diff --git a/builtins/en/piece-categories.yaml b/builtins/en/piece-categories.yaml index b8c77b5..41a521a 100644 --- a/builtins/en/piece-categories.yaml +++ b/builtins/en/piece-categories.yaml @@ -12,6 +12,8 @@ piece_categories: - frontend-mini - backend-mini - backend-cqrs-mini + - expert-mini + - expert-cqrs-mini 🎨 Frontend: pieces: - frontend @@ -25,7 +27,9 @@ piece_categories: 🔧 Expert: pieces: - expert + - expert-mini - expert-cqrs + - expert-cqrs-mini 🛠️ Refactoring: pieces: - structural-reform diff --git a/builtins/en/pieces/expert-cqrs-mini.yaml b/builtins/en/pieces/expert-cqrs-mini.yaml new file mode 100644 index 0000000..e1e7a30 --- /dev/null +++ b/builtins/en/pieces/expert-cqrs-mini.yaml @@ -0,0 +1,254 @@ +name: expert-cqrs-mini +description: CQRS+ES Expert-focused mini development piece (plan -> implement -> parallel review -> fix if needed -> complete) +piece_config: + provider_options: + codex: + network_access: true + opencode: + network_access: true +max_movements: 20 +initial_movement: plan +movements: + - name: plan + edit: false + persona: planner + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + rules: + - condition: Requirements are clear and implementation is possible + next: implement + - condition: User is asking a question (not an implementation task) + next: COMPLETE + - condition: Requirements are unclear, insufficient information + next: ABORT + instruction: plan + output_contracts: + report: + - name: 00-plan.md + format: plan + - name: implement + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + instruction: implement + rules: + - condition: Implementation complete + next: reviewers + - condition: Cannot proceed, insufficient info + next: ABORT + - condition: User input required because there are items to confirm with the user + next: implement + requires_user_input: true + interactive_only: true + output_contracts: + report: + - name: coder-scope.md + format: coder-scope + - name: coder-decisions.md + format: coder-decisions + - name: reviewers + parallel: + - name: ai_review + edit: false + persona: ai-antipattern-reviewer + policy: + - review + - ai-antipattern + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + instruction: review-ai + rules: + - condition: No AI-specific issues + - condition: AI-specific issues found + output_contracts: + report: + - name: 03-ai-review.md + format: ai-review + - name: supervise + edit: false + persona: expert-supervisor + policy: review + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + instruction: supervise + rules: + - condition: All checks passed + - condition: Requirements unmet, tests failing + output_contracts: + report: + - name: supervisor-validation.md + format: supervisor-validation + - name: summary.md + format: summary + use_judge: false + rules: + - condition: all("No AI-specific issues", "All checks passed") + next: COMPLETE + - condition: all("AI-specific issues found", "Requirements unmet, tests failing") + next: fix_both + - condition: any("AI-specific issues found") + next: ai_fix + - condition: any("Requirements unmet, tests failing") + next: supervise_fix + - name: fix_both + parallel: + - name: ai_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: AI Reviewer's issues fixed + - condition: No fix needed (verified target files/spec) + - condition: Cannot proceed, insufficient info + instruction: ai-fix + - name: supervise_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: Supervisor's issues fixed + - condition: Cannot proceed, insufficient info + instruction: fix-supervisor + rules: + - condition: all("AI Reviewer's issues fixed", "Supervisor's issues fixed") + next: reviewers + - condition: any("No fix needed (verified target files/spec)", "Cannot proceed, insufficient info") + next: implement + - name: ai_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: AI Reviewer's issues fixed + next: reviewers + - condition: No fix needed (verified target files/spec) + next: implement + - condition: Cannot proceed, insufficient info + next: implement + instruction: ai-fix + - name: supervise_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: Supervisor's issues fixed + next: reviewers + - condition: Cannot proceed, insufficient info + next: implement + instruction: fix-supervisor diff --git a/builtins/en/pieces/expert-mini.yaml b/builtins/en/pieces/expert-mini.yaml new file mode 100644 index 0000000..4bd34ee --- /dev/null +++ b/builtins/en/pieces/expert-mini.yaml @@ -0,0 +1,247 @@ +name: expert-mini +description: Expert-focused mini development piece (plan -> implement -> parallel review -> fix if needed -> complete) +piece_config: + provider_options: + codex: + network_access: true + opencode: + network_access: true +max_movements: 20 +initial_movement: plan +movements: + - name: plan + edit: false + persona: planner + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + rules: + - condition: Requirements are clear and implementation is possible + next: implement + - condition: User is asking a question (not an implementation task) + next: COMPLETE + - condition: Requirements are unclear, insufficient information + next: ABORT + instruction: plan + output_contracts: + report: + - name: 00-plan.md + format: plan + - name: implement + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + instruction: implement + rules: + - condition: Implementation complete + next: reviewers + - condition: Cannot proceed, insufficient info + next: ABORT + - condition: User input required because there are items to confirm with the user + next: implement + requires_user_input: true + interactive_only: true + output_contracts: + report: + - name: coder-scope.md + format: coder-scope + - name: coder-decisions.md + format: coder-decisions + - name: reviewers + parallel: + - name: ai_review + edit: false + persona: ai-antipattern-reviewer + policy: + - review + - ai-antipattern + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + instruction: review-ai + rules: + - condition: No AI-specific issues + - condition: AI-specific issues found + output_contracts: + report: + - name: 03-ai-review.md + format: ai-review + - name: supervise + edit: false + persona: expert-supervisor + policy: review + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + instruction: supervise + rules: + - condition: All checks passed + - condition: Requirements unmet, tests failing + output_contracts: + report: + - name: supervisor-validation.md + format: supervisor-validation + - name: summary.md + format: summary + use_judge: false + rules: + - condition: all("No AI-specific issues", "All checks passed") + next: COMPLETE + - condition: all("AI-specific issues found", "Requirements unmet, tests failing") + next: fix_both + - condition: any("AI-specific issues found") + next: ai_fix + - condition: any("Requirements unmet, tests failing") + next: supervise_fix + - name: fix_both + parallel: + - name: ai_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: AI Reviewer's issues fixed + - condition: No fix needed (verified target files/spec) + - condition: Cannot proceed, insufficient info + instruction: ai-fix + - name: supervise_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: Supervisor's issues fixed + - condition: Cannot proceed, insufficient info + instruction: fix-supervisor + rules: + - condition: all("AI Reviewer's issues fixed", "Supervisor's issues fixed") + next: reviewers + - condition: any("No fix needed (verified target files/spec)", "Cannot proceed, insufficient info") + next: implement + - name: ai_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: AI Reviewer's issues fixed + next: reviewers + - condition: No fix needed (verified target files/spec) + next: implement + - condition: Cannot proceed, insufficient info + next: implement + instruction: ai-fix + - name: supervise_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: Supervisor's issues fixed + next: reviewers + - condition: Cannot proceed, insufficient info + next: implement + instruction: fix-supervisor diff --git a/builtins/ja/piece-categories.yaml b/builtins/ja/piece-categories.yaml index 3a3c28b..7e4e4c3 100644 --- a/builtins/ja/piece-categories.yaml +++ b/builtins/ja/piece-categories.yaml @@ -12,6 +12,8 @@ piece_categories: - frontend-mini - backend-mini - backend-cqrs-mini + - expert-mini + - expert-cqrs-mini 🎨 フロントエンド: pieces: - frontend @@ -25,7 +27,9 @@ piece_categories: 🔧 エキスパート: pieces: - expert + - expert-mini - expert-cqrs + - expert-cqrs-mini 🛠️ リファクタリング: pieces: - structural-reform diff --git a/builtins/ja/pieces/expert-cqrs-mini.yaml b/builtins/ja/pieces/expert-cqrs-mini.yaml new file mode 100644 index 0000000..2b5ceaf --- /dev/null +++ b/builtins/ja/pieces/expert-cqrs-mini.yaml @@ -0,0 +1,254 @@ +name: expert-cqrs-mini +description: CQRS+ES Expert向けMini開発ピース(plan → implement → 並列レビュー → 修正 → 完了) +piece_config: + provider_options: + codex: + network_access: true + opencode: + network_access: true +max_movements: 20 +initial_movement: plan +movements: + - name: plan + edit: false + persona: planner + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + rules: + - condition: 要件が明確で実装可能 + next: implement + - condition: ユーザーが質問をしている(実装タスクではない) + next: COMPLETE + - condition: 要件が不明確、情報不足 + next: ABORT + instruction: plan + output_contracts: + report: + - name: 00-plan.md + format: plan + - name: implement + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + instruction: implement + rules: + - condition: 実装が完了した + next: reviewers + - condition: 実装を進行できない + next: ABORT + - condition: ユーザーへの確認事項があるためユーザー入力が必要 + next: implement + requires_user_input: true + interactive_only: true + output_contracts: + report: + - name: coder-scope.md + format: coder-scope + - name: coder-decisions.md + format: coder-decisions + - name: reviewers + parallel: + - name: ai_review + edit: false + persona: ai-antipattern-reviewer + policy: + - review + - ai-antipattern + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + instruction: review-ai + rules: + - condition: AI特有の問題なし + - condition: AI特有の問題あり + output_contracts: + report: + - name: 03-ai-review.md + format: ai-review + - name: supervise + edit: false + persona: expert-supervisor + policy: review + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + instruction: supervise + rules: + - condition: すべて問題なし + - condition: 要求未達成、テスト失敗、ビルドエラー + output_contracts: + report: + - name: supervisor-validation.md + format: supervisor-validation + - name: summary.md + format: summary + use_judge: false + rules: + - condition: all("AI特有の問題なし", "すべて問題なし") + next: COMPLETE + - condition: all("AI特有の問題あり", "要求未達成、テスト失敗、ビルドエラー") + next: fix_both + - condition: any("AI特有の問題あり") + next: ai_fix + - condition: any("要求未達成、テスト失敗、ビルドエラー") + next: supervise_fix + - name: fix_both + parallel: + - name: ai_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: AI問題の修正完了 + - condition: 修正不要(指摘対象ファイル/仕様の確認済み) + - condition: 判断できない、情報不足 + instruction: ai-fix + - name: supervise_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: 監督者の指摘に対する修正が完了した + - condition: 修正を進行できない + instruction: fix-supervisor + rules: + - condition: all("AI問題の修正完了", "監督者の指摘に対する修正が完了した") + next: reviewers + - condition: any("修正不要(指摘対象ファイル/仕様の確認済み)", "判断できない、情報不足", "修正を進行できない") + next: implement + - name: ai_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: AI問題の修正完了 + next: reviewers + - condition: 修正不要(指摘対象ファイル/仕様の確認済み) + next: implement + - condition: 判断できない、情報不足 + next: implement + instruction: ai-fix + - name: supervise_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - cqrs-es + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: 監督者の指摘に対する修正が完了した + next: reviewers + - condition: 修正を進行できない + next: implement + instruction: fix-supervisor diff --git a/builtins/ja/pieces/expert-mini.yaml b/builtins/ja/pieces/expert-mini.yaml new file mode 100644 index 0000000..82a1298 --- /dev/null +++ b/builtins/ja/pieces/expert-mini.yaml @@ -0,0 +1,247 @@ +name: expert-mini +description: Expert向けMini開発ピース(plan → implement → 並列レビュー → 修正 → 完了) +piece_config: + provider_options: + codex: + network_access: true + opencode: + network_access: true +max_movements: 20 +initial_movement: plan +movements: + - name: plan + edit: false + persona: planner + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + rules: + - condition: 要件が明確で実装可能 + next: implement + - condition: ユーザーが質問をしている(実装タスクではない) + next: COMPLETE + - condition: 要件が不明確、情報不足 + next: ABORT + instruction: plan + output_contracts: + report: + - name: 00-plan.md + format: plan + - name: implement + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + instruction: implement + rules: + - condition: 実装が完了した + next: reviewers + - condition: 実装を進行できない + next: ABORT + - condition: ユーザーへの確認事項があるためユーザー入力が必要 + next: implement + requires_user_input: true + interactive_only: true + output_contracts: + report: + - name: coder-scope.md + format: coder-scope + - name: coder-decisions.md + format: coder-decisions + - name: reviewers + parallel: + - name: ai_review + edit: false + persona: ai-antipattern-reviewer + policy: + - review + - ai-antipattern + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + instruction: review-ai + rules: + - condition: AI特有の問題なし + - condition: AI特有の問題あり + output_contracts: + report: + - name: 03-ai-review.md + format: ai-review + - name: supervise + edit: false + persona: expert-supervisor + policy: review + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + instruction: supervise + rules: + - condition: すべて問題なし + - condition: 要求未達成、テスト失敗、ビルドエラー + output_contracts: + report: + - name: supervisor-validation.md + format: supervisor-validation + - name: summary.md + format: summary + use_judge: false + rules: + - condition: all("AI特有の問題なし", "すべて問題なし") + next: COMPLETE + - condition: all("AI特有の問題あり", "要求未達成、テスト失敗、ビルドエラー") + next: fix_both + - condition: any("AI特有の問題あり") + next: ai_fix + - condition: any("要求未達成、テスト失敗、ビルドエラー") + next: supervise_fix + - name: fix_both + parallel: + - name: ai_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: AI問題の修正完了 + - condition: 修正不要(指摘対象ファイル/仕様の確認済み) + - condition: 判断できない、情報不足 + instruction: ai-fix + - name: supervise_fix_parallel + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + rules: + - condition: 監督者の指摘に対する修正が完了した + - condition: 修正を進行できない + instruction: fix-supervisor + rules: + - condition: all("AI問題の修正完了", "監督者の指摘に対する修正が完了した") + next: reviewers + - condition: any("修正不要(指摘対象ファイル/仕様の確認済み)", "判断できない、情報不足", "修正を進行できない") + next: implement + - name: ai_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: AI問題の修正完了 + next: reviewers + - condition: 修正不要(指摘対象ファイル/仕様の確認済み) + next: implement + - condition: 判断できない、情報不足 + next: implement + instruction: ai-fix + - name: supervise_fix + edit: true + persona: coder + policy: + - coding + - testing + knowledge: + - frontend + - backend + - security + - architecture + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + required_permission_mode: edit + pass_previous_response: false + rules: + - condition: 監督者の指摘に対する修正が完了した + next: reviewers + - condition: 修正を進行できない + next: implement + instruction: fix-supervisor diff --git a/src/__tests__/permission-profile-resolution.test.ts b/src/__tests__/permission-profile-resolution.test.ts index d789c02..6fe9fac 100644 --- a/src/__tests__/permission-profile-resolution.test.ts +++ b/src/__tests__/permission-profile-resolution.test.ts @@ -43,11 +43,13 @@ describe('resolveMovementPermissionMode', () => { expect(mode).toBe('full'); }); - it('throws when unresolved', () => { - expect(() => resolveMovementPermissionMode({ + it('falls back to readonly when unresolved', () => { + const mode = resolveMovementPermissionMode({ movementName: 'fix', provider: 'codex', - })).toThrow(/Unable to resolve permission mode/); + }); + + expect(mode).toBe('readonly'); }); it('resolves from required_permission_mode when provider is omitted', () => { diff --git a/src/core/piece/permission-profile-resolution.ts b/src/core/piece/permission-profile-resolution.ts index 41dbdc2..340626f 100644 --- a/src/core/piece/permission-profile-resolution.ts +++ b/src/core/piece/permission-profile-resolution.ts @@ -63,10 +63,7 @@ export function resolveMovementPermissionMode(input: ResolvePermissionModeInput) return input.requiredPermissionMode; } - throw new Error( - `Unable to resolve permission mode for movement "${input.movementName}" and provider "${input.provider}": ` + - 'define provider_profiles defaults/overrides or movement.required_permission_mode.', - ); + return 'readonly'; } const PERMISSION_MODE_RANK: Record = {