@descryy/core 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.
- package/LICENSE +21 -0
- package/dist/capabilities/index.d.ts +3 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +2 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/preconditions.d.ts +99 -0
- package/dist/capabilities/preconditions.d.ts.map +1 -0
- package/dist/capabilities/preconditions.js +94 -0
- package/dist/capabilities/preconditions.js.map +1 -0
- package/dist/contracts/engine.d.ts +90 -0
- package/dist/contracts/engine.d.ts.map +1 -0
- package/dist/contracts/engine.js +291 -0
- package/dist/contracts/engine.js.map +1 -0
- package/dist/contracts/index.d.ts +9 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +5 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/orphans.d.ts +96 -0
- package/dist/contracts/orphans.d.ts.map +1 -0
- package/dist/contracts/orphans.js +241 -0
- package/dist/contracts/orphans.js.map +1 -0
- package/dist/contracts/paths.d.ts +132 -0
- package/dist/contracts/paths.d.ts.map +1 -0
- package/dist/contracts/paths.js +245 -0
- package/dist/contracts/paths.js.map +1 -0
- package/dist/contracts/shapes.d.ts +99 -0
- package/dist/contracts/shapes.d.ts.map +1 -0
- package/dist/contracts/shapes.js +196 -0
- package/dist/contracts/shapes.js.map +1 -0
- package/dist/governance/budget.d.ts +89 -0
- package/dist/governance/budget.d.ts.map +1 -0
- package/dist/governance/budget.js +101 -0
- package/dist/governance/budget.js.map +1 -0
- package/dist/governance/candidate-boundary.d.ts +49 -0
- package/dist/governance/candidate-boundary.d.ts.map +1 -0
- package/dist/governance/candidate-boundary.js +51 -0
- package/dist/governance/candidate-boundary.js.map +1 -0
- package/dist/governance/escalation.d.ts +63 -0
- package/dist/governance/escalation.d.ts.map +1 -0
- package/dist/governance/escalation.js +72 -0
- package/dist/governance/escalation.js.map +1 -0
- package/dist/governance/fact-boundary.d.ts +77 -0
- package/dist/governance/fact-boundary.d.ts.map +1 -0
- package/dist/governance/fact-boundary.js +91 -0
- package/dist/governance/fact-boundary.js.map +1 -0
- package/dist/governance/finding-funnel.d.ts +109 -0
- package/dist/governance/finding-funnel.d.ts.map +1 -0
- package/dist/governance/finding-funnel.js +137 -0
- package/dist/governance/finding-funnel.js.map +1 -0
- package/dist/governance/index.d.ts +11 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +6 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/graph/build.d.ts +127 -0
- package/dist/graph/build.d.ts.map +1 -0
- package/dist/graph/build.js +0 -0
- package/dist/graph/build.js.map +1 -0
- package/dist/graph/cross-language.d.ts +70 -0
- package/dist/graph/cross-language.d.ts.map +1 -0
- package/dist/graph/cross-language.js +104 -0
- package/dist/graph/cross-language.js.map +1 -0
- package/dist/graph/index.d.ts +11 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +6 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/merge.d.ts +95 -0
- package/dist/graph/merge.d.ts.map +1 -0
- package/dist/graph/merge.js +131 -0
- package/dist/graph/merge.js.map +1 -0
- package/dist/graph/persist.d.ts +42 -0
- package/dist/graph/persist.d.ts.map +1 -0
- package/dist/graph/persist.js +52 -0
- package/dist/graph/persist.js.map +1 -0
- package/dist/graph/runtime-confirmation.d.ts +169 -0
- package/dist/graph/runtime-confirmation.d.ts.map +1 -0
- package/dist/graph/runtime-confirmation.js +318 -0
- package/dist/graph/runtime-confirmation.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger/index.d.ts +5 -0
- package/dist/ledger/index.d.ts.map +1 -0
- package/dist/ledger/index.js +3 -0
- package/dist/ledger/index.js.map +1 -0
- package/dist/ledger/mint.d.ts +81 -0
- package/dist/ledger/mint.d.ts.map +1 -0
- package/dist/ledger/mint.js +138 -0
- package/dist/ledger/mint.js.map +1 -0
- package/dist/ledger/resolve.d.ts +124 -0
- package/dist/ledger/resolve.d.ts.map +1 -0
- package/dist/ledger/resolve.js +290 -0
- package/dist/ledger/resolve.js.map +1 -0
- package/dist/multipr/fingerprint.d.ts +56 -0
- package/dist/multipr/fingerprint.d.ts.map +1 -0
- package/dist/multipr/fingerprint.js +169 -0
- package/dist/multipr/fingerprint.js.map +1 -0
- package/dist/multipr/hidden-dependency.d.ts +120 -0
- package/dist/multipr/hidden-dependency.d.ts.map +1 -0
- package/dist/multipr/hidden-dependency.js +185 -0
- package/dist/multipr/hidden-dependency.js.map +1 -0
- package/dist/multipr/index.d.ts +14 -0
- package/dist/multipr/index.d.ts.map +1 -0
- package/dist/multipr/index.js +8 -0
- package/dist/multipr/index.js.map +1 -0
- package/dist/multipr/mechanical.d.ts +239 -0
- package/dist/multipr/mechanical.d.ts.map +1 -0
- package/dist/multipr/mechanical.js +333 -0
- package/dist/multipr/mechanical.js.map +1 -0
- package/dist/multipr/migration-heads.d.ts +160 -0
- package/dist/multipr/migration-heads.d.ts.map +1 -0
- package/dist/multipr/migration-heads.js +212 -0
- package/dist/multipr/migration-heads.js.map +1 -0
- package/dist/multipr/overlap.d.ts +186 -0
- package/dist/multipr/overlap.d.ts.map +1 -0
- package/dist/multipr/overlap.js +254 -0
- package/dist/multipr/overlap.js.map +1 -0
- package/dist/multipr/scope-store.d.ts +105 -0
- package/dist/multipr/scope-store.d.ts.map +1 -0
- package/dist/multipr/scope-store.js +182 -0
- package/dist/multipr/scope-store.js.map +1 -0
- package/dist/multipr/superseded.d.ts +133 -0
- package/dist/multipr/superseded.d.ts.map +1 -0
- package/dist/multipr/superseded.js +128 -0
- package/dist/multipr/superseded.js.map +1 -0
- package/dist/query/confirmed-facts.d.ts +56 -0
- package/dist/query/confirmed-facts.d.ts.map +1 -0
- package/dist/query/confirmed-facts.js +64 -0
- package/dist/query/confirmed-facts.js.map +1 -0
- package/dist/query/declared-value-closure.d.ts +126 -0
- package/dist/query/declared-value-closure.d.ts.map +1 -0
- package/dist/query/declared-value-closure.js +156 -0
- package/dist/query/declared-value-closure.js.map +1 -0
- package/dist/query/index.d.ts +28 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +15 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/memory.d.ts +20 -0
- package/dist/query/memory.d.ts.map +1 -0
- package/dist/query/memory.js +55 -0
- package/dist/query/memory.js.map +1 -0
- package/dist/query/provider.d.ts +127 -0
- package/dist/query/provider.d.ts.map +1 -0
- package/dist/query/provider.js +54 -0
- package/dist/query/provider.js.map +1 -0
- package/dist/query/queries.d.ts +119 -0
- package/dist/query/queries.d.ts.map +1 -0
- package/dist/query/queries.js +267 -0
- package/dist/query/queries.js.map +1 -0
- package/dist/query/refusal-fetch.d.ts +114 -0
- package/dist/query/refusal-fetch.d.ts.map +1 -0
- package/dist/query/refusal-fetch.js +200 -0
- package/dist/query/refusal-fetch.js.map +1 -0
- package/dist/query/refusal-questions.d.ts +123 -0
- package/dist/query/refusal-questions.d.ts.map +1 -0
- package/dist/query/refusal-questions.js +122 -0
- package/dist/query/refusal-questions.js.map +1 -0
- package/dist/query/root-cause-score.d.ts +218 -0
- package/dist/query/root-cause-score.d.ts.map +1 -0
- package/dist/query/root-cause-score.js +251 -0
- package/dist/query/root-cause-score.js.map +1 -0
- package/dist/query/row-closure-picture.d.ts +108 -0
- package/dist/query/row-closure-picture.d.ts.map +1 -0
- package/dist/query/row-closure-picture.js +131 -0
- package/dist/query/row-closure-picture.js.map +1 -0
- package/dist/query/similar-incidents.d.ts +76 -0
- package/dist/query/similar-incidents.d.ts.map +1 -0
- package/dist/query/similar-incidents.js +169 -0
- package/dist/query/similar-incidents.js.map +1 -0
- package/dist/query/sqlite.d.ts +13 -0
- package/dist/query/sqlite.d.ts.map +1 -0
- package/dist/query/sqlite.js +54 -0
- package/dist/query/sqlite.js.map +1 -0
- package/dist/query/traverse.d.ts +110 -0
- package/dist/query/traverse.d.ts.map +1 -0
- package/dist/query/traverse.js +0 -0
- package/dist/query/traverse.js.map +1 -0
- package/dist/query/unresolved.d.ts +195 -0
- package/dist/query/unresolved.d.ts.map +1 -0
- package/dist/query/unresolved.js +225 -0
- package/dist/query/unresolved.js.map +1 -0
- package/dist/query/verification-status.d.ts +134 -0
- package/dist/query/verification-status.d.ts.map +1 -0
- package/dist/query/verification-status.js +163 -0
- package/dist/query/verification-status.js.map +1 -0
- package/dist/recording/index.d.ts +26 -0
- package/dist/recording/index.d.ts.map +1 -0
- package/dist/recording/index.js +30 -0
- package/dist/recording/index.js.map +1 -0
- package/dist/recording/migrate.d.ts +22 -0
- package/dist/recording/migrate.d.ts.map +1 -0
- package/dist/recording/migrate.js +51 -0
- package/dist/recording/migrate.js.map +1 -0
- package/dist/recording/reader.d.ts +27 -0
- package/dist/recording/reader.d.ts.map +1 -0
- package/dist/recording/reader.js +55 -0
- package/dist/recording/reader.js.map +1 -0
- package/dist/recording/redact.d.ts +63 -0
- package/dist/recording/redact.d.ts.map +1 -0
- package/dist/recording/redact.js +98 -0
- package/dist/recording/redact.js.map +1 -0
- package/dist/recording/schema.d.ts +41 -0
- package/dist/recording/schema.d.ts.map +1 -0
- package/dist/recording/schema.js +104 -0
- package/dist/recording/schema.js.map +1 -0
- package/dist/recording/writer.d.ts +120 -0
- package/dist/recording/writer.d.ts.map +1 -0
- package/dist/recording/writer.js +81 -0
- package/dist/recording/writer.js.map +1 -0
- package/dist/scoping/fanout.d.ts +86 -0
- package/dist/scoping/fanout.d.ts.map +1 -0
- package/dist/scoping/fanout.js +95 -0
- package/dist/scoping/fanout.js.map +1 -0
- package/dist/scoping/index.d.ts +10 -0
- package/dist/scoping/index.d.ts.map +1 -0
- package/dist/scoping/index.js +6 -0
- package/dist/scoping/index.js.map +1 -0
- package/dist/scoping/score.d.ts +83 -0
- package/dist/scoping/score.d.ts.map +1 -0
- package/dist/scoping/score.js +125 -0
- package/dist/scoping/score.js.map +1 -0
- package/dist/scoping/tiers.d.ts +32 -0
- package/dist/scoping/tiers.d.ts.map +1 -0
- package/dist/scoping/tiers.js +35 -0
- package/dist/scoping/tiers.js.map +1 -0
- package/dist/scoping/traverse.d.ts +60 -0
- package/dist/scoping/traverse.d.ts.map +1 -0
- package/dist/scoping/traverse.js +172 -0
- package/dist/scoping/traverse.js.map +1 -0
- package/dist/scoping/weights.d.ts +97 -0
- package/dist/scoping/weights.d.ts.map +1 -0
- package/dist/scoping/weights.js +167 -0
- package/dist/scoping/weights.js.map +1 -0
- package/dist/sources/git/diff.d.ts +53 -0
- package/dist/sources/git/diff.d.ts.map +1 -0
- package/dist/sources/git/diff.js +140 -0
- package/dist/sources/git/diff.js.map +1 -0
- package/dist/sources/git/env.d.ts +2 -0
- package/dist/sources/git/env.d.ts.map +1 -0
- package/dist/sources/git/env.js +21 -0
- package/dist/sources/git/env.js.map +1 -0
- package/dist/sources/git/history.d.ts +140 -0
- package/dist/sources/git/history.d.ts.map +1 -0
- package/dist/sources/git/history.js +314 -0
- package/dist/sources/git/history.js.map +1 -0
- package/dist/sources/git/index.d.ts +7 -0
- package/dist/sources/git/index.d.ts.map +1 -0
- package/dist/sources/git/index.js +4 -0
- package/dist/sources/git/index.js.map +1 -0
- package/dist/sources/git/source.d.ts +95 -0
- package/dist/sources/git/source.d.ts.map +1 -0
- package/dist/sources/git/source.js +0 -0
- package/dist/sources/git/source.js.map +1 -0
- package/dist/sources/migrations/dialects.d.ts +59 -0
- package/dist/sources/migrations/dialects.d.ts.map +1 -0
- package/dist/sources/migrations/dialects.js +84 -0
- package/dist/sources/migrations/dialects.js.map +1 -0
- package/dist/sources/migrations/index.d.ts +3 -0
- package/dist/sources/migrations/index.d.ts.map +1 -0
- package/dist/sources/migrations/index.js +2 -0
- package/dist/sources/migrations/index.js.map +1 -0
- package/dist/sources/migrations/read.d.ts +113 -0
- package/dist/sources/migrations/read.d.ts.map +1 -0
- package/dist/sources/migrations/read.js +270 -0
- package/dist/sources/migrations/read.js.map +1 -0
- package/dist/sources/workspace/index.d.ts +3 -0
- package/dist/sources/workspace/index.d.ts.map +1 -0
- package/dist/sources/workspace/index.js +2 -0
- package/dist/sources/workspace/index.js.map +1 -0
- package/dist/sources/workspace/workspace.d.ts +64 -0
- package/dist/sources/workspace/workspace.d.ts.map +1 -0
- package/dist/sources/workspace/workspace.js +294 -0
- package/dist/sources/workspace/workspace.js.map +1 -0
- package/dist/store/driver/driver.d.ts +82 -0
- package/dist/store/driver/driver.d.ts.map +1 -0
- package/dist/store/driver/driver.js +31 -0
- package/dist/store/driver/driver.js.map +1 -0
- package/dist/store/driver/node-sqlite.d.ts +28 -0
- package/dist/store/driver/node-sqlite.d.ts.map +1 -0
- package/dist/store/driver/node-sqlite.js +188 -0
- package/dist/store/driver/node-sqlite.js.map +1 -0
- package/dist/store/index.d.ts +33 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +46 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/migrate.d.ts +68 -0
- package/dist/store/migrate.d.ts.map +1 -0
- package/dist/store/migrate.js +140 -0
- package/dist/store/migrate.js.map +1 -0
- package/dist/store/reader.d.ts +127 -0
- package/dist/store/reader.d.ts.map +1 -0
- package/dist/store/reader.js +269 -0
- package/dist/store/reader.js.map +1 -0
- package/dist/store/schema.d.ts +87 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +322 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/writer.d.ts +116 -0
- package/dist/store/writer.d.ts.map +1 -0
- package/dist/store/writer.js +279 -0
- package/dist/store/writer.js.map +1 -0
- package/dist/tiers/certify.d.ts +375 -0
- package/dist/tiers/certify.d.ts.map +1 -0
- package/dist/tiers/certify.js +434 -0
- package/dist/tiers/certify.js.map +1 -0
- package/dist/tiers/index.d.ts +5 -0
- package/dist/tiers/index.d.ts.map +1 -0
- package/dist/tiers/index.js +3 -0
- package/dist/tiers/index.js.map +1 -0
- package/dist/tiers/ladder.d.ts +73 -0
- package/dist/tiers/ladder.d.ts.map +1 -0
- package/dist/tiers/ladder.js +197 -0
- package/dist/tiers/ladder.js.map +1 -0
- package/dist/validation/config-graph.d.ts +104 -0
- package/dist/validation/config-graph.d.ts.map +1 -0
- package/dist/validation/config-graph.js +205 -0
- package/dist/validation/config-graph.js.map +1 -0
- package/dist/validation/env.d.ts +243 -0
- package/dist/validation/env.d.ts.map +1 -0
- package/dist/validation/env.js +447 -0
- package/dist/validation/env.js.map +1 -0
- package/dist/validation/index.d.ts +16 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +9 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/join-substitution.d.ts +186 -0
- package/dist/validation/join-substitution.d.ts.map +1 -0
- package/dist/validation/join-substitution.js +191 -0
- package/dist/validation/join-substitution.js.map +1 -0
- package/dist/validation/migrations.d.ts +133 -0
- package/dist/validation/migrations.d.ts.map +1 -0
- package/dist/validation/migrations.js +315 -0
- package/dist/validation/migrations.js.map +1 -0
- package/dist/validation/nodes.d.ts +32 -0
- package/dist/validation/nodes.d.ts.map +1 -0
- package/dist/validation/nodes.js +45 -0
- package/dist/validation/nodes.js.map +1 -0
- package/dist/validation/rollback.d.ts +124 -0
- package/dist/validation/rollback.d.ts.map +1 -0
- package/dist/validation/rollback.js +302 -0
- package/dist/validation/rollback.js.map +1 -0
- package/dist/validation/route-drift.d.ts +108 -0
- package/dist/validation/route-drift.d.ts.map +1 -0
- package/dist/validation/route-drift.js +103 -0
- package/dist/validation/route-drift.js.map +1 -0
- package/dist/validation/sources.d.ts +153 -0
- package/dist/validation/sources.d.ts.map +1 -0
- package/dist/validation/sources.js +409 -0
- package/dist/validation/sources.js.map +1 -0
- package/dist/worker/index.d.ts +5 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +3 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/pool.d.ts +73 -0
- package/dist/worker/pool.d.ts.map +1 -0
- package/dist/worker/pool.js +203 -0
- package/dist/worker/pool.js.map +1 -0
- package/dist/worker/protocol.d.ts +91 -0
- package/dist/worker/protocol.d.ts.map +1 -0
- package/dist/worker/protocol.js +19 -0
- package/dist/worker/protocol.js.map +1 -0
- package/dist/worker/traversal.worker.d.ts +25 -0
- package/dist/worker/traversal.worker.d.ts.map +1 -0
- package/dist/worker/traversal.worker.js +124 -0
- package/dist/worker/traversal.worker.js.map +1 -0
- package/package.json +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sources/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The producer `migration-heads.ts` has been waiting for.
|
|
3
|
+
*
|
|
4
|
+
* §14.6's check is built, exposed through the MCP tool, and **nothing fed it**.
|
|
5
|
+
* It has been recommended four times and declined once. This is the feed.
|
|
6
|
+
*
|
|
7
|
+
* ## What it will and will not read
|
|
8
|
+
*
|
|
9
|
+
* `migration-heads.ts` says the input is *"a revision, its declared parents and
|
|
10
|
+
* where it came from — the shape every migration tool has, whatever it calls the
|
|
11
|
+
* fields"*, and it says the reading is producer work. It is right about the
|
|
12
|
+
* shape and it is wrong that every tool has it.
|
|
13
|
+
*
|
|
14
|
+
* **Two of the four common families declare a DAG and two do not**, and the
|
|
15
|
+
* difference is not cosmetic — it decides whether §14.6's finding exists at all:
|
|
16
|
+
*
|
|
17
|
+
* | family | declares | head conflict is |
|
|
18
|
+
* | --- | --- | --- |
|
|
19
|
+
* | revision/down_revision chain | one parent per revision, tuples for merges | a real failure the tool itself raises |
|
|
20
|
+
* | dependency list | `(app, name)` pairs per migration | a real failure the tool itself detects |
|
|
21
|
+
* | **timestamp-ordered directory** | **nothing** | **not a thing that can happen** |
|
|
22
|
+
*
|
|
23
|
+
* The last row covers both of the two frameworks this row named as *"the obvious
|
|
24
|
+
* first two"*. They track applied migrations as a **set** in a table, run
|
|
25
|
+
* whatever is pending in filename order, and have no multiple-head error to
|
|
26
|
+
* predict. Two changes each adding a migration is the normal case and it
|
|
27
|
+
* succeeds.
|
|
28
|
+
*
|
|
29
|
+
* Synthesising `parents = [the previous file by timestamp]` would manufacture
|
|
30
|
+
* exactly the DAG this check consumes — and would then report a conflict for
|
|
31
|
+
* *every* pair of changes that each add a migration, since both would carry the
|
|
32
|
+
* same synthesised parent. A maybe-list built from an invented format, published
|
|
33
|
+
* beside real Class A structural facts and indistinguishable from them in the
|
|
34
|
+
* output.
|
|
35
|
+
*
|
|
36
|
+
* So those files are **refused with a reason**, and the refusal is a row.
|
|
37
|
+
*
|
|
38
|
+
* ## Measured rather than assumed, and the asymmetry is stated
|
|
39
|
+
*
|
|
40
|
+
* 604 migrations across three real applications using the timestamp-ordered
|
|
41
|
+
* pattern: **0 declare a revision id or a parent.** The twelve files that matched
|
|
42
|
+
* `/parent/` matched a `parent_id` column and one comment.
|
|
43
|
+
*
|
|
44
|
+
* The other timestamp-ordered ecosystem is refused on **documented behaviour**,
|
|
45
|
+
* because no corpus using it was available here. That is a weaker basis than the
|
|
46
|
+
* measured one and is labelled as such rather than folded in beside it.
|
|
47
|
+
*
|
|
48
|
+
* ## Everything this produces is R0, and the ceiling follows
|
|
49
|
+
*
|
|
50
|
+
* A regex over source text. §15.2 lists migration head conflict as Class A and
|
|
51
|
+
* §15.3 already settles the disagreement: **the Class column is a ceiling, not a
|
|
52
|
+
* floor.** Per DEC-058 the record carries the resolution of its own evidence, so
|
|
53
|
+
* a conflict computed from these records caps at C however certain the
|
|
54
|
+
* arithmetic above it. Class A needs the framework's own migration history —
|
|
55
|
+
* DEC-115's promotion path — which needs the tool installed and run.
|
|
56
|
+
*
|
|
57
|
+
* **Nothing here installs or runs anything**, by policy: cloned third-party
|
|
58
|
+
* source is arbitrary code and installing it executes it. The cost of that policy
|
|
59
|
+
* is this ceiling, and it is disclosed rather than hidden.
|
|
60
|
+
*
|
|
61
|
+
* ## `"unknown"` is not `[]`, enforced here rather than downstream
|
|
62
|
+
*
|
|
63
|
+
* A migration whose parent line could not be read gets `"unknown"`. An initial
|
|
64
|
+
* migration gets `[]`. `migration-heads.ts` makes the distinction unrepresentable
|
|
65
|
+
* in its type for a reason — an unread migration might be exactly the merge that
|
|
66
|
+
* resolves the fork being reported — and a producer that returns `[]` on a failed
|
|
67
|
+
* match would defeat that from below.
|
|
68
|
+
*/
|
|
69
|
+
import type { ResolutionLevel } from "@descryy/ir";
|
|
70
|
+
import type { MigrationRecord } from "../../multipr/migration-heads.ts";
|
|
71
|
+
import { DIALECTS, REFUSED } from "./dialects.ts";
|
|
72
|
+
import type { Dialect, ParentsKind, RefusedFamily } from "./dialects.ts";
|
|
73
|
+
export { DIALECTS, REFUSED };
|
|
74
|
+
export type { Dialect, ParentsKind, RefusedFamily };
|
|
75
|
+
/** One file this producer declined, and why. A refusal is a row, never a silence. */
|
|
76
|
+
export interface MigrationRefusal {
|
|
77
|
+
readonly file: string;
|
|
78
|
+
readonly reason: string;
|
|
79
|
+
/** Set when the file matched a family that is refused by design rather than by failure. */
|
|
80
|
+
readonly family?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface MigrationReadReport {
|
|
83
|
+
readonly records: readonly MigrationRecord[];
|
|
84
|
+
readonly refusals: readonly MigrationRefusal[];
|
|
85
|
+
/**
|
|
86
|
+
* False when no file matched any dialect at all.
|
|
87
|
+
*
|
|
88
|
+
* An empty `records` with `analysed: false` means no migration format was
|
|
89
|
+
* recognised, not that the change adds no migrations — the same distinction
|
|
90
|
+
* `hidden-dependency.ts` draws for co-change history, for the same reason.
|
|
91
|
+
*/
|
|
92
|
+
readonly analysed: boolean;
|
|
93
|
+
readonly checked: {
|
|
94
|
+
readonly files: number;
|
|
95
|
+
readonly matchedDialect: number;
|
|
96
|
+
readonly matchedRefusedFamily: number;
|
|
97
|
+
readonly unrecognised: number;
|
|
98
|
+
readonly parentsUnknown: number;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface ReadOptions {
|
|
102
|
+
/** Reads the file. Injectable so the whole producer is testable with no disk. */
|
|
103
|
+
readonly read?: (path: string) => string;
|
|
104
|
+
readonly resolution?: ResolutionLevel;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Read every migration a change adds.
|
|
108
|
+
*
|
|
109
|
+
* @param prId whatever identifies the change — passed straight through
|
|
110
|
+
* @param files paths the change added, relative to the repository root
|
|
111
|
+
*/
|
|
112
|
+
export declare function readMigrations(prId: string, files: readonly string[], options?: ReadOptions): MigrationReadReport;
|
|
113
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/sources/migrations/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC7B,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AAEpD,qFAAqF;AACrF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;KACjC,CAAC;CACH;AAsGD,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,GAAE,WAAgB,GACxB,mBAAmB,CAoGrB"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The producer `migration-heads.ts` has been waiting for.
|
|
3
|
+
*
|
|
4
|
+
* §14.6's check is built, exposed through the MCP tool, and **nothing fed it**.
|
|
5
|
+
* It has been recommended four times and declined once. This is the feed.
|
|
6
|
+
*
|
|
7
|
+
* ## What it will and will not read
|
|
8
|
+
*
|
|
9
|
+
* `migration-heads.ts` says the input is *"a revision, its declared parents and
|
|
10
|
+
* where it came from — the shape every migration tool has, whatever it calls the
|
|
11
|
+
* fields"*, and it says the reading is producer work. It is right about the
|
|
12
|
+
* shape and it is wrong that every tool has it.
|
|
13
|
+
*
|
|
14
|
+
* **Two of the four common families declare a DAG and two do not**, and the
|
|
15
|
+
* difference is not cosmetic — it decides whether §14.6's finding exists at all:
|
|
16
|
+
*
|
|
17
|
+
* | family | declares | head conflict is |
|
|
18
|
+
* | --- | --- | --- |
|
|
19
|
+
* | revision/down_revision chain | one parent per revision, tuples for merges | a real failure the tool itself raises |
|
|
20
|
+
* | dependency list | `(app, name)` pairs per migration | a real failure the tool itself detects |
|
|
21
|
+
* | **timestamp-ordered directory** | **nothing** | **not a thing that can happen** |
|
|
22
|
+
*
|
|
23
|
+
* The last row covers both of the two frameworks this row named as *"the obvious
|
|
24
|
+
* first two"*. They track applied migrations as a **set** in a table, run
|
|
25
|
+
* whatever is pending in filename order, and have no multiple-head error to
|
|
26
|
+
* predict. Two changes each adding a migration is the normal case and it
|
|
27
|
+
* succeeds.
|
|
28
|
+
*
|
|
29
|
+
* Synthesising `parents = [the previous file by timestamp]` would manufacture
|
|
30
|
+
* exactly the DAG this check consumes — and would then report a conflict for
|
|
31
|
+
* *every* pair of changes that each add a migration, since both would carry the
|
|
32
|
+
* same synthesised parent. A maybe-list built from an invented format, published
|
|
33
|
+
* beside real Class A structural facts and indistinguishable from them in the
|
|
34
|
+
* output.
|
|
35
|
+
*
|
|
36
|
+
* So those files are **refused with a reason**, and the refusal is a row.
|
|
37
|
+
*
|
|
38
|
+
* ## Measured rather than assumed, and the asymmetry is stated
|
|
39
|
+
*
|
|
40
|
+
* 604 migrations across three real applications using the timestamp-ordered
|
|
41
|
+
* pattern: **0 declare a revision id or a parent.** The twelve files that matched
|
|
42
|
+
* `/parent/` matched a `parent_id` column and one comment.
|
|
43
|
+
*
|
|
44
|
+
* The other timestamp-ordered ecosystem is refused on **documented behaviour**,
|
|
45
|
+
* because no corpus using it was available here. That is a weaker basis than the
|
|
46
|
+
* measured one and is labelled as such rather than folded in beside it.
|
|
47
|
+
*
|
|
48
|
+
* ## Everything this produces is R0, and the ceiling follows
|
|
49
|
+
*
|
|
50
|
+
* A regex over source text. §15.2 lists migration head conflict as Class A and
|
|
51
|
+
* §15.3 already settles the disagreement: **the Class column is a ceiling, not a
|
|
52
|
+
* floor.** Per DEC-058 the record carries the resolution of its own evidence, so
|
|
53
|
+
* a conflict computed from these records caps at C however certain the
|
|
54
|
+
* arithmetic above it. Class A needs the framework's own migration history —
|
|
55
|
+
* DEC-115's promotion path — which needs the tool installed and run.
|
|
56
|
+
*
|
|
57
|
+
* **Nothing here installs or runs anything**, by policy: cloned third-party
|
|
58
|
+
* source is arbitrary code and installing it executes it. The cost of that policy
|
|
59
|
+
* is this ceiling, and it is disclosed rather than hidden.
|
|
60
|
+
*
|
|
61
|
+
* ## `"unknown"` is not `[]`, enforced here rather than downstream
|
|
62
|
+
*
|
|
63
|
+
* A migration whose parent line could not be read gets `"unknown"`. An initial
|
|
64
|
+
* migration gets `[]`. `migration-heads.ts` makes the distinction unrepresentable
|
|
65
|
+
* in its type for a reason — an unread migration might be exactly the merge that
|
|
66
|
+
* resolves the fork being reported — and a producer that returns `[]` on a failed
|
|
67
|
+
* match would defeat that from below.
|
|
68
|
+
*/
|
|
69
|
+
import { readFileSync } from "node:fs";
|
|
70
|
+
import { basename } from "node:path";
|
|
71
|
+
import { DIALECTS, REFUSED } from "./dialects.js";
|
|
72
|
+
export { DIALECTS, REFUSED };
|
|
73
|
+
/**
|
|
74
|
+
* Glob subset sufficient for these patterns: `**` across directory boundaries,
|
|
75
|
+
* `*` within one segment.
|
|
76
|
+
*
|
|
77
|
+
* Scanned rather than built by chained `replace`. The chained version needs a
|
|
78
|
+
* placeholder to stop `**` being rewritten by the `*` pass, the placeholder has
|
|
79
|
+
* to be a character no path contains, and the obvious choice is a raw control
|
|
80
|
+
* byte — which is exactly how `sources/git/source.ts` came to be binary to git
|
|
81
|
+
* and grep, found in the same batch of work as this file. A scan has no ordering
|
|
82
|
+
* problem, so it needs no placeholder, so the question never arises.
|
|
83
|
+
*/
|
|
84
|
+
function globToRegExp(glob) {
|
|
85
|
+
let out = "";
|
|
86
|
+
for (let i = 0; i < glob.length; i += 1) {
|
|
87
|
+
const char = glob[i];
|
|
88
|
+
if (char !== "*") {
|
|
89
|
+
out += /[a-zA-Z0-9_-]/.test(char) ? char : `\\${char}`;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (glob[i + 1] === "*") {
|
|
93
|
+
// `**/` is any number of directory segments, INCLUDING none — so
|
|
94
|
+
// `**/versions/*.py` matches `versions/a.py` as well as `x/y/versions/a.py`.
|
|
95
|
+
if (glob[i + 2] === "/") {
|
|
96
|
+
out += "(?:[^/]*/)*";
|
|
97
|
+
i += 2;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
out += ".*";
|
|
101
|
+
i += 1;
|
|
102
|
+
}
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
out += "[^/]*";
|
|
106
|
+
}
|
|
107
|
+
return new RegExp(`^${out}$`);
|
|
108
|
+
}
|
|
109
|
+
const matchesAny = (path, globs) => globs.some((glob) => globToRegExp(glob).test(path));
|
|
110
|
+
/**
|
|
111
|
+
* Parse the captured right-hand side of a parents declaration.
|
|
112
|
+
*
|
|
113
|
+
* Returns `null` when the expression was found but could not be understood —
|
|
114
|
+
* which becomes `"unknown"`, never `[]`. A null literal is the one case that
|
|
115
|
+
* legitimately yields the empty list, because a declared root genuinely has no
|
|
116
|
+
* parent.
|
|
117
|
+
*/
|
|
118
|
+
function parseParents(raw, kind) {
|
|
119
|
+
const text = raw.trim().replace(/#.*$/, "").trim();
|
|
120
|
+
// A declared root. The only path from a matched expression to an empty list.
|
|
121
|
+
if (/^(none|null|nil)$/i.test(text))
|
|
122
|
+
return [];
|
|
123
|
+
switch (kind) {
|
|
124
|
+
case "single-or-none": {
|
|
125
|
+
const single = /^["']([^"']+)["']/.exec(text);
|
|
126
|
+
if (single !== null)
|
|
127
|
+
return [single[1]];
|
|
128
|
+
// A merge revision names several. Bracketed or parenthesised, both seen.
|
|
129
|
+
if (/^[([]/.test(text)) {
|
|
130
|
+
const ids = [...text.matchAll(/["']([^"']+)["']/g)].map((m) => m[1]);
|
|
131
|
+
return ids.length > 0 ? ids : null;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
case "id-list": {
|
|
136
|
+
const ids = [...text.matchAll(/["']([^"']+)["']/g)].map((m) => m[1]);
|
|
137
|
+
return ids.length > 0 ? ids : null;
|
|
138
|
+
}
|
|
139
|
+
case "pair-list": {
|
|
140
|
+
// Two-element tuples. Joined with `/` so a revision id is a single string
|
|
141
|
+
// at this boundary, which is what MigrationRecord.revision is.
|
|
142
|
+
const pairs = [
|
|
143
|
+
...text.matchAll(/[([]\s*["']([^"']+)["']\s*,\s*["']([^"']+)["']\s*[)\]]/g),
|
|
144
|
+
].map((m) => `${m[1]}/${m[2]}`);
|
|
145
|
+
// An empty list is a declared root here — `dependencies = []` is written
|
|
146
|
+
// explicitly by the first migration of an application.
|
|
147
|
+
if (pairs.length === 0)
|
|
148
|
+
return text.replace(/\s/g, "") === "" ? [] : null;
|
|
149
|
+
return pairs;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function revisionOf(dialect, path, text) {
|
|
154
|
+
if (dialect.revision !== undefined) {
|
|
155
|
+
const match = new RegExp(dialect.revision, "m").exec(text);
|
|
156
|
+
if (match !== null)
|
|
157
|
+
return match[1];
|
|
158
|
+
}
|
|
159
|
+
if (dialect.revisionFromFilename !== undefined) {
|
|
160
|
+
const match = new RegExp(dialect.revisionFromFilename).exec(basename(path));
|
|
161
|
+
if (match !== null) {
|
|
162
|
+
// The application directory disambiguates two migrations that share a
|
|
163
|
+
// numeric prefix, which is the normal case across a multi-app repository.
|
|
164
|
+
const app = /(?:^|\/)([^/]+)\/migrations\/[^/]+$/.exec(path)?.[1];
|
|
165
|
+
return app === undefined ? match[1] : `${app}/${match[1]}`;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Read every migration a change adds.
|
|
172
|
+
*
|
|
173
|
+
* @param prId whatever identifies the change — passed straight through
|
|
174
|
+
* @param files paths the change added, relative to the repository root
|
|
175
|
+
*/
|
|
176
|
+
export function readMigrations(prId, files, options = {}) {
|
|
177
|
+
const read = options.read ?? ((path) => readFileSync(path, "utf8"));
|
|
178
|
+
const resolution = options.resolution ?? 0;
|
|
179
|
+
const records = [];
|
|
180
|
+
const refusals = [];
|
|
181
|
+
let matchedDialect = 0;
|
|
182
|
+
let matchedRefusedFamily = 0;
|
|
183
|
+
let unrecognised = 0;
|
|
184
|
+
let parentsUnknown = 0;
|
|
185
|
+
for (const file of files) {
|
|
186
|
+
const refusedFamily = REFUSED.find((family) => matchesAny(file, family.files));
|
|
187
|
+
const dialect = DIALECTS.find((d) => matchesAny(file, d.files));
|
|
188
|
+
// A refused family wins over a dialect match. The dependency-list dialect's
|
|
189
|
+
// glob is broad enough to catch a timestamp-ordered directory that happens
|
|
190
|
+
// to be named `migrations/`, and admitting it there would be the invented
|
|
191
|
+
// format arriving through a glob rather than through a decision.
|
|
192
|
+
if (refusedFamily !== undefined) {
|
|
193
|
+
matchedRefusedFamily += 1;
|
|
194
|
+
refusals.push({
|
|
195
|
+
file,
|
|
196
|
+
family: refusedFamily.id,
|
|
197
|
+
reason: refusedFamily.why,
|
|
198
|
+
});
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (dialect === undefined) {
|
|
202
|
+
unrecognised += 1;
|
|
203
|
+
refusals.push({
|
|
204
|
+
file,
|
|
205
|
+
reason: "no dialect matched this path. Not a finding that the file declares no migration — " +
|
|
206
|
+
"nothing read it.",
|
|
207
|
+
});
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
let text;
|
|
211
|
+
try {
|
|
212
|
+
text = read(file);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
unrecognised += 1;
|
|
216
|
+
refusals.push({ file, reason: `could not be read: ${String(error)}` });
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
const revision = revisionOf(dialect, file, text);
|
|
220
|
+
if (revision === null) {
|
|
221
|
+
matchedDialect += 1;
|
|
222
|
+
refusals.push({
|
|
223
|
+
file,
|
|
224
|
+
family: dialect.id,
|
|
225
|
+
reason: `matched the ${dialect.displayName} dialect but declares no revision id this ` +
|
|
226
|
+
"producer could read. No record is emitted: a migration with no identity cannot " +
|
|
227
|
+
"be a head or descend from one.",
|
|
228
|
+
});
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const raw = new RegExp(dialect.parents, "m").exec(text);
|
|
232
|
+
let parents;
|
|
233
|
+
if (raw === null) {
|
|
234
|
+
parents = "unknown";
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
const parsed = parseParents(raw[1], dialect.parentsKind);
|
|
238
|
+
parents = parsed === null ? "unknown" : parsed;
|
|
239
|
+
}
|
|
240
|
+
// A second declaration channel, where the dialect has one. Merged rather
|
|
241
|
+
// than replacing: both are real predecessors.
|
|
242
|
+
if (dialect.alsoParents !== undefined && parents !== "unknown") {
|
|
243
|
+
const extraRaw = new RegExp(dialect.alsoParents, "m").exec(text);
|
|
244
|
+
if (extraRaw !== null) {
|
|
245
|
+
const extra = parseParents(extraRaw[1], dialect.parentsKind);
|
|
246
|
+
if (extra === null)
|
|
247
|
+
parents = "unknown";
|
|
248
|
+
else if (extra.length > 0)
|
|
249
|
+
parents = [...new Set([...parents, ...extra])];
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (parents === "unknown")
|
|
253
|
+
parentsUnknown += 1;
|
|
254
|
+
matchedDialect += 1;
|
|
255
|
+
records.push({ prId, revision, parents, file, resolution });
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
records,
|
|
259
|
+
refusals,
|
|
260
|
+
analysed: matchedDialect > 0,
|
|
261
|
+
checked: {
|
|
262
|
+
files: files.length,
|
|
263
|
+
matchedDialect,
|
|
264
|
+
matchedRefusedFamily,
|
|
265
|
+
unrecognised,
|
|
266
|
+
parentsUnknown,
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/sources/migrations/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIrC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AA+B7B;;;;;;;;;;GAUG;AACH,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACtB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACvD,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACxB,iEAAiE;YACjE,6EAA6E;YAC7E,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;gBACxB,GAAG,IAAI,aAAa,CAAC;gBACrB,CAAC,IAAI,CAAC,CAAC;YACT,CAAC;iBAAM,CAAC;gBACN,GAAG,IAAI,IAAI,CAAC;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C,CAAC;IAC9D,CAAC;IAED,OAAO;QACL,OAAO;QACP,QAAQ;QACR,QAAQ,EAAE,cAAc,GAAG,CAAC;QAC5B,OAAO,EAAE;YACP,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,cAAc;YACd,oBAAoB;YACpB,YAAY;YACZ,cAAc;SACf;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sources/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sources/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace declaration — DEC-075 §7.
|
|
3
|
+
*
|
|
4
|
+
* A multi-repo or monorepo run needs two facts a graph cannot supply on its
|
|
5
|
+
* own: which package roots exist, and which of them are meant to talk to
|
|
6
|
+
* each other. `descry.json` at the repository root is where both are
|
|
7
|
+
* declared, with an optional `descry` key inside `package.json` or
|
|
8
|
+
* `pyproject.toml` for a project that would rather not add a file. The root
|
|
9
|
+
* file wins where more than one location is present — it is the one
|
|
10
|
+
* location that works for a locally installed tool with no hosted backend,
|
|
11
|
+
* and it is greppable.
|
|
12
|
+
*
|
|
13
|
+
* ## Nx, Turborepo, pnpm and npm workspaces are read for the package LIST,
|
|
14
|
+
* ## and never for a pairing
|
|
15
|
+
*
|
|
16
|
+
* Enumerating packages from a workspace manifest is reading a declaration —
|
|
17
|
+
* the manifest states which directories are packages, so there is nothing to
|
|
18
|
+
* infer. Deciding that `apps/web` talks to `apps/api` is a name inference,
|
|
19
|
+
* and the correct mechanism already exists one layer up: a pairing is either
|
|
20
|
+
* declared here, in `descry.json`, or it falls out of a real
|
|
21
|
+
* `USES_API`/`SERVES_API` join at R3. This module supplies the declared half
|
|
22
|
+
* only; it does not guess a pairing from two directory names that sound
|
|
23
|
+
* related, for the same reason a Python `Company` must not join a
|
|
24
|
+
* TypeScript `Company` on a shared word.
|
|
25
|
+
*
|
|
26
|
+
* ## Precision over recall in the glob reader
|
|
27
|
+
*
|
|
28
|
+
* `workspaces` in `package.json` and `packages:` in `pnpm-workspace.yaml`
|
|
29
|
+
* hold globs, not paths. Only the one shape actually used across real
|
|
30
|
+
* monorepos in this project's own reference set — `dir/*`, one segment of
|
|
31
|
+
* wildcard at the end — is expanded, by listing `dir`'s subdirectories that
|
|
32
|
+
* themselves contain a `package.json`. A more elaborate glob (`**`, a
|
|
33
|
+
* mid-path wildcard, a negation) is left unexpanded and disclosed on
|
|
34
|
+
* `unexpandedGlobs` rather than approximated — an approximated package list
|
|
35
|
+
* silently mis-scopes every check that follows it.
|
|
36
|
+
*/
|
|
37
|
+
export interface WorkspacePairing {
|
|
38
|
+
/** Repo-relative package path, forward slashes. */
|
|
39
|
+
readonly from: string;
|
|
40
|
+
readonly to: string;
|
|
41
|
+
}
|
|
42
|
+
export type DeclarationSource = "descry.json" | "package.json#descry" | "pyproject.toml#tool.descry" | "none";
|
|
43
|
+
export type PackagesSource = "declared" | "package.json#workspaces" | "pnpm-workspace.yaml" | "none";
|
|
44
|
+
export interface WorkspaceDeclaration {
|
|
45
|
+
readonly root: string;
|
|
46
|
+
readonly declarationSource: DeclarationSource;
|
|
47
|
+
/** Repo-relative package directories, forward slashes. */
|
|
48
|
+
readonly packages: readonly string[];
|
|
49
|
+
readonly packagesSource: PackagesSource;
|
|
50
|
+
/** Declared cross-package pairings. Never inferred from names. */
|
|
51
|
+
readonly pairings: readonly WorkspacePairing[];
|
|
52
|
+
/** A workspace glob this reader would not expand, so it is disclosed rather than guessed. */
|
|
53
|
+
readonly unexpandedGlobs: readonly string[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Resolve `root`'s workspace declaration: which packages it holds and which
|
|
57
|
+
* of them are declared as talking to each other. `descry.json` wins over a
|
|
58
|
+
* `package.json#descry` key, which wins over `pyproject.toml`'s
|
|
59
|
+
* `[tool.descry]` table; the first one found is used whole, never merged
|
|
60
|
+
* across locations — a package list assembled from two files is a package
|
|
61
|
+
* list nobody wrote down.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveWorkspace(root: string): WorkspaceDeclaration;
|
|
64
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/sources/workspace/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,qBAAqB,GAAG,4BAA4B,GAAG,MAAM,CAAC;AAC9G,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,yBAAyB,GACzB,qBAAqB,GACrB,MAAM,CAAC;AAEX,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,6FAA6F;IAC7F,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AA2MD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAuCnE"}
|