@venizia/vulcan 0.3.11 → 0.3.12
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/agents.json +19 -58
- package/base/claude/settings.json +1 -3
- package/package.json +18 -19
- package/src/common/constants.ts +1 -1
- package/src/common/format.ts +24 -0
- package/src/common/index.ts +1 -0
- package/src/create/add-app.ts +2 -1
- package/src/create/add-lib.ts +2 -1
- package/src/create/bunfig.ts +16 -4
- package/src/create/manifest-json.ts +5 -0
- package/src/create/workspace.ts +9 -5
- package/src/doctor/checks.ts +121 -0
- package/src/doctor/common/constants.ts +10 -2
- package/src/doctor/runner.ts +7 -1
- package/src/init/scaffold.ts +0 -1
- package/src/manifest/render.ts +5 -1
- package/base/templates/oxfmt.config.mts +0 -4
package/base/agents.json
CHANGED
|
@@ -3,15 +3,9 @@
|
|
|
3
3
|
"id": "claude",
|
|
4
4
|
"name": "Claude Code",
|
|
5
5
|
"detect": {
|
|
6
|
-
"binaries": [
|
|
7
|
-
|
|
8
|
-
]
|
|
9
|
-
"homeDirs": [
|
|
10
|
-
"~/.claude"
|
|
11
|
-
],
|
|
12
|
-
"projectDirs": [
|
|
13
|
-
".claude"
|
|
14
|
-
]
|
|
6
|
+
"binaries": ["claude"],
|
|
7
|
+
"homeDirs": ["~/.claude"],
|
|
8
|
+
"projectDirs": [".claude"]
|
|
15
9
|
},
|
|
16
10
|
"instructions": {
|
|
17
11
|
"nativeAgentsMd": false,
|
|
@@ -35,15 +29,9 @@
|
|
|
35
29
|
"id": "omp",
|
|
36
30
|
"name": "omp (oh-my-pi)",
|
|
37
31
|
"detect": {
|
|
38
|
-
"binaries": [
|
|
39
|
-
|
|
40
|
-
]
|
|
41
|
-
"homeDirs": [
|
|
42
|
-
"~/.omp"
|
|
43
|
-
],
|
|
44
|
-
"projectDirs": [
|
|
45
|
-
".omp"
|
|
46
|
-
]
|
|
32
|
+
"binaries": ["omp"],
|
|
33
|
+
"homeDirs": ["~/.omp"],
|
|
34
|
+
"projectDirs": [".omp"]
|
|
47
35
|
},
|
|
48
36
|
"instructions": {
|
|
49
37
|
"nativeAgentsMd": true,
|
|
@@ -64,15 +52,9 @@
|
|
|
64
52
|
"id": "codex",
|
|
65
53
|
"name": "Codex",
|
|
66
54
|
"detect": {
|
|
67
|
-
"binaries": [
|
|
68
|
-
|
|
69
|
-
]
|
|
70
|
-
"homeDirs": [
|
|
71
|
-
"~/.codex"
|
|
72
|
-
],
|
|
73
|
-
"projectDirs": [
|
|
74
|
-
".codex"
|
|
75
|
-
]
|
|
55
|
+
"binaries": ["codex"],
|
|
56
|
+
"homeDirs": ["~/.codex"],
|
|
57
|
+
"projectDirs": [".codex"]
|
|
76
58
|
},
|
|
77
59
|
"instructions": {
|
|
78
60
|
"nativeAgentsMd": true,
|
|
@@ -95,16 +77,9 @@
|
|
|
95
77
|
"id": "cursor",
|
|
96
78
|
"name": "Cursor",
|
|
97
79
|
"detect": {
|
|
98
|
-
"binaries": [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
],
|
|
102
|
-
"homeDirs": [
|
|
103
|
-
"~/.cursor"
|
|
104
|
-
],
|
|
105
|
-
"projectDirs": [
|
|
106
|
-
".cursor"
|
|
107
|
-
]
|
|
80
|
+
"binaries": ["cursor", "cursor-agent"],
|
|
81
|
+
"homeDirs": ["~/.cursor"],
|
|
82
|
+
"projectDirs": [".cursor"]
|
|
108
83
|
},
|
|
109
84
|
"instructions": {
|
|
110
85
|
"nativeAgentsMd": true,
|
|
@@ -125,9 +100,7 @@
|
|
|
125
100
|
"id": "copilot-cli",
|
|
126
101
|
"name": "Copilot CLI",
|
|
127
102
|
"detect": {
|
|
128
|
-
"binaries": [
|
|
129
|
-
"copilot"
|
|
130
|
-
],
|
|
103
|
+
"binaries": ["copilot"],
|
|
131
104
|
"homeDirs": [],
|
|
132
105
|
"projectDirs": []
|
|
133
106
|
},
|
|
@@ -151,9 +124,7 @@
|
|
|
151
124
|
"name": "Copilot in VS Code",
|
|
152
125
|
"detect": {
|
|
153
126
|
"binaries": [],
|
|
154
|
-
"homeDirs": [
|
|
155
|
-
"~/.vscode/extensions/github.copilot-chat-*"
|
|
156
|
-
],
|
|
127
|
+
"homeDirs": ["~/.vscode/extensions/github.copilot-chat-*"],
|
|
157
128
|
"projectDirs": []
|
|
158
129
|
},
|
|
159
130
|
"instructions": {
|
|
@@ -175,12 +146,8 @@
|
|
|
175
146
|
"id": "antigravity",
|
|
176
147
|
"name": "Antigravity CLI",
|
|
177
148
|
"detect": {
|
|
178
|
-
"binaries": [
|
|
179
|
-
|
|
180
|
-
],
|
|
181
|
-
"homeDirs": [
|
|
182
|
-
"~/.gemini/antigravity-cli"
|
|
183
|
-
],
|
|
149
|
+
"binaries": ["agy"],
|
|
150
|
+
"homeDirs": ["~/.gemini/antigravity-cli"],
|
|
184
151
|
"projectDirs": []
|
|
185
152
|
},
|
|
186
153
|
"instructions": {
|
|
@@ -202,15 +169,9 @@
|
|
|
202
169
|
"id": "pi",
|
|
203
170
|
"name": "Pi",
|
|
204
171
|
"detect": {
|
|
205
|
-
"binaries": [
|
|
206
|
-
|
|
207
|
-
]
|
|
208
|
-
"homeDirs": [
|
|
209
|
-
"~/.pi/agent"
|
|
210
|
-
],
|
|
211
|
-
"projectDirs": [
|
|
212
|
-
".pi"
|
|
213
|
-
]
|
|
172
|
+
"binaries": ["pi"],
|
|
173
|
+
"homeDirs": ["~/.pi/agent"],
|
|
174
|
+
"projectDirs": [".pi"]
|
|
214
175
|
},
|
|
215
176
|
"instructions": {
|
|
216
177
|
"nativeAgentsMd": true,
|
package/package.json
CHANGED
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/vulcan",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
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
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/VENIZIA-AI/vulcan.git",
|
|
9
|
-
"directory": "packages/cli"
|
|
10
|
-
},
|
|
11
6
|
"bugs": {
|
|
12
7
|
"url": "https://github.com/VENIZIA-AI/vulcan/issues"
|
|
13
8
|
},
|
|
9
|
+
"license": "MIT",
|
|
14
10
|
"author": {
|
|
15
11
|
"name": "VENIZIA AI Developer",
|
|
16
12
|
"email": "developer@venizia.ai",
|
|
17
13
|
"url": "https://venizia.ai"
|
|
18
14
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/VENIZIA-AI/vulcan.git",
|
|
18
|
+
"directory": "packages/cli"
|
|
23
19
|
},
|
|
24
20
|
"bin": {
|
|
25
21
|
"vulcan": "./src/cli.ts"
|
|
26
22
|
},
|
|
27
|
-
"exports": {
|
|
28
|
-
".": "./src/index.ts",
|
|
29
|
-
"./okf": "./src/okf.ts",
|
|
30
|
-
"./package.json": "./package.json"
|
|
31
|
-
},
|
|
32
23
|
"files": [
|
|
33
24
|
"README.md",
|
|
34
25
|
"LICENSE.md",
|
|
@@ -37,6 +28,13 @@
|
|
|
37
28
|
"!**/__tests__",
|
|
38
29
|
"!**/*.tsbuildinfo"
|
|
39
30
|
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"exports": {
|
|
34
|
+
".": "./src/index.ts",
|
|
35
|
+
"./okf": "./src/okf.ts",
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
40
38
|
"publishConfig": {
|
|
41
39
|
"access": "public"
|
|
42
40
|
},
|
|
@@ -46,18 +44,19 @@
|
|
|
46
44
|
},
|
|
47
45
|
"dependencies": {
|
|
48
46
|
"@clack/prompts": "1.8.1",
|
|
49
|
-
"@venizia/vulcan-atlas": "0.3.
|
|
50
|
-
"@venizia/vulcan-okf": "0.3.
|
|
47
|
+
"@venizia/vulcan-atlas": "0.3.12",
|
|
48
|
+
"@venizia/vulcan-okf": "0.3.12",
|
|
51
49
|
"zod": "^4.6.7"
|
|
52
50
|
},
|
|
53
51
|
"devDependencies": {
|
|
54
52
|
"@types/bun": "1.4.3",
|
|
55
53
|
"@venizia/dev-configs": "0.3.5",
|
|
56
54
|
"eslint": "10.13.0",
|
|
57
|
-
"oxfmt": "0.74.0",
|
|
58
55
|
"oxlint": "1.89.0",
|
|
59
56
|
"oxlint-tsgolint": "7.0.2004",
|
|
60
57
|
"typescript": "^6.0.3"
|
|
61
58
|
},
|
|
62
|
-
"
|
|
59
|
+
"engines": {
|
|
60
|
+
"bun": ">=1.4.4"
|
|
61
|
+
}
|
|
63
62
|
}
|
package/src/common/constants.ts
CHANGED
|
@@ -70,7 +70,7 @@ export class ProjectLayout {
|
|
|
70
70
|
'.agents/vulcan.local.json',
|
|
71
71
|
];
|
|
72
72
|
/** What the scaffolded lint configs run; optional peers of dev-configs, so bun never installs them alone. */
|
|
73
|
-
static readonly LINT_TOOLS = ['oxlint', 'oxlint-tsgolint', '
|
|
73
|
+
static readonly LINT_TOOLS = ['oxlint', 'oxlint-tsgolint', 'eslint'];
|
|
74
74
|
/** Written into a scaffolded file the project must fill in; doctor fails the file while it holds this. */
|
|
75
75
|
static readonly SCAFFOLD_MARKER = 'vulcan:scaffold';
|
|
76
76
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `text` as `bun fmt` formats the file named `opts.file` (only the extension and name matter: the
|
|
3
|
+
* text goes in on stdin). A file VULCAN writes this way is what `bun fmt --check` accepts, so a
|
|
4
|
+
* regenerate never turns lint red, and no copy of Bun's rules (key order, array layout) lives here.
|
|
5
|
+
* `--no-script` keeps a `fmt` script from taking over. Bun is the runtime (`engines`), so
|
|
6
|
+
* `process.execPath` is it. When bun fmt fails the text comes back unchanged and the reason is
|
|
7
|
+
* printed: `make lint` flags the file.
|
|
8
|
+
*/
|
|
9
|
+
export const formatWithBun = (opts: { text: string; file: string }): string => {
|
|
10
|
+
const result = Bun.spawnSync(
|
|
11
|
+
[process.execPath, 'fmt', '--no-script', '--stdin-filepath', opts.file],
|
|
12
|
+
{ stdin: Buffer.from(opts.text), stdout: 'pipe', stderr: 'pipe' },
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
if (result.exitCode !== 0) {
|
|
16
|
+
console.error(
|
|
17
|
+
`[formatWithBun] bun fmt exited ${result.exitCode}, ${opts.file} is left as rendered | ${result.stderr.toString().trim()}`,
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return opts.text;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return result.stdout.toString();
|
|
24
|
+
};
|
package/src/common/index.ts
CHANGED
package/src/create/add-app.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { AppSides, CreateFlags } from './common/index.ts';
|
|
|
10
10
|
import type { IAppsBlock, ILocatedPreset, IPresetSpec, TAppSide } from './common/index.ts';
|
|
11
11
|
import { today, writeFile } from './files.ts';
|
|
12
12
|
import { recordedPresetOf } from './lib-preset.ts';
|
|
13
|
+
import { renderManifestJson } from './manifest-json.ts';
|
|
13
14
|
import { menusAvailable, promptSelect } from '../ui/index.ts';
|
|
14
15
|
import { askPresetSpec } from './preset-menu.ts';
|
|
15
16
|
import { ABORTED, confirmWrite, planLines } from './plan.ts';
|
|
@@ -602,7 +603,7 @@ const runAdd = async (opts: { cwd: string; args: string[]; scratch: string }): P
|
|
|
602
603
|
writeFile({
|
|
603
604
|
root: cwd,
|
|
604
605
|
path: 'package.json',
|
|
605
|
-
content:
|
|
606
|
+
content: renderManifestJson({ value: nextManifest }),
|
|
606
607
|
});
|
|
607
608
|
writeFile({ root: cwd, path: configPath, content: nextConfig });
|
|
608
609
|
writeFile({
|
package/src/create/add-lib.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { CreateConstants, CreateFlags } from './common/index.ts';
|
|
|
8
8
|
import type { IAppsBlock, ILocatedPreset, IPresetSpec } from './common/index.ts';
|
|
9
9
|
import { today, writeFile } from './files.ts';
|
|
10
10
|
import { readLibPreset } from './lib-preset.ts';
|
|
11
|
+
import { renderManifestJson } from './manifest-json.ts';
|
|
11
12
|
import type { TLibPreset } from './lib-preset.ts';
|
|
12
13
|
import { ABORTED, confirmWrite, planLines } from './plan.ts';
|
|
13
14
|
import { askInTerminal, readFlag, SCOPE_PATTERN } from './names.ts';
|
|
@@ -275,7 +276,7 @@ export const addLibrary = async (opts: {
|
|
|
275
276
|
writeFile({
|
|
276
277
|
root: cwd,
|
|
277
278
|
path: 'package.json',
|
|
278
|
-
content:
|
|
279
|
+
content: renderManifestJson({ value: nextManifest }),
|
|
279
280
|
});
|
|
280
281
|
writeFile({ root: cwd, path: opts.configPath, content: nextConfig });
|
|
281
282
|
writeFile({
|
package/src/create/bunfig.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The root `bunfig.toml` `init` writes: Bun's telemetry off
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The root `bunfig.toml` `init` writes: Bun's telemetry off, and the `[fmt]` section `bun fmt` reads.
|
|
3
|
+
* The three options are the settings of the shared style (`@venizia/dev-configs`, formerly
|
|
4
|
+
* `oxfmtConfigs`); the rest is Bun's defaults (tab width 2, trailing commas, semicolons, bracket
|
|
5
|
+
* spacing). `flavor = "oxfmt"` pins the oxfmt output: without it `bun fmt` formats like Prettier
|
|
6
|
+
* whenever oxfmt is not a dependency (a union type's first member moves to its own line, for one).
|
|
7
|
+
* No `minimumReleaseAge`: a gate of a few days fails a fresh install whose version floors are the
|
|
8
|
+
* latest releases (measured on a real project: ten packages), so it stays out; Phat's rule is floors
|
|
9
|
+
* at the latest.
|
|
5
10
|
*/
|
|
6
11
|
export const renderBunfig = (): string =>
|
|
7
12
|
[
|
|
8
|
-
'# Bun reads this file
|
|
13
|
+
'# Bun reads this file from the directory a command runs in, and bun fmt also inherits it from a parent.',
|
|
14
|
+
'# So it sits at the root, and [fmt] applies to every folder below it.',
|
|
9
15
|
'telemetry = false',
|
|
10
16
|
'',
|
|
17
|
+
'[fmt]',
|
|
18
|
+
'printWidth = 100',
|
|
19
|
+
'singleQuote = true',
|
|
20
|
+
'arrowParens = "avoid"',
|
|
21
|
+
'flavor = "oxfmt"',
|
|
22
|
+
'',
|
|
11
23
|
].join('\n');
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { formatWithBun } from '../common/index.ts';
|
|
2
|
+
|
|
3
|
+
/** A package.json as `bun fmt` wants it: Bun's own key order (name, version, ... scripts, dependencies A to Z). */
|
|
4
|
+
export const renderManifestJson = (opts: { value: unknown }): string =>
|
|
5
|
+
formatWithBun({ text: `${JSON.stringify(opts.value, null, 2)}\n`, file: 'package.json' });
|
package/src/create/workspace.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { relative, resolve } from 'node:path';
|
|
2
2
|
import { coversFolder } from '../init/index.ts';
|
|
3
3
|
import { CreateConstants } from './common/index.ts';
|
|
4
|
+
import { renderManifestJson } from './manifest-json.ts';
|
|
4
5
|
import type {
|
|
5
6
|
IApp,
|
|
6
7
|
IAppsBlock,
|
|
@@ -15,15 +16,13 @@ const ENV_PORT = /^[A-Z0-9_]*PORT=(\d+)\s*$/m;
|
|
|
15
16
|
/** A newline inside a list item or a paragraph would split it. */
|
|
16
17
|
const oneLine = (opts: { text: string }): string => opts.text.replace(/\s+/g, ' ').trim();
|
|
17
18
|
|
|
18
|
-
const json = (opts: { value: unknown }): string => `${JSON.stringify(opts.value, null, 2)}\n`;
|
|
19
|
-
|
|
20
19
|
export const renderRootManifest = (opts: {
|
|
21
20
|
project: string;
|
|
22
21
|
workspaces: string[];
|
|
23
22
|
catalog: Record<string, string>;
|
|
24
23
|
vulcanVersion: string;
|
|
25
24
|
}): string =>
|
|
26
|
-
|
|
25
|
+
renderManifestJson({
|
|
27
26
|
value: {
|
|
28
27
|
name: opts.project,
|
|
29
28
|
private: true,
|
|
@@ -158,7 +157,7 @@ export const renderAppManifest = (opts: {
|
|
|
158
157
|
preset: IPreset;
|
|
159
158
|
presetPackage: { name: string; version: string };
|
|
160
159
|
}): string =>
|
|
161
|
-
|
|
160
|
+
renderManifestJson({
|
|
162
161
|
value: {
|
|
163
162
|
name: opts.name ?? opts.app,
|
|
164
163
|
version: '0.0.0',
|
|
@@ -195,7 +194,7 @@ export const renderLibManifest = (opts: {
|
|
|
195
194
|
const section = (value: Record<string, unknown>, key: string): Record<string, unknown> =>
|
|
196
195
|
Object.keys(value).length === 0 ? {} : { [key]: value };
|
|
197
196
|
|
|
198
|
-
return
|
|
197
|
+
return renderManifestJson({
|
|
199
198
|
value: {
|
|
200
199
|
name: opts.name,
|
|
201
200
|
version: '0.0.0',
|
|
@@ -264,9 +263,14 @@ export const renderLibConcept = (opts: {
|
|
|
264
263
|
...renderAtlasLookups({ kind: 'lib' }),
|
|
265
264
|
].join('\n');
|
|
266
265
|
|
|
266
|
+
/**
|
|
267
|
+
* The block is JSON that `add` reads back with `JSON.parse`, so `bun fmt` must not rewrite it
|
|
268
|
+
* (it would drop the key quotes): `prettier-ignore` is honoured by both of its flavors.
|
|
269
|
+
*/
|
|
267
270
|
export const renderAppsBlock = (opts: { block: IAppsBlock }): string =>
|
|
268
271
|
[
|
|
269
272
|
CreateConstants.APPS_BLOCK_START,
|
|
273
|
+
'// prettier-ignore',
|
|
270
274
|
`const apps = ${JSON.stringify(opts.block, null, 2)};`,
|
|
271
275
|
CreateConstants.APPS_BLOCK_END,
|
|
272
276
|
].join('\n');
|
package/src/doctor/checks.ts
CHANGED
|
@@ -794,6 +794,127 @@ export const checkDockerignore = (opts: ICheckContext): IViolation[] => {
|
|
|
794
794
|
];
|
|
795
795
|
};
|
|
796
796
|
|
|
797
|
+
const FMT_SECTION_ADVICE =
|
|
798
|
+
'add a [fmt] section (printWidth = 100, singleQuote = true, arrowParens = "avoid", flavor = "oxfmt"): without it bun fmt formats with Bun\'s defaults, not the shared style';
|
|
799
|
+
const FMT_FLAVOR_ADVICE =
|
|
800
|
+
'without it bun fmt formats like Prettier when oxfmt is not a dependency, and the output changes';
|
|
801
|
+
const OXFMT_LOADED_ADVICE =
|
|
802
|
+
'bun fmt loads it and it overrides the [fmt] section of bunfig.toml - delete it, or move its settings to [fmt]';
|
|
803
|
+
|
|
804
|
+
/** The folders that can hold a package.json and an oxfmt config: the root, `packages/*` and every configured package. */
|
|
805
|
+
const formatOwners = (opts: ICheckContext): string[] => [
|
|
806
|
+
...new Set([
|
|
807
|
+
'.',
|
|
808
|
+
...listDirectories({ directory: join(opts.root, 'packages') }).map(name =>
|
|
809
|
+
join('packages', name),
|
|
810
|
+
),
|
|
811
|
+
...resolvePackages({ config: opts.config })
|
|
812
|
+
.filter(entry => !entry.retired)
|
|
813
|
+
.map(entry => relative(opts.root, join(opts.root, entry.path)) || '.'),
|
|
814
|
+
]),
|
|
815
|
+
];
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* `bun fmt` reads the `[fmt]` section of `bunfig.toml`; without it, it formats with Bun's defaults
|
|
819
|
+
* (width 80, double quotes) and rewrites a tree the shared style formatted, and without
|
|
820
|
+
* `flavor = "oxfmt"` it formats like Prettier once oxfmt is not a dependency. A `fmt` script in a
|
|
821
|
+
* `package.json` runs instead of the formatter, and an oxfmt config `bun fmt` finds by itself
|
|
822
|
+
* overrides `[fmt]`; the `oxfmt.config.*` init used to write in `.configs/formatters/` is read by
|
|
823
|
+
* nothing. Warnings, never failures: a project made before `bun fmt` does not start failing.
|
|
824
|
+
*/
|
|
825
|
+
export const checkFormat = (opts: ICheckContext): IViolation[] => {
|
|
826
|
+
const warnings: IViolation[] = [];
|
|
827
|
+
const bunfig = join(opts.root, 'bunfig.toml');
|
|
828
|
+
const bunfigText = readText({ file: bunfig });
|
|
829
|
+
|
|
830
|
+
if (!existsSync(bunfig)) {
|
|
831
|
+
warnings.push(
|
|
832
|
+
createViolation({
|
|
833
|
+
check: DoctorChecks.FORMAT,
|
|
834
|
+
file: 'bunfig.toml',
|
|
835
|
+
message: `missing - ${FMT_SECTION_ADVICE}`,
|
|
836
|
+
}),
|
|
837
|
+
);
|
|
838
|
+
} else if (!DoctorConstants.BUNFIG_FMT_SECTION.test(bunfigText)) {
|
|
839
|
+
warnings.push(
|
|
840
|
+
createViolation({
|
|
841
|
+
check: DoctorChecks.FORMAT,
|
|
842
|
+
file: 'bunfig.toml',
|
|
843
|
+
message: `no [fmt] section - ${FMT_SECTION_ADVICE}`,
|
|
844
|
+
}),
|
|
845
|
+
);
|
|
846
|
+
} else if (!DoctorConstants.BUNFIG_FMT_FLAVOR.test(bunfigText)) {
|
|
847
|
+
warnings.push(
|
|
848
|
+
createViolation({
|
|
849
|
+
check: DoctorChecks.FORMAT,
|
|
850
|
+
file: 'bunfig.toml',
|
|
851
|
+
message: `[fmt] has no flavor = "oxfmt" - ${FMT_FLAVOR_ADVICE}`,
|
|
852
|
+
}),
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
for (const owner of formatOwners(opts)) {
|
|
857
|
+
const manifest = join(owner, 'package.json');
|
|
858
|
+
const formatters = join(owner, '.configs', 'formatters');
|
|
859
|
+
|
|
860
|
+
if (readScriptNames({ file: join(opts.root, manifest) })?.includes('fmt')) {
|
|
861
|
+
warnings.push(
|
|
862
|
+
createViolation({
|
|
863
|
+
check: DoctorChecks.FORMAT,
|
|
864
|
+
file: manifest,
|
|
865
|
+
message:
|
|
866
|
+
'defines a "fmt" script: bun fmt runs it instead of formatting - rename it (the standard names are lint and lint:fix)',
|
|
867
|
+
}),
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const copy = join(owner, 'bunfig.toml');
|
|
872
|
+
|
|
873
|
+
if (
|
|
874
|
+
owner !== '.' &&
|
|
875
|
+
DoctorConstants.BUNFIG_FMT_SECTION.test(readText({ file: join(opts.root, copy) }))
|
|
876
|
+
) {
|
|
877
|
+
warnings.push(
|
|
878
|
+
createViolation({
|
|
879
|
+
check: DoctorChecks.FORMAT,
|
|
880
|
+
file: copy,
|
|
881
|
+
message:
|
|
882
|
+
'a [fmt] copy: bun fmt inherits the root bunfig.toml, and a copy here can drift from it - delete the section',
|
|
883
|
+
}),
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
for (const file of DoctorConstants.OXFMT_AUTOLOADED_FILES) {
|
|
888
|
+
if (existsSync(join(opts.root, owner, file))) {
|
|
889
|
+
warnings.push(
|
|
890
|
+
createViolation({
|
|
891
|
+
check: DoctorChecks.FORMAT,
|
|
892
|
+
file: join(owner, file),
|
|
893
|
+
message: OXFMT_LOADED_ADVICE,
|
|
894
|
+
}),
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
if (existsSync(join(opts.root, formatters))) {
|
|
900
|
+
for (const file of readdirSync(join(opts.root, formatters)).filter(name =>
|
|
901
|
+
DoctorConstants.OXFMT_CONFIG_FILE.test(name),
|
|
902
|
+
)) {
|
|
903
|
+
warnings.push(
|
|
904
|
+
createViolation({
|
|
905
|
+
check: DoctorChecks.FORMAT,
|
|
906
|
+
file: join(formatters, file),
|
|
907
|
+
message:
|
|
908
|
+
'not used any more: bun fmt formats with the [fmt] section of bunfig.toml - delete it',
|
|
909
|
+
}),
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
return warnings;
|
|
916
|
+
};
|
|
917
|
+
|
|
797
918
|
export const checkAtlasBlock = (opts: ICheckContext): IViolation[] => {
|
|
798
919
|
const merged = mergedAtlasBlock({ root: opts.root, config: opts.config });
|
|
799
920
|
|
|
@@ -17,6 +17,7 @@ export class DoctorChecks {
|
|
|
17
17
|
static readonly AGENTS = 'agents';
|
|
18
18
|
static readonly DOCKERIGNORE = 'dockerignore';
|
|
19
19
|
static readonly MCP = 'mcp';
|
|
20
|
+
static readonly FORMAT = 'format';
|
|
20
21
|
static readonly SCHEME_SET = new Set<string>([
|
|
21
22
|
this.CONFIG,
|
|
22
23
|
this.LAYOUT,
|
|
@@ -36,6 +37,7 @@ export class DoctorChecks {
|
|
|
36
37
|
this.AGENTS,
|
|
37
38
|
this.DOCKERIGNORE,
|
|
38
39
|
this.MCP,
|
|
40
|
+
this.FORMAT,
|
|
39
41
|
]);
|
|
40
42
|
static isValid(value: string): boolean {
|
|
41
43
|
return this.SCHEME_SET.has(value);
|
|
@@ -60,11 +62,17 @@ export class DoctorConstants {
|
|
|
60
62
|
static readonly MAKE_INCLUDE_PATTERN =
|
|
61
63
|
/^-?include\s+\S*@venizia\/vulcan\/base\/make\/vulcan\.mk\s*$/m;
|
|
62
64
|
static readonly SHIPPED_HOOKS_PATH = '@venizia/vulcan/base/hooks/';
|
|
63
|
-
|
|
65
|
+
/** The `[fmt]` table header of a `bunfig.toml`, on a line of its own, a trailing comment allowed. */
|
|
66
|
+
static readonly BUNFIG_FMT_SECTION = /^\s*\[fmt\]\s*(#.*)?$/m;
|
|
67
|
+
static readonly BUNFIG_FMT_FLAVOR = /^\s*flavor\s*=\s*["']oxfmt["']/m;
|
|
68
|
+
/** What init wrote before `[fmt]` decided the style; `bun fmt` no longer reads it. */
|
|
69
|
+
static readonly OXFMT_CONFIG_FILE = /^oxfmt\.config\.(mts|ts|mjs|js|cjs)$/;
|
|
70
|
+
/** The oxfmt config names `bun fmt` finds by itself, in a package folder or above it; they override `[fmt]`. */
|
|
71
|
+
static readonly OXFMT_AUTOLOADED_FILES = ['.oxfmtrc.json', '.oxfmtrc.jsonc', 'oxfmt.config.ts'];
|
|
72
|
+
static readonly LINT_CONFIG_FILE = /^(oxlint|eslint)\.config\.(mts|ts|mjs|js|cjs)$/;
|
|
64
73
|
/** Where each tool's config lives under `.configs/`; a file left directly in `.configs/` is told where it belongs. */
|
|
65
74
|
static readonly LINT_CONFIG_FOLDERS: Record<string, string> = {
|
|
66
75
|
oxlint: 'lints',
|
|
67
76
|
eslint: 'lints',
|
|
68
|
-
oxfmt: 'formatters',
|
|
69
77
|
};
|
|
70
78
|
}
|
package/src/doctor/runner.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
checkAtlasBlock,
|
|
8
8
|
checkSkillTriggers,
|
|
9
9
|
checkDockerignore,
|
|
10
|
+
checkFormat,
|
|
10
11
|
checkMcpAtlas,
|
|
11
12
|
checkApps,
|
|
12
13
|
checkManifest,
|
|
@@ -95,5 +96,10 @@ export const runDoctorWarnings = async (opts: { root: string }): Promise<IViolat
|
|
|
95
96
|
configFile: relative(opts.root, loaded.file),
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
return [
|
|
99
|
+
return [
|
|
100
|
+
...checkMcpAtlas(context),
|
|
101
|
+
...checkDockerignore(context),
|
|
102
|
+
...checkSkillTriggers(context),
|
|
103
|
+
...checkFormat(context),
|
|
104
|
+
];
|
|
99
105
|
};
|
package/src/init/scaffold.ts
CHANGED
|
@@ -23,7 +23,6 @@ const SCAFFOLD_FILES: IScaffoldFile[] = [
|
|
|
23
23
|
const LINT_CONFIG_FILES: IScaffoldFile[] = [
|
|
24
24
|
{ path: '.configs/lints/oxlint.config.mts', template: 'oxlint.config.mts' },
|
|
25
25
|
{ path: '.configs/lints/eslint.config.mjs', template: 'eslint.config.mjs' },
|
|
26
|
-
{ path: '.configs/formatters/oxfmt.config.mts', template: 'oxfmt.config.mts' },
|
|
27
26
|
];
|
|
28
27
|
|
|
29
28
|
export interface IScaffoldResult {
|
package/src/manifest/render.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { basename, join } from 'node:path';
|
|
3
|
+
import { formatWithBun } from '../common/index.ts';
|
|
3
4
|
import { resolvePackages } from '../config/index.ts';
|
|
4
5
|
import type { TResolvedConfig } from '../config/index.ts';
|
|
5
6
|
import { readBaseRules } from '../rules/index.ts';
|
|
@@ -85,7 +86,10 @@ export const renderManifest = (opts: { root: string; config: TResolvedConfig }):
|
|
|
85
86
|
...(config.remoteHosts === undefined ? {} : { remoteHosts: config.remoteHosts }),
|
|
86
87
|
};
|
|
87
88
|
|
|
88
|
-
return
|
|
89
|
+
return formatWithBun({
|
|
90
|
+
text: `${JSON.stringify(manifest, null, 2)}\n`,
|
|
91
|
+
file: ManifestConstants.FILE,
|
|
92
|
+
});
|
|
89
93
|
};
|
|
90
94
|
|
|
91
95
|
/**
|