create-aixyz-app 0.8.0 → 0.10.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/index.js
CHANGED
|
@@ -593,6 +593,25 @@ class Vt extends x {
|
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
|
+
|
|
597
|
+
class kt extends x {
|
|
598
|
+
get cursor() {
|
|
599
|
+
return this.value ? 0 : 1;
|
|
600
|
+
}
|
|
601
|
+
get _value() {
|
|
602
|
+
return this.cursor === 0;
|
|
603
|
+
}
|
|
604
|
+
constructor(e) {
|
|
605
|
+
super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
|
|
606
|
+
this.value = this._value;
|
|
607
|
+
}), this.on("confirm", (s) => {
|
|
608
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
|
|
609
|
+
}), this.on("cursor", () => {
|
|
610
|
+
this.value = !this.value;
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
596
615
|
class yt extends x {
|
|
597
616
|
options;
|
|
598
617
|
cursor = 0;
|
|
@@ -890,6 +909,33 @@ function J2(t, r, s) {
|
|
|
890
909
|
`).map((i) => Ie(i, r, s)).join(`
|
|
891
910
|
`);
|
|
892
911
|
}
|
|
912
|
+
var Re = (t) => {
|
|
913
|
+
const r = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
914
|
+
return new kt({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
|
|
915
|
+
const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors2.default.gray(d)}
|
|
916
|
+
` : ""}${W2(this.state)} ${t.message}
|
|
917
|
+
`, o = this.value ? r : s;
|
|
918
|
+
switch (this.state) {
|
|
919
|
+
case "submit": {
|
|
920
|
+
const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
|
|
921
|
+
return `${a}${u}${import_picocolors2.default.dim(o)}`;
|
|
922
|
+
}
|
|
923
|
+
case "cancel": {
|
|
924
|
+
const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
|
|
925
|
+
return `${a}${u}${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}${i ? `
|
|
926
|
+
${import_picocolors2.default.gray(d)}` : ""}`;
|
|
927
|
+
}
|
|
928
|
+
default: {
|
|
929
|
+
const u = i ? `${import_picocolors2.default.cyan(d)} ` : "", l = i ? import_picocolors2.default.cyan(x2) : "";
|
|
930
|
+
return `${a}${u}${this.value ? `${import_picocolors2.default.green(Q2)} ${r}` : `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(r)}`}${t.vertical ? i ? `
|
|
931
|
+
${import_picocolors2.default.cyan(d)} ` : `
|
|
932
|
+
` : ` ${import_picocolors2.default.dim("/")} `}${this.value ? `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.green(Q2)} ${s}`}
|
|
933
|
+
${l}
|
|
934
|
+
`;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
} }).prompt();
|
|
938
|
+
};
|
|
893
939
|
var R2 = { message: (t = [], { symbol: r = import_picocolors2.default.gray(d), secondarySymbol: s = import_picocolors2.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
|
|
894
940
|
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
|
|
895
941
|
for (let p = 0;p < a; p++)
|
|
@@ -1044,7 +1090,7 @@ ${l}
|
|
|
1044
1090
|
|
|
1045
1091
|
// src/index.ts
|
|
1046
1092
|
import { execSync } from "node:child_process";
|
|
1047
|
-
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
1093
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
1048
1094
|
import { join, resolve } from "node:path";
|
|
1049
1095
|
import { fileURLToPath } from "node:url";
|
|
1050
1096
|
var args = process.argv.slice(2);
|
|
@@ -1114,6 +1160,18 @@ if (existsSync(targetDir)) {
|
|
|
1114
1160
|
process.exit(1);
|
|
1115
1161
|
}
|
|
1116
1162
|
}
|
|
1163
|
+
var includeErc8004 = false;
|
|
1164
|
+
if (!useDefaults) {
|
|
1165
|
+
const erc8004 = await Re({
|
|
1166
|
+
message: "Support ERC-8004 Agent Identity?",
|
|
1167
|
+
initialValue: false
|
|
1168
|
+
});
|
|
1169
|
+
if (Ct(erc8004)) {
|
|
1170
|
+
Ne("Operation cancelled.");
|
|
1171
|
+
process.exit(0);
|
|
1172
|
+
}
|
|
1173
|
+
includeErc8004 = erc8004;
|
|
1174
|
+
}
|
|
1117
1175
|
var openaiApiKey = "";
|
|
1118
1176
|
if (!useDefaults) {
|
|
1119
1177
|
const apiKey = await Ze({
|
|
@@ -1131,6 +1189,25 @@ if (!useDefaults) {
|
|
|
1131
1189
|
}
|
|
1132
1190
|
openaiApiKey = apiKey || "";
|
|
1133
1191
|
}
|
|
1192
|
+
var DEFAULT_PAY_TO = "0x0799872E07EA7a63c79357694504FE66EDfE4a0A";
|
|
1193
|
+
var payTo = DEFAULT_PAY_TO;
|
|
1194
|
+
if (!useDefaults) {
|
|
1195
|
+
const payToInput = await Ze({
|
|
1196
|
+
message: "x402 payTo address (Ethereum address to receive payments, press Enter to skip):",
|
|
1197
|
+
placeholder: DEFAULT_PAY_TO,
|
|
1198
|
+
defaultValue: DEFAULT_PAY_TO,
|
|
1199
|
+
validate(value) {
|
|
1200
|
+
if (value && !value.startsWith("0x")) {
|
|
1201
|
+
return "Ethereum addresses must start with '0x'";
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
if (Ct(payToInput)) {
|
|
1206
|
+
Ne("Operation cancelled.");
|
|
1207
|
+
process.exit(0);
|
|
1208
|
+
}
|
|
1209
|
+
payTo = payToInput || DEFAULT_PAY_TO;
|
|
1210
|
+
}
|
|
1134
1211
|
var __filename2 = fileURLToPath(import.meta.url);
|
|
1135
1212
|
var templateDir = join(__filename2, "..", "..", "templates", "default");
|
|
1136
1213
|
if (!existsSync(templateDir)) {
|
|
@@ -1139,6 +1216,12 @@ if (!existsSync(templateDir)) {
|
|
|
1139
1216
|
}
|
|
1140
1217
|
mkdirSync(targetDir, { recursive: true });
|
|
1141
1218
|
cpSync(templateDir, targetDir, { recursive: true });
|
|
1219
|
+
if (!includeErc8004) {
|
|
1220
|
+
const erc8004Path = join(targetDir, "app", "erc-8004.ts");
|
|
1221
|
+
if (existsSync(erc8004Path)) {
|
|
1222
|
+
rmSync(erc8004Path);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1142
1225
|
var gitignoreSrc = join(targetDir, "gitignore");
|
|
1143
1226
|
if (existsSync(gitignoreSrc)) {
|
|
1144
1227
|
renameSync(gitignoreSrc, join(targetDir, ".gitignore"));
|
|
@@ -1160,6 +1243,7 @@ for (const file of filesToReplace) {
|
|
|
1160
1243
|
let content = readFileSync(filePath, "utf-8");
|
|
1161
1244
|
content = content.replaceAll("{{PKG_NAME}}", pkgName);
|
|
1162
1245
|
content = content.replaceAll("{{AGENT_NAME}}", agentName);
|
|
1246
|
+
content = content.replaceAll("{{PAY_TO}}", payTo);
|
|
1163
1247
|
writeFileSync(filePath, content);
|
|
1164
1248
|
}
|
|
1165
1249
|
}
|
|
@@ -1179,4 +1263,5 @@ if (packageManager !== "bun" && packageManager !== "unknown") {
|
|
|
1179
1263
|
}
|
|
1180
1264
|
Ve([`cd ${pkgName}`, openaiApiKey ? "" : "Set OPENAI_API_KEY in .env.local", "bun run dev"].filter(Boolean).join(`
|
|
1181
1265
|
`), "Next steps");
|
|
1266
|
+
Ve("aixyz erc-8004 register", "To register ERC-8004: Agent Identity");
|
|
1182
1267
|
Le(`Success! Created ${agentName} at ./${pkgName}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-aixyz-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Payment-native SDK for AI Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/bun": "^1.3.9",
|
|
34
34
|
"@types/node": "^22",
|
|
35
35
|
"ai": "^6",
|
|
36
|
-
"aixyz": "0.
|
|
36
|
+
"aixyz": "0.10.0",
|
|
37
37
|
"typescript": "^5",
|
|
38
38
|
"zod": "^4"
|
|
39
39
|
}
|
|
@@ -7,7 +7,7 @@ const config: AixyzConfig = {
|
|
|
7
7
|
// You can use `process.env.YOUR_PAY_TO_ADDRESS` to conditionally set values based on the environment,
|
|
8
8
|
// For example, .env, .env.local, .env.production, .env.development are supported
|
|
9
9
|
x402: {
|
|
10
|
-
payTo: "
|
|
10
|
+
payTo: "{{PAY_TO}}",
|
|
11
11
|
network: process.env.NODE_ENV === "production" ? "eip155:8453" : "eip155:84532",
|
|
12
12
|
},
|
|
13
13
|
skills: [
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ERC8004Registration } from "aixyz/erc-8004";
|
|
2
|
+
|
|
3
|
+
const metadata: ERC8004Registration = {
|
|
4
|
+
/**
|
|
5
|
+
* `aixyz erc-8004 register` will write to this field.
|
|
6
|
+
*/
|
|
7
|
+
registrations: [],
|
|
8
|
+
supportedTrust: ["reputation"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Declaring `export default registration`, two endpoints will be available:
|
|
13
|
+
*
|
|
14
|
+
* GET /_aixyz/erc-8004.json
|
|
15
|
+
* GET /.well-known/erc-8004.json
|
|
16
|
+
*/
|
|
17
|
+
export default metadata;
|