@cleocode/core 2026.11.6 → 2026.11.7-rc.ci.724
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/build-provenance.json +2 -2
- package/dist/config/legacy-keys.d.ts +14 -0
- package/dist/config/legacy-keys.js +32 -0
- package/dist/config/legacy-keys.js.map +1 -1
- package/dist/config.js +7 -3
- package/dist/config.js.map +1 -1
- package/dist/docs/doctor.js +101 -38
- package/dist/docs/doctor.js.map +1 -1
- package/dist/doctor/cleo-runtime-tracking.d.ts +174 -0
- package/dist/doctor/cleo-runtime-tracking.js +437 -0
- package/dist/doctor/cleo-runtime-tracking.js.map +1 -0
- package/dist/doctor/cloud-sync-folder.d.ts +88 -0
- package/dist/doctor/cloud-sync-folder.js +211 -0
- package/dist/doctor/cloud-sync-folder.js.map +1 -0
- package/dist/git/hooks-install.js +10 -2
- package/dist/git/hooks-install.js.map +1 -1
- package/dist/hooks/handlers/work-capture-hooks.js +2 -0
- package/dist/hooks/handlers/work-capture-hooks.js.map +1 -1
- package/dist/hooks/registry.d.ts +4 -2
- package/dist/hooks/registry.js +19 -10
- package/dist/hooks/registry.js.map +1 -1
- package/dist/hooks/types.d.ts +2 -0
- package/dist/hooks/types.js.map +1 -1
- package/dist/hygiene/census.d.ts +24 -4
- package/dist/hygiene/census.js +137 -9
- package/dist/hygiene/census.js.map +1 -1
- package/dist/init.js +25 -0
- package/dist/init.js.map +1 -1
- package/dist/memory/graph-auto-populate.d.ts +2 -2
- package/dist/memory/graph-auto-populate.js +8 -3
- package/dist/memory/graph-auto-populate.js.map +1 -1
- package/dist/orchestrate/spawn-ops.d.ts +2 -0
- package/dist/orchestrate/spawn-ops.js +4 -0
- package/dist/orchestrate/spawn-ops.js.map +1 -1
- package/dist/orchestrate/worker-records.d.ts +2 -0
- package/dist/orchestrate/worker-records.js +4 -2
- package/dist/orchestrate/worker-records.js.map +1 -1
- package/dist/orchestration/dashboard.d.ts +17 -0
- package/dist/orchestration/dashboard.js +79 -3
- package/dist/orchestration/dashboard.js.map +1 -1
- package/dist/orchestration/spawn.d.ts +7 -0
- package/dist/orchestration/spawn.js +8 -4
- package/dist/orchestration/spawn.js.map +1 -1
- package/dist/release/ci-evidence.d.ts +75 -0
- package/dist/release/ci-evidence.js +117 -1
- package/dist/release/ci-evidence.js.map +1 -1
- package/dist/render/session/doctor.js +8 -2
- package/dist/render/session/doctor.js.map +1 -1
- package/dist/scaffold/ensure-config.d.ts +6 -1
- package/dist/scaffold/ensure-config.js +4 -2
- package/dist/scaffold/ensure-config.js.map +1 -1
- package/dist/session/engine-ops.d.ts +2 -2
- package/dist/session/engine-ops.js +4 -0
- package/dist/session/engine-ops.js.map +1 -1
- package/dist/store/backup-recover.d.ts +9 -10
- package/dist/store/backup-recover.js +7 -5
- package/dist/store/backup-recover.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts +2 -0
- package/dist/store/dual-scope-db.js +63 -3
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/memory-sqlite.js +3 -24
- package/dist/store/memory-sqlite.js.map +1 -1
- package/dist/store/open-cleo-db.d.ts +15 -0
- package/dist/store/open-cleo-db.js +124 -3
- package/dist/store/open-cleo-db.js.map +1 -1
- package/dist/store/recover-malformed-db.js +2 -0
- package/dist/store/recover-malformed-db.js.map +1 -1
- package/dist/store/repair-store-files.d.ts +25 -0
- package/dist/store/repair-store-files.js +273 -0
- package/dist/store/repair-store-files.js.map +1 -0
- package/dist/store/repair-store-salvage.d.ts +13 -0
- package/dist/store/repair-store-salvage.js +765 -0
- package/dist/store/repair-store-salvage.js.map +1 -0
- package/dist/store/repair-store.d.ts +14 -0
- package/dist/store/repair-store.js +499 -0
- package/dist/store/repair-store.js.map +1 -0
- package/dist/store/restore-marker.d.ts +5 -0
- package/dist/store/restore-marker.js +15 -0
- package/dist/store/restore-marker.js.map +1 -1
- package/dist/store/schema/cleo-global/agent-registry.d.ts +1 -1
- package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
- package/dist/store/schema/provenance/releases.d.ts +1 -1
- package/dist/store/snapshot-gate.js +17 -7
- package/dist/store/snapshot-gate.js.map +1 -1
- package/dist/store/sqlite-backup.js +6 -9
- package/dist/store/sqlite-backup.js.map +1 -1
- package/dist/store/sqlite-native.d.ts +2 -0
- package/dist/store/sqlite-native.js +11 -0
- package/dist/store/sqlite-native.js.map +1 -1
- package/dist/store/worktree-isolation-guard.js +2 -0
- package/dist/store/worktree-isolation-guard.js.map +1 -1
- package/dist/system/health.d.ts +4 -2
- package/dist/system/health.js +42 -1
- package/dist/system/health.js.map +1 -1
- package/dist/tasks/add.js +5 -12
- package/dist/tasks/add.js.map +1 -1
- package/dist/tasks/merge-close.d.ts +14 -0
- package/dist/tasks/merge-close.js +21 -2
- package/dist/tasks/merge-close.js.map +1 -1
- package/dist/upgrade.d.ts +2 -0
- package/dist/upgrade.js +38 -1
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/doctor/checks.d.ts +5 -3
- package/dist/validation/doctor/checks.js +14 -4
- package/dist/validation/doctor/checks.js.map +1 -1
- package/package.json +13 -13
- package/templates/CLEO-INJECTION.md +3 -2
- package/templates/CLEO-REFERENCE.md +4 -2
- package/templates/cleo-gitignore +3 -0
- package/templates/config.template.json +1 -2
- package/templates/git-hooks/legacy-hashes.json +2 -1
- package/templates/git-hooks/pre-commit +66 -7
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git tracking of `.cleo/` runtime files (T14549 · ADR-013 §9 · T5158).
|
|
3
|
+
*
|
|
4
|
+
* A project whose git repository tracks `.cleo/cleo.db` (or any other runtime
|
|
5
|
+
* file) corrupts its store on `git checkout` / `git pull`: git replaces the
|
|
6
|
+
* main database file while its `-wal` sidecar stays behind, and SQLite then
|
|
7
|
+
* replays a WAL that belongs to a different database. This module detects
|
|
8
|
+
* such tracking, untracks it losslessly, and finds the commits that added it.
|
|
9
|
+
*
|
|
10
|
+
* The set of runtime files is NOT a second list: it is the EXPLICIT DENY
|
|
11
|
+
* block of the shipped `.cleo/.gitignore` template ({@link getGitignoreContent}),
|
|
12
|
+
* the same rules that keep the files out of git in the first place. The
|
|
13
|
+
* tracked identity files (`project.json`, `project-id`, ADR-094/096) are never
|
|
14
|
+
* runtime files.
|
|
15
|
+
*
|
|
16
|
+
* @task T14549
|
|
17
|
+
*/
|
|
18
|
+
import type { CheckResult } from '@cleocode/contracts/scaffold-diagnostics';
|
|
19
|
+
/** The command `cleo doctor --fix` prints after untracking runtime files. */
|
|
20
|
+
export declare const UNTRACK_RUNTIME_COMMIT_COMMAND = "git commit -m \"chore: stop tracking .cleo runtime files (ADR-013 \u00A79)\"";
|
|
21
|
+
/**
|
|
22
|
+
* The runtime-file patterns: every rule of the EXPLICIT DENY block of a
|
|
23
|
+
* `.cleo/.gitignore` (gitignore syntax, relative to `.cleo/`).
|
|
24
|
+
*
|
|
25
|
+
* @param gitignoreContent - The `.cleo/.gitignore` text. @defaultValue the shipped template
|
|
26
|
+
* @returns The deny patterns in file order; empty when the block is absent.
|
|
27
|
+
* @task T14549
|
|
28
|
+
*/
|
|
29
|
+
export declare function runtimeDenyPatterns(gitignoreContent?: string): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Whether `path` (relative to the project root, e.g. `.cleo/cleo.db`) is a
|
|
32
|
+
* `.cleo/` runtime file: under `.cleo/`, matched by a deny pattern, and not a
|
|
33
|
+
* tracked identity file.
|
|
34
|
+
*
|
|
35
|
+
* @param path - Project-relative path with forward slashes.
|
|
36
|
+
* @param patterns - Deny patterns. @defaultValue {@link runtimeDenyPatterns}()
|
|
37
|
+
* @returns `true` for a runtime file git must never track.
|
|
38
|
+
* @task T14549
|
|
39
|
+
*/
|
|
40
|
+
export declare function isCleoRuntimePath(path: string, patterns?: readonly string[]): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether a project-relative path is a SQLite store file or sidecar
|
|
43
|
+
* (`*.db`, `*.db-wal`, `*.db-shm`, `*.db-journal`), the files whose tracking
|
|
44
|
+
* corrupts the store on checkout.
|
|
45
|
+
*
|
|
46
|
+
* @param path - Project-relative path.
|
|
47
|
+
* @returns `true` for a SQLite database file or sidecar.
|
|
48
|
+
* @task T14549
|
|
49
|
+
*/
|
|
50
|
+
export declare function isSqliteStorePath(path: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Outcome of reading git for the runtime checks: no repository, a read that
|
|
53
|
+
* failed inside a real repository (coverage missing, never a clean result),
|
|
54
|
+
* or the value read.
|
|
55
|
+
*
|
|
56
|
+
* @typeParam T - The value read on success.
|
|
57
|
+
* @task T14549
|
|
58
|
+
*/
|
|
59
|
+
export type RuntimeGitScan<T> = {
|
|
60
|
+
state: 'not-git';
|
|
61
|
+
} | {
|
|
62
|
+
state: 'incomplete';
|
|
63
|
+
error: string;
|
|
64
|
+
} | {
|
|
65
|
+
state: 'ok';
|
|
66
|
+
value: T;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The `.cleo/` runtime files the project's git index tracks. One
|
|
70
|
+
* `git ls-files` call, cheap enough for init, upgrade and session start.
|
|
71
|
+
*
|
|
72
|
+
* @param projectRoot - Project root (the directory holding `.cleo/`).
|
|
73
|
+
* @returns The tracked runtime paths relative to `projectRoot`, `not-git`
|
|
74
|
+
* outside a work tree, or `incomplete` when git failed inside one.
|
|
75
|
+
* @task T14549
|
|
76
|
+
*/
|
|
77
|
+
export declare function scanTrackedCleoRuntimeFiles(projectRoot: string): RuntimeGitScan<string[]>;
|
|
78
|
+
/**
|
|
79
|
+
* The `.cleo/` runtime files the project's git index tracks, for the cheap
|
|
80
|
+
* advisory callers (init, upgrade, session start).
|
|
81
|
+
*
|
|
82
|
+
* @param projectRoot - Project root (the directory holding `.cleo/`).
|
|
83
|
+
* @returns Tracked runtime paths relative to `projectRoot`, or `null` when
|
|
84
|
+
* git could not be read (no repository, or a failed read; `cleo doctor`
|
|
85
|
+
* reports the difference).
|
|
86
|
+
* @task T14549
|
|
87
|
+
*/
|
|
88
|
+
export declare function listTrackedCleoRuntimeFiles(projectRoot: string): string[] | null;
|
|
89
|
+
/**
|
|
90
|
+
* One-line warning for init, upgrade and session start when git tracks
|
|
91
|
+
* `.cleo/` runtime files, or `null` when it does not (or git is absent).
|
|
92
|
+
*
|
|
93
|
+
* @param projectRoot - Project root.
|
|
94
|
+
* @returns The warning text, naming the files and the fix.
|
|
95
|
+
* @task T14549
|
|
96
|
+
*/
|
|
97
|
+
export declare function trackedCleoRuntimeWarning(projectRoot: string): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Doctor check: git must track no `.cleo/` runtime file (T14549 AC1).
|
|
100
|
+
*
|
|
101
|
+
* @param projectRoot - Project root.
|
|
102
|
+
* @returns `failed` for a tracked SQLite store file, `warning` for other runtime
|
|
103
|
+
* files, `info` outside git or when git could not be read, else `passed`.
|
|
104
|
+
* @task T14549
|
|
105
|
+
*/
|
|
106
|
+
export declare function checkTrackedCleoRuntime(projectRoot: string): CheckResult;
|
|
107
|
+
/** Outcome of {@link untrackCleoRuntimeFiles}. */
|
|
108
|
+
export interface UntrackCleoRuntimeResult {
|
|
109
|
+
/** `fixed` when paths were untracked, `skipped` when none were tracked, `failed` on a git error. */
|
|
110
|
+
action: 'fixed' | 'skipped' | 'failed';
|
|
111
|
+
/** Paths removed from the index (working files untouched). */
|
|
112
|
+
untracked: string[];
|
|
113
|
+
/** The commit the owner makes to record the untracking, or `null` when nothing changed. */
|
|
114
|
+
commitCommand: string | null;
|
|
115
|
+
/** Human-readable summary. */
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Untrack every `.cleo/` runtime file with `git rm --cached` only (T14549
|
|
120
|
+
* AC2): working files stay byte-identical, `.cleo/.gitignore` is refreshed
|
|
121
|
+
* from the template, and nothing is committed. Idempotent: a second run
|
|
122
|
+
* finds nothing tracked and skips.
|
|
123
|
+
*
|
|
124
|
+
* @param projectRoot - Project root.
|
|
125
|
+
* @returns What was untracked and the commit to make.
|
|
126
|
+
* @task T14549
|
|
127
|
+
*/
|
|
128
|
+
export declare function untrackCleoRuntimeFiles(projectRoot: string): Promise<UntrackCleoRuntimeResult>;
|
|
129
|
+
/** One commit that added a `.cleo/` runtime file. */
|
|
130
|
+
export interface RuntimeFileAddition {
|
|
131
|
+
/** Full commit sha. */
|
|
132
|
+
sha: string;
|
|
133
|
+
/** Committer date (YYYY-MM-DD). */
|
|
134
|
+
date: string;
|
|
135
|
+
/** Commit subject. */
|
|
136
|
+
subject: string;
|
|
137
|
+
/** Runtime paths that commit added, relative to the project root. */
|
|
138
|
+
paths: string[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Git pathspecs that match exactly the `.cleo/` runtime paths: for each deny
|
|
142
|
+
* pattern, the entry itself and anything beneath a directory of that name
|
|
143
|
+
* (gitignore semantics), never the tracked identity files. The managed
|
|
144
|
+
* pre-commit hook embeds this list (a test keeps the two equal), so git, not
|
|
145
|
+
* the shell, matches staged names: no quoting, space or newline in a name can
|
|
146
|
+
* slip past it.
|
|
147
|
+
*
|
|
148
|
+
* @param patterns - Deny patterns. @defaultValue {@link runtimeDenyPatterns}()
|
|
149
|
+
* @returns Pathspecs relative to the project root.
|
|
150
|
+
* @task T14549
|
|
151
|
+
*/
|
|
152
|
+
export declare function runtimePathspecs(patterns?: readonly string[]): string[];
|
|
153
|
+
/**
|
|
154
|
+
* Commits on ANY ref (branches, tags, remotes, stash) that added a `.cleo/`
|
|
155
|
+
* runtime file (T14549 AC6). One `git log --all --diff-filter=A` restricted to
|
|
156
|
+
* the runtime pathspecs. History is reported, never rewritten.
|
|
157
|
+
*
|
|
158
|
+
* @param projectRoot - Project root.
|
|
159
|
+
* @returns The additions, newest first; `not-git` outside a work tree, or
|
|
160
|
+
* `incomplete` when git failed inside one.
|
|
161
|
+
* @task T14549
|
|
162
|
+
*/
|
|
163
|
+
export declare function findRuntimeFileAdditions(projectRoot: string): RuntimeGitScan<RuntimeFileAddition[]>;
|
|
164
|
+
/**
|
|
165
|
+
* Doctor check: git history holds no commit that added a `.cleo/` runtime
|
|
166
|
+
* file. Such a commit is a likely cause of store corruption: checking it out
|
|
167
|
+
* (or any later commit still tracking the file) swaps the live database.
|
|
168
|
+
*
|
|
169
|
+
* @param projectRoot - Project root.
|
|
170
|
+
* @returns `warning` naming the commits, `info` outside git or when git could
|
|
171
|
+
* not be read, else `passed`.
|
|
172
|
+
* @task T14549
|
|
173
|
+
*/
|
|
174
|
+
export declare function checkRuntimeFileHistory(projectRoot: string): CheckResult;
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git tracking of `.cleo/` runtime files (T14549 · ADR-013 §9 · T5158).
|
|
3
|
+
*
|
|
4
|
+
* A project whose git repository tracks `.cleo/cleo.db` (or any other runtime
|
|
5
|
+
* file) corrupts its store on `git checkout` / `git pull`: git replaces the
|
|
6
|
+
* main database file while its `-wal` sidecar stays behind, and SQLite then
|
|
7
|
+
* replays a WAL that belongs to a different database. This module detects
|
|
8
|
+
* such tracking, untracks it losslessly, and finds the commits that added it.
|
|
9
|
+
*
|
|
10
|
+
* The set of runtime files is NOT a second list: it is the EXPLICIT DENY
|
|
11
|
+
* block of the shipped `.cleo/.gitignore` template ({@link getGitignoreContent}),
|
|
12
|
+
* the same rules that keep the files out of git in the first place. The
|
|
13
|
+
* tracked identity files (`project.json`, `project-id`, ADR-094/096) are never
|
|
14
|
+
* runtime files.
|
|
15
|
+
*
|
|
16
|
+
* @task T14549
|
|
17
|
+
*/
|
|
18
|
+
import { execFileSync } from 'node:child_process';
|
|
19
|
+
import { PORTABLE_PROJECT_ID_FILE, PROJECT_MANIFEST_FILE } from '@cleocode/paths';
|
|
20
|
+
import { discoveryEnv } from '../git/work-tree.js';
|
|
21
|
+
import { ensureGitignore, getGitignoreContent } from '../scaffold/ensure-config.js';
|
|
22
|
+
/** Identity files inside `.cleo/` that stay tracked (ADR-094, ADR-096). */
|
|
23
|
+
const TRACKED_IDENTITY_FILES = new Set([
|
|
24
|
+
PROJECT_MANIFEST_FILE,
|
|
25
|
+
PORTABLE_PROJECT_ID_FILE,
|
|
26
|
+
]);
|
|
27
|
+
/** The command `cleo doctor --fix` prints after untracking runtime files. */
|
|
28
|
+
export const UNTRACK_RUNTIME_COMMIT_COMMAND = 'git commit -m "chore: stop tracking .cleo runtime files (ADR-013 §9)"';
|
|
29
|
+
/**
|
|
30
|
+
* The runtime-file patterns: every rule of the EXPLICIT DENY block of a
|
|
31
|
+
* `.cleo/.gitignore` (gitignore syntax, relative to `.cleo/`).
|
|
32
|
+
*
|
|
33
|
+
* @param gitignoreContent - The `.cleo/.gitignore` text. @defaultValue the shipped template
|
|
34
|
+
* @returns The deny patterns in file order; empty when the block is absent.
|
|
35
|
+
* @task T14549
|
|
36
|
+
*/
|
|
37
|
+
export function runtimeDenyPatterns(gitignoreContent = getGitignoreContent()) {
|
|
38
|
+
const patterns = [];
|
|
39
|
+
let inDeny = false;
|
|
40
|
+
for (const raw of gitignoreContent.split('\n')) {
|
|
41
|
+
const line = raw.trim();
|
|
42
|
+
if (/explicit deny/i.test(line)) {
|
|
43
|
+
inDeny = true;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!inDeny || line === '' || line.startsWith('#') || line.startsWith('!'))
|
|
47
|
+
continue;
|
|
48
|
+
patterns.push(line);
|
|
49
|
+
}
|
|
50
|
+
return patterns;
|
|
51
|
+
}
|
|
52
|
+
/** Translate one gitignore glob segment (`*`, `?`) into an anchored regex source. */
|
|
53
|
+
function globSource(glob) {
|
|
54
|
+
return glob
|
|
55
|
+
.split('')
|
|
56
|
+
.map((ch) => ch === '*' ? '[^/]*' : ch === '?' ? '[^/]' : ch.replace(/[.+^${}()|[\]\\]/g, '\\$&'))
|
|
57
|
+
.join('');
|
|
58
|
+
}
|
|
59
|
+
/** Compile gitignore deny patterns into a predicate over `.cleo/`-relative paths. */
|
|
60
|
+
function compileDenyPatterns(patterns) {
|
|
61
|
+
const regexes = patterns.map((pattern) => {
|
|
62
|
+
const dirOnly = pattern.endsWith('/');
|
|
63
|
+
const body = dirOnly ? pattern.slice(0, -1) : pattern;
|
|
64
|
+
// A pattern with an inner slash is anchored to `.cleo/`; one without
|
|
65
|
+
// matches a path segment at any depth (gitignore semantics).
|
|
66
|
+
const anchored = body.includes('/');
|
|
67
|
+
const core = globSource(body.replace(/^\//, ''));
|
|
68
|
+
const prefix = anchored ? '^' : '(^|/)';
|
|
69
|
+
// A directory pattern matches only paths beneath it; a plain pattern
|
|
70
|
+
// matches the entry itself or anything beneath a directory of that name.
|
|
71
|
+
const suffix = dirOnly ? '/' : '(/|$)';
|
|
72
|
+
return new RegExp(`${prefix}${core}${suffix}`);
|
|
73
|
+
});
|
|
74
|
+
return (rel) => regexes.some((re) => re.test(rel));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Whether `path` (relative to the project root, e.g. `.cleo/cleo.db`) is a
|
|
78
|
+
* `.cleo/` runtime file: under `.cleo/`, matched by a deny pattern, and not a
|
|
79
|
+
* tracked identity file.
|
|
80
|
+
*
|
|
81
|
+
* @param path - Project-relative path with forward slashes.
|
|
82
|
+
* @param patterns - Deny patterns. @defaultValue {@link runtimeDenyPatterns}()
|
|
83
|
+
* @returns `true` for a runtime file git must never track.
|
|
84
|
+
* @task T14549
|
|
85
|
+
*/
|
|
86
|
+
export function isCleoRuntimePath(path, patterns = runtimeDenyPatterns()) {
|
|
87
|
+
if (!path.startsWith('.cleo/'))
|
|
88
|
+
return false;
|
|
89
|
+
const rel = path.slice('.cleo/'.length);
|
|
90
|
+
if (TRACKED_IDENTITY_FILES.has(rel))
|
|
91
|
+
return false;
|
|
92
|
+
return compileDenyPatterns(patterns)(rel);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Whether a project-relative path is a SQLite store file or sidecar
|
|
96
|
+
* (`*.db`, `*.db-wal`, `*.db-shm`, `*.db-journal`), the files whose tracking
|
|
97
|
+
* corrupts the store on checkout.
|
|
98
|
+
*
|
|
99
|
+
* @param path - Project-relative path.
|
|
100
|
+
* @returns `true` for a SQLite database file or sidecar.
|
|
101
|
+
* @task T14549
|
|
102
|
+
*/
|
|
103
|
+
export function isSqliteStorePath(path) {
|
|
104
|
+
return /\.db(-wal|-shm|-journal)?$/.test(path);
|
|
105
|
+
}
|
|
106
|
+
/** Run git in `cwd` with no ambient repo variables. Never throws. */
|
|
107
|
+
function runGit(cwd, args) {
|
|
108
|
+
try {
|
|
109
|
+
const out = execFileSync('git', ['-c', 'core.quotePath=false', ...args], {
|
|
110
|
+
cwd,
|
|
111
|
+
encoding: 'utf-8',
|
|
112
|
+
env: discoveryEnv(),
|
|
113
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
114
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
115
|
+
});
|
|
116
|
+
return { ok: true, out };
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
const stderr = err instanceof Error && 'stderr' in err && typeof err.stderr === 'string' ? err.stderr : '';
|
|
120
|
+
const first = (stderr.trim() || (err instanceof Error ? err.message : String(err))).split('\n')[0];
|
|
121
|
+
return { ok: false, error: first ?? 'git failed' };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Classify a failed git read. Only git's own verdict counts as "no
|
|
126
|
+
* repository": `rev-parse` failing with `not a git repository`, or reporting
|
|
127
|
+
* that `cwd` is not inside a work tree. Any other failure (an invalid config,
|
|
128
|
+
* a corrupt index, a missing git binary) is `incomplete`: coverage is
|
|
129
|
+
* missing, never a clean result.
|
|
130
|
+
*/
|
|
131
|
+
function failedScan(cwd, error) {
|
|
132
|
+
const probe = runGit(cwd, ['rev-parse', '--is-inside-work-tree']);
|
|
133
|
+
if (probe.ok) {
|
|
134
|
+
return probe.out.trim() === 'true' ? { state: 'incomplete', error } : { state: 'not-git' };
|
|
135
|
+
}
|
|
136
|
+
return /not a git repository/i.test(probe.error)
|
|
137
|
+
? { state: 'not-git' }
|
|
138
|
+
: { state: 'incomplete', error: probe.error || error };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The `.cleo/` runtime files the project's git index tracks. One
|
|
142
|
+
* `git ls-files` call, cheap enough for init, upgrade and session start.
|
|
143
|
+
*
|
|
144
|
+
* @param projectRoot - Project root (the directory holding `.cleo/`).
|
|
145
|
+
* @returns The tracked runtime paths relative to `projectRoot`, `not-git`
|
|
146
|
+
* outside a work tree, or `incomplete` when git failed inside one.
|
|
147
|
+
* @task T14549
|
|
148
|
+
*/
|
|
149
|
+
export function scanTrackedCleoRuntimeFiles(projectRoot) {
|
|
150
|
+
const r = runGit(projectRoot, ['ls-files', '-z', '--', '.cleo']);
|
|
151
|
+
if (!r.ok)
|
|
152
|
+
return failedScan(projectRoot, r.error);
|
|
153
|
+
const patterns = runtimeDenyPatterns();
|
|
154
|
+
return {
|
|
155
|
+
state: 'ok',
|
|
156
|
+
value: r.out.split('\0').filter((path) => path !== '' && isCleoRuntimePath(path, patterns)),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The `.cleo/` runtime files the project's git index tracks, for the cheap
|
|
161
|
+
* advisory callers (init, upgrade, session start).
|
|
162
|
+
*
|
|
163
|
+
* @param projectRoot - Project root (the directory holding `.cleo/`).
|
|
164
|
+
* @returns Tracked runtime paths relative to `projectRoot`, or `null` when
|
|
165
|
+
* git could not be read (no repository, or a failed read; `cleo doctor`
|
|
166
|
+
* reports the difference).
|
|
167
|
+
* @task T14549
|
|
168
|
+
*/
|
|
169
|
+
export function listTrackedCleoRuntimeFiles(projectRoot) {
|
|
170
|
+
const scan = scanTrackedCleoRuntimeFiles(projectRoot);
|
|
171
|
+
return scan.state === 'ok' ? scan.value : null;
|
|
172
|
+
}
|
|
173
|
+
/** `info` result for a check whose git read failed inside a real repository. */
|
|
174
|
+
function incompleteResult(id, what, error) {
|
|
175
|
+
return {
|
|
176
|
+
id,
|
|
177
|
+
category: 'configuration',
|
|
178
|
+
status: 'info',
|
|
179
|
+
message: `Check incomplete: git could not read ${what} (${error}); this is not proof that no ` +
|
|
180
|
+
'.cleo runtime file is tracked',
|
|
181
|
+
details: { incomplete: true, error },
|
|
182
|
+
fix: null,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* One-line warning for init, upgrade and session start when git tracks
|
|
187
|
+
* `.cleo/` runtime files, or `null` when it does not (or git is absent).
|
|
188
|
+
*
|
|
189
|
+
* @param projectRoot - Project root.
|
|
190
|
+
* @returns The warning text, naming the files and the fix.
|
|
191
|
+
* @task T14549
|
|
192
|
+
*/
|
|
193
|
+
export function trackedCleoRuntimeWarning(projectRoot) {
|
|
194
|
+
const tracked = listTrackedCleoRuntimeFiles(projectRoot);
|
|
195
|
+
if (!tracked || tracked.length === 0)
|
|
196
|
+
return null;
|
|
197
|
+
return (`git tracks ${tracked.length} .cleo runtime file(s) (${tracked.join(', ')}); a checkout or ` +
|
|
198
|
+
'pull overwrites them, and for the SQLite store that replaces the live database while ' +
|
|
199
|
+
'its WAL stays behind (ADR-013 §9). Fix: cleo doctor --fix (untracks them with git rm ' +
|
|
200
|
+
'--cached; files stay on disk)');
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Doctor check: git must track no `.cleo/` runtime file (T14549 AC1).
|
|
204
|
+
*
|
|
205
|
+
* @param projectRoot - Project root.
|
|
206
|
+
* @returns `failed` for a tracked SQLite store file, `warning` for other runtime
|
|
207
|
+
* files, `info` outside git or when git could not be read, else `passed`.
|
|
208
|
+
* @task T14549
|
|
209
|
+
*/
|
|
210
|
+
export function checkTrackedCleoRuntime(projectRoot) {
|
|
211
|
+
const scan = scanTrackedCleoRuntimeFiles(projectRoot);
|
|
212
|
+
if (scan.state === 'incomplete') {
|
|
213
|
+
return incompleteResult('tracked_cleo_runtime', 'the index', scan.error);
|
|
214
|
+
}
|
|
215
|
+
if (scan.state === 'not-git') {
|
|
216
|
+
return {
|
|
217
|
+
id: 'tracked_cleo_runtime',
|
|
218
|
+
category: 'configuration',
|
|
219
|
+
status: 'info',
|
|
220
|
+
message: 'Not a git repository (skipping tracked .cleo runtime file check)',
|
|
221
|
+
details: {},
|
|
222
|
+
fix: null,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const tracked = scan.value;
|
|
226
|
+
if (tracked.length > 0) {
|
|
227
|
+
const sqlite = tracked.filter(isSqliteStorePath);
|
|
228
|
+
const other = tracked.filter((path) => !isSqliteStorePath(path));
|
|
229
|
+
// SQLite store files and sidecars corrupt the store on checkout; other
|
|
230
|
+
// runtime files (config, logs, metrics) lose local state but cannot
|
|
231
|
+
// desynchronize a WAL, so they warn.
|
|
232
|
+
const parts = [];
|
|
233
|
+
if (sqlite.length > 0) {
|
|
234
|
+
parts.push(`git tracks ${sqlite.length} .cleo SQLite store file(s): ${sqlite.join(', ')}. A ` +
|
|
235
|
+
'checkout or pull can replace the live database while its WAL stays behind and ' +
|
|
236
|
+
'corrupt the store (ADR-013 §9, T5158)');
|
|
237
|
+
}
|
|
238
|
+
if (other.length > 0) {
|
|
239
|
+
parts.push(`git tracks ${other.length} other .cleo runtime file(s): ${other.join(', ')}. A ` +
|
|
240
|
+
'checkout or pull overwrites this local runtime state');
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
id: 'tracked_cleo_runtime',
|
|
244
|
+
category: 'configuration',
|
|
245
|
+
status: sqlite.length > 0 ? 'failed' : 'warning',
|
|
246
|
+
message: parts.join('. '),
|
|
247
|
+
details: { tracked, sqlite, other },
|
|
248
|
+
fix: 'cleo doctor --fix',
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
id: 'tracked_cleo_runtime',
|
|
253
|
+
category: 'configuration',
|
|
254
|
+
status: 'passed',
|
|
255
|
+
message: 'git tracks no .cleo runtime file',
|
|
256
|
+
details: {},
|
|
257
|
+
fix: null,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Untrack every `.cleo/` runtime file with `git rm --cached` only (T14549
|
|
262
|
+
* AC2): working files stay byte-identical, `.cleo/.gitignore` is refreshed
|
|
263
|
+
* from the template, and nothing is committed. Idempotent: a second run
|
|
264
|
+
* finds nothing tracked and skips.
|
|
265
|
+
*
|
|
266
|
+
* @param projectRoot - Project root.
|
|
267
|
+
* @returns What was untracked and the commit to make.
|
|
268
|
+
* @task T14549
|
|
269
|
+
*/
|
|
270
|
+
export async function untrackCleoRuntimeFiles(projectRoot) {
|
|
271
|
+
const scan = scanTrackedCleoRuntimeFiles(projectRoot);
|
|
272
|
+
if (scan.state === 'incomplete') {
|
|
273
|
+
return {
|
|
274
|
+
action: 'failed',
|
|
275
|
+
untracked: [],
|
|
276
|
+
commitCommand: null,
|
|
277
|
+
message: `git could not read the index (${scan.error}); nothing was untracked`,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
const tracked = scan.state === 'ok' ? scan.value : [];
|
|
281
|
+
if (tracked.length === 0) {
|
|
282
|
+
return {
|
|
283
|
+
action: 'skipped',
|
|
284
|
+
untracked: [],
|
|
285
|
+
commitCommand: null,
|
|
286
|
+
message: 'git tracks no .cleo runtime file',
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
// The deny rules must be in place before untracking, or the next
|
|
290
|
+
// `git add -A` stages the files again.
|
|
291
|
+
await ensureGitignore(projectRoot, { checkoutOnly: true });
|
|
292
|
+
// Batched to stay under the argument-length limit on large backup trees.
|
|
293
|
+
for (let i = 0; i < tracked.length; i += 500) {
|
|
294
|
+
const batch = tracked.slice(i, i + 500);
|
|
295
|
+
const removed = runGit(projectRoot, [
|
|
296
|
+
'rm',
|
|
297
|
+
'--cached',
|
|
298
|
+
'-q',
|
|
299
|
+
'--ignore-unmatch',
|
|
300
|
+
'--',
|
|
301
|
+
...batch,
|
|
302
|
+
]);
|
|
303
|
+
if (!removed.ok) {
|
|
304
|
+
return {
|
|
305
|
+
action: 'failed',
|
|
306
|
+
untracked: tracked.slice(0, i),
|
|
307
|
+
commitCommand: i > 0 ? UNTRACK_RUNTIME_COMMIT_COMMAND : null,
|
|
308
|
+
message: `git rm --cached failed (${removed.error}) for: ${batch.join(', ')}`,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
action: 'fixed',
|
|
314
|
+
untracked: tracked,
|
|
315
|
+
commitCommand: UNTRACK_RUNTIME_COMMIT_COMMAND,
|
|
316
|
+
message: `untracked ${tracked.length} .cleo runtime file(s) with git rm --cached (files kept on ` +
|
|
317
|
+
`disk): ${tracked.join(', ')}. Commit it: ${UNTRACK_RUNTIME_COMMIT_COMMAND}. Each ` +
|
|
318
|
+
'other clone runs cleo backup add before pulling that commit: a pull deletes a removed ' +
|
|
319
|
+
'file whose local copy still matches the old commit',
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Git pathspecs that match exactly the `.cleo/` runtime paths: for each deny
|
|
324
|
+
* pattern, the entry itself and anything beneath a directory of that name
|
|
325
|
+
* (gitignore semantics), never the tracked identity files. The managed
|
|
326
|
+
* pre-commit hook embeds this list (a test keeps the two equal), so git, not
|
|
327
|
+
* the shell, matches staged names: no quoting, space or newline in a name can
|
|
328
|
+
* slip past it.
|
|
329
|
+
*
|
|
330
|
+
* @param patterns - Deny patterns. @defaultValue {@link runtimeDenyPatterns}()
|
|
331
|
+
* @returns Pathspecs relative to the project root.
|
|
332
|
+
* @task T14549
|
|
333
|
+
*/
|
|
334
|
+
export function runtimePathspecs(patterns = runtimeDenyPatterns()) {
|
|
335
|
+
const specs = patterns.flatMap((pattern) => {
|
|
336
|
+
const dirOnly = pattern.endsWith('/');
|
|
337
|
+
const body = (dirOnly ? pattern.slice(0, -1) : pattern).replace(/^\//, '');
|
|
338
|
+
const base = body.includes('/') ? `.cleo/${body}` : `.cleo/**/${body}`;
|
|
339
|
+
return dirOnly ? [`:(glob)${base}/**`] : [`:(glob)${base}`, `:(glob)${base}/**`];
|
|
340
|
+
});
|
|
341
|
+
const identity = [...TRACKED_IDENTITY_FILES].map((name) => `:(exclude,literal).cleo/${name}`);
|
|
342
|
+
return [...specs, ...identity];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Commits on ANY ref (branches, tags, remotes, stash) that added a `.cleo/`
|
|
346
|
+
* runtime file (T14549 AC6). One `git log --all --diff-filter=A` restricted to
|
|
347
|
+
* the runtime pathspecs. History is reported, never rewritten.
|
|
348
|
+
*
|
|
349
|
+
* @param projectRoot - Project root.
|
|
350
|
+
* @returns The additions, newest first; `not-git` outside a work tree, or
|
|
351
|
+
* `incomplete` when git failed inside one.
|
|
352
|
+
* @task T14549
|
|
353
|
+
*/
|
|
354
|
+
export function findRuntimeFileAdditions(projectRoot) {
|
|
355
|
+
const patterns = runtimeDenyPatterns();
|
|
356
|
+
const r = runGit(projectRoot, [
|
|
357
|
+
'log',
|
|
358
|
+
'--all',
|
|
359
|
+
'--diff-filter=A',
|
|
360
|
+
'--relative',
|
|
361
|
+
'--name-only',
|
|
362
|
+
'-z',
|
|
363
|
+
'--format=%x01%H%x09%cs%x09%s',
|
|
364
|
+
'--',
|
|
365
|
+
...runtimePathspecs(patterns),
|
|
366
|
+
]);
|
|
367
|
+
if (!r.ok)
|
|
368
|
+
return failedScan(projectRoot, r.error);
|
|
369
|
+
const additions = [];
|
|
370
|
+
for (const record of r.out.split('\x01')) {
|
|
371
|
+
if (record.trim() === '')
|
|
372
|
+
continue;
|
|
373
|
+
const [header = '', ...rest] = record.split('\n');
|
|
374
|
+
const [sha = '', date = '', subject = ''] = header.split('\t');
|
|
375
|
+
const paths = rest
|
|
376
|
+
.join('\n')
|
|
377
|
+
.split('\0')
|
|
378
|
+
.map((p) => p.trim())
|
|
379
|
+
.filter((p) => p !== '' && isCleoRuntimePath(p, patterns));
|
|
380
|
+
if (sha && paths.length > 0)
|
|
381
|
+
additions.push({ sha, date, subject, paths });
|
|
382
|
+
}
|
|
383
|
+
return { state: 'ok', value: additions };
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Doctor check: git history holds no commit that added a `.cleo/` runtime
|
|
387
|
+
* file. Such a commit is a likely cause of store corruption: checking it out
|
|
388
|
+
* (or any later commit still tracking the file) swaps the live database.
|
|
389
|
+
*
|
|
390
|
+
* @param projectRoot - Project root.
|
|
391
|
+
* @returns `warning` naming the commits, `info` outside git or when git could
|
|
392
|
+
* not be read, else `passed`.
|
|
393
|
+
* @task T14549
|
|
394
|
+
*/
|
|
395
|
+
export function checkRuntimeFileHistory(projectRoot) {
|
|
396
|
+
const scan = findRuntimeFileAdditions(projectRoot);
|
|
397
|
+
if (scan.state === 'incomplete') {
|
|
398
|
+
return incompleteResult('cleo_runtime_history', 'the history', scan.error);
|
|
399
|
+
}
|
|
400
|
+
if (scan.state === 'not-git') {
|
|
401
|
+
return {
|
|
402
|
+
id: 'cleo_runtime_history',
|
|
403
|
+
category: 'configuration',
|
|
404
|
+
status: 'info',
|
|
405
|
+
message: 'Not a git repository (skipping .cleo runtime history check)',
|
|
406
|
+
details: {},
|
|
407
|
+
fix: null,
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
const additions = scan.value;
|
|
411
|
+
if (additions.length > 0) {
|
|
412
|
+
const shown = additions
|
|
413
|
+
.slice(0, 5)
|
|
414
|
+
.map((a) => `${a.sha.slice(0, 12)} ${a.date} (${a.paths.join(', ')})`)
|
|
415
|
+
.join('; ');
|
|
416
|
+
return {
|
|
417
|
+
id: 'cleo_runtime_history',
|
|
418
|
+
category: 'configuration',
|
|
419
|
+
status: 'warning',
|
|
420
|
+
message: `git history (all refs) has ${additions.length} commit(s) that added .cleo runtime files: ${shown}` +
|
|
421
|
+
`${additions.length > 5 ? '; …' : ''}. A likely cause of store corruption: checking out ` +
|
|
422
|
+
'such a commit replaces the live database while its WAL stays behind. History is ' +
|
|
423
|
+
'reported, not rewritten',
|
|
424
|
+
details: { additions },
|
|
425
|
+
fix: null,
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
id: 'cleo_runtime_history',
|
|
430
|
+
category: 'configuration',
|
|
431
|
+
status: 'passed',
|
|
432
|
+
message: 'No commit on any ref added a .cleo runtime file',
|
|
433
|
+
details: {},
|
|
434
|
+
fix: null,
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
//# sourceMappingURL=cleo-runtime-tracking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleo-runtime-tracking.js","sourceRoot":"","sources":["../../src/doctor/cleo-runtime-tracking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEpF,2EAA2E;AAC3E,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IAC1D,qBAAqB;IACrB,wBAAwB;CACzB,CAAC,CAAC;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GACzC,uEAAuE,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,mBAA2B,mBAAmB,EAAE;IAClF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,KAAK,MAAM,GAAG,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,MAAM,GAAG,IAA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