@skillcap/gdh 0.5.0 → 0.6.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/INSTALL-BUNDLE.json +1 -1
- package/README.md +53 -90
- package/node_modules/@gdh/adapters/dist/claude-settings-patch.d.ts +74 -0
- package/node_modules/@gdh/adapters/dist/claude-settings-patch.d.ts.map +1 -0
- package/node_modules/@gdh/adapters/dist/claude-settings-patch.js +158 -0
- package/node_modules/@gdh/adapters/dist/claude-settings-patch.js.map +1 -0
- package/node_modules/@gdh/adapters/dist/claude-statusline-render.d.ts +51 -0
- package/node_modules/@gdh/adapters/dist/claude-statusline-render.d.ts.map +1 -0
- package/node_modules/@gdh/adapters/dist/claude-statusline-render.js +80 -0
- package/node_modules/@gdh/adapters/dist/claude-statusline-render.js.map +1 -0
- package/node_modules/@gdh/adapters/dist/claude-update-hook-render.d.ts +35 -0
- package/node_modules/@gdh/adapters/dist/claude-update-hook-render.d.ts.map +1 -0
- package/node_modules/@gdh/adapters/dist/claude-update-hook-render.js +76 -0
- package/node_modules/@gdh/adapters/dist/claude-update-hook-render.js.map +1 -0
- package/node_modules/@gdh/adapters/dist/claude-update-worker-render.d.ts +28 -0
- package/node_modules/@gdh/adapters/dist/claude-update-worker-render.d.ts.map +1 -0
- package/node_modules/@gdh/adapters/dist/claude-update-worker-render.js +99 -0
- package/node_modules/@gdh/adapters/dist/claude-update-worker-render.js.map +1 -0
- package/node_modules/@gdh/adapters/dist/index.d.ts +9 -0
- package/node_modules/@gdh/adapters/dist/index.d.ts.map +1 -1
- package/node_modules/@gdh/adapters/dist/index.js +224 -2
- package/node_modules/@gdh/adapters/dist/index.js.map +1 -1
- package/node_modules/@gdh/adapters/dist/self-update-mechanics.d.ts +51 -0
- package/node_modules/@gdh/adapters/dist/self-update-mechanics.d.ts.map +1 -0
- package/node_modules/@gdh/adapters/dist/self-update-mechanics.js +155 -0
- package/node_modules/@gdh/adapters/dist/self-update-mechanics.js.map +1 -0
- package/node_modules/@gdh/adapters/package.json +8 -8
- package/node_modules/@gdh/authoring/dist/index.d.ts +1 -0
- package/node_modules/@gdh/authoring/dist/index.d.ts.map +1 -1
- package/node_modules/@gdh/authoring/dist/index.js +1 -0
- package/node_modules/@gdh/authoring/dist/index.js.map +1 -1
- package/node_modules/@gdh/authoring/dist/writePinnedVersion.d.ts +17 -0
- package/node_modules/@gdh/authoring/dist/writePinnedVersion.d.ts.map +1 -0
- package/node_modules/@gdh/authoring/dist/writePinnedVersion.js +50 -0
- package/node_modules/@gdh/authoring/dist/writePinnedVersion.js.map +1 -0
- package/node_modules/@gdh/authoring/package.json +5 -2
- package/node_modules/@gdh/cli/dist/index.d.ts +15 -0
- package/node_modules/@gdh/cli/dist/index.d.ts.map +1 -1
- package/node_modules/@gdh/cli/dist/index.js +68 -8
- package/node_modules/@gdh/cli/dist/index.js.map +1 -1
- package/node_modules/@gdh/cli/dist/self-update.d.ts +3 -0
- package/node_modules/@gdh/cli/dist/self-update.d.ts.map +1 -0
- package/node_modules/@gdh/cli/dist/self-update.js +235 -0
- package/node_modules/@gdh/cli/dist/self-update.js.map +1 -0
- package/node_modules/@gdh/cli/dist/update-banner.d.ts +42 -0
- package/node_modules/@gdh/cli/dist/update-banner.d.ts.map +1 -0
- package/node_modules/@gdh/cli/dist/update-banner.js +49 -0
- package/node_modules/@gdh/cli/dist/update-banner.js.map +1 -0
- package/node_modules/@gdh/cli/package.json +10 -10
- package/node_modules/@gdh/core/dist/dev-mode.d.ts +13 -0
- package/node_modules/@gdh/core/dist/dev-mode.d.ts.map +1 -0
- package/node_modules/@gdh/core/dist/dev-mode.js +21 -0
- package/node_modules/@gdh/core/dist/dev-mode.js.map +1 -0
- package/node_modules/@gdh/core/dist/index.d.ts +8 -2
- package/node_modules/@gdh/core/dist/index.d.ts.map +1 -1
- package/node_modules/@gdh/core/dist/index.js +8 -0
- package/node_modules/@gdh/core/dist/index.js.map +1 -1
- package/node_modules/@gdh/core/dist/update-cache.d.ts +46 -0
- package/node_modules/@gdh/core/dist/update-cache.d.ts.map +1 -0
- package/node_modules/@gdh/core/dist/update-cache.js +90 -0
- package/node_modules/@gdh/core/dist/update-cache.js.map +1 -0
- package/node_modules/@gdh/core/dist/update-probe.d.ts +102 -0
- package/node_modules/@gdh/core/dist/update-probe.d.ts.map +1 -0
- package/node_modules/@gdh/core/dist/update-probe.js +195 -0
- package/node_modules/@gdh/core/dist/update-probe.js.map +1 -0
- package/node_modules/@gdh/core/package.json +1 -1
- package/node_modules/@gdh/docs/package.json +2 -2
- package/node_modules/@gdh/mcp/dist/index.d.ts +20 -0
- package/node_modules/@gdh/mcp/dist/index.d.ts.map +1 -1
- package/node_modules/@gdh/mcp/dist/index.js +39 -2
- package/node_modules/@gdh/mcp/dist/index.js.map +1 -1
- package/node_modules/@gdh/mcp/package.json +8 -8
- package/node_modules/@gdh/observability/dist/guidance-audit.js +2 -1
- package/node_modules/@gdh/observability/dist/guidance-audit.js.map +1 -1
- package/node_modules/@gdh/observability/package.json +2 -2
- package/node_modules/@gdh/runtime/package.json +2 -2
- package/node_modules/@gdh/scan/package.json +3 -3
- package/node_modules/@gdh/verify/package.json +7 -7
- package/package.json +11 -11
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { GDH_UPDATE_HOOK_VERSION } from "@gdh/core";
|
|
2
|
+
/**
|
|
3
|
+
* Relative path of the managed Claude SessionStart parent hook script.
|
|
4
|
+
* This is the .js file Claude Code invokes when a session opens on a
|
|
5
|
+
* GDH-managed target; it spawns the worker that refreshes the update cache.
|
|
6
|
+
*/
|
|
7
|
+
export const CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH = ".claude/hooks/gdh-check-update.js";
|
|
8
|
+
/**
|
|
9
|
+
* Relative path of the managed Claude background worker script the parent
|
|
10
|
+
* hook spawns. The worker performs the HTTPS probe and writes the cache.
|
|
11
|
+
*/
|
|
12
|
+
export const CLAUDE_CHECK_UPDATE_WORKER_RELATIVE_PATH = ".claude/hooks/gdh-check-update-worker.js";
|
|
13
|
+
/**
|
|
14
|
+
* Render the Claude SessionStart parent hook source that will be baked into
|
|
15
|
+
* a managed Claude target at the given pinned GDH version.
|
|
16
|
+
*
|
|
17
|
+
* The returned string is written verbatim to
|
|
18
|
+
* `.claude/hooks/gdh-check-update.js` by the adapter install pipeline.
|
|
19
|
+
*
|
|
20
|
+
* Invariants enforced by this renderer (see 11-02-PLAN):
|
|
21
|
+
* - shebang on line 1; a hook-version marker on line 2 for drift detection
|
|
22
|
+
* - dev-mode short-circuit on GDH_DEV_REPO runs BEFORE spawn()
|
|
23
|
+
* - spawn uses detached:true + child.unref() + windowsHide:true + stdio:'ignore'
|
|
24
|
+
* - pinned version flows to the worker via GDH_PINNED_VERSION env var
|
|
25
|
+
* - cache file path flows to the worker via GDH_CACHE_FILE env var
|
|
26
|
+
* - cache dir (~/.cache/gdh/) is created with fs.mkdirSync recursive:true
|
|
27
|
+
*
|
|
28
|
+
* The body wraps everything after the requires in an IIFE so `return` exits
|
|
29
|
+
* cleanly (Node's CommonJS module body does not allow top-level return).
|
|
30
|
+
*
|
|
31
|
+
* The baked script is deliberately dependency-free — it imports only Node
|
|
32
|
+
* built-ins and does NOT resolve @gdh/core at runtime. Every string in the
|
|
33
|
+
* output is literal JavaScript.
|
|
34
|
+
*/
|
|
35
|
+
export function renderClaudeCheckUpdateHook(pinnedVersion) {
|
|
36
|
+
return [
|
|
37
|
+
"#!/usr/bin/env node",
|
|
38
|
+
`// gdh-hook-version: ${GDH_UPDATE_HOOK_VERSION}`,
|
|
39
|
+
"// Check for GDH updates in background, write result to cache.",
|
|
40
|
+
"// Called by Claude Code SessionStart hook — runs once per session.",
|
|
41
|
+
"// Baked by @gdh/adapters at the pinned gdh_version — regenerated by gdh self-update.",
|
|
42
|
+
"",
|
|
43
|
+
"const fs = require('fs');",
|
|
44
|
+
"const path = require('path');",
|
|
45
|
+
"const os = require('os');",
|
|
46
|
+
"const { spawn } = require('child_process');",
|
|
47
|
+
"",
|
|
48
|
+
"(function () {",
|
|
49
|
+
" // Dev-mode short-circuit: contributors running from source must never see an update signal.",
|
|
50
|
+
" // (Baked script cannot read .gdh-state/local-paths.json without @gdh/core; env var covers the contributor case.)",
|
|
51
|
+
" if (process.env.GDH_DEV_REPO && process.env.GDH_DEV_REPO.trim()) return;",
|
|
52
|
+
"",
|
|
53
|
+
" const homeDir = os.homedir();",
|
|
54
|
+
" const cacheDir = path.join(homeDir, '.cache', 'gdh');",
|
|
55
|
+
" const cacheFile = path.join(cacheDir, 'update-check.json');",
|
|
56
|
+
"",
|
|
57
|
+
" try { fs.mkdirSync(cacheDir, { recursive: true }); } catch (e) {}",
|
|
58
|
+
"",
|
|
59
|
+
" const workerPath = path.join(__dirname, 'gdh-check-update-worker.js');",
|
|
60
|
+
" const child = spawn(process.execPath, [workerPath], {",
|
|
61
|
+
" stdio: 'ignore',",
|
|
62
|
+
" windowsHide: true,",
|
|
63
|
+
" detached: true,",
|
|
64
|
+
" env: {",
|
|
65
|
+
" ...process.env,",
|
|
66
|
+
" GDH_CACHE_FILE: cacheFile,",
|
|
67
|
+
` GDH_PINNED_VERSION: ${JSON.stringify(pinnedVersion)},`,
|
|
68
|
+
" },",
|
|
69
|
+
" });",
|
|
70
|
+
"",
|
|
71
|
+
" child.unref();",
|
|
72
|
+
"})();",
|
|
73
|
+
"",
|
|
74
|
+
].join("\n");
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=claude-update-hook-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-update-hook-render.js","sourceRoot":"","sources":["../src/claude-update-hook-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GACjD,mCAAmC,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,wCAAwC,GACnD,0CAA0C,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,2BAA2B,CAAC,aAAqB;IAC/D,OAAO;QACL,qBAAqB;QACrB,wBAAwB,uBAAuB,EAAE;QACjD,gEAAgE;QAChE,qEAAqE;QACrE,uFAAuF;QACvF,EAAE;QACF,2BAA2B;QAC3B,+BAA+B;QAC/B,2BAA2B;QAC3B,6CAA6C;QAC7C,EAAE;QACF,gBAAgB;QAChB,gGAAgG;QAChG,qHAAqH;QACrH,4EAA4E;QAC5E,EAAE;QACF,iCAAiC;QACjC,yDAAyD;QACzD,+DAA+D;QAC/D,EAAE;QACF,qEAAqE;QACrE,EAAE;QACF,0EAA0E;QAC1E,yDAAyD;QACzD,sBAAsB;QACtB,wBAAwB;QACxB,qBAAqB;QACrB,YAAY;QACZ,uBAAuB;QACvB,kCAAkC;QAClC,6BAA6B,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG;QAC7D,QAAQ;QACR,OAAO;QACP,EAAE;QACF,kBAAkB;QAClB,OAAO;QACP,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render the background worker source that is spawned (detached + unref) by
|
|
3
|
+
* the SessionStart parent hook. The worker performs the HTTPS probe against
|
|
4
|
+
* the npm registry and writes the result to the shared per-user cache.
|
|
5
|
+
*
|
|
6
|
+
* The `pinnedVersion` parameter is accepted for API uniformity with
|
|
7
|
+
* `renderClaudeCheckUpdateHook`; the worker body itself reads the pinned
|
|
8
|
+
* version from `process.env.GDH_PINNED_VERSION` so that future regenerations
|
|
9
|
+
* only need to rewrite the parent hook's env injection.
|
|
10
|
+
*
|
|
11
|
+
* The returned string is written verbatim to
|
|
12
|
+
* `.claude/hooks/gdh-check-update-worker.js` by the adapter install pipeline.
|
|
13
|
+
*
|
|
14
|
+
* Invariants enforced by this renderer (see 11-02-PLAN):
|
|
15
|
+
* - shebang on line 1; a hook-version marker on line 2 for drift detection
|
|
16
|
+
* - dev-mode short-circuit on GDH_DEV_REPO runs at top of IIFE
|
|
17
|
+
* - no-pinned fallback uses the exact literal `if (!pinned) return;`
|
|
18
|
+
* - native fetch + AbortSignal.timeout(10000) — no npm shellout, no external deps
|
|
19
|
+
* - all I/O + parse + network wrapped in try/catch (silent-failure D-06)
|
|
20
|
+
* - no stale_hooks scan (GSD-specific; drift detection is `gdh verify drift`)
|
|
21
|
+
* - result object shape matches UpdateCheckCacheEntry from @gdh/core
|
|
22
|
+
*
|
|
23
|
+
* The baked script is deliberately dependency-free — it imports only Node
|
|
24
|
+
* built-ins and does NOT resolve @gdh/core at runtime. The semver compare
|
|
25
|
+
* (`isNewer`) is inlined verbatim from the GSD worker pattern.
|
|
26
|
+
*/
|
|
27
|
+
export declare function renderClaudeCheckUpdateWorker(_pinnedVersion?: string): string;
|
|
28
|
+
//# sourceMappingURL=claude-update-worker-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-update-worker-render.d.ts","sourceRoot":"","sources":["../src/claude-update-worker-render.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,6BAA6B,CAC3C,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,CAsER"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { GDH_UPDATE_HOOK_VERSION, GDH_UPDATE_REGISTRY_URL, } from "@gdh/core";
|
|
2
|
+
/**
|
|
3
|
+
* Render the background worker source that is spawned (detached + unref) by
|
|
4
|
+
* the SessionStart parent hook. The worker performs the HTTPS probe against
|
|
5
|
+
* the npm registry and writes the result to the shared per-user cache.
|
|
6
|
+
*
|
|
7
|
+
* The `pinnedVersion` parameter is accepted for API uniformity with
|
|
8
|
+
* `renderClaudeCheckUpdateHook`; the worker body itself reads the pinned
|
|
9
|
+
* version from `process.env.GDH_PINNED_VERSION` so that future regenerations
|
|
10
|
+
* only need to rewrite the parent hook's env injection.
|
|
11
|
+
*
|
|
12
|
+
* The returned string is written verbatim to
|
|
13
|
+
* `.claude/hooks/gdh-check-update-worker.js` by the adapter install pipeline.
|
|
14
|
+
*
|
|
15
|
+
* Invariants enforced by this renderer (see 11-02-PLAN):
|
|
16
|
+
* - shebang on line 1; a hook-version marker on line 2 for drift detection
|
|
17
|
+
* - dev-mode short-circuit on GDH_DEV_REPO runs at top of IIFE
|
|
18
|
+
* - no-pinned fallback uses the exact literal `if (!pinned) return;`
|
|
19
|
+
* - native fetch + AbortSignal.timeout(10000) — no npm shellout, no external deps
|
|
20
|
+
* - all I/O + parse + network wrapped in try/catch (silent-failure D-06)
|
|
21
|
+
* - no stale_hooks scan (GSD-specific; drift detection is `gdh verify drift`)
|
|
22
|
+
* - result object shape matches UpdateCheckCacheEntry from @gdh/core
|
|
23
|
+
*
|
|
24
|
+
* The baked script is deliberately dependency-free — it imports only Node
|
|
25
|
+
* built-ins and does NOT resolve @gdh/core at runtime. The semver compare
|
|
26
|
+
* (`isNewer`) is inlined verbatim from the GSD worker pattern.
|
|
27
|
+
*/
|
|
28
|
+
export function renderClaudeCheckUpdateWorker(_pinnedVersion) {
|
|
29
|
+
// _pinnedVersion is accepted for API uniformity with the hook renderer;
|
|
30
|
+
// the worker body itself reads process.env.GDH_PINNED_VERSION at runtime.
|
|
31
|
+
return [
|
|
32
|
+
"#!/usr/bin/env node",
|
|
33
|
+
`// gdh-hook-version: ${GDH_UPDATE_HOOK_VERSION}`,
|
|
34
|
+
"// Background worker spawned by the GDH SessionStart parent hook.",
|
|
35
|
+
"// Probes https://registry.npmjs.org/@skillcap/gdh/latest and writes the",
|
|
36
|
+
"// result to the per-user cache at ~/.cache/gdh/update-check.json.",
|
|
37
|
+
"// Exits silently on any failure — D-06 silent-failure contract.",
|
|
38
|
+
"",
|
|
39
|
+
"'use strict';",
|
|
40
|
+
"",
|
|
41
|
+
"const fs = require('fs');",
|
|
42
|
+
"",
|
|
43
|
+
"// Compare semver: true if a is strictly newer than b.",
|
|
44
|
+
"// Strips pre-release suffixes (e.g. '3-beta.1' → '3') to avoid NaN from Number().",
|
|
45
|
+
"function isNewer(a, b) {",
|
|
46
|
+
" const pa = (a || '').split('.').map(s => Number(s.replace(/-.*/, '')) || 0);",
|
|
47
|
+
" const pb = (b || '').split('.').map(s => Number(s.replace(/-.*/, '')) || 0);",
|
|
48
|
+
" for (let i = 0; i < 3; i++) {",
|
|
49
|
+
" if (pa[i] > pb[i]) return true;",
|
|
50
|
+
" if (pa[i] < pb[i]) return false;",
|
|
51
|
+
" }",
|
|
52
|
+
" return false;",
|
|
53
|
+
"}",
|
|
54
|
+
"",
|
|
55
|
+
"(async () => {",
|
|
56
|
+
" // Dev-mode short-circuit: contributors running from source must never see an update signal.",
|
|
57
|
+
" // (Baked worker checks ONLY the env var — cannot read local-paths.json without @gdh/core.)",
|
|
58
|
+
" if (process.env.GDH_DEV_REPO && process.env.GDH_DEV_REPO.trim()) return;",
|
|
59
|
+
"",
|
|
60
|
+
" const pinned = process.env.GDH_PINNED_VERSION;",
|
|
61
|
+
" if (!pinned) return;",
|
|
62
|
+
"",
|
|
63
|
+
" const cacheFile = process.env.GDH_CACHE_FILE;",
|
|
64
|
+
" if (!cacheFile) return;",
|
|
65
|
+
"",
|
|
66
|
+
" let res = null;",
|
|
67
|
+
" try {",
|
|
68
|
+
` res = await fetch(${JSON.stringify(GDH_UPDATE_REGISTRY_URL)}, {`,
|
|
69
|
+
" signal: AbortSignal.timeout(10000),",
|
|
70
|
+
" });",
|
|
71
|
+
" } catch (e) {}",
|
|
72
|
+
"",
|
|
73
|
+
" let latest = null;",
|
|
74
|
+
" if (res && res.ok) {",
|
|
75
|
+
" try {",
|
|
76
|
+
" const body = await res.json();",
|
|
77
|
+
" if (typeof body.version === 'string') {",
|
|
78
|
+
" latest = body.version;",
|
|
79
|
+
" }",
|
|
80
|
+
" } catch (e) {}",
|
|
81
|
+
" }",
|
|
82
|
+
"",
|
|
83
|
+
" // Offline / registry 5xx / parse error — write nothing per D-06.",
|
|
84
|
+
" if (latest === null) return;",
|
|
85
|
+
"",
|
|
86
|
+
" const result = {",
|
|
87
|
+
" pinned,",
|
|
88
|
+
" latest,",
|
|
89
|
+
" checkedAt: new Date().toISOString(),",
|
|
90
|
+
" source: 'npm-registry-latest',",
|
|
91
|
+
" updateAvailable: isNewer(latest, pinned),",
|
|
92
|
+
" };",
|
|
93
|
+
"",
|
|
94
|
+
" try { fs.writeFileSync(cacheFile, JSON.stringify(result, null, 2)); } catch (e) {}",
|
|
95
|
+
"})();",
|
|
96
|
+
"",
|
|
97
|
+
].join("\n");
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=claude-update-worker-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-update-worker-render.js","sourceRoot":"","sources":["../src/claude-update-worker-render.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,cAAuB;IAEvB,wEAAwE;IACxE,0EAA0E;IAC1E,OAAO;QACL,qBAAqB;QACrB,wBAAwB,uBAAuB,EAAE;QACjD,mEAAmE;QACnE,0EAA0E;QAC1E,oEAAoE;QACpE,kEAAkE;QAClE,EAAE;QACF,eAAe;QACf,EAAE;QACF,2BAA2B;QAC3B,EAAE;QACF,wDAAwD;QACxD,oFAAoF;QACpF,0BAA0B;QAC1B,gFAAgF;QAChF,gFAAgF;QAChF,iCAAiC;QACjC,qCAAqC;QACrC,sCAAsC;QACtC,KAAK;QACL,iBAAiB;QACjB,GAAG;QACH,EAAE;QACF,gBAAgB;QAChB,gGAAgG;QAChG,+FAA+F;QAC/F,4EAA4E;QAC5E,EAAE;QACF,kDAAkD;QAClD,wBAAwB;QACxB,EAAE;QACF,iDAAiD;QACjD,2BAA2B;QAC3B,EAAE;QACF,mBAAmB;QACnB,SAAS;QACT,yBAAyB,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK;QACrE,2CAA2C;QAC3C,SAAS;QACT,kBAAkB;QAClB,EAAE;QACF,sBAAsB;QACtB,wBAAwB;QACxB,WAAW;QACX,sCAAsC;QACtC,+CAA+C;QAC/C,gCAAgC;QAChC,SAAS;QACT,oBAAoB;QACpB,KAAK;QACL,EAAE;QACF,qEAAqE;QACrE,gCAAgC;QAChC,EAAE;QACF,oBAAoB;QACpB,aAAa;QACb,aAAa;QACb,0CAA0C;QAC1C,oCAAoC;QACpC,+CAA+C;QAC/C,MAAM;QACN,EAAE;QACF,sFAAsF;QACtF,OAAO;QACP,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -23,6 +23,9 @@ export declare const CURSOR_MIGRATE_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-mi
|
|
|
23
23
|
export declare const CURSOR_CHECK_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-check/SKILL.md";
|
|
24
24
|
export declare const CURSOR_PREPARE_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-prepare/SKILL.md";
|
|
25
25
|
export declare const CURSOR_VERIFY_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-verify/SKILL.md";
|
|
26
|
+
export declare const CLAUDE_UPDATE_COMMAND_RELATIVE_PATH = ".claude/commands/gdh/update.md";
|
|
27
|
+
export declare const CODEX_UPDATE_SKILL_RELATIVE_PATH = ".codex/skills/gdh-update/SKILL.md";
|
|
28
|
+
export declare const CURSOR_UPDATE_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-update/SKILL.md";
|
|
26
29
|
export declare const CLAUDE_SCAN_COMMAND_RELATIVE_PATH = ".claude/commands/gdh/scan.md";
|
|
27
30
|
export declare const CODEX_SCAN_SKILL_RELATIVE_PATH = ".codex/skills/gdh-scan/SKILL.md";
|
|
28
31
|
export declare const CURSOR_SCAN_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-scan/SKILL.md";
|
|
@@ -60,6 +63,9 @@ export declare function renderCursorScanSkill(pinnedVersion: string): string;
|
|
|
60
63
|
export declare function renderClaudeMigrateCommand(pinnedVersion: string): string;
|
|
61
64
|
export declare function renderCodexMigrateSkill(pinnedVersion: string): string;
|
|
62
65
|
export declare function renderCursorMigrateSkill(pinnedVersion: string): string;
|
|
66
|
+
export declare function renderClaudeUpdateCommand(_pinnedVersion: string): string;
|
|
67
|
+
export declare function renderCodexUpdateSkill(_pinnedVersion: string): string;
|
|
68
|
+
export declare function renderCursorUpdateSkill(_pinnedVersion: string): string;
|
|
63
69
|
export declare function renderClaudeCheckCommand(pinnedVersion: string): string;
|
|
64
70
|
export declare function renderCodexCheckSkill(pinnedVersion: string): string;
|
|
65
71
|
export declare function renderCursorCheckSkill(pinnedVersion: string): string;
|
|
@@ -70,4 +76,7 @@ export declare function renderClaudeVerifyCommand(pinnedVersion: string): string
|
|
|
70
76
|
export declare function renderCodexVerifySkill(pinnedVersion: string): string;
|
|
71
77
|
export declare function renderCursorVerifySkill(pinnedVersion: string): string;
|
|
72
78
|
export declare function renderManagedMcpLauncher(pinnedVersion: string): string;
|
|
79
|
+
export { bumpAndRebakePin, type BumpAndRebakePinResult, } from "./self-update-mechanics.js";
|
|
80
|
+
export { CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH } from "./claude-update-hook-render.js";
|
|
81
|
+
export { CLAUDE_STATUSLINE_RELATIVE_PATH } from "./claude-statusline-render.js";
|
|
73
82
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8BA,OAAO,EAgBL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,cAAc,EAGnB,KAAK,sCAAsC,EAK3C,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,WAAW,CAAC;AAWnB,eAAO,MAAM,eAAe,wCAc1B,CAAC;AAEH,eAAO,MAAM,gBAAgB,wCAAgF,CAAC;AAC9G,eAAO,MAAM,yBAAyB,cAAc,CAAC;AACrD,eAAO,MAAM,oCAAoC,oCAAoC,CAAC;AACtF,eAAO,MAAM,yBAAyB,cAAc,CAAC;AACrD,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAC3D,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AACvE,eAAO,MAAM,kCAAkC,wCAAwC,CAAC;AACxF,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AACtF,eAAO,MAAM,mCAAmC,mCAAmC,CAAC;AACpF,eAAO,MAAM,oCAAoC,oCAAoC,CAAC;AACtF,eAAO,MAAM,kCAAkC,kCAAkC,CAAC;AAClF,eAAO,MAAM,oCAAoC,oCAAoC,CAAC;AACtF,eAAO,MAAM,mCAAmC,mCAAmC,CAAC;AACpF,eAAO,MAAM,gCAAgC,sCAAsC,CAAC;AACpF,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AACtF,eAAO,MAAM,+BAA+B,qCAAqC,CAAC;AAClF,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AACtF,eAAO,MAAM,gCAAgC,sCAAsC,CAAC;AACpF,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AACtF,eAAO,MAAM,kCAAkC,wCAAwC,CAAC;AACxF,eAAO,MAAM,gCAAgC,sCAAsC,CAAC;AACpF,eAAO,MAAM,kCAAkC,wCAAwC,CAAC;AACxF,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AAOtF,eAAO,MAAM,mCAAmC,mCAAmC,CAAC;AACpF,eAAO,MAAM,gCAAgC,sCAAsC,CAAC;AACpF,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AACtF,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAChF,eAAO,MAAM,8BAA8B,oCAAoC,CAAC;AAChF,eAAO,MAAM,+BAA+B,qCAAqC,CAAC;AAClF,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAC5E,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AACjE,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAIzC,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IACP,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC,GACL,OAAO,CAAC,4BAA4B,CAAC,CA0BvC;AAED,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IACP,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC/C,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC9B,GACL,OAAO,CAAC,6BAA6B,CAAC,CAgFxC;AAED,wBAAsB,oCAAoC,CACxD,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,sCAAsC,CAAC,CAmEjD;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAS1B;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IACP,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC9C,GACL,OAAO,CAAC,cAAc,CAAC,CAqFzB;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAczC;AAED,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAqCxE;AAED,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA+CrE;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA6CtE;AAID,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAgCvE;AAED,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAwCpE;AAED,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAsCrE;AAID,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA8BrE;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAuClE;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAqCnE;AAID,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAgCxE;AAED,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAuCrE;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAqCtE;AA0BD,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CA+BxE;AAED,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAoCrE;AAED,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAkCtE;AAID,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA+BtE;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAuCnE;AAED,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAqCpE;AAID,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAiCxE;AAED,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAwCrE;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAsCtE;AAID,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAgCvE;AAED,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAwCpE;AAED,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAsCrE;AAokDD,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA+CtE;AAi3CD,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sCAAsC,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -5,6 +5,10 @@ import os from "node:os";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { readProjectConfig, resolvePinnedVersion, resolvePinnedVersionOrNull, resolveProjectRoot, readWorktreeState, resolveAuthoringStatus, } from "@gdh/authoring";
|
|
8
|
+
import { CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH, CLAUDE_CHECK_UPDATE_WORKER_RELATIVE_PATH, renderClaudeCheckUpdateHook, } from "./claude-update-hook-render.js";
|
|
9
|
+
import { renderClaudeCheckUpdateWorker } from "./claude-update-worker-render.js";
|
|
10
|
+
import { CLAUDE_STATUSLINE_RELATIVE_PATH, renderClaudeUpdateStatusline, } from "./claude-statusline-render.js";
|
|
11
|
+
import { CLAUDE_SETTINGS_RELATIVE_PATH, patchClaudeSettingsForGdhSessionStart, patchClaudeSettingsForGdhStatusline, } from "./claude-settings-patch.js";
|
|
8
12
|
import { GDH_AGENT_CONTRACT_VERSION, GDH_CURSOR_RULE_VERSION, GDH_GUIDANCE_INDEX_VERSION, GDH_GUIDANCE_UNIT_VERSION, GDH_MCP_LAUNCHER_VERSION, GDH_PROJECT_CONFIG_VERSION, GDH_RECIPE_SCHEMA_VERSION, GDH_RULES_SCHEMA_VERSION, GDH_SCENARIO_SCHEMA_VERSION, definePackageBoundary, resolveCurrentGdhInstall, resolveGdhProductMetadata, } from "@gdh/core";
|
|
9
13
|
import { createDefaultGuidanceUnits, getGuidanceStatus, resolveGuidanceQuery, } from "@gdh/docs";
|
|
10
14
|
import { inspectGuidanceAudit } from "@gdh/observability";
|
|
@@ -48,6 +52,15 @@ export const CURSOR_MIGRATE_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-migrate/SK
|
|
|
48
52
|
export const CURSOR_CHECK_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-check/SKILL.md";
|
|
49
53
|
export const CURSOR_PREPARE_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-prepare/SKILL.md";
|
|
50
54
|
export const CURSOR_VERIFY_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-verify/SKILL.md";
|
|
55
|
+
// Phase 13 SELF-01: /gdh-update skill surface path constants. The rendered
|
|
56
|
+
// bodies shell out to `npx -y @skillcap/gdh@latest self-update` (LITERAL
|
|
57
|
+
// @latest, not the pinned version — D-10) so the NEW CLI performs the update,
|
|
58
|
+
// not the (potentially pre-Phase-12) OLD pinned one. These constants are
|
|
59
|
+
// INTENTIONALLY excluded from VERIFY_DRIFT_SCANNED_FILES (D-13) because the
|
|
60
|
+
// rendered bodies are version-agnostic by design.
|
|
61
|
+
export const CLAUDE_UPDATE_COMMAND_RELATIVE_PATH = ".claude/commands/gdh/update.md";
|
|
62
|
+
export const CODEX_UPDATE_SKILL_RELATIVE_PATH = ".codex/skills/gdh-update/SKILL.md";
|
|
63
|
+
export const CURSOR_UPDATE_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-update/SKILL.md";
|
|
51
64
|
export const CLAUDE_SCAN_COMMAND_RELATIVE_PATH = ".claude/commands/gdh/scan.md";
|
|
52
65
|
export const CODEX_SCAN_SKILL_RELATIVE_PATH = ".codex/skills/gdh-scan/SKILL.md";
|
|
53
66
|
export const CURSOR_SCAN_SKILL_RELATIVE_PATH = ".cursor/skills/gdh-scan/SKILL.md";
|
|
@@ -774,6 +787,133 @@ export function renderCursorMigrateSkill(pinnedVersion) {
|
|
|
774
787
|
"",
|
|
775
788
|
].join("\n");
|
|
776
789
|
}
|
|
790
|
+
// --- gdh-update skill renders (Phase 13 SELF-01) ---
|
|
791
|
+
//
|
|
792
|
+
// D-10 invariant: every rendered body shells out to the LITERAL string
|
|
793
|
+
// `@skillcap/gdh@latest` in every npx line (dry-run, apply, verify drift).
|
|
794
|
+
// The `pinnedVersion` parameter is accepted for planSkillInstallAction
|
|
795
|
+
// signature symmetry with every other renderer, but MUST NOT be interpolated
|
|
796
|
+
// into the shellout — running the OLD pinned CLI (potentially pre-Phase-12
|
|
797
|
+
// and lacking bumpAndRebakePin entirely) to perform its own update is the
|
|
798
|
+
// failure mode Phase 13 exists to close. Check 44 in scripts/validate-docs.mjs
|
|
799
|
+
// enforces both the @latest presence AND the @${pinnedVersion} absence.
|
|
800
|
+
//
|
|
801
|
+
// D-11: preview-then-apply flow WITHOUT a confirmation gate — the human's
|
|
802
|
+
// original intent ("update GDH") IS the approval. No AskUserQuestion for
|
|
803
|
+
// Claude; no `## User questions` H2 for Codex/Cursor. Differs from /gdh-migrate
|
|
804
|
+
// which DOES gate on explicit approval.
|
|
805
|
+
//
|
|
806
|
+
// D-12: accept an optional positional version forwarded verbatim to the CLI.
|
|
807
|
+
// `/gdh-update` = latest; `/gdh-update 0.6.0` = pin that version.
|
|
808
|
+
//
|
|
809
|
+
// D-13: the three rendered skill files are EXCLUDED from VERIFY_DRIFT_SCANNED_FILES
|
|
810
|
+
// because @latest is not a semver literal — the baked-version scanner would
|
|
811
|
+
// permanently report no_baked_version. See rationale comments adjacent to the
|
|
812
|
+
// VERIFY_DRIFT_SCANNED_FILES declaration in packages/cli/src/index.ts.
|
|
813
|
+
export function renderClaudeUpdateCommand(_pinnedVersion) {
|
|
814
|
+
return [
|
|
815
|
+
"---",
|
|
816
|
+
"name: gdh:update",
|
|
817
|
+
"description: Update GDH to npm latest (bump pinned version + re-bake managed surfaces)",
|
|
818
|
+
"allowed-tools:",
|
|
819
|
+
" - Read",
|
|
820
|
+
" - Bash",
|
|
821
|
+
"---",
|
|
822
|
+
"<objective>",
|
|
823
|
+
"Update this project's GDH pinning to npm latest and re-bake every managed surface at the new pin.",
|
|
824
|
+
"Treat any positional argument (e.g., `/gdh-update 0.6.0`) as an explicit version; otherwise default to npm latest.",
|
|
825
|
+
"</objective>",
|
|
826
|
+
"",
|
|
827
|
+
"<process>",
|
|
828
|
+
"Follow this order:",
|
|
829
|
+
"",
|
|
830
|
+
"1. Preview: run `npx -y @skillcap/gdh@latest self-update [version] --dry-run` (omit `[version]` to preview against npm latest).",
|
|
831
|
+
"2. Surface the planned version delta and re-bake action count to the human conversationally.",
|
|
832
|
+
"3. Apply: run `npx -y @skillcap/gdh@latest self-update [version]` (omit `[version]` to apply against npm latest; forward whatever positional the user passed to `/gdh-update`).",
|
|
833
|
+
"4. Verify: run `npx -y @skillcap/gdh@latest verify drift` to confirm every baked surface matches the new pin.",
|
|
834
|
+
"</process>",
|
|
835
|
+
"",
|
|
836
|
+
"<rules>",
|
|
837
|
+
"- Do NOT ask the user to confirm apply — their original intent (\"update GDH\") IS the approval.",
|
|
838
|
+
"- Bake literal `@latest` in the shellout so the new CLI performs the update, not the old one.",
|
|
839
|
+
"- If `self-update` returns `rolled_back` or `blocked`, surface the failure reason and stop (do not retry).",
|
|
840
|
+
"- If `self-update` returns `skipped_dev_mode`, explain that dev-from-source mode bypasses pinning; no action needed.",
|
|
841
|
+
"</rules>",
|
|
842
|
+
"",
|
|
843
|
+
].join("\n");
|
|
844
|
+
}
|
|
845
|
+
export function renderCodexUpdateSkill(_pinnedVersion) {
|
|
846
|
+
return [
|
|
847
|
+
"---",
|
|
848
|
+
'name: "gdh-update"',
|
|
849
|
+
'description: "Update GDH to npm latest (bump pinned version + re-bake managed surfaces)"',
|
|
850
|
+
"metadata:",
|
|
851
|
+
' short-description: "Update GDH to npm latest"',
|
|
852
|
+
"---",
|
|
853
|
+
"",
|
|
854
|
+
"<codex_skill_adapter>",
|
|
855
|
+
"## Invocation",
|
|
856
|
+
"- This skill is invoked when the user says `/gdh-update` or mentions `$gdh-update`.",
|
|
857
|
+
"- Treat any positional argument (e.g., `/gdh-update 0.6.0`) as an explicit version; otherwise default to npm latest.",
|
|
858
|
+
"</codex_skill_adapter>",
|
|
859
|
+
"",
|
|
860
|
+
"<objective>",
|
|
861
|
+
"Update this project's GDH pinning to npm latest and re-bake every managed surface at the new pin.",
|
|
862
|
+
"</objective>",
|
|
863
|
+
"",
|
|
864
|
+
"<process>",
|
|
865
|
+
"Follow this order:",
|
|
866
|
+
"",
|
|
867
|
+
"1. Preview: run `npx -y @skillcap/gdh@latest self-update [version] --dry-run` (omit `[version]` to preview against npm latest).",
|
|
868
|
+
"2. Surface the planned version delta and re-bake action count to the human conversationally.",
|
|
869
|
+
"3. Apply: run `npx -y @skillcap/gdh@latest self-update [version]` (omit `[version]` to apply against npm latest; forward whatever positional the user passed to `/gdh-update`).",
|
|
870
|
+
"4. Verify: run `npx -y @skillcap/gdh@latest verify drift` to confirm every baked surface matches the new pin.",
|
|
871
|
+
"</process>",
|
|
872
|
+
"",
|
|
873
|
+
"<rules>",
|
|
874
|
+
"- Do NOT ask the user to confirm apply — their original intent (\"update GDH\") IS the approval.",
|
|
875
|
+
"- Bake literal `@latest` in the shellout so the new CLI performs the update, not the old one.",
|
|
876
|
+
"- If `self-update` returns `rolled_back` or `blocked`, surface the failure reason and stop (do not retry).",
|
|
877
|
+
"- If `self-update` returns `skipped_dev_mode`, explain that dev-from-source mode bypasses pinning; no action needed.",
|
|
878
|
+
"</rules>",
|
|
879
|
+
"",
|
|
880
|
+
].join("\n");
|
|
881
|
+
}
|
|
882
|
+
export function renderCursorUpdateSkill(_pinnedVersion) {
|
|
883
|
+
return [
|
|
884
|
+
"---",
|
|
885
|
+
"name: gdh-update",
|
|
886
|
+
'description: "Update GDH to npm latest (bump pinned version + re-bake managed surfaces)"',
|
|
887
|
+
"---",
|
|
888
|
+
"",
|
|
889
|
+
"<cursor_skill_adapter>",
|
|
890
|
+
"## Invocation",
|
|
891
|
+
"- This skill is invoked when the user says `/gdh-update` or mentions `gdh-update`.",
|
|
892
|
+
"- Treat any positional argument (e.g., `gdh-update 0.6.0`) as an explicit version; otherwise default to npm latest.",
|
|
893
|
+
"</cursor_skill_adapter>",
|
|
894
|
+
"",
|
|
895
|
+
"<objective>",
|
|
896
|
+
"Update this project's GDH pinning to npm latest and re-bake every managed surface at the new pin.",
|
|
897
|
+
"</objective>",
|
|
898
|
+
"",
|
|
899
|
+
"<process>",
|
|
900
|
+
"Follow this order:",
|
|
901
|
+
"",
|
|
902
|
+
"1. Preview: run `npx -y @skillcap/gdh@latest self-update [version] --dry-run` (omit `[version]` to preview against npm latest).",
|
|
903
|
+
"2. Surface the planned version delta and re-bake action count to the human conversationally.",
|
|
904
|
+
"3. Apply: run `npx -y @skillcap/gdh@latest self-update [version]` (omit `[version]` to apply against npm latest; forward whatever positional the user passed to `/gdh-update`).",
|
|
905
|
+
"4. Verify: run `npx -y @skillcap/gdh@latest verify drift` to confirm every baked surface matches the new pin.",
|
|
906
|
+
"</process>",
|
|
907
|
+
"",
|
|
908
|
+
"<rules>",
|
|
909
|
+
"- Do NOT ask the user to confirm apply — their original intent (\"update GDH\") IS the approval.",
|
|
910
|
+
"- Bake literal `@latest` in the shellout so the new CLI performs the update, not the old one.",
|
|
911
|
+
"- If `self-update` returns `rolled_back` or `blocked`, surface the failure reason and stop (do not retry).",
|
|
912
|
+
"- If `self-update` returns `skipped_dev_mode`, explain that dev-from-source mode bypasses pinning; no action needed.",
|
|
913
|
+
"</rules>",
|
|
914
|
+
"",
|
|
915
|
+
].join("\n");
|
|
916
|
+
}
|
|
777
917
|
// --- gdh-check skill renders ---
|
|
778
918
|
export function renderClaudeCheckCommand(pinnedVersion) {
|
|
779
919
|
return [
|
|
@@ -1440,6 +1580,11 @@ async function inspectCodexAdapter(targetPath, guidance, projectMcp, pinnedVersi
|
|
|
1440
1580
|
const codexSkillContent = await fs.readFile(codexSkillPath, "utf8").catch(() => null);
|
|
1441
1581
|
const codexStatusContent = await fs.readFile(path.join(targetPath, CODEX_STATUS_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1442
1582
|
const codexMigrateContent = await fs.readFile(path.join(targetPath, CODEX_MIGRATE_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1583
|
+
// Phase 13 Plan 13-03 deliverable — /gdh-update skill for Codex. Inspection
|
|
1584
|
+
// wiring is required so planSkillInstallAction can see the surface state;
|
|
1585
|
+
// otherwise the planner returns `unchanged` for a missing file and install
|
|
1586
|
+
// becomes a no-op (Plan 13-05 integration-test Rule 2 fix).
|
|
1587
|
+
const codexUpdateContent = await fs.readFile(path.join(targetPath, CODEX_UPDATE_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1443
1588
|
const codexCheckContent = await fs.readFile(path.join(targetPath, CODEX_CHECK_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1444
1589
|
const codexPrepareContent = await fs.readFile(path.join(targetPath, CODEX_PREPARE_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1445
1590
|
const codexVerifyContent = await fs.readFile(path.join(targetPath, CODEX_VERIFY_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
@@ -1447,6 +1592,7 @@ async function inspectCodexAdapter(targetPath, guidance, projectMcp, pinnedVersi
|
|
|
1447
1592
|
const expectedCodexOnboardSkill = pinnedVersion === null ? null : renderCodexOnboardSkill(pinnedVersion);
|
|
1448
1593
|
const expectedCodexStatusSkill = pinnedVersion === null ? null : renderCodexStatusSkill(pinnedVersion);
|
|
1449
1594
|
const expectedCodexMigrateSkill = pinnedVersion === null ? null : renderCodexMigrateSkill(pinnedVersion);
|
|
1595
|
+
const expectedCodexUpdateSkill = pinnedVersion === null ? null : renderCodexUpdateSkill(pinnedVersion);
|
|
1450
1596
|
const expectedCodexCheckSkill = pinnedVersion === null ? null : renderCodexCheckSkill(pinnedVersion);
|
|
1451
1597
|
const expectedCodexPrepareSkill = pinnedVersion === null ? null : renderCodexPrepareSkill(pinnedVersion);
|
|
1452
1598
|
const expectedCodexVerifySkill = pinnedVersion === null ? null : renderCodexVerifySkill(pinnedVersion);
|
|
@@ -1494,6 +1640,7 @@ async function inspectCodexAdapter(targetPath, guidance, projectMcp, pinnedVersi
|
|
|
1494
1640
|
}),
|
|
1495
1641
|
...inspectCodexSkillSurface(targetPath, CODEX_STATUS_SKILL_RELATIVE_PATH, codexStatusContent, expectedCodexStatusSkill, "gdh-status"),
|
|
1496
1642
|
...inspectCodexSkillSurface(targetPath, CODEX_MIGRATE_SKILL_RELATIVE_PATH, codexMigrateContent, expectedCodexMigrateSkill, "gdh-migrate"),
|
|
1643
|
+
...inspectCodexSkillSurface(targetPath, CODEX_UPDATE_SKILL_RELATIVE_PATH, codexUpdateContent, expectedCodexUpdateSkill, "gdh-update"),
|
|
1497
1644
|
...inspectCodexSkillSurface(targetPath, CODEX_CHECK_SKILL_RELATIVE_PATH, codexCheckContent, expectedCodexCheckSkill, "gdh-check"),
|
|
1498
1645
|
...inspectCodexSkillSurface(targetPath, CODEX_PREPARE_SKILL_RELATIVE_PATH, codexPrepareContent, expectedCodexPrepareSkill, "gdh-prepare"),
|
|
1499
1646
|
...inspectCodexSkillSurface(targetPath, CODEX_VERIFY_SKILL_RELATIVE_PATH, codexVerifyContent, expectedCodexVerifySkill, "gdh-verify"),
|
|
@@ -1533,17 +1680,29 @@ async function inspectClaudeAdapter(targetPath, guidance, projectMcp, pinnedVers
|
|
|
1533
1680
|
const onboardCommandContent = await fs.readFile(onboardCommandPath, "utf8").catch(() => null);
|
|
1534
1681
|
const claudeStatusContent = await fs.readFile(path.join(targetPath, CLAUDE_STATUS_COMMAND_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1535
1682
|
const claudeMigrateContent = await fs.readFile(path.join(targetPath, CLAUDE_MIGRATE_COMMAND_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1683
|
+
// Phase 13 Plan 13-03 deliverable — /gdh-update slash command for Claude.
|
|
1684
|
+
// Inspection wiring is required so planSkillInstallAction can see the surface
|
|
1685
|
+
// state; otherwise the planner returns `unchanged` for a missing file and
|
|
1686
|
+
// install becomes a no-op (Plan 13-05 integration-test Rule 2 fix).
|
|
1687
|
+
const claudeUpdateContent = await fs.readFile(path.join(targetPath, CLAUDE_UPDATE_COMMAND_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1536
1688
|
const claudeCheckContent = await fs.readFile(path.join(targetPath, CLAUDE_CHECK_COMMAND_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1537
1689
|
const claudePrepareContent = await fs.readFile(path.join(targetPath, CLAUDE_PREPARE_COMMAND_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1538
1690
|
const claudeVerifyContent = await fs.readFile(path.join(targetPath, CLAUDE_VERIFY_COMMAND_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1539
1691
|
const claudeScanContent = await fs.readFile(path.join(targetPath, CLAUDE_SCAN_COMMAND_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1692
|
+
const claudeCheckUpdateHookContent = await fs.readFile(path.join(targetPath, CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1693
|
+
const claudeCheckUpdateWorkerContent = await fs.readFile(path.join(targetPath, CLAUDE_CHECK_UPDATE_WORKER_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1694
|
+
const claudeStatuslineContent = await fs.readFile(path.join(targetPath, CLAUDE_STATUSLINE_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1540
1695
|
let detectedTarget = null;
|
|
1541
1696
|
if (lstat?.isSymbolicLink()) {
|
|
1542
1697
|
detectedTarget = await fs.readlink(absolutePath).catch(() => null);
|
|
1543
1698
|
}
|
|
1544
1699
|
const expectedClaudeOnboardCommand = pinnedVersion === null ? null : renderClaudeOnboardCommand(pinnedVersion);
|
|
1700
|
+
const expectedClaudeCheckUpdateHook = pinnedVersion === null ? null : renderClaudeCheckUpdateHook(pinnedVersion);
|
|
1701
|
+
const expectedClaudeCheckUpdateWorker = pinnedVersion === null ? null : renderClaudeCheckUpdateWorker(pinnedVersion);
|
|
1702
|
+
const expectedClaudeStatusline = pinnedVersion === null ? null : renderClaudeUpdateStatusline(pinnedVersion);
|
|
1545
1703
|
const expectedClaudeStatusCommand = pinnedVersion === null ? null : renderClaudeStatusCommand(pinnedVersion);
|
|
1546
1704
|
const expectedClaudeMigrateCommand = pinnedVersion === null ? null : renderClaudeMigrateCommand(pinnedVersion);
|
|
1705
|
+
const expectedClaudeUpdateCommand = pinnedVersion === null ? null : renderClaudeUpdateCommand(pinnedVersion);
|
|
1547
1706
|
const expectedClaudeCheckCommand = pinnedVersion === null ? null : renderClaudeCheckCommand(pinnedVersion);
|
|
1548
1707
|
const expectedClaudePrepareCommand = pinnedVersion === null ? null : renderClaudePrepareCommand(pinnedVersion);
|
|
1549
1708
|
const expectedClaudeVerifyCommand = pinnedVersion === null ? null : renderClaudeVerifyCommand(pinnedVersion);
|
|
@@ -1593,10 +1752,14 @@ async function inspectClaudeAdapter(targetPath, guidance, projectMcp, pinnedVers
|
|
|
1593
1752
|
}),
|
|
1594
1753
|
...inspectClaudeCommandSurface(targetPath, CLAUDE_STATUS_COMMAND_RELATIVE_PATH, claudeStatusContent, expectedClaudeStatusCommand, "gdh-status"),
|
|
1595
1754
|
...inspectClaudeCommandSurface(targetPath, CLAUDE_MIGRATE_COMMAND_RELATIVE_PATH, claudeMigrateContent, expectedClaudeMigrateCommand, "gdh-migrate"),
|
|
1755
|
+
...inspectClaudeCommandSurface(targetPath, CLAUDE_UPDATE_COMMAND_RELATIVE_PATH, claudeUpdateContent, expectedClaudeUpdateCommand, "gdh-update"),
|
|
1596
1756
|
...inspectClaudeCommandSurface(targetPath, CLAUDE_CHECK_COMMAND_RELATIVE_PATH, claudeCheckContent, expectedClaudeCheckCommand, "gdh-check"),
|
|
1597
1757
|
...inspectClaudeCommandSurface(targetPath, CLAUDE_PREPARE_COMMAND_RELATIVE_PATH, claudePrepareContent, expectedClaudePrepareCommand, "gdh-prepare"),
|
|
1598
1758
|
...inspectClaudeCommandSurface(targetPath, CLAUDE_VERIFY_COMMAND_RELATIVE_PATH, claudeVerifyContent, expectedClaudeVerifyCommand, "gdh-verify"),
|
|
1599
1759
|
...inspectClaudeCommandSurface(targetPath, CLAUDE_SCAN_COMMAND_RELATIVE_PATH, claudeScanContent, expectedClaudeScanCommand, "gdh-scan"),
|
|
1760
|
+
...inspectClaudeCommandSurface(targetPath, CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH, claudeCheckUpdateHookContent, expectedClaudeCheckUpdateHook, "gdh-check-update-hook"),
|
|
1761
|
+
...inspectClaudeCommandSurface(targetPath, CLAUDE_CHECK_UPDATE_WORKER_RELATIVE_PATH, claudeCheckUpdateWorkerContent, expectedClaudeCheckUpdateWorker, "gdh-check-update-worker"),
|
|
1762
|
+
...inspectClaudeCommandSurface(targetPath, CLAUDE_STATUSLINE_RELATIVE_PATH, claudeStatuslineContent, expectedClaudeStatusline, "gdh-statusline"),
|
|
1600
1763
|
];
|
|
1601
1764
|
if (projectMcp.enabled) {
|
|
1602
1765
|
surfaces.push(createSurfaceStatus({
|
|
@@ -1630,6 +1793,11 @@ async function inspectCursorAdapter(targetPath, guidance, projectMcp, pinnedVers
|
|
|
1630
1793
|
const onboardSkillContent = await fs.readFile(onboardSkillPath, "utf8").catch(() => null);
|
|
1631
1794
|
const cursorStatusContent = await fs.readFile(path.join(targetPath, CURSOR_STATUS_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1632
1795
|
const cursorMigrateContent = await fs.readFile(path.join(targetPath, CURSOR_MIGRATE_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1796
|
+
// Phase 13 Plan 13-03 deliverable — /gdh-update skill for Cursor. Inspection
|
|
1797
|
+
// wiring required so planSkillInstallAction sees the surface state; otherwise
|
|
1798
|
+
// the planner returns `unchanged` for a missing file and install becomes a
|
|
1799
|
+
// no-op (Plan 13-05 integration-test Rule 2 fix).
|
|
1800
|
+
const cursorUpdateContent = await fs.readFile(path.join(targetPath, CURSOR_UPDATE_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1633
1801
|
const cursorCheckContent = await fs.readFile(path.join(targetPath, CURSOR_CHECK_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1634
1802
|
const cursorPrepareContent = await fs.readFile(path.join(targetPath, CURSOR_PREPARE_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
1635
1803
|
const cursorVerifyContent = await fs.readFile(path.join(targetPath, CURSOR_VERIFY_SKILL_RELATIVE_PATH), "utf8").catch(() => null);
|
|
@@ -1639,6 +1807,7 @@ async function inspectCursorAdapter(targetPath, guidance, projectMcp, pinnedVers
|
|
|
1639
1807
|
const expectedCursorOnboardSkill = pinnedVersion === null ? null : renderCursorOnboardSkill(pinnedVersion);
|
|
1640
1808
|
const expectedCursorStatusSkill = pinnedVersion === null ? null : renderCursorStatusSkill(pinnedVersion);
|
|
1641
1809
|
const expectedCursorMigrateSkill = pinnedVersion === null ? null : renderCursorMigrateSkill(pinnedVersion);
|
|
1810
|
+
const expectedCursorUpdateSkill = pinnedVersion === null ? null : renderCursorUpdateSkill(pinnedVersion);
|
|
1642
1811
|
const expectedCursorCheckSkill = pinnedVersion === null ? null : renderCursorCheckSkill(pinnedVersion);
|
|
1643
1812
|
const expectedCursorPrepareSkill = pinnedVersion === null ? null : renderCursorPrepareSkill(pinnedVersion);
|
|
1644
1813
|
const expectedCursorVerifySkill = pinnedVersion === null ? null : renderCursorVerifySkill(pinnedVersion);
|
|
@@ -1686,6 +1855,7 @@ async function inspectCursorAdapter(targetPath, guidance, projectMcp, pinnedVers
|
|
|
1686
1855
|
}),
|
|
1687
1856
|
...inspectCursorSkillSurface(targetPath, CURSOR_STATUS_SKILL_RELATIVE_PATH, cursorStatusContent, expectedCursorStatusSkill, "gdh-status"),
|
|
1688
1857
|
...inspectCursorSkillSurface(targetPath, CURSOR_MIGRATE_SKILL_RELATIVE_PATH, cursorMigrateContent, expectedCursorMigrateSkill, "gdh-migrate"),
|
|
1858
|
+
...inspectCursorSkillSurface(targetPath, CURSOR_UPDATE_SKILL_RELATIVE_PATH, cursorUpdateContent, expectedCursorUpdateSkill, "gdh-update"),
|
|
1689
1859
|
...inspectCursorSkillSurface(targetPath, CURSOR_CHECK_SKILL_RELATIVE_PATH, cursorCheckContent, expectedCursorCheckSkill, "gdh-check"),
|
|
1690
1860
|
...inspectCursorSkillSurface(targetPath, CURSOR_PREPARE_SKILL_RELATIVE_PATH, cursorPrepareContent, expectedCursorPrepareSkill, "gdh-prepare"),
|
|
1691
1861
|
...inspectCursorSkillSurface(targetPath, CURSOR_VERIFY_SKILL_RELATIVE_PATH, cursorVerifyContent, expectedCursorVerifySkill, "gdh-verify"),
|
|
@@ -1939,6 +2109,7 @@ function planCodexRepoInstallActions(targetPath, adapter, pinnedVersion) {
|
|
|
1939
2109
|
planSkillInstallAction("codex", targetPath, adapter, CODEX_ONBOARD_SKILL_RELATIVE_PATH, renderCodexOnboardSkill, "gdh-onboard", pinnedVersion),
|
|
1940
2110
|
planSkillInstallAction("codex", targetPath, adapter, CODEX_STATUS_SKILL_RELATIVE_PATH, renderCodexStatusSkill, "gdh-status", pinnedVersion),
|
|
1941
2111
|
planSkillInstallAction("codex", targetPath, adapter, CODEX_MIGRATE_SKILL_RELATIVE_PATH, renderCodexMigrateSkill, "gdh-migrate", pinnedVersion),
|
|
2112
|
+
planSkillInstallAction("codex", targetPath, adapter, CODEX_UPDATE_SKILL_RELATIVE_PATH, renderCodexUpdateSkill, "gdh-update", pinnedVersion),
|
|
1942
2113
|
planSkillInstallAction("codex", targetPath, adapter, CODEX_CHECK_SKILL_RELATIVE_PATH, renderCodexCheckSkill, "gdh-check", pinnedVersion),
|
|
1943
2114
|
planSkillInstallAction("codex", targetPath, adapter, CODEX_PREPARE_SKILL_RELATIVE_PATH, renderCodexPrepareSkill, "gdh-prepare", pinnedVersion),
|
|
1944
2115
|
planSkillInstallAction("codex", targetPath, adapter, CODEX_VERIFY_SKILL_RELATIVE_PATH, renderCodexVerifySkill, "gdh-verify", pinnedVersion),
|
|
@@ -2024,7 +2195,55 @@ function planClaudeInstallActions(targetPath, adapter, pinnedVersion) {
|
|
|
2024
2195
|
expectedTarget: "AGENTS.md",
|
|
2025
2196
|
}));
|
|
2026
2197
|
}
|
|
2027
|
-
actions.push(planSkillInstallAction("claude", targetPath, adapter, CLAUDE_ONBOARD_COMMAND_RELATIVE_PATH, renderClaudeOnboardCommand, "gdh-onboard", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_STATUS_COMMAND_RELATIVE_PATH, renderClaudeStatusCommand, "gdh-status", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_MIGRATE_COMMAND_RELATIVE_PATH, renderClaudeMigrateCommand, "gdh-migrate", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_CHECK_COMMAND_RELATIVE_PATH, renderClaudeCheckCommand, "gdh-check", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_PREPARE_COMMAND_RELATIVE_PATH, renderClaudePrepareCommand, "gdh-prepare", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_VERIFY_COMMAND_RELATIVE_PATH, renderClaudeVerifyCommand, "gdh-verify", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_SCAN_COMMAND_RELATIVE_PATH, renderClaudeScanCommand, "gdh-scan", pinnedVersion)
|
|
2198
|
+
actions.push(planSkillInstallAction("claude", targetPath, adapter, CLAUDE_ONBOARD_COMMAND_RELATIVE_PATH, renderClaudeOnboardCommand, "gdh-onboard", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_STATUS_COMMAND_RELATIVE_PATH, renderClaudeStatusCommand, "gdh-status", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_MIGRATE_COMMAND_RELATIVE_PATH, renderClaudeMigrateCommand, "gdh-migrate", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_UPDATE_COMMAND_RELATIVE_PATH, renderClaudeUpdateCommand, "gdh-update", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_CHECK_COMMAND_RELATIVE_PATH, renderClaudeCheckCommand, "gdh-check", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_PREPARE_COMMAND_RELATIVE_PATH, renderClaudePrepareCommand, "gdh-prepare", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_VERIFY_COMMAND_RELATIVE_PATH, renderClaudeVerifyCommand, "gdh-verify", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_SCAN_COMMAND_RELATIVE_PATH, renderClaudeScanCommand, "gdh-scan", pinnedVersion),
|
|
2199
|
+
// UPD-01 managed hook surfaces baked at the pinned version.
|
|
2200
|
+
planSkillInstallAction("claude", targetPath, adapter, CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH, renderClaudeCheckUpdateHook, "gdh-check-update-hook", pinnedVersion), planSkillInstallAction("claude", targetPath, adapter, CLAUDE_CHECK_UPDATE_WORKER_RELATIVE_PATH, renderClaudeCheckUpdateWorker, "gdh-check-update-worker", pinnedVersion),
|
|
2201
|
+
// UPD-02 managed statusline surface baked at the pinned version. The .js
|
|
2202
|
+
// file is ALWAYS baked, even when settings.json statusLine is not owned
|
|
2203
|
+
// by GDH (write-if-absent below) — users can manually point their config
|
|
2204
|
+
// at gdh-statusline.js later; the baked file is a no-op until wired.
|
|
2205
|
+
planSkillInstallAction("claude", targetPath, adapter, CLAUDE_STATUSLINE_RELATIVE_PATH, renderClaudeUpdateStatusline, "gdh-statusline", pinnedVersion));
|
|
2206
|
+
// UPD-01 + UPD-02 .claude/settings.json composite patch action.
|
|
2207
|
+
// - Plan 02 (Strategy A, planner-lock #1): patch-merge the SessionStart
|
|
2208
|
+
// hook entry by exact command-literal match, preserving siblings.
|
|
2209
|
+
// - Plan 03 (write-if-absent, planner-lock #2 / D-18): add the statusLine
|
|
2210
|
+
// entry ONLY when no existing statusLine is configured (e.g. GSD-owned
|
|
2211
|
+
// or user-owned). Silent no-op for UPD-02 on targets where another
|
|
2212
|
+
// tool already owns the slot; the universal surface is MCP _meta.
|
|
2213
|
+
//
|
|
2214
|
+
// Synchronous read via fsSync is intentional: planClaudeInstallActions is
|
|
2215
|
+
// called without `await`, and making it async would ripple to every sibling
|
|
2216
|
+
// planner (Codex, Cursor). The composed patches are idempotent and
|
|
2217
|
+
// commutative (proven in Task 1 Test J) so application order is irrelevant.
|
|
2218
|
+
let existingSettingsContent = "";
|
|
2219
|
+
try {
|
|
2220
|
+
existingSettingsContent = fsSync.readFileSync(path.join(targetPath, CLAUDE_SETTINGS_RELATIVE_PATH), "utf8");
|
|
2221
|
+
}
|
|
2222
|
+
catch {
|
|
2223
|
+
existingSettingsContent = "";
|
|
2224
|
+
}
|
|
2225
|
+
const patchedSettings = patchClaudeSettingsForGdhStatusline(patchClaudeSettingsForGdhSessionStart(existingSettingsContent));
|
|
2226
|
+
const settingsIsUnchanged = existingSettingsContent === patchedSettings;
|
|
2227
|
+
const settingsExistedOnDisk = existingSettingsContent.length > 0;
|
|
2228
|
+
actions.push(createInstallAction({
|
|
2229
|
+
agent: "claude",
|
|
2230
|
+
kind: "write_file",
|
|
2231
|
+
scope: "repo",
|
|
2232
|
+
targetPath,
|
|
2233
|
+
relativePath: CLAUDE_SETTINGS_RELATIVE_PATH,
|
|
2234
|
+
state: settingsIsUnchanged ? "unchanged" : "planned",
|
|
2235
|
+
mode: settingsIsUnchanged
|
|
2236
|
+
? "unchanged"
|
|
2237
|
+
: settingsExistedOnDisk
|
|
2238
|
+
? "replace"
|
|
2239
|
+
: "create",
|
|
2240
|
+
summary: settingsIsUnchanged
|
|
2241
|
+
? "GDH SessionStart hook + statusline already registered in .claude/settings.json."
|
|
2242
|
+
: settingsExistedOnDisk
|
|
2243
|
+
? "Register the GDH SessionStart hook and statusline (write-if-absent) in .claude/settings.json while preserving sibling content (patch-merge)."
|
|
2244
|
+
: "Create .claude/settings.json with the GDH SessionStart hook + statusline registration.",
|
|
2245
|
+
content: patchedSettings,
|
|
2246
|
+
}));
|
|
2028
2247
|
return actions;
|
|
2029
2248
|
}
|
|
2030
2249
|
function planCursorInstallActions(targetPath, adapter, pinnedVersion) {
|
|
@@ -2060,7 +2279,7 @@ function planCursorInstallActions(targetPath, adapter, pinnedVersion) {
|
|
|
2060
2279
|
content: renderCursorRule(),
|
|
2061
2280
|
}));
|
|
2062
2281
|
}
|
|
2063
|
-
actions.push(planSkillInstallAction("cursor", targetPath, adapter, CURSOR_ONBOARD_SKILL_RELATIVE_PATH, renderCursorOnboardSkill, "gdh-onboard", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_STATUS_SKILL_RELATIVE_PATH, renderCursorStatusSkill, "gdh-status", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_MIGRATE_SKILL_RELATIVE_PATH, renderCursorMigrateSkill, "gdh-migrate", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_CHECK_SKILL_RELATIVE_PATH, renderCursorCheckSkill, "gdh-check", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_PREPARE_SKILL_RELATIVE_PATH, renderCursorPrepareSkill, "gdh-prepare", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_VERIFY_SKILL_RELATIVE_PATH, renderCursorVerifySkill, "gdh-verify", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_SCAN_SKILL_RELATIVE_PATH, renderCursorScanSkill, "gdh-scan", pinnedVersion));
|
|
2282
|
+
actions.push(planSkillInstallAction("cursor", targetPath, adapter, CURSOR_ONBOARD_SKILL_RELATIVE_PATH, renderCursorOnboardSkill, "gdh-onboard", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_STATUS_SKILL_RELATIVE_PATH, renderCursorStatusSkill, "gdh-status", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_MIGRATE_SKILL_RELATIVE_PATH, renderCursorMigrateSkill, "gdh-migrate", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_UPDATE_SKILL_RELATIVE_PATH, renderCursorUpdateSkill, "gdh-update", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_CHECK_SKILL_RELATIVE_PATH, renderCursorCheckSkill, "gdh-check", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_PREPARE_SKILL_RELATIVE_PATH, renderCursorPrepareSkill, "gdh-prepare", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_VERIFY_SKILL_RELATIVE_PATH, renderCursorVerifySkill, "gdh-verify", pinnedVersion), planSkillInstallAction("cursor", targetPath, adapter, CURSOR_SCAN_SKILL_RELATIVE_PATH, renderCursorScanSkill, "gdh-scan", pinnedVersion));
|
|
2064
2283
|
return actions;
|
|
2065
2284
|
}
|
|
2066
2285
|
function dedupeInstallActions(actions) {
|
|
@@ -3279,4 +3498,7 @@ function deriveRepoState(context) {
|
|
|
3279
3498
|
function normalizeChangedFiles(files) {
|
|
3280
3499
|
return [...new Set(files.map((file) => file.trim()).filter((file) => file.length > 0))];
|
|
3281
3500
|
}
|
|
3501
|
+
export { bumpAndRebakePin, } from "./self-update-mechanics.js";
|
|
3502
|
+
export { CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH } from "./claude-update-hook-render.js";
|
|
3503
|
+
export { CLAUDE_STATUSLINE_RELATIVE_PATH } from "./claude-statusline-render.js";
|
|
3282
3504
|
//# sourceMappingURL=index.js.map
|