scrumrun 2.5.0 → 2.6.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/CHANGELOG.md +27 -0
- package/CORE.md +18 -4
- package/DECISIONS.md +20 -0
- package/README.md +27 -3
- package/SPEC.md +9 -1
- package/bin/scrumrun.js +59 -6
- package/lib/commands/manifest.js +3 -3
- package/lib/commands/pretty-intake.js +4 -0
- package/lib/runtime/briefing.js +104 -0
- package/lib/runtime/canonical-snapshot.js +2 -1
- package/lib/runtime/context.js +18 -1
- package/lib/runtime/orchestrator.js +92 -18
- package/lib/runtime/policy-engine.js +22 -0
- package/lib/runtime/request-engine.js +22 -2
- package/lib/runtime/run-ledger.js +16 -0
- package/lib/v2/conformance.js +20 -2
- package/package.json +13 -3
- package/scripts/sync-readme-version.js +20 -0
- package/templates/project/.scrumrun/config.md +3 -0
- package/templates/project/AGENTS.md +6 -4
- package/templates/project-lean/AGENTS.md +3 -3
- package/templates/shared/skills/scrumrun/SKILL.md +17 -11
- package/types/index.d.ts +730 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
// Type declarations for ScrumRun public library API.
|
|
2
|
+
//
|
|
3
|
+
// These types cover the modules that library consumers import
|
|
4
|
+
// directly from `lib/`. CLI-only helpers in `bin/scrumrun.js` are
|
|
5
|
+
// not typed here; they are an internal entry point.
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// lib/v2/schema
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
export type ArtifactKind =
|
|
12
|
+
| "feature"
|
|
13
|
+
| "task"
|
|
14
|
+
| "sprint"
|
|
15
|
+
| "run"
|
|
16
|
+
| "review"
|
|
17
|
+
| "knowledge"
|
|
18
|
+
| "decision"
|
|
19
|
+
| "insight"
|
|
20
|
+
| "dossier";
|
|
21
|
+
|
|
22
|
+
export type ArtifactStatus =
|
|
23
|
+
| "backlog" | "proposed" | "active" | "completed" | "paused" | "cancelled"
|
|
24
|
+
| "running" | "validating" | "learning" | "partial" | "failed" | "blocked"
|
|
25
|
+
| "candidate" | "approved" | "rejected" | "deprecated" | "invalidated"
|
|
26
|
+
| "open" | "resolved" | "confirmed" | "stale" | "archived" | "executing" | "passed";
|
|
27
|
+
|
|
28
|
+
export interface ArtifactTypeDef {
|
|
29
|
+
prefix: string;
|
|
30
|
+
directory: string;
|
|
31
|
+
initial: string[];
|
|
32
|
+
statuses: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type ArtifactTypeMap = Record<ArtifactKind, ArtifactTypeDef>;
|
|
36
|
+
|
|
37
|
+
export interface StructuralRelation {
|
|
38
|
+
targetKind: ArtifactKind;
|
|
39
|
+
cardinality: string;
|
|
40
|
+
requiredFor?: ArtifactKind[];
|
|
41
|
+
meaning: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ScalarFieldDef {
|
|
45
|
+
kinds: ArtifactKind[];
|
|
46
|
+
required: boolean;
|
|
47
|
+
type: string;
|
|
48
|
+
meaning: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface TruthOwnershipDef {
|
|
52
|
+
question: string;
|
|
53
|
+
truth: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface AuthorityDef {
|
|
57
|
+
source: string;
|
|
58
|
+
scope: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const METHOD_VERSION: "2.0.0";
|
|
62
|
+
export const RUN_LEDGER_VERSION: 1;
|
|
63
|
+
export const RUN_EVENT_TYPES: readonly string[];
|
|
64
|
+
export const RUN_EVIDENCE_KINDS: readonly string[];
|
|
65
|
+
export const GUARDRAIL_RESULTS: readonly string[];
|
|
66
|
+
export const ARTIFACT_TYPES: ArtifactTypeMap;
|
|
67
|
+
export const ARTIFACT_TRANSITIONS: Readonly<Record<ArtifactKind, Readonly<Record<string, readonly string[]>>>>;
|
|
68
|
+
export const STRUCTURAL_RELATIONS: Readonly<Record<string, StructuralRelation>>;
|
|
69
|
+
export const SCALAR_FIELDS: Readonly<Record<string, ScalarFieldDef>>;
|
|
70
|
+
export const TRUTH_OWNERSHIP: Readonly<Record<ArtifactKind, TruthOwnershipDef>>;
|
|
71
|
+
export const AUTHORITY: Readonly<Record<string, AuthorityDef>>;
|
|
72
|
+
export function deepFreeze<T>(value: T): T;
|
|
73
|
+
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// lib/v2/artifacts
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
export interface ArtifactRecord {
|
|
79
|
+
id: string;
|
|
80
|
+
kind: ArtifactKind;
|
|
81
|
+
status: string;
|
|
82
|
+
created: string;
|
|
83
|
+
updated: string;
|
|
84
|
+
method: string;
|
|
85
|
+
type?: string;
|
|
86
|
+
feature?: string | null;
|
|
87
|
+
sprint?: string | null;
|
|
88
|
+
task?: string | null;
|
|
89
|
+
attempt?: number;
|
|
90
|
+
ledger?: number;
|
|
91
|
+
guardrails?: number;
|
|
92
|
+
workspace?: number;
|
|
93
|
+
approval_id?: string | null;
|
|
94
|
+
context_fingerprint?: string;
|
|
95
|
+
risk?: string;
|
|
96
|
+
assignee?: string | null;
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ParsedArtifact {
|
|
101
|
+
record: ArtifactRecord | null;
|
|
102
|
+
body: string;
|
|
103
|
+
errors: string[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface WriteResult {
|
|
107
|
+
status: "written" | "unchanged";
|
|
108
|
+
file: string;
|
|
109
|
+
hash: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface GraphNode {
|
|
113
|
+
id: string;
|
|
114
|
+
kind: ArtifactKind;
|
|
115
|
+
status: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface GraphEdge {
|
|
119
|
+
from: string;
|
|
120
|
+
relation: string;
|
|
121
|
+
to: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ArtifactGraph {
|
|
125
|
+
nodes: GraphNode[];
|
|
126
|
+
edges: GraphEdge[];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export class ArtifactRepository {
|
|
130
|
+
constructor(scrumDir: string);
|
|
131
|
+
readonly scrumDir: string;
|
|
132
|
+
pathFor(record: { kind: ArtifactKind; id: string }): string;
|
|
133
|
+
write(record: ArtifactRecord, body?: string, options?: { overwrite?: boolean }): WriteResult;
|
|
134
|
+
read(kind: ArtifactKind, id: string): (ParsedArtifact & { file: string }) | null;
|
|
135
|
+
transition(kind: ArtifactKind, id: string, nextStatus: string, updated: string): WriteResult & { record: ArtifactRecord };
|
|
136
|
+
list(kind: ArtifactKind): Array<ParsedArtifact & { file: string }>;
|
|
137
|
+
graph(): ArtifactGraph;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function sha256(content: string | Buffer): string;
|
|
141
|
+
export function serializeArtifact(record: ArtifactRecord, body?: string): string;
|
|
142
|
+
export function parseArtifact(content: string): ParsedArtifact;
|
|
143
|
+
export function validateArtifact(record: ArtifactRecord | null, expectedKind?: ArtifactKind | null): string[];
|
|
144
|
+
export function transitionArtifact(record: ArtifactRecord, nextStatus: string, updated: string): ArtifactRecord;
|
|
145
|
+
export function relativeArtifactPath(record: { kind: ArtifactKind; id: string }): string;
|
|
146
|
+
export function safePath(root: string, relative: string): string;
|
|
147
|
+
export function assertNoSymlinkPath(root: string, target: string): string;
|
|
148
|
+
export function atomicWrite(file: string, content: string): void;
|
|
149
|
+
export function graphFromRecords(records: ArtifactRecord[]): ArtifactGraph;
|
|
150
|
+
export function withArtifactLock<T>(scrumDir: string, name: string, operation: () => T, options?: { timeoutMs?: number; staleMs?: number }): T;
|
|
151
|
+
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
// lib/v2/conformance
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
export type FindingSeverity = "critical" | "high" | "warning";
|
|
157
|
+
|
|
158
|
+
export interface Finding {
|
|
159
|
+
severity: FindingSeverity;
|
|
160
|
+
code: string;
|
|
161
|
+
message: string;
|
|
162
|
+
file?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface InvariantDef {
|
|
166
|
+
id: string;
|
|
167
|
+
summary: string;
|
|
168
|
+
tests: string[];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface AuditResult {
|
|
172
|
+
method: string;
|
|
173
|
+
passed: boolean;
|
|
174
|
+
findings: Finding[];
|
|
175
|
+
counts: Record<string, number>;
|
|
176
|
+
invariants: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export const INVARIANTS: readonly InvariantDef[];
|
|
180
|
+
export function auditProject(projectRoot: string): AuditResult;
|
|
181
|
+
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
// lib/v2/paths
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
|
|
186
|
+
export const PATHS_SCHEMA_VERSION: 1;
|
|
187
|
+
export const CANONICAL_PATHS: Record<string, unknown>;
|
|
188
|
+
export function canonicalPaths(): Record<string, unknown>;
|
|
189
|
+
export function flattenPaths(paths?: Record<string, unknown>): Array<{ path: string; key: string }>;
|
|
190
|
+
export function renderMethodJson(options?: { method?: string; schemas?: Record<string, number>; paths?: Record<string, unknown> }): string;
|
|
191
|
+
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
// lib/v2/transaction
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
|
|
196
|
+
export const TRANSACTION_SCHEMA: 1;
|
|
197
|
+
|
|
198
|
+
export interface TransactionFileChange {
|
|
199
|
+
relative: string;
|
|
200
|
+
from: string;
|
|
201
|
+
to: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface PendingTransaction {
|
|
205
|
+
id: string;
|
|
206
|
+
status: string;
|
|
207
|
+
action: string;
|
|
208
|
+
name?: string;
|
|
209
|
+
warnings: string[];
|
|
210
|
+
files: TransactionFileChange[];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface PendingTransactionStatus {
|
|
214
|
+
error: string | null;
|
|
215
|
+
pending: Array<{ id: string; name: string; status: string }>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface RecoveryResult {
|
|
219
|
+
id: string;
|
|
220
|
+
action: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface FileOperation {
|
|
224
|
+
file: string;
|
|
225
|
+
previous: string | null;
|
|
226
|
+
next: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function runKernelTransaction(
|
|
230
|
+
scrumDir: string,
|
|
231
|
+
name: string,
|
|
232
|
+
operations: FileOperation[],
|
|
233
|
+
options?: { failurePoint?: string | null; interruptPoint?: string | null }
|
|
234
|
+
): void;
|
|
235
|
+
export function recoverPendingTransactions(scrumDir: string): RecoveryResult[];
|
|
236
|
+
export function recoverPendingTransactionsUnlocked(scrumDir: string): RecoveryResult[];
|
|
237
|
+
export function previewPendingRecovery(scrumDir: string): { plans: PendingTransaction[]; errors: string[] };
|
|
238
|
+
export function pendingTransactionStatus(scrumDir: string): PendingTransactionStatus;
|
|
239
|
+
export function writeKernelTransactionUnlocked(
|
|
240
|
+
scrumDir: string,
|
|
241
|
+
name: string,
|
|
242
|
+
operations: FileOperation[],
|
|
243
|
+
options?: { failurePoint?: string | null; interruptPoint?: string | null }
|
|
244
|
+
): void;
|
|
245
|
+
|
|
246
|
+
// ---------------------------------------------------------------------------
|
|
247
|
+
// lib/v2/migration
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
|
|
250
|
+
export interface MigrationPlan {
|
|
251
|
+
errors: string[];
|
|
252
|
+
[key: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface DryRunResult {
|
|
256
|
+
status: string;
|
|
257
|
+
output: string;
|
|
258
|
+
plan: MigrationPlan;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface ApplyResult {
|
|
262
|
+
status: string;
|
|
263
|
+
manifest: {
|
|
264
|
+
sourceInventory: { rootSha256: string };
|
|
265
|
+
generated: unknown[];
|
|
266
|
+
[key: string]: unknown;
|
|
267
|
+
};
|
|
268
|
+
[key: string]: unknown;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface RollbackResult {
|
|
272
|
+
rootSha256: string;
|
|
273
|
+
[key: string]: unknown;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export function dryRunMigration(projectRoot: string): DryRunResult;
|
|
277
|
+
export function applyMigration(projectRoot: string, options?: { plan?: MigrationPlan }): ApplyResult;
|
|
278
|
+
export function rollbackMigration(projectRoot: string): RollbackResult;
|
|
279
|
+
export function migrationPlan(projectRoot: string): MigrationPlan;
|
|
280
|
+
export function inventoryTree(projectRoot: string): unknown;
|
|
281
|
+
|
|
282
|
+
// ---------------------------------------------------------------------------
|
|
283
|
+
// lib/runtime/request-engine
|
|
284
|
+
// ---------------------------------------------------------------------------
|
|
285
|
+
|
|
286
|
+
export interface RiskAssessment {
|
|
287
|
+
level: "low" | "medium" | "high";
|
|
288
|
+
reasons: string[];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface Classification {
|
|
292
|
+
type: string;
|
|
293
|
+
taskType: string;
|
|
294
|
+
reason: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface GuardrailEvaluation {
|
|
298
|
+
guardrail: string;
|
|
299
|
+
status: "passed" | "blocked" | "deferred";
|
|
300
|
+
code: string;
|
|
301
|
+
message: string;
|
|
302
|
+
enforcement: string;
|
|
303
|
+
scope: string[];
|
|
304
|
+
evidence: string[];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface PolicyResult {
|
|
308
|
+
status: "passed" | "blocked";
|
|
309
|
+
checked: string[];
|
|
310
|
+
deferred: string[];
|
|
311
|
+
obligations: Array<{
|
|
312
|
+
guardrail: string;
|
|
313
|
+
code: string;
|
|
314
|
+
enforcement: string;
|
|
315
|
+
scope: string[];
|
|
316
|
+
gate: string;
|
|
317
|
+
}>;
|
|
318
|
+
evaluations: GuardrailEvaluation[];
|
|
319
|
+
violations: string[];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export interface ContextPackage {
|
|
323
|
+
fingerprint: string;
|
|
324
|
+
request: string;
|
|
325
|
+
warnings: string[];
|
|
326
|
+
guardrails: unknown[];
|
|
327
|
+
config: string;
|
|
328
|
+
layout: string;
|
|
329
|
+
[key: string]: unknown;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface IntakePlan {
|
|
333
|
+
state: "awaiting_approval" | "blocked";
|
|
334
|
+
pipeline: string[];
|
|
335
|
+
request: string;
|
|
336
|
+
context: ContextPackage;
|
|
337
|
+
workspaceFingerprint: string;
|
|
338
|
+
policy: PolicyResult;
|
|
339
|
+
risk: RiskAssessment;
|
|
340
|
+
classification: Classification;
|
|
341
|
+
preview: string | null;
|
|
342
|
+
proposal: {
|
|
343
|
+
create: string[];
|
|
344
|
+
sprint: string | null;
|
|
345
|
+
validation: string;
|
|
346
|
+
};
|
|
347
|
+
issuedAt: string;
|
|
348
|
+
approvalToken: string | null;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export function planRequest(projectRoot: string, request: string, options?: { typeOverride?: string | null; preview?: string | null }): IntakePlan;
|
|
352
|
+
export function assessRisk(request: string): RiskAssessment;
|
|
353
|
+
export function classifyRequest(request: string): Classification;
|
|
354
|
+
export function applyPolicy(context: ContextPackage): PolicyResult;
|
|
355
|
+
export function encodeApproval(plan: IntakePlan): string;
|
|
356
|
+
export function decodeApproval(token: string): {
|
|
357
|
+
schema: 1;
|
|
358
|
+
method: string;
|
|
359
|
+
request: string;
|
|
360
|
+
fingerprint: string;
|
|
361
|
+
classification: Classification;
|
|
362
|
+
risk: RiskAssessment;
|
|
363
|
+
policy: PolicyResult;
|
|
364
|
+
workspaceFingerprint: string;
|
|
365
|
+
preview: string | null;
|
|
366
|
+
issuedAt: string;
|
|
367
|
+
};
|
|
368
|
+
export function stableJson(value: unknown): string;
|
|
369
|
+
|
|
370
|
+
// ---------------------------------------------------------------------------
|
|
371
|
+
// lib/runtime/orchestrator
|
|
372
|
+
// ---------------------------------------------------------------------------
|
|
373
|
+
|
|
374
|
+
export interface StateProjection {
|
|
375
|
+
content: string;
|
|
376
|
+
sourceFingerprint: string;
|
|
377
|
+
watchFingerprint: string;
|
|
378
|
+
sourceFiles: unknown[];
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export function approveRequest(projectRoot: string, token: string, options?: { failurePoint?: string | null; interruptPoint?: string | null }): { status: string; task: ArtifactRecord; run: ArtifactRecord };
|
|
382
|
+
export function transitionRun(projectRoot: string, runId: string, nextStatus: string, options?: {
|
|
383
|
+
note?: string | null;
|
|
384
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
385
|
+
actor?: string;
|
|
386
|
+
occurredAt?: string | null;
|
|
387
|
+
summary?: string | null;
|
|
388
|
+
failurePoint?: string | null;
|
|
389
|
+
interruptPoint?: string | null;
|
|
390
|
+
}): { run: ArtifactRecord; task: ArtifactRecord; learning: { created: string[]; warnings: string[] } | null; recovered?: unknown[] };
|
|
391
|
+
export function retryTask(projectRoot: string, taskId: string, options?: { note?: string; failurePoint?: string | null; interruptPoint?: string | null }): { run: ArtifactRecord; task: ArtifactRecord; content: string; recovered?: unknown[] };
|
|
392
|
+
export function startBacklogTask(projectRoot: string, taskId: string, options?: { note?: string; failurePoint?: string | null; interruptPoint?: string | null }): { run: ArtifactRecord; task: ArtifactRecord; content: string; recovered?: unknown[] };
|
|
393
|
+
export function nextBacklogTask(repository: ArtifactRepository): ArtifactRecord | null;
|
|
394
|
+
export function refreshState(scrumDir: string): StateProjection;
|
|
395
|
+
export function renderState(repository: ArtifactRepository): string;
|
|
396
|
+
export function stateFingerprint(repository: ArtifactRepository): string;
|
|
397
|
+
export function stateIsStale(scrumDir: string): boolean;
|
|
398
|
+
export function nextId(repository: ArtifactRepository, kind: ArtifactKind): string;
|
|
399
|
+
|
|
400
|
+
// ---------------------------------------------------------------------------
|
|
401
|
+
// lib/runtime/mutation-gateway
|
|
402
|
+
// ---------------------------------------------------------------------------
|
|
403
|
+
|
|
404
|
+
export const PERMIT_SCHEMA: 1;
|
|
405
|
+
|
|
406
|
+
export interface MutationPermit {
|
|
407
|
+
schema: 1;
|
|
408
|
+
id: string;
|
|
409
|
+
run: string;
|
|
410
|
+
created_at: string;
|
|
411
|
+
expires_at: string;
|
|
412
|
+
policy_fingerprint: string;
|
|
413
|
+
workspace_before: unknown;
|
|
414
|
+
allowed_paths: string[];
|
|
415
|
+
integrity: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export interface MutationResult {
|
|
419
|
+
run: ArtifactRecord;
|
|
420
|
+
mutation: string;
|
|
421
|
+
changes: unknown[];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export interface PolicyState {
|
|
425
|
+
file: string;
|
|
426
|
+
content: string;
|
|
427
|
+
config: string;
|
|
428
|
+
fingerprint: string;
|
|
429
|
+
guardrails: unknown[];
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export interface WorkspaceState {
|
|
433
|
+
mode: string;
|
|
434
|
+
head: string | null;
|
|
435
|
+
fingerprint: string;
|
|
436
|
+
files: Array<{ path: string; sha256: string; kind: string; mode: number; scan: string }>;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export function authorizeMutation(projectRoot: string, runId: string, paths: string[], options?: { ttlMs?: number }): { permit: string; run: string; expiresAt: string; paths: string[] };
|
|
440
|
+
export function recordMutation(projectRoot: string, runId: string, permitId: string, options?: {
|
|
441
|
+
note?: string | null;
|
|
442
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
443
|
+
actor?: string;
|
|
444
|
+
occurredAt?: string | null;
|
|
445
|
+
}): MutationResult;
|
|
446
|
+
export function satisfyGuardrail(projectRoot: string, runId: string, guardrailId: string, options?: {
|
|
447
|
+
note?: string | null;
|
|
448
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
449
|
+
actor?: string;
|
|
450
|
+
occurredAt?: string | null;
|
|
451
|
+
}): { run: ArtifactRecord; guardrail: string; status: string };
|
|
452
|
+
export function policyState(projectRoot: string): PolicyState;
|
|
453
|
+
export function workspaceState(projectRoot: string): WorkspaceState;
|
|
454
|
+
export function publicWorkspace(value: WorkspaceState): unknown;
|
|
455
|
+
export function verifyWorkspaceIntegrity(projectRoot: string, runArtifact: { record: ArtifactRecord; body: string }): { status: string; fingerprint: string | null; policy?: string };
|
|
456
|
+
export function assertCompletionAllowed(projectRoot: string, runArtifact: { record: ArtifactRecord; body: string }): { status: string; policy?: string };
|
|
457
|
+
export function prepareCompletion(projectRoot: string, runArtifact: { record: ArtifactRecord; body: string }, options?: { occurredAt?: string | null }): { record: ArtifactRecord; body: string; resolved: string[]; status: string };
|
|
458
|
+
export function auditActiveWorkspace(projectRoot: string, runArtifact: { record: ArtifactRecord; body: string }): string | null;
|
|
459
|
+
export function assertCanonicalWrite(projectRoot: string, operation: string, contents?: string[]): { operation: string; policy: string };
|
|
460
|
+
export function expectedWorkspace(runArtifact: { record: ArtifactRecord; body: string }): unknown;
|
|
461
|
+
|
|
462
|
+
// ---------------------------------------------------------------------------
|
|
463
|
+
// lib/runtime/policy-engine
|
|
464
|
+
// ---------------------------------------------------------------------------
|
|
465
|
+
|
|
466
|
+
export interface GuardrailRecord {
|
|
467
|
+
id: string;
|
|
468
|
+
title: string;
|
|
469
|
+
rule: string;
|
|
470
|
+
status: string;
|
|
471
|
+
enforcement: string;
|
|
472
|
+
scope: string[];
|
|
473
|
+
source: string | null;
|
|
474
|
+
explicit: { status: boolean; enforcement: boolean; scope: boolean; rule: boolean };
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export function parseGuardrails(content: string): GuardrailRecord[];
|
|
478
|
+
export function validateGuardrailDocument(content: string): { records: GuardrailRecord[]; errors: string[] };
|
|
479
|
+
export function evaluatePolicy(context: ContextPackage): PolicyResult;
|
|
480
|
+
export function normalizeGuardrailDocument(content: string): string;
|
|
481
|
+
export function configWeakeningAttempts(content: string): string[];
|
|
482
|
+
export function readOnlyPaths(content: string): string[];
|
|
483
|
+
export function obligationGate(evaluation: { scope?: string[]; enforcement: string }): string;
|
|
484
|
+
export function inferEnforcement(title: string, rule: string): string;
|
|
485
|
+
export function normalized(value: string): string;
|
|
486
|
+
export function agentIdentity(scrumDir: string): string | null;
|
|
487
|
+
|
|
488
|
+
// ---------------------------------------------------------------------------
|
|
489
|
+
// lib/runtime/run-ledger
|
|
490
|
+
// ---------------------------------------------------------------------------
|
|
491
|
+
|
|
492
|
+
export interface RunEvent {
|
|
493
|
+
id: string;
|
|
494
|
+
type: "transition" | "snapshot" | "guardrail" | "mutation";
|
|
495
|
+
sequence: number;
|
|
496
|
+
occurred_at: string;
|
|
497
|
+
actor: string;
|
|
498
|
+
from?: string;
|
|
499
|
+
to?: string;
|
|
500
|
+
reason?: string;
|
|
501
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
502
|
+
[key: string]: unknown;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export interface ParsedLedger {
|
|
506
|
+
events: RunEvent[];
|
|
507
|
+
errors: string[];
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export interface GuardrailObligation {
|
|
511
|
+
guardrail: string;
|
|
512
|
+
status: string;
|
|
513
|
+
enforcement: string;
|
|
514
|
+
gate: string;
|
|
515
|
+
scope: string[];
|
|
516
|
+
code: string;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export function parseRunLedger(body: string): ParsedLedger;
|
|
520
|
+
export function validateRunLedger(record: ArtifactRecord, body: string): ParsedLedger;
|
|
521
|
+
export function appendRunEvent(record: ArtifactRecord, body: string, nextRecord: ArtifactRecord, options: {
|
|
522
|
+
note?: string | null;
|
|
523
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
524
|
+
actor?: string;
|
|
525
|
+
occurredAt?: string | null;
|
|
526
|
+
}): { record: ArtifactRecord; body: string; event: RunEvent };
|
|
527
|
+
export function createRunBody(run: ArtifactRecord, options: {
|
|
528
|
+
approvalId?: string | null;
|
|
529
|
+
obligations?: unknown[];
|
|
530
|
+
policyFingerprint?: string;
|
|
531
|
+
workspaceBaseline?: unknown;
|
|
532
|
+
title?: string;
|
|
533
|
+
actor?: string;
|
|
534
|
+
reason?: string;
|
|
535
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
536
|
+
}): { body: string; event: RunEvent };
|
|
537
|
+
export function appendGuardrailEvent(record: ArtifactRecord, body: string, obligation: GuardrailObligation, status: string, options: {
|
|
538
|
+
note?: string | null;
|
|
539
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
540
|
+
actor?: string;
|
|
541
|
+
occurredAt?: string | null;
|
|
542
|
+
}): { record: ArtifactRecord; body: string };
|
|
543
|
+
export function appendMutationEvent(record: ArtifactRecord, body: string, mutation: unknown, options: {
|
|
544
|
+
note?: string | null;
|
|
545
|
+
evidence?: Array<{ kind: string; ref?: string; summary?: string }>;
|
|
546
|
+
actor?: string;
|
|
547
|
+
occurredAt?: string | null;
|
|
548
|
+
}): { record: ArtifactRecord; body: string };
|
|
549
|
+
export function guardrailState(record: ArtifactRecord, body: string): GuardrailObligation[];
|
|
550
|
+
export function appendTechnicalSummary(record: ArtifactRecord, body: string, summary: string): string;
|
|
551
|
+
export function extractTechnicalSummary(body: string): string | null;
|
|
552
|
+
export function renderRunEvent(event: RunEvent): string;
|
|
553
|
+
export function instant(value?: string | null): string;
|
|
554
|
+
export function dateInstant(value?: string | null): string;
|
|
555
|
+
export function eventId(runId: string, sequence: number): string;
|
|
556
|
+
|
|
557
|
+
// ---------------------------------------------------------------------------
|
|
558
|
+
// lib/security/secrets
|
|
559
|
+
// ---------------------------------------------------------------------------
|
|
560
|
+
|
|
561
|
+
export const SECRET_PATTERNS: readonly RegExp[];
|
|
562
|
+
|
|
563
|
+
export function containsSecret(value: string): boolean;
|
|
564
|
+
export function assertNoSecret(values: string | string[], message?: string): void;
|
|
565
|
+
export function secretFingerprints(value: string): string[];
|
|
566
|
+
export function containsSecretWithAllowlist(value: string, relativePath: string, allowlist: Set<string>): boolean;
|
|
567
|
+
export function isSecretAllowed(relativePath: string, allowlist: Set<string>): boolean;
|
|
568
|
+
export function loadSecretAllowlist(scrumDir: string): Set<string>;
|
|
569
|
+
export function parseFrontmatter(text: string): { explicit: Record<string, unknown>; raw: string };
|
|
570
|
+
|
|
571
|
+
// ---------------------------------------------------------------------------
|
|
572
|
+
// lib/errors
|
|
573
|
+
// ---------------------------------------------------------------------------
|
|
574
|
+
|
|
575
|
+
export interface ErrorEntry {
|
|
576
|
+
summary: string;
|
|
577
|
+
remediation: string;
|
|
578
|
+
retired?: boolean;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export const CATALOG: Readonly<Record<string, ErrorEntry>>;
|
|
582
|
+
|
|
583
|
+
export class ScrumRunError extends Error {
|
|
584
|
+
readonly code: string;
|
|
585
|
+
readonly summary: string;
|
|
586
|
+
readonly remediation: string;
|
|
587
|
+
readonly details?: unknown;
|
|
588
|
+
constructor(code: string, message?: string, options?: { cause?: unknown; details?: unknown });
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export function describe(code: string): ErrorEntry | null;
|
|
592
|
+
export function codes(): string[];
|
|
593
|
+
|
|
594
|
+
// ---------------------------------------------------------------------------
|
|
595
|
+
// lib/commands/manifest
|
|
596
|
+
// ---------------------------------------------------------------------------
|
|
597
|
+
|
|
598
|
+
export interface RouteSpec {
|
|
599
|
+
description: string;
|
|
600
|
+
subjects: Record<string, string[]>;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export interface ResolvedRoute {
|
|
604
|
+
type: "route" | "help" | "error";
|
|
605
|
+
noun?: string;
|
|
606
|
+
subject?: string;
|
|
607
|
+
args?: string[];
|
|
608
|
+
spec?: RouteSpec;
|
|
609
|
+
actions?: string[];
|
|
610
|
+
level?: string;
|
|
611
|
+
message?: string;
|
|
612
|
+
note?: string;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
export const nouns: Readonly<Record<string, RouteSpec>>;
|
|
616
|
+
export const aliases: Readonly<Record<string, string>>;
|
|
617
|
+
export function resolveRoute(parts: string[]): ResolvedRoute;
|
|
618
|
+
export function resolveAlias(alias: string, parts: string[]): ResolvedRoute;
|
|
619
|
+
|
|
620
|
+
// ---------------------------------------------------------------------------
|
|
621
|
+
// lib/commands/normalize-legacy
|
|
622
|
+
// ---------------------------------------------------------------------------
|
|
623
|
+
|
|
624
|
+
export interface NormalizePlan {
|
|
625
|
+
malformed: boolean;
|
|
626
|
+
runs: Array<{ id: string; errors: string[] }>;
|
|
627
|
+
[key: string]: unknown;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export function normalizeLegacyRuns(scrumDir: string, options?: { dryRun?: boolean }): { plan: NormalizePlan; applied: string[] };
|
|
631
|
+
export function analyze(scrumDir: string): NormalizePlan;
|
|
632
|
+
export function apply(scrumDir: string, plan: NormalizePlan): string[];
|
|
633
|
+
export function renderReport(plan: NormalizePlan, applied: string[]): string;
|
|
634
|
+
export function buildNormalizedBody(runId: string, status: string, original: string): string;
|
|
635
|
+
export function needsNormalization(body: string): boolean;
|
|
636
|
+
export function scanRuns(scrumDir: string): Array<{ id: string; file: string; body: string; malformed: boolean; errors: string[] }>;
|
|
637
|
+
|
|
638
|
+
// ---------------------------------------------------------------------------
|
|
639
|
+
// lib/commands/run-render
|
|
640
|
+
// ---------------------------------------------------------------------------
|
|
641
|
+
|
|
642
|
+
export function renderRun(record: ArtifactRecord, body: string): string;
|
|
643
|
+
export function renderRunFromDisk(projectRoot: string, runId: string): string;
|
|
644
|
+
export function formatInstant(iso: string | null): string;
|
|
645
|
+
export function humanDuration(startIso: string | null, endIso: string | null): string | null;
|
|
646
|
+
export function summarizeEvidence(evidence: Array<{ kind: string; ref?: string; summary?: string }>): string;
|
|
647
|
+
|
|
648
|
+
// ---------------------------------------------------------------------------
|
|
649
|
+
// lib/commands/run-stats
|
|
650
|
+
// ---------------------------------------------------------------------------
|
|
651
|
+
|
|
652
|
+
export interface StatsFilters {
|
|
653
|
+
task?: string;
|
|
654
|
+
feature?: string;
|
|
655
|
+
sprint?: string;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
export interface RunStats {
|
|
659
|
+
[key: string]: unknown;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export function computeStats(projectRoot: string, filters?: StatsFilters): RunStats;
|
|
663
|
+
export function renderStats(stats: RunStats, filters: StatsFilters): string;
|
|
664
|
+
export function loadRuns(cwd: string): Array<{ id: string; file: string; body: string; frontmatter: Record<string, unknown> }>;
|
|
665
|
+
|
|
666
|
+
// ---------------------------------------------------------------------------
|
|
667
|
+
// lib/commands/pretty-intake
|
|
668
|
+
// ---------------------------------------------------------------------------
|
|
669
|
+
|
|
670
|
+
export function canRenderPretty(stream?: { isTTY?: boolean }): boolean;
|
|
671
|
+
export function renderIntake(plan: IntakePlan): string;
|
|
672
|
+
export function renderIntakePlain(plan: IntakePlan): string;
|
|
673
|
+
|
|
674
|
+
// ---------------------------------------------------------------------------
|
|
675
|
+
// lib/memory/service
|
|
676
|
+
// ---------------------------------------------------------------------------
|
|
677
|
+
|
|
678
|
+
export interface MemoryArtifact {
|
|
679
|
+
record: ArtifactRecord;
|
|
680
|
+
body: string;
|
|
681
|
+
file: string;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export interface MemoryOptions {
|
|
685
|
+
title: string;
|
|
686
|
+
content: string;
|
|
687
|
+
evidence: string[];
|
|
688
|
+
relations: string[];
|
|
689
|
+
subjectType?: string | null;
|
|
690
|
+
subjectId?: string | null;
|
|
691
|
+
sourceType?: string;
|
|
692
|
+
sourceId?: string | null;
|
|
693
|
+
confidence?: string | null;
|
|
694
|
+
validFrom?: string | null;
|
|
695
|
+
validUntil?: string | null;
|
|
696
|
+
reviewTrigger?: string | null;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export function createMemory(projectRoot: string, kind: string, options: MemoryOptions): MemoryArtifact;
|
|
700
|
+
export function listMemory(projectRoot: string, kind: string, options?: { includeInactive?: boolean }): MemoryArtifact[];
|
|
701
|
+
export function showMemory(projectRoot: string, kind: string, id: string): MemoryArtifact | null;
|
|
702
|
+
export function transitionMemory(projectRoot: string, kind: string, id: string, action: string, options?: { evidence?: string[]; note?: string | null }): MemoryArtifact;
|
|
703
|
+
export function resolveEvidence(projectRoot: string, repository: ArtifactRepository, reference: string): { resolved: boolean; reason?: string };
|
|
704
|
+
|
|
705
|
+
// ---------------------------------------------------------------------------
|
|
706
|
+
// lib/runtime/context
|
|
707
|
+
// ---------------------------------------------------------------------------
|
|
708
|
+
|
|
709
|
+
export function buildContextPackage(projectRoot: string, request: string): ContextPackage;
|
|
710
|
+
export function contextFingerprint(projectRoot: string, request: string): string;
|
|
711
|
+
export function artifactSnapshot(scrumDir: string): { hashes: Record<string, string>; records: Record<string, Array<{ id: string; status: string; title?: string }>> };
|
|
712
|
+
export function guardrailRecords(scrumDir: string): GuardrailRecord[];
|
|
713
|
+
export function projectScan(projectRoot: string): unknown;
|
|
714
|
+
|
|
715
|
+
// ---------------------------------------------------------------------------
|
|
716
|
+
// lib/runtime/canonical-snapshot
|
|
717
|
+
// ---------------------------------------------------------------------------
|
|
718
|
+
|
|
719
|
+
export function canonicalFingerprint(scrumDir: string, hashes: Record<string, string>): string;
|
|
720
|
+
export function canonicalWatchSnapshot(scrumDir: string): { fingerprint: string; files: unknown[] };
|
|
721
|
+
export function fileWatchSnapshot(projectRoot: string): { fingerprint: string; files: unknown[] };
|
|
722
|
+
export function statRow(entry: unknown): unknown;
|
|
723
|
+
|
|
724
|
+
// ---------------------------------------------------------------------------
|
|
725
|
+
// lib/code-intel/learning
|
|
726
|
+
// ---------------------------------------------------------------------------
|
|
727
|
+
|
|
728
|
+
export function extractLearningCandidates(projectRoot: string, runId: string): { created: string[]; warnings: string[] };
|
|
729
|
+
export function learningSection(candidates: unknown[]): string;
|
|
730
|
+
export function parseCandidate(text: string): unknown;
|