@dhzh/foundry 9.1.1 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -117,6 +117,7 @@ and files use `0700` and `0600` permissions.
117
117
 
118
118
  ```bash
119
119
  foundry skills create local ./my-skill
120
+ foundry skills create local ./skills-collection
120
121
  foundry skills create local ./collection.zip
121
122
  foundry skills create local ./example.skill
122
123
  ```
@@ -125,12 +126,14 @@ Pass one source path, absolute or relative to the current directory. The CLI
125
126
  reads it directly without opening a picker or starting the Web server. The
126
127
  same service and validation as Web import apply:
127
128
 
128
- - A folder must contain `SKILL.md` directly at its root; its whole tree is one Skill.
129
- - An archive with root `SKILL.md` is one Skill. Otherwise, only its immediate
130
- child folders are candidates; each must have its own root `SKILL.md`.
129
+ - A folder or archive with root `SKILL.md` is one Skill, including its complete
130
+ resource tree. Root entry presence takes priority even if its metadata is invalid.
131
+ - Without root `SKILL.md`, only immediate child folders are candidates; each must
132
+ have its own root `SKILL.md`. Root files are ignored; grandchildren are never
133
+ discovered as separate Skills.
131
134
  - Metadata `name` determines the destination under `~/.foundry/skills`.
132
135
  Existing destinations are never overwritten. Standalone `.md` files are rejected.
133
- - In archive collection mode, invalid or conflicting candidates are skipped;
136
+ - In collection mode, invalid, unreadable, or conflicting candidates are skipped;
134
137
  other candidates continue. The CLI does not search deeper for Skills.
135
138
 
136
139
  Success prints `{ "imported": [...], "skipped": [...] }`. Imported items are
@@ -141,6 +144,34 @@ unreadable/corrupt archive prints the JSON error envelope on stderr and exits
141
144
  with code 1. Original files, resources, extra metadata, and empty directories
142
145
  are preserved. Import does not assign Skills to agents.
143
146
 
147
+ ## Import from a URL
148
+
149
+ ```bash
150
+ foundry skills create url https://example.com/example.skill
151
+ foundry skills create url https://example.com/collection.zip
152
+ foundry skills create url https://example.com/SKILL.md
153
+ ```
154
+
155
+ Pass a direct HTTP or HTTPS file URL without embedded credentials. Foundry
156
+ follows up to five redirects and downloads the file itself; no Web server is
157
+ needed. The final URL filename or download response's `Content-Disposition`
158
+ filename must be `.skill`, `.zip`, or exactly `SKILL.md`. Query parameters are
159
+ allowed. Use a raw file link rather than a GitHub file preview or directory
160
+ page; for folders, supply a ZIP download URL.
161
+
162
+ Archives follow the local import rules above, including collection discovery,
163
+ skipped candidates, conflicts, and JSON results. A standalone `SKILL.md` creates
164
+ one Skill using its YAML `name` and `description`; the directory name comes from
165
+ `name`, and all original file bytes and extra metadata are preserved. Only that
166
+ file is downloaded, so use an archive when the Skill needs sibling resources.
167
+ Existing names are never overwritten and import does not assign agents.
168
+
169
+ Downloads have a 30-second timeout and a 32 MiB limit; expanded archives also
170
+ have the local import limits. Standalone `SKILL.md` is limited to 2 MiB. Invalid
171
+ URLs, HTML pages, unsupported filenames, download errors, invalid metadata,
172
+ and single-Skill conflicts fail with a JSON error on stderr and exit code 1.
173
+ Fix the link or download the source and use local import after a network error.
174
+
144
175
  ## Edit metadata
145
176
 
146
177
  ```bash
@@ -179,22 +210,26 @@ foundry agents skills unassign chatgpt --skill hello
179
210
  `list` returns an array of registered Skill agents with `id`, `name`, `icon`,
180
211
  `directory`, and saved `skillNames`; the optional agent ID filters the array.
181
212
  It shows persisted assignments even if a link was removed externally.
182
- `assign` and `unassign` operate on one existing Skill and preserve other
183
- assignments. Both print `{ "name": "hello", "agentIds": [...] }` describing
184
- that Skill's remaining assigned agents. Repeated assignment repairs a missing
185
- link without duplication; repeated unassignment is safe. Targets and help
186
- come from the agent registry. Skill assignment is independent of instruction
187
- application and takes effect immediately, without a separate enable command.
188
-
189
- Assignment creates
190
- a directory symlink in that registered agent's Skill directory; deselection
191
- unlinks only entries pointing to the current source. The UI reads saved
192
- `skills.skillNames` from each agent profile at
193
- `~/.foundry/agents/<agent-id>.json`. Existing links are imported once for a
194
- profile without Skill state. External link removal leaves the saved assignment
195
- intact; assigning again or editing the Skill repairs a missing link. Available targets
196
- come from the registry's Skills capability; the Instructions apply switch does
197
- not control Skill availability.
213
+ `assign` requires an existing library Skill. It adds its name once to the
214
+ selected agent record and creates a directory symlink at
215
+ `<agent-skill-directory>/<skill-name>`. An existing entry at that exact name
216
+ is replaced, including files, directories, stale links, and dangling links.
217
+ Other names and agents stay unchanged. Link replacement never deletes a
218
+ symlink's target directory.
219
+
220
+ `unassign` removes the name from the selected saved record and unlinks any
221
+ same-name symbolic link, regardless of its target. Missing links, saved names,
222
+ and library sources succeed; ordinary files and directories remain intact.
223
+ Repeated assign/unassign is safe. Both print `{ "name": "hello", "agentIds": [...] }`
224
+ describing that Skill's remaining saved assignments. These writes operate on
225
+ saved JSON directly rather than importing other external links.
226
+
227
+ The UI reads saved `skills.skillNames` from each agent profile at
228
+ `~/.foundry/agents/<agent-id>.json`. Reading assignments imports existing matching
229
+ links once for a profile without Skill state. External link removal leaves a
230
+ saved assignment intact; assigning again repairs or replaces its named entry.
231
+ Targets come from the registry's Skills capability. Skill assignment takes
232
+ effect immediately and is independent of the Instructions apply switch.
198
233
 
199
234
  Each edit creates or refreshes directory symlinks only for saved assigned
200
235
  agents. This includes edits to description only and missing links for those
@@ -226,8 +261,9 @@ for filesystem behavior and official agent references.
226
261
  - `SKILL_NAME_CONFLICT`: the destination already exists. Create/edit flows require
227
262
  another name; import leaves the existing directory, including an incomplete
228
263
  skill directory, untouched.
229
- - `SKILL_LINK_CONFLICT`: an unrelated entry occupies a registered agent
230
- destination. Preserve that entry and resolve the conflict before retrying.
264
+ - `SKILL_LINK_CONFLICT`: a destination blocks metadata synchronization or rename,
265
+ or an agent directory aliases the library source itself. Resolve that conflict
266
+ before retrying. Explicit assign replaces normal same-name agent entries.
231
267
  - `SKILL_AGENT_NOT_FOUND`: the agent is not registered with Skills support.
232
268
  - Missing required flags produce CLI argument errors.
233
269
  - `skills save` rejects malformed JSON and invalid file trees with the same
@@ -235,8 +271,8 @@ for filesystem behavior and official agent references.
235
271
  indicate an invalid `--file` path. Operation errors use the JSON error
236
272
  envelope on stderr and exit with code 1.
237
273
 
238
- CLI creation supports `manual` and `local`. The Web UI also supports local
239
- import; URL import remains a placeholder. Creation does not distribute the Skill;
274
+ CLI creation supports `manual`, `local`, and `url`. The Web UI supports the
275
+ same creation sources. Creation does not distribute the Skill;
240
276
  editing refreshes assigned agent links. Skill sources and assignments are
241
277
  included in version-4 encrypted backups with complete source files and resources.
242
278
  Import replaces source files first; Agent configuration is applied only by the
@@ -250,8 +286,11 @@ a native picker on the computer running Foundry. Select
250
286
  one folder or one `.skill` / `.zip` archive. Standalone Markdown files and
251
287
  multiple selection are not supported.
252
288
 
253
- - A selected folder must contain `SKILL.md` directly at its root. The complete
254
- folder is one Skill; its children are resources, not additional candidates.
289
+ - A selected folder with root `SKILL.md` is one Skill, including its entire
290
+ resource tree. Without root `SKILL.md`, only its immediate child folders are
291
+ checked as candidates; each needs its own root `SKILL.md`. Invalid, unreadable,
292
+ or conflicting candidates are skipped. Root files are ignored and discovery
293
+ never descends to grandchildren.
255
294
  - An archive with root `SKILL.md` is one Skill. Its frontmatter `name` determines
256
295
  the destination directory, independent of the archive filename.
257
296
  - An archive without root `SKILL.md` checks each immediate child folder as a
@@ -267,7 +306,8 @@ the source directly; file contents never pass through the browser.
267
306
  Import validates each candidate before writing it. Invalid UTF-8/frontmatter,
268
307
  unsafe or duplicate paths, and symbolic links are rejected. Archive corruption,
269
308
  unsafe archive paths, or archive-wide limits abort the request before any import.
270
- Sources support at most 5,000 entries and 32 MiB of expanded file contents;
309
+ Source-wide entry and byte limits are checked before any import, including
310
+ folder collections. Sources support at most 5,000 entries and 32 MiB of file contents;
271
311
  Skill paths support 32 levels and `SKILL.md` is limited to 2 MiB. An occupied
272
312
  destination is never overwritten. Each accepted Skill uses its own recovery
273
313
  transaction; rejected candidates do not undo other successful imports. Import
@@ -276,18 +316,31 @@ does not assign Skills to agents.
276
316
  `POST /api/skills/import/local` accepts JSON `{ "path": "/absolute/source/path" }`.
277
317
  It returns `{ imported: Skill[], skipped: [{ source, code, message }] }` with
278
318
  HTTP 201 when any Skill was imported, or HTTP 200 when every candidate was
279
- skipped. A source with no candidates is invalid. Missing/unreadable sources use
319
+ skipped. A source with no child folder candidates is invalid. Missing/unreadable sources use
280
320
  `SKILL_IMPORT_READ_FAILED` (400). Single-Skill validation errors use specific
281
321
  `SKILL_IMPORT_*` codes (400), total-size errors use `SKILL_IMPORT_TOO_LARGE`
282
322
  (413), `SKILL.md` over 2 MiB uses `SKILL_IMPORT_SKILL_MD_TOO_LARGE` (413), and
283
- occupied names use `SKILL_NAME_CONFLICT` (409). In archive collection mode,
284
- candidate validation and conflict errors appear in `skipped` instead.
323
+ occupied names use `SKILL_NAME_CONFLICT` (409). In collection mode,
324
+ candidate validation, read, and conflict errors appear in `skipped` instead.
285
325
 
286
326
  The Web UI shows imported/skipped counts and skipped folder names. One successful
287
327
  Skill with no skipped items opens its detail page; collections and partial
288
328
  results stay in the refreshed library list. Cancelling the picker sends no
289
329
  business request.
290
330
 
331
+ Use **New skill → Import from URL** to enter a direct file URL. The backend
332
+ performs the download. URL validation disables submission until an HTTP(S) URL
333
+ without embedded credentials is entered. The dialog prevents duplicate submits
334
+ and closure during download; errors retain the input for retry. Import uses the
335
+ same result notifications and navigation as local import.
336
+
337
+ `POST /api/skills/import/url` accepts JSON `{ "url": "https://example.com/SKILL.md" }`
338
+ and returns the same result and statuses as local import. URL-specific failures
339
+ use HTTP 400: `SKILL_IMPORT_INVALID_URL`, `SKILL_IMPORT_UNSUPPORTED_URL_FILE`,
340
+ `SKILL_IMPORT_DOWNLOAD_FAILED`, and `SKILL_IMPORT_DOWNLOAD_TIMEOUT`.
341
+ Download and expanded-content size failures use the existing 413 codes.
342
+ Downloads are bounded in memory and do not leave temporary files.
343
+
291
344
  At `#/library/skills`, select **New skill → Create manually**, enter the same
292
345
  metadata, and submit. Success opens `#/library/skills/<name>`. The detail page
293
346
  has file navigation on the left and a Monaco source editor on the right,