This document serves as the master execution plan for verifying and finalizing the project.
-
Step 1: Environment Verification
- Verify
package.jsondependencies match requirements (MASTRA, AI SDK, Zod, etc.). - Check
tsconfig.jsonfor strict mode settings. - Verify
.envfile exists and contains necessary keys (or use.env.example). - Ensure
data/stateanddata/processeddirectories exist (or are created by code). - Verification: Run
npm installand ensure no peer dependency warnings. Runnpm run build(if script exists, elsetsc) to check for compilation errors.
- Verify
-
Step 2: Documentation Integrity Check
- Verify
docs/schemasmatchessrc/schemasimplementations 1:1. - Confirm
AGENTS.mdaccurately reflects the current architecture. - Check
docs/opensips-llm-extraction-prompts.mdcontains prompts for all document types. - Verification: Manual cross-check of one schema (e.g.,
modules.schema.ts) against its markdown doc.
- Verify
-
Step 3: Base & Shared Schemas
- Verify
src/schemas/base.schema.tsexportsBaseDocumentSchema. - Verify
src/schemas/collection-state.schema.tsmatches state management design. - Verify
src/schemas/consolidated.schema.tsstructure. - Verification: Run existing unit test
tests/unit/schemas/module.schema.test.ts.
- Verify
-
Step 4: Core Documentation Schemas
- Audit
src/schemas/core/*.tsfiles (12 types). - Ensure all 12 types (variables, functions, parameters, etc.) are exported in
src/schemas/index.ts. - Verification: Create a temporary test script that imports all core schemas and successfully parses a dummy object for each.
- Audit
-
Step 5: Module & Guide Schemas
- Verify
src/schemas/modules.schema.tshandles nested objects (params, functions). - Verify
src/schemas/guides.schema.tscovers all 3 guide types. - Verification: Run
npx ts-node -e "import { ModuleDocumentSchema } from './src/schemas/modules.schema'; console.log('Module Schema Valid');"
- Verify
-
Step 6: State Service
- Verify
src/services/state.service.tsimplementsinit,save,markCompleted,logError. - Check file locking/atomicity logic (if any) or simple write safety.
- Verification: Run
tests/unit/services/state.service.test.ts.
- Verify
-
Step 7: File Service
- Verify
src/services/file.service.tspath resolution logic. - Ensure
writeDocumentJsonvalidates data before writing. - Verification: Create a unit test checking that
writeDocumentJsonwrites to the correct pathdata/processed/{version}/{category}/{name}.json.
- Verify
-
Step 8: Fetcher & Converter Services
- Verify
src/services/fetcher.service.tshas rate limiting logic. - Verify
src/services/converter.service.tsuses Turndown correctly. - Verification: Create a test that mocks
fetchand asserts rate limiting delay, then checks HTML->MD conversion output.
- Verify
-
Step 9: LLM Provider Service
- Verify
src/services/llm.service.tssupports Google, OpenAI, Anthropic switching. - Check error handling and retry logic in
generate. - Verification: Create a test with a mocked provider response to ensure
generatereturns parsed JSON.
- Verify
-
Step 10: Fetch & Parse Tools
- Verify
src/tools/fetch-html.tool.tsusesFetcherService. - Verify
src/tools/parse-module-list.tool.tsuses Cheerio correctly. - Verification: Run a script executing
parseModuleListToolwith a sample HTML snippet containing module links.
- Verify
-
Step 11: Extraction Tools
- Verify
src/tools/extract-with-llm.tool.tsintegration withdoc-extractor.agent.ts. - Check prompt injection mechanism from
docs/opensips-llm-extraction-prompts.md. - Verification: Mock the LLM service and run
extractWithLlmToolto see if it calls the service with the correct prompt structure.
- Verify
-
Step 12: Output Tools
- Verify
src/tools/write-json.tool.tsandvalidate-schema.tool.ts. - Verify
src/tools/update-state.tool.ts. - Verification: Execute
writeJsonToolin a test script and confirm file creation.
- Verify
-
Step 13: Discovery Workflow
- Audit
src/workflows/discovery/discover-urls.workflow.ts. - Ensure it passes data correctly between steps (Fetch -> Parse -> Update State).
- Verification: Run the workflow with a mocked fetcher that returns a static module list page.
- Audit
-
Step 14: Module Extraction Workflow
- Audit
src/workflows/modules/extract-module.workflow.ts. - Check
extractWithLlmToolusage withModuleDocumentSchema. - Verification: Run the workflow with mocked inputs (single module) and verify state update to "completed".
- Audit
-
Step 15: Core Workflows (12 Types)
- Audit
src/workflows/core/core-workflows.ts(factory pattern usage). - Ensure all 12 workflows are correctly instantiated.
- Verification: Pick one core workflow (e.g.,
extractCoreVariablesWorkflow) and dry-run it with mocks.
- Audit
-
Step 16: Guide Workflows
- Audit
src/workflows/guides/guide-workflows.ts. - Verification: Dry-run
extractInstallGuideWorkflowwith mocks.
- Audit
-
Step 17: Output Workflows
- Audit
enhance-relationships.workflow.tsandconsolidate-mcp.workflow.ts. - Check that
consolidatereads from the correct paths. - Verification: Populate dummy data in
data/processedand runconsolidateMcpWorkflowto see if it generates a valid aggregated file.
- Audit
-
Step 18: CLI Entry Point
- Audit
src/index.ts. - Verify command parsing:
collect,status,retry,list. - Verification: Run
node dist/index.js --helpand check output.
- Audit
-
Step 19: Main Orchestrator Logic
- Check the
collectcommand logic insrc/index.ts. - Verify it initializes state -> runs discovery -> runs core (parallel) -> runs modules (loop) -> runs output.
- Verification: Run
collect --dry-run(if implemented) or use mocks to trace the execution path without making network calls.
- Check the
-
Step 20: Resilience & Recovery
- Verify that rerunning
collectresumes from state. - Verify
statuscommand reads correctly from state file. - Verification: Manually edit a state file to simulate a partial run, then run
collectand observe log output (should skip completed items).
- Verify that rerunning
-
Step 21: Integration Test Suite
- Create
tests/integration/full-run.test.ts. - Implement a full mock run of one module + one core doc.
- Verification:
npm testpasses all suites.
- Create
-
Step 22: Documentation Finalization
- Update
README.mdwith usage instructions based on final CLI. - Ensure
AGENTS.mdis up to date for future maintenance. - Verification: Review all markdown files for broken links or outdated info.
- Update
-
Step 23: Release Build
- Clean
dist/anddata/. - Run full build.
- Verification: Execute the built binary against a real (or mocked) target to ensure startup is error-free.
- Clean