@ysgao/web-cli 0.1.5 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +60 -24
  2. package/dist/index.js +120 -139
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -110,8 +110,8 @@ node dist/index.js observe --site <site> --intent <search|getArticle> --param "<
110
110
  node dist/index.js learned [--site <site>]
111
111
  node dist/index.js finalize [--markdown [path]] [--json] [--pretty] # reads {query, finalAnswer, summary?, keyReferences, answers} as JSON on stdin
112
112
  node dist/index.js render-markdown [--from <path>] [--markdown [path]] [--json] # renders a Markdown report from an ALREADY-RETRIEVED search result -- zero network calls
113
- node dist/index.js install-skill [--agent claude|codex|agents|all] [--project] [--force]
114
- node dist/index.js uninstall-skill [--agent claude|codex|agents|all] [--project] [--force]
113
+ node dist/index.js install-skill [--agent claude|codex|agents|dsh|all] [--project] [--force]
114
+ node dist/index.js uninstall-skill [--agent claude|codex|agents|dsh|all] [--project] [--force]
115
115
  ```
116
116
 
117
117
  (The commands above are written as `node dist/index.js ...` because that's what works from inside
@@ -119,30 +119,66 @@ a cloned, un-built-into-a-global-command checkout. If you installed via `npm ins
119
119
  @ysgao/web-cli` — the normal path, see **Quick Start** above — or ran `npm link` while developing
120
120
  this checkout, use the plain `web-cli ...` form instead; both resolve to the exact same CLI.)
121
121
 
122
- ### `install-skill`'s three targets
123
-
124
- `--agent` accepts `claude`, `codex`, `agents`, or `all` — omit it and `install-skill` registers
125
- whichever of these are actually present on your machine (falling back to `claude` if none are).
126
- `claude`/`codex` register with Claude Code (`~/.claude/skills`) and Codex (`~/.codex/prompts`)
127
- respectively. **`agents`** registers with `~/.agents/skills` (or `$DSH_AGENTS_HOME/skills`) —
128
- DeepSeek Harness's own bundled skill provider scans this location (and `~/.dsh/skills`) directly
129
- for its `skill` tool's catalog, and never looks at `~/.claude`/`~/.codex` at all. If you're driving
130
- this CLI from a DSH-based agent and it reports the `web-cli` skill as "unknown or no longer
131
- available" even though `install-skill` has already run, this is almost always why — re-run with
132
- `--agent agents` (or `--agent all`) to also cover it.
122
+ ### `install-skill`'s four targets — each a copy, refreshed on every run
123
+
124
+ `install-skill` **copies** the skill that ships inside the package (`skills/web-cli/`: `SKILL.md` +
125
+ `references/`) into each agent's skills folder as a real directory — never a symlink into the
126
+ package, and no generated pointer file. Re-running it after upgrading the CLI refreshes every copy
127
+ to the latest version (`"status":"updated"`); re-running with nothing changed reports
128
+ `already-current`. Each copy carries a small marker file (`.installed-by-web-cli.json`, recording
129
+ the package version and where it was copied from) — that's how a later run recognizes its own
130
+ outdated copy and refreshes it rather than mistaking it for a directory you wrote yourself. Delete
131
+ the marker if you want to take a copy over and edit it as your own: from then on `install-skill`
132
+ treats it as yours and leaves it alone unless you pass `--force`.
133
+
134
+ `--agent` accepts `claude`, `codex`, `agents`, `dsh`, or `all` (comma-separable) — omit it and
135
+ `install-skill` targets whichever of `claude`/`codex`/`dsh` are actually present on your machine
136
+ (falling back to `claude` if none are; `agents` is never auto-selected — see below):
137
+
138
+ - **`claude`** → `~/.claude/skills/web-cli/` (or `<cwd>/.claude/skills/web-cli/` with `--project`,
139
+ a self-contained copy you can commit).
140
+ - **`codex`** → `~/.codex/skills/web-cli/` (or `$CODEX_HOME/skills/web-cli/`) — Codex discovers
141
+ `SKILL.md` skills from this folder exactly like Claude Code does. Earlier versions of this tool
142
+ instead wrote a pointer prompt to `~/.codex/prompts/web-cli.md`, from before Codex had a skills
143
+ folder; `install-skill`/`uninstall-skill` both remove that legacy file if it's one of ours.
144
+ - **`agents`** → `~/.agents/skills/web-cli/` (or `$DSH_AGENTS_HOME/skills/`) — the cross-tool
145
+ "shared agent config root" DeepSeek Harness's bundled skill provider scans.
146
+ - **`dsh`** → `~/.dsh/skills/web-cli/` (or `$DSH_HOME/skills/`) — DSH's own dedicated home, the
147
+ directory where it also keeps its sessions/profile data, and where a user who manages all of
148
+ their DSH skills in one place typically already has the rest of them.
149
+
150
+ The two DSH targets both serve **DeepSeek Harness**, whose skill provider scans both user-level
151
+ roots for its `skill` tool's catalog — and never looks at `~/.claude`/`~/.codex` at all. They are
152
+ two genuinely different directories, not two spellings of one (`~/.agents` honors
153
+ `$DSH_AGENTS_HOME`; `~/.dsh` honors `$DSH_HOME`), so either can exist without the other and
154
+ neither stands in for the other. **`dsh` is the auto-detected DSH target; `agents` is
155
+ explicit-only** (`--agent agents` or `--agent all`): `~/.agents` is a cross-tool root that other
156
+ software creates and uses for its own purposes, so its mere existence says nothing about whether
157
+ you want this skill there — and since DSH scans both roots, installing into both automatically
158
+ would register the same skill with DSH twice on any machine that has both. If you're driving this
159
+ CLI from a DSH-based agent and it reports the `web-cli` skill as "unknown or no longer available"
160
+ even though `install-skill` has already run, this is almost always why — re-run with `--agent dsh`
161
+ (or `--agent all`) to cover it. If you previously copied `skills/web-cli/` into `~/.dsh/skills/` by
162
+ hand (the only option before the `dsh` target existed), `install-skill` recognizes a byte-identical
163
+ copy as its own and takes it over (adding the marker) without needing `--force`; a copy you've since
164
+ edited is left alone unless you pass `--force`.
165
+
166
+ Previous *symlink* installs from older versions of this tool — live or dangling after an
167
+ `npm rm -g` — are likewise recognized and replaced with a copy, no `--force` required.
133
168
 
134
169
  **On a brand-new machine (e.g. a fresh Termux:X11 proot-distro Debian install), a plain
135
- `install-skill` with no `--agent` flag can silently skip the `agents` target entirely** — its
136
- auto-detection (`detectAgents` in `src/skillInstall.ts`) only targets an agent whose home directory
137
- *already exists*, and `~/.agents` (or `$DSH_AGENTS_HOME`) won't exist yet if DSH itself, or some
138
- other tool that creates it, hasn't run there before. The command still reports success (typically
139
- `{"agent":"claude","status":"installed",...}`), which reads as "the skill is installed" — but
140
- nothing was ever written to `~/.agents/skills`, so DSH's `skill` tool still can't find it. Confirm
141
- which targets actually ran by checking the `results[].agent` list in the command's own JSON output,
142
- or just always pass `--agent all` explicitly when you specifically want DSH coverage rather than
143
- relying on auto-detection. After registering (or re-registering) the `agents` target, **start a new
144
- DSH session/chat** — the skill catalog a running agent sees is loaded once, at session start, so an
145
- already-open session won't pick up a skill installed mid-conversation.
170
+ `install-skill` with no `--agent` flag can silently skip the `dsh` target entirely** — its
171
+ auto-detection (`detectAgents` in `src/skillInstall.ts`) only targets an agent whose home
172
+ directory *already exists*, and `~/.dsh` (or `$DSH_HOME`) won't exist yet if DSH itself hasn't
173
+ run there before. The command still
174
+ reports success (typically `{"agent":"claude","status":"installed",...}`), which reads as "the
175
+ skill is installed" — but nothing was ever written to either DSH root, so DSH's `skill` tool still
176
+ can't find it. Confirm which targets actually ran by checking the `results[].agent` list in the
177
+ command's own JSON output, or just always pass `--agent all` explicitly when you specifically want
178
+ DSH coverage rather than relying on auto-detection. After registering (or re-registering) either
179
+ DSH target, **start a new DSH session/chat** — the skill catalog a running agent sees is loaded
180
+ once, at session start, so an already-open session won't pick up a skill installed
181
+ mid-conversation.
146
182
 
147
183
  ### `search`/`finalize`: JSON or a human-readable report, auto-detected from whether stdout is a terminal
148
184
 
package/dist/index.js CHANGED
@@ -53412,10 +53412,33 @@ var fs14 = __toESM(require("fs"));
53412
53412
  var os5 = __toESM(require("os"));
53413
53413
  var path11 = __toESM(require("path"));
53414
53414
  var SKILL_NAME = "web-cli";
53415
- var AGENT_CHOICES = ["claude", "codex", "agents"];
53415
+ var INSTALL_MARKER_FILE = ".installed-by-web-cli.json";
53416
+ var COPY_EXCLUDES = /* @__PURE__ */ new Set([".DS_Store"]);
53417
+ var AGENT_CHOICES = ["claude", "codex", "agents", "dsh"];
53418
+ function resolveCodexHomeDir(homeDir, override) {
53419
+ const fromEnv = process.env.CODEX_HOME;
53420
+ if (override !== void 0) {
53421
+ return path11.resolve(override);
53422
+ }
53423
+ return fromEnv !== void 0 && fromEnv.trim().length > 0 ? path11.resolve(fromEnv) : path11.join(homeDir, ".codex");
53424
+ }
53416
53425
  function resolveAgentsHomeDir(homeDir, override) {
53417
53426
  return override ?? process.env.DSH_AGENTS_HOME ?? path11.join(homeDir, ".agents");
53418
53427
  }
53428
+ function resolveDshHomeDir(homeDir, override) {
53429
+ const fromEnv = process.env.DSH_HOME;
53430
+ const configured = override ?? (fromEnv !== void 0 && fromEnv.trim().length > 0 ? fromEnv : void 0);
53431
+ if (configured === void 0) {
53432
+ return path11.join(homeDir, ".dsh");
53433
+ }
53434
+ if (configured === "~") {
53435
+ return homeDir;
53436
+ }
53437
+ if (configured.startsWith("~/") || configured.startsWith("~\\")) {
53438
+ return path11.join(homeDir, configured.slice(2));
53439
+ }
53440
+ return path11.resolve(configured);
53441
+ }
53419
53442
  function resolveShippedSkillDir(fromDir) {
53420
53443
  const candidates = [
53421
53444
  path11.resolve(fromDir, "..", "skills", SKILL_NAME),
@@ -53430,20 +53453,28 @@ function resolveShippedSkillDir(fromDir) {
53430
53453
  `Could not find the bundled skill (looked for skills/${SKILL_NAME}/SKILL.md in: ${candidates.join(", ")}). This means the installed package is incomplete \u2014 reinstall with "npm install -g web-cli".`
53431
53454
  );
53432
53455
  }
53433
- function detectAgents(homeDir, agentsHomeOverride) {
53456
+ function shippedSkillVersion(shippedSkillDir) {
53457
+ try {
53458
+ const pkg = JSON.parse(fs14.readFileSync(path11.resolve(shippedSkillDir, "..", "..", "package.json"), "utf8"));
53459
+ return typeof pkg.version === "string" ? pkg.version : void 0;
53460
+ } catch {
53461
+ return void 0;
53462
+ }
53463
+ }
53464
+ function detectAgents(homeDir, overrides = {}) {
53434
53465
  const detected = [];
53435
53466
  if (fs14.existsSync(path11.join(homeDir, ".claude"))) {
53436
53467
  detected.push("claude");
53437
53468
  }
53438
- if (fs14.existsSync(path11.join(homeDir, ".codex"))) {
53469
+ if (fs14.existsSync(resolveCodexHomeDir(homeDir, overrides.codexHomeDir))) {
53439
53470
  detected.push("codex");
53440
53471
  }
53441
- if (fs14.existsSync(resolveAgentsHomeDir(homeDir, agentsHomeOverride))) {
53442
- detected.push("agents");
53472
+ if (fs14.existsSync(resolveDshHomeDir(homeDir, overrides.dshHomeDir))) {
53473
+ detected.push("dsh");
53443
53474
  }
53444
53475
  return detected;
53445
53476
  }
53446
- function resolveAgents(requested, homeDir, agentsHomeOverride) {
53477
+ function resolveAgents(requested, homeDir, overrides = {}) {
53447
53478
  if (requested === "all") {
53448
53479
  return [...AGENT_CHOICES];
53449
53480
  }
@@ -53455,32 +53486,10 @@ function resolveAgents(requested, homeDir, agentsHomeOverride) {
53455
53486
  }
53456
53487
  return names;
53457
53488
  }
53458
- const detected = detectAgents(homeDir, agentsHomeOverride);
53489
+ const detected = detectAgents(homeDir, overrides);
53459
53490
  return detected.length ? detected : ["claude"];
53460
53491
  }
53461
53492
  var CODEX_PROMPT_MARKER = "# web-cli \u2014 search/retrieval CLI usage guidance";
53462
- function buildCodexPrompt(shippedSkillDir) {
53463
- const skillFile = path11.join(shippedSkillDir, "SKILL.md");
53464
- const anatomyFile = path11.join(shippedSkillDir, "references", "anatomy-lookup.md");
53465
- return [
53466
- CODEX_PROMPT_MARKER,
53467
- "",
53468
- `Read \`${skillFile}\` now, and follow it for the rest of this session whenever you run the`,
53469
- "`web-cli` command \u2014 before any `search`, `get`, `login`, or `observe` call. It documents the",
53470
- "three-tier discovery/replay model and site-specific gotchas that fail or mislead in non-obvious",
53471
- "ways if you don't know about them going in.",
53472
- "",
53473
- `Also read \`${anatomyFile}\` whenever the query is about a specific anatomical structure, layer,`,
53474
- "or historical/Latin synonym \u2014 subscription clinical sites (UpToDate, ClinicalKey) are",
53475
- "practice-medicine resources and routinely lack this granularity; FMA and Terminologia Anatomica",
53476
- "are the actual controlled vocabularies for it.",
53477
- "",
53478
- "Both files live inside the installed `web-cli` npm package, so they stay in step with the CLI",
53479
- "itself. If the paths above no longer exist, the package moved or was upgraded to a different",
53480
- "location \u2014 re-run `web-cli install-skill` to refresh this prompt.",
53481
- ""
53482
- ].join("\n");
53483
- }
53484
53493
  function symlinkTarget(target) {
53485
53494
  try {
53486
53495
  return path11.resolve(path11.dirname(target), fs14.readlinkSync(target));
@@ -53518,11 +53527,15 @@ function isOurCodexPrompt(target) {
53518
53527
  return false;
53519
53528
  }
53520
53529
  }
53530
+ function isOurInstalledCopy(target) {
53531
+ const stats = lstatOrNull(target);
53532
+ return stats !== null && stats.isDirectory() && !stats.isSymbolicLink() && fs14.existsSync(path11.join(target, INSTALL_MARKER_FILE));
53533
+ }
53521
53534
  function relativeFileList(dir) {
53522
- return fs14.readdirSync(dir, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => path11.relative(dir, path11.join(entry.parentPath, entry.name))).sort();
53535
+ return fs14.readdirSync(dir, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile() && entry.name !== INSTALL_MARKER_FILE && !COPY_EXCLUDES.has(entry.name)).map((entry) => path11.relative(dir, path11.join(entry.parentPath, entry.name))).sort();
53523
53536
  }
53524
- function isCopyOfShippedSkill(target, shippedSkillDir) {
53525
- if (!shippedSkillDir || !fs14.existsSync(shippedSkillDir)) {
53537
+ function matchesShippedSkill(target, shippedSkillDir) {
53538
+ if (!shippedSkillDir || !fs14.existsSync(shippedSkillDir) || !lstatOrNull(target)?.isDirectory()) {
53526
53539
  return false;
53527
53540
  }
53528
53541
  try {
@@ -53537,126 +53550,94 @@ function isCopyOfShippedSkill(target, shippedSkillDir) {
53537
53550
  return false;
53538
53551
  }
53539
53552
  }
53540
- function installClaude(options, homeDir, cwd) {
53541
- const skillsRoot = options.project ? path11.join(cwd, ".claude", "skills") : path11.join(homeDir, ".claude", "skills");
53542
- const target = path11.join(skillsRoot, SKILL_NAME);
53543
- const shipped = options.shippedSkillDir;
53544
- const linkPath = options.project && shipped.startsWith(cwd + path11.sep) ? path11.relative(path11.dirname(target), shipped) : shipped;
53545
- const existing = lstatOrNull(target);
53546
- let replaced = false;
53547
- if (existing) {
53548
- const linked = symlinkTarget(target);
53549
- if (linked === shipped && fs14.existsSync(linked)) {
53550
- return { agent: "claude", path: target, status: "already-current", kind: "symlink", detail: shipped };
53551
- }
53552
- const reclaimable = isOurSkillLink(target) || isCopyOfShippedSkill(target, shipped);
53553
- if (!reclaimable && !options.force) {
53554
- return { agent: "claude", path: target, status: "blocked", kind: "symlink", detail: describeExisting(target) };
53555
- }
53556
- fs14.rmSync(target, { recursive: true, force: true });
53557
- replaced = true;
53558
- }
53559
- fs14.mkdirSync(skillsRoot, { recursive: true });
53560
- try {
53561
- fs14.symlinkSync(linkPath, target, "dir");
53562
- return {
53563
- agent: "claude",
53564
- path: target,
53565
- status: replaced ? "replaced" : "installed",
53566
- kind: "symlink",
53567
- detail: linkPath
53568
- };
53569
- } catch (err) {
53570
- const code = err.code;
53571
- if (code !== "EPERM" && code !== "EACCES") {
53572
- throw err;
53573
- }
53574
- fs14.cpSync(shipped, target, { recursive: true });
53575
- return {
53576
- agent: "claude",
53577
- path: target,
53578
- status: replaced ? "replaced" : "installed",
53579
- kind: "copy",
53580
- detail: "symlinks unavailable on this platform \u2014 copied instead; re-run install-skill after upgrading the CLI"
53581
- };
53582
- }
53583
- }
53584
- function installCodex(options, homeDir) {
53585
- const promptsDir = path11.join(homeDir, ".codex", "prompts");
53586
- const target = path11.join(promptsDir, `${SKILL_NAME}.md`);
53587
- const contents = buildCodexPrompt(options.shippedSkillDir);
53588
- const existing = lstatOrNull(target);
53589
- let replaced = false;
53590
- if (existing) {
53591
- const current = existing.isFile() ? fs14.readFileSync(target, "utf8") : null;
53592
- if (current === contents) {
53593
- return { agent: "codex", path: target, status: "already-current", kind: "pointer" };
53594
- }
53595
- if (!isOurCodexPrompt(target) && !options.force) {
53596
- return { agent: "codex", path: target, status: "blocked", kind: "pointer", detail: describeExisting(target) };
53597
- }
53598
- fs14.rmSync(target, { recursive: true, force: true });
53599
- replaced = true;
53553
+ function copyShippedSkill(shippedSkillDir, target) {
53554
+ fs14.mkdirSync(path11.dirname(target), { recursive: true });
53555
+ fs14.cpSync(shippedSkillDir, target, {
53556
+ recursive: true,
53557
+ filter: (src) => !COPY_EXCLUDES.has(path11.basename(src))
53558
+ });
53559
+ const marker = {
53560
+ installer: "web-cli",
53561
+ version: shippedSkillVersion(shippedSkillDir) ?? null,
53562
+ source: shippedSkillDir,
53563
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
53564
+ note: "This directory is a copy managed by `web-cli install-skill`; re-run it to refresh, or `web-cli uninstall-skill` to remove."
53565
+ };
53566
+ fs14.writeFileSync(path11.join(target, INSTALL_MARKER_FILE), JSON.stringify(marker, null, 2) + "\n", "utf8");
53567
+ }
53568
+ function skillsRootFor(agent, options, homeDir, cwd) {
53569
+ switch (agent) {
53570
+ case "claude":
53571
+ return path11.join(options.project ? cwd : homeDir, ".claude", "skills");
53572
+ case "codex":
53573
+ return path11.join(resolveCodexHomeDir(homeDir, options.codexHomeDir), "skills");
53574
+ case "agents":
53575
+ return path11.join(resolveAgentsHomeDir(homeDir, options.agentsHomeDir), "skills");
53576
+ case "dsh":
53577
+ return path11.join(resolveDshHomeDir(homeDir, options.dshHomeDir), "skills");
53578
+ }
53579
+ }
53580
+ function legacyCodexPromptPath(options, homeDir) {
53581
+ return path11.join(resolveCodexHomeDir(homeDir, options.codexHomeDir), "prompts", `${SKILL_NAME}.md`);
53582
+ }
53583
+ function cleanUpLegacyCodexPrompt(options, homeDir) {
53584
+ const prompt = legacyCodexPromptPath(options, homeDir);
53585
+ if (!isOurCodexPrompt(prompt)) {
53586
+ return null;
53600
53587
  }
53601
- fs14.mkdirSync(promptsDir, { recursive: true });
53602
- fs14.writeFileSync(target, contents, "utf8");
53603
- return { agent: "codex", path: target, status: replaced ? "replaced" : "installed", kind: "pointer" };
53588
+ fs14.rmSync(prompt, { force: true });
53589
+ return `removed legacy pointer prompt ${prompt}`;
53604
53590
  }
53605
- function installAgents(options, homeDir) {
53606
- const agentsHome = resolveAgentsHomeDir(homeDir, options.agentsHomeDir);
53607
- const skillsRoot = path11.join(agentsHome, "skills");
53591
+ function installCopyInto(agent, skillsRoot, options) {
53608
53592
  const target = path11.join(skillsRoot, SKILL_NAME);
53609
53593
  const shipped = options.shippedSkillDir;
53610
- const existing = lstatOrNull(target);
53611
- let replaced = false;
53612
- if (existing) {
53613
- const linked = symlinkTarget(target);
53614
- if (linked === shipped && fs14.existsSync(linked)) {
53615
- return { agent: "agents", path: target, status: "already-current", kind: "symlink", detail: shipped };
53616
- }
53617
- const reclaimable = isOurSkillLink(target) || isCopyOfShippedSkill(target, shipped);
53618
- if (!reclaimable && !options.force) {
53619
- return { agent: "agents", path: target, status: "blocked", kind: "symlink", detail: describeExisting(target) };
53594
+ const version = shippedSkillVersion(shipped);
53595
+ const provenance = `copied from ${shipped}${version ? ` (v${version})` : ""}`;
53596
+ let status = "installed";
53597
+ if (lstatOrNull(target)) {
53598
+ const current = matchesShippedSkill(target, shipped);
53599
+ if (isOurInstalledCopy(target)) {
53600
+ if (current) {
53601
+ return { agent, path: target, status: "already-current", kind: "copy", detail: provenance };
53602
+ }
53603
+ status = "updated";
53604
+ } else if (isOurSkillLink(target) || current) {
53605
+ status = "replaced";
53606
+ } else if (options.force) {
53607
+ status = "replaced";
53608
+ } else {
53609
+ return { agent, path: target, status: "blocked", kind: "copy", detail: describeExisting(target) };
53620
53610
  }
53621
53611
  fs14.rmSync(target, { recursive: true, force: true });
53622
- replaced = true;
53623
- }
53624
- fs14.mkdirSync(skillsRoot, { recursive: true });
53625
- try {
53626
- fs14.symlinkSync(shipped, target, "dir");
53627
- return { agent: "agents", path: target, status: replaced ? "replaced" : "installed", kind: "symlink", detail: shipped };
53628
- } catch (err) {
53629
- const code = err.code;
53630
- if (code !== "EPERM" && code !== "EACCES") {
53631
- throw err;
53632
- }
53633
- fs14.cpSync(shipped, target, { recursive: true });
53634
- return {
53635
- agent: "agents",
53636
- path: target,
53637
- status: replaced ? "replaced" : "installed",
53638
- kind: "copy",
53639
- detail: "symlinks unavailable on this platform \u2014 copied instead; re-run install-skill after upgrading the CLI"
53640
- };
53641
53612
  }
53613
+ copyShippedSkill(shipped, target);
53614
+ return { agent, path: target, status, kind: "copy", detail: provenance };
53642
53615
  }
53643
53616
  function installSkill(options) {
53644
53617
  const homeDir = options.homeDir ?? os5.homedir();
53645
53618
  const cwd = options.cwd ?? process.cwd();
53646
- const agents = options.agents ?? resolveAgents(void 0, homeDir, options.agentsHomeDir);
53647
- return agents.map(
53648
- (agent) => agent === "claude" ? installClaude(options, homeDir, cwd) : agent === "codex" ? installCodex(options, homeDir) : installAgents(options, homeDir)
53649
- );
53619
+ const agents = options.agents ?? resolveAgents(void 0, homeDir, options);
53620
+ return agents.map((agent) => {
53621
+ const result = installCopyInto(agent, skillsRootFor(agent, options, homeDir, cwd), options);
53622
+ if (agent === "codex" && result.status !== "blocked") {
53623
+ const note = cleanUpLegacyCodexPrompt(options, homeDir);
53624
+ if (note) {
53625
+ result.detail = result.detail ? `${result.detail}; ${note}` : note;
53626
+ }
53627
+ }
53628
+ return result;
53629
+ });
53650
53630
  }
53651
53631
  function uninstallSkill(options) {
53652
53632
  const homeDir = options.homeDir ?? os5.homedir();
53653
53633
  const cwd = options.cwd ?? process.cwd();
53654
53634
  return options.agents.map((agent) => {
53655
- const target = agent === "claude" ? path11.join(options.project ? path11.join(cwd, ".claude") : path11.join(homeDir, ".claude"), "skills", SKILL_NAME) : agent === "codex" ? path11.join(homeDir, ".codex", "prompts", `${SKILL_NAME}.md`) : path11.join(resolveAgentsHomeDir(homeDir, options.agentsHomeDir), "skills", SKILL_NAME);
53635
+ const target = path11.join(skillsRootFor(agent, options, homeDir, cwd), SKILL_NAME);
53636
+ const legacyNote = agent === "codex" ? cleanUpLegacyCodexPrompt(options, homeDir) : null;
53656
53637
  if (!lstatOrNull(target)) {
53657
- return { agent, path: target, status: "not-registered" };
53638
+ return { agent, path: target, status: "not-registered", ...legacyNote ? { detail: legacyNote } : {} };
53658
53639
  }
53659
- const ours = agent === "codex" ? isOurCodexPrompt(target) : isOurSkillLink(target) || isCopyOfShippedSkill(target, options.shippedSkillDir);
53640
+ const ours = isOurInstalledCopy(target) || isOurSkillLink(target) || matchesShippedSkill(target, options.shippedSkillDir);
53660
53641
  if (!ours && !options.force) {
53661
53642
  return {
53662
53643
  agent,
@@ -53665,9 +53646,9 @@ function uninstallSkill(options) {
53665
53646
  detail: `${describeExisting(target)} \u2014 not something this CLI created; re-run with --force to delete it anyway`
53666
53647
  };
53667
53648
  }
53668
- const detail = symlinkTarget(target) ?? void 0;
53649
+ const what = symlinkTarget(target) ? `symlink -> ${symlinkTarget(target)}` : "installed copy";
53669
53650
  fs14.rmSync(target, { recursive: true, force: true });
53670
- return { agent, path: target, status: "removed", detail };
53651
+ return { agent, path: target, status: "removed", detail: legacyNote ? `${what}; ${legacyNote}` : what };
53671
53652
  });
53672
53653
  }
53673
53654
 
@@ -53960,10 +53941,10 @@ program2.command("render-markdown").description(
53960
53941
  }
53961
53942
  });
53962
53943
  program2.command("install-skill").aliases(["install-skills"]).description(
53963
- `Registers the usage-guidance skill bundled with this package (agents: ${AGENT_CHOICES.join(
53944
+ `Copies the usage-guidance skill bundled with this package into your AI agent's skills folder (agents: ${AGENT_CHOICES.join(
53964
53945
  ", "
53965
- )}) with your AI agent, so /web-cli works alongside these commands \u2014 defaults to whichever agents are installed`
53966
- ).option("--agent <agent>", `"${AGENT_CHOICES.join("|")}", or "all"`).option("--project", "install into <cwd>/.claude/skills instead of ~/.claude/skills (Claude Code only)").option("--force", "replace an existing registration that is not already ours").action(
53946
+ )}), so /web-cli works alongside these commands; re-run after upgrading the CLI to refresh the copies \u2014 defaults to whichever of claude/codex/dsh are installed ("agents" is never auto-selected)`
53947
+ ).option("--agent <agent>", `"${AGENT_CHOICES.join("|")}" (comma-separable), or "all"`).option("--project", "install into <cwd>/.claude/skills instead of ~/.claude/skills (Claude Code only)").option("--force", "replace an existing registration that is not already ours").action(
53967
53948
  wrap(
53968
53949
  async (opts) => runInstallSkill({ agent: opts.agent, project: opts.project, force: opts.force })
53969
53950
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ysgao/web-cli",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Self-discovering REST API CLI for subscription medical-knowledge sites, driven by an AI agent",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {