lanternspec 0.2.7__tar.gz → 0.2.9__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.
- {lanternspec-0.2.7/src/lanternspec.egg-info → lanternspec-0.2.9}/PKG-INFO +9 -6
- {lanternspec-0.2.7 → lanternspec-0.2.9}/README.md +8 -5
- {lanternspec-0.2.7 → lanternspec-0.2.9}/pyproject.toml +1 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/check_docs.py +12 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/doctor.py +14 -3
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/__init__.py +2 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/check.py +20 -9
- lanternspec-0.2.9/src/lanternspec/cli/color.py +98 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/refs.py +137 -2
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/report.py +6 -3
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/work.py +4 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/enums.py +40 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/meta.py +38 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/profile.py +13 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/project.py +5 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/learn/debt.py +63 -23
- lanternspec-0.2.9/src/lanternspec/refs/convert.py +809 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/refs/domain.py +2 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/refs/index.py +3 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/refs/sources.py +59 -3
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/doc_map.py +10 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/obsidian.py +32 -2
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/scan.py +12 -5
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/views.py +124 -61
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/conventions/go.yaml +2 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/conventions/python.yaml +4 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/conventions/typescript.yaml +4 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-domain/SKILL.md +1 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-idea/SKILL.md +10 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-plan/SKILL.md +1 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-ref/SKILL.md +2 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-ref/domain.md +14 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-report/SKILL.md +2 -2
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Competency Card.md +5 -4
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Idea.md +6 -2
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/_meta/enums.yaml +1 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-domain/SKILL.md +1 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-idea/SKILL.md +10 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-plan/SKILL.md +1 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-ref/SKILL.md +2 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-ref/domain.md +14 -1
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-report/SKILL.md +2 -2
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates/_meta/enums.yaml +1 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//354/225/204/354/235/264/353/224/224/354/226/264.md +6 -2
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//354/227/255/353/237/211 /354/271/264/353/223/234.md" +5 -4
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/messages.yaml +76 -9
- lanternspec-0.2.9/src/lanternspec/resources/obsidian/lantern-timeline/main.js +389 -0
- lanternspec-0.2.9/src/lanternspec/resources/obsidian/lantern-timeline/manifest.json +9 -0
- lanternspec-0.2.9/src/lanternspec/resources/obsidian/lantern-timeline/styles.css +68 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/install.py +45 -12
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/parts.py +25 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/ideas.py +67 -10
- {lanternspec-0.2.7 → lanternspec-0.2.9/src/lanternspec.egg-info}/PKG-INFO +9 -6
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec.egg-info/SOURCES.txt +6 -0
- lanternspec-0.2.9/tests/test_color.py +26 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_later_features.py +117 -2
- lanternspec-0.2.9/tests/test_obsidian.py +177 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_refs.py +157 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_work_line.py +62 -0
- lanternspec-0.2.7/tests/test_obsidian.py +0 -83
- {lanternspec-0.2.7 → lanternspec-0.2.9}/LICENSE +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/setup.cfg +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/__main__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/budget.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/githooks.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/layout.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/legacy.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/check/templates.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/common.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/core.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/learn.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/cli/tools.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/frontmatter.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/links.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/messages.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/names.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/new_id.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/outline.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/principles.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/sections.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/state.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/taskfile.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/core/templating.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/learn/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/learn/knowledge/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/learn/knowledge/drafts.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/learn/knowledge/mcp_server.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/learn/knowledge/notion.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/learn/knowledge/obsidian.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/refs/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/refs/rules.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/refs/terms.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/evaluate.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/harness.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/principles_doc.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/resume.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/sections_doc.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/report/status.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/conventions/rust.yaml +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/conventions/swift.yaml +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/agents/AGENTS.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-adr/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-build/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-check/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-design/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-init/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-learn/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-map/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-ref/rules.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-ref/terms.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-resume/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-sync/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-task/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/skills/l-template/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/ADR.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/API.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Architecture.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Collaboration Rules.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Data.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Debt Card.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Deployment.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Design.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Docs MOC.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Feature List.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Glossary.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Known Tech.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Legacy Map.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Log.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Meeting Notes.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Plan.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Platform Integration.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Project Definition.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Screens.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Server Operations.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Session Log.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Tasks.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/en/templates/Work Division Rules.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/agents/AGENTS.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-adr/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-build/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-check/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-design/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-init/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-learn/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-map/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-ref/rules.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-ref/terms.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-resume/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-sync/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-task/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/skills/l-template/SKILL.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates/ADR.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates/API.md +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//352/260/234/353/260/234/353/254/270/354/204/234 MOC.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//352/270/260/353/212/245 /353/252/251/353/241/235.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//352/270/260/353/241/235.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/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
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//352/270/260/355/232/215.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//353/215/260/354/235/264/355/204/260.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//353/260/260/355/217/254.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//353/266/200/354/261/204 /354/271/264/353/223/234.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/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
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//354/204/244/352/263/204.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//354/204/270/354/205/230 /352/270/260/353/241/235.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//354/213/234/354/212/244/355/205/234 /352/265/254/354/241/260.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//354/225/204/353/212/224 /352/270/260/354/210/240.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//354/232/251/354/226/264/354/247/221.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/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
- {lanternspec-0.2.7 → lanternspec-0.2.9}/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
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//355/224/214/353/236/253/355/217/274 /354/227/260/353/217/231.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//355/225/240 /354/235/274.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//355/230/221/354/227/205 /352/267/234/354/271/231.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//355/231/224/353/251/264.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/locales/ko/templates//355/232/214/354/235/230/353/241/235.md" +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/names.yaml +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/resources/principles.yaml +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/agent_hooks.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/antigravity.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/base.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/claude.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/close.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/codex.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/docs_mode.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/health.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/rules.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/runlog.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/sessions.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/tools/skills.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/__init__.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/branches.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/dbml.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/epic_rules.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/pack.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/progress.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/scaffold.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/screen.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/stages.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec/work/tasks.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec.egg-info/dependency_links.txt +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec.egg-info/entry_points.txt +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec.egg-info/requires.txt +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/src/lanternspec.egg-info/top_level.txt +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_budget.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_checks.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_core.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_english.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_enums_single_source.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_git.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_install_and_aux.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_layout.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_learning_line.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_messages.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_name_overlap.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_names.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_part_delivery.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_parts.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_principles.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_principles_data.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_release_script.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_resume.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_skill_commands.py +0 -0
- {lanternspec-0.2.7 → lanternspec-0.2.9}/tests/test_tool_health.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lanternspec
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Spec-driven development for agentic software engineering
|
|
5
5
|
Author: Jihyeok Jeong
|
|
6
6
|
License-Expression: MIT
|
|
@@ -165,6 +165,7 @@ Sections lantern reads and writes (protected sections, such as "Now" in a log) m
|
|
|
165
165
|
|
|
166
166
|
### Viewing the docs in Obsidian
|
|
167
167
|
Open the `docs/` folder as a vault in Obsidian and it is already set up for reading (`docs/.obsidian/`).
|
|
168
|
+
`lantern obsidian plugins` also adds Lantern Timeline, which shows the report's timeline as bars by day. Drag a task that has not started to move it, or drag its ends to change its length; the dates are saved in its planned and due attributes.
|
|
168
169
|
|
|
169
170
|
- **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.
|
|
170
171
|
- **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.
|
|
@@ -222,6 +223,7 @@ Material people already have stays in its own form and is indexed by section, so
|
|
|
222
223
|
|
|
223
224
|
- **Outside material never reaches git.** Its paths, titles and index all stay in `.lantern/`.
|
|
224
225
|
- **Sections are read by address.** `lantern ref read "Privacy#Retention period"`
|
|
226
|
+
- **Originals are read through copies.** `lantern ref convert --apply` turns PDF · Word · PowerPoint · HWP into Markdown cut into sections, and Excel · CSV into a card of sheets, columns and row counts, next to the original. It marks the quality too (HWP without headings or tables is "check it", a scanned PDF "no text"). PDF needs `pdftotext` (poppler).
|
|
225
227
|
|
|
226
228
|
## Managing unfamiliar tech — knowledge base and understanding debt
|
|
227
229
|
|
|
@@ -245,7 +247,7 @@ There are three kinds of debt.
|
|
|
245
247
|
| Kind | Meaning |
|
|
246
248
|
|---|---|
|
|
247
249
|
| 🧠 Understanding | you follow it when it's explained, but it isn't yours yet. Reopened if you ask again after resolving it |
|
|
248
|
-
| 🛠 Competency | you understand it but haven't done it yourself. Practised with exercises (`lantern debt promote`) |
|
|
250
|
+
| 🛠 Competency | you understand it but haven't done it yourself, or a blocked idea needs it. Practised with exercises (`lantern debt promote`) |
|
|
249
251
|
| 🧱 Technical | debt left in the code (technical debt) |
|
|
250
252
|
|
|
251
253
|
## Design principles and ways of working
|
|
@@ -259,7 +261,8 @@ Picks design principles and code conventions from a table, based on the project
|
|
|
259
261
|
- In existing projects, lint and format settings already in use are recorded, never changed.
|
|
260
262
|
- When the code grows past a size boundary, `lantern doctor` asks whether to raise the principles one level.
|
|
261
263
|
- The language of code comments can be set apart from the documents with `project.comment_language`.
|
|
262
|
-
- See the result with `lantern principles show`; run lint and type checks with `lantern lint`
|
|
264
|
+
- See the result with `lantern principles show`; run lint and type checks with `lantern lint` (in each part's folder when there are parts)
|
|
265
|
+
- CI (`lantern install --ci`) prepares tools and checks in each part's folder. Leave a heavy part out with `ci: false` on that part in `lantern.yaml`. In existing projects, lint and type errors only warn at first and CI passes; once they are clean, set `build.ci_lint: block`.
|
|
263
266
|
|
|
264
267
|
### How the AI works
|
|
265
268
|
`lantern harness suggest` looks at code size, work in progress, whether tests exist and past runs, and recommends one of three modes.
|
|
@@ -281,13 +284,13 @@ Import mockups with `lantern screen import`; `lantern screen compare` finds wher
|
|
|
281
284
|
setup install [--language] [--tools] [--mcp] [--ci|--no-ci] · upgrade [--apply] · doctor · harness suggest
|
|
282
285
|
profile profile show|docs|write|set · principles show|detect · parts [add|ignore] · enums list|rename · sections list|rename|off|on
|
|
283
286
|
documents scaffold init [--plan] | work | doc | idea | adr | meeting | custom · new-id · map · meta get|set
|
|
284
|
-
checks check [--changed] [--epic W-012] · lint · check-dbml · dbml render|from-sql|diff
|
|
287
|
+
checks check [--changed] [--epic W-012] · lint [--ci] · check-dbml · dbml render|from-sql|diff
|
|
285
288
|
work task next [--all]|start|done|ac|list|estimate · task add [--parallel] · pack · screen import|compare
|
|
286
289
|
work branch|start|list|finish|archive|stage · design approve · unit-log add · idea find|status
|
|
287
290
|
learning knowledge search|read|propose|write|areas · debt find|new|ask|resolve|promote|practice|known|status|list · mcp
|
|
288
|
-
reports report [--views] [--summary] · status · resume [--session] [--more] · scan [--tests] · sync adopt · eval · obsidian plugins
|
|
291
|
+
reports report [--views] [--summary] · status · resume [--session] [--more] · scan [--tests] [--ci] · sync adopt · eval · obsidian plugins
|
|
289
292
|
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
|
|
293
|
+
references ref list|check|index|read · tag|exclude|rules · terms|term|glossary|candidate · domain|describe|attach · convert [--apply]|preview
|
|
291
294
|
git hooks install|uninstall|status · docs-mode local|shared
|
|
292
295
|
wrap-up close <skill>
|
|
293
296
|
```
|
|
@@ -150,6 +150,7 @@ Sections lantern reads and writes (protected sections, such as "Now" in a log) m
|
|
|
150
150
|
|
|
151
151
|
### Viewing the docs in Obsidian
|
|
152
152
|
Open the `docs/` folder as a vault in Obsidian and it is already set up for reading (`docs/.obsidian/`).
|
|
153
|
+
`lantern obsidian plugins` also adds Lantern Timeline, which shows the report's timeline as bars by day. Drag a task that has not started to move it, or drag its ends to change its length; the dates are saved in its planned and due attributes.
|
|
153
154
|
|
|
154
155
|
- **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.
|
|
155
156
|
- **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.
|
|
@@ -207,6 +208,7 @@ Material people already have stays in its own form and is indexed by section, so
|
|
|
207
208
|
|
|
208
209
|
- **Outside material never reaches git.** Its paths, titles and index all stay in `.lantern/`.
|
|
209
210
|
- **Sections are read by address.** `lantern ref read "Privacy#Retention period"`
|
|
211
|
+
- **Originals are read through copies.** `lantern ref convert --apply` turns PDF · Word · PowerPoint · HWP into Markdown cut into sections, and Excel · CSV into a card of sheets, columns and row counts, next to the original. It marks the quality too (HWP without headings or tables is "check it", a scanned PDF "no text"). PDF needs `pdftotext` (poppler).
|
|
210
212
|
|
|
211
213
|
## Managing unfamiliar tech — knowledge base and understanding debt
|
|
212
214
|
|
|
@@ -230,7 +232,7 @@ There are three kinds of debt.
|
|
|
230
232
|
| Kind | Meaning |
|
|
231
233
|
|---|---|
|
|
232
234
|
| 🧠 Understanding | you follow it when it's explained, but it isn't yours yet. Reopened if you ask again after resolving it |
|
|
233
|
-
| 🛠 Competency | you understand it but haven't done it yourself. Practised with exercises (`lantern debt promote`) |
|
|
235
|
+
| 🛠 Competency | you understand it but haven't done it yourself, or a blocked idea needs it. Practised with exercises (`lantern debt promote`) |
|
|
234
236
|
| 🧱 Technical | debt left in the code (technical debt) |
|
|
235
237
|
|
|
236
238
|
## Design principles and ways of working
|
|
@@ -244,7 +246,8 @@ Picks design principles and code conventions from a table, based on the project
|
|
|
244
246
|
- In existing projects, lint and format settings already in use are recorded, never changed.
|
|
245
247
|
- When the code grows past a size boundary, `lantern doctor` asks whether to raise the principles one level.
|
|
246
248
|
- The language of code comments can be set apart from the documents with `project.comment_language`.
|
|
247
|
-
- See the result with `lantern principles show`; run lint and type checks with `lantern lint`
|
|
249
|
+
- See the result with `lantern principles show`; run lint and type checks with `lantern lint` (in each part's folder when there are parts)
|
|
250
|
+
- CI (`lantern install --ci`) prepares tools and checks in each part's folder. Leave a heavy part out with `ci: false` on that part in `lantern.yaml`. In existing projects, lint and type errors only warn at first and CI passes; once they are clean, set `build.ci_lint: block`.
|
|
248
251
|
|
|
249
252
|
### How the AI works
|
|
250
253
|
`lantern harness suggest` looks at code size, work in progress, whether tests exist and past runs, and recommends one of three modes.
|
|
@@ -266,13 +269,13 @@ Import mockups with `lantern screen import`; `lantern screen compare` finds wher
|
|
|
266
269
|
setup install [--language] [--tools] [--mcp] [--ci|--no-ci] · upgrade [--apply] · doctor · harness suggest
|
|
267
270
|
profile profile show|docs|write|set · principles show|detect · parts [add|ignore] · enums list|rename · sections list|rename|off|on
|
|
268
271
|
documents scaffold init [--plan] | work | doc | idea | adr | meeting | custom · new-id · map · meta get|set
|
|
269
|
-
checks check [--changed] [--epic W-012] · lint · check-dbml · dbml render|from-sql|diff
|
|
272
|
+
checks check [--changed] [--epic W-012] · lint [--ci] · check-dbml · dbml render|from-sql|diff
|
|
270
273
|
work task next [--all]|start|done|ac|list|estimate · task add [--parallel] · pack · screen import|compare
|
|
271
274
|
work branch|start|list|finish|archive|stage · design approve · unit-log add · idea find|status
|
|
272
275
|
learning knowledge search|read|propose|write|areas · debt find|new|ask|resolve|promote|practice|known|status|list · mcp
|
|
273
|
-
reports report [--views] [--summary] · status · resume [--session] [--more] · scan [--tests] · sync adopt · eval · obsidian plugins
|
|
276
|
+
reports report [--views] [--summary] · status · resume [--session] [--more] · scan [--tests] [--ci] · sync adopt · eval · obsidian plugins
|
|
274
277
|
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
|
|
278
|
+
references ref list|check|index|read · tag|exclude|rules · terms|term|glossary|candidate · domain|describe|attach · convert [--apply]|preview
|
|
276
279
|
git hooks install|uninstall|status · docs-mode local|shared
|
|
277
280
|
wrap-up close <skill>
|
|
278
281
|
```
|
|
@@ -622,6 +622,18 @@ def check_file(project: Project, path: Path, text: str, ctx: _Ctx) -> list[Findi
|
|
|
622
622
|
):
|
|
623
623
|
out.append(Finding("warn", rel, "dropped-reason", msg("A dropped idea needs a one-line reason (dropped_reason)"), 1))
|
|
624
624
|
|
|
625
|
+
# idea: blocked says why and what would reopen it
|
|
626
|
+
if (
|
|
627
|
+
doc_type == "idea"
|
|
628
|
+
and meta.get("status") == project.enums["idea_status"].roles.get("blocked")
|
|
629
|
+
and not (str(meta.get("blocked_reason") or "").strip() and str(meta.get("revisit_when") or "").strip())
|
|
630
|
+
):
|
|
631
|
+
out.append(
|
|
632
|
+
Finding(
|
|
633
|
+
"warn", rel, "blocked-reason", msg("A blocked idea needs why (blocked_reason) and what would reopen it (revisit_when)"), 1
|
|
634
|
+
)
|
|
635
|
+
)
|
|
636
|
+
|
|
625
637
|
# tasks
|
|
626
638
|
if doc_type == "tasks":
|
|
627
639
|
out += _check_tasks(project, path, text, rel)
|
|
@@ -161,8 +161,9 @@ def _reference_rows(project: Project) -> list[tuple[str, str]]:
|
|
|
161
161
|
|
|
162
162
|
found = src_mod.sources(project)
|
|
163
163
|
excluded = [str(x) for x in project.profile.get("references.exclude") or []]
|
|
164
|
+
waiting = src_mod.pending(project)
|
|
164
165
|
if not found and not excluded and not project.profile.get("references.outside_rules"):
|
|
165
|
-
return []
|
|
166
|
+
return [(WARN, "domain: " + waiting)] if waiting else []
|
|
166
167
|
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
168
|
for kind in src_mod.KINDS:
|
|
168
169
|
for entry in project.profile.get(f"references.{kind}") or []:
|
|
@@ -193,6 +194,8 @@ def _reference_rows(project: Project) -> list[tuple[str, str]]:
|
|
|
193
194
|
by_kind.setdefault(s.document.source.kind, []).append(s.document.name + ("" if s.never else f" ({len(s.changed)})"))
|
|
194
195
|
for kind, docs in by_kind.items():
|
|
195
196
|
out.append((WARN, msg("{kind}: changed or never indexed since /l-ref: {items} — /l-ref {kind}", kind=kind, items=", ".join(docs))))
|
|
197
|
+
if waiting:
|
|
198
|
+
out.append((WARN, "domain: " + waiting))
|
|
196
199
|
for address in excluded:
|
|
197
200
|
try:
|
|
198
201
|
src_mod.locate(project, address)
|
|
@@ -391,10 +394,18 @@ def format_result(rows: list[tuple[str, str]]) -> str:
|
|
|
391
394
|
>>> print(format_result([(OK, "lantern.yaml 형식"), (WARN, "MOC가 없습니다 — lantern map")]))
|
|
392
395
|
✔ lantern.yaml 형식
|
|
393
396
|
⚠ MOC가 없습니다 — lantern map
|
|
394
|
-
|
|
397
|
+
⚠ 문제 0개 · 경고 1개
|
|
395
398
|
"""
|
|
396
399
|
bad = sum(1 for r in rows if r[0] == BAD)
|
|
397
400
|
warn = sum(1 for r in rows if r[0] == WARN)
|
|
398
401
|
lines = [f"{icon} {text}" for icon, text in rows]
|
|
399
|
-
lines.append(
|
|
402
|
+
lines.append(
|
|
403
|
+
""
|
|
404
|
+
if not rows
|
|
405
|
+
else (
|
|
406
|
+
msg("✔ All good")
|
|
407
|
+
if not bad and not warn
|
|
408
|
+
else msg("{mark} {bad} problems · {warn} warnings", mark=BAD if bad else WARN, bad=bad, warn=warn)
|
|
409
|
+
)
|
|
410
|
+
)
|
|
400
411
|
return "\n".join(lines).rstrip()
|
|
@@ -11,7 +11,7 @@ import sys
|
|
|
11
11
|
|
|
12
12
|
from .. import __version__
|
|
13
13
|
from ..core.messages import msg
|
|
14
|
-
from . import check, core, learn, refs, report, tools, work
|
|
14
|
+
from . import check, color, core, learn, refs, report, tools, work
|
|
15
15
|
from .common import CliError, Handler
|
|
16
16
|
|
|
17
17
|
GROUPS = (tools, core, work, learn, refs, report, check) # order of the help list
|
|
@@ -64,6 +64,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
64
64
|
if len(argv) >= 2 and argv[0] == "task" and argv[1] == "add":
|
|
65
65
|
argv = ["task-add", *argv[2:]]
|
|
66
66
|
_use_project_language()
|
|
67
|
+
color.enable()
|
|
67
68
|
parser = build_parser()
|
|
68
69
|
a = parser.parse_args(argv)
|
|
69
70
|
if not getattr(a, "fn", None):
|
|
@@ -141,23 +141,33 @@ def cmd_doctor(a: argparse.Namespace) -> int:
|
|
|
141
141
|
|
|
142
142
|
|
|
143
143
|
def cmd_lint(a: argparse.Namespace) -> int:
|
|
144
|
-
"""`lantern lint` — run build.lint and build.typecheck
|
|
144
|
+
"""`lantern lint` — run the lint and type-check commands of each part, or build.lint and build.typecheck (/l-build · CI)."""
|
|
145
145
|
from ..report.scan import run_tests
|
|
146
|
+
from ..tools.parts import commands
|
|
146
147
|
|
|
147
148
|
project = _p()
|
|
148
|
-
cmds = [(role,
|
|
149
|
-
if not
|
|
149
|
+
cmds = [(role, part, cmd) for role in ("lint", "typecheck") for part, cmd in commands(project, role, ci=a.ci)]
|
|
150
|
+
if not cmds:
|
|
150
151
|
print(msg("ℹ No build.lint · build.typecheck, so skipped (lantern principles detect --write)"))
|
|
151
152
|
return 0
|
|
153
|
+
warn_only = a.ci and project.profile.ci_lint == "warn"
|
|
152
154
|
failed = 0
|
|
153
|
-
for role, cmd in cmds:
|
|
154
|
-
if
|
|
155
|
-
|
|
156
|
-
res
|
|
157
|
-
print(f"{'✔' if res['ok'] else '✖'} {role}: `{cmd}`")
|
|
155
|
+
for role, part, cmd in cmds:
|
|
156
|
+
res = run_tests(project, cmd, project.root / part if part else None)
|
|
157
|
+
where = f"{part} · " if part else ""
|
|
158
|
+
print(f"{'✔' if res['ok'] else '⚠' if warn_only else '✖'} {where}{role}: `{cmd}`")
|
|
158
159
|
if not res["ok"]:
|
|
159
160
|
failed += 1
|
|
160
161
|
print(res["tail"])
|
|
162
|
+
if warn_only: # a passing step hides its log, so GitHub Actions shows this on the run's page
|
|
163
|
+
print(f"::warning::{where}{role}: {cmd}")
|
|
164
|
+
if warn_only and failed:
|
|
165
|
+
print(
|
|
166
|
+
msg(
|
|
167
|
+
"⚠ {count} checks failed, but CI passes (build.ci_lint: warn) — once they are clean, set build.ci_lint: block", count=failed
|
|
168
|
+
)
|
|
169
|
+
)
|
|
170
|
+
return 0
|
|
161
171
|
return 1 if failed else 0
|
|
162
172
|
|
|
163
173
|
|
|
@@ -170,7 +180,8 @@ def register(add: Add) -> None:
|
|
|
170
180
|
p.add_argument("--json", action="store_true")
|
|
171
181
|
p.add_argument("--quiet", action="store_true", help=msg("Hide notes (ℹ)"))
|
|
172
182
|
p.add_argument("--strict", action="store_true", help=msg("Treat warnings as failures"))
|
|
173
|
-
add("lint", cmd_lint, msg("Code lint · type check (lantern.yaml build.lint · build.typecheck)"))
|
|
183
|
+
p = add("lint", cmd_lint, msg("Code lint · type check (each part's commands, or lantern.yaml build.lint · build.typecheck)"))
|
|
184
|
+
p.add_argument("--ci", action="store_true", help=msg("For CI: leave out parts with ci: false, and follow build.ci_lint"))
|
|
174
185
|
p = add("template", cmd_template, msg("Templates: list · lint · level · bump · outdated · diff · usage · new · migrate"))
|
|
175
186
|
p.add_argument("action", choices=["list", "lint", "level", "bump", "outdated", "diff", "usage", "new", "migrate"])
|
|
176
187
|
p.add_argument("name", nargs="?")
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Color the status marks (✔ ⚠ ✖ ℹ) of command output on a terminal.
|
|
2
|
+
|
|
3
|
+
Responsibilities:
|
|
4
|
+
- pick a color for a line from the mark it starts with
|
|
5
|
+
- wrap stdout · stderr so every print gets colored, only on a terminal and without NO_COLOR
|
|
6
|
+
|
|
7
|
+
Not here:
|
|
8
|
+
- which mark a line gets → the command or the check that writes it
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
from typing import Any, TextIO
|
|
16
|
+
|
|
17
|
+
RESET = "\033[0m"
|
|
18
|
+
WHOLE_LINE = {"✖": "\033[31m", "⚠": "\033[33m"} # problems and warnings: the whole line stands out
|
|
19
|
+
MARK_ONLY = {"✔": "\033[32m", "ℹ": "\033[36m"} # fine and notes: only the mark, so the text stays calm
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def paint(line: str) -> str:
|
|
23
|
+
r"""Color one output line by the mark it starts with (after its indentation).
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
line: One line without its newline.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
The line with ANSI colors; unchanged when it starts with no mark.
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
>>> paint("⚠ hook이 실행되지 않았습니다")
|
|
33
|
+
'\x1b[33m⚠ hook이 실행되지 않았습니다\x1b[0m'
|
|
34
|
+
>>> paint(" ✔ 양식에 맞음")
|
|
35
|
+
' \x1b[32m✔\x1b[0m 양식에 맞음'
|
|
36
|
+
>>> paint("📄 docs/기획.md")
|
|
37
|
+
'📄 docs/기획.md'
|
|
38
|
+
"""
|
|
39
|
+
text = line.lstrip(" ")
|
|
40
|
+
pad = line[: len(line) - len(text)]
|
|
41
|
+
mark = text[:1]
|
|
42
|
+
if mark in WHOLE_LINE:
|
|
43
|
+
return f"{pad}{WHOLE_LINE[mark]}{text}{RESET}"
|
|
44
|
+
if mark in MARK_ONLY:
|
|
45
|
+
return f"{pad}{MARK_ONLY[mark]}{mark}{RESET}{text[1:]}"
|
|
46
|
+
return line
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class _Painted:
|
|
50
|
+
"""A text stream that colors each complete line before passing it on."""
|
|
51
|
+
|
|
52
|
+
def __init__(self, stream: TextIO) -> None:
|
|
53
|
+
self.stream = stream
|
|
54
|
+
self.pending = ""
|
|
55
|
+
|
|
56
|
+
def write(self, s: str) -> int:
|
|
57
|
+
*done, self.pending = (self.pending + s).split("\n")
|
|
58
|
+
for line in done:
|
|
59
|
+
self.stream.write(paint(line) + "\n")
|
|
60
|
+
return len(s)
|
|
61
|
+
|
|
62
|
+
def flush(self) -> None:
|
|
63
|
+
if self.pending:
|
|
64
|
+
self.stream.write(paint(self.pending))
|
|
65
|
+
self.pending = ""
|
|
66
|
+
self.stream.flush()
|
|
67
|
+
|
|
68
|
+
def __getattr__(self, name: str) -> Any:
|
|
69
|
+
return getattr(self.stream, name)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def wanted(stream: TextIO) -> bool:
|
|
73
|
+
"""Say whether to color a stream: a terminal, NO_COLOR unset, and not a dumb terminal.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
stream: The stream to write to.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
True when colors are wanted.
|
|
80
|
+
|
|
81
|
+
Example:
|
|
82
|
+
>>> import io
|
|
83
|
+
>>> wanted(io.StringIO())
|
|
84
|
+
False
|
|
85
|
+
"""
|
|
86
|
+
return stream.isatty() and "NO_COLOR" not in os.environ and os.environ.get("TERM") != "dumb"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def enable() -> None:
|
|
90
|
+
"""Wrap stdout and stderr so status marks are colored, where colors are wanted.
|
|
91
|
+
|
|
92
|
+
Example:
|
|
93
|
+
>>> enable() # doctest: +SKIP
|
|
94
|
+
"""
|
|
95
|
+
for name in ("stdout", "stderr"):
|
|
96
|
+
stream = getattr(sys, name)
|
|
97
|
+
if not isinstance(stream, _Painted) and wanted(stream):
|
|
98
|
+
setattr(sys, name, _Painted(stream))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""References commands: ref (list · check · index · read · tag · exclude · rules · terms ·
|
|
1
|
+
"""References commands: ref (list · check · index · read · tag · exclude · rules · terms · glossary · domain · convert · preview …)."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -22,6 +22,8 @@ def cmd_ref(a: argparse.Namespace) -> int:
|
|
|
22
22
|
return _list(project)
|
|
23
23
|
if a.action == "domain":
|
|
24
24
|
return _domain(project, a.work or "", a.task or "")
|
|
25
|
+
if a.action == "convert":
|
|
26
|
+
return _convert(project, a.arg or "", a.apply)
|
|
25
27
|
if a.action == "rules":
|
|
26
28
|
return _rules(project, a.arg or "", a.must)
|
|
27
29
|
if a.action == "terms":
|
|
@@ -50,6 +52,8 @@ def cmd_ref(a: argparse.Namespace) -> int:
|
|
|
50
52
|
return _tag(project, a.arg, a.scope or "", a.strength, a.off)
|
|
51
53
|
if a.action == "describe":
|
|
52
54
|
return _describe(project, a)
|
|
55
|
+
if a.action == "preview":
|
|
56
|
+
return _preview(project, a.arg)
|
|
53
57
|
if a.action == "attach":
|
|
54
58
|
return _attach(project, a)
|
|
55
59
|
if a.action == "glossary":
|
|
@@ -142,6 +146,9 @@ def _domain(project: Project, work_id: str, task: str) -> int:
|
|
|
142
146
|
domain_mod.table(project)
|
|
143
147
|
or msg("No domain knowledge yet — put documents in {folder}, then /l-ref domain", folder=project.rel(project.folder("domain")))
|
|
144
148
|
)
|
|
149
|
+
waiting = src_mod.pending(project)
|
|
150
|
+
if waiting:
|
|
151
|
+
print("\n⚠ " + waiting)
|
|
145
152
|
return 0
|
|
146
153
|
work = project.find_work(work_id)
|
|
147
154
|
if work is None:
|
|
@@ -158,6 +165,127 @@ def _domain(project: Project, work_id: str, task: str) -> int:
|
|
|
158
165
|
return 0
|
|
159
166
|
|
|
160
167
|
|
|
168
|
+
def _size(n: int) -> str:
|
|
169
|
+
return f"{n / 1e6:.1f}MB" if n >= 1e6 else f"{-(-n // 1000)}KB" # rounded up, so 0 stays 0
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
QUALITY = {"ok": "✔", "check": "⚠", "empty": "✖"}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def _convert(project: Project, path: str, apply: bool) -> int:
|
|
176
|
+
"""List the domain-knowledge originals and what converting them would do; with --apply, convert the new and changed ones."""
|
|
177
|
+
import time
|
|
178
|
+
|
|
179
|
+
from ..refs import convert as conv
|
|
180
|
+
|
|
181
|
+
if path:
|
|
182
|
+
found = src_mod.resolve(project, path)
|
|
183
|
+
if found is None or not found.path.exists():
|
|
184
|
+
raise CliError(msg("{path} does not exist", path=path))
|
|
185
|
+
if found.outside:
|
|
186
|
+
raise CliError(msg("lantern ref convert works inside the project — convert material outside it there, then index the .md"))
|
|
187
|
+
items = conv.originals(found.path)
|
|
188
|
+
else:
|
|
189
|
+
items = src_mod.originals(project)
|
|
190
|
+
if not items:
|
|
191
|
+
print(
|
|
192
|
+
msg(
|
|
193
|
+
"No originals to convert — PDF · DOCX · PPTX · HWP · HWPX · XLSX · CSV put in {folder} show up here",
|
|
194
|
+
folder=project.rel(project.folder("domain")),
|
|
195
|
+
)
|
|
196
|
+
)
|
|
197
|
+
return 0
|
|
198
|
+
todo = [o for o in items if o.state in ("new", "changed")]
|
|
199
|
+
if not apply:
|
|
200
|
+
marks = {"new": "+", "changed": "~", "done": "✔", "edited": "⚠", "same": "=", "unknown": "?"}
|
|
201
|
+
for o in items:
|
|
202
|
+
tail = {
|
|
203
|
+
"same": msg("(same file as {path} — converted once)", path=project.rel(o.same_as)) if o.same_as else "",
|
|
204
|
+
"edited": msg("(the original changed, but its copy was edited by hand — left alone; delete the copy to convert again)"),
|
|
205
|
+
"unknown": msg("(can't be read — save it as PDF, DOCX or XLSX)"),
|
|
206
|
+
"done": f"→ {o.target.name}",
|
|
207
|
+
}.get(o.state, "")
|
|
208
|
+
print(f"{marks[o.state]} {o.label:<5} {_size(o.path.stat().st_size):>7} {project.rel(o.path)} {tail}".rstrip())
|
|
209
|
+
counts = {s: sum(1 for o in items if o.state == s) for s in ("done", "same", "unknown")}
|
|
210
|
+
print(
|
|
211
|
+
"\n"
|
|
212
|
+
+ msg(
|
|
213
|
+
"To convert: {todo} ({size}) · converted: {done} · duplicates: {same} · unreadable: {unknown}",
|
|
214
|
+
todo=len(todo),
|
|
215
|
+
size=_size(sum(o.path.stat().st_size for o in todo)),
|
|
216
|
+
**counts,
|
|
217
|
+
)
|
|
218
|
+
)
|
|
219
|
+
if todo:
|
|
220
|
+
print(
|
|
221
|
+
msg(
|
|
222
|
+
"→ lantern ref convert {path}--apply (only the copies are written; the originals stay as they are)",
|
|
223
|
+
path=f'"{path}" ' if path else "",
|
|
224
|
+
)
|
|
225
|
+
)
|
|
226
|
+
return 0
|
|
227
|
+
made, failed, total, started = 0, 0, 0, time.monotonic()
|
|
228
|
+
for o in todo:
|
|
229
|
+
try:
|
|
230
|
+
copy = conv.convert(o)
|
|
231
|
+
except conv.ConvertError as e:
|
|
232
|
+
failed += 1
|
|
233
|
+
print(f"✖ {project.rel(o.path)} — {e}")
|
|
234
|
+
continue
|
|
235
|
+
except Exception as e: # one odd file must not stop the rest; it is reported and left unconverted
|
|
236
|
+
failed += 1
|
|
237
|
+
print(
|
|
238
|
+
f"✖ {project.rel(o.path)} — "
|
|
239
|
+
+ msg("could not be read ({error}) — save it again as PDF or DOCX", error=f"{type(e).__name__}: {e}")
|
|
240
|
+
)
|
|
241
|
+
continue
|
|
242
|
+
made += 1
|
|
243
|
+
size = o.target.stat().st_size
|
|
244
|
+
total += size
|
|
245
|
+
note = f" — {copy.note}" if copy.note else ""
|
|
246
|
+
print(f"{QUALITY[copy.quality]} {project.rel(o.target)} ({_size(size)}){note}")
|
|
247
|
+
print(
|
|
248
|
+
"\n"
|
|
249
|
+
+ msg(
|
|
250
|
+
"Made {made} copies ({size} — read whole, at most {tokens} tokens) · failed {failed} · {seconds}s",
|
|
251
|
+
made=made,
|
|
252
|
+
size=_size(total),
|
|
253
|
+
tokens=f"{total:,}",
|
|
254
|
+
failed=failed,
|
|
255
|
+
seconds=round(time.monotonic() - started, 1),
|
|
256
|
+
)
|
|
257
|
+
)
|
|
258
|
+
if made:
|
|
259
|
+
print(msg("→ Describe them with /l-ref domain — it looks at lantern ref preview, not the whole text"))
|
|
260
|
+
return 1 if failed else 0
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def _preview(project: Project, name: str) -> int:
|
|
264
|
+
"""Print a reference document as its sections' addresses, sizes and first lines."""
|
|
265
|
+
from ..refs import convert as conv
|
|
266
|
+
|
|
267
|
+
doc = src_mod.find_document(project, name)
|
|
268
|
+
text = read(doc.path)
|
|
269
|
+
head = conv.read_header(text)
|
|
270
|
+
if head:
|
|
271
|
+
quality = {"ok": msg("good"), "check": msg("check it"), "empty": msg("no text")}.get(head.get("quality", ""), "")
|
|
272
|
+
print(
|
|
273
|
+
msg("Converted from {name} ({tool} · {quality})", name=head.get("from", ""), tool=head.get("tool", ""), quality=quality)
|
|
274
|
+
+ (f" — {head['note']}" if head.get("note") else "")
|
|
275
|
+
)
|
|
276
|
+
shown = conv.preview(text)
|
|
277
|
+
print(shown)
|
|
278
|
+
print(
|
|
279
|
+
"\n"
|
|
280
|
+
+ msg(
|
|
281
|
+
'Preview {preview} of {whole} — lantern ref read "<address>" reads one section',
|
|
282
|
+
preview=_size(len(shown.encode())),
|
|
283
|
+
whole=_size(len(text.encode())),
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
return 0
|
|
287
|
+
|
|
288
|
+
|
|
161
289
|
def _rules(project: Project, place: str, must: bool) -> int:
|
|
162
290
|
"""Print the company rules kept outside the project for the root or one part, word for word."""
|
|
163
291
|
from ..tools.rules import active_parts
|
|
@@ -198,7 +326,9 @@ def _check(project: Project, path: str) -> int:
|
|
|
198
326
|
raise CliError(msg("{path} doesn't exist", path=path))
|
|
199
327
|
docs = src_mod.documents(project, found)
|
|
200
328
|
if not docs:
|
|
201
|
-
raise CliError(
|
|
329
|
+
raise CliError(
|
|
330
|
+
msg("{path} holds no Markdown document — lantern ref convert makes .md copies of PDF · DOCX · HWP · XLSX first", path=path)
|
|
331
|
+
)
|
|
202
332
|
bad = 0
|
|
203
333
|
for d in docs:
|
|
204
334
|
text = read(d.path)
|
|
@@ -306,6 +436,8 @@ def register(add: Add) -> None:
|
|
|
306
436
|
"domain",
|
|
307
437
|
"describe",
|
|
308
438
|
"attach",
|
|
439
|
+
"convert",
|
|
440
|
+
"preview",
|
|
309
441
|
],
|
|
310
442
|
)
|
|
311
443
|
p.add_argument(
|
|
@@ -333,3 +465,6 @@ def register(add: Add) -> None:
|
|
|
333
465
|
p.add_argument("--work", help=msg("domain · attach: the work, e.g. W-012"))
|
|
334
466
|
p.add_argument("--task", help=msg("domain · attach: the task, e.g. T03"))
|
|
335
467
|
p.add_argument("--note", help=msg("attach: what it is used for, in a few words"))
|
|
468
|
+
p.add_argument(
|
|
469
|
+
"--apply", action="store_true", help=msg("convert: write the Markdown copies (without it, only shows what would happen)")
|
|
470
|
+
)
|
|
@@ -41,7 +41,7 @@ def cmd_scan(a: argparse.Namespace) -> int:
|
|
|
41
41
|
"""`lantern scan` — find docs-vs-code drift (text or JSON)."""
|
|
42
42
|
from ..report import scan
|
|
43
43
|
|
|
44
|
-
res = scan.run(_p(), rev=a.range, limit=a.limit, tests=a.tests)
|
|
44
|
+
res = scan.run(_p(), rev=a.range, limit=a.limit, tests=a.tests, ci=a.ci)
|
|
45
45
|
print(res.to_json() if a.json else res.format())
|
|
46
46
|
return 1 if res.tests is not None and not res.tests.get("ok") else 0 # CI fails on broken acceptance tests
|
|
47
47
|
|
|
@@ -127,12 +127,14 @@ def cmd_harness(a: argparse.Namespace) -> int:
|
|
|
127
127
|
|
|
128
128
|
def cmd_obsidian(a: argparse.Namespace) -> int:
|
|
129
129
|
"""`lantern obsidian plugins` — download the recommended Obsidian plugins into docs/.obsidian/plugins/."""
|
|
130
|
-
from ..report.obsidian import install_plugins, write_vault
|
|
130
|
+
from ..report.obsidian import TIMELINE_PLUGIN, install_plugins, write_vault
|
|
131
131
|
|
|
132
132
|
project = _p()
|
|
133
133
|
write_vault(project) # plugin settings and .gitignore must exist first
|
|
134
134
|
for plugin_id, version in install_plugins(project):
|
|
135
135
|
print(f"✔ {plugin_id} {version}")
|
|
136
|
+
write_vault(project) # now that plugins are in use, this also copies the timeline plugin bundled with the package
|
|
137
|
+
print(f"✔ {TIMELINE_PLUGIN}")
|
|
136
138
|
print(msg("Next: open the docs/ folder as a vault in Obsidian, and turn community plugins on when asked (turn off restricted mode)"))
|
|
137
139
|
return 0
|
|
138
140
|
|
|
@@ -151,7 +153,8 @@ def register(add: Add) -> None:
|
|
|
151
153
|
p = add("scan", cmd_scan, msg("Find doc-code mismatches"))
|
|
152
154
|
p.add_argument("--range", help=msg("git range (e.g. main..HEAD)"))
|
|
153
155
|
p.add_argument("--limit", type=int, default=200)
|
|
154
|
-
p.add_argument("--tests", action="store_true", help=msg("Run acceptance tests
|
|
156
|
+
p.add_argument("--tests", action="store_true", help=msg("Run acceptance tests (each part's test command, or build.test)"))
|
|
157
|
+
p.add_argument("--ci", action="store_true", help=msg("For CI: leave out parts with ci: false"))
|
|
155
158
|
p.add_argument("--json", action="store_true")
|
|
156
159
|
p = add("sync", cmd_sync, msg("Record the result of aligning"))
|
|
157
160
|
p.add_argument("action", choices=["adopt"])
|
|
@@ -82,6 +82,8 @@ def cmd_idea(a: argparse.Namespace) -> int:
|
|
|
82
82
|
if h["status"] == project.enums.value("idea_status", "dropped")
|
|
83
83
|
else ""
|
|
84
84
|
)
|
|
85
|
+
if h["blocked_reason"]:
|
|
86
|
+
extra = " — " + msg("{reason} (look again when: {revisit})", reason=h["blocked_reason"], revisit=h["revisit_when"])
|
|
85
87
|
print(
|
|
86
88
|
msg(
|
|
87
89
|
"{id} {title} ({kind} · {status}) score {score}{extra}",
|
|
@@ -97,7 +99,7 @@ def cmd_idea(a: argparse.Namespace) -> int:
|
|
|
97
99
|
if a.action == "status":
|
|
98
100
|
if not a.status:
|
|
99
101
|
raise CliError(msg("lantern idea status IDEA-014 <status>"))
|
|
100
|
-
p = ideas.idea_status(project, a.arg, a.status, work=a.work, reason=a.reason, note=a.note)
|
|
102
|
+
p = ideas.idea_status(project, a.arg, a.status, work=a.work, reason=a.reason, note=a.note, revisit=a.revisit)
|
|
101
103
|
print(f"✔ {project.rel(p)} → {a.status}")
|
|
102
104
|
return 0
|
|
103
105
|
return 1
|
|
@@ -427,6 +429,7 @@ def register(add: Add) -> None:
|
|
|
427
429
|
p.add_argument("--work")
|
|
428
430
|
p.add_argument("--reason")
|
|
429
431
|
p.add_argument("--note")
|
|
432
|
+
p.add_argument("--revisit", help=msg("status: for a blocked idea, what would reopen it"))
|
|
430
433
|
p = add("design", cmd_design, msg("Record design approval"))
|
|
431
434
|
p.add_argument("action", choices=["approve"])
|
|
432
435
|
p.add_argument("work")
|
|
@@ -26,7 +26,7 @@ from .messages import msg
|
|
|
26
26
|
|
|
27
27
|
# Roles the code relies on. A project's enums.yaml must give each of them to some value of its list.
|
|
28
28
|
REQUIRED_ROLES: dict[str, list[str]] = {
|
|
29
|
-
"idea_status": ["new", "reviewing", "worked", "on_hold", "dropped"],
|
|
29
|
+
"idea_status": ["new", "reviewing", "worked", "on_hold", "blocked", "dropped"],
|
|
30
30
|
"work_status": ["plan", "design", "tasks", "build", "done", "on_hold"],
|
|
31
31
|
"adr_status": ["proposed", "accepted", "superseded"],
|
|
32
32
|
"debt_kind": ["understanding", "competency", "tech"],
|
|
@@ -433,6 +433,45 @@ def rename_in_text(text: str, enum: str, old: str, new: str) -> str:
|
|
|
433
433
|
return text[: block.start(1)] + body + text[block.end(1) :]
|
|
434
434
|
|
|
435
435
|
|
|
436
|
+
def add_value_in_text(text: str, enum: str, name: str, icon: str, role: str) -> str:
|
|
437
|
+
r"""Add one value at the end of a list in the text of enums.yaml.
|
|
438
|
+
|
|
439
|
+
Comments and the other values stay as written.
|
|
440
|
+
|
|
441
|
+
Args:
|
|
442
|
+
text: The whole text of enums.yaml.
|
|
443
|
+
enum: List name.
|
|
444
|
+
name: The new value's name.
|
|
445
|
+
icon: Its icon.
|
|
446
|
+
role: Its role.
|
|
447
|
+
|
|
448
|
+
Returns:
|
|
449
|
+
The enums.yaml text with the value added.
|
|
450
|
+
|
|
451
|
+
Raises:
|
|
452
|
+
LookupError: The list does not exist.
|
|
453
|
+
|
|
454
|
+
Example:
|
|
455
|
+
>>> text = "idea_status:\n values:\n 보류: {icon: 🗄, role: on_hold}\n\nsize:\n values:\n S: 🟢\n"
|
|
456
|
+
>>> print(add_value_in_text(text, "idea_status", "막힘", "🚧", "blocked"), end="")
|
|
457
|
+
idea_status:
|
|
458
|
+
values:
|
|
459
|
+
보류: {icon: 🗄, role: on_hold}
|
|
460
|
+
막힘: {icon: 🚧, role: blocked}
|
|
461
|
+
<BLANKLINE>
|
|
462
|
+
size:
|
|
463
|
+
values:
|
|
464
|
+
S: 🟢
|
|
465
|
+
"""
|
|
466
|
+
block = re.search(r"^" + re.escape(enum) + r":[ \t]*$(.*?)(?=^\S|\Z)", text, re.M | re.S)
|
|
467
|
+
if block is None:
|
|
468
|
+
raise LookupError(msg("enums.yaml has no '{enum}'", enum=enum))
|
|
469
|
+
body = block.group(1)
|
|
470
|
+
kept = body.rstrip()
|
|
471
|
+
line = f"\n {_yaml_key(name)}: {{icon: {icon}, role: {role}}}"
|
|
472
|
+
return text[: block.start(1)] + kept + line + body[len(kept) :] + text[block.end(1) :]
|
|
473
|
+
|
|
474
|
+
|
|
436
475
|
def _yaml_key(s: str) -> str:
|
|
437
476
|
"""Quote a name that cannot be a bare YAML key."""
|
|
438
477
|
return s if re.fullmatch(r"[^\s:#'\"{}\[\],&*!|>%@`-][^:#{}\[\],]*", s) and s == s.strip() else '"' + s.replace('"', '\\"') + '"'
|