werkmeister 0.85.0 → 0.85.1

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/dist/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __sandboxCreateRequire } from "node:module";
3
3
  const require = __sandboxCreateRequire(import.meta.url);
4
- var gee=Object.create;var Z0=Object.defineProperty;var yee=Object.getOwnPropertyDescriptor;var wee=Object.getOwnPropertyNames;var xee=Object.getPrototypeOf,kee=Object.prototype.hasOwnProperty;var i=(e,t)=>Z0(e,"name",{value:t,configurable:!0}),oe=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ie=(e,t)=>{for(var r in t)Z0(e,r,{get:t[r],enumerable:!0})},bee=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wee(t))!kee.call(e,s)&&s!==r&&Z0(e,s,{get:()=>t[s],enumerable:!(n=yee(t,s))||n.enumerable});return e};var $e=(e,t,r)=>(r=e!=null?gee(xee(e)):{},bee(t||!e||!e.__esModule?Z0(r,"default",{value:e,enumerable:!0}):r,e));var v,h=R(()=>{v={sha:"09d4fc8c24903b7152d013ce858d337e4e68e734",dirty:!1}});var Wd=T(hS=>{h();var eg=class extends Error{static{i(this,"CommanderError")}constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},pS=class extends eg{static{i(this,"InvalidArgumentError")}constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};hS.CommanderError=eg;hS.InvalidArgumentError=pS});var tg=T(gS=>{h();var{InvalidArgumentError:See}=Wd(),mS=class{static{i(this,"Argument")}constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new See(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function _ee(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}i(_ee,"humanReadableArgName");gS.Argument=mS;gS.humanReadableArgName=_ee});var xS=T(wS=>{h();var{humanReadableArgName:Eee}=tg(),yS=class{static{i(this,"Help")}constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(s=>!s._hidden),n=t._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((s,o)=>s.name().localeCompare(o.name())),r}compareOptions(t,r){let n=i(s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,""),"getSortKey");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(s=>!s.hidden),n=t._getHelpOption();if(n&&!n.hidden){let s=n.short&&t._findOption(n.short),o=n.long&&t._findOption(n.long);!s&&!o?r.push(n):n.long&&!o?r.push(t.createOption(n.long,n.description)):n.short&&!s&&r.push(t.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let s=n.options.filter(o=>!o.hidden);r.push(...s)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>Eee(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(s)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(s)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let s=t.parent;s;s=s.parent)n=s.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatItemList(t,r,n){return r.length===0?[]:[n.styleTitle(t),...r,""]}groupItems(t,r,n){let s=new Map;return t.forEach(o=>{let a=n(o);s.has(a)||s.set(a,[])}),r.forEach(o=>{let a=n(o);s.has(a)||s.set(a,[]),s.get(a).push(o)}),s}formatHelp(t,r){let n=r.padWidth(t,r),s=r.helpWidth??80;function o(d,p){return r.formatItem(d,n,p,r)}i(o,"callFormatItem");let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],c=r.commandDescription(t);c.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(c),s),""]));let l=r.visibleArguments(t).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",l,r)),this.groupItems(t.options,r.visibleOptions(t),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let m=d.map(w=>o(r.styleOptionTerm(r.optionTerm(w)),r.styleOptionDescription(r.optionDescription(w))));a=a.concat(this.formatItemList(p,m,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(t).map(p=>o(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(t.commands,r.visibleCommands(t),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let m=d.map(w=>o(r.styleSubcommandTerm(r.subcommandTerm(w)),r.styleSubcommandDescription(r.subcommandDescription(w))));a=a.concat(this.formatItemList(p,m,r))}),a.join(`
4
+ var gee=Object.create;var Z0=Object.defineProperty;var yee=Object.getOwnPropertyDescriptor;var wee=Object.getOwnPropertyNames;var xee=Object.getPrototypeOf,kee=Object.prototype.hasOwnProperty;var i=(e,t)=>Z0(e,"name",{value:t,configurable:!0}),oe=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ie=(e,t)=>{for(var r in t)Z0(e,r,{get:t[r],enumerable:!0})},bee=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wee(t))!kee.call(e,s)&&s!==r&&Z0(e,s,{get:()=>t[s],enumerable:!(n=yee(t,s))||n.enumerable});return e};var $e=(e,t,r)=>(r=e!=null?gee(xee(e)):{},bee(t||!e||!e.__esModule?Z0(r,"default",{value:e,enumerable:!0}):r,e));var v,h=R(()=>{v={sha:"9e142b87a8fff061e06125c591ecab6f3feae19a",dirty:!1}});var Wd=T(hS=>{h();var eg=class extends Error{static{i(this,"CommanderError")}constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},pS=class extends eg{static{i(this,"InvalidArgumentError")}constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};hS.CommanderError=eg;hS.InvalidArgumentError=pS});var tg=T(gS=>{h();var{InvalidArgumentError:See}=Wd(),mS=class{static{i(this,"Argument")}constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new See(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function _ee(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}i(_ee,"humanReadableArgName");gS.Argument=mS;gS.humanReadableArgName=_ee});var xS=T(wS=>{h();var{humanReadableArgName:Eee}=tg(),yS=class{static{i(this,"Help")}constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(s=>!s._hidden),n=t._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((s,o)=>s.name().localeCompare(o.name())),r}compareOptions(t,r){let n=i(s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,""),"getSortKey");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(s=>!s.hidden),n=t._getHelpOption();if(n&&!n.hidden){let s=n.short&&t._findOption(n.short),o=n.long&&t._findOption(n.long);!s&&!o?r.push(n):n.long&&!o?r.push(t.createOption(n.long,n.description)):n.short&&!s&&r.push(t.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let s=n.options.filter(o=>!o.hidden);r.push(...s)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>Eee(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(s)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(s)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let s=t.parent;s;s=s.parent)n=s.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatItemList(t,r,n){return r.length===0?[]:[n.styleTitle(t),...r,""]}groupItems(t,r,n){let s=new Map;return t.forEach(o=>{let a=n(o);s.has(a)||s.set(a,[])}),r.forEach(o=>{let a=n(o);s.has(a)||s.set(a,[]),s.get(a).push(o)}),s}formatHelp(t,r){let n=r.padWidth(t,r),s=r.helpWidth??80;function o(d,p){return r.formatItem(d,n,p,r)}i(o,"callFormatItem");let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],c=r.commandDescription(t);c.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(c),s),""]));let l=r.visibleArguments(t).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",l,r)),this.groupItems(t.options,r.visibleOptions(t),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let m=d.map(w=>o(r.styleOptionTerm(r.optionTerm(w)),r.styleOptionDescription(r.optionDescription(w))));a=a.concat(this.formatItemList(p,m,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(t).map(p=>o(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(t.commands,r.visibleCommands(t),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let m=d.map(w=>o(r.styleSubcommandTerm(r.subcommandTerm(w)),r.styleSubcommandDescription(r.subcommandDescription(w))));a=a.concat(this.formatItemList(p,m,r))}),a.join(`
5
5
  `)}displayWidth(t){return NI(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,n,s){let a=" ".repeat(2);if(!n)return a+t;let c=t.padEnd(r+t.length-s.displayWidth(t)),l=2,f=(this.helpWidth??80)-r-l-2,d;return f<this.minWidthToWrap||s.preformatted(n)?d=n:d=s.boxWrap(n,f).replace(/\n/g,`
6
6
  `+" ".repeat(r+l)),a+c+" ".repeat(l)+d.replace(/\n/g,`
7
7
  ${a}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let n=t.split(/\r\n|\n/),s=/[\s]*[^\s]+/g,o=[];return n.forEach(a=>{let c=a.match(s);if(c===null){o.push("");return}let l=[c.shift()],u=this.displayWidth(l[0]);c.forEach(f=>{let d=this.displayWidth(f);if(u+d<=r){l.push(f),u+=d;return}o.push(l.join(""));let p=f.trimStart();l=[p],u=this.displayWidth(p)}),o.push(l.join(""))}),o.join(`
@@ -285,7 +285,7 @@ ${t.comment}`].filter(Boolean),n=await Pn().askJson(`Do exactly this on the Jira
285
285
  `)+`
286
286
  Then output ONLY <result>{"ok":true}</result>, or <result>{"ok":false,"error":"<why>"}</result> when any step failed. Write no prose outside the tags.`,{tools:!0});if(n?.ok!==!0)throw new Error(br(n?.error)??`Could not update ${e} through the Atlassian MCP`)}function bD(e){let t=null;return e.split(`
287
287
  `).map(r=>{let n=/^\s*(```|~~~)\s*[\w-]*\s*$/.exec(r);if(n&&(!t||n[1]===t))return t=t?null:n[1],"{code}";if(t)return r;let s=i(c=>c.split(/(`[^`]+`)/).map(l=>l.startsWith("`")&&l.length>1?Vie(l.slice(1,-1)):l.replace(/\*\*(.+?)\*\*/g,"*$1*").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,"[$1|$2]")).join(""),"inline"),o=/^(#{1,6})\s+(.*)$/.exec(r);if(o)return`h${o[1].length}. ${s(o[2])}`;let a=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/.exec(r);if(a){let c=Math.floor(a[1].replace(/\t/g," ").length/2)+1;return`${(/\d/.test(a[2])?"#":"*").repeat(c)} ${s(a[3])}`}return s(r)}).join(`
288
- `)}function r$(e={}){let t=e.project?.toUpperCase();return{id:"jira",label:"Jira",refExample:"PROJ-123",refPattern:null,issueTypes:SD,parseRef:i(r=>qie.exec(r??"")?.[0].toUpperCase()??null,"parseRef"),slug:i(r=>r.trim().toLowerCase(),"slug"),holds:i(r=>!t||r.toUpperCase().startsWith(`${t}-`),"holds"),url:zy,async fetchIssue(r,n){let s=await dD(r,n);if(s)return kD(s);let o=await Hie(r);return o||n?.push("the Atlassian MCP fallback returned no issue"),o},async fetchIssues(r){if(!r.length)return{};let n=await pD(r)??await Kie(r),s={};for(let[o,a]of Object.entries(n))s[o]={ref:o,status:a,url:zy(o)??void 0};return s},filingGuide(r,n="<workspace>"){let s=/^([A-Z][A-Z0-9]+)-\d+$/.exec(r)?.[1]??t,o=Zj(),a=(ni().base_url??"").trim().replace(/\/+$/,""),c=ba(a)||!a?"":` (${a})`,l=i(m=>`\`werkmeister issue create --project ${m??"<KEY>"} --type <type> --title "<title>" --body-file <file> [--relates <issue>]\`; `+(r?`pass \`--relates ${r}\` for a follow-up from this run; `:"")+"if it fails for want of a Jira API token, the Atlassian MCP tools if connected, otherwise hand the person the title, type and body to file","command"),u=i((m,w)=>`JQL \`${m?`project = ${m} AND `:""}text ~ "${w}"\``,"jql"),f=i(m=>`${u(m,"<keywords>")}, then ${u(m,n)}`,"both"),d=i(m=>`\`gh issue list -R ${Yie} --search "${m}" --state all\``,"gh");return{row:`| app code in a worktree | ${`Jira${s?`, project \`${s}\``:" \u2014 ask the person which project"}${c}`} | ${l(s)} |`,werkmeister:o?{where:`Jira, project \`${o}\`${c}`,command:l(o)}:void 0,search:`Search first: ${f(s)}: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead. (Werkmeister issues: ${o?f(o):`${d("<keywords>")}, then ${d(n)}`}.)`}},async createIssue({project:r,type:n,title:s,body:o}){let a=await yD({project:r,issueType:SD[n],fallbackLabel:n,summary:s,description:bD(o)});if(!a)throw new Error(vD);return{ref:a.key,title:s,type:a.issueType,url:a.url}},async linkIssue(r,n){if(!await wD(r,n))throw new Error(vD)},async listReady(r){if(!r&&!t)throw new Error("no Jira project in scope");let n=r?await gD(r.id,r.ready):await mD(`project = ${t} AND statusCategory != Done ORDER BY priority DESC, rank ASC`);if(!n)throw new Error("listing ready work needs Jira REST credentials (docs/jira-rest-setup.md)");return n.map(kD)},async updateIssue(r,n){let s=n.comment?{...n,comment:bD(n.comment)}:n;await xD(r,s)===null&&await Gie(r,n)},async checkAuth(){let r="set jira.base_url, jira.email and jira.api_token (docs/jira-rest-setup.md)";try{let n=await fD();if(n)return{ok:!0,who:n.who,fix:""};let s=ni();return[process.env.JIRA_BASE_URL,process.env.JIRA_EMAIL,process.env.JIRA_API_TOKEN,s.base_url,s.email,s.api_token].some(a=>a&&ba(String(a)))?{ok:!1,reason:"Jira settings still hold the placeholder values",fix:r}:{ok:!0,who:"via Atlassian MCP (not checked)",fix:""}}catch(n){return{ok:!1,reason:n.message,fix:r}}}}}var qie,br,Wie,ED,$D,Vie,Yie,vD,SD,OD,n$=R(()=>{"use strict";h();ze();Qp();t$();qie=/[A-Za-z][A-Za-z0-9]+-\d+/;i(zy,"jiraBrowseUrl");i(_D,"jiraSiteRef");i(Jy,"jiraSitePhrase");br=i(e=>typeof e=="string"&&e.trim()?e.trim():void 0,"str"),Wie=["new","indeterminate","done"],ED=i(e=>Wie.find(t=>t===br(e)?.toLowerCase()),"category");i(kD,"fromRest");$D="Do not create, edit, transition, or comment on anything; write no prose outside the tags.";i(Hie,"fetchViaMcp");i(Kie,"statusesViaMcp");i(Gie,"updateViaMcp");Vie=i(e=>`{{${e.replace(/([-{}!*_+^~[\]|#])/g,"\\$1")}}}`,"monoEscape");i(bD,"markdownToWiki");Yie="jbbz-sandbox/werkmeister",vD="no Jira REST credentials: set jira.base_url, jira.email and jira.api_token (docs/jira-rest-setup.md), or file it with the Atlassian MCP tools",SD={bug:"Bug",feature:"Story",task:"Task"};i(r$,"jiraTracker");OD=r$()});function mo(e){return CD[e]}function Zp(e){let t=(e??Pe()).overrides?.issue_tracker;return io.includes(t)?t:"jira"}function eh(e){return zie[e.tracker](e.scope)}function Sa(e={}){let t=gn();if(!t.length)return null;let r=e.project?.trim();if(r){let n=t.find(s=>s.name===r);return n||(TD.has(r)||(TD.add(r),C(`project "${r}" is not in projects: of the config \u2014 using the machine's tracker`)),null)}if(!e.text)return null;for(let n of t){let s=eh(n),o=s.parseRef(e.text);if(o&&s.holds(o))return n}return null}function th(){let e=gn().filter(t=>t.default);return e.length===1?e[0]:null}function be(e){let t=e?Sa(e):null;return t?eh(t):CD[Zp()]}function Xy(e,t=""){let r=gn();if(!r.length){if(t)throw new Error(`--project ${t}: this machine has no projects: in its config`);return null}let n=r.map(c=>c.name).join(", "),s=t?r.find(c=>c.name===t):void 0;if(t&&!s)throw new Error(`no project "${t}" (projects: ${n})`);if(!e)return s??null;let o=s??Sa({text:e})??th();if(!o)throw new Error(`${e} isn't in any project's scope; pass --project (one of: ${n})`);let a=eh(o);if(!a.parseRef(e))throw new Error(`${e} isn't a ${a.label} issue in project ${o.name} (e.g. ${a.refExample})`);return o}function pi(e){return Kc(e?.project)}function hi(e){return Kc(e?.issue_id)||Kc(e?.jira_id)||Kc(e?.github_issue)}function Ku(e){let t=hi(e);if(!t)return[];let r=e?.group,n=Array.isArray(r)?r:String(r??"").split(",");return[...new Set([t,...n.map(s=>String(s).trim()).filter(Boolean)])]}function _a(e){return Kc(e.ISSUE_ID)||Kc(e.JIRA_ID)||Kc(e.GITHUB_ISSUE)}function PD(e){let t=_a(e);return t?[t,be().url(t)]:null}function Gu(e,t={}){let r=[`${e.ref}: ${e.title??"(no title)"}`],n=[e.status&&`Status: ${e.status}`,e.type&&`Type: ${e.type}`,e.assignee&&`Assignee: ${e.assignee}`].filter(Boolean);if(n.length&&r.push(n.join(" \xB7 ")),e.description){let o=e.description,a=t.full?0:Math.max(0,o.length-RD);r.push("","Description:",a?o.slice(0,RD):o),a&&r.push(`[cut: ${a} more characters not shown]`)}let s=e.comments??[];if(s.length){r.push("",`Comments (last ${Math.min(s.length,AD)} of ${s.length}):`);for(let o of s.slice(-AD)){let a=o.created?` ${o.created.slice(0,10)}`:"";r.push(`- [${o.author}${a}] ${o.body.slice(0,Jie)}`)}}return r.join(`
288
+ `)}function r$(e={}){let t=e.project?.toUpperCase();return{id:"jira",label:"Jira",refExample:"PROJ-123",refPattern:null,issueTypes:SD,parseRef:i(r=>qie.exec(r??"")?.[0].toUpperCase()??null,"parseRef"),slug:i(r=>r.trim().toLowerCase(),"slug"),holds:i(r=>!t||r.toUpperCase().startsWith(`${t}-`),"holds"),url:zy,async fetchIssue(r,n){let s=await dD(r,n);if(s)return kD(s);let o=await Hie(r);return o||n?.push("the Atlassian MCP fallback returned no issue"),o},async fetchIssues(r){if(!r.length)return{};let n=await pD(r)??await Kie(r),s={};for(let[o,a]of Object.entries(n))s[o]={ref:o,status:a,url:zy(o)??void 0};return s},filingGuide(r,n="<workspace>"){let s=/^([A-Z][A-Z0-9]+)-\d+$/.exec(r)?.[1]??t,o=Zj(),a=(ni().base_url??"").trim().replace(/\/+$/,""),c=ba(a)||!a?"":` (${a})`,l=i(m=>`\`werkmeister issue create --project ${m??"<KEY>"} --type <type> --title "<title>" --body-file <file> [--relates <issue>]\`; `+(r?`pass \`--relates ${r}\` for a follow-up from this run; `:"")+"if it fails for want of a Jira API token, the Atlassian MCP tools if connected, otherwise hand the person the title, type and body to file","command"),u=i((m,w)=>`JQL \`${m?`project = ${m} AND `:""}text ~ "${w}"\``,"jql"),f=i(m=>`${u(m,"<keywords>")}, then ${u(m,n)}`,"both"),d=i(m=>`\`gh issue list -R ${Yie} --search "${m}" --state all\``,"gh");return{row:`| app code in a worktree | ${`Jira${s?`, project \`${s}\``:" \u2014 ask the person which project"}${c}`} | ${l(s)} |`,werkmeister:o?{where:`Jira, project \`${o}\`${c}`,command:l(o)}:void 0,search:`Search first: ${f(s)}: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead. (Werkmeister issues: ${o?f(o):`${d("<keywords>")}, then ${d(n)}`}.)`}},async createIssue({project:r,type:n,title:s,body:o}){let a=await yD({project:r,issueType:SD[n],fallbackLabel:n,summary:s,description:bD(o)});if(!a)throw new Error(vD);return{ref:a.key,title:s,type:a.issueType,url:a.url}},async linkIssue(r,n){if(!await wD(r,n))throw new Error(vD)},async listReady(r){if(!r&&!t)throw new Error("no Jira project in scope");let n=r?await gD(r.id,r.ready):await mD(`project = ${t} AND statusCategory != Done ORDER BY priority DESC, rank ASC`);if(!n)throw new Error("listing ready work needs Jira REST credentials (docs/issue-trackers.md)");return n.map(kD)},async updateIssue(r,n){let s=n.comment?{...n,comment:bD(n.comment)}:n;await xD(r,s)===null&&await Gie(r,n)},async checkAuth(){let r="set jira.base_url, jira.email and jira.api_token (docs/issue-trackers.md)";try{let n=await fD();if(n)return{ok:!0,who:n.who,fix:""};let s=ni();return[process.env.JIRA_BASE_URL,process.env.JIRA_EMAIL,process.env.JIRA_API_TOKEN,s.base_url,s.email,s.api_token].some(a=>a&&ba(String(a)))?{ok:!1,reason:"Jira settings still hold the placeholder values",fix:r}:{ok:!0,who:"via Atlassian MCP (not checked)",fix:""}}catch(n){return{ok:!1,reason:n.message,fix:r}}}}}var qie,br,Wie,ED,$D,Vie,Yie,vD,SD,OD,n$=R(()=>{"use strict";h();ze();Qp();t$();qie=/[A-Za-z][A-Za-z0-9]+-\d+/;i(zy,"jiraBrowseUrl");i(_D,"jiraSiteRef");i(Jy,"jiraSitePhrase");br=i(e=>typeof e=="string"&&e.trim()?e.trim():void 0,"str"),Wie=["new","indeterminate","done"],ED=i(e=>Wie.find(t=>t===br(e)?.toLowerCase()),"category");i(kD,"fromRest");$D="Do not create, edit, transition, or comment on anything; write no prose outside the tags.";i(Hie,"fetchViaMcp");i(Kie,"statusesViaMcp");i(Gie,"updateViaMcp");Vie=i(e=>`{{${e.replace(/([-{}!*_+^~[\]|#])/g,"\\$1")}}}`,"monoEscape");i(bD,"markdownToWiki");Yie="jbbz-sandbox/werkmeister",vD="no Jira REST credentials: set jira.base_url, jira.email and jira.api_token (docs/issue-trackers.md), or file it with the Atlassian MCP tools",SD={bug:"Bug",feature:"Story",task:"Task"};i(r$,"jiraTracker");OD=r$()});function mo(e){return CD[e]}function Zp(e){let t=(e??Pe()).overrides?.issue_tracker;return io.includes(t)?t:"jira"}function eh(e){return zie[e.tracker](e.scope)}function Sa(e={}){let t=gn();if(!t.length)return null;let r=e.project?.trim();if(r){let n=t.find(s=>s.name===r);return n||(TD.has(r)||(TD.add(r),C(`project "${r}" is not in projects: of the config \u2014 using the machine's tracker`)),null)}if(!e.text)return null;for(let n of t){let s=eh(n),o=s.parseRef(e.text);if(o&&s.holds(o))return n}return null}function th(){let e=gn().filter(t=>t.default);return e.length===1?e[0]:null}function be(e){let t=e?Sa(e):null;return t?eh(t):CD[Zp()]}function Xy(e,t=""){let r=gn();if(!r.length){if(t)throw new Error(`--project ${t}: this machine has no projects: in its config`);return null}let n=r.map(c=>c.name).join(", "),s=t?r.find(c=>c.name===t):void 0;if(t&&!s)throw new Error(`no project "${t}" (projects: ${n})`);if(!e)return s??null;let o=s??Sa({text:e})??th();if(!o)throw new Error(`${e} isn't in any project's scope; pass --project (one of: ${n})`);let a=eh(o);if(!a.parseRef(e))throw new Error(`${e} isn't a ${a.label} issue in project ${o.name} (e.g. ${a.refExample})`);return o}function pi(e){return Kc(e?.project)}function hi(e){return Kc(e?.issue_id)||Kc(e?.jira_id)||Kc(e?.github_issue)}function Ku(e){let t=hi(e);if(!t)return[];let r=e?.group,n=Array.isArray(r)?r:String(r??"").split(",");return[...new Set([t,...n.map(s=>String(s).trim()).filter(Boolean)])]}function _a(e){return Kc(e.ISSUE_ID)||Kc(e.JIRA_ID)||Kc(e.GITHUB_ISSUE)}function PD(e){let t=_a(e);return t?[t,be().url(t)]:null}function Gu(e,t={}){let r=[`${e.ref}: ${e.title??"(no title)"}`],n=[e.status&&`Status: ${e.status}`,e.type&&`Type: ${e.type}`,e.assignee&&`Assignee: ${e.assignee}`].filter(Boolean);if(n.length&&r.push(n.join(" \xB7 ")),e.description){let o=e.description,a=t.full?0:Math.max(0,o.length-RD);r.push("","Description:",a?o.slice(0,RD):o),a&&r.push(`[cut: ${a} more characters not shown]`)}let s=e.comments??[];if(s.length){r.push("",`Comments (last ${Math.min(s.length,AD)} of ${s.length}):`);for(let o of s.slice(-AD)){let a=o.created?` ${o.created.slice(0,10)}`:"";r.push(`- [${o.author}${a}] ${o.body.slice(0,Jie)}`)}}return r.join(`
289
289
  `)}var CD,zie,TD,Kc,RD,AD,Jie,Pr=R(()=>{"use strict";h();ze();ZE();n$();fy();Rc();ge();ZE();n$();fy();CD={jira:OD,github:lD};i(mo,"trackerById");i(Zp,"loadIssueTracker");zie={jira:r$,github:QE};i(eh,"projectTracker");TD=new Set;i(Sa,"projectFor");i(th,"defaultProject");i(be,"issueTracker");i(Xy,"projectForIssue");Kc=i(e=>typeof e=="string"?e.trim():"","str");i(pi,"projectOf");i(hi,"issueIdOf");i(Ku,"issueRefsOf");i(_a,"issueIdOfMeta");i(PD,"issueLink");RD=4e3,AD=10,Jie=1e3;i(Gu,"issueBriefing")});function rh(e=Vr()){let t=s$(e.models)?e.models:{},r=t.default_tier;if(r!==void 0&&!(typeof r=="string"&&ND(r)))throw new B(`models.default_tier must be one of ${o$.join(", ")} (got ${String(r)})`);let n=new Set([...Object.keys(ID),...Object.keys(t).filter(o=>o!=="default_tier"&&s$(t[o]))]),s={};for(let o of n){let a=s$(t[o])?t[o]:{};s[o]=Object.fromEntries(o$.map(c=>{let l=a[c];if(typeof l=="string"&&l.trim())return[c,{model:l.trim(),origin:"YAML"}];let u=ID[o]?.[c];return[c,u?{model:u,origin:"default"}:void 0]}))}return{defaultTier:r??"frontier",defaultOrigin:r===void 0?"default":"YAML",byHarness:s}}function Qy(e,t,r){let n=(e??"").trim();if(Xie.has(t))return{model:n||null,tier:null};if(n&&!ND(n))return{model:n,tier:null};let s=rh(r??Vr()),o=n||s.defaultTier,a=s.byHarness[t]?.[o]?.model;if(!a)throw new B(`No model for tier ${o} on harness ${t}: set models.${t}.${o} in ~/.werkmeister/config.yaml`);return{model:a,tier:o}}var o$,ID,Xie,ND,s$,nh=R(()=>{"use strict";h();Q();st();o$=["small","mid","frontier","advanced_frontier"],ID={claude:{small:"haiku",mid:"sonnet",frontier:"opus",advanced_frontier:"claude-fable-5-1"},opencode:{small:"anthropic/claude-haiku-5-5",mid:"anthropic/claude-sonnet-5-5",frontier:"anthropic/claude-opus-5-5",advanced_frontier:"anthropic/claude-fable-5-1"},codex:{}},Xie=new Set(["mcp"]),ND=i(e=>o$.includes(e),"isTier"),s$=i(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isDict");i(rh,"modelTiers");i(Qy,"resolveModel")});var kn,Zy=R(()=>{"use strict";h();kn=["icm","jit"]});import*as ls from"node:fs";import*as i$ from"node:os";import*as cs from"node:path";function Qie(e){try{return ls.statSync(e).isDirectory()}catch{return!1}}function Zie(e){let t=[],r=0,n=e.length,s=!1;for(;r<n;){let o=e[r];if(s){if(t.push(o),o==="\\"&&r+1<n){t.push(e[r+1]),r+=2;continue}o==='"'&&(s=!1),r+=1;continue}if(o==='"'){s=!0,t.push(o),r+=1;continue}if(o==="/"&&r+1<n){let a=e[r+1];if(a==="/"){for(r+=2;r<n&&e[r]!==`
290
290
  `;)r+=1;continue}if(a==="*"){for(r+=2;r+1<n&&!(e[r]==="*"&&e[r+1]==="/");)r+=1;r+=2;continue}}t.push(o),r+=1}return t.join("")}function tw(e){let t=ls.readFileSync(e,"utf8"),r=cs.extname(e);return r===".yaml"||r===".yml"?LD.parse(t):JSON.parse(Zie(t))}function In(e){return/^(true|1|yes|on)$/i.test(String(e??"").trim())}function Gc(e){return In(go(e,"autonomous"))}function sh(e){let t=go(e,"auto_stop");return t==null||t===""?Gc(e):In(t)}function a$(e){let{model:t}=Qy(e.model,e.harness||fr[0]);t?e.model=t:delete e.model}function zu(e){let t=go(e,"model");return typeof t=="string"&&t.trim()?t.trim():null}function go(e,t){let r=Se("WORKSPACE_CONFIG"),n=[...r?[Vu(r)]:[],...Ju.map(s=>cs.join(W(e),s))];for(let s of n)if(ls.existsSync(s))try{return tw(s)?.[t]}catch{return}}function Ft(e,t){let r=[];t&&r.push(Vu(t));let n=Se("WORKSPACE_CONFIG");n&&r.push(Vu(n));let s=W(e);for(let o of Ju)r.push(cs.join(s,o));for(let o of r){if(!ls.existsSync(o))continue;let a;try{a=tw(o)}catch(c){return C(`Config file ${o} unreadable: ${c.message} \u2014 skipping.`),{}}return typeof a!="object"||a===null||Array.isArray(a)?(C(`Config file ${o} must be a mapping \u2014 skipping.`),{}):(O(`Loaded workspace config from ${o}`),a)}return{}}function Vu(e){return e==="~"?i$.homedir():e.startsWith("~/")?cs.join(i$.homedir(),e.slice(2)):e}function DD(e){return/['"$#\\]/.test(e)?`"${e.replace(/[\\"$]/g,"\\$&")}"`:e}function c$(e){return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\([\\"$])/g,"$1"):e}function eae(e){let t=cs.join(e,".env");if(!(ls.existsSync(t)&&ls.statSync(t).isFile()))return{};let r={};for(let[,,s]of Yu)r[s.toUpperCase()]=s;r.JIRA_ID=r.GITHUB_ISSUE="issue_id";let n={};for(let s of ls.readFileSync(t,"utf8").split(`
291
291
  `)){if(s=s.trim(),!s||s.startsWith("#")||!s.includes("="))continue;let o=s.indexOf("="),a=s.slice(0,o).trim(),c=s.slice(o+1);a in r&&(n[r[a]]=c$(c.trim()))}return n}function Vc(e,t){let r=Ft(t,e.config_file??null),n=eae(t),s={};for(let[c,l,u]of Yu){let f=e[c]??null,d=l?Se(l)??null:null,p=u==="issue_id"?hi(r)||null:u in r?r[u]:null,m=u in n?n[u]:null;for(let w of[f,d,p,m]){if(w==null)continue;let g;if(Array.isArray(w)?g=w.map(y=>String(y).trim()).filter(y=>y).join(","):g=String(w).trim(),g){s[u]=g;break}}}let o=e.services;!s.services&&o!==null&&o!==void 0&&!String(o).trim()&&(s.services="");let a=i(()=>be({project:s.project,text:s.issue_id??""}),"tracker");if(s.issue_id&&(s.issue_id=a().parseRef(s.issue_id)??s.issue_id),s.group){let c=a(),l=[...new Set(s.group.split(",").map(u=>c.parseRef(u)??u))].filter(u=>u!==s.issue_id);s.group=l.join(",")}return s.autonomous&&(s.autonomous=String(In(s.autonomous))),s.auto_stop&&(s.auto_stop=String(In(s.auto_stop))),s}function tae(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.join("-"):e}function rae(e){for(let t of ls.readdirSync(e).sort()){let r=cs.join(e,t);if(!Qie(r)||t.startsWith("."))continue;let n;try{n=K(["git","-C",r,"branch","--show-current"],{capture:!0,timeout:5})}catch(a){if(a instanceof ne&&(a.code==="ENOENT"||a.code==="ETIMEDOUT"))continue;throw a}if(n.status!==0)continue;let s=n.stdout.trim(),o=be({text:s}).parseRef(s);if(o)return o}return""}function Yc(e){let t=e.trim().toLowerCase();return Object.hasOwn(ew,t)?ew[t]:l$}function rw(e,t,r,n={}){let s={key:e.key,label:e.label,help:e.help,accept_empty:e.acceptEmpty??!0,multi:e.multi??!1,recommended:e.recommended??!1,default:e.defaultFn&&n.defaults!==!1?e.defaultFn(t):e.default??"",resolved:e.key in r,resolved_value:e.key in r?r[e.key]:null};if(e.multiline&&(s.multiline=!0),e.boolean&&(s.boolean=!0),e.refinable&&(s.refinable=!0,e.refineInstruction&&(s.refine_instruction=e.refineInstruction)),e.pattern&&(s.pattern=e.pattern),e.placeholder&&(s.placeholder=e.placeholder),e.choicesFn&&(s.choices=e.choicesFn()),e.choiceGroupsFn){let o={},a=e.choiceGroupsFn();for(let c of s.choices??Object.keys(a))(o[a[c]??"other"]??=[]).push(c);s.choice_groups=Object.fromEntries(Object.entries(o).sort(([c],[l])=>c.localeCompare(l)))}return s}function sae(){let e=gn();if(e.length){let r=[...new Set(e.map(n=>mo(n.tracker).refExample))];return jD.map(n=>n.key==="issue_id"?{...n,placeholder:r.join(" or ")}:n)}let t=be();return jD.flatMap(r=>r.key==="project"?[]:r.key==="issue_id"?[{...r,placeholder:t.refExample,...t.refPattern?{pattern:t.refPattern}:{}}]:[r])}function oae(e,t,r={}){return{workspace_root:e,workspace_name:cs.basename(e),prompts:sae().map(n=>rw(n,e,t,r))}}function u$(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "):e}function Nn(){try{return[ce(),hn()]}catch{return[{},{}]}}function FD(e,t,r={}){return f$(t,Vc(e,t),r)}function f$(e,t,r={}){let n=oae(e,t,r),s=rw(iae,"",t);if(s.choices.length){let o=n.prompts??[],a=o.findIndex(c=>c.key==="services");a===-1&&(a=o.length-1),o.splice(a+1,0,s),n.prompts=o}return n}var LD,Yu,Ju,ew,l$,nae,jD,iae,Vt=R(()=>{"use strict";h();LD=$e(Ye(),1);An();Q();Wu();Pr();nh();ut();Rc();ge();Zy();i(Qie,"isDir");i(Zie,"stripJsoncComments");i(tw,"loadWorkspaceConfig");Yu=[["feature",null,"feature"],["work_type","WORK_TYPE","work_type"],["context_strategy","CONTEXT_STRATEGY","context_strategy"],["harness","HARNESS","harness"],["repos","REPOS","repos"],["services","SERVICES","services"],["issue_id","ISSUE_ID","issue_id"],["project","PROJECT","project"],["test_path","TEST_PATH","test_path"],["description","DESCRIPTION","description"],["task","TASK","task"],["starting_prompt","STARTING_PROMPT","starting_prompt"],["labels","LABELS","labels"],["group","GROUP","group"],["autonomous","AUTONOMOUS","autonomous"],["model","MODEL","model"],["auto_stop","AUTO_STOP","auto_stop"]];i(In,"isTrue");i(Gc,"readAutonomous");i(sh,"readAutoStop");i(a$,"resolveModelInput");i(zu,"readModel");i(go,"readWorkspaceField");Ju=["workspace.yml","workspace.yaml","workspace.jsonc","workspace.json"];i(Ft,"loadConfigFile");i(Vu,"expandUserPath");i(DD,"quoteEnvValue");i(c$,"unquoteEnvValue");i(eae,"loadExistingEnvMetadata");i(Vc,"resolveInputs");i(tae,"defaultFeatureFromDir");i(rae,"scrapeIssueId");ew={feature:{path:"architectural",phases:["research","implement","test","review","pr"],gate:{note:"decision",status:"decided"},hint:"invoke `w9r-research` first \u2014 it ends in a `decision` note the user approves before any code"},bugfix:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to reproduce and write the root cause to a `finding` note before changing code"},incident:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to diagnose; the `finding` note is the incident record"},refactor:{path:"bounded",phases:["implement","test","review","pr"],gate:null,hint:"invoke `w9r-implement` first \u2014 the scope is known and standards matter most"},spike:{path:"spike",phases:["research"],gate:null,hint:"invoke `w9r-research` first to frame the questions; anything built is throwaway and there is no PR"}},l$={path:"architectural",phases:["research","implement","test","review","pr"],gate:null,hint:"invoke `w9r-research` first"};i(Yc,"planFor");nae=Object.keys(ew),jD=[{key:"issue_id",label:"Issue",help:"Issue ID in this machine's issue tracker. The issue is fetched and stored in the workspace; empty fields are filled from it.",defaultFn:i(e=>rae(e),"defaultFn")},{key:"project",label:"Project",help:"The project whose tracker holds the issue (projects: in ~/.werkmeister/config.yaml). Blank picks the one whose scope holds the issue, else the default project.",choicesFn:i(()=>gn().map(e=>e.name),"choicesFn"),defaultFn:i(()=>th()?.name??"","defaultFn")},{key:"feature",label:"Feature name",help:`Lowercase, hyphen-separated. Drives workspace slot routing via the X-Feature cookie. No feature = no ${Oe} / werkmeister-context.md.`,acceptEmpty:!1,recommended:!0,pattern:"^[a-z0-9]+(-[a-z0-9]+)*$",placeholder:"mdx-blog",defaultFn:i(e=>tae(cs.basename(e)),"defaultFn")},{key:"work_type",label:"Work type",help:"What kind of work this is; selects the phase sequence and the pre-implementation gate in CLAUDE.md.",acceptEmpty:!1,pattern:"^("+Object.keys(ew).join("|")+")$",default:"feature",choicesFn:i(()=>[...nae],"choicesFn")},{key:"context_strategy",label:"Workflow",help:"Which context layer init-workspace generates: jit (w9r-* skills, hooks, notes) or icm (staged folders the agent walks by itself).",pattern:"^("+kn.join("|")+")$",default:kn[0],choicesFn:i(()=>[...kn],"choicesFn")},{key:"harness",label:"Harness",help:"Which agent harness reads this workspace: claude (Claude Code: CLAUDE.md, .claude/, hooks), mcp (any harness with MCP and skills: AGENTS.md, .agents/skills, no hooks) or codex (Codex CLI: AGENTS.md, .agents/skills, .codex/hooks.json, .codex/config.toml).",pattern:"^("+fr.join("|")+")$",default:fr[0],choicesFn:i(()=>[...fr],"choicesFn")},{key:"autonomous",label:"Autonomous run",help:"Off by default. On: an icm run goes from stage 01 to `werkmeister pr open` with no human check (each stage self-checks and the agent approves its own PR file), and .claude/settings.json allows the git, werkmeister, docker, gh, node and python3 calls a headless session needs. The person reviews the PR; `werkmeister pr gate` still applies.",boolean:!0},{key:"model",label:"Model",help:"Model tier (small, mid, frontier, advanced_frontier) or an explicit model (alias or full id); empty = the default tier from `models.default_tier` in ~/.werkmeister/config.yaml (frontier). The resolved model is written to workspace.yml and .claude/settings.json and passed to every session start. mid suits mechanical jobs (lint passes, renames).",pattern:"^[A-Za-z0-9][A-Za-z0-9._/\\[\\]-]*$",placeholder:"frontier"},{key:"auto_stop",label:"Auto-stop on session end",help:"On by default for autonomous workspaces, off otherwise. On: when a Claude session in the workspace ends and no other one is open there, a SessionEnd hook runs `werkmeister internal session-end`, which stops this feature's containers (slot and volumes kept; `werkmeister feature up` resumes). Shared infra is never stopped.",boolean:!0},{key:"services",label:"Services to run locally",help:"Services to run locally with hot-reload; the rest fall through to k8s port-forwards.",multi:!0,choicesFn:i(()=>Object.keys(Nn()[0]).sort(),"choicesFn"),choiceGroupsFn:i(()=>Object.fromEntries(Object.entries(Nn()[0]).map(([e,t])=>[e,String(t?.repo??"other")])),"choiceGroupsFn")},{key:"labels",label:"Labels",help:"Comma-separated free-form tags for filtering workspaces in the dashboard search.",multi:!0},{key:"group",label:"Grouped PR members",help:"Comma-separated issue keys this workspace's PR also covers, led by its issue: one PR, one commit per ticket. Blank for a one-ticket PR.",multi:!0},{key:"test_path",label:"Feature test path",help:"URL path for the feature entry point, appended to the routed host.",pattern:"^/\\S*$",placeholder:"/products/foo"},{key:"task",label:"Task title",help:"Short title for the Current Task section. Defaults to the feature name in words.",defaultFn:i(e=>u$(cs.basename(e)),"defaultFn")},{key:"description",label:"Description",help:"1-2 sentences on what the feature does and the user-visible outcome; rendered under Current Task in CLAUDE.md.",placeholder:"Adds an MDX-powered blog index under /blog."},{key:"starting_prompt",label:"Starting prompt",help:"The first instruction to hand the agent in this workspace; persisted to .werkmeister/workspace.yml.",multiline:!0,refinable:!0,refineInstruction:"Rewrite the user's text as a clear, specific, actionable starting instruction for a coding agent beginning a development task, preserving the user's intent. The rewritten instruction must state the goal \u2014 the desired end state and why it matters \u2014 and must include explicit acceptance criteria: a checklist of concrete, verifiable conditions that define when the task is done. Derive the goal and acceptance criteria from the user's text wherever possible; for any that cannot be confidently derived, the rewritten instruction must direct the agent to ask the user to supply them before proceeding, rather than guessing."}];i(rw,"promptEntry");i(sae,"wizardPrompts");i(oae,"buildPromptSpec");i(u$,"slugToTask");i(Nn,"loadSandboxServiceConfigs");iae={key:"repos",label:"Extra repos",help:"Extra repos to create worktrees for. The final set is the union of these and the repos owning the services selected above.",multi:!0,choicesFn:i(()=>Object.keys(hn()).sort(),"choicesFn")};i(FD,"computePromptSpec");i(f$,"workspacePromptSpec")});var aae,d$,cae,Ea,oh,p$=R(()=>{"use strict";h();aae=["mcp__plugin_werkmeister_werkmeister__"],d$=i(e=>aae.map(t=>`${t}${e}`),"pluginTool"),cae=["werkmeister","w9r"],Ea=i(e=>cae.map(t=>`Bash(${t} ${e})`),"cli"),oh=["Bash(node:*)","Bash(python3:*)",...["proxy-reload","down","remove","remove-workspace","clean","setup","registry","connect","intercept","notes graduate","up infra","restart infra","stop infra","infra proxy-reload","feature down","infra down","feature drop","machine clean","machine setup","infra connect","infra intercept","workspace new","ws new","infra up","infra restart","infra stop","daemon install","daemon uninstall","daemon restart"].flatMap(e=>Ea(`${e}:*`)),...["stop","kill","rm","rmi","compose down","system prune","volume rm","network rm"].map(e=>`Bash(docker ${e}:*)`),...["npm","pnpm"].flatMap(e=>["publish","link","unlink","install -g","install --global","i -g","i --global","uninstall -g","uninstall --global"].map(t=>`Bash(${e} ${t}:*)`)),...["add -g","add --global","remove -g","remove --global"].map(e=>`Bash(pnpm ${e}:*)`),"Bash(gh pr merge:*)",...["kube-switch","up","stop","restart","down","create-workspace","create-workspace-form","pr-approve","ask-pr-review","claude-send","claude-resume","connect","proxy-reload","remove-service","intercept"].flatMap(d$)]});var nw,h$=R(()=>{"use strict";h();ao();nw={id:"mcp",instructionsFile:"AGENTS.md",skillsDir:".agents/skills",hooks:{available:!1,reason:"a generic MCP harness has no hooks adapter; use harness: codex for Codex"},agents:!1,notice:i(()=>`
package/dist/mcp.js CHANGED
@@ -549,7 +549,7 @@ ${t.comment}`].filter(Boolean),i=await uo().askJson(`Do exactly this on the Jira
549
549
  `)+`
550
550
  Then output ONLY <result>{"ok":true}</result>, or <result>{"ok":false,"error":"<why>"}</result> when any step failed. Write no prose outside the tags.`,{tools:!0});if(i?.ok!==!0)throw new Error(sn(i?.error)??`Could not update ${e} through the Atlassian MCP`)}function mue(e){let t=null;return e.split(`
551
551
  `).map(r=>{let i=/^\s*(```|~~~)\s*[\w-]*\s*$/.exec(r);if(i&&(!t||i[1]===t))return t=t?null:i[1],"{code}";if(t)return r;let n=s(c=>c.split(/(`[^`]+`)/).map(l=>l.startsWith("`")&&l.length>1?oHe(l.slice(1,-1)):l.replace(/\*\*(.+?)\*\*/g,"*$1*").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,"[$1|$2]")).join(""),"inline"),o=/^(#{1,6})\s+(.*)$/.exec(r);if(o)return`h${o[1].length}. ${n(o[2])}`;let a=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/.exec(r);if(a){let c=Math.floor(a[1].replace(/\t/g," ").length/2)+1;return`${(/\d/.test(a[2])?"#":"*").repeat(c)} ${n(a[3])}`}return n(r)}).join(`
552
- `)}function OF(e={}){let t=e.project?.toUpperCase();return{id:"jira",label:"Jira",refExample:"PROJ-123",refPattern:null,issueTypes:gue,parseRef:s(r=>eHe.exec(r??"")?.[0].toUpperCase()??null,"parseRef"),slug:s(r=>r.trim().toLowerCase(),"slug"),holds:s(r=>!t||r.toUpperCase().startsWith(`${t}-`),"holds"),url:W1,async fetchIssue(r,i){let n=await oue(r,i);if(n)return fue(n);let o=await rHe(r);return o||i?.push("the Atlassian MCP fallback returned no issue"),o},async fetchIssues(r){if(!r.length)return{};let i=await sue(r)??await nHe(r),n={};for(let[o,a]of Object.entries(i))n[o]={ref:o,status:a,url:W1(o)??void 0};return n},filingGuide(r,i="<workspace>"){let n=/^([A-Z][A-Z0-9]+)-\d+$/.exec(r)?.[1]??t,o=Aie(),a=(rm().base_url??"").trim().replace(/\/+$/,""),c=$l(a)||!a?"":` (${a})`,l=s(h=>`\`werkmeister issue create --project ${h??"<KEY>"} --type <type> --title "<title>" --body-file <file> [--relates <issue>]\`; `+(r?`pass \`--relates ${r}\` for a follow-up from this run; `:"")+"if it fails for want of a Jira API token, the Atlassian MCP tools if connected, otherwise hand the person the title, type and body to file","command"),u=s((h,y)=>`JQL \`${h?`project = ${h} AND `:""}text ~ "${y}"\``,"jql"),p=s(h=>`${u(h,"<keywords>")}, then ${u(h,i)}`,"both"),d=s(h=>`\`gh issue list -R ${sHe} --search "${h}" --state all\``,"gh");return{row:`| app code in a worktree | ${`Jira${n?`, project \`${n}\``:" \u2014 ask the person which project"}${c}`} | ${l(n)} |`,werkmeister:o?{where:`Jira, project \`${o}\`${c}`,command:l(o)}:void 0,search:`Search first: ${p(n)}: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead. (Werkmeister issues: ${o?p(o):`${d("<keywords>")}, then ${d(i)}`}.)`}},async createIssue({project:r,type:i,title:n,body:o}){let a=await uue({project:r,issueType:gue[i],fallbackLabel:i,summary:n,description:mue(o)});if(!a)throw new Error(hue);return{ref:a.key,title:n,type:a.issueType,url:a.url}},async linkIssue(r,i){if(!await pue(r,i))throw new Error(hue)},async listReady(r){if(!r&&!t)throw new Error("no Jira project in scope");let i=r?await lue(r.id,r.ready):await cue(`project = ${t} AND statusCategory != Done ORDER BY priority DESC, rank ASC`);if(!i)throw new Error("listing ready work needs Jira REST credentials (docs/jira-rest-setup.md)");return i.map(fue)},async updateIssue(r,i){let n=i.comment?{...i,comment:mue(i.comment)}:i;await due(r,n)===null&&await iHe(r,i)},async checkAuth(){let r="set jira.base_url, jira.email and jira.api_token (docs/jira-rest-setup.md)";try{let i=await iue();if(i)return{ok:!0,who:i.who,fix:""};let n=rm();return[process.env.JIRA_BASE_URL,process.env.JIRA_EMAIL,process.env.JIRA_API_TOKEN,n.base_url,n.email,n.api_token].some(a=>a&&$l(String(a)))?{ok:!1,reason:"Jira settings still hold the placeholder values",fix:r}:{ok:!0,who:"via Atlassian MCP (not checked)",fix:""}}catch(i){return{ok:!1,reason:i.message,fix:r}}}}}var eHe,sn,tHe,vue,bue,oHe,sHe,hue,gue,wue,RF=P(()=>{"use strict";f();cr();H1();TF();eHe=/[A-Za-z][A-Za-z0-9]+-\d+/;s(W1,"jiraBrowseUrl");s(yue,"jiraSiteRef");s(Z1,"jiraSitePhrase");sn=s(e=>typeof e=="string"&&e.trim()?e.trim():void 0,"str"),tHe=["new","indeterminate","done"],vue=s(e=>tHe.find(t=>t===sn(e)?.toLowerCase()),"category");s(fue,"fromRest");bue="Do not create, edit, transition, or comment on anything; write no prose outside the tags.";s(rHe,"fetchViaMcp");s(nHe,"statusesViaMcp");s(iHe,"updateViaMcp");oHe=s(e=>`{{${e.replace(/([-{}!*_+^~[\]|#])/g,"\\$1")}}}`,"monoEscape");s(mue,"markdownToWiki");sHe="jbbz-sandbox/werkmeister",hue="no Jira REST credentials: set jira.base_url, jira.email and jira.api_token (docs/jira-rest-setup.md), or file it with the Atlassian MCP tools",gue={bug:"Bug",feature:"Story",task:"Task"};s(OF,"jiraTracker");wue=OF()});function Ib(e){return Sue[e]}function IF(e){let t=(e??ar()).overrides?.issue_tracker;return Qf.includes(t)?t:"jira"}function AF(e){return aHe[e.tracker](e.scope)}function Pm(e={}){let t=_a();if(!t.length)return null;let r=e.project?.trim();if(r){let i=t.find(n=>n.name===r);return i||(xue.has(r)||(xue.add(r),N(`project "${r}" is not in projects: of the config \u2014 using the machine's tracker`)),null)}if(!e.text)return null;for(let i of t){let n=AF(i),o=n.parseRef(e.text);if(o&&n.holds(o))return i}return null}function q6(){let e=_a().filter(t=>t.default);return e.length===1?e[0]:null}function dt(e){let t=e?Pm(e):null;return t?AF(t):Sue[IF()]}function V1(e,t=""){let r=_a();if(!r.length){if(t)throw new Error(`--project ${t}: this machine has no projects: in its config`);return null}let i=r.map(c=>c.name).join(", "),n=t?r.find(c=>c.name===t):void 0;if(t&&!n)throw new Error(`no project "${t}" (projects: ${i})`);if(!e)return n??null;let o=n??Pm({text:e})??q6();if(!o)throw new Error(`${e} isn't in any project's scope; pass --project (one of: ${i})`);let a=AF(o);if(!a.parseRef(e))throw new Error(`${e} isn't a ${a.label} issue in project ${o.name} (e.g. ${a.refExample})`);return o}function qb(e){return tp(e?.project)}function Xu(e){return tp(e?.issue_id)||tp(e?.jira_id)||tp(e?.github_issue)}function Bb(e){let t=Xu(e);if(!t)return[];let r=e?.group,i=Array.isArray(r)?r:String(r??"").split(",");return[...new Set([t,...i.map(n=>String(n).trim()).filter(Boolean)])]}function Tl(e){return tp(e.ISSUE_ID)||tp(e.JIRA_ID)||tp(e.GITHUB_ISSUE)}function $ue(e){let t=Tl(e);return t?[t,dt().url(t)]:null}function K1(e,t={}){let r=[`${e.ref}: ${e.title??"(no title)"}`],i=[e.status&&`Status: ${e.status}`,e.type&&`Type: ${e.type}`,e.assignee&&`Assignee: ${e.assignee}`].filter(Boolean);if(i.length&&r.push(i.join(" \xB7 ")),e.description){let o=e.description,a=t.full?0:Math.max(0,o.length-kue);r.push("","Description:",a?o.slice(0,kue):o),a&&r.push(`[cut: ${a} more characters not shown]`)}let n=e.comments??[];if(n.length){r.push("",`Comments (last ${Math.min(n.length,_ue)} of ${n.length}):`);for(let o of n.slice(-_ue)){let a=o.created?` ${o.created.slice(0,10)}`:"";r.push(`- [${o.author}${a}] ${o.body.slice(0,cHe)}`)}}return r.join(`
552
+ `)}function OF(e={}){let t=e.project?.toUpperCase();return{id:"jira",label:"Jira",refExample:"PROJ-123",refPattern:null,issueTypes:gue,parseRef:s(r=>eHe.exec(r??"")?.[0].toUpperCase()??null,"parseRef"),slug:s(r=>r.trim().toLowerCase(),"slug"),holds:s(r=>!t||r.toUpperCase().startsWith(`${t}-`),"holds"),url:W1,async fetchIssue(r,i){let n=await oue(r,i);if(n)return fue(n);let o=await rHe(r);return o||i?.push("the Atlassian MCP fallback returned no issue"),o},async fetchIssues(r){if(!r.length)return{};let i=await sue(r)??await nHe(r),n={};for(let[o,a]of Object.entries(i))n[o]={ref:o,status:a,url:W1(o)??void 0};return n},filingGuide(r,i="<workspace>"){let n=/^([A-Z][A-Z0-9]+)-\d+$/.exec(r)?.[1]??t,o=Aie(),a=(rm().base_url??"").trim().replace(/\/+$/,""),c=$l(a)||!a?"":` (${a})`,l=s(h=>`\`werkmeister issue create --project ${h??"<KEY>"} --type <type> --title "<title>" --body-file <file> [--relates <issue>]\`; `+(r?`pass \`--relates ${r}\` for a follow-up from this run; `:"")+"if it fails for want of a Jira API token, the Atlassian MCP tools if connected, otherwise hand the person the title, type and body to file","command"),u=s((h,y)=>`JQL \`${h?`project = ${h} AND `:""}text ~ "${y}"\``,"jql"),p=s(h=>`${u(h,"<keywords>")}, then ${u(h,i)}`,"both"),d=s(h=>`\`gh issue list -R ${sHe} --search "${h}" --state all\``,"gh");return{row:`| app code in a worktree | ${`Jira${n?`, project \`${n}\``:" \u2014 ask the person which project"}${c}`} | ${l(n)} |`,werkmeister:o?{where:`Jira, project \`${o}\`${c}`,command:l(o)}:void 0,search:`Search first: ${p(n)}: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead. (Werkmeister issues: ${o?p(o):`${d("<keywords>")}, then ${d(i)}`}.)`}},async createIssue({project:r,type:i,title:n,body:o}){let a=await uue({project:r,issueType:gue[i],fallbackLabel:i,summary:n,description:mue(o)});if(!a)throw new Error(hue);return{ref:a.key,title:n,type:a.issueType,url:a.url}},async linkIssue(r,i){if(!await pue(r,i))throw new Error(hue)},async listReady(r){if(!r&&!t)throw new Error("no Jira project in scope");let i=r?await lue(r.id,r.ready):await cue(`project = ${t} AND statusCategory != Done ORDER BY priority DESC, rank ASC`);if(!i)throw new Error("listing ready work needs Jira REST credentials (docs/issue-trackers.md)");return i.map(fue)},async updateIssue(r,i){let n=i.comment?{...i,comment:mue(i.comment)}:i;await due(r,n)===null&&await iHe(r,i)},async checkAuth(){let r="set jira.base_url, jira.email and jira.api_token (docs/issue-trackers.md)";try{let i=await iue();if(i)return{ok:!0,who:i.who,fix:""};let n=rm();return[process.env.JIRA_BASE_URL,process.env.JIRA_EMAIL,process.env.JIRA_API_TOKEN,n.base_url,n.email,n.api_token].some(a=>a&&$l(String(a)))?{ok:!1,reason:"Jira settings still hold the placeholder values",fix:r}:{ok:!0,who:"via Atlassian MCP (not checked)",fix:""}}catch(i){return{ok:!1,reason:i.message,fix:r}}}}}var eHe,sn,tHe,vue,bue,oHe,sHe,hue,gue,wue,RF=P(()=>{"use strict";f();cr();H1();TF();eHe=/[A-Za-z][A-Za-z0-9]+-\d+/;s(W1,"jiraBrowseUrl");s(yue,"jiraSiteRef");s(Z1,"jiraSitePhrase");sn=s(e=>typeof e=="string"&&e.trim()?e.trim():void 0,"str"),tHe=["new","indeterminate","done"],vue=s(e=>tHe.find(t=>t===sn(e)?.toLowerCase()),"category");s(fue,"fromRest");bue="Do not create, edit, transition, or comment on anything; write no prose outside the tags.";s(rHe,"fetchViaMcp");s(nHe,"statusesViaMcp");s(iHe,"updateViaMcp");oHe=s(e=>`{{${e.replace(/([-{}!*_+^~[\]|#])/g,"\\$1")}}}`,"monoEscape");s(mue,"markdownToWiki");sHe="jbbz-sandbox/werkmeister",hue="no Jira REST credentials: set jira.base_url, jira.email and jira.api_token (docs/issue-trackers.md), or file it with the Atlassian MCP tools",gue={bug:"Bug",feature:"Story",task:"Task"};s(OF,"jiraTracker");wue=OF()});function Ib(e){return Sue[e]}function IF(e){let t=(e??ar()).overrides?.issue_tracker;return Qf.includes(t)?t:"jira"}function AF(e){return aHe[e.tracker](e.scope)}function Pm(e={}){let t=_a();if(!t.length)return null;let r=e.project?.trim();if(r){let i=t.find(n=>n.name===r);return i||(xue.has(r)||(xue.add(r),N(`project "${r}" is not in projects: of the config \u2014 using the machine's tracker`)),null)}if(!e.text)return null;for(let i of t){let n=AF(i),o=n.parseRef(e.text);if(o&&n.holds(o))return i}return null}function q6(){let e=_a().filter(t=>t.default);return e.length===1?e[0]:null}function dt(e){let t=e?Pm(e):null;return t?AF(t):Sue[IF()]}function V1(e,t=""){let r=_a();if(!r.length){if(t)throw new Error(`--project ${t}: this machine has no projects: in its config`);return null}let i=r.map(c=>c.name).join(", "),n=t?r.find(c=>c.name===t):void 0;if(t&&!n)throw new Error(`no project "${t}" (projects: ${i})`);if(!e)return n??null;let o=n??Pm({text:e})??q6();if(!o)throw new Error(`${e} isn't in any project's scope; pass --project (one of: ${i})`);let a=AF(o);if(!a.parseRef(e))throw new Error(`${e} isn't a ${a.label} issue in project ${o.name} (e.g. ${a.refExample})`);return o}function qb(e){return tp(e?.project)}function Xu(e){return tp(e?.issue_id)||tp(e?.jira_id)||tp(e?.github_issue)}function Bb(e){let t=Xu(e);if(!t)return[];let r=e?.group,i=Array.isArray(r)?r:String(r??"").split(",");return[...new Set([t,...i.map(n=>String(n).trim()).filter(Boolean)])]}function Tl(e){return tp(e.ISSUE_ID)||tp(e.JIRA_ID)||tp(e.GITHUB_ISSUE)}function $ue(e){let t=Tl(e);return t?[t,dt().url(t)]:null}function K1(e,t={}){let r=[`${e.ref}: ${e.title??"(no title)"}`],i=[e.status&&`Status: ${e.status}`,e.type&&`Type: ${e.type}`,e.assignee&&`Assignee: ${e.assignee}`].filter(Boolean);if(i.length&&r.push(i.join(" \xB7 ")),e.description){let o=e.description,a=t.full?0:Math.max(0,o.length-kue);r.push("","Description:",a?o.slice(0,kue):o),a&&r.push(`[cut: ${a} more characters not shown]`)}let n=e.comments??[];if(n.length){r.push("",`Comments (last ${Math.min(n.length,_ue)} of ${n.length}):`);for(let o of n.slice(-_ue)){let a=o.created?` ${o.created.slice(0,10)}`:"";r.push(`- [${o.author}${a}] ${o.body.slice(0,cHe)}`)}}return r.join(`
553
553
  `)}var Sue,aHe,xue,tp,kue,_ue,cHe,lo=P(()=>{"use strict";f();cr();$6();RF();zE();Zv();ze();$6();RF();zE();Sue={jira:wue,github:sce};s(Ib,"trackerById");s(IF,"loadIssueTracker");aHe={jira:OF,github:S6};s(AF,"projectTracker");xue=new Set;s(Pm,"projectFor");s(q6,"defaultProject");s(dt,"issueTracker");s(V1,"projectForIssue");tp=s(e=>typeof e=="string"?e.trim():"","str");s(qb,"projectOf");s(Xu,"issueIdOf");s(Bb,"issueRefsOf");s(Tl,"issueIdOfMeta");s($ue,"issueLink");kue=4e3,_ue=10,cHe=1e3;s(K1,"issueBriefing")});var Cde={};Ni(Cde,{BREW_FORMULA:()=>z8,DAEMON_HOST_ADDRESS:()=>$de,DOWNLOAD_HINT:()=>F8,FEATURE_HEADER:()=>H8,INSTALL_HINT:()=>aw,MIN_VERSION:()=>cw,_run:()=>U8,buildConnectArgs:()=>Sde,buildInterceptArgs:()=>Ede,buildLeaveArgs:()=>CT,buildListInterceptsArgs:()=>W8,buildQuitArgs:()=>Ode,buildUninstallArgs:()=>Tde,connectedNamespace:()=>VZe,dockerDaemonName:()=>LT,ensureConnected:()=>Ide,interceptBlocker:()=>DT,isRemoteService:()=>Z8,leaveFeatureIntercepts:()=>JZe,leaveIntercept:()=>G8,listIntercepts:()=>MT,parseInterceptList:()=>V8,parseVersion:()=>q8,portOpen:()=>kde,releaseIdleTelepresence:()=>M8,runAsyncRunner:()=>Ka,startIntercept:()=>K8,versionError:()=>_de,versionLt:()=>B8});import*as Va from"node:fs";import*as wde from"node:net";import*as lw from"node:path";function xde(e){for(let t of(process.env.PATH??"").split(lw.delimiter)){if(!t)continue;let r=lw.join(t,e);try{if(Va.accessSync(r,Va.constants.X_OK),Va.statSync(r).isFile())return r}catch{}}return null}function U8(e,t=120){let r;try{r=ie(e,{capture:!0,timeout:t})}catch(i){if(i instanceof ke&&i.code==="ENOENT")return[127,`${e[0]}: command not found`];if(i instanceof ke&&i.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${t}s`];throw i}return[r.status,((r.stdout||"")+(r.stderr||"")).trim()]}async function Ka(e,t,r=120){let i;try{i=await Lo(e,{capture:!0,timeout:r,signal:t})}catch(n){if(n instanceof ke&&n.code==="ENOENT")return[127,`${e[0]}: command not found`];if(n instanceof ke&&n.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${r}s`];throw n}return[i.status,((i.stdout||"")+(i.stderr||"")).trim()]}function kde(e,t=1e3){return new Promise(r=>{let i=new wde.Socket,n=!1,o=s(a=>{n||(n=!0,i.destroy(),r(a))},"finish");i.setTimeout(t),i.once("connect",()=>o(!0)),i.once("timeout",()=>o(!1)),i.once("error",()=>o(!1)),i.connect(e,"localhost")})}function q8(e){let t=/v(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}function B8(e,t){for(let r=0;r<3;r++)if(e[r]!==t[r])return e[r]<t[r];return!1}async function _de(e=t=>Ka(t)){if(xde("telepresence")===null)return`telepresence not found on PATH. ${aw}`;let[t,r]=await e(["telepresence","version"]),i=q8(r);if(t!==0||i===null)return`could not determine telepresence version (${r?r.split(`
554
554
  `)[0]:"no output"}). ${aw}`;if(B8(i,cw)){let n=i.join("."),o=cw.join(".");return`telepresence ${n} is too old (need >= ${o}). ${aw}`}return null}function Sde(e,t,r=!1){let i=["telepresence","connect"];return r&&i.push("--docker"),i.push("--context",e,"--namespace",t),i}function LT(e,t){return`${e}-${t}-cn`}function Ede(e,t,r,i,n=!1){return["telepresence","intercept",e,"--port",`${t}:${r}`,"--http-header",`x-feature=${i}`,"--mount","false",...n?["--address",$de]:[]]}function CT(e){return["telepresence","detach",e]}function Tde(e){return["telepresence","uninstall",...e]}function Ode(){return["telepresence","quit","-s"]}function W8(){return["telepresence","list","-i","--format","json"]}function DT(e){if(typeof e!="object"||e===null||Array.isArray(e))return"is not defined in ~/.werkmeister/services.yaml.";let t=e,r=Rde(t);return r.length?`has no ${r.join("/")} in services.yaml \u2014 not interceptable.`:t.k8s_port_name?null:"has no k8s_port_name in services.yaml. Interception under Istio ambient requires a NAMED Service targetPort; add the port name there once the service's manifests are fixed."}function Rde(e){return WZe.filter(t=>!e[t])}function Z8(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Rde(e).length===0}function V8(e){let t=new Map,r=String(e||"").trim();if(!r)return t;let i;try{i=JSON.parse(r)}catch{return t}if(!Array.isArray(i))return t;for(let n of i){if(typeof n!="object"||n===null)continue;let o=n,a=o.name,c=o.intercept_info;typeof a!="string"||!a||!Array.isArray(c)||!c.length||t.set(a,ZZe(c[0]))}return t}function ZZe(e){if(typeof e!="object"||e===null)return null;let t=e.spec?.header_filters;if(typeof t!="object"||t===null)return null;for(let[r,i]of Object.entries(t))if(r.toLowerCase()===H8&&typeof i=="string")return i;return null}async function MT(e=t=>Ka(t)){let t=new Map;if(Ir())return{installed:!1,available:!1,namespace:null,intercepts:t};let[r,i]=await e(jT);if(r===127)return{installed:!1,available:!1,namespace:null,intercepts:t};let n=NT(r,i),o=[];for(let l of n===null?KZe(i):[])if(n=NT(...await e([...jT,"--use",l])),n!==null){o=["--use",l];break}if(n===null)return{installed:!0,available:!1,namespace:n,intercepts:t};let[a,c]=await e([...W8(),...o]);return a!==0?{installed:!0,available:!1,namespace:n,intercepts:t}:{installed:!0,available:!0,namespace:n,intercepts:V8(c)}}function VZe(e=U8){return NT(...e(jT))}function KZe(e){let t=/please select (.+?) using the --use/.exec(e);return t?t[1].split(/, | or /):[]}function NT(e,t){if(e!==0)return null;let r;try{r=JSON.parse(t)}catch{return null}let i=r.daemon||r.user_daemon||{};return(i.status==="Connected"||i.running)&&i.namespace||null}async function Ide(e,t,r=!1,i=n=>Ka(n)){if(Ir())return;let n=r?["--use",LT(e,t)]:[];if(NT(...await i([...jT,...n]))===t)return;await i(["telepresence","quit","-s"]);let[a,c]=await i(Sde(e,t,r));if(a!==0)throw new Error(`telepresence connect failed: ${c||"no output"}`)}function GZe(e){let t;try{if(!Va.statSync(e).isFile())return[];t=Va.readFileSync(e,"utf8")}catch{return[]}for(let r of t.split(`
555
555
  `))if(r=r.trim(),r.startsWith("SERVICES="))return r.slice(r.indexOf("=")+1).split(",").map(n=>n.trim()).filter(Boolean);return[]}function JZe(e,t=U8){if(xde("telepresence")===null)return[];let r=ii(e);if(r===null)return[];let i=GZe(lw.join(r,".env"));if(!i.length)return[];let n=Re(),o=[];for(let a of i){let c=Ade(n[a]);if(!c)continue;let[l]=t(CT(c));l===0&&o.push(c)}return o}async function M8(e,t=r=>Ka(r)){let r={uninstalled:[],quit:!1};if(!e.length)return r;let[i,n]=await t(W8()),o=[];try{o=n.trim()?JSON.parse(n):[]}catch{o=null}if(i!==0||!Array.isArray(o))return N("Could not read telepresence intercepts -- leaving traffic agents and daemons in place"),r;let a=V8(n),c=e.filter(l=>!a.has(l));if(c.length){let[l,u]=await t(Tde(c));l===0?(r.uninstalled=c,A(`Uninstalled traffic agent(s): ${c.join(", ")}`)):N(`Could not uninstall traffic agent(s) ${c.join(", ")}: ${u||"no output"}`)}if(a.size===0){let[l,u]=await t(Ode());l===0?(r.quit=!0,A("Stopped telepresence daemons")):N(`Could not stop telepresence daemons: ${u||"no output"}`)}return r}function Ade(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e.k8s_deployment:void 0}function Pde(e,t){if(!t.includes(e))throw new te(`'${e}' is not a local service of this workspace (SERVICES=${t.join(",")||"(none)"}). Add it to workspace.yml services and rerun \`werkmeister workspace init\`.`,"NOT_LOCAL");let r=Re()[e],i=DT(r);if(i)throw new te(`'${e}' ${i}`,"NOT_INTERCEPTABLE");return r}async function K8(e){if(Ir())throw new te("Intercepts are off under WERKMEISTER_FIXTURE.","FIXTURE");let t=Pde(e.service,e.localServices),r=s(d=>Ka(d,e.signal),"runner"),i=await _de(r);if(i)throw new te(i,"TELEPRESENCE_VERSION");let n=await Es(e.feature);if(n===null)throw new te(`Feature '${e.feature}' has no allocated slot \u2014 run \`werkmeister feature up ${e.feature}\` first.`,"NOT_RUNNING");let o=oo(n,t.port_offset??0);if(!await kde(o))throw new te(`${e.service} is not listening on localhost:${o} \u2014 run \`werkmeister feature up ${e.feature}\` first (the local container is the intercept target).`,"PORT_CLOSED");let a=cM(),c=t.k8s_namespace,l=t.k8s_deployment;A(`Connecting to ${c} on ${a}...`),await Ide(a,c,!!e.dockerDaemon,r),A(`Intercepting ${l} \u2192 localhost:${o} (x-feature=${e.feature})...`);let[u,p]=await r([...Ede(l,o,t.k8s_port,e.feature,!!e.dockerDaemon),...e.dockerDaemon?["--use",LT(a,c)]:[]]);if(u!==0)throw new te(`telepresence intercept failed: ${p||"no output"}`,"INTERCEPT_FAILED");return{service:e.service,context:a,namespace:c,deployment:l,localPort:o,header:H8,remoteHost:Mn()[e.service]?.remoteHostname??null}}async function G8(e){let t=s(o=>a=>Ka(e.dockerDaemon?[...a,"--use",LT(cM(),o)]:a,e.signal),"runnerIn");if(e.service){let o=Pde(e.service,e.localServices),a=o.k8s_deployment,c=t(o.k8s_namespace),[l,u]=await c(CT(a));if(l!==0)throw new te(`Could not leave intercept: ${u||"no output"}`,"INTERCEPT_FAILED");return await M8([a],c),[a]}let r=Re(),i=[],n=t("default");for(let o of e.localServices){let a=Ade(r[o]);if(!a)continue;n=t(r[o].k8s_namespace??"default");let[c]=await n(CT(a));c===0&&i.push(a)}return await M8(i,n),i}var cw,z8,F8,aw,$de,H8,WZe,jT,uw=P(()=>{"use strict";f();wi();ye();Nt();La();sr();ze();ni();cw=[2,30,0],z8="telepresenceio/telepresence/telepresence-oss",F8="curl -fL https://github.com/telepresenceio/telepresence/releases/latest/download/telepresence-darwin-arm64 -o /opt/homebrew/bin/telepresence && chmod +x /opt/homebrew/bin/telepresence",aw=`Install Telepresence OSS >= ${cw.join(".")} with \`brew install ${z8}\`, or by direct release download: ${F8}`;s(xde,"which");s(U8,"_run");s(Ka,"runAsyncRunner");s(kde,"portOpen");s(q8,"parseVersion");s(B8,"versionLt");s(_de,"versionError");s(Sde,"buildConnectArgs");$de="host.docker.internal";s(LT,"dockerDaemonName");s(Ede,"buildInterceptArgs");s(CT,"buildLeaveArgs");s(Tde,"buildUninstallArgs");s(Ode,"buildQuitArgs");H8="x-feature";s(W8,"buildListInterceptsArgs");s(DT,"interceptBlocker");WZe=["k8s_deployment","k8s_namespace","k8s_port"];s(Rde,"missingClusterKeys");s(Z8,"isRemoteService");s(V8,"parseInterceptList");s(ZZe,"featureOf");s(MT,"listIntercepts");s(VZe,"connectedNamespace");jT=["telepresence","status","--format","json"];s(KZe,"daemonChoices");s(NT,"parseConnectedNamespace");s(Ide,"ensureConnected");s(GZe,"servicesFromEnv");s(JZe,"leaveFeatureIntercepts");s(M8,"releaseIdleTelepresence");s(Ade,"deploymentOf");s(Pde,"resolveServiceDef");s(K8,"startIntercept");s(G8,"leaveIntercept")});var Gfe={};Ni(Gfe,{launchSafariWindow:()=>p7e,parseRect:()=>Kfe});import{spawn as l7e}from"node:child_process";import*as Zfe from"node:fs";import*as Vfe from"node:net";function Kfe(e,t){let[r,i]=e.split(",").map(Number),[n,o]=(t??"60,60").split(",").map(Number);return{width:r,height:i,x:n,y:o}}async function Ai(e,t,r,i){let n=await fetch(`http://127.0.0.1:${e}${t}`,{method:r,headers:i!==void 0?{"Content-Type":"application/json"}:void 0,body:i!==void 0?JSON.stringify(i):void 0}),o=await n.json().catch(()=>({}));if(!n.ok||o?.value?.error){let a=o?.value?.message||o?.value?.error||`HTTP ${n.status}`;throw new Error(`safaridriver ${r} ${t} failed: ${a}`)}return o.value}async function u7e(e,t=1e4){let r=Date.now()+t;for(;Date.now()<r;){if(await new Promise(n=>{let o=Vfe.createConnection({port:e,host:"127.0.0.1"});o.once("connect",()=>{o.destroy(),n(!0)}),o.once("error",()=>n(!1))}))return;await Gm(200)}throw new Error(`safaridriver never came up on :${e}`)}async function p7e(e,t,r={}){if(!Zfe.existsSync(wU))return be(`safaridriver not found at ${wU} -- this needs macOS with Safari installed.`),null;let i=Kfe(r.size??"1440,900",r.position??null),n=xU(e),o=await _U(),a=kU(e,n),c=l7e(wU,[`--port=${o}`],{stdio:"ignore",detached:!0});c.unref();let l=!1;c.on("exit",()=>{l=!0});let u=null;async function p(){if(u)try{await Ai(o,`/session/${u}`,"DELETE")}catch{}try{c.kill()}catch{}}s(p,"cleanup");let d=new Map;async function m(y){await Ai(o,`/session/${u}/window`,"POST",{handle:y});let g=await Ai(o,`/session/${u}/url`,"GET");await Ai(o,`/session/${u}/execute/sync`,"POST",{script:a,args:[]}),d.set(y,g)}s(m,"tagHandle");try{await u7e(o);try{u=(await Ai(o,"/session","POST",{capabilities:{alwaysMatch:{browserName:"safari"}}})).sessionId}catch(v){return be(`Could not start a Safari WebDriver session: ${v instanceof Error?v.message:v}`),be('One-time setup: run `safaridriver --enable` (needs sudo), then in Safari enable Settings > Advanced > "Show features for web developers", and Develop > "Allow Remote Automation".'),await p(),null}we(`
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "werkmeister",
3
- "version": "0.85.0",
3
+ "version": "0.85.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Multi-feature concurrent development orchestrator CLI tool",
6
6
  "type": "module",
@@ -118,8 +118,8 @@
118
118
  "typescript": "^5.7.0",
119
119
  "vitest": "^3.0.0",
120
120
  "yaml": "^2.7.0",
121
- "werkmeister-core": "0.85.0",
122
- "werkmeister-mcp": "0.9.7"
121
+ "werkmeister-core": "0.85.1",
122
+ "werkmeister-mcp": "0.9.8"
123
123
  },
124
124
  "scripts": {
125
125
  "build": "node esbuild.mjs",