truemap-cli 0.1.0 → 0.3.0
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/README.md +31 -27
- package/bin/truemap.js +3 -0
- package/kit/fonts/OFL.txt +93 -0
- package/kit/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/kit/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/kit/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/kit/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
- package/kit/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
- package/kit/truemap.css +248 -186
- package/package.json +1 -1
- package/skills/truemap/SKILL.md +4 -3
- package/src/check.js +32 -1
- package/src/cli.js +75 -20
- package/src/export.js +62 -0
- package/src/guide.md +67 -32
- package/src/outline.js +71 -0
- package/src/server.js +453 -394
- package/src/ui/sdk.js +350 -58
- package/src/ui/wires.js +237 -0
- package/src/ui/workspace.css +194 -128
- package/src/ui/workspace.html +59 -45
- package/src/ui/workspace.js +277 -104
package/kit/truemap.css
CHANGED
|
@@ -1,41 +1,59 @@
|
|
|
1
|
-
/* truemap page kit
|
|
2
|
-
To match
|
|
1
|
+
/* truemap page kit. truemap serves this file to every page in .truemap/ (assets/truemap.css).
|
|
2
|
+
To match a project's own look, put token overrides in .truemap/assets/theme.css – truemap appends it here. */
|
|
3
|
+
|
|
4
|
+
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/__truemap/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
|
|
5
|
+
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/__truemap/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
|
|
6
|
+
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/__truemap/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
|
|
7
|
+
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/__truemap/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
|
|
8
|
+
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/__truemap/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
|
|
3
9
|
|
|
4
10
|
:root {
|
|
5
|
-
--tm-paper: #
|
|
6
|
-
--tm-sheet: #ffffff;
|
|
7
|
-
--tm-wash: #
|
|
8
|
-
--tm-ink: #
|
|
9
|
-
--tm-
|
|
10
|
-
--tm-
|
|
11
|
-
--tm-
|
|
12
|
-
--tm-rule
|
|
13
|
-
--tm-
|
|
14
|
-
--tm-route
|
|
15
|
-
--tm-
|
|
16
|
-
--tm-
|
|
17
|
-
--tm-
|
|
18
|
-
--tm-
|
|
19
|
-
--tm-
|
|
20
|
-
--tm-
|
|
11
|
+
--tm-paper: #f6f7f4; /* page background */
|
|
12
|
+
--tm-sheet: #ffffff; /* boxes on the map */
|
|
13
|
+
--tm-wash: #eef0ec; /* quiet fills */
|
|
14
|
+
--tm-ink: #17202b; /* titles */
|
|
15
|
+
--tm-text: #2a3441; /* body text */
|
|
16
|
+
--tm-graphite: #5b6573; /* secondary text */
|
|
17
|
+
--tm-pencil: #8a939e; /* paths, hints */
|
|
18
|
+
--tm-rule: #dde1db;
|
|
19
|
+
--tm-rule-strong: #c2c8c1;
|
|
20
|
+
--tm-route: #2453c4; /* the one emphasis: the key path, links, decisions */
|
|
21
|
+
--tm-route-ink: #1b3f96;
|
|
22
|
+
--tm-route-wash: #e9eefb;
|
|
23
|
+
--tm-action: #2453c4; /* filled buttons */
|
|
24
|
+
--tm-changed: #a2690a;
|
|
25
|
+
--tm-changed-wash: #fbf2e0;
|
|
26
|
+
--tm-broken: #b03a2e;
|
|
27
|
+
--tm-broken-wash: #fbeae7;
|
|
28
|
+
--tm-fine: #2c7550;
|
|
29
|
+
--tm-fine-wash: #e5f1e9;
|
|
30
|
+
--tm-radius: 6px;
|
|
31
|
+
--tm-font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
|
|
32
|
+
--tm-code: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
|
|
21
33
|
color-scheme: light dark;
|
|
22
34
|
}
|
|
23
35
|
|
|
24
36
|
@media (prefers-color-scheme: dark) {
|
|
25
37
|
:root {
|
|
26
|
-
--tm-paper: #
|
|
27
|
-
--tm-sheet: #
|
|
28
|
-
--tm-wash: #
|
|
29
|
-
--tm-ink: #
|
|
30
|
-
--tm-
|
|
31
|
-
--tm-
|
|
32
|
-
--tm-
|
|
33
|
-
--tm-rule
|
|
34
|
-
--tm-
|
|
35
|
-
--tm-route
|
|
36
|
-
--tm-
|
|
37
|
-
--tm-
|
|
38
|
-
--tm-
|
|
38
|
+
--tm-paper: #121519;
|
|
39
|
+
--tm-sheet: #191d23;
|
|
40
|
+
--tm-wash: #1f242b;
|
|
41
|
+
--tm-ink: #edf0f3;
|
|
42
|
+
--tm-text: #d0d6dd;
|
|
43
|
+
--tm-graphite: #9ba4af;
|
|
44
|
+
--tm-pencil: #707a86;
|
|
45
|
+
--tm-rule: #2a3039;
|
|
46
|
+
--tm-rule-strong: #3d4651;
|
|
47
|
+
--tm-route: #7ea3ff;
|
|
48
|
+
--tm-route-ink: #a9c0ff;
|
|
49
|
+
--tm-route-wash: #1b2440;
|
|
50
|
+
--tm-action: #3a66d6;
|
|
51
|
+
--tm-changed: #d9a54a;
|
|
52
|
+
--tm-changed-wash: #2c2414;
|
|
53
|
+
--tm-broken: #ec8170;
|
|
54
|
+
--tm-broken-wash: #321b18;
|
|
55
|
+
--tm-fine: #73bd95;
|
|
56
|
+
--tm-fine-wash: #16271e;
|
|
39
57
|
}
|
|
40
58
|
}
|
|
41
59
|
|
|
@@ -44,187 +62,231 @@
|
|
|
44
62
|
html { -webkit-text-size-adjust: 100%; }
|
|
45
63
|
body {
|
|
46
64
|
margin: 0;
|
|
65
|
+
overflow-x: clip;
|
|
47
66
|
background: var(--tm-paper);
|
|
48
|
-
color: var(--tm-
|
|
49
|
-
font: 16px/1.
|
|
67
|
+
color: var(--tm-text);
|
|
68
|
+
font: 16px/1.62 var(--tm-font);
|
|
69
|
+
font-feature-settings: "kern", "liga";
|
|
50
70
|
-webkit-font-smoothing: antialiased;
|
|
51
71
|
text-rendering: optimizeLegibility;
|
|
52
72
|
}
|
|
53
73
|
img, svg, video, canvas { max-width: 100%; }
|
|
54
74
|
p, li, td, th, h1, h2, h3, h4, dd { overflow-wrap: anywhere; }
|
|
55
|
-
p { margin: 0 0 1em; max-width:
|
|
56
|
-
|
|
57
|
-
a
|
|
75
|
+
p { margin: 0 0 1em; max-width: 68ch; }
|
|
76
|
+
strong, b { color: var(--tm-ink); font-weight: 600; }
|
|
77
|
+
a { color: var(--tm-route); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--tm-route) 40%, transparent); }
|
|
78
|
+
a:hover { text-decoration-color: var(--tm-route); }
|
|
58
79
|
:focus-visible { outline: 2px solid var(--tm-route); outline-offset: 2px; }
|
|
59
|
-
::selection { background: var(--tm-route-wash); }
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.tm-
|
|
68
|
-
.tm-
|
|
69
|
-
.tm-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.tm-
|
|
73
|
-
.tm-
|
|
74
|
-
.tm-
|
|
75
|
-
|
|
80
|
+
::selection { background: var(--tm-route-wash); color: var(--tm-ink); }
|
|
81
|
+
h1, h2, h3, h4 { color: var(--tm-ink); font-weight: 600; text-wrap: balance; }
|
|
82
|
+
ul, ol { padding-left: 1.3em; max-width: 68ch; }
|
|
83
|
+
li { margin: 0.2em 0; }
|
|
84
|
+
li::marker { color: var(--tm-pencil); }
|
|
85
|
+
hr { border: 0; border-top: 1px solid var(--tm-rule); margin: 40px 0; }
|
|
86
|
+
|
|
87
|
+
/* ---------- page ---------- */
|
|
88
|
+
.tm-page { max-width: 960px; margin: 0 auto; padding: 48px 48px 112px; }
|
|
89
|
+
.tm-header { margin-bottom: 8px; }
|
|
90
|
+
.tm-crumb, .tm-eyebrow { font-size: 13.5px; color: var(--tm-graphite); margin: 0 0 14px; }
|
|
91
|
+
.tm-crumb a { color: var(--tm-graphite); text-decoration-color: var(--tm-rule-strong); }
|
|
92
|
+
.tm-crumb a:hover { color: var(--tm-route); }
|
|
93
|
+
.tm-title { font-size: 36px; line-height: 1.15; letter-spacing: -0.018em; margin: 0 0 14px; max-width: 22ch; }
|
|
94
|
+
.tm-lede { font-size: 18.5px; line-height: 1.55; color: var(--tm-graphite); margin: 0; max-width: 60ch; }
|
|
95
|
+
.tm-lede strong { color: var(--tm-text); font-weight: 500; }
|
|
96
|
+
|
|
97
|
+
.tm-section { margin-top: 64px; }
|
|
98
|
+
.tm-section > h2, .tm-h2 { font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 8px; }
|
|
99
|
+
.tm-section > h2 + p { color: var(--tm-graphite); }
|
|
100
|
+
.tm-section h3 { font-size: 16.5px; line-height: 1.35; margin: 32px 0 8px; }
|
|
101
|
+
.tm-section > :last-child { margin-bottom: 0; }
|
|
76
102
|
.tm-muted { color: var(--tm-graphite); }
|
|
77
|
-
.tm-
|
|
78
|
-
.tm-small { font-size: 14px; }
|
|
79
|
-
.tm-stack > * + * { margin-top: 12px; }
|
|
80
|
-
|
|
81
|
-
/* ---------- layout ---------- */
|
|
82
|
-
.tm-grid { display: grid; gap: 20px 28px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
|
|
83
|
-
.tm-grid-2 { display: grid; gap: 20px 28px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
84
|
-
.tm-grid-3 { display: grid; gap: 20px 28px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
85
|
-
@media (max-width: 760px) { .tm-grid-2, .tm-grid-3 { grid-template-columns: minmax(0, 1fr); } }
|
|
86
|
-
.tm-grid > *, .tm-grid-2 > *, .tm-grid-3 > * { min-width: 0; }
|
|
87
|
-
|
|
88
|
-
/* A panel is for content that belongs together, not a wrapper for every paragraph. */
|
|
89
|
-
.tm-card { background: var(--tm-sheet); border: 1px solid var(--tm-rule); border-radius: var(--tm-radius); padding: 18px 20px; }
|
|
90
|
-
.tm-card > :last-child { margin-bottom: 0; }
|
|
91
|
-
.tm-card.is-key { border-color: var(--tm-route); }
|
|
103
|
+
.tm-small { font-size: 13.5px; }
|
|
92
104
|
|
|
93
|
-
/* ----------
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.tm-
|
|
98
|
-
|
|
105
|
+
/* ---------- the map (blueprint) ---------- */
|
|
106
|
+
/* Rows are layers; boxes are real code. truemap draws the wires from data-to="id id". */
|
|
107
|
+
/* A map never wraps or stacks: when it is wider than the page it scrolls sideways, wires and all. */
|
|
108
|
+
/* The map may run wider than the text column, up to the right edge of the window. */
|
|
109
|
+
.tm-map, .tm-blueprint {
|
|
110
|
+
position: relative; margin: 20px 0 0; overflow-x: auto; overflow-y: hidden; padding: 10px 8px 14px 2px; scrollbar-width: thin;
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
|
+
/* --tm-vw is the usable window width (without the scrollbar), set by truemap. */
|
|
114
|
+
html[style*="--tm-vw"] .tm-map, html[style*="--tm-vw"] .tm-blueprint { width: calc(var(--tm-vw) - max(48px, (var(--tm-vw) - 960px) / 2 + 48px) - 16px); min-width: 100%; }
|
|
115
|
+
.tm-map.tm-scrolls { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
|
|
116
|
+
.tm-layer { position: relative; display: grid; grid-template-columns: var(--tm-label-w, 112px) minmax(0, 1fr); gap: 20px; align-items: start; }
|
|
117
|
+
.tm-layer + .tm-layer { margin-top: 44px; }
|
|
118
|
+
.tm-layer-label { font-size: 13px; color: var(--tm-pencil); padding-top: 12px; line-height: 1.35; }
|
|
119
|
+
.tm-layer-nodes { display: flex; flex-wrap: nowrap; gap: 18px 26px; }
|
|
120
|
+
/* Boxes shrink to 168px before the map has to scroll. */
|
|
121
|
+
.tm-layer-nodes > .tm-node { flex: 0 1 var(--tm-node-w, 216px); min-width: var(--tm-node-min, 168px); max-width: none; }
|
|
122
|
+
.tm-map > .tm-layer-nodes { margin-left: 132px; }
|
|
99
123
|
|
|
100
|
-
/* ---------- nodes: modules, services, steps ---------- */
|
|
101
124
|
.tm-node, .tm-step {
|
|
102
|
-
position: relative;
|
|
103
|
-
|
|
104
|
-
padding: 11px
|
|
105
|
-
background: var(--tm-sheet);
|
|
106
|
-
|
|
125
|
+
position: relative; z-index: 1;
|
|
126
|
+
display: flex; flex-direction: column; flex: 0 1 216px; min-width: 156px; max-width: 280px;
|
|
127
|
+
padding: 11px 26px 12px 14px;
|
|
128
|
+
background: var(--tm-sheet); color: var(--tm-text);
|
|
129
|
+
border: 1px solid var(--tm-rule-strong); border-radius: var(--tm-radius);
|
|
130
|
+
text-decoration: none; line-height: 1.4;
|
|
131
|
+
transition: border-color 120ms ease, box-shadow 120ms ease;
|
|
132
|
+
}
|
|
133
|
+
a.tm-node:hover, a.tm-step:hover { border-color: var(--tm-graphite); }
|
|
134
|
+
.tm-node-title, .tm-step > b, .tm-step > strong { font-size: 15px; font-weight: 600; color: var(--tm-ink); }
|
|
135
|
+
.tm-node-sub { font-family: var(--tm-code); font-size: 12px; color: var(--tm-pencil); margin-top: 2px; overflow-wrap: break-word; }
|
|
136
|
+
.tm-node-desc { font-size: 13.5px; line-height: 1.45; color: var(--tm-graphite); margin-top: 7px; }
|
|
137
|
+
|
|
138
|
+
/* The survey mark: a box pinned to real code (data-src) carries a small triangle. */
|
|
139
|
+
.tm-node[data-src]::after, .tm-step[data-src]::after, .tm-card[data-src]::after {
|
|
140
|
+
content: ""; position: absolute; top: 11px; right: 11px; width: 8px; height: 7px;
|
|
141
|
+
background: var(--tm-pencil); clip-path: polygon(50% 0, 100% 100%, 0 100%);
|
|
107
142
|
}
|
|
108
|
-
.tm-node-
|
|
109
|
-
.tm-node-
|
|
110
|
-
.tm-node-
|
|
111
|
-
|
|
112
|
-
.tm-node.is-
|
|
143
|
+
.tm-node.is-key, .tm-step.is-key { border-color: var(--tm-route); box-shadow: inset 0 0 0 1px var(--tm-route); }
|
|
144
|
+
.tm-node.is-key .tm-node-title, .tm-step.is-key > b, .tm-step.is-key > strong { color: var(--tm-route-ink); }
|
|
145
|
+
.tm-node.is-key::after, .tm-step.is-key::after { background: var(--tm-route); }
|
|
146
|
+
.tm-node.is-ext, .tm-step.is-ext { background: transparent; border-style: dashed; }
|
|
147
|
+
.tm-node.is-ext .tm-node-title, .tm-step.is-ext > b { color: var(--tm-graphite); font-weight: 500; }
|
|
113
148
|
.tm-node.is-new, .tm-step.is-new { border-color: var(--tm-fine); }
|
|
114
149
|
.tm-node.is-risk, .tm-step.is-risk { border-color: var(--tm-changed); }
|
|
115
|
-
.tm-node.is-ext, .tm-step.is-ext { border-style: dashed; background: transparent; }
|
|
116
150
|
|
|
117
|
-
/*
|
|
118
|
-
.tm-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
151
|
+
/* Wires (drawn by truemap into svg.tm-wires) */
|
|
152
|
+
.tm-wires { position: absolute; top: 0; left: 0; max-width: none; pointer-events: none; overflow: visible; z-index: 0; }
|
|
153
|
+
.tm-wire { fill: none; stroke: var(--tm-rule-strong); stroke-width: 1.5; }
|
|
154
|
+
.tm-wire.is-key { stroke: var(--tm-route); stroke-width: 2; }
|
|
155
|
+
.tm-wire.is-ext { stroke-dasharray: 4 4; }
|
|
156
|
+
.tm-wire-head { fill: var(--tm-rule-strong); }
|
|
157
|
+
.tm-wire-head.is-key { fill: var(--tm-route); }
|
|
158
|
+
.tm-wire-label { font: 500 11.5px var(--tm-font); fill: var(--tm-graphite); paint-order: stroke; stroke: var(--tm-paper); stroke-width: 4px; stroke-linejoin: round; }
|
|
159
|
+
|
|
160
|
+
/* Legend under a map */
|
|
161
|
+
.tm-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 22px 0 0 132px; font-size: 13px; color: var(--tm-graphite); }
|
|
162
|
+
.tm-legend span { display: inline-flex; align-items: center; gap: 8px; }
|
|
163
|
+
.tm-legend i { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--tm-route); }
|
|
164
|
+
.tm-legend i.is-wire { border-top: 1.5px solid var(--tm-rule-strong); }
|
|
165
|
+
.tm-legend i.is-ext { border-top: 1.5px dashed var(--tm-rule-strong); }
|
|
166
|
+
.tm-legend i.is-mark { width: 8px; height: 7px; border: 0; background: var(--tm-pencil); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
|
|
122
167
|
|
|
123
|
-
/* ----------
|
|
124
|
-
.tm-flow { display: flex;
|
|
125
|
-
.tm-flow > .tm-
|
|
126
|
-
.tm-flow >
|
|
127
|
-
.tm-flow >
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
border: 4px solid transparent; border-left: 6px solid var(--tm-graphite); border-right: 0;
|
|
168
|
+
/* ---------- flow: a real sequence ---------- */
|
|
169
|
+
.tm-flow { display: flex; align-items: stretch; gap: 30px; margin: 24px 0 8px; overflow-x: auto; padding: 2px 2px 6px; }
|
|
170
|
+
.tm-flow > .tm-step { flex: 1 1 0; min-width: auto; max-width: none; }
|
|
171
|
+
.tm-flow > .tm-step > * { min-width: 132px; }
|
|
172
|
+
.tm-flow > .tm-step + .tm-step::before {
|
|
173
|
+
content: ""; position: absolute; left: -26px; top: 50%; width: 21px; height: 0;
|
|
174
|
+
border-top: 1.5px solid var(--tm-rule-strong);
|
|
131
175
|
}
|
|
132
|
-
.tm-flow.
|
|
133
|
-
|
|
134
|
-
.tm-flow.is-vertical > * + * { margin: 24px 0 0; }
|
|
135
|
-
.tm-flow.is-vertical > * + *::before { left: 28px; top: -20px; width: 1px; height: 14px; }
|
|
136
|
-
.tm-flow.is-vertical > * + *::after { left: 24px; top: -9px; border: 4px solid transparent; border-top: 6px solid var(--tm-graphite); border-bottom: 0; }
|
|
137
|
-
@media (max-width: 640px) {
|
|
138
|
-
.tm-flow { flex-direction: column; }
|
|
139
|
-
.tm-flow > *, .tm-flow > .tm-node, .tm-flow > .tm-step { flex: none; }
|
|
140
|
-
.tm-flow > * + * { margin: 24px 0 0; }
|
|
141
|
-
.tm-flow > * + *::before { left: 28px; top: -20px; width: 1px; height: 14px; }
|
|
142
|
-
.tm-flow > * + *::after { left: 24px; top: -9px; border: 4px solid transparent; border-top: 6px solid var(--tm-graphite); border-bottom: 0; }
|
|
176
|
+
.tm-flow > .tm-step + .tm-step > :first-child::before {
|
|
177
|
+
content: ""; position: absolute; left: -8px; top: calc(50% - 4px); border: 4px solid transparent; border-left: 5px solid var(--tm-rule-strong); border-right: 0;
|
|
143
178
|
}
|
|
179
|
+
.tm-flow > .tm-step.is-key + .tm-step.is-key::before { border-top: 2px solid var(--tm-route); }
|
|
180
|
+
.tm-flow > .tm-step.is-key + .tm-step.is-key > :first-child::before { border-left-color: var(--tm-route); }
|
|
181
|
+
.tm-flow.is-vertical { flex-direction: column; gap: 26px; max-width: 420px; overflow: visible; }
|
|
182
|
+
.tm-flow.is-vertical > .tm-step { flex: none; }
|
|
183
|
+
.tm-flow.is-vertical > .tm-step + .tm-step::before { left: 50%; top: -22px; width: 0; height: 18px; border-top: 0; border-left: 1.5px solid var(--tm-rule-strong); }
|
|
184
|
+
.tm-flow.is-vertical > .tm-step + .tm-step > :first-child::before { left: calc(50% - 4px); top: -8px; border: 4px solid transparent; border-top: 5px solid var(--tm-rule-strong); border-bottom: 0; }
|
|
144
185
|
|
|
145
|
-
/* ----------
|
|
146
|
-
.tm-
|
|
147
|
-
.tm-
|
|
148
|
-
.tm-
|
|
149
|
-
.tm-
|
|
150
|
-
.tm-
|
|
151
|
-
.tm-
|
|
152
|
-
.tm-
|
|
153
|
-
|
|
154
|
-
.tm-
|
|
155
|
-
|
|
156
|
-
/* ---------- page index (on the blueprint) ---------- */
|
|
157
|
-
.tm-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); border-top: 1px solid var(--tm-rule); column-gap: 32px; }
|
|
158
|
-
.tm-link { display: block; padding: 14px 0; border-bottom: 1px solid var(--tm-rule); text-decoration: none; color: inherit; }
|
|
159
|
-
.tm-link strong { display: block; font-weight: 620; color: var(--tm-route); }
|
|
160
|
-
.tm-link:hover strong { text-decoration: underline; text-underline-offset: 3px; }
|
|
161
|
-
.tm-link span { display: block; margin-top: 2px; font-size: 14px; color: var(--tm-graphite); }
|
|
162
|
-
|
|
163
|
-
/* ---------- tags, code ---------- */
|
|
164
|
-
.tm-badge {
|
|
165
|
-
display: inline-block; padding: 0 6px; border-radius: 3px; vertical-align: 1px;
|
|
166
|
-
font-size: 12.5px; line-height: 20px; font-weight: 560; color: var(--tm-graphite); background: var(--tm-wash);
|
|
167
|
-
}
|
|
168
|
-
.tm-badge.is-accent { color: var(--tm-route); background: var(--tm-route-wash); }
|
|
169
|
-
.tm-badge.is-ok { color: var(--tm-fine); background: color-mix(in srgb, var(--tm-fine) 12%, transparent); }
|
|
170
|
-
.tm-badge.is-warn { color: var(--tm-changed); background: color-mix(in srgb, var(--tm-changed) 13%, transparent); }
|
|
171
|
-
.tm-badge.is-bad { color: var(--tm-broken); background: color-mix(in srgb, var(--tm-broken) 11%, transparent); }
|
|
172
|
-
.tm-path, code { font-family: var(--tm-code); font-size: .88em; padding: 1px 4px; border-radius: 3px; background: var(--tm-wash); overflow-wrap: anywhere; }
|
|
173
|
-
pre { margin: 14px 0; padding: 14px 16px; overflow: auto; border-radius: var(--tm-radius); font: 13.5px/1.6 var(--tm-code); background: var(--tm-wash); }
|
|
174
|
-
pre code { padding: 0; background: none; font-size: inherit; }
|
|
175
|
-
|
|
176
|
-
/* ---------- notes (risk, decision, fact) ---------- */
|
|
177
|
-
.tm-callout { margin: 16px 0; padding: 14px 16px; border-radius: var(--tm-radius); background: var(--tm-sheet); border: 1px solid var(--tm-rule); max-width: 76ch; }
|
|
178
|
-
.tm-callout > :first-child { margin-top: 0; } .tm-callout > :last-child { margin-bottom: 0; }
|
|
186
|
+
/* ---------- panels ---------- */
|
|
187
|
+
.tm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
|
|
188
|
+
.tm-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
189
|
+
.tm-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
190
|
+
.tm-card { position: relative; background: var(--tm-sheet); border: 1px solid var(--tm-rule); border-radius: var(--tm-radius); padding: 18px 20px; min-width: 0; }
|
|
191
|
+
.tm-card > h3 { margin: 0 0 6px; font-size: 15.5px; }
|
|
192
|
+
.tm-card > p { color: var(--tm-graphite); font-size: 14.5px; }
|
|
193
|
+
.tm-card > :last-child { margin-bottom: 0; }
|
|
194
|
+
|
|
195
|
+
.tm-callout { margin: 22px 0; padding: 14px 18px; border-radius: var(--tm-radius); background: var(--tm-wash); color: var(--tm-text); max-width: 72ch; }
|
|
196
|
+
.tm-callout > :last-child { margin-bottom: 0; }
|
|
179
197
|
.tm-callout > b:first-child, .tm-callout > strong:first-child { color: var(--tm-ink); }
|
|
180
|
-
.tm-callout.is-accent {
|
|
181
|
-
.tm-callout.is-accent > b:first-child, .tm-callout.is-accent > strong:first-child { color: var(--tm-route); }
|
|
198
|
+
.tm-callout.is-accent { background: var(--tm-route-wash); }
|
|
199
|
+
.tm-callout.is-accent > b:first-child, .tm-callout.is-accent > strong:first-child { color: var(--tm-route-ink); }
|
|
200
|
+
.tm-callout.is-ok { background: var(--tm-fine-wash); }
|
|
182
201
|
.tm-callout.is-ok > b:first-child, .tm-callout.is-ok > strong:first-child { color: var(--tm-fine); }
|
|
183
|
-
.tm-callout.is-warn {
|
|
202
|
+
.tm-callout.is-warn { background: var(--tm-changed-wash); }
|
|
184
203
|
.tm-callout.is-warn > b:first-child, .tm-callout.is-warn > strong:first-child { color: var(--tm-changed); }
|
|
185
|
-
.tm-callout.is-bad {
|
|
204
|
+
.tm-callout.is-bad { background: var(--tm-broken-wash); }
|
|
186
205
|
.tm-callout.is-bad > b:first-child, .tm-callout.is-bad > strong:first-child { color: var(--tm-broken); }
|
|
187
206
|
|
|
188
|
-
/* ----------
|
|
189
|
-
.tm-
|
|
190
|
-
.tm-
|
|
191
|
-
.tm-
|
|
192
|
-
.tm-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
.tm-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
.tm-
|
|
199
|
-
.tm-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
.tm-
|
|
205
|
-
|
|
206
|
-
.tm-
|
|
207
|
-
.tm-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
/* ---------- page links (on the blueprint) ---------- */
|
|
208
|
+
.tm-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 28px; margin: 18px 0; border-top: 1px solid var(--tm-rule); }
|
|
209
|
+
.tm-link { display: block; padding: 14px 0 15px; border-bottom: 1px solid var(--tm-rule); text-decoration: none; color: var(--tm-graphite); font-size: 14px; line-height: 1.45; }
|
|
210
|
+
.tm-link strong { display: block; font-size: 15.5px; color: var(--tm-ink); margin-bottom: 3px; }
|
|
211
|
+
.tm-link:hover strong { color: var(--tm-route); }
|
|
212
|
+
|
|
213
|
+
/* ---------- small things ---------- */
|
|
214
|
+
.tm-badge { display: inline-block; vertical-align: 0.1em; font: 500 11.5px/1.5 var(--tm-font); padding: 0 6px; border-radius: 4px; background: var(--tm-wash); color: var(--tm-graphite); white-space: nowrap; }
|
|
215
|
+
.tm-badge.is-accent { background: var(--tm-route-wash); color: var(--tm-route-ink); }
|
|
216
|
+
.tm-badge.is-ok { background: var(--tm-fine-wash); color: var(--tm-fine); }
|
|
217
|
+
.tm-badge.is-warn { background: var(--tm-changed-wash); color: var(--tm-changed); }
|
|
218
|
+
.tm-badge.is-bad { background: var(--tm-broken-wash); color: var(--tm-broken); }
|
|
219
|
+
|
|
220
|
+
code, kbd, samp { font-family: var(--tm-code); font-size: 0.88em; }
|
|
221
|
+
:not(pre) > code { background: var(--tm-wash); color: var(--tm-ink); padding: 1px 5px; border-radius: 4px; }
|
|
222
|
+
pre { font-family: var(--tm-code); font-size: 13px; line-height: 1.6; background: var(--tm-sheet); color: var(--tm-text); border: 1px solid var(--tm-rule); border-radius: var(--tm-radius); padding: 14px 16px; overflow-x: auto; margin: 18px 0; max-width: 100%; }
|
|
223
|
+
.tm-path { font-family: var(--tm-code); font-size: 12.5px; color: var(--tm-graphite); }
|
|
224
|
+
|
|
225
|
+
.tm-steps { list-style: none; counter-reset: tm-step; padding: 0; margin: 18px 0; max-width: 68ch; }
|
|
226
|
+
.tm-steps > li { counter-increment: tm-step; position: relative; padding: 0 0 14px 36px; margin: 0; }
|
|
227
|
+
.tm-steps > li::before {
|
|
228
|
+
content: counter(tm-step); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%;
|
|
229
|
+
border: 1px solid var(--tm-rule-strong); color: var(--tm-graphite); font: 500 12px/20px var(--tm-code); text-align: center; background: var(--tm-sheet);
|
|
210
230
|
}
|
|
231
|
+
.tm-steps > li:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; border-left: 1px solid var(--tm-rule); }
|
|
232
|
+
|
|
233
|
+
.tm-table-wrap { overflow-x: auto; margin: 20px 0; }
|
|
234
|
+
.tm-table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
|
|
235
|
+
.tm-table th { text-align: left; font-weight: 500; font-size: 13px; color: var(--tm-graphite); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--tm-rule-strong); }
|
|
236
|
+
.tm-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--tm-rule); vertical-align: top; }
|
|
237
|
+
.tm-table tr:last-child td { border-bottom: 0; }
|
|
238
|
+
|
|
239
|
+
.tm-kv { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 8px 24px; margin: 18px 0; font-size: 14.5px; }
|
|
240
|
+
.tm-kv dt { color: var(--tm-graphite); }
|
|
241
|
+
.tm-kv dd { margin: 0; color: var(--tm-text); }
|
|
242
|
+
|
|
243
|
+
/* ---------- custom diagrams ---------- */
|
|
244
|
+
.tm-svg { display: block; width: 100%; height: auto; margin: 24px 0; font-family: var(--tm-font); }
|
|
245
|
+
.tm-svg .tm-box { fill: var(--tm-sheet); stroke: var(--tm-rule-strong); stroke-width: 1; }
|
|
246
|
+
.tm-svg .tm-box.is-key { stroke: var(--tm-route); stroke-width: 2; }
|
|
247
|
+
.tm-svg .tm-edge { fill: none; stroke: var(--tm-rule-strong); stroke-width: 1.5; }
|
|
248
|
+
.tm-svg .tm-edge.is-key { stroke: var(--tm-route); stroke-width: 2; }
|
|
249
|
+
.tm-svg .tm-label { fill: var(--tm-ink); font-size: 14px; font-weight: 600; }
|
|
250
|
+
.tm-svg .tm-sub { fill: var(--tm-pencil); font-size: 12px; font-family: var(--tm-code); }
|
|
251
|
+
|
|
252
|
+
/* ---------- decisions ---------- */
|
|
253
|
+
.tm-ask { margin: 28px 0; padding: 22px 24px 24px; background: var(--tm-sheet); border: 1px solid var(--tm-rule-strong); border-radius: calc(var(--tm-radius) + 2px); max-width: 720px; }
|
|
254
|
+
.tm-ask > h3 { margin: 0 0 6px; font-size: 18px; }
|
|
255
|
+
.tm-ask > p { color: var(--tm-graphite); font-size: 14.5px; }
|
|
256
|
+
.tm-options { display: grid; gap: 10px; margin: 16px 0; }
|
|
257
|
+
.tm-option { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 12px; padding: 13px 16px; border: 1px solid var(--tm-rule); border-radius: var(--tm-radius); cursor: pointer; background: var(--tm-sheet); transition: border-color 120ms ease, background-color 120ms ease; }
|
|
211
258
|
.tm-option:hover { border-color: var(--tm-rule-strong); }
|
|
259
|
+
.tm-option input { grid-row: 1 / span 2; margin: 3px 0 0; accent-color: var(--tm-route); width: 16px; height: 16px; }
|
|
260
|
+
.tm-option strong { font-size: 15px; }
|
|
261
|
+
.tm-option .tm-why { grid-column: 2; font-size: 13.5px; color: var(--tm-graphite); margin-top: 2px; }
|
|
212
262
|
.tm-option:has(input:checked) { border-color: var(--tm-route); background: var(--tm-route-wash); }
|
|
213
|
-
.tm-
|
|
214
|
-
.tm-
|
|
215
|
-
.tm-
|
|
216
|
-
.tm-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
263
|
+
.tm-ask textarea { width: 100%; min-height: 64px; resize: vertical; font: 14.5px/1.5 var(--tm-font); color: var(--tm-text); background: var(--tm-paper); border: 1px solid var(--tm-rule); border-radius: var(--tm-radius); padding: 10px 12px; }
|
|
264
|
+
.tm-ask textarea:focus { outline: none; border-color: var(--tm-route); }
|
|
265
|
+
.tm-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font: 500 14.5px/1 var(--tm-font); padding: 11px 18px; border-radius: var(--tm-radius); border: 1px solid var(--tm-action); background: var(--tm-action); color: #fff; cursor: pointer; }
|
|
266
|
+
.tm-btn:hover { filter: brightness(0.92); }
|
|
267
|
+
.tm-btn.is-quiet { background: transparent; color: var(--tm-route); }
|
|
268
|
+
[data-tm-sent] .tm-btn { background: var(--tm-wash); border-color: var(--tm-rule); color: var(--tm-graphite); cursor: default; }
|
|
269
|
+
[data-tm-sent] .tm-option { cursor: default; }
|
|
270
|
+
|
|
271
|
+
/* ---------- small screens ---------- */
|
|
272
|
+
@media (max-width: 720px) {
|
|
273
|
+
.tm-page { padding: 28px 18px 80px; }
|
|
274
|
+
.tm-title { font-size: 28px; }
|
|
275
|
+
.tm-lede { font-size: 17px; }
|
|
276
|
+
.tm-section { margin-top: 48px; }
|
|
277
|
+
.tm-map { --tm-label-w: 72px; --tm-node-w: 184px; }
|
|
278
|
+
html[style*="--tm-vw"] .tm-map, html[style*="--tm-vw"] .tm-blueprint { width: calc(var(--tm-vw) - 26px); }
|
|
279
|
+
.tm-layer { gap: 12px; }
|
|
280
|
+
.tm-legend { margin-left: 0; }
|
|
281
|
+
.tm-node { flex: 1 1 100%; max-width: none; }
|
|
282
|
+
.tm-grid-2, .tm-grid-3 { grid-template-columns: minmax(0, 1fr); }
|
|
283
|
+
.tm-flow:not(.is-vertical) { flex-direction: column; gap: 26px; overflow: visible; }
|
|
284
|
+
.tm-flow:not(.is-vertical) > .tm-step { flex: none; }
|
|
285
|
+
.tm-flow:not(.is-vertical) > .tm-step + .tm-step::before { left: 50%; top: -22px; width: 0; height: 18px; border-top: 0; border-left: 1.5px solid var(--tm-rule-strong); }
|
|
286
|
+
.tm-flow:not(.is-vertical) > .tm-step + .tm-step > :first-child::before { left: calc(50% - 4px); top: -8px; border: 4px solid transparent; border-top: 5px solid var(--tm-rule-strong); border-bottom: 0; }
|
|
223
287
|
}
|
|
224
|
-
.tm-btn:hover { background: color-mix(in srgb, var(--tm-ink) 86%, var(--tm-route)); }
|
|
225
|
-
.tm-btn.is-ghost { background: transparent; color: var(--tm-ink); border-color: var(--tm-rule-strong); }
|
|
226
|
-
.tm-ask[data-tm-sent] { border-color: var(--tm-fine); }
|
|
227
|
-
.tm-ask[data-tm-sent] .tm-btn { background: var(--tm-fine); border-color: var(--tm-fine); }
|
|
228
288
|
|
|
229
|
-
@media
|
|
230
|
-
|
|
289
|
+
@media print {
|
|
290
|
+
body { background: #fff; }
|
|
291
|
+
.tm-page { padding: 0; }
|
|
292
|
+
}
|
package/package.json
CHANGED
package/skills/truemap/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: truemap
|
|
3
|
-
description: Explain a codebase with living HTML
|
|
3
|
+
description: Explain a codebase with a living map in HTML that the user can comment on, ask about, and decide on. Use when explaining architecture, a module, a flow, or a data model; when comparing options or needing the user to decide; when asked "how does X work" or "show me the project"; and whenever a .truemap/ folder exists and you are about to explain something it may already cover. Not for one-line answers.
|
|
4
4
|
allowed-tools: Bash(npx -y truemap-cli:*), Bash(npx truemap-cli:*), Bash(truemap:*)
|
|
5
5
|
license: MIT
|
|
6
6
|
---
|
|
@@ -12,9 +12,10 @@ Pages live in `.truemap/` at the repo root (`index.html` is the project blueprin
|
|
|
12
12
|
Current instructions live in the CLI – this file stays short so it never goes stale:
|
|
13
13
|
|
|
14
14
|
- `npx -y truemap-cli --help` – commands and the chat loop
|
|
15
|
-
- `npx -y truemap-cli
|
|
15
|
+
- `npx -y truemap-cli outline` – a fast repo outline for the first blueprint
|
|
16
|
+
- `npx -y truemap-cli guide` – how to write pages: the map, `data-src` anchors, page kit, decision forms
|
|
16
17
|
|
|
17
|
-
Flow: look in `.truemap/` first
|
|
18
|
+
Flow: look in `.truemap/` first, update or write the page, run `npx -y truemap-cli <page>` (add `--annotate` when you want the user's review), then follow the `next_step` it prints.
|
|
18
19
|
Always also give the user a 1–3 line answer in the terminal.
|
|
19
20
|
|
|
20
21
|
## Request
|
package/src/check.js
CHANGED
|
@@ -223,7 +223,38 @@ export function checkPage(ctx, page) {
|
|
|
223
223
|
});
|
|
224
224
|
const counts = { ok: 0, changed: 0, broken: 0 };
|
|
225
225
|
for (const a of anchors) counts[a.state]++;
|
|
226
|
-
return { page, anchors, counts };
|
|
226
|
+
return { page, anchors, counts, wires: checkWires(html), layout: checkLayout(html) };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Maps that are too big to read at a glance (the guide: at most 12 boxes per map, 4 per layer). */
|
|
230
|
+
export function checkLayout(html) {
|
|
231
|
+
const notes = [];
|
|
232
|
+
const NODE = /class=["'][^"']*\btm-node(?![-\w])/g;
|
|
233
|
+
const maps = html.split(/class=["'][^"']*\btm-(?:map|blueprint)(?![-\w])/).slice(1);
|
|
234
|
+
maps.forEach((body, i) => {
|
|
235
|
+
const total = (body.match(NODE) || []).length;
|
|
236
|
+
if (total > 12) notes.push(`map ${i + 1} has ${total} boxes; 12 or fewer reads at a glance, split the rest into a module page`);
|
|
237
|
+
body.split(/class=["'][^"']*\btm-layer(?![-\w])/).slice(1).forEach((layer, j) => {
|
|
238
|
+
const n = (layer.match(NODE) || []).length;
|
|
239
|
+
if (n > 4) notes.push(`map ${i + 1}, layer ${j + 1} has ${n} boxes; keep it to 4`);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
return notes;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Map wires whose data-to names an id that is not on the page (they would silently not be drawn). */
|
|
246
|
+
export function checkWires(html) {
|
|
247
|
+
const ID = /\sid\s*=\s*["']([^"']+)["']/i;
|
|
248
|
+
const ids = new Set([...html.matchAll(new RegExp(ID.source, 'gi'))].map((m) => m[1]));
|
|
249
|
+
const problems = [];
|
|
250
|
+
for (const m of html.matchAll(/<[^>]*\sdata-to\s*=\s*["']([^"']*)["'][^>]*>/gi)) {
|
|
251
|
+
const from = (m[0].match(ID) || [])[1] || '(a box without an id)';
|
|
252
|
+
for (const spec of m[1].split(/[\s,]+/).filter(Boolean)) {
|
|
253
|
+
const to = spec.split(':')[0];
|
|
254
|
+
if (!ids.has(to)) problems.push({ from, to, reason: `no element with id="${to}"` });
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return problems;
|
|
227
258
|
}
|
|
228
259
|
|
|
229
260
|
export function checkAll(root, pages) {
|