@mortice/mapwright 0.8.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 (166) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/LICENSE +21 -0
  3. package/README.md +262 -0
  4. package/dist/catalogue/canonicalisation.d.ts +36 -0
  5. package/dist/catalogue/canonicalisation.js +262 -0
  6. package/dist/catalogue/config.d.ts +13 -0
  7. package/dist/catalogue/config.js +77 -0
  8. package/dist/catalogue/deterministic.d.ts +3 -0
  9. package/dist/catalogue/deterministic.js +25 -0
  10. package/dist/catalogue/diagnostics.d.ts +2 -0
  11. package/dist/catalogue/diagnostics.js +34 -0
  12. package/dist/catalogue/evidence.d.ts +1 -0
  13. package/dist/catalogue/evidence.js +10 -0
  14. package/dist/catalogue/examples.d.ts +3 -0
  15. package/dist/catalogue/examples.js +20 -0
  16. package/dist/catalogue/identity.d.ts +61 -0
  17. package/dist/catalogue/identity.js +114 -0
  18. package/dist/catalogue/ignore.d.ts +4 -0
  19. package/dist/catalogue/ignore.js +29 -0
  20. package/dist/catalogue/indexer.d.ts +20 -0
  21. package/dist/catalogue/indexer.js +1393 -0
  22. package/dist/catalogue/linkage.d.ts +16 -0
  23. package/dist/catalogue/linkage.js +419 -0
  24. package/dist/catalogue/moduleResolution.d.ts +4 -0
  25. package/dist/catalogue/moduleResolution.js +67 -0
  26. package/dist/catalogue/ordering.d.ts +13 -0
  27. package/dist/catalogue/ordering.js +86 -0
  28. package/dist/catalogue/packages.d.ts +12 -0
  29. package/dist/catalogue/packages.js +475 -0
  30. package/dist/catalogue/pythonReExports.d.ts +7 -0
  31. package/dist/catalogue/pythonReExports.js +113 -0
  32. package/dist/catalogue/resolveRefs.d.ts +40 -0
  33. package/dist/catalogue/resolveRefs.js +284 -0
  34. package/dist/catalogue/scanner.d.ts +8 -0
  35. package/dist/catalogue/scanner.js +99 -0
  36. package/dist/catalogue/schema.d.ts +289 -0
  37. package/dist/catalogue/schema.js +1 -0
  38. package/dist/catalogue/store.d.ts +41 -0
  39. package/dist/catalogue/store.js +209 -0
  40. package/dist/catalogue/templates.d.ts +18 -0
  41. package/dist/catalogue/templates.js +158 -0
  42. package/dist/catalogue/version.d.ts +12 -0
  43. package/dist/catalogue/version.js +30 -0
  44. package/dist/cli/commands/adoptionPlan.d.ts +8 -0
  45. package/dist/cli/commands/adoptionPlan.js +24 -0
  46. package/dist/cli/commands/auditDocs.d.ts +8 -0
  47. package/dist/cli/commands/auditDocs.js +24 -0
  48. package/dist/cli/commands/changeImpact.d.ts +10 -0
  49. package/dist/cli/commands/changeImpact.js +36 -0
  50. package/dist/cli/commands/changes.d.ts +12 -0
  51. package/dist/cli/commands/changes.js +31 -0
  52. package/dist/cli/commands/check.d.ts +9 -0
  53. package/dist/cli/commands/check.js +4 -0
  54. package/dist/cli/commands/compatibility.d.ts +10 -0
  55. package/dist/cli/commands/compatibility.js +43 -0
  56. package/dist/cli/commands/diff.d.ts +31 -0
  57. package/dist/cli/commands/diff.js +118 -0
  58. package/dist/cli/commands/dogfood.d.ts +8 -0
  59. package/dist/cli/commands/dogfood.js +24 -0
  60. package/dist/cli/commands/drift.d.ts +8 -0
  61. package/dist/cli/commands/drift.js +13 -0
  62. package/dist/cli/commands/index.d.ts +9 -0
  63. package/dist/cli/commands/index.js +9 -0
  64. package/dist/cli/commands/indexWorkspace.d.ts +8 -0
  65. package/dist/cli/commands/indexWorkspace.js +23 -0
  66. package/dist/cli/commands/recommendConfig.d.ts +7 -0
  67. package/dist/cli/commands/recommendConfig.js +20 -0
  68. package/dist/cli/commands/schema.d.ts +1 -0
  69. package/dist/cli/commands/schema.js +37 -0
  70. package/dist/cli/commands/template.d.ts +5 -0
  71. package/dist/cli/commands/template.js +44 -0
  72. package/dist/cli/commands/validate.d.ts +9 -0
  73. package/dist/cli/commands/validate.js +85 -0
  74. package/dist/cli/index.d.ts +2 -0
  75. package/dist/cli/index.js +211 -0
  76. package/dist/comparison/artefactValidate.d.ts +19 -0
  77. package/dist/comparison/artefactValidate.js +334 -0
  78. package/dist/comparison/candidates.d.ts +12 -0
  79. package/dist/comparison/candidates.js +391 -0
  80. package/dist/comparison/compare.d.ts +15 -0
  81. package/dist/comparison/compare.js +240 -0
  82. package/dist/comparison/compatibility.d.ts +26 -0
  83. package/dist/comparison/compatibility.js +316 -0
  84. package/dist/comparison/drift.d.ts +34 -0
  85. package/dist/comparison/drift.js +71 -0
  86. package/dist/comparison/identity.d.ts +30 -0
  87. package/dist/comparison/identity.js +73 -0
  88. package/dist/comparison/impact.d.ts +14 -0
  89. package/dist/comparison/impact.js +291 -0
  90. package/dist/comparison/index.d.ts +6 -0
  91. package/dist/comparison/index.js +6 -0
  92. package/dist/comparison/integrity.d.ts +12 -0
  93. package/dist/comparison/integrity.js +199 -0
  94. package/dist/comparison/ordering.d.ts +4 -0
  95. package/dist/comparison/ordering.js +69 -0
  96. package/dist/comparison/projections.d.ts +19 -0
  97. package/dist/comparison/projections.js +185 -0
  98. package/dist/comparison/relationshipPolicy.d.ts +19 -0
  99. package/dist/comparison/relationshipPolicy.js +98 -0
  100. package/dist/comparison/schema.d.ts +178 -0
  101. package/dist/comparison/schema.js +16 -0
  102. package/dist/comparison/store.d.ts +58 -0
  103. package/dist/comparison/store.js +462 -0
  104. package/dist/comparison/validate.d.ts +23 -0
  105. package/dist/comparison/validate.js +137 -0
  106. package/dist/comparison/version.d.ts +9 -0
  107. package/dist/comparison/version.js +11 -0
  108. package/dist/extractors/docTags.d.ts +9 -0
  109. package/dist/extractors/docTags.js +106 -0
  110. package/dist/extractors/generic.d.ts +5 -0
  111. package/dist/extractors/generic.js +3 -0
  112. package/dist/extractors/javascript.d.ts +3 -0
  113. package/dist/extractors/javascript.js +4 -0
  114. package/dist/extractors/markdown.d.ts +7 -0
  115. package/dist/extractors/markdown.js +269 -0
  116. package/dist/extractors/python.d.ts +7 -0
  117. package/dist/extractors/python.js +314 -0
  118. package/dist/extractors/typescript.d.ts +7 -0
  119. package/dist/extractors/typescript.js +387 -0
  120. package/dist/index.d.ts +2 -0
  121. package/dist/index.js +2 -0
  122. package/dist/mcp/resources.d.ts +18 -0
  123. package/dist/mcp/resources.js +57 -0
  124. package/dist/mcp/server.d.ts +2 -0
  125. package/dist/mcp/server.js +95 -0
  126. package/dist/mcp/tools.d.ts +29 -0
  127. package/dist/mcp/tools.js +902 -0
  128. package/dist/queries/adoption.d.ts +62 -0
  129. package/dist/queries/adoption.js +366 -0
  130. package/dist/queries/capabilities.d.ts +45 -0
  131. package/dist/queries/capabilities.js +124 -0
  132. package/dist/queries/changes.d.ts +33 -0
  133. package/dist/queries/changes.js +53 -0
  134. package/dist/queries/dependencies.d.ts +17 -0
  135. package/dist/queries/dependencies.js +94 -0
  136. package/dist/queries/dogfood.d.ts +50 -0
  137. package/dist/queries/dogfood.js +116 -0
  138. package/dist/queries/editingContext.d.ts +84 -0
  139. package/dist/queries/editingContext.js +240 -0
  140. package/dist/queries/examples.d.ts +8 -0
  141. package/dist/queries/examples.js +16 -0
  142. package/dist/queries/files.d.ts +8 -0
  143. package/dist/queries/files.js +14 -0
  144. package/dist/queries/lists.d.ts +94 -0
  145. package/dist/queries/lists.js +184 -0
  146. package/dist/queries/overview.d.ts +2 -0
  147. package/dist/queries/overview.js +8 -0
  148. package/dist/queries/publicApis.d.ts +60 -0
  149. package/dist/queries/publicApis.js +120 -0
  150. package/dist/queries/ranking.d.ts +67 -0
  151. package/dist/queries/ranking.js +387 -0
  152. package/dist/queries/recommendConfig.d.ts +47 -0
  153. package/dist/queries/recommendConfig.js +123 -0
  154. package/dist/queries/relationships.d.ts +5 -0
  155. package/dist/queries/relationships.js +15 -0
  156. package/dist/queries/reuseCandidates.d.ts +34 -0
  157. package/dist/queries/reuseCandidates.js +181 -0
  158. package/dist/queries/symbols.d.ts +40 -0
  159. package/dist/queries/symbols.js +41 -0
  160. package/dist/security/pathPolicy.d.ts +12 -0
  161. package/dist/security/pathPolicy.js +46 -0
  162. package/dist/security/secretPatterns.d.ts +1 -0
  163. package/dist/security/secretPatterns.js +4 -0
  164. package/dist/security/sourceAccess.d.ts +12 -0
  165. package/dist/security/sourceAccess.js +35 -0
  166. package/package.json +60 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,161 @@
1
+ # Changelog
2
+
3
+ ## 0.8.0
4
+
5
+ Mortice Mapwright **v0.8.0** — change intelligence.
6
+
7
+ - **Renamed from Code Atlas to Mapwright (`@mortice/mapwright`) before first public distribution.** CLI binary is now `mapwright`, MCP binary is `mapwright-mcp`, default catalogue directory is `.mapwright`, config file is `mapwright.config.json`, and MCP resources use the `mapwright://` namespace. Cryptographic identity/comparison namespace strings inherited from the pre-release Code Atlas era (`code-atlas-identity`, `code-atlas-fingerprint`, `code-atlas-comparison`, `code-atlas-change`) are intentionally frozen for ID stability. Catalogues with generator name `code-atlas` continue to load.
8
+ - **Toolkit namespace corrected from Mortise to Mortice (`@mortice/mapwright`) immediately before first public npm distribution** because the `@mortise` npm scope was unavailable. Mapwright's own runtime identity (CLI, MCP, generator name, catalogue directory, config file, `mapwright://` resources) and repository (`andrewmuir/Mapwright`) were not affected. Earlier qualification evidence retains the original `@mortise` scope and Mortise-branded package spelling under which it was produced; see [docs/naming.md](docs/naming.md) and [docs/release/v0.8-qualification.md](docs/release/v0.8-qualification.md).
9
+ - Comparison schema: **1**; change contract: **"1"**; compatibility rules: **"1"**; identity scheme: **comparison-sha256-v1**
10
+ - Deterministic catalogue-pair comparison with added/removed/modified/unchanged classification, signature-versus-implementation facets, and conservative move/rename candidates
11
+ - Public API compatibility findings (`breaking`, `potentially_breaking`, `non_breaking`, `documentation_only`, `unknown`, `not_applicable`) with severity aggregation
12
+ - Dependant-directed direct and transitive change impact with base/head and impact-delta reporting, bounded by depth/node/edge/path budgets
13
+ - Deterministic source-free comparison artefacts with full identity, ordering, hash, and referential validation on load; rollback-safe replacement; path and lock-file security
14
+ - CLI `diff`, `changes`, `compatibility`, `change-impact`, `drift`; MCP comparison tools and resources
15
+ - Explicit read-only catalogue drift detection (in-memory indexing, no writes, no Git execution)
16
+ - Mixed generator-version comparison (e.g. v0.7.0 base against v0.8.0 head)
17
+ - Windows and Docker Linux qualification of one frozen tarball with matching cross-platform semantic artefact hashes
18
+
19
+ Not tagged / not published until separately authorised.
20
+
21
+ ## 0.8.0-rc.3
22
+
23
+ ### Fixed
24
+
25
+ - Loaded comparison artefacts recompute and verify comparison, change, candidate, and compatibility-finding identities; reject duplicate IDs, unsupported vocabularies, wrong deterministic ordering, and lock/manifest identity disagreement
26
+ - Catalogue referential integrity covers authoritative Schema 2 forward references across public APIs, symbols, capabilities, tests, examples, relationships, and diagnostics (derived membership backlinks may warn)
27
+ - Production comparison drift no longer executes Git or exposes filesystem/Git observation options
28
+ - Comparison artefact directory replacement is transactional/rollback-safe (backup → install → cleanup) rather than delete-then-rename
29
+
30
+ ### Tests
31
+
32
+ - Artefact semantic validation with content rewrite + lock rehash
33
+ - Referential integrity failures across domains
34
+ - Injectable filesystem failure injection for transactional replace
35
+ - Packed/source guard that drift contains no Git subprocess invocation
36
+
37
+ RC.1 and RC.2 remain historical evidence and were not rewritten.
38
+
39
+ ## 0.8.0-rc.2
40
+
41
+ ### Fixed
42
+
43
+ - Impact traversal now follows **dependants** (reverse dependency edges), not outgoing dependency targets
44
+ - Impact sections report truthful `total` / pagination (`offset`, `limit`, `truncated`) within bounded work budgets
45
+ - Declaration `range` and relationship evidence line fields no longer create semantic modifications
46
+ - Transition candidates require stronger fingerprint/structural evidence; global ambiguity resolution; budget exhaustion warnings
47
+ - Console-script additions are `non_breaking`; removals/renames/target changes classified granularly
48
+ - Stability transitions use an explicit matrix (not documentation-only for all stability facets)
49
+ - `--fail-on any-public-change` ignores internal-only changes
50
+ - Referential integrity validation before comparison (`comparison_referential_integrity_failed`)
51
+ - Comparison artefact lock allowlist, path containment, size limits, atomic directory replace, and full load validation
52
+ - Drift returns separate `driftClass` and `regenerationRecommendation`; filesystem observation for no-write verification
53
+
54
+ ### Tests
55
+
56
+ - Expanded focused comparison suites (projections, compatibility, candidates, impact, store, CLI, security, validation, drift)
57
+
58
+ RC.1 remains historical evidence and was not promoted.
59
+
60
+ ## 0.8.0-rc.1
61
+
62
+ Release-candidate packaging of the v0.8 change-intelligence line. Same feature surface as `0.8.0-dev.0`; intended for packed Windows and Docker Linux qualification before final `0.8.0`.
63
+
64
+ ## 0.8.0-dev.0
65
+
66
+ ### Added
67
+
68
+ - Gate 0 contracts and scenario freeze for deterministic catalogue comparison (`comparisonSchemaVersion: 1`, `changeContractVersion: "1"`, `compatibilityRuleVersion: "1"`, `comparison-sha256-v1`)
69
+ - Deterministic catalogue comparison core (`src/comparison/`) with directional comparison IDs, domain projections, facets, and Model A artefact store
70
+ - Public API compatibility analysis with severity aggregation and Schema 2 signature feasibility fallbacks
71
+ - Move/rename transition candidates (public surface, declarations, files) under bounded work budgets
72
+ - Bounded base/head change impact from persisted graph indexes
73
+ - CLI: `diff`, `changes`, `compatibility`, `change-impact`, `drift`
74
+ - MCP: `compare_catalogues`, `load_comparison`, `get_change_summary`, `list_changes`, `get_change`, `get_compatibility_report`, `get_change_impact`, `check_catalogue_drift`
75
+ - MCP resources: `code-atlas://comparison/summary|changes|compatibility`
76
+ - Docs: `docs/change-intelligence.md`, `docs/compatibility-analysis.md`, `docs/change-impact.md`, `docs/comparison-artefacts.md`, `docs/release-v0.8.md`
77
+ ## 0.7.0
78
+
79
+ Code Atlas **v0.7.0**.
80
+
81
+ - Catalogue `schemaVersion`: **2**
82
+ - Required `identityScheme`: **stable-sha256-v1**
83
+ - Includes corrective canonicalisation (Category A + Category B module topology), ranking, bounded MCP resources, and RC.2 qualification fixes
84
+ - Final tarball `code-atlas-mcp-0.7.0.tgz` SHA-256 `ac7f0455be53e7b29d6c4e491aeda57e76c6d7d46443b98baeabca0590fecf86` (host/Windows/Docker/Pass A/security qualified)
85
+
86
+ Not tagged / not published until separately authorised.
87
+
88
+ ## 0.7.0-rc.2
89
+
90
+ ### Fixed
91
+
92
+ - Source/generated canonicalisation now requires Category A declaration equivalence **and** Category B module topology mapping (`src` ↔ `dist`/`build`/`out` or colocated `.ts`/`.d.ts`). Package/name/kind alone no longer collapses declarations.
93
+ - Provenance semantics: collapsed generated records use `generated_declaration` (not `generated_only`); inconsistent provenance is validated.
94
+ - Relationship remapping merges duplicate semantic edges and evidence ranges after canonicalisation.
95
+ - Identity collision checks register canonical preimages for packages, symbols, public APIs, tests, relationships, capabilities, examples, and diagnostics.
96
+
97
+ ### Tests
98
+
99
+ - Added dedicated canonicalisation and indexing-level identity collision coverage.
100
+ - Requalified Windows + Docker Linux packed MCP installs, StyleFrameWork Pass A, and security boundaries against tarball `0bbf3e516d44213cee339e39d67c5979a9cb47f475277082acfa332dc7d01abc`.
101
+
102
+ ## 0.7.0-rc.1
103
+
104
+ Release-candidate packaging of the v0.7 retrieval-quality work. Same feature surface as `0.7.0-dev.0` development line; intended for packed Windows and Docker Linux qualification before final `0.7.0`.
105
+
106
+ ## 0.7.0-dev.0
107
+
108
+ ### Breaking
109
+
110
+ - Catalogue `schemaVersion` is now **2**. Schema 1 catalogues fail with `catalogue_upgrade_required` and must be regenerated.
111
+ - Required catalogue field `identityScheme: "stable-sha256-v1"`.
112
+ - Stable IDs no longer embed source line numbers. Package, declaration, public export, test, and relationship identities use fixed SHA-256 digests.
113
+ - Public API IDs are independent of declaration location (package + consumer import path + exported name + kind).
114
+ - MCP search tools return ranked paginated envelopes; collection resources are bounded with list-tool continuation.
115
+
116
+ ### Added
117
+
118
+ - Canonical identity encoder (`stable-sha256-v1`) with NFC + JSON-array preimages
119
+ - Source/generated canonicalisation (Category A + B mapping evidence)
120
+ - Deterministic ranking with hard filters, query-specific policies, and per-result `matchReasons`
121
+ - Bounded `list_*` tools and windowed MCP resources with semantic ordering
122
+ - Conservative `resolved_direct_import` / `resolved_direct_usage` linkage
123
+ - Stronger Python public surface (`__all__`, `__init__` re-exports, `project.scripts`, import package fields)
124
+ - Opt-in bounded `editingContext` on context tools
125
+ - Read-only `recommend_config` MCP tool and CLI command
126
+
127
+ ### Changed
128
+
129
+ - Package identity always includes ecosystem + name/unnamed + package root
130
+ - Relationship semantic endpoints use canonical symbol IDs
131
+ - Generator/package version set to `0.7.0-dev.0` for schema-2 development
132
+
133
+ ## 0.6.0
134
+
135
+ ### Added
136
+
137
+ - MCP `load_committed_catalogue` for consuming committed snapshots without source indexing
138
+ - Deterministic committed-catalogue compatibility checks and error codes
139
+ - Shared `catalogue_not_loaded` helper/message for MCP tools and resources
140
+ - Fail-closed source-preview path and binary exclusions
141
+ - Cross-repository generalisation dogfooding evidence
142
+ - Cross-platform packed-install qualification (Windows host + Docker Linux)
143
+ - Release documentation for installation, MCP configuration, and catalogue compatibility
144
+
145
+ ### Changed
146
+
147
+ - Public API import paths prefer package-root/subpath guidance when export-reachable
148
+ - Package manifest names take precedence over earlier markdown/path seeds
149
+ - `typescript` is a runtime dependency for packed MCP installs
150
+ - MCP resources serve the loaded snapshot only
151
+ - Package version set to `0.6.0`
152
+
153
+ ### Fixed
154
+
155
+ - Windows MCP server entrypoint startup using `fileURLToPath`
156
+ - Packed installation failure caused by missing runtime TypeScript dependency
157
+ - Workspace path boundary checks for source preview escapes
158
+
159
+ ## 0.6.0-rc.1
160
+
161
+ Release-candidate packaging and generalisation baseline retained as historical evidence.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mortice Mapwright contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,262 @@
1
+ # Mortice Mapwright
2
+
3
+ Mortice Mapwright is a standalone MCP server and CLI that builds an agent-facing catalogue of repository capabilities, public APIs, symbols, files, tests, and diagnostics.
4
+
5
+ ## Relationship to Mortice
6
+
7
+ Mapwright is a standalone deterministic repository catalogue and change-intelligence
8
+ tool within the Mortice toolkit. It remains usable independently and does not depend
9
+ on Mortice workflow orchestration.
10
+
11
+ ## What problem this solves
12
+ Coding agents need a reliable way to discover and reuse existing code before creating new code. Mortice Mapwright provides a structured catalogue layer over a repository so agents can query capabilities, public APIs, symbols, tests, and diagnostics without defaulting to raw source reads.
13
+
14
+ ## What v0.1 does
15
+ - Indexes a workspace with deterministic output in .mapwright.
16
+ - Extracts metadata from TypeScript or JavaScript JSDoc and Python docstrings.
17
+ - Parses CATALOGUE.md package or capability metadata.
18
+ - Produces relationships and diagnostics for docs and reference quality.
19
+ - Serves catalogue data through CLI commands and MCP tools.
20
+
21
+ ## What v0.2 adds
22
+ - Import and export relationship extraction for TypeScript, JavaScript, and Python.
23
+ - Conservative package boundary modeling from manifests, docs, and directory layout.
24
+ - Dependency neighborhood querying through MCP.
25
+ - Improved public API import-path metadata where entrypoints are detectable.
26
+ - Evidence text in relationship records is bounded and metadata-first.
27
+ - Package IDs are path-aware so nested packages do not collide.
28
+
29
+ ## What v0.3 starts
30
+ - Richer authored CATALOGUE.md parsing for package and capability reuse context.
31
+ - First-class example records with metadata-only references.
32
+ - Rich capability and public API context bundles through query/MCP surfaces.
33
+ - Deterministic metadata-only reuse candidate search with explainable reasons.
34
+ - Diagnostics for missing or broken authored reuse documentation.
35
+
36
+ ## What v0.4 focuses on
37
+ - Adoption tooling for retrofitting Mortice Mapwright documentation into real repositories.
38
+ - Deterministic audit outputs that highlight missing package, capability, and public API docs.
39
+ - Grouped adoption plans ordered by deterministic priority tiers.
40
+ - Static conservative documentation templates for package and API metadata authoring.
41
+
42
+ ## What v0.5 focuses on
43
+ - Dogfooding and quality calibration on realistic repositories.
44
+ - Compact evaluation reports that summarize diagnostics and adoption gaps.
45
+ - Clear methodology for deciding whether findings are bugs or expected limitations.
46
+ - Practical guidance for maintainer-facing review and next-step decisions.
47
+
48
+ ## What v0.7 focuses on
49
+ - Stable package, declaration, public-export, test, and relationship identities (`stable-sha256-v1`).
50
+ - Schema 2 clean break; schema 1 requires regeneration (`catalogue_upgrade_required`).
51
+ - Deterministic search ranking with hard filters and per-result `matchReasons`.
52
+ - Bounded MCP collection resources and explicit `list_*` continuation.
53
+ - Conservative provenanced import/usage linkage and stronger Python public surfaces.
54
+ - Opt-in bounded editing context and read-only configuration recommendations.
55
+
56
+ ## What v0.6 focuses on
57
+ - Cross-repository generalisation beyond StyleFrameWork.
58
+ - Committed-catalogue MCP consumption without eager source indexing.
59
+ - Packed-package installation and catalogue compatibility for v0.6.0.
60
+ - Package-root/subpath import guidance and clearer empty-state MCP errors.
61
+
62
+ ## What v0.8 adds
63
+ - Deterministic comparison of two committed catalogues with stable comparison IDs (`comparison-sha256-v1`).
64
+ - Added/removed/modified/unchanged change records with signature-versus-implementation facets.
65
+ - Conservative move and rename transition candidates with explicit ambiguity handling.
66
+ - Public API compatibility findings and severity aggregation (breaking → not-applicable).
67
+ - Dependant-directed direct and transitive change impact with truthful pagination and bounded work budgets.
68
+ - Source-free comparison artefacts validated on load (identities, ordering, hashes, references) and replaced rollback-safely.
69
+ - CLI `diff`, `changes`, `compatibility`, `change-impact`, and `drift`; matching MCP tools and resources.
70
+ - Explicit read-only drift detection: indexes the workspace in memory, writes nothing, executes no Git.
71
+ - Renamed from Code Atlas to Mapwright (`@mortice/mapwright`) before first public distribution. Frozen identity/comparison namespace strings from the pre-release Code Atlas era are preserved for ID stability; catalogues that still carry a `code-atlas` generator name continue to load. The toolkit namespace was corrected from Mortise to Mortice immediately before first public npm distribution; see [docs/naming.md](docs/naming.md).
72
+
73
+ ## Version metadata
74
+ - `schemaVersion` identifies the catalogue JSON schema compatibility level (v0.7 → **2**).
75
+ - `identityScheme` identifies the persisted identity encoding (`stable-sha256-v1`).
76
+ - `generator.version` identifies the Mapwright package version that produced the snapshot.
77
+ - `rankingContractVersion` is emitted by the running query implementation (not catalogue truth).
78
+
79
+ ## Install
80
+
81
+ ```bash
82
+ npm install -g @mortice/mapwright
83
+ ```
84
+
85
+ ```bash
86
+ npx -y @mortice/mapwright
87
+ ```
88
+
89
+ Local development:
90
+
91
+ ```bash
92
+ npm install
93
+ npm run build
94
+ ```
95
+
96
+ See [docs/installation.md](docs/installation.md).
97
+
98
+ ## Build
99
+ ```bash
100
+ npm run build
101
+ ```
102
+
103
+ ## Test
104
+ ```bash
105
+ npm test
106
+ ```
107
+
108
+ ## CLI usage
109
+ ```bash
110
+ mapwright index --workspace .
111
+ mapwright validate --workspace .
112
+ mapwright check --workspace . --fail-on warning
113
+ mapwright schema
114
+ mapwright audit-docs --workspace .
115
+ mapwright adoption-plan --workspace .
116
+ mapwright template package-catalogue
117
+ mapwright template --list
118
+ mapwright dogfood --workspace .
119
+ ```
120
+
121
+ Equivalent local runs without global install:
122
+ ```bash
123
+ npm run cli -- index --workspace .
124
+ npm run cli -- validate --workspace .
125
+ npm run cli -- schema
126
+ npm run cli -- audit-docs --workspace .
127
+ npm run cli -- adoption-plan --workspace .
128
+ npm run cli -- template package-catalogue
129
+ npm run cli -- template --list
130
+ npm run cli -- dogfood --workspace .
131
+ ```
132
+
133
+ ## v0.4 adoption examples
134
+
135
+ Audit-docs command returns a stable envelope with summary, gaps, and recommendations:
136
+
137
+ ```json
138
+ {
139
+ "ok": true,
140
+ "data": {
141
+ "summary": {
142
+ "gapsTotal": 12,
143
+ "gapsReturned": 12,
144
+ "gapsTruncated": false
145
+ },
146
+ "gaps": [],
147
+ "recommendations": []
148
+ },
149
+ "warnings": [],
150
+ "provenance": {
151
+ "source": "mapwright"
152
+ }
153
+ }
154
+ ```
155
+
156
+ Adoption-plan command groups recommendations by deterministic priority order:
157
+
158
+ ```json
159
+ {
160
+ "ok": true,
161
+ "data": {
162
+ "groupedRecommendations": [
163
+ { "priority": "high", "recommendations": [] },
164
+ { "priority": "medium", "recommendations": [] },
165
+ { "priority": "low", "recommendations": [] }
166
+ ]
167
+ },
168
+ "warnings": [],
169
+ "provenance": {
170
+ "source": "mapwright"
171
+ }
172
+ }
173
+ ```
174
+
175
+ Template command returns metadata plus static content, and templates always include TODO placeholders:
176
+
177
+ ```json
178
+ {
179
+ "ok": true,
180
+ "data": {
181
+ "templateId": "package-catalogue",
182
+ "title": "Package CATALOGUE scaffold",
183
+ "description": "Markdown scaffold for package metadata and one initial capability section.",
184
+ "surface": "markdown",
185
+ "content": "# Catalogue\n... TODO ..."
186
+ },
187
+ "warnings": [],
188
+ "provenance": {
189
+ "source": "mapwright"
190
+ }
191
+ }
192
+ ```
193
+
194
+ ## Run MCP server
195
+ ```bash
196
+ npm run mcp
197
+ # or from a packed install:
198
+ npx -y @mortice/mapwright
199
+ # or the MCP executable directly:
200
+ mapwright-mcp
201
+ ```
202
+
203
+ Preferred agent load path: `load_committed_catalogue` then `get_workspace_overview` / `mapwright://packages`.
204
+
205
+ If no catalogue is loaded, tools return: `Run load_committed_catalogue or index_workspace first.`
206
+
207
+ Example MCP client config:
208
+
209
+ ```json
210
+ {
211
+ "mcpServers": {
212
+ "mapwright": {
213
+ "command": "npx",
214
+ "args": ["-y", "@mortice/mapwright"]
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ Where the MCP executable is invoked directly:
221
+
222
+ ```json
223
+ {
224
+ "mcpServers": {
225
+ "mapwright": {
226
+ "command": "mapwright-mcp"
227
+ }
228
+ }
229
+ }
230
+ ```
231
+
232
+ See [docs/mcp-configuration.md](docs/mcp-configuration.md).
233
+
234
+ ## Docs
235
+ - [docs/installation.md](docs/installation.md)
236
+ - [docs/mcp-configuration.md](docs/mcp-configuration.md)
237
+ - [docs/catalogue-compatibility.md](docs/catalogue-compatibility.md)
238
+ - [docs/release-v0.6.md](docs/release-v0.6.md)
239
+ - [docs/dogfooding/cross-repository-generalisation-v0.6.md](docs/dogfooding/cross-repository-generalisation-v0.6.md)
240
+ - [docs/Code-Atlas-v0.1-Spec.md](docs/Code-Atlas-v0.1-Spec.md)
241
+ - [docs/architecture.md](docs/architecture.md)
242
+ - [docs/reuse-context.md](docs/reuse-context.md)
243
+ - [docs/v0.1-current-state.md](docs/v0.1-current-state.md)
244
+ - [docs/v0.2-roadmap.md](docs/v0.2-roadmap.md)
245
+ - [docs/v0.3-roadmap.md](docs/v0.3-roadmap.md)
246
+ - [docs/v0.4-roadmap.md](docs/v0.4-roadmap.md)
247
+ - [docs/v0.5-roadmap.md](docs/v0.5-roadmap.md)
248
+ - [docs/adoption.md](docs/adoption.md)
249
+ - [docs/dogfooding.md](docs/dogfooding.md)
250
+ - [docs/naming.md](docs/naming.md)
251
+ - [CONTRIBUTING.md](CONTRIBUTING.md)
252
+ - [skills/](skills/)
253
+
254
+ ## Naming quick reference
255
+ - Product: Mortice Mapwright
256
+ - Package: @mortice/mapwright
257
+ - CLI: mapwright
258
+ - MCP binary: mapwright-mcp
259
+ - Config: mapwright.config.json
260
+ - Catalogue output dir: .mapwright
261
+ - MCP resource namespace: mapwright://
262
+ - Pre-release history: Code Atlas (frozen identity/comparison namespace strings only; see [docs/naming.md](docs/naming.md))
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Symbol canonicalisation for schema 2.
3
+ *
4
+ * Collapses a generated declaration onto an authored source only when both
5
+ * Category A (declaration equivalence beyond package/name/kind alone) and
6
+ * Category B (actual source↔output module mapping) hold.
7
+ */
8
+ import type { DiagnosticRecord, SymbolRecord } from "./schema.js";
9
+ export type SymbolProvenanceKind = "authored_source" | "generated_declaration" | "generated_only";
10
+ /** Path is under a build output tree (dist/build/out). */
11
+ export declare function isBuildOutputPath(filePath: string): boolean;
12
+ /**
13
+ * A symbol is treated as generated when its file is a build artefact, is a
14
+ * declaration file, or its provenance already marks it as generated.
15
+ */
16
+ export declare function isGeneratedSymbol(symbol: SymbolRecord): boolean;
17
+ /**
18
+ * Strip a single source or generated root segment and the file extension so
19
+ * relative module topology can be compared (e.g. src/a/b.ts ↔ dist/a/b.d.ts).
20
+ */
21
+ export declare function moduleTopologyKey(filePath: string): string;
22
+ /** Category B: authored and generated files share module topology after src↔emit transform. */
23
+ export declare function hasSourceOutputMapping(authored: SymbolRecord, generated: SymbolRecord): boolean;
24
+ /**
25
+ * Category A: declaration equivalence stronger than package+name+kind alone.
26
+ * Requires matching qualified declaration identity (container + name) and kind,
27
+ * plus compatible signature fingerprint when both are present.
28
+ */
29
+ export declare function categoryACompatible(a: SymbolRecord, b: SymbolRecord): boolean;
30
+ export declare function validateSymbolProvenance(symbol: SymbolRecord): string | undefined;
31
+ /**
32
+ * Assign canonical identities to symbols in place.
33
+ *
34
+ * Returns a map from collapsed duplicate symbol id to its canonical symbol id.
35
+ */
36
+ export declare function canonicaliseSymbols(symbols: SymbolRecord[], diagnostics: DiagnosticRecord[]): Map<string, string>;