@reqlan/analytical 0.4.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 (97) hide show
  1. package/out/analysis/analyser-registry.d.ts +21 -0
  2. package/out/analysis/analyser-registry.js +33 -0
  3. package/out/analysis/analyser-registry.js.map +1 -0
  4. package/out/analysis/completion-tracking-analyser.d.ts +3 -0
  5. package/out/analysis/completion-tracking-analyser.js +37 -0
  6. package/out/analysis/completion-tracking-analyser.js.map +1 -0
  7. package/out/analysis/deprecation-impact-analyser.d.ts +3 -0
  8. package/out/analysis/deprecation-impact-analyser.js +21 -0
  9. package/out/analysis/deprecation-impact-analyser.js.map +1 -0
  10. package/out/analysis/file-related-analyser.d.ts +5 -0
  11. package/out/analysis/file-related-analyser.js +41 -0
  12. package/out/analysis/file-related-analyser.js.map +1 -0
  13. package/out/analysis/git-dates-analyser.d.ts +9 -0
  14. package/out/analysis/git-dates-analyser.js +39 -0
  15. package/out/analysis/git-dates-analyser.js.map +1 -0
  16. package/out/analysis/list-ideas-analyser.d.ts +3 -0
  17. package/out/analysis/list-ideas-analyser.js +7 -0
  18. package/out/analysis/list-ideas-analyser.js.map +1 -0
  19. package/out/analysis/local-graph-analyser.d.ts +6 -0
  20. package/out/analysis/local-graph-analyser.js +42 -0
  21. package/out/analysis/local-graph-analyser.js.map +1 -0
  22. package/out/analysis/semantic-search-analyser.d.ts +8 -0
  23. package/out/analysis/semantic-search-analyser.js +51 -0
  24. package/out/analysis/semantic-search-analyser.js.map +1 -0
  25. package/out/analysis-api.d.ts +31 -0
  26. package/out/analysis-api.js +136 -0
  27. package/out/analysis-api.js.map +1 -0
  28. package/out/core/analytical-store.d.ts +78 -0
  29. package/out/core/analytical-store.js +141 -0
  30. package/out/core/analytical-store.js.map +1 -0
  31. package/out/core/context-model.d.ts +187 -0
  32. package/out/core/context-model.js +36 -0
  33. package/out/core/context-model.js.map +1 -0
  34. package/out/core/context-signals.d.ts +149 -0
  35. package/out/core/context-signals.js +397 -0
  36. package/out/core/context-signals.js.map +1 -0
  37. package/out/core/file-path-match.d.ts +7 -0
  38. package/out/core/file-path-match.js +39 -0
  39. package/out/core/file-path-match.js.map +1 -0
  40. package/out/core/file-reference-resolve.d.ts +8 -0
  41. package/out/core/file-reference-resolve.js +28 -0
  42. package/out/core/file-reference-resolve.js.map +1 -0
  43. package/out/core/idea-references.d.ts +13 -0
  44. package/out/core/idea-references.js +25 -0
  45. package/out/core/idea-references.js.map +1 -0
  46. package/out/core/index-error.d.ts +23 -0
  47. package/out/core/index-error.js +33 -0
  48. package/out/core/index-error.js.map +1 -0
  49. package/out/core/types.d.ts +172 -0
  50. package/out/core/types.js +48 -0
  51. package/out/core/types.js.map +1 -0
  52. package/out/core/workspace-paths.d.ts +4 -0
  53. package/out/core/workspace-paths.js +92 -0
  54. package/out/core/workspace-paths.js.map +1 -0
  55. package/out/create-runtime.d.ts +21 -0
  56. package/out/create-runtime.js +39 -0
  57. package/out/create-runtime.js.map +1 -0
  58. package/out/export/build-export-snapshot.d.ts +3 -0
  59. package/out/export/build-export-snapshot.js +573 -0
  60. package/out/export/build-export-snapshot.js.map +1 -0
  61. package/out/export/html-export-assets.d.ts +3 -0
  62. package/out/export/html-export-assets.js +1066 -0
  63. package/out/export/html-export-assets.js.map +1 -0
  64. package/out/export/html-export-template.d.ts +17 -0
  65. package/out/export/html-export-template.js +930 -0
  66. package/out/export/html-export-template.js.map +1 -0
  67. package/out/export/html-export-utils.d.ts +45 -0
  68. package/out/export/html-export-utils.js +262 -0
  69. package/out/export/html-export-utils.js.map +1 -0
  70. package/out/export/types.d.ts +187 -0
  71. package/out/export/types.js +2 -0
  72. package/out/export/types.js.map +1 -0
  73. package/out/export/write-html-export.d.ts +2 -0
  74. package/out/export/write-html-export.js +143 -0
  75. package/out/export/write-html-export.js.map +1 -0
  76. package/out/headless-index-service.d.ts +23 -0
  77. package/out/headless-index-service.js +171 -0
  78. package/out/headless-index-service.js.map +1 -0
  79. package/out/index-store/idea-extractor.d.ts +6 -0
  80. package/out/index-store/idea-extractor.js +271 -0
  81. package/out/index-store/idea-extractor.js.map +1 -0
  82. package/out/index-store/schema.d.ts +10 -0
  83. package/out/index-store/schema.js +54 -0
  84. package/out/index-store/schema.js.map +1 -0
  85. package/out/index-store/sqlite-store.d.ts +66 -0
  86. package/out/index-store/sqlite-store.js +964 -0
  87. package/out/index-store/sqlite-store.js.map +1 -0
  88. package/out/index-store/webview-graph-queries.d.ts +62 -0
  89. package/out/index-store/webview-graph-queries.js +256 -0
  90. package/out/index-store/webview-graph-queries.js.map +1 -0
  91. package/out/index-store/webview-table-queries.d.ts +57 -0
  92. package/out/index-store/webview-table-queries.js +199 -0
  93. package/out/index-store/webview-table-queries.js.map +1 -0
  94. package/out/index.d.ts +40 -0
  95. package/out/index.js +27 -0
  96. package/out/index.js.map +1 -0
  97. package/package.json +52 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * SQLite schema for the workspace idea graph index.
3
+ */
4
+ export declare const SCHEMA_VERSION = 2;
5
+ /** Initial schema — always safe to re-run (IF NOT EXISTS). */
6
+ export declare const BASE_MIGRATIONS: string[];
7
+ /** Versioned migrations applied once when upgrading from an older schema_version. */
8
+ export declare const VERSION_MIGRATIONS: Record<number, string[]>;
9
+ /** @deprecated Use BASE_MIGRATIONS — kept for tests referencing MIGRATIONS. */
10
+ export declare const MIGRATIONS: string[];
@@ -0,0 +1,54 @@
1
+ /**
2
+ * SQLite schema for the workspace idea graph index.
3
+ */
4
+ export const SCHEMA_VERSION = 2;
5
+ /** Initial schema — always safe to re-run (IF NOT EXISTS). */
6
+ export const BASE_MIGRATIONS = [
7
+ `CREATE TABLE IF NOT EXISTS meta (
8
+ key TEXT PRIMARY KEY,
9
+ value TEXT NOT NULL
10
+ )`,
11
+ `CREATE TABLE IF NOT EXISTS ideas (
12
+ id TEXT PRIMARY KEY,
13
+ name TEXT NOT NULL,
14
+ kind TEXT NOT NULL,
15
+ file_uri TEXT NOT NULL,
16
+ line_start INTEGER NOT NULL,
17
+ line_end INTEGER NOT NULL,
18
+ summary TEXT NOT NULL,
19
+ attributes_json TEXT NOT NULL DEFAULT '{}',
20
+ content_hash TEXT NOT NULL,
21
+ git_created_at TEXT,
22
+ git_modified_at TEXT
23
+ )`,
24
+ `CREATE INDEX IF NOT EXISTS idx_ideas_file ON ideas(file_uri)`,
25
+ `CREATE INDEX IF NOT EXISTS idx_ideas_name ON ideas(name)`,
26
+ `CREATE TABLE IF NOT EXISTS edges (
27
+ id TEXT PRIMARY KEY,
28
+ source_id TEXT NOT NULL,
29
+ target_id TEXT,
30
+ target_file TEXT,
31
+ kind TEXT NOT NULL,
32
+ label TEXT,
33
+ FOREIGN KEY (source_id) REFERENCES ideas(id) ON DELETE CASCADE
34
+ )`,
35
+ `CREATE INDEX IF NOT EXISTS idx_edges_source ON edges(source_id)`,
36
+ `CREATE INDEX IF NOT EXISTS idx_edges_target ON edges(target_id)`,
37
+ `CREATE INDEX IF NOT EXISTS idx_edges_target_file ON edges(target_file)`,
38
+ `CREATE TABLE IF NOT EXISTS documents (
39
+ file_uri TEXT PRIMARY KEY,
40
+ content_hash TEXT NOT NULL,
41
+ indexed_at TEXT NOT NULL
42
+ )`
43
+ ];
44
+ /** Versioned migrations applied once when upgrading from an older schema_version. */
45
+ export const VERSION_MIGRATIONS = {
46
+ 2: [
47
+ `ALTER TABLE edges ADD COLUMN source_line INTEGER`,
48
+ `ALTER TABLE edges ADD COLUMN snippet TEXT`,
49
+ `ALTER TABLE edges ADD COLUMN is_resolved INTEGER NOT NULL DEFAULT 1`
50
+ ]
51
+ };
52
+ /** @deprecated Use BASE_MIGRATIONS — kept for tests referencing MIGRATIONS. */
53
+ export const MIGRATIONS = BASE_MIGRATIONS;
54
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/index-store/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAa;IACrC;;;MAGE;IACF;;;;;;;;;;;;MAYE;IACF,8DAA8D;IAC9D,0DAA0D;IAC1D;;;;;;;;MAQE;IACF,iEAAiE;IACjE,iEAAiE;IACjE,wEAAwE;IACxE;;;;MAIE;CACL,CAAC;AAEF,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAA6B;IACxD,CAAC,EAAE;QACC,kDAAkD;QAClD,2CAA2C;QAC3C,qEAAqE;KACxE;CACJ,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { EdgeRecord, IdeaRecord, IdeaReferenceChip, IdeaSummary, IdeaWithRange, IdeasetKind, IdeasetMemberRow, IdeasetTableRow, IdeaTableRow, ReferenceListRow, ReferenceTableRow, AncestorChainResult } from '../core/types.js';
2
+ import type { IdeasTableQuery, IdeasetsTableQuery, ReferencesTableQuery } from './webview-table-queries.js';
3
+ import { type GraphViewQuery } from './webview-graph-queries.js';
4
+ export declare class SqliteIndexStore {
5
+ private readonly db;
6
+ private constructor();
7
+ static open(dbPath: string): Promise<SqliteIndexStore>;
8
+ close(): Promise<void>;
9
+ /** Close the in-memory database without writing back to disk. */
10
+ closeWithoutPersist(): void;
11
+ static deleteDatabaseFile(dbPath: string): Promise<void>;
12
+ getDocumentHash(fileUri: string): Promise<string | undefined>;
13
+ upsertDocument(fileUri: string, contentHash: string, ideas: IdeaRecord[], edges: EdgeRecord[]): Promise<void>;
14
+ removeDocument(fileUri: string): Promise<void>;
15
+ clearAll(): Promise<void>;
16
+ listAllIdeas(): Promise<IdeaSummary[]>;
17
+ getIdea(id: string): Promise<IdeaSummary | undefined>;
18
+ getIdeasInFile(fileUri: string): Promise<IdeaSummary[]>;
19
+ getIdeaAtLine(fileUri: string, line: number): Promise<IdeaSummary | undefined>;
20
+ /** Innermost ideaset whose line range contains `line` (0-based). */
21
+ getIdeasetAtLine(fileUri: string, line: number): Promise<IdeaSummary | undefined>;
22
+ listIdeasInFileWithRanges(fileUri: string): Promise<IdeaWithRange[]>;
23
+ listIdeasetsInFileWithRanges(fileUri: string): Promise<IdeaWithRange[]>;
24
+ listReferencesForIdea(ideaId: string): Promise<ReferenceListRow[]>;
25
+ listReferencesWithinHopDepth(ideaId: string, hopDepth: number): Promise<ReferenceListRow[]>;
26
+ countUnresolvedForIdea(ideaId: string): Promise<number>;
27
+ countEdgesFromFile(fileUri: string): Promise<number>;
28
+ listAncestorChain(ideaId: string, maxDepth?: number): Promise<IdeaSummary[]>;
29
+ buildAncestorChainResult(ideaId: string, maxDepth?: number): Promise<AncestorChainResult>;
30
+ getEdgesFrom(sourceId: string): Promise<EdgeRecord[]>;
31
+ getEdgesTo(targetId: string): Promise<EdgeRecord[]>;
32
+ /** Batched fetch of every edge touching any of the given node ids (source or target). */
33
+ getEdgesForNodes(nodeIds: readonly string[]): Promise<EdgeRecord[]>;
34
+ /** Batched fetch of idea summaries by id, preserving no particular order. */
35
+ getIdeasByIds(ids: readonly string[]): Promise<IdeaSummary[]>;
36
+ getEdgesReferencingFile(filePath: string): Promise<EdgeRecord[]>;
37
+ getAllEdges(): Promise<EdgeRecord[]>;
38
+ getAllIdeasRaw(): Promise<IdeaRecord[]>;
39
+ updateGitDates(id: string, createdAt?: string, modifiedAt?: string): Promise<void>;
40
+ counts(): Promise<{
41
+ ideas: number;
42
+ edges: number;
43
+ }>;
44
+ getAttributeCatalog(): Promise<{
45
+ keys: string[];
46
+ valuesByKey: Record<string, string[]>;
47
+ }>;
48
+ searchByNameOrSummary(query: string): Promise<IdeaSummary[]>;
49
+ listIdeasForGraphQuery(query: GraphViewQuery, limit: number): Promise<{
50
+ candidates: IdeaSummary[];
51
+ totalMatching: number;
52
+ }>;
53
+ countIdeas(query?: IdeasTableQuery): Promise<number>;
54
+ listIdeasPage(query: IdeasTableQuery): Promise<IdeaTableRow[]>;
55
+ listReferenceChipsForIdeas(ideaIds: string[]): Promise<Map<string, {
56
+ outbound: IdeaReferenceChip[];
57
+ inbound: IdeaReferenceChip[];
58
+ }>>;
59
+ countIdeasets(query?: IdeasetsTableQuery): Promise<number>;
60
+ listIdeasetsPage(query: IdeasetsTableQuery): Promise<IdeasetTableRow[]>;
61
+ listIdeasetMembers(ideasetId: string, kind: IdeasetKind, fileUri: string): Promise<IdeasetMemberRow[]>;
62
+ countReferences(query?: ReferencesTableQuery): Promise<number>;
63
+ listReferencesPage(query: ReferencesTableQuery): Promise<ReferenceTableRow[]>;
64
+ private toSummary;
65
+ private migrate;
66
+ }