create-aixyz-app 0.27.0 → 0.28.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 +37 -14
- package/package.json +2 -2
- package/templates/default/README.md +14 -0
- package/templates/default/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -3215,11 +3215,31 @@ var {
|
|
|
3215
3215
|
|
|
3216
3216
|
// src/index.ts
|
|
3217
3217
|
import { execSync } from "node:child_process";
|
|
3218
|
-
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync as
|
|
3218
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
3219
|
+
|
|
3220
|
+
// src/generate-agent-files.ts
|
|
3221
|
+
import { writeFileSync } from "node:fs";
|
|
3222
|
+
import { join } from "node:path";
|
|
3223
|
+
function generateAgentFiles(root) {
|
|
3224
|
+
const agentsMdContent = `<!-- BEGIN:aixyz-agent-rules -->
|
|
3225
|
+
|
|
3226
|
+
# aixyz: ALWAYS read docs before coding
|
|
3227
|
+
|
|
3228
|
+
Before any aixyz work, find and read the relevant doc in \`node_modules/aixyz/docs/\`.
|
|
3229
|
+
And you can read \`node_modules/aixyz/examples/\` for examples that you can reference.
|
|
3230
|
+
Your training data is outdated — the docs are the source of truth.
|
|
3231
|
+
|
|
3232
|
+
<!-- END:aixyz-agent-rules -->
|
|
3233
|
+
`;
|
|
3234
|
+
const claudeMdContent = `@AGENTS.md
|
|
3235
|
+
`;
|
|
3236
|
+
writeFileSync(join(root, "AGENTS.md"), agentsMdContent);
|
|
3237
|
+
writeFileSync(join(root, "CLAUDE.md"), claudeMdContent);
|
|
3238
|
+
}
|
|
3219
3239
|
|
|
3220
3240
|
// src/generate-icon.ts
|
|
3221
3241
|
import { randomInt } from "node:crypto";
|
|
3222
|
-
import { writeFileSync } from "node:fs";
|
|
3242
|
+
import { writeFileSync as writeFileSync2 } from "node:fs";
|
|
3223
3243
|
function randomHsl() {
|
|
3224
3244
|
return {
|
|
3225
3245
|
h: randomInt(360),
|
|
@@ -3240,15 +3260,15 @@ function buildSvg(h, s, l, fg) {
|
|
|
3240
3260
|
function generateIcon(outputPath) {
|
|
3241
3261
|
const { h, s, l } = randomHsl();
|
|
3242
3262
|
const fg = contrastColor(l);
|
|
3243
|
-
|
|
3263
|
+
writeFileSync2(outputPath, buildSvg(h, s, l, fg));
|
|
3244
3264
|
}
|
|
3245
3265
|
|
|
3246
3266
|
// src/index.ts
|
|
3247
|
-
import { join, resolve } from "node:path";
|
|
3267
|
+
import { join as join2, resolve } from "node:path";
|
|
3248
3268
|
import { fileURLToPath } from "node:url";
|
|
3249
3269
|
var DEFAULT_PAY_TO = "0x0799872E07EA7a63c79357694504FE66EDfE4a0A";
|
|
3250
3270
|
var program2 = new Command;
|
|
3251
|
-
program2.name("create-aixyz-app").description("Scaffold a new aixyz agent project").argument("[name]", "Agent name", "my-agent").option("-y, --yes", "Use defaults for all prompts (non-interactive)").option("--erc-8004", "Include ERC-8004 Agent Identity support").option("--openai-api-key <key>", "Set OpenAI API Key in .env.local").option("--pay-to <address>", "x402 payTo Ethereum address", DEFAULT_PAY_TO).option("--no-install", "Skip dependency installation").addHelpText("after", `
|
|
3271
|
+
program2.name("create-aixyz-app").description("Scaffold a new aixyz agent project").argument("[name]", "Agent name", "my-agent").option("-y, --yes", "Use defaults for all prompts (non-interactive)").option("--erc-8004", "Include ERC-8004 Agent Identity support").option("--openai-api-key <key>", "Set OpenAI API Key in .env.local").option("--pay-to <address>", "x402 payTo Ethereum address", DEFAULT_PAY_TO).option("--no-install", "Skip dependency installation").option("--no-agents-md", "Skip generating AGENTS.md and CLAUDE.md").addHelpText("after", `
|
|
3252
3272
|
Non-interactive example (CI/AI-friendly):
|
|
3253
3273
|
$ bunx create-aixyz-app my-agent --yes
|
|
3254
3274
|
$ bunx create-aixyz-app my-agent --erc-8004 --openai-api-key sk-... --pay-to 0x...
|
|
@@ -3367,41 +3387,44 @@ if (payTo === DEFAULT_PAY_TO && !isNonInteractive) {
|
|
|
3367
3387
|
payTo = payToInput || DEFAULT_PAY_TO;
|
|
3368
3388
|
}
|
|
3369
3389
|
var __filename2 = fileURLToPath(import.meta.url);
|
|
3370
|
-
var templateDir =
|
|
3390
|
+
var templateDir = join2(__filename2, "..", "..", "templates", "default");
|
|
3371
3391
|
if (!existsSync(templateDir)) {
|
|
3372
3392
|
Ne("Template directory not found. This is a bug in create-aixyz-app.");
|
|
3373
3393
|
process.exit(1);
|
|
3374
3394
|
}
|
|
3375
3395
|
mkdirSync(targetDir, { recursive: true });
|
|
3376
3396
|
cpSync(templateDir, targetDir, { recursive: true });
|
|
3377
|
-
generateIcon(
|
|
3397
|
+
generateIcon(join2(targetDir, "app", "icon.svg"));
|
|
3398
|
+
if (opts.agentsMd) {
|
|
3399
|
+
generateAgentFiles(targetDir);
|
|
3400
|
+
}
|
|
3378
3401
|
if (!includeErc8004) {
|
|
3379
|
-
const erc8004Path =
|
|
3402
|
+
const erc8004Path = join2(targetDir, "app", "erc-8004.ts");
|
|
3380
3403
|
if (existsSync(erc8004Path)) {
|
|
3381
3404
|
rmSync(erc8004Path);
|
|
3382
3405
|
}
|
|
3383
3406
|
}
|
|
3384
|
-
var gitignoreSrc =
|
|
3407
|
+
var gitignoreSrc = join2(targetDir, "gitignore");
|
|
3385
3408
|
if (existsSync(gitignoreSrc)) {
|
|
3386
|
-
renameSync(gitignoreSrc,
|
|
3409
|
+
renameSync(gitignoreSrc, join2(targetDir, ".gitignore"));
|
|
3387
3410
|
}
|
|
3388
|
-
var envLocalSrc =
|
|
3411
|
+
var envLocalSrc = join2(targetDir, "env.local");
|
|
3389
3412
|
if (existsSync(envLocalSrc)) {
|
|
3390
3413
|
rmSync(envLocalSrc);
|
|
3391
3414
|
}
|
|
3392
3415
|
var envContent = openaiApiKey ? `OPENAI_API_KEY=${openaiApiKey}
|
|
3393
3416
|
` : `OPENAI_API_KEY=
|
|
3394
3417
|
`;
|
|
3395
|
-
|
|
3418
|
+
writeFileSync3(join2(targetDir, ".env.local"), envContent);
|
|
3396
3419
|
var filesToReplace = ["package.json", "aixyz.config.ts", "README.md"];
|
|
3397
3420
|
for (const file of filesToReplace) {
|
|
3398
|
-
const filePath =
|
|
3421
|
+
const filePath = join2(targetDir, file);
|
|
3399
3422
|
if (existsSync(filePath)) {
|
|
3400
3423
|
let content = readFileSync(filePath, "utf-8");
|
|
3401
3424
|
content = content.replaceAll("{{PKG_NAME}}", pkgName);
|
|
3402
3425
|
content = content.replaceAll("{{AGENT_NAME}}", agentName);
|
|
3403
3426
|
content = content.replaceAll("{{PAY_TO}}", payTo);
|
|
3404
|
-
|
|
3427
|
+
writeFileSync3(filePath, content);
|
|
3405
3428
|
}
|
|
3406
3429
|
}
|
|
3407
3430
|
if (!opts.install) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-aixyz-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Payment-native SDK for AI Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/bun": "^1.3.9",
|
|
35
35
|
"@types/node": "^22",
|
|
36
36
|
"ai": "^6",
|
|
37
|
-
"aixyz": "0.
|
|
37
|
+
"aixyz": "0.28.0",
|
|
38
38
|
"typescript": "^5",
|
|
39
39
|
"zod": "^4"
|
|
40
40
|
}
|
|
@@ -20,6 +20,20 @@ Open [http://localhost:3000/.well-known/agent-card.json](http://localhost:3000/.
|
|
|
20
20
|
|
|
21
21
|
You can start editing the agent by modifying `app/agent.ts`. The server hot-reloads as you edit the file.
|
|
22
22
|
|
|
23
|
+
## Testing
|
|
24
|
+
|
|
25
|
+
Start the dev server:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bun run dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then in another terminal, use [use-agently](https://github.com/use-agently/cli) to interact with your agent via A2A:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bun use-agently a2a send --uri http://localhost:3000/ -m "Convert 100 meters to feet"
|
|
35
|
+
```
|
|
36
|
+
|
|
23
37
|
## Learn More
|
|
24
38
|
|
|
25
39
|
To learn more about aixyz, take a look at the following resources:
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@ai-sdk/openai": "^3",
|
|
10
10
|
"ai": "^6",
|
|
11
|
-
"aixyz": "0.
|
|
11
|
+
"aixyz": "0.28.0",
|
|
12
12
|
"zod": "^4"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/bun": "^1",
|
|
16
|
-
"typescript": "^5"
|
|
16
|
+
"typescript": "^5",
|
|
17
|
+
"use-agently": "latest"
|
|
17
18
|
}
|
|
18
19
|
}
|