@grafema/util 0.3.17 → 0.3.20
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/core/FileOverview.d.ts +12 -0
- package/dist/core/FileOverview.d.ts.map +1 -1
- package/dist/core/FileOverview.js +98 -2
- package/dist/core/FileOverview.js.map +1 -1
- package/dist/federation/FederatedRouter.d.ts +124 -0
- package/dist/federation/FederatedRouter.d.ts.map +1 -0
- package/dist/federation/FederatedRouter.js +297 -0
- package/dist/federation/FederatedRouter.js.map +1 -0
- package/dist/federation/ShardDiscovery.d.ts +56 -0
- package/dist/federation/ShardDiscovery.d.ts.map +1 -0
- package/dist/federation/ShardDiscovery.js +100 -0
- package/dist/federation/ShardDiscovery.js.map +1 -0
- package/dist/federation/index.d.ts +28 -0
- package/dist/federation/index.d.ts.map +1 -0
- package/dist/federation/index.js +26 -0
- package/dist/federation/index.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest/generator.d.ts.map +1 -1
- package/dist/manifest/generator.js +26 -4
- package/dist/manifest/generator.js.map +1 -1
- package/dist/manifest/index.d.ts +2 -0
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +1 -0
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/registry.d.ts +116 -0
- package/dist/manifest/registry.d.ts.map +1 -0
- package/dist/manifest/registry.js +638 -0
- package/dist/manifest/registry.js.map +1 -0
- package/dist/manifest/resolver.d.ts +9 -0
- package/dist/manifest/resolver.d.ts.map +1 -1
- package/dist/manifest/resolver.js +31 -0
- package/dist/manifest/resolver.js.map +1 -1
- package/dist/notation/traceRenderer.d.ts +2 -0
- package/dist/notation/traceRenderer.d.ts.map +1 -1
- package/dist/notation/traceRenderer.js +6 -5
- package/dist/notation/traceRenderer.js.map +1 -1
- package/package.json +3 -3
- package/src/core/FileOverview.ts +104 -2
- package/src/federation/FederatedRouter.ts +440 -0
- package/src/federation/ShardDiscovery.ts +130 -0
- package/src/federation/index.ts +35 -0
- package/src/index.ts +16 -1
- package/src/manifest/generator.ts +25 -4
- package/src/manifest/index.ts +2 -0
- package/src/manifest/registry.ts +769 -0
- package/src/manifest/resolver.ts +33 -0
- package/src/notation/traceRenderer.ts +8 -5
package/src/manifest/resolver.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { readFileSync, existsSync } from 'fs';
|
|
|
20
20
|
import { join } from 'path';
|
|
21
21
|
import { parse as parseYaml } from 'yaml';
|
|
22
22
|
import type { Manifest, ManifestExport } from './types.js';
|
|
23
|
+
import type { RegistryIndex } from './registry.js';
|
|
23
24
|
|
|
24
25
|
export interface ResolveResult {
|
|
25
26
|
/** The matched export entry */
|
|
@@ -105,6 +106,38 @@ export class ManifestResolver {
|
|
|
105
106
|
return loaded;
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Load manifests from a registry directory (registry/index.yaml).
|
|
111
|
+
* Reads index.yaml to discover available packages, then loads each manifest.
|
|
112
|
+
*
|
|
113
|
+
* @param registryDir Path to the registry directory containing index.yaml
|
|
114
|
+
* @param packageNames Optional filter — only load these packages
|
|
115
|
+
* @returns Number of manifests loaded
|
|
116
|
+
*/
|
|
117
|
+
loadFromRegistry(registryDir: string, packageNames?: string[]): number {
|
|
118
|
+
const indexPath = join(registryDir, 'index.yaml');
|
|
119
|
+
if (!existsSync(indexPath)) return 0;
|
|
120
|
+
|
|
121
|
+
let index: RegistryIndex;
|
|
122
|
+
try {
|
|
123
|
+
index = parseYaml(readFileSync(indexPath, 'utf-8')) as RegistryIndex;
|
|
124
|
+
} catch {
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (!index?.entries) return 0;
|
|
129
|
+
|
|
130
|
+
let loaded = 0;
|
|
131
|
+
for (const entry of index.entries) {
|
|
132
|
+
if (packageNames && !packageNames.includes(entry.name)) continue;
|
|
133
|
+
|
|
134
|
+
const manifestPath = join(registryDir, entry.name, entry.version, 'manifest.yaml');
|
|
135
|
+
if (this.loadFromFile(manifestPath)) loaded++;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return loaded;
|
|
139
|
+
}
|
|
140
|
+
|
|
108
141
|
/**
|
|
109
142
|
* Register a manifest directly (e.g., from in-memory generation).
|
|
110
143
|
*/
|
|
@@ -28,6 +28,8 @@ export type TraceDetail = 'summary' | 'normal' | 'full';
|
|
|
28
28
|
export interface TraceNarrativeOptions {
|
|
29
29
|
/** Level of detail: summary, normal (default), full */
|
|
30
30
|
detail?: TraceDetail;
|
|
31
|
+
/** Format hints for CLI (--detail full) vs MCP (detail="full") */
|
|
32
|
+
hintStyle?: 'cli' | 'mcp';
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
// === CONSTANTS ===
|
|
@@ -40,14 +42,15 @@ const MAX_LINES = 35;
|
|
|
40
42
|
|
|
41
43
|
// === LEGEND (from single source of truth) ===
|
|
42
44
|
|
|
43
|
-
function lodHint(currentDetail: TraceDetail): string {
|
|
45
|
+
function lodHint(currentDetail: TraceDetail, style: 'cli' | 'mcp' = 'mcp'): string {
|
|
46
|
+
const fmt = (level: string) => style === 'cli' ? `--detail ${level}` : `detail="${level}"`;
|
|
44
47
|
switch (currentDetail) {
|
|
45
48
|
case 'summary':
|
|
46
|
-
return
|
|
49
|
+
return `Use ${fmt('normal')} for node list, ${fmt('full')} for complete chain`;
|
|
47
50
|
case 'normal':
|
|
48
|
-
return
|
|
51
|
+
return `Use ${fmt('full')} for complete chain, ${fmt('summary')} for overview`;
|
|
49
52
|
case 'full':
|
|
50
|
-
return
|
|
53
|
+
return `Use ${fmt('summary')} for overview, ${fmt('normal')} for compressed view`;
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -452,7 +455,7 @@ export function renderTraceNarrative(
|
|
|
452
455
|
// Append legend (from archetypes.ts — single source of truth) + LOD hint
|
|
453
456
|
output.push('');
|
|
454
457
|
output.push(generateLegend());
|
|
455
|
-
output.push(lodHint(detail));
|
|
458
|
+
output.push(lodHint(detail, options.hintStyle));
|
|
456
459
|
|
|
457
460
|
return output.join('\n');
|
|
458
461
|
}
|