greprag 5.84.0 → 5.85.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/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 +5 -5
- 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 +297 -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,65 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
2
|
+
/** Instruction-file cleanup used by `greprag init`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* GrepRAG no longer holds instruction canon or materializes followers
|
|
5
|
+
* (adr/skill-ownership-git.md); this only drops the install marker an older
|
|
6
|
+
* CLI wrote into a user's CLAUDE.md.
|
|
6
7
|
*/
|
|
7
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
-
var ownKeys = function(o) {
|
|
25
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
-
var ar = [];
|
|
27
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
return ownKeys(o);
|
|
31
|
-
};
|
|
32
|
-
return function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.doctrineRenderHash = doctrineRenderHash;
|
|
42
|
-
exports.extractDoctrineFollowerBody = extractDoctrineFollowerBody;
|
|
43
9
|
exports.stripLegacyGrepRagConventionBlocks = stripLegacyGrepRagConventionBlocks;
|
|
44
|
-
exports.renderDoctrineFollower = renderDoctrineFollower;
|
|
45
|
-
exports.planDoctrineFollowerWrite = planDoctrineFollowerWrite;
|
|
46
|
-
const crypto = __importStar(require("node:crypto"));
|
|
47
|
-
function doctrineRenderHash(value) {
|
|
48
|
-
return crypto.createHash('sha256').update(value).digest('hex');
|
|
49
|
-
}
|
|
50
|
-
const LEGACY_BLOCK_RE = /<!--\s*greprag:agents:start\s+scope=\S+\s+harness=\S+\s+revision=(\d+)\s+hash=([a-f0-9]{64})(?:\s+chars=(\d+))?\s*-->\r?\n([\s\S]*?)<!--\s*greprag:agents:end\s*-->/i;
|
|
51
10
|
const LEGACY_GREPRAG_CONVENTIONS_BLOCK_RE = /(?:\r?\n)?<!--\s*greprag-conventions:start\b[^>]*-->\r?\n[\s\S]*?<!--\s*greprag-conventions:end\b[^>]*-->(?:\r?\n)?/gi;
|
|
52
|
-
/**
|
|
53
|
-
function extractDoctrineFollowerBody(source) {
|
|
54
|
-
const match = source.match(LEGACY_BLOCK_RE);
|
|
55
|
-
if (!match)
|
|
56
|
-
return null;
|
|
57
|
-
const chars = match[3] === undefined ? null : Number(match[3]);
|
|
58
|
-
const captured = match[4];
|
|
59
|
-
return chars === null ? captured.replace(/\r?\n$/, '') : captured.slice(0, chars);
|
|
60
|
-
}
|
|
61
|
-
/** Drop GrepRAG's old harness-specific install marker before promoting a
|
|
62
|
-
* full instruction file to canonical doctrine. The marker block was an
|
|
11
|
+
/** Drop GrepRAG's old harness-specific install marker. The marker block was an
|
|
63
12
|
* activation shim, not user-authored doctrine; chip-spawn activation now rides
|
|
64
13
|
* harness-specific SessionStart announces and `greprag load` entries. */
|
|
65
14
|
function stripLegacyGrepRagConventionBlocks(source) {
|
|
@@ -69,75 +18,3 @@ function stripLegacyGrepRagConventionBlocks(source) {
|
|
|
69
18
|
return hadLeadingNewline && hadTrailingNewline ? '\n' : '';
|
|
70
19
|
});
|
|
71
20
|
}
|
|
72
|
-
function renderDoctrineFollower(render) {
|
|
73
|
-
return render.body;
|
|
74
|
-
}
|
|
75
|
-
function hasSyncedBaseline(baseline) {
|
|
76
|
-
return !!baseline?.syncedHash && /^[a-f0-9]{64}$/i.test(baseline.syncedHash);
|
|
77
|
-
}
|
|
78
|
-
function canonChangedSinceBaseline(baseline, render, renderHash) {
|
|
79
|
-
if (!hasSyncedBaseline(baseline))
|
|
80
|
-
return false;
|
|
81
|
-
return baseline.syncedRevision !== render.revision || baseline.syncedHash !== renderHash;
|
|
82
|
-
}
|
|
83
|
-
/** Plan a full-file follower write.
|
|
84
|
-
*
|
|
85
|
-
* No marker comments are generated. A write is automatic only when the file is
|
|
86
|
-
* empty/missing, already exactly current, or still equals its last verified
|
|
87
|
-
* baseline. If both canon and disk changed since that baseline, the caller gets
|
|
88
|
-
* `conflict` and must not write.
|
|
89
|
-
*/
|
|
90
|
-
function planDoctrineFollowerWrite(source, render, baseline, options = {}) {
|
|
91
|
-
const body = renderDoctrineFollower(render);
|
|
92
|
-
const renderHash = doctrineRenderHash(body);
|
|
93
|
-
const sourceHash = doctrineRenderHash(source);
|
|
94
|
-
const baselineHash = baseline?.syncedHash?.toLowerCase() || null;
|
|
95
|
-
const synced = hasSyncedBaseline(baseline);
|
|
96
|
-
if (sourceHash === renderHash) {
|
|
97
|
-
return {
|
|
98
|
-
action: 'current',
|
|
99
|
-
content: source,
|
|
100
|
-
renderHash,
|
|
101
|
-
shouldReportSync: baseline?.syncedRevision !== render.revision || baselineHash !== renderHash,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
if (options.force) {
|
|
105
|
-
return { action: 'force', content: body, renderHash, shouldReportSync: true };
|
|
106
|
-
}
|
|
107
|
-
if (!source.trim()) {
|
|
108
|
-
return { action: 'seed', content: body, renderHash, shouldReportSync: true };
|
|
109
|
-
}
|
|
110
|
-
if (!synced) {
|
|
111
|
-
return {
|
|
112
|
-
action: 'unmanaged',
|
|
113
|
-
content: source,
|
|
114
|
-
renderHash,
|
|
115
|
-
shouldReportSync: false,
|
|
116
|
-
reason: 'file has no external sync baseline; enroll only when bytes already match canon or use --force',
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
const diskChanged = sourceHash !== baselineHash;
|
|
120
|
-
const canonChanged = canonChangedSinceBaseline(baseline, render, renderHash);
|
|
121
|
-
const dirty = !!baseline?.dirtyAt && (!baseline.syncedAt || baseline.dirtyAt > baseline.syncedAt);
|
|
122
|
-
if (!diskChanged && canonChanged) {
|
|
123
|
-
return { action: 'update', content: body, renderHash, shouldReportSync: true };
|
|
124
|
-
}
|
|
125
|
-
if (diskChanged && canonChanged) {
|
|
126
|
-
return {
|
|
127
|
-
action: 'conflict',
|
|
128
|
-
content: source,
|
|
129
|
-
renderHash,
|
|
130
|
-
shouldReportSync: false,
|
|
131
|
-
reason: 'both canon and follower changed since the last verified sync; pull or reconcile explicitly',
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
action: 'local-change',
|
|
136
|
-
content: source,
|
|
137
|
-
renderHash,
|
|
138
|
-
shouldReportSync: false,
|
|
139
|
-
reason: dirty
|
|
140
|
-
? 'follower has a worthy direct edit after sync; pull it to canon or revert it before push'
|
|
141
|
-
: 'follower changed since the last verified sync; pull it to canon or revert it before push',
|
|
142
|
-
};
|
|
143
|
-
}
|