Google Cloud Filestore NFS Browser

Google Cloud Filestore NFS Browser

Browses, searches and reads files and POSIX metadata on Filestore NFS shares without local NFS clients or root, using a Cloud Run bridge or jump host. Read only.

Skill files15 files

references/

scripts/

scripts/bridge_server/

SKILL.md288 lines
1
---
2
name: google-cloud-filestore-nfs-browser
3
metadata:
4
version: "1.0.3"
5
category: Storage
6
description: >-
7
Inspects, searches, and reads files and POSIX metadata on Filestore (NFS)
8
instances on Google Cloud without local NFS client packages or root
9
privileges. Use when browsing Filestore shares, searching files, reading
10
remote logs, or inspecting file attributes; don't use for Cloud Storage
11
buckets, Cloud NetApp Volumes, Persistent Disks, or modifying/deleting files.
12
---
13
14
# Filestore NFS File Browser
15
16
Enables autonomous agents and cloud engineers to inspect, search, and read files
17
located on Filestore (NFS) instances without needing local NFS
18
client packages (`nfs-common`), root privileges, or manual VPC network mounting.
19
20
## Quick Start
21
22
1. Ensure `gcloud` is installed and authenticated. See
23
[gcloud installation guide](https://cloud.google.com/sdk/docs/install) if
24
needed.
25
2. Enable essential APIs:
26
27
```bash
28
gcloud services enable file.googleapis.com compute.googleapis.com run.googleapis.com --quiet
29
```
30
3. Discover instances and choose an execution engine (see
31
[Execution Engine Selection](#execution-engine-selection) below).
32
4. Run inspection actions using the self-contained runner
33
`scripts/nfs_browser.py` included within this skill package.
34
35
## Usage Attribution
36
37
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
38
MUST read and follow the instructions in
39
[Usage Attribution](references/attribution.md).
40
41
## Conceptual & Informational Queries (CRITICAL)
42
43
For purely conceptual, educational, or architectural questions (e.g., "How do I
44
inspect files on Filestore?", "How to deploy the Serverless Cloud Run NFS
45
Bridge?", "Explain Cloud Run NFS volume mounts"):
46
47
* **Rule**: **Answer immediately using your pre-trained knowledge and the
48
documentation below.** Answering directly minimizes tool invocation latency
49
and token consumption when the user only seeks architecture or workflow
50
guidance.
51
* **Constraint**: **Do not execute external tool calls or API requests** for
52
basic knowledge questions.
53
* **Bridge Deployment Explanations**: Always highlight that Cloud Run scales
54
to zero with **$0 idle compute cost**, detail the `gcloud run deploy`
55
command with `--add-volume` and `--vpc-egress=all-traffic`, and specify the
56
required IAM permissions (`roles/run.invoker` for callers and
57
`roles/run.admin` for deployers).
58
59
## Handling "No-Command" Constraints (CRITICAL)
60
61
If the user prompt contains constraints like "Do not execute commands", "don't
62
run any commands", "without executing", or "read-only":
63
64
* **Rule**: **Strictly NEVER invoke the `run_command` tool** for any reason
65
(do NOT run `gcloud`, `python3`, `ls`, or any local/remote shell command,
66
including read-only directory listings or discovery checks).
67
* **Discovery**:
68
1. Check if mock definitions or instance parameters are provided directly
69
in the user's prompt, conversation history, or local documentation
70
files.
71
2. Read [Usage Attribution](references/attribution.md), explain the
72
required steps, output the exact terminal commands with proper
73
attribution, and explain what the commands do.
74
3. Do not attempt to read or search `EVAL.*` configuration files during
75
evaluations as access to eval suites is restricted.
76
77
## Execution Engine Selection
78
79
Filestore instances are accessible via private VPC IPs. Select the engine
80
matching your environment:
81
82
* **Engine 1: Cloud Run Serverless Bridge (Primary)**: Use
83
`--bridge-url={bridge_url}` for low-latency (sub-50ms) REST calls. Scales to
84
zero ($0 idle cost). Requires `roles/run.invoker`. See
85
[references/nfs-bridge-setup.md](references/nfs-bridge-setup.md).
86
* **Engine 2: GCE Jump Host via IAP SSH (Fallback)**: Use
87
`--jump-host-vm={vm_name}` when an existing VM in the VPC is available. Pass
88
`--mount={mount_path}` (defaulting to `/mnt/filestore`) if the jump host
89
uses a different mount path. Zero new deployment needed. Requires
90
`roles/iap.tunnelResourceAccessor`. See
91
[references/iap-jump-host.md](references/iap-jump-host.md).
92
93
For execution flows, architecture diagrams, and engine comparison, see
94
[references/architecture.md](references/architecture.md).
95
96
## Core Operational Workflow
97
98
### 1. Discovery & Instance Targeting
99
100
If the Filestore instance, location, or share name is not provided, list them
101
first to avoid querying or targeting unrelated projects in multi-project
102
environments:
103
104
```bash
105
gcloud filestore instances list --project={project_id}
106
```
107
108
* **Always Include Instance, Project & Path**: Every `scripts/nfs_browser.py`
109
command and written response MUST explicitly include
110
`--project={project_id}`, `--instance={instance_id}`, and `--path={path}`,
111
naming the target Filestore instance ID (`{instance_id}`), project
112
(`{project_id}`), and path (`{path}`) explicitly in the explanation.
113
* **Fast Fallback When Live Access or Engine Flag Is Unavailable**: If a
114
`gcloud` check returns `PERMISSION_DENIED` or `NOT_FOUND`, or if neither
115
`--bridge-url` nor `--jump-host-vm` is configured, stop retrying immediately
116
(do NOT read `scripts/*.py` source files to debug flags) and provide the
117
exact `scripts/nfs_browser.py` command with `--project={project_id}`,
118
`--instance={instance_id}`, `--path={path}`, and `--bridge-url` /
119
`--jump-host-vm` placeholders.
120
121
### 2. Directory Tree Exploration (`tree`)
122
123
Renders a clean, structured directory tree with file types, human-readable
124
sizes, and modification dates.
125
126
```bash
127
# List top-level folders with depth 1
128
python3 scripts/nfs_browser.py tree \
129
--project={project_id} \
130
--instance={instance_id} \
131
--path=/ \
132
--depth=1
133
134
# List subfolder recursively with depth 2 and pagination cap
135
python3 scripts/nfs_browser.py tree \
136
--project={project_id} \
137
--instance={instance_id} \
138
--path=/backup/logs/ \
139
--depth=2 \
140
--max-entries=100
141
```
142
143
### 3. File Pattern & Content Grep (`search`)
144
145
Searches for filenames matching a glob pattern and/or searches text contents for
146
regex patterns.
147
148
```bash
149
# Search for all tar.gz backup archives
150
python3 scripts/nfs_browser.py search \
151
--project={project_id} \
152
--instance={instance_id} \
153
--path=/backups/ \
154
--pattern="*.tar.gz"
155
156
# Grep for error patterns inside log files
157
python3 scripts/nfs_browser.py search \
158
--project={project_id} \
159
--instance={instance_id} \
160
--path=/app/logs/ \
161
--pattern="*.log" \
162
--grep="FATAL|Exception|OutOfMemory" \
163
--max-results=25
164
```
165
166
### 4. Chunked File Reading (`read`)
167
168
Safely reads text file chunks to protect the LLM context window against token
169
blowup. Always default to a safe chunk size (e.g., `--head 50` or `--tail 50`)
170
when the user does not specify an explicit range. Unbounded reads are
171
automatically capped to a safe limit of 100 lines. Always explicitly explain
172
that chunked reading protects the LLM context window from overflow and token
173
exhaustion.
174
175
```bash
176
# Read the last 50 lines (tail) of a log file
177
python3 scripts/nfs_browser.py read \
178
--project={project_id} \
179
--instance={instance_id} \
180
--path=/backup/logs/app.log \
181
--tail=50
182
183
# Read lines 100 to 200 of a config file
184
python3 scripts/nfs_browser.py read \
185
--project={project_id} \
186
--instance={instance_id} \
187
--path=/config/settings.yaml \
188
--lines=100:200
189
190
# Read the first 30 lines (head)
191
python3 scripts/nfs_browser.py read \
192
--project={project_id} \
193
--instance={instance_id} \
194
--path=/var/log/syslog \
195
--head=30
196
```
197
198
### 5. File Metadata & Attribute Inspection (`stat`)
199
200
Inspects POSIX permissions (`0644`), UID/GID, byte sizes, and timestamps.
201
202
```bash
203
python3 scripts/nfs_browser.py stat \
204
--project={project_id} \
205
--instance={instance_id} \
206
--path=/backup/database_dump.tar.gz
207
```
208
209
## Context Window & LLM Safety Rules
210
211
1. **Strictly Read-Only Guarantee**: This skill is strictly read-only. It
212
provides no write, edit, delete, or truncate capabilities.
213
2. **Never Dump Entire Large Files**: Always request a slice (`--lines`), head
214
(`--head 50`), or tail (`--tail 50`) and explicitly explain that chunked
215
reading protects the LLM context window against token overflow and client
216
timeouts.
217
3. **Handle Pagination**: Tree listings are capped at 100 entries per response.
218
When truncated, the tool outputs a clear `[TRUNCATED]` notice so the agent
219
can target specific subpaths.
220
4. **Binary Protection**: Non-text files (e.g. `.tar.gz`, `.iso`, `.so`,
221
compiled binaries) are detected via null-byte and magic-byte inspection; raw
222
binary output is suppressed and metadata is displayed instead to prevent
223
context corruption with non-printable characters.
224
5. See
225
[references/token-safety-guardrails.md](references/token-safety-guardrails.md)
226
for full token guardrail details.
227
228
## Expected Errors & Recovery Strategies
229
230
| Error Type / | Root Cause | Recovery Strategy |
231
: Symptom : : :
232
| :------------------ | :----------------- | :------------------------------------------ |
233
| `FileNotFoundError: | Path does not | Run `tree --path=/ --depth=2` to discover |
234
: File not found` : exist on the NFS : valid directory hierarchies. :
235
: : export. : :
236
| `PermissionError: | Share POSIX | Use `stat --path={path}` to inspect UID/GID |
237
: Permission denied` : permissions : and mode bits; request share admin adjust :
238
: : restrict read : permissions. :
239
: : access. : :
240
| `HTTPException: 403 | Path parameter | Use clean paths (e.g. `/logs/app.log`) |
241
: Access denied\: : contains `../` or : anchored to the NFS mount root. :
242
: path traversal` : a symlink : :
243
: : attempting escape : :
244
: : outside mount : :
245
: : point. : :
246
| `Jump Host | VM is stopped or | Verify VM status with `gcloud compute |
247
: connection timed : IAP firewall rule : instances list` and verify firewall rules :
248
: out / SSH failed` : (`tcp\:22` from : allow `tcp\:22` from the specific IAP :
249
: : `35.235.240.0/20`) : netblock `35.235.240.0/20` (e.g., `gcloud :
250
: : is missing. : compute firewall-rules list :
251
: : : --filter="sourceRanges\:35.235.240.0/20"`). :
252
| `Bridge 404 / | Cloud Run bridge | Deploy bridge using |
253
: connection error` : not deployed or : `scripts/deploy_bridge.sh` or fall back to :
254
: : URL invalid. : GCE IAP Jump Host via `--jump-host`. :
255
256
## Reference Directory
257
258
For progressive disclosure of deeper topics, consult the `references/`
259
directory:
260
261
- [Usage Attribution](references/attribution.md)
262
- [Multi-Engine Architecture & Execution Flow](references/architecture.md)
263
- [Serverless NFS Bridge Setup Guide](references/nfs-bridge-setup.md)
264
- [GCE Jump Host IAP SSH Guide](references/iap-jump-host.md)
265
- [Token Safety & Context Guardrails](references/token-safety-guardrails.md)
266
- [Troubleshooting & Common Errors](references/troubleshooting.md)
267
268
## Bundled Scripts & Components
269
270
The skill package bundles the following scripts and service components:
271
272
- `scripts/nfs_browser.py`: Main CLI entrypoint for browsing, searching,
273
reading, and stating NFS exports.
274
- `scripts/formatters.py`: Output formatters for human-readable terminal
275
rendering and token-safe summaries.
276
- `scripts/jump_host_engine.py`: Remote SSH jump host execution engine via
277
Google Cloud IAP tunnel.
278
- `scripts/nfs_browser_test.py`: Comprehensive unit test suite covering
279
formatters, HTTP bridge, and SSH jump host engines.
280
- `scripts/deploy_bridge.sh`: Automated Cloud Run deployment script for the
281
Serverless NFS Bridge.
282
- `scripts/bridge_server/main.py`: FastAPI Cloud Run server implementation for
283
direct NFS mounts.
284
- `scripts/bridge_server/Dockerfile`: Container definition for packaging the
285
Serverless NFS Bridge.
286
- `scripts/bridge_server/requirements.txt`: Python dependencies for the Cloud
287
Run bridge service.
288

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…