Skip to content

[#777] implement-workflow-builder#780

Open
nrslib wants to merge 2 commits into
mainfrom
takt/777/implement-workflow-builder
Open

[#777] implement-workflow-builder#780
nrslib wants to merge 2 commits into
mainfrom
takt/777/implement-workflow-builder

Conversation

@nrslib

@nrslib nrslib commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

背景・動機

ワークフローを作るには、YAML スキーマとファセット分離(persona/policy/knowledge/instruction/output-contract)を理解した上で手書きする必要がある。takt workflow init は静的雛形を出すだけで設計判断は人間任せ。

takt-builder の知識(STYLE_GUIDE、yaml-schema、ファセット分離判断)を 対話する AI(builder) として常駐させ、要件を話すだけで設計・生成・検証できるようにする。workflow 名前空間に、doctor(診断する人)と対になる役割名詞 builder(組み立てる人)を追加する。

コマンド

takt workflow builder
  • 引数なし・CLI フラグなし。 scope などの分岐はすべて起動時の対話 UI と会話の中で決める。
  • src/app/cli/commands.tsworkflow サブコマンドに init / doctor と並べて登録。

設計の中心:ワークフロー中心、ファセットは選ばない

ユーザーはファセットを直接選ばない。エントリは常にワークフローで、「このワークフローでこういうことをしたい」という意図に合わせて builder がファセット(persona/policy/knowledge/instruction/output-contract)を生成・更新する。

  • 新規ワークフロー作成:必要なファセットは設計の結果として生成される。
  • 既存ワークフロー修正:ステップ編集に連動して、関連するファセットを更新する。
  • どのファセット種別に分けるかは STYLE_GUIDE の分離判断に従って builder が提案する。ユーザーは要件を話すだけ。

基本方針:軽量ウィザード + 会話のハイブリッド

起動直後に 構造的な軸だけ を軽量ウィザード(対話の選択 UI、CLI フラグではない)で確定させ、そこから先は builder AI との自由対話に落とす。ただしターゲットを絞りたくない場合は、ウィザードを最小限にして即対話へ移れる。

フェーズ1:ウィザード(構造軸の確定)

  1. 出力先 scope

    • プロジェクト .takt/
    • グローバル ~/.takt/
    • TAKT 本体 builtins/{en,ja}/TAKT リポジトリ内でのみ表示builtins/ja/STYLE_GUIDE.md の存在で自動検出し、検出時のみ候補に出す)
  2. ターゲット

    • ワークフローを新規作成
    • 既存ワークフローを修正
    • 絞らない(AI と会話して決める) — 新規/修正・対象を事前に確定せず、builder が会話の中で見極める
  3. (「既存ワークフローを修正」のみ)対象ワークフロー選択

    • scope 内の workflows/*.yamlGlob で一覧表示し、対象を選ぶ。
    • 選んだワークフロー本文と、そのステップが参照するファセットを context に読み込む。
    • 「絞らない」を選んだ場合はこのステップを スキップ し、builder が scope 全体を Glob/Read で探索しながら対話で対象を特定する。

フェーズ2:会話(設計・生成)

ウィザードで確定した軸(または「絞らない」前提)で、builder AI と自由対話で中身を詰める。

  • ユーザーはワークフローでやりたいことを話す。builder がステップ構成とファセットを設計・更新し、既存資産の再利用も提案する。
  • 「絞らない」の場合、builder はまず scope の既存ワークフロー一覧を提示し、「新規で作るか・どれを直すか」を会話で確認してから進める。
  • ファセットの種別はユーザーに選ばせず、builder が分離判断して提案する。
  • /go で生成内容を確定、/cancel で破棄。

関連ワークフロー・ファセットの波及編集(確認フロー)

ワークフローを1つ指定しても、builder はそれと 関連するファセットや類似ワークフローを探索 し、見つかれば 「これも編集しますか?」とユーザーに問いかけ、OK が出たものだけ編集 する。勝手に広げない。

  • 探索対象
    • 対象が使うファセットを共有している他ワークフロー
    • workflow_call: で呼ぶサブワークフロー/対象を呼ぶ親ワークフロー
    • 類似名・同系統のワークフロー(例:review-* 系)
  • フロー
    1. builder が関連候補を提示(どこに・なぜ波及しうるか)。
    2. ユーザーに編集するか問いかける。
    3. OK が出た対象だけを編集する。
  • 既存の workflowDoctorRefValidator(ファセット参照・未使用検出)と workflow_call 契約検証の仕組みを利用して関連グラフを構築する。

ユーザーディレクトリの理解

builder には対象 scope の既存資産を把握させる。

  • scope 確定後、その scope の workflows/facets/config.yaml を読み、再利用可能な既存資産リストワークフロー間の関連グラフを systemPrompt に注入(assistantInitFiles.ts / runSessionReader.ts と同じ流儀)。
  • builder の allowedToolsRead / Glob / Grep を許可し、対話中に自分で深掘りできるようにする。
  • 修正時/「絞らない」時は対象ワークフロー・参照ファセット・関連候補の本文を注入。

builder の知識・指示はプロンプトテンプレートで持つ

builder の systemPrompt は ファセットではなくプロンプトテンプレート として実装する。

  • src/shared/prompts/{en,ja}/builder_system_prompt.md(仮)を新設し、loadTemplate('builder_system_prompt', lang, vars) で読む(perform_agent_system_prompt.md などと同じ仕組み)。
  • STYLE_GUIDE 群と yaml-schema(TAKT 本体 builtins/{lang}/ の Single Source of Truth)はテンプレート変数として注入し、重複を持たない。
  • en / ja の両言語版テンプレートを用意する。

builtin(TAKT 開発者)モードの固有挙動

scope = builtins/ のときだけ en / ja の両言語を生成・同期 する。片方で作ってもう一方へミラー(翻訳)。project / global には無い分岐。

生成と検証

  • /go で生成内容を確定 → ワークフロー YAML・関連ファセット・(OK の出た)波及先を Write
  • 直後に inspectWorkflowFile()workflow doctor の検証エンジン)を編集対象すべてに対して自動実行し、スキーマ・グラフ到達性・ファセット参照を検証。エラーは対話に差し戻して修正させる。

実装スケッチ

src/features/workflowAuthoring/
  ├── index.ts      … builderWorkflowCommand を追加 export
  ├── init.ts       (既存)
  ├── doctor.ts     (既存)
  └── builder.ts    (新規)

src/shared/prompts/{en,ja}/
  └── builder_system_prompt.md  (新規)
  • フェーズ1ウィザード:scope / 新規・修正・絞らない / (修正時のみ)対象ワークフローを対話 UI で確定。
  • フェーズ2対話:src/features/interactive/conversationLoop.ts::runConversationLoop() を再利用。strategy(systemPrompt = loadTemplate('builder_system_prompt', ...) / allowedTools / transformPrompt / introMessage)を builder 用に差し替える。
  • 関連グラフ構築:workflowDoctorRefValidatorworkflow_call 契約検証を流用。
  • AI 呼び出しは aiCaller.ts::callAIWithRetry()、セッション初期化は sessionInitialization.ts を流用。
  • /go フックを「ファイル生成 → Write → doctor 検証」に差し替え。
  • commands.ts:
workflow
  .command('builder')
  .description('Design workflows interactively with an AI builder')
  .action(async () => {
    await builderWorkflowCommand({ projectDir: resolvedCwd });
  });

スコープ外

  • ワークフロー実行(takt run の役割)。
  • 対話の途中保存/再開(セッション resume)。
  • 関連ファセット・類似ワークフローへの 無確認の 波及編集(必ず問いかけて OK を得てから)。

受け入れ条件

  • takt workflow builder を引数・フラグなしで起動できる。
  • 起動時ウィザードで scope と「新規作成/既存修正/絞らない」を選べ、修正時のみ対象ワークフローを一覧から選べる。
  • 「絞らない」を選ぶと対象を事前確定せず、builder が会話の中で新規/修正・対象を見極める。
  • ファセットは直接選ばせず、ワークフローの意図に合わせて builder が生成・更新する。
  • 関連ファセット・類似ワークフローを検出したら編集するか問いかけ、OK が出たものだけ編集する。
  • builder の systemPrompt が src/shared/prompts/{en,ja}/ のテンプレートとして実装され、STYLE_GUIDE / yaml-schema を変数注入している。
  • builtin は TAKT リポジトリ内でのみ選べ、選択時は en / ja 両方を生成する。
  • 編集対象すべてが workflow doctor の検証を通る。

Execution Report

Workflow takt-default completed successfully.

Closes #777

Summary by CodeRabbit

  • New Features

    • 対話型の「workflow builder」CLIを追加し、対話でワークフロー作成・修正が可能に。
    • 会話モードに/​goコマンドを追加し、変更マニフェストの生成と適用ワークフローをサポート。
    • 会話戦略の設定で/​goフック・再開無効化・直接実行抑止を導入しコマンド可用性を制御。
  • Documentation

    • ビルダー用システムプロンプト(英語/日本語)とワークフローYAMLスキーマ参照を追加。
    • 対話UIの案内文言を英日で追加。
  • Tests

    • ビルダー関連と会話ループ周りを中心とした包括的なテスト群を多数追加。

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

PR #780 は対話型の "workflow builder" 機能を追加します。CLI に builder サブコマンドを登録し、会話ループに /go フックとコマンド可用性制御を導入、ビルダー用のスコープ解決、マニフェスト解析・適用・ロールバック、プロンプト文脈生成、承認抽出・検証、参照解析、および包括的なテストとドキュメントを追加しています。

Changes

Workflow Builder Feature

Layer / File(s) Summary
Conversation loop & command availability
src/features/interactive/conversationLoop.ts, src/features/interactive/slashCommandRegistry.ts, src/__tests__/conversationLoop-builder-go.test.ts, src/__tests__/slashCommandRegistry.test.ts
ConversationGoContextConversationStrategy の新フィールド(handleGo, disableDirectExecuteCommands, enableResumeCommand)を追加。/go は strategy.handleGo に委譲し null で継続、結果で即返す。/accept,/play の直接実行を戦略で抑止し、/resume の可用性をフラグで制御。対応テストを追加。
Builder types, constants & file utilities
src/features/workflowAuthoring/builder/types.ts, src/features/workflowAuthoring/builder/constants.ts, src/features/workflowAuthoring/builder/files.ts
ビルダー関連の型(スコープ/ターゲット/マニフェスト/差分/承認等)、フェイスタイプ→ディレクトリ等定数、ファイル列挙・読み込み・ワークフロー/ファセット判定、シンボリックリンク検出・安全性チェック、dual-language パスミラーリングを実装。
Scope selection & target workflow resolution
src/features/workflowAuthoring/builder/scope.ts, src/__tests__/workflow-builder.test.ts
project/global/builtins のスコープ選択肢生成、ResolvedBuilderScope の解決、builtins 利用可否判定、スコープ配下ワークフロー列挙を実装。
Manifest parsing, resolution & snapshot/rollback
src/features/workflowAuthoring/builder/manifest.ts, src/features/workflowAuthoring/builder/snapshot.ts
AI 応答から JSON マニフェストを抽出・解析、言語接頭辞対応で相対解決、書き込み安全性検証、ファイルスナップショット取得、差分算出、カテゴリ化、ロールバック処理を提供。
Workflow reference analysis & related candidates
src/features/workflowAuthoring/builder/workflowGraph.ts, src/infra/config/loaders/workflowDoctorRefValidator.ts
shared facet、workflow_call 親子関係、名前プレフィックス類似で関連候補を構築。facet 参照解決、workflow_call 解決と診断集約、doctor 側の参照収集拡張を実装。
Prompt system & builder prompt/context generation
src/features/workflowAuthoring/builder/promptContext.ts, src/shared/prompts/en/builder_system_prompt.md, src/shared/prompts/ja/builder_system_prompt.md, src/__tests__/prompts.test.ts
builder 用の system prompt テンプレート(en/ja)と buildBuilderPromptContext/buildBuilderSystemPrompt を追加。scopeSummary、assetInventory、targetContext、relatedGraph、styleGuide、yamlSchema を注入し、非信頼ブロックを安全な Markdown フェンスで包む。
Conversation-based approval extraction & validation
src/features/workflowAuthoring/builder/approval.ts, src/features/workflowAuthoring/builder/validation.ts, src/__tests__/workflow-builder.test.ts
会話履歴からの明示承認抽出(メンション/短縮ラベル/否定検出)を実装し、承認範囲に基づく変更違反検出(削除禁止、承認外変更、dual-language 同期違反、YAML 妥当性)と検証フィードバック生成を実装。
Builder workflow command with orchestration & error recovery
src/features/workflowAuthoring/builder/command.ts, src/__tests__/workflow-builder-command.test.ts
主要 CLI 実装 builderWorkflowCommand:セッション初期化→scope/target ウィザード→会話ループ起動(builder strategy)→/go ハンドラで AI 呼び出し→マニフェスト解析→事前違反検出→適用→検証→違反時ロールバック・履歴フィードバックを一貫実行。
CLI registration, re-exports & tests
src/features/workflowAuthoring/builder.ts, src/features/workflowAuthoring/index.ts, src/app/cli/commands.ts, src/__tests__/commands-workflow.test.ts, e2e/specs/cli-workflow-authoring.e2e.ts
builderWorkflowCommand を再エクスポートし、takt workflow builder を CLI に登録。ユニット/E2E テストで登録、説明、help 出力(builder 表示含む)、アクション委譲を検証。
Comprehensive tests, prompts and YAML references
src/__tests__/*, builtins/en/skill/references/yaml-schema.md, builtins/ja/skill/references/yaml-schema.md, src/shared/i18n/labels_en.yaml, src/shared/i18n/labels_ja.yaml
会話ループ、ビルダーコマンド、ビルダー機能群の包括的なテスト一式を追加。builder_system_prompt テンプレートとワークフロー YAML スキーマ参照ドキュメント(en/ja)を追加。UI 文言に未対応時の案内を追加。

Estimated code review effort: 🎯 4 (Complex) | ⏱️ ~60 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch takt/777/implement-workflow-builder

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/features/interactive/conversationLoop.ts (1)

242-257: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

/accept/play の拒否メッセージを i18n 化してください。

ここだけ固定英語文字列なので、ja ロケールでも英語表示になります。既存どおり interactive.ui のラベル経由に揃えた方がよいです。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/interactive/conversationLoop.ts` around lines 242 - 257, Replace
the hardcoded English refusal message inside the blocks that check
strategy.disableDirectExecuteCommands (both where SlashCommand.Accept and
SlashCommand.Play are handled) with an i18n lookup via the existing
interactive.ui labels instead of the literal 'Use /go to apply confirmed
changes.'; call the same ui label used elsewhere (e.g., ui.useGoToApply or add
that key under interactive.ui/locales if missing) and pass the result to info()
so the message is localized across locales.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/features/interactive/conversationLoop.ts`:
- Around line 364-366: The code displays the wrong message when resume is
disabled: in the branch checking strategy.enableResumeCommand === false it
currently calls ui.retryUnavailable; change that call to ui.resumeUnavailable
(or add that i18n string if missing) so the user sees a resume-specific message;
update any tests or callers referencing ui.retryUnavailable in this branch to
use ui.resumeUnavailable and keep the continue behavior in the conversationLoop
control flow.

In `@src/features/workflowAuthoring/builder/approval.ts`:
- Around line 54-83: The current fallback to latestAssistantCandidatePaths when
the user says `yes`/`ok` causes implicit approvals; change the logic so that
when hasMentionedCandidate is false you only use latestAssistantCandidatePaths
if the prior assistant message was an explicit approval request (use
isApprovalRequestMessage(...) on the assistant message that produced
latestAssistantCandidatePaths); otherwise require explicit path mentions and
skip approval. Update the branch around approved = hasMentionedCandidate ?
mentioned : latestAssistantCandidatePaths to check isApprovalRequestMessage(...)
and call removeApprovedBuilderCandidatePaths / addApprovedBuilderCandidatePath
accordingly.

In `@src/features/workflowAuthoring/builder/command.ts`:
- Around line 91-99: selectRequiredOption currently throws when selectOption
returns no selection, which causes the whole builderWorkflowCommand to reject on
simple user cancel; change selectRequiredOption to stop throwing and instead
return a nullable result (e.g., Promise<T | undefined>) when no selection is
made, so callers can handle an early return/abort gracefully; update the
selectRequiredOption signature and body to return undefined on cancel and then
update callers such as builderWorkflowCommand to check for falsy/undefined and
return early instead of relying on exceptions.
- Around line 132-141: When parseBuilderManifestForGo(...) returns falsy or
findBuilderChangeViolation(...) returns a plannedViolation, append the
validation feedback into goContext.history (same approach as in workflow
doctor/apply) instead of only logging to the terminal: call
buildBuilderValidationFeedback(...) with the appropriate inputs (e.g.,
options.scope, manifest or manifestChanges, and the error/violation message) and
push the result onto goContext.history before returning null; apply the same
change for the other block referenced around the 213-225 range so both
manifest-parse failures and approval-scope violations record feedback in
history.

In `@src/features/workflowAuthoring/builder/files.ts`:
- Around line 18-26: listFilesRecursive currently calls readdirSync on rootDir
even when rootDir is a regular file; add a directory check like the existing
symlink guard to return [] when lstatSync(rootDir).isDirectory() is false. In
other words, in function listFilesRecursive, after existsSync(rootDir) and
before calling readdirSync(rootDir), call lstatSync(rootDir) and if
!isDirectory() return []; this mirrors the symlink exclusion and prevents
ENOTDIR errors from readdirSync.

In `@src/features/workflowAuthoring/builder/manifest.ts`:
- Line 21: 現在の BUILDER_MANIFEST_JSON_BLOCK が最初のコードフェンス(json 指定なし)もマッチしてしまい説明用の
```yaml などで JSON.parse が失敗するので、まず ```json
を優先して抽出し、未指定フェンスはレスポンス全体が単一フェンスだった場合のみ許可するように修正してください: 定数を
BUILDER_MANIFEST_JSON_BLOCK = /```json\s*([\s\S]*?)```/i とし、別で
BUILDER_MANIFEST_SINGLE_FENCE = /^\s*```(?:json)?\s*([\s\S]*?)```\s*$/i
を定義、extractBuilderManifestJson(content: string) 内でまず BUILDER_MANIFEST_JSON_BLOCK
を試し、マッチしなければ BUILDER_MANIFEST_SINGLE_FENCE を試してマッチ時はそのグループを返し(trim
する)、どちらにもマッチしなければ元の content.trim() を返すようにしてください(関数名 extractBuilderManifestJson
と定数名を参照)。

In `@src/features/workflowAuthoring/builder/promptContext.ts`:
- Around line 71-88: The current buildScopeRelatedGraph function (and related
logic used at lines ~165-193) inlines full workflow and facet bodies for every
candidate, causing quadratic token growth; change buildScopeRelatedGraph to only
emit per-candidate metadata (path, relation, reason) by replacing/adjusting the
use of formatRelatedCandidates (or creating a new formatter) so it returns only
"path / relation / reason" entries, leaving out workflow/facet text, and ensure
buildRelatedWorkflowAnalysis consumers still provide candidate identifiers so
the actual bodies can be retrieved later on explicit "Read" requests during the
conversation.
- Around line 42-48: The buildBuilderSystemPrompt is injecting the Japanese
style guide because loadStyleGuide() (and similarly loadYamlSchema()) currently
always reads getLanguageResourcesDir('ja'); update buildBuilderSystemPrompt to
pass the lang through to the resource loaders so they load the matching language
(e.g., change calls to loadStyleGuide(lang) and loadYamlSchema(lang) or modify
those helpers to accept a language parameter), and apply the same change to the
other builder functions in the file (the block around lines 108-126) so English
prompts receive English resources and Japanese prompts receive Japanese
resources.

In `@src/features/workflowAuthoring/builder/validation.ts`:
- Around line 31-38: The loop over listBuilderTargetWorkflows currently calls
WorkflowConfigRawSchema.parse(parseYamlContent(workflow.path)) directly which
throws on any unreadable/invalid YAML and aborts facet-change resolution; wrap
the parse step in a try/catch (or reuse the same “skip unreadable workflow”
logic used by parseWorkflowForApprovalScope) so that if parseYamlContent or
WorkflowConfigRawSchema.parse fails you log or warn and continue to the next
workflow, then only call resolveUsedFacetPaths and potentially add
resolve(workflow.path) to targets for successfully parsed workflows.

---

Outside diff comments:
In `@src/features/interactive/conversationLoop.ts`:
- Around line 242-257: Replace the hardcoded English refusal message inside the
blocks that check strategy.disableDirectExecuteCommands (both where
SlashCommand.Accept and SlashCommand.Play are handled) with an i18n lookup via
the existing interactive.ui labels instead of the literal 'Use /go to apply
confirmed changes.'; call the same ui label used elsewhere (e.g.,
ui.useGoToApply or add that key under interactive.ui/locales if missing) and
pass the result to info() so the message is localized across locales.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d6d613d2-19eb-4794-91df-0ae90bd4510a

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd9018 and 5ad87a0.

📒 Files selected for processing (26)
  • e2e/specs/cli-workflow-authoring.e2e.ts
  • src/__tests__/commands-workflow.test.ts
  • src/__tests__/conversationLoop-builder-go.test.ts
  • src/__tests__/prompts.test.ts
  • src/__tests__/slashCommandRegistry.test.ts
  • src/__tests__/workflow-builder-command.test.ts
  • src/__tests__/workflow-builder.test.ts
  • src/app/cli/commands.ts
  • src/features/interactive/conversationLoop.ts
  • src/features/interactive/slashCommandRegistry.ts
  • src/features/workflowAuthoring/builder.ts
  • src/features/workflowAuthoring/builder/approval.ts
  • src/features/workflowAuthoring/builder/command.ts
  • src/features/workflowAuthoring/builder/constants.ts
  • src/features/workflowAuthoring/builder/files.ts
  • src/features/workflowAuthoring/builder/manifest.ts
  • src/features/workflowAuthoring/builder/promptContext.ts
  • src/features/workflowAuthoring/builder/scope.ts
  • src/features/workflowAuthoring/builder/snapshot.ts
  • src/features/workflowAuthoring/builder/types.ts
  • src/features/workflowAuthoring/builder/validation.ts
  • src/features/workflowAuthoring/builder/workflowGraph.ts
  • src/features/workflowAuthoring/index.ts
  • src/infra/config/loaders/workflowDoctorRefValidator.ts
  • src/shared/prompts/en/builder_system_prompt.md
  • src/shared/prompts/ja/builder_system_prompt.md

Comment thread src/features/interactive/conversationLoop.ts
Comment thread src/features/workflowAuthoring/builder/approval.ts
Comment thread src/features/workflowAuthoring/builder/command.ts Outdated
Comment thread src/features/workflowAuthoring/builder/command.ts Outdated
Comment thread src/features/workflowAuthoring/builder/files.ts
Comment thread src/features/workflowAuthoring/builder/manifest.ts Outdated
Comment thread src/features/workflowAuthoring/builder/promptContext.ts Outdated
Comment thread src/features/workflowAuthoring/builder/promptContext.ts
Comment thread src/features/workflowAuthoring/builder/validation.ts
@nrslib

nrslib commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

Summary

タスク指示書: PR #780 のレビューコメント対応と修正

タスク概要

PR #780[#777] implement-workflow-builder)で追加された takt workflow builder 関連実装について、PRコメントを含めて現在コード上で成立する指摘を修正する。
主対象は CodeRabbit の unresolved / active review comments に挙がっている不具合・UX・i18n・安全性・プロンプト肥大化・検証継続性の修正である。

対象

  • PR: #780
  • 関連 Issue: #777
  • 主な対象領域:
    • 対話モードの slash command 制御
    • workflow builder の承認判定
    • workflow builder の /go エラー回復
    • workflow builder のファイル列挙
    • builder manifest 抽出
    • builder system prompt context
    • builder validation 対象解決
    • 関連テスト

優先度: 高

src/features/interactive/conversationLoop.ts

  1. /resume 無効時の表示文言を修正する。

    • strategy.enableResumeCommand === false の分岐で /retry 用の文言を出している場合は、/resume 専用の i18n 文言を使う。
    • 既存の UI ラベル構造を確認し、必要なら resumeUnavailable 相当のキーを追加する。
    • 会話ループの continue 挙動は維持する。
  2. strategy.disableDirectExecuteCommands により /accept/play を拒否する場合の固定英語メッセージを i18n 化する。

    • 現在コードに 'Use /go to apply confirmed changes.' のような固定文字列が残っていれば、interactive.ui 配下のローカライズ済みラベル経由に変更する。
    • en / ja の両方で適切な文言が出るようにする。

i18n / locale 定義

  • conversationLoop.ts の修正に必要な UI ラベルが未定義なら、既存の locale 定義ファイルに追加する。
  • retryUnavailableresumeUnavailable が混同されないようにテストで確認する。

src/features/workflowAuthoring/builder/approval.ts

  1. yes / ok などのパス未明示承認が、直前の assistant の単なる候補列挙に結び付かないように修正する。
    • ユーザー発話に候補パスが明示されている場合は、その明示パスのみを承認対象にする。
    • ユーザー発話に候補パスがない場合は、直前の assistant 発話が明示的な承認依頼である場合のみ latestAssistantCandidatePaths を承認対象にする。
    • 直前の assistant 発話が承認依頼でない場合は、暗黙承認として扱わない。
    • 既存の isApprovalRequestMessage(...) がある場合は活用し、なければ承認依頼判定を追加する。
    • 承認・却下時の addApprovedBuilderCandidatePath / removeApprovedBuilderCandidatePaths の挙動を壊さない。

src/features/workflowAuthoring/builder/command.ts

  1. ウィザード中断を例外扱いにしない。

    • selectRequiredOptionselectOption() の未選択時に throw している場合、undefined などの nullable result を返すように変更する。
    • builderWorkflowCommand 側で未選択を検知して早期 return する。
    • scope 選択、target 選択、対象 workflow 選択など、同ヘルパーを使う全呼び出し箇所を更新する。
  2. /go の失敗理由を会話履歴へ戻す。

    • parseBuilderManifestForGo(...) 失敗時、端末出力だけで終わらせず、goContext.historybuildBuilderValidationFeedback(...) の結果を追加する。
    • findBuilderChangeViolation(...)plannedViolation を返す場合も、同様に goContext.history に feedback を追加する。
    • 該当箇所が複数ある場合はすべて対応する。
    • 直後の /go 再実行でモデルが前回失敗理由を参照できる状態にする。

src/features/workflowAuthoring/builder/manifest.ts

  1. manifest JSON 抽出で任意の最初のコードフェンスを採用しないように修正する。
    • ```json フェンスを優先して抽出する。
    • 未指定フェンスは、レスポンス全体が単一フェンスの場合のみ許可する。
    • 説明用の ```yaml などが先に出ても JSON.parse 対象にならないようにする。
    • extractBuilderManifestJson(content: string) の挙動をテストで固定する。

src/features/workflowAuthoring/builder/promptContext.ts

  1. buildBuilderSystemPrompt('en', ...) が英語リソースを読み、buildBuilderSystemPrompt('ja', ...) が日本語リソースを読むように修正する。

    • loadStyleGuide() / loadYamlSchema() が常に ja を読む実装になっていれば、lang を引き回す。
    • STYLE_GUIDE 群と yaml schema の両方で言語が一致することを確認する。
  2. 関連グラフのプロンプト注入内容をメタデータ中心にする。

    • buildScopeRelatedGraph / formatRelatedCandidates などが関連 workflow 本文や facet 本文を候補ごとに全文展開している場合、path / relation / reason など候補識別に必要な情報だけを出す。
    • 必要な本文は対話中に Read で取得できる前提で、候補識別子は残す。
    • target context など、明示的に選択された対象本文の注入まで削らない。

src/features/workflowAuthoring/builder/validation.ts

  1. facet 変更時の検証対象解決で、壊れた既存 workflow 1件により全体が例外終了しないようにする。
    • listBuilderTargetWorkflows(...) の走査中に parseYamlContentWorkflowConfigRawSchema.parse が失敗しても、その workflow をスキップして次へ進む。
    • 既存の parseWorkflowForApprovalScope(...) など、同等の「読めない workflow はスキップ」処理があれば再利用する。
    • 正常に parse できた workflow だけに resolveUsedFacetPaths(...) を実行する。

優先度: 中

src/features/workflowAuthoring/builder/files.ts

  1. listFilesRecursive(rootDir, extensions)rootDir が通常ファイルの場合に readdirSync() で落ちないようにする。
    • existsSync(rootDir) 後に lstatSync(rootDir) を取得する。
    • symlink の場合は従来どおり [] を返す。
    • !isDirectory() の場合も [] を返す。
    • 既存の除外ルールや拡張子フィルタは維持する。

テスト

以下の既存テストを確認し、必要に応じて追加・更新する。

  • src/__tests__/conversationLoop-builder-go.test.ts

    • /accept / /play 拒否メッセージの i18n 化
    • /resume 無効時に resume 専用メッセージが使われること
    • /go handler が null を返した後も会話継続できること
  • src/__tests__/workflow-builder-command.test.ts

    • wizard 選択キャンセル時に builderWorkflowCommand が reject せず早期終了すること
    • manifest parse 失敗時に goContext.history へ feedback が追加されること
    • approval scope / planned violation 失敗時に goContext.history へ feedback が追加されること
  • src/__tests__/workflow-builder.test.ts

    • パス未明示 yes / ok が、承認依頼でない assistant 発話の候補を暗黙承認しないこと
    • 承認依頼直後の yes / ok は既存の承認フローとして機能すること
    • listFilesRecursive が通常ファイル root で [] を返すこと
    • manifest 抽出が json フェンス優先、単一未指定フェンスのみ許可になること
    • buildBuilderSystemPrompten / ja で対応言語の STYLE_GUIDE / yaml schema を注入すること
    • 関連グラフが workflow/facet 本文を大量展開せず、候補 metadata を含むこと
    • 壊れた workflow が混在しても facet 変更の検証対象解決が継続すること
  • src/__tests__/prompts.test.ts

    • builder system prompt のテンプレート読み込み・変数注入に影響があれば更新する。

優先度: 低

PR コメント対応記録

  • PR [#777] implement-workflow-builder #780 の各 review comment について、最終レポートに以下を簡潔に記録する。
    • 対応したコメント
    • 現在コードでは成立せずスキップしたコメント
    • スキップ理由
  • CodeRabbit の docstring coverage warning は、今回の PR コメント修正と直接関係するコード上の不具合でなければ、対応対象外として扱ってよい。

確認方法

最低限、以下を実行して結果を記録する。

npm test
npm run lint
npm run build

変更範囲が限定される場合でも、関連テストは個別に実行してから全体確認を行う。

npm test -- src/__tests__/conversationLoop-builder-go.test.ts
npm test -- src/__tests__/workflow-builder-command.test.ts
npm test -- src/__tests__/workflow-builder.test.ts
npm test -- src/__tests__/prompts.test.ts

完了条件

  • PR [#777] implement-workflow-builder #780 の現在コード上で成立する unresolved / active review comments が修正されている。
  • 修正に対応するテストが追加または更新されている。
  • npm testnpm run lintnpm run build の結果が記録されている。
  • 各 PR コメントへの対応状況が最終レポートにまとまっている。
  • 既存の takt workflow builder の主要要件を壊していない。

Execution Report

Workflow review-fix-takt-default completed successfully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
src/features/workflowAuthoring/builder/command.ts (1)

89-92: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

空のスコープで modify を選ぶと、通常操作なのにコマンド全体が例外終了します。

ここだけ throw のままなので、ワークフロー未作成のプロジェクトで誤って「Modify」を選ぶと builderWorkflowCommand() が reject します。キャンセル時と同じく、案内して早期 return に寄せないと対話型 CLI の中断経路が不安定です。

修正案
   const workflows = listBuilderTargetWorkflows(scope);
   if (workflows.length === 0) {
-    throw new Error('No workflow files found in the selected scope.');
+    info('No workflow files found in the selected scope.');
+    return undefined;
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/workflowAuthoring/builder/command.ts` around lines 89 - 92, The
code currently throws when listBuilderTargetWorkflows(scope) returns an empty
array, causing builderWorkflowCommand() to reject; change this behavior to
mirror the user-cancel path: detect workflows.length === 0, print an informative
message to the user (or use the existing CLI logger), and return early from
builderWorkflowCommand instead of throwing so the interactive flow continues
gracefully. Update the conditional around listBuilderTargetWorkflows(scope) to
avoid throwing and ensure any callers expect a normal return rather than an
exception.
src/features/workflowAuthoring/builder/approval.ts (1)

67-89: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

混在した承認/拒否を 1 セグメントで送ると、言及した候補を全部外してしまいます。

isExplicitRejectionLine() に先に入るので、edit workflows/a.yaml but don't edit workflows/b.yaml のような文でも mentioned 全体が rejected 扱いになり、Line 85 のパス単位除外まで到達しません。これだと関連編集の一部だけ承認する返答を正しく表現できません。

💡 修正イメージ
+      const normalizedSegment = segment.trim().toLowerCase();
+      const hasMentionedCandidate = mentioned.size > 0;
-      if (isExplicitRejectionLine(segment.trim().toLowerCase())) {
+      if (isExplicitRejectionLine(normalizedSegment) && !isExplicitApprovalLine(segment, hasMentionedCandidate)) {
         const rejected = mentioned.size > 0
           ? mentioned
           : latestAssistantAskedForApproval ? latestAssistantCandidatePaths : new Set<string>();
         removeApprovedBuilderCandidatePaths(scope, candidates, approvedWorkflowPaths, approvedFacetPaths, rejected);
         continue;
       }
-      const hasMentionedCandidate = mentioned.size > 0;
       if (!isExplicitApprovalLine(segment, hasMentionedCandidate)) {
         continue;
       }

Based on learnings: 「AI生成コードの認証・認可ロジックを厳しく審査し、エッジケースの見落としを検出する」。

Also applies to: 220-236

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/workflowAuthoring/builder/approval.ts` around lines 67 - 89, The
current logic treats any segment flagged by isExplicitRejectionLine(...) as
rejecting the entire mentioned set, causing mixed "approve X but reject Y"
segments like "edit workflows/a.yaml but don't edit workflows/b.yaml" to
incorrectly remove all mentioned candidates; instead, change the flow to decide
approval/rejection per candidate: do not call
removeApprovedBuilderCandidatePaths(...) with the whole mentioned set up-front;
iterate mentioned candidates (or iterate candidates and check membership in
mentioned) and for each candidate call pathIsRejectedInText(scope,
candidate.filePath, segment, candidates.map(...)) to determine rejection and
otherwise check isExplicitApprovalLine(...) (or use isExplicitRejectionLine(...)
scoped to the candidate) and call removeApprovedBuilderCandidatePath(...) or
addApprovedBuilderCandidatePath(...) accordingly; alternately swap the guards so
per-candidate rejection is determined after per-candidate approval checks rather
than blanket-rejecting the entire mentioned set.
src/features/workflowAuthoring/builder/workflowGraph.ts (1)

44-49: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

壊れた sibling workflow 1 件で関連グラフ全体が落ちます。

ここは候補走査中の各 workflow を loadRawWorkflow() で無条件に読み込んでいるので、無関係な 1 ファイルでも YAML/Schema エラーがあると buildRelatedWorkflowAnalysis() 自体が例外で終了します。src/features/workflowAuthoring/builder/promptContext.ts の Line 71-88 ではこれをスコープ内の全 workflow に対して呼ぶため、create / unspecified モードでも builder の prompt 構築全体が失敗します。sibling 側の parse failure は診断に落として skip しないと、既存の壊れた workflow があるだけで builder を起動できません。

💡 最小修正案
   for (const workflow of listBuilderTargetWorkflows(options.scope)) {
     if (resolve(workflow.path) === resolve(options.targetWorkflowPath)) {
       continue;
     }
-    const raw = loadRawWorkflow(workflow.path);
+    let raw: RawWorkflow;
+    try {
+      raw = loadRawWorkflow(workflow.path);
+    } catch (error) {
+      diagnostics.push(
+        `Skipped related workflow analysis for ${formatBuilderWorkflowPath(options.scope, workflow.path)}.`,
+      );
+      continue;
+    }
     const workflowFacets = resolveUsedFacetPaths(options.scope, raw, workflow.path);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/workflowAuthoring/builder/workflowGraph.ts` around lines 44 -
49, The loop that iterates listBuilderTargetWorkflows unconditionally calls
loadRawWorkflow (and then resolveUsedFacetPaths) so a YAML/schema parse error in
any sibling workflow throws and aborts buildRelatedWorkflowAnalysis; wrap the
per-workflow load/resolve in a try/catch, on error push a diagnostic/validation
error for that workflow (so callers like the prompt builder see the failure) and
continue to the next workflow instead of rethrowing—adjust the block around
loadRawWorkflow and resolveUsedFacetPaths in buildRelatedWorkflowAnalysis (and
code paths used by promptContext) to catch parse/validation errors, record them,
and skip that workflow.
builtins/en/skill/references/yaml-schema.md (1)

1-169: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

英語版の YAML schema 参照が日本語版より大幅に欠けています。

buildBuilderSystemPrompt('en', ...) はこのファイルをそのまま英語 builder の schema source として注入しますが、現状は builtins/ja/skill/references/yaml-schema.md にある output_contracts / quality_gates / テンプレート変数 / 詳細な loop_monitors / allowed_tools の説明が英語版にありません。これだと locale ごとに builder が受け取る制約が変わってしまい、英語側だけ不完全な YAML を提案しやすくなります。少なくとも日本語版と同じ契約面は揃えておいた方が安全です。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@builtins/en/skill/references/yaml-schema.md` around lines 1 - 169, The
English YAML schema (used by buildBuilderSystemPrompt('en', ...)) is missing
several contract fields present in the Japanese schema (output_contracts,
quality_gates, template variables, detailed loop_monitors, allowed_tools), which
causes inconsistent builder constraints per locale; update the English schema
document (yaml-schema.md) to mirror the Japanese version by adding the missing
sections and their detailed descriptions (output_contracts, quality_gates,
template/template-variable usage, loop_monitors examples, allowed_tools
semantics and examples) so the builder injected by
buildBuilderSystemPrompt('en', ...) receives the same contract surface as the
Japanese schema and ensure any validation or generation logic that reads those
keys remains compatible.
♻️ Duplicate comments (2)
src/features/workflowAuthoring/builder/manifest.ts (1)

21-22: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

単一の bare code fence が同一行だと、まだ manifest を取り出せません。

SINGLE_UNTYPED_CODE_BLOCK が改行必須なので、LLM がレスポンス全体を ```````{"summary":"...","changes":[]}````` のような 1 行 fence で返すと unwrap されず、そのまま JSON.parse() が失敗します。レスポンス全体が単一 fence のときは、改行の有無に関係なく剥がした方が安全です。

💡 修正イメージ
-const SINGLE_UNTYPED_CODE_BLOCK = /^```\s*\r?\n([\s\S]*?)```$/;
+const SINGLE_UNTYPED_CODE_BLOCK = /^```\s*([\s\S]*?)```$/;

Based on learnings: 「AI生成コードの入力バリデーションを厳しく審査し、構文検証だけでなく意味的バリデーションを確認する」。

Also applies to: 75-82

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/workflowAuthoring/builder/manifest.ts` around lines 21 - 22,
SINGLE_UNTYPED_CODE_BLOCK currently requires a newline after the opening ``` so
one-line bare fences like ```{"summary":"...","changes":[]}``` aren't unwrapped
and later JSON.parse fails; update the regex for SINGLE_UNTYPED_CODE_BLOCK (and
the duplicate occurrence around the 75-82 region) to allow optional
whitespace/newline after the opening fence (i.e., change from
/^```\\s*\\r?\\n([\\s\\S]*?)```$/ to a pattern that does not mandate the
newline, e.g., /^```\\s*([\\s\\S]*?)```$/) so single-line fenced JSON is
correctly captured before parsing.
src/features/workflowAuthoring/builder/validation.ts (1)

224-235: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

read 失敗はまだ skip されていません。

この helper は YAML/Schema の失敗を undefined に落とせていますが、Line 225 の readFileSync() はその前に throw します。権限エラーや壊れた symlink が 1 件あるだけで、resolveBuilderValidationTargets()collectFacetPathsReferencedByUnapprovedWorkflows() が再び全体中断になります。read 失敗もここで明示的に skip 扱いにしてください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/workflowAuthoring/builder/validation.ts` around lines 224 - 235,
The helper parseWorkflowForApprovalScope currently calls
readFileSync(workflowPath) which can throw and abort higher-level flows like
resolveBuilderValidationTargets and
collectFacetPathsReferencedByUnapprovedWorkflows; wrap the file read in a
try/catch so any IO errors (permission, broken symlink, etc.) cause the function
to return undefined (skip) instead of throwing, then proceed with parseDocument,
convertYamlDocumentForApprovalScope, and WorkflowConfigRawSchema.safeParse as
before; ensure you reference parseWorkflowForApprovalScope and readFileSync to
locate the change and keep the existing return shape (undefined on any failure).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/features/workflowAuthoring/builder/command.ts`:
- Line 47: Replace hard-coded English UI strings in command.ts with i18n keys:
add the new keys for the wizard labels/progress/failure messages to the YAML
files under src/shared/i18n/* and ensure they are included in the dist build,
then load a translator using ctx.lang and use it where the strings are currently
passed to selectRequiredOption, in the wizard prompts and progress/failure
messages (the same area that calls buildBuilderSystemPrompt(ctx.lang, ...)),
replacing the literal strings referenced around selectRequiredOption and the
following wizard/display calls with translator(key) lookups so the UI follows
ctx.lang.

---

Outside diff comments:
In `@builtins/en/skill/references/yaml-schema.md`:
- Around line 1-169: The English YAML schema (used by
buildBuilderSystemPrompt('en', ...)) is missing several contract fields present
in the Japanese schema (output_contracts, quality_gates, template variables,
detailed loop_monitors, allowed_tools), which causes inconsistent builder
constraints per locale; update the English schema document (yaml-schema.md) to
mirror the Japanese version by adding the missing sections and their detailed
descriptions (output_contracts, quality_gates, template/template-variable usage,
loop_monitors examples, allowed_tools semantics and examples) so the builder
injected by buildBuilderSystemPrompt('en', ...) receives the same contract
surface as the Japanese schema and ensure any validation or generation logic
that reads those keys remains compatible.

In `@src/features/workflowAuthoring/builder/approval.ts`:
- Around line 67-89: The current logic treats any segment flagged by
isExplicitRejectionLine(...) as rejecting the entire mentioned set, causing
mixed "approve X but reject Y" segments like "edit workflows/a.yaml but don't
edit workflows/b.yaml" to incorrectly remove all mentioned candidates; instead,
change the flow to decide approval/rejection per candidate: do not call
removeApprovedBuilderCandidatePaths(...) with the whole mentioned set up-front;
iterate mentioned candidates (or iterate candidates and check membership in
mentioned) and for each candidate call pathIsRejectedInText(scope,
candidate.filePath, segment, candidates.map(...)) to determine rejection and
otherwise check isExplicitApprovalLine(...) (or use isExplicitRejectionLine(...)
scoped to the candidate) and call removeApprovedBuilderCandidatePath(...) or
addApprovedBuilderCandidatePath(...) accordingly; alternately swap the guards so
per-candidate rejection is determined after per-candidate approval checks rather
than blanket-rejecting the entire mentioned set.

In `@src/features/workflowAuthoring/builder/command.ts`:
- Around line 89-92: The code currently throws when
listBuilderTargetWorkflows(scope) returns an empty array, causing
builderWorkflowCommand() to reject; change this behavior to mirror the
user-cancel path: detect workflows.length === 0, print an informative message to
the user (or use the existing CLI logger), and return early from
builderWorkflowCommand instead of throwing so the interactive flow continues
gracefully. Update the conditional around listBuilderTargetWorkflows(scope) to
avoid throwing and ensure any callers expect a normal return rather than an
exception.

In `@src/features/workflowAuthoring/builder/workflowGraph.ts`:
- Around line 44-49: The loop that iterates listBuilderTargetWorkflows
unconditionally calls loadRawWorkflow (and then resolveUsedFacetPaths) so a
YAML/schema parse error in any sibling workflow throws and aborts
buildRelatedWorkflowAnalysis; wrap the per-workflow load/resolve in a try/catch,
on error push a diagnostic/validation error for that workflow (so callers like
the prompt builder see the failure) and continue to the next workflow instead of
rethrowing—adjust the block around loadRawWorkflow and resolveUsedFacetPaths in
buildRelatedWorkflowAnalysis (and code paths used by promptContext) to catch
parse/validation errors, record them, and skip that workflow.

---

Duplicate comments:
In `@src/features/workflowAuthoring/builder/manifest.ts`:
- Around line 21-22: SINGLE_UNTYPED_CODE_BLOCK currently requires a newline
after the opening ``` so one-line bare fences like
```{"summary":"...","changes":[]}``` aren't unwrapped and later JSON.parse
fails; update the regex for SINGLE_UNTYPED_CODE_BLOCK (and the duplicate
occurrence around the 75-82 region) to allow optional whitespace/newline after
the opening fence (i.e., change from /^```\\s*\\r?\\n([\\s\\S]*?)```$/ to a
pattern that does not mandate the newline, e.g., /^```\\s*([\\s\\S]*?)```$/) so
single-line fenced JSON is correctly captured before parsing.

In `@src/features/workflowAuthoring/builder/validation.ts`:
- Around line 224-235: The helper parseWorkflowForApprovalScope currently calls
readFileSync(workflowPath) which can throw and abort higher-level flows like
resolveBuilderValidationTargets and
collectFacetPathsReferencedByUnapprovedWorkflows; wrap the file read in a
try/catch so any IO errors (permission, broken symlink, etc.) cause the function
to return undefined (skip) instead of throwing, then proceed with parseDocument,
convertYamlDocumentForApprovalScope, and WorkflowConfigRawSchema.safeParse as
before; ensure you reference parseWorkflowForApprovalScope and readFileSync to
locate the change and keep the existing return shape (undefined on any failure).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 38b5e8ad-5bd3-425a-a03b-4d84b42015e6

📥 Commits

Reviewing files that changed from the base of the PR and between 5ad87a0 and 24396a5.

📒 Files selected for processing (18)
  • builtins/en/skill/references/yaml-schema.md
  • builtins/ja/skill/references/yaml-schema.md
  • src/__tests__/conversationLoop-builder-go.test.ts
  • src/__tests__/workflow-builder-command.test.ts
  • src/__tests__/workflow-builder.test.ts
  • src/features/interactive/conversationLoop.ts
  • src/features/interactive/interactive.ts
  • src/features/workflowAuthoring/builder/approval.ts
  • src/features/workflowAuthoring/builder/command.ts
  • src/features/workflowAuthoring/builder/constants.ts
  • src/features/workflowAuthoring/builder/files.ts
  • src/features/workflowAuthoring/builder/manifest.ts
  • src/features/workflowAuthoring/builder/promptContext.ts
  • src/features/workflowAuthoring/builder/types.ts
  • src/features/workflowAuthoring/builder/validation.ts
  • src/features/workflowAuthoring/builder/workflowGraph.ts
  • src/shared/i18n/labels_en.yaml
  • src/shared/i18n/labels_ja.yaml
💤 Files with no reviewable changes (1)
  • src/features/workflowAuthoring/builder/types.ts

const ctx = initializeSession(options.projectDir, 'workflow-builder');
displayAndClearSessionState(options.projectDir, ctx.lang);

const scopeKind = await selectRequiredOption('Select output scope:', buildBuilderScopeChoices(options.projectDir));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

ビルダーの新規 UI 文言が i18n を通っていません。

ctx.lang で言語は解決できていて、system prompt も buildBuilderSystemPrompt(ctx.lang, ...) で分岐している一方、ウィザード文言・進捗表示・失敗案内は英語固定です。ja 環境ではこのコマンドだけ混在表示になるので、今回追加した表示文言はラベル化した方がよいです。As per coding guidelines, src/shared/i18n/*.yaml: Define internationalization strings in YAML under src/shared/i18n/; copy to dist/ during build.

Also applies to: 63-63, 77-80, 93-95, 124-124, 133-153, 172-172, 247-247, 275-275

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/workflowAuthoring/builder/command.ts` at line 47, Replace
hard-coded English UI strings in command.ts with i18n keys: add the new keys for
the wizard labels/progress/failure messages to the YAML files under
src/shared/i18n/* and ensure they are included in the dist build, then load a
translator using ctx.lang and use it where the strings are currently passed to
selectRequiredOption, in the wizard prompts and progress/failure messages (the
same area that calls buildBuilderSystemPrompt(ctx.lang, ...)), replacing the
literal strings referenced around selectRequiredOption and the following
wizard/display calls with translator(key) lookups so the UI follows ctx.lang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: takt workflow builder — AI と対話してワークフローを作る

1 participant