@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.
- package/base/extensions/vulcan-guards.ts +48 -41
- package/base/hooks/antigravity-guards.ts +2 -2
- package/base/hooks/codex-guards.ts +15 -5
- package/base/hooks/guard-git.ts +8 -8
- package/base/hooks/guard-manifest.ts +4 -5
- package/base/hooks/guard-outside.ts +8 -8
- package/base/hooks/guard-package.ts +5 -6
- package/base/hooks/guard-remote-hosts.ts +6 -7
- package/base/hooks/guard-scripting.ts +5 -6
- package/base/hooks/guard-writes.ts +8 -9
- package/base/hooks/post-tool.ts +2 -2
- package/base/hooks/prompt-submit.ts +2 -2
- package/base/hooks/session-start.ts +3 -3
- package/base/hooks/stop.ts +2 -2
- package/base/hooks/subagent-start.ts +2 -2
- package/base/skills/docs-update/SKILL.md +4 -2
- package/base/skills/visualize-work/SKILL.md +9 -0
- package/package.json +3 -3
- package/src/agents/atlas-block.ts +43 -43
- package/src/agents/codex-hooks.ts +45 -43
- package/src/agents/detect.ts +19 -16
- package/src/agents/exclude.ts +96 -97
- package/src/agents/hooks-json.ts +38 -36
- package/src/agents/local.ts +46 -43
- package/src/agents/prompt.ts +45 -42
- package/src/agents/render.ts +201 -195
- package/src/agents/resolve.ts +133 -134
- package/src/agents/table.ts +12 -8
- package/src/commands/add.command.ts +2 -2
- package/src/commands/agents.command.ts +11 -17
- package/src/commands/clean.command.ts +6 -6
- package/src/commands/doctor.command.ts +4 -4
- package/src/commands/init.command.ts +12 -8
- package/src/commands/preset.command.ts +2 -2
- package/src/commands/profile.command.ts +42 -49
- package/src/commands/sync.command.ts +109 -111
- package/src/commands/upgrade.command.ts +80 -75
- package/src/commands/visualize.command.ts +7 -13
- package/src/commands/x.command.ts +55 -50
- package/src/common/format.ts +23 -21
- package/src/common/json.ts +8 -5
- package/src/common/layout-folder.ts +94 -91
- package/src/common/paths.ts +14 -12
- package/src/config/loader.ts +52 -49
- package/src/config/packages.ts +14 -11
- package/src/config/schema.ts +3 -3
- package/src/create/add-app.ts +519 -509
- package/src/create/add-lib.ts +237 -240
- package/src/create/bunfig.ts +26 -23
- package/src/create/checks.ts +36 -34
- package/src/create/diff.ts +21 -23
- package/src/create/dockerignore.ts +26 -24
- package/src/create/files.ts +7 -5
- package/src/create/init-monorepo.ts +75 -80
- package/src/create/lib-preset.ts +59 -63
- package/src/create/manifest-json.ts +10 -4
- package/src/create/names.ts +217 -210
- package/src/create/next.ts +26 -23
- package/src/create/plan.ts +15 -12
- package/src/create/preset-diff.ts +301 -303
- package/src/create/preset-menu.ts +38 -32
- package/src/create/preset.ts +202 -197
- package/src/create/process.ts +79 -72
- package/src/create/scratch.ts +48 -49
- package/src/create/workspace.ts +404 -396
- package/src/doctor/checks.ts +1027 -1014
- package/src/doctor/makefile.ts +17 -13
- package/src/doctor/runner.ts +88 -118
- package/src/doctor/skills.ts +97 -95
- package/src/doctor/tags.ts +42 -37
- package/src/hooks/codex-patch.ts +25 -22
- package/src/hooks/command-view.ts +44 -39
- package/src/hooks/decision.ts +37 -37
- package/src/hooks/guard-git.ts +51 -49
- package/src/hooks/guard-manifest.ts +58 -55
- package/src/hooks/guard-outside.ts +93 -91
- package/src/hooks/guard-package.ts +82 -79
- package/src/hooks/guard-scripting.ts +19 -14
- package/src/hooks/guard-writes.ts +154 -149
- package/src/hooks/owner-reply.ts +127 -127
- package/src/hooks/post-tool.ts +94 -93
- package/src/hooks/project-guards.ts +65 -62
- package/src/hooks/project-tmp.ts +27 -24
- package/src/hooks/remote-hosts.ts +153 -130
- package/src/hooks/session-digest.ts +98 -101
- package/src/hooks/shell.ts +509 -499
- package/src/hooks/subagent-card.ts +11 -7
- package/src/hooks/trusted-scripts.ts +106 -104
- package/src/init/scaffold.ts +135 -132
- package/src/local/clean.ts +38 -36
- package/src/local/format.ts +21 -17
- package/src/local/scan.ts +144 -138
- package/src/manifest/render.ts +110 -104
- package/src/owner/card.ts +51 -46
- package/src/owner/profile.ts +99 -93
- package/src/owner/reply-switch.ts +9 -6
- package/src/owner/shape.ts +71 -69
- package/src/owner/survey.ts +173 -171
- package/src/owner/view.ts +62 -59
- package/src/owner/violations.ts +119 -123
- package/src/rules/base.ts +15 -11
- package/src/rules/parser.ts +39 -32
- package/src/rules/slots.ts +8 -6
- package/src/signals/claims.ts +30 -28
- package/src/signals/classify.ts +38 -33
- package/src/signals/loop.ts +39 -37
- package/src/signals/state.ts +79 -81
- package/src/skills/frontmatter.ts +28 -28
- package/src/sync/agent-files.ts +217 -199
- package/src/sync/agent-removal.ts +56 -59
- package/src/sync/atlas-block.ts +45 -43
- package/src/sync/base-rules.ts +32 -30
- package/src/sync/claude-launch.ts +36 -34
- package/src/sync/exclude.ts +77 -69
- package/src/sync/local-choice.ts +50 -47
- package/src/sync/planner.ts +59 -61
- package/src/sync/prune.ts +52 -48
- package/src/sync/settings.ts +166 -167
- package/src/ui/capability.ts +12 -7
- package/src/ui/keyboard.ts +38 -38
- package/src/ui/prompt.ts +79 -77
- package/src/visualize/assets.ts +33 -24
- package/src/visualize/charts.ts +179 -176
- package/src/visualize/compare-css.ts +3 -2
- package/src/visualize/compare-render.ts +9 -7
- package/src/visualize/diagrams.ts +189 -174
- package/src/visualize/grid-span.ts +34 -0
- package/src/visualize/icons.ts +7 -5
- package/src/visualize/kinds-render.ts +50 -45
- package/src/visualize/kinds-validate.ts +12 -10
- package/src/visualize/labels.ts +21 -17
- package/src/visualize/layout.ts +112 -97
- package/src/visualize/page.ts +92 -104
- package/src/visualize/render.ts +143 -140
- package/src/visualize/sections.ts +395 -384
- package/src/visualize/sources.ts +2 -2
- package/src/visualize/theme.ts +12 -10
- package/src/visualize/validate.ts +13 -9
- package/src/wiki/anchors.ts +38 -36
- package/src/wiki/command.ts +4 -4
- package/src/wiki/source-links.ts +46 -44
package/src/agents/resolve.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { AgentConstants, AgentSources } from './common/index.ts';
|
|
4
4
|
import type { TAgentResolution, TAskAgents } from './common/index.ts';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { LocalChoice } from './local.ts';
|
|
6
|
+
import { AgentTable } from './table.ts';
|
|
7
7
|
|
|
8
8
|
const PROJECT_FILES = ['CLAUDE.md', '.claude'];
|
|
9
9
|
|
|
@@ -11,157 +11,156 @@ export const NO_TTY_HINT = `vulcan sync: no agents chosen on this machine - wrot
|
|
|
11
11
|
|
|
12
12
|
type TParsed = { ok: true; agents: string[] } | { ok: false; error: string };
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
.filter((word) => word !== '');
|
|
21
|
-
|
|
22
|
-
if (words.includes(AgentConstants.NONE)) {
|
|
23
|
-
return words.length === 1
|
|
24
|
-
? { ok: true, agents: [] }
|
|
25
|
-
: {
|
|
26
|
-
ok: false,
|
|
27
|
-
error: `vulcan sync: '${AgentConstants.NONE}' cannot be combined with other agents`,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
14
|
+
export class AgentSelection {
|
|
15
|
+
private static fromList(opts: {
|
|
16
|
+
value: string;
|
|
17
|
+
source: typeof AgentSources.FLAG | typeof AgentSources.ASKED;
|
|
18
|
+
}): TAgentResolution {
|
|
19
|
+
const parsed = AgentSelection.parseList({ value: opts.value });
|
|
30
20
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
ok: false,
|
|
36
|
-
error: `vulcan sync: unknown agent '${unknown}' - one of: ${[...known, AgentConstants.NONE].join(', ')}`,
|
|
37
|
-
};
|
|
21
|
+
return parsed.ok
|
|
22
|
+
? { ok: true, agents: parsed.agents, source: opts.source, writeLocal: true, hint: undefined }
|
|
23
|
+
: parsed;
|
|
38
24
|
}
|
|
39
25
|
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* suggestion, a project that already has Claude files, then ask (terminal) or keep today's Claude
|
|
57
|
-
* default (no terminal, with a hint and nothing stored).
|
|
58
|
-
*/
|
|
59
|
-
export const resolveAgents = (opts: {
|
|
60
|
-
root: string;
|
|
61
|
-
/** `--agents`: undefined when absent, '' when given without a value. */
|
|
62
|
-
flag: string | undefined;
|
|
63
|
-
configAgents: string[] | undefined;
|
|
64
|
-
interactive: boolean;
|
|
65
|
-
detected: string[];
|
|
66
|
-
ask: TAskAgents;
|
|
67
|
-
}): TAgentResolution => {
|
|
68
|
-
const stored = readLocalChoice({ root: opts.root });
|
|
69
|
-
|
|
70
|
-
if (!stored.ok) {
|
|
71
|
-
return { ok: false, error: `vulcan sync: ${stored.error}` };
|
|
72
|
-
}
|
|
26
|
+
/** A comma list or `none`: validated against the table, deduplicated, in table order. */
|
|
27
|
+
static parseList(opts: { value: string }): TParsed {
|
|
28
|
+
const known = AgentTable.agentIds();
|
|
29
|
+
const words = opts.value
|
|
30
|
+
.split(',')
|
|
31
|
+
.map((word) => word.trim())
|
|
32
|
+
.filter((word) => word !== '');
|
|
33
|
+
|
|
34
|
+
if (words.includes(AgentConstants.NONE)) {
|
|
35
|
+
return words.length === 1
|
|
36
|
+
? { ok: true, agents: [] }
|
|
37
|
+
: {
|
|
38
|
+
ok: false,
|
|
39
|
+
error: `vulcan sync: '${AgentConstants.NONE}' cannot be combined with other agents`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
73
42
|
|
|
74
|
-
|
|
75
|
-
const answer = opts.ask({ detected: opts.detected, stored: stored.agents });
|
|
43
|
+
const unknown = words.find((word) => !known.includes(word));
|
|
76
44
|
|
|
77
|
-
if (
|
|
45
|
+
if (unknown !== undefined) {
|
|
78
46
|
return {
|
|
79
47
|
ok: false,
|
|
80
|
-
error: `vulcan sync:
|
|
48
|
+
error: `vulcan sync: unknown agent '${unknown}' - one of: ${[...known, AgentConstants.NONE].join(', ')}`,
|
|
81
49
|
};
|
|
82
50
|
}
|
|
83
51
|
|
|
84
|
-
|
|
85
|
-
return answer.trim() === ''
|
|
86
|
-
? {
|
|
87
|
-
ok: true,
|
|
88
|
-
agents: stored.agents ?? opts.detected,
|
|
89
|
-
source: AgentSources.ASKED,
|
|
90
|
-
writeLocal: true,
|
|
91
|
-
hint: undefined,
|
|
92
|
-
}
|
|
93
|
-
: fromList({ value: answer, source: AgentSources.ASKED });
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
if (opts.flag === '') {
|
|
97
|
-
return opts.interactive
|
|
98
|
-
? askNow()
|
|
99
|
-
: {
|
|
100
|
-
ok: false,
|
|
101
|
-
error: `vulcan sync: ${AgentConstants.FLAG} needs a list (${AgentConstants.EXAMPLE_LIST}) or ${AgentConstants.NONE}`,
|
|
102
|
-
};
|
|
52
|
+
return { ok: true, agents: known.filter((id) => words.includes(id)) };
|
|
103
53
|
}
|
|
104
54
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Which agents this machine uses, in order: the flag, the stored choice, the committed config's
|
|
57
|
+
* suggestion, a project that already has Claude files, then ask (terminal) or keep today's Claude
|
|
58
|
+
* default (no terminal, with a hint and nothing stored).
|
|
59
|
+
*/
|
|
60
|
+
static resolve(opts: {
|
|
61
|
+
root: string;
|
|
62
|
+
/** `--agents`: undefined when absent, '' when given without a value. */
|
|
63
|
+
flag: string | undefined;
|
|
64
|
+
configAgents: string[] | undefined;
|
|
65
|
+
interactive: boolean;
|
|
66
|
+
detected: string[];
|
|
67
|
+
ask: TAskAgents;
|
|
68
|
+
}): TAgentResolution {
|
|
69
|
+
const stored = LocalChoice.read({ root: opts.root });
|
|
70
|
+
|
|
71
|
+
if (!stored.ok) {
|
|
72
|
+
return { ok: false, error: `vulcan sync: ${stored.error}` };
|
|
73
|
+
}
|
|
108
74
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
ok: true,
|
|
112
|
-
agents: stored.agents,
|
|
113
|
-
source: AgentSources.LOCAL,
|
|
114
|
-
writeLocal: false,
|
|
115
|
-
hint: undefined,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
75
|
+
const askNow = (): TAgentResolution => {
|
|
76
|
+
const answer = opts.ask({ detected: opts.detected, stored: stored.agents });
|
|
118
77
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
78
|
+
if (answer === null) {
|
|
79
|
+
return {
|
|
80
|
+
ok: false,
|
|
81
|
+
error: `vulcan sync: no answer - run: vulcan sync ${AgentConstants.FLAG} ${AgentConstants.EXAMPLE_LIST} (or ${AgentConstants.NONE})`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Enter keeps what this machine chose before; with no earlier choice it takes what was detected.
|
|
86
|
+
return answer.trim() === ''
|
|
87
|
+
? {
|
|
88
|
+
ok: true,
|
|
89
|
+
agents: stored.agents ?? opts.detected,
|
|
90
|
+
source: AgentSources.ASKED,
|
|
91
|
+
writeLocal: true,
|
|
92
|
+
hint: undefined,
|
|
93
|
+
}
|
|
94
|
+
: AgentSelection.fromList({ value: answer, source: AgentSources.ASKED });
|
|
126
95
|
};
|
|
127
|
-
}
|
|
128
96
|
|
|
129
|
-
|
|
97
|
+
if (opts.flag === '') {
|
|
98
|
+
return opts.interactive
|
|
99
|
+
? askNow()
|
|
100
|
+
: {
|
|
101
|
+
ok: false,
|
|
102
|
+
error: `vulcan sync: ${AgentConstants.FLAG} needs a list (${AgentConstants.EXAMPLE_LIST}) or ${AgentConstants.NONE}`,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (opts.flag !== undefined) {
|
|
107
|
+
return AgentSelection.fromList({ value: opts.flag, source: AgentSources.FLAG });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (stored.agents !== undefined) {
|
|
111
|
+
return {
|
|
112
|
+
ok: true,
|
|
113
|
+
agents: stored.agents,
|
|
114
|
+
source: AgentSources.LOCAL,
|
|
115
|
+
writeLocal: false,
|
|
116
|
+
hint: undefined,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (opts.configAgents !== undefined) {
|
|
121
|
+
return {
|
|
122
|
+
ok: true,
|
|
123
|
+
agents: AgentTable.agentIds().filter((id) => opts.configAgents?.includes(id)),
|
|
124
|
+
source: AgentSources.CONFIG,
|
|
125
|
+
writeLocal: true,
|
|
126
|
+
hint: undefined,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (PROJECT_FILES.some((file) => existsSync(join(opts.root, file)))) {
|
|
131
|
+
return {
|
|
132
|
+
ok: true,
|
|
133
|
+
agents: ['claude'],
|
|
134
|
+
source: AgentSources.MIGRATION,
|
|
135
|
+
writeLocal: true,
|
|
136
|
+
hint: undefined,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (opts.interactive) {
|
|
141
|
+
return askNow();
|
|
142
|
+
}
|
|
143
|
+
|
|
130
144
|
return {
|
|
131
145
|
ok: true,
|
|
132
|
-
agents: [
|
|
133
|
-
source: AgentSources.
|
|
134
|
-
writeLocal:
|
|
135
|
-
hint:
|
|
146
|
+
agents: [AgentConstants.DEFAULT_AGENT],
|
|
147
|
+
source: AgentSources.DEFAULT,
|
|
148
|
+
writeLocal: false,
|
|
149
|
+
hint: NO_TTY_HINT,
|
|
136
150
|
};
|
|
137
151
|
}
|
|
138
152
|
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
/** The same order without a terminal or a flag: what doctor and every non-interactive reader use. */
|
|
154
|
+
static resolveQuietly(opts: { root: string; configAgents: string[] | undefined }): string[] {
|
|
155
|
+
const resolved = AgentSelection.resolve({
|
|
156
|
+
root: opts.root,
|
|
157
|
+
flag: undefined,
|
|
158
|
+
configAgents: opts.configAgents,
|
|
159
|
+
interactive: false,
|
|
160
|
+
detected: [],
|
|
161
|
+
ask: () => null,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
return resolved.ok ? resolved.agents : [AgentConstants.DEFAULT_AGENT];
|
|
141
165
|
}
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
ok: true,
|
|
145
|
-
agents: [AgentConstants.DEFAULT_AGENT],
|
|
146
|
-
source: AgentSources.DEFAULT,
|
|
147
|
-
writeLocal: false,
|
|
148
|
-
hint: NO_TTY_HINT,
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
/** The same order without a terminal or a flag: what doctor and every non-interactive reader use. */
|
|
153
|
-
export const resolveAgentsQuietly = (opts: {
|
|
154
|
-
root: string;
|
|
155
|
-
configAgents: string[] | undefined;
|
|
156
|
-
}): string[] => {
|
|
157
|
-
const resolved = resolveAgents({
|
|
158
|
-
root: opts.root,
|
|
159
|
-
flag: undefined,
|
|
160
|
-
configAgents: opts.configAgents,
|
|
161
|
-
interactive: false,
|
|
162
|
-
detected: [],
|
|
163
|
-
ask: () => null,
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
return resolved.ok ? resolved.agents : [AgentConstants.DEFAULT_AGENT];
|
|
167
|
-
};
|
|
166
|
+
}
|
package/src/agents/table.ts
CHANGED
|
@@ -23,13 +23,17 @@ const TABLE_SCHEMA = z.array(AGENT_ENTRY_SCHEMA).superRefine((entries, context)
|
|
|
23
23
|
|
|
24
24
|
let cached: TAgentEntry[] | undefined;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export class AgentTable {
|
|
27
|
+
/** The shipped table, in the order the questions and the list show it; a broken table throws. */
|
|
28
|
+
static read(): TAgentEntry[] {
|
|
29
|
+
cached ??= TABLE_SCHEMA.parse(
|
|
30
|
+
JSON.parse(readFileSync(join(BASE_DIRECTORY, 'agents.json'), 'utf8')),
|
|
31
|
+
);
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
}
|
|
33
|
+
return cached;
|
|
34
|
+
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
static agentIds(): string[] {
|
|
37
|
+
return AgentTable.read().map((entry) => entry.id);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ICommandContext } from '../common/index.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { AppScaffold } from '../create/add-app.ts';
|
|
3
3
|
|
|
4
4
|
export const runAddCommand = async (opts: ICommandContext): Promise<number> =>
|
|
5
|
-
|
|
5
|
+
AppScaffold.add({ cwd: opts.cwd, args: opts.args });
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
|
-
import {
|
|
3
|
-
AgentConstants,
|
|
4
|
-
agentIds,
|
|
5
|
-
detectAgents,
|
|
6
|
-
parseAgentList,
|
|
7
|
-
resolveAgents,
|
|
8
|
-
} from '../agents/index.ts';
|
|
2
|
+
import { AgentConstants, AgentDetection, AgentSelection, AgentTable } from '../agents/index.ts';
|
|
9
3
|
import { ExitCodes } from '../common/index.ts';
|
|
10
4
|
import type { ICommandContext } from '../common/index.ts';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { ConfigLoader } from '../config/index.ts';
|
|
6
|
+
import { SyncFlow } from './sync.command.ts';
|
|
13
7
|
|
|
14
8
|
const SUBCOMMANDS = ['list', 'add', 'remove', 'setup'];
|
|
15
9
|
const DRY_RUN_FLAG = '--dry-run';
|
|
@@ -21,7 +15,7 @@ const fail = (opts: { message: string }): number => {
|
|
|
21
15
|
};
|
|
22
16
|
|
|
23
17
|
const detected = (opts: { root: string }): string[] =>
|
|
24
|
-
|
|
18
|
+
AgentDetection.detect({
|
|
25
19
|
root: opts.root,
|
|
26
20
|
home: process.env.HOME ?? homedir(),
|
|
27
21
|
path: process.env.PATH ?? '',
|
|
@@ -31,13 +25,13 @@ const detected = (opts: { root: string }): string[] =>
|
|
|
31
25
|
const currentAgents = async (opts: {
|
|
32
26
|
root: string;
|
|
33
27
|
}): Promise<{ ok: true; agents: string[]; chosen: boolean } | { ok: false; error: string }> => {
|
|
34
|
-
const loaded = await
|
|
28
|
+
const loaded = await ConfigLoader.load({ root: opts.root });
|
|
35
29
|
|
|
36
30
|
if (!loaded.ok) {
|
|
37
31
|
return { ok: false, error: loaded.error };
|
|
38
32
|
}
|
|
39
33
|
|
|
40
|
-
const resolved =
|
|
34
|
+
const resolved = AgentSelection.resolve({
|
|
41
35
|
root: opts.root,
|
|
42
36
|
flag: undefined,
|
|
43
37
|
configAgents: loaded.config.agents,
|
|
@@ -68,7 +62,7 @@ const runList = async (opts: { root: string }): Promise<number> => {
|
|
|
68
62
|
`chosen on this machine: ${current.chosen ? current.agents.join(', ') || AgentConstants.NONE : '(nothing yet)'}\n`,
|
|
69
63
|
);
|
|
70
64
|
process.stdout.write(`detected: ${found.length === 0 ? '(none)' : found.join(', ')}\n\n`);
|
|
71
|
-
printAgentTable();
|
|
65
|
+
SyncFlow.printAgentTable();
|
|
72
66
|
|
|
73
67
|
return ExitCodes.OK;
|
|
74
68
|
};
|
|
@@ -95,7 +89,7 @@ export const runAgentsCommand = async (opts: ICommandContext): Promise<number> =
|
|
|
95
89
|
});
|
|
96
90
|
}
|
|
97
91
|
|
|
98
|
-
return
|
|
92
|
+
return SyncFlow.run({ cwd: opts.cwd, args: [AgentConstants.FLAG, ...dryRun] });
|
|
99
93
|
}
|
|
100
94
|
|
|
101
95
|
if (value === undefined) {
|
|
@@ -104,7 +98,7 @@ export const runAgentsCommand = async (opts: ICommandContext): Promise<number> =
|
|
|
104
98
|
});
|
|
105
99
|
}
|
|
106
100
|
|
|
107
|
-
const parsed =
|
|
101
|
+
const parsed = AgentSelection.parseList({ value });
|
|
108
102
|
|
|
109
103
|
if (!parsed.ok) {
|
|
110
104
|
return fail({ message: parsed.error.replace(/^vulcan sync: /, '') });
|
|
@@ -120,7 +114,7 @@ export const runAgentsCommand = async (opts: ICommandContext): Promise<number> =
|
|
|
120
114
|
return fail({ message: current.error });
|
|
121
115
|
}
|
|
122
116
|
|
|
123
|
-
const known = agentIds();
|
|
117
|
+
const known = AgentTable.agentIds();
|
|
124
118
|
const already = parsed.agents.filter((id) => current.agents.includes(id));
|
|
125
119
|
const absent = parsed.agents.filter((id) => !current.agents.includes(id));
|
|
126
120
|
const touched = subcommand === 'add' ? absent : already;
|
|
@@ -142,7 +136,7 @@ export const runAgentsCommand = async (opts: ICommandContext): Promise<number> =
|
|
|
142
136
|
: current.agents.includes(id) && !touched.includes(id),
|
|
143
137
|
);
|
|
144
138
|
|
|
145
|
-
return
|
|
139
|
+
return SyncFlow.run({
|
|
146
140
|
cwd: opts.cwd,
|
|
147
141
|
args: [
|
|
148
142
|
AgentConstants.FLAG,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExitCodes } from '../common/index.ts';
|
|
2
2
|
import type { ICommandContext } from '../common/index.ts';
|
|
3
|
-
import { CleanScopes,
|
|
3
|
+
import { CleanScopes, LocalClean, LocalFormat } from '../local/index.ts';
|
|
4
4
|
import type { ILocalEntry } from '../local/index.ts';
|
|
5
5
|
|
|
6
6
|
const YES_FLAG = '--yes';
|
|
@@ -10,7 +10,7 @@ const lineOf = (opts: { entry: ILocalEntry }): string => {
|
|
|
10
10
|
const { entry } = opts;
|
|
11
11
|
const note = entry.note === '' ? (entry.state === 'stale' ? 'stale' : '') : entry.note;
|
|
12
12
|
|
|
13
|
-
return ` ${entry.scope}/${entry.name} ${formatBytes({ bytes: entry.bytes })} ${formatAge({ ageMs: entry.ageMs })}${note === '' ? '' : ` ${note}`}`;
|
|
13
|
+
return ` ${entry.scope}/${entry.name} ${LocalFormat.formatBytes({ bytes: entry.bytes })} ${LocalFormat.formatAge({ ageMs: entry.ageMs })}${note === '' ? '' : ` ${note}`}`;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -27,7 +27,7 @@ export const runCleanCommand = async (opts: ICommandContext): Promise<number> =>
|
|
|
27
27
|
? named
|
|
28
28
|
: [CleanScopes.TMP];
|
|
29
29
|
const yes = opts.args.includes(YES_FLAG);
|
|
30
|
-
const plan =
|
|
30
|
+
const plan = LocalClean.plan({ root: opts.cwd, scopes });
|
|
31
31
|
const total = plan.remove.reduce((sum, entry) => sum + entry.bytes, 0);
|
|
32
32
|
|
|
33
33
|
if (plan.remove.length === 0 && plan.keep.length === 0) {
|
|
@@ -50,13 +50,13 @@ export const runCleanCommand = async (opts: ICommandContext): Promise<number> =>
|
|
|
50
50
|
|
|
51
51
|
if (!yes) {
|
|
52
52
|
process.stderr.write(
|
|
53
|
-
`would remove ${plan.remove.length} item(s), ${formatBytes({ bytes: total })}\n`,
|
|
53
|
+
`would remove ${plan.remove.length} item(s), ${LocalFormat.formatBytes({ bytes: total })}\n`,
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
return ExitCodes.OK;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const result =
|
|
59
|
+
const result = LocalClean.run({ root: opts.cwd, plan });
|
|
60
60
|
|
|
61
61
|
for (const failure of result.failed) {
|
|
62
62
|
process.stderr.write(
|
|
@@ -65,7 +65,7 @@ export const runCleanCommand = async (opts: ICommandContext): Promise<number> =>
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
process.stderr.write(
|
|
68
|
-
`removed ${result.removed.length} item(s), ${formatBytes({ bytes: result.removed.reduce((sum, entry) => sum + entry.bytes, 0) })}\n`,
|
|
68
|
+
`removed ${result.removed.length} item(s), ${LocalFormat.formatBytes({ bytes: result.removed.reduce((sum, entry) => sum + entry.bytes, 0) })}\n`,
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
return result.failed.length === 0 ? ExitCodes.OK : ExitCodes.FAILURE;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { ExitCodes } from '../common/index.ts';
|
|
2
2
|
import type { ICommandContext } from '../common/index.ts';
|
|
3
|
-
import {
|
|
3
|
+
import { DoctorRunner } from '../doctor/index.ts';
|
|
4
4
|
|
|
5
5
|
export const runDoctorCommand = async (opts: ICommandContext): Promise<number> => {
|
|
6
|
-
const violations = await
|
|
6
|
+
const violations = await DoctorRunner.runChecks({ root: opts.cwd });
|
|
7
7
|
|
|
8
8
|
for (const violation of violations) {
|
|
9
9
|
process.stderr.write(` [${violation.check}] ${violation.file}: ${violation.message}\n`);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const warnings = await
|
|
12
|
+
const warnings = await DoctorRunner.runWarnings({ root: opts.cwd });
|
|
13
13
|
|
|
14
14
|
for (const warning of warnings) {
|
|
15
15
|
process.stderr.write(` warning [${warning.check}] ${warning.file}: ${warning.message}\n`);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const doctorNotes = await
|
|
18
|
+
const doctorNotes = await DoctorRunner.runNotes({ root: opts.cwd });
|
|
19
19
|
|
|
20
20
|
for (const note of doctorNotes) {
|
|
21
21
|
process.stderr.write(` info [${note.check}] ${note.file}: ${note.message}\n`);
|
|
@@ -4,14 +4,14 @@ import { ExitCodes } from '../common/index.ts';
|
|
|
4
4
|
import type { ICommandContext } from '../common/index.ts';
|
|
5
5
|
import { ConfigExtensions } from '../config/index.ts';
|
|
6
6
|
import { CreateFlags } from '../create/common/index.ts';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { InitConstants,
|
|
10
|
-
import {
|
|
7
|
+
import { Monorepo } from '../create/init-monorepo.ts';
|
|
8
|
+
import { SubProcess } from '../create/process.ts';
|
|
9
|
+
import { InitConstants, ProjectScaffold } from '../init/index.ts';
|
|
10
|
+
import { ProfilePrompt } from './profile.command.ts';
|
|
11
11
|
|
|
12
12
|
export const runInitCommand = async (opts: ICommandContext): Promise<number> => {
|
|
13
13
|
if (opts.args.includes(CreateFlags.PRESET)) {
|
|
14
|
-
return
|
|
14
|
+
return Monorepo.create({ cwd: opts.cwd, args: opts.args });
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const flagIndex = opts.args.indexOf(InitConstants.CONFIG_FLAG);
|
|
@@ -35,7 +35,7 @@ export const runInitCommand = async (opts: ICommandContext): Promise<number> =>
|
|
|
35
35
|
return ExitCodes.FAILURE;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const result =
|
|
38
|
+
const result = ProjectScaffold.scaffold({ root: opts.cwd, extension });
|
|
39
39
|
|
|
40
40
|
for (const entry of result.entries) {
|
|
41
41
|
process.stderr.write(` ${entry.status.padEnd(8)} ${entry.subject}\n`);
|
|
@@ -48,7 +48,11 @@ export const runInitCommand = async (opts: ICommandContext): Promise<number> =>
|
|
|
48
48
|
const args = ['add', '-d', '--exact', ...result.install];
|
|
49
49
|
|
|
50
50
|
process.stderr.write(`installing ${result.install.join(' ')}\n`);
|
|
51
|
-
const installExit = await runBun({
|
|
51
|
+
const installExit = await SubProcess.runBun({
|
|
52
|
+
cwd: opts.cwd,
|
|
53
|
+
args,
|
|
54
|
+
label: `bun ${args.join(' ')}`,
|
|
55
|
+
});
|
|
52
56
|
|
|
53
57
|
installCode = installExit;
|
|
54
58
|
|
|
@@ -60,7 +64,7 @@ export const runInitCommand = async (opts: ICommandContext): Promise<number> =>
|
|
|
60
64
|
process.stderr.write('left to do:\n');
|
|
61
65
|
result.todo.forEach((line, index) => process.stderr.write(` ${index + 1}. ${line}\n`));
|
|
62
66
|
|
|
63
|
-
await
|
|
67
|
+
await ProfilePrompt.offer({ root: opts.cwd });
|
|
64
68
|
|
|
65
69
|
return installCode === ExitCodes.OK ? ExitCodes.OK : ExitCodes.FAILURE;
|
|
66
70
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ICommandContext } from '../common/index.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { PresetDiff } from '../create/preset-diff.ts';
|
|
3
3
|
|
|
4
4
|
export const runPresetCommand = async (opts: ICommandContext): Promise<number> =>
|
|
5
|
-
|
|
5
|
+
PresetDiff.run({ cwd: opts.cwd, args: opts.args });
|