@builder.io/buildercode 0.3.6 → 0.3.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +55 -21
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -244266,7 +244266,7 @@ const LIB_CACHE = /* @__PURE__ */ new Map();
244266
244266
  const PENDING_LIB_CACHE = /* @__PURE__ */ new Map();
244267
244267
  const NODE_MODULE_CACHE = /* @__PURE__ */ new Map();
244268
244268
  const TSCONFIG_CACHE = /* @__PURE__ */ new Map();
244269
- const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.3.6";
244269
+ const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.3.8";
244270
244270
  //#endregion
244271
244271
  //#region ../dev-tools/core/detect-frameworks.ts
244272
244272
  async function detectFrameworks$1(sys) {
@@ -520772,13 +520772,7 @@ Tips:
520772
520772
  ...this.#lastAICommits,
520773
520773
  ...allCommits
520774
520774
  };
520775
- if (!(await this.#emitGitStatus())?.currentCommit) {
520776
- this.#sys.Sentry?.captureException(/* @__PURE__ */ new Error(`Failed to get current commit hash after revert`), { tags: {
520777
- operation: "codegen-git",
520778
- endpoint: "revertToCommitHash"
520779
- } });
520780
- return;
520781
- }
520775
+ await this.#emitGitStatus();
520782
520776
  this.requestRefresh();
520783
520777
  await this.#completionFinalize({ lastCommit: serializeGitSnapshot(allCommits) });
520784
520778
  }
@@ -521577,7 +521571,10 @@ Make the necessary changes and try again.`
521577
521571
  checkpointCommitHash = (await this.#emitGitStatus())?.currentCommit;
521578
521572
  }
521579
521573
  const subagent_type = agentConfig.subagent_type;
521580
- const agentSession = new CodeGenSession(agentConfig.options);
521574
+ const agentSession = new CodeGenSession({
521575
+ ...agentConfig.options,
521576
+ git: false
521577
+ });
521581
521578
  const subAgentId = options.sessionId ?? options.resume ?? sessionId;
521582
521579
  const agentPromise = Promise.withResolvers();
521583
521580
  this.#runningSubAgents.set(subAgentId, {
@@ -523370,6 +523367,7 @@ failed with code ${result.code}`,
523370
523367
  projectId: this.#projectId,
523371
523368
  branchName: this.#branchName,
523372
523369
  repoHash: this.#repoHash,
523370
+ repoBranch: this.#aiBranch,
523373
523371
  pingEvents: true,
523374
523372
  workingDirectory: this.#bashWorkingDirectory,
523375
523373
  beforeCommit,
@@ -528449,6 +528447,7 @@ async function* completionStream(sys, credentials, body, signal, debug) {
528449
528447
  const res = await safeFetch(url, {
528450
528448
  method: "POST",
528451
528449
  body: json,
528450
+ keepalive: true,
528452
528451
  headers: {
528453
528452
  "Content-Type": "application/json",
528454
528453
  Authorization: `Bearer ${credentials.builderPrivateKey}`
@@ -530388,7 +530387,9 @@ async function getFusionConfig(sys, args) {
530388
530387
  "netlify *",
530389
530388
  "node *",
530390
530389
  "tsx *",
530391
- "builderio *"
530390
+ "builderio *",
530391
+ "builder *",
530392
+ "open *"
530392
530393
  ]
530393
530394
  };
530394
530395
  if (args.configJson) try {
@@ -533826,7 +533827,14 @@ function useCodeGenStateHandler() {
533826
533827
  state.activeUserQuestions = void 0;
533827
533828
  const doneThinking = state.messages.findLast((m) => m.type === "thinking");
533828
533829
  if (doneThinking) doneThinking.streaming = false;
533829
- if (step.applyResults?.length) turnApplyResults.push(...step.applyResults);
533830
+ if (step.applyResults?.length) for (const result of step.applyResults) {
533831
+ const existing = turnApplyResults.find((r) => r.filePath === result.filePath);
533832
+ if (existing) {
533833
+ existing.addedLines += result.addedLines;
533834
+ existing.removedLines += result.removedLines;
533835
+ existing.action = result.action;
533836
+ } else turnApplyResults.push({ ...result });
533837
+ }
533830
533838
  turnCreditsUsed += step.creditsUsed ?? 0;
533831
533839
  break;
533832
533840
  }
@@ -538131,7 +538139,7 @@ const FooterSection = (0, import_react.memo)(() => {
538131
538139
  children: [
538132
538140
  "•",
538133
538141
  " Fusion ",
538134
- "0.3.6"
538142
+ "0.3.8"
538135
538143
  ]
538136
538144
  });
538137
538145
  $[10] = t7;
@@ -600772,7 +600780,7 @@ function initSentry() {
600772
600780
  init({
600773
600781
  dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
600774
600782
  tracesSampleRate: 0,
600775
- release: "0.3.6",
600783
+ release: "0.3.8",
600776
600784
  environment: process.env.NODE_ENV ?? "development",
600777
600785
  enabled: false,
600778
600786
  registerEsmLoaderHooks: false,
@@ -600796,7 +600804,7 @@ function isStandaloneBinary() {
600796
600804
  return !path$6.basename(process.execPath, ".exe").startsWith("node");
600797
600805
  }
600798
600806
  function getCurrentVersion() {
600799
- return "0.3.6";
600807
+ return "0.3.8";
600800
600808
  }
600801
600809
  async function fetchLatestVersion() {
600802
600810
  return new Promise((resolve, reject) => {
@@ -600886,16 +600894,39 @@ async function selfUpdate(onProgress) {
600886
600894
  const tarballUrl = `https://registry.npmjs.org/@builder.io/${pkgName}/-/${pkgName}-${latestVersion}.tgz`;
600887
600895
  const tmpDir = createTempDir(path$6.dirname(process.execPath));
600888
600896
  const tarballPath = path$6.join(tmpDir, "builder.tgz");
600897
+ let activeRequest = null;
600898
+ let activeChild = null;
600899
+ const onSigint = () => {
600900
+ activeRequest?.destroy();
600901
+ activeChild?.kill();
600902
+ try {
600903
+ fs$20.rmSync(tmpDir, {
600904
+ recursive: true,
600905
+ force: true
600906
+ });
600907
+ } catch {}
600908
+ onProgress("\nUpdate cancelled.");
600909
+ process.exit(130);
600910
+ };
600911
+ process.on("SIGINT", onSigint);
600889
600912
  try {
600890
- await downloadFile(tarballUrl, tarballPath);
600913
+ await downloadFile(tarballUrl, tarballPath, (req) => {
600914
+ activeRequest = req;
600915
+ });
600916
+ activeRequest = null;
600891
600917
  onProgress("Installing...");
600892
600918
  await new Promise((resolve, reject) => {
600893
- spawn("tar", [
600919
+ const tar = spawn("tar", [
600894
600920
  "-xzf",
600895
600921
  tarballPath,
600896
600922
  "-C",
600897
600923
  tmpDir
600898
- ], { stdio: "inherit" }).on("close", (code) => code === 0 ? resolve() : reject(/* @__PURE__ */ new Error(`tar exited with ${code}`)));
600924
+ ], { stdio: "inherit" });
600925
+ activeChild = tar;
600926
+ tar.on("close", (code) => {
600927
+ activeChild = null;
600928
+ code === 0 ? resolve() : reject(/* @__PURE__ */ new Error(`tar exited with ${code}`));
600929
+ });
600899
600930
  });
600900
600931
  const binaryName = process.platform === "win32" ? "builder.exe" : "builder";
600901
600932
  const extractedBinary = path$6.join(tmpDir, "package", binaryName);
@@ -600915,6 +600946,7 @@ async function selfUpdate(onProgress) {
600915
600946
  });
600916
600947
  onProgress(`Updated to ${latestVersion}. Restart builder to apply.`);
600917
600948
  } finally {
600949
+ process.off("SIGINT", onSigint);
600918
600950
  fs$20.rmSync(tmpDir, {
600919
600951
  recursive: true,
600920
600952
  force: true
@@ -600943,11 +600975,11 @@ function atomicReplace(source, dest) {
600943
600975
  } else throw err;
600944
600976
  }
600945
600977
  }
600946
- async function downloadFile(url, dest) {
600978
+ async function downloadFile(url, dest, onRequest) {
600947
600979
  return new Promise((resolve, reject) => {
600948
600980
  const file = fs$20.createWriteStream(dest);
600949
600981
  const request = (targetUrl) => {
600950
- https$4.get(targetUrl, (res) => {
600982
+ const req = https$4.get(targetUrl, (res) => {
600951
600983
  if (res.statusCode === 301 || res.statusCode === 302) {
600952
600984
  const location = res.headers.location;
600953
600985
  if (!location) {
@@ -600957,10 +600989,11 @@ async function downloadFile(url, dest) {
600957
600989
  res.resume();
600958
600990
  file.close();
600959
600991
  const newFile = fs$20.createWriteStream(dest);
600960
- https$4.get(location, (r) => {
600992
+ const redirectReq = https$4.get(location, (r) => {
600961
600993
  r.pipe(newFile);
600962
600994
  newFile.on("finish", () => newFile.close(() => resolve()));
600963
600995
  }).on("error", reject);
600996
+ onRequest?.(redirectReq);
600964
600997
  return;
600965
600998
  }
600966
600999
  if (res.statusCode !== 200) {
@@ -600973,13 +601006,14 @@ async function downloadFile(url, dest) {
600973
601006
  fs$20.unlink(dest, () => {});
600974
601007
  reject(err);
600975
601008
  });
601009
+ onRequest?.(req);
600976
601010
  };
600977
601011
  request(url);
600978
601012
  });
600979
601013
  }
600980
601014
  //#endregion
600981
601015
  //#region src/cli.tsx
600982
- const VERSION = "0.3.6";
601016
+ const VERSION = "0.3.8";
600983
601017
  async function startInk(command, options) {
600984
601018
  await render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
600985
601019
  command,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/buildercode",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Builder.io CLI - AI-powered code generation",
5
5
  "license": "MIT",
6
6
  "bin": {