@standardagents/cli 0.24.7 → 0.25.1

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
@@ -239,7 +239,7 @@ function getScaffoldStandardAgentsVersion() {
239
239
  if (process.env.STANDARDAGENTS_WORKSPACE === "1") {
240
240
  return "workspace:*";
241
241
  }
242
- return "0.24.7";
242
+ return "0.25.1";
243
243
  }
244
244
  function findViteConfig(cwd) {
245
245
  const candidates = ["vite.config.ts", "vite.config.js", "vite.config.mts", "vite.config.mjs"];
@@ -983,6 +983,11 @@ async function selectInitAuthModeWithInk(context = {}) {
983
983
 
984
984
  // src/commands/init.ts
985
985
  var DEFAULT_PLATFORM_ENDPOINT = "https://api.standardagents.ai";
986
+ var DEFAULT_ONBOARDING_URL = "https://platform.standardagents.ai/projects/new";
987
+ var KNOWN_PLATFORM_ONBOARDING_URLS = {
988
+ "https://api.standardagents.ai": DEFAULT_ONBOARDING_URL,
989
+ "https://platform.standardagents.ai": DEFAULT_ONBOARDING_URL
990
+ };
986
991
  var INIT_TUI_ENV_VAR = "STANDARDAGENTS_INIT_TUI";
987
992
  var GENERATED_STANDARD_AGENTS_PACKAGES = [
988
993
  "@standardagents/builder",
@@ -1529,7 +1534,7 @@ async function ensurePlatformAuth(options, quietLogs = false, context = {}) {
1529
1534
  return { connected: true, mode: "standardagents" };
1530
1535
  }
1531
1536
  function getCliVersion() {
1532
- return "0.24.7";
1537
+ return "0.25.1";
1533
1538
  }
1534
1539
  function getSipVersion() {
1535
1540
  return "1.0.1";
@@ -1715,13 +1720,28 @@ function isBootstrapConsumeSuccess(body) {
1715
1720
  const candidate = body;
1716
1721
  return !!(candidate && candidate.user && typeof candidate.user.id === "string" && typeof candidate.user.email === "string" && typeof candidate.user.role === "string" && candidate.account && typeof candidate.account.id === "string");
1717
1722
  }
1718
- function formatBootstrapExchangeError(status, body) {
1723
+ function onboardingUrlForEndpoint(endpoint) {
1724
+ if (!endpoint) return DEFAULT_ONBOARDING_URL;
1725
+ try {
1726
+ const origin = new URL(endpoint).origin;
1727
+ return KNOWN_PLATFORM_ONBOARDING_URLS[origin] ?? DEFAULT_ONBOARDING_URL;
1728
+ } catch {
1729
+ return DEFAULT_ONBOARDING_URL;
1730
+ }
1731
+ }
1732
+ function isBootstrapCodeFailureMessage(message) {
1733
+ return /bootstrap code/i.test(message);
1734
+ }
1735
+ function formatBootstrapExchangeError(status, body, endpoint) {
1719
1736
  const payload = body;
1720
1737
  const message = payload?.error?.message || payload?.message;
1721
- if (message) {
1722
- return `Bootstrap exchange failed (${status}): ${message}`;
1738
+ const base = message ? `Bootstrap exchange failed (${status}): ${message}` : `Bootstrap exchange failed (${status})`;
1739
+ if (message && isBootstrapCodeFailureMessage(message)) {
1740
+ const url = onboardingUrlForEndpoint(endpoint);
1741
+ return `${base}
1742
+ Bootstrap codes are single-use and expire quickly. Grab a fresh one from ${url} and run the command again.`;
1723
1743
  }
1724
- return `Bootstrap exchange failed (${status})`;
1744
+ return base;
1725
1745
  }
1726
1746
  function extractSessionCookie(response) {
1727
1747
  const headersWithSetCookie = response.headers;
@@ -1758,7 +1778,7 @@ async function exchangeBootstrapCode(endpoint, code, fetchImpl = fetch) {
1758
1778
  body = {};
1759
1779
  }
1760
1780
  if (!response.ok) {
1761
- throw new Error(formatBootstrapExchangeError(response.status, body));
1781
+ throw new Error(formatBootstrapExchangeError(response.status, body, endpoint));
1762
1782
  }
1763
1783
  if (!isBootstrapConsumeSuccess(body)) {
1764
1784
  throw new Error("Bootstrap exchange failed: invalid response payload");
@@ -4569,6 +4589,13 @@ var PROVIDER_DEFINITIONS = [
4569
4589
  label: "Groq",
4570
4590
  envKeys: ["GROQ_API_KEY"]
4571
4591
  },
4592
+ {
4593
+ name: "novita",
4594
+ packageName: "@standardagents/novita",
4595
+ exportName: "novita",
4596
+ label: "Novita AI",
4597
+ envKeys: ["NOVITA_API_KEY"]
4598
+ },
4572
4599
  {
4573
4600
  name: "openai",
4574
4601
  packageName: "@standardagents/openai",
@@ -5055,6 +5082,17 @@ password=${tokenSecret}
5055
5082
  `);
5056
5083
  }
5057
5084
  var DEFAULT_GIT_HELPER_COMMAND = "!npx -y @standardagents/cli@latest git-credential";
5085
+ var STANDARD_AGENTS_GIT_CREDENTIAL_URL_PATTERNS = [
5086
+ "https://standardagents.ai",
5087
+ "https://*.standardagents.ai",
5088
+ "https://standardagentbuilder.com",
5089
+ "https://*.standardagentbuilder.com",
5090
+ "https://artifacts.cloudflare.net",
5091
+ "https://*.artifacts.cloudflare.net",
5092
+ "https://artifacts.cloudflare.com",
5093
+ "https://*.artifacts.cloudflare.com",
5094
+ "https://git.cloudflare.com"
5095
+ ];
5058
5096
  function prompt4(question) {
5059
5097
  const rl = readline.createInterface({
5060
5098
  input: process.stdin,
@@ -5082,19 +5120,43 @@ function runGit(args, runner) {
5082
5120
  }
5083
5121
  return result;
5084
5122
  }
5123
+ function readGlobalConfigValues(runner, key) {
5124
+ const result = runner(["config", "--global", "--get-all", key]);
5125
+ if (result.status !== 0) {
5126
+ if (result.stderr.trim()) {
5127
+ throw new Error(result.stderr.trim());
5128
+ }
5129
+ return null;
5130
+ }
5131
+ if (result.stdout === "") return [];
5132
+ return result.stdout.replace(/\r?\n$/, "").split(/\r?\n/);
5133
+ }
5134
+ function isStandardAgentsHelper(value, helperCommand) {
5135
+ const trimmed = value.trim();
5136
+ return trimmed === helperCommand || trimmed.includes("@standardagents/cli") && trimmed.includes("git-credential");
5137
+ }
5085
5138
  function configureStandardAgentsGitCredentials(options = {}) {
5086
5139
  const runner = options.gitRunner ?? defaultGitRunner;
5087
5140
  const helperCommand = options.helperCommand?.trim() || process.env.STANDARD_AGENTS_GIT_HELPER || DEFAULT_GIT_HELPER_COMMAND;
5088
- const existingResult = runner(["config", "--global", "--get-all", "credential.helper"]);
5089
- if (existingResult.status !== 0 && existingResult.stderr.trim()) {
5090
- throw new Error(existingResult.stderr.trim());
5091
- }
5092
- const existing = existingResult.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
5093
5141
  let helperAdded = false;
5094
- if (!existing.includes(helperCommand)) {
5095
- runGit(["config", "--global", "--add", "credential.helper", helperCommand], runner);
5142
+ const desired = ["", helperCommand];
5143
+ for (const pattern of STANDARD_AGENTS_GIT_CREDENTIAL_URL_PATTERNS) {
5144
+ const key = `credential.${pattern}.helper`;
5145
+ const existing = readGlobalConfigValues(runner, key);
5146
+ if (existing && existing.length === desired.length && existing.every((value, i) => value === desired[i])) {
5147
+ continue;
5148
+ }
5149
+ if (existing !== null) {
5150
+ runGit(["config", "--global", "--unset-all", key], runner);
5151
+ }
5152
+ runGit(["config", "--global", "--add", key, ""], runner);
5153
+ runGit(["config", "--global", "--add", key, helperCommand], runner);
5096
5154
  helperAdded = true;
5097
5155
  }
5156
+ const generic = readGlobalConfigValues(runner, "credential.helper") ?? [];
5157
+ for (const value of new Set(generic.filter((entry) => isStandardAgentsHelper(entry, helperCommand)))) {
5158
+ runner(["config", "--global", "--unset-all", "--fixed-value", "credential.helper", value]);
5159
+ }
5098
5160
  runGit(["config", "--global", "credential.useHttpPath", "true"], runner);
5099
5161
  return { helperCommand, helperAdded };
5100
5162
  }
@@ -5195,7 +5257,7 @@ async function settleStdinForInitHandoff(stdin = process.stdin) {
5195
5257
  }
5196
5258
  }
5197
5259
  var program = new Command();
5198
- program.name("agents").description("CLI tool for Standard Agents / AgentBuilder").version("0.24.7");
5260
+ program.name("agents").description("CLI tool for Standard Agents / AgentBuilder").version("0.25.1");
5199
5261
  program.command("init [project-name]").description("Create a new Standard Agents project").option("-y, --yes", "Skip prompts and use defaults").option("--local", "Use local project scaffolding instead of browser platform onboarding").option("--cli", "Use classic line-by-line CLI prompts instead of the TUI wizard").option("--api-url <url>", "Standard Agents platform API URL").option("--endpoint <url>", "Platform API endpoint for auth/bootstrap exchange").option("--package-manager <manager>", "Package manager for generated project: npm, pnpm, yarn, or bun").option("--template <template>", "Vite template to use", "vanilla-ts").option("--workspace", "Install @standardagents packages as workspace:* (local pnpm workspace development)").option("--no-dev", "Clone and configure the project without starting the dev server").addOption(new Option("--bootstrap <code>", "Exchange a web onboarding bootstrap code")).action(init);
5200
5262
  program.command("login").description("Authenticate this machine (or use --bootstrap for project bootstrap auth)").option("--bootstrap <code>", "Bootstrap code from web onboarding").option("--endpoint <url>", "Platform API endpoint (default: https://api.standardagents.ai)").option("--no-open", "Do not auto-open browser URL").action(login);
5201
5263
  program.command("logout").description("Clear stored StandardAgents auth and local org-scoped project auth").option("--org <org-id-or-slug>", "Org ID or slug to logout (defaults to active org)").option("--endpoint <url>", "Platform API endpoint (default: https://api.standardagents.ai)").action(logout);