lanternspec 0.1.2__tar.gz → 0.2.0__tar.gz

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 (192) hide show
  1. {lanternspec-0.1.2/src/lanternspec.egg-info → lanternspec-0.2.0}/PKG-INFO +8 -7
  2. {lanternspec-0.1.2 → lanternspec-0.2.0}/README.md +7 -6
  3. {lanternspec-0.1.2 → lanternspec-0.2.0}/pyproject.toml +1 -1
  4. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/check/doctor.py +97 -6
  5. lanternspec-0.2.0/src/lanternspec/check/layout.py +348 -0
  6. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/check/legacy.py +3 -14
  7. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/report.py +2 -2
  8. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/tools.py +7 -2
  9. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/new_id.py +1 -1
  10. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/profile.py +64 -27
  11. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/project.py +19 -0
  12. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/learn/debt.py +3 -1
  13. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/doc_map.py +1 -1
  14. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/obsidian.py +68 -9
  15. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/principles_doc.py +5 -3
  16. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/views.py +1 -1
  17. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-adr/SKILL.md +1 -1
  18. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-plan/SKILL.md +15 -4
  19. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-report/SKILL.md +3 -3
  20. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-task/SKILL.md +1 -1
  21. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Collaboration Rules.md +4 -3
  22. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Tasks.md +4 -3
  23. lanternspec-0.2.0/src/lanternspec/resources/locales/en/templates/Work Division Rules.md +29 -0
  24. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-adr/SKILL.md +1 -1
  25. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-plan/SKILL.md +15 -4
  26. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-report/SKILL.md +3 -3
  27. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-task/SKILL.md +1 -1
  28. lanternspec-0.2.0/src/lanternspec/resources/locales/ko/templates//354/236/221/354/227/205 /353/202/230/353/210/204/352/270/260 /352/270/260/354/244/200.md" +29 -0
  29. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//355/225/240 /354/235/274.md" +4 -3
  30. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//355/230/221/354/227/205 /352/267/234/354/271/231.md" +4 -3
  31. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/messages.yaml +38 -6
  32. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/names.yaml +4 -2
  33. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/agent_hooks.py +5 -2
  34. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/antigravity.py +2 -1
  35. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/base.py +48 -2
  36. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/claude.py +110 -9
  37. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/codex.py +1 -0
  38. lanternspec-0.2.0/src/lanternspec/tools/health.py +233 -0
  39. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/install.py +30 -3
  40. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/rules.py +1 -1
  41. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/scaffold.py +7 -5
  42. {lanternspec-0.1.2 → lanternspec-0.2.0/src/lanternspec.egg-info}/PKG-INFO +8 -7
  43. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec.egg-info/SOURCES.txt +7 -2
  44. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_install_and_aux.py +39 -0
  45. lanternspec-0.2.0/tests/test_layout.py +158 -0
  46. lanternspec-0.2.0/tests/test_name_overlap.py +90 -0
  47. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_names.py +1 -1
  48. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_principles.py +3 -3
  49. lanternspec-0.2.0/tests/test_tool_health.py +121 -0
  50. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_work_line.py +6 -6
  51. lanternspec-0.1.2/src/lanternspec/resources/locales/en/templates/Work Unit Log.md +0 -27
  52. lanternspec-0.1.2/src/lanternspec/resources/locales/ko/templates//354/236/221/354/227/205 /353/213/250/354/234/204 /352/270/260/353/241/235.md" +0 -27
  53. {lanternspec-0.1.2 → lanternspec-0.2.0}/LICENSE +0 -0
  54. {lanternspec-0.1.2 → lanternspec-0.2.0}/setup.cfg +0 -0
  55. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/__init__.py +0 -0
  56. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/__main__.py +0 -0
  57. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/check/__init__.py +0 -0
  58. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/check/check_docs.py +0 -0
  59. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/check/githooks.py +0 -0
  60. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/check/templates.py +0 -0
  61. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/__init__.py +0 -0
  62. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/check.py +0 -0
  63. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/common.py +0 -0
  64. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/core.py +0 -0
  65. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/learn.py +0 -0
  66. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/cli/work.py +0 -0
  67. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/__init__.py +0 -0
  68. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/enums.py +0 -0
  69. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/frontmatter.py +0 -0
  70. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/links.py +0 -0
  71. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/messages.py +0 -0
  72. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/meta.py +0 -0
  73. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/names.py +0 -0
  74. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/principles.py +0 -0
  75. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/sections.py +0 -0
  76. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/state.py +0 -0
  77. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/taskfile.py +0 -0
  78. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/core/templating.py +0 -0
  79. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/learn/__init__.py +0 -0
  80. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/learn/knowledge/__init__.py +0 -0
  81. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/learn/knowledge/drafts.py +0 -0
  82. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/learn/knowledge/mcp_server.py +0 -0
  83. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/learn/knowledge/notion.py +0 -0
  84. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/learn/knowledge/obsidian.py +0 -0
  85. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/__init__.py +0 -0
  86. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/evaluate.py +0 -0
  87. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/harness.py +0 -0
  88. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/scan.py +0 -0
  89. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/sections_doc.py +0 -0
  90. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/report/status.py +0 -0
  91. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/__init__.py +0 -0
  92. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/conventions/go.yaml +0 -0
  93. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/conventions/python.yaml +0 -0
  94. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/conventions/rust.yaml +0 -0
  95. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/conventions/swift.yaml +0 -0
  96. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/conventions/typescript.yaml +0 -0
  97. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/agents/AGENTS.md +0 -0
  98. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-build/SKILL.md +0 -0
  99. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-check/SKILL.md +0 -0
  100. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-design/SKILL.md +0 -0
  101. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-idea/SKILL.md +0 -0
  102. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-init/SKILL.md +0 -0
  103. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-learn/SKILL.md +0 -0
  104. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-map/SKILL.md +0 -0
  105. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-sync/SKILL.md +0 -0
  106. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/skills/l-template/SKILL.md +0 -0
  107. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/ADR.md +0 -0
  108. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/API.md +0 -0
  109. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Architecture.md +0 -0
  110. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Competency Card.md +0 -0
  111. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Data.md +0 -0
  112. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Debt Card.md +0 -0
  113. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Deployment.md +0 -0
  114. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Design.md +0 -0
  115. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Docs MOC.md +0 -0
  116. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Feature List.md +0 -0
  117. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Idea.md +0 -0
  118. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Known Tech.md +0 -0
  119. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Legacy Map.md +0 -0
  120. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Log.md +0 -0
  121. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Meeting Notes.md +0 -0
  122. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Plan.md +0 -0
  123. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Platform Integration.md +0 -0
  124. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Project Definition.md +0 -0
  125. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Screens.md +0 -0
  126. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Server Operations.md +0 -0
  127. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/Session Log.md +0 -0
  128. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/en/templates/_meta/enums.yaml +0 -0
  129. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/agents/AGENTS.md +0 -0
  130. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-build/SKILL.md +0 -0
  131. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-check/SKILL.md +0 -0
  132. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-design/SKILL.md +0 -0
  133. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-idea/SKILL.md +0 -0
  134. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-init/SKILL.md +0 -0
  135. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-learn/SKILL.md +0 -0
  136. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-map/SKILL.md +0 -0
  137. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-sync/SKILL.md +0 -0
  138. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/skills/l-template/SKILL.md +0 -0
  139. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates/ADR.md +0 -0
  140. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates/API.md +0 -0
  141. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates/_meta/enums.yaml +0 -0
  142. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//352/260/234/353/260/234/353/254/270/354/204/234 MOC.md" +0 -0
  143. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//352/270/260/353/212/245 /353/252/251/353/241/235.md" +0 -0
  144. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//352/270/260/353/241/235.md" +0 -0
  145. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//352/270/260/354/241/264 /353/254/270/354/204/234 /354/247/200/353/217/204.md" +0 -0
  146. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//352/270/260/355/232/215.md" +0 -0
  147. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//353/215/260/354/235/264/355/204/260.md" +0 -0
  148. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//353/260/260/355/217/254.md" +0 -0
  149. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//353/266/200/354/261/204 /354/271/264/353/223/234.md" +0 -0
  150. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//354/204/234/353/262/204 /353/260/260/355/217/254 /302/267 /354/232/264/354/230/201.md" +0 -0
  151. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//354/204/244/352/263/204.md" +0 -0
  152. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//354/204/270/354/205/230 /352/270/260/353/241/235.md" +0 -0
  153. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//354/213/234/354/212/244/355/205/234 /352/265/254/354/241/260.md" +0 -0
  154. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//354/225/204/353/212/224 /352/270/260/354/210/240.md" +0 -0
  155. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//354/225/204/354/235/264/353/224/224/354/226/264.md" +0 -0
  156. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//354/227/255/353/237/211 /354/271/264/353/223/234.md" +0 -0
  157. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//355/224/204/353/241/234/354/240/235/355/212/270 /354/240/225/354/235/230/354/204/234.md" +0 -0
  158. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//355/224/214/353/236/253/355/217/274 /354/227/260/353/217/231.md" +0 -0
  159. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//355/231/224/353/251/264.md" +0 -0
  160. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/locales/ko/templates//355/232/214/354/235/230/353/241/235.md" +0 -0
  161. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/resources/principles.yaml +0 -0
  162. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/__init__.py +0 -0
  163. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/close.py +0 -0
  164. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/docs_mode.py +0 -0
  165. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/runlog.py +0 -0
  166. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/tools/skills.py +0 -0
  167. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/__init__.py +0 -0
  168. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/branches.py +0 -0
  169. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/dbml.py +0 -0
  170. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/epic_rules.py +0 -0
  171. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/ideas.py +0 -0
  172. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/pack.py +0 -0
  173. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/progress.py +0 -0
  174. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/screen.py +0 -0
  175. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/stages.py +0 -0
  176. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec/work/tasks.py +0 -0
  177. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec.egg-info/dependency_links.txt +0 -0
  178. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec.egg-info/entry_points.txt +0 -0
  179. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec.egg-info/requires.txt +0 -0
  180. {lanternspec-0.1.2 → lanternspec-0.2.0}/src/lanternspec.egg-info/top_level.txt +0 -0
  181. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_checks.py +0 -0
  182. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_core.py +0 -0
  183. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_english.py +0 -0
  184. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_enums_single_source.py +0 -0
  185. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_git.py +0 -0
  186. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_later_features.py +0 -0
  187. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_learning_line.py +0 -0
  188. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_messages.py +0 -0
  189. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_obsidian.py +0 -0
  190. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_principles_data.py +0 -0
  191. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_release_script.py +0 -0
  192. {lanternspec-0.1.2 → lanternspec-0.2.0}/tests/test_skill_commands.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lanternspec
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Spec-driven development for agentic software engineering
5
5
  Author: Jihyeok Jeong
6
6
  License-Expression: MIT
@@ -65,7 +65,7 @@ Then call `/l-init` inside your AI tool (`$l-init` in Codex).
65
65
  - **Language:** documents, skills and rules come in English (`--language en`) or Korean (the default). It is chosen at the first install and kept in `lantern.yaml`.
66
66
  - **Using several AI tools:** `lantern install --language en --tools claude,codex,antigravity`
67
67
  - **Skills live in your project:** they are written straight into the project, not installed as a plugin. So they are called without a prefix (`/l-init`) and shared with your team through git.
68
- - **When a new version comes out:** `uv tool upgrade lanternspec` → `lantern upgrade`
68
+ - **When a new version comes out:** `uv tool upgrade lanternspec` → `lantern upgrade`. If the version changed the documents' folder layout, it first shows what would move and stops — check it, then `lantern upgrade --apply` (moved with git so history continues, links rewritten, one commit)
69
69
 
70
70
  ## Quick start
71
71
 
@@ -93,7 +93,7 @@ Then call `/l-init` inside your AI tool (`$l-init` in Codex).
93
93
  | Command | When to use it |
94
94
  |---|---|
95
95
  | `lantern status` | when you pick the work back up — shows the work in progress, the next task and open questions in three lines |
96
- | `lantern doctor` | right after installing, or when something feels off — checks that install, settings and folders match `lantern.yaml` |
96
+ | `lantern doctor` | right after installing, or when something feels off — checks that install, settings and folders match `lantern.yaml`, and that each installed AI tool's version and hooks are working |
97
97
  | `lantern --help` | when you forget a command — options per command with `lantern <command> --help` |
98
98
 
99
99
  ## Flow and skills
@@ -123,7 +123,7 @@ flowchart LR
123
123
  | `/l-check` | format check (required sections · values · links · versions · IDs · length) | — |
124
124
  | `/l-sync` | finds where documents and code disagree and brings them back in line | — |
125
125
  | `/l-map` | updates the MOC (document map) | `Docs MOC.md` |
126
- | `/l-adr` | records decisions that are hard to reverse | `Rules and Decisions/ADR-001 …` |
126
+ | `/l-adr` | records decisions that are hard to reverse | `Decisions/ADR-001 …` |
127
127
 
128
128
  ### How it works
129
129
  - **Scripts handle the format, the AI writes the content.** Numbering, files, folders, checks and status changes all go through the `lantern` command; the AI only writes content.
@@ -144,6 +144,7 @@ docs/
144
144
  ├─ 2. Work/W-001 …/ plan · design · tasks · log — the only place edited while working
145
145
  │ └─ Archive/ archive
146
146
  ├─ 3. Current State/ what the system looks like now — updated only when work is done, after approval
147
+ │ └─ Rules/ · Decisions/ · Deployment and Operations/ …
147
148
  ├─ 4. Operations/ reports · session logs · (teams of 2+) meeting notes
148
149
  ├─ 5. Legacy Docs/ (existing projects) original documents, kept unchanged
149
150
  └─ 📒 Debt/ understanding debt — one card per debt
@@ -161,7 +162,7 @@ Sections lantern reads and writes (protected sections, such as "Now" in a log) m
161
162
  ### Viewing the docs in Obsidian
162
163
  Open the `docs/` folder as a vault in Obsidian and it is already set up for reading (`docs/.obsidian/`).
163
164
 
164
- - **Folder colors, callouts and quotes** — each document stage has its own folder color, and callouts and quotes look clean. Works on top of any theme.
165
+ - **Folder colors, folder and file icons, callouts and quotes** — each document stage has its own folder color, folders and files get icons, and callouts and quotes look clean. Works on top of any theme.
165
166
  - **Picking status and kind** — each document type offers only its own choices in a menu (Metadata Menu). The choices are generated from `enums.yaml`, so renaming a value updates them too.
166
167
  - **Recommended plugins** — Dataview (shows `[start:: …]` fields in task lists) and Metadata Menu (choice menus). `/l-init` asks whether to download them; to do it later:
167
168
 
@@ -175,7 +176,7 @@ When Obsidian first asks whether to turn on community plugins, turn them on (lea
175
176
 
176
177
  | Tool | Skills | Rules | Agent hooks | MCP (`--mcp`) |
177
178
  |---|---|---|---|---|
178
- | Claude Code | `.claude/skills` | `CLAUDE.md` → `@AGENTS.md` | `.claude/settings.json` | `.mcp.json` |
179
+ | Claude Code | `.claude/skills` | `AGENTS.md` (an existing `CLAUDE.md` gets `@AGENTS.md`) | `.claude/settings.json` | `.mcp.json` |
179
180
  | Codex | `.agents/skills` (`$l-…`) | `AGENTS.md` | `.codex/hooks.json` | `.codex/config.toml` |
180
181
  | Antigravity CLI (`agy`) | `.agents/skills` | `AGENTS.md` | `.agents/hooks.json` (no save-before-compaction — there is no compaction hook) | `.agents/plugins/lanternspec/` |
181
182
 
@@ -259,7 +260,7 @@ Import mockups with `lantern screen import`; `lantern screen compare` finds wher
259
260
  ## CLI at a glance
260
261
 
261
262
  ```text
262
- setup install [--language] [--tools] [--mcp] [--ci|--no-ci] · upgrade · doctor · harness suggest
263
+ setup install [--language] [--tools] [--mcp] [--ci|--no-ci] · upgrade [--apply] · doctor · harness suggest
263
264
  profile profile show|docs|write|set · principles show|detect · enums list|rename · sections list|rename|off|on
264
265
  documents scaffold init [--plan] | work | doc | idea | adr | meeting | custom · new-id · map · meta get|set
265
266
  checks check [--changed] [--epic W-012] · lint · check-dbml · dbml render|from-sql|diff
@@ -50,7 +50,7 @@ Then call `/l-init` inside your AI tool (`$l-init` in Codex).
50
50
  - **Language:** documents, skills and rules come in English (`--language en`) or Korean (the default). It is chosen at the first install and kept in `lantern.yaml`.
51
51
  - **Using several AI tools:** `lantern install --language en --tools claude,codex,antigravity`
52
52
  - **Skills live in your project:** they are written straight into the project, not installed as a plugin. So they are called without a prefix (`/l-init`) and shared with your team through git.
53
- - **When a new version comes out:** `uv tool upgrade lanternspec` → `lantern upgrade`
53
+ - **When a new version comes out:** `uv tool upgrade lanternspec` → `lantern upgrade`. If the version changed the documents' folder layout, it first shows what would move and stops — check it, then `lantern upgrade --apply` (moved with git so history continues, links rewritten, one commit)
54
54
 
55
55
  ## Quick start
56
56
 
@@ -78,7 +78,7 @@ Then call `/l-init` inside your AI tool (`$l-init` in Codex).
78
78
  | Command | When to use it |
79
79
  |---|---|
80
80
  | `lantern status` | when you pick the work back up — shows the work in progress, the next task and open questions in three lines |
81
- | `lantern doctor` | right after installing, or when something feels off — checks that install, settings and folders match `lantern.yaml` |
81
+ | `lantern doctor` | right after installing, or when something feels off — checks that install, settings and folders match `lantern.yaml`, and that each installed AI tool's version and hooks are working |
82
82
  | `lantern --help` | when you forget a command — options per command with `lantern <command> --help` |
83
83
 
84
84
  ## Flow and skills
@@ -108,7 +108,7 @@ flowchart LR
108
108
  | `/l-check` | format check (required sections · values · links · versions · IDs · length) | — |
109
109
  | `/l-sync` | finds where documents and code disagree and brings them back in line | — |
110
110
  | `/l-map` | updates the MOC (document map) | `Docs MOC.md` |
111
- | `/l-adr` | records decisions that are hard to reverse | `Rules and Decisions/ADR-001 …` |
111
+ | `/l-adr` | records decisions that are hard to reverse | `Decisions/ADR-001 …` |
112
112
 
113
113
  ### How it works
114
114
  - **Scripts handle the format, the AI writes the content.** Numbering, files, folders, checks and status changes all go through the `lantern` command; the AI only writes content.
@@ -129,6 +129,7 @@ docs/
129
129
  ├─ 2. Work/W-001 …/ plan · design · tasks · log — the only place edited while working
130
130
  │ └─ Archive/ archive
131
131
  ├─ 3. Current State/ what the system looks like now — updated only when work is done, after approval
132
+ │ └─ Rules/ · Decisions/ · Deployment and Operations/ …
132
133
  ├─ 4. Operations/ reports · session logs · (teams of 2+) meeting notes
133
134
  ├─ 5. Legacy Docs/ (existing projects) original documents, kept unchanged
134
135
  └─ 📒 Debt/ understanding debt — one card per debt
@@ -146,7 +147,7 @@ Sections lantern reads and writes (protected sections, such as "Now" in a log) m
146
147
  ### Viewing the docs in Obsidian
147
148
  Open the `docs/` folder as a vault in Obsidian and it is already set up for reading (`docs/.obsidian/`).
148
149
 
149
- - **Folder colors, callouts and quotes** — each document stage has its own folder color, and callouts and quotes look clean. Works on top of any theme.
150
+ - **Folder colors, folder and file icons, callouts and quotes** — each document stage has its own folder color, folders and files get icons, and callouts and quotes look clean. Works on top of any theme.
150
151
  - **Picking status and kind** — each document type offers only its own choices in a menu (Metadata Menu). The choices are generated from `enums.yaml`, so renaming a value updates them too.
151
152
  - **Recommended plugins** — Dataview (shows `[start:: …]` fields in task lists) and Metadata Menu (choice menus). `/l-init` asks whether to download them; to do it later:
152
153
 
@@ -160,7 +161,7 @@ When Obsidian first asks whether to turn on community plugins, turn them on (lea
160
161
 
161
162
  | Tool | Skills | Rules | Agent hooks | MCP (`--mcp`) |
162
163
  |---|---|---|---|---|
163
- | Claude Code | `.claude/skills` | `CLAUDE.md` → `@AGENTS.md` | `.claude/settings.json` | `.mcp.json` |
164
+ | Claude Code | `.claude/skills` | `AGENTS.md` (an existing `CLAUDE.md` gets `@AGENTS.md`) | `.claude/settings.json` | `.mcp.json` |
164
165
  | Codex | `.agents/skills` (`$l-…`) | `AGENTS.md` | `.codex/hooks.json` | `.codex/config.toml` |
165
166
  | Antigravity CLI (`agy`) | `.agents/skills` | `AGENTS.md` | `.agents/hooks.json` (no save-before-compaction — there is no compaction hook) | `.agents/plugins/lanternspec/` |
166
167
 
@@ -244,7 +245,7 @@ Import mockups with `lantern screen import`; `lantern screen compare` finds wher
244
245
  ## CLI at a glance
245
246
 
246
247
  ```text
247
- setup install [--language] [--tools] [--mcp] [--ci|--no-ci] · upgrade · doctor · harness suggest
248
+ setup install [--language] [--tools] [--mcp] [--ci|--no-ci] · upgrade [--apply] · doctor · harness suggest
248
249
  profile profile show|docs|write|set · principles show|detect · enums list|rename · sections list|rename|off|on
249
250
  documents scaffold init [--plan] | work | doc | idea | adr | meeting | custom · new-id · map · meta get|set
250
251
  checks check [--changed] [--epic W-012] · lint · check-dbml · dbml render|from-sql|diff
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "lanternspec"
7
- version = "0.1.2"
7
+ version = "0.2.0"
8
8
  description = "Spec-driven development for agentic software engineering"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -1,7 +1,8 @@
1
1
  """`lantern doctor` — does the project's real structure match lantern.yaml? One look at everything.
2
2
 
3
3
  Checks lantern.yaml, the `lantern` command, git and its hooks, the docs storage mode, templates,
4
- enums.yaml, the MOC, the knowledge store, installed skills, AGENTS.md and the code size.
4
+ enums.yaml, the MOC, the knowledge store, installed skills, AGENTS.md, the code size and, for each
5
+ installed AI tool, its version and whether its hooks still run (tools/health.py).
5
6
 
6
7
  Not here:
7
8
  - fixing anything — each row names the command that fixes it
@@ -19,7 +20,8 @@ from ..tools.rules import AGENTS_START
19
20
  from ..tools.skills import SKILL_NAMES
20
21
  from . import githooks
21
22
 
22
- OK, WARN, BAD = "✔", "⚠", "✖"
23
+ OK, INFO, WARN, BAD = "✔", "ℹ", "⚠", "✖"
24
+ LEVELS = {"ok": OK, "info": INFO, "warn": WARN, "bad": BAD} # Tool.check_config levels → icons
23
25
 
24
26
 
25
27
  def run(project: Project) -> list[tuple[str, str]]:
@@ -121,10 +123,99 @@ def run(project: Project) -> list[tuple[str, str]]:
121
123
  agents = project.root / "AGENTS.md"
122
124
  if not agents.exists() or AGENTS_START not in read(agents):
123
125
  out.append((WARN, msg("AGENTS.md has no LanternSpec rules — lantern upgrade")))
124
- if "claude" in (st.get("tools") or []):
125
- cm = project.root / "CLAUDE.md"
126
- if not cm.exists() or "@AGENTS.md" not in read(cm):
127
- out.append((WARN, msg("CLAUDE.md doesn't load @AGENTS.md")))
126
+ out += _tool_rows(project, list(st.get("tools") or []))
127
+ return out
128
+
129
+
130
+ def _tool_rows(project: Project, names: list[str]) -> list[tuple[str, str]]:
131
+ """Check each installed AI tool: it reads our rules, its version against the checked ones, its hooks still running, odd payloads."""
132
+ from ..tools import REGISTRY, health
133
+
134
+ beats, odd = health.heartbeat(project), health.unexpected(project)
135
+ out: list[tuple[str, str]] = []
136
+ for tool in (REGISTRY[n] for n in names if n in REGISTRY):
137
+ out += [(LEVELS[level], text) for level, text in tool.check_config(project)]
138
+ version = health.installed_version(tool)
139
+ verdict = health.version_verdict(tool, version) if version else ""
140
+ if version is None:
141
+ out.append(
142
+ (WARN, msg("{label}: the {launch} command isn't on PATH — can't check its version", label=tool.label, launch=tool.launch))
143
+ )
144
+ elif verdict == "old":
145
+ out.append(
146
+ (
147
+ BAD,
148
+ msg(
149
+ "{label} {version} is older than {min} — update it (some features won't work)",
150
+ label=tool.label,
151
+ version=version,
152
+ min=tool.min_version,
153
+ ),
154
+ )
155
+ )
156
+ elif verdict == "new":
157
+ out.append(
158
+ (
159
+ WARN,
160
+ msg(
161
+ "{label} {version} is newer than the last checked {verified} — if hooks misbehave, the hook rows below show it",
162
+ label=tool.label,
163
+ version=version,
164
+ verified=tool.verified_version,
165
+ ),
166
+ )
167
+ )
168
+ elif verdict == "ok":
169
+ out.append(
170
+ (
171
+ OK,
172
+ msg(
173
+ "{label} {version} (checked up to {verified})",
174
+ label=tool.label,
175
+ version=version,
176
+ verified=tool.verified_version or "-",
177
+ ),
178
+ )
179
+ )
180
+ else:
181
+ out.append((WARN, msg("{label}: couldn't read its version", label=tool.label)))
182
+ mine = beats.get(tool.name)
183
+ if not mine:
184
+ out.append((WARN, msg("{label}: its hooks have never run in this project — open a session once to check", label=tool.label)))
185
+ else:
186
+ silent = health.silent_events(tool, mine)
187
+ if silent:
188
+ out.append(
189
+ (
190
+ WARN,
191
+ msg(
192
+ "{label}: hook {items} stopped running for {count} sessions — the tool may have "
193
+ "changed its hooks (lantern upgrade; if it stays, report it)",
194
+ label=tool.label,
195
+ items=", ".join(silent),
196
+ count=health.MISSED_STARTS,
197
+ ),
198
+ )
199
+ )
200
+ else:
201
+ runs = sum(int(v.get("count") or 0) for v in (mine.get("events") or {}).values())
202
+ out.append((OK, msg("{label}: hooks running ({count} runs)", label=tool.label, count=runs)))
203
+ calls = [c for c in odd if c.get("tool") == tool.name]
204
+ if calls:
205
+ last = calls[-1]
206
+ out.append(
207
+ (
208
+ WARN,
209
+ msg(
210
+ "{label}: {count} hook calls came without {items} (latest {at}, {event}) — its payload format may have changed",
211
+ label=tool.label,
212
+ count=len(calls),
213
+ items=", ".join(last.get("missing") or []),
214
+ at=last.get("at", "?"),
215
+ event=last.get("event", "?"),
216
+ ),
217
+ )
218
+ )
128
219
  return out
129
220
 
130
221
 
@@ -0,0 +1,348 @@
1
+ """Put documents where the current names.yaml says they belong — from any older layout, with no per-version code.
2
+
3
+ Documents carry their identity in frontmatter (`id: CUR-deploy`, `id: ADR-004`), so where a document
4
+ *is* and where it *should be* can be compared at any time. When a folder or document name changes in
5
+ names.yaml, `lantern upgrade` shows what would move and `lantern upgrade --apply` moves it.
6
+
7
+ Responsibilities:
8
+ - where each document should be: fixed-id documents through DOC_FOLDERS, numbered documents
9
+ (ADR · idea · debt card · meeting) through their ID kind's folder
10
+ - plan the moves, the `template:` values to update and the links to rewrite (nothing changes)
11
+ - apply the plan: `git mv` (history continues), rewrite links, one commit
12
+
13
+ Not here:
14
+ - where each kind of document lives → core/profile.py (DOC_FOLDERS) · core/new_id.py (KINDS) · names.yaml
15
+ - running it as part of an upgrade → tools/install.py (upgrade)
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import os
21
+ import re
22
+ from dataclasses import dataclass, field
23
+ from pathlib import Path
24
+
25
+ from ..core import frontmatter, state
26
+ from ..core.links import Resolver, iter_links
27
+ from ..core.messages import msg
28
+ from ..core.new_id import KINDS
29
+ from ..core.profile import DOC_FOLDERS, doc_place
30
+ from ..core.project import Project, git, git_out, move_path, nfc, read, write
31
+
32
+ SKIP_HOOKS = {"LANTERN_SKIP_HOOKS": "1"} # our own git hooks would check the commit we make
33
+
34
+
35
+ class LayoutError(RuntimeError):
36
+ """The documents can't be moved now; the message says why and what to do.
37
+
38
+ Example:
39
+ >>> str(LayoutError("변경 사항이 있습니다"))
40
+ '변경 사항이 있습니다'
41
+ """
42
+
43
+
44
+ @dataclass
45
+ class LayoutPlan:
46
+ """What it takes to bring the documents to the current layout.
47
+
48
+ Attributes:
49
+ moves: (from, to) document paths.
50
+ templates: (document, old value, new value) for a `template:` field that kept an old name.
51
+ links: (document, link as written, new link) for links that would break after the moves.
52
+ conflicts: Problems a person must settle (two documents with one id, a target already taken).
53
+ renamed_templates: (old, new) names of the project's template copies whose base template was renamed.
54
+
55
+ Example:
56
+ >>> LayoutPlan().empty, LayoutPlan(conflicts=["…"]).empty
57
+ (True, True)
58
+ """
59
+
60
+ moves: list[tuple[Path, Path]] = field(default_factory=list)
61
+ templates: list[tuple[Path, str, str]] = field(default_factory=list)
62
+ links: list[tuple[Path, str, str]] = field(default_factory=list)
63
+ conflicts: list[str] = field(default_factory=list)
64
+ renamed_templates: list[tuple[str, str]] = field(default_factory=list) # (old, new) template names, for the install record
65
+
66
+ @property
67
+ def empty(self) -> bool:
68
+ """Whether nothing needs to change (conflicts alone change nothing)."""
69
+ return not (self.moves or self.templates or self.links)
70
+
71
+
72
+ def fixed_places(project: Project) -> dict[str, tuple[str, str | None]]:
73
+ """Map each fixed document id to where it belongs and the template name it should record.
74
+
75
+ Ids come from the base templates (`id: CUR-deploy`) and, for generated documents, from the
76
+ modules that write them.
77
+
78
+ Args:
79
+ project: The project.
80
+
81
+ Returns:
82
+ id → (path from the documents root, template name or None for generated documents).
83
+
84
+ Example:
85
+ >>> fixed_places(project)["CUR-deploy"] # doctest: +SKIP
86
+ ('3. 현재 상태/배포 · 운영/배포.md', '배포')
87
+ """
88
+ from ..learn.debt import STATUS_DOC_ID
89
+ from ..report.principles_doc import DOC_ID as PRINCIPLES_ID
90
+ from ..work.scaffold import base_template_text
91
+
92
+ generated = {"principles": PRINCIPLES_ID, "debt-status": STATUS_DOC_ID}
93
+ names = project.names
94
+ out: dict[str, tuple[str, str | None]] = {}
95
+ for key in DOC_FOLDERS:
96
+ place = doc_place(names, key)
97
+ if key in generated:
98
+ out[generated[key]] = (place, None)
99
+ continue
100
+ template = names.doc(key.replace("-", "_"))
101
+ try:
102
+ doc_id = frontmatter.as_str(frontmatter.parse(base_template_text(template, project.profile.language)).meta.get("id"))
103
+ except FileNotFoundError:
104
+ continue
105
+ if doc_id and "${" not in doc_id:
106
+ out[doc_id] = (place, template)
107
+ return out
108
+
109
+
110
+ def _kind_folder(project: Project, doc_id: str) -> Path | None:
111
+ """The folder a numbered document (ADR-004 · IDEA-012 · D-007 · MTG-003) belongs in; None for other ids."""
112
+ for kind, spec in KINDS.items():
113
+ if kind != "work" and re.fullmatch(rf"{spec['prefix']}-\d+", doc_id):
114
+ return project.folder(str(spec["folder"]))
115
+ return None
116
+
117
+
118
+ def _documents(project: Project) -> list[Path]:
119
+ """Every Markdown document a person or lantern wrote — not templates, legacy originals (the legacy map is ours) or hidden folders."""
120
+ skip = {project.folder(k).resolve() for k in ("templates", "legacy")}
121
+ legacy_map = (project.docs / doc_place(project.names, "legacy-map")).resolve() # ours, though it sits with the originals
122
+ out = []
123
+ for p in sorted(project.docs.rglob("*.md")):
124
+ rel = p.relative_to(project.docs).parts
125
+ if any(part.startswith(".") for part in rel):
126
+ continue
127
+ if p.resolve() != legacy_map and any(s in p.resolve().parents for s in skip):
128
+ continue
129
+ out.append(p)
130
+ return out
131
+
132
+
133
+ def plan(project: Project) -> LayoutPlan:
134
+ """Compare where each document is with where the current layout puts it. Changes nothing.
135
+
136
+ Args:
137
+ project: The project.
138
+
139
+ Returns:
140
+ The moves, template values and links to change, and the conflicts to report.
141
+
142
+ Example:
143
+ >>> [(project.docs_rel(a), project.docs_rel(b)) for a, b in plan(project).moves] # doctest: +SKIP
144
+ [('3. 현재 상태/규칙 · 결정 기록/ADR-001 인증.md', '3. 현재 상태/결정 기록/ADR-001 인증.md')]
145
+ """
146
+ result = LayoutPlan()
147
+ if not project.docs.exists():
148
+ return result
149
+ places = fixed_places(project)
150
+ seen: dict[str, Path] = {}
151
+ docs = _documents(project)
152
+ for path in docs:
153
+ meta = frontmatter.parse(read(path)).meta
154
+ doc_id = frontmatter.as_str(meta.get("id"))
155
+ if doc_id in places:
156
+ place, template = places[doc_id]
157
+ if doc_id in seen:
158
+ result.conflicts.append(
159
+ msg(
160
+ "Two documents have id {id}: {a} · {b} — keep one",
161
+ id=doc_id,
162
+ a=project.docs_rel(seen[doc_id]),
163
+ b=project.docs_rel(path),
164
+ )
165
+ )
166
+ continue
167
+ seen[doc_id] = path
168
+ dest = project.docs / place
169
+ old_template = frontmatter.as_str(meta.get("template"))
170
+ if template and old_template and old_template != template:
171
+ result.templates.append((path, old_template, template))
172
+ elif (folder := _kind_folder(project, doc_id)) is not None:
173
+ dest = folder / path.name
174
+ else:
175
+ continue
176
+ if nfc(str(dest)) == nfc(str(path)):
177
+ continue
178
+ if dest.exists():
179
+ result.conflicts.append(
180
+ msg(
181
+ "{a} belongs at {b}, but a file is already there — merge them by hand",
182
+ a=project.docs_rel(path),
183
+ b=project.docs_rel(dest),
184
+ )
185
+ )
186
+ continue
187
+ result.moves.append((path, dest))
188
+ _plan_template_copies(project, places, result)
189
+ result.links = _link_changes(project, docs, dict(result.moves))
190
+ return result
191
+
192
+
193
+ def _plan_template_copies(project: Project, places: dict[str, tuple[str, str | None]], result: LayoutPlan) -> None:
194
+ """A template copy carries the same id as its documents: when its base template was renamed, rename the copy too."""
195
+ if not project.templates_dir.exists():
196
+ return
197
+ for path in sorted(project.templates_dir.glob("*.md")):
198
+ meta = frontmatter.parse(read(path)).meta
199
+ template = places.get(frontmatter.as_str(meta.get("id")), ("", None))[1]
200
+ if not template or nfc(path.stem) == nfc(template):
201
+ continue
202
+ dest = project.templates_dir / f"{template}.md"
203
+ if dest.exists():
204
+ result.conflicts.append(
205
+ msg(
206
+ "{a} belongs at {b}, but a file is already there — merge them by hand",
207
+ a=project.docs_rel(path),
208
+ b=project.docs_rel(dest),
209
+ )
210
+ )
211
+ continue
212
+ result.moves.append((path, dest))
213
+ result.renamed_templates.append((nfc(path.stem), template))
214
+ if frontmatter.as_str(meta.get("template")) not in ("", template):
215
+ result.templates.append((path, frontmatter.as_str(meta.get("template")), template))
216
+
217
+
218
+ def _link_changes(project: Project, docs: list[Path], moved: dict[Path, Path]) -> list[tuple[Path, str, str]]:
219
+ """Find the links a move would break and how to write them after it."""
220
+ if not moved:
221
+ return []
222
+ resolver = Resolver(project.docs)
223
+ root = resolver.root
224
+ moved_r = {a.resolve(): b for a, b in moved.items()}
225
+ out = []
226
+ for source in docs:
227
+ new_source = moved_r.get(source.resolve(), source)
228
+ for link in iter_links(read(source)):
229
+ target = resolver.resolve(link, source)
230
+ if target is None or target.resolve() == source.resolve():
231
+ continue
232
+ new_target = moved_r.get(target.resolve(), target)
233
+ if link.kind == "wiki":
234
+ if "/" not in link.target or (new_target == target and new_source == source):
235
+ continue # a bare name still finds the file (Obsidian looks it up by name)
236
+ rel = nfc(os.path.relpath(new_target.resolve(), root))
237
+ new_text = rel if link.target.lower().endswith(".md") else rel.removesuffix(".md")
238
+ else:
239
+ new_text = nfc(os.path.relpath(new_target, new_source.parent))
240
+ if nfc(new_text) == nfc(link.target) or link.target not in link.raw:
241
+ continue
242
+ out.append((source, link.raw, link.raw.replace(link.target, new_text, 1)))
243
+ return out
244
+
245
+
246
+ def describe(project: Project, result: LayoutPlan) -> list[str]:
247
+ """Write a plan for the user.
248
+
249
+ Args:
250
+ project: The project.
251
+ result: The plan.
252
+
253
+ Returns:
254
+ Lines: moves, template values, links, conflicts.
255
+
256
+ Example:
257
+ >>> describe(project, LayoutPlan()) # doctest: +SKIP
258
+ []
259
+ """
260
+ out = []
261
+ if result.moves:
262
+ out.append(msg("📦 {count} documents are not where the current layout puts them", count=len(result.moves)))
263
+ out += [f" {project.docs_rel(a)} → {project.docs_rel(b)}" for a, b in result.moves]
264
+ if result.templates:
265
+ out.append(msg("🏷 {count} documents record an old template name", count=len(result.templates)))
266
+ out += [f" {project.docs_rel(p)}: {a} → {b}" for p, a, b in result.templates]
267
+ if result.links:
268
+ sources = {p for p, _, _ in result.links}
269
+ out.append(msg("🔗 {count} links to rewrite in {docs} documents", count=len(result.links), docs=len(sources)))
270
+ out += [f" {project.docs_rel(p)}: {a} → {b}" for p, a, b in result.links[:20]]
271
+ if result.conflicts:
272
+ out.append(msg("⚠ Left for you to settle:"))
273
+ out += [f" {c}" for c in result.conflicts]
274
+ return out
275
+
276
+
277
+ def apply(project: Project, result: LayoutPlan) -> list[str]:
278
+ """Carry out a plan: rewrite links and template values, move with `git mv`, then commit once.
279
+
280
+ The documents' git (the docs worktree in local mode) must have nothing staged and no changes
281
+ under the documents root, so the commit holds only this change and one revert undoes it.
282
+
283
+ Args:
284
+ project: The project.
285
+ result: The plan from plan().
286
+
287
+ Returns:
288
+ What was done.
289
+
290
+ Raises:
291
+ LayoutError: The documents have uncommitted changes, or have never been committed.
292
+
293
+ Example:
294
+ >>> apply(project, plan(project)) # doctest: +SKIP
295
+ ['✔ 문서 5개를 옮겼습니다 (커밋 3f2a1c0)']
296
+ """
297
+ if result.empty:
298
+ return []
299
+ cwd = project.docs_git_cwd()
300
+ in_git = git(["rev-parse", "--git-dir"], cwd).returncode == 0
301
+ if in_git:
302
+ if git(["rev-parse", "--verify", "-q", "HEAD"], cwd).returncode != 0:
303
+ raise LayoutError(msg("The documents have never been committed — commit them once, then run lantern upgrade --apply again"))
304
+ staged = git_out(["diff", "--cached", "--name-only"], cwd)
305
+ dirty = git_out(["status", "--porcelain", "--", str(project.docs)], cwd)
306
+ if staged or dirty:
307
+ raise LayoutError(msg("Commit or stash the changes in the documents first, then run lantern upgrade --apply again"))
308
+ edits: dict[Path, str] = {}
309
+ for path, old, new in result.links:
310
+ text = edits.get(path, read(path))
311
+ edits[path] = text.replace(old, new)
312
+ for path, _, new in result.templates:
313
+ edits[path] = frontmatter.set_fields(edits.get(path, read(path)), {"template": new}, touch=False)
314
+ _rename_template_records(project, result, edits)
315
+ for path, text in edits.items():
316
+ write(path, text)
317
+ old_dirs = set()
318
+ for src, dest in result.moves:
319
+ move_path(project, src, dest)
320
+ old_dirs.add(src.parent)
321
+ for d in sorted(old_dirs, key=lambda p: len(p.parts), reverse=True): # leave no empty old folders behind
322
+ while d != project.docs and d.exists() and not any(d.iterdir()):
323
+ d.rmdir()
324
+ d = d.parent
325
+ out = [msg("✔ Moved {count} documents · rewrote {links} links", count=len(result.moves), links=len(result.links))]
326
+ if in_git:
327
+ git(["add", "-A", "--", str(project.docs)], cwd)
328
+ r = git(["commit", "-q", "-m", msg("docs: move documents to the current layout [lantern]")], cwd, env=SKIP_HOOKS)
329
+ if r.returncode == 0:
330
+ out.append(msg(" one commit {sha} — git revert {sha} undoes it", sha=git_out(["rev-parse", "--short", "HEAD"], cwd)))
331
+ return out
332
+
333
+
334
+ def _rename_template_records(project: Project, result: LayoutPlan, edits: dict[Path, str]) -> None:
335
+ """Carry each renamed template copy's install record over; an unedited copy stays unedited, so upgrade refreshes it."""
336
+ if not result.renamed_templates:
337
+ return
338
+ st = state.load(project)
339
+ records = st.setdefault("templates", {})
340
+ for old, new in result.renamed_templates:
341
+ rec = records.pop(old, None)
342
+ if rec is None:
343
+ continue
344
+ path = project.templates_dir / f"{old}.md"
345
+ if path in edits and rec.get("sha256") == state.sha256_text(read(path)):
346
+ rec["sha256"] = state.sha256_text(edits[path])
347
+ records[new] = rec
348
+ state.save(project, st)
@@ -7,12 +7,11 @@ Not here:
7
7
  from __future__ import annotations
8
8
 
9
9
  import re
10
- import shutil
11
10
  from pathlib import Path
12
11
 
13
12
  from ..core import sections
14
13
  from ..core.messages import msg
15
- from ..core.project import Project, git, git_out, nfc, read, write
14
+ from ..core.project import Project, move_path, nfc, read, write
16
15
 
17
16
  TODO_RE = re.compile(
18
17
  r"(TODO|FIXME|later|someday|to do|idea|needs? improv|나중에|추후|언젠가|해야 할|할 것|아이디어|개선 필요|- \[ \])", re.I
@@ -24,16 +23,6 @@ def _ours(project: Project) -> set:
24
23
  return tops | {nfc(project.names.file("moc")), ".git", ".obsidian"}
25
24
 
26
25
 
27
- def _move(project: Project, src: Path, dest: Path) -> None:
28
- dest.parent.mkdir(parents=True, exist_ok=True)
29
- tracked = bool(git_out(["ls-files", "--", str(src)], project.root))
30
- if tracked:
31
- r = git(["mv", str(src), str(dest)], project.root)
32
- if r.returncode == 0:
33
- return
34
- shutil.move(str(src), str(dest))
35
-
36
-
37
26
  def adopt(project: Project, source: Path | None = None) -> list[str]:
38
27
  """Move existing documents into `docs/5. 기존 문서/` (git mv keeps their history) and add them to the map.
39
28
 
@@ -61,14 +50,14 @@ def adopt(project: Project, source: Path | None = None) -> list[str]:
61
50
  if nfc(item.name) in ours or item.name.startswith("."):
62
51
  continue
63
52
  dest = legacy / item.name
64
- _move(project, item, dest)
53
+ move_path(project, item, dest)
65
54
  moved.append(project.rel(dest))
66
55
  else:
67
56
  src = source if source.is_absolute() else project.root / source
68
57
  if not src.exists():
69
58
  raise FileNotFoundError(msg("Not found: {source}", source=source))
70
59
  dest = legacy / src.name
71
- _move(project, src, dest)
60
+ move_path(project, src, dest)
72
61
  moved.append(project.rel(dest))
73
62
  legacy.mkdir(parents=True, exist_ok=True)
74
63
  add_map_rows(project)