@venizia/vulcan 0.4.1 → 0.4.3
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/package.json +3 -3
- package/src/agents/exclude.ts +37 -8
- package/src/doctor/checks.ts +20 -1
- package/src/owner/shape.ts +9 -1
- package/src/sync/exclude.ts +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/vulcan",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "VULCAN - one setup, one workflow for every project: init, sync, doctor, upgrade, and `vulcan x` for the shipped tools. Bun-only.",
|
|
5
5
|
"homepage": "https://github.com/VENIZIA-AI/vulcan/tree/main/packages/cli",
|
|
6
6
|
"bugs": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@clack/prompts": "1.8.1",
|
|
47
|
-
"@venizia/vulcan-atlas": "0.4.
|
|
48
|
-
"@venizia/vulcan-okf": "0.4.
|
|
47
|
+
"@venizia/vulcan-atlas": "0.4.3",
|
|
48
|
+
"@venizia/vulcan-okf": "0.4.3",
|
|
49
49
|
"zod": "^4.6.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
package/src/agents/exclude.ts
CHANGED
|
@@ -6,6 +6,8 @@ export const EXCLUDE_BLOCK_START =
|
|
|
6
6
|
'# vulcan:start - written by vulcan sync for the agents you chose; do not edit';
|
|
7
7
|
export const EXCLUDE_BLOCK_END = '# vulcan:end';
|
|
8
8
|
const START_PREFIX = '# vulcan:start';
|
|
9
|
+
/** A block's start line: the project it belongs to sits in brackets after the marker, none for the git top level. */
|
|
10
|
+
const START_PATTERN = /^# vulcan:start(?: \((.*)\))? - written/;
|
|
9
11
|
const CLAUDE_SKILLS_DIRECTORY = '.claude/skills';
|
|
10
12
|
|
|
11
13
|
export interface IExcludeGroup {
|
|
@@ -59,28 +61,55 @@ export const excludePathsOf = (opts: {
|
|
|
59
61
|
return [...groups, { title: 'local', paths: [`/${LOCAL_AGENTS_FILE}`] }];
|
|
60
62
|
};
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
/**
|
|
65
|
+
* One block per project: a project below the git top level (an app in a monorepo, a scratch app
|
|
66
|
+
* inside a repo) names its path from the top level in the start line, so syncing it never touches
|
|
67
|
+
* the block of the top level or of another project. The top level keeps the plain start line.
|
|
68
|
+
*/
|
|
69
|
+
export const renderExcludeBlock = (opts: { groups: IExcludeGroup[]; prefix?: string }): string =>
|
|
63
70
|
[
|
|
64
|
-
|
|
71
|
+
opts.prefix === undefined || opts.prefix === ''
|
|
72
|
+
? EXCLUDE_BLOCK_START
|
|
73
|
+
: EXCLUDE_BLOCK_START.replace(START_PREFIX, `${START_PREFIX} (${opts.prefix})`),
|
|
65
74
|
...opts.groups.flatMap((group) => [`# ${group.title}`, ...group.paths]),
|
|
66
75
|
EXCLUDE_BLOCK_END,
|
|
67
76
|
'',
|
|
68
77
|
].join('\n');
|
|
69
78
|
|
|
70
|
-
|
|
79
|
+
const blockKeyOf = (line: string): string | undefined => {
|
|
80
|
+
const match = START_PATTERN.exec(line);
|
|
81
|
+
|
|
82
|
+
return match === null ? undefined : (match[1] ?? '');
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The block of `opts.prefix` replaces itself between its markers; the user's own lines in the
|
|
87
|
+
* file, and the blocks of other projects, are never touched.
|
|
88
|
+
*/
|
|
71
89
|
export const mergeExcludeBlock = (opts: {
|
|
72
90
|
text: string | undefined;
|
|
73
91
|
block: string;
|
|
92
|
+
prefix?: string;
|
|
74
93
|
}): { changed: boolean; text: string } => {
|
|
75
94
|
if (opts.text === undefined || opts.text === '') {
|
|
76
95
|
return { changed: true, text: opts.block };
|
|
77
96
|
}
|
|
78
97
|
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
const lines = opts.text.split('\n');
|
|
99
|
+
const start = lines.findIndex((line) => blockKeyOf(line) === (opts.prefix ?? ''));
|
|
100
|
+
const stop = lines.findIndex(
|
|
101
|
+
(line, index) =>
|
|
102
|
+
index > start && (line.trimEnd() === EXCLUDE_BLOCK_END || blockKeyOf(line) !== undefined),
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// A block with no end marker before the next block starts is left alone: replacing it would
|
|
106
|
+
// swallow the next project's block.
|
|
107
|
+
if (start !== -1 && stop !== -1 && lines[stop]?.trimEnd() === EXCLUDE_BLOCK_END) {
|
|
108
|
+
const text = [
|
|
109
|
+
...lines.slice(0, start),
|
|
110
|
+
...opts.block.trimEnd().split('\n'),
|
|
111
|
+
...lines.slice(stop + 1),
|
|
112
|
+
].join('\n');
|
|
84
113
|
|
|
85
114
|
return { changed: text !== opts.text, text };
|
|
86
115
|
}
|
package/src/doctor/checks.ts
CHANGED
|
@@ -634,6 +634,17 @@ const readJsonObject = (opts: { file: string }): Record<string, unknown> | undef
|
|
|
634
634
|
const isRecord = (opts: { value: unknown }): opts is { value: Record<string, unknown> } =>
|
|
635
635
|
typeof opts.value === 'object' && opts.value !== null && !Array.isArray(opts.value);
|
|
636
636
|
|
|
637
|
+
/** Whether git lists the file as untracked and not ignored: what a clean-tree check, such as a release, refuses on. */
|
|
638
|
+
const isUntrackedAndVisible = (opts: { root: string; path: string }): boolean => {
|
|
639
|
+
const listed = spawnSync('git', ['status', '--porcelain', '--', opts.path], {
|
|
640
|
+
cwd: opts.root,
|
|
641
|
+
encoding: 'utf8',
|
|
642
|
+
timeout: 5000,
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
return listed.status === 0 && listed.stdout.startsWith('?? ');
|
|
646
|
+
};
|
|
647
|
+
|
|
637
648
|
const mcpWarning = (opts: { file: string; message: string }): IViolation =>
|
|
638
649
|
createViolation({ check: DoctorChecks.MCP, file: opts.file, message: opts.message });
|
|
639
650
|
|
|
@@ -642,7 +653,7 @@ const mcpWarning = (opts: { file: string; message: string }): IViolation =>
|
|
|
642
653
|
* file `sync` writes for the agents that read it) holds an `atlas` entry that runs the project's own
|
|
643
654
|
* atlas (`--root .`), and the managed Claude settings enable `atlas` by that name. A server under
|
|
644
655
|
* another name, or one that serves another folder, is never enabled automatically or serves the wrong
|
|
645
|
-
* knowledge. A `.mcp.json` git still tracks is told how to hand over to `sync
|
|
656
|
+
* knowledge. A `.mcp.json` git still tracks is told how to hand over to `sync`; one that is untracked and not ignored is told how to hide it. Warnings, not violations.
|
|
646
657
|
*/
|
|
647
658
|
export const checkMcpAtlas = (opts: ICheckContext): IViolation[] => {
|
|
648
659
|
const warnings: IViolation[] = [];
|
|
@@ -663,6 +674,14 @@ export const checkMcpAtlas = (opts: ICheckContext): IViolation[] => {
|
|
|
663
674
|
'tracked by git; VULCAN now writes it per machine. Run `git rm --cached .mcp.json` and let sync manage it.',
|
|
664
675
|
}),
|
|
665
676
|
);
|
|
677
|
+
} else if (isUntrackedAndVisible({ root: opts.root, path: MCP_FILE })) {
|
|
678
|
+
warnings.push(
|
|
679
|
+
mcpWarning({
|
|
680
|
+
file: MCP_FILE,
|
|
681
|
+
message:
|
|
682
|
+
'untracked and not ignored, so a clean-tree check (a release) refuses to run. Add `/.mcp.json` to .gitignore, or run `vulcan sync` at the top level of the repository, which lists it in .git/info/exclude.',
|
|
683
|
+
}),
|
|
684
|
+
);
|
|
666
685
|
}
|
|
667
686
|
|
|
668
687
|
const parsed = readJsonObject({ file });
|
package/src/owner/shape.ts
CHANGED
|
@@ -271,7 +271,15 @@ const decisionsFrom = (opts: { lines: string[]; view: IOwnerView; from: number }
|
|
|
271
271
|
};
|
|
272
272
|
|
|
273
273
|
const styleProblems = (opts: { lines: string[]; view: IOwnerView }): string[] => {
|
|
274
|
-
|
|
274
|
+
// The owner's own status words and labels may carry symbols: they are the shape, not a fault.
|
|
275
|
+
const configured = [
|
|
276
|
+
...Object.values(opts.view.labels.status),
|
|
277
|
+
...Object.values(opts.view.labels.labels),
|
|
278
|
+
].sort((first, second) => second.length - first.length);
|
|
279
|
+
const prose = configured.reduce(
|
|
280
|
+
(text, word) => text.replaceAll(word, ' '),
|
|
281
|
+
opts.lines.map((line) => line.replace(/`[^`]*`/g, '')).join('\n'),
|
|
282
|
+
);
|
|
275
283
|
const classes: string[] = [];
|
|
276
284
|
|
|
277
285
|
if (/\p{Emoji_Presentation}/u.test(prose)) {
|
package/src/sync/exclude.ts
CHANGED
|
@@ -39,7 +39,8 @@ export const shippedSkillNames = (): string[] => {
|
|
|
39
39
|
/**
|
|
40
40
|
* The files sync creates for the chosen agents, listed in this clone's `.git/info/exclude` (D1): the
|
|
41
41
|
* choice is per developer, so a committed `.gitignore` would flip-flop. A re-run replaces the block, so
|
|
42
|
-
* an agent that is no longer chosen drops out.
|
|
42
|
+
* an agent that is no longer chosen drops out. A project below the git top level keeps its own block,
|
|
43
|
+
* so it never replaces the block of the top level. Paths git tracks are not listed; outside a git
|
|
43
44
|
* repository nothing is written.
|
|
44
45
|
*/
|
|
45
46
|
export const planExclude = (opts: { root: string; agents: string[] }): ISyncAction[] => {
|
|
@@ -49,6 +50,11 @@ export const planExclude = (opts: { root: string; agents: string[] }): ISyncActi
|
|
|
49
50
|
return [];
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
// A project directory git already ignores (scratch under .agents/local/) needs no entries of its own.
|
|
54
|
+
if (git({ root: opts.root, args: ['check-ignore', '-q', '.'] }) !== undefined) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
|
|
52
58
|
const path = resolve(opts.root, location);
|
|
53
59
|
const prefix = git({ root: opts.root, args: ['rev-parse', '--show-prefix'] }) ?? '';
|
|
54
60
|
const anchored = excludePathsOf({ agents: opts.agents, skillNames: shippedSkillNames() }).map(
|
|
@@ -70,7 +76,11 @@ export const planExclude = (opts: { root: string; agents: string[] }): ISyncActi
|
|
|
70
76
|
.map((group) => ({ ...group, paths: group.paths.filter((item) => !tracked.has(item)) }))
|
|
71
77
|
.filter((group) => group.paths.length > 0);
|
|
72
78
|
const before = existsSync(path) ? readFileSync(path, 'utf8') : undefined;
|
|
73
|
-
const merged = mergeExcludeBlock({
|
|
79
|
+
const merged = mergeExcludeBlock({
|
|
80
|
+
text: before,
|
|
81
|
+
block: renderExcludeBlock({ groups, prefix }),
|
|
82
|
+
prefix,
|
|
83
|
+
});
|
|
74
84
|
|
|
75
85
|
if (!merged.changed) {
|
|
76
86
|
return [{ path, status: SyncStatuses.UNCHANGED, apply: NO_CHANGE }];
|