@venizia/vulcan 0.4.9-1 → 0.4.9-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/README.md +5 -6
- package/base/make/vulcan.mk +1 -11
- package/base/rules.md +3 -8
- package/base/skills/docs-update/SKILL.md +4 -2
- package/package.json +3 -3
- package/src/agents/atlas-block.ts +2 -2
- package/src/agents/common/constants.ts +1 -21
- package/src/agents/exclude.ts +2 -2
- package/src/agents/render.ts +2 -2
- package/src/agents/resolve.ts +1 -16
- package/src/commands/agents.command.ts +1 -1
- package/src/commands/help.command.ts +3 -4
- package/src/commands/init.command.ts +2 -15
- package/src/commands/sync.command.ts +0 -5
- package/src/commands/x.command.ts +1 -1
- package/src/common/constants.ts +0 -22
- package/src/common/layout-folder.ts +1 -5
- package/src/common/types.ts +0 -5
- package/src/config/common/constants.ts +2 -23
- package/src/config/common/types.ts +1 -10
- package/src/config/loader.ts +15 -16
- package/src/config/schema.ts +16 -21
- package/src/create/add-app.ts +2 -10
- package/src/create/add-lib.ts +1 -8
- package/src/create/common/constants.ts +0 -14
- package/src/create/common/types.ts +1 -2
- package/src/create/preset.ts +0 -12
- package/src/create/workspace.ts +5 -5
- package/src/doctor/checks.ts +20 -85
- package/src/doctor/common/constants.ts +2 -33
- package/src/doctor/runner.ts +0 -1
- package/src/doctor/tags.ts +4 -5
- package/src/hooks/codex-patch.ts +0 -6
- package/src/hooks/common/constants.ts +0 -24
- package/src/hooks/guard-manifest.ts +1 -1
- package/src/hooks/subagent-card.ts +1 -4
- package/src/init/common/constants.ts +0 -11
- package/src/init/scaffold.ts +8 -16
- package/src/manifest/render.ts +1 -25
- package/src/owner/constants.ts +0 -4
- package/src/owner/violations.ts +1 -15
- package/src/router.ts +1 -2
- package/src/rules/base.ts +0 -4
- package/src/rules/parser.ts +0 -10
- package/src/signals/classify.ts +2 -0
- package/src/sync/base-rules.ts +1 -2
- package/src/sync/common/constants.ts +0 -18
- package/src/sync/common/types.ts +1 -1
- package/src/sync/index.ts +0 -1
- package/src/sync/planner.ts +1 -17
- package/src/sync/settings.ts +0 -9
- package/src/visualize/assets.ts +1 -1
- package/src/visualize/compare-schema.ts +0 -4
- package/src/visualize/constants.ts +0 -24
- package/src/visualize/kinds-schema.ts +0 -8
- package/src/wiki/constants.ts +0 -4
- package/base/templates/vulcan.config.js +0 -5
- package/base/templates/vulcan.config.mjs +0 -5
- package/base/templates/vulcan.config.ts +0 -6
- package/src/sync/prune.ts +0 -142
package/src/create/add-app.ts
CHANGED
|
@@ -529,7 +529,7 @@ export class AppScaffold {
|
|
|
529
529
|
[side]: LayoutFolder.withLayoutFolder({ value: parsed.block.layout[side], folder }),
|
|
530
530
|
},
|
|
531
531
|
packages: [...parsed.block.packages, entry],
|
|
532
|
-
|
|
532
|
+
presets: parsed.block.presets,
|
|
533
533
|
sources: [
|
|
534
534
|
...parsed.block.sources,
|
|
535
535
|
...newSources.filter(
|
|
@@ -541,15 +541,7 @@ export class AppScaffold {
|
|
|
541
541
|
block: extended,
|
|
542
542
|
preset: LibPreset.recordedOf({ spec: recordedSpec, located: located.located }),
|
|
543
543
|
});
|
|
544
|
-
const
|
|
545
|
-
// A config written before presets were recorded does not read them yet: the line that does goes in.
|
|
546
|
-
const nextConfig =
|
|
547
|
-
replaced === undefined || replaced.includes('apps.presets')
|
|
548
|
-
? replaced
|
|
549
|
-
: replaced.replace(
|
|
550
|
-
' packages: apps.packages,\n',
|
|
551
|
-
' packages: apps.packages,\n presets: apps.presets,\n',
|
|
552
|
-
);
|
|
544
|
+
const nextConfig = AppsBlock.replace({ source, block });
|
|
553
545
|
|
|
554
546
|
if (nextConfig === undefined) {
|
|
555
547
|
return AddFailure.fail({ message: ROOT_HINT });
|
package/src/create/add-lib.ts
CHANGED
|
@@ -233,14 +233,7 @@ export class LibraryScaffold {
|
|
|
233
233
|
],
|
|
234
234
|
},
|
|
235
235
|
});
|
|
236
|
-
const
|
|
237
|
-
const nextConfig =
|
|
238
|
-
replaced === undefined || replaced.includes('apps.presets')
|
|
239
|
-
? replaced
|
|
240
|
-
: replaced.replace(
|
|
241
|
-
' packages: apps.packages,\n',
|
|
242
|
-
' packages: apps.packages,\n presets: apps.presets,\n',
|
|
243
|
-
);
|
|
236
|
+
const nextConfig = AppsBlock.replace({ source, block });
|
|
244
237
|
|
|
245
238
|
if (nextConfig === undefined) {
|
|
246
239
|
return AddFailure.fail({
|
|
@@ -11,12 +11,6 @@ export class AppSides {
|
|
|
11
11
|
export class AppsBlockProblems {
|
|
12
12
|
static readonly MISSING = 'missing';
|
|
13
13
|
static readonly INVALID = 'invalid';
|
|
14
|
-
|
|
15
|
-
static readonly SCHEME_SET = new Set<string>([this.MISSING, this.INVALID]);
|
|
16
|
-
|
|
17
|
-
static isValid(value: string): boolean {
|
|
18
|
-
return this.SCHEME_SET.has(value);
|
|
19
|
-
}
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
export class CreateConstants {
|
|
@@ -73,10 +67,6 @@ export class DiffEditKinds {
|
|
|
73
67
|
static readonly KEEP = 'keep';
|
|
74
68
|
static readonly ADD = 'add';
|
|
75
69
|
static readonly REMOVE = 'remove';
|
|
76
|
-
static readonly SCHEME_SET = new Set<string>([this.KEEP, this.ADD, this.REMOVE]);
|
|
77
|
-
static isValid(value: string): boolean {
|
|
78
|
-
return this.SCHEME_SET.has(value);
|
|
79
|
-
}
|
|
80
70
|
}
|
|
81
71
|
|
|
82
72
|
/** What `preset diff` says of a file the preset makes, next to the file the app has. */
|
|
@@ -84,8 +74,4 @@ export class PresetDiffStatuses {
|
|
|
84
74
|
static readonly SAME = 'same';
|
|
85
75
|
static readonly DIFFERS = 'differs';
|
|
86
76
|
static readonly MISSING = 'missing';
|
|
87
|
-
static readonly SCHEME_SET = new Set<string>([this.SAME, this.DIFFERS, this.MISSING]);
|
|
88
|
-
static isValid(value: string): boolean {
|
|
89
|
-
return this.SCHEME_SET.has(value);
|
|
90
|
-
}
|
|
91
77
|
}
|
|
@@ -113,7 +113,6 @@ export interface IRecordedPreset {
|
|
|
113
113
|
export interface IAppsBlock {
|
|
114
114
|
layout: ILayout;
|
|
115
115
|
packages: { dir: string; name: string; path: string; kind?: 'lib'; presetKind?: TLibraryKind }[];
|
|
116
|
-
|
|
117
|
-
presets?: IRecordedPreset[];
|
|
116
|
+
presets: IRecordedPreset[];
|
|
118
117
|
sources: { name: string; repo: string; ref: string }[];
|
|
119
118
|
}
|
package/src/create/preset.ts
CHANGED
|
@@ -152,18 +152,6 @@ export class Preset {
|
|
|
152
152
|
const packageVersion = String(manifest.version);
|
|
153
153
|
const shown = `${packageName}@${packageVersion}`;
|
|
154
154
|
const vulcan = manifest[CreateConstants.PRESET_FIELD];
|
|
155
|
-
const oldKeys = ['preset', 'lib'].filter(
|
|
156
|
-
(key) => JsonValue.readProperty({ value: vulcan, key }) !== undefined,
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
// No fallback to the keys before `presets`: say what the contract is now.
|
|
160
|
-
if (oldKeys.length > 0) {
|
|
161
|
-
return {
|
|
162
|
-
ok: false,
|
|
163
|
-
error: `${shown} uses the old keys "vulcan": { ${oldKeys.map((key) => `"${key}"`).join(', ')} }; the contract is now "vulcan": { "presets": { "app": "./path/preset.json", "lib": "./path/lib.json" } }`,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
155
|
const presets = JsonValue.readProperty({ value: vulcan, key: 'presets' });
|
|
168
156
|
const field = JsonValue.readProperty({ value: presets, key: 'app' });
|
|
169
157
|
const libField = JsonValue.readProperty({ value: presets, key: 'lib' });
|
package/src/create/workspace.ts
CHANGED
|
@@ -277,8 +277,8 @@ const isRecordedPreset = (value: unknown): boolean =>
|
|
|
277
277
|
|
|
278
278
|
const isAppsBlock = (value: unknown): value is IAppsBlock =>
|
|
279
279
|
RecordValue.isRecord(value) &&
|
|
280
|
-
(value.presets
|
|
281
|
-
|
|
280
|
+
Array.isArray(value.presets) &&
|
|
281
|
+
value.presets.every((entry) => isRecordedPreset(entry)) &&
|
|
282
282
|
RecordValue.isRecord(value.layout) &&
|
|
283
283
|
Object.values(value.layout).every(
|
|
284
284
|
(folders) =>
|
|
@@ -511,12 +511,12 @@ export class PresetRecord {
|
|
|
511
511
|
|
|
512
512
|
/** The block with this preset recorded: once per spec, its side and summary refreshed. */
|
|
513
513
|
static record(opts: { block: IAppsBlock; preset: IRecordedPreset }): IAppsBlock {
|
|
514
|
-
const others =
|
|
515
|
-
const index =
|
|
514
|
+
const others = opts.block.presets.filter((item) => item.spec !== opts.preset.spec);
|
|
515
|
+
const index = opts.block.presets.findIndex((item) => item.spec === opts.preset.spec);
|
|
516
516
|
const presets =
|
|
517
517
|
index === -1
|
|
518
518
|
? [...others, opts.preset]
|
|
519
|
-
:
|
|
519
|
+
: opts.block.presets.map((item, at) => (at === index ? opts.preset : item));
|
|
520
520
|
|
|
521
521
|
return { ...opts.block, presets };
|
|
522
522
|
}
|
package/src/doctor/checks.ts
CHANGED
|
@@ -7,17 +7,10 @@ import { LayoutKeys, LayoutFolder } from '../common/layout-folder.ts';
|
|
|
7
7
|
import { MCP_SERVER_HINT, ProjectScaffold } from '../init/index.ts';
|
|
8
8
|
import { ProjectPackages } from '../config/index.ts';
|
|
9
9
|
import type { TResolvedConfig } from '../config/index.ts';
|
|
10
|
-
import { BaseRules,
|
|
10
|
+
import { BaseRules, RuleParser, RuleSlots } from '../rules/index.ts';
|
|
11
11
|
import { ManifestConstants, ProjectManifest } from '../manifest/index.ts';
|
|
12
12
|
import { AgentScopes, AgentSelection, AgentTable, LocalChoice } from '../agents/index.ts';
|
|
13
|
-
import {
|
|
14
|
-
AgentFiles,
|
|
15
|
-
AtlasBlockPlan,
|
|
16
|
-
LocalPlan,
|
|
17
|
-
PrunePlan,
|
|
18
|
-
SyncPlanner,
|
|
19
|
-
SyncStatuses,
|
|
20
|
-
} from '../sync/index.ts';
|
|
13
|
+
import { AgentFiles, AtlasBlockPlan, LocalPlan, SyncPlanner, SyncStatuses } from '../sync/index.ts';
|
|
21
14
|
import { LocalConstants, LocalFormat, LocalScan, LocalStates } from '../local/index.ts';
|
|
22
15
|
import {
|
|
23
16
|
ReplySwitch,
|
|
@@ -123,7 +116,6 @@ const readScriptNames = (opts: { file: string }): string[] | undefined => {
|
|
|
123
116
|
}
|
|
124
117
|
};
|
|
125
118
|
|
|
126
|
-
/** Info only: the Atlas block of AGENTS.md is missing or no longer matches the config. */
|
|
127
119
|
const CANONICAL_ATLAS_ARGS = ['x', '--no-install', 'vulcan', 'x', 'atlas', 'mcp', '--root', '.'];
|
|
128
120
|
|
|
129
121
|
const MCP_FILE = '.mcp.json';
|
|
@@ -211,7 +203,6 @@ const formatOwners = (opts: ICheckContext): string[] => [
|
|
|
211
203
|
]),
|
|
212
204
|
];
|
|
213
205
|
|
|
214
|
-
/** The size of `.agents/local/` once it is large: where the space went, and the command that gives it back. */
|
|
215
206
|
/** The states of a listed script worth a warning: a typo or a script nobody committed. A modified one is normal work, so it is only a note. */
|
|
216
207
|
const STALE_TRUST_STATES = new Set<string>([
|
|
217
208
|
TrustStates.MISSING,
|
|
@@ -244,11 +235,10 @@ export class ProjectContract {
|
|
|
244
235
|
|
|
245
236
|
/**
|
|
246
237
|
* The base owns the `V-` namespace: a project defines its rules with bare IDs, and a `V-` ID in its
|
|
247
|
-
* rules points at a base rule - one the base does not carry
|
|
238
|
+
* rules points at a base rule - one the base does not carry dangles.
|
|
248
239
|
*/
|
|
249
240
|
static checkRuleIds(opts: ICheckContext): IViolation[] {
|
|
250
241
|
const base = BaseRules.read();
|
|
251
|
-
const retired = new Set(BaseRules.readRetiredIds());
|
|
252
242
|
|
|
253
243
|
return RuleParser.parseBaseReferences({
|
|
254
244
|
markdown: readText({ file: join(opts.root, '.agents', 'rules.md') }),
|
|
@@ -258,9 +248,7 @@ export class ProjectContract {
|
|
|
258
248
|
createViolation({
|
|
259
249
|
check: DoctorChecks.RULE_IDS,
|
|
260
250
|
file: '.agents/rules.md',
|
|
261
|
-
message:
|
|
262
|
-
? `${id} is retired in the base - drop the reference`
|
|
263
|
-
: `${id} is not a base rule - give the extension a bare ID`,
|
|
251
|
+
message: `${id} is not a base rule - give the extension a bare ID`,
|
|
264
252
|
}),
|
|
265
253
|
);
|
|
266
254
|
}
|
|
@@ -298,16 +286,11 @@ export class ProjectContract {
|
|
|
298
286
|
for (const id of Object.keys(opts.config.rules).filter(
|
|
299
287
|
(ruleId) => slots[ruleId] === undefined,
|
|
300
288
|
)) {
|
|
301
|
-
const namespaced = `${RuleConstants.BASE_NAMESPACE}${id}`;
|
|
302
|
-
|
|
303
289
|
violations.push(
|
|
304
290
|
createViolation({
|
|
305
291
|
check: DoctorChecks.RULE_SLOTS,
|
|
306
292
|
file: opts.configFile,
|
|
307
|
-
message:
|
|
308
|
-
slots[namespaced] === undefined
|
|
309
|
-
? `${id} is not a slot - only ${Object.keys(slots).join(', ')} take a choice`
|
|
310
|
-
: `'${id}' is not a slot - the base rule is now '${namespaced}'`,
|
|
293
|
+
message: `${id} is not a slot - only ${Object.keys(slots).join(', ')} take a choice`,
|
|
311
294
|
}),
|
|
312
295
|
);
|
|
313
296
|
}
|
|
@@ -418,32 +401,14 @@ export class ProjectContract {
|
|
|
418
401
|
];
|
|
419
402
|
}
|
|
420
403
|
|
|
421
|
-
/** What `sync --prune` would remove: an old VULCAN or plugin-era hook command, a dead skill link. */
|
|
422
|
-
static checkPrune(opts: ICheckContext): IViolation[] {
|
|
423
|
-
return PrunePlan.plan({ root: opts.root }).map((action) =>
|
|
424
|
-
createViolation({
|
|
425
|
-
check: DoctorChecks.PRUNE,
|
|
426
|
-
file: relative(opts.root, action.path),
|
|
427
|
-
message: `${action.note ?? 'stale'} - run '${ProjectLayout.VULCAN_COMMAND} sync --prune'`,
|
|
428
|
-
}),
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
404
|
/**
|
|
433
405
|
* C1: the committed manifest is what the config renders - atlas reads the file, never the config.
|
|
434
|
-
* A
|
|
406
|
+
* A hand-edited one, or one without the `$generated` note, is not.
|
|
435
407
|
*/
|
|
436
408
|
static checkManifest(opts: ICheckContext): IViolation[] {
|
|
437
409
|
const action = SyncPlanner.planManifest({ root: opts.root, config: opts.config });
|
|
438
410
|
|
|
439
|
-
if (
|
|
440
|
-
action.status === SyncStatuses.UNCHANGED ||
|
|
441
|
-
(action.status === SyncStatuses.REPLACED &&
|
|
442
|
-
ProjectManifest.isCurrent({
|
|
443
|
-
committed: readFileSync(join(opts.root, ManifestConstants.FILE), 'utf8'),
|
|
444
|
-
rendered: ProjectManifest.render({ root: opts.root, config: opts.config }),
|
|
445
|
-
}))
|
|
446
|
-
) {
|
|
411
|
+
if (action.status === SyncStatuses.UNCHANGED) {
|
|
447
412
|
return [];
|
|
448
413
|
}
|
|
449
414
|
|
|
@@ -484,27 +449,17 @@ export class ProjectContract {
|
|
|
484
449
|
|
|
485
450
|
for (const owner of owners) {
|
|
486
451
|
const configs = join(owner, '.configs');
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
.filter((file) => DoctorConstants.LINT_CONFIG_FILE.test(file))
|
|
494
|
-
.map((file) => ({
|
|
495
|
-
file: join(directory, file),
|
|
496
|
-
name: file,
|
|
497
|
-
legacy: folder === '.',
|
|
498
|
-
}))
|
|
499
|
-
: [];
|
|
500
|
-
},
|
|
501
|
-
);
|
|
502
|
-
const names = found.map((item) => item.file);
|
|
452
|
+
const directory = join(configs, DoctorConstants.LINT_CONFIG_FOLDER);
|
|
453
|
+
const found = existsSync(join(opts.root, directory))
|
|
454
|
+
? readdirSync(join(opts.root, directory))
|
|
455
|
+
.filter((file) => DoctorConstants.LINT_CONFIG_FILE.test(file))
|
|
456
|
+
.map((file) => join(directory, file))
|
|
457
|
+
: [];
|
|
503
458
|
|
|
504
|
-
lintConfigs +=
|
|
459
|
+
lintConfigs += found.length;
|
|
505
460
|
|
|
506
461
|
if (
|
|
507
|
-
|
|
462
|
+
found.length > 0 &&
|
|
508
463
|
!isRootDeclared &&
|
|
509
464
|
!hasStylePackage({ directory: join(opts.root, owner) })
|
|
510
465
|
) {
|
|
@@ -517,21 +472,7 @@ export class ProjectContract {
|
|
|
517
472
|
);
|
|
518
473
|
}
|
|
519
474
|
|
|
520
|
-
for (const
|
|
521
|
-
const { file } = item;
|
|
522
|
-
|
|
523
|
-
if (item.legacy) {
|
|
524
|
-
const tool = item.name.split('.')[0];
|
|
525
|
-
|
|
526
|
-
violations.push(
|
|
527
|
-
createViolation({
|
|
528
|
-
check: DoctorChecks.STYLE,
|
|
529
|
-
file,
|
|
530
|
-
message: `move it to .configs/${DoctorConstants.LINT_CONFIG_FOLDERS[tool]}/${item.name}`,
|
|
531
|
-
}),
|
|
532
|
-
);
|
|
533
|
-
}
|
|
534
|
-
|
|
475
|
+
for (const file of found) {
|
|
535
476
|
if (!readText({ file: join(opts.root, file) }).includes(ProjectLayout.STYLE_PACKAGE)) {
|
|
536
477
|
violations.push(
|
|
537
478
|
createViolation({
|
|
@@ -734,7 +675,7 @@ export class ProjectContract {
|
|
|
734
675
|
* file `sync` writes for the agents that read it) holds an `atlas` entry that runs the project's own
|
|
735
676
|
* atlas (`--root .`), and the managed Claude settings enable `atlas` by that name. A server under
|
|
736
677
|
* another name, or one that serves another folder, is never enabled automatically or serves the wrong
|
|
737
|
-
* knowledge.
|
|
678
|
+
* knowledge. One that is untracked and not ignored is told how to hide it. Warnings, not violations.
|
|
738
679
|
*/
|
|
739
680
|
static checkMcpAtlas(opts: ICheckContext): IViolation[] {
|
|
740
681
|
const warnings: IViolation[] = [];
|
|
@@ -750,15 +691,7 @@ export class ProjectContract {
|
|
|
750
691
|
// The root `.mcp.json` is a per-machine file of the agents that read it; a missing one is the
|
|
751
692
|
// `adapters` check's (not synced yet), so only an existing file is looked at.
|
|
752
693
|
if (readsMcpFile && existsSync(file)) {
|
|
753
|
-
if (
|
|
754
|
-
warnings.push(
|
|
755
|
-
mcpWarning({
|
|
756
|
-
file: MCP_FILE,
|
|
757
|
-
message:
|
|
758
|
-
'tracked by git; VULCAN now writes it per machine. Run `git rm --cached .mcp.json` and let sync manage it.',
|
|
759
|
-
}),
|
|
760
|
-
);
|
|
761
|
-
} else if (isUntrackedAndVisible({ root: opts.root, path: MCP_FILE })) {
|
|
694
|
+
if (isUntrackedAndVisible({ root: opts.root, path: MCP_FILE })) {
|
|
762
695
|
warnings.push(
|
|
763
696
|
mcpWarning({
|
|
764
697
|
file: MCP_FILE,
|
|
@@ -979,6 +912,7 @@ export class ProjectContract {
|
|
|
979
912
|
return warnings;
|
|
980
913
|
}
|
|
981
914
|
|
|
915
|
+
/** Info only: the Atlas block of AGENTS.md is missing or no longer matches the config. */
|
|
982
916
|
static checkAtlasBlock(opts: ICheckContext): IViolation[] {
|
|
983
917
|
const merged = AtlasBlockPlan.merged({ root: opts.root, config: opts.config });
|
|
984
918
|
|
|
@@ -1253,6 +1187,7 @@ export class ProjectContract {
|
|
|
1253
1187
|
];
|
|
1254
1188
|
}
|
|
1255
1189
|
|
|
1190
|
+
/** The size of `.agents/local/` once it is large: where the space went, and the command that gives it back. */
|
|
1256
1191
|
static checkLocalSize(opts: ICheckContext): IViolation[] {
|
|
1257
1192
|
const entries = LocalScan.scan({ root: opts.root });
|
|
1258
1193
|
const total = entries.reduce((sum, entry) => sum + entry.bytes, 0);
|
|
@@ -10,7 +10,6 @@ export class DoctorChecks {
|
|
|
10
10
|
static readonly STYLE = 'style';
|
|
11
11
|
static readonly MANIFEST = 'manifest';
|
|
12
12
|
static readonly TAGS = 'tags';
|
|
13
|
-
static readonly PRUNE = 'prune';
|
|
14
13
|
static readonly SCAFFOLD = 'scaffold';
|
|
15
14
|
static readonly APPS = 'apps';
|
|
16
15
|
static readonly SCRIPTS = 'scripts';
|
|
@@ -21,33 +20,6 @@ export class DoctorChecks {
|
|
|
21
20
|
static readonly LOCAL = 'local';
|
|
22
21
|
static readonly PROFILE = 'profile';
|
|
23
22
|
static readonly GUARDS = 'guards';
|
|
24
|
-
static readonly SCHEME_SET = new Set<string>([
|
|
25
|
-
this.CONFIG,
|
|
26
|
-
this.LAYOUT,
|
|
27
|
-
this.RULE_IDS,
|
|
28
|
-
this.RULE_SLOTS,
|
|
29
|
-
this.SKILLS,
|
|
30
|
-
this.MAKE,
|
|
31
|
-
this.HOOKS,
|
|
32
|
-
this.ADAPTERS,
|
|
33
|
-
this.STYLE,
|
|
34
|
-
this.MANIFEST,
|
|
35
|
-
this.TAGS,
|
|
36
|
-
this.PRUNE,
|
|
37
|
-
this.SCAFFOLD,
|
|
38
|
-
this.APPS,
|
|
39
|
-
this.SCRIPTS,
|
|
40
|
-
this.AGENTS,
|
|
41
|
-
this.DOCKERIGNORE,
|
|
42
|
-
this.MCP,
|
|
43
|
-
this.FORMAT,
|
|
44
|
-
this.LOCAL,
|
|
45
|
-
this.PROFILE,
|
|
46
|
-
this.GUARDS,
|
|
47
|
-
]);
|
|
48
|
-
static isValid(value: string): boolean {
|
|
49
|
-
return this.SCHEME_SET.has(value);
|
|
50
|
-
}
|
|
51
23
|
}
|
|
52
24
|
|
|
53
25
|
/** The `package.json` scripts every app carries, and the names the standard retired. */
|
|
@@ -76,9 +48,6 @@ export class DoctorConstants {
|
|
|
76
48
|
/** The oxfmt config names `bun fmt` finds by itself, in a package folder or above it; they override `[fmt]`. */
|
|
77
49
|
static readonly OXFMT_AUTOLOADED_FILES = ['.oxfmtrc.json', '.oxfmtrc.jsonc', 'oxfmt.config.ts'];
|
|
78
50
|
static readonly LINT_CONFIG_FILE = /^(oxlint|eslint)\.config\.(mts|ts|mjs|js|cjs)$/;
|
|
79
|
-
/** Where
|
|
80
|
-
static readonly
|
|
81
|
-
oxlint: 'lints',
|
|
82
|
-
eslint: 'lints',
|
|
83
|
-
};
|
|
51
|
+
/** Where the lint configs live under `.configs/`. */
|
|
52
|
+
static readonly LINT_CONFIG_FOLDER = 'lints';
|
|
84
53
|
}
|
package/src/doctor/runner.ts
CHANGED
|
@@ -36,7 +36,6 @@ export class DoctorRunner {
|
|
|
36
36
|
...ProjectContract.checkHooks(context),
|
|
37
37
|
...ProjectContract.checkAdapters(context),
|
|
38
38
|
...ProjectContract.checkAgents(context),
|
|
39
|
-
...ProjectContract.checkPrune(context),
|
|
40
39
|
...ProjectContract.checkManifest(context),
|
|
41
40
|
...TagCheck.check(context),
|
|
42
41
|
...SkillLint.check(context),
|
package/src/doctor/tags.ts
CHANGED
|
@@ -5,15 +5,14 @@ import type { ICheckContext } from './checks.ts';
|
|
|
5
5
|
import { DoctorChecks } from './common/index.ts';
|
|
6
6
|
import type { IViolation } from './common/index.ts';
|
|
7
7
|
|
|
8
|
-
/** The tag pattern as a regular expression that captures `<dir
|
|
8
|
+
/** The tag pattern as a regular expression that captures `<dir>`. */
|
|
9
9
|
const tagPatternOf = (opts: { template: string }): RegExp =>
|
|
10
10
|
new RegExp(
|
|
11
11
|
`^${opts.template
|
|
12
|
-
.split(/(<(?:dir|
|
|
12
|
+
.split(/(<(?:dir|version|date)>)/)
|
|
13
13
|
.map((part) => {
|
|
14
14
|
switch (part) {
|
|
15
|
-
case '<dir>':
|
|
16
|
-
case '<package>': {
|
|
15
|
+
case '<dir>': {
|
|
17
16
|
return '(?<dir>[a-z0-9][a-z0-9.-]*)';
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -43,7 +42,7 @@ export class TagCheck {
|
|
|
43
42
|
static check(opts: ICheckContext): IViolation[] {
|
|
44
43
|
const template = opts.config.atlas.tagPattern;
|
|
45
44
|
|
|
46
|
-
if (
|
|
45
|
+
if (!template.includes('<dir>')) {
|
|
47
46
|
return [];
|
|
48
47
|
}
|
|
49
48
|
|
package/src/hooks/codex-patch.ts
CHANGED
|
@@ -5,12 +5,6 @@ import type { TConstValue } from '../common/index.ts';
|
|
|
5
5
|
export class PatchedTools {
|
|
6
6
|
static readonly WRITE = 'write';
|
|
7
7
|
static readonly EDIT = 'edit';
|
|
8
|
-
|
|
9
|
-
static readonly SCHEME_SET = new Set<string>([this.WRITE, this.EDIT]);
|
|
10
|
-
|
|
11
|
-
static isValid(value: string): boolean {
|
|
12
|
-
return this.SCHEME_SET.has(value);
|
|
13
|
-
}
|
|
14
8
|
}
|
|
15
9
|
|
|
16
10
|
type TPatchedTool = TConstValue<typeof PatchedTools>;
|
|
@@ -2,22 +2,12 @@
|
|
|
2
2
|
export class GuardDecisions {
|
|
3
3
|
static readonly ASK = 'ask';
|
|
4
4
|
static readonly DENY = 'deny';
|
|
5
|
-
static readonly SCHEME_SET = new Set<string>([this.ASK, this.DENY]);
|
|
6
|
-
static isValid(value: string): boolean {
|
|
7
|
-
return this.SCHEME_SET.has(value);
|
|
8
|
-
}
|
|
9
5
|
}
|
|
10
6
|
|
|
11
7
|
/** What the package guard says about a hand-made package: refuse where a `vulcan add` command exists, else warn. */
|
|
12
8
|
export class PackageVerdictKinds {
|
|
13
9
|
static readonly DENY = GuardDecisions.DENY;
|
|
14
10
|
static readonly WARN = 'warn';
|
|
15
|
-
|
|
16
|
-
static readonly SCHEME_SET = new Set<string>([this.DENY, this.WARN]);
|
|
17
|
-
|
|
18
|
-
static isValid(value: string): boolean {
|
|
19
|
-
return this.SCHEME_SET.has(value);
|
|
20
|
-
}
|
|
21
11
|
}
|
|
22
12
|
|
|
23
13
|
/** What git says about a script a project trusts: only `TRUSTED` skips the script checks of guard-writes. */
|
|
@@ -29,20 +19,6 @@ export class TrustStates {
|
|
|
29
19
|
static readonly MODIFIED = 'modified';
|
|
30
20
|
static readonly SYMLINK = 'symlink';
|
|
31
21
|
static readonly UNKNOWN = 'unknown';
|
|
32
|
-
|
|
33
|
-
static readonly SCHEME_SET = new Set<string>([
|
|
34
|
-
this.TRUSTED,
|
|
35
|
-
this.MISSING,
|
|
36
|
-
this.UNTRACKED,
|
|
37
|
-
this.UNCOMMITTED,
|
|
38
|
-
this.MODIFIED,
|
|
39
|
-
this.SYMLINK,
|
|
40
|
-
this.UNKNOWN,
|
|
41
|
-
]);
|
|
42
|
-
|
|
43
|
-
static isValid(value: string): boolean {
|
|
44
|
-
return this.SCHEME_SET.has(value);
|
|
45
|
-
}
|
|
46
22
|
}
|
|
47
23
|
|
|
48
24
|
export class HookConstants {
|
|
@@ -6,7 +6,7 @@ import { HookDecision } from './decision.ts';
|
|
|
6
6
|
/** The shell tool under the names the hosts give it: Cursor's `Shell`, and a lower-case `bash`. */
|
|
7
7
|
const SHELL_NAMES = new Set(['Shell', 'shell', 'bash']);
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const MANIFEST_BLOCK_MESSAGE =
|
|
10
10
|
'vulcan.manifest.json is generated - edit .configs/vulcan.config.* and run `vulcan sync`';
|
|
11
11
|
|
|
12
12
|
const MANIFEST_SUFFIX = '/.agents/vulcan.manifest.json';
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { HookConstants } from './common/index.ts';
|
|
2
2
|
|
|
3
|
-
/** The most a subagent's start card may be: it is paid for once per subagent, so it carries gates only. */
|
|
4
|
-
export const SUBAGENT_CARD_MAX_CHARACTERS = 1600;
|
|
5
|
-
|
|
6
3
|
/**
|
|
7
4
|
* What a subagent must keep, and nothing else: the project's own rules are one path away, and the owner
|
|
8
5
|
* shape and the profile are for the agent that talks to the owner. Each line cites its base rule.
|
|
9
6
|
*/
|
|
10
|
-
|
|
7
|
+
const SUBAGENT_CARD = [
|
|
11
8
|
'# VULCAN: rules for a subagent',
|
|
12
9
|
'',
|
|
13
10
|
'You work for a main agent, inside this project. Base rules: `node_modules/@venizia/vulcan/base/rules.md`; this project: `.agents/rules.md`.',
|
|
@@ -4,19 +4,8 @@ export class InitStatuses {
|
|
|
4
4
|
static readonly KEPT = 'kept';
|
|
5
5
|
static readonly ADD = 'add';
|
|
6
6
|
static readonly SKIPPED = 'skipped';
|
|
7
|
-
static readonly SCHEME_SET = new Set<string>([
|
|
8
|
-
this.CREATED,
|
|
9
|
-
this.UPDATED,
|
|
10
|
-
this.KEPT,
|
|
11
|
-
this.ADD,
|
|
12
|
-
this.SKIPPED,
|
|
13
|
-
]);
|
|
14
|
-
static isValid(value: string): boolean {
|
|
15
|
-
return this.SCHEME_SET.has(value);
|
|
16
|
-
}
|
|
17
7
|
}
|
|
18
8
|
|
|
19
9
|
export class InitConstants {
|
|
20
10
|
static readonly NAME_TOKEN = '{{name}}';
|
|
21
|
-
static readonly CONFIG_FLAG = '--config';
|
|
22
11
|
}
|
package/src/init/scaffold.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
3
3
|
import { basename, dirname, join, relative } from 'node:path';
|
|
4
4
|
import { BASE_DIRECTORY, JsonValue, ProjectLayout } from '../common/index.ts';
|
|
5
5
|
import { ConfigConstants, ConfigLoader } from '../config/index.ts';
|
|
6
|
-
import type { TConfigExtension } from '../config/index.ts';
|
|
7
6
|
import { InitConstants, InitStatuses } from './common/index.ts';
|
|
8
7
|
import { Bunfig } from '../create/bunfig.ts';
|
|
9
8
|
import { Dockerignore } from '../create/dockerignore.ts';
|
|
@@ -13,7 +12,7 @@ import type { IInitEntry, IScaffoldFile } from './common/index.ts';
|
|
|
13
12
|
export const MCP_SERVER_HINT =
|
|
14
13
|
'"atlas": { "command": "bun", "args": ["x", "--no-install", "vulcan", "x", "atlas", "mcp", "--root", "."] }';
|
|
15
14
|
|
|
16
|
-
/** The files every project gets, apart from the config
|
|
15
|
+
/** The files every project gets, apart from the config. */
|
|
17
16
|
const SCAFFOLD_FILES: IScaffoldFile[] = [
|
|
18
17
|
{ path: 'AGENTS.md', template: 'AGENTS.md' },
|
|
19
18
|
{ path: '.agents/rules.md', template: 'rules.md' },
|
|
@@ -132,7 +131,7 @@ export class ProjectScaffold {
|
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
/** Scaffolds the project layer at `root`. Never overwrites: an existing file is kept and a needed edit becomes a hint; only `.gitignore` is appended to, line by line. */
|
|
135
|
-
static scaffold(opts: { root: string
|
|
134
|
+
static scaffold(opts: { root: string }): IScaffoldResult {
|
|
136
135
|
const { root } = opts;
|
|
137
136
|
const name = resolveProjectName({ root });
|
|
138
137
|
const isWorkspaces = ProjectScaffold.declaresWorkspaces({ root });
|
|
@@ -149,29 +148,22 @@ export class ProjectScaffold {
|
|
|
149
148
|
if (isWorkspaces) {
|
|
150
149
|
entries.push({
|
|
151
150
|
status: InitStatuses.SKIPPED,
|
|
152
|
-
subject: `.configs/
|
|
151
|
+
subject: `.configs/lints: a workspaces project keeps them per app (apps/<name>/.configs/lints/); the templates are in node_modules/@venizia/vulcan/base/templates/`,
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
if (configs.length === 0) {
|
|
159
|
-
const configFile = `${ConfigConstants.BASENAME}.${opts.extension}`;
|
|
155
|
+
const config = ConfigLoader.findFile({ root });
|
|
160
156
|
|
|
157
|
+
if (config === undefined) {
|
|
161
158
|
entries.push(
|
|
162
159
|
writeIfAbsent({
|
|
163
160
|
root,
|
|
164
|
-
path: join(ConfigConstants.DIRECTORY,
|
|
165
|
-
content: ProjectScaffold.renderTemplate({ template:
|
|
161
|
+
path: join(ConfigConstants.DIRECTORY, ConfigConstants.FILE),
|
|
162
|
+
content: ProjectScaffold.renderTemplate({ template: ConfigConstants.FILE, name }),
|
|
166
163
|
}),
|
|
167
164
|
);
|
|
168
165
|
} else {
|
|
169
|
-
entries.push(
|
|
170
|
-
...configs.map((file): IInitEntry => ({
|
|
171
|
-
status: InitStatuses.KEPT,
|
|
172
|
-
subject: relative(root, file),
|
|
173
|
-
})),
|
|
174
|
-
);
|
|
166
|
+
entries.push({ status: InitStatuses.KEPT, subject: relative(root, config) });
|
|
175
167
|
}
|
|
176
168
|
|
|
177
169
|
entries.push(writeIfAbsent({ root, path: '.dockerignore', content: Dockerignore.render() }));
|
package/src/manifest/render.ts
CHANGED
|
@@ -11,7 +11,7 @@ export class ManifestConstants {
|
|
|
11
11
|
static readonly SCHEMA_VERSION = 1;
|
|
12
12
|
static readonly PROJECT_RULES = '.agents/rules.md';
|
|
13
13
|
static readonly ENV = 'VULCAN_MANIFEST';
|
|
14
|
-
/** The first key: a reader sees at once that the file is generated. Readers ignore it
|
|
14
|
+
/** The first key: a reader sees at once that the file is generated. Readers ignore it. */
|
|
15
15
|
static readonly GENERATED_KEY = '$generated';
|
|
16
16
|
static readonly GENERATED_NOTE = 'by vulcan sync from .configs/vulcan.config.* - do not edit';
|
|
17
17
|
}
|
|
@@ -147,28 +147,4 @@ export class ProjectManifest {
|
|
|
147
147
|
file: ManifestConstants.FILE,
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Whether a committed manifest holds what the config renders, apart from the `$generated` note: a
|
|
153
|
-
* file written before the note existed is current, a hand-edited one is not.
|
|
154
|
-
*/
|
|
155
|
-
static isCurrent(opts: { committed: string; rendered: string }): boolean {
|
|
156
|
-
try {
|
|
157
|
-
const strip = (text: string): string => {
|
|
158
|
-
const record: Record<string, unknown> = JSON.parse(text);
|
|
159
|
-
|
|
160
|
-
delete record[ManifestConstants.GENERATED_KEY];
|
|
161
|
-
|
|
162
|
-
return JSON.stringify(record);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return strip(opts.committed) === strip(opts.rendered);
|
|
166
|
-
} catch (error) {
|
|
167
|
-
console.error(
|
|
168
|
-
`[ProjectManifest.isCurrent] unreadable manifest | ${error instanceof Error ? error.message : String(error)}`,
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
150
|
}
|
package/src/owner/constants.ts
CHANGED
|
@@ -119,8 +119,4 @@ export class OwnerReplySwitch {
|
|
|
119
119
|
export class OwnerLabelModes {
|
|
120
120
|
static readonly EXACT = 'exact';
|
|
121
121
|
static readonly FREE = 'free';
|
|
122
|
-
static readonly SCHEME_SET = new Set<string>([this.EXACT, this.FREE]);
|
|
123
|
-
static isValid(value: string): boolean {
|
|
124
|
-
return this.SCHEME_SET.has(value);
|
|
125
|
-
}
|
|
126
122
|
}
|