create-conductor-flow 1.3.1 → 1.3.3

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 CHANGED
@@ -182,7 +182,6 @@ Examples:
182
182
  The CLI remembers your preferences between runs, so you don't have to specify the same options every time.
183
183
 
184
184
  **What's Saved:**
185
- - Agent selection (`--agent`)
186
185
  - Template source (`--repo`, `--branch`)
187
186
  - Git ignore preference (`--git-ignore`)
188
187
 
@@ -197,9 +196,8 @@ The CLI remembers your preferences between runs, so you don't have to specify th
197
196
  # First run - specify your preferences
198
197
  npm create conductor-flow --agent claude-code --git-ignore exclude
199
198
 
200
- # Future runs - automatically uses claude-code and exclude
199
+ # Future runs - automatically uses exclude
201
200
  npm create conductor-flow
202
- # Output: [Config] Using saved agent: claude-code
203
201
  # Output: [Config] Using saved git-ignore: exclude
204
202
  ```
205
203
 
@@ -0,0 +1,62 @@
1
+ import cr from"yargs";import{hideBin as lr}from"yargs/helpers";import Fe from"@inquirer/select";var q={agentType:"opencode",agentDir:".opencode",commandsDir:"commands",displayName:"OpenCode",protocolFilename:"AGENTS.md",description:"The open source AI coding agent"};var K={agentType:"claude-code",agentDir:".claude",commandsDir:"commands",displayName:"Claude Code",protocolFilename:"CLAUDE.md",description:"Anthropic's coding assistant"};var X={agentType:"antigravity",agentDir:".agent",commandsDir:"workflows",displayName:"Antigravity",protocolFilename:"GEMINI.md",description:"Google's agentic coding assistant"};var z={agentType:"cursor",agentDir:".cursor",commandsDir:"commands",displayName:"Cursor",protocolFilename:"AGENTS.md",description:"Cursor IDE's AI agent"};import{parse as fo}from"smol-toml";import{readFile as ao}from"fs/promises";import{join as at,resolve as nt}from"path";import{fileURLToPath as co}from"url";import{execSync as it}from"child_process";import{createHash as lo}from"crypto";import B from"fs-extra";import{join as ot}from"path";import{homedir as oo}from"os";import j from"fs-extra";import{join as T}from"path";import{homedir as ze,platform as Je}from"os";import F from"fs-extra";var N="create-conductor-flow",to="config.json";function Qe(){if(process.env.CONDUCTOR_CONFIG_DIR)return process.env.CONDUCTOR_CONFIG_DIR;if(process.env.XDG_CONFIG_HOME)return T(process.env.XDG_CONFIG_HOME,N);let t=ze();switch(Je()){case"win32":return T(process.env.APPDATA||T(t,"AppData","Roaming"),N);case"darwin":return T(t,".config",N);default:return T(t,".config",N)}}function Ze(){if(process.env.CONDUCTOR_CACHE_DIR)return process.env.CONDUCTOR_CACHE_DIR;if(process.env.XDG_CACHE_HOME)return T(process.env.XDG_CACHE_HOME,N);let t=ze();switch(Je()){case"win32":return T(process.env.LOCALAPPDATA||T(t,"AppData","Local"),N);case"darwin":return T(t,".cache",N);default:return T(t,".cache",N)}}function Ie(){return T(Qe(),to)}async function Te(){try{let t=Ie();if(!await F.pathExists(t))return{};let e=await F.readFile(t,"utf-8"),o=JSON.parse(e);return typeof o!="object"||o===null||Array.isArray(o)?(console.warn("[Config] Invalid config format, using defaults"),{}):o}catch(t){return t instanceof SyntaxError&&console.warn("[Config] Config file corrupted, using defaults"),{}}}async function et(t){let e=Ie(),o=Qe();await F.ensureDir(o);let n={...await Te(),...t};await F.writeJson(e,n,{spaces:2})}async function tt(){let t=Ie();await F.pathExists(t)&&await F.remove(t)}var ro=".gemini/cache/conductor",no="templates";function io(){return process.env.CONDUCTOR_LEGACY_CACHE_DIR?process.env.CONDUCTOR_LEGACY_CACHE_DIR:ot(oo(),ro)}function we(){return ot(Ze(),no)}async function so(t){return await j.pathExists(t)?(await j.readdir(t)).length===0:!0}async function rt(){let t=io(),e=we();try{return await j.pathExists(t)?await so(e)?(console.log(`[Migration] Migrating cache from ${t} to ${e}...`),await j.ensureDir(e),await j.copy(t,e,{overwrite:!1}),console.log("[Migration] Cache migration completed successfully"),console.log(`[Migration] You can safely remove the old cache at: ${t}`),!0):(console.log("[Migration] New cache already exists, skipping migration"),console.log(`[Migration] You can safely remove the old cache at: ${t}`),!1):!1}catch(o){return console.warn("[Migration] Failed to migrate cache:",o instanceof Error?o.message:o),!1}}var st=co(new URL(".",import.meta.url)),R="https://github.com/gemini-cli-extensions/conductor",O="main";function po(t=R,e=O){let o=lo("md5").update(`${t}#${e}`).digest("hex");return at(we(),o)}function ct(t=R,e=O){return po(t,e)}async function go(t=R,e=O){let o=ct(t,e);if(B.existsSync(o))try{console.log(`Updating templates from ${t} [${e}]...`),it("git pull --rebase",{cwd:o,stdio:["ignore","ignore","pipe"]})}catch(r){console.warn(`Failed to update templates (using cached version): ${r instanceof Error?r.message:String(r)}`)}else{await B.ensureDir(o),console.log(`Downloading templates from ${t} [${e}]...`);try{it(`git clone ${t} --branch ${e} --depth 1 .`,{cwd:o,stdio:["ignore","ignore","pipe"]})}catch(r){throw await B.remove(o),new Error(`Failed to clone templates: ${r instanceof Error?r.message:String(r)}`)}}}function h(t,e){return t.replace(/\{(\w+)\}/g,(o,r)=>Object.prototype.hasOwnProperty.call(e,r)?e[r]:o)}function mo(){let t=nt(st,"conductor");return B.existsSync(t)?t:nt(st,"../conductor")}async function lt(t,e){if(!t){let o=mo();if(await B.pathExists(o))return console.log("use bundled Conductor templates"),o}return await go(t,e),ct(t,e)}async function pt(t,e){let o=at(e,t);return ao(o,"utf-8")}var k="conductor-",x="~/.gemini/extensions/conductor";var Ee=class{process(e,o){let{installPath:r,agentType:n,fixedAgent:i}=o,s=fo(e);if(!s.prompt)return null;let l=s.prompt;l=l.replaceAll(x,r);let p=h(l,{agent_type:n});return`---
2
+ description: ${s.description||""}
3
+ agent: ${i}
4
+ ---
5
+ ${p}`}},gt=new Ee;var J={agentType:"github-copilot",agentDir:".github",commandsDir:"prompts",displayName:"Github Copilot",protocolFilename:"AGENTS.md",description:"Github Copilot's Prompt Files",extension:".prompt.md",fixedAgent:"agent",strategy:{content:gt}};var Q={agentType:"codex",agentDir:".codex",commandsDir:"prompts",displayName:"Codex",protocolFilename:"AGENTS.md",description:"OpenAI Codex Agent",extension:".md"};var Z={agentType:"windsurf",agentDir:".windsurf",commandsDir:"workflows",displayName:"Windsurf",protocolFilename:"AGENTS.md",description:"Windsurf Cascade AI Agent"};import{parse as uo}from"smol-toml";var ve=class{process(e,o){let{installPath:r,agentType:n,commandName:i}=o,s=uo(e);if(!s.prompt)return null;let l=s.prompt;l=l.replaceAll(x,r);let p=h(l,{agent_type:n});return`# Conductor ${i?i.charAt(0).toUpperCase()+i.slice(1):"Command"}${s.description?`
6
+
7
+ `+s.description+`
8
+
9
+ `:`
10
+
11
+ `}${p}`}},mt=new ve;var ee={agentType:"cline",agentDir:".clinerules",commandsDir:"workflows",displayName:"Cline",protocolFilename:"AGENTS.md",description:"Cline AI coding assistant",strategy:{content:mt}};import{join as yo}from"path";import Co from"fs-extra";import{parse as xo}from"smol-toml";var{writeFile:ho}=Co,Oe=class{process(e,o){let{installPath:r,agentType:n}=o;if(!xo(e).prompt)return null;let s=e.replaceAll(x,r);return h(s,{agent_type:n})}},be=class{async write(e){let{targetDir:o,agentDir:r,commandsDir:n,commandName:i,extension:s,content:l}=e,p=`${i}${s}`;await ho(yo(o,r,n,p),l)}},ft=new Oe,dt=new be;var te={agentType:"gemini",agentDir:".gemini",commandsDir:"commands/conductor",displayName:"Gemini CLI",protocolFilename:"GEMINI.md",description:"Google Gemini CLI agent",extension:".toml",usesPrefix:!1,strategy:{content:ft,file:dt}};import{parse as _o}from"smol-toml";var Ne=class{process(e,o){let{installPath:r,agentType:n,commandName:i}=o,s=_o(e);if(!s.prompt)return null;let l=s.prompt;l=l.replaceAll(x,r);let p=h(l,{agent_type:n});return`# Conductor ${i?i.charAt(0).toUpperCase()+i.slice(1):"Command"}${s.description?`
12
+
13
+ `+s.description+`
14
+
15
+ `:`
16
+
17
+ `}${p}`}},ut=new Ne;var oe={agentType:"kilo-code",agentDir:".kilocode",commandsDir:"workflows",displayName:"Kilo Code",protocolFilename:"AGENTS.md",description:"Kilo Code AI coding assistant",strategy:{content:ut}};import{parse as Ao}from"smol-toml";var De=class{process(e,o){let{installPath:r,agentType:n,commandName:i}=o,s=Ao(e);if(!s.prompt)return null;let l=s.prompt;l=l.replaceAll(x,r);let p=h(l,{agent_type:n});return`# Conductor ${i?i.charAt(0).toUpperCase()+i.slice(1):"Command"}${s.description?`
18
+
19
+ `+s.description+`
20
+
21
+ `:`
22
+
23
+ `}${p}`}},yt=new De;var re={agentType:"roo-code",agentDir:".roo",commandsDir:"commands",displayName:"Roo Code",protocolFilename:"AGENTS.md",description:"Roo Code AI coding assistant",strategy:{content:yt}};import{parse as So}from"smol-toml";var Ge=class{process(e,o){let{installPath:r,agentType:n}=o,i=So(e);if(!i.prompt)return null;let s=i.prompt;s=s.replaceAll(x,r);let l=h(s,{agent_type:n}),p="";return i.description&&(p=`---
24
+ description: "${i.description.replace(/"/g,'\\"')}"
25
+ ---
26
+
27
+ `),`${p}${l}`}},Ct=new Ge;var ne={agentType:"qwen-code",agentDir:".qwen",commandsDir:"commands",displayName:"Qwen Code",protocolFilename:"AGENTS.md",description:"Qwen Code AI coding assistant",strategy:{content:Ct}};import{parse as Io}from"smol-toml";var Re=class{process(e,o){let{installPath:r,agentType:n}=o,i=Io(e);if(!i.prompt)return null;let s=i.prompt;s=s.replaceAll(x,r);let l=h(s,{agent_type:n}),p="";return i.description&&(p=`---
28
+ description: "${i.description.replace(/"/g,'\\"')}"
29
+ ---
30
+
31
+ `),`${p}${l}`}},ht=new Re;var ie={agentType:"factory-droid",agentDir:".factory",commandsDir:"commands",displayName:"Factory Droid",protocolFilename:"AGENTS.md",description:"Factory Droid AI coding assistant",strategy:{content:ht}};var L=[q,K,X,z,J,Q,Z,ee,oe,re,ne,ie,te];async function xt(t){let e=t==="codex",o=t==="cline";return await Fe({message:"Select installation method:",choices:e?[{name:"Global (User Home Directory)",value:"global"}]:[{name:"Project (Current Directory)",value:"project"}],default:e?"global":"project"})}async function _t(){let t=L.map(o=>{let{displayName:r,agentType:n,protocolFilename:i,agentDir:s,commandsDir:l,description:p}=o,d=p||`${r} agent`,_=`\x1B[90m(${i}, ${s}/${l})\x1B[0m`;return{name:`${r} ${_}`,value:n,description:d}});return await Fe({message:"Select your coding agent:",choices:t,default:"opencode",loop:!0})}async function At(){return await Fe({message:"Configure git ignore for Conductor files?",choices:[{name:"Add to .gitignore",value:"gitignore",description:"Add Conductor entries to the project's .gitignore file"},{name:"Add to .git/info/exclude",value:"exclude",description:"Add Conductor entries to .git/info/exclude (local only, not shared)"},{name:"Remove existing entries",value:"none",description:"Remove Conductor entries from both .gitignore and .git/info/exclude"},{name:"Don't configure git ignore",value:void 0,description:"Skip git ignore configuration"}],default:void 0})}import{join as To}from"path";import wo from"fs-extra";import{parse as vo}from"smol-toml";var{writeFile:Eo}=wo,Le=class{process(e,o){let{installPath:r,agentType:n}=o,i=vo(e);if(!i.prompt)return null;let s=i.prompt;s=s.replaceAll(x,r),s=s.replace(/\/conductor:/g,`/${k}`);let l=h(s,{agent_type:n});return i.description?`---
32
+ description: ${i.description}
33
+ ---
34
+ ${l}`:l}},Pe=class{async write(e){let{targetDir:o,agentDir:r,commandsDir:n,commandName:i,extension:s,content:l}=e,p=`${k}${i}${s}`;await Eo(To(o,r,n,p),l)}},St=new Le,It=new Pe;import{join as A,posix as Oo}from"path";import bo from"@inquirer/select";import wt from"fs-extra";var{existsSync:D,ensureDir:Tt,copy:Me}=wt,E=class{constructor(e){this.config=e}async validate(e,o){if(!D(e))throw new Error(`Target directory does not exist: ${e}`);let{agentDir:r,commandsDir:n,displayName:i,extension:s,usesPrefix:l}=this.config,_=`${l!==!1?k:""}setup${s||".md"}`,C=A(e,r,n,_),g=A(e,r,"conductor");if(D(g)&&D(C))throw new Error(`Conductor (${i}) is already installed in: ${e}`);return e}async generate(e,o,r,n,i){let{agentDir:s,commandsDir:l,agentType:p}=this.config,d=A(e,s),_=A(d,l),C=Oo.join(s,"conductor");o==="global"&&(C=`~/${s}/conductor`),await Tt(_),await Tt(A(d,"conductor"));let g=await lt(r,n);try{let u=A(g,"templates"),I=A(d,"conductor","templates");await Me(u,I)}catch(u){console.warn("Failed to copy templates directory:",u)}let{protocolFilename:v}=this.config;if(v)try{let u=A(g,"GEMINI.md"),I=A(e,v);if(D(u)){let G=!0;D(I)&&!i&&(G=await bo({message:`The protocol file '${v}' already exists. Do you want to overwrite it?`,choices:[{value:!0,name:"Overwrite"},{value:!1,name:"Skip"}]})),G&&await Me(u,I)}}catch(u){console.warn("Failed to handle protocol file:",u)}let $=[];try{let u=A(g,"commands/conductor");if(D(u)){let I=await wt.readdir(u);Array.isArray(I)&&($=I.filter(G=>G.endsWith(".toml")).map(G=>G.replace(/\.toml$/,"")))}}catch(u){console.warn("Failed to discover commands:",u)}$.length===0?(console.log("No commands discovered, using default commands"),$=["setup","newTrack","implement","status","revert","review"]):console.log(`Discovered commands: ${$.join(", ")}`);let Zt=this.config.extension||".md",eo=this.config.fixedAgent;for(let u of $)try{let I=await pt(A("commands","conductor",`${u}.toml`),g),Xe=(this.config.strategy?.content||St).process(I,{installPath:C,agentType:p,fixedAgent:eo,commandName:u});Xe&&await(this.config.strategy?.file||It).write({targetDir:e,agentDir:s,commandsDir:l,commandName:u,extension:Zt,content:Xe})}catch(I){console.warn(`Failed to process ${u}:`,I)}let qe=A(g,"templates/workflow.md"),Ke=A(e,"conductor/workflow.md");if(D(Ke)&&D(qe))try{await Me(qe,Ke),console.log("\u2714 conductor/workflow.md synced")}catch(u){console.warn("Failed to handle workflow file:",u)}else console.warn("Workflow template not found, skipping workflow file sync")}};function y(t){return new E(t)}var se=class{generator=y(q);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};var ae=class{generator=y(K);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};var ce=class{generator=y(X);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};var le=class{generator=y(z);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};var pe=class{generator=y(J);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};import{homedir as Et}from"os";var ge=class{generator=y(Q);validate(e,o){return o==="global"&&(e=Et()),this.generator.validate(e,o)}generate(e,o,r,n,i){return o==="global"&&(e=Et()),this.generator.generate(e,o,r,n,i)}};var me=class{generator=y(Z);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};var fe=class{generator=y(ee);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};var de=class{generator=y(te);async validate(e,o){if(o==="global")throw new Error("Gemini CLI agent only supports project-level installation");return this.generator.validate(e,o)}async generate(e,o,r,n,i){if(o==="global")throw new Error("Gemini CLI agent only supports project-level installation");return this.generator.generate(e,o,r,n,i)}};var ue=class{generator=y(oe);validate(e,o){return this.generator.validate(e,o)}generate(e,o,r,n,i){return this.generator.generate(e,o,r,n,i)}};var ye=class extends E{constructor(){super(re)}};var Ce=class extends E{constructor(){super(ne)}};var he=class extends E{constructor(){super(ie)}};function vt(t){switch(t){case"claude-code":return new ae;case"antigravity":return new ce;case"cursor":return new le;case"github-copilot":return new pe;case"codex":return new ge;case"windsurf":return new me;case"cline":return new fe;case"kilo-code":return new ue;case"roo-code":return new ye;case"qwen-code":return new Ce;case"factory-droid":return new he;case"gemini":return new de;default:return new se}}import{resolve as ko}from"path";import Ho from"@inquirer/select";import{join as Ue}from"path";import{readFile as $e,writeFile as Ot,access as No,mkdir as Do}from"fs/promises";import{constants as Go}from"fs";var bt="# Conductor";function Nt(t){let e=L.find(r=>r.agentType===t);if(!e)return[];let o=[];return e.agentDir&&o.push(e.agentDir),e.protocolFilename&&o.push(e.protocolFilename),o}function H(t){return t.replace(/\/+$/,"")}async function je(t){try{return await No(t,Go.F_OK),!0}catch{return!1}}async function Ro(t,e){let o=[],r=[];if(!await je(t))return{existing:[],missing:[...e]};let i=(await $e(t,"utf-8")).split(`
35
+ `).map(s=>H(s.trim()));for(let s of e){let l=H(s);i.includes(l)?o.push(s):r.push(s)}return{existing:o,missing:r}}async function Dt(t,e){let{existing:o,missing:r}=await Ro(t,e);if(r.length===0)return{added:[],skipped:o};let n="";await je(t)&&(n=await $e(t,"utf-8")),n.length>0&&!n.endsWith(`
36
+ `)&&(n+=`
37
+ `),n+=`
38
+ ${bt}
39
+ `;for(let s of r)n+=`${s}
40
+ `;let i=Ue(t,"..");return await Do(i,{recursive:!0}),await Ot(t,n,"utf-8"),{added:r,skipped:o}}async function Be(t,e){if(!await je(t))return{removed:[]};let r=(await $e(t,"utf-8")).split(`
41
+ `),n=e.map(H),i=[],s=[];for(let _ of r){let C=H(_.trim());if(C!==bt){if(n.includes(C)){let g=e.find(v=>H(v)===C);g&&!i.includes(g)&&i.push(g);continue}s.push(_)}}let l=[],p=!1;for(let _ of s){let C=_.trim()==="";C&&p||(l.push(_),p=C)}for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();let d=l.length>0?l.join(`
42
+ `)+`
43
+ `:"";return await Ot(t,d,"utf-8"),{removed:i}}function xe(t,e){return e==="gitignore"?Ue(t,".gitignore"):Ue(t,".git","info","exclude")}async function Gt(t,e,o){let r=Nt(o);return r.length===0?{action:"none",entries:[],message:`No git ignore entries found for agent ${o}`}:e==="none"?await Lo(t,r):await Fo(t,e,r)}async function Fo(t,e,o){let r=xe(t,e),n=await Dt(r,o);if(n.added.length===0)return{action:"skipped",entries:n.skipped,message:"Git ignore entries already present, skipping.",targetFiles:[r]};let i=e==="gitignore"?".gitignore":".git/info/exclude";return{action:"added",entries:n.added,message:`Added ${n.added.length} entries to ${i}: ${n.added.join(", ")}`,targetFiles:[r]}}async function Lo(t,e){let o=xe(t,"gitignore"),r=xe(t,"exclude"),n=await Be(o,e),i=await Be(r,e),s=[...new Set([...n.removed,...i.removed])];if(s.length===0)return{action:"none",entries:[],message:"No Conductor git ignore entries found."};let l=[],p=[];return n.removed.length>0&&(l.push(o),p.push(`.gitignore (${n.removed.length})`)),i.removed.length>0&&(l.push(r),p.push(`.git/info/exclude (${i.removed.length})`)),{action:"removed",entries:s,message:`Removed entries from: ${p.join(", ")}`,targetFiles:l}}import $o from"@inquirer/select";import Ft from"@inquirer/input";import{execSync as Po}from"child_process";import{existsSync as Mo}from"fs";import{join as Uo}from"path";var V;function _e(){if(V!==void 0)return V;try{Po("git --version",{stdio:"ignore"}),V=!0}catch{V=!1}return V}function Rt(t){let e=Uo(t,".git");return Mo(e)}var b={SELECT_SOURCE_MESSAGE:"Select template source:",BUNDLED_LABEL:"Bundled Templates (Offline)",BUNDLED_DESCRIPTION:"Use built-in templates, no network required",OFFICIAL_LABEL:"Official Repository (Latest)",OFFICIAL_DESCRIPTION:"Fetch latest from official repository",CUSTOM_LABEL:"Custom Repository",CUSTOM_DESCRIPTION:"Specify your own repository and branch",CUSTOM_REPO_PROMPT:"Enter repository URL:",CUSTOM_BRANCH_PROMPT:"Enter branch name:"},P={USING_BUNDLED:"Using bundled Conductor templates",DOWNLOADING_FROM:(t,e)=>`Downloading templates from ${t} [${e}]...`,NON_INTERACTIVE_BUNDLED:"Non-interactive mode detected. Using bundled templates.",GIT_NOT_FOUND_INFO:"\u2139 Remote templates require git. Install git to enable remote options.",GIT_NOT_FOUND_FALLBACK:"\u26A0 git not found, falling back to bundled templates",GIT_NOT_FOUND_SKIP_GITIGNORE:"\u26A0 git not found, skipping git ignore configuration"};function jo(){return!(process.env.CI==="true"||!process.stdin.isTTY)}function Bo(t){if(!t||t.trim().length===0)return"Repository URL is required";let e=t.trim();return e.startsWith("https://")||e.startsWith("git@")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?!0:"Invalid repository URL. Please provide an HTTPS URL, SSH URL, or local path."}async function Lt(){if(!jo())return console.log(P.NON_INTERACTIVE_BUNDLED),{source:"bundled"};let t=_e();t||console.log(P.GIT_NOT_FOUND_INFO);let e=[{name:b.BUNDLED_LABEL,value:"bundled",description:b.BUNDLED_DESCRIPTION},...t?[{name:b.OFFICIAL_LABEL,value:"official",description:b.OFFICIAL_DESCRIPTION},{name:b.CUSTOM_LABEL,value:"custom",description:b.CUSTOM_DESCRIPTION}]:[]];switch(await $o({message:b.SELECT_SOURCE_MESSAGE,choices:e,default:"bundled"})){case"bundled":return{source:"bundled"};case"official":return{source:"official",repo:R,branch:O};case"custom":{let r=await Ft({message:b.CUSTOM_REPO_PROMPT,validate:Bo}),n=await Ft({message:b.CUSTOM_BRANCH_PROMPT,default:O});return{source:"custom",repo:r.trim(),branch:n.trim()||O}}default:return{source:"bundled"}}}function Pt(t){switch(t.source){case"bundled":return{repo:void 0,branch:void 0};case"official":case"custom":return{repo:t.repo,branch:t.branch};default:return{repo:void 0,branch:void 0}}}async function Mt(t){let e=ko(process.cwd(),t.path),o=t.force??!1,r=t.config??{};try{console.log(`Initializing Conductor in: ${e}`);let n;t.agent?(n=t.agent,console.log(`Using provided agent: ${n}`)):(console.log("Step 1: Prompting for agent selection..."),n=await _t(),console.log(`\u2714 Selected agent: ${n}`));let i;t.scope?(i=t.scope,console.log(`Using provided scope: ${i}`)):i=await xt(n),console.log(`\u2714 Selected scope: ${i}`);let s=Rt(e),l=t.gitIgnore;if(t.gitIgnore&&i==="global")console.warn("\u26A0 --git-ignore flag is only supported for project scope. Skipping git ignore configuration."),l=void 0;else if(s)!t.gitIgnore&&i==="project"&&(r.gitIgnore?(l=r.gitIgnore,console.log(`[Config] Using saved git-ignore: ${l}`)):l=await At());else{let g=t.gitIgnore??r.gitIgnore;g&&g!=="none"&&console.warn("\u26A0 Target directory is not a git repository, skipping git ignore configuration"),t.gitIgnore!=="none"&&(l=void 0)}let p=t.repo,d=t.branch;if(t.repo)console.log(`Using provided repository: ${t.repo}`),t.branch&&console.log(`Using provided branch: ${t.branch}`);else if(r.repo)p=r.repo,d=r.branch??d,console.log(`[Config] Using saved template source: ${p} [${d}]`);else{let g=await Lt(),v=Pt(g);p=v.repo,d=v.branch,g.source==="bundled"?console.log(`\u2714 ${P.USING_BUNDLED}`):p&&console.log(`\u2714 ${P.DOWNLOADING_FROM(p,d||"main")}`)}p&&!_e()&&(console.warn(P.GIT_NOT_FOUND_FALLBACK),p=void 0,d=void 0);let _=vt(n);console.log(`
44
+ Step 3: Validating project directory...`);let C;try{C=await _.validate(e,i)}catch(g){if(g instanceof Error&&g.message.includes("already installed"))if(o)console.log("\u26A0 Force mode: Overwriting existing installation"),C=e;else if(await Ho({message:`${g.message}
45
+ Do you want to overwrite the existing installation?`,choices:[{value:!0,name:"Yes, overwrite"},{value:!1,name:"No, cancel"}]}))console.log("Overwriting existing installation..."),C=e;else{console.log("Installation cancelled.");return}else throw g}if(console.log(`\u2714 Validation complete: ${C}`),console.log(`
46
+ Step 4: Generating files...`),await _.generate(C,i,p,d,o),console.log("\u2714 Files generated"),l){console.log(`
47
+ Step 5: Configuring git ignore...`);let g=await Gt(C,l,n);console.log(`\u2714 ${g.message}`)}console.log(`
48
+ Saving preferences...`),await et({repo:p,branch:d,gitIgnore:l}),console.log("\u2714 Preferences saved"),console.log(`
49
+ \u2714 Conductor initialized successfully!`)}catch(n){console.error(`
50
+ \u2718 Installation failed:`,n instanceof Error?n.message:n),process.exit(1)}}import ir from"gradient-string";var Ut=(t=0)=>e=>`\x1B[${e+t}m`,$t=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,jt=(t=0)=>(e,o,r)=>`\x1B[${38+t};2;${e};${o};${r}m`,m={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},xl=Object.keys(m.modifier),Vo=Object.keys(m.color),Yo=Object.keys(m.bgColor),_l=[...Vo,...Yo];function Wo(){let t=new Map;for(let[e,o]of Object.entries(m)){for(let[r,n]of Object.entries(o))m[r]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},o[r]=m[r],t.set(n[0],n[1]);Object.defineProperty(m,e,{value:o,enumerable:!1})}return Object.defineProperty(m,"codes",{value:t,enumerable:!1}),m.color.close="\x1B[39m",m.bgColor.close="\x1B[49m",m.color.ansi=Ut(),m.color.ansi256=$t(),m.color.ansi16m=jt(),m.bgColor.ansi=Ut(10),m.bgColor.ansi256=$t(10),m.bgColor.ansi16m=jt(10),Object.defineProperties(m,{rgbToAnsi256:{value(e,o,r){return e===o&&o===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(o/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){let o=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!o)return[0,0,0];let[r]=o;r.length===3&&(r=[...r].map(i=>i+i).join(""));let n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:e=>m.rgbToAnsi256(...m.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let o,r,n;if(e>=232)o=((e-232)*10+8)/255,r=o,n=o;else{e-=16;let l=e%36;o=Math.floor(e/36)/5,r=Math.floor(l/6)/5,n=l%6/5}let i=Math.max(o,r,n)*2;if(i===0)return 30;let s=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(o));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,o,r)=>m.ansi256ToAnsi(m.rgbToAnsi256(e,o,r)),enumerable:!1},hexToAnsi:{value:e=>m.ansi256ToAnsi(m.hexToAnsi256(e)),enumerable:!1}}),m}var qo=Wo(),w=qo;import ke from"process";import Ko from"os";import Bt from"tty";function S(t,e=globalThis.Deno?globalThis.Deno.args:ke.argv){let o=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(o+t),n=e.indexOf("--");return r!==-1&&(n===-1||r<n)}var{env:f}=ke,Ae;S("no-color")||S("no-colors")||S("color=false")||S("color=never")?Ae=0:(S("color")||S("colors")||S("color=true")||S("color=always"))&&(Ae=1);function Xo(){if("FORCE_COLOR"in f)return f.FORCE_COLOR==="true"?1:f.FORCE_COLOR==="false"?0:f.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(f.FORCE_COLOR,10),3)}function zo(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Jo(t,{streamIsTTY:e,sniffFlags:o=!0}={}){let r=Xo();r!==void 0&&(Ae=r);let n=o?Ae:r;if(n===0)return 0;if(o){if(S("color=16m")||S("color=full")||S("color=truecolor"))return 3;if(S("color=256"))return 2}if("TF_BUILD"in f&&"AGENT_NAME"in f)return 1;if(t&&!e&&n===void 0)return 0;let i=n||0;if(f.TERM==="dumb")return i;if(ke.platform==="win32"){let s=Ko.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in f)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in f)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in f)||f.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in f)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(f.TEAMCITY_VERSION)?1:0;if(f.COLORTERM==="truecolor"||f.TERM==="xterm-kitty"||f.TERM==="xterm-ghostty"||f.TERM==="wezterm")return 3;if("TERM_PROGRAM"in f){let s=Number.parseInt((f.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(f.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(f.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(f.TERM)||"COLORTERM"in f?1:i}function kt(t,e={}){let o=Jo(t,{streamIsTTY:t&&t.isTTY,...e});return zo(o)}var Qo={stdout:kt({isTTY:Bt.isatty(1)}),stderr:kt({isTTY:Bt.isatty(2)})},Ht=Qo;function Vt(t,e,o){let r=t.indexOf(e);if(r===-1)return t;let n=e.length,i=0,s="";do s+=t.slice(i,r)+e+o,i=r+n,r=t.indexOf(e,i);while(r!==-1);return s+=t.slice(i),s}function Yt(t,e,o,r){let n=0,i="";do{let s=t[r-1]==="\r";i+=t.slice(n,s?r-1:r)+e+(s?`\r
51
+ `:`
52
+ `)+o,n=r+1,r=t.indexOf(`
53
+ `,n)}while(r!==-1);return i+=t.slice(n),i}var{stdout:Wt,stderr:qt}=Ht,He=Symbol("GENERATOR"),M=Symbol("STYLER"),Y=Symbol("IS_EMPTY"),Kt=["ansi","ansi","ansi256","ansi16m"],U=Object.create(null),Zo=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let o=Wt?Wt.level:0;t.level=e.level===void 0?o:e.level};var er=t=>{let e=(...o)=>o.join(" ");return Zo(e,t),Object.setPrototypeOf(e,W.prototype),e};function W(t){return er(t)}Object.setPrototypeOf(W.prototype,Function.prototype);for(let[t,e]of Object.entries(w))U[t]={get(){let o=Se(this,Ye(e.open,e.close,this[M]),this[Y]);return Object.defineProperty(this,t,{value:o}),o}};U.visible={get(){let t=Se(this,this[M],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var Ve=(t,e,o,...r)=>t==="rgb"?e==="ansi16m"?w[o].ansi16m(...r):e==="ansi256"?w[o].ansi256(w.rgbToAnsi256(...r)):w[o].ansi(w.rgbToAnsi(...r)):t==="hex"?Ve("rgb",e,o,...w.hexToRgb(...r)):w[o][t](...r),tr=["rgb","hex","ansi256"];for(let t of tr){U[t]={get(){let{level:o}=this;return function(...r){let n=Ye(Ve(t,Kt[o],"color",...r),w.color.close,this[M]);return Se(this,n,this[Y])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);U[e]={get(){let{level:o}=this;return function(...r){let n=Ye(Ve(t,Kt[o],"bgColor",...r),w.bgColor.close,this[M]);return Se(this,n,this[Y])}}}}var or=Object.defineProperties(()=>{},{...U,level:{enumerable:!0,get(){return this[He].level},set(t){this[He].level=t}}}),Ye=(t,e,o)=>{let r,n;return o===void 0?(r=t,n=e):(r=o.openAll+t,n=e+o.closeAll),{open:t,close:e,openAll:r,closeAll:n,parent:o}},Se=(t,e,o)=>{let r=(...n)=>rr(r,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(r,or),r[He]=t,r[M]=e,r[Y]=o,r},rr=(t,e)=>{if(t.level<=0||!e)return t[Y]?"":e;let o=t[M];if(o===void 0)return e;let{openAll:r,closeAll:n}=o;if(e.includes("\x1B"))for(;o!==void 0;)e=Vt(e,o.close,o.open),o=o.parent;let i=e.indexOf(`
54
+ `);return i!==-1&&(e=Yt(e,n,r,i)),r+e+n};Object.defineProperties(W.prototype,U);var nr=W(),Rl=W({level:qt?qt.level:0});var Xt=nr;import zt from"fs";import We from"path";import{fileURLToPath as sr}from"url";var ar=`
55
+ __________ _ ______ __ __________________ ____ ________ ____ _ __
56
+ / ____/ __ \\/ | / / __ \\/ / / / ____/_ __/ __ \\/ __ \\ / ____/ / / __ \\| | / /
57
+ / / / / / / |/ / / / / / / / / / / / / / / /_/ / / /_ / / / / / /| | /| / /
58
+ / /___/ /_/ / /| / /_/ / /_/ / /___ / / / /_/ / _, _/ / __/ / /___/ /_/ / | |/ |/ /
59
+ \\____/\\____/_/ |_/_____/\\____/\\____/ /_/ \\____/_/ |_| /_/ /_____/\\____/ |__/|__/
60
+
61
+ `;function Jt(){let t=We.dirname(sr(import.meta.url)),e=We.join(t,"../package.json");zt.existsSync(e)||(e=We.join(t,"../../package.json"));let r=JSON.parse(zt.readFileSync(e,"utf-8")).version;console.log(Xt.dim(` v${r} | Scaffolding for Gemini Conductor
62
+ `))}function Qt(){console.log(ir("cyan","green")(ar))}async function pr(t){let e=cr(lr(process.argv));return process.env.COLUMNS&&e.wrap(parseInt(process.env.COLUMNS)),await e.scriptName(t).usage("$0 [path] [options]").positional("path",{describe:"Directory to install Conductor",default:".",type:"string"}).option("agent",{alias:"a",describe:"Specify the coding agent",type:"string",choices:L.map(o=>o.agentType)}).option("repo",{alias:"r",describe:"Git repository URL for templates. Without this flag, interactive template source selection is shown.",type:"string"}).coerce("repo",o=>o===""?R:o).option("branch",{alias:"b",describe:"Branch name for template repository",type:"string",default:O}).option("scope",{alias:"s",describe:"Installation scope (project or global)",type:"string",choices:["project","global"]}).option("git-ignore",{alias:"g",describe:"Configure git ignore for Conductor files (gitignore: add to .gitignore, exclude: add to .git/info/exclude, none: remove entries)",type:"string",choices:["gitignore","exclude","none"]}).coerce("git-ignore",o=>o===""?"exclude":o).option("force",{alias:"f",describe:"Force overwrite existing installation",type:"boolean",default:!1}).option("reset",{describe:"Clear saved preferences and show all prompts",type:"boolean",default:!1}).example("$0","Install with interactive prompts").example("$0 --agent claude-code","Install for Claude Code agent").example("$0 --repo https://github.com/user/templates","Use custom template repository").example("$0 --git-ignore gitignore","Add Conductor files to .gitignore").example("$0 --git-ignore exclude","Add Conductor files to .git/info/exclude").example("$0 --git-ignore none","Remove Conductor entries from git ignore").example("$0 --reset","Clear saved preferences and show all prompts").help().alias("h","help").version().alias("v","version").completion("completion",!1).parseAsync()}async function Jl(t){!process.env.CONDUCTOR_NO_BANNER&&!process.argv.includes("completion")&&!process.argv.includes("--get-yargs-completions")&&(Qt(),Jt());let e=await pr(t),o=e._[0];if(process.argv.includes("completion")||process.argv.includes("--get-yargs-completions"))return;let r={};e.reset?(console.log("[Config] Clearing saved preferences..."),await tt()):(r=await Te(),Object.keys(r).length>0&&console.log("[Config] Loaded saved preferences")),await rt(),await Mt({...e,path:o||e.path||".",gitIgnore:e["git-ignore"],$0:"conductor-init",_:e._,config:r})}export{Jl as a};
@@ -35,13 +35,29 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
35
35
  4. **Select Track:**
36
36
  - **If a track name was provided:**
37
37
  1. Perform an exact, case-insensitive match for the provided name against the track descriptions you parsed.
38
- 2. If a unique match is found, confirm the selection with the user: "I found track '<track_description>'. Is this correct?"
39
- 3. If no match is found, or if the match is ambiguous, inform the user and ask for clarification. Suggest the next available track as below.
38
+ 2. If a unique match is found, immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat):
39
+ - **questions:**
40
+ - **header:** "Confirm"
41
+ - **question:** "I found track '<track_description>'. Is this correct?"
42
+ - **type:** "yesno"
43
+ 3. If no match is found, or if the match is ambiguous, immediately call the `ask_user` tool to inform the user and request the correct track name (do not repeat the question in the chat):
44
+ - **questions:**
45
+ - **header:** "Clarify"
46
+ - **question:** "I couldn't find a unique track matching the name you provided. Did you mean '<next_available_track>'? Or please type the exact track name."
47
+ - **type:** "text"
40
48
  - **If no track name was provided (or if the previous step failed):**
41
49
  1. **Identify Next Track:** Find the first track in the parsed tracks file that is NOT marked as `[x] Completed`.
42
50
  2. **If a next track is found:**
43
- - Announce: "No track name provided. Automatically selecting the next incomplete track: '<track_description>'."
44
- - Proceed with this track.
51
+ - Immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat):
52
+ - **questions:**
53
+ - **header:** "Next Track"
54
+ - **question:** "No track name provided. Would you like to proceed with the next incomplete track: '<track_description>'?"
55
+ - **type:** "yesno"
56
+ - If confirmed, proceed with this track. Otherwise, immediately call the `ask_user` tool to request the correct track name (do not repeat the question in the chat):
57
+ - **questions:**
58
+ - **header:** "Clarify"
59
+ - **question:** "Please type the exact name of the track you would like to implement."
60
+ - **type:** "text"
45
61
  3. **If no incomplete tracks are found:**
46
62
  - Announce: "No incomplete tracks found in the tracks file. All tasks are completed!"
47
63
  - Halt the process and await further user instructions.
@@ -71,6 +87,7 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
71
87
  b. **Iterate Through Tasks:** You MUST now loop through each task in the track's **Implementation Plan** one by one.
72
88
  c. **For Each Task, You MUST:**
73
89
  i. **Defer to Workflow:** The **Workflow** file is the **single source of truth** for the entire task lifecycle. You MUST now read and execute the procedures defined in the "Task Workflow" section of the **Workflow** file you have in your context. Follow its steps for implementation, testing, and committing precisely.
90
+ - **CRITICAL:** Every human-in-the-loop interaction, confirmation, or request for feedback mentioned in the **Workflow** (e.g., manual verification plans or guidance on persistent failures) MUST be conducted using the `ask_user` tool.
74
91
 
75
92
  5. **Finalize Track:**
76
93
  - After all tasks in the track's local **Implementation Plan** are completed, you MUST update the track's status in the **Tracks Registry**.
@@ -99,31 +116,46 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
99
116
  a. **Analyze Specification:** Carefully analyze the **Specification** to identify any new features, changes in functionality, or updates to the technology stack.
100
117
  b. **Update Product Definition:**
101
118
  i. **Condition for Update:** Based on your analysis, you MUST determine if the completed feature or bug fix significantly impacts the description of the product itself.
102
- ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation:
103
- > "Based on the completed track, I propose the following updates to the **Product Definition**:"
104
- > ```diff
105
- > [Proposed changes here, ideally in a diff format]
106
- > ```
107
- > "Do you approve these changes? (yes/no)"
119
+ ii. **Propose and Confirm Changes:** If an update is needed:
120
+ - **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the proposed updates (in a diff format) directly into the `question` field so the user can review them in context.
121
+ - **questions:**
122
+ - **header:** "Product"
123
+ - **question:**
124
+ Please review the proposed updates to the Product Definition below. Do you approve?
125
+
126
+ ---
127
+
128
+ <Insert Proposed product.md Updates/Diff Here>
129
+ - **type:** "yesno"
108
130
  iii. **Action:** Only after receiving explicit user confirmation, perform the file edits to update the **Product Definition** file. Keep a record of whether this file was changed.
109
131
  c. **Update Tech Stack:**
110
132
  i. **Condition for Update:** Similarly, you MUST determine if significant changes in the technology stack are detected as a result of the completed track.
111
- ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation:
112
- > "Based on the completed track, I propose the following updates to the **Tech Stack**:"
113
- > ```diff
114
- > [Proposed changes here, ideally in a diff format]
115
- > ```
116
- > "Do you approve these changes? (yes/no)"
133
+ ii. **Propose and Confirm Changes:** If an update is needed:
134
+ - **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the proposed updates (in a diff format) directly into the `question` field so the user can review them in context.
135
+ - **questions:**
136
+ - **header:** "Tech Stack"
137
+ - **question:**
138
+ Please review the proposed updates to the Tech Stack below. Do you approve?
139
+
140
+ ---
141
+
142
+ <Insert Proposed tech-stack.md Updates/Diff Here>
143
+ - **type:** "yesno"
117
144
  iii. **Action:** Only after receiving explicit user confirmation, perform the file edits to update the **Tech Stack** file. Keep a record of whether this file was changed.
118
145
  d. **Update Product Guidelines (Strictly Controlled):**
119
146
  i. **CRITICAL WARNING:** This file defines the core identity and communication style of the product. It should be modified with extreme caution and ONLY in cases of significant strategic shifts, such as a product rebrand or a fundamental change in user engagement philosophy. Routine feature updates or bug fixes should NOT trigger changes to this file.
120
147
  ii. **Condition for Update:** You may ONLY propose an update to this file if the track's **Specification** explicitly describes a change that directly impacts branding, voice, tone, or other core product guidelines.
121
- iii. **Propose and Confirm Changes:** If the conditions are met, you MUST generate the proposed changes and present them to the user with a clear warning:
122
- > "WARNING: The completed track suggests a change to the core **Product Guidelines**. This is an unusual step. Please review carefully:"
123
- > ```diff
124
- > [Proposed changes here, ideally in a diff format]
125
- > ```
126
- > "Do you approve these critical changes to the **Product Guidelines**? (yes/no)"
148
+ iii. **Propose and Confirm Changes:** If the conditions are met:
149
+ - **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the proposed changes (in a diff format) directly into the `question` field, including a clear warning.
150
+ - **questions:**
151
+ - **header:** "Product"
152
+ - **question:**
153
+ WARNING: This is a sensitive action as it impacts core product guidelines. Please review the proposed changes below. Do you approve these critical changes?
154
+
155
+ ---
156
+
157
+ <Insert Proposed product-guidelines.md Updates/Diff Here>
158
+ - **type:** "yesno"
127
159
  iv. **Action:** Only after receiving explicit user confirmation, perform the file edits. Keep a record of whether this file was changed.
128
160
 
129
161
  6. **Final Report:** Announce the completion of the synchronization process and provide a summary of the actions taken.
@@ -146,34 +178,41 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
146
178
 
147
179
  1. **Execution Trigger:** This protocol MUST only be executed after the current track has been successfully implemented and the `SYNCHRONIZE PROJECT DOCUMENTATION` step is complete.
148
180
 
149
- 2. **Ask for User Choice:** You MUST prompt the user with the available options for the completed track.
150
- > "Track '<track_description>' is now complete. What would you like to do?
151
- > A. **Review (Recommended):** Run the review command to verify changes before finalizing.
152
- > B. **Archive:** Move the track's folder to `conductor/archive/` and remove it from the tracks file.
153
- > C. **Delete:** Permanently delete the track's folder and remove it from the tracks file.
154
- > D. **Skip:** Do nothing and leave it in the tracks file.
155
- > Please enter the option of your choice (A, B, C, or D)."
181
+ 2. **Ask for User Choice:** Immediately call the `ask_user` tool to prompt the user (do not repeat the question in the chat):
182
+ - **questions:**
183
+ - **header:** "Track Cleanup"
184
+ - **question:** "Track '<track_description>' is now complete. What would you like to do?"
185
+ - **type:** "choice"
186
+ - **multiSelect:** false
187
+ - **options:**
188
+ - Label: "Review", Description: "Run the review command to verify changes before finalizing."
189
+ - Label: "Archive", Description: "Move the track's folder to `conductor/archive/` and remove it from the tracks file."
190
+ - Label: "Delete", Description: "Permanently delete the track's folder and remove it from the tracks file."
191
+ - Label: "Skip", Description: "Do nothing and leave it in the tracks file."
156
192
 
157
193
  3. **Handle User Response:**
158
- * **If user chooses "A" (Review):**
194
+ * **If user chooses "Review":**
159
195
  * Announce: "Please run `/conductor:review` to verify your changes. You will be able to archive or delete the track after the review."
160
- * **If user chooses "B" (Archive):**
196
+ * **If user chooses "Archive":**
161
197
  i. **Create Archive Directory:** Check for the existence of `conductor/archive/`. If it does not exist, create it.
162
198
  ii. **Archive Track Folder:** Move the track's folder from its current location (resolved via the **Tracks Directory**) to `conductor/archive/<track_id>`.
163
199
  iii. **Remove from Tracks File:** Read the content of the **Tracks Registry** file, remove the entire section for the completed track (the part that starts with `---` and contains the track description), and write the modified content back to the file.
164
200
  iv. **Commit Changes:** Stage the **Tracks Registry** file and `conductor/archive/`. Commit with the message `chore(conductor): Archive track '<track_description>'`.
165
201
  v. **Announce Success:** Announce: "Track '<track_description>' has been successfully archived."
166
- * **If user chooses "C" (Delete):**
167
- i. **CRITICAL WARNING:** Before proceeding, you MUST ask for a final confirmation due to the irreversible nature of the action.
168
- > "WARNING: This will permanently delete the track folder and all its contents. This action cannot be undone. Are you sure you want to proceed? (yes/no)"
202
+ * **If user chooses "Delete":**
203
+ i. **CRITICAL WARNING:** Before proceeding, immediately call the `ask_user` tool to ask for final confirmation (do not repeat the warning in the chat):
204
+ - **questions:**
205
+ - **header:** "Confirm"
206
+ - **question:** "WARNING: This will permanently delete the track folder and all its contents. This action cannot be undone. Are you sure?"
207
+ - **type:** "yesno"
169
208
  ii. **Handle Confirmation:**
170
209
  - **If 'yes'**:
171
210
  a. **Delete Track Folder:** Resolve the **Tracks Directory** and permanently delete the track's folder from `<Tracks Directory>/<track_id>`.
172
211
  b. **Remove from Tracks File:** Read the content of the **Tracks Registry** file, remove the entire section for the completed track, and write the modified content back to the file.
173
212
  c. **Commit Changes:** Stage the **Tracks Registry** file and the deletion of the track directory. Commit with the message `chore(conductor): Delete track '<track_description>'`.
174
213
  d. **Announce Success:** Announce: "Track '<track_description>' has been permanently deleted."
175
- - **If 'no' (or anything else)**:
214
+ - **If 'no'**:
176
215
  a. **Announce Cancellation:** Announce: "Deletion cancelled. The track has not been changed."
177
- * **If user chooses "D" (Skip) or provides any other input:**
216
+ * **If user chooses "Skip":**
178
217
  * Announce: "Okay, the completed track will remain in your tracks file for now."
179
- """
218
+ """
@@ -30,8 +30,12 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
30
30
  1. **Load Project Context:** Read and understand the content of the project documents (**Product Definition**, **Tech Stack**, etc.) resolved via the **Universal File Resolution Protocol**.
31
31
  2. **Get Track Description:**
32
32
  * **If `{{args}}` contains a description:** Use the content of `{{args}}`.
33
- * **If `{{args}}` is empty:** Ask the user:
34
- > "Please provide a brief description of the track (feature, bug fix, chore, etc.) you wish to start."
33
+ * **If `{{args}}` is empty:** Ask the user using the `ask_user` tool (do not repeat the question in the chat):
34
+ - **questions:**
35
+ - **header:** "Description"
36
+ - **type:** "text"
37
+ - **question:** "Please provide a brief description of the track (feature, bug fix, chore, etc.) you wish to start."
38
+ - **placeholder:** "e.g., Implement user authentication"
35
39
  Await the user's response and use it as the track description.
36
40
  3. **Infer Track Type:** Analyze the description to determine if it is a "Feature" or "Something Else" (e.g., Bug, Chore, Refactor). Do NOT ask the user to classify it.
37
41
 
@@ -40,48 +44,56 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
40
44
  1. **State Your Goal:** Announce:
41
45
  > "I'll now guide you through a series of questions to build a comprehensive specification (`spec.md`) for this track."
42
46
 
43
- 2. **Questioning Phase:** Ask a series of questions to gather details for the `spec.md`. Tailor questions based on the track type (Feature or Other).
44
- * **CRITICAL:** You MUST ask these questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question.
47
+ 2. **Questioning Phase:** Ask a series of questions to gather details for the `spec.md` using the `ask_user` tool. You must batch up to 4 related questions in a single tool call to streamline the process. Tailor questions based on the track type (Feature or Other).
48
+ * **CRITICAL:** Wait for the user's response after each `ask_user` tool call.
45
49
  * **General Guidelines:**
46
50
  * Refer to information in **Product Definition**, **Tech Stack**, etc., to ask context-aware questions.
47
51
  * Provide a brief explanation and clear examples for each question.
48
- * **Strongly Recommendation:** Whenever possible, present 2-3 plausible options (A, B, C) for the user to choose from.
49
- * **Mandatory:** The last option for every multiple-choice question MUST be "Type your own answer".
50
-
52
+ * **Strongly Recommendation:** Whenever possible, present 2-3 plausible options for the user to choose from.
53
+
51
54
  * **1. Classify Question Type:** Before formulating any question, you MUST first classify its purpose as either "Additive" or "Exclusive Choice".
52
55
  * Use **Additive** for brainstorming and defining scope (e.g., users, goals, features, project guidelines). These questions allow for multiple answers.
53
56
  * Use **Exclusive Choice** for foundational, singular commitments (e.g., selecting a primary technology, a specific workflow rule). These questions require a single answer.
54
-
55
- * **2. Formulate the Question:** Based on the classification, you MUST adhere to the following:
56
- * **Strongly Recommended:** Whenever possible, present 2-3 plausible options (A, B, C) for the user to choose from.
57
- * **If Additive:** Formulate an open-ended question that encourages multiple points. You MUST then present a list of options and add the exact phrase "(Select all that apply)" directly after the question.
58
- * **If Exclusive Choice:** Formulate a direct question that guides the user to a single, clear decision. You MUST NOT add "(Select all that apply)".
57
+
58
+ * **2. Formulate the Question:** Use the `ask_user` tool: Adhere to the following for each question in the `questions` array:
59
+ - **header:** Very short label (max 16 chars).
60
+ - **type:** "choice", "text", or "yesno".
61
+ - **multiSelect:** (Required for type: "choice") Set to `true` for multi-select (additive) or `false` for single-choice (exclusive).
62
+ - **options:** (Required for type: "choice") Provide 2-4 options, each with a `label` and `description`. Note that "Other" is automatically added.
63
+ - **placeholder:** (For type: "text") Provide a hint.
59
64
 
60
65
  * **3. Interaction Flow:**
61
- * **CRITICAL:** You MUST ask questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question.
62
- * The last option for every multiple-choice question MUST be "Type your own answer".
63
- * Confirm your understanding by summarizing before moving on to the next question or section..
66
+ * Wait for the user's response after each `ask_user` tool call.
67
+ * If the user selects "Other", use a subsequent `ask_user` tool call with `type: "text"` to get their input if necessary.
68
+ * Confirm your understanding by summarizing before moving on to drafting.
64
69
 
65
70
  * **If FEATURE:**
66
- * **Ask 3-5 relevant questions** to clarify the feature request.
71
+ * **Ask 3-4 relevant questions** to clarify the feature request using the `ask_user` tool.
67
72
  * Examples include clarifying questions about the feature, how it should be implemented, interactions, inputs/outputs, etc.
68
73
  * Tailor the questions to the specific feature request (e.g., if the user didn't specify the UI, ask about it; if they didn't specify the logic, ask about it).
69
74
 
70
75
  * **If SOMETHING ELSE (Bug, Chore, etc.):**
71
- * **Ask 2-3 relevant questions** to obtain necessary details.
76
+ * **Ask 2-3 relevant questions** to obtain necessary details using the `ask_user` tool.
72
77
  * Examples include reproduction steps for bugs, specific scope for chores, or success criteria.
73
78
  * Tailor the questions to the specific request.
74
79
 
75
80
  3. **Draft `spec.md`:** Once sufficient information is gathered, draft the content for the track's `spec.md` file, including sections like Overview, Functional Requirements, Non-Functional Requirements (if any), Acceptance Criteria, and Out of Scope.
76
81
 
77
- 4. **User Confirmation:** Present the drafted `spec.md` content to the user for review and approval.
78
- > "I've drafted the specification for this track. Please review the following:"
79
- >
80
- > ```markdown
81
- > [Drafted spec.md content here]
82
- > ```
83
- >
84
- > "Does this accurately capture the requirements? Please suggest any changes or confirm."
82
+ 4. **User Confirmation:**
83
+ - **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the drafted content directly into the `question` field so the user can review it in context.
84
+ - **questions:**
85
+ - **header:** "Confirm Spec"
86
+ - **question:**
87
+ Please review the drafted Specification below. Does this accurately capture the requirements?
88
+
89
+ ---
90
+
91
+ <Insert Drafted spec.md Content Here>
92
+ - **type:** "choice"
93
+ - **multiSelect:** false
94
+ - **options:**
95
+ - Label: "Approve", Description: "The specification looks correct, proceed to planning."
96
+ - Label: "Revise", Description: "I want to make changes to the requirements."
85
97
  Await user feedback and revise the `spec.md` content until confirmed.
86
98
 
87
99
  ### 2.3 Interactive Plan Generation (`plan.md`)
@@ -99,14 +111,21 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
99
111
  - Sub-task: ` - [ ] ...`
100
112
  * **CRITICAL: Inject Phase Completion Tasks.** Determine if a "Phase Completion Verification and Checkpointing Protocol" is defined in the **Workflow**. If this protocol exists, then for each **Phase** that you generate in `plan.md`, you MUST append a final meta-task to that phase. The format for this meta-task is: `- [ ] Task: Conductor - User Manual Verification '<Phase Name>' (Protocol in workflow.md)`.
101
113
 
102
- 3. **User Confirmation:** Present the drafted `plan.md` to the user for review and approval.
103
- > "I've drafted the implementation plan. Please review the following:"
104
- >
105
- > ```markdown
106
- > [Drafted plan.md content here]
107
- > ```
108
- >
109
- > "Does this plan look correct and cover all the necessary steps based on the spec and our workflow? Please suggest any changes or confirm."
114
+ 3. **User Confirmation:**
115
+ - **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the drafted content directly into the `question` field so the user can review it in context.
116
+ - **questions:**
117
+ - **header:** "Confirm Plan"
118
+ - **question:**
119
+ Please review the drafted Implementation Plan below. Does this look correct and cover all the necessary steps?
120
+
121
+ ---
122
+
123
+ <Insert Drafted plan.md Content Here>
124
+ - **type:** "choice"
125
+ - **multiSelect:** false
126
+ - **options:**
127
+ - Label: "Approve", Description: "The plan looks solid, proceed to implementation."
128
+ - Label: "Revise", Description: "I want to modify the implementation steps."
110
129
  Await user feedback and revise the `plan.md` content until confirmed.
111
130
 
112
131
  ### 2.4 Create Track Artifacts and Update Main Plan
@@ -37,42 +37,35 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
37
37
 
38
38
  * **PATH A: Direct Confirmation**
39
39
  1. Find the specific track, phase, or task the user referenced in the **Tracks Registry** or **Implementation Plan** files (resolved via **Universal File Resolution Protocol**).
40
- 2. Ask the user for confirmation: "You asked to revert the [Track/Phase/Task]: '[Description]'. Is this correct?".
41
- - **Structure:**
42
- A) Yes
43
- B) No
44
- 3. If "yes", establish this as the `target_intent` and proceed to Phase 2. If "no", ask clarifying questions to find the correct item to revert.
40
+ 2. Immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat):
41
+ - **questions:**
42
+ - **header:** "Confirm"
43
+ - **question:** "You asked to revert the [Track/Phase/Task]: '[Description]'. Is this correct?"
44
+ - **type:** "yesno"
45
+ 3. If "yes", establish this as the `target_intent` and proceed to Phase 2. If "no", immediately call the `ask_user` tool to ask clarifying questions (do not repeat the question in the chat):
46
+ - **questions:**
47
+ - **header:** "Clarify"
48
+ - **question:** "I'm sorry, I misunderstood. Please describe the Track, Phase, or Task you would like to revert."
49
+ - **type:** "text"
45
50
 
46
51
  * **PATH B: Guided Selection Menu**
47
52
  1. **Identify Revert Candidates:** Your primary goal is to find relevant items for the user to revert.
48
53
  * **Scan All Plans:** You MUST read the **Tracks Registry** and every track's **Implementation Plan** (resolved via **Universal File Resolution Protocol** using the track's index file).
49
- * **Prioritize In-Progress:** First, find **all** Tracks, Phases, and Tasks marked as "in-progress" (`[~]`).
50
- * **Fallback to Completed:** If and only if NO in-progress items are found, find the **5 most recently completed** Tasks and Phases (`[x]`).
51
- 2. **Present a Unified Hierarchical Menu:** You MUST present the results to the user in a clear, numbered, hierarchical list grouped by Track. The introductory text MUST change based on the context.
52
- * **Example when in-progress items are found:**
53
- > "I found multiple in-progress items. Please choose which one to revert:
54
- >
55
- > Track: track_20251208_user_profile
56
- > 1) [Phase] Implement Backend API
57
- > 2) [Task] Update user model
58
- >
59
- > 3) A different Track, Task, or Phase."
60
- * **Example when showing recently completed items:**
61
- > "No items are in progress. Please choose a recently completed item to revert:
62
- >
63
- > Track: track_20251208_user_profile
64
- > 1) [Phase] Foundational Setup
65
- > 2) [Task] Initialize React application
66
- >
67
- > Track: track_20251208_auth_ui
68
- > 3) [Task] Create login form
69
- >
70
- > 4) A different Track, Task, or Phase."
54
+ * **Prioritize In-Progress:** First, find the **top 3** most relevant Tracks, Phases, or Tasks marked as "in-progress" (`[~]`).
55
+ * **Fallback to Completed:** If and only if NO in-progress items are found, find the **3 most recently completed** Tasks and Phases (`[x]`).
56
+ 2. **Present a Unified Hierarchical Menu:** Immediately call the `ask_user` tool to present the results (do not list them in the chat first):
57
+ - **questions:**
58
+ - **header:** "Select Item"
59
+ - **question:** "I found multiple in-progress items (or recently completed items). Please choose which one to revert:"
60
+ - **type:** "choice"
61
+ - **multiSelect:** false
62
+ - **options:** Provide the identified items as options. Group them by Track in the description if possible. **CRITICAL:** You MUST limit this array to a maximum of 4 items.
63
+ - **Example Option Label:** "[Task] Update user model", **Description:** "Track: track_20251208_user_profile"
64
+ - **Example Option Label:** "[Phase] Implement Backend", **Description:** "Track: track_20251208_user_profile"
65
+ - **Note:** The "Other" option is automatically added by the tool.
71
66
  3. **Process User's Choice:**
72
- * If the user's response is **A** or **B**, set this as the `target_intent` and proceed directly to Phase 2.
73
- * If the user's response is **C** or another value that does not match A or B, you must engage in a dialogue to find the correct target. Ask clarifying questions like:
74
- * "What is the name or ID of the track you are looking for?"
75
- * "Can you describe the task you want to revert?"
67
+ * If the user selects a specific item from the list, set this as the `target_intent` and proceed directly to Phase 2.
68
+ * If the user selects "Other" (automatically added for "choice") or the explicit "Other" option provided, you must engage in a dialogue to find the correct target using `ask_user` tool with a single question of `type: "text"` in the `questions` array.
76
69
  * Once a target is identified, loop back to Path A for final confirmation.
77
70
 
78
71
  4. **Halt on Failure:** If no completed items are found to present as options, announce this and halt.
@@ -112,11 +105,23 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
112
105
  > ` - <sha_plan_commit> ('conductor(plan): Mark task complete')`
113
106
  > * **Action:** I will run `git revert` on these commits in reverse order.
114
107
 
115
- 2. **Final Go/No-Go:** Ask for final confirmation: "**Do you want to proceed? (yes/no)**".
116
- - **Structure:**
117
- A) Yes
118
- B) No
119
- 3. If "yes", proceed to Phase 4. If "no", ask clarifying questions to get the correct plan for revert.
108
+ 2. **Final Go/No-Go:** Immediately call the `ask_user` tool to ask for final confirmation (do not repeat the question in the chat):
109
+ - **questions:**
110
+ - **header:** "Confirm Plan"
111
+ - **question:** "Do you want to proceed with the drafted plan?"
112
+ - **type:** "choice"
113
+ - **multiSelect:** false
114
+ - **options:**
115
+ - Label: "Approve", Description: "Proceed with the revert actions."
116
+ - Label: "Revise", Description: "I want to change the revert plan."
117
+
118
+ 3. **Process User Choice:**
119
+ - If "Approve", proceed to Phase 4.
120
+ - If "Revise", immediately call the `ask_user` tool to get the correct plan (do not repeat the question in the chat):
121
+ - **questions:**
122
+ - **header:** "Revise"
123
+ - **question:** "Please describe the changes needed for the revert plan."
124
+ - **type:** "text"
120
125
 
121
126
  ---
122
127