@narumitw/pi-starship 0.55.0 → 0.55.2

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 (101) hide show
  1. package/README.md +21 -36
  2. package/dist/chunks/{chunk-UX6PBXVK.js → chunk-JO5PH6FN.js} +28 -110
  3. package/dist/chunks/chunk-JO5PH6FN.js.map +7 -0
  4. package/dist/chunks/{chunk-P4XMFSQW.js → chunk-YWY5RIDQ.js} +3 -7
  5. package/dist/chunks/chunk-YWY5RIDQ.js.map +7 -0
  6. package/dist/chunks/{chunk-EOGXAMTA.js → chunk-ZQZSXXPI.js} +1 -1
  7. package/dist/chunks/chunk-ZQZSXXPI.js.map +7 -0
  8. package/dist/chunks/{cloud-BKHYWCTA.js → cloud-C4VU3TX3.js} +7 -14
  9. package/dist/chunks/cloud-C4VU3TX3.js.map +7 -0
  10. package/dist/chunks/{commands-53ZO2JUK.js → commands-ATILSUVK.js} +13 -42
  11. package/dist/chunks/commands-ATILSUVK.js.map +7 -0
  12. package/dist/chunks/{deployment-RKKOEQQ2.js → deployment-FMNTYRBW.js} +6 -21
  13. package/dist/chunks/deployment-FMNTYRBW.js.map +7 -0
  14. package/dist/chunks/{development-BERD42HW.js → development-OUYXDPBS.js} +4 -8
  15. package/dist/chunks/development-OUYXDPBS.js.map +7 -0
  16. package/dist/chunks/{execution-42JTEY3N.js → execution-HJOGLMWD.js} +3 -3
  17. package/dist/chunks/execution-HJOGLMWD.js.map +7 -0
  18. package/dist/chunks/{languages-RMP6DW7H.js → languages-WXMF4GOF.js} +6 -22
  19. package/dist/chunks/languages-WXMF4GOF.js.map +7 -0
  20. package/dist/chunks/{package-LG5H7BBM.js → package-YXRZQAOV.js} +5 -14
  21. package/dist/chunks/package-YXRZQAOV.js.map +7 -0
  22. package/dist/index.ts +38 -53
  23. package/dist/index.ts.map +2 -2
  24. package/package.json +60 -61
  25. package/skills/configuring-pi-starship/references/runtime-and-security.md +5 -1
  26. package/skills/configuring-pi-starship/scripts/apply.mjs +43 -47
  27. package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
  28. package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
  29. package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
  30. package/src/command-configuration.ts +267 -286
  31. package/src/command-contract.ts +6 -6
  32. package/src/command-inspector.ts +27 -27
  33. package/src/command-preset-picker.ts +45 -50
  34. package/src/command-preview.ts +153 -166
  35. package/src/commands.ts +588 -618
  36. package/src/config.ts +580 -660
  37. package/src/effective-config.ts +46 -48
  38. package/src/format/formatter.ts +211 -227
  39. package/src/format/style.ts +205 -216
  40. package/src/modules/activity.ts +74 -74
  41. package/src/modules/brand.ts +9 -9
  42. package/src/modules/cache.ts +18 -18
  43. package/src/modules/catalog.ts +79 -83
  44. package/src/modules/cloud.ts +54 -54
  45. package/src/modules/context.ts +27 -27
  46. package/src/modules/cost.ts +23 -23
  47. package/src/modules/deployment.ts +45 -45
  48. package/src/modules/development.ts +80 -81
  49. package/src/modules/directory.ts +89 -113
  50. package/src/modules/display.ts +9 -9
  51. package/src/modules/execution.ts +62 -69
  52. package/src/modules/extension-status.ts +59 -64
  53. package/src/modules/fill.ts +10 -10
  54. package/src/modules/git/branch.ts +26 -26
  55. package/src/modules/git/commit.ts +21 -23
  56. package/src/modules/git/metrics.ts +22 -22
  57. package/src/modules/git/runtime.ts +299 -334
  58. package/src/modules/git/state.ts +17 -17
  59. package/src/modules/git/status.ts +77 -79
  60. package/src/modules/git/worktree.ts +10 -12
  61. package/src/modules/github-pr.ts +20 -20
  62. package/src/modules/helpers.ts +3 -3
  63. package/src/modules/index.ts +21 -21
  64. package/src/modules/inspection.ts +101 -108
  65. package/src/modules/languages.ts +52 -59
  66. package/src/modules/model.ts +57 -67
  67. package/src/modules/package.ts +12 -12
  68. package/src/modules/provider.ts +22 -24
  69. package/src/modules/render.ts +124 -140
  70. package/src/modules/thinking.ts +27 -26
  71. package/src/modules/time.ts +10 -13
  72. package/src/modules/tokens.ts +13 -13
  73. package/src/modules/truncation.ts +14 -17
  74. package/src/modules/turn.ts +9 -9
  75. package/src/modules/types.ts +125 -132
  76. package/src/modules/workspace-helpers.ts +4 -7
  77. package/src/pi-starship.ts +567 -571
  78. package/src/presets/catalog.ts +113 -113
  79. package/src/runtime/cloud.ts +122 -150
  80. package/src/runtime/command.ts +106 -108
  81. package/src/runtime/deployment.ts +150 -179
  82. package/src/runtime/development.ts +107 -124
  83. package/src/runtime/execution.ts +110 -124
  84. package/src/runtime/github-pr.ts +223 -252
  85. package/src/runtime/helpers.ts +186 -199
  86. package/src/runtime/languages.ts +149 -180
  87. package/src/runtime/package.ts +74 -87
  88. package/src/runtime/refresh-controller.ts +82 -86
  89. package/src/runtime/types.ts +38 -38
  90. package/src/runtime/workspace.ts +108 -116
  91. package/src/usage.ts +40 -40
  92. package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
  93. package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
  94. package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
  95. package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
  96. package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
  97. package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
  98. package/dist/chunks/development-BERD42HW.js.map +0 -7
  99. package/dist/chunks/execution-42JTEY3N.js.map +0 -7
  100. package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
  101. package/dist/chunks/package-LG5H7BBM.js.map +0 -7
@@ -9,56 +9,52 @@ import { formatDisplayValue, formatError } from "./script-support.mjs";
9
9
  const [draftPath, destinationPath, expectedPath, ...extraArguments] = process.argv.slice(2);
10
10
 
11
11
  if (!draftPath || !destinationPath || !expectedPath || extraArguments.length > 0) {
12
- console.error(
13
- "Usage: node scripts/apply.mjs <draft-path> <absolute-pi-starship.toml-path> <expected-path|--expect-missing>",
14
- );
15
- process.exitCode = 2;
12
+ console.error(
13
+ "Usage: node scripts/apply.mjs <draft-path> <absolute-pi-starship.toml-path> <expected-path|--expect-missing>",
14
+ );
15
+ process.exitCode = 2;
16
16
  } else if (!isAbsolute(destinationPath) || basename(destinationPath) !== "pi-starship.toml") {
17
- console.error("The destination must be an absolute path named pi-starship.toml.");
18
- process.exitCode = 2;
17
+ console.error("The destination must be an absolute path named pi-starship.toml.");
18
+ process.exitCode = 2;
19
19
  } else {
20
- let temporaryPath;
21
- try {
22
- const draft = await readFile(draftPath, "utf8");
23
- const expectMissing = expectedPath === "--expect-missing";
24
- const expected = expectMissing ? undefined : await readFile(expectedPath, "utf8");
25
- await mkdir(dirname(destinationPath), { recursive: true });
26
- temporaryPath = join(dirname(destinationPath), `.pi-starship.toml.${randomUUID()}.tmp`);
27
- await writeFile(temporaryPath, draft, { encoding: "utf8", flag: "wx" });
28
- parse(await readFile(temporaryPath, "utf8"));
29
- await assertDestinationUnchanged(destinationPath, expectMissing, expected);
30
- await rename(temporaryPath, destinationPath);
31
- temporaryPath = undefined;
32
- console.log(`Applied valid TOML atomically to ${formatDisplayValue(destinationPath)}`);
33
- } catch (error) {
34
- console.error(
35
- `Draft was not applied to ${formatDisplayValue(destinationPath)}: ${formatError(error)}`,
36
- );
37
- process.exitCode = 1;
38
- } finally {
39
- if (temporaryPath) {
40
- try {
41
- await rm(temporaryPath, { force: true });
42
- } catch {
43
- // Cleanup is best-effort and must not obscure the original failure.
44
- }
45
- }
46
- }
20
+ let temporaryPath;
21
+ try {
22
+ const draft = await readFile(draftPath, "utf8");
23
+ const expectMissing = expectedPath === "--expect-missing";
24
+ const expected = expectMissing ? undefined : await readFile(expectedPath, "utf8");
25
+ await mkdir(dirname(destinationPath), { recursive: true });
26
+ temporaryPath = join(dirname(destinationPath), `.pi-starship.toml.${randomUUID()}.tmp`);
27
+ await writeFile(temporaryPath, draft, { encoding: "utf8", flag: "wx" });
28
+ parse(await readFile(temporaryPath, "utf8"));
29
+ await assertDestinationUnchanged(destinationPath, expectMissing, expected);
30
+ await rename(temporaryPath, destinationPath);
31
+ temporaryPath = undefined;
32
+ console.log(`Applied valid TOML atomically to ${formatDisplayValue(destinationPath)}`);
33
+ } catch (error) {
34
+ console.error(`Draft was not applied to ${formatDisplayValue(destinationPath)}: ${formatError(error)}`);
35
+ process.exitCode = 1;
36
+ } finally {
37
+ if (temporaryPath) {
38
+ try {
39
+ await rm(temporaryPath, { force: true });
40
+ } catch {
41
+ // Cleanup is best-effort and must not obscure the original failure.
42
+ }
43
+ }
44
+ }
47
45
  }
48
46
 
49
47
  async function assertDestinationUnchanged(destinationPath, expectMissing, expected) {
50
- let current;
51
- try {
52
- current = await readFile(destinationPath, "utf8");
53
- } catch (error) {
54
- if (error && typeof error === "object" && error.code === "ENOENT") {
55
- if (expectMissing) return;
56
- throw new Error("The active pi-starship.toml was removed after inspection.");
57
- }
58
- throw error;
59
- }
60
- if (!expectMissing && current === expected) return;
61
- throw new Error(
62
- "The active pi-starship.toml changed after inspection; the newer file was preserved.",
63
- );
48
+ let current;
49
+ try {
50
+ current = await readFile(destinationPath, "utf8");
51
+ } catch (error) {
52
+ if (error && typeof error === "object" && error.code === "ENOENT") {
53
+ if (expectMissing) return;
54
+ throw new Error("The active pi-starship.toml was removed after inspection.");
55
+ }
56
+ throw error;
57
+ }
58
+ if (!expectMissing && current === expected) return;
59
+ throw new Error("The active pi-starship.toml changed after inspection; the newer file was preserved.");
64
60
  }
@@ -4,8 +4,8 @@ import { resolve } from "node:path";
4
4
  import { getAgentDir } from "@earendil-works/pi-coding-agent";
5
5
 
6
6
  if (process.argv.length > 2) {
7
- console.error("Usage: node scripts/config-path.mjs");
8
- process.exitCode = 2;
7
+ console.error("Usage: node scripts/config-path.mjs");
8
+ process.exitCode = 2;
9
9
  } else {
10
- process.stdout.write(`${JSON.stringify(resolve(getAgentDir(), "pi-starship.toml"))}\n`);
10
+ process.stdout.write(`${JSON.stringify(resolve(getAgentDir(), "pi-starship.toml"))}\n`);
11
11
  }
@@ -5,16 +5,16 @@ const MAX_ERROR_SOURCE_LENGTH = 8000;
5
5
  const MAX_DISPLAY_VALUE_LENGTH = 500;
6
6
 
7
7
  export function formatError(error) {
8
- const raw = error instanceof Error ? error.message : String(error);
9
- return sanitizeAndBound(raw, MAX_ERROR_LENGTH, MAX_ERROR_SOURCE_LENGTH);
8
+ const raw = error instanceof Error ? error.message : String(error);
9
+ return sanitizeAndBound(raw, MAX_ERROR_LENGTH, MAX_ERROR_SOURCE_LENGTH);
10
10
  }
11
11
 
12
12
  export function formatDisplayValue(value) {
13
- return JSON.stringify(sanitizeAndBound(String(value), MAX_DISPLAY_VALUE_LENGTH, 4000));
13
+ return JSON.stringify(sanitizeAndBound(String(value), MAX_DISPLAY_VALUE_LENGTH, 4000));
14
14
  }
15
15
 
16
16
  function sanitizeAndBound(value, maximumLength, maximumSourceLength) {
17
- const result = sanitizeTerminalText(value.slice(0, maximumSourceLength));
18
- const truncated = value.length > maximumSourceLength || result.length > maximumLength;
19
- return truncated ? `${result.slice(0, Math.max(0, maximumLength - 1))}…` : result;
17
+ const result = sanitizeTerminalText(value.slice(0, maximumSourceLength));
18
+ const truncated = value.length > maximumSourceLength || result.length > maximumLength;
19
+ return truncated ? `${result.slice(0, Math.max(0, maximumLength - 1))}…` : result;
20
20
  }
@@ -7,24 +7,24 @@ import { formatDisplayValue, formatError } from "./script-support.mjs";
7
7
  const [filePath, ...extraArguments] = process.argv.slice(2);
8
8
 
9
9
  if (!filePath || extraArguments.length > 0) {
10
- console.error("Usage: node scripts/validate.mjs <absolute-pi-starship.toml-path>");
11
- process.exitCode = 2;
10
+ console.error("Usage: node scripts/validate.mjs <absolute-pi-starship.toml-path>");
11
+ process.exitCode = 2;
12
12
  } else {
13
- let document;
14
- try {
15
- document = await readFile(filePath, "utf8");
16
- } catch (error) {
17
- console.error(`Unable to read ${formatDisplayValue(filePath)}: ${formatError(error)}`);
18
- process.exitCode = 1;
19
- }
13
+ let document;
14
+ try {
15
+ document = await readFile(filePath, "utf8");
16
+ } catch (error) {
17
+ console.error(`Unable to read ${formatDisplayValue(filePath)}: ${formatError(error)}`);
18
+ process.exitCode = 1;
19
+ }
20
20
 
21
- if (document !== undefined) {
22
- try {
23
- parse(document);
24
- console.log(`Valid TOML: ${formatDisplayValue(filePath)}`);
25
- } catch (error) {
26
- console.error(`Invalid TOML in ${formatDisplayValue(filePath)}: ${formatError(error)}`);
27
- process.exitCode = 1;
28
- }
29
- }
21
+ if (document !== undefined) {
22
+ try {
23
+ parse(document);
24
+ console.log(`Valid TOML: ${formatDisplayValue(filePath)}`);
25
+ } catch (error) {
26
+ console.error(`Invalid TOML in ${formatDisplayValue(filePath)}: ${formatError(error)}`);
27
+ process.exitCode = 1;
28
+ }
29
+ }
30
30
  }