@weftlet/toolkit 0.0.0-stage → 0.1.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 (157) hide show
  1. package/LICENSE +176 -0
  2. package/NOTICE +6 -0
  3. package/README.md +155 -2
  4. package/THIRD_PARTY_NOTICES.md +610 -0
  5. package/dist/application/agent-context.d.ts +23 -0
  6. package/dist/application/agent-context.js +94 -0
  7. package/dist/application/application.d.ts +23 -0
  8. package/dist/application/application.js +91 -0
  9. package/dist/application/hydrator.d.ts +49 -0
  10. package/dist/application/hydrator.js +275 -0
  11. package/dist/application/overlay.d.ts +6 -0
  12. package/dist/application/overlay.js +110 -0
  13. package/dist/application/saved-evidence.d.ts +38 -0
  14. package/dist/application/saved-evidence.js +59 -0
  15. package/dist/application/snapshot-checks.d.ts +16 -0
  16. package/dist/application/snapshot-checks.js +51 -0
  17. package/dist/cli.d.ts +3 -0
  18. package/dist/cli.js +4 -0
  19. package/dist/configuration/cache.d.ts +2 -0
  20. package/dist/configuration/cache.js +10 -0
  21. package/dist/configuration/config.d.ts +79 -0
  22. package/dist/configuration/config.js +165 -0
  23. package/dist/core.d.ts +1 -0
  24. package/dist/core.js +2 -0
  25. package/dist/extraction/codex-auth.d.ts +12 -0
  26. package/dist/extraction/codex-auth.js +74 -0
  27. package/dist/extraction/document.d.ts +5 -0
  28. package/dist/extraction/document.js +54 -0
  29. package/dist/extraction/ontology.d.ts +32 -0
  30. package/dist/extraction/ontology.js +164 -0
  31. package/dist/extraction/providers.d.ts +8 -0
  32. package/dist/extraction/providers.js +58 -0
  33. package/dist/extraction/runtime-evidence.d.ts +2 -0
  34. package/dist/extraction/runtime-evidence.js +84 -0
  35. package/dist/extraction/semantic-citations.d.ts +7 -0
  36. package/dist/extraction/semantic-citations.js +27 -0
  37. package/dist/extraction/semantic-process.d.ts +11 -0
  38. package/dist/extraction/semantic-process.js +68 -0
  39. package/dist/extraction/semantic.d.ts +73 -0
  40. package/dist/extraction/semantic.js +414 -0
  41. package/dist/extraction/static.d.ts +52 -0
  42. package/dist/extraction/static.js +322 -0
  43. package/dist/extraction/telemetry.d.ts +19 -0
  44. package/dist/extraction/telemetry.js +259 -0
  45. package/dist/governance/governance.d.ts +60 -0
  46. package/dist/governance/governance.js +209 -0
  47. package/dist/graph/authority.d.ts +2 -0
  48. package/dist/graph/authority.js +13 -0
  49. package/dist/graph/diagnostics.d.ts +5 -0
  50. package/dist/graph/diagnostics.js +61 -0
  51. package/dist/graph/query.d.ts +16 -0
  52. package/dist/graph/query.js +373 -0
  53. package/dist/graph/rdf.d.ts +26 -0
  54. package/dist/graph/rdf.js +144 -0
  55. package/dist/index.d.ts +11 -0
  56. package/dist/index.js +12 -0
  57. package/dist/infrastructure/module-resolution.d.ts +2 -0
  58. package/dist/infrastructure/module-resolution.js +10 -0
  59. package/dist/infrastructure/process.d.ts +5 -0
  60. package/dist/infrastructure/process.js +27 -0
  61. package/dist/infrastructure/util.d.ts +1 -0
  62. package/dist/infrastructure/util.js +2 -0
  63. package/dist/interfaces/cli.d.ts +4 -0
  64. package/dist/interfaces/cli.js +197 -0
  65. package/dist/interfaces/doctor.d.ts +25 -0
  66. package/dist/interfaces/doctor.js +49 -0
  67. package/dist/interfaces/init.d.ts +24 -0
  68. package/dist/interfaces/init.js +154 -0
  69. package/dist/interfaces/mcp-facade.d.ts +3 -0
  70. package/dist/interfaces/mcp-facade.js +4 -0
  71. package/dist/interfaces/mcp.d.ts +2 -0
  72. package/dist/interfaces/mcp.js +81 -0
  73. package/dist/interfaces/request.d.ts +2 -0
  74. package/dist/interfaces/request.js +59 -0
  75. package/dist/mcp.d.ts +3 -0
  76. package/dist/mcp.js +4 -0
  77. package/dist/repository/committed-tree.d.ts +2 -0
  78. package/dist/repository/committed-tree.js +35 -0
  79. package/dist/repository/git.d.ts +26 -0
  80. package/dist/repository/git.js +163 -0
  81. package/dist/repository/glob.d.ts +2 -0
  82. package/dist/repository/glob.js +46 -0
  83. package/dist/repository/working-content.d.ts +3 -0
  84. package/dist/repository/working-content.js +34 -0
  85. package/dist/storage/atomic-rename.d.ts +2 -0
  86. package/dist/storage/atomic-rename.js +22 -0
  87. package/dist/storage/storage.d.ts +15 -0
  88. package/dist/storage/storage.js +115 -0
  89. package/dist/telemetry.d.ts +1 -0
  90. package/dist/telemetry.js +2 -0
  91. package/dist/visualization/viewer-interaction.d.ts +12 -0
  92. package/dist/visualization/viewer-interaction.js +123 -0
  93. package/dist/visualization/visualization.d.ts +26 -0
  94. package/dist/visualization/visualization.js +491 -0
  95. package/docs/ADR-001-standalone-baseline.md +16 -0
  96. package/docs/ADR-002-saved-evidence.md +21 -0
  97. package/docs/ADR-003-draft-overlays.md +23 -0
  98. package/docs/ADR-004-rdf-query-path.md +37 -0
  99. package/docs/ADR-005-governance-and-optional-oml.md +37 -0
  100. package/docs/ADR-006-provider-boundaries.md +15 -0
  101. package/docs/ADR-007-toolkit-modules.md +53 -0
  102. package/docs/ADR-008-weftlet-packages.md +32 -0
  103. package/docs/CLOUD-ENVIRONMENT.md +56 -0
  104. package/docs/ENVIRONMENT-VALIDATION.md +78 -0
  105. package/docs/MIGRATING-TO-WEFTLET.md +54 -0
  106. package/docs/PROVIDERS.md +121 -0
  107. package/docs/RELEASING.md +144 -0
  108. package/docs/ROADMAP.md +53 -0
  109. package/docs/SOURCE-INVENTORY.md +48 -0
  110. package/docs/VALIDATION.md +490 -0
  111. package/docs/VIEWER.md +36 -0
  112. package/docs/architecture-baseline.json +57 -0
  113. package/docs/architecture-policy.md +41 -0
  114. package/docs/extraction-manifest.json +721 -0
  115. package/docs/licenses/REVIEW.md +16 -0
  116. package/docs/licenses/lru-cache-11.5.3-BlueOak.md +55 -0
  117. package/docs/licenses/negotiate-1.0.1-BSD.txt +22 -0
  118. package/docs/licenses/spark-md5-3.0.2-MIT.txt +7 -0
  119. package/examples/generic-typescript/context-graph.config.json +47 -0
  120. package/examples/generic-typescript/context-graph.oml.config.json +49 -0
  121. package/examples/generic-typescript/docs/search-capability.md +14 -0
  122. package/examples/generic-typescript/ontology/build.gradle +38 -0
  123. package/examples/generic-typescript/ontology/catalog.xml +5 -0
  124. package/examples/generic-typescript/ontology/settings.gradle +1 -0
  125. package/examples/generic-typescript/ontology/src/oml/context-graph.dev/core.oml +99 -0
  126. package/examples/generic-typescript/package.json +6 -0
  127. package/examples/generic-typescript/src/search.ts +11 -0
  128. package/examples/generic-typescript/test/search.test.ts +8 -0
  129. package/examples/generic-typescript/tsconfig.json +10 -0
  130. package/examples/pipeline/context-graph.config.json +49 -0
  131. package/examples/pipeline/docs/admission.md +6 -0
  132. package/examples/pipeline/docs/analysis.md +6 -0
  133. package/examples/pipeline/docs/discovery.md +6 -0
  134. package/examples/pipeline/docs/execution.md +6 -0
  135. package/examples/pipeline/docs/outcomes.md +6 -0
  136. package/examples/pipeline/docs/planning.md +6 -0
  137. package/examples/pipeline/package.json +6 -0
  138. package/examples/pipeline/src/admission.ts +9 -0
  139. package/examples/pipeline/src/analysis.ts +9 -0
  140. package/examples/pipeline/src/contracts/admission.ts +1 -0
  141. package/examples/pipeline/src/contracts/analysis.ts +1 -0
  142. package/examples/pipeline/src/contracts/discovery.ts +1 -0
  143. package/examples/pipeline/src/contracts/execution.ts +1 -0
  144. package/examples/pipeline/src/contracts/outcomes.ts +1 -0
  145. package/examples/pipeline/src/contracts/planning.ts +1 -0
  146. package/examples/pipeline/src/discovery.ts +9 -0
  147. package/examples/pipeline/src/execution.ts +9 -0
  148. package/examples/pipeline/src/outcomes.ts +9 -0
  149. package/examples/pipeline/src/planning.ts +9 -0
  150. package/examples/pipeline/src/queue.ts +12 -0
  151. package/examples/pipeline/test/pipeline.test.ts +17 -0
  152. package/examples/pipeline/tsconfig.json +12 -0
  153. package/package.json +116 -3
  154. package/runtime-check.d.mts +2 -0
  155. package/runtime-check.mjs +12 -0
  156. package/templates/context-graph-development/SKILL.md +37 -0
  157. package/third-party-tools.json +34 -0
package/package.json CHANGED
@@ -1,6 +1,119 @@
1
1
  {
2
2
  "name": "@weftlet/toolkit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Reusable commit-keyed semantic, implementation, runtime, and evidence graph toolkit",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "runtime-check.mjs",
10
+ "runtime-check.d.mts",
11
+ "LICENSE",
12
+ "NOTICE",
13
+ "README.md",
14
+ "THIRD_PARTY_NOTICES.md",
15
+ "examples/generic-typescript",
16
+ "templates/context-graph-development",
17
+ "third-party-tools.json",
18
+ "examples/pipeline",
19
+ "docs"
20
+ ],
21
+ "bin": {
22
+ "weftlet": "dist/cli.js",
23
+ "toolkit": "dist/cli.js",
24
+ "weftlet-mcp": "dist/mcp.js",
25
+ "context-graph": "dist/cli.js",
26
+ "context-graph-mcp": "dist/mcp.js"
27
+ },
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ },
34
+ "./core": {
35
+ "types": "./dist/core.d.ts",
36
+ "import": "./dist/core.js"
37
+ },
38
+ "./telemetry": {
39
+ "types": "./dist/telemetry.d.ts",
40
+ "import": "./dist/telemetry.js"
41
+ }
42
+ },
43
+ "engines": {
44
+ "node": ">=24.0.0"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public",
48
+ "provenance": true
49
+ },
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/jchewitt/weftlet.git"
53
+ },
54
+ "dependencies": {
55
+ "@comunica/query-sparql": "5.4.1",
56
+ "@modelcontextprotocol/sdk": "1.30.0",
57
+ "@opentelemetry/api": "1.9.0",
58
+ "@opentelemetry/resources": "2.2.0",
59
+ "@opentelemetry/sdk-trace-base": "2.2.0",
60
+ "@sourcegraph/scip-typescript": "0.4.0",
61
+ "import-meta-resolve": "4.2.0",
62
+ "n3": "2.7.2",
63
+ "rdf-validate-shacl": "0.6.5",
64
+ "sparqljs": "3.7.4",
65
+ "@weftlet/core": "^0.1.0"
66
+ },
67
+ "devDependencies": {
68
+ "@types/n3": "1.26.1",
69
+ "@types/node": "20.19.11",
70
+ "@typescript-eslint/parser": "8.72.0",
71
+ "dependency-cruiser": "18.7.0",
72
+ "eslint": "10.13.0",
73
+ "jscpd": "5.4.1",
74
+ "tsx": "4.20.5",
75
+ "typescript": "5.5.4",
76
+ "vitest": "3.2.4"
77
+ },
78
+ "x-extraction-modifications": "Standalone workspace, runtime assets, scripts, and destination metadata; see docs/extraction-manifest.json.",
79
+ "peerDependencies": {
80
+ "@typescript-eslint/parser": "8.72.0",
81
+ "dependency-cruiser": "18.7.0",
82
+ "eslint": "10.13.0",
83
+ "jscpd": "5.4.1"
84
+ },
85
+ "peerDependenciesMeta": {
86
+ "dependency-cruiser": {
87
+ "optional": true
88
+ },
89
+ "eslint": {
90
+ "optional": true
91
+ },
92
+ "@typescript-eslint/parser": {
93
+ "optional": true
94
+ },
95
+ "jscpd": {
96
+ "optional": true
97
+ }
98
+ },
99
+ "scripts": {
100
+ "build": "node runtime-check.mjs && node scripts/clean-build.mjs && pnpm --filter @weftlet/core build && tsc -p tsconfig.json",
101
+ "context-graph": "tsx src/cli.ts",
102
+ "hydrate": "tsx src/cli.ts hydrate --ref HEAD",
103
+ "mcp": "tsx src/mcp.ts",
104
+ "ontology:build": "tsx src/cli.ts ontology compile",
105
+ "scip:index": "scip-typescript index --pnpm-workspaces --no-global-caches",
106
+ "test": "node runtime-check.mjs && pnpm --filter @weftlet/core test && vitest run",
107
+ "test:watch": "vitest",
108
+ "context-graph:licenses": "node scripts/generate-third-party-notices.mjs",
109
+ "context-graph:licenses:check": "node scripts/generate-third-party-notices.mjs --check",
110
+ "context-graph:pack:check": "node scripts/check-publication.mjs",
111
+ "context-graph:publication-check": "pnpm build && pnpm test && pnpm govern && pnpm inventory:check && pnpm context-graph:licenses:check && pnpm context-graph:pack:check",
112
+ "inventory:update": "node scripts/update-inventory.mjs",
113
+ "inventory:check": "node scripts/update-inventory.mjs --check",
114
+ "release:prepare": "pnpm context-graph:publication-check && node scripts/release.mjs --prepare",
115
+ "release:publish": "node scripts/release.mjs --publish",
116
+ "govern": "tsx src/cli.ts govern --policy architecture.policy.json --output .context-graph/architecture-report.json",
117
+ "weftlet": "tsx src/cli.ts"
118
+ }
6
119
  }
@@ -0,0 +1,2 @@
1
+ export const minimumNodeMajor: 24;
2
+ export function assertSupportedNode(version?: string): void;
@@ -0,0 +1,12 @@
1
+ export const minimumNodeMajor = 24;
2
+
3
+ /** Run before loading dependencies that require newer Node built-ins. */
4
+ export function assertSupportedNode(version = process.versions.node) {
5
+ const major = Number(version.split('.')[0]);
6
+ if (!Number.isInteger(major) || major < minimumNodeMajor) {
7
+ throw new Error(`Weftlet requires Node.js ${minimumNodeMajor} or newer; found ${version}. ` +
8
+ 'Use Node 24 (nvm install 24 && nvm use 24), then reinstall dependencies and retry.');
9
+ }
10
+ }
11
+
12
+ assertSupportedNode();
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: context-graph-development
3
+ description: Use commit-keyed context graph evidence for nontrivial repository changes that may affect multiple components, contracts, invariants, or validation surfaces.
4
+ ---
5
+ <!-- Modified for standalone extraction; see docs/extraction-manifest.json. -->
6
+
7
+ # Context Graph Development
8
+
9
+ Context Packs classify diagnostics as missing/ambiguous intent, implementation gaps, runtime gaps,
10
+ or drift. Verify their cited sources; no query match does not prove absence from the repository.
11
+ Normal queries cap each category and disclose omissions. Use `diagnostics show --snapshot <id>`
12
+ only for graph maintenance; omitted and legacy diagnostics do not expand an implementation task.
13
+
14
+ 1. Identify the task, base/head SHA, governing document, checklist items, and initial files or
15
+ symbols.
16
+ 2. Call MCP `impact.scan` before implementation with the owner document, task, and checklist text.
17
+ Queries only read saved evidence. Run the CLI `hydrate` explicitly when refresh is needed.
18
+ Check the reported commit, configuration, scope and excluded working changes.
19
+ 3. Inspect product intent, contracts/invariants, implementation/consumers, validation evidence,
20
+ runtime evidence, confidence, unknowns, and source locations. Treat an empty coverage lane or
21
+ relevant runtime gap as unresolved context.
22
+ 4. Keep source approval, assertion review, implementation, test coverage and observed runtime
23
+ behavior distinct. An inferred/unreviewed assertion citing an approved owner document still
24
+ requires checking the citation. Never promote current behavior or model output into intent.
25
+ 5. Query progressively for relationships that need detail. Follow continuation tokens and
26
+ check depth truncation; rerun with a larger maxDepth when needed. Missing pages are not proof
27
+ of missing dependencies.
28
+ 6. Give subagents the bounded Context Pack, snapshot SHA, and unresolved assumptions.
29
+ 7. Query again after material diff changes. Historical saved evidence remains useful context but
30
+ cannot satisfy current-diff validation or merge gates.
31
+ 8. Run invariant and evidence checks before local review and on the final diff.
32
+ 9. Treat graph warnings as evidence to verify in source. Never fabricate results.
33
+ 10. If MCP is unavailable, use the repository's context-graph CLI. If both fail, report the failure
34
+ and proceed only when direct repository evidence makes the scope safe.
35
+
36
+ Configure source roots, adapters, telemetry mappings, and storage in the repository's context graph
37
+ configuration. Keep product vocabulary in an adapter rather than this generic workflow.
@@ -0,0 +1,34 @@
1
+ [
2
+ {
3
+ "name": "openCAESAR OML toolchain and core vocabularies",
4
+ "version": "2.13.x / 5.1.0",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://github.com/opencaesar",
7
+ "distribution": "Optional pinned formal ontology compiler; not redistributed in npm packages",
8
+ "x-extraction-modifications": "Modified for standalone extraction; see docs/extraction-manifest.json."
9
+ },
10
+ {
11
+ "name": "SCIP TypeScript",
12
+ "version": "0.4.0",
13
+ "license": "Apache-2.0",
14
+ "homepage": "https://github.com/sourcegraph/scip-typescript",
15
+ "distribution": "Pinned production npm dependency installed alongside the toolkit",
16
+ "x-extraction-modifications": "Modified for standalone extraction; see docs/extraction-manifest.json."
17
+ },
18
+ {
19
+ "name": "Gradle JDK 21 container",
20
+ "version": "8.10.2",
21
+ "license": "Third-party image license set",
22
+ "homepage": "https://hub.docker.com/_/gradle",
23
+ "distribution": "Optional digest-pinned formal compiler image; not redistributed in npm packages",
24
+ "x-extraction-modifications": "Modified for standalone extraction; see docs/extraction-manifest.json."
25
+ },
26
+ {
27
+ "name": "Codex CLI",
28
+ "version": "Host provided",
29
+ "license": "Host installation terms",
30
+ "homepage": "https://developers.openai.com/codex/cli",
31
+ "distribution": "Invoked from the host only; never bundled or redistributed",
32
+ "x-extraction-modifications": "Modified for standalone extraction; see docs/extraction-manifest.json."
33
+ }
34
+ ]