@alexkroman1/aai-cli 15.0.0 → 15.1.0
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/dist/cli.mjs +3 -10
- package/dist/{init-CFyusRbq.mjs → init-CQbj3ycf.mjs} +11 -37
- package/dist/init.d.ts +5 -10
- package/dist/scaffold/package.json +4 -4
- package/package.json +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -695,24 +695,17 @@ const init = defineExec({
|
|
|
695
695
|
alias: "t",
|
|
696
696
|
description: "Template to use (prompted when omitted)"
|
|
697
697
|
},
|
|
698
|
-
server: sharedArgs.server,
|
|
699
698
|
yes: sharedArgs.yes,
|
|
700
|
-
json: sharedArgs.json
|
|
701
|
-
skipDeploy: {
|
|
702
|
-
type: "boolean",
|
|
703
|
-
description: "Skip deploy after scaffolding"
|
|
704
|
-
}
|
|
699
|
+
json: sharedArgs.json
|
|
705
700
|
},
|
|
706
701
|
cwd: "none",
|
|
707
702
|
async run({ args, mode }) {
|
|
708
|
-
const { executeInit } = await import("./init-
|
|
703
|
+
const { executeInit } = await import("./init-CQbj3ycf.mjs");
|
|
709
704
|
return executeInit({
|
|
710
705
|
dir: args.dir,
|
|
711
706
|
force: args.force,
|
|
712
707
|
template: args.template,
|
|
713
|
-
yes: mode === "json" ? true : args.yes
|
|
714
|
-
skipDeploy: args.skipDeploy,
|
|
715
|
-
server: args.server
|
|
708
|
+
yes: mode === "json" ? true : args.yes
|
|
716
709
|
}, mode === "json" ? { silent: true } : void 0);
|
|
717
710
|
}
|
|
718
711
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as ok } from "./_output-DBP9Op_d.mjs";
|
|
3
3
|
import { n as log, s as unwrapCancel } from "./_ui-DCt4qZrk.mjs";
|
|
4
|
-
import { c as fileExists, d as readJson, p as resolveCwd, s as errorMessage
|
|
4
|
+
import { c as fileExists, d as readJson, p as resolveCwd, s as errorMessage, t as AGENT_ENTRY } from "./_utils-D5JGcjiW.mjs";
|
|
5
5
|
import { r as isDevMode, t as getMonorepoRoot } from "./_agent-BzUeqOdj.mjs";
|
|
6
6
|
import { listTemplates } from "./_templates-CIlJ3Vay.mjs";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import { omitUndefined } from "@alexkroman1/aai/utils";
|
|
9
8
|
import { styleText } from "node:util";
|
|
10
9
|
import * as p from "@clack/prompts";
|
|
11
10
|
import { execa } from "execa";
|
|
@@ -109,9 +108,14 @@ async function runPnpmInstall(cwd) {
|
|
|
109
108
|
const pnpmArgs = isDevMode() ? ["install"] : ["install", "--ignore-workspace"];
|
|
110
109
|
await execa(cmd, [...args, ...pnpmArgs], { cwd });
|
|
111
110
|
}
|
|
112
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Install deps with pnpm, reporting a failure through `warn` rather than
|
|
113
|
+
* throwing: the project is scaffolded either way, and the two warnings say how
|
|
114
|
+
* to finish the install by hand. Nothing downstream branches on the outcome —
|
|
115
|
+
* `init` stops here — so it returns nothing.
|
|
116
|
+
*/
|
|
113
117
|
async function installDeps(cwd, warn, silent) {
|
|
114
|
-
if (!await hasDeps(cwd)) return
|
|
118
|
+
if (!await hasDeps(cwd)) return;
|
|
115
119
|
await ensurePnpm();
|
|
116
120
|
try {
|
|
117
121
|
await withSpinner(silent, {
|
|
@@ -119,11 +123,9 @@ async function installDeps(cwd, warn, silent) {
|
|
|
119
123
|
done: "Dependencies installed",
|
|
120
124
|
failed: "Dependency install failed"
|
|
121
125
|
}, () => runPnpmInstall(cwd));
|
|
122
|
-
return true;
|
|
123
126
|
} catch (err) {
|
|
124
|
-
warn(`pnpm install failed: ${errorMessage
|
|
127
|
+
warn(`pnpm install failed: ${errorMessage(err)}`);
|
|
125
128
|
warn("Install pnpm (`npm install -g pnpm`), then run `pnpm install` in the project.");
|
|
126
|
-
return false;
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
/** Resolve target directory relative to the user's current directory. */
|
|
@@ -140,27 +142,6 @@ function collectWarnings() {
|
|
|
140
142
|
}
|
|
141
143
|
};
|
|
142
144
|
}
|
|
143
|
-
/** Publish after init and return deploy metadata if successful. */
|
|
144
|
-
async function tryPublish(cwd, server, warn) {
|
|
145
|
-
const { executePublish } = await import("./studio-C_zuRC_z.mjs");
|
|
146
|
-
try {
|
|
147
|
-
const result = await executePublish({
|
|
148
|
-
cwd,
|
|
149
|
-
...omitUndefined({ server })
|
|
150
|
-
});
|
|
151
|
-
if (result.ok) return {
|
|
152
|
-
slug: result.data.slug,
|
|
153
|
-
url: result.data.url,
|
|
154
|
-
studioUrl: result.data.studioUrl
|
|
155
|
-
};
|
|
156
|
-
warn(`Publish failed: ${result.error}`);
|
|
157
|
-
return null;
|
|
158
|
-
} catch (err) {
|
|
159
|
-
warn(`Publish failed: ${errorMessage$1(err)}`);
|
|
160
|
-
warn("Your project was still created — run `aai publish` in it to retry.");
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
145
|
/** Scaffold the project, optionally showing a spinner. */
|
|
165
146
|
async function scaffoldProject(dir, cwd, template, silent) {
|
|
166
147
|
const { runInit } = await import("./_init-Bsi3DZNJ.mjs");
|
|
@@ -189,19 +170,12 @@ async function executeInit(opts, extra) {
|
|
|
189
170
|
const template = opts.template ?? (opts.yes || suppressUi ? DEFAULT_TEMPLATE : await promptTemplate());
|
|
190
171
|
const { warn, warnings } = collectWarnings();
|
|
191
172
|
await scaffoldProject(dir, cwd, template, suppressUi);
|
|
192
|
-
|
|
193
|
-
if (!installed) warn("Skipping publish because dependencies were not installed.");
|
|
194
|
-
const published = installed && !opts.skipDeploy ? await tryPublish(cwd, opts.server, warn) : null;
|
|
173
|
+
await installDeps(cwd, warn, suppressUi);
|
|
195
174
|
if (!suppressUi) printPostInitInfo(cwd, monorepoRoot);
|
|
196
175
|
const data = {
|
|
197
176
|
dir: cwd,
|
|
198
|
-
template
|
|
199
|
-
deployed: published !== null
|
|
177
|
+
template
|
|
200
178
|
};
|
|
201
|
-
if (published) {
|
|
202
|
-
data.slug = published.slug;
|
|
203
|
-
data.url = published.url;
|
|
204
|
-
}
|
|
205
179
|
if (warnings.length > 0) data.warnings = warnings;
|
|
206
180
|
return ok(data);
|
|
207
181
|
}
|
package/dist/init.d.ts
CHANGED
|
@@ -2,18 +2,15 @@ import { type CommandResult } from "./_output.ts";
|
|
|
2
2
|
type InitData = {
|
|
3
3
|
dir: string;
|
|
4
4
|
template: string;
|
|
5
|
-
deployed: boolean;
|
|
6
|
-
slug?: string;
|
|
7
|
-
url?: string;
|
|
8
5
|
/**
|
|
9
|
-
* Diagnostics a human sees as `log.warn` lines
|
|
10
|
-
*
|
|
6
|
+
* Diagnostics a human sees as `log.warn` lines — today only a failed
|
|
7
|
+
* `pnpm install`.
|
|
11
8
|
*
|
|
12
9
|
* They have to ride the result for the same reason `PushOutcome.warnings`
|
|
13
10
|
* does — `log.warn` is silenced in JSON mode and JSON mode is AUTO-DETECTED
|
|
14
|
-
* on a pipe, so a scripted `aai init` was told `{ ok: true
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* on a pipe, so a scripted `aai init` was told `{ ok: true }` for a project
|
|
12
|
+
* whose dependencies never installed and could not tell that apart from a
|
|
13
|
+
* clean run.
|
|
17
14
|
*/
|
|
18
15
|
warnings?: string[];
|
|
19
16
|
};
|
|
@@ -41,8 +38,6 @@ export declare function executeInit(opts: {
|
|
|
41
38
|
force?: boolean | undefined;
|
|
42
39
|
template?: string | undefined;
|
|
43
40
|
yes?: boolean | undefined;
|
|
44
|
-
skipDeploy?: boolean | undefined;
|
|
45
|
-
server?: string | undefined;
|
|
46
41
|
}, extra?: {
|
|
47
42
|
silent?: boolean | undefined;
|
|
48
43
|
}): Promise<CommandResult<InitData>>;
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"publish:agent": "aai publish"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alexkroman1/aai": "^15.
|
|
19
|
-
"@alexkroman1/aai-cli": "^15.
|
|
20
|
-
"@alexkroman1/aai-runtime": "^15.
|
|
21
|
-
"@alexkroman1/aai-ui": "^15.
|
|
18
|
+
"@alexkroman1/aai": "^15.1.0",
|
|
19
|
+
"@alexkroman1/aai-cli": "^15.1.0",
|
|
20
|
+
"@alexkroman1/aai-runtime": "^15.1.0",
|
|
21
|
+
"@alexkroman1/aai-ui": "^15.1.0",
|
|
22
22
|
"react": "^19.2.8",
|
|
23
23
|
"react-dom": "^19.2.8",
|
|
24
24
|
"tailwindcss": "^4.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai-cli",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"p-timeout": "^7.0.1",
|
|
58
58
|
"vite": "^8.2.2",
|
|
59
59
|
"zod": "^4.5.4",
|
|
60
|
-
"@alexkroman1/aai": "15.
|
|
61
|
-
"@alexkroman1/aai-runtime": "15.
|
|
62
|
-
"@alexkroman1/aai-ui": "15.
|
|
60
|
+
"@alexkroman1/aai": "15.1.0",
|
|
61
|
+
"@alexkroman1/aai-runtime": "15.1.0",
|
|
62
|
+
"@alexkroman1/aai-ui": "15.1.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"playwright": "^1.62.1",
|