cadre-ai 3.0.0 → 3.0.2
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +4 -0
- package/dist/cadre-cli.mjs +201 -74
- package/dist/cadre-mcp.mjs +105 -16
- package/package.json +1 -1
- package/skills/review/SKILL.md +1 -1
- package/skills/revise/SKILL.md +1 -1
- package/skills/track/SKILL.md +1 -1
- package/templates/v1/init/gitignore.template +5 -0
- package/templates/v1/init/wisps/.gitkeep +1 -0
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ Cadre is a human-governed, Git-aware delivery harness for Codex and Claude Code.
|
|
|
4
4
|
|
|
5
5
|
Cadre is installed as a user plugin. Its bundled TypeScript MCP server provides deterministic state operations and immutable, versioned templates. A project keeps only approved, mutable delivery state under `.cadre/`; runtime code and template catalogs are not copied into the project.
|
|
6
6
|
|
|
7
|
+
**Documentation:** [cadre-docs.pages.dev](https://cadre-docs.pages.dev/) ·
|
|
8
|
+
[Quickstart](https://cadre-docs.pages.dev/quickstart/) ·
|
|
9
|
+
[Release notes](https://cadre-docs.pages.dev/release-notes/)
|
|
10
|
+
|
|
7
11
|
## Capabilities
|
|
8
12
|
|
|
9
13
|
- Greenfield and brownfield project onboarding, with an explicit classification gate when the repository is ambiguous.
|
package/dist/cadre-cli.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// scripts/cli.ts
|
|
4
|
-
import { existsSync as
|
|
5
|
-
import { dirname as
|
|
6
|
-
import { fileURLToPath as
|
|
4
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
5
|
+
import { dirname as dirname6, join as join6, resolve as resolve6 } from "node:path";
|
|
6
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7
7
|
|
|
8
8
|
// scripts/install.ts
|
|
9
|
-
import { existsSync as
|
|
9
|
+
import { existsSync as existsSync4, mkdtempSync, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2 } from "node:fs";
|
|
10
10
|
import { homedir as homedir2 } from "node:os";
|
|
11
|
-
import { basename as basename2, dirname as
|
|
11
|
+
import { basename as basename2, dirname as dirname4, join as join4, parse as parse4, resolve as resolve4 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// scripts/cli-options.ts
|
|
14
14
|
import { homedir } from "node:os";
|
|
@@ -63,10 +63,130 @@ function marketplaceFromHome(home) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// scripts/package-plugin.ts
|
|
66
|
-
import { cpSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
67
|
-
import { dirname, join as
|
|
66
|
+
import { cpSync, existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "node:fs";
|
|
67
|
+
import { dirname as dirname2, join as join3, resolve as resolve3 } from "node:path";
|
|
68
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
69
|
+
|
|
70
|
+
// src/domain/templates.ts
|
|
71
|
+
import { createHash } from "node:crypto";
|
|
72
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
73
|
+
import { dirname, extname, join as join2, relative, resolve as resolve2, sep } from "node:path";
|
|
68
74
|
import { fileURLToPath } from "node:url";
|
|
69
|
-
|
|
75
|
+
|
|
76
|
+
// src/domain/version.ts
|
|
77
|
+
var CADRE_RUNTIME_VERSION = "3.0.2";
|
|
78
|
+
var TEMPLATE_SET_VERSION = "v1";
|
|
79
|
+
|
|
80
|
+
// src/domain/templates.ts
|
|
81
|
+
var TEMPLATE_IDS = [
|
|
82
|
+
"project/archive-operation",
|
|
83
|
+
"project/gitignore",
|
|
84
|
+
"project/guidelines",
|
|
85
|
+
"project/pattern",
|
|
86
|
+
"project/patterns/index",
|
|
87
|
+
"project/product",
|
|
88
|
+
"project/project",
|
|
89
|
+
"project/refresh",
|
|
90
|
+
"project/refresh-operation",
|
|
91
|
+
"project/styleguides/general",
|
|
92
|
+
"project/styleguides/language",
|
|
93
|
+
"project/tech-stack",
|
|
94
|
+
"project/tracks",
|
|
95
|
+
"project/workflow",
|
|
96
|
+
"styleguide/dart",
|
|
97
|
+
"styleguide/flutter",
|
|
98
|
+
"styleguide/go",
|
|
99
|
+
"styleguide/gradle",
|
|
100
|
+
"styleguide/html-css",
|
|
101
|
+
"styleguide/index",
|
|
102
|
+
"styleguide/java",
|
|
103
|
+
"styleguide/javascript",
|
|
104
|
+
"styleguide/kotlin",
|
|
105
|
+
"styleguide/maven",
|
|
106
|
+
"styleguide/python",
|
|
107
|
+
"styleguide/react",
|
|
108
|
+
"styleguide/swift",
|
|
109
|
+
"styleguide/swiftui",
|
|
110
|
+
"styleguide/typescript",
|
|
111
|
+
"track/bug",
|
|
112
|
+
"track/execution",
|
|
113
|
+
"track/learning",
|
|
114
|
+
"track/plan",
|
|
115
|
+
"track/revert-operation",
|
|
116
|
+
"track/revise-operation",
|
|
117
|
+
"track/revision",
|
|
118
|
+
"track/spec",
|
|
119
|
+
"track/state"
|
|
120
|
+
];
|
|
121
|
+
var catalogCache = null;
|
|
122
|
+
function locateTemplateRoot() {
|
|
123
|
+
const moduleDirectory = dirname(fileURLToPath(import.meta.url));
|
|
124
|
+
const candidates = [
|
|
125
|
+
process.env.CADRE_TEMPLATE_ROOT,
|
|
126
|
+
resolve2(moduleDirectory, "../../templates", TEMPLATE_SET_VERSION),
|
|
127
|
+
resolve2(moduleDirectory, "../templates", TEMPLATE_SET_VERSION)
|
|
128
|
+
].filter((candidate) => Boolean(candidate));
|
|
129
|
+
const found = candidates.find((candidate) => existsSync(candidate));
|
|
130
|
+
if (!found) throw new Error(`Cadre template set ${TEMPLATE_SET_VERSION} is unavailable`);
|
|
131
|
+
return found;
|
|
132
|
+
}
|
|
133
|
+
function walk(root, directory = root) {
|
|
134
|
+
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
135
|
+
const path = join2(directory, entry.name);
|
|
136
|
+
return entry.isDirectory() ? walk(root, path) : [relative(root, path).split(sep).join("/")];
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function templateId(path) {
|
|
140
|
+
if (path.endsWith("/.gitkeep")) return null;
|
|
141
|
+
if (path === "init/gitignore.template") return "project/gitignore";
|
|
142
|
+
const withoutExtension = path.slice(0, -extname(path).length);
|
|
143
|
+
const styleguidePrefix = "styleguides/";
|
|
144
|
+
if (path.startsWith(styleguidePrefix)) return `styleguide/${withoutExtension.slice(styleguidePrefix.length)}`;
|
|
145
|
+
if (path.startsWith("init/")) return `project/${withoutExtension.slice("init/".length)}`;
|
|
146
|
+
return withoutExtension;
|
|
147
|
+
}
|
|
148
|
+
function mimeType(path) {
|
|
149
|
+
if (path === "init/gitignore.template") return "text/plain";
|
|
150
|
+
return path.endsWith(".json") ? "application/json" : "text/markdown";
|
|
151
|
+
}
|
|
152
|
+
function assertCompleteCatalog(catalog) {
|
|
153
|
+
const actual = new Set(catalog.map((template) => template.id));
|
|
154
|
+
if (actual.size !== catalog.length) throw new Error(`Cadre template set ${TEMPLATE_SET_VERSION} has duplicate identifiers`);
|
|
155
|
+
const expected = new Set(TEMPLATE_IDS);
|
|
156
|
+
const missing = TEMPLATE_IDS.filter((id) => !actual.has(id));
|
|
157
|
+
const unexpected = [...actual].filter((id) => !expected.has(id)).sort();
|
|
158
|
+
if (missing.length || unexpected.length) {
|
|
159
|
+
const details = [
|
|
160
|
+
missing.length ? `missing ${missing.join(", ")}` : "",
|
|
161
|
+
unexpected.length ? `unexpected ${unexpected.join(", ")}` : ""
|
|
162
|
+
].filter(Boolean).join("; ");
|
|
163
|
+
throw new Error(`Cadre template set ${TEMPLATE_SET_VERSION} is incomplete: ${details}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function templateCatalog() {
|
|
167
|
+
if (!catalogCache) {
|
|
168
|
+
const root = locateTemplateRoot();
|
|
169
|
+
const catalog = walk(root).map((relativePath) => {
|
|
170
|
+
const id = templateId(relativePath);
|
|
171
|
+
if (!id) return null;
|
|
172
|
+
const content = readFileSync(join2(root, relativePath), "utf8");
|
|
173
|
+
return {
|
|
174
|
+
id,
|
|
175
|
+
uri: `cadre://templates/${TEMPLATE_SET_VERSION}/${id}`,
|
|
176
|
+
relativePath,
|
|
177
|
+
mimeType: mimeType(relativePath),
|
|
178
|
+
content,
|
|
179
|
+
sha256: createHash("sha256").update(content).digest("hex")
|
|
180
|
+
};
|
|
181
|
+
}).filter((entry) => entry !== null).sort((left, right) => left.id.localeCompare(right.id));
|
|
182
|
+
assertCompleteCatalog(catalog);
|
|
183
|
+
catalogCache = catalog;
|
|
184
|
+
}
|
|
185
|
+
return catalogCache.map((template) => ({ ...template }));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// scripts/package-plugin.ts
|
|
189
|
+
var sourceRoot = resolve3(dirname2(fileURLToPath2(import.meta.url)), "..");
|
|
70
190
|
var requiredEntries = [
|
|
71
191
|
"skills",
|
|
72
192
|
"templates",
|
|
@@ -78,10 +198,10 @@ var requiredEntries = [
|
|
|
78
198
|
];
|
|
79
199
|
var optionalEntries = ["hooks", "hooks.json", ".app.json", "assets", "commands", "agents"];
|
|
80
200
|
function readJson(path) {
|
|
81
|
-
return JSON.parse(
|
|
201
|
+
return JSON.parse(readFileSync2(path, "utf8"));
|
|
82
202
|
}
|
|
83
203
|
function writeJson(path, value) {
|
|
84
|
-
mkdirSync(
|
|
204
|
+
mkdirSync(dirname2(path), { recursive: true });
|
|
85
205
|
writeFileSync(path, `${JSON.stringify(value, null, 2)}
|
|
86
206
|
`);
|
|
87
207
|
}
|
|
@@ -93,36 +213,37 @@ function defaultCachebuster() {
|
|
|
93
213
|
return `local-${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z")}`;
|
|
94
214
|
}
|
|
95
215
|
function packagePluginMarketplace(outputRoot, requestedCachebuster = defaultCachebuster()) {
|
|
96
|
-
|
|
216
|
+
templateCatalog();
|
|
217
|
+
const targetRoot = resolve3(outputRoot);
|
|
97
218
|
const cachebuster = requestedCachebuster.trim();
|
|
98
219
|
if (!/^[0-9A-Za-z-]+$/.test(cachebuster)) {
|
|
99
220
|
throw new Error("cachebuster must contain only letters, digits, and hyphens");
|
|
100
221
|
}
|
|
101
|
-
const pluginRoot =
|
|
102
|
-
if (
|
|
222
|
+
const pluginRoot = join3(targetRoot, "plugins", "cadre");
|
|
223
|
+
if (existsSync2(pluginRoot)) throw new Error(`plugin output already exists: ${pluginRoot}`);
|
|
103
224
|
mkdirSync(pluginRoot, { recursive: true });
|
|
104
225
|
for (const entry of requiredEntries) {
|
|
105
|
-
const source =
|
|
106
|
-
if (!
|
|
107
|
-
cpSync(source,
|
|
226
|
+
const source = join3(sourceRoot, entry);
|
|
227
|
+
if (!existsSync2(source)) throw new Error(`required plugin entry is missing: ${entry}`);
|
|
228
|
+
cpSync(source, join3(pluginRoot, entry), { recursive: true });
|
|
108
229
|
}
|
|
109
230
|
for (const entry of optionalEntries) {
|
|
110
|
-
const source =
|
|
111
|
-
if (
|
|
231
|
+
const source = join3(sourceRoot, entry);
|
|
232
|
+
if (existsSync2(source)) cpSync(source, join3(pluginRoot, entry), { recursive: true });
|
|
112
233
|
}
|
|
113
|
-
const codexManifest = readJson(
|
|
234
|
+
const codexManifest = readJson(join3(sourceRoot, ".codex-plugin", "plugin.json"));
|
|
114
235
|
codexManifest.version = withCachebuster(codexManifest.version, "codex", cachebuster);
|
|
115
|
-
writeJson(
|
|
116
|
-
const claudeManifest = readJson(
|
|
236
|
+
writeJson(join3(pluginRoot, ".codex-plugin", "plugin.json"), codexManifest);
|
|
237
|
+
const claudeManifest = readJson(join3(sourceRoot, ".claude-plugin", "plugin.json"));
|
|
117
238
|
claudeManifest.version = withCachebuster(claudeManifest.version, "claude", cachebuster);
|
|
118
|
-
writeJson(
|
|
239
|
+
writeJson(join3(pluginRoot, ".claude-plugin", "plugin.json"), claudeManifest);
|
|
119
240
|
writeJson(
|
|
120
|
-
|
|
121
|
-
readJson(
|
|
241
|
+
join3(targetRoot, ".agents", "plugins", "marketplace.json"),
|
|
242
|
+
readJson(join3(sourceRoot, "marketplace", "codex.json"))
|
|
122
243
|
);
|
|
123
244
|
writeJson(
|
|
124
|
-
|
|
125
|
-
readJson(
|
|
245
|
+
join3(targetRoot, ".claude-plugin", "marketplace.json"),
|
|
246
|
+
readJson(join3(sourceRoot, "marketplace", "claude.json"))
|
|
126
247
|
);
|
|
127
248
|
return { targetRoot, pluginRoot, cachebuster };
|
|
128
249
|
}
|
|
@@ -903,11 +1024,11 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
903
1024
|
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
904
1025
|
ensurePropertyComplete(offset + length);
|
|
905
1026
|
},
|
|
906
|
-
onSeparator: (
|
|
1027
|
+
onSeparator: (sep2, offset, length) => {
|
|
907
1028
|
if (currentParent.type === "property") {
|
|
908
|
-
if (
|
|
1029
|
+
if (sep2 === ":") {
|
|
909
1030
|
currentParent.colonOffset = offset;
|
|
910
|
-
} else if (
|
|
1031
|
+
} else if (sep2 === ",") {
|
|
911
1032
|
ensurePropertyComplete(offset);
|
|
912
1033
|
}
|
|
913
1034
|
}
|
|
@@ -1539,7 +1660,7 @@ function applyEdits(text, edits) {
|
|
|
1539
1660
|
// scripts/permissions.ts
|
|
1540
1661
|
import {
|
|
1541
1662
|
chmodSync,
|
|
1542
|
-
existsSync as
|
|
1663
|
+
existsSync as existsSync3,
|
|
1543
1664
|
lstatSync,
|
|
1544
1665
|
mkdirSync as mkdirSync2,
|
|
1545
1666
|
realpathSync,
|
|
@@ -1547,9 +1668,9 @@ import {
|
|
|
1547
1668
|
statSync,
|
|
1548
1669
|
unlinkSync,
|
|
1549
1670
|
writeFileSync as writeFileSync2,
|
|
1550
|
-
readFileSync as
|
|
1671
|
+
readFileSync as readFileSync3
|
|
1551
1672
|
} from "node:fs";
|
|
1552
|
-
import { basename, dirname as
|
|
1673
|
+
import { basename, dirname as dirname3 } from "node:path";
|
|
1553
1674
|
|
|
1554
1675
|
// ../node_modules/.pnpm/smol-toml@1.7.1/node_modules/smol-toml/dist/date.js
|
|
1555
1676
|
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
@@ -1876,7 +1997,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
|
|
|
1876
1997
|
}
|
|
1877
1998
|
return ptr;
|
|
1878
1999
|
}
|
|
1879
|
-
function skipUntil(str, ptr,
|
|
2000
|
+
function skipUntil(str, ptr, sep2, end, banNewLines = false) {
|
|
1880
2001
|
if (!end) {
|
|
1881
2002
|
ptr = indexOfNewline(str, ptr);
|
|
1882
2003
|
return ptr < 0 ? str.length : ptr;
|
|
@@ -1887,7 +2008,7 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
|
1887
2008
|
i = indexOfNewline(str, i);
|
|
1888
2009
|
if (i < 0)
|
|
1889
2010
|
break;
|
|
1890
|
-
} else if (c ===
|
|
2011
|
+
} else if (c === sep2) {
|
|
1891
2012
|
return i + 1;
|
|
1892
2013
|
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
|
|
1893
2014
|
return i;
|
|
@@ -2242,16 +2363,16 @@ function isRecord(value) {
|
|
|
2242
2363
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2243
2364
|
}
|
|
2244
2365
|
function atomicWrite(path, content) {
|
|
2245
|
-
const effectivePath =
|
|
2246
|
-
const directory =
|
|
2366
|
+
const effectivePath = existsSync3(path) && lstatSync(path).isSymbolicLink() ? realpathSync(path) : path;
|
|
2367
|
+
const directory = dirname3(effectivePath);
|
|
2247
2368
|
mkdirSync2(directory, { recursive: true });
|
|
2248
2369
|
const temporary = `${directory}/.${basename(effectivePath)}.cadre-${process.pid}-${Date.now()}`;
|
|
2249
2370
|
try {
|
|
2250
2371
|
writeFileSync2(temporary, content, { encoding: "utf8", flag: "wx" });
|
|
2251
|
-
if (
|
|
2372
|
+
if (existsSync3(effectivePath)) chmodSync(temporary, statSync(effectivePath).mode);
|
|
2252
2373
|
renameSync(temporary, effectivePath);
|
|
2253
2374
|
} finally {
|
|
2254
|
-
if (
|
|
2375
|
+
if (existsSync3(temporary)) unlinkSync(temporary);
|
|
2255
2376
|
}
|
|
2256
2377
|
}
|
|
2257
2378
|
function cadreCodexPolicy(value) {
|
|
@@ -2264,7 +2385,7 @@ function cadreCodexPolicy(value) {
|
|
|
2264
2385
|
return isRecord(server) ? server : void 0;
|
|
2265
2386
|
}
|
|
2266
2387
|
function configureCodexMcpApproval(configPath) {
|
|
2267
|
-
const existing =
|
|
2388
|
+
const existing = existsSync3(configPath) ? readFileSync3(configPath, "utf8") : "";
|
|
2268
2389
|
let parsed;
|
|
2269
2390
|
try {
|
|
2270
2391
|
parsed = parse3(existing);
|
|
@@ -2338,7 +2459,7 @@ function deniesCadre(rule) {
|
|
|
2338
2459
|
return rule === "mcp__*" || rule === "mcp__cadre" || rule.startsWith("mcp__cadre__");
|
|
2339
2460
|
}
|
|
2340
2461
|
function configureClaudeMcpApproval(settingsPath) {
|
|
2341
|
-
const existing =
|
|
2462
|
+
const existing = existsSync3(settingsPath) ? readFileSync3(settingsPath, "utf8") : "{}\n";
|
|
2342
2463
|
const errors = [];
|
|
2343
2464
|
const parsed = parse2(existing, errors, { allowTrailingComma: true });
|
|
2344
2465
|
if (errors.length) {
|
|
@@ -2416,7 +2537,7 @@ function parseInstallOptions(args) {
|
|
|
2416
2537
|
options.selection = parseClient(optionValue(args, index, arg));
|
|
2417
2538
|
index += 1;
|
|
2418
2539
|
} else if (arg === "--marketplace-root") {
|
|
2419
|
-
options.marketplaceRoot =
|
|
2540
|
+
options.marketplaceRoot = resolve4(optionValue(args, index, arg));
|
|
2420
2541
|
index += 1;
|
|
2421
2542
|
} else if (arg === "--home") {
|
|
2422
2543
|
options.marketplaceRoot = marketplaceFromHome(optionValue(args, index, arg));
|
|
@@ -2453,7 +2574,7 @@ function claudeMarketplaces() {
|
|
|
2453
2574
|
function replaceMarketplaceIfNeeded(client, existing, targetRoot, allowReplacement) {
|
|
2454
2575
|
if (!existing) return false;
|
|
2455
2576
|
const currentPath = marketplacePath(existing);
|
|
2456
|
-
if (currentPath &&
|
|
2577
|
+
if (currentPath && resolve4(currentPath) === targetRoot) return true;
|
|
2457
2578
|
if (!allowReplacement) {
|
|
2458
2579
|
throw new Error(
|
|
2459
2580
|
`${client} already has a ${marketplaceName} marketplace at ${currentPath ?? "an unknown path"}; review it and rerun with --replace-marketplace`
|
|
@@ -2473,8 +2594,8 @@ function installCodex(targetRoot, allowReplacement, autoApproveMcp) {
|
|
|
2473
2594
|
throw new Error(`Codex did not report ${pluginId} as installed and enabled`);
|
|
2474
2595
|
}
|
|
2475
2596
|
if (autoApproveMcp) {
|
|
2476
|
-
const codexRoot = process.env.CODEX_HOME ?
|
|
2477
|
-
const update = configureCodexMcpApproval(
|
|
2597
|
+
const codexRoot = process.env.CODEX_HOME ? resolve4(process.env.CODEX_HOME) : join4(homedir2(), ".codex");
|
|
2598
|
+
const update = configureCodexMcpApproval(join4(codexRoot, "config.toml"));
|
|
2478
2599
|
process.stdout.write(`${update.changed ? "Added" : "Retained"} Codex Cadre MCP approval in ${update.path}
|
|
2479
2600
|
`);
|
|
2480
2601
|
}
|
|
@@ -2495,30 +2616,30 @@ function installClaude(targetRoot, allowReplacement, autoApproveMcp) {
|
|
|
2495
2616
|
throw new Error(`Claude did not report ${pluginId} as installed and enabled`);
|
|
2496
2617
|
}
|
|
2497
2618
|
if (autoApproveMcp) {
|
|
2498
|
-
const claudeRoot = process.env.CLAUDE_HOME ?? process.env.CLAUDE_CONFIG_DIR ??
|
|
2499
|
-
const update = configureClaudeMcpApproval(
|
|
2619
|
+
const claudeRoot = process.env.CLAUDE_HOME ?? process.env.CLAUDE_CONFIG_DIR ?? join4(homedir2(), ".claude");
|
|
2620
|
+
const update = configureClaudeMcpApproval(join4(resolve4(claudeRoot), "settings.json"));
|
|
2500
2621
|
process.stdout.write(`${update.changed ? "Added" : "Retained"} Claude Cadre MCP approval in ${update.path}
|
|
2501
2622
|
`);
|
|
2502
2623
|
}
|
|
2503
2624
|
}
|
|
2504
2625
|
function assertSafeTarget(targetRoot) {
|
|
2505
|
-
if (targetRoot === parse4(targetRoot).root || targetRoot ===
|
|
2626
|
+
if (targetRoot === parse4(targetRoot).root || targetRoot === resolve4(homedir2())) {
|
|
2506
2627
|
throw new Error(`refusing to use broad marketplace root ${targetRoot}`);
|
|
2507
2628
|
}
|
|
2508
2629
|
if (basename2(targetRoot) !== "cadre") throw new Error("marketplace root must end in a directory named cadre");
|
|
2509
2630
|
}
|
|
2510
2631
|
function prepareMarketplace(targetRoot, cachebuster) {
|
|
2511
|
-
const parent =
|
|
2632
|
+
const parent = dirname4(targetRoot);
|
|
2512
2633
|
mkdirSync3(parent, { recursive: true });
|
|
2513
|
-
const stagingRoot = mkdtempSync(
|
|
2634
|
+
const stagingRoot = mkdtempSync(join4(parent, ".cadre-staging-"));
|
|
2514
2635
|
const packaged = packagePluginMarketplace(stagingRoot, cachebuster ?? void 0);
|
|
2515
2636
|
let backupRoot = null;
|
|
2516
|
-
if (
|
|
2637
|
+
if (existsSync4(targetRoot)) {
|
|
2517
2638
|
const catalogs = [
|
|
2518
|
-
|
|
2519
|
-
|
|
2639
|
+
join4(targetRoot, ".agents", "plugins", "marketplace.json"),
|
|
2640
|
+
join4(targetRoot, ".claude-plugin", "marketplace.json")
|
|
2520
2641
|
];
|
|
2521
|
-
const owned = catalogs.every((path) =>
|
|
2642
|
+
const owned = catalogs.every((path) => existsSync4(path) && JSON.parse(readFileSync4(path, "utf8")).name === marketplaceName);
|
|
2522
2643
|
if (!owned) throw new Error(`${targetRoot} exists but is not a Cadre dual-product marketplace`);
|
|
2523
2644
|
backupRoot = `${targetRoot}.backup-${Date.now()}`;
|
|
2524
2645
|
renameSync2(targetRoot, backupRoot);
|
|
@@ -2563,8 +2684,8 @@ function runInstall(args) {
|
|
|
2563
2684
|
}
|
|
2564
2685
|
|
|
2565
2686
|
// scripts/uninstall.ts
|
|
2566
|
-
import { existsSync as
|
|
2567
|
-
import { basename as basename3, dirname as
|
|
2687
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2, rmSync } from "node:fs";
|
|
2688
|
+
import { basename as basename3, dirname as dirname5, join as join5, resolve as resolve5 } from "node:path";
|
|
2568
2689
|
var marketplaceName2 = "cadre";
|
|
2569
2690
|
var pluginId2 = "cadre@cadre";
|
|
2570
2691
|
function parseUninstallOptions(args) {
|
|
@@ -2579,7 +2700,7 @@ function parseUninstallOptions(args) {
|
|
|
2579
2700
|
options.selection = parseClient(optionValue(args, index, arg));
|
|
2580
2701
|
index += 1;
|
|
2581
2702
|
} else if (arg === "--marketplace-root") {
|
|
2582
|
-
options.marketplaceRoot =
|
|
2703
|
+
options.marketplaceRoot = resolve5(optionValue(args, index, arg));
|
|
2583
2704
|
index += 1;
|
|
2584
2705
|
} else if (arg === "--home") {
|
|
2585
2706
|
options.marketplaceRoot = marketplaceFromHome(optionValue(args, index, arg));
|
|
@@ -2599,15 +2720,15 @@ function selectedClients2(selection) {
|
|
|
2599
2720
|
return [selection];
|
|
2600
2721
|
}
|
|
2601
2722
|
function ownedMarketplace(root) {
|
|
2602
|
-
if (!
|
|
2723
|
+
if (!existsSync5(root)) return false;
|
|
2603
2724
|
const catalogs = [
|
|
2604
|
-
|
|
2605
|
-
|
|
2725
|
+
join5(root, ".agents", "plugins", "marketplace.json"),
|
|
2726
|
+
join5(root, ".claude-plugin", "marketplace.json")
|
|
2606
2727
|
];
|
|
2607
2728
|
return catalogs.every((path) => {
|
|
2608
|
-
if (!
|
|
2729
|
+
if (!existsSync5(path)) return false;
|
|
2609
2730
|
try {
|
|
2610
|
-
return JSON.parse(
|
|
2731
|
+
return JSON.parse(readFileSync5(path, "utf8")).name === marketplaceName2;
|
|
2611
2732
|
} catch {
|
|
2612
2733
|
return false;
|
|
2613
2734
|
}
|
|
@@ -2625,11 +2746,11 @@ function uninstallClient(client) {
|
|
|
2625
2746
|
function removeOwnedMarketplaces(root) {
|
|
2626
2747
|
const removed = [];
|
|
2627
2748
|
const candidates = [root];
|
|
2628
|
-
const parent =
|
|
2749
|
+
const parent = dirname5(root);
|
|
2629
2750
|
const prefix = `${basename3(root)}.backup-`;
|
|
2630
|
-
if (
|
|
2631
|
-
for (const entry of
|
|
2632
|
-
if (entry.startsWith(prefix)) candidates.push(
|
|
2751
|
+
if (existsSync5(parent)) {
|
|
2752
|
+
for (const entry of readdirSync2(parent)) {
|
|
2753
|
+
if (entry.startsWith(prefix)) candidates.push(join5(parent, entry));
|
|
2633
2754
|
}
|
|
2634
2755
|
}
|
|
2635
2756
|
for (const candidate of candidates) {
|
|
@@ -2671,16 +2792,13 @@ function runUninstall(args) {
|
|
|
2671
2792
|
if (removed.length) process.stdout.write(`Removed ${removed.join(", ")}
|
|
2672
2793
|
`);
|
|
2673
2794
|
else process.stdout.write("No owned Cadre marketplace files found to remove.\n");
|
|
2674
|
-
} else if (
|
|
2795
|
+
} else if (existsSync5(options.marketplaceRoot)) {
|
|
2675
2796
|
process.stdout.write(`Retained shared marketplace at ${options.marketplaceRoot} for other clients.
|
|
2676
2797
|
`);
|
|
2677
2798
|
}
|
|
2678
2799
|
return failed ? 1 : 0;
|
|
2679
2800
|
}
|
|
2680
2801
|
|
|
2681
|
-
// src/domain/version.ts
|
|
2682
|
-
var CADRE_RUNTIME_VERSION = "3.0.0";
|
|
2683
|
-
|
|
2684
2802
|
// scripts/cli.ts
|
|
2685
2803
|
function usage() {
|
|
2686
2804
|
return [
|
|
@@ -2695,7 +2813,7 @@ function usage() {
|
|
|
2695
2813
|
].join("\n");
|
|
2696
2814
|
}
|
|
2697
2815
|
function packageRoot() {
|
|
2698
|
-
return
|
|
2816
|
+
return resolve6(dirname6(fileURLToPath3(import.meta.url)), "..");
|
|
2699
2817
|
}
|
|
2700
2818
|
function runDoctor() {
|
|
2701
2819
|
const root = packageRoot();
|
|
@@ -2707,11 +2825,11 @@ function runDoctor() {
|
|
|
2707
2825
|
"skills",
|
|
2708
2826
|
"templates"
|
|
2709
2827
|
];
|
|
2710
|
-
const missing = required.filter((entry) => !
|
|
2711
|
-
const packageJson =
|
|
2828
|
+
const missing = required.filter((entry) => !existsSync6(join6(root, entry)));
|
|
2829
|
+
const packageJson = join6(root, "package.json");
|
|
2712
2830
|
let identity = `cadre-ai@${CADRE_RUNTIME_VERSION}`;
|
|
2713
|
-
if (
|
|
2714
|
-
const metadata = JSON.parse(
|
|
2831
|
+
if (existsSync6(packageJson)) {
|
|
2832
|
+
const metadata = JSON.parse(readFileSync6(packageJson, "utf8"));
|
|
2715
2833
|
identity = `${metadata.name ?? "cadre-ai"}@${metadata.version ?? CADRE_RUNTIME_VERSION}`;
|
|
2716
2834
|
}
|
|
2717
2835
|
process.stdout.write(`${identity}
|
|
@@ -2719,6 +2837,15 @@ package root: ${root}
|
|
|
2719
2837
|
`);
|
|
2720
2838
|
if (missing.length) {
|
|
2721
2839
|
process.stderr.write(`Missing packaged runtime assets: ${missing.join(", ")}
|
|
2840
|
+
`);
|
|
2841
|
+
return 1;
|
|
2842
|
+
}
|
|
2843
|
+
try {
|
|
2844
|
+
const templates = templateCatalog();
|
|
2845
|
+
process.stdout.write(`template catalog: ${templates.length}/${TEMPLATE_IDS.length} required templates
|
|
2846
|
+
`);
|
|
2847
|
+
} catch (error) {
|
|
2848
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}
|
|
2722
2849
|
`);
|
|
2723
2850
|
return 1;
|
|
2724
2851
|
}
|
package/dist/cadre-mcp.mjs
CHANGED
|
@@ -30994,7 +30994,7 @@ import { existsSync as existsSync4, lstatSync as lstatSync2, readFileSync as rea
|
|
|
30994
30994
|
import { join as join2, resolve as resolve3 } from "node:path";
|
|
30995
30995
|
|
|
30996
30996
|
// src/domain/version.ts
|
|
30997
|
-
var CADRE_RUNTIME_VERSION = "3.0.
|
|
30997
|
+
var CADRE_RUNTIME_VERSION = "3.0.2";
|
|
30998
30998
|
var TEMPLATE_SET_VERSION = "v1";
|
|
30999
30999
|
|
|
31000
31000
|
// src/domain/plan.ts
|
|
@@ -31023,16 +31023,12 @@ function graphDigest(graph) {
|
|
|
31023
31023
|
};
|
|
31024
31024
|
return createHash("sha256").update(JSON.stringify(normalized)).digest("hex");
|
|
31025
31025
|
}
|
|
31026
|
-
function
|
|
31027
|
-
if (!existsSync(path)) {
|
|
31028
|
-
errors.push(`${path}: missing plan`);
|
|
31029
|
-
return { specRevision: null, planRevision: null, phases: [], digest: graphDigest({ specRevision: null, planRevision: null, phases: [] }) };
|
|
31030
|
-
}
|
|
31026
|
+
function parsePlanContent(content, sourceLabel, errors = []) {
|
|
31031
31027
|
const phases = [];
|
|
31032
31028
|
let specRevision = null;
|
|
31033
31029
|
let planRevision = null;
|
|
31034
31030
|
let currentTask = null;
|
|
31035
|
-
const lines =
|
|
31031
|
+
const lines = content.split(/\r?\n/);
|
|
31036
31032
|
for (const [index, line] of lines.entries()) {
|
|
31037
31033
|
const lineNumber = index + 1;
|
|
31038
31034
|
const spec = line.match(/^- Spec revision: (\d+)$/);
|
|
@@ -31059,8 +31055,8 @@ function parsePlan(path, errors = []) {
|
|
|
31059
31055
|
const phaseDependencies = line.match(/^- Phase dependencies: (.+)$/);
|
|
31060
31056
|
if (phaseDependencies) {
|
|
31061
31057
|
const phase = phases.at(-1);
|
|
31062
|
-
if (!phase) errors.push(`${
|
|
31063
|
-
else if (phase.dependencyDeclared) errors.push(`${
|
|
31058
|
+
if (!phase) errors.push(`${sourceLabel}:${lineNumber}: phase dependencies appear before a phase`);
|
|
31059
|
+
else if (phase.dependencyDeclared) errors.push(`${sourceLabel}:${lineNumber}: ${phase.id} has duplicate phase dependencies`);
|
|
31064
31060
|
else {
|
|
31065
31061
|
phase.dependencies = dependencyList(phaseDependencies[1]);
|
|
31066
31062
|
phase.dependencyDeclared = true;
|
|
@@ -31070,7 +31066,7 @@ function parsePlan(path, errors = []) {
|
|
|
31070
31066
|
const phaseCommit = line.match(/^- Phase completion commit: (pending|`([0-9a-f]{7,40})`)$/);
|
|
31071
31067
|
if (phaseCommit) {
|
|
31072
31068
|
const phase = phases.at(-1);
|
|
31073
|
-
if (!phase) errors.push(`${
|
|
31069
|
+
if (!phase) errors.push(`${sourceLabel}:${lineNumber}: phase completion commit appears before a phase`);
|
|
31074
31070
|
else phase.completionCommit = phaseCommit[1] === "pending" ? null : phaseCommit[2];
|
|
31075
31071
|
continue;
|
|
31076
31072
|
}
|
|
@@ -31078,7 +31074,7 @@ function parsePlan(path, errors = []) {
|
|
|
31078
31074
|
if (taskMatch) {
|
|
31079
31075
|
const phase = phases.at(-1);
|
|
31080
31076
|
if (!phase) {
|
|
31081
|
-
errors.push(`${
|
|
31077
|
+
errors.push(`${sourceLabel}:${lineNumber}: task appears before a phase`);
|
|
31082
31078
|
continue;
|
|
31083
31079
|
}
|
|
31084
31080
|
let title = taskMatch[5].trim();
|
|
@@ -31105,8 +31101,8 @@ function parsePlan(path, errors = []) {
|
|
|
31105
31101
|
}
|
|
31106
31102
|
const taskDependencies = line.match(/^ - Task dependencies: (.+)$/);
|
|
31107
31103
|
if (taskDependencies) {
|
|
31108
|
-
if (!currentTask) errors.push(`${
|
|
31109
|
-
else if (currentTask.dependencyDeclared) errors.push(`${
|
|
31104
|
+
if (!currentTask) errors.push(`${sourceLabel}:${lineNumber}: task dependencies do not follow a task`);
|
|
31105
|
+
else if (currentTask.dependencyDeclared) errors.push(`${sourceLabel}:${lineNumber}: ${currentTask.id} has duplicate task dependencies`);
|
|
31110
31106
|
else {
|
|
31111
31107
|
currentTask.dependencies = dependencyList(taskDependencies[1]);
|
|
31112
31108
|
currentTask.dependencyDeclared = true;
|
|
@@ -31116,6 +31112,13 @@ function parsePlan(path, errors = []) {
|
|
|
31116
31112
|
const graphWithoutDigest = { specRevision, planRevision, phases };
|
|
31117
31113
|
return { ...graphWithoutDigest, digest: graphDigest(graphWithoutDigest) };
|
|
31118
31114
|
}
|
|
31115
|
+
function parsePlan(path, errors = []) {
|
|
31116
|
+
if (!existsSync(path)) {
|
|
31117
|
+
errors.push(`${path}: missing plan`);
|
|
31118
|
+
return { specRevision: null, planRevision: null, phases: [], digest: graphDigest({ specRevision: null, planRevision: null, phases: [] }) };
|
|
31119
|
+
}
|
|
31120
|
+
return parsePlanContent(readFileSync(path, "utf8"), path, errors);
|
|
31121
|
+
}
|
|
31119
31122
|
function findCycles(nodes, owner, errors) {
|
|
31120
31123
|
const ids = new Set(nodes.map((node) => node.id));
|
|
31121
31124
|
const visiting = /* @__PURE__ */ new Set();
|
|
@@ -32259,6 +32262,46 @@ import { createHash as createHash4 } from "node:crypto";
|
|
|
32259
32262
|
import { existsSync as existsSync5, readFileSync as readFileSync4, readdirSync as readdirSync3 } from "node:fs";
|
|
32260
32263
|
import { dirname as dirname2, extname, join as join3, relative, resolve as resolve4, sep } from "node:path";
|
|
32261
32264
|
import { fileURLToPath } from "node:url";
|
|
32265
|
+
var TEMPLATE_IDS = [
|
|
32266
|
+
"project/archive-operation",
|
|
32267
|
+
"project/gitignore",
|
|
32268
|
+
"project/guidelines",
|
|
32269
|
+
"project/pattern",
|
|
32270
|
+
"project/patterns/index",
|
|
32271
|
+
"project/product",
|
|
32272
|
+
"project/project",
|
|
32273
|
+
"project/refresh",
|
|
32274
|
+
"project/refresh-operation",
|
|
32275
|
+
"project/styleguides/general",
|
|
32276
|
+
"project/styleguides/language",
|
|
32277
|
+
"project/tech-stack",
|
|
32278
|
+
"project/tracks",
|
|
32279
|
+
"project/workflow",
|
|
32280
|
+
"styleguide/dart",
|
|
32281
|
+
"styleguide/flutter",
|
|
32282
|
+
"styleguide/go",
|
|
32283
|
+
"styleguide/gradle",
|
|
32284
|
+
"styleguide/html-css",
|
|
32285
|
+
"styleguide/index",
|
|
32286
|
+
"styleguide/java",
|
|
32287
|
+
"styleguide/javascript",
|
|
32288
|
+
"styleguide/kotlin",
|
|
32289
|
+
"styleguide/maven",
|
|
32290
|
+
"styleguide/python",
|
|
32291
|
+
"styleguide/react",
|
|
32292
|
+
"styleguide/swift",
|
|
32293
|
+
"styleguide/swiftui",
|
|
32294
|
+
"styleguide/typescript",
|
|
32295
|
+
"track/bug",
|
|
32296
|
+
"track/execution",
|
|
32297
|
+
"track/learning",
|
|
32298
|
+
"track/plan",
|
|
32299
|
+
"track/revert-operation",
|
|
32300
|
+
"track/revise-operation",
|
|
32301
|
+
"track/revision",
|
|
32302
|
+
"track/spec",
|
|
32303
|
+
"track/state"
|
|
32304
|
+
];
|
|
32262
32305
|
var catalogCache = null;
|
|
32263
32306
|
function locateTemplateRoot() {
|
|
32264
32307
|
const moduleDirectory = dirname2(fileURLToPath(import.meta.url));
|
|
@@ -32279,7 +32322,7 @@ function walk(root, directory = root) {
|
|
|
32279
32322
|
}
|
|
32280
32323
|
function templateId(path) {
|
|
32281
32324
|
if (path.endsWith("/.gitkeep")) return null;
|
|
32282
|
-
if (path === "init
|
|
32325
|
+
if (path === "init/gitignore.template") return "project/gitignore";
|
|
32283
32326
|
const withoutExtension = path.slice(0, -extname(path).length);
|
|
32284
32327
|
const styleguidePrefix = "styleguides/";
|
|
32285
32328
|
if (path.startsWith(styleguidePrefix)) return `styleguide/${withoutExtension.slice(styleguidePrefix.length)}`;
|
|
@@ -32287,13 +32330,27 @@ function templateId(path) {
|
|
|
32287
32330
|
return withoutExtension;
|
|
32288
32331
|
}
|
|
32289
32332
|
function mimeType(path) {
|
|
32290
|
-
if (path
|
|
32333
|
+
if (path === "init/gitignore.template") return "text/plain";
|
|
32291
32334
|
return path.endsWith(".json") ? "application/json" : "text/markdown";
|
|
32292
32335
|
}
|
|
32336
|
+
function assertCompleteCatalog(catalog) {
|
|
32337
|
+
const actual = new Set(catalog.map((template) => template.id));
|
|
32338
|
+
if (actual.size !== catalog.length) throw new Error(`Cadre template set ${TEMPLATE_SET_VERSION} has duplicate identifiers`);
|
|
32339
|
+
const expected = new Set(TEMPLATE_IDS);
|
|
32340
|
+
const missing = TEMPLATE_IDS.filter((id) => !actual.has(id));
|
|
32341
|
+
const unexpected = [...actual].filter((id) => !expected.has(id)).sort();
|
|
32342
|
+
if (missing.length || unexpected.length) {
|
|
32343
|
+
const details = [
|
|
32344
|
+
missing.length ? `missing ${missing.join(", ")}` : "",
|
|
32345
|
+
unexpected.length ? `unexpected ${unexpected.join(", ")}` : ""
|
|
32346
|
+
].filter(Boolean).join("; ");
|
|
32347
|
+
throw new Error(`Cadre template set ${TEMPLATE_SET_VERSION} is incomplete: ${details}`);
|
|
32348
|
+
}
|
|
32349
|
+
}
|
|
32293
32350
|
function templateCatalog() {
|
|
32294
32351
|
if (!catalogCache) {
|
|
32295
32352
|
const root = locateTemplateRoot();
|
|
32296
|
-
|
|
32353
|
+
const catalog = walk(root).map((relativePath) => {
|
|
32297
32354
|
const id = templateId(relativePath);
|
|
32298
32355
|
if (!id) return null;
|
|
32299
32356
|
const content = readFileSync4(join3(root, relativePath), "utf8");
|
|
@@ -32306,6 +32363,8 @@ function templateCatalog() {
|
|
|
32306
32363
|
sha256: createHash4("sha256").update(content).digest("hex")
|
|
32307
32364
|
};
|
|
32308
32365
|
}).filter((entry) => entry !== null).sort((left, right) => left.id.localeCompare(right.id));
|
|
32366
|
+
assertCompleteCatalog(catalog);
|
|
32367
|
+
catalogCache = catalog;
|
|
32309
32368
|
}
|
|
32310
32369
|
return catalogCache.map((template) => ({ ...template }));
|
|
32311
32370
|
}
|
|
@@ -33116,6 +33175,16 @@ function serializableValidation(validation) {
|
|
|
33116
33175
|
warnings: validation.warnings
|
|
33117
33176
|
};
|
|
33118
33177
|
}
|
|
33178
|
+
var PLAN_VALIDATION_STATUSES = [
|
|
33179
|
+
"drafting-spec",
|
|
33180
|
+
"drafting-plan",
|
|
33181
|
+
"planned",
|
|
33182
|
+
"in_progress",
|
|
33183
|
+
"ready_for_review",
|
|
33184
|
+
"completed",
|
|
33185
|
+
"archived"
|
|
33186
|
+
];
|
|
33187
|
+
var MAX_DRAFT_PLAN_CHARACTERS = 256 * 1024;
|
|
33119
33188
|
function createCadreServer() {
|
|
33120
33189
|
const server = new McpServer(
|
|
33121
33190
|
{ name: "cadre", version: CADRE_RUNTIME_VERSION },
|
|
@@ -33233,6 +33302,26 @@ function createCadreServer() {
|
|
|
33233
33302
|
return failure(error51);
|
|
33234
33303
|
}
|
|
33235
33304
|
});
|
|
33305
|
+
server.registerTool("execution_graph_validate_draft", {
|
|
33306
|
+
title: "Validate a draft execution graph",
|
|
33307
|
+
description: "Compile and validate an unapproved plan supplied as Markdown without reading or writing project files.",
|
|
33308
|
+
inputSchema: {
|
|
33309
|
+
planMarkdown: external_exports.string().min(1).max(MAX_DRAFT_PLAN_CHARACTERS),
|
|
33310
|
+
targetStatus: external_exports.enum(PLAN_VALIDATION_STATUSES),
|
|
33311
|
+
sourceLabel: external_exports.string().min(1).max(200).regex(/^[^\r\n]+$/).optional()
|
|
33312
|
+
},
|
|
33313
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
33314
|
+
}, async ({ planMarkdown, targetStatus, sourceLabel }) => {
|
|
33315
|
+
try {
|
|
33316
|
+
const label = sourceLabel ?? "<draft-plan>";
|
|
33317
|
+
const errors = [];
|
|
33318
|
+
const graph = parsePlanContent(planMarkdown, label, errors);
|
|
33319
|
+
validatePlanGraph(label, graph, targetStatus, errors);
|
|
33320
|
+
return result({ valid: errors.length === 0, graph, errors });
|
|
33321
|
+
} catch (error51) {
|
|
33322
|
+
return failure(error51);
|
|
33323
|
+
}
|
|
33324
|
+
});
|
|
33236
33325
|
const reviewCompleteSchema = {
|
|
33237
33326
|
projectRoot: external_exports.string().min(1),
|
|
33238
33327
|
trackId: external_exports.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
package/package.json
CHANGED
package/skills/review/SKILL.md
CHANGED
|
@@ -22,7 +22,7 @@ Expected human decision count is one per review cycle when the human accepts the
|
|
|
22
22
|
1. Determine the commit range from the plan's recorded task commits. Inspect diffs and affected callers, tests, security boundaries, error paths, compatibility, acceptance criteria, and non-functional requirements.
|
|
23
23
|
2. Run relevant verification without mutating production behavior. Report findings by severity with file/line evidence, impact, reproduction, and proposed acceptance criteria. Do not write a bug file yet.
|
|
24
24
|
3. Prepare one decision-ready proposal before asking for approval:
|
|
25
|
-
- If findings exist, call `template_get_many` for `track/bug`, retain the versioned result, and draft the exact bug artifact plus the recommended dependency-aware remediation phases for all actionable findings. Every regular task declares same-phase dependencies, every added phase declares the phases it consumes and ends in the derived `User Manual Verification` barrier. Renumber the final phase/tasks as needed, reset that final manual barrier and phase completion to pending, and preserve its prior verification provenance in the review cycle/execution journal rather than leaving a second final phase. Call `
|
|
25
|
+
- If findings exist, call `template_get_many` for `track/bug`, retain the versioned result, and draft the exact bug artifact plus the recommended dependency-aware remediation phases for all actionable findings. Every regular task declares same-phase dependencies, every added phase declares the phases it consumes and ends in the derived `User Manual Verification` barrier. Renumber the final phase/tasks as needed, reset that final manual barrier and phase completion to pending, and preserve its prior verification provenance in the review cycle/execution journal rather than leaving a second final phase. Call `execution_graph_validate_draft` with the complete proposed plan Markdown and target status `in_progress`; do not validate the stale canonical plan or create a temporary project copy.
|
|
26
26
|
- Present the findings, exact artifact/plan diff, consequences, and choices together. One response may approve both the finding disposition and the unchanged exact artifacts. The human may instead request a subset or different remediation, reject all findings while explicitly accepting their risks and approve clean completion, or stop without mutation.
|
|
27
27
|
- If the human changes the finding subset or remediation, rebuild and validate the exact proposal and request approval once for that changed proposal. Do not reuse approval for superseded content.
|
|
28
28
|
- If no findings exist, present clean-review evidence and the exact completion transition once, then ask approval to complete the track.
|
package/skills/revise/SKILL.md
CHANGED
|
@@ -25,7 +25,7 @@ Call `project_status` first and use its embedded structured validation; do not r
|
|
|
25
25
|
3. Apply the workflow clarification gate. Ask when materially different interpretations remain for the desired outcome, scope, acceptance criteria, compatibility, dependency changes, treatment of completed or partial work, or whether dependent tracks should change now. Do not infer permission to invalidate approved work.
|
|
26
26
|
4. Trace transitive dependent tracks. For each, classify impact as none, reseed-only, plan change, spec change, or invalidated work, with evidence. If evidence cannot resolve a material impact, ask before choosing a classification.
|
|
27
27
|
5. Call `template_get_many` once for `track/revision` and `track/revise-operation`, and retain the versioned bundle. Render `revisions/revision-<ts>.md` and draft exact diffs for every affected artifact. Record source and target status, the base commit, affected phases/tasks, completed and partial-work disposition, review impact, dependency impact, and verification work. Preserve completed tasks and commit markers; append or explicitly supersede work rather than erasing provenance.
|
|
28
|
-
6. Increment the track revision exactly once. Increment the specification revision only if `spec.md` changes and the plan revision only if `plan.md` changes; keep the revision values in `state.json`, `spec.md`, `plan.md`, and the marked Pattern Seed consistent. Preserve completed task provenance, update explicit regular phase/task dependencies, restore derived manual-verification barriers,
|
|
28
|
+
6. Increment the track revision exactly once. Increment the specification revision only if `spec.md` changes and the plan revision only if `plan.md` changes; keep the revision values in `state.json`, `spec.md`, `plan.md`, and the marked Pattern Seed consistent. Preserve completed task provenance, update explicit regular phase/task dependencies, and restore derived manual-verification barriers. When the plan changes, call `execution_graph_validate_draft` with the complete proposed plan Markdown and the intended post-approval target status; do not validate the stale canonical plan or create a temporary project copy. A changed plan graph uses a new execution ID; never reuse a completed or superseded execution journal.
|
|
29
29
|
7. Present the target revision and all cascading dependent-track changes together. Wait for explicit approval. Partial approval narrows the change set and requires a fresh impact assessment, transition calculation, and proposal.
|
|
30
30
|
8. Before changing approved artifacts, write the rendered `revise` operation into every affected track's `state.json`. Use the same expected commit, record each approved artifact and per-artifact progress, and advance the durable checkpoint after each write.
|
|
31
31
|
9. Apply only the approved changes, update relevant marked Pattern Seed sections without overwriting phase learning, set the approved source-to-target states, mark the earliest affected plan nodes pending in the replacement execution graph, and append track-local history. Do not add singular active phase/task fields to track state. Preview and apply `tracks.md` through `tracks_render_preview` and `tracks_render_apply` using the unchanged approved digest.
|
package/skills/track/SKILL.md
CHANGED
|
@@ -19,7 +19,7 @@ Call `project_status` first and use its embedded structured validation; do not r
|
|
|
19
19
|
2. Apply the workflow clarification gate before drafting. Ask targeted questions whenever repository evidence and the request do not clearly establish a material choice such as feature versus bug, in/out of scope behavior, affected users/interfaces/data, compatibility or rollout expectations, acceptance measures, dependency tracks, or whether existing behavior must be preserved. Do not silently choose an interpretation.
|
|
20
20
|
3. Call `template_get_many` once for `track/spec` and `track/state`. Retain the versioned bundle across approval turns. Render the functional requirements, non-functional requirements, acceptance criteria, additional information, and dependency impact. Present both proposed artifacts and wait for approval before writing or changing state.
|
|
21
21
|
4. After approval, create/update track state with the spec operation journal before writing `spec.md`. Directly writing these approved track artifacts is intentional; do not search for an undeclared track-mutation MCP tool. Advance artifact checkpoints through written, then preview/apply the derived `tracks.md` update, call `state_validate`, require both canonical validity and current derived state, and advance to `commit-pending`. Commit as `cadre(track): specify <track-id>`, then record its SHA, clear the operation, move to `drafting-plan`, and commit the state record.
|
|
22
|
-
5. Call `template_get_many` once for `track/plan` and `track/learning`, retain the versioned bundle, then draft an acyclic phase/task graph. Every regular phase explicitly declares phase dependencies and every regular task explicitly declares same-phase task dependencies. Do not repeat derived barriers: each phase's final `User Manual Verification` depends on every sibling task, while the final `Track-level User Manual Verification` phase contains only its manual task and depends on every preceding phase. Include tests, formatting, documentation, and Definition of Done work explicitly. Call `
|
|
22
|
+
5. Call `template_get_many` once for `track/plan` and `track/learning`, retain the versioned bundle, then draft an acyclic phase/task graph. Every regular phase explicitly declares phase dependencies and every regular task explicitly declares same-phase task dependencies. Do not repeat derived barriers: each phase's final `User Manual Verification` depends on every sibling task, while the final `Track-level User Manual Verification` phase contains only its manual task and depends on every preceding phase. Include tests, formatting, documentation, and Definition of Done work explicitly. Call `execution_graph_validate_draft` with the proposed plan Markdown and target status `planned`; resolve every unknown reference, cycle, missing declaration, or material ambiguity before approval. Do not write an unapproved plan into `.cadre/` or create a temporary project copy for validation.
|
|
23
23
|
6. Build the marked `Pattern Seed` section at the top of `learning.md` from patterns relevant to this spec and plan. Root phases read the seed; other phases read learning from their declared dependency phases. Cite pattern file paths and explain relevance. Do not invent patterns. Present the plan, graph, and learning seed for approval.
|
|
24
24
|
7. After approval, journal the plan operation before writing `plan.md` and `learning.md`. Advance checkpoints through written, validated, and `commit-pending`; set track-local status to `planned`, call `tracks_render_preview`, present and apply its unchanged digest with `tracks_render_apply`, call `state_validate`, and commit `cadre(track): plan <track-id>`. Then record its SHA, clear the operation, set checkpoint `ready`, and commit `cadre(track): record plan <track-id>`.
|
|
25
25
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|