@aixyz/cli 0.17.0 → 0.19.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/build/AixyzServerPlugin.ts +2 -2
- package/build/index.ts +9 -6
- package/dev/index.ts +15 -8
- package/dev/worker.ts +3 -1
- package/package.json +3 -3
- package/register/register.ts +10 -0
- package/register/update.ts +8 -0
- package/register/wallet/index.ts +2 -1
|
@@ -38,8 +38,8 @@ if (import.meta.main) {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function getEntrypointMayGenerate(cwd: string, mode: "dev" | "build"): string {
|
|
42
|
-
const appDir = resolve(cwd,
|
|
41
|
+
export function getEntrypointMayGenerate(cwd: string, appDirName: string, mode: "dev" | "build"): string {
|
|
42
|
+
const appDir = resolve(cwd, appDirName);
|
|
43
43
|
|
|
44
44
|
if (existsSync(resolve(appDir, "server.ts"))) {
|
|
45
45
|
return resolve(appDir, "server.ts");
|
package/build/index.ts
CHANGED
|
@@ -8,10 +8,6 @@ import { getAixyzConfig } from "@aixyz/config";
|
|
|
8
8
|
import { loadEnvConfig } from "@next/env";
|
|
9
9
|
import chalk from "chalk";
|
|
10
10
|
|
|
11
|
-
interface BuildOptions {
|
|
12
|
-
output?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
11
|
export const buildCommand = new Command("build")
|
|
16
12
|
.description("Build the aixyz agent")
|
|
17
13
|
.option("--output <type>", "Output format: 'standalone', 'vercel', or 'executable'")
|
|
@@ -51,16 +47,23 @@ Examples:
|
|
|
51
47
|
)
|
|
52
48
|
.action(action);
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
type BuildOptions = {
|
|
51
|
+
output?: string;
|
|
52
|
+
// Internal option, not exposed to CLI
|
|
53
|
+
appDir?: string;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export async function action(options: BuildOptions = {}): Promise<void> {
|
|
55
57
|
const cwd = process.cwd();
|
|
56
58
|
loadEnvConfig(cwd, false);
|
|
57
59
|
process.env.NODE_ENV = "production";
|
|
58
60
|
process.env.AIXYZ_ENV = "production";
|
|
59
|
-
const entrypoint = getEntrypointMayGenerate(cwd, "build");
|
|
60
61
|
|
|
61
62
|
// Determine output target: explicit CLI flag takes precedence, then config file, then auto-detect VERCEL env
|
|
62
63
|
const config = getAixyzConfig();
|
|
63
64
|
const target = options.output ?? config.build?.output ?? (process.env.VERCEL === "1" ? "vercel" : "standalone");
|
|
65
|
+
const appDir = options.appDir || "app";
|
|
66
|
+
const entrypoint = getEntrypointMayGenerate(cwd, appDir, "build");
|
|
64
67
|
|
|
65
68
|
if (target === "vercel") {
|
|
66
69
|
console.log(chalk.cyan("▶") + " Building for " + chalk.bold("Vercel") + "...");
|
package/dev/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { existsSync, watch } from "fs";
|
|
|
3
3
|
import { loadEnvConfig } from "@next/env";
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { getEntrypointMayGenerate } from "../build/AixyzServerPlugin";
|
|
6
|
+
import chalk from "chalk";
|
|
6
7
|
import pkg from "../package.json";
|
|
7
8
|
|
|
8
9
|
export const devCommand = new Command("dev")
|
|
@@ -10,7 +11,13 @@ export const devCommand = new Command("dev")
|
|
|
10
11
|
.option("-p, --port <port>", "Port to listen on", "3000")
|
|
11
12
|
.action(action);
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
type DevOptions = {
|
|
15
|
+
port?: string;
|
|
16
|
+
// Internal option, not exposed to CLI
|
|
17
|
+
appDir?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export async function action(options: DevOptions): Promise<void> {
|
|
14
21
|
const cwd = process.cwd();
|
|
15
22
|
|
|
16
23
|
// Load environment config
|
|
@@ -20,15 +27,15 @@ async function action(options: { port?: string }): Promise<void> {
|
|
|
20
27
|
const envFileNames = loadedEnvFiles.map((f) => relative(cwd, f.path));
|
|
21
28
|
|
|
22
29
|
const port = options.port || process.env.PORT || "3000";
|
|
30
|
+
const appDir = options.appDir || "app";
|
|
23
31
|
const baseUrl = `http://localhost:${port}`;
|
|
24
32
|
|
|
25
33
|
console.log("");
|
|
26
|
-
console.log(
|
|
27
|
-
console.log(
|
|
28
|
-
console.log(`-
|
|
29
|
-
console.log(`- MCP: ${baseUrl}/mcp`);
|
|
34
|
+
console.log(chalk.blueBright(`➫ aixyz.sh v${pkg.version}`));
|
|
35
|
+
console.log(`- A2A: ${baseUrl}/.well-known/agent-card.json`);
|
|
36
|
+
console.log(`- MCP: ${baseUrl}/mcp`);
|
|
30
37
|
if (envFileNames.length > 0) {
|
|
31
|
-
console.log(`- Environments:
|
|
38
|
+
console.log(`- Environments: ${envFileNames.join(", ")}`);
|
|
32
39
|
}
|
|
33
40
|
console.log("");
|
|
34
41
|
|
|
@@ -38,7 +45,7 @@ async function action(options: { port?: string }): Promise<void> {
|
|
|
38
45
|
let restarting = false;
|
|
39
46
|
|
|
40
47
|
function startServer() {
|
|
41
|
-
const endpoint = getEntrypointMayGenerate(cwd, "dev");
|
|
48
|
+
const endpoint = getEntrypointMayGenerate(cwd, appDir, "dev");
|
|
42
49
|
child = Bun.spawn(["bun", workerPath, endpoint, port], {
|
|
43
50
|
cwd,
|
|
44
51
|
stdout: "inherit",
|
|
@@ -76,7 +83,7 @@ async function action(options: { port?: string }): Promise<void> {
|
|
|
76
83
|
}, 100);
|
|
77
84
|
}
|
|
78
85
|
|
|
79
|
-
watch(resolve(cwd,
|
|
86
|
+
watch(resolve(cwd, appDir), { recursive: true }, (_event, filename) => {
|
|
80
87
|
scheduleRestart(filename ? `${filename} changed` : "file changed");
|
|
81
88
|
});
|
|
82
89
|
|
package/dev/worker.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
1
3
|
async function main() {
|
|
2
4
|
const entrypoint = process.argv[2];
|
|
3
5
|
const port = parseInt(process.argv[3], 10);
|
|
@@ -18,7 +20,7 @@ async function main() {
|
|
|
18
20
|
|
|
19
21
|
app.express.listen(port, () => {
|
|
20
22
|
const duration = Math.round(performance.now() - startTime);
|
|
21
|
-
console.log(`Ready in ${duration}ms`);
|
|
23
|
+
console.log(chalk.blueBright("✓") + ` Ready in ${duration}ms`);
|
|
22
24
|
console.log("");
|
|
23
25
|
});
|
|
24
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aixyz/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Payment-native SDK for AI Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"bin.ts"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aixyz/config": "0.
|
|
32
|
-
"@aixyz/erc-8004": "0.
|
|
31
|
+
"@aixyz/config": "0.19.0",
|
|
32
|
+
"@aixyz/erc-8004": "0.19.0",
|
|
33
33
|
"@inquirer/prompts": "^8.3.0",
|
|
34
34
|
"@next/env": "^16.1.6",
|
|
35
35
|
"boxen": "^8.0.1",
|
package/register/register.ts
CHANGED
|
@@ -91,6 +91,16 @@ export async function register(options: RegisterOptions): Promise<void> {
|
|
|
91
91
|
}
|
|
92
92
|
printTxDetails("Transaction details (dry-run)");
|
|
93
93
|
console.log("Dry-run complete. To sign and broadcast, re-run with --broadcast.");
|
|
94
|
+
const sq = (v: string) => `'${v.replace(/'/g, `'\\''`)}'`;
|
|
95
|
+
const rerunParts = [`aixyz erc-8004 register`, `--url ${sq(agentUrl)}`, `--chain-id ${chainId}`];
|
|
96
|
+
if (options.rpcUrl) rerunParts.push(`--rpc-url ${sq(options.rpcUrl)}`);
|
|
97
|
+
rerunParts.push(`--registry ${sq(registryAddress)}`);
|
|
98
|
+
if (options.keystore) rerunParts.push(`--keystore ${sq(options.keystore)}`);
|
|
99
|
+
if (options.browser) rerunParts.push("--browser");
|
|
100
|
+
if (options.outDir) rerunParts.push(`--out-dir ${sq(options.outDir)}`);
|
|
101
|
+
if (options.supportedTrust) rerunParts.push(`--supported-trust ${sq(options.supportedTrust)}`);
|
|
102
|
+
rerunParts.push("--broadcast");
|
|
103
|
+
console.log(rerunParts.join(" "));
|
|
94
104
|
return;
|
|
95
105
|
}
|
|
96
106
|
|
package/register/update.ts
CHANGED
|
@@ -91,6 +91,14 @@ export async function update(options: UpdateOptions): Promise<void> {
|
|
|
91
91
|
}
|
|
92
92
|
printTxDetails("Transaction details (dry-run)");
|
|
93
93
|
console.log("Dry-run complete. To sign and broadcast, re-run with --broadcast.");
|
|
94
|
+
const sq = (v: string) => `'${v.replace(/'/g, `'\\''`)}'`;
|
|
95
|
+
const rerunParts = [`aixyz erc-8004 update`, `--url ${sq(agentUrl)}`, `--agent-id ${selected.agentId}`];
|
|
96
|
+
if (options.rpcUrl) rerunParts.push(`--rpc-url ${sq(options.rpcUrl)}`);
|
|
97
|
+
if (options.keystore) rerunParts.push(`--keystore ${sq(options.keystore)}`);
|
|
98
|
+
if (options.browser) rerunParts.push("--browser");
|
|
99
|
+
if (options.outDir) rerunParts.push(`--out-dir ${sq(options.outDir)}`);
|
|
100
|
+
rerunParts.push("--broadcast");
|
|
101
|
+
console.log(rerunParts.join(" "));
|
|
94
102
|
return;
|
|
95
103
|
}
|
|
96
104
|
|
package/register/wallet/index.ts
CHANGED
|
@@ -38,8 +38,8 @@ export async function selectWalletMethod(options: WalletOptions): Promise<Wallet
|
|
|
38
38
|
return withTTY(async () => {
|
|
39
39
|
const localWalletExists = hasLocalWallet();
|
|
40
40
|
const choices = [
|
|
41
|
-
{ name: "Keystore file", value: "keystore" },
|
|
42
41
|
{ name: "Browser wallet (any EIP-6963 compatible wallets)", value: "browser" },
|
|
42
|
+
{ name: "Keystore file", value: "keystore" },
|
|
43
43
|
{ name: "Private key (not recommended)", value: "privatekey" },
|
|
44
44
|
...(localWalletExists ? [{ name: "Local wallet (.aixyz/wallet.json)", value: "local" }] : []),
|
|
45
45
|
];
|
|
@@ -47,6 +47,7 @@ export async function selectWalletMethod(options: WalletOptions): Promise<Wallet
|
|
|
47
47
|
const method = await select({
|
|
48
48
|
message: "Select signing method:",
|
|
49
49
|
choices,
|
|
50
|
+
default: "browser",
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
switch (method) {
|