Skip to content

feat: add Grok as a first-class Comet platform - #309

Open
mouyase wants to merge 2 commits into
rpamis:masterfrom
mouyase:feat/grok-platform
Open

feat: add Grok as a first-class Comet platform#309
mouyase wants to merge 2 commits into
rpamis:masterfrom
mouyase:feat/grok-platform

Conversation

@mouyase

@mouyase mouyase commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

✨ Summary

Add Grok as a first-class Comet host so comet init --platform grok installs Skills, the phase-guard Rule, and a Hook Router that Grok actually loads.

Grok scans .agents/skills natively, but its project hooks live under .grok/hooks/*.json and its native write tool is write (not Claude's Write). Without this platform, comet init --platform grok either duplicates Skills or writes hooks to a file Grok never reads, and --platform grok is rejected by the Router.

🎯 Scope

  • CLI commands (init, status, doctor, update)
  • Core installer / platform detection
  • Comet shell scripts (assets/skills/comet/scripts/)
  • Tests / CI
  • Documentation / changelog
  • Other:

What this does

  • Registers grok in PLATFORMS: project Skills share Codex's .agents root; rules go to .grok/rules/; hooks go to .grok/hooks/comet.json.
  • Adds grok to the Hook Router allowlist and treats Grok's write / search_replace payloads as writes.
  • Installs the Grok matcher as Write|Edit|write|search_replace so Grok's native write tool cannot bypass the phase guard.
  • Maps Superpowers to the existing Codex / .agents agent so Grok-only Classic installs still get Superpowers.
  • Reuses OpenSpec's codex tool id so Classic OpenSpec skills land in .agents.

🧪 Testing

  • pnpm build
  • pnpm lint
  • pnpm run lint:architecture
  • pnpm format:check
  • Targeted tests: detect, hook-adapter, platform-inspect, superpowers, bundle-platform, bundle-compatibility, cli-help, release-metadata
  • pnpm test — full suite was also run; remaining failures were /var vs /private/var and linked-worktree leakage from running inside a git worktree, unrelated to this platform
  • pnpm test -- test/domains/comet-classic/comet-scripts.test.ts

✅ Checklist

  • PR title follows Conventional Commits
  • User-facing behavior is documented in README.md / README-zh.md
  • CHANGELOG.md is updated
  • Version is 0.4.0-beta.19 (one step ahead of 0.4.0-beta.18 on master)

👀 Notes for Reviewers

Grok is Claude-hook compatible (exit 2 + stderr deny). The only Grok-specific hook difference is the matcher and the .grok/hooks/comet.json path. Skills are intentionally not copied into .grok/skills/ so a repo that already has Codex / .agents does not get a second Comet Skill tree.

Summary by Sourcery

Add Grok as a first-class Comet platform, wiring its skills, rules, and hooks into the CLI, router, and Native runtime, and updating docs, tests, and version metadata accordingly.

New Features:

  • Register Grok in the platform registry so Comet can install project skills under .agents and Grok-owned config under .grok.
  • Allow the Hook Router and hook guard to recognize Grok, treating its write and search_replace tools as guarded writes.
  • Map Grok to the Codex agent for Superpowers so Grok installs reuse the shared .agents skills tree.

Enhancements:

  • Adjust Claude-shaped hook matcher handling so platform-specific matchers (including Grok) can expand Write/Edit to cover native tool variants.
  • Normalize Grok hook input in the platform adapter so Grok’s write and search_replace tools are interpreted as write intents.

Build:

  • Bump package, lockfile, and assets manifest version to 0.4.0-beta.19 to release Grok platform support.

Documentation:

  • Update English and Chinese READMEs to list Grok as a supported platform using the shared .agents root.
  • Document Grok platform behavior and hook routing in the changelog for version 0.4.0-beta.19.

Tests:

  • Add platform detection, platform-inspect, hook adapter, bundle, superpowers, and doctor tests to cover Grok’s directories, rule paths, hook matcher, and platform count.
  • Update existing tests that assert platform counts and version numbers to reflect the addition of Grok and the new release version.

Summary by CodeRabbit

  • New Features
    • Added first-class Grok support across initialization, updates, diagnostics, and uninstall workflows.
    • Added Grok project skills, rules, hooks, configuration locations, and Router support for write and search_replace.
    • Added shared .agents/ Project Skills compatibility with Codex.
  • Documentation
    • Updated platform documentation to list 35 supported AI coding platforms, including Grok.
  • Release
    • Updated the release version to 0.4.0-beta.20.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @mouyase, your pull request is larger than the review limit of 150000 diff characters

@sourcery-ai

sourcery-ai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds Grok as a first-class Comet platform by registering it in the platform table, wiring its hook paths and matcher into the installer/inspector and hook adapter, mapping Grok to Codex’s shared .agents Skills and Superpowers agent, and updating tests and docs to reflect the new platform and version bump to 0.4.0-beta.19.

Sequence diagram for Grok hook installation with matcher resolution

sequenceDiagram
  participant CometInstaller
  participant ClaudeCodeHooks
  participant GrokPlatform

  CometInstaller->>GrokPlatform: installClaudeCodeHooks(context.platformId=grok)
  GrokPlatform->>ClaudeCodeHooks: buildHookCommand(baseDir,skillsDir,scriptRelPath,context)
  ClaudeCodeHooks->>ClaudeCodeHooks: resolveClaudeCodeHookMatcher(platformId,config.matcher)
  ClaudeCodeHooks->>ClaudeCodeHooks: group commands by matcher
  ClaudeCodeHooks-->>GrokPlatform: write hooks to .grok/hooks/comet.json
Loading

File-Level Changes

Change Details Files
Register Grok as a first-class platform with shared .agents Skills and Grok-owned config under .grok, including OpenSpec and Rule destinations.
  • Add a grok Platform entry in the PLATFORMS array with skillsDir .agents, config and rules under .grok, and claude-code hook format whose config file is hooks/comet.json.
  • Extend platform detection tests to assert Grok’s skills, config, rules, OpenSpec tool id and detection paths, and ensure detectPlatforms() recognizes .grok as the Grok indicator.
  • Teach platform-inspect tests to resolve Grok’s hookConfigPath to .grok/hooks/comet.json and Grok’s workflow guard rule path to .grok/rules/comet-workflow-guard.md.
platform/install/platforms.ts
test/platform/detect.test.ts
test/domains/skill/platform-inspect.test.ts
Ensure Grok’s hooks are installed and inspected correctly, with a matcher that covers Write, Edit, write and search_replace and router support for Grok payloads.
  • Introduce resolveClaudeCodeHookMatcher to override the matcher for platform grok from Write
Edit to Write
Wire Grok into the Comet Hook Router and Superpowers integrations, and update supported platform counts and documentation.
  • Add grok to COMET_HOOK_PLATFORM_IDS and extend WRITE_TOOL_NAMES to include searchreplace so router compatibility and write intent classification cover Grok’s native tools.
  • Map Grok to the Codex agent (codex) in SKILLS_AGENT_MAP so Superpowers installs for Grok reuse the .agents skill tree owned by Codex, and update tests to expect grok mapping and 34 platforms.
  • Update README and README-zh platform tables to list Grok as a Classic platform that uses the .agents root and adjust the supported platform count from 33 to 34.
  • Bump assets/manifest.json version from 0.4.0-beta.18 to 0.4.0-beta.19 and align package.json, package-lock, CLI help, bundle-platform, bundle-compatibility, and release-metadata tests with the new version and platform count.
domains/comet-entry/hook-adapter.ts
domains/integrations/superpowers.ts
test/domains/integrations/superpowers.test.ts
README.md
README-zh.md
assets/manifest.json
package.json
package-lock.json
test/app/cli-help.test.ts
test/domains/bundle/bundle-platform.test.ts
test/domains/bundle/comet-bundle-compatibility.test.ts
test/repository/release-metadata.test.ts
CHANGELOG.md
assets/skills/comet-native/scripts/comet-native-hook-guard.mjs
assets/skills/comet/scripts/comet-hook-router.mjs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 358b53f8-b374-46f4-950b-0436504bd011

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff42ff and 92d402a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (21)
  • CHANGELOG.md
  • README-zh.md
  • README.md
  • assets/manifest.json
  • assets/skills/comet-native/scripts/comet-native-hook-guard.mjs
  • assets/skills/comet-native/scripts/comet-native-runtime.mjs
  • assets/skills/comet/scripts/comet-hook-router.mjs
  • domains/comet-entry/hook-adapter.ts
  • domains/integrations/superpowers.ts
  • domains/skill/platform-inspect.ts
  • domains/skill/platform-install.ts
  • package.json
  • platform/install/platforms.ts
  • test/app/cli-help.test.ts
  • test/domains/bundle/bundle-platform.test.ts
  • test/domains/bundle/comet-bundle-compatibility.test.ts
  • test/domains/comet-entry/hook-adapter.test.ts
  • test/domains/integrations/superpowers.test.ts
  • test/domains/skill/platform-inspect.test.ts
  • test/platform/detect.test.ts
  • test/repository/release-metadata.test.ts
🚧 Files skipped from review as they are similar to previous changes (15)
  • test/domains/bundle/bundle-platform.test.ts
  • package.json
  • domains/comet-entry/hook-adapter.ts
  • domains/skill/platform-inspect.ts
  • test/domains/comet-entry/hook-adapter.test.ts
  • platform/install/platforms.ts
  • test/repository/release-metadata.test.ts
  • test/domains/bundle/comet-bundle-compatibility.test.ts
  • README-zh.md
  • assets/skills/comet/scripts/comet-hook-router.mjs
  • README.md
  • domains/skill/platform-install.ts
  • test/domains/integrations/superpowers.test.ts
  • CHANGELOG.md
  • test/platform/detect.test.ts

Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Grok becomes the 35th supported platform. The change adds Grok paths, detection, skills, rules, hooks, OpenSpec integration, tool matching, release metadata, documentation, generated assets, and tests.

Changes

Grok platform support

Layer / File(s) Summary
Register Grok platform
platform/install/platforms.ts, domains/integrations/superpowers.ts, test/platform/detect.test.ts, test/domains/integrations/superpowers.test.ts
Grok uses .agents project skills, .grok global configuration, Codex skills integration, rules, and Claude-compatible hooks. Detection and mapping tests cover the platform.
Integrate Grok hooks and tools
domains/comet-entry/hook-adapter.ts, domains/skill/platform-install.ts, domains/skill/platform-inspect.ts, test/domains/comet-entry/hook-adapter.test.ts, test/domains/skill/platform-inspect.test.ts
Grok hooks use `Write
Align release metadata and documentation
package.json, assets/manifest.json, CHANGELOG.md, README.md, README-zh.md, assets/skills/comet*/scripts/*, test/app/cli-help.test.ts, test/domains/bundle/*, test/repository/release-metadata.test.ts
The release advances to 0.4.0-beta.20. Documentation and tests update the supported-platform count from 34 to 35. Generated parser assets retain equivalent behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 92d40

The PR adds Grok platform support without any actionable merge-blocking risk remaining; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Grok
  participant HookAdapter
  participant PlatformInstall
  participant PlatformInspect
  Grok->>HookAdapter: send write or search_replace event
  HookAdapter->>PlatformInstall: normalize tool and target
  PlatformInstall->>PlatformInspect: install resolved hook matcher
  PlatformInspect-->>Grok: recognize managed hook
Loading

Possibly related PRs

  • rpamis/comet#227: Adds platform-target and installation infrastructure extended by this change.
  • rpamis/comet#284: Adds related hook support through shared platform installation and inspection logic.
  • rpamis/comet#197: Extends shared platform hook installation and inspection logic.

Suggested reviewers: benym

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding Grok as a first-class Comet platform.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@benym

benym commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Please first sync with the latest version of the master branch and resolve any code conflicts.

Install Grok Skills into the shared .agents root, keep rules and the Hook
Router under .grok, and recognize Grok's native write/search_replace tools.
@mouyase
mouyase force-pushed the feat/grok-platform branch from 4883bba to 92d402a Compare August 17, 2026 02:19
@mouyase

mouyase commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest master and resolved the conflicts.

  • Kept the current 0.4.0-beta.19 changelog entries
  • Moved the Grok platform addition to 0.4.0-beta.20
  • Regenerated the Hook Router / Native runtime bundles on the new master

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@rpamis rpamis deleted a comment from github-actions Bot Aug 17, 2026
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.

2 participants