@weftlet/toolkit 0.6.1 → 0.7.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 (177) hide show
  1. package/README.md +168 -1
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/application/application.d.ts +10 -0
  4. package/dist/application/application.js +20 -0
  5. package/dist/application/document-code-bindings.d.ts +11 -0
  6. package/dist/application/document-code-bindings.js +25 -0
  7. package/dist/application/document-obligations.d.ts +8 -0
  8. package/dist/application/document-obligations.js +11 -0
  9. package/dist/application/draft-facts.d.ts +3 -0
  10. package/dist/application/draft-facts.js +37 -0
  11. package/dist/application/extraction-identity.d.ts +2 -2
  12. package/dist/application/extraction-identity.js +7 -1
  13. package/dist/application/extractor-results.d.ts +6 -0
  14. package/dist/application/extractor-results.js +6 -0
  15. package/dist/application/hydrator.js +20 -3
  16. package/dist/application/mapping-proposals.d.ts +108 -0
  17. package/dist/application/mapping-proposals.js +142 -0
  18. package/dist/application/mapping-service.d.ts +2 -0
  19. package/dist/application/mapping-service.js +5 -0
  20. package/dist/application/overlay.js +36 -22
  21. package/dist/application/saved-code-coverage.d.ts +40 -0
  22. package/dist/application/saved-code-coverage.js +20 -0
  23. package/dist/application/saved-compatibility.d.ts +38 -0
  24. package/dist/application/saved-compatibility.js +20 -0
  25. package/dist/application/saved-evidence.d.ts +17 -11
  26. package/dist/application/saved-evidence.js +44 -40
  27. package/dist/application/saved-exploration.d.ts +57 -0
  28. package/dist/application/saved-exploration.js +21 -0
  29. package/dist/application/saved-paths.d.ts +58 -0
  30. package/dist/application/saved-paths.js +20 -0
  31. package/dist/extraction/call-syntax.d.ts +18 -0
  32. package/dist/extraction/call-syntax.js +61 -0
  33. package/dist/extraction/canonical-document-links.d.ts +5 -1
  34. package/dist/extraction/canonical-document-links.js +4 -4
  35. package/dist/extraction/code-inventory.d.ts +6 -0
  36. package/dist/extraction/code-inventory.js +26 -0
  37. package/dist/extraction/document-code-bindings.d.ts +14 -0
  38. package/dist/extraction/document-code-bindings.js +121 -0
  39. package/dist/extraction/document-obligations.d.ts +12 -0
  40. package/dist/extraction/document-obligations.js +112 -0
  41. package/dist/extraction/mapping-candidates.d.ts +13 -0
  42. package/dist/extraction/mapping-candidates.js +46 -0
  43. package/dist/extraction/mapping-output.d.ts +75 -0
  44. package/dist/extraction/mapping-output.js +53 -0
  45. package/dist/extraction/mapping-plan.d.ts +7 -0
  46. package/dist/extraction/mapping-plan.js +117 -0
  47. package/dist/extraction/mapping-prompt.d.ts +2 -0
  48. package/dist/extraction/mapping-prompt.js +17 -0
  49. package/dist/extraction/mapping-provider.d.ts +15 -0
  50. package/dist/extraction/mapping-provider.js +60 -0
  51. package/dist/extraction/mapping-request.d.ts +3 -0
  52. package/dist/extraction/mapping-request.js +32 -0
  53. package/dist/extraction/routing.js +5 -20
  54. package/dist/extraction/scip-occurrences.d.ts +3 -0
  55. package/dist/extraction/scip-occurrences.js +102 -0
  56. package/dist/extraction/scip-ranges.d.ts +6 -0
  57. package/dist/extraction/scip-ranges.js +31 -0
  58. package/dist/extraction/scip-runtime.d.ts +39 -0
  59. package/dist/extraction/scip-runtime.js +8 -0
  60. package/dist/extraction/scip-symbols.d.ts +21 -0
  61. package/dist/extraction/scip-symbols.js +91 -0
  62. package/dist/extraction/semantic.d.ts +1 -1
  63. package/dist/extraction/semantic.js +5 -17
  64. package/dist/extraction/static-calls.d.ts +10 -0
  65. package/dist/extraction/static-calls.js +133 -0
  66. package/dist/extraction/static.d.ts +3 -20
  67. package/dist/extraction/static.js +8 -84
  68. package/dist/extraction/symbol-resolution.d.ts +12 -0
  69. package/dist/extraction/symbol-resolution.js +51 -0
  70. package/dist/extraction/symbol-selectors.d.ts +11 -0
  71. package/dist/extraction/symbol-selectors.js +51 -0
  72. package/dist/graph/binding-rdf.d.ts +7 -0
  73. package/dist/graph/binding-rdf.js +109 -0
  74. package/dist/graph/call-rdf.d.ts +4 -0
  75. package/dist/graph/call-rdf.js +94 -0
  76. package/dist/graph/call-shapes.d.ts +2 -0
  77. package/dist/graph/call-shapes.js +28 -0
  78. package/dist/graph/code-coverage-projection.d.ts +9 -0
  79. package/dist/graph/code-coverage-projection.js +117 -0
  80. package/dist/graph/code-coverage-renderer.d.ts +2 -0
  81. package/dist/graph/code-coverage-renderer.js +15 -0
  82. package/dist/graph/code-coverage-request.d.ts +6 -0
  83. package/dist/graph/code-coverage-request.js +19 -0
  84. package/dist/graph/code-coverage.d.ts +6 -0
  85. package/dist/graph/code-coverage.js +54 -0
  86. package/dist/graph/code-description.d.ts +4 -0
  87. package/dist/graph/code-description.js +24 -0
  88. package/dist/graph/code-rdf.d.ts +5 -0
  89. package/dist/graph/code-rdf.js +72 -0
  90. package/dist/graph/compatibility-context.d.ts +2 -0
  91. package/dist/graph/compatibility-context.js +18 -0
  92. package/dist/graph/compatibility-renderer.d.ts +2 -0
  93. package/dist/graph/compatibility-renderer.js +45 -0
  94. package/dist/graph/compatibility-request.d.ts +3 -0
  95. package/dist/graph/compatibility-request.js +18 -0
  96. package/dist/graph/compatibility.d.ts +7 -0
  97. package/dist/graph/compatibility.js +67 -0
  98. package/dist/graph/constraint-comparison.d.ts +7 -0
  99. package/dist/graph/constraint-comparison.js +49 -0
  100. package/dist/graph/coverage.d.ts +2 -2
  101. package/dist/graph/coverage.js +8 -3
  102. package/dist/graph/diagnostics.d.ts +1 -1
  103. package/dist/graph/diagnostics.js +10 -6
  104. package/dist/graph/evidence-description.d.ts +3 -0
  105. package/dist/graph/evidence-description.js +13 -0
  106. package/dist/graph/identity-preflight.js +1 -1
  107. package/dist/graph/neighborhood-renderer.d.ts +2 -0
  108. package/dist/graph/neighborhood-renderer.js +38 -0
  109. package/dist/graph/neighborhood-request.d.ts +9 -0
  110. package/dist/graph/neighborhood-request.js +37 -0
  111. package/dist/graph/neighborhood.d.ts +8 -0
  112. package/dist/graph/neighborhood.js +100 -0
  113. package/dist/graph/obligation-rdf.d.ts +5 -0
  114. package/dist/graph/obligation-rdf.js +67 -0
  115. package/dist/graph/obligation-shapes.d.ts +2 -0
  116. package/dist/graph/obligation-shapes.js +32 -0
  117. package/dist/graph/path-request.d.ts +11 -0
  118. package/dist/graph/path-request.js +24 -0
  119. package/dist/graph/path-search.d.ts +45 -0
  120. package/dist/graph/path-search.js +101 -0
  121. package/dist/graph/paths-renderer.d.ts +2 -0
  122. package/dist/graph/paths-renderer.js +36 -0
  123. package/dist/graph/paths.d.ts +7 -0
  124. package/dist/graph/paths.js +74 -0
  125. package/dist/graph/query.js +23 -6
  126. package/dist/graph/rdf.js +26 -0
  127. package/dist/graph/shacl-shapes.js +70 -0
  128. package/dist/graph/snapshot-context.d.ts +3 -0
  129. package/dist/graph/snapshot-context.js +8 -0
  130. package/dist/index.d.ts +23 -0
  131. package/dist/index.js +22 -0
  132. package/dist/infrastructure/json-digest.d.ts +2 -0
  133. package/dist/infrastructure/json-digest.js +3 -0
  134. package/dist/infrastructure/unique-json.d.ts +2 -0
  135. package/dist/infrastructure/unique-json.js +20 -0
  136. package/dist/interfaces/cli.js +33 -1
  137. package/dist/interfaces/code-coverage.d.ts +46 -0
  138. package/dist/interfaces/code-coverage.js +18 -0
  139. package/dist/interfaces/graph-compatibility.d.ts +35 -0
  140. package/dist/interfaces/graph-compatibility.js +21 -0
  141. package/dist/interfaces/graph-exploration.d.ts +59 -0
  142. package/dist/interfaces/graph-exploration.js +27 -0
  143. package/dist/interfaces/graph-paths.d.ts +77 -0
  144. package/dist/interfaces/graph-paths.js +31 -0
  145. package/dist/interfaces/graph-query-args.d.ts +2 -0
  146. package/dist/interfaces/graph-query-args.js +25 -0
  147. package/dist/interfaces/mapping-proposals.d.ts +204 -0
  148. package/dist/interfaces/mapping-proposals.js +74 -0
  149. package/dist/interfaces/mcp.js +31 -3
  150. package/dist/storage/mapping-proposals.d.ts +9 -0
  151. package/dist/storage/mapping-proposals.js +42 -0
  152. package/dist/visualization/evidence-sources.d.ts +6 -0
  153. package/dist/visualization/evidence-sources.js +19 -0
  154. package/dist/visualization/viewer-interaction.d.ts +5 -8
  155. package/dist/visualization/viewer-interaction.js +46 -44
  156. package/dist/visualization/visualization.js +14 -5
  157. package/docs/1.0-WORK-QUEUE.md +38 -0
  158. package/docs/ADR-029-exact-graph-neighborhoods.md +70 -0
  159. package/docs/ADR-030-bounded-evidence-paths.md +97 -0
  160. package/docs/ADR-031-code-extractor-selection.md +91 -0
  161. package/docs/ADR-032-scip-code-evidence.md +73 -0
  162. package/docs/ADR-033-document-symbol-bindings.md +83 -0
  163. package/docs/ADR-034-mapping-gaps.md +80 -0
  164. package/docs/ADR-035-static-call-evidence.md +78 -0
  165. package/docs/ADR-036-contract-obligation-declarations.md +124 -0
  166. package/docs/ADR-037-selected-contract-compatibility.md +93 -0
  167. package/docs/ADR-038-monorepo-code-coverage.md +105 -0
  168. package/docs/ADR-039-mapping-proposals.md +119 -0
  169. package/docs/GRAPHIFY-EVALUATION.md +21 -4
  170. package/docs/PRE-1.0-BASELINE.md +49 -2
  171. package/docs/RELEASE-1.0-PLAN.md +14 -2
  172. package/docs/RELEASING.md +3 -3
  173. package/docs/ROADMAP.md +27 -6
  174. package/docs/VALIDATION.md +437 -14
  175. package/docs/extraction-manifest.json +248 -21
  176. package/package.json +8 -4
  177. package/templates/context-graph-development/SKILL.md +30 -1
package/dist/index.js CHANGED
@@ -20,3 +20,25 @@ export * from './application/document-coverage.js';
20
20
  export * from './extraction/document-traversal.js';
21
21
  export * from './extraction/document-classification.js';
22
22
  export * from './extraction/document-evidence.js';
23
+ export * from './graph/neighborhood.js';
24
+ export * from './graph/neighborhood-request.js';
25
+ export * from './graph/neighborhood-renderer.js';
26
+ export * from './graph/paths.js';
27
+ export * from './graph/path-request.js';
28
+ export * from './graph/paths-renderer.js';
29
+ export * from './extraction/document-code-bindings.js';
30
+ export * from './extraction/document-obligations.js';
31
+ export * from './graph/compatibility.js';
32
+ export * from './graph/compatibility-request.js';
33
+ export * from './graph/compatibility-renderer.js';
34
+ export * from './graph/code-coverage.js';
35
+ export * from './graph/code-coverage-projection.js';
36
+ export * from './graph/code-coverage-request.js';
37
+ export * from './graph/code-coverage-renderer.js';
38
+ export { MappingProposalService } from './application/mapping-proposals.js';
39
+ export { createMappingProposalService } from './application/mapping-service.js';
40
+ export { prepareMappingProposal } from './extraction/mapping-plan.js';
41
+ export { createMappingProvider, mappingProviderIdentity } from './extraction/mapping-provider.js';
42
+ export { parseMappingRequest } from './extraction/mapping-request.js';
43
+ export { validateMappingOutput } from './extraction/mapping-output.js';
44
+ export { FileMappingProposalStore } from './storage/mapping-proposals.js';
@@ -0,0 +1,2 @@
1
+ /** Identity of persisted JSON, excluding undefined optional fields that JSON cannot retain. */
2
+ export declare const jsonDigest: (value: unknown) => string;
@@ -0,0 +1,3 @@
1
+ import { sha256, stableJson } from './util.js';
2
+ /** Identity of persisted JSON, excluding undefined optional fields that JSON cannot retain. */
3
+ export const jsonDigest = (value) => sha256(stableJson(JSON.parse(JSON.stringify(value))));
@@ -0,0 +1,2 @@
1
+ /** JSON.parse silently accepts duplicate keys, including differently escaped spellings. */
2
+ export declare function parseUniqueJson(content: string): unknown;
@@ -0,0 +1,20 @@
1
+ /** JSON.parse silently accepts duplicate keys, including differently escaped spellings. */
2
+ export function parseUniqueJson(content) {
3
+ const parsed = JSON.parse(content);
4
+ const objects = [];
5
+ for (const token of content.matchAll(/"(?:\\.|[^"\\])*"|[{}\[\]]/g)) {
6
+ const value = token[0];
7
+ if (value === '{' || value === '[')
8
+ objects.push(value === '{' ? new Set() : undefined);
9
+ else if (value === '}' || value === ']')
10
+ objects.pop();
11
+ else if (/^\s*:/.test(content.slice(token.index + value.length))) {
12
+ const keys = objects.at(-1);
13
+ const key = JSON.parse(value);
14
+ if (keys.has(key))
15
+ throw new Error('Duplicate JSON key');
16
+ keys.add(key);
17
+ }
18
+ }
19
+ return parsed;
20
+ }
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // Modified for standalone extraction; see docs/extraction-manifest.json.
3
3
  import "../../runtime-check.mjs";
4
+ import { runMappingsCommand } from './mapping-proposals.js';
4
5
  import { resolve } from 'node:path';
5
6
  import process from 'node:process';
6
7
  import { createContextGraphApplication } from "../application/application.js";
@@ -20,6 +21,10 @@ import { adoptSemanticCache } from '../application/cache-adoption.js';
20
21
  import { SemanticHydrationError } from '../application/hydration-failure.js';
21
22
  import { GraphIdentityConflictError } from '../graph/identity-preflight.js';
22
23
  import { runDocumentCoverage } from './document-coverage.js';
24
+ import { graphNeighborsRequestFromArgs } from './graph-exploration.js';
25
+ import { graphPathsRequestFromArgs } from './graph-paths.js';
26
+ import { graphCompatibilityRequestFromArgs } from './graph-compatibility.js';
27
+ import { codeCoverageRequestFromArgs } from './code-coverage.js';
23
28
  function valueAfter(args, name) {
24
29
  const index = args.indexOf(name);
25
30
  return index >= 0 ? args[index + 1] : undefined;
@@ -98,7 +103,7 @@ function formatHydrationPlan(plan) {
98
103
  async function main() {
99
104
  const args = process.argv.slice(2);
100
105
  if (args.includes('--help') || !args.length) {
101
- process.stdout.write('weftlet documents plan|init|config show|config validate|doctor|hydrate|cache adopt|overlay|impact scan|sparql|validate|govern|visualize|diagnostics show|invariant check|clean-compare|ontology compile\nUse --config <file>; queries accept --snapshot <id>. impact scan accepts --changed-file, --capability, --max-facts, --max-depth, --continuation.\ndocuments plan --entry <document> [--entry <document>] [--root <path>] [--document-policy <json-file>] [--ref <commit>] [--json] previews prospective committed link coverage; it does not change hydration inputs or estimate model/cache work. Source classification/ownership completeness is separate from traversal readiness. The preview policy is an operation input. Set documentTraversal in configuration to activate traversal hydration; hydrate --plan describes its execution inputs. Safety limits: --max-read-documents, --max-read-bytes, --max-document-bytes.\nhydrate --plan [--json] [--ref <commit>] [--force-semantic] previews scope, cache and budgets without model calls or graph writes. Traversal coverage and role ambiguity block new model work; direct-source selection retains its existing behavior.\nhydrate --json --quiet emits structured semantic failures on stderr with no progress lines; failure stdout stays empty. hydrate --plan maps opaque source IDs to local document paths.\nhydrate|overlay --validation-details explicitly includes local node/fact identities, extractor names and source citations in identity-conflict errors; default reports use opaque references. This flag writes no diagnostic file. Use --json --quiet for structured identity-conflict stderr and empty failure stdout. Validation timings report phase boundaries, not a live heartbeat or percentage.\ncache adopt --from-config <previous.json> [--config <current.json>] [--ref <commit>] [--dry-run] returns JSON and copies only validated compatible artifacts, without model calls or snapshot writes. --dry-run performs no cache writes. Agent configurations accept the same --owner-doc, --task and --capability selection as hydrate.\ninit [--yes] [--directory <project>] [--config <file>] [--repository-id <id>] [--code-root <path>] [--semantic-source <path>] [--evidence-root <path>] [--model <name>] [--no-gitignore]\nSource flags may be repeated. init never overwrites an existing config. See README.md for examples.\n');
106
+ process.stdout.write('weftlet mappings plan|mappings propose|mappings read|documents plan|init|config show|config validate|doctor|hydrate|cache adopt|overlay|impact scan|graph neighbors|graph paths|graph compatibility|graph coverage|sparql|validate|govern|visualize|diagnostics show|invariant check|clean-compare|ontology compile\nmappings plan|propose --request <json-file> [--allow-model for propose] previews or runs one opt-in proposal; mappings read --snapshot <id> --key <key> reads saved unreviewed results.\nUse --config <file>; queries accept --snapshot <id>. impact scan accepts --changed-file, --capability, --max-facts, --max-depth, --continuation.\ngraph neighbors --snapshot <id> --node <exact-id> [--direction incoming|outgoing|both] [--predicate <relation>] [--max-facts <1..200>] [--continuation <token>] [--json] reads one-hop saved evidence; repeat --predicate to select multiple relations.\ngraph paths --snapshot <id> --from <exact-id> --to <exact-id> [--direction incoming|outgoing|both] [--predicate <relation>] [--max-depth <1..32>] [--max-paths <1..20>] [--max-steps <1..10000>] [--continuation <token>] [--json] explores cited simple paths; incomplete searches report frontier and limits.\ngraph coverage --snapshot <id> [--project <exact-package-root>] [--max-items <1..200>] [--continuation <token>] [--json] pages saved package/file coverage; absence or zero references is not proof of no impact.\ngraph compatibility --snapshot <id> --producer-fact <assertion-id> --consumer-fact <assertion-id> [--json] compares two documented numeric obligations; advisory only, with explicit unknowns and no implementation or CI verdict.\ndocuments plan --entry <document> [--entry <document>] [--root <path>] [--document-policy <json-file>] [--ref <commit>] [--json] previews prospective committed link coverage; it does not change hydration inputs or estimate model/cache work. Source classification/ownership completeness is separate from traversal readiness. The preview policy is an operation input. Set documentTraversal in configuration to activate traversal hydration; hydrate --plan describes its execution inputs. Safety limits: --max-read-documents, --max-read-bytes, --max-document-bytes.\nhydrate --plan [--json] [--ref <commit>] [--force-semantic] previews scope, cache and budgets without model calls or graph writes. Traversal coverage and role ambiguity block new model work; direct-source selection retains its existing behavior.\nhydrate --json --quiet emits structured semantic failures on stderr with no progress lines; failure stdout stays empty. hydrate --plan maps opaque source IDs to local document paths.\nhydrate|overlay --validation-details explicitly includes local node/fact identities, extractor names and source citations in identity-conflict errors; default reports use opaque references. This flag writes no diagnostic file. Use --json --quiet for structured identity-conflict stderr and empty failure stdout. Validation timings report phase boundaries, not a live heartbeat or percentage.\ncache adopt --from-config <previous.json> [--config <current.json>] [--ref <commit>] [--dry-run] returns JSON and copies only validated compatible artifacts, without model calls or snapshot writes. --dry-run performs no cache writes. Agent configurations accept the same --owner-doc, --task and --capability selection as hydrate.\ninit [--yes] [--directory <project>] [--config <file>] [--repository-id <id>] [--code-root <path>] [--semantic-source <path>] [--evidence-root <path>] [--model <name>] [--no-gitignore]\nSource flags may be repeated. init never overwrites an existing config. See README.md for examples.\n');
102
107
  return;
103
108
  }
104
109
  if (await runDocumentCoverage(args, defaultConfigPath))
@@ -164,6 +169,13 @@ async function main() {
164
169
  }
165
170
  const application = await createContextGraphApplication(configPath);
166
171
  const [command, subcommand] = args;
172
+ if (command === 'mappings') {
173
+ const report = await runMappingsCommand(application.mappingProposalService, args.slice(1));
174
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
175
+ if ('ready' in report && !report.ready)
176
+ process.exitCode = 1;
177
+ return;
178
+ }
167
179
  if (command === 'sparql' || command === 'validate') {
168
180
  const id = valueAfter(args, '--snapshot');
169
181
  const snapshot = id ? await application.snapshotStore.read(id) :
@@ -235,6 +247,26 @@ async function main() {
235
247
  process.stdout.write(args.includes('--json') ? `${JSON.stringify(pack, null, 2)}\n` : `${pack.markdown}\n`);
236
248
  return;
237
249
  }
250
+ if (command === 'graph' && subcommand === 'compatibility') {
251
+ const result = await application.compatibilityService.assess(graphCompatibilityRequestFromArgs(args.slice(2)));
252
+ process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
253
+ return;
254
+ }
255
+ if (command === 'graph' && subcommand === 'coverage') {
256
+ const result = await application.codeCoverageService.coverage(codeCoverageRequestFromArgs(args.slice(2)));
257
+ process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
258
+ return;
259
+ }
260
+ if (command === 'graph' && subcommand === 'paths') {
261
+ const result = await application.pathService.paths(graphPathsRequestFromArgs(args.slice(2)));
262
+ process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
263
+ return;
264
+ }
265
+ if (command === 'graph' && subcommand === 'neighbors') {
266
+ const result = await application.explorationService.neighbors(graphNeighborsRequestFromArgs(args.slice(2)));
267
+ process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
268
+ return;
269
+ }
238
270
  if (command === 'visualize') {
239
271
  const outputPath = valueAfter(args, '--output');
240
272
  if (!outputPath)
@@ -0,0 +1,46 @@
1
+ import type { CodeCoverageService } from '@weftlet/core';
2
+ export declare const graphCoverageTool: {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: "object";
7
+ additionalProperties: boolean;
8
+ required: string[];
9
+ properties: {
10
+ snapshotId: {
11
+ type: string;
12
+ minLength: number;
13
+ maxLength: number;
14
+ };
15
+ projectRoot: {
16
+ type: string;
17
+ minLength: number;
18
+ maxLength: number;
19
+ };
20
+ maxItems: {
21
+ type: string;
22
+ minimum: number;
23
+ maximum: number;
24
+ default: number;
25
+ };
26
+ continuation: {
27
+ type: string;
28
+ minLength: number;
29
+ maxLength: number;
30
+ };
31
+ };
32
+ };
33
+ annotations: {
34
+ readOnlyHint: boolean;
35
+ destructiveHint: boolean;
36
+ idempotentHint: boolean;
37
+ openWorldHint: boolean;
38
+ };
39
+ };
40
+ export declare function handleCodeCoverage(service: CodeCoverageService, value: unknown): Promise<import("@weftlet/core").CodeCoverageReport>;
41
+ export declare function codeCoverageRequestFromArgs(args: readonly string[]): {
42
+ continuation?: string | undefined;
43
+ projectRoot?: string | undefined;
44
+ snapshotId: string;
45
+ maxItems: number;
46
+ };
@@ -0,0 +1,18 @@
1
+ import { parseCodeCoverageRequest } from '../graph/code-coverage-request.js';
2
+ import { parseGraphQueryArgs } from './graph-query-args.js';
3
+ export const graphCoverageTool = {
4
+ name: 'graph.coverage',
5
+ description: 'Inspect saved TypeScript-family source coverage. Page package boundaries, then select an exact projectRoot to page files. Distinguishes code-root selection, requested index entries, observed SCIP documents, cross-package references and unresolved evidence. Missing or zero observations never prove no impact. Does not rebuild evidence.',
6
+ inputSchema: { type: 'object', additionalProperties: false, required: ['snapshotId'], properties: {
7
+ snapshotId: { type: 'string', minLength: 1, maxLength: 256 }, projectRoot: { type: 'string', minLength: 1, maxLength: 8192 },
8
+ maxItems: { type: 'integer', minimum: 1, maximum: 200, default: 50 }, continuation: { type: 'string', minLength: 1, maxLength: 2048 },
9
+ } }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
10
+ };
11
+ export function handleCodeCoverage(service, value) {
12
+ return service.coverage(parseCodeCoverageRequest(value));
13
+ }
14
+ export function codeCoverageRequestFromArgs(args) {
15
+ return parseCodeCoverageRequest(parseGraphQueryArgs(args, 'coverage', {
16
+ '--snapshot': 'snapshotId', '--project': 'projectRoot', '--max-items': 'maxItems', '--continuation': 'continuation',
17
+ }));
18
+ }
@@ -0,0 +1,35 @@
1
+ import type { ContractCompatibilityService } from '@weftlet/core';
2
+ export declare const graphCompatibilityTool: {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: "object";
7
+ additionalProperties: boolean;
8
+ required: string[];
9
+ properties: {
10
+ snapshotId: {
11
+ type: string;
12
+ minLength: number;
13
+ maxLength: number;
14
+ };
15
+ producerFactId: {
16
+ type: string;
17
+ minLength: number;
18
+ maxLength: number;
19
+ };
20
+ consumerFactId: {
21
+ type: string;
22
+ minLength: number;
23
+ maxLength: number;
24
+ };
25
+ };
26
+ };
27
+ annotations: {
28
+ readOnlyHint: boolean;
29
+ destructiveHint: boolean;
30
+ idempotentHint: boolean;
31
+ openWorldHint: boolean;
32
+ };
33
+ };
34
+ export declare function handleGraphCompatibility(service: ContractCompatibilityService, value: unknown): Promise<import("@weftlet/core").ContractCompatibilityReport>;
35
+ export declare function graphCompatibilityRequestFromArgs(args: readonly string[]): import("@weftlet/core").ContractCompatibilityRequest;
@@ -0,0 +1,21 @@
1
+ import { parseContractCompatibilityRequest } from '../graph/compatibility-request.js';
2
+ import { parseGraphQueryArgs } from './graph-query-args.js';
3
+ export const graphCompatibilityTool = {
4
+ name: 'graph.compatibility',
5
+ description: 'Compare two exact cited producer/consumer numeric obligations from a saved snapshot. Reports subset, insufficient guarantee, disjoint constraints, required revalidation or unknown. Advisory only: never proves implementation, current-diff validity or a CI policy violation. Discover assertion IDs with graph.neighbors.',
6
+ inputSchema: { type: 'object', additionalProperties: false,
7
+ required: ['snapshotId', 'producerFactId', 'consumerFactId'], properties: {
8
+ snapshotId: { type: 'string', minLength: 1, maxLength: 256 },
9
+ producerFactId: { type: 'string', minLength: 1, maxLength: 8192 },
10
+ consumerFactId: { type: 'string', minLength: 1, maxLength: 8192 },
11
+ } },
12
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
13
+ };
14
+ export function handleGraphCompatibility(service, value) {
15
+ return service.assess(parseContractCompatibilityRequest(value));
16
+ }
17
+ export function graphCompatibilityRequestFromArgs(args) {
18
+ return parseContractCompatibilityRequest(parseGraphQueryArgs(args, 'compatibility', {
19
+ '--snapshot': 'snapshotId', '--producer-fact': 'producerFactId', '--consumer-fact': 'consumerFactId',
20
+ }));
21
+ }
@@ -0,0 +1,59 @@
1
+ import { type GraphExplorationService } from '@weftlet/core';
2
+ export declare const graphNeighborsTool: {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: "object";
7
+ additionalProperties: boolean;
8
+ required: string[];
9
+ properties: {
10
+ snapshotId: {
11
+ type: string;
12
+ minLength: number;
13
+ maxLength: number;
14
+ };
15
+ nodeId: {
16
+ type: string;
17
+ minLength: number;
18
+ maxLength: number;
19
+ };
20
+ direction: {
21
+ type: string;
22
+ enum: string[];
23
+ };
24
+ predicates: {
25
+ type: string;
26
+ maxItems: 16;
27
+ items: {
28
+ type: string;
29
+ enum: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
30
+ };
31
+ };
32
+ maxFacts: {
33
+ type: string;
34
+ minimum: number;
35
+ maximum: number;
36
+ };
37
+ continuation: {
38
+ type: string;
39
+ minLength: number;
40
+ maxLength: number;
41
+ };
42
+ };
43
+ };
44
+ annotations: {
45
+ readOnlyHint: boolean;
46
+ destructiveHint: boolean;
47
+ idempotentHint: boolean;
48
+ openWorldHint: boolean;
49
+ };
50
+ };
51
+ export declare function handleGraphNeighbors(service: GraphExplorationService, value: unknown): Promise<import("@weftlet/core").GraphNeighborhood>;
52
+ export declare function graphNeighborsRequestFromArgs(args: readonly string[]): {
53
+ continuation?: string | undefined;
54
+ snapshotId: string;
55
+ nodeId: string;
56
+ direction: "incoming" | "outgoing" | "both";
57
+ predicates: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
58
+ maxFacts: number;
59
+ };
@@ -0,0 +1,27 @@
1
+ import { parseGraphQueryArgs } from './graph-query-args.js';
2
+ import { graphPredicates } from '@weftlet/core';
3
+ import { parseGraphNeighborsRequest } from '../graph/neighborhood-request.js';
4
+ export const graphNeighborsTool = {
5
+ name: 'graph.neighbors',
6
+ description: 'Look up an exact node ID in an explicit saved snapshot and page through its cited one-hop relationships. Follow returned neighbor IDs to explore further; no hydration or model calls.',
7
+ inputSchema: {
8
+ type: 'object', additionalProperties: false, required: ['snapshotId', 'nodeId'],
9
+ properties: {
10
+ snapshotId: { type: 'string', minLength: 1, maxLength: 256 },
11
+ nodeId: { type: 'string', minLength: 1, maxLength: 8192 },
12
+ direction: { type: 'string', enum: ['incoming', 'outgoing', 'both'] },
13
+ predicates: { type: 'array', maxItems: graphPredicates.length, items: { type: 'string', enum: [...graphPredicates] } },
14
+ maxFacts: { type: 'integer', minimum: 1, maximum: 200 },
15
+ continuation: { type: 'string', minLength: 1, maxLength: 2048 },
16
+ },
17
+ },
18
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
19
+ };
20
+ export function handleGraphNeighbors(service, value) {
21
+ return service.neighbors(parseGraphNeighborsRequest(value));
22
+ }
23
+ export function graphNeighborsRequestFromArgs(args) {
24
+ const flags = { '--snapshot': 'snapshotId', '--node': 'nodeId',
25
+ '--direction': 'direction', '--predicate': 'predicates', '--max-facts': 'maxFacts', '--continuation': 'continuation' };
26
+ return parseGraphNeighborsRequest(parseGraphQueryArgs(args, 'neighbors', flags));
27
+ }
@@ -0,0 +1,77 @@
1
+ import { type GraphPathQueryService } from '@weftlet/core';
2
+ export declare const graphPathsTool: {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: "object";
7
+ additionalProperties: boolean;
8
+ required: string[];
9
+ properties: {
10
+ snapshotId: {
11
+ type: string;
12
+ minLength: number;
13
+ maxLength: number;
14
+ };
15
+ fromNodeId: {
16
+ type: string;
17
+ minLength: number;
18
+ maxLength: number;
19
+ };
20
+ toNodeId: {
21
+ type: string;
22
+ minLength: number;
23
+ maxLength: number;
24
+ };
25
+ direction: {
26
+ type: string;
27
+ enum: string[];
28
+ };
29
+ predicates: {
30
+ type: string;
31
+ maxItems: 16;
32
+ items: {
33
+ type: string;
34
+ enum: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
35
+ };
36
+ };
37
+ maxDepth: {
38
+ type: string;
39
+ minimum: number;
40
+ maximum: number;
41
+ };
42
+ maxPaths: {
43
+ type: string;
44
+ minimum: number;
45
+ maximum: number;
46
+ };
47
+ maxSteps: {
48
+ type: string;
49
+ minimum: number;
50
+ maximum: number;
51
+ };
52
+ continuation: {
53
+ type: string;
54
+ minLength: number;
55
+ maxLength: number;
56
+ };
57
+ };
58
+ };
59
+ annotations: {
60
+ readOnlyHint: boolean;
61
+ destructiveHint: boolean;
62
+ idempotentHint: boolean;
63
+ openWorldHint: boolean;
64
+ };
65
+ };
66
+ export declare function handleGraphPaths(service: GraphPathQueryService, value: unknown): Promise<import("@weftlet/core").GraphPaths>;
67
+ export declare function graphPathsRequestFromArgs(args: readonly string[]): {
68
+ continuation?: string | undefined;
69
+ snapshotId: string;
70
+ fromNodeId: string;
71
+ toNodeId: string;
72
+ direction: "incoming" | "outgoing" | "both";
73
+ predicates: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
74
+ maxDepth: number;
75
+ maxPaths: number;
76
+ maxSteps: number;
77
+ };
@@ -0,0 +1,31 @@
1
+ import { parseGraphQueryArgs } from './graph-query-args.js';
2
+ import { graphPredicates } from '@weftlet/core';
3
+ import { parseGraphPathsRequest } from '../graph/path-request.js';
4
+ export const graphPathsTool = {
5
+ name: 'graph.paths',
6
+ description: 'Explore simple cited paths between exact node IDs in an explicit saved snapshot. Depth-first assertion order, not shortest/causal paths. Follow continuation with identical selectors; inspect depth/work limits and unexplored frontier. No hydration or model calls.',
7
+ inputSchema: {
8
+ type: 'object', additionalProperties: false, required: ['snapshotId', 'fromNodeId', 'toNodeId'],
9
+ properties: {
10
+ snapshotId: { type: 'string', minLength: 1, maxLength: 256 },
11
+ fromNodeId: { type: 'string', minLength: 1, maxLength: 8192 },
12
+ toNodeId: { type: 'string', minLength: 1, maxLength: 8192 },
13
+ direction: { type: 'string', enum: ['incoming', 'outgoing', 'both'] },
14
+ predicates: { type: 'array', maxItems: graphPredicates.length, items: { type: 'string', enum: [...graphPredicates] } },
15
+ maxDepth: { type: 'integer', minimum: 1, maximum: 32 },
16
+ maxPaths: { type: 'integer', minimum: 1, maximum: 20 },
17
+ maxSteps: { type: 'integer', minimum: 1, maximum: 10000 },
18
+ continuation: { type: 'string', minLength: 1, maxLength: 2048 },
19
+ },
20
+ },
21
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
22
+ };
23
+ export function handleGraphPaths(service, value) {
24
+ return service.paths(parseGraphPathsRequest(value));
25
+ }
26
+ export function graphPathsRequestFromArgs(args) {
27
+ const flags = { '--snapshot': 'snapshotId', '--from': 'fromNodeId', '--to': 'toNodeId',
28
+ '--direction': 'direction', '--predicate': 'predicates', '--max-depth': 'maxDepth', '--max-paths': 'maxPaths',
29
+ '--max-steps': 'maxSteps', '--continuation': 'continuation' };
30
+ return parseGraphPathsRequest(parseGraphQueryArgs(args, 'paths', flags));
31
+ }
@@ -0,0 +1,2 @@
1
+ /** Shared flag grammar for exact-ID graph queries; semantic validation stays in the query layer. */
2
+ export declare function parseGraphQueryArgs(args: readonly string[], operation: string, flags: Readonly<Record<string, string>>): Record<string, unknown>;
@@ -0,0 +1,25 @@
1
+ /** Shared flag grammar for exact-ID graph queries; semantic validation stays in the query layer. */
2
+ export function parseGraphQueryArgs(args, operation, flags) {
3
+ const values = {};
4
+ for (let index = 0; index < args.length; index++) {
5
+ const flag = args[index];
6
+ if (flag === '--json')
7
+ continue;
8
+ if (flag !== '--config' && !Object.hasOwn(flags, flag))
9
+ throw new Error(`Unknown graph ${operation} argument: ${flag}`);
10
+ const value = args[++index];
11
+ if (value === undefined || value.startsWith('--'))
12
+ throw new Error(`Missing value for ${flag}`);
13
+ if (flag === '--config')
14
+ continue;
15
+ const key = flags[flag];
16
+ if (key === 'predicates')
17
+ values[key] = [...(values[key] ?? []), value];
18
+ else {
19
+ if (Object.hasOwn(values, key))
20
+ throw new Error(`Repeated graph ${operation} argument: ${flag}`);
21
+ values[key] = key.startsWith('max') ? Number(value) : value;
22
+ }
23
+ }
24
+ return values;
25
+ }