Skip to content

feat: Introduce /init command for generating agent collab file (AGENTS.md)#643

Open
yanurag-dev wants to merge 4 commits intotruffle-ai:mainfrom
yanurag-dev:feat/init-command
Open

feat: Introduce /init command for generating agent collab file (AGENTS.md)#643
yanurag-dev wants to merge 4 commits intotruffle-ai:mainfrom
yanurag-dev:feat/init-command

Conversation

@yanurag-dev
Copy link
Copy Markdown
Contributor

@yanurag-dev yanurag-dev commented Mar 6, 2026

Release Note

  • No release needed (docs/chore/test-only/private package)
  • Changeset added via pnpm changeset (select packages + bump)
    • Bump type: Patch / Minor / Major (choose patch for all if unsure)
    • Packages: ...

Summary by CodeRabbit

  • New Features

    • Added /init command to analyze the codebase and generate or improve AGENTS.md documentation.
  • Improvements

    • Unified prompt-command handling so non-streaming results follow the same streaming pipeline for consistent messaging and to avoid duplicate outputs.
    • Added an integration hook to allow external routing of prompt commands into the streaming flow.

…just command imports

- Removed redundant user message display for executed commands in OverlayContainer.
- Added handling for non-streaming commands to show user messages.
- Updated command import path in general-commands for consistency.
- Removed logging of command execution results in executeCommand function.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 6, 2026

@yanurag-dev is attempting to deploy a commit to the Shaunak's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0834c768-f719-4ff3-a7de-99ed358ea241

📥 Commits

Reviewing files that changed from the base of the PR and between 21090e4 and 9bd1057.

📒 Files selected for processing (2)
  • .changeset/sharp-trams-smash.md
  • packages/cli/src/index-main.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/cli/src/index-main.ts

📝 Walkthrough

Walkthrough

Removes a comment in the CLI config, adds an OverlayContainer prop to route prompt commands into the InputContainer pipeline, updates OverlayContainer callbacks, and introduces a new /init interactive command that creates or improves an AGENTS.md at the repository root. Also adds a changeset for @dexto/tui.

Changes

Cohort / File(s) Summary
CLI entry
packages/cli/src/index-main.ts
Minor comment removal around the enriched configuration's logLevel field; no behavioral change.
TUI overlay & routing
packages/tui/src/containers/OverlayContainer.tsx
Adds new prop onSubmitPromptCommand?: (commandText: string) => Promise<void>, routes non-streaming sendMessage results through that callback instead of local immediate emission, and updates related useCallback dependency arrays.
Interactive commands
packages/tui/src/interactive-commands/general-commands.ts
Adds a new init general command that builds a prompt asking the system to analyze the repo and create or improve AGENTS.md at process.cwd()/AGENTS.md, returning a send-message marker.
Changeset
.changeset/sharp-trams-smash.md
Adds a patch changeset for @dexto/tui describing the new /init command.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant OverlayContainer
  participant InputContainer
  participant StreamingPipeline

  User->>OverlayContainer: invoke command (e.g. /init)
  OverlayContainer->>OverlayContainer: determine result.type === 'sendMessage'
  alt onSubmitPromptCommand provided
    OverlayContainer->>InputContainer: call onSubmitPromptCommand(commandText)
    InputContainer->>StreamingPipeline: start streaming pipeline for prompt
    StreamingPipeline-->>InputContainer: stream tokens / events
    InputContainer-->>OverlayContainer: update UI with stream
  else fallback (no callback)
    OverlayContainer->>OverlayContainer: create local user message and append to UI
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I nibble code and send a ping,
A prompt now routed like a spring,
Init will scan the roots and write,
AGENTS.md to guide the light,
Hooray — I hop, and all connects! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing a new /init command for generating AGENTS.md, which aligns with all file modifications and the PR's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@yanurag-dev yanurag-dev changed the title feat: Introduc /init command for generating agent collab file feat: Introduce /init command for generating agent collab file (AGENTS.md) Mar 6, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli/src/index-main.ts`:
- Around line 840-853: The CLI's DEXTO_LOG_LEVEL parsing is only applied in the
top-level main path; extract that logic into a shared resolver function (e.g.,
resolveDextoLogLevel or getEnvLogLevel) and replace the inline parsing with a
call to it where you build agent config (the enrichAgentConfig call) and inside
bootstrapAgentFromGlobalOpts so both call sites use the same resolved logLevel
instead of hardcoded 'info'/'error'; ensure the resolver reads
process.env.DEXTO_LOG_LEVEL, normalizes to lowercase, validates against
['debug','info','warn','error'], and returns the validated level (default
'info') so enrichAgentConfig and bootstrapAgentFromGlobalOpts consume the same
value.

In `@packages/tui/src/containers/OverlayContainer.tsx`:
- Around line 1255-1263: The code routes the literal commandText to
onSubmitPromptCommand, which re-submits the slash command instead of the
resolved prompt; change the call to pass the resolved payload
(result.messageToSend) so the generated prompt is submitted: await
onSubmitPromptCommand(result.messageToSend). Also ensure the no-callback path is
not a no-op—if onSubmitPromptCommand is undefined, forward result.messageToSend
into the existing InputContainer send pipeline (the same flow used for normal
user messages) so the resolved prompt is processed even without a callback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d7958f9a-c074-40aa-acfe-aa77d1b8f490

📥 Commits

Reviewing files that changed from the base of the PR and between daaa4a1 and 21090e4.

📒 Files selected for processing (3)
  • packages/cli/src/index-main.ts
  • packages/tui/src/containers/OverlayContainer.tsx
  • packages/tui/src/interactive-commands/general-commands.ts

- Remove env var parsing from index-main.ts (factory.ts already handles DEXTO_LOG_LEVEL internally)
- Add changeset for /init command
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