@venizia/vulcan 0.4.10-13 → 0.4.10-15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/vulcan",
|
|
3
|
-
"version": "0.4.10-
|
|
3
|
+
"version": "0.4.10-15",
|
|
4
4
|
"description": "VULCAN - one setup, one workflow for every project: init, sync, doctor, upgrade, and `vulcan x` for the shipped tools. Bun-only.",
|
|
5
5
|
"homepage": "https://github.com/VENIZIA-AI/vulcan/tree/main/packages/cli",
|
|
6
6
|
"bugs": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@clack/prompts": "1.8.1",
|
|
48
|
-
"@venizia/vulcan-atlas": "0.4.10-
|
|
49
|
-
"@venizia/vulcan-okf": "0.4.10-
|
|
48
|
+
"@venizia/vulcan-atlas": "0.4.10-15",
|
|
49
|
+
"@venizia/vulcan-okf": "0.4.10-15",
|
|
50
50
|
"zod": "^4.6.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -1,18 +1,71 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
1
3
|
import { ExitCodes } from '../common/index.ts';
|
|
2
4
|
import type { ICommandContext } from '../common/index.ts';
|
|
5
|
+
import { ConfigLoader } from '../config/index.ts';
|
|
3
6
|
import { runXCommand } from './x.command.ts';
|
|
4
7
|
|
|
5
8
|
const SUBCOMMANDS = new Set(['plan', 'apply']);
|
|
6
9
|
|
|
10
|
+
/**
|
|
11
|
+
* The project a folder belongs to: the nearest folder at or above `cwd` that has a VULCAN config, never
|
|
12
|
+
* above the git work tree root (a config of an unrelated parent is not this project's). `undefined` when
|
|
13
|
+
* there is none, so the folder is served as it is and atlas says there is nothing to serve.
|
|
14
|
+
*/
|
|
15
|
+
const enclosingProjectOf = (opts: { cwd: string }): string | undefined => {
|
|
16
|
+
let directory = opts.cwd;
|
|
17
|
+
|
|
18
|
+
for (;;) {
|
|
19
|
+
if (ConfigLoader.findFile({ root: directory }) !== undefined) {
|
|
20
|
+
return directory;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const parent = dirname(directory);
|
|
24
|
+
|
|
25
|
+
if (existsSync(join(directory, '.git')) || parent === directory) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
directory = parent;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** `--app` made absolute against the folder the command was run in, and added (as that folder) when absent. */
|
|
34
|
+
const withApp = (opts: { args: string[]; cwd: string }): string[] => {
|
|
35
|
+
const args = [...opts.args];
|
|
36
|
+
const at = args.findIndex((arg) => arg === '--app' || arg.startsWith('--app='));
|
|
37
|
+
|
|
38
|
+
if (at === -1) {
|
|
39
|
+
return [...args, '--app', opts.cwd];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (args[at] === '--app') {
|
|
43
|
+
args[at + 1] = resolve(opts.cwd, args[at + 1] ?? '');
|
|
44
|
+
} else {
|
|
45
|
+
args[at] = `--app=${resolve(opts.cwd, args[at].slice('--app='.length))}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return args;
|
|
49
|
+
};
|
|
50
|
+
|
|
7
51
|
/** `vulcan migrate plan|apply`: atlas's `migrate` run at the pinned version, over the sources this project serves. */
|
|
8
52
|
export const runMigrateCommand = (opts: ICommandContext): Promise<number> => {
|
|
9
53
|
if (!SUBCOMMANDS.has(opts.args[0] ?? '')) {
|
|
10
54
|
process.stderr.write(
|
|
11
|
-
'usage: vulcan migrate plan [--package <name>] [--from <version>] --to <version|latest|next> [--app <dir>] [--format md|json]\n vulcan migrate apply [--package <name>] [--from <version>] --to <version|latest|next> [--app <dir>] [--force]\n',
|
|
55
|
+
'usage: vulcan migrate plan [--package <name>] [--from <version>] --to <version|latest|next> [--app <dir>] [--format md|json] [--verbose]\n vulcan migrate apply [--package <name>] [--from <version>] --to <version|latest|next> [--app <dir>] [--force]\n',
|
|
12
56
|
);
|
|
13
57
|
|
|
14
58
|
return Promise.resolve(ExitCodes.USAGE);
|
|
15
59
|
}
|
|
16
60
|
|
|
17
|
-
|
|
61
|
+
const project = enclosingProjectOf({ cwd: opts.cwd });
|
|
62
|
+
|
|
63
|
+
// Run in the project that has the config; the app is the folder the command was run in unless `--app` says otherwise.
|
|
64
|
+
return project === undefined || project === opts.cwd
|
|
65
|
+
? runXCommand({ ...opts, args: ['atlas', 'migrate', ...opts.args] })
|
|
66
|
+
: runXCommand({
|
|
67
|
+
...opts,
|
|
68
|
+
cwd: project,
|
|
69
|
+
args: ['atlas', 'migrate', ...withApp({ args: opts.args, cwd: opts.cwd })],
|
|
70
|
+
});
|
|
18
71
|
};
|
package/src/commands/table.ts
CHANGED
|
@@ -270,7 +270,7 @@ export class CommandTable {
|
|
|
270
270
|
'0 when every entry conforms; 1 when an entry does not, the tool is missing or the configuration is invalid; 2 for a subcommand other than check.',
|
|
271
271
|
},
|
|
272
272
|
[VulcanCommands.MIGRATE]: {
|
|
273
|
-
help: ` migrate plan [--package <name>] [--from <version>] --to <version|latest|next> [--app <dir>] [--format md|json]
|
|
273
|
+
help: ` migrate plan [--package <name>] [--from <version>] --to <version|latest|next> [--app <dir>] [--format md|json] [--verbose]
|
|
274
274
|
What an app must change to move a package between two releases, newer or
|
|
275
275
|
older: the steps in order, the places in your code they touch (file:line),
|
|
276
276
|
codemods and data warnings; read only
|
|
@@ -288,6 +288,7 @@ export class CommandTable {
|
|
|
288
288
|
},
|
|
289
289
|
flags: {
|
|
290
290
|
'--force': 'apply: run on an app with uncommitted changes, or outside git',
|
|
291
|
+
'--verbose': 'plan: list every place that imports a module a step is about, not a count',
|
|
291
292
|
},
|
|
292
293
|
positionals: 1,
|
|
293
294
|
unknownExit: ExitCodes.USAGE,
|