Commit Graph

2 Commits

Author SHA1 Message Date
Magal abd758e7ee feat(adapter): add hierarchical summarization via --summarize flag (Story 3.3)
Adds --summarize flag to memtrace-adapter.mjs for token-budgeted
hierarchical summarization of get_impact blast radius responses:
- summarizeBlastRadius(): groups by directory prefix, extracts depth<=2
  critical dependents, builds module impact with top symbols, enforces
  <=2000 token budget via progressive while-loop trimming
- estimateTokens(): chars/4 * 1.15 buffer safety margin
- Cross-platform path support (/[\\\\/]/ regex), NaN/Infinity depth guards
- Non-object entry guards, JSON.stringify try/catch
- total_critical field added for count transparency

Workflow files updated to use --summarize flag:
- bmad-dev-story/SKILL.md step 5, bmad-quick-dev step files
- bmad-code-review and gds-code-review auditors check for --summarize

6 summarization tests added. 42/42 tests passing (adapter 20 +
qa-memtrace 10 + validate-dead-code 12).
2026-05-19 18:41:01 -03:00
Magal ffb430ed99 feat(adapter): implement MCP query adapter with get_impact, list_repos, and find_dead_code (Stories 3.1-3.2)
- Add memtrace-adapter.mjs: standalone Node.js MCP client over stdio
  with 10000ms timeout, MEMTRACE_MCP_ERROR_TIMEOUT token,
  structured JSON output matching qa-memtrace.mjs contract
- Support --query get_impact (blast radius), --query find_dead_code
  (dead code detection with repo_id + file_path scoping),
  --query list_repos (index freshness)
- Add 14 automated tests: 9 CLI arg handling + 5 MCP integration
- Update dev-story SKILL.md step 5 to use adapter for blast radius
  and dead-code queries, with empty-results skip for pitfall validation
- Update quick-dev step-03-implement and step-oneshot workflows
- Extend code-review acceptance auditors with adapter usage verification
  and dead-code adapter check
- Fix raw memtrace_get_impact reference in SKILL.md (review patch)
2026-05-19 17:50:32 -03:00