ctxr-cli 0.7.0 → 0.9.0
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/README.md +303 -22
- package/dist/adapters/types.d.ts +0 -5
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/commands/adapters-generate.d.ts.map +1 -1
- package/dist/commands/adapters-generate.js +2 -3
- package/dist/commands/adapters-generate.js.map +1 -1
- package/dist/commands/context-gather.d.ts +22 -0
- package/dist/commands/context-gather.d.ts.map +1 -0
- package/dist/commands/context-gather.js +36 -0
- package/dist/commands/context-gather.js.map +1 -0
- package/dist/commands/graph-query.d.ts.map +1 -1
- package/dist/commands/graph-query.js +6 -8
- package/dist/commands/graph-query.js.map +1 -1
- package/dist/commands/ingest.d.ts +22 -9
- package/dist/commands/ingest.d.ts.map +1 -1
- package/dist/commands/ingest.js +86 -24
- package/dist/commands/ingest.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +21 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/source-check.d.ts.map +1 -1
- package/dist/commands/source-check.js +27 -9
- package/dist/commands/source-check.js.map +1 -1
- package/dist/commands/source-stamp.d.ts +6 -5
- package/dist/commands/source-stamp.d.ts.map +1 -1
- package/dist/commands/source-stamp.js +8 -7
- package/dist/commands/source-stamp.js.map +1 -1
- package/dist/config/defaults.d.ts +103 -4
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +76 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/render.d.ts +11 -0
- package/dist/config/render.d.ts.map +1 -1
- package/dist/config/render.js +85 -3
- package/dist/config/render.js.map +1 -1
- package/dist/config/schema.d.ts +50 -30
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +151 -62
- package/dist/config/schema.js.map +1 -1
- package/dist/core/agents-doc.d.ts.map +1 -1
- package/dist/core/agents-doc.js +4 -1
- package/dist/core/agents-doc.js.map +1 -1
- package/dist/core/checks/harness-portability-checks.d.ts +1 -1
- package/dist/core/checks/harness-portability-checks.d.ts.map +1 -1
- package/dist/core/checks/harness-portability-checks.js +2 -3
- package/dist/core/checks/harness-portability-checks.js.map +1 -1
- package/dist/core/checks/manifest.d.ts.map +1 -1
- package/dist/core/checks/manifest.js +2 -0
- package/dist/core/checks/manifest.js.map +1 -1
- package/dist/core/checks/organize-checks.d.ts +11 -1
- package/dist/core/checks/organize-checks.d.ts.map +1 -1
- package/dist/core/checks/organize-checks.js +42 -12
- package/dist/core/checks/organize-checks.js.map +1 -1
- package/dist/core/checks/retrieval-checks.d.ts +9 -0
- package/dist/core/checks/retrieval-checks.d.ts.map +1 -0
- package/dist/core/checks/retrieval-checks.js +30 -0
- package/dist/core/checks/retrieval-checks.js.map +1 -0
- package/dist/core/content/canonicalize.d.ts +10 -0
- package/dist/core/content/canonicalize.d.ts.map +1 -1
- package/dist/core/content/canonicalize.js +12 -0
- package/dist/core/content/canonicalize.js.map +1 -1
- package/dist/core/errors.d.ts +19 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +53 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/fs/prefix.d.ts +13 -0
- package/dist/core/fs/prefix.d.ts.map +1 -0
- package/dist/core/fs/prefix.js +22 -0
- package/dist/core/fs/prefix.js.map +1 -0
- package/dist/core/graph/persist.d.ts +13 -0
- package/dist/core/graph/persist.d.ts.map +1 -1
- package/dist/core/graph/persist.js +24 -0
- package/dist/core/graph/persist.js.map +1 -1
- package/dist/core/hooks.d.ts +3 -12
- package/dist/core/hooks.d.ts.map +1 -1
- package/dist/core/hooks.js +24 -20
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/ingest/capture-hash.d.ts +16 -0
- package/dist/core/ingest/capture-hash.d.ts.map +1 -0
- package/dist/core/ingest/capture-hash.js +34 -0
- package/dist/core/ingest/capture-hash.js.map +1 -0
- package/dist/core/ingest/identity.d.ts +7 -1
- package/dist/core/ingest/identity.d.ts.map +1 -1
- package/dist/core/ingest/identity.js +16 -1
- package/dist/core/ingest/identity.js.map +1 -1
- package/dist/core/ingest/model.d.ts +17 -2
- package/dist/core/ingest/model.d.ts.map +1 -1
- package/dist/core/ingest/model.js +5 -0
- package/dist/core/ingest/model.js.map +1 -1
- package/dist/core/migrations/config-defaults-as-the-convention.d.ts +21 -0
- package/dist/core/migrations/config-defaults-as-the-convention.d.ts.map +1 -0
- package/dist/core/migrations/config-defaults-as-the-convention.js +54 -0
- package/dist/core/migrations/config-defaults-as-the-convention.js.map +1 -0
- package/dist/core/migrations/registry.d.ts.map +1 -1
- package/dist/core/migrations/registry.js +4 -0
- package/dist/core/migrations/registry.js.map +1 -1
- package/dist/core/migrations/retain-captures-as-provenance.d.ts +22 -0
- package/dist/core/migrations/retain-captures-as-provenance.d.ts.map +1 -0
- package/dist/core/migrations/retain-captures-as-provenance.js +133 -0
- package/dist/core/migrations/retain-captures-as-provenance.js.map +1 -0
- package/dist/core/notes/list.d.ts +20 -0
- package/dist/core/notes/list.d.ts.map +1 -1
- package/dist/core/notes/list.js +27 -6
- package/dist/core/notes/list.js.map +1 -1
- package/dist/core/records.d.ts +7 -0
- package/dist/core/records.d.ts.map +1 -1
- package/dist/core/records.js +12 -2
- package/dist/core/records.js.map +1 -1
- package/dist/core/retrieval/pass.d.ts +66 -0
- package/dist/core/retrieval/pass.d.ts.map +1 -0
- package/dist/core/retrieval/pass.js +171 -0
- package/dist/core/retrieval/pass.js.map +1 -0
- package/dist/core/write-lifecycle/path-gate.d.ts +2 -2
- package/dist/core/write-lifecycle/path-gate.d.ts.map +1 -1
- package/dist/core/write-lifecycle/path-gate.js +9 -10
- package/dist/core/write-lifecycle/path-gate.js.map +1 -1
- package/dist/run.d.ts +0 -5
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +38 -3
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +13 -5
- package/templates/agents/capture-and-ingest.md +27 -8
- package/templates/agents/retrieval-leg-routing.md +34 -8
- package/templates/hooks/_resolve-ctxr.sh +37 -0
- package/templates/hooks/claude-code-write-gate.sh +34 -6
- package/templates/hooks/pre-commit.sh +15 -8
- package/templates/skills/ctxr-connection-finding.md +7 -5
- package/templates/skills/ctxr-ingest-orchestration.md +15 -9
- package/templates/skills/ctxr-publish.md +7 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-hash.js","sourceRoot":"","sources":["../../../src/core/ingest/capture-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAQnD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,SAAiB,EAAE,YAAoB;IACzE,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC,kBAAkB,CAAC,CAAC;IACvF,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;IAC5E,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,CAAC;IACnF,IAAI,KAAiB,CAAC;IACtB,IAAI,CAAC;QACH,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,IAAI,uBAAuB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACnH,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACtE,CAAC"}
|
|
@@ -12,6 +12,12 @@ export declare const SOURCE_HASH_FIELD = "source_hash";
|
|
|
12
12
|
export declare const INGESTED_FIELD = "ingested";
|
|
13
13
|
/** store-primitives-from-migration-audit spec (D2): alternative source identities `source add-alt` appends — a later check against any of them reports `duplicate`. */
|
|
14
14
|
export declare const SOURCE_ALT_IDS_FIELD = "source_alt_ids";
|
|
15
|
-
/**
|
|
15
|
+
/** retain-captures-as-provenance: the capture paths a note was synthesized from — a list, because a note may cite many. */
|
|
16
|
+
export declare const SOURCES_FIELD = "sources";
|
|
17
|
+
/** retain-captures-as-provenance: on a sidecar, the non-markdown capture beside it whose bytes the hash is taken over. */
|
|
18
|
+
export declare const CAPTURE_FILE_FIELD = "capture_file";
|
|
19
|
+
/** Whether a record carries any source-identity field at all — what makes it a dedupe record. */
|
|
16
20
|
export declare function hasSourceIdentity(note: Pick<Note, 'frontmatter'>): boolean;
|
|
21
|
+
/** Whether ingest has already run against this capture — the re-ingest guard. */
|
|
22
|
+
export declare function hasAssignedIdentity(note: Pick<Note, 'frontmatter'>): boolean;
|
|
17
23
|
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,cAAc,aAAa,CAAC;AACzC,uKAAuK;AACvK,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,cAAc,aAAa,CAAC;AACzC,uKAAuK;AACvK,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,2HAA2H;AAC3H,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,0HAA0H;AAC1H,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAYjD,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAE1E;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAE5E"}
|
|
@@ -11,9 +11,24 @@ export const SOURCE_HASH_FIELD = 'source_hash';
|
|
|
11
11
|
export const INGESTED_FIELD = 'ingested';
|
|
12
12
|
/** store-primitives-from-migration-audit spec (D2): alternative source identities `source add-alt` appends — a later check against any of them reports `duplicate`. */
|
|
13
13
|
export const SOURCE_ALT_IDS_FIELD = 'source_alt_ids';
|
|
14
|
+
/** retain-captures-as-provenance: the capture paths a note was synthesized from — a list, because a note may cite many. */
|
|
15
|
+
export const SOURCES_FIELD = 'sources';
|
|
16
|
+
/** retain-captures-as-provenance: on a sidecar, the non-markdown capture beside it whose bytes the hash is taken over. */
|
|
17
|
+
export const CAPTURE_FILE_FIELD = 'capture_file';
|
|
14
18
|
const IDENTITY_FIELDS = [SOURCE_TYPE_FIELD, SOURCE_ID_FIELD, SOURCE_HASH_FIELD, INGESTED_FIELD];
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* retain-captures-as-provenance: the two fields ingest itself assigns, as
|
|
21
|
+
* opposed to the two a capture pipeline commonly already knows when it writes
|
|
22
|
+
* the file. Splitting them is what lets a fetcher record where something came
|
|
23
|
+
* from without pretending it has been ingested.
|
|
24
|
+
*/
|
|
25
|
+
const ASSIGNED_AT_INGEST_FIELDS = [SOURCE_HASH_FIELD, INGESTED_FIELD];
|
|
26
|
+
/** Whether a record carries any source-identity field at all — what makes it a dedupe record. */
|
|
16
27
|
export function hasSourceIdentity(note) {
|
|
17
28
|
return IDENTITY_FIELDS.some((field) => note.frontmatter?.[field] !== undefined);
|
|
18
29
|
}
|
|
30
|
+
/** Whether ingest has already run against this capture — the re-ingest guard. */
|
|
31
|
+
export function hasAssignedIdentity(note) {
|
|
32
|
+
return ASSIGNED_AT_INGEST_FIELDS.some((field) => note.frontmatter?.[field] !== undefined);
|
|
33
|
+
}
|
|
19
34
|
//# sourceMappingURL=identity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/core/ingest/identity.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,M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/**
|
|
2
|
+
* retain-captures-as-provenance: dedupe compares identity records, not notes.
|
|
3
|
+
* A record is a retained capture (where identity lives now) or a note stamped
|
|
4
|
+
* before the capture tier existed (where it used to). `Note` satisfies this
|
|
5
|
+
* structurally, so both lists feed the same evaluation unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export interface IdentityRecord {
|
|
8
|
+
/** Path relative to the store root, forward-slash separated. */
|
|
9
|
+
path: string;
|
|
10
|
+
frontmatter: Record<string, unknown> | undefined;
|
|
11
|
+
}
|
|
2
12
|
export type SourceCheckVerdict = 'new' | 'already_ingested' | 'drift' | 'alternate_source_match' | 'multiple_matches';
|
|
3
13
|
export interface SourceCheckResult {
|
|
4
14
|
verdict: SourceCheckVerdict;
|
|
@@ -13,6 +23,11 @@ export interface SourceCheckResult {
|
|
|
13
23
|
* order, stopping (and reporting `multiple_matches` rather than guessing)
|
|
14
24
|
* the moment either stage finds more than one match.
|
|
15
25
|
*
|
|
26
|
+
* retain-captures-as-provenance: `notes` is the store's identity records —
|
|
27
|
+
* every retained capture plus every note stamped before identity moved onto
|
|
28
|
+
* the capture — so excluding the capture tier from retrieval never narrows
|
|
29
|
+
* what dedupe can see.
|
|
30
|
+
*
|
|
16
31
|
* store-primitives-from-migration-audit spec (D2): a source-id match
|
|
17
32
|
* (primary OR an alternate `source add-alt` recorded) whose recorded hash
|
|
18
33
|
* differs from the candidate's is `drift`, not `already_ingested` — the
|
|
@@ -20,5 +35,5 @@ export interface SourceCheckResult {
|
|
|
20
35
|
* canonicalized form (D2), so a URL varying only in case, tracking
|
|
21
36
|
* parameters, or a trailing slash still matches.
|
|
22
37
|
*/
|
|
23
|
-
export declare function evaluateSourceCheck(notes: readonly
|
|
38
|
+
export declare function evaluateSourceCheck(notes: readonly IdentityRecord[], candidateHash: string, sourceId: string, trackingParams?: readonly string[]): SourceCheckResult;
|
|
24
39
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/model.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAClD;AAID,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,kBAAkB,GAAG,OAAO,GAAG,wBAAwB,GAAG,kBAAkB,CAAC;AAEtH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,kFAAkF;IAClF,KAAK,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;IACrC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAaD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,SAAS,MAAM,EAAO,GACrC,iBAAiB,CA2BnB"}
|
|
@@ -18,6 +18,11 @@ function recordedIds(note) {
|
|
|
18
18
|
* order, stopping (and reporting `multiple_matches` rather than guessing)
|
|
19
19
|
* the moment either stage finds more than one match.
|
|
20
20
|
*
|
|
21
|
+
* retain-captures-as-provenance: `notes` is the store's identity records —
|
|
22
|
+
* every retained capture plus every note stamped before identity moved onto
|
|
23
|
+
* the capture — so excluding the capture tier from retrieval never narrows
|
|
24
|
+
* what dedupe can see.
|
|
25
|
+
*
|
|
21
26
|
* store-primitives-from-migration-audit spec (D2): a source-id match
|
|
22
27
|
* (primary OR an alternate `source add-alt` recorded) whose recorded hash
|
|
23
28
|
* differs from the candidate's is `drift`, not `already_ingested` — the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/core/ingest/model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/core/ingest/model.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAazF,SAAS,WAAW,CAAC,IAAoB;IACvC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC,CAAC;IACpD,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,KAAK,MAAM,GAAG,IAAI,IAAI;YAAE,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAgC,EAChC,aAAqB,EACrB,QAAgB,EAChB,cAAc,GAAsB,EAAE;IAEtC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,KAAK;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,EAAE,cAAc,CAAC,KAA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cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAC3G,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IACjH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Migration } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* config-defaults-as-the-convention: every store written before this change
|
|
4
|
+
* restates the whole convention verbatim, because `init` wrote every resolved
|
|
5
|
+
* value. That is what made a changed shipped default reach existing stores
|
|
6
|
+
* only through a migration rewriting files whose operators never chose those
|
|
7
|
+
* values.
|
|
8
|
+
*
|
|
9
|
+
* This removes the restatements. It cannot tell an echo `init` wrote from a
|
|
10
|
+
* value an operator typed that happens to equal the default — and treats them
|
|
11
|
+
* the same deliberately: agreeing with the convention is not a decision that
|
|
12
|
+
* needs recording, and after pruning the store resolves the identical value.
|
|
13
|
+
* An operator who wants to pin a value against a future default change
|
|
14
|
+
* re-declares it, which is now a meaningful act rather than one line among
|
|
15
|
+
* forty identical ones.
|
|
16
|
+
*
|
|
17
|
+
* The pruning itself lives in `renderStoreConfig`, not here — every writer
|
|
18
|
+
* goes through it, so this migration only has to trigger a write.
|
|
19
|
+
*/
|
|
20
|
+
export declare const configDefaultsAsTheConventionMigration: Migration;
|
|
21
|
+
//# sourceMappingURL=config-defaults-as-the-convention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-defaults-as-the-convention.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/config-defaults-as-the-convention.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AAI5D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sCAAsC,EAAE,SA+BpD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { readConfig } from '../../config/load.js';
|
|
3
|
+
import { redundantKeyPaths, renderStoreConfig } from '../../config/render.js';
|
|
4
|
+
import { writeFileAtomic } from '../fs/atomic.js';
|
|
5
|
+
const CONFIG_PATH = 'contexture.yaml';
|
|
6
|
+
/**
|
|
7
|
+
* config-defaults-as-the-convention: every store written before this change
|
|
8
|
+
* restates the whole convention verbatim, because `init` wrote every resolved
|
|
9
|
+
* value. That is what made a changed shipped default reach existing stores
|
|
10
|
+
* only through a migration rewriting files whose operators never chose those
|
|
11
|
+
* values.
|
|
12
|
+
*
|
|
13
|
+
* This removes the restatements. It cannot tell an echo `init` wrote from a
|
|
14
|
+
* value an operator typed that happens to equal the default — and treats them
|
|
15
|
+
* the same deliberately: agreeing with the convention is not a decision that
|
|
16
|
+
* needs recording, and after pruning the store resolves the identical value.
|
|
17
|
+
* An operator who wants to pin a value against a future default change
|
|
18
|
+
* re-declares it, which is now a meaningful act rather than one line among
|
|
19
|
+
* forty identical ones.
|
|
20
|
+
*
|
|
21
|
+
* The pruning itself lives in `renderStoreConfig`, not here — every writer
|
|
22
|
+
* goes through it, so this migration only has to trigger a write.
|
|
23
|
+
*/
|
|
24
|
+
export const configDefaultsAsTheConventionMigration = {
|
|
25
|
+
id: '0010-config-defaults-as-the-convention',
|
|
26
|
+
fromVersion: 9,
|
|
27
|
+
toVersion: 10,
|
|
28
|
+
description: 'Remove configuration keys whose value already equals contexture\'s shipped default, so the file records only what the store chose, and bump schema_version to 10.',
|
|
29
|
+
async plan(store) {
|
|
30
|
+
if (store.config.schema_version >= 10)
|
|
31
|
+
return [];
|
|
32
|
+
const deltas = [
|
|
33
|
+
{ path: CONFIG_PATH, description: 'set schema_version to 10' },
|
|
34
|
+
];
|
|
35
|
+
for (const key of redundantKeyPaths(store.config)) {
|
|
36
|
+
deltas.push({
|
|
37
|
+
path: CONFIG_PATH,
|
|
38
|
+
description: `remove ${key}, which already holds contexture's shipped default`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return deltas;
|
|
42
|
+
},
|
|
43
|
+
async apply(store) {
|
|
44
|
+
if (store.config.schema_version >= 10)
|
|
45
|
+
return [];
|
|
46
|
+
const currentConfig = await readConfig(store.root);
|
|
47
|
+
const appliedDeltas = await this.plan({ ...store, config: currentConfig });
|
|
48
|
+
// renderStoreConfig drops every redundant key on the way out, and its
|
|
49
|
+
// round-trip re-parse proves the pruned file still resolves to this.
|
|
50
|
+
await writeFileAtomic(path.join(store.root, CONFIG_PATH), renderStoreConfig({ ...currentConfig, schema_version: 10 }));
|
|
51
|
+
return appliedDeltas;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=config-defaults-as-the-convention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-defaults-as-the-convention.js","sourceRoot":"","sources":["../../../src/core/migrations/config-defaults-as-the-convention.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAc;IAC/D,EAAE,EAAE,wCAAwC;IAC5C,WAAW,EAAE,CAAC;IACd,SAAS,EAAE,EAAE;IACb,WAAW,EACT,mKAAmK;IAErK,KAAK,CAAC,IAAI,CAAC,KAAK;QACd,IAAI,KAAK,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE;YAAE,OAAO,EAAE,CAAC;QACjD,MAAM,MAAM,GAAqB;YAC/B,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,0BAA0B,EAAE;SAC/D,CAAC;QACF,KAAK,MAAM,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,UAAU,GAAG,oDAAoD;aAC/E,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAK;QACf,IAAI,KAAK,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE;YAAE,OAAO,EAAE,CAAC;QAEjD,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QAC3E,sEAAsE;QACtE,qEAAqE;QACrE,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,iBAAiB,CAAC,EAAE,GAAG,aAAa,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACvH,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/registry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,SAAS,EAS1C,CAAC;AAEF,qHAAqH;AACrH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,CAElE"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { addExplanationCraftSkillMigration } from './add-explanation-craft-skill.js';
|
|
2
|
+
import { configDefaultsAsTheConventionMigration } from './config-defaults-as-the-convention.js';
|
|
2
3
|
import { archiveDestinationFromTaxonomyMigration } from './archive-destination-from-taxonomy.js';
|
|
3
4
|
import { dropAccessAxesMigration } from './drop-access-axes.js';
|
|
4
5
|
import { dropForgeAndWorkspacesExternalMigration } from './drop-forge-and-workspaces-external.js';
|
|
5
6
|
import { renameConventionsPathMigration } from './rename-conventions-path.js';
|
|
6
7
|
import { renameProceduresPathMigration } from './rename-procedures-path.js';
|
|
8
|
+
import { retainCapturesAsProvenanceMigration } from './retain-captures-as-provenance.js';
|
|
7
9
|
/**
|
|
8
10
|
* Every migration contexture ships, in ascending fromVersion order. Later
|
|
9
11
|
* phases append here, nothing else.
|
|
@@ -22,6 +24,8 @@ export const MIGRATIONS = [
|
|
|
22
24
|
archiveDestinationFromTaxonomyMigration,
|
|
23
25
|
addExplanationCraftSkillMigration,
|
|
24
26
|
dropAccessAxesMigration,
|
|
27
|
+
retainCapturesAsProvenanceMigration,
|
|
28
|
+
configDefaultsAsTheConventionMigration,
|
|
25
29
|
];
|
|
26
30
|
/** Every migration a store currently at `fromVersion` still needs to reach the CLI's supported version, in order. */
|
|
27
31
|
export function pendingMigrations(fromVersion) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/core/migrations/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,uCAAuC,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,uCAAuC,EAAE,MAAM,yCAAyC,CAAC;AAClG,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/core/migrations/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,uCAAuC,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,uCAAuC,EAAE,MAAM,yCAAyC,CAAC;AAClG,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AAGzF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAyB;IAC9C,6BAA6B;IAC7B,8BAA8B;IAC9B,uCAAuC;IACvC,uCAAuC;IACvC,iCAAiC;IACjC,uBAAuB;IACvB,mCAAmC;IACnC,sCAAsC;CACvC,CAAC;AAEF,qHAAqH;AACrH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Migration } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* retain-captures-as-provenance: captures stop being consumed by ingest and
|
|
4
|
+
* start being retained as the store's provenance ledger, which means they
|
|
5
|
+
* stop being notes. That needs three things on an existing store — a
|
|
6
|
+
* declared capture root, an inbox inside it, and the root excluded from
|
|
7
|
+
* retrieval — and this migration supplies all three.
|
|
8
|
+
*
|
|
9
|
+
* Modelled on 0006: adopt the new shipped default only where the value still
|
|
10
|
+
* sat at the old one, preserve an operator-chosen value verbatim, and move
|
|
11
|
+
* the directory when one exists. Pending-ness is `schema_version < 9`, not
|
|
12
|
+
* key presence, for the reason 0002/0004/0005/0006 all record: the schema's
|
|
13
|
+
* transform fills `capture_root` in on an unmigrated store too, so its
|
|
14
|
+
* presence cannot distinguish migrated from not.
|
|
15
|
+
*
|
|
16
|
+
* The directory move runs before the config write, so an interruption
|
|
17
|
+
* between them leaves the next run able to re-derive what is left: the
|
|
18
|
+
* config still reads schema 8 with the old inbox, the old directory is
|
|
19
|
+
* already gone, and the rename is skipped as done.
|
|
20
|
+
*/
|
|
21
|
+
export declare const retainCapturesAsProvenanceMigration: Migration;
|
|
22
|
+
//# sourceMappingURL=retain-captures-as-provenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retain-captures-as-provenance.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/retain-captures-as-provenance.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AAsD5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mCAAmC,EAAE,SAoEjD,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { mkdir, rename } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { DEFAULT_CAPTURE_ROOT, DEFAULT_INBOX_PATH } from '../../config/defaults.js';
|
|
5
|
+
import { readConfig } from '../../config/load.js';
|
|
6
|
+
import { renderStoreConfig } from '../../config/render.js';
|
|
7
|
+
import { CaptureRootUndeterminedError } from '../errors.js';
|
|
8
|
+
import { writeFileAtomic } from '../fs/atomic.js';
|
|
9
|
+
/**
|
|
10
|
+
* The inbox default as it stood before this migration. Pinned locally, never
|
|
11
|
+
* read from `defaults.ts`: a migration reasons about the value a store was
|
|
12
|
+
* born with, which must not drift when the shipped default moves again.
|
|
13
|
+
*/
|
|
14
|
+
const PREVIOUS_DEFAULT_INBOX_PATH = 'inbox/';
|
|
15
|
+
function normalize(prefix) {
|
|
16
|
+
return prefix.replace(/\/+$/, '');
|
|
17
|
+
}
|
|
18
|
+
/** The directory one level above `inboxPath`, or null when the inbox is already top-level. */
|
|
19
|
+
function parentDirectoryOf(inboxPath) {
|
|
20
|
+
const segments = normalize(inboxPath).split('/').filter((segment) => segment !== '');
|
|
21
|
+
if (segments.length < 2)
|
|
22
|
+
return null;
|
|
23
|
+
return `${segments.slice(0, -1).join('/')}/`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Where this store's capture tier lands. Two cases and one refusal:
|
|
27
|
+
*
|
|
28
|
+
* 1. The store never customized its inbox, so it is ours to move: adopt the
|
|
29
|
+
* shipped `raw/inbox/` under `raw/`.
|
|
30
|
+
* 2. The store chose an inbox nested at least one level (`staging/inbox/`):
|
|
31
|
+
* the parent it already chose IS the capture root. The inbox is left
|
|
32
|
+
* exactly as the operator set it.
|
|
33
|
+
* 3. The store chose a top-level inbox of its own (`incoming/`): there is no
|
|
34
|
+
* parent to promote short of the store root, and excluding the store root
|
|
35
|
+
* from retrieval would empty the note list. Refuse before writing
|
|
36
|
+
* anything and let the operator choose, the same way `source check`
|
|
37
|
+
* refuses to guess among multiple matches.
|
|
38
|
+
*/
|
|
39
|
+
function resolveCaptureTier(inboxPath) {
|
|
40
|
+
if (normalize(inboxPath) === normalize(PREVIOUS_DEFAULT_INBOX_PATH)) {
|
|
41
|
+
return { inboxPath: DEFAULT_INBOX_PATH, captureRoot: DEFAULT_CAPTURE_ROOT, adoptsShippedDefault: true };
|
|
42
|
+
}
|
|
43
|
+
const parent = parentDirectoryOf(inboxPath);
|
|
44
|
+
if (parent === null)
|
|
45
|
+
throw new CaptureRootUndeterminedError(inboxPath);
|
|
46
|
+
return { inboxPath, captureRoot: parent, adoptsShippedDefault: false };
|
|
47
|
+
}
|
|
48
|
+
function alreadyExcluded(excludePaths, captureRoot) {
|
|
49
|
+
return excludePaths.some((excluded) => normalize(excluded) === normalize(captureRoot));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* retain-captures-as-provenance: captures stop being consumed by ingest and
|
|
53
|
+
* start being retained as the store's provenance ledger, which means they
|
|
54
|
+
* stop being notes. That needs three things on an existing store — a
|
|
55
|
+
* declared capture root, an inbox inside it, and the root excluded from
|
|
56
|
+
* retrieval — and this migration supplies all three.
|
|
57
|
+
*
|
|
58
|
+
* Modelled on 0006: adopt the new shipped default only where the value still
|
|
59
|
+
* sat at the old one, preserve an operator-chosen value verbatim, and move
|
|
60
|
+
* the directory when one exists. Pending-ness is `schema_version < 9`, not
|
|
61
|
+
* key presence, for the reason 0002/0004/0005/0006 all record: the schema's
|
|
62
|
+
* transform fills `capture_root` in on an unmigrated store too, so its
|
|
63
|
+
* presence cannot distinguish migrated from not.
|
|
64
|
+
*
|
|
65
|
+
* The directory move runs before the config write, so an interruption
|
|
66
|
+
* between them leaves the next run able to re-derive what is left: the
|
|
67
|
+
* config still reads schema 8 with the old inbox, the old directory is
|
|
68
|
+
* already gone, and the rename is skipped as done.
|
|
69
|
+
*/
|
|
70
|
+
export const retainCapturesAsProvenanceMigration = {
|
|
71
|
+
id: '0009-retain-captures-as-provenance',
|
|
72
|
+
fromVersion: 8,
|
|
73
|
+
toVersion: 9,
|
|
74
|
+
description: 'Declare the capture tier: add ingest.capture_root, move a default-valued inbox inside it, exclude the capture root from retrieval, and bump schema_version to 9.',
|
|
75
|
+
async plan(store) {
|
|
76
|
+
if (store.config.schema_version >= 9)
|
|
77
|
+
return [];
|
|
78
|
+
const tier = resolveCaptureTier(store.config.ingest.inbox_path);
|
|
79
|
+
const deltas = [
|
|
80
|
+
{
|
|
81
|
+
path: 'contexture.yaml',
|
|
82
|
+
description: `add ingest.capture_root: ${tier.captureRoot} and set schema_version to 9`,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
if (tier.adoptsShippedDefault) {
|
|
86
|
+
deltas.push({
|
|
87
|
+
path: 'contexture.yaml',
|
|
88
|
+
description: `adopt the shipped inbox default, moving ingest.inbox_path from ${PREVIOUS_DEFAULT_INBOX_PATH} to ${tier.inboxPath}`,
|
|
89
|
+
});
|
|
90
|
+
if (existsSync(path.join(store.root, PREVIOUS_DEFAULT_INBOX_PATH))) {
|
|
91
|
+
deltas.push({
|
|
92
|
+
path: tier.inboxPath,
|
|
93
|
+
description: `move the inbox directory from ${PREVIOUS_DEFAULT_INBOX_PATH} to ${tier.inboxPath}`,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!alreadyExcluded(store.config.retrieval.exclude_paths, tier.captureRoot)) {
|
|
98
|
+
deltas.push({
|
|
99
|
+
path: 'contexture.yaml',
|
|
100
|
+
description: `add ${tier.captureRoot} to retrieval.exclude_paths, so retained captures are never notes`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return deltas;
|
|
104
|
+
},
|
|
105
|
+
async apply(store) {
|
|
106
|
+
if (store.config.schema_version >= 9)
|
|
107
|
+
return [];
|
|
108
|
+
const currentConfig = await readConfig(store.root);
|
|
109
|
+
const tier = resolveCaptureTier(currentConfig.ingest.inbox_path);
|
|
110
|
+
const appliedDeltas = await this.plan({ ...store, config: currentConfig });
|
|
111
|
+
if (tier.adoptsShippedDefault) {
|
|
112
|
+
const oldDir = path.join(store.root, PREVIOUS_DEFAULT_INBOX_PATH);
|
|
113
|
+
const newDir = path.join(store.root, tier.inboxPath);
|
|
114
|
+
// Absent whenever nothing was ever captured — only the config changes.
|
|
115
|
+
if (existsSync(oldDir) && !existsSync(newDir)) {
|
|
116
|
+
await mkdir(path.dirname(newDir), { recursive: true });
|
|
117
|
+
await rename(oldDir, newDir);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const excludePaths = alreadyExcluded(currentConfig.retrieval.exclude_paths, tier.captureRoot)
|
|
121
|
+
? [...currentConfig.retrieval.exclude_paths]
|
|
122
|
+
: [...currentConfig.retrieval.exclude_paths, tier.captureRoot];
|
|
123
|
+
const nextConfig = {
|
|
124
|
+
...currentConfig,
|
|
125
|
+
schema_version: 9,
|
|
126
|
+
retrieval: { ...currentConfig.retrieval, exclude_paths: excludePaths },
|
|
127
|
+
ingest: { ...currentConfig.ingest, inbox_path: tier.inboxPath, capture_root: tier.captureRoot },
|
|
128
|
+
};
|
|
129
|
+
await writeFileAtomic(path.join(store.root, 'contexture.yaml'), renderStoreConfig(nextConfig));
|
|
130
|
+
return appliedDeltas;
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=retain-captures-as-provenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retain-captures-as-provenance.js","sourceRoot":"","sources":["../../../src/core/migrations/retain-captures-as-provenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;;;GAIG;AACH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aAAa;YAChB,cAAc,EAAE,CAAC;YACjB,SAAS,EAAE,EAAE,GAAG,aAAa,CAAC,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE;YACtE,MAAM,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE;SAChG,CAAC;QACF,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;QAE/F,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAC"}
|
|
@@ -9,7 +9,27 @@ export interface Note {
|
|
|
9
9
|
frontmatter: Record<string, unknown> | undefined;
|
|
10
10
|
body: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The one prefix rule every path-prefix declaration reads — exclusions,
|
|
14
|
+
* `--under`, the pass's demotion tier, and the write-path gate. Re-exported
|
|
15
|
+
* rather than defined here: it now lives in `core/fs/prefix.ts` so the gate
|
|
16
|
+
* can read the same implementation without importing note enumeration.
|
|
17
|
+
*/
|
|
18
|
+
export { isUnderAnyPrefix } from '../fs/prefix.js';
|
|
12
19
|
export declare function excludedPrefixesFor(config: StoreConfig): string[];
|
|
20
|
+
/**
|
|
21
|
+
* retain-captures-as-provenance: every markdown capture in the tier, which is
|
|
22
|
+
* exactly the set `listNotes` refuses to return — the capture root is a
|
|
23
|
+
* declared retrieval exclusion, so the same walk that hides captures from
|
|
24
|
+
* retrieval is what enumerates them here. Dedupe needs this list and
|
|
25
|
+
* retrieval must never see it, so the two callers share the walker and
|
|
26
|
+
* differ only in which side of the exclusion they ask for.
|
|
27
|
+
*
|
|
28
|
+
* Non-markdown captures are skipped for the same reason `listNotes` skips
|
|
29
|
+
* them: only markdown can carry the frontmatter an identity lives in. A
|
|
30
|
+
* binary capture is represented here by its sidecar.
|
|
31
|
+
*/
|
|
32
|
+
export declare function listCaptures(storeRoot: string, config: StoreConfig): Promise<Note[]>;
|
|
13
33
|
/** Every retrievable note in the store: everything under a .md path, minus every declared exclusion. */
|
|
14
34
|
export declare function listNotes(storeRoot: string, config: StoreConfig, query?: NoteQuery): Promise<Note[]>;
|
|
15
35
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/core/notes/list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/core/notes/list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,IAAI;IACnB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AAmCD;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAYjE;AAkCD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAM1F;AAED,wGAAwG;AACxG,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,GAAE,SAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAO9G"}
|
package/dist/core/notes/list.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readdir } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { configuredAdapters } from '../../adapters/registry.js';
|
|
4
|
+
import { isUnderAnyPrefix } from '../fs/prefix.js';
|
|
4
5
|
import { parseNote } from './parse.js';
|
|
5
6
|
/** Infrastructure directories intrinsic to contexture itself — never configurable content locations. */
|
|
6
7
|
const ALWAYS_SKIP_DIRS = new Set(['.git', '.githooks', '.queue']);
|
|
@@ -31,12 +32,13 @@ function harnessEntryFiles(config) {
|
|
|
31
32
|
return new Set();
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The one prefix rule every path-prefix declaration reads — exclusions,
|
|
37
|
+
* `--under`, the pass's demotion tier, and the write-path gate. Re-exported
|
|
38
|
+
* rather than defined here: it now lives in `core/fs/prefix.ts` so the gate
|
|
39
|
+
* can read the same implementation without importing note enumeration.
|
|
40
|
+
*/
|
|
41
|
+
export { isUnderAnyPrefix } from '../fs/prefix.js';
|
|
40
42
|
export function excludedPrefixesFor(config) {
|
|
41
43
|
return [
|
|
42
44
|
...config.retrieval.exclude_paths,
|
|
@@ -81,6 +83,25 @@ async function walk(dir, root, excludePrefixes, skipRootFiles, results) {
|
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* retain-captures-as-provenance: every markdown capture in the tier, which is
|
|
88
|
+
* exactly the set `listNotes` refuses to return — the capture root is a
|
|
89
|
+
* declared retrieval exclusion, so the same walk that hides captures from
|
|
90
|
+
* retrieval is what enumerates them here. Dedupe needs this list and
|
|
91
|
+
* retrieval must never see it, so the two callers share the walker and
|
|
92
|
+
* differ only in which side of the exclusion they ask for.
|
|
93
|
+
*
|
|
94
|
+
* Non-markdown captures are skipped for the same reason `listNotes` skips
|
|
95
|
+
* them: only markdown can carry the frontmatter an identity lives in. A
|
|
96
|
+
* binary capture is represented here by its sidecar.
|
|
97
|
+
*/
|
|
98
|
+
export async function listCaptures(storeRoot, config) {
|
|
99
|
+
const captureRoot = path.join(storeRoot, config.ingest.capture_root);
|
|
100
|
+
const relativePaths = [];
|
|
101
|
+
await walk(captureRoot, storeRoot, [], new Set(), relativePaths);
|
|
102
|
+
relativePaths.sort();
|
|
103
|
+
return Promise.all(relativePaths.map((relativePath) => parseNote(path.join(storeRoot, relativePath), relativePath)));
|
|
104
|
+
}
|
|
84
105
|
/** Every retrievable note in the store: everything under a .md path, minus every declared exclusion. */
|
|
85
106
|
export async function listNotes(storeRoot, config, query = {}) {
|
|
86
107
|
const relativePaths = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/core/notes/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAcvC,wGAAwG;AACxG,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,MAAmB;IAC5C,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CACZ,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,CAAC;aAC7C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;aAC3B,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SA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E,aAAa,CAAC,CAAC;IACxG,aAAa,CAAC,IAAI,EAAE,CAAC;IAErB,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAC1H,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;AAChH,CAAC"}
|
package/dist/core/records.d.ts
CHANGED
|
@@ -11,5 +11,12 @@ export interface PerNoteRecord {
|
|
|
11
11
|
gloss: string;
|
|
12
12
|
hash: string;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Every authored gloss in the catalog, keyed by note path. Split out so a
|
|
16
|
+
* caller that already holds the note list — the retrieval pass — can join
|
|
17
|
+
* against it without enumerating the store a second time, which would risk
|
|
18
|
+
* the two enumerations disagreeing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readCatalogGlosses(store: Store): Promise<Map<string, string>>;
|
|
14
21
|
export declare function buildPerNoteRecords(store: Store): Promise<PerNoteRecord[]>;
|
|
15
22
|
//# sourceMappingURL=records.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAWD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAWD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAYnF;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAUhF"}
|
package/dist/core/records.js
CHANGED
|
@@ -13,8 +13,13 @@ async function readIfExists(filePath) {
|
|
|
13
13
|
throw err;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Every authored gloss in the catalog, keyed by note path. Split out so a
|
|
18
|
+
* caller that already holds the note list — the retrieval pass — can join
|
|
19
|
+
* against it without enumerating the store a second time, which would risk
|
|
20
|
+
* the two enumerations disagreeing.
|
|
21
|
+
*/
|
|
22
|
+
export async function readCatalogGlosses(store) {
|
|
18
23
|
const sections = catalogSectionsFor(store.config);
|
|
19
24
|
const catalogDir = path.join(store.root, store.config.catalog.path);
|
|
20
25
|
const glosses = new Map();
|
|
@@ -24,6 +29,11 @@ export async function buildPerNoteRecords(store) {
|
|
|
24
29
|
glosses.set(notePath, entry.gloss);
|
|
25
30
|
}
|
|
26
31
|
}
|
|
32
|
+
return glosses;
|
|
33
|
+
}
|
|
34
|
+
export async function buildPerNoteRecords(store) {
|
|
35
|
+
const notes = await listNotes(store.root, store.config);
|
|
36
|
+
const glosses = await readCatalogGlosses(store);
|
|
27
37
|
return notes.map((note) => ({
|
|
28
38
|
id: note.path,
|
|
29
39
|
path: note.path,
|
package/dist/core/records.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgB5C,KAAK,UAAU,YAAY,CAAC,QAAgB;IAC1C,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,CAAC;QAChE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgB5C,KAAK,UAAU,YAAY,CAAC,QAAgB;IAC1C,IAAI,CAAC;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