@pablozaiden/devbox 0.1.3 → 0.1.4

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/devbox.js +29 -6
  2. package/package.json +1 -1
package/dist/devbox.js CHANGED
@@ -1305,12 +1305,22 @@ function formatDevcontainerProgressLine(line) {
1305
1305
  return null;
1306
1306
  }
1307
1307
  if (type === "raw" && text === "Container started") {
1308
- return "Container started.";
1308
+ return "Container started. Finishing devcontainer setup...";
1309
1309
  }
1310
1310
  if (text.startsWith("workspace root: ")) {
1311
1311
  return `Workspace: ${text.slice("workspace root: ".length)}`;
1312
1312
  }
1313
- if (text === "No user features to update" || text === "Inspecting container" || text.startsWith("Run: ") || text.startsWith("Run in container: ") || text.startsWith("userEnvProbe") || text.startsWith("LifecycleCommandExecutionMap:") || text.startsWith("Exit code ")) {
1313
+ if (text === "Inspecting container") {
1314
+ return "Inspecting container...";
1315
+ }
1316
+ if (text.startsWith("userEnvProbe")) {
1317
+ return "Checking container environment...";
1318
+ }
1319
+ const lifecycleProgress = formatDevcontainerLifecycleProgress(text);
1320
+ if (lifecycleProgress) {
1321
+ return lifecycleProgress;
1322
+ }
1323
+ if (text === "No user features to update" || text.startsWith("Run: ") || text.startsWith("Run in container: ") || text.startsWith("Exit code ")) {
1314
1324
  return null;
1315
1325
  }
1316
1326
  if (level !== undefined && level >= 2) {
@@ -1713,6 +1723,7 @@ async function consumeStream(stream, mode, useStderr) {
1713
1723
  stream.setEncoding("utf8");
1714
1724
  let captured = "";
1715
1725
  let buffered = "";
1726
+ let lastRenderedProgressLine = null;
1716
1727
  for await (const chunk of stream) {
1717
1728
  const text = typeof chunk === "string" ? chunk : String(chunk);
1718
1729
  captured += text;
@@ -1729,13 +1740,13 @@ async function consumeStream(stream, mode, useStderr) {
1729
1740
  while (newlineIndex >= 0) {
1730
1741
  const line = buffered.slice(0, newlineIndex);
1731
1742
  buffered = buffered.slice(newlineIndex + 1);
1732
- renderDevcontainerJsonLine(line, writer);
1743
+ lastRenderedProgressLine = renderDevcontainerJsonLine(line, writer, lastRenderedProgressLine);
1733
1744
  newlineIndex = buffered.indexOf(`
1734
1745
  `);
1735
1746
  }
1736
1747
  }
1737
1748
  if (mode === "devcontainer-json" && buffered.length > 0) {
1738
- renderDevcontainerJsonLine(buffered, writer);
1749
+ renderDevcontainerJsonLine(buffered, writer, lastRenderedProgressLine);
1739
1750
  }
1740
1751
  return captured;
1741
1752
  }
@@ -1771,12 +1782,14 @@ function isExecutablePath(candidate) {
1771
1782
  return false;
1772
1783
  }
1773
1784
  }
1774
- function renderDevcontainerJsonLine(line, writer) {
1785
+ function renderDevcontainerJsonLine(line, writer, previousLine) {
1775
1786
  const formatted = formatDevcontainerProgressLine(line);
1776
- if (formatted) {
1787
+ if (formatted && formatted !== previousLine) {
1777
1788
  writer.write(`${formatted}
1778
1789
  `);
1790
+ return formatted;
1779
1791
  }
1792
+ return previousLine;
1780
1793
  }
1781
1794
  function parseDevcontainerOutcome(stdout) {
1782
1795
  const lines = stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
@@ -1806,6 +1819,16 @@ ${details}`;
1806
1819
  function stripAnsi(text) {
1807
1820
  return text.replace(/\u001B\[[0-9;]*m/g, "");
1808
1821
  }
1822
+ function formatDevcontainerLifecycleProgress(text) {
1823
+ if (!text.startsWith("LifecycleCommandExecutionMap:")) {
1824
+ return null;
1825
+ }
1826
+ const commandMatch = text.match(/\b(initializeCommand|onCreateCommand|updateContentCommand|postCreateCommand|postStartCommand|postAttachCommand)\b/);
1827
+ if (commandMatch) {
1828
+ return `Running ${commandMatch[1]}...`;
1829
+ }
1830
+ return "Running devcontainer lifecycle commands...";
1831
+ }
1809
1832
  function looksLikeDevcontainerUserEnvProbeDump(text) {
1810
1833
  const match = text.match(/^([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})([\s\S]*)\1$/i);
1811
1834
  if (!match) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pablozaiden/devbox",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "CLI to run and expose a devcontainer with SSH agent sharing and a forwarded ssh-server-runner port.",
6
6
  "repository": {