@alexkroman1/aai-cli 3.2.0 → 4.0.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/{_agent-4rsUGPhx.mjs → _agent-dJAeDb38.mjs} +1 -1
- package/dist/{_config-BWYgLjiI.mjs → _config-B7Ywbpfb.mjs} +4 -20
- package/dist/{_dev-server-C8lcQOXt.mjs → _dev-server-DvcbFgos.mjs} +2 -2
- package/dist/{_init-C3xJKK3L.mjs → _init-B-Fd6Lm4.mjs} +3 -5
- package/dist/{_server-common-Bv-4Rskq.mjs → _server-common-CpVD57yn.mjs} +9 -3
- package/dist/cli.mjs +10 -14
- package/dist/{delete-BHSeDVBT.mjs → delete-Br2Jj28e.mjs} +1 -1
- package/dist/{deploy-CQ69yWAK.mjs → deploy-DzGsORJx.mjs} +3 -3
- package/dist/{dev-DlseKVVF.mjs → dev-CQPY9Cfx.mjs} +1 -1
- package/dist/{init-mdG0rdRZ.mjs → init-Dn3RNhsR.mjs} +3 -3
- package/dist/{secret-CJcR121q.mjs → secret-DTH-dXnP.mjs} +1 -1
- package/dist/{storage-D0odnyBO.mjs → storage-DOtoALnS.mjs} +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as serverOrigin, i as readProjectConfig, n as ensureApiKey, r as readGlobalConfig, t as approveServer } from "./_config-
|
|
2
|
+
import { a as serverOrigin, i as readProjectConfig, n as ensureApiKey, r as readGlobalConfig, t as approveServer } from "./_config-B7Ywbpfb.mjs";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as unwrapCancel, n as log, o as CliError } from "./_ui-CKEIHAtB.mjs";
|
|
3
3
|
import { l as writeJson, o as readJson, r as errorMessage } from "./_utils-C502jKo8.mjs";
|
|
4
|
-
import { existsSync } from "node:fs";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import * as p from "@clack/prompts";
|
|
7
|
-
import os from "node:os";
|
|
8
6
|
import envPaths from "env-paths";
|
|
9
7
|
import { z } from "zod";
|
|
10
8
|
//#region _config.ts
|
|
@@ -24,32 +22,18 @@ const ProjectConfigSchema = z.object({
|
|
|
24
22
|
serverUrl: z.string()
|
|
25
23
|
});
|
|
26
24
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* Windows (no trailing `Config` segment) it does not.
|
|
30
|
-
*/
|
|
31
|
-
function legacyConfigDir() {
|
|
32
|
-
if (process.platform === "win32") return path.join(process.env.APPDATA ?? path.join(os.homedir(), "AppData", "Roaming"), "aai");
|
|
33
|
-
return path.join(process.env.XDG_CONFIG_HOME ?? path.join(os.homedir(), ".config"), "aai");
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Resolve the global config directory, preferring the platform-conventional
|
|
37
|
-
* env-paths location while staying backward compatible: an existing config at
|
|
38
|
-
* the legacy path keeps winning so already-authenticated users are not
|
|
39
|
-
* silently logged out. Injectable for tests.
|
|
25
|
+
* Resolve the global config directory (the platform-conventional env-paths
|
|
26
|
+
* location).
|
|
40
27
|
*
|
|
41
28
|
* `AAI_CONFIG_DIR` overrides everything — it exists so tests (and unusual
|
|
42
29
|
* setups) can redirect ALL global-config reads and writes away from the
|
|
43
30
|
* user's real config. The test suite's `approveServer` calls used to
|
|
44
31
|
* permanently pollute `~/.config/aai/config.json` with approved origins.
|
|
45
32
|
*/
|
|
46
|
-
function getConfigDir(
|
|
47
|
-
legacy: legacyConfigDir(),
|
|
48
|
-
modern: envPaths("aai", { suffix: "" }).config
|
|
49
|
-
}, exists = existsSync) {
|
|
33
|
+
function getConfigDir() {
|
|
50
34
|
const override = process.env.AAI_CONFIG_DIR?.trim();
|
|
51
35
|
if (override) return override;
|
|
52
|
-
return
|
|
36
|
+
return envPaths("aai", { suffix: "" }).config;
|
|
53
37
|
}
|
|
54
38
|
async function readProjectConfig(agentDir) {
|
|
55
39
|
const file = path.join(agentDir, ".aai", "project.json");
|
|
@@ -4,8 +4,8 @@ import { r as errorMessage, t as errorCode } from "./_utils-C502jKo8.mjs";
|
|
|
4
4
|
import { n as fallbackHtmlPlugin } from "./client-bundler-DO3GgO6p.mjs";
|
|
5
5
|
import { buildWorker } from "./worker-bundler.mjs";
|
|
6
6
|
import { createWorkerEvaluator } from "./_bundler-DnZnKsIU.mjs";
|
|
7
|
-
import { n as ensureApiKey } from "./_config-
|
|
8
|
-
import { t as resolveServerEnv } from "./_server-common-
|
|
7
|
+
import { n as ensureApiKey } from "./_config-B7Ywbpfb.mjs";
|
|
8
|
+
import { t as resolveServerEnv } from "./_server-common-CpVD57yn.mjs";
|
|
9
9
|
import { createRequire } from "node:module";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
import path from "node:path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as isEexist, l as writeJson, o as readJson, r as errorMessage } from "./_utils-C502jKo8.mjs";
|
|
3
|
-
import { r as isDevMode, t as getMonorepoRoot } from "./_agent-
|
|
3
|
+
import { r as isDevMode, t as getMonorepoRoot } from "./_agent-dJAeDb38.mjs";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
@@ -17,7 +17,7 @@ async function resolveTemplatesDir() {
|
|
|
17
17
|
root: process.env.AAI_TEMPLATES_DIR,
|
|
18
18
|
cleanup: noCleanup
|
|
19
19
|
};
|
|
20
|
-
const monorepoRoot =
|
|
20
|
+
const monorepoRoot = getMonorepoRoot();
|
|
21
21
|
if (monorepoRoot) return {
|
|
22
22
|
root: path.join(monorepoRoot, "packages", "aai-templates"),
|
|
23
23
|
cleanup: noCleanup
|
|
@@ -117,9 +117,7 @@ aai secret delete MY_KEY # Remove a secret
|
|
|
117
117
|
const WORKSPACE_PKG_DIRS = {
|
|
118
118
|
"@alexkroman1/aai": "aai",
|
|
119
119
|
"@alexkroman1/aai-cli": "aai-cli",
|
|
120
|
-
"@alexkroman1/aai-ui": "aai-ui"
|
|
121
|
-
"aai-server": "aai-server",
|
|
122
|
-
"aai-templates": "aai-templates"
|
|
120
|
+
"@alexkroman1/aai-ui": "aai-ui"
|
|
123
121
|
};
|
|
124
122
|
/** Rewrite workspace deps to link: paths so pnpm links to local source. */
|
|
125
123
|
async function patchPackageJsonForWorkspace(targetDir) {
|
|
@@ -21,9 +21,15 @@ import { parseEnv } from "node:util";
|
|
|
21
21
|
*/
|
|
22
22
|
async function resolveServerEnv(cwd, baseEnv) {
|
|
23
23
|
let fileEntries = {};
|
|
24
|
-
if (cwd)
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if (cwd) {
|
|
25
|
+
let content = null;
|
|
26
|
+
try {
|
|
27
|
+
content = await fs.readFile(path.join(cwd, ".env"), "utf-8");
|
|
28
|
+
} catch (err) {
|
|
29
|
+
if (err.code !== "ENOENT") throw err;
|
|
30
|
+
}
|
|
31
|
+
if (content !== null) fileEntries = parseEnv(content);
|
|
32
|
+
}
|
|
27
33
|
const source = baseEnv ?? process.env;
|
|
28
34
|
const env = {};
|
|
29
35
|
for (const [key, fileVal] of Object.entries(fileEntries)) {
|
package/dist/cli.mjs
CHANGED
|
@@ -108,10 +108,6 @@ const init = defineCommand({
|
|
|
108
108
|
server: sharedArgs.server,
|
|
109
109
|
yes: sharedArgs.yes,
|
|
110
110
|
json: sharedArgs.json,
|
|
111
|
-
skipApi: {
|
|
112
|
-
type: "boolean",
|
|
113
|
-
description: "Deprecated no-op: the API key is now only requested when deploying"
|
|
114
|
-
},
|
|
115
111
|
skipDeploy: {
|
|
116
112
|
type: "boolean",
|
|
117
113
|
description: "Skip deploy after scaffolding"
|
|
@@ -119,7 +115,7 @@ const init = defineCommand({
|
|
|
119
115
|
},
|
|
120
116
|
async run({ args }) {
|
|
121
117
|
await runCommand(args, async (mode) => {
|
|
122
|
-
const { executeInit } = await import("./init-
|
|
118
|
+
const { executeInit } = await import("./init-Dn3RNhsR.mjs");
|
|
123
119
|
return executeInit({
|
|
124
120
|
dir: args.dir,
|
|
125
121
|
force: args.force,
|
|
@@ -143,7 +139,7 @@ const dev = defineCommand({
|
|
|
143
139
|
async run({ args }) {
|
|
144
140
|
await runCommand(args, async () => {
|
|
145
141
|
const cwd = await setup({ agent: true });
|
|
146
|
-
const { executeDev } = await import("./dev-
|
|
142
|
+
const { executeDev } = await import("./dev-CQPY9Cfx.mjs");
|
|
147
143
|
return executeDev({
|
|
148
144
|
cwd,
|
|
149
145
|
port: args.port
|
|
@@ -209,7 +205,7 @@ const deploy = defineCommand({
|
|
|
209
205
|
async run({ args }) {
|
|
210
206
|
await runCommand(args, async () => {
|
|
211
207
|
const cwd = await setup({ agent: true });
|
|
212
|
-
const { executeDeploy } = await import("./deploy-
|
|
208
|
+
const { executeDeploy } = await import("./deploy-DzGsORJx.mjs");
|
|
213
209
|
return executeDeploy({
|
|
214
210
|
cwd,
|
|
215
211
|
...args.server ? { server: args.server } : {}
|
|
@@ -229,7 +225,7 @@ const del = defineCommand({
|
|
|
229
225
|
async run({ args }) {
|
|
230
226
|
await runCommand(args, async () => {
|
|
231
227
|
const cwd = await setup();
|
|
232
|
-
const { executeDelete } = await import("./delete-
|
|
228
|
+
const { executeDelete } = await import("./delete-Br2Jj28e.mjs");
|
|
233
229
|
return executeDelete({
|
|
234
230
|
cwd,
|
|
235
231
|
...args.server ? { server: args.server } : {}
|
|
@@ -260,7 +256,7 @@ const secret = defineCommand({
|
|
|
260
256
|
async run({ args }) {
|
|
261
257
|
await runCommand(args, async (mode) => {
|
|
262
258
|
const cwd = await setup();
|
|
263
|
-
const { executeSecretPut, readStdin } = await import("./secret-
|
|
259
|
+
const { executeSecretPut, readStdin } = await import("./secret-DTH-dXnP.mjs");
|
|
264
260
|
const value = mode === "json" ? await readStdin() : void 0;
|
|
265
261
|
if (mode === "json" && !value) throw new CliError("no_input", "No value provided", "Pipe secret value to stdin");
|
|
266
262
|
return executeSecretPut(cwd, args.name, value, args.server);
|
|
@@ -284,7 +280,7 @@ const secret = defineCommand({
|
|
|
284
280
|
async run({ args }) {
|
|
285
281
|
await runCommand(args, async () => {
|
|
286
282
|
const cwd = await setup();
|
|
287
|
-
const { executeSecretDelete } = await import("./secret-
|
|
283
|
+
const { executeSecretDelete } = await import("./secret-DTH-dXnP.mjs");
|
|
288
284
|
return executeSecretDelete(cwd, args.name, args.server);
|
|
289
285
|
});
|
|
290
286
|
}
|
|
@@ -301,7 +297,7 @@ const secret = defineCommand({
|
|
|
301
297
|
async run({ args }) {
|
|
302
298
|
await runCommand(args, async () => {
|
|
303
299
|
const cwd = await setup();
|
|
304
|
-
const { executeSecretList } = await import("./secret-
|
|
300
|
+
const { executeSecretList } = await import("./secret-DTH-dXnP.mjs");
|
|
305
301
|
return executeSecretList(cwd, args.server);
|
|
306
302
|
});
|
|
307
303
|
}
|
|
@@ -336,7 +332,7 @@ const storage = defineCommand({
|
|
|
336
332
|
},
|
|
337
333
|
async run({ args }) {
|
|
338
334
|
await runCommand(args, async () => {
|
|
339
|
-
const { executeStorageStatus } = await import("./storage-
|
|
335
|
+
const { executeStorageStatus } = await import("./storage-DOtoALnS.mjs");
|
|
340
336
|
return executeStorageStatus(resolveStorageCwd(args.dir), args.server);
|
|
341
337
|
});
|
|
342
338
|
}
|
|
@@ -353,7 +349,7 @@ const storage = defineCommand({
|
|
|
353
349
|
},
|
|
354
350
|
async run({ args }) {
|
|
355
351
|
await runCommand(args, async () => {
|
|
356
|
-
const { executeStorageEnable } = await import("./storage-
|
|
352
|
+
const { executeStorageEnable } = await import("./storage-DOtoALnS.mjs");
|
|
357
353
|
return executeStorageEnable(resolveStorageCwd(args.dir), args.server);
|
|
358
354
|
});
|
|
359
355
|
}
|
|
@@ -375,7 +371,7 @@ const storage = defineCommand({
|
|
|
375
371
|
},
|
|
376
372
|
async run({ args }) {
|
|
377
373
|
await runCommand(args, async () => {
|
|
378
|
-
const { executeStorageDisable } = await import("./storage-
|
|
374
|
+
const { executeStorageDisable } = await import("./storage-DOtoALnS.mjs");
|
|
379
375
|
return executeStorageDisable(resolveStorageCwd(args.dir), {
|
|
380
376
|
server: args.server,
|
|
381
377
|
force: args.force
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as log, u as ok } from "./_ui-CKEIHAtB.mjs";
|
|
3
|
-
import { n as getServerInfo } from "./_agent-
|
|
3
|
+
import { n as getServerInfo } from "./_agent-dJAeDb38.mjs";
|
|
4
4
|
import { t as apiRequest } from "./_api-client-a6cPMebU.mjs";
|
|
5
5
|
//#region delete.ts
|
|
6
6
|
async function runDelete(opts) {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { n as log, t as fmtUrl, u as ok } from "./_ui-CKEIHAtB.mjs";
|
|
3
3
|
import { r as errorMessage } from "./_utils-C502jKo8.mjs";
|
|
4
4
|
import { buildAgentBundle } from "./_bundler-DnZnKsIU.mjs";
|
|
5
|
-
import { o as writeProjectConfig } from "./_config-
|
|
6
|
-
import { t as resolveServerEnv } from "./_server-common-
|
|
7
|
-
import { i as resolveDeployTarget } from "./_agent-
|
|
5
|
+
import { o as writeProjectConfig } from "./_config-B7Ywbpfb.mjs";
|
|
6
|
+
import { t as resolveServerEnv } from "./_server-common-CpVD57yn.mjs";
|
|
7
|
+
import { i as resolveDeployTarget } from "./_agent-dJAeDb38.mjs";
|
|
8
8
|
import { t as apiRequest } from "./_api-client-a6cPMebU.mjs";
|
|
9
9
|
import { gzipSync } from "node:zlib";
|
|
10
10
|
//#region _deploy.ts
|
|
@@ -11,7 +11,7 @@ import pc from "picocolors";
|
|
|
11
11
|
async function executeDev(opts) {
|
|
12
12
|
const port = parsePort(opts.port);
|
|
13
13
|
const agentName = path.basename(path.resolve(opts.cwd));
|
|
14
|
-
const { startDevServer } = await import("./_dev-server-
|
|
14
|
+
const { startDevServer } = await import("./_dev-server-DvcbFgos.mjs");
|
|
15
15
|
let cleanup;
|
|
16
16
|
let shuttingDown = false;
|
|
17
17
|
const onSignal = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as unwrapCancel, n as log, u as ok } from "./_ui-CKEIHAtB.mjs";
|
|
3
3
|
import { i as fileExists, o as readJson, r as errorMessage, s as resolveCwd } from "./_utils-C502jKo8.mjs";
|
|
4
|
-
import { r as isDevMode, t as getMonorepoRoot } from "./_agent-
|
|
4
|
+
import { r as isDevMode, t as getMonorepoRoot } from "./_agent-dJAeDb38.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
7
|
import pc from "picocolors";
|
|
@@ -74,7 +74,7 @@ function resolveTargetDir(dir) {
|
|
|
74
74
|
}
|
|
75
75
|
/** Run deploy after init and return deploy metadata if successful. */
|
|
76
76
|
async function tryDeploy(cwd, server) {
|
|
77
|
-
const { executeDeploy } = await import("./deploy-
|
|
77
|
+
const { executeDeploy } = await import("./deploy-DzGsORJx.mjs");
|
|
78
78
|
try {
|
|
79
79
|
const result = await executeDeploy({
|
|
80
80
|
cwd,
|
|
@@ -92,7 +92,7 @@ async function tryDeploy(cwd, server) {
|
|
|
92
92
|
}
|
|
93
93
|
/** Scaffold the project, optionally showing a spinner. */
|
|
94
94
|
async function scaffoldProject(dir, cwd, template, silent) {
|
|
95
|
-
const { runInit } = await import("./_init-
|
|
95
|
+
const { runInit } = await import("./_init-B-Fd6Lm4.mjs");
|
|
96
96
|
if (silent) {
|
|
97
97
|
await runInit({
|
|
98
98
|
targetDir: cwd,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as unwrapCancel, n as log, s as fail, u as ok } from "./_ui-CKEIHAtB.mjs";
|
|
3
|
-
import { n as getServerInfo } from "./_agent-
|
|
3
|
+
import { n as getServerInfo } from "./_agent-dJAeDb38.mjs";
|
|
4
4
|
import { t as apiRequest } from "./_api-client-a6cPMebU.mjs";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
import { text } from "node:stream/consumers";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as log, s as fail, u as ok } from "./_ui-CKEIHAtB.mjs";
|
|
3
|
-
import { n as getServerInfo } from "./_agent-
|
|
3
|
+
import { n as getServerInfo } from "./_agent-dJAeDb38.mjs";
|
|
4
4
|
import { t as apiRequest } from "./_api-client-a6cPMebU.mjs";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region storage.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"aai": "dist/cli.mjs"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"rolldown": "~1.1.4",
|
|
33
33
|
"vite": "^8.1.5",
|
|
34
34
|
"zod": "^4.4.3",
|
|
35
|
-
"@alexkroman1/aai": "
|
|
36
|
-
"@alexkroman1/aai-ui": "
|
|
35
|
+
"@alexkroman1/aai": "4.0.0",
|
|
36
|
+
"@alexkroman1/aai-ui": "4.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"playwright": "^1.61.1",
|