mdedit-cli 0.3.5 → 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 +17 -11
- package/dist/index.js +247 -92
- package/dist/index.js.map +1 -1
- package/openclaw.json +8 -7
- package/package.json +5 -5
- package/skills/catalog.json +164 -0
- package/skills/find-mdedit-document/cli/SKILL.md +21 -0
- package/skills/find-mdedit-document/mcp/SKILL.md +23 -0
- package/skills/publish-mdedit-document/cli/SKILL.md +20 -0
- package/skills/publish-mdedit-document/mcp/SKILL.md +20 -0
- package/skills/revise-mdedit-document/cli/SKILL.md +19 -0
- package/skills/revise-mdedit-document/mcp/SKILL.md +23 -0
- package/skills/save-mdedit-document/cli/SKILL.md +22 -0
- package/skills/save-mdedit-document/mcp/SKILL.md +21 -0
- package/skill.md +0 -333
package/README.md
CHANGED
|
@@ -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
|
-
###
|
|
152
|
+
### Agent skills
|
|
153
153
|
|
|
154
|
-
|
|
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
|
-
#
|
|
158
|
-
mdedit skill
|
|
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
|
|
162
|
+
# Install all four CLI-backed skills for the current project
|
|
161
163
|
mdedit skill install
|
|
162
164
|
|
|
163
|
-
#
|
|
164
|
-
mdedit skill install --target claude
|
|
165
|
-
mdedit skill install --target cursor
|
|
166
|
-
mdedit skill install --target
|
|
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
|
-
#
|
|
169
|
-
mdedit skill install --
|
|
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((
|
|
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((
|
|
977
|
-
resolveResult =
|
|
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((
|
|
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",
|
|
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((
|
|
1055
|
+
close: () => new Promise((resolve) => {
|
|
1056
1056
|
if (timeout) clearTimeout(timeout);
|
|
1057
1057
|
if (!server.listening) {
|
|
1058
|
-
|
|
1058
|
+
resolve();
|
|
1059
1059
|
return;
|
|
1060
1060
|
}
|
|
1061
|
-
server.close(() =>
|
|
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((
|
|
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", () =>
|
|
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((
|
|
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.");
|
|
@@ -2606,96 +2606,251 @@ function createApiKeyCommands() {
|
|
|
2606
2606
|
|
|
2607
2607
|
// src/commands/skill.ts
|
|
2608
2608
|
init_output();
|
|
2609
|
-
import {
|
|
2610
|
-
import {
|
|
2611
|
-
|
|
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
|
-
|
|
2615
|
-
var __dirname = dirname(
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
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
|
-
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
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
|
-
|
|
2644
|
-
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2647
|
-
|
|
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
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
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
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
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
|
-
|
|
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("
|
|
2676
|
-
skill.command("
|
|
2677
|
-
|
|
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("
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
const
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
|
-
|
|
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
|
|
2859
|
-
var __dirname2 = dirname2(
|
|
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"));
|