Skip to content

feat: Codex host support#42

Merged
aanishs merged 2 commits intomainfrom
feat/codex-host-support
Apr 6, 2026
Merged

feat: Codex host support#42
aanishs merged 2 commits intomainfrom
feat/codex-host-support

Conversation

@aanishs
Copy link
Copy Markdown
Owner

@aanishs aanishs commented Apr 4, 2026

Summary

  • Add --host flag to setup script supporting both claude and codex targets
  • Codex gets its own skill directory (~/.codex/skills) with host-appropriate skill files
  • Three new test files: generation, setup, and smoke tests for the Codex path

Test plan

  • bun test test/codex-generation.test.ts
  • bun test test/codex-setup.test.ts
  • bun test test/codex-smoke.test.ts
  • ./setup --host codex installs to ~/.codex/skills/em-dash
  • ./setup --host claude still works as before

🤖 Generated with Claude Code

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 4, 2026

Greptile Summary

This PR adds Codex as a supported host target alongside the existing Claude Code path. The setup script gains a --host flag; --host codex migrates any direct Codex install, generates Codex-flavoured skill docs via gen-skill-docs.ts --host codex, builds a ~/.codex/skills/em-dash runtime root with symlinked assets, and links per-skill directories into ~/.codex/skills/. Three test files exercise the generator, the setup script integration, and an optional end-to-end smoke test.

All four issues flagged in the previous review round have been addressed:

  • gen-skill-docs.ts now parses --host codex, strips version: / allowed-tools: frontmatter fields, replaces .claude/ paths with .agents/ equivalents, and emits agents/openai.yaml per skill
  • CODEX_GENERATED_SKILLS_DIR is recomputed after migrate_direct_codex_install may have moved SOURCE_EMDASH_DIR
  • The unused emdash_dir parameter has been removed from link_codex_skill_dirs
  • The smoke test now forwards an isolated EMDASH_CODEX_OUTPUT_ROOT to prevent writes into the source tree

One minor issue remains: the dry-run stale-files error message in gen-skill-docs.ts always prints bun run gen:skill-docs regardless of the active host, leaving Codex users with the wrong regeneration command.

Confidence Score: 5/5

PR is safe to merge; all four previously-identified blocking issues are resolved and only a minor UX inaccuracy in the dry-run error message remains

All P1 findings from the prior review round are fully addressed. The sole remaining finding is a P2 UX issue where the dry-run stale-files error message omits --host codex, which does not affect correctness, data integrity, or the actual generation/linking logic.

scripts/gen-skill-docs.ts has the minor dry-run message inaccuracy noted above; no other files require special attention

Important Files Changed

Filename Overview
setup Adds --host codex path with migration, runtime root creation, skill linking, and CODEX_GENERATED_SKILLS_DIR recomputation after migration — all previous thread issues are addressed
scripts/gen-skill-docs.ts Implements --host codex: frontmatter stripping, path replacement, agents/openai.yaml emission, and Codex dry-run support; dry-run stale-files message omits --host codex
test/codex-generation.test.ts Four generation tests covering output files, frontmatter stripping, dry-run freshness, and empty-root dry-run, all with properly isolated temp dirs
test/codex-setup.test.ts Two setup integration tests (global and repo-local) with isolated HOME and EMDASH_CODEX_OUTPUT_ROOT env vars
test/codex-smoke.test.ts Optional end-to-end smoke test gated on CODEX_SMOKE=1; now correctly passes EMDASH_CODEX_OUTPUT_ROOT to avoid writing into the source tree
package.json Adds the three new Codex test files to the bun test suite so they run in CI

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[setup --host codex] --> B{migrate_direct_codex_install}
    B -->|moved SOURCE_EMDASH_DIR| C[Recompute CODEX_GENERATED_SKILLS_DIR]
    B -->|no migration needed| D[generate_codex_skill_docs]
    C --> D
    D --> E[bun run gen:skill-docs -- --host codex]
    E --> F[Write SKILL.md + agents/openai.yaml\ninto CODEX_OUTPUT_ROOT per skill]
    F --> G{CODEX_REPO_LOCAL?}
    G -->|yes: inside .agents/skills/| H[CODEX_SKILLS = .agents/skills]
    G -->|no: global install| I[create_codex_runtime_root\n~/.codex/skills/em-dash]
    H --> J[link_codex_skill_dirs]
    I --> J
    J --> K[Symlink each skill dir from CODEX_SKILLS]
    K --> L[em-dash ready - codex]
Loading

Reviews (4): Last reviewed commit: "fix: implement --host codex in gen-skill..." | Re-trigger Greptile

Comment thread setup
Comment thread setup
Comment thread setup
Comment thread test/codex-smoke.test.ts
aanishs and others added 2 commits April 6, 2026 00:00
Add --host flag to setup script supporting both Claude and Codex targets.
Codex gets its own skill directory (~/.codex/skills) with host-appropriate
skill files. Includes generation, setup, and smoke tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…sts to CI

- Implement Codex generation path in gen-skill-docs.ts: --host flag,
  frontmatter stripping, .claude→.codex/.agents path rewriting,
  agents/openai.yaml emission, dry-run support
- Fix stale CODEX_GENERATED_SKILLS_DIR after migrate_direct_codex_install
- Remove unused emdash_dir param from link_codex_skill_dirs
- Pass EMDASH_CODEX_OUTPUT_ROOT in smoke test to avoid source tree pollution
- Add codex test files to package.json test script

Addresses: P0 missing codex generator, P1 stale path after migration,
P1 tests not in CI, P2 smoke test pollution, P2 dead parameter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aanishs aanishs force-pushed the feat/codex-host-support branch from 160377d to 2f1d7c9 Compare April 6, 2026 07:01
@aanishs aanishs merged commit f8dbfb0 into main Apr 6, 2026
2 checks passed
@aanishs aanishs deleted the feat/codex-host-support branch April 6, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant