oh-my-opencode 4.19.2 → 4.19.3
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/.agents/command/publish.md +95 -28
- package/.agents/skills/publish/SKILL.md +20 -6
- package/.opencode/command/publish.md +95 -28
- package/THIRD-PARTY-NOTICES.md +7 -7
- package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +1 -1
- package/dist/cli/config-migrate.d.ts +8 -0
- package/dist/cli/doctor/checks/legacy-config-leftovers.d.ts +10 -0
- package/dist/cli/doctor/checks/model-resolution-config.d.ts +1 -1
- package/dist/cli/doctor/checks/tools-lsp.d.ts +1 -1
- package/dist/cli/doctor/framework/constants.d.ts +1 -1
- package/dist/cli/index.js +95557 -92944
- package/dist/cli-node/index.js +95539 -92926
- package/dist/config/validate.d.ts +2 -1
- package/dist/config-migration/deep-diff.d.ts +1 -0
- package/dist/config-migration/discovery-paths.d.ts +11 -0
- package/dist/config-migration/discovery-roots.d.ts +7 -0
- package/dist/config-migration/discovery.d.ts +4 -0
- package/dist/config-migration/index.d.ts +9 -0
- package/dist/config-migration/legacy-history.d.ts +3 -0
- package/dist/config-migration/migration-executor.d.ts +4 -0
- package/dist/config-migration/migration-plans.d.ts +14 -0
- package/dist/config-migration/record-values.d.ts +4 -0
- package/dist/config-migration/schema-url.d.ts +1 -0
- package/dist/config-migration/transform-config-jsonc.d.ts +2 -0
- package/dist/config-migration/transform-opencode.d.ts +2 -0
- package/dist/config-migration/transform-types.d.ts +24 -0
- package/dist/config-migration/types.d.ts +39 -0
- package/dist/features/builtin-commands/templates/hyperplan.d.ts +1 -1
- package/dist/hooks/auto-update-checker/constants.d.ts +3 -3
- package/dist/index.js +10424 -8161
- package/dist/plugin-config/omo-config-chain.d.ts +14 -0
- package/dist/plugin-config/unknown-key-diagnostics.d.ts +5 -0
- package/dist/plugin-config.d.ts +2 -2
- package/dist/shared/agent-display-names.d.ts +1 -1
- package/dist/shared/jsonc-parser.d.ts +1 -1
- package/dist/shared/migration.d.ts +5 -1
- package/dist/shared/opencode-config-dir-types.d.ts +0 -1
- package/dist/shared/plugin-identity.d.ts +6 -8
- package/dist/shared/project-discovery-dirs.d.ts +0 -1
- package/dist/skills/frontend/ATTRIBUTION.md +7 -0
- package/dist/skills/frontend/SKILL.md +4 -1
- package/dist/skills/frontend/references/design/README.md +8 -0
- package/dist/skills/frontend/references/design/_INDEX.md +14 -1
- package/dist/skills/frontend/references/design/interaction-skill.md +144 -0
- package/dist/startup-migration.d.ts +28 -0
- package/dist/testing/create-plugin-module.d.ts +4 -0
- package/dist/tui.js +5356 -4643
- package/package.json +13 -13
- package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +19 -3
- package/packages/lsp-core/src/lsp/fixtures/workspace-edit-server.mjs +11 -2
- package/packages/omo-codex/THIRD-PARTY-NOTICES.md +2 -2
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/AGENTS.md +11 -5
- package/packages/omo-codex/plugin/components/codegraph/NOTICE +1 -1
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +10153 -2571
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +7311 -572
- package/packages/omo-codex/plugin/components/codegraph/package.json +2 -2
- package/packages/omo-codex/plugin/components/codegraph/src/hook-input.ts +33 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +36 -10
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +164 -159
- package/packages/omo-codex/plugin/components/codegraph/src/post-tool-use-hook.ts +34 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +20 -2
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-command.ts +106 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-cooldown.ts +145 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +21 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-lock.ts +139 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-outcome.ts +15 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-paths.ts +32 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-project.ts +109 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker-result.ts +148 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +126 -175
- package/packages/omo-codex/plugin/components/codegraph/test/hook-exclusion.test.ts +4 -4
- package/packages/omo-codex/plugin/components/codegraph/test/hook-session-start-guard.test.ts +160 -0
- package/packages/omo-codex/plugin/components/codegraph/test/hook-store-upgrade.test.ts +12 -138
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +28 -24
- package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +3 -3
- package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +2 -2
- package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +5 -5
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +3 -3
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +1 -1
- package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +45 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +2 -2
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +70 -13
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-project.test.ts +58 -0
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-state.test.ts +104 -0
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +4 -2
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-cooldown.test.ts +116 -0
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +58 -57
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +31 -14
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +17 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +42 -41
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +165 -16
- package/packages/omo-codex/plugin/shared/src/config-migration.ts +162 -0
- package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +186 -9
- package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +7 -0
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +4 -1
- package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +8 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +14 -1
- package/packages/omo-codex/plugin/skills/frontend/references/design/interaction-skill.md +144 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +17 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +1 -1
- package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +7 -0
- package/packages/shared-skills/skills/frontend/SKILL.md +4 -1
- package/packages/shared-skills/skills/frontend/references/design/README.md +8 -0
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +14 -1
- package/packages/shared-skills/skills/frontend/references/design/interaction-skill.md +144 -0
- package/dist/plugin-config/layered-config-loader.d.ts +0 -2
- package/dist/plugin-config/single-config-loader.d.ts +0 -4
- package/dist/shared/migrate-legacy-config-file.d.ts +0 -1
- package/dist/shared/migration/config-migration.d.ts +0 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"type": "command",
|
|
8
8
|
"command": "node \"${PLUGIN_ROOT}/components/ultrawork/dist/cli.js\" hook user-prompt-submit",
|
|
9
9
|
"timeout": 5,
|
|
10
|
-
"statusMessage": "(OmO 4.19.
|
|
10
|
+
"statusMessage": "(OmO 4.19.3) Checking Ultrawork Trigger",
|
|
11
11
|
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ultrawork\\dist\\cli.js\" hook user-prompt-submit"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"type": "command",
|
|
8
8
|
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook user-prompt-submit",
|
|
9
9
|
"timeout": 10,
|
|
10
|
-
"statusMessage": "(OmO 4.19.
|
|
10
|
+
"statusMessage": "(OmO 4.19.3) Checking Ulw-Loop Steering",
|
|
11
11
|
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook user-prompt-submit"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"type": "command",
|
|
8
8
|
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook user-prompt-submit",
|
|
9
9
|
"timeout": 10,
|
|
10
|
-
"statusMessage": "(OmO 4.19.
|
|
10
|
+
"statusMessage": "(OmO 4.19.3) Loading Project Rules",
|
|
11
11
|
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook user-prompt-submit"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sisyphuslabs/omo-codex-plugin",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@sisyphuslabs/omo-codex-plugin",
|
|
9
|
-
"version": "4.19.
|
|
9
|
+
"version": "4.19.3",
|
|
10
10
|
"workspaces": [
|
|
11
11
|
"components/codegraph",
|
|
12
12
|
"components/comment-checker",
|
|
@@ -94,13 +94,14 @@
|
|
|
94
94
|
"version": "0.1.0",
|
|
95
95
|
"dev": true,
|
|
96
96
|
"dependencies": {
|
|
97
|
+
"@oh-my-opencode/omo-config-core": "workspace:*",
|
|
97
98
|
"js-yaml": "^4.1.1",
|
|
98
99
|
"jsonc-parser": "^3.3.1"
|
|
99
100
|
}
|
|
100
101
|
},
|
|
101
102
|
"components/codegraph": {
|
|
102
103
|
"name": "@sisyphuslabs/codex-codegraph",
|
|
103
|
-
"version": "4.19.
|
|
104
|
+
"version": "4.19.3",
|
|
104
105
|
"bin": {
|
|
105
106
|
"omo-codegraph": "dist/cli.js"
|
|
106
107
|
},
|
|
@@ -114,12 +115,12 @@
|
|
|
114
115
|
"node": ">=20.0.0"
|
|
115
116
|
},
|
|
116
117
|
"optionalDependencies": {
|
|
117
|
-
"@colbymchenry/codegraph": "1.
|
|
118
|
+
"@colbymchenry/codegraph": "1.5.0"
|
|
118
119
|
}
|
|
119
120
|
},
|
|
120
121
|
"components/comment-checker": {
|
|
121
122
|
"name": "@code-yeongyu/codex-comment-checker",
|
|
122
|
-
"version": "4.19.
|
|
123
|
+
"version": "4.19.3",
|
|
123
124
|
"license": "MIT",
|
|
124
125
|
"bin": {
|
|
125
126
|
"omo-comment-checker": "dist/cli.js"
|
|
@@ -140,7 +141,7 @@
|
|
|
140
141
|
},
|
|
141
142
|
"components/git-bash": {
|
|
142
143
|
"name": "@sisyphuslabs/codex-git-bash-hook",
|
|
143
|
-
"version": "4.19.
|
|
144
|
+
"version": "4.19.3",
|
|
144
145
|
"bin": {
|
|
145
146
|
"omo-git-bash-hook": "dist/cli.js"
|
|
146
147
|
},
|
|
@@ -155,7 +156,7 @@
|
|
|
155
156
|
},
|
|
156
157
|
"components/lazycodex-executor-verify": {
|
|
157
158
|
"name": "@code-yeongyu/codex-lazycodex-executor-verify",
|
|
158
|
-
"version": "4.19.
|
|
159
|
+
"version": "4.19.3",
|
|
159
160
|
"license": "MIT",
|
|
160
161
|
"bin": {
|
|
161
162
|
"lazycodex-executor-verify": "dist/cli.js"
|
|
@@ -172,7 +173,7 @@
|
|
|
172
173
|
},
|
|
173
174
|
"components/lsp": {
|
|
174
175
|
"name": "@code-yeongyu/codex-lsp",
|
|
175
|
-
"version": "4.19.
|
|
176
|
+
"version": "4.19.3",
|
|
176
177
|
"license": "MIT",
|
|
177
178
|
"dependencies": {
|
|
178
179
|
"@code-yeongyu/lsp-daemon": "file:../../../../lsp-daemon",
|
|
@@ -193,7 +194,7 @@
|
|
|
193
194
|
},
|
|
194
195
|
"components/rules": {
|
|
195
196
|
"name": "@code-yeongyu/codex-rules",
|
|
196
|
-
"version": "4.19.
|
|
197
|
+
"version": "4.19.3",
|
|
197
198
|
"license": "MIT",
|
|
198
199
|
"dependencies": {
|
|
199
200
|
"picomatch": "^4.0.3"
|
|
@@ -215,7 +216,7 @@
|
|
|
215
216
|
},
|
|
216
217
|
"components/start-work-continuation": {
|
|
217
218
|
"name": "@code-yeongyu/codex-start-work-continuation",
|
|
218
|
-
"version": "4.19.
|
|
219
|
+
"version": "4.19.3",
|
|
219
220
|
"license": "MIT",
|
|
220
221
|
"bin": {
|
|
221
222
|
"omo-start-work-continuation": "dist/cli.js"
|
|
@@ -232,7 +233,7 @@
|
|
|
232
233
|
},
|
|
233
234
|
"components/teammode": {
|
|
234
235
|
"name": "@sisyphuslabs/codex-teammode",
|
|
235
|
-
"version": "4.19.
|
|
236
|
+
"version": "4.19.3",
|
|
236
237
|
"devDependencies": {
|
|
237
238
|
"@types/node": "^25.9.3",
|
|
238
239
|
"bun-types": "^1.3.1",
|
|
@@ -245,7 +246,7 @@
|
|
|
245
246
|
},
|
|
246
247
|
"components/telemetry": {
|
|
247
248
|
"name": "@code-yeongyu/codex-telemetry",
|
|
248
|
-
"version": "4.19.
|
|
249
|
+
"version": "4.19.3",
|
|
249
250
|
"license": "MIT",
|
|
250
251
|
"bin": {
|
|
251
252
|
"omo-telemetry": "dist/cli.js"
|
|
@@ -263,7 +264,7 @@
|
|
|
263
264
|
},
|
|
264
265
|
"components/ultrawork": {
|
|
265
266
|
"name": "@code-yeongyu/codex-ultrawork",
|
|
266
|
-
"version": "4.19.
|
|
267
|
+
"version": "4.19.3",
|
|
267
268
|
"license": "MIT",
|
|
268
269
|
"bin": {
|
|
269
270
|
"omo-ultrawork": "dist/cli.js"
|
|
@@ -281,7 +282,7 @@
|
|
|
281
282
|
},
|
|
282
283
|
"components/ulw-loop": {
|
|
283
284
|
"name": "@code-yeongyu/codex-ulw-loop",
|
|
284
|
-
"version": "4.19.
|
|
285
|
+
"version": "4.19.3",
|
|
285
286
|
"license": "MIT",
|
|
286
287
|
"bin": {
|
|
287
288
|
"omo-ulw-loop": "dist/cli.js",
|
|
@@ -512,27 +513,27 @@
|
|
|
512
513
|
"link": true
|
|
513
514
|
},
|
|
514
515
|
"node_modules/@colbymchenry/codegraph": {
|
|
515
|
-
"version": "1.
|
|
516
|
-
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph/-/codegraph-1.
|
|
517
|
-
"integrity": "sha512
|
|
516
|
+
"version": "1.5.0",
|
|
517
|
+
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph/-/codegraph-1.5.0.tgz",
|
|
518
|
+
"integrity": "sha512-/l1JMVOQ9WGQLrc/IIuAg7Igr944t79/oNCJTcnGkYtIeQx2XFIqI0ho+9Les/Yu4zKfmPU17hIUshD6yP1fKw==",
|
|
518
519
|
"license": "MIT",
|
|
519
520
|
"optional": true,
|
|
520
521
|
"bin": {
|
|
521
522
|
"codegraph": "npm-shim.js"
|
|
522
523
|
},
|
|
523
524
|
"optionalDependencies": {
|
|
524
|
-
"@colbymchenry/codegraph-darwin-arm64": "1.
|
|
525
|
-
"@colbymchenry/codegraph-darwin-x64": "1.
|
|
526
|
-
"@colbymchenry/codegraph-linux-arm64": "1.
|
|
527
|
-
"@colbymchenry/codegraph-linux-x64": "1.
|
|
528
|
-
"@colbymchenry/codegraph-win32-arm64": "1.
|
|
529
|
-
"@colbymchenry/codegraph-win32-x64": "1.
|
|
525
|
+
"@colbymchenry/codegraph-darwin-arm64": "1.5.0",
|
|
526
|
+
"@colbymchenry/codegraph-darwin-x64": "1.5.0",
|
|
527
|
+
"@colbymchenry/codegraph-linux-arm64": "1.5.0",
|
|
528
|
+
"@colbymchenry/codegraph-linux-x64": "1.5.0",
|
|
529
|
+
"@colbymchenry/codegraph-win32-arm64": "1.5.0",
|
|
530
|
+
"@colbymchenry/codegraph-win32-x64": "1.5.0"
|
|
530
531
|
}
|
|
531
532
|
},
|
|
532
533
|
"node_modules/@colbymchenry/codegraph-darwin-arm64": {
|
|
533
|
-
"version": "1.
|
|
534
|
-
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-darwin-arm64/-/codegraph-darwin-arm64-1.
|
|
535
|
-
"integrity": "sha512-
|
|
534
|
+
"version": "1.5.0",
|
|
535
|
+
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-darwin-arm64/-/codegraph-darwin-arm64-1.5.0.tgz",
|
|
536
|
+
"integrity": "sha512-ptQV1WlEKCDDy0Wl2r/urVGwaczUn5ezjt/Rv22Gj7RnKHAc9pNdU1uvL3gQzvoWJ9q7kmCeo7q6866/ZohbjQ==",
|
|
536
537
|
"cpu": [
|
|
537
538
|
"arm64"
|
|
538
539
|
],
|
|
@@ -543,9 +544,9 @@
|
|
|
543
544
|
]
|
|
544
545
|
},
|
|
545
546
|
"node_modules/@colbymchenry/codegraph-darwin-x64": {
|
|
546
|
-
"version": "1.
|
|
547
|
-
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-darwin-x64/-/codegraph-darwin-x64-1.
|
|
548
|
-
"integrity": "sha512-
|
|
547
|
+
"version": "1.5.0",
|
|
548
|
+
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-darwin-x64/-/codegraph-darwin-x64-1.5.0.tgz",
|
|
549
|
+
"integrity": "sha512-7BUOOxMacLNXmXTQTrjDTZXhbo0o5R5Z19uKjICIau2KxO9oU+Zbk7Bnf4P/JT1T4M41xRuiCJVE1uqBi6cFWA==",
|
|
549
550
|
"cpu": [
|
|
550
551
|
"x64"
|
|
551
552
|
],
|
|
@@ -556,9 +557,9 @@
|
|
|
556
557
|
]
|
|
557
558
|
},
|
|
558
559
|
"node_modules/@colbymchenry/codegraph-linux-arm64": {
|
|
559
|
-
"version": "1.
|
|
560
|
-
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-linux-arm64/-/codegraph-linux-arm64-1.
|
|
561
|
-
"integrity": "sha512-
|
|
560
|
+
"version": "1.5.0",
|
|
561
|
+
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-linux-arm64/-/codegraph-linux-arm64-1.5.0.tgz",
|
|
562
|
+
"integrity": "sha512-Bq5Ggb7PoLF7mnOiGl/UxMrDgrPCAQUMsl7BpMkAxq8FulvVEp7E/GrIQih2YB32vWr18KpN2i2VoRLAHLIDUw==",
|
|
562
563
|
"cpu": [
|
|
563
564
|
"arm64"
|
|
564
565
|
],
|
|
@@ -569,9 +570,9 @@
|
|
|
569
570
|
]
|
|
570
571
|
},
|
|
571
572
|
"node_modules/@colbymchenry/codegraph-linux-x64": {
|
|
572
|
-
"version": "1.
|
|
573
|
-
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-linux-x64/-/codegraph-linux-x64-1.
|
|
574
|
-
"integrity": "sha512-
|
|
573
|
+
"version": "1.5.0",
|
|
574
|
+
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-linux-x64/-/codegraph-linux-x64-1.5.0.tgz",
|
|
575
|
+
"integrity": "sha512-wT1O7NkQoV6zPiq36d1qBqoIHL2ZRnOkFMjQ7JJwWS7KHnP32qHCd/pPaSwl8cNRlGYkYSaX3WVDpz2BaV+Now==",
|
|
575
576
|
"cpu": [
|
|
576
577
|
"x64"
|
|
577
578
|
],
|
|
@@ -582,9 +583,9 @@
|
|
|
582
583
|
]
|
|
583
584
|
},
|
|
584
585
|
"node_modules/@colbymchenry/codegraph-win32-arm64": {
|
|
585
|
-
"version": "1.
|
|
586
|
-
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-win32-arm64/-/codegraph-win32-arm64-1.
|
|
587
|
-
"integrity": "sha512-
|
|
586
|
+
"version": "1.5.0",
|
|
587
|
+
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-win32-arm64/-/codegraph-win32-arm64-1.5.0.tgz",
|
|
588
|
+
"integrity": "sha512-cWMJp8BeVLKR1mUVklI3opy9mJL/yrVkvjBqJFXRejM8CCU+UTpPDxDzQuPyywY0qyD0Ru2tjuWT4do7OUcNvg==",
|
|
588
589
|
"cpu": [
|
|
589
590
|
"arm64"
|
|
590
591
|
],
|
|
@@ -595,9 +596,9 @@
|
|
|
595
596
|
]
|
|
596
597
|
},
|
|
597
598
|
"node_modules/@colbymchenry/codegraph-win32-x64": {
|
|
598
|
-
"version": "1.
|
|
599
|
-
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-win32-x64/-/codegraph-win32-x64-1.
|
|
600
|
-
"integrity": "sha512-
|
|
599
|
+
"version": "1.5.0",
|
|
600
|
+
"resolved": "https://registry.npmjs.org/@colbymchenry/codegraph-win32-x64/-/codegraph-win32-x64-1.5.0.tgz",
|
|
601
|
+
"integrity": "sha512-45gycJ+t153vpLEVkXChEySG1Ok5zqCgiBeonLe5V7Jxt1w+MF2vG00qexTC0pBWTmHSeMW4Q8d47nVMiC8ciQ==",
|
|
601
602
|
"cpu": [
|
|
602
603
|
"x64"
|
|
603
604
|
],
|
|
@@ -2,45 +2,194 @@ import { homedir } from "node:os"
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
loadOmoConfig,
|
|
5
|
+
mergeOmoConfigRecords,
|
|
6
|
+
OmoConfigSchema,
|
|
5
7
|
type LoadOmoConfigOptions,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
type MigrationEnvironment,
|
|
9
|
+
type MigrationFileSystem,
|
|
10
|
+
type OmoConfig,
|
|
11
|
+
type OmoConfigEnv,
|
|
12
|
+
type OmoConfigSource,
|
|
13
|
+
} from "../../../../omo-config-core/src/index.ts"
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
import {
|
|
16
|
+
runCodexConfigMigration,
|
|
17
|
+
type CodexConfigMigrationOptions,
|
|
18
|
+
type CodexConfigMigrationResult,
|
|
19
|
+
} from "./config-migration.ts"
|
|
20
|
+
|
|
21
|
+
export type CodexOmoConfigOptions = Omit<LoadOmoConfigOptions, "fileSystem" | "harness"> & {
|
|
22
|
+
readonly fileSystem?: MigrationFileSystem
|
|
23
|
+
readonly homeDir?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type CodexStartupMigrationOptions = CodexConfigMigrationOptions
|
|
27
|
+
export type CodexStartupMigrationResult = CodexConfigMigrationResult
|
|
28
|
+
|
|
29
|
+
type CodexCodegraphConfig = {
|
|
30
|
+
readonly auto_provision?: boolean
|
|
31
|
+
readonly daemon?: boolean
|
|
32
|
+
readonly enabled?: boolean
|
|
33
|
+
readonly excluded_roots?: readonly string[]
|
|
34
|
+
readonly install_dir?: string
|
|
35
|
+
readonly session_start_cooldown_ms?: number
|
|
36
|
+
readonly telemetry?: boolean
|
|
37
|
+
readonly watch_debounce_ms?: number
|
|
38
|
+
}
|
|
11
39
|
|
|
12
|
-
|
|
40
|
+
type CodexResolvedConfig = Omit<OmoConfig, "codegraph"> & {
|
|
41
|
+
readonly codegraph?: CodexCodegraphConfig
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type CodexOmoConfig = CodexResolvedConfig & {
|
|
13
45
|
readonly sources: readonly OmoConfigSource[]
|
|
14
46
|
readonly trustedCodegraphInstallDir?: string
|
|
15
47
|
readonly warnings: readonly string[]
|
|
16
48
|
}
|
|
17
49
|
|
|
50
|
+
const ENV_BOOLEAN_SETTINGS = [
|
|
51
|
+
["auto_provision", "AUTO_PROVISION"],
|
|
52
|
+
["enabled", "ENABLED"],
|
|
53
|
+
["telemetry", "TELEMETRY"],
|
|
54
|
+
] as const
|
|
55
|
+
|
|
56
|
+
function resolveHomeDir(options: CodexOmoConfigOptions): string {
|
|
57
|
+
const env = options.env ?? process.env
|
|
58
|
+
return options.homeDir ?? env.HOME ?? env.USERPROFILE ?? homedir()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function environmentWithHome(env: OmoConfigEnv, homeDir: string): OmoConfigEnv {
|
|
62
|
+
return { ...env, HOME: homeDir }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function migrationEnvironment(homeDir: string, env: OmoConfigEnv): MigrationEnvironment {
|
|
66
|
+
return {
|
|
67
|
+
HOME: homeDir,
|
|
68
|
+
...(env.USERPROFILE === undefined ? {} : { USERPROFILE: env.USERPROFILE }),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Runs only the legacy config.jsonc transaction before Codex reads omo.jsonc. */
|
|
73
|
+
export function runCodexStartupMigration(options: CodexStartupMigrationOptions): CodexStartupMigrationResult {
|
|
74
|
+
return runCodexConfigMigration(options)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function parseBoolean(value: string): boolean | undefined {
|
|
78
|
+
const normalized = value.trim().toLowerCase()
|
|
79
|
+
if (["1", "true", "yes", "on"].includes(normalized)) return true
|
|
80
|
+
if (["0", "false", "no", "off"].includes(normalized)) return false
|
|
81
|
+
return undefined
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function envOverrides(env: OmoConfigEnv, warnings: string[]): Record<string, unknown> {
|
|
85
|
+
const codegraph: Record<string, unknown> = {}
|
|
86
|
+
for (const prefix of ["OMO", "CODEX"]) {
|
|
87
|
+
for (const [setting, suffix] of ENV_BOOLEAN_SETTINGS) {
|
|
88
|
+
const name = `${prefix}_CODEGRAPH_${suffix}`
|
|
89
|
+
const rawValue = env[name]
|
|
90
|
+
if (rawValue === undefined) continue
|
|
91
|
+
const value = parseBoolean(rawValue)
|
|
92
|
+
if (value === undefined) warnings.push(`${name} has invalid boolean value "${rawValue}"`)
|
|
93
|
+
else codegraph[setting] = value
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const installDir = env[`${prefix}_CODEGRAPH_INSTALL_DIR`]
|
|
97
|
+
if (installDir !== undefined) codegraph["install_dir"] = installDir
|
|
98
|
+
const cooldown = env[`${prefix}_CODEGRAPH_SESSION_START_COOLDOWN_MS`]
|
|
99
|
+
if (cooldown !== undefined) {
|
|
100
|
+
const value = Number(cooldown)
|
|
101
|
+
if (!Number.isFinite(value) || value < 60_000) {
|
|
102
|
+
warnings.push(`${prefix}_CODEGRAPH_SESSION_START_COOLDOWN_MS has invalid number value "${cooldown}"`)
|
|
103
|
+
} else codegraph["session_start_cooldown_ms"] = value
|
|
104
|
+
}
|
|
105
|
+
const debounce = env[`${prefix}_CODEGRAPH_WATCH_DEBOUNCE_MS`]
|
|
106
|
+
if (debounce !== undefined) {
|
|
107
|
+
const value = Number(debounce)
|
|
108
|
+
if (!Number.isFinite(value) || value < 0) warnings.push(`${prefix}_CODEGRAPH_WATCH_DEBOUNCE_MS has invalid number value "${debounce}"`)
|
|
109
|
+
else codegraph["watch_debounce_ms"] = value
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return Object.keys(codegraph).length === 0 ? {} : { codegraph }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function migrationWarnings(result: CodexStartupMigrationResult): readonly string[] {
|
|
116
|
+
const warnings: string[] = []
|
|
117
|
+
if (result.error !== undefined) warnings.push(`omo-codex: configuration migration: ${result.error}`)
|
|
118
|
+
if (result.journalResumed) warnings.push("omo-codex: recovered an interrupted configuration migration")
|
|
119
|
+
if (result.migratedFrom.length > 0) {
|
|
120
|
+
warnings.push(`omo-codex: migrated legacy configuration from ${result.migratedFrom.join(", ")}`)
|
|
121
|
+
}
|
|
122
|
+
for (const migration of result.results) {
|
|
123
|
+
for (const diagnostic of migration.diagnostics) {
|
|
124
|
+
warnings.push(`omo-codex: configuration migration: ${diagnostic}`)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return warnings
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function applicabilityWarnings(config: OmoConfig): readonly string[] {
|
|
131
|
+
return config.codegraph?.watch_debounce_ms === undefined
|
|
132
|
+
? []
|
|
133
|
+
: ["codegraph.watch_debounce_ms is not supported for harness codex"]
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function codexCodegraphConfig(value: OmoConfig["codegraph"]): CodexCodegraphConfig | undefined {
|
|
137
|
+
if (value === undefined) return undefined
|
|
138
|
+
return {
|
|
139
|
+
auto_provision: value.auto_provision,
|
|
140
|
+
daemon: value.daemon,
|
|
141
|
+
enabled: value.enabled,
|
|
142
|
+
telemetry: value.telemetry,
|
|
143
|
+
...(value.excluded_roots === undefined ? {} : { excluded_roots: value.excluded_roots }),
|
|
144
|
+
...(value.install_dir === undefined ? {} : { install_dir: value.install_dir }),
|
|
145
|
+
...(value.session_start_cooldown_ms === undefined ? {} : { session_start_cooldown_ms: value.session_start_cooldown_ms }),
|
|
146
|
+
...(value.watch_debounce_ms === undefined ? {} : { watch_debounce_ms: value.watch_debounce_ms }),
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
18
150
|
export function getCodexOmoConfig(options: CodexOmoConfigOptions = {}): CodexOmoConfig {
|
|
19
151
|
const env = options.env ?? process.env
|
|
20
152
|
const homeDir = resolveHomeDir(options)
|
|
153
|
+
const environment = environmentWithHome(env, homeDir)
|
|
154
|
+
const migration = runCodexStartupMigration({
|
|
155
|
+
cwd: options.cwd ?? process.cwd(),
|
|
156
|
+
environment,
|
|
157
|
+
env: migrationEnvironment(homeDir, environment),
|
|
158
|
+
...(options.fileSystem === undefined ? {} : { fileSystem: options.fileSystem }),
|
|
159
|
+
...(options.platform === undefined ? {} : { platform: options.platform }),
|
|
160
|
+
})
|
|
21
161
|
const result = loadOmoConfig({
|
|
22
162
|
...(options.cwd === undefined ? {} : { cwd: options.cwd }),
|
|
23
|
-
env,
|
|
24
|
-
|
|
163
|
+
env: environment,
|
|
164
|
+
...(options.fileSystem === undefined ? {} : { fileSystem: options.fileSystem }),
|
|
25
165
|
harness: "codex",
|
|
166
|
+
...(options.platform === undefined ? {} : { platform: options.platform }),
|
|
167
|
+
...(options.profile === undefined ? {} : { profile: options.profile }),
|
|
26
168
|
})
|
|
27
169
|
const trustedConfig = loadOmoConfig({
|
|
28
170
|
cwd: homeDir,
|
|
29
|
-
env,
|
|
30
|
-
|
|
171
|
+
env: environment,
|
|
172
|
+
...(options.fileSystem === undefined ? {} : { fileSystem: options.fileSystem }),
|
|
31
173
|
harness: "codex",
|
|
174
|
+
...(options.platform === undefined ? {} : { platform: options.platform }),
|
|
175
|
+
...(options.profile === undefined ? {} : { profile: options.profile }),
|
|
32
176
|
})
|
|
177
|
+
const envWarnings: string[] = []
|
|
178
|
+
const config = OmoConfigSchema.parse(mergeOmoConfigRecords(result.config, envOverrides(env, envWarnings)))
|
|
33
179
|
const trustedCodegraphInstallDir = trustedConfig.config.codegraph?.install_dir
|
|
180
|
+
const { codegraph, ...resolvedConfig } = config
|
|
181
|
+
const codexCodegraph = codexCodegraphConfig(codegraph)
|
|
34
182
|
|
|
35
183
|
return {
|
|
36
|
-
...
|
|
184
|
+
...resolvedConfig,
|
|
185
|
+
...(codexCodegraph === undefined ? {} : { codegraph: codexCodegraph }),
|
|
37
186
|
sources: result.sources,
|
|
38
187
|
...(trustedCodegraphInstallDir === undefined ? {} : { trustedCodegraphInstallDir }),
|
|
39
|
-
warnings:
|
|
188
|
+
warnings: [
|
|
189
|
+
...migrationWarnings(migration),
|
|
190
|
+
...result.diagnostics.map((diagnostic) => diagnostic.message),
|
|
191
|
+
...envWarnings,
|
|
192
|
+
...applicabilityWarnings(config),
|
|
193
|
+
],
|
|
40
194
|
}
|
|
41
195
|
}
|
|
42
|
-
|
|
43
|
-
function resolveHomeDir(options: CodexOmoConfigOptions): string {
|
|
44
|
-
const env = options.env ?? process.env
|
|
45
|
-
return options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir()
|
|
46
|
-
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { existsSync } from "node:fs"
|
|
2
|
+
import { posix, win32 } from "node:path"
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
runMigrations,
|
|
6
|
+
type LoadedMigrationSource,
|
|
7
|
+
type MigrationBoundary,
|
|
8
|
+
type MigrationClock,
|
|
9
|
+
type MigrationEnvironment,
|
|
10
|
+
type MigrationFileSystem,
|
|
11
|
+
type MigrationPlan,
|
|
12
|
+
type MigrationRunResult,
|
|
13
|
+
type MigrationTransformResult,
|
|
14
|
+
} from "../../../../omo-config-core/src/index.ts"
|
|
15
|
+
|
|
16
|
+
const MIGRATION_ID = "2026-07-codex-config-jsonc"
|
|
17
|
+
const OMO_SCHEMA_URL = "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/omo.schema.json"
|
|
18
|
+
|
|
19
|
+
type DiscoveryFileSystem = {
|
|
20
|
+
readonly existsSync: (path: string) => boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type PathOperations = {
|
|
24
|
+
readonly join: (...paths: string[]) => string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type CodexConfigMigrationOptions = {
|
|
28
|
+
readonly backupTimestamp?: string
|
|
29
|
+
readonly clock?: MigrationClock
|
|
30
|
+
readonly cwd: string
|
|
31
|
+
readonly discoveryFileSystem?: DiscoveryFileSystem
|
|
32
|
+
readonly env?: MigrationEnvironment
|
|
33
|
+
readonly environment?: Readonly<Record<string, string | undefined>>
|
|
34
|
+
readonly fileSystem?: MigrationFileSystem
|
|
35
|
+
readonly homeDir?: string
|
|
36
|
+
readonly isProcessAlive?: (pid: number) => boolean
|
|
37
|
+
readonly onBoundary?: (boundary: MigrationBoundary) => void
|
|
38
|
+
readonly pathOperations?: PathOperations
|
|
39
|
+
readonly pid?: number
|
|
40
|
+
readonly platform?: NodeJS.Platform
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type CodexConfigMigrationResult = {
|
|
44
|
+
readonly error?: string
|
|
45
|
+
readonly journalResumed: boolean
|
|
46
|
+
readonly migratedFrom: readonly string[]
|
|
47
|
+
readonly results: readonly MigrationRunResult[]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
51
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function recordAt(value: Readonly<Record<string, unknown>>, key: string): Record<string, unknown> | undefined {
|
|
55
|
+
const candidate = value[key]
|
|
56
|
+
return isRecord(candidate) ? candidate : undefined
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function migrationHistory(sources: readonly LoadedMigrationSource[], configPath: string): Record<string, readonly string[]> {
|
|
60
|
+
const history: string[] = []
|
|
61
|
+
for (const source of sources) {
|
|
62
|
+
if (!isRecord(source.value)) continue
|
|
63
|
+
for (const key of ["_migrations", "appliedMigrations"]) {
|
|
64
|
+
const values = source.value[key]
|
|
65
|
+
if (!Array.isArray(values)) continue
|
|
66
|
+
for (const value of values) {
|
|
67
|
+
if (typeof value === "string" && !history.includes(value)) history.push(value)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return history.length === 0 ? {} : { [configPath]: history }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function transformConfigJsonc(configPath: string, sources: readonly LoadedMigrationSource[]): MigrationTransformResult {
|
|
75
|
+
const config = sources.find((source) => source.path === configPath)
|
|
76
|
+
const legacy = config === undefined || !isRecord(config.value) ? {} : config.value
|
|
77
|
+
const omo = recordAt(legacy, "[omo]")
|
|
78
|
+
const senpi = recordAt(legacy, "[senpi]")
|
|
79
|
+
const history = migrationHistory(sources, configPath)
|
|
80
|
+
return {
|
|
81
|
+
diagnostics: omo !== undefined && senpi !== undefined
|
|
82
|
+
? ["conflict: [senpi] legacy [omo] kept [senpi]"]
|
|
83
|
+
: [],
|
|
84
|
+
document: {
|
|
85
|
+
$schema: OMO_SCHEMA_URL,
|
|
86
|
+
...(recordAt(legacy, "codegraph") === undefined ? {} : { codegraph: recordAt(legacy, "codegraph") }),
|
|
87
|
+
...(recordAt(legacy, "[opencode]") === undefined ? {} : { "[opencode]": recordAt(legacy, "[opencode]") }),
|
|
88
|
+
...(recordAt(legacy, "[codex]") === undefined ? {} : { "[codex]": recordAt(legacy, "[codex]") }),
|
|
89
|
+
...(senpi === undefined && omo === undefined ? {} : { "[senpi]": senpi ?? omo }),
|
|
90
|
+
...(Object.keys(history).length === 0 ? {} : { legacy_migrations: history }),
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function timestamp(value: string | undefined): string {
|
|
96
|
+
return value ?? new Date().toISOString().replace(/[:.]/g, "-")
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function sourceExists(options: CodexConfigMigrationOptions, path: string): boolean {
|
|
100
|
+
return (options.discoveryFileSystem ?? options.fileSystem ?? { existsSync }).existsSync(path)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function migrationPlan(homeDir: string, options: CodexConfigMigrationOptions): MigrationPlan | undefined {
|
|
104
|
+
const platform = options.platform ?? process.platform
|
|
105
|
+
const paths = options.pathOperations ?? (platform === "win32" ? win32 : posix)
|
|
106
|
+
const configPath = paths.join(homeDir, ".omo", "config.jsonc")
|
|
107
|
+
const sidecarPath = `${configPath}.migrations.json`
|
|
108
|
+
const sourcePaths = [configPath, sidecarPath].filter((path) => sourceExists(options, path))
|
|
109
|
+
if (sourcePaths.length === 0) return undefined
|
|
110
|
+
const backupRoot = paths.join(homeDir, ".omo", `migration-backup-${timestamp(options.backupTimestamp)}-opencode-config`, ".omo")
|
|
111
|
+
return {
|
|
112
|
+
id: MIGRATION_ID,
|
|
113
|
+
sources: sourcePaths.map((path) => ({
|
|
114
|
+
backupPath: paths.join(backupRoot, path === configPath ? "config.jsonc" : "config.jsonc.migrations.json"),
|
|
115
|
+
path,
|
|
116
|
+
})),
|
|
117
|
+
targetPath: paths.join(homeDir, ".omo", "omo.jsonc"),
|
|
118
|
+
transform: (sources) => transformConfigJsonc(configPath, sources),
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function migratedSources(results: readonly MigrationRunResult[]): readonly string[] {
|
|
123
|
+
return [...new Set(results.flatMap((result) => result.status === "migrated"
|
|
124
|
+
? result.preview?.backupMoves.map((move) => move.from) ?? []
|
|
125
|
+
: []))].sort()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function runCodexConfigMigration(options: CodexConfigMigrationOptions): CodexConfigMigrationResult {
|
|
129
|
+
const environment = options.environment ?? process.env
|
|
130
|
+
const homeDir = options.homeDir ?? environment["HOME"] ?? environment["USERPROFILE"]
|
|
131
|
+
if (homeDir === undefined || homeDir.length === 0) {
|
|
132
|
+
return { error: "Cannot migrate configuration because no home directory is available", journalResumed: false, migratedFrom: [], results: [] }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const batch = runMigrations({
|
|
137
|
+
...(options.clock === undefined ? {} : { clock: options.clock }),
|
|
138
|
+
discover: () => {
|
|
139
|
+
const plan = migrationPlan(homeDir, options)
|
|
140
|
+
return plan === undefined ? [] : [plan]
|
|
141
|
+
},
|
|
142
|
+
...(options.env === undefined ? { env: { HOME: homeDir } } : { env: options.env }),
|
|
143
|
+
...(options.fileSystem === undefined ? {} : { fileSystem: options.fileSystem }),
|
|
144
|
+
...(options.isProcessAlive === undefined ? {} : { isProcessAlive: options.isProcessAlive }),
|
|
145
|
+
...(options.onBoundary === undefined ? {} : { onBoundary: options.onBoundary }),
|
|
146
|
+
...(options.pid === undefined ? {} : { pid: options.pid }),
|
|
147
|
+
})
|
|
148
|
+
return {
|
|
149
|
+
...(batch.status === "locked" ? { error: "Configuration migration is already running" } : {}),
|
|
150
|
+
journalResumed: batch.journalResumed,
|
|
151
|
+
migratedFrom: migratedSources(batch.results),
|
|
152
|
+
results: batch.results,
|
|
153
|
+
}
|
|
154
|
+
} catch (error) {
|
|
155
|
+
return {
|
|
156
|
+
error: error instanceof Error ? error.message : String(error),
|
|
157
|
+
journalResumed: false,
|
|
158
|
+
migratedFrom: [],
|
|
159
|
+
results: [],
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|