mdedit-cli 0.3.4 → 0.4.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 CHANGED
@@ -3,7 +3,7 @@
3
3
  Official command-line interface for [mdedit.ai](https://mdedit.ai).
4
4
 
5
5
  Links:
6
- - [CLI docs](https://docs.mdedit.ai/cli)
6
+ - [CLI docs](https://mdedit.ai/docs/cli)
7
7
  - [mdedit.ai homepage](https://mdedit.ai)
8
8
 
9
9
  ## Install
@@ -16,7 +16,7 @@ npm install -g mdedit-cli
16
16
 
17
17
  All APIs require authentication. Create an API key here:
18
18
 
19
- - [API key docs](https://docs.mdedit.ai/api-keys)
19
+ - [API key docs](https://mdedit.ai/docs/api-keys)
20
20
 
21
21
  Interactive browser OAuth is also available in explicitly enabled cohorts. It
22
22
  uses authorization code + PKCE, a fixed loopback callback, and the operating
@@ -149,26 +149,32 @@ The CLI is designed to be used by AI agents without modification.
149
149
  - Use `--yes` on destructive commands to skip confirmation
150
150
  - Pipe content via `--file -` (stdin) or `--content-only` (stdout)
151
151
 
152
- ### Skill file
152
+ ### Agent skills
153
153
 
154
- A comprehensive agent skill document is included with the CLI. It covers all commands, flags, workflows, and error handling in a format optimised for AI agents (Claude Code, Cursor, GitHub Copilot, etc.).
154
+ The canonical Save, Find, Revise, and Publish skills are bundled in focused CLI-backed and MCP-backed variants.
155
155
 
156
156
  ```bash
157
- # View the skill
158
- mdedit skill show
157
+ # List and inspect skills
158
+ mdedit skill list
159
+ mdedit skill show save-mdedit-document --via cli
160
+ mdedit skill show revise-mdedit-document --via mcp
159
161
 
160
- # Install the skill into all detected agent config files
162
+ # Install all four CLI-backed skills for the current project
161
163
  mdedit skill install
162
164
 
163
- # Install into a specific tool only
164
- mdedit skill install --target claude # → CLAUDE.md
165
- mdedit skill install --target cursor # → .cursor/rules/mdedit.mdc
166
- mdedit skill install --target codex # → .github/copilot-instructions.md
165
+ # Select a host-native directory or MCP-backed variant
166
+ mdedit skill install --target claude --via mcp
167
+ mdedit skill install --target cursor
168
+ mdedit skill install publish-mdedit-document --target gemini --via mcp
167
169
 
168
- # Install to home-directory (global) targets
169
- mdedit skill install --global
170
+ # User scope, diagnostics, and safe removal
171
+ mdedit skill install --scope user
172
+ mdedit skill doctor
173
+ mdedit skill uninstall save-mdedit-document
170
174
  ```
171
175
 
176
+ Project scope is the default. Installations carry mdedit ownership and content checksums: edited or unowned skills are not overwritten without `--force`, and uninstall removes only unchanged mdedit-owned artifacts. `doctor` reports legacy monolithic `CLAUDE.md`, Cursor rule, and Copilot instruction installs without modifying them.
177
+
172
178
  ### OpenClaw plugin
173
179
 
174
180
  An `openclaw.json` plugin manifest is included in the package. It defines every CLI tool as a structured, machine-readable entry that OpenClaw-compatible agents can load directly.
package/dist/index.js CHANGED
@@ -540,7 +540,7 @@ var init_dist = __esm({
540
540
  }
541
541
  return true;
542
542
  };
543
- sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
543
+ sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
544
544
  isRetriableStatus = (status) => status === 429 || status === 500 || status === 502 || status === 503 || status === 504;
545
545
  withRetries = async (fn, maxAttempts = 3) => {
546
546
  let lastError;
@@ -973,8 +973,8 @@ async function startLoopbackCallback({
973
973
  }
974
974
  let resolveResult;
975
975
  let rejectResult;
976
- const result = new Promise((resolve2, reject) => {
977
- resolveResult = resolve2;
976
+ const result = new Promise((resolve, reject) => {
977
+ resolveResult = resolve;
978
978
  rejectResult = reject;
979
979
  });
980
980
  let settled = false;
@@ -1024,7 +1024,7 @@ async function startLoopbackCallback({
1024
1024
  }
1025
1025
  finish(void 0, code);
1026
1026
  });
1027
- await new Promise((resolve2, reject) => {
1027
+ await new Promise((resolve, reject) => {
1028
1028
  server.once("error", (error) => {
1029
1029
  if (error.code === "EADDRINUSE") {
1030
1030
  reject(new OAuthClientError(
@@ -1036,7 +1036,7 @@ async function startLoopbackCallback({
1036
1036
  }
1037
1037
  reject(error);
1038
1038
  });
1039
- server.listen(port, "127.0.0.1", resolve2);
1039
+ server.listen(port, "127.0.0.1", resolve);
1040
1040
  });
1041
1041
  const address = server.address();
1042
1042
  const boundPort = typeof address === "object" && address ? address.port : port;
@@ -1052,13 +1052,13 @@ async function startLoopbackCallback({
1052
1052
  return {
1053
1053
  port: boundPort,
1054
1054
  result,
1055
- close: () => new Promise((resolve2) => {
1055
+ close: () => new Promise((resolve) => {
1056
1056
  if (timeout) clearTimeout(timeout);
1057
1057
  if (!server.listening) {
1058
- resolve2();
1058
+ resolve();
1059
1059
  return;
1060
1060
  }
1061
- server.close(() => resolve2());
1061
+ server.close(() => resolve());
1062
1062
  })
1063
1063
  };
1064
1064
  }
@@ -1770,10 +1770,10 @@ function presentArticleDetails(article) {
1770
1770
  // src/commands/article.ts
1771
1771
  async function readContentFromFile(filePath) {
1772
1772
  if (filePath === "-") {
1773
- return new Promise((resolve2, reject) => {
1773
+ return new Promise((resolve, reject) => {
1774
1774
  const chunks = [];
1775
1775
  process.stdin.on("data", (d) => chunks.push(Buffer.isBuffer(d) ? d : Buffer.from(d)));
1776
- process.stdin.on("end", () => resolve2(Buffer.concat(chunks).toString("utf-8")));
1776
+ process.stdin.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")));
1777
1777
  process.stdin.on("error", reject);
1778
1778
  });
1779
1779
  }
@@ -1958,7 +1958,7 @@ function createArticleCommands() {
1958
1958
  throw error;
1959
1959
  }
1960
1960
  }
1961
- await new Promise((resolve2) => setTimeout(resolve2, 500));
1961
+ await new Promise((resolve) => setTimeout(resolve, 500));
1962
1962
  }
1963
1963
  if (checkpointedContentHash !== expectedContentHash) {
1964
1964
  throw new Error("Collaborative content did not reach a durable checkpoint within 10 seconds.");
@@ -2476,7 +2476,7 @@ function createConfigCommands() {
2476
2476
  config.command("login").description("Set API key authentication").option("-k, --api-key <key>", "API key").option("-u, --url <url>", "API URL").action(async (options) => {
2477
2477
  let apiKey = options.apiKey || process.env.MDEDIT_API_KEY;
2478
2478
  if (!apiKey) {
2479
- output.info("Get an API key: https://docs.mdedit.ai/api-keys");
2479
+ output.info("Get an API key: https://mdedit.ai/docs/api-keys");
2480
2480
  const answers = await inquirer4.prompt([
2481
2481
  {
2482
2482
  type: "password",
@@ -2606,96 +2606,251 @@ function createApiKeyCommands() {
2606
2606
 
2607
2607
  // src/commands/skill.ts
2608
2608
  init_output();
2609
- import { Command as Command6 } from "commander";
2610
- import { readFileSync as readFileSync2, mkdirSync as mkdirSync2, existsSync as existsSync2, appendFileSync, writeFileSync as writeFileSync2 } from "fs";
2611
- import { dirname, join as join2, resolve } from "path";
2609
+ import { createHash as createHash3 } from "crypto";
2610
+ import {
2611
+ existsSync as existsSync2,
2612
+ mkdirSync as mkdirSync2,
2613
+ readFileSync as readFileSync2,
2614
+ readdirSync,
2615
+ renameSync,
2616
+ rmSync,
2617
+ writeFileSync as writeFileSync2
2618
+ } from "fs";
2612
2619
  import { homedir as homedir2 } from "os";
2620
+ import { dirname, join as join2 } from "path";
2613
2621
  import { fileURLToPath } from "url";
2614
- var __filename = fileURLToPath(import.meta.url);
2615
- var __dirname = dirname(__filename);
2616
- function getSkillContent() {
2617
- const candidates = [join2(__dirname, "../skill.md"), join2(__dirname, "../../skill.md")];
2618
- for (const candidate of candidates) {
2619
- if (existsSync2(candidate)) return readFileSync2(candidate, "utf-8");
2622
+ import { Command as Command6 } from "commander";
2623
+ var __dirname = dirname(fileURLToPath(import.meta.url));
2624
+ var OWNER = "mdedit-cli";
2625
+ var METADATA_FILE = ".mdedit-skill.json";
2626
+ var TARGET_ROOTS = {
2627
+ agents: { project: [".agents", "skills"], user: [".agents", "skills"] },
2628
+ claude: { project: [".claude", "skills"], user: [".claude", "skills"] },
2629
+ cursor: { project: [".cursor", "skills"], user: [".cursor", "skills"] },
2630
+ gemini: { project: [".gemini", "skills"], user: [".gemini", "skills"] }
2631
+ };
2632
+ function skillsRoot() {
2633
+ const candidates = [join2(__dirname, "../skills"), join2(__dirname, "../../skills")];
2634
+ const found = candidates.find((candidate) => existsSync2(join2(candidate, "catalog.json")));
2635
+ if (!found) throw new Error(`Bundled skills catalog not found (searched: ${candidates.join(", ")})`);
2636
+ return found;
2637
+ }
2638
+ function catalog() {
2639
+ return JSON.parse(readFileSync2(join2(skillsRoot(), "catalog.json"), "utf8"));
2640
+ }
2641
+ function sha256(content) {
2642
+ return createHash3("sha256").update(content).digest("hex");
2643
+ }
2644
+ function parseVia(value) {
2645
+ const via = String(value || "cli").toLowerCase();
2646
+ if (via !== "cli" && via !== "mcp") throw new Error("Unknown variant. Valid values: cli, mcp");
2647
+ return via;
2648
+ }
2649
+ function parseScope(options) {
2650
+ const value = options.global ? "user" : String(options.scope || "project").toLowerCase();
2651
+ if (value !== "project" && value !== "user") {
2652
+ throw new Error("Unknown scope. Valid values: project, user");
2620
2653
  }
2621
- throw new Error(`skill.md not found (searched: ${candidates.join(", ")})`);
2622
- }
2623
- var NAMED_TARGETS = ["claude", "cursor", "codex"];
2624
- var TARGETS = {
2625
- claude: {
2626
- label: "Claude Code",
2627
- path: (_cwd, global) => global ? join2(homedir2(), ".claude", "CLAUDE.md") : join2(process.cwd(), "CLAUDE.md"),
2628
- mode: "append-section",
2629
- sectionHeading: "## mdedit CLI"
2630
- },
2631
- cursor: {
2632
- label: "Cursor",
2633
- path: (_cwd, global) => global ? join2(homedir2(), ".cursor", "rules", "mdedit.mdc") : join2(process.cwd(), ".cursor", "rules", "mdedit.mdc"),
2634
- mode: "write"
2635
- },
2636
- codex: {
2637
- label: "GitHub Copilot / Codex",
2638
- path: (cwd, _global) => join2(cwd, ".github", "copilot-instructions.md"),
2639
- mode: "append-section",
2640
- sectionHeading: "## mdedit CLI"
2654
+ return value;
2655
+ }
2656
+ function parseTarget(value) {
2657
+ const normalized = String(value || "agents").toLowerCase();
2658
+ const target = normalized === "codex" ? "agents" : normalized;
2659
+ if (!["agents", "claude", "cursor", "gemini"].includes(target)) {
2660
+ throw new Error("Unknown target. Valid values: agents, claude, cursor, gemini");
2641
2661
  }
2642
- };
2643
- function installToTarget(spec, skillContent, global) {
2644
- const targetPath = spec.path(process.cwd(), global);
2645
- const dir = dirname(resolve(targetPath));
2646
- if (!existsSync2(dir)) {
2647
- mkdirSync2(dir, { recursive: true });
2662
+ return target;
2663
+ }
2664
+ function targetRoot(target, scope) {
2665
+ const base = scope === "user" ? homedir2() : process.cwd();
2666
+ return join2(base, ...TARGET_ROOTS[target][scope]);
2667
+ }
2668
+ function selectSkills(skillIds, available) {
2669
+ const requested = skillIds?.filter(Boolean) || [];
2670
+ if (requested.length === 0 || requested.includes("all")) return available;
2671
+ const byId = new Map(available.map((skill) => [skill.id, skill]));
2672
+ const unknown = requested.filter((id) => !byId.has(id));
2673
+ if (unknown.length > 0) {
2674
+ throw new Error(`Unknown skill${unknown.length === 1 ? "" : "s"}: ${unknown.join(", ")}`);
2648
2675
  }
2649
- if (spec.mode === "write") {
2650
- writeFileSync2(targetPath, skillContent, "utf-8");
2651
- output.success(`${spec.label}: skill written to ${targetPath}`);
2652
- return;
2676
+ return [...new Set(requested)].map((id) => byId.get(id));
2677
+ }
2678
+ function skillContent(skillId, via) {
2679
+ return readFileSync2(join2(skillsRoot(), skillId, via, "SKILL.md"), "utf8");
2680
+ }
2681
+ function readMetadata(path) {
2682
+ if (!existsSync2(path)) return null;
2683
+ try {
2684
+ const value = JSON.parse(readFileSync2(path, "utf8"));
2685
+ return value.owner === OWNER ? value : null;
2686
+ } catch {
2687
+ return null;
2653
2688
  }
2654
- const heading = spec.sectionHeading ?? "## mdedit CLI";
2655
- if (existsSync2(targetPath)) {
2656
- const existing = readFileSync2(targetPath, "utf-8");
2657
- if (existing.includes(heading)) {
2658
- output.info(`${spec.label}: skill section already present in ${targetPath} (skipped)`);
2659
- return;
2689
+ }
2690
+ function atomicWrite(path, content) {
2691
+ mkdirSync2(dirname(path), { recursive: true });
2692
+ const temporary = `${path}.tmp-${process.pid}-${Date.now()}`;
2693
+ writeFileSync2(temporary, content, { encoding: "utf8", flag: "wx" });
2694
+ renameSync(temporary, path);
2695
+ }
2696
+ function installOne(skill, via, root, catalogVersion, force) {
2697
+ const directory = join2(root, skill.id);
2698
+ const skillPath = join2(directory, "SKILL.md");
2699
+ const metadataPath = join2(directory, METADATA_FILE);
2700
+ const content = skillContent(skill.id, via);
2701
+ const contentSha256 = sha256(content);
2702
+ const metadata = readMetadata(metadataPath);
2703
+ if (existsSync2(skillPath)) {
2704
+ if (!metadata || metadata.skillId !== skill.id) {
2705
+ if (!force) throw new Error(`${skillPath} is not owned by mdedit; use --force to replace it`);
2706
+ } else {
2707
+ const currentSha = sha256(readFileSync2(skillPath, "utf8"));
2708
+ if (currentSha !== metadata.contentSha256 && !force) {
2709
+ throw new Error(`${skillPath} was edited after installation; use --force to replace it`);
2710
+ }
2711
+ if (currentSha === contentSha256 && metadata.via === via && metadata.catalogVersion === catalogVersion) {
2712
+ return { skillId: skill.id, status: "unchanged", path: skillPath, via };
2713
+ }
2660
2714
  }
2661
- const trimmed = existing.trimEnd();
2662
- appendFileSync(targetPath, `${trimmed}
2663
-
2664
- ${heading}
2665
-
2666
- ${skillContent}`, "utf-8");
2667
- } else {
2668
- writeFileSync2(targetPath, `${heading}
2669
-
2670
- ${skillContent}`, "utf-8");
2671
2715
  }
2672
- output.success(`${spec.label}: skill appended to ${targetPath}`);
2716
+ const status = existsSync2(skillPath) ? "updated" : "installed";
2717
+ const nextMetadata = {
2718
+ owner: OWNER,
2719
+ skillId: skill.id,
2720
+ via,
2721
+ catalogVersion,
2722
+ contentSha256,
2723
+ installedAt: (/* @__PURE__ */ new Date()).toISOString()
2724
+ };
2725
+ atomicWrite(skillPath, content);
2726
+ atomicWrite(metadataPath, `${JSON.stringify(nextMetadata, null, 2)}
2727
+ `);
2728
+ return { skillId: skill.id, status, path: skillPath, via };
2729
+ }
2730
+ function assertInstallable(skill, via, root, force) {
2731
+ const directory = join2(root, skill.id);
2732
+ const skillPath = join2(directory, "SKILL.md");
2733
+ skillContent(skill.id, via);
2734
+ if (!existsSync2(skillPath)) return;
2735
+ const metadata = readMetadata(join2(directory, METADATA_FILE));
2736
+ if ((!metadata || metadata.skillId !== skill.id) && !force) {
2737
+ throw new Error(`${skillPath} is not owned by mdedit; use --force to replace it`);
2738
+ }
2739
+ if (metadata?.skillId === skill.id && sha256(readFileSync2(skillPath, "utf8")) !== metadata.contentSha256 && !force) {
2740
+ throw new Error(`${skillPath} was edited after installation; use --force to replace it`);
2741
+ }
2742
+ }
2743
+ function uninstallOne(skill, root) {
2744
+ const directory = join2(root, skill.id);
2745
+ const skillPath = join2(directory, "SKILL.md");
2746
+ const metadataPath = join2(directory, METADATA_FILE);
2747
+ if (!existsSync2(skillPath) && !existsSync2(metadataPath)) {
2748
+ return { skillId: skill.id, status: "not-installed", path: skillPath };
2749
+ }
2750
+ const metadata = readMetadata(metadataPath);
2751
+ if (!metadata || metadata.skillId !== skill.id || !existsSync2(skillPath)) {
2752
+ throw new Error(`${directory} is not a complete mdedit-owned installation; it was left unchanged`);
2753
+ }
2754
+ if (sha256(readFileSync2(skillPath, "utf8")) !== metadata.contentSha256) {
2755
+ throw new Error(`${skillPath} was edited after installation; it was left unchanged`);
2756
+ }
2757
+ rmSync(skillPath);
2758
+ rmSync(metadataPath);
2759
+ if (readdirSync(directory).length === 0) rmSync(directory, { recursive: true });
2760
+ return { skillId: skill.id, status: "uninstalled", path: skillPath };
2761
+ }
2762
+ function legacyInstallations() {
2763
+ const locations = [
2764
+ { target: "Claude", path: join2(process.cwd(), "CLAUDE.md"), marker: "## mdedit CLI" },
2765
+ { target: "Cursor", path: join2(process.cwd(), ".cursor", "rules", "mdedit.mdc"), marker: "" },
2766
+ {
2767
+ target: "GitHub Copilot / Codex",
2768
+ path: join2(process.cwd(), ".github", "copilot-instructions.md"),
2769
+ marker: "## mdedit CLI"
2770
+ }
2771
+ ];
2772
+ return locations.filter(({ path, marker }) => {
2773
+ if (!existsSync2(path)) return false;
2774
+ return marker ? readFileSync2(path, "utf8").includes(marker) : true;
2775
+ }).map(({ target, path }) => ({
2776
+ target,
2777
+ path,
2778
+ guidance: "Remove the legacy mdedit block manually after reviewing it; doctor never edits host instructions."
2779
+ }));
2780
+ }
2781
+ function diagnosis(skill, via, root, catalogVersion) {
2782
+ const directory = join2(root, skill.id);
2783
+ const skillPath = join2(directory, "SKILL.md");
2784
+ const metadata = readMetadata(join2(directory, METADATA_FILE));
2785
+ if (!existsSync2(skillPath) && !metadata) return { skillId: skill.id, status: "missing", path: skillPath };
2786
+ if (!existsSync2(skillPath) || !metadata || metadata.skillId !== skill.id) {
2787
+ return { skillId: skill.id, status: "unowned-or-incomplete", path: skillPath };
2788
+ }
2789
+ const currentSha = sha256(readFileSync2(skillPath, "utf8"));
2790
+ if (currentSha !== metadata.contentSha256) return { skillId: skill.id, status: "modified", path: skillPath };
2791
+ const expectedSha = sha256(skillContent(skill.id, via));
2792
+ if (metadata.via !== via || metadata.catalogVersion !== catalogVersion || currentSha !== expectedSha) {
2793
+ return { skillId: skill.id, status: "stale", path: skillPath, installedVia: metadata.via };
2794
+ }
2795
+ return { skillId: skill.id, status: "current", path: skillPath, via };
2796
+ }
2797
+ function emitResults(results, message) {
2798
+ if (output.isJson()) output.output(results);
2799
+ else {
2800
+ output.output(results);
2801
+ output.info(message);
2802
+ }
2673
2803
  }
2674
2804
  function createSkillCommands() {
2675
- const skill = new Command6("skill").description("Manage and install the mdedit agent skill").action(() => skill.help());
2676
- skill.command("show").description("Print the mdedit agent skill to stdout").action(() => {
2677
- process.stdout.write(getSkillContent());
2805
+ const skill = new Command6("skill").description("List, inspect, install, diagnose, and safely remove mdedit agent skills").action(() => skill.help());
2806
+ skill.command("list").description("List the canonical mdedit skills").action(() => {
2807
+ const data = catalog();
2808
+ output.output(data.skills.map(({ id, title, shortDescription, scopes }) => ({ id, title, shortDescription, scopes })));
2678
2809
  });
2679
- skill.command("install").description(
2680
- "Install the mdedit skill into AI agent configuration files (Claude Code, Cursor, GitHub Copilot/Codex)"
2681
- ).option(
2682
- "-t, --target <target>",
2683
- "Which agent tool to install for: claude | cursor | codex | all (default: all)",
2684
- "all"
2685
- ).option("--global", "Install to home-directory targets instead of current project directory").action((options) => {
2686
- const target = String(options.target).toLowerCase();
2687
- const global = Boolean(options.global);
2688
- const skillContent = getSkillContent();
2689
- const validTargets = [...NAMED_TARGETS, "all"];
2690
- if (!validTargets.includes(target)) {
2691
- throw new Error(`Unknown target "${target}". Valid targets: ${validTargets.join(", ")}`);
2692
- }
2693
- const keys = target === "all" ? [...NAMED_TARGETS] : [target];
2694
- for (const key of keys) {
2695
- installToTarget(TARGETS[key], skillContent, global);
2696
- }
2697
- output.info("");
2698
- output.info("To view the installed skill at any time: mdedit skill show");
2810
+ skill.command("show <skillId>").description("Print one mdedit skill variant").option("--via <variant>", "Skill variant: cli | mcp", "cli").action((skillId, options) => {
2811
+ const data = catalog();
2812
+ const selected = selectSkills([skillId], data.skills)[0];
2813
+ const via = parseVia(options.via);
2814
+ const content = skillContent(selected.id, via);
2815
+ if (output.isJson()) output.output({ ...selected, via, content, catalogVersion: data.version });
2816
+ else process.stdout.write(content);
2817
+ });
2818
+ skill.command("install [skillIds...]").description("Install canonical mdedit skills into a native host skill directory").option("--via <variant>", "Skill variant: cli | mcp", "cli").option("--scope <scope>", "Installation scope: project | user", "project").option("--target <target>", "Host target: agents | claude | cursor | gemini", "agents").option("--global", "Legacy alias for --scope user").option("--force", "Replace an unowned or locally edited skill").action((skillIds, options) => {
2819
+ const data = catalog();
2820
+ const selected = selectSkills(skillIds, data.skills);
2821
+ const via = parseVia(options.via);
2822
+ const scope = parseScope(options);
2823
+ const target = parseTarget(options.target);
2824
+ const root = targetRoot(target, scope);
2825
+ selected.forEach((item) => assertInstallable(item, via, root, Boolean(options.force)));
2826
+ const results = selected.map((item) => installOne(item, via, root, data.version, Boolean(options.force)));
2827
+ emitResults({ target, scope, via, root, results }, "Use `mdedit skill doctor` to verify the installation.");
2828
+ });
2829
+ skill.command("uninstall [skillIds...]").description("Remove unchanged mdedit-owned skill installations").option("--scope <scope>", "Installation scope: project | user", "project").option("--target <target>", "Host target: agents | claude | cursor | gemini", "agents").option("--global", "Legacy alias for --scope user").action((skillIds, options) => {
2830
+ const data = catalog();
2831
+ const selected = selectSkills(skillIds, data.skills);
2832
+ const scope = parseScope(options);
2833
+ const target = parseTarget(options.target);
2834
+ const root = targetRoot(target, scope);
2835
+ const results = selected.map((item) => uninstallOne(item, root));
2836
+ emitResults({ target, scope, root, results }, "Only unchanged mdedit-owned files were removed.");
2837
+ });
2838
+ skill.command("doctor [skillIds...]").description("Check native skill installations and detect legacy monolithic instructions").option("--via <variant>", "Expected skill variant: cli | mcp", "cli").option("--scope <scope>", "Installation scope: project | user", "project").option("--target <target>", "Host target: agents | claude | cursor | gemini", "agents").option("--global", "Legacy alias for --scope user").action((skillIds, options) => {
2839
+ const data = catalog();
2840
+ const selected = selectSkills(skillIds, data.skills);
2841
+ const via = parseVia(options.via);
2842
+ const scope = parseScope(options);
2843
+ const target = parseTarget(options.target);
2844
+ const root = targetRoot(target, scope);
2845
+ output.output({
2846
+ target,
2847
+ scope,
2848
+ via,
2849
+ root,
2850
+ skills: selected.map((item) => diagnosis(item, via, root, data.version)),
2851
+ legacy: legacyInstallations(),
2852
+ installGuide: data.installUrl
2853
+ });
2699
2854
  });
2700
2855
  return skill;
2701
2856
  }
@@ -2855,8 +3010,8 @@ function createAuthCommands(runtime = defaultRuntime) {
2855
3010
  init_output();
2856
3011
  init_config();
2857
3012
  init_api();
2858
- var __filename2 = fileURLToPath2(import.meta.url);
2859
- var __dirname2 = dirname2(__filename2);
3013
+ var __filename = fileURLToPath2(import.meta.url);
3014
+ var __dirname2 = dirname2(__filename);
2860
3015
  var version = "0.0.0";
2861
3016
  try {
2862
3017
  const packageJson = JSON.parse(readFileSync3(join3(__dirname2, "../package.json"), "utf-8"));