@automaton-labs/aib 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/commands/help-command.js +7 -3
  2. package/dist/commands/session-workspace.js +4 -4
  3. package/dist/config/workspace-root.js +3 -3
  4. package/dist/help/bootstrap.md +88 -84
  5. package/dist/help/docs/config-setup.aliases.md +56 -0
  6. package/dist/help/docs/config-setup.excludes.md +45 -0
  7. package/dist/help/docs/config-setup.import-normalize.md +86 -0
  8. package/dist/help/docs/config-setup.import-rules.md +96 -0
  9. package/dist/help/docs/config-setup.tsconfigs.md +33 -0
  10. package/dist/help/docs/first-setup.md +63 -48
  11. package/dist/help/docs/help-protocol.md +26 -0
  12. package/dist/help/docs/inspect.cycles.md +38 -0
  13. package/dist/help/docs/inspect.md +1 -0
  14. package/dist/help/docs/modulePlan.md +3 -0
  15. package/dist/help/docs/move.md +3 -0
  16. package/dist/help/docs/mutation.md +3 -0
  17. package/dist/help/docs/patterns.md +7 -118
  18. package/dist/help/docs/qr.md +6 -2
  19. package/dist/help/docs/quick-map.md +30 -0
  20. package/dist/help/docs/reveal.md +30 -0
  21. package/dist/help/dsl/bootstrap.md +88 -84
  22. package/dist/help/dsl/docs/config-setup.aliases.md +56 -0
  23. package/dist/help/dsl/docs/config-setup.excludes.md +45 -0
  24. package/dist/help/dsl/docs/config-setup.import-normalize.md +86 -0
  25. package/dist/help/dsl/docs/config-setup.import-rules.md +96 -0
  26. package/dist/help/dsl/docs/config-setup.tsconfigs.md +33 -0
  27. package/dist/help/dsl/docs/first-setup.md +63 -48
  28. package/dist/help/dsl/docs/help-protocol.md +26 -0
  29. package/dist/help/dsl/docs/inspect.cycles.md +38 -0
  30. package/dist/help/dsl/docs/inspect.md +1 -0
  31. package/dist/help/dsl/docs/modulePlan.md +3 -0
  32. package/dist/help/dsl/docs/move.md +3 -0
  33. package/dist/help/dsl/docs/mutation.md +3 -0
  34. package/dist/help/dsl/docs/patterns.md +7 -118
  35. package/dist/help/dsl/docs/qr.md +6 -2
  36. package/dist/help/dsl/docs/quick-map.md +30 -0
  37. package/dist/help/dsl/docs/reveal.md +30 -0
  38. package/dist/help/dsl/full.md +88 -84
  39. package/dist/help/dsl/topics/config-setup.aliases.md +54 -0
  40. package/dist/help/dsl/topics/config-setup.excludes.md +43 -0
  41. package/dist/help/dsl/topics/config-setup.import-normalize.md +84 -0
  42. package/dist/help/dsl/topics/config-setup.import-rules.md +94 -0
  43. package/dist/help/dsl/topics/config-setup.tsconfigs.md +31 -0
  44. package/dist/help/dsl/topics/first-setup.md +63 -48
  45. package/dist/help/dsl/topics/help-protocol.md +24 -0
  46. package/dist/help/dsl/topics/inspect.cycles.md +36 -0
  47. package/dist/help/dsl/topics/inspect.md +1 -0
  48. package/dist/help/dsl/topics/modulePlan.md +3 -0
  49. package/dist/help/dsl/topics/move.md +3 -0
  50. package/dist/help/dsl/topics/mutation.md +3 -0
  51. package/dist/help/dsl/topics/patterns.md +7 -118
  52. package/dist/help/dsl/topics/qr.md +6 -2
  53. package/dist/help/dsl/topics/quick-map.md +28 -0
  54. package/dist/help/dsl/topics/reveal.md +28 -0
  55. package/dist/help/full.md +88 -84
  56. package/dist/help/help-meta.json +53 -17
  57. package/dist/help/index.md +54 -0
  58. package/dist/help/json/bootstrap.md +88 -84
  59. package/dist/help/json/docs/config-setup.aliases.md +56 -0
  60. package/dist/help/json/docs/config-setup.excludes.md +45 -0
  61. package/dist/help/json/docs/config-setup.import-normalize.md +86 -0
  62. package/dist/help/json/docs/config-setup.import-rules.md +96 -0
  63. package/dist/help/json/docs/config-setup.tsconfigs.md +33 -0
  64. package/dist/help/json/docs/first-setup.md +63 -48
  65. package/dist/help/json/docs/help-protocol.md +26 -0
  66. package/dist/help/json/docs/inspect.cycles.md +38 -0
  67. package/dist/help/json/docs/inspect.md +1 -0
  68. package/dist/help/json/docs/modulePlan.md +3 -0
  69. package/dist/help/json/docs/move.md +3 -0
  70. package/dist/help/json/docs/mutation.md +3 -0
  71. package/dist/help/json/docs/patterns.md +7 -118
  72. package/dist/help/json/docs/qr.md +6 -2
  73. package/dist/help/json/docs/quick-map.md +30 -0
  74. package/dist/help/json/docs/reveal.md +30 -0
  75. package/dist/help/json/full.md +88 -84
  76. package/dist/help/json/topics/config-setup.aliases.md +54 -0
  77. package/dist/help/json/topics/config-setup.excludes.md +43 -0
  78. package/dist/help/json/topics/config-setup.import-normalize.md +84 -0
  79. package/dist/help/json/topics/config-setup.import-rules.md +94 -0
  80. package/dist/help/json/topics/config-setup.tsconfigs.md +31 -0
  81. package/dist/help/json/topics/first-setup.md +63 -48
  82. package/dist/help/json/topics/help-protocol.md +24 -0
  83. package/dist/help/json/topics/inspect.cycles.md +36 -0
  84. package/dist/help/json/topics/inspect.md +1 -0
  85. package/dist/help/json/topics/modulePlan.md +3 -0
  86. package/dist/help/json/topics/move.md +3 -0
  87. package/dist/help/json/topics/mutation.md +3 -0
  88. package/dist/help/json/topics/patterns.md +7 -118
  89. package/dist/help/json/topics/qr.md +6 -2
  90. package/dist/help/json/topics/quick-map.md +28 -0
  91. package/dist/help/json/topics/reveal.md +28 -0
  92. package/dist/help/topics/config-setup.aliases.md +54 -0
  93. package/dist/help/topics/config-setup.excludes.md +43 -0
  94. package/dist/help/topics/config-setup.import-normalize.md +84 -0
  95. package/dist/help/topics/config-setup.import-rules.md +94 -0
  96. package/dist/help/topics/config-setup.tsconfigs.md +31 -0
  97. package/dist/help/topics/first-setup.md +63 -48
  98. package/dist/help/topics/help-protocol.md +24 -0
  99. package/dist/help/topics/inspect.cycles.md +36 -0
  100. package/dist/help/topics/inspect.md +1 -0
  101. package/dist/help/topics/modulePlan.md +3 -0
  102. package/dist/help/topics/move.md +3 -0
  103. package/dist/help/topics/mutation.md +3 -0
  104. package/dist/help/topics/patterns.md +7 -118
  105. package/dist/help/topics/qr.md +6 -2
  106. package/dist/help/topics/quick-map.md +28 -0
  107. package/dist/help/topics/reveal.md +28 -0
  108. package/dist/session/server.js +3 -3
  109. package/dist/shared/diagnostic-catalog.js +1 -1
  110. package/dist/shared/errors.js +6 -5
  111. package/extension/vscode-refactor-bridge-extension.vsix +0 -0
  112. package/package.json +1 -1
  113. package/runtimes/launcher/win-x64/aib.exe +0 -0
@@ -1,3 +1,7 @@
1
- "use strict";var m=exports&&exports.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),g=exports&&exports.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),u=exports&&exports.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&m(n,e,i[s]);return g(n,e),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.runHelpCommand=v,exports.resolveHelpRoot=l;const r=u(require("node:fs")),c=u(require("node:path")),a=require("../content/content-bundle"),p=require("../shared/agent-text"),y=require("../shared/errors"),_=new Map([["inspect file","inspect.file"],["inspect imports","inspect.imports"],["inspect exports","inspect.exports"],["inspect members","inspect.members"],["inspect code","inspect.code"],["inspect deps","inspect.deps"],["inspect dependencies","inspect.deps"],["inspect usages","inspect.usages"],["inspect usage","inspect.usages"],["inspect graph","inspect.graph"],["inspect tree","inspect.tree"],["inspect duplicates","inspect.duplicates"],["inspect duplicate","inspect.duplicates"],["refactor batch","refactor.batch"],["module plan","modulePlan"],["moduleplan","modulePlan"]]),d=["help-format","basics","dsl","patterns","session","prefs","selectors","inspect","inspect file","inspect imports","inspect exports","inspect members","inspect code","inspect deps","inspect usages","inspect graph","inspect tree","inspect duplicates","mutation","imports normalize","rename","move","modulePlan","refactor batch","view","qr"];function v(t){if(O(t))return C();const e=j(t);if(!e)return H();const n=l(),i=c.join(n.dir,e.file);if(!r.existsSync(i))throw new y.CliError("HELP_TOPIC_NOT_FOUND",`Help topic not found: ${e.id}`,{topic:e.id,helpRoot:n.dir,available:d});const s=r.readFileSync(i,"utf8").trim();return(0,p.attachAgentText)({operation:"help",topic:e.id,source:n.source},s)}function O(t){const e=t.filter(n=>n!=="help");return e.length===1&&e[0]==="status"}function H(){const t=["Start here if this is your first AIB pass:","aib help bootstrap","","Help conventions:","aib help help-format","","Recommended after context compaction:","aib help basics","aib help patterns","","Use focused help when you only need one area:","aib help session","aib help prefs","aib help selectors","aib help dsl","aib help inspect","aib help mutation","","Feature help:","aib help inspect file","aib help inspect imports","aib help inspect exports","aib help inspect members","aib help inspect code","aib help inspect deps","aib help inspect usages","aib help inspect graph","aib help inspect tree","aib help inspect duplicates","aib help imports normalize","aib help rename","aib help move","aib help modulePlan","aib help refactor batch","aib help view","aib help qr"].join(`
2
- `);return(0,p.attachAgentText)({operation:"help",topic:"index",available:d},t)}function j(t){const e=t.filter(s=>s!=="help");if(e.length===0)return null;if(e.includes("--full"))return{id:"full",file:"full.md"};const n=e.filter(s=>!s.startsWith("--")).join(" ").trim();if(!n)return null;if(n==="bootstrap")return{id:"bootstrap",file:"bootstrap.md"};const i=_.get(n.toLowerCase())??n.replace(/\s+/g,".");return{id:i,file:c.join("topics",`${i}.md`)}}function C(){const t=l(),e=S(t.dir),n=(0,a.collectContentCandidates)(),i=e&&f(e.topics)?Object.keys(e.topics).length:$(t.dir),s=typeof e?.contentHash=="string"?e.contentHash:void 0,h=["aib help status","",`source: ${t.source}`,`path: ${t.dir}`,`assets: ${(0,a.directoryHasHelp)(t.dir)?"ok":"missing"}`,`metadata: ${e?"ok":"missing help-meta.json"}`,...typeof e?.helpVersion=="string"?[`version: ${e.helpVersion}`]:[],...typeof e?.generatedAt=="string"?[`generatedAt: ${e.generatedAt}`]:[],...typeof e?.sourceCommit=="string"?[`sourceCommit: ${e.sourceCommit}`]:[],...s?[`contentHash: ${P(s)}`]:[],`topics: ${i}`,"","checked:",...n.map(o=>{const b=o.valid?"ok":`skip (${o.reason??"invalid"})`;return`${o.source}: ${b} ${o.dir}`})].join(`
3
- `);return(0,p.attachAgentText)({operation:"help.status",source:t.source,path:t.dir,assetsOk:(0,a.directoryHasHelp)(t.dir),metadataOk:e!==null,topicCount:i,meta:e??null,candidates:n},h)}function l(){return(0,a.resolveContentRoot)()}function S(t){const e=c.join(t,"help-meta.json");if(!r.existsSync(e))return null;try{const n=JSON.parse(r.readFileSync(e,"utf8"));return f(n)?n:null}catch{return null}}function $(t){const e=c.join(t,"topics");return r.existsSync(e)?r.readdirSync(e).filter(n=>n.endsWith(".md")).length:0}function P(t){return t.replace(/^sha256:/,"sha256:").slice(0,19)}function f(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}
1
+ "use strict";var w=exports&&exports.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(t,n);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,s)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),v=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),m=exports&&exports.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var i=e(t),s=0;s<i.length;s++)i[s]!=="default"&&w(n,t,i[s]);return v(n,t),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.runHelpCommand=_,exports.resolveHelpRoot=d;const c=m(require("node:fs")),o=m(require("node:path")),p=require("../content/content-bundle"),u=require("../shared/agent-text"),j=require("../shared/errors"),h=new Map([["inspect file","inspect.file"],["inspect imports","inspect.imports"],["inspect exports","inspect.exports"],["inspect members","inspect.members"],["inspect code","inspect.code"],["inspect deps","inspect.deps"],["inspect dependencies","inspect.deps"],["inspect usages","inspect.usages"],["inspect usage","inspect.usages"],["inspect graph","inspect.graph"],["inspect tree","inspect.tree"],["inspect duplicates","inspect.duplicates"],["inspect duplicate","inspect.duplicates"],["inspect cycles","inspect.cycles"],["inspect cycle","inspect.cycles"],["refactor batch","refactor.batch"],["module plan","modulePlan"],["moduleplan","modulePlan"]]),g=["help-protocol","quick-map","help-format","basics","dsl","patterns","config-setup.aliases","config-setup.excludes","config-setup.import-normalize","config-setup.import-rules","config-setup.tsconfigs","session","prefs","selectors","inspect","inspect.file","inspect.imports","inspect.exports","inspect.members","inspect.code","inspect.deps","inspect.usages","inspect.graph","inspect.tree","inspect.duplicates","inspect.cycles","mutation","imports.normalize","rename","move","modulePlan","refactor.batch","view","qr","reveal"];function _(e){if(O(e))return C();const t=$(e);if(t.length===0)return f();const n=d(),i=H(t,n);if(i.targets.length===0&&i.unknown.length===0)return f();const s=i.targets.map(r=>{const a=o.join(n.dir,r.file);return c.existsSync(a)?{target:r,text:c.readFileSync(a,"utf8").trim()}:null}).filter(r=>r!==null);if(s.length===1&&i.unknown.length===0){const r=s[0];return r?(0,u.attachAgentText)({operation:"help",topic:r.target.id,source:n.source},r.text):f()}const l=[...s.map(r=>`// ${r.target.id}
2
+ ${r.text}`),...i.unknown.length>0?[["Unknown help topics:",...i.unknown].join(`
3
+ `)]:[]].join(`
4
+
5
+ `);if(i.unknown.length>0)throw new j.CliError("HELP_TOPIC_NOT_FOUND",l,{topics:s.map(r=>r.target.id),unknown:i.unknown,helpRoot:n.dir,available:g});return(0,u.attachAgentText)({operation:"help",topics:s.map(r=>r.target.id),source:n.source},l)}function O(e){const t=e.filter(n=>n!=="help");return t.length===1&&t[0]==="status"}function f(){const e=["Run as: aib help <topic...>","","Start here if this is your first AIB pass:"," bootstrap","","Always after context compaction:"," aib help help-protocol quick-map"," aib config aliases","","Help conventions:"," help-format","","Refresh workflow model:"," basics patterns","","Core focused topics:"," session"," prefs"," selectors"," dsl"," inspect"," mutation","","Feature topics:"," inspect.file"," inspect.imports"," inspect.exports"," inspect.members"," inspect.code"," inspect.deps"," inspect.usages"," inspect.graph"," inspect.tree"," inspect.duplicates"," inspect.cycles"," rename"," move"," modulePlan"," refactor.batch"," imports.normalize"," view"," qr"," reveal"].join(`
6
+ `);return(0,u.attachAgentText)({operation:"help",topic:"index",available:g},e)}function $(e){return e.filter(t=>t!=="help")}function H(e,t){if(e.length===0)return{targets:[],unknown:[]};if(e.includes("--full"))return{targets:[{id:"full",input:"--full",file:"full.md"}],unknown:[]};const n=S(e,t);if(n)return{targets:[n],unknown:[]};const i=[],s=[];for(const l of e.filter(r=>!r.startsWith("--"))){const r=l.trim(),a=x(r,t);if(a){i.push(a);continue}s.push(r)}return{targets:i,unknown:s}}function S(e,t){const n=e.join(" ").trim();if(!n)return null;if(n==="bootstrap")return{id:"bootstrap",input:n,file:"bootstrap.md"};const i=h.get(n.toLowerCase());if(i)return{id:i,input:n,file:o.join("topics",`${i}.md`)};const s=n.replace(/\s+/g,".");return b(t,s)?{id:s,input:n,file:o.join("topics",`${s}.md`)}:null}function x(e,t){if(!e)return null;if(e==="bootstrap")return{id:"bootstrap",input:e,file:"bootstrap.md"};if(e==="full")return{id:"full",input:e,file:"full.md"};const n=h.get(e.toLowerCase());if(n)return{id:n,input:e,file:o.join("topics",`${n}.md`)};if(b(t,e))return{id:e,input:e,file:o.join("topics",`${e}.md`)};const i=T(t,e);return i?{id:i,input:e,file:o.join("topics",`${i}.md`)}:null}function C(){const e=d(),t=k(e.dir),n=(0,p.collectContentCandidates)(),i=t&&y(t.topics)?Object.keys(t.topics).length:P(e.dir),s=typeof t?.contentHash=="string"?t.contentHash:void 0,l=["aib help status","",`source: ${e.source}`,`path: ${e.dir}`,`assets: ${(0,p.directoryHasHelp)(e.dir)?"ok":"missing"}`,`metadata: ${t?"ok":"missing help-meta.json"}`,...typeof t?.helpVersion=="string"?[`version: ${t.helpVersion}`]:[],...typeof t?.generatedAt=="string"?[`generatedAt: ${t.generatedAt}`]:[],...typeof t?.sourceCommit=="string"?[`sourceCommit: ${t.sourceCommit}`]:[],...s?[`contentHash: ${q(s)}`]:[],`topics: ${i}`,"","checked:",...n.map(r=>{const a=r.valid?"ok":`skip (${r.reason??"invalid"})`;return`${r.source}: ${a} ${r.dir}`})].join(`
7
+ `);return(0,u.attachAgentText)({operation:"help.status",source:e.source,path:e.dir,assetsOk:(0,p.directoryHasHelp)(e.dir),metadataOk:t!==null,topicCount:i,meta:t??null,candidates:n},l)}function d(){return(0,p.resolveContentRoot)()}function k(e){const t=o.join(e,"help-meta.json");if(!c.existsSync(t))return null;try{const n=JSON.parse(c.readFileSync(t,"utf8"));return y(n)?n:null}catch{return null}}function P(e){const t=o.join(e,"topics");return c.existsSync(t)?c.readdirSync(t).filter(n=>n.endsWith(".md")).length:0}function b(e,t){return c.existsSync(o.join(e.dir,"topics",`${t}.md`))}function T(e,t){const n=A(e.dir),i=t.toLowerCase(),s=n.filter(l=>{const r=l.toLowerCase();return r.endsWith(`.${i}`)||r===i});return s.length===1?s[0]??null:null}function A(e){const t=o.join(e,"topics");return c.existsSync(t)?c.readdirSync(t).filter(n=>n.endsWith(".md")).map(n=>n.replace(/\.md$/,"")).sort():[]}function q(e){return e.replace(/^sha256:/,"sha256:").slice(0,19)}function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}
@@ -1,4 +1,4 @@
1
- "use strict";var De=exports&&exports.__createBinding||(Object.create?(function(e,t,n,s){s===void 0&&(s=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,i)}):(function(e,t,n,s){s===void 0&&(s=n),e[s]=t[n]})),$e=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ie=exports&&exports.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var s=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[s.length]=i);return s},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var s=e(t),i=0;i<s.length;i++)s[i]!=="default"&&De(n,t,s[i]);return $e(n,t),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.isSessionHandle=M,exports.runWithSessionOverride=Ue,exports.runSessionWorkspaceCommand=Fe,exports.resolveSessionFileArgument=B,exports.saveSessionOutputJson=qe,exports.saveSessionOutputText=et,exports.saveSessionResultJson=tt,exports.saveSessionResultViewJson=nt,exports.readSessionResultViewJson=st,exports.readSessionResultJson=it,exports.captureSessionInputJson=rt,exports.captureSessionInput=ae,exports.sessionWorkspaceExists=ot,exports.useSessionGuidance=ue,exports.readSessionBooleanPref=at,exports.readSessionNumberPref=ut,exports.readSessionStringPref=ct,exports.readEffectiveSessionPathAliases=lt,exports.readSessionPathAliasOverrides=ft,exports.tryResolveCurrentSessionId=Ut;const l=ie(require("node:fs")),c=ie(require("node:path")),xe=require("node:async_hooks"),E=require("../config/env-vars"),N=require("../config/workspace-root"),b=require("../config/path-aliases"),m=require("../shared/agent-text"),u=require("../shared/errors"),je=c.join(".tmp","aib"),U="sessionDir",Ce="session.json",we="active.json",Re="aib:",Le="s_",Pe="last",Te="_last.json",F=new xe.AsyncLocalStorage,ke=["graph","inspect","code","slice","members","exports","deps","usages","duplicates","execution","rename","move","refactor","modulePlan","imports"],We=["inspect","graph","rename","move","refactor","modulePlan","imports","generic"],O={"guidance.nextLimit":{type:"number",default:2,min:0,max:100,hidden:!0},"diagnostics.hintLimit":{type:"number",default:2,min:0,max:100,hidden:!0},"inspect.code.show":{type:"boolean",default:!0,hidden:!0},"inspect.code.maxNonEmptyLines":{type:"number",default:120,min:1,max:1e4},"inspect.code.meta":{type:"boolean",default:!0,hidden:!0},"inspect.members.maxItems":{type:"number",default:20,min:1,max:1e3},"inspect.members.all":{type:"boolean",default:!1,hidden:!0},"inspect.exports.ranges":{type:"boolean",default:!1,hidden:!0},"inspect.exports.resolveStar":{type:"boolean",default:!1,hidden:!0},"inspect.graph.hubs":{type:"boolean",default:!0},"inspect.graph.entrypoints":{type:"boolean",default:!0},"inspect.graph.leaves":{type:"boolean",default:!0},"inspect.graph.edges":{type:"boolean",default:!0},"inspect.graph.symbols":{type:"boolean",default:!1,hidden:!0},"inspect.graph.symbolUsage":{type:"boolean",default:!1},"inspect.usages.detail":{type:"string",default:"locations",values:["summary","locations","code"],hidden:!0},"inspect.usages.maxLocations":{type:"number",default:12,min:1,max:1e4},"inspect.usages.maxCodeBlocks":{type:"number",default:8,min:1,max:1e4},"inspect.usages.excludeTarget":{type:"boolean",default:!1,hidden:!0}};function M(e){return e.startsWith(Re)}function Ue(e,t){return e?F.run(e,t):t()}function Fe(e,t,n){const s=t[0]??"status",i=(0,N.resolveWorkspaceRoot)(e);if(!i){if(s==="status")return(0,m.attachAgentText)({initialized:!1,active:null,source:"none",available:[],next:"Run aib init"},["session not ready","","No aib.json was found.","Run:","aib init"].join(`
1
+ "use strict";var De=exports&&exports.__createBinding||(Object.create?(function(e,t,n,s){s===void 0&&(s=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,i)}):(function(e,t,n,s){s===void 0&&(s=n),e[s]=t[n]})),$e=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ie=exports&&exports.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var s=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[s.length]=i);return s},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var s=e(t),i=0;i<s.length;i++)s[i]!=="default"&&De(n,t,s[i]);return $e(n,t),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.isSessionHandle=M,exports.runWithSessionOverride=Ue,exports.runSessionWorkspaceCommand=Fe,exports.resolveSessionFileArgument=B,exports.saveSessionOutputJson=qe,exports.saveSessionOutputText=et,exports.saveSessionResultJson=tt,exports.saveSessionResultViewJson=nt,exports.readSessionResultViewJson=st,exports.readSessionResultJson=it,exports.captureSessionInputJson=rt,exports.captureSessionInput=ae,exports.sessionWorkspaceExists=ot,exports.useSessionGuidance=ue,exports.readSessionBooleanPref=at,exports.readSessionNumberPref=ut,exports.readSessionStringPref=ct,exports.readEffectiveSessionPathAliases=lt,exports.readSessionPathAliasOverrides=ft,exports.tryResolveCurrentSessionId=Ut;const l=ie(require("node:fs")),c=ie(require("node:path")),xe=require("node:async_hooks"),E=require("../config/env-vars"),N=require("../config/workspace-root"),b=require("../config/path-aliases"),m=require("../shared/agent-text"),u=require("../shared/errors"),je=c.join(".tmp","aib"),U="sessionDir",Ce="session.json",we="active.json",Re="aib:",Le="s_",Pe="last",Te="_last.json",F=new xe.AsyncLocalStorage,ke=["graph","inspect","code","slice","members","exports","deps","usages","duplicates","execution","rename","move","refactor","modulePlan","imports"],We=["inspect","graph","rename","move","refactor","modulePlan","imports","generic"],O={"guidance.nextLimit":{type:"number",default:2,min:0,max:100,hidden:!0},"diagnostics.hintLimit":{type:"number",default:2,min:0,max:100,hidden:!0},"inspect.code.show":{type:"boolean",default:!0,hidden:!0},"inspect.code.maxNonEmptyLines":{type:"number",default:120,min:1,max:1e4},"inspect.code.meta":{type:"boolean",default:!0,hidden:!0},"inspect.members.maxItems":{type:"number",default:20,min:1,max:1e3},"inspect.members.all":{type:"boolean",default:!1,hidden:!0},"inspect.exports.ranges":{type:"boolean",default:!1,hidden:!0},"inspect.exports.resolveStar":{type:"boolean",default:!1,hidden:!0},"inspect.graph.hubs":{type:"boolean",default:!0},"inspect.graph.entrypoints":{type:"boolean",default:!0},"inspect.graph.leaves":{type:"boolean",default:!0},"inspect.graph.edges":{type:"boolean",default:!0},"inspect.graph.symbols":{type:"boolean",default:!1,hidden:!0},"inspect.graph.symbolUsage":{type:"boolean",default:!1},"inspect.usages.detail":{type:"string",default:"locations",values:["summary","locations","code"],hidden:!0},"inspect.usages.maxLocations":{type:"number",default:12,min:1,max:1e4},"inspect.usages.maxCodeBlocks":{type:"number",default:8,min:1,max:1e4},"inspect.usages.excludeTarget":{type:"boolean",default:!1,hidden:!0}};function M(e){return e.startsWith(Re)}function Ue(e,t){return e?F.run(e,t):t()}function Fe(e,t,n){const s=t[0]??"status",i=(0,N.resolveWorkspaceRoot)(e);if(!i){if(s==="status")return(0,m.attachAgentText)({initialized:!1,active:null,source:"none",available:[],next:"Run aib help first-setup"},["session not ready","","No aib.json was found.","","If you are a user:","ask your agent to set up AIB for this repo:","aib help first-setup","","If you are an agent:","run:","aib help first-setup","","Then follow the setup from the intended repository root."].join(`
2
2
  `));(0,N.resolveRequiredWorkspaceRoot)(e)}const r=i?.root??e;if(Rt(r),s==="init")return dt(r,t.slice(1));if(s==="status")return Dt(r);if(s==="list")return St(r);if(s==="use")return ht(r,t.slice(1));if(s==="where")return mt(r,t.slice(1));if(s==="read")return It(r,t.slice(1),n);if(s==="write")return Je(r,t.slice(1),n);if(s==="prefs")return Be(r,t.slice(1),n);if(s==="aliases")return Me(r,t.slice(1),n);if(s==="clear")return Ct(r);throw new u.CliError("UNKNOWN_SESSION_WORKSPACE_COMMAND",`Unknown session workspace command: ${s}`)}function Me(e,t,n){const s=t[0]??"get";if(s==="get"){const i=A(e),r=(0,b.readConfigPathAliases)(e),o=(0,b.normalizePathAliasMap)(i.pathAliases??{},"session path aliases"),a={aliases:(0,b.effectivePathAliases)(e,o),config:r,session:o};return(0,m.attachAgentText)(a,V(a))}if(s==="set"){const i=A(e),r=t.includes("--stdin")?Ve(n):ze(t.slice(1)),o=(0,b.normalizePathAliasMap)(i.pathAliases??{},"session path aliases"),a={};for(const[d,p]of Object.entries(r)){const S=(0,b.normalizePathAliasName)(d,"session path aliases");if(typeof p!="string"||p.trim()==="")throw new u.CliError("INVALID_PATH_ALIAS_TARGET",`session path alias ${d} must be a non-empty path string.`);o[S]=p.trim().replace(/\\/g,"/"),a[S]=o[S]}i.pathAliases=o,g(e,i);const f={updated:a,aliases:(0,b.effectivePathAliases)(e,o)};return(0,m.attachAgentText)(f,V(f))}if(s==="clear"){const i=A(e),r=t.slice(1).filter(d=>!d.startsWith("--")),o=(0,b.normalizePathAliasMap)(i.pathAliases??{},"session path aliases"),a=[];if(r.length===0)a.push(...Object.keys(o).sort()),delete i.pathAliases;else{for(const d of r){const p=(0,b.normalizePathAliasName)(d,"session path aliases");Object.prototype.hasOwnProperty.call(o,p)&&(a.push(p),delete o[p])}Object.keys(o).length>0?i.pathAliases=o:delete i.pathAliases}g(e,i);const f={cleared:a,aliases:(0,b.effectivePathAliases)(e,i.pathAliases??{})};return(0,m.attachAgentText)(f,V(f))}throw new u.CliError("UNKNOWN_SESSION_ALIASES_COMMAND",`Unknown session aliases command: ${s}`,{expected:"aib session aliases get | set | clear"})}function Ve(e){if(!y(e))throw new u.CliError("INVALID_SESSION_ALIASES_STDIN","session aliases set --stdin expects a JSON object.");const t=y(e.aliases)?e.aliases:e,n={};for(const[s,i]of Object.entries(t))typeof i=="string"&&(n[s]=i);return n}function ze(e){if(e.length===0||e.length%2!==0)throw new u.CliError("SESSION_ALIASES_SET_USAGE","Usage: aib session aliases set <name> <path> [<name> <path>...] or session aliases set --stdin");const t={};for(let n=0;n<e.length;n+=2)t[e[n]??""]=e[n+1]??"";return t}function V(e){if(y(e.updated))return re("aliases.updated",e.updated);if(Array.isArray(e.cleared)){const t=e.cleared.filter(n=>typeof n=="string");return t.length>0?["aliases.cleared",...t].join(`
3
3
  `):"aliases.cleared none"}if(y(e.aliases)){const t=re("aliases",e.aliases).split(`
4
4
  `);return t.length===1&&t.push("none"),t.join(`
@@ -8,7 +8,7 @@
8
8
  `);return t.length===1&&t.push("no overrides"),typeof e.defaults=="string"&&t.push(e.defaults),t.join(`
9
9
  `)}return y(e.prefs)?J("prefs",e.prefs):null}function J(e,t){const n=[e];for(const[s,i]of Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))n.push(`${s}=${String(i)}`);return n.join(`
10
10
  `)}function He(e){if(!y(e))throw new u.CliError("INVALID_SESSION_PREFS_STDIN","session prefs set --stdin expects a JSON object.");const t=y(e.prefs)?e.prefs:e,n={};for(const[s,i]of Object.entries(t))n[s]=i;return n}function Ge(e){if(e.length===0||e.length%2!==0)throw new u.CliError("SESSION_PREFS_SET_USAGE","Usage: aib session prefs set <key> <value> [<key> <value>...] or session prefs set --stdin");const t={};for(let n=0;n<e.length;n+=2){const s=e[n]??"",i=e[n+1]??"";t[s]=i}return t}function oe(e){if(Object.prototype.hasOwnProperty.call(O,e))return e;throw new u.CliError("UNKNOWN_SESSION_PREF",`Unknown session preference: ${e}`,{available:Object.keys(O)})}function Qe(e,t){const n=O[e];if(n.type==="boolean"){if(typeof t=="boolean")return t;if(typeof t=="string"){const i=t.trim().toLowerCase();if(i==="true")return!0;if(i==="false")return!1}throw new u.CliError("INVALID_SESSION_PREF_VALUE",`${e} expects true or false.`)}if(n.type==="string"){if(typeof t!="string")throw new u.CliError("INVALID_SESSION_PREF_VALUE",`${e} expects one of: ${n.values.join(", ")}.`);const i=t.trim();if(!n.values.includes(i))throw new u.CliError("INVALID_SESSION_PREF_VALUE",`${e} expects one of: ${n.values.join(", ")}.`);return i}const s=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;if(!Number.isInteger(s)||s<n.min||s>n.max)throw new u.CliError("INVALID_SESSION_PREF_VALUE",`${e} expects an integer from ${n.min} to ${n.max}.`);return s}function Ye(e){const t={};for(const n of Object.keys(O)){const s=O[n];"hidden"in s&&s.hidden||(s.type==="boolean"?t[n]=ce(e,n,s.default):s.type==="number"?t[n]=K(e,n,s.default):t[n]=le(e,n,s.default))}return t}function Ze(e){const t={};for(const[n,s]of Object.entries(e))Xe(n)||(t[n]=s);return t}function Xe(e){if(!Object.prototype.hasOwnProperty.call(O,e))return!1;const t=O[e];return"hidden"in t&&t.hidden===!0}function B(e,t){if(!M(t))return t;const n=A(e),s=Oe(t),i=s.scope==="input"?n.inputs:n.outputs,r=s.scope==="input"?s.kind:s.scope,o=i[r],a=s.name==="last"?o?.last:s.name,f=a?o?.items[a]:void 0;if(!f)throw new u.CliError("SESSION_HANDLE_NOT_FOUND",`Session handle not found: ${t}`,{handle:t,sessionDir:h(e,n.rootDir)});return f.file}function qe(e,t,n,s){const i=A(e),r=Ae(i,t,n,".json");l.mkdirSync(c.dirname(r),{recursive:!0}),l.writeFileSync(r,`${JSON.stringify(s,null,2)}
11
- `);const o=C(i,"outputs",t,n,r);return g(e,i),{saved:o.handle,last:`aib:${t}:last`,file:h(e,r)}}function et(e,t,n,s,i=".txt"){const r=A(e),o=Ae(r,t,n,i);l.mkdirSync(c.dirname(o),{recursive:!0}),l.writeFileSync(o,s);const a=C(r,"outputs",t,n,o);return g(e,r),{saved:a.handle,last:`aib:${t}:last`,file:h(e,o)}}function tt(e,t,n,s){const i=v(e);if(!i)return null;const r=I(t),o=I(n),a=c.join(i.rootDir,"outputs","result",r,`${o}.json`);return x(a,s),{saved:`aib:result:${r}:${o}`,file:h(e,a)}}function nt(e,t,n){const s=v(e);if(!s)return null;const i=I(t),r=c.join(s.rootDir,"outputs","result",`${i}.json`);return x(r,n),{saved:`aib:${i}`,file:h(e,r)}}function st(e,t){const n=A(e),s=I(t),i=c.join(n.rootDir,"outputs","result",`${s}.json`);if(!l.existsSync(i))throw new u.CliError("SESSION_RESULT_NOT_FOUND",`Result handle not found: aib:${s}`,{handle:`aib:${s}`,sessionDir:h(e,n.rootDir)});const r=JSON.parse(l.readFileSync(i,"utf8"));if(!r||typeof r!="object"||Array.isArray(r))throw new u.CliError("INVALID_SESSION_RESULT",`Result artifact is not a JSON object: aib:${s}`);return r}function it(e,t,n){const s=A(e),i=I(t),r=I(n),o=c.join(s.rootDir,"outputs","result",i,`${r}.json`);if(!l.existsSync(o))throw new u.CliError("SESSION_RESULT_NOT_FOUND",`Result handle not found: aib:result:${i}:${r}`,{handle:`aib:result:${i}:${r}`,sessionDir:h(e,s.rootDir)});const a=JSON.parse(l.readFileSync(o,"utf8"));if(!a||typeof a!="object"||Array.isArray(a))throw new u.CliError("INVALID_SESSION_RESULT",`Result artifact is not a JSON object: aib:result:${i}:${r}`);return a}function rt(e,t,n,s){return ae(e,t,n,s,{format:"json",text:JSON.stringify(s,null,2)})}function ae(e,t,n,s,i){const r=v(e);if(!r)return null;const o=i??{format:"json",text:JSON.stringify(s,null,2)},a=o.format==="dsl"?Z(r,t,n,".dsl"):Z(r,t,n,".json");o.format==="dsl"?(_e(a,o.text),x(Ft(r,t,n),s)):x(a,s);const f=C(r,"inputs",t,n,a);return Ne(r,t,s,o),g(e,r),{handle:f.handle,file:h(e,a)}}function ot(e){return l.existsSync(L(e))}function ue(e,t,n,s=-1){const i=v(e);if(!i)return n;const r=s>=0?s:K(i,"guidance.nextLimit",2),o=i.guidance??{},a=o[t]??{shown:0,limit:r};if(a.limit=r,a.shown>=a.limit){o[t]=a,i.guidance=o,g(e,i);return}return a.shown+=1,o[t]=a,i.guidance=o,g(e,i),n}function at(e,t,n){const s=v(e),i=O[t],r=typeof n=="boolean"?n:i.type==="boolean"?i.default:!1;return s?ce(s,t,r):r}function ut(e,t,n){const s=v(e),i=O[t],r=typeof n=="number"?n:i.type==="number"?i.default:0;return s?K(s,t,r):r}function ct(e,t,n){const s=v(e),i=O[t],r=typeof n=="string"?n:i.type==="string"?i.default:"";return s?le(s,t,r):r}function lt(e){try{const t=v(e);return(0,b.effectivePathAliases)(e,t?.pathAliases??{})}catch(t){if(t instanceof u.CliError&&t.code==="MULTIPLE_AIB_SESSIONS")return(0,b.effectivePathAliases)(e,{});throw t}}function ft(e){try{const t=v(e);return(0,b.normalizePathAliasMap)(t?.pathAliases??{},"session path aliases")}catch(t){if(t instanceof u.CliError&&t.code==="MULTIPLE_AIB_SESSIONS")return{};throw t}}function ce(e,t,n){const s=e.prefs?.[t];return typeof s=="boolean"?s:n}function K(e,t,n){const s=e.prefs?.[t];return typeof s=="number"&&Number.isFinite(s)?s:n}function le(e,t,n){const s=e.prefs?.[t];return typeof s=="string"?s:n}function dt(e,t){const n=w(t,"--dir"),s=Q(e,n,!0),i=w(t,"--name"),r=$(i??Y()??Jt()),o=c.join(s.rootDir,r),a=new Date().toISOString(),d=R(e,r)??{version:1,sessionId:r,cwd:c.resolve(e),rootDir:o,createdAt:a,updatedAt:a,outputs:{},inputs:{},guidance:{}};d.sessionId=r,d.rootDir=o,d.updatedAt=a,me(d),g(e,d),be(e,d,!0);const p=D(e),S=p?Object.keys(p.sessions).length:1,_={session:r,dir:h(e,d.rootDir),sessionDir:h(e,s.rootDir),sessionDirSource:s.source,sessionCount:S,bind:`${E.CLI_ENV.session}=${r}`,next:S===1?"Run AIB commands without -s for now. AIB will tell you if multiple sessions exist.":`Use aib -s ${r} <command> or set ${E.CLI_ENV.session}=${r}.`};return s.ignoredRequestedDir&&(_.note=`${U} from aib.json is in effect; --dir was ignored.`,_.requestedDir=s.ignoredRequestedDir),(0,m.attachAgentText)(_,pt(_))}function pt(e){const t=String(e.session??""),n=String(e.dir??""),s=typeof e.sessionCount=="number"?e.sessionCount:1,i=[`session ready: ${t}`,""];typeof e.note=="string"&&e.note&&(i.push("aib.json sessionDir is in effect; --dir was ignored."),i.push("Next time do not use --dir when creating a session."),i.push(""));const r=n.replace(/[\\/]+$/,"");return i.push(`outputs: ${r}/outputs`),i.push(`inputs: ${r}/inputs`),i.push(""),s===1?(i.push("Only one AIB session exists in this repo."),i.push("You can run AIB commands without -s for now."),i.push("AIB will tell you if multiple sessions exist and you need to choose one.")):(i.push("Multiple AIB sessions exist in this repo."),i.push("Use this session explicitly:"),i.push(`aib -s ${t} <command>`),i.push(""),i.push("Or bind it in this shell:"),i.push(`${E.CLI_ENV.session}=${t}`)),i.join(`
11
+ `);const o=C(i,"outputs",t,n,r);return g(e,i),{saved:o.handle,last:`aib:${t}:last`,file:h(e,r)}}function et(e,t,n,s,i=".txt"){const r=A(e),o=Ae(r,t,n,i);l.mkdirSync(c.dirname(o),{recursive:!0}),l.writeFileSync(o,s);const a=C(r,"outputs",t,n,o);return g(e,r),{saved:a.handle,last:`aib:${t}:last`,file:h(e,o)}}function tt(e,t,n,s){const i=v(e);if(!i)return null;const r=I(t),o=I(n),a=c.join(i.rootDir,"outputs","result",r,`${o}.json`);return x(a,s),{saved:`aib:result:${r}:${o}`,file:h(e,a)}}function nt(e,t,n){const s=v(e);if(!s)return null;const i=I(t),r=c.join(s.rootDir,"outputs","result",`${i}.json`);return x(r,n),{saved:`aib:${i}`,file:h(e,r)}}function st(e,t){const n=A(e),s=I(t),i=c.join(n.rootDir,"outputs","result",`${s}.json`);if(!l.existsSync(i))throw new u.CliError("SESSION_RESULT_NOT_FOUND",`Result handle not found: aib:${s}`,{handle:`aib:${s}`,sessionDir:h(e,n.rootDir)});const r=JSON.parse(l.readFileSync(i,"utf8"));if(!r||typeof r!="object"||Array.isArray(r))throw new u.CliError("INVALID_SESSION_RESULT",`Result artifact is not a JSON object: aib:${s}`);return r}function it(e,t,n){const s=A(e),i=I(t),r=I(n),o=c.join(s.rootDir,"outputs","result",i,`${r}.json`);if(!l.existsSync(o))throw new u.CliError("SESSION_RESULT_NOT_FOUND",`Result handle not found: aib:result:${i}:${r}`,{handle:`aib:result:${i}:${r}`,sessionDir:h(e,s.rootDir)});const a=JSON.parse(l.readFileSync(o,"utf8"));if(!a||typeof a!="object"||Array.isArray(a))throw new u.CliError("INVALID_SESSION_RESULT",`Result artifact is not a JSON object: aib:result:${i}:${r}`);return a}function rt(e,t,n,s){return ae(e,t,n,s,{format:"json",text:JSON.stringify(s,null,2)})}function ae(e,t,n,s,i){const r=v(e);if(!r)return null;const o=i??{format:"json",text:JSON.stringify(s,null,2)},a=o.format==="dsl"?Z(r,t,n,".dsl"):Z(r,t,n,".json");o.format==="dsl"?(_e(a,o.text),x(Ft(r,t,n),s)):x(a,s);const f=C(r,"inputs",t,n,a);return Ne(r,t,s,o),g(e,r),{handle:f.handle,file:h(e,a)}}function ot(e){return l.existsSync(L(e))}function ue(e,t,n,s=-1){const i=v(e);if(!i)return n;const r=s>=0?s:K(i,"guidance.nextLimit",2),o=i.guidance??{},a=o[t]??{shown:0,limit:r};if(a.limit=r,a.shown>=a.limit){o[t]=a,i.guidance=o,g(e,i);return}return a.shown+=1,o[t]=a,i.guidance=o,g(e,i),n}function at(e,t,n){const s=v(e),i=O[t],r=typeof n=="boolean"?n:i.type==="boolean"?i.default:!1;return s?ce(s,t,r):r}function ut(e,t,n){const s=v(e),i=O[t],r=typeof n=="number"?n:i.type==="number"?i.default:0;return s?K(s,t,r):r}function ct(e,t,n){const s=v(e),i=O[t],r=typeof n=="string"?n:i.type==="string"?i.default:"";return s?le(s,t,r):r}function lt(e){try{const t=v(e);return(0,b.effectivePathAliases)(e,t?.pathAliases??{})}catch(t){if(t instanceof u.CliError&&t.code==="MULTIPLE_AIB_SESSIONS")return(0,b.effectivePathAliases)(e,{});throw t}}function ft(e){try{const t=v(e);return(0,b.normalizePathAliasMap)(t?.pathAliases??{},"session path aliases")}catch(t){if(t instanceof u.CliError&&t.code==="MULTIPLE_AIB_SESSIONS")return{};throw t}}function ce(e,t,n){const s=e.prefs?.[t];return typeof s=="boolean"?s:n}function K(e,t,n){const s=e.prefs?.[t];return typeof s=="number"&&Number.isFinite(s)?s:n}function le(e,t,n){const s=e.prefs?.[t];return typeof s=="string"?s:n}function dt(e,t){const n=w(t,"--dir"),s=Q(e,n,!0),i=w(t,"--name"),r=$(i??Y()??Jt()),o=c.join(s.rootDir,r),a=new Date().toISOString(),d=R(e,r)??{version:1,sessionId:r,cwd:c.resolve(e),rootDir:o,createdAt:a,updatedAt:a,outputs:{},inputs:{},guidance:{}};d.sessionId=r,d.rootDir=o,d.updatedAt=a,me(d),g(e,d),be(e,d,!0);const p=D(e),S=p?Object.keys(p.sessions).length:1,_={session:r,dir:h(e,d.rootDir),sessionDir:h(e,s.rootDir),sessionDirSource:s.source,sessionCount:S,bind:`${E.CLI_ENV.session}=${r}`,next:S===1?"Run AIB commands without -s for now. AIB will tell you if multiple sessions exist.":`Use aib -s ${r} <command> or set ${E.CLI_ENV.session}=${r}.`};return s.ignoredRequestedDir&&(_.note=`${U} from aib.json is in effect; --dir was ignored.`,_.requestedDir=s.ignoredRequestedDir),(0,m.attachAgentText)(_,pt(_))}function pt(e){const t=String(e.session??""),n=typeof e.sessionCount=="number"?e.sessionCount:1,s=[`session ready: ${t}`,""];return typeof e.note=="string"&&e.note&&(s.push("aib.json sessionDir is in effect; --dir was ignored."),s.push("")),n===1?(s.push("Only one AIB session exists in this repo."),s.push("You can run AIB commands without -s for now."),s.push("AIB will tell you if multiple sessions exist and you need to choose one.")):(s.push("Multiple AIB sessions exist in this repo."),s.push("Use this session explicitly:"),s.push(`aib -s ${t} <command>`),s.push(""),s.push("Or bind it in this shell:"),s.push(`${E.CLI_ENV.session}=${t}`)),s.join(`
12
12
  `)}function St(e){const t=D(e),n=k(e);return{active:n.sessionId??t?.activeSessionId??null,source:n.source,sessions:t?Object.values(t.sessions).sort((s,i)=>s.sessionId.localeCompare(i.sessionId)).map(s=>`${s.sessionId} -> ${h(e,s.rootDir)}`):[]}}function ht(e,t){const n=t[0]??"";if(!n)throw new u.CliError("SESSION_USE_ID_REQUIRED","Usage: aib session use <sessionId>");const s=$(n),i=D(e),r=i?.sessions[s];if(!r)throw new u.CliError("SESSION_NOT_FOUND",`Session not found: ${s}`,{available:i?Object.keys(i.sessions).sort():[]});return T(e,{...i??ge(e),activeSessionId:s}),{session:s,dir:h(e,r.rootDir),bind:`${E.CLI_ENV.session}=${s}`,next:`Use aib -s ${s} <command> or set ${E.CLI_ENV.session}=${s}.`}}function mt(e,t){const n=t[0]??"";if(!n)throw new u.CliError("SESSION_WHERE_HANDLE_REQUIRED","Usage: aib session where <handle>");const s=B(e,n),i={handle:n,file:h(e,s)};return(0,m.attachAgentText)(i,[n,i.file].join(`
13
13
  `))}function It(e,t,n){if(t.includes("--stdin")){if(!y(n))throw new u.CliError("INVALID_SESSION_READ_STDIN","session read --stdin expects a JSON object payload.");const r=yt(n);if(r.length===1){const a=H(e,r[0]);return(0,m.attachAgentText)(a,G(a))}const o={reads:r.map(a=>gt(e,a))};return(0,m.attachAgentText)(o,G(o))}const s=t[0]??"";if(!s)throw new u.CliError("SESSION_READ_HANDLE_REQUIRED","Usage: aib session read <handle> [--head <n> | --offset <n> --limit <n>]");const i=H(e,{handle:s,...vt(t.slice(1))});return(0,m.attachAgentText)(i,G(i))}function yt(e){if(Array.isArray(e.reads))return e.reads.map((t,n)=>{if(typeof t=="string"){if(!M(t))throw new u.CliError("INVALID_SESSION_READ_ROW",`session read row at index ${n} must be an aib: handle string or an object.`);return{handle:t}}if(!y(t))throw new u.CliError("INVALID_SESSION_READ_ROW",`session read row at index ${n} must be an aib: handle string or an object.`);return fe(t,n)});if(typeof e.handle=="string"||typeof e.read=="string")return[fe(e,0)];throw new u.CliError("INVALID_SESSION_READ_STDIN","Expected { reads: [{ handle }] } or { handle }.")}function fe(e,t){const n=X(e.handle)??X(e.read);if(!n)throw new u.CliError("SESSION_READ_HANDLE_REQUIRED",`session read row at index ${t} requires handle.`);return{handle:n,...e.rawInput===!0?{rawInput:!0}:{},...pe(e,t)}}function gt(e,t){try{return H(e,t)}catch(n){if(n instanceof u.CliError){const s=y(n.details)?n.details:{};return{read:t.handle,error:n.code,...typeof s.next=="string"?{next:s.next}:{}}}return{read:t.handle,error:"UNEXPECTED_ERROR"}}}function H(e,t){Ot(t);const n=Oe(t.handle),s=B(e,t.handle);if(n.scope==="input"&&!t.rawInput){const r=Nt(n.kind,t.handle);return{read:t.handle,file:h(e,s),next:r?`Edit file, then rerun: ${r}`:"Edit file, then rerun the command with --from <handle>."}}if(n.scope==="graph"||n.scope==="usages"){const r=n.scope==="graph"?`aib inspect graph --from-file ${t.handle} --focus <file>`:`aib inspect usages --from-file ${t.handle} --focus <name>`;throw new u.CliError("SESSION_ARTIFACT_NOT_READABLE",`${n.scope} artifacts are reusable indexes, not agent-readable context.`,{handle:t.handle,kind:n.scope,next:r})}if(n.scope==="duplicates"){const r=l.readFileSync(s,"utf8");return{read:t.handle,content:bt(e,t.handle,s,r,t)}}const i=l.readFileSync(s,"utf8");return{read:t.handle,content:At(s,i,t)}}function bt(e,t,n,s,i){const r=Et(e,t,n,s);return i.head!==void 0||i.offset!==void 0||i.limit!==void 0?Se(r,i):r}function Et(e,t,n,s){let i;try{i=JSON.parse(s)}catch{return de(t,n,s)}if(!y(i))return de(t,n,s);const r=[],o=Array.isArray(i.targetPaths)?i.targetPaths.filter(S=>typeof S=="string"&&S!==""):[],a=o.length===1?h(e,o[0]):o.length>1?`${o.length} scopes`:"";r.push(a?`duplicates ${a}`:"duplicates");const f=typeof i.summary=="string"?i.summary:`${j(i.itemCount)} ${te(j(i.itemCount),"name")}`;r.push(f);const d=Array.isArray(i.items)?i.items.filter(y):[];for(const S of d){const _=typeof S.name=="string"?S.name:"",ve=j(S.declarationCount),ne=j(S.variantCount),se=j(S.exactCopyCount);_&&r.push(`${_} x${ve}, ${ne} ${te(ne,"variant")}${se>0?`, exact x${se}`:""}`)}const p=j(i.hiddenItemCount);return p>0&&r.push(`+ ${p} ${te(p,"name")}`),r.push(`raw: aib session where ${t}`),r.join(`
14
14
  `)}function de(e,t,n){return[`saved artifact ${e}`,`${n.length} bytes`,`raw: ${t}`].join(`
@@ -16,12 +16,12 @@
16
16
  `)}function _t(e){return typeof e=="string"?e:e===void 0?null:JSON.stringify(e,null,2)}function Nt(e,t){return e==="inspect"?`aib inspect --from ${t}`:e==="graph"?`aib inspect graph --from ${t}`:e==="rename"?`aib rename preview --from ${t}`:e==="move"?`aib move toFile preview --from ${t}`:e==="refactor"?`aib refactor batch preview --from ${t}`:e==="modulePlan"?`aib modulePlan preview --from ${t}`:e==="imports"?`aib imports normalize preview --from ${t}`:null}function Ot(e){if(e.head!==void 0&&(e.offset!==void 0||e.limit!==void 0))throw new u.CliError("SESSION_READ_RANGE_CONFLICT","Use either head or offset/limit, not both.")}function vt(e){const t={},n=w(e,"--head"),s=w(e,"--offset"),i=w(e,"--limit");return n!==void 0&&(t.head=n),s!==void 0&&(t.offset=s),i!==void 0&&(t.limit=i),{...e.includes("--raw-input")?{rawInput:!0}:{},...pe(t,0)}}function pe(e,t){const n=q(e.head,`session read row at index ${t} has invalid head.`),s=q(e.offset,`session read row at index ${t} has invalid offset.`),i=zt(e.limit,`session read row at index ${t} has invalid limit.`);return{...n!==void 0?{head:n}:{},...s!==void 0?{offset:s}:{},...i!==void 0?{limit:i}:{}}}function Se(e,t){if(t.head===void 0&&t.offset===void 0&&t.limit===void 0)return e;const n=e.split(/\r?\n/),s=t.head!==void 0?0:t.offset??0,i=t.head!==void 0?t.head:t.limit!==void 0?s+t.limit:void 0;return n.slice(s,i).join(`
17
17
  `)}function Dt(e){const t=D(e),n=k(e),s=t?Object.keys(t.sessions).sort():[];if(n.source==="ambiguous")return(0,m.attachAgentText)({ok:!1,code:"MULTIPLE_AIB_SESSIONS",error:"Multiple AIB sessions exist. Select one explicitly.",available:s,next:`Use aib -s <session> <command> or set ${E.CLI_ENV.session}=<session>.`},jt(s));const i=n.sessionId?R(e,n.sessionId):null;if(!i){const o={initialized:!1,active:n.sessionId??null,source:n.source,available:s,next:n.sessionId?`Run aib session init --name ${n.sessionId}`:"Run aib session init --name <name>"};return(0,m.attachAgentText)(o,$t(o))}g(e,i);const r={initialized:!0,session:i.sessionId??n.sessionId,active:i.sessionId??n.sessionId,source:n.source,available:s,sessionDir:h(e,i.rootDir),aliases:(0,b.effectivePathAliases)(e,i.pathAliases??{}),latest:Mt(i),dirs:Vt(e,i)};return(0,m.attachAgentText)(r,xt(r))}function $t(e){const t=typeof e.active=="string"&&e.active?e.active:null;return t?["session not ready","",`Session ${t} was not found.`,"Create it:",`aib session init --name ${t}`].join(`
18
18
  `):["session not ready","","No AIB sessions exist in this repo.","Create one:","aib session init --name <name>"].join(`
19
- `)}function xt(e){const t=String(e.session??""),n=e.dirs&&typeof e.dirs=="object"&&!Array.isArray(e.dirs)?e.dirs:{},s=e.aliases&&typeof e.aliases=="object"&&!Array.isArray(e.aliases)?e.aliases:{},i=[`session: ${t}`,`outputs: ${String(n.outputs??"")}`,`inputs: ${String(n.inputs??"")}`],r=Object.entries(s).filter(([,o])=>typeof o=="string"&&o.trim()!=="").sort(([o],[a])=>o.localeCompare(a)).map(([o,a])=>`@${o} -> ${String(a)}`);return r.length>0&&i.push("","aliases:",...r),e.source==="single"&&i.push("","Only one AIB session exists in this repo.","You can run AIB commands without -s."),i.join(`
19
+ `)}function xt(e){const t=String(e.session??""),n=e.aliases&&typeof e.aliases=="object"&&!Array.isArray(e.aliases)?e.aliases:{},s=[`session: ${t}`],i=Object.entries(n).filter(([,r])=>typeof r=="string"&&r.trim()!=="").sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>`@${r} -> ${String(o)}`);return i.length>0&&s.push("","aliases:",...i),e.source==="single"&&s.push("","Only one AIB session exists in this repo.","You can run AIB commands without -s."),s.join(`
20
20
  `)}function jt(e){return["multiple AIB sessions","","available:",...e,"","Choose one:","aib -s <session> <command>","","Or bind it in this shell:",`${E.CLI_ENV.session}=<session>`,"","If none of these sessions is yours, create a new one:","aib session init --name <name>"].join(`
21
21
  `)}function Ct(e){const t=k(e),n=D(e),s=n?Object.keys(n.sessions).sort():[];if(t.source==="ambiguous")return(0,m.attachAgentText)({ok:!1,code:"MULTIPLE_AIB_SESSIONS",error:"Multiple AIB sessions exist. Select one explicitly.",available:s,next:"Use aib -s <session> session clear."},wt(s));const i=t.sessionId?R(e,t.sessionId):null;if(!i)return(0,m.attachAgentText)({cleared:!1,reason:"session-not-initialized"},["No AIB sessions exist in this repo.","","Create one:","aib session init --name <name>"].join(`
22
22
  `));he(i,{touch:!0}),g(e,i);const r=i.sessionId??t.sessionId??"";return(0,m.attachAgentText)({cleared:!0,session:r,dir:h(e,i.rootDir)},[`session cleared: ${r}`,"","Inputs and outputs were pruned.","You can keep using this session."].join(`
23
23
  `))}function he(e,t){l.rmSync(c.join(e.rootDir,"inputs"),{recursive:!0,force:!0}),l.rmSync(c.join(e.rootDir,"outputs"),{recursive:!0,force:!0}),e.inputs={},e.outputs={},e.guidance={},t.touch&&(e.updatedAt=new Date().toISOString()),me(e)}function wt(e){return["multiple AIB sessions","","available:",...e,"","Clear one explicitly only if it is yours:","aib -s <session> session clear","","If none of these sessions is yours, create a new one:","aib session init --name <name>"].join(`
24
- `)}function Rt(e){const t=Lt(e),n=D(e);if(!n)return;const s=Date.now();let i=!1;for(const[r,o]of Object.entries(n.sessions)){const a=P(o.rootDir);if(!l.existsSync(a)){delete n.sessions[r],i=!0,n.activeSessionId===r&&delete n.activeSessionId;continue}const f=Date.parse(o.updatedAt);if(!Number.isFinite(f))continue;const d=s-f;if(t.autoDelete&&t.ttlDeleteMs>0&&d>t.ttlDeleteMs){l.rmSync(o.rootDir,{recursive:!0,force:!0}),delete n.sessions[r],i=!0,n.activeSessionId===r&&delete n.activeSessionId;continue}if(t.autoClean&&t.ttlCleanMs>0&&d>t.ttlCleanMs){const p=Ie(e,o.rootDir,r);p&&(he(p,{touch:!1}),Pt(p))}}if(i){if(!n.activeSessionId){const r=Object.keys(n.sessions).sort()[0];r&&(n.activeSessionId=r)}T(e,n)}}function Lt(e){const t=(0,N.readWorkspaceNumberConfig)(e,"session.ttlMinutes",60),n=(0,N.readWorkspaceNumberConfig)(e,"session.ttlDeleteMinutes",t),s=(0,N.readWorkspaceNumberConfig)(e,"session.ttlCleanMinutes",t);return{autoDelete:(0,N.readWorkspaceBooleanConfig)(e,"session.autoDelete",!0),ttlDeleteMs:n>0?n*6e4:0,autoClean:(0,N.readWorkspaceBooleanConfig)(e,"session.autoClean",!0),ttlCleanMs:s>0?s*6e4:0}}function me(e){for(const t of ke)l.mkdirSync(c.join(e.rootDir,"outputs",t),{recursive:!0});for(const t of We)l.mkdirSync(c.join(e.rootDir,"inputs",t),{recursive:!0})}function R(e,t){const s=D(e)?.sessions[t];return s?Ie(e,s.rootDir,t):null}function v(e){const t=Ee(e);return t.sessionId?R(e,t.sessionId):null}function Ie(e,t,n){try{const s=JSON.parse(l.readFileSync(P(t),"utf8"));if(!s||typeof s!="object"||Array.isArray(s))return null;const i=s;return i.version!==1||typeof i.rootDir!="string"?null:(i.sessionId=i.sessionId??n,i)}catch{return null}}function A(e){const t=v(e);if(!t)throw new u.CliError("SESSION_WORKSPACE_NOT_INITIALIZED","Session workspace is not initialized.",{session:Y()??null,next:"Run aib session init --dir .tmp/aib"});return g(e,t),t}function g(e,t){t.updatedAt=new Date().toISOString(),l.mkdirSync(t.rootDir,{recursive:!0}),l.writeFileSync(P(t.rootDir),`${JSON.stringify(t,null,2)}
24
+ `)}function Rt(e){const t=Lt(e),n=D(e);if(!n)return;const s=Date.now();let i=!1;for(const[r,o]of Object.entries(n.sessions)){const a=P(o.rootDir);if(!l.existsSync(a)){delete n.sessions[r],i=!0,n.activeSessionId===r&&delete n.activeSessionId;continue}const f=Date.parse(o.updatedAt);if(!Number.isFinite(f))continue;const d=s-f;if(t.autoDelete&&t.ttlDeleteMs>0&&d>t.ttlDeleteMs){l.rmSync(o.rootDir,{recursive:!0,force:!0}),delete n.sessions[r],i=!0,n.activeSessionId===r&&delete n.activeSessionId;continue}if(t.autoClean&&t.ttlCleanMs>0&&d>t.ttlCleanMs){const p=Ie(e,o.rootDir,r);p&&(he(p,{touch:!1}),Pt(p))}}if(i){if(!n.activeSessionId){const r=Object.keys(n.sessions).sort()[0];r&&(n.activeSessionId=r)}T(e,n)}}function Lt(e){const t=(0,N.readWorkspaceNumberConfig)(e,"session.ttlMinutes",60),n=(0,N.readWorkspaceNumberConfig)(e,"session.ttlDeleteMinutes",t),s=(0,N.readWorkspaceNumberConfig)(e,"session.ttlCleanMinutes",t);return{autoDelete:(0,N.readWorkspaceBooleanConfig)(e,"session.autoDelete",!0),ttlDeleteMs:n>0?n*6e4:0,autoClean:(0,N.readWorkspaceBooleanConfig)(e,"session.autoClean",!0),ttlCleanMs:s>0?s*6e4:0}}function me(e){for(const t of ke)l.mkdirSync(c.join(e.rootDir,"outputs",t),{recursive:!0});for(const t of We)l.mkdirSync(c.join(e.rootDir,"inputs",t),{recursive:!0})}function R(e,t){const s=D(e)?.sessions[t];return s?Ie(e,s.rootDir,t):null}function v(e){const t=Ee(e);return t.sessionId?R(e,t.sessionId):null}function Ie(e,t,n){try{const s=JSON.parse(l.readFileSync(P(t),"utf8"));if(!s||typeof s!="object"||Array.isArray(s))return null;const i=s;return i.version!==1||typeof i.rootDir!="string"?null:(i.sessionId=i.sessionId??n,i)}catch{return null}}function A(e){const t=v(e);if(!t)throw new u.CliError("SESSION_WORKSPACE_NOT_INITIALIZED","Session workspace is not initialized.",{session:Y()??null,next:"Run aib session init --name <name>",help:"aib help session"});return g(e,t),t}function g(e,t){t.updatedAt=new Date().toISOString(),l.mkdirSync(t.rootDir,{recursive:!0}),l.writeFileSync(P(t.rootDir),`${JSON.stringify(t,null,2)}
25
25
  `),be(e,t,!1)}function Pt(e){l.mkdirSync(e.rootDir,{recursive:!0}),l.writeFileSync(P(e.rootDir),`${JSON.stringify(e,null,2)}
26
26
  `)}function Q(e,t,n=!1){const s=(0,N.resolveWorkspaceRoot)(e),i=s?.root??e,r=s?X(s.config[U]):void 0;if(r)return{rootDir:ye(i,r),source:"aib.json",...t?{ignoredRequestedDir:t}:{}};const a=ye(i,t??je);return n&&s&&(0,N.updateWorkspaceConfig)(i,{[U]:Tt(i,a)}),{rootDir:a,source:t?"request":"default"}}function ye(e,t){const n=c.resolve(e,t);return c.basename(n).toLowerCase()==="aib"?n:c.join(n,"aib")}function Tt(e,t){const n=c.relative(e,t);return n&&!n.startsWith("..")&&!c.isAbsolute(n)?n.replace(/\\/g,"/"):t.replace(/\\/g,"/")}function L(e){return c.join(Q(e).rootDir,Ce)}function kt(e){return c.join(Q(e).rootDir,we)}function P(e){return c.join(e,"session.json")}function D(e){try{const t=JSON.parse(l.readFileSync(L(e),"utf8"));if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t;return n.version!==1||!n.sessions||typeof n.sessions!="object"?null:{version:1,cwd:typeof n.cwd=="string"?n.cwd:c.resolve(e),...typeof n.activeSessionId=="string"?{activeSessionId:n.activeSessionId}:{},sessions:n.sessions}}catch{return null}}function T(e,t){t.cwd=c.resolve((0,N.resolveWorkspaceRoot)(e)?.root??e),l.mkdirSync(c.dirname(L(e)),{recursive:!0}),l.writeFileSync(L(e),`${JSON.stringify(t,null,2)}
27
27
  `),Wt(e,t.activeSessionId)}function ge(e){return{version:1,cwd:c.resolve(e),sessions:{}}}function Wt(e,t){const n=kt(e);if(l.mkdirSync(c.dirname(n),{recursive:!0}),!t){l.rmSync(n,{force:!0});return}l.writeFileSync(n,`${JSON.stringify({sessionId:t,updatedAt:new Date().toISOString()},null,2)}
@@ -1,3 +1,3 @@
1
- "use strict";var S=exports&&exports.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),O=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),m=exports&&exports.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&S(n,t,r[o]);return O(n,t),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AIB_CONFIG_FILE_NAME=void 0,exports.initWorkspaceRoot=h,exports.resolveWorkspaceRoot=p,exports.resolveRequiredWorkspaceRoot=C,exports.readWorkspaceNumberConfig=D,exports.readWorkspaceBooleanConfig=w,exports.readWorkspaceStringConfig=k,exports.updateWorkspaceConfig=E,exports.workspaceConfigSummary=W,exports.isPathInsideOrEqual=A;const c=m(require("node:fs")),s=m(require("node:path")),N=require("./env-vars"),M=require("../shared/errors");exports.AIB_CONFIG_FILE_NAME="aib.json";function h(e,t={}){const n=s.join(s.resolve(e),exports.AIB_CONFIG_FILE_NAME),r=c.existsSync(n),o=r?_(n):{},f=a(t.sessionDir)??a(o.sessionDir),d=i(o["session.ttlMinutes"]),g=i(o["session.ttlCleanMinutes"])??d??60,I=i(o["session.ttlDeleteMinutes"])??d??60,l={...o,"workspace.root":a(o["workspace.root"])??".",...f?{sessionDir:f}:{},"session.autoDelete":u(o["session.autoDelete"])??!0,"session.ttlDeleteMinutes":I,"session.autoClean":u(o["session.autoClean"])??!0,"session.ttlCleanMinutes":g,"runtime.managedIdeTtlMinutes":i(o["runtime.managedIdeTtlMinutes"])??15,"runtime.managedIdeWatchdogIntervalMs":i(o["runtime.managedIdeWatchdogIntervalMs"])??3e4,"runtime.autoStopManagedIde":u(o["runtime.autoStopManagedIde"])??!0};c.writeFileSync(n,`${JSON.stringify(l,null,2)}
2
- `,"utf8");const y=i(l["session.ttlCleanMinutes"])??60,v=i(l["runtime.managedIdeTtlMinutes"])??15,b=!r||JSON.stringify(o)!==JSON.stringify(l);return{status:r?b?"updated":"unchanged":"created",...r?{}:{created:exports.AIB_CONFIG_FILE_NAME},configPath:n,root:s.resolve(e),"workspace.root":a(l["workspace.root"])??".",...f?{sessionDir:f}:{},"session.autoClean":u(l["session.autoClean"])??!0,"session.ttlCleanMinutes":y,"session.autoDelete":u(l["session.autoDelete"])??!0,"session.ttlDeleteMinutes":i(l["session.ttlDeleteMinutes"])??60,"runtime.autoStopManagedIde":u(l["runtime.autoStopManagedIde"])??!0,"runtime.managedIdeTtlMinutes":v,...f?{}:{next:"Set the default session directory: aib config --session-dir .tmp/aib"}}}function p(e){const t=a(process.env[N.CLI_ENV.workspaceRoot]);if(t){const d=s.resolve(e,t),g=s.join(d,exports.AIB_CONFIG_FILE_NAME),I=c.existsSync(g)?_(g):{"workspace.root":"."};return{root:d,configPath:g,config:I}}const n=F(e);if(!n)return null;const r=_(n),o=s.dirname(n),f=a(r["workspace.root"])??".";return{root:s.resolve(o,f),configPath:n,config:r}}function C(e){const t=p(e);if(t)return t;const n=j(e,".git");throw new M.CliError("WORKSPACE_ROOT_NOT_INITIALIZED","Workspace root is not initialized.",{cwd:s.resolve(e),...n?{detectedGitRoot:n}:{},next:"Go to your repo root and run: aib init"})}function D(e,t,n){const r=p(e);return(r?i(r.config[t]):null)??n}function w(e,t,n){const r=p(e);return(r?u(r.config[t]):null)??n}function k(e,t,n){const r=p(e);return(r?a(r.config[t]):null)??n}function E(e,t){const n=C(e),r={...n.config,...t};return c.writeFileSync(n.configPath,`${JSON.stringify(r,null,2)}
3
- `,"utf8"),r}function W(e){const t=i(e["session.ttlMinutes"]);return{"workspace.root":a(e["workspace.root"])??".",...a(e.sessionDir)?{sessionDir:a(e.sessionDir)}:{},"session.autoClean":u(e["session.autoClean"])??!0,"session.ttlCleanMinutes":i(e["session.ttlCleanMinutes"])??t??60,"session.autoDelete":u(e["session.autoDelete"])??!0,"session.ttlDeleteMinutes":i(e["session.ttlDeleteMinutes"])??t??60,"runtime.autoStopManagedIde":u(e["runtime.autoStopManagedIde"])??!0,"runtime.managedIdeTtlMinutes":i(e["runtime.managedIdeTtlMinutes"])??15}}function A(e,t){const n=s.resolve(e).toLowerCase(),r=s.resolve(t).toLowerCase();return r===n||r.startsWith(`${n}${s.sep}`)}function F(e){let t=s.resolve(e);const n=s.parse(t).root;for(;;){const r=s.join(t,exports.AIB_CONFIG_FILE_NAME);if(c.existsSync(r)&&c.statSync(r).isFile())return r;if(t===n)break;const o=s.dirname(t);if(o===t)break;t=o}return null}function j(e,t){let n=s.resolve(e);const r=s.parse(n).root;for(;;){if(c.existsSync(s.join(n,t)))return n;if(n===r)break;const o=s.dirname(n);if(o===n)break;n=o}return null}function _(e){try{const t=JSON.parse(c.readFileSync(e,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch(t){throw new M.CliError("AIB_CONFIG_INVALID","aib.json must be valid JSON.",{file:e,error:t instanceof Error?t.message:String(t)})}}function a(e){return typeof e=="string"&&e.trim()?e.trim():null}function i(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);return Number.isFinite(t)?t:null}return null}function u(e){if(typeof e=="boolean")return e;if(typeof e!="string")return null;const t=e.trim().toLowerCase();return["1","true","yes","on"].includes(t)?!0:["0","false","no","off"].includes(t)?!1:null}
1
+ "use strict";var S=exports&&exports.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),O=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),_=exports&&exports.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&S(n,t,r[o]);return O(n,t),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AIB_CONFIG_FILE_NAME=void 0,exports.initWorkspaceRoot=h,exports.resolveWorkspaceRoot=g,exports.resolveRequiredWorkspaceRoot=C,exports.readWorkspaceNumberConfig=D,exports.readWorkspaceBooleanConfig=w,exports.readWorkspaceStringConfig=k,exports.updateWorkspaceConfig=E,exports.workspaceConfigSummary=W,exports.isPathInsideOrEqual=A;const c=_(require("node:fs")),s=_(require("node:path")),N=require("./env-vars"),M=require("../shared/errors");exports.AIB_CONFIG_FILE_NAME="aib.json";function h(e,t={}){const n=s.join(s.resolve(e),exports.AIB_CONFIG_FILE_NAME),r=c.existsSync(n),o=r?I(n):{},f=a(t.sessionDir)??a(o.sessionDir),d=i(o["session.ttlMinutes"]),p=i(o["session.ttlCleanMinutes"])??d??60,m=i(o["session.ttlDeleteMinutes"])??d??60,l={...o,"workspace.root":a(o["workspace.root"])??".",...f?{sessionDir:f}:{},"session.autoDelete":u(o["session.autoDelete"])??!0,"session.ttlDeleteMinutes":m,"session.autoClean":u(o["session.autoClean"])??!0,"session.ttlCleanMinutes":p,"runtime.managedIdeTtlMinutes":i(o["runtime.managedIdeTtlMinutes"])??15,"runtime.managedIdeWatchdogIntervalMs":i(o["runtime.managedIdeWatchdogIntervalMs"])??3e4,"runtime.autoStopManagedIde":u(o["runtime.autoStopManagedIde"])??!0};c.writeFileSync(n,`${JSON.stringify(l,null,2)}
2
+ `,"utf8");const y=i(l["session.ttlCleanMinutes"])??60,v=i(l["runtime.managedIdeTtlMinutes"])??15,b=!r||JSON.stringify(o)!==JSON.stringify(l);return{status:r?b?"updated":"unchanged":"created",...r?{}:{created:exports.AIB_CONFIG_FILE_NAME},configPath:n,root:s.resolve(e),"workspace.root":a(l["workspace.root"])??".",...f?{sessionDir:f}:{},"session.autoClean":u(l["session.autoClean"])??!0,"session.ttlCleanMinutes":y,"session.autoDelete":u(l["session.autoDelete"])??!0,"session.ttlDeleteMinutes":i(l["session.ttlDeleteMinutes"])??60,"runtime.autoStopManagedIde":u(l["runtime.autoStopManagedIde"])??!0,"runtime.managedIdeTtlMinutes":v,...f?{}:{next:"Set the default session directory: aib config --session-dir .tmp/aib"}}}function g(e){const t=a(process.env[N.CLI_ENV.workspaceRoot]);if(t){const d=s.resolve(e,t),p=s.join(d,exports.AIB_CONFIG_FILE_NAME),m=c.existsSync(p)?I(p):{"workspace.root":"."};return{root:d,configPath:p,config:m}}const n=F(e);if(!n)return null;const r=I(n),o=s.dirname(n),f=a(r["workspace.root"])??".";return{root:s.resolve(o,f),configPath:n,config:r}}function C(e){const t=g(e);if(t)return t;const n=R(e,".git");throw new M.CliError("WORKSPACE_ROOT_NOT_INITIALIZED","Workspace root is not initialized.",{cwd:s.resolve(e),...n?{detectedGitRoot:n}:{},next:"Run aib help first-setup from the intended repository root."})}function D(e,t,n){const r=g(e);return(r?i(r.config[t]):null)??n}function w(e,t,n){const r=g(e);return(r?u(r.config[t]):null)??n}function k(e,t,n){const r=g(e);return(r?a(r.config[t]):null)??n}function E(e,t){const n=C(e),r={...n.config,...t};return c.writeFileSync(n.configPath,`${JSON.stringify(r,null,2)}
3
+ `,"utf8"),r}function W(e){const t=i(e["session.ttlMinutes"]);return{"workspace.root":a(e["workspace.root"])??".",...a(e.sessionDir)?{sessionDir:a(e.sessionDir)}:{},"session.autoClean":u(e["session.autoClean"])??!0,"session.ttlCleanMinutes":i(e["session.ttlCleanMinutes"])??t??60,"session.autoDelete":u(e["session.autoDelete"])??!0,"session.ttlDeleteMinutes":i(e["session.ttlDeleteMinutes"])??t??60,"runtime.autoStopManagedIde":u(e["runtime.autoStopManagedIde"])??!0,"runtime.managedIdeTtlMinutes":i(e["runtime.managedIdeTtlMinutes"])??15}}function A(e,t){const n=s.resolve(e).toLowerCase(),r=s.resolve(t).toLowerCase();return r===n||r.startsWith(`${n}${s.sep}`)}function F(e){let t=s.resolve(e);const n=s.parse(t).root;for(;;){const r=s.join(t,exports.AIB_CONFIG_FILE_NAME);if(c.existsSync(r)&&c.statSync(r).isFile())return r;if(t===n)break;const o=s.dirname(t);if(o===t)break;t=o}return null}function R(e,t){let n=s.resolve(e);const r=s.parse(n).root;for(;;){if(c.existsSync(s.join(n,t)))return n;if(n===r)break;const o=s.dirname(n);if(o===n)break;n=o}return null}function I(e){try{const t=JSON.parse(c.readFileSync(e,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch(t){throw new M.CliError("AIB_CONFIG_INVALID","aib.json must be valid JSON.",{file:e,error:t instanceof Error?t.message:String(t)})}}function a(e){return typeof e=="string"&&e.trim()?e.trim():null}function i(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);return Number.isFinite(t)?t:null}return null}function u(e){if(typeof e=="boolean")return e;if(typeof e!="string")return null;const t=e.trim().toLowerCase();return["1","true","yes","on"].includes(t)?!0:["0","false","no","off"].includes(t)?!1:null}
@@ -36,9 +36,28 @@ Use one-off commands only for small checks/changes.
36
36
  For mutations, aib asks TS/IDE refactors to update affected references and imports.
37
37
  After a successful mutation, do not manually patch the same imports unless aib reports a follow-up or the build/checks show a real issue.
38
38
 
39
- Working patterns
40
-
39
+ Working patterns
40
+
41
+ Help refresh
42
+
43
+ After context compaction, always run:
44
+ aib help help-protocol quick-map
45
+ aib config aliases
46
+
47
+ Use focused help when you would otherwise guess how a known AIB capability works.
48
+
49
+ Reread bootstrap when you need to restore the overall AIB workflow faster than piecing it together from focused topics.
50
+ If you just reread bootstrap, do not also read focused topics unless you need details that bootstrap does not cover.
51
+
52
+ Do not reread bootstrap automatically if focused help is enough.
53
+ When refreshing multiple areas, request them together instead of one by one.
54
+
55
+ Example:
56
+ aib help patterns mutation inspect inspect.file inspect.code imports.normalize
57
+
41
58
  Use aib before broad file reads when the question is about TS/JS structure, references, dependencies, or focused code.
59
+ Use qr for cross-OS quick reads of text files, logs, JSON, scripts, and line windows.
60
+ It is not a replacement for inspect.
42
61
  Use normal text search when the question is just text.
43
62
 
44
63
  For a first pass in a new codebase, map directories before reading files:
@@ -52,9 +71,9 @@ If output hides data and shows `view: aib:res_<id>`, use `aib view ...` to fetch
52
71
 
53
72
  Compact output is a starting point, not a substitute for needed code.
54
73
  Fetch exact code when correctness depends on implementation details.
55
-
56
- Use prefs when the current phase repeats the same output shape.
57
- Turn details off when they stop helping.
74
+
75
+ Use prefs when the current phase repeats the same output shape.
76
+ Turn details off when they stop helping.
58
77
  Turn them back on when they matter.
59
78
 
60
79
  For mutation commands, set the shell/tool harness timeout to 3 minutes.
@@ -65,15 +84,30 @@ aib execution status last
65
84
 
66
85
  This is an escape hatch for recovering the latest mutation status/result.
67
86
 
68
- Before repeated mutation work, check aib config:
69
-
70
- aib config
71
-
72
- Set pathAliases for repeated request paths.
73
- Set importRules so move/modulePlan create imports in the project style.
74
-
75
- This avoids repeating long paths in requests and avoids manual import cleanup after mutations.
76
- Do this before large move/modulePlan work, not after cleanup becomes repetitive.
87
+ After reading bootstrap for the first time in a repo, run:
88
+
89
+ aib config
90
+
91
+ Use the output as the repo-local AIB map:
92
+ - pathAliases show short paths to use in AIB requests;
93
+ - importRules show how move/modulePlan should create imports;
94
+ - importNormalize shows defaults for explicit imports normalize;
95
+ - excludes show which noise is intentionally hidden from tree/graph/sync.
96
+
97
+ If pathAliases are missing, stale, or weak for repeated paths, run:
98
+ aib help config-setup.aliases
99
+
100
+ If move/modulePlan imports do not match the repo style, run:
101
+ aib help config-setup.import-rules
102
+
103
+ If you are about to change import style across files, add or adopt tsconfig aliases, or clean imports repeatedly, run:
104
+ aib help config-setup.import-normalize
105
+
106
+ If tree/graph output includes known repo noise, run:
107
+ aib help config-setup.excludes
108
+
109
+ If sync or reveal shows too many visible TypeScript configs, run:
110
+ aib help config-setup.tsconfigs
77
111
 
78
112
  Example aib.json config:
79
113
 
@@ -110,72 +144,18 @@ Use them to reduce input tokens for repeated inspect and mutation work.
110
144
  Aliases are for aib request paths. They do not change TypeScript imports by themselves.
111
145
  For import style after mutations, use importRules.
112
146
 
113
- importRules control imports created or expanded by move/modulePlan mutation cleanup.
114
- They do not rewrite the whole project.
115
-
116
- AIB starts from IDE/TS import preferences.
117
- For mutation cleanup, matching importRules in aib.json take priority.
118
-
119
- Do not assume IDE/TS defaults match the repo style.
120
- Set importRules before large move/modulePlan work so imports do not need manual cleanup.
121
-
122
- Fields:
123
- scope repo-relative file or directory scope; most specific scope wins
124
- specifier relative|shortest|project-relative|non-relative
125
- ending auto|minimal|index|js
126
- builtin node|bare
127
- unusedImports remove|preserve
128
-
129
- Defaults:
130
- specifier omitted IDE/TS decides
131
- ending omitted IDE/TS decides
132
- builtin omitted keep TS/project builtin style
133
- unusedImports omitted keep unused imports
134
-
135
- specifier:
136
- relative best for local relative imports
137
- shortest best for shortest valid alias/path output
138
- project-relative best for root-relative project imports
139
- non-relative best for package or alias imports
140
-
141
- ending:
142
- minimal best for extensionless TS imports
143
- js best for ESM-style TS projects that require .js
144
- auto leaves the decision to TypeScript
145
- index best for explicit index import style
146
-
147
- builtin:
148
- node path -> node:path; best for explicit Node builtin imports
149
- bare node:path -> path; best for bare Node builtin imports
150
- omit field keeps TypeScript/project output; add builtin if agents keep fixing this manually
151
-
152
- unusedImports:
153
- remove clean unused imports in mutation-touched files
154
- preserve keep unused imports
155
- omit same as preserve
156
-
157
- Mutation-touched files are files where TS produced edits: source/target files and any reference/update files TS changed.
158
- Recommended value: remove
159
-
160
- importNormalize defines reusable defaults for aib imports normalize.
161
- Use it when the same normalize request would otherwise be repeated.
162
-
163
- It affects explicit import normalize commands only.
164
- It does not run automatically during move/modulePlan; use importRules for mutation-time cleanup.
165
-
166
- Fields:
167
- scope repo-relative file or directory scope; most specific scope wins
168
- to relative|alias|shortestAlias
169
- preferAlias tsconfig paths pattern used when to=alias
170
- exclude files, directories, or glob-like patterns to skip
171
-
172
- to:
173
- relative rewrite resolved local imports to relative paths
174
- alias rewrite resolved local imports to a matching tsconfig alias
175
- shortestAlias rewrite to the shortest valid alias specifier
176
-
177
- preferAlias:
178
- @shared/* prefer one alias pattern when several aliases can resolve the same file
147
+ importRules control imports created or expanded by move/modulePlan mutation cleanup.
148
+ They do not rewrite the whole project.
149
+
150
+ AIB starts from IDE/TS import preferences.
151
+ For mutation cleanup, matching importRules in aib.json take priority.
152
+
153
+ Do not assume IDE/TS defaults match the repo style.
154
+ Set importRules before large move/modulePlan work so imports do not need manual cleanup.
155
+
156
+ importNormalize defines default rules for explicit aib imports normalize commands.
157
+
158
+ It does not run automatically during move/modulePlan; use importRules for mutation-time cleanup.
179
159
 
180
160
  AIB has four config exclude fields:
181
161
  inspect.graph.exclude
@@ -189,9 +169,10 @@ Use config excludes for generated files, backups, local copies, nested workspace
189
169
 
190
170
  Graph excludes affect graph counts, hubs, entrypoints, leaves, edges, imports, importedBy, and saved graph files.
191
171
  Tree excludes affect directory/file discovery output.
192
- Tsconfig excludes affect which TypeScript configs AIB syncs and watches.
172
+ AIB syncs and watches visible tsconfigs.
173
+ sync.tsconfig.exclude affects which TypeScript configs AIB syncs and watches.
193
174
 
194
- Leave feedback while working.
175
+ Important: leave feedback while working.
195
176
 
196
177
  aib is built for agents. Agent feedback is the main signal for improving output, docs, mutations, and token efficiency.
197
178
 
@@ -347,6 +328,10 @@ incoming references/callers usages
347
328
  file/module connectivity graph
348
329
  compact directory layout tree
349
330
  repeated declarations/helpers duplicates
331
+ local import cycles cycles
332
+
333
+ Cycles are available but not expanded in bootstrap:
334
+ aib help inspect.cycles
350
335
 
351
336
  Prefer one batch DSL request for related questions.
352
337
 
@@ -701,6 +686,9 @@ Successful mutations update affected references and imports.
701
686
 
702
687
  After a successful mutation, do not manually patch the same imports unless aib reports a follow-up or checks show a real issue.
703
688
 
689
+ If move/modulePlan imports do not match the repo style, run:
690
+ aib help config-setup.import-rules
691
+
704
692
  AIB mutations are designed to reduce manual checking.
705
693
  Your job is to express the intent in DSL.
706
694
  AIB's job is to convert that intent into code changes.
@@ -762,6 +750,9 @@ Move is semantic; it moves supported declarations and updates affected imports/r
762
750
  Use it for focused extraction into a single target file.
763
751
  For large file splitting across several target files, use modulePlan.
764
752
 
753
+ If imports created by move do not match the repo style, run:
754
+ aib help config-setup.import-rules
755
+
765
756
  Move several entities into one target:
766
757
  Run:
767
758
  aib move toFile execute --stdin
@@ -777,6 +768,9 @@ Use it when a large file should be refactored into several target files.
777
768
 
778
769
  modulePlan orchestrates semantic moves and updates affected references/imports.
779
770
 
771
+ If imports created by modulePlan do not match the repo style, run:
772
+ aib help config-setup.import-rules
773
+
780
774
  Use +expectEmpty when your modulePlan intent is to move all declarations out of the source file.
781
775
  It does not change the move behavior; it only asks output to report remaining source declarations if any remain.
782
776
  Use it only when remaining declarations would mean the split did not match your intent.
@@ -901,12 +895,16 @@ aib view aib:res_<id_2> --except ClassB.bigB --except ClassC.bigC
901
895
 
902
896
  Quick Read
903
897
 
904
- Use qr to read arbitrary text files with compact, cross-platform line windows.
898
+ Use qr for cross-OS quick reads of text files: ts, js, cmd, sh, json, log, txt, ndjson, etc.
899
+ Use it for compact line windows and batching.
905
900
  qr supports AIB path aliases.
906
901
 
907
- qr is not a replacement for inspect.
902
+ It is not a replacement for inspect.
908
903
  Use it as a token-efficient way to read text data when semantic inspect is not needed.
909
904
 
905
+ For focused text reads, prefer qr over cat/Get-Content/type, especially when aliases, line windows, or batching help.
906
+ Use shell reads only when piping into shell tooling or qr is unavailable.
907
+
910
908
  Controls:
911
909
  -h N head; first N lines
912
910
  -t N tail; last N lines
@@ -932,3 +930,9 @@ aib qr @scripts/b.py -o 300 -l 50
932
930
  aib qr @logs/app.log -a
933
931
 
934
932
  Use stdin for several reads.
933
+
934
+ Need to see TypeScript configs in the repo:
935
+ aib reveal tsconfigs
936
+
937
+ Need to see TypeScript aliases across the repo:
938
+ aib reveal tsaliases
@@ -0,0 +1,56 @@
1
+ # Config Setup: Aliases
2
+
3
+ If you have not just checked the full config, check current aliases:
4
+
5
+ aib config aliases
6
+
7
+ pathAliases define short request aliases for paths agents repeat in AIB commands.
8
+ Use them to reduce input tokens for repeated inspect and mutation work.
9
+
10
+ Aliases are for AIB request paths.
11
+ They do not change TypeScript imports by themselves.
12
+ For import style after mutations, use importRules.
13
+
14
+ Check TypeScript aliases for hints:
15
+
16
+ aib reveal tsaliases
17
+
18
+ Use this to see existing tsconfig paths and baseUrl values.
19
+ They can reveal stable work areas, but they are not a list to copy.
20
+
21
+ Add pathAliases for long paths that are likely to appear repeatedly in AIB requests.
22
+ Prefer aliases for real work areas, package roots, or deep directories.
23
+
24
+ A good alias:
25
+ - saves meaningful path tokens;
26
+ - points to a stable work area;
27
+ - is easy to recognize later.
28
+
29
+ A bad alias:
30
+ - duplicates a short path like "src": "src", "packages": "packages", "scripts": "scripts";
31
+ - points to a rarely used folder;
32
+ - mirrors the directory tree without a workflow reason.
33
+
34
+ Having 20-30 good aliases is fine for a large repo or monorepo.
35
+
36
+ Example:
37
+
38
+ "pathAliases": {
39
+ "wstore": "apps/web/src/shared/store",
40
+ "wapi": "apps/web/src/shared/api",
41
+ "whooks": "apps/web/src/shared/utils/hooks",
42
+ "pmail": "packages/email/src",
43
+ "putils": "packages/utils/src",
44
+ "arules": "docs/agent/rules"
45
+ }
46
+
47
+ After editing aib.json, run:
48
+
49
+ aib sync
50
+
51
+ Verify aliases with a small tree or inspect request:
52
+
53
+ aib inspect --stdin
54
+
55
+ Input:
56
+ tree @<alias> depth=3 +onlyDirs limit=80
@@ -0,0 +1,45 @@
1
+ # Config Setup: Excludes
2
+
3
+ Tree excludes affect directory and file discovery output.
4
+ Graph excludes affect graph counts, hubs, entrypoints, leaves, edges, imports, importedBy, and saved graph views.
5
+
6
+ Built-in excludes already skip common noise such as node_modules, .git, dist, build, out, and .tmp.
7
+ Add config excludes for repository-specific noise.
8
+
9
+ For example, if the user often creates hard-copy directories or backup files before risky edits, those copies can make tree and graph output noisy.
10
+ Exclude them explicitly:
11
+
12
+ "inspect.tree.onlyDirs.exclude": [
13
+ "**/*copy",
14
+ "**/*copy/**"
15
+ ],
16
+ "inspect.tree.files.exclude": [
17
+ "**/* copy.ts",
18
+ "**/*.generated.ts"
19
+ ],
20
+ "inspect.graph.exclude": [
21
+ "**/* copy.ts",
22
+ "**/*.generated.ts",
23
+ "src/generated/**"
24
+ ]
25
+
26
+ Prefer narrow patterns for known noise:
27
+ - generated files;
28
+ - local copy/backup folders;
29
+ - build artifacts not already skipped by defaults;
30
+ - vendored or checked-in output.
31
+
32
+ These are common cases, not mandatory rules.
33
+ If the repository needs one of these areas for reasoning or mutation impact checks, do not exclude it.
34
+
35
+ Do not exclude broad source areas to make output smaller.
36
+ If output is too large, use scope, depth, limit, graph view, or graph toggles first.
37
+
38
+ After editing aib.json, run:
39
+
40
+ aib sync
41
+
42
+ Then verify with a compact tree request and the graph view that was noisy.
43
+
44
+ If excluded paths still appear, check the glob pattern against repo-relative paths.
45
+ If important source disappeared, narrow or remove the exclude.