@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
package/src/operations/tasks.ts
CHANGED
|
@@ -25,7 +25,7 @@ import type { TaskAnalysisResult, TaskRef } from '../results.js';
|
|
|
25
25
|
/**
|
|
26
26
|
* Common task types (API contract — matches CLI src/types/task.ts)
|
|
27
27
|
*/
|
|
28
|
-
import type { TaskStatus } from '../status-registry.js';
|
|
28
|
+
import type { CancellationKind, TaskStatus } from '../status-registry.js';
|
|
29
29
|
import type { TaskClaim, TaskKind, TaskPriority, TaskSeverity, TaskType } from '../task.js';
|
|
30
30
|
import type {
|
|
31
31
|
MinimalTaskRecord,
|
|
@@ -52,7 +52,7 @@ import type {
|
|
|
52
52
|
TaskPlanResult,
|
|
53
53
|
TaskTreeNode,
|
|
54
54
|
TaskView,
|
|
55
|
-
} from '../tasks.js';
|
|
55
|
+
} from '../tasks/index.js';
|
|
56
56
|
import type { DocsType } from './docs.js';
|
|
57
57
|
import type { JsonSchema, OperationInputContract } from './input-contract.js';
|
|
58
58
|
|
|
@@ -236,13 +236,11 @@ export interface TasksCurrentResult {
|
|
|
236
236
|
sessionId?: string;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
// tasks.show (with optional history/
|
|
239
|
+
// tasks.show (with optional history/relations flags)
|
|
240
240
|
export interface TasksShowParams {
|
|
241
241
|
taskId: string;
|
|
242
242
|
/** When true, include task change history. */
|
|
243
243
|
history?: boolean;
|
|
244
|
-
/** When true, include IVTR phase history. */
|
|
245
|
-
ivtrHistory?: boolean;
|
|
246
244
|
/** When true, include expanded relation/doc ID lists alongside compact counts. */
|
|
247
245
|
relations?: boolean;
|
|
248
246
|
}
|
|
@@ -1042,6 +1040,13 @@ export interface TasksSyncLinksRemoveResult {
|
|
|
1042
1040
|
}
|
|
1043
1041
|
|
|
1044
1042
|
// tasks.cancel
|
|
1043
|
+
/**
|
|
1044
|
+
* Child handling mode for `tasks.cancel`: `block` refuses while unsettled
|
|
1045
|
+
* children remain, `cascade` cancels the subtree, `reparent` moves the
|
|
1046
|
+
* children under `reparentTo` (T11811 · moved from core in T14273).
|
|
1047
|
+
*/
|
|
1048
|
+
export type ChildStrategy = 'block' | 'cascade' | 'reparent';
|
|
1049
|
+
|
|
1045
1050
|
export interface TasksCancelParams {
|
|
1046
1051
|
taskId: string;
|
|
1047
1052
|
reason?: string;
|
|
@@ -1051,7 +1056,7 @@ export interface TasksCancelParams {
|
|
|
1051
1056
|
* legacy `orphan`/detach mode was removed by T11811 (it manufactured the
|
|
1052
1057
|
* exact orphan the containment guard rejects).
|
|
1053
1058
|
*/
|
|
1054
|
-
children?:
|
|
1059
|
+
children?: ChildStrategy;
|
|
1055
1060
|
/**
|
|
1056
1061
|
* Target parent ID for the `reparent` strategy (T11811). REQUIRED when
|
|
1057
1062
|
* `children='reparent'`.
|
|
@@ -1063,6 +1068,10 @@ export interface TasksCancelParams {
|
|
|
1063
1068
|
cascadeThreshold?: number;
|
|
1064
1069
|
/** Config-level cascade permission. Defaults to true. */
|
|
1065
1070
|
allowCascade?: boolean;
|
|
1071
|
+
/** Why the task is cancelled (T14267): abandoned, superseded, duplicate or obsolete. */
|
|
1072
|
+
kind?: CancellationKind;
|
|
1073
|
+
/** The task that replaced this one; only with kind `superseded` or `duplicate` (T14267). */
|
|
1074
|
+
replacedBy?: string;
|
|
1066
1075
|
}
|
|
1067
1076
|
/**
|
|
1068
1077
|
* Result of `tasks.cancel` — cancellation confirmation.
|
|
@@ -1087,8 +1096,12 @@ export interface TasksCancelResult {
|
|
|
1087
1096
|
* @defaultValue undefined
|
|
1088
1097
|
*/
|
|
1089
1098
|
alreadyCancelled?: boolean;
|
|
1099
|
+
/** The recorded cancel kind (T14267). @defaultValue undefined */
|
|
1100
|
+
kind?: CancellationKind;
|
|
1101
|
+
/** The recorded replacement (T14267). @defaultValue undefined */
|
|
1102
|
+
replacedBy?: string;
|
|
1090
1103
|
/** Explicit child handling mode applied by the operation. */
|
|
1091
|
-
childStrategy?:
|
|
1104
|
+
childStrategy?: ChildStrategy;
|
|
1092
1105
|
/** Child or descendant tasks affected by cascade/reparent handling. */
|
|
1093
1106
|
affectedTasks?: string[];
|
|
1094
1107
|
/** Count of affected child/descendant tasks. */
|
|
@@ -238,6 +238,12 @@ export interface ValidateGateParams {
|
|
|
238
238
|
* with these REQ-IDs (comma-separated); the others are not run.
|
|
239
239
|
*/
|
|
240
240
|
req?: string;
|
|
241
|
+
/**
|
|
242
|
+
* `cleo verify --criterion` (T14199): record a per-criterion receipt from
|
|
243
|
+
* `evidence` (one `satisfies:` plus a `decision:` or stored-document
|
|
244
|
+
* `files:` atom) instead of a gate. Exclusive with `gate`, `all` and `reset`.
|
|
245
|
+
*/
|
|
246
|
+
criterion?: boolean;
|
|
241
247
|
}
|
|
242
248
|
export interface ValidateGateResult {
|
|
243
249
|
taskId: string;
|
|
@@ -483,7 +483,10 @@ export interface DestroyWorktreeOptions {
|
|
|
483
483
|
*/
|
|
484
484
|
forceDeleteUnmergedBranch?: boolean;
|
|
485
485
|
/**
|
|
486
|
-
* When true,
|
|
486
|
+
* When true, a worktree whose content or commits are not proven preserved
|
|
487
|
+
* is archived first (an archive ref plus a patch, with a receipt) and then
|
|
488
|
+
* removed; without it such a worktree is kept (T13924). Nothing that still
|
|
489
|
+
* links into the worktree, or evidence found only there, is overridden.
|
|
487
490
|
*
|
|
488
491
|
* @default false
|
|
489
492
|
*/
|
|
@@ -564,6 +567,127 @@ export interface DestroyWorktreeResult {
|
|
|
564
567
|
hookResults?: WorktreeHookResult[];
|
|
565
568
|
/** Set when the worktree was kept because something still needs its files (T13696). */
|
|
566
569
|
kept?: WorktreeDisposalBlockers;
|
|
570
|
+
/** The archive a forced destroy wrote before removing unpreserved work (T13924). */
|
|
571
|
+
archive?: WorktreeArchiveReceipt;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* What `createWorktree` attaches to the error it rethrows.
|
|
576
|
+
*
|
|
577
|
+
* @task T12506
|
|
578
|
+
* @task T14407
|
|
579
|
+
*/
|
|
580
|
+
export interface CreateWorktreeFailure {
|
|
581
|
+
/** True when the failing call itself created the worktree directory. */
|
|
582
|
+
freshWorktreeCreated: boolean;
|
|
583
|
+
/**
|
|
584
|
+
* The removal of that fresh worktree, run while the per-task lock was still
|
|
585
|
+
* held. Absent when the call created none. Callers must not clean up again:
|
|
586
|
+
* the lock is released by then, so a concurrent re-spawn may own the path.
|
|
587
|
+
*/
|
|
588
|
+
cleanup?: DestroyWorktreeResult;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Receipt of a worktree archived before removal (T13924): every commit and
|
|
593
|
+
* every uncommitted change it held, as a ref in the repository and a patch on
|
|
594
|
+
* disk. Written beside the patch as `<name>.json`.
|
|
595
|
+
*
|
|
596
|
+
* @task T13924
|
|
597
|
+
*/
|
|
598
|
+
export interface WorktreeArchiveReceipt {
|
|
599
|
+
/** The worktree that was archived. */
|
|
600
|
+
worktreePath: string;
|
|
601
|
+
/** Owning task, when known. */
|
|
602
|
+
taskId: string | null;
|
|
603
|
+
/** The disposal that archived it. */
|
|
604
|
+
reason: string;
|
|
605
|
+
/** Branch checked out in the worktree, or `null` when detached. */
|
|
606
|
+
branch: string | null;
|
|
607
|
+
/** The worktree's HEAD commit, or `null` for an unborn branch. */
|
|
608
|
+
head: string | null;
|
|
609
|
+
/** Ref holding the archive commit, under `refs/cleo/archive/`. */
|
|
610
|
+
archiveRef: string;
|
|
611
|
+
/** Archive commit: HEAD as parent, the tracked, untracked and ignored content (bar `node_modules` and build output) as its tree. */
|
|
612
|
+
archiveSha: string;
|
|
613
|
+
/** Patch from HEAD to the archive commit (`git diff --binary`). */
|
|
614
|
+
patchPath: string;
|
|
615
|
+
/** Path of this receipt. */
|
|
616
|
+
receiptPath: string;
|
|
617
|
+
/** ISO-8601 time the archive was written. */
|
|
618
|
+
createdAt: string;
|
|
619
|
+
/** Command that restores the archive into a new worktree. */
|
|
620
|
+
restore: string;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Options for the one worktree disposal engine (T13924, `disposeWorktree`).
|
|
625
|
+
*
|
|
626
|
+
* @task T13924
|
|
627
|
+
*/
|
|
628
|
+
export interface DisposeWorktreeOptions {
|
|
629
|
+
/** Worktree directory to dispose. */
|
|
630
|
+
worktreePath: string;
|
|
631
|
+
/** Repository root the worktree belongs to; read from the worktree when omitted. */
|
|
632
|
+
gitRoot?: string;
|
|
633
|
+
/** Main checkout untracked and ignored content is compared against, and the archive's home; the repository's main worktree when omitted. */
|
|
634
|
+
projectRoot?: string;
|
|
635
|
+
/** Owning task, when known. */
|
|
636
|
+
taskId: string | null;
|
|
637
|
+
/** Why the worktree is disposed (audit and archive receipt). */
|
|
638
|
+
reason: string;
|
|
639
|
+
/** The task's recorded evidence atoms (T13696). */
|
|
640
|
+
evidence?: readonly EvidenceAtom[];
|
|
641
|
+
/**
|
|
642
|
+
* The project's default branch (core `getDefaultBranch`, which honours
|
|
643
|
+
* `git.defaultBranch`). When omitted: `origin/HEAD`, then `main`, `master`,
|
|
644
|
+
* `develop`, `trunk`.
|
|
645
|
+
*/
|
|
646
|
+
defaultBranch?: string;
|
|
647
|
+
/** Ignored build output counts as redundant: only for a checkout whose commits are merged. */
|
|
648
|
+
exemptRegenerable?: boolean;
|
|
649
|
+
/**
|
|
650
|
+
* Archive unpreserved work, then remove (`destroy --force` only). The
|
|
651
|
+
* dependents and evidence guard still keeps the worktree.
|
|
652
|
+
*/
|
|
653
|
+
force?: boolean;
|
|
654
|
+
/** Report what would happen; never write, archive or remove. */
|
|
655
|
+
dryRun?: boolean;
|
|
656
|
+
/**
|
|
657
|
+
* Decide only: run the proof and record a keep marker when the guard keeps
|
|
658
|
+
* it (as a real disposal does), but never archive or remove. Callers that
|
|
659
|
+
* act between deciding and removing (hooks, a re-check) use it.
|
|
660
|
+
*/
|
|
661
|
+
probe?: boolean;
|
|
662
|
+
/**
|
|
663
|
+
* Whether something still uses the worktree (a live task lock or claim):
|
|
664
|
+
* a reason when it does, `null` when not. A probe that throws counts as in use.
|
|
665
|
+
*/
|
|
666
|
+
inUse?: () => string | null;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Outcome of {@link DisposeWorktreeOptions | disposeWorktree}.
|
|
671
|
+
*
|
|
672
|
+
* @task T13924
|
|
673
|
+
*/
|
|
674
|
+
export interface DisposeWorktreeResult {
|
|
675
|
+
/** The worktree considered. */
|
|
676
|
+
worktreePath: string;
|
|
677
|
+
/** Whether the directory is gone (a dry run reports `false`). */
|
|
678
|
+
removed: boolean;
|
|
679
|
+
/** Why it was kept, when it was; absent when removed or removable. */
|
|
680
|
+
keptReason?: string;
|
|
681
|
+
/** Set when the dependents and evidence guard kept it (T13696). */
|
|
682
|
+
kept?: WorktreeDisposalBlockers;
|
|
683
|
+
/** The preservation clause that failed, when one did (dirty, untracked, ignored content, unpreserved commits, a failed probe). */
|
|
684
|
+
unpreserved?: string;
|
|
685
|
+
/** The archive written before a forced removal. */
|
|
686
|
+
archive?: WorktreeArchiveReceipt;
|
|
687
|
+
/** Set when the removal (or the archive before it) was attempted and failed: an error, not a proof result. */
|
|
688
|
+
failed?: string;
|
|
689
|
+
/** True when a probe could not answer (a git or read error), so the worktree was kept unproven (T14274). */
|
|
690
|
+
indeterminate?: boolean;
|
|
567
691
|
}
|
|
568
692
|
|
|
569
693
|
// ---------------------------------------------------------------------------
|
|
@@ -649,9 +773,9 @@ export interface PruneWorktreesResult {
|
|
|
649
773
|
removed: number;
|
|
650
774
|
/** Absolute paths that were removed. */
|
|
651
775
|
removedPaths: string[];
|
|
652
|
-
/** Number of worktrees
|
|
776
|
+
/** Number of worktrees kept because their content or commits are not proven preserved (T13924). */
|
|
653
777
|
quarantined: number;
|
|
654
|
-
/** Absolute paths of
|
|
778
|
+
/** Absolute paths of those kept worktrees, left on disk untouched. */
|
|
655
779
|
quarantinedPaths: string[];
|
|
656
780
|
/** Entries that failed to remove (with reasons). */
|
|
657
781
|
errors: Array<{ path: string; reason: string }>;
|
|
@@ -670,25 +794,26 @@ export interface PruneWorktreesResult {
|
|
|
670
794
|
// ---------------------------------------------------------------------------
|
|
671
795
|
|
|
672
796
|
/**
|
|
673
|
-
* Mutually-exclusive worktree status category
|
|
674
|
-
*
|
|
797
|
+
* Mutually-exclusive worktree status category: what the one disposal proof
|
|
798
|
+
* (`disposeWorktree`, T13924) says about the worktree (T14274).
|
|
675
799
|
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
800
|
+
* - `active` — in use: the primary checkout (T9686-D), a worktree whose task
|
|
801
|
+
* is open, or one with no (stored) task that was active within the stale
|
|
802
|
+
* window. Never pruned.
|
|
803
|
+
* - `redundant` — its task is done or cancelled (or it has no task and has
|
|
804
|
+
* been idle past the stale window) and the proof holds: nothing in it would
|
|
805
|
+
* be lost. `cleo worktree prune --orphaned` acts only on these.
|
|
806
|
+
* - `keep` — same candidacy, but the proof fails; {@link WorktreeInfo.keepReason}
|
|
807
|
+
* names the failing clause (uncommitted changes, unpreserved commits,
|
|
808
|
+
* something linking into it, a task lock held, …).
|
|
809
|
+
* - `unknown` — a probe could not answer (a git or read error); never redundant.
|
|
810
|
+
*
|
|
811
|
+
* Staleness is an annotation ({@link WorktreeInfo.isStale}), not a category.
|
|
688
812
|
*
|
|
689
813
|
* @task T9546
|
|
814
|
+
* @task T14274
|
|
690
815
|
*/
|
|
691
|
-
export type WorktreeStatusCategory = 'active' | '
|
|
816
|
+
export type WorktreeStatusCategory = 'active' | 'redundant' | 'keep' | 'unknown';
|
|
692
817
|
|
|
693
818
|
/**
|
|
694
819
|
* Source classifier for a worktree entry.
|
|
@@ -759,7 +884,7 @@ export interface WorktreeInfo {
|
|
|
759
884
|
* @task T9546
|
|
760
885
|
*/
|
|
761
886
|
lockState: 'locked' | 'unlocked';
|
|
762
|
-
/**
|
|
887
|
+
/** Annotation: no activity for more than the stale window AND (task done/cancelled OR branch merged). */
|
|
763
888
|
isStale: boolean;
|
|
764
889
|
/** Whether the branch is reachable from `main` (already integrated). */
|
|
765
890
|
isMerged: boolean;
|
|
@@ -767,6 +892,8 @@ export interface WorktreeInfo {
|
|
|
767
892
|
owningTaskStatus: string | null;
|
|
768
893
|
/** Mutually-exclusive status category — see {@link WorktreeStatusCategory}. */
|
|
769
894
|
statusCategory: WorktreeStatusCategory;
|
|
895
|
+
/** For `keep` and `unknown`: the proof clause that failed, or the probe that could not answer (T14274). */
|
|
896
|
+
keepReason?: string;
|
|
770
897
|
/**
|
|
771
898
|
* Origin of this worktree entry.
|
|
772
899
|
*
|
|
@@ -793,6 +920,8 @@ export interface WorktreeInfo {
|
|
|
793
920
|
* @task T9546
|
|
794
921
|
*/
|
|
795
922
|
export interface ListWorktreesOpts {
|
|
923
|
+
/** Limit enrichment and disposal proofs to this task (terminal lifecycle cleanup). */
|
|
924
|
+
taskId?: string;
|
|
796
925
|
/**
|
|
797
926
|
* Absolute path to the project root (used to compute the project hash
|
|
798
927
|
* and resolve the canonical worktrees directory).
|
|
@@ -811,6 +940,8 @@ export interface ListWorktreesOpts {
|
|
|
811
940
|
* @default 7
|
|
812
941
|
*/
|
|
813
942
|
staleDays?: number;
|
|
943
|
+
/** Whether merged ignored build output may be regenerated (default: true for legacy listing). */
|
|
944
|
+
exemptRegenerable?: boolean;
|
|
814
945
|
}
|
|
815
946
|
|
|
816
947
|
/**
|
|
@@ -1098,3 +1229,69 @@ export interface AdoptWorktreeResult {
|
|
|
1098
1229
|
*/
|
|
1099
1230
|
projectInfo: 'seeded' | 'present' | 'skipped';
|
|
1100
1231
|
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Options for `cleanupMergedWork` (T14142): remove what merged work left
|
|
1235
|
+
* behind, after proving each item redundant.
|
|
1236
|
+
*
|
|
1237
|
+
* @task T14142
|
|
1238
|
+
*/
|
|
1239
|
+
export interface MergedCleanupOpts {
|
|
1240
|
+
/** Project root (the main checkout; its hash names the canonical worktree root). */
|
|
1241
|
+
projectRoot: string;
|
|
1242
|
+
/**
|
|
1243
|
+
* Tasks whose work merged (the sweep's merged PR, or a release's tasks).
|
|
1244
|
+
* Either way a task is in scope only while stored `done` or `cancelled`:
|
|
1245
|
+
* an open task (more PRs to come) keeps its worktree and branches.
|
|
1246
|
+
*/
|
|
1247
|
+
taskIds?: readonly string[];
|
|
1248
|
+
/** List everything without deleting. Default `true`: deleting is opt-in. */
|
|
1249
|
+
dryRun?: boolean;
|
|
1250
|
+
/** Also delete merged task branches on `origin`. Default `true`. */
|
|
1251
|
+
remote?: boolean;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* One item the cleanup considered: removed (or, on a dry run, removable), or
|
|
1256
|
+
* kept with the reason.
|
|
1257
|
+
*
|
|
1258
|
+
* @task T14142
|
|
1259
|
+
*/
|
|
1260
|
+
export interface MergedCleanupItem {
|
|
1261
|
+
/** Worktree or nested-copy path, or branch name. */
|
|
1262
|
+
target: string;
|
|
1263
|
+
/** Owning task, when the target names one. */
|
|
1264
|
+
taskId: string | null;
|
|
1265
|
+
/** Branch tip (branches only): what a restore pushes back. */
|
|
1266
|
+
sha?: string;
|
|
1267
|
+
/** True when removed (dry run: when it would be removed). */
|
|
1268
|
+
removed: boolean;
|
|
1269
|
+
/** Why it was kept, or what proved it redundant. */
|
|
1270
|
+
reason: string;
|
|
1271
|
+
/** Bytes on disk (worktrees and nested copies; 0 for branches). */
|
|
1272
|
+
bytes: number;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Result of `cleanupMergedWork` (T14142).
|
|
1277
|
+
*
|
|
1278
|
+
* @task T14142
|
|
1279
|
+
*/
|
|
1280
|
+
export interface MergedCleanupResult {
|
|
1281
|
+
/** Whether nothing was deleted. */
|
|
1282
|
+
dryRun: boolean;
|
|
1283
|
+
/** The default branch merges were proven against (`origin/<name>`). */
|
|
1284
|
+
base: string;
|
|
1285
|
+
/** Canonical task worktrees. */
|
|
1286
|
+
worktrees: MergedCleanupItem[];
|
|
1287
|
+
/** Local `task/*` branches. */
|
|
1288
|
+
localBranches: MergedCleanupItem[];
|
|
1289
|
+
/** `origin` `task/*` branches. */
|
|
1290
|
+
remoteBranches: MergedCleanupItem[];
|
|
1291
|
+
/** Repository copies nested inside worktrees. */
|
|
1292
|
+
nestedCopies: MergedCleanupItem[];
|
|
1293
|
+
/** Bytes removed (dry run: that would be removed). */
|
|
1294
|
+
bytesReclaimed: number;
|
|
1295
|
+
/** Why nothing was considered (the fetch failed, no base branch); absent when it ran. */
|
|
1296
|
+
skippedReason?: string;
|
|
1297
|
+
}
|