@cleocode/contracts 2026.11.19 → 2026.11.20-rc.ci.737
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.source-stamp.json +1 -1
- package/dist/data-accessor.d.ts +43 -3
- package/dist/data-accessor.d.ts.map +1 -1
- package/dist/data-accessor.js.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +10 -3
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/operations/worktree.d.ts +26 -6
- package/dist/operations/worktree.d.ts.map +1 -1
- package/dist/project-context.d.ts +10 -0
- package/dist/project-context.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/data-accessor.ts +38 -3
- package/src/dispatch/operations-registry.ts +12 -3
- package/src/index.ts +1 -0
- package/src/operations/worktree.ts +26 -6
- package/src/project-context.ts +10 -0
package/src/data-accessor.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import type { ArchivedTask } from './archive.js';
|
|
17
17
|
import type { Session } from './session.js';
|
|
18
|
-
import type { CancellationKind } from './status-registry.js';
|
|
18
|
+
import type { CancellationKind, SessionStatus } from './status-registry.js';
|
|
19
19
|
import type {
|
|
20
20
|
Task,
|
|
21
21
|
TaskClaim,
|
|
@@ -664,6 +664,34 @@ export interface TransactionAccessor {
|
|
|
664
664
|
pruneOrphanAcBindings(): Promise<AcBindingRow[]>;
|
|
665
665
|
}
|
|
666
666
|
|
|
667
|
+
/**
|
|
668
|
+
* SQL-side filter for {@link DataAccessor.loadSessions} (T14453).
|
|
669
|
+
*
|
|
670
|
+
* Every field narrows the result; an omitted field does not filter. Callers
|
|
671
|
+
* still apply their own predicates to the returned rows, so an implementation
|
|
672
|
+
* that ignores the filter (a test double) stays correct, only unbounded.
|
|
673
|
+
*/
|
|
674
|
+
export interface SessionLoadFilter {
|
|
675
|
+
/** Only the session with this id. */
|
|
676
|
+
id?: string;
|
|
677
|
+
/** Only sessions in this lifecycle status. */
|
|
678
|
+
status?: SessionStatus;
|
|
679
|
+
/**
|
|
680
|
+
* Only sessions whose `scope.type` equals this value. A row whose scope JSON
|
|
681
|
+
* does not parse counts as global, as the row converter reads it.
|
|
682
|
+
*/
|
|
683
|
+
scopeType?: string;
|
|
684
|
+
/** Only sessions carrying handoff or debrief JSON. */
|
|
685
|
+
withHandoff?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Order by `endedAt` then `id`, newest first, skipping rows without an
|
|
688
|
+
* `endedAt`, and return at most `limit` rows strictly after the `before`
|
|
689
|
+
* cursor (the last row of the previous page). Keyset paging: equal `endedAt`
|
|
690
|
+
* values and rows removed between pages never make a page skip a row.
|
|
691
|
+
*/
|
|
692
|
+
newestEnded?: { limit: number; before?: { endedAt: string; id: string } };
|
|
693
|
+
}
|
|
694
|
+
|
|
667
695
|
// Re-export AcRow at the module level for both transaction + outer accessor use.
|
|
668
696
|
|
|
669
697
|
/**
|
|
@@ -687,8 +715,15 @@ export interface DataAccessor {
|
|
|
687
715
|
|
|
688
716
|
// ---- Session data ----
|
|
689
717
|
|
|
690
|
-
/**
|
|
691
|
-
|
|
718
|
+
/**
|
|
719
|
+
* Load sessions from the store. Returns empty array if none exist.
|
|
720
|
+
*
|
|
721
|
+
* Without a filter this reads EVERY row, debrief and handoff JSON included —
|
|
722
|
+
* hundreds of MB on a store with thousands of sessions (T14453). Callers that
|
|
723
|
+
* need one session, the active ones, or the newest ended ones pass a
|
|
724
|
+
* {@link SessionLoadFilter} so the store applies it in SQL.
|
|
725
|
+
*/
|
|
726
|
+
loadSessions(filter?: SessionLoadFilter): Promise<Session[]>;
|
|
692
727
|
|
|
693
728
|
/** Save all sessions to the store atomically. */
|
|
694
729
|
saveSessions(sessions: Session[]): Promise<void>;
|
|
@@ -10209,15 +10209,24 @@ export const OPERATIONS: OperationDef[] = [
|
|
|
10209
10209
|
tier: 1,
|
|
10210
10210
|
idempotent: true,
|
|
10211
10211
|
sessionRequired: false,
|
|
10212
|
-
requiredParams: [
|
|
10212
|
+
requiredParams: [],
|
|
10213
10213
|
params: [
|
|
10214
10214
|
{
|
|
10215
10215
|
name: 'taskId',
|
|
10216
10216
|
type: 'string',
|
|
10217
|
-
required:
|
|
10218
|
-
description:
|
|
10217
|
+
required: false,
|
|
10218
|
+
description:
|
|
10219
|
+
'Task ID whose XDG worktree should be destroyed (e.g. T9805). Give it or worktreePath, not both.',
|
|
10219
10220
|
cli: { positional: true },
|
|
10220
10221
|
},
|
|
10222
|
+
{
|
|
10223
|
+
name: 'worktreePath',
|
|
10224
|
+
type: 'string',
|
|
10225
|
+
required: false,
|
|
10226
|
+
description:
|
|
10227
|
+
'Exact path of a registered linked worktree to destroy, for one no task id names such as a detached HEAD (T14627). CLI: --path.',
|
|
10228
|
+
cli: { flag: 'path' },
|
|
10229
|
+
},
|
|
10221
10230
|
{
|
|
10222
10231
|
name: 'force',
|
|
10223
10232
|
type: 'boolean',
|
package/src/index.ts
CHANGED
|
@@ -464,8 +464,24 @@ export interface CreateWorktreeResult {
|
|
|
464
464
|
* @adr ADR-062
|
|
465
465
|
*/
|
|
466
466
|
export interface DestroyWorktreeOptions {
|
|
467
|
-
/** Task ID whose worktree to destroy. */
|
|
468
|
-
taskId
|
|
467
|
+
/** Task ID whose worktree to destroy. Give it or {@link worktreePath}, never both. */
|
|
468
|
+
taskId?: string;
|
|
469
|
+
/**
|
|
470
|
+
* Exact path of the worktree to destroy (T14627), for a checkout no task id
|
|
471
|
+
* names (a detached HEAD). Accepted only for a linked worktree git has
|
|
472
|
+
* registered for the repository, under the project's canonical worktree
|
|
473
|
+
* root, that no task's directory name or branch names (that one is refused
|
|
474
|
+
* with the `cleo worktree destroy <taskId>` to run); never the main
|
|
475
|
+
* checkout. Its own branch (none when detached) is the one `deleteBranch`
|
|
476
|
+
* considers. Requires {@link inUse}: without it the worktree is kept.
|
|
477
|
+
*/
|
|
478
|
+
worktreePath?: string;
|
|
479
|
+
/**
|
|
480
|
+
* The process-use probe for a {@link worktreePath} destroy (T14627): the
|
|
481
|
+
* reason the worktree is in use (a process with its cwd or an open file in
|
|
482
|
+
* it), or `null` when nothing is. A throw counts as in use.
|
|
483
|
+
*/
|
|
484
|
+
inUse?: (worktreePath: string) => string | null;
|
|
469
485
|
/**
|
|
470
486
|
* When true, delete the associated git branch after removing the worktree.
|
|
471
487
|
*
|
|
@@ -583,8 +599,8 @@ export interface WorktreeKeepMarker {
|
|
|
583
599
|
* @task T1161
|
|
584
600
|
*/
|
|
585
601
|
export interface DestroyWorktreeResult {
|
|
586
|
-
/** Task ID that was destroyed. */
|
|
587
|
-
taskId: string;
|
|
602
|
+
/** Task ID that was destroyed, or `null` for a path-named worktree without one (T14627). */
|
|
603
|
+
taskId: string | null;
|
|
588
604
|
/** Whether the worktree directory was successfully removed. */
|
|
589
605
|
worktreeRemoved: boolean;
|
|
590
606
|
/** Whether the task branch was deleted. */
|
|
@@ -676,7 +692,11 @@ export interface DisposeWorktreeOptions {
|
|
|
676
692
|
* `develop`, `trunk`.
|
|
677
693
|
*/
|
|
678
694
|
defaultBranch?: string;
|
|
679
|
-
/**
|
|
695
|
+
/**
|
|
696
|
+
* Ignored build output (the built-in output directories and the project's
|
|
697
|
+
* declared `build.outputPaths`, T14627) counts as redundant. The commit proof
|
|
698
|
+
* still applies, so the source that rebuilds it is always preserved.
|
|
699
|
+
*/
|
|
680
700
|
exemptRegenerable?: boolean;
|
|
681
701
|
/**
|
|
682
702
|
* Archive unpreserved work, then remove (`destroy --force` only). The
|
|
@@ -977,7 +997,7 @@ export interface ListWorktreesOpts {
|
|
|
977
997
|
* @default 7
|
|
978
998
|
*/
|
|
979
999
|
staleDays?: number;
|
|
980
|
-
/** Whether
|
|
1000
|
+
/** Whether ignored build output may be regenerated (default: true; T14627: merged or not, the commit proof holds). */
|
|
981
1001
|
exemptRegenerable?: boolean;
|
|
982
1002
|
}
|
|
983
1003
|
|
package/src/project-context.ts
CHANGED
|
@@ -213,6 +213,16 @@ export interface ProjectContext {
|
|
|
213
213
|
* `cleo run` charges them as heavy whatever their content shows (T14162).
|
|
214
214
|
*/
|
|
215
215
|
heavyScripts?: string[];
|
|
216
|
+
/**
|
|
217
|
+
* Globs (`path.matchesGlob`), relative to the project root, of build
|
|
218
|
+
* output beyond the built-in `dist/`, `.turbo/`, `coverage/` and
|
|
219
|
+
* `*.tsbuildinfo`: ignored content at or under a match never blocks a
|
|
220
|
+
* worktree's disposal by itself, while any other ignored content still
|
|
221
|
+
* does (T14627). Read from the main checkout. Only plain globs that start
|
|
222
|
+
* with a literal segment count: a wildcard first segment, a segment
|
|
223
|
+
* starting with `.`, braces, brackets and extglobs are refused.
|
|
224
|
+
*/
|
|
225
|
+
outputPaths?: string[];
|
|
216
226
|
};
|
|
217
227
|
directories?: {
|
|
218
228
|
source?: string;
|