@psnext/lscg 0.1.5 → 0.1.6
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 +30 -6
- package/dist/bin/lscg.js +0 -0
- package/dist/src/cli.js +54 -9
- package/dist/src/explore/sigma-provider.d.ts +27 -0
- package/dist/src/explore/sigma-provider.js +87 -0
- package/dist/src/explore/sigma-render.d.ts +18 -0
- package/dist/src/explore/sigma-render.js +67 -0
- package/dist/src/graph/explore.d.ts +20 -0
- package/dist/src/graph/explore.js +200 -0
- package/dist/src/graph/repository.d.ts +7 -2
- package/dist/src/graph/repository.js +66 -20
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/mcp/server.js +5 -2
- package/dist/src/scanner/attributionPlugin.d.ts +5 -0
- package/dist/src/scanner/attributionPlugin.js +16 -0
- package/dist/src/scanner/discover.js +89 -16
- package/dist/src/scanner/plugins.d.ts +6 -2
- package/dist/src/scanner/plugins.js +8 -1
- package/dist/src/storage/connection.js +22 -0
- package/dist/src/storage/explore-queries.d.ts +52 -0
- package/dist/src/storage/explore-queries.js +184 -0
- package/dist/src/storage/graph-writes.d.ts +8 -2
- package/dist/src/storage/graph-writes.js +55 -33
- package/dist/src/storage/plugin-graph.js +3 -3
- package/dist/src/storage/queries.d.ts +4 -2
- package/dist/src/storage/queries.js +40 -31
- package/dist/src/storage/schema.d.ts +2 -2
- package/dist/src/storage/schema.js +5 -1
- package/dist/src/types.d.ts +10 -2
- package/dist/src/watch.d.ts +3 -0
- package/dist/src/watch.js +5 -2
- package/package.json +1 -1
package/dist/src/types.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface GraphEdge {
|
|
|
40
40
|
sourceId: string;
|
|
41
41
|
targetId: string;
|
|
42
42
|
kind: GraphEdgeKind;
|
|
43
|
+
type?: string;
|
|
43
44
|
confidence: number;
|
|
44
45
|
metadata: Record<string, unknown>;
|
|
45
46
|
}
|
|
@@ -84,13 +85,17 @@ export type AttributionOutcome = {
|
|
|
84
85
|
status: 'failed';
|
|
85
86
|
diagnostic: string;
|
|
86
87
|
};
|
|
87
|
-
export type EnrichmentState = 'pending' | 'complete' | 'failed';
|
|
88
|
+
export type EnrichmentState = 'disabled' | 'pending' | 'complete' | 'failed';
|
|
89
|
+
export type EnrichmentOutcomeKind = 'complete' | 'unavailable' | 'failed';
|
|
88
90
|
/** Durable, hash-bound optional-enrichment work for a scanned file. */
|
|
89
91
|
export interface FileEnrichmentState {
|
|
90
92
|
repositoryId: string;
|
|
91
93
|
fileId: string;
|
|
94
|
+
pluginName: string;
|
|
92
95
|
sourceHash: string;
|
|
93
|
-
|
|
96
|
+
historyFingerprint: string | null;
|
|
97
|
+
state: Exclude<EnrichmentState, 'disabled'>;
|
|
98
|
+
outcome: EnrichmentOutcomeKind | null;
|
|
94
99
|
diagnostic: string | null;
|
|
95
100
|
queuedAt: string;
|
|
96
101
|
updatedAt: string;
|
|
@@ -116,6 +121,8 @@ export interface EnrichmentSummary {
|
|
|
116
121
|
pending: number;
|
|
117
122
|
complete: number;
|
|
118
123
|
failed: number;
|
|
124
|
+
unavailable?: number;
|
|
125
|
+
notApplicable?: number;
|
|
119
126
|
diagnostics: string[];
|
|
120
127
|
}
|
|
121
128
|
export interface ScanSummary {
|
|
@@ -203,6 +210,7 @@ export interface GraphNodeTextRow extends GraphNodeRow {
|
|
|
203
210
|
export interface GraphEdgeRow {
|
|
204
211
|
id: string;
|
|
205
212
|
kind: GraphEdgeKind;
|
|
213
|
+
type?: string;
|
|
206
214
|
sourceId: string;
|
|
207
215
|
targetId: string;
|
|
208
216
|
fileId: string | null;
|
package/dist/src/watch.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { drainRepositoryEnrichment, scanRepository } from './graph/repository.js';
|
|
2
2
|
import type { EnrichmentSummary, ProgressReporter, RepositoryRecord, StorageScope } from './types.js';
|
|
3
|
+
import type { ScannerPlugin } from './scanner/plugins.js';
|
|
3
4
|
export interface WatchCommandOptions {
|
|
4
5
|
root?: string | undefined;
|
|
5
6
|
scope?: StorageScope | 'both' | undefined;
|
|
7
|
+
attribution?: boolean | undefined;
|
|
8
|
+
plugins?: readonly ScannerPlugin[] | undefined;
|
|
6
9
|
intervalMs?: number | undefined;
|
|
7
10
|
debounceMs?: number | undefined;
|
|
8
11
|
}
|
package/dist/src/watch.js
CHANGED
|
@@ -102,11 +102,14 @@ export async function watchRepository(options = {}, dependencies = {}) {
|
|
|
102
102
|
const phase = scans === 0 ? 'initial-scan' : 'rescan';
|
|
103
103
|
reportWatchProgress(progress, { event: phase, mode, repository, scope, detail: scans === 0 ? 'starting initial scan' : 'starting rescan' });
|
|
104
104
|
const scanStartFingerprint = polling ? await fingerprintFn(repository.root) : undefined;
|
|
105
|
-
const structuralSummary = await scanFn({ root: repository.root, scope, progress });
|
|
105
|
+
const structuralSummary = await scanFn({ root: repository.root, scope, attribution: options.attribution, plugins: options.plugins, progress });
|
|
106
106
|
// A watch owns in-process enrichment. Awaiting it while `scanning` is
|
|
107
107
|
// true serializes durable work with structural replacement; a filesystem
|
|
108
108
|
// event during either phase queues exactly one follow-up structural scan.
|
|
109
|
-
const
|
|
109
|
+
const shouldDrainEnrichment = options.attribution === true || dependencies.drainEnrichment !== undefined;
|
|
110
|
+
const enrichment = shouldDrainEnrichment
|
|
111
|
+
? await drainEnrichment({ root: repository.root, scope, historyFingerprint: undefined })
|
|
112
|
+
: { state: 'disabled', pending: 0, complete: 0, failed: 0, unavailable: 0, notApplicable: 0, diagnostics: [] };
|
|
110
113
|
reportWatchProgress(progress, { event: 'enrichment', mode, repository, scope, detail: `state=${enrichment.state} pending=${enrichment.pending} complete=${enrichment.complete} failed=${enrichment.failed}` });
|
|
111
114
|
const summary = { ...structuralSummary, enrichment };
|
|
112
115
|
scanning = false;
|