@cleocode/contracts 2026.10.27 → 2026.11.1-canary.11
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/README.md +2 -1
- package/dist/.source-stamp.json +4 -0
- package/dist/__tests__/acceptance-gate.test.js +15 -3
- package/dist/__tests__/acceptance-gate.test.js.map +1 -1
- package/dist/__tests__/completion-operation-contracts.test.js +1 -1
- package/dist/__tests__/completion-operation-contracts.test.js.map +1 -1
- package/dist/__tests__/evidence-atom-schema.test.js +3 -1
- package/dist/__tests__/evidence-atom-schema.test.js.map +1 -1
- package/dist/__tests__/gateway-contract.test.js +1 -1
- package/dist/__tests__/gateway-contract.test.js.map +1 -1
- package/dist/__tests__/memory-wire-shapes.test.js.map +1 -1
- package/dist/__tests__/operation-def.test.js +4 -3
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/acceptance-gate-schema.d.ts +25 -0
- package/dist/acceptance-gate-schema.d.ts.map +1 -1
- package/dist/acceptance-gate-schema.js +5 -0
- package/dist/acceptance-gate-schema.js.map +1 -1
- package/dist/acceptance-gate.d.ts +8 -0
- package/dist/acceptance-gate.d.ts.map +1 -1
- package/dist/brain-graph.d.ts +1 -1
- package/dist/brain-graph.js +1 -1
- package/dist/caamp-markers.d.ts +11 -0
- package/dist/caamp-markers.d.ts.map +1 -1
- package/dist/config/manifest.d.ts.map +1 -1
- package/dist/config/manifest.js +13 -0
- package/dist/config/manifest.js.map +1 -1
- package/dist/{config.d.ts → config/types.d.ts} +130 -6
- package/dist/config/types.d.ts.map +1 -0
- package/dist/{config.js → config/types.js} +1 -1
- package/dist/config/types.js.map +1 -0
- package/dist/config/worker-policy.d.ts +42 -0
- package/dist/config/worker-policy.d.ts.map +1 -0
- package/dist/config/worker-policy.js +35 -0
- package/dist/config/worker-policy.js.map +1 -0
- package/dist/data-accessor.d.ts +15 -0
- package/dist/data-accessor.d.ts.map +1 -1
- package/dist/data-accessor.js.map +1 -1
- package/dist/dependency.d.ts +2 -0
- package/dist/dependency.d.ts.map +1 -1
- package/dist/dispatch/__tests__/operation-envelope-snapshots.test.js +0 -6
- package/dist/dispatch/__tests__/operation-envelope-snapshots.test.js.map +1 -1
- package/dist/dispatch/identity.d.ts +3 -8
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +2 -8
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +360 -513
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/docs/modernize.d.ts +468 -0
- package/dist/docs/modernize.d.ts.map +1 -0
- package/dist/docs/modernize.js +145 -0
- package/dist/docs/modernize.js.map +1 -0
- package/dist/docs/provenance.d.ts +6 -6
- package/dist/docs-taxonomy.d.ts +6 -0
- package/dist/docs-taxonomy.d.ts.map +1 -1
- package/dist/docs-taxonomy.js +38 -1
- package/dist/docs-taxonomy.js.map +1 -1
- package/dist/done-plan.d.ts +34 -3
- package/dist/done-plan.d.ts.map +1 -1
- package/dist/evidence-atom-schema.d.ts +78 -4
- package/dist/evidence-atom-schema.d.ts.map +1 -1
- package/dist/evidence-atom-schema.js +136 -11
- package/dist/evidence-atom-schema.js.map +1 -1
- package/dist/evidence-record-schema.d.ts +2 -2
- package/dist/exit-codes.d.ts +93 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +93 -0
- package/dist/exit-codes.js.map +1 -1
- package/dist/{gateway.d.ts → gateway/index.d.ts} +4 -4
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/{gateway.js → gateway/index.js} +2 -2
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/rpc/messages.d.ts +4 -4
- package/dist/gateway/rpc/messages.js +1 -1
- package/dist/gateway/rpc/messages.js.map +1 -1
- package/dist/git-hooks.d.ts +29 -3
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +34 -3
- package/dist/git-hooks.js.map +1 -1
- package/dist/heavy-command-hook.d.ts +5 -0
- package/dist/heavy-command-hook.d.ts.map +1 -1
- package/dist/index.d.ts +23 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/invariants/sync-write-invariants.d.ts.map +1 -1
- package/dist/invariants/sync-write-invariants.js +29 -1
- package/dist/invariants/sync-write-invariants.js.map +1 -1
- package/dist/jobs.d.ts +5 -0
- package/dist/jobs.d.ts.map +1 -1
- package/dist/lease-ipc/messages.d.ts +5 -5
- package/dist/llm/onboarding.d.ts +1 -1
- package/dist/llm/system-of-use.d.ts +1 -1
- package/dist/llm/system-of-use.d.ts.map +1 -1
- package/dist/llm/system-resolver.d.ts +1 -1
- package/dist/llm/system-resolver.d.ts.map +1 -1
- package/dist/{memory.d.ts → memory/index.d.ts} +1 -1
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/{memory.js → memory/index.js} +1 -1
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/search.d.ts +20 -2
- package/dist/memory/search.d.ts.map +1 -1
- package/dist/merge-close.d.ts +277 -0
- package/dist/merge-close.d.ts.map +1 -0
- package/dist/merge-close.js +16 -0
- package/dist/merge-close.js.map +1 -0
- package/dist/nexus-cloud.d.ts +1 -1
- package/dist/operations/admin.d.ts +6 -0
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/docs.d.ts +233 -9
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/index.d.ts +0 -1
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +0 -1
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/memory.d.ts +7 -4
- package/dist/operations/memory.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.d.ts +0 -8
- package/dist/operations/nexus-scope-map.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.js +0 -8
- package/dist/operations/nexus-scope-map.js.map +1 -1
- package/dist/operations/nexus.d.ts +2 -10
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/operations/nexus.js.map +1 -1
- package/dist/operations/orchestrate.d.ts +219 -6
- package/dist/operations/orchestrate.d.ts.map +1 -1
- package/dist/operations/orchestrate.js +329 -1
- package/dist/operations/orchestrate.js.map +1 -1
- package/dist/operations/output-contracts-data.js +1 -1
- package/dist/operations/output-contracts-data.js.map +1 -1
- package/dist/operations/release.d.ts +0 -79
- package/dist/operations/release.d.ts.map +1 -1
- package/dist/operations/session.d.ts +1 -1
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/operations/tasks.d.ts +18 -6
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js.map +1 -1
- package/dist/operations/validate.d.ts +6 -0
- package/dist/operations/validate.d.ts.map +1 -1
- package/dist/operations/worktree.d.ts +209 -19
- package/dist/operations/worktree.d.ts.map +1 -1
- package/dist/orca-execution.d.ts +533 -0
- package/dist/orca-execution.d.ts.map +1 -0
- package/dist/orca-execution.js +385 -0
- package/dist/orca-execution.js.map +1 -0
- package/dist/project-context.d.ts +31 -0
- package/dist/project-context.d.ts.map +1 -1
- package/dist/project-hooks.d.ts +8 -8
- package/dist/release/authorization.d.ts +46 -0
- package/dist/release/authorization.d.ts.map +1 -0
- package/dist/release/authorization.js +10 -0
- package/dist/release/authorization.js.map +1 -0
- package/dist/release/hook-pilot.d.ts +1 -1
- package/dist/resource-governor.d.ts +44 -0
- package/dist/resource-governor.d.ts.map +1 -1
- package/dist/resource-governor.js +10 -0
- package/dist/resource-governor.js.map +1 -1
- package/dist/review-verdict.d.ts +253 -0
- package/dist/review-verdict.d.ts.map +1 -0
- package/dist/review-verdict.js +20 -0
- package/dist/review-verdict.js.map +1 -0
- package/dist/row-identity.d.ts +11 -0
- package/dist/row-identity.d.ts.map +1 -1
- package/dist/session-journal.d.ts.map +1 -1
- package/dist/session-journal.js +7 -1
- package/dist/session-journal.js.map +1 -1
- package/dist/session.d.ts +11 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js.map +1 -1
- package/dist/skills/migrate.d.ts +1 -1
- package/dist/skills/migrate.js +1 -1
- package/dist/skills/stats.d.ts +1 -1
- package/dist/skills/stats.js +1 -1
- package/dist/spawn-types.d.ts +57 -0
- package/dist/spawn-types.d.ts.map +1 -1
- package/dist/spawn.d.ts +43 -0
- package/dist/spawn.d.ts.map +1 -1
- package/dist/spawn.js +1 -0
- package/dist/spawn.js.map +1 -1
- package/dist/status-registry.d.ts +27 -0
- package/dist/status-registry.d.ts.map +1 -1
- package/dist/status-registry.js +28 -0
- package/dist/status-registry.js.map +1 -1
- package/dist/table-classification.d.ts +22 -0
- package/dist/table-classification.d.ts.map +1 -1
- package/dist/task-id.d.ts +8 -10
- package/dist/task-id.d.ts.map +1 -1
- package/dist/task-id.js +9 -48
- package/dist/task-id.js.map +1 -1
- package/dist/task-record.d.ts +10 -1
- package/dist/task-record.d.ts.map +1 -1
- package/dist/task.d.ts +177 -4
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js.map +1 -1
- package/dist/{tasks.d.ts → tasks/index.d.ts} +3 -3
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/{tasks.js → tasks/index.js} +2 -2
- package/dist/tasks/index.js.map +1 -0
- package/dist/templates/manifest.d.ts +1 -1
- package/dist/tools/build-task-tree.d.ts +1 -1
- package/dist/tools/build-task-tree.d.ts.map +1 -1
- package/dist/workgraph.d.ts +56 -56
- package/package.json +22 -6
- package/schemas/acceptance-gate.schema.json +24 -0
- package/schemas/task.schema.json +24 -0
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/acceptance-gate.test.ts +16 -3
- package/src/__tests__/completion-operation-contracts.test.ts +1 -1
- package/src/__tests__/evidence-atom-schema.test.ts +3 -1
- package/src/__tests__/gateway-contract.test.ts +1 -1
- package/src/__tests__/llm-config-schema.test.ts +1 -1
- package/src/__tests__/memory-wire-shapes.test.ts +4 -1
- package/src/__tests__/operation-def.test.ts +4 -3
- package/src/acceptance-gate-schema.ts +5 -0
- package/src/acceptance-gate.ts +9 -0
- package/src/brain-graph.ts +1 -1
- package/src/caamp-markers.ts +11 -0
- package/src/config/manifest.ts +13 -0
- package/src/{config.ts → config/types.ts} +134 -5
- package/src/config/worker-policy.ts +55 -0
- package/src/data-accessor.ts +16 -0
- package/src/dependency.ts +2 -0
- package/src/dispatch/__tests__/operation-envelope-snapshots.test.ts +0 -6
- package/src/dispatch/identity.ts +2 -8
- package/src/dispatch/operations-registry.ts +377 -525
- package/src/docs/modernize.ts +442 -0
- package/src/docs-taxonomy.ts +44 -1
- package/src/done-plan.ts +33 -2
- package/src/evidence-atom-schema.ts +167 -14
- package/src/exit-codes.ts +95 -0
- package/src/{gateway.ts → gateway/index.ts} +3 -3
- package/src/gateway/rpc/messages.ts +1 -1
- package/src/git-hooks.ts +43 -3
- package/src/heavy-command-hook.ts +5 -0
- package/src/index.ts +132 -48
- package/src/invariants/sync-write-invariants.ts +30 -0
- package/src/jobs.ts +5 -0
- package/src/llm/onboarding.ts +1 -1
- package/src/llm/system-of-use.ts +1 -1
- package/src/llm/system-resolver.ts +1 -1
- package/src/memory/search.ts +17 -2
- package/src/merge-close.ts +291 -0
- package/src/operations/admin.ts +6 -0
- package/src/operations/docs.ts +242 -10
- package/src/operations/index.ts +0 -1
- package/src/operations/memory.ts +7 -4
- package/src/operations/nexus-scope-map.ts +0 -8
- package/src/operations/nexus.ts +2 -11
- package/src/operations/orchestrate.ts +490 -6
- package/src/operations/output-contracts-data.ts +1 -1
- package/src/operations/release.ts +0 -87
- package/src/operations/session.ts +1 -1
- package/src/operations/tasks.ts +20 -7
- package/src/operations/validate.ts +6 -0
- package/src/operations/worktree.ts +216 -19
- package/src/orca-execution.ts +528 -0
- package/src/project-context.ts +33 -0
- package/src/release/authorization.ts +48 -0
- package/src/resource-governor.ts +47 -0
- package/src/review-verdict.ts +265 -0
- package/src/row-identity.ts +11 -0
- package/src/session-journal.ts +7 -1
- package/src/session.ts +11 -0
- package/src/skills/migrate.ts +1 -1
- package/src/skills/stats.ts +1 -1
- package/src/spawn-types.ts +75 -0
- package/src/spawn.ts +48 -0
- package/src/status-registry.ts +37 -0
- package/src/table-classification.ts +23 -0
- package/src/task-id.ts +9 -47
- package/src/task-record.ts +10 -1
- package/src/task.ts +171 -4
- package/src/{tasks.ts → tasks/index.ts} +3 -3
- package/src/tools/build-task-tree.ts +1 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/gateway.d.ts.map +0 -1
- package/dist/gateway.js.map +0 -1
- package/dist/memory.d.ts.map +0 -1
- package/dist/memory.js.map +0 -1
- package/dist/operations/conduit.d.ts +0 -285
- package/dist/operations/conduit.d.ts.map +0 -1
- package/dist/operations/conduit.js +0 -39
- package/dist/operations/conduit.js.map +0 -1
- package/dist/tasks.d.ts.map +0 -1
- package/dist/tasks.js.map +0 -1
- package/src/operations/conduit.ts +0 -348
- /package/src/{memory.ts → memory/index.ts} +0 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge closes tasks (T14101, owner decision D11209): the contract of the
|
|
3
|
+
* post-merge sweep that records a merged PR's evidence on the tasks its body
|
|
4
|
+
* names and completes them, with no agent step.
|
|
5
|
+
*
|
|
6
|
+
* A PR body names tasks one per line:
|
|
7
|
+
*
|
|
8
|
+
* - `Closes: T#### AC1,AC2` binds those criteria and completes the task once
|
|
9
|
+
* the criteria every merged PR bound cover all of the task's criteria.
|
|
10
|
+
* - `Refs: T#### AC1` binds those criteria from a PR that delivers part of a
|
|
11
|
+
* task, and leaves it open.
|
|
12
|
+
*
|
|
13
|
+
* @task T14101
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { MergedCleanupResult } from './operations/worktree.js';
|
|
17
|
+
|
|
18
|
+
/** One `Closes:` / `Refs:` line of a PR body. */
|
|
19
|
+
export interface MergeDirective {
|
|
20
|
+
/** `closes` completes the task; `refs` only binds criteria. */
|
|
21
|
+
kind: 'closes' | 'refs';
|
|
22
|
+
/** The task the line names. */
|
|
23
|
+
taskId: string;
|
|
24
|
+
/** Criterion aliases (`AC1`, …) the PR delivers, in the order written. */
|
|
25
|
+
acs: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* What a merged PR says, judged without a task store (the CI job's receipt):
|
|
30
|
+
* its lines, whether its required checks were green on its exact head, and
|
|
31
|
+
* why it closes nothing when it does not.
|
|
32
|
+
*/
|
|
33
|
+
export interface MergeReceipt {
|
|
34
|
+
/** PR number. */
|
|
35
|
+
prNumber: number;
|
|
36
|
+
/** The merge commit, or null when GitHub reports none. */
|
|
37
|
+
mergeSha: string | null;
|
|
38
|
+
/** The PR's final head. */
|
|
39
|
+
headSha: string | null;
|
|
40
|
+
/** The parsed lines. */
|
|
41
|
+
directives: MergeDirective[];
|
|
42
|
+
/** Malformed `Closes:` / `Refs:` lines, each with the fix. */
|
|
43
|
+
errors: string[];
|
|
44
|
+
/** Whether every required check passed on the PR's head. */
|
|
45
|
+
ciGreen: boolean;
|
|
46
|
+
/** Why CI does not count as green, when it does not. */
|
|
47
|
+
ciReason?: string;
|
|
48
|
+
/** Why the PR closes nothing at all, when it closes nothing. */
|
|
49
|
+
closesNothing?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** What the sweep did, or would do under `dryRun`, for one task of one PR. */
|
|
53
|
+
export interface MergeTaskOutcome {
|
|
54
|
+
/** The task. */
|
|
55
|
+
taskId: string;
|
|
56
|
+
/**
|
|
57
|
+
* `closed`: evidence recorded and the task completed. `bound`: a `Refs:`
|
|
58
|
+
* line's criteria recorded, the task left open. `already`: an earlier sweep
|
|
59
|
+
* handled this PR for the task, or the task was already done. `refused`:
|
|
60
|
+
* nothing recorded; `reason` says why. `waiting`: the merge commit's own CI
|
|
61
|
+
* run was cancelled, skipped or has not finished and nothing stands in yet;
|
|
62
|
+
* the PR is re-judged every sweep.
|
|
63
|
+
*/
|
|
64
|
+
action: 'closed' | 'bound' | 'already' | 'refused' | 'waiting';
|
|
65
|
+
/** The criteria the line named. */
|
|
66
|
+
acs: string[];
|
|
67
|
+
/** Why, for `refused` and `already`; for a dry run of an open PR, what would happen. */
|
|
68
|
+
reason?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The sweep's result for one merged PR. */
|
|
72
|
+
export interface MergePrOutcome {
|
|
73
|
+
/** PR number. */
|
|
74
|
+
prNumber: number;
|
|
75
|
+
/** Its merge commit. */
|
|
76
|
+
mergeSha: string | null;
|
|
77
|
+
/** One entry per task the PR names. */
|
|
78
|
+
outcomes: MergeTaskOutcome[];
|
|
79
|
+
/** Why nothing was attempted for this PR (no lines, malformed lines, CI not green). */
|
|
80
|
+
closesNothing?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The PR's attribution receipt, listed beside the outcome (T14252, SHADOW:
|
|
83
|
+
* it changes no outcome); every merged PR gets one, task or not. Absent
|
|
84
|
+
* while the merge's CI is still running.
|
|
85
|
+
*/
|
|
86
|
+
attribution?: Pick<MergeAttributionReceipt, 'verdict' | 'claim' | 'reason'>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* What a merged PR's merge-commit CI shows about the PR itself (T14252), from
|
|
91
|
+
* a test-level first-parent differential: a failure the first parent's run
|
|
92
|
+
* also shows is `disjoint`; one new at the merge is `pr-caused` (or
|
|
93
|
+
* `combination` when the PR head's own run passed that job); a merge whose
|
|
94
|
+
* runs were only cancelled or skipped is `superseded`; a budget tripwire the
|
|
95
|
+
* PR crossed (bundle size, gate-39 module counts, `gen:sdk` drift) over a
|
|
96
|
+
* passing parent is `budget-crossed`; a flaky-quarantine-budget-only failure
|
|
97
|
+
* is `main-health`, never attributed to the merging PR (D11225); no parent
|
|
98
|
+
* observation is `unknown`, never a guess.
|
|
99
|
+
*/
|
|
100
|
+
export type MergeAttributionVerdict =
|
|
101
|
+
| 'clean'
|
|
102
|
+
| 'superseded'
|
|
103
|
+
| 'disjoint'
|
|
104
|
+
| 'pr-caused'
|
|
105
|
+
| 'combination'
|
|
106
|
+
| 'budget-crossed'
|
|
107
|
+
| 'main-health'
|
|
108
|
+
| 'unknown';
|
|
109
|
+
|
|
110
|
+
/** One failing merge-commit job and how it was attributed (T14252). */
|
|
111
|
+
export interface MergeAttributionFailure {
|
|
112
|
+
/** Job (check run) name. */
|
|
113
|
+
job: string;
|
|
114
|
+
/** Test identities (`<project>:<file>`) that failed it and decided it. */
|
|
115
|
+
tests: string[];
|
|
116
|
+
/** Non-test cause: `flaky-quarantine-budget`, `runner-cancel`, `worker-crash`, `setup`, or `step:<command>`. */
|
|
117
|
+
cause: string | null;
|
|
118
|
+
/** This job's verdict. */
|
|
119
|
+
verdict: MergeAttributionVerdict;
|
|
120
|
+
/** Why, naming the parent observation. */
|
|
121
|
+
reason: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The later main run that resolved an `unknown` receipt (T14255): every
|
|
126
|
+
* undecided job passed, without a rerun, on a main commit that contains the
|
|
127
|
+
* change.
|
|
128
|
+
*/
|
|
129
|
+
export interface MergeAttributionResolution {
|
|
130
|
+
/** What it proves. */
|
|
131
|
+
claim: 'holds-on-main';
|
|
132
|
+
/** The later main commit. */
|
|
133
|
+
sha: string;
|
|
134
|
+
/** How that commit contains the change: it descends from the merge, or carries the same patch. */
|
|
135
|
+
via: 'ancestry' | 'patch-id';
|
|
136
|
+
/** The run attempts judged on it. */
|
|
137
|
+
runs: MergeAttributionRunPin[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* One workflow run attempt a receipt was judged on (T14253): GitHub keeps
|
|
142
|
+
* only each job's latest attempt on a commit, so the receipt pins which
|
|
143
|
+
* attempt it read and when it completed.
|
|
144
|
+
*/
|
|
145
|
+
export interface MergeAttributionRunPin {
|
|
146
|
+
/** The workflow run id. */
|
|
147
|
+
runId: number;
|
|
148
|
+
/** Its attempt (1 = the first run, above 1 = a rerun). */
|
|
149
|
+
attempt: number;
|
|
150
|
+
/** When the attempt's last judged job completed, when known. */
|
|
151
|
+
completedAt: string | null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The attribution receipt of one merged PR (T14252): computed once per
|
|
156
|
+
* (PR, resolved merge sha) and kept in `.cleo/audit/merge-attribution.jsonl`
|
|
157
|
+
* (a `merge_attribution` audit row on the PR's task points at it). In
|
|
158
|
+
* SHADOW mode (D11224) it is recorded beside the sweep's outcome and changes
|
|
159
|
+
* no closure.
|
|
160
|
+
*/
|
|
161
|
+
export interface MergeAttributionReceipt {
|
|
162
|
+
/** PR number. */
|
|
163
|
+
prNumber: number;
|
|
164
|
+
/** The PR head the receipt judged. */
|
|
165
|
+
headSha: string | null;
|
|
166
|
+
/** The merge commit. */
|
|
167
|
+
mergeSha: string;
|
|
168
|
+
/** How the merge sha was resolved. */
|
|
169
|
+
resolvedFrom: 'merge-commit';
|
|
170
|
+
/** The merge's first parent, the differential's baseline. */
|
|
171
|
+
parentSha: string | null;
|
|
172
|
+
/**
|
|
173
|
+
* The merge run attempts judged (T14253): each job at its first attempt,
|
|
174
|
+
* unless a later attempt on the same sha passed it.
|
|
175
|
+
*/
|
|
176
|
+
mergeRuns: MergeAttributionRunPin[];
|
|
177
|
+
/** The parent run attempts compared: those that had started when the merge job ran (T14253). */
|
|
178
|
+
parentRuns: MergeAttributionRunPin[];
|
|
179
|
+
/** Failing merge-commit jobs, each attributed. */
|
|
180
|
+
failures: MergeAttributionFailure[];
|
|
181
|
+
/**
|
|
182
|
+
* The open `main-over-budget` fix task per budget the PR crossed, filed or
|
|
183
|
+
* found (T14254); absent when it crossed none.
|
|
184
|
+
*/
|
|
185
|
+
budgetTasks?: string[];
|
|
186
|
+
/** Why a crossed budget got no fix task (the PR names no task under an epic). */
|
|
187
|
+
budgetTaskSkipped?: string;
|
|
188
|
+
/**
|
|
189
|
+
* How an `unknown` receipt was later resolved (T14255): a completed green
|
|
190
|
+
* run of its undecided jobs on a later main commit containing the change.
|
|
191
|
+
* The verdict stays `unknown`; it never closes a task by itself.
|
|
192
|
+
*/
|
|
193
|
+
resolution?: MergeAttributionResolution;
|
|
194
|
+
/** The last later main commit inspected without such a run; the next look starts after it. */
|
|
195
|
+
unresolvedThrough?: string;
|
|
196
|
+
/** The PR's verdict: the most serious of its jobs'. */
|
|
197
|
+
verdict: MergeAttributionVerdict;
|
|
198
|
+
/** What the verdict proves: the change holds on main, or only the head was tested, or nothing. */
|
|
199
|
+
claim: 'holds-on-main' | 'green-at-head' | 'none';
|
|
200
|
+
/** One line naming the deciding job and observation. */
|
|
201
|
+
reason: string;
|
|
202
|
+
/** The rule's version, so a later rule never reads an older receipt as its own. */
|
|
203
|
+
ruleVersion: number;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Options of `sweepMergedClosures`. */
|
|
207
|
+
export interface MergeSweepOptions {
|
|
208
|
+
/** Report what would be recorded; write, complete and comment nothing. */
|
|
209
|
+
dryRun?: boolean;
|
|
210
|
+
/** Ignore the throttle (`cleo release` always passes it). */
|
|
211
|
+
force?: boolean;
|
|
212
|
+
/** Only PRs merged at or after this ISO time (default: the last sweep's high-water mark). */
|
|
213
|
+
since?: string;
|
|
214
|
+
/** Only these PRs (implies `force`). */
|
|
215
|
+
prNumbers?: number[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** What the sweep did with open `macos-regression` issues (T14104). */
|
|
219
|
+
export interface MacosRegressionSync {
|
|
220
|
+
/** Tasks created for newly seen issues (under `dryRun`: issue URLs that would get one). */
|
|
221
|
+
created: string[];
|
|
222
|
+
/** Issue URLs closed because their task is done. */
|
|
223
|
+
closedIssues: string[];
|
|
224
|
+
/** Why the issues were not read. */
|
|
225
|
+
skippedReason?: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** The newest release's provenance reconcile, run by the sweep (T14102). */
|
|
229
|
+
export interface MergeSweepReconcile {
|
|
230
|
+
/** The release version, or null when there is none. */
|
|
231
|
+
version: string | null;
|
|
232
|
+
/** What happened. */
|
|
233
|
+
action: 'reconciled' | 'already' | 'unpublished' | 'none' | 'failed';
|
|
234
|
+
/** Why, when it did not reconcile. */
|
|
235
|
+
reason?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** The other upkeep one sweep runs after the closures, inside the same claim. */
|
|
239
|
+
export interface MergeSweepHooks {
|
|
240
|
+
/** Task ids flagged `docs-update` for docs a merged change left stale (T14111). */
|
|
241
|
+
docsRot?: string[];
|
|
242
|
+
/** `macos-regression` issues turned into tasks, and closed when their task is done (T14104). */
|
|
243
|
+
macosRegression?: MacosRegressionSync;
|
|
244
|
+
/** The newest release's reconcile (T14102); skipped under `dryRun`. */
|
|
245
|
+
reconcile?: MergeSweepReconcile;
|
|
246
|
+
/**
|
|
247
|
+
* Worktrees, branches and nested copies merged work left behind, removed
|
|
248
|
+
* per applied PR (T14142). Off unless `CLEO_MERGE_SWEEP_CLEANUP=1`.
|
|
249
|
+
*/
|
|
250
|
+
cleanup?: MergedCleanupResult[];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Result of `sweepMergedClosures` / `cleo done --from-merge`. */
|
|
254
|
+
export interface MergeSweepResult {
|
|
255
|
+
/** False when the sweep did not run: throttled, `gh` unavailable, or offline. */
|
|
256
|
+
swept: boolean;
|
|
257
|
+
/** Why it did not run. */
|
|
258
|
+
skippedReason?: string;
|
|
259
|
+
/** Whether this was a dry run. */
|
|
260
|
+
dryRun: boolean;
|
|
261
|
+
/** Each merged PR considered, oldest merge first. */
|
|
262
|
+
prs: MergePrOutcome[];
|
|
263
|
+
/** Tasks completed (under `dryRun`: that would be). */
|
|
264
|
+
closed: string[];
|
|
265
|
+
/** Tasks with criteria bound by `Refs:`, left open. */
|
|
266
|
+
bound: string[];
|
|
267
|
+
/** Tasks nothing was recorded for, with the reason. */
|
|
268
|
+
refused: Array<{ taskId: string; prNumber: number; reason: string }>;
|
|
269
|
+
/** Task outcomes waiting on their merge commit's CI (re-judged every sweep). */
|
|
270
|
+
waiting: number;
|
|
271
|
+
/** Cancelled or skipped merge-commit CI runs this sweep reran (once per merge commit, ever). */
|
|
272
|
+
reran: number;
|
|
273
|
+
/**
|
|
274
|
+
* Set when more PRs merged than one sweep's page budget reads: `read` PRs
|
|
275
|
+
* were processed, and those merged in `[unreadSince, unreadBefore]` are read
|
|
276
|
+
* first by the next sweep (never skipped).
|
|
277
|
+
*/
|
|
278
|
+
truncated?: { read: number; unreadSince: string; unreadBefore: string };
|
|
279
|
+
/**
|
|
280
|
+
* The pre-merge check of open PRs carrying Closes:/Refs: lines (T14122):
|
|
281
|
+
* the `cleo/merge-close` status each head got, and why when it failed.
|
|
282
|
+
*/
|
|
283
|
+
openChecks?: Array<{
|
|
284
|
+
prNumber: number;
|
|
285
|
+
headSha: string;
|
|
286
|
+
state: 'success' | 'failure';
|
|
287
|
+
description: string;
|
|
288
|
+
}>;
|
|
289
|
+
/** The upkeep run in the same sweep, when any ran. */
|
|
290
|
+
hooks?: MergeSweepHooks;
|
|
291
|
+
}
|
package/src/operations/admin.ts
CHANGED
|
@@ -1662,6 +1662,12 @@ export interface AdminBackupMutateParams {
|
|
|
1662
1662
|
confirmOwnerStore?: boolean;
|
|
1663
1663
|
/** Create: also back up the global store (`<CLEO_HOME>/cleo.db`, T13245). */
|
|
1664
1664
|
includeGlobal?: boolean;
|
|
1665
|
+
/**
|
|
1666
|
+
* Create: write the backup into this directory (the global copy under
|
|
1667
|
+
* `<destination>/global`) instead of the rotating backup dirs; it never
|
|
1668
|
+
* rotates or is rotated (T13209).
|
|
1669
|
+
*/
|
|
1670
|
+
destination?: string;
|
|
1665
1671
|
/** Restore by id: `global` restores a backup of the global store (T13245). */
|
|
1666
1672
|
scope?: 'project' | 'global';
|
|
1667
1673
|
}
|
package/src/operations/docs.ts
CHANGED
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
|
|
33
33
|
import { z } from 'zod';
|
|
34
34
|
import type { AttachmentKind } from '../attachment.js';
|
|
35
|
+
import type { TaskPopulation } from '../data-accessor.js';
|
|
36
|
+
import type { DocsModernizePlan, DocsModernizeReceipt } from '../docs/modernize.js';
|
|
35
37
|
import { BUILTIN_DOC_KIND_VALUES, type BuiltinDocKind } from '../docs-taxonomy.js';
|
|
36
38
|
import type {
|
|
37
39
|
BackgroundJobStatus,
|
|
@@ -316,6 +318,12 @@ export interface DocsListResult {
|
|
|
316
318
|
* @task T9792
|
|
317
319
|
*/
|
|
318
320
|
totalCount?: number;
|
|
321
|
+
/**
|
|
322
|
+
* How many attachments matched, how many this response returns, whether it
|
|
323
|
+
* left any out, and the window applied (`null`: every match, `--limit 0`).
|
|
324
|
+
* The same shape `cleo list` reports (T14115).
|
|
325
|
+
*/
|
|
326
|
+
population: Pick<TaskPopulation, 'matched' | 'returned' | 'truncated' | 'limit'>;
|
|
319
327
|
/**
|
|
320
328
|
* Effective limit applied to this response. Mirrored from the request
|
|
321
329
|
* (or {@link DOCS_LIST_DEFAULT_LIMIT} when the request did not set one)
|
|
@@ -458,6 +466,37 @@ export interface DocsFetchResult {
|
|
|
458
466
|
* ratifies.
|
|
459
467
|
*/
|
|
460
468
|
linkedDecisions?: string[];
|
|
469
|
+
/**
|
|
470
|
+
* Where this doc sits in its supersession chain and what it serves
|
|
471
|
+
* (T14110). Present for slugged docs.
|
|
472
|
+
*/
|
|
473
|
+
lineage?: DocsLineage;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* A doc's supersession chain and the work it serves (T14110). Built from the
|
|
478
|
+
* existing `supersedes`/`superseded_by` pointers, task refs and
|
|
479
|
+
* `related_tasks`; nothing here is stored separately.
|
|
480
|
+
*/
|
|
481
|
+
export interface DocsLineage {
|
|
482
|
+
/** The doc's lifecycle status (`superseded` when replaced). */
|
|
483
|
+
readonly lifecycleStatus: string;
|
|
484
|
+
/** Slug of the doc this one replaced, when any. */
|
|
485
|
+
readonly supersedes: string | null;
|
|
486
|
+
/** Slug of the doc that replaced this one, when any. */
|
|
487
|
+
readonly supersededBy: string | null;
|
|
488
|
+
/**
|
|
489
|
+
* Slug of the current doc at the end of the `superseded_by` chain: this
|
|
490
|
+
* doc's own slug when it is current. Read this one instead.
|
|
491
|
+
*/
|
|
492
|
+
readonly currentSlug: string;
|
|
493
|
+
/** Task ids the doc serves: its task owners and the tasks its body names. */
|
|
494
|
+
readonly servesTasks: readonly string[];
|
|
495
|
+
/**
|
|
496
|
+
* Decisions this doc supersedes: the `supersedes` of each decision it links
|
|
497
|
+
* (`docs link-decision`). Absent when it links none that supersede another.
|
|
498
|
+
*/
|
|
499
|
+
readonly supersedesDecisions?: readonly string[];
|
|
461
500
|
}
|
|
462
501
|
|
|
463
502
|
// --------------------------------------------------------------------------
|
|
@@ -570,6 +609,12 @@ export interface DocsAddParams {
|
|
|
570
609
|
* @saga T9855
|
|
571
610
|
*/
|
|
572
611
|
strict?: boolean;
|
|
612
|
+
/**
|
|
613
|
+
* Why this doc is new although it resembles an existing one (T14109). A
|
|
614
|
+
* likely duplicate is refused unless this states the reason (at least 15
|
|
615
|
+
* characters); the reason is recorded in `.cleo/audit/docs-new-because.jsonl`.
|
|
616
|
+
*/
|
|
617
|
+
newBecause?: string;
|
|
573
618
|
}
|
|
574
619
|
|
|
575
620
|
/** Canonical attachment and owner whose optional projections may be prepared. */
|
|
@@ -755,6 +800,12 @@ export interface DocsAddResult {
|
|
|
755
800
|
* @task T10360
|
|
756
801
|
*/
|
|
757
802
|
adrNumber?: number;
|
|
803
|
+
/**
|
|
804
|
+
* The doc's head version uid (T14329): recorded by the add itself, so the
|
|
805
|
+
* expected-base fence (`docs update --base-version-uid`) works from the
|
|
806
|
+
* first edit. Absent for a slug-less attachment.
|
|
807
|
+
*/
|
|
808
|
+
headVersionUid?: string;
|
|
758
809
|
}
|
|
759
810
|
|
|
760
811
|
// --------------------------------------------------------------------------
|
|
@@ -893,10 +944,9 @@ export interface DocsUpdateResult {
|
|
|
893
944
|
/** ISO 8601 timestamp the new row was registered. */
|
|
894
945
|
updatedAt: string;
|
|
895
946
|
/**
|
|
896
|
-
*
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
* first update and increments by 1 thereafter.
|
|
947
|
+
* The doc's version count from its version DAG (T14288): every version row
|
|
948
|
+
* of the doc's uid, the new one included. A doc with no version history yet
|
|
949
|
+
* reports its registry row's `docVersion` counter.
|
|
900
950
|
*/
|
|
901
951
|
version: number;
|
|
902
952
|
/** CLEO release or owner version associated with the new row. */
|
|
@@ -1104,6 +1154,12 @@ export interface DocsDoctorParams {
|
|
|
1104
1154
|
repair?: boolean;
|
|
1105
1155
|
/** Age threshold (days) for the `stale-drafts` diagnostic. Default 30. */
|
|
1106
1156
|
olderThanDays?: number;
|
|
1157
|
+
/**
|
|
1158
|
+
* Comma-separated repair classes to scope the run to (T14174), for example
|
|
1159
|
+
* `publication-ledger-drift`. Only their repairs are planned and, with
|
|
1160
|
+
* `apply`, written. Diagnostics still cover every class.
|
|
1161
|
+
*/
|
|
1162
|
+
only?: string;
|
|
1107
1163
|
}
|
|
1108
1164
|
|
|
1109
1165
|
/**
|
|
@@ -1121,7 +1177,9 @@ export interface DocsDoctorDiagnostic {
|
|
|
1121
1177
|
| 'legacy-store-present'
|
|
1122
1178
|
| 'legacy-blob-coverage'
|
|
1123
1179
|
| 'stale-drafts'
|
|
1124
|
-
| 'conduit-history-gaps'
|
|
1180
|
+
| 'conduit-history-gaps'
|
|
1181
|
+
| 'publication-ledger-drift'
|
|
1182
|
+
| 'old-identity-stuck';
|
|
1125
1183
|
/** `error` should be fixed promptly; `info` is observational. */
|
|
1126
1184
|
severity: 'info' | 'warn' | 'error';
|
|
1127
1185
|
/** Total offenders found (may exceed `items.length`). */
|
|
@@ -1164,10 +1222,18 @@ export interface DocsDoctorResult {
|
|
|
1164
1222
|
olderThanDays: number;
|
|
1165
1223
|
/** Backup receipt that authorised this run (null on dry runs). */
|
|
1166
1224
|
backupReceiptPath: string | null;
|
|
1167
|
-
/** All
|
|
1225
|
+
/** All ten diagnostics, in declaration order. */
|
|
1168
1226
|
diagnostics: readonly DocsDoctorDiagnostic[];
|
|
1169
1227
|
/** Repair plan (dry run) or executed repairs (apply). */
|
|
1170
1228
|
repairs: readonly DocsDoctorRepairAction[];
|
|
1229
|
+
/** Repairs per class: planned entries and those written (T14174). */
|
|
1230
|
+
repairCounts: Readonly<
|
|
1231
|
+
Partial<
|
|
1232
|
+
Record<DocsDoctorDiagnostic['kind'], { readonly planned: number; readonly applied: number }>
|
|
1233
|
+
>
|
|
1234
|
+
>;
|
|
1235
|
+
/** The repair classes this run was scoped to, or null for every class (T14174). */
|
|
1236
|
+
only: readonly DocsDoctorDiagnostic['kind'][] | null;
|
|
1171
1237
|
/** One-line human summary. */
|
|
1172
1238
|
summary: string;
|
|
1173
1239
|
}
|
|
@@ -1242,6 +1308,87 @@ export interface DocsStatsResult {
|
|
|
1242
1308
|
readonly summary: string;
|
|
1243
1309
|
}
|
|
1244
1310
|
|
|
1311
|
+
/**
|
|
1312
|
+
* Parameters for `docs.rot` — the docs-rot report (T14111).
|
|
1313
|
+
*
|
|
1314
|
+
* Read-only and git-only: it reads tracked markdown and git history, never
|
|
1315
|
+
* the docs store, so it runs the same in CI and locally.
|
|
1316
|
+
*
|
|
1317
|
+
* @task T14111 (Epic T14106)
|
|
1318
|
+
*/
|
|
1319
|
+
export interface DocsRotParams {
|
|
1320
|
+
/**
|
|
1321
|
+
* Git revision range `<base>..<head>` of a merged change. When set, the
|
|
1322
|
+
* report also lists the docs whose `covers:` globs match a file the range
|
|
1323
|
+
* changed (and that the range did not update itself).
|
|
1324
|
+
*/
|
|
1325
|
+
readonly changed?: string;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* A doc whose declared `covers:` code changed without the doc changing.
|
|
1330
|
+
*
|
|
1331
|
+
* @task T14111
|
|
1332
|
+
*/
|
|
1333
|
+
export interface DocsRotCoverageHit {
|
|
1334
|
+
/** Repo-relative path of the doc. */
|
|
1335
|
+
readonly doc: string;
|
|
1336
|
+
/** Covered files that changed (sorted, repo-relative). */
|
|
1337
|
+
readonly files: readonly string[];
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* A group of docs that duplicate each other: identical bodies, or titles
|
|
1342
|
+
* close enough that one is a fork of the other.
|
|
1343
|
+
*
|
|
1344
|
+
* @task T14111
|
|
1345
|
+
*/
|
|
1346
|
+
export interface DocsRotDuplicate {
|
|
1347
|
+
/** Why the docs were grouped: `content` (same body) or `title`. */
|
|
1348
|
+
readonly reason: 'content' | 'title';
|
|
1349
|
+
/** Repo-relative paths of the duplicates (sorted). */
|
|
1350
|
+
readonly docs: readonly string[];
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
/**
|
|
1354
|
+
* A doc nothing ties to the repo: a `covers:` glob that matches no tracked
|
|
1355
|
+
* file, or a `docs/` file no other tracked file references.
|
|
1356
|
+
*
|
|
1357
|
+
* @task T14111
|
|
1358
|
+
*/
|
|
1359
|
+
export interface DocsRotOrphan {
|
|
1360
|
+
/** Repo-relative path of the doc. */
|
|
1361
|
+
readonly doc: string;
|
|
1362
|
+
/** `dead-covers` (globs listed in `globs`) or `unreferenced`. */
|
|
1363
|
+
readonly reason: 'dead-covers' | 'unreferenced';
|
|
1364
|
+
/** The covers globs that match nothing (only for `dead-covers`). */
|
|
1365
|
+
readonly globs?: readonly string[];
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
/**
|
|
1369
|
+
* Result of `docs.rot` — stale, duplicate and orphaned docs (T14111).
|
|
1370
|
+
*
|
|
1371
|
+
* @task T14111
|
|
1372
|
+
*/
|
|
1373
|
+
export interface DocsRotResult {
|
|
1374
|
+
/** Tracked markdown docs scanned. */
|
|
1375
|
+
readonly scanned: number;
|
|
1376
|
+
/** Docs that declare `covers:`. */
|
|
1377
|
+
readonly covering: number;
|
|
1378
|
+
/** Docs whose covered code changed after the doc last changed on main. */
|
|
1379
|
+
readonly stale: readonly DocsRotCoverageHit[];
|
|
1380
|
+
/** Duplicate doc groups. */
|
|
1381
|
+
readonly duplicates: readonly DocsRotDuplicate[];
|
|
1382
|
+
/** Orphaned docs. */
|
|
1383
|
+
readonly orphans: readonly DocsRotOrphan[];
|
|
1384
|
+
/** Docs the `changed` range flags for update (empty without `changed`). */
|
|
1385
|
+
readonly flagged: readonly DocsRotCoverageHit[];
|
|
1386
|
+
/** Wall time of the scan in milliseconds. */
|
|
1387
|
+
readonly durationMs: number;
|
|
1388
|
+
/** One-line human summary. */
|
|
1389
|
+
readonly summary: string;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1245
1392
|
// ============================================================================
|
|
1246
1393
|
// Discriminated Union (DocsOps)
|
|
1247
1394
|
// ============================================================================
|
|
@@ -1269,7 +1416,59 @@ export type DocsOps =
|
|
|
1269
1416
|
| { op: 'docs.unlink-decision'; params: DocsDecisionLinkParams; result: DocsDecisionLinkResult }
|
|
1270
1417
|
| { op: 'docs.doctor'; params: DocsDoctorParams; result: DocsDoctorResult }
|
|
1271
1418
|
| { op: 'docs.migrate'; params: DocsMigrateParams; result: DocsMigrateResult }
|
|
1272
|
-
| { op: 'docs.
|
|
1419
|
+
| { op: 'docs.modernize'; params: DocsModernizeParams; result: DocsModernizeResult }
|
|
1420
|
+
| { op: 'docs.stats'; params: DocsStatsParams; result: DocsStatsResult }
|
|
1421
|
+
| { op: 'docs.rot'; params: DocsRotParams; result: DocsRotResult };
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Parameters for `docs.modernize` (T14113) — dry run by default.
|
|
1425
|
+
*/
|
|
1426
|
+
export interface DocsModernizeParams {
|
|
1427
|
+
/** Folder to modernize, relative to the project root or absolute. Required unless `rollback`. */
|
|
1428
|
+
readonly path?: string;
|
|
1429
|
+
/** Execute the plan; without it the run is a dry run that writes nothing. */
|
|
1430
|
+
readonly apply?: boolean;
|
|
1431
|
+
/** Apply this saved plan JSON verbatim instead of re-planning. */
|
|
1432
|
+
readonly planFile?: string;
|
|
1433
|
+
/** Save the plan JSON here. */
|
|
1434
|
+
readonly out?: string;
|
|
1435
|
+
/** Roll back the apply run with this id. */
|
|
1436
|
+
readonly rollback?: string;
|
|
1437
|
+
/** Extra folder names to skip, comma-separated. */
|
|
1438
|
+
readonly exclude?: string;
|
|
1439
|
+
/** Path of a `DocsModernizeOverrides` JSON file keyed by root-relative path. */
|
|
1440
|
+
readonly overrides?: string;
|
|
1441
|
+
/** Use this kind for every file instead of classifying. */
|
|
1442
|
+
readonly kind?: string;
|
|
1443
|
+
/** Ingest every file into the store (task-owned, slugless) and leave the folder untouched. */
|
|
1444
|
+
readonly storeOnly?: boolean;
|
|
1445
|
+
/** Apply even when the root is not a clean git checkout. */
|
|
1446
|
+
readonly allowDirty?: boolean;
|
|
1447
|
+
/**
|
|
1448
|
+
* Rewrite relative links to planned docs as `[[slug]]` wikilinks (opt-in).
|
|
1449
|
+
* By default links stay markdown, re-pointed at the new paths (T14185).
|
|
1450
|
+
*/
|
|
1451
|
+
readonly wikilinks?: boolean;
|
|
1452
|
+
/** Modernize the docs already in the store (re-kind, re-slug with aliases, ADR numbers). */
|
|
1453
|
+
readonly store?: boolean;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
/**
|
|
1457
|
+
* Result of `docs.modernize`: the plan (dry run, apply) and the receipt
|
|
1458
|
+
* (apply, rollback).
|
|
1459
|
+
*/
|
|
1460
|
+
export interface DocsModernizeResult {
|
|
1461
|
+
/** What ran. */
|
|
1462
|
+
readonly mode: 'dry-run' | 'apply' | 'rollback';
|
|
1463
|
+
/** The plan, or null for a rollback. */
|
|
1464
|
+
readonly plan: DocsModernizePlan | null;
|
|
1465
|
+
/** Where the plan was saved, when `out` was given. */
|
|
1466
|
+
readonly planPath: string | null;
|
|
1467
|
+
/** The receipt, or null for a dry run. */
|
|
1468
|
+
readonly receipt: DocsModernizeReceipt | null;
|
|
1469
|
+
/** One-line human summary. */
|
|
1470
|
+
readonly summary: string;
|
|
1471
|
+
}
|
|
1273
1472
|
|
|
1274
1473
|
/**
|
|
1275
1474
|
* Parameters for `docs.migrate` — the T13360 legacy docs migration (spec §5).
|
|
@@ -1278,8 +1477,28 @@ export type DocsOps =
|
|
|
1278
1477
|
* @task T13360 (Epic T13340 / Saga T13339)
|
|
1279
1478
|
*/
|
|
1280
1479
|
export interface DocsMigrateParams {
|
|
1281
|
-
/**
|
|
1282
|
-
|
|
1480
|
+
/**
|
|
1481
|
+
* At most this many docs per run, oldest first (T14329); default all. Each
|
|
1482
|
+
* run is one harness transaction with its own backup; run again to continue.
|
|
1483
|
+
*/
|
|
1484
|
+
readonly limit?: number;
|
|
1485
|
+
/** Report the plan's counts and write nothing (T14331). */
|
|
1486
|
+
readonly dryRun?: boolean;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* An old-recipe doc `docs migrate` cannot move onto the shared identity
|
|
1491
|
+
* (T14336): another doc row already holds the shared uid (for example a doc
|
|
1492
|
+
* renamed onto the slug the identity derives from). It stays listed until the
|
|
1493
|
+
* owner resolves it; the step writes nothing for it.
|
|
1494
|
+
*/
|
|
1495
|
+
export interface DocsMigrateRekeySkip {
|
|
1496
|
+
/** The stuck doc's slug. */
|
|
1497
|
+
readonly slug: string;
|
|
1498
|
+
/** Why it cannot move. */
|
|
1499
|
+
readonly reason: 'shared-uid-taken';
|
|
1500
|
+
/** The slug of the doc row holding the shared uid. */
|
|
1501
|
+
readonly holder: string;
|
|
1283
1502
|
}
|
|
1284
1503
|
|
|
1285
1504
|
/**
|
|
@@ -1306,6 +1525,17 @@ export interface DocsMigrateResult {
|
|
|
1306
1525
|
readonly nativeConflicts: number;
|
|
1307
1526
|
/** History rows imported across all captured docs. */
|
|
1308
1527
|
readonly versionsImported: number;
|
|
1528
|
+
/** Docs left for a later run by the `limit` bound (T14329). */
|
|
1529
|
+
readonly remaining: number;
|
|
1530
|
+
/**
|
|
1531
|
+
* Docs moved off the pre-T14332 recipe onto the shared identity, children
|
|
1532
|
+
* included (T14336); on a dry run, the docs that would move.
|
|
1533
|
+
*/
|
|
1534
|
+
readonly rekeyed: number;
|
|
1535
|
+
/** Old-recipe docs that cannot move, each with its reason (T14336); empty when none. */
|
|
1536
|
+
readonly rekeySkipped: readonly DocsMigrateRekeySkip[];
|
|
1537
|
+
/** True for a dry run: the counts are the plan, nothing was written (T14331). */
|
|
1538
|
+
readonly dryRun: boolean;
|
|
1309
1539
|
/** First failure when halted/refused. */
|
|
1310
1540
|
readonly failure: string | null;
|
|
1311
1541
|
/** The harness pre-step backup id (null only when the backup itself failed). */
|
|
@@ -1336,4 +1566,6 @@ export type DocsOp =
|
|
|
1336
1566
|
| 'docs.unlink-decision'
|
|
1337
1567
|
| 'docs.doctor'
|
|
1338
1568
|
| 'docs.migrate'
|
|
1339
|
-
| 'docs.
|
|
1569
|
+
| 'docs.modernize'
|
|
1570
|
+
| 'docs.stats'
|
|
1571
|
+
| 'docs.rot';
|
package/src/operations/index.ts
CHANGED
|
@@ -10,7 +10,6 @@ export * from './agent-operation-contract.js';
|
|
|
10
10
|
export * from './attention.js';
|
|
11
11
|
export * from './brain.js';
|
|
12
12
|
export * from './check.js';
|
|
13
|
-
export * from './conduit.js';
|
|
14
13
|
export * from './dialectic.js';
|
|
15
14
|
export * from './docs.js';
|
|
16
15
|
export * from './focus.js';
|
package/src/operations/memory.ts
CHANGED
|
@@ -68,8 +68,8 @@ export type MemoryPatternImpact = 'low' | 'medium' | 'high';
|
|
|
68
68
|
export interface MemoryCompactHit {
|
|
69
69
|
/** Memory entry identifier (e.g. `O-abc123`, `D-def456`). */
|
|
70
70
|
id: string;
|
|
71
|
-
/** Table this hit was drawn from. */
|
|
72
|
-
type: 'decision' | 'pattern' | 'learning' | 'observation';
|
|
71
|
+
/** Table this hit was drawn from, or `doc` for the docs store (T14152). */
|
|
72
|
+
type: 'decision' | 'pattern' | 'learning' | 'observation' | 'doc';
|
|
73
73
|
/** Normalized display title for the entry. */
|
|
74
74
|
title: string;
|
|
75
75
|
/** ISO 8601 timestamp of entry creation. */
|
|
@@ -173,8 +173,11 @@ export interface MemoryFindParams {
|
|
|
173
173
|
query: string;
|
|
174
174
|
/** Max results to return. */
|
|
175
175
|
limit?: number;
|
|
176
|
-
/**
|
|
177
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Sources to search (defaults to the four BRAIN tables). `docs` adds the
|
|
178
|
+
* docs store: current docs only, ranked with BRAIN hits (T14152).
|
|
179
|
+
*/
|
|
180
|
+
tables?: Array<'decisions' | 'patterns' | 'learnings' | 'observations' | 'docs'>;
|
|
178
181
|
/** ISO 8601 lower bound on entry date. */
|
|
179
182
|
dateStart?: string;
|
|
180
183
|
/** ISO 8601 upper bound on entry date. */
|