@litfamily/litclaude 1.0.36 → 1.0.38
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.
- package/CHANGELOG.md +49 -0
- package/README.md +11 -8
- package/README_ko-KR.md +11 -8
- package/bin/litclaude-ai.js +3 -3
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/assets/skills/lit-adhd.webp +0 -0
- package/docs/assets/skills/lit-hijack.webp +0 -0
- package/docs/assets/skills/lit-schematic.webp +0 -0
- package/docs/hooks.md +112 -26
- package/docs/workflow-compatibility-audit.md +1 -1
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/icon.png +0 -0
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/agents/lit-executor.md +4 -2
- package/plugins/litclaude/bin/litclaude-ai +1 -0
- package/plugins/litclaude/bin/litclaude-hook.js +349 -47
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/commands/lit-adhd.md +103 -0
- package/plugins/litclaude/commands/lit-hijack.md +102 -0
- package/plugins/litclaude/commands/lit-loop.md +4 -2
- package/plugins/litclaude/commands/lit-plan.md +5 -4
- package/plugins/litclaude/commands/lit-rewind.md +103 -0
- package/plugins/litclaude/commands/litgoal.md +5 -4
- package/plugins/litclaude/commands/start-work.md +25 -10
- package/plugins/litclaude/hooks/lit-mod.mjs +51 -5
- package/plugins/litclaude/lib/canonical-skill-catalog.mjs +3 -0
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +199 -96
- package/plugins/litclaude/lib/lit-activation.mjs +24 -10
- package/plugins/litclaude/lib/mod/frame.mjs +158 -39
- package/plugins/litclaude/lib/mod/motion.mjs +21 -0
- package/plugins/litclaude/lib/mod/settings.mjs +4 -0
- package/plugins/litclaude/lib/mod/skills.mjs +3 -0
- package/plugins/litclaude/lib/mod/state.mjs +100 -7
- package/plugins/litclaude/lib/mod/svg-card.mjs +115 -15
- package/plugins/litclaude/lib/mod/timeline.mjs +24 -2
- package/plugins/litclaude/lib/mod/toasts.mjs +5 -2
- package/plugins/litclaude/lib/mod/view.mjs +199 -5
- package/plugins/litclaude/lib/mod/workflow.mjs +36 -7
- package/plugins/litclaude/lib/motion-render-gate.mjs +25 -7
- package/plugins/litclaude/lib/render_pages.py +29 -1
- package/plugins/litclaude/lib/rewind/collect.mjs +387 -0
- package/plugins/litclaude/lib/rewind/gauge.mjs +67 -0
- package/plugins/litclaude/lib/rewind/next-step.mjs +89 -0
- package/plugins/litclaude/lib/rewind/redact.mjs +36 -0
- package/plugins/litclaude/lib/rewind/transcripts.mjs +244 -0
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +403 -18
- package/plugins/litclaude/lib/workflow-stack.mjs +243 -0
- package/plugins/litclaude/lib/workflow-stage.mjs +127 -103
- package/plugins/litclaude/scripts/scaffold-plan.mjs +1 -1
- package/plugins/litclaude/skills/frontend-ui-ux/SKILL.md +11 -3
- package/plugins/litclaude/skills/frontend-ui-ux/kit/components.css +414 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
- package/plugins/litclaude/skills/frontend-ui-ux/references/complete-contract.md +1 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/craft-floor.md +9 -4
- package/plugins/litclaude/skills/frontend-ui-ux/references/default-editorial-pixel.json +6 -5
- package/plugins/litclaude/skills/frontend-ui-ux/references/house-styles.md +234 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/motion-guide.md +3 -3
- package/plugins/litclaude/skills/frontend-ui-ux/references/slop-register.md +7 -7
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +30 -9
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +19 -7
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-static.mjs +12 -2
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe.mjs +53 -6
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/plugins/litclaude/skills/lit-adhd/SKILL.md +151 -0
- package/plugins/litclaude/skills/lit-adhd/references/card-examples.md +69 -0
- package/plugins/litclaude/skills/lit-adhd/references/status-taxonomy.md +43 -0
- package/plugins/litclaude/skills/lit-adhd/scripts/rewind.mjs +11 -0
- package/plugins/litclaude/skills/lit-diagram-drawer/SKILL.md +5 -4
- package/plugins/litclaude/skills/lit-diagram-drawer/references/style-guide.md +20 -11
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/references/verifier-guide.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/scripts/visual-quality.mjs +3 -3
- package/plugins/litclaude/skills/lit-handoff/SKILL.md +1 -1
- package/plugins/litclaude/skills/lit-hijack/SKILL.md +551 -0
- package/plugins/litclaude/skills/lit-hijack/references/capture-and-provenance.md +124 -0
- package/plugins/litclaude/skills/lit-hijack/references/clean-room-build.md +133 -0
- package/plugins/litclaude/skills/lit-hijack/references/distil-and-licence.md +128 -0
- package/plugins/litclaude/skills/lit-hijack/references/gap-and-port-design.md +152 -0
- package/plugins/litclaude/skills/lit-hijack/references/parity-and-report.md +131 -0
- package/plugins/litclaude/skills/lit-hijack/scripts/hijack.mjs +854 -0
- package/plugins/litclaude/skills/lit-loop/SKILL.md +4 -3
- package/plugins/litclaude/skills/lit-plan/SKILL.md +16 -10
- package/plugins/litclaude/skills/lit-pptx/SKILL.md +29 -14
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/provenance.json +32 -1
- package/plugins/litclaude/skills/lit-pptx/references/agents/architect.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/anti-slop-checklist.md +32 -11
- package/plugins/litclaude/skills/lit-pptx/references/authoring-guide.md +2 -2
- package/plugins/litclaude/skills/lit-pptx/references/data-display-cookbook.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/density-and-fill.md +3 -4
- package/plugins/litclaude/skills/lit-pptx/references/direction-step.md +19 -2
- package/plugins/litclaude/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/plugins/litclaude/skills/lit-pptx/references/layout-families.md +22 -26
- package/plugins/litclaude/skills/lit-pptx/references/title-treatments.md +30 -26
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/atlas.md +4 -4
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/chalk.md +3 -3
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/gazette.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/ledger.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/night.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/paper.md +3 -3
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/signal.md +2 -2
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/studio.md +6 -7
- package/plugins/litclaude/skills/lit-pptx/scripts/compile-deck.js +1 -1
- package/plugins/litclaude/skills/lit-pptx/scripts/craft_extras.py +135 -91
- package/plugins/litclaude/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/render-pack.js +370 -563
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/plugins/litclaude/skills/lit-pptx/scripts/qa_deck.py +5 -5
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-recap/SKILL.md +3 -0
- package/plugins/litclaude/skills/lit-schematic/SKILL.md +112 -0
- package/plugins/litclaude/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/plugins/litclaude/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/plugins/litclaude/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/plugins/litclaude/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/plugins/litclaude/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/plugins/litclaude/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/plugins/litclaude/skills/lit-schematic/references/journal-figures.md +72 -0
- package/plugins/litclaude/skills/lit-schematic/references/kit-api.md +134 -0
- package/plugins/litclaude/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/plugins/litclaude/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/plugins/litclaude/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/plugins/litclaude/skills/lit-schematic/references/verification.md +100 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/render.mjs +233 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/plugins/litclaude/skills/lit-scientific-visualization/SKILL.md +14 -4
- package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +50 -45
- package/plugins/litclaude/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +11 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/blender/runner.py +218 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/core/presets.mjs +1 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/analysis.mjs +65 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/assets.mjs +208 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/blender.mjs +143 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/board.mjs +136 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/brief.mjs +7 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/chrome.mjs +6 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-assets.mjs +5 -3
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-capture.mjs +4 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-treatment.mjs +37 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover.mjs +17 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/done.mjs +42 -3
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/frame-worker.mjs +7 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/gallery.mjs +121 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/house.mjs +44 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/look.mjs +33 -19
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/pipeline.mjs +18 -7
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/scaffold.mjs +210 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/score.mjs +639 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/sound-cli.mjs +21 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/sound.mjs +126 -27
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-capture.mjs +7 -6
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-gate.mjs +59 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-qa.mjs +141 -9
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-serve.mjs +28 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +82 -14
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/styles.mjs +213 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/treatment.mjs +311 -10
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/cover-init.js +14 -2
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/init.js +11 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/qa.js +6 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/stage-kit.js +83 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/hero-3d/expected.json +69 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/painted-light/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/weight-tide/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/cover.md +67 -15
- package/plugins/litclaude/skills/lit-typographic-motion/references/craft-loop.md +3 -2
- package/plugins/litclaude/skills/lit-typographic-motion/references/depth.md +122 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/look.md +28 -13
- package/plugins/litclaude/skills/lit-typographic-motion/references/runtime.md +4 -3
- package/plugins/litclaude/skills/lit-typographic-motion/references/sound.md +92 -23
- package/plugins/litclaude/skills/lit-typographic-motion/references/stage.md +43 -22
- package/plugins/litclaude/skills/lit-typographic-motion/references/studio.md +245 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/style-bibles.md +30 -6
- package/plugins/litclaude/skills/lit-typographic-motion/references/treatment.md +108 -14
- package/plugins/litclaude/skills/lit-typographic-motion/scripts/motion-doctor.mjs +16 -3
- package/plugins/litclaude/skills/lit-typographic-motion/scripts/motion.mjs +47 -7
- package/plugins/litclaude/skills/lit-typographic-motion/styles/paper.json +41 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/swiss-signal.json +41 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/terminalcore.json +42 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/tidal.json +41 -0
- package/plugins/litclaude/skills/litgoal/SKILL.md +3 -2
- package/plugins/litclaude/skills/litresearch/SKILL.md +5 -0
- package/plugins/litclaude/skills/readme-studio/templates/hyperframes-cover/package-lock.json +3 -3
- package/plugins/litclaude/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
- package/plugins/litclaude/skills/start-work/SKILL.md +24 -11
- package/scripts/qa-cover-recipes.mjs +3 -3
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// while boulder.json is found the way `lifecycleRootFor` in bin/litclaude-hook.js finds it, walking up
|
|
13
13
|
// from the working directory and across a linked Git worktree to its main checkout.
|
|
14
14
|
|
|
15
|
+
import { parsePlanTaskRows } from "../plan-task-rows.mjs";
|
|
15
16
|
import { parseStageRecord } from "./workflow.mjs";
|
|
16
17
|
|
|
17
18
|
export const STATE_CAPS = Object.freeze({
|
|
@@ -85,7 +86,19 @@ export const resolveStateRoot = async (io, cwd) => {
|
|
|
85
86
|
return normalizePath(cwd);
|
|
86
87
|
};
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
// The main checkout's run reaches a linked worktree only when the run's worktree covers cwd or the
|
|
90
|
+
// session is one of the run's; a sibling worktree reads its own state (the hook's rule, mirrored).
|
|
91
|
+
const governsLinkedCwd = async (io, mainRoot, cwd, sessionId) => {
|
|
92
|
+
const state = await readGuardedJson(io, mainRoot, joinPath(".litclaude", "boulder.json"), STATE_CAPS.boulder);
|
|
93
|
+
const work = state?.active_work_id ? state.works?.[state.active_work_id] : null;
|
|
94
|
+
if (!work || !["active", "paused"].includes(work.status)) return true;
|
|
95
|
+
if (typeof sessionId === "string" && Array.isArray(work.session_ids) && work.session_ids.includes(sessionId)) return true;
|
|
96
|
+
const scope = splitPath(normalizePath(String(work.effective_worktree_root ?? work.worktree_path ?? mainRoot)).normalize("NFC"));
|
|
97
|
+
const here = splitPath(normalizePath((await statOf(io, cwd))?.realPath ?? cwd).normalize("NFC"));
|
|
98
|
+
return scope.every((part, index) => here[index] === part);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const resolveLifecycleRoot = async (io, cwd, stateRoot, sessionId = null) => {
|
|
89
102
|
for (const directory of ancestors(cwd)) {
|
|
90
103
|
if (await statOf(io, joinPath(directory, ".litclaude", "boulder.json"))) return directory;
|
|
91
104
|
const marker = joinPath(directory, ".git");
|
|
@@ -102,7 +115,7 @@ export const resolveLifecycleRoot = async (io, cwd, stateRoot) => {
|
|
|
102
115
|
const worktreesDir = parentOf(resolvePath(directory, match[1]));
|
|
103
116
|
if (splitPath(worktreesDir).at(-1) === "worktrees") {
|
|
104
117
|
const mainRoot = parentOf(parentOf(worktreesDir));
|
|
105
|
-
if (await statOf(io, joinPath(mainRoot, ".litclaude", "boulder.json"))) return mainRoot;
|
|
118
|
+
if (await statOf(io, joinPath(mainRoot, ".litclaude", "boulder.json")) && await governsLinkedCwd(io, mainRoot, cwd, sessionId)) return mainRoot;
|
|
106
119
|
}
|
|
107
120
|
}
|
|
108
121
|
}
|
|
@@ -336,14 +349,85 @@ export const summarizeResearchFiles = (entries, slug) => {
|
|
|
336
349
|
};
|
|
337
350
|
};
|
|
338
351
|
|
|
352
|
+
const FRAME_SKILL = /^[a-z][a-z0-9-]{0,40}$/u;
|
|
353
|
+
// The plan a frame works from, as lib/workflow-stack.mjs keeps it: a project-relative `plans/<name>.md`.
|
|
354
|
+
const FRAME_PLAN = /^plans\/[A-Za-z0-9_-][A-Za-z0-9._-]*\.md$/u;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* The session's workflow stack (lib/workflow-stack.mjs) as the card trusts it: at most three frames,
|
|
358
|
+
* each with its skill, role, status and stage record, and the frame whose map the card draws, which
|
|
359
|
+
* is the nearest paused spine while a side frame is on top and the top frame otherwise. The owner's
|
|
360
|
+
* record carries the top frame's time, so a side frame keeps the paused map fresh.
|
|
361
|
+
*/
|
|
362
|
+
export const parseWorkflowStack = (stack, sessionId) => {
|
|
363
|
+
if (!stack || typeof stack !== "object" || !Array.isArray(stack.frames) || !stack.frames.length || stack.frames.length > 3) return null;
|
|
364
|
+
const frames = stack.frames.map((frame) => ({
|
|
365
|
+
skill: typeof frame?.skill === "string" && FRAME_SKILL.test(frame.skill) ? frame.skill : null,
|
|
366
|
+
role: frame?.role === "side" ? "side" : "spine",
|
|
367
|
+
status: frame?.status === "paused" ? "paused" : "active",
|
|
368
|
+
record: parseStageRecord({ ...frame, sessionId: undefined }, sessionId),
|
|
369
|
+
at: typeof frame?.at === "string" ? Date.parse(frame.at) : Number.NaN,
|
|
370
|
+
planRef: typeof frame?.ref?.plan === "string" && FRAME_PLAN.test(frame.ref.plan) && !frame.ref.plan.includes("..") ? frame.ref.plan : null,
|
|
371
|
+
plan: null,
|
|
372
|
+
}));
|
|
373
|
+
const top = frames.at(-1);
|
|
374
|
+
const owner = top.role === "side" ? frames.findLast(({ role }) => role === "spine") ?? top : top;
|
|
375
|
+
const record = owner.record && Number.isFinite(top.at) ? { ...owner.record, at: Math.max(owner.record.at, top.at), stacked: true } : null;
|
|
376
|
+
return { frames, owner: frames.indexOf(owner), record };
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
/** A plan's `{ done, total }` by the start-work checkbox grammar, or null when it has no task rows. */
|
|
380
|
+
export const countPlanTasks = (text) => {
|
|
381
|
+
const rows = parsePlanTaskRows(String(text ?? ""));
|
|
382
|
+
return rows.length ? { done: rows.filter(({ checked }) => checked).length, total: rows.length } : null;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// Each frame that names a plan gets that plan's checkbox counts, read once per plan under the cap.
|
|
386
|
+
const withPlanCounts = async (io, stateRoot, frames) => {
|
|
387
|
+
const refs = [...new Set(frames.map(({ planRef }) => planRef).filter(Boolean))];
|
|
388
|
+
const counts = new Map(await Promise.all(refs.map(async (ref) => [ref, countPlanTasks(await readGuarded(io, stateRoot, ref, STATE_CAPS.goals))])));
|
|
389
|
+
for (const frame of frames) frame.plan = frame.planRef ? counts.get(frame.planRef) ?? null : null;
|
|
390
|
+
return frames;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const OTHER_STACKS = 6;
|
|
394
|
+
|
|
395
|
+
// The stacks other sessions of this project keep beside this one's, newest first and at most
|
|
396
|
+
// OTHER_STACKS: `{ id8, at, frames }` each, `at` being the file's mtime. Links, this session's own
|
|
397
|
+
// file and the unknown-session file are skipped; whether one is still live is the view's call.
|
|
398
|
+
const readOtherStacks = async (io, stateRoot, sessionId) => {
|
|
399
|
+
const own = new Set([ignitionFileName(sessionId), ignitionFileName(null)]);
|
|
400
|
+
const files = (await listOf(io, joinPath(stateRoot, ".litclaude", "workflow-stack")))
|
|
401
|
+
.filter((entry) => entry?.kind === "file" && !entry.isLink && /^[A-Za-z0-9._-]+\.json$/u.test(entry.name) && !own.has(entry.name))
|
|
402
|
+
.sort((a, b) => b.mtimeMs - a.mtimeMs)
|
|
403
|
+
.slice(0, OTHER_STACKS);
|
|
404
|
+
const read = await Promise.all(files.map(async (entry) => {
|
|
405
|
+
const raw = await readGuardedJson(io, stateRoot, joinPath(".litclaude", "workflow-stack", entry.name), STATE_CAPS.small);
|
|
406
|
+
const id = typeof raw?.sessionId === "string" ? raw.sessionId : null;
|
|
407
|
+
const parsed = id ? parseWorkflowStack(raw, id) : null;
|
|
408
|
+
if (parsed) await withPlanCounts(io, stateRoot, parsed.frames.slice(-1));
|
|
409
|
+
return parsed ? { id8: id.replace(/[^A-Za-z0-9]/gu, "").slice(0, 8), at: entry.mtimeMs, frames: parsed.frames } : null;
|
|
410
|
+
}));
|
|
411
|
+
return read.filter(Boolean);
|
|
412
|
+
};
|
|
413
|
+
|
|
339
414
|
const readWorkflowSources = async (io, stateRoot, sessionId) => {
|
|
340
415
|
const dir = (name) => joinPath(stateRoot, ".litclaude", name);
|
|
341
|
-
const [interviews, drafts, researches,
|
|
416
|
+
const [interviews, drafts, researches, ownStack, unknownStack] = await Promise.all([
|
|
342
417
|
listOf(io, dir("deep-interview")),
|
|
343
418
|
listOf(io, dir("drafts")),
|
|
344
419
|
listOf(io, dir("litresearch")),
|
|
345
|
-
readGuardedJson(io, stateRoot, ".litclaude
|
|
420
|
+
readGuardedJson(io, stateRoot, joinPath(".litclaude", "workflow-stack", ignitionFileName(sessionId)), STATE_CAPS.small),
|
|
421
|
+
readGuardedJson(io, stateRoot, joinPath(".litclaude", "workflow-stack", ignitionFileName(null)), STATE_CAPS.small),
|
|
346
422
|
]);
|
|
423
|
+
const stack = parseWorkflowStack(ownStack, sessionId) ?? parseWorkflowStack(unknownStack, sessionId);
|
|
424
|
+
if (stack) {
|
|
425
|
+
await withPlanCounts(io, stateRoot, stack.frames);
|
|
426
|
+
if (stack.record) stack.record.plan = stack.frames[stack.owner].plan;
|
|
427
|
+
}
|
|
428
|
+
const others = await readOtherStacks(io, stateRoot, sessionId);
|
|
429
|
+
// A record written before the stack existed, read only while this session has no stack.
|
|
430
|
+
const legacy = stack ? null : await readGuardedJson(io, stateRoot, ".litclaude/workflow-stage.json", STATE_CAPS.small);
|
|
347
431
|
const interviewFile = newestFile(interviews, /^[A-Za-z0-9._-]+-state\.json$/u);
|
|
348
432
|
const draftFile = newestFile(drafts, /^[A-Za-z0-9._-]+\.md$/u);
|
|
349
433
|
let research = null;
|
|
@@ -358,7 +442,9 @@ const readWorkflowSources = async (io, stateRoot, sessionId) => {
|
|
|
358
442
|
draftFile ? readGuarded(io, stateRoot, `.litclaude/drafts/${draftFile.name}`, STATE_CAPS.goals) : null,
|
|
359
443
|
]);
|
|
360
444
|
return {
|
|
361
|
-
record: parseStageRecord(
|
|
445
|
+
record: stack?.record ?? parseStageRecord(legacy, sessionId),
|
|
446
|
+
stack,
|
|
447
|
+
others,
|
|
362
448
|
interview: interview ? parseInterviewState(interview, interviewFile.mtimeMs) : null,
|
|
363
449
|
draft: draft === null ? null : parseDraftStatus(draft, draftFile.name.replace(/\.md$/u, ""), draftFile.mtimeMs),
|
|
364
450
|
research,
|
|
@@ -367,7 +453,7 @@ const readWorkflowSources = async (io, stateRoot, sessionId) => {
|
|
|
367
453
|
|
|
368
454
|
export const readLitSnapshot = async (io, { cwd, sessionId, env = {} }) => {
|
|
369
455
|
const stateRoot = await resolveStateRoot(io, cwd);
|
|
370
|
-
const lifecycleRoot = await resolveLifecycleRoot(io, cwd, stateRoot);
|
|
456
|
+
const lifecycleRoot = await resolveLifecycleRoot(io, cwd, stateRoot, sessionId);
|
|
371
457
|
const state = (relative, cap = STATE_CAPS.small) => readGuardedJson(io, stateRoot, joinPath(".litclaude", relative), cap);
|
|
372
458
|
const handoffId = handoffSessionId(sessionId);
|
|
373
459
|
const [ignition, boulder, goals, autoloop, litPlan, probe, motion, handoffSettings, handoffSession] = await Promise.all([
|
|
@@ -475,6 +561,13 @@ export const detectIconFont = async (io, env) => {
|
|
|
475
561
|
|
|
476
562
|
// The litgoal ledger's newest entries for the evidence pane, newest first. Lines that are not JSON
|
|
477
563
|
// objects are skipped; the file is read only under its cap.
|
|
564
|
+
// A workflow stack event's place: `lit-loop RED 1/4`.
|
|
565
|
+
const stackDetail = (entry) => {
|
|
566
|
+
if (!String(entry.event ?? "").startsWith("workflow.") || typeof entry.skill !== "string") return null;
|
|
567
|
+
const count = Number.isInteger(entry.n) && Number.isInteger(entry.total) ? ` ${entry.n}/${entry.total}` : "";
|
|
568
|
+
return `${entry.skill}${typeof entry.stage === "string" ? ` ${entry.stage}${count}` : ""}`;
|
|
569
|
+
};
|
|
570
|
+
|
|
478
571
|
export const readLedgerTail = async (io, stateRoot, limit = 8) => {
|
|
479
572
|
const text = await readGuarded(io, stateRoot, ".litclaude/litgoal/ledger.jsonl", STATE_CAPS.ledger);
|
|
480
573
|
if (text === null) return [];
|
|
@@ -488,7 +581,7 @@ export const readLedgerTail = async (io, stateRoot, limit = 8) => {
|
|
|
488
581
|
entries.push({
|
|
489
582
|
event: str(entry.event, 60) ?? "event",
|
|
490
583
|
at: time(entry.timestamp),
|
|
491
|
-
detail: str(entry.criterionId ?? entry.note ?? entry.objective ?? entry.status, 120) ?? "",
|
|
584
|
+
detail: str(entry.criterionId ?? entry.note ?? entry.objective ?? stackDetail(entry) ?? entry.status, 120) ?? "",
|
|
492
585
|
status: str(entry.status, 40),
|
|
493
586
|
});
|
|
494
587
|
} catch {
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
// terminal card's text border and its padded pills come apart there. Those surfaces carry an `Svg`
|
|
4
4
|
// element instead, and this module draws the same card into it: the brand pill, the discipline and
|
|
5
5
|
// the stage indicator on top, the workflow map (or the phase track and progress when no family
|
|
6
|
-
// places the session), the detail line with the live step, the
|
|
7
|
-
//
|
|
6
|
+
// places the session), the detail line with the live step, the thread rows while more than one
|
|
7
|
+
// thread is live (the terminal card's rows, drawn the same way), the skill chips (or the notice or
|
|
8
|
+
// the finish), and the live figures at the bottom.
|
|
8
9
|
//
|
|
9
10
|
// It draws the settled state of the model; the terminal's entrances and crossfades stay terminal
|
|
10
11
|
// only. While LitClaude works and motion allows, SMIL animation in the drawing keeps it moving: the
|
|
@@ -19,8 +20,9 @@
|
|
|
19
20
|
// Text is set in a monospace face and placed by counted cells (Hangul and emoji as two), so the
|
|
20
21
|
// layout does not depend on measuring a font the drawing cannot see.
|
|
21
22
|
|
|
23
|
+
import { gauge } from "../rewind/gauge.mjs";
|
|
22
24
|
import { textWidth, truncateToWidth } from "./layout.mjs";
|
|
23
|
-
import { TIMINGS, barCells, gradientAt } from "./motion.mjs";
|
|
25
|
+
import { TIMINGS, barCells, gradientAt, lookOf, rainbowAt } from "./motion.mjs";
|
|
24
26
|
|
|
25
27
|
const C = Object.freeze({
|
|
26
28
|
bg: "#0d1117",
|
|
@@ -48,6 +50,8 @@ const PHASES = Object.freeze(["plan", "work", "review"]);
|
|
|
48
50
|
// Drawing units: CSS pixels at the card's natural size; the surface draws it at that width, up to its slot.
|
|
49
51
|
export const SVG_CARD = Object.freeze({ width: 880, height: 160, font: 13, cell: 7.8, pad: 18 });
|
|
50
52
|
const ROW_Y = Object.freeze([28, 58, 86, 114, 142]);
|
|
53
|
+
// Each reserved thread row adds this much height, between the detail line and the chips.
|
|
54
|
+
export const THREAD_ROW_H = 22;
|
|
51
55
|
const PILL_H = 20;
|
|
52
56
|
const FONT = "ui-monospace, 'SF Mono', SFMono-Regular, Menlo, 'JetBrains Mono', Consolas, monospace";
|
|
53
57
|
|
|
@@ -98,6 +102,7 @@ const indicatorOf = (model, accent) => {
|
|
|
98
102
|
if (model.completion) return { label: "DONE ✓", fill: C.green };
|
|
99
103
|
if (model.idle) return { label: "idle", fill: C.dim, plain: true };
|
|
100
104
|
const flow = model.workflow;
|
|
105
|
+
if (flow?.paused && flow.current >= 0) return { label: `${flow.stages[flow.current].id.toUpperCase()} ||`, fill: C.dim };
|
|
101
106
|
if (flow && flow.current >= 0) return { label: `${flow.stages[flow.current].id.toUpperCase()} ●`, fill: model.ctxWarning ? C.amber : accent };
|
|
102
107
|
if (flow && model.lanes.count === 0) return { label: "DONE ✓", fill: C.green };
|
|
103
108
|
const current = PHASES.find((id) => model.phases[id] === "now");
|
|
@@ -206,14 +211,19 @@ const mapRowSvg = (model, accent, animate) => {
|
|
|
206
211
|
out.push(`<line x1="${x1.toFixed(1)}" y1="${y - 4}" x2="${x2.toFixed(1)}" y2="${y - 4}" stroke="${C.rail}" stroke-width="2.5" stroke-linecap="round"/>`);
|
|
207
212
|
const filled = count && count.total > 0 ? Math.min(1, count.done / count.total) : 0;
|
|
208
213
|
if (filled > 0) out.push(`<line x1="${x1.toFixed(1)}" y1="${y - 4}" x2="${(x1 + filled * layout.rail).toFixed(1)}" y2="${y - 4}" stroke="${mapColor(accent, mid)}" stroke-width="2.5" stroke-linecap="round"/>`);
|
|
209
|
-
if (animate.sweep) out.push(`<circle cx="${x1.toFixed(1)}" cy="${y - 4}" r="2.5" fill="#ffffff"><animate attributeName="cx" values="${x1.toFixed(1)};${x2.toFixed(1)}" ${loop(TIMINGS.flow, 0.5)}/></circle>`);
|
|
214
|
+
if (animate.sweep && !model.workflow.paused) out.push(`<circle cx="${x1.toFixed(1)}" cy="${y - 4}" r="2.5" fill="#ffffff"><animate attributeName="cx" values="${x1.toFixed(1)};${x2.toFixed(1)}" ${loop(TIMINGS.flow, 0.5)}/></circle>`);
|
|
210
215
|
} else {
|
|
211
216
|
out.push(`<line x1="${x1.toFixed(1)}" y1="${y - 4}" x2="${x2.toFixed(1)}" y2="${y - 4}" stroke="${C.rail}" stroke-width="1.5" stroke-linecap="round" stroke-opacity="0.7"/>`);
|
|
212
217
|
}
|
|
213
218
|
x = x2 + 6;
|
|
214
219
|
}
|
|
215
220
|
const label = labelOf(stage, layout.short);
|
|
216
|
-
if (stage.state === "now") {
|
|
221
|
+
if (stage.state === "now" && model.workflow.paused) {
|
|
222
|
+
// A paused stage holds still, as on the terminal card.
|
|
223
|
+
const drawn = pill(x, y, label, { fill: C.muted, ink: C.mutedText });
|
|
224
|
+
out.push(drawn.markup);
|
|
225
|
+
x = drawn.end;
|
|
226
|
+
} else if (stage.state === "now") {
|
|
217
227
|
const fill = model.idle ? C.muted : model.ctxWarning ? C.amber : accent;
|
|
218
228
|
const drawn = pill(x, y, label, { fill, ink: model.idle ? C.mutedText : C.ink, sweep: animate.sweep, breath: animate.breath ? "#ffffff" : null, breathPeak: 0.2 });
|
|
219
229
|
out.push(drawn.markup);
|
|
@@ -288,9 +298,9 @@ const detailRowSvg = (model, accent, animate) => {
|
|
|
288
298
|
const TONES = Object.freeze({ pink: [C.pink, "#ff6fae", "🔥"], amber: [C.amber, C.amber, "⚠"], red: [C.red, C.red, "✗"] });
|
|
289
299
|
|
|
290
300
|
// Skill chips, or the notice or the finish while one is up, or the hint while nothing has fired.
|
|
291
|
-
const middleRow = (model, accent, animate) => {
|
|
301
|
+
const middleRow = (model, accent, animate, shift = 0) => {
|
|
292
302
|
const { width, pad } = SVG_CARD;
|
|
293
|
-
const y = ROW_Y[3];
|
|
303
|
+
const y = ROW_Y[3] + shift;
|
|
294
304
|
const room = width - pad;
|
|
295
305
|
if (model.completion) {
|
|
296
306
|
return run(pad, y, [["✦ ", { fill: C.pink }], ["COMPLETE", { fill: C.white, bold: true }], [` · ${model.completion.detail ?? ""}`, { fill: C.green }]]).markup;
|
|
@@ -326,9 +336,9 @@ const middleRow = (model, accent, animate) => {
|
|
|
326
336
|
};
|
|
327
337
|
|
|
328
338
|
// ctx 42% ▰▰▱▱▱ · 5h 31% · 1w 12% · git main, after a warning when one is up.
|
|
329
|
-
const bottomRow = (model, accent) => {
|
|
339
|
+
const bottomRow = (model, accent, shift = 0) => {
|
|
330
340
|
const { width, pad } = SVG_CARD;
|
|
331
|
-
const y = ROW_Y[4];
|
|
341
|
+
const y = ROW_Y[4] + shift;
|
|
332
342
|
const groups = [];
|
|
333
343
|
const warning = model.warnings[0];
|
|
334
344
|
if (warning) {
|
|
@@ -360,12 +370,95 @@ const bottomRow = (model, accent) => {
|
|
|
360
370
|
return out.join("");
|
|
361
371
|
};
|
|
362
372
|
|
|
373
|
+
const THREAD_FILL = Object.freeze({ running: ["●", C.green], paused: ["|", C.dim], blocked: ["!", C.amber], idle: ["-", C.dim], done: ["✓", C.green] });
|
|
374
|
+
const TASK_MARK = Object.freeze({ shell: "$", monitor: "~" });
|
|
375
|
+
const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
376
|
+
|
|
377
|
+
// A gauge whose count is a lane's finished steps moves on every tool call it makes, and each new
|
|
378
|
+
// drawing restarts the card's animations; past ten the drawing counts steps by tens.
|
|
379
|
+
const threadGauge = ({ done, total, steps }) => (steps && total === null && done >= 10 ? `[???] ${Math.floor(done / 10) * 10}+/?` : gauge(done, total));
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* The thread rows (view.mjs threadsOf), as the terminal card lays them out (frame.mjs threadRows):
|
|
383
|
+
* the stack parent first with each child under it, lanes and background tasks under a fork line
|
|
384
|
+
* when two or more run, other sessions last, `+N more` on the last row. Returns the markup.
|
|
385
|
+
*/
|
|
386
|
+
const threadRowsSvg = (model) => {
|
|
387
|
+
const { width, pad } = SVG_CARD;
|
|
388
|
+
const { chain, lanes, others, laneCount = 0, taskCount = 0, more } = model.threads;
|
|
389
|
+
const lines = [];
|
|
390
|
+
chain.forEach((thread, index) => lines.push({ thread, lead: index === 0 ? "" : `${" ".repeat(index - 1)}└─ ` }));
|
|
391
|
+
const under = " ".repeat(Math.max(0, chain.length - 1));
|
|
392
|
+
if (laneCount + taskCount >= 2) {
|
|
393
|
+
const label = [laneCount ? plural(laneCount, "lane") : null, taskCount ? plural(taskCount, "task") : null].filter(Boolean).join(" · ");
|
|
394
|
+
lines.push({ fork: `${under}┬ ${label} in parallel` });
|
|
395
|
+
lanes.forEach((thread, index) => lines.push({ thread, lead: `${under}${index === lanes.length - 1 ? "└─" : "├─"} ` }));
|
|
396
|
+
} else {
|
|
397
|
+
lanes.forEach((thread) => lines.push({ thread, lead: chain.length ? `${under}└─ ` : "" }));
|
|
398
|
+
}
|
|
399
|
+
others.forEach((thread) => lines.push({ thread, lead: "" }));
|
|
400
|
+
const threads = lines.filter(({ thread }) => thread).map(({ thread }) => thread);
|
|
401
|
+
const nameCells = Math.min(28, Math.max(...threads.map(({ name }) => textWidth(name))));
|
|
402
|
+
const stageCells = Math.min(10, Math.max(0, ...threads.map(({ stage }) => (stage ? textWidth(stage) : 0))));
|
|
403
|
+
const out = [];
|
|
404
|
+
lines.forEach((line, index) => {
|
|
405
|
+
const y = ROW_Y[2] + THREAD_ROW_H * (index + 1);
|
|
406
|
+
const tail = index === lines.length - 1 && more > 0 ? `+${more} more` : null;
|
|
407
|
+
if (tail) out.push(text(width - pad, y, tail, { fill: C.dim, anchor: "end" }));
|
|
408
|
+
const room = Math.floor((width - pad * 2 - (tail ? widthOf(tail) + 16 : 0)) / SVG_CARD.cell);
|
|
409
|
+
if (line.fork) {
|
|
410
|
+
out.push(text(pad, y, truncateToWidth(line.fork, room), { fill: C.dim }));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const { thread } = line;
|
|
414
|
+
const [stateMark, color] = THREAD_FILL[thread.state] ?? THREAD_FILL.running;
|
|
415
|
+
const mark = thread.task ? TASK_MARK[thread.task] ?? "$" : stateMark;
|
|
416
|
+
const name = truncateToWidth(thread.name, nameCells);
|
|
417
|
+
const pieces = [
|
|
418
|
+
[line.lead, { fill: C.dim }],
|
|
419
|
+
[`${mark} `, { fill: color, bold: true }],
|
|
420
|
+
[name + " ".repeat(Math.max(0, nameCells - textWidth(name))), { fill: C.white, bold: thread.active }],
|
|
421
|
+
...(stageCells ? [[` ${truncateToWidth(thread.stage ?? "", stageCells).padEnd(stageCells)}`, { fill: C.dim }]] : []),
|
|
422
|
+
[` ${threadGauge(thread)}`, { fill: C.white }],
|
|
423
|
+
[` ${thread.state}`, { fill: color }],
|
|
424
|
+
...(thread.session ? [[` · other session ${thread.session}`, { fill: C.dim }]] : []),
|
|
425
|
+
];
|
|
426
|
+
// Pieces past the room are cut from the right, as the terminal card clips its rows.
|
|
427
|
+
let used = 0;
|
|
428
|
+
const kept = [];
|
|
429
|
+
for (const [body, style] of pieces) {
|
|
430
|
+
const cells = textWidth(body);
|
|
431
|
+
if (used + cells > room) {
|
|
432
|
+
if (room - used > 1) kept.push([truncateToWidth(body, room - used), style]);
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
kept.push([body, style]);
|
|
436
|
+
used += cells;
|
|
437
|
+
}
|
|
438
|
+
out.push(run(pad, y, kept).markup);
|
|
439
|
+
});
|
|
440
|
+
return out.join("");
|
|
441
|
+
};
|
|
442
|
+
|
|
363
443
|
const borderColor = (model, accent) => {
|
|
364
444
|
if (model.warnings.some(({ tone }) => tone === "red")) return C.red;
|
|
365
445
|
if (model.warnings.length) return C.amber;
|
|
366
446
|
return model.idle ? C.faint : accent;
|
|
367
447
|
};
|
|
368
448
|
|
|
449
|
+
// The rewind look's border (plans/lit-adhd.md D7): a rainbow gradient whose stops each walk the hue
|
|
450
|
+
// wheel over TIMINGS.hue while the card moves, so the colours cycle; with motion off it stands still.
|
|
451
|
+
const RAINBOW_STOPS = 6;
|
|
452
|
+
const rainbowDefs = (animate) => {
|
|
453
|
+
const stops = Array.from({ length: RAINBOW_STOPS + 1 }, (_, i) => {
|
|
454
|
+
const color = rainbowAt(i / RAINBOW_STOPS);
|
|
455
|
+
if (!animate) return `<stop offset="${(i / RAINBOW_STOPS).toFixed(3)}" stop-color="${color}"/>`;
|
|
456
|
+
const values = Array.from({ length: RAINBOW_STOPS + 1 }, (_, j) => rainbowAt((i + j) / RAINBOW_STOPS)).join(";");
|
|
457
|
+
return `<stop offset="${(i / RAINBOW_STOPS).toFixed(3)}" stop-color="${color}"><animate attributeName="stop-color" values="${values}" ${loop(TIMINGS.hue, 0.5)}/></stop>`;
|
|
458
|
+
});
|
|
459
|
+
return `<defs><linearGradient id="lit-rainbow" x1="0" x2="1" y1="0" y2="1">${stops.join("")}</linearGradient></defs>`;
|
|
460
|
+
};
|
|
461
|
+
|
|
369
462
|
/** What the card says, for a reader that cannot see the drawing. */
|
|
370
463
|
export const svgCardAlt = (model) => {
|
|
371
464
|
const parts = [`LIT ${model.idle ? "idle" : "working"}`];
|
|
@@ -380,6 +473,8 @@ export const svgCardAlt = (model) => {
|
|
|
380
473
|
parts.push(`phase ${LABELS[current]}`);
|
|
381
474
|
}
|
|
382
475
|
if (model.step) parts.push(`running ${model.step.name}`);
|
|
476
|
+
const threads = model.threads ? [...model.threads.chain, ...model.threads.lanes, ...model.threads.others] : [];
|
|
477
|
+
if (threads.length) parts.push(`threads ${threads.map((thread) => `${thread.name} ${gauge(thread.done, thread.total)} ${thread.state}`).join(", ")}${model.threads.more ? `, ${model.threads.more} more` : ""}`);
|
|
383
478
|
if (model.skills.length) parts.push(`skills ${model.skills.map(({ id }) => id).join(", ")}`);
|
|
384
479
|
const { context, rates } = model.figures;
|
|
385
480
|
if (context !== null) parts.push(`context ${context}%`);
|
|
@@ -392,14 +487,18 @@ export const svgCardAlt = (model) => {
|
|
|
392
487
|
* mod's setting; the drawing moves only while the model is not idle and motion is not off.
|
|
393
488
|
*/
|
|
394
489
|
export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } = {}) => {
|
|
395
|
-
const { width
|
|
490
|
+
const { width } = SVG_CARD;
|
|
491
|
+
// The thread rows sit between the detail line and the chips; the card grows by their reserve.
|
|
492
|
+
const shift = model.threads ? THREAD_ROW_H * model.threads.reserve : 0;
|
|
493
|
+
const height = SVG_CARD.height + shift;
|
|
396
494
|
const working = !model.idle && motion !== "off";
|
|
397
495
|
const animate = { breath: working, sweep: working && motion === "full", comet: working && motion === "full" };
|
|
398
|
-
const
|
|
496
|
+
const rewind = !model.idle && model.warnings.length === 0 && lookOf(model.discipline) === "rewind";
|
|
497
|
+
const edge = rewind ? "url(#lit-rainbow)" : borderColor(model, accent);
|
|
399
498
|
const perimeter = 1000;
|
|
400
|
-
const defs = animate.sweep
|
|
499
|
+
const defs = (rewind ? rainbowDefs(animate.breath) : "") + (animate.sweep
|
|
401
500
|
? `<defs><linearGradient id="lit-sweep" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="#fff" stop-opacity="0"/><stop offset="0.5" stop-color="#fff" stop-opacity="0.55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/><animateTransform attributeName="gradientTransform" type="translate" values="-1.2 0;1.2 0" ${loop(TIMINGS.sweep, 0.5)}/></linearGradient></defs>`
|
|
402
|
-
: "";
|
|
501
|
+
: "");
|
|
403
502
|
const frame = `<rect x="1" y="1" width="${width - 2}" height="${height - 2}" rx="14" fill="${C.bg}" stroke="${edge}" stroke-width="${model.idle ? "1.5" : "2.5"}"${model.idle ? ' stroke-opacity="0.8"' : ""}>`
|
|
404
503
|
+ (animate.breath && !model.warnings.length ? `<animate attributeName="stroke-opacity" values="0.85;1;0.85" ${loop(TIMINGS.breath, BREATH_PHASE)}/>` : "")
|
|
405
504
|
+ "</rect>";
|
|
@@ -411,8 +510,9 @@ export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } =
|
|
|
411
510
|
topRow(model, accent, animate),
|
|
412
511
|
model.workflow ? mapRowSvg(model, accent, animate) : phaseRow(model, accent, animate),
|
|
413
512
|
detailRowSvg(model, accent, animate),
|
|
414
|
-
|
|
415
|
-
|
|
513
|
+
model.threads ? threadRowsSvg(model) : "",
|
|
514
|
+
middleRow(model, accent, animate, shift),
|
|
515
|
+
bottomRow(model, accent, shift),
|
|
416
516
|
].join("");
|
|
417
517
|
const source = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" font-family="${FONT}" font-size="${SVG_CARD.font}">${defs}${frame}${comet}${body}</svg>`;
|
|
418
518
|
return { source, alt: svgCardAlt(model), animated: working };
|
|
@@ -100,10 +100,30 @@ export const clockShown = (timeline) => timeline.exitAt === null && Boolean(time
|
|
|
100
100
|
/** True while the ambient loop runs; the surface module then keeps a slower frame timer going. */
|
|
101
101
|
export const ambientActive = (timeline, profile) => Boolean(profile.ambient) && timeline.exitAt === null && timeline.ambient.on;
|
|
102
102
|
|
|
103
|
+
// The rewind look's sparks: fixed seeds (a small LCG, so every surface draws the same sky), each a
|
|
104
|
+
// starting place, a drift speed and a twinkle offset.
|
|
105
|
+
const SPARK_SEEDS = (() => {
|
|
106
|
+
let state = 13;
|
|
107
|
+
const next = () => {
|
|
108
|
+
state = (state * 1103515245 + 12345) % 2147483648;
|
|
109
|
+
return state / 2147483648;
|
|
110
|
+
};
|
|
111
|
+
return Object.freeze(Array.from({ length: 7 }, () => Object.freeze({ start: next(), speed: 0.6 + 0.8 * next(), twinkle: next() })));
|
|
112
|
+
})();
|
|
113
|
+
|
|
114
|
+
// Where each spark stands at `elapsed` (`x`, 0 to 1, drifting right to left) and which of the four
|
|
115
|
+
// ASCII sparks it shows (`glyph`, 0 to 3).
|
|
116
|
+
const sparksAt = (elapsed) => SPARK_SEEDS.map(({ start, speed, twinkle }) => {
|
|
117
|
+
const x = start - (elapsed * speed) / TIMINGS.sparks;
|
|
118
|
+
const t = elapsed / (TIMINGS.sparks / 4) + twinkle;
|
|
119
|
+
return { x: ((x % 1) + 1) % 1, glyph: Math.floor((((t % 1) + 1) % 1) * 4) };
|
|
120
|
+
});
|
|
121
|
+
|
|
103
122
|
// One frame of the ambient loop: `breath` (0 to 1 and back over TIMINGS.breath), where the light
|
|
104
123
|
// stands on the active phase (`sweep`, null between passes), how far the comet has gone around
|
|
105
|
-
// the card (`comet`, 0 to 1: the top rule left to right, then the bottom rule right to left)
|
|
106
|
-
// where the bright head stands on the rail leaving the current stage (`flow`, 0 to 1)
|
|
124
|
+
// the card (`comet`, 0 to 1: the top rule left to right, then the bottom rule right to left),
|
|
125
|
+
// where the bright head stands on the rail leaving the current stage (`flow`, 0 to 1), how far the
|
|
126
|
+
// rewind look's hue has turned (`hue`, 0 to 1 over TIMINGS.hue) and its sparks (`sparks`, full only).
|
|
107
127
|
const ambientSample = (timeline, now, profile) => {
|
|
108
128
|
if (!ambientActive(timeline, profile)) return null;
|
|
109
129
|
const elapsed = Math.max(0, now - timeline.ambient.at);
|
|
@@ -114,6 +134,8 @@ const ambientSample = (timeline, now, profile) => {
|
|
|
114
134
|
sweep: profile.ambient.sweep && pass >= -0.2 && pass <= 1.2 ? pass : null,
|
|
115
135
|
comet: profile.ambient.comet ? (elapsed % TIMINGS.comet) / TIMINGS.comet : null,
|
|
116
136
|
flow: profile.ambient.sweep ? (elapsed % TIMINGS.flow) / TIMINGS.flow : null,
|
|
137
|
+
hue: (elapsed % TIMINGS.hue) / TIMINGS.hue,
|
|
138
|
+
sparks: profile.ambient.sweep ? sparksAt(elapsed) : null,
|
|
117
139
|
};
|
|
118
140
|
};
|
|
119
141
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The toasts the mod raises when the LIT state really changes: a discipline starts or
|
|
1
|
+
// The toasts the mod raises when the LIT state really changes: a discipline starts, switches or resumes, the
|
|
2
2
|
// workflow stage moves, a goal is set or met, a lane starts or finishes. Pure: the mod keeps the last
|
|
3
3
|
// status it saw and a gate, and hands each new status in; what comes back is at most one short line
|
|
4
4
|
// to show, never more than one per TOAST_GAP_MS. Gate notices (state.mjs gates, the auto-handoff)
|
|
@@ -25,6 +25,8 @@ export const statusOf = ({ discipline, model, snapshot }, previous = null) => {
|
|
|
25
25
|
discipline: DISCIPLINE_ENTRY[discipline] ? discipline : previous?.discipline ?? null,
|
|
26
26
|
stage: stage && `${flow.family}:${stage}`,
|
|
27
27
|
goal: goal ? { key: goal.createdAt ?? goal.objective, objective: String(goal.objective ?? ""), status: goal.status, passed: goal.criteria.filter(({ status }) => status === "pass").length, total: goal.criteria.length } : null,
|
|
28
|
+
paused: flow?.paused?.parent ?? null,
|
|
29
|
+
place: stage && `${flow.stages[flow.current].id}${flow.paused?.count ?? flow.count ? ` ${(flow.paused?.count ?? flow.count).done}/${(flow.paused?.count ?? flow.count).total}` : ""}`,
|
|
28
30
|
lanes: Object.fromEntries((model?.lanes?.list ?? []).filter(({ id }) => id).map(({ id, name }) => [id, name])),
|
|
29
31
|
};
|
|
30
32
|
};
|
|
@@ -38,7 +40,8 @@ const laneEntries = (ids, names, verb) => {
|
|
|
38
40
|
export const statusChanges = (previous, next) => {
|
|
39
41
|
if (!previous) return [];
|
|
40
42
|
const entries = [];
|
|
41
|
-
if (next.
|
|
43
|
+
if (previous.paused && !next.paused && next.discipline === previous.paused) entries.push({ kind: "resumed", text: `resumed ${next.discipline}${next.place ? ` · ${next.place}` : ""}` });
|
|
44
|
+
else if (next.discipline && next.discipline !== previous.discipline) entries.push({ kind: "discipline", from: previous.discipline, to: next.discipline });
|
|
42
45
|
else if (next.stage && next.stage !== previous.stage) entries.push({ kind: "stage", text: `stage · ${next.stage.split(":")[1]}` });
|
|
43
46
|
const goal = next.goal;
|
|
44
47
|
const sameGoal = goal && previous.goal?.key === goal.key;
|