@venizia/vulcan 0.4.8 → 0.4.9-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/base/extensions/vulcan-guards.ts +48 -41
  2. package/base/hooks/antigravity-guards.ts +4 -3
  3. package/base/hooks/codex-guards.ts +17 -6
  4. package/base/hooks/guard-git.ts +8 -8
  5. package/base/hooks/guard-manifest.ts +5 -5
  6. package/base/hooks/guard-outside.ts +8 -8
  7. package/base/hooks/guard-package.ts +6 -6
  8. package/base/hooks/guard-remote-hosts.ts +14 -9
  9. package/base/hooks/guard-scripting.ts +6 -6
  10. package/base/hooks/guard-writes.ts +20 -11
  11. package/base/hooks/post-tool.ts +4 -3
  12. package/base/hooks/prompt-submit.ts +4 -3
  13. package/base/hooks/session-start.ts +5 -3
  14. package/base/hooks/stop.ts +4 -3
  15. package/base/hooks/subagent-start.ts +2 -2
  16. package/base/make/vulcan.mk +1 -4
  17. package/base/skills/build-a-feature/SKILL.md +1 -1
  18. package/base/skills/docs-update/SKILL.md +11 -5
  19. package/base/skills/docs-update/evals/evals.json +1 -1
  20. package/base/skills/docs-writing/SKILL.md +1 -1
  21. package/base/skills/plan-a-change/references/spec-card.md +1 -1
  22. package/base/skills/ship/SKILL.md +1 -1
  23. package/base/skills/visualize-work/SKILL.md +29 -6
  24. package/base/skills/visualize-work/references/spec.md +16 -5
  25. package/package.json +5 -6
  26. package/src/agents/atlas-block.ts +43 -43
  27. package/src/agents/codex-hooks.ts +55 -52
  28. package/src/agents/common/types.ts +1 -1
  29. package/src/agents/detect.ts +19 -16
  30. package/src/agents/exclude.ts +97 -98
  31. package/src/agents/hooks-json.ts +41 -43
  32. package/src/agents/local.ts +46 -43
  33. package/src/agents/prompt.ts +45 -42
  34. package/src/agents/render.ts +203 -201
  35. package/src/agents/resolve.ts +133 -134
  36. package/src/agents/table.ts +12 -8
  37. package/src/cli.ts +3 -1
  38. package/src/commands/add.command.ts +2 -2
  39. package/src/commands/agents.command.ts +11 -17
  40. package/src/commands/clean.command.ts +6 -6
  41. package/src/commands/doctor.command.ts +6 -4
  42. package/src/commands/help.command.ts +11 -9
  43. package/src/commands/init.command.ts +14 -8
  44. package/src/commands/preset.command.ts +2 -2
  45. package/src/commands/profile.command.ts +43 -50
  46. package/src/commands/sync.command.ts +109 -111
  47. package/src/commands/upgrade.command.ts +85 -78
  48. package/src/commands/visualize.command.ts +20 -5
  49. package/src/commands/x.command.ts +55 -50
  50. package/src/common/format.ts +23 -21
  51. package/src/common/index.ts +2 -0
  52. package/src/common/json.ts +8 -5
  53. package/src/common/layout-folder.ts +96 -111
  54. package/src/common/paths.ts +14 -12
  55. package/src/common/record.ts +7 -0
  56. package/src/common/text.ts +7 -0
  57. package/src/config/common/constants.ts +13 -1
  58. package/src/config/common/types.ts +8 -1
  59. package/src/config/loader.ts +53 -48
  60. package/src/config/packages.ts +17 -11
  61. package/src/config/schema.ts +54 -7
  62. package/src/create/add-app.ts +604 -493
  63. package/src/create/add-lib.ts +249 -242
  64. package/src/create/bunfig.ts +26 -23
  65. package/src/create/checks.ts +36 -34
  66. package/src/create/common/constants.ts +1 -0
  67. package/src/create/common/failure.ts +10 -0
  68. package/src/create/common/index.ts +2 -0
  69. package/src/create/common/preset-path.ts +11 -0
  70. package/src/create/common/types.ts +7 -2
  71. package/src/create/diff.ts +21 -23
  72. package/src/create/dockerignore.ts +26 -24
  73. package/src/create/files.ts +7 -5
  74. package/src/create/init-monorepo.ts +78 -80
  75. package/src/create/lib-preset.ts +62 -61
  76. package/src/create/manifest-json.ts +10 -4
  77. package/src/create/names.ts +217 -210
  78. package/src/create/next.ts +27 -24
  79. package/src/create/plan.ts +15 -12
  80. package/src/create/preset-diff.ts +415 -240
  81. package/src/create/preset-menu.ts +40 -34
  82. package/src/create/preset.ts +207 -194
  83. package/src/create/process.ts +80 -71
  84. package/src/create/scratch.ts +49 -48
  85. package/src/create/workspace.ts +423 -398
  86. package/src/doctor/checks.ts +1069 -998
  87. package/src/doctor/makefile.ts +17 -13
  88. package/src/doctor/runner.ts +88 -116
  89. package/src/doctor/skills.ts +97 -95
  90. package/src/doctor/tags.ts +44 -41
  91. package/src/hooks/codex-patch.ts +27 -24
  92. package/src/hooks/command-view.ts +44 -39
  93. package/src/hooks/common/constants.ts +0 -3
  94. package/src/hooks/common/types.ts +15 -1
  95. package/src/hooks/decision.ts +38 -42
  96. package/src/hooks/guard-git.ts +52 -50
  97. package/src/hooks/guard-manifest.ts +58 -55
  98. package/src/hooks/guard-outside.ts +109 -88
  99. package/src/hooks/guard-package.ts +86 -77
  100. package/src/hooks/guard-scripting.ts +20 -15
  101. package/src/hooks/guard-writes.ts +169 -111
  102. package/src/hooks/owner-reply.ts +128 -128
  103. package/src/hooks/post-tool.ts +94 -93
  104. package/src/hooks/project-guards.ts +93 -55
  105. package/src/hooks/project-tmp.ts +27 -24
  106. package/src/hooks/remote-hosts.ts +157 -149
  107. package/src/hooks/session-digest.ts +99 -95
  108. package/src/hooks/shell.ts +519 -500
  109. package/src/hooks/subagent-card.ts +11 -7
  110. package/src/hooks/trusted-scripts.ts +158 -80
  111. package/src/init/common/types.ts +1 -1
  112. package/src/init/scaffold.ts +137 -134
  113. package/src/local/clean.ts +39 -37
  114. package/src/local/format.ts +21 -17
  115. package/src/local/scan.ts +146 -140
  116. package/src/manifest/render.ts +127 -112
  117. package/src/owner/card.ts +51 -46
  118. package/src/owner/profile.ts +100 -96
  119. package/src/owner/reply-switch.ts +9 -6
  120. package/src/owner/shape.ts +72 -70
  121. package/src/owner/survey.ts +175 -164
  122. package/src/owner/view.ts +62 -59
  123. package/src/owner/violations.ts +119 -123
  124. package/src/router.ts +4 -1
  125. package/src/rules/base.ts +15 -11
  126. package/src/rules/common/types.ts +1 -1
  127. package/src/rules/parser.ts +39 -32
  128. package/src/rules/slots.ts +8 -6
  129. package/src/signals/claims.ts +30 -28
  130. package/src/signals/classify.ts +36 -33
  131. package/src/signals/loop.ts +39 -37
  132. package/src/signals/state.ts +80 -85
  133. package/src/skills/frontmatter.ts +28 -28
  134. package/src/sync/agent-files.ts +217 -199
  135. package/src/sync/agent-removal.ts +62 -68
  136. package/src/sync/atlas-block.ts +45 -43
  137. package/src/sync/base-rules.ts +32 -30
  138. package/src/sync/claude-launch.ts +74 -37
  139. package/src/sync/common/constants.ts +4 -0
  140. package/src/sync/common/index.ts +1 -0
  141. package/src/sync/common/symlink.ts +9 -0
  142. package/src/sync/common/types.ts +2 -2
  143. package/src/sync/exclude.ts +77 -69
  144. package/src/sync/local-choice.ts +50 -47
  145. package/src/sync/planner.ts +64 -68
  146. package/src/sync/prune.ts +52 -48
  147. package/src/sync/settings.ts +167 -168
  148. package/src/ui/capability.ts +12 -7
  149. package/src/ui/keyboard.ts +35 -33
  150. package/src/ui/prompt.ts +81 -77
  151. package/src/visualize/assets.ts +379 -195
  152. package/src/visualize/charts.ts +188 -176
  153. package/src/visualize/compare-css.ts +31 -0
  154. package/src/visualize/compare-render.ts +196 -0
  155. package/src/visualize/compare-schema.ts +81 -0
  156. package/src/visualize/compare-validate.ts +126 -0
  157. package/src/visualize/constants.ts +29 -3
  158. package/src/visualize/diagrams.ts +189 -174
  159. package/src/visualize/gate.ts +136 -0
  160. package/src/visualize/grid-span.ts +34 -0
  161. package/src/visualize/icons.ts +9 -4
  162. package/src/visualize/index.ts +2 -0
  163. package/src/visualize/kinds-css.ts +54 -0
  164. package/src/visualize/kinds-render.ts +698 -0
  165. package/src/visualize/kinds-schema.ts +148 -0
  166. package/src/visualize/kinds-validate.ts +186 -0
  167. package/src/visualize/labels-vi.ts +109 -0
  168. package/src/visualize/labels.ts +53 -0
  169. package/src/visualize/layout.ts +112 -92
  170. package/src/visualize/page.ts +140 -114
  171. package/src/visualize/render.ts +158 -114
  172. package/src/visualize/schema.ts +21 -1
  173. package/src/visualize/sections.ts +401 -309
  174. package/src/visualize/sources.ts +270 -0
  175. package/src/visualize/theme.ts +474 -0
  176. package/src/visualize/validate.ts +15 -5
  177. package/src/wiki/anchors.ts +39 -37
  178. package/src/wiki/command.ts +4 -4
  179. package/src/wiki/source-links.ts +49 -49
@@ -0,0 +1,136 @@
1
+ /**
2
+ * The last check of a page, on the markup that is about to be written: whatever the renderer did, the page makes no
3
+ * request, has no inline style or handler, and holds exactly the style and the scripts its policy names. The renderer
4
+ * escapes every text, so a spec cannot add markup; this gate says so about the output instead of trusting that.
5
+ */
6
+ export class PageGate {
7
+ /** Tags a page of this kind never has: each one loads something or sends something. */
8
+ static readonly FORBIDDEN_TAGS = new Set([
9
+ 'link',
10
+ 'img',
11
+ 'iframe',
12
+ 'object',
13
+ 'embed',
14
+ 'base',
15
+ 'form',
16
+ 'frame',
17
+ 'frameset',
18
+ 'audio',
19
+ 'video',
20
+ 'source',
21
+ 'track',
22
+ 'picture',
23
+ 'input',
24
+ 'use',
25
+ 'image',
26
+ 'foreignobject',
27
+ ]);
28
+
29
+ /** Attributes that load or run something. */
30
+ static readonly FORBIDDEN_ATTRIBUTES = new Set([
31
+ 'style',
32
+ 'src',
33
+ 'srcset',
34
+ 'formaction',
35
+ 'action',
36
+ 'ping',
37
+ 'poster',
38
+ 'background',
39
+ 'xlink:href',
40
+ ]);
41
+
42
+ /** Presentation attributes that take a `url(...)` and fetch it: they may name a place in the page and nothing else. */
43
+ static readonly LOADING_ATTRIBUTES = new Set([
44
+ 'mask',
45
+ 'fill',
46
+ 'stroke',
47
+ 'filter',
48
+ 'clip-path',
49
+ 'marker-start',
50
+ 'marker-mid',
51
+ 'marker-end',
52
+ 'cursor',
53
+ 'content',
54
+ ]);
55
+
56
+ /** The executable scripts of a page: the head script that applies the saved theme, and the page script. */
57
+ static readonly SCRIPTS = 2;
58
+
59
+ static readonly CHECK =
60
+ 'output gate: no request, no inline style or handler, one style and two scripts, links to https only';
61
+
62
+ /** What is wrong with `html`, one sentence each; empty when it is sound. */
63
+ static problems(opts: { html: string }): string[] {
64
+ const { html } = opts;
65
+ const problems: string[] = [];
66
+ const tags = html.matchAll(/<([a-zA-Z][a-zA-Z0-9:-]*)((?:\s+[^\s=>/]+(?:="[^"]*")?)*)\s*\/?>/g);
67
+ let scripts = 0;
68
+ let styles = 0;
69
+
70
+ for (const [, rawName = '', attributes = ''] of tags) {
71
+ const name = rawName.toLowerCase();
72
+
73
+ if (name === 'script') {
74
+ scripts += /\stype="application\/json"/.test(attributes) ? 0 : 1;
75
+ }
76
+
77
+ if (name === 'style') {
78
+ styles += 1;
79
+ }
80
+
81
+ if (PageGate.FORBIDDEN_TAGS.has(name)) {
82
+ problems.push(`the page has a <${name}> tag`);
83
+ }
84
+
85
+ for (const [, attribute = '', value = ''] of attributes.matchAll(
86
+ /\s+([^\s=>/]+)(?:="([^"]*)")?/g,
87
+ )) {
88
+ const key = attribute.toLowerCase();
89
+
90
+ if (PageGate.FORBIDDEN_ATTRIBUTES.has(key) || key.startsWith('on')) {
91
+ problems.push(`a <${name}> tag has the attribute ${key}`);
92
+ }
93
+
94
+ if (key === 'href' && name === 'a') {
95
+ if (!value.startsWith('#') && !value.startsWith('https://')) {
96
+ problems.push(
97
+ `a link goes to '${value.slice(0, 40)}', not an https address or a place on the page`,
98
+ );
99
+ }
100
+
101
+ continue;
102
+ }
103
+
104
+ if (key === 'href') {
105
+ problems.push(`a <${name}> tag has an href`);
106
+ }
107
+
108
+ // A label, a title or a data attribute is text and may say anything; only an attribute that can fetch is held to it.
109
+ if (
110
+ PageGate.LOADING_ATTRIBUTES.has(key) &&
111
+ (/url\((?!#)/i.test(value) || /(?:^|[\s(])(?:https?:)?\/\//i.test(value))
112
+ ) {
113
+ problems.push(`the ${key} of a <${name}> tag holds an address`);
114
+ }
115
+ }
116
+ }
117
+
118
+ if (scripts !== PageGate.SCRIPTS) {
119
+ problems.push(`the page has ${scripts} scripts; its policy names ${PageGate.SCRIPTS}`);
120
+ }
121
+
122
+ if (styles !== 1) {
123
+ problems.push(`the page has ${styles} style blocks; its policy names 1`);
124
+ }
125
+
126
+ for (const block of html.matchAll(/<style>([\s\S]*?)<\/style>/g)) {
127
+ const css = block[1] ?? '';
128
+
129
+ if (/@import|@font-face|url\((?!#)/i.test(css)) {
130
+ problems.push('the style loads something: @import, @font-face or url()');
131
+ }
132
+ }
133
+
134
+ return [...new Set(problems)];
135
+ }
136
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Cards in a row share their rows: each card spans as many rows of its grid as it has parts, and takes those rows over
3
+ * from the grid (`grid-template-rows: subgrid`), so the score, the title, each criterion and each pro of one card sit
4
+ * at the same height as the same part of its neighbours, whatever wraps. The number of rows is only known when the page
5
+ * is made, and an inline `style` is blocked by the page's policy, so a class names the span (`sp4`) and the page carries
6
+ * the rules for exactly the spans it uses.
7
+ */
8
+ export class GridSpans {
9
+ /** The most rows a card can span: a tag, a total, a title, a line, 8 criteria, 6 pros and 6 cons, and room to spare. */
10
+ static readonly MAX = 40;
11
+
12
+ /** The class that makes an element span `count` rows; remembers the span so the page carries its rule. */
13
+ static classOf(opts: { count: number; spans: Set<number> }): string {
14
+ const count = Math.max(1, Math.min(GridSpans.MAX, Math.round(opts.count)));
15
+
16
+ opts.spans.add(count);
17
+
18
+ return `sp${count}`;
19
+ }
20
+
21
+ /** The rules of the spans a page uses; with no subgrid in the browser, or in one column (a phone), a card is a plain block. */
22
+ static css(opts: { spans: Set<number> }): string {
23
+ if (opts.spans.size === 0) {
24
+ return '';
25
+ }
26
+
27
+ const rules = [...opts.spans]
28
+ .sort((a, b) => a - b)
29
+ .map((count) => `.sp${count}{grid-row-end:span ${count}}`)
30
+ .join('');
31
+
32
+ return `@media (min-width:621px){@supports (grid-template-rows:subgrid){${rules}}}`;
33
+ }
34
+ }
@@ -19,10 +19,15 @@ const PATHS: Record<string, string> = {
19
19
  quote: '<path d="M9 7H5v6h4l-2 4M19 7h-4v6h4l-2 4"/>',
20
20
  star: '<path d="M12 3l2.7 5.8 6.3.7-4.7 4.3 1.3 6.2L12 17l-5.6 3 1.3-6.2L3 9.5l6.3-.7z"/>',
21
21
  check: '<path d="M5 12.5l4.5 4.5L19 7"/>',
22
+ sun: '<circle cx="12" cy="12" r="4.2"/><path d="M12 2.5v2.2M12 19.3v2.2M4.6 4.6l1.6 1.6M17.8 17.8l1.6 1.6M2.5 12h2.2M19.3 12h2.2M4.6 19.4l1.6-1.6M17.8 6.2l1.6-1.6"/>',
23
+ moon: '<path d="M20.2 14.6A8.4 8.4 0 0 1 9.4 3.8 8.4 8.4 0 1 0 20.2 14.6Z"/>',
22
24
  };
23
25
 
24
- export const iconSvg = (opts: { name: string; size?: number }): string => {
25
- const size = opts.size ?? 20;
26
+ export class IconSet {
27
+ /** An icon; `className` is added after `ic` for a page rule that targets one icon (the theme switch's sun and moon). */
28
+ static iconSvg(opts: { name: string; size?: number; className?: string }): string {
29
+ const size = opts.size ?? 20;
26
30
 
27
- return `<svg class="ic" viewBox="0 0 24 24" width="${size}" height="${size}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${PATHS[opts.name] ?? ''}</svg>`;
28
- };
31
+ return `<svg class="ic${opts.className === undefined ? '' : ` ${opts.className}`}" viewBox="0 0 24 24" width="${size}" height="${size}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${PATHS[opts.name] ?? ''}</svg>`;
32
+ }
33
+ }
@@ -2,5 +2,7 @@ export * from './constants.ts';
2
2
  export * from './schema.ts';
3
3
  export * from './validate.ts';
4
4
  export * from './layout.ts';
5
+ export * from './labels.ts';
5
6
  export * from './page.ts';
6
7
  export * from './render.ts';
8
+ export * from './theme.ts';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The look of the sequence, the lifecycle and the tree. Colours come from the page's tokens only: the figures sit on the
3
+ * always-dark slab (their own background, so they read the same whatever the section around them does), the phone
4
+ * lists sit on the page ground. Nothing here names a colour of a project.
5
+ */
6
+ export const NEW_KINDS_CSS = `.kfig{margin:0}
7
+ .kfig figcaption{margin-top:14px;max-width:70ch;color:var(--muted);font-size:15px;line-height:1.5}
8
+ .kf{display:block;max-width:100%;height:auto;background:var(--slab);border:1px solid var(--slab-3);color:var(--slab-ink);border-radius:4px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
9
+ .kf text{fill:var(--slab-body);font-size:12px}
10
+ .kf .kt{fill:var(--slab-ink);font-size:14px;font-weight:600;letter-spacing:-.01em}
11
+ .kf .ks{fill:var(--slab-muted);font-size:12px}
12
+ .kf .kw{fill:var(--slab-muted);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase}
13
+ .kf .ke{fill:var(--slab-body);font-size:13px}
14
+ .kf .knum{fill:var(--slab-muted);font-weight:600}
15
+ .kf .kh{paint-order:stroke;stroke:var(--slab);stroke-width:8px;stroke-linejoin:round}
16
+ .kf .kbox{fill:var(--slab-2);stroke:var(--slab-3);stroke-width:1}
17
+ .kf .kk-start .kbox{stroke:var(--slab-ink);stroke-width:2}
18
+ .kf .kk-end .kbox{stroke:var(--slab-muted);stroke-width:1.5}
19
+ .kf .kinner{fill:none;stroke:var(--slab-muted);stroke-width:1.5}
20
+ .kf .kline{fill:none;stroke:var(--slab-body);stroke-width:1.8}
21
+ .kf .kdash{stroke-dasharray:7 5}
22
+ .kf .khead{fill:var(--slab-body);stroke:none}
23
+ .kf .kopen{fill:none;stroke:var(--slab-body);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
24
+ .kf .klife{fill:none;stroke:var(--slab-muted);stroke-width:1;stroke-dasharray:1 5;stroke-linecap:round}
25
+ .kf .kdot{fill:var(--slab-ink)}
26
+ .kf .kguide{fill:none;stroke:var(--slab-muted);stroke-width:1.5}
27
+ .kf .kic{color:var(--slab-ink)}
28
+ .kf .kn-blocked .kbox{stroke:var(--slab-ink);stroke-width:2}
29
+ .kf .kn-waiting .kbox,.kf .kn-in-progress .kbox{stroke:var(--slab-body);stroke-width:1.5}
30
+ .kf .kn-not-started .kbox,.kf .kn-dropped .kbox{stroke:var(--slab-muted);stroke-dasharray:4 4}
31
+ .path.kl{display:none}
32
+ .path.kl,.path.kl ul,.path.kl ol{margin:0;padding:0;list-style:none}
33
+ .path.kl li{display:block;border:0;padding:10px 0;color:var(--body);font-size:16px;line-height:1.5}
34
+ .path.kl li+li{border-top:1px solid color-mix(in srgb,var(--ink) 12%,transparent)}
35
+ .path.kl b{color:var(--ink);font-weight:600}
36
+ .path.kl .mut{color:var(--muted)}
37
+ .path.kl .verb{display:inline-block;margin:0 8px;padding:0 8px;border:1px solid color-mix(in srgb,var(--ink) 35%,transparent);border-radius:4px;color:var(--body);font-size:14px;line-height:1.6}
38
+ .path.kl .kv-reply{border-style:dashed}
39
+ .path.kl .kv-async{border-left-width:4px}
40
+ .path.kl .kword{color:var(--muted);font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase}
41
+ .path.kl .knote{display:block;margin-top:2px;color:var(--muted);font-size:14px}
42
+ .path.kl .kparts{margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid color-mix(in srgb,var(--ink) 12%,transparent)}
43
+ .path.kl .kparts li,.path.kl .kparts li+li{padding:3px 0;border:0}
44
+ .path.kl .kmsgs{padding-left:28px;list-style:decimal}
45
+ .path.kl .kmsgs li{display:list-item}
46
+ .path.kl .kmsgs li::marker{color:var(--muted);font-weight:600}
47
+ .path.kl .kout{margin:4px 0 0 14px}
48
+ .path.kl .kout li,.path.kl .kout li+li{padding:3px 0;border:0}
49
+ .path.kl .kout .verb{margin-left:0}
50
+ .path.kl .kt-in{margin:8px 0 0 6px;padding-left:16px;border-left:2px solid color-mix(in srgb,var(--ink) 18%,transparent)}
51
+ .path.kl .kt-in li{padding:6px 0}
52
+ .path.kl .kt-in li+li{border-top:0}
53
+ .path.kl .chip{margin-left:6px;vertical-align:middle}
54
+ `;