greprag 5.73.23 → 5.74.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/claude-lifecycle-cutover.d.ts +23 -0
- package/dist/claude-lifecycle-cutover.js +175 -0
- package/dist/claude-lifecycle-cutover.js.map +1 -0
- package/dist/commands/delivery-reminder.d.ts +10 -0
- package/dist/commands/delivery-reminder.js +44 -0
- package/dist/commands/delivery-reminder.js.map +1 -0
- package/dist/commands/delivery.d.ts +1 -0
- package/dist/commands/delivery.js +56 -0
- package/dist/commands/delivery.js.map +1 -0
- package/dist/commands/init.js +5 -8
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/opencode-interrupt.d.ts +1 -0
- package/dist/commands/opencode-interrupt.js +1 -0
- package/dist/commands/opencode-interrupt.js.map +1 -1
- package/dist/commands/reminder-registry.js +2 -0
- package/dist/commands/reminder-registry.js.map +1 -1
- package/dist/commands/reminder-types.d.ts +4 -0
- package/dist/commands/skill.js +22 -1
- package/dist/commands/skill.js.map +1 -1
- package/dist/delivery-config.d.ts +35 -0
- package/dist/delivery-config.js +188 -0
- package/dist/delivery-config.js.map +1 -0
- package/dist/delivery-lifecycle.d.ts +3 -0
- package/dist/delivery-lifecycle.js +13 -0
- package/dist/delivery-lifecycle.js.map +1 -0
- package/dist/hook.js +28 -34
- package/dist/hook.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/native-skill-mirror.d.ts +3 -1
- package/dist/native-skill-mirror.js +11 -4
- package/dist/native-skill-mirror.js.map +1 -1
- package/dist/opencode-plugin.bundle.js +54 -0
- package/dist/opencode-plugin.js +1 -0
- package/dist/opencode-plugin.js.map +1 -1
- package/dist/procedure-runtime.d.ts +18 -0
- package/dist/procedure-runtime.js +83 -0
- package/dist/procedure-runtime.js.map +1 -0
- package/dist/procedure-shadow.d.ts +31 -0
- package/dist/procedure-shadow.js +122 -0
- package/dist/procedure-shadow.js.map +1 -0
- package/dist/procedure-watch.d.ts +5 -3
- package/dist/procedure-watch.js +10 -4
- package/dist/procedure-watch.js.map +1 -1
- package/dist/procedure.js +3 -0
- package/dist/procedure.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Transitional repo Delivery Profile resolver. */
|
|
2
|
+
export type IntegrationStrategy = 'merge' | 'rebase' | 'ff-only';
|
|
3
|
+
export interface DeliveryProfile {
|
|
4
|
+
version: 1;
|
|
5
|
+
git: {
|
|
6
|
+
defaultBranch: string;
|
|
7
|
+
remote: string;
|
|
8
|
+
integrationStrategy: IntegrationStrategy;
|
|
9
|
+
pushDeploys: boolean;
|
|
10
|
+
};
|
|
11
|
+
deploy?: {
|
|
12
|
+
source: string;
|
|
13
|
+
targets: Array<{
|
|
14
|
+
id: string;
|
|
15
|
+
procedureId?: string;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
release?: {
|
|
19
|
+
source: string;
|
|
20
|
+
procedureId?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface ResolvedDeliveryProfile {
|
|
24
|
+
mode: 'profile' | 'legacy' | 'missing' | 'invalid';
|
|
25
|
+
root: string | null;
|
|
26
|
+
configPath: string | null;
|
|
27
|
+
profile: DeliveryProfile | null;
|
|
28
|
+
deploySource: string | null;
|
|
29
|
+
releaseSource: string | null;
|
|
30
|
+
legacyPromptSource: string | null;
|
|
31
|
+
warnings: string[];
|
|
32
|
+
errors: string[];
|
|
33
|
+
}
|
|
34
|
+
export declare function deliveryProfilePath(root: string): string;
|
|
35
|
+
export declare function resolveDeliveryProfile(cwd: string): ResolvedDeliveryProfile;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Transitional repo Delivery Profile resolver. */
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.deliveryProfilePath = deliveryProfilePath;
|
|
38
|
+
exports.resolveDeliveryProfile = resolveDeliveryProfile;
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const proc_1 = require("./proc");
|
|
42
|
+
function deliveryProfilePath(root) {
|
|
43
|
+
return path.join(root, '.greprag', 'delivery.json');
|
|
44
|
+
}
|
|
45
|
+
function gitRoot(cwd) {
|
|
46
|
+
try {
|
|
47
|
+
const out = (0, proc_1.safeExecSync)('git rev-parse --show-toplevel', {
|
|
48
|
+
cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true,
|
|
49
|
+
});
|
|
50
|
+
return out.trim() ? path.resolve(out.trim()) : null;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function safeDoc(root, value, field, errors) {
|
|
57
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
58
|
+
errors.push(`${field} must name a repo-relative Markdown file`);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const relative = value.trim().replace(/\\/g, '/');
|
|
62
|
+
if (path.isAbsolute(relative) || relative.split('/').includes('..') || !relative.toLowerCase().endsWith('.md')) {
|
|
63
|
+
errors.push(`${field} must be a safe repo-relative .md path`);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const absolute = path.resolve(root, relative);
|
|
67
|
+
const rootPrefix = root.toLowerCase().endsWith(path.sep)
|
|
68
|
+
? root.toLowerCase() : root.toLowerCase() + path.sep;
|
|
69
|
+
if (!absolute.toLowerCase().startsWith(rootPrefix)) {
|
|
70
|
+
errors.push(`${field} escapes the repository`);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
if (!fs.existsSync(absolute))
|
|
74
|
+
errors.push(`${field} does not exist: ${relative}`);
|
|
75
|
+
return relative;
|
|
76
|
+
}
|
|
77
|
+
function parseProfile(root, raw) {
|
|
78
|
+
const errors = [];
|
|
79
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
80
|
+
return { profile: null, deploySource: null, releaseSource: null, errors: ['profile must be a JSON object'] };
|
|
81
|
+
}
|
|
82
|
+
const value = raw;
|
|
83
|
+
if (value.version !== 1)
|
|
84
|
+
errors.push('version must be 1');
|
|
85
|
+
const git = value.git;
|
|
86
|
+
const defaultBranch = typeof git?.defaultBranch === 'string' ? git.defaultBranch.trim() : '';
|
|
87
|
+
const remote = typeof git?.remote === 'string' ? git.remote.trim() : '';
|
|
88
|
+
const strategy = git?.integrationStrategy;
|
|
89
|
+
const pushDeploys = git?.pushDeploys;
|
|
90
|
+
if (!defaultBranch || !/^[A-Za-z0-9._/-]+$/.test(defaultBranch))
|
|
91
|
+
errors.push('git.defaultBranch is invalid');
|
|
92
|
+
if (!remote || !/^[A-Za-z0-9._-]+$/.test(remote))
|
|
93
|
+
errors.push('git.remote is invalid');
|
|
94
|
+
if (strategy !== 'merge' && strategy !== 'rebase' && strategy !== 'ff-only') {
|
|
95
|
+
errors.push('git.integrationStrategy must be merge, rebase, or ff-only');
|
|
96
|
+
}
|
|
97
|
+
if (typeof pushDeploys !== 'boolean')
|
|
98
|
+
errors.push('git.pushDeploys must be boolean');
|
|
99
|
+
const deploy = value.deploy;
|
|
100
|
+
const release = value.release;
|
|
101
|
+
const deploySource = deploy ? safeDoc(root, deploy.source, 'deploy.source', errors) : null;
|
|
102
|
+
const releaseSource = release ? safeDoc(root, release.source, 'release.source', errors) : null;
|
|
103
|
+
const targetsRaw = deploy?.targets;
|
|
104
|
+
const targets = [];
|
|
105
|
+
if (deploy) {
|
|
106
|
+
if (!Array.isArray(targetsRaw) || targetsRaw.length === 0) {
|
|
107
|
+
errors.push('deploy.targets must contain at least one target');
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
const seen = new Set();
|
|
111
|
+
for (const item of targetsRaw) {
|
|
112
|
+
const target = item;
|
|
113
|
+
const id = typeof target?.id === 'string' ? target.id.trim() : '';
|
|
114
|
+
if (!id || !/^[a-z0-9][a-z0-9._-]*$/.test(id))
|
|
115
|
+
errors.push('every deploy target needs a safe lowercase id');
|
|
116
|
+
else if (seen.has(id))
|
|
117
|
+
errors.push(`duplicate deploy target: ${id}`);
|
|
118
|
+
else
|
|
119
|
+
seen.add(id);
|
|
120
|
+
const procedureId = typeof target?.procedureId === 'string' && target.procedureId.trim()
|
|
121
|
+
? target.procedureId.trim() : undefined;
|
|
122
|
+
targets.push({ id, procedureId });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const releaseProcedureId = typeof release?.procedureId === 'string' && release.procedureId.trim()
|
|
127
|
+
? release.procedureId.trim() : undefined;
|
|
128
|
+
if (errors.length)
|
|
129
|
+
return { profile: null, deploySource, releaseSource, errors };
|
|
130
|
+
return {
|
|
131
|
+
profile: {
|
|
132
|
+
version: 1,
|
|
133
|
+
git: {
|
|
134
|
+
defaultBranch,
|
|
135
|
+
remote,
|
|
136
|
+
integrationStrategy: strategy,
|
|
137
|
+
pushDeploys: pushDeploys,
|
|
138
|
+
},
|
|
139
|
+
deploy: deploy && deploySource ? { source: deploySource, targets } : undefined,
|
|
140
|
+
release: release && releaseSource
|
|
141
|
+
? { source: releaseSource, procedureId: releaseProcedureId } : undefined,
|
|
142
|
+
},
|
|
143
|
+
deploySource, releaseSource, errors,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// adr: adr/delivery-profile.md
|
|
147
|
+
function resolveDeliveryProfile(cwd) {
|
|
148
|
+
const root = gitRoot(cwd);
|
|
149
|
+
if (!root) {
|
|
150
|
+
return {
|
|
151
|
+
mode: 'missing', root: null, configPath: null, profile: null,
|
|
152
|
+
deploySource: null, releaseSource: null, legacyPromptSource: null,
|
|
153
|
+
warnings: [], errors: ['cwd is not inside a committed Git repository'],
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const configPath = deliveryProfilePath(root);
|
|
157
|
+
if (fs.existsSync(configPath)) {
|
|
158
|
+
try {
|
|
159
|
+
const parsed = parseProfile(root, JSON.parse(fs.readFileSync(configPath, 'utf8')));
|
|
160
|
+
return {
|
|
161
|
+
mode: parsed.profile ? 'profile' : 'invalid', root, configPath,
|
|
162
|
+
profile: parsed.profile,
|
|
163
|
+
deploySource: parsed.deploySource,
|
|
164
|
+
releaseSource: parsed.releaseSource,
|
|
165
|
+
legacyPromptSource: null,
|
|
166
|
+
warnings: [], errors: parsed.errors,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
return {
|
|
171
|
+
mode: 'invalid', root, configPath, profile: null,
|
|
172
|
+
deploySource: null, releaseSource: null, legacyPromptSource: null,
|
|
173
|
+
warnings: [], errors: [`invalid JSON: ${error instanceof Error ? error.message : String(error)}`],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const deploySource = fs.existsSync(path.join(root, 'docs', 'deploy.md')) ? 'docs/deploy.md' : null;
|
|
178
|
+
const releaseSource = fs.existsSync(path.join(root, 'docs', 'releases.md')) ? 'docs/releases.md' : null;
|
|
179
|
+
const legacyPromptSource = fs.existsSync(path.join(root, 'CLAUDE.md')) ? 'CLAUDE.md' : null;
|
|
180
|
+
const found = deploySource || releaseSource || legacyPromptSource;
|
|
181
|
+
return {
|
|
182
|
+
mode: found ? 'legacy' : 'missing', root, configPath, profile: null,
|
|
183
|
+
deploySource, releaseSource, legacyPromptSource,
|
|
184
|
+
warnings: found ? ['legacy fallback only; add .greprag/delivery.json before removing old prompt/skill authority'] : [],
|
|
185
|
+
errors: found ? [] : ['no delivery profile or legacy deploy/release source found'],
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=delivery-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-config.js","sourceRoot":"","sources":["../src/delivery-config.ts"],"names":[],"mappings":";AAAA,mDAAmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCnD,kDAEC;AAoGD,wDAwCC;AAlLD,uCAAyB;AACzB,2CAA6B;AAC7B,iCAAsC;AAkCtC,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,CAAC,CA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CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5F,MAAM,KAAK,GAAG,YAAY,IAAI,aAAa,IAAI,kBAAkB,CAAC;IAClE,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI;QACnE,YAAY,EAAE,aAAa,EAAE,kBAAkB;QAC/C,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,6FAA6F,CAAC,CAAC,CAAC,CAAC,EAAE;QACtH,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,2DAA2D,CAAC;KACnF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Lifecycle verbs governed by the announce-first Delivery System pilot. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DELIVERY_LIFECYCLE_VERBS = void 0;
|
|
5
|
+
exports.isDeliveryLifecycleVerb = isDeliveryLifecycleVerb;
|
|
6
|
+
exports.DELIVERY_LIFECYCLE_VERBS = [
|
|
7
|
+
'commit', 'merge', 'push', 'deploy', 'release',
|
|
8
|
+
];
|
|
9
|
+
const DELIVERY_LIFECYCLE_SET = new Set(exports.DELIVERY_LIFECYCLE_VERBS);
|
|
10
|
+
function isDeliveryLifecycleVerb(verb) {
|
|
11
|
+
return DELIVERY_LIFECYCLE_SET.has((verb || '').trim().toLowerCase());
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=delivery-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-lifecycle.js","sourceRoot":"","sources":["../src/delivery-lifecycle.ts"],"names":[],"mappings":";AAAA,4EAA4E;;;AAQ5E,0DAEC;AARY,QAAA,wBAAwB,GAAG;IACtC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS;CACtC,CAAC;AAEX,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAS,gCAAwB,CAAC,CAAC;AAEzE,SAAgB,uBAAuB,CAAC,IAAY;IAClD,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/hook.js
CHANGED
|
@@ -127,6 +127,8 @@ const procedure_1 = require("./procedure");
|
|
|
127
127
|
// per turn by the Stop hook (observeProcedureTurn), closed by negative
|
|
128
128
|
// continuity, distilled server-side, transitions applied to the local store.
|
|
129
129
|
const procedure_watch_1 = require("./procedure-watch");
|
|
130
|
+
const procedure_runtime_1 = require("./procedure-runtime");
|
|
131
|
+
const procedure_shadow_1 = require("./procedure-shadow");
|
|
130
132
|
const inline_atom_hook_1 = require("./inline-atom-hook");
|
|
131
133
|
const inline_atom_background_1 = require("./inline-atom-background");
|
|
132
134
|
const reminder_injector_1 = require("./reminder-injector");
|
|
@@ -805,7 +807,7 @@ async function observeProcedureTurn(cfg, anchor, turn, cwd, redaction) {
|
|
|
805
807
|
body: JSON.stringify({
|
|
806
808
|
projectName: anchor.projectName,
|
|
807
809
|
verb: watch.verb,
|
|
808
|
-
phase: watch.phase,
|
|
810
|
+
phase: watch.phase === 'SHADOW' ? 'REPLAY' : watch.phase,
|
|
809
811
|
digest,
|
|
810
812
|
turnCount: watch.turnCount + 1,
|
|
811
813
|
}),
|
|
@@ -833,7 +835,7 @@ async function observeProcedureTurn(cfg, anchor, turn, cwd, redaction) {
|
|
|
833
835
|
body: JSON.stringify({
|
|
834
836
|
projectName: anchor.projectName,
|
|
835
837
|
verb: next.verb,
|
|
836
|
-
phase: next.phase,
|
|
838
|
+
phase: next.phase === 'SHADOW' ? 'REPLAY' : next.phase,
|
|
837
839
|
digests: span,
|
|
838
840
|
}),
|
|
839
841
|
});
|
|
@@ -851,10 +853,22 @@ async function observeProcedureTurn(cfg, anchor, turn, cwd, redaction) {
|
|
|
851
853
|
? data.procedure.caveats : undefined,
|
|
852
854
|
}
|
|
853
855
|
: null;
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
856
|
+
if (next.phase === 'SHADOW' && next.shadowRunId) {
|
|
857
|
+
(0, procedure_shadow_1.recordProcedureShadowOutcome)({
|
|
858
|
+
projectId: anchor.projectId,
|
|
859
|
+
runId: next.shadowRunId,
|
|
860
|
+
verb: next.verb,
|
|
861
|
+
outcome,
|
|
862
|
+
span,
|
|
863
|
+
candidate: distilled,
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
else {
|
|
867
|
+
const store = (0, procedure_1.readProcedureStore)(anchor.projectId);
|
|
868
|
+
const { store: nextStore, action } = (0, procedure_watch_1.applyDistillTransition)(store, next, outcome, distilled, (0, procedure_watch_1.learnTriggersForVerb)(next.verb, store));
|
|
869
|
+
if (action !== 'discarded')
|
|
870
|
+
(0, procedure_1.writeProcedureStore)(anchor.projectId, nextStore);
|
|
871
|
+
}
|
|
858
872
|
}
|
|
859
873
|
}
|
|
860
874
|
catch { /* judge down → no write; watch discarded (transition table row 4) */ }
|
|
@@ -1637,6 +1651,7 @@ async function recap(input, mode = 'plain', opts = {}) {
|
|
|
1637
1651
|
mechanicLive: announceMechanicLive,
|
|
1638
1652
|
platform,
|
|
1639
1653
|
projectName: anchor.projectName,
|
|
1654
|
+
deliveryRepo: (0, project_anchor_1.computeGitDerivedProjectId)(cwd) !== null,
|
|
1640
1655
|
setupWarning,
|
|
1641
1656
|
assistantDoctrine,
|
|
1642
1657
|
corpusApiDocs,
|
|
@@ -1769,35 +1784,14 @@ function codexSubagentStart(input) {
|
|
|
1769
1784
|
* a miss or any error never blocks the turn. The Tier-1 intent guard (in
|
|
1770
1785
|
* matchProcedure) suppresses keyword mention-not-request false-fires. */
|
|
1771
1786
|
async function procedureCheck(input) {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
const store = (0, procedure_1.readProcedureStore)(anchor.projectId);
|
|
1780
|
-
const raw = store.procedures.length
|
|
1781
|
-
? (0, procedure_1.matchProcedure)(prompt, store, { includeInactive: true }) : null;
|
|
1782
|
-
// Disabled/shadow is operational silence, independent of recipe reliability.
|
|
1783
|
-
if (raw && (0, procedure_1.effectiveInstall)(store, raw.procedure).state !== 'active')
|
|
1784
|
-
return;
|
|
1785
|
-
const m = raw;
|
|
1786
|
-
if (m && m.procedure.status !== 'stale') {
|
|
1787
|
-
(0, hook_runtime_1.writeAdditionalContext)(input.hook_event_name || 'UserPromptSubmit', (0, procedure_1.buildProcedureInjection)(m.procedure));
|
|
1788
|
-
(0, procedure_watch_1.openWatchIfIdle)(anchor.projectId, m.procedure.verb, 'REPLAY');
|
|
1789
|
-
return;
|
|
1790
|
-
}
|
|
1791
|
-
// LEARN path: a stale store hit, or a Tier-1 vocabulary hit with no
|
|
1792
|
-
// procedure for the verb. No injection either way.
|
|
1793
|
-
const lm = m || (0, procedure_watch_1.matchLearnTrigger)(prompt);
|
|
1794
|
-
if (!lm)
|
|
1795
|
-
return;
|
|
1796
|
-
if ((0, procedure_watch_1.isDestructiveVerb)(lm.procedure.verb, store))
|
|
1797
|
-
return; // never LEARN a destructive verb
|
|
1798
|
-
(0, procedure_watch_1.openWatchIfIdle)(anchor.projectId, lm.procedure.verb, 'LEARN');
|
|
1787
|
+
const result = (0, procedure_runtime_1.runProcedurePromptCheck)({
|
|
1788
|
+
cwd: input.cwd || process.cwd(),
|
|
1789
|
+
prompt: typeof input.prompt === 'string' ? input.prompt : '',
|
|
1790
|
+
sessionId: input.session_id,
|
|
1791
|
+
});
|
|
1792
|
+
if (result.additionalContext) {
|
|
1793
|
+
(0, hook_runtime_1.writeAdditionalContext)(input.hook_event_name || 'UserPromptSubmit', result.additionalContext);
|
|
1799
1794
|
}
|
|
1800
|
-
catch { /* fail-open — a procedure miss never blocks the turn */ }
|
|
1801
1795
|
}
|
|
1802
1796
|
async function notify(input, source = 'claude-code', chipContext) {
|
|
1803
1797
|
if (source === 'codex')
|