greprag 5.84.0 → 5.85.1
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/commands/agent-doctrine-file.js +5 -128
- package/dist/commands/agents.js +125 -846
- package/dist/commands/init.js +17 -29
- package/dist/commands/load.js +14 -36
- package/dist/commands/parity.js +1 -1
- package/dist/commands/skill-mirror-reminder.js +1 -18
- package/dist/commands/skill.js +137 -566
- package/dist/hook.js +30 -54
- package/dist/index.js +571 -573
- package/dist/native-adapter-refresh.js +15 -18
- package/dist/native-skill-mirror.js +11 -92
- package/dist/opencode-plugin.bundle.js +81 -283
- package/dist/skill-activation-manifest.js +14 -37
- package/dist/skill-git-ingest.js +300 -0
- package/dist/skill-landing.js +7 -173
- package/dist/skill-mirror-client.js +4 -280
- package/dist/skill-staleness.js +3 -6
- package/package.json +1 -1
- package/skill/mechanic/docs/skill-fix-conventions.md +1 -1
- package/skill/templates/os.md +1 -1
- package/skill/templates/prompt-audit.md +26 -49
- package/skill/templates/skill-change.md +15 -13
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/** Keep installed
|
|
2
|
+
/** Keep installed Codex/OpenCode launchers at canon.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Launchers were written only by explicit syncs (init, `skill mirror sync`),
|
|
5
|
+
* so a canon change ingested anywhere — another session, another machine —
|
|
6
|
+
* left them behind until someone re-synced by hand.
|
|
7
7
|
*
|
|
8
8
|
* SessionStart calls this with the mirror roster it already fetched. Detection
|
|
9
9
|
* is local: each managed adapter's stamps against the roster. Only a stale
|
|
@@ -16,7 +16,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.readAdapterStamps = readAdapterStamps;
|
|
17
17
|
exports.staleNativeAdapters = staleNativeAdapters;
|
|
18
18
|
exports.refreshNativeAdapters = refreshNativeAdapters;
|
|
19
|
-
const claude_lifecycle_cutover_1 = require("./claude-lifecycle-cutover");
|
|
20
19
|
const native_skill_mirror_1 = require("./native-skill-mirror");
|
|
21
20
|
const skill_mirror_files_1 = require("./skill-mirror-files");
|
|
22
21
|
/** The identity stamps a generated adapter carries in its frontmatter. */
|
|
@@ -37,8 +36,7 @@ function readAdapterStamps(content) {
|
|
|
37
36
|
function staleNativeAdapters(params) {
|
|
38
37
|
const globalRoot = (0, native_skill_mirror_1.nativeSkillRoot)(params.platform, params.homeDir);
|
|
39
38
|
const roots = [globalRoot];
|
|
40
|
-
|
|
41
|
-
const projectRoot = params.projectDir && params.platform !== 'claude-code'
|
|
39
|
+
const projectRoot = params.projectDir
|
|
42
40
|
? (0, native_skill_mirror_1.writerOwnedProjectSkillRoot)(params.platform, params.projectDir, params.homeDir)
|
|
43
41
|
: null;
|
|
44
42
|
if (projectRoot)
|
|
@@ -80,10 +78,11 @@ function staleNativeAdapters(params) {
|
|
|
80
78
|
}
|
|
81
79
|
/** Rewrite each stale managed adapter of this harness from canon, through the
|
|
82
80
|
* writer the sync commands use. One adapter per write, so a diverged one holds
|
|
83
|
-
* back no other. A harness without native adapters is a no-op
|
|
81
|
+
* back no other. A harness without native adapters is a no-op, Claude Code
|
|
82
|
+
* included: it reads skills from their git folders (adr/skill-ownership-git.md). */
|
|
84
83
|
async function refreshNativeAdapters(params) {
|
|
85
84
|
const platform = params.platform;
|
|
86
|
-
if (platform !== '
|
|
85
|
+
if (platform !== 'codex' && platform !== 'opencode') {
|
|
87
86
|
return { refreshed: 0, blocked: 0 };
|
|
88
87
|
}
|
|
89
88
|
const stale = staleNativeAdapters({ ...params, platform });
|
|
@@ -94,15 +93,13 @@ async function refreshNativeAdapters(params) {
|
|
|
94
93
|
if (!skill)
|
|
95
94
|
continue; // canon unreachable: the next session start retries
|
|
96
95
|
try {
|
|
97
|
-
const result =
|
|
98
|
-
|
|
99
|
-
:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
prune: false,
|
|
105
|
-
});
|
|
96
|
+
const result = (0, native_skill_mirror_1.applyNativeSkillMirror)({
|
|
97
|
+
platform,
|
|
98
|
+
skills: [skill],
|
|
99
|
+
homeDir: params.homeDir,
|
|
100
|
+
projectDir: params.projectDir,
|
|
101
|
+
prune: false,
|
|
102
|
+
});
|
|
106
103
|
refreshed += result.updated;
|
|
107
104
|
blocked += result.blocked;
|
|
108
105
|
}
|
|
@@ -321,130 +321,49 @@ function canonicalContentHash(skill) {
|
|
|
321
321
|
function canonicalLookupArgs(skill) {
|
|
322
322
|
return `--skill-id ${canonicalSkillId(skill)}`;
|
|
323
323
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
function canonicalEditArgs(skill) {
|
|
331
|
-
return [canonicalLookupArgs(skill), canonicalWriteArgs(skill)].filter(Boolean).join(' ');
|
|
332
|
-
}
|
|
333
|
-
function nativeCreationLocations(platform) {
|
|
334
|
-
if (platform === 'codex') {
|
|
335
|
-
return '`~/.codex/skills/<new-name>/SKILL.md` (global) or `<repo>/.agents/skills/<new-name>/SKILL.md` (project)';
|
|
336
|
-
}
|
|
337
|
-
if (platform === 'opencode') {
|
|
338
|
-
return '`~/.config/opencode/skills/<new-name>/SKILL.md` (global) or `<repo>/.opencode/skills/<new-name>/SKILL.md` (project)';
|
|
339
|
-
}
|
|
340
|
-
return '`~/.claude/skills/<new-name>/SKILL.md` (global) or `<repo>/.claude/skills/<new-name>/SKILL.md` (project)';
|
|
341
|
-
}
|
|
342
|
-
function renderChangeSkillLine(params) {
|
|
343
|
-
const exportCommand = `greprag skill mirror export ${params.skillName} ${params.identityArg} --to <dir>`;
|
|
344
|
-
const applyCommand = `greprag skill mirror apply <dir> --skill ${params.skillName} ${params.editArgs} --expected-hash <exported-hash> --reason "<why>"`;
|
|
345
|
-
if (params.platform === 'codex') {
|
|
346
|
-
return `- **Change this skill:** run \`greprag load skill-change\`, then \`${exportCommand}\`; patch the exported Markdown files non-interactively; run \`${applyCommand}\`; then \`${params.syncCommand}\`; then verify with \`${params.loadCommand}\`.`;
|
|
347
|
-
}
|
|
348
|
-
return `- **Change this skill:** run \`greprag load skill-change\`, then \`greprag skill edit ${params.skillName} ${params.editArgs} --reason "<why>"\`, then \`${params.syncCommand}\`, then verify with \`${params.loadCommand}\`.`;
|
|
349
|
-
}
|
|
350
|
-
function renderEditingSection(platform, params) {
|
|
351
|
-
const exportCommand = `greprag skill mirror export ${params.skillName} ${params.identityArg} --to <dir>`;
|
|
352
|
-
const applyCommand = `greprag skill mirror apply <dir> --skill ${params.skillName} ${params.editArgs} --expected-hash <exported-hash> --reason "<why>"`;
|
|
353
|
-
if (platform === 'codex') {
|
|
354
|
-
return `## Editing
|
|
355
|
-
|
|
356
|
-
Codex agents must use the non-interactive mirror path:
|
|
357
|
-
|
|
358
|
-
\`\`\`bash
|
|
359
|
-
${exportCommand}
|
|
360
|
-
# patch the exported Markdown files with normal file edits
|
|
361
|
-
${applyCommand}
|
|
362
|
-
\`\`\`
|
|
363
|
-
|
|
364
|
-
Do not launch an interactive editor from Codex. If using \`greprag skill edit\` as an export helper, include \`--no-open\` and run the printed apply command after patching.
|
|
365
|
-
`;
|
|
366
|
-
}
|
|
367
|
-
return `## Editing
|
|
368
|
-
|
|
369
|
-
To edit this skill, run the guarded editor flow:
|
|
370
|
-
|
|
371
|
-
\`\`\`bash
|
|
372
|
-
greprag skill edit ${params.skillName} ${params.editArgs} --reason "<why>"
|
|
373
|
-
\`\`\`
|
|
374
|
-
|
|
375
|
-
Manual path:
|
|
376
|
-
|
|
377
|
-
\`\`\`bash
|
|
378
|
-
${exportCommand}
|
|
379
|
-
${applyCommand}
|
|
380
|
-
\`\`\`
|
|
381
|
-
`;
|
|
324
|
+
/** Where the skill's one true copy lives: git. adr: adr/skill-ownership-git.md */
|
|
325
|
+
function gitSkillFolder(skill) {
|
|
326
|
+
return skill.scope === 'project'
|
|
327
|
+
? `\`<repo>/.claude/skills/${skill.skillName}/\`${skill.projectName ? ` in the ${skill.projectName} repo` : ''}`
|
|
328
|
+
: `\`~/.claude/skills/${skill.skillName}/\` in the dotclaude repo`;
|
|
382
329
|
}
|
|
383
330
|
function renderAdapterBody(platform, skill) {
|
|
384
331
|
const skillName = skill.skillName;
|
|
385
332
|
const skillId = canonicalSkillId(skill);
|
|
386
333
|
const identityArg = canonicalLookupArgs(skill);
|
|
387
|
-
const editArgs = canonicalEditArgs(skill);
|
|
388
|
-
const creationLocations = nativeCreationLocations(platform);
|
|
389
334
|
const syncCommand = (0, skill_activation_manifest_1.nativeAdapterInstallCommand)(platform, [skillName]);
|
|
390
|
-
const creationLine = platform === 'claude-code'
|
|
391
|
-
? '- **Create another skill:** use the normal native creation path and leave it unmanaged until a separate Claude cutover is approved.'
|
|
392
|
-
: `- **Create another skill:** create a normal native skill at ${creationLocations}; run \`${syncCommand} --dry-run\` and confirm it says \`adopt\`; then run \`${syncCommand}\`. GrepRAG adopts it as canon and replaces the native package with an adapter.`;
|
|
393
335
|
const companions = skill.files.map(file => file.path).filter(relative => relative !== 'SKILL.md').sort();
|
|
394
336
|
const harnessArg = `--harness ${platform}`;
|
|
395
337
|
const loadCommand = `greprag load ${skillName} ${identityArg} ${harnessArg}`;
|
|
396
|
-
const changeSkillLine = renderChangeSkillLine({
|
|
397
|
-
platform,
|
|
398
|
-
skillName,
|
|
399
|
-
editArgs,
|
|
400
|
-
identityArg,
|
|
401
|
-
syncCommand,
|
|
402
|
-
loadCommand,
|
|
403
|
-
});
|
|
404
|
-
const editingSection = renderEditingSection(platform, { skillName, editArgs, identityArg });
|
|
405
338
|
const companionLines = companions.length
|
|
406
339
|
? companions.map(relative => `- \`greprag load ${skillName} ${relative} ${identityArg} ${harnessArg}\``).join('\n')
|
|
407
|
-
: '- No companion docs are mirrored into this
|
|
340
|
+
: '- No companion docs are mirrored into this launcher.';
|
|
408
341
|
return `# ${skillName}
|
|
409
342
|
|
|
410
343
|
## GENERATED ADAPTER — NEVER EDIT
|
|
411
344
|
|
|
412
|
-
This is a disposable GrepRAG launcher for ${platform}, not
|
|
413
|
-
|
|
414
|
-
Do not add or maintain project-state/doc pointers here. Current project state belongs in repo docs and the GrepRAG doc mirror; \`greprag load ${skillName} ${identityArg} ${harnessArg}\` discovers relevant state docs dynamically.
|
|
345
|
+
This is a disposable GrepRAG launcher for ${platform}, not skill content. The skill lives in git at ${gitSkillFolder(skill)}; GrepRAG mirrors the committed files read-only and this launcher loads them.
|
|
415
346
|
|
|
416
347
|
Required action chains:
|
|
417
348
|
|
|
418
349
|
- **Use this skill:** run \`${loadCommand}\` before acting.
|
|
419
|
-
${
|
|
420
|
-
|
|
350
|
+
- **Change this skill:** edit ${gitSkillFolder(skill)} with normal file edits, commit, then run \`${syncCommand}\` (session start does it too) and verify with \`${loadCommand}\`. Uncommitted edits are never served. History and rollback are git log / git revert on that folder.
|
|
351
|
+
- **Create another skill:** create \`~/.claude/skills/<new-name>/SKILL.md\` (dotclaude repo, global) or \`<repo>/.claude/skills/<new-name>/SKILL.md\` (project), commit, then run \`${syncCommand}\`.
|
|
421
352
|
|
|
422
353
|
Authority: ${skillId}
|
|
423
354
|
Source binding: ${sourceBindingState(skill)}
|
|
424
355
|
Canonical content hash: ${canonicalContentHash(skill)}
|
|
425
356
|
${typeof skill.revision === 'number' ? `Mirror revision: ${skill.revision}` : 'Mirror revision: unknown'}
|
|
426
357
|
|
|
427
|
-
${editingSection}
|
|
428
|
-
|
|
429
|
-
History and rollback (every canon write keeps its bytes and reason):
|
|
430
|
-
|
|
431
|
-
\`\`\`bash
|
|
432
|
-
greprag skill history ${skillName} ${identityArg}
|
|
433
|
-
greprag skill diff ${skillName} <revA> [<revB>] ${identityArg}
|
|
434
|
-
greprag skill revert ${skillName} --to <rev> ${identityArg} --reason "<why>" --expected-hash <current-hash>
|
|
435
|
-
greprag skill mirror snapshot list ${skillName} ${identityArg}
|
|
436
|
-
greprag skill mirror snapshot promote ${skillName} --name <snapshot> ${editArgs} --expected-hash <current-hash> --reason "<why>"
|
|
437
|
-
\`\`\`
|
|
438
|
-
|
|
439
358
|
## Mandatory Invocation
|
|
440
359
|
|
|
441
360
|
When this skill activates, run:
|
|
442
361
|
|
|
443
362
|
\`\`\`bash
|
|
444
|
-
|
|
363
|
+
${loadCommand}
|
|
445
364
|
\`\`\`
|
|
446
365
|
|
|
447
|
-
Read and follow that
|
|
366
|
+
Read and follow that payload before responding or taking action.
|
|
448
367
|
|
|
449
368
|
## Companion Docs
|
|
450
369
|
|