@opum-ai/lore 0.1.0 → 0.2.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.
Files changed (90) hide show
  1. package/README.md +33 -22
  2. package/bin/lore.cjs +35 -7
  3. package/package.json +17 -17
  4. package/src/adapters/backlog.ts +0 -1084
  5. package/src/adapters/git.ts +0 -221
  6. package/src/cli.ts +0 -667
  7. package/src/commands/agent.ts +0 -301
  8. package/src/commands/agents.ts +0 -302
  9. package/src/commands/args.ts +0 -209
  10. package/src/commands/changed.ts +0 -70
  11. package/src/commands/check.ts +0 -1031
  12. package/src/commands/codex-bridge.ts +0 -49
  13. package/src/commands/concurrency.ts +0 -48
  14. package/src/commands/context.ts +0 -292
  15. package/src/commands/discover.ts +0 -89
  16. package/src/commands/explorer.ts +0 -253
  17. package/src/commands/export.ts +0 -93
  18. package/src/commands/fswrite.ts +0 -928
  19. package/src/commands/graph.ts +0 -291
  20. package/src/commands/help.ts +0 -151
  21. package/src/commands/impact.ts +0 -59
  22. package/src/commands/init.ts +0 -583
  23. package/src/commands/instructions.ts +0 -91
  24. package/src/commands/link.ts +0 -929
  25. package/src/commands/new.ts +0 -476
  26. package/src/commands/orphans.ts +0 -457
  27. package/src/commands/path.ts +0 -67
  28. package/src/commands/provenance.ts +0 -68
  29. package/src/commands/query.ts +0 -312
  30. package/src/commands/reconcile-shared.ts +0 -280
  31. package/src/commands/rename.ts +0 -585
  32. package/src/commands/replace.ts +0 -320
  33. package/src/commands/scaffold.ts +0 -346
  34. package/src/commands/schema.ts +0 -293
  35. package/src/commands/snapshot.ts +0 -130
  36. package/src/commands/supersede.ts +0 -400
  37. package/src/commands/sync.ts +0 -371
  38. package/src/commands/tasks.ts +0 -271
  39. package/src/commands/traversal.ts +0 -151
  40. package/src/commands/validate.ts +0 -226
  41. package/src/config.ts +0 -598
  42. package/src/core/agent-bridge.ts +0 -287
  43. package/src/core/agent-context.ts +0 -498
  44. package/src/core/agent-profile.ts +0 -447
  45. package/src/core/bundle.ts +0 -893
  46. package/src/core/check.ts +0 -853
  47. package/src/core/codex-bridge.ts +0 -100
  48. package/src/core/concept.ts +0 -597
  49. package/src/core/consumer-scaffold.ts +0 -433
  50. package/src/core/context.ts +0 -271
  51. package/src/core/explorer-contract.ts +0 -441
  52. package/src/core/explorer-qualification.ts +0 -58
  53. package/src/core/explorer.ts +0 -518
  54. package/src/core/finding.ts +0 -31
  55. package/src/core/graph.ts +0 -201
  56. package/src/core/indexes.ts +0 -436
  57. package/src/core/instructions.ts +0 -209
  58. package/src/core/ladybug-driver.ts +0 -1795
  59. package/src/core/ladybug-lifecycle.ts +0 -1178
  60. package/src/core/ladybug-native.ts +0 -95
  61. package/src/core/ladybug-source.ts +0 -667
  62. package/src/core/links.ts +0 -681
  63. package/src/core/log.ts +0 -253
  64. package/src/core/managed-block.ts +0 -540
  65. package/src/core/manifest.ts +0 -718
  66. package/src/core/order.ts +0 -13
  67. package/src/core/profile.ts +0 -1007
  68. package/src/core/projection.ts +0 -195
  69. package/src/core/query.ts +0 -542
  70. package/src/core/reconcile.ts +0 -236
  71. package/src/core/replace.ts +0 -419
  72. package/src/core/retrieval.ts +0 -213
  73. package/src/core/rewrite.ts +0 -940
  74. package/src/core/scaffold.ts +0 -255
  75. package/src/core/schema.ts +0 -366
  76. package/src/core/snapshot-runtime.ts +0 -52
  77. package/src/core/snapshot-store.ts +0 -287
  78. package/src/core/snapshot.ts +0 -711
  79. package/src/core/template.ts +0 -429
  80. package/src/core/traversal.ts +0 -487
  81. package/src/core/validate.ts +0 -517
  82. package/src/core/workspace-contract.ts +0 -473
  83. package/src/core/workspace-projection.ts +0 -365
  84. package/src/core/workspace-retrieval.ts +0 -196
  85. package/src/core/workspace-source.ts +0 -174
  86. package/src/errors.ts +0 -697
  87. package/src/meta.ts +0 -7
  88. package/src/output.ts +0 -589
  89. package/src/scripts/upstream-backlog-watch.ts +0 -288
  90. package/src/state.ts +0 -390
@@ -1,213 +0,0 @@
1
- /**
2
- * Backend selection for Lore's existing graph/query/context contracts.
3
- *
4
- * The indexed path reads one completely verified immutable Ladybug generation
5
- * into the same BundleGraph model the reference filesystem loader produces.
6
- * Selection and fallback complete before a command renders or writes output.
7
- */
8
-
9
- import { join } from "node:path";
10
- import type { BacklogAdapter } from "../adapters/backlog";
11
- import { LoreError, WarningCollector } from "../errors";
12
- import { type BundleGraph, loadBundle } from "./bundle";
13
- import { reconcileLadybugProjection } from "./ladybug-lifecycle";
14
- import {
15
- EXPECTED_LADYBUG_STORAGE_VERSION,
16
- EXPECTED_LADYBUG_VERSION,
17
- type LadybugIndexedReader,
18
- type LadybugNativeLoader,
19
- loadLadybugNativeDriver,
20
- memoizeLadybugNativeLoader,
21
- supportsLadybugNative,
22
- } from "./ladybug-native";
23
- import { loadLadybugProjectionFreshness, loadLadybugProjectionSource } from "./ladybug-source";
24
- import { loadProfile } from "./profile";
25
- import { DOCS_DIR } from "./scaffold";
26
- import { buildTraversalSnapshot, type TraversalSnapshot } from "./traversal";
27
- import {
28
- loadWorkspaceRetrievalGraph,
29
- type WorkspaceRetrievalContext,
30
- type WorkspaceRetrievalSelection,
31
- } from "./workspace-retrieval";
32
-
33
- export type RetrievalBackend = "indexed" | "reference";
34
- export type RetrievalPolicy = "auto" | RetrievalBackend;
35
-
36
- /** Internal provenance proving which verified snapshot supplied an indexed graph. */
37
- export interface IndexedRetrievalProvenance {
38
- readonly repositoryScopeKey: string;
39
- readonly snapshotKey: string;
40
- readonly sourceFingerprint: string;
41
- readonly exportDigest: string;
42
- readonly gitCommit: string | null;
43
- }
44
-
45
- export interface RetrievalGraph {
46
- readonly graph: BundleGraph;
47
- /** Bounded persisted operations available only for a verified indexed generation. */
48
- readonly indexed?: LadybugIndexedReader;
49
- /** Release native resources owned by this retrieval load. */
50
- readonly dispose?: () => Promise<void>;
51
- readonly backend: RetrievalBackend;
52
- readonly provenance?: IndexedRetrievalProvenance;
53
- /** Explicit multi-repository scope; absent for byte-compatible repository-local retrieval. */
54
- readonly workspace?: WorkspaceRetrievalContext;
55
- /** Exact typed authored facts for bounded path and impact operations. */
56
- readonly traversal?: TraversalSnapshot;
57
- }
58
-
59
- export interface RetrievalGraphOptions {
60
- readonly root: string;
61
- readonly warnings?: WarningCollector;
62
- readonly adapter?: BacklogAdapter;
63
- readonly resolveGitCommit?: (root: string) => string | null;
64
- /** Internal test/conformance control; never exposed as a public CLI flag. */
65
- readonly policy?: RetrievalPolicy;
66
- /** Injectable platform fact for objective Windows-safe fallback coverage. */
67
- readonly platform?: NodeJS.Platform;
68
- /** Injectable lazy native boundary for load-order and failure tests. */
69
- readonly loadNativeDriver?: LadybugNativeLoader;
70
- /** Explicit workspace selection; absence preserves the repository-local M6 path. */
71
- readonly workspace?: WorkspaceRetrievalSelection;
72
- /** Load the typed authored-edge traversal snapshot beside the concept graph. */
73
- readonly includeTraversal?: boolean;
74
- }
75
-
76
- export type RetrievalGraphLoader = (options: RetrievalGraphOptions) => Promise<RetrievalGraph>;
77
-
78
- /**
79
- * Select a verified indexed graph when supported and usable, otherwise load the
80
- * existing in-memory graph. Failed indexed warnings and data are discarded so a
81
- * fallback run has exactly the reference path's observable stderr/stdout.
82
- */
83
- export async function loadRetrievalGraph(options: RetrievalGraphOptions): Promise<RetrievalGraph> {
84
- if (options.workspace !== undefined) {
85
- return loadWorkspaceRetrievalGraph({
86
- root: options.root,
87
- selection: options.workspace,
88
- warnings: options.warnings,
89
- adapter: options.adapter,
90
- policy: options.policy,
91
- platform: options.platform,
92
- loadNativeDriver: options.loadNativeDriver,
93
- sourceOptions: {
94
- adapterForRoot: (root) => (root === options.root ? options.adapter : undefined),
95
- },
96
- includeTraversal: options.includeTraversal,
97
- });
98
- }
99
- const policy = options.policy ?? "auto";
100
- if (policy === "reference") {
101
- return loadReferenceGraph(options);
102
- }
103
- if (!supportsLadybugNative(options.platform)) {
104
- if (policy === "indexed") {
105
- throw indexedUnavailable();
106
- }
107
- return loadReferenceGraph(options);
108
- }
109
-
110
- let indexedWarnings = new WarningCollector();
111
- const loadNative = memoizeLadybugNativeLoader(options.loadNativeDriver ?? loadLadybugNativeDriver);
112
- const loadSource = async () => {
113
- const attemptWarnings = new WarningCollector();
114
- const source = await loadLadybugProjectionSource({
115
- root: options.root,
116
- ladybugVersion: EXPECTED_LADYBUG_VERSION,
117
- ladybugStorageVersion: EXPECTED_LADYBUG_STORAGE_VERSION,
118
- adapter: options.adapter,
119
- resolveGitCommit: options.resolveGitCommit,
120
- warnings: attemptWarnings,
121
- });
122
- indexedWarnings = attemptWarnings;
123
- return source;
124
- };
125
- const loadFreshness = () =>
126
- loadLadybugProjectionFreshness({
127
- root: options.root,
128
- ladybugVersion: EXPECTED_LADYBUG_VERSION,
129
- ladybugStorageVersion: EXPECTED_LADYBUG_STORAGE_VERSION,
130
- adapter: options.adapter,
131
- resolveGitCommit: options.resolveGitCommit,
132
- });
133
- try {
134
- const lifecycle = await reconcileLadybugProjection({
135
- root: options.root,
136
- loadSource,
137
- loadFreshness,
138
- loadNativeDriver: loadNative,
139
- });
140
- if (lifecycle.generation === undefined) {
141
- if (policy === "indexed") throw indexedUnavailable();
142
- return loadReferenceGraph(options);
143
- }
144
- const native = await loadNative();
145
- indexedWarnings = new WarningCollector();
146
- for (const warning of lifecycle.source.warnings) indexedWarnings.add(warning);
147
- const indexed = native.openLadybugIndexedReader(lifecycle.generation.databasePath, lifecycle.source);
148
- const graph = await indexed.readBundleGraph();
149
- const traversal = options.includeTraversal
150
- ? buildTraversalSnapshot(lifecycle.source, (await indexed.readTraversalRecords?.()) ?? lifecycle.source)
151
- : undefined;
152
- copyWarnings(indexedWarnings, options.warnings);
153
- return {
154
- graph,
155
- indexed,
156
- dispose: () => indexed.close(),
157
- backend: "indexed",
158
- provenance: {
159
- repositoryScopeKey: lifecycle.source.repositoryScopeKey,
160
- snapshotKey: lifecycle.source.snapshotKey,
161
- sourceFingerprint: lifecycle.source.sourceFingerprint,
162
- exportDigest: lifecycle.source.exportDigest,
163
- gitCommit: lifecycle.source.manifest.bundle.gitCommit,
164
- },
165
- ...(traversal !== undefined ? { traversal } : {}),
166
- };
167
- } catch {
168
- if (policy === "indexed") throw indexedUnavailable();
169
- return loadReferenceGraph(options);
170
- }
171
- }
172
-
173
- /** The retained filesystem/in-memory conformance oracle and fallback. */
174
- export async function loadReferenceRetrievalGraph(options: RetrievalGraphOptions): Promise<RetrievalGraph> {
175
- return loadReferenceGraph(options);
176
- }
177
-
178
- async function loadReferenceGraph(options: RetrievalGraphOptions): Promise<RetrievalGraph> {
179
- const profile = loadProfile({ root: options.root });
180
- const graph = loadBundle(join(options.root, DOCS_DIR), {
181
- warnings: options.warnings,
182
- profile,
183
- });
184
- const traversal = options.includeTraversal
185
- ? buildTraversalSnapshot(
186
- await loadLadybugProjectionSource({
187
- root: options.root,
188
- ladybugVersion: EXPECTED_LADYBUG_VERSION,
189
- ladybugStorageVersion: EXPECTED_LADYBUG_STORAGE_VERSION,
190
- adapter: options.adapter,
191
- resolveGitCommit: options.resolveGitCommit,
192
- }),
193
- )
194
- : undefined;
195
- return {
196
- graph,
197
- backend: "reference",
198
- ...(traversal !== undefined ? { traversal } : {}),
199
- };
200
- }
201
-
202
- function copyWarnings(from: WarningCollector, to?: WarningCollector): void {
203
- if (to === undefined) return;
204
- for (const message of from.list()) to.add(message);
205
- }
206
-
207
- function indexedUnavailable(): LoreError {
208
- return new LoreError(
209
- "validation",
210
- "verified indexed retrieval is unavailable",
211
- "retry after the local projection can be rebuilt, or use Lore's automatic in-memory fallback",
212
- );
213
- }