@north-light/crouter 0.3.227 → 0.3.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +5 -5
- package/dist/api/client.js +3 -3
- package/dist/api/dto/broker-ops.d.ts +8 -0
- package/dist/api/dto/memory.d.ts +8 -7
- package/dist/api/dto/memory.js +2 -2
- package/dist/builtin-memory/04-base-worker.md +1 -1
- package/dist/builtin-memory/insights/init.md +5 -5
- package/dist/builtin-memory/internal/INDEX.md +1 -1
- package/dist/builtin-memory/internal/agent-shaping.md +11 -11
- package/dist/builtin-memory/internal/examples/INDEX.md +1 -1
- package/dist/builtin-memory/internal/memory-loading.md +6 -6
- package/dist/builtin-memory/internal/plugins.md +1 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +50 -37
- package/dist/clients/attach/__tests__/pane-tag-successor.test.js +56 -0
- package/dist/clients/attach/__tests__/profile-files.test.js +21 -0
- package/dist/clients/attach/chrome/inbox-strip.js +11 -7
- package/dist/clients/attach/session/pane-tag.d.ts +28 -2
- package/dist/clients/attach/session/pane-tag.js +48 -22
- package/dist/clients/attach/session/profile-files.d.ts +6 -0
- package/dist/clients/attach/session/profile-files.js +44 -11
- package/dist/clients/attach/slash/dispatch.js +4 -7
- package/dist/clients/attach/viewer.js +588 -596
- package/dist/commands/__tests__/surface-reload-target.test.js +21 -0
- package/dist/commands/api-client.d.ts +3 -7
- package/dist/commands/api-client.js +7 -12
- package/dist/commands/memory/__tests__/command-selector-and-mutation-guards.test.js +292 -0
- package/dist/commands/memory/__tests__/repository-root-lint.test.js +146 -0
- package/dist/commands/memory/delete.js +51 -24
- package/dist/commands/memory/edit.js +50 -10
- package/dist/commands/memory/find.js +105 -56
- package/dist/commands/memory/history.js +51 -31
- package/dist/commands/memory/lint.d.ts +0 -9
- package/dist/commands/memory/lint.js +78 -322
- package/dist/commands/memory/list.d.ts +12 -4
- package/dist/commands/memory/list.js +64 -25
- package/dist/commands/memory/move.js +103 -73
- package/dist/commands/memory/origin.js +35 -5
- package/dist/commands/memory/read.d.ts +4 -0
- package/dist/commands/memory/read.js +132 -80
- package/dist/commands/memory/shared.d.ts +115 -25
- package/dist/commands/memory/shared.js +331 -74
- package/dist/commands/memory/write.js +72 -21
- package/dist/commands/memory.js +2 -2
- package/dist/commands/node/create.d.ts +1 -1
- package/dist/commands/node/create.js +1 -1
- package/dist/commands/node/inspect.js +1 -1
- package/dist/commands/node/lifecycle.js +5 -5
- package/dist/commands/pkg/market-manage.js +25 -24
- package/dist/commands/pkg/plugin-manage.d.ts +22 -6
- package/dist/commands/pkg/plugin-manage.js +118 -25
- package/dist/commands/pkg/shared.d.ts +8 -0
- package/dist/commands/pkg/shared.js +23 -20
- package/dist/commands/surface-reload.d.ts +5 -0
- package/dist/commands/surface-reload.js +9 -1
- package/dist/commands/sys/__tests__/migrate.test.js +1140 -22
- package/dist/commands/sys/__tests__/sync-project-guidance.test.js +218 -0
- package/dist/commands/sys/migrate.js +126 -140
- package/dist/commands/sys/panels/profiles-panel.d.ts +66 -0
- package/dist/commands/sys/panels/profiles-panel.js +599 -0
- package/dist/commands/sys/settings-shell.d.ts +4 -2
- package/dist/commands/sys/settings-shell.js +35 -4
- package/dist/commands/sys/settings.js +21 -5
- package/dist/commands/sys/sync-deps.d.ts +2 -0
- package/dist/commands/sys/sync-deps.js +26 -15
- package/dist/commands/sys/sync-project-guidance.js +228 -145
- package/dist/commands/sys/sync-skills.js +28 -17
- package/dist/commands/sys/update.js +11 -3
- package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +15 -2
- package/dist/core/__tests__/config-change-delta.test.js +106 -0
- package/dist/core/__tests__/context-intro.test.js +13 -9
- package/dist/core/__tests__/daemon-boot.test.js +22 -16
- package/dist/core/__tests__/fixtures/memory-slash-live-probe.js +5 -1
- package/dist/core/__tests__/human-deliver.test.js +19 -0
- package/dist/core/__tests__/inline-memory-refs.test.js +50 -46
- package/dist/core/__tests__/{serial → integration}/broker-fork-seam.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/broker-sdk-wiring.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/broker-snapshot-history.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/command-plugins.test.js +94 -3
- package/dist/core/__tests__/{serial → integration}/deferred-no-wake.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/flagship-lifecycle.test.js +13 -27
- package/dist/core/__tests__/{serial → integration}/host-teardown-process-group.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/human-deliver-e2e.test.js +1 -1
- package/dist/core/__tests__/{live-mutation-verbs.test.js → integration/live-mutation-verbs.test.js} +22 -33
- package/dist/core/__tests__/{serial → integration}/live-mutation.test.js +21 -41
- package/dist/core/__tests__/integration/refresh-stall-recycle.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/refresh-stall-recycle.test.js +1 -1
- package/dist/core/__tests__/integration/revive.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/revive.test.js +38 -19
- package/dist/core/__tests__/integration/spawn-root.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/spawn-root.test.js +104 -1
- package/dist/core/__tests__/integration/subscription-delivery.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/subscription-delivery.test.js +1 -1
- package/dist/core/__tests__/integration/tmux-surface.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/tmux-surface.test.js +1 -1
- package/dist/core/__tests__/integration/worktree-land.test.d.ts +1 -0
- package/dist/core/__tests__/integration/worktree-land.test.js +400 -0
- package/dist/core/__tests__/integration/worktree-reap.test.d.ts +1 -0
- package/dist/core/__tests__/{serial/worktree.test.js → integration/worktree-reap.test.js} +6 -338
- package/dist/core/__tests__/kickoff.test.js +16 -5
- package/dist/core/__tests__/memory-resolver-precedence.test.js +122 -91
- package/dist/core/__tests__/nested-store-discovery.test.js +5 -3
- package/dist/core/__tests__/on-read-crouter-home-fence.test.js +2 -1
- package/dist/core/__tests__/on-read-dedup-resume.test.js +39 -27
- package/dist/core/__tests__/on-read-nested-store.test.js +19 -13
- package/dist/core/__tests__/profile-project-memory-delivery.test.js +138 -44
- package/dist/core/__tests__/repository-association.test.d.ts +1 -0
- package/dist/core/__tests__/repository-association.test.js +153 -0
- package/dist/core/__tests__/repository-root-identity.test.d.ts +1 -0
- package/dist/core/__tests__/repository-root-identity.test.js +219 -0
- package/dist/core/__tests__/review-model-floor.test.js +12 -4
- package/dist/core/__tests__/seam/memory-slash-node-relative-inventory.test.js +27 -11
- package/dist/core/__tests__/warm-claim-preference-snapshot.test.d.ts +1 -0
- package/dist/core/__tests__/warm-claim-preference-snapshot.test.js +40 -0
- package/dist/core/canvas/canvas.d.ts +3 -0
- package/dist/core/canvas/canvas.js +30 -10
- package/dist/core/canvas/db.js +28 -1
- package/dist/core/canvas/paths.d.ts +4 -6
- package/dist/core/canvas/paths.js +8 -6
- package/dist/core/canvas/render-source.js +2 -2
- package/dist/core/canvas/types.d.ts +9 -13
- package/dist/core/config.d.ts +3 -3
- package/dist/core/config.js +3 -3
- package/dist/core/exclusive-lock.d.ts +2 -0
- package/dist/core/exclusive-lock.js +21 -0
- package/dist/core/git.d.ts +0 -1
- package/dist/core/git.js +0 -3
- package/dist/core/human/__tests__/integration/inbox-core.test.d.ts +1 -0
- package/dist/core/human/feedback-companion.js +3 -0
- package/dist/core/human/scan.js +8 -1
- package/dist/core/keybindings/catalog.d.ts +2 -2
- package/dist/core/keybindings/catalog.js +2 -1
- package/dist/core/memory/doc-link-grammar.js +2 -2
- package/dist/core/memory/history.d.ts +24 -0
- package/dist/core/memory/history.js +66 -1
- package/dist/core/memory/identity.d.ts +65 -0
- package/dist/core/memory/identity.js +185 -0
- package/dist/core/memory/inline-ref-guidance.d.ts +1 -1
- package/dist/core/memory/inline-ref-guidance.js +1 -1
- package/dist/core/memory/inline-ref-inventory.d.ts +3 -10
- package/dist/core/memory/inline-ref-inventory.js +30 -62
- package/dist/core/memory/lint.d.ts +129 -0
- package/dist/core/memory/lint.js +517 -0
- package/dist/core/memory/project-namespace.d.ts +31 -0
- package/dist/core/memory/project-namespace.js +85 -0
- package/dist/core/memory/repository-association.d.ts +31 -0
- package/dist/core/memory/repository-association.js +129 -0
- package/dist/core/memory/tree.d.ts +39 -0
- package/dist/core/memory/tree.js +93 -0
- package/dist/core/memory-resolver.d.ts +193 -90
- package/dist/core/memory-resolver.js +461 -375
- package/dist/core/nested-stores.js +6 -13
- package/dist/core/profiles/select.d.ts +4 -1
- package/dist/core/profiles/select.js +108 -48
- package/dist/core/review/__tests__/capture-origin.test.js +2 -2
- package/dist/core/review/__tests__/stage-identity.test.js +2 -2
- package/dist/core/review/companion.js +11 -2
- package/dist/core/runtime/bearings.d.ts +2 -2
- package/dist/core/runtime/bearings.js +3 -3
- package/dist/core/runtime/broker/daemon-ops.d.ts +2 -2
- package/dist/core/runtime/broker/rebind.js +5 -0
- package/dist/core/runtime/broker-extension-render.d.ts +7 -3
- package/dist/core/runtime/broker-extension-render.js +10 -5
- package/dist/core/runtime/broker-persona-guidance.d.ts +19 -5
- package/dist/core/runtime/broker-persona-guidance.js +122 -27
- package/dist/core/runtime/deliver-live.d.ts +16 -4
- package/dist/core/runtime/deliver-live.js +29 -15
- package/dist/core/runtime/kickoff.d.ts +3 -3
- package/dist/core/runtime/kickoff.js +8 -16
- package/dist/core/runtime/launch.js +1 -1
- package/dist/core/runtime/lifecycle.js +2 -3
- package/dist/core/runtime/nodes.d.ts +3 -4
- package/dist/core/runtime/nodes.js +3 -4
- package/dist/core/runtime/persona.d.ts +8 -12
- package/dist/core/runtime/persona.js +24 -96
- package/dist/core/runtime/promote.d.ts +2 -2
- package/dist/core/runtime/promote.js +8 -21
- package/dist/core/runtime/revive.js +20 -17
- package/dist/core/runtime/spawn.js +18 -7
- package/dist/core/runtime/tmux-bindings.js +2 -3
- package/dist/core/runtime/warm-pool.js +3 -4
- package/dist/core/scope.js +2 -0
- package/dist/core/self-update.d.ts +0 -2
- package/dist/core/self-update.js +2 -35
- package/dist/core/substrate/__tests__/surface-match-memory-read.test.d.ts +1 -0
- package/dist/core/substrate/__tests__/surface-match-memory-read.test.js +28 -0
- package/dist/core/substrate/index.d.ts +2 -2
- package/dist/core/substrate/index.js +1 -1
- package/dist/core/substrate/injected-store.d.ts +43 -27
- package/dist/core/substrate/injected-store.js +208 -104
- package/dist/core/substrate/listings.d.ts +19 -12
- package/dist/core/substrate/listings.js +75 -52
- package/dist/core/substrate/on-read-node.d.ts +4 -7
- package/dist/core/substrate/on-read-node.js +6 -8
- package/dist/core/substrate/on-read.d.ts +22 -25
- package/dist/core/substrate/on-read.js +103 -147
- package/dist/core/substrate/render-node.d.ts +4 -7
- package/dist/core/substrate/render-node.js +5 -7
- package/dist/core/substrate/render.d.ts +21 -3
- package/dist/core/substrate/render.js +291 -223
- package/dist/core/substrate/schema.d.ts +1 -13
- package/dist/core/substrate/schema.js +5 -40
- package/dist/core/substrate/session-cache.d.ts +14 -4
- package/dist/core/substrate/session-cache.js +40 -22
- package/dist/core/substrate/surface-match.d.ts +9 -7
- package/dist/core/substrate/surface-match.js +26 -25
- package/dist/daemon/__tests__/helpers/source-daemon.d.ts +30 -0
- package/dist/daemon/__tests__/helpers/source-daemon.js +174 -0
- package/dist/daemon/__tests__/integration/migration-startup.test.d.ts +1 -0
- package/dist/daemon/__tests__/integration/migration-startup.test.js +97 -0
- package/dist/daemon/api/__tests__/bridge-heartbeat.test.js +21 -5
- package/dist/daemon/api/handlers/broker-ops.js +21 -16
- package/dist/daemon/api/handlers/memory.js +2 -0
- package/dist/daemon/crtrd.js +2 -0
- package/dist/daemon/human/finish.js +8 -1
- package/dist/daemon/manage.d.ts +0 -1
- package/dist/daemon/manage.js +7 -16
- package/dist/daemon/startup-policy.d.ts +1 -0
- package/dist/daemon/startup-policy.js +1 -0
- package/dist/migrations/001-surfaces-frontmatter.js +21 -109
- package/dist/migrations/002-profile-project-memory.js +1 -0
- package/dist/migrations/003-repository-root-memory-identity/front-door.d.ts +26 -0
- package/dist/migrations/003-repository-root-memory-identity/front-door.js +231 -0
- package/dist/migrations/003-repository-root-memory-identity/index.d.ts +2 -0
- package/dist/migrations/003-repository-root-memory-identity/index.js +513 -0
- package/dist/migrations/003-repository-root-memory-identity/references.d.ts +95 -0
- package/dist/migrations/003-repository-root-memory-identity/references.js +469 -0
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.d.ts +39 -0
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.js +349 -0
- package/dist/migrations/__tests__/activation-concurrency.test.d.ts +1 -0
- package/dist/migrations/__tests__/activation-concurrency.test.js +145 -0
- package/dist/migrations/__tests__/activation.test.d.ts +1 -0
- package/dist/migrations/__tests__/activation.test.js +149 -0
- package/dist/migrations/__tests__/deletion-and-root-declaration.test.d.ts +1 -0
- package/dist/migrations/__tests__/deletion-and-root-declaration.test.js +149 -0
- package/dist/migrations/activation.d.ts +16 -0
- package/dist/migrations/activation.js +78 -0
- package/dist/migrations/convergent.d.ts +14 -3
- package/dist/migrations/convergent.js +21 -10
- package/dist/migrations/corpus.d.ts +78 -0
- package/dist/migrations/corpus.js +497 -0
- package/dist/migrations/frontmatter-splice.d.ts +15 -0
- package/dist/migrations/frontmatter-splice.js +176 -0
- package/dist/migrations/registry.d.ts +6 -1
- package/dist/migrations/registry.js +7 -2
- package/dist/migrations/runner.d.ts +41 -0
- package/dist/migrations/runner.js +81 -0
- package/dist/migrations/types.d.ts +148 -9
- package/dist/migrations/types.js +9 -2
- package/dist/pi-extensions/__tests__/canvas-context-intro.test.js +225 -17
- package/dist/pi-extensions/__tests__/canvas-goal-capture-envelope.test.js +11 -3
- package/dist/pi-extensions/canvas-context-intro.d.ts +3 -5
- package/dist/pi-extensions/canvas-context-intro.js +50 -46
- package/dist/pi-extensions/canvas-doc-substrate.d.ts +1 -8
- package/dist/pi-extensions/canvas-doc-substrate.js +55 -122
- package/dist/pi-extensions/canvas-stophook.js +6 -13
- package/dist/shared/generated-context.d.ts +0 -3
- package/dist/shared/generated-context.js +0 -57
- package/dist/shared/tool-groups.js +2 -3
- package/dist/types.d.ts +8 -11
- package/dist/types.js +4 -31
- package/package.json +5 -4
- package/runtime.lock.json +2 -2
- package/dist/builtin-memory/05-kinds/design/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/design/01-orchestrator.md +0 -15
- package/dist/builtin-memory/05-kinds/design/design-contract.md +0 -19
- package/dist/builtin-memory/05-kinds/developer/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/developer/01-orchestrator.md +0 -15
- package/dist/builtin-memory/05-kinds/plan/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/01-orchestrator.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/plan-contract.md +0 -28
- package/dist/builtin-memory/05-kinds/plan/reviewers/architecture-fit.md +0 -15
- package/dist/builtin-memory/05-kinds/plan/reviewers/code-smells.md +0 -15
- package/dist/builtin-memory/05-kinds/plan/reviewers/lens-contract.md +0 -13
- package/dist/builtin-memory/05-kinds/plan/reviewers/pattern-consistency.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/reviewers/requirements-coverage.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +0 -17
- package/dist/builtin-memory/05-kinds/spec/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +0 -15
- package/dist/builtin-memory/05-kinds/spec/requirements.md +0 -15
- package/dist/builtin-memory/design/guide.md +0 -35
- package/dist/builtin-memory/design/roadmap.md +0 -21
- package/dist/builtin-memory/development.md +0 -113
- package/dist/builtin-memory/plan/roadmap.md +0 -25
- package/dist/builtin-memory/spec/guide.md +0 -53
- package/dist/builtin-memory/spec/requirements.md +0 -29
- package/dist/builtin-memory/spec/roadmap.md +0 -36
- package/dist/builtin-memory/testing.md +0 -39
- /package/dist/api/__tests__/{serial → integration}/client.test.d.ts +0 -0
- /package/dist/api/__tests__/{serial → integration}/client.test.js +0 -0
- /package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/{serial → integration}/provider-rotation.test.ts +0 -0
- /package/dist/clients/{inbox/__tests__/serial/inbox-controller.test.d.ts → attach/__tests__/pane-tag-successor.test.d.ts} +0 -0
- /package/dist/clients/{inbox/__tests__/serial/mount-panel.test.d.ts → attach/__tests__/profile-files.test.d.ts} +0 -0
- /package/dist/{core/__tests__/live-mutation-verbs.test.d.ts → clients/inbox/__tests__/integration/inbox-controller.test.d.ts} +0 -0
- /package/dist/clients/inbox/__tests__/{serial → integration}/inbox-controller.test.js +0 -0
- /package/dist/{core/__tests__/serial/broker-fork-seam.test.d.ts → clients/inbox/__tests__/integration/mount-panel.test.d.ts} +0 -0
- /package/dist/clients/inbox/__tests__/{serial → integration}/mount-panel.test.js +0 -0
- /package/dist/{core/__tests__/serial/broker-sdk-wiring.test.d.ts → commands/__tests__/surface-reload-target.test.d.ts} +0 -0
- /package/dist/{core/__tests__/serial/broker-snapshot-history.test.d.ts → commands/memory/__tests__/command-selector-and-mutation-guards.test.d.ts} +0 -0
- /package/dist/{core/__tests__/serial/command-plugins.test.d.ts → commands/memory/__tests__/repository-root-lint.test.d.ts} +0 -0
- /package/dist/{core/__tests__/serial/deferred-no-wake.test.d.ts → commands/sys/__tests__/sync-project-guidance.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/flagship-lifecycle.test.d.ts → config-change-delta.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/host-teardown-process-group.test.d.ts → integration/broker-fork-seam.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/human-deliver-e2e.test.d.ts → integration/broker-sdk-wiring.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/live-mutation.test.d.ts → integration/broker-snapshot-history.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/refresh-stall-recycle.test.d.ts → integration/command-plugins.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/revive.test.d.ts → integration/deferred-no-wake.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/spawn-root.test.d.ts → integration/flagship-lifecycle.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/subscription-delivery.test.d.ts → integration/host-teardown-process-group.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/tmux-surface.test.d.ts → integration/human-deliver-e2e.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/worktree.test.d.ts → integration/live-mutation-verbs.test.d.ts} +0 -0
- /package/dist/core/{human/__tests__/serial/inbox-core.test.d.ts → __tests__/integration/live-mutation.test.d.ts} +0 -0
- /package/dist/core/human/__tests__/{serial → integration}/inbox-core.test.js +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// identity.ts — the ONE memory-identity rule. Every loader, placement helper,
|
|
2
|
+
// linter, and migration derives names here rather than reproducing string
|
|
3
|
+
// arithmetic: a document has a store-local name, its store declares a namespace
|
|
4
|
+
// (a project's declaration, an installed plugin's mount prefix, or empty), and
|
|
5
|
+
// its canonical name — the only address resolution accepts — is namespace ⊕
|
|
6
|
+
// local. Pure and side-effect free.
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Segment normalization — the optional `NN-` ordering pin. A physical path may
|
|
9
|
+
// carry a two-digit prefix on any segment (`00-runtime-base/`, `01-spine/`)
|
|
10
|
+
// purely to pin structural order against natural sort. The prefix is NEVER part
|
|
11
|
+
// of identity: only the physical path keeps it.
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
const NUMERIC_PREFIX_RE = /^\d{2}-/;
|
|
14
|
+
const SEGMENT_RE = /^[A-Za-z0-9._-]+$/;
|
|
15
|
+
/** The filename (and path segment) whose document fronts its directory. */
|
|
16
|
+
export const INDEX_SEGMENT = 'INDEX';
|
|
17
|
+
/** Strip an optional `NN-` ordering prefix from ONE segment. */
|
|
18
|
+
export function normalizeNameSegment(segment) {
|
|
19
|
+
return segment.replace(NUMERIC_PREFIX_RE, '');
|
|
20
|
+
}
|
|
21
|
+
/** Slugify one authored or filesystem label into a canonical segment. */
|
|
22
|
+
export function slugCanonicalSegment(raw) {
|
|
23
|
+
return normalizeNameSegment(raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, ''));
|
|
24
|
+
}
|
|
25
|
+
/** Slugify a derived label into canonical path segments. Empty segments are
|
|
26
|
+
* intentionally dropped; owner paths use slugCanonicalSegment directly. */
|
|
27
|
+
export function slugCanonicalPath(raw) {
|
|
28
|
+
return raw
|
|
29
|
+
.replace(/\\/g, '/')
|
|
30
|
+
.replace(/\.md$/i, '')
|
|
31
|
+
.split('/')
|
|
32
|
+
.map(slugCanonicalSegment)
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join('/');
|
|
35
|
+
}
|
|
36
|
+
/** Strip the ordering prefix from EVERY segment of a slash-separated name:
|
|
37
|
+
* `01-spine/00-has-manager` -> `spine/has-manager`. */
|
|
38
|
+
export function normalizeDocName(name) {
|
|
39
|
+
return name.split('/').map(normalizeNameSegment).join('/');
|
|
40
|
+
}
|
|
41
|
+
/** Split a name into segments, dropping empties from `//`, a leading `/`, or an
|
|
42
|
+
* empty name. */
|
|
43
|
+
export function canonicalSegments(name) {
|
|
44
|
+
return name.split('/').filter((s) => s !== '');
|
|
45
|
+
}
|
|
46
|
+
/** The canonical directory containing `name`, or `''` at the top. */
|
|
47
|
+
export function canonicalParent(name) {
|
|
48
|
+
const segments = canonicalSegments(name);
|
|
49
|
+
return segments.slice(0, -1).join('/');
|
|
50
|
+
}
|
|
51
|
+
/** Remove EXACTLY ONE trailing `INDEX` segment. `a/INDEX` -> `a`; `INDEX` ->
|
|
52
|
+
* `''` (a store root); `a/INDEX/INDEX` -> `a/INDEX` (the inner segment is an
|
|
53
|
+
* ordinary directory name). */
|
|
54
|
+
export function collapseTrailingIndex(name) {
|
|
55
|
+
const segments = canonicalSegments(name);
|
|
56
|
+
if (segments[segments.length - 1] === INDEX_SEGMENT)
|
|
57
|
+
segments.pop();
|
|
58
|
+
return segments.join('/');
|
|
59
|
+
}
|
|
60
|
+
/** Normalized identity segments of a store-relative markdown path, extension
|
|
61
|
+
* stripped. */
|
|
62
|
+
function pathIdentitySegments(physicalRelativePath) {
|
|
63
|
+
return canonicalSegments(physicalRelativePath.replace(/\\/g, '/').replace(/\.md$/i, '')).map(normalizeNameSegment);
|
|
64
|
+
}
|
|
65
|
+
/** Which form a store-relative markdown path takes. */
|
|
66
|
+
export function representationForPath(physicalRelativePath) {
|
|
67
|
+
const segments = pathIdentitySegments(physicalRelativePath);
|
|
68
|
+
return segments[segments.length - 1] === INDEX_SEGMENT ? 'directory-index' : 'leaf-file';
|
|
69
|
+
}
|
|
70
|
+
/** Store-local name derived from a store-relative markdown path: ordering
|
|
71
|
+
* prefixes stripped from every segment and one trailing `INDEX` collapsed.
|
|
72
|
+
* Empty only for a store root `INDEX.md`. */
|
|
73
|
+
export function localNameFromPath(physicalRelativePath) {
|
|
74
|
+
return collapseTrailingIndex(pathIdentitySegments(physicalRelativePath).join('/'));
|
|
75
|
+
}
|
|
76
|
+
/** The store-relative markdown path a local name occupies in a given form.
|
|
77
|
+
* Both forms are checked before any create or move, so occupancy never depends
|
|
78
|
+
* on which one a store happens to use. */
|
|
79
|
+
export function physicalRelativePathFor(localName, representation) {
|
|
80
|
+
const local = canonicalSegments(localName).join('/');
|
|
81
|
+
if (local === '') {
|
|
82
|
+
if (representation === 'leaf-file')
|
|
83
|
+
throw new Error('a store root document has no leaf-file representation');
|
|
84
|
+
return `${INDEX_SEGMENT}.md`;
|
|
85
|
+
}
|
|
86
|
+
return representation === 'directory-index' ? `${local}/${INDEX_SEGMENT}.md` : `${local}.md`;
|
|
87
|
+
}
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Local name and canonical composition.
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
/** A document's explicit frontmatter `name` as a local name — normalized with
|
|
92
|
+
* one trailing `INDEX` collapsed — or `null` when it carries none. */
|
|
93
|
+
export function explicitLocalName(fm) {
|
|
94
|
+
const raw = fm?.['name'];
|
|
95
|
+
if (typeof raw !== 'string' || raw.trim() === '')
|
|
96
|
+
return null;
|
|
97
|
+
return collapseTrailingIndex(normalizeDocName(raw.trim()));
|
|
98
|
+
}
|
|
99
|
+
/** A document's store-local name: its explicit frontmatter `name` when present,
|
|
100
|
+
* else the path-derived local name. Explicit names are local to their store —
|
|
101
|
+
* they never carry the store's namespace. */
|
|
102
|
+
export function resolveLocalName(fm, pathDerivedLocalName) {
|
|
103
|
+
return explicitLocalName(fm) ?? pathDerivedLocalName;
|
|
104
|
+
}
|
|
105
|
+
/** namespace ⊕ local — the only address. Composition is unconditional: a local
|
|
106
|
+
* name that already looks namespace-prefixed is composed anyway, so identity
|
|
107
|
+
* never depends on string coincidence. An empty result means a namespace-less
|
|
108
|
+
* store root, which has no valid canonical identity. */
|
|
109
|
+
export function composeCanonicalName(namespace, localName) {
|
|
110
|
+
const ns = canonicalSegments(namespace).join('/');
|
|
111
|
+
const local = canonicalSegments(localName).join('/');
|
|
112
|
+
if (ns === '')
|
|
113
|
+
return local;
|
|
114
|
+
return local === '' ? ns : `${ns}/${local}`;
|
|
115
|
+
}
|
|
116
|
+
/** The canonical directory a document's `./` memory-read entries match against:
|
|
117
|
+
* a directory document anchors at its own name, an ordinary leaf at its
|
|
118
|
+
* canonical parent. */
|
|
119
|
+
export function routingAnchorFor(canonicalName, representation) {
|
|
120
|
+
return representation === 'directory-index' ? canonicalSegments(canonicalName).join('/') : canonicalParent(canonicalName);
|
|
121
|
+
}
|
|
122
|
+
/** The local name a canonical name has inside `namespace`, or `null` when it
|
|
123
|
+
* falls outside it. Exact on segment boundaries: `a/bc` is not inside `a/b`.
|
|
124
|
+
* The namespace itself yields `''` — the store root document. */
|
|
125
|
+
export function stripNamespace(canonicalName, namespace) {
|
|
126
|
+
const name = canonicalSegments(canonicalName);
|
|
127
|
+
const ns = canonicalSegments(namespace);
|
|
128
|
+
for (let i = 0; i < ns.length; i++) {
|
|
129
|
+
if (name[i] !== ns[i])
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
return name.slice(ns.length).join('/');
|
|
133
|
+
}
|
|
134
|
+
function invalidSegmentReason(name) {
|
|
135
|
+
for (const segment of name.split('/')) {
|
|
136
|
+
if (segment === '')
|
|
137
|
+
return `empty segment in \`${name}\``;
|
|
138
|
+
if (segment === '.' || segment === '..')
|
|
139
|
+
return `relative segment \`${segment}\` in \`${name}\``;
|
|
140
|
+
if (!SEGMENT_RE.test(segment))
|
|
141
|
+
return `segment \`${segment}\` is not [A-Za-z0-9._-]`;
|
|
142
|
+
if (NUMERIC_PREFIX_RE.test(segment)) {
|
|
143
|
+
return `segment \`${segment}\` carries an \`NN-\` ordering prefix, which is physical-path-only — use \`${normalizeNameSegment(segment)}\``;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
/** A project store's declared namespace, or an installed plugin's mount prefix:
|
|
149
|
+
* one or more normalized segments, never ending in `INDEX`. */
|
|
150
|
+
export function validateNamespace(namespace) {
|
|
151
|
+
if (namespace.trim() !== namespace)
|
|
152
|
+
return { ok: false, reason: 'namespace has surrounding whitespace' };
|
|
153
|
+
if (namespace === '')
|
|
154
|
+
return { ok: false, reason: 'namespace is empty' };
|
|
155
|
+
const badSegment = invalidSegmentReason(namespace);
|
|
156
|
+
if (badSegment !== null)
|
|
157
|
+
return { ok: false, reason: badSegment };
|
|
158
|
+
if (canonicalSegments(namespace).pop() === INDEX_SEGMENT) {
|
|
159
|
+
return { ok: false, reason: `namespace ends in \`${INDEX_SEGMENT}\`` };
|
|
160
|
+
}
|
|
161
|
+
return { ok: true };
|
|
162
|
+
}
|
|
163
|
+
/** An explicit non-root `name:`: a non-empty local name, never ending in
|
|
164
|
+
* `INDEX` (its directory name is the identity) and never carrying its own
|
|
165
|
+
* store's namespace. */
|
|
166
|
+
export function validateExplicitLocalName(localName, namespace = '') {
|
|
167
|
+
if (localName.trim() !== localName)
|
|
168
|
+
return { ok: false, reason: 'name has surrounding whitespace' };
|
|
169
|
+
if (localName === '')
|
|
170
|
+
return { ok: false, reason: 'name is empty' };
|
|
171
|
+
const badSegment = invalidSegmentReason(localName);
|
|
172
|
+
if (badSegment !== null)
|
|
173
|
+
return { ok: false, reason: badSegment };
|
|
174
|
+
if (canonicalSegments(localName).pop() === INDEX_SEGMENT) {
|
|
175
|
+
const collapsed = collapseTrailingIndex(localName);
|
|
176
|
+
return {
|
|
177
|
+
ok: false,
|
|
178
|
+
reason: `name ends in \`${INDEX_SEGMENT}\` — a directory document answers at its directory name${collapsed === '' ? '' : `, so use \`${collapsed}\``}`,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
if (namespace !== '' && stripNamespace(localName, namespace) !== null) {
|
|
182
|
+
return { ok: false, reason: `name repeats its store's namespace \`${namespace}\` — explicit names are store-local` };
|
|
183
|
+
}
|
|
184
|
+
return { ok: true };
|
|
185
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolve every slash token in `text` against `names` (
|
|
2
|
+
* Resolve every slash token in `text` against `names` (the exact canonical
|
|
3
3
|
* `buildRefInventory().names` set), collapse duplicates, and return one
|
|
4
4
|
* directive line per distinct resolved ref in FIRST-APPEARANCE order.
|
|
5
5
|
* Returns `null` when no token resolves, so the broker sends no guidance
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { findRefTokens } from './inline-ref-grammar.js';
|
|
12
12
|
const GUIDANCE_HEADER = 'The user explicitly called out specific memories. Read the relevant mentioned memory files:';
|
|
13
13
|
/**
|
|
14
|
-
* Resolve every slash token in `text` against `names` (
|
|
14
|
+
* Resolve every slash token in `text` against `names` (the exact canonical
|
|
15
15
|
* `buildRefInventory().names` set), collapse duplicates, and return one
|
|
16
16
|
* directive line per distinct resolved ref in FIRST-APPEARANCE order.
|
|
17
17
|
* Returns `null` when no token resolves, so the broker sends no guidance
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import type { RefMeta } from '../runtime/broker-protocol.js';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* both kinds, no gate/rung/`slash` filtering. Returns display metadata
|
|
6
|
-
* (`refs`, stably sorted by winning scope then name) plus the resolution set
|
|
7
|
-
* (`names` — doc names plus every proper directory prefix, because a bare-dir
|
|
8
|
-
* ref is a legal listing link) that both the broker's per-submission resolver
|
|
9
|
-
* and `buildGuidance` test tokens against. `refs` additionally labels Gateway
|
|
10
|
-
* eligibility; the terminal viewer still receives every referenceable row.
|
|
11
|
-
*/
|
|
2
|
+
/** Build the inline inventory from exact target-view winners. `refs` carries
|
|
3
|
+
* metadata rows; `names` adds only canonical directory nodes with members for
|
|
4
|
+
* browse links. Gates, rungs, and `slash` do not affect referenceability. */
|
|
12
5
|
export declare function buildRefInventory(): {
|
|
13
6
|
refs: RefMeta[];
|
|
14
7
|
names: Set<string>;
|
|
@@ -1,41 +1,13 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// shelled out.
|
|
7
|
-
//
|
|
8
|
-
// This is deliberately NOT `crtr memory list`'s inventory:
|
|
9
|
-
// • listAllMemoryDocs() is called with NO scope arg, so inside a running
|
|
10
|
-
// node (CRTR_NODE_ID set) the corpus already includes node > project
|
|
11
|
-
// stack > profile > user > builtin, nearest first.
|
|
12
|
-
// • Dedup is first-wins by NAME alone (not `scope/name`) — a slash token
|
|
13
|
-
// maps to exactly one `crtr memory read <name>`, so two same-named docs
|
|
14
|
-
// at different scopes must collapse to one inventory row, and the
|
|
15
|
-
// winning (nearest) doc supplies the display fields.
|
|
16
|
-
// • No gate / visibility-rung / `slash` filtering. Referenceability is
|
|
17
|
-
// "resolves in this node's corpus," full stop — gates/rungs govern
|
|
18
|
-
// automatic boot/on-read surfacing only (spec §7.1), and `slash` governs
|
|
19
|
-
// command registration only (spec §4.3). An explicit human reference
|
|
20
|
-
// outranks both.
|
|
21
|
-
// • Directory names are referenceable too: a bare-dir `[[ref]]` opens the
|
|
22
|
-
// directory's listing through `crtr memory read <dir>`, so every proper
|
|
23
|
-
// name-prefix of a winning doc joins the resolution set — resolution
|
|
24
|
-
// only, never a display row.
|
|
25
|
-
// • A malformed doc (no valid `kind`) is already dropped by
|
|
26
|
-
// `parseSubstrateDoc` returning null, so it never reaches the winners map.
|
|
27
|
-
//
|
|
28
|
-
// `buildRefInventory` is called fresh per read-op / per submission by the
|
|
29
|
-
// broker (src/core/runtime/broker.ts), which memoizes it and rebuilds on
|
|
30
|
-
// `/reload` — this module itself holds no cache beyond the session parse
|
|
31
|
-
// cache it reads through.
|
|
32
|
-
import { listAllMemoryDocs } from '../memory-resolver.js';
|
|
1
|
+
// Authoritative broker-side inventory for inline memory references. It uses one
|
|
2
|
+
// target view, exact canonical winners, and the canonical tree for directory
|
|
3
|
+
// browse names; gates, rungs, and slash flags do not affect referenceability.
|
|
4
|
+
import { loadMemoryTargetView } from '../memory-resolver.js';
|
|
5
|
+
import { buildMemoryTree } from './tree.js';
|
|
33
6
|
import { memoryExtensionEffectiveCatalog, projectEffectiveMemoryExtensions } from './extensions.js';
|
|
34
7
|
import { parseSubstrateDoc } from '../substrate/schema.js';
|
|
35
|
-
import { cachedAllMemoryDocsInclusive, cachedSubstrateDocsInclusive } from '../substrate/session-cache.js';
|
|
36
8
|
// Display-sort weight matching resolution precedence (node > project >
|
|
37
|
-
// profile > user > builtin) — display-only; resolution itself is
|
|
38
|
-
// name
|
|
9
|
+
// profile > user > builtin) — display-only; resolution itself is exact
|
|
10
|
+
// canonical-name membership (`names.has(candidate)`).
|
|
39
11
|
const SCOPE_SORT_RANK = {
|
|
40
12
|
node: 0,
|
|
41
13
|
project: 1,
|
|
@@ -43,28 +15,22 @@ const SCOPE_SORT_RANK = {
|
|
|
43
15
|
user: 3,
|
|
44
16
|
builtin: 4,
|
|
45
17
|
};
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* both kinds, no gate/rung/`slash` filtering. Returns display metadata
|
|
50
|
-
* (`refs`, stably sorted by winning scope then name) plus the resolution set
|
|
51
|
-
* (`names` — doc names plus every proper directory prefix, because a bare-dir
|
|
52
|
-
* ref is a legal listing link) that both the broker's per-submission resolver
|
|
53
|
-
* and `buildGuidance` test tokens against. `refs` additionally labels Gateway
|
|
54
|
-
* eligibility; the terminal viewer still receives every referenceable row.
|
|
55
|
-
*/
|
|
18
|
+
/** Build the inline inventory from exact target-view winners. `refs` carries
|
|
19
|
+
* metadata rows; `names` adds only canonical directory nodes with members for
|
|
20
|
+
* browse links. Gates, rungs, and `slash` do not affect referenceability. */
|
|
56
21
|
export function buildRefInventory() {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
22
|
+
const target = {
|
|
23
|
+
cwd: process.cwd(),
|
|
24
|
+
profileId: process.env['CRTR_PROFILE_ID'] || null,
|
|
25
|
+
nodeId: process.env['CRTR_NODE_ID'] || null,
|
|
26
|
+
};
|
|
27
|
+
const view = loadMemoryTargetView(target, { quiet: true });
|
|
63
28
|
const winners = new Map();
|
|
64
|
-
for (const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
29
|
+
for (const candidateSet of view.candidateSets()) {
|
|
30
|
+
const memoryDoc = candidateSet.winner;
|
|
31
|
+
const doc = parseSubstrateDoc(memoryDoc);
|
|
32
|
+
if (doc !== null)
|
|
33
|
+
winners.set(candidateSet.name, { doc, memoryDoc });
|
|
68
34
|
}
|
|
69
35
|
const refs = [];
|
|
70
36
|
for (const [name, { doc, memoryDoc }] of winners) {
|
|
@@ -79,12 +45,14 @@ export function buildRefInventory() {
|
|
|
79
45
|
return a.name.localeCompare(b.name);
|
|
80
46
|
});
|
|
81
47
|
const names = new Set(refs.map((r) => r.name));
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
48
|
+
const tree = buildMemoryTree([...winners.values()].map(({ memoryDoc }) => memoryDoc));
|
|
49
|
+
const addDirectoryNames = (node) => {
|
|
50
|
+
if (node.name !== '' && (node.childDirectories.length > 0 || node.childDocuments.length > 0)) {
|
|
51
|
+
names.add(node.name);
|
|
52
|
+
}
|
|
53
|
+
for (const child of node.childDirectories)
|
|
54
|
+
addDirectoryNames(child);
|
|
55
|
+
};
|
|
56
|
+
addDirectoryNames(tree.root);
|
|
89
57
|
return { refs, names };
|
|
90
58
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { type MemoryDoc, type MemoryScope, type MemoryStoreDescriptor, type MemoryTarget } from '../memory-resolver.js';
|
|
2
|
+
export type MemoryLintSeverity = 'error' | 'warning' | 'notice';
|
|
3
|
+
export type MemoryLintRule =
|
|
4
|
+
/** Frontmatter does not parse as YAML. */
|
|
5
|
+
'yaml'
|
|
6
|
+
/** Substrate frontmatter contract violation. */
|
|
7
|
+
| 'schema'
|
|
8
|
+
/** A plugin-declared `extensions` value is invalid. */
|
|
9
|
+
| 'extension'
|
|
10
|
+
/** Body longer than its delivery entries earn. */
|
|
11
|
+
| 'length'
|
|
12
|
+
/** A body short enough to inline still pays a routing line. */
|
|
13
|
+
| 'short-preview'
|
|
14
|
+
/** A `memory-read` glob that fires on every memory read. */
|
|
15
|
+
| 'broad-memory-read'
|
|
16
|
+
/** A project store the runtime refuses to mount: no/invalid repository-root `namespace:`. */
|
|
17
|
+
| 'store-namespace'
|
|
18
|
+
/** `namespace:` declared anywhere but the repository-root store's root INDEX.md. */
|
|
19
|
+
| 'namespace-placement'
|
|
20
|
+
/** Two owner directories in one repository normalize to one effective prefix. */
|
|
21
|
+
| 'owner-path-collision'
|
|
22
|
+
/** `name:` on a store's root INDEX.md, whose identity is the namespace. */
|
|
23
|
+
| 'root-name'
|
|
24
|
+
/** A root INDEX.md in a store that declares no namespace — no address. */
|
|
25
|
+
| 'root-index-unaddressable'
|
|
26
|
+
/** An explicit non-root `name:` that is not a valid store-local name. */
|
|
27
|
+
| 'local-name'
|
|
28
|
+
/** Two files in ONE store owning the same canonical identity. */
|
|
29
|
+
| 'canonical-collision'
|
|
30
|
+
/** One canonical identity held by several stores (inspection data). */
|
|
31
|
+
| 'cross-store-candidates'
|
|
32
|
+
/** A `[[link]]` that resolves to no document or directory. */
|
|
33
|
+
| 'dangling-link'
|
|
34
|
+
/** A `memory-read` route that matches no canonical name. */
|
|
35
|
+
| 'memory-read-route'
|
|
36
|
+
/** A project store's workspace front door is missing or not its root doc. */
|
|
37
|
+
| 'front-door'
|
|
38
|
+
/** Boot entries in a nested store, which never rides the boot catalog. */
|
|
39
|
+
| 'nested-store-boot'
|
|
40
|
+
/** Reference checks skipped because the store's identities are undetermined. */
|
|
41
|
+
| 'reference-check-deferred';
|
|
42
|
+
/** The rules that decide whether a corpus is COMPATIBLE with exact canonical
|
|
43
|
+
* identity — what a plugin candidate gate, the builtin build gate, and
|
|
44
|
+
* migration verification refuse a corpus on, independent of authoring-quality
|
|
45
|
+
* rules such as length or routing lines. */
|
|
46
|
+
export declare const MEMORY_LINT_IDENTITY_RULES: ReadonlySet<MemoryLintRule>;
|
|
47
|
+
export interface MemoryLintFinding {
|
|
48
|
+
severity: MemoryLintSeverity;
|
|
49
|
+
rule: MemoryLintRule;
|
|
50
|
+
/** The markdown file, store root, or project directory at fault. */
|
|
51
|
+
path: string;
|
|
52
|
+
message: string;
|
|
53
|
+
scope?: MemoryScope;
|
|
54
|
+
storeRoot?: string;
|
|
55
|
+
/** The canonical identity the finding is about, when it has one. */
|
|
56
|
+
name?: string;
|
|
57
|
+
/** Every physical path sharing a collided identity, read winner first. */
|
|
58
|
+
paths?: readonly string[];
|
|
59
|
+
}
|
|
60
|
+
export interface MemoryLintResult {
|
|
61
|
+
/** No `error` findings. */
|
|
62
|
+
ok: boolean;
|
|
63
|
+
/** Markdown files examined, including non-document files (`SKILL.md`,
|
|
64
|
+
* `MEMORY.md`) that are YAML-checked but never loaded as documents. */
|
|
65
|
+
checked: number;
|
|
66
|
+
/** Of `checked`, the files the substrate actually loads as memory
|
|
67
|
+
* documents — `checked` minus `SKILL.md`/`MEMORY.md`. */
|
|
68
|
+
documents: number;
|
|
69
|
+
storesLinted: number;
|
|
70
|
+
/** Every finding, in emission order. */
|
|
71
|
+
findings: readonly MemoryLintFinding[];
|
|
72
|
+
errors: readonly MemoryLintFinding[];
|
|
73
|
+
warnings: readonly MemoryLintFinding[];
|
|
74
|
+
notices: readonly MemoryLintFinding[];
|
|
75
|
+
}
|
|
76
|
+
export interface MemoryLintTargetResult extends MemoryLintResult {
|
|
77
|
+
/** Every store the target saw, mounted or not, in precedence order. */
|
|
78
|
+
stores: readonly MemoryStoreDescriptor[];
|
|
79
|
+
/** Projects the selected profile manages that were checked for a workspace
|
|
80
|
+
* front door — zero under a scope filter that excludes project stores. */
|
|
81
|
+
profileProjects: number;
|
|
82
|
+
}
|
|
83
|
+
/** The length rule. Caps come from the parsed entries — an invalid entry already
|
|
84
|
+
* fails the schema check, so it simply matches no cap here. `docName` is the
|
|
85
|
+
* doc's canonical identity; persona layers under `kinds/` are never capped. */
|
|
86
|
+
export declare function lintBodyLength(fm: Record<string, unknown>, body: string, docName: string): string | null;
|
|
87
|
+
/** Warn when a body short enough to inline still pays a routing line. */
|
|
88
|
+
export declare function lintShortPreviewBody(fm: Record<string, unknown>, body: string): string | null;
|
|
89
|
+
/** Every canonical name a reference may target in a corpus: each document's
|
|
90
|
+
* exact identity plus every canonical directory, because reading a directory
|
|
91
|
+
* answers with its own document and its listing. Derived from the canonical
|
|
92
|
+
* tree, never from string prefixes of a name. */
|
|
93
|
+
export declare function resolvableCanonicalNames(docs: readonly MemoryDoc[]): Set<string>;
|
|
94
|
+
export interface MemoryLintStoreOptions {
|
|
95
|
+
/** Canonical names a `[[link]]` or route may target — the target view the
|
|
96
|
+
* store's documents are read in. Omit to skip reference checks entirely
|
|
97
|
+
* (a store linted in isolation, such as the builtin corpus at build time,
|
|
98
|
+
* passes only its own names). */
|
|
99
|
+
resolvable?: ReadonlySet<string>;
|
|
100
|
+
/** Whether a project store must carry a workspace front door: `required` for
|
|
101
|
+
* a profile-managed project, `advisory` (warning) for an unmanaged one that
|
|
102
|
+
* was asked about directly, `ignore` otherwise. A front door on any doc but
|
|
103
|
+
* the store root is an error under every mode. */
|
|
104
|
+
frontDoor?: 'required' | 'advisory' | 'ignore';
|
|
105
|
+
/** A store discovered BELOW the mounted project roots: the boot catalog never
|
|
106
|
+
* includes one, so its boot entries are inert. */
|
|
107
|
+
nestedStore?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/** Lint ONE physical store, whether or not the runtime mounts it. An undeclared
|
|
110
|
+
* or invalid project store still has its files checked — every store-local rule
|
|
111
|
+
* holds before a namespace exists — but its references are deferred, because
|
|
112
|
+
* the identities its links resolve against are undetermined until migration
|
|
113
|
+
* declares the namespace. */
|
|
114
|
+
export declare function lintMemoryStore(store: MemoryStoreDescriptor, options?: MemoryLintStoreOptions): MemoryLintResult;
|
|
115
|
+
export interface MemoryLintTargetOptions {
|
|
116
|
+
/** Whose view to lint. Default: the ambient process (cwd + CRTR_PROFILE_ID +
|
|
117
|
+
* CRTR_NODE_ID). */
|
|
118
|
+
target?: MemoryTarget;
|
|
119
|
+
/** Restrict to one source class. Front-door coverage applies only to an
|
|
120
|
+
* unfiltered or project-scoped view. */
|
|
121
|
+
scope?: MemoryScope;
|
|
122
|
+
/** Also lint `.crouter/memory` stores discovered below the mounted project
|
|
123
|
+
* roots. Default true: they are addressable, so they are lintable. */
|
|
124
|
+
includeDescendants?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** Lint every store a target sees, then the diagnostics only the merged view
|
|
127
|
+
* produces: references resolved against the view's canonical names, and equal
|
|
128
|
+
* canonical identities held by several stores. */
|
|
129
|
+
export declare function lintMemoryTarget(options?: MemoryLintTargetOptions): MemoryLintTargetResult;
|