iskills 0.2.60 → 0.2.63
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.
- package/AGENT-CLI.md +63 -0
- package/README.md +24 -17
- package/README.zh-CN.md +24 -17
- package/bin/command-route.mjs +15 -0
- package/bin/iskills.js +14 -7
- package/dist/src/cli.js +4 -12
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/agent/arguments.d.ts +10 -0
- package/dist/src/commands/agent/arguments.js +60 -0
- package/dist/src/commands/agent/arguments.js.map +1 -0
- package/dist/src/commands/agent/index.d.ts +1 -0
- package/dist/src/commands/agent/index.js +778 -0
- package/dist/src/commands/agent/index.js.map +1 -0
- package/dist/src/commands/browser-actions.js +42 -12
- package/dist/src/commands/browser-actions.js.map +1 -1
- package/dist/src/commands/create.js +3 -3
- package/dist/src/commands/create.js.map +1 -1
- package/dist/src/commands/index.d.ts +0 -3
- package/dist/src/commands/index.js +0 -33
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/library.d.ts +1 -0
- package/dist/src/commands/library.js +82 -120
- package/dist/src/commands/library.js.map +1 -1
- package/dist/src/commands/mcp.d.ts +1 -3
- package/dist/src/commands/mcp.js +7 -240
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/domain/agent-collection-write.d.ts +2 -0
- package/dist/src/domain/agent-collection-write.js +204 -0
- package/dist/src/domain/agent-collection-write.js.map +1 -0
- package/dist/src/domain/agent-mcp-write.d.ts +23 -0
- package/dist/src/domain/agent-mcp-write.js +927 -0
- package/dist/src/domain/agent-mcp-write.js.map +1 -0
- package/dist/src/domain/agent-read.d.ts +38 -0
- package/dist/src/domain/agent-read.js +524 -0
- package/dist/src/domain/agent-read.js.map +1 -0
- package/dist/src/domain/agent-skill-write.d.ts +34 -0
- package/dist/src/domain/agent-skill-write.js +926 -0
- package/dist/src/domain/agent-skill-write.js.map +1 -0
- package/dist/src/domain/agent-write.d.ts +9 -0
- package/dist/src/domain/agent-write.js +127 -0
- package/dist/src/domain/agent-write.js.map +1 -0
- package/dist/src/domain/collection-write.d.ts +9 -2
- package/dist/src/domain/collection-write.js +175 -36
- package/dist/src/domain/collection-write.js.map +1 -1
- package/dist/src/domain/core.d.ts +12 -0
- package/dist/src/domain/core.js +57 -2
- package/dist/src/domain/core.js.map +1 -1
- package/dist/src/domain/cross-agent-install.js +3 -5
- package/dist/src/domain/cross-agent-install.js.map +1 -1
- package/dist/src/domain/errors.d.ts +1 -0
- package/dist/src/domain/errors.js +3 -0
- package/dist/src/domain/errors.js.map +1 -1
- package/dist/src/domain/git.d.ts +28 -2
- package/dist/src/domain/git.js +233 -84
- package/dist/src/domain/git.js.map +1 -1
- package/dist/src/domain/install-target.js +10 -1
- package/dist/src/domain/install-target.js.map +1 -1
- package/dist/src/domain/mcp/collection.d.ts +3 -0
- package/dist/src/domain/mcp/collection.js +26 -4
- package/dist/src/domain/mcp/collection.js.map +1 -1
- package/dist/src/domain/mcp/dialects/borrow.js +1 -5
- package/dist/src/domain/mcp/dialects/borrow.js.map +1 -1
- package/dist/src/domain/mcp/index.d.ts +1 -1
- package/dist/src/domain/mcp/index.js +1 -1
- package/dist/src/domain/mcp/index.js.map +1 -1
- package/dist/src/domain/mcp/io.js +1 -1
- package/dist/src/domain/mcp/io.js.map +1 -1
- package/dist/src/domain/mcp/location-write.d.ts +3 -0
- package/dist/src/domain/mcp/location-write.js +39 -0
- package/dist/src/domain/mcp/location-write.js.map +1 -0
- package/dist/src/domain/mcp/probe.d.ts +2 -0
- package/dist/src/domain/mcp/probe.js +2 -1
- package/dist/src/domain/mcp/probe.js.map +1 -1
- package/dist/src/domain/mcp/recipe.d.ts +1 -1
- package/dist/src/domain/mcp/recipe.js +6 -5
- package/dist/src/domain/mcp/recipe.js.map +1 -1
- package/dist/src/domain/mcp/secrets.js +12 -11
- package/dist/src/domain/mcp/secrets.js.map +1 -1
- package/dist/src/domain/mcp/types.d.ts +2 -0
- package/dist/src/domain/mcp/write.js +49 -35
- package/dist/src/domain/mcp/write.js.map +1 -1
- package/dist/src/domain/operation.d.ts +30 -0
- package/dist/src/domain/operation.js +107 -0
- package/dist/src/domain/operation.js.map +1 -0
- package/dist/src/domain/process.d.ts +3 -0
- package/dist/src/domain/process.js +81 -0
- package/dist/src/domain/process.js.map +1 -0
- package/dist/src/domain/tags.d.ts +11 -0
- package/dist/src/domain/tags.js +42 -0
- package/dist/src/domain/tags.js.map +1 -0
- package/dist/src/domain/user-config.js +9 -1
- package/dist/src/domain/user-config.js.map +1 -1
- package/dist/src/i18n/en.js +55 -29
- package/dist/src/i18n/en.js.map +1 -1
- package/dist/src/i18n/zh.d.ts +56 -30
- package/dist/src/i18n/zh.js +56 -30
- package/dist/src/i18n/zh.js.map +1 -1
- package/dist/src/ui/browser/browse-capabilities.js +7 -1
- package/dist/src/ui/browser/browse-capabilities.js.map +1 -1
- package/dist/src/ui/browser/browse-session.d.ts +2 -0
- package/dist/src/ui/browser/browse-session.js +4 -0
- package/dist/src/ui/browser/browse-session.js.map +1 -1
- package/dist/src/ui/browser/browser.js +41 -12
- package/dist/src/ui/browser/browser.js.map +1 -1
- package/dist/src/ui/browser/index.js +3 -1
- package/dist/src/ui/browser/index.js.map +1 -1
- package/dist/src/ui/browser/types.d.ts +6 -0
- package/dist/src/ui/footer/resolve-footer.js +3 -0
- package/dist/src/ui/footer/resolve-footer.js.map +1 -1
- package/dist/src/ui/footer/types.d.ts +1 -0
- package/dist/src/ui/import/review.d.ts +2 -1
- package/dist/src/ui/import/review.js +8 -3
- package/dist/src/ui/import/review.js.map +1 -1
- package/dist/src/ui/import/types.d.ts +1 -0
- package/dist/src/ui/mcp/browse-capabilities.d.ts +1 -0
- package/dist/src/ui/mcp/browse-capabilities.js +1 -0
- package/dist/src/ui/mcp/browse-capabilities.js.map +1 -1
- package/dist/src/ui/mcp/browser.d.ts +2 -1
- package/dist/src/ui/mcp/browser.js +33 -5
- package/dist/src/ui/mcp/browser.js.map +1 -1
- package/dist/src/ui/mcp/index.js +29 -2
- package/dist/src/ui/mcp/index.js.map +1 -1
- package/dist/src/ui/prompts/index.d.ts +1 -1
- package/dist/src/ui/prompts/index.js +1 -1
- package/dist/src/ui/prompts/index.js.map +1 -1
- package/dist/src/ui/prompts/present.d.ts +5 -1
- package/dist/src/ui/prompts/present.js +11 -2
- package/dist/src/ui/prompts/present.js.map +1 -1
- package/dist/src/ui/tui/hooks.js +4 -0
- package/dist/src/ui/tui/hooks.js.map +1 -1
- package/package.json +16 -13
package/AGENT-CLI.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Agent CLI
|
|
2
|
+
|
|
3
|
+
Run `iskills help` for the command tree and `iskills help <command path>` for that command's purpose, positional arguments, options, output format, and exit codes (for example, `iskills help skill import`). Agent commands run under Node, never prompt, and return one JSON document. Human entries are `iskills`, `iskills mcp`, `iskills config`, `iskills search` and `iskills import`.
|
|
4
|
+
|
|
5
|
+
## Skills
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
iskills agents
|
|
9
|
+
iskills skill search review --limit 10
|
|
10
|
+
iskills skill discover --git owner/repository
|
|
11
|
+
iskills skill import --git owner/repository --path skills/review --expect-commit <reviewed-sha> --dry-run
|
|
12
|
+
iskills skill import --git owner/repository --path skills/review --expect-commit <reviewed-sha>
|
|
13
|
+
iskills skill install review --agent codex --scope project --dry-run
|
|
14
|
+
iskills skill install review --agent codex --scope project
|
|
15
|
+
iskills skill show review --body
|
|
16
|
+
iskills skill locations --scope project
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`--project <directory>` sets project context and the base for relative input paths. Install requires explicit Agent/scope or `--to <skill-root>`. Local import moves the source directory into the collection and leaves a symlink; inspect its dry-run first. `--expect-commit` verifies HEAD without changing branch tracking; `source#sha` pins the source.
|
|
20
|
+
|
|
21
|
+
Use `skill create NAME --private`, `skill import ... --private`, or `skill adopt NAME --private` to keep skills out of collection Git. Switch existing skills with `skill edit NAME --private` and restore Git tracking with `skill edit NAME --public`. Private skills remain available locally and are not synced to other machines; previously committed Git history is not erased.
|
|
22
|
+
|
|
23
|
+
Maintenance actions: `create`, `adopt`, `edit`, `tag rename`, `source bind`, `source unbind`, `update`, `remove`, `uninstall`, `materialize`. Names are exact. Uninstall/materialize take the absolute installation paths returned by `skill locations`. Remove/uninstall/source unbind require `--yes`; source replacement requires `--replace`.
|
|
24
|
+
|
|
25
|
+
## MCP
|
|
26
|
+
|
|
27
|
+
Create an input file:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{"recipe":{"transport":"http","url":"https://example.com/mcp","envKeys":[],"headerKeys":["Authorization"]},"description":"Documentation"}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
iskills mcp create docs --input docs.json
|
|
35
|
+
iskills mcp secret set docs --header Authorization --value-file authorization.txt
|
|
36
|
+
iskills mcp add docs --agent claude --scope project
|
|
37
|
+
iskills mcp locations --agent claude --scope project
|
|
38
|
+
iskills mcp disable '<selector-from-locations>'
|
|
39
|
+
iskills mcp update docs --location '<selector-from-locations>' --replace
|
|
40
|
+
iskills mcp secret status docs
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Pass selectors unchanged. They include project, Agent, scope, ownership, source file and native key. Borrowed entries cannot be updated or uninstalled. Secret values only enter via stdin/files; JSON output reports keys and configured state. `mcp import --input` accepts native JSON snippets, while `mcp create --input` uses the strict creation shape above. Same-source import fills missing secrets without overwriting existing values. Replacing an endpoint clears old credentials.
|
|
44
|
+
|
|
45
|
+
Other actions: `list`, `show`, `import`, `edit`, `rename`, `tag rename`, `enable`, `disable`, `uninstall`, `remove`, `probe`, `secret set|unset|status`.
|
|
46
|
+
|
|
47
|
+
## Results and retries
|
|
48
|
+
|
|
49
|
+
The envelope contains `schemaVersion`, `command`, `outcome`, `context`, `result`, `warnings`, `error`. Machine decisions use stable `error.code`/`details`; messages are English. Writes report every selected item's status: `committed`, `unchanged`, `conflict`, `failed`, `not-run`; dry-run uses `planned`. `committed` means business completion, independently of `result.git`.
|
|
50
|
+
|
|
51
|
+
Exit codes: `0` completed/unchanged or only Git soft failure; `2` usage/selection/authorization; `3` preflight conflict; `1` runtime failure; `130` interrupted. A runtime failure can preserve earlier committed items. Inspect unknown recovery state before retrying; repeat unchanged operations safely. MCP recipe and secret stages are reported separately so failed secrets can be completed on retry. Read lists retain valid entries and report damaged ones in `issues` with `partial`/exit `1`.
|
|
52
|
+
|
|
53
|
+
`--replace` permits selected replacement; `--yes` permits deletion. All writes support `--dry-run`. Queries and dry-run do not create persistent state. Agent writes commit locally when Git exists and never sync in the background.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
iskills status
|
|
57
|
+
iskills collection init --remote <git-source>
|
|
58
|
+
iskills collection remote get
|
|
59
|
+
iskills collection sync --dry-run
|
|
60
|
+
iskills collection sync
|
|
61
|
+
iskills config get
|
|
62
|
+
iskills config set locale en
|
|
63
|
+
```
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
**Personal skill collection for AI coding agents** — discover, collect, install, and maintain skills that agents load via `SKILL.md`.
|
|
10
10
|
|
|
11
|
-
`iskills`
|
|
11
|
+
`iskills` provides a full-screen TUI for people and a non-interactive JSON CLI for agents and scripts. Both manage skills and MCP configurations in one personal collection.
|
|
12
12
|
|
|
13
13
|
## Why iskills
|
|
14
14
|
|
|
@@ -26,7 +26,7 @@ Data integrity comes first: writes are transactional where it matters; conflicts
|
|
|
26
26
|
## Requirements
|
|
27
27
|
|
|
28
28
|
- **Node.js** 20.6+
|
|
29
|
-
- **Bun** recommended for the full-screen TUI (OpenTUI native FFI).
|
|
29
|
+
- **Bun** recommended for the full-screen TUI (OpenTUI native FFI). Interactive entries re-exec under Bun when Node lacks `node:ffi`. Agent commands run on Node alone, without loading React or OpenTUI.
|
|
30
30
|
- **macOS** or **Linux**
|
|
31
31
|
- A TTY for the interactive UI (`stdin` and `stdout`)
|
|
32
32
|
- **Git** optional — enable only if you want collection versioning / remote sync
|
|
@@ -63,19 +63,19 @@ iskills import https://github.com/org/skills-repo.git
|
|
|
63
63
|
iskills import -g
|
|
64
64
|
iskills import -g --agent pi
|
|
65
65
|
|
|
66
|
-
# Create a new skill in the collection
|
|
67
|
-
iskills create my-skill
|
|
66
|
+
# Create a new skill in the collection
|
|
67
|
+
iskills skill create my-skill
|
|
68
68
|
|
|
69
69
|
# Install from your collection into this project (symlink)
|
|
70
|
-
iskills
|
|
70
|
+
iskills skill install my-skill --agent codex --scope project
|
|
71
71
|
|
|
72
72
|
# Install into agent global dirs, or as a detached copy
|
|
73
|
-
iskills
|
|
74
|
-
iskills
|
|
73
|
+
iskills skill install my-skill --agent claude --scope global
|
|
74
|
+
iskills skill install my-skill --to ./copies --copy
|
|
75
75
|
|
|
76
76
|
# Optional: turn the collection into a Git repo (and set origin)
|
|
77
|
-
iskills init
|
|
78
|
-
iskills init --remote git@github.com:you/my-skills.git
|
|
77
|
+
iskills collection init
|
|
78
|
+
iskills collection init --remote git@github.com:you/my-skills.git
|
|
79
79
|
|
|
80
80
|
# Configure UI language (follow system / Chinese / English)
|
|
81
81
|
iskills config
|
|
@@ -84,6 +84,10 @@ iskills config
|
|
|
84
84
|
iskills mcp
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
Use `iskills skill create NAME --private` or `iskills skill import ... --private` for local-only skills. Switch an existing skill with `iskills skill edit NAME --private` or `--public`. The interactive import review also offers a private toggle (P). Private skills remain usable locally but are excluded from collection Git sync; earlier Git history is not erased.
|
|
88
|
+
|
|
89
|
+
The private list is stored locally in the collection's `.local/private-skills.json`. Sync refuses to push when outgoing history still contains a private skill; safely handle that history first. Previously pushed content requires separate handling.
|
|
90
|
+
|
|
87
91
|
In the main TUI, day-to-day work (browse, delete, update, notes, tags, sync) lives on the keyboard-driven browser. With a remote configured, press **`s`** on the Collection tab to sync.
|
|
88
92
|
|
|
89
93
|
## Commands
|
|
@@ -92,20 +96,24 @@ In the main TUI, day-to-day work (browse, delete, update, notes, tags, sync) liv
|
|
|
92
96
|
| --- | --- |
|
|
93
97
|
| `iskills` | Main TUI — project / global / collection browser |
|
|
94
98
|
| `iskills search [query]` | Search TUI against skills.sh; save selections to the collection |
|
|
95
|
-
| `iskills create [name]` | Create a new skill in the collection and open its directory |
|
|
96
99
|
| `iskills import [source]` | Import a local path or Git URL |
|
|
97
|
-
| `iskills add [skill…]` | Install from the collection into a project or global agent dir |
|
|
98
|
-
| `iskills init` | Initialize Git for the collection (optional remote) |
|
|
99
100
|
| `iskills config` | Configure UI preferences (language, collection Git remote) |
|
|
100
101
|
| `iskills mcp` | MCP collection TUI — project / global / collection |
|
|
102
|
+
| `iskills skill <action>` | Discover, import, create, install, update and maintain skills; JSON |
|
|
103
|
+
| `iskills mcp <action>` | Collect, write, update, enable/disable and maintain MCP entries and secrets; JSON |
|
|
104
|
+
| `iskills collection <action>` | Initialize Git, inspect/change origin, explicitly sync; JSON |
|
|
105
|
+
| `iskills config get\|set` | Read/change locale and secret tracking preferences; JSON |
|
|
106
|
+
| `iskills agents` / `iskills status` | Inspect supported targets and collection health; JSON |
|
|
101
107
|
|
|
102
108
|
Common flags (see `iskills help <command>` for the full set):
|
|
103
109
|
|
|
104
110
|
- **`import`:** `-g` / `--global`, `--agent <name>`, `--all`, `--replace`, `-y`
|
|
105
|
-
- **`
|
|
106
|
-
-
|
|
111
|
+
- **`skill install`:** explicit `--agent <id> --scope project|global` or `--to <dir>`, `--copy`, `--replace`
|
|
112
|
+
- **Writes:** `--dry-run` plans without changing persistent state; `--replace` authorizes replacement and `--yes` authorizes deletion
|
|
107
113
|
- **`search`:** `--replace`
|
|
108
|
-
- **`mcp
|
|
114
|
+
- **`mcp create`:** `--input <UTF-8-file|->`; **`mcp add`:** explicit `--agent <id> --scope project|global`
|
|
115
|
+
|
|
116
|
+
Agent commands always emit one JSON document, including errors. Exit codes: `0` completed/unchanged, `2` usage or authorization, `3` preflight conflict, `1` execution failure, `130` interrupted. Check item statuses and `warnings` separately: a local Git commit can fail after the business write succeeds. Read commands never initialize or repair the collection. Agent writes do not start background remote sync; use `iskills collection sync` explicitly. See [the shipped agent guide](./AGENT-CLI.md) for examples.
|
|
109
117
|
|
|
110
118
|
Supported `--agent` values: `agents`, `codex`, `claude`, `cursor`, `opencode`, `pi`, `zcode`, `trae`, `qoder`, `grok`.
|
|
111
119
|
|
|
@@ -114,7 +122,7 @@ Supported `--agent` values: `agents`, `codex`, `claude`, `cursor`, `opencode`, `
|
|
|
114
122
|
| Item | Location |
|
|
115
123
|
| --- | --- |
|
|
116
124
|
| Collection root | `$XDG_CONFIG_HOME/iskills`, or `~/.config/iskills` if unset |
|
|
117
|
-
| Git | Optional.
|
|
125
|
+
| Git | Optional. Writes commit locally; interactive flows may sync in the background, agent commands sync only explicitly |
|
|
118
126
|
| Source conflicts | `.local/conflicts` under the collection — resolve with an editor + Git, or copy a handoff from Alerts via **Copy for Agent** |
|
|
119
127
|
|
|
120
128
|
After you commit a merge resolution, the next main TUI start (or a retained collection command) applies the result. Active in-use skills are never overwritten by conflict material.
|
|
@@ -137,7 +145,6 @@ Stack: TypeScript (strict), OpenTUI, React. The published package ships compiled
|
|
|
137
145
|
|
|
138
146
|
- Skill marketplace, hosting, accounts, or cloud sync as a product
|
|
139
147
|
- Desktop or web GUI
|
|
140
|
-
- CI/CD or headless machine API as the primary interface
|
|
141
148
|
- Multi-user / org permissions
|
|
142
149
|
|
|
143
150
|
## Contributing
|
package/README.zh-CN.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
**面向 AI coding agent 的个人 Skill 收藏夹** — 发现、收藏、安装并维护可通过 `SKILL.md` 被 Agent 加载的技能。
|
|
10
10
|
|
|
11
|
-
`iskills`
|
|
11
|
+
`iskills` 同时提供供人使用的全屏 TUI,以及供 Agent 和脚本调用的非交互 JSON CLI。两者共同管理个人收藏夹中的技能和 MCP 配置。
|
|
12
12
|
|
|
13
13
|
## 为什么用 iskills
|
|
14
14
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
## 环境要求
|
|
27
27
|
|
|
28
28
|
- **Node.js** 20.6+
|
|
29
|
-
- **Bun**
|
|
29
|
+
- **Bun** 推荐用于全屏 TUI(OpenTUI 原生 FFI)。Node 缺少 `node:ffi` 时,人用入口会 re-exec 到 Bun。Agent 命令直接运行于 Node,不加载 React 或 OpenTUI。
|
|
30
30
|
- **macOS** 或 **Linux**
|
|
31
31
|
- 交互界面需要 TTY(`stdin` 与 `stdout`)
|
|
32
32
|
- **Git** 可选 — 仅在需要收藏夹版本管理 / 远端同步时启用
|
|
@@ -63,19 +63,19 @@ iskills import https://github.com/org/skills-repo.git
|
|
|
63
63
|
iskills import -g
|
|
64
64
|
iskills import -g --agent pi
|
|
65
65
|
|
|
66
|
-
#
|
|
67
|
-
iskills create my-skill
|
|
66
|
+
# 在收藏夹新建技能
|
|
67
|
+
iskills skill create my-skill
|
|
68
68
|
|
|
69
69
|
# 从收藏夹安装到当前项目(软链)
|
|
70
|
-
iskills
|
|
70
|
+
iskills skill install my-skill --agent codex --scope project
|
|
71
71
|
|
|
72
72
|
# 安装到 Agent 全局目录,或以副本脱离收藏夹
|
|
73
|
-
iskills
|
|
74
|
-
iskills
|
|
73
|
+
iskills skill install my-skill --agent claude --scope global
|
|
74
|
+
iskills skill install my-skill --to ./copies --copy
|
|
75
75
|
|
|
76
76
|
# 可选:将收藏夹初始化为 Git 仓库(并配置 origin)
|
|
77
|
-
iskills init
|
|
78
|
-
iskills init --remote git@github.com:you/my-skills.git
|
|
77
|
+
iskills collection init
|
|
78
|
+
iskills collection init --remote git@github.com:you/my-skills.git
|
|
79
79
|
|
|
80
80
|
# 配置 UI 语言(跟随系统 / 中文 / English)
|
|
81
81
|
iskills config
|
|
@@ -84,6 +84,10 @@ iskills config
|
|
|
84
84
|
iskills mcp
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
使用 `iskills skill create NAME --private` 或 `iskills skill import ... --private` 创建仅保存在本机的技能;用 `iskills skill edit NAME --private` 或 `--public` 切换已有技能。交互导入确认页也可按 P 切换私有状态。私有技能仍可在本机使用,但不会随收藏夹 Git 同步;切换不会清除已有 Git 历史。
|
|
88
|
+
|
|
89
|
+
私有名单保存在收藏夹的 `.local/private-skills.json`,只在本机生效。切换为私有前已提交的历史不会被改写;如果待推送的历史仍包含私有内容,同步会拒绝推送,需先安全处理相关历史。已经推送的内容需要另行处理。
|
|
90
|
+
|
|
87
91
|
日常操作(浏览、删除、更新、备注、标签、同步)在主 TUI 的键盘浏览中完成。配置远程后,在收藏夹 Tab 按 **`s`** 同步。
|
|
88
92
|
|
|
89
93
|
## 命令
|
|
@@ -92,20 +96,24 @@ iskills mcp
|
|
|
92
96
|
| --- | --- |
|
|
93
97
|
| `iskills` | 主 TUI — 当前项目 / 全局 / 收藏夹浏览 |
|
|
94
98
|
| `iskills search [关键词]` | 独立搜索 TUI(skills.sh),选择后写入收藏夹 |
|
|
95
|
-
| `iskills create [名称]` | 在收藏夹新建技能并打开目录 |
|
|
96
99
|
| `iskills import [来源]` | 导入本地路径或 Git URL |
|
|
97
|
-
| `iskills add [技能…]` | 从收藏夹安装到项目或 Agent 全局目录 |
|
|
98
|
-
| `iskills init` | 初始化收藏夹 Git(可选远程) |
|
|
99
100
|
| `iskills config` | 配置界面偏好(UI 语言、收藏夹远程 Git) |
|
|
100
101
|
| `iskills mcp` | MCP 配置收藏夹 TUI — 项目 / 全局 / 收藏夹 |
|
|
102
|
+
| `iskills skill <动作>` | 发现、导入、新建、安装、更新与维护技能;JSON |
|
|
103
|
+
| `iskills mcp <动作>` | 收藏、写入、更新、开关及维护 MCP 与密钥;JSON |
|
|
104
|
+
| `iskills collection <动作>` | Git 初始化、查看/修改 origin、显式同步;JSON |
|
|
105
|
+
| `iskills config get\|set` | 读取/修改语言与密钥跟踪偏好;JSON |
|
|
106
|
+
| `iskills agents` / `iskills status` | 查看支持能力与收藏夹状态;JSON |
|
|
101
107
|
|
|
102
108
|
常用参数(完整列表见 `iskills help <命令>`):
|
|
103
109
|
|
|
104
110
|
- **`import`:** `-g` / `--global`、`--agent <名称>`、`--all`、`--replace`、`-y`
|
|
105
|
-
- **`
|
|
106
|
-
-
|
|
111
|
+
- **`skill install`:** 显式 `--agent <id> --scope project|global` 或 `--to <目录>`,可加 `--copy`、`--replace`
|
|
112
|
+
- **写命令:** `--dry-run` 查看计划;`--replace` 授权替换,`--yes` 授权删除,两者互不蕴含
|
|
107
113
|
- **`search`:** `--replace`
|
|
108
|
-
- **`mcp
|
|
114
|
+
- **`mcp create`:** `--input <UTF-8文件|->`;**`mcp add`:** 显式 `--agent <id> --scope project|global`
|
|
115
|
+
|
|
116
|
+
Agent 命令始终输出一个 JSON 文档,错误同样走 JSON。退出码:`0` 完成/无需变更、`2` 参数或授权、`3` 预检冲突、`1` 执行失败、`130` 中断。分别检查逐项状态与 warnings:业务成功后,本地 Git 提交仍可能失败。查询不初始化或修复收藏夹;Agent 写入不启动后台远端同步,需显式运行 `iskills collection sync`。调用示例见[随包 Agent 指南](./AGENT-CLI.md)。
|
|
109
117
|
|
|
110
118
|
`--agent` 可选:`agents`、`codex`、`claude`、`cursor`、`opencode`、`pi`、`zcode`、`trae`、`qoder`、`grok`。
|
|
111
119
|
|
|
@@ -114,7 +122,7 @@ iskills mcp
|
|
|
114
122
|
| 项 | 位置 |
|
|
115
123
|
| --- | --- |
|
|
116
124
|
| 收藏根目录 | `$XDG_CONFIG_HOME/iskills`;未设置时为 `~/.config/iskills` |
|
|
117
|
-
| Git |
|
|
125
|
+
| Git | 可选。写入保留本地提交;交互流程可后台同步,Agent 命令只显式同步 |
|
|
118
126
|
| 来源冲突 | 收藏夹下 `.local/conflicts` — 用编辑器 + Git 手动解决,或在告警里「复制给 Agent」交给其他 Agent |
|
|
119
127
|
|
|
120
128
|
提交合并结果后,下次启动主 TUI(或运行保留的收藏操作)会自动应用。冲突内容不会写入正在使用的技能。
|
|
@@ -137,7 +145,6 @@ pnpm pack --dry-run
|
|
|
137
145
|
|
|
138
146
|
- 技能市场、托管、账号体系或云同步产品
|
|
139
147
|
- 桌面 / Web GUI
|
|
140
|
-
- 以 CI/CD 或无人脚本 / 机器 API 为主界面
|
|
141
148
|
- 多用户 / 组织级权限
|
|
142
149
|
|
|
143
150
|
## 贡献
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Select the process entry before loading any terminal runtime. */
|
|
2
|
+
export function isNonInteractiveCommand(argv) {
|
|
3
|
+
const hasHelpFlag = argv.includes('-h') || argv.includes('--help');
|
|
4
|
+
const tokens = ['help', '-h', '--help'].includes(argv[0]) ? argv.slice(1) : argv.filter((token) => !['-h', '--help'].includes(token));
|
|
5
|
+
const [command, action] = tokens;
|
|
6
|
+
if (['skill', 'collection', 'agents', 'status'].includes(command)) return true;
|
|
7
|
+
if (command === 'help') return ['skill', 'mcp', 'collection', 'config', 'agents', 'status'].includes(action);
|
|
8
|
+
if (['mcp', 'config'].includes(command)) {
|
|
9
|
+
if (command === 'config' && hasHelpFlag && !action) return false;
|
|
10
|
+
if (command === 'mcp' && hasHelpFlag && !action) return false;
|
|
11
|
+
return Boolean(action);
|
|
12
|
+
}
|
|
13
|
+
if (!command || ['search', 'import', 'help', '-h', '--help', '-v', '--version'].includes(command)) return false;
|
|
14
|
+
return true;
|
|
15
|
+
}
|
package/bin/iskills.js
CHANGED
|
@@ -14,6 +14,9 @@ import { spawnSync } from 'node:child_process';
|
|
|
14
14
|
import { existsSync } from 'node:fs';
|
|
15
15
|
import { createRequire } from 'node:module';
|
|
16
16
|
import { fileURLToPath } from 'node:url';
|
|
17
|
+
import { isNonInteractiveCommand } from './command-route.mjs';
|
|
18
|
+
|
|
19
|
+
const nonInteractive = isNonInteractiveCommand(process.argv.slice(2));
|
|
17
20
|
|
|
18
21
|
const FORCE_NODE = process.env.ISKILLS_FORCE_NODE === '1';
|
|
19
22
|
const ALREADY_REEXEC = process.env.ISKILLS_RUNTIME === '1';
|
|
@@ -47,6 +50,7 @@ function findBun() {
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
function shouldReexecToBun() {
|
|
53
|
+
if (nonInteractive) return false;
|
|
50
54
|
if (FORCE_NODE || ALREADY_REEXEC || isBunRuntime()) return false;
|
|
51
55
|
if (nodeHasFfi()) return false;
|
|
52
56
|
return Boolean(findBun());
|
|
@@ -77,10 +81,13 @@ if (shouldReexecToBun()) {
|
|
|
77
81
|
|
|
78
82
|
// OpenTUI + react-reconciler need an ESM resolve hook under Node (extensionless subpaths).
|
|
79
83
|
// Bun resolves those without the hook; registering is harmless.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
if (nonInteractive) {
|
|
85
|
+
const { main } = await import('../dist/src/commands/agent/index.js');
|
|
86
|
+
await main();
|
|
87
|
+
} else {
|
|
88
|
+
await import('./opentui-register.mjs');
|
|
89
|
+
const { main, printProcessFailure } = await import('../dist/src/cli.js');
|
|
90
|
+
main().catch((error) => {
|
|
91
|
+
void printProcessFailure(error);
|
|
92
|
+
});
|
|
93
|
+
}
|
package/dist/src/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import {
|
|
2
|
+
import { commandConfig, commandImport, commandSearch, printHelp, } from './commands/index.js';
|
|
3
3
|
import { commandMcp } from './commands/mcp.js';
|
|
4
4
|
import { commitCollection, ensureCollection } from './domain/core.js';
|
|
5
5
|
import { finalizeResolvedConflicts } from './domain/git.js';
|
|
@@ -10,10 +10,7 @@ import { installRunLogProcessHooks, persistFailureLog, startRunLog, } from './ut
|
|
|
10
10
|
const packageVersion = createRequire(import.meta.url)('../../package.json').version;
|
|
11
11
|
const PUBLIC_COMMANDS = new Set([
|
|
12
12
|
'search',
|
|
13
|
-
'add',
|
|
14
|
-
'create',
|
|
15
13
|
'import',
|
|
16
|
-
'init',
|
|
17
14
|
'config',
|
|
18
15
|
'mcp',
|
|
19
16
|
]);
|
|
@@ -32,10 +29,11 @@ export async function printProcessFailure(error) {
|
|
|
32
29
|
process.exitCode = 130;
|
|
33
30
|
return;
|
|
34
31
|
}
|
|
35
|
-
|
|
32
|
+
const plain = (value) => !process.stdin.isTTY || !process.stdout.isTTY ? value.replace(/\u001b\[[0-9;]*m/g, '') : value;
|
|
33
|
+
process.stderr.write(`${plain(t('cli.errorPrefix', { message: formatAppError(error) }))}\n`);
|
|
36
34
|
const path = await persistFailureLog(error);
|
|
37
35
|
if (path)
|
|
38
|
-
|
|
36
|
+
process.stderr.write(`${plain(t('cli.logWritten', { path }))}\n`);
|
|
39
37
|
process.exitCode = 1;
|
|
40
38
|
}
|
|
41
39
|
async function run(argv) {
|
|
@@ -63,8 +61,6 @@ async function run(argv) {
|
|
|
63
61
|
throw new DomainError('cli.mainTtyRequired');
|
|
64
62
|
}
|
|
65
63
|
await ensureCollection();
|
|
66
|
-
if (command === 'init')
|
|
67
|
-
return commandInit(rest);
|
|
68
64
|
await finalizeResolvedConflicts();
|
|
69
65
|
await commitCollection('capture external skill edits');
|
|
70
66
|
// Collection / source health is shown live in the browser footer (⚠), not via stderr cache.
|
|
@@ -72,10 +68,6 @@ async function run(argv) {
|
|
|
72
68
|
const { runBrowserApp } = await import('./ui/browser/index.js');
|
|
73
69
|
return runBrowserApp('', 'collection');
|
|
74
70
|
}
|
|
75
|
-
if (command === 'add')
|
|
76
|
-
return commandAdd(rest);
|
|
77
|
-
if (command === 'create')
|
|
78
|
-
return commandCreate(rest);
|
|
79
71
|
if (command === 'import')
|
|
80
72
|
return commandImport(rest);
|
|
81
73
|
throw new DomainError('cli.unknownCommand', { command });
|
package/dist/src/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"cli.js","sour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AC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,mBAAmB,EAAE,CAAC;IACtB,MAAM,qBAAqB,EAAE,CAAC;IAC9B,WAAW,CAAC;QACV,IAAI;QACJ,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,cAAc,EAAE;QACzB,MAAM,EAAE,SAAS,EAAE;QACnB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;IACH,yBAAyB,EAAE,CAAC;IAC5B,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC;YACvB,OAAO;QACT,CAAC;QACD,uEAAuE;QACvE,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,kEAAkE;QAClE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;QAC7D,QAAQ,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type OptionKind = 'boolean' | 'string' | 'multiple';
|
|
2
|
+
export interface Arguments {
|
|
3
|
+
positional: string[];
|
|
4
|
+
options: Record<string, string | string[] | boolean>;
|
|
5
|
+
}
|
|
6
|
+
/** Strict option parsing; a value containing dashes can be passed with --key=value. */
|
|
7
|
+
export declare function parseArguments(argv: string[], options: Record<string, OptionKind>): Arguments;
|
|
8
|
+
export declare function stringOption(args: Arguments, key: string): string | undefined;
|
|
9
|
+
export declare function listOption(args: Arguments, key: string): string[];
|
|
10
|
+
export declare function requirePositionals(args: Arguments, min: number, max?: number): string[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { OperationFailure } from '../../domain/operation.js';
|
|
2
|
+
/** Strict option parsing; a value containing dashes can be passed with --key=value. */
|
|
3
|
+
export function parseArguments(argv, options) {
|
|
4
|
+
const result = { positional: [], options: {} };
|
|
5
|
+
const kinds = { project: 'string', ...options };
|
|
6
|
+
for (let index = 0; index < argv.length; index++) {
|
|
7
|
+
const token = argv[index];
|
|
8
|
+
if (token === '--') {
|
|
9
|
+
result.positional.push(...argv.slice(index + 1));
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
if (!token.startsWith('-')) {
|
|
13
|
+
result.positional.push(token);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const [option, inline] = token.split(/=(.*)/s);
|
|
17
|
+
const key = option.slice(2);
|
|
18
|
+
const kind = option.startsWith('--') && Object.hasOwn(kinds, key)
|
|
19
|
+
? kinds[key]
|
|
20
|
+
: undefined;
|
|
21
|
+
if (!kind)
|
|
22
|
+
throw new OperationFailure('usage.unknownOption', 'Unknown option.', {
|
|
23
|
+
option,
|
|
24
|
+
});
|
|
25
|
+
if (kind !== 'multiple' && key in result.options) {
|
|
26
|
+
throw new OperationFailure('usage.invalidArguments', 'A single-value option was repeated.', { option });
|
|
27
|
+
}
|
|
28
|
+
if (kind === 'boolean') {
|
|
29
|
+
if (inline !== undefined)
|
|
30
|
+
throw new OperationFailure('usage.invalidArguments', 'This option takes no value.', { option });
|
|
31
|
+
result.options[key] = true;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const value = inline ?? argv[++index];
|
|
35
|
+
if (value === undefined ||
|
|
36
|
+
(inline === undefined && value.startsWith('--'))) {
|
|
37
|
+
throw new OperationFailure('usage.invalidArguments', 'An option value is required.', { option });
|
|
38
|
+
}
|
|
39
|
+
if (kind === 'multiple') {
|
|
40
|
+
const values = result.options[key];
|
|
41
|
+
result.options[key] = [...(values ?? []), value];
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
result.options[key] = value;
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
export function stringOption(args, key) {
|
|
49
|
+
return args.options[key];
|
|
50
|
+
}
|
|
51
|
+
export function listOption(args, key) {
|
|
52
|
+
return [...new Set(args.options[key] ?? [])];
|
|
53
|
+
}
|
|
54
|
+
export function requirePositionals(args, min, max = min) {
|
|
55
|
+
if (args.positional.length < min || args.positional.length > max) {
|
|
56
|
+
throw new OperationFailure('usage.invalidArguments', 'Invalid number of positional arguments.', { min, max });
|
|
57
|
+
}
|
|
58
|
+
return [...new Set(args.positional)];
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=arguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arguments.js","sourceRoot":"","sources":["../../../../src/commands/agent/arguments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAQ7D,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAC5B,IAAc,EACd,OAAmC;IAEnC,MAAM,MAAM,GAAc,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC1D,MAAM,KAAK,GAA+B,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;IAC5E,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAE,CAAC;QAC3B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM;QACR,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;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