foretext 0.8.0-bootstrap.0 → 0.8.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 +6 -4
- package/claude-scaffold/SKILL.md +13 -13
- package/claude-scaffold/bin/{engram → foretext} +7 -7
- package/claude-scaffold/references/review.md +24 -24
- package/claude-scaffold/references/search.md +23 -23
- package/claude-scaffold/references/setup.md +28 -28
- package/dist/capture-adapter.js +2 -2
- package/dist/{capture-admission-Dnu2eW39.js → capture-admission-DqhzaMDY.js} +2 -2
- package/dist/{contextual-recall-AR3ign-H.js → contextual-recall-DF8e3Oa_.js} +99 -97
- package/dist/index.js +357 -274
- package/dist/opencode-plugin.js +47 -47
- package/dist/pi-extension.js +71 -71
- package/dist/{src-CRnWgfbx.js → src-DjnbdRrt.js} +176 -151
- package/package.json +3 -5
- package/skills/{engram → foretext}/SKILL.md +11 -11
- package/skills/{engram → foretext}/references/review.md +27 -27
- package/skills/{engram → foretext}/references/search.md +23 -23
- package/skills/{engram → foretext}/references/setup.md +28 -28
|
@@ -6,6 +6,8 @@ import * as NodeCrypto from "node:crypto";
|
|
|
6
6
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
7
7
|
import * as FileSystem$1 from "effect/FileSystem";
|
|
8
8
|
import { FileSystem } from "effect/FileSystem";
|
|
9
|
+
import * as NFS from "node:fs";
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
9
11
|
import * as OS from "node:os";
|
|
10
12
|
import os, { hostname } from "node:os";
|
|
11
13
|
import * as Path$1 from "node:path";
|
|
@@ -38,8 +40,6 @@ import * as Scope from "effect/Scope";
|
|
|
38
40
|
import * as Option$1 from "effect/Option";
|
|
39
41
|
import * as EffectCrypto from "effect/Crypto";
|
|
40
42
|
import * as Queue from "effect/Queue";
|
|
41
|
-
import * as NFS from "node:fs";
|
|
42
|
-
import "node:fs";
|
|
43
43
|
import * as NodeUrl from "node:url";
|
|
44
44
|
import * as Stdio from "effect/Stdio";
|
|
45
45
|
import * as RcRef from "effect/RcRef";
|
|
@@ -110,8 +110,8 @@ const encodeEntropy = (bytes) => {
|
|
|
110
110
|
/** Derive a repeatable canonical ID from an independently random proposal ID. */
|
|
111
111
|
const pendingApprovalId = (candidateId, created) => encodeTime(Math.max(0, Math.min(created, 2 ** 48 - 1))) + encodeEntropy(createHash("sha256").update(candidateId).digest().subarray(0, 10));
|
|
112
112
|
const nowISO = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
113
|
-
const slugify = (input) => {
|
|
114
|
-
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) ||
|
|
113
|
+
const slugify = (input, emptySlug = "note") => {
|
|
114
|
+
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || emptySlug;
|
|
115
115
|
};
|
|
116
116
|
const parseTags = (input) => {
|
|
117
117
|
if (!input) return [];
|
|
@@ -263,10 +263,10 @@ const detectAuthor = () => Effect.sync(() => {
|
|
|
263
263
|
//#endregion
|
|
264
264
|
//#region ../core/src/domain.ts
|
|
265
265
|
/**
|
|
266
|
-
* Domain model for
|
|
266
|
+
* Domain model for note, defined with `effect/Schema`.
|
|
267
267
|
*/
|
|
268
|
-
/** The kind of thing
|
|
269
|
-
const
|
|
268
|
+
/** The kind of thing a note records. */
|
|
269
|
+
const NoteTypeSchema = Schema.Literals([
|
|
270
270
|
"decision",
|
|
271
271
|
"fact",
|
|
272
272
|
"preference",
|
|
@@ -274,7 +274,7 @@ const EngramTypeSchema = Schema.Literals([
|
|
|
274
274
|
"issue",
|
|
275
275
|
"context"
|
|
276
276
|
]);
|
|
277
|
-
const
|
|
277
|
+
const NOTE_TYPES = [
|
|
278
278
|
"decision",
|
|
279
279
|
"fact",
|
|
280
280
|
"preference",
|
|
@@ -282,7 +282,7 @@ const ENGRAM_TYPES = [
|
|
|
282
282
|
"issue",
|
|
283
283
|
"context"
|
|
284
284
|
];
|
|
285
|
-
/** Where
|
|
285
|
+
/** Where a note lives. */
|
|
286
286
|
const ScopeSchema = Schema.Literals(["personal", "project"]);
|
|
287
287
|
/** Lifecycle status of an entry. Absence is not serialized (old files have
|
|
288
288
|
* no `status` key); consumers may treat absence as `active` when they need
|
|
@@ -293,8 +293,8 @@ const StatusSchema = Schema.Literals([
|
|
|
293
293
|
"superseded",
|
|
294
294
|
"archived"
|
|
295
295
|
]);
|
|
296
|
-
/** Valid `status` values (mirrors the
|
|
297
|
-
const
|
|
296
|
+
/** Valid `status` values (mirrors the NOTE_TYPES pattern). */
|
|
297
|
+
const NOTE_STATUSES = [
|
|
298
298
|
"active",
|
|
299
299
|
"superseded",
|
|
300
300
|
"archived"
|
|
@@ -308,7 +308,7 @@ const SourceTypeSchema = Schema.Literals([
|
|
|
308
308
|
"command",
|
|
309
309
|
"other"
|
|
310
310
|
]);
|
|
311
|
-
/** Valid `sourceType` values (mirrors the
|
|
311
|
+
/** Valid `sourceType` values (mirrors the NOTE_TYPES pattern). */
|
|
312
312
|
const SOURCE_TYPES = [
|
|
313
313
|
"conversation",
|
|
314
314
|
"file",
|
|
@@ -316,16 +316,16 @@ const SOURCE_TYPES = [
|
|
|
316
316
|
"command",
|
|
317
317
|
"other"
|
|
318
318
|
];
|
|
319
|
-
/** Raw frontmatter as read from
|
|
319
|
+
/** Raw frontmatter as read from a note Markdown file.
|
|
320
320
|
*
|
|
321
321
|
* `id`: ULID-style (26 lowercase base32 chars — see `newId`) for new
|
|
322
|
-
*
|
|
322
|
+
* notes; legacy 4-digit numeric ids ("0001") remain valid. Both are
|
|
323
323
|
* unique-per-store by contract; duplicates are a repairable defect
|
|
324
|
-
* (see `
|
|
324
|
+
* (see `NoteStore.dedupe`). */
|
|
325
325
|
const FrontmatterSchema = Schema.Struct({
|
|
326
326
|
id: Schema.String,
|
|
327
327
|
title: Schema.String,
|
|
328
|
-
type:
|
|
328
|
+
type: NoteTypeSchema,
|
|
329
329
|
tags: Schema.Array(Schema.String),
|
|
330
330
|
scope: ScopeSchema,
|
|
331
331
|
created: Schema.String,
|
|
@@ -356,16 +356,16 @@ const FrontmatterSchema = Schema.Struct({
|
|
|
356
356
|
sourceRef: Schema.optional(Schema.String),
|
|
357
357
|
schemaVersion: Schema.optional(Schema.Number.pipe(Schema.check(Schema.isInt())))
|
|
358
358
|
});
|
|
359
|
-
/** ENG-17: time-derived activity of one
|
|
359
|
+
/** ENG-17: time-derived activity of one note. Inactive iff an explicit
|
|
360
360
|
* status says so (`superseded`/`archived`) OR `expires` is set and has
|
|
361
361
|
* passed. The boundary is inclusive (`expires <= nowMs`), matching
|
|
362
362
|
* `lifecycleDiagnostics`. `reviewAfter` is attention-only and never affects
|
|
363
363
|
* activity; a missing or unparseable `expires` never deactivates (entry
|
|
364
364
|
* validation reports bad values). Time-expiry does not change status
|
|
365
365
|
* metadata — `expired` is deliberately not a status. Pure function. */
|
|
366
|
-
const effectiveStatus = (
|
|
367
|
-
if (
|
|
368
|
-
const expiresMs =
|
|
366
|
+
const effectiveStatus = (note, nowMs = Date.now()) => {
|
|
367
|
+
if (note.status === "superseded" || note.status === "archived") return "inactive";
|
|
368
|
+
const expiresMs = note.expires === void 0 ? void 0 : parseTimestamp(note.expires);
|
|
369
369
|
if (expiresMs !== void 0 && expiresMs <= nowMs) return "inactive";
|
|
370
370
|
return "active";
|
|
371
371
|
};
|
|
@@ -387,7 +387,7 @@ const DEFAULT_PERSONAL_SECRET_SCAN = "warn";
|
|
|
387
387
|
const ProjectConfigSchema = Schema.Struct({
|
|
388
388
|
version: Schema.Number,
|
|
389
389
|
tracked: Schema.Boolean,
|
|
390
|
-
defaultType:
|
|
390
|
+
defaultType: NoteTypeSchema,
|
|
391
391
|
author: Schema.optional(Schema.String),
|
|
392
392
|
/** ENG-15: scan policy for project writes. Defaults to block. */
|
|
393
393
|
secretScan: Schema.optional(SecretPolicySchema)
|
|
@@ -400,7 +400,7 @@ const AutoContextScopeSchema = Schema.Literals([
|
|
|
400
400
|
"personal",
|
|
401
401
|
"both"
|
|
402
402
|
]);
|
|
403
|
-
/** Valid `autoContextScope` values (mirrors the
|
|
403
|
+
/** Valid `autoContextScope` values (mirrors the NOTE_TYPES pattern). */
|
|
404
404
|
const AUTO_CONTEXT_SCOPES = [
|
|
405
405
|
"project",
|
|
406
406
|
"personal",
|
|
@@ -456,11 +456,11 @@ const DEFAULT_GLOBAL_CONFIG = {
|
|
|
456
456
|
//#endregion
|
|
457
457
|
//#region ../core/src/errors.ts
|
|
458
458
|
/**
|
|
459
|
-
* Tagged errors for the
|
|
459
|
+
* Tagged errors for the note domain. These flow through the Effect error
|
|
460
460
|
* channel and are formatted into friendly CLI messages at the edge.
|
|
461
461
|
*/
|
|
462
462
|
var ProjectNotInitializedError = class extends Data.TaggedError("ProjectNotInitializedError") {};
|
|
463
|
-
var
|
|
463
|
+
var NoteNotFoundError = class extends Data.TaggedError("NoteNotFoundError") {};
|
|
464
464
|
var AmbiguousIdError = class extends Data.TaggedError("AmbiguousIdError") {};
|
|
465
465
|
var DuplicateIdError = class extends Data.TaggedError("DuplicateIdError") {};
|
|
466
466
|
var InvalidTypeError = class extends Data.TaggedError("InvalidTypeError") {};
|
|
@@ -469,7 +469,7 @@ var FrontmatterParseError = class extends Data.TaggedError("FrontmatterParseErro
|
|
|
469
469
|
var ConfigError = class extends Data.TaggedError("ConfigError") {};
|
|
470
470
|
/** A store or config integrity check failed: unreadable or invalid files
|
|
471
471
|
* were found where a complete view was required (e.g. `dedupe` refusing to
|
|
472
|
-
* rewrite a partially readable store, or `
|
|
472
|
+
* rewrite a partially readable store, or `foretext check` reporting defects). */
|
|
473
473
|
var IntegrityCheckFailedError = class extends Data.TaggedError("IntegrityCheckFailedError") {};
|
|
474
474
|
/** ENG-15: a write was rejected because the secret scanner found findings
|
|
475
475
|
* under a blocking policy. Findings are redacted by construction: they name
|
|
@@ -489,10 +489,10 @@ function formatWriteAdvisory(error, confirmation) {
|
|
|
489
489
|
/** Render a domain error to a human-friendly string. */
|
|
490
490
|
function formatDomainError(err) {
|
|
491
491
|
switch (err._tag) {
|
|
492
|
-
case "ProjectNotInitializedError": return `No
|
|
493
|
-
case "
|
|
492
|
+
case "ProjectNotInitializedError": return `No project memory store found in "${err.cwd}".\nRun \`foretext init\` here, or use \`--scope personal\` for global memory.`;
|
|
493
|
+
case "NoteNotFoundError": return err.scope ? `No note with id "${err.id}" in scope "${err.scope}".` : `No note with id "${err.id}".`;
|
|
494
494
|
case "AmbiguousIdError": return `Ambiguous id "${err.id}" — matches: ${err.matches.join(", ")}`;
|
|
495
|
-
case "DuplicateIdError": return `Duplicate id "${err.id}" — ${err.files.length} files claim it:\n` + err.files.map((f) => ` ${f}`).join("\n") + "\nIds must be unique. Run `
|
|
495
|
+
case "DuplicateIdError": return `Duplicate id "${err.id}" — ${err.files.length} files claim it:\n` + err.files.map((f) => ` ${f}`).join("\n") + "\nIds must be unique. Run `foretext dedupe` to assign fresh ids automatically, or renumber one file by hand (filename prefix and frontmatter id), or remove it.";
|
|
496
496
|
case "InvalidTypeError": return `Unknown type "${err.type}". Valid: ${[
|
|
497
497
|
"decision",
|
|
498
498
|
"fact",
|
|
@@ -518,22 +518,44 @@ function formatDomainError(err) {
|
|
|
518
518
|
const compareDiagnostics = (a, b) => a.scope.localeCompare(b.scope) || a.file.localeCompare(b.file) || a.code.localeCompare(b.code) || a.message.localeCompare(b.message);
|
|
519
519
|
/** The single bounded warning emitted when a read had to skip candidate
|
|
520
520
|
* files: fail-open but loud. Its length is constant apart from the count;
|
|
521
|
-
* no file list, no entry content. `
|
|
521
|
+
* no file list, no entry content. `foretext list` prints it to stderr, and
|
|
522
522
|
* context paths prepend it to their captured output. */
|
|
523
|
-
const incompleteMemoryWarning = (omittedFiles) => `WARNING:
|
|
523
|
+
const incompleteMemoryWarning = (omittedFiles) => `WARNING: Foretext memory is incomplete. Skipped ${omittedFiles} unreadable or invalid ${omittedFiles === 1 ? "file" : "files"}. Run \`foretext check --scope all\` for exact paths and repair guidance.`;
|
|
524
524
|
//#endregion
|
|
525
525
|
//#region ../core/src/paths.ts
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
const
|
|
531
|
-
|
|
526
|
+
const DEFAULT_STORE_NAME = ".foretext";
|
|
527
|
+
const LEGACY_STORE_NAME = ".engram";
|
|
528
|
+
const DEFAULT_NOTES_NAME = "notes";
|
|
529
|
+
const LEGACY_NOTES_NAME = "engrams";
|
|
530
|
+
const notesDirectoryName = (store) => {
|
|
531
|
+
if (existsSync(path.join(store, "engrams"))) return LEGACY_NOTES_NAME;
|
|
532
|
+
if (existsSync(path.join(store, "notes"))) return DEFAULT_NOTES_NAME;
|
|
533
|
+
return path.basename(store) === ".engram" ? LEGACY_NOTES_NAME : DEFAULT_NOTES_NAME;
|
|
534
|
+
};
|
|
535
|
+
const globalRoot = () => {
|
|
536
|
+
const home = os.homedir();
|
|
537
|
+
const legacy = path.join(home, LEGACY_STORE_NAME);
|
|
538
|
+
return existsSync(legacy) ? legacy : path.join(home, DEFAULT_STORE_NAME);
|
|
539
|
+
};
|
|
540
|
+
const personalStoreName = () => path.basename(globalRoot());
|
|
541
|
+
const globalNotesDir = () => {
|
|
542
|
+
const store = globalRoot();
|
|
543
|
+
return path.join(store, notesDirectoryName(store));
|
|
544
|
+
};
|
|
532
545
|
const globalConfigPath = () => path.join(globalRoot(), "config.json");
|
|
533
|
-
const
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
546
|
+
const projectStoreName = (root) => {
|
|
547
|
+
const legacy = path.join(root, LEGACY_STORE_NAME);
|
|
548
|
+
if (existsSync(path.join(legacy, "config.json"))) return LEGACY_STORE_NAME;
|
|
549
|
+
if (existsSync(path.join(root, ".foretext", "config.json"))) return DEFAULT_STORE_NAME;
|
|
550
|
+
return existsSync(legacy) ? LEGACY_STORE_NAME : DEFAULT_STORE_NAME;
|
|
551
|
+
};
|
|
552
|
+
const projectDir = (root) => path.join(root, projectStoreName(root));
|
|
553
|
+
const projectNotesDir = (root) => {
|
|
554
|
+
const store = projectDir(root);
|
|
555
|
+
return path.join(store, notesDirectoryName(store));
|
|
556
|
+
};
|
|
557
|
+
const projectConfigPath = (root) => path.join(projectDir(root), "config.json");
|
|
558
|
+
const projectReadmePath = (root) => path.join(projectDir(root), "README.md");
|
|
537
559
|
const gitignorePath = (gitRoot) => path.join(gitRoot, ".gitignore");
|
|
538
560
|
//#endregion
|
|
539
561
|
//#region ../core/src/config.ts
|
|
@@ -567,7 +589,7 @@ const validateFile = (fs, file, scope, required, decode) => Effect.gen(function*
|
|
|
567
589
|
scope,
|
|
568
590
|
file,
|
|
569
591
|
message: `config file not found: ${file}`,
|
|
570
|
-
hint: `Recreate it with \`
|
|
592
|
+
hint: `Recreate it with \`foretext init\`; its presence is what marks this as an initialized store.`
|
|
571
593
|
}];
|
|
572
594
|
}
|
|
573
595
|
const read = yield* Effect.result(fs.readFileString(file));
|
|
@@ -599,7 +621,7 @@ const validateFile = (fs, file, scope, required, decode) => Effect.gen(function*
|
|
|
599
621
|
scope,
|
|
600
622
|
file,
|
|
601
623
|
message: `unsupported config version ${version} (supported: 1)`,
|
|
602
|
-
hint: `This config was written by a different
|
|
624
|
+
hint: `This config was written by a different note release. Upgrade the foretext CLI, or reset the file to version 1.`
|
|
603
625
|
}];
|
|
604
626
|
try {
|
|
605
627
|
decode(data);
|
|
@@ -726,18 +748,20 @@ const writeAtomicFile = Effect.fnUntraced(function* (directory, name, content, o
|
|
|
726
748
|
* they don't add runtime requirements to the calling context.
|
|
727
749
|
*/
|
|
728
750
|
const SEP = "/";
|
|
729
|
-
/** Walk up from `start` to the nearest
|
|
751
|
+
/** Walk up from `start` to the nearest directory with a project memory config.
|
|
730
752
|
*
|
|
731
753
|
* Two boundaries keep discovery local:
|
|
732
|
-
* - The walk stops at the nearest `.git`: a project
|
|
733
|
-
* repo, so
|
|
734
|
-
*
|
|
735
|
-
* - The global `~/.engram` is the personal scope, never a project root.
|
|
754
|
+
* - The walk stops at the nearest `.git`: a project note lives inside its
|
|
755
|
+
* repo, so a store above the Git root is never treated as the project store.
|
|
756
|
+
* - The home directory holds personal memory and is never a project root.
|
|
736
757
|
*/
|
|
737
758
|
const findProjectRoot = (fs, path, start = process.cwd()) => Effect.gen(function* () {
|
|
738
759
|
let dir = path.resolve(start);
|
|
760
|
+
const home = path.resolve(os.homedir());
|
|
739
761
|
while (true) {
|
|
740
|
-
if (
|
|
762
|
+
if (dir !== home) {
|
|
763
|
+
for (const name of [LEGACY_STORE_NAME, DEFAULT_STORE_NAME]) if (yield* fs.exists(path.join(dir, name, "config.json"))) return dir;
|
|
764
|
+
}
|
|
741
765
|
if (yield* fs.exists(`${dir}${SEP}.git`)) return null;
|
|
742
766
|
const parent = path.dirname(dir);
|
|
743
767
|
if (parent === dir) return null;
|
|
@@ -971,6 +995,7 @@ function parseRepositoryReference(ref) {
|
|
|
971
995
|
".",
|
|
972
996
|
"..",
|
|
973
997
|
".git",
|
|
998
|
+
".foretext",
|
|
974
999
|
".engram"
|
|
975
1000
|
].includes(part.toLowerCase()))) return void 0;
|
|
976
1001
|
return {
|
|
@@ -994,7 +1019,7 @@ const reference = {
|
|
|
994
1019
|
const timestamp$1 = Schema.String.check(Schema.makeFilter((value) => parseTimestamp(value) !== void 0));
|
|
995
1020
|
const Proposed = Schema.Struct({
|
|
996
1021
|
title: nonBlank,
|
|
997
|
-
type:
|
|
1022
|
+
type: NoteTypeSchema,
|
|
998
1023
|
tags: Schema.Array(Schema.String),
|
|
999
1024
|
body: Schema.String,
|
|
1000
1025
|
reviewAfter: Schema.optionalKey(timestamp$1),
|
|
@@ -1296,7 +1321,7 @@ const rejectPendingCandidate = Effect.fnUntraced(function* (scope, id, assertEdi
|
|
|
1296
1321
|
* empty, whitespace-only, and punctuation-only queries therefore
|
|
1297
1322
|
* yield [].
|
|
1298
1323
|
* 3. Each term is edge-trimmed (leading and trailing non-letter characters
|
|
1299
|
-
* removed, e.g. "@" in "@
|
|
1324
|
+
* removed, e.g. "@" in "@foretext/core", "--" in "--save-dev") and emitted
|
|
1300
1325
|
* first as its exact whole form: internal separators (., /, _, -, :) are
|
|
1301
1326
|
* preserved, and letters are normalized with normalizeText.
|
|
1302
1327
|
* 4. Expanded subtokens follow the exact form, in order:
|
|
@@ -3990,7 +4015,7 @@ const mergeUnknownFields = (canonical, metadata) => {
|
|
|
3990
4015
|
return out;
|
|
3991
4016
|
};
|
|
3992
4017
|
const REQUIRED_HINTS = {
|
|
3993
|
-
id: "Add an \"id\" line: four digits (legacy, e.g. 0001) or 26 lowercase base32 characters, as written by `
|
|
4018
|
+
id: "Add an \"id\" line: four digits (legacy, e.g. 0001) or 26 lowercase base32 characters, as written by `foretext add`.",
|
|
3994
4019
|
title: "Add a non-empty \"title\" line.",
|
|
3995
4020
|
type: "Add a \"type\" line: decision, fact, preference, note, issue, or context.",
|
|
3996
4021
|
tags: "Add a `tags` list of strings, e.g. `tags: [deps, auth]`.",
|
|
@@ -4018,7 +4043,7 @@ const fieldTypeIssue = (name, expected, got) => ({
|
|
|
4018
4043
|
const timestampIssue = (name, value) => ({
|
|
4019
4044
|
code: name === "created" ? "created_invalid" : name === "updated" ? "updated_invalid" : name === "reviewAfter" ? "review_after_invalid" : "expires_invalid",
|
|
4020
4045
|
message: `"${name}" is not an ISO 8601 timestamp with zone: ${quote(value)}`,
|
|
4021
|
-
hint: `Use the UTC form
|
|
4046
|
+
hint: `Use the UTC form note writes, e.g. \`${name}: 2026-01-01T00:00:00.000Z\`.`
|
|
4022
4047
|
});
|
|
4023
4048
|
const NO_PARTIAL = {
|
|
4024
4049
|
id: void 0,
|
|
@@ -4086,8 +4111,8 @@ const validateEntry = (raw) => {
|
|
|
4086
4111
|
partialId = id;
|
|
4087
4112
|
if (!isValidId(id)) issues.push({
|
|
4088
4113
|
code: "id_invalid",
|
|
4089
|
-
message: `id ${quote(id)} is not a valid
|
|
4090
|
-
hint: "Ids are four digits (legacy, e.g. 0001) or 26 lowercase base32 characters, as written by `
|
|
4114
|
+
message: `id ${quote(id)} is not a valid note id`,
|
|
4115
|
+
hint: "Ids are four digits (legacy, e.g. 0001) or 26 lowercase base32 characters, as written by `foretext add`."
|
|
4091
4116
|
});
|
|
4092
4117
|
} else issues.push(fieldTypeIssue("id", "a string", id));
|
|
4093
4118
|
}
|
|
@@ -4104,10 +4129,10 @@ const validateEntry = (raw) => {
|
|
|
4104
4129
|
} else issues.push(fieldTypeIssue("title", "a string", title));
|
|
4105
4130
|
}
|
|
4106
4131
|
const type = field("type");
|
|
4107
|
-
if (type !== void 0 && !
|
|
4132
|
+
if (type !== void 0 && !NOTE_TYPES.includes(type)) issues.push({
|
|
4108
4133
|
code: "type_invalid",
|
|
4109
4134
|
message: `unknown type ${quote(type)}`,
|
|
4110
|
-
hint: `Use one of: ${
|
|
4135
|
+
hint: `Use one of: ${NOTE_TYPES.join(", ")}.`
|
|
4111
4136
|
});
|
|
4112
4137
|
const tags = field("tags");
|
|
4113
4138
|
if (tags !== void 0 && (!Array.isArray(tags) || tags.some((t) => typeof t !== "string"))) issues.push(fieldTypeIssue("tags", "a list of strings", tags));
|
|
@@ -4167,15 +4192,15 @@ const validateEntry = (raw) => {
|
|
|
4167
4192
|
issues.push({
|
|
4168
4193
|
code: "schema_version_unsupported",
|
|
4169
4194
|
message: `unsupported entry schema version ${rawSchemaVersion} (supported: 1)`,
|
|
4170
|
-
hint: "Upgrade
|
|
4195
|
+
hint: "Upgrade note to a release that supports this entry format. Avoid editing this file unless you accept forward-compatibility risk."
|
|
4171
4196
|
});
|
|
4172
4197
|
}
|
|
4173
4198
|
}
|
|
4174
4199
|
const status = field("status");
|
|
4175
|
-
if (status !== void 0 && !
|
|
4200
|
+
if (status !== void 0 && !NOTE_STATUSES.includes(status)) issues.push({
|
|
4176
4201
|
code: "status_invalid",
|
|
4177
4202
|
message: `unknown status ${quote(status)}`,
|
|
4178
|
-
hint: `Use one of: ${
|
|
4203
|
+
hint: `Use one of: ${NOTE_STATUSES.join(", ")}.`
|
|
4179
4204
|
});
|
|
4180
4205
|
const supersedes = field("supersedes");
|
|
4181
4206
|
let partialSupersedes;
|
|
@@ -4189,8 +4214,8 @@ const validateEntry = (raw) => {
|
|
|
4189
4214
|
});
|
|
4190
4215
|
} else issues.push({
|
|
4191
4216
|
code: "supersedes_invalid",
|
|
4192
|
-
message: `supersedes ${quote(supersedes)} is not a valid
|
|
4193
|
-
hint: "Ids are four digits (legacy, e.g. 0001) or 26 lowercase base32 characters, as written by `
|
|
4217
|
+
message: `supersedes ${quote(supersedes)} is not a valid note id`,
|
|
4218
|
+
hint: "Ids are four digits (legacy, e.g. 0001) or 26 lowercase base32 characters, as written by `foretext add`."
|
|
4194
4219
|
});
|
|
4195
4220
|
}
|
|
4196
4221
|
const reviewAfter = field("reviewAfter");
|
|
@@ -4223,8 +4248,8 @@ const validateEntry = (raw) => {
|
|
|
4223
4248
|
if (Array.isArray(rawRelated)) {
|
|
4224
4249
|
for (const [position, member] of rawRelated.entries()) if (typeof member !== "string" || !isValidId(member)) issues.push({
|
|
4225
4250
|
code: "related_invalid",
|
|
4226
|
-
message: typeof member === "string" ? `related ${quote(member)} (position ${position + 1}) is not a valid
|
|
4227
|
-
hint: "Related takes exact
|
|
4251
|
+
message: typeof member === "string" ? `related ${quote(member)} (position ${position + 1}) is not a valid note id` : `related (position ${position + 1}) must be an id string, got ${describeValue(member)}`,
|
|
4252
|
+
hint: "Related takes exact note ids: four digits (legacy, e.g. 0001) or 26 lowercase base32 characters. Prefixes are not ids."
|
|
4228
4253
|
});
|
|
4229
4254
|
const strings = rawRelated.filter((m) => typeof m === "string");
|
|
4230
4255
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -4248,7 +4273,7 @@ const validateEntry = (raw) => {
|
|
|
4248
4273
|
related = strings;
|
|
4249
4274
|
} else issues.push({
|
|
4250
4275
|
code: "related_invalid",
|
|
4251
|
-
message: `"related" must be a list of
|
|
4276
|
+
message: `"related" must be a list of note ids, got ${describeValue(rawRelated)}`,
|
|
4252
4277
|
hint: "Write related as a YAML list of exact ids, e.g. related: [\"0002\", \"0003\"], or remove the line."
|
|
4253
4278
|
});
|
|
4254
4279
|
}
|
|
@@ -4311,9 +4336,9 @@ const validateEntry = (raw) => {
|
|
|
4311
4336
|
//#endregion
|
|
4312
4337
|
//#region ../core/src/store.ts
|
|
4313
4338
|
/**
|
|
4314
|
-
* The
|
|
4339
|
+
* The NoteStore service: CRUD over Markdown files with YAML frontmatter.
|
|
4315
4340
|
*
|
|
4316
|
-
* File layout per
|
|
4341
|
+
* File layout per note: <scope-dir>/<id>-<slug>.md
|
|
4317
4342
|
*
|
|
4318
4343
|
* `id` is a ULID-style string (timestamp + randomness, see `newId`) — unique
|
|
4319
4344
|
* across machines without coordination, and lexicographically sortable by
|
|
@@ -4333,8 +4358,8 @@ const validateEntry = (raw) => {
|
|
|
4333
4358
|
* ---
|
|
4334
4359
|
* <markdown body>
|
|
4335
4360
|
*/
|
|
4336
|
-
var
|
|
4337
|
-
const
|
|
4361
|
+
var NoteStore = class extends Context.Service()("NoteStore") {};
|
|
4362
|
+
const toNote = (fm, body, file, metadata) => ({
|
|
4338
4363
|
id: fm.id,
|
|
4339
4364
|
title: fm.title,
|
|
4340
4365
|
type: fm.type,
|
|
@@ -4488,7 +4513,7 @@ const linkDiagnostics = (m, context) => {
|
|
|
4488
4513
|
...base,
|
|
4489
4514
|
code: "related_ambiguous",
|
|
4490
4515
|
message: `related "${relatedId}" is claimed by ${sorted.length} entries: ${sorted.join(", ")}`,
|
|
4491
|
-
hint: "Run `
|
|
4516
|
+
hint: "Run `foretext dedupe` to renumber the extra claimants, or edit \"related\" to the id you mean. This warning is advisory: the entry still reads, but the claimants' duplicate ids make checks fail."
|
|
4492
4517
|
});
|
|
4493
4518
|
}
|
|
4494
4519
|
}
|
|
@@ -4520,20 +4545,20 @@ const rollbackStep = (file, leftBehind, primary, compensation) => Effect.gen(fun
|
|
|
4520
4545
|
if (Result.isSuccess(rolled)) return null;
|
|
4521
4546
|
return new FrontmatterParseError({
|
|
4522
4547
|
file,
|
|
4523
|
-
message: `incomplete rollback: ${leftBehind} may remain in a half-applied state. Primary failure: ${describeError(primary)}. Rollback failure: ${describeError(rolled.failure)}. Run
|
|
4548
|
+
message: `incomplete rollback: ${leftBehind} may remain in a half-applied state. Primary failure: ${describeError(primary)}. Rollback failure: ${describeError(rolled.failure)}. Run foretext check and repair the store by hand.`
|
|
4524
4549
|
});
|
|
4525
4550
|
});
|
|
4526
|
-
/** Build the live
|
|
4527
|
-
const
|
|
4551
|
+
/** Build the live NoteStore from the platform FileSystem + Path services. */
|
|
4552
|
+
const makeNoteStoreLive = (cwd) => Layer.effect(NoteStore, Effect.gen(function* () {
|
|
4528
4553
|
const fs = yield* FileSystem;
|
|
4529
4554
|
const path = yield* Path;
|
|
4530
4555
|
const projectRoot = () => Effect.flatMap(findProjectRoot(fs, path, cwd()), (root) => Effect.succeed(root === null ? Option.none() : Option.some(root)));
|
|
4531
4556
|
const dirForScope = (scope) => Effect.gen(function* () {
|
|
4532
|
-
if (scope === "personal") return
|
|
4557
|
+
if (scope === "personal") return globalNotesDir();
|
|
4533
4558
|
const start = cwd();
|
|
4534
4559
|
const root = yield* findProjectRoot(fs, path, start);
|
|
4535
4560
|
if (root === null) return yield* Effect.fail(new ProjectNotInitializedError({ cwd: start }));
|
|
4536
|
-
return
|
|
4561
|
+
return projectNotesDir(root);
|
|
4537
4562
|
});
|
|
4538
4563
|
/** Read and validate every `.md` candidate in one scope's store.
|
|
4539
4564
|
*
|
|
@@ -4561,7 +4586,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4561
4586
|
const v = validateEntry(raw);
|
|
4562
4587
|
return {
|
|
4563
4588
|
file,
|
|
4564
|
-
|
|
4589
|
+
note: v.frontmatter === void 0 ? void 0 : toNote(v.frontmatter, v.content.trim(), file, v.metadata),
|
|
4565
4590
|
id: v.partial.id,
|
|
4566
4591
|
title: v.partial.title,
|
|
4567
4592
|
scope: v.partial.scope,
|
|
@@ -4578,7 +4603,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4578
4603
|
},
|
|
4579
4604
|
onFailure: (e) => ({
|
|
4580
4605
|
file,
|
|
4581
|
-
|
|
4606
|
+
note: void 0,
|
|
4582
4607
|
id: void 0,
|
|
4583
4608
|
title: void 0,
|
|
4584
4609
|
scope: void 0,
|
|
@@ -4615,7 +4640,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4615
4640
|
message: `filename id "${parsed.id}" does not match frontmatter id "${c.id}"`,
|
|
4616
4641
|
hint: "Fix the filename prefix or frontmatter id so they agree."
|
|
4617
4642
|
});
|
|
4618
|
-
if (c.title !== void 0 && parsed.slug !== slugify(c.title)) cross.push({
|
|
4643
|
+
if (c.title !== void 0 && parsed.slug !== slugify(c.title) && parsed.slug !== slugify(c.title, "engram")) cross.push({
|
|
4619
4644
|
code: "filename_slug_mismatch",
|
|
4620
4645
|
severity: "error",
|
|
4621
4646
|
scope,
|
|
@@ -4650,15 +4675,15 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4650
4675
|
scope,
|
|
4651
4676
|
file,
|
|
4652
4677
|
message: `duplicate id "${id}": also claimed by ${others.join(", ")}`,
|
|
4653
|
-
hint: "Run `
|
|
4678
|
+
hint: "Run `foretext dedupe` to renumber the extras automatically, or renumber/remove them by hand."
|
|
4654
4679
|
});
|
|
4655
4680
|
}
|
|
4656
4681
|
const nowMs = Date.now();
|
|
4657
4682
|
const knownIds = new Set(byId.keys());
|
|
4658
4683
|
const lifecycle = [];
|
|
4659
4684
|
for (const c of candidates) {
|
|
4660
|
-
if (c.
|
|
4661
|
-
lifecycle.push(...lifecycleDiagnostics(c.
|
|
4685
|
+
if (c.note === void 0) continue;
|
|
4686
|
+
lifecycle.push(...lifecycleDiagnostics(c.note, {
|
|
4662
4687
|
scope,
|
|
4663
4688
|
file: c.file,
|
|
4664
4689
|
nowMs,
|
|
@@ -4667,8 +4692,8 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4667
4692
|
}
|
|
4668
4693
|
const links = [];
|
|
4669
4694
|
for (const c of candidates) {
|
|
4670
|
-
if (c.
|
|
4671
|
-
links.push(...linkDiagnostics(c.
|
|
4695
|
+
if (c.note === void 0) continue;
|
|
4696
|
+
links.push(...linkDiagnostics(c.note, {
|
|
4672
4697
|
scope,
|
|
4673
4698
|
file: c.file,
|
|
4674
4699
|
claims: byId
|
|
@@ -4678,7 +4703,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4678
4703
|
scope,
|
|
4679
4704
|
directory: dir,
|
|
4680
4705
|
filesChecked: files.length,
|
|
4681
|
-
entries: candidates.flatMap((c) => c.
|
|
4706
|
+
entries: candidates.flatMap((c) => c.note ? [c.note] : []).sort(chronological),
|
|
4682
4707
|
diagnostics: [
|
|
4683
4708
|
...candidates.flatMap((c) => c.diagnostics),
|
|
4684
4709
|
...cross,
|
|
@@ -4686,7 +4711,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4686
4711
|
...links
|
|
4687
4712
|
].sort(compareDiagnostics),
|
|
4688
4713
|
duplicateIds,
|
|
4689
|
-
omittedFiles: candidates.filter((c) => c.
|
|
4714
|
+
omittedFiles: candidates.filter((c) => c.note === void 0).length
|
|
4690
4715
|
};
|
|
4691
4716
|
});
|
|
4692
4717
|
/** Compatibility view: just the valid entries (see `scan`). */
|
|
@@ -4723,7 +4748,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4723
4748
|
message: detail
|
|
4724
4749
|
}));
|
|
4725
4750
|
}
|
|
4726
|
-
return yield* Effect.fail(new
|
|
4751
|
+
return yield* Effect.fail(new NoteNotFoundError({
|
|
4727
4752
|
id,
|
|
4728
4753
|
scope: scanned.scope
|
|
4729
4754
|
}));
|
|
@@ -4815,13 +4840,13 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4815
4840
|
const hasPendingPublication = (scanned, pending, id) => {
|
|
4816
4841
|
const correction = pending.correction;
|
|
4817
4842
|
const existing = scanned.entries.find((entry) => entry.id === id);
|
|
4818
|
-
if (scanned.duplicateIds.some((claim) => claim.id === id) || existing !== void 0 && (existing.sourceRef !== pendingSourceRef(pending) || correction !== void 0 && existing.supersedes !== correction.originalId)) return Effect.fail(new ValidationError({ message: "The canonical approval ID is already in use. Run
|
|
4843
|
+
if (scanned.duplicateIds.some((claim) => claim.id === id) || existing !== void 0 && (existing.sourceRef !== pendingSourceRef(pending) || correction !== void 0 && existing.supersedes !== correction.originalId)) return Effect.fail(new ValidationError({ message: "The canonical approval ID is already in use. Run foretext check and resolve the ID conflict." }));
|
|
4819
4844
|
return Effect.succeed(existing);
|
|
4820
4845
|
};
|
|
4821
4846
|
const assertPendingEditable = (candidate) => Effect.gen(function* () {
|
|
4822
4847
|
const id = pendingApprovalId(candidate.id, Date.parse(candidate.created));
|
|
4823
4848
|
const scanned = yield* scanStore(candidate.scope);
|
|
4824
|
-
if (yield* hasPendingPublication(scanned, candidate, id)) return yield* Effect.fail(new ValidationError({ message: `This candidate was already published. Retry approval to finish queue cleanup. Use
|
|
4849
|
+
if (yield* hasPendingPublication(scanned, candidate, id)) return yield* Effect.fail(new ValidationError({ message: `This candidate was already published. Retry approval to finish queue cleanup. Use foretext edit on canonical memory ${id} to revise it.` }));
|
|
4825
4850
|
});
|
|
4826
4851
|
const approvePending = (pending, options) => Effect.gen(function* () {
|
|
4827
4852
|
const { scope, created, provenanceClass, correction } = pending;
|
|
@@ -4929,9 +4954,9 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4929
4954
|
*/
|
|
4930
4955
|
const writeWith = (id) => {
|
|
4931
4956
|
const file = path.join(dir, `${id}-${slug}.md`);
|
|
4932
|
-
const
|
|
4933
|
-
return Effect.flatMap(scanGate(
|
|
4934
|
-
...
|
|
4957
|
+
const note = buildCandidate(id, file);
|
|
4958
|
+
return Effect.flatMap(scanGate(note, file, scan), (evaluation) => Effect.flatMap(validateCandidate(note, file), () => Effect.as(fs.writeFileString(file, serialize(note), { flag: "wx" }), {
|
|
4959
|
+
...note,
|
|
4935
4960
|
scan: evaluation
|
|
4936
4961
|
})));
|
|
4937
4962
|
};
|
|
@@ -4957,7 +4982,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4957
4982
|
if (targetId === entryId) return yield* Effect.fail(reject(`supersedes self-reference: "${entryId}" cannot supersede itself`));
|
|
4958
4983
|
const scanned = yield* scanStore(scope);
|
|
4959
4984
|
const claimed = scanned.duplicateIds.find((c) => c.id === targetId);
|
|
4960
|
-
if (claimed !== void 0) return yield* Effect.fail(reject(`supersedes target "${targetId}" is claimed by multiple files (${claimed.files.join(", ")}); resolve the duplicate first, e.g. with
|
|
4985
|
+
if (claimed !== void 0) return yield* Effect.fail(reject(`supersedes target "${targetId}" is claimed by multiple files (${claimed.files.join(", ")}); resolve the duplicate first, e.g. with foretext dedupe`));
|
|
4961
4986
|
const target = scanned.entries.find((m) => m.id === targetId);
|
|
4962
4987
|
if (target === void 0) {
|
|
4963
4988
|
const diagnosed = scanned.diagnostics.filter((d) => parseEntryFilename(path.basename(d.file))?.id === targetId);
|
|
@@ -4987,7 +5012,7 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
4987
5012
|
});
|
|
4988
5013
|
const update = (scope, id, patch, scan, options = {}) => Effect.gen(function* () {
|
|
4989
5014
|
const dir = yield* dirForScope(scope);
|
|
4990
|
-
if (!(yield* fs.exists(dir))) return yield* Effect.fail(new
|
|
5015
|
+
if (!(yield* fs.exists(dir))) return yield* Effect.fail(new NoteNotFoundError({
|
|
4991
5016
|
id,
|
|
4992
5017
|
scope
|
|
4993
5018
|
}));
|
|
@@ -5096,8 +5121,8 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
5096
5121
|
if (scanned.omittedFiles > 0 || otherDefects.length > 0) {
|
|
5097
5122
|
const entryPaths = new Set(scanned.entries.map((m) => m.path));
|
|
5098
5123
|
const badFiles = [...new Set(scanned.diagnostics.filter((d) => !entryPaths.has(d.file)).map((d) => d.file))].sort();
|
|
5099
|
-
const reason = scanned.omittedFiles > 0 ? `${scanned.omittedFiles} of ${scanned.filesChecked} file(s) in "${dir}" could not be read as valid
|
|
5100
|
-
return yield* Effect.fail(new IntegrityCheckFailedError({ message: `refusing to dedupe: ${reason}. Run \`
|
|
5124
|
+
const reason = scanned.omittedFiles > 0 ? `${scanned.omittedFiles} of ${scanned.filesChecked} file(s) in "${dir}" could not be read as valid notes (${badFiles.join(", ")})` : `the store has ${otherDefects.length} diagnostic(s) beyond duplicate ids (e.g. ${path.basename(otherDefects[0].file)})`;
|
|
5125
|
+
return yield* Effect.fail(new IntegrityCheckFailedError({ message: `refusing to dedupe: ${reason}. Run \`foretext check\` for exact paths and repair guidance, then retry.` }));
|
|
5101
5126
|
}
|
|
5102
5127
|
const byId = /* @__PURE__ */ new Map();
|
|
5103
5128
|
for (const m of scanned.entries) byId.set(m.id, [...byId.get(m.id) ?? [], m]);
|
|
@@ -5164,9 +5189,9 @@ const makeEngramStoreLive = (cwd) => Layer.effect(EngramStore, Effect.gen(functi
|
|
|
5164
5189
|
};
|
|
5165
5190
|
}));
|
|
5166
5191
|
/** Store layer pinned to a specific workspace directory. */
|
|
5167
|
-
const
|
|
5192
|
+
const NoteStoreLiveAt = (directory) => makeNoteStoreLive(() => directory);
|
|
5168
5193
|
/** Default store layer; resolves from the process cwd at operation time. */
|
|
5169
|
-
const
|
|
5194
|
+
const NoteStoreLive = makeNoteStoreLive(() => process.cwd());
|
|
5170
5195
|
//#endregion
|
|
5171
5196
|
//#region ../core/src/query.ts
|
|
5172
5197
|
/**
|
|
@@ -5414,7 +5439,7 @@ function prepareContextualEvidence(query, prompt) {
|
|
|
5414
5439
|
].includes(c.field) && c.score > 0).flatMap((c) => c.token === null ? [] : [c.token]));
|
|
5415
5440
|
const matchedUnits = units.filter(({ exact, component }) => matched.has(exact) || component !== void 0 && matched.has(component)).length;
|
|
5416
5441
|
const coverage = units.length ? matchedUnits / units.length : 0;
|
|
5417
|
-
const trigger = result.
|
|
5442
|
+
const trigger = result.note.triggers?.some((t) => normalizeText(t.trim()) === normalizedPrompt) === true;
|
|
5418
5443
|
return {
|
|
5419
5444
|
matchedUnits,
|
|
5420
5445
|
totalUnits: units.length,
|
|
@@ -5427,11 +5452,11 @@ function prepareContextualEvidence(query, prompt) {
|
|
|
5427
5452
|
//#endregion
|
|
5428
5453
|
//#region ../core/src/rank-metadata.ts
|
|
5429
5454
|
const DAY = 864e5;
|
|
5430
|
-
const sortResults = (a, b) => b.score - a.score || a.
|
|
5455
|
+
const sortResults = (a, b) => b.score - a.score || a.note.id.localeCompare(b.note.id);
|
|
5431
5456
|
function adjust(result, field, token, points, explain) {
|
|
5432
5457
|
if (points === 0) return result;
|
|
5433
5458
|
return {
|
|
5434
|
-
|
|
5459
|
+
note: result.note,
|
|
5435
5460
|
score: result.score + points,
|
|
5436
5461
|
...explain ? { explanation: {
|
|
5437
5462
|
mode: "relevance",
|
|
@@ -5471,7 +5496,7 @@ function rankMetadata(results, options) {
|
|
|
5471
5496
|
const now = options.now ?? Date.now();
|
|
5472
5497
|
const explain = options.explain === true;
|
|
5473
5498
|
const ranked = results.map((result) => {
|
|
5474
|
-
const m = result.
|
|
5499
|
+
const m = result.note;
|
|
5475
5500
|
let next = result;
|
|
5476
5501
|
if (effectiveStatus(m, now) !== "active") return next;
|
|
5477
5502
|
if (Number.isInteger(m.importance) && m.importance >= 0 && m.importance <= 5) next = adjust(next, "importance", null, m.importance * .1, explain);
|
|
@@ -5486,7 +5511,7 @@ function rankMetadata(results, options) {
|
|
|
5486
5511
|
const unique = [];
|
|
5487
5512
|
const repeated = [];
|
|
5488
5513
|
for (const result of ranked) {
|
|
5489
|
-
const candidate = fingerprint$1(result.
|
|
5514
|
+
const candidate = fingerprint$1(result.note);
|
|
5490
5515
|
if (candidate && representatives.some((rep) => duplicates(candidate, rep))) repeated.push(result);
|
|
5491
5516
|
else {
|
|
5492
5517
|
unique.push(result);
|
|
@@ -5736,7 +5761,7 @@ function scoreTerm(term, entryIndex, stats, dfMemo, pointsList, contributions) {
|
|
|
5736
5761
|
* term of at least one OR-alternative matches. For legacy parity, pinning can
|
|
5737
5762
|
* also include an entry for plain unscoped alternatives, but never for field
|
|
5738
5763
|
* filters or AND requirements. Results sort score-desc with id-ascending
|
|
5739
|
-
* ties. Lifecycle filtering is the caller's job (
|
|
5764
|
+
* ties. Lifecycle filtering is the caller's job (searchNotes). */
|
|
5740
5765
|
function rankEntries(candidates, parsed, options) {
|
|
5741
5766
|
const explain = options.explain === true;
|
|
5742
5767
|
if (candidates.length === 0 || parsed.alternatives.length === 0) return [];
|
|
@@ -5774,7 +5799,7 @@ function rankEntries(candidates, parsed, options) {
|
|
|
5774
5799
|
let score = 0;
|
|
5775
5800
|
for (const p of pointsList) score += p;
|
|
5776
5801
|
if (score > 0) results.push({
|
|
5777
|
-
|
|
5802
|
+
note: m,
|
|
5778
5803
|
score,
|
|
5779
5804
|
...explain ? { explanation: {
|
|
5780
5805
|
mode: "relevance",
|
|
@@ -5782,7 +5807,7 @@ function rankEntries(candidates, parsed, options) {
|
|
|
5782
5807
|
} } : {}
|
|
5783
5808
|
});
|
|
5784
5809
|
}
|
|
5785
|
-
return results.sort((a, b) => b.score - a.score || a.
|
|
5810
|
+
return results.sort((a, b) => b.score - a.score || a.note.id.localeCompare(b.note.id));
|
|
5786
5811
|
}
|
|
5787
5812
|
//#endregion
|
|
5788
5813
|
//#region ../core/src/abstention.ts
|
|
@@ -5956,13 +5981,13 @@ function abstainPolicy(candidates, parsed, results, params = DEFAULT_ABSTENTION_
|
|
|
5956
5981
|
//#endregion
|
|
5957
5982
|
//#region ../core/src/search.ts
|
|
5958
5983
|
/**
|
|
5959
|
-
* Relevance search over
|
|
5984
|
+
* Relevance search over notes.
|
|
5960
5985
|
*
|
|
5961
5986
|
* ENG-18 default ranker: a BM25-style lexical scorer (see `./rank.js`) over
|
|
5962
5987
|
* the tag, alias, title, type, and body fields, with query syntax from
|
|
5963
5988
|
* `./query.js` (phrases, bounded prefixes, field filters, AND/OR groups).
|
|
5964
5989
|
* The legacy fixed-points ranker (tag +5, title +3, type +2, body +1,
|
|
5965
|
-
* pinned +0.5, substring matching) remains callable as `
|
|
5990
|
+
* pinned +0.5, substring matching) remains callable as `searchNotesLegacy`
|
|
5966
5991
|
* for the benchmark's same-corpus shadow comparison.
|
|
5967
5992
|
*
|
|
5968
5993
|
* Queries and indexed fields are folded with `normalizeText` from
|
|
@@ -5975,16 +6000,16 @@ function activeCandidates(list, options) {
|
|
|
5975
6000
|
return options.includeInactive ? [...list] : list.filter((m) => effectiveStatus(m, nowMs) === "active");
|
|
5976
6001
|
}
|
|
5977
6002
|
function recencyResults(candidates, explain) {
|
|
5978
|
-
return candidates.map((
|
|
5979
|
-
|
|
6003
|
+
return candidates.map((note) => ({
|
|
6004
|
+
note,
|
|
5980
6005
|
score: 0,
|
|
5981
6006
|
...explain ? { explanation: {
|
|
5982
6007
|
mode: "recency",
|
|
5983
6008
|
contributions: []
|
|
5984
6009
|
} } : {}
|
|
5985
|
-
})).sort((a, b) => b.
|
|
6010
|
+
})).sort((a, b) => b.note.updated.localeCompare(a.note.updated) || a.note.id.localeCompare(b.note.id));
|
|
5986
6011
|
}
|
|
5987
|
-
/** Search
|
|
6012
|
+
/** Search notes with the default BM25-style ranker. With no query (or a
|
|
5988
6013
|
* query with no searchable content), returns all sorted by recency.
|
|
5989
6014
|
*
|
|
5990
6015
|
* ENG-17: inactive entries (explicit superseded/archived status, or `expires`
|
|
@@ -6000,7 +6025,7 @@ function recencyResults(candidates, explain) {
|
|
|
6000
6025
|
* (indistinguishable from a no-match query); structured queries (phrases,
|
|
6001
6026
|
* prefixes, field filters, AND) and single-term queries never abstain. See
|
|
6002
6027
|
* `./abstention.js`. */
|
|
6003
|
-
function
|
|
6028
|
+
function searchNotes(list, query, limit, options = {}) {
|
|
6004
6029
|
if (options.currentPath !== void 0 && !validRetrievalPath(options.currentPath)) throw new Error("currentPath must be a repository-relative path without traversal");
|
|
6005
6030
|
const candidates = activeCandidates(list, options).filter((m) => options.currentPath === void 0 || !m.appliesTo?.length || m.appliesTo.some((pattern) => pathApplies(pattern, options.currentPath)));
|
|
6006
6031
|
const parsed = query ? parseQuery(options.literal ? contextualQuery(query) : query) : void 0;
|
|
@@ -6012,20 +6037,20 @@ function searchEngrams(list, query, limit, options = {}) {
|
|
|
6012
6037
|
results = rankEntries(candidates, parsed, { explain: true });
|
|
6013
6038
|
beforeAbstention = results;
|
|
6014
6039
|
if (results.length > 0 && abstainPolicy(candidates, parsed, results)) results = [];
|
|
6015
|
-
if (options.explain !== true) results = results.map(({
|
|
6016
|
-
|
|
6040
|
+
if (options.explain !== true) results = results.map(({ note, score }) => ({
|
|
6041
|
+
note,
|
|
6017
6042
|
score
|
|
6018
6043
|
}));
|
|
6019
6044
|
}
|
|
6020
6045
|
if (parsed && parsed.alternatives.length && query && parsed.alternatives.every((terms) => terms.length === 1 && terms[0].kind === "word" && terms[0].field === void 0)) {
|
|
6021
6046
|
const trigger = normalizeText(query.trim());
|
|
6022
|
-
const byId = new Map(results.map((result) => [result.
|
|
6023
|
-
const lexical = new Map(beforeAbstention.map((result) => [result.
|
|
6024
|
-
for (const
|
|
6025
|
-
if (!
|
|
6026
|
-
const prior = lexical.get(
|
|
6027
|
-
byId.set(
|
|
6028
|
-
|
|
6047
|
+
const byId = new Map(results.map((result) => [result.note, result]));
|
|
6048
|
+
const lexical = new Map(beforeAbstention.map((result) => [result.note, result]));
|
|
6049
|
+
for (const note of candidates) {
|
|
6050
|
+
if (!note.triggers?.some((value) => normalizeText(value.trim()) === trigger)) continue;
|
|
6051
|
+
const prior = lexical.get(note) ?? byId.get(note);
|
|
6052
|
+
byId.set(note, {
|
|
6053
|
+
note,
|
|
6029
6054
|
score: (prior?.score ?? 0) + 4,
|
|
6030
6055
|
...options.explain ? { explanation: {
|
|
6031
6056
|
mode: "relevance",
|
|
@@ -6038,7 +6063,7 @@ function searchEngrams(list, query, limit, options = {}) {
|
|
|
6038
6063
|
} } : {}
|
|
6039
6064
|
});
|
|
6040
6065
|
}
|
|
6041
|
-
results = [...byId.values()].sort((a, b) => b.score - a.score || a.
|
|
6066
|
+
results = [...byId.values()].sort((a, b) => b.score - a.score || a.note.id.localeCompare(b.note.id));
|
|
6042
6067
|
}
|
|
6043
6068
|
if (parsed && parsed.alternatives.length > 0) results = rankMetadata(results, options);
|
|
6044
6069
|
return typeof limit === "number" ? results.slice(0, limit) : results;
|
|
@@ -6120,7 +6145,7 @@ function searchReport(ranked, query, offset = 0, limit) {
|
|
|
6120
6145
|
offset,
|
|
6121
6146
|
limit: limit ?? null,
|
|
6122
6147
|
nextOffset: page.length > 0 && offset + page.length < ranked.length ? offset + page.length : null,
|
|
6123
|
-
results: page.map(({
|
|
6148
|
+
results: page.map(({ note: m, score, explanation }) => ({
|
|
6124
6149
|
id: m.id,
|
|
6125
6150
|
scope: m.scope,
|
|
6126
6151
|
title: m.title,
|
|
@@ -6149,7 +6174,7 @@ function renderSearchExplanation(report) {
|
|
|
6149
6174
|
//#region ../core/src/scope.ts
|
|
6150
6175
|
/**
|
|
6151
6176
|
* Scope resolution helpers. These are pure functions that take the already-
|
|
6152
|
-
* resolved project-root option (from
|
|
6177
|
+
* resolved project-root option (from NoteStore.projectRoot) so they stay free
|
|
6153
6178
|
* of filesystem requirements.
|
|
6154
6179
|
*/
|
|
6155
6180
|
/** Resolve an explicit scope arg, falling back to the default. */
|
|
@@ -6190,16 +6215,16 @@ function summaryLine(m) {
|
|
|
6190
6215
|
return `${m.pinned ? chalk.yellow("★ ") : " "}${chalk.bold(m.id)} ${typeColor(m.type)} ${m.title}${tagsStr(m.tags)}`;
|
|
6191
6216
|
}
|
|
6192
6217
|
/** Render the `list` view. */
|
|
6193
|
-
function renderList(
|
|
6194
|
-
if (!
|
|
6195
|
-
return
|
|
6218
|
+
function renderList(notes) {
|
|
6219
|
+
if (!notes.length) return chalk.gray("(no notes)");
|
|
6220
|
+
return notes.map((m) => {
|
|
6196
6221
|
const line = summaryLine(m);
|
|
6197
6222
|
const meta = chalk.gray(` ${dateShort(m.updated)}${m.author ? ` · ${m.author}` : ""}`);
|
|
6198
6223
|
const preview = m.body ? chalk.gray(` ${truncate$1(m.body, 90)}`) : "";
|
|
6199
6224
|
return `${line}\n${meta}${preview ? "\n" + preview : ""}`;
|
|
6200
6225
|
}).join("\n");
|
|
6201
6226
|
}
|
|
6202
|
-
/** Render a single
|
|
6227
|
+
/** Render a single note in full (the `show` view). */
|
|
6203
6228
|
function renderFull(m) {
|
|
6204
6229
|
const lifecycle = [];
|
|
6205
6230
|
if (m.status !== void 0) lifecycle.push(`status: ${m.status}`);
|
|
@@ -6222,7 +6247,7 @@ function renderFull(m) {
|
|
|
6222
6247
|
/** Render search results with scores. */
|
|
6223
6248
|
function renderSearch(results, query = "") {
|
|
6224
6249
|
if (!results.length) return chalk.gray("(no matches)");
|
|
6225
|
-
return results.map(({
|
|
6250
|
+
return results.map(({ note: m, score }) => {
|
|
6226
6251
|
const line = summaryLine(m);
|
|
6227
6252
|
const meta = chalk.gray(` ${dateShort(m.updated)} · score ${score}${m.author ? ` · ${m.author}` : ""}`);
|
|
6228
6253
|
const snippet = matchingSnippet(m.body, query);
|
|
@@ -6232,13 +6257,13 @@ function renderSearch(results, query = "") {
|
|
|
6232
6257
|
}).join("\n");
|
|
6233
6258
|
}
|
|
6234
6259
|
/** Render an agent-ready context digest (the `context` command). */
|
|
6235
|
-
function renderContext(
|
|
6236
|
-
if (!
|
|
6237
|
-
if (opts.query) return `#
|
|
6238
|
-
const header = `# ${opts.scope === "personal" ?
|
|
6239
|
-
if (opts.full) return header + "\n\n" +
|
|
6240
|
-
const decisions =
|
|
6241
|
-
const rest =
|
|
6260
|
+
function renderContext(notes, opts) {
|
|
6261
|
+
if (!notes.length) return chalk.gray(`No notes in scope "${opts.scope}".`);
|
|
6262
|
+
if (opts.query) return `# Foretext search: "${opts.query}" (${notes.length})\n` + notes.map((m) => `## [${m.id}] ${m.title}\n${m.type} · ${dateShort(m.updated)}${m.author ? ` · ${m.author}` : ""}${tagsStr(m.tags)}\n\n${m.body || "_(no body)_"}`).join("\n\n---\n\n");
|
|
6263
|
+
const header = `# ${opts.scope === "personal" ? `personal note (~/${personalStoreName()})` : `project note${opts.root ? ` (${opts.root})` : ""}`}\n${notes.length} note${notes.length === 1 ? "" : "s"}.`;
|
|
6264
|
+
if (opts.full) return header + "\n\n" + notes.map((m) => `## [${m.id}] ${m.title}\n${m.type}${tagsStr(m.tags)} · ${dateShort(m.updated)}\n\n${m.body || "_(no body)_"}`).join("\n\n---\n\n");
|
|
6265
|
+
const decisions = notes.filter((m) => m.type === "decision" || m.pinned);
|
|
6266
|
+
const rest = notes.filter((m) => !(m.type === "decision" || m.pinned));
|
|
6242
6267
|
const blocks = [];
|
|
6243
6268
|
if (decisions.length) blocks.push(`## Decisions & pinned\n${decisions.map(summaryLine).join("\n")}`);
|
|
6244
6269
|
if (rest.length) blocks.push(`## Other\n${rest.map(summaryLine).join("\n")}`);
|
|
@@ -7663,23 +7688,23 @@ const layer = /*#__PURE__*/ Layer$1.provideMerge(layer$11, /*#__PURE__*/ Layer$1
|
|
|
7663
7688
|
//#endregion
|
|
7664
7689
|
//#region ../core/src/layer.ts
|
|
7665
7690
|
/**
|
|
7666
|
-
* The main application layer: wires the
|
|
7691
|
+
* The main application layer: wires the NoteStore + ConfigRepo services over
|
|
7667
7692
|
* the Node.js platform services (FileSystem, Path, Terminal, ...).
|
|
7668
7693
|
*/
|
|
7669
7694
|
/** Services built on the platform layer (FileSystem/Path satisfied). */
|
|
7670
7695
|
const appServices = (store) => Layer.mergeAll(store, ConfigRepoLive).pipe(Layer.provide(layer));
|
|
7671
7696
|
/**
|
|
7672
|
-
* Provides
|
|
7697
|
+
* Provides NoteStore, ConfigRepo, and the raw platform services
|
|
7673
7698
|
* (FileSystem, Path, Terminal) for commands that need them directly.
|
|
7674
7699
|
*/
|
|
7675
|
-
const MainLive = Layer.mergeAll(appServices(
|
|
7700
|
+
const MainLive = Layer.mergeAll(appServices(NoteStoreLive), layer);
|
|
7676
7701
|
/** Main application layer pinned to a harness-provided workspace directory. */
|
|
7677
|
-
const MainLiveAt = (directory) => Layer.mergeAll(appServices(
|
|
7702
|
+
const MainLiveAt = (directory) => Layer.mergeAll(appServices(NoteStoreLiveAt(directory)), layer);
|
|
7678
7703
|
//#endregion
|
|
7679
7704
|
//#region ../core/src/capture-lock.ts
|
|
7680
7705
|
const busy = new ValidationError({ message: "Project capture controls are busy." });
|
|
7681
7706
|
const unavailable = new ValidationError({ message: "Project capture lock is unavailable." });
|
|
7682
|
-
const legacy = new ValidationError({ message: "Project capture has a legacy lock. Stop all capture processes before removing
|
|
7707
|
+
const legacy = new ValidationError({ message: "Project capture has a legacy lock. Stop all capture processes before removing capture/.lock inside the project memory store." });
|
|
7683
7708
|
let namespace;
|
|
7684
7709
|
const processNamespace = Effect.fnUntraced(function* () {
|
|
7685
7710
|
if (namespace) return namespace;
|
|
@@ -7755,7 +7780,7 @@ const withCaptureLock = (directory, actor, operation) => Effect.gen(function* ()
|
|
|
7755
7780
|
});
|
|
7756
7781
|
//#endregion
|
|
7757
7782
|
//#region ../core/src/capture-fingerprint.json
|
|
7758
|
-
var fingerprint = "
|
|
7783
|
+
var fingerprint = "889cbd7ca9e9d4e17ae73dcc391569eb82b13c570c66d9c599760094d915bb91";
|
|
7759
7784
|
//#endregion
|
|
7760
7785
|
//#region ../../corpus/capture/manifest.json
|
|
7761
7786
|
var manifest_default = {
|
|
@@ -8058,7 +8083,7 @@ const Memory = Schema.Struct({
|
|
|
8058
8083
|
id: Id,
|
|
8059
8084
|
title: Text,
|
|
8060
8085
|
body: Text,
|
|
8061
|
-
type:
|
|
8086
|
+
type: NoteTypeSchema,
|
|
8062
8087
|
scope: ScopeSchema
|
|
8063
8088
|
});
|
|
8064
8089
|
const Evidence = Schema.Struct({
|
|
@@ -8599,7 +8624,7 @@ const State = Schema.Struct({
|
|
|
8599
8624
|
const fail = (message) => new ValidationError({ message });
|
|
8600
8625
|
const controlsUnavailable = () => fail("Project capture controls are unavailable.");
|
|
8601
8626
|
const strict = { onExcessProperty: "error" };
|
|
8602
|
-
const basename = "state.json";
|
|
8627
|
+
const basename$1 = "state.json";
|
|
8603
8628
|
const isExists = (error) => error.reason._tag === "AlreadyExists";
|
|
8604
8629
|
const checkOwned = Effect.fnUntraced(function* (file, actor, type, privateMode = false) {
|
|
8605
8630
|
const fs = yield* FileSystem;
|
|
@@ -8608,7 +8633,7 @@ const checkOwned = Effect.fnUntraced(function* (file, actor, type, privateMode =
|
|
|
8608
8633
|
return stat;
|
|
8609
8634
|
});
|
|
8610
8635
|
const openControls = Effect.fnUntraced(function* () {
|
|
8611
|
-
const store = yield*
|
|
8636
|
+
const store = yield* NoteStore;
|
|
8612
8637
|
const fs = yield* FileSystem;
|
|
8613
8638
|
const path = yield* Path;
|
|
8614
8639
|
const root = Option.getOrUndefined(yield* store.projectRoot());
|
|
@@ -8641,7 +8666,7 @@ const withControls = (use) => Effect.gen(function* () {
|
|
|
8641
8666
|
const path = yield* Path;
|
|
8642
8667
|
const { actualRoot, project, directory, actor } = yield* openControls();
|
|
8643
8668
|
return yield* withCaptureLock(directory, actor, Effect.gen(function* () {
|
|
8644
|
-
const file = path.join(directory, basename);
|
|
8669
|
+
const file = path.join(directory, basename$1);
|
|
8645
8670
|
const ignore = path.join(directory, ".gitignore");
|
|
8646
8671
|
if (!(yield* fs.exists(ignore))) yield* writeAtomicFile(directory, ".gitignore", "/*\n", { mode: 384 }).pipe(Effect.catchIf(isExists, () => Effect.void));
|
|
8647
8672
|
yield* checkOwned(ignore, actor, "File", true);
|
|
@@ -8659,7 +8684,7 @@ const withControls = (use) => Effect.gen(function* () {
|
|
|
8659
8684
|
if (state.project !== project || state.consent && state.consent.actor !== actor || state.report && state.report.value.project !== project) return yield* Effect.fail(controlsUnavailable());
|
|
8660
8685
|
}
|
|
8661
8686
|
const persist = (next) => Effect.gen(function* () {
|
|
8662
|
-
yield* writeAtomicFile(directory, basename, JSON.stringify(next) + "\n", {
|
|
8687
|
+
yield* writeAtomicFile(directory, basename$1, JSON.stringify(next) + "\n", {
|
|
8663
8688
|
mode: 384,
|
|
8664
8689
|
replace: true
|
|
8665
8690
|
});
|
|
@@ -8739,7 +8764,7 @@ const recover = Effect.fnUntraced(function* (controls) {
|
|
|
8739
8764
|
const state = controls.get();
|
|
8740
8765
|
const intent = state.audit.at(-1);
|
|
8741
8766
|
if (intent?.result !== "authorized") return;
|
|
8742
|
-
const scanned = yield* (yield*
|
|
8767
|
+
const scanned = yield* (yield* NoteStore).scan("project");
|
|
8743
8768
|
if (scanned.diagnostics.some(({ severity, code }) => severity === "error" || code === "schema_version_unsupported")) return yield* Effect.fail(controlsUnavailable());
|
|
8744
8769
|
const entry = scanned.entries.find(({ id }) => id === intent.canonicalId);
|
|
8745
8770
|
if (entry && entry.sourceRef !== intent.sample?.candidate) return yield* Effect.fail(controlsUnavailable());
|
|
@@ -8756,7 +8781,7 @@ const recover = Effect.fnUntraced(function* (controls) {
|
|
|
8756
8781
|
const effectiveConfig = Effect.fnUntraced(function* (controls) {
|
|
8757
8782
|
const cfg = yield* ConfigRepo;
|
|
8758
8783
|
yield* checkOwned(projectConfigPath(controls.root), process.geteuid(), "File");
|
|
8759
|
-
yield* checkOwned(
|
|
8784
|
+
yield* checkOwned(projectNotesDir(controls.root), process.geteuid(), "Directory");
|
|
8760
8785
|
if ((yield* cfg.validateProject(controls.root)).length || (yield* cfg.validateGlobal()).length) return yield* Effect.fail(controlsUnavailable());
|
|
8761
8786
|
const project = yield* cfg.loadProject(controls.root);
|
|
8762
8787
|
if (project.secretScan !== void 0 && project.secretScan !== "block") return yield* Effect.fail(controlsUnavailable());
|
|
@@ -8926,7 +8951,7 @@ const recordProjectCapture = (candidate, signal, recheck) => withControls((contr
|
|
|
8926
8951
|
yield* suspend(controls, "config_unavailable");
|
|
8927
8952
|
return yield* pending("config_unavailable");
|
|
8928
8953
|
}
|
|
8929
|
-
const store = yield*
|
|
8954
|
+
const store = yield* NoteStore;
|
|
8930
8955
|
const fs = yield* FileSystem;
|
|
8931
8956
|
const path = yield* Path;
|
|
8932
8957
|
const configRepo = yield* ConfigRepo;
|
|
@@ -9013,7 +9038,7 @@ const importLocation = (source) => source.format === "pack" ? {
|
|
|
9013
9038
|
};
|
|
9014
9039
|
const reviewImport = (proposals, scope, cwd, apply) => {
|
|
9015
9040
|
const review = Effect.gen(function* () {
|
|
9016
|
-
const store = yield*
|
|
9041
|
+
const store = yield* NoteStore;
|
|
9017
9042
|
const pending = yield* Effect.forEach(yield* listPendingIds(scope, cwd), (id) => readPendingCandidate(scope, id, cwd).pipe(Effect.catchIf((error) => error._tag === "PlatformError" && error.reason._tag === "NotFound", () => Effect.succeed(void 0))));
|
|
9018
9043
|
const { entries, omittedFiles, duplicateIds } = yield* store.scan(scope);
|
|
9019
9044
|
if (omittedFiles || duplicateIds.length) return yield* Effect.fail(new ValidationError({ message: "Memory store needs repair." }));
|
|
@@ -9161,4 +9186,4 @@ const reviewImport = (proposals, scope, cwd, apply) => {
|
|
|
9161
9186
|
return apply ? withPendingAdmissionLock(scope, review, cwd) : review;
|
|
9162
9187
|
};
|
|
9163
9188
|
//#endregion
|
|
9164
|
-
export { writeAtomicFile as $,
|
|
9189
|
+
export { writeAtomicFile as $, NoteStore as A, NOTE_STATUSES as At, readPendingCandidate as B, parseTimestamp as Bt, searchPaginationError as C, formatDomainError as Ct, searchNotes as D, DEFAULT_AUTO_CONTEXT_SCOPE as Dt, openingSnippet as E, DEFAULT_AUTO_CONTEXT_MAX_CHARS as Et, inspectPendingCandidate as F, detectAuthor as Ft, correctionBaseline as G, removePendingCandidate as H, validateAliases as Ht, isPendingCandidateId as I, isValidId as It, packSlug as J, parseRepositoryReference as K, listPendingIds as L, normalizeAliases as Lt, CaptureMessageId as M, SECRET_POLICIES as Mt, CaptureSource as N, SOURCE_TYPES as Nt, contextualQuery as O, DEFAULT_PERSONAL_SECRET_SCAN as Ot, enqueuePendingCandidate as P, effectiveStatus as Pt, findProjectRoot as Q, parsePendingPatch as R, parseEntryFilename as Rt, renderSearchExplanation as S, ValidationError as St, matchingSnippet as T, AUTO_CONTEXT_SCOPES as Tt, withPendingAdmissionLock as U, rejectPendingCandidate as V, splitAliasList as Vt, withPendingCandidateLock as W, scanContent as X, resolveSecretPolicy as Y, findGitRoot as Z, renderList as _, compareDiagnostics as _t, recordProjectCapture as a, LEGACY_NOTES_NAME as at, resolveScope as b, InvalidTypeError as bt, isDuplicate as c, globalNotesDir as ct, ensureGitignoreLine as d, personalStoreName as dt, pathApplies as et, removeGitignoreLine as f, projectConfigPath as ft, renderLinks as g, projectStoreName as gt, renderFull as h, projectReadmePath as ht, captureControl as i, DEFAULT_STORE_NAME as it, validateEntry as j, NOTE_TYPES as jt, prepareContextualEvidence as k, DEFAULT_SECRET_SCAN as kt, MainLive as l, globalRoot as lt, renderContext as m, projectNotesDir as mt, reviewImport as n, ConfigRepo as nt, CAPTURE_RULES_VERSION as o, LEGACY_STORE_NAME as ot, linkRows as p, projectDir as pt, packEntryPath as q, auditCaptureDuplicate as r, DEFAULT_NOTES_NAME as rt, evaluateCapture as s, globalConfigPath as st, importLocation as t, validRetrievalPath as tt, MainLiveAt as u, notesDirectoryName as ut, renderSearch as v, incompleteMemoryWarning as vt, searchReport as w, formatWriteAdvisory as wt, scopesToQuery as x, ProjectNotInitializedError as xt, isValidScopeArg as y, IntegrityCheckFailedError as yt, patchPendingCandidate as z, parseTags as zt };
|