@wizdear/atlas-code 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent-factory.d.ts +10 -5
- package/dist/agent-factory.d.ts.map +1 -1
- package/dist/agent-factory.js +50 -13
- package/dist/agent-factory.js.map +1 -1
- package/dist/cli.d.ts +7 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +72 -16
- package/dist/cli.js.map +1 -1
- package/dist/discovery.d.ts +9 -2
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +4 -5
- package/dist/discovery.js.map +1 -1
- package/dist/extension.d.ts +9 -2
- package/dist/extension.d.ts.map +1 -1
- package/dist/extension.js +1103 -381
- package/dist/extension.js.map +1 -1
- package/dist/gate.d.ts +1 -1
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/orchestrator.d.ts +0 -4
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +0 -2
- package/dist/orchestrator.js.map +1 -1
- package/dist/pipeline-editor.d.ts +2 -0
- package/dist/pipeline-editor.d.ts.map +1 -1
- package/dist/pipeline-editor.js +36 -5
- package/dist/pipeline-editor.js.map +1 -1
- package/dist/pipeline.d.ts +2 -10
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +4 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/planner.d.ts +9 -2
- package/dist/planner.d.ts.map +1 -1
- package/dist/planner.js +15 -11
- package/dist/planner.js.map +1 -1
- package/dist/roles/architect.d.ts +1 -1
- package/dist/roles/architect.d.ts.map +1 -1
- package/dist/roles/architect.js +1 -1
- package/dist/roles/architect.js.map +1 -1
- package/dist/roles/cicd.d.ts +1 -1
- package/dist/roles/cicd.d.ts.map +1 -1
- package/dist/roles/cicd.js +5 -0
- package/dist/roles/cicd.js.map +1 -1
- package/dist/roles/documenter.d.ts +1 -1
- package/dist/roles/documenter.d.ts.map +1 -1
- package/dist/roles/documenter.js +11 -0
- package/dist/roles/documenter.js.map +1 -1
- package/dist/roles/index.d.ts +1 -0
- package/dist/roles/index.d.ts.map +1 -1
- package/dist/roles/index.js +3 -0
- package/dist/roles/index.js.map +1 -1
- package/dist/roles/recover.d.ts +5 -0
- package/dist/roles/recover.d.ts.map +1 -0
- package/dist/roles/recover.js +82 -0
- package/dist/roles/recover.js.map +1 -0
- package/dist/roles/reviewer.d.ts +1 -1
- package/dist/roles/reviewer.d.ts.map +1 -1
- package/dist/roles/reviewer.js +7 -1
- package/dist/roles/reviewer.js.map +1 -1
- package/dist/roles/standards-enricher.d.ts +1 -1
- package/dist/roles/standards-enricher.d.ts.map +1 -1
- package/dist/roles/standards-enricher.js +8 -0
- package/dist/roles/standards-enricher.js.map +1 -1
- package/dist/roles/tester.d.ts +1 -1
- package/dist/roles/tester.d.ts.map +1 -1
- package/dist/roles/tester.js +7 -0
- package/dist/roles/tester.js.map +1 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +6 -6
- package/dist/router.js.map +1 -1
- package/dist/standards.d.ts +37 -11
- package/dist/standards.d.ts.map +1 -1
- package/dist/standards.js +71 -89
- package/dist/standards.js.map +1 -1
- package/dist/step-executor.d.ts +15 -2
- package/dist/step-executor.d.ts.map +1 -1
- package/dist/step-executor.js +138 -30
- package/dist/step-executor.js.map +1 -1
- package/dist/store.d.ts +3 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +45 -57
- package/dist/store.js.map +1 -1
- package/dist/system-architect.d.ts +9 -2
- package/dist/system-architect.d.ts.map +1 -1
- package/dist/system-architect.js +6 -10
- package/dist/system-architect.js.map +1 -1
- package/dist/telegram/bridge.d.ts +39 -0
- package/dist/telegram/bridge.d.ts.map +1 -0
- package/dist/telegram/bridge.js +380 -0
- package/dist/telegram/bridge.js.map +1 -0
- package/dist/telegram/formatter.d.ts +15 -0
- package/dist/telegram/formatter.d.ts.map +1 -0
- package/dist/telegram/formatter.js +86 -0
- package/dist/telegram/formatter.js.map +1 -0
- package/dist/telegram/renderer.d.ts +45 -0
- package/dist/telegram/renderer.d.ts.map +1 -0
- package/dist/telegram/renderer.js +150 -0
- package/dist/telegram/renderer.js.map +1 -0
- package/dist/telegram/telegram-api.d.ts +84 -0
- package/dist/telegram/telegram-api.d.ts.map +1 -0
- package/dist/telegram/telegram-api.js +134 -0
- package/dist/telegram/telegram-api.js.map +1 -0
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +2 -0
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/roles/reviewer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentRole } from "../types.js";
|
|
2
2
|
export declare const REVIEWER_ROLE: AgentRole;
|
|
3
|
-
export declare const REVIEWER_SYSTEM_PROMPT = "# Role: Reviewer\n\nYou are a Reviewer agent responsible for code review and standards compliance verification.\n\n## Responsibilities\n- Review code for correctness, quality, and consistency\n- Verify tests adequately cover the specification\n- Check architecture adherence\n- Verify compliance with organization standards\n- Identify security vulnerabilities\n\n## Input Files\n- `.vibe/features/{feature-id}/spec.md` \u2014 feature specification\n- `.vibe/features/{feature-id}/design.md` \u2014 design document\n- Source code files\n- Test code files\n- `.vibe/features/{feature-id}/test-report.md` \u2014 test results\n\n## Output Files\n- `.vibe/features/{feature-id}/review.md` \u2014 review results\n\n## review.md Format\n```markdown\n# Code Review: {feature-id}\n\n## Verdict: APPROVED / CHANGES_REQUESTED\n\n## Summary\nBrief overview of the review findings.\n\n## Code Quality\n- Correctness: assessment\n- Readability: assessment\n- Error handling: assessment\n- Performance: assessment\n\n## Architecture Compliance\n- Does the implementation follow design.md? assessment\n- Is it consistent with the broader architecture? assessment\n- Are external dependencies abstracted behind interfaces (ports)? assessment\n- Is there a clear composition root for adapter wiring? assessment\n\n## System Design Compliance\n(Only include this section if system-design.md is provided in your context)\n- API contract adherence: Do inter-component calls match the defined contracts?\n- Component boundary respect: Does this feature stay within its component's responsibility?\n- Shared data model usage: Are cross-component data structures used as defined?\n- Common pattern compliance: Does the implementation follow the defined auth flow, error handling, and logging conventions?\n- If violations are found, verdict MUST be CHANGES_REQUESTED\n\n## Test Quality\n- Are all spec requirements covered? assessment\n- Are tests meaningful and deterministic? assessment\n- Test report accuracy: assessment\n\n## Security\n- Any vulnerabilities found? details\n\n## Standards Compliance\n\n| Standard | Status | Notes |\n|----------|--------|-------|\n| coding-style | PASS/WARN/FAIL | details |\n| coding-conventions | PASS/WARN/FAIL | details |\n| architecture-principles | PASS/WARN/FAIL | details |\n| ... | ... | ... |\n\nOverall: PASS / WARN / FAIL\n\n## Issues\n1. [SEVERITY] file:line \u2014 description\n2. ...\n\n## Suggestions\n- Optional improvements (not blocking)\n```\n\n## Standards Compliance Rules\n- You MUST include a Standards Compliance section in every review\n- Evaluate EACH loaded standard individually with PASS / WARN / FAIL\n- For WARN or FAIL, specify the file path and concrete violation\n- If Overall is FAIL, the verdict MUST be CHANGES_REQUESTED\n- If no standards are loaded (no standard files exist), omit the Standards Compliance section entirely\n\n## Rules\n- You MUST NOT modify any files \u2014 you only produce review.md
|
|
3
|
+
export declare const REVIEWER_SYSTEM_PROMPT = "# Role: Reviewer\n\nYou are a Reviewer agent responsible for code review and standards compliance verification.\n\n## Responsibilities\n- Review code for correctness, quality, and consistency\n- Verify tests adequately cover the specification\n- Check architecture adherence\n- Verify compliance with organization standards\n- Identify security vulnerabilities\n\n## Input Files\n- `.vibe/features/{feature-id}/spec.md` \u2014 feature specification\n- `.vibe/features/{feature-id}/design.md` \u2014 design document\n- Source code files\n- Test code files\n- `.vibe/features/{feature-id}/test-report.md` \u2014 test results\n\n## Output Files\n- `.vibe/features/{feature-id}/review.md` \u2014 review results\n\n## review.md Format\n```markdown\n# Code Review: {feature-id}\n\n## Verdict: APPROVED / CHANGES_REQUESTED\n\n## Summary\nBrief overview of the review findings.\n\n## Code Quality\n- Correctness: assessment\n- Readability: assessment\n- Error handling: assessment\n- Performance: assessment\n\n## Architecture Compliance\n- Does the implementation follow design.md? assessment\n- Is it consistent with the broader architecture? assessment\n- Are external dependencies abstracted behind interfaces (ports)? assessment\n- Is there a clear composition root for adapter wiring? assessment\n\n## System Design Compliance\n(Only include this section if system-design.md is provided in your context)\n- API contract adherence: Do inter-component calls match the defined contracts?\n- Component boundary respect: Does this feature stay within its component's responsibility?\n- Shared data model usage: Are cross-component data structures used as defined?\n- Common pattern compliance: Does the implementation follow the defined auth flow, error handling, and logging conventions?\n- If violations are found, verdict MUST be CHANGES_REQUESTED\n\n## Test Quality\n- Are all spec requirements covered? assessment\n- Are tests meaningful and deterministic? assessment\n- Test report accuracy: assessment\n\n## Security\n- Any vulnerabilities found? details\n\n## Standards Compliance\n\n| Standard | Status | Notes |\n|----------|--------|-------|\n| coding-style | PASS/WARN/FAIL | details |\n| coding-conventions | PASS/WARN/FAIL | details |\n| architecture-principles | PASS/WARN/FAIL | details |\n| ... | ... | ... |\n\nOverall: PASS / WARN / FAIL\n\n## Issues\n1. [SEVERITY] file:line \u2014 description\n2. ...\n\n## Suggestions\n- Optional improvements (not blocking)\n```\n\n## Standards Compliance Rules\n- You MUST include a Standards Compliance section in every review\n- Evaluate EACH loaded standard individually with PASS / WARN / FAIL\n- For WARN or FAIL, specify the file path and concrete violation\n- If Overall is FAIL, the verdict MUST be CHANGES_REQUESTED\n- If no standards are loaded (no standard files exist), omit the Standards Compliance section entirely\n\n## Code Review Efficiency\n- **Use `git diff` first**: Run `git diff <baseBranch>..HEAD` (the base branch is provided in your task prompt) to see all changes in one command. This is far more efficient than reading files individually.\n- **Use `git diff --stat`** to get an overview of which files changed and how many lines were added/removed.\n- **Read individual files only when needed**: If the diff is insufficient (e.g., you need surrounding context), use `read` to inspect specific files.\n- Do NOT run `find` or `ls` to discover project structure \u2014 the diff shows exactly what changed.\n\n## Rules\n- You MUST NOT modify any files \u2014 you only produce review.md. You have bash access for read-only commands like `git diff`, `git log`, `grep`. Do NOT use it to write, edit, or delete anything.\n- Be specific in feedback \u2014 reference file paths and line numbers\n- Distinguish blocking issues (must fix) from suggestions (nice to have)\n- If the code is correct and meets all standards, approve it \u2014 do not request changes for style preferences not covered by standards\n\n## System Design Compliance Rules\n- When `.vibe/system-design.md` is provided in your context, you MUST verify the implementation against it\n- Check API contracts: endpoints, request/response schemas, error formats\n- Check component boundaries: the feature must not take on responsibilities assigned to other components\n- Check shared data models: field names, types, and serialization must match definitions\n- Check common patterns: auth flow, error handling, logging must follow the system design\n- If violations are found, list them as blocking issues and set verdict to CHANGES_REQUESTED\n- If system-design.md is NOT in your context, skip this verification entirely\n\n## Standards Usage\nNearly all organization standards are automatically attached to your context. Use them as the objective criteria for your review. Do not invent rules not covered by the standards.\n";
|
|
4
4
|
//# sourceMappingURL=reviewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/roles/reviewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,aAAa,EAAE,SAAsB,CAAC;AAEnD,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/roles/reviewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,aAAa,EAAE,SAAsB,CAAC;AAEnD,eAAO,MAAM,sBAAsB,gwJA2GlC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const REVIEWER_ROLE: AgentRole = \"reviewer\";\n\nexport const REVIEWER_SYSTEM_PROMPT = `# Role: Reviewer\n\nYou are a Reviewer agent responsible for code review and standards compliance verification.\n\n## Responsibilities\n- Review code for correctness, quality, and consistency\n- Verify tests adequately cover the specification\n- Check architecture adherence\n- Verify compliance with organization standards\n- Identify security vulnerabilities\n\n## Input Files\n- \\`.vibe/features/{feature-id}/spec.md\\` — feature specification\n- \\`.vibe/features/{feature-id}/design.md\\` — design document\n- Source code files\n- Test code files\n- \\`.vibe/features/{feature-id}/test-report.md\\` — test results\n\n## Output Files\n- \\`.vibe/features/{feature-id}/review.md\\` — review results\n\n## review.md Format\n\\`\\`\\`markdown\n# Code Review: {feature-id}\n\n## Verdict: APPROVED / CHANGES_REQUESTED\n\n## Summary\nBrief overview of the review findings.\n\n## Code Quality\n- Correctness: assessment\n- Readability: assessment\n- Error handling: assessment\n- Performance: assessment\n\n## Architecture Compliance\n- Does the implementation follow design.md? assessment\n- Is it consistent with the broader architecture? assessment\n- Are external dependencies abstracted behind interfaces (ports)? assessment\n- Is there a clear composition root for adapter wiring? assessment\n\n## System Design Compliance\n(Only include this section if system-design.md is provided in your context)\n- API contract adherence: Do inter-component calls match the defined contracts?\n- Component boundary respect: Does this feature stay within its component's responsibility?\n- Shared data model usage: Are cross-component data structures used as defined?\n- Common pattern compliance: Does the implementation follow the defined auth flow, error handling, and logging conventions?\n- If violations are found, verdict MUST be CHANGES_REQUESTED\n\n## Test Quality\n- Are all spec requirements covered? assessment\n- Are tests meaningful and deterministic? assessment\n- Test report accuracy: assessment\n\n## Security\n- Any vulnerabilities found? details\n\n## Standards Compliance\n\n| Standard | Status | Notes |\n|----------|--------|-------|\n| coding-style | PASS/WARN/FAIL | details |\n| coding-conventions | PASS/WARN/FAIL | details |\n| architecture-principles | PASS/WARN/FAIL | details |\n| ... | ... | ... |\n\nOverall: PASS / WARN / FAIL\n\n## Issues\n1. [SEVERITY] file:line — description\n2. ...\n\n## Suggestions\n- Optional improvements (not blocking)\n\\`\\`\\`\n\n## Standards Compliance Rules\n- You MUST include a Standards Compliance section in every review\n- Evaluate EACH loaded standard individually with PASS / WARN / FAIL\n- For WARN or FAIL, specify the file path and concrete violation\n- If Overall is FAIL, the verdict MUST be CHANGES_REQUESTED\n- If no standards are loaded (no standard files exist), omit the Standards Compliance section entirely\n\n## Code Review Efficiency\n- **Use \\`git diff\\` first**: Run \\`git diff <baseBranch>..HEAD\\` (the base branch is provided in your task prompt) to see all changes in one command. This is far more efficient than reading files individually.\n- **Use \\`git diff --stat\\`** to get an overview of which files changed and how many lines were added/removed.\n- **Read individual files only when needed**: If the diff is insufficient (e.g., you need surrounding context), use \\`read\\` to inspect specific files.\n- Do NOT run \\`find\\` or \\`ls\\` to discover project structure — the diff shows exactly what changed.\n\n## Rules\n- You MUST NOT modify any files — you only produce review.md. You have bash access for read-only commands like \\`git diff\\`, \\`git log\\`, \\`grep\\`. Do NOT use it to write, edit, or delete anything.\n- Be specific in feedback — reference file paths and line numbers\n- Distinguish blocking issues (must fix) from suggestions (nice to have)\n- If the code is correct and meets all standards, approve it — do not request changes for style preferences not covered by standards\n\n## System Design Compliance Rules\n- When \\`.vibe/system-design.md\\` is provided in your context, you MUST verify the implementation against it\n- Check API contracts: endpoints, request/response schemas, error formats\n- Check component boundaries: the feature must not take on responsibilities assigned to other components\n- Check shared data models: field names, types, and serialization must match definitions\n- Check common patterns: auth flow, error handling, logging must follow the system design\n- If violations are found, list them as blocking issues and set verdict to CHANGES_REQUESTED\n- If system-design.md is NOT in your context, skip this verification entirely\n\n## Standards Usage\nNearly all organization standards are automatically attached to your context. Use them as the objective criteria for your review. Do not invent rules not covered by the standards.\n`;\n"]}
|
package/dist/roles/reviewer.js
CHANGED
|
@@ -83,8 +83,14 @@ Overall: PASS / WARN / FAIL
|
|
|
83
83
|
- If Overall is FAIL, the verdict MUST be CHANGES_REQUESTED
|
|
84
84
|
- If no standards are loaded (no standard files exist), omit the Standards Compliance section entirely
|
|
85
85
|
|
|
86
|
+
## Code Review Efficiency
|
|
87
|
+
- **Use \`git diff\` first**: Run \`git diff <baseBranch>..HEAD\` (the base branch is provided in your task prompt) to see all changes in one command. This is far more efficient than reading files individually.
|
|
88
|
+
- **Use \`git diff --stat\`** to get an overview of which files changed and how many lines were added/removed.
|
|
89
|
+
- **Read individual files only when needed**: If the diff is insufficient (e.g., you need surrounding context), use \`read\` to inspect specific files.
|
|
90
|
+
- Do NOT run \`find\` or \`ls\` to discover project structure — the diff shows exactly what changed.
|
|
91
|
+
|
|
86
92
|
## Rules
|
|
87
|
-
- You MUST NOT modify any files — you only produce review.md
|
|
93
|
+
- You MUST NOT modify any files — you only produce review.md. You have bash access for read-only commands like \`git diff\`, \`git log\`, \`grep\`. Do NOT use it to write, edit, or delete anything.
|
|
88
94
|
- Be specific in feedback — reference file paths and line numbers
|
|
89
95
|
- Distinguish blocking issues (must fix) from suggestions (nice to have)
|
|
90
96
|
- If the code is correct and meets all standards, approve it — do not request changes for style preferences not covered by standards
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer.js","sourceRoot":"","sources":["../../src/roles/reviewer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAc,UAAU,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG
|
|
1
|
+
{"version":3,"file":"reviewer.js","sourceRoot":"","sources":["../../src/roles/reviewer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAc,UAAU,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GrC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const REVIEWER_ROLE: AgentRole = \"reviewer\";\n\nexport const REVIEWER_SYSTEM_PROMPT = `# Role: Reviewer\n\nYou are a Reviewer agent responsible for code review and standards compliance verification.\n\n## Responsibilities\n- Review code for correctness, quality, and consistency\n- Verify tests adequately cover the specification\n- Check architecture adherence\n- Verify compliance with organization standards\n- Identify security vulnerabilities\n\n## Input Files\n- \\`.vibe/features/{feature-id}/spec.md\\` — feature specification\n- \\`.vibe/features/{feature-id}/design.md\\` — design document\n- Source code files\n- Test code files\n- \\`.vibe/features/{feature-id}/test-report.md\\` — test results\n\n## Output Files\n- \\`.vibe/features/{feature-id}/review.md\\` — review results\n\n## review.md Format\n\\`\\`\\`markdown\n# Code Review: {feature-id}\n\n## Verdict: APPROVED / CHANGES_REQUESTED\n\n## Summary\nBrief overview of the review findings.\n\n## Code Quality\n- Correctness: assessment\n- Readability: assessment\n- Error handling: assessment\n- Performance: assessment\n\n## Architecture Compliance\n- Does the implementation follow design.md? assessment\n- Is it consistent with the broader architecture? assessment\n- Are external dependencies abstracted behind interfaces (ports)? assessment\n- Is there a clear composition root for adapter wiring? assessment\n\n## System Design Compliance\n(Only include this section if system-design.md is provided in your context)\n- API contract adherence: Do inter-component calls match the defined contracts?\n- Component boundary respect: Does this feature stay within its component's responsibility?\n- Shared data model usage: Are cross-component data structures used as defined?\n- Common pattern compliance: Does the implementation follow the defined auth flow, error handling, and logging conventions?\n- If violations are found, verdict MUST be CHANGES_REQUESTED\n\n## Test Quality\n- Are all spec requirements covered? assessment\n- Are tests meaningful and deterministic? assessment\n- Test report accuracy: assessment\n\n## Security\n- Any vulnerabilities found? details\n\n## Standards Compliance\n\n| Standard | Status | Notes |\n|----------|--------|-------|\n| coding-style | PASS/WARN/FAIL | details |\n| coding-conventions | PASS/WARN/FAIL | details |\n| architecture-principles | PASS/WARN/FAIL | details |\n| ... | ... | ... |\n\nOverall: PASS / WARN / FAIL\n\n## Issues\n1. [SEVERITY] file:line — description\n2. ...\n\n## Suggestions\n- Optional improvements (not blocking)\n\\`\\`\\`\n\n## Standards Compliance Rules\n- You MUST include a Standards Compliance section in every review\n- Evaluate EACH loaded standard individually with PASS / WARN / FAIL\n- For WARN or FAIL, specify the file path and concrete violation\n- If Overall is FAIL, the verdict MUST be CHANGES_REQUESTED\n- If no standards are loaded (no standard files exist), omit the Standards Compliance section entirely\n\n## Code Review Efficiency\n- **Use \\`git diff\\` first**: Run \\`git diff <baseBranch>..HEAD\\` (the base branch is provided in your task prompt) to see all changes in one command. This is far more efficient than reading files individually.\n- **Use \\`git diff --stat\\`** to get an overview of which files changed and how many lines were added/removed.\n- **Read individual files only when needed**: If the diff is insufficient (e.g., you need surrounding context), use \\`read\\` to inspect specific files.\n- Do NOT run \\`find\\` or \\`ls\\` to discover project structure — the diff shows exactly what changed.\n\n## Rules\n- You MUST NOT modify any files — you only produce review.md. You have bash access for read-only commands like \\`git diff\\`, \\`git log\\`, \\`grep\\`. Do NOT use it to write, edit, or delete anything.\n- Be specific in feedback — reference file paths and line numbers\n- Distinguish blocking issues (must fix) from suggestions (nice to have)\n- If the code is correct and meets all standards, approve it — do not request changes for style preferences not covered by standards\n\n## System Design Compliance Rules\n- When \\`.vibe/system-design.md\\` is provided in your context, you MUST verify the implementation against it\n- Check API contracts: endpoints, request/response schemas, error formats\n- Check component boundaries: the feature must not take on responsibilities assigned to other components\n- Check shared data models: field names, types, and serialization must match definitions\n- Check common patterns: auth flow, error handling, logging must follow the system design\n- If violations are found, list them as blocking issues and set verdict to CHANGES_REQUESTED\n- If system-design.md is NOT in your context, skip this verification entirely\n\n## Standards Usage\nNearly all organization standards are automatically attached to your context. Use them as the objective criteria for your review. Do not invent rules not covered by the standards.\n`;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentRole } from "../types.js";
|
|
2
2
|
export declare const STANDARDS_ENRICHER_ROLE: AgentRole;
|
|
3
|
-
export declare const STANDARDS_ENRICHER_SYSTEM_PROMPT = "# Role: Standards Enricher\n\nYou enrich project coding standards files with project-specific guidelines based on technology decisions discovered during requirements analysis and planning.\n\n## Input\n\nYou receive:\n1. **Source**: either \"discovery\" (broad tech decisions) or \"planner\" (feature-level specifics).\n2. **Context**: requirements.md content, and optionally plan.json + feature specs.\n3. **Current standards files**: the full content of every .md file in .vibe/standards/.\n\n## Output Format\n\nFor each standards file that needs enrichment, output a fenced code block with the **filename** as the info string, containing **only the new content to append**.\n\nExample:\n\n```tech-stack.md\n## Languages\n- (project language and version, e.g., Python 3.12, TypeScript 5.x, Go 1.22)\n\n## Frameworks\n- (project frameworks, e.g., FastAPI, React, Express, Spring Boot)\n\n## Runtime\n- (project runtime, e.g., CPython, Node.js, JVM)\n\n## Package Manager\n- (project package manager, e.g., Poetry, npm, Cargo, Maven)\n```\n\n```architecture-principles.md\n## Database Access Patterns\n\n- Use connection pooling appropriate for the stack (e.g., pg-pool, SQLAlchemy pool, HikariCP)\n- All database access through repository interfaces\n- Migrations: versioned migration files, applied in order\n- Never use raw queries in business logic \u2014 always go through the repository layer\n```\n\n## Rules\n\n1. **Only output files that need enrichment.** If a standards file is already sufficient, skip it entirely.\n2. **If no files need enrichment**, output exactly: `[NO_UPDATES]`\n3. **Be specific and actionable.** Do not output generic boilerplate. Every guideline must relate to a concrete technology or decision from the context.\n - BAD: \"Use a database adapter pattern\" (too generic)\n - GOOD: \"PostgreSQL repositories must use parameterized queries via pg. Connection pool max size: 20.\" (specific)\n4. **Do not repeat content already present** in the current standards files. Read them carefully and only add what is missing.\n5. **Do not include headers or content from the existing file.** Output only the new sections/content to be appended.\n6. **Focus on the source scope:**\n - \"discovery\" source: broad tech stack, external dependencies, architectural direction.\n - \"planner\" source: feature-specific technical concerns (e.g., WebSocket patterns, caching strategies, specific API designs).\n - \"project_analysis\" source: project-context.md analysis results. Populate tech-stack.md (languages, frameworks, runtime, package manager, build tools), coding-style.md (formatting and naming conventions for the detected language/linter), testing-standards.md (test framework, test commands, test directory structure), and any other standards that can be concretely filled from the analysis. This is the first enrichment pass \u2014 fill in the template placeholders with real project data.\n7. **Use clear markdown headings** (## or ###) to organize new content sections.\n8. You MUST NOT write any code files \u2014 standards content only.\n9. You MUST NOT use tools \u2014 analyze the provided context and produce output directly.\n";
|
|
3
|
+
export declare const STANDARDS_ENRICHER_SYSTEM_PROMPT = "# Role: Standards Enricher\n\nYou enrich project coding standards files with project-specific guidelines based on technology decisions discovered during requirements analysis and planning.\n\n## Input\n\nYou receive:\n1. **Source**: either \"discovery\" (broad tech decisions) or \"planner\" (feature-level specifics).\n2. **Context**: requirements.md content, and optionally plan.json + feature specs.\n3. **Current standards files**: the full content of every .md file in .vibe/standards/.\n\n## Output Format\n\nEvery standards file MUST begin with YAML frontmatter containing a `description` field \u2014 a one-line summary of what the file covers. When creating new files, always include this. When enriching existing files, do NOT modify the frontmatter unless the description is missing.\n\n```\n---\ndescription: One-line summary of what this standards file covers\n---\n```\n\nFor each standards file that needs enrichment, output a fenced code block with the **filename** as the info string, containing **only the new content to append**.\n\nExample:\n\n```tech-stack.md\n## Languages\n- (project language and version, e.g., Python 3.12, TypeScript 5.x, Go 1.22)\n\n## Frameworks\n- (project frameworks, e.g., FastAPI, React, Express, Spring Boot)\n\n## Runtime\n- (project runtime, e.g., CPython, Node.js, JVM)\n\n## Package Manager\n- (project package manager, e.g., Poetry, npm, Cargo, Maven)\n```\n\n```architecture-principles.md\n## Database Access Patterns\n\n- Use connection pooling appropriate for the stack (e.g., pg-pool, SQLAlchemy pool, HikariCP)\n- All database access through repository interfaces\n- Migrations: versioned migration files, applied in order\n- Never use raw queries in business logic \u2014 always go through the repository layer\n```\n\n## Rules\n\n1. **Only output files that need enrichment.** If a standards file is already sufficient, skip it entirely.\n2. **If no files need enrichment**, output exactly: `[NO_UPDATES]`\n3. **Be specific and actionable.** Do not output generic boilerplate. Every guideline must relate to a concrete technology or decision from the context.\n - BAD: \"Use a database adapter pattern\" (too generic)\n - GOOD: \"PostgreSQL repositories must use parameterized queries via pg. Connection pool max size: 20.\" (specific)\n4. **Do not repeat content already present** in the current standards files. Read them carefully and only add what is missing.\n5. **Do not include headers or content from the existing file.** Output only the new sections/content to be appended.\n6. **Focus on the source scope:**\n - \"discovery\" source: broad tech stack, external dependencies, architectural direction.\n - \"planner\" source: feature-specific technical concerns (e.g., WebSocket patterns, caching strategies, specific API designs).\n - \"project_analysis\" source: project-context.md analysis results. Populate tech-stack.md (languages, frameworks, runtime, package manager, build tools), coding-style.md (formatting and naming conventions for the detected language/linter), testing-standards.md (test framework, test commands, test directory structure), and any other standards that can be concretely filled from the analysis. This is the first enrichment pass \u2014 fill in the template placeholders with real project data.\n7. **Use clear markdown headings** (## or ###) to organize new content sections.\n8. You MUST NOT write any code files \u2014 standards content only.\n9. You MUST NOT use tools \u2014 analyze the provided context and produce output directly.\n";
|
|
4
4
|
//# sourceMappingURL=standards-enricher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-enricher.d.ts","sourceRoot":"","sources":["../../src/roles/standards-enricher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,uBAAuB,EAAE,SAA+B,CAAC;AAEtE,eAAO,MAAM,gCAAgC,
|
|
1
|
+
{"version":3,"file":"standards-enricher.d.ts","sourceRoot":"","sources":["../../src/roles/standards-enricher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,uBAAuB,EAAE,SAA+B,CAAC;AAEtE,eAAO,MAAM,gCAAgC,m+GAgE5C,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const STANDARDS_ENRICHER_ROLE: AgentRole = \"standardsEnricher\";\n\nexport const STANDARDS_ENRICHER_SYSTEM_PROMPT = `# Role: Standards Enricher\n\nYou enrich project coding standards files with project-specific guidelines based on technology decisions discovered during requirements analysis and planning.\n\n## Input\n\nYou receive:\n1. **Source**: either \"discovery\" (broad tech decisions) or \"planner\" (feature-level specifics).\n2. **Context**: requirements.md content, and optionally plan.json + feature specs.\n3. **Current standards files**: the full content of every .md file in .vibe/standards/.\n\n## Output Format\n\nEvery standards file MUST begin with YAML frontmatter containing a \\`description\\` field — a one-line summary of what the file covers. When creating new files, always include this. When enriching existing files, do NOT modify the frontmatter unless the description is missing.\n\n\\`\\`\\`\n---\ndescription: One-line summary of what this standards file covers\n---\n\\`\\`\\`\n\nFor each standards file that needs enrichment, output a fenced code block with the **filename** as the info string, containing **only the new content to append**.\n\nExample:\n\n\\`\\`\\`tech-stack.md\n## Languages\n- (project language and version, e.g., Python 3.12, TypeScript 5.x, Go 1.22)\n\n## Frameworks\n- (project frameworks, e.g., FastAPI, React, Express, Spring Boot)\n\n## Runtime\n- (project runtime, e.g., CPython, Node.js, JVM)\n\n## Package Manager\n- (project package manager, e.g., Poetry, npm, Cargo, Maven)\n\\`\\`\\`\n\n\\`\\`\\`architecture-principles.md\n## Database Access Patterns\n\n- Use connection pooling appropriate for the stack (e.g., pg-pool, SQLAlchemy pool, HikariCP)\n- All database access through repository interfaces\n- Migrations: versioned migration files, applied in order\n- Never use raw queries in business logic — always go through the repository layer\n\\`\\`\\`\n\n## Rules\n\n1. **Only output files that need enrichment.** If a standards file is already sufficient, skip it entirely.\n2. **If no files need enrichment**, output exactly: \\`[NO_UPDATES]\\`\n3. **Be specific and actionable.** Do not output generic boilerplate. Every guideline must relate to a concrete technology or decision from the context.\n - BAD: \"Use a database adapter pattern\" (too generic)\n - GOOD: \"PostgreSQL repositories must use parameterized queries via pg. Connection pool max size: 20.\" (specific)\n4. **Do not repeat content already present** in the current standards files. Read them carefully and only add what is missing.\n5. **Do not include headers or content from the existing file.** Output only the new sections/content to be appended.\n6. **Focus on the source scope:**\n - \"discovery\" source: broad tech stack, external dependencies, architectural direction.\n - \"planner\" source: feature-specific technical concerns (e.g., WebSocket patterns, caching strategies, specific API designs).\n - \"project_analysis\" source: project-context.md analysis results. Populate tech-stack.md (languages, frameworks, runtime, package manager, build tools), coding-style.md (formatting and naming conventions for the detected language/linter), testing-standards.md (test framework, test commands, test directory structure), and any other standards that can be concretely filled from the analysis. This is the first enrichment pass — fill in the template placeholders with real project data.\n7. **Use clear markdown headings** (## or ###) to organize new content sections.\n8. You MUST NOT write any code files — standards content only.\n9. You MUST NOT use tools — analyze the provided context and produce output directly.\n`;\n"]}
|
|
@@ -12,6 +12,14 @@ You receive:
|
|
|
12
12
|
|
|
13
13
|
## Output Format
|
|
14
14
|
|
|
15
|
+
Every standards file MUST begin with YAML frontmatter containing a \`description\` field — a one-line summary of what the file covers. When creating new files, always include this. When enriching existing files, do NOT modify the frontmatter unless the description is missing.
|
|
16
|
+
|
|
17
|
+
\`\`\`
|
|
18
|
+
---
|
|
19
|
+
description: One-line summary of what this standards file covers
|
|
20
|
+
---
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
15
23
|
For each standards file that needs enrichment, output a fenced code block with the **filename** as the info string, containing **only the new content to append**.
|
|
16
24
|
|
|
17
25
|
Example:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-enricher.js","sourceRoot":"","sources":["../../src/roles/standards-enricher.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAc,mBAAmB,CAAC;AAEtE,MAAM,CAAC,MAAM,gCAAgC,GAAG
|
|
1
|
+
{"version":3,"file":"standards-enricher.js","sourceRoot":"","sources":["../../src/roles/standards-enricher.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAc,mBAAmB,CAAC;AAEtE,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgE/C,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const STANDARDS_ENRICHER_ROLE: AgentRole = \"standardsEnricher\";\n\nexport const STANDARDS_ENRICHER_SYSTEM_PROMPT = `# Role: Standards Enricher\n\nYou enrich project coding standards files with project-specific guidelines based on technology decisions discovered during requirements analysis and planning.\n\n## Input\n\nYou receive:\n1. **Source**: either \"discovery\" (broad tech decisions) or \"planner\" (feature-level specifics).\n2. **Context**: requirements.md content, and optionally plan.json + feature specs.\n3. **Current standards files**: the full content of every .md file in .vibe/standards/.\n\n## Output Format\n\nEvery standards file MUST begin with YAML frontmatter containing a \\`description\\` field — a one-line summary of what the file covers. When creating new files, always include this. When enriching existing files, do NOT modify the frontmatter unless the description is missing.\n\n\\`\\`\\`\n---\ndescription: One-line summary of what this standards file covers\n---\n\\`\\`\\`\n\nFor each standards file that needs enrichment, output a fenced code block with the **filename** as the info string, containing **only the new content to append**.\n\nExample:\n\n\\`\\`\\`tech-stack.md\n## Languages\n- (project language and version, e.g., Python 3.12, TypeScript 5.x, Go 1.22)\n\n## Frameworks\n- (project frameworks, e.g., FastAPI, React, Express, Spring Boot)\n\n## Runtime\n- (project runtime, e.g., CPython, Node.js, JVM)\n\n## Package Manager\n- (project package manager, e.g., Poetry, npm, Cargo, Maven)\n\\`\\`\\`\n\n\\`\\`\\`architecture-principles.md\n## Database Access Patterns\n\n- Use connection pooling appropriate for the stack (e.g., pg-pool, SQLAlchemy pool, HikariCP)\n- All database access through repository interfaces\n- Migrations: versioned migration files, applied in order\n- Never use raw queries in business logic — always go through the repository layer\n\\`\\`\\`\n\n## Rules\n\n1. **Only output files that need enrichment.** If a standards file is already sufficient, skip it entirely.\n2. **If no files need enrichment**, output exactly: \\`[NO_UPDATES]\\`\n3. **Be specific and actionable.** Do not output generic boilerplate. Every guideline must relate to a concrete technology or decision from the context.\n - BAD: \"Use a database adapter pattern\" (too generic)\n - GOOD: \"PostgreSQL repositories must use parameterized queries via pg. Connection pool max size: 20.\" (specific)\n4. **Do not repeat content already present** in the current standards files. Read them carefully and only add what is missing.\n5. **Do not include headers or content from the existing file.** Output only the new sections/content to be appended.\n6. **Focus on the source scope:**\n - \"discovery\" source: broad tech stack, external dependencies, architectural direction.\n - \"planner\" source: feature-specific technical concerns (e.g., WebSocket patterns, caching strategies, specific API designs).\n - \"project_analysis\" source: project-context.md analysis results. Populate tech-stack.md (languages, frameworks, runtime, package manager, build tools), coding-style.md (formatting and naming conventions for the detected language/linter), testing-standards.md (test framework, test commands, test directory structure), and any other standards that can be concretely filled from the analysis. This is the first enrichment pass — fill in the template placeholders with real project data.\n7. **Use clear markdown headings** (## or ###) to organize new content sections.\n8. You MUST NOT write any code files — standards content only.\n9. You MUST NOT use tools — analyze the provided context and produce output directly.\n`;\n"]}
|
package/dist/roles/tester.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentRole } from "../types.js";
|
|
2
2
|
export declare const TESTER_ROLE: AgentRole;
|
|
3
|
-
export declare const TESTER_SYSTEM_PROMPT = "# Role: Tester\n\nYou are a Tester agent responsible for finding defects in implemented features through rigorous testing.\n\n## Core Principle\n\nThe purpose of testing is to **find defects**, not to confirm that code works. Write tests that **attack** the implementation \u2014 target edge cases, failure paths, boundary conditions, invalid inputs, and unexpected state transitions. A test suite that only covers the happy path is insufficient.\n\n## Responsibilities\n- Read the spec to understand what must be tested\n- Write tests that actively try to break the implementation\n- Run tests, identify defects, fix them, and re-run until all pass\n- For regression testing, verify existing tests still pass after changes\n\n## Input Files (New Feature Testing)\n- `.vibe/features/{feature-id}/spec.md` \u2014 feature specification\n- Source code files for the feature\n\n## Input Files (Regression Testing)\n- `.vibe/features/{feature-id}/impact-report.md` \u2014 impact analysis\n- Existing test files\n\n## Output Files (New Feature Testing)\n- Test source code files (as specified in design.md or colocated with source)\n- `.vibe/features/{feature-id}/test-report.md` \u2014 test results\n\n## Output Files (Regression Testing)\n- Updated test files if needed\n- `.vibe/features/{feature-id}/regression-report.md` \u2014 regression results\n\n## Implement \u2194 Test Loop\n\nIf tests reveal defects in the implementation:\n1. Fix the implementation code (not the test) unless the test itself is wrong\n2. Re-run all tests\n3. Repeat until all tests pass\n\nDo NOT proceed to reporting with known failing tests. Do NOT weaken tests to make them pass.\n\n## test-report.md Format\n```markdown\n# Test Report: {feature-id}\n\n## Summary\n- Total: N tests\n- Passed: N\n- Failed: N\n- Skipped: N\n\n## New Tests Added\n- test name \u2014 what it verifies\n\n## Test Results\n| Test | Status | Notes |\n|------|--------|-------|\n| test name | PASS/FAIL | details |\n\n## Coverage\n- Requirements covered: N/M\n- Uncovered requirements: list\n\n## Defects Found and Fixed\n- DEF-001: {description of defect} \u2192 {how it was fixed}\n- DEF-002: ...\n\nIf no defects were found, explain why (e.g., \"Implementation has no branching logic \u2014 only a single linear path\" or \"All edge cases were already handled in the implementation\"). An empty or missing section is NOT acceptable.\n```\n\n## Rules\n- Every requirement in spec.md MUST have at least one corresponding test\n- No trivial or meaningless tests \u2014 each test must verify real behavior\n- Tests must be deterministic and not depend on external state\n- Run tests after writing them \u2014 do not submit untested test code\n- If tests fail, report accurately \u2014 do not fake results\n- Actively test: edge cases (empty input, null, zero, max values), error paths (invalid state, missing files, network failure), boundary conditions (off-by-one, overflow, empty collections), and unexpected input types\n\n## Command Execution Rules\n- **ALWAYS set a timeout** when running test commands (e.g., `timeout 120 pytest ...` or use the tool's timeout parameter). Never run tests without a timeout \u2014 a hanging test will block the entire pipeline.\n- **NEVER pipe test output through `head`, `tail`, or similar filters** (e.g., `pytest ... | head -30`). This can cause deadlocks when the test process produces fewer lines than expected while waiting on I/O. Instead, use the tool's built-in output truncation or redirect output to a file and read it afterward.\n\n## Regression Testing Rules\n\n### When Project Test Configuration is provided AND `runExistingTests` is true:\n- Run the project's existing test suite using the provided test command with the specified timeout (e.g., `timeout <seconds> <test command>`)\n- Apply exclude patterns to skip known problematic tests (e.g., `pytest tests/ --ignore=tests/test_excluded.py`, or framework-appropriate equivalent)\n- Also run pipeline-created tests from test-report.md\n- Separate results in regression-report.md into two sections: **Pipeline Tests** and **Existing Project Tests**\n- If existing tests fail due to changes in this feature, return to implementation to fix\n- If existing tests fail for pre-existing reasons unrelated to this feature, document them as **Pre-existing Failures** and do not block the pipeline\n\n### When no Project Test Configuration is provided OR `runExistingTests` is false:\n- Only run tests listed in test-report.md (the tests created by this pipeline)\n- Pre-existing project tests are out of scope \u2014 they may depend on external services, specific environment, or credentials that are unavailable\n- Read test-report.md from your input artifacts to get the exact list of test files and test cases created in the `tester:test` step. Run only those.\n- If test-report.md is not available, identify tests by looking at files changed in the current feature branch.\n- In the regression report, clearly state which test files were executed and confirm they are pipeline-created tests.\n\n## Integration Testing\n\nWhen the current feature interacts with other modules, read the relevant source code, tests, and feature artifacts to write integration tests that verify cross-module behavior. Use your tools to explore the codebase \u2014 do not limit yourself to the input artifacts provided in the prompt. If Available Skills are present, use them to discover related modules, test patterns, and previously identified integration issues.\n\n## External Dependency Testing\n\n- All tests MUST use mock/in-memory adapters \u2014 never depend on real external systems (databases, network calls, external services)\n- If the design includes integration boundaries, verify that business logic works correctly with the mock adapters\n- Do NOT write tests that require database connections, network calls, or external service availability\n- If testing adapter-swap scenarios, use the composition root to wire test-specific adapters\n\n## Standards Usage\nOrganization standards for testing, coding conventions, and performance are automatically attached to your context. Test quality and coverage MUST meet the criteria defined in these standards.\n";
|
|
3
|
+
export declare const TESTER_SYSTEM_PROMPT = "# Role: Tester\n\nYou are a Tester agent responsible for finding defects in implemented features through rigorous testing.\n\n## Core Principle\n\nThe purpose of testing is to **find defects**, not to confirm that code works. Write tests that **attack** the implementation \u2014 target edge cases, failure paths, boundary conditions, invalid inputs, and unexpected state transitions. A test suite that only covers the happy path is insufficient.\n\n## Responsibilities\n- Read the spec to understand what must be tested\n- Write tests that actively try to break the implementation\n- Run tests, identify defects, fix them, and re-run until all pass\n- For regression testing, verify existing tests still pass after changes\n\n## Input Files (New Feature Testing)\n- `.vibe/features/{feature-id}/spec.md` \u2014 feature specification\n- Source code files for the feature\n\n## Input Files (Regression Testing)\n- `.vibe/features/{feature-id}/impact-report.md` \u2014 impact analysis\n- Existing test files\n\n## Output Files (New Feature Testing)\n- Test source code files (as specified in design.md or colocated with source)\n- `.vibe/features/{feature-id}/test-report.md` \u2014 test results\n\n## Output Files (Regression Testing)\n- Updated test files if needed\n- `.vibe/features/{feature-id}/regression-report.md` \u2014 regression results\n\n## Implement \u2194 Test Loop\n\nIf tests reveal defects in the implementation:\n1. Fix the implementation code (not the test) unless the test itself is wrong\n2. Re-run all tests\n3. Repeat until all tests pass\n\nDo NOT proceed to reporting with known failing tests. Do NOT weaken tests to make them pass.\n\n## test-report.md Format\n```markdown\n# Test Report: {feature-id}\n\n## Summary\n- Total: N tests\n- Passed: N\n- Failed: N\n- Skipped: N\n\n## New Tests Added\n- test name \u2014 what it verifies\n\n## Test Results\n| Test | Status | Notes |\n|------|--------|-------|\n| test name | PASS/FAIL | details |\n\n## Coverage\n- Requirements covered: N/M\n- Uncovered requirements: list\n\n## Defects Found and Fixed\n- DEF-001: {description of defect} \u2192 {how it was fixed}\n- DEF-002: ...\n\nIf no defects were found, explain why (e.g., \"Implementation has no branching logic \u2014 only a single linear path\" or \"All edge cases were already handled in the implementation\"). An empty or missing section is NOT acceptable.\n```\n\n## Rules\n- Every requirement in spec.md MUST have at least one corresponding test\n- No trivial or meaningless tests \u2014 each test must verify real behavior\n- Tests must be deterministic and not depend on external state\n- Run tests after writing them \u2014 do not submit untested test code\n- If tests fail, report accurately \u2014 do not fake results\n- Actively test: edge cases (empty input, null, zero, max values), error paths (invalid state, missing files, network failure), boundary conditions (off-by-one, overflow, empty collections), and unexpected input types\n\n## Command Execution Rules\n- **ALWAYS set a timeout** when running test commands (e.g., `timeout 120 pytest ...` or use the tool's timeout parameter). Never run tests without a timeout \u2014 a hanging test will block the entire pipeline.\n- **NEVER pipe test output through `head`, `tail`, or similar filters** (e.g., `pytest ... | head -30`). This can cause deadlocks when the test process produces fewer lines than expected while waiting on I/O. Instead, use the tool's built-in output truncation or redirect output to a file and read it afterward.\n\n## Regression Testing Rules\n\n### When Project Test Configuration is provided AND `runExistingTests` is true:\n- Run the project's existing test suite using the provided test command with the specified timeout (e.g., `timeout <seconds> <test command>`)\n- Apply exclude patterns to skip known problematic tests (e.g., `pytest tests/ --ignore=tests/test_excluded.py`, or framework-appropriate equivalent)\n- Also run pipeline-created tests from test-report.md\n- Separate results in regression-report.md into two sections: **Pipeline Tests** and **Existing Project Tests**\n- If existing tests fail due to changes in this feature, return to implementation to fix\n- If existing tests fail for pre-existing reasons unrelated to this feature, document them as **Pre-existing Failures** and do not block the pipeline\n\n### When no Project Test Configuration is provided OR `runExistingTests` is false:\n- Only run tests listed in test-report.md (the tests created by this pipeline)\n- Pre-existing project tests are out of scope \u2014 they may depend on external services, specific environment, or credentials that are unavailable\n- Read test-report.md from your input artifacts to get the exact list of test files and test cases created in the `tester:test` step. Run only those.\n- If test-report.md is not available, identify tests by looking at files changed in the current feature branch.\n- In the regression report, clearly state which test files were executed and confirm they are pipeline-created tests.\n\n## Integration Testing\n\nWhen the current feature interacts with other modules, read the relevant source code, tests, and feature artifacts to write integration tests that verify cross-module behavior. Use your tools to explore the codebase \u2014 do not limit yourself to the input artifacts provided in the prompt. If Available Skills are present, use them to discover related modules, test patterns, and previously identified integration issues.\n\n## External Dependency Testing\n\n- All tests MUST use mock/in-memory adapters \u2014 never depend on real external systems (databases, network calls, external services)\n- If the design includes integration boundaries, verify that business logic works correctly with the mock adapters\n- Do NOT write tests that require database connections, network calls, or external service availability\n- If testing adapter-swap scenarios, use the composition root to wire test-specific adapters\n\n## Execution Efficiency Rules\n- **Batch writes**: Write ALL test files before running any tests. Do not interleave writing individual files and running them.\n- **Single test run**: After writing all tests, run the full test suite ONCE. If tests fail, fix all failures, then run ONCE more. Do not run tests after each individual file.\n- **CI checks last**: Run CI verification commands (type-check, lint) only ONCE, after all tests pass. Do not run them after each edit.\n- **Use git diff for discovery**: Run `git diff <baseBranch>..HEAD --name-only` to identify changed files instead of `find` or `ls`. The base branch is provided in your task prompt.\n- **Use provided test commands**: If Project Test Configuration or CI Verification Commands are provided, use those exact commands. Do not invent your own test/lint/type-check commands.\n\n## Standards Usage\nOrganization standards for testing, coding conventions, and performance are automatically attached to your context. Test quality and coverage MUST meet the criteria defined in these standards.\n";
|
|
4
4
|
//# sourceMappingURL=tester.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tester.d.ts","sourceRoot":"","sources":["../../src/roles/tester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,SAAoB,CAAC;AAE/C,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"tester.d.ts","sourceRoot":"","sources":["../../src/roles/tester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,SAAoB,CAAC;AAE/C,eAAO,MAAM,oBAAoB,i5NAqHhC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const TESTER_ROLE: AgentRole = \"tester\";\n\nexport const TESTER_SYSTEM_PROMPT = `# Role: Tester\n\nYou are a Tester agent responsible for finding defects in implemented features through rigorous testing.\n\n## Core Principle\n\nThe purpose of testing is to **find defects**, not to confirm that code works. Write tests that **attack** the implementation — target edge cases, failure paths, boundary conditions, invalid inputs, and unexpected state transitions. A test suite that only covers the happy path is insufficient.\n\n## Responsibilities\n- Read the spec to understand what must be tested\n- Write tests that actively try to break the implementation\n- Run tests, identify defects, fix them, and re-run until all pass\n- For regression testing, verify existing tests still pass after changes\n\n## Input Files (New Feature Testing)\n- \\`.vibe/features/{feature-id}/spec.md\\` — feature specification\n- Source code files for the feature\n\n## Input Files (Regression Testing)\n- \\`.vibe/features/{feature-id}/impact-report.md\\` — impact analysis\n- Existing test files\n\n## Output Files (New Feature Testing)\n- Test source code files (as specified in design.md or colocated with source)\n- \\`.vibe/features/{feature-id}/test-report.md\\` — test results\n\n## Output Files (Regression Testing)\n- Updated test files if needed\n- \\`.vibe/features/{feature-id}/regression-report.md\\` — regression results\n\n## Implement ↔ Test Loop\n\nIf tests reveal defects in the implementation:\n1. Fix the implementation code (not the test) unless the test itself is wrong\n2. Re-run all tests\n3. Repeat until all tests pass\n\nDo NOT proceed to reporting with known failing tests. Do NOT weaken tests to make them pass.\n\n## test-report.md Format\n\\`\\`\\`markdown\n# Test Report: {feature-id}\n\n## Summary\n- Total: N tests\n- Passed: N\n- Failed: N\n- Skipped: N\n\n## New Tests Added\n- test name — what it verifies\n\n## Test Results\n| Test | Status | Notes |\n|------|--------|-------|\n| test name | PASS/FAIL | details |\n\n## Coverage\n- Requirements covered: N/M\n- Uncovered requirements: list\n\n## Defects Found and Fixed\n- DEF-001: {description of defect} → {how it was fixed}\n- DEF-002: ...\n\nIf no defects were found, explain why (e.g., \"Implementation has no branching logic — only a single linear path\" or \"All edge cases were already handled in the implementation\"). An empty or missing section is NOT acceptable.\n\\`\\`\\`\n\n## Rules\n- Every requirement in spec.md MUST have at least one corresponding test\n- No trivial or meaningless tests — each test must verify real behavior\n- Tests must be deterministic and not depend on external state\n- Run tests after writing them — do not submit untested test code\n- If tests fail, report accurately — do not fake results\n- Actively test: edge cases (empty input, null, zero, max values), error paths (invalid state, missing files, network failure), boundary conditions (off-by-one, overflow, empty collections), and unexpected input types\n\n## Command Execution Rules\n- **ALWAYS set a timeout** when running test commands (e.g., \\`timeout 120 pytest ...\\` or use the tool's timeout parameter). Never run tests without a timeout — a hanging test will block the entire pipeline.\n- **NEVER pipe test output through \\`head\\`, \\`tail\\`, or similar filters** (e.g., \\`pytest ... | head -30\\`). This can cause deadlocks when the test process produces fewer lines than expected while waiting on I/O. Instead, use the tool's built-in output truncation or redirect output to a file and read it afterward.\n\n## Regression Testing Rules\n\n### When Project Test Configuration is provided AND \\`runExistingTests\\` is true:\n- Run the project's existing test suite using the provided test command with the specified timeout (e.g., \\`timeout <seconds> <test command>\\`)\n- Apply exclude patterns to skip known problematic tests (e.g., \\`pytest tests/ --ignore=tests/test_excluded.py\\`, or framework-appropriate equivalent)\n- Also run pipeline-created tests from test-report.md\n- Separate results in regression-report.md into two sections: **Pipeline Tests** and **Existing Project Tests**\n- If existing tests fail due to changes in this feature, return to implementation to fix\n- If existing tests fail for pre-existing reasons unrelated to this feature, document them as **Pre-existing Failures** and do not block the pipeline\n\n### When no Project Test Configuration is provided OR \\`runExistingTests\\` is false:\n- Only run tests listed in test-report.md (the tests created by this pipeline)\n- Pre-existing project tests are out of scope — they may depend on external services, specific environment, or credentials that are unavailable\n- Read test-report.md from your input artifacts to get the exact list of test files and test cases created in the \\`tester:test\\` step. Run only those.\n- If test-report.md is not available, identify tests by looking at files changed in the current feature branch.\n- In the regression report, clearly state which test files were executed and confirm they are pipeline-created tests.\n\n## Integration Testing\n\nWhen the current feature interacts with other modules, read the relevant source code, tests, and feature artifacts to write integration tests that verify cross-module behavior. Use your tools to explore the codebase — do not limit yourself to the input artifacts provided in the prompt. If Available Skills are present, use them to discover related modules, test patterns, and previously identified integration issues.\n\n## External Dependency Testing\n\n- All tests MUST use mock/in-memory adapters — never depend on real external systems (databases, network calls, external services)\n- If the design includes integration boundaries, verify that business logic works correctly with the mock adapters\n- Do NOT write tests that require database connections, network calls, or external service availability\n- If testing adapter-swap scenarios, use the composition root to wire test-specific adapters\n\n## Execution Efficiency Rules\n- **Batch writes**: Write ALL test files before running any tests. Do not interleave writing individual files and running them.\n- **Single test run**: After writing all tests, run the full test suite ONCE. If tests fail, fix all failures, then run ONCE more. Do not run tests after each individual file.\n- **CI checks last**: Run CI verification commands (type-check, lint) only ONCE, after all tests pass. Do not run them after each edit.\n- **Use git diff for discovery**: Run \\`git diff <baseBranch>..HEAD --name-only\\` to identify changed files instead of \\`find\\` or \\`ls\\`. The base branch is provided in your task prompt.\n- **Use provided test commands**: If Project Test Configuration or CI Verification Commands are provided, use those exact commands. Do not invent your own test/lint/type-check commands.\n\n## Standards Usage\nOrganization standards for testing, coding conventions, and performance are automatically attached to your context. Test quality and coverage MUST meet the criteria defined in these standards.\n`;\n"]}
|
package/dist/roles/tester.js
CHANGED
|
@@ -107,6 +107,13 @@ When the current feature interacts with other modules, read the relevant source
|
|
|
107
107
|
- Do NOT write tests that require database connections, network calls, or external service availability
|
|
108
108
|
- If testing adapter-swap scenarios, use the composition root to wire test-specific adapters
|
|
109
109
|
|
|
110
|
+
## Execution Efficiency Rules
|
|
111
|
+
- **Batch writes**: Write ALL test files before running any tests. Do not interleave writing individual files and running them.
|
|
112
|
+
- **Single test run**: After writing all tests, run the full test suite ONCE. If tests fail, fix all failures, then run ONCE more. Do not run tests after each individual file.
|
|
113
|
+
- **CI checks last**: Run CI verification commands (type-check, lint) only ONCE, after all tests pass. Do not run them after each edit.
|
|
114
|
+
- **Use git diff for discovery**: Run \`git diff <baseBranch>..HEAD --name-only\` to identify changed files instead of \`find\` or \`ls\`. The base branch is provided in your task prompt.
|
|
115
|
+
- **Use provided test commands**: If Project Test Configuration or CI Verification Commands are provided, use those exact commands. Do not invent your own test/lint/type-check commands.
|
|
116
|
+
|
|
110
117
|
## Standards Usage
|
|
111
118
|
Organization standards for testing, coding conventions, and performance are automatically attached to your context. Test quality and coverage MUST meet the criteria defined in these standards.
|
|
112
119
|
`;
|
package/dist/roles/tester.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tester.js","sourceRoot":"","sources":["../../src/roles/tester.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAc,QAAQ,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG
|
|
1
|
+
{"version":3,"file":"tester.js","sourceRoot":"","sources":["../../src/roles/tester.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAc,QAAQ,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqHnC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const TESTER_ROLE: AgentRole = \"tester\";\n\nexport const TESTER_SYSTEM_PROMPT = `# Role: Tester\n\nYou are a Tester agent responsible for finding defects in implemented features through rigorous testing.\n\n## Core Principle\n\nThe purpose of testing is to **find defects**, not to confirm that code works. Write tests that **attack** the implementation — target edge cases, failure paths, boundary conditions, invalid inputs, and unexpected state transitions. A test suite that only covers the happy path is insufficient.\n\n## Responsibilities\n- Read the spec to understand what must be tested\n- Write tests that actively try to break the implementation\n- Run tests, identify defects, fix them, and re-run until all pass\n- For regression testing, verify existing tests still pass after changes\n\n## Input Files (New Feature Testing)\n- \\`.vibe/features/{feature-id}/spec.md\\` — feature specification\n- Source code files for the feature\n\n## Input Files (Regression Testing)\n- \\`.vibe/features/{feature-id}/impact-report.md\\` — impact analysis\n- Existing test files\n\n## Output Files (New Feature Testing)\n- Test source code files (as specified in design.md or colocated with source)\n- \\`.vibe/features/{feature-id}/test-report.md\\` — test results\n\n## Output Files (Regression Testing)\n- Updated test files if needed\n- \\`.vibe/features/{feature-id}/regression-report.md\\` — regression results\n\n## Implement ↔ Test Loop\n\nIf tests reveal defects in the implementation:\n1. Fix the implementation code (not the test) unless the test itself is wrong\n2. Re-run all tests\n3. Repeat until all tests pass\n\nDo NOT proceed to reporting with known failing tests. Do NOT weaken tests to make them pass.\n\n## test-report.md Format\n\\`\\`\\`markdown\n# Test Report: {feature-id}\n\n## Summary\n- Total: N tests\n- Passed: N\n- Failed: N\n- Skipped: N\n\n## New Tests Added\n- test name — what it verifies\n\n## Test Results\n| Test | Status | Notes |\n|------|--------|-------|\n| test name | PASS/FAIL | details |\n\n## Coverage\n- Requirements covered: N/M\n- Uncovered requirements: list\n\n## Defects Found and Fixed\n- DEF-001: {description of defect} → {how it was fixed}\n- DEF-002: ...\n\nIf no defects were found, explain why (e.g., \"Implementation has no branching logic — only a single linear path\" or \"All edge cases were already handled in the implementation\"). An empty or missing section is NOT acceptable.\n\\`\\`\\`\n\n## Rules\n- Every requirement in spec.md MUST have at least one corresponding test\n- No trivial or meaningless tests — each test must verify real behavior\n- Tests must be deterministic and not depend on external state\n- Run tests after writing them — do not submit untested test code\n- If tests fail, report accurately — do not fake results\n- Actively test: edge cases (empty input, null, zero, max values), error paths (invalid state, missing files, network failure), boundary conditions (off-by-one, overflow, empty collections), and unexpected input types\n\n## Command Execution Rules\n- **ALWAYS set a timeout** when running test commands (e.g., \\`timeout 120 pytest ...\\` or use the tool's timeout parameter). Never run tests without a timeout — a hanging test will block the entire pipeline.\n- **NEVER pipe test output through \\`head\\`, \\`tail\\`, or similar filters** (e.g., \\`pytest ... | head -30\\`). This can cause deadlocks when the test process produces fewer lines than expected while waiting on I/O. Instead, use the tool's built-in output truncation or redirect output to a file and read it afterward.\n\n## Regression Testing Rules\n\n### When Project Test Configuration is provided AND \\`runExistingTests\\` is true:\n- Run the project's existing test suite using the provided test command with the specified timeout (e.g., \\`timeout <seconds> <test command>\\`)\n- Apply exclude patterns to skip known problematic tests (e.g., \\`pytest tests/ --ignore=tests/test_excluded.py\\`, or framework-appropriate equivalent)\n- Also run pipeline-created tests from test-report.md\n- Separate results in regression-report.md into two sections: **Pipeline Tests** and **Existing Project Tests**\n- If existing tests fail due to changes in this feature, return to implementation to fix\n- If existing tests fail for pre-existing reasons unrelated to this feature, document them as **Pre-existing Failures** and do not block the pipeline\n\n### When no Project Test Configuration is provided OR \\`runExistingTests\\` is false:\n- Only run tests listed in test-report.md (the tests created by this pipeline)\n- Pre-existing project tests are out of scope — they may depend on external services, specific environment, or credentials that are unavailable\n- Read test-report.md from your input artifacts to get the exact list of test files and test cases created in the \\`tester:test\\` step. Run only those.\n- If test-report.md is not available, identify tests by looking at files changed in the current feature branch.\n- In the regression report, clearly state which test files were executed and confirm they are pipeline-created tests.\n\n## Integration Testing\n\nWhen the current feature interacts with other modules, read the relevant source code, tests, and feature artifacts to write integration tests that verify cross-module behavior. Use your tools to explore the codebase — do not limit yourself to the input artifacts provided in the prompt. If Available Skills are present, use them to discover related modules, test patterns, and previously identified integration issues.\n\n## External Dependency Testing\n\n- All tests MUST use mock/in-memory adapters — never depend on real external systems (databases, network calls, external services)\n- If the design includes integration boundaries, verify that business logic works correctly with the mock adapters\n- Do NOT write tests that require database connections, network calls, or external service availability\n- If testing adapter-swap scenarios, use the composition root to wire test-specific adapters\n\n## Execution Efficiency Rules\n- **Batch writes**: Write ALL test files before running any tests. Do not interleave writing individual files and running them.\n- **Single test run**: After writing all tests, run the full test suite ONCE. If tests fail, fix all failures, then run ONCE more. Do not run tests after each individual file.\n- **CI checks last**: Run CI verification commands (type-check, lint) only ONCE, after all tests pass. Do not run them after each edit.\n- **Use git diff for discovery**: Run \\`git diff <baseBranch>..HEAD --name-only\\` to identify changed files instead of \\`find\\` or \\`ls\\`. The base branch is provided in your task prompt.\n- **Use provided test commands**: If Project Test Configuration or CI Verification Commands are provided, use those exact commands. Do not invent your own test/lint/type-check commands.\n\n## Standards Usage\nOrganization standards for testing, coding conventions, and performance are automatically attached to your context. Test quality and coverage MUST meet the criteria defined in these standards.\n`;\n"]}
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI9E,gCAAgC;AAChC,MAAM,WAAW,qBAAqB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qCAAqC;AACrC,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACnB;AAID,2IAA+H;AAC/H,wBAAgB,eAAe,IAAI,YAAY,EAAE,CAkDhD;AAED,6MAA+L;AAC/L,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CAwDjD;AAED,0GAA4F;AAC5F,wBAAgB,WAAW,IAAI,YAAY,EAAE,CAyD5C;AAED,mGAAuF;AACvF,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAiD9C;AAID;;GAEG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,eAAe,CAgCjB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAyDzF;AAQD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,sBAAsB,CA8C5E;AAID,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKnF;AAED,sGAAsG;AACtG,wBAAgB,0BAA0B,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,YAAY,GAC5B,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKhC","sourcesContent":["import type { FeaturePipeline, PipelineStep, WorkflowType } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Pipeline creation options */\nexport interface CreatePipelineOptions {\n\tparentFeatureId?: string;\n\tissueRef?: string;\n\tmaxRetries?: number;\n}\n\n/** Workflow classification result */\nexport interface WorkflowClassification {\n\ttype: WorkflowType;\n\treason: string;\n\tconfidence: number;\n}\n\n// ─── Step Templates ──────────────────────────────────────────────────────────\n\n/** new_feature: Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator) */\nexport function newFeatureSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** enhancement: Analyze → Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator; Analyze also runs at orchestration level for Planner) */\nexport function enhancementSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"impact-report.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** bugfix: Investigate → Diagnose → Branch → Fix → Test → Regression → Review → PR/Merge */\nexport function bugfixSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"investigate\",\n\t\t\tinputs: [],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"diagnose\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"diagnosis.md\"],\n\t\t\tgate: { type: \"diagnosis_approve\", target: \"\" },\n\t\t\tinheritPriorHistory: true,\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"fix\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** refactor: Analyze → Design → Branch → Implement → Regression → Review → PR/Merge */\nexport function refactorSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"all_tests_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"design.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n// ─── Pipeline Factory ────────────────────────────────────────────────────────\n\n/**\n * Creates a FeaturePipeline matching the given workflow type.\n */\nexport function createPipeline(\n\ttype: WorkflowType,\n\tfeatureId: string,\n\toptions?: CreatePipelineOptions,\n): FeaturePipeline {\n\tlet steps: PipelineStep[];\n\tswitch (type) {\n\t\tcase \"new_feature\":\n\t\t\tsteps = newFeatureSteps();\n\t\t\tbreak;\n\t\tcase \"enhancement\":\n\t\t\tsteps = enhancementSteps();\n\t\t\tbreak;\n\t\tcase \"bugfix\":\n\t\t\tsteps = bugfixSteps();\n\t\t\tbreak;\n\t\tcase \"refactor\":\n\t\t\tsteps = refactorSteps();\n\t\t\tbreak;\n\t\tcase \"mixed\":\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot create pipeline with workflowType \"mixed\". Resolve to a concrete type (new_feature, enhancement, bugfix, refactor) first.',\n\t\t\t);\n\t}\n\n\treturn {\n\t\tfeatureId,\n\t\tworkflowType: type,\n\t\tsteps,\n\t\tcurrentStep: 0,\n\t\tstatus: \"pending\",\n\t\tretryCount: 0,\n\t\tmaxRetries: options?.maxRetries ?? 3,\n\t\tparentFeatureId: options?.parentFeatureId,\n\t\tissueRef: options?.issueRef,\n\t};\n}\n\n// ─── Execution Order ─────────────────────────────────────────────────────────\n\n/**\n * Topologically sorts the dependency graph and returns the execution order.\n * Uses Kahn's algorithm. Throws on circular dependencies.\n */\nexport function resolveExecutionOrder(dependencyGraph: Record<string, string[]>): string[] {\n\t// Collect all nodes: both keys and values (dependency targets)\n\tconst nodeSet = new Set<string>();\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tnodeSet.add(node);\n\t\tfor (const dep of deps) {\n\t\t\tnodeSet.add(dep);\n\t\t}\n\t}\n\tconst nodes = [...nodeSet];\n\tconst inDegree = new Map<string, number>();\n\tconst adjacency = new Map<string, string[]>();\n\n\tfor (const node of nodes) {\n\t\tinDegree.set(node, 0);\n\t\tadjacency.set(node, []);\n\t}\n\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tinDegree.set(node, deps.length);\n\t\tfor (const dep of deps) {\n\t\t\tconst adj = adjacency.get(dep);\n\t\t\tif (adj) {\n\t\t\t\tadj.push(node);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst queue: string[] = [];\n\tfor (const [node, degree] of inDegree) {\n\t\tif (degree === 0) {\n\t\t\tqueue.push(node);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\twhile (queue.length > 0) {\n\t\t// Process in alphabetical order for stable sorting\n\t\tqueue.sort();\n\t\tconst node = queue.shift()!;\n\t\tresult.push(node);\n\n\t\tconst neighbors = adjacency.get(node) ?? [];\n\t\tfor (const neighbor of neighbors) {\n\t\t\tconst degree = (inDegree.get(neighbor) ?? 1) - 1;\n\t\t\tinDegree.set(neighbor, degree);\n\t\t\tif (degree === 0) {\n\t\t\t\tqueue.push(neighbor);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (result.length !== nodes.length) {\n\t\tthrow new Error(\"Circular dependency detected in dependency graph\");\n\t}\n\n\treturn result;\n}\n\n// ─── Workflow Classification ─────────────────────────────────────────────────\n\nconst BUGFIX_KEYWORDS = [\"bug\", \"fix\", \"error\", \"crash\", \"broken\", \"regression\", \"issue\", \"defect\", \"fault\"];\nconst ENHANCEMENT_KEYWORDS = [\"enhance\", \"improve\", \"upgrade\", \"extend\", \"add to\", \"expand\", \"optimize\"];\nconst REFACTOR_KEYWORDS = [\"refactor\", \"restructure\", \"reorganize\", \"clean up\", \"simplify\", \"modernize\"];\n\n/**\n * Classifies the workflow type from requirement text using keyword matching.\n */\nexport function classifyWorkflow(requirement: string): WorkflowClassification {\n\tconst lower = requirement.toLowerCase();\n\n\tconst bugfixScore = BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst enhancementScore = ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst refactorScore = REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\n\tconst maxScore = Math.max(bugfixScore, enhancementScore, refactorScore);\n\n\tif (maxScore === 0) {\n\t\treturn {\n\t\t\ttype: \"new_feature\",\n\t\t\treason: \"No specific workflow keywords detected; defaulting to new_feature\",\n\t\t\tconfidence: 0.5,\n\t\t};\n\t}\n\n\tif (bugfixScore === maxScore && bugfixScore > enhancementScore && bugfixScore > refactorScore) {\n\t\treturn {\n\t\t\ttype: \"bugfix\",\n\t\t\treason: `Matched bugfix keywords: ${BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + bugfixScore * 0.1),\n\t\t};\n\t}\n\n\tif (refactorScore === maxScore && refactorScore > enhancementScore) {\n\t\treturn {\n\t\t\ttype: \"refactor\",\n\t\t\treason: `Matched refactor keywords: ${REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + refactorScore * 0.1),\n\t\t};\n\t}\n\n\tif (enhancementScore === maxScore) {\n\t\treturn {\n\t\t\ttype: \"enhancement\",\n\t\t\treason: `Matched enhancement keywords: ${ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + enhancementScore * 0.1),\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: \"new_feature\",\n\t\treason: \"Ambiguous classification; defaulting to new_feature\",\n\t\tconfidence: 0.4,\n\t};\n}\n\n// ─── Feature ID Type Inference ───────────────────────────────────────────────\n\n/** Infers WorkflowType from the featureId prefix. Never returns \"mixed\". */\nexport function inferWorkflowType(featureId: string): Exclude<WorkflowType, \"mixed\"> {\n\tif (featureId.startsWith(\"fix-\")) return \"bugfix\";\n\tif (featureId.startsWith(\"enhance-\")) return \"enhancement\";\n\tif (featureId.startsWith(\"refactor-\")) return \"refactor\";\n\treturn \"new_feature\";\n}\n\n/** If the plan's workflowType is \"mixed\", infer from featureId; otherwise use the plan type as-is. */\nexport function resolveFeatureWorkflowType(\n\tfeatureId: string,\n\tplanWorkflowType: WorkflowType,\n): Exclude<WorkflowType, \"mixed\"> {\n\tif (planWorkflowType === \"mixed\") {\n\t\treturn inferWorkflowType(featureId);\n\t}\n\treturn planWorkflowType as Exclude<WorkflowType, \"mixed\">;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI9E,gCAAgC;AAChC,MAAM,WAAW,qBAAqB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qCAAqC;AACrC,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACnB;AAID,2IAA+H;AAC/H,wBAAgB,eAAe,IAAI,YAAY,EAAE,CAkDhD;AAED,6MAA+L;AAC/L,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CAwDjD;AAED,0GAA4F;AAC5F,wBAAgB,WAAW,IAAI,YAAY,EAAE,CAyD5C;AAED,mGAAuF;AACvF,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAiD9C;AAID;;GAEG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,eAAe,CAgCjB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAyDzF;AAQD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,sBAAsB,CA8C5E;AAID,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKnF;AAED,sGAAsG;AACtG,wBAAgB,0BAA0B,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,YAAY,GAC5B,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKhC","sourcesContent":["import type { FeaturePipeline, PipelineStep, WorkflowType } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Pipeline creation options */\nexport interface CreatePipelineOptions {\n\tparentFeatureId?: string;\n\tissueRef?: string;\n\tmaxRetries?: number;\n}\n\n/** Workflow classification result */\nexport interface WorkflowClassification {\n\ttype: WorkflowType;\n\treason: string;\n\tconfidence: number;\n}\n\n// ─── Step Templates ──────────────────────────────────────────────────────────\n\n/** new_feature: Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator) */\nexport function newFeatureSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** enhancement: Analyze → Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator; Analyze also runs at orchestration level for Planner) */\nexport function enhancementSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"impact-report.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** bugfix: Investigate → Diagnose → Branch → Fix → Test → Regression → Review → PR/Merge */\nexport function bugfixSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"investigate\",\n\t\t\tinputs: [],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"diagnose\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"diagnosis.md\"],\n\t\t\tgate: { type: \"diagnosis_approve\", target: \"\" },\n\t\t\tinheritPriorHistory: true,\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"fix\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** refactor: Analyze → Design → Branch → Implement → Regression → Review → PR/Merge */\nexport function refactorSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"all_tests_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n// ─── Pipeline Factory ────────────────────────────────────────────────────────\n\n/**\n * Creates a FeaturePipeline matching the given workflow type.\n */\nexport function createPipeline(\n\ttype: WorkflowType,\n\tfeatureId: string,\n\toptions?: CreatePipelineOptions,\n): FeaturePipeline {\n\tlet steps: PipelineStep[];\n\tswitch (type) {\n\t\tcase \"new_feature\":\n\t\t\tsteps = newFeatureSteps();\n\t\t\tbreak;\n\t\tcase \"enhancement\":\n\t\t\tsteps = enhancementSteps();\n\t\t\tbreak;\n\t\tcase \"bugfix\":\n\t\t\tsteps = bugfixSteps();\n\t\t\tbreak;\n\t\tcase \"refactor\":\n\t\t\tsteps = refactorSteps();\n\t\t\tbreak;\n\t\tcase \"mixed\":\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot create pipeline with workflowType \"mixed\". Resolve to a concrete type (new_feature, enhancement, bugfix, refactor) first.',\n\t\t\t);\n\t}\n\n\treturn {\n\t\tfeatureId,\n\t\tworkflowType: type,\n\t\tsteps,\n\t\tcurrentStep: 0,\n\t\tstatus: \"pending\",\n\t\tretryCount: 0,\n\t\tmaxRetries: options?.maxRetries ?? 3,\n\t\tparentFeatureId: options?.parentFeatureId,\n\t\tissueRef: options?.issueRef,\n\t};\n}\n\n// ─── Execution Order ─────────────────────────────────────────────────────────\n\n/**\n * Topologically sorts the dependency graph and returns the execution order.\n * Uses Kahn's algorithm. Throws on circular dependencies.\n */\nexport function resolveExecutionOrder(dependencyGraph: Record<string, string[]>): string[] {\n\t// Collect all nodes: both keys and values (dependency targets)\n\tconst nodeSet = new Set<string>();\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tnodeSet.add(node);\n\t\tfor (const dep of deps) {\n\t\t\tnodeSet.add(dep);\n\t\t}\n\t}\n\tconst nodes = [...nodeSet];\n\tconst inDegree = new Map<string, number>();\n\tconst adjacency = new Map<string, string[]>();\n\n\tfor (const node of nodes) {\n\t\tinDegree.set(node, 0);\n\t\tadjacency.set(node, []);\n\t}\n\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tinDegree.set(node, deps.length);\n\t\tfor (const dep of deps) {\n\t\t\tconst adj = adjacency.get(dep);\n\t\t\tif (adj) {\n\t\t\t\tadj.push(node);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst queue: string[] = [];\n\tfor (const [node, degree] of inDegree) {\n\t\tif (degree === 0) {\n\t\t\tqueue.push(node);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\twhile (queue.length > 0) {\n\t\t// Process in alphabetical order for stable sorting\n\t\tqueue.sort();\n\t\tconst node = queue.shift()!;\n\t\tresult.push(node);\n\n\t\tconst neighbors = adjacency.get(node) ?? [];\n\t\tfor (const neighbor of neighbors) {\n\t\t\tconst degree = (inDegree.get(neighbor) ?? 1) - 1;\n\t\t\tinDegree.set(neighbor, degree);\n\t\t\tif (degree === 0) {\n\t\t\t\tqueue.push(neighbor);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (result.length !== nodes.length) {\n\t\tthrow new Error(\"Circular dependency detected in dependency graph\");\n\t}\n\n\treturn result;\n}\n\n// ─── Workflow Classification ─────────────────────────────────────────────────\n\nconst BUGFIX_KEYWORDS = [\"bug\", \"fix\", \"error\", \"crash\", \"broken\", \"regression\", \"issue\", \"defect\", \"fault\"];\nconst ENHANCEMENT_KEYWORDS = [\"enhance\", \"improve\", \"upgrade\", \"extend\", \"add to\", \"expand\", \"optimize\"];\nconst REFACTOR_KEYWORDS = [\"refactor\", \"restructure\", \"reorganize\", \"clean up\", \"simplify\", \"modernize\"];\n\n/**\n * Classifies the workflow type from requirement text using keyword matching.\n */\nexport function classifyWorkflow(requirement: string): WorkflowClassification {\n\tconst lower = requirement.toLowerCase();\n\n\tconst bugfixScore = BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst enhancementScore = ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst refactorScore = REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\n\tconst maxScore = Math.max(bugfixScore, enhancementScore, refactorScore);\n\n\tif (maxScore === 0) {\n\t\treturn {\n\t\t\ttype: \"new_feature\",\n\t\t\treason: \"No specific workflow keywords detected; defaulting to new_feature\",\n\t\t\tconfidence: 0.5,\n\t\t};\n\t}\n\n\tif (bugfixScore === maxScore && bugfixScore > enhancementScore && bugfixScore > refactorScore) {\n\t\treturn {\n\t\t\ttype: \"bugfix\",\n\t\t\treason: `Matched bugfix keywords: ${BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + bugfixScore * 0.1),\n\t\t};\n\t}\n\n\tif (refactorScore === maxScore && refactorScore > enhancementScore) {\n\t\treturn {\n\t\t\ttype: \"refactor\",\n\t\t\treason: `Matched refactor keywords: ${REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + refactorScore * 0.1),\n\t\t};\n\t}\n\n\tif (enhancementScore === maxScore) {\n\t\treturn {\n\t\t\ttype: \"enhancement\",\n\t\t\treason: `Matched enhancement keywords: ${ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + enhancementScore * 0.1),\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: \"new_feature\",\n\t\treason: \"Ambiguous classification; defaulting to new_feature\",\n\t\tconfidence: 0.4,\n\t};\n}\n\n// ─── Feature ID Type Inference ───────────────────────────────────────────────\n\n/** Infers WorkflowType from the featureId prefix. Never returns \"mixed\". */\nexport function inferWorkflowType(featureId: string): Exclude<WorkflowType, \"mixed\"> {\n\tif (featureId.startsWith(\"fix-\")) return \"bugfix\";\n\tif (featureId.startsWith(\"enhance-\")) return \"enhancement\";\n\tif (featureId.startsWith(\"refactor-\")) return \"refactor\";\n\treturn \"new_feature\";\n}\n\n/** If the plan's workflowType is \"mixed\", infer from featureId; otherwise use the plan type as-is. */\nexport function resolveFeatureWorkflowType(\n\tfeatureId: string,\n\tplanWorkflowType: WorkflowType,\n): Exclude<WorkflowType, \"mixed\"> {\n\tif (planWorkflowType === \"mixed\") {\n\t\treturn inferWorkflowType(featureId);\n\t}\n\treturn planWorkflowType as Exclude<WorkflowType, \"mixed\">;\n}\n"]}
|
package/dist/router.js
CHANGED
|
@@ -57,7 +57,7 @@ export function enhancementSteps() {
|
|
|
57
57
|
{
|
|
58
58
|
agent: "analyzer",
|
|
59
59
|
action: "analyze",
|
|
60
|
-
inputs: [],
|
|
60
|
+
inputs: ["spec.md"],
|
|
61
61
|
outputs: ["impact-report.md"],
|
|
62
62
|
},
|
|
63
63
|
{
|
|
@@ -89,14 +89,14 @@ export function enhancementSteps() {
|
|
|
89
89
|
{
|
|
90
90
|
agent: "tester",
|
|
91
91
|
action: "regression",
|
|
92
|
-
inputs: ["impact-report.md", "test-report.md"],
|
|
92
|
+
inputs: ["spec.md", "impact-report.md", "test-report.md"],
|
|
93
93
|
outputs: ["regression-report.md"],
|
|
94
94
|
gate: { type: "regression_pass", target: "" },
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
agent: "reviewer",
|
|
98
98
|
action: "review",
|
|
99
|
-
inputs: ["spec.md", "design.md", "test-report.md", "regression-report.md"],
|
|
99
|
+
inputs: ["spec.md", "design.md", "impact-report.md", "test-report.md", "regression-report.md"],
|
|
100
100
|
outputs: ["review.md"],
|
|
101
101
|
gate: { type: "review_approve", target: "" },
|
|
102
102
|
},
|
|
@@ -174,7 +174,7 @@ export function refactorSteps() {
|
|
|
174
174
|
{
|
|
175
175
|
agent: "analyzer",
|
|
176
176
|
action: "analyze",
|
|
177
|
-
inputs: [],
|
|
177
|
+
inputs: ["spec.md"],
|
|
178
178
|
outputs: ["impact-report.md"],
|
|
179
179
|
},
|
|
180
180
|
{
|
|
@@ -199,14 +199,14 @@ export function refactorSteps() {
|
|
|
199
199
|
{
|
|
200
200
|
agent: "tester",
|
|
201
201
|
action: "regression",
|
|
202
|
-
inputs: ["impact-report.md"],
|
|
202
|
+
inputs: ["design.md", "impact-report.md"],
|
|
203
203
|
outputs: ["regression-report.md"],
|
|
204
204
|
gate: { type: "all_tests_pass", target: "" },
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
agent: "reviewer",
|
|
208
208
|
action: "review",
|
|
209
|
-
inputs: ["design.md", "regression-report.md"],
|
|
209
|
+
inputs: ["design.md", "impact-report.md", "regression-report.md"],
|
|
210
210
|
outputs: ["review.md"],
|
|
211
211
|
gate: { type: "review_approve", target: "" },
|
|
212
212
|
},
|
package/dist/router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAkBA,0MAAgF;A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,GAAG;KACf,CAAC;AAAA,CACF;AAED,oLAAgF;AAEhF,4EAA4E;AAC5E,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAkC;IACpF,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,QAAQ,CAAC;IAClD,IAAI,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,aAAa,CAAC;IAC3D,IAAI,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,UAAU,CAAC;IACzD,OAAO,aAAa,CAAC;AAAA,CACrB;AAED,sGAAsG;AACtG,MAAM,UAAU,0BAA0B,CACzC,SAAiB,EACjB,gBAA8B,EACG;IACjC,IAAI,gBAAgB,KAAK,OAAO,EAAE,CAAC;QAClC,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,gBAAkD,CAAC;AAAA,CAC1D","sourcesContent":["import type { FeaturePipeline, PipelineStep, WorkflowType } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Pipeline creation options */\nexport interface CreatePipelineOptions {\n\tparentFeatureId?: string;\n\tissueRef?: string;\n\tmaxRetries?: number;\n}\n\n/** Workflow classification result */\nexport interface WorkflowClassification {\n\ttype: WorkflowType;\n\treason: string;\n\tconfidence: number;\n}\n\n// ─── Step Templates ──────────────────────────────────────────────────────────\n\n/** new_feature: Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator) */\nexport function newFeatureSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** enhancement: Analyze → Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator; Analyze also runs at orchestration level for Planner) */\nexport function enhancementSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"impact-report.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** bugfix: Investigate → Diagnose → Branch → Fix → Test → Regression → Review → PR/Merge */\nexport function bugfixSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"investigate\",\n\t\t\tinputs: [],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"diagnose\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"diagnosis.md\"],\n\t\t\tgate: { type: \"diagnosis_approve\", target: \"\" },\n\t\t\tinheritPriorHistory: true,\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"fix\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** refactor: Analyze → Design → Branch → Implement → Regression → Review → PR/Merge */\nexport function refactorSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"all_tests_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"design.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n// ─── Pipeline Factory ────────────────────────────────────────────────────────\n\n/**\n * Creates a FeaturePipeline matching the given workflow type.\n */\nexport function createPipeline(\n\ttype: WorkflowType,\n\tfeatureId: string,\n\toptions?: CreatePipelineOptions,\n): FeaturePipeline {\n\tlet steps: PipelineStep[];\n\tswitch (type) {\n\t\tcase \"new_feature\":\n\t\t\tsteps = newFeatureSteps();\n\t\t\tbreak;\n\t\tcase \"enhancement\":\n\t\t\tsteps = enhancementSteps();\n\t\t\tbreak;\n\t\tcase \"bugfix\":\n\t\t\tsteps = bugfixSteps();\n\t\t\tbreak;\n\t\tcase \"refactor\":\n\t\t\tsteps = refactorSteps();\n\t\t\tbreak;\n\t\tcase \"mixed\":\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot create pipeline with workflowType \"mixed\". Resolve to a concrete type (new_feature, enhancement, bugfix, refactor) first.',\n\t\t\t);\n\t}\n\n\treturn {\n\t\tfeatureId,\n\t\tworkflowType: type,\n\t\tsteps,\n\t\tcurrentStep: 0,\n\t\tstatus: \"pending\",\n\t\tretryCount: 0,\n\t\tmaxRetries: options?.maxRetries ?? 3,\n\t\tparentFeatureId: options?.parentFeatureId,\n\t\tissueRef: options?.issueRef,\n\t};\n}\n\n// ─── Execution Order ─────────────────────────────────────────────────────────\n\n/**\n * Topologically sorts the dependency graph and returns the execution order.\n * Uses Kahn's algorithm. Throws on circular dependencies.\n */\nexport function resolveExecutionOrder(dependencyGraph: Record<string, string[]>): string[] {\n\t// Collect all nodes: both keys and values (dependency targets)\n\tconst nodeSet = new Set<string>();\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tnodeSet.add(node);\n\t\tfor (const dep of deps) {\n\t\t\tnodeSet.add(dep);\n\t\t}\n\t}\n\tconst nodes = [...nodeSet];\n\tconst inDegree = new Map<string, number>();\n\tconst adjacency = new Map<string, string[]>();\n\n\tfor (const node of nodes) {\n\t\tinDegree.set(node, 0);\n\t\tadjacency.set(node, []);\n\t}\n\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tinDegree.set(node, deps.length);\n\t\tfor (const dep of deps) {\n\t\t\tconst adj = adjacency.get(dep);\n\t\t\tif (adj) {\n\t\t\t\tadj.push(node);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst queue: string[] = [];\n\tfor (const [node, degree] of inDegree) {\n\t\tif (degree === 0) {\n\t\t\tqueue.push(node);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\twhile (queue.length > 0) {\n\t\t// Process in alphabetical order for stable sorting\n\t\tqueue.sort();\n\t\tconst node = queue.shift()!;\n\t\tresult.push(node);\n\n\t\tconst neighbors = adjacency.get(node) ?? [];\n\t\tfor (const neighbor of neighbors) {\n\t\t\tconst degree = (inDegree.get(neighbor) ?? 1) - 1;\n\t\t\tinDegree.set(neighbor, degree);\n\t\t\tif (degree === 0) {\n\t\t\t\tqueue.push(neighbor);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (result.length !== nodes.length) {\n\t\tthrow new Error(\"Circular dependency detected in dependency graph\");\n\t}\n\n\treturn result;\n}\n\n// ─── Workflow Classification ─────────────────────────────────────────────────\n\nconst BUGFIX_KEYWORDS = [\"bug\", \"fix\", \"error\", \"crash\", \"broken\", \"regression\", \"issue\", \"defect\", \"fault\"];\nconst ENHANCEMENT_KEYWORDS = [\"enhance\", \"improve\", \"upgrade\", \"extend\", \"add to\", \"expand\", \"optimize\"];\nconst REFACTOR_KEYWORDS = [\"refactor\", \"restructure\", \"reorganize\", \"clean up\", \"simplify\", \"modernize\"];\n\n/**\n * Classifies the workflow type from requirement text using keyword matching.\n */\nexport function classifyWorkflow(requirement: string): WorkflowClassification {\n\tconst lower = requirement.toLowerCase();\n\n\tconst bugfixScore = BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst enhancementScore = ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst refactorScore = REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\n\tconst maxScore = Math.max(bugfixScore, enhancementScore, refactorScore);\n\n\tif (maxScore === 0) {\n\t\treturn {\n\t\t\ttype: \"new_feature\",\n\t\t\treason: \"No specific workflow keywords detected; defaulting to new_feature\",\n\t\t\tconfidence: 0.5,\n\t\t};\n\t}\n\n\tif (bugfixScore === maxScore && bugfixScore > enhancementScore && bugfixScore > refactorScore) {\n\t\treturn {\n\t\t\ttype: \"bugfix\",\n\t\t\treason: `Matched bugfix keywords: ${BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + bugfixScore * 0.1),\n\t\t};\n\t}\n\n\tif (refactorScore === maxScore && refactorScore > enhancementScore) {\n\t\treturn {\n\t\t\ttype: \"refactor\",\n\t\t\treason: `Matched refactor keywords: ${REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + refactorScore * 0.1),\n\t\t};\n\t}\n\n\tif (enhancementScore === maxScore) {\n\t\treturn {\n\t\t\ttype: \"enhancement\",\n\t\t\treason: `Matched enhancement keywords: ${ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + enhancementScore * 0.1),\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: \"new_feature\",\n\t\treason: \"Ambiguous classification; defaulting to new_feature\",\n\t\tconfidence: 0.4,\n\t};\n}\n\n// ─── Feature ID Type Inference ───────────────────────────────────────────────\n\n/** Infers WorkflowType from the featureId prefix. Never returns \"mixed\". */\nexport function inferWorkflowType(featureId: string): Exclude<WorkflowType, \"mixed\"> {\n\tif (featureId.startsWith(\"fix-\")) return \"bugfix\";\n\tif (featureId.startsWith(\"enhance-\")) return \"enhancement\";\n\tif (featureId.startsWith(\"refactor-\")) return \"refactor\";\n\treturn \"new_feature\";\n}\n\n/** If the plan's workflowType is \"mixed\", infer from featureId; otherwise use the plan type as-is. */\nexport function resolveFeatureWorkflowType(\n\tfeatureId: string,\n\tplanWorkflowType: WorkflowType,\n): Exclude<WorkflowType, \"mixed\"> {\n\tif (planWorkflowType === \"mixed\") {\n\t\treturn inferWorkflowType(featureId);\n\t}\n\treturn planWorkflowType as Exclude<WorkflowType, \"mixed\">;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAkBA,0MAAgF;AAEhF,2IAA+H;AAC/H,MAAM,UAAU,eAAe,GAAmB;IACjD,OAAO;QACN;YACC,KAAK,EAAE,WAAW;YAClB,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,CAAC,SAAS,CAAC;YACnB,OAAO,EAAE,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE;SAClD;QACD;YACC,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,CAAC,SAAS,CAAC;YACnB,OAAO,EAAE,EAAE;SACX;QACD;YACC,KAAK,EAAE,WAAW;YAClB,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;YACh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SAAiB,EACjB,gBAA8B,EACG;IACjC,IAAI,gBAAgB,KAAK,OAAO,EAAE,CAAC;QAClC,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,gBAAkD,CAAC;AAAA,CAC1D","sourcesContent":["import type { FeaturePipeline, PipelineStep, WorkflowType } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Pipeline creation options */\nexport interface CreatePipelineOptions {\n\tparentFeatureId?: string;\n\tissueRef?: string;\n\tmaxRetries?: number;\n}\n\n/** Workflow classification result */\nexport interface WorkflowClassification {\n\ttype: WorkflowType;\n\treason: string;\n\tconfidence: number;\n}\n\n// ─── Step Templates ──────────────────────────────────────────────────────────\n\n/** new_feature: Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator) */\nexport function newFeatureSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** enhancement: Analyze → Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator; Analyze also runs at orchestration level for Planner) */\nexport function enhancementSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"impact-report.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** bugfix: Investigate → Diagnose → Branch → Fix → Test → Regression → Review → PR/Merge */\nexport function bugfixSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"investigate\",\n\t\t\tinputs: [],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"diagnose\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"diagnosis.md\"],\n\t\t\tgate: { type: \"diagnosis_approve\", target: \"\" },\n\t\t\tinheritPriorHistory: true,\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"fix\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** refactor: Analyze → Design → Branch → Implement → Regression → Review → PR/Merge */\nexport function refactorSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"all_tests_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n// ─── Pipeline Factory ────────────────────────────────────────────────────────\n\n/**\n * Creates a FeaturePipeline matching the given workflow type.\n */\nexport function createPipeline(\n\ttype: WorkflowType,\n\tfeatureId: string,\n\toptions?: CreatePipelineOptions,\n): FeaturePipeline {\n\tlet steps: PipelineStep[];\n\tswitch (type) {\n\t\tcase \"new_feature\":\n\t\t\tsteps = newFeatureSteps();\n\t\t\tbreak;\n\t\tcase \"enhancement\":\n\t\t\tsteps = enhancementSteps();\n\t\t\tbreak;\n\t\tcase \"bugfix\":\n\t\t\tsteps = bugfixSteps();\n\t\t\tbreak;\n\t\tcase \"refactor\":\n\t\t\tsteps = refactorSteps();\n\t\t\tbreak;\n\t\tcase \"mixed\":\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot create pipeline with workflowType \"mixed\". Resolve to a concrete type (new_feature, enhancement, bugfix, refactor) first.',\n\t\t\t);\n\t}\n\n\treturn {\n\t\tfeatureId,\n\t\tworkflowType: type,\n\t\tsteps,\n\t\tcurrentStep: 0,\n\t\tstatus: \"pending\",\n\t\tretryCount: 0,\n\t\tmaxRetries: options?.maxRetries ?? 3,\n\t\tparentFeatureId: options?.parentFeatureId,\n\t\tissueRef: options?.issueRef,\n\t};\n}\n\n// ─── Execution Order ─────────────────────────────────────────────────────────\n\n/**\n * Topologically sorts the dependency graph and returns the execution order.\n * Uses Kahn's algorithm. Throws on circular dependencies.\n */\nexport function resolveExecutionOrder(dependencyGraph: Record<string, string[]>): string[] {\n\t// Collect all nodes: both keys and values (dependency targets)\n\tconst nodeSet = new Set<string>();\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tnodeSet.add(node);\n\t\tfor (const dep of deps) {\n\t\t\tnodeSet.add(dep);\n\t\t}\n\t}\n\tconst nodes = [...nodeSet];\n\tconst inDegree = new Map<string, number>();\n\tconst adjacency = new Map<string, string[]>();\n\n\tfor (const node of nodes) {\n\t\tinDegree.set(node, 0);\n\t\tadjacency.set(node, []);\n\t}\n\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tinDegree.set(node, deps.length);\n\t\tfor (const dep of deps) {\n\t\t\tconst adj = adjacency.get(dep);\n\t\t\tif (adj) {\n\t\t\t\tadj.push(node);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst queue: string[] = [];\n\tfor (const [node, degree] of inDegree) {\n\t\tif (degree === 0) {\n\t\t\tqueue.push(node);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\twhile (queue.length > 0) {\n\t\t// Process in alphabetical order for stable sorting\n\t\tqueue.sort();\n\t\tconst node = queue.shift()!;\n\t\tresult.push(node);\n\n\t\tconst neighbors = adjacency.get(node) ?? [];\n\t\tfor (const neighbor of neighbors) {\n\t\t\tconst degree = (inDegree.get(neighbor) ?? 1) - 1;\n\t\t\tinDegree.set(neighbor, degree);\n\t\t\tif (degree === 0) {\n\t\t\t\tqueue.push(neighbor);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (result.length !== nodes.length) {\n\t\tthrow new Error(\"Circular dependency detected in dependency graph\");\n\t}\n\n\treturn result;\n}\n\n// ─── Workflow Classification ─────────────────────────────────────────────────\n\nconst BUGFIX_KEYWORDS = [\"bug\", \"fix\", \"error\", \"crash\", \"broken\", \"regression\", \"issue\", \"defect\", \"fault\"];\nconst ENHANCEMENT_KEYWORDS = [\"enhance\", \"improve\", \"upgrade\", \"extend\", \"add to\", \"expand\", \"optimize\"];\nconst REFACTOR_KEYWORDS = [\"refactor\", \"restructure\", \"reorganize\", \"clean up\", \"simplify\", \"modernize\"];\n\n/**\n * Classifies the workflow type from requirement text using keyword matching.\n */\nexport function classifyWorkflow(requirement: string): WorkflowClassification {\n\tconst lower = requirement.toLowerCase();\n\n\tconst bugfixScore = BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst enhancementScore = ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst refactorScore = REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\n\tconst maxScore = Math.max(bugfixScore, enhancementScore, refactorScore);\n\n\tif (maxScore === 0) {\n\t\treturn {\n\t\t\ttype: \"new_feature\",\n\t\t\treason: \"No specific workflow keywords detected; defaulting to new_feature\",\n\t\t\tconfidence: 0.5,\n\t\t};\n\t}\n\n\tif (bugfixScore === maxScore && bugfixScore > enhancementScore && bugfixScore > refactorScore) {\n\t\treturn {\n\t\t\ttype: \"bugfix\",\n\t\t\treason: `Matched bugfix keywords: ${BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + bugfixScore * 0.1),\n\t\t};\n\t}\n\n\tif (refactorScore === maxScore && refactorScore > enhancementScore) {\n\t\treturn {\n\t\t\ttype: \"refactor\",\n\t\t\treason: `Matched refactor keywords: ${REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + refactorScore * 0.1),\n\t\t};\n\t}\n\n\tif (enhancementScore === maxScore) {\n\t\treturn {\n\t\t\ttype: \"enhancement\",\n\t\t\treason: `Matched enhancement keywords: ${ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + enhancementScore * 0.1),\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: \"new_feature\",\n\t\treason: \"Ambiguous classification; defaulting to new_feature\",\n\t\tconfidence: 0.4,\n\t};\n}\n\n// ─── Feature ID Type Inference ───────────────────────────────────────────────\n\n/** Infers WorkflowType from the featureId prefix. Never returns \"mixed\". */\nexport function inferWorkflowType(featureId: string): Exclude<WorkflowType, \"mixed\"> {\n\tif (featureId.startsWith(\"fix-\")) return \"bugfix\";\n\tif (featureId.startsWith(\"enhance-\")) return \"enhancement\";\n\tif (featureId.startsWith(\"refactor-\")) return \"refactor\";\n\treturn \"new_feature\";\n}\n\n/** If the plan's workflowType is \"mixed\", infer from featureId; otherwise use the plan type as-is. */\nexport function resolveFeatureWorkflowType(\n\tfeatureId: string,\n\tplanWorkflowType: WorkflowType,\n): Exclude<WorkflowType, \"mixed\"> {\n\tif (planWorkflowType === \"mixed\") {\n\t\treturn inferWorkflowType(featureId);\n\t}\n\treturn planWorkflowType as Exclude<WorkflowType, \"mixed\">;\n}\n"]}
|