@standardagents/cli 0.45.7 → 0.45.8

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
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command, Option, CommanderError } from 'commander';
3
- import path18 from 'path';
4
- import fs13 from 'fs';
3
+ import path19 from 'path';
4
+ import fs14 from 'fs';
5
+ import { applyEdits, modify, parse as parse$1 } from 'jsonc-parser';
6
+ import { LOCKSTEP_FRAMEWORK_PACKAGES, STANDARD_AGENTS_NPM_SCOPE, FIRST_PARTY_PROVIDER_PACKAGES, AGENT_DOCS, BUILD_GUARD_SCRIPT, renderPnpmWorkspaceYaml, renderAgentBuilderSupportFiles, STANDARD_AGENTS_NPM_REGISTRY, ROOT_AGENTS_MD_UNLINKED, renderAgentSkill } from '@standardagents/agentbuilder-template';
5
7
  import { fileURLToPath, pathToFileURL } from 'url';
6
8
  import crypto2, { createHash } from 'crypto';
7
9
  import childProcess, { spawn, spawnSync, execFileSync } from 'child_process';
8
10
  import os5 from 'os';
9
11
  import net from 'net';
10
- import { STANDARD_AGENTS_NPM_SCOPE, FIRST_PARTY_PROVIDER_PACKAGES, AGENT_DOCS, BUILD_GUARD_SCRIPT, renderPnpmWorkspaceYaml, renderAgentBuilderSupportFiles, STANDARD_AGENTS_NPM_REGISTRY, ROOT_AGENTS_MD_UNLINKED } from '@standardagents/agentbuilder-template';
11
12
  import chalk from 'chalk';
12
13
  import { parse, parseDocument, visit, isScalar, isNode, isMap } from 'yaml';
13
- import { parse as parse$1, applyEdits, modify } from 'jsonc-parser';
14
14
  import { loadFile, writeFile, generateCode, builders } from 'magicast';
15
15
  import { addVitePlugin, getDefaultExportOptions } from 'magicast/helpers';
16
16
  import { useState, useMemo } from 'react';
@@ -20,47 +20,276 @@ import readline from 'readline';
20
20
  import { createRequire } from 'module';
21
21
  import { copySkill } from '@standardagents/skill';
22
22
 
23
+ // src/utils/platform-endpoint.ts
24
+ var DEFAULT_PLATFORM_ENDPOINT = "https://api.standardagents.ai";
25
+ var PLATFORM_ENDPOINT_ENV_KEYS = [
26
+ "STANDARD_AGENTS_API_URL",
27
+ "PLATFORM_ENDPOINT",
28
+ "STANDARD_AGENTS_PLATFORM_URL"
29
+ ];
30
+ function normalizePlatformEndpoint(value) {
31
+ return value.trim().replace(/\/+$/, "");
32
+ }
33
+ var PlatformEndpointError = class extends Error {
34
+ constructor(message) {
35
+ super(message);
36
+ this.name = "PlatformEndpointError";
37
+ }
38
+ };
39
+ function displayEndpoint(value) {
40
+ const trimmed = value.trim();
41
+ try {
42
+ const url = new URL(trimmed);
43
+ if (url.protocol === "http:" || url.protocol === "https:") {
44
+ url.username = "";
45
+ url.password = "";
46
+ url.search = "";
47
+ url.hash = "";
48
+ return url.toString().replace(/\/+$/, "");
49
+ }
50
+ } catch {
51
+ }
52
+ return trimmed.replace(/^[^@/\s]*@/, "").replace(/[?#].*$/, "");
53
+ }
54
+ function isLoopbackHost(hostname) {
55
+ const host = hostname.toLowerCase();
56
+ return host === "localhost" || host.endsWith(".localhost") || host === "[::1]" || /^127(\.\d{1,3}){3}$/.test(host);
57
+ }
58
+ function platformEndpointProblem(value, noun = "platform endpoint") {
59
+ const shown = displayEndpoint(value);
60
+ let url;
61
+ try {
62
+ url = new URL(value.trim());
63
+ } catch {
64
+ return `The ${noun} "${shown}" is not a URL.
65
+ Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
66
+ }
67
+ if (url.protocol !== "https:" && url.protocol !== "http:") {
68
+ return `The ${noun} ${shown} is not an HTTPS URL.
69
+ Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
70
+ }
71
+ if (url.username || url.password) {
72
+ return `The ${noun} ${shown} must not contain a user name or password.
73
+ Use ${shown}`;
74
+ }
75
+ if (url.protocol === "http:" && !isLoopbackHost(url.hostname)) {
76
+ return `The ${noun} ${shown} is not HTTPS. The CLI sends a credential only to an HTTPS endpoint, or to plain HTTP on this machine (localhost, 127.0.0.1, [::1]).
77
+ Use ${shown.replace(/^http:/i, "https:")}`;
78
+ }
79
+ return null;
80
+ }
81
+ function assertSafePlatformEndpoint(endpoint) {
82
+ const problem = platformEndpointProblem(endpoint);
83
+ if (problem) throw new PlatformEndpointError(problem);
84
+ return endpoint;
85
+ }
86
+ function platformEndpointFrom(source) {
87
+ for (const key of PLATFORM_ENDPOINT_ENV_KEYS) {
88
+ const value = normalizePlatformEndpoint(source[key] ?? "");
89
+ if (value) return value;
90
+ }
91
+ return void 0;
92
+ }
93
+ function configuredPlatformEndpoint(flag, ...fallbackSources) {
94
+ const explicit = normalizePlatformEndpoint(flag ?? "");
95
+ if (explicit) return assertSafePlatformEndpoint(explicit);
96
+ for (const source of [process.env, ...fallbackSources]) {
97
+ const value = platformEndpointFrom(source);
98
+ if (value) return assertSafePlatformEndpoint(value);
99
+ }
100
+ return void 0;
101
+ }
102
+ function resolvePlatformEndpoint(flag) {
103
+ return configuredPlatformEndpoint(flag) ?? DEFAULT_PLATFORM_ENDPOINT;
104
+ }
105
+
106
+ // src/utils/platform-request.ts
107
+ var REQUEST_TIMEOUT_MS = 3e4;
108
+ function requestHost(url) {
109
+ try {
110
+ return new URL(url).host;
111
+ } catch {
112
+ return "the server";
113
+ }
114
+ }
115
+ var RequestTimeoutError = class extends Error {
116
+ constructor(host, timeoutMs, next) {
117
+ super(`${host} did not answer within ${Math.round(timeoutMs / 1e3)} seconds.
118
+ ${next}`);
119
+ this.host = host;
120
+ this.timeoutMs = timeoutMs;
121
+ this.name = "RequestTimeoutError";
122
+ }
123
+ };
124
+ var RedirectRefusedError = class extends Error {
125
+ constructor(host, status2, next) {
126
+ super(
127
+ `${host} answered with a redirect (HTTP ${status2}). The CLI does not follow a redirect with your sign-in.
128
+ ${next}`
129
+ );
130
+ this.host = host;
131
+ this.status = status2;
132
+ this.name = "RedirectRefusedError";
133
+ }
134
+ };
135
+ var BODILESS_STATUSES = /* @__PURE__ */ new Set([101, 204, 205, 304]);
136
+ async function fetchWithDeadline(url, init2 = {}, options) {
137
+ const timeoutMs = options.timeoutMs ?? REQUEST_TIMEOUT_MS;
138
+ const deadlineController = new AbortController();
139
+ const timer = setTimeout(() => deadlineController.abort(), timeoutMs);
140
+ const deadline = deadlineController.signal;
141
+ const signal = init2.signal ? AbortSignal.any([init2.signal, deadline]) : deadline;
142
+ try {
143
+ const response = await (options.fetchImpl ?? fetch)(url, { ...init2, signal });
144
+ if (!(response instanceof Response)) return response;
145
+ const body = await response.arrayBuffer();
146
+ return new Response(BODILESS_STATUSES.has(response.status) ? null : body, {
147
+ status: response.status,
148
+ statusText: response.statusText,
149
+ headers: response.headers
150
+ });
151
+ } catch (error) {
152
+ if (deadline.aborted && !init2.signal?.aborted) {
153
+ throw new RequestTimeoutError(requestHost(url), timeoutMs, options.next);
154
+ }
155
+ throw error;
156
+ } finally {
157
+ clearTimeout(timer);
158
+ }
159
+ }
160
+ async function credentialFetch(url, init2, options) {
161
+ const response = await fetchWithDeadline(url, { redirect: "manual", ...init2 }, options);
162
+ if (response.status >= 300 && response.status < 400) {
163
+ throw new RedirectRefusedError(requestHost(url), response.status, options.next);
164
+ }
165
+ return response;
166
+ }
167
+ async function platformFetch(endpoint, pathname, init2, options) {
168
+ assertSafePlatformEndpoint(endpoint);
169
+ return credentialFetch(`${endpoint}${pathname}`, init2, options);
170
+ }
171
+
172
+ // src/utils/framework-versions.ts
173
+ var PUBLIC_NPM_REGISTRY = "https://registry.npmjs.org";
174
+ var SCOPE_REGISTRY_ENV = "npm_config_@standardagents:registry";
175
+ var BUILDER_PACKUMENT_PATH = "/@standardagents%2Fbuilder";
176
+ var LATEST_LOOKUP_TIMEOUT_MS = 1e4;
177
+ var EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
178
+ var DEPENDENCY_SECTIONS = ["dependencies", "devDependencies", "optionalDependencies"];
179
+ var FRAMEWORK_PACKAGES = new Set(LOCKSTEP_FRAMEWORK_PACKAGES);
180
+ function isExactVersion(specifier) {
181
+ return EXACT_VERSION.test(specifier);
182
+ }
183
+ function isPrereleaseVersion(specifier) {
184
+ return isExactVersion(specifier) && specifier.includes("-");
185
+ }
186
+ function frameworkRegistry(env = process.env) {
187
+ const key = Object.keys(env).find((name) => name.toLowerCase() === SCOPE_REGISTRY_ENV);
188
+ const override = key ? env[key]?.trim() : void 0;
189
+ if (override && /^https?:\/\//i.test(override)) return override.replace(/\/+$/, "");
190
+ return PUBLIC_NPM_REGISTRY;
191
+ }
192
+ function hasLatestTag(value) {
193
+ if (typeof value !== "object" || value === null || !("dist-tags" in value)) return false;
194
+ const tags = value["dist-tags"];
195
+ return typeof tags === "object" && tags !== null && "latest" in tags;
196
+ }
197
+ async function resolveLatestFrameworkVersion(options = {}) {
198
+ const url = `${frameworkRegistry(options.env)}${BUILDER_PACKUMENT_PATH}`;
199
+ const host = requestHost(url);
200
+ try {
201
+ const response = await fetchWithDeadline(
202
+ url,
203
+ { headers: { Accept: "application/vnd.npm.install-v1+json, application/json" } },
204
+ {
205
+ fetchImpl: options.fetchImpl,
206
+ timeoutMs: options.timeoutMs ?? LATEST_LOOKUP_TIMEOUT_MS,
207
+ next: "Check your network connection."
208
+ }
209
+ );
210
+ if (!response.ok) return { version: null, reason: `${host} answered HTTP ${response.status}.` };
211
+ const body = await response.json();
212
+ const latest = hasLatestTag(body) ? body["dist-tags"].latest : void 0;
213
+ if (typeof latest !== "string" || !isExactVersion(latest)) {
214
+ return { version: null, reason: `${host} did not name a latest release.` };
215
+ }
216
+ return { version: latest };
217
+ } catch (error) {
218
+ const detail = error instanceof Error ? error.message.split("\n")[0] : String(error);
219
+ return { version: null, reason: detail.includes(host) ? detail : `${host} could not be reached (${detail}).` };
220
+ }
221
+ }
222
+ function isRegistrySpecifier(specifier) {
223
+ return typeof specifier === "string" && !specifier.includes(":") && !specifier.includes("/");
224
+ }
225
+ function pinFrameworkDependencies(projectPath, version) {
226
+ const packageJsonPath = path19.join(projectPath, "package.json");
227
+ const original = fs14.readFileSync(packageJsonPath, "utf-8");
228
+ const manifest = JSON.parse(original);
229
+ if (typeof manifest !== "object" || manifest === null) return [];
230
+ let text2 = original;
231
+ const pinned = [];
232
+ for (const section of DEPENDENCY_SECTIONS) {
233
+ const dependencies = section in manifest ? Reflect.get(manifest, section) : void 0;
234
+ if (typeof dependencies !== "object" || dependencies === null) continue;
235
+ for (const [name, specifier] of Object.entries(dependencies)) {
236
+ if (!FRAMEWORK_PACKAGES.has(name) || !isRegistrySpecifier(specifier)) continue;
237
+ pinned.push(name);
238
+ if (specifier === version) continue;
239
+ text2 = applyEdits(text2, modify(text2, [section, name], version, {
240
+ formattingOptions: { insertSpaces: true, tabSize: 2 }
241
+ }));
242
+ }
243
+ }
244
+ if (text2 !== original) fs14.writeFileSync(packageJsonPath, text2, "utf-8");
245
+ return pinned;
246
+ }
247
+ function freshInstallOptions(packageManager) {
248
+ if (packageManager === "pnpm") return { args: ["--no-frozen-lockfile"], env: {} };
249
+ if (packageManager === "yarn") return { args: [], env: { YARN_ENABLE_IMMUTABLE_INSTALLS: "false" } };
250
+ return { args: [], env: {} };
251
+ }
23
252
  function findPnpmWorkspaceRoot(startDir) {
24
253
  let currentDir = startDir;
25
254
  while (true) {
26
- if (fs13.existsSync(path18.join(currentDir, "pnpm-workspace.yaml"))) {
255
+ if (fs14.existsSync(path19.join(currentDir, "pnpm-workspace.yaml"))) {
27
256
  return currentDir;
28
257
  }
29
- const parentDir = path18.dirname(currentDir);
258
+ const parentDir = path19.dirname(currentDir);
30
259
  if (parentDir === currentDir) {
31
260
  return null;
32
261
  }
33
262
  currentDir = parentDir;
34
263
  }
35
264
  }
36
- function findStandardAgentsWorkspaceRoot(startDir = path18.dirname(fileURLToPath(import.meta.url))) {
265
+ function findStandardAgentsWorkspaceRoot(startDir = path19.dirname(fileURLToPath(import.meta.url))) {
37
266
  let currentDir = startDir;
38
267
  for (; ; ) {
39
268
  const workspaceRoot = findPnpmWorkspaceRoot(currentDir);
40
269
  if (!workspaceRoot) return null;
41
- const manifestPath = path18.join(workspaceRoot, "package.json");
270
+ const manifestPath = path19.join(workspaceRoot, "package.json");
42
271
  try {
43
- const manifest = JSON.parse(fs13.readFileSync(manifestPath, "utf8"));
272
+ const manifest = JSON.parse(fs14.readFileSync(manifestPath, "utf8"));
44
273
  if (manifest && typeof manifest === "object" && "name" in manifest && manifest.name === "standardagents") {
45
274
  return workspaceRoot;
46
275
  }
47
276
  } catch {
48
277
  }
49
- const parent = path18.dirname(workspaceRoot);
278
+ const parent = path19.dirname(workspaceRoot);
50
279
  if (parent === workspaceRoot) return null;
51
280
  currentDir = parent;
52
281
  }
53
282
  }
54
283
  function resolveStandardAgentsWorkspaceRoot(startDirs = [
55
- path18.dirname(fileURLToPath(import.meta.url)),
284
+ path19.dirname(fileURLToPath(import.meta.url)),
56
285
  process.cwd()
57
286
  ]) {
58
287
  const explicitRoot = process.env.STANDARDAGENTS_WORKSPACE_ROOT?.trim();
59
288
  if (explicitRoot) {
60
- const workspaceRoot = findStandardAgentsWorkspaceRoot(path18.resolve(explicitRoot));
289
+ const workspaceRoot = findStandardAgentsWorkspaceRoot(path19.resolve(explicitRoot));
61
290
  if (workspaceRoot) return workspaceRoot;
62
291
  throw new Error(
63
- `STANDARDAGENTS_WORKSPACE_ROOT=${path18.resolve(explicitRoot)} is not a Standard Agents workspace root`
292
+ `STANDARDAGENTS_WORKSPACE_ROOT=${path19.resolve(explicitRoot)} is not a Standard Agents workspace root`
64
293
  );
65
294
  }
66
295
  for (const startDir of startDirs) {
@@ -70,14 +299,14 @@ function resolveStandardAgentsWorkspaceRoot(startDirs = [
70
299
  return null;
71
300
  }
72
301
  function workspacePackageDir(workspaceRoot, packageName) {
73
- return path18.join(workspaceRoot, "packages", packageName.replace("@standardagents/", ""));
302
+ return path19.join(workspaceRoot, "packages", packageName.replace("@standardagents/", ""));
74
303
  }
75
304
  function validateWorkspacePackageDir(packageName, packageDir) {
76
- const dependencyPackageJsonPath = path18.join(packageDir, "package.json");
77
- if (!fs13.existsSync(dependencyPackageJsonPath)) {
305
+ const dependencyPackageJsonPath = path19.join(packageDir, "package.json");
306
+ if (!fs14.existsSync(dependencyPackageJsonPath)) {
78
307
  throw new Error(`Could not find workspace package for ${packageName} at ${packageDir}`);
79
308
  }
80
- const manifest = JSON.parse(fs13.readFileSync(dependencyPackageJsonPath, "utf8"));
309
+ const manifest = JSON.parse(fs14.readFileSync(dependencyPackageJsonPath, "utf8"));
81
310
  const name = manifest && typeof manifest === "object" && "name" in manifest ? manifest.name : void 0;
82
311
  if (name !== packageName) {
83
312
  throw new Error(`Expected ${packageDir} to contain ${packageName}, found ${String(name ?? "unknown package")}`);
@@ -150,8 +379,8 @@ function ignoredByGit(projectPath) {
150
379
  return new Set(result.lines);
151
380
  }
152
381
  function coveredByGitignoreText(projectPath) {
153
- const gitignorePath = path18.join(projectPath, ".gitignore");
154
- const lines = fs13.existsSync(gitignorePath) ? fs13.readFileSync(gitignorePath, "utf8").split(/\r?\n/) : [];
382
+ const gitignorePath = path19.join(projectPath, ".gitignore");
383
+ const lines = fs14.existsSync(gitignorePath) ? fs14.readFileSync(gitignorePath, "utf8").split(/\r?\n/) : [];
155
384
  const lastNegation = lines.map((line) => line.startsWith("!")).lastIndexOf(true);
156
385
  const finalRules = new Set(lines.slice(lastNegation + 1));
157
386
  return new Set(
@@ -159,7 +388,7 @@ function coveredByGitignoreText(projectPath) {
159
388
  );
160
389
  }
161
390
  function isSymbolicLink(filePath) {
162
- return fs13.lstatSync(filePath, { throwIfNoEntry: false })?.isSymbolicLink() ?? false;
391
+ return fs14.lstatSync(filePath, { throwIfNoEntry: false })?.isSymbolicLink() ?? false;
163
392
  }
164
393
  function notIgnoredError(paths, reason) {
165
394
  return new Error([
@@ -168,10 +397,10 @@ function notIgnoredError(paths, reason) {
168
397
  ].join("\n"));
169
398
  }
170
399
  function appendGitignoreEntries(projectPath, entries) {
171
- const gitignorePath = path18.join(projectPath, ".gitignore");
172
- const existing = fs13.existsSync(gitignorePath) ? fs13.readFileSync(gitignorePath, "utf8") : "";
400
+ const gitignorePath = path19.join(projectPath, ".gitignore");
401
+ const existing = fs14.existsSync(gitignorePath) ? fs14.readFileSync(gitignorePath, "utf8") : "";
173
402
  const separator = existing.length === 0 ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
174
- fs13.appendFileSync(gitignorePath, `${separator}${GITIGNORE_HEADING}
403
+ fs14.appendFileSync(gitignorePath, `${separator}${GITIGNORE_HEADING}
175
404
  ${entries.join("\n")}
176
405
  `);
177
406
  }
@@ -189,7 +418,7 @@ function protectProjectCredentialFiles(projectPath) {
189
418
  ].join("\n"));
190
419
  }
191
420
  }
192
- const linkedGitignore = isSymbolicLink(path18.join(projectPath, ".gitignore"));
421
+ const linkedGitignore = isSymbolicLink(path19.join(projectPath, ".gitignore"));
193
422
  const covered = insideGit ? ignoredByGit(projectPath) : linkedGitignore ? /* @__PURE__ */ new Set() : coveredByGitignoreText(projectPath);
194
423
  const missing = CREDENTIAL_FILES.filter((file) => !covered.has(file.path));
195
424
  if (missing.length === 0) return { ignored: [] };
@@ -214,12 +443,12 @@ function protectProjectCredentialFiles(projectPath) {
214
443
  return { ignored: entries };
215
444
  }
216
445
  function writePrivateFileSync(filePath, content) {
217
- const descriptor = fs13.openSync(filePath, "w", 384);
446
+ const descriptor = fs14.openSync(filePath, "w", 384);
218
447
  try {
219
- fs13.fchmodSync(descriptor, 384);
220
- fs13.writeFileSync(descriptor, content, "utf8");
448
+ fs14.fchmodSync(descriptor, 384);
449
+ fs14.writeFileSync(descriptor, content, "utf8");
221
450
  } finally {
222
- fs13.closeSync(descriptor);
451
+ fs14.closeSync(descriptor);
223
452
  }
224
453
  }
225
454
 
@@ -304,12 +533,12 @@ function collapseBlankLines(content) {
304
533
  return (result + outside(content.slice(cursor))).replace(/^\n+/, "");
305
534
  }
306
535
  function readDevVarsFile(projectPath) {
307
- const filePath = path18.join(projectPath, DEV_VARS_FILENAME);
308
- return fs13.existsSync(filePath) ? fs13.readFileSync(filePath, "utf-8") : "";
536
+ const filePath = path19.join(projectPath, DEV_VARS_FILENAME);
537
+ return fs14.existsSync(filePath) ? fs14.readFileSync(filePath, "utf-8") : "";
309
538
  }
310
539
  function writeDevVarsFile(projectPath, content, options = {}) {
311
540
  if (!options.removesCredentials) protectProjectCredentialFiles(projectPath);
312
- const filePath = path18.join(projectPath, DEV_VARS_FILENAME);
541
+ const filePath = path19.join(projectPath, DEV_VARS_FILENAME);
313
542
  writePrivateFileSync(filePath, content === "" || content.endsWith("\n") ? content : `${content}
314
543
  `);
315
544
  return filePath;
@@ -505,7 +734,7 @@ function isPackageManager(name) {
505
734
  }
506
735
  function declaredPackageManager(projectPath) {
507
736
  try {
508
- const manifest = JSON.parse(fs13.readFileSync(path18.join(projectPath, "package.json"), "utf-8"));
737
+ const manifest = JSON.parse(fs14.readFileSync(path19.join(projectPath, "package.json"), "utf-8"));
509
738
  if (!manifest || typeof manifest !== "object" || !("packageManager" in manifest)) return null;
510
739
  const declared = /^([a-z]+)@(\d+)/.exec(String(manifest.packageManager));
511
740
  return declared && isPackageManager(declared[1]) ? { name: declared[1], major: Number(declared[2]) } : null;
@@ -525,12 +754,12 @@ function globToRegExp(glob) {
525
754
  return new RegExp(`^${pattern}$`);
526
755
  }
527
756
  function isPnpmWorkspaceMember(workspaceRoot, projectPath) {
528
- const relative = path18.relative(workspaceRoot, projectPath).split(path18.sep).join("/");
757
+ const relative = path19.relative(workspaceRoot, projectPath).split(path19.sep).join("/");
529
758
  if (relative === "") return true;
530
759
  if (relative.startsWith("..")) return false;
531
760
  let packages;
532
761
  try {
533
- const workspace = parse(fs13.readFileSync(path18.join(workspaceRoot, "pnpm-workspace.yaml"), "utf-8"));
762
+ const workspace = parse(fs14.readFileSync(path19.join(workspaceRoot, "pnpm-workspace.yaml"), "utf-8"));
534
763
  packages = workspace && typeof workspace === "object" && "packages" in workspace ? workspace.packages : void 0;
535
764
  } catch {
536
765
  return false;
@@ -546,7 +775,7 @@ function inferProjectPackageManager(projectPath) {
546
775
  const declared = declaredPackageManager(projectPath);
547
776
  if (declared) return declared.name;
548
777
  for (const [lockfile, packageManager] of LOCKFILES) {
549
- if (fs13.existsSync(path18.join(projectPath, lockfile))) return packageManager;
778
+ if (fs14.existsSync(path19.join(projectPath, lockfile))) return packageManager;
550
779
  }
551
780
  const workspaceRoot = findPnpmWorkspaceRoot(projectPath);
552
781
  return workspaceRoot && isPnpmWorkspaceMember(workspaceRoot, projectPath) ? "pnpm" : void 0;
@@ -772,11 +1001,11 @@ function isPrivateRegistry(value) {
772
1001
  }
773
1002
  function yarnrcFiles(projectPath) {
774
1003
  const files = [];
775
- for (let directory = path18.resolve(projectPath); ; directory = path18.dirname(directory)) {
776
- files.push(path18.join(directory, ".yarnrc.yml"));
777
- if (path18.dirname(directory) === directory) break;
1004
+ for (let directory = path19.resolve(projectPath); ; directory = path19.dirname(directory)) {
1005
+ files.push(path19.join(directory, ".yarnrc.yml"));
1006
+ if (path19.dirname(directory) === directory) break;
778
1007
  }
779
- const homeFile = path18.join(os5.homedir(), ".yarnrc.yml");
1008
+ const homeFile = path19.join(os5.homedir(), ".yarnrc.yml");
780
1009
  return files.includes(homeFile) ? files : [...files, homeFile];
781
1010
  }
782
1011
  function yarnCredentialsBoundToScope(projectPath, env = process.env) {
@@ -784,10 +1013,10 @@ function yarnCredentialsBoundToScope(projectPath, env = process.env) {
784
1013
  const topLevelSources = AUTH_ENVIRONMENT.filter((name) => isSet(env[name]));
785
1014
  let privateDefaultRegistry = isPrivateRegistry(env.YARN_NPM_REGISTRY_SERVER);
786
1015
  for (const file of yarnrcFiles(projectPath)) {
787
- if (!fs13.existsSync(file)) continue;
1016
+ if (!fs14.existsSync(file)) continue;
788
1017
  let config;
789
1018
  try {
790
- config = parse(fs13.readFileSync(file, "utf-8"), { merge: true });
1019
+ config = parse(fs14.readFileSync(file, "utf-8"), { merge: true });
791
1020
  } catch {
792
1021
  scopeSources.push(`${file} (unreadable)`);
793
1022
  continue;
@@ -810,14 +1039,14 @@ function refuse(plan, step, required) {
810
1039
  if (required) plan.blocked = true;
811
1040
  }
812
1041
  function planNpmrc(npmrcPath, plan) {
813
- const stat = fs13.lstatSync(npmrcPath, { throwIfNoEntry: false });
1042
+ const stat = fs14.lstatSync(npmrcPath, { throwIfNoEntry: false });
814
1043
  if (!stat) {
815
1044
  plan.writes.push({ filePath: npmrcPath, text: `${SCOPE_REGISTRY_PIN}
816
1045
  ` });
817
1046
  return;
818
1047
  }
819
1048
  if (stat.isSymbolicLink()) {
820
- const target = fs13.existsSync(npmrcPath) ? fs13.readFileSync(npmrcPath, "utf-8") : "";
1049
+ const target = fs14.existsSync(npmrcPath) ? fs14.readFileSync(npmrcPath, "utf-8") : "";
821
1050
  if (!pinScopeRegistryInNpmrc(target).changed) return;
822
1051
  if (hasOtherNpmrcSettings(target)) {
823
1052
  refuse(plan, `${npmrcPath} is a symbolic link, so it is unchanged. Add this line to a project-owned .npmrc: ${SCOPE_REGISTRY_PIN}`, true);
@@ -827,17 +1056,17 @@ function planNpmrc(npmrcPath, plan) {
827
1056
  `, replacesLink: true });
828
1057
  return;
829
1058
  }
830
- const pinned = pinScopeRegistryInNpmrc(fs13.readFileSync(npmrcPath, "utf-8"));
1059
+ const pinned = pinScopeRegistryInNpmrc(fs14.readFileSync(npmrcPath, "utf-8"));
831
1060
  if (pinned.changed) plan.writes.push({ filePath: npmrcPath, text: pinned.text });
832
1061
  }
833
1062
  function planYaml(filePath, pin, keyPath, required, plan) {
834
1063
  const step = `Set ${keyPath.join(".")} to https://registry.npmjs.org/ in ${filePath}.`;
835
- const stat = fs13.lstatSync(filePath, { throwIfNoEntry: false });
1064
+ const stat = fs14.lstatSync(filePath, { throwIfNoEntry: false });
836
1065
  if (stat?.isSymbolicLink()) {
837
1066
  refuse(plan, `${filePath} is a symbolic link, so it is unchanged. ${step}`, required);
838
1067
  return;
839
1068
  }
840
- const pinned = pin(stat ? fs13.readFileSync(filePath, "utf-8") : "");
1069
+ const pinned = pin(stat ? fs14.readFileSync(filePath, "utf-8") : "");
841
1070
  if (pinned === null) {
842
1071
  refuse(plan, `The CLI cannot edit ${filePath} safely, so it is unchanged. ${step}`, required);
843
1072
  return;
@@ -845,9 +1074,9 @@ function planYaml(filePath, pin, keyPath, required, plan) {
845
1074
  if (pinned.changed) plan.writes.push({ filePath, text: pinned.text });
846
1075
  }
847
1076
  function planYarnrc(projectPath, required, plan) {
848
- const filePath = path18.join(projectPath, ".yarnrc.yml");
849
- const stat = fs13.lstatSync(filePath, { throwIfNoEntry: false });
850
- const current = stat && !stat.isSymbolicLink() ? fs13.readFileSync(filePath, "utf-8") : "";
1077
+ const filePath = path19.join(projectPath, ".yarnrc.yml");
1078
+ const stat = fs14.lstatSync(filePath, { throwIfNoEntry: false });
1079
+ const current = stat && !stat.isSymbolicLink() ? fs14.readFileSync(filePath, "utf-8") : "";
851
1080
  const credentials = pinScopeRegistryInYarnrc(current)?.changed ? yarnCredentialsBoundToScope(projectPath) : [];
852
1081
  if (credentials.length > 0) {
853
1082
  refuse(
@@ -860,7 +1089,7 @@ function planYarnrc(projectPath, required, plan) {
860
1089
  planYaml(filePath, pinScopeRegistryInYarnrc, YARNRC_REGISTRY_PATH, required, plan);
861
1090
  }
862
1091
  function needsYarnrc(projectPath, packageManager, options) {
863
- if (fs13.lstatSync(path18.join(projectPath, ".yarnrc.yml"), { throwIfNoEntry: false })) return true;
1092
+ if (fs14.lstatSync(path19.join(projectPath, ".yarnrc.yml"), { throwIfNoEntry: false })) return true;
864
1093
  if (packageManager !== "yarn") return false;
865
1094
  const declared = declaredPackageManager(projectPath);
866
1095
  if (declared?.name === "yarn") return declared.major >= 2;
@@ -869,13 +1098,13 @@ function needsYarnrc(projectPath, packageManager, options) {
869
1098
  }
870
1099
  function migrateLockfiles(projectPath, changed) {
871
1100
  for (const [name, migrate] of Object.entries(LOCKFILE_MIGRATIONS)) {
872
- const lockfilePath = path18.join(projectPath, name);
873
- const stat = fs13.lstatSync(lockfilePath, { throwIfNoEntry: false });
1101
+ const lockfilePath = path19.join(projectPath, name);
1102
+ const stat = fs14.lstatSync(lockfilePath, { throwIfNoEntry: false });
874
1103
  if (!stat?.isFile()) continue;
875
- const text2 = fs13.readFileSync(lockfilePath, "utf-8");
1104
+ const text2 = fs14.readFileSync(lockfilePath, "utf-8");
876
1105
  const migrated = migrate(text2);
877
1106
  if (migrated === text2) continue;
878
- fs13.writeFileSync(lockfilePath, migrated, "utf-8");
1107
+ fs14.writeFileSync(lockfilePath, migrated, "utf-8");
879
1108
  changed.push(lockfilePath);
880
1109
  }
881
1110
  }
@@ -883,9 +1112,9 @@ function pinStandardAgentsScopeRegistry(projectPath, options = {}) {
883
1112
  const packageManager = options.packageManager ?? inferProjectPackageManager(projectPath);
884
1113
  const configRoot = registryConfigRoot(projectPath, packageManager, options.isolateFromParent ?? false);
885
1114
  const plan = { writes: [], manual: [], blocked: false };
886
- planNpmrc(path18.join(configRoot, ".npmrc"), plan);
887
- const workspaceFile = path18.join(configRoot, "pnpm-workspace.yaml");
888
- if (fs13.lstatSync(workspaceFile, { throwIfNoEntry: false })) {
1115
+ planNpmrc(path19.join(configRoot, ".npmrc"), plan);
1116
+ const workspaceFile = path19.join(configRoot, "pnpm-workspace.yaml");
1117
+ if (fs14.lstatSync(workspaceFile, { throwIfNoEntry: false })) {
889
1118
  planYaml(workspaceFile, pinScopeRegistryInPnpmWorkspace, PNPM_WORKSPACE_REGISTRY_PATH, packageManager === "pnpm", plan);
890
1119
  }
891
1120
  if (needsYarnrc(projectPath, packageManager, options)) {
@@ -894,8 +1123,8 @@ function pinStandardAgentsScopeRegistry(projectPath, options = {}) {
894
1123
  if (plan.blocked) return { changed: [], manual: plan.manual, blocked: true };
895
1124
  const changed = [];
896
1125
  for (const write of plan.writes) {
897
- if (write.replacesLink) fs13.unlinkSync(write.filePath);
898
- fs13.writeFileSync(write.filePath, write.text, "utf-8");
1126
+ if (write.replacesLink) fs14.unlinkSync(write.filePath);
1127
+ fs14.writeFileSync(write.filePath, write.text, "utf-8");
899
1128
  changed.push(write.filePath);
900
1129
  }
901
1130
  migrateLockfiles(projectPath, changed);
@@ -904,7 +1133,7 @@ function pinStandardAgentsScopeRegistry(projectPath, options = {}) {
904
1133
  function pinProjectScopeRegistry(projectPath, options, log) {
905
1134
  const result = pinStandardAgentsScopeRegistry(projectPath, options);
906
1135
  if (result.changed.length > 0) {
907
- const files = result.changed.map((file) => path18.relative(projectPath, file)).join(", ");
1136
+ const files = result.changed.map((file) => path19.relative(projectPath, file)).join(", ");
908
1137
  log.info(`Your project now installs @standardagents packages from npm (updated ${files}).`);
909
1138
  }
910
1139
  for (const step of result.manual) log.warning(step);
@@ -923,155 +1152,6 @@ function cliCommand(args = "") {
923
1152
  }
924
1153
  var SIGN_IN_UNREADABLE_MESSAGE = `The Keychain did not return the saved sign-in. It is locked in this session (for example over SSH): unlock it with \`security unlock-keychain\`, or sign in again with: ${cliCommand("login")}`;
925
1154
 
926
- // src/utils/platform-endpoint.ts
927
- var DEFAULT_PLATFORM_ENDPOINT = "https://api.standardagents.ai";
928
- var PLATFORM_ENDPOINT_ENV_KEYS = [
929
- "STANDARD_AGENTS_API_URL",
930
- "PLATFORM_ENDPOINT",
931
- "STANDARD_AGENTS_PLATFORM_URL"
932
- ];
933
- function normalizePlatformEndpoint(value) {
934
- return value.trim().replace(/\/+$/, "");
935
- }
936
- var PlatformEndpointError = class extends Error {
937
- constructor(message) {
938
- super(message);
939
- this.name = "PlatformEndpointError";
940
- }
941
- };
942
- function displayEndpoint(value) {
943
- const trimmed = value.trim();
944
- try {
945
- const url = new URL(trimmed);
946
- if (url.protocol === "http:" || url.protocol === "https:") {
947
- url.username = "";
948
- url.password = "";
949
- url.search = "";
950
- url.hash = "";
951
- return url.toString().replace(/\/+$/, "");
952
- }
953
- } catch {
954
- }
955
- return trimmed.replace(/^[^@/\s]*@/, "").replace(/[?#].*$/, "");
956
- }
957
- function isLoopbackHost(hostname) {
958
- const host = hostname.toLowerCase();
959
- return host === "localhost" || host.endsWith(".localhost") || host === "[::1]" || /^127(\.\d{1,3}){3}$/.test(host);
960
- }
961
- function platformEndpointProblem(value, noun = "platform endpoint") {
962
- const shown = displayEndpoint(value);
963
- let url;
964
- try {
965
- url = new URL(value.trim());
966
- } catch {
967
- return `The ${noun} "${shown}" is not a URL.
968
- Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
969
- }
970
- if (url.protocol !== "https:" && url.protocol !== "http:") {
971
- return `The ${noun} ${shown} is not an HTTPS URL.
972
- Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
973
- }
974
- if (url.username || url.password) {
975
- return `The ${noun} ${shown} must not contain a user name or password.
976
- Use ${shown}`;
977
- }
978
- if (url.protocol === "http:" && !isLoopbackHost(url.hostname)) {
979
- return `The ${noun} ${shown} is not HTTPS. The CLI sends a credential only to an HTTPS endpoint, or to plain HTTP on this machine (localhost, 127.0.0.1, [::1]).
980
- Use ${shown.replace(/^http:/i, "https:")}`;
981
- }
982
- return null;
983
- }
984
- function assertSafePlatformEndpoint(endpoint) {
985
- const problem = platformEndpointProblem(endpoint);
986
- if (problem) throw new PlatformEndpointError(problem);
987
- return endpoint;
988
- }
989
- function platformEndpointFrom(source) {
990
- for (const key of PLATFORM_ENDPOINT_ENV_KEYS) {
991
- const value = normalizePlatformEndpoint(source[key] ?? "");
992
- if (value) return value;
993
- }
994
- return void 0;
995
- }
996
- function configuredPlatformEndpoint(flag, ...fallbackSources) {
997
- const explicit = normalizePlatformEndpoint(flag ?? "");
998
- if (explicit) return assertSafePlatformEndpoint(explicit);
999
- for (const source of [process.env, ...fallbackSources]) {
1000
- const value = platformEndpointFrom(source);
1001
- if (value) return assertSafePlatformEndpoint(value);
1002
- }
1003
- return void 0;
1004
- }
1005
- function resolvePlatformEndpoint(flag) {
1006
- return configuredPlatformEndpoint(flag) ?? DEFAULT_PLATFORM_ENDPOINT;
1007
- }
1008
-
1009
- // src/utils/platform-request.ts
1010
- var REQUEST_TIMEOUT_MS = 3e4;
1011
- function requestHost(url) {
1012
- try {
1013
- return new URL(url).host;
1014
- } catch {
1015
- return "the server";
1016
- }
1017
- }
1018
- var RequestTimeoutError = class extends Error {
1019
- constructor(host, timeoutMs, next) {
1020
- super(`${host} did not answer within ${Math.round(timeoutMs / 1e3)} seconds.
1021
- ${next}`);
1022
- this.host = host;
1023
- this.timeoutMs = timeoutMs;
1024
- this.name = "RequestTimeoutError";
1025
- }
1026
- };
1027
- var RedirectRefusedError = class extends Error {
1028
- constructor(host, status2, next) {
1029
- super(
1030
- `${host} answered with a redirect (HTTP ${status2}). The CLI does not follow a redirect with your sign-in.
1031
- ${next}`
1032
- );
1033
- this.host = host;
1034
- this.status = status2;
1035
- this.name = "RedirectRefusedError";
1036
- }
1037
- };
1038
- var BODILESS_STATUSES = /* @__PURE__ */ new Set([101, 204, 205, 304]);
1039
- async function fetchWithDeadline(url, init2 = {}, options) {
1040
- const timeoutMs = options.timeoutMs ?? REQUEST_TIMEOUT_MS;
1041
- const deadlineController = new AbortController();
1042
- const timer = setTimeout(() => deadlineController.abort(), timeoutMs);
1043
- const deadline = deadlineController.signal;
1044
- const signal = init2.signal ? AbortSignal.any([init2.signal, deadline]) : deadline;
1045
- try {
1046
- const response = await (options.fetchImpl ?? fetch)(url, { ...init2, signal });
1047
- if (!(response instanceof Response)) return response;
1048
- const body = await response.arrayBuffer();
1049
- return new Response(BODILESS_STATUSES.has(response.status) ? null : body, {
1050
- status: response.status,
1051
- statusText: response.statusText,
1052
- headers: response.headers
1053
- });
1054
- } catch (error) {
1055
- if (deadline.aborted && !init2.signal?.aborted) {
1056
- throw new RequestTimeoutError(requestHost(url), timeoutMs, options.next);
1057
- }
1058
- throw error;
1059
- } finally {
1060
- clearTimeout(timer);
1061
- }
1062
- }
1063
- async function credentialFetch(url, init2, options) {
1064
- const response = await fetchWithDeadline(url, { redirect: "manual", ...init2 }, options);
1065
- if (response.status >= 300 && response.status < 400) {
1066
- throw new RedirectRefusedError(requestHost(url), response.status, options.next);
1067
- }
1068
- return response;
1069
- }
1070
- async function platformFetch(endpoint, pathname, init2, options) {
1071
- assertSafePlatformEndpoint(endpoint);
1072
- return credentialFetch(`${endpoint}${pathname}`, init2, options);
1073
- }
1074
-
1075
1155
  // src/utils/cli-auth-api.ts
1076
1156
  var CliAuthWsTransportError = class extends Error {
1077
1157
  };
@@ -1675,13 +1755,13 @@ function getScaffoldStandardAgentsVersion() {
1675
1755
  if (process.env.STANDARDAGENTS_WORKSPACE === "1") {
1676
1756
  return workspacePackageLink("@standardagents/builder");
1677
1757
  }
1678
- return "0.45.7";
1758
+ return "0.45.8";
1679
1759
  }
1680
1760
  function findViteConfig(cwd) {
1681
1761
  const candidates = ["vite.config.ts", "vite.config.js", "vite.config.mts", "vite.config.mjs"];
1682
1762
  for (const candidate of candidates) {
1683
- const configPath = path18.join(cwd, candidate);
1684
- if (fs13.existsSync(configPath)) {
1763
+ const configPath = path19.join(cwd, candidate);
1764
+ if (fs14.existsSync(configPath)) {
1685
1765
  return configPath;
1686
1766
  }
1687
1767
  }
@@ -1699,27 +1779,27 @@ function setPackageDependency(packageJsonText, section, packageName, version) {
1699
1779
  return applyEdits(packageJsonText, edits);
1700
1780
  }
1701
1781
  function updatePackageDependencies(cwd, versions = {}) {
1702
- const packageJsonPath = path18.join(cwd, "package.json");
1703
- if (!fs13.existsSync(packageJsonPath)) {
1782
+ const packageJsonPath = path19.join(cwd, "package.json");
1783
+ if (!fs14.existsSync(packageJsonPath)) {
1704
1784
  return stageResult("package-json", "failed", "No package.json found. Create one (for example with `npm init -y`).");
1705
1785
  }
1706
1786
  let text2;
1707
1787
  let pkg;
1708
1788
  try {
1709
- text2 = fs13.readFileSync(packageJsonPath, "utf-8");
1789
+ text2 = fs14.readFileSync(packageJsonPath, "utf-8");
1710
1790
  pkg = JSON.parse(text2);
1711
1791
  } catch (error) {
1712
1792
  return stageResult("package-json", "failed", `package.json is not valid JSON, so it is unchanged: ${error instanceof Error ? error.message : error}`);
1713
1793
  }
1714
1794
  const desiredBuilderVersion = versions.standardAgents ?? getScaffoldStandardAgentsVersion();
1715
1795
  const builderSection = dependencySectionFor(pkg, "@standardagents/builder", "dependencies");
1716
- if (pkg[builderSection]?.["@standardagents/builder"] === desiredBuilderVersion) {
1717
- return stageResult("package-json", "ok", "package.json already has current Standard Agents dependencies");
1718
- }
1719
- const result = setPackageDependency(text2, builderSection, "@standardagents/builder", desiredBuilderVersion);
1720
- fs13.writeFileSync(packageJsonPath, `${result.trimEnd()}
1796
+ if (pkg[builderSection]?.["@standardagents/builder"] !== desiredBuilderVersion) {
1797
+ const result = setPackageDependency(text2, builderSection, "@standardagents/builder", desiredBuilderVersion);
1798
+ fs14.writeFileSync(packageJsonPath, `${result.trimEnd()}
1721
1799
  `, "utf-8");
1722
- return stageResult("package-json", "ok", "Updated package.json with current Standard Agents dependencies");
1800
+ }
1801
+ if (isExactVersion(desiredBuilderVersion)) pinFrameworkDependencies(cwd, desiredBuilderVersion);
1802
+ return fs14.readFileSync(packageJsonPath, "utf-8") === text2 ? stageResult("package-json", "ok", "package.json already has current Standard Agents dependencies") : stageResult("package-json", "ok", "Updated package.json with current Standard Agents dependencies");
1723
1803
  }
1724
1804
  var BUILDER_PACKAGE = "@standardagents/builder";
1725
1805
  var BUILDER_PLUGIN_EXPORTS = ["builder", "agentbuilder"];
@@ -1746,10 +1826,10 @@ async function modifyViteConfig(cwd, force, log) {
1746
1826
  if (!configPath) {
1747
1827
  return stageResult("vite-config", "failed", `No vite.config found. Create vite.config.ts first. ${VITE_CONFIG_MANUAL_EDIT}`);
1748
1828
  }
1749
- const configName = path18.basename(configPath);
1829
+ const configName = path19.basename(configPath);
1750
1830
  try {
1751
1831
  const mod = await loadFile(configPath);
1752
- const code = fs13.readFileSync(configPath, "utf-8");
1832
+ const code = fs14.readFileSync(configPath, "utf-8");
1753
1833
  const hasAgentBuilder = code.includes("@standardagents/builder") || code.includes("builder()") || code.includes("agentbuilder()");
1754
1834
  if (!hasAgentBuilder) {
1755
1835
  addVitePlugin(mod, {
@@ -1798,40 +1878,53 @@ function projectGuides(cwd) {
1798
1878
  }
1799
1879
  function outdatedGuides(cwd) {
1800
1880
  return projectGuides(cwd).filter((doc) => {
1801
- const filePath = path18.join(cwd, guidePath(doc.directory));
1802
- return fs13.existsSync(filePath) && fs13.readFileSync(filePath, "utf-8") !== doc.content;
1881
+ const filePath = path19.join(cwd, guidePath(doc.directory));
1882
+ return fs14.existsSync(filePath) && fs14.readFileSync(filePath, "utf-8") !== doc.content;
1803
1883
  }).map((doc) => guidePath(doc.directory));
1804
1884
  }
1805
1885
  function writeGuides(cwd, replace, log) {
1806
1886
  for (const doc of projectGuides(cwd)) {
1807
- const dirPath = path18.join(cwd, doc.directory);
1808
- if (!fs13.existsSync(dirPath)) {
1809
- fs13.mkdirSync(dirPath, { recursive: true });
1887
+ const dirPath = path19.join(cwd, doc.directory);
1888
+ if (!fs14.existsSync(dirPath)) {
1889
+ fs14.mkdirSync(dirPath, { recursive: true });
1810
1890
  log.success(`Created ${doc.directory}`);
1811
1891
  }
1812
1892
  const guide = guidePath(doc.directory);
1813
- const agentsDocPath = path18.join(cwd, guide);
1814
- if (!fs13.existsSync(agentsDocPath)) {
1815
- fs13.writeFileSync(agentsDocPath, doc.content, "utf-8");
1893
+ const agentsDocPath = path19.join(cwd, guide);
1894
+ if (!fs14.existsSync(agentsDocPath)) {
1895
+ fs14.writeFileSync(agentsDocPath, doc.content, "utf-8");
1816
1896
  log.success(`Created ${guide}`);
1817
1897
  } else if (replace.has(guide)) {
1818
- fs13.writeFileSync(agentsDocPath, doc.content, "utf-8");
1898
+ fs14.writeFileSync(agentsDocPath, doc.content, "utf-8");
1819
1899
  log.success(`Replaced ${guide}`);
1820
1900
  }
1821
- const claudeDocPath = path18.join(dirPath, "CLAUDE.md");
1822
- if (!fs13.lstatSync(claudeDocPath, { throwIfNoEntry: false })) {
1823
- fs13.symlinkSync("AGENTS.md", claudeDocPath);
1901
+ const claudeDocPath = path19.join(dirPath, "CLAUDE.md");
1902
+ if (!fs14.lstatSync(claudeDocPath, { throwIfNoEntry: false })) {
1903
+ fs14.symlinkSync("AGENTS.md", claudeDocPath);
1824
1904
  log.success(`Created ${guide.replace(/AGENTS\.md$/, "CLAUDE.md")} symlink`);
1825
1905
  }
1826
1906
  }
1907
+ for (const skillFile of renderAgentSkill()) {
1908
+ const target = path19.join(cwd, skillFile.path);
1909
+ if (fs14.lstatSync(target, { throwIfNoEntry: false })) {
1910
+ continue;
1911
+ }
1912
+ fs14.mkdirSync(path19.dirname(target), { recursive: true });
1913
+ if (skillFile.kind === "symlink") {
1914
+ fs14.symlinkSync(skillFile.content, target);
1915
+ } else {
1916
+ fs14.writeFileSync(target, skillFile.content, "utf-8");
1917
+ }
1918
+ log.success(`Created ${skillFile.path}`);
1919
+ }
1827
1920
  return stageResult("guides", "ok", "Agent directories and AGENTS.md guides are in place");
1828
1921
  }
1829
1922
  function updateTsConfig(cwd) {
1830
- const tsconfigPath = path18.join(cwd, "tsconfig.json");
1831
- if (!fs13.existsSync(tsconfigPath)) {
1923
+ const tsconfigPath = path19.join(cwd, "tsconfig.json");
1924
+ if (!fs14.existsSync(tsconfigPath)) {
1832
1925
  return stageResult("tsconfig", "skipped", "No tsconfig.json found, so there is no TypeScript configuration to update");
1833
1926
  }
1834
- const text2 = fs13.readFileSync(tsconfigPath, "utf-8");
1927
+ const text2 = fs14.readFileSync(tsconfigPath, "utf-8");
1835
1928
  const config = parse$1(text2);
1836
1929
  if (typeof config !== "object" || config === null || Array.isArray(config)) {
1837
1930
  return stageResult(
@@ -1858,7 +1951,7 @@ function updateTsConfig(cwd) {
1858
1951
  if (newTypes.length === 0 && newIncludes.length === 0) {
1859
1952
  return stageResult("tsconfig", "ok", "tsconfig.json already configured");
1860
1953
  }
1861
- fs13.writeFileSync(tsconfigPath, result, "utf-8");
1954
+ fs14.writeFileSync(tsconfigPath, result, "utf-8");
1862
1955
  return stageResult("tsconfig", "ok", "Updated tsconfig.json with Standard Agents types");
1863
1956
  }
1864
1957
  function pinScopeRegistry(cwd, options, log) {
@@ -1892,21 +1985,21 @@ function cleanupViteDefaults(cwd) {
1892
1985
  ];
1893
1986
  const dirsToRemove = ["src", "public", "worker"];
1894
1987
  for (const file of filesToRemove) {
1895
- const filePath = path18.join(cwd, file);
1896
- if (fs13.existsSync(filePath)) {
1988
+ const filePath = path19.join(cwd, file);
1989
+ if (fs14.existsSync(filePath)) {
1897
1990
  try {
1898
- fs13.unlinkSync(filePath);
1991
+ fs14.unlinkSync(filePath);
1899
1992
  } catch {
1900
1993
  }
1901
1994
  }
1902
1995
  }
1903
1996
  for (const dir of dirsToRemove) {
1904
- const dirPath = path18.join(cwd, dir);
1905
- if (fs13.existsSync(dirPath)) {
1997
+ const dirPath = path19.join(cwd, dir);
1998
+ if (fs14.existsSync(dirPath)) {
1906
1999
  try {
1907
- const files = fs13.readdirSync(dirPath);
2000
+ const files = fs14.readdirSync(dirPath);
1908
2001
  if (files.length === 0) {
1909
- fs13.rmdirSync(dirPath);
2002
+ fs14.rmdirSync(dirPath);
1910
2003
  }
1911
2004
  } catch {
1912
2005
  }
@@ -1985,25 +2078,25 @@ async function scaffoldCommand(options = {}) {
1985
2078
  const directories = AGENT_DOCS.filter((doc) => doc.directory !== ".");
1986
2079
  directories.forEach((doc, index) => {
1987
2080
  const branch = index === directories.length - 1 ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500";
1988
- const name = `${path18.basename(doc.directory)}/`;
2081
+ const name = `${path19.basename(doc.directory)}/`;
1989
2082
  log.log(` ${branch} ${name.padEnd(20)}# ${doc.label[0].toUpperCase()}${doc.label.slice(1)} definitions`);
1990
2083
  });
1991
2084
  log.log("");
1992
2085
  }
1993
2086
  function writeBuildGuardScript(projectPath) {
1994
- const manifestPath = path18.join(projectPath, "package.json");
1995
- if (!fs13.existsSync(manifestPath)) return false;
1996
- const manifest = JSON.parse(fs13.readFileSync(manifestPath, "utf-8"));
2087
+ const manifestPath = path19.join(projectPath, "package.json");
2088
+ if (!fs14.existsSync(manifestPath)) return false;
2089
+ const manifest = JSON.parse(fs14.readFileSync(manifestPath, "utf-8"));
1997
2090
  if (manifest.scripts?.build === BUILD_GUARD_SCRIPT) return false;
1998
2091
  manifest.scripts = { ...manifest.scripts, build: BUILD_GUARD_SCRIPT };
1999
- fs13.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
2092
+ fs14.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
2000
2093
  `, "utf-8");
2001
2094
  return true;
2002
2095
  }
2003
2096
 
2004
2097
  // src/utils/git-helper-command.ts
2005
2098
  function cliVersion() {
2006
- return "0.45.7";
2099
+ return "0.45.8";
2007
2100
  }
2008
2101
  function defaultGitCredentialHelperCommand(version = cliVersion()) {
2009
2102
  return `!npx -y @standardagents/cli@${version} git-credential`;
@@ -2037,7 +2130,7 @@ async function resolveSetupCode(options, readStdin2 = readStandardInput) {
2037
2130
  if (file) {
2038
2131
  source = `The file ${file}`;
2039
2132
  try {
2040
- code = fs13.readFileSync(file, "utf8");
2133
+ code = fs14.readFileSync(file, "utf8");
2041
2134
  } catch (error) {
2042
2135
  const reason = error instanceof Error && "code" in error ? String(error.code) : "it could not be read";
2043
2136
  throw new Error(`Cannot read the setup code file ${file} (${reason}).`);
@@ -2077,7 +2170,7 @@ function signalAll(pids, signal) {
2077
2170
  function readProcfsTable() {
2078
2171
  let entries;
2079
2172
  try {
2080
- entries = fs13.readdirSync("/proc");
2173
+ entries = fs14.readdirSync("/proc");
2081
2174
  } catch {
2082
2175
  return null;
2083
2176
  }
@@ -2085,7 +2178,7 @@ function readProcfsTable() {
2085
2178
  for (const entry of entries) {
2086
2179
  if (!/^\d+$/.test(entry)) continue;
2087
2180
  try {
2088
- const stat = fs13.readFileSync(`/proc/${entry}/stat`, "utf8");
2181
+ const stat = fs14.readFileSync(`/proc/${entry}/stat`, "utf8");
2089
2182
  const parent = Number.parseInt(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1], 10);
2090
2183
  if (Number.isInteger(parent)) parents.set(Number(entry), parent);
2091
2184
  } catch {
@@ -2257,10 +2350,10 @@ function directoryExistsFailure(name) {
2257
2350
  };
2258
2351
  }
2259
2352
  function resolveFreeDirectoryName(cwd, name) {
2260
- if (!fs13.existsSync(path18.join(cwd, name))) return name;
2353
+ if (!fs14.existsSync(path19.join(cwd, name))) return name;
2261
2354
  for (let suffix = 2; ; suffix += 1) {
2262
2355
  const candidate = `${name}-${suffix}`;
2263
- if (!fs13.existsSync(path18.join(cwd, candidate))) return candidate;
2356
+ if (!fs14.existsSync(path19.join(cwd, candidate))) return candidate;
2264
2357
  }
2265
2358
  }
2266
2359
  function commandFailureCause(label, error) {
@@ -2841,16 +2934,16 @@ function normalizeProjectName(raw) {
2841
2934
  return toKebabCase(raw.trim());
2842
2935
  }
2843
2936
  function isNonEmptyDirectory(targetPath) {
2844
- if (!fs13.existsSync(targetPath)) return false;
2845
- const stat = fs13.statSync(targetPath);
2937
+ if (!fs14.existsSync(targetPath)) return false;
2938
+ const stat = fs14.statSync(targetPath);
2846
2939
  if (!stat.isDirectory()) return false;
2847
- return fs13.readdirSync(targetPath).length > 0;
2940
+ return fs14.readdirSync(targetPath).length > 0;
2848
2941
  }
2849
2942
  function hasBuilderDependency(targetPath) {
2850
- const packageJsonPath = path18.join(targetPath, "package.json");
2851
- if (!fs13.existsSync(packageJsonPath)) return false;
2943
+ const packageJsonPath = path19.join(targetPath, "package.json");
2944
+ if (!fs14.existsSync(packageJsonPath)) return false;
2852
2945
  try {
2853
- const pkg = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
2946
+ const pkg = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
2854
2947
  if (pkg === null || typeof pkg !== "object") return false;
2855
2948
  const dependencies = "dependencies" in pkg ? pkg.dependencies : void 0;
2856
2949
  const devDependencies = "devDependencies" in pkg ? pkg.devDependencies : void 0;
@@ -2862,12 +2955,12 @@ function hasBuilderDependency(targetPath) {
2862
2955
  }
2863
2956
  }
2864
2957
  function isStandardAgentsProjectDir(targetPath) {
2865
- const agentsDir = path18.join(targetPath, "agents");
2866
- if (!fs13.existsSync(agentsDir) || !fs13.statSync(agentsDir).isDirectory()) {
2958
+ const agentsDir = path19.join(targetPath, "agents");
2959
+ if (!fs14.existsSync(agentsDir) || !fs14.statSync(agentsDir).isDirectory()) {
2867
2960
  return false;
2868
2961
  }
2869
2962
  if (hasBuilderDependency(targetPath)) return true;
2870
- return fs13.existsSync(path18.join(targetPath, "vite.config.ts")) && fs13.existsSync(path18.join(targetPath, "tsconfig.json"));
2963
+ return fs14.existsSync(path19.join(targetPath, "vite.config.ts")) && fs14.existsSync(path19.join(targetPath, "tsconfig.json"));
2871
2964
  }
2872
2965
  function initScaffoldOptions(useExistingProject, standardAgents) {
2873
2966
  return { freshProject: !useExistingProject, scopeRegistryPinned: true, standardAgents };
@@ -2878,7 +2971,7 @@ function resolveProjectTarget(cwd, candidate) {
2878
2971
  if (!isStandardAgentsProjectDir(cwd)) {
2879
2972
  return { ok: false, message: "Project name is required" };
2880
2973
  }
2881
- const dirName = path18.basename(cwd) || "standard-agents";
2974
+ const dirName = path19.basename(cwd) || "standard-agents";
2882
2975
  return {
2883
2976
  ok: true,
2884
2977
  target: {
@@ -2892,9 +2985,9 @@ function resolveProjectTarget(cwd, candidate) {
2892
2985
  if (!projectName) {
2893
2986
  return { ok: false, message: "Project name must include at least one letter or number" };
2894
2987
  }
2895
- const projectPath = path18.join(cwd, projectName);
2896
- const exists = fs13.existsSync(projectPath);
2897
- if (exists && !fs13.statSync(projectPath).isDirectory()) {
2988
+ const projectPath = path19.join(cwd, projectName);
2989
+ const exists = fs14.existsSync(projectPath);
2990
+ if (exists && !fs14.statSync(projectPath).isDirectory()) {
2898
2991
  return { ok: false, message: `Path "${projectName}" already exists and is not a directory` };
2899
2992
  }
2900
2993
  const existingStandardAgentsProject = exists && isStandardAgentsProjectDir(projectPath);
@@ -2911,7 +3004,7 @@ function resolveProjectTarget(cwd, candidate) {
2911
3004
  };
2912
3005
  }
2913
3006
  function detectLockfilePackageManager(projectPath) {
2914
- const has = (file) => fs13.existsSync(path18.join(projectPath, file));
3007
+ const has = (file) => fs14.existsSync(path19.join(projectPath, file));
2915
3008
  if (has("pnpm-lock.yaml")) return "pnpm";
2916
3009
  if (has("yarn.lock")) return "yarn";
2917
3010
  if (has("bun.lockb") || has("bun.lock")) return "bun";
@@ -2991,7 +3084,7 @@ function renderInitStepHeader(stage, title, subtitle, options) {
2991
3084
  logger.log("");
2992
3085
  }
2993
3086
  function getCliVersion() {
2994
- return "0.45.7";
3087
+ return "0.45.8";
2995
3088
  }
2996
3089
  function getSipVersion() {
2997
3090
  return "1.0.1";
@@ -3020,8 +3113,8 @@ function resolveStandardAgentsPackageSpecifier(packageName, packageSpecifier) {
3020
3113
  return packageSpecifier;
3021
3114
  }
3022
3115
  function rewriteStandardAgentsDependenciesForWorkspace(projectPath, workspaceRoot) {
3023
- const packageJsonPath = path18.join(projectPath, "package.json");
3024
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3116
+ const packageJsonPath = path19.join(projectPath, "package.json");
3117
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3025
3118
  const dependencies = packageJson.dependencies ?? {};
3026
3119
  const linkedPackages = [];
3027
3120
  for (const packageName of GENERATED_STANDARD_AGENTS_PACKAGES) {
@@ -3033,7 +3126,7 @@ function rewriteStandardAgentsDependenciesForWorkspace(projectPath, workspaceRoo
3033
3126
  }
3034
3127
  if (linkedPackages.length > 0) {
3035
3128
  packageJson.dependencies = dependencies;
3036
- fs13.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
3129
+ fs14.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
3037
3130
  `, "utf-8");
3038
3131
  }
3039
3132
  return linkedPackages;
@@ -3054,7 +3147,7 @@ function preparePlatformProjectDependencies(projectPath, packageManager, options
3054
3147
  return linkedPackages;
3055
3148
  }
3056
3149
  function getPnpmWorkspaceCompatibilityArgs(packageManager, projectPath) {
3057
- if (packageManager !== "pnpm" || !fs13.existsSync(path18.join(projectPath, "pnpm-workspace.yaml"))) return [];
3150
+ if (packageManager !== "pnpm" || !fs14.existsSync(path19.join(projectPath, "pnpm-workspace.yaml"))) return [];
3058
3151
  try {
3059
3152
  childProcess.execFileSync("pnpm", ["config", "get", "registry"], {
3060
3153
  cwd: projectPath,
@@ -3072,33 +3165,55 @@ function getPnpmWorkspaceCompatibilityArgs(packageManager, projectPath) {
3072
3165
  }
3073
3166
  }
3074
3167
  function projectInstallArgs(packageManager, projectPath, command = "install", dependencies = [], options = {}) {
3075
- const hasProjectWorkspace = projectPath !== void 0 && fs13.existsSync(path18.join(projectPath, "pnpm-workspace.yaml"));
3076
- const inheritsWorkspace = !options.isolateFromParent && projectPath !== void 0 && findPnpmWorkspaceRoot(path18.dirname(projectPath)) !== null;
3168
+ const hasProjectWorkspace = projectPath !== void 0 && fs14.existsSync(path19.join(projectPath, "pnpm-workspace.yaml"));
3169
+ const inheritsWorkspace = !options.isolateFromParent && projectPath !== void 0 && findPnpmWorkspaceRoot(path19.dirname(projectPath)) !== null;
3077
3170
  const prefix = [];
3078
3171
  if (packageManager === "pnpm") {
3079
3172
  if (options.ignoreProjectWorkspace) prefix.push("--ignore-workspace");
3080
3173
  else if (hasProjectWorkspace && command === "add") prefix.push("--workspace-root");
3081
3174
  else if (!hasProjectWorkspace && !inheritsWorkspace) prefix.push("--ignore-workspace");
3082
3175
  }
3083
- return [...prefix, command, ...dependencies];
3176
+ const saveExact = packageManager === "npm" && dependencies.length > 0 ? ["--save-exact"] : [];
3177
+ return [...prefix, command, ...saveExact, ...dependencies];
3178
+ }
3179
+ async function pinLatestFrameworkRelease(projectPath) {
3180
+ const cliVersion2 = getCliVersion();
3181
+ if (isPrereleaseVersion(cliVersion2)) {
3182
+ const pinned2 = pinFrameworkDependencies(projectPath, cliVersion2);
3183
+ if (pinned2.length > 0) {
3184
+ logger.info(`Pinned ${pinned2.length} Standard Agents packages to ${cliVersion2}, the release of this prerelease CLI.`);
3185
+ }
3186
+ return;
3187
+ }
3188
+ const latest = await resolveLatestFrameworkVersion();
3189
+ if (latest.version === null) {
3190
+ logger.warning(
3191
+ `Could not read the latest Standard Agents Builder release: ${latest.reason} Keeping the versions in package.json.`
3192
+ );
3193
+ return;
3194
+ }
3195
+ const pinned = pinFrameworkDependencies(projectPath, latest.version);
3196
+ if (pinned.length > 0) {
3197
+ logger.info(`Pinned ${pinned.length} Standard Agents packages to ${latest.version}, the latest release.`);
3198
+ }
3084
3199
  }
3085
3200
  function shellQuote(value) {
3086
3201
  return `"${value.replace(/(["\\$`])/g, "\\$1")}"`;
3087
3202
  }
3088
3203
  function findWorkspaceCommandRoot(projectPath) {
3089
- let current = path18.dirname(projectPath);
3204
+ let current = path19.dirname(projectPath);
3090
3205
  while (true) {
3091
- const packageJsonPath = path18.join(current, "package.json");
3092
- if (fs13.existsSync(packageJsonPath)) {
3206
+ const packageJsonPath = path19.join(current, "package.json");
3207
+ if (fs14.existsSync(packageJsonPath)) {
3093
3208
  try {
3094
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3209
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3095
3210
  if (packageJson?.scripts && typeof packageJson.scripts["sandbox:hmr"] === "string") {
3096
3211
  return current;
3097
3212
  }
3098
3213
  } catch {
3099
3214
  }
3100
3215
  }
3101
- const parent = path18.dirname(current);
3216
+ const parent = path19.dirname(current);
3102
3217
  if (parent === current) {
3103
3218
  return null;
3104
3219
  }
@@ -3106,47 +3221,47 @@ function findWorkspaceCommandRoot(projectPath) {
3106
3221
  }
3107
3222
  }
3108
3223
  function linkWorkspaceProjectToolchain(projectPath, workspaceRoot) {
3109
- const packageJsonPath = path18.join(projectPath, "package.json");
3110
- const manifest = JSON.parse(fs13.readFileSync(packageJsonPath, "utf8"));
3224
+ const packageJsonPath = path19.join(projectPath, "package.json");
3225
+ const manifest = JSON.parse(fs14.readFileSync(packageJsonPath, "utf8"));
3111
3226
  for (const section of [manifest.dependencies, manifest.devDependencies]) {
3112
3227
  if (!section) continue;
3113
3228
  for (const name of ["vite", "typescript"]) {
3114
3229
  if (!(name in section)) continue;
3115
- const installedPath = path18.join(workspaceRoot, "node_modules", name);
3116
- if (!fs13.existsSync(path18.join(installedPath, "package.json"))) {
3230
+ const installedPath = path19.join(workspaceRoot, "node_modules", name);
3231
+ if (!fs14.existsSync(path19.join(installedPath, "package.json"))) {
3117
3232
  throw new Error(`Install the contributor workspace before linking ${name}`);
3118
3233
  }
3119
3234
  section[name] = `link:${installedPath}`;
3120
3235
  }
3121
3236
  }
3122
- fs13.writeFileSync(packageJsonPath, `${JSON.stringify(manifest, null, 2)}
3237
+ fs14.writeFileSync(packageJsonPath, `${JSON.stringify(manifest, null, 2)}
3123
3238
  `);
3124
3239
  }
3125
3240
  function configureWorkspaceProjectScripts(projectPath, projectName) {
3126
- const packageJsonPath = path18.join(projectPath, "package.json");
3127
- if (!fs13.existsSync(packageJsonPath)) return false;
3241
+ const packageJsonPath = path19.join(projectPath, "package.json");
3242
+ if (!fs14.existsSync(packageJsonPath)) return false;
3128
3243
  const workspaceRoot = findWorkspaceCommandRoot(projectPath);
3129
3244
  if (!workspaceRoot) return false;
3130
- const workspacePackageJsonPath = path18.join(workspaceRoot, "package.json");
3131
- const workspacePackageJson = JSON.parse(fs13.readFileSync(workspacePackageJsonPath, "utf-8"));
3132
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3245
+ const workspacePackageJsonPath = path19.join(workspaceRoot, "package.json");
3246
+ const workspacePackageJson = JSON.parse(fs14.readFileSync(workspacePackageJsonPath, "utf-8"));
3247
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3133
3248
  const scripts = packageJson.scripts && typeof packageJson.scripts === "object" ? packageJson.scripts : {};
3134
- const relativeRoot = path18.relative(projectPath, workspaceRoot) || ".";
3249
+ const relativeRoot = path19.relative(projectPath, workspaceRoot) || ".";
3135
3250
  scripts["sandbox:hmr"] = `pnpm -C ${shellQuote(relativeRoot)} sandbox:hmr -- ${shellQuote(projectName)}`;
3136
3251
  if (workspacePackageJson?.scripts && typeof workspacePackageJson.scripts["cli:login:workspace"] === "string") {
3137
3252
  scripts["cli:login:workspace"] = `pnpm -C ${shellQuote(relativeRoot)} cli:login:workspace -- ${shellQuote(projectName)}`;
3138
3253
  }
3139
3254
  packageJson.scripts = scripts;
3140
- fs13.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
3255
+ fs14.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
3141
3256
  return true;
3142
3257
  }
3143
3258
  function resolvePostInitRunCommand(packageManager, projectPath, workspacePackages, pnpmCompatibilityArgs = []) {
3144
3259
  const command = packageManager === "pnpm" ? [packageManager, ...pnpmCompatibilityArgs].join(" ") : packageManager;
3145
3260
  if (workspacePackages) {
3146
- const packageJsonPath = path18.join(projectPath, "package.json");
3147
- if (fs13.existsSync(packageJsonPath)) {
3261
+ const packageJsonPath = path19.join(projectPath, "package.json");
3262
+ if (fs14.existsSync(packageJsonPath)) {
3148
3263
  try {
3149
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3264
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3150
3265
  if (packageJson?.scripts && typeof packageJson.scripts["sandbox:hmr"] === "string") {
3151
3266
  return packageManager === "npm" ? "npm run sandbox:hmr" : `${command} sandbox:hmr`;
3152
3267
  }
@@ -3294,8 +3409,8 @@ function gitSupportsEnvironmentConfig(versionLine) {
3294
3409
  return major > 2 || major === 2 && minor >= 31;
3295
3410
  }
3296
3411
  function platformGitCredentialHelperCommand(cliEntry = process.argv[1] ?? "") {
3297
- if (process.env.STANDARDAGENTS_WORKSPACE === "1" && cliEntry && fs13.existsSync(cliEntry)) {
3298
- return `!node ${shellQuote(path18.resolve(cliEntry))} git-credential`;
3412
+ if (process.env.STANDARDAGENTS_WORKSPACE === "1" && cliEntry && fs14.existsSync(cliEntry)) {
3413
+ return `!node ${shellQuote(path19.resolve(cliEntry))} git-credential`;
3299
3414
  }
3300
3415
  if (process.env.STANDARD_AGENTS_GIT_HELPER?.trim()) {
3301
3416
  return process.env.STANDARD_AGENTS_GIT_HELPER.trim();
@@ -3319,20 +3434,20 @@ function waitForPlatformProject(session, onProgress, signal) {
3319
3434
  return waitForCliAuthCompletion(session, PLATFORM_PROJECT_READER, { onProgress, signal });
3320
3435
  }
3321
3436
  function appendGitignoreEntries2(projectPath, heading, entries) {
3322
- const gitignorePath = path18.join(projectPath, ".gitignore");
3323
- const gitignoreContent = fs13.existsSync(gitignorePath) ? fs13.readFileSync(gitignorePath, "utf-8") : "";
3437
+ const gitignorePath = path19.join(projectPath, ".gitignore");
3438
+ const gitignoreContent = fs14.existsSync(gitignorePath) ? fs14.readFileSync(gitignorePath, "utf-8") : "";
3324
3439
  const existingEntries = new Set(gitignoreContent.split(/\r?\n/));
3325
3440
  const missingEntries = entries.filter((entry) => !existingEntries.has(entry));
3326
3441
  if (missingEntries.length === 0) return;
3327
3442
  const prefix = gitignoreContent.length === 0 ? "" : gitignoreContent.endsWith("\n") ? "\n" : "\n\n";
3328
- fs13.appendFileSync(gitignorePath, `${prefix}${heading}
3443
+ fs14.appendFileSync(gitignorePath, `${prefix}${heading}
3329
3444
  ${missingEntries.join("\n")}
3330
3445
  `);
3331
3446
  }
3332
3447
  function writeLocalPnpmBuildPolicy(projectPath, packageManager, options = {}) {
3333
3448
  if (packageManager !== "pnpm") return false;
3334
- const policyPath = path18.join(projectPath, "pnpm-workspace.yaml");
3335
- if (fs13.existsSync(policyPath)) return false;
3449
+ const policyPath = path19.join(projectPath, "pnpm-workspace.yaml");
3450
+ if (fs14.existsSync(policyPath)) return false;
3336
3451
  const buildPolicySettings = [
3337
3452
  "onlyBuiltDependencies",
3338
3453
  "onlyBuiltDependenciesFile",
@@ -3343,20 +3458,20 @@ function writeLocalPnpmBuildPolicy(projectPath, packageManager, options = {}) {
3343
3458
  "ignoreDepScripts",
3344
3459
  "ignoreScripts"
3345
3460
  ];
3346
- const npmrcPath = path18.join(projectPath, ".npmrc");
3347
- if (fs13.existsSync(npmrcPath)) {
3348
- const hasBuildPolicy = fs13.readFileSync(npmrcPath, "utf8").split(/\r?\n/).some((line) => {
3461
+ const npmrcPath = path19.join(projectPath, ".npmrc");
3462
+ if (fs14.existsSync(npmrcPath)) {
3463
+ const hasBuildPolicy = fs14.readFileSync(npmrcPath, "utf8").split(/\r?\n/).some((line) => {
3349
3464
  const separator = line.indexOf("=");
3350
3465
  const name = (separator < 0 ? line : line.slice(0, separator)).trim().replace(/[-_[\]]/g, "").toLowerCase();
3351
3466
  return buildPolicySettings.some((setting) => setting.toLowerCase() === name);
3352
3467
  });
3353
3468
  if (hasBuildPolicy) return false;
3354
3469
  }
3355
- if (!options.isolateFromParent && findPnpmWorkspaceRoot(path18.dirname(projectPath))) return false;
3470
+ if (!options.isolateFromParent && findPnpmWorkspaceRoot(path19.dirname(projectPath))) return false;
3356
3471
  const ignoredBuildScripts = options.ignoredBuildScripts ?? [];
3357
3472
  const approvedBuildScripts = ["esbuild", "workerd"].filter((name) => !ignoredBuildScripts.includes(name));
3358
- const manifestPath = path18.join(projectPath, "package.json");
3359
- const manifest = JSON.parse(fs13.readFileSync(manifestPath, "utf8"));
3473
+ const manifestPath = path19.join(projectPath, "package.json");
3474
+ const manifest = JSON.parse(fs14.readFileSync(manifestPath, "utf8"));
3360
3475
  const existingPnpm = manifest.pnpm ?? {};
3361
3476
  if (buildPolicySettings.some((name) => Object.hasOwn(existingPnpm, name))) return false;
3362
3477
  manifest.pnpm = {
@@ -3364,9 +3479,9 @@ function writeLocalPnpmBuildPolicy(projectPath, packageManager, options = {}) {
3364
3479
  onlyBuiltDependencies: approvedBuildScripts,
3365
3480
  ...ignoredBuildScripts.length > 0 ? { ignoredBuiltDependencies: ignoredBuildScripts } : {}
3366
3481
  };
3367
- fs13.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
3482
+ fs14.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
3368
3483
  `);
3369
- fs13.writeFileSync(policyPath, renderPnpmWorkspaceYaml(approvedBuildScripts, ignoredBuildScripts));
3484
+ fs14.writeFileSync(policyPath, renderPnpmWorkspaceYaml(approvedBuildScripts, ignoredBuildScripts));
3370
3485
  return true;
3371
3486
  }
3372
3487
  function writeStandardAgentsSupportFiles(projectPath, params) {
@@ -3379,15 +3494,17 @@ function writeStandardAgentsSupportFiles(projectPath, params) {
3379
3494
  sip: getSipVersion()
3380
3495
  }
3381
3496
  })) {
3382
- const targetPath = path18.join(projectPath, supportFile.path);
3383
- if (fs13.existsSync(targetPath)) continue;
3384
- fs13.mkdirSync(path18.dirname(targetPath), { recursive: true });
3385
- fs13.writeFileSync(targetPath, supportFile.content, "utf-8");
3497
+ const targetPath = path19.join(projectPath, supportFile.path);
3498
+ if (fs14.existsSync(targetPath)) continue;
3499
+ fs14.mkdirSync(path19.dirname(targetPath), { recursive: true });
3500
+ fs14.writeFileSync(targetPath, supportFile.content, "utf-8");
3386
3501
  written.push(supportFile.path);
3387
3502
  }
3388
3503
  appendGitignoreEntries2(projectPath, "# Standard Agents local dev state", [
3389
3504
  "node_modules",
3390
- ".agents",
3505
+ // Generated files are ignored; the committed coding-agent skill is kept.
3506
+ ".agents/*",
3507
+ "!.agents/skills/",
3391
3508
  ".wrangler",
3392
3509
  "dist",
3393
3510
  ".agentbuilder-dev.log"
@@ -3413,7 +3530,7 @@ async function writeSupportFilesStages(options = {}, log = logger) {
3413
3530
  ], resume);
3414
3531
  }
3415
3532
  const cwd = process.cwd();
3416
- const projectName = normalizeProjectName(options.projectName ?? path18.basename(cwd)) || "standard-agents";
3533
+ const projectName = normalizeProjectName(options.projectName ?? path19.basename(cwd)) || "standard-agents";
3417
3534
  const stages = [
3418
3535
  await runStage("support-files", () => {
3419
3536
  const written = writeStandardAgentsSupportFiles(cwd, { projectName, packageManager });
@@ -3577,7 +3694,7 @@ async function runPlatformInit(projectNameArg, options) {
3577
3694
  process.exit(1);
3578
3695
  }
3579
3696
  const requestedProjectName = projectNameArg?.trim() || void 0;
3580
- if (requestedProjectName && fs13.existsSync(path18.join(cwd, requestedProjectName))) {
3697
+ if (requestedProjectName && fs14.existsSync(path19.join(cwd, requestedProjectName))) {
3581
3698
  exitWithInitFailure(directoryExistsFailure(requestedProjectName));
3582
3699
  }
3583
3700
  const endpoint = platformEndpoint(options);
@@ -3622,7 +3739,7 @@ async function runPlatformInit(projectNameArg, options) {
3622
3739
  exitWithInitFailure({ cause: error instanceof Error ? error.message : String(error), next: [] });
3623
3740
  }
3624
3741
  const projectName = resolveFreeDirectoryName(cwd, platformName);
3625
- const projectPath = path18.join(cwd, projectName);
3742
+ const projectPath = path19.join(cwd, projectName);
3626
3743
  const projectLabel = project.name || projectName;
3627
3744
  logger.success("Browser setup complete.");
3628
3745
  if (projectName !== platformName) {
@@ -3630,7 +3747,7 @@ async function runPlatformInit(projectNameArg, options) {
3630
3747
  }
3631
3748
  logger.info(`Cloning ${cloneDisplayUrl(project)}...`);
3632
3749
  const stopRemoveOnInterrupt = interrupts.onInterrupt(() => {
3633
- fs13.rmSync(projectPath, { recursive: true, force: true });
3750
+ fs14.rmSync(projectPath, { recursive: true, force: true });
3634
3751
  logger.log("");
3635
3752
  logger.info(`Setup interrupted. Removed the partial "${projectName}" directory.`);
3636
3753
  for (const line of finishExistingProjectSteps(projectLabel, dashboardUrl)) {
@@ -3663,7 +3780,7 @@ async function runPlatformInit(projectNameArg, options) {
3663
3780
  apiKey: project.api_key,
3664
3781
  platformEndpoint: endpoint
3665
3782
  });
3666
- logger.success(`Wrote Standard Agents credentials to ${path18.relative(cwd, envPath)}.`);
3783
+ logger.success(`Wrote Standard Agents credentials to ${path19.relative(cwd, envPath)}.`);
3667
3784
  if (project.git_extra_header) {
3668
3785
  await configurePlatformGitCredentialHelper(projectPath);
3669
3786
  logger.success("Configured git credentials for the platform repository.");
@@ -3672,6 +3789,9 @@ async function runPlatformInit(projectNameArg, options) {
3672
3789
  if (linkedPackages.length > 0) {
3673
3790
  logger.info(`Workspace mode detected: linked ${linkedPackages.length} Standard Agents packages locally.`);
3674
3791
  }
3792
+ if (!shouldUseWorkspacePackages(options)) {
3793
+ await pinLatestFrameworkRelease(projectPath);
3794
+ }
3675
3795
  } catch (error) {
3676
3796
  stopRemoveOnInterrupt();
3677
3797
  exitWithInitFailure(configureFailure({
@@ -3685,10 +3805,14 @@ async function runPlatformInit(projectNameArg, options) {
3685
3805
  logger.info(`Installing dependencies with ${projectPackageManager}...`);
3686
3806
  const pnpmCompatibilityArgs = getPnpmWorkspaceCompatibilityArgs(projectPackageManager, projectPath);
3687
3807
  const devHint = pnpmCompatibilityArgs.length > 0 ? resolvePostInitRunCommand(projectPackageManager, projectPath, false, pnpmCompatibilityArgs) : devCommandHint(projectPackageManager);
3688
- const installArgs = projectInstallArgs(projectPackageManager, projectPath, "install", [], {
3689
- isolateFromParent: true,
3690
- ignoreProjectWorkspace: pnpmCompatibilityArgs.length > 0
3691
- });
3808
+ const freshInstall = freshInstallOptions(projectPackageManager);
3809
+ const installArgs = [
3810
+ ...projectInstallArgs(projectPackageManager, projectPath, "install", [], {
3811
+ isolateFromParent: true,
3812
+ ignoreProjectWorkspace: pnpmCompatibilityArgs.length > 0
3813
+ }),
3814
+ ...freshInstall.args
3815
+ ];
3692
3816
  const installCommand = [projectPackageManager, ...installArgs].join(" ");
3693
3817
  if (pinProjectScopeRegistry(projectPath, { packageManager: projectPackageManager, isolateFromParent: true }, logger).blocked) {
3694
3818
  exitWithInitFailure(installFailure({
@@ -3706,7 +3830,7 @@ async function runPlatformInit(projectNameArg, options) {
3706
3830
  }
3707
3831
  });
3708
3832
  try {
3709
- await runCommand(projectPackageManager, installArgs, projectPath);
3833
+ await runCommand(projectPackageManager, installArgs, projectPath, { env: freshInstall.env });
3710
3834
  } catch (error) {
3711
3835
  stopResumeHintOnInterrupt();
3712
3836
  exitWithInitFailure(installFailure({
@@ -3718,7 +3842,7 @@ async function runPlatformInit(projectNameArg, options) {
3718
3842
  }
3719
3843
  stopResumeHintOnInterrupt();
3720
3844
  const repoUrl = project.repo_html_url ?? project.repo_clone_url;
3721
- const tokenLocation = path18.relative(cwd, envPath);
3845
+ const tokenLocation = path19.relative(cwd, envPath);
3722
3846
  if (options.dev === false) {
3723
3847
  logger.success("Your Standard Agents instance is ready.");
3724
3848
  logger.log(`Repository: ${repoUrl}`);
@@ -3818,8 +3942,8 @@ var MANAGED_PROVIDER_KEY_HINTS = [
3818
3942
  ""
3819
3943
  ].join("\n");
3820
3944
  function writeLocalDevVars(projectPath, input) {
3821
- const devVarsPath = path18.join(projectPath, DEV_VARS_FILENAME);
3822
- const existed = fs13.existsSync(devVarsPath);
3945
+ const devVarsPath = path19.join(projectPath, DEV_VARS_FILENAME);
3946
+ const existed = fs14.existsSync(devVarsPath);
3823
3947
  const existing = readDevVarsFile(projectPath);
3824
3948
  const wanted = [
3825
3949
  {
@@ -3850,7 +3974,7 @@ function writeLocalDevVars(projectPath, input) {
3850
3974
  }
3851
3975
  const missing = wanted.filter(({ key }) => !readDevVar(existing, key));
3852
3976
  if (existed && missing.length === 0) {
3853
- fs13.chmodSync(devVarsPath, 384);
3977
+ fs14.chmodSync(devVarsPath, 384);
3854
3978
  } else {
3855
3979
  let devVars = existed ? existing : LOCAL_DEV_VARS_HEADER;
3856
3980
  for (const { heading, key, value } of missing) {
@@ -3909,7 +4033,7 @@ async function init(projectNameArg, initOptions = {}) {
3909
4033
  }
3910
4034
  }
3911
4035
  const providedBootstrap = options.bootstrap?.trim() ?? "";
3912
- const needsLocalEnv = (candidate) => !providedBootstrap && !fs13.existsSync(path18.join(candidate.projectPath, ".dev.vars"));
4036
+ const needsLocalEnv = (candidate) => !providedBootstrap && !fs14.existsSync(path19.join(candidate.projectPath, ".dev.vars"));
3913
4037
  const existingProjectPackageManager = (candidate) => candidate.useExistingProject ? detectLockfilePackageManager(candidate.projectPath) : void 0;
3914
4038
  const initialTarget = resolveProjectTarget(cwd, projectNameArg);
3915
4039
  let target;
@@ -3983,8 +4107,8 @@ async function init(projectNameArg, initOptions = {}) {
3983
4107
  "Installing dependencies and applying Standard Agents project structure.",
3984
4108
  headerOptions
3985
4109
  );
3986
- const stopRemoveOnInterrupt = !useExistingProject && !fs13.existsSync(projectPath) ? interrupts.onInterrupt(() => {
3987
- fs13.rmSync(projectPath, { recursive: true, force: true });
4110
+ const stopRemoveOnInterrupt = !useExistingProject && !fs14.existsSync(projectPath) ? interrupts.onInterrupt(() => {
4111
+ fs14.rmSync(projectPath, { recursive: true, force: true });
3988
4112
  logger.log("");
3989
4113
  logger.info(`Setup interrupted. Removed the partial "${projectName}" directory.`);
3990
4114
  }) : () => {
@@ -4020,28 +4144,28 @@ async function init(projectNameArg, initOptions = {}) {
4020
4144
  );
4021
4145
  process.exit(1);
4022
4146
  }
4023
- const viteConfigPath = path18.join(projectPath, "vite.config.ts");
4024
- if (!fs13.existsSync(viteConfigPath)) {
4147
+ const viteConfigPath = path19.join(projectPath, "vite.config.ts");
4148
+ if (!fs14.existsSync(viteConfigPath)) {
4025
4149
  const viteConfigContent = `import { defineConfig } from 'vite'
4026
4150
 
4027
4151
  export default defineConfig({
4028
4152
  plugins: [],
4029
4153
  })
4030
4154
  `;
4031
- fs13.writeFileSync(viteConfigPath, viteConfigContent, "utf-8");
4155
+ fs14.writeFileSync(viteConfigPath, viteConfigContent, "utf-8");
4032
4156
  logSuccess("Created vite.config.ts");
4033
4157
  }
4034
4158
  writeBuildGuardScript(projectPath);
4035
4159
  } else {
4036
4160
  logInfo(`Detected existing Standard Agents project in "${projectName}".`);
4037
4161
  }
4038
- const packageJsonPath = path18.join(projectPath, "package.json");
4039
- if (fs13.existsSync(packageJsonPath)) {
4040
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
4162
+ const packageJsonPath = path19.join(projectPath, "package.json");
4163
+ if (fs14.existsSync(packageJsonPath)) {
4164
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
4041
4165
  const kebabName = toKebabCase(projectName);
4042
4166
  if (packageJson.name !== kebabName) {
4043
4167
  packageJson.name = kebabName;
4044
- fs13.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
4168
+ fs14.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
4045
4169
  }
4046
4170
  if (packageSpecifier === "workspace:*") {
4047
4171
  const workspaceRoot = resolveStandardAgentsWorkspaceRoot();
@@ -4066,7 +4190,7 @@ export default defineConfig({
4066
4190
  let projectPnpmCompatibilityArgs = [];
4067
4191
  try {
4068
4192
  const installBoundary = { isolateFromParent: packageSpecifier === "workspace:*" };
4069
- if (pm === "pnpm" && !installBoundary.isolateFromParent && !fs13.existsSync(path18.join(projectPath, "pnpm-workspace.yaml")) && findPnpmWorkspaceRoot(path18.dirname(projectPath))) {
4193
+ if (pm === "pnpm" && !installBoundary.isolateFromParent && !fs14.existsSync(path19.join(projectPath, "pnpm-workspace.yaml")) && findPnpmWorkspaceRoot(path19.dirname(projectPath))) {
4070
4194
  logInfo("The enclosing pnpm workspace controls esbuild and workerd build approvals.");
4071
4195
  }
4072
4196
  writeLocalPnpmBuildPolicy(projectPath, pm, {
@@ -4281,20 +4405,20 @@ var KEYCHAIN_SERVICE2 = "standardagents-cli";
4281
4405
  function configDir() {
4282
4406
  if (process.platform === "win32") {
4283
4407
  const appData = process.env.APPDATA;
4284
- if (appData) return path18.join(appData, "standardagents");
4408
+ if (appData) return path19.join(appData, "standardagents");
4285
4409
  }
4286
4410
  const xdgConfig = process.env.XDG_CONFIG_HOME;
4287
- if (xdgConfig) return path18.join(xdgConfig, "standardagents");
4288
- return path18.join(os5.homedir(), ".config", "standardagents");
4411
+ if (xdgConfig) return path19.join(xdgConfig, "standardagents");
4412
+ return path19.join(os5.homedir(), ".config", "standardagents");
4289
4413
  }
4290
4414
  function stateFilePath() {
4291
- return path18.join(configDir(), "auth-state.json");
4415
+ return path19.join(configDir(), "auth-state.json");
4292
4416
  }
4293
4417
  function cliAuthStatePath() {
4294
4418
  return stateFilePath();
4295
4419
  }
4296
4420
  function ensureStateDir() {
4297
- fs13.mkdirSync(path18.dirname(stateFilePath()), { recursive: true });
4421
+ fs14.mkdirSync(path19.dirname(stateFilePath()), { recursive: true });
4298
4422
  }
4299
4423
  function securityCommand(args) {
4300
4424
  const result = spawnSync("security", args, { encoding: "utf8" });
@@ -4323,11 +4447,11 @@ function deleteFromKeychain(orgId) {
4323
4447
  }
4324
4448
  function readCliAuthState() {
4325
4449
  const file = stateFilePath();
4326
- if (!fs13.existsSync(file)) {
4450
+ if (!fs14.existsSync(file)) {
4327
4451
  return { active_org_id: null, orgs: {} };
4328
4452
  }
4329
4453
  try {
4330
- const parsed = JSON.parse(fs13.readFileSync(file, "utf8"));
4454
+ const parsed = JSON.parse(fs14.readFileSync(file, "utf8"));
4331
4455
  return {
4332
4456
  active_org_id: parsed.active_org_id ?? null,
4333
4457
  orgs: parsed.orgs ?? {},
@@ -4381,7 +4505,7 @@ function hasStoredCliAuth() {
4381
4505
  return Object.keys(state.orgs).length > 0;
4382
4506
  }
4383
4507
  function gitAuthKeychainAccount(endpoint) {
4384
- const owner = `${path18.resolve(stateFilePath())}\0${endpoint}`;
4508
+ const owner = `${path19.resolve(stateFilePath())}\0${endpoint}`;
4385
4509
  return `git-auth-${createHash("sha256").update(owner).digest("hex").slice(0, 32)}`;
4386
4510
  }
4387
4511
  function parseGitAuthSecrets(text2) {
@@ -4723,11 +4847,11 @@ function wasReplacedByRetry(build) {
4723
4847
  return build.error_code === LEGAL_ACCEPTANCE_RETRIED;
4724
4848
  }
4725
4849
  function findDevVars(startDir) {
4726
- let current = path18.resolve(startDir);
4850
+ let current = path19.resolve(startDir);
4727
4851
  while (true) {
4728
- const candidate = path18.join(current, DEV_VARS_FILENAME);
4729
- if (fs13.existsSync(candidate)) return fs13.readFileSync(candidate, "utf-8");
4730
- const parent = path18.dirname(current);
4852
+ const candidate = path19.join(current, DEV_VARS_FILENAME);
4853
+ if (fs14.existsSync(candidate)) return fs14.readFileSync(candidate, "utf-8");
4854
+ const parent = path19.dirname(current);
4731
4855
  if (parent === current) return "";
4732
4856
  current = parent;
4733
4857
  }
@@ -5070,19 +5194,19 @@ function standardAgentsRemote(dir) {
5070
5194
  return remote && isStandardAgentsGitRemote(remote) ? remote : null;
5071
5195
  }
5072
5196
  function findProjectDir(cwd) {
5073
- let start = path18.resolve(cwd);
5197
+ let start = path19.resolve(cwd);
5074
5198
  try {
5075
- start = fs13.realpathSync(start);
5199
+ start = fs14.realpathSync(start);
5076
5200
  } catch {
5077
5201
  return null;
5078
5202
  }
5079
5203
  const toplevel = gitOutput(start, ["rev-parse", "--show-toplevel"]);
5080
- const root = toplevel ? path18.resolve(toplevel) : null;
5081
- for (let current = start; ; current = path18.dirname(current)) {
5082
- if (fs13.existsSync(path18.join(current, DEV_VARS_FILENAME)) || isStandardAgentsProjectDir(current)) {
5204
+ const root = toplevel ? path19.resolve(toplevel) : null;
5205
+ for (let current = start; ; current = path19.dirname(current)) {
5206
+ if (fs14.existsSync(path19.join(current, DEV_VARS_FILENAME)) || isStandardAgentsProjectDir(current)) {
5083
5207
  return current;
5084
5208
  }
5085
- if (!root || current === root || path18.dirname(current) === current) break;
5209
+ if (!root || current === root || path19.dirname(current) === current) break;
5086
5210
  }
5087
5211
  return root && standardAgentsRemote(root) ? root : null;
5088
5212
  }
@@ -5202,7 +5326,7 @@ async function performLogin(options = {}) {
5202
5326
  return { record, keyReused: accessKey?.reused === true, store, helper, ...helperError ? { helperError } : {}, project };
5203
5327
  }
5204
5328
  function reportProject(project) {
5205
- const devVars = path18.join(path18.relative(process.cwd(), project.dir), DEV_VARS_FILENAME);
5329
+ const devVars = path19.join(path19.relative(process.cwd(), project.dir), DEV_VARS_FILENAME);
5206
5330
  if (project.status === "key_saved") {
5207
5331
  logger.log(`Project: saved a project API key in ${devVars}. Local sign-in uses your Standard Agents account.`);
5208
5332
  return;
@@ -5336,7 +5460,7 @@ function registerLoginCommands(program2) {
5336
5460
  }
5337
5461
  function readSession(statePath) {
5338
5462
  try {
5339
- const parsed = JSON.parse(fs13.readFileSync(statePath, "utf-8"));
5463
+ const parsed = JSON.parse(fs14.readFileSync(statePath, "utf-8"));
5340
5464
  if (!parsed || typeof parsed !== "object") return null;
5341
5465
  const { endpoint, session_cookie: cookie } = parsed;
5342
5466
  return typeof endpoint === "string" && endpoint && typeof cookie === "string" && cookie ? { endpoint, cookie } : null;
@@ -5345,10 +5469,10 @@ function readSession(statePath) {
5345
5469
  }
5346
5470
  }
5347
5471
  function removeLegacyProjectSession(projectPath) {
5348
- const statePath = path18.join(projectPath, BOOTSTRAP_STATE_RELATIVE_PATH);
5349
- if (!fs13.existsSync(statePath)) return null;
5472
+ const statePath = path19.join(projectPath, BOOTSTRAP_STATE_RELATIVE_PATH);
5473
+ if (!fs14.existsSync(statePath)) return null;
5350
5474
  const session = readSession(statePath);
5351
- fs13.unlinkSync(statePath);
5475
+ fs14.unlinkSync(statePath);
5352
5476
  return { file: BOOTSTRAP_STATE_RELATIVE_PATH, session };
5353
5477
  }
5354
5478
  var GIT_TOKEN_SCOPE_ENV = "STANDARD_AGENTS_GIT_TOKEN_SCOPE";
@@ -5377,7 +5501,7 @@ function gitSubcommand(args) {
5377
5501
  }
5378
5502
  function gitTokenScopeFor(ancestors) {
5379
5503
  for (const { argv, exact } of ancestors) {
5380
- const program2 = path18.basename(argv[0] ?? "").toLowerCase().replace(/\.exe$/, "");
5504
+ const program2 = path19.basename(argv[0] ?? "").toLowerCase().replace(/\.exe$/, "");
5381
5505
  if (program2 !== "git") continue;
5382
5506
  const command = gitSubcommand(argv.slice(1));
5383
5507
  if (command?.startsWith("remote-http")) continue;
@@ -5389,8 +5513,8 @@ function gitTokenScopeFor(ancestors) {
5389
5513
  }
5390
5514
  function procfsProcess(pid) {
5391
5515
  try {
5392
- const argv = fs13.readFileSync(`/proc/${pid}/cmdline`, "utf8").split("\0").filter(Boolean);
5393
- const stat = fs13.readFileSync(`/proc/${pid}/stat`, "utf8");
5516
+ const argv = fs14.readFileSync(`/proc/${pid}/cmdline`, "utf8").split("\0").filter(Boolean);
5517
+ const stat = fs14.readFileSync(`/proc/${pid}/stat`, "utf8");
5394
5518
  const parent = Number.parseInt(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1], 10);
5395
5519
  return Number.isInteger(parent) ? { argv, parent } : null;
5396
5520
  } catch {
@@ -5405,7 +5529,7 @@ function psProcess(pid) {
5405
5529
  }
5406
5530
  function* readAncestorCommands(startPid = process.ppid) {
5407
5531
  if (process.platform === "win32") return;
5408
- const exact = fs13.existsSync("/proc/self/stat");
5532
+ const exact = fs14.existsSync("/proc/self/stat");
5409
5533
  let pid = startPid;
5410
5534
  for (let depth = 0; pid > 1 && depth < MAX_ANCESTORS; depth += 1) {
5411
5535
  const entry = exact ? procfsProcess(pid) : psProcess(pid);
@@ -5437,11 +5561,11 @@ function parseCredentialRequest(input) {
5437
5561
  return result;
5438
5562
  }
5439
5563
  function findDotDevVars(startDir = process.cwd()) {
5440
- let current = path18.resolve(startDir);
5564
+ let current = path19.resolve(startDir);
5441
5565
  while (true) {
5442
- const candidate = path18.join(current, DEV_VARS_FILENAME);
5443
- if (fs13.existsSync(candidate)) return candidate;
5444
- const parent = path18.dirname(current);
5566
+ const candidate = path19.join(current, DEV_VARS_FILENAME);
5567
+ if (fs14.existsSync(candidate)) return candidate;
5568
+ const parent = path19.dirname(current);
5445
5569
  if (parent === current) return null;
5446
5570
  current = parent;
5447
5571
  }
@@ -5449,7 +5573,7 @@ function findDotDevVars(startDir = process.cwd()) {
5449
5573
  var PROJECT_API_KEY = "STANDARD_AGENTS_API_KEY";
5450
5574
  function credentialSources(options) {
5451
5575
  const envPath = findDotDevVars(options.startDir);
5452
- const devVars = envPath ? readDevVarsFile(path18.dirname(envPath)) : "";
5576
+ const devVars = envPath ? readDevVarsFile(path19.dirname(envPath)) : "";
5453
5577
  const fileVar = (key) => readDevVar(devVars, key)?.trim() ?? "";
5454
5578
  const endpoint = configuredPlatformEndpoint(
5455
5579
  options.endpoint,
@@ -5600,7 +5724,7 @@ var ENVIRONMENT_CREDENTIAL_KEYS = [
5600
5724
  ];
5601
5725
  function resolveProjectDir(startDir) {
5602
5726
  const devVarsPath = findDotDevVars(startDir);
5603
- return devVarsPath ? path18.dirname(devVarsPath) : path18.resolve(startDir);
5727
+ return devVarsPath ? path19.dirname(devVarsPath) : path19.resolve(startDir);
5604
5728
  }
5605
5729
  function recordRevocation(report, outcome, labels) {
5606
5730
  if (outcome.status === "revoked") {
@@ -5957,9 +6081,9 @@ export default defineConfig(({ mode }) => {
5957
6081
  }
5958
6082
  function getReactPackageVersion() {
5959
6083
  try {
5960
- const __dirname = path18.dirname(fileURLToPath(import.meta.url));
5961
- const pkgPath = path18.resolve(__dirname, "../package.json");
5962
- const pkg = JSON.parse(fs13.readFileSync(pkgPath, "utf-8"));
6084
+ const __dirname = path19.dirname(fileURLToPath(import.meta.url));
6085
+ const pkgPath = path19.resolve(__dirname, "../package.json");
6086
+ const pkg = JSON.parse(fs14.readFileSync(pkgPath, "utf-8"));
5963
6087
  const version = pkg.version;
5964
6088
  const prereleaseMatch = version.match(/-([a-z]+)\./i);
5965
6089
  if (prereleaseMatch) {
@@ -5971,9 +6095,9 @@ function getReactPackageVersion() {
5971
6095
  }
5972
6096
  }
5973
6097
  function getChatSourceDir() {
5974
- const __dirname = path18.dirname(fileURLToPath(import.meta.url));
5975
- const bundled = path18.resolve(__dirname, "../chat");
5976
- return fs13.existsSync(bundled) ? bundled : path18.resolve(__dirname, "../../chat");
6098
+ const __dirname = path19.dirname(fileURLToPath(import.meta.url));
6099
+ const bundled = path19.resolve(__dirname, "../chat");
6100
+ return fs14.existsSync(bundled) ? bundled : path19.resolve(__dirname, "../../chat");
5977
6101
  }
5978
6102
  async function prompt(question) {
5979
6103
  const rl = readline.createInterface({
@@ -5994,10 +6118,10 @@ function detectPackageManager2() {
5994
6118
  if (userAgent.includes("yarn")) return "yarn";
5995
6119
  if (userAgent.includes("bun")) return "bun";
5996
6120
  }
5997
- if (fs13.existsSync("pnpm-lock.yaml")) return "pnpm";
5998
- if (fs13.existsSync("yarn.lock")) return "yarn";
5999
- if (fs13.existsSync("bun.lockb")) return "bun";
6000
- if (fs13.existsSync("package-lock.json")) return "npm";
6121
+ if (fs14.existsSync("pnpm-lock.yaml")) return "pnpm";
6122
+ if (fs14.existsSync("yarn.lock")) return "yarn";
6123
+ if (fs14.existsSync("bun.lockb")) return "bun";
6124
+ if (fs14.existsSync("package-lock.json")) return "npm";
6001
6125
  return "npm";
6002
6126
  }
6003
6127
  async function selectPackageManager(detected) {
@@ -6226,25 +6350,25 @@ minimumReleaseAgeExclude:
6226
6350
  `;
6227
6351
  }
6228
6352
  function copyDir(src, dest, skip = []) {
6229
- if (!fs13.existsSync(dest)) {
6230
- fs13.mkdirSync(dest, { recursive: true });
6353
+ if (!fs14.existsSync(dest)) {
6354
+ fs14.mkdirSync(dest, { recursive: true });
6231
6355
  }
6232
- const entries = fs13.readdirSync(src, { withFileTypes: true });
6356
+ const entries = fs14.readdirSync(src, { withFileTypes: true });
6233
6357
  for (const entry of entries) {
6234
6358
  if (skip.includes(entry.name) || /\.test\.tsx?$/.test(entry.name)) continue;
6235
- const srcPath = path18.join(src, entry.name);
6236
- const destPath = path18.join(dest, entry.name);
6359
+ const srcPath = path19.join(src, entry.name);
6360
+ const destPath = path19.join(dest, entry.name);
6237
6361
  if (entry.isDirectory()) {
6238
6362
  copyDir(srcPath, destPath, skip);
6239
6363
  } else {
6240
- fs13.copyFileSync(srcPath, destPath);
6364
+ fs14.copyFileSync(srcPath, destPath);
6241
6365
  }
6242
6366
  }
6243
6367
  }
6244
6368
  async function initChat(projectNameArg, options = {}) {
6245
6369
  const cwd = process.cwd();
6246
6370
  const chatSourceDir = getChatSourceDir();
6247
- if (!fs13.existsSync(chatSourceDir)) {
6371
+ if (!fs14.existsSync(chatSourceDir)) {
6248
6372
  logger.error("Chat source files not found. This CLI installation may be corrupted.");
6249
6373
  process.exit(1);
6250
6374
  }
@@ -6264,8 +6388,8 @@ async function initChat(projectNameArg, options = {}) {
6264
6388
  logger.error("Project name is required");
6265
6389
  process.exit(1);
6266
6390
  }
6267
- const projectPath = path18.join(cwd, projectName);
6268
- if (fs13.existsSync(projectPath)) {
6391
+ const projectPath = path19.join(cwd, projectName);
6392
+ if (fs14.existsSync(projectPath)) {
6269
6393
  logger.error(`Directory "${projectName}" already exists`);
6270
6394
  process.exit(1);
6271
6395
  }
@@ -6299,7 +6423,7 @@ async function initChat(projectNameArg, options = {}) {
6299
6423
  logger.log("");
6300
6424
  logger.info(`Creating ${framework === "vite" ? "Vite" : "Next.js"} project...`);
6301
6425
  logger.log("");
6302
- fs13.mkdirSync(projectPath, { recursive: true });
6426
+ fs14.mkdirSync(projectPath, { recursive: true });
6303
6427
  const reactVersion = getReactPackageVersion();
6304
6428
  if (framework === "vite") {
6305
6429
  await scaffoldVite(projectPath, chatSourceDir, projectName, serverUrl, reactVersion);
@@ -6362,25 +6486,25 @@ async function initChat(projectNameArg, options = {}) {
6362
6486
  }
6363
6487
  }
6364
6488
  async function scaffoldVite(projectPath, chatSourceDir, projectName, serverUrl, reactVersion) {
6365
- copyDir(path18.join(chatSourceDir, "src"), path18.join(projectPath, "src"), []);
6489
+ copyDir(path19.join(chatSourceDir, "src"), path19.join(projectPath, "src"), []);
6366
6490
  logger.success("Copied src/");
6367
- const viteDir = path18.join(chatSourceDir, "vite");
6368
- let indexHtml = fs13.readFileSync(path18.join(viteDir, "index.html"), "utf-8");
6491
+ const viteDir = path19.join(chatSourceDir, "vite");
6492
+ let indexHtml = fs14.readFileSync(path19.join(viteDir, "index.html"), "utf-8");
6369
6493
  indexHtml = indexHtml.replace('src="/main.tsx"', 'src="/src/main.tsx"');
6370
- fs13.writeFileSync(path18.join(projectPath, "index.html"), indexHtml, "utf-8");
6494
+ fs14.writeFileSync(path19.join(projectPath, "index.html"), indexHtml, "utf-8");
6371
6495
  logger.success("Created index.html");
6372
- fs13.copyFileSync(path18.join(viteDir, "main.tsx"), path18.join(projectPath, "src", "main.tsx"));
6496
+ fs14.copyFileSync(path19.join(viteDir, "main.tsx"), path19.join(projectPath, "src", "main.tsx"));
6373
6497
  logger.success("Created src/main.tsx");
6374
- fs13.writeFileSync(path18.join(projectPath, "vite.config.ts"), renderChatViteConfig(), "utf-8");
6498
+ fs14.writeFileSync(path19.join(projectPath, "vite.config.ts"), renderChatViteConfig(), "utf-8");
6375
6499
  logger.success("Created vite.config.ts");
6376
- fs13.copyFileSync(path18.join(chatSourceDir, "tsconfig.json"), path18.join(projectPath, "tsconfig.json"));
6377
- const tsconfig = JSON.parse(fs13.readFileSync(path18.join(projectPath, "tsconfig.json"), "utf-8"));
6500
+ fs14.copyFileSync(path19.join(chatSourceDir, "tsconfig.json"), path19.join(projectPath, "tsconfig.json"));
6501
+ const tsconfig = JSON.parse(fs14.readFileSync(path19.join(projectPath, "tsconfig.json"), "utf-8"));
6378
6502
  tsconfig.include = ["src"];
6379
6503
  delete tsconfig.compilerOptions?.paths;
6380
- fs13.writeFileSync(path18.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6504
+ fs14.writeFileSync(path19.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6381
6505
  logger.success("Created tsconfig.json");
6382
- fs13.copyFileSync(path18.join(chatSourceDir, "package.json"), path18.join(projectPath, "package.json"));
6383
- const pkg = JSON.parse(fs13.readFileSync(path18.join(projectPath, "package.json"), "utf-8"));
6506
+ fs14.copyFileSync(path19.join(chatSourceDir, "package.json"), path19.join(projectPath, "package.json"));
6507
+ const pkg = JSON.parse(fs14.readFileSync(path19.join(projectPath, "package.json"), "utf-8"));
6384
6508
  pkg.name = projectName;
6385
6509
  pkg.scripts = { ...CHAT_SCRIPTS.vite };
6386
6510
  delete pkg.private;
@@ -6391,36 +6515,36 @@ async function scaffoldVite(projectPath, chatSourceDir, projectName, serverUrl,
6391
6515
  delete pkg.devDependencies?.["@tailwindcss/postcss"];
6392
6516
  delete pkg.devDependencies?.["postcss"];
6393
6517
  delete pkg.devDependencies?.["vitest"];
6394
- fs13.writeFileSync(path18.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6395
- fs13.writeFileSync(path18.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6518
+ fs14.writeFileSync(path19.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6519
+ fs14.writeFileSync(path19.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6396
6520
  logger.success("Created package.json");
6397
6521
  const envContent = `# Standard Agents Builder connection
6398
6522
  VITE_AGENTBUILDER_URL=${serverUrl}
6399
6523
  `;
6400
- fs13.writeFileSync(path18.join(projectPath, ".env"), envContent, "utf-8");
6524
+ fs14.writeFileSync(path19.join(projectPath, ".env"), envContent, "utf-8");
6401
6525
  logger.success("Created .env");
6402
- fs13.writeFileSync(path18.join(projectPath, ".gitignore"), `node_modules
6526
+ fs14.writeFileSync(path19.join(projectPath, ".gitignore"), `node_modules
6403
6527
  dist
6404
6528
  .env
6405
6529
  `, "utf-8");
6406
6530
  logger.success("Created .gitignore");
6407
- let mainTsx = fs13.readFileSync(path18.join(projectPath, "src", "main.tsx"), "utf-8");
6531
+ let mainTsx = fs14.readFileSync(path19.join(projectPath, "src", "main.tsx"), "utf-8");
6408
6532
  mainTsx = mainTsx.replace(/from '\.\.\/src\//g, "from './").replace(/import '\.\.\/src\//g, "import './");
6409
- fs13.writeFileSync(path18.join(projectPath, "src", "main.tsx"), mainTsx, "utf-8");
6410
- if (fs13.existsSync(path18.join(viteDir, "favicon.svg"))) {
6411
- fs13.copyFileSync(path18.join(viteDir, "favicon.svg"), path18.join(projectPath, "favicon.svg"));
6533
+ fs14.writeFileSync(path19.join(projectPath, "src", "main.tsx"), mainTsx, "utf-8");
6534
+ if (fs14.existsSync(path19.join(viteDir, "favicon.svg"))) {
6535
+ fs14.copyFileSync(path19.join(viteDir, "favicon.svg"), path19.join(projectPath, "favicon.svg"));
6412
6536
  logger.success("Created favicon.svg");
6413
6537
  }
6414
6538
  }
6415
6539
  async function scaffoldNextjs(projectPath, chatSourceDir, projectName, serverUrl, reactVersion) {
6416
- copyDir(path18.join(chatSourceDir, "src"), path18.join(projectPath, "src"), []);
6540
+ copyDir(path19.join(chatSourceDir, "src"), path19.join(projectPath, "src"), []);
6417
6541
  logger.success("Copied src/");
6418
- const nextDir = path18.join(chatSourceDir, "next");
6419
- copyDir(path18.join(nextDir, "app"), path18.join(projectPath, "app"), []);
6542
+ const nextDir = path19.join(chatSourceDir, "next");
6543
+ copyDir(path19.join(nextDir, "app"), path19.join(projectPath, "app"), []);
6420
6544
  logger.success("Copied app/");
6421
- fs13.copyFileSync(path18.join(nextDir, "next.config.ts"), path18.join(projectPath, "next.config.ts"));
6545
+ fs14.copyFileSync(path19.join(nextDir, "next.config.ts"), path19.join(projectPath, "next.config.ts"));
6422
6546
  logger.success("Created next.config.ts");
6423
- fs13.copyFileSync(path18.join(nextDir, "postcss.config.mjs"), path18.join(projectPath, "postcss.config.mjs"));
6547
+ fs14.copyFileSync(path19.join(nextDir, "postcss.config.mjs"), path19.join(projectPath, "postcss.config.mjs"));
6424
6548
  logger.success("Created postcss.config.mjs");
6425
6549
  const tsconfig = {
6426
6550
  compilerOptions: {
@@ -6445,9 +6569,9 @@ async function scaffoldNextjs(projectPath, chatSourceDir, projectName, serverUrl
6445
6569
  include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
6446
6570
  exclude: ["node_modules"]
6447
6571
  };
6448
- fs13.writeFileSync(path18.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6572
+ fs14.writeFileSync(path19.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6449
6573
  logger.success("Created tsconfig.json");
6450
- const pkg = JSON.parse(fs13.readFileSync(path18.join(chatSourceDir, "package.json"), "utf-8"));
6574
+ const pkg = JSON.parse(fs14.readFileSync(path19.join(chatSourceDir, "package.json"), "utf-8"));
6451
6575
  pkg.name = projectName;
6452
6576
  pkg.scripts = { ...CHAT_SCRIPTS.nextjs };
6453
6577
  delete pkg.private;
@@ -6458,26 +6582,26 @@ async function scaffoldNextjs(projectPath, chatSourceDir, projectName, serverUrl
6458
6582
  delete pkg.devDependencies?.["@vitejs/plugin-react"];
6459
6583
  delete pkg.devDependencies?.["vite"];
6460
6584
  delete pkg.devDependencies?.["vitest"];
6461
- fs13.writeFileSync(path18.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6462
- fs13.writeFileSync(path18.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6585
+ fs14.writeFileSync(path19.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6586
+ fs14.writeFileSync(path19.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6463
6587
  logger.success("Created package.json");
6464
6588
  const envContent = `# Standard Agents Builder connection
6465
6589
  NEXT_PUBLIC_AGENTBUILDER_URL=${serverUrl}
6466
6590
  `;
6467
- fs13.writeFileSync(path18.join(projectPath, ".env.local"), envContent, "utf-8");
6591
+ fs14.writeFileSync(path19.join(projectPath, ".env.local"), envContent, "utf-8");
6468
6592
  logger.success("Created .env.local");
6469
- fs13.writeFileSync(path18.join(projectPath, ".gitignore"), `node_modules
6593
+ fs14.writeFileSync(path19.join(projectPath, ".gitignore"), `node_modules
6470
6594
  .next
6471
6595
  out
6472
6596
  .env.local
6473
6597
  `, "utf-8");
6474
6598
  logger.success("Created .gitignore");
6475
- let layoutTsx = fs13.readFileSync(path18.join(projectPath, "app", "layout.tsx"), "utf-8");
6599
+ let layoutTsx = fs14.readFileSync(path19.join(projectPath, "app", "layout.tsx"), "utf-8");
6476
6600
  layoutTsx = layoutTsx.replace(/from '\.\.\/\.\.\/src\//g, "from '../src/");
6477
- fs13.writeFileSync(path18.join(projectPath, "app", "layout.tsx"), layoutTsx, "utf-8");
6478
- let pageTsx = fs13.readFileSync(path18.join(projectPath, "app", "page.tsx"), "utf-8");
6601
+ fs14.writeFileSync(path19.join(projectPath, "app", "layout.tsx"), layoutTsx, "utf-8");
6602
+ let pageTsx = fs14.readFileSync(path19.join(projectPath, "app", "page.tsx"), "utf-8");
6479
6603
  pageTsx = pageTsx.replace(/from '\.\.\/\.\.\/src\//g, "from '../src/");
6480
- fs13.writeFileSync(path18.join(projectPath, "app", "page.tsx"), pageTsx, "utf-8");
6604
+ fs14.writeFileSync(path19.join(projectPath, "app", "page.tsx"), pageTsx, "utf-8");
6481
6605
  }
6482
6606
 
6483
6607
  // src/commands/init-chat-command.ts
@@ -6514,7 +6638,7 @@ function packageManagerFor(rootDir) {
6514
6638
  }
6515
6639
  function declaresBuilder(rootDir) {
6516
6640
  try {
6517
- const manifest = JSON.parse(fs13.readFileSync(path18.join(rootDir, "package.json"), "utf-8"));
6641
+ const manifest = JSON.parse(fs14.readFileSync(path19.join(rootDir, "package.json"), "utf-8"));
6518
6642
  if (!manifest || typeof manifest !== "object") return false;
6519
6643
  return ["dependencies", "devDependencies"].some((field2) => {
6520
6644
  const dependencies = Reflect.get(manifest, field2);
@@ -6530,15 +6654,15 @@ function builderInstallCommand(rootDir) {
6530
6654
  return packageManager === "npm" ? `npm install ${BUILDER}` : `${packageManager} add ${BUILDER}`;
6531
6655
  }
6532
6656
  function findInstalledBuilder(rootDir) {
6533
- for (let dir = path18.resolve(rootDir); ; dir = path18.dirname(dir)) {
6534
- const candidate = path18.join(dir, "node_modules", BUILDER);
6535
- if (fs13.existsSync(path18.join(candidate, "package.json"))) return candidate;
6536
- if (path18.dirname(dir) === dir) return void 0;
6657
+ for (let dir = path19.resolve(rootDir); ; dir = path19.dirname(dir)) {
6658
+ const candidate = path19.join(dir, "node_modules", BUILDER);
6659
+ if (fs14.existsSync(path19.join(candidate, "package.json"))) return candidate;
6660
+ if (path19.dirname(dir) === dir) return void 0;
6537
6661
  }
6538
6662
  }
6539
6663
  function installedVersion(builderDir) {
6540
6664
  try {
6541
- const manifest = JSON.parse(fs13.readFileSync(path18.join(builderDir, "package.json"), "utf-8"));
6665
+ const manifest = JSON.parse(fs14.readFileSync(path19.join(builderDir, "package.json"), "utf-8"));
6542
6666
  const version = manifest && typeof manifest === "object" ? Reflect.get(manifest, "version") : void 0;
6543
6667
  return typeof version === "string" ? version : "unknown version";
6544
6668
  } catch {
@@ -6555,7 +6679,7 @@ async function loadProjectPacking(rootDir) {
6555
6679
  }
6556
6680
  let entry;
6557
6681
  try {
6558
- entry = createRequire(path18.join(rootDir, "package.json")).resolve(PACKING_ENTRY);
6682
+ entry = createRequire(path19.join(rootDir, "package.json")).resolve(PACKING_ENTRY);
6559
6683
  } catch (error) {
6560
6684
  const installed = `${BUILDER} ${installedVersion(builderDir)} at ${builderDir}`;
6561
6685
  if (errorCode(error) === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
@@ -6580,7 +6704,7 @@ async function loadProjectPacking(rootDir) {
6580
6704
  }
6581
6705
  }
6582
6706
  async function requireProjectPacking(rootDir) {
6583
- if (!fs13.existsSync(path18.join(rootDir, "agents"))) {
6707
+ if (!fs14.existsSync(path19.join(rootDir, "agents"))) {
6584
6708
  throw new PackingUnavailableError(
6585
6709
  `No agents/ directory in ${rootDir}.`,
6586
6710
  "Run this command from the root of a Standard Agents project.",
@@ -6853,12 +6977,12 @@ async function pack(agentName, options) {
6853
6977
  if (removed.length > 0) {
6854
6978
  logger.warning("Packing removes these original files from the project. The package keeps a copy of each. Pass --no-remove to keep them:");
6855
6979
  for (const item of removed) {
6856
- logger.detail(` - ${path18.relative(rootDir, item.filePath)}`);
6980
+ logger.detail(` - ${path19.relative(rootDir, item.filePath)}`);
6857
6981
  }
6858
6982
  } else {
6859
6983
  logger.info("Original files are kept. Packing removes nothing from the project.");
6860
6984
  }
6861
- const outputDir = options.output || path18.join(rootDir, "agents", "packed");
6985
+ const outputDir = options.output || path19.join(rootDir, "agents", "packed");
6862
6986
  logger.info(`Packing to: ${outputDir}`);
6863
6987
  const result = await packingService.pack({
6864
6988
  agentName: selectedAgent,
@@ -6957,7 +7081,7 @@ async function unpack(pkgIdentifier) {
6957
7081
  console.log("");
6958
7082
  logger.info("Created files:");
6959
7083
  for (const file of result.filesGenerated) {
6960
- const relPath = path18.relative(rootDir, file);
7084
+ const relPath = path19.relative(rootDir, file);
6961
7085
  console.log(` - ${relPath}`);
6962
7086
  }
6963
7087
  }
@@ -7877,8 +8001,8 @@ var PROJECT_SIGNAL_PATHS = [
7877
8001
  "vite.config.mjs"
7878
8002
  ];
7879
8003
  function hasProjectSignals(cwd) {
7880
- const hits = PROJECT_SIGNAL_PATHS.filter((signal) => fs13.existsSync(path18.join(cwd, signal))).length;
7881
- return hits >= 2 || fs13.existsSync(path18.join(cwd, ".agents"));
8004
+ const hits = PROJECT_SIGNAL_PATHS.filter((signal) => fs14.existsSync(path19.join(cwd, signal))).length;
8005
+ return hits >= 2 || fs14.existsSync(path19.join(cwd, ".agents"));
7882
8006
  }
7883
8007
  function detectCliDirectoryContext(cwd = process.cwd()) {
7884
8008
  if (!hasProjectSignals(cwd)) {
@@ -8047,13 +8171,13 @@ async function runHomeTui(cwd = process.cwd()) {
8047
8171
  }
8048
8172
  var DEFAULT_SKILL_NAME = "agentbuilder";
8049
8173
  function resolveCodexHome(env = process.env, homeDir = os5.homedir()) {
8050
- return env.CODEX_HOME || path18.join(homeDir, ".codex");
8174
+ return env.CODEX_HOME || path19.join(homeDir, ".codex");
8051
8175
  }
8052
8176
  function resolveClaudeHome(homeDir = os5.homedir()) {
8053
- return path18.join(homeDir, ".claude");
8177
+ return path19.join(homeDir, ".claude");
8054
8178
  }
8055
8179
  function resolveAgentsHome(homeDir = os5.homedir()) {
8056
- return path18.join(homeDir, ".agents");
8180
+ return path19.join(homeDir, ".agents");
8057
8181
  }
8058
8182
  function normalizeTargetId(target) {
8059
8183
  if (target === "codex" || target === "agents") {
@@ -8066,12 +8190,12 @@ function expandHomePath(inputPath, homeDir = os5.homedir()) {
8066
8190
  return homeDir;
8067
8191
  }
8068
8192
  if (inputPath.startsWith("~/")) {
8069
- return path18.join(homeDir, inputPath.slice(2));
8193
+ return path19.join(homeDir, inputPath.slice(2));
8070
8194
  }
8071
8195
  return inputPath;
8072
8196
  }
8073
8197
  function buildInstallTargets(options = {}, env = process.env, homeDir = os5.homedir()) {
8074
- const customRoot = options.dir ? path18.resolve(expandHomePath(options.dir, homeDir)) : null;
8198
+ const customRoot = options.dir ? path19.resolve(expandHomePath(options.dir, homeDir)) : null;
8075
8199
  const agentsHome = resolveAgentsHome(homeDir);
8076
8200
  const claudeHome = resolveClaudeHome(homeDir);
8077
8201
  return [
@@ -8079,15 +8203,15 @@ function buildInstallTargets(options = {}, env = process.env, homeDir = os5.home
8079
8203
  id: "agents",
8080
8204
  label: "Codex and other coding agents",
8081
8205
  summary: "Agent Skills folder read by Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, and others",
8082
- detected: fs13.existsSync(agentsHome) || fs13.existsSync(resolveCodexHome(env, homeDir)),
8083
- installPath: customRoot ?? path18.join(agentsHome, "skills")
8206
+ detected: fs14.existsSync(agentsHome) || fs14.existsSync(resolveCodexHome(env, homeDir)),
8207
+ installPath: customRoot ?? path19.join(agentsHome, "skills")
8084
8208
  },
8085
8209
  {
8086
8210
  id: "claude",
8087
8211
  label: "Claude Code",
8088
8212
  summary: "Agent Skills folder read by Claude Code",
8089
- detected: fs13.existsSync(claudeHome),
8090
- installPath: customRoot ?? path18.join(claudeHome, "skills")
8213
+ detected: fs14.existsSync(claudeHome),
8214
+ installPath: customRoot ?? path19.join(claudeHome, "skills")
8091
8215
  }
8092
8216
  ];
8093
8217
  }
@@ -8107,8 +8231,8 @@ function findSupersededInstalls(targetId, skillName = DEFAULT_SKILL_NAME, option
8107
8231
  if (options.dir) {
8108
8232
  return [];
8109
8233
  }
8110
- const superseded = normalizeTargetId(targetId) === "claude" ? path18.join(resolveClaudeHome(homeDir), "agents", `${skillName}.md`) : path18.join(resolveCodexHome(env, homeDir), "skills", skillName);
8111
- return fs13.existsSync(superseded) ? [superseded] : [];
8234
+ const superseded = normalizeTargetId(targetId) === "claude" ? path19.join(resolveClaudeHome(homeDir), "agents", `${skillName}.md`) : path19.join(resolveCodexHome(env, homeDir), "skills", skillName);
8235
+ return fs14.existsSync(superseded) ? [superseded] : [];
8112
8236
  }
8113
8237
  async function selectInstallTarget(targets) {
8114
8238
  return new Promise((resolve) => {
@@ -8172,8 +8296,8 @@ async function selectInstallTarget(targets) {
8172
8296
  }
8173
8297
  async function installBundledSkill(targetId, skillName = DEFAULT_SKILL_NAME, options = {}) {
8174
8298
  const target = resolveSelectedTarget(targetId, options);
8175
- const targetDir = path18.join(target.installPath, skillName);
8176
- if (fs13.existsSync(targetDir) && !options.force) {
8299
+ const targetDir = path19.join(target.installPath, skillName);
8300
+ if (fs14.existsSync(targetDir) && !options.force) {
8177
8301
  throw new Error(
8178
8302
  `Skill already exists at ${targetDir}. Re-run with --force to overwrite it.`
8179
8303
  );
@@ -8201,7 +8325,7 @@ async function skill(options = {}) {
8201
8325
  logger.log("");
8202
8326
  logger.log("Next steps:");
8203
8327
  logger.log(` Restart ${selectedTarget.id === "claude" ? "Claude Code" : "your coding agent"} if it is already running`);
8204
- logger.log(` Edit ${path18.join(installedPath, "SKILL.md")} to continue customizing the skill`);
8328
+ logger.log(` Edit ${path19.join(installedPath, "SKILL.md")} to continue customizing the skill`);
8205
8329
  for (const superseded of findSupersededInstalls(
8206
8330
  selectedTarget.id,
8207
8331
  DEFAULT_SKILL_NAME,
@@ -8364,24 +8488,24 @@ function parseEnvFile(content) {
8364
8488
  return result;
8365
8489
  }
8366
8490
  function findProjectRoot(startDir = process.cwd()) {
8367
- let currentDir = path18.resolve(startDir);
8491
+ let currentDir = path19.resolve(startDir);
8368
8492
  while (true) {
8369
- if (fs13.existsSync(path18.join(currentDir, "package.json"))) {
8493
+ if (fs14.existsSync(path19.join(currentDir, "package.json"))) {
8370
8494
  return currentDir;
8371
8495
  }
8372
- const parentDir = path18.dirname(currentDir);
8496
+ const parentDir = path19.dirname(currentDir);
8373
8497
  if (parentDir === currentDir) {
8374
- return path18.resolve(startDir);
8498
+ return path19.resolve(startDir);
8375
8499
  }
8376
8500
  currentDir = parentDir;
8377
8501
  }
8378
8502
  }
8379
8503
  function readProjectPackageJson(projectRoot) {
8380
- const packagePath = path18.join(projectRoot, "package.json");
8381
- if (!fs13.existsSync(packagePath)) {
8504
+ const packagePath = path19.join(projectRoot, "package.json");
8505
+ if (!fs14.existsSync(packagePath)) {
8382
8506
  return {};
8383
8507
  }
8384
- return JSON.parse(fs13.readFileSync(packagePath, "utf8"));
8508
+ return JSON.parse(fs14.readFileSync(packagePath, "utf8"));
8385
8509
  }
8386
8510
  function getDeclaredProviderPackages(projectRoot) {
8387
8511
  const pkg = readProjectPackageJson(projectRoot);
@@ -8398,23 +8522,23 @@ function resolvePackageEntry(packageName, projectRoot) {
8398
8522
  if (!packageDir) {
8399
8523
  return null;
8400
8524
  }
8401
- const packageJsonPath = path18.join(packageDir, "package.json");
8525
+ const packageJsonPath = path19.join(packageDir, "package.json");
8402
8526
  try {
8403
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf8"));
8527
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf8"));
8404
8528
  const exportPath = resolvePackageExportPath(packageJson.exports) || packageJson.main || "index.js";
8405
- return path18.join(packageDir, exportPath);
8529
+ return path19.join(packageDir, exportPath);
8406
8530
  } catch {
8407
8531
  return null;
8408
8532
  }
8409
8533
  }
8410
8534
  function findInstalledPackageDir(packageName, projectRoot) {
8411
- let currentDir = path18.resolve(projectRoot);
8535
+ let currentDir = path19.resolve(projectRoot);
8412
8536
  while (true) {
8413
- const candidate = path18.join(currentDir, "node_modules", ...packageName.split("/"));
8414
- if (fs13.existsSync(candidate)) {
8537
+ const candidate = path19.join(currentDir, "node_modules", ...packageName.split("/"));
8538
+ if (fs14.existsSync(candidate)) {
8415
8539
  return candidate;
8416
8540
  }
8417
- const parentDir = path18.dirname(currentDir);
8541
+ const parentDir = path19.dirname(currentDir);
8418
8542
  if (parentDir === currentDir) {
8419
8543
  return null;
8420
8544
  }
@@ -8446,9 +8570,9 @@ function loadProjectEnv(projectRoot, processEnv = process.env) {
8446
8570
  const result = {};
8447
8571
  const envFiles = [".env", ".env.local", ".dev.vars", ".dev.vars.local"];
8448
8572
  for (const fileName of envFiles) {
8449
- const filePath = path18.join(projectRoot, fileName);
8450
- if (!fs13.existsSync(filePath)) continue;
8451
- Object.assign(result, parseEnvFile(fs13.readFileSync(filePath, "utf8")));
8573
+ const filePath = path19.join(projectRoot, fileName);
8574
+ if (!fs14.existsSync(filePath)) continue;
8575
+ Object.assign(result, parseEnvFile(fs14.readFileSync(filePath, "utf8")));
8452
8576
  }
8453
8577
  for (const [key, value] of Object.entries(processEnv)) {
8454
8578
  if (typeof value === "string") {
@@ -8638,23 +8762,23 @@ async function currentModels(options = {}) {
8638
8762
  process.exit(1);
8639
8763
  }
8640
8764
  }
8641
- var PROJECT_PROVIDERS_DIR = path18.join("agents", "providers");
8765
+ var PROJECT_PROVIDERS_DIR = path19.join("agents", "providers");
8642
8766
  function isLoadedProjectProvider(provider) {
8643
8767
  return !("loadError" in provider);
8644
8768
  }
8645
8769
  function projectProviderPath(projectRoot, provider) {
8646
- return path18.relative(projectRoot, provider.filePath).split(path18.sep).join("/");
8770
+ return path19.relative(projectRoot, provider.filePath).split(path19.sep).join("/");
8647
8771
  }
8648
8772
  function scanProjectProviders(projectRoot) {
8649
- const dir = path18.join(projectRoot, PROJECT_PROVIDERS_DIR);
8650
- if (!fs13.existsSync(dir)) return [];
8773
+ const dir = path19.join(projectRoot, PROJECT_PROVIDERS_DIR);
8774
+ if (!fs14.existsSync(dir)) return [];
8651
8775
  const providers = [];
8652
- for (const entry of fs13.readdirSync(dir, { withFileTypes: true })) {
8776
+ for (const entry of fs14.readdirSync(dir, { withFileTypes: true })) {
8653
8777
  if (!entry.isFile() || !entry.name.endsWith(".ts")) continue;
8654
- const filePath = path18.join(dir, entry.name);
8778
+ const filePath = path19.join(dir, entry.name);
8655
8779
  let content;
8656
8780
  try {
8657
- content = fs13.readFileSync(filePath, "utf8");
8781
+ content = fs14.readFileSync(filePath, "utf8");
8658
8782
  } catch {
8659
8783
  continue;
8660
8784
  }
@@ -8765,7 +8889,7 @@ async function createProjectModuleServer(projectRoot) {
8765
8889
  if (!entryPath) {
8766
8890
  throw new Error(
8767
8891
  [
8768
- `Reading ${PROJECT_PROVIDERS_DIR.split(path18.sep).join("/")}/ needs the project's Vite installation, which was not found from ${projectRoot}.`,
8892
+ `Reading ${PROJECT_PROVIDERS_DIR.split(path19.sep).join("/")}/ needs the project's Vite installation, which was not found from ${projectRoot}.`,
8769
8893
  "Install the project dependencies, then run this command again."
8770
8894
  ].join("\n")
8771
8895
  );
@@ -9078,7 +9202,7 @@ function stringField(value, key) {
9078
9202
  const field2 = Reflect.get(value, key);
9079
9203
  return typeof field2 === "string" && field2 ? field2 : null;
9080
9204
  }
9081
- function describeFailedResponse(method, path26, status2, text2) {
9205
+ function describeFailedResponse(method, path27, status2, text2) {
9082
9206
  let detail = text2.slice(0, 300);
9083
9207
  let code = null;
9084
9208
  let requestId = null;
@@ -9096,7 +9220,7 @@ function describeFailedResponse(method, path26, status2, text2) {
9096
9220
  }
9097
9221
  const context = [code ? `code: ${code}` : null, requestId ? `request ID: ${requestId}` : null].filter(Boolean);
9098
9222
  const suffix = context.length > 0 ? ` (${context.join(", ")})` : "";
9099
- return new DiagRequestError(`${method} ${path26} \u2192 HTTP ${status2}: ${detail}${suffix}`, status2, code, requestId);
9223
+ return new DiagRequestError(`${method} ${path27} \u2192 HTTP ${status2}: ${detail}${suffix}`, status2, code, requestId);
9100
9224
  }
9101
9225
  function diagJsonError(error) {
9102
9226
  const message = error instanceof Error ? error.message : String(error);
@@ -9108,40 +9232,40 @@ function diagJsonError(error) {
9108
9232
  ...error.requestId ? { request_id: error.requestId } : {}
9109
9233
  };
9110
9234
  }
9111
- async function apiGet(config, path26) {
9112
- return apiRequest(config, path26, "GET");
9235
+ async function apiGet(config, path27) {
9236
+ return apiRequest(config, path27, "GET");
9113
9237
  }
9114
- async function apiRequest(config, path26, method, body) {
9238
+ async function apiRequest(config, path27, method, body) {
9115
9239
  const headers = { Accept: "application/json" };
9116
9240
  if (config.token) headers.Authorization = `Bearer ${config.token}`;
9117
9241
  if (body !== void 0) headers["Content-Type"] = "application/json";
9118
9242
  let response;
9119
9243
  try {
9120
- response = await (config.token ? credentialFetch : fetchWithDeadline)(`${config.endpoint}${path26}`, {
9244
+ response = await (config.token ? credentialFetch : fetchWithDeadline)(`${config.endpoint}${path27}`, {
9121
9245
  method,
9122
9246
  headers,
9123
9247
  body: body === void 0 ? void 0 : JSON.stringify(body)
9124
9248
  }, { fetchImpl: config.fetchImpl, next: "Check the instance URL (--endpoint), then run the command again." });
9125
9249
  } catch (error) {
9126
9250
  if (error instanceof RequestTimeoutError) {
9127
- throw new DiagRequestError(`${method} ${path26}: ${error.message.replace("\n", " ")}`, null, "timeout", null);
9251
+ throw new DiagRequestError(`${method} ${path27}: ${error.message.replace("\n", " ")}`, null, "timeout", null);
9128
9252
  }
9129
9253
  if (error instanceof RedirectRefusedError) {
9130
- throw new DiagRequestError(`${method} ${path26}: ${error.message.replace("\n", " ")}`, error.status, "redirect_refused", null);
9254
+ throw new DiagRequestError(`${method} ${path27}: ${error.message.replace("\n", " ")}`, error.status, "redirect_refused", null);
9131
9255
  }
9132
9256
  const cause = error instanceof Error && error.cause instanceof Error ? error.cause.message : null;
9133
9257
  const detail = cause ?? (error instanceof Error ? error.message : String(error));
9134
- throw new DiagRequestError(`${method} ${path26} could not reach ${config.endpoint}: ${detail}`, null, "unreachable", null);
9258
+ throw new DiagRequestError(`${method} ${path27} could not reach ${config.endpoint}: ${detail}`, null, "unreachable", null);
9135
9259
  }
9136
9260
  const text2 = await response.text();
9137
9261
  if (!response.ok) {
9138
- throw describeFailedResponse(method, path26, response.status, text2);
9262
+ throw describeFailedResponse(method, path27, response.status, text2);
9139
9263
  }
9140
9264
  try {
9141
9265
  return JSON.parse(text2);
9142
9266
  } catch {
9143
9267
  throw new Error(
9144
- `${method} ${path26} returned non-JSON (is this a Standard Agents Builder instance URL?): ${text2.slice(0, 120)}`
9268
+ `${method} ${path27} returned non-JSON (is this a Standard Agents Builder instance URL?): ${text2.slice(0, 120)}`
9145
9269
  );
9146
9270
  }
9147
9271
  }
@@ -9257,6 +9381,11 @@ async function diagInstance(options, fetchImpl) {
9257
9381
  console.log(" builder version pre-0.26 (no runtime block in /api/diagnostics)");
9258
9382
  console.log(` config warnings ${data.warnings?.length ?? 0}`);
9259
9383
  }
9384
+ for (const warning of data.warnings ?? []) {
9385
+ if (warning && typeof warning === "object" && "message" in warning && typeof warning.message === "string") {
9386
+ console.log(` warning: ${warning.message}`);
9387
+ }
9388
+ }
9260
9389
  }
9261
9390
  async function diagThreads(options, fetchImpl) {
9262
9391
  const config = resolveDiagConfig(options, process.env, fetchImpl ?? fetch);
@@ -9641,7 +9770,7 @@ function parsePlatformError(body) {
9641
9770
  reason: details ? stringField2(details, "reason") : null
9642
9771
  };
9643
9772
  }
9644
- async function requestLegal(config, path26, init2) {
9773
+ async function requestLegal(config, path27, init2) {
9645
9774
  const fetchImpl = config.fetchImpl ?? fetch;
9646
9775
  const headers = {
9647
9776
  Accept: "application/json",
@@ -9651,7 +9780,7 @@ async function requestLegal(config, path26, init2) {
9651
9780
  if (init2.body !== void 0) headers["Content-Type"] = "application/json";
9652
9781
  let response;
9653
9782
  try {
9654
- response = await platformFetch(config.endpoint, path26, {
9783
+ response = await platformFetch(config.endpoint, path27, {
9655
9784
  method: init2.method,
9656
9785
  headers,
9657
9786
  // The cookie belongs to this endpoint only; never follow it elsewhere.
@@ -10158,7 +10287,7 @@ async function settleStdinForInitHandoff(stdin = process.stdin) {
10158
10287
  }
10159
10288
  }
10160
10289
  var program = new Command();
10161
- program.name("agents").description("CLI tool for Standard Agents Builder").version("0.45.7").exitOverride();
10290
+ program.name("agents").description("CLI tool for Standard Agents Builder").version("0.45.8").exitOverride();
10162
10291
  registerInitCommand(program);
10163
10292
  registerLoginCommands(program);
10164
10293
  addPlatformEndpointOption(
@@ -10183,7 +10312,7 @@ program.command("skill").description("Install the bundled Standard Agents Builde
10183
10312
  program.command("current-models").description("Print the live curated model guide from standardagentspec.org (standardagentspec.com when that request fails)").option("--url <url>", "Request this models markdown URL instead").action(currentModels);
10184
10313
  program.command("available-models").description("List the model IDs of one provider in the current project, using its own key or the project's Standard Agents account key").option("--provider <provider>", "Provider to query: an installed provider package such as openai, or a provider defined in agents/providers/").option("--json", "Print the provider and its models as one JSON document on stdout").action(availableModels);
10185
10314
  registerDiagCommand(program);
10186
- registerTermsCommand(program, "0.45.7");
10315
+ registerTermsCommand(program, "0.45.8");
10187
10316
  async function run() {
10188
10317
  const userArgs = process.argv.slice(2);
10189
10318
  if (userArgs[0] !== "git-credential") {