@attalabs/vinaya 0.42.1 → 0.43.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/checks/bin/check-evidence-fresh.js +177 -152
- package/dist/checks/bin/check-registry-gates.js +10 -3
- package/dist/index.js +300 -173
- package/dist/lib/pre-push-cache-test-run.js +145 -144
- package/dist/lib/pre-push-changed-files.js +10 -3
- package/dist/lib/pre-push-progress-dir.js +169 -147
- package/dist/lib/pre-push-select-tests.js +16 -4
- package/dist/lib/push-progress-observer.js +169 -147
- package/dist/programs/archive.js +172 -148
- package/dist/programs/audit.js +169 -147
- package/dist/programs/check.js +172 -148
- package/dist/programs/commit-msg.js +172 -148
- package/dist/programs/dev-review-loop.js +300 -176
- package/dist/programs/dispatch.js +1905 -1877
- package/dist/programs/log-emit.js +172 -148
- package/dist/programs/log-selftest.js +172 -148
- package/dist/programs/log-send.js +172 -148
- package/dist/programs/pr-report.js +177 -152
- package/dist/programs/pr-snapshot.js +172 -148
- package/dist/programs/pr-verify-evidence.js +177 -152
- package/dist/programs/pr.js +172 -148
- package/dist/programs/review-post.js +172 -148
- package/dist/programs/review-status.js +180 -148
- package/dist/programs/run-engine.js +110594 -0
- package/dist/programs/supervised-command.js +67 -0
- package/dist/programs/sync.js +63 -39
- package/dist/programs/task-brief.js +174 -150
- package/dist/programs/task-sweep.js +244 -151
- package/dist/programs/task-tools-serve.js +260 -163
- package/dist/programs/tokens.js +172 -148
- package/dist/programs/waiver.js +172 -148
- package/dist/vinaya-strict/checks/registry.ts +1085 -0
- package/dist/vinaya-strict/executing/code-reviewer/README.md +3 -0
- package/dist/vinaya-strict/executing/code-reviewer/doctrine.md +185 -0
- package/dist/vinaya-strict/executing/code-reviewer/evals/README.md +1 -0
- package/dist/vinaya-strict/executing/code-reviewer/evals/code-reviewer-cases.json +280 -0
- package/dist/vinaya-strict/executing/code-reviewer/grants.yaml +22 -0
- package/dist/vinaya-strict/executing/code-reviewer/output.schema.json +93 -0
- package/dist/vinaya-strict/executing/code-reviewer/review-result.ts +347 -0
- package/dist/vinaya-strict/executing/dev-review.flow.yaml +103 -0
- package/dist/vinaya-strict/executing/developer/README.md +3 -0
- package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +69 -0
- package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +286 -0
- package/dist/vinaya-strict/executing/developer/doctrine.md +111 -0
- package/dist/vinaya-strict/executing/developer/evals/README.md +1 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-cases.json +6275 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-held-out.json +11526 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +498 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +1407 -0
- package/dist/vinaya-strict/executing/developer/grants.yaml +25 -0
- package/dist/vinaya-strict/executing/developer/output.schema.json +148 -0
- package/dist/vinaya-strict/executing/developer/reference.md +376 -0
- package/dist/vinaya-strict/executing/operator/doctrine.md +209 -0
- package/dist/vinaya-strict/executing/security-reviewer/README.md +3 -0
- package/dist/vinaya-strict/executing/security-reviewer/doctrine.md +171 -0
- package/dist/vinaya-strict/executing/security-reviewer/evals/README.md +1 -0
- package/dist/vinaya-strict/executing/security-reviewer/evals/security-reviewer-cases.json +141 -0
- package/dist/vinaya-strict/executing/security-reviewer/grants.yaml +22 -0
- package/dist/vinaya-strict/executing/security-reviewer/output.schema.json +93 -0
- package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +1278 -0
- package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +52 -0
- package/dist/vinaya-strict/integration/process/process-integration.ts +57 -0
- package/dist/vinaya-strict/loops/dev-review/v2/dev-review-v2.flow.yaml +136 -0
- package/dist/vinaya-strict/process.yaml +43 -0
- package/dist/vinaya-strict/retrospecting/archivist/doctrine.md +174 -0
- package/dist/vinaya-strict/retrospecting/tranche-archivist/doctrine.md +270 -0
- package/dist/vinaya-strict/thinking/architect/doctrine.md +110 -0
- package/dist/vinaya-strict/thinking/planner/doctrine.md +105 -0
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +128 -0
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +169 -0
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +701 -0
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +1035 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +359 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +815 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +200 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +458 -0
- package/package.json +4 -2
- package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
- /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { FIELD_LABEL, NEXT_HEADER, SECTION_HEADER } from '../../../tools/task-contract/forge/parse-rationale-deps'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Input to {@link amendRationaleDeps}. A field left `undefined` is untouched;
|
|
5
|
+
* a field set to `[]` writes the explicit empty marker `—`. `date` is injected
|
|
6
|
+
* by the caller (the bin/I-O layer), never generated in this pure function, so
|
|
7
|
+
* the rewrite stays deterministic and testable.
|
|
8
|
+
*/
|
|
9
|
+
export type AmendDepsInput = {
|
|
10
|
+
/** New `Depends-on` edge set. Omitted = leave that field's spans untouched. */
|
|
11
|
+
dependsOn?: string[]
|
|
12
|
+
/** New `Conflicts-with` edge set. `[]` = write the explicit empty marker `—`. */
|
|
13
|
+
conflictsWith?: string[]
|
|
14
|
+
/** The why — becomes the appended amendment paragraph's prose. */
|
|
15
|
+
note: string
|
|
16
|
+
/** `YYYY-MM-DD`, injected by the caller (bin), never generated here. */
|
|
17
|
+
date: string
|
|
18
|
+
/** Amendment author. Defaults to `Planner`. */
|
|
19
|
+
actor?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type FieldKey = 'dependsOn' | 'conflictsWith'
|
|
23
|
+
|
|
24
|
+
const FIELD_META: Record<FieldKey, { label: string }> = {
|
|
25
|
+
dependsOn: { label: 'Depends-on' },
|
|
26
|
+
conflictsWith: { label: 'Conflicts-with' }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Canonical comma-joined value for a field's span: the ids, or `—` when empty. */
|
|
30
|
+
function canonicalValue(ids: string[]): string {
|
|
31
|
+
return ids.length > 0 ? ids.join(', ') : '—'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type SpanHit = { start: number; end: number; inner: string; field: FieldKey }
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Scans the section's backtick spans left-to-right, carrying forward whichever
|
|
38
|
+
* field was last labeled, and returns in order every span so attributed to
|
|
39
|
+
* `field` — its labeled span first, then any bare continuation spans.
|
|
40
|
+
*
|
|
41
|
+
* This carry-forward is DELIBERATELY WIDER than the reader's: `parseRationaleDeps`
|
|
42
|
+
* reads edges from the labeled span only and ignores every
|
|
43
|
+
* other span; the writer keeps scanning so `rewriteField` can unwrap the bare
|
|
44
|
+
* continuation spans a body written in the old multi-span form still contains.
|
|
45
|
+
* Narrowing this to match the reader would leave those spans backticked in the
|
|
46
|
+
* rewritten body — harmless to the parse, but leaving stale ids beside a freshly
|
|
47
|
+
* amended field for a human to misread.
|
|
48
|
+
*
|
|
49
|
+
* It is wider than that job strictly needs, and not precise: EVERY span after a
|
|
50
|
+
* field's label is attributed to that field, so an unrelated prose span in the
|
|
51
|
+
* same paragraph is unwrapped too. A real body lost the backticks
|
|
52
|
+
* around its `` `vinaya check` `` command-name mention when its Depends-on was
|
|
53
|
+
* amended. That is cosmetic — the id set round-trips either way, and it predates
|
|
54
|
+
* the reader's own narrowing — but it is a wart, not a guarantee, and this
|
|
55
|
+
* comment should not be
|
|
56
|
+
* read as promising continuation spans are the only thing touched. Shares the
|
|
57
|
+
* parser's own `FIELD_LABEL` grammar either way; it does not re-implement it.
|
|
58
|
+
*/
|
|
59
|
+
function collectFieldSpans(section: string, field: FieldKey): SpanHit[] {
|
|
60
|
+
const hits: SpanHit[] = []
|
|
61
|
+
let current: FieldKey | null = null
|
|
62
|
+
const spanPattern = /`([^`]*)`/g
|
|
63
|
+
let match: RegExpExecArray | null = spanPattern.exec(section)
|
|
64
|
+
while (match !== null) {
|
|
65
|
+
const inner = match[1] ?? ''
|
|
66
|
+
const labelMatch = inner.trim().match(FIELD_LABEL)
|
|
67
|
+
if (labelMatch) {
|
|
68
|
+
current = labelMatch[1]?.toLowerCase() === 'conflicts-with' ? 'conflictsWith' : 'dependsOn'
|
|
69
|
+
}
|
|
70
|
+
if (current === field) {
|
|
71
|
+
hits.push({ start: match.index, end: match.index + match[0].length, inner, field })
|
|
72
|
+
}
|
|
73
|
+
match = spanPattern.exec(section)
|
|
74
|
+
}
|
|
75
|
+
return hits
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Rewrites one field's spans in the section to a single canonical comma-joined
|
|
80
|
+
* span carrying `ids`, dropping (unwrapping) that field's superseded bare
|
|
81
|
+
* continuation spans while leaving their surrounding prose intact. If the field
|
|
82
|
+
* has no span in the section yet, a fresh canonical span is appended. A short
|
|
83
|
+
* `(amended <date> — see Amendment below)` parenthetical is added beside the
|
|
84
|
+
* field's canonical span so a human reading the field alone is pointed at the
|
|
85
|
+
* amendment paragraph.
|
|
86
|
+
*/
|
|
87
|
+
function rewriteField(section: string, field: FieldKey, ids: string[], date: string): string {
|
|
88
|
+
const { label } = FIELD_META[field]
|
|
89
|
+
const value = canonicalValue(ids)
|
|
90
|
+
const canonicalSpan = `\`${label}: ${value}\` (amended ${date} — see Amendment below)`
|
|
91
|
+
const hits = collectFieldSpans(section, field)
|
|
92
|
+
|
|
93
|
+
if (hits.length === 0) {
|
|
94
|
+
// Field not present in the section — append a fresh canonical span before
|
|
95
|
+
// any trailing whitespace so it lands inside the section, not after its
|
|
96
|
+
// terminating blank line.
|
|
97
|
+
const trailing = section.match(/\s*$/)?.[0] ?? ''
|
|
98
|
+
const core = section.slice(0, section.length - trailing.length)
|
|
99
|
+
return `${core} ${canonicalSpan}.${trailing}`
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Apply replacements from LAST to FIRST so earlier offsets stay valid.
|
|
103
|
+
// First hit (always the labeled span) becomes the canonical span; every
|
|
104
|
+
// later hit (bare continuation) is unwrapped to its inner text — no longer a
|
|
105
|
+
// backtick span, so `parseRationaleDeps` no longer reads it.
|
|
106
|
+
let out = section
|
|
107
|
+
for (let i = hits.length - 1; i >= 0; i--) {
|
|
108
|
+
const hit = hits[i] as SpanHit
|
|
109
|
+
const replacement = i === 0 ? canonicalSpan : hit.inner
|
|
110
|
+
out = out.slice(0, hit.start) + replacement + out.slice(hit.end)
|
|
111
|
+
}
|
|
112
|
+
return out
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Atomically rewrites an Issue body's structured `Dependency rationale` edge
|
|
117
|
+
* set AND appends the matching `**Amendment (...)**` paragraph — the two halves
|
|
118
|
+
* that several live incidents drifted apart because nothing forced them to
|
|
119
|
+
* change together. Both happen in this one
|
|
120
|
+
* function; there is no way to do one without the other — the Ring 0 shape
|
|
121
|
+
* follows the rule that "the sanctioned path is
|
|
122
|
+
* the only path".
|
|
123
|
+
*
|
|
124
|
+
* Deterministic and pure — `date` is injected. The amendment paragraph is
|
|
125
|
+
* appended at the very END of the body, which keeps it structurally OUTSIDE the
|
|
126
|
+
* parsed section by construction: its leading `**Amendment ...**` bold header
|
|
127
|
+
* terminates the `parseRationaleDeps` section extractor (`NEXT_HEADER`), so the
|
|
128
|
+
* `Depends-on`/`Conflicts-with` words and backtick spans inside the prose can
|
|
129
|
+
* never pollute what the parser extracts.
|
|
130
|
+
*
|
|
131
|
+
* The caller (bin) gates every real invocation on a runtime round-trip check
|
|
132
|
+
* (`parseRationaleDeps(result)` must deep-equal the requested sets) — never
|
|
133
|
+
* trusting this rewrite by construction (this class of bug bit the Planner
|
|
134
|
+
* more than once by trusting assumptions over verification).
|
|
135
|
+
*
|
|
136
|
+
* @throws if the body has no `**Dependency rationale**` section — a conforming
|
|
137
|
+
* task Issue always has one; the caller turns this into a refusal.
|
|
138
|
+
*/
|
|
139
|
+
export function amendRationaleDeps(body: string, input: AmendDepsInput): string {
|
|
140
|
+
const start = body.match(SECTION_HEADER)
|
|
141
|
+
if (!start || start.index === undefined) {
|
|
142
|
+
throw new Error('amendRationaleDeps: no "**Dependency rationale**" section found in the Issue body')
|
|
143
|
+
}
|
|
144
|
+
const sectionStart = start.index + start[0].length
|
|
145
|
+
const rest = body.slice(sectionStart)
|
|
146
|
+
const next = rest.match(NEXT_HEADER)
|
|
147
|
+
const sectionEnd = next && next.index !== undefined ? next.index : rest.length
|
|
148
|
+
|
|
149
|
+
const before = body.slice(0, sectionStart)
|
|
150
|
+
let section = rest.slice(0, sectionEnd)
|
|
151
|
+
const after = rest.slice(sectionEnd)
|
|
152
|
+
|
|
153
|
+
if (input.dependsOn !== undefined) section = rewriteField(section, 'dependsOn', input.dependsOn, input.date)
|
|
154
|
+
if (input.conflictsWith !== undefined)
|
|
155
|
+
section = rewriteField(section, 'conflictsWith', input.conflictsWith, input.date)
|
|
156
|
+
|
|
157
|
+
const actor = input.actor ?? 'Planner'
|
|
158
|
+
const clauses: string[] = []
|
|
159
|
+
if (input.dependsOn !== undefined) clauses.push(`Depends-on is now \`${canonicalValue(input.dependsOn)}\``)
|
|
160
|
+
if (input.conflictsWith !== undefined)
|
|
161
|
+
clauses.push(`Conflicts-with is now \`${canonicalValue(input.conflictsWith)}\``)
|
|
162
|
+
|
|
163
|
+
const amendment =
|
|
164
|
+
`**Amendment (${input.date}, ${actor}) — dependency edges updated via amend-deps.** ` +
|
|
165
|
+
`${input.note} ${clauses.join('; ')}.`
|
|
166
|
+
|
|
167
|
+
const rewrittenBody = before + section + after
|
|
168
|
+
return `${rewrittenBody.replace(/\s*$/, '')}\n\n${amendment}\n`
|
|
169
|
+
}
|