@narumitw/pi-starship 0.55.1 → 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.
- package/dist/chunks/{chunk-UX6PBXVK.js → chunk-JO5PH6FN.js} +28 -110
- package/dist/chunks/chunk-JO5PH6FN.js.map +7 -0
- package/dist/chunks/{chunk-P4XMFSQW.js → chunk-YWY5RIDQ.js} +3 -7
- package/dist/chunks/chunk-YWY5RIDQ.js.map +7 -0
- package/dist/chunks/{chunk-EOGXAMTA.js → chunk-ZQZSXXPI.js} +1 -1
- package/dist/chunks/chunk-ZQZSXXPI.js.map +7 -0
- package/dist/chunks/{cloud-BKHYWCTA.js → cloud-C4VU3TX3.js} +7 -14
- package/dist/chunks/cloud-C4VU3TX3.js.map +7 -0
- package/dist/chunks/{commands-53ZO2JUK.js → commands-ATILSUVK.js} +13 -42
- package/dist/chunks/commands-ATILSUVK.js.map +7 -0
- package/dist/chunks/{deployment-RKKOEQQ2.js → deployment-FMNTYRBW.js} +6 -21
- package/dist/chunks/deployment-FMNTYRBW.js.map +7 -0
- package/dist/chunks/{development-BERD42HW.js → development-OUYXDPBS.js} +4 -8
- package/dist/chunks/development-OUYXDPBS.js.map +7 -0
- package/dist/chunks/{execution-42JTEY3N.js → execution-HJOGLMWD.js} +3 -3
- package/dist/chunks/execution-HJOGLMWD.js.map +7 -0
- package/dist/chunks/{languages-RMP6DW7H.js → languages-WXMF4GOF.js} +6 -22
- package/dist/chunks/languages-WXMF4GOF.js.map +7 -0
- package/dist/chunks/{package-LG5H7BBM.js → package-YXRZQAOV.js} +5 -14
- package/dist/chunks/package-YXRZQAOV.js.map +7 -0
- package/dist/index.ts +20 -55
- package/dist/index.ts.map +2 -2
- package/package.json +60 -61
- package/skills/configuring-pi-starship/scripts/apply.mjs +43 -47
- package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
- package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
- package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
- package/src/command-configuration.ts +267 -286
- package/src/command-contract.ts +6 -6
- package/src/command-inspector.ts +27 -27
- package/src/command-preset-picker.ts +45 -50
- package/src/command-preview.ts +153 -166
- package/src/commands.ts +588 -618
- package/src/config.ts +580 -660
- package/src/effective-config.ts +46 -48
- package/src/format/formatter.ts +211 -227
- package/src/format/style.ts +205 -216
- package/src/modules/activity.ts +74 -74
- package/src/modules/brand.ts +9 -9
- package/src/modules/cache.ts +18 -18
- package/src/modules/catalog.ts +79 -83
- package/src/modules/cloud.ts +54 -54
- package/src/modules/context.ts +27 -27
- package/src/modules/cost.ts +23 -23
- package/src/modules/deployment.ts +45 -45
- package/src/modules/development.ts +80 -81
- package/src/modules/directory.ts +89 -113
- package/src/modules/display.ts +9 -9
- package/src/modules/execution.ts +62 -69
- package/src/modules/extension-status.ts +59 -64
- package/src/modules/fill.ts +10 -10
- package/src/modules/git/branch.ts +26 -26
- package/src/modules/git/commit.ts +21 -23
- package/src/modules/git/metrics.ts +22 -22
- package/src/modules/git/runtime.ts +299 -334
- package/src/modules/git/state.ts +17 -17
- package/src/modules/git/status.ts +77 -79
- package/src/modules/git/worktree.ts +10 -12
- package/src/modules/github-pr.ts +20 -20
- package/src/modules/helpers.ts +3 -3
- package/src/modules/index.ts +21 -21
- package/src/modules/inspection.ts +101 -108
- package/src/modules/languages.ts +52 -59
- package/src/modules/model.ts +57 -67
- package/src/modules/package.ts +12 -12
- package/src/modules/provider.ts +22 -24
- package/src/modules/render.ts +124 -140
- package/src/modules/thinking.ts +27 -26
- package/src/modules/time.ts +10 -13
- package/src/modules/tokens.ts +13 -13
- package/src/modules/truncation.ts +14 -17
- package/src/modules/turn.ts +9 -9
- package/src/modules/types.ts +125 -132
- package/src/modules/workspace-helpers.ts +4 -7
- package/src/pi-starship.ts +567 -603
- package/src/presets/catalog.ts +113 -113
- package/src/runtime/cloud.ts +122 -150
- package/src/runtime/command.ts +106 -108
- package/src/runtime/deployment.ts +150 -179
- package/src/runtime/development.ts +107 -124
- package/src/runtime/execution.ts +110 -124
- package/src/runtime/github-pr.ts +223 -252
- package/src/runtime/helpers.ts +186 -199
- package/src/runtime/languages.ts +149 -180
- package/src/runtime/package.ts +74 -87
- package/src/runtime/refresh-controller.ts +82 -86
- package/src/runtime/types.ts +38 -38
- package/src/runtime/workspace.ts +108 -116
- package/src/usage.ts +40 -40
- package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
- package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
- package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
- package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
- package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
- package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
- package/dist/chunks/development-BERD42HW.js.map +0 -7
- package/dist/chunks/execution-42JTEY3N.js.map +0 -7
- package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
- 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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
17
|
+
console.error("The destination must be an absolute path named pi-starship.toml.");
|
|
18
|
+
process.exitCode = 2;
|
|
19
19
|
} else {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
8
|
-
|
|
7
|
+
console.error("Usage: node scripts/config-path.mjs");
|
|
8
|
+
process.exitCode = 2;
|
|
9
9
|
} else {
|
|
10
|
-
|
|
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
|
-
|
|
9
|
-
|
|
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
|
-
|
|
13
|
+
return JSON.stringify(sanitizeAndBound(String(value), MAX_DISPLAY_VALUE_LENGTH, 4000));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function sanitizeAndBound(value, maximumLength, maximumSourceLength) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
11
|
-
|
|
10
|
+
console.error("Usage: node scripts/validate.mjs <absolute-pi-starship.toml-path>");
|
|
11
|
+
process.exitCode = 2;
|
|
12
12
|
} else {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
}
|