lanternspec 0.2.4__tar.gz → 0.2.6__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 (221) hide show
  1. {lanternspec-0.2.4/src/lanternspec.egg-info → lanternspec-0.2.6}/PKG-INFO +20 -3
  2. {lanternspec-0.2.4 → lanternspec-0.2.6}/README.md +19 -2
  3. {lanternspec-0.2.4 → lanternspec-0.2.6}/pyproject.toml +1 -1
  4. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/check_docs.py +46 -0
  5. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/doctor.py +73 -1
  6. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/layout.py +2 -1
  7. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/__init__.py +2 -2
  8. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/core.py +2 -1
  9. lanternspec-0.2.6/src/lanternspec/cli/refs.py +335 -0
  10. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/names.py +7 -1
  11. lanternspec-0.2.6/src/lanternspec/core/outline.py +248 -0
  12. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/profile.py +39 -0
  13. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/project.py +21 -0
  14. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/state.py +9 -1
  15. lanternspec-0.2.6/src/lanternspec/refs/__init__.py +6 -0
  16. lanternspec-0.2.6/src/lanternspec/refs/domain.py +472 -0
  17. lanternspec-0.2.6/src/lanternspec/refs/index.py +556 -0
  18. lanternspec-0.2.6/src/lanternspec/refs/rules.py +260 -0
  19. lanternspec-0.2.6/src/lanternspec/refs/sources.py +285 -0
  20. lanternspec-0.2.6/src/lanternspec/refs/terms.py +452 -0
  21. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/agents/AGENTS.md +2 -0
  22. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-build/SKILL.md +3 -0
  23. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-design/SKILL.md +3 -0
  24. lanternspec-0.2.6/src/lanternspec/resources/locales/en/skills/l-domain/SKILL.md +38 -0
  25. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-plan/SKILL.md +6 -0
  26. lanternspec-0.2.6/src/lanternspec/resources/locales/en/skills/l-ref/SKILL.md +53 -0
  27. lanternspec-0.2.6/src/lanternspec/resources/locales/en/skills/l-ref/domain.md +27 -0
  28. lanternspec-0.2.6/src/lanternspec/resources/locales/en/skills/l-ref/rules.md +40 -0
  29. lanternspec-0.2.6/src/lanternspec/resources/locales/en/skills/l-ref/terms.md +31 -0
  30. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-task/SKILL.md +1 -0
  31. lanternspec-0.2.6/src/lanternspec/resources/locales/en/templates/Glossary.md +27 -0
  32. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Plan.md +6 -2
  33. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/agents/AGENTS.md +2 -0
  34. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-build/SKILL.md +3 -0
  35. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-design/SKILL.md +3 -0
  36. lanternspec-0.2.6/src/lanternspec/resources/locales/ko/skills/l-domain/SKILL.md +38 -0
  37. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-plan/SKILL.md +6 -0
  38. lanternspec-0.2.6/src/lanternspec/resources/locales/ko/skills/l-ref/SKILL.md +53 -0
  39. lanternspec-0.2.6/src/lanternspec/resources/locales/ko/skills/l-ref/domain.md +27 -0
  40. lanternspec-0.2.6/src/lanternspec/resources/locales/ko/skills/l-ref/rules.md +40 -0
  41. lanternspec-0.2.6/src/lanternspec/resources/locales/ko/skills/l-ref/terms.md +31 -0
  42. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-task/SKILL.md +1 -0
  43. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//352/270/260/355/232/215.md +6 -2
  44. lanternspec-0.2.6/src/lanternspec/resources/locales/ko/templates//354/232/251/354/226/264/354/247/221.md +27 -0
  45. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/messages.yaml +131 -0
  46. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/names.yaml +14 -1
  47. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/agent_hooks.py +89 -2
  48. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/base.py +3 -2
  49. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/claude.py +10 -3
  50. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/close.py +14 -1
  51. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/install.py +35 -3
  52. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/parts.py +23 -8
  53. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/rules.py +12 -8
  54. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/skills.py +2 -0
  55. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/scaffold.py +4 -0
  56. {lanternspec-0.2.4 → lanternspec-0.2.6/src/lanternspec.egg-info}/PKG-INFO +20 -3
  57. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec.egg-info/SOURCES.txt +21 -0
  58. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_checks.py +4 -4
  59. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_core.py +1 -1
  60. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_install_and_aux.py +26 -9
  61. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_layout.py +1 -0
  62. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_parts.py +33 -0
  63. lanternspec-0.2.6/tests/test_refs.py +468 -0
  64. {lanternspec-0.2.4 → lanternspec-0.2.6}/LICENSE +0 -0
  65. {lanternspec-0.2.4 → lanternspec-0.2.6}/setup.cfg +0 -0
  66. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/__init__.py +0 -0
  67. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/__main__.py +0 -0
  68. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/__init__.py +0 -0
  69. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/budget.py +0 -0
  70. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/githooks.py +0 -0
  71. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/legacy.py +0 -0
  72. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/check/templates.py +0 -0
  73. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/check.py +0 -0
  74. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/common.py +0 -0
  75. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/learn.py +0 -0
  76. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/report.py +0 -0
  77. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/tools.py +0 -0
  78. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/cli/work.py +0 -0
  79. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/__init__.py +0 -0
  80. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/enums.py +0 -0
  81. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/frontmatter.py +0 -0
  82. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/links.py +0 -0
  83. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/messages.py +0 -0
  84. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/meta.py +0 -0
  85. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/new_id.py +0 -0
  86. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/principles.py +0 -0
  87. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/sections.py +0 -0
  88. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/taskfile.py +0 -0
  89. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/core/templating.py +0 -0
  90. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/learn/__init__.py +0 -0
  91. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/learn/debt.py +0 -0
  92. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/learn/knowledge/__init__.py +0 -0
  93. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/learn/knowledge/drafts.py +0 -0
  94. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/learn/knowledge/mcp_server.py +0 -0
  95. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/learn/knowledge/notion.py +0 -0
  96. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/learn/knowledge/obsidian.py +0 -0
  97. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/__init__.py +0 -0
  98. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/doc_map.py +0 -0
  99. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/evaluate.py +0 -0
  100. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/harness.py +0 -0
  101. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/obsidian.py +0 -0
  102. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/principles_doc.py +0 -0
  103. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/resume.py +0 -0
  104. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/scan.py +0 -0
  105. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/sections_doc.py +0 -0
  106. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/status.py +0 -0
  107. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/report/views.py +0 -0
  108. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/__init__.py +0 -0
  109. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/conventions/go.yaml +0 -0
  110. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/conventions/python.yaml +0 -0
  111. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/conventions/rust.yaml +0 -0
  112. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/conventions/swift.yaml +0 -0
  113. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/conventions/typescript.yaml +0 -0
  114. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-adr/SKILL.md +0 -0
  115. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-check/SKILL.md +0 -0
  116. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-idea/SKILL.md +0 -0
  117. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-init/SKILL.md +0 -0
  118. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-learn/SKILL.md +0 -0
  119. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-map/SKILL.md +0 -0
  120. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-report/SKILL.md +0 -0
  121. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-resume/SKILL.md +0 -0
  122. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-sync/SKILL.md +0 -0
  123. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/skills/l-template/SKILL.md +0 -0
  124. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/ADR.md +0 -0
  125. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/API.md +0 -0
  126. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Architecture.md +0 -0
  127. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Collaboration Rules.md +0 -0
  128. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Competency Card.md +0 -0
  129. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Data.md +0 -0
  130. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Debt Card.md +0 -0
  131. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Deployment.md +0 -0
  132. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Design.md +0 -0
  133. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Docs MOC.md +0 -0
  134. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Feature List.md +0 -0
  135. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Idea.md +0 -0
  136. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Known Tech.md +0 -0
  137. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Legacy Map.md +0 -0
  138. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Log.md +0 -0
  139. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Meeting Notes.md +0 -0
  140. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Platform Integration.md +0 -0
  141. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Project Definition.md +0 -0
  142. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Screens.md +0 -0
  143. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Server Operations.md +0 -0
  144. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Session Log.md +0 -0
  145. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Tasks.md +0 -0
  146. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/Work Division Rules.md +0 -0
  147. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/en/templates/_meta/enums.yaml +0 -0
  148. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-adr/SKILL.md +0 -0
  149. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-check/SKILL.md +0 -0
  150. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-idea/SKILL.md +0 -0
  151. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-init/SKILL.md +0 -0
  152. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-learn/SKILL.md +0 -0
  153. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-map/SKILL.md +0 -0
  154. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-report/SKILL.md +0 -0
  155. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-resume/SKILL.md +0 -0
  156. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-sync/SKILL.md +0 -0
  157. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/skills/l-template/SKILL.md +0 -0
  158. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates/ADR.md +0 -0
  159. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates/API.md +0 -0
  160. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates/_meta/enums.yaml +0 -0
  161. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//352/260/234/353/260/234/353/254/270/354/204/234 MOC.md" +0 -0
  162. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//352/270/260/353/212/245 /353/252/251/353/241/235.md" +0 -0
  163. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//352/270/260/353/241/235.md" +0 -0
  164. {lanternspec-0.2.4 → lanternspec-0.2.6}/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
  165. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//353/215/260/354/235/264/355/204/260.md" +0 -0
  166. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//353/260/260/355/217/254.md" +0 -0
  167. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//353/266/200/354/261/204 /354/271/264/353/223/234.md" +0 -0
  168. {lanternspec-0.2.4 → lanternspec-0.2.6}/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
  169. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//354/204/244/352/263/204.md" +0 -0
  170. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//354/204/270/354/205/230 /352/270/260/353/241/235.md" +0 -0
  171. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//354/213/234/354/212/244/355/205/234 /352/265/254/354/241/260.md" +0 -0
  172. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//354/225/204/353/212/224 /352/270/260/354/210/240.md" +0 -0
  173. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//354/225/204/354/235/264/353/224/224/354/226/264.md" +0 -0
  174. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//354/227/255/353/237/211 /354/271/264/353/223/234.md" +0 -0
  175. {lanternspec-0.2.4 → lanternspec-0.2.6}/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" +0 -0
  176. {lanternspec-0.2.4 → lanternspec-0.2.6}/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
  177. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//355/224/214/353/236/253/355/217/274 /354/227/260/353/217/231.md" +0 -0
  178. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//355/225/240 /354/235/274.md" +0 -0
  179. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//355/230/221/354/227/205 /352/267/234/354/271/231.md" +0 -0
  180. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//355/231/224/353/251/264.md" +0 -0
  181. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/locales/ko/templates//355/232/214/354/235/230/353/241/235.md" +0 -0
  182. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/resources/principles.yaml +0 -0
  183. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/__init__.py +0 -0
  184. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/antigravity.py +0 -0
  185. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/codex.py +0 -0
  186. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/docs_mode.py +0 -0
  187. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/health.py +0 -0
  188. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/runlog.py +0 -0
  189. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/tools/sessions.py +0 -0
  190. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/__init__.py +0 -0
  191. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/branches.py +0 -0
  192. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/dbml.py +0 -0
  193. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/epic_rules.py +0 -0
  194. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/ideas.py +0 -0
  195. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/pack.py +0 -0
  196. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/progress.py +0 -0
  197. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/screen.py +0 -0
  198. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/stages.py +0 -0
  199. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec/work/tasks.py +0 -0
  200. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec.egg-info/dependency_links.txt +0 -0
  201. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec.egg-info/entry_points.txt +0 -0
  202. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec.egg-info/requires.txt +0 -0
  203. {lanternspec-0.2.4 → lanternspec-0.2.6}/src/lanternspec.egg-info/top_level.txt +0 -0
  204. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_budget.py +0 -0
  205. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_english.py +0 -0
  206. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_enums_single_source.py +0 -0
  207. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_git.py +0 -0
  208. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_later_features.py +0 -0
  209. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_learning_line.py +0 -0
  210. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_messages.py +0 -0
  211. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_name_overlap.py +0 -0
  212. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_names.py +0 -0
  213. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_obsidian.py +0 -0
  214. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_part_delivery.py +0 -0
  215. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_principles.py +0 -0
  216. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_principles_data.py +0 -0
  217. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_release_script.py +0 -0
  218. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_resume.py +0 -0
  219. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_skill_commands.py +0 -0
  220. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_tool_health.py +0 -0
  221. {lanternspec-0.2.4 → lanternspec-0.2.6}/tests/test_work_line.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lanternspec
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Spec-driven development for agentic software engineering
5
5
  Author: Jihyeok Jeong
6
6
  License-Expression: MIT
@@ -125,6 +125,8 @@ flowchart LR
125
125
  | `/l-map` | updates the MOC (document map) | `Docs MOC.md` |
126
126
  | `/l-adr` | records decisions that are hard to reverse | `Decisions/ADR-001 …` |
127
127
  | `/l-resume` | carries on an earlier conversation — from any AI tool, from where it stopped even if it was cut off | — |
128
+ | `/l-ref` | brings in company rules, glossaries and domain knowledge, indexes them by section and gets each section's use approved | the index, company rules in `AGENTS.md`, `Glossary.md` |
129
+ | `/l-domain` | when domain rules matter, finds the matching section in the index and reads just that section word for word | (the plan's "Domain Knowledge Used") |
128
130
 
129
131
  ### How it works
130
132
  - **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.
@@ -145,10 +147,11 @@ docs/
145
147
  ├─ 2. Work/W-001 …/ plan · design · tasks · log — the only place edited while working
146
148
  │ └─ Archive/ archive
147
149
  ├─ 3. Current State/ what the system looks like now — updated only when work is done, after approval
148
- │ └─ Rules/ · Decisions/ · Deployment and Operations/ …
150
+ │ └─ Rules/ · Decisions/ · Deployment and Operations/ · Glossary …
149
151
  ├─ 4. Operations/ reports · session logs · (teams of 2+) meeting notes
150
152
  ├─ 5. Legacy Docs/ (existing projects) original documents, kept unchanged
151
- └─ 📒 Debt/ understanding debt — one card per debt
153
+ ├─ 📒 Debt/ understanding debt — one card per debt
154
+ └─ 📚 Domain Knowledge/ laws · policies · business rules (the Domain Knowledge MOC shows the index)
152
155
  ```
153
156
 
154
157
  Which documents you get depends on your `/l-init` answers (`lantern.yaml`; check with `lantern profile docs`).
@@ -207,6 +210,19 @@ lantern hooks install # turns on the commit and push checks (/l-init
207
210
  lantern install --ci # also checks on GitHub (turn off with --no-ci)
208
211
  ```
209
212
 
213
+ ## References — company rules, terms and domain knowledge
214
+
215
+ Material people already have stays in its own form and is indexed by section, so the AI reads only the sections it needs (`/l-ref`). It can live inside the project or outside it (`~/…`).
216
+
217
+ | Material | When it is read | How |
218
+ |---|---|---|
219
+ | Company rules | always | each section's scope and strength are approved, then it goes word for word into the matching `AGENTS.md` |
220
+ | Terms | when needed | `lantern check` finds the glossary's "words to avoid" in the documents |
221
+ | Domain knowledge | only the section, only when needed | sections picked from the `📚 Domain Knowledge/` index are attached to a work's plan and read when their task starts |
222
+
223
+ - **Outside material never reaches git.** Its paths, titles and index all stay in `.lantern/`.
224
+ - **Sections are read by address.** `lantern ref read "Privacy#Retention period"`
225
+
210
226
  ## Managing unfamiliar tech — knowledge base and understanding debt
211
227
 
212
228
  When the AI uses a technology you don't know, LanternSpec compares it with the notes in your knowledge base and sorts it into three groups.
@@ -271,6 +287,7 @@ work task next [--all]|start|done|ac|list|estimate · task add [--parallel
271
287
  learning knowledge search|read|propose|write|areas · debt find|new|ask|resolve|promote|practice|known|status|list · mcp
272
288
  reports report [--views] [--summary] · status · resume [--session] [--more] · scan [--tests] · sync adopt · eval · obsidian plugins
273
289
  templates template list|lint|level|bump|outdated|diff|usage|new|migrate · legacy adopt|todos
290
+ references ref list|check|index|read · tag|exclude|rules · terms|term|glossary|candidate · domain|describe|attach
274
291
  git hooks install|uninstall|status · docs-mode local|shared
275
292
  wrap-up close <skill>
276
293
  ```
@@ -110,6 +110,8 @@ flowchart LR
110
110
  | `/l-map` | updates the MOC (document map) | `Docs MOC.md` |
111
111
  | `/l-adr` | records decisions that are hard to reverse | `Decisions/ADR-001 …` |
112
112
  | `/l-resume` | carries on an earlier conversation — from any AI tool, from where it stopped even if it was cut off | — |
113
+ | `/l-ref` | brings in company rules, glossaries and domain knowledge, indexes them by section and gets each section's use approved | the index, company rules in `AGENTS.md`, `Glossary.md` |
114
+ | `/l-domain` | when domain rules matter, finds the matching section in the index and reads just that section word for word | (the plan's "Domain Knowledge Used") |
113
115
 
114
116
  ### How it works
115
117
  - **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.
@@ -130,10 +132,11 @@ docs/
130
132
  ├─ 2. Work/W-001 …/ plan · design · tasks · log — the only place edited while working
131
133
  │ └─ Archive/ archive
132
134
  ├─ 3. Current State/ what the system looks like now — updated only when work is done, after approval
133
- │ └─ Rules/ · Decisions/ · Deployment and Operations/ …
135
+ │ └─ Rules/ · Decisions/ · Deployment and Operations/ · Glossary …
134
136
  ├─ 4. Operations/ reports · session logs · (teams of 2+) meeting notes
135
137
  ├─ 5. Legacy Docs/ (existing projects) original documents, kept unchanged
136
- └─ 📒 Debt/ understanding debt — one card per debt
138
+ ├─ 📒 Debt/ understanding debt — one card per debt
139
+ └─ 📚 Domain Knowledge/ laws · policies · business rules (the Domain Knowledge MOC shows the index)
137
140
  ```
138
141
 
139
142
  Which documents you get depends on your `/l-init` answers (`lantern.yaml`; check with `lantern profile docs`).
@@ -192,6 +195,19 @@ lantern hooks install # turns on the commit and push checks (/l-init
192
195
  lantern install --ci # also checks on GitHub (turn off with --no-ci)
193
196
  ```
194
197
 
198
+ ## References — company rules, terms and domain knowledge
199
+
200
+ Material people already have stays in its own form and is indexed by section, so the AI reads only the sections it needs (`/l-ref`). It can live inside the project or outside it (`~/…`).
201
+
202
+ | Material | When it is read | How |
203
+ |---|---|---|
204
+ | Company rules | always | each section's scope and strength are approved, then it goes word for word into the matching `AGENTS.md` |
205
+ | Terms | when needed | `lantern check` finds the glossary's "words to avoid" in the documents |
206
+ | Domain knowledge | only the section, only when needed | sections picked from the `📚 Domain Knowledge/` index are attached to a work's plan and read when their task starts |
207
+
208
+ - **Outside material never reaches git.** Its paths, titles and index all stay in `.lantern/`.
209
+ - **Sections are read by address.** `lantern ref read "Privacy#Retention period"`
210
+
195
211
  ## Managing unfamiliar tech — knowledge base and understanding debt
196
212
 
197
213
  When the AI uses a technology you don't know, LanternSpec compares it with the notes in your knowledge base and sorts it into three groups.
@@ -256,6 +272,7 @@ work task next [--all]|start|done|ac|list|estimate · task add [--parallel
256
272
  learning knowledge search|read|propose|write|areas · debt find|new|ask|resolve|promote|practice|known|status|list · mcp
257
273
  reports report [--views] [--summary] · status · resume [--session] [--more] · scan [--tests] · sync adopt · eval · obsidian plugins
258
274
  templates template list|lint|level|bump|outdated|diff|usage|new|migrate · legacy adopt|todos
275
+ references ref list|check|index|read · tag|exclude|rules · terms|term|glossary|candidate · domain|describe|attach
259
276
  git hooks install|uninstall|status · docs-mode local|shared
260
277
  wrap-up close <skill>
261
278
  ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "lanternspec"
7
- version = "0.2.4"
7
+ version = "0.2.6"
8
8
  description = "Spec-driven development for agentic software engineering"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -605,6 +605,9 @@ def check_file(project: Project, path: Path, text: str, ctx: _Ctx) -> list[Findi
605
605
  if tname and tname in ctx.templates.texts and not generated and not disabled:
606
606
  in_template = set(missing_sections(project, tname, ctx.templates.texts[tname]))
607
607
  for role in missing_sections(project, tname, text):
608
+ since = project.names.section(role).since
609
+ if since and semver(meta.get("template_version")) < semver(since): # made before the template had it
610
+ continue
608
611
  if role not in in_template:
609
612
  out.append(section_question(project, path, role, tname, rel, "section-missing"))
610
613
 
@@ -730,6 +733,48 @@ def _check_tasks(project: Project, path: Path, text: str, rel: str) -> list[Find
730
733
  return out
731
734
 
732
735
 
736
+ def term_findings(project: Project, paths: list[Path]) -> list[Finding]:
737
+ """Point out the glossary's words to avoid in documents (the glossary itself and generated documents aside).
738
+
739
+ Args:
740
+ project: The project.
741
+ paths: The documents to look at.
742
+
743
+ Returns:
744
+ One warning per line and word.
745
+
746
+ Example:
747
+ >>> term_findings(project, [path])[0].message # doctest: +SKIP
748
+ "'유저' 대신 '회원' (용어집)"
749
+ """
750
+ from ..refs import terms as terms_mod
751
+
752
+ terms, _ = terms_mod.merged(project)
753
+ if not any(t.avoid for t in terms):
754
+ return []
755
+ glossary = terms_mod.glossary_path(project).resolve()
756
+ out = []
757
+ for p in paths:
758
+ if p.resolve() == glossary:
759
+ continue
760
+ text = read(p)
761
+ if is_generated(frontmatter.parse(text).meta):
762
+ continue
763
+ for line, word, t in terms_mod.avoid_hits(text, terms):
764
+ where = msg("company glossary") if t.company else project.names.file("glossary")
765
+ out.append(
766
+ Finding(
767
+ "warn",
768
+ project.rel(p),
769
+ "avoid-term",
770
+ msg("'{word}' — use '{term}' ({where})", word=word, term=t.term, where=where),
771
+ line,
772
+ t.meaning or None,
773
+ )
774
+ )
775
+ return out
776
+
777
+
733
778
  class _Ctx:
734
779
  def __init__(self, project: Project) -> None:
735
780
  self.enums = project.enums
@@ -795,6 +840,7 @@ def run(project: Project, paths: Iterable[Path] | None = None, templates: bool =
795
840
  target_set = set(targets)
796
841
  for p in targets:
797
842
  findings += check_file(project, p, read(p), ctx)
843
+ findings += term_findings(project, targets)
798
844
  # duplicate ids need every doc, not only the targets
799
845
  if paths is not None:
800
846
  for p in all_docs:
@@ -97,6 +97,7 @@ def run(project: Project) -> list[tuple[str, str]]:
97
97
  if path.exists()
98
98
  else (BAD, msg("Knowledge store path doesn't exist: {path}", path=path))
99
99
  )
100
+ out += _reference_rows(project)
100
101
  st = state.load(project)
101
102
  if not st.get("version"):
102
103
  out.append((WARN, msg("Skills are not installed — lantern install")))
@@ -137,7 +138,7 @@ def _part_rows(project: Project) -> list[tuple[str, str]]:
137
138
  out = []
138
139
  found = statuses(project)
139
140
  open_ = [s.path for s in found if s.state == "new"]
140
- if open_ and sum(1 for s in found if s.state != "ignored") >= 2:
141
+ if open_ and sum(1 for s in found if s.state in ("added", "new")) >= 2:
141
142
  out.append(
142
143
  (
143
144
  WARN,
@@ -153,6 +154,77 @@ def _part_rows(project: Project) -> list[tuple[str, str]]:
153
154
  return out
154
155
 
155
156
 
157
+ def _reference_rows(project: Project) -> list[tuple[str, str]]:
158
+ """Check the references: missing paths, outside material in git, indexes behind their documents, exclusions matching nothing."""
159
+ from ..refs import index as index_mod
160
+ from ..refs import sources as src_mod
161
+
162
+ found = src_mod.sources(project)
163
+ excluded = [str(x) for x in project.profile.get("references.exclude") or []]
164
+ if not found and not excluded and not project.profile.get("references.outside_rules"):
165
+ return []
166
+ out = [(BAD, msg("references.{kind}: {path} doesn't exist", kind=s.kind, path=s.entry)) for s in found if not s.path.exists()]
167
+ for kind in src_mod.KINDS:
168
+ for entry in project.profile.get(f"references.{kind}") or []:
169
+ if (r := src_mod.resolve(project, str(entry))) and r.outside:
170
+ out.append(
171
+ (
172
+ WARN,
173
+ msg(
174
+ "references.{kind}: {path} is outside the project, but lantern.yaml goes into git — "
175
+ "lantern ref index {kind} {path} moves it to .lantern/",
176
+ kind=kind,
177
+ path=entry,
178
+ ),
179
+ )
180
+ )
181
+ private = index_mod.index_file(project, True)
182
+ if git(["ls-files", "--error-unmatch", str(private)], project.root).returncode == 0:
183
+ out.append(
184
+ (
185
+ BAD,
186
+ msg(
187
+ "{path} is in git — it holds the titles of material outside the project; git rm --cached it", path=project.rel(private)
188
+ ),
189
+ )
190
+ )
191
+ by_kind: dict[str, list[str]] = {}
192
+ for s in index_mod.stale(project):
193
+ by_kind.setdefault(s.document.source.kind, []).append(s.document.name + ("" if s.never else f" ({len(s.changed)})"))
194
+ for kind, docs in by_kind.items():
195
+ out.append((WARN, msg("{kind}: changed or never indexed since /l-ref: {items} — /l-ref {kind}", kind=kind, items=", ".join(docs))))
196
+ for address in excluded:
197
+ try:
198
+ src_mod.locate(project, address)
199
+ except LookupError:
200
+ out.append((WARN, msg("references.exclude: {address} matches no section any more (renamed?)", address=address)))
201
+ out += _company_rule_rows(project)
202
+ from ..refs.rules import MISSING, missing_outside
203
+
204
+ if missing_outside(project):
205
+ out.append((WARN, msg(MISSING)))
206
+ if found and not out:
207
+ out.append((OK, msg("References: {count} sources, indexes up to date", count=len(found))))
208
+ return out
209
+
210
+
211
+ def _company_rule_rows(project: Project) -> list[tuple[str, str]]:
212
+ """Say which AGENTS.md doesn't hold the approved company rules as they are now."""
213
+ from ..refs import rules as company
214
+ from ..tools.rules import active_parts
215
+
216
+ out = []
217
+ for place in ["", *(p["path"] for p in active_parts(project.profile))]:
218
+ path = project.root / place / "AGENTS.md"
219
+ want = company.agents_section(project, place)
220
+ if not want:
221
+ continue
222
+ have = read(path) if path.exists() else ""
223
+ if want not in have and company.agents_section(project, place, pointers=True) not in have:
224
+ out.append((WARN, msg("{path}: the company rules differ from the approved ones — lantern upgrade", path=project.rel(path))))
225
+ return out
226
+
227
+
156
228
  def unseen_note(files: list[str], tools: list[str]) -> str:
157
229
  """Say which folder AGENTS.md files some tools never get, and where to put what matters.
158
230
 
@@ -86,10 +86,11 @@ def fixed_places(project: Project) -> dict[str, tuple[str, str | None]]:
86
86
  ('3. 현재 상태/배포 · 운영/배포.md', '배포')
87
87
  """
88
88
  from ..learn.debt import STATUS_DOC_ID
89
+ from ..refs.domain import MOC_ID as DOMAIN_MOC_ID
89
90
  from ..report.principles_doc import DOC_ID as PRINCIPLES_ID
90
91
  from ..work.scaffold import base_template_text
91
92
 
92
- generated = {"principles": PRINCIPLES_ID, "debt-status": STATUS_DOC_ID}
93
+ generated = {"principles": PRINCIPLES_ID, "debt-status": STATUS_DOC_ID, "domain-moc": DOMAIN_MOC_ID}
93
94
  names = project.names
94
95
  out: dict[str, tuple[str, str | None]] = {}
95
96
  for key in DOC_FOLDERS:
@@ -11,10 +11,10 @@ import sys
11
11
 
12
12
  from .. import __version__
13
13
  from ..core.messages import msg
14
- from . import check, core, learn, report, tools, work
14
+ from . import check, core, learn, refs, report, tools, work
15
15
  from .common import CliError, Handler
16
16
 
17
- GROUPS = (tools, core, work, learn, report, check) # order of the help list
17
+ GROUPS = (tools, core, work, learn, refs, report, check) # order of the help list
18
18
 
19
19
 
20
20
  def build_parser() -> argparse.ArgumentParser:
@@ -141,7 +141,8 @@ def cmd_parts(a: argparse.Namespace) -> int:
141
141
  label = {"added": msg("part"), "ignored": msg("ignored"), "new": msg("not decided")}
142
142
  for s in found:
143
143
  why = ", ".join(s.evidence) or msg("no package file found any more")
144
- print(f" {s.path} ({', '.join(s.languages) or '-'}) · {label[s.state]} · {why}")
144
+ state = msg("inside part {path}", path=s.owner) if s.state == "inside" else label[s.state]
145
+ print(f" {s.path} ({', '.join(s.languages) or '-'}) · {state} · {why}")
145
146
  if any(s.state == "new" for s in found):
146
147
  print(msg("→ make it a part: lantern parts add <folder> · not a part: lantern parts ignore <folder>"))
147
148
  return 0
@@ -0,0 +1,335 @@
1
+ """References commands: ref (list · check · index · read · tag · exclude · rules · terms · term · glossary · candidate · domain …)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+
7
+ from ..core import outline
8
+ from ..core.messages import msg
9
+ from ..core.project import Project, read
10
+ from ..refs import index as index_mod
11
+ from ..refs import rules as rules_mod
12
+ from ..refs import sources as src_mod
13
+ from .common import Add, CliError, _p
14
+
15
+ READ_MAX_LINES = 300 # a longer section shows its sub-sections to pick from instead
16
+
17
+
18
+ def cmd_ref(a: argparse.Namespace) -> int:
19
+ """`lantern ref [list|check|index|read|tag|exclude|rules|…]` — references: listed · structure · index · read · approve · leave out."""
20
+ project = _p()
21
+ if a.action in (None, "list"):
22
+ return _list(project)
23
+ if a.action == "domain":
24
+ return _domain(project, a.work or "", a.task or "")
25
+ if a.action == "rules":
26
+ return _rules(project, a.arg or "", a.must)
27
+ if a.action == "terms":
28
+ from ..refs import terms as terms_mod
29
+
30
+ waiting = terms_mod.candidates(project)
31
+ if waiting:
32
+ print(msg("📘 Glossary candidates: {items}", items=", ".join(f"{c['term']} ({c['asked']})" for c in waiting)) + "\n")
33
+ print(
34
+ terms_mod.table(project)
35
+ or msg(
36
+ "No terms yet — fill in {doc} or bring a company glossary in with /l-ref terms",
37
+ doc=project.rel(terms_mod.glossary_path(project)),
38
+ )
39
+ )
40
+ return 0
41
+ if not a.arg:
42
+ raise CliError(msg("lantern ref {action} needs a path or an address", action=a.action))
43
+ if a.action == "check":
44
+ return _check(project, a.arg)
45
+ if a.action == "index":
46
+ if not a.path:
47
+ raise CliError(msg("lantern ref index <rules|terms|domain> <path>"))
48
+ return _index(project, a.arg, a.path)
49
+ if a.action == "tag":
50
+ return _tag(project, a.arg, a.scope or "", a.strength, a.off)
51
+ if a.action == "describe":
52
+ return _describe(project, a)
53
+ if a.action == "attach":
54
+ return _attach(project, a)
55
+ if a.action == "glossary":
56
+ from ..refs import terms as terms_mod
57
+
58
+ avoid = [w.strip() for w in (a.avoid or "").replace("·", ",").split(",") if w.strip()]
59
+ path = terms_mod.add_to_glossary(project, a.arg, a.meaning or "", avoid, a.scope or "")
60
+ print(msg("✔ Added to {path}: {term}", path=project.rel(path), term=a.arg))
61
+ return 0
62
+ if a.action == "candidate":
63
+ from ..refs import terms as terms_mod
64
+
65
+ if a.drop:
66
+ said = (
67
+ msg("✔ No longer a candidate: {term}", term=a.arg)
68
+ if terms_mod.drop_candidate(project, a.arg)
69
+ else msg("Not a candidate: {term}", term=a.arg)
70
+ )
71
+ else:
72
+ said = msg("✔ Glossary candidate: {term} ({count} asks)", term=a.arg, count=terms_mod.add_candidate(project, a.arg))
73
+ print(said)
74
+ return 0
75
+ if a.action == "term":
76
+ if not a.path:
77
+ raise CliError(msg('lantern ref term <glossary document> <term> --avoid "word, word" [--meaning "…"]'))
78
+ avoid = [] if a.off else [w for w in (a.avoid or "").replace("·", ",").split(",") if w.strip()]
79
+ name = index_mod.set_term(project, a.arg, a.path, [w.strip() for w in avoid], "" if a.off else a.meaning or "", a.scope or "")
80
+ print(
81
+ msg("✔ {doc}: {term} taken away", doc=name, term=a.path)
82
+ if a.off
83
+ else msg("✔ {doc}: {term} (avoid: {words})", doc=name, term=a.path, words=", ".join(avoid) or "-")
84
+ )
85
+ return 0
86
+ if a.action == "exclude":
87
+ changed = index_mod.exclude(project, a.arg, a.undo)
88
+ said = msg("✔ Brought back: {address}", address=a.arg) if a.undo else msg("✔ Left out of this project: {address}", address=a.arg)
89
+ print((said if changed else msg("Nothing to change: {address}", address=a.arg)) + (" → lantern upgrade" if changed else ""))
90
+ return 0
91
+ return _read(project, a.arg)
92
+
93
+
94
+ def _tag(project: Project, address: str, scope: str, strength: str, off: bool) -> int:
95
+ """Store an approved company rule's scope and strength (or take the approval away) and say what to run next."""
96
+ if off:
97
+ scope = ""
98
+ elif not scope:
99
+ raise CliError(msg("lantern ref tag <document#section> --scope <all|part|language> --strength <must|should>"))
100
+ full = index_mod.tag(project, address, scope, strength)
101
+ if scope:
102
+ print(msg("✔ {address}: {scope} · {strength}", address=full, scope=scope, strength=strength) + " → lantern upgrade")
103
+ else:
104
+ print(msg("✔ Approval taken away: {address}", address=full) + " → lantern upgrade")
105
+ return 0
106
+
107
+
108
+ def _describe(project: Project, a: argparse.Namespace) -> int:
109
+ """Store (or take away) what a domain-knowledge section is about and when to read it, then refresh the MOC."""
110
+ from ..refs import domain as domain_mod
111
+
112
+ keys = [w.strip() for w in (a.keys or "").replace("·", ",").split(",") if w.strip()]
113
+ what, when = ("", "") if a.off else (a.what or "", a.when or "")
114
+ if not a.off and not (what.strip() and when.strip()):
115
+ raise CliError(msg('lantern ref describe <document#section> --what "…" --when "…" [--keys "a, b"] [--verbatim]'))
116
+ full = index_mod.describe(project, a.arg, what, when, keys, a.verbatim)
117
+ domain_mod.write_moc(project)
118
+ print(msg("✔ Description taken away: {address}", address=full) if a.off else msg("✔ Described: {address}", address=full))
119
+ return 0
120
+
121
+
122
+ def _attach(project: Project, a: argparse.Namespace) -> int:
123
+ """Tie a domain-knowledge section to a work's tasks."""
124
+ from ..refs import domain as domain_mod
125
+
126
+ if not a.work:
127
+ raise CliError(msg('lantern ref attach <document#section> --work W-012 [--task T03] [--note "…"]'))
128
+ work = project.find_work(a.work, include_archive=False)
129
+ if work is None:
130
+ raise CliError(msg("Work {work_id} not found", work_id=a.work))
131
+ path = domain_mod.attach(project, work, a.arg, [a.task] if a.task else [], a.note or "")
132
+ print(msg("✔ Attached to {work_id}: {address} — written in {path}", work_id=a.work.upper(), address=a.arg, path=project.rel(path)))
133
+ return 0
134
+
135
+
136
+ def _domain(project: Project, work_id: str, task: str) -> int:
137
+ """Print the domain-knowledge index, or the sections one work (or task) uses, each with the command that reads it."""
138
+ from ..refs import domain as domain_mod
139
+
140
+ if not work_id:
141
+ print(
142
+ domain_mod.table(project)
143
+ or msg("No domain knowledge yet — put documents in {folder}, then /l-ref domain", folder=project.rel(project.folder("domain")))
144
+ )
145
+ return 0
146
+ work = project.find_work(work_id)
147
+ if work is None:
148
+ raise CliError(msg("Work {work_id} not found", work_id=work_id))
149
+ chosen = domain_mod.picks(project, work, task)
150
+ if not chosen:
151
+ print(msg("{work_id} uses no domain knowledge — lantern ref domain lists what there is", work_id=work_id.upper()))
152
+ return 0
153
+ print(msg("📚 Domain knowledge {work_id} uses — read each right before the task that needs it:", work_id=work_id.upper()))
154
+ for p in chosen:
155
+ known = domain_mod.find(project, p.address)
156
+ tail = " · ".join(x for x in (", ".join(p.tasks) or msg("whole work"), msg("📌 verbatim") if known and known.verbatim else "") if x)
157
+ print(f'- lantern ref read "{p.address}" — {tail}')
158
+ return 0
159
+
160
+
161
+ def _rules(project: Project, place: str, must: bool) -> int:
162
+ """Print the company rules kept outside the project for the root or one part, word for word."""
163
+ from ..tools.rules import active_parts
164
+
165
+ if place and place not in [p["path"] for p in active_parts(project.profile)]:
166
+ raise CliError(msg("{place} is not a part — lantern parts", place=place))
167
+ text = rules_mod.outside_rules(project, place, "must" if must else "")
168
+ if not text and rules_mod.missing_outside(project):
169
+ print(msg(rules_mod.MISSING))
170
+ return 1
171
+ print(text or msg("No company rules from outside the project on this computer — nothing to follow here"))
172
+ return 0
173
+
174
+
175
+ def _list(project: Project) -> int:
176
+ """Print every reference with its documents and whether its index is up to date."""
177
+ found = src_mod.sources(project)
178
+ if not found:
179
+ print(msg("No references yet — bring company rules · terms · domain knowledge in with /l-ref"))
180
+ return 0
181
+ behind = {s.document.path for s in index_mod.stale(project)}
182
+ for s in found:
183
+ where = msg("outside") if s.outside else msg("inside")
184
+ if not s.path.exists():
185
+ print(f"✖ {s.kind} {s.entry} ({where}) · " + msg("doesn't exist"))
186
+ continue
187
+ docs = src_mod.documents(project, s)
188
+ late = sum(1 for d in docs if d.path in behind)
189
+ state = msg("{count} not indexed or changed", count=late) if late else msg("indexed")
190
+ print(f"{'⚠' if late else '✔'} {s.kind} {s.entry} ({where}) · " + msg("{count} documents", count=len(docs)) + f" · {state}")
191
+ return 0
192
+
193
+
194
+ def _check(project: Project, path: str) -> int:
195
+ """Print the structure problems of a file or folder (it needn't be a reference yet)."""
196
+ found = src_mod.resolve(project, path)
197
+ if found is None or not found.path.exists():
198
+ raise CliError(msg("{path} doesn't exist", path=path))
199
+ docs = src_mod.documents(project, found)
200
+ if not docs:
201
+ raise CliError(msg("{path} holds no Markdown document — convert PDF · HWP to .md first (keep the original)", path=path))
202
+ bad = 0
203
+ for d in docs:
204
+ text = read(d.path)
205
+ problems = outline.problems(text)
206
+ if problems:
207
+ bad += 1
208
+ print(f"⚠ {d.shown}")
209
+ print("\n".join(f" - {p}" for p in problems))
210
+ else:
211
+ print(f"✔ {d.shown} · " + msg("{count} sections", count=len(outline.sections(text))))
212
+ return 1 if bad else 0
213
+
214
+
215
+ def _index(project: Project, kind: str, path: str) -> int:
216
+ """Index one source and say which sections are new · changed · gone (the skill tags only those)."""
217
+ r = index_mod.index(project, kind, path)
218
+ if kind == "domain" and not r.source.outside:
219
+ from ..refs.domain import write_moc
220
+
221
+ write_moc(project)
222
+ if r.registered and r.source.outside:
223
+ print(
224
+ msg(
225
+ "✔ Listed in {file} (outside material stays out of git): {kind} {path}",
226
+ file=project.rel(index_mod.index_file(project, True)),
227
+ kind=kind,
228
+ path=path,
229
+ )
230
+ )
231
+ elif r.registered:
232
+ print(msg("✔ Added to lantern.yaml references.{kind}: {path}", kind=kind, path=path))
233
+ if r.moved:
234
+ print(msg("✔ Taken out of lantern.yaml, which goes into git: references.{kind} {path}", kind=kind, path=path))
235
+ print(
236
+ msg(
237
+ "✔ {kind} {path}: {docs} documents · {sections} sections (new {added} · changed {changed} · gone {removed})",
238
+ kind=kind,
239
+ path=path,
240
+ docs=r.documents,
241
+ sections=r.sections,
242
+ added=len(r.added),
243
+ changed=len(r.changed),
244
+ removed=len(r.removed),
245
+ )
246
+ )
247
+ for mark, items in (("+", r.added), ("~", r.changed), ("-", r.removed)):
248
+ for item in items:
249
+ print(f" {mark} {item}")
250
+ return 0
251
+
252
+
253
+ def _read(project: Project, address: str) -> int:
254
+ """Print one section (or a whole document) of a reference; a long one lists its parts to read instead."""
255
+ doc, section = src_mod.locate(project, address)
256
+ text = read(doc.path)
257
+ body = (outline.cut(text, section) if section else text).rstrip("\n")
258
+ print(f"<!-- {doc.name}{' › ' + section.address if section else ''} ({doc.label}) -->")
259
+ if index_mod.changed_since_indexed(project, doc, section):
260
+ print(msg("⚠ Changed since it was indexed (or never indexed) — the index may be behind: /l-ref {kind}", kind=doc.source.kind))
261
+ if doc.source.kind == "domain":
262
+ from ..refs import domain as domain_mod
263
+
264
+ known = domain_mod.find(project, address) if section else None
265
+ if known and known.verbatim:
266
+ print(
267
+ msg("📌 Verbatim — numbers · deadlines · exceptions: follow these exact words, and read them again right before deciding")
268
+ )
269
+ domain_mod.record_read(project, f"{doc.name}#{section.address}" if section else doc.name, bool(known and known.verbatim))
270
+ parts = _parts(text, section)
271
+ if body.count("\n") + 1 > READ_MAX_LINES and parts:
272
+ print(msg("{count} lines — read one part:", count=body.count("\n") + 1))
273
+ for s in parts:
274
+ print(f' lantern ref read "{doc.name}#{s.address}" ' + msg("({count} lines)", count=s.end - s.start))
275
+ return 0
276
+ print(body)
277
+ return 0
278
+
279
+
280
+ def _parts(text: str, section: outline.Section | None) -> list[outline.Section]:
281
+ """The sections right below a section (or the top-level sections of a whole document, below its lone title)."""
282
+ inner = [s for s in outline.sections(text) if section is None or section.start < s.start < section.end]
283
+ top = min((s.level for s in inner), default=0)
284
+ parts = [s for s in inner if s.level == top]
285
+ return _parts(text, parts[0]) if section is None and len(parts) == 1 else parts
286
+
287
+
288
+ def register(add: Add) -> None:
289
+ """Register the references commands."""
290
+ p = add("ref", cmd_ref, msg("References (company rules · terms · domain knowledge): list · check · index · read"))
291
+ p.add_argument(
292
+ "action",
293
+ nargs="?",
294
+ choices=[
295
+ "list",
296
+ "check",
297
+ "index",
298
+ "read",
299
+ "tag",
300
+ "exclude",
301
+ "rules",
302
+ "terms",
303
+ "term",
304
+ "glossary",
305
+ "candidate",
306
+ "domain",
307
+ "describe",
308
+ "attach",
309
+ ],
310
+ )
311
+ p.add_argument(
312
+ "arg",
313
+ nargs="?",
314
+ help=msg(
315
+ "check: a file or folder · index: rules | terms | domain · read · tag · exclude: document#section · rules: a part (optional)"
316
+ ),
317
+ )
318
+ p.add_argument("path", nargs="?", help=msg("index: the file or folder to index (relative = inside, ~/… = outside) · term: the term"))
319
+ p.add_argument("--scope", help=msg("tag · term: where it applies — all, a part's folder or a language"))
320
+ p.add_argument("--strength", choices=list(rules_mod.STRENGTHS), default="must", help=msg("tag: must or should"))
321
+ p.add_argument("--off", action="store_true", help=msg("tag · term · describe: take it away"))
322
+ p.add_argument("--avoid", help=msg('term · glossary: words not to use for it, "word, word"'))
323
+ p.add_argument("--meaning", help=msg("term · glossary: what it means, in one line"))
324
+ p.add_argument("--undo", action="store_true", help=msg("exclude: bring it back"))
325
+ p.add_argument("--must", action="store_true", help=msg("rules: must rules only"))
326
+ p.add_argument("--drop", action="store_true", help=msg("candidate: not a project word — forget it"))
327
+ p.add_argument("--what", help=msg("describe: its topic only — never the rule itself"))
328
+ p.add_argument("--when", help=msg("describe: the situation to read it in"))
329
+ p.add_argument("--keys", help=msg('describe: its key terms, "word, word"'))
330
+ p.add_argument(
331
+ "--verbatim", action="store_true", help=msg("describe: numbers · deadlines · exceptions — read the exact words before deciding")
332
+ )
333
+ p.add_argument("--work", help=msg("domain · attach: the work, e.g. W-012"))
334
+ p.add_argument("--task", help=msg("domain · attach: the task, e.g. T03"))
335
+ p.add_argument("--note", help=msg("attach: what it is used for, in a few words"))