@juicesharp/rpiv-pi 2.6.0 → 2.6.2
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.
|
@@ -1035,7 +1035,9 @@ const sliceCovers = (entry: Record<string, unknown>): string[] => {
|
|
|
1035
1035
|
* tree file whose path ends with it on whole segments — bare basenames and
|
|
1036
1036
|
* package-relative forms both back the citation iff exactly ONE tree file
|
|
1037
1037
|
* matches; an ambiguous suffix stays unresolved (the finding names the
|
|
1038
|
-
* candidates so the fix arm can disambiguate)
|
|
1038
|
+
* candidates so the fix arm can disambiguate) unless one of two tiebreaks names
|
|
1039
|
+
* a single candidate: the caller's declared-`files:` union, then the nearest
|
|
1040
|
+
* preceding prose mention of a candidate's full path. A citation that names no real
|
|
1039
1041
|
* file, or points past end-of-file, is UNBACKED precision — a fabricated
|
|
1040
1042
|
* reference that must fail the gate rather than propagate into design. A bare
|
|
1041
1043
|
* `path` with no `:line` is not checked (the contract is "verifiable line
|
|
@@ -1062,7 +1064,8 @@ type BasenameIndex = { index: Map<string, string[]>; truncated: boolean };
|
|
|
1062
1064
|
* — mechanical path-prefix omissions, not fabricated references. The basename
|
|
1063
1065
|
* keys the candidates; `verifyCitations` narrows them by whole-segment suffix.
|
|
1064
1066
|
* A UNIQUE match backs the citation; an AMBIGUOUS one stays unresolved — unless
|
|
1065
|
-
* the caller's declared-`files:`
|
|
1067
|
+
* one of `verifyCitations`' tiebreaks (the caller's declared-`files:` union,
|
|
1068
|
+
* then the nearest preceding prose mention) names exactly one
|
|
1066
1069
|
* candidate — so the producer must disambiguate with the repo-root-relative
|
|
1067
1070
|
* path. Skips
|
|
1068
1071
|
* vendored/generated trees so a citation never resolves to a build copy or a
|
|
@@ -1174,6 +1177,55 @@ const resolveCitationPath = (
|
|
|
1174
1177
|
* for zero risk averted (three of f329's floor failures were this class). */
|
|
1175
1178
|
const PLACEHOLDER_CITATION_PREFIXES: readonly string[] = ["path/to/", "packages/x/"];
|
|
1176
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* Proximity tiebreak for a citation left ambiguous by the declared-`files:`
|
|
1182
|
+
* intersection: resolve to the candidate whose repo-root-relative path has the
|
|
1183
|
+
* nearest PRECEDING prose mention — the common artifact idiom of naming a file
|
|
1184
|
+
* once in full, then citing it by bare basename. Prose only: mentions inside
|
|
1185
|
+
* YAML frontmatter (`files:` ordering carries no authorial intent — a tie there
|
|
1186
|
+
* stays a tie) or fenced spans (example/fixture territory) don't count, and
|
|
1187
|
+
* matches are token-bounded so a candidate never back-matches inside a longer
|
|
1188
|
+
* path mention (`a/dup.ts` inside `x/a/dup.ts`). Returns the winner's absolute
|
|
1189
|
+
* path, or `undefined` — the citation then stays unbacked as before.
|
|
1190
|
+
*/
|
|
1191
|
+
const nearestProseMention = (
|
|
1192
|
+
body: string,
|
|
1193
|
+
upTo: number,
|
|
1194
|
+
candidates: readonly string[],
|
|
1195
|
+
cwd: string,
|
|
1196
|
+
fenced: readonly [number, number][],
|
|
1197
|
+
proseStart: number,
|
|
1198
|
+
): string | undefined => {
|
|
1199
|
+
let bestAbs: string | undefined;
|
|
1200
|
+
let bestIdx = -1;
|
|
1201
|
+
for (const abs of candidates) {
|
|
1202
|
+
if (!abs.startsWith(cwd + sep)) continue;
|
|
1203
|
+
const rel = abs
|
|
1204
|
+
.slice(cwd.length + 1)
|
|
1205
|
+
.split(sep)
|
|
1206
|
+
.join("/");
|
|
1207
|
+
// Walk mentions nearest-first; the first CLEAN one (token-bounded, in
|
|
1208
|
+
// prose, outside fences) is this candidate's best — earlier ones can't win.
|
|
1209
|
+
let from = upTo - rel.length;
|
|
1210
|
+
while (from >= 0) {
|
|
1211
|
+
const i = body.lastIndexOf(rel, from);
|
|
1212
|
+
if (i < 0 || i < proseStart) break;
|
|
1213
|
+
from = i - 1;
|
|
1214
|
+
const prev = i > 0 ? (body[i - 1] as string) : "";
|
|
1215
|
+
const next = body[i + rel.length] ?? "";
|
|
1216
|
+
if (prev !== "" && /[\w.@/-]/.test(prev)) continue;
|
|
1217
|
+
if (next !== "" && /[\w-]/.test(next)) continue;
|
|
1218
|
+
if (fenced.some(([s, e]) => i >= s && i < e)) continue;
|
|
1219
|
+
if (i > bestIdx) {
|
|
1220
|
+
bestIdx = i;
|
|
1221
|
+
bestAbs = abs;
|
|
1222
|
+
}
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
return bestAbs;
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1177
1229
|
const verifyCitations = (
|
|
1178
1230
|
body: string,
|
|
1179
1231
|
cwd: string,
|
|
@@ -1187,6 +1239,14 @@ const verifyCitations = (
|
|
|
1187
1239
|
// placeholder-pattern skip: a REAL citation that merely looks placeholder-ish
|
|
1188
1240
|
// still verifies when it appears in prose.
|
|
1189
1241
|
const fenced = fencedSpans(body);
|
|
1242
|
+
// Prose begins past the YAML frontmatter: the proximity tiebreak must not
|
|
1243
|
+
// read the `files:` array as a mention (its ordering carries no intent — a
|
|
1244
|
+
// tie inside the declared set stays a tie).
|
|
1245
|
+
let proseStart = 0;
|
|
1246
|
+
if (body.startsWith("---\n")) {
|
|
1247
|
+
const end = body.indexOf("\n---\n", 3);
|
|
1248
|
+
if (end !== -1) proseStart = end + "\n---\n".length;
|
|
1249
|
+
}
|
|
1190
1250
|
// Built lazily and reused across citations — only the first direct-resolution
|
|
1191
1251
|
// miss pays the tree walk, and only when at least one such citation exists.
|
|
1192
1252
|
const indexHolder: { value: BasenameIndex | undefined } = { value: undefined };
|
|
@@ -1218,6 +1278,12 @@ const verifyCitations = (
|
|
|
1218
1278
|
);
|
|
1219
1279
|
if (declaredMatches.length === 1) resolved = { abs: declaredMatches[0] };
|
|
1220
1280
|
}
|
|
1281
|
+
if (resolved && "ambiguous" in resolved) {
|
|
1282
|
+
// Proximity tiebreak: the nearest preceding prose mention of a
|
|
1283
|
+
// candidate's full path names the file the author means.
|
|
1284
|
+
const near = nearestProseMention(body, m.index, resolved.ambiguous, cwd, fenced, proseStart);
|
|
1285
|
+
if (near !== undefined) resolved = { abs: near };
|
|
1286
|
+
}
|
|
1221
1287
|
if (resolved && "ambiguous" in resolved) {
|
|
1222
1288
|
// More than one tree file matches — name the candidates so the fix arm can disambiguate.
|
|
1223
1289
|
const shown = resolved.ambiguous
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-pi",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "A skill-based development workflow for Pi Agent. 29 contract-carrying skills (discover → research → design → plan → implement → validate → code-review → commit, and more), the 15 named subagents they dispatch, and four built-in /wf workflows that chain them end to end in detached parallel runs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"!**/*.test.ts"
|
|
42
42
|
],
|
|
43
43
|
"pi": {
|
|
44
|
+
"image": "https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-pi/docs/cover.png",
|
|
44
45
|
"extensions": [
|
|
45
46
|
"./extensions"
|
|
46
47
|
],
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
]
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@juicesharp/rpiv-config": "^2.6.
|
|
53
|
+
"@juicesharp/rpiv-config": "^2.6.2",
|
|
53
54
|
"typebox": "^1.1.24"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|