@automaton-labs/aib 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/README.md +578 -0
  2. package/dist/bin/aib.js +2 -0
  3. package/dist/bin/cli.js +3 -0
  4. package/dist/client/http-client.js +1 -0
  5. package/dist/client/transport-options.js +1 -0
  6. package/dist/client/websocket-client.js +1 -0
  7. package/dist/commands/add-missing-imports-preview-cache.js +2 -0
  8. package/dist/commands/add-missing-imports.js +2 -0
  9. package/dist/commands/apply-module-plan.js +3 -0
  10. package/dist/commands/captured-input.js +2 -0
  11. package/dist/commands/config-command.js +3 -0
  12. package/dist/commands/diagnostics-command.js +3 -0
  13. package/dist/commands/doctor.js +1 -0
  14. package/dist/commands/entity-resolution.js +1 -0
  15. package/dist/commands/execution-command.js +1 -0
  16. package/dist/commands/feedback-command.js +3 -0
  17. package/dist/commands/find-importers.js +1 -0
  18. package/dist/commands/find-unused-imports.js +1 -0
  19. package/dist/commands/generate-docs-command.js +6 -0
  20. package/dist/commands/help-command.js +3 -0
  21. package/dist/commands/imports-command.js +1 -0
  22. package/dist/commands/init-skill-usage.js +3 -0
  23. package/dist/commands/init-workspace.js +3 -0
  24. package/dist/commands/inspect-cycles.js +5 -0
  25. package/dist/commands/inspect-format.js +18 -0
  26. package/dist/commands/inspect-graph.js +9 -0
  27. package/dist/commands/inspect-imports.js +2 -0
  28. package/dist/commands/inspect-symbol-query.js +1 -0
  29. package/dist/commands/inspect-tree.js +5 -0
  30. package/dist/commands/inspect.js +16 -0
  31. package/dist/commands/json-file-input.js +1 -0
  32. package/dist/commands/list-instances.js +1 -0
  33. package/dist/commands/module-plan-cache.js +2 -0
  34. package/dist/commands/module-plan-command.js +1 -0
  35. package/dist/commands/module-plan-timeout.js +1 -0
  36. package/dist/commands/move-command.js +1 -0
  37. package/dist/commands/move-preview-cache.js +2 -0
  38. package/dist/commands/move-to-file.js +2 -0
  39. package/dist/commands/mutation-execution-cache.js +3 -0
  40. package/dist/commands/normalize-imports.js +4 -0
  41. package/dist/commands/observability-command.js +3 -0
  42. package/dist/commands/ping.js +1 -0
  43. package/dist/commands/print-config.js +1 -0
  44. package/dist/commands/quick-read.js +11 -0
  45. package/dist/commands/refactor-batch-builder.js +1 -0
  46. package/dist/commands/refactor-batch-execution-cache.js +1 -0
  47. package/dist/commands/refactor-batch-preview-cache.js +2 -0
  48. package/dist/commands/refactor-batch.js +4 -0
  49. package/dist/commands/refactor-command.js +1 -0
  50. package/dist/commands/rename-command.js +1 -0
  51. package/dist/commands/rename-entities.js +4 -0
  52. package/dist/commands/rename-execution-cache.js +1 -0
  53. package/dist/commands/rename-input.js +1 -0
  54. package/dist/commands/rename-preview-cache.js +2 -0
  55. package/dist/commands/result-view.js +6 -0
  56. package/dist/commands/runtime-command.js +4 -0
  57. package/dist/commands/runtime-info.js +1 -0
  58. package/dist/commands/session-workspace.js +31 -0
  59. package/dist/commands/shared.js +1 -0
  60. package/dist/commands/sync-command.js +2 -0
  61. package/dist/commands/validate-module-plan.js +2 -0
  62. package/dist/commands/workspace-cache.js +1 -0
  63. package/dist/compatibility/policy.js +1 -0
  64. package/dist/config/auto-start-ide.js +1 -0
  65. package/dist/config/defaults.js +1 -0
  66. package/dist/config/env-vars.js +1 -0
  67. package/dist/config/glob-match.js +1 -0
  68. package/dist/config/import-rules.js +1 -0
  69. package/dist/config/local-config.js +3 -0
  70. package/dist/config/mutation-comments.js +1 -0
  71. package/dist/config/path-aliases.js +1 -0
  72. package/dist/config/path-display.js +1 -0
  73. package/dist/config/product-storage.js +1 -0
  74. package/dist/config/resolve-command-alias.js +1 -0
  75. package/dist/config/resolve.js +1 -0
  76. package/dist/config/workspace-root.js +3 -0
  77. package/dist/config/workspace-state.js +1 -0
  78. package/dist/content/content-bundle.js +1 -0
  79. package/dist/diagnostics/module-plan-timeline.js +2 -0
  80. package/dist/diagnostics/readiness-text.js +8 -0
  81. package/dist/discovery/registry.js +1 -0
  82. package/dist/discovery/select-instance.js +1 -0
  83. package/dist/dsl/aib-dsl.js +1 -0
  84. package/dist/help/bootstrap.md +924 -0
  85. package/dist/help/diagnostics/doctor.json +70 -0
  86. package/dist/help/docs/basics.md +14 -0
  87. package/dist/help/docs/dsl.md +25 -0
  88. package/dist/help/docs/help-format.md +12 -0
  89. package/dist/help/docs/imports.normalize.md +36 -0
  90. package/dist/help/docs/inspect.code.md +29 -0
  91. package/dist/help/docs/inspect.deps.md +32 -0
  92. package/dist/help/docs/inspect.duplicates.md +72 -0
  93. package/dist/help/docs/inspect.exports.md +34 -0
  94. package/dist/help/docs/inspect.file.md +32 -0
  95. package/dist/help/docs/inspect.graph.md +112 -0
  96. package/dist/help/docs/inspect.imports.md +15 -0
  97. package/dist/help/docs/inspect.md +71 -0
  98. package/dist/help/docs/inspect.members.md +24 -0
  99. package/dist/help/docs/inspect.tree.md +30 -0
  100. package/dist/help/docs/inspect.usages.md +48 -0
  101. package/dist/help/docs/modulePlan.md +51 -0
  102. package/dist/help/docs/move.md +37 -0
  103. package/dist/help/docs/mutation.md +47 -0
  104. package/dist/help/docs/patterns.md +178 -0
  105. package/dist/help/docs/prefs.md +40 -0
  106. package/dist/help/docs/qr.md +33 -0
  107. package/dist/help/docs/refactor.batch.md +44 -0
  108. package/dist/help/docs/rename.md +39 -0
  109. package/dist/help/docs/selectors.md +23 -0
  110. package/dist/help/docs/session.md +61 -0
  111. package/dist/help/docs/view.md +30 -0
  112. package/dist/help/dsl/bootstrap.md +924 -0
  113. package/dist/help/dsl/docs/basics.md +14 -0
  114. package/dist/help/dsl/docs/dsl.md +25 -0
  115. package/dist/help/dsl/docs/help-format.md +12 -0
  116. package/dist/help/dsl/docs/imports.normalize.md +36 -0
  117. package/dist/help/dsl/docs/inspect.code.md +29 -0
  118. package/dist/help/dsl/docs/inspect.deps.md +32 -0
  119. package/dist/help/dsl/docs/inspect.duplicates.md +72 -0
  120. package/dist/help/dsl/docs/inspect.exports.md +34 -0
  121. package/dist/help/dsl/docs/inspect.file.md +32 -0
  122. package/dist/help/dsl/docs/inspect.graph.md +112 -0
  123. package/dist/help/dsl/docs/inspect.imports.md +15 -0
  124. package/dist/help/dsl/docs/inspect.md +71 -0
  125. package/dist/help/dsl/docs/inspect.members.md +24 -0
  126. package/dist/help/dsl/docs/inspect.tree.md +30 -0
  127. package/dist/help/dsl/docs/inspect.usages.md +48 -0
  128. package/dist/help/dsl/docs/modulePlan.md +51 -0
  129. package/dist/help/dsl/docs/move.md +37 -0
  130. package/dist/help/dsl/docs/mutation.md +47 -0
  131. package/dist/help/dsl/docs/patterns.md +178 -0
  132. package/dist/help/dsl/docs/prefs.md +40 -0
  133. package/dist/help/dsl/docs/qr.md +33 -0
  134. package/dist/help/dsl/docs/refactor.batch.md +44 -0
  135. package/dist/help/dsl/docs/rename.md +39 -0
  136. package/dist/help/dsl/docs/selectors.md +23 -0
  137. package/dist/help/dsl/docs/session.md +61 -0
  138. package/dist/help/dsl/docs/view.md +30 -0
  139. package/dist/help/dsl/full.md +924 -0
  140. package/dist/help/dsl/snippets/agents.md +14 -0
  141. package/dist/help/dsl/topics/basics.md +12 -0
  142. package/dist/help/dsl/topics/dsl.md +23 -0
  143. package/dist/help/dsl/topics/help-format.md +10 -0
  144. package/dist/help/dsl/topics/imports.normalize.md +34 -0
  145. package/dist/help/dsl/topics/inspect.code.md +27 -0
  146. package/dist/help/dsl/topics/inspect.deps.md +30 -0
  147. package/dist/help/dsl/topics/inspect.duplicates.md +43 -0
  148. package/dist/help/dsl/topics/inspect.exports.md +32 -0
  149. package/dist/help/dsl/topics/inspect.file.md +30 -0
  150. package/dist/help/dsl/topics/inspect.graph.md +110 -0
  151. package/dist/help/dsl/topics/inspect.imports.md +13 -0
  152. package/dist/help/dsl/topics/inspect.md +69 -0
  153. package/dist/help/dsl/topics/inspect.members.md +22 -0
  154. package/dist/help/dsl/topics/inspect.tree.md +20 -0
  155. package/dist/help/dsl/topics/inspect.usages.md +46 -0
  156. package/dist/help/dsl/topics/modulePlan.md +38 -0
  157. package/dist/help/dsl/topics/move.md +27 -0
  158. package/dist/help/dsl/topics/mutation.md +45 -0
  159. package/dist/help/dsl/topics/patterns.md +176 -0
  160. package/dist/help/dsl/topics/prefs.md +38 -0
  161. package/dist/help/dsl/topics/qr.md +31 -0
  162. package/dist/help/dsl/topics/refactor.batch.md +33 -0
  163. package/dist/help/dsl/topics/rename.md +25 -0
  164. package/dist/help/dsl/topics/selectors.md +21 -0
  165. package/dist/help/dsl/topics/session.md +59 -0
  166. package/dist/help/dsl/topics/view.md +28 -0
  167. package/dist/help/full.md +924 -0
  168. package/dist/help/help-meta.json +113 -0
  169. package/dist/help/index.md +167 -0
  170. package/dist/help/json/bootstrap.md +1074 -0
  171. package/dist/help/json/docs/basics.md +15 -0
  172. package/dist/help/json/docs/dsl.md +25 -0
  173. package/dist/help/json/docs/help-format.md +12 -0
  174. package/dist/help/json/docs/imports.normalize.md +47 -0
  175. package/dist/help/json/docs/inspect.code.md +41 -0
  176. package/dist/help/json/docs/inspect.deps.md +46 -0
  177. package/dist/help/json/docs/inspect.duplicates.md +65 -0
  178. package/dist/help/json/docs/inspect.exports.md +40 -0
  179. package/dist/help/json/docs/inspect.file.md +38 -0
  180. package/dist/help/json/docs/inspect.graph.md +139 -0
  181. package/dist/help/json/docs/inspect.imports.md +15 -0
  182. package/dist/help/json/docs/inspect.md +87 -0
  183. package/dist/help/json/docs/inspect.members.md +32 -0
  184. package/dist/help/json/docs/inspect.tree.md +30 -0
  185. package/dist/help/json/docs/inspect.usages.md +61 -0
  186. package/dist/help/json/docs/modulePlan.md +70 -0
  187. package/dist/help/json/docs/move.md +53 -0
  188. package/dist/help/json/docs/mutation.md +62 -0
  189. package/dist/help/json/docs/patterns.md +178 -0
  190. package/dist/help/json/docs/prefs.md +40 -0
  191. package/dist/help/json/docs/qr.md +33 -0
  192. package/dist/help/json/docs/refactor.batch.md +72 -0
  193. package/dist/help/json/docs/rename.md +47 -0
  194. package/dist/help/json/docs/selectors.md +23 -0
  195. package/dist/help/json/docs/session.md +77 -0
  196. package/dist/help/json/docs/view.md +30 -0
  197. package/dist/help/json/full.md +1074 -0
  198. package/dist/help/json/snippets/agents.md +14 -0
  199. package/dist/help/json/topics/basics.md +13 -0
  200. package/dist/help/json/topics/dsl.md +23 -0
  201. package/dist/help/json/topics/help-format.md +10 -0
  202. package/dist/help/json/topics/imports.normalize.md +45 -0
  203. package/dist/help/json/topics/inspect.code.md +39 -0
  204. package/dist/help/json/topics/inspect.deps.md +44 -0
  205. package/dist/help/json/topics/inspect.duplicates.md +37 -0
  206. package/dist/help/json/topics/inspect.exports.md +38 -0
  207. package/dist/help/json/topics/inspect.file.md +36 -0
  208. package/dist/help/json/topics/inspect.graph.md +137 -0
  209. package/dist/help/json/topics/inspect.imports.md +13 -0
  210. package/dist/help/json/topics/inspect.md +85 -0
  211. package/dist/help/json/topics/inspect.members.md +30 -0
  212. package/dist/help/json/topics/inspect.tree.md +20 -0
  213. package/dist/help/json/topics/inspect.usages.md +59 -0
  214. package/dist/help/json/topics/modulePlan.md +57 -0
  215. package/dist/help/json/topics/move.md +43 -0
  216. package/dist/help/json/topics/mutation.md +60 -0
  217. package/dist/help/json/topics/patterns.md +176 -0
  218. package/dist/help/json/topics/prefs.md +38 -0
  219. package/dist/help/json/topics/qr.md +31 -0
  220. package/dist/help/json/topics/refactor.batch.md +61 -0
  221. package/dist/help/json/topics/rename.md +42 -0
  222. package/dist/help/json/topics/selectors.md +21 -0
  223. package/dist/help/json/topics/session.md +59 -0
  224. package/dist/help/json/topics/view.md +28 -0
  225. package/dist/help/snippets/agents.md +14 -0
  226. package/dist/help/topics/basics.md +12 -0
  227. package/dist/help/topics/dsl.md +23 -0
  228. package/dist/help/topics/help-format.md +10 -0
  229. package/dist/help/topics/imports.normalize.md +34 -0
  230. package/dist/help/topics/inspect.code.md +27 -0
  231. package/dist/help/topics/inspect.deps.md +30 -0
  232. package/dist/help/topics/inspect.duplicates.md +43 -0
  233. package/dist/help/topics/inspect.exports.md +32 -0
  234. package/dist/help/topics/inspect.file.md +30 -0
  235. package/dist/help/topics/inspect.graph.md +110 -0
  236. package/dist/help/topics/inspect.imports.md +13 -0
  237. package/dist/help/topics/inspect.md +69 -0
  238. package/dist/help/topics/inspect.members.md +22 -0
  239. package/dist/help/topics/inspect.tree.md +20 -0
  240. package/dist/help/topics/inspect.usages.md +46 -0
  241. package/dist/help/topics/modulePlan.md +38 -0
  242. package/dist/help/topics/move.md +27 -0
  243. package/dist/help/topics/mutation.md +45 -0
  244. package/dist/help/topics/patterns.md +176 -0
  245. package/dist/help/topics/prefs.md +38 -0
  246. package/dist/help/topics/qr.md +31 -0
  247. package/dist/help/topics/refactor.batch.md +33 -0
  248. package/dist/help/topics/rename.md +25 -0
  249. package/dist/help/topics/selectors.md +21 -0
  250. package/dist/help/topics/session.md +59 -0
  251. package/dist/help/topics/view.md +28 -0
  252. package/dist/ide-launch/common.cjs +162 -0
  253. package/dist/managed-host/extension-vsix-resolver.js +1 -0
  254. package/dist/managed-host/manage-serve-web-host.cjs +141 -0
  255. package/dist/managed-host/serve-web-autostart.js +1 -0
  256. package/dist/managed-host/serve-web-host.cjs +1790 -0
  257. package/dist/metrics/central-metrics.js +2 -0
  258. package/dist/observability/config.js +1 -0
  259. package/dist/observability/context.js +1 -0
  260. package/dist/observability/failure-snapshot.js +2 -0
  261. package/dist/observability/recent.js +2 -0
  262. package/dist/payloads/read-stdin-json.js +1 -0
  263. package/dist/runtime/bundled-node.js +1 -0
  264. package/dist/runtime/input-source.js +1 -0
  265. package/dist/runtime/managed-runtime-provisioning.js +1 -0
  266. package/dist/runtime/run-command.js +1 -0
  267. package/dist/selectors/parse-entities.js +1 -0
  268. package/dist/session/client.js +1 -0
  269. package/dist/session/paths.js +1 -0
  270. package/dist/session/server.js +6 -0
  271. package/dist/shared/agent-text.js +1 -0
  272. package/dist/shared/diagnostic-catalog.js +1 -0
  273. package/dist/shared/diagnostics.js +1 -0
  274. package/dist/shared/errors.js +28 -0
  275. package/dist/shared/event-loop.js +1 -0
  276. package/dist/shared/hints.js +1 -0
  277. package/dist/shared/metrics.js +1 -0
  278. package/dist/shared/operations.js +1 -0
  279. package/dist/shared/presentation.js +4 -0
  280. package/dist/shared/protocol.js +1 -0
  281. package/dist/shared/routes.js +1 -0
  282. package/dist/shared/stdout.js +2 -0
  283. package/dist/shared/types.js +1 -0
  284. package/dist/tracing/config.js +2 -0
  285. package/dist/tracing/trace.js +3 -0
  286. package/extension/vscode-refactor-bridge-extension.vsix +0 -0
  287. package/package.json +39 -0
  288. package/runtimes/launcher/win-x64/aib.exe +0 -0
  289. package/scripts/install-windows-launcher.cjs +58 -0
  290. package/scripts/postinstall.cjs +28 -0
  291. package/scripts/provision-runtime.cjs +299 -0
@@ -0,0 +1,1074 @@
1
+ AIB
2
+
3
+ aib is a local CLI for TS/JS code work backed by IDE and TypeScript APIs.
4
+ It can inspect symbols, usages, dependencies, duplicates, focused code, and run IDE-backed mutations.
5
+
6
+ aib is designed for agent workflows:
7
+ batch requests, compact text output, session handles, captured inputs, and reusable outputs.
8
+
9
+ Inline commands omit the aib prefix.
10
+ When you see:
11
+ session prefs get
12
+
13
+ Run:
14
+ aib session prefs get
15
+
16
+ Stdin examples show command and input separately to avoid shell-specific syntax.
17
+ Stdin Run lines include the aib prefix to avoid confusion.
18
+
19
+ PowerShell stdin shape:
20
+ @'
21
+ <input>
22
+ '@ | aib <command> --stdin
23
+
24
+ Basics
25
+
26
+ Use the active session while you work.
27
+ Reuse captured inputs when editing them is cheaper than rebuilding large JSON.
28
+
29
+ Examples are patterns, not limits.
30
+ Feature sections show common high-value uses, not every valid use.
31
+ Adapt requests to the task: combine features, batch related questions, and skip steps when you already have enough context.
32
+
33
+ Prefer batch JSON instead of inline calls.
34
+ One request can inspect/mutate several files/entities and save reusable outputs.
35
+ Use one-off commands only for small checks/changes.
36
+
37
+ For mutations, aib asks TS/IDE refactors to update affected references and imports.
38
+ 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.
39
+
40
+ Working patterns
41
+
42
+ Use aib before broad file reads when the question is about TS/JS structure, references, dependencies, or focused code.
43
+ Use normal text search when the question is just text.
44
+
45
+ For a first pass in a new codebase, map directories before reading files:
46
+
47
+ tree src depth=5 +onlyDirs limit=200
48
+
49
+ Start compact for broad scans.
50
+ Use summary, locations, or local graph views first when output could be large.
51
+ Expand to code or wider graph views only for the parts that matter now.
52
+ If output hides data and shows `view: aib:res_<id>`, use `aib view ...` to fetch only the hidden part instead of repeating the original request.
53
+
54
+ Compact output is a starting point, not a substitute for needed code.
55
+ Fetch exact code when correctness depends on implementation details.
56
+
57
+ Use prefs when the current phase repeats the same output shape.
58
+ Turn details off when they stop helping.
59
+ Turn them back on when they matter.
60
+
61
+ For mutation commands, set the shell/tool harness timeout to 3 minutes.
62
+
63
+ If a mutation command times out or returns no final output, use:
64
+
65
+ aib execution status last
66
+
67
+ This is an escape hatch for recovering the latest mutation status/result.
68
+
69
+ Before repeated mutation work, check aib config:
70
+
71
+ aib config
72
+
73
+ Set pathAliases for repeated request paths.
74
+ Set importRules so move/modulePlan create imports in the project style.
75
+
76
+ This avoids repeating long paths in requests and avoids manual import cleanup after mutations.
77
+ Do this before large move/modulePlan work, not after cleanup becomes repetitive.
78
+
79
+ Example aib.json config:
80
+
81
+ {
82
+ "pathAliases": {
83
+ "svc": "src/services",
84
+ "cli": "packages/cli/src",
85
+ "ext": "packages/extension/src"
86
+ },
87
+ "importRules": [
88
+ {
89
+ "scope": ".",
90
+ "specifier": "shortest",
91
+ "ending": "auto",
92
+ "builtin": "bare",
93
+ "unusedImports": "remove"
94
+ }
95
+ ],
96
+ "importNormalize": [
97
+ {
98
+ "scope": "src",
99
+ "to": "shortestAlias",
100
+ "exclude": ["src/generated"]
101
+ }
102
+ ],
103
+ "inspect.graph.exclude": [
104
+ "**/* copy.ts"
105
+ ]
106
+ }
107
+
108
+ pathAliases define short request aliases for paths agents repeat in aib commands.
109
+ Use them to reduce input tokens for repeated inspect and mutation work.
110
+
111
+ Aliases are for aib request paths. They do not change TypeScript imports by themselves.
112
+ For import style after mutations, use importRules.
113
+
114
+ importRules control imports created or expanded by move/modulePlan mutation cleanup.
115
+ They do not rewrite the whole project.
116
+
117
+ AIB starts from IDE/TS import preferences.
118
+ For mutation cleanup, matching importRules in aib.json take priority.
119
+
120
+ Do not assume IDE/TS defaults match the repo style.
121
+ Set importRules before large move/modulePlan work so imports do not need manual cleanup.
122
+
123
+ Fields:
124
+ scope repo-relative file or directory scope; most specific scope wins
125
+ specifier relative|shortest|project-relative|non-relative
126
+ ending auto|minimal|index|js
127
+ builtin node|bare
128
+ unusedImports remove|preserve
129
+
130
+ Defaults:
131
+ specifier omitted IDE/TS decides
132
+ ending omitted IDE/TS decides
133
+ builtin omitted keep TS/project builtin style
134
+ unusedImports omitted keep unused imports
135
+
136
+ specifier:
137
+ relative best for local relative imports
138
+ shortest best for shortest valid alias/path output
139
+ project-relative best for root-relative project imports
140
+ non-relative best for package or alias imports
141
+
142
+ ending:
143
+ minimal best for extensionless TS imports
144
+ js best for ESM-style TS projects that require .js
145
+ auto leaves the decision to TypeScript
146
+ index best for explicit index import style
147
+
148
+ builtin:
149
+ node path -> node:path; best for explicit Node builtin imports
150
+ bare node:path -> path; best for bare Node builtin imports
151
+ omit field keeps TypeScript/project output; add builtin if agents keep fixing this manually
152
+
153
+ unusedImports:
154
+ remove clean unused imports in mutation-touched files
155
+ preserve keep unused imports
156
+ omit same as preserve
157
+
158
+ Mutation-touched files are files where TS produced edits: source/target files and any reference/update files TS changed.
159
+ Recommended value: remove
160
+
161
+ importNormalize defines reusable defaults for aib imports normalize.
162
+ Use it when the same normalize request would otherwise be repeated.
163
+
164
+ It affects explicit import normalize commands only.
165
+ It does not run automatically during move/modulePlan; use importRules for mutation-time cleanup.
166
+
167
+ Fields:
168
+ scope repo-relative file or directory scope; most specific scope wins
169
+ to relative|alias|shortestAlias
170
+ preferAlias tsconfig paths pattern used when to=alias
171
+ exclude files, directories, or glob-like patterns to skip
172
+
173
+ to:
174
+ relative rewrite resolved local imports to relative paths
175
+ alias rewrite resolved local imports to a matching tsconfig alias
176
+ shortestAlias rewrite to the shortest valid alias specifier
177
+
178
+ preferAlias:
179
+ @shared/* prefer one alias pattern when several aliases can resolve the same file
180
+
181
+ inspect.graph.exclude skips files before graph builds the model.
182
+ Use it for generated files, backups, local copies, or other paths that make graph output noisy.
183
+
184
+ Excluded files do not affect graph counts, hubs, entrypoints, leaves, edges, imports, importedBy, or saved graph files.
185
+
186
+ Leave feedback while working.
187
+
188
+ aib is built for agents. Agent feedback is the main signal for improving output, docs, mutations, and token efficiency.
189
+
190
+ Use feedback when something is wrong, unclear, noisy, or could be more efficient.
191
+
192
+ Format:
193
+ feedback "kind | message"
194
+ feedback "kind | topic | message"
195
+
196
+ Kinds:
197
+ bug, confusion, friction, idea, other
198
+
199
+ Topic is optional. Choose any short topic that helps classify the feedback.
200
+
201
+ Example:
202
+ feedback "friction | imports | normalize required manual cleanup"
203
+
204
+ Session
205
+
206
+ Start by creating or selecting your session.
207
+ Create it once, then reuse it.
208
+ Do not create a new session for every command or subtask.
209
+
210
+ Session stores captured inputs, saved outputs, aliases, and prefs.
211
+
212
+ Prefer short session names:
213
+ aa, tr, qa, a2
214
+
215
+ Create:
216
+ session init --name <name>
217
+
218
+ Follow the command output.
219
+ If aib says multiple sessions exist, use the session you created explicitly:
220
+ aib -s <name> <command>
221
+
222
+ Or bind this shell:
223
+ AIB=<name>
224
+
225
+ If you want to prune session inputs/outputs, use:
226
+ session clear
227
+
228
+ After clear, keep using the same session.
229
+
230
+ Check:
231
+ session status
232
+
233
+ Reusable index handles look like:
234
+ `aib:graph:<name>` `aib:usages:<name>`
235
+
236
+ Pass index handles back to the matching inspect command with `--from-file` or `from` in DSL.
237
+
238
+ Every JSON stdin/from request is captured in the active session.
239
+
240
+ Latest captured input:
241
+ <session-dir>/inputs/<kind>/_last.json
242
+
243
+ Handle:
244
+ aib:input:<kind>:last
245
+
246
+ Use --from when editing the captured input costs less than rebuilding the request.
247
+ This is usually true for large batches, partial failures, or multi-step mutation plans.
248
+ For small one-off requests, write a corrected request instead.
249
+
250
+ Example:
251
+ A refactor batch moves symbols into 5 files.
252
+ The first 2 moves are done, and the 3rd fails in TypeScript.
253
+ Edit <session-dir>/inputs/refactor/_last.json:
254
+ - remove the already completed moves
255
+ - change or remove the failed move
256
+ - keep the remaining moves
257
+
258
+ Then rerun:
259
+ aib refactor batch <command> --from aib:input:refactor:last
260
+
261
+ Prefs
262
+
263
+ Prefs change defaults for the active session.
264
+ Use them when you want repeated CLI behavior without repeating request fields.
265
+
266
+ Set prefs:
267
+ session prefs set <name> <value> [<name> <value>...]
268
+
269
+ Example:
270
+ session prefs set inspect.graph.hubs false inspect.graph.leaves false
271
+
272
+ Show prefs:
273
+ session prefs get [prefix] [--all]
274
+
275
+ By default, get shows session overrides.
276
+ --all includes defaults.
277
+ prefix filters keys.
278
+
279
+ boolean = true|false
280
+ N = integer
281
+
282
+ Available prefs:
283
+ inspect.code.maxNonEmptyLines N
284
+ inspect.usages.maxLocations N
285
+ inspect.usages.maxCodeBlocks N
286
+ inspect.members.maxItems N
287
+ inspect.members.all boolean
288
+ inspect.graph.hubs boolean
289
+ inspect.graph.entrypoints boolean
290
+ inspect.graph.leaves boolean
291
+ inspect.graph.edges boolean
292
+ inspect.graph.symbolUsage boolean
293
+
294
+ Selectors identify symbols when names are ambiguous.
295
+ Use plain names when they are unambiguous.
296
+ Use selectors when aib reports ambiguity or when different symbol kinds share a name.
297
+
298
+ Example:
299
+ type WsOptions
300
+ class WsOptions
301
+
302
+ If aib needs the exact entity, use:
303
+ t-WsOptions
304
+ c-WsOptions
305
+
306
+ Selectors list:
307
+ f-name function
308
+ c-Name class
309
+ i-Name interface
310
+ t-Name type
311
+ v-name variable
312
+ e-Name enum
313
+ m-name method, usually with parent in JSON
314
+ p-name property, usually with parent in JSON
315
+
316
+ DSL request model:
317
+ - directives set defaults for following requests
318
+ - each request line can override defaults with key=value
319
+ - +flag means true
320
+ - -flag means false
321
+ - file/imports/exports/members/code/deps accept a path as the first positional argument; examples below use this shape.
322
+ - Use @file when several following operations share the same file.
323
+ - For one-off file operations, pass the path directly.
324
+
325
+ Syntax:
326
+ @file <path> default file
327
+ @source <path> default sourceFile for mutations
328
+ op arg arg key=value request
329
+ +flag boolean true
330
+ -flag boolean false
331
+ >name save reusable artifact when supported
332
+ old->new rename pair
333
+ Parent.member parent-qualified member
334
+ Parent.{a,b} several members under one parent
335
+ key=[a,b] list value for repeatable fields
336
+ file="path with spaces.ts" quote values with spaces
337
+ detail=sum|loc|code aliases for summary|locations|code
338
+ from=... alias for fromFile
339
+
340
+ Inspect
341
+
342
+ Inspect helps you turn an unknown code area into a small working model.
343
+
344
+ Use it to understand what exists, how pieces connect, what repeats, where a change can spread, and which exact code should enter context next.
345
+
346
+ One useful flow:
347
+ map -> focus -> code
348
+
349
+ map: learn what exists and how it connects
350
+ focus: choose files/entities/usages that matter
351
+ code: fetch exact code needed
352
+
353
+ Choose inspect operation:
354
+
355
+ declarations in one file file
356
+ static/dynamic imports imports
357
+ public API exports
358
+ methods/properties of parent members
359
+ exact implementation code
360
+ outgoing deps of one entity deps
361
+ incoming references/callers usages
362
+ file/module connectivity graph
363
+ compact directory layout tree
364
+ repeated declarations/helpers duplicates
365
+
366
+ Prefer one batch JSON request for related questions.
367
+ Top-level fields are defaults for every request.
368
+ A request without op uses the top-level op.
369
+ A request without file/scope/target uses the top-level value when applicable.
370
+ Each request may override any default.
371
+
372
+ Batch example:
373
+
374
+ Run:
375
+ aib inspect --stdin
376
+
377
+ Input:
378
+ {
379
+ "file": "src/service.ts",
380
+ "requests": [
381
+ { "op": "file" },
382
+ { "op": "members", "entity": "Service" },
383
+ {
384
+ "op": "code",
385
+ "entities": [
386
+ { "parent": "Service", "entities": ["render", "reset"] },
387
+ "normalize"
388
+ ],
389
+ "show": true,
390
+ "save": "service-focus"
391
+ },
392
+ {
393
+ "op": "usages",
394
+ "target": "src/service.ts",
395
+ "entity": "normalize",
396
+ "scope": "src",
397
+ "detail": "locations"
398
+ },
399
+ {
400
+ "op": "duplicates",
401
+ "scope": "src/scripts",
402
+ "detail": "summary",
403
+ "limit": 20
404
+ }
405
+ ]
406
+ }
407
+
408
+ Inspect controls:
409
+
410
+ file default file for requests
411
+ target file, dir, or symbol area to analyze
412
+ scope where to search; JSON scope:string|string[]
413
+ entity one symbol
414
+ entities several target symbols; JSON entities:[...]
415
+ parent class/interface parent for methods/properties
416
+ ranges include line/range metadata; JSON ranges:boolean; CLI --ranges
417
+ localOnly show local declarations and reexports without resolving facade API; JSON localOnly:boolean; CLI --local-only
418
+ resolveStar resolve export * through re-exported modules; JSON resolveStar:boolean; CLI --resolve-star
419
+ limit max items in one page; JSON limit:N; CLI --limit N
420
+ offset page offset; JSON offset:N; CLI --offset N
421
+ all return all items; JSON all:boolean; CLI --all
422
+ detail output level; JSON detail:summary|locations|code; CLI --detail summary|locations|code
423
+ show include code output; JSON show:boolean; CLI --show
424
+ save save reusable output; JSON save:"name"; CLI --save name
425
+ exclude skip names/selectors; JSON exclude:[...]
426
+ kinds restrict selector kinds; JSON kinds:["f","t"]
427
+
428
+ Inspect File
429
+
430
+ Use file to map top-level declarations physically present in one file.
431
+ Exported declarations are marked in the output.
432
+ It shows what lives in the file before you decide whether to read code.
433
+
434
+ Good for:
435
+ - mapping an unfamiliar file
436
+ - listing top-level declarations
437
+ - checking whether a file contains real declarations or mostly re-exports
438
+
439
+ Do not add limit just in case.
440
+ file output is compact and most files have far fewer than 100 top-level declarations.
441
+ Use limit only after file output is actually too large.
442
+
443
+ Controls:
444
+ file, ranges, localOnly
445
+
446
+ Specific:
447
+ localOnly show local declarations and reexports without resolving facade API; +localOnly
448
+
449
+ Defaults: +ranges
450
+ Use -ranges to show names without ranges.
451
+
452
+ Run:
453
+ aib inspect --stdin
454
+
455
+ Input:
456
+ {
457
+ "op": "file",
458
+ "file": "src/service.ts",
459
+ "requests": [
460
+ { "ranges": true },
461
+ { "file": "src/index.ts", "localOnly": true }
462
+ ]
463
+ }
464
+
465
+ inspect file src/service.ts [--ranges] [--local-only]
466
+
467
+ Inspect Imports
468
+
469
+ Use imports to inspect static and dynamic imports in a file.
470
+ If there are no dynamic imports, the dynamic imports block is omitted.
471
+
472
+ Controls:
473
+ file, ranges
474
+
475
+ Defaults: +ranges
476
+
477
+ Run:
478
+ aib inspect --stdin
479
+
480
+ Input:
481
+ imports @svc/service.ts
482
+
483
+ Inspect Exports
484
+
485
+ Use exports to see the public API of one file.
486
+ It answers what other files can import from that file.
487
+
488
+ Important:
489
+ inspect.file marks exported declarations already.
490
+
491
+ Do not batch this for a plain implementation file:
492
+ file src/service.ts
493
+ exports src/service.ts
494
+
495
+ Use exports when you need public module surface, barrels, re-exports, export *, or resolveStar.
496
+
497
+ Good for:
498
+ - checking a module boundary or public surface
499
+ - understanding facade/barrel files
500
+ - resolving export * when the local file only re-exports from elsewhere
501
+ - comparing API shape when public imports matter
502
+
503
+ Controls:
504
+ file, ranges, resolveStar
505
+
506
+ Specific:
507
+ resolveStar resolve export * through re-exported modules; +resolveStar
508
+
509
+ Run:
510
+ aib inspect --stdin
511
+
512
+ Input:
513
+ {
514
+ "op": "exports",
515
+ "file": "src/service.ts",
516
+ "requests": [
517
+ { "ranges": true },
518
+ { "file": "src/index.ts", "resolveStar": true }
519
+ ]
520
+ }
521
+
522
+ inspect exports src/service.ts [--ranges] [--resolve-star]
523
+
524
+ Inspect Members
525
+
526
+ Use members to map a class/interface/object-like symbol without reading its body.
527
+ It shows the internal shape of a parent entity without reading its full body.
528
+
529
+ Good for:
530
+ - listing member names when the parent entity is known
531
+ - narrowing a large parent entity to relevant members
532
+ - understanding object shape before changing or moving related code
533
+
534
+ Controls:
535
+ file, entity, entities, ranges, limit, offset, all
536
+
537
+ Run:
538
+ aib inspect --stdin
539
+
540
+ Input:
541
+ {
542
+ "file": "src/service.ts",
543
+ "op": "members",
544
+ "limit": 12,
545
+ "requests": [
546
+ { "entity": "Service" },
547
+ { "entities": ["ServiceOptions", "WsOptions"], "all": true }
548
+ ]
549
+ }
550
+
551
+ inspect members src/service.ts Service [--limit N] [--offset N] [--all] [--ranges]
552
+
553
+ Inspect Code
554
+
555
+ Use code to fetch exact declarations or members.
556
+ It returns focused code without reading the whole file.
557
+
558
+ Good for:
559
+ - reading a known function, class, method, or declaration
560
+ - fetching several related code blocks in one request
561
+ - keeping context focused on code needed for the current task
562
+
563
+ Controls:
564
+ file, entity, entities, parent, show, ranges
565
+
566
+ Specific:
567
+ show include source output
568
+
569
+ Defaults: +show +ranges
570
+ Use -show for names/ranges only.
571
+ Use -ranges for source without ranges.
572
+
573
+ Run:
574
+ aib inspect --stdin
575
+
576
+ Input:
577
+ {
578
+ "file": "src/service.ts",
579
+ "op": "code",
580
+ "requests": [
581
+ {
582
+ "entities": [
583
+ { "parent": "Service", "entities": ["render", "reset"] },
584
+ "normalize"
585
+ ],
586
+ "show": true,
587
+ "save": "service-focus"
588
+ }
589
+ ]
590
+ }
591
+
592
+ Inspect Deps
593
+
594
+ Use deps to see what one entity depends on inside its file.
595
+ It separates type-only dependencies from runtime value dependencies.
596
+
597
+ Good for:
598
+ - checking what a symbol may need when moved or extracted
599
+ - spotting nearby types, constants, or helpers tied to one entity
600
+ - deciding whether one symbol is standalone or tied to nearby declarations
601
+ - debugging mutation failures caused by local dependency shape
602
+
603
+ Controls:
604
+ file, entity, entities, parent
605
+
606
+ Run:
607
+ aib inspect --stdin
608
+
609
+ Input:
610
+ {
611
+ "file": "src/service.ts",
612
+ "op": "deps",
613
+ "requests": [
614
+ { "entity": "createService" },
615
+ {
616
+ "entities": [
617
+ { "parent": "Service", "entities": ["render", "reset"] }
618
+ ]
619
+ }
620
+ ]
621
+ }
622
+
623
+ Inspect Usages
624
+
625
+ Use usages to find who references a file, directory, or entity inside a scope.
626
+ It reports real references, not unused imports or text matches.
627
+ For broad impact checks, target-local usages are hidden automatically when the target is inside a wider scope.
628
+ Use includeTarget only when references inside the target file or directory matter.
629
+
630
+ Good for:
631
+ - checking impact before changing behavior
632
+ - finding consumers of an entity or module area
633
+ - confirming whether extracted or renamed code still has callers
634
+ - getting caller locations or caller code without broad file scans
635
+
636
+ Use locations for broad impact checks.
637
+ Use code when usage count is small or caller context matters now.
638
+
639
+ Controls:
640
+ target, scope, entity, entities, parent, detail, limit, all, save, includeTarget
641
+
642
+ Specific:
643
+ includeTarget include references inside the target file/directory; +includeTarget
644
+
645
+ Run:
646
+ aib inspect --stdin
647
+
648
+ Input:
649
+ {
650
+ "op": "usages",
651
+ "target": "src/service.ts",
652
+ "entities": [
653
+ "createService",
654
+ { "parent": "Service", "entities": ["render", "reset"] }
655
+ ],
656
+ "scope": ["src/app", "src/tests"],
657
+ "detail": "locations",
658
+ "save": "service-usages"
659
+ }
660
+
661
+ Inspect Graph
662
+
663
+ Use graph when the question is about file/module boundaries, not one symbol.
664
+ It builds a reusable map of local import relationships, then lets you focus files inside that map.
665
+
666
+ Good for:
667
+ - mapping an unfamiliar directory or subsystem
668
+ - seeing which files are hubs, entrypoints, or leaves
669
+ - comparing a few known areas without mapping all src
670
+ - choosing files/entities to inspect next
671
+ - checking module boundaries when ownership is unclear
672
+
673
+ Use deps for one entity's outgoing dependencies.
674
+ Use usages for real incoming references.
675
+ Use graph for file-level connectivity.
676
+
677
+ Model:
678
+ build graph: scope + view + save
679
+ query graph: fromFile + focus + output toggles
680
+
681
+ view controls what enters the saved graph.
682
+ focus only expands details for files already inside it.
683
+ If focus misses a file, rebuild with wider scope or view.
684
+
685
+ Default view:
686
+ directory scope -> local
687
+ file or multiple scopes -> neighbors
688
+ fromFile -> uses the saved graph
689
+
690
+ Views:
691
+ local only files inside scope; best directory map
692
+ neighbors direct import neighborhood; best file-centered map
693
+ expanded wider neighborhood; more output
694
+
695
+ Scope choice:
696
+ scope: "src" creates a broad reusable map for src.
697
+ scope: "src/services" is cheaper for local work.
698
+ scope: [...] compares known areas without mapping all src.
699
+
700
+ After you understand which graph sections matter, hide the rest with JSON fields or prefs.
701
+ Graph can be noisy; shape it for the current task.
702
+
703
+ Controls:
704
+ scope, view, from, focus, symbolUsage, edges, hubs, entrypoints, leaves, exclude, save
705
+
706
+ Specific:
707
+ view local|neighbors|expanded
708
+ from reuse saved graph index; from=aib:graph:<name>
709
+ focus focus a file inside the graph; focus=path
710
+ symbolUsage show imported symbols on edges; +symbolUsage
711
+
712
+ edges/hubs/entrypoints/leaves output section toggles; +name or -name
713
+
714
+ Run:
715
+ aib inspect --stdin
716
+
717
+ Input:
718
+ {
719
+ "op": "graph",
720
+ "requests": [
721
+ {
722
+ "scope": "src/services",
723
+ "view": "local",
724
+ "save": "services-graph"
725
+ },
726
+ {
727
+ "fromFile": "aib:graph:services-graph",
728
+ "focus": ["src/services/users.ts", "src/services/admins.ts"],
729
+ "symbolUsage": true,
730
+ "edges": false
731
+ }
732
+ ]
733
+ }
734
+
735
+ Focus saved graph later:
736
+ inspect graph --from-file aib:graph:services-graph --focus src/services/messages.ts --focus src/services/posts.ts --symbol-usage
737
+
738
+ Inline graph focus can add focus and symbolUsage.
739
+ Inline cannot hide graph sections such as edges/hubs/entrypoints/leaves.
740
+ Use JSON request fields or prefs for section control.
741
+
742
+ Inspect Tree
743
+
744
+ Use tree to list a compact directory layout.
745
+ It is useful before focused inspect when you know the area but not the exact file.
746
+
747
+ node_modules, .git, dist, build, out, and .tmp are skipped by default.
748
+
749
+ Controls:
750
+ scope, depth, minDepth, limit, include, exclude, onlyDirs
751
+
752
+ Specific:
753
+ depth max nesting depth; depth=N
754
+ minDepth hide shallower paths; minDepth=N
755
+ onlyDirs show directories only; +onlyDirs
756
+ exclude skip matching files/dirs
757
+ include only matching files/dirs; include=[...]
758
+
759
+ Run:
760
+ aib inspect --stdin
761
+
762
+ Input:
763
+ tree src depth=4 +onlyDirs limit=200
764
+ tree @svc depth=3 include=["**/*.ts"] exclude=["**/*.test.ts","**/* copy.ts"]
765
+
766
+ Inspect Duplicates
767
+
768
+ Use duplicates to find repeated top-level names and exact declaration copies.
769
+ It is useful when many files may contain copied local helpers, duplicated types, or repeated declarations.
770
+
771
+ Start with summary for broad scopes.
772
+ Use locations when you need files/lines.
773
+ Use code only for duplicate names you are ready to inspect.
774
+
775
+ Controls:
776
+ scope, detail, limit, offset, kinds, entities, exclude, pathExclude
777
+
778
+ Specific:
779
+ entities only these duplicate names/selectors
780
+ exclude skip these names/selectors
781
+ pathExclude skip files or path/glob-like patterns
782
+ kinds selector kinds, e.g. f, t, c, etc.; kinds=[...]
783
+
784
+ Run:
785
+ aib inspect --stdin
786
+
787
+ Input:
788
+ {
789
+ "scope": "src",
790
+ "detail": "summary",
791
+ "limit": 20
792
+ }
793
+
794
+ Mutation
795
+
796
+ Mutation commands change code through TS/IDE refactors.
797
+ Successful mutations update affected references and imports.
798
+
799
+ After a successful mutation, do not manually patch the same imports unless aib reports a follow-up or checks show a real issue.
800
+
801
+ AIB mutations are designed to reduce manual checking.
802
+ Your job is to express the intent in DSL.
803
+ AIB's job is to convert that intent into code changes.
804
+
805
+ Do not read all changed files just because a mutation touched them.
806
+ That defeats the purpose of using AIB for mechanical refactors.
807
+
808
+ If the command succeeds, the requested mechanical change was applied.
809
+ After failure or partial success, use the output to decide the next request.
810
+
811
+ When running mutation commands, set the harness timeout to 3 minutes.
812
+ If the harness stops waiting before final output appears, recover with:
813
+
814
+ aib execution status last
815
+
816
+ Modes:
817
+ preview inspect planned edits, then apply by id
818
+ apply write a previewed change
819
+ execute write immediately
820
+
821
+ Use execute for routine rename/move/modulePlan requests.
822
+
823
+ Use preview/apply when you are learning a mutation command, or when one request contains a large multi-step change that you want to inspect before writing files.
824
+ Typical examples: a huge modulePlan or refactor batch.
825
+
826
+ preview/apply uses more tool calls and more output tokens.
827
+ preview validates input and planned edits, but writing files can still hit a TS/IDE refactor error.
828
+ execute writes immediately and reports what changed.
829
+
830
+ If a mutation cannot be completed, aib reports the failed part and the captured input.
831
+ For large or partial requests, edit the captured input and rerun the remaining or changed intent.
832
+ For small requests, write a corrected request instead.
833
+
834
+ Prefer batch JSON for related mutations.
835
+ One request can describe several related changes.
836
+ aib captures JSON input automatically so large failed or partial requests can be edited and rerun.
837
+
838
+ When a batch mutation partly fails, split the next request by failure type.
839
+
840
+ If the failure is wrong input, fix the selector/entity/file and run the corrected remaining intent.
841
+ If TS/IDE cannot apply one part of the batch, do not treat the whole intent as failed.
842
+ Run the next request without the failed part and let aib report any later failures.
843
+ Then decide whether failed parts need smaller requests or manual fallback.
844
+
845
+ Rename
846
+
847
+ Rename is for semantic symbol renames.
848
+ It follows TypeScript references.
849
+ It is not plain-text replacement.
850
+
851
+ Run:
852
+ aib rename execute --stdin
853
+
854
+ Input:
855
+ {
856
+ "file": "src/service.ts",
857
+ "renames": {
858
+ "oldName": "newName",
859
+ "OldService": "NewService"
860
+ }
861
+ }
862
+
863
+ Move
864
+
865
+ Move transfers one or more symbols from one file to another.
866
+ Move is semantic; it moves supported declarations and updates affected imports/references.
867
+ Use it for focused extraction into a single target file.
868
+ For large file splitting across several target files, use modulePlan.
869
+
870
+ Move several entities into one target:
871
+ Run:
872
+ aib move toFile execute --stdin
873
+
874
+ Input:
875
+ {
876
+ "sourceFile": "src/service.ts",
877
+ "targetFile": "src/service.helpers.ts",
878
+ "entities": ["oldHelper", "OtherHelper"]
879
+ }
880
+
881
+ Module Plan
882
+
883
+ modulePlan is for splitting large files into smaller modules.
884
+ Use it when a large file should be refactored into several target files.
885
+
886
+ modulePlan orchestrates semantic moves and updates affected references/imports.
887
+
888
+ Use expectEmpty when your modulePlan intent is to move all declarations out of the source file.
889
+ It does not change the move behavior; it only asks output to report remaining source declarations if any remain.
890
+ Use it only when remaining declarations would mean the split did not match your intent.
891
+ Do not use it for partial extractions.
892
+
893
+ Split one large source file into several targets:
894
+ Run:
895
+ aib modulePlan execute --stdin
896
+
897
+ Input:
898
+ {
899
+ "sourceFile": "src/large-service.ts",
900
+ "expectEmpty": true,
901
+ "modules": [
902
+ {
903
+ "target": "src/large-service.types.ts",
904
+ "entities": ["ServiceOptions", "ServiceMode"]
905
+ },
906
+ {
907
+ "target": "src/large-service.core.ts",
908
+ "entities": ["LargeService", "createLargeService"]
909
+ }
910
+ ]
911
+ }
912
+
913
+ Refactor Batch
914
+
915
+ refactor batch runs related mutation requests together.
916
+ Use it when one workflow needs ordered steps, such as rename plus move.
917
+
918
+ Use modulePlan when the main intent is only to split one large file into target modules.
919
+ Use refactor batch when the split also includes coordinated renames or mixed mutation steps.
920
+
921
+ Example: rename and move in one request
922
+
923
+ Run:
924
+ aib refactor batch execute --stdin
925
+
926
+ Input:
927
+ {
928
+ "sourceFile": "src/service.ts",
929
+ "requests": [
930
+ {
931
+ "op": "rename",
932
+ "renames": {
933
+ "oldHelper": "newHelper",
934
+ "oldType": "newType"
935
+ }
936
+ },
937
+ {
938
+ "op": "move",
939
+ "targetFile": "src/service.helpers.ts",
940
+ "entities": ["newHelper"]
941
+ },
942
+ {
943
+ "op": "move",
944
+ "targetFile": "src/service.types.ts",
945
+ "entities": ["newType"]
946
+ }
947
+ ]
948
+ }
949
+
950
+ Imports Normalize
951
+
952
+ Use imports normalize for explicit import-style cleanup.
953
+ It rewrites resolved local import/export specifiers inside a chosen file or directory.
954
+
955
+ Use importNormalize in aib.json for repeated defaults.
956
+
957
+ Good for:
958
+ - converting one area to aliases or relative imports
959
+ - cleaning import style after manual edits or broad refactors
960
+ - applying the same import style to a directory without hand-editing files
961
+ - applying new tsconfig aliases after they are added
962
+
963
+ Controls:
964
+ scope file/dir scope to normalize
965
+ to relative|alias|shortestAlias
966
+ preferAlias select one tsconfig paths pattern when several aliases can resolve the same file
967
+ exclude files, directories, or glob-like patterns to skip
968
+ all show all planned edits; avoid on broad directory scopes
969
+
970
+ Run:
971
+ aib imports normalize preview --stdin
972
+
973
+ Input:
974
+ {
975
+ "scope": "src/services",
976
+ "to": "shortestAlias",
977
+ "exclude": ["src/services/generated", "**/* copy.ts"]
978
+ }
979
+
980
+ Rewrite imports found inside src/core.
981
+ When an imported file can be expressed through @features/*, prefer that alias.
982
+
983
+ Run:
984
+ aib imports normalize preview --stdin
985
+
986
+ Input:
987
+ {
988
+ "scope": "src/core",
989
+ "to": "alias",
990
+ "preferAlias": "@features/*"
991
+ }
992
+
993
+ With matching importNormalize config for this scope or a parent scope, use inline CLI commands:
994
+
995
+ imports normalize preview @svc
996
+ imports normalize execute @svc
997
+
998
+ JS/TS compatibility
999
+
1000
+ With tsconfig:
1001
+ TS/TSX inspect + rename + move + modulePlan
1002
+ JS/MJS/JSX ESM inspect + rename + move + modulePlan
1003
+ CJS / JS CommonJS inspect + rename
1004
+
1005
+ Without tsconfig:
1006
+ JS/MJS/JSX/CJS inspect only
1007
+ rename/move/modulePlan require tsconfig
1008
+
1009
+ CommonJS means .cjs or module.exports / exports.*.
1010
+
1011
+ View Hidden Output
1012
+
1013
+ AIB keeps large outputs compact.
1014
+ When part of a result is hidden, output may include:
1015
+
1016
+ view: aib:res_<id>
1017
+
1018
+ Use view to fetch the hidden part without repeating what you already saw.
1019
+
1020
+ When a batch has several hidden results of the same kind, output may include:
1021
+
1022
+ view all code: aib:res_<id>
1023
+ view all members: aib:res_<id>
1024
+
1025
+ A `view all` handle covers hidden parts from all results of that kind.
1026
+
1027
+ For code views, narrow what you fetch:
1028
+ only show only these hidden code entities
1029
+ except show all hidden code except these entities
1030
+
1031
+ Run:
1032
+ aib view --stdin
1033
+
1034
+ Input:
1035
+ view aib:res_<id_1> only=[ClassA.{bigA,bigB},bigQ,ClassB.bigB]
1036
+ view aib:res_<id_2> except=[ClassC.bigC]
1037
+
1038
+ Inline:
1039
+ aib view aib:res_<id_1> --only bigQ --only "ClassA.{bigA,bigB}"
1040
+ aib view aib:res_<id_2> --except ClassB.bigB --except ClassC.bigC
1041
+
1042
+ Quick Read
1043
+
1044
+ Use qr to read arbitrary text files with compact, cross-platform line windows.
1045
+ qr supports AIB path aliases.
1046
+
1047
+ qr is not a replacement for inspect.
1048
+ Use it as a token-efficient way to read text data when semantic inspect is not needed.
1049
+
1050
+ Controls:
1051
+ -h N head; first N lines
1052
+ -t N tail; last N lines
1053
+ -o N offset; starting line, 1-based
1054
+ -l N limit; line count for offset reads
1055
+ -a all; whole file
1056
+
1057
+ If no window is provided, qr uses -h 80.
1058
+ If -a is present, it wins over other window flags.
1059
+
1060
+ Run:
1061
+ aib qr --stdin
1062
+
1063
+ Input:
1064
+ qr @scripts/a.txt h=80
1065
+ qr @scripts/b.py o=300 l=50
1066
+ qr @scripts/c.md t=120
1067
+ qr @logs/app.log all
1068
+
1069
+ Inline:
1070
+ aib qr @scripts/a.txt -h 80
1071
+ aib qr @scripts/b.py -o 300 -l 50
1072
+ aib qr @logs/app.log -a
1073
+
1074
+ Use stdin for several reads.