@xynogen/pix-optimizer 1.1.10 → 1.1.12
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/package.json +2 -2
- package/src/json.ts +2 -1
- package/src/opt.ts +5 -3
- package/src/rtk.ts +2 -2
- package/src/status.test.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-optimizer",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "Performance optimization suite for Pi Coding Agent - caveman mode + RTK tool rewriting + jq/TOON JSON compression + ponytail lazy-dev mode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@xynogen/pix-pretty": "
|
|
51
|
+
"@xynogen/pix-pretty": "^1.7.9"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/json.ts
CHANGED
|
@@ -182,7 +182,8 @@ export function isUniformObjectArray(arr: unknown[]): boolean {
|
|
|
182
182
|
for (let i = 0; i < keys.length; i++) {
|
|
183
183
|
if (elKeys[i] !== keys[i]) return false;
|
|
184
184
|
// values must be primitive for a clean tabular row
|
|
185
|
-
if (isObjectLike((el as Record<string, unknown>)[keys[i]
|
|
185
|
+
if (isObjectLike((el as Record<string, unknown>)[keys[i] as string]))
|
|
186
|
+
return false;
|
|
186
187
|
}
|
|
187
188
|
return true;
|
|
188
189
|
});
|
package/src/opt.ts
CHANGED
|
@@ -132,11 +132,11 @@ export function registerOptCommand(
|
|
|
132
132
|
let selected = 0;
|
|
133
133
|
|
|
134
134
|
const cycle = (direction: -1 | 1) => {
|
|
135
|
-
const tool = TOOL_ORDER[selected]
|
|
135
|
+
const tool = TOOL_ORDER[selected] as OptimizerTool;
|
|
136
136
|
const values = handles[tool].values;
|
|
137
137
|
const cur = values.indexOf(handles[tool].current());
|
|
138
138
|
const next = (cur + direction + values.length) % values.length;
|
|
139
|
-
handles[tool].run(values[next]
|
|
139
|
+
handles[tool].run(values[next] as string, ctx);
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
const move = (direction: -1 | 1) => {
|
|
@@ -173,7 +173,9 @@ export function registerOptCommand(
|
|
|
173
173
|
"",
|
|
174
174
|
theme.fg(
|
|
175
175
|
"dim",
|
|
176
|
-
helpSummary(
|
|
176
|
+
helpSummary(
|
|
177
|
+
handles[TOOL_ORDER[selected] as OptimizerTool].help,
|
|
178
|
+
),
|
|
177
179
|
),
|
|
178
180
|
"",
|
|
179
181
|
theme.fg("dim", "←→ change · ↑↓ move · esc close"),
|
package/src/rtk.ts
CHANGED
|
@@ -156,7 +156,7 @@ export function splitChain(command: string): string[] | null {
|
|
|
156
156
|
let quote: "'" | '"' | null = null;
|
|
157
157
|
|
|
158
158
|
for (let i = 0; i < command.length; i++) {
|
|
159
|
-
const c = command[i]
|
|
159
|
+
const c = command[i] as string;
|
|
160
160
|
const next = command[i + 1];
|
|
161
161
|
|
|
162
162
|
if (quote) {
|
|
@@ -213,7 +213,7 @@ export function rewriteChain(command: string): string {
|
|
|
213
213
|
const body = part.slice(leading.length);
|
|
214
214
|
if (!body) return part;
|
|
215
215
|
|
|
216
|
-
const firstWord = body.split(/\s+/)[0]
|
|
216
|
+
const firstWord = body.split(/\s+/)[0] ?? "";
|
|
217
217
|
if (firstWord === "rtk") return part;
|
|
218
218
|
if (!RTK_COMMANDS.has(firstWord)) return part;
|
|
219
219
|
|
package/src/status.test.ts
CHANGED
|
@@ -74,7 +74,8 @@ describe("OptimizerStatus", () => {
|
|
|
74
74
|
const status = new OptimizerStatus();
|
|
75
75
|
const ctx = fakeCtx();
|
|
76
76
|
status.set("rtk", true, ctx as never);
|
|
77
|
-
const last = ctx.calls.at(-1)
|
|
77
|
+
const last = ctx.calls.at(-1);
|
|
78
|
+
if (!last) throw new Error("no calls");
|
|
78
79
|
expect(last.key).toBe(STATUS_KEY);
|
|
79
80
|
// caveman + toon + ponytail still unset (dim), rtk accent.
|
|
80
81
|
expect(last.text).toBe(
|
|
@@ -87,7 +88,8 @@ describe("OptimizerStatus", () => {
|
|
|
87
88
|
const ctx = fakeCtx();
|
|
88
89
|
status.set("caveman", true, ctx as never);
|
|
89
90
|
status.set("toon", true, ctx as never);
|
|
90
|
-
const last = ctx.calls.at(-1)
|
|
91
|
+
const last = ctx.calls.at(-1);
|
|
92
|
+
if (!last) throw new Error("no calls");
|
|
91
93
|
expect(last.text).toBe(
|
|
92
94
|
`<accent>${CV}</accent> <dim>${RK}</dim> <accent>${TN}</accent> <dim>${PT}</dim> `,
|
|
93
95
|
);
|
|
@@ -98,7 +100,8 @@ describe("OptimizerStatus", () => {
|
|
|
98
100
|
const ctx = fakeCtx();
|
|
99
101
|
status.set("rtk", true, ctx as never);
|
|
100
102
|
status.set("rtk", false, ctx as never);
|
|
101
|
-
const last = ctx.calls.at(-1)
|
|
103
|
+
const last = ctx.calls.at(-1);
|
|
104
|
+
if (!last) throw new Error("no calls");
|
|
102
105
|
expect(last.text).toBe(
|
|
103
106
|
`<dim>${CV}</dim> <dim>${RK}</dim> <dim>${TN}</dim> <dim>${PT}</dim> `,
|
|
104
107
|
);
|