zcode-app-cli 3.3.5-1
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/LICENSE +24 -0
- package/README.md +642 -0
- package/bin/zcode.js +848 -0
- package/config.example.json +110 -0
- package/package.json +81 -0
- package/vendor/.node-bundle-meta.json +6 -0
- package/vendor/extraction.json +11 -0
- package/vendor/node_modules/@zcode/tui/dist/index.js +161875 -0
- package/vendor/node_modules/@zcode/tui/package.json +14 -0
- package/vendor/packages/android-emulator-plugin/.mcp.json +19 -0
- package/vendor/packages/android-emulator-plugin/.zcode-plugin/plugin.json +63 -0
- package/vendor/packages/android-emulator-plugin/README.md +134 -0
- package/vendor/packages/android-emulator-plugin/commands/android-dev.md +11 -0
- package/vendor/packages/android-emulator-plugin/dist/lib/path.d.ts +4 -0
- package/vendor/packages/android-emulator-plugin/dist/lib/path.js +17 -0
- package/vendor/packages/android-emulator-plugin/dist/lib/result.d.ts +5 -0
- package/vendor/packages/android-emulator-plugin/dist/lib/result.js +22 -0
- package/vendor/packages/android-emulator-plugin/dist/lib/run.d.ts +18 -0
- package/vendor/packages/android-emulator-plugin/dist/lib/run.js +99 -0
- package/vendor/packages/android-emulator-plugin/dist/mcp/server.d.ts +3 -0
- package/vendor/packages/android-emulator-plugin/dist/mcp/server.js +47607 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/app.d.ts +39 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/app.js +50 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/avd.d.ts +37 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/avd.js +185 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/build.d.ts +68 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/build.js +131 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/config.d.ts +7 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/config.js +29 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/device.d.ts +20 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/device.js +91 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/logs.d.ts +15 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/logs.js +31 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/preflight.d.ts +15 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/preflight.js +123 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/project-template.d.ts +13 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/project-template.js +211 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/project.d.ts +33 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/project.js +195 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/screenshot.d.ts +14 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/screenshot.js +73 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/sdk.d.ts +14 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/sdk.js +185 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/ui.d.ts +92 -0
- package/vendor/packages/android-emulator-plugin/dist/providers/ui.js +146 -0
- package/vendor/packages/android-emulator-plugin/hooks/hooks.json +3 -0
- package/vendor/packages/android-emulator-plugin/package.json +35 -0
- package/vendor/packages/android-emulator-plugin/skills/android-dev/INSTALL_ENVIRONMENT.md +357 -0
- package/vendor/packages/android-emulator-plugin/skills/android-dev/SKILL.md +73 -0
- package/vendor/packages/android-emulator-plugin/templates/compose-app/README.md +5 -0
- package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +8 -0
- package/vendor/packages/document-skills-plugin/package.json +8 -0
- package/vendor/packages/document-skills-plugin/skills/docx/LICENSE.txt +13 -0
- package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +201 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/chart-templates.md +386 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/common-rules.md +419 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/decorations.md +537 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/design-system.md +1797 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/docx-js-advanced.md +257 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/docx-js-core.md +332 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/faq.md +323 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/math-formulas.md +276 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/ooxml.md +222 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/toc.md +264 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/comment.md +88 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/create.md +207 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/edit.md +115 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/format.md +120 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/read.md +114 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scenes/academic.md +783 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scenes/contract.md +463 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scenes/copywriting.md +139 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scenes/exam.md +698 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scenes/official-doc.md +411 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scenes/report.md +340 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scenes/resume.md +534 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/__init__.py +1 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/add_toc_placeholders.py +749 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/document.py +1333 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/postcheck.py +807 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/comments.xml +3 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/people.xml +3 -0
- package/vendor/packages/document-skills-plugin/skills/docx/scripts/utilities.py +374 -0
- package/vendor/packages/document-skills-plugin/skills/docx/setup.sh +177 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/LICENSE.txt +13 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +919 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/academic.md +1058 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/creative.md +770 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/poster.md +702 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process-advanced.md +284 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +319 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/report.md +1659 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/configs/components.md +153 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/configs/fonts.md +93 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/configs/visual_framework.md +263 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/references/resume-academic.tex +130 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/references/resume-altacv.tex +190 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/cover_validate.js +367 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/design_engine.py +2816 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2pdf-next.js +754 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2poster.js +256 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +2959 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf_qa.py +901 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/poster_validate.py +1337 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +269 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/toc_validate.py +2075 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/charts.md +320 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover-backgrounds.md +384 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover.md +1442 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/fill-engine.md +527 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/geometry.md +142 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/overflow.md +630 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/pagination.md +367 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/palette.md +217 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/typography.md +20 -0
- package/vendor/packages/ios-simulator-plugin/.mcp.json +15 -0
- package/vendor/packages/ios-simulator-plugin/.zcode-plugin/plugin.json +34 -0
- package/vendor/packages/ios-simulator-plugin/README.md +111 -0
- package/vendor/packages/ios-simulator-plugin/commands/ios-dev.md +11 -0
- package/vendor/packages/ios-simulator-plugin/dist/lib/path.d.ts +4 -0
- package/vendor/packages/ios-simulator-plugin/dist/lib/path.js +18 -0
- package/vendor/packages/ios-simulator-plugin/dist/lib/result.d.ts +5 -0
- package/vendor/packages/ios-simulator-plugin/dist/lib/result.js +20 -0
- package/vendor/packages/ios-simulator-plugin/dist/lib/run.d.ts +17 -0
- package/vendor/packages/ios-simulator-plugin/dist/lib/run.js +83 -0
- package/vendor/packages/ios-simulator-plugin/dist/mcp/server.d.ts +3 -0
- package/vendor/packages/ios-simulator-plugin/dist/mcp/server.js +46833 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/build.d.ts +112 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/build.js +99 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/logs.d.ts +21 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/logs.js +26 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/preflight.d.ts +12 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/preflight.js +62 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/project.d.ts +35 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/project.js +288 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/screenshot.d.ts +22 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/screenshot.js +30 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/sim.d.ts +60 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/sim.js +116 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/ui.d.ts +57 -0
- package/vendor/packages/ios-simulator-plugin/dist/providers/ui.js +67 -0
- package/vendor/packages/ios-simulator-plugin/hooks/hooks.json +3 -0
- package/vendor/packages/ios-simulator-plugin/package.json +35 -0
- package/vendor/packages/ios-simulator-plugin/skills/ios-dev/SKILL.md +45 -0
- package/vendor/packages/ios-simulator-plugin/templates/swiftui-app/README.md +5 -0
- package/vendor/packages/restore-legacy-sessions-plugin/.zcode-plugin/plugin.json +9 -0
- package/vendor/packages/restore-legacy-sessions-plugin/README.md +35 -0
- package/vendor/packages/restore-legacy-sessions-plugin/commands/restore-legacy-sessions.md +11 -0
- package/vendor/packages/restore-legacy-sessions-plugin/package.json +8 -0
- package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/SKILL.md +92 -0
- package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/scripts/restore-conversation.mjs +648 -0
- package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/scripts/scan-legacy-sessions.mjs +422 -0
- package/vendor/packages/skill-creator-plugin/.zcode-plugin/plugin.json +8 -0
- package/vendor/packages/skill-creator-plugin/package.json +8 -0
- package/vendor/packages/skill-creator-plugin/skills/skill-creator/SKILL.md +159 -0
- package/vendor/packages/zcode-guide-plugin/.zcode-plugin/plugin.json +8 -0
- package/vendor/packages/zcode-guide-plugin/README.md +22 -0
- package/vendor/packages/zcode-guide-plugin/package.json +8 -0
- package/vendor/packages/zcode-guide-plugin/skills/diagnosing-commands/SKILL.md +66 -0
- package/vendor/packages/zcode-guide-plugin/skills/diagnosing-hooks/SKILL.md +66 -0
- package/vendor/packages/zcode-guide-plugin/skills/diagnosing-mcp/SKILL.md +97 -0
- package/vendor/packages/zcode-guide-plugin/skills/diagnosing-plugins/SKILL.md +59 -0
- package/vendor/packages/zcode-guide-plugin/skills/diagnosing-skills/SKILL.md +61 -0
- package/vendor/packages/zcode-guide-plugin/skills/zcode-configuration-guide/SKILL.md +99 -0
- package/vendor/zcode.cjs +2926 -0
- package/zcode-runtime.lock.json +8 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { basename, join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
|
|
6
|
+
const originalEmitWarning = process.emitWarning;
|
|
7
|
+
process.emitWarning = function filterSqliteExperimentalWarning(warning, ...args) {
|
|
8
|
+
// 只读扫描依赖 node:sqlite 访问本地 DB;过滤该实验提示,避免污染给用户选择用的表格。
|
|
9
|
+
if (String(warning).includes("SQLite is an experimental feature")) return;
|
|
10
|
+
return originalEmitWarning.call(process, warning, ...args);
|
|
11
|
+
};
|
|
12
|
+
const { DatabaseSync } = await import("node:sqlite");
|
|
13
|
+
process.emitWarning = originalEmitWarning;
|
|
14
|
+
|
|
15
|
+
const defaultLegacyDir = join(homedir(), ".zcode", "v2", "sessions");
|
|
16
|
+
const defaultTaskIndexPath = join(homedir(), ".zcode", "v2", "tasks-index.sqlite");
|
|
17
|
+
const defaultCliDbPath = join(homedir(), ".zcode", "cli", "db", "db.sqlite");
|
|
18
|
+
|
|
19
|
+
function printUsage() {
|
|
20
|
+
console.log(`Usage:
|
|
21
|
+
scan-legacy-sessions.mjs summary [--json]
|
|
22
|
+
scan-legacy-sessions.mjs agents [--json]
|
|
23
|
+
scan-legacy-sessions.mjs workspaces --agent <provider> [--json]
|
|
24
|
+
scan-legacy-sessions.mjs conversations --agent <provider> --workspace <path> [--query <text>] [--limit <n>] [--json]
|
|
25
|
+
|
|
26
|
+
Options:
|
|
27
|
+
--legacy-dir <path> Legacy snapshot root. Default: ${defaultLegacyDir}
|
|
28
|
+
--task-index <path> Task index sqlite path. Default: ${defaultTaskIndexPath}
|
|
29
|
+
--cli-db <path> New ZCode session sqlite path. Default: ${defaultCliDbPath}
|
|
30
|
+
--agent <provider> Filter by provider, such as glm, claude, codex, opencode.
|
|
31
|
+
--workspace <path> Filter by exact workspace path.
|
|
32
|
+
--query <text> Filter conversations by title, ids, or visible message text.
|
|
33
|
+
--conversation <id> Filter by restored task id, legacy task id, or ACP session id.
|
|
34
|
+
--limit <n> Conversation row limit. Default: 30.
|
|
35
|
+
--json Print JSON instead of Markdown tables.
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function parseArgs(argv) {
|
|
40
|
+
const args = {
|
|
41
|
+
command: argv[0] ?? "summary",
|
|
42
|
+
legacyDir: defaultLegacyDir,
|
|
43
|
+
taskIndexPath: defaultTaskIndexPath,
|
|
44
|
+
cliDbPath: defaultCliDbPath,
|
|
45
|
+
json: false,
|
|
46
|
+
limit: 30,
|
|
47
|
+
};
|
|
48
|
+
for (let index = 1; index < argv.length; index += 1) {
|
|
49
|
+
const item = argv[index];
|
|
50
|
+
if (item === "--json") {
|
|
51
|
+
args.json = true;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (item === "--help" || item === "-h") {
|
|
55
|
+
args.help = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const next = argv[index + 1];
|
|
59
|
+
if (!next) {
|
|
60
|
+
throw new Error(`Missing value for ${item}`);
|
|
61
|
+
}
|
|
62
|
+
index += 1;
|
|
63
|
+
if (item === "--legacy-dir") args.legacyDir = next;
|
|
64
|
+
else if (item === "--task-index") args.taskIndexPath = next;
|
|
65
|
+
else if (item === "--cli-db") args.cliDbPath = next;
|
|
66
|
+
else if (item === "--agent") args.agent = next;
|
|
67
|
+
else if (item === "--workspace") args.workspace = next;
|
|
68
|
+
else if (item === "--query") args.query = next;
|
|
69
|
+
else if (item === "--conversation") args.conversation = next;
|
|
70
|
+
else if (item === "--limit") args.limit = Number.parseInt(next, 10);
|
|
71
|
+
else throw new Error(`Unknown option: ${item}`);
|
|
72
|
+
}
|
|
73
|
+
if (!Number.isFinite(args.limit) || args.limit <= 0) args.limit = 30;
|
|
74
|
+
return args;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function collectJsonFiles(root) {
|
|
78
|
+
if (!existsSync(root)) return [];
|
|
79
|
+
const files = [];
|
|
80
|
+
for (const workspaceDir of readdirSync(root)) {
|
|
81
|
+
const dirPath = join(root, workspaceDir);
|
|
82
|
+
if (!statSync(dirPath).isDirectory()) continue;
|
|
83
|
+
for (const fileName of readdirSync(dirPath)) {
|
|
84
|
+
if (!fileName.endsWith(".json") || fileName.endsWith(".deleted.json")) continue;
|
|
85
|
+
files.push(join(dirPath, fileName));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return files;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function readSnapshot(filePath) {
|
|
92
|
+
try {
|
|
93
|
+
const raw = JSON.parse(readFileSync(filePath, "utf8"));
|
|
94
|
+
const meta = raw.meta && typeof raw.meta === "object" ? raw.meta : {};
|
|
95
|
+
const messages = Array.isArray(raw.messages) ? raw.messages : [];
|
|
96
|
+
const legacyTaskId = String(meta.taskId || basename(filePath, ".json"));
|
|
97
|
+
const acpSessionId = typeof meta.acpSessionId === "string" ? meta.acpSessionId : "";
|
|
98
|
+
const restoredTaskId = acpSessionId || legacyTaskId;
|
|
99
|
+
const workspacePath = typeof meta.workspacePath === "string" ? meta.workspacePath : "";
|
|
100
|
+
const provider = typeof meta.provider === "string" ? meta.provider : "unknown";
|
|
101
|
+
const firstUser = messages.find((message) => message?.role === "user");
|
|
102
|
+
const title =
|
|
103
|
+
typeof meta.title === "string" && meta.title.trim()
|
|
104
|
+
? meta.title.trim()
|
|
105
|
+
: summarizeText(firstUser?.content) || "Untitled session";
|
|
106
|
+
const createdAt = finiteNumber(meta.createdAt) ?? firstTimestamp(messages) ?? 0;
|
|
107
|
+
const updatedAt = finiteNumber(meta.updatedAt) ?? lastTimestamp(messages) ?? createdAt;
|
|
108
|
+
const visibleText = messages.map((message) => String(message?.content ?? "")).join("\n");
|
|
109
|
+
return {
|
|
110
|
+
filePath,
|
|
111
|
+
workspaceHash: basename(join(filePath, "..")),
|
|
112
|
+
legacyTaskId,
|
|
113
|
+
acpSessionId,
|
|
114
|
+
restoredTaskId,
|
|
115
|
+
workspacePath,
|
|
116
|
+
workspaceIdentity:
|
|
117
|
+
typeof meta.workspaceIdentity === "string" ? meta.workspaceIdentity : undefined,
|
|
118
|
+
provider,
|
|
119
|
+
model: typeof meta.model === "string" ? meta.model : undefined,
|
|
120
|
+
title,
|
|
121
|
+
createdAt,
|
|
122
|
+
updatedAt,
|
|
123
|
+
messageCount: messages.length,
|
|
124
|
+
userMessageCount: messages.filter((message) => message?.role === "user").length,
|
|
125
|
+
assistantMessageCount: messages.filter((message) => message?.role === "assistant").length,
|
|
126
|
+
visibleText,
|
|
127
|
+
};
|
|
128
|
+
} catch (error) {
|
|
129
|
+
return {
|
|
130
|
+
filePath,
|
|
131
|
+
error: error instanceof Error ? error.message : String(error),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function finiteNumber(value) {
|
|
137
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function firstTimestamp(messages) {
|
|
141
|
+
for (const message of messages) {
|
|
142
|
+
const timestamp = finiteNumber(message?.timestamp);
|
|
143
|
+
if (timestamp !== undefined) return timestamp;
|
|
144
|
+
}
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function lastTimestamp(messages) {
|
|
149
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
150
|
+
const timestamp = finiteNumber(messages[index]?.timestamp);
|
|
151
|
+
if (timestamp !== undefined) return timestamp;
|
|
152
|
+
}
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function summarizeText(value) {
|
|
157
|
+
const text = typeof value === "string" ? value.trim().replace(/\s+/g, " ") : "";
|
|
158
|
+
return text.length > 80 ? `${text.slice(0, 77)}...` : text;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function openDatabase(path) {
|
|
162
|
+
if (!existsSync(path)) return null;
|
|
163
|
+
if (statSync(path).size === 0) return null;
|
|
164
|
+
try {
|
|
165
|
+
return new DatabaseSync(path, { readOnly: true });
|
|
166
|
+
} catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function attachStoreStatus(candidates, taskIndexPath, cliDbPath) {
|
|
172
|
+
const taskIndexDb = openDatabase(taskIndexPath);
|
|
173
|
+
const cliDb = openDatabase(cliDbPath);
|
|
174
|
+
const taskByRestored = prepareOrNull(
|
|
175
|
+
taskIndexDb,
|
|
176
|
+
"select count(*) as count from tasks where workspace_path = ? and task_id = ?",
|
|
177
|
+
);
|
|
178
|
+
const taskByLegacy = prepareOrNull(
|
|
179
|
+
taskIndexDb,
|
|
180
|
+
"select count(*) as count from tasks where workspace_path = ? and task_id = ?",
|
|
181
|
+
);
|
|
182
|
+
const cliBySession = prepareOrNull(cliDb, "select count(*) as count from session where id = ?");
|
|
183
|
+
|
|
184
|
+
for (const candidate of candidates) {
|
|
185
|
+
if (candidate.error) continue;
|
|
186
|
+
const taskIndexRestored = countResult(
|
|
187
|
+
taskByRestored?.get(candidate.workspacePath, candidate.restoredTaskId),
|
|
188
|
+
);
|
|
189
|
+
const taskIndexLegacy = countResult(
|
|
190
|
+
taskByLegacy?.get(candidate.workspacePath, candidate.legacyTaskId),
|
|
191
|
+
);
|
|
192
|
+
const cliSession = countResult(cliBySession?.get(candidate.restoredTaskId));
|
|
193
|
+
candidate.store = {
|
|
194
|
+
cliDb: cliSession > 0 ? "present" : "missing",
|
|
195
|
+
taskIndex:
|
|
196
|
+
taskIndexRestored > 0 ? "present" : taskIndexLegacy > 0 ? "legacy-task-id" : "missing",
|
|
197
|
+
};
|
|
198
|
+
candidate.restoreState = restoreState(candidate.store);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
taskIndexDb?.close();
|
|
202
|
+
cliDb?.close();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function prepareOrNull(db, sql) {
|
|
206
|
+
if (!db) return null;
|
|
207
|
+
try {
|
|
208
|
+
return db.prepare(sql);
|
|
209
|
+
} catch {
|
|
210
|
+
// 目的地 DB 可能刚被备份/清空;扫描阶段只把缺表视为 missing,不能创建或修复。
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function countResult(row) {
|
|
216
|
+
return typeof row?.count === "number" ? row.count : 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function restoreState(store) {
|
|
220
|
+
const cliPresent = store.cliDb === "present";
|
|
221
|
+
const taskPresent = store.taskIndex === "present";
|
|
222
|
+
if (cliPresent && taskPresent) return "ready";
|
|
223
|
+
if (!cliPresent && taskPresent) return "needs-cli-db";
|
|
224
|
+
if (cliPresent && !taskPresent) return "needs-task-index";
|
|
225
|
+
return "needs-full-import";
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function filterCandidates(candidates, args) {
|
|
229
|
+
const query = args.query?.toLowerCase();
|
|
230
|
+
const conversation = args.conversation?.toLowerCase();
|
|
231
|
+
return candidates.filter((candidate) => {
|
|
232
|
+
if (candidate.error) return false;
|
|
233
|
+
if (args.agent && args.agent !== "all" && candidate.provider !== args.agent) return false;
|
|
234
|
+
if (args.workspace && candidate.workspacePath !== args.workspace) return false;
|
|
235
|
+
if (
|
|
236
|
+
conversation &&
|
|
237
|
+
![candidate.restoredTaskId, candidate.legacyTaskId, candidate.acpSessionId]
|
|
238
|
+
.filter(Boolean)
|
|
239
|
+
.some((value) => value.toLowerCase() === conversation)
|
|
240
|
+
) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
if (!query) return true;
|
|
244
|
+
const haystack = [
|
|
245
|
+
candidate.provider,
|
|
246
|
+
candidate.workspacePath,
|
|
247
|
+
candidate.title,
|
|
248
|
+
candidate.restoredTaskId,
|
|
249
|
+
candidate.legacyTaskId,
|
|
250
|
+
candidate.acpSessionId,
|
|
251
|
+
candidate.visibleText,
|
|
252
|
+
]
|
|
253
|
+
.join("\n")
|
|
254
|
+
.toLowerCase();
|
|
255
|
+
return haystack.includes(query);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function groupBy(items, keyFn) {
|
|
260
|
+
const map = new Map();
|
|
261
|
+
for (const item of items) {
|
|
262
|
+
const key = keyFn(item);
|
|
263
|
+
const existing = map.get(key) ?? [];
|
|
264
|
+
existing.push(item);
|
|
265
|
+
map.set(key, existing);
|
|
266
|
+
}
|
|
267
|
+
return map;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function summarizeGroups(candidates, keyFn) {
|
|
271
|
+
return [...groupBy(candidates, keyFn).entries()]
|
|
272
|
+
.map(([key, items]) => ({
|
|
273
|
+
key,
|
|
274
|
+
count: items.length,
|
|
275
|
+
workspaces: new Set(items.map((item) => item.workspacePath)).size,
|
|
276
|
+
ready: items.filter((item) => item.restoreState === "ready").length,
|
|
277
|
+
needsCliDb: items.filter((item) => item.restoreState === "needs-cli-db").length,
|
|
278
|
+
needsTaskIndex: items.filter((item) => item.restoreState === "needs-task-index").length,
|
|
279
|
+
needsFullImport: items.filter((item) => item.restoreState === "needs-full-import").length,
|
|
280
|
+
latestUpdatedAt: Math.max(...items.map((item) => item.updatedAt || 0)),
|
|
281
|
+
}))
|
|
282
|
+
.sort((a, b) => b.count - a.count || a.key.localeCompare(b.key));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function escapeCell(value) {
|
|
286
|
+
return String(value ?? "")
|
|
287
|
+
.replace(/\|/g, "\\|")
|
|
288
|
+
.replace(/\n/g, " ")
|
|
289
|
+
.trim();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function markdownTable(headers, rows) {
|
|
293
|
+
const header = `| ${headers.map(escapeCell).join(" | ")} |`;
|
|
294
|
+
const divider = `| ${headers.map(() => "---").join(" | ")} |`;
|
|
295
|
+
const body = rows.map((row) => `| ${row.map(escapeCell).join(" | ")} |`);
|
|
296
|
+
return [header, divider, ...body].join("\n");
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function formatTime(ms) {
|
|
300
|
+
if (!ms) return "";
|
|
301
|
+
return new Date(ms).toISOString().replace("T", " ").replace(".000Z", "Z");
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function printAgents(candidates, json) {
|
|
305
|
+
const rows = summarizeGroups(candidates, (item) => item.provider);
|
|
306
|
+
if (json) return printJson(rows);
|
|
307
|
+
console.log(
|
|
308
|
+
markdownTable(
|
|
309
|
+
["agent", "conversations", "workspaces", "ready", "needs-cli-db", "needs-task-index", "needs-full-import"],
|
|
310
|
+
rows.map((row) => [
|
|
311
|
+
row.key,
|
|
312
|
+
row.count,
|
|
313
|
+
row.workspaces,
|
|
314
|
+
row.ready,
|
|
315
|
+
row.needsCliDb,
|
|
316
|
+
row.needsTaskIndex,
|
|
317
|
+
row.needsFullImport,
|
|
318
|
+
]),
|
|
319
|
+
),
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function printWorkspaces(candidates, json) {
|
|
324
|
+
const rows = summarizeGroups(candidates, (item) => item.workspacePath);
|
|
325
|
+
if (json) return printJson(rows);
|
|
326
|
+
console.log(
|
|
327
|
+
markdownTable(
|
|
328
|
+
["workspace", "conversations", "ready", "needs-cli-db", "needs-task-index", "needs-full-import", "latest"],
|
|
329
|
+
rows.map((row) => [
|
|
330
|
+
row.key,
|
|
331
|
+
row.count,
|
|
332
|
+
row.ready,
|
|
333
|
+
row.needsCliDb,
|
|
334
|
+
row.needsTaskIndex,
|
|
335
|
+
row.needsFullImport,
|
|
336
|
+
formatTime(row.latestUpdatedAt),
|
|
337
|
+
]),
|
|
338
|
+
),
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function printConversations(candidates, args) {
|
|
343
|
+
const rows = [...candidates]
|
|
344
|
+
.sort((a, b) => (b.updatedAt || 0) - (a.updatedAt || 0))
|
|
345
|
+
.slice(0, args.limit);
|
|
346
|
+
if (args.json) return printJson(rows.map(stripVisibleText));
|
|
347
|
+
console.log(
|
|
348
|
+
markdownTable(
|
|
349
|
+
["#", "state", "agent", "title", "messages", "updated", "restoredTaskId", "legacyTaskId"],
|
|
350
|
+
rows.map((row, index) => [
|
|
351
|
+
index + 1,
|
|
352
|
+
row.restoreState,
|
|
353
|
+
row.provider,
|
|
354
|
+
row.title,
|
|
355
|
+
row.messageCount,
|
|
356
|
+
formatTime(row.updatedAt),
|
|
357
|
+
row.restoredTaskId,
|
|
358
|
+
row.legacyTaskId,
|
|
359
|
+
]),
|
|
360
|
+
),
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function printSummary(candidates, invalid, json) {
|
|
365
|
+
const payload = {
|
|
366
|
+
total: candidates.length,
|
|
367
|
+
invalid: invalid.length,
|
|
368
|
+
byAgent: summarizeGroups(candidates, (item) => item.provider),
|
|
369
|
+
byState: summarizeGroups(candidates, (item) => item.restoreState),
|
|
370
|
+
};
|
|
371
|
+
if (json) return printJson(payload);
|
|
372
|
+
console.log(`Total legacy conversations: ${payload.total}`);
|
|
373
|
+
if (payload.invalid > 0) console.log(`Invalid snapshots: ${payload.invalid}`);
|
|
374
|
+
console.log("\nBy agent:");
|
|
375
|
+
printAgents(candidates, false);
|
|
376
|
+
console.log("\nBy restore state:");
|
|
377
|
+
console.log(
|
|
378
|
+
markdownTable(
|
|
379
|
+
["state", "conversations", "workspaces"],
|
|
380
|
+
payload.byState.map((row) => [row.key, row.count, row.workspaces]),
|
|
381
|
+
),
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function stripVisibleText(candidate) {
|
|
386
|
+
const { visibleText, ...rest } = candidate;
|
|
387
|
+
return rest;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function printJson(value) {
|
|
391
|
+
console.log(JSON.stringify(value, null, 2));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function main() {
|
|
395
|
+
const args = parseArgs(process.argv.slice(2));
|
|
396
|
+
if (args.help) {
|
|
397
|
+
printUsage();
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const raw = collectJsonFiles(args.legacyDir).map(readSnapshot);
|
|
402
|
+
const invalid = raw.filter((candidate) => candidate.error);
|
|
403
|
+
const valid = raw.filter((candidate) => !candidate.error);
|
|
404
|
+
attachStoreStatus(valid, args.taskIndexPath, args.cliDbPath);
|
|
405
|
+
const filtered = filterCandidates(valid, args);
|
|
406
|
+
|
|
407
|
+
if (args.command === "summary") printSummary(filtered, invalid, args.json);
|
|
408
|
+
else if (args.command === "agents") printAgents(filtered, args.json);
|
|
409
|
+
else if (args.command === "workspaces") printWorkspaces(filtered, args.json);
|
|
410
|
+
else if (args.command === "conversations") printConversations(filtered, args);
|
|
411
|
+
else {
|
|
412
|
+
throw new Error(`Unknown command: ${args.command}`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
try {
|
|
417
|
+
main();
|
|
418
|
+
} catch (error) {
|
|
419
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
420
|
+
printUsage();
|
|
421
|
+
process.exitCode = 1;
|
|
422
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-creator
|
|
3
|
+
description: Create new skills, edit existing skills, and iterate wording. Use when writing SKILL.md from scratch, improving existing skills, turning repeated workflows into reusable skills, or refining skill descriptions to improve trigger reliability.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill Creator
|
|
7
|
+
|
|
8
|
+
A skill for authoring and iteratively improving local ZCode skills.
|
|
9
|
+
|
|
10
|
+
At a high level, the loop is:
|
|
11
|
+
|
|
12
|
+
- Figure out what the skill should do and roughly how it should do it
|
|
13
|
+
- Write a draft of the skill
|
|
14
|
+
- Try the skill on 2–3 realistic test prompts
|
|
15
|
+
- Read the outputs with the user and revise
|
|
16
|
+
- Repeat until the skill is good enough
|
|
17
|
+
|
|
18
|
+
Your job when this skill is loaded is to figure out where the user is in this loop and help them progress. They might say "I want a skill for X" (start at the top), or they might already have a draft (jump to evaluate/iterate). Be flexible — if the user says "just vibe with me, no formal evaluation," do that.
|
|
19
|
+
|
|
20
|
+
## Communicating with the user
|
|
21
|
+
|
|
22
|
+
People using this skill range from seasoned skill authors to first-timers. Pay attention to context cues. In doubt, briefly explain a term ("an *eval prompt* is just a test message you'd send the model to see how the skill behaves") rather than assuming familiarity.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Creating a skill
|
|
27
|
+
|
|
28
|
+
### Capture intent
|
|
29
|
+
|
|
30
|
+
Start by understanding what the user wants. If the current conversation already shows a workflow worth capturing (e.g., the user has been doing the same thing manually a few times and says "turn this into a skill"), extract answers from the conversation history first — the tools they used, the order of steps, corrections they made, input/output formats. Confirm gaps with the user before drafting.
|
|
31
|
+
|
|
32
|
+
Useful questions:
|
|
33
|
+
|
|
34
|
+
1. What should this skill enable the model to do?
|
|
35
|
+
2. When should it trigger? What user phrasings or contexts?
|
|
36
|
+
3. What's the expected output format?
|
|
37
|
+
4. Are there example inputs/outputs to lock the behavior down?
|
|
38
|
+
|
|
39
|
+
### Where skills live
|
|
40
|
+
|
|
41
|
+
ZCode discovers skills in these directories (highest priority first):
|
|
42
|
+
|
|
43
|
+
- `<project>/.zcode/skills/<name>/SKILL.md`
|
|
44
|
+
- `<project>/.agents/skills/<name>/SKILL.md`
|
|
45
|
+
- `~/.zcode/skills/<name>/SKILL.md`
|
|
46
|
+
- `~/.agents/skills/<name>/SKILL.md`
|
|
47
|
+
|
|
48
|
+
**Default to creating new skills under `.agents/skills/`** — it's the standard, cross-tool location for new skills. Note that `.zcode/skills` still takes priority during discovery: if the same skill name exists in both, the `.zcode/skills` copy wins, so `.zcode/skills` is the place to *override* a skill. Pick the `<project>` path for skills that only make sense in this repo; pick the `~/` (user) path for personal skills you want everywhere.
|
|
49
|
+
|
|
50
|
+
### Write the SKILL.md
|
|
51
|
+
|
|
52
|
+
Every skill is a directory containing a `SKILL.md` with YAML frontmatter and markdown body:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
my-skill/
|
|
56
|
+
├── SKILL.md (required)
|
|
57
|
+
└── (optional)
|
|
58
|
+
├── references/ (extra docs the model reads on demand)
|
|
59
|
+
├── scripts/ (helper scripts the model can invoke)
|
|
60
|
+
└── assets/ (templates, fixtures, etc.)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Required frontmatter:
|
|
64
|
+
|
|
65
|
+
- `name` — the skill's identifier. Lowercase kebab-case, 1–64 chars. Must match the directory name.
|
|
66
|
+
- `description` — when this skill should trigger and what it does. This is the primary triggering signal — both *what* the skill does and *in what contexts* belong here, not in the body. Models tend to *under*-trigger skills, so write descriptions a little bit pushy: instead of "How to build a dashboard for internal data," write "How to build a fast dashboard for internal data. Use whenever the user mentions dashboards, data visualization, internal metrics, or wants to display any company data — even if they don't explicitly say 'dashboard'."
|
|
67
|
+
|
|
68
|
+
Optional (reserved) frontmatter fields are listed in the ZCode skill spec; for most skills you only need `name` and `description`.
|
|
69
|
+
|
|
70
|
+
### Progressive disclosure
|
|
71
|
+
|
|
72
|
+
ZCode loads skills in three layers:
|
|
73
|
+
|
|
74
|
+
1. **Metadata** (name + description) is always in context. Keep it short.
|
|
75
|
+
2. **SKILL.md body** is loaded only when the skill triggers. Target under 500 lines.
|
|
76
|
+
3. **Bundled files** (under `references/`, `scripts/`, `assets/`) are read on demand. Unlimited size in principle.
|
|
77
|
+
|
|
78
|
+
If the body is getting long, split domain-specific detail into reference files and have the SKILL.md tell the model when to read them. For example:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
cloud-deploy/
|
|
82
|
+
├── SKILL.md (workflow + selection)
|
|
83
|
+
└── references/
|
|
84
|
+
├── aws.md
|
|
85
|
+
├── gcp.md
|
|
86
|
+
└── azure.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The SKILL.md then says "if the target is AWS, read references/aws.md before proceeding."
|
|
90
|
+
|
|
91
|
+
### Writing style
|
|
92
|
+
|
|
93
|
+
Prefer the imperative form ("Read the file before editing"). Explain *why* something matters when the rule isn't obvious — modern models follow guidance better when they understand the reason. If you find yourself writing all-caps MUSTs and NEVERs, that's usually a sign the rule needs better explanation rather than louder enforcement.
|
|
94
|
+
|
|
95
|
+
Examples beat rules. If the skill produces structured output, include a literal example of the format. If a specific tool should be used, show the call.
|
|
96
|
+
|
|
97
|
+
### Test prompts
|
|
98
|
+
|
|
99
|
+
After writing the draft, come up with 2–3 realistic test prompts — the kind of thing a user would actually type, with concrete file paths, column names, casual phrasing, even typos. Share them with the user: "Here are a few cases I want to try. Anything to add or change?"
|
|
100
|
+
|
|
101
|
+
Then run them: load the draft skill, hand the model the test prompt, and inspect what happens. ZCode does not currently spawn parallel evaluation subagents, so do this one prompt at a time and look at each result with the user.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Reviewing the draft
|
|
106
|
+
|
|
107
|
+
For each test prompt:
|
|
108
|
+
|
|
109
|
+
1. Make sure the draft skill is on disk where ZCode can discover it (one of the directories listed above).
|
|
110
|
+
2. In a fresh ZCode turn, give the test prompt to the model. Either let the description trigger the skill, or use `/skill <name> <prompt>` to force-load it.
|
|
111
|
+
3. Look at the result *with the user*. Did the skill trigger? Did the output match what they wanted? Where did it go off the rails?
|
|
112
|
+
|
|
113
|
+
Note both the *result* and the *trace*: if the skill caused the model to do a bunch of busywork (re-reading the same files, writing a throwaway script, going in circles), the skill is probably over-prescribing or unclear. That's a signal to cut, not to add more rules.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Improving the skill
|
|
118
|
+
|
|
119
|
+
This is the heart of the loop. You ran the test prompts, the user reviewed the outputs, now make the skill better.
|
|
120
|
+
|
|
121
|
+
How to think about improvements:
|
|
122
|
+
|
|
123
|
+
1. **Generalize from feedback.** You and the user are iterating on a handful of examples for speed, but the skill needs to work for inputs neither of you has seen. If a stubborn issue resists targeted edits, try a different framing or metaphor instead of layering more constraints. Fiddly overfit rules and oppressive MUSTs make the skill worse over time.
|
|
124
|
+
|
|
125
|
+
2. **Keep the prompt lean.** Remove things that aren't pulling their weight. If the model is wasting tokens on busywork the skill encouraged, delete the offending guidance and see what happens.
|
|
126
|
+
|
|
127
|
+
3. **Explain the why.** Today's models reason well when given context. Even if the user's feedback is terse or frustrated, work out what they actually want and transmit that understanding into the instructions. Reframing usually beats more enforcement.
|
|
128
|
+
|
|
129
|
+
4. **Look for repeated work.** If every test run independently wrote the same helper script or took the same multi-step approach, bundle the script under `scripts/` and have the skill point at it. Write it once instead of having the model reinvent it every time.
|
|
130
|
+
|
|
131
|
+
Then loop:
|
|
132
|
+
|
|
133
|
+
1. Apply the improvements.
|
|
134
|
+
2. Rerun the test prompts.
|
|
135
|
+
3. Show the user the new outputs.
|
|
136
|
+
4. Keep going until they're happy or further changes stop helping.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Updating an existing skill
|
|
141
|
+
|
|
142
|
+
If the user wants to update an existing installed skill rather than create one:
|
|
143
|
+
|
|
144
|
+
- Preserve the original `name` and directory name. If the installed skill is `research-helper`, the updated version is still `research-helper`, not `research-helper-v2`.
|
|
145
|
+
- If the installed skill path is read-only (e.g., shipped under an official plugin cache), copy the skill to a writable user location like `~/.agents/skills/<name>/`, edit there, and let user-priority discovery override the original.
|
|
146
|
+
- Same-name skills from different paths are kept as separate installed skills; path is the installation identity.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## The core loop, one more time
|
|
151
|
+
|
|
152
|
+
- Figure out what the skill is about.
|
|
153
|
+
- Draft it.
|
|
154
|
+
- Try 2–3 realistic test prompts.
|
|
155
|
+
- Read the results with the user.
|
|
156
|
+
- Improve.
|
|
157
|
+
- Repeat until the user is happy or improvements stop landing.
|
|
158
|
+
|
|
159
|
+
Good luck.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zcode-guide",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ZCode usage and self-diagnosis guide: teaches agents and users how to configure MCP servers, commands, skills, hooks, and plugins, and how to locate and fix configuration problems for each.",
|
|
5
|
+
"author": { "name": "Z.ai" },
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"skills": "skills"
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# zcode-guide
|
|
2
|
+
|
|
3
|
+
The official built-in ZCode plugin for configuration and self-diagnosis. It is content-only (skills) and enabled by default.
|
|
4
|
+
|
|
5
|
+
## What it provides
|
|
6
|
+
|
|
7
|
+
A set of skills that teach both users and agents how to configure ZCode's five extension resource types in the ZCode client, and how to locate and fix configuration problems for each:
|
|
8
|
+
|
|
9
|
+
| Skill | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `zcode-configuration-guide` | Overview: the locations, scopes, precedence, and merge rules for MCP servers, commands, skills, hooks, and plugins, plus guidance on where to configure each |
|
|
12
|
+
| `diagnosing-mcp` | Localize and fix MCP servers that will not connect, have missing tools, are untrusted, or time out |
|
|
13
|
+
| `diagnosing-skills` | Localize and fix skills that are not discovered, do not trigger, are shadowed, or are disabled |
|
|
14
|
+
| `diagnosing-commands` | Localize and fix slash commands that are missing, overridden, have frontmatter errors, or do not substitute arguments |
|
|
15
|
+
| `diagnosing-hooks` | Localize and fix hooks that do not trigger, whose matcher does not match, whose script is not executable, that time out, or that block unexpectedly |
|
|
16
|
+
| `diagnosing-plugins` | Localize and fix plugins that are not listed, fail to install, have missing components, or are not enabled |
|
|
17
|
+
|
|
18
|
+
## Design principle
|
|
19
|
+
|
|
20
|
+
Every diagnosis resolves to a concrete action: for a person, what to inspect and change in the client (Settings → Plugin Management / Skills / MCP, and the `/` menu); for an agent, the specific configuration file and field to edit. The goal is for an agent to diagnose and repair configuration on its own using these skills alone.
|
|
21
|
+
|
|
22
|
+
A built-in plugin can be disabled but not uninstalled.
|