Feature/epic 14 refine prompt - #21
Conversation
- Introduced `AGENTS_REFINE.md` to be emitted after every `init` and `update`, serving as a planning-only handoff for users to tailor generated agent files to their workspace. - Updated CLI options to include `--no-refine-prompt` for skipping the emission of the refinement prompt. - Enhanced `README.md` to document the new refinement process and usage instructions for the emitted prompt. - Added tests to ensure the correct generation of `AGENTS_REFINE.md` and its contents based on the active agents. - Refactored generator logic to conditionally include the refinement prompt based on user preferences. This commit aims to improve user experience by providing a structured way to refine agent configurations post-initialization.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds a post-init/post-update refinement workflow: CLI opt-out flag, a new generator that emits Changes
Sequence DiagramsequenceDiagram
actor User
participant CLI as CLI<br/>(init/update)
participant Handler as Command<br/>Handler
participant Generator as generateAll()
participant RefineGen as generateRefinePrompt()
participant Template as EJS Template
participant FileSystem as Filesystem
User->>CLI: run init/update (+/− --no-refine-prompt)
CLI->>Handler: parse options & invoke
Handler->>Generator: generateAll(config, {refinePrompt})
rect rgba(100, 150, 200, 0.5)
Generator->>Generator: check refinePrompt != false
alt refinePrompt enabled
Generator->>RefineGen: call generateRefinePrompt()
RefineGen->>Template: render AGENTS_REFINE.md.ejs
Template-->>RefineGen: rendered markdown
RefineGen-->>Generator: GeneratedFile(AGENTS_REFINE.md)
Generator->>Generator: append to output files
end
end
Generator->>FileSystem: write generated files
Generator-->>Handler: return generated files
alt refinePrompt enabled
Handler->>User: print "Hand AGENTS_REFINE.md..." next-step message
else
Handler->>User: skip next-step message
end
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 4/5 reviews remaining, refill in 12 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
src/schema/stack-config.ts (1)
34-35: ⚡ Quick winRename schema constants to UPPER_SNAKE_CASE for guideline compliance.
safeStackValueandsafeStackValueNullableare module-level constants; please rename them to UPPER_SNAKE_CASE and update call sites.Proposed diff
-const safeStackValue = z.string().trim().min(1).max(100).regex(SAFE_STACK_VALUE_RE, SAFE_STACK_VALUE_MESSAGE); -const safeStackValueNullable = safeStackValue.nullable().default(null); +const SAFE_STACK_VALUE = z.string().trim().min(1).max(100).regex(SAFE_STACK_VALUE_RE, SAFE_STACK_VALUE_MESSAGE); +const SAFE_STACK_VALUE_NULLABLE = SAFE_STACK_VALUE.nullable().default(null); ... - language: safeStackValue, - runtime: safeStackValue, - framework: safeStackValueNullable, - uiLibrary: safeStackValueNullable, - stateManagement: safeStackValueNullable, - database: safeStackValueNullable, - auth: safeStackValueNullable, - i18nLibrary: safeStackValueNullable, + language: SAFE_STACK_VALUE, + runtime: SAFE_STACK_VALUE, + framework: SAFE_STACK_VALUE_NULLABLE, + uiLibrary: SAFE_STACK_VALUE_NULLABLE, + stateManagement: SAFE_STACK_VALUE_NULLABLE, + database: SAFE_STACK_VALUE_NULLABLE, + auth: SAFE_STACK_VALUE_NULLABLE, + i18nLibrary: SAFE_STACK_VALUE_NULLABLE, ... - packageManager: safeStackValue, + packageManager: SAFE_STACK_VALUE, ... - testFramework: safeStackValue, - testLibrary: safeStackValueNullable, - e2eFramework: safeStackValueNullable, - linter: safeStackValueNullable, - formatter: safeStackValueNullable, + testFramework: SAFE_STACK_VALUE, + testLibrary: SAFE_STACK_VALUE_NULLABLE, + e2eFramework: SAFE_STACK_VALUE_NULLABLE, + linter: SAFE_STACK_VALUE_NULLABLE, + formatter: SAFE_STACK_VALUE_NULLABLE,As per coding guidelines "Name module-level constants in UPPER_SNAKE_CASE".
Also applies to: 81-88, 92-92, 94-98
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/schema/stack-config.ts` around lines 34 - 35, Rename the module-level schema constants to UPPER_SNAKE_CASE: change safeStackValue → SAFE_STACK_VALUE and safeStackValueNullable → SAFE_STACK_VALUE_NULLABLE, update every usage/call-site accordingly, and apply the same renaming convention to the other module-level schema constants referenced in the file (the constants around lines 81–98) so they follow UPPER_SNAKE_CASE; ensure imports/exports and any references inside functions or validators are updated to the new names to avoid unresolved identifier errors.src/templates/refine/AGENTS_REFINE.md.ejs (1)
19-19: ⚡ Quick winMake Codex skill audit targets explicit in the generated target list
The mission says to audit both
.claude/agents/and.codex/skills/, but the explicit “Generated agent files to audit” list currently renders only Claude paths. Adding a Codex entry (or enumerated Codex paths) would remove ambiguity during execution.Suggested minimal clarification
Generated agent files to audit: @@ <% for (const path of claudeAgents) { -%> - `<%= path %>` <% } -%> +- All generated files under `.codex/skills/`.Also applies to: 48-52
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/templates/refine/AGENTS_REFINE.md.ejs` at line 19, Update the "Generated agent files to audit" list in the AGENTS_REFINE.md.ejs template to explicitly include Codex skill paths (e.g., add `.codex/skills/` or enumerate expected Codex files) in addition to the existing Claude paths so the audit target list is unambiguous; modify the list rendered at the current snippet (around the "Generated agent files to audit" text) and the other occurrence mentioned (lines ~48-52) to mirror this change, ensuring any template variables or loops that output the Claude entries also include the Codex entries or a separate Codex block.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@PRD.md`:
- Around line 2006-2008: The delivery snapshot table for "Epic 14 — Post-Init
Workspace Refinement Prompt" is inconsistent with the epic header marked DONE;
update the snapshot row for Epic 14 to reflect DONE status, change the "planned
— no template or generator yet" cell to indicate completed (e.g., "DONE —
template/generator implemented"), and ensure the branch column matches the
landed branch `feature/epic-14-refine-prompt` so the snapshot no longer
contradicts the epic header.
In `@src/cli/init-command.ts`:
- Line 213: The logged "next" instruction in init-command.ts is the only
numbered item; update the logger.info call that currently prints ' 4. Hand
AGENTS_REFINE.md to your agent to tailor the generated agent files to this
workspace.' (in the init command output) to remove the "4. " prefix so it
matches the surrounding plain-bullet "next:" lines—i.e., change the message to
start with the same indentation and text but without the numeric label so
formatting is consistent with the other messages.
In `@src/generator/generate-refine-prompt.ts`:
- Around line 22-25: The template render call for 'refine/AGENTS_REFINE.md.ejs'
currently receives only boolean agent flags via "agents: config.agents"; instead
compute and pass the actual generated agent path list (e.g., agentPaths or
generatedAgents) derived from the same logic that emits real outputs and include
it in the render context (for example alongside context and config.agents) so
the template can iterate concrete paths rather than booleans; update the
renderTemplate invocation in generate-refine-prompt.ts to pass that computed
array (name it something like generatedAgentPaths) and adjust the template to
consume that new variable.
In `@src/templates/refine/AGENTS_REFINE.md.ejs`:
- Line 35: The template unconditionally interpolates paths.utilsDir which can
produce "undefined" in output; update the AGENTS_REFINE.md.ejs fragment that
renders "Representative source files..." to guard the interpolation (like the
existing checks for paths.componentsDir) so you only append `, <%=
paths.utilsDir %>` when paths.utilsDir is truthy (e.g., wrap it in an if/`<% if
(paths.utilsDir) { %>...<% } %>` block).
---
Nitpick comments:
In `@src/schema/stack-config.ts`:
- Around line 34-35: Rename the module-level schema constants to
UPPER_SNAKE_CASE: change safeStackValue → SAFE_STACK_VALUE and
safeStackValueNullable → SAFE_STACK_VALUE_NULLABLE, update every usage/call-site
accordingly, and apply the same renaming convention to the other module-level
schema constants referenced in the file (the constants around lines 81–98) so
they follow UPPER_SNAKE_CASE; ensure imports/exports and any references inside
functions or validators are updated to the new names to avoid unresolved
identifier errors.
In `@src/templates/refine/AGENTS_REFINE.md.ejs`:
- Line 19: Update the "Generated agent files to audit" list in the
AGENTS_REFINE.md.ejs template to explicitly include Codex skill paths (e.g., add
`.codex/skills/` or enumerate expected Codex files) in addition to the existing
Claude paths so the audit target list is unambiguous; modify the list rendered
at the current snippet (around the "Generated agent files to audit" text) and
the other occurrence mentioned (lines ~48-52) to mirror this change, ensuring
any template variables or loops that output the Claude entries also include the
Codex entries or a separate Codex block.
🪄 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
Run ID: 7c26ff82-4973-4e8a-b1d4-7d472d43e3f7
📒 Files selected for processing (11)
PLAN.mdPRD.mdREADME.mdsrc/cli/index.tssrc/cli/init-command.tssrc/cli/update-command.tssrc/generator/generate-refine-prompt.tssrc/generator/index.tssrc/schema/stack-config.tssrc/templates/refine/AGENTS_REFINE.md.ejstests/generator/refine-prompt.test.ts
- Updated the `AGENTS_REFINE.md` template to reference generated agent files directly, enhancing clarity for users on which files to audit. - Modified the CLI output in `init-command.ts` to append a new unnumbered line for handing off `AGENTS_REFINE.md` to agents, improving user guidance. - Introduced a new function in `generate-agents.ts` to retrieve paths for generated agent files based on active configurations, streamlining the generation process. - Enhanced the refinement prompt generation to include target-specific agent paths, ensuring accurate representation of available agents based on user settings. - Updated tests to validate the correct generation of agent paths and the contents of `AGENTS_REFINE.md`, ensuring robust functionality. This commit aims to improve the user experience by providing clearer instructions and accurate references in the refinement process.
Summary by CodeRabbit
New Features
Documentation
Tests