@code-partner/codepipe 0.3.3-dev.96.gbcb185c → 0.3.3-dev.98.gd2baea2

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var me="0.3.3-dev.96.gbcb185c",Te="https://hub.dev.codepipe.dev";var Ie=4,mu=4;function Lr(t){return typeof t!="number"||!Number.isFinite(t)?!1:t>=mu&&t<=Ie}var je=".codepipe-context.yaml",lr=".devpipe-context.yaml",ci=[{version:1,summary:"ADR section: adr/ scaffold (README, template, derived INDEX) + the format-version stamp itself",addedPaths:["adr/README.md","adr/0000-template.md","adr/INDEX.md",je]},{version:2,summary:"Rename the format-version stamp .devpipe-context.yaml \u2192 .codepipe-context.yaml (drop the devpipe-brand leftover)",addedPaths:[je]}];function Dr(t=2){return`# CodePipe Context Repo format version.
2
+ var me="0.3.3-dev.98.gd2baea2",Te="https://hub.dev.codepipe.dev";var Ie=4,mu=4;function Lr(t){return typeof t!="number"||!Number.isFinite(t)?!1:t>=mu&&t<=Ie}var je=".codepipe-context.yaml",lr=".devpipe-context.yaml",ci=[{version:1,summary:"ADR section: adr/ scaffold (README, template, derived INDEX) + the format-version stamp itself",addedPaths:["adr/README.md","adr/0000-template.md","adr/INDEX.md",je]},{version:2,summary:"Rename the format-version stamp .devpipe-context.yaml \u2192 .codepipe-context.yaml (drop the devpipe-brand leftover)",addedPaths:[je]}];function Dr(t=2){return`# CodePipe Context Repo format version.
3
3
  # Bumped by the scaffold / the format-migration PR \u2014 do not edit by hand.
4
4
  template_version: ${t}
5
5
  `}function li(t){if(!t)return 0;let e=/^\s*template_version:\s*(\d+)\s*$/m.exec(t),r=e?parseInt(e[1]??"",10):NaN;return Number.isFinite(r)&&r>=0?r:0}function ui(t,e=ci){let r=[];for(let n of e)if(!(n.version<=t))for(let o of n.addedPaths)r.includes(o)||r.push(o);return r}function pi(t,e=ci){return e.filter(r=>r.version>t)}var di=["estimate","analyze","implement","resolve-conflict","rework","draft","build","index","analysis","chat"];function pt(){return{inputTokens:0,outputTokens:0,cacheReadInputTokens:0,cacheCreationInputTokens:0,totalCostUsd:0,model:"",numTurns:0,durationMs:0}}var qe="opus",Br="sonnet",gu="haiku",Kn=[qe,Br,gu],fi={analyze:qe,implement:qe,"resolve-conflict":qe,rework:qe,estimate:Br,build:Br,draft:Br,index:qe,analysis:qe,chat:qe};var hu=[{id:"branch",label:"Branch",help:"Task-branch naming.",fields:[{id:"branch.pattern",file:"project.yaml",path:["branch","pattern"],type:"string",label:"Task-branch pattern",nullable:!0,mustContain:"<TASK_ID>",help:"Template for the per-task branch name. Must contain the <TASK_ID> placeholder. Empty \u21D2 default codepipe/<TASK_ID>."}]},{id:"llm",label:"LLM",fields:[],groups:[{id:"llm.models",label:"Models by role",help:"Model per pipeline stage. Empty \u21D2 the role's recommended default applies.",fields:[{id:"llm.models.default",file:"regimen.yaml",path:["llm","models","default"],type:"model",label:"default (catch-all)",nullable:!0,suggestions:[...Kn],help:"Overrides the recommended defaults for every role not listed below."},...di.map(t=>({id:`llm.models.${t}`,file:"regimen.yaml",path:["llm","models",t],type:"model",label:t,nullable:!0,suggestions:[...Kn],help:`recommended: ${fi[t]}`}))]}]},{id:"gates",label:"Gates",help:"Approval gate before the pipeline starts (orthogonal to automation).",fields:[{id:"gates.require_approval",file:"regimen.yaml",path:["gates","require_approval"],type:"boolean",label:"Require approval before start",nullable:!1,help:"When on, a task taken from Develop waits in AWAITING_APPROVAL for a manual Approve before analysis starts. Off \u21D2 intake auto-starts the pipeline."}]},{id:"automation",label:"Automation",help:"How far the pipeline advances the G1\u2013G4 gates without a manual Run/Approve. Independent of the approval gate above.",fields:[{id:"automation.level",file:"regimen.yaml",path:["automation","level"],type:"enum",label:"Automation level",nullable:!1,suggestions:["assisted","full"],help:"assisted \u21D2 manual Run/Approve at each of G1\u2013G4; full \u21D2 gates auto-pass."}]}];function mi(t=hu){let e=[];for(let r of t)e.push(...r.fields),r.groups&&e.push(...mi(r.groups));return e}function yu(t,e){let r=JSON.stringify(e);return mi().find(n=>n.file===t&&JSON.stringify(n.path)===r)}function gi(t){let e=yu(t.file,t.path);if(!e)return{ok:!1,error:`unknown setting path: ${t.file}:${t.path.join(".")}`};let r=t.value,n=e.type==="model"||e.type==="enum"||e.type==="string";if(r===null||n&&typeof r=="string"&&r.trim().length===0)return e.nullable?{ok:!0,field:e,value:null}:{ok:!1,error:`${e.id} cannot be cleared`};switch(e.type){case"model":case"string":{if(typeof r!="string")return{ok:!1,error:`${e.id} must be a string`};let i=r.trim();return e.type==="string"&&e.mustContain&&!i.includes(e.mustContain)?{ok:!1,error:`${e.id} must contain "${e.mustContain}"`}:{ok:!0,field:e,value:i}}case"enum":{if(typeof r!="string")return{ok:!1,error:`${e.id} must be a string`};let i=r.trim();return e.suggestions?.includes(i)?{ok:!0,field:e,value:i}:{ok:!1,error:`${e.id} must be one of: ${(e.suggestions??[]).join(", ")}`}}case"number":return typeof r!="number"||!Number.isFinite(r)||!Number.isInteger(r)?{ok:!1,error:`${e.id} must be an integer`}:e.min!==void 0&&r<e.min?{ok:!1,error:`${e.id} must be \u2265 ${e.min}`}:e.max!==void 0&&r>e.max?{ok:!1,error:`${e.id} must be \u2264 ${e.max}`}:{ok:!0,field:e,value:r};case"boolean":return typeof r!="boolean"?{ok:!1,error:`${e.id} must be a boolean`}:{ok:!0,field:e,value:r};case"string_list":{if(!Array.isArray(r))return{ok:!1,error:`${e.id} must be a list`};let i=r.map(s=>typeof s=="string"?s.trim():"").filter(s=>s.length>0);return i.length===0?e.nullable?{ok:!0,field:e,value:null}:{ok:!1,error:`${e.id} must be a non-empty list`}:{ok:!0,field:e,value:i}}}}var dt=/^[a-z][a-z0-9-]{1,30}$/,wu="-codepipe-ctx";function Ge(t){return`${t}${wu}`}var bu=[{name:"rework",pattern:/^@(?:codepipe|devpipe)\s+rework:\s*(.+)$/im,description:"Send the task back to ANALYZING with a new instruction.",hasArg:!0},{name:"approve",pattern:/^@(?:codepipe|devpipe)\s+approve\s*$/im,description:"Merge every PR for this task (TRACKING only)."},{name:"reject",pattern:/^@(?:codepipe|devpipe)\s+reject(?::\s*(.+))?\s*$/im,description:"Abandon this task: close any open PR(s) and move it to DONE (reason rejected_and_closed). Valid from any non-terminal phase; from early phases it just skips the task.",hasArg:!0},{name:"merge",pattern:/^@(?:codepipe|devpipe)\s+merge\s*$/im,description:"Merge the task branch into the default branch without a PR (direct apply path, apply.pull_request=false; TRACKING only)."},{name:"rebase",pattern:/^@(?:codepipe|devpipe)\s+rebase\s*$/im,description:"Re-apply the patch on top of the latest base branch and force-push. Use after a PR merge conflict or APPLYING failure."},{name:"update",pattern:/^@(?:codepipe|devpipe)\s+update(?::\s*(.+))?\s*$/im,description:"Update a conflicting PR: resolve conflicts against the current base branch (TRACKING only). Optional `: <instruction>` is forwarded to the agent.",hasArg:!0},{name:"apply",pattern:/^@(?:codepipe|devpipe)\s+apply:\s*(local|auto)\s*$/im,description:"Override apply mode for this task: local (you apply by hand) or auto.",hasArg:!0}];function Gr(t){for(let e of bu){let r=t.match(e.pattern);if(r)return{name:e.name,args:(r[1]??"").trim()}}return null}var ur={github:"github.com",gitlab:"gitlab.com",bitbucket:"bitbucket.org"};function Ct(t){let e=t.match(/^git@([^:/]+):/);if(e)return e[1]??null;let r=t.match(/^ssh:\/\/(?:[^@/]+@)?([^/:]+)/);if(r)return r[1]??null;let n=t.match(/^https?:\/\/(?:[^@/]+@)?([^/:]+)/);return n?n[1]??null:null}var ft="x-bitbucket-api-token-auth";function Mr(t){switch(t){case ur.gitlab:return"oauth2";case ur.bitbucket:return"x-token-auth";default:return"x-access-token"}}var hi=20;function L(t){return process.env[`CODEPIPE_${t}`]??process.env[`DEVPIPE_${t}`]}import{Command as Ah}from"commander";import{homedir as $i}from"node:os";import{mkdirSync as ju,readFileSync as Pu,writeFileSync as Eu,existsSync as qn}from"node:fs";import{dirname as xi,join as Kr,resolve as Au}from"node:path";import{fileURLToPath as _u}from"node:url";import{existsSync as Fr,readFileSync as wi,readdirSync as $u,writeFileSync as vu}from"node:fs";import{dirname as xu,join as Ye}from"node:path";import{parse as Su}from"yaml";import{existsSync as yi,renameSync as ku}from"node:fs";function mt(t,e,r=n=>console.error(n)){if(yi(e)||!yi(t))return!1;try{return ku(t,e),r(`migrated ${t} \u2192 ${e} (DevPipe \u2192 CodePipe)`),!0}catch(n){return r(`failed to migrate ${t} \u2192 ${e}: ${n instanceof Error?n.message:String(n)} \u2014 continuing with the legacy path untouched`),!1}}var Pe=".codepipe",Wn=".devpipe";function Cu(t=process.cwd()){let e=t;for(;;){if(Fr(Ye(e,Pe,"project.yaml")))return e;if(Fr(Ye(e,Wn,"project.yaml")))return mt(Ye(e,Wn),Ye(e,Pe))&&Tu(e),e;let r=xu(e);if(r===e)return null;e=r}}function Ru(t){let e=Ye(t,Pe);return Fr(e)?e:Ye(t,Wn)}function Tu(t){let e=Ye(t,".gitignore");if(!Fr(e))return;let r=wi(e,"utf-8"),n=r.split(/\r?\n/).map(o=>{let i=o.trim();return i===".devpipe"||i===".devpipe/"||i==="/.devpipe"||i==="/.devpipe/"?o.replace(".devpipe",".codepipe"):o}).join(`
@@ -272,6 +272,14 @@ Automation level: **${t.automationLevel}**.
272
272
  # above). Its open PR is left untouched. Remove the key to disable.
273
273
  # done_columns:
274
274
  # - Done
275
+ # Optional: statuses offered for manual switching from the task card (a
276
+ # per-project allow-list; can include statuses outside the pipeline roles
277
+ # above). Remove/empty to hide the manual switcher.
278
+ # status_columns:
279
+ # - Develop
280
+ # - In Progress
281
+ # - Review
282
+ # - Done
275
283
  # Sync gate on assignee. require_assignee=false (or the key missing) \u2014
276
284
  # behavior unchanged. When true, CodePipe only pulls tasks of the given
277
285
  # assignee (YT login) into the pipeline; without assignee \u2014 any task with a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-partner/codepipe",
3
- "version": "0.3.3-dev.96.gbcb185c",
3
+ "version": "0.3.3-dev.98.gd2baea2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {