@cleocode/cant 2026.5.100 → 2026.5.101
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/index.d.ts +0 -1
- package/dist/index.js +1 -7
- package/dist/worktree.d.ts +46 -58
- package/dist/worktree.js +21 -202
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -19,4 +19,3 @@ export { initCantParser, parseCANTMessage } from './parse';
|
|
|
19
19
|
export type { CantAgentV3, CantContextSourceDef, CantContractBlock, CantContractClause, CantMentalModelRef, CantOverflowStrategy, CantPathPermissions, CantTier, DirectiveType, } from './types';
|
|
20
20
|
export { isCantAgentV3 } from './types';
|
|
21
21
|
export type { MergeResult, WorktreeConfig, WorktreeEntry, WorktreeHandle, WorktreeRequest, } from './worktree.js';
|
|
22
|
-
export { createWorktree, listWorktrees, mergeWorktree, resolveWorktreeRoot, } from './worktree.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// JIT Agent Composer (ULTRAPLAN Wave 5)
|
|
3
3
|
// Wave 7a: BRAIN-backed ContextProvider (T432)
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.isCantAgentV3 = exports.parseCANTMessage = exports.initCantParser = exports.validateAgentCantPath = exports.SEED_PERSONA_IDS = exports.loadSeedAgentIdentities = exports.isWasmAvailable = exports.isNativeAvailable = exports.initWasm = exports.extractAgentSkills = exports.extractAgentProfilesTyped = exports.cantValidateDocumentNative = exports.cantParseNative = exports.cantParseDocumentNative = exports.cantExtractAgentProfilesNative = exports.cantExecutePipelineNative = exports.cantClassifyDirectiveNative = exports.showSummary = exports.showDiff = exports.serializeCantDocument = exports.migrateMarkdown = exports.renderMentalModel = exports.harvestObservations = exports.createEmptyModel = exports.consolidate = exports.WORKER_FORBIDDEN_SPAWN_TOOLS = exports.validateSpawnRequest = exports.THIN_AGENT_TOOLS_STRIPPED = exports.stripSpawnToolsForWorker = exports.ORCHESTRATOR_FORBIDDEN_TOOLS = exports.LEAD_FORBIDDEN_TOOLS = exports.filterToolsForRole = exports.validateDocument = exports.parseDocument = exports.listSections = exports.executePipeline = exports.brainContextProvider = exports.TIER_CAPS = exports.estimateTokens = exports.escalateTier = exports.composeSpawnPayload = exports.toCantAgentV3 = exports.compileBundle = void 0;
|
|
6
6
|
// Bundle compiler
|
|
7
7
|
var bundle_1 = require("./bundle");
|
|
8
8
|
Object.defineProperty(exports, "compileBundle", { enumerable: true, get: function () { return bundle_1.compileBundle; } });
|
|
@@ -64,9 +64,3 @@ Object.defineProperty(exports, "initCantParser", { enumerable: true, get: functi
|
|
|
64
64
|
Object.defineProperty(exports, "parseCANTMessage", { enumerable: true, get: function () { return parse_1.parseCANTMessage; } });
|
|
65
65
|
var types_1 = require("./types");
|
|
66
66
|
Object.defineProperty(exports, "isCantAgentV3", { enumerable: true, get: function () { return types_1.isCantAgentV3; } });
|
|
67
|
-
// Worktree isolation (ULTRAPLAN Wave 9)
|
|
68
|
-
var worktree_js_1 = require("./worktree.js");
|
|
69
|
-
Object.defineProperty(exports, "createWorktree", { enumerable: true, get: function () { return worktree_js_1.createWorktree; } });
|
|
70
|
-
Object.defineProperty(exports, "listWorktrees", { enumerable: true, get: function () { return worktree_js_1.listWorktrees; } });
|
|
71
|
-
Object.defineProperty(exports, "mergeWorktree", { enumerable: true, get: function () { return worktree_js_1.mergeWorktree; } });
|
|
72
|
-
Object.defineProperty(exports, "resolveWorktreeRoot", { enumerable: true, get: function () { return worktree_js_1.resolveWorktreeRoot; } });
|
package/dist/worktree.d.ts
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Type-only deprecation shim for the legacy cant worktree API.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This file was 298 LOC of runtime worktree logic (the "2nd creation site"
|
|
6
|
+
* flagged by the T9801 audit). Per T9986 / E9-RIP-LEGACY, the runtime has
|
|
7
|
+
* been removed — all callers now route through `@cleocode/worktree` (the
|
|
8
|
+
* canonical napi-backed SSoT).
|
|
9
|
+
*
|
|
10
|
+
* Two downstream consumers (`@cleocode/caamp`) still import
|
|
11
|
+
* {@link WorktreeHandle} as a TYPE for their `SpawnOptions.worktree` and
|
|
12
|
+
* `SubagentSpawnOptions.worktree` fields. To avoid a breaking change to
|
|
13
|
+
* the spawn-adapter contract in the same release that rips the legacy
|
|
14
|
+
* runtime, the type definitions are preserved here as a one-cycle
|
|
15
|
+
* deprecation shim. The runtime functions (`createWorktree`,
|
|
16
|
+
* `mergeWorktree`, `listWorktrees`, `resolveWorktreeRoot`) had ZERO
|
|
17
|
+
* production consumers and have been deleted.
|
|
18
|
+
*
|
|
19
|
+
* Removal target: the next minor cycle after caamp migrates to
|
|
20
|
+
* `@cleocode/worktree`'s `CreateWorktreeResult` shape directly.
|
|
7
21
|
*
|
|
8
22
|
* @packageDocumentation
|
|
23
|
+
* @deprecated Import worktree primitives from `@cleocode/worktree` instead.
|
|
24
|
+
* This module retains only type shims for one deprecation cycle.
|
|
25
|
+
* @task T9986
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Request payload for creating a new git worktree.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated Use `CreateWorktreeOptions` from `@cleocode/worktree` instead.
|
|
9
31
|
*/
|
|
10
|
-
/** Request payload for creating a new git worktree. */
|
|
11
32
|
export interface WorktreeRequest {
|
|
12
33
|
/** The base ref to branch from (e.g. "main", "develop", a SHA). */
|
|
13
34
|
baseRef: string;
|
|
@@ -26,7 +47,11 @@ export interface WorktreeRequest {
|
|
|
26
47
|
* `CLEO_PROJECT_HASH` in spawned subagent environments without threading
|
|
27
48
|
* {@link WorktreeConfig} through every call site.
|
|
28
49
|
*
|
|
50
|
+
* Still consumed (as a type) by `@cleocode/caamp` for its
|
|
51
|
+
* `SpawnOptions.worktree` and `SubagentSpawnOptions.worktree` fields.
|
|
52
|
+
*
|
|
29
53
|
* @task T380
|
|
54
|
+
* @deprecated Migrate to `CreateWorktreeResult` from `@cleocode/worktree`.
|
|
30
55
|
*/
|
|
31
56
|
export interface WorktreeHandle {
|
|
32
57
|
/** Absolute path to the worktree directory. */
|
|
@@ -51,7 +76,12 @@ export interface WorktreeHandle {
|
|
|
51
76
|
/** Clean up: remove the worktree and optionally delete the branch. */
|
|
52
77
|
cleanup(deleteBranch?: boolean): void;
|
|
53
78
|
}
|
|
54
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Configuration for worktree path resolution and git operations.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated `@cleocode/worktree` derives paths from `@cleocode/paths`
|
|
83
|
+
* directly; configuration is no longer threaded through call sites.
|
|
84
|
+
*/
|
|
55
85
|
export interface WorktreeConfig {
|
|
56
86
|
/** Root directory for worktrees. Defaults to $XDG_DATA_HOME/cleo/worktrees/<projectHash>/ */
|
|
57
87
|
worktreeRoot?: string;
|
|
@@ -60,67 +90,25 @@ export interface WorktreeConfig {
|
|
|
60
90
|
/** The project's git root directory. */
|
|
61
91
|
gitRoot: string;
|
|
62
92
|
}
|
|
63
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Result of a merge operation.
|
|
95
|
+
*
|
|
96
|
+
* @deprecated Use `WorktreeMergeResult` from `@cleocode/contracts` instead.
|
|
97
|
+
*/
|
|
64
98
|
export interface MergeResult {
|
|
65
99
|
/** Whether the merge succeeded. */
|
|
66
100
|
success: boolean;
|
|
67
101
|
/** Error message if the merge failed. */
|
|
68
102
|
error?: string;
|
|
69
103
|
}
|
|
70
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Entry in the list of active worktrees.
|
|
106
|
+
*
|
|
107
|
+
* @deprecated Use `WorktreeListEntry` from `@cleocode/contracts` instead.
|
|
108
|
+
*/
|
|
71
109
|
export interface WorktreeEntry {
|
|
72
110
|
/** Absolute path to the worktree directory. */
|
|
73
111
|
path: string;
|
|
74
112
|
/** Branch checked out in this worktree. */
|
|
75
113
|
branch: string;
|
|
76
114
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Resolve the worktree root directory.
|
|
79
|
-
*
|
|
80
|
-
* Uses `$XDG_DATA_HOME/cleo/worktrees/<projectHash>/` per ULTRAPLAN §14.3.
|
|
81
|
-
* Falls back to `~/.local/share/cleo/worktrees/<projectHash>/` when
|
|
82
|
-
* `XDG_DATA_HOME` is not set.
|
|
83
|
-
*
|
|
84
|
-
* @param config - Worktree configuration containing optional override and project hash.
|
|
85
|
-
* @returns Absolute path to the worktree root directory.
|
|
86
|
-
*/
|
|
87
|
-
export declare function resolveWorktreeRoot(config: WorktreeConfig): string;
|
|
88
|
-
/**
|
|
89
|
-
* Create a git worktree for an agent.
|
|
90
|
-
*
|
|
91
|
-
* Runs `git worktree add <path> -b <branch> <baseRef>` from the
|
|
92
|
-
* project's git root. Branch naming convention: `cleo/<taskId>-<shortId>`.
|
|
93
|
-
*
|
|
94
|
-
* If a worktree already exists at the target path (stale from a prior run),
|
|
95
|
-
* it is removed before creating the new one.
|
|
96
|
-
*
|
|
97
|
-
* @param request - The worktree request specifying task, base ref, and optional branch name.
|
|
98
|
-
* @param config - Project-level worktree configuration.
|
|
99
|
-
* @returns A handle for the created worktree with cleanup capability.
|
|
100
|
-
* @throws Error if the git worktree add command fails.
|
|
101
|
-
*/
|
|
102
|
-
export declare function createWorktree(request: WorktreeRequest, config: WorktreeConfig): WorktreeHandle;
|
|
103
|
-
/**
|
|
104
|
-
* Merge a worktree's branch back into the current branch.
|
|
105
|
-
*
|
|
106
|
-
* On success the worktree is cleaned up (directory removed, branch deleted).
|
|
107
|
-
* On failure the worktree is retained for forensic inspection.
|
|
108
|
-
*
|
|
109
|
-
* @param handle - The worktree handle returned from {@link createWorktree}.
|
|
110
|
-
* @param config - Project-level worktree configuration.
|
|
111
|
-
* @param options - Merge strategy options (defaults to fast-forward only).
|
|
112
|
-
* @returns A result object indicating success or failure with an error message.
|
|
113
|
-
*/
|
|
114
|
-
export declare function mergeWorktree(handle: WorktreeHandle, config: WorktreeConfig, options?: {
|
|
115
|
-
strategy?: 'ff-only' | 'no-ff';
|
|
116
|
-
}): MergeResult;
|
|
117
|
-
/**
|
|
118
|
-
* List active worktrees scoped to the current project.
|
|
119
|
-
*
|
|
120
|
-
* Parses `git worktree list --porcelain` and filters entries whose path
|
|
121
|
-
* falls under the project's worktree root directory.
|
|
122
|
-
*
|
|
123
|
-
* @param config - Project-level worktree configuration.
|
|
124
|
-
* @returns Array of worktree entries with their paths and branch names.
|
|
125
|
-
*/
|
|
126
|
-
export declare function listWorktrees(config: WorktreeConfig): WorktreeEntry[];
|
package/dist/worktree.js
CHANGED
|
@@ -1,209 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Type-only deprecation shim for the legacy cant worktree API.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This file was 298 LOC of runtime worktree logic (the "2nd creation site"
|
|
7
|
+
* flagged by the T9801 audit). Per T9986 / E9-RIP-LEGACY, the runtime has
|
|
8
|
+
* been removed — all callers now route through `@cleocode/worktree` (the
|
|
9
|
+
* canonical napi-backed SSoT).
|
|
10
|
+
*
|
|
11
|
+
* Two downstream consumers (`@cleocode/caamp`) still import
|
|
12
|
+
* {@link WorktreeHandle} as a TYPE for their `SpawnOptions.worktree` and
|
|
13
|
+
* `SubagentSpawnOptions.worktree` fields. To avoid a breaking change to
|
|
14
|
+
* the spawn-adapter contract in the same release that rips the legacy
|
|
15
|
+
* runtime, the type definitions are preserved here as a one-cycle
|
|
16
|
+
* deprecation shim. The runtime functions (`createWorktree`,
|
|
17
|
+
* `mergeWorktree`, `listWorktrees`, `resolveWorktreeRoot`) had ZERO
|
|
18
|
+
* production consumers and have been deleted.
|
|
19
|
+
*
|
|
20
|
+
* Removal target: the next minor cycle after caamp migrates to
|
|
21
|
+
* `@cleocode/worktree`'s `CreateWorktreeResult` shape directly.
|
|
8
22
|
*
|
|
9
23
|
* @packageDocumentation
|
|
24
|
+
* @deprecated Import worktree primitives from `@cleocode/worktree` instead.
|
|
25
|
+
* This module retains only type shims for one deprecation cycle.
|
|
26
|
+
* @task T9986
|
|
10
27
|
*/
|
|
11
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.resolveWorktreeRoot = resolveWorktreeRoot;
|
|
13
|
-
exports.createWorktree = createWorktree;
|
|
14
|
-
exports.mergeWorktree = mergeWorktree;
|
|
15
|
-
exports.listWorktrees = listWorktrees;
|
|
16
|
-
const node_child_process_1 = require("node:child_process");
|
|
17
|
-
const node_fs_1 = require("node:fs");
|
|
18
|
-
const node_os_1 = require("node:os");
|
|
19
|
-
const node_path_1 = require("node:path");
|
|
20
|
-
/**
|
|
21
|
-
* Resolve the worktree root directory.
|
|
22
|
-
*
|
|
23
|
-
* Uses `$XDG_DATA_HOME/cleo/worktrees/<projectHash>/` per ULTRAPLAN §14.3.
|
|
24
|
-
* Falls back to `~/.local/share/cleo/worktrees/<projectHash>/` when
|
|
25
|
-
* `XDG_DATA_HOME` is not set.
|
|
26
|
-
*
|
|
27
|
-
* @param config - Worktree configuration containing optional override and project hash.
|
|
28
|
-
* @returns Absolute path to the worktree root directory.
|
|
29
|
-
*/
|
|
30
|
-
function resolveWorktreeRoot(config) {
|
|
31
|
-
if (config.worktreeRoot)
|
|
32
|
-
return config.worktreeRoot;
|
|
33
|
-
const xdgData = process.env['XDG_DATA_HOME'] ?? (0, node_path_1.join)((0, node_os_1.homedir)(), '.local', 'share');
|
|
34
|
-
return (0, node_path_1.join)(xdgData, 'cleo', 'worktrees', config.projectHash);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create a git worktree for an agent.
|
|
38
|
-
*
|
|
39
|
-
* Runs `git worktree add <path> -b <branch> <baseRef>` from the
|
|
40
|
-
* project's git root. Branch naming convention: `cleo/<taskId>-<shortId>`.
|
|
41
|
-
*
|
|
42
|
-
* If a worktree already exists at the target path (stale from a prior run),
|
|
43
|
-
* it is removed before creating the new one.
|
|
44
|
-
*
|
|
45
|
-
* @param request - The worktree request specifying task, base ref, and optional branch name.
|
|
46
|
-
* @param config - Project-level worktree configuration.
|
|
47
|
-
* @returns A handle for the created worktree with cleanup capability.
|
|
48
|
-
* @throws Error if the git worktree add command fails.
|
|
49
|
-
*/
|
|
50
|
-
function createWorktree(request, config) {
|
|
51
|
-
const root = resolveWorktreeRoot(config);
|
|
52
|
-
(0, node_fs_1.mkdirSync)(root, { recursive: true });
|
|
53
|
-
const shortId = Math.random().toString(36).slice(2, 8);
|
|
54
|
-
const branch = request.branchName ?? `cleo/${request.taskId}-${shortId}`;
|
|
55
|
-
const worktreePath = (0, node_path_1.join)(root, request.taskId);
|
|
56
|
-
// Remove existing worktree at this path if it exists (stale from prior run)
|
|
57
|
-
if ((0, node_fs_1.existsSync)(worktreePath)) {
|
|
58
|
-
try {
|
|
59
|
-
(0, node_child_process_1.execSync)(`git worktree remove "${worktreePath}" --force`, {
|
|
60
|
-
cwd: config.gitRoot,
|
|
61
|
-
stdio: 'pipe',
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
// Best-effort cleanup — directory may not be a valid worktree
|
|
66
|
-
(0, node_fs_1.rmSync)(worktreePath, { recursive: true, force: true });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Create the worktree
|
|
70
|
-
(0, node_child_process_1.execSync)(`git worktree add "${worktreePath}" -b "${branch}" "${request.baseRef}"`, {
|
|
71
|
-
cwd: config.gitRoot,
|
|
72
|
-
stdio: 'pipe',
|
|
73
|
-
});
|
|
74
|
-
return buildHandle(worktreePath, branch, request.baseRef, request.taskId, config.gitRoot, config.projectHash);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Merge a worktree's branch back into the current branch.
|
|
78
|
-
*
|
|
79
|
-
* On success the worktree is cleaned up (directory removed, branch deleted).
|
|
80
|
-
* On failure the worktree is retained for forensic inspection.
|
|
81
|
-
*
|
|
82
|
-
* @param handle - The worktree handle returned from {@link createWorktree}.
|
|
83
|
-
* @param config - Project-level worktree configuration.
|
|
84
|
-
* @param options - Merge strategy options (defaults to fast-forward only).
|
|
85
|
-
* @returns A result object indicating success or failure with an error message.
|
|
86
|
-
*/
|
|
87
|
-
function mergeWorktree(handle, config, options = {}) {
|
|
88
|
-
const strategy = options.strategy ?? 'ff-only';
|
|
89
|
-
const mergeFlag = strategy === 'ff-only' ? '--ff-only' : '--no-ff';
|
|
90
|
-
try {
|
|
91
|
-
(0, node_child_process_1.execSync)(`git merge ${mergeFlag} "${handle.branch}"`, {
|
|
92
|
-
cwd: config.gitRoot,
|
|
93
|
-
stdio: 'pipe',
|
|
94
|
-
});
|
|
95
|
-
// Success: clean up worktree
|
|
96
|
-
handle.cleanup(true);
|
|
97
|
-
return { success: true };
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
// Failure: retain worktree for forensics
|
|
101
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
102
|
-
return {
|
|
103
|
-
success: false,
|
|
104
|
-
error: `Merge failed: ${message}. Worktree retained at ${handle.path} for forensics.`,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* List active worktrees scoped to the current project.
|
|
110
|
-
*
|
|
111
|
-
* Parses `git worktree list --porcelain` and filters entries whose path
|
|
112
|
-
* falls under the project's worktree root directory.
|
|
113
|
-
*
|
|
114
|
-
* @param config - Project-level worktree configuration.
|
|
115
|
-
* @returns Array of worktree entries with their paths and branch names.
|
|
116
|
-
*/
|
|
117
|
-
function listWorktrees(config) {
|
|
118
|
-
try {
|
|
119
|
-
const output = (0, node_child_process_1.execSync)('git worktree list --porcelain', {
|
|
120
|
-
cwd: config.gitRoot,
|
|
121
|
-
encoding: 'utf-8',
|
|
122
|
-
});
|
|
123
|
-
const entries = [];
|
|
124
|
-
const root = resolveWorktreeRoot(config);
|
|
125
|
-
const canonicalRoot = canonicalPath(root);
|
|
126
|
-
let currentPath = '';
|
|
127
|
-
let currentBranch = '';
|
|
128
|
-
for (const line of output.split('\n')) {
|
|
129
|
-
if (line.startsWith('worktree ')) {
|
|
130
|
-
currentPath = line.slice('worktree '.length);
|
|
131
|
-
}
|
|
132
|
-
else if (line.startsWith('branch ')) {
|
|
133
|
-
currentBranch = line.slice('branch refs/heads/'.length);
|
|
134
|
-
}
|
|
135
|
-
else if (line === '') {
|
|
136
|
-
const canonicalCurrent = canonicalPath(currentPath);
|
|
137
|
-
const relativeToRoot = (0, node_path_1.relative)(canonicalRoot, canonicalCurrent);
|
|
138
|
-
if (relativeToRoot.length > 0 &&
|
|
139
|
-
!relativeToRoot.startsWith('..') &&
|
|
140
|
-
!(0, node_path_1.isAbsolute)(relativeToRoot)) {
|
|
141
|
-
entries.push({ path: (0, node_path_1.join)(root, relativeToRoot), branch: currentBranch });
|
|
142
|
-
}
|
|
143
|
-
currentPath = '';
|
|
144
|
-
currentBranch = '';
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return entries;
|
|
148
|
-
}
|
|
149
|
-
catch {
|
|
150
|
-
return [];
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Return a filesystem-canonical path when possible.
|
|
155
|
-
*
|
|
156
|
-
* macOS reports temporary git worktrees via `/private/var/...` even when the
|
|
157
|
-
* test/config path was created under `/var/...`. Canonicalizing both sides for
|
|
158
|
-
* filtering prevents managed worktrees from being dropped, while callers still
|
|
159
|
-
* receive paths rooted at the configured spelling.
|
|
160
|
-
*/
|
|
161
|
-
function canonicalPath(path) {
|
|
162
|
-
try {
|
|
163
|
-
return node_fs_1.realpathSync.native(path);
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
return path;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Build a WorktreeHandle with a cleanup closure.
|
|
171
|
-
*
|
|
172
|
-
* @remarks
|
|
173
|
-
* The `projectHash` parameter was added in T380/ADR-041 and is stored on the
|
|
174
|
-
* returned handle so spawn adapters can populate `CLEO_PROJECT_HASH` without
|
|
175
|
-
* re-threading {@link WorktreeConfig}.
|
|
176
|
-
*
|
|
177
|
-
* @internal
|
|
178
|
-
*/
|
|
179
|
-
function buildHandle(worktreePath, branch, baseRef, taskId, gitRoot, projectHash) {
|
|
180
|
-
return {
|
|
181
|
-
path: worktreePath,
|
|
182
|
-
branch,
|
|
183
|
-
baseRef,
|
|
184
|
-
taskId,
|
|
185
|
-
projectHash,
|
|
186
|
-
cleanup(deleteBranch = false) {
|
|
187
|
-
try {
|
|
188
|
-
(0, node_child_process_1.execSync)(`git worktree remove "${worktreePath}" --force`, {
|
|
189
|
-
cwd: gitRoot,
|
|
190
|
-
stdio: 'pipe',
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
catch {
|
|
194
|
-
(0, node_fs_1.rmSync)(worktreePath, { recursive: true, force: true });
|
|
195
|
-
}
|
|
196
|
-
if (deleteBranch) {
|
|
197
|
-
try {
|
|
198
|
-
(0, node_child_process_1.execSync)(`git branch -D "${branch}"`, {
|
|
199
|
-
cwd: gitRoot,
|
|
200
|
-
stdio: 'pipe',
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
catch {
|
|
204
|
-
// Branch may already be deleted
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/cant",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.101",
|
|
4
4
|
"description": "CANT protocol parser and runtime for CLEO — wraps cant-core via napi-rs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"napi/"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@cleocode/
|
|
13
|
-
"@cleocode/lafs": "2026.5.
|
|
14
|
-
"@cleocode/
|
|
12
|
+
"@cleocode/core": "2026.5.101",
|
|
13
|
+
"@cleocode/lafs": "2026.5.101",
|
|
14
|
+
"@cleocode/contracts": "2026.5.101"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"typescript": "^6.0.2",
|