@weftlet/toolkit 0.1.1 → 0.2.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 (52) hide show
  1. package/README.md +39 -3
  2. package/THIRD_PARTY_NOTICES.md +33 -0
  3. package/dist/application/hydrator.js +18 -5
  4. package/dist/application/overlay.js +46 -9
  5. package/dist/application/saved-evidence.d.ts +1 -0
  6. package/dist/configuration/config.d.ts +4 -0
  7. package/dist/configuration/config.js +12 -0
  8. package/dist/configuration/scip-project.d.ts +9 -0
  9. package/dist/configuration/scip-project.js +40 -0
  10. package/dist/extraction/codex-auth.js +9 -2
  11. package/dist/extraction/codex-command.d.ts +8 -0
  12. package/dist/extraction/codex-command.js +81 -0
  13. package/dist/extraction/document-references.d.ts +18 -0
  14. package/dist/extraction/document-references.js +94 -0
  15. package/dist/extraction/document.d.ts +9 -2
  16. package/dist/extraction/document.js +44 -46
  17. package/dist/extraction/module-request.d.ts +3 -0
  18. package/dist/extraction/module-request.js +25 -0
  19. package/dist/extraction/routing.d.ts +14 -0
  20. package/dist/extraction/routing.js +151 -0
  21. package/dist/extraction/scip-project.d.ts +3 -0
  22. package/dist/extraction/scip-project.js +33 -0
  23. package/dist/extraction/semantic-process.js +17 -5
  24. package/dist/extraction/semantic.js +13 -2
  25. package/dist/extraction/static.d.ts +7 -3
  26. package/dist/extraction/static.js +15 -9
  27. package/dist/graph/query.js +21 -34
  28. package/dist/graph/ranking.d.ts +10 -0
  29. package/dist/graph/ranking.js +85 -0
  30. package/dist/interfaces/doctor.js +12 -3
  31. package/docs/ADR-002-saved-evidence.md +7 -1
  32. package/docs/ADR-003-draft-overlays.md +6 -0
  33. package/docs/ADR-004-rdf-query-path.md +6 -0
  34. package/docs/ADR-006-provider-boundaries.md +5 -0
  35. package/docs/ADR-008-weftlet-packages.md +2 -1
  36. package/docs/ADR-009-release-automation.md +39 -0
  37. package/docs/ADR-010-committed-source-indexing.md +77 -0
  38. package/docs/ADR-011-explicit-document-links.md +48 -0
  39. package/docs/ADR-012-impact-ranking.md +50 -0
  40. package/docs/ADR-013-relative-module-requests.md +58 -0
  41. package/docs/ADR-014-routing-declarations.md +108 -0
  42. package/docs/CONSUMER-TRIAL.md +165 -0
  43. package/docs/ENVIRONMENT-VALIDATION.md +9 -0
  44. package/docs/IMPACT-EVALUATION.md +363 -0
  45. package/docs/PROVIDERS.md +30 -2
  46. package/docs/RELEASING.md +128 -116
  47. package/docs/ROADMAP.md +49 -8
  48. package/docs/SOURCE-INVENTORY.md +10 -0
  49. package/docs/VALIDATION.md +394 -0
  50. package/docs/VIEWER.md +5 -0
  51. package/docs/extraction-manifest.json +104 -16
  52. package/package.json +9 -3
@@ -0,0 +1,108 @@
1
+ # ADR 014: explicit routing declarations
2
+
3
+ Status: implemented as an opt-in source of candidate dependencies. No query ranking change.
4
+
5
+ The frozen dispatch evaluation has an archival consumer with no shared TypeScript symbol
6
+ or extracted route from its producer. Matching topic strings cannot establish a subscription,
7
+ particularly across environments, filters and consumer groups. A source change can therefore
8
+ have an operational consumer that static imports alone do not retrieve.
9
+
10
+ This increment accepts a small, explicit Weftlet mapping format. It does not parse a broker's
11
+ deployment configuration or verify a running subscription. The configuration selects exact
12
+ committed files through `routingSources`. The routing extractor performs no directory expansion,
13
+ glob lookup, network request or working-checkout read. Future deployment-format adapters
14
+ can supply stronger evidence separately without changing this declaration's meaning.
15
+
16
+ ## Configuration and source format
17
+
18
+ Add the optional field to `context-graph.config.json`:
19
+
20
+ ```json
21
+ { "routingSources": ["routing/events.json"] }
22
+ ```
23
+
24
+ Commit a source such as `routing/events.json`:
25
+
26
+ ```json
27
+ {
28
+ "schemaVersion": 1,
29
+ "routes": [
30
+ {
31
+ "id": "archive-completion",
32
+ "scope": "example/dispatch",
33
+ "channel": "dispatch.completed.v1",
34
+ "producer": "src/dispatch/executor.ts",
35
+ "consumer": "src/archive/consumer.ts"
36
+ }
37
+ ]
38
+ }
39
+ ```
40
+
41
+ Paths are exact, case-sensitive repository-relative names of regular committed files. No
42
+ suffix substitution, basename guessing, symbol resolution or endpoint behavior check occurs.
43
+ IDs, scopes and channel labels are literal, case-sensitive strings. Scope distinguishes the
44
+ context in which the mapping was written; it is not proof that an environment is deployed.
45
+ There are at most 16 source files, 64 KiB per file and 500 declarations in total. Unknown
46
+ fields and duplicate JSON keys are rejected. Filters, wildcards and consumer-group semantics
47
+ are unsupported; write only the explicit endpoint mapping this format can represent.
48
+
49
+ Run `weftlet config validate`, commit the source, then explicitly `weftlet hydrate --ref HEAD`.
50
+ Configuration validation checks source selection; hydration validates the selected committed
51
+ content. With `semanticSources: []`, this routing extraction makes no model requests.
52
+
53
+ ## Identity, citations and authority
54
+
55
+ Each `(repositoryId, scope, id)` identifies one binding Workflow node. The channel is an
56
+ attribute, not a shared join key. The producer `emits` that binding and the binding
57
+ `routesThrough` its consumer. Separate records do not imply every producer delivers to every
58
+ consumer with the same topic name. Shared endpoint files can still connect bindings because
59
+ an implementation change may affect more than one declared relationship.
60
+
61
+ Both facts cite the entire committed JSON source with path, line span, content digest and
62
+ commit SHA. Binding attributes identify the record. The citation proves what the mapping
63
+ declares; file existence does not prove that code publishes, subscribes or delivers an event.
64
+ `routing-declaration-extractor@1.0.0` emits `authority: inferred`,
65
+ `sourceAuthority: inferred`, and `extractionReview: deterministic`. Confidence 1 describes
66
+ faithful parsing of an explicit declaration, not delivery confidence. Even matching
67
+ `approvedIntentSources` does not promote these mappings into approved product intent.
68
+ No runtime observation or successful test result is synthesized.
69
+
70
+ The same facts flow through RDF/SPARQL, SHACL, impact queries and visualization. Facts do
71
+ not require a separate query projection or routing-specific ranking preference. A matching
72
+ file returned through these facts is a candidate dependency with declaration provenance.
73
+
74
+ ## Failure and editing behavior
75
+
76
+ Malformed, absent or non-regular configured source files fail committed refresh before model
77
+ extraction or indexing, preserving the last valid snapshot. Missing/non-regular endpoint
78
+ files suppress both relationships for that binding and produce a cited extraction-gap
79
+ diagnostic. Duplicate `(scope, id)` declarations across all selected files suppress every
80
+ record with that identity, including identical duplicates. No winner is chosen. These are
81
+ evidence gaps, not automatic architecture violations; diagnostics do not certify completeness.
82
+
83
+ Opted-in snapshots include the routing extractor version in their identity and manifest.
84
+ Snapshots without routing retain the existing graph-v4 identity construction. Saved queries
85
+ never refresh implicitly, and semantic artifact keys are unchanged.
86
+
87
+ Draft overlays capture the selected declarations and previously referenced endpoints alongside
88
+ normal source scope, then rebuild all routing relationships from the isolated draft. The
89
+ isolated archive preserves committed inputs even when `.gitignore` matches them. Deleted
90
+ declarations invalidate their bindings and produce a gap diagnostic. Renamed/deleted endpoints
91
+ invalidate a binding until its declaration names a present file. Draft facts and source authority
92
+ are labeled `draft`; citations retain the base SHA and the captured content digest. A new
93
+ endpoint outside captured source scope fails capture even if currently clean, so later edits
94
+ cannot evade freshness checks. Configure its source scope before rebuilding. Malformed draft sources preserve the previous
95
+ overlay head. Publication IDs bind the routing extractor version, and RDF/SHACL validation
96
+ runs before a routing overlay is published. Historical snapshots and committed heads remain
97
+ unchanged.
98
+
99
+ ## Validation boundary
100
+
101
+ Tests use real temporary Git repositories and actual TypeScript indexing. They cover exact
102
+ bindings, same-topic isolation, ambiguity, missing inputs, rename/delete, dirty saved querying,
103
+ artifact reuse, RDF/projection equivalence, draft authority and failed-refresh preservation.
104
+ An independent packed-consumer smoke checks the runtime asset and queries a declared consumer.
105
+ The frozen dispatch control remains intact; a separately committed declaration/configuration
106
+ is compared against a no-routing control at the same new input SHA. This tests extraction of
107
+ explicit source mappings and linkage to code, not discovery of undeclared routes or broker
108
+ delivery. Live semantic quality, browser interaction and provider authentication remain separate.
@@ -0,0 +1,165 @@
1
+ # Evaluate Weftlet in a real project
2
+
3
+ Run this trial on the machine where you develop the consumer project. Weftlet is a local
4
+ toolkit and MCP server; it does not require a hosted Weftlet service or this project's Codex
5
+ development workspace. Saved evidence queries work without a model login. Hydrating selected
6
+ prose uses the configured provider; an OAuth failure may block new extraction but does not
7
+ remove an already published snapshot.
8
+
9
+ Use a pinned, reviewed toolkit version and its matching documentation. The current `main`
10
+ contains features beyond npm `0.1.2`, including explicit routing declarations. To evaluate
11
+ those features before their release, use both locally prepared package archives from the
12
+ same reviewed commit; see [release preparation](RELEASING.md). Record that commit separately
13
+ from the package version, which does not change with every development commit.
14
+
15
+ ## Choose tasks before querying
16
+
17
+ Start with three small, real changes: a shared contract change, a downstream consumer across
18
+ an asynchronous boundary, and a local implementation change. Before the first query, write
19
+ down each task, changed paths, expected consumers/contracts/tests/documents and why they
20
+ matter. Include a few plausible but irrelevant files as noise controls. Record the expected
21
+ relationships, not just filenames. Keep these initial expectations when reviewing results;
22
+ record later corrections separately instead of changing the denominator after seeing a score.
23
+
24
+ Review configuration and source scope before hydration. Begin with a few explicitly selected
25
+ documents and bounded `maxDocuments`, `maxSourceBytes`, `timeoutMs` and `retries`. Keep your
26
+ existing ChatGPT login mode if that is your chosen provider; there is no need to switch to
27
+ API billing. See [provider configuration](PROVIDERS.md). A second unchanged hydration should
28
+ reuse semantic artifacts. Do not use `--force-semantic` for that check.
29
+
30
+ Commit the project inputs you want indexed. Hydration reads the chosen commit while leaving
31
+ the active checkout alone; it excludes uncommitted edits. Test/workspace source inclusion and
32
+ package aliases may need an explicit [TypeScript source project](ADR-010-committed-source-indexing.md).
33
+ Do not approve documents, add routing mappings or change extraction scope merely to improve
34
+ the first measurement. Record such changes as a separate comparison with its own snapshot.
35
+
36
+ ## Capture a private run
37
+
38
+ The following commands use Bash on Linux/WSL and an already installed project-local toolkit.
39
+ Ensure `.context-graph/` is ignored first. From the consumer repository root, start a dedicated
40
+ Bash session with `bash`, then run the blocks below in that same session. Fail-fast settings
41
+ exit that session on an error while retaining the bundle; fix the cause before starting a new
42
+ trial. Native PowerShell needs equivalent redirection/exit-status handling. This recipe does
43
+ not install packages, authenticate, commit files or upload results.
44
+
45
+ ```bash
46
+ set -euo pipefail
47
+ git check-ignore -q .context-graph/trials/
48
+ trial="$PWD/.context-graph/trials/$(date -u +%Y%m%dT%H%M%SZ)-$$"
49
+ mkdir -p "$trial"
50
+ printf 'Private trial directory: %s\n' "$trial"
51
+ weftlet_cmd=("$PWD/node_modules/.bin/weftlet")
52
+ config="$PWD/context-graph.config.json"
53
+
54
+ # Captures each command's exact arguments, streams, status and elapsed seconds.
55
+ capture() {
56
+ local label="$1" started=$SECONDS status
57
+ shift
58
+ test ! -e "$trial/$label.argv.json" || return 1
59
+ node -e 'process.stdout.write(JSON.stringify(process.argv.slice(1), null, 2)+"\n")' \
60
+ "$@" > "$trial/$label.argv.json"
61
+ date -u +%Y-%m-%dT%H:%M:%SZ > "$trial/$label.started.txt"
62
+ if "$@" > "$trial/$label.stdout" 2> "$trial/$label.stderr"; then
63
+ status=0
64
+ else
65
+ status=$?
66
+ fi
67
+ printf '{"exitCode":%s,"elapsedSeconds":%s}\n' "$status" "$((SECONDS-started))" \
68
+ > "$trial/$label.result.json"
69
+ return "$status"
70
+ }
71
+
72
+ capture project-commit git rev-parse HEAD
73
+ capture working-state git status --porcelain=v1 --untracked-files=all
74
+ capture runtime node -p 'JSON.stringify({node:process.version,platform:process.platform,arch:process.arch})'
75
+ capture packages npm ls @weftlet/toolkit @weftlet/core --json
76
+ capture config "${weftlet_cmd[@]}" config show --config "$config"
77
+ capture doctor "${weftlet_cmd[@]}" doctor --config "$config"
78
+ ```
79
+
80
+ Keep the initial task expectations in `expectations.md` in this private directory before
81
+ continuing. Retain your
82
+ package lockfile, toolkit commit if using a development build, and Codex version if selected.
83
+ `doctor` reports readiness without a model request; its successful exit does not mean every
84
+ reported dependency is available or that live extraction works. There is no CLI `--version`
85
+ command; the package metadata above records installed versions.
86
+
87
+ After reviewing source scope and the provider budget, run hydration and its reuse check:
88
+
89
+ ```bash
90
+ evidence_ref=$(cat "$trial/project-commit.stdout")
91
+ capture hydrate "${weftlet_cmd[@]}" hydrate --config "$config" --ref "$evidence_ref"
92
+ snapshot=$(node -e 'const fs=require("node:fs"); process.stdout.write(JSON.parse(fs.readFileSync(process.argv[1],"utf8")).snapshotId)' "$trial/hydrate.stdout")
93
+ capture hydrate-repeat "${weftlet_cmd[@]}" hydrate --config "$config" --ref "$evidence_ref"
94
+ capture diagnostics "${weftlet_cmd[@]}" diagnostics show --config "$config" --snapshot "$snapshot"
95
+ capture shacl "${weftlet_cmd[@]}" validate --config "$config" --snapshot "$snapshot"
96
+ ```
97
+
98
+ Compare `hydrate.stdout` and `hydrate-repeat.stdout`: with unchanged inputs/configuration,
99
+ expect the same `snapshotId` and `contentDigest`, zero `semanticExtracted` on the repeat and
100
+ the expected `semanticReused` count. With no selected prose, zero reused is expected and
101
+ does not test model extraction. A refresh failure is an infrastructure/extraction result,
102
+ not a semantic-quality pass. Keep its status and stderr, and query an earlier snapshot by
103
+ its recorded ID if useful; identify that historical evidence in the trial.
104
+
105
+ ## Record what the agent actually sees
106
+
107
+ Replace the example task and path with the first predeclared task. Keep this request fixed
108
+ while paginating, including its snapshot and budgets:
109
+
110
+ ```bash
111
+ request=(impact scan --config "$config" --snapshot "$snapshot" \
112
+ --changed-file src/example.ts --task 'Describe the planned change here' \
113
+ --max-facts 60 --max-depth 32 --json)
114
+ capture task1-page1 "${weftlet_cmd[@]}" "${request[@]}"
115
+ continuation=$(node -e 'const fs=require("node:fs"); process.stdout.write(JSON.parse(fs.readFileSync(process.argv[1],"utf8")).exploration?.continuation ?? "")' "$trial/task1-page1.stdout")
116
+ if test -n "$continuation"; then
117
+ capture task1-page2 "${weftlet_cmd[@]}" "${request[@]}" --continuation "$continuation"
118
+ fi
119
+ ```
120
+
121
+ For subsequent pages, read the token from the **last** response and keep a new filename for
122
+ each page. Start with a declared three-page budget per task; preserve the final continuation
123
+ and `depthLimitReached`/`truncated` fields if you stop there. Exhausting a page budget is not
124
+ proof that other consumers are absent. Repeat for tasks two and three with distinct labels.
125
+ Keep all pages actually used, including complete provenance, coverage, ranking version and
126
+ `evidenceState`. Queries do not refresh evidence. Historical or draft evidence cannot satisfy
127
+ current-diff validation just because it contains useful relationships.
128
+
129
+ For an agent using MCP, retain the actual `impact.scan` request arguments and complete tool
130
+ responses from the client session, including continuations and any errors. Weftlet does not
131
+ persist a tool-call transcript automatically. A separate CLI replay can aid diagnosis but
132
+ does not establish what the agent saw. Also retain a short account of what the agent changed
133
+ in its implementation or test plan because of these results, and the actual test outcomes.
134
+
135
+ Retain the selected immutable snapshot, not just the mutable head pointer. With workspace
136
+ storage, it is `<repositoryRoot>/<storagePath>/snapshots/<snapshotId>.json`; the default
137
+ `storagePath` is `.context-graph`. `storageScope: "user"` instead uses a configuration/checkout
138
+ hash directory under `~/.cache/context-graph`. Preserve the original store and exact
139
+ configuration if its resolved path is uncertain. Semantic artifacts under `artifacts/semantic/`
140
+ contain model output; keep them locally if extraction debugging is needed. They are not
141
+ required to query an existing snapshot. Do not copy credentials or whole account directories.
142
+
143
+ ## Review usefulness and share only the result
144
+
145
+ For each expected relationship, record whether it appeared on page one, later within budget,
146
+ or was missed. Distinguish an absent extracted link from a reachable link beyond the budget
147
+ when the retained snapshot permits that diagnosis. Manually check cited source lines against
148
+ the recorded commit and assess whether the relationship is supported. Record wrong identities,
149
+ contradictions, misleading authority, irrelevant results and useful unexpected discoveries.
150
+ Intent approval, model assertion review, implementation, tests and runtime observations remain
151
+ separate; a test-file link does not prove that a test ran or passed.
152
+
153
+ Record elapsed hydration/query time, cache reuse, provider failures and whether the findings
154
+ changed the development decision. Keep missing evidence, rule violations and infrastructure
155
+ failures separate. These three tasks are a bounded usefulness trial, not a universal accuracy
156
+ score or a merge gate. Optional [source-checkout evaluation tooling](IMPACT-EVALUATION.md)
157
+ can score saved snapshots using an independently authored case suite; it is not an installed
158
+ `weftlet evaluate` command, and its reduced witnesses do not replace the raw pages above.
159
+
160
+ Keep the bundle private with the consumer project: configuration, paths, task text, snapshots,
161
+ model artifacts and agent transcripts can contain private product information. Do not dump
162
+ environment variables, login files or full prompts into a shared report. Share a reviewed
163
+ summary containing versions/SHAs, counts, timings, misses and a small sanitized reproduction
164
+ when possible. Browser checks can be done separately using the [viewer guide](VIEWER.md)
165
+ and [interaction checklist](ENVIRONMENT-VALIDATION.md#browser-run-through-browser-mcp).
@@ -3,6 +3,10 @@
3
3
  macOS is outside the maintainer's current validation scope. Treat the following checks
4
4
  separately; a live model provider is not a prerequisite for deterministic development.
5
5
 
6
+ These cloud checks concern the Codex workspace used to develop Weftlet. Consumer repositories
7
+ run the installed toolkit locally; they do not need this workspace or a hosted Weftlet service.
8
+ Use the [consumer trial](CONSUMER-TRIAL.md) to evaluate actual project usage.
9
+
6
10
  ## Hosted CI: verified
7
11
 
8
12
  GitHub-hosted Ubuntu run [39492039168](https://github.com/jchewitt/weftlet/actions/runs/39492039168)
@@ -17,6 +21,11 @@ passed at `4cdc4e5bc8b53bde3b23ce0be550146ac6ae817c`: the full Ubuntu job and a
17
21
  Windows job covering storage contention, committed archive bytes and all original MCP startup
18
22
  cases. This Windows subset does not establish full Windows release-preparation readiness.
19
23
 
24
+ The Windows reliability increment passed [run 39676848049](https://github.com/jchewitt/weftlet/actions/runs/39676848049):
25
+ 34 native Windows tests plus repository inventory and license checks, and the full Ubuntu
26
+ publication gate with 178 deterministic tests. The npm launchers use a synthetic CLI fixture;
27
+ this does not claim live Codex authentication or a full Windows publication gate.
28
+
20
29
  ## Fresh cloud: requires a new task
21
30
 
22
31
  Before publishing the current environment snapshot: