@cleocode/core 2026.9.16 → 2026.9.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/changesets/parser.d.ts.map +1 -1
- package/dist/changesets/parser.js +67 -0
- package/dist/changesets/parser.js.map +1 -1
- package/dist/crypto/credentials.d.ts +128 -26
- package/dist/crypto/credentials.d.ts.map +1 -1
- package/dist/crypto/credentials.js +183 -142
- package/dist/crypto/credentials.js.map +1 -1
- package/dist/docs/export-document.js +14705 -12949
- package/dist/docs/export-document.js.map +3 -3
- package/dist/doctor/index.d.ts +1 -1
- package/dist/doctor/index.d.ts.map +1 -1
- package/dist/doctor/index.js +1 -1
- package/dist/doctor/index.js.map +1 -1
- package/dist/doctor/nexus-schema-residency.d.ts +1 -1
- package/dist/doctor/nexus-schema-residency.d.ts.map +1 -1
- package/dist/doctor/nexus-schema-residency.js +1 -0
- package/dist/doctor/nexus-schema-residency.js.map +1 -1
- package/dist/doctor/project-identity.d.ts +124 -0
- package/dist/doctor/project-identity.d.ts.map +1 -0
- package/dist/doctor/project-identity.js +307 -0
- package/dist/doctor/project-identity.js.map +1 -0
- package/dist/doctor/superseded-store.d.ts +8 -0
- package/dist/doctor/superseded-store.d.ts.map +1 -1
- package/dist/doctor/superseded-store.js +48 -3
- package/dist/doctor/superseded-store.js.map +1 -1
- package/dist/init.d.ts +7 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +17 -2
- package/dist/init.js.map +1 -1
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -2
- package/dist/internal.js.map +1 -1
- package/dist/llm/credentials-store.d.ts +10 -0
- package/dist/llm/credentials-store.d.ts.map +1 -1
- package/dist/llm/credentials-store.js +7 -1
- package/dist/llm/credentials-store.js.map +1 -1
- package/dist/llm/plugin-facade.js +13368 -1550
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/nexus/analyze-orchestrator.d.ts +20 -3
- package/dist/nexus/analyze-orchestrator.d.ts.map +1 -1
- package/dist/nexus/analyze-orchestrator.js +159 -10
- package/dist/nexus/analyze-orchestrator.js.map +1 -1
- package/dist/nexus/assessment-store.d.ts +57 -0
- package/dist/nexus/assessment-store.d.ts.map +1 -0
- package/dist/nexus/assessment-store.js +73 -0
- package/dist/nexus/assessment-store.js.map +1 -0
- package/dist/nexus/freshness.d.ts +131 -0
- package/dist/nexus/freshness.d.ts.map +1 -0
- package/dist/nexus/freshness.js +391 -0
- package/dist/nexus/freshness.js.map +1 -0
- package/dist/nexus/graph-manifest.d.ts +88 -0
- package/dist/nexus/graph-manifest.d.ts.map +1 -0
- package/dist/nexus/graph-manifest.js +114 -0
- package/dist/nexus/graph-manifest.js.map +1 -0
- package/dist/nexus/knowledge.d.ts +21 -1
- package/dist/nexus/knowledge.d.ts.map +1 -1
- package/dist/nexus/knowledge.js +76 -37
- package/dist/nexus/knowledge.js.map +1 -1
- package/dist/nexus/path-map.d.ts +55 -0
- package/dist/nexus/path-map.d.ts.map +1 -0
- package/dist/nexus/path-map.js +87 -0
- package/dist/nexus/path-map.js.map +1 -0
- package/dist/nexus/projects-clean.d.ts +21 -28
- package/dist/nexus/projects-clean.d.ts.map +1 -1
- package/dist/nexus/projects-clean.js +168 -85
- package/dist/nexus/projects-clean.js.map +1 -1
- package/dist/nexus/query.d.ts.map +1 -1
- package/dist/nexus/query.js +3 -2
- package/dist/nexus/query.js.map +1 -1
- package/dist/nexus/registry-hygiene.d.ts +70 -0
- package/dist/nexus/registry-hygiene.d.ts.map +1 -0
- package/dist/nexus/registry-hygiene.js +113 -0
- package/dist/nexus/registry-hygiene.js.map +1 -0
- package/dist/nexus/registry.d.ts +2 -2
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +48 -12
- package/dist/nexus/registry.js.map +1 -1
- package/dist/paths.d.ts +26 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +99 -6
- package/dist/paths.js.map +1 -1
- package/dist/render/nexus/graph/index.d.ts.map +1 -1
- package/dist/render/nexus/graph/index.js +8 -0
- package/dist/render/nexus/graph/index.js.map +1 -1
- package/dist/scaffold/ensure-config.d.ts +12 -3
- package/dist/scaffold/ensure-config.d.ts.map +1 -1
- package/dist/scaffold/ensure-config.js +61 -38
- package/dist/scaffold/ensure-config.js.map +1 -1
- package/dist/scaffold/project-identity.d.ts +136 -0
- package/dist/scaffold/project-identity.d.ts.map +1 -0
- package/dist/scaffold/project-identity.js +225 -0
- package/dist/scaffold/project-identity.js.map +1 -0
- package/dist/selfimprove/fix-gen.js +13319 -1556
- package/dist/selfimprove/fix-gen.js.map +3 -3
- package/dist/store/agent-api-key.d.ts +114 -0
- package/dist/store/agent-api-key.d.ts.map +1 -0
- package/dist/store/agent-api-key.js +136 -0
- package/dist/store/agent-api-key.js.map +1 -0
- package/dist/store/agent-registry-accessor.d.ts +4 -2
- package/dist/store/agent-registry-accessor.d.ts.map +1 -1
- package/dist/store/agent-registry-accessor.js +39 -89
- package/dist/store/agent-registry-accessor.js.map +1 -1
- package/dist/store/api-key-kdf.d.ts +7 -0
- package/dist/store/api-key-kdf.d.ts.map +1 -1
- package/dist/store/api-key-kdf.js +7 -0
- package/dist/store/api-key-kdf.js.map +1 -1
- package/dist/store/backup-crypto.d.ts +49 -0
- package/dist/store/backup-crypto.d.ts.map +1 -1
- package/dist/store/backup-crypto.js +154 -0
- package/dist/store/backup-crypto.js.map +1 -1
- package/dist/store/credential-transfer.d.ts +303 -0
- package/dist/store/credential-transfer.d.ts.map +1 -0
- package/dist/store/credential-transfer.js +774 -0
- package/dist/store/credential-transfer.js.map +1 -0
- package/dist/store/exodus/column-transforms.d.ts +79 -4
- package/dist/store/exodus/column-transforms.d.ts.map +1 -1
- package/dist/store/exodus/column-transforms.js +121 -4
- package/dist/store/exodus/column-transforms.js.map +1 -1
- package/dist/store/exodus/index.d.ts +1 -0
- package/dist/store/exodus/index.d.ts.map +1 -1
- package/dist/store/exodus/index.js +1 -0
- package/dist/store/exodus/index.js.map +1 -1
- package/dist/store/exodus/migrate.d.ts +17 -1
- package/dist/store/exodus/migrate.d.ts.map +1 -1
- package/dist/store/exodus/migrate.js +155 -33
- package/dist/store/exodus/migrate.js.map +1 -1
- package/dist/store/exodus/on-open.d.ts +14 -0
- package/dist/store/exodus/on-open.d.ts.map +1 -1
- package/dist/store/exodus/on-open.js +115 -6
- package/dist/store/exodus/on-open.js.map +1 -1
- package/dist/store/exodus/reconcile.d.ts +103 -0
- package/dist/store/exodus/reconcile.d.ts.map +1 -0
- package/dist/store/exodus/reconcile.js +728 -0
- package/dist/store/exodus/reconcile.js.map +1 -0
- package/dist/store/exodus/recovery.d.ts.map +1 -1
- package/dist/store/exodus/recovery.js +14 -2
- package/dist/store/exodus/recovery.js.map +1 -1
- package/dist/store/exodus/runtime-targets.d.ts +39 -0
- package/dist/store/exodus/runtime-targets.d.ts.map +1 -0
- package/dist/store/exodus/runtime-targets.js +63 -0
- package/dist/store/exodus/runtime-targets.js.map +1 -0
- package/dist/store/exodus/table-name-map.d.ts.map +1 -1
- package/dist/store/exodus/table-name-map.js +5 -0
- package/dist/store/exodus/table-name-map.js.map +1 -1
- package/dist/store/exodus/table-order.d.ts +35 -0
- package/dist/store/exodus/table-order.d.ts.map +1 -0
- package/dist/store/exodus/table-order.js +62 -0
- package/dist/store/exodus/table-order.js.map +1 -0
- package/dist/store/exodus/verify-migration.d.ts +4 -1
- package/dist/store/exodus/verify-migration.d.ts.map +1 -1
- package/dist/store/exodus/verify-migration.js +142 -10
- package/dist/store/exodus/verify-migration.js.map +1 -1
- package/dist/store/global-salt.d.ts +16 -0
- package/dist/store/global-salt.d.ts.map +1 -1
- package/dist/store/global-salt.js +22 -7
- package/dist/store/global-salt.js.map +1 -1
- package/dist/store/legacy-tasks-lineage.d.ts +86 -0
- package/dist/store/legacy-tasks-lineage.d.ts.map +1 -0
- package/dist/store/legacy-tasks-lineage.js +285 -0
- package/dist/store/legacy-tasks-lineage.js.map +1 -0
- package/dist/store/migration-manager.d.ts +27 -0
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +63 -0
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/portable-bundle-import.d.ts +117 -0
- package/dist/store/portable-bundle-import.d.ts.map +1 -0
- package/dist/store/portable-bundle-import.js +589 -0
- package/dist/store/portable-bundle-import.js.map +1 -0
- package/dist/store/portable-bundle-relocate.d.ts +66 -0
- package/dist/store/portable-bundle-relocate.d.ts.map +1 -0
- package/dist/store/portable-bundle-relocate.js +304 -0
- package/dist/store/portable-bundle-relocate.js.map +1 -0
- package/dist/store/portable-bundle-scan.d.ts +167 -0
- package/dist/store/portable-bundle-scan.d.ts.map +1 -0
- package/dist/store/portable-bundle-scan.js +569 -0
- package/dist/store/portable-bundle-scan.js.map +1 -0
- package/dist/store/portable-bundle.d.ts +146 -0
- package/dist/store/portable-bundle.d.ts.map +1 -0
- package/dist/store/portable-bundle.js +674 -0
- package/dist/store/portable-bundle.js.map +1 -0
- package/dist/store/regenerators.d.ts +3 -1
- package/dist/store/regenerators.d.ts.map +1 -1
- package/dist/store/regenerators.js +6 -2
- package/dist/store/regenerators.js.map +1 -1
- package/dist/store/schema/cleo-global/nexus.d.ts +98 -0
- package/dist/store/schema/cleo-global/nexus.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/nexus.js +19 -0
- package/dist/store/schema/cleo-global/nexus.js.map +1 -1
- package/dist/store/schema/nexus-schema.d.ts +102 -0
- package/dist/store/schema/nexus-schema.d.ts.map +1 -1
- package/dist/store/schema/nexus-schema.js +24 -0
- package/dist/store/schema/nexus-schema.js.map +1 -1
- package/dist/store/split-brain-import.d.ts +176 -0
- package/dist/store/split-brain-import.d.ts.map +1 -0
- package/dist/store/split-brain-import.js +680 -0
- package/dist/store/split-brain-import.js.map +1 -0
- package/dist/store/sqlite.d.ts +29 -0
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +57 -5
- package/dist/store/sqlite.js.map +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +30 -5
- package/dist/system/health.js.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +60 -0
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/doctor/checks.d.ts +14 -0
- package/dist/validation/doctor/checks.d.ts.map +1 -1
- package/dist/validation/doctor/checks.js +33 -0
- package/dist/validation/doctor/checks.js.map +1 -1
- package/migrations/drizzle-cleo-global/20260924000000_t12354-project-paths/migration.sql +40 -0
- package/migrations/drizzle-nexus/20260924000000_t12315-nexus-parse-cache/migration.sql +21 -0
- package/package.json +13 -13
- package/templates/CLEO-INJECTION.md +3 -3
- package/templates/cleo-gitignore +7 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* portable-bundle-relocate.ts — rewrite a restored project's absolute paths
|
|
3
|
+
* from its old root to its new root, and report every absolute path it
|
|
4
|
+
* deliberately left alone.
|
|
5
|
+
*
|
|
6
|
+
* Rewrites are limited to STRUCTURAL locators: path-named columns and
|
|
7
|
+
* path-named keys inside `*_json` columns. Historical records (audit logs,
|
|
8
|
+
* observations, narratives, captured tool output, task text) are reported
|
|
9
|
+
* but never edited: rewriting them would falsify history and invalidate
|
|
10
|
+
* content hashes and signatures computed over the original text.
|
|
11
|
+
*
|
|
12
|
+
* Operates on a staged copy BEFORE it is placed, so a failed relocation
|
|
13
|
+
* never leaves a half-rewritten live store.
|
|
14
|
+
*
|
|
15
|
+
* @task T12318
|
|
16
|
+
* @epic T12317
|
|
17
|
+
* @module store/portable-bundle-relocate
|
|
18
|
+
*/
|
|
19
|
+
import type { PortableRelocationReport } from '@cleocode/contracts';
|
|
20
|
+
/**
|
|
21
|
+
* True when `value` is `root` or lies under it (path-boundary aware, so
|
|
22
|
+
* `/a/b` does not match `/a/bc`).
|
|
23
|
+
*
|
|
24
|
+
* @param value - Candidate path.
|
|
25
|
+
* @param root - Root path.
|
|
26
|
+
* @returns Whether `value` is at or under `root`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isUnderRoot(value: string, root: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Replace the `from` prefix of a path with `to` (boundary aware).
|
|
31
|
+
*
|
|
32
|
+
* @param value - Path under `from`.
|
|
33
|
+
* @param from - Old root.
|
|
34
|
+
* @param to - New root.
|
|
35
|
+
* @returns The relocated path.
|
|
36
|
+
*/
|
|
37
|
+
export declare function relocatePath(value: string, from: string, to: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Relocate one SQLite database from `from` to `to`.
|
|
40
|
+
*
|
|
41
|
+
* @param dbPath - Staged database (modified in place).
|
|
42
|
+
* @param dbLabel - Label used in finding locations (e.g. `cleo.db`).
|
|
43
|
+
* @param from - Old project root.
|
|
44
|
+
* @param to - New project root.
|
|
45
|
+
* @param report - Report to append to.
|
|
46
|
+
*/
|
|
47
|
+
export declare function relocateDatabase(dbPath: string, dbLabel: string, from: string, to: string, report: PortableRelocationReport): void;
|
|
48
|
+
/**
|
|
49
|
+
* Relocate the staged `.cleo/` files of one project and report text files that
|
|
50
|
+
* still mention the old root.
|
|
51
|
+
*
|
|
52
|
+
* - `project-info.json`: `projectHash` is recomputed for the new root (it is a
|
|
53
|
+
* path fingerprint; `projectId` is the stable identity and is kept).
|
|
54
|
+
* - `config.json`, `project-context.json`, `worktrees.json`: string values that
|
|
55
|
+
* are absolute paths under the old root are rewritten. Paths embedded inside
|
|
56
|
+
* prose strings are left and reported.
|
|
57
|
+
* - Every other text file mentioning the old root is reported, not edited.
|
|
58
|
+
*
|
|
59
|
+
* @param stagedCleoDir - Staged copy of the project's `.cleo/` directory.
|
|
60
|
+
* @param relPaths - Relative paths of the staged regular files.
|
|
61
|
+
* @param from - Old project root.
|
|
62
|
+
* @param to - New project root.
|
|
63
|
+
* @param report - Report to append to.
|
|
64
|
+
*/
|
|
65
|
+
export declare function relocateProjectFiles(stagedCleoDir: string, relPaths: readonly string[], from: string, to: string, report: PortableRelocationReport): void;
|
|
66
|
+
//# sourceMappingURL=portable-bundle-relocate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-bundle-relocate.d.ts","sourceRoot":"","sources":["../../src/store/portable-bundle-relocate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,KAAK,EAAuB,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAuBzF;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAE5E;AA8DD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,wBAAwB,GAC/B,IAAI,CA8FN;AAsCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,wBAAwB,GAC/B,IAAI,CAkDN"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* portable-bundle-relocate.ts — rewrite a restored project's absolute paths
|
|
3
|
+
* from its old root to its new root, and report every absolute path it
|
|
4
|
+
* deliberately left alone.
|
|
5
|
+
*
|
|
6
|
+
* Rewrites are limited to STRUCTURAL locators: path-named columns and
|
|
7
|
+
* path-named keys inside `*_json` columns. Historical records (audit logs,
|
|
8
|
+
* observations, narratives, captured tool output, task text) are reported
|
|
9
|
+
* but never edited: rewriting them would falsify history and invalidate
|
|
10
|
+
* content hashes and signatures computed over the original text.
|
|
11
|
+
*
|
|
12
|
+
* Operates on a staged copy BEFORE it is placed, so a failed relocation
|
|
13
|
+
* never leaves a half-rewritten live store.
|
|
14
|
+
*
|
|
15
|
+
* @task T12318
|
|
16
|
+
* @epic T12317
|
|
17
|
+
* @module store/portable-bundle-relocate
|
|
18
|
+
*/
|
|
19
|
+
import fs from 'node:fs';
|
|
20
|
+
import { createRequire } from 'node:module';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import { generateProjectHash } from '../nexus/hash.js';
|
|
23
|
+
const _require = createRequire(import.meta.url);
|
|
24
|
+
const { DatabaseSync } = _require('node:sqlite');
|
|
25
|
+
/** Column names that hold a single filesystem locator. */
|
|
26
|
+
const PATH_COLUMN = /(^|_)(path|cwd|root|dir)$/i;
|
|
27
|
+
/** Keys inside JSON columns that hold a filesystem locator. */
|
|
28
|
+
const PATH_JSON_KEY = /^(path|filePath|projectRoot|projectPath|root|cwd|worktreePath|worktreeRoot|gitRoot|cleoDir|dir|brainDbPath|tasksDbPath)$/;
|
|
29
|
+
/** Tables whose rows are historical record — reported, never rewritten. */
|
|
30
|
+
const HISTORICAL_TABLE = /(audit|_log$|history|_events?$|narrative|transcript|observation|journal|backfill|background_jobs|handoff|retrieval|usage)/i;
|
|
31
|
+
/** Columns holding captured text or evidence — reported, never rewritten. */
|
|
32
|
+
const HISTORICAL_COLUMN = /(verification|narrative|details|stdout|output|text|description|notes|title|summary|content|body|message|proposal|snapshot)/i;
|
|
33
|
+
const EXAMPLE_LIMIT = 160;
|
|
34
|
+
/**
|
|
35
|
+
* True when `value` is `root` or lies under it (path-boundary aware, so
|
|
36
|
+
* `/a/b` does not match `/a/bc`).
|
|
37
|
+
*
|
|
38
|
+
* @param value - Candidate path.
|
|
39
|
+
* @param root - Root path.
|
|
40
|
+
* @returns Whether `value` is at or under `root`.
|
|
41
|
+
*/
|
|
42
|
+
export function isUnderRoot(value, root) {
|
|
43
|
+
return value === root || value.startsWith(`${root}/`);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Replace the `from` prefix of a path with `to` (boundary aware).
|
|
47
|
+
*
|
|
48
|
+
* @param value - Path under `from`.
|
|
49
|
+
* @param from - Old root.
|
|
50
|
+
* @param to - New root.
|
|
51
|
+
* @returns The relocated path.
|
|
52
|
+
*/
|
|
53
|
+
export function relocatePath(value, from, to) {
|
|
54
|
+
return value === from ? to : `${to}${value.slice(from.length)}`;
|
|
55
|
+
}
|
|
56
|
+
/** Recursively rewrite path-named string keys of a parsed JSON value. */
|
|
57
|
+
function rewriteJson(node, from, to, onOutside, onRewrite) {
|
|
58
|
+
if (Array.isArray(node)) {
|
|
59
|
+
let changed = 0;
|
|
60
|
+
const out = node.map((item) => {
|
|
61
|
+
const r = rewriteJson(item, from, to, onOutside, onRewrite);
|
|
62
|
+
changed += r.changed;
|
|
63
|
+
return r.value;
|
|
64
|
+
});
|
|
65
|
+
return { value: out, changed };
|
|
66
|
+
}
|
|
67
|
+
if (node !== null && typeof node === 'object') {
|
|
68
|
+
let changed = 0;
|
|
69
|
+
const out = {};
|
|
70
|
+
for (const [key, value] of Object.entries(node)) {
|
|
71
|
+
if (typeof value === 'string' && PATH_JSON_KEY.test(key) && value.startsWith('/')) {
|
|
72
|
+
if (isUnderRoot(value, from)) {
|
|
73
|
+
out[key] = relocatePath(value, from, to);
|
|
74
|
+
onRewrite(out[key]);
|
|
75
|
+
changed += 1;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
onOutside(value);
|
|
79
|
+
out[key] = value;
|
|
80
|
+
}
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const r = rewriteJson(value, from, to, onOutside, onRewrite);
|
|
84
|
+
changed += r.changed;
|
|
85
|
+
out[key] = r.value;
|
|
86
|
+
}
|
|
87
|
+
return { value: out, changed };
|
|
88
|
+
}
|
|
89
|
+
return { value: node, changed: 0 };
|
|
90
|
+
}
|
|
91
|
+
/** Accumulates findings keyed by location. */
|
|
92
|
+
class FindingSet {
|
|
93
|
+
map = new Map();
|
|
94
|
+
add(location, example) {
|
|
95
|
+
const existing = this.map.get(location);
|
|
96
|
+
if (existing)
|
|
97
|
+
existing.count += 1;
|
|
98
|
+
else
|
|
99
|
+
this.map.set(location, { location, count: 1, example: example.slice(0, EXAMPLE_LIMIT) });
|
|
100
|
+
}
|
|
101
|
+
list() {
|
|
102
|
+
return [...this.map.values()].sort((a, b) => b.count - a.count);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function quoteIdent(name) {
|
|
106
|
+
return `"${name.replace(/"/g, '""')}"`;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Relocate one SQLite database from `from` to `to`.
|
|
110
|
+
*
|
|
111
|
+
* @param dbPath - Staged database (modified in place).
|
|
112
|
+
* @param dbLabel - Label used in finding locations (e.g. `cleo.db`).
|
|
113
|
+
* @param from - Old project root.
|
|
114
|
+
* @param to - New project root.
|
|
115
|
+
* @param report - Report to append to.
|
|
116
|
+
*/
|
|
117
|
+
export function relocateDatabase(dbPath, dbLabel, from, to, report) {
|
|
118
|
+
const rewritten = new FindingSet();
|
|
119
|
+
const leftUnder = new FindingSet();
|
|
120
|
+
const leftOutside = new FindingSet();
|
|
121
|
+
const missing = new FindingSet();
|
|
122
|
+
const destCleo = `${to}/.cleo`;
|
|
123
|
+
const checkTarget = (location, next) => {
|
|
124
|
+
// Files under the new .cleo/ are placed after relocation; anything else
|
|
125
|
+
// must already exist (or be restored by the user, e.g. a git clone).
|
|
126
|
+
if (!isUnderRoot(next, destCleo) && !fs.existsSync(next))
|
|
127
|
+
missing.add(location, next);
|
|
128
|
+
};
|
|
129
|
+
const db = new DatabaseSync(dbPath);
|
|
130
|
+
try {
|
|
131
|
+
const tables = db
|
|
132
|
+
.prepare("SELECT name, sql FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'")
|
|
133
|
+
.all();
|
|
134
|
+
const virtualNames = tables
|
|
135
|
+
.filter((t) => (t.sql ?? '').toUpperCase().startsWith('CREATE VIRTUAL TABLE'))
|
|
136
|
+
.map((t) => t.name);
|
|
137
|
+
for (const table of tables) {
|
|
138
|
+
if (virtualNames.includes(table.name))
|
|
139
|
+
continue;
|
|
140
|
+
if (virtualNames.some((v) => table.name.startsWith(`${v}_`)))
|
|
141
|
+
continue;
|
|
142
|
+
const withoutRowid = (table.sql ?? '').toUpperCase().includes('WITHOUT ROWID');
|
|
143
|
+
const historicalTable = HISTORICAL_TABLE.test(table.name);
|
|
144
|
+
const columns = db.prepare(`PRAGMA table_info(${quoteIdent(table.name)})`).all().map((c) => c.name);
|
|
145
|
+
for (const column of columns) {
|
|
146
|
+
const location = `${dbLabel}:${table.name}.${column}`;
|
|
147
|
+
const eligible = !historicalTable && !withoutRowid && !HISTORICAL_COLUMN.test(column);
|
|
148
|
+
const pathColumn = eligible && PATH_COLUMN.test(column);
|
|
149
|
+
const jsonColumn = eligible && /_json$/i.test(column);
|
|
150
|
+
const col = quoteIdent(column);
|
|
151
|
+
const rows = db
|
|
152
|
+
.prepare(`SELECT ${withoutRowid ? 'NULL' : 'rowid'} AS rid, ${col} AS v FROM ${quoteIdent(table.name)} WHERE typeof(${col}) = 'text' AND (instr(${col}, ?) > 0${pathColumn ? ` OR ${col} LIKE '/%'` : ''}${jsonColumn ? ` OR instr(${col}, '"/') > 0` : ''})`)
|
|
153
|
+
.all(from);
|
|
154
|
+
for (const row of rows) {
|
|
155
|
+
const mentionsRoot = row.v.includes(from);
|
|
156
|
+
if (pathColumn && row.v.startsWith('/')) {
|
|
157
|
+
if (isUnderRoot(row.v, from)) {
|
|
158
|
+
const next = relocatePath(row.v, from, to);
|
|
159
|
+
db.prepare(`UPDATE ${quoteIdent(table.name)} SET ${col} = ? WHERE rowid = ?`).run(next, row.rid);
|
|
160
|
+
rewritten.add(location, row.v);
|
|
161
|
+
checkTarget(location, next);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
leftOutside.add(location, row.v);
|
|
165
|
+
}
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (jsonColumn && /^[[{]/.test(row.v)) {
|
|
169
|
+
let parsed;
|
|
170
|
+
try {
|
|
171
|
+
parsed = JSON.parse(row.v);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
parsed = undefined;
|
|
175
|
+
}
|
|
176
|
+
if (parsed !== undefined) {
|
|
177
|
+
const r = rewriteJson(parsed, from, to, (v) => leftOutside.add(location, v), (v) => checkTarget(location, v));
|
|
178
|
+
if (r.changed > 0) {
|
|
179
|
+
const next = JSON.stringify(r.value);
|
|
180
|
+
db.prepare(`UPDATE ${quoteIdent(table.name)} SET ${col} = ? WHERE rowid = ?`).run(next, row.rid);
|
|
181
|
+
rewritten.add(location, row.v);
|
|
182
|
+
if (next.includes(from))
|
|
183
|
+
leftUnder.add(location, next);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (mentionsRoot)
|
|
189
|
+
leftUnder.add(location, row.v);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
db.close();
|
|
196
|
+
}
|
|
197
|
+
report.rewritten.push(...rewritten.list());
|
|
198
|
+
report.leftUnderOldRoot.push(...leftUnder.list());
|
|
199
|
+
report.leftOutsideRoot.push(...leftOutside.list());
|
|
200
|
+
report.rewrittenTargetMissing.push(...missing.list());
|
|
201
|
+
}
|
|
202
|
+
/** Project JSON files whose string values are relocated wholesale. */
|
|
203
|
+
const RELOCATED_JSON_FILES = ['config.json', 'project-context.json', 'worktrees.json'];
|
|
204
|
+
/** Rewrite every string value under `from` in a parsed JSON value. */
|
|
205
|
+
function rewriteAllStrings(node, from, to) {
|
|
206
|
+
if (typeof node === 'string') {
|
|
207
|
+
return node.startsWith('/') && isUnderRoot(node, from)
|
|
208
|
+
? { value: relocatePath(node, from, to), changed: 1 }
|
|
209
|
+
: { value: node, changed: 0 };
|
|
210
|
+
}
|
|
211
|
+
if (Array.isArray(node)) {
|
|
212
|
+
let changed = 0;
|
|
213
|
+
const value = node.map((n) => {
|
|
214
|
+
const r = rewriteAllStrings(n, from, to);
|
|
215
|
+
changed += r.changed;
|
|
216
|
+
return r.value;
|
|
217
|
+
});
|
|
218
|
+
return { value, changed };
|
|
219
|
+
}
|
|
220
|
+
if (node !== null && typeof node === 'object') {
|
|
221
|
+
let changed = 0;
|
|
222
|
+
const value = {};
|
|
223
|
+
for (const [k, v] of Object.entries(node)) {
|
|
224
|
+
const r = rewriteAllStrings(v, from, to);
|
|
225
|
+
changed += r.changed;
|
|
226
|
+
value[k] = r.value;
|
|
227
|
+
}
|
|
228
|
+
return { value, changed };
|
|
229
|
+
}
|
|
230
|
+
return { value: node, changed: 0 };
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Relocate the staged `.cleo/` files of one project and report text files that
|
|
234
|
+
* still mention the old root.
|
|
235
|
+
*
|
|
236
|
+
* - `project-info.json`: `projectHash` is recomputed for the new root (it is a
|
|
237
|
+
* path fingerprint; `projectId` is the stable identity and is kept).
|
|
238
|
+
* - `config.json`, `project-context.json`, `worktrees.json`: string values that
|
|
239
|
+
* are absolute paths under the old root are rewritten. Paths embedded inside
|
|
240
|
+
* prose strings are left and reported.
|
|
241
|
+
* - Every other text file mentioning the old root is reported, not edited.
|
|
242
|
+
*
|
|
243
|
+
* @param stagedCleoDir - Staged copy of the project's `.cleo/` directory.
|
|
244
|
+
* @param relPaths - Relative paths of the staged regular files.
|
|
245
|
+
* @param from - Old project root.
|
|
246
|
+
* @param to - New project root.
|
|
247
|
+
* @param report - Report to append to.
|
|
248
|
+
*/
|
|
249
|
+
export function relocateProjectFiles(stagedCleoDir, relPaths, from, to, report) {
|
|
250
|
+
const infoPath = path.join(stagedCleoDir, 'project-info.json');
|
|
251
|
+
if (fs.existsSync(infoPath)) {
|
|
252
|
+
const info = JSON.parse(fs.readFileSync(infoPath, 'utf-8'));
|
|
253
|
+
if (typeof info['projectHash'] === 'string') {
|
|
254
|
+
const next = generateProjectHash(to);
|
|
255
|
+
if (info['projectHash'] !== next) {
|
|
256
|
+
report.rewritten.push({
|
|
257
|
+
location: 'project-info.json:projectHash',
|
|
258
|
+
count: 1,
|
|
259
|
+
example: `${String(info['projectHash'])} -> ${next}`,
|
|
260
|
+
});
|
|
261
|
+
info['projectHash'] = next;
|
|
262
|
+
fs.writeFileSync(infoPath, `${JSON.stringify(info, null, 2)}\n`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
for (const rel of relPaths) {
|
|
267
|
+
const abs = path.join(stagedCleoDir, rel);
|
|
268
|
+
let text;
|
|
269
|
+
try {
|
|
270
|
+
if (fs.statSync(abs).size > 8 * 1024 * 1024)
|
|
271
|
+
continue;
|
|
272
|
+
text = fs.readFileSync(abs, 'utf-8');
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (!text.includes(from))
|
|
278
|
+
continue;
|
|
279
|
+
if (RELOCATED_JSON_FILES.includes(rel)) {
|
|
280
|
+
try {
|
|
281
|
+
const r = rewriteAllStrings(JSON.parse(text), from, to);
|
|
282
|
+
if (r.changed > 0) {
|
|
283
|
+
const next = `${JSON.stringify(r.value, null, 2)}\n`;
|
|
284
|
+
fs.writeFileSync(abs, next);
|
|
285
|
+
report.rewritten.push({ location: rel, count: r.changed });
|
|
286
|
+
text = next;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
// not JSON — fall through to reporting
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const occurrences = text.split(from).length - 1;
|
|
294
|
+
if (occurrences > 0) {
|
|
295
|
+
const at = text.indexOf(from);
|
|
296
|
+
report.leftUnderOldRoot.push({
|
|
297
|
+
location: rel,
|
|
298
|
+
count: occurrences,
|
|
299
|
+
example: text.slice(Math.max(0, at - 40), at + EXAMPLE_LIMIT - 40),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=portable-bundle-relocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-bundle-relocate.js","sourceRoot":"","sources":["../../src/store/portable-bundle-relocate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEhD,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC,aAAa,CAE9C,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACjD,+DAA+D;AAC/D,MAAM,aAAa,GACjB,0HAA0H,CAAC;AAC7H,2EAA2E;AAC3E,MAAM,gBAAgB,GACpB,4HAA4H,CAAC;AAC/H,6EAA6E;AAC7E,MAAM,iBAAiB,GACrB,6HAA6H,CAAC;AAEhI,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,IAAY;IACrD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,IAAY,EAAE,EAAU;IAClE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,KAAK,CA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MAAM,CAAC;gBACP,uCAAuC;YACzC,CAAC;QACH,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAChD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC9B,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC;gBAC3B,QAAQ,EAAE,GAAG;gBACb,KAAK,EAAE,WAAW;gBAClB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,aAAa,GAAG,EAAE,CAAC;aACnE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* portable-bundle-scan.ts — tree walking, SQLite snapshotting and row
|
|
3
|
+
* counting shared by the portable-bundle export and import sides.
|
|
4
|
+
*
|
|
5
|
+
* Kept free of CLI and registry concerns: it answers "what is in this root,
|
|
6
|
+
* what may leave the machine, and how many rows does each table hold".
|
|
7
|
+
*
|
|
8
|
+
* @task T12318
|
|
9
|
+
* @epic T12317
|
|
10
|
+
* @module store/portable-bundle-scan
|
|
11
|
+
*/
|
|
12
|
+
import { type PortableExclusion, type PortableSymlinkEntry } from '@cleocode/contracts';
|
|
13
|
+
/**
|
|
14
|
+
* Basename of the consolidated (post-E6) store, derived from the dual-scope
|
|
15
|
+
* resolver so a future rename cannot silently strand the export again.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PRIMARY_STORE_BASENAME: string;
|
|
18
|
+
/**
|
|
19
|
+
* Pre-E6 per-domain database basenames that sit directly in a root, by tier.
|
|
20
|
+
* Derived from `DB_INVENTORY` (whose templates still describe the pre-E6
|
|
21
|
+
* layout): any inventory file at the top of `.cleo/` or `<cleoHome>/`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const LEGACY_STORE_BASENAMES: Readonly<Record<'project' | 'global', ReadonlySet<string>>>;
|
|
24
|
+
/** Rules controlling what a section walk captures. */
|
|
25
|
+
export interface SectionRules {
|
|
26
|
+
/**
|
|
27
|
+
* Relative directory paths excluded with a reason. A key matches the
|
|
28
|
+
* directory itself; a key ending in `*` matches any directory whose
|
|
29
|
+
* relative path starts with the prefix.
|
|
30
|
+
*/
|
|
31
|
+
excludedDirs: Readonly<Record<string, string>>;
|
|
32
|
+
/** Directory basenames excluded at ANY depth, with a reason. */
|
|
33
|
+
excludedDirNamesAnywhere: Readonly<Record<string, string>>;
|
|
34
|
+
/** Files (relative paths) never exported, not even in encrypted bundles, with a reason. */
|
|
35
|
+
excludedFiles?: Readonly<Record<string, string>>;
|
|
36
|
+
/** Returns the remedy when `relPath` is a secret, else null. */
|
|
37
|
+
secretRemedy: (relPath: string) => string | null;
|
|
38
|
+
}
|
|
39
|
+
/** Walk rules for a project `.cleo/` directory. */
|
|
40
|
+
export declare const PROJECT_SECTION_RULES: SectionRules;
|
|
41
|
+
/** Walk rules for the global CLEO home. */
|
|
42
|
+
export declare const GLOBAL_HOME_RULES: SectionRules;
|
|
43
|
+
/** Walk rules for the config home (`$XDG_CONFIG_HOME/cleo`). */
|
|
44
|
+
export declare const CONFIG_HOME_RULES: SectionRules;
|
|
45
|
+
/** Classified contents of one root. */
|
|
46
|
+
export interface SectionScan {
|
|
47
|
+
/** SQLite files (relative paths). */
|
|
48
|
+
sqlite: string[];
|
|
49
|
+
/** Regular non-secret files (relative paths). */
|
|
50
|
+
files: string[];
|
|
51
|
+
/** Secret files with their remedies. */
|
|
52
|
+
secrets: Array<{
|
|
53
|
+
relPath: string;
|
|
54
|
+
remedy: string;
|
|
55
|
+
}>;
|
|
56
|
+
/** Symlinks whose targets stay inside the root. */
|
|
57
|
+
symlinks: PortableSymlinkEntry[];
|
|
58
|
+
/** Exclusions with sizes. */
|
|
59
|
+
excluded: PortableExclusion[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* True when a file starts with the SQLite header.
|
|
63
|
+
*
|
|
64
|
+
* @param absPath - File to test.
|
|
65
|
+
* @returns Whether the file is a SQLite database.
|
|
66
|
+
*/
|
|
67
|
+
export declare function isSqliteFile(absPath: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Walk one root and classify every entry. Symlinks are never followed; an
|
|
70
|
+
* in-root relative symlink is recorded for recreation, any other symlink is
|
|
71
|
+
* reported as an exclusion so nothing leaves the root silently.
|
|
72
|
+
*
|
|
73
|
+
* @param root - Absolute root directory.
|
|
74
|
+
* @param rules - Section rules.
|
|
75
|
+
* @param skipAbsolute - Absolute paths to ignore entirely (e.g. the export's own staging dir).
|
|
76
|
+
* @returns The classified scan.
|
|
77
|
+
*/
|
|
78
|
+
export declare function scanSection(root: string, rules: SectionRules, skipAbsolute?: ReadonlySet<string>): SectionScan;
|
|
79
|
+
/**
|
|
80
|
+
* Snapshot a SQLite database with `VACUUM INTO` over a READ-ONLY connection.
|
|
81
|
+
*
|
|
82
|
+
* VACUUM INTO runs inside one read transaction, so the snapshot is
|
|
83
|
+
* consistent even while other processes write through WAL. The source is
|
|
84
|
+
* never checkpointed or otherwise modified.
|
|
85
|
+
*
|
|
86
|
+
* @param srcPath - Source database.
|
|
87
|
+
* @param destPath - Snapshot path (must not exist).
|
|
88
|
+
* @throws {Error} When the source cannot be opened or read.
|
|
89
|
+
*/
|
|
90
|
+
export declare function vacuumSnapshot(srcPath: string, destPath: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Count rows in every ordinary table of a database.
|
|
93
|
+
*
|
|
94
|
+
* Virtual tables are reported as uncounted (their rows live in shadow tables,
|
|
95
|
+
* which are counted); any other failure is reported with its message rather
|
|
96
|
+
* than swallowed.
|
|
97
|
+
*
|
|
98
|
+
* @param dbPath - Database to count.
|
|
99
|
+
* @returns Counts and uncountable tables.
|
|
100
|
+
*/
|
|
101
|
+
export declare function countRows(dbPath: string): {
|
|
102
|
+
rowCounts: Record<string, number>;
|
|
103
|
+
uncountedTables: Record<string, string>;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Run `PRAGMA integrity_check` on a database.
|
|
107
|
+
*
|
|
108
|
+
* @param dbPath - Database to check.
|
|
109
|
+
* @returns `ok` or the first reported problem.
|
|
110
|
+
*/
|
|
111
|
+
export declare function integrityCheck(dbPath: string): string;
|
|
112
|
+
/** Tables surfaced as "key counts" in results when present. */
|
|
113
|
+
export declare const KEY_COUNT_TABLES: readonly string[];
|
|
114
|
+
/**
|
|
115
|
+
* Legacy (pre-E6) table → consolidated table in `cleo.db`, for detecting data
|
|
116
|
+
* that exists only in legacy files.
|
|
117
|
+
*/
|
|
118
|
+
export declare const LEGACY_TABLE_MAP: Readonly<Record<string, string>>;
|
|
119
|
+
/**
|
|
120
|
+
* Select the key-table subset of a row-count map.
|
|
121
|
+
*
|
|
122
|
+
* @param rowCounts - Full counts.
|
|
123
|
+
* @returns Counts for the key tables that exist.
|
|
124
|
+
*/
|
|
125
|
+
export declare function pickKeyCounts(rowCounts: Record<string, number>): Record<string, number>;
|
|
126
|
+
/**
|
|
127
|
+
* Credential-bearing columns, by table, that an UNENCRYPTED bundle clears.
|
|
128
|
+
* Found by auditing the live project and global stores for secret-, token-,
|
|
129
|
+
* password- and key-bearing columns (usage counters such as `tokens_used`
|
|
130
|
+
* are not credentials). The rows are kept; only these values are cleared.
|
|
131
|
+
*
|
|
132
|
+
* Interim list: the table classification registry (T12332) is the intended
|
|
133
|
+
* long-term source for the `portable-secret` class.
|
|
134
|
+
*/
|
|
135
|
+
export declare const CREDENTIAL_COLUMNS: Readonly<Record<string, readonly string[]>>;
|
|
136
|
+
/** Memory (ADR-093 `portable`) tables whose counts are disclosed on export. */
|
|
137
|
+
export declare const MEMORY_TABLES: readonly string[];
|
|
138
|
+
/** One table's cleared credential columns. */
|
|
139
|
+
export interface CredentialRedaction {
|
|
140
|
+
/** Table. */
|
|
141
|
+
table: string;
|
|
142
|
+
/** Columns cleared. */
|
|
143
|
+
columns: string[];
|
|
144
|
+
/** Rows that held a non-empty credential value. */
|
|
145
|
+
rows: number;
|
|
146
|
+
/** Remedy text. */
|
|
147
|
+
remedy: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Clear credential columns in a SNAPSHOT (never a live store), then rebuild
|
|
151
|
+
* the file with `secure_delete` + `VACUUM` so the old values are not left in
|
|
152
|
+
* free pages. Rows are kept, so row counts are unchanged.
|
|
153
|
+
*
|
|
154
|
+
* @param snapshotPath - A VACUUM snapshot owned by the export staging area.
|
|
155
|
+
* @returns Per-table redactions (tables with no credential values are omitted).
|
|
156
|
+
* @throws {Error} When a credential column cannot be cleared; the caller must
|
|
157
|
+
* not ship the snapshot.
|
|
158
|
+
*/
|
|
159
|
+
export declare function redactCredentials(snapshotPath: string): CredentialRedaction[];
|
|
160
|
+
/**
|
|
161
|
+
* Stream a file through SHA-256.
|
|
162
|
+
*
|
|
163
|
+
* @param filePath - File to hash.
|
|
164
|
+
* @returns Lowercase hex digest.
|
|
165
|
+
*/
|
|
166
|
+
export declare function sha256File(filePath: string): Promise<string>;
|
|
167
|
+
//# sourceMappingURL=portable-bundle-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-bundle-scan.d.ts","sourceRoot":"","sources":["../../src/store/portable-bundle-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAe7B;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAElC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAG9F,CAAC;AAgBF,sDAAsD;AACtD,MA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