@litfamily/litgrok 1.0.26 → 1.0.28
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/.grok/hooks/lit-mark.mjs +42 -0
- package/.grok/hooks/lit-status-line.mjs +174 -21
- package/.grok/hooks/plan-gate.mjs +13 -3
- package/.grok/hooks/record-passive-event.mjs +40 -6
- package/.grok/hooks/session-end.json +15 -0
- package/.grok/hooks/session-end.mjs +6 -0
- package/.grok/hooks/session-liveness.mjs +102 -0
- package/.grok/hooks/session-rows.mjs +57 -0
- package/.grok/hooks/session-start.mjs +17 -0
- package/.grok/hooks/workflow-stage.mjs +5 -2
- package/.grok/rules/00-litgrok.md +14 -0
- package/.grok/skills/frontend-ui-ux/ATTRIBUTION.md +23 -0
- package/.grok/skills/frontend-ui-ux/SKILL.md +4 -1
- package/.grok/skills/frontend-ui-ux/examples/phase-3-readme-ab/README.md +9 -0
- package/.grok/skills/frontend-ui-ux/kit/components.css +414 -0
- package/.grok/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/.grok/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/.grok/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/.grok/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/.grok/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/.grok/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/.grok/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/.grok/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/.grok/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/.grok/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/.grok/skills/frontend-ui-ux/references/adaptive-layout.md +10 -4
- package/.grok/skills/frontend-ui-ux/references/brand-and-imagery.md +11 -7
- package/.grok/skills/frontend-ui-ux/references/complete-contract.md +21 -0
- package/.grok/skills/frontend-ui-ux/references/composition.md +10 -6
- package/.grok/skills/frontend-ui-ux/references/craft-floor.md +256 -93
- package/.grok/skills/frontend-ui-ux/references/creative-directions.md +9 -6
- package/.grok/skills/frontend-ui-ux/references/default-editorial-pixel.json +28 -0
- package/.grok/skills/frontend-ui-ux/references/house-styles.md +234 -0
- package/.grok/skills/frontend-ui-ux/references/implementation-platforms.md +10 -6
- package/.grok/skills/frontend-ui-ux/references/inclusive-interface.md +11 -5
- package/.grok/skills/frontend-ui-ux/references/interaction-motion.md +34 -78
- package/.grok/skills/frontend-ui-ux/references/motion-guide.md +10 -7
- package/.grok/skills/frontend-ui-ux/references/performance-delivery.md +11 -8
- package/.grok/skills/frontend-ui-ux/references/probe-loop.md +1 -1
- package/.grok/skills/frontend-ui-ux/references/product-direction.md +9 -4
- package/.grok/skills/frontend-ui-ux/references/production-interview.md +17 -0
- package/.grok/skills/frontend-ui-ux/references/redesign-playbook.md +10 -6
- package/.grok/skills/frontend-ui-ux/references/slop-register.md +148 -73
- package/.grok/skills/frontend-ui-ux/references/system-foundations.md +10 -4
- package/.grok/skills/frontend-ui-ux/references/visual-language.md +10 -4
- package/.grok/skills/frontend-ui-ux/references/visual-reconstruction.md +39 -72
- package/.grok/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/.grok/skills/frontend-ui-ux/scripts/interface-probe-driver.mjs +33 -0
- package/.grok/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
- package/.grok/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +1555 -0
- package/.grok/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +153 -0
- package/.grok/skills/frontend-ui-ux/scripts/interface-probe-server.mjs +57 -0
- package/.grok/skills/frontend-ui-ux/scripts/interface-probe-static.mjs +139 -0
- package/.grok/skills/frontend-ui-ux/scripts/interface-probe.mjs +363 -0
- package/.grok/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/.grok/skills/lit-adhd/SKILL.md +155 -0
- package/.grok/skills/lit-adhd/references/card-examples.md +131 -0
- package/.grok/skills/lit-adhd/references/status-taxonomy.md +50 -0
- package/.grok/skills/lit-adhd/scripts/lib/brief.mjs +421 -0
- package/.grok/skills/lit-adhd/scripts/lib/collect.mjs +395 -0
- package/.grok/skills/lit-adhd/scripts/lib/gauge.mjs +87 -0
- package/.grok/skills/lit-adhd/scripts/lib/next-step.mjs +22 -0
- package/.grok/skills/lit-adhd/scripts/lib/plan-task-rows.mjs +32 -0
- package/.grok/skills/lit-adhd/scripts/lib/project-state-root.mjs +55 -0
- package/.grok/skills/lit-adhd/scripts/lib/redact.mjs +64 -0
- package/.grok/skills/lit-adhd/scripts/lib/suggest.mjs +140 -0
- package/.grok/skills/lit-adhd/scripts/lib/transcripts.mjs +232 -0
- package/.grok/skills/lit-adhd/scripts/rewind.mjs +6 -0
- package/.grok/skills/lit-diagram-drawer/SKILL.md +17 -5
- package/.grok/skills/lit-diagram-drawer/references/output-spec.md +2 -2
- package/.grok/skills/lit-diagram-drawer/references/style-guide.md +20 -11
- package/.grok/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/.grok/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/.grok/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/.grok/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/.grok/skills/lit-diagram-drawer/references/verifier-guide.md +4 -0
- package/.grok/skills/lit-diagram-drawer/scripts/visual-quality.mjs +2 -2
- package/.grok/skills/lit-handoff/SKILL.md +2 -0
- package/.grok/skills/lit-hijack/SKILL.md +459 -0
- package/.grok/skills/lit-hijack/references/capture-and-provenance.md +124 -0
- package/.grok/skills/lit-hijack/references/clean-room-build.md +130 -0
- package/.grok/skills/lit-hijack/references/distil-and-licence.md +128 -0
- package/.grok/skills/lit-hijack/references/gap-and-port-design.md +150 -0
- package/.grok/skills/lit-hijack/references/parity-and-report.md +130 -0
- package/.grok/skills/lit-hijack/scripts/hijack.mjs +890 -0
- package/.grok/skills/lit-hijack/scripts/lib/safe-fetch.mjs +213 -0
- package/.grok/skills/lit-plan/SKILL.md +3 -1
- package/.grok/skills/lit-plan/references/plan-schema.md +4 -0
- package/.grok/skills/lit-plan/scripts/scaffold-plan.mjs +9 -2
- package/.grok/skills/lit-plan/scripts/scope-roots.mjs +83 -0
- package/.grok/skills/lit-pptx/SKILL.md +10 -5
- package/.grok/skills/lit-pptx/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/.grok/skills/lit-pptx/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/.grok/skills/lit-pptx/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/.grok/skills/lit-pptx/examples/16-community-programme-riso-ko.md +158 -0
- package/.grok/skills/lit-pptx/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/.grok/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/.grok/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/.grok/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/.grok/skills/lit-pptx/fonts/jetbrains-mono/provenance.json +1 -0
- package/.grok/skills/lit-pptx/references/direction-step.md +34 -8
- package/.grok/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/.grok/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/.grok/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/.grok/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/.grok/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/.grok/skills/lit-pptx/scripts/compile-deck.js +1 -1
- package/.grok/skills/lit-pptx/scripts/craft_extras.py +61 -3
- package/.grok/skills/lit-pptx/scripts/deck_output.py +76 -62
- package/.grok/skills/lit-pptx/scripts/embed_fonts.py +14 -1
- package/.grok/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/.grok/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/.grok/skills/lit-pptx/scripts/lib/render-pack.js +389 -582
- package/.grok/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/.grok/skills/lit-pptx/scripts/lib/template-registry.js +60 -8
- package/.grok/skills/lit-pptx/scripts/qa_deck.py +4 -4
- package/.grok/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +2 -0
- package/.grok/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/.grok/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +2 -0
- package/.grok/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/.grok/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +2 -0
- package/.grok/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +2 -0
- package/.grok/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/.grok/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/.grok/skills/lit-pptx/templates/tonalities/night/pack.yaml +2 -0
- package/.grok/skills/lit-pptx/templates/tonalities/paper/pack.yaml +2 -0
- package/.grok/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/.grok/skills/lit-pptx/templates/tonalities/signal/pack.yaml +3 -0
- package/.grok/skills/lit-pptx/templates/tonalities/studio/pack.yaml +2 -0
- package/.grok/skills/lit-recap/SKILL.md +1 -1
- package/.grok/skills/lit-schematic/SKILL.md +140 -0
- package/.grok/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/.grok/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/.grok/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/.grok/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/.grok/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/.grok/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/.grok/skills/lit-schematic/references/journal-figures.md +72 -0
- package/.grok/skills/lit-schematic/references/kit-api.md +134 -0
- package/.grok/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/.grok/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/.grok/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/.grok/skills/lit-schematic/references/verification.md +100 -0
- package/.grok/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/.grok/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/.grok/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
- package/.grok/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/.grok/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/.grok/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/.grok/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/.grok/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/.grok/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/.grok/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/.grok/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/.grok/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/.grok/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/.grok/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/.grok/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/.grok/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/.grok/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/.grok/skills/lit-schematic/scripts/render.mjs +233 -0
- package/.grok/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/.grok/skills/lit-scientific-visualization/SKILL.md +36 -12
- package/.grok/skills/lit-typographic-motion/SKILL.md +7 -4
- package/.grok/skills/lit-typographic-motion/THIRD_PARTY_NOTICES +11 -0
- package/.grok/skills/lit-typographic-motion/recipes/hero-3d/expected.json +62 -0
- package/.grok/skills/lit-typographic-motion/recipes/hero-3d/index.html +82 -0
- package/.grok/skills/lit-typographic-motion/references/choice-first.md +30 -0
- package/.grok/skills/lit-typographic-motion/references/cover.md +10 -1
- package/.grok/skills/lit-typographic-motion/references/depth.md +119 -0
- package/.grok/skills/lit-typographic-motion/references/treatment.md +9 -1
- package/.grok/skills/lit-typographic-motion/scripts/blender/runner.py +218 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/assets.mjs +230 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/blender.mjs +136 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/board.mjs +153 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/chrome.mjs +61 -32
- package/.grok/skills/lit-typographic-motion/scripts/lib/constants.mjs +4 -2
- package/.grok/skills/lit-typographic-motion/scripts/lib/cover-capture.mjs +20 -11
- package/.grok/skills/lit-typographic-motion/scripts/lib/cover-treatment.mjs +26 -2
- package/.grok/skills/lit-typographic-motion/scripts/lib/cover.mjs +12 -5
- package/.grok/skills/lit-typographic-motion/scripts/lib/frame-pool.mjs +78 -1
- package/.grok/skills/lit-typographic-motion/scripts/lib/gallery.mjs +160 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/house.mjs +43 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/look.mjs +39 -1
- package/.grok/skills/lit-typographic-motion/scripts/lib/scaffold.mjs +174 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/score.mjs +640 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/sound.mjs +143 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/soundtrack.mjs +12 -3
- package/.grok/skills/lit-typographic-motion/scripts/lib/stage-gate.mjs +44 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/stage-qa.mjs +132 -3
- package/.grok/skills/lit-typographic-motion/scripts/lib/stage-session.mjs +51 -3
- package/.grok/skills/lit-typographic-motion/scripts/lib/stage.mjs +74 -9
- package/.grok/skills/lit-typographic-motion/scripts/lib/styles.mjs +224 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/treatment.mjs +198 -4
- package/.grok/skills/lit-typographic-motion/scripts/lib/vendor/three/LICENSE +21 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/.grok/skills/lit-typographic-motion/scripts/lib/vendor/three/three.module.js +54571 -0
- package/.grok/skills/lit-typographic-motion/scripts/motion.mjs +56 -6
- package/.grok/skills/lit-typographic-motion/scripts/stage/cover-init.js +20 -8
- package/.grok/skills/lit-typographic-motion/scripts/stage/loop-kit.js +2 -2
- package/.grok/skills/lit-typographic-motion/scripts/stage/stage-kit.js +25 -0
- package/.grok/skills/lit-typographic-motion/styles/paper.json +1 -0
- package/.grok/skills/lit-typographic-motion/styles/swiss-signal.json +1 -0
- package/.grok/skills/lit-typographic-motion/styles/terminalcore.json +1 -0
- package/.grok/skills/lit-typographic-motion/styles/tidal.json +1 -0
- package/.grok/skills/litgrok/SKILL.md +1 -1
- package/.grok/skills/litresearch/SKILL.md +2 -0
- package/.grok/skills/readme-studio/SKILL.md +14 -12
- package/.grok/skills/readme-studio/references/choice-first.md +24 -0
- package/.grok/skills/start-work/SKILL.md +8 -1
- package/.grok-plugin/plugin.json +4 -1
- package/CHANGELOG.md +18 -0
- package/README.md +11 -11
- package/README_ko-KR.md +11 -11
- package/TRADEMARK.md +12 -0
- package/bin/litgrok.mjs +2 -0
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/assets/showcase/brief.webp +0 -0
- package/docs/assets/showcase/deck.webp +0 -0
- package/docs/assets/showcase/page.webp +0 -0
- package/docs/assets/showcase/pid.webp +0 -0
- 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/reference.md +11 -7
- package/docs/reference_ko-KR.md +11 -7
- package/hooks/hooks.json +11 -0
- package/package.json +6 -1
- package/plugin.json +1 -1
- package/.grok/skills/frontend-ui-ux/scripts/page-probe.mjs +0 -105
- package/.grok/skills/frontend-ui-ux/scripts/probe.mjs +0 -91
- package/.grok/skills/frontend-ui-ux/scripts/rule-data.mjs +0 -56
- package/.grok/skills/frontend-ui-ux/scripts/static-probe.mjs +0 -27
- package/.grok/skills/frontend-ui-ux/scripts/static-server.mjs +0 -19
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// The SessionStart nudge toward lit-adhd: when this project has other recent Grok Build sessions,
|
|
2
|
+
// suggest `lit adhd` once a day, naming the one to answer, resume or check on. It stats file times,
|
|
3
|
+
// never reads contents, so it stays cheap on every session start. A marker under
|
|
4
|
+
// `.grok/litgrok/adhd/` keeps it to one nudge per calendar day per project. The marker path is
|
|
5
|
+
// walked with lstat and refuses symlinks, and the marker itself is opened with O_NOFOLLOW, so a
|
|
6
|
+
// planted link can neither redirect the write nor leak another file's contents into the read.
|
|
7
|
+
import { closeSync, constants, lstatSync, mkdirSync, openSync, readSync, readdirSync, writeSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { ensureStateDirIgnored } from "./project-state-root.mjs";
|
|
10
|
+
|
|
11
|
+
export const RECENT_MS = 3 * 24 * 60 * 60 * 1000;
|
|
12
|
+
const SCAN_LIMIT = 400;
|
|
13
|
+
|
|
14
|
+
const dayOf = (now) => new Date(now).toISOString().slice(0, 10);
|
|
15
|
+
|
|
16
|
+
const storeDirs = (storeDir) => {
|
|
17
|
+
try {
|
|
18
|
+
return readdirSync(storeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).slice(0, SCAN_LIMIT);
|
|
19
|
+
} catch {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Session folders of this project: the store folder whose decoded name is the project root.
|
|
25
|
+
export const recentOtherSessions = (storeDir, projectRoot, sessionId, now = Date.now()) => {
|
|
26
|
+
const wanted = projectRoot.normalize("NFC");
|
|
27
|
+
let count = 0;
|
|
28
|
+
for (const folder of storeDirs(storeDir)) {
|
|
29
|
+
let decoded;
|
|
30
|
+
try {
|
|
31
|
+
decoded = decodeURIComponent(folder.name).normalize("NFC");
|
|
32
|
+
} catch {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (decoded !== wanted) continue;
|
|
36
|
+
let sessions;
|
|
37
|
+
try {
|
|
38
|
+
sessions = readdirSync(join(storeDir, folder.name), { withFileTypes: true }).filter((entry) => entry.isDirectory());
|
|
39
|
+
} catch {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
for (const session of sessions.slice(0, SCAN_LIMIT)) {
|
|
43
|
+
if (session.name === sessionId) continue;
|
|
44
|
+
try {
|
|
45
|
+
const at = lstatSync(join(storeDir, folder.name, session.name));
|
|
46
|
+
if (at.isDirectory() && now - at.mtimeMs < RECENT_MS) count += 1;
|
|
47
|
+
} catch {
|
|
48
|
+
// A session that vanished mid-scan is not recent.
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return count;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The one-line suggestion, or null when there is nothing to suggest or it was already made today.
|
|
57
|
+
* Making it records today's date in `.grok/litgrok/adhd/suggested.json`.
|
|
58
|
+
*/
|
|
59
|
+
// Every part of the marker directory must already be a real directory: a symlink anywhere on
|
|
60
|
+
// the path refuses the write, and the marker itself is never followed, read or written.
|
|
61
|
+
const markerDir = (stateRoot) => {
|
|
62
|
+
const parts = [stateRoot, ".grok", "litgrok", "adhd"];
|
|
63
|
+
let cursor = parts[0];
|
|
64
|
+
for (const part of parts.slice(1)) {
|
|
65
|
+
cursor = join(cursor, part);
|
|
66
|
+
let status;
|
|
67
|
+
try {
|
|
68
|
+
status = lstatSync(cursor);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (error?.code !== "ENOENT") return null;
|
|
71
|
+
try {
|
|
72
|
+
mkdirSync(cursor);
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (!status.isDirectory() || status.isSymbolicLink()) return null;
|
|
79
|
+
}
|
|
80
|
+
// State stays uncommitted, but the ignore marker lives beside the state, never beside the
|
|
81
|
+
// committed skills, rules and hooks one level up.
|
|
82
|
+
ensureStateDirIgnored(cursor);
|
|
83
|
+
return cursor;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const noFollow = constants.O_NOFOLLOW ?? 0;
|
|
87
|
+
|
|
88
|
+
const readMarker = (marker) => {
|
|
89
|
+
let descriptor;
|
|
90
|
+
try {
|
|
91
|
+
descriptor = openSync(marker, constants.O_RDONLY | noFollow);
|
|
92
|
+
} catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const status = lstatSync(marker);
|
|
97
|
+
if (!status.isFile() || status.isSymbolicLink() || status.size > 1024) return null;
|
|
98
|
+
const buffer = Buffer.alloc(status.size);
|
|
99
|
+
const read = readSync(descriptor, buffer, 0, status.size, 0);
|
|
100
|
+
return JSON.parse(buffer.subarray(0, read).toString("utf8"));
|
|
101
|
+
} catch {
|
|
102
|
+
return null;
|
|
103
|
+
} finally {
|
|
104
|
+
closeSync(descriptor);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const writeMarker = (marker, day) => {
|
|
109
|
+
let descriptor;
|
|
110
|
+
try {
|
|
111
|
+
descriptor = openSync(marker, constants.O_WRONLY | constants.O_CREAT | constants.O_TRUNC | noFollow, 0o600);
|
|
112
|
+
} catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
writeSync(descriptor, `${JSON.stringify({ day })}\n`);
|
|
117
|
+
return true;
|
|
118
|
+
} catch {
|
|
119
|
+
return false;
|
|
120
|
+
} finally {
|
|
121
|
+
closeSync(descriptor);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const adhdSuggestion = ({ storeDir, projectRoot, sessionId, stateRoot, now = Date.now() }) => {
|
|
126
|
+
const count = recentOtherSessions(storeDir, projectRoot, sessionId, now);
|
|
127
|
+
if (count === 0) return null;
|
|
128
|
+
const directory = markerDir(stateRoot);
|
|
129
|
+
if (directory === null) return null;
|
|
130
|
+
const marker = join(directory, "suggested.json");
|
|
131
|
+
try {
|
|
132
|
+
if (readMarker(marker)?.day === dayOf(now)) return null;
|
|
133
|
+
} catch {
|
|
134
|
+
// An unreadable marker suggests once, then the write below records it.
|
|
135
|
+
}
|
|
136
|
+
if (!writeMarker(marker, dayOf(now))) return null;
|
|
137
|
+
return count === 1
|
|
138
|
+
? "One other recent session is on record: type `lit adhd` for the brief before you resume it."
|
|
139
|
+
: `${count} other recent sessions are on record: type ` + "`lit adhd`" + " for the one-screen brief before you resume any.";
|
|
140
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// Grok Build session records for the lit-adhd collector. Grok keeps one directory per session
|
|
2
|
+
// under `<store>/sessions/<url-encoded cwd>/<session-uuid>/` with `summary.json` (title, times),
|
|
3
|
+
// `chat_history.jsonl` (`{type, content}` records), `events.jsonl` (`{ts, type}` tool events) and
|
|
4
|
+
// `prompt_context.json`. The format is private and may move, so every field is read defensively and
|
|
5
|
+
// anything missing reads as unknown. Session files are read head and tail only, under a budget
|
|
6
|
+
// shared by the whole run, through descriptors opened without following links. Only the session's
|
|
7
|
+
// own project folder is ever listed: the store is never scanned blindly.
|
|
8
|
+
|
|
9
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, readdirSync, realpathSync } from "node:fs";
|
|
10
|
+
import { join, relative, resolve } from "node:path";
|
|
11
|
+
|
|
12
|
+
export const HEAD_BYTES = 64 * 1024;
|
|
13
|
+
export const TAIL_BYTES = 256 * 1024;
|
|
14
|
+
export const TOTAL_BUDGET_BYTES = 8 * 1024 * 1024;
|
|
15
|
+
const ACTIVE_MS = 15 * 60 * 1000;
|
|
16
|
+
|
|
17
|
+
/** A byte budget shared by every read of one collector run. */
|
|
18
|
+
export const makeBudget = (limit = TOTAL_BUDGET_BYTES) => ({ limit, used: 0, exhausted: false });
|
|
19
|
+
|
|
20
|
+
const readSlice = (fd, position, length, budget) => {
|
|
21
|
+
const allowed = Math.min(length, budget.limit - budget.used);
|
|
22
|
+
if (allowed <= 0) {
|
|
23
|
+
budget.exhausted = true;
|
|
24
|
+
return "";
|
|
25
|
+
}
|
|
26
|
+
const buffer = Buffer.alloc(allowed);
|
|
27
|
+
const read = readSync(fd, buffer, 0, allowed, position);
|
|
28
|
+
budget.used += read;
|
|
29
|
+
if (allowed < length) budget.exhausted = true;
|
|
30
|
+
return buffer.subarray(0, read).toString("utf8");
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** The parsed lines of a JSONL file's head and tail; a link or a non-file reads as null. */
|
|
34
|
+
export const readJsonlHeadTail = (path, budget, { head = HEAD_BYTES, tail = TAIL_BYTES } = {}) => {
|
|
35
|
+
let fd;
|
|
36
|
+
try {
|
|
37
|
+
if (!lstatSync(path).isFile()) return null;
|
|
38
|
+
fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
39
|
+
const { size } = fstatSync(fd);
|
|
40
|
+
const chunks = size <= head + tail
|
|
41
|
+
? [readSlice(fd, 0, size, budget)]
|
|
42
|
+
: [readSlice(fd, 0, head, budget), readSlice(fd, size - tail, tail, budget)];
|
|
43
|
+
const lines = [];
|
|
44
|
+
for (const chunk of chunks) {
|
|
45
|
+
for (const line of chunk.split("\n")) {
|
|
46
|
+
if (!line.trim()) continue;
|
|
47
|
+
try {
|
|
48
|
+
const parsed = JSON.parse(line);
|
|
49
|
+
if (parsed && typeof parsed === "object") lines.push(parsed);
|
|
50
|
+
} catch {
|
|
51
|
+
// A line cut at a slice edge, or a malformed one, is skipped.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return lines;
|
|
56
|
+
} catch {
|
|
57
|
+
return null;
|
|
58
|
+
} finally {
|
|
59
|
+
if (fd !== undefined) closeSync(fd);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const readJsonFile = (path, budget) => {
|
|
64
|
+
let fd;
|
|
65
|
+
try {
|
|
66
|
+
if (!lstatSync(path).isFile()) return null;
|
|
67
|
+
fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
68
|
+
const { size } = fstatSync(fd);
|
|
69
|
+
const text = readSlice(fd, 0, Math.min(size, 65536), budget);
|
|
70
|
+
return JSON.parse(text);
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
} finally {
|
|
74
|
+
if (fd !== undefined) closeSync(fd);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const newestFirst = (paths) => paths
|
|
79
|
+
.map((path) => {
|
|
80
|
+
try {
|
|
81
|
+
return { path, mtimeMs: lstatSync(path).mtimeMs };
|
|
82
|
+
} catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.filter(Boolean)
|
|
87
|
+
.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
88
|
+
|
|
89
|
+
// The store encodes the cwd with encodeURIComponent; decoding recovers it for comparison. A name
|
|
90
|
+
// that does not decode is never matched, so an unrelated folder cannot leak in.
|
|
91
|
+
const decodeStoreName = (name) => {
|
|
92
|
+
try {
|
|
93
|
+
return decodeURIComponent(name);
|
|
94
|
+
} catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The session directories of every given worktree path, newest first, and whether the store was
|
|
101
|
+
* there at all. Each worktree path matches the decoded store folder name exactly.
|
|
102
|
+
*/
|
|
103
|
+
export const findSessions = (storeDir, paths) => {
|
|
104
|
+
let folders;
|
|
105
|
+
try {
|
|
106
|
+
if (!lstatSync(storeDir).isDirectory()) return { status: "unknown", dirs: [] };
|
|
107
|
+
folders = readdirSync(storeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory());
|
|
108
|
+
} catch {
|
|
109
|
+
return { status: "unknown", dirs: [] };
|
|
110
|
+
}
|
|
111
|
+
// The store encodes the cwd as the host gave it, which may run through a symlink (/tmp on
|
|
112
|
+
// macOS is /private/tmp): canonicalize both sides with realpath before comparing.
|
|
113
|
+
const canonical = (path) => {
|
|
114
|
+
try {
|
|
115
|
+
return realpathSync(path).normalize("NFC");
|
|
116
|
+
} catch {
|
|
117
|
+
return resolve(path).normalize("NFC");
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const wanted = new Set(paths.map(canonical));
|
|
121
|
+
const dirs = new Set();
|
|
122
|
+
for (const folder of folders) {
|
|
123
|
+
const decoded = decodeStoreName(folder.name);
|
|
124
|
+
if (decoded === null) continue;
|
|
125
|
+
// A name that does not decode is never matched, so an unrelated folder cannot leak in.
|
|
126
|
+
if (!wanted.has(canonical(decoded))) continue;
|
|
127
|
+
let sessions;
|
|
128
|
+
try {
|
|
129
|
+
sessions = readdirSync(join(storeDir, folder.name), { withFileTypes: true }).filter((entry) => entry.isDirectory());
|
|
130
|
+
} catch {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
for (const session of sessions) dirs.add(join(storeDir, folder.name, session.name));
|
|
134
|
+
}
|
|
135
|
+
return { status: "ok", dirs: newestFirst([...dirs]).map(({ path }) => path) };
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const textOf = (content) => {
|
|
139
|
+
if (typeof content === "string") return content;
|
|
140
|
+
if (!Array.isArray(content)) return "";
|
|
141
|
+
return content.filter((part) => part?.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
|
|
142
|
+
};
|
|
143
|
+
const clip = (text, max) => {
|
|
144
|
+
const flat = String(text).replace(/\s+/gu, " ").trim();
|
|
145
|
+
return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
|
|
146
|
+
};
|
|
147
|
+
const WAITING_TEXT = /[??]\s*$|`?lit approve`?|`?lit deny`?|승인해\s*주|확인해\s*주|괜찮을까요|할까요|어떻게 할까요/iu;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* One session's record from its store files: what it was asked, what it did, what it said last,
|
|
151
|
+
* and where it stands. `redact` runs over every text field it returns.
|
|
152
|
+
*/
|
|
153
|
+
export const sessionRecord = (dir, { redact = (text) => text, now = Date.now(), budget = makeBudget() } = {}) => {
|
|
154
|
+
const summary = readJsonFile(join(dir, "summary.json"), budget);
|
|
155
|
+
const history = readJsonlHeadTail(join(dir, "chat_history.jsonl"), budget) ?? [];
|
|
156
|
+
const events = readJsonlHeadTail(join(dir, "events.jsonl"), budget) ?? [];
|
|
157
|
+
const sessionId = typeof summary?.info?.id === "string" ? summary.info.id : dir.split("/").at(-1) ?? null;
|
|
158
|
+
if (!sessionId) return null;
|
|
159
|
+
const cwd = typeof summary?.info?.cwd === "string" ? summary.info.cwd : "unknown";
|
|
160
|
+
const branch = typeof summary?.info?.git_branch === "string" && summary.info.git_branch ? summary.info.git_branch : "unknown";
|
|
161
|
+
const started = Date.parse(summary?.info?.created_at) || Date.parse(summary?.created_at);
|
|
162
|
+
const lastSummary = Date.parse(summary?.info?.updated_at) || Date.parse(summary?.updated_at);
|
|
163
|
+
let last = Number.isFinite(lastSummary) ? lastSummary : null;
|
|
164
|
+
let lastEntry = null;
|
|
165
|
+
const prompts = [];
|
|
166
|
+
const tools = {};
|
|
167
|
+
const files = [];
|
|
168
|
+
let result = null;
|
|
169
|
+
let lastAction = null;
|
|
170
|
+
for (const line of history) {
|
|
171
|
+
if (typeof line.ts === "string" || typeof line.timestamp === "string") {
|
|
172
|
+
const at = Date.parse(line.ts ?? line.timestamp);
|
|
173
|
+
if (Number.isFinite(at)) last = last === null ? at : Math.max(last, at);
|
|
174
|
+
}
|
|
175
|
+
if (line.type === "user" && typeof line.content === "string" && line.content.trim()) {
|
|
176
|
+
const text = line.content.trim();
|
|
177
|
+
if (!text.startsWith("<") || !/^<(?:system-reminder|command-|local-command)/u.test(text)) {
|
|
178
|
+
prompts.push(text);
|
|
179
|
+
lastEntry = { role: "user", text };
|
|
180
|
+
}
|
|
181
|
+
} else if (line.type === "user" && line.content !== undefined) {
|
|
182
|
+
const text = textOf(line.content).trim();
|
|
183
|
+
if (text) {
|
|
184
|
+
prompts.push(text);
|
|
185
|
+
lastEntry = { role: "user", text };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (line.type === "assistant" && typeof line.content === "string" && line.content.trim()) {
|
|
189
|
+
result = line.content.trim();
|
|
190
|
+
lastEntry = { role: "assistant", text: result };
|
|
191
|
+
} else if (line.type === "assistant" && line.content !== undefined) {
|
|
192
|
+
const text = textOf(line.content).trim();
|
|
193
|
+
if (text) {
|
|
194
|
+
result = text;
|
|
195
|
+
lastEntry = { role: "assistant", text };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
for (const event of events) {
|
|
200
|
+
const at = Date.parse(event.ts);
|
|
201
|
+
if (Number.isFinite(at)) last = last === null ? at : Math.max(last, at);
|
|
202
|
+
const name = typeof event.tool === "string" ? event.tool : typeof event.type === "string" && event.type.startsWith("tool:") ? event.type.slice(5) : null;
|
|
203
|
+
if (name) {
|
|
204
|
+
tools[name] = (tools[name] ?? 0) + 1;
|
|
205
|
+
const target = typeof event.target === "string" ? event.target : typeof event.file === "string" ? event.file.split("/").at(-1) : null;
|
|
206
|
+
lastAction = { tool: name, ...(target ? { target } : {}) };
|
|
207
|
+
if (lastEntry?.role !== "assistant" || !result) lastEntry = { role: "tool" };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const title = summary?.session_summary ?? summary?.info?.title ?? prompts[0] ?? "unknown";
|
|
211
|
+
const changed = [...new Set(files.reverse())].slice(0, 5).map((path) => redact(path));
|
|
212
|
+
const asked = [...new Set([prompts[0], prompts.at(-1)].filter(Boolean))].slice(0, 2).map((text) => clip(redact(text), 160));
|
|
213
|
+
const waiting = lastEntry?.role === "assistant" && WAITING_TEXT.test(lastEntry.text.slice(-400));
|
|
214
|
+
const status = last === null ? "unknown" : waiting ? "waiting-on-user" : now - last < ACTIVE_MS ? "active" : "ended";
|
|
215
|
+
return {
|
|
216
|
+
sessionId,
|
|
217
|
+
id8: sessionId.slice(0, 8),
|
|
218
|
+
worktree: cwd !== "unknown" ? redact(cwd) : "unknown",
|
|
219
|
+
cwd,
|
|
220
|
+
branch: redact(branch),
|
|
221
|
+
started: Number.isFinite(started) ? new Date(started).toISOString() : "unknown",
|
|
222
|
+
last: last === null ? "unknown" : new Date(last).toISOString(),
|
|
223
|
+
lastMs: last,
|
|
224
|
+
title: clip(redact(title ?? "unknown"), 80),
|
|
225
|
+
asked: asked.length ? asked : ["unknown"],
|
|
226
|
+
done: { tools, files: changed, commits: [] },
|
|
227
|
+
lastAction: lastAction ? { tool: lastAction.tool, ...(lastAction.target ? { target: clip(redact(lastAction.target), 60) } : {}) } : null,
|
|
228
|
+
result: result ? clip(redact(result), 240) : "unknown",
|
|
229
|
+
status,
|
|
230
|
+
...(waiting ? { waitingReason: "asked the user" } : {}),
|
|
231
|
+
};
|
|
232
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The lit-adhd record collector. Run by absolute path from the SKILL.md procedure; never from the
|
|
3
|
+
// working directory or another cached copy.
|
|
4
|
+
import { runRewindCli } from "./lib/collect.mjs";
|
|
5
|
+
|
|
6
|
+
process.exitCode = runRewindCli(process.argv.slice(2));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lit-diagram-drawer
|
|
3
|
-
description: Create clear, accessible, Korean-ready diagrams for architecture, workflows, systems, data models, timelines, and quantitative relationships. Use for conceptual diagrams; use frontend-ui-ux for interfaces and lit-scientific-visualization for plots of measured data.
|
|
3
|
+
description: Create clear, accessible, Korean-ready diagrams for architecture, workflows, systems, data models, timelines, and quantitative relationships. Use for conceptual diagrams; use frontend-ui-ux for interfaces, lit-schematic for real equipment and P&IDs, and lit-scientific-visualization for plots of measured data.
|
|
4
4
|
user-invocable: true
|
|
5
5
|
argument-hint: "<brief>"
|
|
6
6
|
---
|
|
@@ -42,18 +42,30 @@ The line is advisory prompt guidance. It does not prove that Grok Build selected
|
|
|
42
42
|
- Use this skill for system maps, process diagrams, schemas, decision paths, schedules, ownership maps, and conceptual charts in the catalog.
|
|
43
43
|
- Route pages, dashboards, responsive application screens, and interaction design to [frontend-ui-ux](../frontend-ui-ux/SKILL.md).
|
|
44
44
|
- Route measured scientific data, statistical inference, uncertainty, and instrument output to [lit-scientific-visualization](../lit-scientific-visualization/SKILL.md).
|
|
45
|
+
- Route drawings of physical equipment to [lit-schematic](../lit-schematic/SKILL.md): a P&ID, PFD or BFD, an equipment layout, a journal figure of an experimental apparatus, or an isometric or cutaway view of a vessel, exchanger or machine. A box-and-arrow sketch of a process stays here.
|
|
45
46
|
- Use prose, a table, or a short list when it carries the same meaning more plainly.
|
|
46
47
|
|
|
47
48
|
## Fixed procedure
|
|
48
49
|
|
|
50
|
+
### Choose the design first
|
|
51
|
+
|
|
52
|
+
The user has the right to choose how the diagram looks. Before the content brief, the layout budget or any HTML, ask which design to build: put the numbered choice in the reply with the option your reading of the brief favours first and marked recommended, a one-line description each, and a small ASCII sketch of the result. Ask only what is open, at most four questions:
|
|
53
|
+
|
|
54
|
+
1. Type ("Which layout?"): only when two or more entries of `references/type-catalog.json` answer the reader's question, with the best two to four as options (for a request-path question, for instance `architecture`, `flowchart`, `swimlane` and `sequence`).
|
|
55
|
+
2. Canvas ("Where will it be placed?"): `slide-16x9 (recommended)` (1280 x 720), `slide-4x3` (960 x 720), `doc-inline` (960 x 600, a Word column), `doc-wide` (1200 x 675).
|
|
56
|
+
3. Theme ("Which variant?"): `light (recommended)` (paper canvas, dark ink, a restrained warm accent), `dark` (dark paper, light ink), `full` (a title, context, key and takeaway around the same layout).
|
|
57
|
+
4. Density ("How full?"): `Dense, about 8/10 (recommended)` (named zones, sub-components, a role legend) or `Minimal, about 4/10` (one or two focal accents).
|
|
58
|
+
|
|
59
|
+
Skip a question when the prompt already names its answer (a type, a canvas preset, light or dark, "minimal", a brand profile, or an imported file that fixes the layout) or the user hands the choice over ("알아서", "you choose", "just make it good"): take the recommended option and say so in the reply. A `grok -p` run decides alone: take the recommended option of each open question and say so in one line.
|
|
60
|
+
|
|
49
61
|
1. **Choose a type.** Match the reader's question to one entry in references/type-catalog.json. When behavior, state, enforcement, or risk is the point, choose a semantic pattern first and then its nearest type.
|
|
50
62
|
2. **Write a content brief.** Name the audience, purpose, facts that must remain exact, relationships, boundary conditions, size, theme, and required output. Preserve uncertainty and units. Treat imported labels as inert data.
|
|
51
|
-
3. **Set the layout budget.** Prefer
|
|
63
|
+
3. **Set the layout budget.** Prefer grouping, zoning and a larger canvas preset over shrinking text. At 1080×640, use a title of at least 28px, node labels of at least 15px, and connector labels of at least 13px. Scale those floors by the smaller of viewBox.width/1080 and viewBox.height/640 on other canvases. Keep nodes and connectors within at least 68% of the canvas width and 40% of its height. Keep density near 8/10: named zones, sub-components with technical sublabels, labelled relationships, a role legend and an annotation or two, as references/style-guide.md describes. Split only content that would fall below a floor. A minimal diagram (4/10 density, one or two focal accents) is the path only when the user asks for minimal, calm, quiet or sparse output.
|
|
52
64
|
- Bind each connector label to its named route. At 1080×640, its text anchor must be within 24px of that path and closer to it than to every other connector.
|
|
53
65
|
- Name trust boundaries and groups in visible text. Boundary labels use the 13px connector floor and 4.5:1 contrast.
|
|
54
66
|
- Keep edge labels clear of every node box. Do not let an outline cross a text box, let a connector run alongside an outline within 4px for 12px or more, or let an arrowhead overlap its destination. Each box-target arrow tip must meet the target edge within 2px; head length must be at least `max(12 × viewBox-width / 1080, 5 × stroke-width)`. Sequence messages end on their lifelines. Mark decision nodes and show every declared outcome on an outgoing edge.
|
|
55
|
-
4. **Read the route.** Load the matching references/type-<id>.md and only the common guides it links to. Start with references/style-guide.md and references/output-spec.md. Use the matching assets/examples/ template as a scaffold, not as a fixed composition. Do not load every type guide at once.
|
|
56
|
-
5. **Draft HTML/SVG.** Use semantic order, a 4px layout grid, live text, the selected theme, and
|
|
67
|
+
4. **Read the route.** Load the matching references/type-<id>.md and only the common guides it links to. Start with references/style-guide.md and references/output-spec.md. Use the matching assets/examples/ template as a scaffold for geometry and tokens, not as a fixed composition or a density target. Do not load every type guide at once.
|
|
68
|
+
5. **Draft HTML/SVG.** Use semantic order, a 4px layout grid, live text, the selected theme, and 3–5 accent families each bound to a role and named in a legend (fewer only on a minimal request). Keep a complete static state available.
|
|
57
69
|
6. **Verify.** Run scripts/verify-diagram.mjs, scripts/verify-type.mjs --type=<id>, scripts/verify-brief.mjs, and scripts/check-visible-text.mjs. Run scripts/verify-all.mjs for the complete example set and scripts/verify-coverage.mjs after changing catalog resources. When a brief has a trust boundary, declare every node exactly once in semicolon-separated `Trust boundary internal nodes:` and `Trust boundary external nodes:` lists; the brief verifier checks that internal boxes lie fully inside the boundary rectangle and external boxes fully outside. These checks reject process or generator copy, undersized role labels, sparse content, detached or ambiguous edge labels, edge labels on node boxes, text crossing boundaries, routes through unrelated nodes or along outlines, route crossings (including opposite directions between the same two nodes), arrowheads that miss or cover their targets, undersized heads, incomplete decision outcomes, node gaps under 12px, and incomplete sequences. Correct every block, geometry, contrast, accessibility, language, and type-specific failure before exporting.
|
|
58
70
|
7. **Check visible text with lit-humanizer.** The checker calls the detector shipped in this same project at ../lit-humanizer/scripts/detect.mjs. A block-tier hit or detector error fails the check. If that installed detector is missing or fails, stop and report it; do not skip the text check or use another checkout.
|
|
59
71
|
8. **Export.** Run scripts/export.mjs for requested PNG scales or Office-safe SVG. It never installs a browser or font. scripts/doctor.mjs reports tool availability. If the renderer is missing, use the printed user-run setup steps; authoring and non-rendering checks remain available.
|
|
@@ -75,7 +87,7 @@ Use the shared references/import-schema.md output to make a fresh content brief.
|
|
|
75
87
|
- Run `scripts/verify-all.mjs` before releasing a skill example set to check every template and after example and reject each naive foil.
|
|
76
88
|
- Run `scripts/verify-coverage.mjs` after changing catalog resources to check type-reference and template coverage.
|
|
77
89
|
- Run `scripts/verify-motion.mjs` before export when the diagram has an animated state.
|
|
78
|
-
- Run `scripts/visual-quality.mjs` before review to check visible-label scale, route detours, lifelines, and other visual-quality rules. Its OF-201 through OF-204 findings cover declared-group gap ratios, node-fill accent families, Latin label casing, and node/boundary label fit. OF-203 is advisory; an edge label has no rectangular box and is outside OF-204's scope.
|
|
90
|
+
- Run `scripts/visual-quality.mjs` before review to check visible-label scale, route detours, lifelines, and other visual-quality rules. Its OF-201 through OF-204 findings cover declared-group gap ratios, node-fill accent families (3–5 pass, 6 or more fail), Latin label casing, and node/boundary label fit. OF-203 is advisory; an edge label has no rectangular box and is outside OF-204's scope.
|
|
79
91
|
- Run `scripts/check-visible-text.mjs` before accepting copy to apply the installed LitGrok detector.
|
|
80
92
|
- Run `scripts/doctor.mjs` before export to see renderer, font, and write-access status.
|
|
81
93
|
- Run `scripts/export.mjs` after verification to export the requested PNG scales or Office-safe SVG.
|
|
@@ -28,8 +28,8 @@ Use a fixed viewBox and preserve its ratio. Keep titles and captions inside the
|
|
|
28
28
|
|
|
29
29
|
## Variants
|
|
30
30
|
|
|
31
|
-
- light: paper canvas, dark ink, neutral
|
|
32
|
-
- dark: dark paper, light ink, theme-specific rule and connector values, and
|
|
31
|
+
- light: paper canvas, dark ink, neutral connectors, and the style guide's accent families on their washes.
|
|
32
|
+
- dark: dark paper, light ink, theme-specific rule and connector values, and the dark-theme accent and wash tokens.
|
|
33
33
|
- full: a title, concise context, optional key, and takeaway around the same layout. Keep the content footprint within the selected canvas.
|
|
34
34
|
|
|
35
35
|
The full variant is still a single diagram. It does not mean a dashboard or a denser version.
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# LitFamily diagram style
|
|
2
2
|
|
|
3
|
-
This guide sets a
|
|
3
|
+
This guide sets a rich editorial skin: a diagram that rewards a second look, with zones, sub-parts, labelled relationships and a layered palette, while every safety floor below stays fixed. Use it as the shared default. A minimal, one-accent diagram is the opt-in variant, used only when the user asks for minimal, calm, quiet or sparse output; replace the palette only when the user supplies a brand source.
|
|
4
4
|
|
|
5
5
|
## Composition
|
|
6
6
|
|
|
7
7
|
- Start with the reader's question. Group related elements and set their reading order before drawing connectors or choosing colors.
|
|
8
|
-
-
|
|
9
|
-
- Aim for density around
|
|
10
|
-
-
|
|
11
|
-
- Use
|
|
8
|
+
- Show the system the way its owners know it. Keep the sub-components, protocols, data stores, queues, owners and boundary names that make the picture specific; merge only nodes that always move together, and drop only content that repeats something already on the canvas.
|
|
9
|
+
- Aim for density around 8 on a 10-point scale. A standard overview carries about 14–24 nodes and as many connectors as the real relationships need, arranged in named zones or tiers. When the content outgrows one view, enlarge the canvas preset or zone the layout; split into an overview and detail views only when a label would otherwise fall below its floor.
|
|
10
|
+
- Layer the composition: tinted zone bands behind groups, a sublabel or technical token under each node name, small primitive icons from `primitive-icons.md` beside names, numbered step badges on the main path, a legend that maps every accent family to its subject role in the subject's words ("payment path", not "accent" or "focal"), and one or two annotation callouts on the decisive edge or node. Every mark still names something real; avoid ornamental dots, fake precision, and glow or blur that lowers text contrast.
|
|
11
|
+
- Use a palette of 3–5 accent families, each bound to one role: a zone, a category of node, the critical path, a risk or a state. Neutrals carry the rest. Color never carries state or category by itself: pair each family with a label, legend entry, line style or icon.
|
|
12
|
+
- Minimal is opt-in. When the user asks for minimal, calm, quiet or sparse output, fall back to a 4/10 density, one or two focal accents and plain boxes; the floors and checks do not change.
|
|
12
13
|
|
|
13
14
|
## Color roles
|
|
14
15
|
|
|
@@ -20,10 +21,18 @@ This guide sets a quiet editorial skin for diagrams that must explain structure
|
|
|
20
21
|
| muted | #536268 | #BAC4C1 | Secondary labels and connectors |
|
|
21
22
|
| quiet | #748084 | #8A9998 | Tertiary labels |
|
|
22
23
|
| rule | #CCD2CE | #3B4A4D | Dividers and boundaries |
|
|
23
|
-
| accent | #B85C42 | #E39373 |
|
|
24
|
-
| accent-wash | #F4E7E0 | #3B2B28 |
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
| accent | #B85C42 | #E39373 | First role family: focal path or primary zone |
|
|
25
|
+
| accent-wash | #F4E7E0 | #3B2B28 | Fill for the first family |
|
|
26
|
+
| accent-2 | #2E7D7A | #6CC4BD | Second role family |
|
|
27
|
+
| accent-2-wash | #DDEFEC | #1F3B3A | Fill for the second family |
|
|
28
|
+
| accent-3 | #4A5BA8 | #9AA8EC | Third role family |
|
|
29
|
+
| accent-3-wash | #E3E7F6 | #2A3150 | Fill for the third family |
|
|
30
|
+
| accent-4 | #9A6B12 | #E0B456 | Fourth role family |
|
|
31
|
+
| accent-4-wash | #F3E9D2 | #3D3420 | Fill for the fourth family |
|
|
32
|
+
| accent-5 | #8C4A86 | #D493CB | Fifth role family |
|
|
33
|
+
| accent-5-wash | #F1E2EF | #3A2738 | Fill for the fifth family |
|
|
34
|
+
|
|
35
|
+
Every accent stroke clears 3:1 against its paper and every ink label clears 4.5:1 on its wash in both themes. Use the families in order and stop at the number of roles the subject has; three is the usual floor for a system overview. Six or more saturated families stop reading as roles and fail `ACCENT_COUNT` (OF-202). A brand source replaces these tokens one for one; check all pairs after replacement.
|
|
27
36
|
|
|
28
37
|
## Shape, stroke, and spacing
|
|
29
38
|
|
|
@@ -34,7 +43,7 @@ Choose a different accent only when the user provides a brand source. Check all
|
|
|
34
43
|
- Bind each connector label to its declared source and destination. At the 1080×640 reference, its SVG text anchor sits within 24px of that route and is nearer to it than to any other connector. Give the text box clear space from every route.
|
|
35
44
|
- Name each trust boundary or group in visible text. Keep its label at least 13px and 4.5:1 contrast; outline strokes must not cross labels. Never route alongside an outline within 4px for 12px or more.
|
|
36
45
|
- Use line style, shape, position, or text alongside color whenever a distinction matters.
|
|
37
|
-
-
|
|
46
|
+
- Show depth through nesting, tinted zone bands, order and labelled boundaries. A soft, consistent offset under one raised layer is allowed when it separates that layer; never let it touch a label or a route.
|
|
38
47
|
|
|
39
48
|
## Typography roles
|
|
40
49
|
|
|
@@ -58,7 +67,7 @@ Visible text belongs to the subject. Do not print the product or generator name,
|
|
|
58
67
|
## Theme behavior
|
|
59
68
|
|
|
60
69
|
- Light and dark are separate complete themes, not partial color swaps. Every label, line, focus cue, and boundary must retain contrast.
|
|
61
|
-
- Full-editorial adds a title, brief, legend,
|
|
70
|
+
- Full-editorial adds a title, brief, legend, takeaway, and summary cards with already-declared facts around the same diagram, using the same accent families as the drawing.
|
|
62
71
|
- Keep diagram semantics and reading order identical across variants.
|
|
63
72
|
- Print and export must show the full final state without relying on a dark-mode preference, animation, or remote font.
|
|
64
73
|
|
|
@@ -10,7 +10,7 @@ Choose deployment when placement on hosts, environments, replicas, or network zo
|
|
|
10
10
|
|
|
11
11
|
## Content schema
|
|
12
12
|
|
|
13
|
-
Record an ordered list of groups or trust zones; each group has an ID and a short visible name. Record nodes with stable ID, group, name, optional role or technical sublabel, and an optional focal flag. Record directed edges with source ID, destination ID, relationship meaning, optional protocol or payload label, and optional/dashed state. Every edge endpoint must resolve. State which direction the reader should follow.
|
|
13
|
+
Record an ordered list of groups or trust zones; each group has an ID and a short visible name. Record nodes with stable ID, group, name, optional role or technical sublabel, and an optional focal flag. Record directed edges with source ID, destination ID, relationship meaning, optional protocol or payload label, and optional/dashed state. Every edge endpoint must resolve. State which direction the reader should follow. An overview carries about 14–24 nodes, every real edge between them, and up to 5 true boundary groups; past that, enlarge the canvas preset or split at a group boundary with cross-reference ids.
|
|
14
14
|
|
|
15
15
|
## Deterministic layout recipe
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ Draw boundary regions first, then connectors, then node shapes and text. Route e
|
|
|
20
20
|
|
|
21
21
|
## Encoding rules
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Give each group or node role its own accent family from the style guide (3–5 families), tint the group bands with the matching wash, and mark the primary path with the first family and numbered step badges. Use a dashed boundary only when it represents an actual trust or ownership boundary. Use a dashed edge only for a named optional, asynchronous, or return relationship; explain that meaning in a compact legend. Keep ordinary edges neutral. Technical protocols and ports use the mono role; names and explanations use Pretendard sans.
|
|
24
24
|
|
|
25
25
|
## Korean behavior
|
|
26
26
|
|
|
@@ -41,7 +41,7 @@ Run scripts/verify-diagram.mjs for geometry, overlaps, clipping, off-canvas cont
|
|
|
41
41
|
## Anti-patterns
|
|
42
42
|
|
|
43
43
|
- Turning every service into an equally weighted card.
|
|
44
|
-
-
|
|
44
|
+
- Coloring connectors or boundaries for variety rather than by a role the legend names.
|
|
45
45
|
- Drawing deployment detail into a logical overview without a placement question.
|
|
46
46
|
- Adding decorative arrows between components when no relationship was supplied.
|
|
47
47
|
- Letting a node name or edge label collide with a connector.
|
|
@@ -8,7 +8,7 @@ Use a dependency graph when a component has multiple dependents or a real depend
|
|
|
8
8
|
|
|
9
9
|
## Content schema
|
|
10
10
|
|
|
11
|
-
Provide
|
|
11
|
+
Provide about 12–20 package, module, or service nodes and up to 30 directed dependency edges. Each node has a stable ID, name, type (internal, external, or leaf), and optional version/registry label. Include fan-in count as a derived value. Declare one cycle for focal treatment at most. If the input is a DAG, state the ranking rule; if cyclic, mark the single back-edge explicitly.
|
|
12
12
|
|
|
13
13
|
## Deterministic layout recipe
|
|
14
14
|
|
|
@@ -18,11 +18,11 @@ Each node carries a stable id, parent id (empty only for the root), short name,
|
|
|
18
18
|
2. Center each parent above the span occupied by its descendants. Order siblings by the domain's actual sequence; if none exists, use a stable declared order so reruns are reproducible.
|
|
19
19
|
3. Route orthogonal connectors: short parent stem, horizontal sibling bus, then a short drop to each child. Keep connectors behind nodes and attach them at the center of node edges.
|
|
20
20
|
4. Use two node widths at most, based on measured label lengths. Align boxes to the layout grid; use a lighter border or fill for leaves only when it remains a redundant cue.
|
|
21
|
-
5.
|
|
21
|
+
5. Carry up to about 24 nodes, five levels including the root, and eight children at a level. Beyond that, split at a meaningful subsystem boundary and provide cross-reference ids between figures.
|
|
22
22
|
|
|
23
23
|
## Visual encoding
|
|
24
24
|
|
|
25
|
-
Connector topology carries the hierarchy; box position and text carry identity.
|
|
25
|
+
Connector topology carries the hierarchy; box position and text carry identity. Give each top-level subtree one accent family from the style guide (3–5 families) so a branch reads as one unit, and mark a critical leaf with a labelled badge. Do not color by depth alone. Use the same visual weight for siblings and the same depth spacing throughout. Place connectors before cards so their paths terminate cleanly at the box edge.
|
|
26
26
|
|
|
27
27
|
## Korean text
|
|
28
28
|
|
|
@@ -44,7 +44,7 @@ Run `scripts/verify-diagram.mjs` for node bounds, overlap, clipping, contrast, s
|
|
|
44
44
|
|
|
45
45
|
- A node with two parents, a cycle, or an unlabeled skipped level.
|
|
46
46
|
- Diagonal connectors or connectors that stop short of a child.
|
|
47
|
-
- More than
|
|
47
|
+
- More than five levels, inconsistent box widths, or one exceptionally broad row.
|
|
48
48
|
- Highlighting the root and a leaf with competing accents.
|
|
49
49
|
- Cross-tree dependencies drawn as if they were parent-child links.
|
|
50
50
|
- Cropping a large tree so that its root or branch context disappears.
|
|
@@ -8,7 +8,7 @@ Use a Wardley map to reason about a value chain against component evolution: wha
|
|
|
8
8
|
|
|
9
9
|
## Content schema
|
|
10
10
|
|
|
11
|
-
Each component needs a stable id, short name, value-chain position, evolution band, and its dependency links. Record which components are moving, their rightward destination or time horizon, and the evidence behind the placement. Use up to
|
|
11
|
+
Each component needs a stable id, short name, value-chain position, evolution band, and its dependency links. Record which components are moving, their rightward destination or time horizon, and the evidence behind the placement. Use up to about 18 components, 26 links, and four movement arrows. Each component must take part in the value chain through at least one incoming or outgoing dependency.
|
|
12
12
|
|
|
13
13
|
## Deterministic layout recipe
|
|
14
14
|
|
|
@@ -44,6 +44,10 @@ The shared verifier reports overlap candidates, label bounds, off-canvas geometr
|
|
|
44
44
|
- **Opposed arrowheads:** one directed polyline has both a start marker and an end marker. Keep one arrowhead per directed edge unless the brief explicitly defines a two-way relationship.
|
|
45
45
|
- **Sequence lifeline:** a participant has no dashed lifeline, the line does not start at its box center or reach the final message, a message misses its named lifeline, or message order is not top-to-bottom. Bind each message endpoint to its actor lifeline and preserve order.
|
|
46
46
|
- **Content fill:** the declared node bounds use less than 68% of canvas width or 40% of canvas height. Recompose the subject to use the available slide area.
|
|
47
|
+
- **Cluster gap ratio (OF-201):** with two or more boundary or group outlines, the smallest gap between nodes of different groups is less than twice the largest gap inside a group, so nothing reads as grouped. Pull each group's members together or push the groups apart.
|
|
48
|
+
- **Accent count (OF-202):** node fills use six or more saturated hue families. Three to five families is the default palette and passes; bind each to one role, name it in the legend, and pair it with a label, icon or line style. Reduce the families by merging roles, not by greying out the drawing.
|
|
49
|
+
- **Label case (OF-203, advisory):** a Latin label reads as Title Case, with a capitalised function word such as "Of" or "The". Use sentence case; a proper-noun component name is not flagged.
|
|
50
|
+
- **Label overflow (OF-204):** a node or boundary label is wider than its own box minus an 8px inset. Shorten the label, wrap it, or widen the box. Edge labels are not measured by this check.
|
|
47
51
|
|
|
48
52
|
## Type checks
|
|
49
53
|
|
|
@@ -68,7 +68,7 @@ function segmentHitsText(s,t,pad=1){
|
|
|
68
68
|
function textOverlapsNode(text,node,pad=1){return text.x<node.x+node.w+pad&&text.x+text.w>node.x-pad&&text.y<node.y+node.h+pad&&text.y+text.h>node.y-pad;}
|
|
69
69
|
function gap(a,b){const dx=Math.max(0,a.x-(b.x+b.w),b.x-(a.x+a.w)),dy=Math.max(0,a.y-(b.y+b.h),b.y-(a.y+a.h));return Math.hypot(dx,dy);}
|
|
70
70
|
|
|
71
|
-
const OFFICE_LIMITS={groupRatio:2,accentFamiliesHigh:
|
|
71
|
+
const OFFICE_LIMITS={groupRatio:2,accentFamiliesHigh:6,hueBand:20,latinShare:.8,titleShare:.6,inset:4};
|
|
72
72
|
function officeQuality(svg,nodes,texts,outlines){
|
|
73
73
|
const issues=[];
|
|
74
74
|
if(outlines.length>=2){
|
|
@@ -79,7 +79,7 @@ function officeQuality(svg,nodes,texts,outlines){
|
|
|
79
79
|
}
|
|
80
80
|
const hues=[];
|
|
81
81
|
for(const n of nodes){const m=n.fill.match(/^#([\da-f]{6})$/i);if(!m)continue;const rgb=[0,2,4].map((i)=>parseInt(m[1].slice(i,i+2),16)/255),max=Math.max(...rgb),min=Math.min(...rgb),d=max-min,light=(max+min)/2,sat=d===0?0:d/(1-Math.abs(2*light-1));if(sat<.12||light<.12||light>.93)continue;let h=0;if(d){const k=rgb.indexOf(max);h=60*((k===0?(rgb[1]-rgb[2])/d:k===1?(rgb[2]-rgb[0])/d+2:(rgb[0]-rgb[1])/d+4)+6)%360;}if(!hues.some((v)=>Math.min(Math.abs(v-h),360-Math.abs(v-h))<=OFFICE_LIMITS.hueBand))hues.push(h);}
|
|
82
|
-
if(hues.length>=OFFICE_LIMITS.
|
|
82
|
+
if(hues.length>=OFFICE_LIMITS.accentFamiliesHigh)issues.push('OF-202 ACCENT_COUNT '+hues.length+' HIGH; keep three to five families, each tied to a named role');
|
|
83
83
|
for(const t of texts){
|
|
84
84
|
const letters=[...t.label].filter((c)=>/[A-Za-z0-9]/.test(c)).length,share=letters/Math.max(1,t.label.length);
|
|
85
85
|
if(share>=OFFICE_LIMITS.latinShare&&t.label!==t.label.toUpperCase()){const all=t.label.split(/\s+/),words=all.filter((w)=>/^[A-Za-z]{4,}$/.test(w)),caps=words.filter((w)=>/^[A-Z][a-z]+$/.test(w));if(caps.length>=2&&caps.length/Math.max(1,words.length)>OFFICE_LIMITS.titleShare&&all.some((w)=>/^(Of|And|The|To|For|In)$/.test(w)))issues.push('OF-203 LABEL_CASE '+t.label);}
|