@venizia/vulcan 0.3.10 → 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/commands/help.command.ts +5 -3
- 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 +25 -3
- package/src/create/add-lib.ts +3 -3
- package/src/create/bunfig.ts +16 -4
- package/src/create/init-monorepo.ts +30 -4
- package/src/create/manifest-json.ts +5 -0
- package/src/create/names.ts +34 -0
- package/src/create/workspace.ts +12 -6
- 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/src/router.ts +1 -0
- 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
|
}
|
|
@@ -6,13 +6,15 @@ Usage: bun x vulcan <command>
|
|
|
6
6
|
|
|
7
7
|
init [--config ts|mts|mjs|js] Scaffold the project layer (never overwrites)
|
|
8
8
|
init --preset <name|file:path> --project <name> --app <name> [--backend-dir|--frontend-dir <name>]
|
|
9
|
-
[--shared-dir <name>]
|
|
9
|
+
[--shared-dir <name>] [--scope <@scope>]
|
|
10
|
+
Create a monorepo with its first app, from a framework preset
|
|
10
11
|
(a name missing from the flags is asked in a terminal)
|
|
11
12
|
add --preset <name|file:path> (--app <name> | --lib <name>) [--dir <folder>] [--scope <@scope>]
|
|
12
13
|
[--backend-dir|--frontend-dir <name>] [--api <app> | --no-api]
|
|
13
14
|
Add an app or a shared library to the monorepo (a frontend says which
|
|
14
|
-
backend to proxy to; --dir
|
|
15
|
-
|
|
15
|
+
backend to proxy to; --dir is for a library; --scope names the package
|
|
16
|
+
@scope/<name>, for an app or a library; a terminal asks for the kind
|
|
17
|
+
and every name the flags leave out)
|
|
16
18
|
sync [--agents <list>|list] [--dry-run] [--prune]
|
|
17
19
|
Write the adapters of the agents you chose (--agents claude,omp or none,
|
|
18
20
|
stored in .agents/vulcan.local.json; --agents list shows the table);
|
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,14 +10,17 @@ 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';
|
|
16
17
|
import {
|
|
17
18
|
askInTerminal,
|
|
19
|
+
askScope,
|
|
18
20
|
askWithPrompt,
|
|
19
21
|
nameProblem,
|
|
20
22
|
readFlag,
|
|
23
|
+
readScope,
|
|
21
24
|
resolveNames,
|
|
22
25
|
SIDE_FIELDS,
|
|
23
26
|
} from './names.ts';
|
|
@@ -329,6 +332,12 @@ const runAdd = async (opts: { cwd: string; args: string[]; scratch: string }): P
|
|
|
329
332
|
return fail({ message: `${CreateFlags.APP} and ${CreateFlags.LIB} cannot be used together` });
|
|
330
333
|
}
|
|
331
334
|
|
|
335
|
+
const flaggedScope = readScope({ args: opts.args });
|
|
336
|
+
|
|
337
|
+
if (!flaggedScope.ok) {
|
|
338
|
+
return fail({ message: flaggedScope.error });
|
|
339
|
+
}
|
|
340
|
+
|
|
332
341
|
if (libFlag && libName === undefined) {
|
|
333
342
|
return fail({ message: `${CreateFlags.LIB} needs a name` });
|
|
334
343
|
}
|
|
@@ -452,9 +461,20 @@ const runAdd = async (opts: { cwd: string; args: string[]; scratch: string }): P
|
|
|
452
461
|
});
|
|
453
462
|
}
|
|
454
463
|
|
|
464
|
+
// Optional, asked only where menus are drawn; a plain terminal and a script give --scope.
|
|
465
|
+
const scope = flaggedScope.scope ?? (menusAvailable() ? await askScope() : undefined);
|
|
466
|
+
|
|
467
|
+
if (scope === null) {
|
|
468
|
+
return fail({ message: ABORTED });
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const packageOfApp = scope === undefined ? app : `${scope}/${app}`;
|
|
455
472
|
const packages = resolvePackages({ config });
|
|
456
473
|
|
|
457
|
-
if (
|
|
474
|
+
if (
|
|
475
|
+
existsSync(join(cwd, folder, app)) ||
|
|
476
|
+
packages.some(entry => entry.dir === app || entry.name === packageOfApp)
|
|
477
|
+
) {
|
|
458
478
|
return fail({ message: `${folder}/${app} already exists` });
|
|
459
479
|
}
|
|
460
480
|
|
|
@@ -478,7 +498,7 @@ const runAdd = async (opts: { cwd: string; args: string[]; scratch: string }): P
|
|
|
478
498
|
}
|
|
479
499
|
|
|
480
500
|
const source = readFileSync(loaded.file, 'utf8');
|
|
481
|
-
const entry = { dir: app, name:
|
|
501
|
+
const entry = { dir: app, name: packageOfApp, path: `${folder}/${app}` };
|
|
482
502
|
const knownSources = new Set(config.atlas.sources.map(known => known.name));
|
|
483
503
|
const newSources = preset.atlas.filter(candidate => !knownSources.has(candidate.name));
|
|
484
504
|
const parsed = parseAppsBlock({ source });
|
|
@@ -538,6 +558,7 @@ const runAdd = async (opts: { cwd: string; args: string[]; scratch: string }): P
|
|
|
538
558
|
lines: planLines({
|
|
539
559
|
rows: [
|
|
540
560
|
['app', `${folder}/${app}`],
|
|
561
|
+
...(scope === undefined ? [] : [['package', packageOfApp] as [string, string]]),
|
|
541
562
|
['side', side],
|
|
542
563
|
['preset', `${packageName} ${packageVersion}`],
|
|
543
564
|
['port', String(devPort)],
|
|
@@ -562,6 +583,7 @@ const runAdd = async (opts: { cwd: string; args: string[]; scratch: string }): P
|
|
|
562
583
|
path: `${folder}/${app}/package.json`,
|
|
563
584
|
content: renderAppManifest({
|
|
564
585
|
app,
|
|
586
|
+
name: packageOfApp,
|
|
565
587
|
preset,
|
|
566
588
|
presetPackage: { name: packageName, version: packageVersion },
|
|
567
589
|
}),
|
|
@@ -581,7 +603,7 @@ const runAdd = async (opts: { cwd: string; args: string[]; scratch: string }): P
|
|
|
581
603
|
writeFile({
|
|
582
604
|
root: cwd,
|
|
583
605
|
path: 'package.json',
|
|
584
|
-
content:
|
|
606
|
+
content: renderManifestJson({ value: nextManifest }),
|
|
585
607
|
});
|
|
586
608
|
writeFile({ root: cwd, path: configPath, content: nextConfig });
|
|
587
609
|
writeFile({
|
package/src/create/add-lib.ts
CHANGED
|
@@ -8,9 +8,10 @@ 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
|
-
import { askInTerminal, readFlag } from './names.ts';
|
|
14
|
+
import { askInTerminal, readFlag, SCOPE_PATTERN } from './names.ts';
|
|
14
15
|
import { copyPresetFiles } from './preset.ts';
|
|
15
16
|
import { runBun } from './process.ts';
|
|
16
17
|
import {
|
|
@@ -26,7 +27,6 @@ import {
|
|
|
26
27
|
} from './workspace.ts';
|
|
27
28
|
|
|
28
29
|
const KNOWLEDGE_DIRECTORY = '.agents/knowledge';
|
|
29
|
-
const SCOPE_PATTERN = /^@[a-z0-9][a-z0-9-]*$/;
|
|
30
30
|
const DIRECTORY_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
31
31
|
|
|
32
32
|
const fail = (opts: { message: string }): number => {
|
|
@@ -276,7 +276,7 @@ export const addLibrary = async (opts: {
|
|
|
276
276
|
writeFile({
|
|
277
277
|
root: cwd,
|
|
278
278
|
path: 'package.json',
|
|
279
|
-
content:
|
|
279
|
+
content: renderManifestJson({ value: nextManifest }),
|
|
280
280
|
});
|
|
281
281
|
writeFile({ root: cwd, path: opts.configPath, content: nextConfig });
|
|
282
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');
|
|
@@ -18,7 +18,15 @@ import { renderDockerignore } from './dockerignore.ts';
|
|
|
18
18
|
import { menusAvailable } from '../ui/index.ts';
|
|
19
19
|
import { askPresetSpec } from './preset-menu.ts';
|
|
20
20
|
import { ABORTED, confirmWrite, planLines } from './plan.ts';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
askInTerminal,
|
|
23
|
+
askScope,
|
|
24
|
+
findFolderClash,
|
|
25
|
+
readFlag,
|
|
26
|
+
readScope,
|
|
27
|
+
resolveNames,
|
|
28
|
+
SIDE_FIELDS,
|
|
29
|
+
} from './names.ts';
|
|
22
30
|
import { copyPresetFiles, locatePreset, parsePresetSpec } from './preset.ts';
|
|
23
31
|
import { renderNext } from './next.ts';
|
|
24
32
|
import { isInstallSkipped, runBun, runGitInit } from './process.ts';
|
|
@@ -81,9 +89,12 @@ const writeMonorepo = (opts: {
|
|
|
81
89
|
located: ILocatedPreset;
|
|
82
90
|
folder: string;
|
|
83
91
|
app: string;
|
|
92
|
+
/** `@scope` for the app's package name; the folder stays bare. */
|
|
93
|
+
scope: string | undefined;
|
|
84
94
|
shared: string;
|
|
85
95
|
}): void => {
|
|
86
|
-
const { root, project, spec, presetValue, located, folder, app, shared } = opts;
|
|
96
|
+
const { root, project, spec, presetValue, located, folder, app, shared, scope } = opts;
|
|
97
|
+
const packageOfApp = scope === undefined ? app : `${scope}/${app}`;
|
|
87
98
|
const { preset, packageName, packageVersion } = located;
|
|
88
99
|
const side = preset.side;
|
|
89
100
|
const catalog = {
|
|
@@ -138,6 +149,7 @@ const writeMonorepo = (opts: {
|
|
|
138
149
|
path: `${folder}/${app}/package.json`,
|
|
139
150
|
content: renderAppManifest({
|
|
140
151
|
app,
|
|
152
|
+
name: packageOfApp,
|
|
141
153
|
preset,
|
|
142
154
|
presetPackage: { name: packageName, version: packageVersion },
|
|
143
155
|
}),
|
|
@@ -155,7 +167,7 @@ const writeMonorepo = (opts: {
|
|
|
155
167
|
|
|
156
168
|
const block: IAppsBlock = {
|
|
157
169
|
layout: { [side]: folder, ...(shared === '' ? {} : { shared }) },
|
|
158
|
-
packages: [{ dir: app, name:
|
|
170
|
+
packages: [{ dir: app, name: packageOfApp, path: `${folder}/${app}` }],
|
|
159
171
|
presets: [
|
|
160
172
|
recordedPresetOf({
|
|
161
173
|
spec: presetSpecOf({ value: presetValue, root, cwd: dirname(root) }),
|
|
@@ -212,6 +224,12 @@ const runCreate = async (opts: {
|
|
|
212
224
|
return fail({ message: '--preset needs a value (a package name, or file:<path>)' });
|
|
213
225
|
}
|
|
214
226
|
|
|
227
|
+
const flaggedScope = readScope({ args: opts.args });
|
|
228
|
+
|
|
229
|
+
if (!flaggedScope.ok) {
|
|
230
|
+
return fail({ message: flaggedScope.error });
|
|
231
|
+
}
|
|
232
|
+
|
|
215
233
|
const spec = parsePresetSpec({ value: presetValue, cwd: opts.cwd });
|
|
216
234
|
const interactive = process.stdin.isTTY === true;
|
|
217
235
|
const first = await resolveNames({
|
|
@@ -313,6 +331,13 @@ const runCreate = async (opts: {
|
|
|
313
331
|
return fail({ message: clash });
|
|
314
332
|
}
|
|
315
333
|
|
|
334
|
+
// Optional, asked only where menus are drawn; a plain terminal and a script give --scope.
|
|
335
|
+
const scope = flaggedScope.scope ?? (menusAvailable() ? await askScope() : undefined);
|
|
336
|
+
|
|
337
|
+
if (scope === null) {
|
|
338
|
+
return fail({ message: ABORTED });
|
|
339
|
+
}
|
|
340
|
+
|
|
316
341
|
const warning = filePresetWarning({
|
|
317
342
|
spec,
|
|
318
343
|
packageName: located.packageName,
|
|
@@ -329,6 +354,7 @@ const runCreate = async (opts: {
|
|
|
329
354
|
['project', project],
|
|
330
355
|
['preset', `${located.packageName} ${located.packageVersion}`],
|
|
331
356
|
[`${side} app`, `${folder}/${app}`],
|
|
357
|
+
...(scope === undefined ? [] : [['package', `${scope}/${app}`] as [string, string]]),
|
|
332
358
|
['shared', shared === '' ? '(none)' : shared],
|
|
333
359
|
],
|
|
334
360
|
}),
|
|
@@ -338,7 +364,7 @@ const runCreate = async (opts: {
|
|
|
338
364
|
return fail({ message: ABORTED });
|
|
339
365
|
}
|
|
340
366
|
|
|
341
|
-
writeMonorepo({ root, project, spec, presetValue, located, folder, app, shared });
|
|
367
|
+
writeMonorepo({ root, project, spec, presetValue, located, folder, app, scope, shared });
|
|
342
368
|
|
|
343
369
|
for (const step of [
|
|
344
370
|
() => runBun({ cwd: root, args: ['install'], label: 'bun install' }),
|
|
@@ -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/names.ts
CHANGED
|
@@ -25,12 +25,46 @@ export const SIDE_FIELDS: Record<TAppSide, INameField> = {
|
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/** `@acme`: what `--scope` takes, for a library and for an app. */
|
|
29
|
+
export const SCOPE_PATTERN = /^@[a-z0-9][a-z0-9-]*$/;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The optional scope question of a menu: a package scope typed, or nothing for a bare name. Asked only
|
|
33
|
+
* where menus are drawn; a plain terminal and a script give `--scope`. `null` is a cancel.
|
|
34
|
+
*/
|
|
35
|
+
export const askScope = async (): Promise<string | undefined | null> => {
|
|
36
|
+
const answer = await promptText({
|
|
37
|
+
message: 'Package scope (optional, like @acme; empty for none)',
|
|
38
|
+
validate: value =>
|
|
39
|
+
value.trim() === '' || SCOPE_PATTERN.test(value.trim())
|
|
40
|
+
? undefined
|
|
41
|
+
: `'${value.trim()}' is not a scope like @acme`,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return answer === null ? null : answer.trim() === '' ? undefined : answer.trim();
|
|
45
|
+
};
|
|
46
|
+
|
|
28
47
|
export const readFlag = (opts: { args: string[]; flag: string }): string | undefined => {
|
|
29
48
|
const index = opts.args.indexOf(opts.flag);
|
|
30
49
|
|
|
31
50
|
return index === -1 ? undefined : opts.args[index + 1];
|
|
32
51
|
};
|
|
33
52
|
|
|
53
|
+
/** The scope the flag names, validated: none when absent, an error that names the flag when it is not `@scope`. */
|
|
54
|
+
export const readScope = (opts: {
|
|
55
|
+
args: string[];
|
|
56
|
+
}): { ok: true; scope: string | undefined } | { ok: false; error: string } => {
|
|
57
|
+
const given = readFlag({ args: opts.args, flag: CreateFlags.SCOPE });
|
|
58
|
+
|
|
59
|
+
if (given === undefined) {
|
|
60
|
+
return { ok: true, scope: undefined };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return SCOPE_PATTERN.test(given)
|
|
64
|
+
? { ok: true, scope: given }
|
|
65
|
+
: { ok: false, error: `${CreateFlags.SCOPE} '${given}' is not a scope like @acme` };
|
|
66
|
+
};
|
|
67
|
+
|
|
34
68
|
const isValidName = (opts: { name: string }): boolean =>
|
|
35
69
|
CreateConstants.NAME_PATTERN.test(opts.name);
|
|
36
70
|
|
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,
|
|
@@ -153,12 +152,14 @@ const toCatalog = (opts: { dependencies: Record<string, string> }): Record<strin
|
|
|
153
152
|
|
|
154
153
|
export const renderAppManifest = (opts: {
|
|
155
154
|
app: string;
|
|
155
|
+
/** The package name when it is not the app name: `@scope/<app>`. */
|
|
156
|
+
name?: string;
|
|
156
157
|
preset: IPreset;
|
|
157
158
|
presetPackage: { name: string; version: string };
|
|
158
159
|
}): string =>
|
|
159
|
-
|
|
160
|
+
renderManifestJson({
|
|
160
161
|
value: {
|
|
161
|
-
name: opts.app,
|
|
162
|
+
name: opts.name ?? opts.app,
|
|
162
163
|
version: '0.0.0',
|
|
163
164
|
private: true,
|
|
164
165
|
// The preset's own text: no token is replaced here, a path pattern has no use for one.
|
|
@@ -193,7 +194,7 @@ export const renderLibManifest = (opts: {
|
|
|
193
194
|
const section = (value: Record<string, unknown>, key: string): Record<string, unknown> =>
|
|
194
195
|
Object.keys(value).length === 0 ? {} : { [key]: value };
|
|
195
196
|
|
|
196
|
-
return
|
|
197
|
+
return renderManifestJson({
|
|
197
198
|
value: {
|
|
198
199
|
name: opts.name,
|
|
199
200
|
version: '0.0.0',
|
|
@@ -262,9 +263,14 @@ export const renderLibConcept = (opts: {
|
|
|
262
263
|
...renderAtlasLookups({ kind: 'lib' }),
|
|
263
264
|
].join('\n');
|
|
264
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
|
+
*/
|
|
265
270
|
export const renderAppsBlock = (opts: { block: IAppsBlock }): string =>
|
|
266
271
|
[
|
|
267
272
|
CreateConstants.APPS_BLOCK_START,
|
|
273
|
+
'// prettier-ignore',
|
|
268
274
|
`const apps = ${JSON.stringify(opts.block, null, 2)};`,
|
|
269
275
|
CreateConstants.APPS_BLOCK_END,
|
|
270
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
|
/**
|
package/src/router.ts
CHANGED