Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Nov 27, 2025

Summary

Integrates Git commit history into the dev_plan context assembler, providing relevant commits alongside code snippets when planning issue implementation.

Changes

Types (packages/subagents/src/planner/context-types.ts)

  • Added RelatedCommit interface with:
    • hash: Short commit hash
    • subject: Commit subject line
    • author: Author name
    • date: ISO date string
    • filesChanged: List of changed files
    • issueRefs: Issue numbers referenced in commit
    • relevanceScore: Semantic similarity score
  • Added relatedCommits to ContextPackage
  • Added gitHistorySearchUsed to ContextMetadata
  • Added includeGitHistory and maxGitCommitResults to ContextAssemblyOptions

Context Assembler (packages/subagents/src/planner/utils/context-assembler.ts)

  • Added ContextAssemblyContext interface for flexible input
  • Implemented findRelatedCommits() using GitIndexer semantic search
  • Updated formatContextPackage() to include Related Commits section:
    • Shows commit hash, subject, author, date
    • Displays issue references
    • Truncates long file lists ("+N more")

Plan Adapter (packages/mcp-server/src/adapters/built-in/plan-adapter.ts)

  • Added gitIndexer config option
  • Added includeGitHistory parameter to tool schema
  • Passes context with gitIndexer to assembleContext()
  • Logs commit result count

MCP Server (packages/mcp-server/bin/dev-agent-mcp.ts)

  • Moved git indexer initialization before PlanAdapter
  • Passes gitIndexer to PlanAdapter config

Tests

  • Added 6 tests for git history integration:
    • Include commits when git indexer provided
    • Skip when disabled
    • Handle null git indexer
    • Handle search errors
    • Format commits in output
    • Truncate long file lists

Example Output

## Related Commits

- **\`abc123\`** feat: add authentication (refs: #42)
  - *developer* on 2025-01-15
  - Files: \`src/auth.ts\`, \`src/types.ts\`

- **\`def456\`** fix: token validation
  - *developer* on 2025-01-14
  - Files: \`src/auth.ts\`, \`src/utils.ts\`, \`src/config.ts\` +2 more

Closes

Closes #95

Part of

Epic: Intelligent Git History (v0.4.0) #90

🎉 This completes the v0.4.0 Epic! All 5 sub-issues are now done.

- Add RelatedCommit type with hash, subject, author, date, files, issueRefs
- Add relatedCommits to ContextPackage
- Add gitHistorySearchUsed to ContextMetadata
- Add includeGitHistory and maxGitCommitResults to ContextAssemblyOptions
- Implement findRelatedCommits using GitIndexer semantic search
- Add git commit section to formatContextPackage output
- Update PlanAdapter to pass gitIndexer to assembleContext
- Add includeGitHistory parameter to dev_plan tool
- Add 6 tests for git history integration
- Update plan-adapter tests for new signature

Closes #95
Part of Epic: Intelligent Git History (v0.4.0) #90
@prosdev prosdev merged commit be34613 into main Nov 27, 2025
1 check passed
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.

History integration in dev_plan

1 participant