@mindfoldhq/trellis 0.5.0-beta.15 → 0.5.0-beta.17
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/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +0 -28
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +29 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/antigravity.d.ts.map +1 -1
- package/dist/configurators/antigravity.js +2 -8
- package/dist/configurators/antigravity.js.map +1 -1
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +3 -9
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/codebuddy.d.ts.map +1 -1
- package/dist/configurators/codebuddy.js +2 -2
- package/dist/configurators/codebuddy.js.map +1 -1
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +2 -7
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts.map +1 -1
- package/dist/configurators/copilot.js +2 -9
- package/dist/configurators/copilot.js.map +1 -1
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +2 -2
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/droid.d.ts.map +1 -1
- package/dist/configurators/droid.js +2 -2
- package/dist/configurators/droid.js.map +1 -1
- package/dist/configurators/gemini.d.ts.map +1 -1
- package/dist/configurators/gemini.js +2 -2
- package/dist/configurators/gemini.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +13 -11
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/kilo.d.ts.map +1 -1
- package/dist/configurators/kilo.js +2 -8
- package/dist/configurators/kilo.js.map +1 -1
- package/dist/configurators/kiro.d.ts.map +1 -1
- package/dist/configurators/kiro.js +2 -2
- package/dist/configurators/kiro.js.map +1 -1
- package/dist/configurators/opencode.d.ts.map +1 -1
- package/dist/configurators/opencode.js +7 -4
- package/dist/configurators/opencode.js.map +1 -1
- package/dist/configurators/pi.d.ts.map +1 -1
- package/dist/configurators/pi.js +9 -4
- package/dist/configurators/pi.js.map +1 -1
- package/dist/configurators/qoder.d.ts.map +1 -1
- package/dist/configurators/qoder.js +2 -2
- package/dist/configurators/qoder.js.map +1 -1
- package/dist/configurators/shared.d.ts +21 -2
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +32 -3
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/windsurf.d.ts.map +1 -1
- package/dist/configurators/windsurf.js +2 -8
- package/dist/configurators/windsurf.js.map +1 -1
- package/dist/migrations/manifests/0.5.0-beta.15.json +3 -13
- package/dist/migrations/manifests/0.5.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.17.json +9 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +81 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +78 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +79 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +48 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +101 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +79 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +74 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +83 -0
- package/dist/templates/common/index.d.ts +22 -2
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +53 -4
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/skills/brainstorm.md +3 -0
- package/dist/templates/markdown/agents.md +8 -0
- package/dist/templates/pi/extensions/trellis/index.ts.txt +499 -51
- package/dist/templates/trellis/scripts/common/task_store.py +2 -2
- package/dist/templates/trellis/scripts/task.py +3 -3
- package/dist/templates/trellis/workflow.md +3 -0
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/template-hash.d.ts +22 -3
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +78 -17
- package/dist/utils/template-hash.js.map +1 -1
- package/package.json +1 -1
|
@@ -298,8 +298,8 @@ def cmd_archive(args: argparse.Namespace) -> int:
|
|
|
298
298
|
|
|
299
299
|
tasks_dir = get_tasks_dir(repo_root)
|
|
300
300
|
|
|
301
|
-
#
|
|
302
|
-
task_dir =
|
|
301
|
+
# Resolve task directory (supports task name, relative path, or absolute path)
|
|
302
|
+
task_dir = resolve_task_dir(task_name, repo_root)
|
|
303
303
|
|
|
304
304
|
if not task_dir or not task_dir.is_dir():
|
|
305
305
|
print(colored(f"Error: Task not found: {task_name}", Colors.RED), file=sys.stderr)
|
|
@@ -14,7 +14,7 @@ Usage:
|
|
|
14
14
|
python3 task.py set-branch <dir> <branch> # Set git branch
|
|
15
15
|
python3 task.py set-base-branch <dir> <branch> # Set PR target branch
|
|
16
16
|
python3 task.py set-scope <dir> <scope> # Set scope for PR title
|
|
17
|
-
python3 task.py archive <task-
|
|
17
|
+
python3 task.py archive <task-dir> # Archive completed task
|
|
18
18
|
python3 task.py list # List active tasks
|
|
19
19
|
python3 task.py list-archive [month] # List archived tasks
|
|
20
20
|
python3 task.py add-subtask <parent-dir> <child-dir> # Link child to parent
|
|
@@ -297,7 +297,7 @@ Usage:
|
|
|
297
297
|
python3 task.py set-branch <dir> <branch> Set git branch
|
|
298
298
|
python3 task.py set-base-branch <dir> <branch> Set PR target branch
|
|
299
299
|
python3 task.py set-scope <dir> <scope> Set scope for PR title
|
|
300
|
-
python3 task.py archive <task-
|
|
300
|
+
python3 task.py archive <task-dir> Archive completed task
|
|
301
301
|
python3 task.py add-subtask <parent> <child> Link child task to parent
|
|
302
302
|
python3 task.py remove-subtask <parent> <child> Unlink child from parent
|
|
303
303
|
python3 task.py list [--mine] [--status <status>] List tasks
|
|
@@ -424,7 +424,7 @@ def main() -> int:
|
|
|
424
424
|
|
|
425
425
|
# archive
|
|
426
426
|
p_archive = subparsers.add_parser("archive", help="Archive task")
|
|
427
|
-
p_archive.add_argument("name", help="Task name")
|
|
427
|
+
p_archive.add_argument("name", help="Task directory or name")
|
|
428
428
|
p_archive.add_argument("--no-commit", action="store_true", help="Skip auto git commit after archive")
|
|
429
429
|
|
|
430
430
|
# list
|
|
@@ -207,6 +207,9 @@ python3 ./.trellis/scripts/task.py create "<task title>" --slug <name>
|
|
|
207
207
|
python3 ./.trellis/scripts/task.py start <task-dir>
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
+
`--slug` is the human-readable name only. Do not include the `MM-DD-` date
|
|
211
|
+
prefix; `task.py create` adds that prefix automatically.
|
|
212
|
+
|
|
210
213
|
Skip when `python3 ./.trellis/scripts/task.py current --source` already points to a task.
|
|
211
214
|
|
|
212
215
|
#### 1.1 Requirement exploration `[required · repeatable]`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POSIX path normalization utility
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for converting OS-native path separators to POSIX `/`.
|
|
5
|
+
* Use ONLY for logical path strings used as cross-platform persistence keys
|
|
6
|
+
* (e.g. hash dictionary keys, JSON-stored paths). Do NOT use for paths passed
|
|
7
|
+
* to filesystem APIs — those must remain OS-native via `path.join`.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Convert any path string's `\` separators to POSIX `/`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function toPosix(p: string): string;
|
|
13
|
+
//# sourceMappingURL=posix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posix.d.ts","sourceRoot":"","sources":["../../src/utils/posix.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POSIX path normalization utility
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for converting OS-native path separators to POSIX `/`.
|
|
5
|
+
* Use ONLY for logical path strings used as cross-platform persistence keys
|
|
6
|
+
* (e.g. hash dictionary keys, JSON-stored paths). Do NOT use for paths passed
|
|
7
|
+
* to filesystem APIs — those must remain OS-native via `path.join`.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Convert any path string's `\` separators to POSIX `/`.
|
|
11
|
+
*/
|
|
12
|
+
export function toPosix(p) {
|
|
13
|
+
return p.replace(/\\/g, "/");
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=posix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posix.js","sourceRoot":"","sources":["../../src/utils/posix.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -3,18 +3,37 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Stores SHA256 hashes of template files at install time.
|
|
5
5
|
* Used to determine if users have modified templates.
|
|
6
|
+
*
|
|
7
|
+
* Cross-platform contract:
|
|
8
|
+
* - All hash dictionary keys are POSIX style (`/`), never `\`.
|
|
9
|
+
* - Hashes are computed against LF-normalized content, so CRLF and LF
|
|
10
|
+
* versions of the same logical content produce the same hash.
|
|
11
|
+
* - Persisted JSON uses schema `{ __version: 2, hashes: { ... } }`. Old
|
|
12
|
+
* flat-format files (no `__version`) are silently discarded; the hash
|
|
13
|
+
* set is regenerated on next init/update.
|
|
6
14
|
*/
|
|
7
15
|
import type { TemplateHashes } from "../types/migration.js";
|
|
8
16
|
/**
|
|
9
|
-
* Compute SHA256 hash of content
|
|
17
|
+
* Compute SHA256 hash of content.
|
|
18
|
+
*
|
|
19
|
+
* Normalizes line endings (CRLF -> LF) before hashing so that the same
|
|
20
|
+
* logical content yields the same hash across platforms.
|
|
10
21
|
*/
|
|
11
22
|
export declare function computeHash(content: string): string;
|
|
12
23
|
/**
|
|
13
|
-
* Load stored template hashes
|
|
24
|
+
* Load stored template hashes.
|
|
25
|
+
*
|
|
26
|
+
* Returns `{}` for: missing file, invalid JSON, or legacy flat-format
|
|
27
|
+
* files (no `__version`). Legacy files are silently dropped; the hash
|
|
28
|
+
* set is regenerated by subsequent init/update logic. This handles two
|
|
29
|
+
* Windows compatibility issues at once: backslash keys and CRLF-based
|
|
30
|
+
* hashes both differ from the v2 contract.
|
|
14
31
|
*/
|
|
15
32
|
export declare function loadHashes(cwd: string): TemplateHashes;
|
|
16
33
|
/**
|
|
17
|
-
* Save template hashes
|
|
34
|
+
* Save template hashes.
|
|
35
|
+
*
|
|
36
|
+
* Always writes the v2 schema with POSIX-normalized keys.
|
|
18
37
|
*/
|
|
19
38
|
export declare function saveHashes(cwd: string, hashes: TemplateHashes): void;
|
|
20
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-hash.d.ts","sourceRoot":"","sources":["../../src/utils/template-hash.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"template-hash.d.ts","sourceRoot":"","sources":["../../src/utils/template-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAe5D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnD;AAoBD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA6BtD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAOpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAQ1E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAU1E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAKlE;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,IAAI,CASN;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAsBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GACtB,OAAO,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EAAE,EACvB,MAAM,EAAE,cAAc,GACrB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAQtB;AAuED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAsBpD"}
|
|
@@ -3,19 +3,34 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Stores SHA256 hashes of template files at install time.
|
|
5
5
|
* Used to determine if users have modified templates.
|
|
6
|
+
*
|
|
7
|
+
* Cross-platform contract:
|
|
8
|
+
* - All hash dictionary keys are POSIX style (`/`), never `\`.
|
|
9
|
+
* - Hashes are computed against LF-normalized content, so CRLF and LF
|
|
10
|
+
* versions of the same logical content produce the same hash.
|
|
11
|
+
* - Persisted JSON uses schema `{ __version: 2, hashes: { ... } }`. Old
|
|
12
|
+
* flat-format files (no `__version`) are silently discarded; the hash
|
|
13
|
+
* set is regenerated on next init/update.
|
|
6
14
|
*/
|
|
7
15
|
import { createHash } from "node:crypto";
|
|
8
16
|
import fs from "node:fs";
|
|
9
17
|
import path from "node:path";
|
|
10
18
|
import { DIR_NAMES } from "../constants/paths.js";
|
|
11
19
|
import { ALL_MANAGED_DIRS } from "../configurators/index.js";
|
|
20
|
+
import { toPosix } from "./posix.js";
|
|
12
21
|
/** File name for storing template hashes */
|
|
13
22
|
const HASHES_FILE = ".template-hashes.json";
|
|
23
|
+
/** Current schema version for `.template-hashes.json` */
|
|
24
|
+
const HASHES_SCHEMA_VERSION = 2;
|
|
14
25
|
/**
|
|
15
|
-
* Compute SHA256 hash of content
|
|
26
|
+
* Compute SHA256 hash of content.
|
|
27
|
+
*
|
|
28
|
+
* Normalizes line endings (CRLF -> LF) before hashing so that the same
|
|
29
|
+
* logical content yields the same hash across platforms.
|
|
16
30
|
*/
|
|
17
31
|
export function computeHash(content) {
|
|
18
|
-
|
|
32
|
+
const normalized = content.replace(/\r\n/g, "\n");
|
|
33
|
+
return createHash("sha256").update(normalized, "utf-8").digest("hex");
|
|
19
34
|
}
|
|
20
35
|
/**
|
|
21
36
|
* Get path to the hashes file
|
|
@@ -24,7 +39,23 @@ function getHashesPath(cwd) {
|
|
|
24
39
|
return path.join(cwd, DIR_NAMES.WORKFLOW, HASHES_FILE);
|
|
25
40
|
}
|
|
26
41
|
/**
|
|
27
|
-
*
|
|
42
|
+
* Normalize all keys of a hashes record to POSIX form.
|
|
43
|
+
*/
|
|
44
|
+
function normalizeHashKeys(hashes) {
|
|
45
|
+
const out = {};
|
|
46
|
+
for (const [key, value] of Object.entries(hashes)) {
|
|
47
|
+
out[toPosix(key)] = value;
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Load stored template hashes.
|
|
53
|
+
*
|
|
54
|
+
* Returns `{}` for: missing file, invalid JSON, or legacy flat-format
|
|
55
|
+
* files (no `__version`). Legacy files are silently dropped; the hash
|
|
56
|
+
* set is regenerated by subsequent init/update logic. This handles two
|
|
57
|
+
* Windows compatibility issues at once: backslash keys and CRLF-based
|
|
58
|
+
* hashes both differ from the v2 contract.
|
|
28
59
|
*/
|
|
29
60
|
export function loadHashes(cwd) {
|
|
30
61
|
const hashesPath = getHashesPath(cwd);
|
|
@@ -33,18 +64,37 @@ export function loadHashes(cwd) {
|
|
|
33
64
|
}
|
|
34
65
|
try {
|
|
35
66
|
const content = fs.readFileSync(hashesPath, "utf-8");
|
|
36
|
-
|
|
67
|
+
const parsed = JSON.parse(content);
|
|
68
|
+
if (parsed !== null &&
|
|
69
|
+
typeof parsed === "object" &&
|
|
70
|
+
"__version" in parsed &&
|
|
71
|
+
parsed.__version === HASHES_SCHEMA_VERSION &&
|
|
72
|
+
"hashes" in parsed &&
|
|
73
|
+
typeof parsed.hashes === "object" &&
|
|
74
|
+
parsed.hashes !== null) {
|
|
75
|
+
const stored = parsed;
|
|
76
|
+
// Defensive: enforce POSIX keys even if a writer slipped through.
|
|
77
|
+
return normalizeHashKeys(stored.hashes);
|
|
78
|
+
}
|
|
79
|
+
// Legacy flat format (no __version) or unknown shape: discard.
|
|
80
|
+
return {};
|
|
37
81
|
}
|
|
38
82
|
catch {
|
|
39
83
|
return {};
|
|
40
84
|
}
|
|
41
85
|
}
|
|
42
86
|
/**
|
|
43
|
-
* Save template hashes
|
|
87
|
+
* Save template hashes.
|
|
88
|
+
*
|
|
89
|
+
* Always writes the v2 schema with POSIX-normalized keys.
|
|
44
90
|
*/
|
|
45
91
|
export function saveHashes(cwd, hashes) {
|
|
46
92
|
const hashesPath = getHashesPath(cwd);
|
|
47
|
-
|
|
93
|
+
const payload = {
|
|
94
|
+
__version: HASHES_SCHEMA_VERSION,
|
|
95
|
+
hashes: normalizeHashKeys(hashes),
|
|
96
|
+
};
|
|
97
|
+
fs.writeFileSync(hashesPath, JSON.stringify(payload, null, 2));
|
|
48
98
|
}
|
|
49
99
|
/**
|
|
50
100
|
* Update hashes for specific files
|
|
@@ -55,7 +105,7 @@ export function saveHashes(cwd, hashes) {
|
|
|
55
105
|
export function updateHashes(cwd, files) {
|
|
56
106
|
const hashes = loadHashes(cwd);
|
|
57
107
|
for (const [relativePath, content] of files) {
|
|
58
|
-
hashes[relativePath] = computeHash(content);
|
|
108
|
+
hashes[toPosix(relativePath)] = computeHash(content);
|
|
59
109
|
}
|
|
60
110
|
saveHashes(cwd, hashes);
|
|
61
111
|
}
|
|
@@ -69,7 +119,7 @@ export function updateHashFromFile(cwd, relativePath) {
|
|
|
69
119
|
}
|
|
70
120
|
const content = fs.readFileSync(fullPath, "utf-8");
|
|
71
121
|
const hashes = loadHashes(cwd);
|
|
72
|
-
hashes[relativePath] = computeHash(content);
|
|
122
|
+
hashes[toPosix(relativePath)] = computeHash(content);
|
|
73
123
|
saveHashes(cwd, hashes);
|
|
74
124
|
}
|
|
75
125
|
/**
|
|
@@ -77,7 +127,8 @@ export function updateHashFromFile(cwd, relativePath) {
|
|
|
77
127
|
*/
|
|
78
128
|
export function removeHash(cwd, relativePath) {
|
|
79
129
|
const hashes = loadHashes(cwd);
|
|
80
|
-
const
|
|
130
|
+
const key = toPosix(relativePath);
|
|
131
|
+
const { [key]: _, ...rest } = hashes;
|
|
81
132
|
saveHashes(cwd, rest);
|
|
82
133
|
}
|
|
83
134
|
/**
|
|
@@ -85,9 +136,11 @@ export function removeHash(cwd, relativePath) {
|
|
|
85
136
|
*/
|
|
86
137
|
export function renameHash(cwd, oldPath, newPath) {
|
|
87
138
|
const hashes = loadHashes(cwd);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
139
|
+
const oldKey = toPosix(oldPath);
|
|
140
|
+
const newKey = toPosix(newPath);
|
|
141
|
+
if (hashes[oldKey]) {
|
|
142
|
+
const { [oldKey]: oldValue, ...rest } = hashes;
|
|
143
|
+
rest[newKey] = oldValue;
|
|
91
144
|
saveHashes(cwd, rest);
|
|
92
145
|
}
|
|
93
146
|
}
|
|
@@ -105,8 +158,11 @@ export function isTemplateModified(cwd, relativePath, hashes) {
|
|
|
105
158
|
if (!fs.existsSync(fullPath)) {
|
|
106
159
|
return false;
|
|
107
160
|
}
|
|
108
|
-
// If we don't have a stored hash, assume it's modified (conservative)
|
|
109
|
-
|
|
161
|
+
// If we don't have a stored hash, assume it's modified (conservative).
|
|
162
|
+
// Lookup by POSIX key — hashes loaded via loadHashes are already
|
|
163
|
+
// normalized, but the caller may have built `hashes` themselves.
|
|
164
|
+
const posixKey = toPosix(relativePath);
|
|
165
|
+
const storedHash = hashes[posixKey] ?? hashes[relativePath];
|
|
110
166
|
if (!storedHash) {
|
|
111
167
|
return true;
|
|
112
168
|
}
|
|
@@ -169,7 +225,7 @@ const EXCLUDE_FROM_HASH = [
|
|
|
169
225
|
* Check if a path should be excluded from hash tracking
|
|
170
226
|
*/
|
|
171
227
|
function shouldExcludeFromHash(relativePath) {
|
|
172
|
-
const normalizedPath = relativePath
|
|
228
|
+
const normalizedPath = toPosix(relativePath);
|
|
173
229
|
for (const pattern of EXCLUDE_FROM_HASH) {
|
|
174
230
|
if (normalizedPath.includes(pattern)) {
|
|
175
231
|
return true;
|
|
@@ -178,7 +234,10 @@ function shouldExcludeFromHash(relativePath) {
|
|
|
178
234
|
return false;
|
|
179
235
|
}
|
|
180
236
|
/**
|
|
181
|
-
* Recursively collect all files in a directory
|
|
237
|
+
* Recursively collect all files in a directory.
|
|
238
|
+
*
|
|
239
|
+
* Returned paths are POSIX-normalized so they can be used directly as
|
|
240
|
+
* hash dictionary keys regardless of host OS.
|
|
182
241
|
*/
|
|
183
242
|
function collectFiles(cwd, dir, relativeTo = "") {
|
|
184
243
|
const fullDir = path.join(cwd, dir);
|
|
@@ -196,7 +255,7 @@ function collectFiles(cwd, dir, relativeTo = "") {
|
|
|
196
255
|
files.push(...collectFiles(cwd, relativePath, relativeTo));
|
|
197
256
|
}
|
|
198
257
|
else if (entry.isFile()) {
|
|
199
|
-
files.push(relativePath);
|
|
258
|
+
files.push(toPosix(relativePath));
|
|
200
259
|
}
|
|
201
260
|
}
|
|
202
261
|
return files;
|
|
@@ -217,6 +276,8 @@ export function initializeHashes(cwd) {
|
|
|
217
276
|
for (const dir of TEMPLATE_DIRS) {
|
|
218
277
|
const files = collectFiles(cwd, dir);
|
|
219
278
|
for (const relativePath of files) {
|
|
279
|
+
// `relativePath` is POSIX (collectFiles normalizes); reconstruct an
|
|
280
|
+
// OS-native path for the actual fs read.
|
|
220
281
|
const fullPath = path.join(cwd, relativePath);
|
|
221
282
|
try {
|
|
222
283
|
const content = fs.readFileSync(fullPath, "utf-8");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-hash.js","sourceRoot":"","sources":["../../src/utils/template-hash.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"template-hash.js","sourceRoot":"","sources":["../../src/utils/template-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,4CAA4C;AAC5C,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,yDAAyD;AACzD,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAQhC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,MAAsB;IAC/C,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,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