@locus-forge/locus-map 0.2.2-dev.20261206.g5e970d2 → 0.3.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 (156) hide show
  1. package/dist/assets/{abnfDiagram-VCTEODGH-JiCO6vo-.js → abnfDiagram-VCTEODGH-YtlnkH6t.js} +1 -1
  2. package/dist/assets/{ar-SA-G6X2FPQ2-BdzEBmp3.js → ar-SA-G6X2FPQ2-BH5AlOAp.js} +1 -1
  3. package/dist/assets/{architectureDiagram-5GKGNRK7-D7T_vJwe.js → architectureDiagram-5GKGNRK7-DKYw7IM8.js} +1 -1
  4. package/dist/assets/{az-AZ-76LH7QW2-BQ_SoVB7.js → az-AZ-76LH7QW2-DoI4xcyq.js} +1 -1
  5. package/dist/assets/{bg-BG-XCXSNQG7-DlH1olUf.js → bg-BG-XCXSNQG7-CS9_2dp-.js} +1 -1
  6. package/dist/assets/{blockDiagram-I7D4REHJ-DPz0LEjY.js → blockDiagram-I7D4REHJ-FelDwD1I.js} +1 -1
  7. package/dist/assets/{bn-BD-2XOGV67Q-CFIZU06C.js → bn-BD-2XOGV67Q-CoIu5tTK.js} +1 -1
  8. package/dist/assets/{c4Diagram-7LVT6UL2-B6uCi0Ol.js → c4Diagram-7LVT6UL2-Bh7h9IHP.js} +1 -1
  9. package/dist/assets/{ca-ES-6MX7JW3Y-Bpe3kOti.js → ca-ES-6MX7JW3Y-DAEHzf3H.js} +1 -1
  10. package/dist/assets/channel-DXsl7ag_.js +1 -0
  11. package/dist/assets/{chunk-2Q5K7J3B-DTWRWhpx.js → chunk-2Q5K7J3B-CgUOCDxa.js} +1 -1
  12. package/dist/assets/{chunk-5VM5RSS4-Dfr1HUAN.js → chunk-5VM5RSS4-B97oha-s.js} +1 -1
  13. package/dist/assets/{chunk-F27PBJKO-D_IVoCIK.js → chunk-F27PBJKO-BQGqI2Ej.js} +1 -1
  14. package/dist/assets/{chunk-IMKFNOWR-Boa_chn8.js → chunk-IMKFNOWR-C_sOeFT_.js} +1 -1
  15. package/dist/assets/{chunk-JWPE2WC7-RaK8jzc2.js → chunk-JWPE2WC7-DG5n2owX.js} +1 -1
  16. package/dist/assets/{chunk-POPQ4Y6H-D7xOpv6O.js → chunk-POPQ4Y6H-Y-h3THrr.js} +1 -1
  17. package/dist/assets/{chunk-SVP7TREG-XvJsx1jt.js → chunk-SVP7TREG-Dn6yBHtF.js} +1 -1
  18. package/dist/assets/{chunk-TICWLB2K-DZCVWmZG.js → chunk-TICWLB2K-Cb_yWOVI.js} +1 -1
  19. package/dist/assets/{chunk-XXDRQBXY-Djk-REAy.js → chunk-XXDRQBXY-QE51OqTj.js} +1 -1
  20. package/dist/assets/classDiagram-ZZMXUADV-DLyWZtYF.js +1 -0
  21. package/dist/assets/classDiagram-v2-VYDZK3BY-Cb3mb68m.js +1 -0
  22. package/dist/assets/{cose-bilkent-JH36ORCC-D6XaIbtG.js → cose-bilkent-JH36ORCC-Bt7ZI9S1.js} +1 -1
  23. package/dist/assets/{cs-CZ-2BRQDIVT-BdzgSHdJ.js → cs-CZ-2BRQDIVT-BKZzkx2M.js} +1 -1
  24. package/dist/assets/{cynefin-OW5HDTMX-BMTkMDG1.js → cynefin-OW5HDTMX-n6-BmECj.js} +1 -1
  25. package/dist/assets/{cynefinDiagram-5FMLGOSQ-C2s5i9h9.js → cynefinDiagram-5FMLGOSQ-Bq2km1fZ.js} +1 -1
  26. package/dist/assets/{d3-scale-BMIMKl27.js → d3-scale-C9oJHYFk.js} +1 -1
  27. package/dist/assets/{da-DK-5WZEPLOC-Bj-GFWHU.js → da-DK-5WZEPLOC-DWJm1_Yl.js} +1 -1
  28. package/dist/assets/{dagre-GXQ25YYZ-CMT8wlz0.js → dagre-GXQ25YYZ-D9EJj_nK.js} +1 -1
  29. package/dist/assets/{de-DE-XR44H4JA-JmpondAB.js → de-DE-XR44H4JA-D-5dMJXD.js} +1 -1
  30. package/dist/assets/{diagram-S7CK7UJ4-DU1blS3M.js → diagram-S7CK7UJ4-DX3qZf_H.js} +1 -1
  31. package/dist/assets/{diagram-UQ7AKVKN-0lWi4KDV.js → diagram-UQ7AKVKN-lODsxrZ9.js} +1 -1
  32. package/dist/assets/{diagram-VSXAHHWV-CrseWrhn.js → diagram-VSXAHHWV-B48xz8Xq.js} +1 -1
  33. package/dist/assets/{diagram-VX7I27RA-C5BMS8Ql.js → diagram-VX7I27RA-Dms2AfBa.js} +1 -1
  34. package/dist/assets/{diagram-Z3DM3KII-Cc3vq6b8.js → diagram-Z3DM3KII-BnwZBeJA.js} +1 -1
  35. package/dist/assets/{ebnfDiagram-PWID7BFC-ZF78imma.js → ebnfDiagram-PWID7BFC-OtcCvaIU.js} +1 -1
  36. package/dist/assets/{el-GR-BZB4AONW-BFslUpdm.js → el-GR-BZB4AONW-BZVA3YVN.js} +1 -1
  37. package/dist/assets/{engines-BtEtIBXt.js → engines-DPbXorS1.js} +1 -1
  38. package/dist/assets/{erDiagram-RLTQ6QDP-CjPjDn2i.js → erDiagram-RLTQ6QDP-Cnh8Gn9f.js} +1 -1
  39. package/dist/assets/{es-ES-U4NZUMDT-B0ezBTxQ.js → es-ES-U4NZUMDT-DKJIfS-2.js} +1 -1
  40. package/dist/assets/{eu-ES-A7QVB2H4-DP_gx2kf.js → eu-ES-A7QVB2H4-LHCF7lHc.js} +1 -1
  41. package/dist/assets/{fa-IR-HGAKTJCU-BuT1ELty.js → fa-IR-HGAKTJCU-CMtLvHxY.js} +1 -1
  42. package/dist/assets/{fi-FI-Z5N7JZ37-BAu_Cj7n.js → fi-FI-Z5N7JZ37-CUIzm5UM.js} +1 -1
  43. package/dist/assets/{flowDiagram-HODETNUW-yqPGWNdd.js → flowDiagram-HODETNUW-lneiCvFi.js} +1 -1
  44. package/dist/assets/{fr-FR-RHASNOE6-OF1CpgtN.js → fr-FR-RHASNOE6-DTJ2WS73.js} +1 -1
  45. package/dist/assets/{ganttDiagram-EL5Y4UJY-zUY5je2K.js → ganttDiagram-EL5Y4UJY-B2aJ2MDb.js} +1 -1
  46. package/dist/assets/{gitGraphDiagram-WWUBYQGX-oWrs7wy0.js → gitGraphDiagram-WWUBYQGX-C74V3MFm.js} +1 -1
  47. package/dist/assets/{gl-ES-HMX3MZ6V-CkJ47l98.js → gl-ES-HMX3MZ6V-BP8M0fQQ.js} +1 -1
  48. package/dist/assets/{he-IL-6SHJWFNN-D7CecRlh.js → he-IL-6SHJWFNN-BMd-Q0PW.js} +1 -1
  49. package/dist/assets/{hi-IN-IWLTKZ5I-CGlW2X-h.js → hi-IN-IWLTKZ5I-Ct52OkX5.js} +1 -1
  50. package/dist/assets/{hu-HU-A5ZG7DT2-Dq_n_tbp.js → hu-HU-A5ZG7DT2-NfIL6Jfo.js} +1 -1
  51. package/dist/assets/{id-ID-SAP4L64H-CotwO_06.js → id-ID-SAP4L64H-Osl6P1wb.js} +1 -1
  52. package/dist/assets/{index-CdVc9Lmz.js → index-CyQSsku0.js} +181 -181
  53. package/dist/assets/{index-Cv-tTxNC.css → index-DR6sd54W.css} +1 -1
  54. package/dist/assets/{index-VaWCb9bx.js → index-VfiAlFSM.js} +5 -5
  55. package/dist/assets/{infoDiagram-27XIBGKW-CYzIkNFW.js → infoDiagram-27XIBGKW-BjDMKD-X.js} +1 -1
  56. package/dist/assets/{ishikawaDiagram-5VMMS53U-DkgUsuk5.js → ishikawaDiagram-5VMMS53U-DjrBmz8f.js} +1 -1
  57. package/dist/assets/{it-IT-JPQ66NNP-h97o81us.js → it-IT-JPQ66NNP-vT-EYZw5.js} +1 -1
  58. package/dist/assets/{ja-JP-DBVTYXUO-M6EVfh0o.js → ja-JP-DBVTYXUO-DexyPC4p.js} +1 -1
  59. package/dist/assets/{journeyDiagram-3NMN7TZE-CuKkNrJy.js → journeyDiagram-3NMN7TZE-Bs5RL4Ef.js} +1 -1
  60. package/dist/assets/{kaa-6HZHGXH3-DUy85zzz.js → kaa-6HZHGXH3-0BLUFlXY.js} +1 -1
  61. package/dist/assets/{kab-KAB-ZGHBKWFO-ChL-fKtk.js → kab-KAB-ZGHBKWFO-ByGN5_Fc.js} +1 -1
  62. package/dist/assets/{kanban-definition-UXKFOSKX-DkOxt3kf.js → kanban-definition-UXKFOSKX-DgcopnbA.js} +1 -1
  63. package/dist/assets/{kk-KZ-P5N5QNE5-DY6ucSGD.js → kk-KZ-P5N5QNE5-DlK-wQWu.js} +1 -1
  64. package/dist/assets/{km-KH-HSX4SM5Z-BAaS4014.js → km-KH-HSX4SM5Z-BZ75967_.js} +1 -1
  65. package/dist/assets/{ko-KR-MTYHY66A-D-r3mJ1R.js → ko-KR-MTYHY66A-C-copauZ.js} +1 -1
  66. package/dist/assets/{ku-TR-6OUDTVRD-Dk1GCoOP.js → ku-TR-6OUDTVRD-CNqY-Uj4.js} +1 -1
  67. package/dist/assets/{layout-DtNEGI4_.js → layout-B8D2HGrb.js} +1 -1
  68. package/dist/assets/{lt-LT-XHIRWOB4-3Z2Ui1VZ.js → lt-LT-XHIRWOB4-BopE_XJX.js} +1 -1
  69. package/dist/assets/{lv-LV-5QDEKY6T-Bg59rOkR.js → lv-LV-5QDEKY6T--7hU3JSZ.js} +1 -1
  70. package/dist/assets/{mindmap-definition-YA3MSWOX-Dcs8eV7p.js → mindmap-definition-YA3MSWOX-DYOVTEyE.js} +1 -1
  71. package/dist/assets/{mr-IN-CRQNXWMA-DepTOG29.js → mr-IN-CRQNXWMA-DydjVI2G.js} +1 -1
  72. package/dist/assets/{my-MM-5M5IBNSE-4KqL4Tav.js → my-MM-5M5IBNSE-D6ewM-EV.js} +1 -1
  73. package/dist/assets/{nb-NO-T6EIAALU-5YWO_l3W.js → nb-NO-T6EIAALU--iqOwj15.js} +1 -1
  74. package/dist/assets/{nl-NL-IS3SIHDZ-QlAndkM2.js → nl-NL-IS3SIHDZ-Bnhl_SmS.js} +1 -1
  75. package/dist/assets/{nn-NO-6E72VCQL-BscwhEDW.js → nn-NO-6E72VCQL-CIx7sLAQ.js} +1 -1
  76. package/dist/assets/{oc-FR-POXYY2M6-k7bYbSQj.js → oc-FR-POXYY2M6-DWt5a8Ow.js} +1 -1
  77. package/dist/assets/{pa-IN-N4M65BXN-jxBFwrWj.js → pa-IN-N4M65BXN-BW3LNure.js} +1 -1
  78. package/dist/assets/{pegDiagram-XKGWAZYB-zM-VZA3r.js → pegDiagram-XKGWAZYB-ixSY_9-e.js} +1 -1
  79. package/dist/assets/{pica-CsWQ4DPU.js → pica-Dn0N8xAP.js} +1 -1
  80. package/dist/assets/{pieDiagram-E7YTZNPT-C60FE0D8.js → pieDiagram-E7YTZNPT-BbCRV6Qi.js} +1 -1
  81. package/dist/assets/{pl-PL-T2D74RX3-be8atU_l.js → pl-PL-T2D74RX3-7nXJ8SiV.js} +1 -1
  82. package/dist/assets/{pt-BR-5N22H2LF-CSE0O2fj.js → pt-BR-5N22H2LF-DKGGof4J.js} +1 -1
  83. package/dist/assets/{pt-PT-UZXXM6DQ-5rnYJhy1.js → pt-PT-UZXXM6DQ-DCLEXuhk.js} +1 -1
  84. package/dist/assets/{quadrantDiagram-AXDQQJYC-DyH84hx6.js → quadrantDiagram-AXDQQJYC-Bvh_H4wg.js} +1 -1
  85. package/dist/assets/{railroadDiagram-O6MQD6OU-DCrJgP9s.js → railroadDiagram-O6MQD6OU-DHC3neQ8.js} +1 -1
  86. package/dist/assets/{requirementDiagram-BXWQKSXE-C78-QlFo.js → requirementDiagram-BXWQKSXE-DuCkl3u1.js} +1 -1
  87. package/dist/assets/{ro-RO-JPDTUUEW-Gh6EgC27.js → ro-RO-JPDTUUEW-Cwf4k3Ou.js} +1 -1
  88. package/dist/assets/{ru-RU-B4JR7IUQ-BUWESZhq.js → ru-RU-B4JR7IUQ-sZF6fySs.js} +1 -1
  89. package/dist/assets/{sankeyDiagram-P5KCCOFB-D_MOkKEs.js → sankeyDiagram-P5KCCOFB-1ELTqwtI.js} +1 -1
  90. package/dist/assets/{sequenceDiagram-WJ2MYXX4-BeQbHZRB.js → sequenceDiagram-WJ2MYXX4-BK8Ou8Dz.js} +1 -1
  91. package/dist/assets/{si-LK-N5RQ5JYF-C9pnvQMf.js → si-LK-N5RQ5JYF-DmYhXIqO.js} +1 -1
  92. package/dist/assets/{sizeCapture-INFHLROL-DUn-Mus_.js → sizeCapture-INFHLROL-BKwx3lxX.js} +1 -1
  93. package/dist/assets/{sk-SK-C5VTKIMK-FnkPBibb.js → sk-SK-C5VTKIMK-BRLu35YX.js} +1 -1
  94. package/dist/assets/{sl-SI-NN7IZMDC-Cwrqj_B9.js → sl-SI-NN7IZMDC-CMjfvJTr.js} +1 -1
  95. package/dist/assets/{stateDiagram-D77RDMKH-C3EF3jQ3.js → stateDiagram-D77RDMKH-CDwJ9XLN.js} +1 -1
  96. package/dist/assets/stateDiagram-v2-MP3YSRHH-BZjKARGY.js +1 -0
  97. package/dist/assets/{subset-shared.chunk-8ifLcT_D.js → subset-shared.chunk-DngAvf0H.js} +1 -1
  98. package/dist/assets/{subset-worker.chunk-DrNTybDR.js → subset-worker.chunk-DkH_mqr5.js} +1 -1
  99. package/dist/assets/{sv-SE-XGPEYMSR-Btz80pGx.js → sv-SE-XGPEYMSR-G4S06sbd.js} +1 -1
  100. package/dist/assets/{swimlanes-42K2YHIH-B2_kGhPA.js → swimlanes-42K2YHIH-Z9u8PDi-.js} +1 -1
  101. package/dist/assets/swimlanesDiagram-VR7AAH4N-D0kM5xmS.js +8 -0
  102. package/dist/assets/{ta-IN-2NMHFXQM-B0bWtgu1.js → ta-IN-2NMHFXQM-DgBbCQ8S.js} +1 -1
  103. package/dist/assets/{th-TH-HPSO5L25-DgC0yFw3.js → th-TH-HPSO5L25-o9u4fVfq.js} +1 -1
  104. package/dist/assets/{timeline-definition-24CTP7MA-Bu0W3Mcy.js → timeline-definition-24CTP7MA-BNgrm1r_.js} +1 -1
  105. package/dist/assets/{tr-TR-DEFEU3FU-C9Mmy6ri.js → tr-TR-DEFEU3FU-BqqSdzoL.js} +1 -1
  106. package/dist/assets/{uk-UA-QMV73CPH-rxEnqB_i.js → uk-UA-QMV73CPH-Dna46aia.js} +1 -1
  107. package/dist/assets/{vennDiagram-4TSXK5OY-63JTeOph.js → vennDiagram-4TSXK5OY-CHwUI40M.js} +1 -1
  108. package/dist/assets/{vi-VN-M7AON7JQ-DOVa-vAT.js → vi-VN-M7AON7JQ-CbKRBQPB.js} +1 -1
  109. package/dist/assets/{wardleyDiagram-VM6X3IG4-Bct0TRuC.js → wardleyDiagram-VM6X3IG4-KB0xBjXX.js} +1 -1
  110. package/dist/assets/{xychartDiagram-S5SC5T6Z-C21zgvSM.js → xychartDiagram-S5SC5T6Z-B3LOQLL-.js} +1 -1
  111. package/dist/assets/{zh-CN-LNUGB5OW-MyifsmQ8.js → zh-CN-LNUGB5OW-BFjA6n_2.js} +1 -1
  112. package/dist/assets/{zh-HK-E62DVLB3-Cp55UViv.js → zh-HK-E62DVLB3-BoTU6iS7.js} +1 -1
  113. package/dist/assets/{zh-TW-RAJ6MFWO-DMy6SZap.js → zh-TW-RAJ6MFWO-DB4kdpOS.js} +1 -1
  114. package/dist/index.html +2 -2
  115. package/docs/LOCAL-DOCUMENT.md +36 -83
  116. package/docs/VIEWER-LAUNCH.md +24 -27
  117. package/docs/adr/ADR-002-2026-12-03-project-selector/ADR-002-2026-12-03-project-selector.md +1 -1
  118. package/docs/adr/ADR-005-2026-12-04-named-libraries/ADR-005-2026-12-04-named-libraries.md +1 -1
  119. package/package.json +1 -1
  120. package/scripts/lib/library-directory.mjs +1 -1
  121. package/scripts/lib/map-build-invocation.mjs +5 -1
  122. package/scripts/lib/map-viewer-server.mjs +148 -20
  123. package/scripts/lib/project-catalog.mjs +250 -95
  124. package/scripts/lib/project-registry.mjs +151 -47
  125. package/scripts/lib/view-args.mjs +25 -45
  126. package/scripts/locus-map.mjs +12 -11
  127. package/scripts/open-map.mjs +18 -8
  128. package/skills/locus-map/SKILL.md +6 -4
  129. package/skills/locus-map/references/checks.md +1 -1
  130. package/skills/locus-map/references/component-checkpoint.md +4 -4
  131. package/skills/locus-map/references/folder.md +2 -2
  132. package/skills/locus-map/references/selection.md +2 -2
  133. package/skills/locus-map/references/visual-composition.md +20 -20
  134. package/skills/locus-map-draft/SKILL.md +76 -76
  135. package/skills/locus-map-draft/references/divergence-and-formats.md +58 -107
  136. package/skills/locus-map-primitives/SKILL.md +11 -14
  137. package/skills/locus-map-primitives/assets/batch/README.md +2 -2
  138. package/skills/locus-map-primitives/assets/batch/build.mjs +1 -1
  139. package/skills/locus-map-primitives/assets/batch/{project.json → topic.json} +13 -20
  140. package/src/bundle/projectClient.js +5 -3
  141. package/src/main.jsx +25 -1
  142. package/src/viewer/ControlIcon.jsx +2 -0
  143. package/src/viewer/ProjectLocation.jsx +25 -7
  144. package/src/viewer/ProjectRail.jsx +9 -2
  145. package/src/viewer/ProjectViewChainViewer.jsx +35 -16
  146. package/src/viewer/SketchCanvas.jsx +124 -15
  147. package/src/viewer/ViewChainViewer.jsx +14 -5
  148. package/src/viewer/ViewerSettings.jsx +208 -0
  149. package/src/viewer/projectContents.js +248 -55
  150. package/src/viewer/projectNavigation.js +27 -3
  151. package/src/viewer/viewChain.css +52 -1
  152. package/dist/assets/channel-DB3atv5o.js +0 -1
  153. package/dist/assets/classDiagram-ZZMXUADV-CzvsXoj_.js +0 -1
  154. package/dist/assets/classDiagram-v2-VYDZK3BY-HxwJpdPt.js +0 -1
  155. package/dist/assets/stateDiagram-v2-MP3YSRHH-CVQHmIvK.js +0 -1
  156. package/dist/assets/swimlanesDiagram-VR7AAH4N-C1rOmrkT.js +0 -8
@@ -11,15 +11,14 @@ import { bindMapInputs, parseMapSources } from './project-map-inputs.mjs';
11
11
  import { originalMaterials } from './original-materials.mjs';
12
12
 
13
13
  function parse(text, file, home) {
14
- const legacy = path.extname(file).toLowerCase() !== '.toml';
15
- const config = legacy ? JSON.parse(text) : parseToml(text);
16
- if (legacy && (config?.version !== 1 || !Array.isArray(config.projects))) {
17
- throw new Error('Expected version 1 and a projects array.');
14
+ if (path.extname(file).toLowerCase() !== '.toml') {
15
+ throw new Error('Legacy projects.json registries are no longer supported. Migrate to ~/.locus-map/projects.toml.');
18
16
  }
19
- if (!legacy && Object.keys(config).some(key => !['port', 'projects'].includes(key))) {
17
+ const config = parseToml(text);
18
+ if (Object.keys(config).some(key => !['port', 'projects'].includes(key))) {
20
19
  throw new Error('Expected port and projects settings.');
21
20
  }
22
- const { port } = legacy ? {} : config;
21
+ const { port } = config;
23
22
  if (port !== undefined && (!Number.isInteger(port) || port < 0 || port > 65535)) {
24
23
  throw new Error('Port must be an integer from 0 to 65535.');
25
24
  }
@@ -33,99 +32,198 @@ function parse(text, file, home) {
33
32
  function directory(key) {
34
33
  const value = entry[key];
35
34
  if (typeof value !== 'string' || !value.trim() || value.includes('\0')) throw new Error(`Invalid ${key} for "${name}".`);
36
- return !legacy && value.startsWith('~/') ? path.resolve(home, value.slice(2)) : path.resolve(path.dirname(file), value);
35
+ return value.startsWith('~/') ? path.resolve(home, value.slice(2)) : path.resolve(path.dirname(file), value);
37
36
  }
38
- const sourceKey = legacy ? 'sourceRoot' : 'source_root';
39
- if (!legacy && Object.keys(entry).some(key => !['name', 'folder', sourceKey, 'mapSources', 'taskSources'].includes(key))) {
37
+ if (Object.keys(entry).some(key => !['name', 'folder', 'source_root', 'mapSources', 'taskSources'].includes(key))) {
40
38
  throw new Error(`Unexpected setting for "${name}".`);
41
39
  }
42
40
  const mapSources = parseMapSources(entry.mapSources);
43
41
  const taskSources = parseTaskSources(entry.taskSources);
44
- const sourceRoot = Object.hasOwn(entry, sourceKey) ? directory(sourceKey) : undefined;
45
- if (!legacy && (mapSources.length || taskSources.length) && !sourceRoot) {
42
+ const sourceRoot = Object.hasOwn(entry, 'source_root') ? directory('source_root') : undefined;
43
+ if ((mapSources.length || taskSources.length) && !sourceRoot) {
46
44
  throw new Error(`Set source_root for "${name}" before registering source inputs or tasks.`);
47
45
  }
48
- return { name, ...(legacy ? { root: directory('root') } : { folder: directory('folder') }), sourceRoot, mapSources, taskSources };
46
+ return { name, folder: directory('folder'), sourceRoot, mapSources, taskSources };
49
47
  });
50
48
  return { projects, port };
51
49
  }
52
50
 
51
+ function directoryMatchDepth(candidate, root) {
52
+ if (!root || !candidate) return -1;
53
+ if (candidate === root) return root.length + 1_000_000;
54
+ const relative = path.relative(root, candidate);
55
+ if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) return -1;
56
+ return root.length;
57
+ }
58
+
59
+ function matchProject(all, resolvedDir, resolvedLib) {
60
+ let best = null;
61
+ let bestScore = -1;
62
+ for (const item of all) {
63
+ const libExact = item.library.path === resolvedDir || item.library.path === resolvedLib;
64
+ if (libExact) return item;
65
+ const score = Math.max(
66
+ directoryMatchDepth(resolvedDir, item.library.path),
67
+ directoryMatchDepth(resolvedDir, item.source?.path),
68
+ );
69
+ if (score > bestScore) {
70
+ bestScore = score;
71
+ best = item;
72
+ }
73
+ }
74
+ return bestScore >= 0 ? best : null;
75
+ }
76
+
77
+ async function inspectDirectoryStatus(dir) {
78
+ if (!dir) return null;
79
+ if (dir.identity) {
80
+ const current = await captureDirectory(dir.path, false);
81
+ if (!current.identity) return current.missing ? 'missing' : 'inaccessible';
82
+ return current.identity === dir.identity ? 'available' : 'replaced';
83
+ }
84
+ if (dir.missing && dir.admitMissing) return 'creatable';
85
+ return dir.missing ? 'missing' : 'inaccessible';
86
+ }
87
+
53
88
  /** Read the selected config. A launch without configured tabs adds its own defaults. */
54
89
  export async function readProjectRegistry(cwd, file) {
55
90
  return loadRegistry(cwd, file, false);
56
91
  }
57
92
 
58
- export async function readWorkspaceRegistry(cwd) {
59
- return loadRegistry(cwd, undefined, true);
93
+ export async function readWorkspaceRegistry(cwd, file) {
94
+ return loadRegistry(cwd, file, true);
60
95
  }
61
96
 
62
97
  async function loadRegistry(cwd, file, workspace) {
63
98
  const home = os.homedir();
64
99
  const override = process.env.LOCUS_MAP_PROJECTS_FILE;
65
- const candidates = file ? [path.resolve(cwd, file)]
66
- : override ? [path.resolve(cwd, override)] : ['projects.toml', 'projects.json'].map(name => path.join(home, '.locusmap', name));
100
+ const defaultToml = path.join(home, '.locus-map', 'projects.toml');
101
+ const candidate = file ? path.resolve(cwd, file)
102
+ : override ? path.resolve(cwd, override)
103
+ : defaultToml;
67
104
  let config = { projects: [] };
68
105
  let selectedFile;
69
- for (const candidate of candidates) {
70
- let text;
71
- try { text = await fs.readFile(candidate, 'utf8'); }
72
- catch (error) {
73
- if (error.code === 'ENOENT' && !(override && !file)) continue;
106
+ let text;
107
+ try { text = await fs.readFile(candidate, 'utf8'); }
108
+ catch (error) {
109
+ if (error.code === 'ENOENT' && !file && !override) {
110
+ const legacyJson = path.join(home, '.locus-map', 'projects.json');
111
+ const hasLegacy = await fs.access(legacyJson).then(() => true, () => false);
112
+ if (hasLegacy) {
113
+ throw new Error(`Found legacy ${legacyJson} without ${defaultToml}. Migrate your entries to ~/.locus-map/projects.toml.`);
114
+ }
115
+ } else {
74
116
  throw new Error(`Cannot read ${candidate}. Use locus-map view --local for the current project.`, { cause: error });
75
117
  }
118
+ }
119
+ if (text !== undefined) {
76
120
  try { config = parse(text, candidate, home); }
77
121
  catch (error) {
78
122
  throw new Error(`Invalid project registry ${candidate}: ${error.message} Use locus-map view --local for the current project.`, { cause: error });
79
123
  }
80
124
  selectedFile = candidate;
81
- break;
82
125
  }
83
126
  if (!workspace && !config.projects.length) return null;
127
+ const configSource = file ? 'explicit-file' : override ? 'env-override' : selectedFile ? 'home-toml' : 'defaults';
84
128
  try {
129
+ const realHome = await fs.realpath(home).catch(() => path.resolve(home));
85
130
  const current = await fs.realpath(cwd);
86
131
  const conventional = path.join(current, '.locus-map');
87
132
  const currentLibrary = await fs.realpath(conventional).catch(() => conventional);
88
- const entries = config.projects;
133
+ const entries = [...config.projects];
134
+ const personalMaps = path.join(realHome, '.locus-map', 'maps');
135
+ const homePersonalMaps = path.join(home, '.locus-map', 'maps');
89
136
  if (!entries.length) {
90
- entries.push({ name: 'Personal', folder: path.join(home, '.locusmap', 'maps'), mapSources: [], taskSources: [] });
91
- const present = await captureDirectory(conventional, false);
92
- if (present.identity) {
93
- const name = path.basename(current) || current;
94
- entries.push({ name: name === 'Personal' ? 'Personal (.locus-map)' : name, folder: currentLibrary, mapSources: [], taskSources: [] });
137
+ entries.push({ name: 'Personal', folder: personalMaps, mapSources: [], taskSources: [] });
138
+ if (current !== realHome) {
139
+ const present = await captureDirectory(conventional, false);
140
+ if (present.identity) {
141
+ const name = path.basename(current) || current;
142
+ entries.push({ name: name === 'Personal' ? 'Personal (.locus-map)' : name, folder: currentLibrary, sourceRoot: current, mapSources: [], taskSources: [] });
143
+ }
95
144
  }
96
145
  }
97
146
  const libraries = new Set(), identities = new Set();
98
147
  const projects = new Map();
99
148
  for (const entry of entries) {
100
- const root = entry.root && await captureDirectory(entry.root);
101
- const library = root ? await captureDirectory(path.join(root.path, '.locus-map'), false)
102
- : entry.folder === path.join(home, '.locusmap', 'maps') ? await bindPersonalLibrary(home) : await captureDirectory(entry.folder);
103
- if (libraries.has(library.path) || (library.identity && identities.has(library.identity))) throw new Error(`Duplicate ${root ? 'root' : 'folder'} for "${entry.name}".`);
149
+ const isPersonalFolder = entry.folder === personalMaps || entry.folder === homePersonalMaps;
150
+ const library = isPersonalFolder ? await bindPersonalLibrary(home) : await captureDirectory(entry.folder);
151
+ if (libraries.has(library.path) || (library.identity && identities.has(library.identity))) {
152
+ throw new Error(`Duplicate folder for "${entry.name}".`);
153
+ }
104
154
  libraries.add(library.path);
105
155
  if (library.identity) identities.add(library.identity);
106
156
  const source = entry.sourceRoot ? await captureDirectory(entry.sourceRoot) : null;
107
- const repository = source ?? root ?? library;
157
+ const repository = source ?? library;
108
158
  const id = 'library-' + randomUUID();
109
- const readTasks = await bindTaskSources(root ?? repository, repository, entry.taskSources);
159
+ const readTasks = await bindTaskSources(library, repository, entry.taskSources);
110
160
  const mapInputs = await bindMapInputs(repository, library, entry.mapSources, selectedFile);
111
- projects.set(id, { id, name: entry.name, root, library, source, taskSources: entry.taskSources, inputMaps: entry.mapSources.map(row => row.document), mapInputs, readTasks });
161
+ projects.set(id, { id, name: entry.name, library, source, taskSources: entry.taskSources, inputMaps: entry.mapSources.map(row => row.document), mapInputs, readTasks });
112
162
  }
113
163
  const all = [...projects.values()];
114
- const direct = all.find(item => item.root?.path === current || item.library.path === current || item.library.path === currentLibrary);
115
- const selected = direct ?? all.find(item => item.source?.path === current) ?? all[0];
164
+ const matched = matchProject(all, current, currentLibrary);
165
+ const selected = matched ?? all[0];
166
+ const currentHasLibrary = !matched && current !== realHome && Boolean((await captureDirectory(conventional, false)).identity);
116
167
  let closing = false;
117
168
  return {
118
- file: selectedFile, port: config.port,
169
+ file: selectedFile,
170
+ configSource,
171
+ configPath: selectedFile ?? defaultToml,
172
+ configExists: Boolean(selectedFile),
173
+ port: config.port,
119
174
  entry: selected.id,
175
+ matchedCurrent: Boolean(matched),
176
+ unregisteredHint: currentHasLibrary ? {
177
+ name: path.basename(current) || current,
178
+ folder: conventional,
179
+ sourceRoot: current,
180
+ } : null,
181
+ async resolveEntry({ cwd: requestedCwd, tab } = {}) {
182
+ if (typeof tab === 'string' && tab.trim()) {
183
+ const normalized = tab.trim();
184
+ const byName = all.find(item => item.name === normalized)
185
+ ?? all.find(item => item.name.toLowerCase() === normalized.toLowerCase());
186
+ if (byName) return byName.id;
187
+ }
188
+ if (typeof requestedCwd === 'string' && requestedCwd.trim() && !requestedCwd.includes('\0') && path.isAbsolute(requestedCwd)) {
189
+ const resolved = await fs.realpath(requestedCwd).catch(() => path.resolve(requestedCwd));
190
+ const requestedConventional = path.join(resolved, '.locus-map');
191
+ const resolvedLib = await fs.realpath(requestedConventional).catch(() => requestedConventional);
192
+ const found = matchProject(all, resolved, resolvedLib);
193
+ if (found) return found.id;
194
+ }
195
+ return selected.id;
196
+ },
120
197
  get list() {
121
- return all.map(({ id, name, root, library, taskSources, inputMaps }) => ({ id, name, ...(root && { legacy: true }), ...(inputMaps.length && { inputMaps }), ...(taskSources.length && { taskSources }),
122
- available: Boolean((!root || root.identity) && (library.identity || (library.missing && (root || library.admitMissing)))) }));
198
+ return all.map(({ id, name, library, taskSources, inputMaps }) => ({
199
+ id, name,
200
+ ...(inputMaps.length && { inputMaps }),
201
+ ...(taskSources.length && { taskSources }),
202
+ available: Boolean(library.identity || (library.missing && library.admitMissing)),
203
+ }));
204
+ },
205
+ async runtimeProjects() {
206
+ return Promise.all(all.map(async item => {
207
+ const folderStatus = await inspectDirectoryStatus(item.library);
208
+ const sourceStatus = item.source ? await inspectDirectoryStatus(item.source) : null;
209
+ return {
210
+ id: item.id,
211
+ name: item.name,
212
+ folder: item.library.path,
213
+ folderStatus,
214
+ sourceRoot: item.source?.path ?? null,
215
+ sourceStatus,
216
+ available: folderStatus === 'available' || folderStatus === 'creatable',
217
+ mapSourcesCount: item.inputMaps.length,
218
+ taskSourcesCount: item.taskSources.length,
219
+ };
220
+ }));
123
221
  },
124
222
  hasOriginals: all.some(item => item.source?.identity),
125
223
  async startMapInputRecord(document, options) {
126
- const matches = all.filter(item => (item.root?.path === current || item.source?.path === current) && item.inputMaps.includes(document));
127
- if (matches.length !== 1) throw new Error('Run from the project root or its declared source directory with one matching mapSources entry.');
128
- return matches[0].mapInputs.startRecording(document, options, matches[0].root?.path === current ? 'project' : 'source');
224
+ const matches = all.filter(item => item.source?.path === current && item.inputMaps.includes(document));
225
+ if (matches.length !== 1) throw new Error('Run from the declared source_root directory with one matching mapSources entry.');
226
+ return matches[0].mapInputs.startRecording(document, options, 'source');
129
227
  },
130
228
  async readMapInputs(id, document) {
131
229
  const item = projects.get(id);
@@ -147,12 +245,18 @@ async function loadRegistry(cwd, file, workspace) {
147
245
  async get(id) {
148
246
  const item = projects.get(id);
149
247
  if (!item) throw new DocumentError('PROJECT_ADDRESS_NOT_FOUND', 'Unknown project for this launch.');
150
- const check = () => checkLibraryDirectory(item.library, item.root);
248
+ const check = () => checkLibraryDirectory(item.library, null);
151
249
  await check();
152
250
  if (closing) throw new DocumentError('OWNER_CLOSED', 'The viewer is closing.');
153
251
  item.opening ??= (async () => {
154
- const project = await openProjectLibrary({ id, binding: { root: item.root, library: item.library }, name: item.name, sourceRoot: item.source?.path,
155
- workspaceIdentity: item.source?.identity, sketches: true });
252
+ const project = await openProjectLibrary({
253
+ id,
254
+ binding: { root: null, library: item.library },
255
+ name: item.name,
256
+ sourceRoot: item.source?.path,
257
+ workspaceIdentity: item.source?.identity,
258
+ sketches: true,
259
+ });
156
260
  try {
157
261
  const originals = item.source && await originalMaterials(item.source.path, item.source.identity);
158
262
  await check();
@@ -175,6 +279,6 @@ async function loadRegistry(cwd, file, workspace) {
175
279
  },
176
280
  };
177
281
  } catch (error) {
178
- throw new Error(`Invalid project registry ${selectedFile ?? "defaults"}: ${error.message} Use locus-map view --local for the current project.`, { cause: error });
282
+ throw new Error(`Invalid project registry ${selectedFile ?? 'defaults'}: ${error.message} Use locus-map view --local for the current project.`, { cause: error });
179
283
  }
180
284
  }
@@ -60,57 +60,48 @@ async function inferSourceRoot(mode, targetPath, cwd) {
60
60
  return undefined;
61
61
  }
62
62
 
63
- async function resolveTopicTarget(target, cwd, { projectFlag }) {
63
+ async function resolveTopicTarget(target, cwd) {
64
64
  const direct = path.resolve(cwd, target);
65
65
  const directKind = await statKind(direct);
66
66
  if (directKind === 'file') {
67
- const isCatalog = projectFlag || path.basename(direct) === 'project.json';
68
- return { mode: isCatalog ? 'project' : 'document', targetPath: direct };
67
+ const base = path.basename(direct);
68
+ if (base === 'topic.json' || base.toLowerCase().endsWith('.excalidraw')) {
69
+ return { mode: 'topic', targetPath: path.dirname(direct) };
70
+ }
71
+ return { mode: 'document', targetPath: direct };
69
72
  }
70
73
  if (directKind === 'dir') {
71
- const catalog = path.join(direct, 'project.json');
72
- if (await statKind(catalog) === 'file') return { mode: 'project', targetPath: catalog };
73
- const name = path.basename(direct);
74
- if (!projectFlag && name === '.locus-map') return { mode: 'library', targetPath: path.dirname(direct) };
75
- if (name !== '.locus-map') {
76
- const namesake = path.join(direct, `${name}.locus-map.json`);
77
- if (await statKind(namesake) === 'file') return { mode: 'document', targetPath: namesake };
78
- }
79
- if (!isBareTopicName(target) || name === '.locus-map') {
80
- throw new Error(name === '.locus-map'
81
- ? `Cannot find "project.json" in "${target}".`
82
- : `Cannot find "project.json" or "${name}.locus-map.json" in "${target}".`);
74
+ if (path.basename(direct) === '.locus-map') {
75
+ return { mode: 'library', targetPath: path.dirname(direct) };
83
76
  }
77
+ return { mode: 'topic', targetPath: direct };
84
78
  }
85
79
  if (isBareTopicName(target)) {
86
- const candidates = [
87
- { mode: 'project', targetPath: path.resolve(cwd, '.locus-map', target, 'project.json') },
88
- { mode: 'document', targetPath: path.resolve(cwd, '.locus-map', target, `${target}.locus-map.json`) },
89
- { mode: 'document', targetPath: path.resolve(cwd, '.locus-map', `${target}.locus-map.json`) },
90
- ...(target === 'project'
91
- ? [{ mode: 'project', targetPath: path.resolve(cwd, '.locus-map', 'project.json') }]
92
- : []),
93
- ];
94
- for (const candidate of candidates) {
95
- if (await statKind(candidate.targetPath) === 'file') return candidate;
80
+ const topicDir = path.resolve(cwd, '.locus-map', target);
81
+ const topicDirKind = await statKind(topicDir);
82
+ if (topicDirKind === 'dir') {
83
+ return { mode: 'topic', targetPath: topicDir };
84
+ }
85
+ const directDoc = path.resolve(cwd, '.locus-map', `${target}.locus-map.json`);
86
+ if (await statKind(directDoc) === 'file') {
87
+ return { mode: 'document', targetPath: directDoc };
96
88
  }
97
89
  throw new Error(
98
- `Cannot find ${projectFlag ? 'project or diagram' : 'diagram or project'} "${target}". `
99
- + `Checked "${target}", ".locus-map/${target}/project.json", ".locus-map/${target}/${target}.locus-map.json", and ".locus-map/${target}.locus-map.json".`,
90
+ `Cannot find topic or diagram "${target}". `
91
+ + `Checked "${target}", ".locus-map/${target}/", and ".locus-map/${target}.locus-map.json".`,
100
92
  );
101
93
  }
102
- return { mode: projectFlag ? 'project' : 'document', targetPath: direct };
94
+ return { mode: 'document', targetPath: direct };
103
95
  }
104
96
 
105
97
  /**
106
- * Parse `locus-map view` CLI arguments, resolve topic/project shorthands relative
98
+ * Parse `locus-map view` CLI arguments, resolve topic/document shorthands relative
107
99
  * to `cwd`, and return the canonical `open-map.mjs` argument list.
108
100
  */
109
101
  export async function resolveViewArgs(args, { cwd = process.cwd(), usage }) {
110
102
  const resolvedCwd = path.resolve(cwd);
111
103
  const seen = new Set();
112
104
  let local = false;
113
- let hasProject = false;
114
105
  let positional;
115
106
  let sourceRoot;
116
107
  let noSourceRoot = false;
@@ -121,6 +112,7 @@ export async function resolveViewArgs(args, { cwd = process.cwd(), usage }) {
121
112
  for (let index = 0; index < args.length; index++) {
122
113
  const token = args[index];
123
114
  if (token === '--document') throw new Error('Pass the document as the first argument to view.');
115
+ if (token === '--project') throw new Error('The --project flag was removed. Pass a topic directory, topic.json, or use "locus-map view --local".');
124
116
  if (!token.startsWith('-')) {
125
117
  if (positional !== undefined) throw new Error(usage);
126
118
  positional = token;
@@ -131,7 +123,6 @@ export async function resolveViewArgs(args, { cwd = process.cwd(), usage }) {
131
123
  if (token === '--local') { local = true; continue; }
132
124
  if (token === '--read-only') { readOnly = true; continue; }
133
125
  if (token === '--no-source-root') { noSourceRoot = true; continue; }
134
- if (token === '--project') { hasProject = true; continue; }
135
126
  const value = args[++index];
136
127
  if (!value || value.startsWith('-')) throw new Error(usage);
137
128
  if (token === '--source-root') sourceRoot = path.resolve(resolvedCwd, value);
@@ -145,23 +136,12 @@ export async function resolveViewArgs(args, { cwd = process.cwd(), usage }) {
145
136
  }
146
137
 
147
138
  if (sourceRoot !== undefined && noSourceRoot) throw new Error(usage);
148
- if (hasProject && local) throw new Error(usage);
139
+ if (local && positional !== undefined) throw new Error(usage);
149
140
 
150
141
  let mode;
151
142
  let targetPath;
152
- if (hasProject) {
153
- if (positional === undefined) {
154
- const rootCatalog = path.resolve(resolvedCwd, '.locus-map', 'project.json');
155
- if (await statKind(rootCatalog) !== 'file') {
156
- throw new Error('Cannot find root project catalog ".locus-map/project.json". Pass a catalog file, topic name, or use "locus-map view --local".');
157
- }
158
- mode = 'project';
159
- targetPath = rootCatalog;
160
- } else {
161
- ({ mode, targetPath } = await resolveTopicTarget(positional, resolvedCwd, { projectFlag: true }));
162
- }
163
- } else if (positional !== undefined) {
164
- ({ mode, targetPath } = await resolveTopicTarget(positional, resolvedCwd, { projectFlag: false }));
143
+ if (positional !== undefined) {
144
+ ({ mode, targetPath } = await resolveTopicTarget(positional, resolvedCwd));
165
145
  } else {
166
146
  const isolated = local || sourceRoot !== undefined || noSourceRoot;
167
147
  mode = isolated ? 'library' : 'user-projects';
@@ -12,22 +12,23 @@ const usage = `Usage:
12
12
  locus-map tasks export [--root DIR] [--dir .tasks] [--include-archived]
13
13
  locus-map view --help
14
14
  locus-map view [--local] [--source-root DIR | --no-source-root] [--read-only] [--port N]
15
- locus-map view TARGET [--source-root DIR | --no-source-root] [--read-only] [--port N] [--previous-document FILE]
16
- locus-map view --project [TARGET] [--source-root DIR | --no-source-root] [--read-only] [--port N]`;
15
+ locus-map view TARGET [--source-root DIR | --no-source-root] [--read-only] [--port N] [--previous-document FILE]`;
17
16
 
18
17
  const viewHelp = `${usage.slice(usage.indexOf(' locus-map view [--local]'))}
19
18
 
20
19
  Start one local viewer and open the URL it prints. Keep its process running.
21
- Register named folders in ~/.locusmap/projects.toml. Existing projects.json registries also work.
20
+ Register named folders in ~/.locus-map/projects.toml.
22
21
  Without a registry, view opens Personal and any library in the launch directory.
23
- --local skips the home registry. Explicit target, --project and --source-root launches also skip it.
24
- TARGET may be a file, directory or topic name under .locus-map/ (.locus-map/<name>/project.json,
25
- .locus-map/<name>/<name>.locus-map.json or .locus-map/<name>.locus-map.json). --project without a
26
- target opens the root .locus-map/project.json. Isolated launches default --source-root to the
27
- enclosing project directory when the target lives under .locus-map/ or the launch directory; pass
28
- --no-source-root to disable original-file links.
29
- Workspace launches default to 127.0.0.1:8181 or the configured port. --port N overrides both.
30
- Use --port 0 for a free port, the default for explicit and isolated launches. --read-only disables file saves.
22
+ --local skips the home registry. Explicit targets and --source-root launches also skip it.
23
+ TARGET may be a .locus-map.json file, topic.json, topic directory, or bare topic name under
24
+ .locus-map/ (.locus-map/<name>/ or .locus-map/<name>.locus-map.json). Isolated launches default
25
+ --source-root to the enclosing project directory when the target lives under .locus-map/ or the
26
+ launch directory; pass --no-source-root to disable original-file links.
27
+ Workspace launches default to 127.0.0.1:8181 or the configured port. Visiting http://127.0.0.1:8181/
28
+ redirects to the default tab; /?cwd=DIR or /?tab=NAME (with optional &map=…&view=…&node=…) selects
29
+ a matching tab on a running viewer.
30
+ --port N overrides the configured port. Isolated launches choose a free port automatically.
31
+ --read-only disables file saves and write locks process-wide.
31
32
  Launch and configuration guide: ${join(root, 'docs', 'VIEWER-LAUNCH.md')}`;
32
33
 
33
34
  async function doctor(json) {
@@ -9,7 +9,7 @@ export const DEFAULT_SHUTDOWN_GRACE_MS = 1500;
9
9
 
10
10
  export async function runOpenMap(args = process.argv.slice(2), { distDir, shutdownGraceMs = DEFAULT_SHUTDOWN_GRACE_MS } = {}) {
11
11
  let filePath;
12
- let projectPath;
12
+ let topicPath;
13
13
  let libraryRoot;
14
14
  let registryRoot;
15
15
  let previousDocumentPath;
@@ -18,8 +18,9 @@ export async function runOpenMap(args = process.argv.slice(2), { distDir, shutdo
18
18
  let port;
19
19
  const usage = `Usage:
20
20
  node scripts/open-map.mjs --document /full/path/map.locus-map.json [--previous-document /full/path/previous.locus-map.json] [--source-root DIR] [--read-only] [--port 4181]
21
- node scripts/open-map.mjs --project /full/path/project.json [--source-root DIR] [--read-only] [--port 4181]
22
- node scripts/open-map.mjs --library /full/path/project [--source-root DIR] [--read-only] [--port 4181]`;
21
+ node scripts/open-map.mjs --topic /full/path/topic-dir [--source-root DIR] [--read-only] [--port 4181]
22
+ node scripts/open-map.mjs --library /full/path/project [--source-root DIR] [--read-only] [--port 4181]
23
+ node scripts/open-map.mjs --user-projects /full/path/cwd [--read-only] [--port 8181]`;
23
24
  const seen = new Set();
24
25
  for (let index = 0; index < args.length; index++) {
25
26
  const option = args[index];
@@ -30,7 +31,7 @@ export async function runOpenMap(args = process.argv.slice(2), { distDir, shutdo
30
31
  const value = args[++index];
31
32
  if (!value || value.startsWith('--')) throw new Error(usage);
32
33
  if (option === '--document') filePath = value;
33
- else if (option === '--project') projectPath = value;
34
+ else if (option === '--topic') topicPath = value;
34
35
  else if (option === '--user-projects') registryRoot = value;
35
36
  else if (option === '--library') libraryRoot = value;
36
37
  else if (option === '--previous-document') previousDocumentPath = value;
@@ -38,8 +39,8 @@ export async function runOpenMap(args = process.argv.slice(2), { distDir, shutdo
38
39
  else if (option === '--port' && /^[0-9]+$/.test(value)) port = Number(value);
39
40
  else throw new Error(usage);
40
41
  }
41
- if ([filePath, projectPath, libraryRoot, registryRoot].filter(Boolean).length !== 1 || (!filePath && previousDocumentPath)
42
- || [filePath, projectPath, libraryRoot, registryRoot, previousDocumentPath].some(value => value !== undefined && !path.isAbsolute(value))
42
+ if ([filePath, topicPath, libraryRoot, registryRoot].filter(Boolean).length !== 1 || (!filePath && previousDocumentPath)
43
+ || [filePath, topicPath, libraryRoot, registryRoot, previousDocumentPath].some(value => value !== undefined && !path.isAbsolute(value))
43
44
  || (port !== undefined && (!Number.isInteger(port) || port < 0 || port > 65535))) {
44
45
  throw new Error(usage);
45
46
  }
@@ -47,10 +48,19 @@ export async function runOpenMap(args = process.argv.slice(2), { distDir, shutdo
47
48
  try {
48
49
  const registry = registryRoot && await readWorkspaceRegistry(registryRoot);
49
50
  port ??= registry ? registry.port ?? 8181 : 0;
50
- viewer = await startMapViewer({ filePath, projectPath, libraryRoot, registry, previousDocumentPath, sourceRoot, readOnly, port, ...(distDir ? { distDir } : {}) });
51
+ viewer = await startMapViewer({ filePath, topicPath, libraryRoot, registry, previousDocumentPath, sourceRoot, readOnly, port, ...(distDir ? { distDir } : {}) });
51
52
  if (registry?.file) console.error(`Using project registry ${registry.file}`);
53
+ if (registry?.unregisteredHint) {
54
+ const { name, folder, sourceRoot: src } = registry.unregisteredHint;
55
+ console.error(
56
+ `Current checkout is not registered in ${registry.configPath}. Add this stanza and restart the viewer, or run "locus-map view --local":\n`
57
+ + `[[projects]]\nname = ${JSON.stringify(name)}\nfolder = ${JSON.stringify(folder)}\nsource_root = ${JSON.stringify(src)}`,
58
+ );
59
+ }
52
60
  } catch (error) {
53
- console.error(error.code === 'EADDRINUSE' ? `Port ${port} is in use. Reuse your running viewer or choose another --port.` : error.message);
61
+ console.error(error.code === 'EADDRINUSE'
62
+ ? `Port ${port} is in use. Reuse your running viewer${registryRoot ? ` at http://127.0.0.1:${port}/?cwd=${encodeURIComponent(registryRoot)}` : ''} or choose another --port.`
63
+ : error.message);
54
64
  process.exit(1);
55
65
  }
56
66
  process.stdout.write(`${viewer.url}\n`);
@@ -88,14 +88,16 @@ Repair source into the next build directory via [checks and repairs](references/
88
88
 
89
89
  ## 5. Open, edit and reopen
90
90
 
91
- Checkout: `npm run build` once; npm: use the included viewer:
91
+ Checkout: `npm run build` once; npm includes the viewer.
92
+ Standard launch (port `8181`, `~/.locus-map/projects.toml`, selects current tab):
92
93
 
93
94
  ```sh
94
- "$MAP_BIN" view <diagram>
95
+ "$MAP_BIN" view
95
96
  ```
96
97
 
97
- Reopen by topic or relative path (`--source-root` is automatic). Never save `#write=`.
98
- Open the printed URL in browser; `docs/LOCAL-DOCUMENT.md` owns Open, Save and regeneration.
98
+ Running `8181`: open `http://127.0.0.1:8181/?cwd=<dir>` or **Refresh library**.
99
+ Isolated topic: `"$MAP_BIN" view <diagram>`. Never save `#write=`.
100
+ See `docs/VIEWER-LAUNCH.md` and `docs/LOCAL-DOCUMENT.md`.
99
101
  On a copy outside folder root, check open, whole-card move, Save and reopen.
100
102
  Presentation edits may be retained; changes to labels, identity or relation direction are refused by design.
101
103
  A build proves no viewer opening, saved change or reader understanding; record those separately.
@@ -36,7 +36,7 @@ Open the delivered project in Locus Map. Follow the route from the contents to a
36
36
 
37
37
  State the comparator and result on the card. Use a negative tone for every observed deterioration, including multiple on a page. Label an unstable gain, an unchanged result, uncertain economics and future work in words. A page with no losses can have zero red cards. Declare representative samples in the exported legend. Check both themes and reopen the saved scene.
38
38
 
39
- Keep project contents (`project.json` `navigation`) focused on diagram pages (saved maps and views, optionally grouped), or omit `navigation` when the default document list is enough. Add in-page card or experiment anchors (`node`) to `navigation` only when the reader explicitly requests sidebar jumps to individual cards; keep cross-canvas drilldowns in `links` and attach the protocol and report to each node. If two results fed the experiment, draw and source both labeled relations to the same card in an ordinary view. Reserve foldable reading trees for single-parent canvases. See the project contents guidance in `docs/LOCAL-DOCUMENT.md`.
39
+ Keep topic contents (`topic.json` `navigation`) focused on diagram pages (saved maps and views, optionally grouped), or omit `navigation` when the default nested folder hierarchy is enough. Add in-page card or experiment anchors (`node`) to `navigation` only when the reader explicitly requests sidebar jumps to individual cards; keep cross-canvas drilldowns in `links` and attach the protocol and report to each node. If two results fed the experiment, draw and source both labeled relations to the same card in an ordinary view. Reserve foldable reading trees for single-parent canvases. See the topic contents guidance in `docs/LOCAL-DOCUMENT.md`.
40
40
  For requested soft lines, keep rounded or curved routing while adjusting
41
41
  spacing, side ports and lanes. Inspect crossings and detours on the final scene.
42
42
  For long notes and reports with figures, see “Package reading files with the
@@ -6,7 +6,7 @@ Complete this two-step gate before authoring full diagrams whenever an interacti
6
6
 
7
7
  Require Step 1 approval before building the full deliverable whenever any of the following holds:
8
8
 
9
- - The request calls for **2 or more connected canvases** or a multi-document atlas (`project.json`).
9
+ - The request calls for **2 or more connected canvases** or a multi-document topic (`topic.json`).
10
10
  - The request covers broad scope across system architecture, workflows, tasks, and roadmap together.
11
11
  - The diagram family, presentation profile, or sequence-vs-workflow boundary is open (see [selection](selection.md)).
12
12
  - It is the **first diagram in a project** with no approved `.locus-map/preferences.md` visual defaults.
@@ -15,9 +15,9 @@ You may skip Step 1 when none of the triggers above apply, for a targeted revisi
15
15
 
16
16
  ## Step 1: Diagram plan and real Draw specimens (wait for approval)
17
17
 
18
- Before writing full diagram sources or `project.json`:
18
+ Before writing full diagram sources or `topic.json`:
19
19
 
20
- 1. **Present the diagram plan:** list every planned canvas, its Map family (`semantic`, `component`, `sequence`, `decision`), authoring route (`--source`, `research --single-diagram`, or standalone Draw if an unverified sketch is explicitly agreed), Draw profile (strict canonical `c4-reference-v1` with standard C4 roles/palette and no ad-hoc pastel color overrides as default for architecture overviews; `editorial-v4` for workflows; `task-card-v1` for `--tasks-dir`; `c4-modern-v2` only when explicitly chosen), and what each candidate shows or loses. State explicitly when an option falls outside Map admission: standalone Draw `.excalidraw` files cannot be registered or linked in `project.json` and carry no Inspector `details` or `sources`.
20
+ 1. **Present the diagram plan:** list every planned canvas, its Map family (`semantic`, `component`, `sequence`, `decision`), authoring route (`--source`, `research --single-diagram`, or standalone Draw if an unverified sketch is explicitly agreed), Draw profile (strict canonical `c4-reference-v1` with standard C4 roles/palette and no ad-hoc pastel color overrides as default for architecture overviews; `editorial-v4` for workflows; `task-card-v1` for `--tasks-dir`; `c4-modern-v2` only when explicitly chosen), and what each candidate shows or loses. State explicitly when an option falls outside Map admission: standalone Draw `.excalidraw` files cannot be linked in `topic.json` `links` or `models` and carry no Inspector `details` or `sources`.
21
21
  2. **Build 2–4 real specimen cards/components:** author a minimal specimen source file at `<diagram>/artifacts/checkpoint/specimen.puml` (or `.map.json`) and build it to a separate build subdirectory `--out-dir <diagram>/artifacts/checkpoint/builds/1` (never put the specimen source inside `--out-dir` or the published project root so output checks and project discovery stay clean). When `sequence` vs workflow is the open decision, include a small participant pair with ordered messages rather than isolated cards alone. Populate profile-accurate slots:
22
22
  - **Standard C4 architecture (`c4-reference-v1`):** keep canonical C4 roles and low-chroma palette without ad-hoc pastel color overrides, decorative badges, or extra icons (`«role»` → `Title` → optional `[Technology]` → `body`).
23
23
  - **Code-backed workflows (`editorial-v4` / editorial profiles):** for code-backed workflow steps, follow the 3-slot workflow card pattern — Line 1 (`label`): `Step N · <action>` (or localized `Шаг N · <действие>`), Line 2 (`technology`): compact code anchor `Code: :module → File :: fn()` (or localized `Код: :module → File :: fn()`), Line 3+ (`body`): 2–3 concise bullets using Unicode `• ` (literal UTF-8 `• ` in `.puml`, where `\u` escapes fail with `TEXT_ESCAPE_UNSUPPORTED`; literal `• ` or `\u2022 ` in `.map.json` / `.mjs`) — never leading `- `, which `locus-draw`'s `MARKUP` regex (`src/source/diagramSource.ts`) rejects with `INVALID_TEXT`. On grouped task grids or non-code editorial boards, keep the appropriate 3-slot editorial layout (for example `T-xxx · Title` + single status subline in `technology`).
@@ -27,7 +27,7 @@ Before writing full diagram sources or `project.json`:
27
27
  ## Step 2: Full build and delivery (only after approval)
28
28
 
29
29
  1. Apply any adjustments requested on the specimens, then author and build every planned canvas using the selected route's delivery flow (`artifacts/builds/<n>/` + `check.json` for `--source`; `build.json`, metrics, and saved-scene checks for `research`).
30
- 2. Inspect every route report (`checks[]`, including warnings such as `EDGE_ROUTE_DETOUR`, `ADJACENT_EDGE_DETOUR`, and `MAIN_PATH_MISSING`; see [checks](checks.md)) and every rendered PNG. On revisions to existing documents, follow the replacement guard in [deliverable updates](folder.md#updates) (`cmp` against the last published build before replacing the canvas root; keep a candidate when the root differs or its origin is unknown so saved viewer edits are never overwritten) before updating `project.json`.
30
+ 2. Inspect every route report (`checks[]`, including warnings such as `EDGE_ROUTE_DETOUR`, `ADJACENT_EDGE_DETOUR`, and `MAIN_PATH_MISSING`; see [checks](checks.md)) and every rendered PNG. On revisions to existing documents, follow the replacement guard in [deliverable updates](folder.md#updates) (`cmp` against the last published build before replacing the canvas root; keep a candidate when the root differs or its origin is unknown so saved viewer edits are never overwritten) before updating `topic.json`.
31
31
  3. Verify the viewer opens cleanly and offer to save reusable visual defaults into `.locus-map/preferences.md`.
32
32
 
33
33
  ## Evidence firewall
@@ -27,9 +27,9 @@ links it.
27
27
 
28
28
  Feedback lives beside the delivered document. Follow [Revise a diagram from feedback](revise.md) for the editing workflow and older handoffs.
29
29
 
30
- ## Deliver project pages
30
+ ## Deliver nested topic maps
31
31
 
32
- When the reader requests separate maps, use `skills/locus-map-primitives/SKILL.md` for the project catalog, trigger and target addresses. Use [the destination rule](connected-diagram.md#choose-what-a-card-opens) to choose what opens. Hand over the catalog, its member folders and the verified launch command. Test edits on a copy of the catalog and member files together.
32
+ When the reader requests separate maps, place subtopics directly under `.locus-map/<topic>/<subtopic>/<subtopic>.locus-map.json` (no `pages/` folder). Use `skills/locus-map-primitives/SKILL.md` and `docs/LOCAL-DOCUMENT.md` for optional `topic.json` links, ordering, and navigation. Use [the destination rule](connected-diagram.md#choose-what-a-card-opens) to choose what opens. Hand over the topic folder, its member files, and the verified open URL (`docs/VIEWER-LAUNCH.md`). Test edits on a copy of the topic folder together.
33
33
 
34
34
  ## What stays out
35
35
 
@@ -26,8 +26,8 @@ Paths here and in `docs/capabilities.json` start at the explicitly selected Map
26
26
  Ordinary `.puml`/schema-v1 `.map.json` use `source` and produce `semantic` only (`sequence` is admitted on
27
27
  the `research` route via `--single-diagram`, not `--source`; never silently substitute one for the other —
28
28
  clarify the tradeoff during the component checkpoint, or use standalone Draw `.excalidraw` if an unverified
29
- sequence sketch is explicitly agreed, noting that `.excalidraw` files cannot be registered or linked in
30
- `project.json` and carry no Inspector `details` or `sources`). C4 Component vocabulary and reading areas are not canonical `contains`
29
+ sequence sketch is explicitly agreed, noting that `.excalidraw` files cannot be linked in `topic.json`
30
+ `links` or `models` and carry no Inspector `details` or `sources`). C4 Component vocabulary and reading areas are not canonical `contains`
31
31
  ownership. Source profiles belong to Draw; resolve them through `docs/PLANTUML-SOURCE.md` and the installed
32
32
  Draw skill. `docs/DIAGRAM-SOURCE.md` owns Map source admission. Other families and verified claims use
33
33
  `research`; the ArchiMate application subset also keeps that workflow.