@sdd-method/sdd-cli 1.41.0 → 1.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/api-surface/index.js +2 -2
- package/dist/lib/api-surface/index.js.map +1 -1
- package/dist/lib/catalogue/cli-version.d.ts +1 -1
- package/dist/lib/catalogue/cli-version.d.ts.map +1 -1
- package/dist/lib/catalogue/cli-version.js +3 -3
- package/dist/lib/catalogue/cli-version.js.map +1 -1
- package/dist/lib/catalogue/freshness.d.ts +26 -0
- package/dist/lib/catalogue/freshness.d.ts.map +1 -0
- package/dist/lib/catalogue/freshness.js +69 -0
- package/dist/lib/catalogue/freshness.js.map +1 -0
- package/dist/lib/catalogue/graph-run.js +1 -1
- package/dist/lib/catalogue/graph-run.js.map +1 -1
- package/dist/lib/ci-binding/index.d.ts +63 -0
- package/dist/lib/ci-binding/index.d.ts.map +1 -0
- package/dist/lib/ci-binding/index.js +220 -0
- package/dist/lib/ci-binding/index.js.map +1 -0
- package/dist/lib/ci-binding/module.d.ts +36 -0
- package/dist/lib/ci-binding/module.d.ts.map +1 -0
- package/dist/lib/ci-binding/module.js +204 -0
- package/dist/lib/ci-binding/module.js.map +1 -0
- package/dist/lib/context-pull/index.d.ts +39 -0
- package/dist/lib/context-pull/index.d.ts.map +1 -0
- package/dist/lib/context-pull/index.js +151 -0
- package/dist/lib/context-pull/index.js.map +1 -0
- package/dist/lib/context-pull/resolve.d.ts +46 -0
- package/dist/lib/context-pull/resolve.d.ts.map +1 -0
- package/dist/lib/context-pull/resolve.js +70 -0
- package/dist/lib/context-pull/resolve.js.map +1 -0
- package/dist/lib/init/app.d.ts.map +1 -1
- package/dist/lib/init/app.js +3 -0
- package/dist/lib/init/app.js.map +1 -1
- package/dist/lib/init/ci-workflow.d.ts +6 -8
- package/dist/lib/init/ci-workflow.d.ts.map +1 -1
- package/dist/lib/init/ci-workflow.js +57 -120
- package/dist/lib/init/ci-workflow.js.map +1 -1
- package/dist/lib/init/integration.d.ts.map +1 -1
- package/dist/lib/init/integration.js +3 -0
- package/dist/lib/init/integration.js.map +1 -1
- package/dist/lib/init/platform.d.ts.map +1 -1
- package/dist/lib/init/platform.js +6 -2
- package/dist/lib/init/platform.js.map +1 -1
- package/dist/lib/lock-file.d.ts +20 -0
- package/dist/lib/lock-file.d.ts.map +1 -1
- package/dist/lib/lock-file.js +25 -1
- package/dist/lib/lock-file.js.map +1 -1
- package/dist/lib/mcp/build-info.d.ts.map +1 -1
- package/dist/lib/mcp/build-info.js +3 -3
- package/dist/lib/mcp/build-info.js.map +1 -1
- package/dist/lib/pack/index.js +2 -2
- package/dist/lib/pack/index.js.map +1 -1
- package/dist/lib/pack/validate.js +2 -2
- package/dist/lib/pack/validate.js.map +1 -1
- package/dist/lib/package-version.d.ts +23 -0
- package/dist/lib/package-version.d.ts.map +1 -1
- package/dist/lib/package-version.js +47 -10
- package/dist/lib/package-version.js.map +1 -1
- package/dist/lib/sync/index.d.ts +13 -0
- package/dist/lib/sync/index.d.ts.map +1 -1
- package/dist/lib/sync/index.js +69 -46
- package/dist/lib/sync/index.js.map +1 -1
- package/dist/lib/validate/bundle-coherence.js +2 -2
- package/dist/lib/validate/bundle-coherence.js.map +1 -1
- package/dist/lib/validate/plan.d.ts +25 -0
- package/dist/lib/validate/plan.d.ts.map +1 -0
- package/dist/lib/validate/plan.js +54 -0
- package/dist/lib/validate/plan.js.map +1 -0
- package/dist/maintain-bin.d.ts +3 -0
- package/dist/maintain-bin.d.ts.map +1 -0
- package/dist/maintain-bin.js +8 -0
- package/dist/maintain-bin.js.map +1 -0
- package/dist/maintain-program.d.ts +8 -0
- package/dist/maintain-program.d.ts.map +1 -0
- package/dist/maintain-program.js +91 -0
- package/dist/maintain-program.js.map +1 -0
- package/dist/maintain-version.json +4 -0
- package/dist/verbs/catalogue-maintain.d.ts +6 -0
- package/dist/verbs/catalogue-maintain.d.ts.map +1 -0
- package/dist/verbs/catalogue-maintain.js +110 -0
- package/dist/verbs/catalogue-maintain.js.map +1 -0
- package/dist/verbs/catalogue.d.ts +5 -0
- package/dist/verbs/catalogue.d.ts.map +1 -1
- package/dist/verbs/catalogue.js +14 -80
- package/dist/verbs/catalogue.js.map +1 -1
- package/dist/verbs/context.d.ts +3 -0
- package/dist/verbs/context.d.ts.map +1 -0
- package/dist/verbs/context.js +39 -0
- package/dist/verbs/context.js.map +1 -0
- package/dist/verbs/pack-build.d.ts +3 -0
- package/dist/verbs/pack-build.d.ts.map +1 -0
- package/dist/verbs/pack-build.js +31 -0
- package/dist/verbs/pack-build.js.map +1 -0
- package/dist/verbs/pack.d.ts.map +1 -1
- package/dist/verbs/pack.js +2 -25
- package/dist/verbs/pack.js.map +1 -1
- package/dist/verbs/sync.d.ts.map +1 -1
- package/dist/verbs/sync.js +21 -0
- package/dist/verbs/sync.js.map +1 -1
- package/dist/verbs/validate.d.ts.map +1 -1
- package/dist/verbs/validate.js +26 -0
- package/dist/verbs/validate.js.map +1 -1
- package/dist/verify-program.d.ts +6 -1
- package/dist/verify-program.d.ts.map +1 -1
- package/dist/verify-program.js +11 -4
- package/dist/verify-program.js.map +1 -1
- package/dist/verify-version.json +2 -2
- package/package.json +5 -4
- package/scripts/{build-verify-package.mjs → build-persona-package.mjs} +112 -46
- package/scripts/copy-yaml-assets.mjs +4 -2
- package/scripts/dagger-parity.sh +74 -0
- package/scripts/maintain-acceptance.mjs +240 -0
- package/scripts/maintain-version.json +4 -0
- package/scripts/release-gate.mjs +9 -0
- package/scripts/verify-version.json +2 -2
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Method Validation Dagger module (M-ADR 0219 §4.1–§4.3): the ONLY definition of the
|
|
3
|
+
* method-managed validation job. `sync` writes these files into every SDD at MODULE_DIR, with the
|
|
4
|
+
* exact verify-cli and maintain-cli versions released alongside this sdd-cli substituted in, and
|
|
5
|
+
* every CI host's wrapper (./index.ts) just calls the module.
|
|
6
|
+
*
|
|
7
|
+
* The module's source lives here, as text, rather than as files beside the package: sync runs from
|
|
8
|
+
* three packages (sdd-cli, maintain-cli, and the persona builds' import closure), and a string
|
|
9
|
+
* travels with whichever one imports it, where an asset directory would have to be copied into each.
|
|
10
|
+
* `scripts/dagger-parity.sh` renders it from the built package, so the parity harness runs exactly
|
|
11
|
+
* what sync writes.
|
|
12
|
+
*/
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
|
+
import { getMaintainCliVersion, getVerifyCliVersion } from "../package-version.js";
|
|
15
|
+
/** Where the module lives in an SDD (M-ADR 0219 §4.3, ruled 2026-10-16). */
|
|
16
|
+
export const MODULE_DIR = ".dagger/method-validation";
|
|
17
|
+
/**
|
|
18
|
+
* The Dagger engine the module declares and every wrapper installs, pinned to one value so the CLI a
|
|
19
|
+
* wrapper installs and the engine the module asks for can never disagree (M-ADR 0219 §6). An engine
|
|
20
|
+
* upgrade is a release concern: change it here, run scripts/dagger-parity.sh, release.
|
|
21
|
+
*/
|
|
22
|
+
export const DAGGER_VERSION = "0.21.10";
|
|
23
|
+
/** The command every host wrapper runs. */
|
|
24
|
+
export const MODULE_CALL = `dagger call -m ${MODULE_DIR} method-validation --source .`;
|
|
25
|
+
const VERIFY_PIN = "@@VERIFY_CLI_VERSION@@";
|
|
26
|
+
// The module's SDK import, substituted at render: written literally, the persona builds' import-closure
|
|
27
|
+
// scan would read this text as an import of the CLI's own and refuse a dependency it does not declare.
|
|
28
|
+
const DAGGER_SDK = "@@DAGGER_SDK@@";
|
|
29
|
+
const MAINTAIN_PIN = "@@MAINTAIN_CLI_VERSION@@";
|
|
30
|
+
// The module's own source. String.raw keeps it byte-for-byte, so it holds no backtick; its only
|
|
31
|
+
// substitutions are the three markers above, which renderModuleFiles replaces.
|
|
32
|
+
const INDEX_TS = String.raw `/**
|
|
33
|
+
* Method Validation (M-ADR 0219): the method-managed validation job, as one Dagger module. Every CI
|
|
34
|
+
* host calls it, and none keeps a step list of its own. Written by sdd-cli sync and method-managed:
|
|
35
|
+
* sync refuses to overwrite an edited copy without --allow-overwrite.
|
|
36
|
+
*
|
|
37
|
+
* Run it anywhere a container engine runs:
|
|
38
|
+
* dagger call -m .dagger/method-validation method-validation --source .
|
|
39
|
+
*
|
|
40
|
+
* The steps are the method's job plan, read at run time from "sdd-verify validate --list". Every
|
|
41
|
+
* step runs even after an earlier one fails, so one red step never hides the verdicts after it. The
|
|
42
|
+
* job fails only when a non-advisory step fails; the catalogue freshness step is advisory.
|
|
43
|
+
*/
|
|
44
|
+
import { dag, Container, Directory, File, object, func, ReturnType } from ${DAGGER_SDK}
|
|
45
|
+
|
|
46
|
+
// Pinned, so a run is reproducible and every tool the validators shell out to is named here.
|
|
47
|
+
const NODE_IMAGE = "node:20-bookworm"
|
|
48
|
+
const YQ_VERSION = "v4.44.3"
|
|
49
|
+
|
|
50
|
+
interface PlanStep {
|
|
51
|
+
id: string
|
|
52
|
+
title: string
|
|
53
|
+
tool: "sdd-verify" | "sdd-maintain" | "bash"
|
|
54
|
+
args: string[]
|
|
55
|
+
advisory: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@object()
|
|
59
|
+
export class MethodValidation {
|
|
60
|
+
/**
|
|
61
|
+
* The toolchain: Node, git, bash, python3, ripgrep, a pinned yq, and the exact-pinned verify and
|
|
62
|
+
* maintain CLIs. A tarball, when given, replaces the published package (a release candidate).
|
|
63
|
+
*/
|
|
64
|
+
@func()
|
|
65
|
+
toolchain(
|
|
66
|
+
verifyVersion: string = "${VERIFY_PIN}",
|
|
67
|
+
maintainVersion: string = "${MAINTAIN_PIN}",
|
|
68
|
+
verifyTarball?: File,
|
|
69
|
+
maintainTarball?: File,
|
|
70
|
+
): Container {
|
|
71
|
+
let c = dag
|
|
72
|
+
.container()
|
|
73
|
+
.from(NODE_IMAGE)
|
|
74
|
+
.withExec(["sh", "-c", "apt-get update -qq && apt-get install -y -qq ripgrep python3 >/dev/null"])
|
|
75
|
+
.withExec([
|
|
76
|
+
"sh",
|
|
77
|
+
"-c",
|
|
78
|
+
"curl -fsSL -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/" +
|
|
79
|
+
YQ_VERSION +
|
|
80
|
+
"/yq_linux_$(dpkg --print-architecture) && chmod +x /usr/local/bin/yq",
|
|
81
|
+
])
|
|
82
|
+
const pkgs: string[] = []
|
|
83
|
+
if (verifyTarball) {
|
|
84
|
+
c = c.withFile("/pkgs/verify-cli.tgz", verifyTarball)
|
|
85
|
+
pkgs.push("/pkgs/verify-cli.tgz")
|
|
86
|
+
} else pkgs.push("@sdd-method/verify-cli@" + verifyVersion)
|
|
87
|
+
if (maintainTarball) {
|
|
88
|
+
c = c.withFile("/pkgs/maintain-cli.tgz", maintainTarball)
|
|
89
|
+
pkgs.push("/pkgs/maintain-cli.tgz")
|
|
90
|
+
} else pkgs.push("@sdd-method/maintain-cli@" + maintainVersion)
|
|
91
|
+
return c.withExec(["npm", "install", "-g", "--silent", ...pkgs])
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Run Method Validation on an SDD repository. Returns a step-by-step report, and throws (so the
|
|
96
|
+
* CI host's job fails) when any non-advisory step failed.
|
|
97
|
+
*/
|
|
98
|
+
@func()
|
|
99
|
+
async methodValidation(
|
|
100
|
+
source: Directory,
|
|
101
|
+
verifyVersion: string = "${VERIFY_PIN}",
|
|
102
|
+
maintainVersion: string = "${MAINTAIN_PIN}",
|
|
103
|
+
verifyTarball?: File,
|
|
104
|
+
maintainTarball?: File,
|
|
105
|
+
): Promise<string> {
|
|
106
|
+
const base = this.toolchain(verifyVersion, maintainVersion, verifyTarball, maintainTarball)
|
|
107
|
+
.withMountedDirectory("/src", source)
|
|
108
|
+
.withWorkdir("/src")
|
|
109
|
+
const versions = (await base.withExec(["sh", "-c", "sdd-verify --version; sdd-maintain --version"]).stdout()).split("\n")
|
|
110
|
+
const plan = JSON.parse(await base.withExec(["sdd-verify", "validate", "--list"]).stdout()) as {
|
|
111
|
+
profile: string
|
|
112
|
+
steps: PlanStep[]
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const lines = ["Method Validation: profile " + plan.profile + "; sdd-verify " + versions[0] + ", sdd-maintain " + versions[1]]
|
|
116
|
+
let failed = 0
|
|
117
|
+
for (const step of plan.steps) {
|
|
118
|
+
const ran = base.withExec([step.tool, ...step.args], { expect: ReturnType.Any })
|
|
119
|
+
const code = await ran.exitCode()
|
|
120
|
+
const verdict = code === 0 ? "PASS" : step.advisory ? "ADVISORY" : "FAIL"
|
|
121
|
+
if (code !== 0 && !step.advisory) failed++
|
|
122
|
+
lines.push(verdict.padEnd(8) + " exit " + code + " " + step.id + " (" + step.title + ")")
|
|
123
|
+
if (code !== 0) {
|
|
124
|
+
const out = (await ran.stdout()) + (await ran.stderr())
|
|
125
|
+
lines.push(...out.trim().split("\n").slice(-6).map((l) => " " + l))
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
lines.push(failed === 0 ? "RESULT: PASS" : "RESULT: FAIL (" + failed + " failing step(s))")
|
|
129
|
+
const report = lines.join("\n")
|
|
130
|
+
if (failed > 0) throw new Error(report)
|
|
131
|
+
return report
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
const DAGGER_JSON = `{
|
|
136
|
+
"name": "method-validation",
|
|
137
|
+
"engineVersion": "v${DAGGER_VERSION}",
|
|
138
|
+
"sdk": {
|
|
139
|
+
"source": "typescript"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
const PACKAGE_JSON = `{
|
|
144
|
+
"type": "module",
|
|
145
|
+
"dependencies": {
|
|
146
|
+
"typescript": "5.9.3"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
const TSCONFIG_JSON = `{
|
|
151
|
+
"compilerOptions": {
|
|
152
|
+
"target": "ES2022",
|
|
153
|
+
"moduleResolution": "Node",
|
|
154
|
+
"experimentalDecorators": true,
|
|
155
|
+
"strict": true,
|
|
156
|
+
"skipLibCheck": true,
|
|
157
|
+
"paths": {
|
|
158
|
+
"@dagger.io/dagger": ["./sdk/index.ts"],
|
|
159
|
+
"@dagger.io/dagger/telemetry": ["./sdk/telemetry.ts"]
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
const YARN_LOCK = `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
165
|
+
# yarn lockfile v1
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
typescript@5.9.3:
|
|
169
|
+
version "5.9.3"
|
|
170
|
+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
|
|
171
|
+
integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==
|
|
172
|
+
`;
|
|
173
|
+
// The SDK Dagger generates at run time stays out of the SDD's history.
|
|
174
|
+
const GITIGNORE = `/sdk
|
|
175
|
+
/**/node_modules/**
|
|
176
|
+
/**/.pnpm-store/**
|
|
177
|
+
/.env
|
|
178
|
+
`;
|
|
179
|
+
/**
|
|
180
|
+
* The module's files, relative to MODULE_DIR, in a fixed order. Pins default to the versions released
|
|
181
|
+
* with this sdd-cli (M-ADR 0218 §4.6); the parity harness passes candidate versions.
|
|
182
|
+
*/
|
|
183
|
+
export function renderModuleFiles(pins = { verify: getVerifyCliVersion(), maintain: getMaintainCliVersion() }) {
|
|
184
|
+
return [
|
|
185
|
+
[".gitignore", GITIGNORE],
|
|
186
|
+
["dagger.json", DAGGER_JSON],
|
|
187
|
+
["package.json", PACKAGE_JSON],
|
|
188
|
+
["src/index.ts", INDEX_TS.split(VERIFY_PIN).join(pins.verify).split(MAINTAIN_PIN).join(pins.maintain).split(DAGGER_SDK).join('"@dagger.io' + '/dagger"')],
|
|
189
|
+
["tsconfig.json", TSCONFIG_JSON],
|
|
190
|
+
["yarn.lock", YARN_LOCK],
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* sha256 over the module's files as they stand (null content = absent), in the render's order, so
|
|
195
|
+
* sync can tell a module nobody touched from an edited one (M-ADR 0218 §4.7, as for the wrapper).
|
|
196
|
+
*/
|
|
197
|
+
export function moduleSha256(files) {
|
|
198
|
+
const h = createHash("sha256");
|
|
199
|
+
for (const [rel, content] of files) {
|
|
200
|
+
h.update(rel).update("\0").update(content === null ? "\u0001absent" : content).update("\0");
|
|
201
|
+
}
|
|
202
|
+
return h.digest("hex");
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/lib/ci-binding/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AAExC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,UAAU,+BAA+B,CAAC;AAEvF,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAC5C,wGAAwG;AACxG,uGAAuG;AACvG,MAAM,UAAU,GAAG,gBAAgB,CAAC;AACpC,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,gGAAgG;AAChG,+EAA+E;AAC/E,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;4EAYiD,UAAU;;;;;;;;;;;;;;;;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MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9F,CAAC;IACD,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sdd-cli context pull` — write the code-repo briefing and MCP_SETUP.md into a
|
|
3
|
+
* code repository from its upstream SDD (M-ADR 0128 §1; M-ADR 0150 §4.3–4.4).
|
|
4
|
+
*
|
|
5
|
+
* The successor to the code-repo half of `generate-claude-md.sh`, scoped by
|
|
6
|
+
* M-ADR 0150 Phase D: no dynamic content is baked in; that is the SDD's MCP
|
|
7
|
+
* server's job. A sibling verb to `generate-briefing`, not an extension of it:
|
|
8
|
+
* `generate-briefing` needs the target to be an SDD (marker, lock, synced
|
|
9
|
+
* templates), and a code repository is none of those. They share the
|
|
10
|
+
* placeholder substitution and the wrapper's marker-block merge.
|
|
11
|
+
*
|
|
12
|
+
* What it writes, and nothing else (M-ADR 0218 §4.3 item 9, a MAINTAIN verb):
|
|
13
|
+
* agent-instructions.md whole file, method-managed
|
|
14
|
+
* CLAUDE.md / AGENTS.md the method-managed block only; adopter content survives
|
|
15
|
+
* MCP_SETUP.md whole file, method-managed
|
|
16
|
+
* Templates are read from the SDD, which carries them via its baseline bundle.
|
|
17
|
+
*/
|
|
18
|
+
import type { AgentHarness } from "../agent-harness.js";
|
|
19
|
+
export declare const CODE_REPO_BRIEFING_ROOT = "orchestration/templates/briefing/code-repo";
|
|
20
|
+
export declare const MCP_SETUP_TEMPLATE = "orchestration/templates/mcp/code-repo/MCP_SETUP.md.hbs";
|
|
21
|
+
export declare const MCP_SETUP_REL_PATH = "MCP_SETUP.md";
|
|
22
|
+
export interface ContextPullOptions {
|
|
23
|
+
/** The code repository to write into. */
|
|
24
|
+
readonly codeRepo: string;
|
|
25
|
+
readonly agentHarness: AgentHarness;
|
|
26
|
+
readonly allowOverwrite: boolean;
|
|
27
|
+
readonly sddPath?: string | undefined;
|
|
28
|
+
readonly repoName?: string | undefined;
|
|
29
|
+
readonly searchRoots?: readonly string[] | undefined;
|
|
30
|
+
/** ISO date recorded as pull_date. Default: today (UTC). Pinned in tests for determinism. */
|
|
31
|
+
readonly pullDate?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface ContextPullResult {
|
|
34
|
+
readonly exitCode: number;
|
|
35
|
+
}
|
|
36
|
+
export declare function runContextPull(opts: ContextPullOptions, out?: (line: string) => void): Promise<ContextPullResult>;
|
|
37
|
+
/** `{{name}}` substitution over an open variable set (the briefing renderer's is closed to four). */
|
|
38
|
+
export declare function substituteAll(template: string, vars: Readonly<Record<string, string>>): string;
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/context-pull/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAexD,eAAO,MAAM,uBAAuB,+CAA+C,CAAC;AACpF,eAAO,MAAM,kBAAkB,2DAA2D,CAAC;AAC3F,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAOjD,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrD,6FAA6F;IAC7F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,EACxB,GAAG,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAA2C,GACjE,OAAO,CAAC,iBAAiB,CAAC,CAiH5B;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAE9F"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sdd-cli context pull` — write the code-repo briefing and MCP_SETUP.md into a
|
|
3
|
+
* code repository from its upstream SDD (M-ADR 0128 §1; M-ADR 0150 §4.3–4.4).
|
|
4
|
+
*
|
|
5
|
+
* The successor to the code-repo half of `generate-claude-md.sh`, scoped by
|
|
6
|
+
* M-ADR 0150 Phase D: no dynamic content is baked in; that is the SDD's MCP
|
|
7
|
+
* server's job. A sibling verb to `generate-briefing`, not an extension of it:
|
|
8
|
+
* `generate-briefing` needs the target to be an SDD (marker, lock, synced
|
|
9
|
+
* templates), and a code repository is none of those. They share the
|
|
10
|
+
* placeholder substitution and the wrapper's marker-block merge.
|
|
11
|
+
*
|
|
12
|
+
* What it writes, and nothing else (M-ADR 0218 §4.3 item 9, a MAINTAIN verb):
|
|
13
|
+
* agent-instructions.md whole file, method-managed
|
|
14
|
+
* CLAUDE.md / AGENTS.md the method-managed block only; adopter content survives
|
|
15
|
+
* MCP_SETUP.md whole file, method-managed
|
|
16
|
+
* Templates are read from the SDD, which carries them via its baseline bundle.
|
|
17
|
+
*/
|
|
18
|
+
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
19
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
20
|
+
import { AGENT_INSTRUCTIONS_REL_PATH, WRAPPER_BLOCK_BEGIN, WRAPPER_BLOCK_END, findUnresolvedPlaceholders, harnessWrapperOutputPath, resolveBriefingVariables, splitWrapperTemplate, } from "../briefing/index.js";
|
|
21
|
+
import { readLockFile } from "../lock-file.js";
|
|
22
|
+
import { readRepoKind } from "../repo-kind.js";
|
|
23
|
+
import { writeMarkedBlockFile } from "../sync/yaml-block-merge.js";
|
|
24
|
+
import { defaultSearchRoots, resolveCodeRepoName, resolveSdd } from "./resolve.js";
|
|
25
|
+
export const CODE_REPO_BRIEFING_ROOT = "orchestration/templates/briefing/code-repo";
|
|
26
|
+
export const MCP_SETUP_TEMPLATE = "orchestration/templates/mcp/code-repo/MCP_SETUP.md.hbs";
|
|
27
|
+
export const MCP_SETUP_REL_PATH = "MCP_SETUP.md";
|
|
28
|
+
const WRAPPER_TEMPLATE = {
|
|
29
|
+
"claude-code": "claude-code/CLAUDE.md.hbs",
|
|
30
|
+
"github-copilot-cli": "github-copilot-cli/AGENTS.md.hbs",
|
|
31
|
+
};
|
|
32
|
+
export async function runContextPull(opts, out = (line) => process.stdout.write(line)) {
|
|
33
|
+
const codeRepo = resolve(opts.codeRepo);
|
|
34
|
+
if ((await readRepoKind(codeRepo)) !== null) {
|
|
35
|
+
out(fail(`${codeRepo} is an SDD repository (it has .sdd-repo-kind). context pull writes into a code repository; for an SDD use sdd-cli generate-briefing.`));
|
|
36
|
+
return { exitCode: 1 };
|
|
37
|
+
}
|
|
38
|
+
const repoName = resolveCodeRepoName(codeRepo, opts.repoName);
|
|
39
|
+
const outcome = await resolveSdd({
|
|
40
|
+
repoName,
|
|
41
|
+
sddPath: opts.sddPath,
|
|
42
|
+
searchRoots: opts.searchRoots ?? defaultSearchRoots(codeRepo),
|
|
43
|
+
codeRepo,
|
|
44
|
+
});
|
|
45
|
+
if (outcome.kind === "not-an-sdd") {
|
|
46
|
+
out(fail(`--sdd ${outcome.path} is not an SDD repository (no .sdd-repo-kind).`));
|
|
47
|
+
return { exitCode: 1 };
|
|
48
|
+
}
|
|
49
|
+
if (outcome.kind === "not-found") {
|
|
50
|
+
out(fail(`No SDD lists repository "${repoName}" in its catalogues/repositories.csv (searched ${outcome.searched.length} SDD(s) under ${(opts.searchRoots ?? defaultSearchRoots(codeRepo)).join(", ")}). Pass --sdd <path>, or --repo <id> if this repository is catalogued under another id.`));
|
|
51
|
+
return { exitCode: 1 };
|
|
52
|
+
}
|
|
53
|
+
if (outcome.kind === "ambiguous") {
|
|
54
|
+
out(fail(`Repository "${repoName}" is listed by ${outcome.candidates.length} SDDs: ${outcome.candidates.join(", ")}. Pass --sdd <path> to choose.`));
|
|
55
|
+
return { exitCode: 1 };
|
|
56
|
+
}
|
|
57
|
+
const sddRoot = outcome.sddRoot;
|
|
58
|
+
if (!outcome.catalogued) {
|
|
59
|
+
out(warn(`${basename(sddRoot)}'s catalogues/repositories.csv does not list "${repoName}"; continuing because --sdd was given.`));
|
|
60
|
+
}
|
|
61
|
+
// The SDD's own identity, profile and baseline, exactly as its own briefing renders them.
|
|
62
|
+
const lock = await readLockFile(sddRoot);
|
|
63
|
+
const forwardBase = lock?.bundles.find((b) => b.isForwardBase);
|
|
64
|
+
if (!forwardBase) {
|
|
65
|
+
out(fail(`${sddRoot} has no forward-base bundle in method-baseline.lock; sync it first.`));
|
|
66
|
+
return { exitCode: 1 };
|
|
67
|
+
}
|
|
68
|
+
const sdd = await resolveBriefingVariables({ targetRepo: sddRoot, baselineVersionOverride: forwardBase.bundleVersion });
|
|
69
|
+
const vars = {
|
|
70
|
+
repo_name: repoName,
|
|
71
|
+
sdd_name: sdd.sdd_name,
|
|
72
|
+
sdd_root: sddRoot,
|
|
73
|
+
repo_kind: sdd.repo_kind,
|
|
74
|
+
baseline_version: sdd.baseline_version,
|
|
75
|
+
pull_date: opts.pullDate ?? new Date().toISOString().slice(0, 10),
|
|
76
|
+
// MCP_SETUP.md's own names, kept so the template the bash generator rendered still renders.
|
|
77
|
+
upstream_sdd_name: basename(sddRoot),
|
|
78
|
+
sdd_method_baseline_version: sdd.baseline_version,
|
|
79
|
+
};
|
|
80
|
+
const aiTemplate = join(sddRoot, CODE_REPO_BRIEFING_ROOT, "agent-instructions.md.hbs");
|
|
81
|
+
const wrapperTemplate = join(sddRoot, CODE_REPO_BRIEFING_ROOT, WRAPPER_TEMPLATE[opts.agentHarness]);
|
|
82
|
+
const mcpTemplate = join(sddRoot, MCP_SETUP_TEMPLATE);
|
|
83
|
+
for (const t of [aiTemplate, wrapperTemplate, mcpTemplate]) {
|
|
84
|
+
if (!(await exists(t))) {
|
|
85
|
+
out(fail(`${sddRoot} does not carry ${t.slice(sddRoot.length + 1)}: its method baseline predates context pull. Sync the SDD to a baseline that ships the code-repo templates.`));
|
|
86
|
+
return { exitCode: 1 };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const rendered = {};
|
|
90
|
+
for (const [rel, path] of [[AGENT_INSTRUCTIONS_REL_PATH, aiTemplate], [harnessWrapperOutputPath(opts.agentHarness), wrapperTemplate], [MCP_SETUP_REL_PATH, mcpTemplate]]) {
|
|
91
|
+
const content = substituteAll(await readFile(path, "utf8"), vars);
|
|
92
|
+
const unresolved = findUnresolvedPlaceholders(content);
|
|
93
|
+
if (unresolved.length > 0) {
|
|
94
|
+
out(fail(`${rel}: the SDD's template has placeholders this CLI does not know: ${unresolved.join(", ")}. Upgrade sdd-cli.`));
|
|
95
|
+
return { exitCode: 1 };
|
|
96
|
+
}
|
|
97
|
+
rendered[rel] = content;
|
|
98
|
+
}
|
|
99
|
+
// The wrapper first: it is the only write that can be refused, and a refusal must leave nothing written.
|
|
100
|
+
const wrapperRel = harnessWrapperOutputPath(opts.agentHarness);
|
|
101
|
+
const wrapperPath = join(codeRepo, wrapperRel);
|
|
102
|
+
const existing = (await exists(wrapperPath)) ? await readFile(wrapperPath, "utf8") : null;
|
|
103
|
+
const parts = splitWrapperTemplate(rendered[wrapperRel]);
|
|
104
|
+
const hasMarkers = existing !== null && existing.includes(WRAPPER_BLOCK_BEGIN) && existing.includes(WRAPPER_BLOCK_END);
|
|
105
|
+
let wrapperChanged;
|
|
106
|
+
if (existing !== null && !hasMarkers) {
|
|
107
|
+
// No markers: a pre-briefing-layer file (the bash generator wrote these whole) or adopter-authored.
|
|
108
|
+
if (!opts.allowOverwrite) {
|
|
109
|
+
out(fail(`${wrapperRel} exists without method-managed markers, so it is treated as adopter-authored. Nothing was written. Re-run with --allow-overwrite to replace it with the rendered wrapper (move anything worth keeping below its markers afterwards).`));
|
|
110
|
+
return { exitCode: 1 };
|
|
111
|
+
}
|
|
112
|
+
await writeFile(wrapperPath, rendered[wrapperRel], "utf8");
|
|
113
|
+
wrapperChanged = existing !== rendered[wrapperRel];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const merge = await writeMarkedBlockFile(wrapperPath, existing === null ? rendered[wrapperRel] : parts.block, { begin: WRAPPER_BLOCK_BEGIN, end: WRAPPER_BLOCK_END }, opts.allowOverwrite, existing === null ? undefined : { pre: parts.pre, post: parts.post });
|
|
117
|
+
wrapperChanged = merge.changed;
|
|
118
|
+
}
|
|
119
|
+
const changed = [];
|
|
120
|
+
if (wrapperChanged)
|
|
121
|
+
changed.push(wrapperRel);
|
|
122
|
+
for (const rel of [AGENT_INSTRUCTIONS_REL_PATH, MCP_SETUP_REL_PATH]) {
|
|
123
|
+
const path = join(codeRepo, rel);
|
|
124
|
+
const before = (await exists(path)) ? await readFile(path, "utf8") : null;
|
|
125
|
+
if (before !== rendered[rel]) {
|
|
126
|
+
await mkdir(dirname(path), { recursive: true });
|
|
127
|
+
await writeFile(path, rendered[rel], "utf8");
|
|
128
|
+
changed.push(rel);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
out(info(`Code repo "${repoName}" is specified by ${sdd.sdd_name} (${sdd.repo_kind}, ${sdd.baseline_version}) at ${sddRoot}.`));
|
|
132
|
+
out(info(changed.length > 0 ? `Wrote ${changed.join(", ")}.` : `Already current: ${AGENT_INSTRUCTIONS_REL_PATH}, ${wrapperRel}, ${MCP_SETUP_REL_PATH}.`));
|
|
133
|
+
return { exitCode: 0 };
|
|
134
|
+
}
|
|
135
|
+
/** `{{name}}` substitution over an open variable set (the briefing renderer's is closed to four). */
|
|
136
|
+
export function substituteAll(template, vars) {
|
|
137
|
+
return template.replace(/\{\{\s*([a-z_][a-z0-9_]*)\s*\}\}/g, (full, key) => (key in vars ? vars[key] : full));
|
|
138
|
+
}
|
|
139
|
+
async function exists(path) {
|
|
140
|
+
try {
|
|
141
|
+
await access(path);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const info = (m) => `[INFO] ${m}\n`;
|
|
149
|
+
const warn = (m) => `[WARN] ${m}\n`;
|
|
150
|
+
const fail = (m) => `[FAIL] ${m}\n`;
|
|
151
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/context-pull/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MA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,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;AAC5C,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;AAC5C,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-repo SDD-source resolution for `sdd-cli context pull` (M-ADR 0128 §1,
|
|
3
|
+
* M-ADR 0150 §4.4 Phase D).
|
|
4
|
+
*
|
|
5
|
+
* A code repository has no `.sdd-repo-kind`, no lock and no bundle, so nothing
|
|
6
|
+
* in it names the SDD that specifies it. The SDD names the code repository
|
|
7
|
+
* instead: every repository it owns is a row in its own
|
|
8
|
+
* `catalogues/repositories.csv`, keyed by id. Resolution is therefore a lookup
|
|
9
|
+
* in that direction: find the SDD whose catalogue lists this repository.
|
|
10
|
+
*
|
|
11
|
+
* Only the SDD's OWN catalogue counts, never `catalogues-aggregated/`: a
|
|
12
|
+
* platform root's aggregate lists every member's repositories too, so reading
|
|
13
|
+
* it would make every code repo resolve to two SDDs.
|
|
14
|
+
*/
|
|
15
|
+
export declare const REPOSITORIES_CATALOGUE = "catalogues/repositories.csv";
|
|
16
|
+
/** The code repository's id: `--repo` when given, else its git top-level's directory name. */
|
|
17
|
+
export declare function resolveCodeRepoName(codeRepo: string, override?: string): string;
|
|
18
|
+
export type ResolveOutcome = {
|
|
19
|
+
readonly kind: "resolved";
|
|
20
|
+
readonly sddRoot: string;
|
|
21
|
+
readonly catalogued: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "not-found";
|
|
24
|
+
readonly searched: readonly string[];
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: "ambiguous";
|
|
27
|
+
readonly candidates: readonly string[];
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: "not-an-sdd";
|
|
30
|
+
readonly path: string;
|
|
31
|
+
};
|
|
32
|
+
export interface ResolveSddOptions {
|
|
33
|
+
readonly repoName: string;
|
|
34
|
+
/** `--sdd`: an explicit SDD root. Skips discovery. */
|
|
35
|
+
readonly sddPath?: string | undefined;
|
|
36
|
+
/** Directories to discover SDDs under. Default: the code repository's parent. */
|
|
37
|
+
readonly searchRoots: readonly string[];
|
|
38
|
+
/** The code repository itself, excluded from candidates. */
|
|
39
|
+
readonly codeRepo: string;
|
|
40
|
+
}
|
|
41
|
+
/** Does this SDD's own repositories catalogue list `repoName`? */
|
|
42
|
+
export declare function catalogueListsRepo(sddRoot: string, repoName: string): Promise<boolean>;
|
|
43
|
+
export declare function resolveSdd(opts: ResolveSddOptions): Promise<ResolveOutcome>;
|
|
44
|
+
/** Default discovery root: the directory holding the code repository. */
|
|
45
|
+
export declare function defaultSearchRoots(codeRepo: string): string[];
|
|
46
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/lib/context-pull/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AAEpE,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAK/E;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GACrF;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACpE;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACtE;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,iFAAiF;IACjF,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,kEAAkE;AAClE,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS5F;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAkBjF;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7D"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-repo SDD-source resolution for `sdd-cli context pull` (M-ADR 0128 §1,
|
|
3
|
+
* M-ADR 0150 §4.4 Phase D).
|
|
4
|
+
*
|
|
5
|
+
* A code repository has no `.sdd-repo-kind`, no lock and no bundle, so nothing
|
|
6
|
+
* in it names the SDD that specifies it. The SDD names the code repository
|
|
7
|
+
* instead: every repository it owns is a row in its own
|
|
8
|
+
* `catalogues/repositories.csv`, keyed by id. Resolution is therefore a lookup
|
|
9
|
+
* in that direction: find the SDD whose catalogue lists this repository.
|
|
10
|
+
*
|
|
11
|
+
* Only the SDD's OWN catalogue counts, never `catalogues-aggregated/`: a
|
|
12
|
+
* platform root's aggregate lists every member's repositories too, so reading
|
|
13
|
+
* it would make every code repo resolve to two SDDs.
|
|
14
|
+
*/
|
|
15
|
+
import { access } from "node:fs/promises";
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
18
|
+
import { readCatalogueCsv } from "../catalogue/csv-reader.js";
|
|
19
|
+
import { discoverSddRepos } from "../list/discover.js";
|
|
20
|
+
import { readRepoKind } from "../repo-kind.js";
|
|
21
|
+
export const REPOSITORIES_CATALOGUE = "catalogues/repositories.csv";
|
|
22
|
+
/** The code repository's id: `--repo` when given, else its git top-level's directory name. */
|
|
23
|
+
export function resolveCodeRepoName(codeRepo, override) {
|
|
24
|
+
if (override !== undefined && override.trim() !== "")
|
|
25
|
+
return override.trim();
|
|
26
|
+
const top = spawnSync("git", ["-C", codeRepo, "rev-parse", "--show-toplevel"], { encoding: "utf8" });
|
|
27
|
+
if (top.status === 0 && top.stdout.trim() !== "")
|
|
28
|
+
return basename(top.stdout.trim());
|
|
29
|
+
return basename(resolve(codeRepo));
|
|
30
|
+
}
|
|
31
|
+
/** Does this SDD's own repositories catalogue list `repoName`? */
|
|
32
|
+
export async function catalogueListsRepo(sddRoot, repoName) {
|
|
33
|
+
const path = join(sddRoot, REPOSITORIES_CATALOGUE);
|
|
34
|
+
try {
|
|
35
|
+
await access(path);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const { rows } = await readCatalogueCsv(path);
|
|
41
|
+
return rows.some((r) => r["id"] === repoName);
|
|
42
|
+
}
|
|
43
|
+
export async function resolveSdd(opts) {
|
|
44
|
+
if (opts.sddPath !== undefined) {
|
|
45
|
+
const root = resolve(opts.sddPath);
|
|
46
|
+
if ((await readRepoKind(root)) === null)
|
|
47
|
+
return { kind: "not-an-sdd", path: root };
|
|
48
|
+
// An explicit --sdd is the caller's assertion, so an uncatalogued repository is reported
|
|
49
|
+
// (the caller may be wiring a repository the SDD has not catalogued yet), not refused.
|
|
50
|
+
return { kind: "resolved", sddRoot: root, catalogued: await catalogueListsRepo(root, opts.repoName) };
|
|
51
|
+
}
|
|
52
|
+
const self = resolve(opts.codeRepo);
|
|
53
|
+
const found = await discoverSddRepos(opts.searchRoots);
|
|
54
|
+
const searched = found.map((r) => r.path).filter((p) => resolve(p) !== self);
|
|
55
|
+
const matches = [];
|
|
56
|
+
for (const p of searched) {
|
|
57
|
+
if (await catalogueListsRepo(p, opts.repoName))
|
|
58
|
+
matches.push(p);
|
|
59
|
+
}
|
|
60
|
+
if (matches.length === 1)
|
|
61
|
+
return { kind: "resolved", sddRoot: matches[0], catalogued: true };
|
|
62
|
+
if (matches.length === 0)
|
|
63
|
+
return { kind: "not-found", searched };
|
|
64
|
+
return { kind: "ambiguous", candidates: matches };
|
|
65
|
+
}
|
|
66
|
+
/** Default discovery root: the directory holding the code repository. */
|
|
67
|
+
export function defaultSearchRoots(codeRepo) {
|
|
68
|
+
return [dirname(resolve(codeRepo))];
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/lib/context-pull/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,6BAA6B,CAAC;AAEpE,8FAA8F;AAC9F,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,QAAiB;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AO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/lib/init/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/lib/init/app.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAkBT;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CA8ET;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAGhD;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAsCrC"}
|
package/dist/lib/init/app.js
CHANGED
|
@@ -2,6 +2,7 @@ import { mkdir, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { buildMethodManagedServers, upsertMethodManagedServers, } from "../mcp-seed/index.js";
|
|
4
4
|
import { renderMethodValidationWorkflow, WORKFLOW_REL_PATH } from "./ci-workflow.js";
|
|
5
|
+
import { writeMethodValidationModule } from "../ci-binding/index.js";
|
|
5
6
|
export function renderAppPlatformDependencies(input) {
|
|
6
7
|
return ([
|
|
7
8
|
"# app-platform-dependencies.yaml",
|
|
@@ -116,6 +117,8 @@ export async function scaffoldAppProfile(input) {
|
|
|
116
117
|
filesWritten.push(".claude/settings.json");
|
|
117
118
|
await writeFileAt(join(input.targetRepo, WORKFLOW_REL_PATH), renderMethodValidationWorkflow("application"));
|
|
118
119
|
filesWritten.push(WORKFLOW_REL_PATH);
|
|
120
|
+
// The module the workflow calls (M-ADR 0219).
|
|
121
|
+
filesWritten.push(...(await writeMethodValidationModule(input.targetRepo)));
|
|
119
122
|
return { filesWritten };
|
|
120
123
|
}
|
|
121
124
|
async function writeFileAt(path, content) {
|
package/dist/lib/init/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/lib/init/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/lib/init/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAUrE,MAAM,UAAU,6BAA6B,CAAC,KAG7C;IACC,OAAO,CACL;QACE,kCAAkC;QAClC,GAAG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ation.yml
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* human-readable `orchestration/templates/ci/method-validation.yml.hbs`
|
|
7
|
-
* in sdd-method; the two must stay in lockstep.
|
|
2
|
+
* Renders .github/workflows/method-validation.yml: the GitHub Actions host wrapper (M-ADR 0219
|
|
3
|
+
* §4.4), which installs the pinned Dagger CLI and calls the Method Validation module. The job
|
|
4
|
+
* itself is defined once, in ../ci-binding/module.ts; the other hosts' wrappers are in
|
|
5
|
+
* ../ci-binding/index.ts.
|
|
8
6
|
*
|
|
9
7
|
* Output wraps a `# method-managed: begin` / `# method-managed: end`
|
|
10
8
|
* block-marker pair so the sync path can preserve adopter-authored
|
|
@@ -18,12 +16,12 @@ export declare const BLOCK_END = "# method-managed: end";
|
|
|
18
16
|
* Full file content (block + adopter-extension footer). Used by
|
|
19
17
|
* `sdd-cli init` to write a fresh workflow.
|
|
20
18
|
*/
|
|
21
|
-
export declare function renderMethodValidationWorkflow(profile: Profile): string;
|
|
19
|
+
export declare function renderMethodValidationWorkflow(profile: Profile, runner?: readonly string[]): string;
|
|
22
20
|
/**
|
|
23
21
|
* Method-managed slice only (begin marker through end marker). Used
|
|
24
22
|
* by `sdd-cli sync` as the `incomingBlock` argument to
|
|
25
23
|
* `writeMarkedBlockFile` so adopter content outside the markers is
|
|
26
24
|
* preserved verbatim.
|
|
27
25
|
*/
|
|
28
|
-
export declare function renderMethodManagedWorkflowBlock(profile: Profile): string;
|
|
26
|
+
export declare function renderMethodManagedWorkflowBlock(profile: Profile, runner?: readonly string[]): string;
|
|
29
27
|
//# sourceMappingURL=ci-workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../../src/lib/init/ci-workflow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../../src/lib/init/ci-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAI/C,eAAO,MAAM,iBAAiB,4CAA4C,CAAC;AAC3E,eAAO,MAAM,WAAW,4BAA4B,CAAC;AACrD,eAAO,MAAM,SAAS,0BAA0B,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAGnG;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAErG"}
|