@sdd-method/maintain-cli 0.1.0 → 0.3.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/NOTICE +1 -1
- package/README.md +1 -1
- package/dist/lib/agent-harness.js +17 -8
- package/dist/lib/briefing/index.js +1 -1
- package/dist/lib/briefing/render.js +17 -8
- package/dist/lib/catalogue/aggregate.js +6 -6
- package/dist/lib/catalogue/aggregation-manifest-loader.js +4 -4
- package/dist/lib/catalogue/build.js +1 -1
- package/dist/lib/catalogue/builders/c4-components.js +1 -1
- package/dist/lib/catalogue/builders/c4-containers.js +1 -1
- package/dist/lib/catalogue/builders/c4-l1-candidates.js +1 -1
- package/dist/lib/catalogue/builders/container-dependency.js +1 -1
- package/dist/lib/catalogue/builders/data-store-mapping.js +1 -1
- package/dist/lib/catalogue/builders/screen-tree.js +1 -1
- package/dist/lib/catalogue/contract-path-resolution.js +2 -2
- package/dist/lib/catalogue/dedupe-keyed-tables.js +0 -0
- package/dist/lib/catalogue/freshness.js +4 -3
- package/dist/lib/catalogue/scores-coverage.js +1 -1
- package/dist/lib/catalogue/service-contract-aliases-loader.js +1 -1
- package/dist/lib/ci-binding/index.js +44 -5
- package/dist/lib/ci-binding/module.js +74 -2
- package/dist/lib/context-pull/index.js +79 -39
- package/dist/lib/context-pull/retired-mcp-setup.js +7 -0
- package/dist/lib/hooks-seed/entries.js +55 -4
- package/dist/lib/hooks-seed/index.js +4 -7
- package/dist/lib/hooks-seed/merge.js +31 -0
- package/dist/lib/init/ci-workflow.js +26 -2
- package/dist/lib/lock-file.js +10 -0
- package/dist/lib/pack/builder.js +56 -4
- package/dist/lib/pack/index.js +1 -0
- package/dist/lib/pack/publish-transform.js +1 -1
- package/dist/lib/sync/briefing-merge.js +50 -34
- package/dist/lib/sync/diff.js +1 -1
- package/dist/lib/sync/index.js +46 -72
- package/dist/lib/sync/settings-merge.js +71 -163
- package/dist/lib/validate/plan.js +6 -3
- package/dist/maintain-program.js +6 -3
- package/dist/maintain-version.json +2 -2
- package/dist/verbs/catalogue-check.js +28 -0
- package/dist/verbs/context.js +1 -1
- package/dist/verbs/pack-build.js +22 -0
- package/dist/verbs/sync.js +17 -0
- package/dist/verbs/validate.js +6 -1
- package/dist/verify-program.js +2 -2
- package/dist/verify-version.json +2 -2
- package/package.json +2 -6
- package/dist/lib/hooks-seed/copilot.js +0 -167
- package/dist/lib/hooks-seed/lifecycle-mapping.js +0 -28
- package/dist/lib/mcp-seed/entries.js +0 -14
- package/dist/lib/mcp-seed/index.js +0 -28
- package/dist/lib/mcp-seed/merge.js +0 -99
- package/dist/lib/mcp-seed/types.js +0 -13
- package/dist/lib/sync/copilot-hooks-merge.js +0 -108
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `.github/hooks/*.json` merge pass during `sdd-cli sync` when the
|
|
3
|
-
* adopter opted into `--agent-harness github-copilot-cli`.
|
|
4
|
-
*
|
|
5
|
-
* Method-managed event entries are sentinel-tagged via their
|
|
6
|
-
* `command.bash` / `command.powershell` strings. Adopter-added events
|
|
7
|
-
* in the same `events[]` array survive sync. Drift inside a method-
|
|
8
|
-
* managed event refuses without `--allow-overwrite`, symmetric to the
|
|
9
|
-
* Claude Code settings-merge path.
|
|
10
|
-
*/
|
|
11
|
-
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
12
|
-
import { dirname, join } from "node:path";
|
|
13
|
-
import { buildMethodManagedCopilotHooks, detectCopilotHookDrift, upsertCopilotHookFile, } from "../hooks-seed/copilot.js";
|
|
14
|
-
export async function syncMethodManagedCopilotHooks(opts) {
|
|
15
|
-
const surface = buildMethodManagedCopilotHooks();
|
|
16
|
-
const entries = Object.entries(surface);
|
|
17
|
-
// First pass: detect drift across all files. If any drifted file
|
|
18
|
-
// would be refused (no --allow-overwrite), we refuse the whole
|
|
19
|
-
// merge without writing — same all-or-nothing posture as the
|
|
20
|
-
// Claude Code settings merge.
|
|
21
|
-
const reads = [];
|
|
22
|
-
for (const [portableClass, { filePath, events }] of entries) {
|
|
23
|
-
const absPath = join(opts.targetRepo, filePath);
|
|
24
|
-
const existing = await readHookFile(absPath);
|
|
25
|
-
const drifted = detectCopilotHookDrift(existing, events);
|
|
26
|
-
reads.push({
|
|
27
|
-
portableClass,
|
|
28
|
-
relPath: filePath,
|
|
29
|
-
absPath,
|
|
30
|
-
existing,
|
|
31
|
-
owned: events,
|
|
32
|
-
drifted,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
const driftedFiles = reads.filter((r) => r.drifted).map((r) => r.relPath);
|
|
36
|
-
if (driftedFiles.length > 0 && !opts.allowOverwrite) {
|
|
37
|
-
return {
|
|
38
|
-
files: reads.map((r) => ({
|
|
39
|
-
relPath: r.relPath,
|
|
40
|
-
portableClass: r.portableClass,
|
|
41
|
-
drifted: r.drifted,
|
|
42
|
-
wrote: false,
|
|
43
|
-
})),
|
|
44
|
-
driftedRefused: driftedFiles,
|
|
45
|
-
refused: true,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
if (opts.checkOnly) {
|
|
49
|
-
return {
|
|
50
|
-
files: reads.map((r) => ({
|
|
51
|
-
relPath: r.relPath,
|
|
52
|
-
portableClass: r.portableClass,
|
|
53
|
-
drifted: r.drifted,
|
|
54
|
-
wrote: false,
|
|
55
|
-
})),
|
|
56
|
-
driftedRefused: [],
|
|
57
|
-
refused: false,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// Second pass: upsert + write.
|
|
61
|
-
const fileResults = [];
|
|
62
|
-
for (const r of reads) {
|
|
63
|
-
const merge = upsertCopilotHookFile(r.existing, r.owned);
|
|
64
|
-
let wrote = false;
|
|
65
|
-
if (merge.changed || r.existing === null) {
|
|
66
|
-
await mkdir(dirname(r.absPath), { recursive: true });
|
|
67
|
-
await writeFile(r.absPath, JSON.stringify(merge.file, null, 2) + "\n", "utf8");
|
|
68
|
-
wrote = true;
|
|
69
|
-
}
|
|
70
|
-
fileResults.push({
|
|
71
|
-
relPath: r.relPath,
|
|
72
|
-
portableClass: r.portableClass,
|
|
73
|
-
drifted: r.drifted,
|
|
74
|
-
wrote,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return { files: fileResults, driftedRefused: [], refused: false };
|
|
78
|
-
}
|
|
79
|
-
async function readHookFile(absPath) {
|
|
80
|
-
if (!(await fileExists(absPath)))
|
|
81
|
-
return null;
|
|
82
|
-
const raw = await readFile(absPath, "utf8");
|
|
83
|
-
if (raw.trim().length === 0)
|
|
84
|
-
return null;
|
|
85
|
-
try {
|
|
86
|
-
const parsed = JSON.parse(raw);
|
|
87
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
88
|
-
const obj = parsed;
|
|
89
|
-
if (Array.isArray(obj["events"])) {
|
|
90
|
-
return obj;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
/* fall through — treat malformed as empty so the next write reseats it */
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
async function fileExists(path) {
|
|
100
|
-
try {
|
|
101
|
-
await access(path);
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=copilot-hooks-merge.js.map
|