greprag 5.65.2 → 5.65.3
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/codex-chip-hooks.js +2 -2
- package/dist/codex-chip-hooks.js.map +1 -1
- package/dist/commands/agent-doctrine-file.d.ts +27 -9
- package/dist/commands/agent-doctrine-file.js +74 -47
- package/dist/commands/agent-doctrine-file.js.map +1 -1
- package/dist/commands/agents.d.ts +2 -2
- package/dist/commands/agents.js +167 -48
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/codex-chip/command.js +4 -2
- package/dist/commands/codex-chip/command.js.map +1 -1
- package/dist/commands/codex-chip/goals.d.ts +3 -3
- package/dist/commands/codex-chip/goals.js +3 -3
- package/dist/commands/codex-chip/goals.js.map +1 -1
- package/dist/commands/codex-chip/help.d.ts +1 -1
- package/dist/commands/codex-chip/help.js +4 -3
- package/dist/commands/codex-chip/help.js.map +1 -1
- package/dist/commands/codex-chip/model.d.ts +6 -2
- package/dist/commands/codex-chip/model.js +12 -2
- package/dist/commands/codex-chip/model.js.map +1 -1
- package/dist/commands/codex-chip/native.js +2 -2
- package/dist/commands/codex-chip/native.js.map +1 -1
- package/dist/commands/codex-chip/prompt.js +8 -4
- package/dist/commands/codex-chip/prompt.js.map +1 -1
- package/dist/commands/codex-chip/selection.d.ts +5 -4
- package/dist/commands/codex-chip/selection.js +28 -9
- package/dist/commands/codex-chip/selection.js.map +1 -1
- package/dist/commands/codex-model-policy.d.ts +1 -1
- package/dist/commands/codex-model-policy.js +17 -6
- package/dist/commands/codex-model-policy.js.map +1 -1
- package/dist/commands/codex.js +1 -1
- package/dist/commands/init.js +19 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/load-primer-reminder.js +1 -1
- package/dist/commands/load-primer-reminder.js.map +1 -1
- package/dist/commands/mechanic-spawn.js +1 -1
- package/dist/commands/mechanic-spawn.js.map +1 -1
- package/dist/commands/opencode-chip-mission.d.ts +4 -4
- package/dist/commands/opencode-chip-mission.js.map +1 -1
- package/dist/commands/opencode-chip-store.d.ts +2 -2
- package/dist/commands/opencode-chip.js +3 -2
- package/dist/commands/opencode-chip.js.map +1 -1
- package/dist/commands/parity.js +1 -1
- package/dist/commands/skill-mirror-reminder.d.ts +3 -4
- package/dist/commands/skill-mirror-reminder.js +13 -8
- package/dist/commands/skill-mirror-reminder.js.map +1 -1
- package/dist/commands/skill.js +28 -0
- package/dist/commands/skill.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/native-skill-mirror.d.ts +30 -0
- package/dist/native-skill-mirror.js +230 -0
- package/dist/native-skill-mirror.js.map +1 -0
- package/dist/opencode-plugin.bundle.js +9 -4
- package/dist/skill-mirror-client.d.ts +2 -5
- package/dist/skill-mirror-client.js +18 -6
- package/dist/skill-mirror-client.js.map +1 -1
- package/dist/skill-mirror-files.d.ts +6 -0
- package/dist/skill-mirror-files.js +51 -0
- package/dist/skill-mirror-files.js.map +1 -0
- package/package.json +1 -1
- package/skill/greprag/docs/codex-chip.md +4 -3
- package/skill/templates/chip-leader.md +37 -15
- package/skill/templates/codex-chip-spawn.md +40 -25
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Materialize exact GrepRAG skill mirrors into native harness registries. */
|
|
2
|
+
import { type SkillFile } from './skill-mirror-files';
|
|
3
|
+
export type NativeSkillPlatform = 'claude-code' | 'codex' | 'opencode';
|
|
4
|
+
export interface NativeMirroredSkill {
|
|
5
|
+
skillName: string;
|
|
6
|
+
files: SkillFile[];
|
|
7
|
+
}
|
|
8
|
+
export interface NativeSkillMirrorResult {
|
|
9
|
+
installed: number;
|
|
10
|
+
updated: number;
|
|
11
|
+
current: number;
|
|
12
|
+
removed: number;
|
|
13
|
+
skipped: number;
|
|
14
|
+
blocked: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function nativeSkillRoot(platform: NativeSkillPlatform, homeDir?: string): string;
|
|
17
|
+
/** Apply an exact snapshot. Existing non-GrepRAG directories are never touched. */
|
|
18
|
+
export declare function applyNativeSkillMirror(params: {
|
|
19
|
+
platform: NativeSkillPlatform;
|
|
20
|
+
skills: NativeMirroredSkill[];
|
|
21
|
+
homeDir?: string;
|
|
22
|
+
prune?: boolean;
|
|
23
|
+
}): NativeSkillMirrorResult;
|
|
24
|
+
export declare function syncNativeSkillMirror(params: {
|
|
25
|
+
platform: NativeSkillPlatform;
|
|
26
|
+
apiUrl: string;
|
|
27
|
+
apiKey: string;
|
|
28
|
+
homeDir?: string;
|
|
29
|
+
}): Promise<NativeSkillMirrorResult>;
|
|
30
|
+
export declare function nativeSkillMirrorSummary(result: NativeSkillMirrorResult): string;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Materialize exact GrepRAG skill mirrors into native harness registries. */
|
|
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.nativeSkillRoot = nativeSkillRoot;
|
|
38
|
+
exports.applyNativeSkillMirror = applyNativeSkillMirror;
|
|
39
|
+
exports.syncNativeSkillMirror = syncNativeSkillMirror;
|
|
40
|
+
exports.nativeSkillMirrorSummary = nativeSkillMirrorSummary;
|
|
41
|
+
const fs = __importStar(require("node:fs"));
|
|
42
|
+
const os = __importStar(require("node:os"));
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const skill_mirror_files_1 = require("./skill-mirror-files");
|
|
45
|
+
const SKILL_NAME_RE = /^[A-Za-z0-9._-]{1,64}$/;
|
|
46
|
+
const STATE_FILE = '.greprag-mirror.json';
|
|
47
|
+
function nativeSkillRoot(platform, homeDir = os.homedir()) {
|
|
48
|
+
if (platform === 'claude-code')
|
|
49
|
+
return path.join(homeDir, '.claude', 'skills');
|
|
50
|
+
if (platform === 'codex')
|
|
51
|
+
return path.join(homeDir, '.codex', 'skills');
|
|
52
|
+
return path.join(homeDir, '.config', 'opencode', 'skills');
|
|
53
|
+
}
|
|
54
|
+
function emptyState() {
|
|
55
|
+
return { version: 1, skills: {} };
|
|
56
|
+
}
|
|
57
|
+
function readState(root) {
|
|
58
|
+
try {
|
|
59
|
+
const parsed = JSON.parse(fs.readFileSync(path.join(root, STATE_FILE), 'utf8'));
|
|
60
|
+
if (parsed?.version === 1 && parsed.skills && typeof parsed.skills === 'object')
|
|
61
|
+
return parsed;
|
|
62
|
+
}
|
|
63
|
+
catch { /* first run or corrupt state: existing directories remain unmanaged */ }
|
|
64
|
+
return emptyState();
|
|
65
|
+
}
|
|
66
|
+
function writeState(root, state) {
|
|
67
|
+
fs.mkdirSync(root, { recursive: true });
|
|
68
|
+
fs.writeFileSync(path.join(root, STATE_FILE), JSON.stringify(state, null, 2) + '\n', 'utf8');
|
|
69
|
+
}
|
|
70
|
+
function targetPath(root, skillName) {
|
|
71
|
+
const target = path.resolve(root, skillName);
|
|
72
|
+
const prefix = path.resolve(root) + path.sep;
|
|
73
|
+
if (!target.startsWith(prefix))
|
|
74
|
+
throw new Error('skill target escapes native root');
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
77
|
+
function filePath(target, relative) {
|
|
78
|
+
const resolved = path.resolve(target, ...relative.split('/'));
|
|
79
|
+
const prefix = path.resolve(target) + path.sep;
|
|
80
|
+
if (!resolved.startsWith(prefix))
|
|
81
|
+
throw new Error('skill file escapes target directory');
|
|
82
|
+
return resolved;
|
|
83
|
+
}
|
|
84
|
+
function readManagedFiles(target, managed) {
|
|
85
|
+
try {
|
|
86
|
+
return managed.files.map(relative => ({
|
|
87
|
+
path: relative,
|
|
88
|
+
content: fs.readFileSync(filePath(target, relative), 'utf8'),
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function removeTrackedFiles(target, relativeFiles) {
|
|
96
|
+
const directories = new Set();
|
|
97
|
+
for (const relative of relativeFiles) {
|
|
98
|
+
const file = filePath(target, relative);
|
|
99
|
+
try {
|
|
100
|
+
fs.unlinkSync(file);
|
|
101
|
+
}
|
|
102
|
+
catch { /* missing or locked: preserve and continue */ }
|
|
103
|
+
let dir = path.dirname(file);
|
|
104
|
+
while (dir.startsWith(path.resolve(target) + path.sep)) {
|
|
105
|
+
directories.add(dir);
|
|
106
|
+
dir = path.dirname(dir);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const dir of [...directories].sort((a, b) => b.length - a.length)) {
|
|
110
|
+
try {
|
|
111
|
+
fs.rmdirSync(dir);
|
|
112
|
+
}
|
|
113
|
+
catch { /* nonempty directories are preserved */ }
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
fs.rmdirSync(target);
|
|
117
|
+
}
|
|
118
|
+
catch { /* nonempty target is preserved */ }
|
|
119
|
+
}
|
|
120
|
+
/** Apply an exact snapshot. Existing non-GrepRAG directories are never touched. */
|
|
121
|
+
function applyNativeSkillMirror(params) {
|
|
122
|
+
const root = nativeSkillRoot(params.platform, params.homeDir);
|
|
123
|
+
const state = readState(root);
|
|
124
|
+
const result = {
|
|
125
|
+
installed: 0, updated: 0, current: 0, removed: 0, skipped: 0, blocked: 0,
|
|
126
|
+
};
|
|
127
|
+
const present = new Set();
|
|
128
|
+
for (const skill of params.skills) {
|
|
129
|
+
if (!SKILL_NAME_RE.test(skill.skillName)) {
|
|
130
|
+
result.skipped++;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
present.add(skill.skillName);
|
|
134
|
+
if (!skill.files.some(file => file.path === 'SKILL.md')
|
|
135
|
+
|| !skill.files.every(skill_mirror_files_1.isSafeMirroredSkillFile)) {
|
|
136
|
+
result.skipped++;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const target = targetPath(root, skill.skillName);
|
|
140
|
+
const managed = state.skills[skill.skillName];
|
|
141
|
+
if (fs.existsSync(target) && !managed) {
|
|
142
|
+
result.skipped++;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const nextHash = (0, skill_mirror_files_1.computeSkillFileHash)(skill.files);
|
|
146
|
+
if (managed) {
|
|
147
|
+
const currentFiles = readManagedFiles(target, managed);
|
|
148
|
+
if (!currentFiles || (0, skill_mirror_files_1.computeSkillFileHash)(currentFiles) !== managed.hash) {
|
|
149
|
+
result.blocked++;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (managed.hash === nextHash) {
|
|
153
|
+
result.current++;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
fs.mkdirSync(target, { recursive: true });
|
|
158
|
+
for (const file of skill.files) {
|
|
159
|
+
const destination = filePath(target, file.path);
|
|
160
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
161
|
+
fs.writeFileSync(destination, file.content, 'utf8');
|
|
162
|
+
}
|
|
163
|
+
if (managed) {
|
|
164
|
+
const nextPaths = new Set(skill.files.map(file => file.path));
|
|
165
|
+
removeTrackedFiles(target, managed.files.filter(relative => !nextPaths.has(relative)));
|
|
166
|
+
result.updated++;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
result.installed++;
|
|
170
|
+
}
|
|
171
|
+
state.skills[skill.skillName] = {
|
|
172
|
+
hash: nextHash,
|
|
173
|
+
files: skill.files.map(file => file.path).sort(),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (params.prune) {
|
|
177
|
+
for (const [skillName, managed] of Object.entries(state.skills)) {
|
|
178
|
+
if (present.has(skillName))
|
|
179
|
+
continue;
|
|
180
|
+
const target = targetPath(root, skillName);
|
|
181
|
+
const currentFiles = readManagedFiles(target, managed);
|
|
182
|
+
if (!currentFiles || (0, skill_mirror_files_1.computeSkillFileHash)(currentFiles) !== managed.hash) {
|
|
183
|
+
result.blocked++;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
removeTrackedFiles(target, managed.files);
|
|
187
|
+
delete state.skills[skillName];
|
|
188
|
+
result.removed++;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
writeState(root, state);
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
async function syncNativeSkillMirror(params) {
|
|
195
|
+
const list = await fetch(`${params.apiUrl}/v1/skillmirror`, {
|
|
196
|
+
headers: { Authorization: `Bearer ${params.apiKey}` },
|
|
197
|
+
});
|
|
198
|
+
if (!list.ok)
|
|
199
|
+
throw new Error(`skill mirror list failed: HTTP ${list.status}`);
|
|
200
|
+
const data = await list.json();
|
|
201
|
+
const names = (data.skills || [])
|
|
202
|
+
.map(row => row.skillName)
|
|
203
|
+
.filter((name) => typeof name === 'string' && SKILL_NAME_RE.test(name));
|
|
204
|
+
const fetched = await Promise.all(names.map(async (skillName) => {
|
|
205
|
+
const response = await fetch(`${params.apiUrl}/v1/skillmirror/${encodeURIComponent(skillName)}`, {
|
|
206
|
+
headers: { Authorization: `Bearer ${params.apiKey}` },
|
|
207
|
+
});
|
|
208
|
+
if (!response.ok)
|
|
209
|
+
return null;
|
|
210
|
+
const body = await response.json();
|
|
211
|
+
return Array.isArray(body.files) ? { skillName, files: body.files } : null;
|
|
212
|
+
}));
|
|
213
|
+
if (fetched.some(skill => skill === null)) {
|
|
214
|
+
throw new Error('skill mirror snapshot incomplete; existing native adapters preserved');
|
|
215
|
+
}
|
|
216
|
+
const skills = fetched;
|
|
217
|
+
return applyNativeSkillMirror({
|
|
218
|
+
platform: params.platform,
|
|
219
|
+
skills,
|
|
220
|
+
homeDir: params.homeDir,
|
|
221
|
+
prune: true,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function nativeSkillMirrorSummary(result) {
|
|
225
|
+
const active = result.installed + result.updated + result.current;
|
|
226
|
+
const exceptions = result.skipped + result.blocked;
|
|
227
|
+
return `Native skill mirror: ${active} active, ${result.removed} removed`
|
|
228
|
+
+ (exceptions ? `, ${exceptions} preserved collision(s)` : '');
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=native-skill-mirror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-skill-mirror.js","sourceRoot":"","sources":["../src/native-skill-mirror.ts"],"names":[],"mappings":";AAAA,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwC9E,0CAIC;AA8DD,wDA+EC;AAED,sDAgCC;A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GAAG,OAAgC,CAAC;IAChD,OAAO,sBAAsB,CAAC;QAC5B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM;QACN,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,wBAAwB,CAAC,MAA+B;IACtE,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAClE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACnD,OAAO,wBAAwB,MAAM,YAAY,MAAM,CAAC,OAAO,UAAU;UACrE,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1828,7 +1828,7 @@ var OPENCODE_CHIP_SPAWN_POINTER = [
|
|
|
1828
1828
|
].join("\n");
|
|
1829
1829
|
var CODEX_CHIP_SPAWN_POINTER = [
|
|
1830
1830
|
"[greprag Codex delegation \u2014 internal subagent, 1\u20132-chip quick path with the initiator as LEAD, or a separate LEAD for larger/seamed missions.]",
|
|
1831
|
-
"\u2022 About to delegate a Codex task? \u2192 run `greprag load codex-chip-spawn` FIRST. Use exact first-line titles `LEAD: <Mission
|
|
1831
|
+
"\u2022 About to delegate a Codex task? \u2192 run `greprag load codex-chip-spawn` FIRST. Use exact first-line titles `LEAD: <Mission>`, `Chip A/B/C: <Specific Purview>`, and `FIX: <one friction unit>`. Chips are ordinary writable native tasks; completion is a native Codex task reply to the LEAD after committing. A `FIX:` task loads `greprag load mechanic` first."
|
|
1832
1832
|
].join("\n");
|
|
1833
1833
|
var loadPrimerModule = {
|
|
1834
1834
|
id: "load-primer",
|
|
@@ -2224,9 +2224,14 @@ function buildSkillMirrorAnnounce(m) {
|
|
|
2224
2224
|
return `[greprag load skills: all ${m.count} canonical mirrored skills are already advertised by this harness; use \`greprag load <skill>\` to read the canonical payload.]`;
|
|
2225
2225
|
}
|
|
2226
2226
|
const header = [
|
|
2227
|
-
"## GrepRAG
|
|
2228
|
-
`
|
|
2229
|
-
"
|
|
2227
|
+
"## GrepRAG Skill Adapter Fallback",
|
|
2228
|
+
`Native registration is missing for ${m.skills.length} mirrored skills; their exact payload remains available through \`greprag load\`` + (m.nativeCount > 0 ? ` (${m.nativeCount} native-advertised duplicate${m.nativeCount === 1 ? "" : "s"} omitted)` : "") + ".",
|
|
2229
|
+
"",
|
|
2230
|
+
"### Trigger Rules",
|
|
2231
|
+
"If the user names a skill (with or without `/`) OR the request clearly matches a skill's description below, you MUST activate that skill for the current turn. Match meaning, not exact keywords.",
|
|
2232
|
+
"",
|
|
2233
|
+
"### Invocation",
|
|
2234
|
+
"To activate a skill, run `greprag load <skill-name>` before responding or taking action. Read the returned instructions completely, then follow them for the current turn.",
|
|
2230
2235
|
""
|
|
2231
2236
|
].join("\n");
|
|
2232
2237
|
let output = header;
|
|
@@ -9,10 +9,8 @@
|
|
|
9
9
|
* last-mirrored hash per skill so an unchanged skill costs one hash pass and
|
|
10
10
|
* ZERO network. Markdown only, v1 — SKILL.md + docs/**\/*.md; script-bearing
|
|
11
11
|
* assets stay file-bound (see the spec's named gaps). */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
content: string;
|
|
15
|
-
}
|
|
12
|
+
import { type SkillFile } from './skill-mirror-files';
|
|
13
|
+
export type { SkillFile } from './skill-mirror-files';
|
|
16
14
|
/** Collect the skill's markdown: SKILL.md (required) + docs/**\/*.md, capped.
|
|
17
15
|
* Returns null when the dir has no SKILL.md. Never throws. */
|
|
18
16
|
export declare function collectSkillFiles(skillDir: string): SkillFile[] | null;
|
|
@@ -34,4 +32,3 @@ export declare function maybeMirrorSkill(params: {
|
|
|
34
32
|
apiUrl: string;
|
|
35
33
|
apiKey: string;
|
|
36
34
|
}): Promise<MirrorOutcome>;
|
|
37
|
-
export {};
|
|
@@ -51,8 +51,9 @@ exports.writeMirrorState = writeMirrorState;
|
|
|
51
51
|
exports.maybeMirrorSkill = maybeMirrorSkill;
|
|
52
52
|
const fs = __importStar(require("fs"));
|
|
53
53
|
const path = __importStar(require("path"));
|
|
54
|
-
const crypto = __importStar(require("crypto"));
|
|
55
54
|
const skill_landing_1 = require("./skill-landing");
|
|
55
|
+
const native_skill_mirror_1 = require("./native-skill-mirror");
|
|
56
|
+
const skill_mirror_files_1 = require("./skill-mirror-files");
|
|
56
57
|
/** Mirrors the server's caps (SKILL_MIRROR_* in @greprag/core — the CLI is
|
|
57
58
|
* core-free, so the numbers are restated; the server re-validates anyway). */
|
|
58
59
|
const MAX_FILES = 20;
|
|
@@ -110,11 +111,19 @@ function collectSkillFiles(skillDir) {
|
|
|
110
111
|
}
|
|
111
112
|
/** Deterministic content hash over path+content pairs. PURE — unit-tested. */
|
|
112
113
|
function computeMirrorHash(files) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
return (0, skill_mirror_files_1.computeSkillFileHash)(files);
|
|
115
|
+
}
|
|
116
|
+
function materializeLocally(skillName, files) {
|
|
117
|
+
for (const platform of ['claude-code', 'codex', 'opencode']) {
|
|
118
|
+
try {
|
|
119
|
+
(0, native_skill_mirror_1.applyNativeSkillMirror)({
|
|
120
|
+
platform,
|
|
121
|
+
skills: [{ skillName, files }],
|
|
122
|
+
prune: false,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
catch { /* local adapter failure never breaks turn capture */ }
|
|
116
126
|
}
|
|
117
|
-
return h.digest('hex');
|
|
118
127
|
}
|
|
119
128
|
function statePath() {
|
|
120
129
|
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
@@ -152,8 +161,10 @@ async function maybeMirrorSkill(params) {
|
|
|
152
161
|
return 'skipped';
|
|
153
162
|
const hash = computeMirrorHash(files);
|
|
154
163
|
const state = readMirrorState();
|
|
155
|
-
if (state.skills[params.skill]?.hash === hash)
|
|
164
|
+
if (state.skills[params.skill]?.hash === hash) {
|
|
165
|
+
materializeLocally(params.skill, files);
|
|
156
166
|
return 'fresh';
|
|
167
|
+
}
|
|
157
168
|
const res = await fetch(`${params.apiUrl}/v1/skillmirror/${encodeURIComponent(params.skill)}`, {
|
|
158
169
|
method: 'POST',
|
|
159
170
|
headers: { 'Authorization': `Bearer ${params.apiKey}`, 'Content-Type': 'application/json' },
|
|
@@ -163,6 +174,7 @@ async function maybeMirrorSkill(params) {
|
|
|
163
174
|
return 'skipped';
|
|
164
175
|
state.skills[params.skill] = { hash, mirroredAt: new Date().toISOString() };
|
|
165
176
|
writeMirrorState(state);
|
|
177
|
+
materializeLocally(params.skill, files);
|
|
166
178
|
return 'mirrored';
|
|
167
179
|
}
|
|
168
180
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-mirror-client.js","sourceRoot":"","sources":["../src/skill-mirror-client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;0DAU0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"skill-mirror-client.js","sourceRoot":"","sources":["../src/skill-mirror-client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;0DAU0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiB1D,8CA8BC;AAGD,8CAEC;AAuBD,0CAQC;AAED,4CAMC;AAOD,4CAmCC;AAnID,uCAAyB;AACzB,2CAA6B;AAC7B,mDAAkD;AAClD,+DAAyF;AACzF,6DAA4E;AAE5E;+EAC+E;AAC/E,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,cAAc,GAAG,OAAO,CAAC;AAI/B;+DAC+D;AAC/D,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,IAAI,CAAC;QACH,MAAM,KAAK,GAAgB,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;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C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.computeSkillFileHash = computeSkillFileHash;
|
|
37
|
+
exports.isSafeMirroredSkillFile = isSafeMirroredSkillFile;
|
|
38
|
+
const crypto = __importStar(require("node:crypto"));
|
|
39
|
+
function computeSkillFileHash(files) {
|
|
40
|
+
const hash = crypto.createHash('sha256');
|
|
41
|
+
for (const file of [...files].sort((a, b) => a.path.localeCompare(b.path))) {
|
|
42
|
+
hash.update(file.path).update('\0').update(file.content).update('\0');
|
|
43
|
+
}
|
|
44
|
+
return hash.digest('hex');
|
|
45
|
+
}
|
|
46
|
+
function isSafeMirroredSkillFile(file) {
|
|
47
|
+
if (file.path === 'SKILL.md')
|
|
48
|
+
return true;
|
|
49
|
+
return /^docs\/(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9._\/-]+\.md$/.test(file.path);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=skill-mirror-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-mirror-files.js","sourceRoot":"","sources":["../src/skill-mirror-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,oDAMC;AAED,0DAGC;AAlBD,oDAAsC;AAOtC,SAAgB,oBAAoB,CAAC,KAAkB;IACrD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC3E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,SAAgB,uBAAuB,CAAC,IAAe;IACrD,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,yDAAyD,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,14 +6,15 @@ Use `greprag load codex-chip-spawn` for the three-primitives method:
|
|
|
6
6
|
worktree, manifest, inbox, or goal);
|
|
7
7
|
- quick mode: rename the current task `LEAD: <Mission>` and directly spawn
|
|
8
8
|
1–2 visible `Chip A/B: <Specific Purview>` worktree tasks;
|
|
9
|
-
- Leader mode:
|
|
9
|
+
- Leader mode: rename the current task `PLANNER: <Mission>`, then create a
|
|
10
|
+
separate `LEAD: <Mission>` task before that LEAD spawns
|
|
10
11
|
`Chip A/B/C: <Specific Purview>` children for seams or larger orchestration.
|
|
11
12
|
|
|
12
13
|
Normal chips are writable and own discovery, design, implementation, tests, and
|
|
13
14
|
commit. Preserve the Codex-provided worktree, committed result artifact, and
|
|
14
15
|
parent cleanup. The child opening prompt starts with the exact visible title
|
|
15
|
-
alone (`Chip A: <Specific Purview>`, `LEAD: <Mission>`, `
|
|
16
|
-
`
|
|
16
|
+
alone (`Chip A: <Specific Purview>`, `LEAD: <Mission>`, `PLANNER: <Mission>`,
|
|
17
|
+
`ADVISOR: <Purview>`, or `FIX: <one friction unit>`) and then has exactly three sections:
|
|
17
18
|
`Setup — do this FIRST`, `Task`, and `Report when done`. It has no lease,
|
|
18
19
|
read-only, mandatory nested-goal, or nonce/ACK requirement. Completion is the
|
|
19
20
|
native Codex parent-child task reply: commit the durable result, then reply to
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Leader Mission
|
|
1
|
+
# Planner + Leader Mission
|
|
2
2
|
|
|
3
3
|
Load this method when the work needs a dedicated orchestrator: more than the
|
|
4
4
|
quick 1–2 visible chips, shared files or contracts, ordering, integration, or
|
|
@@ -6,13 +6,23 @@ another coordination seam.
|
|
|
6
6
|
|
|
7
7
|
## Identity first
|
|
8
8
|
|
|
9
|
-
Before any child is created, the
|
|
10
|
-
|
|
9
|
+
This is the explicit Leader shape. Before any child is created, the initiating
|
|
10
|
+
task becomes the planner by renaming itself exactly:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
PLANNER: <Mission>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The PLANNER then creates one separate task whose exact first-line title is:
|
|
11
17
|
|
|
12
18
|
```text
|
|
13
19
|
LEAD: <Mission>
|
|
14
20
|
```
|
|
15
21
|
|
|
22
|
+
Do not leave the initiator unnamed, and do not name it LEAD when it creates a
|
|
23
|
+
separate LEAD. The title split makes planning authority and execution
|
|
24
|
+
leadership visible before fanout.
|
|
25
|
+
|
|
16
26
|
Children use the exact ordinal discoverability schema:
|
|
17
27
|
|
|
18
28
|
```text
|
|
@@ -24,13 +34,21 @@ Chip C: <Specific Purview>
|
|
|
24
34
|
Naming identifies the workstream and makes the task legible. It does not grant
|
|
25
35
|
execution authority; every child remains an ordinary writable chip.
|
|
26
36
|
|
|
37
|
+
<!-- adr: adr/codex-lead-native-goal.md -->
|
|
38
|
+
After the PLANNER creates it and before fanout, the dedicated LEAD creates a
|
|
39
|
+
native top-level mission goal with `create_goal`, then runs `get_goal` and
|
|
40
|
+
verifies the active goal names this mission before fanout. That native goal
|
|
41
|
+
tracks the LEAD mission; it is not a GrepRAG lease, durable manifest, or child
|
|
42
|
+
permission gate.
|
|
43
|
+
|
|
27
44
|
## Quick versus Leader
|
|
28
45
|
|
|
29
46
|
- **Quick:** the current task renames itself `LEAD: <Mission>` and directly
|
|
30
47
|
spawns 1–2 children. No separate leader task is created.
|
|
31
|
-
- **Leader:** the initiator
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
- **Leader:** the initiator first renames itself `PLANNER: <Mission>`, then
|
|
49
|
+
creates a separate `LEAD: <Mission>` task. That dedicated task owns
|
|
50
|
+
decomposition, child dispatch, seam reconciliation, checks, integration,
|
|
51
|
+
parent messaging, and cleanup.
|
|
34
52
|
|
|
35
53
|
This template is for the second shape. If the mission fits the quick shape,
|
|
36
54
|
load `greprag load codex-chip-spawn` and keep the initiator as the implicit
|
|
@@ -56,14 +74,18 @@ ordering in the brief rather than relying on hidden coordination metadata.
|
|
|
56
74
|
|
|
57
75
|
## Dispatch and closeout
|
|
58
76
|
|
|
59
|
-
1. Rename the
|
|
60
|
-
2.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
1. Rename the initiating task `PLANNER: <Mission>` before any child creation.
|
|
78
|
+
2. Create the separate `LEAD: <Mission>` task; do not dispatch worker chips
|
|
79
|
+
directly from the PLANNER.
|
|
80
|
+
3. In the dedicated LEAD, create the native top-level mission goal with
|
|
81
|
+
`create_goal`, then verify it with `get_goal`.
|
|
82
|
+
4. From the LEAD, spawn each `Chip A/B/C: <Specific Purview>` with its own
|
|
83
|
+
visible worktree and the mission context it needs.
|
|
84
|
+
A `FIX: <one friction unit>` child must make `greprag load mechanic` its
|
|
85
|
+
first Setup action before diagnosis or edits.
|
|
86
|
+
5. Keep children writable and let them investigate, edit, test, and commit
|
|
65
87
|
within their worktrees.
|
|
66
|
-
|
|
88
|
+
6. Require each child to return `DONE` or `BLOCKED` through the native
|
|
67
89
|
parent-child task result, including the commit, checks, and caveats. Use
|
|
68
90
|
`greprag send` only for explicit cross-harness or peer messaging:
|
|
69
91
|
|
|
@@ -73,9 +95,9 @@ ordering in the brief rather than relying on hidden coordination metadata.
|
|
|
73
95
|
--from-session <child-session>
|
|
74
96
|
```
|
|
75
97
|
|
|
76
|
-
|
|
98
|
+
7. Review reports, reconcile seams in the planned order, run the whole-mission
|
|
77
99
|
checks, and send the parent a concise closeout.
|
|
78
|
-
|
|
100
|
+
8. The parent owns integration and cleanup. Do not silently delete a child
|
|
79
101
|
worktree or treat a report as acceptance.
|
|
80
102
|
|
|
81
103
|
Do not introduce a separate read-only, lease, nested-goal, or delivery-proof
|