Skip to content

Commit 229a579

Browse files
author
DavidQ
committed
BUILD PR: centralize createResult across exact command-pack batch.
1 parent 8c9a134 commit 229a579

9 files changed

Lines changed: 115 additions & 38 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
MODEL: GPT-5.3-codex
22
REASONING: high
33
COMMAND:
4-
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_41_AS_STRING_ARRAY_PRESET_BATCH.md exactly.
4+
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_42_CREATE_RESULT_COMMANDPACK_BATCH.md exactly.
55
Edit only these files:
6-
- src/shared/utils/arrayUtils.js (only to add/export asStringArray if missing, or minimum export fix if present)
7-
- tools/dev/advanced/debugPanelGroupRegistry.js
8-
- tools/dev/presets/debugPresetRegistry.js
6+
- tools/dev/commandPacks/commandPackResultUtils.js (new file)
7+
- tools/dev/commandPacks/groupCommandPack.js
8+
- tools/dev/commandPacks/macroCommandPack.js
9+
- tools/dev/commandPacks/toggleCommandPack.js
910
Do not expand scope.
10-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_41_AS_STRING_ARRAY_PRESET_BATCH_delta.zip
11+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_42_CREATE_RESULT_COMMANDPACK_BATCH_delta.zip

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BUILD PR: centralize asStringArray across exact preset/group-registry batch.
1+
BUILD PR: centralize createResult across exact command-pack batch.

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Next: run BUILD_PR_SHARED_EXTRACTION_42_CREATE_RESULT_COMMANDPACK_BATCH after this batch.
1+
Next: run BUILD_PR_SHARED_EXTRACTION_43_GET_RUNTIME_AND_REGISTRY_BATCH after this batch.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Execution-grade batch for asStringArray using the exact duplicate-report file list.
1+
Execution-grade batch for createResult using the exact duplicate-report file list.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# BUILD_PR_SHARED_EXTRACTION_42_CREATE_RESULT_COMMANDPACK_BATCH
2+
3+
## Purpose
4+
Centralize duplicated `createResult(status, title, lines, code, details = {})` implementations across the exact command-pack batch identified in the duplicate report.
5+
6+
## Single PR Purpose
7+
Normalize ONLY this helper:
8+
9+
- `createResult(status, title, lines, code, details = {})`
10+
11+
## Exact Files Allowed
12+
13+
### New shared file
14+
1. `tools/dev/commandPacks/commandPackResultUtils.js`
15+
16+
### Consumer files
17+
2. `tools/dev/commandPacks/groupCommandPack.js`
18+
3. `tools/dev/commandPacks/macroCommandPack.js`
19+
4. `tools/dev/commandPacks/toggleCommandPack.js`
20+
21+
Do not edit any other file.
22+
23+
## Source of Truth
24+
This exact scope comes from the provided duplicate report entry for:
25+
26+
`function createResult(status, title, lines, code, details = {})`
27+
28+
Only the 3 listed consumer files are in scope.
29+
30+
## Exact Shared Helper Creation
31+
Create:
32+
33+
`tools/dev/commandPacks/commandPackResultUtils.js`
34+
35+
Export exactly:
36+
37+
```js
38+
export function createResult(status, title, lines, code, details = {}) {
39+
// copy one existing implementation exactly
40+
}
41+
```
42+
43+
Implementation rules:
44+
- use ONE existing local implementation as source-of-truth
45+
- do NOT merge logic
46+
- do NOT generalize behavior
47+
- preserve the function signature exactly:
48+
- `createResult(status, title, lines, code, details = {})`
49+
50+
## Exact Consumer Changes
51+
For each of the 3 listed consumer files:
52+
53+
If the file contains a local function definition matching:
54+
```js
55+
function createResult(status, title, lines, code, details = {})
56+
```
57+
then:
58+
- remove the local `createResult(...)` function definition
59+
- import `createResult` from the correct relative path to:
60+
- `./commandPackResultUtils.js`
61+
- if the file already imports from that module, add `createResult` with the minimum safe edit
62+
- do not duplicate imports
63+
- do not touch unrelated helpers
64+
- do not change logic
65+
66+
If a listed file already imports and uses shared `createResult`, leave it unchanged.
67+
68+
## Relative Import Rule
69+
Use exactly:
70+
71+
`./commandPackResultUtils.js`
72+
73+
Do not use aliases.
74+
Do not change `.js` extension usage.
75+
76+
## Hard Constraints
77+
- no engine changes
78+
- no files outside the 3 listed consumers plus the one new shared file
79+
- no repo-wide command-pack helper cleanup
80+
- no behavior changes
81+
- keep one PR purpose only
82+
83+
## Validation Checklist
84+
1. Confirm no more than the 4 listed files changed
85+
2. Confirm `tools/dev/commandPacks/commandPackResultUtils.js` exists and exports `createResult`
86+
3. Confirm local `function createResult(...)` definitions no longer exist in changed listed consumer files
87+
4. Confirm changed consumer files import `createResult` from `./commandPackResultUtils.js`
88+
5. Confirm no unrelated files changed
89+
6. Confirm no behavior changes were made
90+
91+
## Non-Goals
92+
- no cleanup of `toResult`
93+
- no cleanup outside the 3 listed consumer files
94+
- no refactor beyond this exact duplicate-removal batch
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export function createResult(status, title, lines, code, details = {}) {
2+
return {
3+
status: status === "failed" ? "failed" : "ready",
4+
title,
5+
lines: Array.isArray(lines) ? lines : [],
6+
code,
7+
details
8+
};
9+
}

tools/dev/commandPacks/groupCommandPack.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,10 @@ import {
1111
requireAtLeastArgs,
1212
requireNoArgs
1313
} from "./packUtils.js";
14+
import { createResult } from "./commandPackResultUtils.js";
1415

1516
import { sanitizeText } from "../../../src/engine/debug/inspectors/shared/inspectorUtils.js";
1617

17-
function createResult(status, title, lines, code, details = {}) {
18-
return {
19-
status: status === "failed" ? "failed" : "ready",
20-
title,
21-
lines: Array.isArray(lines) ? lines : [],
22-
code,
23-
details
24-
};
25-
}
26-
2718
function getRuntimeAndRegistry(context) {
2819
const runtime = context?.consoleRuntime;
2920
const panelRegistry = runtime?.panelRegistry;

tools/dev/commandPacks/macroCommandPack.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@ import {
1212
requireAtLeastArgs,
1313
requireNoArgs
1414
} from "./packUtils.js";
15+
import { createResult } from "./commandPackResultUtils.js";
1516

1617
import { sanitizeText } from "../../../src/engine/debug/inspectors/shared/inspectorUtils.js";
1718

18-
function createResult(status, title, lines, code, details = {}) {
19-
return {
20-
status: status === "failed" ? "failed" : "ready",
21-
title,
22-
lines: Array.isArray(lines) ? lines : [],
23-
code,
24-
details
25-
};
26-
}
27-
2819
const macroRegistry = new DebugMacroRegistry();
2920
registerStandardDebugMacros(macroRegistry, "standard");
3021

tools/dev/commandPacks/toggleCommandPack.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,7 @@ toggleCommandPack.js
88
import {
99
requireNoArgs
1010
} from "./packUtils.js";
11-
12-
function createResult(status, title, lines, code, details = {}) {
13-
return {
14-
status: status === "failed" ? "failed" : "ready",
15-
title,
16-
lines: Array.isArray(lines) ? lines : [],
17-
code,
18-
details
19-
};
20-
}
11+
import { createResult } from "./commandPackResultUtils.js";
2112

2213
function executePresetToggle(context, presetId) {
2314
if (typeof context?.executeConsoleCommand !== "function") {

0 commit comments

Comments
 (0)