Skip to content

Commit 8e7db69

Browse files
committed
feat: add workspace files skill
1 parent bd22424 commit 8e7db69

3 files changed

Lines changed: 159 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ Native plugin installs expose the skills under the `sim` namespace:
7373
- `sim:build-workflow`
7474
- `sim:run-workflow`
7575
- `sim:deploy-workflow`
76+
- `sim:files`
7677
- `sim:table`
7778
- `sim:knowledge-base`
79+
- `sim:run-tool`
7880

7981
Direct installs through `bunx sim-skills` install the selected skills without the plugin prefix.
8082

@@ -83,7 +85,9 @@ Direct installs through `bunx sim-skills` install the selected skills without th
8385
- `build-workflow` — discover blocks and author a draft graph with atomic workflow operations.
8486
- `run-workflow` — test saved state, exercise triggers, resume from a block, and diagnose runs.
8587
- `deploy-workflow` — publish and manage workflows as APIs, chats, or MCP tools.
88+
- `files` — organize workspace files and folders, read and search text, and apply targeted edits.
8689
- `table` — design typed tables, load and query rows, import data, and run workflow groups.
8790
- `knowledge-base` — ingest and index documents, configure connectors and tags, and verify retrieval.
91+
- `run-tool` — call one integration tool directly with Sim-managed credentials.
8892

8993
The skills assume the `sim` CLI is installed and authenticated. They never store or print API keys.

scripts/validate-skills.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const pluginName = "sim";
1313
const expectedSkillNames = [
1414
"build-workflow",
1515
"deploy-workflow",
16+
"files",
1617
"knowledge-base",
1718
"run-tool",
1819
"run-workflow",

skills/files/SKILL.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
name: files
3+
description: Manage Sim workspace files and folders through the sim CLI. Use when listing, uploading, reading, searching, moving, renaming, sharing, restoring, or making exact or anchor-based edits to workspace files; not for knowledge-base ingestion or local filesystem edits.
4+
---
5+
6+
# Manage Sim Workspace Files
7+
8+
Use server-side folder, search, and edit operations instead of downloading a workspace tree or
9+
rewriting a whole file when a narrower operation expresses the request.
10+
11+
## Establish context
12+
13+
- Use the profile the user named. If none was named, inspect configured profiles and current
14+
context; do not silently switch accounts, workspaces, or API origins.
15+
- Start with `sim --output json files ls [path]` when navigating files and child folders together.
16+
Use `files list` for file-only filtering and `files folders list` for folder-only traversal.
17+
- Keep file ids returned by list, upload, and create operations. File mutations use the id, not a
18+
name or path that could identify several files.
19+
- Read `sim files --help` and the relevant subcommand help when the installed CLI may differ from
20+
these instructions. Do not guess a newly introduced flag.
21+
22+
Folder paths use the same slash-delimited form shown in the app; the leading slash is optional. The
23+
CLI encodes individual path segments, so pass the displayed path rather than percent-encoding it.
24+
25+
## Scope discovery on the server
26+
27+
List one folder without descendants:
28+
29+
```bash
30+
sim --output json files list --folder "Reports/2026" --no-recursive
31+
```
32+
33+
Add `--recursive` when descendants belong in the result. With `files list`, recursion defaults to
34+
false for an ordinary folder listing and true when `--search` is present. With no `--folder`, the
35+
list already spans the workspace and a recursion flag has no effect.
36+
37+
Search file names with `files list --search`. Search text contents with `files search`:
38+
39+
```bash
40+
sim --output json files search \
41+
--query "invoice_[0-9]+" --mode regex \
42+
--folder "Reports" "Exports" --include-subfolders
43+
```
44+
45+
`--folder` on `files search` accepts several folder paths. Omit it to search the whole workspace.
46+
Use `--mode exact` for literal text and `--no-include-subfolders` when only the selected folders
47+
should be searched. Do not fetch every file and search locally when the server-side query suffices.
48+
49+
## Create and organize deliberately
50+
51+
Upload a local file or create textual content directly:
52+
53+
```bash
54+
sim --output json files upload ./report.csv --folder "Reports/2026"
55+
sim --output json files create --name notes.md --folder "Reports/2026" --content "# Notes"
56+
```
57+
58+
Create nested folders with `files mkdir <path>` or `files folders create <path>`. Move or rename a
59+
folder atomically with `files folders move <path> <destination>`. Move known files with
60+
`files move --file-ids <id...> --to <folder>`; omit `--to` to move them to the workspace root.
61+
62+
File names are leaf names, not paths. Use `files rename <fileId> --name <name>` to change one and
63+
`files move` to change its folder. Do not place path separators or dot segments in a file name.
64+
65+
## Read before editing
66+
67+
For textual work, inspect only the needed lines:
68+
69+
```bash
70+
sim --output json files read <fileId> --offset 1 --limit 200
71+
```
72+
73+
`files read` extracts text and supports line windows. Use `files get <fileId> --output-file <path>`
74+
when the original bytes are needed. Use `files describe <fileId>` for metadata and sharing status.
75+
76+
Apply one targeted edit with `files edit <fileId> --edit <json|@file>`. Prefer `@path` or `@-` for
77+
multiline content or payloads that are awkward to shell-quote.
78+
79+
### Exact replacement
80+
81+
```json
82+
{
83+
"mode": "search_replace",
84+
"search": "old text",
85+
"content": "new text",
86+
"replaceAll": false
87+
}
88+
```
89+
90+
Without `replaceAll`, the search must occur exactly once. Set `replaceAll` to true only when every
91+
exact occurrence should change. An empty `content` deletes the matched text.
92+
93+
### Anchor-based edits
94+
95+
Anchors match complete lines after trimming surrounding whitespace. They are not substrings or
96+
regular expressions. `occurrence`, when supplied, is 1-based and selects among repeated valid
97+
matches.
98+
99+
Replace the lines between two retained anchors:
100+
101+
```json
102+
{
103+
"mode": "replace_between",
104+
"beforeAnchor": "BEGIN GENERATED",
105+
"afterAnchor": "END GENERATED",
106+
"content": "replacement lines",
107+
"occurrence": 1
108+
}
109+
```
110+
111+
Insert immediately after a retained anchor:
112+
113+
```json
114+
{
115+
"mode": "insert_after",
116+
"anchor": "## Changelog",
117+
"content": "- Added workspace file editing",
118+
"occurrence": 1
119+
}
120+
```
121+
122+
Delete from the start anchor through the line before the retained end anchor:
123+
124+
```json
125+
{
126+
"mode": "delete_between",
127+
"startAnchor": "BEGIN OBSOLETE",
128+
"endAnchor": "END OBSOLETE",
129+
"occurrence": 1
130+
}
131+
```
132+
133+
Use `files set-content` only when complete replacement is intentional. A targeted edit preserves
134+
unrelated content and reduces stale-read overwrites. If an edit is rejected because the source
135+
changed concurrently, read the current file and recompute the edit; do not replay the stale write.
136+
137+
## Treat deletion and sharing as explicit effects
138+
139+
File and folder deletion requires `--yes` and is soft-delete where the surface supports restore.
140+
Use `files list --scope archived` or `files folders list --scope archived` to find deleted items,
141+
then restore by exact file id or folder path. A recursive folder delete affects descendants, so use
142+
it only when the requested scope is clear.
143+
144+
Before changing a share, inspect it with `files share get <fileId>`. `files share set` requires a
145+
personal API-key profile. Do not expose share passwords, profile credentials, or unrelated file
146+
content in output.
147+
148+
## Verify and report
149+
150+
After a mutation, read the exact file, folder listing, metadata, or share state that proves the
151+
requested outcome. For edits, verify the affected region and enough surrounding lines to confirm
152+
the anchors and unrelated content remain correct. Report the file id, folder path, and operation
153+
performed, plus any concurrency or authorization error. Do not claim an accepted upload, move, or
154+
edit succeeded without checking the returned result.

0 commit comments

Comments
 (0)