Skip to content

feat(agent): add Gemini CLI install target#57

Open
merlinsantiago982-cmd wants to merge 3 commits into
TestSprite:mainfrom
merlinsantiago982-cmd:feat/gemini-agent-target
Open

feat(agent): add Gemini CLI install target#57
merlinsantiago982-cmd wants to merge 3 commits into
TestSprite:mainfrom
merlinsantiago982-cmd:feat/gemini-agent-target

Conversation

@merlinsantiago982-cmd

@merlinsantiago982-cmd merlinsantiago982-cmd commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • add a gemini agent target that installs TestSprite guidance into GEMINI.md
  • generalize managed-section metadata so Codex and Gemini can each preserve user-authored root instruction files
  • update agent docs, help snapshots, and install/list coverage

Safety

  • GEMINI.md uses sentinel-delimited managed-section writes, so existing project instructions outside the TestSprite block are preserved
  • re-running install replaces only the TestSprite section

Tests

  • npm run format:check
  • npm run test -- src/lib/agent-targets.test.ts src/commands/agent.test.ts test/help.snapshot.test.ts
  • npm run typecheck
  • npm run lint
  • npm run build

Summary by CodeRabbit

  • New Features
    • Added support for the Gemini target across agent setup, install, and list.
    • Added skill selection for agent installs (including multi-skill installs) with updated install and list output details (now includes a skill column and skill-aware results).
  • Documentation
    • Updated Quickstart/Commands to list Gemini as a supported agent target.
    • Clarified testsprite test code get/put behavior and example outputs for Python-based generated test sources.
  • Tests
    • Expanded coverage for Gemini and multi-skill managed-section installs.

@coderabbitai

coderabbitai Bot commented Jun 30, 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: 67feb232-d19d-4095-839f-b64e8061b866

📥 Commits

Reviewing files that changed from the base of the PR and between 31f4ee0 and 8898ca6.

📒 Files selected for processing (5)
  • src/commands/agent.test.ts
  • src/commands/agent.ts
  • src/lib/agent-targets.test.ts
  • src/lib/agent-targets.ts
  • test/e2e/agent-install.e2e.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/lib/agent-targets.test.ts
  • src/commands/agent.ts
  • src/lib/agent-targets.ts
  • src/commands/agent.test.ts

📝 Walkthrough

Walkthrough

This PR generalizes agent target installation to a multi-skill registry, adds gemini managed-section support, updates install/list behavior to be skill-aware, and revises related tests and documentation.

Changes

Multi-skill agent registry and CLI

Layer / File(s) Summary
Skill registry and rendering core
src/lib/agent-targets.ts
Expands target and skill types, adds managed-section metadata, defines the multi-skill registry, and rewrites target rendering and path resolution for own-file and managed-section modes.
runInstall multi-skill handling
src/commands/agent.ts
Updates install option/result shapes, validates selected skills, builds managed sections from per-target sentinels, writes per-skill own files, and adds skill-aware list output and CLI wiring.
Agent target and command test updates
src/lib/agent-targets.test.ts, src/commands/agent.test.ts, test/e2e/agent-install.e2e.test.ts
Updates unit and command coverage for gemini, explicit skill arguments, multi-skill install/list flows, and path-safety and overwrite cases.
Documentation updates for gemini and Python test code
DOCUMENTATION.md, README.md
Updates onboarding and command docs to include gemini, and revises test code get/put descriptions and examples to use Python output and replacements.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

A rabbit hopped through skillful code,
With gemini paths along the road. 🐇
Two fluffy skills in one neat nest,
Managed sections passed the test.
Hop, hop—now lists can show the way,
And Python docs brighten the day.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a Gemini CLI install target for the agent.
Docstring Coverage ✅ Passed Docstring coverage is 81.25% which is sufficient. The required threshold is 80.00%.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/commands/agent.ts (1)

499-544: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Report the composed managed-file byte count in dry-run output.

Line 534 computes wouldBeBytes, but Line 543 still records bytes from only the managed section. For an append/replace into an existing AGENTS.md/GEMINI.md, the dry-run “would write” size under-reports the actual resulting file size.

Proposed fix
-        const bytes = Buffer.byteLength(section, 'utf8');
         let wouldBeContent = section;
@@
-        dryRunLines.push({ abs, bytes, note: 'managed section' });
+        dryRunLines.push({ abs, bytes: wouldBeBytes, note: 'managed section' });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/agent.ts` around lines 499 - 544, The dry-run output in the
agent command reports the wrong byte count because `dryRunLines.push` in
`src/commands/agent.ts` still uses `bytes` instead of the computed
`wouldBeBytes`. Update the dry-run record for the managed section so it reflects
the final composed file size after `classifySection`/`composeManagedFile` logic,
including append and replace cases. Keep the warning and result behavior
unchanged, but make the reported “would write” size match the actual post-write
content.
🧹 Nitpick comments (4)
src/commands/agent.ts (1)

325-330: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Generalize the managed-section comments beyond Codex.

Gemini now also uses managed-section mode, so these comments should describe “managed-section targets” rather than Codex specifically.

Proposed wording cleanup
-   * (`[skill]`); the codex managed-section target produces ONE result whose
+   * (`[skill]`); managed-section targets produce ONE result whose
    * section aggregates every installed skill (`[...skills]`).
-  // single AGENTS.md (so every codex row shares that path — truthful, since both
+  // single root instruction file (so managed-section rows share that path — truthful, since both

Also applies to: 764-767

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/agent.ts` around lines 325 - 330, The comments on the skill
result shape in agent.ts are too Codex-specific and should be generalized to
cover all managed-section targets. Update the documentation around the skills
field and the related managed-section comment block (including the matching
comment near the later section) so they refer to “managed-section targets”
instead of “Codex,” while keeping the behavior description about own-file
targets versus aggregated managed-section results.
src/commands/agent.test.ts (1)

1418-1440: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add Gemini repeat-install coverage for the managed block.

This new suite covers append, but the PR safety claim also depends on repeated Gemini installs replacing exactly one TestSprite block while preserving surrounding GEMINI.md content. Add a second run/assertion for exactly one begin/end sentinel and unchanged user text.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/agent.test.ts` around lines 1418 - 1440, The new Gemini append
test in runInstall only verifies the first install path, but it should also
cover repeat-install behavior for the managed section. Extend the existing
runInstall — gemini managed-section: append test to perform a second run with
the same target and assert that GEMINI.md still preserves the user content while
containing exactly one managed block bounded by
TARGETS.gemini.managedSection!.begin and TARGETS.gemini.managedSection!.end. Use
the existing runInstall, TARGETS.gemini.managedSection, and makeMemFs helpers to
confirm repeated installs replace the TestSprite block instead of duplicating
it.
src/lib/agent-targets.test.ts (1)

694-716: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a Gemini onboard rendering assertion.

The new Gemini target is installed with DEFAULT_SKILLS, but this suite only exercises Gemini with testsprite-verify. Add one test for testsprite-onboard so the shared GEMINI.md path and managed-section contribution stay covered.

Proposed test coverage
   it('renderForTarget("gemini") without body arg uses the managed-section asset', () => {
     const result = renderForTarget('gemini', 'testsprite-verify');
     expect(result.content).toContain('testsprite test run');
     expect(result.content).not.toContain('name: testsprite-verify');
     expect(result.content).not.toContain('alwaysApply:');
   });
+
+  it('renderForTarget("gemini") supports the onboard managed-section contribution', () => {
+    const result = renderForTarget('gemini', 'testsprite-onboard');
+    expect(result.path).toBe('GEMINI.md');
+    expect(result.content).toBe(ONBOARD_CODEX_LINE);
+    expect(result.content).not.toContain('---');
+  });
 });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/agent-targets.test.ts` around lines 694 - 716, Add a Gemini
onboarding coverage test in the existing renderForTarget("gemini") suite so the
shared GEMINI.md path is verified for testsprite-onboard as well as
testsprite-verify. Reuse renderForTarget and assert that the onboard target
resolves to GEMINI.md and includes the managed-section content expected from
DEFAULT_SKILLS, keeping the assertion alongside the current gemini
content-integrity tests.
src/lib/agent-targets.ts (1)

136-140: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Update pathFor docs to include Gemini’s shared path.

The comment still says only Codex lands in a shared root file, but gemini also ignores skill and returns GEMINI.md.

Proposed JSDoc tweak
- * skills coexist; the codex target always lands at the single shared `AGENTS.md`
- * (every skill's codex contribution is merged into one managed section there).
+ * skills coexist; managed-section targets land at shared root instruction files
+ * (`AGENTS.md` for codex, `GEMINI.md` for gemini), where every selected skill's
+ * contribution is merged into one managed section.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/agent-targets.ts` around lines 136 - 140, The JSDoc for pathFor is
outdated: it says only codex uses a shared root file, but gemini also ignores
the skill and maps to a single shared file. Update the comment near pathFor in
agent-targets.ts to mention both codex and gemini shared landing paths, and keep
the target-specific behavior clear for own-file targets.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/agent-targets.ts`:
- Around line 322-326: The remaining renderForTarget call site is still passing
only the target, so the missing second argument is being treated as the skill id
and causing the unknown skill failure. Update the call in the agent install e2e
test to pass both the AgentTarget and the intended skill string, matching the
new renderForTarget(t, skill, body?) signature and other call sites.

---

Outside diff comments:
In `@src/commands/agent.ts`:
- Around line 499-544: The dry-run output in the agent command reports the wrong
byte count because `dryRunLines.push` in `src/commands/agent.ts` still uses
`bytes` instead of the computed `wouldBeBytes`. Update the dry-run record for
the managed section so it reflects the final composed file size after
`classifySection`/`composeManagedFile` logic, including append and replace
cases. Keep the warning and result behavior unchanged, but make the reported
“would write” size match the actual post-write content.

---

Nitpick comments:
In `@src/commands/agent.test.ts`:
- Around line 1418-1440: The new Gemini append test in runInstall only verifies
the first install path, but it should also cover repeat-install behavior for the
managed section. Extend the existing runInstall — gemini managed-section: append
test to perform a second run with the same target and assert that GEMINI.md
still preserves the user content while containing exactly one managed block
bounded by TARGETS.gemini.managedSection!.begin and
TARGETS.gemini.managedSection!.end. Use the existing runInstall,
TARGETS.gemini.managedSection, and makeMemFs helpers to confirm repeated
installs replace the TestSprite block instead of duplicating it.

In `@src/commands/agent.ts`:
- Around line 325-330: The comments on the skill result shape in agent.ts are
too Codex-specific and should be generalized to cover all managed-section
targets. Update the documentation around the skills field and the related
managed-section comment block (including the matching comment near the later
section) so they refer to “managed-section targets” instead of “Codex,” while
keeping the behavior description about own-file targets versus aggregated
managed-section results.

In `@src/lib/agent-targets.test.ts`:
- Around line 694-716: Add a Gemini onboarding coverage test in the existing
renderForTarget("gemini") suite so the shared GEMINI.md path is verified for
testsprite-onboard as well as testsprite-verify. Reuse renderForTarget and
assert that the onboard target resolves to GEMINI.md and includes the
managed-section content expected from DEFAULT_SKILLS, keeping the assertion
alongside the current gemini content-integrity tests.

In `@src/lib/agent-targets.ts`:
- Around line 136-140: The JSDoc for pathFor is outdated: it says only codex
uses a shared root file, but gemini also ignores the skill and maps to a single
shared file. Update the comment near pathFor in agent-targets.ts to mention both
codex and gemini shared landing paths, and keep the target-specific behavior
clear for own-file targets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a616caba-7f61-492f-8194-260254a50514

📥 Commits

Reviewing files that changed from the base of the PR and between 15e95de and 31f4ee0.

⛔ Files ignored due to path filters (1)
  • test/__snapshots__/help.snapshot.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • DOCUMENTATION.md
  • README.md
  • src/commands/agent.test.ts
  • src/commands/agent.ts
  • src/lib/agent-targets.test.ts
  • src/lib/agent-targets.ts

Comment thread src/lib/agent-targets.ts
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