@maadb/core 0.0.1 → 0.7.9

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 (407) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +371 -3
  3. package/dist/architect.d.ts +2 -0
  4. package/dist/architect.d.ts.map +1 -0
  5. package/dist/architect.js +273 -0
  6. package/dist/architect.js.map +1 -0
  7. package/dist/auth/resolve.d.ts +36 -0
  8. package/dist/auth/resolve.d.ts.map +1 -0
  9. package/dist/auth/resolve.js +77 -0
  10. package/dist/auth/resolve.js.map +1 -0
  11. package/dist/auth/token-store.d.ts +82 -0
  12. package/dist/auth/token-store.d.ts.map +1 -0
  13. package/dist/auth/token-store.js +464 -0
  14. package/dist/auth/token-store.js.map +1 -0
  15. package/dist/auth/types.d.ts +75 -0
  16. package/dist/auth/types.d.ts.map +1 -0
  17. package/dist/auth/types.js +15 -0
  18. package/dist/auth/types.js.map +1 -0
  19. package/dist/backend/adapter.d.ts +57 -0
  20. package/dist/backend/adapter.d.ts.map +1 -0
  21. package/dist/backend/adapter.js +6 -0
  22. package/dist/backend/adapter.js.map +1 -0
  23. package/dist/backend/index.d.ts +3 -0
  24. package/dist/backend/index.d.ts.map +1 -0
  25. package/dist/backend/index.js +2 -0
  26. package/dist/backend/index.js.map +1 -0
  27. package/dist/backend/sqlite/index.d.ts +63 -0
  28. package/dist/backend/sqlite/index.d.ts.map +1 -0
  29. package/dist/backend/sqlite/index.js +521 -0
  30. package/dist/backend/sqlite/index.js.map +1 -0
  31. package/dist/backend/sqlite/schema.d.ts +2 -0
  32. package/dist/backend/sqlite/schema.d.ts.map +1 -0
  33. package/dist/backend/sqlite/schema.js +88 -0
  34. package/dist/backend/sqlite/schema.js.map +1 -0
  35. package/dist/claude-md.d.ts +2 -0
  36. package/dist/claude-md.d.ts.map +1 -0
  37. package/dist/claude-md.js +97 -0
  38. package/dist/claude-md.js.map +1 -0
  39. package/dist/cli/commands/audit.d.ts +4 -0
  40. package/dist/cli/commands/audit.d.ts.map +1 -0
  41. package/dist/cli/commands/audit.js +39 -0
  42. package/dist/cli/commands/audit.js.map +1 -0
  43. package/dist/cli/commands/auth.d.ts +8 -0
  44. package/dist/cli/commands/auth.d.ts.map +1 -0
  45. package/dist/cli/commands/auth.js +242 -0
  46. package/dist/cli/commands/auth.js.map +1 -0
  47. package/dist/cli/commands/discover.d.ts +5 -0
  48. package/dist/cli/commands/discover.d.ts.map +1 -0
  49. package/dist/cli/commands/discover.js +48 -0
  50. package/dist/cli/commands/discover.js.map +1 -0
  51. package/dist/cli/commands/maintain.d.ts +6 -0
  52. package/dist/cli/commands/maintain.d.ts.map +1 -0
  53. package/dist/cli/commands/maintain.js +168 -0
  54. package/dist/cli/commands/maintain.js.map +1 -0
  55. package/dist/cli/commands/read.d.ts +7 -0
  56. package/dist/cli/commands/read.d.ts.map +1 -0
  57. package/dist/cli/commands/read.js +139 -0
  58. package/dist/cli/commands/read.js.map +1 -0
  59. package/dist/cli/commands/write.d.ts +4 -0
  60. package/dist/cli/commands/write.d.ts.map +1 -0
  61. package/dist/cli/commands/write.js +99 -0
  62. package/dist/cli/commands/write.js.map +1 -0
  63. package/dist/cli/helpers.d.ts +8 -0
  64. package/dist/cli/helpers.d.ts.map +1 -0
  65. package/dist/cli/helpers.js +17 -0
  66. package/dist/cli/helpers.js.map +1 -0
  67. package/dist/cli/index.d.ts +3 -0
  68. package/dist/cli/index.d.ts.map +1 -0
  69. package/dist/cli/index.js +296 -0
  70. package/dist/cli/index.js.map +1 -0
  71. package/dist/cli.d.ts +3 -0
  72. package/dist/cli.d.ts.map +1 -0
  73. package/dist/cli.js +7 -0
  74. package/dist/cli.js.map +1 -0
  75. package/dist/engine/audit.d.ts +15 -0
  76. package/dist/engine/audit.d.ts.map +1 -0
  77. package/dist/engine/audit.js +42 -0
  78. package/dist/engine/audit.js.map +1 -0
  79. package/dist/engine/composites.d.ts +6 -0
  80. package/dist/engine/composites.d.ts.map +1 -0
  81. package/dist/engine/composites.js +102 -0
  82. package/dist/engine/composites.js.map +1 -0
  83. package/dist/engine/context.d.ts +47 -0
  84. package/dist/engine/context.d.ts.map +1 -0
  85. package/dist/engine/context.js +55 -0
  86. package/dist/engine/context.js.map +1 -0
  87. package/dist/engine/docid-safe.d.ts +8 -0
  88. package/dist/engine/docid-safe.d.ts.map +1 -0
  89. package/dist/engine/docid-safe.js +0 -0
  90. package/dist/engine/docid-safe.js.map +1 -0
  91. package/dist/engine/helpers.d.ts +8 -0
  92. package/dist/engine/helpers.d.ts.map +1 -0
  93. package/dist/engine/helpers.js +102 -0
  94. package/dist/engine/helpers.js.map +1 -0
  95. package/dist/engine/index.d.ts +209 -0
  96. package/dist/engine/index.d.ts.map +1 -0
  97. package/dist/engine/index.js +489 -0
  98. package/dist/engine/index.js.map +1 -0
  99. package/dist/engine/indexing.d.ts +14 -0
  100. package/dist/engine/indexing.d.ts.map +1 -0
  101. package/dist/engine/indexing.js +225 -0
  102. package/dist/engine/indexing.js.map +1 -0
  103. package/dist/engine/journal.d.ts +32 -0
  104. package/dist/engine/journal.d.ts.map +1 -0
  105. package/dist/engine/journal.js +111 -0
  106. package/dist/engine/journal.js.map +1 -0
  107. package/dist/engine/logger.d.ts +19 -0
  108. package/dist/engine/logger.d.ts.map +1 -0
  109. package/dist/engine/logger.js +40 -0
  110. package/dist/engine/logger.js.map +1 -0
  111. package/dist/engine/maintenance.d.ts +15 -0
  112. package/dist/engine/maintenance.d.ts.map +1 -0
  113. package/dist/engine/maintenance.js +87 -0
  114. package/dist/engine/maintenance.js.map +1 -0
  115. package/dist/engine/mutex.d.ts +24 -0
  116. package/dist/engine/mutex.d.ts.map +1 -0
  117. package/dist/engine/mutex.js +50 -0
  118. package/dist/engine/mutex.js.map +1 -0
  119. package/dist/engine/pathguard.d.ts +16 -0
  120. package/dist/engine/pathguard.d.ts.map +1 -0
  121. package/dist/engine/pathguard.js +41 -0
  122. package/dist/engine/pathguard.js.map +1 -0
  123. package/dist/engine/reads.d.ts +24 -0
  124. package/dist/engine/reads.d.ts.map +1 -0
  125. package/dist/engine/reads.js +701 -0
  126. package/dist/engine/reads.js.map +1 -0
  127. package/dist/engine/types.d.ts +350 -0
  128. package/dist/engine/types.d.ts.map +1 -0
  129. package/dist/engine/types.js +5 -0
  130. package/dist/engine/types.js.map +1 -0
  131. package/dist/engine/writes.d.ts +10 -0
  132. package/dist/engine/writes.d.ts.map +1 -0
  133. package/dist/engine/writes.js +606 -0
  134. package/dist/engine/writes.js.map +1 -0
  135. package/dist/engine.d.ts +3 -0
  136. package/dist/engine.d.ts.map +1 -0
  137. package/dist/engine.js +6 -0
  138. package/dist/engine.js.map +1 -0
  139. package/dist/errors.d.ts +20 -0
  140. package/dist/errors.d.ts.map +1 -0
  141. package/dist/errors.js +17 -0
  142. package/dist/errors.js.map +1 -0
  143. package/dist/extractor/fields.d.ts +3 -0
  144. package/dist/extractor/fields.d.ts.map +1 -0
  145. package/dist/extractor/fields.js +58 -0
  146. package/dist/extractor/fields.js.map +1 -0
  147. package/dist/extractor/index.d.ts +7 -0
  148. package/dist/extractor/index.d.ts.map +1 -0
  149. package/dist/extractor/index.js +22 -0
  150. package/dist/extractor/index.js.map +1 -0
  151. package/dist/extractor/normalizers.d.ts +22 -0
  152. package/dist/extractor/normalizers.d.ts.map +1 -0
  153. package/dist/extractor/normalizers.js +250 -0
  154. package/dist/extractor/normalizers.js.map +1 -0
  155. package/dist/extractor/objects.d.ts +3 -0
  156. package/dist/extractor/objects.d.ts.map +1 -0
  157. package/dist/extractor/objects.js +33 -0
  158. package/dist/extractor/objects.js.map +1 -0
  159. package/dist/extractor/relationships.d.ts +3 -0
  160. package/dist/extractor/relationships.d.ts.map +1 -0
  161. package/dist/extractor/relationships.js +58 -0
  162. package/dist/extractor/relationships.js.map +1 -0
  163. package/dist/git/commit.d.ts +63 -0
  164. package/dist/git/commit.d.ts.map +1 -0
  165. package/dist/git/commit.js +161 -0
  166. package/dist/git/commit.js.map +1 -0
  167. package/dist/git/diff.d.ts +4 -0
  168. package/dist/git/diff.d.ts.map +1 -0
  169. package/dist/git/diff.js +56 -0
  170. package/dist/git/diff.js.map +1 -0
  171. package/dist/git/index.d.ts +41 -0
  172. package/dist/git/index.d.ts.map +1 -0
  173. package/dist/git/index.js +86 -0
  174. package/dist/git/index.js.map +1 -0
  175. package/dist/git/log.d.ts +13 -0
  176. package/dist/git/log.d.ts.map +1 -0
  177. package/dist/git/log.js +116 -0
  178. package/dist/git/log.js.map +1 -0
  179. package/dist/git/snapshot.d.ts +4 -0
  180. package/dist/git/snapshot.d.ts.map +1 -0
  181. package/dist/git/snapshot.js +65 -0
  182. package/dist/git/snapshot.js.map +1 -0
  183. package/dist/instance/config.d.ts +19 -0
  184. package/dist/instance/config.d.ts.map +1 -0
  185. package/dist/instance/config.js +107 -0
  186. package/dist/instance/config.js.map +1 -0
  187. package/dist/instance/pool.d.ts +138 -0
  188. package/dist/instance/pool.d.ts.map +1 -0
  189. package/dist/instance/pool.js +335 -0
  190. package/dist/instance/pool.js.map +1 -0
  191. package/dist/instance/session.d.ts +140 -0
  192. package/dist/instance/session.d.ts.map +1 -0
  193. package/dist/instance/session.js +267 -0
  194. package/dist/instance/session.js.map +1 -0
  195. package/dist/logging.d.ts +108 -0
  196. package/dist/logging.d.ts.map +1 -0
  197. package/dist/logging.js +120 -0
  198. package/dist/logging.js.map +1 -0
  199. package/dist/maad-md.d.ts +11 -0
  200. package/dist/maad-md.d.ts.map +1 -0
  201. package/dist/maad-md.js +252 -0
  202. package/dist/maad-md.js.map +1 -0
  203. package/dist/mcp/bulk-cap.d.ts +10 -0
  204. package/dist/mcp/bulk-cap.d.ts.map +1 -0
  205. package/dist/mcp/bulk-cap.js +37 -0
  206. package/dist/mcp/bulk-cap.js.map +1 -0
  207. package/dist/mcp/config.d.ts +18 -0
  208. package/dist/mcp/config.d.ts.map +1 -0
  209. package/dist/mcp/config.js +20 -0
  210. package/dist/mcp/config.js.map +1 -0
  211. package/dist/mcp/ctx.d.ts +17 -0
  212. package/dist/mcp/ctx.d.ts.map +1 -0
  213. package/dist/mcp/ctx.js +7 -0
  214. package/dist/mcp/ctx.js.map +1 -0
  215. package/dist/mcp/guardrails.d.ts +21 -0
  216. package/dist/mcp/guardrails.d.ts.map +1 -0
  217. package/dist/mcp/guardrails.js +39 -0
  218. package/dist/mcp/guardrails.js.map +1 -0
  219. package/dist/mcp/idempotency.d.ts +69 -0
  220. package/dist/mcp/idempotency.d.ts.map +1 -0
  221. package/dist/mcp/idempotency.js +168 -0
  222. package/dist/mcp/idempotency.js.map +1 -0
  223. package/dist/mcp/instance-reload.d.ts +23 -0
  224. package/dist/mcp/instance-reload.d.ts.map +1 -0
  225. package/dist/mcp/instance-reload.js +126 -0
  226. package/dist/mcp/instance-reload.js.map +1 -0
  227. package/dist/mcp/kinds.d.ts +22 -0
  228. package/dist/mcp/kinds.d.ts.map +1 -0
  229. package/dist/mcp/kinds.js +110 -0
  230. package/dist/mcp/kinds.js.map +1 -0
  231. package/dist/mcp/lifecycle.d.ts +8 -0
  232. package/dist/mcp/lifecycle.d.ts.map +1 -0
  233. package/dist/mcp/lifecycle.js +65 -0
  234. package/dist/mcp/lifecycle.js.map +1 -0
  235. package/dist/mcp/notifications.d.ts +87 -0
  236. package/dist/mcp/notifications.d.ts.map +1 -0
  237. package/dist/mcp/notifications.js +154 -0
  238. package/dist/mcp/notifications.js.map +1 -0
  239. package/dist/mcp/query-depth.d.ts +28 -0
  240. package/dist/mcp/query-depth.d.ts.map +1 -0
  241. package/dist/mcp/query-depth.js +43 -0
  242. package/dist/mcp/query-depth.js.map +1 -0
  243. package/dist/mcp/rate-limit.d.ts +60 -0
  244. package/dist/mcp/rate-limit.d.ts.map +1 -0
  245. package/dist/mcp/rate-limit.js +203 -0
  246. package/dist/mcp/rate-limit.js.map +1 -0
  247. package/dist/mcp/reload-signal.d.ts +13 -0
  248. package/dist/mcp/reload-signal.d.ts.map +1 -0
  249. package/dist/mcp/reload-signal.js +68 -0
  250. package/dist/mcp/reload-signal.js.map +1 -0
  251. package/dist/mcp/response.d.ts +109 -0
  252. package/dist/mcp/response.d.ts.map +1 -0
  253. package/dist/mcp/response.js +132 -0
  254. package/dist/mcp/response.js.map +1 -0
  255. package/dist/mcp/roles.d.ts +7 -0
  256. package/dist/mcp/roles.d.ts.map +1 -0
  257. package/dist/mcp/roles.js +56 -0
  258. package/dist/mcp/roles.js.map +1 -0
  259. package/dist/mcp/server.d.ts +33 -0
  260. package/dist/mcp/server.d.ts.map +1 -0
  261. package/dist/mcp/server.js +242 -0
  262. package/dist/mcp/server.js.map +1 -0
  263. package/dist/mcp/shutdown.d.ts +32 -0
  264. package/dist/mcp/shutdown.d.ts.map +1 -0
  265. package/dist/mcp/shutdown.js +130 -0
  266. package/dist/mcp/shutdown.js.map +1 -0
  267. package/dist/mcp/tools/audit.d.ts +4 -0
  268. package/dist/mcp/tools/audit.d.ts.map +1 -0
  269. package/dist/mcp/tools/audit.js +45 -0
  270. package/dist/mcp/tools/audit.js.map +1 -0
  271. package/dist/mcp/tools/auth.d.ts +4 -0
  272. package/dist/mcp/tools/auth.d.ts.map +1 -0
  273. package/dist/mcp/tools/auth.js +181 -0
  274. package/dist/mcp/tools/auth.js.map +1 -0
  275. package/dist/mcp/tools/discover.d.ts +4 -0
  276. package/dist/mcp/tools/discover.d.ts.map +1 -0
  277. package/dist/mcp/tools/discover.js +83 -0
  278. package/dist/mcp/tools/discover.js.map +1 -0
  279. package/dist/mcp/tools/instance.d.ts +15 -0
  280. package/dist/mcp/tools/instance.d.ts.map +1 -0
  281. package/dist/mcp/tools/instance.js +207 -0
  282. package/dist/mcp/tools/instance.js.map +1 -0
  283. package/dist/mcp/tools/maintain.d.ts +4 -0
  284. package/dist/mcp/tools/maintain.d.ts.map +1 -0
  285. package/dist/mcp/tools/maintain.js +118 -0
  286. package/dist/mcp/tools/maintain.js.map +1 -0
  287. package/dist/mcp/tools/read.d.ts +4 -0
  288. package/dist/mcp/tools/read.d.ts.map +1 -0
  289. package/dist/mcp/tools/read.js +260 -0
  290. package/dist/mcp/tools/read.js.map +1 -0
  291. package/dist/mcp/tools/write.d.ts +4 -0
  292. package/dist/mcp/tools/write.d.ts.map +1 -0
  293. package/dist/mcp/tools/write.js +342 -0
  294. package/dist/mcp/tools/write.js.map +1 -0
  295. package/dist/mcp/transport/auth.d.ts +41 -0
  296. package/dist/mcp/transport/auth.d.ts.map +1 -0
  297. package/dist/mcp/transport/auth.js +115 -0
  298. package/dist/mcp/transport/auth.js.map +1 -0
  299. package/dist/mcp/transport/http.d.ts +62 -0
  300. package/dist/mcp/transport/http.d.ts.map +1 -0
  301. package/dist/mcp/transport/http.js +357 -0
  302. package/dist/mcp/transport/http.js.map +1 -0
  303. package/dist/mcp/transport/pin.d.ts +15 -0
  304. package/dist/mcp/transport/pin.d.ts.map +1 -0
  305. package/dist/mcp/transport/pin.js +71 -0
  306. package/dist/mcp/transport/pin.js.map +1 -0
  307. package/dist/mcp/transport/telemetry.d.ts +79 -0
  308. package/dist/mcp/transport/telemetry.d.ts.map +1 -0
  309. package/dist/mcp/transport/telemetry.js +97 -0
  310. package/dist/mcp/transport/telemetry.js.map +1 -0
  311. package/dist/mcp/with-session.d.ts +26 -0
  312. package/dist/mcp/with-session.d.ts.map +1 -0
  313. package/dist/mcp/with-session.js +275 -0
  314. package/dist/mcp/with-session.js.map +1 -0
  315. package/dist/parser/annotations.d.ts +3 -0
  316. package/dist/parser/annotations.d.ts.map +1 -0
  317. package/dist/parser/annotations.js +41 -0
  318. package/dist/parser/annotations.js.map +1 -0
  319. package/dist/parser/blocks.d.ts +3 -0
  320. package/dist/parser/blocks.d.ts.map +1 -0
  321. package/dist/parser/blocks.js +99 -0
  322. package/dist/parser/blocks.js.map +1 -0
  323. package/dist/parser/frontmatter.d.ts +9 -0
  324. package/dist/parser/frontmatter.d.ts.map +1 -0
  325. package/dist/parser/frontmatter.js +33 -0
  326. package/dist/parser/frontmatter.js.map +1 -0
  327. package/dist/parser/index.d.ts +11 -0
  328. package/dist/parser/index.d.ts.map +1 -0
  329. package/dist/parser/index.js +54 -0
  330. package/dist/parser/index.js.map +1 -0
  331. package/dist/parser/matter.d.ts +3 -0
  332. package/dist/parser/matter.d.ts.map +1 -0
  333. package/dist/parser/matter.js +32 -0
  334. package/dist/parser/matter.js.map +1 -0
  335. package/dist/parser/tags.d.ts +3 -0
  336. package/dist/parser/tags.d.ts.map +1 -0
  337. package/dist/parser/tags.js +32 -0
  338. package/dist/parser/tags.js.map +1 -0
  339. package/dist/parser/verbatim.d.ts +4 -0
  340. package/dist/parser/verbatim.d.ts.map +1 -0
  341. package/dist/parser/verbatim.js +121 -0
  342. package/dist/parser/verbatim.js.map +1 -0
  343. package/dist/parser/yaml-profile.d.ts +4 -0
  344. package/dist/parser/yaml-profile.d.ts.map +1 -0
  345. package/dist/parser/yaml-profile.js +73 -0
  346. package/dist/parser/yaml-profile.js.map +1 -0
  347. package/dist/registry/index.d.ts +2 -0
  348. package/dist/registry/index.d.ts.map +1 -0
  349. package/dist/registry/index.js +2 -0
  350. package/dist/registry/index.js.map +1 -0
  351. package/dist/registry/loader.d.ts +4 -0
  352. package/dist/registry/loader.d.ts.map +1 -0
  353. package/dist/registry/loader.js +147 -0
  354. package/dist/registry/loader.js.map +1 -0
  355. package/dist/registry/types.d.ts +2 -0
  356. package/dist/registry/types.d.ts.map +1 -0
  357. package/dist/registry/types.js +5 -0
  358. package/dist/registry/types.js.map +1 -0
  359. package/dist/scanner.d.ts +57 -0
  360. package/dist/scanner.d.ts.map +1 -0
  361. package/dist/scanner.js +223 -0
  362. package/dist/scanner.js.map +1 -0
  363. package/dist/schema/index.d.ts +3 -0
  364. package/dist/schema/index.d.ts.map +1 -0
  365. package/dist/schema/index.js +3 -0
  366. package/dist/schema/index.js.map +1 -0
  367. package/dist/schema/loader.d.ts +4 -0
  368. package/dist/schema/loader.d.ts.map +1 -0
  369. package/dist/schema/loader.js +303 -0
  370. package/dist/schema/loader.js.map +1 -0
  371. package/dist/schema/precision.d.ts +6 -0
  372. package/dist/schema/precision.d.ts.map +1 -0
  373. package/dist/schema/precision.js +59 -0
  374. package/dist/schema/precision.js.map +1 -0
  375. package/dist/schema/validator.d.ts +21 -0
  376. package/dist/schema/validator.d.ts.map +1 -0
  377. package/dist/schema/validator.js +200 -0
  378. package/dist/schema/validator.js.map +1 -0
  379. package/dist/schema-md.d.ts +8 -0
  380. package/dist/schema-md.d.ts.map +1 -0
  381. package/dist/schema-md.js +98 -0
  382. package/dist/schema-md.js.map +1 -0
  383. package/dist/skill-files.d.ts +3 -0
  384. package/dist/skill-files.d.ts.map +1 -0
  385. package/dist/skill-files.js +362 -0
  386. package/dist/skill-files.js.map +1 -0
  387. package/dist/skills-scaffold.d.ts +10 -0
  388. package/dist/skills-scaffold.d.ts.map +1 -0
  389. package/dist/skills-scaffold.js +52 -0
  390. package/dist/skills-scaffold.js.map +1 -0
  391. package/dist/types.d.ts +309 -0
  392. package/dist/types.d.ts.map +1 -0
  393. package/dist/types.js +111 -0
  394. package/dist/types.js.map +1 -0
  395. package/dist/writer/index.d.ts +7 -0
  396. package/dist/writer/index.d.ts.map +1 -0
  397. package/dist/writer/index.js +32 -0
  398. package/dist/writer/index.js.map +1 -0
  399. package/dist/writer/serializer.d.ts +4 -0
  400. package/dist/writer/serializer.d.ts.map +1 -0
  401. package/dist/writer/serializer.js +103 -0
  402. package/dist/writer/serializer.js.map +1 -0
  403. package/dist/writer/template.d.ts +3 -0
  404. package/dist/writer/template.d.ts.map +1 -0
  405. package/dist/writer/template.js +27 -0
  406. package/dist/writer/template.js.map +1 -0
  407. package/package.json +59 -7
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luis Martinez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,373 @@
1
- # @maadb/core
1
+ # MAADb — Markdown As A Database
2
2
 
3
- Reserved — MAADB core engine. The real package ships soon.
3
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
+ [![Node.js](https://img.shields.io/badge/node-%E2%89%A524-brightgreen.svg)](package.json)
5
+ [![TypeScript](https://img.shields.io/badge/typescript-strict-blue.svg)](tsconfig.json)
6
+ [![Tests](https://img.shields.io/badge/tests-817%20passing-brightgreen.svg)](tests)
7
+ [![npm](https://img.shields.io/npm/v/@maadb/core.svg)](https://www.npmjs.com/package/@maadb/core)
8
+ [![Version](https://img.shields.io/badge/version-0.7.9-purple.svg)](Version.md)
4
9
 
5
- See [github.com/maadb/maadb](https://github.com/maadb/maadb) for the source and roadmap.
10
+ > **Markdown is the database. The engine makes it queryable.**
11
+
12
+ MAADb stores records as markdown files with YAML frontmatter for structured fields and body content for narrative. The engine validates schemas, builds a lookup index, and serves the whole thing to LLM agents over MCP. Your data stays in files you can read, grep, and version-control — not behind an opaque database server.
13
+
14
+ ## Why MAADb
15
+
16
+ - **Markdown is canonical.** Open any record in any text editor — your data is exactly what's on screen, no translation layer.
17
+ - **Git is the audit trail.** Every write is a commit. `maad_history` shows the full change history for any record.
18
+ - **LLM-native.** Ships with 30+ MCP tools for discovery, read, write, maintenance, and auth. Designed for agent workflows from the start.
19
+ - **Optional schemas.** Add YAML schemas when you want structure, skip them when you don't. Validation runs on writes, never on old records.
20
+ - **The index is a speed layer.** SQLite stores pointers into your markdown files. Delete it and it rebuilds — your data never depends on the index surviving.
21
+ - **Safe under concurrent writes.** Clean shutdown, lock recovery, rate limiting, retry-safe operations all built in.
22
+
23
+ ## Where MAADb fits
24
+
25
+ MAADb works as a context engine for AI agents — a place to hold the information they need to keep working, when that context still needs structure. Records are typed, relationships are queryable through MCP, and the data stays as readable markdown on disk. Common shapes: agent memory, project state, ongoing case files. For high-throughput transactional data or pure semantic retrieval at scale, purpose-built tools serve better.
26
+
27
+ ## Quick example
28
+
29
+ A record lives as markdown with a schema-validated YAML header:
30
+
31
+ ```markdown
32
+ ---
33
+ doc_id: cas-2026-001
34
+ doc_type: case
35
+ schema: case.v1
36
+ title: Contract Review Dispute
37
+ client: cli-acme
38
+ status: open
39
+ opened_at: 2026-04-01
40
+ ---
41
+
42
+ # Contract Review Dispute {#summary}
43
+
44
+ Dispute over delivery obligations and late change requests.
45
+
46
+ ## Timeline {#timeline}
47
+
48
+ Initial issue raised on [[date:2026-03-28|March 28, 2026]].
49
+
50
+ ## Parties {#parties}
51
+
52
+ [[person:Jane Smith|Jane]] representing [[org:Acme Corporation|Acme]].
53
+ ```
54
+
55
+ Three addressable layers:
56
+
57
+ - **Frontmatter** — structured fields, schema-validated on write.
58
+ - **Headings** — individually-readable sections via line pointers.
59
+ - **Inline annotations** — `[[type:value|label]]` entities extracted and indexed cross-document.
60
+
61
+ ## How it works
62
+
63
+ ```
64
+ Markdown files (your data)
65
+ -> YAML registry + schemas (define structure)
66
+ -> Engine (parse, validate, extract, index)
67
+ -> SQLite (pointer-only query index)
68
+ -> MCP server (LLM agent interface)
69
+ ```
70
+
71
+ See [docs/framework.md](docs/framework.md) for data doctrine, tier model, and engine design principles.
72
+
73
+ ## Architecture
74
+
75
+ Runtime layout, client to storage:
76
+
77
+ ```
78
+ ┌─ Client (agent) ────────────────────────────────────────┐
79
+ │ stdio subprocess or HTTP/SSE client │
80
+ └────────────────────────┬────────────────────────────────┘
81
+ │ MCP protocol
82
+ ┌────────────────────────▼────────────────────────────────┐
83
+ │ MCP server (one process per instance) │
84
+ │ • SessionRegistry — bind state, effective roles │
85
+ │ • EnginePool — one engine per bound project │
86
+ │ • TokenStore — HTTP transport only (0.7.0+) │
87
+ └────────────────────────┬────────────────────────────────┘
88
+
89
+ ┌────────────────────────▼────────────────────────────────┐
90
+ │ Instance │
91
+ │ instance.yaml — project declarations + roles │
92
+ │ _auth/tokens.yaml — per-agent tokens (HTTP only) │
93
+ └────────────────────────┬────────────────────────────────┘
94
+ │ N projects per instance
95
+ ┌────────────────────────▼────────────────────────────────┐
96
+ │ Project (each is a directory) │
97
+ │ _registry/ Type definitions │
98
+ │ _schema/ Field schemas per type │
99
+ │ _backend/ SQLite index (derived, gitignored) │
100
+ │ _import/ Drop zone for raw imports │
101
+ │ _skills/ Agent skill files │
102
+ │ MAAD.md Generated agent operating instructions │
103
+ │ <type-dirs>/ Records (paths declared in _registry/) │
104
+ └────────────────────────┬────────────────────────────────┘
105
+
106
+ ┌────────────────────────▼────────────────────────────────┐
107
+ │ Engine (per project) │
108
+ │ parse → validate → extract → index → git-commit │
109
+ └─────────────────────────────────────────────────────────┘
110
+ ```
111
+
112
+ **One instance, many projects.** The MCP server is instance-scoped; each bound session gets routed to the engine for its active project. Projects are filesystem-isolated — nothing in project A's engine touches project B.
113
+
114
+ **One engine, two interfaces.** The engine is the same whether you reach it over stdio (local subprocess, host user is the trust boundary) or HTTP/SSE (per-agent tokens, three-cap role composition).
115
+
116
+ **Two sources of truth on disk.** Markdown files are canonical — open any record in a text editor and you see exactly what the engine sees. SQLite is a rebuildable pointer index; delete `_backend/` and it rebuilds from the markdown on next operation.
117
+
118
+ ## Quick start
119
+
120
+ ### Install
121
+
122
+ Published on npm as [`@maadb/core`](https://www.npmjs.com/package/@maadb/core). No clone needed.
123
+
124
+ ```bash
125
+ # Run directly without installing
126
+ npx @maadb/core --help
127
+
128
+ # Or install globally
129
+ npm install -g @maadb/core
130
+ maad --help
131
+
132
+ # Or add as a project dependency
133
+ npm install @maadb/core
134
+ ```
135
+
136
+ To work on the engine itself, clone and build:
137
+
138
+ ```bash
139
+ git clone https://github.com/maadb/maadb.git
140
+ cd maadb
141
+ npm install && npm run build
142
+ ```
143
+
144
+ ### Single-project (simplest)
145
+
146
+ Wire up MCP in your agent (`.mcp.json` in the project directory):
147
+
148
+ ```json
149
+ {
150
+ "mcpServers": {
151
+ "maad": {
152
+ "command": "npx",
153
+ "args": [
154
+ "-y", "@maadb/core",
155
+ "--project", "/absolute/path/to/my-project",
156
+ "serve",
157
+ "--role", "admin"
158
+ ]
159
+ }
160
+ }
161
+ }
162
+ ```
163
+
164
+ (Or use `node /absolute/path/to/maadb/dist/cli.js ...` if running from a checkout.)
165
+
166
+ Same shape for Claude Desktop (`claude_desktop_config.json`) and OpenClaw. Any MCP-compatible agent works — stdio is the default, HTTP/SSE is available since 0.5.0.
167
+
168
+ Restart your agent. The agent detects an empty project and enters **Architect mode** to design the schema based on your goal:
169
+
170
+ > *"Set up a CRM for my law firm."*
171
+ > *"Index my research papers for querying."*
172
+ > *"Create a persistent memory store for this agent."*
173
+
174
+ The Architect skill handles type discovery, schema design, registry creation, and deployment. From there, any agent with an MCP connection can read and write records.
175
+
176
+ ### Multi-project (one server, many projects)
177
+
178
+ When one MCP server should serve more than one project — or when deploying over HTTP — use an **instance config**. `instance.yaml` is a deployment artifact, hand-written once by the operator and updated whenever projects are added, removed, or have their role ceilings changed. No CLI scaffolder exists yet.
179
+
180
+ Write `instance.yaml`:
181
+
182
+ ```yaml
183
+ name: my-instance
184
+ projects:
185
+ - name: alpha
186
+ path: /absolute/path/to/alpha
187
+ role: admin # role ceiling for this project
188
+ description: Primary project
189
+ - name: beta
190
+ path: ./beta # relative paths resolve against this file's directory
191
+ role: reader
192
+ ```
193
+
194
+ **Fields:**
195
+ - `name` (required) — instance label for logs/diagnostics
196
+ - `projects[]` (required, ≥1):
197
+ - `name` — slug `[a-z][a-z0-9_-]*`, unique within the instance. This is the **bind key** agents pass to `maad_use_project(s)`.
198
+ - `path` — absolute, or relative to the yaml file's directory.
199
+ - `role` — `reader | writer | admin` (default `reader`). This is the project's **role ceiling** — the server-assigned maximum. No session can exceed it.
200
+ - `description` — optional, surfaces in `maad_projects`.
201
+
202
+ Startup validates the file and fails fast on any error.
203
+
204
+ Serve:
205
+
206
+ ```bash
207
+ node dist/cli.js --instance /path/to/instance.yaml serve
208
+ ```
209
+
210
+ `--project` and `--instance` are mutually exclusive. `serve` with neither flag errors.
211
+
212
+ **Declaring new projects:** add another entry to `projects[]` and reload the server (`SIGHUP` / `systemctl reload maad` / `docker compose kill -s SIGHUP maad`). Projects not declared in `instance.yaml` are unreachable through MCP — there is no runtime add-project path.
213
+
214
+ ### Session binding
215
+
216
+ Before any data-tool call, a session must bind to a project via an instance-level tool (always visible pre-bind):
217
+
218
+ | Tool | Effect |
219
+ |---|---|
220
+ | `maad_projects` | Lists declared projects — discover bind keys |
221
+ | `maad_use_project <name> [as=<role>]` | **Single mode** — `project=` auto-defaults on every subsequent call |
222
+ | `maad_use_projects [names...] [as=<role>]` | **Multi mode** — every subsequent call must pass `project=<name>` |
223
+ | `maad_current_session` | Inspect bind state |
224
+
225
+ **Binding is monotonic and terminal.** `maad_use_project(s)` is one-shot:
226
+ - Second call (including re-binding to the same project) returns `SESSION_ALREADY_BOUND`.
227
+ - You cannot escalate single → multi mid-session.
228
+ - Rebinding requires disconnect + reconnect.
229
+
230
+ Default to multi mode unless you are certain the session touches exactly one project.
231
+
232
+ ### How roles are assigned
233
+
234
+ Roles are **server-assigned ceilings**. An agent never sets its own role — it can only accept a downgrade via `as=<role>` at bind time.
235
+
236
+ - **`instance.yaml` per-project `role:`** — set by the operator. This is the absolute ceiling for the project. Cannot be exceeded by any path.
237
+ - **`_auth/tokens.yaml` token caps** (HTTP only) — set by admin at token issuance. Per-token global role + per-project caps. Tokens are immutable; capability changes require revoke + reissue.
238
+ - **`as=<role>` at bind time** — agent-controlled, **downgrade only**. `as=admin` when the ceiling is `reader` fails `ROLE_UPGRADE_DENIED`.
239
+
240
+ **Effective role composition:**
241
+ - stdio: `min(project ceiling, as= requested)`
242
+ - HTTP: `min(project ceiling, token cap, as= requested)` — three-cap min rule, enforced on every tool call.
243
+
244
+ ### Isolation & escalation
245
+
246
+ - `instance.yaml` and `_auth/tokens.yaml` are filesystem-only artifacts. No MCP tool can read or modify them.
247
+ - Admin-tier MCP tools (`maad_issue_token`, `maad_revoke_token`, `maad_rotate_token`) require admin on **every** bound project. Reader/writer sessions cannot reach them.
248
+ - An admin session cannot issue a token that exceeds the instance project ceiling.
249
+ - Token records are append-only with revocation — never upgraded in place.
250
+ - Under stdio, the host machine's filesystem permissions are the trust boundary (role enforcement is advisory). Under HTTP, the token registry is the trust boundary.
251
+
252
+ ### Error taxonomy
253
+
254
+ | Code | When |
255
+ |---|---|
256
+ | `SESSION_UNBOUND` | data-tool call before any `maad_use_project(s)` |
257
+ | `SESSION_ALREADY_BOUND` | second `maad_use_project(s)` in the same session |
258
+ | `PROJECT_REQUIRED` | multi mode call missing `project=` |
259
+ | `PROJECT_NOT_WHITELISTED` | multi mode `project=` outside the whitelist |
260
+ | `PROJECT_UNKNOWN` | name not in `instance.yaml` |
261
+ | `INSUFFICIENT_ROLE` | tool requires higher role than session's effective role |
262
+ | `ROLE_UPGRADE_DENIED` | `as=` requests higher role than ceiling |
263
+ | `INSTANCE_CONFIG_INVALID` | startup-only; server refuses to start |
264
+ | `TOKEN_ROLE_ABOVE_GLOBAL` | token issuance: per-project role exceeds global |
265
+ | `TOKEN_PROJECT_FORBIDDEN` | token presented for a project outside its allowlist |
266
+
267
+ ## Remote / hosted deployment
268
+
269
+ MAADb serves over HTTP/SSE for multi-session hosted deployments. One process handles many concurrent client sessions with per-agent token auth at the handshake, concurrent reads, polling delta ([`maad_changes_since`](docs/change-feed.md)), live push notifications, and an unauthenticated `/healthz` liveness probe. TLS terminated upstream at a reverse proxy.
270
+
271
+ Generate a token from the CLI (plaintext printed ONCE; server stores only the SHA-256 hash):
272
+
273
+ ```bash
274
+ node dist/cli.js --instance /path/to/instance.yaml auth issue-token \
275
+ --role=admin --name='primary-gateway' --projects='*' --agent=agt-gateway
276
+ # → maad_pat_<32hex> on stdout
277
+ ```
278
+
279
+ Clients present that plaintext as `Authorization: Bearer <token>` on every HTTP request. Start the server:
280
+
281
+ ```bash
282
+ node dist/cli.js --instance /path/to/instance.yaml serve \
283
+ --transport http --http-host 127.0.0.1 --http-port 7733
284
+ ```
285
+
286
+ Hot-reload tokens + instance config on edits: `sudo systemctl reload maad` (or `docker compose kill -s SIGHUP maad`). Rotate tokens via `maad auth rotate-token --id=tok-<id>`; revoke via `maad auth revoke-token --id=tok-<id>`. Full auth primitives: [`docs/specs/0.7.0-scoped-auth.md`](docs/specs/0.7.0-scoped-auth.md).
287
+
288
+ Deployment guides:
289
+
290
+ - [systemd + nginx (bare metal)](docs/deploy/systemd.md)
291
+ - [Docker + traefik](docs/deploy/docker.md)
292
+ - [Change feed — polling patterns + cadence](docs/change-feed.md)
293
+
294
+ ## Access roles
295
+
296
+ MCP roles control what tools an agent can use. Ceiling set per project in `instance.yaml`; assignment mechanics and three-cap composition detailed in [How roles are assigned](#how-roles-are-assigned).
297
+
298
+ | Role | Tools | Use case |
299
+ |------|-------|----------|
300
+ | `reader` (default) | scan, summary, describe, get, query, search, related, schema, aggregate, join, verify, changes_since, history, audit | Read-only agents, reporting, analysis |
301
+ | `writer` | reader + create, update, validate, bulk_create, bulk_update | Standard agents that read and write records |
302
+ | `admin` | writer + delete, reindex, reload, health | Project setup, schema changes, maintenance |
303
+
304
+ ## Project layout
305
+
306
+ A MAADb project is a directory. `maad init <dir>` scaffolds the structure:
307
+
308
+ ```
309
+ my-project/
310
+ _registry/ # Type definitions (YAML)
311
+ object_types.yaml
312
+ _schema/ # Field schemas per type (YAML)
313
+ case.v1.yaml
314
+ _backend/ # SQLite index — gitignored, rebuildable
315
+ maad.db
316
+ _import/ # Drop zone for raw markdown imports
317
+ _skills/ # Agent skill files (architect, import, etc.)
318
+ MAAD.md # Generated: stable agent operating instructions
319
+ CLAUDE.md # Generated: MCP-first agent workflow guide
320
+ <type-dirs>/ # Record files — one directory per type
321
+ cas-2026-001.md
322
+ ```
323
+
324
+ **Convention:** `_` prefix = engine-managed (don't hand-edit unless you know what you're doing). Every other directory holds records.
325
+
326
+ **Record directories are type-declared, not hardcoded.** Each type in `_registry/object_types.yaml` declares its own `path:` — e.g. `cases/`, `clients/`, `data/cases/`, whatever you prefer. The architect skill picks a layout that fits the data shape.
327
+
328
+ ## MCP tools
329
+
330
+ All tools return `{ ok: true, data: {...} }` or `{ ok: false, errors: [...] }`. Call `maad_schema <type>` for full field definitions before writing.
331
+
332
+ **Discover:** `maad_scan`, `maad_summary`, `maad_describe`, `maad_schema`
333
+ **Read:** `maad_get`, `maad_query`, `maad_search`, `maad_related`, `maad_aggregate`, `maad_join`, `maad_verify`, `maad_changes_since`
334
+ **Write:** `maad_create`, `maad_update`, `maad_bulk_create`, `maad_bulk_update`, `maad_validate`
335
+ **Maintain:** `maad_delete`, `maad_reindex`, `maad_reload`, `maad_health`, `maad_history`, `maad_audit`
336
+ **Live updates (0.6.11+):** `maad_subscribe`, `maad_unsubscribe` — push notifications on durable writes.
337
+ **Instance admin:** `maad_instance_reload`, `maad_subscriptions`.
338
+ **Auth admin (0.7.0+):** `maad_issue_token`, `maad_revoke_token`, `maad_rotate_token`, `maad_list_tokens`, `maad_show_token`.
339
+
340
+ In multi-project mode, session tools are always available pre-bind: `maad_projects`, `maad_use_project`, `maad_use_projects`, `maad_current_session`.
341
+
342
+ ## Agent boot flow
343
+
344
+ 1. Agent reads `MAAD.md` → stable operating instructions
345
+ 2. Agent runs `maad_summary` → live project snapshot
346
+ 3. If empty project → reads `_skills/architect-core.md`, enters Architect mode
347
+ 4. If live project → uses MCP tools for normal operations
348
+
349
+ ## Current state
350
+
351
+ **Current:** v0.7.9 — First npm publish via Trusted Publishers (OIDC). Package now installable as `@maadb/core`. No engine code changes.
352
+
353
+ Recent shipped scope:
354
+ - **0.7.8** — Repository hygiene, dependency tightening, Node 24 baseline
355
+ - **0.7.7** — Schema-cache coherence across concurrent writers (silent index-corruption fix)
356
+ - **0.7.6** — Parser / write-path security hardening (`INVALID_DOC_ID` validator + path-containment guards)
357
+ - **0.7.5** — Unix domain socket transport (`MAAD_TRANSPORT=unix`)
358
+ - **0.7.4** — Reindex auto-detects schema-index changes (no more `--force` after schema flips)
359
+ - **0.7.3** — Engine hardening + agent-first composites (YAML coercion guard, bulk caps, commit identity)
360
+ - **0.7.0–0.7.1** — Scoped auth & identity, agent-first aggregate capabilities
361
+
362
+ See [Version.md](Version.md) for the full release history and forward plan.
363
+
364
+ ## Stack
365
+
366
+ - TypeScript strict, Node.js 24+ (current Active LTS)
367
+ - 6 production dependencies: `better-sqlite3`, `gray-matter`, `js-yaml`, `simple-git`, `@modelcontextprotocol/sdk`, `pino`
368
+ - 817 tests, Vitest
369
+ - MIT license, pre-1.0, actively developed
370
+
371
+ ## License
372
+
373
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,2 @@
1
+ export declare function generateArchitectSkill(): string;
2
+ //# sourceMappingURL=architect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../src/architect.ts"],"names":[],"mappings":"AAMA,wBAAgB,sBAAsB,IAAI,MAAM,CA0Q/C"}