skilld 2.1.0 → 2.3.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.
- package/README.md +80 -1
- package/dist/_chunks/add.mjs +34 -6
- package/dist/_chunks/add.mjs.map +1 -1
- package/dist/_chunks/agent-prompt.mjs +7 -5
- package/dist/_chunks/agent-prompt.mjs.map +1 -1
- package/dist/_chunks/agent.mjs +3 -8
- package/dist/_chunks/agent.mjs.map +1 -1
- package/dist/_chunks/args.mjs +8 -1
- package/dist/_chunks/args.mjs.map +1 -1
- package/dist/_chunks/author.mjs +2 -1
- package/dist/_chunks/author.mjs.map +1 -1
- package/dist/_chunks/cache.mjs +4 -129
- package/dist/_chunks/cache.mjs.map +1 -1
- package/dist/_chunks/changes-digest.mjs +49 -0
- package/dist/_chunks/changes-digest.mjs.map +1 -0
- package/dist/_chunks/changes.mjs +23 -0
- package/dist/_chunks/changes.mjs.map +1 -0
- package/dist/_chunks/client.mjs +111 -47
- package/dist/_chunks/client.mjs.map +1 -1
- package/dist/_chunks/core.mjs +1 -1
- package/dist/_chunks/detect.mjs +7 -2
- package/dist/_chunks/detect.mjs.map +1 -1
- package/dist/_chunks/eject.mjs +1 -1
- package/dist/_chunks/embedding-cache2.mjs +12 -11
- package/dist/_chunks/embedding-cache2.mjs.map +1 -1
- package/dist/_chunks/index-identity.mjs +365 -0
- package/dist/_chunks/index-identity.mjs.map +1 -0
- package/dist/_chunks/index-identity2.mjs +2 -0
- package/dist/_chunks/install-many.mjs +183 -18
- package/dist/_chunks/install-many.mjs.map +1 -1
- package/dist/_chunks/install.mjs +2 -1
- package/dist/_chunks/install.mjs.map +1 -1
- package/dist/_chunks/login.mjs +14 -1
- package/dist/_chunks/login.mjs.map +1 -1
- package/dist/_chunks/pipeline.mjs +6 -2
- package/dist/_chunks/pipeline.mjs.map +1 -1
- package/dist/_chunks/portable.mjs +2 -1
- package/dist/_chunks/portable.mjs.map +1 -1
- package/dist/_chunks/prepare.mjs +10 -2
- package/dist/_chunks/prepare.mjs.map +1 -1
- package/dist/_chunks/pull.mjs +23 -53
- package/dist/_chunks/pull.mjs.map +1 -1
- package/dist/_chunks/retriv.mjs +2 -2
- package/dist/_chunks/retriv2.mjs +21 -3
- package/dist/_chunks/retriv2.mjs.map +1 -1
- package/dist/_chunks/search-helpers.mjs +9 -21
- package/dist/_chunks/search-helpers.mjs.map +1 -1
- package/dist/_chunks/search-interactive.mjs +4 -4
- package/dist/_chunks/search-interactive.mjs.map +1 -1
- package/dist/_chunks/search.mjs +33 -5
- package/dist/_chunks/search.mjs.map +1 -1
- package/dist/_chunks/semver.mjs +40 -10
- package/dist/_chunks/semver.mjs.map +1 -1
- package/dist/_chunks/skill-installer2.mjs +1 -1
- package/dist/_chunks/skills.mjs +11 -2
- package/dist/_chunks/skills.mjs.map +1 -1
- package/dist/_chunks/store.mjs.map +1 -1
- package/dist/_chunks/sync.mjs +2 -1
- package/dist/_chunks/sync.mjs.map +1 -1
- package/dist/_chunks/uninstall.mjs +2 -1
- package/dist/_chunks/uninstall.mjs.map +1 -1
- package/dist/_chunks/update.mjs +8 -47
- package/dist/_chunks/update.mjs.map +1 -1
- package/dist/_chunks/watch.mjs +2 -0
- package/dist/_chunks/watch2.mjs +118 -0
- package/dist/_chunks/watch2.mjs.map +1 -0
- package/dist/_chunks/wizard2.mjs +1 -1
- package/dist/cli.mjs +96 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/retriv/worker.mjs +11 -5
- package/dist/retriv/worker.mjs.map +1 -1
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -146,6 +146,8 @@ skilld
|
|
|
146
146
|
# Add skills for specific package(s) — npm: prefix for registry packages
|
|
147
147
|
skilld add npm:vue npm:nuxt npm:pinia
|
|
148
148
|
|
|
149
|
+
# The same prefixes work in the interactive wizard's package prompt
|
|
150
|
+
|
|
149
151
|
# Add a pre-authored skill from a GitHub repo
|
|
150
152
|
skilld add gh:vercel-labs/agent-skills
|
|
151
153
|
|
|
@@ -159,6 +161,7 @@ skilld update tailwindcss
|
|
|
159
161
|
# Search docs across installed skills
|
|
160
162
|
skilld search "useFetch options" -p nuxt
|
|
161
163
|
skilld search "error" -p nuxt --filter '{"type":"issue"}'
|
|
164
|
+
skilld search "routing" --agents claude-code
|
|
162
165
|
skilld search --guide -p nuxt
|
|
163
166
|
|
|
164
167
|
# Target a specific agent
|
|
@@ -188,7 +191,7 @@ skilld config
|
|
|
188
191
|
| `skilld` | Interactive wizard (first run) or status menu (existing skills) |
|
|
189
192
|
| `skilld add <source...>` | Add skills. Sources: `npm:<pkg>`, `crate:<name>`, `gh:<owner/repo>`, or bare names (deprecated) |
|
|
190
193
|
| `skilld update [pkg]` | Update outdated skills (all or specific) |
|
|
191
|
-
| `skilld search [query]` | Search indexed docs (`-p` package, `--filter` JSON, `--limit`, `--guide`) |
|
|
194
|
+
| `skilld search [query]` | Search indexed docs (`-p` package, `--agents` filter, `--filter` JSON, `--limit`, `--guide`) |
|
|
192
195
|
| `skilld list` | List installed skills (`--json` for machine-readable output) |
|
|
193
196
|
| `skilld info` | Show skill info and config |
|
|
194
197
|
| `skilld config` | Configure agent, model, preferences |
|
|
@@ -239,6 +242,82 @@ Generation runs locally: free, offline, no API key. Unlike the CLI and API backe
|
|
|
239
242
|
|
|
240
243
|
The large default context can exceed memory for big models on constrained hardware (Ollama returns a 500). Lower `OLLAMA_NUM_CTX` or pick a smaller model if generation fails to load.
|
|
241
244
|
|
|
245
|
+
### Embedding Model
|
|
246
|
+
|
|
247
|
+
Search covers skills installed for every agent in the project, deduplicated. Restrict it with `--agents`:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
skilld search "routing" --agents claude-code
|
|
251
|
+
skilld search "routing" --agents claude-code,codex
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
`skilld search` is powered by a local embedding model. It runs offline through transformers.js. It needs no API key or network traffic after the first download. Pick one under **Embedding model** in `skilld config`:
|
|
255
|
+
|
|
256
|
+
| Model | Dimensions | Notes |
|
|
257
|
+
|-------|-----------:|-------|
|
|
258
|
+
| `bge-small-en-v1.5` | 384 | Default. Fastest to index, smallest download. |
|
|
259
|
+
| `bge-base-en-v1.5` | 768 | Balanced accuracy and speed. |
|
|
260
|
+
| `Xenova/bge-large-en-v1.5` | 1024 | Most accurate English retrieval, slowest to index. |
|
|
261
|
+
| `bge-m3` | 1024 | Multilingual, 8192-token context. |
|
|
262
|
+
|
|
263
|
+
Larger models retrieve more accurately but cost more time and memory when indexing. Locally-pulled [Ollama](#ollama-embedding-models) models can be used too. Export `SKILLD_EMBED_MODEL` to override the saved setting for every index and search command in the current shell:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
export SKILLD_EMBED_MODEL=bge-m3
|
|
267
|
+
skilld update
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Search indexes must use one embedding model and device. Rebuild them after switching either setting:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
skilld update
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Ollama Embedding Models
|
|
277
|
+
|
|
278
|
+
If [Ollama](https://ollama.com) is running, locally-pulled embedding models appear in the **Embedding model** picker alongside the built-in ones. They are addressed as `ollama:<name>`, matching the `-m ollama:<name>` syntax used for enhancement models:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
ollama pull qwen3-embedding
|
|
282
|
+
SKILLD_EMBED_MODEL=ollama:qwen3-embedding skilld add npm:vue
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Only models that advertise the `embedding` capability are listed, so chat models cannot be selected by mistake. Dimensions and context length are read from Ollama. skilld validates each vector before indexing.
|
|
286
|
+
|
|
287
|
+
This talks to Ollama's HTTP API directly. It needs no additional dependency or API key. Set `OLLAMA_HOST` to point at a non-default daemon. If Ollama is not running, the picker simply shows the built-in models.
|
|
288
|
+
|
|
289
|
+
Ollama manages its own execution device, so **Embedding device** does not apply to `ollama:` models.
|
|
290
|
+
|
|
291
|
+
### Embedding Device
|
|
292
|
+
|
|
293
|
+
The embedding model runs on the CPU by default. **Embedding device** in `skilld config` moves it onto a GPU backend, which can be substantially faster:
|
|
294
|
+
|
|
295
|
+
| Device | Notes |
|
|
296
|
+
|--------|-------|
|
|
297
|
+
| `auto` | Default. Lets transformers.js choose; CPU under Node. |
|
|
298
|
+
| `cpu` | Always available, predictable. |
|
|
299
|
+
| `webgpu` | Fastest on Apple Silicon in testing. |
|
|
300
|
+
| `coreml` | Apple Neural Engine. Measured slower than CPU for these models. |
|
|
301
|
+
|
|
302
|
+
Measured on an Apple M5 Max, 120 documents, best of 3 after warm-up (docs/sec):
|
|
303
|
+
|
|
304
|
+
| Model | `cpu` | `coreml` | `webgpu` |
|
|
305
|
+
|-------|------:|---------:|---------:|
|
|
306
|
+
| `bge-small-en-v1.5` | 664 | 198 | **1713** |
|
|
307
|
+
| `bge-base-en-v1.5` | 198 | 68 | **580** |
|
|
308
|
+
| `Xenova/bge-large-en-v1.5` | 71 | 9 | **201** |
|
|
309
|
+
|
|
310
|
+
WebGPU was 2.6 to 2.9 times faster than CPU at every size. On WebGPU, `bge-large` indexed faster than `bge-base` on CPU and improved retrieval. CoreML was consistently slower.
|
|
311
|
+
|
|
312
|
+
The ranking is hardware-specific, so benchmark before trusting a device on other machines. Export `SKILLD_EMBED_DEVICE` to override the saved setting in the current shell:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
export SKILLD_EMBED_DEVICE=cpu
|
|
316
|
+
skilld update
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
If a backend is unavailable, indexing fails to start. Switch back to `auto`.
|
|
320
|
+
|
|
242
321
|
### Eject
|
|
243
322
|
|
|
244
323
|
Export a skill as a portable, self-contained directory for sharing via git repos:
|
package/dist/_chunks/add.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { hasCompletedWizard } from "./index-identity.mjs";
|
|
1
2
|
import { COMMA_OR_WHITESPACE_RE } from "./regex.mjs";
|
|
2
|
-
import { hasCompletedWizard } from "./cache.mjs";
|
|
3
3
|
import { autoResolveAgent } from "./agent-prompt.mjs";
|
|
4
|
-
import { sharedArgs } from "./args.mjs";
|
|
4
|
+
import { agentOrNoneArg, sharedArgs } from "./args.mjs";
|
|
5
5
|
import { parseSkillInput } from "./semver.mjs";
|
|
6
6
|
import { runWizard } from "./wizard2.mjs";
|
|
7
7
|
import { installSkills } from "./install-many.mjs";
|
|
8
|
+
import { watchRepositories } from "./watch2.mjs";
|
|
8
9
|
import { exportPortablePrompts } from "./portable.mjs";
|
|
9
10
|
import * as p from "@clack/prompts";
|
|
10
11
|
import { defineCommand } from "citty";
|
|
11
12
|
const addCommandDef = defineCommand({
|
|
12
13
|
meta: {
|
|
13
14
|
name: "add",
|
|
14
|
-
description: "Install skills
|
|
15
|
+
description: "Install skills from packages, repositories, curators, or collections"
|
|
15
16
|
},
|
|
16
17
|
args: {
|
|
17
18
|
"package": {
|
|
@@ -29,11 +30,22 @@ const addCommandDef = defineCommand({
|
|
|
29
30
|
type: "boolean",
|
|
30
31
|
description: "Install skills that fail the upstream audit gate"
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
+
"watch": {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
description: "Watch installed repositories for changes"
|
|
36
|
+
},
|
|
37
|
+
...sharedArgs,
|
|
38
|
+
"agent": agentOrNoneArg
|
|
33
39
|
},
|
|
34
40
|
async run({ args }) {
|
|
35
41
|
const rawInputs = [...new Set([args.package, ...args._ || []].map((s) => s.trim()).filter(Boolean))];
|
|
42
|
+
const items = rawInputs.map(parseSkillInput);
|
|
36
43
|
if (args.agent === "none") {
|
|
44
|
+
if (items.some((item) => item.type === "curator")) {
|
|
45
|
+
p.log.error("Curator installs require a target agent.");
|
|
46
|
+
process.exitCode = 1;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
37
49
|
const packages = [...new Set(rawInputs.flatMap((s) => s.split(COMMA_OR_WHITESPACE_RE)).map((s) => s.trim()).filter(Boolean))];
|
|
38
50
|
for (const pkg of packages) await exportPortablePrompts(pkg, {
|
|
39
51
|
force: args.force,
|
|
@@ -48,8 +60,7 @@ const addCommandDef = defineCommand({
|
|
|
48
60
|
return;
|
|
49
61
|
}
|
|
50
62
|
if (!hasCompletedWizard()) await runWizard({ agent });
|
|
51
|
-
const
|
|
52
|
-
await installSkills(items, {
|
|
63
|
+
const summary = await installSkills(items, {
|
|
53
64
|
agent,
|
|
54
65
|
surface: "cli:add",
|
|
55
66
|
global: args.global,
|
|
@@ -60,6 +71,23 @@ const addCommandDef = defineCommand({
|
|
|
60
71
|
skillFilter: args.skill,
|
|
61
72
|
allowUnsafe: args["allow-unsafe"]
|
|
62
73
|
});
|
|
74
|
+
if (args.watch) {
|
|
75
|
+
if (summary.repositories.length === 0) {
|
|
76
|
+
p.log.warn("No GitHub repositories were resolved to watch.");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
await watchRepositories(summary.repositories).then((result) => {
|
|
80
|
+
if (result._tag === "AuthRequired") {
|
|
81
|
+
p.log.error("Skills installed. Run `skilld login`, then `skilld watch`.");
|
|
82
|
+
process.exitCode = 1;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
p.log.success(`Watching ${summary.repositories.length} repositories. ${result.inserted} added.`);
|
|
86
|
+
}).catch((error) => {
|
|
87
|
+
p.log.error(`Skills installed, but watch failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
88
|
+
process.exitCode = 1;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
63
91
|
}
|
|
64
92
|
});
|
|
65
93
|
export { addCommandDef };
|
package/dist/_chunks/add.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.mjs","names":[],"sources":["../../src/commands/sync/add.ts"],"sourcesContent":["import type { AgentType, OptimizeModel } from '../../agent/index.ts'\nimport * as p from '@clack/prompts'\nimport { defineCommand } from 'citty'\nimport { autoResolveAgent } from '../../cli/agent-prompt.ts'\nimport { sharedArgs } from '../../cli/args.ts'\nimport { hasCompletedWizard } from '../../core/config.ts'\nimport { parseSkillInput } from '../../core/prefix.ts'\nimport { COMMA_OR_WHITESPACE_RE } from '../../core/regex.ts'\nimport { runWizard } from '../wizard.ts'\nimport { installSkills } from './install-many.ts'\nimport { exportPortablePrompts } from './portable.ts'\n\nexport const addCommandDef = defineCommand({\n meta: { name: 'add', description: 'Install skills
|
|
1
|
+
{"version":3,"file":"add.mjs","names":[],"sources":["../../src/commands/sync/add.ts"],"sourcesContent":["import type { AgentType, OptimizeModel } from '../../agent/index.ts'\nimport * as p from '@clack/prompts'\nimport { defineCommand } from 'citty'\nimport { autoResolveAgent } from '../../cli/agent-prompt.ts'\nimport { agentOrNoneArg, sharedArgs } from '../../cli/args.ts'\nimport { hasCompletedWizard } from '../../core/config.ts'\nimport { parseSkillInput } from '../../core/prefix.ts'\nimport { COMMA_OR_WHITESPACE_RE } from '../../core/regex.ts'\nimport { watchRepositories } from '../watch.ts'\nimport { runWizard } from '../wizard.ts'\nimport { installSkills } from './install-many.ts'\nimport { exportPortablePrompts } from './portable.ts'\n\nexport const addCommandDef = defineCommand({\n meta: { name: 'add', description: 'Install skills from packages, repositories, curators, or collections' },\n args: {\n 'package': {\n type: 'positional',\n description: 'Package(s) to sync (space/comma-separated; npm:<pkg>, crate:<name>, or owner/repo)',\n required: true,\n },\n 'skill': {\n type: 'string',\n alias: 's',\n description: 'Select specific skills from a git repo (comma-separated)',\n valueHint: 'name',\n },\n 'allow-unsafe': {\n type: 'boolean',\n description: 'Install skills that fail the upstream audit gate',\n },\n 'watch': {\n type: 'boolean',\n description: 'Watch installed repositories for changes',\n },\n ...sharedArgs,\n // This command supports portable exports.\n 'agent': agentOrNoneArg,\n },\n async run({ args }) {\n const rawInputs = [...new Set(\n [args.package, ...((args as any)._ || [])]\n .map((s: string) => s.trim())\n .filter(Boolean),\n )]\n const items = rawInputs.map(parseSkillInput)\n\n // --agent none → portable export (no installed-agent target needed).\n if (args.agent === 'none') {\n if (items.some(item => item.type === 'curator')) {\n p.log.error('Curator installs require a target agent.')\n process.exitCode = 1\n return\n }\n const packages = [...new Set(rawInputs.flatMap(s => s.split(COMMA_OR_WHITESPACE_RE)).map(s => s.trim()).filter(Boolean))]\n for (const pkg of packages)\n await exportPortablePrompts(pkg, { force: args.force, agent: 'none' })\n return\n }\n\n const agent: AgentType | null = autoResolveAgent(args.agent)\n if (!agent) {\n p.log.error('No target agent detected.\\n Pass --agent <name> (claude-code, cursor, codex, …) or run `skilld config` to set a default.\\n Use --agent none for portable export.')\n process.exitCode = 1\n return\n }\n\n if (!hasCompletedWizard())\n await runWizard({ agent })\n\n const summary = await installSkills(items, {\n agent,\n surface: 'cli:add',\n global: args.global,\n yes: args.yes,\n force: args.force,\n debug: args.debug,\n model: args.model as OptimizeModel | undefined,\n skillFilter: args.skill,\n allowUnsafe: args['allow-unsafe'],\n })\n if (args.watch) {\n if (summary.repositories.length === 0) {\n p.log.warn('No GitHub repositories were resolved to watch.')\n return\n }\n await watchRepositories(summary.repositories).then((result) => {\n if (result._tag === 'AuthRequired') {\n p.log.error('Skills installed. Run `skilld login`, then `skilld watch`.')\n process.exitCode = 1\n return\n }\n p.log.success(`Watching ${summary.repositories.length} repositories. ${result.inserted} added.`)\n }).catch((error) => {\n p.log.error(`Skills installed, but watch failed: ${error instanceof Error ? error.message : String(error)}`)\n process.exitCode = 1\n })\n }\n },\n})\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,gBAAgB,cAAc;CACzC,MAAM;EAAE,MAAM;EAAO,aAAa;CAAuE;CACzG,MAAM;EACJ,WAAW;GACT,MAAM;GACN,aAAa;GACb,UAAU;EACZ;EACA,SAAS;GACP,MAAM;GACN,OAAO;GACP,aAAa;GACb,WAAW;EACb;EACA,gBAAgB;GACd,MAAM;GACN,aAAa;EACf;EACA,SAAS;GACP,MAAM;GACN,aAAa;EACf;EACA,GAAG;EAEH,SAAS;CACX;CACA,MAAM,IAAI,EAAE,QAAQ;EAClB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QAAQ,WAAW;KACnB;IACF;IACA,EAAE,IAAI,QAAQ,YAAY,QAAQ,aAAa,OAAO,iBAAiB,OAAO,SAAS,QAAQ;GACjG,CAAC,CAAC,CAAC,OAAO,UAAU;IAClB,EAAE,IAAI,MAAM,uCAAuC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;IAC3G,QAAQ,WAAW;GACrB,CAAC;EACH;CACF;AACF,CAAC"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { detectInstalledAgents, detectProjectAgents,
|
|
1
|
+
import { detectEnvAgent, detectInstalledAgents, detectProjectAgents, targets } from "./detect.mjs";
|
|
2
2
|
import "./agent.mjs";
|
|
3
|
-
import { readConfig, updateConfig } from "./
|
|
3
|
+
import { readConfig, updateConfig } from "./index-identity.mjs";
|
|
4
4
|
import { isInteractive } from "./env.mjs";
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
|
+
function detectProjectAgent() {
|
|
8
|
+
const projectMatches = detectProjectAgents();
|
|
9
|
+
return projectMatches.length === 1 ? projectMatches[0] : null;
|
|
10
|
+
}
|
|
7
11
|
function resolveAgent(agentFlag) {
|
|
8
12
|
if (process.env.SKILLD_NO_AGENT) return null;
|
|
9
|
-
return agentFlag ??
|
|
13
|
+
return agentFlag ?? detectEnvAgent() ?? readConfig().agent ?? detectProjectAgent() ?? null;
|
|
10
14
|
}
|
|
11
15
|
function autoResolveAgent(agentFlag) {
|
|
12
16
|
const resolved = resolveAgent(agentFlag);
|
|
13
17
|
if (resolved && resolved !== "none") return resolved;
|
|
14
18
|
if (process.env.SKILLD_NO_AGENT) return null;
|
|
15
|
-
const projectMatches = detectProjectAgents();
|
|
16
|
-
if (projectMatches.length === 1) return projectMatches[0];
|
|
17
19
|
const installed = detectInstalledAgents();
|
|
18
20
|
if (installed.length === 1) return installed[0];
|
|
19
21
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-prompt.mjs","names":["agents"],"sources":["../../src/cli/agent-prompt.ts"],"sourcesContent":["import type { AgentType } from '../agent/index.ts'\nimport { styleText } from 'node:util'\nimport * as p from '@clack/prompts'\nimport { agents, detectInstalledAgents, detectProjectAgents
|
|
1
|
+
{"version":3,"file":"agent-prompt.mjs","names":["agents"],"sources":["../../src/cli/agent-prompt.ts"],"sourcesContent":["import type { AgentType } from '../agent/index.ts'\nimport { styleText } from 'node:util'\nimport * as p from '@clack/prompts'\nimport { agents, detectEnvAgent, detectInstalledAgents, detectProjectAgents } from '../agent/index.ts'\nimport { readConfig, updateConfig } from '../core/config.ts'\nimport { isInteractive } from './env.ts'\n\nfunction detectProjectAgent(): AgentType | null {\n const projectMatches = detectProjectAgents()\n return projectMatches.length === 1 ? projectMatches[0]! : null\n}\n\nexport function resolveAgent(agentFlag?: string): AgentType | 'none' | null {\n if (process.env.SKILLD_NO_AGENT)\n return null\n return (agentFlag as AgentType | undefined)\n ?? detectEnvAgent()\n ?? (readConfig().agent as AgentType | undefined)\n ?? detectProjectAgent()\n ?? null\n}\n\n/**\n * Auto-resolve target agent without prompting. Consults, in order:\n * 1. Explicit `--agent` flag.\n * 2. Env-detected target (`CLAUDE_CODE`, `CURSOR_SESSION`, etc).\n * 3. Saved config default.\n * 4. Project marker dirs (`.claude/skills`, `.cursor/`, …) when exactly one\n * agent matches the cwd.\n * 5. Installed agents on the machine when exactly one is found.\n *\n * Returns `null` when nothing is determined. Callers should error with a clear\n * \"pass --agent <name>\" hint rather than prompting — keeps commands\n * scriptable.\n */\nexport function autoResolveAgent(agentFlag?: string): AgentType | null {\n const resolved = resolveAgent(agentFlag)\n if (resolved && resolved !== 'none')\n return resolved\n\n if (process.env.SKILLD_NO_AGENT)\n return null\n\n const installed = detectInstalledAgents()\n if (installed.length === 1)\n return installed[0]!\n\n return null\n}\n\nexport function listKnownAgents(): AgentType[] {\n return Object.keys(agents) as AgentType[]\n}\n\nlet _warnedNoAgent = false\nfunction warnNoAgent(): void {\n if (_warnedNoAgent)\n return\n _warnedNoAgent = true\n p.log.warn('No target agent detected — falling back to prompt-only mode.\\n Use --agent <name> to specify, or run `skilld config` to set a default.')\n}\n\nexport async function promptForAgent(): Promise<AgentType | 'none' | null> {\n const noAgent = !!process.env.SKILLD_NO_AGENT\n const installed = noAgent ? [] : detectInstalledAgents()\n const projectMatches = noAgent ? [] : detectProjectAgents()\n\n if (!isInteractive()) {\n if (installed.length === 1) {\n updateConfig({ agent: installed[0] })\n return installed[0]!\n }\n warnNoAgent()\n return 'none'\n }\n\n p.log.info(\n `Skilld generates reference cards from package docs so your AI agent\\n`\n + ` always has accurate APIs for your exact dependency versions.`,\n )\n\n const candidateIds = projectMatches.length > 0\n ? projectMatches\n : installed.length > 0\n ? installed\n : Object.keys(agents) as AgentType[]\n\n const sharedAgents = new Set(\n Object.entries(agents)\n .filter(([, a]) => a.additionalSkillsDirs.some(d => d.includes('.claude/skills')))\n .map(([id]) => id),\n )\n\n const sharedIds = candidateIds.filter(id => id === 'claude-code' || sharedAgents.has(id))\n const isolatedIds = candidateIds.filter(id => id !== 'claude-code' && !sharedAgents.has(id))\n\n const options: Array<{ label: string, value: AgentType | 'none', hint?: string }> = []\n\n if (sharedIds.length > 0 && isolatedIds.length > 0) {\n for (const id of sharedIds) {\n const a = agents[id]\n const hint = id === 'claude-code'\n ? `skills shared with ${sharedIds.length - 1} other agents`\n : `skills shared with Claude Code and others`\n options.push({ label: a.displayName, value: id as AgentType, hint })\n }\n }\n\n const isolatedAgentIds = new Set(\n Object.entries(agents)\n .filter(([, a]) => a.additionalSkillsDirs.length === 0)\n .map(([id]) => id),\n )\n\n for (const id of (sharedIds.length > 0 && isolatedIds.length > 0 ? isolatedIds : candidateIds)) {\n if (options.some(o => o.value === id))\n continue\n const a = agents[id]\n const hint = sharedAgents.has(id) && id !== 'claude-code'\n ? 'skills shared with Claude Code and others'\n : isolatedAgentIds.has(id)\n ? 'skills only visible to this agent'\n : undefined\n options.push({ label: a.displayName, value: id as AgentType, hint })\n }\n\n options.push({ label: 'No agent', value: 'none', hint: 'export as standalone files for any AI' })\n\n if (!_warnedNoAgent) {\n _warnedNoAgent = true\n const hint = projectMatches.length > 1\n ? `Multiple agent directories found: ${projectMatches.map(t => agents[t].displayName).join(', ')}`\n : installed.length > 0\n ? `Found ${installed.map(t => agents[t].displayName).join(', ')} but couldn't determine which to use`\n : 'No agents auto-detected'\n const crossNote = sharedIds.length > 1\n ? `\\n ${styleText('gray', `Tip: Picking Claude Code shares skills with ${sharedIds.filter(id => id !== 'claude-code').map(id => agents[id].displayName).join(', ')} automatically.`)}`\n : ''\n p.log.warn(`${hint}\\n Pick the agent you actively code with.${crossNote}`)\n }\n\n const choice = await p.select({\n message: 'Which AI coding agent do you use?',\n options,\n })\n\n if (p.isCancel(choice))\n return null\n\n if (choice === 'none')\n return 'none'\n\n updateConfig({ agent: choice })\n p.log.success(`Target agent set to ${agents[choice].displayName}`)\n return choice\n}\n"],"mappings":";;;;;;AAOA,SAAS,qBAAuC;CAC9C,MAAM,iBAAiB,oBAAoB;CAC3C,OAAO,eAAe,WAAW,IAAI,eAAe,KAAM;AAC5D;AAEA,SAAgB,aAAa,WAA+C;CAC1E,IAAI,QAAQ,IAAI,iBACd,OAAO;CACT,OAAQ,aACH,eAAe,KACd,WAAW,CAAC,CAAC,SACd,mBAAmB,KACnB;AACP;;;;;;;;;;;;;CAeA,EAAA,IAAA,KAAgB,yIAAuD;AACrE;AACA,eAAI,iBAAyB;CAG7B,MAAI,UAAY,CAAA,CAAA,QAAA,IAAA;CAGhB,MAAM,YAAY,UAAA,CAAA,IAAA,sBAAsB;CACxC,MAAI,iBAAU,UACZ,CAAA,IAAO,oBAAU;CAEnB,IAAA,CAAA,cAAO,GAAA;EACT,IAAA,UAAA,WAAA,GAAA;GAMA,aAAI,EAAA,OAAiB,UAAA,GAAA,CAAA;GACrB,OAAS,UAAA;EACP;EAEA,YAAA;EACA,OAAM;CACR;CAEA,EAAA,IAAA,KAAA,qIAA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AAA,CAAA,gBAAa;EAKb,iBAAa;EAAE,MAAA,OAAS,eAAA,SAAA,IAAA,qCAAA,eAAA,KAAA,MAAA,QAAA,EAAA,CAAA,WAAA,CAAA,CAAA,KAAA,IAAA,MAAA,UAAA,SAAA,IAAA,SAAA,UAAA,KAAA,MAAA,QAAA,EAAA,CAAA,WAAA,CAAA,CAAA,KAAA,IAAA,EAAA,wCAAA;EAAa,MAAA,YAAO,UAAA,SAAA,IAAA,OAAA,UAAA,QAAA,+CAAA,UAAA,QAAA,OAAA,OAAA,aAAA,CAAA,CAAA,KAAA,OAAA,QAAA,GAAA,CAAA,WAAA,CAAA,CAAA,KAAA,IAAA,EAAA,gBAAA,MAAA;EAAiB,EAAA,IAAA,KAAA,GAAA,KAAA,4CAAA,WAAA;CAAK;CACpE,MAAA,SAAA,MAAA,EAAA,OAAA;EAEA,SAAQ;EAAO;CAAmB,CAAA;CAAe,IAAA,EAAA,SAAM,MAAA,GAAA,OAAA;CAAwC,IAAC,WAAA,QAAA,OAAA;CAEhG,aAAK,EAAA,OAAgB,OAAA,CAAA;CACnB,EAAA,IAAA,QAAA,uBAAiB,QAAA,OAAA,CAAA,aAAA;CACjB,OAAM;AAKN;AAIF,SAAA,kBAAA,gBAAA"}
|
package/dist/_chunks/agent.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { detectInstalledAgents, targets } from "./detect.mjs";
|
|
2
2
|
import { SECTION_MERGE_ORDER, SECTION_OUTPUT_FILES, buildAllSectionPrompts, getSectionValidator, resolveSkilldCommand, wrapSection } from "./prompts.mjs";
|
|
3
|
+
import { ollamaHost } from "./index-identity.mjs";
|
|
3
4
|
import { CACHE_DIR, LLM_CACHE_DIR, PI_AI_AUTH_PATH, skillInternalDir, skillLogDir } from "./paths.mjs";
|
|
4
|
-
import { API_CHANGE_BULLET_RE, SECTION_HEADING_RE, SOURCE_LINK_RE, TRAILING_SLASH_RE
|
|
5
|
+
import { API_CHANGE_BULLET_RE, SECTION_HEADING_RE, SOURCE_LINK_RE, TRAILING_SLASH_RE } from "./regex.mjs";
|
|
5
6
|
import { sanitizeMarkdown } from "./sanitize.mjs";
|
|
6
7
|
import { createReferenceCache, getSkillReferenceDirs } from "./cache.mjs";
|
|
7
8
|
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
@@ -393,12 +394,6 @@ function isOllamaModel(model) {
|
|
|
393
394
|
function parseOllamaModelId(model) {
|
|
394
395
|
return isOllamaModel(model) ? model.slice(7) : null;
|
|
395
396
|
}
|
|
396
|
-
const HAS_SCHEME_RE = /^https?:\/\//;
|
|
397
|
-
const TRAILING_SLASH_RE = /\/$/;
|
|
398
|
-
function ollamaHost() {
|
|
399
|
-
const raw = process.env.OLLAMA_HOST || "http://localhost:11434";
|
|
400
|
-
return (HAS_SCHEME_RE.test(raw) ? raw : `http://${raw}`).replace(TRAILING_SLASH_RE, "");
|
|
401
|
-
}
|
|
402
397
|
async function isCompletionModel(name) {
|
|
403
398
|
const res = await fetch(`${ollamaHost()}/api/show`, {
|
|
404
399
|
method: "POST",
|
|
@@ -812,7 +807,7 @@ function executeTool(toolCall, skilldDir) {
|
|
|
812
807
|
else results.push(`./.skilld/${relPath}`);
|
|
813
808
|
}
|
|
814
809
|
};
|
|
815
|
-
const baseDir = pattern.split("*")[0]?.replace(TRAILING_SLASH_RE
|
|
810
|
+
const baseDir = pattern.split("*")[0]?.replace(TRAILING_SLASH_RE, "") ?? "";
|
|
816
811
|
walkDir(join(skilldDir, baseDir), baseDir);
|
|
817
812
|
const matched = results.filter((r) => globMatch(r.replace(STATIC_REGEX_1$3, ""), pattern));
|
|
818
813
|
return matched.length > 0 ? matched.join("\n") : `No files matching: ${args.pattern}`;
|