@ironbee-ai/cli 0.30.0 → 0.31.0
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/CHANGELOG.md +6 -0
- package/dist/analytics/claude/emit.js +1 -1
- package/dist/analytics/claude/state.js +1 -1
- package/dist/analytics/codex/events-emit.js +2 -2
- package/dist/analytics/codex/subagent-transcripts.js +3 -3
- package/dist/clients/claude/hooks/activity-end.js +1 -1
- package/dist/clients/claude/hooks/activity-start.js +1 -1
- package/dist/clients/claude/hooks/clear-verdict.js +1 -1
- package/dist/clients/claude/hooks/require-verdict.js +2 -2
- package/dist/clients/claude/hooks/require-verification.js +3 -3
- package/dist/clients/claude/hooks/session-end.js +1 -1
- package/dist/clients/claude/hooks/session-start.js +4 -4
- package/dist/clients/claude/hooks/session-status.js +2 -2
- package/dist/clients/claude/hooks/subagent-start.js +1 -1
- package/dist/clients/claude/hooks/subagent-stop.js +1 -1
- package/dist/clients/claude/hooks/track-action-monitor.js +1 -1
- package/dist/clients/claude/hooks/track-action.js +1 -1
- package/dist/clients/claude/hooks/verify-gate.js +4 -4
- package/dist/clients/claude/platforms/scenario.android.md +1 -0
- package/dist/clients/claude/platforms/skill.android.md +4 -0
- package/dist/clients/claude/process-analytics.js +1 -1
- package/dist/clients/claude/statusline-toggle.js +2 -2
- package/dist/clients/codex/hooks/activity-end.js +1 -1
- package/dist/clients/codex/hooks/activity-start.js +1 -1
- package/dist/clients/codex/hooks/clear-verdict.js +3 -3
- package/dist/clients/codex/hooks/require-verdict.js +2 -2
- package/dist/clients/codex/hooks/require-verification.js +3 -3
- package/dist/clients/codex/hooks/session-start.js +3 -3
- package/dist/clients/codex/hooks/subagent-start.js +1 -1
- package/dist/clients/codex/hooks/subagent-stop.js +1 -1
- package/dist/clients/codex/hooks/track-action-monitor.js +1 -1
- package/dist/clients/codex/hooks/track-action-pre.js +1 -1
- package/dist/clients/codex/hooks/track-action.js +1 -1
- package/dist/clients/codex/hooks/verify-gate.js +1 -1
- package/dist/clients/codex/index.js +2 -2
- package/dist/clients/codex/platforms/command-verify.android.md +1 -0
- package/dist/clients/codex/platforms/rule.android.md +2 -1
- package/dist/clients/codex/platforms/scenario.android.md +1 -0
- package/dist/clients/codex/platforms/skill.android.md +4 -0
- package/dist/clients/codex/process-analytics.js +2 -2
- package/dist/clients/codex/thread-map.js +1 -1
- package/dist/clients/codex/util.js +44 -31
- package/dist/clients/cursor/hooks/activity-end.js +1 -1
- package/dist/clients/cursor/hooks/activity-start.js +1 -1
- package/dist/clients/cursor/hooks/clear-verdict.js +1 -1
- package/dist/clients/cursor/hooks/require-verdict.js +2 -2
- package/dist/clients/cursor/hooks/require-verification.js +3 -3
- package/dist/clients/cursor/hooks/session-end.js +1 -1
- package/dist/clients/cursor/hooks/session-start.js +4 -4
- package/dist/clients/cursor/hooks/track-action-monitor.js +1 -1
- package/dist/clients/cursor/hooks/track-action.js +1 -1
- package/dist/clients/cursor/hooks/verify-gate.js +1 -1
- package/dist/clients/cursor/platforms/command-verify.android.md +1 -0
- package/dist/clients/cursor/platforms/rule.android.md +2 -1
- package/dist/clients/cursor/platforms/scenario.android.md +1 -0
- package/dist/clients/cursor/platforms/skill.android.md +4 -0
- package/dist/commands/config.js +1 -1
- package/dist/commands/hook.js +10 -10
- package/dist/commands/import.js +3 -3
- package/dist/commands/process-job-file.js +1 -1
- package/dist/commands/queue.js +16 -16
- package/dist/commands/status.js +1 -1
- package/dist/commands/uninstall.js +1 -1
- package/dist/commands/verify.js +2 -2
- package/dist/hooks/core/actions.js +7 -7
- package/dist/hooks/core/session-state.js +1 -1
- package/dist/hooks/core/verification-context.js +8 -8
- package/dist/import/marker.js +2 -2
- package/dist/import/skip.js +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/install-version.js +1 -1
- package/dist/lib/runtime-paths.js +1 -0
- package/dist/otel/claude/daemon/process.js +1 -1
- package/dist/otel/claude/daemon/reprocess.js +1 -1
- package/dist/otel/claude/daemon/response-usage.js +2 -2
- package/dist/queue/drain.js +1 -1
- package/dist/queue/flush.js +1 -1
- package/dist/queue/paths.js +1 -1
- package/dist/queue/process-file.js +2 -2
- package/dist/queue/spawn.js +1 -1
- package/dist/tui/config/schema.js +1 -1
- package/dist/tui/queue/read.js +4 -4
- package/dist/tui/sessions/read.js +2 -2
- package/package.json +1 -1
|
@@ -1,54 +1,67 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var $=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var o=(n,t)=>$(n,"name",{value:t,configurable:!0});var J=(n,t)=>{for(var e in t)$(n,e,{get:t[e],enumerable:!0})},P=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of W(t))!M.call(n,r)&&r!==e&&$(n,r,{get:()=>t[r],enumerable:!(s=L(t,r))||s.enumerable});return n};var B=n=>P($({},"__esModule",{value:!0}),n);var hn={};J(hn,{AGENTS_MD_END_MARKER:()=>y,AGENTS_MD_START_MARKER:()=>v,canonicalizeCodexServerName:()=>C,canonicalizeCodexToolName:()=>R,classifyCodexTool:()=>D,codexAgentTomlPath:()=>ln,codexConfigTomlPath:()=>O,codexHooksJsonPath:()=>pn,decodeJwtPayload:()=>E,ensureFeaturesHooksTrue:()=>Z,ensureMultiAgentV2SpawnMetadataExposed:()=>Y,ensureSandboxWritableRoot:()=>sn,extractBashBinary:()=>A,extractCodexMcpServer:()=>S,extractCodexToolInput:()=>K,extractTomlTopLevelModel:()=>un,findTomlSection:()=>p,normalizeCodexToolName:()=>j,parseCodexHookStdin:()=>z,readCodexConfigToml:()=>gn,removeAgentsTable:()=>rn,removeFeaturesHooks:()=>q,removeMcpServer:()=>tn,removeMultiAgentV2SpawnMetadata:()=>N,removeSandboxWritableRoot:()=>on,resolveCodexUsage:()=>X,stripAgentsMdBlock:()=>cn,tomlBodyFromRecord:()=>an,upsertAgentsMdBlock:()=>dn,upsertAgentsTable:()=>en,upsertMcpServer:()=>nn,userCodexAgentTomlPath:()=>_n,userCodexConfigTomlPath:()=>mn,userCodexHooksJsonPath:()=>xn,writeCodexConfigToml:()=>fn});module.exports=B(hn);var x=require("fs"),I=require("os"),m=require("path"),b=require("../../lib/logger");function z(n){try{return JSON.parse(n)}catch(t){return b.logger.debug(`failed to parse Codex hook stdin: ${t}`),{}}}o(z,"parseCodexHookStdin");const h="mcp__",H={browser_devtools:"browser-devtools",node_devtools:"node-devtools",backend_devtools:"backend-devtools",android_devtools:"android-devtools"},F=["bdt_","ndt_","bedt_","adt_"];function C(n){return H[n]??n}o(C,"canonicalizeCodexServerName");function R(n){if(!F.some(e=>n.startsWith(e)))return n;const t=n.split("_");return t.length>=3&&t[1]==="scenario"?`${t[0]}_scenario-${t.slice(2).join("-")}`:t.length<=3?n:`${t[0]}_${t[1]}_${t.slice(2).join("-")}`}o(R,"canonicalizeCodexToolName");const V=[["bdt_","browser-devtools"],["ndt_","node-devtools"],["bedt_","backend-devtools"],["adt_","android-devtools"]];function S(n){if(!n)return null;if(n.startsWith(h)){const t=n.slice(h.length),e=t.indexOf("__");return e<0?null:C(t.slice(0,e))}for(const[t,e]of V)if(n.startsWith(t))return e;return null}o(S,"extractCodexMcpServer");function j(n){return n==="exec_command"?"Bash":n==="apply_patch"?"Edit":n==="update_plan"?"TodoWrite":n==="read_file"?"Read":n==="web_search"?"WebSearch":n==="web_fetch"?"WebFetch":n}o(j,"normalizeCodexToolName");function D(n){if(!n)return{tool_type:null,tool_name:"",mcp_server:null};if(n.startsWith(h)){const s=n.slice(h.length),r=s.indexOf("__");if(r>=0){const i=s.slice(0,r),u=C(i),l=s.slice(r+2);return{tool_type:"mcp",tool_name:R(l),mcp_server:u}}}const t=S(n);if(t!==null&&!n.startsWith(h))return{tool_type:"mcp",tool_name:R(n),mcp_server:t};const e=j(n);return n==="spawn_agent"||n==="wait_agent"||n==="close_agent"?{tool_type:"sub_agent",tool_name:e,mcp_server:null}:{tool_type:null,tool_name:e,mcp_server:null}}o(D,"classifyCodexTool");function K(n,t){if(!n||t===void 0)return;if(n==="apply_patch"){if(typeof t=="string")return{input_size:t.length};if(typeof t=="object"&&t!==null){const r=t,i=r.command??r.input;if(typeof i=="string")return{input_size:i.length}}return{input_size:void 0}}if(typeof t!="object"||t===null)return;const e=t;if(j(n)==="Bash"){const r=e.cmd??e.command,i=typeof r=="string"?A(r):void 0;return{workdir:e.workdir,binary:i}}if(n==="update_plan"){const r=e.explanation,i=e.plan;return{explanation:typeof r=="string"?r:void 0,plan_step_count:Array.isArray(i)?i.length:void 0}}if(n==="spawn_agent"){const r=e.agent_type,i=e.message,u=e.fork_context;return{agent_type:typeof r=="string"?r:void 0,message_size:typeof i=="string"?i.length:void 0,fork_context:typeof u=="boolean"?u:void 0}}if(n==="wait_agent"){const r=e.targets,i=e.timeout_ms;return{target_count:Array.isArray(r)?r.length:void 0,timeout_ms:typeof i=="number"?i:void 0}}if(n==="close_agent"){const r=e.target;return{target:typeof r=="string"?r:void 0}}if(n==="view_image"){const r=e.path,i=e.detail;return{path:typeof r=="string"?r:void 0,detail:typeof i=="string"?i:void 0}}if(n==="write_stdin"){const r=e.session_id,i=e.chars,u=e.yield_time_ms,l=e.max_output_tokens;return{session_id:typeof r=="number"?r:void 0,chars_size:typeof i=="string"?i.length:void 0,yield_time_ms:typeof u=="number"?u:void 0,max_output_tokens:typeof l=="number"?l:void 0}}if(n.startsWith(h)||S(n)!==null){if("_metadata"in e){const{_metadata:r,...i}=e;return i}return e}}o(K,"extractCodexToolInput");function A(n){const t=n.trim();if(!t)return;const e=t.split(/\s+/);for(const s of e)if(!/^[A-Za-z_][A-Za-z0-9_]*=/.test(s)&&s.length>0)return s.split(/[\\/]/).pop()??s}o(A,"extractBashBinary");function E(n){const t=n.split(".");if(t.length!==3)return null;try{const e=Buffer.from(t[1],"base64url").toString("utf-8"),s=JSON.parse(e);return typeof s!="object"||s===null?null:s}catch{return null}}o(E,"decodeJwtPayload");function U(n){if(typeof n=="string"){const t=E(n);return t?{email:t.email,planType:t["https://api.openai.com/auth"]?.chatgpt_plan_type}:{}}if(typeof n=="object"&&n!==null){const t=n;return{email:t.email,planType:t.chatgpt_plan_type}}return{}}o(U,"extractIdTokenFields");function X(n){const t=n??(0,m.join)((0,I.homedir)(),".codex","auth.json");if(!(0,x.existsSync)(t))return{};try{const e=JSON.parse((0,x.readFileSync)(t,"utf-8")),s=e.auth_mode==="chatgpt"||e.auth_mode==="swic"?"subscription":e.auth_mode==="api"?"api":void 0,{email:r,planType:i}=U(e.tokens?.id_token);return{usageType:s,usagePlan:i?.toLowerCase(),userEmail:r}}catch(e){return b.logger.debug(`failed to parse ${t}: ${e}`),{}}}o(X,"resolveCodexUsage");function G(n,t){return n.trim()===`[${t}]`}o(G,"tableHeaderLineExact");function Q(n){const t=n.trim();return/^\[\[?[^\]]+\]\]?$/.test(t)}o(Q,"isAnyTableHeader");function T(n){const e=n.trim().match(/^\[([^[\]]+)\]$/);return e===null?null:e[1]}o(T,"tableHeaderName");function p(n,t){let e=-1;for(let r=0;r<n.length;r+=1)if(G(n[r],t)){e=r;break}if(e<0)return null;let s=n.length;for(let r=e+1;r<n.length;r+=1)if(Q(n[r])){s=r;break}return{startIdx:e,endIdx:s}}o(p,"findTomlSection");function k(n){const t=[...n];for(;t.length>0&&t[t.length-1].trim()==="";)t.pop();return t}o(k,"trimTrailingBlanks");function w(n,t){return n.length===0?t.join(`
|
|
2
2
|
`)+`
|
|
3
3
|
`:n.replace(/\n+$/,"")+`
|
|
4
4
|
|
|
5
5
|
`+t.join(`
|
|
6
6
|
`)+`
|
|
7
7
|
`}o(w,"appendBlockWithSeparator");function Z(n){const t=n.split(`
|
|
8
|
-
`),e=
|
|
9
|
-
`);return
|
|
10
|
-
`)?
|
|
8
|
+
`),e=p(t,"features");if(e===null)return w(n,["[features]","hooks = true"]);const s=t.slice(e.startIdx+1,e.endIdx),r=/^\s*hooks\s*=/;let i=!1;for(let a=0;a<s.length;a+=1)if(r.test(s[a])){s[a]="hooks = true",i=!0;break}i||s.unshift("hooks = true");const u=k(s),g=[...t.slice(0,e.startIdx),t[e.startIdx],...u,...e.endIdx<t.length?[""]:[],...t.slice(e.endIdx)].join(`
|
|
9
|
+
`);return g.endsWith(`
|
|
10
|
+
`)?g:g+`
|
|
11
11
|
`}o(Z,"ensureFeaturesHooksTrue");function q(n){const t=n.split(`
|
|
12
|
-
`),e=
|
|
12
|
+
`),e=p(t,"features");if(e===null)return n;const s=t.slice(e.startIdx+1,e.endIdx),r=/^\s*hooks\s*=\s*true\s*$/,i=s.filter(a=>!r.test(a));if(i.length===s.length)return n;const u=i.some(a=>a.trim().length>0);let l;if(u){const a=k(i);l=[...t.slice(0,e.startIdx),t[e.startIdx],...a,...e.endIdx<t.length?[""]:[],...t.slice(e.endIdx)]}else l=[...t.slice(0,e.startIdx),...t.slice(e.endIdx)];const g=l.join(`
|
|
13
13
|
`).replace(/\n{3,}/g,`
|
|
14
14
|
|
|
15
|
-
`);return
|
|
16
|
-
`)?
|
|
17
|
-
`}o(q,"removeFeaturesHooks");function
|
|
18
|
-
`),e=
|
|
19
|
-
`);return
|
|
20
|
-
`)?
|
|
21
|
-
`}o(
|
|
22
|
-
`),e=
|
|
15
|
+
`);return g.endsWith(`
|
|
16
|
+
`)?g:g+`
|
|
17
|
+
`}o(q,"removeFeaturesHooks");function Y(n){const t=n.split(`
|
|
18
|
+
`),e=p(t,"features.multi_agent_v2");if(e===null)return w(n,["[features.multi_agent_v2]","hide_spawn_agent_metadata = false"]);const s=t.slice(e.startIdx+1,e.endIdx),r=/^\s*hide_spawn_agent_metadata\s*=/;let i=!1;for(let a=0;a<s.length;a+=1)if(r.test(s[a])){s[a]="hide_spawn_agent_metadata = false",i=!0;break}i||s.unshift("hide_spawn_agent_metadata = false");const u=k(s),g=[...t.slice(0,e.startIdx),t[e.startIdx],...u,...e.endIdx<t.length?[""]:[],...t.slice(e.endIdx)].join(`
|
|
19
|
+
`);return g.endsWith(`
|
|
20
|
+
`)?g:g+`
|
|
21
|
+
`}o(Y,"ensureMultiAgentV2SpawnMetadataExposed");function N(n){const t=n.split(`
|
|
22
|
+
`),e=p(t,"features.multi_agent_v2");if(e===null)return n;const s=t.slice(e.startIdx+1,e.endIdx).filter(l=>l.trim().length>0);if(!(s.length===1&&/^\s*hide_spawn_agent_metadata\s*=\s*false\s*$/.test(s[0])))return n;const u=[...t.slice(0,e.startIdx),...t.slice(e.endIdx)].join(`
|
|
23
23
|
`).replace(/\n{3,}/g,`
|
|
24
24
|
|
|
25
25
|
`);return u.endsWith(`
|
|
26
26
|
`)?u:u+`
|
|
27
|
-
`}o(
|
|
28
|
-
`),i=
|
|
27
|
+
`}o(N,"removeMultiAgentV2SpawnMetadata");function nn(n,t,e){const s=`mcp_servers.${t}`,r=n.split(`
|
|
28
|
+
`),i=p(r,s),l=[`[${s}]`,...e];if(i===null)return w(n,l);const g=r.slice(0,i.startIdx),a=r.slice(i.endIdx),d=[...g,...l,...a.length>0?[""]:[],...a].join(`
|
|
29
|
+
`);return d.endsWith(`
|
|
30
|
+
`)?d:d+`
|
|
31
|
+
`}o(nn,"upsertMcpServer");function tn(n,t){const e=`mcp_servers.${t}`,s=`${e}.`,r=n.split(`
|
|
32
|
+
`),i=[];let u=!1,l=!1;for(const d of r){const f=T(d);if(f!==null&&(u=f===e||f.startsWith(s),u)){l=!0;continue}u||i.push(d)}if(!l)return n;const g=[];let a=!1;for(const d of i){const f=d.trim().length===0;f&&a||(g.push(d),a=f)}const c=g.join(`
|
|
29
33
|
`);return c.endsWith(`
|
|
30
|
-
`)?c:c+`
|
|
31
|
-
`}o(
|
|
32
|
-
`),i=
|
|
33
|
-
`);return
|
|
34
|
-
`)
|
|
35
|
-
`}o(
|
|
36
|
-
`),i=
|
|
34
|
+
`)||c.length===0?c:c+`
|
|
35
|
+
`}o(tn,"removeMcpServer");function en(n,t,e){const s=`agents.${t}`,r=n.split(`
|
|
36
|
+
`),i=p(r,s),l=[`[${s}]`,...e];if(i===null)return w(n,l);const g=r.slice(0,i.startIdx),a=r.slice(i.endIdx),d=[...g,...l,...a.length>0?[""]:[],...a].join(`
|
|
37
|
+
`);return d.endsWith(`
|
|
38
|
+
`)?d:d+`
|
|
39
|
+
`}o(en,"upsertAgentsTable");function rn(n,t){const e=`agents.${t}`,s=`${e}.`,r=n.split(`
|
|
40
|
+
`),i=[];let u=!1,l=!1;for(const d of r){const f=T(d);if(f!==null&&(u=f===e||f.startsWith(s),u)){l=!0;continue}u||i.push(d)}if(!l)return n;const g=[];let a=!1;for(const d of i){const f=d.trim().length===0;f&&a||(g.push(d),a=f)}const c=g.join(`
|
|
41
|
+
`);return c.endsWith(`
|
|
42
|
+
`)||c.length===0?c:c+`
|
|
43
|
+
`}o(rn,"removeAgentsTable");function sn(n,t){const e=JSON.stringify(t),s=n.split(`
|
|
44
|
+
`),r=p(s,"sandbox_workspace_write");if(r===null)return w(n,["[sandbox_workspace_write]",`writable_roots = [${e}]`]);const i=s.slice(r.startIdx+1,r.endIdx);if(i.some(d=>d.includes(e)))return n;const u=/^\s*writable_roots\s*=\s*\[(.*)\]\s*$/;let l=!1;for(let d=0;d<i.length;d+=1){const f=i[d].match(u);if(f){const _=f[1].trim();i[d]=`writable_roots = [${_.length===0?e:`${_}, ${e}`}]`,l=!0;break}}if(!l){if(i.some(d=>/^\s*writable_roots\s*=/.test(d)))return b.logger.debug("codex: existing multi-line writable_roots \u2014 leaving as-is; add ~/.ironbee/projects manually if needed"),n;i.unshift(`writable_roots = [${e}]`)}const g=k(i),c=[...s.slice(0,r.startIdx),s[r.startIdx],...g,...r.endIdx<s.length?[""]:[],...s.slice(r.endIdx)].join(`
|
|
37
45
|
`);return c.endsWith(`
|
|
38
46
|
`)?c:c+`
|
|
39
|
-
`}o(
|
|
40
|
-
`),
|
|
41
|
-
`)
|
|
42
|
-
|
|
43
|
-
`
|
|
44
|
-
`)
|
|
47
|
+
`}o(sn,"ensureSandboxWritableRoot");function on(n,t){const e=JSON.stringify(t),s=n.split(`
|
|
48
|
+
`),r=p(s,"sandbox_workspace_write");if(r===null)return n;const i=s.slice(r.startIdx+1,r.endIdx),u=/^\s*writable_roots\s*=\s*\[(.*)\]\s*$/;for(let c=0;c<i.length;c+=1){const d=i[c].match(u);if(d){const f=d[1].split(",").map(_=>_.trim()).filter(_=>_.length>0&&_!==e);f.length===0?i.splice(c,1):i[c]=`writable_roots = [${f.join(", ")}]`;break}}const l=k(i);if(l.length===0){const c=[...s.slice(0,r.startIdx),...s.slice(r.endIdx)].join(`
|
|
49
|
+
`).replace(/\n{3,}/g,`
|
|
50
|
+
|
|
51
|
+
`);return c.endsWith(`
|
|
52
|
+
`)||c.length===0?c:c+`
|
|
53
|
+
`}const a=[...s.slice(0,r.startIdx),s[r.startIdx],...l,...r.endIdx<s.length?[""]:[],...s.slice(r.endIdx)].join(`
|
|
54
|
+
`);return a.endsWith(`
|
|
55
|
+
`)?a:a+`
|
|
56
|
+
`}o(on,"removeSandboxWritableRoot");function ln(n,t){return(0,m.join)(n,".codex","agents",`${t}.toml`)}o(ln,"codexAgentTomlPath");function un(n){for(const t of n.split(`
|
|
57
|
+
`)){const e=t.trim();if(e.startsWith("["))break;const s=e.match(/^model\s*=\s*"([^"]*)"/);if(s&&s[1].length>0)return s[1]}return null}o(un,"extractTomlTopLevelModel");function an(n){const t=[];for(const[e,s]of Object.entries(n))if(s!=null){if(typeof s=="string")t.push(`${e} = ${JSON.stringify(s)}`);else if(typeof s=="number"||typeof s=="boolean")t.push(`${e} = ${s}`);else if(Array.isArray(s)){const r=s.map(i=>typeof i=="string"?JSON.stringify(i):typeof i=="number"||typeof i=="boolean"?String(i):JSON.stringify(i));t.push(`${e} = [${r.join(", ")}]`)}else if(typeof s=="object"){const r=s,i=[];for(const[u,l]of Object.entries(r))l!=null&&(typeof l=="string"?i.push(`${u} = ${JSON.stringify(l)}`):typeof l=="number"||typeof l=="boolean"?i.push(`${u} = ${l}`):i.push(`${u} = ${JSON.stringify(l)}`));t.push(`${e} = { ${i.join(", ")} }`)}}return t}o(an,"tomlBodyFromRecord");const v="<!-- ironbee:start -->",y="<!-- ironbee:end -->";function dn(n,t){const e=`${v}
|
|
45
58
|
${t.trimEnd()}
|
|
46
|
-
${
|
|
59
|
+
${y}`,s=n.indexOf(v),r=n.indexOf(y);if(s>=0&&r>s){const i=n.slice(0,s),u=n.slice(r+y.length);return i+e+u}return n.trim().length===0?e+`
|
|
47
60
|
`:n.trimEnd()+`
|
|
48
61
|
|
|
49
62
|
`+e+`
|
|
50
|
-
`}o(
|
|
63
|
+
`}o(dn,"upsertAgentsMdBlock");function cn(n){const t=n.indexOf(v),e=n.indexOf(y);if(t<0||e<t)return n.trim().length===0?null:n;const s=n.slice(0,t).trimEnd(),r=n.slice(e+y.length).trimStart(),i=s+(s.length>0&&r.length>0?`
|
|
51
64
|
|
|
52
65
|
`:"")+r;return i.trim().length===0?null:i.endsWith(`
|
|
53
66
|
`)?i:i+`
|
|
54
|
-
`}o(
|
|
67
|
+
`}o(cn,"stripAgentsMdBlock");function gn(n){const t=O(n);if(!(0,x.existsSync)(t))return"";try{return(0,x.readFileSync)(t,"utf-8")}catch(e){return b.logger.debug(`failed to read ${t}: ${e}`),""}}o(gn,"readCodexConfigToml");function fn(n,t){const e=O(n);try{(0,x.writeFileSync)(e,t)}catch(s){b.logger.debug(`failed to write ${e}: ${s}`)}}o(fn,"writeCodexConfigToml");function O(n){return(0,m.join)(n,".codex","config.toml")}o(O,"codexConfigTomlPath");function pn(n){return(0,m.join)(n,".codex","hooks.json")}o(pn,"codexHooksJsonPath");function mn(){return(0,m.join)((0,I.homedir)(),".codex","config.toml")}o(mn,"userCodexConfigTomlPath");function xn(){return(0,m.join)((0,I.homedir)(),".codex","hooks.json")}o(xn,"userCodexHooksJsonPath");function _n(n){return(0,m.join)((0,I.homedir)(),".codex","agents",`${n}.toml`)}o(_n,"userCodexAgentTomlPath");0&&(module.exports={AGENTS_MD_END_MARKER,AGENTS_MD_START_MARKER,canonicalizeCodexServerName,canonicalizeCodexToolName,classifyCodexTool,codexAgentTomlPath,codexConfigTomlPath,codexHooksJsonPath,decodeJwtPayload,ensureFeaturesHooksTrue,ensureMultiAgentV2SpawnMetadataExposed,ensureSandboxWritableRoot,extractBashBinary,extractCodexMcpServer,extractCodexToolInput,extractTomlTopLevelModel,findTomlSection,normalizeCodexToolName,parseCodexHookStdin,readCodexConfigToml,removeAgentsTable,removeFeaturesHooks,removeMcpServer,removeMultiAgentV2SpawnMetadata,removeSandboxWritableRoot,resolveCodexUsage,stripAgentsMdBlock,tomlBodyFromRecord,upsertAgentsMdBlock,upsertAgentsTable,upsertMcpServer,userCodexAgentTomlPath,userCodexConfigTomlPath,userCodexHooksJsonPath,writeCodexConfigToml});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var p=(i,o)=>r(i,"name",{value:o,configurable:!0});var S=(i,o)=>{for(var t in o)r(i,t,{get:o[t],enumerable:!0})},v=(i,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of m(o))!l.call(i,s)&&s!==t&&r(i,s,{get:()=>o[s],enumerable:!(n=f(o,s))||n.enumerable});return i};var y=i=>v(r({},"__esModule",{value:!0}),i);var I={};S(I,{run:()=>k});module.exports=y(I);var u=require("../../../hooks/core/activity-end"),e=require("../../../lib/logger"),a=require("../../../lib/output"),c=require("../../../lib/stdin"),d=require("../../../lib/runtime-paths");async function k(i){let o;try{o=JSON.parse((0,c.readStdin)())}catch(g){e.logger.debug(`failed to parse stdin: ${g}`),(0,a.writeAndExit)(JSON.stringify({}),0);return}const t=o.conversation_id??"default",n=(0,d.sessionDir)(i,t),s=`${n}/actions.jsonl`;(0,e.setLogFile)(`${n}/session.log`),await(0,u.runActivityEnd)({sessionDir:n,actionsFile:s,projectDir:i,sessionId:t}),(0,a.writeAndExit)(JSON.stringify({}),0)}p(k,"run");0&&(module.exports={run});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty;var
|
|
1
|
+
"use strict";var e=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(r,o)=>e(r,"name",{value:o,configurable:!0});var l=(r,o)=>{for(var t in o)e(r,t,{get:o[t],enumerable:!0})},S=(r,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of d(o))!g.call(r,s)&&s!==t&&e(r,s,{get:()=>o[s],enumerable:!(i=f(o,s))||i.enumerable});return r};var v=r=>S(e({},"__esModule",{value:!0}),r);var I={};l(I,{run:()=>b});module.exports=v(I);var a=require("../../../hooks/core/activity"),n=require("../../../lib/logger"),u=require("../../../lib/stdin"),c=require("../../../lib/runtime-paths");async function b(r){let o;try{o=JSON.parse((0,u.readStdin)())}catch(m){n.logger.debug(`failed to parse stdin: ${m}`),process.exit(0)}const t=o.conversation_id??"default",i=(0,c.sessionDir)(r,t);(0,n.setLogFile)(`${i}/session.log`);const s=`${i}/actions.jsonl`;await(0,a.startActivity)({sessionDir:i,actionsFile:s,source:"user_prompt"}),process.exit(0)}p(b,"run");0&&(module.exports={run});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var p=(t,e)=>g(t,"name",{value:e,configurable:!0});var W=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},$=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of w(e))!I.call(t,i)&&i!==o&&g(t,i,{get:()=>e[i],enumerable:!(n=b(e,i))||n.enumerable});return t};var k=t=>$(g({},"__esModule",{value:!0}),t);var L={};W(L,{run:()=>E});module.exports=k(L);var _=require("fs"),C=require("../../../hooks/core/clear-verdict"),v=require("../../../hooks/core/verification-lifecycle"),m=require("../../../hooks/core/actions"),F=require("../../../hooks/core/session-state"),x=require("../../../hooks/core/tool-use-stash"),c=require("../../../hooks/core/file-diff"),u=require("../../../lib/runtime-paths"),d=require("../../../lib/config"),a=require("../../../lib/logger"),y=require("../../../lib/stdin");function D(t,e){const o=t.tool_name,n=t.tool_input;if(!n)return null;const i=t.tool_use_id?(0,x.consumeToolUseData)(e,t.tool_use_id):null;if(o==="StrReplace"){const s=n.old_string??"",l=n.new_string??"",r=(0,c.diffLineCounts)(s,l);return{tool_name:"StrReplace",operation:"update",lines_added:r.added,lines_removed:r.removed,stash:i}}if(o==="Write"){const s=n.content??n.contents??"",l=i?.file_existed??!1;return{tool_name:"Write",operation:l?"update":"create",lines_added:(0,c.countLines)(s),lines_removed:l?null:0,stash:i}}return o==="Delete"?{tool_name:"Delete",operation:"delete",lines_added:null,lines_removed:null,stash:i}:null}p(D,"deriveChangeFacts");function U(t,e,o,n){const i=o?.prior_content??"";let s;if(e==="delete")s="";else try{s=(0,_.existsSync)(t)?(0,_.readFileSync)(t,"utf-8"):""}catch(r){a.logger.debug(`failed to read post-edit content of ${t} for changeset: ${r}`);return}return(0,c.createUnifiedDiff)(i,s,n)??void 0}p(U,"buildChangeset");async function E(t){let e;try{e=JSON.parse((0,y.readStdin)())}catch(f){a.logger.debug(`failed to parse stdin: ${f}`),process.exit(0)}const o=e.conversation_id??"default";(0,a.setLogFile)((0,u.sessionLogFile)(t,o));const n=e.tool_input?.file_path??e.tool_input?.path;n&&n.endsWith("verdict.json")&&n.replace(/\\/g,"/").startsWith((0,u.sessionsRoot)(t).replace(/\\/g,"/")+"/")&&(a.logger.debug(`skipping clear-verdict: write target is verdict file ${n}`),process.exit(0));const i=(0,d.loadConfig)(t);n&&!(0,d.requiresVerification)(n,i)&&(a.logger.debug(`skipping clear-verdict: file does not require verification (${n})`),process.exit(0)),n||a.logger.warn(`clear-verdict: ${e.tool_name} had no extractable file path (tool_input keys: [${Object.keys(e.tool_input??{}).join(", ")}]) \u2014 recording file_change with empty path so the fix cycle isn't lost`);const s=(0,u.sessionDir)(t,o),l=`${s}/actions.jsonl`,r=D(e,o);r||(a.logger.debug(`skipping clear-verdict: unsupported tool ${e.tool_name}`),process.exit(0));const S=await(0,v.openFixCycleIfFixing)({sessionDir:s,actionsFile:l}),h={...(0,m.baseFields)(l),type:"file_change",timestamp:Date.now(),tool_name:r.tool_name,file_path:n??"",operation:r.operation,lines_added:r.lines_added,lines_removed:r.lines_removed,activity_id:(0,F.getActiveActivityId)(s),fix_id:S};if((0,d.getCaptureFileChangeset)(i)&&n){const f=U(n,r.operation,r.stash,(0,d.getMaxChangesetBytes)(i));f!==void 0&&(h.changeset=f)}await(0,m.appendAction)(l,h),(0,C.runClearVerdict)({verdictFile:`${s}/verdict.json`,sessionDir:s}),process.exit(0)}p(E,"run");0&&(module.exports={run});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var h=(o,t)=>l(o,"name",{value:t,configurable:!0});var k=(o,t)=>{for(var i in t)l(o,i,{get:t[i],enumerable:!0})},I=(o,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!x.call(o,s)&&s!==i&&l(o,s,{get:()=>t[s],enumerable:!(e=P(t,s))||e.enumerable});return o};var E=o=>I(l({},"__esModule",{value:!0}),o);var $={};k($,{run:()=>F});module.exports=E($);var c=require("fs"),b=require("../../../hooks/core/actions"),v=require("../../../hooks/core/activity"),C=require("../../../hooks/core/tool-use-stash"),d=require("../../../lib/config"),n=require("../../../lib/logger"),S=require("../../../lib/stdin"),p=require("../../../lib/runtime-paths");async function F(o,t){const i=t?.soft===!0;let e;try{e=JSON.parse((0,S.readStdin)())}catch(r){n.logger.debug(`failed to parse stdin: ${r}`);const u={permission:"allow"};process.stdout.write(JSON.stringify(u)),process.exit(0);return}const s=e.conversation_id??"default";(0,n.setLogFile)((0,p.sessionLogFile)(o,s));const f=(0,p.sessionDir)(o,s),g=`${f}/actions.jsonl`;if(!i&&(0,b.hasToolCallsSinceLastVerdict)(g)){const r={permission:"deny",agent_message:`BLOCKED: You used verification tools (browser-devtools / node-devtools / backend-devtools / android-devtools) but did not submit a verdict. You MUST submit a verdict (pass or fail) before editing code.
|
|
2
2
|
|
|
3
3
|
Submit your verdict first:
|
|
4
4
|
echo '{"session_id":"${s}","status":"fail","checks":["..."],"issues":["describe what failed"]}' | ironbee hook submit-verdict
|
|
5
5
|
|
|
6
|
-
Then you can edit code to fix the issues.`};process.stdout.write(JSON.stringify(r)),process.exit(2);return}const a=e.tool_input?.file_path??e.tool_input?.path;if(a&&e.tool_use_id){const r=(0,d.loadConfig)(o),u=(0,d.getCaptureFileChangeset)(r),
|
|
6
|
+
Then you can edit code to fix the issues.`};process.stdout.write(JSON.stringify(r)),process.exit(2);return}const a=e.tool_input?.file_path??e.tool_input?.path;if(a&&e.tool_use_id){const r=(0,d.loadConfig)(o),u=(0,d.getCaptureFileChangeset)(r),m=(0,c.existsSync)(a),w=e.tool_name==="Write",T=e.tool_name==="StrReplace"||e.tool_name==="Delete";if(w||T&&u){const _={file_existed:m};if(u&&m)try{_.prior_content=(0,c.readFileSync)(a,"utf-8")}catch(O){n.logger.debug(`failed to pre-read ${a} for changeset capture: ${O}`)}(0,C.stashToolUseData)(s,e.tool_use_id,_)}}await(0,v.startActivity)({sessionDir:f,actionsFile:g,source:"pre_tool_use"});const y={permission:"allow"};process.stdout.write(JSON.stringify(y)),process.exit(0)}h(F,"run");0&&(module.exports={run});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var R=(o,t)=>f(o,"name",{value:t,configurable:!0});var J=(o,t)=>{for(var c in t)f(o,c,{get:t[c],enumerable:!0})},L=(o,t,c,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of K(t))!j.call(o,r)&&r!==c&&f(o,r,{get:()=>t[r],enumerable:!(i=F(t,r))||i.enumerable});return o};var D=o=>L(f({},"__esModule",{value:!0}),o);var Y={};J(Y,{run:()=>q});module.exports=D(Y);var S=require("crypto"),e=require("../../../hooks/core/session-state"),I=require("../../../hooks/core/actions"),k=require("../../../hooks/core/activity"),O=require("../../../hooks/core/verification-lifecycle"),U=require("../../../lib/config"),E=require("../../../lib/recording-tools"),M=require("../../../hooks/core/scenario-tools"),p=require("../../../lib/logger"),A=require("../../../lib/stdin"),N=require("../../../lib/runtime-paths");const h={"MCP:bdt_":"browser-devtools","MCP:ndt_":"node-devtools","MCP:bedt_":"backend-devtools","MCP:adt_":"android-devtools"},W="browser-devtools";async function q(o,t){const c=t?.soft===!0;let i;try{i=JSON.parse((0,A.readStdin)())}catch(n){p.logger.debug(`failed to parse stdin: ${n}`);const B={permission:"allow"};process.stdout.write(JSON.stringify(B)),process.exit(0);return}const r=i.conversation_id??"default",s=(0,N.sessionDir)(o,r);(0,p.setLogFile)(`${s}/session.log`);const P=`${s}/actions.jsonl`,g=(0,M.isScenarioTool)(i.tool_name),b=(0,e.getActiveVerificationId)(s);if(!b&&!c&&!g){const n={permission:"deny",agent_message:`BLOCKED: You must start a verification cycle before using devtools tools (browser-devtools / node-devtools / backend-devtools / android-devtools).
|
|
2
2
|
|
|
3
3
|
Start verification first:
|
|
4
4
|
echo '{"session_id":"${r}"}' | ironbee hook verification-start
|
|
5
5
|
|
|
6
|
-
Then use the verification tools for the active cycle(s) \u2014 MCP:bdt_* for browser, MCP:ndt_* for node, MCP:bedt_* for backend, MCP:adt_* for android.`};process.stdout.write(JSON.stringify(n)),process.exit(2);return}const m=i.tool_name??"",v=m.startsWith("MCP:")?m.slice(4):"",u=v?(0,E.recordingToolsForBareTool)(v):null;if(!c&&!
|
|
6
|
+
Then use the verification tools for the active cycle(s) \u2014 MCP:bdt_* for browser, MCP:ndt_* for node, MCP:bedt_* for backend, MCP:adt_* for android.`};process.stdout.write(JSON.stringify(n)),process.exit(2);return}const m=i.tool_name??"",v=m.startsWith("MCP:")?m.slice(4):"",u=v?(0,E.recordingToolsForBareTool)(v):null;if(!c&&!g&&u!==null&&(0,e.isRecordingRequired)(s)&&!(0,e.isRecordingActive)(s)&&v!==u.startTool){const n={permission:"deny",agent_message:`BLOCKED: Recording is required but not started.
|
|
7
7
|
|
|
8
8
|
1. Start recording NOW:
|
|
9
9
|
Use MCP:${u.startTool}
|
|
@@ -12,4 +12,4 @@ Then use the verification tools for the active cycle(s) \u2014 MCP:bdt_* for bro
|
|
|
12
12
|
|
|
13
13
|
3. **Stop recording BEFORE submitting verdict:**
|
|
14
14
|
Use MCP:${u.stopTool}
|
|
15
|
-
submit-verdict will reject with "recording is still active" if you skip this.`};process.stdout.write(JSON.stringify(n)),process.exit(2);return}await(0,k.startActivity)({sessionDir:s,actionsFile:
|
|
15
|
+
submit-verdict will reject with "recording is still active" if you skip this.`};process.stdout.write(JSON.stringify(n)),process.exit(2);return}await(0,k.startActivity)({sessionDir:s,actionsFile:P,source:"pre_tool_use"});let d=b;c&&!d&&!g&&(d=(await(0,O.startVerification)({sessionId:r,sessionDir:s,actionsFile:P,recordingEnabled:!1})).verificationId);const $=(0,e.getActiveTraceId)(s),_=(0,e.getActiveActivityId)(s),y=(0,I.resolveProjectName)(o),C=[`prj:${y}`,`sid:${r}`];_&&C.push(`aid:${_}`),d&&C.push(`vid:${d}`);const V=`ironbee=${C.join(";")}`,l=(0,U.loadConfig)(o),T={...i.tool_input??{}},a={projectName:y,sessionId:r,activityId:_,verificationId:d,traceId:$,traceState:V,toolCallId:(0,S.randomUUID)()};i.tool_use_id&&(a.toolUseId=i.tool_use_id),a.mcpServer=(()=>{for(const n of Object.keys(h))if(m.startsWith(n))return h[n];return W})();const w=(0,e.getUserEmail)(s);w&&(a.userEmail=w),l.collector?.url&&(a.collectorUrl=l.collector.url),l.collector?.oauthToken?a.collectorOAuthToken=l.collector.oauthToken:l.collector?.apiKey&&(a.collectorApiKey=l.collector.apiKey),T._metadata=a;const x={permission:"allow",updated_input:T};process.stdout.write(JSON.stringify(x)),process.exit(0)}R(q,"run");0&&(module.exports={run});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var c=(n,s)=>a(n,"name",{value:s,configurable:!0});var v=(n,s)=>{for(var i in s)a(n,i,{get:s[i],enumerable:!0})},A=(n,s,i,e)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of w(s))!_.call(n,o)&&o!==i&&a(n,o,{get:()=>s[o],enumerable:!(e=y(s,o))||e.enumerable});return n};var E=n=>A(a({},"__esModule",{value:!0}),n);var C={};v(C,{run:()=>b});module.exports=E(C);var t=require("../../../hooks/core/actions"),p=require("../../../hooks/core/activity"),m=require("../../../hooks/core/session-state"),r=require("../../../lib/logger"),u=require("../../../lib/stdin"),l=require("../../../queue"),f=require("../../../lib/runtime-paths");async function b(n){let s;try{s=JSON.parse((0,u.readStdin)())}catch(S){r.logger.debug(`failed to parse stdin: ${S}`),process.exit(0)}const i=s.conversation_id??"default",e=(0,f.sessionDir)(n,i),o=`${e}/actions.jsonl`;(0,r.setLogFile)(`${e}/session.log`),await(0,m.closeOpenCycles)(e,o,"session_end"),await(0,p.endActivity)({sessionDir:e,actionsFile:o});const d=Date.now(),g={...(0,t.baseFields)(o),type:"session_end",timestamp:d,session_id:i,duration:(0,t.findDurationSinceLastAction)(o,"session_start",d),reason:s.reason};await(0,t.appendAction)(o,g),await(0,l.flushSynchronously)(n,i),r.logger.debug(`session-end: ${i}`),process.exit(0)}c(b,"run");0&&(module.exports={run});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var m=(s,i)=>u(s,"name",{value:i,configurable:!0});var _=(s,i)=>{for(var t in i)u(s,t,{get:i[t],enumerable:!0})},w=(s,i,t,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of E(i))!I.call(s,e)&&e!==t&&u(s,e,{get:()=>i[e],enumerable:!(n=O(i,e))||n.enumerable});return s};var k=s=>w(u({},"__esModule",{value:!0}),s);var N={};_(N,{run:()=>x});module.exports=k(N);var a=require("../../../hooks/core/actions"),o=require("../../../hooks/core/session-state"),f=require("../../../lib/config"),c=require("../../../lib/logger"),d=require("../../../lib/output"),g=require("../../../lib/stdin"),S=require("../../../lib/telemetry"),r=require("../../../lib/runtime-paths");async function x(s){let i;try{i=JSON.parse((0,g.readStdin)())}catch(y){c.logger.debug(`failed to parse stdin: ${y}`),(0,d.writeAndExit)(JSON.stringify({}),0);return}const t=i.conversation_id??"default",n=(0,r.sessionActionsFile)(s,t);(0,c.setLogFile)((0,r.sessionLogFile)(s,t));const e=(0,r.sessionDir)(s,t);(0,o.setProjectDir)(e,s),(0,o.setUserEmail)(e,i.user_email??void 0);const p={...(0,a.baseFields)(n),type:"session_start",timestamp:Date.now(),session_id:t,client:"cursor",source:"startup"};await(0,a.appendAction)(n,p),await(0,o.reconcileSessionState)(e,n,a.appendAction);const l=(0,f.getVerificationEnabled)((0,f.loadConfig)(s));if(await(0,S.trackSessionStart)("cursor",t,l,s),c.logger.debug(`session-start: ${t}`),!l){(0,d.writeAndExit)(JSON.stringify({}),0);return}const b=JSON.stringify({session_id:t,status:"pass",checks:["form submits successfully","new item appears in list"]}),v=JSON.stringify({session_id:t,status:"fail",checks:["form renders","submit button unresponsive"],issues:["button click handler not firing","TypeError in console"]}),h={additional_context:`IRONBEE VERIFICATION \u2014 SESSION ACTIVE
|
|
2
2
|
Session ID: ${t}
|
|
3
3
|
|
|
4
4
|
You MUST verify all code changes in the browser before completing any task.
|
|
@@ -7,11 +7,11 @@ After EVERY verification attempt, you MUST submit a verdict BEFORE doing anythin
|
|
|
7
7
|
- If fail \u2192 submit fail verdict FIRST, then fix. Do NOT skip to fixing code without submitting.
|
|
8
8
|
|
|
9
9
|
Submit via terminal:
|
|
10
|
-
echo '${
|
|
10
|
+
echo '${b}' | ironbee hook submit-verdict
|
|
11
11
|
|
|
12
12
|
On fail (issues is required):
|
|
13
|
-
echo '${
|
|
13
|
+
echo '${v}' | ironbee hook submit-verdict
|
|
14
14
|
|
|
15
15
|
Required fields: session_id, status, checks
|
|
16
16
|
On fail, include: issues (array of strings describing what failed)
|
|
17
|
-
On pass after a previous fail, include: fixes (array of strings describing what was fixed)`};(0,
|
|
17
|
+
On pass after a previous fail, include: fixes (array of strings describing what was fixed)`};(0,d.writeAndExit)(JSON.stringify(h),0)}m(x,"run");0&&(module.exports={run});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var p=(t,o)=>d(t,"name",{value:o,configurable:!0});var C=(t,o)=>{for(var r in o)d(t,r,{get:o[r],enumerable:!0})},S=(t,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of v(o))!I.call(t,n)&&n!==r&&d(t,n,{get:()=>o[n],enumerable:!(i=h(o,n))||i.enumerable});return t};var P=t=>S(d({},"__esModule",{value:!0}),t);var x={};C(x,{run:()=>L});module.exports=P(x);var b=require("../../../hooks/core/actions"),T=require("../../../hooks/core/activity"),m=require("../../../hooks/core/session-state"),E=require("../../../lib/config"),e=require("../../../lib/logger"),c=require("../../../lib/output"),w=require("../../../lib/stdin"),l=require("../../../queue"),f=require("../util"),O=require("../../../lib/runtime-paths");const D="bdt_",J="ndt_",F="bedt_";async function L(t){let o;try{o=JSON.parse((0,w.readStdin)())}catch(u){e.logger.debug(`failed to parse stdin: ${u}`),(0,c.writeAndExit)(JSON.stringify({}),0);return}const r=o.conversation_id??"default",i=(0,O.sessionDir)(t,r),n=`${i}/actions.jsonl`;(0,e.setLogFile)(`${i}/session.log`),(0,m.getActiveActivityId)(i)===void 0&&await(0,T.startActivity)({sessionDir:i,actionsFile:n,source:"pre_tool_use"});const _=o.tool_name??"unknown",k=Date.now(),A=o.tool_input&&typeof o.tool_input=="object"&&!Array.isArray(o.tool_input)?{...o.tool_input,_metadata:void 0}:o.tool_input,N=(0,m.getActiveActivityId)(i),s=(0,f.classifyTool)(_,o.tool_input);if(s.tool_type==="mcp"&&(s.tool_name.startsWith(D)||s.tool_name.startsWith(J)||s.tool_name.startsWith(F))){e.logger.debug(`track-action-monitor: skipped devtools tool ${_}`),(0,c.writeAndExit)(JSON.stringify({}),0);return}const g=typeof o.error_message=="string"&&o.error_message.length>0?o.error_message:void 0;let a;if(g){const u=[];o.failure_type&&u.push(o.failure_type),o.is_interrupt&&u.push("interrupted"),a=`${u.length>0?`${u.join(",")}: `:""}${g}`}const $={...(0,b.baseFields)(n),type:"tool_call",timestamp:k,tool_name:s.tool_name,tool_type:s.tool_type,tool_use_id:o.tool_use_id,tool_input:(0,f.extractCursorToolInput)(_,A),tool_input_size:y(o.tool_input),tool_response:a?void 0:o.tool_output,tool_response_size:y(a?void 0:o.tool_output),activity_id:N,duration:typeof o.duration=="number"?o.duration:null,mcp_server:s.mcp_server,error:a};R(t,r,$),e.logger.debug(`track-action-monitor: ${_}${a?" (failed)":""}`),(0,c.writeAndExit)(JSON.stringify({}),0)}p(L,"run");function R(t,o,r){if(!(0,E.isJobQueueEnabled)(t))return;const i={...r};delete i.tool_response;try{(0,l.submit)(t,o,l.SEND_EVENT_TYPE,i)}catch(n){if(n instanceof l.JobTooLargeError){e.logger.debug(`track-action-monitor: wire event too large for ${r.tool_name}; dropping`);return}e.logger.debug(`track-action-monitor: failed to submit ${r.tool_name}: ${n instanceof Error?n.message:n}`)}}p(R,"submitEvent");function y(t){if(t==null)return 0;try{const o=typeof t=="string"?t:JSON.stringify(t);return o===void 0?0:Buffer.byteLength(o,"utf-8")}catch{return 0}}p(y,"byteSize");0&&(module.exports={run});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var
|
|
1
|
+
"use strict";var y=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var g=(o,t)=>y(o,"name",{value:t,configurable:!0});var Y=(o,t)=>{for(var l in t)y(o,l,{get:t[l],enumerable:!0})},q=(o,t,l,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of j(t))!Q.call(o,r)&&r!==l&&y(o,r,{get:()=>t[r],enumerable:!(i=K(t,r))||i.enumerable});return o};var G=o=>q(y({},"__esModule",{value:!0}),o);var rt={};Y(rt,{run:()=>et});module.exports=G(rt);var p=require("../../../hooks/core/actions"),T=require("../../../hooks/core/nested-tools"),a=require("../../../hooks/core/session-state"),L=require("../../../hooks/core/verification-context"),E=require("../../../lib/config"),s=require("../../../lib/logger"),k=require("../../../lib/recording-tools"),F=require("../../../lib/output"),P=require("../../../lib/stdin"),f=require("../../../queue"),b=require("../util"),W=require("../../../lib/runtime-paths");const N="bdt_",$="ndt_",x="bedt_",D="adt_",H="browser-devtools",Z="node-devtools",tt="backend-devtools",ot="android-devtools";function nt(o){return o.startsWith(x)?tt:o.startsWith(D)?ot:o.startsWith(N)?H:o.startsWith($)?Z:null}g(nt,"resolveServerByPrefix");async function et(o){let t;try{t=JSON.parse((0,P.readStdin)())}catch(n){s.logger.debug(`failed to parse stdin: ${n}`),process.stdout.write(JSON.stringify({})),process.exit(0);return}const l=t.conversation_id??"default",i=(0,W.sessionDir)(o,l),r=`${i}/actions.jsonl`;(0,s.setLogFile)(`${i}/session.log`);const v=t.tool_name??"unknown",R=Date.now(),w=t.tool_input&&typeof t.tool_input=="object"&&!Array.isArray(t.tool_input)?{...t.tool_input,_metadata:void 0}:t.tool_input,A=(0,a.getActiveActivityId)(i),O=(0,a.getActiveVerificationId)(i),C=(0,a.getActiveTraceId)(i),e=(0,b.classifyTool)(v,t.tool_input),B=e.tool_type==="mcp"&&e.tool_name.startsWith(N),J=e.tool_type==="mcp"&&e.tool_name.startsWith($),M=e.tool_type==="mcp"&&e.tool_name.startsWith(x),z=e.tool_type==="mcp"&&e.tool_name.startsWith(D),m=B||J||M||z,c=e.tool_type==="mcp"?nt(e.tool_name)??e.mcp_server:e.mcp_server,X=m?w:(0,b.extractCursorToolInput)(v,w),I=typeof t.error_message=="string"&&t.error_message.length>0?t.error_message:void 0;let u;if(I){const n=[];t.failure_type&&n.push(t.failure_type),t.is_interrupt&&n.push("interrupted"),u=`${n.length>0?`${n.join(",")}: `:""}${I}`}const S={...(0,p.baseFields)(r),type:"tool_call",timestamp:R,tool_name:e.tool_name,tool_type:e.tool_type,tool_use_id:t.tool_use_id,tool_input:X,tool_input_size:V(t.tool_input),tool_response:u?void 0:t.tool_output,tool_response_size:V(u?void 0:t.tool_output),activity_id:A,verification_id:O,trace_id:C,duration:typeof t.duration=="number"?t.duration:null,mcp_server:c,error:u};if(m){await(0,p.appendAction)(r,S);const n=(0,k.recordingToolsForServer)(c);n!==null&&(e.tool_name===n.startTool?((0,a.setRecordingActive)(i,!0),s.logger.debug(`track-action: recording started (${n.cycle})`)):e.tool_name===n.stopTool&&((0,a.setRecordingActive)(i,!1),s.logger.debug(`track-action: recording stopped (${n.cycle})`)))}else it(o,l,S);if(s.logger.debug(`track-action: ${v}${u?" (failed)":""}`),m&&c!==null&&e.tool_name===(0,T.executeToolBareName)(c)&&!u){const n=(0,T.extractNestedToolCalls)(t.tool_input,c),_=(0,k.recordingToolsForServer)(c);for(const d of n){_!==null&&(d.name===_.startTool?((0,a.setRecordingActive)(i,!0),s.logger.debug(`track-action (nested): recording started (${_.cycle})`)):d.name===_.stopTool&&((0,a.setRecordingActive)(i,!1),s.logger.debug(`track-action (nested): recording stopped (${_.cycle})`)));const U={...(0,p.baseFields)(r),type:"tool_call",timestamp:d.startTime??R,tool_name:d.name,tool_type:"mcp",tool_input:d.args,activity_id:A,verification_id:O,trace_id:C,duration:d.duration??null,mcp_server:c,nested:!0,parent_tool_use_id:t.tool_use_id};await(0,p.appendAction)(r,U),s.logger.debug(`track-action (nested): ${d.name}`)}}const h={};if(m)try{const n=(0,L.buildVerificationContextOnceForCycle)({projectDir:o,sessionId:l,sessionDir:i,activeVerificationId:O,config:(0,E.loadConfig)(o)});n.length>0&&(h.additional_context=n)}catch(n){s.logger.debug(`track-action: verification-context injection skipped: ${n instanceof Error?n.message:n}`)}(0,F.writeAndExit)(JSON.stringify(h),0)}g(et,"run");function it(o,t,l){if(!(0,E.isJobQueueEnabled)(o))return;const i={...l};delete i.tool_response;try{(0,f.submit)(o,t,f.SEND_EVENT_TYPE,i)}catch(r){if(r instanceof f.JobTooLargeError){s.logger.debug(`track-action: wire event too large for ${l.tool_name}; dropping`);return}s.logger.debug(`track-action: failed to submit ${l.tool_name}: ${r instanceof Error?r.message:r}`)}}g(it,"submitEvent");function V(o){if(o==null)return 0;try{const t=typeof o=="string"?o:JSON.stringify(o);return t===void 0?0:Buffer.byteLength(t,"utf-8")}catch{return 0}}g(V,"byteSize");0&&(module.exports={run});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var p=(o,t)=>e(o,"name",{value:t,configurable:!0});var I=(o,t)=>{for(var s in t)e(o,s,{get:t[s],enumerable:!0})},_=(o,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of y(t))!C.call(o,n)&&n!==s&&e(o,n,{get:()=>t[n],enumerable:!(i=w(t,n))||i.enumerable});return o};var H=o=>_(e({},"__esModule",{value:!0}),o);var h={};I(h,{run:()=>O});module.exports=H(h);var d=require("../../../hooks/core/verify-gate"),k=require("../../../hooks/core/activity"),a=require("../../../lib/config"),u=require("../../../lib/logger"),l=require("../../../lib/output"),S=require("../../../lib/stdin"),g=require("../../../queue"),f=require("../../../lib/runtime-paths");async function O(o){let t;try{t=JSON.parse((0,S.readStdin)())}catch(v){u.logger.debug(`failed to parse stdin: ${v}`),(0,l.writeAndExit)(JSON.stringify({}),0);return}const s=t.conversation_id??"default";(0,u.setLogFile)((0,f.sessionLogFile)(o,s));const i=(0,f.sessionDir)(o,s),n=`${i}/actions.jsonl`,m=(0,a.loadConfig)(o),r=await(0,d.runVerifyGate)({sessionId:s,sessionDir:i,actionsFile:n,verdictFile:`${i}/verdict.json`,maxRetries:(0,a.getMaxRetries)(m),config:m,projectDir:o}),c={};r.action==="allow"&&await(0,k.endActivity)({sessionDir:i,actionsFile:n}),r.action==="block"&&r.message&&(c.followup_message=r.message),(0,g.flushInBackground)(o,s),(0,g.flushStragglersInBackground)(o,s),(0,l.writeAndExit)(JSON.stringify(c),0)}p(O,"run");0&&(module.exports={run});
|
|
@@ -18,6 +18,7 @@ If the project has android verification enabled (`ironbee android enable` once a
|
|
|
18
18
|
4. **Pick an evidence path** for the changed code:
|
|
19
19
|
- **Device-evidence** (proves the change is visible / functional): drive UI (`MCP:adt_interaction_tap` / `MCP:adt_interaction_input-text` / `MCP:adt_interaction_swipe`) → screenshot (`MCP:adt_content_take-screenshot`) → UI snapshot (`MCP:adt_a11y_take-ui-snapshot`). **STOP and visually analyze the screenshot** — readability, layout, cut-off content, expected state rendered; the snapshot reports structure, the screenshot shows what the user actually sees. Both are MANDATORY on this path.
|
|
20
20
|
- **Log-evidence** (proves the changed code path executed): `MCP:adt_o11y_log-read` or `MCP:adt_o11y_log-follow`. Confirm expected log lines present AND no FATAL/crash from the app package.
|
|
21
|
+
- **Network-evidence** (proves a network/API change behaved correctly): `MCP:adt_o11y_get-http-requests` — forward-looking, so start capture, drive the app to trigger traffic, then read again; confirm the expected request(s)/status. Auxiliary (NOT gate evidence): `MCP:adt_o11y_new-trace-id` pins a correlation root; `MCP:adt_stub_*` mocks/intercepts responses for setup.
|
|
21
22
|
5. **If recording was started, stop it now** — `MCP:adt_content_stop-recording`. submit-verdict rejects with `"recording is still active"` when this step is skipped.
|
|
22
23
|
6. **Submit verdict** — platform-agnostic, just status + checks (+ issues/fixes).
|
|
23
24
|
|
|
@@ -21,8 +21,9 @@ These attach to the **Required steps** above — they don't replace any step. Nu
|
|
|
21
21
|
- **Within step 3 (run flow):** also run the android flow: connect (`MCP:adt_device_connect`) → launch app (`MCP:adt_device_launch-app`) → pick ONE evidence path:
|
|
22
22
|
- **Device-evidence**: drive UI (`MCP:adt_interaction_tap` / `MCP:adt_interaction_input-text` / `MCP:adt_interaction_swipe`) + screenshot (`MCP:adt_content_take-screenshot`) + UI snapshot (`MCP:adt_a11y_take-ui-snapshot`)
|
|
23
23
|
- **Log-evidence**: read Logcat (`MCP:adt_o11y_log-read` or `MCP:adt_o11y_log-follow`) confirming expected output and no crashes
|
|
24
|
+
- **Network-evidence**: capture outgoing HTTP traffic (`MCP:adt_o11y_get-http-requests` — forward-looking: start capture, drive the app, read again) confirming the expected request(s)/status. Auxiliary setup only (NOT evidence): `MCP:adt_o11y_new-trace-id` (pin correlation), `MCP:adt_stub_*` (mock/intercept).
|
|
24
25
|
- If `recording.enable` is on, the gate forces `MCP:adt_content_start-recording` BEFORE the android steps above and rejects the verdict if you don't call `MCP:adt_content_stop-recording` AFTER them. Always pair start/stop around the steps above.
|
|
25
|
-
- **Within step 6 (submit verdict):** submit one platform-agnostic verdict with `status` + `checks` (+ `issues`/`fixes` as needed). Android-cycle pass criteria: device connected AND (UI-interaction + screenshot + UI snapshot taken) OR (Logcat read with no crashes).
|
|
26
|
+
- **Within step 6 (submit verdict):** submit one platform-agnostic verdict with `status` + `checks` (+ `issues`/`fixes` as needed). Android-cycle pass criteria: device connected AND (UI-interaction + screenshot + UI snapshot taken) OR (Logcat read with no crashes) OR (outgoing HTTP traffic captured and confirmed).
|
|
26
27
|
|
|
27
28
|
### Additional BANNED for android cycle
|
|
28
29
|
|
|
@@ -24,6 +24,7 @@ verification, so its script must collect what the android cycle collects). In th
|
|
|
24
24
|
- **Log-evidence path** — `adt_o11y_log-read` / `adt_o11y_log-follow` (with `returnOutput: true`)
|
|
25
25
|
for the tag(s) relevant to the change; confirm expected lines appear AND no FATAL / crash (E/
|
|
26
26
|
entries) for the app package.
|
|
27
|
+
- **Network-evidence path** — capture outgoing HTTP traffic with `adt_o11y_get-http-requests` (`returnOutput: true`): start capture, drive the app (`adt_interaction_*`) to trigger traffic, read again, and put the captured request(s)/status in your result. Optional setup helpers (NOT evidence): `adt_o11y_new-trace-id` to pin a correlation root, `adt_stub_*` to mock/intercept responses.
|
|
27
28
|
|
|
28
29
|
`return` the evidence — UI-snapshot text, log lines, the screenshot `filePath`s — **plus explicit
|
|
29
30
|
pass/fail assertions**. That returned result is what `/ironbee-verify scenario:<name>` reads to judge
|
|
@@ -32,6 +32,9 @@ If you see only `ios/`, `web/`, or no mobile directories — the project does NO
|
|
|
32
32
|
- **Log-evidence path** (device logs confirm the changed code path executed):
|
|
33
33
|
- Read Logcat output for the tag(s) relevant to the changed code: `MCP:adt_o11y_log-read` or `MCP:adt_o11y_log-follow` (drain a follow with `MCP:adt_o11y_log-get-followed`, stop it with `MCP:adt_o11y_log-stop-follow`).
|
|
34
34
|
- Confirm expected log lines appear AND no unexpected crashes (FATAL / E/ entries for the app package).
|
|
35
|
+
- **Network-evidence path** (captured HTTP traffic confirms a network/API-related change):
|
|
36
|
+
- Capture the app's outgoing HTTP(S) requests: `MCP:adt_o11y_get-http-requests` (Frida/OkHttp in-process — no proxy, no CA install; OkHttp-based stacks only — Retrofit / React Native / HttpURLConnection). **Capture is forward-looking**: call it once to start capture, drive the app to trigger traffic (`MCP:adt_interaction_*`), then call it again to read. Confirm the expected request(s) / response status appear.
|
|
37
|
+
- **Auxiliary (NOT evidence — setup/correlation only):** to pin one correlation root across the flow, optionally `MCP:adt_o11y_new-trace-id` first (it stamps `traceparent` on every captured request; inspect/clear via `MCP:adt_o11y_set-trace-context` / `MCP:adt_o11y_get-trace-context`). To set up test conditions, `MCP:adt_stub_mock-http-response` / `MCP:adt_stub_intercept-http-request` mock or mutate responses (list/clear with `MCP:adt_stub_list` / `MCP:adt_stub_clear`). `MCP:adt_figma_compare-screen-with-design` checks emulator-vs-Figma parity (optional, requires `FIGMA_ACCESS_TOKEN`). None of these count toward the gate — they shape the test, they don't inspect it.
|
|
35
38
|
|
|
36
39
|
**Batch (speed):** connect + launch-app run standalone first (prerequisites). On the device-evidence path, batch the UI interactions + the UI snapshot into one `MCP:adt_execute`; the snapshot captures the state after the batched interactions, so to assert an intermediate state take a snapshot at that point too. The device-evidence screenshot is usually pixel-judged (a visual change) — take THAT one standalone with `includeBase64: true` so you can see it; batch it only when it's purely gate evidence. Log-evidence reads batch together too.
|
|
37
40
|
|
|
@@ -51,6 +54,7 @@ On fail, include `issues`. On pass after a previous fail, include `fixes`.
|
|
|
51
54
|
Android-cycle pass criteria:
|
|
52
55
|
- **Device-evidence**: at least one UI interaction tool fired AND a screenshot was taken AND a UI snapshot was taken AND both show the expected UI state/structure.
|
|
53
56
|
- **Log-evidence**: Logcat was read AND the expected log lines are present AND no crash (FATAL / unhandled exception) from the app's package.
|
|
57
|
+
- **Network-evidence**: the app's outgoing HTTP traffic was captured AND the expected request(s) / response status confirm the change behaved correctly.
|
|
54
58
|
|
|
55
59
|
## Multi-cycle (browser + android simultaneously)
|
|
56
60
|
|
package/dist/commands/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var l=(e,o)=>m(e,"name",{value:o,configurable:!0});var L=(e,o)=>{for(var n in o)m(e,n,{get:o[n],enumerable:!0})},M=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of V(o))!q.call(e,i)&&i!==n&&m(e,i,{get:()=>o[i],enumerable:!(r=K(o,i))||r.enumerable});return e};var Y=e=>M(m({},"__esModule",{value:!0}),e);var ie={};L(ie,{configCommand:()=>u,runGet:()=>U,runList:()=>W,runPath:()=>_,runSet:()=>F,runUnset:()=>B});module.exports=Y(ie);var D=require("commander"),g=require("fs"),N=require("os"),d=require("path"),f=require("../clients/registry"),I=require("./install"),b=require("../lib/config"),G=require("../lib/gitignore"),k=require("../lib/logger"),t=require("../lib/output"),h=require("../lib/prompt"),J=require("../lib/projects-registry");const z=new Set(["verification","collector","browser","node","backend","android","browserDevTools","nodeDevTools","backendDevTools","androidDevTools","telemetry","privacy","statusLine","otel","codex"]);function C(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.json")}l(C,"projectConfigPath");function S(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.local.json")}l(S,"projectLocalConfigPath");function O(){return(0,d.join)((0,N.homedir)(),".ironbee","config.json")}l(O,"globalConfigPath");function w(e){if(!(0,g.existsSync)(e))return{};try{const o=(0,g.readFileSync)(e,"utf-8");return o.trim().length===0?{}:JSON.parse(o)}catch(o){throw k.logger.debug(`failed to read ${e}: ${o}`),new Error(`Config at ${e} is not valid JSON: ${o instanceof Error?o.message:o}`)}}l(w,"readConfigFile");function j(e,o){(0,g.mkdirSync)((0,d.join)(e,".."),{recursive:!0}),(0,g.writeFileSync)(e,JSON.stringify(o,null,2)+`
|
|
1
|
+
"use strict";var m=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var l=(e,o)=>m(e,"name",{value:o,configurable:!0});var L=(e,o)=>{for(var n in o)m(e,n,{get:o[n],enumerable:!0})},M=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of V(o))!q.call(e,i)&&i!==n&&m(e,i,{get:()=>o[i],enumerable:!(r=K(o,i))||r.enumerable});return e};var Y=e=>M(m({},"__esModule",{value:!0}),e);var ie={};L(ie,{configCommand:()=>u,runGet:()=>U,runList:()=>W,runPath:()=>_,runSet:()=>F,runUnset:()=>B});module.exports=Y(ie);var D=require("commander"),g=require("fs"),N=require("os"),d=require("path"),f=require("../clients/registry"),I=require("./install"),b=require("../lib/config"),G=require("../lib/gitignore"),k=require("../lib/logger"),t=require("../lib/output"),h=require("../lib/prompt"),J=require("../lib/projects-registry");const z=new Set(["verification","collector","browser","node","backend","android","browserDevTools","nodeDevTools","backendDevTools","androidDevTools","telemetry","privacy","statusLine","otel","codex","runtime"]);function C(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.json")}l(C,"projectConfigPath");function S(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.local.json")}l(S,"projectLocalConfigPath");function O(){return(0,d.join)((0,N.homedir)(),".ironbee","config.json")}l(O,"globalConfigPath");function w(e){if(!(0,g.existsSync)(e))return{};try{const o=(0,g.readFileSync)(e,"utf-8");return o.trim().length===0?{}:JSON.parse(o)}catch(o){throw k.logger.debug(`failed to read ${e}: ${o}`),new Error(`Config at ${e} is not valid JSON: ${o instanceof Error?o.message:o}`)}}l(w,"readConfigFile");function j(e,o){(0,g.mkdirSync)((0,d.join)(e,".."),{recursive:!0}),(0,g.writeFileSync)(e,JSON.stringify(o,null,2)+`
|
|
2
2
|
`)}l(j,"writeConfigFile");function H(e){const o=e.indexOf(".");return o===-1?e:e.slice(0,o)}l(H,"topKey");function $(e){return z.has(H(e))}l($,"affectsArtifacts");function Q(e,o){if(o.length===0)return e;const n=o.split(".");let r=e;for(const i of n){if(r==null||typeof r!="object"||Array.isArray(r))return;r=r[i]}return r}l(Q,"getAtPath");function X(e,o,n){if(o.length===0)throw new Error("Cannot set the root config \u2014 pass a dotted key (e.g. `collector.url`).");const r=o.split(".");let i=e;for(let a=0;a<r.length-1;a++){const s=r[a],c=i[s];(c==null||typeof c!="object"||Array.isArray(c))&&(i[s]={}),i=i[s]}i[r[r.length-1]]=n}l(X,"setAtPath");function Z(e,o){if(o.length===0)return!1;const n=o.split(".");let r=e;for(let a=0;a<n.length-1;a++){const s=n[a],c=r[s];if(c==null||typeof c!="object"||Array.isArray(c))return!1;r=c}const i=n[n.length-1];return Object.prototype.hasOwnProperty.call(r,i)?(delete r[i],!0):!1}l(Z,"unsetAtPath");function ee(e,o){if(o)try{return JSON.parse(e)}catch(n){throw new Error(`--json was set but value is not valid JSON: ${n instanceof Error?n.message:n}`)}try{return JSON.parse(e)}catch{return e}}l(ee,"parseValue");function v(e){if(e.global===!0&&e.local===!0)throw new Error("Pass at most one of --global / --local.");if(e.global===!0)return{path:O(),label:"global",useGlobal:!0};const o=e.projectDir??process.cwd();return e.local===!0?{path:S(o),label:"local",useGlobal:!1}:{path:C(o),label:"project",useGlobal:!1}}l(v,"resolveWriteTarget");function A(e){if((e.global===!0?1:0)+(e.project===!0?1:0)+(e.local===!0?1:0)>1)throw new Error("Pass at most one of --global / --project / --local.");if(e.global===!0)return{label:"global",path:O()};const n=e.projectDir??process.cwd();return e.project===!0?{label:"project",path:C(n)}:e.local===!0?{label:"local",path:S(n)}:{label:"merged",path:n}}l(A,"resolveReadTarget");function P(e){return e.label==="merged"?(0,b.loadConfig)(e.path):w(e.path)}l(P,"readForGet");function oe(e){return e===void 0?"(unset)":typeof e=="string"?e:JSON.stringify(e,null,2)}l(oe,"formatValue");function ne(e,o){const n=(0,f.detectClients)(e);if(o===void 0&&n.length===0)return console.log(` ${t.pc.dim("\xB7")} ${t.pc.dim("no clients detected in")} ${t.pc.dim(e)} ${t.pc.dim("\u2014 skipping artifact rerender")}`),[];const r=(0,b.loadConfig)(e),i=(0,f.resolveTargetClients)(e,o);for(const a of i)a.install(e,r);return(0,G.ensureIronBeeGitignored)(e),i.map(a=>a.name)}l(ne,"rerenderArtifacts");function E(e,o,n,r){const i=(0,g.existsSync)(e)?(0,g.readFileSync)(e,"utf-8"):null;j(e,o);try{return ne(n,r)}catch(a){try{i===null?(0,g.existsSync)(e)&&(0,g.unlinkSync)(e):(0,g.writeFileSync)(e,i)}catch(s){k.logger.debug(`config rollback failed: ${s}`)}throw a}}l(E,"writeAndRerender");const R=10;function te(e){const o=(0,f.listActiveProjects)(),n=(0,J.canonicalizePath)(e);return o.filter(r=>r.path!==n)}l(te,"listOtherProjects");function re(e){const o=e.length===1?"other project":"other projects";console.log(` ${t.pc.yellow("\u26A0")} ${t.pc.bold(String(e.length))} ${o} registered in the inventory still on the prior state:`);const n=e.slice(0,R);for(const r of n)console.log(` ${t.pc.dim("\xB7")} ${t.pc.dim(r.path)}`);e.length>R&&console.log(` ${t.pc.dim("\u2026and")} ${t.pc.bold(String(e.length-R))} ${t.pc.dim("more")}`)}l(re,"printOtherProjectsBanner");async function T(e,o,n){if(!o)return;const r=te(e);if(r.length===0)return;re(r);let i;if(n===!0)i=!0;else if(n===!1){console.log(` ${t.pc.dim("Run")} ${t.pc.cyan("ironbee install --all")} ${t.pc.dim("later to apply, or")} ${t.pc.cyan("ironbee install")} ${t.pc.dim("in selected projects.")}`);return}else if((0,h.isInteractive)()){const a=r.length===1?"this project":`these ${r.length} projects`;i=await(0,h.promptYesNo)(` Apply this change to ${a} now?`,!0)}else{console.log(` ${t.pc.dim("Run")} ${t.pc.cyan("ironbee install --all")} ${t.pc.dim("to apply everywhere, or pass")} ${t.pc.cyan("--apply-all")} ${t.pc.dim("to skip this prompt.")}`);return}if(!i){console.log(` ${t.pc.dim("Skipped. Run")} ${t.pc.cyan("ironbee install --all")} ${t.pc.dim("later to apply.")}`);return}console.log(),await(0,I.runInstallAll)({})}l(T,"maybeApplyToOtherProjects");async function F(e,o,n){if(e.length===0)throw new Error("Key is required (dotted path, e.g. `collector.url`).");const r=v(n),i=ee(o,n.json===!0),a=w(r.path),s=JSON.parse(JSON.stringify(a));X(s,e,i);const c=n.projectDir??process.cwd(),p=n.rerender!==!1&&$(e);let y=[];p?y=E(r.path,s,c,n.client):j(r.path,s),console.log(`${t.pc.green("\u2713")} Set ${t.pc.cyan(e)} = ${t.pc.bold(oe(i))} in ${r.label} config (${t.pc.dim(r.path)}).`),p?y.length>0&&(console.log(` ${t.pc.dim("Re-rendered artifacts for:")} ${t.pc.bold(y.join(", "))}`),console.log(` ${t.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)):n.rerender===!1&&$(e)&&console.log(` ${t.pc.yellow("\u26A0")} --no-rerender set: artifacts may now be out of sync with config. Run ${t.pc.cyan("ironbee install")} to resync.`),x(e),r.useGlobal&&await T(c,p,n.applyAll)}l(F,"runSet");function x(e){const o=(0,b.findActiveEnvOverride)(e);o!==void 0&&console.log(` ${t.pc.yellow("\u26A0")} ${t.pc.cyan(o.envVar)} is set in this shell \u2014 env overrides file config, so ${t.pc.cyan(e)} reads will return the env value until ${t.pc.cyan(o.envVar)} is unset.`)}l(x,"warnIfEnvShadowed");async function B(e,o){if(e.length===0)throw new Error("Key is required (dotted path, e.g. `collector.url`).");const n=v(o),r=w(n.path),i=JSON.parse(JSON.stringify(r));if(!Z(i,e)){console.log(`${t.pc.dim("\xB7")} ${t.pc.cyan(e)} not present in ${n.label} config (${t.pc.dim(n.path)}). No-op.`);return}const s=o.projectDir??process.cwd(),c=o.rerender!==!1&&$(e);let p=[];c?p=E(n.path,i,s,o.client):j(n.path,i),console.log(`${t.pc.green("\u2713")} Unset ${t.pc.cyan(e)} in ${n.label} config (${t.pc.dim(n.path)}).`),c&&p.length>0&&(console.log(` ${t.pc.dim("Re-rendered artifacts for:")} ${t.pc.bold(p.join(", "))}`),console.log(` ${t.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)),x(e),n.useGlobal&&await T(s,c,o.applyAll)}l(B,"runUnset");function U(e,o){const n=A(o),r=P(n),i=Q(r,e);i===void 0&&(console.error(`${t.pc.dim("\xB7")} ${t.pc.cyan(e)} ${t.pc.dim("not set in")} ${n.label} ${t.pc.dim("config")}`),process.exit(1)),console.log(typeof i=="string"?i:JSON.stringify(i,null,2))}l(U,"runGet");function W(e){const o=A(e),n=P(o);console.log(JSON.stringify(n,null,2))}l(W,"runList");function _(e){const o=v(e);console.log(o.path)}l(_,"runPath");const u=new D.Command("config").description("Read or write IronBee configuration values (project or global). Smart re-render: artifact-affecting keys auto-update installed client files.");u.command("get <key>").description("Print the value at a dotted path. Default: merged effective value (global + project + local). --global / --project / --local narrow to one source.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Read from global config only (~/.ironbee/config.json).").option("--project","Read from project config only (<project>/.ironbee/config.json).").option("--local","Read from project-local config only (<project>/.ironbee/config.local.json \u2014 gitignored).").action((e,o)=>{try{U(e,o)}catch(n){console.error(`${t.pc.red("\u2717")} ${n instanceof Error?n.message:n}`),process.exit(1)}}),u.command("set <key> <value>").description("Set a config value. Type-coerces (true/42/[\u2026]/{\u2026}) unless --json forces strict parsing. Re-renders client artifacts when the top-level key affects them. After a global write (`-g`) on an artifact-affecting key, prompts whether to apply the change to every other registered project. Use --local to write to the gitignored personal-override layer instead of the committed project config.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Write to global config (~/.ironbee/config.json).").option("--local","Write to the gitignored project-local override (<project>/.ironbee/config.local.json) instead of the committed project config. Mutually exclusive with --global.").option("--client <name>",`Filter clients for artifact rerender (${(0,f.clientNames)()}), or "all". Default: detected clients.`).option("--no-rerender","Skip artifact rerender even when the key normally triggers it.").option("--json","Require value to parse as strict JSON (no string fallback).").option("--apply-all","After a global write on an artifact-affecting key, apply the change to every registered project without prompting.").option("--no-apply-all","After a global write on an artifact-affecting key, do NOT apply to other registered projects (suppress the prompt).").action(async(e,o,n)=>{try{await F(e,o,n)}catch(r){console.error(`${t.pc.red("\u2717")} ${r instanceof Error?r.message:r}`),process.exit(1)}}),u.command("unset <key>").description("Remove a config key. Idempotent \u2014 no-op when the key is absent. Re-renders client artifacts when the top-level key affects them. After a global unset (`-g`) on an artifact-affecting key, prompts whether to apply the change to every other registered project. Use --local to remove from the gitignored personal-override layer instead of the committed project config.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Write to global config (~/.ironbee/config.json).").option("--local","Write to the gitignored project-local override (<project>/.ironbee/config.local.json) instead of the committed project config. Mutually exclusive with --global.").option("--client <name>",`Filter clients for artifact rerender (${(0,f.clientNames)()}), or "all". Default: detected clients.`).option("--no-rerender","Skip artifact rerender even when the key normally triggers it.").option("--apply-all","After a global unset on an artifact-affecting key, apply the change to every registered project without prompting.").option("--no-apply-all","After a global unset on an artifact-affecting key, do NOT apply to other registered projects (suppress the prompt).").action(async(e,o)=>{try{await B(e,o)}catch(n){console.error(`${t.pc.red("\u2717")} ${n instanceof Error?n.message:n}`),process.exit(1)}}),u.command("list").description("Print the entire config. Default: merged effective config; --global / --project / --local narrow to one source.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Read from global config only.").option("--project","Read from project config only.").option("--local","Read from project-local config only (<project>/.ironbee/config.local.json \u2014 gitignored).").action(e=>{try{W(e)}catch(o){console.error(`${t.pc.red("\u2717")} ${o instanceof Error?o.message:o}`),process.exit(1)}}),u.command("path").description("Print the on-disk path of the targeted config file (project by default; --global for global, --local for the gitignored personal-override layer).").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Print global config path (~/.ironbee/config.json).").option("--local","Print project-local config path (<project>/.ironbee/config.local.json).").action(e=>{try{_(e)}catch(o){console.error(`${t.pc.red("\u2717")} ${o instanceof Error?o.message:o}`),process.exit(1)}});0&&(module.exports={configCommand,runGet,runList,runPath,runSet,runUnset});
|