codex-devtools 0.1.9 → 0.1.10
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/README.md +6 -0
- package/bin/codex-devtools.cjs +52 -3
- package/package.json +2 -1
- package/resources/.gitkeep +0 -0
- package/resources/icon.icns +0 -0
- package/resources/icon.png +0 -0
- package/resources/icons/.gitkeep +0 -0
- package/resources/icons/png/128x128.png +0 -0
- package/resources/icons/png/16x16.png +0 -0
- package/resources/icons/png/256x256.png +0 -0
- package/resources/icons/png/32x32.png +0 -0
- package/resources/icons/png/48x48.png +0 -0
- package/resources/icons/png/512x512.png +0 -0
- package/resources/icons/png/64x64.png +0 -0
- package/resources/logo.png +0 -0
package/README.md
CHANGED
|
@@ -50,6 +50,12 @@ bunx codex-devtools --web
|
|
|
50
50
|
|
|
51
51
|
Standalone mode serves at `http://localhost:3456`.
|
|
52
52
|
|
|
53
|
+
To make web mode the default without flags:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
CODEX_DEVTOOLS_DEFAULT_MODE=web npx codex-devtools
|
|
57
|
+
```
|
|
58
|
+
|
|
53
59
|
## Standalone mode
|
|
54
60
|
|
|
55
61
|
Run as an HTTP server without Electron:
|
package/bin/codex-devtools.cjs
CHANGED
|
@@ -1,18 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const { existsSync } = require('node:fs');
|
|
5
|
-
const { join } = require('node:path');
|
|
6
|
-
const { spawn } = require('node:child_process');
|
|
4
|
+
const { copyFileSync, existsSync } = require('node:fs');
|
|
5
|
+
const { join, resolve } = require('node:path');
|
|
6
|
+
const { spawn, spawnSync } = require('node:child_process');
|
|
7
7
|
|
|
8
8
|
const APP_ROOT = join(__dirname, '..');
|
|
9
9
|
const ELECTRON_ENTRY = join(APP_ROOT, 'dist-electron', 'main', 'index.cjs');
|
|
10
10
|
const STANDALONE_ENTRY = join(APP_ROOT, 'dist-electron', 'main', 'standalone.cjs');
|
|
11
|
+
const APP_DISPLAY_NAME = 'codex-devtools';
|
|
12
|
+
const APP_BUNDLE_ID = 'com.codex.devtools.dev';
|
|
11
13
|
|
|
12
14
|
function hasArg(flag) {
|
|
13
15
|
return process.argv.includes(flag);
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
function runCommand(command, args) {
|
|
19
|
+
const result = spawnSync(command, args, { stdio: 'ignore' });
|
|
20
|
+
return result.status === 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function patchMacElectronBundle(electronBinary) {
|
|
24
|
+
if (process.platform !== 'darwin') {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const appContents = resolve(electronBinary, '..', '..');
|
|
30
|
+
const plistPath = join(appContents, 'Info.plist');
|
|
31
|
+
const sourceIcon = join(APP_ROOT, 'resources', 'icon.icns');
|
|
32
|
+
const targetIcon = join(appContents, 'Resources', 'electron.icns');
|
|
33
|
+
|
|
34
|
+
if (!existsSync(plistPath)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const replacements = [
|
|
39
|
+
['CFBundleDisplayName', APP_DISPLAY_NAME],
|
|
40
|
+
['CFBundleName', APP_DISPLAY_NAME],
|
|
41
|
+
['CFBundleIdentifier', APP_BUNDLE_ID],
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
for (const [key, value] of replacements) {
|
|
45
|
+
runCommand('plutil', ['-replace', key, '-string', value, plistPath]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (existsSync(sourceIcon)) {
|
|
49
|
+
copyFileSync(sourceIcon, targetIcon);
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// Best effort only; launch should continue even if patching fails.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
16
56
|
function runStandalone() {
|
|
17
57
|
if (!existsSync(STANDALONE_ENTRY)) {
|
|
18
58
|
console.error('[codex-devtools] Missing standalone bundle. Reinstall package and try again.');
|
|
@@ -47,6 +87,8 @@ function runDesktop() {
|
|
|
47
87
|
process.exit(1);
|
|
48
88
|
}
|
|
49
89
|
|
|
90
|
+
patchMacElectronBundle(electronBinary);
|
|
91
|
+
|
|
50
92
|
const forwardedArgs = process.argv.slice(2).filter((arg) => arg !== '--desktop');
|
|
51
93
|
const child = spawn(electronBinary, [APP_ROOT, ...forwardedArgs], {
|
|
52
94
|
stdio: 'inherit',
|
|
@@ -75,11 +117,18 @@ if (hasArg('--help') || hasArg('-h')) {
|
|
|
75
117
|
console.log(' codex-devtools Launch Electron desktop app (default)');
|
|
76
118
|
console.log(' codex-devtools --web Run standalone HTTP mode');
|
|
77
119
|
console.log(' codex-devtools --desktop Force desktop mode');
|
|
120
|
+
console.log('');
|
|
121
|
+
console.log('Environment:');
|
|
122
|
+
console.log(' CODEX_DEVTOOLS_DEFAULT_MODE=web Use web mode by default');
|
|
78
123
|
process.exit(0);
|
|
79
124
|
}
|
|
80
125
|
|
|
81
126
|
if (hasArg('--web') || hasArg('--standalone')) {
|
|
82
127
|
runStandalone();
|
|
128
|
+
} else if (hasArg('--desktop')) {
|
|
129
|
+
runDesktop();
|
|
130
|
+
} else if ((process.env.CODEX_DEVTOOLS_DEFAULT_MODE || '').toLowerCase() === 'web') {
|
|
131
|
+
runStandalone();
|
|
83
132
|
} else {
|
|
84
133
|
runDesktop();
|
|
85
134
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-devtools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.10",
|
|
5
5
|
"description": "Desktop app for inspecting Codex session data",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"bin/**",
|
|
25
25
|
"dist-electron/**",
|
|
26
26
|
"out/renderer/**",
|
|
27
|
+
"resources/**",
|
|
27
28
|
"README.md"
|
|
28
29
|
],
|
|
29
30
|
"scripts": {
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|