@venizia/vulcan 0.4.9-0 → 0.4.9-2

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 (141) hide show
  1. package/base/extensions/vulcan-guards.ts +48 -41
  2. package/base/hooks/antigravity-guards.ts +2 -2
  3. package/base/hooks/codex-guards.ts +15 -5
  4. package/base/hooks/guard-git.ts +8 -8
  5. package/base/hooks/guard-manifest.ts +4 -5
  6. package/base/hooks/guard-outside.ts +8 -8
  7. package/base/hooks/guard-package.ts +5 -6
  8. package/base/hooks/guard-remote-hosts.ts +6 -7
  9. package/base/hooks/guard-scripting.ts +5 -6
  10. package/base/hooks/guard-writes.ts +8 -9
  11. package/base/hooks/post-tool.ts +2 -2
  12. package/base/hooks/prompt-submit.ts +2 -2
  13. package/base/hooks/session-start.ts +3 -3
  14. package/base/hooks/stop.ts +2 -2
  15. package/base/hooks/subagent-start.ts +2 -2
  16. package/base/skills/docs-update/SKILL.md +4 -2
  17. package/base/skills/visualize-work/SKILL.md +9 -0
  18. package/package.json +3 -3
  19. package/src/agents/atlas-block.ts +43 -43
  20. package/src/agents/codex-hooks.ts +45 -43
  21. package/src/agents/detect.ts +19 -16
  22. package/src/agents/exclude.ts +96 -97
  23. package/src/agents/hooks-json.ts +38 -36
  24. package/src/agents/local.ts +46 -43
  25. package/src/agents/prompt.ts +45 -42
  26. package/src/agents/render.ts +201 -195
  27. package/src/agents/resolve.ts +133 -134
  28. package/src/agents/table.ts +12 -8
  29. package/src/commands/add.command.ts +2 -2
  30. package/src/commands/agents.command.ts +11 -17
  31. package/src/commands/clean.command.ts +6 -6
  32. package/src/commands/doctor.command.ts +4 -4
  33. package/src/commands/init.command.ts +12 -8
  34. package/src/commands/preset.command.ts +2 -2
  35. package/src/commands/profile.command.ts +42 -49
  36. package/src/commands/sync.command.ts +109 -111
  37. package/src/commands/upgrade.command.ts +80 -75
  38. package/src/commands/visualize.command.ts +7 -13
  39. package/src/commands/x.command.ts +55 -50
  40. package/src/common/format.ts +23 -21
  41. package/src/common/json.ts +8 -5
  42. package/src/common/layout-folder.ts +94 -91
  43. package/src/common/paths.ts +14 -12
  44. package/src/config/loader.ts +52 -49
  45. package/src/config/packages.ts +14 -11
  46. package/src/config/schema.ts +3 -3
  47. package/src/create/add-app.ts +519 -509
  48. package/src/create/add-lib.ts +237 -240
  49. package/src/create/bunfig.ts +26 -23
  50. package/src/create/checks.ts +36 -34
  51. package/src/create/diff.ts +21 -23
  52. package/src/create/dockerignore.ts +26 -24
  53. package/src/create/files.ts +7 -5
  54. package/src/create/init-monorepo.ts +75 -80
  55. package/src/create/lib-preset.ts +59 -63
  56. package/src/create/manifest-json.ts +10 -4
  57. package/src/create/names.ts +217 -210
  58. package/src/create/next.ts +26 -23
  59. package/src/create/plan.ts +15 -12
  60. package/src/create/preset-diff.ts +301 -303
  61. package/src/create/preset-menu.ts +38 -32
  62. package/src/create/preset.ts +202 -197
  63. package/src/create/process.ts +79 -72
  64. package/src/create/scratch.ts +48 -49
  65. package/src/create/workspace.ts +404 -396
  66. package/src/doctor/checks.ts +1027 -1014
  67. package/src/doctor/makefile.ts +17 -13
  68. package/src/doctor/runner.ts +88 -118
  69. package/src/doctor/skills.ts +97 -95
  70. package/src/doctor/tags.ts +42 -37
  71. package/src/hooks/codex-patch.ts +25 -22
  72. package/src/hooks/command-view.ts +44 -39
  73. package/src/hooks/decision.ts +37 -37
  74. package/src/hooks/guard-git.ts +51 -49
  75. package/src/hooks/guard-manifest.ts +58 -55
  76. package/src/hooks/guard-outside.ts +93 -91
  77. package/src/hooks/guard-package.ts +82 -79
  78. package/src/hooks/guard-scripting.ts +19 -14
  79. package/src/hooks/guard-writes.ts +154 -149
  80. package/src/hooks/owner-reply.ts +127 -127
  81. package/src/hooks/post-tool.ts +94 -93
  82. package/src/hooks/project-guards.ts +65 -62
  83. package/src/hooks/project-tmp.ts +27 -24
  84. package/src/hooks/remote-hosts.ts +153 -130
  85. package/src/hooks/session-digest.ts +98 -101
  86. package/src/hooks/shell.ts +509 -499
  87. package/src/hooks/subagent-card.ts +11 -7
  88. package/src/hooks/trusted-scripts.ts +106 -104
  89. package/src/init/scaffold.ts +135 -132
  90. package/src/local/clean.ts +38 -36
  91. package/src/local/format.ts +21 -17
  92. package/src/local/scan.ts +144 -138
  93. package/src/manifest/render.ts +110 -104
  94. package/src/owner/card.ts +51 -46
  95. package/src/owner/profile.ts +99 -93
  96. package/src/owner/reply-switch.ts +9 -6
  97. package/src/owner/shape.ts +71 -69
  98. package/src/owner/survey.ts +173 -171
  99. package/src/owner/view.ts +62 -59
  100. package/src/owner/violations.ts +119 -123
  101. package/src/rules/base.ts +15 -11
  102. package/src/rules/parser.ts +39 -32
  103. package/src/rules/slots.ts +8 -6
  104. package/src/signals/claims.ts +30 -28
  105. package/src/signals/classify.ts +38 -33
  106. package/src/signals/loop.ts +39 -37
  107. package/src/signals/state.ts +79 -81
  108. package/src/skills/frontmatter.ts +28 -28
  109. package/src/sync/agent-files.ts +217 -199
  110. package/src/sync/agent-removal.ts +56 -59
  111. package/src/sync/atlas-block.ts +45 -43
  112. package/src/sync/base-rules.ts +32 -30
  113. package/src/sync/claude-launch.ts +36 -34
  114. package/src/sync/exclude.ts +77 -69
  115. package/src/sync/local-choice.ts +50 -47
  116. package/src/sync/planner.ts +59 -61
  117. package/src/sync/prune.ts +52 -48
  118. package/src/sync/settings.ts +166 -167
  119. package/src/ui/capability.ts +12 -7
  120. package/src/ui/keyboard.ts +38 -38
  121. package/src/ui/prompt.ts +79 -77
  122. package/src/visualize/assets.ts +33 -24
  123. package/src/visualize/charts.ts +179 -176
  124. package/src/visualize/compare-css.ts +3 -2
  125. package/src/visualize/compare-render.ts +9 -7
  126. package/src/visualize/diagrams.ts +189 -174
  127. package/src/visualize/grid-span.ts +34 -0
  128. package/src/visualize/icons.ts +7 -5
  129. package/src/visualize/kinds-render.ts +50 -45
  130. package/src/visualize/kinds-validate.ts +12 -10
  131. package/src/visualize/labels.ts +21 -17
  132. package/src/visualize/layout.ts +112 -97
  133. package/src/visualize/page.ts +92 -104
  134. package/src/visualize/render.ts +143 -140
  135. package/src/visualize/sections.ts +395 -384
  136. package/src/visualize/sources.ts +2 -2
  137. package/src/visualize/theme.ts +12 -10
  138. package/src/visualize/validate.ts +13 -9
  139. package/src/wiki/anchors.ts +38 -36
  140. package/src/wiki/command.ts +4 -4
  141. package/src/wiki/source-links.ts +46 -44
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { TChrome } from './constants.ts';
3
- import { escapeText } from './layout.ts';
3
+ import { FigureLayout } from './layout.ts';
4
4
  import type { TVisualizeSpec } from './schema.ts';
5
5
 
6
6
  /** One line of plain text: no markup is interpreted anywhere, it is all escaped. */
@@ -59,7 +59,7 @@ interface ISourceUse {
59
59
  source: TSource;
60
60
  }
61
61
 
62
- const escaped = (value: string): string => escapeText({ value });
62
+ const escaped = (value: string): string => FigureLayout.escapeText({ value });
63
63
 
64
64
  const REPO = /^[A-Za-z0-9][A-Za-z0-9._-]*(\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/;
65
65
  const COMMIT = /^[0-9a-f]{40}$/;
@@ -107,12 +107,14 @@ const luminance = (hex: string): number => {
107
107
  return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
108
108
  };
109
109
 
110
- export const contrastOf = (opts: { foreground: string; background: string }): number => {
111
- const a = luminance(opts.foreground);
112
- const b = luminance(opts.background);
110
+ export class Theme {
111
+ static contrastOf(opts: { foreground: string; background: string }): number {
112
+ const a = luminance(opts.foreground);
113
+ const b = luminance(opts.background);
113
114
 
114
- return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
115
- };
115
+ return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
116
+ }
117
+ }
116
118
 
117
119
  const hueOf = (hex: string): number => {
118
120
  const { r, g, b } = parse(hex);
@@ -209,7 +211,7 @@ export class ProjectTheme {
209
211
  ['the page', lightGrounds.bg],
210
212
  ['a soft panel', lightGrounds.bgSoft],
211
213
  ] as const) {
212
- const mark = contrastOf({ foreground: given.accent, background: ground });
214
+ const mark = Theme.contrastOf({ foreground: given.accent, background: ground });
213
215
 
214
216
  if (mark < MARK_RATIO) {
215
217
  problems.push(
@@ -223,7 +225,7 @@ export class ProjectTheme {
223
225
  ['a soft panel', lightGrounds.bgSoft],
224
226
  ['an accent tint', accentSoft],
225
227
  ] as const) {
226
- const text = contrastOf({ foreground: accentText, background: ground });
228
+ const text = Theme.contrastOf({ foreground: accentText, background: ground });
227
229
 
228
230
  if (text < TEXT_RATIO) {
229
231
  const which = given.accentText === undefined ? 'accent' : 'accentText';
@@ -250,7 +252,7 @@ export class ProjectTheme {
250
252
  const darkNeeds = [darkGrounds.bg, darkGrounds.bgSoft, ...slabs];
251
253
  const darkPasses = (color: string): boolean =>
252
254
  darkNeeds.every(
253
- (ground) => contrastOf({ foreground: color, background: ground }) >= TEXT_RATIO,
255
+ (ground) => Theme.contrastOf({ foreground: color, background: ground }) >= TEXT_RATIO,
254
256
  );
255
257
  let dark = given.accentDark;
256
258
 
@@ -275,7 +277,7 @@ export class ProjectTheme {
275
277
  }
276
278
  } else {
277
279
  for (const ground of darkNeeds) {
278
- const value = contrastOf({ foreground: dark, background: ground });
280
+ const value = Theme.contrastOf({ foreground: dark, background: ground });
279
281
 
280
282
  if (value < TEXT_RATIO) {
281
283
  problems.push(
@@ -360,7 +362,7 @@ export class ProjectTheme {
360
362
  const candidates = ['#ffffff', '#0e0e0f'];
361
363
 
362
364
  return candidates.find(
363
- (ink) => contrastOf({ foreground: ink, background: opts.fill }) >= TEXT_RATIO,
365
+ (ink) => Theme.contrastOf({ foreground: ink, background: opts.fill }) >= TEXT_RATIO,
364
366
  );
365
367
  }
366
368
 
@@ -1,5 +1,5 @@
1
1
  import { CompareChecks } from './compare-validate.ts';
2
- import { checkNewKinds } from './kinds-validate.ts';
2
+ import { KindsValidate } from './kinds-validate.ts';
3
3
  import type { TVisualizeSpec } from './schema.ts';
4
4
  import { SourceRefs } from './sources.ts';
5
5
 
@@ -216,11 +216,15 @@ const checkKinds = (opts: { spec: TVisualizeSpec }): string[] => {
216
216
  return problems;
217
217
  };
218
218
 
219
- /** What a schema cannot say, for every kind on the page. */
220
- export const checkSpec = (opts: { spec: TVisualizeSpec }): string[] => [
221
- ...(opts.spec.flow === undefined ? [] : checkFlow({ flow: opts.spec.flow })),
222
- ...checkKinds({ spec: opts.spec }),
223
- ...checkNewKinds({ spec: opts.spec }),
224
- ...CompareChecks.check({ spec: opts.spec }),
225
- ...SourceRefs.check({ spec: opts.spec }),
226
- ];
219
+ export class SpecValidation {
220
+ /** What a schema cannot say, for every kind on the page. */
221
+ static check(opts: { spec: TVisualizeSpec }): string[] {
222
+ return [
223
+ ...(opts.spec.flow === undefined ? [] : checkFlow({ flow: opts.spec.flow })),
224
+ ...checkKinds({ spec: opts.spec }),
225
+ ...KindsValidate.checkNew({ spec: opts.spec }),
226
+ ...CompareChecks.check({ spec: opts.spec }),
227
+ ...SourceRefs.check({ spec: opts.spec }),
228
+ ];
229
+ }
230
+ }
@@ -76,43 +76,45 @@ const readAnchors = (opts: { dist: string }): Map<string, Set<string>> => {
76
76
  return anchorsByRoute;
77
77
  };
78
78
 
79
- /** Checks every `](page#fragment)` link of the markdown under `content` against the ids built in `dist`. */
80
- export const checkAnchors = (opts: {
81
- content: string;
82
- dist: string;
83
- }): { checked: number; broken: IBrokenAnchor[] } => {
84
- const { content } = opts;
85
- const anchorsByRoute = readAnchors({ dist: opts.dist });
86
- const broken: IBrokenAnchor[] = [];
87
- let checked = 0;
88
-
89
- for (const file of walk({ directory: content, extension: '.md' })) {
90
- // Fenced code carries example links that are not ours to resolve.
91
- const body = readFileSync(file, 'utf8').replace(/```[\s\S]*?```/g, (match) =>
92
- match.replace(/[^\n]/g, ' '),
93
- );
94
-
95
- for (const [index, text] of body.split('\n').entries()) {
96
- for (const match of text.matchAll(/\]\(([^)\s]*?)#([\w.-]+)\)/g)) {
97
- const [, page = '', anchor = ''] = match;
98
-
99
- if (page.startsWith('http')) {
100
- continue;
101
- }
102
-
103
- checked += 1;
104
-
105
- const ids = anchorsByRoute.get(resolveRoute({ file, target: page, content }));
106
- const target = `${page}#${anchor}`;
107
-
108
- if (ids === undefined) {
109
- broken.push({ file, line: index + 1, target, reason: AnchorProblems.MISSING_PAGE });
110
- } else if (!ids.has(anchor)) {
111
- broken.push({ file, line: index + 1, target, reason: AnchorProblems.DEAD_ANCHOR });
79
+ export class AnchorCheck {
80
+ /** Checks every `](page#fragment)` link of the markdown under `content` against the ids built in `dist`. */
81
+ static check(opts: { content: string; dist: string }): {
82
+ checked: number;
83
+ broken: IBrokenAnchor[];
84
+ } {
85
+ const { content } = opts;
86
+ const anchorsByRoute = readAnchors({ dist: opts.dist });
87
+ const broken: IBrokenAnchor[] = [];
88
+ let checked = 0;
89
+
90
+ for (const file of walk({ directory: content, extension: '.md' })) {
91
+ // Fenced code carries example links that are not ours to resolve.
92
+ const body = readFileSync(file, 'utf8').replace(/```[\s\S]*?```/g, (match) =>
93
+ match.replace(/[^\n]/g, ' '),
94
+ );
95
+
96
+ for (const [index, text] of body.split('\n').entries()) {
97
+ for (const match of text.matchAll(/\]\(([^)\s]*?)#([\w.-]+)\)/g)) {
98
+ const [, page = '', anchor = ''] = match;
99
+
100
+ if (page.startsWith('http')) {
101
+ continue;
102
+ }
103
+
104
+ checked += 1;
105
+
106
+ const ids = anchorsByRoute.get(resolveRoute({ file, target: page, content }));
107
+ const target = `${page}#${anchor}`;
108
+
109
+ if (ids === undefined) {
110
+ broken.push({ file, line: index + 1, target, reason: AnchorProblems.MISSING_PAGE });
111
+ } else if (!ids.has(anchor)) {
112
+ broken.push({ file, line: index + 1, target, reason: AnchorProblems.DEAD_ANCHOR });
113
+ }
112
114
  }
113
115
  }
114
116
  }
115
- }
116
117
 
117
- return { checked, broken };
118
- };
118
+ return { checked, broken };
119
+ }
120
+ }
@@ -1,8 +1,8 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { ExitCodes } from '../common/index.ts';
3
- import { checkAnchors } from './anchors.ts';
3
+ import { AnchorCheck } from './anchors.ts';
4
4
  import { WikiDefaults, WikiFlags } from './constants.ts';
5
- import { checkSourceLinks } from './source-links.ts';
5
+ import { SourceLinkCheck } from './source-links.ts';
6
6
 
7
7
  /** The value after `--flag`, or the fallback; `undefined` when the flag has no value after it. */
8
8
  const valueOf = (opts: { args: string[]; flag: string; fallback?: string }): string | undefined => {
@@ -56,7 +56,7 @@ export const runSourceLinksCommand = (opts: { args: string[]; root: string }): n
56
56
  return ExitCodes.FAILURE;
57
57
  }
58
58
 
59
- const { checked, missing } = checkSourceLinks({
59
+ const { checked, missing } = SourceLinkCheck.check({
60
60
  root: opts.root,
61
61
  repo,
62
62
  directories: listOf({ value: directories }),
@@ -98,7 +98,7 @@ export const runAnchorsCommand = (opts: { args: string[]; root: string }): numbe
98
98
  return ExitCodes.FAILURE;
99
99
  }
100
100
 
101
- const { checked, broken } = checkAnchors({ content, dist });
101
+ const { checked, broken } = AnchorCheck.check({ content, dist });
102
102
 
103
103
  for (const entry of broken) {
104
104
  console.log(`${entry.file}:${entry.line} ${entry.reason}: ${entry.target}`);
@@ -126,59 +126,61 @@ const extractResource = (opts: { lines: string[] }): { line: number; path: strin
126
126
  return undefined;
127
127
  };
128
128
 
129
- /**
130
- * Walks the `.md` files under `directories` (paths relative to `root`) and reports every source path
131
- * that git does not track. `skipFiles` are generated pages that are never held to the gate.
132
- */
133
- export const checkSourceLinks = (opts: {
134
- root: string;
135
- repo: string;
136
- directories: string[];
137
- skipProseUnder: string[];
138
- skipFiles: string[];
139
- }): { checked: number; missing: IMissingSourceLink[] } => {
140
- const { root, repo, skipFiles, skipProseUnder } = opts;
141
- const tracked = loadTracked({ root });
142
- const exists = (path: string): boolean =>
143
- tracked.files.has(path) || tracked.directories.has(path);
144
- const missing: IMissingSourceLink[] = [];
145
- let checked = 0;
146
-
147
- for (const directory of opts.directories) {
148
- for (const file of walkMarkdown({ directory: resolve(root, directory) })) {
149
- const path = relative(root, file);
150
-
151
- if (skipFiles.some((skip) => isUnder({ path, directory: skip }))) {
152
- continue;
153
- }
129
+ export class SourceLinkCheck {
130
+ /**
131
+ * Walks the `.md` files under `directories` (paths relative to `root`) and reports every source path
132
+ * that git does not track. `skipFiles` are generated pages that are never held to the gate.
133
+ */
134
+ static check(opts: {
135
+ root: string;
136
+ repo: string;
137
+ directories: string[];
138
+ skipProseUnder: string[];
139
+ skipFiles: string[];
140
+ }): { checked: number; missing: IMissingSourceLink[] } {
141
+ const { root, repo, skipFiles, skipProseUnder } = opts;
142
+ const tracked = loadTracked({ root });
143
+ const exists = (path: string): boolean =>
144
+ tracked.files.has(path) || tracked.directories.has(path);
145
+ const missing: IMissingSourceLink[] = [];
146
+ let checked = 0;
147
+
148
+ for (const directory of opts.directories) {
149
+ for (const file of walkMarkdown({ directory: resolve(root, directory) })) {
150
+ const path = relative(root, file);
151
+
152
+ if (skipFiles.some((skip) => isUnder({ path, directory: skip }))) {
153
+ continue;
154
+ }
154
155
 
155
- const skipProse = skipProseUnder.some((skip) => isUnder({ path, directory: skip }));
156
- const lines = readFileSync(file, 'utf8').split('\n');
157
- const resource = isUnder({ path, directory: WikiDefaults.KNOWLEDGE_DIRECTORY })
158
- ? extractResource({ lines })
159
- : undefined;
156
+ const skipProse = skipProseUnder.some((skip) => isUnder({ path, directory: skip }));
157
+ const lines = readFileSync(file, 'utf8').split('\n');
158
+ const resource = isUnder({ path, directory: WikiDefaults.KNOWLEDGE_DIRECTORY })
159
+ ? extractResource({ lines })
160
+ : undefined;
160
161
 
161
- if (resource !== undefined) {
162
- checked += 1;
162
+ if (resource !== undefined) {
163
+ checked += 1;
163
164
 
164
- if (!exists(resource.path)) {
165
- missing.push({ file: path, line: resource.line, path: resource.path });
165
+ if (!exists(resource.path)) {
166
+ missing.push({ file: path, line: resource.line, path: resource.path });
167
+ }
166
168
  }
167
- }
168
169
 
169
- for (const [index, text] of lines.entries()) {
170
- for (const found of extractPaths({ text, repo, skipProse })) {
171
- checked += 1;
170
+ for (const [index, text] of lines.entries()) {
171
+ for (const found of extractPaths({ text, repo, skipProse })) {
172
+ checked += 1;
172
173
 
173
- if (!exists(found)) {
174
- missing.push({ file: path, line: index + 1, path: found });
174
+ if (!exists(found)) {
175
+ missing.push({ file: path, line: index + 1, path: found });
176
+ }
175
177
  }
176
178
  }
177
179
  }
178
180
  }
179
- }
180
181
 
181
- missing.sort((left, right) => left.file.localeCompare(right.file) || left.line - right.line);
182
+ missing.sort((left, right) => left.file.localeCompare(right.file) || left.line - right.line);
182
183
 
183
- return { checked, missing };
184
- };
184
+ return { checked, missing };
185
+ }
186
+ }