@cleocode/paths 2026.10.27-rc.ci.698 → 2026.11.1-canary.2
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/worktree-paths.d.ts
CHANGED
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
* through `realpathSync` before hashing so that different mount points
|
|
26
26
|
* (/mnt/projects/X vs /workspace/X) produce the same hash.
|
|
27
27
|
*
|
|
28
|
+
* **One project, one hash (T14126):** a linked git worktree hashes as the
|
|
29
|
+
* main checkout that owns it, so a command run from inside a task worktree
|
|
30
|
+
* (`cleo done --plan`) names the same `<cleoHome>/worktrees/<hash>/` as the
|
|
31
|
+
* spawn that created it. Hashing the worktree path itself named a sibling
|
|
32
|
+
* directory that does not exist.
|
|
33
|
+
*
|
|
28
34
|
* @param projectRoot - Absolute path to the project root.
|
|
29
35
|
* @returns 16-character lowercase hex string.
|
|
30
36
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree-paths.d.ts","sourceRoot":"","sources":["../src/worktree-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"worktree-paths.d.ts","sourceRoot":"","sources":["../src/worktree-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmDH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAW9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAG7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAGR;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpE;AAKD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvF"}
|
package/dist/worktree-paths.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* @task T9802
|
|
16
16
|
*/
|
|
17
17
|
import { createHash } from 'node:crypto';
|
|
18
|
-
import { realpathSync } from 'node:fs';
|
|
19
|
-
import { join } from 'node:path';
|
|
18
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
19
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
20
20
|
import { getCleoHome } from './cleo-paths.js';
|
|
21
21
|
const WORKTREES_SUBDIR = 'worktrees';
|
|
22
22
|
const PROJECT_HASH_LENGTH = 16;
|
|
@@ -36,6 +36,33 @@ function joinSegments(base, ...parts) {
|
|
|
36
36
|
}
|
|
37
37
|
return join(base, ...parts);
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The main checkout that owns the linked git worktree at `dir`, or null
|
|
41
|
+
* (T14126). Only the `<main>/.git/worktrees/<name>` gitlink layout counts: a
|
|
42
|
+
* submodule (`.git/modules/<name>`) or a bare repository's worktree has no
|
|
43
|
+
* main checkout to name, and resolves as itself.
|
|
44
|
+
*
|
|
45
|
+
* @param dir - Real path of a directory that may be a linked worktree.
|
|
46
|
+
* @returns The owning checkout's real path, or null.
|
|
47
|
+
*/
|
|
48
|
+
function linkedWorktreeOwner(dir) {
|
|
49
|
+
try {
|
|
50
|
+
// A directory `.git` (a main checkout) throws EISDIR here: not linked.
|
|
51
|
+
const match = /^gitdir:\s*(.+)$/m.exec(readFileSync(join(dir, '.git'), 'utf-8'));
|
|
52
|
+
if (!match?.[1])
|
|
53
|
+
return null;
|
|
54
|
+
const gitdir = resolve(dir, match[1].trim());
|
|
55
|
+
if (basename(dirname(gitdir)) !== 'worktrees')
|
|
56
|
+
return null;
|
|
57
|
+
const commonDir = dirname(dirname(gitdir));
|
|
58
|
+
if (basename(commonDir) !== '.git')
|
|
59
|
+
return null;
|
|
60
|
+
return realpathSync(dirname(commonDir));
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
39
66
|
/**
|
|
40
67
|
* Compute a stable 16-character project hash from an absolute project root path.
|
|
41
68
|
*
|
|
@@ -47,6 +74,12 @@ function joinSegments(base, ...parts) {
|
|
|
47
74
|
* through `realpathSync` before hashing so that different mount points
|
|
48
75
|
* (/mnt/projects/X vs /workspace/X) produce the same hash.
|
|
49
76
|
*
|
|
77
|
+
* **One project, one hash (T14126):** a linked git worktree hashes as the
|
|
78
|
+
* main checkout that owns it, so a command run from inside a task worktree
|
|
79
|
+
* (`cleo done --plan`) names the same `<cleoHome>/worktrees/<hash>/` as the
|
|
80
|
+
* spawn that created it. Hashing the worktree path itself named a sibling
|
|
81
|
+
* directory that does not exist.
|
|
82
|
+
*
|
|
50
83
|
* @param projectRoot - Absolute path to the project root.
|
|
51
84
|
* @returns 16-character lowercase hex string.
|
|
52
85
|
*
|
|
@@ -62,6 +95,7 @@ export function computeProjectHash(projectRoot) {
|
|
|
62
95
|
catch {
|
|
63
96
|
normalized = projectRoot;
|
|
64
97
|
}
|
|
98
|
+
normalized = linkedWorktreeOwner(normalized) ?? normalized;
|
|
65
99
|
return createHash('sha256').update(normalized).digest('hex').slice(0, PROJECT_HASH_LENGTH);
|
|
66
100
|
}
|
|
67
101
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree-paths.js","sourceRoot":"","sources":["../src/worktree-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM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,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,YAAY,CAAC,WAAW,EAAE,EAAE,gBAAgB,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAmB;IAC1D,OAAO,YAAY,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAC9D,CAAC;AAED,kFAAkF;AAClF,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,WAAW,CAAU,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,2BAA2B,CAAC,WAAmB,EAAE,MAAc;IAC7E,OAAO,YAAY,CAAC,WAAW,EAAE,EAAE,GAAG,qBAAqB,EAAE,WAAW,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;AAC9F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/paths",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.11.1-canary.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "CLEO XDG/env-paths SSoT — createPlatformPathsResolver factory, cleo-bound platform paths, project hash + worktree root primitives, isAbsolutePath. Zero-dep leaf package consumed by core, worktree, brain, adapters, and caamp.",
|