Skip to content

Commit 8898ca6

Browse files
address gemini agent review feedback
1 parent 31f4ee0 commit 8898ca6

5 files changed

Lines changed: 27 additions & 8 deletions

File tree

src/commands/agent.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,17 @@ describe('runInstall — gemini managed-section: append (GEMINI.md exists, no se
14371437
expect(written).toContain('testsprite test run');
14381438
expect(capture.stdout.join('\n')).toContain('gemini');
14391439
expect(capture.stdout.join('\n')).toContain('section-installed');
1440+
1441+
await runInstall(
1442+
{ ...BASE_OPTS, target: ['gemini'], force: false },
1443+
{ cwd: CWD, fs: agentFs, ...deps },
1444+
);
1445+
1446+
const rewritten = store.get(geminiAbs)!;
1447+
expect(rewritten).toContain('# Project Instructions');
1448+
expect(rewritten).toContain('Keep existing Gemini CLI notes.');
1449+
expect(rewritten.split(TARGETS.gemini.managedSection!.begin).length - 1).toBe(1);
1450+
expect(rewritten.split(TARGETS.gemini.managedSection!.end).length - 1).toBe(1);
14401451
});
14411452
});
14421453

src/commands/agent.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export interface InstallResult {
324324
action: InstallAction;
325325
/**
326326
* Skill(s) this result covers. Own-file targets produce one result per skill
327-
* (`[skill]`); the codex managed-section target produces ONE result whose
327+
* (`[skill]`); managed-section targets produce ONE result whose
328328
* section aggregates every installed skill (`[...skills]`).
329329
*/
330330
skills: string[];
@@ -540,7 +540,7 @@ export async function runInstall(opts: InstallOptions, deps: AgentDeps = {}): Pr
540540
`[warn] ${relPath} will be ${wouldBeBytes} bytes after this write — ${managedConfig.loadBudgetLabel ?? `the target agent may not load content beyond its ${managedConfig.loadBudgetBytes} byte budget`}. Trim ${relPath} to stay within the limit.`,
541541
);
542542
}
543-
dryRunLines.push({ abs, bytes, note: 'managed section' });
543+
dryRunLines.push({ abs, bytes: wouldBeBytes, note: 'managed section' });
544544
results.push({ target: t, path: relPath, action: 'dry-run', skills: [...skills] });
545545
continue;
546546
}
@@ -762,9 +762,9 @@ export async function runList(opts: CommonOptions, deps: AgentDeps = {}): Promis
762762
const out = makeOutput(opts.output, deps);
763763

764764
// One row per (target × default skill). Own-file targets land each skill at a
765-
// distinct path; the codex managed-section target merges all skills into the
766-
// single AGENTS.md (so every codex row shares that path — truthful, since both
767-
// skills' content lands there).
765+
// distinct path; managed-section targets merge all skills into a single root
766+
// instruction file (so every managed-section row shares that path — truthful,
767+
// since both skills' content lands there).
768768
const results: ListResult[] = [];
769769
for (const [t, spec] of Object.entries(TARGETS) as [
770770
AgentTarget,

src/lib/agent-targets.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,4 +713,11 @@ describe('content integrity — gemini target (GEMINI.md managed-section body)',
713713
expect(result.content).not.toContain('name: testsprite-verify');
714714
expect(result.content).not.toContain('alwaysApply:');
715715
});
716+
717+
it('renderForTarget("gemini") supports the onboard managed-section contribution', () => {
718+
const result = renderForTarget('gemini', 'testsprite-onboard');
719+
expect(result.path).toBe('GEMINI.md');
720+
expect(result.content).toBe(ONBOARD_CODEX_LINE);
721+
expect(result.content).not.toContain('---');
722+
});
716723
});

src/lib/agent-targets.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ function wrapMdc(_name: string, description: string, body: string): string {
136136
/**
137137
* Repo-relative landing path for a given skill on a given target (POSIX
138138
* separators). Own-file targets embed the skill name in the path so multiple
139-
* skills coexist; the codex target always lands at the single shared `AGENTS.md`
140-
* (every skill's codex contribution is merged into one managed section there).
139+
* skills coexist; managed-section targets land at shared root instruction files
140+
* (`AGENTS.md` for codex, `GEMINI.md` for gemini), where every selected skill's
141+
* contribution is merged into one managed section.
141142
*/
142143
export function pathFor(target: AgentTarget, skill: string): string {
143144
switch (target) {

test/e2e/agent-install.e2e.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ describe('force overwrite with backup', () => {
334334
expect(parsed[0]!.action).toBe('updated');
335335

336336
// File must now equal canonical content
337-
const { content: canonical } = renderForTarget('claude');
337+
const { content: canonical } = renderForTarget('claude', 'testsprite-verify');
338338
expect(readFileSync(filePath, 'utf8')).toBe(canonical);
339339

340340
// .bak must hold the edited bytes

0 commit comments

Comments
 (0)