struere 0.3.9 → 0.3.11
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/bin/struere.js +66 -9
- package/dist/cli/index.js +66 -9
- package/package.json +1 -1
package/dist/bin/struere.js
CHANGED
|
@@ -18116,7 +18116,7 @@ import { join as join6 } from "path";
|
|
|
18116
18116
|
async function loadAgent(cwd) {
|
|
18117
18117
|
const agentPath = join6(cwd, "src/agent.ts");
|
|
18118
18118
|
try {
|
|
18119
|
-
const module = await import(agentPath);
|
|
18119
|
+
const module = await import(`${agentPath}?t=${Date.now()}`);
|
|
18120
18120
|
const agent = module.default || module;
|
|
18121
18121
|
if (!agent.name) {
|
|
18122
18122
|
throw new Error("Agent must have a name");
|
|
@@ -18294,12 +18294,30 @@ async function interactiveSetup(cwd) {
|
|
|
18294
18294
|
console.log();
|
|
18295
18295
|
}
|
|
18296
18296
|
spinner.start("Fetching agents");
|
|
18297
|
-
|
|
18297
|
+
let { agents: existingAgents, error: listError } = await listAgents();
|
|
18298
18298
|
if (listError) {
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18299
|
+
const isAuthError = listError.includes("Unauthenticated") || listError.includes("OIDC") || listError.includes("token") || listError.includes("expired");
|
|
18300
|
+
if (isAuthError) {
|
|
18301
|
+
spinner.fail("Session expired");
|
|
18302
|
+
console.log();
|
|
18303
|
+
console.log(source_default.gray("Re-authenticating..."));
|
|
18304
|
+
clearCredentials();
|
|
18305
|
+
credentials = await performLogin();
|
|
18306
|
+
if (!credentials) {
|
|
18307
|
+
console.log(source_default.red("Authentication failed"));
|
|
18308
|
+
return null;
|
|
18309
|
+
}
|
|
18310
|
+
spinner.start("Fetching agents");
|
|
18311
|
+
const retryResult = await listAgents();
|
|
18312
|
+
existingAgents = retryResult.agents;
|
|
18313
|
+
listError = retryResult.error;
|
|
18314
|
+
}
|
|
18315
|
+
if (listError) {
|
|
18316
|
+
spinner.fail("Failed to fetch agents");
|
|
18317
|
+
console.log();
|
|
18318
|
+
console.log(source_default.red("Error:"), listError);
|
|
18319
|
+
return null;
|
|
18320
|
+
}
|
|
18303
18321
|
}
|
|
18304
18322
|
const agents = existingAgents.map((a) => ({ id: a._id, name: a.name, slug: a.slug }));
|
|
18305
18323
|
spinner.succeed(`Found ${agents.length} existing agent(s)`);
|
|
@@ -18332,11 +18350,33 @@ async function interactiveSetup(cwd) {
|
|
|
18332
18350
|
const name = await promptText2("Agent name:", projectName);
|
|
18333
18351
|
const displayName = name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
18334
18352
|
spinner.start("Creating agent");
|
|
18335
|
-
|
|
18353
|
+
let { agentId, error: createError } = await createAgent({
|
|
18336
18354
|
name: displayName,
|
|
18337
18355
|
slug: name,
|
|
18338
18356
|
description: `${displayName} Agent`
|
|
18339
18357
|
});
|
|
18358
|
+
if (createError) {
|
|
18359
|
+
const isAuthError = createError.includes("Unauthenticated") || createError.includes("OIDC") || createError.includes("token") || createError.includes("expired");
|
|
18360
|
+
if (isAuthError) {
|
|
18361
|
+
spinner.fail("Session expired");
|
|
18362
|
+
console.log();
|
|
18363
|
+
console.log(source_default.gray("Re-authenticating..."));
|
|
18364
|
+
clearCredentials();
|
|
18365
|
+
credentials = await performLogin();
|
|
18366
|
+
if (!credentials) {
|
|
18367
|
+
console.log(source_default.red("Authentication failed"));
|
|
18368
|
+
return null;
|
|
18369
|
+
}
|
|
18370
|
+
spinner.start("Creating agent");
|
|
18371
|
+
const retryResult = await createAgent({
|
|
18372
|
+
name: displayName,
|
|
18373
|
+
slug: name,
|
|
18374
|
+
description: `${displayName} Agent`
|
|
18375
|
+
});
|
|
18376
|
+
agentId = retryResult.agentId;
|
|
18377
|
+
createError = retryResult.error;
|
|
18378
|
+
}
|
|
18379
|
+
}
|
|
18340
18380
|
if (createError || !agentId) {
|
|
18341
18381
|
spinner.fail("Failed to create agent");
|
|
18342
18382
|
console.log();
|
|
@@ -18365,7 +18405,24 @@ async function interactiveSetup(cwd) {
|
|
|
18365
18405
|
console.log(source_default.green("\u2713"), `Created ${file}`);
|
|
18366
18406
|
}
|
|
18367
18407
|
console.log();
|
|
18368
|
-
|
|
18408
|
+
spinner.start("Installing dependencies");
|
|
18409
|
+
try {
|
|
18410
|
+
const proc = Bun.spawn(["bun", "install"], {
|
|
18411
|
+
cwd,
|
|
18412
|
+
stdout: "pipe",
|
|
18413
|
+
stderr: "pipe"
|
|
18414
|
+
});
|
|
18415
|
+
await proc.exited;
|
|
18416
|
+
if (proc.exitCode === 0) {
|
|
18417
|
+
spinner.succeed("Dependencies installed");
|
|
18418
|
+
} else {
|
|
18419
|
+
spinner.fail("Failed to install dependencies");
|
|
18420
|
+
console.log(source_default.yellow("Run"), source_default.cyan("bun install"), source_default.yellow("manually"));
|
|
18421
|
+
}
|
|
18422
|
+
} catch {
|
|
18423
|
+
spinner.fail("Failed to install dependencies");
|
|
18424
|
+
console.log(source_default.yellow("Run"), source_default.cyan("bun install"), source_default.yellow("manually"));
|
|
18425
|
+
}
|
|
18369
18426
|
}
|
|
18370
18427
|
console.log();
|
|
18371
18428
|
return projectData;
|
|
@@ -19090,7 +19147,7 @@ var whoamiCommand = new Command("whoami").description("Show current logged in us
|
|
|
19090
19147
|
// package.json
|
|
19091
19148
|
var package_default = {
|
|
19092
19149
|
name: "struere",
|
|
19093
|
-
version: "0.3.
|
|
19150
|
+
version: "0.3.11",
|
|
19094
19151
|
description: "Build, test, and deploy AI agents",
|
|
19095
19152
|
keywords: [
|
|
19096
19153
|
"ai",
|
package/dist/cli/index.js
CHANGED
|
@@ -1458,7 +1458,7 @@ import { join as join6 } from "path";
|
|
|
1458
1458
|
async function loadAgent(cwd) {
|
|
1459
1459
|
const agentPath = join6(cwd, "src/agent.ts");
|
|
1460
1460
|
try {
|
|
1461
|
-
const module = await import(agentPath);
|
|
1461
|
+
const module = await import(`${agentPath}?t=${Date.now()}`);
|
|
1462
1462
|
const agent = module.default || module;
|
|
1463
1463
|
if (!agent.name) {
|
|
1464
1464
|
throw new Error("Agent must have a name");
|
|
@@ -1636,12 +1636,30 @@ async function interactiveSetup(cwd) {
|
|
|
1636
1636
|
console.log();
|
|
1637
1637
|
}
|
|
1638
1638
|
spinner.start("Fetching agents");
|
|
1639
|
-
|
|
1639
|
+
let { agents: existingAgents, error: listError } = await listAgents();
|
|
1640
1640
|
if (listError) {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1641
|
+
const isAuthError = listError.includes("Unauthenticated") || listError.includes("OIDC") || listError.includes("token") || listError.includes("expired");
|
|
1642
|
+
if (isAuthError) {
|
|
1643
|
+
spinner.fail("Session expired");
|
|
1644
|
+
console.log();
|
|
1645
|
+
console.log(chalk3.gray("Re-authenticating..."));
|
|
1646
|
+
clearCredentials();
|
|
1647
|
+
credentials = await performLogin();
|
|
1648
|
+
if (!credentials) {
|
|
1649
|
+
console.log(chalk3.red("Authentication failed"));
|
|
1650
|
+
return null;
|
|
1651
|
+
}
|
|
1652
|
+
spinner.start("Fetching agents");
|
|
1653
|
+
const retryResult = await listAgents();
|
|
1654
|
+
existingAgents = retryResult.agents;
|
|
1655
|
+
listError = retryResult.error;
|
|
1656
|
+
}
|
|
1657
|
+
if (listError) {
|
|
1658
|
+
spinner.fail("Failed to fetch agents");
|
|
1659
|
+
console.log();
|
|
1660
|
+
console.log(chalk3.red("Error:"), listError);
|
|
1661
|
+
return null;
|
|
1662
|
+
}
|
|
1645
1663
|
}
|
|
1646
1664
|
const agents = existingAgents.map((a) => ({ id: a._id, name: a.name, slug: a.slug }));
|
|
1647
1665
|
spinner.succeed(`Found ${agents.length} existing agent(s)`);
|
|
@@ -1674,11 +1692,33 @@ async function interactiveSetup(cwd) {
|
|
|
1674
1692
|
const name = await promptText2("Agent name:", projectName);
|
|
1675
1693
|
const displayName = name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1676
1694
|
spinner.start("Creating agent");
|
|
1677
|
-
|
|
1695
|
+
let { agentId, error: createError } = await createAgent({
|
|
1678
1696
|
name: displayName,
|
|
1679
1697
|
slug: name,
|
|
1680
1698
|
description: `${displayName} Agent`
|
|
1681
1699
|
});
|
|
1700
|
+
if (createError) {
|
|
1701
|
+
const isAuthError = createError.includes("Unauthenticated") || createError.includes("OIDC") || createError.includes("token") || createError.includes("expired");
|
|
1702
|
+
if (isAuthError) {
|
|
1703
|
+
spinner.fail("Session expired");
|
|
1704
|
+
console.log();
|
|
1705
|
+
console.log(chalk3.gray("Re-authenticating..."));
|
|
1706
|
+
clearCredentials();
|
|
1707
|
+
credentials = await performLogin();
|
|
1708
|
+
if (!credentials) {
|
|
1709
|
+
console.log(chalk3.red("Authentication failed"));
|
|
1710
|
+
return null;
|
|
1711
|
+
}
|
|
1712
|
+
spinner.start("Creating agent");
|
|
1713
|
+
const retryResult = await createAgent({
|
|
1714
|
+
name: displayName,
|
|
1715
|
+
slug: name,
|
|
1716
|
+
description: `${displayName} Agent`
|
|
1717
|
+
});
|
|
1718
|
+
agentId = retryResult.agentId;
|
|
1719
|
+
createError = retryResult.error;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1682
1722
|
if (createError || !agentId) {
|
|
1683
1723
|
spinner.fail("Failed to create agent");
|
|
1684
1724
|
console.log();
|
|
@@ -1707,7 +1747,24 @@ async function interactiveSetup(cwd) {
|
|
|
1707
1747
|
console.log(chalk3.green("\u2713"), `Created ${file}`);
|
|
1708
1748
|
}
|
|
1709
1749
|
console.log();
|
|
1710
|
-
|
|
1750
|
+
spinner.start("Installing dependencies");
|
|
1751
|
+
try {
|
|
1752
|
+
const proc = Bun.spawn(["bun", "install"], {
|
|
1753
|
+
cwd,
|
|
1754
|
+
stdout: "pipe",
|
|
1755
|
+
stderr: "pipe"
|
|
1756
|
+
});
|
|
1757
|
+
await proc.exited;
|
|
1758
|
+
if (proc.exitCode === 0) {
|
|
1759
|
+
spinner.succeed("Dependencies installed");
|
|
1760
|
+
} else {
|
|
1761
|
+
spinner.fail("Failed to install dependencies");
|
|
1762
|
+
console.log(chalk3.yellow("Run"), chalk3.cyan("bun install"), chalk3.yellow("manually"));
|
|
1763
|
+
}
|
|
1764
|
+
} catch {
|
|
1765
|
+
spinner.fail("Failed to install dependencies");
|
|
1766
|
+
console.log(chalk3.yellow("Run"), chalk3.cyan("bun install"), chalk3.yellow("manually"));
|
|
1767
|
+
}
|
|
1711
1768
|
}
|
|
1712
1769
|
console.log();
|
|
1713
1770
|
return projectData;
|
|
@@ -2455,7 +2512,7 @@ var whoamiCommand = new Command11("whoami").description("Show current logged in
|
|
|
2455
2512
|
// package.json
|
|
2456
2513
|
var package_default = {
|
|
2457
2514
|
name: "struere",
|
|
2458
|
-
version: "0.3.
|
|
2515
|
+
version: "0.3.11",
|
|
2459
2516
|
description: "Build, test, and deploy AI agents",
|
|
2460
2517
|
keywords: [
|
|
2461
2518
|
"ai",
|