oh-my-codex 0.12.5 → 0.12.6

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 (386) hide show
  1. package/Cargo.lock +5 -5
  2. package/Cargo.toml +1 -1
  3. package/README.md +17 -0
  4. package/dist/cli/__tests__/ask.test.js +26 -0
  5. package/dist/cli/__tests__/ask.test.js.map +1 -1
  6. package/dist/cli/__tests__/explore.test.js +95 -8
  7. package/dist/cli/__tests__/explore.test.js.map +1 -1
  8. package/dist/cli/__tests__/index.test.js +58 -0
  9. package/dist/cli/__tests__/index.test.js.map +1 -1
  10. package/dist/cli/__tests__/launch-fallback.test.js +169 -0
  11. package/dist/cli/__tests__/launch-fallback.test.js.map +1 -1
  12. package/dist/cli/__tests__/mcp-parity.test.js +31 -0
  13. package/dist/cli/__tests__/mcp-parity.test.js.map +1 -1
  14. package/dist/cli/__tests__/setup-agents-overwrite.test.js +66 -2
  15. package/dist/cli/__tests__/setup-agents-overwrite.test.js.map +1 -1
  16. package/dist/cli/__tests__/setup-refresh.test.js +11 -1
  17. package/dist/cli/__tests__/setup-refresh.test.js.map +1 -1
  18. package/dist/cli/__tests__/team.test.js +92 -0
  19. package/dist/cli/__tests__/team.test.js.map +1 -1
  20. package/dist/cli/__tests__/uninstall.test.js +14 -1
  21. package/dist/cli/__tests__/uninstall.test.js.map +1 -1
  22. package/dist/cli/cleanup.js +1 -1
  23. package/dist/cli/cleanup.js.map +1 -1
  24. package/dist/cli/constants.d.ts +1 -0
  25. package/dist/cli/constants.d.ts.map +1 -1
  26. package/dist/cli/constants.js +1 -0
  27. package/dist/cli/constants.js.map +1 -1
  28. package/dist/cli/explore.d.ts +1 -0
  29. package/dist/cli/explore.d.ts.map +1 -1
  30. package/dist/cli/explore.js +45 -1
  31. package/dist/cli/explore.js.map +1 -1
  32. package/dist/cli/index.d.ts +1 -1
  33. package/dist/cli/index.d.ts.map +1 -1
  34. package/dist/cli/index.js +103 -10
  35. package/dist/cli/index.js.map +1 -1
  36. package/dist/cli/mcp-parity.d.ts +1 -1
  37. package/dist/cli/mcp-parity.d.ts.map +1 -1
  38. package/dist/cli/mcp-parity.js +24 -0
  39. package/dist/cli/mcp-parity.js.map +1 -1
  40. package/dist/cli/setup.d.ts.map +1 -1
  41. package/dist/cli/setup.js +2 -2
  42. package/dist/cli/setup.js.map +1 -1
  43. package/dist/cli/team.d.ts.map +1 -1
  44. package/dist/cli/team.js +54 -14
  45. package/dist/cli/team.js.map +1 -1
  46. package/dist/cli/uninstall.d.ts.map +1 -1
  47. package/dist/cli/uninstall.js +1 -0
  48. package/dist/cli/uninstall.js.map +1 -1
  49. package/dist/config/__tests__/generator-idempotent.test.js +1 -0
  50. package/dist/config/__tests__/generator-idempotent.test.js.map +1 -1
  51. package/dist/config/__tests__/mcp-registry.test.js +61 -0
  52. package/dist/config/__tests__/mcp-registry.test.js.map +1 -1
  53. package/dist/config/__tests__/wiki-config-contract.test.d.ts +2 -0
  54. package/dist/config/__tests__/wiki-config-contract.test.d.ts.map +1 -0
  55. package/dist/config/__tests__/wiki-config-contract.test.js +19 -0
  56. package/dist/config/__tests__/wiki-config-contract.test.js.map +1 -0
  57. package/dist/config/generator.d.ts.map +1 -1
  58. package/dist/config/generator.js +8 -0
  59. package/dist/config/generator.js.map +1 -1
  60. package/dist/config/mcp-registry.d.ts +2 -0
  61. package/dist/config/mcp-registry.d.ts.map +1 -1
  62. package/dist/config/mcp-registry.js +12 -0
  63. package/dist/config/mcp-registry.js.map +1 -1
  64. package/dist/hooks/__tests__/agents-overlay.test.js +18 -0
  65. package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -1
  66. package/dist/hooks/__tests__/keyword-detector.test.js +75 -0
  67. package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -1
  68. package/dist/hooks/__tests__/notify-fallback-watcher.test.js +140 -1
  69. package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -1
  70. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js +35 -0
  71. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js.map +1 -1
  72. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js +86 -2
  73. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js.map +1 -1
  74. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js +176 -1
  75. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js.map +1 -1
  76. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +193 -0
  77. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -1
  78. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js +90 -2
  79. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js.map +1 -1
  80. package/dist/hooks/__tests__/session.test.js +41 -1
  81. package/dist/hooks/__tests__/session.test.js.map +1 -1
  82. package/dist/hooks/__tests__/wiki-docs-contract.test.d.ts +2 -0
  83. package/dist/hooks/__tests__/wiki-docs-contract.test.d.ts.map +1 -0
  84. package/dist/hooks/__tests__/wiki-docs-contract.test.js +34 -0
  85. package/dist/hooks/__tests__/wiki-docs-contract.test.js.map +1 -0
  86. package/dist/hooks/agents-overlay.d.ts.map +1 -1
  87. package/dist/hooks/agents-overlay.js +0 -1
  88. package/dist/hooks/agents-overlay.js.map +1 -1
  89. package/dist/hooks/extensibility/__tests__/dispatcher.test.js +32 -0
  90. package/dist/hooks/extensibility/__tests__/dispatcher.test.js.map +1 -1
  91. package/dist/hooks/extensibility/__tests__/sdk.test.js +33 -3
  92. package/dist/hooks/extensibility/__tests__/sdk.test.js.map +1 -1
  93. package/dist/hooks/extensibility/dispatcher.d.ts.map +1 -1
  94. package/dist/hooks/extensibility/dispatcher.js +41 -0
  95. package/dist/hooks/extensibility/dispatcher.js.map +1 -1
  96. package/dist/hooks/extensibility/sdk/runtime-state.d.ts.map +1 -1
  97. package/dist/hooks/extensibility/sdk/runtime-state.js +7 -1
  98. package/dist/hooks/extensibility/sdk/runtime-state.js.map +1 -1
  99. package/dist/hooks/keyword-detector.d.ts.map +1 -1
  100. package/dist/hooks/keyword-detector.js +42 -5
  101. package/dist/hooks/keyword-detector.js.map +1 -1
  102. package/dist/hooks/keyword-registry.d.ts.map +1 -1
  103. package/dist/hooks/keyword-registry.js +3 -0
  104. package/dist/hooks/keyword-registry.js.map +1 -1
  105. package/dist/hooks/session.d.ts.map +1 -1
  106. package/dist/hooks/session.js +26 -4
  107. package/dist/hooks/session.js.map +1 -1
  108. package/dist/hud/__tests__/state.test.js +27 -0
  109. package/dist/hud/__tests__/state.test.js.map +1 -1
  110. package/dist/hud/state.d.ts.map +1 -1
  111. package/dist/hud/state.js +3 -1
  112. package/dist/hud/state.js.map +1 -1
  113. package/dist/mcp/__tests__/bootstrap.test.js +65 -1
  114. package/dist/mcp/__tests__/bootstrap.test.js.map +1 -1
  115. package/dist/mcp/__tests__/state-server.test.js +31 -0
  116. package/dist/mcp/__tests__/state-server.test.js.map +1 -1
  117. package/dist/mcp/__tests__/wiki-server.test.d.ts +2 -0
  118. package/dist/mcp/__tests__/wiki-server.test.d.ts.map +1 -0
  119. package/dist/mcp/__tests__/wiki-server.test.js +30 -0
  120. package/dist/mcp/__tests__/wiki-server.test.js.map +1 -0
  121. package/dist/mcp/bootstrap.d.ts +18 -1
  122. package/dist/mcp/bootstrap.d.ts.map +1 -1
  123. package/dist/mcp/bootstrap.js +158 -0
  124. package/dist/mcp/bootstrap.js.map +1 -1
  125. package/dist/mcp/state-server.d.ts +4 -4
  126. package/dist/mcp/state-server.d.ts.map +1 -1
  127. package/dist/mcp/state-server.js +27 -22
  128. package/dist/mcp/state-server.js.map +1 -1
  129. package/dist/mcp/wiki-server.d.ts +181 -0
  130. package/dist/mcp/wiki-server.d.ts.map +1 -0
  131. package/dist/mcp/wiki-server.js +235 -0
  132. package/dist/mcp/wiki-server.js.map +1 -0
  133. package/dist/modes/__tests__/base-autoresearch-contract.test.js +22 -1
  134. package/dist/modes/__tests__/base-autoresearch-contract.test.js.map +1 -1
  135. package/dist/modes/base.d.ts.map +1 -1
  136. package/dist/modes/base.js +10 -0
  137. package/dist/modes/base.js.map +1 -1
  138. package/dist/notifications/__tests__/formatter.test.js +11 -0
  139. package/dist/notifications/__tests__/formatter.test.js.map +1 -1
  140. package/dist/notifications/__tests__/idle-cooldown.test.js +32 -1
  141. package/dist/notifications/__tests__/idle-cooldown.test.js.map +1 -1
  142. package/dist/notifications/__tests__/index.test.d.ts +2 -0
  143. package/dist/notifications/__tests__/index.test.d.ts.map +1 -0
  144. package/dist/notifications/__tests__/index.test.js +113 -0
  145. package/dist/notifications/__tests__/index.test.js.map +1 -0
  146. package/dist/notifications/__tests__/lifecycle-dedupe.test.d.ts +2 -0
  147. package/dist/notifications/__tests__/lifecycle-dedupe.test.d.ts.map +1 -0
  148. package/dist/notifications/__tests__/lifecycle-dedupe.test.js +86 -0
  149. package/dist/notifications/__tests__/lifecycle-dedupe.test.js.map +1 -0
  150. package/dist/notifications/__tests__/reply-listener.test.js +155 -0
  151. package/dist/notifications/__tests__/reply-listener.test.js.map +1 -1
  152. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.d.ts +2 -0
  153. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.d.ts.map +1 -0
  154. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.js +93 -0
  155. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.js.map +1 -0
  156. package/dist/notifications/__tests__/session-registry.test.js +48 -1
  157. package/dist/notifications/__tests__/session-registry.test.js.map +1 -1
  158. package/dist/notifications/__tests__/session-status.test.d.ts +2 -0
  159. package/dist/notifications/__tests__/session-status.test.d.ts.map +1 -0
  160. package/dist/notifications/__tests__/session-status.test.js +159 -0
  161. package/dist/notifications/__tests__/session-status.test.js.map +1 -0
  162. package/dist/notifications/__tests__/tmux.test.js +58 -1
  163. package/dist/notifications/__tests__/tmux.test.js.map +1 -1
  164. package/dist/notifications/idle-cooldown.d.ts +11 -0
  165. package/dist/notifications/idle-cooldown.d.ts.map +1 -1
  166. package/dist/notifications/idle-cooldown.js +42 -8
  167. package/dist/notifications/idle-cooldown.js.map +1 -1
  168. package/dist/notifications/index.d.ts +1 -1
  169. package/dist/notifications/index.d.ts.map +1 -1
  170. package/dist/notifications/index.js +41 -8
  171. package/dist/notifications/index.js.map +1 -1
  172. package/dist/notifications/lifecycle-dedupe.d.ts +8 -0
  173. package/dist/notifications/lifecycle-dedupe.d.ts.map +1 -0
  174. package/dist/notifications/lifecycle-dedupe.js +112 -0
  175. package/dist/notifications/lifecycle-dedupe.js.map +1 -0
  176. package/dist/notifications/reply-listener.d.ts +2 -0
  177. package/dist/notifications/reply-listener.d.ts.map +1 -1
  178. package/dist/notifications/reply-listener.js +42 -6
  179. package/dist/notifications/reply-listener.js.map +1 -1
  180. package/dist/notifications/session-registry.d.ts.map +1 -1
  181. package/dist/notifications/session-registry.js +7 -1
  182. package/dist/notifications/session-registry.js.map +1 -1
  183. package/dist/notifications/session-status.d.ts +23 -0
  184. package/dist/notifications/session-status.d.ts.map +1 -0
  185. package/dist/notifications/session-status.js +187 -0
  186. package/dist/notifications/session-status.js.map +1 -0
  187. package/dist/notifications/tmux.d.ts +10 -0
  188. package/dist/notifications/tmux.d.ts.map +1 -1
  189. package/dist/notifications/tmux.js +59 -5
  190. package/dist/notifications/tmux.js.map +1 -1
  191. package/dist/notifications/types.d.ts +2 -0
  192. package/dist/notifications/types.d.ts.map +1 -1
  193. package/dist/openclaw/__tests__/index.test.js +84 -0
  194. package/dist/openclaw/__tests__/index.test.js.map +1 -1
  195. package/dist/openclaw/index.d.ts.map +1 -1
  196. package/dist/openclaw/index.js +7 -14
  197. package/dist/openclaw/index.js.map +1 -1
  198. package/dist/openclaw/types.d.ts +2 -2
  199. package/dist/openclaw/types.d.ts.map +1 -1
  200. package/dist/scripts/__tests__/codex-native-hook.test.js +270 -1
  201. package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -1
  202. package/dist/scripts/__tests__/hook-derived-watcher.test.d.ts +2 -0
  203. package/dist/scripts/__tests__/hook-derived-watcher.test.d.ts.map +1 -0
  204. package/dist/scripts/__tests__/hook-derived-watcher.test.js +87 -0
  205. package/dist/scripts/__tests__/hook-derived-watcher.test.js.map +1 -0
  206. package/dist/scripts/codex-native-hook.d.ts.map +1 -1
  207. package/dist/scripts/codex-native-hook.js +134 -6
  208. package/dist/scripts/codex-native-hook.js.map +1 -1
  209. package/dist/scripts/hook-derived-watcher.js +43 -1
  210. package/dist/scripts/hook-derived-watcher.js.map +1 -1
  211. package/dist/scripts/notify-fallback-watcher.js +27 -2
  212. package/dist/scripts/notify-fallback-watcher.js.map +1 -1
  213. package/dist/scripts/notify-hook/auto-nudge.d.ts.map +1 -1
  214. package/dist/scripts/notify-hook/auto-nudge.js +17 -1
  215. package/dist/scripts/notify-hook/auto-nudge.js.map +1 -1
  216. package/dist/scripts/notify-hook/managed-tmux.d.ts.map +1 -1
  217. package/dist/scripts/notify-hook/managed-tmux.js +5 -3
  218. package/dist/scripts/notify-hook/managed-tmux.js.map +1 -1
  219. package/dist/scripts/notify-hook/team-dispatch.d.ts.map +1 -1
  220. package/dist/scripts/notify-hook/team-dispatch.js +305 -167
  221. package/dist/scripts/notify-hook/team-dispatch.js.map +1 -1
  222. package/dist/scripts/notify-hook/team-leader-nudge.d.ts.map +1 -1
  223. package/dist/scripts/notify-hook/team-leader-nudge.js +79 -3
  224. package/dist/scripts/notify-hook/team-leader-nudge.js.map +1 -1
  225. package/dist/scripts/notify-hook/tmux-injection.d.ts.map +1 -1
  226. package/dist/scripts/notify-hook/tmux-injection.js +2 -1
  227. package/dist/scripts/notify-hook/tmux-injection.js.map +1 -1
  228. package/dist/scripts/run-provider-advisor.js +20 -2
  229. package/dist/scripts/run-provider-advisor.js.map +1 -1
  230. package/dist/scripts/smoke-packed-install.d.ts +1 -8
  231. package/dist/scripts/smoke-packed-install.d.ts.map +1 -1
  232. package/dist/scripts/smoke-packed-install.js +12 -68
  233. package/dist/scripts/smoke-packed-install.js.map +1 -1
  234. package/dist/state/__tests__/operations.test.js +113 -0
  235. package/dist/state/__tests__/operations.test.js.map +1 -1
  236. package/dist/state/operations.d.ts +1 -1
  237. package/dist/state/operations.d.ts.map +1 -1
  238. package/dist/state/operations.js +88 -2
  239. package/dist/state/operations.js.map +1 -1
  240. package/dist/state/skill-active.d.ts +1 -1
  241. package/dist/state/skill-active.d.ts.map +1 -1
  242. package/dist/state/skill-active.js +1 -0
  243. package/dist/state/skill-active.js.map +1 -1
  244. package/dist/team/__tests__/api-interop.test.js +90 -0
  245. package/dist/team/__tests__/api-interop.test.js.map +1 -1
  246. package/dist/team/__tests__/hardening-e2e.test.js +17 -0
  247. package/dist/team/__tests__/hardening-e2e.test.js.map +1 -1
  248. package/dist/team/__tests__/runtime.test.js +23 -0
  249. package/dist/team/__tests__/runtime.test.js.map +1 -1
  250. package/dist/team/__tests__/tmux-session.test.js +210 -0
  251. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  252. package/dist/team/api-interop.d.ts.map +1 -1
  253. package/dist/team/api-interop.js +10 -1
  254. package/dist/team/api-interop.js.map +1 -1
  255. package/dist/team/delivery-log.d.ts +1 -1
  256. package/dist/team/delivery-log.d.ts.map +1 -1
  257. package/dist/team/delivery-log.js.map +1 -1
  258. package/dist/team/leader-activity.d.ts +1 -0
  259. package/dist/team/leader-activity.d.ts.map +1 -1
  260. package/dist/team/leader-activity.js +4 -2
  261. package/dist/team/leader-activity.js.map +1 -1
  262. package/dist/team/progress-evidence.d.ts +2 -0
  263. package/dist/team/progress-evidence.d.ts.map +1 -0
  264. package/dist/team/progress-evidence.js +77 -0
  265. package/dist/team/progress-evidence.js.map +1 -0
  266. package/dist/team/runtime.d.ts.map +1 -1
  267. package/dist/team/runtime.js +44 -0
  268. package/dist/team/runtime.js.map +1 -1
  269. package/dist/team/tmux-session.d.ts.map +1 -1
  270. package/dist/team/tmux-session.js +57 -8
  271. package/dist/team/tmux-session.js.map +1 -1
  272. package/dist/team/worktree.d.ts +6 -1
  273. package/dist/team/worktree.d.ts.map +1 -1
  274. package/dist/team/worktree.js +4 -2
  275. package/dist/team/worktree.js.map +1 -1
  276. package/dist/utils/__tests__/agents-md.test.js +21 -1
  277. package/dist/utils/__tests__/agents-md.test.js.map +1 -1
  278. package/dist/utils/__tests__/repo-deps.test.d.ts +2 -0
  279. package/dist/utils/__tests__/repo-deps.test.d.ts.map +1 -0
  280. package/dist/utils/__tests__/repo-deps.test.js +71 -0
  281. package/dist/utils/__tests__/repo-deps.test.js.map +1 -0
  282. package/dist/utils/agents-md.d.ts +1 -0
  283. package/dist/utils/agents-md.d.ts.map +1 -1
  284. package/dist/utils/agents-md.js +7 -3
  285. package/dist/utils/agents-md.js.map +1 -1
  286. package/dist/utils/paths.d.ts +4 -0
  287. package/dist/utils/paths.d.ts.map +1 -1
  288. package/dist/utils/paths.js +20 -0
  289. package/dist/utils/paths.js.map +1 -1
  290. package/dist/utils/repo-deps.d.ts +20 -0
  291. package/dist/utils/repo-deps.d.ts.map +1 -0
  292. package/dist/utils/repo-deps.js +78 -0
  293. package/dist/utils/repo-deps.js.map +1 -0
  294. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.d.ts +2 -0
  295. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.d.ts.map +1 -0
  296. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.js +54 -0
  297. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.js.map +1 -0
  298. package/dist/wiki/__tests__/cjk-tokenize.test.d.ts +12 -0
  299. package/dist/wiki/__tests__/cjk-tokenize.test.d.ts.map +1 -0
  300. package/dist/wiki/__tests__/cjk-tokenize.test.js +139 -0
  301. package/dist/wiki/__tests__/cjk-tokenize.test.js.map +1 -0
  302. package/dist/wiki/__tests__/crlf-parse.test.d.ts +2 -0
  303. package/dist/wiki/__tests__/crlf-parse.test.d.ts.map +1 -0
  304. package/dist/wiki/__tests__/crlf-parse.test.js +24 -0
  305. package/dist/wiki/__tests__/crlf-parse.test.js.map +1 -0
  306. package/dist/wiki/__tests__/escape-newline.test.d.ts +2 -0
  307. package/dist/wiki/__tests__/escape-newline.test.d.ts.map +1 -0
  308. package/dist/wiki/__tests__/escape-newline.test.js +45 -0
  309. package/dist/wiki/__tests__/escape-newline.test.js.map +1 -0
  310. package/dist/wiki/__tests__/ingest.test.d.ts +5 -0
  311. package/dist/wiki/__tests__/ingest.test.d.ts.map +1 -0
  312. package/dist/wiki/__tests__/ingest.test.js +181 -0
  313. package/dist/wiki/__tests__/ingest.test.js.map +1 -0
  314. package/dist/wiki/__tests__/lint.test.d.ts +5 -0
  315. package/dist/wiki/__tests__/lint.test.d.ts.map +1 -0
  316. package/dist/wiki/__tests__/lint.test.js +163 -0
  317. package/dist/wiki/__tests__/lint.test.js.map +1 -0
  318. package/dist/wiki/__tests__/query.test.d.ts +5 -0
  319. package/dist/wiki/__tests__/query.test.d.ts.map +1 -0
  320. package/dist/wiki/__tests__/query.test.js +141 -0
  321. package/dist/wiki/__tests__/query.test.js.map +1 -0
  322. package/dist/wiki/__tests__/reserved-file-guard.test.d.ts +2 -0
  323. package/dist/wiki/__tests__/reserved-file-guard.test.d.ts.map +1 -0
  324. package/dist/wiki/__tests__/reserved-file-guard.test.js +44 -0
  325. package/dist/wiki/__tests__/reserved-file-guard.test.js.map +1 -0
  326. package/dist/wiki/__tests__/session-hooks.test.d.ts +5 -0
  327. package/dist/wiki/__tests__/session-hooks.test.d.ts.map +1 -0
  328. package/dist/wiki/__tests__/session-hooks.test.js +36 -0
  329. package/dist/wiki/__tests__/session-hooks.test.js.map +1 -0
  330. package/dist/wiki/__tests__/slug-nonascii.test.d.ts +2 -0
  331. package/dist/wiki/__tests__/slug-nonascii.test.d.ts.map +1 -0
  332. package/dist/wiki/__tests__/slug-nonascii.test.js +24 -0
  333. package/dist/wiki/__tests__/slug-nonascii.test.js.map +1 -0
  334. package/dist/wiki/__tests__/storage.test.d.ts +5 -0
  335. package/dist/wiki/__tests__/storage.test.d.ts.map +1 -0
  336. package/dist/wiki/__tests__/storage.test.js +278 -0
  337. package/dist/wiki/__tests__/storage.test.js.map +1 -0
  338. package/dist/wiki/__tests__/test-helpers.d.ts +31 -0
  339. package/dist/wiki/__tests__/test-helpers.d.ts.map +1 -0
  340. package/dist/wiki/__tests__/test-helpers.js +108 -0
  341. package/dist/wiki/__tests__/test-helpers.js.map +1 -0
  342. package/dist/wiki/index.d.ts +14 -0
  343. package/dist/wiki/index.d.ts.map +1 -0
  344. package/dist/wiki/index.js +17 -0
  345. package/dist/wiki/index.js.map +1 -0
  346. package/dist/wiki/ingest.d.ts +20 -0
  347. package/dist/wiki/ingest.d.ts.map +1 -0
  348. package/dist/wiki/ingest.js +115 -0
  349. package/dist/wiki/ingest.js.map +1 -0
  350. package/dist/wiki/lifecycle.d.ts +20 -0
  351. package/dist/wiki/lifecycle.d.ts.map +1 -0
  352. package/dist/wiki/lifecycle.js +212 -0
  353. package/dist/wiki/lifecycle.js.map +1 -0
  354. package/dist/wiki/lint.d.ts +25 -0
  355. package/dist/wiki/lint.d.ts.map +1 -0
  356. package/dist/wiki/lint.js +166 -0
  357. package/dist/wiki/lint.js.map +1 -0
  358. package/dist/wiki/query.d.ts +36 -0
  359. package/dist/wiki/query.d.ts.map +1 -0
  360. package/dist/wiki/query.js +138 -0
  361. package/dist/wiki/query.js.map +1 -0
  362. package/dist/wiki/storage.d.ts +33 -0
  363. package/dist/wiki/storage.d.ts.map +1 -0
  364. package/dist/wiki/storage.js +321 -0
  365. package/dist/wiki/storage.js.map +1 -0
  366. package/dist/wiki/types.d.ts +83 -0
  367. package/dist/wiki/types.d.ts.map +1 -0
  368. package/dist/wiki/types.js +15 -0
  369. package/dist/wiki/types.js.map +1 -0
  370. package/package.json +3 -1
  371. package/skills/configure-notifications/SKILL.md +1 -0
  372. package/skills/doctor/SKILL.md +11 -0
  373. package/skills/omx-setup/SKILL.md +1 -1
  374. package/skills/wiki/SKILL.md +57 -0
  375. package/src/scripts/__tests__/codex-native-hook.test.ts +378 -0
  376. package/src/scripts/__tests__/hook-derived-watcher.test.ts +111 -0
  377. package/src/scripts/codex-native-hook.ts +187 -7
  378. package/src/scripts/hook-derived-watcher.ts +43 -1
  379. package/src/scripts/notify-fallback-watcher.ts +26 -2
  380. package/src/scripts/notify-hook/auto-nudge.ts +19 -1
  381. package/src/scripts/notify-hook/managed-tmux.ts +8 -3
  382. package/src/scripts/notify-hook/team-dispatch.ts +326 -168
  383. package/src/scripts/notify-hook/team-leader-nudge.ts +82 -3
  384. package/src/scripts/notify-hook/tmux-injection.ts +2 -1
  385. package/src/scripts/run-provider-advisor.ts +20 -2
  386. package/src/scripts/smoke-packed-install.ts +16 -83
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Wiki Lint
3
+ *
4
+ * Health checks for the wiki knowledge base.
5
+ * Detects orphan pages, stale content, broken cross-references,
6
+ * oversized pages, and structural contradictions.
7
+ */
8
+ import { DEFAULT_WIKI_CONFIG, } from './types.js';
9
+ import { readAllPages, appendLog, } from './storage.js';
10
+ /**
11
+ * Run health checks on the wiki.
12
+ *
13
+ * Checks performed:
14
+ * 1. Orphan pages — no incoming [[links]] from other pages
15
+ * 2. Stale pages — not updated in `staleDays` days
16
+ * 3. Broken cross-references — [[links]] to non-existent pages
17
+ * 4. Low confidence — pages marked as `confidence: low`
18
+ * 5. Oversized — content exceeds `maxPageSize` bytes
19
+ * 6. Structural contradictions — same topic with conflicting confidence/category
20
+ *
21
+ * @param root - Project root directory
22
+ * @param config - Wiki configuration (uses defaults if not provided)
23
+ * @returns Lint report with issues and stats
24
+ */
25
+ export function lintWiki(root, config = DEFAULT_WIKI_CONFIG) {
26
+ const pages = readAllPages(root);
27
+ const issues = [];
28
+ const pageFilenames = new Set(pages.map(p => p.filename));
29
+ // Build incoming link map
30
+ const incomingLinks = new Map();
31
+ for (const page of pages) {
32
+ for (const link of page.frontmatter.links) {
33
+ if (!incomingLinks.has(link))
34
+ incomingLinks.set(link, new Set());
35
+ incomingLinks.get(link).add(page.filename);
36
+ }
37
+ }
38
+ const now = Date.now();
39
+ const staleThresholdMs = config.staleDays * 24 * 60 * 60 * 1000;
40
+ for (const page of pages) {
41
+ // 1. Orphan detection — no incoming links from other pages
42
+ if (!incomingLinks.has(page.filename) || incomingLinks.get(page.filename).size === 0) {
43
+ issues.push({
44
+ page: page.filename,
45
+ severity: 'info',
46
+ type: 'orphan',
47
+ message: `No other pages link to "${page.frontmatter.title}"`,
48
+ });
49
+ }
50
+ // 2. Stale detection — not updated recently
51
+ const updatedAt = new Date(page.frontmatter.updated).getTime();
52
+ if (now - updatedAt > staleThresholdMs) {
53
+ const daysSince = Math.floor((now - updatedAt) / (24 * 60 * 60 * 1000));
54
+ issues.push({
55
+ page: page.filename,
56
+ severity: 'warning',
57
+ type: 'stale',
58
+ message: `"${page.frontmatter.title}" not updated in ${daysSince} days`,
59
+ });
60
+ }
61
+ // 3. Broken cross-references — links to non-existent pages
62
+ for (const link of page.frontmatter.links) {
63
+ if (!pageFilenames.has(link)) {
64
+ issues.push({
65
+ page: page.filename,
66
+ severity: 'error',
67
+ type: 'broken-ref',
68
+ message: `Broken link to "${link}" from "${page.frontmatter.title}"`,
69
+ });
70
+ }
71
+ }
72
+ // 4. Low confidence
73
+ if (page.frontmatter.confidence === 'low') {
74
+ issues.push({
75
+ page: page.filename,
76
+ severity: 'info',
77
+ type: 'low-confidence',
78
+ message: `"${page.frontmatter.title}" has low confidence — consider verifying or removing`,
79
+ });
80
+ }
81
+ // 5. Oversized pages
82
+ const contentSize = Buffer.byteLength(page.content, 'utf-8');
83
+ if (contentSize > config.maxPageSize) {
84
+ const sizeKB = (contentSize / 1024).toFixed(1);
85
+ issues.push({
86
+ page: page.filename,
87
+ severity: 'warning',
88
+ type: 'oversized',
89
+ message: `"${page.frontmatter.title}" is ${sizeKB}KB — consider splitting into smaller pages`,
90
+ });
91
+ }
92
+ }
93
+ // 6. Structural contradictions — same slug prefix with conflicting metadata
94
+ detectStructuralContradictions(pages, issues);
95
+ // Build stats
96
+ const stats = {
97
+ totalPages: pages.length,
98
+ orphanCount: issues.filter(i => i.type === 'orphan').length,
99
+ staleCount: issues.filter(i => i.type === 'stale').length,
100
+ brokenRefCount: issues.filter(i => i.type === 'broken-ref').length,
101
+ lowConfidenceCount: issues.filter(i => i.type === 'low-confidence').length,
102
+ oversizedCount: issues.filter(i => i.type === 'oversized').length,
103
+ contradictionCount: issues.filter(i => i.type === 'structural-contradiction').length,
104
+ };
105
+ // Log the lint operation
106
+ appendLog(root, {
107
+ timestamp: new Date().toISOString(),
108
+ operation: 'lint',
109
+ pagesAffected: [...new Set(issues.map(i => i.page))],
110
+ summary: `Lint: ${issues.length} issues (${stats.orphanCount} orphan, ${stats.staleCount} stale, ${stats.brokenRefCount} broken, ${stats.contradictionCount} contradictions)`,
111
+ });
112
+ return { issues, stats };
113
+ }
114
+ /**
115
+ * Detect structural contradictions:
116
+ * - Pages with overlapping tags but different categories
117
+ * - Pages with same slug prefix but different confidence levels
118
+ *
119
+ * NOTE: Semantic contradiction detection requires LLM integration (v2).
120
+ */
121
+ function detectStructuralContradictions(pages, issues) {
122
+ // Group by slug prefix (first segment before first hyphen-separated word boundary)
123
+ const slugGroups = new Map();
124
+ for (const page of pages) {
125
+ const prefix = page.filename.split('-').slice(0, 2).join('-');
126
+ if (!slugGroups.has(prefix))
127
+ slugGroups.set(prefix, []);
128
+ slugGroups.get(prefix).push(page);
129
+ }
130
+ for (const [_prefix, group] of slugGroups) {
131
+ if (group.length < 2)
132
+ continue;
133
+ // Check for conflicting confidence on same topic
134
+ const confidences = new Set(group.map(p => p.frontmatter.confidence));
135
+ if (confidences.size > 1 && confidences.has('high') && confidences.has('low')) {
136
+ const titles = group.map(p => `"${p.frontmatter.title}"`).join(', ');
137
+ issues.push({
138
+ page: group[0].filename,
139
+ severity: 'warning',
140
+ type: 'structural-contradiction',
141
+ message: `Conflicting confidence levels for related pages: ${titles}`,
142
+ });
143
+ }
144
+ // Check for overlapping tags with different categories
145
+ const tagCategoryPairs = new Map();
146
+ for (const page of group) {
147
+ for (const tag of page.frontmatter.tags) {
148
+ if (!tagCategoryPairs.has(tag))
149
+ tagCategoryPairs.set(tag, new Set());
150
+ tagCategoryPairs.get(tag).add(page.frontmatter.category);
151
+ }
152
+ }
153
+ for (const [tag, categories] of tagCategoryPairs) {
154
+ if (categories.size > 1) {
155
+ issues.push({
156
+ page: group[0].filename,
157
+ severity: 'info',
158
+ type: 'structural-contradiction',
159
+ message: `Tag "${tag}" appears in pages with different categories: ${[...categories].join(', ')}`,
160
+ });
161
+ break; // One contradiction per group is enough
162
+ }
163
+ }
164
+ }
165
+ }
166
+ //# sourceMappingURL=lint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/wiki/lint.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,SAAqB,mBAAmB;IAC7E,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE1D,0BAA0B;IAC1B,MAAM,aAAa,GAAG,IAAI,GAAG,EAAuB,CAAC;IACrD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YAC1C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CA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K,CAAC,CAAC,CAAC,CAAC,QAAQ;gBACvB,QAAQ,EAAE,SAAS;gBACnB,IAAI,EAAE,0BAA0B;gBAChC,OAAO,EAAE,oDAAoD,MAAM,EAAE;aACtE,CAAC,CAAC;QACL,CAAC;QAED,uDAAuD;QACvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAuB,CAAC;QACxD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;gBACxC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC;oBAAE,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;gBACrE,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAED,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,gBAAgB,EAAE,CAAC;YACjD,IAAI,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBACxB,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ;oBACvB,QAAQ,EAAE,MAAM;oBAChB,IAAI,EAAE,0BAA0B;oBAChC,OAAO,EAAE,QAAQ,GAAG,iDAAiD,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBAClG,CAAC,CAAC;gBACH,MAAM,CAAC,wCAAwC;YACjD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Wiki Query
3
+ *
4
+ * Keyword + tag search across all wiki pages.
5
+ * Returns matching pages with relevance snippets.
6
+ *
7
+ * NO vector embeddings — search is keyword-based only (hard constraint).
8
+ * The LLM caller synthesizes answers from returned matches.
9
+ */
10
+ import { type WikiQueryOptions, type WikiQueryMatch } from './types.js';
11
+ /**
12
+ * Tokenize text for search, with CJK bi-gram support.
13
+ *
14
+ * Latin/numeric words: split on whitespace.
15
+ * CJK characters (Han, Hangul, Kana): bi-grams (2-char sliding window)
16
+ * plus individual characters for single-char query support.
17
+ * Other scripts (Cyrillic, Arabic, Thai, etc.): whitespace split (fallback).
18
+ */
19
+ export declare function tokenize(text: string): string[];
20
+ /**
21
+ * Search wiki pages by keyword and/or tags.
22
+ *
23
+ * Matching strategy:
24
+ * 1. Tag match: pages whose tags intersect with query tags (highest weight)
25
+ * 2. Title match: pages whose title contains the query text
26
+ * 3. Content match: pages whose content contains the query text
27
+ *
28
+ * Results are scored and sorted by relevance (descending).
29
+ *
30
+ * @param root - Project root directory
31
+ * @param queryText - Search text (matched against title + content)
32
+ * @param options - Optional filters (tags, category, limit)
33
+ * @returns Matching pages with snippets, sorted by relevance
34
+ */
35
+ export declare function queryWiki(root: string, queryText: string, options?: WikiQueryOptions): WikiQueryMatch[];
36
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/wiki/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAMpB;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAiC/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,gBAAqB,GAC7B,cAAc,EAAE,CAiFlB"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Wiki Query
3
+ *
4
+ * Keyword + tag search across all wiki pages.
5
+ * Returns matching pages with relevance snippets.
6
+ *
7
+ * NO vector embeddings — search is keyword-based only (hard constraint).
8
+ * The LLM caller synthesizes answers from returned matches.
9
+ */
10
+ import { readAllPages, appendLog, } from './storage.js';
11
+ /**
12
+ * Tokenize text for search, with CJK bi-gram support.
13
+ *
14
+ * Latin/numeric words: split on whitespace.
15
+ * CJK characters (Han, Hangul, Kana): bi-grams (2-char sliding window)
16
+ * plus individual characters for single-char query support.
17
+ * Other scripts (Cyrillic, Arabic, Thai, etc.): whitespace split (fallback).
18
+ */
19
+ export function tokenize(text) {
20
+ const lower = text.toLowerCase();
21
+ const tokens = [];
22
+ // Latin/numeric tokens (including accented Latin: café, naïve, etc.)
23
+ const latinMatches = lower.match(/[a-z0-9\u00C0-\u024F]+/g);
24
+ if (latinMatches)
25
+ tokens.push(...latinMatches);
26
+ // CJK segments (Hiragana + Katakana + CJK Unified Ideographs + Hangul)
27
+ const cjkPattern = /[\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FFF\uAC00-\uD7AF]+/g;
28
+ const cjkMatches = lower.match(cjkPattern);
29
+ if (cjkMatches) {
30
+ for (const segment of cjkMatches) {
31
+ for (let i = 0; i < segment.length; i++) {
32
+ tokens.push(segment[i]);
33
+ }
34
+ for (let i = 0; i < segment.length - 1; i++) {
35
+ tokens.push(segment.slice(i, i + 2));
36
+ }
37
+ }
38
+ }
39
+ // Fallback: other scripts (Cyrillic, Arabic, Thai, Devanagari, etc.)
40
+ // Remove already-matched Latin and CJK, then whitespace-split the remainder
41
+ // Filter out pure-punctuation tokens to avoid false-positive matches.
42
+ const remaining = lower
43
+ .replace(/[a-z0-9\u00C0-\u024F]+/g, ' ')
44
+ .replace(cjkPattern, ' ')
45
+ .split(/\s+/)
46
+ .filter(t => t.length > 0 && /\p{L}/u.test(t));
47
+ if (remaining.length > 0)
48
+ tokens.push(...remaining);
49
+ return tokens;
50
+ }
51
+ /**
52
+ * Search wiki pages by keyword and/or tags.
53
+ *
54
+ * Matching strategy:
55
+ * 1. Tag match: pages whose tags intersect with query tags (highest weight)
56
+ * 2. Title match: pages whose title contains the query text
57
+ * 3. Content match: pages whose content contains the query text
58
+ *
59
+ * Results are scored and sorted by relevance (descending).
60
+ *
61
+ * @param root - Project root directory
62
+ * @param queryText - Search text (matched against title + content)
63
+ * @param options - Optional filters (tags, category, limit)
64
+ * @returns Matching pages with snippets, sorted by relevance
65
+ */
66
+ export function queryWiki(root, queryText, options = {}) {
67
+ const { tags: filterTags, category, limit = 20, logQuery = true } = options;
68
+ const pages = readAllPages(root);
69
+ const queryLower = queryText.toLowerCase();
70
+ const queryTerms = tokenize(queryText);
71
+ const matches = [];
72
+ for (const page of pages) {
73
+ // Category filter
74
+ if (category && page.frontmatter.category !== category)
75
+ continue;
76
+ let score = 0;
77
+ let snippet = '';
78
+ // Tag matching (weight: 3 per matching tag)
79
+ if (filterTags && filterTags.length > 0) {
80
+ const tagOverlap = filterTags.filter(t => page.frontmatter.tags.some(pt => pt.toLowerCase() === t.toLowerCase()));
81
+ score += tagOverlap.length * 3;
82
+ }
83
+ // Also match query terms against page tags
84
+ for (const term of queryTerms) {
85
+ if (page.frontmatter.tags.some(t => t.toLowerCase().includes(term))) {
86
+ score += 2;
87
+ }
88
+ }
89
+ // Title matching (weight: 5)
90
+ const titleLower = page.frontmatter.title.toLowerCase();
91
+ if (titleLower.includes(queryLower)) {
92
+ score += 5;
93
+ }
94
+ else {
95
+ for (const term of queryTerms) {
96
+ if (titleLower.includes(term))
97
+ score += 2;
98
+ }
99
+ }
100
+ // Content matching (weight: 1 per unique term match)
101
+ const contentLower = page.content.toLowerCase();
102
+ for (const term of queryTerms) {
103
+ const idx = contentLower.indexOf(term);
104
+ if (idx !== -1) {
105
+ score += 1;
106
+ // Extract snippet around first match
107
+ if (!snippet) {
108
+ const start = Math.max(0, idx - 40);
109
+ const end = Math.min(contentLower.length, idx + term.length + 80);
110
+ const raw = page.content.slice(start, end).replace(/\n+/g, ' ').trim();
111
+ snippet = (start > 0 ? '...' : '') + raw + (end < contentLower.length ? '...' : '');
112
+ }
113
+ }
114
+ }
115
+ if (score > 0) {
116
+ if (!snippet) {
117
+ // Default snippet: first non-empty line
118
+ snippet = page.content.split('\n').find(l => l.trim().length > 0)?.trim() || '';
119
+ if (snippet.length > 120)
120
+ snippet = snippet.slice(0, 117) + '...';
121
+ }
122
+ matches.push({ page, snippet, score });
123
+ }
124
+ }
125
+ // Sort by score descending
126
+ matches.sort((a, b) => b.score - a.score);
127
+ const limited = matches.slice(0, limit);
128
+ if (logQuery) {
129
+ appendLog(root, {
130
+ timestamp: new Date().toISOString(),
131
+ operation: 'query',
132
+ pagesAffected: limited.map(m => m.page.filename),
133
+ summary: `Query "${queryText}" → ${limited.length} results (of ${matches.length} total)`,
134
+ });
135
+ }
136
+ return limited;
137
+ }
138
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/wiki/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EACL,YAAY,EACZ,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,qEAAqE;IACrE,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5D,IAAI,YAAY;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;IAE/C,uEAAuE;IACvE,MAAM,UAAU,GAAG,0DAA0D,CAAC;IAC9E,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3C,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,MAAM,OAAO,IAAI,UAAU,EAAE,CAAC;YACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAA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M,GAAG,GAAG;oBAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;YACpE,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,2BAA2B;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAExC,IAAI,QAAQ,EAAE,CAAC;QACb,SAAS,CAAC,IAAI,EAAE;YACd,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,SAAS,EAAE,OAAO;YAClB,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;YAChD,OAAO,EAAE,UAAU,SAAS,OAAO,OAAO,CAAC,MAAM,gBAAgB,OAAO,CAAC,MAAM,SAAS;SACzF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Wiki Storage
3
+ *
4
+ * File I/O layer for the OMX wiki knowledge base.
5
+ */
6
+ import { type WikiLogEntry, type WikiPage, type WikiPageFrontmatter } from './types.js';
7
+ export declare function getWikiDir(root: string): string;
8
+ export declare function ensureWikiDir(root: string): string;
9
+ export declare function withWikiLock<T>(root: string, fn: () => T): T;
10
+ export declare function parseFrontmatter(raw: string): {
11
+ frontmatter: WikiPageFrontmatter;
12
+ content: string;
13
+ } | null;
14
+ export declare function serializePage(page: WikiPage): string;
15
+ export declare function readPage(root: string, filename: string): WikiPage | null;
16
+ export declare function listPages(root: string): string[];
17
+ export declare function readAllPages(root: string): WikiPage[];
18
+ export declare function readIndex(root: string): string | null;
19
+ export declare function readLog(root: string): string | null;
20
+ export declare function writePageUnsafe(root: string, page: WikiPage, options?: {
21
+ allowReserved?: boolean;
22
+ }): void;
23
+ export declare function deletePageUnsafe(root: string, filename: string): boolean;
24
+ export declare function updateIndexUnsafe(root: string): void;
25
+ export declare function appendLogUnsafe(root: string, entry: WikiLogEntry): void;
26
+ export declare function writePage(root: string, page: WikiPage, options?: {
27
+ allowReserved?: boolean;
28
+ }): void;
29
+ export declare function deletePage(root: string, filename: string): boolean;
30
+ export declare function appendLog(root: string, entry: WikiLogEntry): void;
31
+ export declare function titleToSlug(title: string): string;
32
+ export declare function normalizeWikiPageName(page: string): string;
33
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/wiki/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AAoDpB,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAelD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAM5D;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,WAAW,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA2B1G;AAqDD,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAepD;AAeD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAgBx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