Skip to content

feat(acp): wire ACP validate_invest tool to invest.ts #147

Description

@paulbreuler

Problem

The ACP validate_invest tool in src/acp/tools.ts returns a hardcoded stub (score: 0) instead of calling validateInvest() from src/utils/invest.ts.

Current behavior

async validate_invest(req: { content: string }) {
  return { score: 0, warnings: ['INVEST validation not yet connected to document model'] };
}

Expected behavior

The tool accepts either raw markdown content or a taskId, parses frontmatter + body via gray-matter, runs validateInvest(frontmatter, body), and returns the full InvestReport.

Acceptance criteria

  • validate_invest({ content: string }) — parses content and returns real { score, criteria, warnings, pass }
  • validate_invest({ taskId: string }) — resolves the agent file from the DB, reads it, and validates
  • Returns structured errors when content is empty or unparseable
  • Matches the InvestReport type from src/documents/types.ts
  • Tests cover: valid agent, agent below threshold, missing sections

Files to modify

  • src/acp/tools.ts — replace stub with real validateInvest() call
  • src/acp/types.ts — update ValidateInvestRequest to accept taskId or content
  • tests/acp/tools.test.ts — add tests for real validation results

Related

  • src/utils/invest.tsvalidateInvest(frontmatter, body)InvestReport
  • src/documents/types.tsInvestReport interface

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions