keri-ts 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/README.md +57 -8
  2. package/esm/app/cli/agent.js +0 -19
  3. package/esm/app/cli/annotate.js +7 -2
  4. package/esm/app/cli/benchmark.js +210 -0
  5. package/esm/app/cli/cli.js +50 -52
  6. package/esm/app/cli/command-definitions.js +258 -6
  7. package/esm/app/cli/common/existing.js +40 -0
  8. package/esm/app/cli/common/parsing.js +20 -0
  9. package/esm/app/cli/export.js +51 -0
  10. package/esm/app/cli/incept.js +106 -0
  11. package/esm/app/cli/index.js +2 -0
  12. package/esm/app/cli/init.js +72 -41
  13. package/esm/app/configing.js +261 -0
  14. package/esm/app/habbing.js +386 -0
  15. package/esm/app/index.js +3 -0
  16. package/esm/app/keeping.js +321 -0
  17. package/esm/app/version.js +2 -2
  18. package/esm/db/basing.js +66 -1
  19. package/esm/db/core/lmdber.js +13 -7
  20. package/esm/db/core/path-manager.js +193 -169
  21. package/esm/db/index.js +1 -0
  22. package/esm/db/keeping.js +214 -0
  23. package/esm/deps/jsr.io/@std/internal/1.0.12/_os.js +12 -0
  24. package/esm/deps/jsr.io/@std/internal/1.0.12/os.js +5 -0
  25. package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +7 -0
  26. package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.js +40 -0
  27. package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.js +23 -0
  28. package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.js +46 -0
  29. package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +8 -0
  30. package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.js +19 -0
  31. package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +9 -0
  32. package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +235 -0
  33. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +8 -0
  34. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +77 -0
  35. package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.js +9 -0
  36. package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +19 -0
  37. package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +15 -0
  38. package/esm/deps/jsr.io/@std/path/1.1.4/basename.js +35 -0
  39. package/esm/deps/jsr.io/@std/path/1.1.4/common.js +33 -0
  40. package/esm/deps/jsr.io/@std/path/1.1.4/constants.js +17 -0
  41. package/esm/deps/jsr.io/@std/path/1.1.4/dirname.js +28 -0
  42. package/esm/deps/jsr.io/@std/path/1.1.4/extname.js +28 -0
  43. package/esm/deps/jsr.io/@std/path/1.1.4/format.js +27 -0
  44. package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.js +28 -0
  45. package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +83 -0
  46. package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.js +28 -0
  47. package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.js +42 -0
  48. package/esm/deps/jsr.io/@std/path/1.1.4/join.js +29 -0
  49. package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.js +34 -0
  50. package/esm/deps/jsr.io/@std/path/1.1.4/mod.js +216 -0
  51. package/esm/deps/jsr.io/@std/path/1.1.4/normalize.js +32 -0
  52. package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +35 -0
  53. package/esm/deps/jsr.io/@std/path/1.1.4/parse.js +39 -0
  54. package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.js +8 -0
  55. package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.js +52 -0
  56. package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.js +14 -0
  57. package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +64 -0
  58. package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.js +93 -0
  59. package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.js +28 -0
  60. package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +21 -0
  61. package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +82 -0
  62. package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +23 -0
  63. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.js +45 -0
  64. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +40 -0
  65. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +58 -0
  66. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +32 -0
  67. package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.js +115 -0
  68. package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.js +106 -0
  69. package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +59 -0
  70. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +27 -0
  71. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +20 -0
  72. package/esm/deps/jsr.io/@std/path/1.1.4/relative.js +30 -0
  73. package/esm/deps/jsr.io/@std/path/1.1.4/resolve.js +30 -0
  74. package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.js +28 -0
  75. package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +29 -0
  76. package/esm/deps/jsr.io/@std/path/1.1.4/types.js +3 -0
  77. package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.js +15 -0
  78. package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.js +47 -0
  79. package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.js +14 -0
  80. package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +113 -0
  81. package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.js +82 -0
  82. package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.js +28 -0
  83. package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +30 -0
  84. package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +82 -0
  85. package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +38 -0
  86. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.js +77 -0
  87. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +41 -0
  88. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +135 -0
  89. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +32 -0
  90. package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.js +176 -0
  91. package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.js +131 -0
  92. package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +154 -0
  93. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +34 -0
  94. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +49 -0
  95. package/package.json +4 -2
  96. package/types/app/cli/agent.d.ts.map +1 -1
  97. package/types/app/cli/annotate.d.ts.map +1 -1
  98. package/types/app/cli/benchmark.d.ts +11 -0
  99. package/types/app/cli/benchmark.d.ts.map +1 -0
  100. package/types/app/cli/cli.d.ts.map +1 -1
  101. package/types/app/cli/command-definitions.d.ts +5 -2
  102. package/types/app/cli/command-definitions.d.ts.map +1 -1
  103. package/types/app/cli/command-types.d.ts +12 -0
  104. package/types/app/cli/command-types.d.ts.map +1 -1
  105. package/types/app/cli/common/existing.d.ts +4 -0
  106. package/types/app/cli/common/existing.d.ts.map +1 -0
  107. package/types/app/cli/common/parsing.d.ts +15 -0
  108. package/types/app/cli/common/parsing.d.ts.map +1 -0
  109. package/types/app/cli/export.d.ts +8 -0
  110. package/types/app/cli/export.d.ts.map +1 -0
  111. package/types/app/cli/incept.d.ts +8 -0
  112. package/types/app/cli/incept.d.ts.map +1 -0
  113. package/types/app/cli/index.d.ts +2 -0
  114. package/types/app/cli/index.d.ts.map +1 -1
  115. package/types/app/cli/init.d.ts +5 -0
  116. package/types/app/cli/init.d.ts.map +1 -1
  117. package/types/app/configing.d.ts +57 -0
  118. package/types/app/configing.d.ts.map +1 -0
  119. package/types/app/habbing.d.ts +107 -0
  120. package/types/app/habbing.d.ts.map +1 -0
  121. package/types/app/index.d.ts +3 -0
  122. package/types/app/index.d.ts.map +1 -1
  123. package/types/app/keeping.d.ts +72 -0
  124. package/types/app/keeping.d.ts.map +1 -0
  125. package/types/app/version.d.ts +2 -2
  126. package/types/db/basing.d.ts +16 -1
  127. package/types/db/basing.d.ts.map +1 -1
  128. package/types/db/core/lmdber.d.ts +8 -4
  129. package/types/db/core/lmdber.d.ts.map +1 -1
  130. package/types/db/core/path-manager.d.ts +88 -24
  131. package/types/db/core/path-manager.d.ts.map +1 -1
  132. package/types/db/index.d.ts +1 -0
  133. package/types/db/index.d.ts.map +1 -1
  134. package/types/db/keeping.d.ts +73 -0
  135. package/types/db/keeping.d.ts.map +1 -0
  136. package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
  137. package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
  138. package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
  139. package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
  140. package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
  141. package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
  142. package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
  143. package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
  144. package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
  145. package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
  146. package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
  147. package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
  148. package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
  149. package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
  150. package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
  151. package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
  152. package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
  153. package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
  154. package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
  155. package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
  156. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
  157. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
  158. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
  159. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
  160. package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
  161. package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
  162. package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
  163. package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
  164. package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
  165. package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
  166. package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
  167. package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
  168. package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
  169. package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
  170. package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
  171. package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
  172. package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
  173. package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
  174. package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
  175. package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
  176. package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
  177. package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
  178. package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
  179. package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
  180. package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
  181. package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
  182. package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
  183. package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
  184. package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
  185. package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
  186. package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
  187. package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
  188. package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
  189. package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
  190. package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
  191. package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
  192. package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
  193. package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
  194. package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
  195. package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
  196. package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
  197. package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
  198. package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
  199. package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
  200. package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
  201. package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
  202. package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
  203. package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
  204. package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
  205. package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
  206. package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
  207. package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
  208. package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
  209. package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
  210. package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
  211. package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
  212. package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
  213. package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
  214. package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
  215. package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
  216. package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
  217. package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
  218. package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
  219. package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
  220. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
  221. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
  222. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
  223. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
  224. package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
  225. package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
  226. package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
  227. package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
  228. package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
  229. package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
  230. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
  231. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
  232. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
  233. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
  234. package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
  235. package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
  236. package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
  237. package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
  238. package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
  239. package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
  240. package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
  241. package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
  242. package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
  243. package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
  244. package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
  245. package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
  246. package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
  247. package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
  248. package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
  249. package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
  250. package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
  251. package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
  252. package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
  253. package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
  254. package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
  255. package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
  256. package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
  257. package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
  258. package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
  259. package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
  260. package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
  261. package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
  262. package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
  263. package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
  264. package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
  265. package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
  266. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
  267. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
  268. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
  269. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
  270. package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
  271. package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
  272. package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
  273. package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
  274. package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
  275. package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
  276. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
  277. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
  278. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
  279. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
  280. package/esm/app/cli/stub-commands.js +0 -61
  281. package/types/app/cli/stub-commands.d.ts +0 -6
  282. package/types/app/cli/stub-commands.d.ts.map +0 -1
@@ -1,22 +1,70 @@
1
1
  import { agentCommand } from "./agent.js";
2
2
  import { annotateCommand } from "./annotate.js";
3
+ import { benchmarkCommand } from "./benchmark.js";
3
4
  import { dumpEvts } from "./db-dump.js";
5
+ import { exportCommand } from "./export.js";
6
+ import { inceptCommand } from "./incept.js";
4
7
  import { initCommand } from "./init.js";
5
8
  import { DISPLAY_VERSION } from "../version.js";
6
- export function createCoreCommandHandlers() {
9
+ export function createCmdHandlers() {
7
10
  return new Map([
8
11
  ["init", (args) => initCommand(args)],
12
+ ["incept", (args) => inceptCommand(args)],
13
+ ["export", (args) => exportCommand(args)],
9
14
  ["agent", (args) => agentCommand(args)],
10
15
  ["annotate", (args) => annotateCommand(args)],
16
+ ["benchmark.cesr", (args) => benchmarkCommand(args)],
11
17
  ["db.dump", (args) => dumpEvts(args)],
18
+ ["interact", interactCommand],
19
+ ["witness", witnessCommand],
12
20
  ]);
13
21
  }
14
- export function registerCoreCommands(program, dispatch) {
22
+ /**
23
+ * registers core commands with the program
24
+ */
25
+ export function registerCmds(program, dispatch) {
26
+ // top level commands
27
+ regVersionCmd(program);
28
+ regInitCmd(program, dispatch);
29
+ regInceptCmd(program, dispatch);
30
+ regExportCmd(program, dispatch);
31
+ regAnnotateCmd(program, dispatch);
32
+ regAgentCmd(program, dispatch);
33
+ regBenchmarkSubCmd(program, dispatch);
34
+ // sub commands
35
+ regDbDumpSubCmd(program, dispatch);
36
+ regExperimentalSubCmd(program, dispatch);
37
+ }
38
+ /**
39
+ * Registers the version command with the program.
40
+ * Equivalent to `kli version` from KERIpy.
41
+ *
42
+ * @param program The tufa Commander program instance
43
+ * @param dispatch The command dispatch function
44
+ */
45
+ function regVersionCmd(program) {
46
+ program
47
+ .command("version")
48
+ .description("Show tufa version")
49
+ .action(() => {
50
+ console.log(DISPLAY_VERSION);
51
+ return Promise.resolve();
52
+ });
53
+ }
54
+ /**
55
+ * Registers the init command with the program.
56
+ * Equivalent to `kli init` from KERIpy.
57
+ *
58
+ * @param program The tufa Commander program instance
59
+ * @param dispatch The command dispatch function
60
+ */
61
+ function regInitCmd(program, dispatch) {
15
62
  program
16
63
  .command("init")
17
64
  .description("Create a database and keystore")
18
65
  .option("-n, --name <name>", "Keystore name and file location of KERI keystore (required)")
19
66
  .option("-b, --base <base>", "Additional optional prefix to file location of KERI keystore")
67
+ .option("--head-dir <dir>", "Directory override for database and keystore root (default fallback: ~/.tufa)")
20
68
  .option("-t, --temp", "Create a temporary keystore, used for testing")
21
69
  .option("-s, --salt <salt>", "Qualified base64 salt for creating key pairs")
22
70
  .option("-c, --config-dir <dir>", "Directory override for configuration data")
@@ -31,6 +79,7 @@ export function registerCoreCommands(program, dispatch) {
31
79
  args: {
32
80
  name: options.name,
33
81
  base: options.base,
82
+ headDirPath: options.headDir,
34
83
  temp: options.temp || false,
35
84
  salt: options.salt,
36
85
  configDir: options.configDir,
@@ -43,6 +92,106 @@ export function registerCoreCommands(program, dispatch) {
43
92
  });
44
93
  return Promise.resolve();
45
94
  });
95
+ }
96
+ /**
97
+ * Registers the incept command with the program.
98
+ * Equivalent to `kli incept` from KERIpy.
99
+ *
100
+ * @param program The tufa Commander program instance
101
+ * @param dispatch The command dispatch function
102
+ */
103
+ function regInceptCmd(program, dispatch) {
104
+ program
105
+ .command("incept")
106
+ .description("Initialize a prefix")
107
+ .requiredOption("-n, --name <name>", "Keystore name and file location of KERI keystore")
108
+ .option("-b, --base <base>", "Additional optional prefix to file location of KERI keystore")
109
+ .option("--head-dir <dir>", "Directory override for database and keystore root (default fallback: ~/.tufa)")
110
+ .option("-p, --passcode <passcode>", "Encryption passcode for keystore")
111
+ .requiredOption("-a, --alias <alias>", "Human readable alias for the new identifier prefix")
112
+ .option("-f, --file <file>", "Filename to use to create the identifier", "")
113
+ .option("-tf, --transferable", "Whether the prefix is transferable or non-transferable")
114
+ .option("-w, --wits <prefix>", "New set of witnesses, replaces all existing witnesses", (value, prev = []) => {
115
+ prev.push(value);
116
+ return prev;
117
+ }, [])
118
+ .option("-t, --toad <toad>", "Witness threshold (threshold of accountable duplicity)", (value) => Number(value))
119
+ .option("-ic, --icount <count>", "Incepting key count for number of keys used for inception", (value) => Number(value))
120
+ .option("-s, --isith <isith>", "Signing threshold for the inception event")
121
+ .option("-nc, --ncount <count>", "Next key count for number of next keys used on first rotation", (value) => Number(value))
122
+ .option("-x, --nsith <nsith>", "Signing threshold for the next rotation")
123
+ .option("-e, --est-only", "Only allow establishment events in KEL")
124
+ .option("-d, --data <data>", "Anchor data, '@' allowed", (value, prev = []) => {
125
+ prev.push(value);
126
+ return prev;
127
+ }, [])
128
+ .option("-di, --delpre <prefix>", "Delegator AID for delegated identifiers")
129
+ .action((options) => {
130
+ dispatch({
131
+ name: "incept",
132
+ args: {
133
+ name: options.name,
134
+ base: options.base,
135
+ headDirPath: options.headDir,
136
+ passcode: options.passcode,
137
+ alias: options.alias,
138
+ file: options.file,
139
+ transferable: options.transferable || false,
140
+ wits: options.wits || [],
141
+ toad: options.toad,
142
+ icount: options.icount,
143
+ isith: options.isith,
144
+ ncount: options.ncount,
145
+ nsith: options.nsith,
146
+ estOnly: options.estOnly || false,
147
+ data: options.data || [],
148
+ delpre: options.delpre,
149
+ },
150
+ });
151
+ return Promise.resolve();
152
+ });
153
+ }
154
+ /**
155
+ * Registers the export command with the program.
156
+ * Equivalent to `kli export` from KERIpy.
157
+ *
158
+ * @param program The tufa Commander program instance
159
+ * @param dispatch The command dispatch function
160
+ */
161
+ function regExportCmd(program, dispatch) {
162
+ program
163
+ .command("export")
164
+ .description("Export key events in CESR stream format")
165
+ .requiredOption("-n, --name <name>", "Keystore name")
166
+ .requiredOption("-a, --alias <alias>", "Human readable alias for identifier to export")
167
+ .option("-b, --base <base>", "Optional base path prefix")
168
+ .option("--head-dir <dir>", "Directory override for database and keystore root (default fallback: ~/.tufa)")
169
+ .option("-p, --passcode <passcode>", "Encryption passcode for keystore")
170
+ .option("--files", "Export artifacts to individual files")
171
+ .option("--ends", "Export service end points")
172
+ .action((options) => {
173
+ dispatch({
174
+ name: "export",
175
+ args: {
176
+ name: options.name,
177
+ alias: options.alias,
178
+ base: options.base,
179
+ headDirPath: options.headDir,
180
+ passcode: options.passcode,
181
+ files: options.files || false,
182
+ ends: options.ends || false,
183
+ },
184
+ });
185
+ return Promise.resolve();
186
+ });
187
+ }
188
+ /**
189
+ * Registers the annotate command with the program.
190
+ *
191
+ * @param program The tufa Commander program instance
192
+ * @param dispatch The command dispatch function
193
+ */
194
+ function regAnnotateCmd(program, dispatch) {
46
195
  program
47
196
  .command("annotate")
48
197
  .description("Annotate CESR stream from file or stdin")
@@ -62,6 +211,14 @@ export function registerCoreCommands(program, dispatch) {
62
211
  });
63
212
  return Promise.resolve();
64
213
  });
214
+ }
215
+ /**
216
+ * Registers the agent command with the program.
217
+ *
218
+ * @param program The tufa Commander program instance
219
+ * @param dispatch The command dispatch function
220
+ */
221
+ function regAgentCmd(program, dispatch) {
65
222
  program
66
223
  .command("agent")
67
224
  .description("Start the KERI agent server")
@@ -76,7 +233,69 @@ export function registerCoreCommands(program, dispatch) {
76
233
  });
77
234
  return Promise.resolve();
78
235
  });
236
+ }
237
+ /**
238
+ * Registers benchmark subcommands with the program.
239
+ *
240
+ * @param program The tufa Commander program instance
241
+ * @param dispatch The command dispatch function
242
+ */
243
+ function regBenchmarkSubCmd(program, dispatch) {
244
+ const benchmarkCommand = program.command("benchmark").description("Benchmark operations");
245
+ regBenchmarkCesrCmd(benchmarkCommand, dispatch);
246
+ }
247
+ /**
248
+ * Registers the CESR benchmark command.
249
+ *
250
+ * @param benchmarkCommand The benchmark sub-command instance
251
+ * @param dispatch The command dispatch function
252
+ */
253
+ function regBenchmarkCesrCmd(benchmarkCommand, dispatch) {
254
+ benchmarkCommand
255
+ .command("cesr")
256
+ .description("Benchmark CESR parser from file or stdin")
257
+ .option("--in <path>", "Input file path (defaults to stdin)")
258
+ .option("--iterations <count>", "Measured benchmark iterations", (value) => Number(value), 50)
259
+ .option("--warmup <count>", "Warmup iterations before measurement", (value) => Number(value), 5)
260
+ .option("--chunk-size <bytes>", "Chunk size for simulated streaming input", (value) => Number(value), 0)
261
+ .option("--framed", "Use framed parser mode")
262
+ .option("--compat", "Use compat attachment dispatch mode")
263
+ .option("--allow-errors", "Do not fail benchmark if parse errors are emitted")
264
+ .option("--json", "Emit benchmark result as one JSON line")
265
+ .action((options) => {
266
+ dispatch({
267
+ name: "benchmark.cesr",
268
+ args: {
269
+ inPath: options.in,
270
+ iterations: options.iterations,
271
+ warmupIterations: options.warmup,
272
+ chunkSize: options.chunkSize,
273
+ framed: options.framed || false,
274
+ compat: options.compat || false,
275
+ allowErrors: options.allowErrors || false,
276
+ json: options.json || false,
277
+ },
278
+ });
279
+ return Promise.resolve();
280
+ });
281
+ }
282
+ /**
283
+ * Registers the db dump sub command with the program.
284
+ *
285
+ * @param program The tufa Commander program instance
286
+ * @param dispatch The command dispatch function
287
+ */
288
+ function regDbDumpSubCmd(program, dispatch) {
79
289
  const dbCommand = program.command("db").description("Database operations");
290
+ regDbDumpCmd(dbCommand, dispatch);
291
+ }
292
+ /**
293
+ * Registers the db dump command with the program.
294
+ *
295
+ * @param dbCommand The db sub-command instance
296
+ * @param dispatch The command dispatch function
297
+ */
298
+ function regDbDumpCmd(dbCommand, dispatch) {
80
299
  dbCommand
81
300
  .command("dump")
82
301
  .description("Dump database contents")
@@ -94,11 +313,44 @@ export function registerCoreCommands(program, dispatch) {
94
313
  });
95
314
  return Promise.resolve();
96
315
  });
97
- program
98
- .command("version")
99
- .description("Show tufa version")
316
+ }
317
+ /**
318
+ * Registers the experimental sub command with the program.
319
+ * This is for commands not yet implemented, finished, or supported by tufa.
320
+ *
321
+ * @param program The tufa Commander program instance
322
+ * @param dispatch The command dispatch function
323
+ */
324
+ function regExperimentalSubCmd(program, dispatch) {
325
+ const experimentalCommand = program
326
+ .command("experimental")
327
+ .description("Experimental or placeholder commands");
328
+ regInteractCmd(experimentalCommand, dispatch);
329
+ regWitnessCmd(experimentalCommand, dispatch);
330
+ }
331
+ function regInteractCmd(experimentalCommand, dispatch) {
332
+ experimentalCommand
333
+ .command("interact")
334
+ .description("Create an interaction event (placeholder)")
100
335
  .action(() => {
101
- console.log(DISPLAY_VERSION);
336
+ dispatch({ name: "interact", args: {} });
102
337
  return Promise.resolve();
103
338
  });
104
339
  }
340
+ function regWitnessCmd(experimentalCommand, dispatch) {
341
+ experimentalCommand
342
+ .command("witness")
343
+ .description("Start a witness server (placeholder)")
344
+ .action(() => {
345
+ dispatch({ name: "witness", args: {} });
346
+ return Promise.resolve();
347
+ });
348
+ }
349
+ // deno-lint-ignore require-yield
350
+ function* interactCommand(_args) {
351
+ console.log("tufa experimental interact command - coming soon!");
352
+ }
353
+ // deno-lint-ignore require-yield
354
+ function* witnessCommand(_args) {
355
+ console.log("tufa experimental witness command - coming soon!");
356
+ }
@@ -0,0 +1,40 @@
1
+ import { createKeeper } from "../../../db/keeping.js";
2
+ import { createHabery } from "../../habbing.js";
3
+ export function* setupHby(name, base = "", bran, temp = false, headDirPath) {
4
+ const ks = yield* createKeeper({
5
+ name,
6
+ base,
7
+ temp,
8
+ headDirPath,
9
+ reopen: true,
10
+ readonly: true,
11
+ });
12
+ const aeid = ks.getGbls("aeid");
13
+ yield* ks.close();
14
+ if (aeid === null) {
15
+ throw new Error("Keystore must already exist, exiting");
16
+ }
17
+ let retries = 0;
18
+ let passcode = bran;
19
+ while (true) {
20
+ try {
21
+ retries += 1;
22
+ return yield* createHabery({
23
+ name,
24
+ base,
25
+ temp,
26
+ headDirPath,
27
+ bran: passcode?.replaceAll("-", ""),
28
+ });
29
+ }
30
+ catch (error) {
31
+ if (retries >= 3) {
32
+ throw new Error("too many attempts");
33
+ }
34
+ const message = error instanceof Error ? error.message : String(error);
35
+ console.log(message);
36
+ console.log("Valid passcode required, try again...");
37
+ passcode = prompt("Passcode: ") ?? undefined;
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,20 @@
1
+ import * as dntShim from "../../../_dnt.shims.js";
2
+ export function parseDataItems(items) {
3
+ if (!items || items.length === 0)
4
+ return [];
5
+ const out = [];
6
+ for (const item of items) {
7
+ if (item.startsWith("@")) {
8
+ const file = item.slice(1);
9
+ const text = dntShim.Deno.readTextFileSync(file);
10
+ out.push(JSON.parse(text));
11
+ continue;
12
+ }
13
+ out.push(JSON.parse(item));
14
+ }
15
+ return out;
16
+ }
17
+ export function loadInceptFileOptions(path) {
18
+ const text = dntShim.Deno.readTextFileSync(path);
19
+ return JSON.parse(text);
20
+ }
@@ -0,0 +1,51 @@
1
+ import { createQueue, spawn } from "effection";
2
+ import { ValidationError } from "../../core/errors.js";
3
+ import { setupHby } from "./common/existing.js";
4
+ /**
5
+ * Implements `tufa export`.
6
+ *
7
+ * Exports CESR-formatted KEL events for a named local AID.
8
+ */
9
+ export function* exportCommand(args) {
10
+ const exportArgs = {
11
+ name: args.name,
12
+ base: args.base,
13
+ headDirPath: args.headDirPath,
14
+ passcode: args.passcode,
15
+ alias: args.alias,
16
+ files: args.files,
17
+ ends: args.ends,
18
+ };
19
+ if (!exportArgs.name) {
20
+ throw new ValidationError("Name is required and cannot be empty");
21
+ }
22
+ if (!exportArgs.alias) {
23
+ throw new ValidationError("Alias is required and cannot be empty");
24
+ }
25
+ const cues = createQueue();
26
+ const doer = yield* spawn(function* () {
27
+ const hby = yield* setupHby(exportArgs.name, exportArgs.base ?? "", exportArgs.passcode, false, exportArgs.headDirPath);
28
+ try {
29
+ const hab = hby.habByName(exportArgs.alias);
30
+ if (!hab || !hab.pre) {
31
+ throw new ValidationError(`No local AID found for alias ${exportArgs.alias}`);
32
+ }
33
+ const encoder = new TextEncoder();
34
+ const keyPrefix = encoder.encode(`${hab.pre}:`);
35
+ const decoder = new TextDecoder();
36
+ let count = 0;
37
+ for (const [, value] of hby.db.getAllEvtsIter(keyPrefix)) {
38
+ console.log(decoder.decode(value));
39
+ count += 1;
40
+ }
41
+ cues.add({ kin: "export", count, mode: "native" });
42
+ }
43
+ finally {
44
+ yield* hby.close();
45
+ }
46
+ });
47
+ yield* doer;
48
+ const cue = yield* cues.next();
49
+ if (cue.done)
50
+ return;
51
+ }
@@ -0,0 +1,106 @@
1
+ import { createQueue, spawn } from "effection";
2
+ import { ValidationError } from "../../core/errors.js";
3
+ import { setupHby } from "./common/existing.js";
4
+ import { loadInceptFileOptions, parseDataItems, } from "./common/parsing.js";
5
+ /**
6
+ * Loads incept options from a file and overlays explicit CLI values.
7
+ */
8
+ function mergeWithFile(args) {
9
+ let opts = {};
10
+ if (args.file && args.file !== "") {
11
+ opts = loadInceptFileOptions(args.file);
12
+ }
13
+ if (args.transferable !== undefined)
14
+ opts.transferable = args.transferable;
15
+ if (args.wits && args.wits.length > 0)
16
+ opts.wits = args.wits;
17
+ if (args.icount !== undefined)
18
+ opts.icount = Number(args.icount);
19
+ if (args.isith !== undefined)
20
+ opts.isith = args.isith;
21
+ if (args.ncount !== undefined)
22
+ opts.ncount = Number(args.ncount);
23
+ if (args.nsith !== undefined)
24
+ opts.nsith = args.nsith;
25
+ if (args.toad !== undefined)
26
+ opts.toad = Number(args.toad);
27
+ if (args.estOnly !== undefined)
28
+ opts.estOnly = args.estOnly;
29
+ if (args.delpre !== undefined)
30
+ opts.delpre = args.delpre;
31
+ if (args.data !== undefined)
32
+ opts.data = parseDataItems(args.data);
33
+ return opts;
34
+ }
35
+ /**
36
+ * Implements `tufa incept`.
37
+ *
38
+ * Creates a single-sig identifier locally.
39
+ */
40
+ export function* inceptCommand(args) {
41
+ const inceptArgs = {
42
+ name: args.name,
43
+ base: args.base,
44
+ headDirPath: args.headDirPath,
45
+ temp: args.temp,
46
+ passcode: args.passcode,
47
+ alias: args.alias,
48
+ endpoint: args.endpoint,
49
+ proxy: args.proxy,
50
+ file: args.file,
51
+ transferable: args.transferable,
52
+ wits: args.wits,
53
+ toad: args.toad,
54
+ icount: args.icount,
55
+ isith: args.isith,
56
+ ncount: args.ncount,
57
+ nsith: args.nsith,
58
+ estOnly: args.estOnly,
59
+ data: args.data,
60
+ delpre: args.delpre,
61
+ };
62
+ if (!inceptArgs.name) {
63
+ throw new ValidationError("Name is required and cannot be empty");
64
+ }
65
+ if (!inceptArgs.alias) {
66
+ throw new ValidationError("Alias is required and cannot be empty");
67
+ }
68
+ if (inceptArgs.endpoint) {
69
+ throw new ValidationError("Witness endpoint receipting is not available in single-sig local phase");
70
+ }
71
+ if (inceptArgs.proxy) {
72
+ throw new ValidationError("Delegation proxy flow is not available in single-sig local phase");
73
+ }
74
+ const opts = mergeWithFile(inceptArgs);
75
+ const cues = createQueue();
76
+ const doer = yield* spawn(function* () {
77
+ const hby = yield* setupHby(inceptArgs.name, inceptArgs.base ?? "", inceptArgs.passcode, inceptArgs.temp ?? false, inceptArgs.headDirPath);
78
+ try {
79
+ const hab = hby.makeHab(inceptArgs.alias, undefined, {
80
+ transferable: opts.transferable ?? false,
81
+ wits: opts.wits ?? [],
82
+ toad: opts.toad ?? 0,
83
+ icount: opts.icount ?? 1,
84
+ isith: opts.isith,
85
+ ncount: opts.ncount ?? 1,
86
+ nsith: opts.nsith,
87
+ estOnly: opts.estOnly ?? false,
88
+ data: opts.data ?? [],
89
+ delpre: opts.delpre,
90
+ });
91
+ console.log(`Prefix ${hab.pre}`);
92
+ for (const [idx, key] of (hab.kever?.verfers ?? []).entries()) {
93
+ console.log(`\tPublic key ${idx + 1}: ${key}`);
94
+ }
95
+ console.log("");
96
+ cues.add({ kin: "incept", pre: hab.pre, mode: "native" });
97
+ }
98
+ finally {
99
+ yield* hby.close();
100
+ }
101
+ });
102
+ yield* doer;
103
+ const cue = yield* cues.next();
104
+ if (cue.done)
105
+ return;
106
+ }
@@ -4,4 +4,6 @@
4
4
  * This module provides the KERI TypeScript CLI interface.
5
5
  */
6
6
  export { tufa } from "./cli.js";
7
+ export { exportCommand } from "./export.js";
7
8
  export { initCommand } from "./init.js";
9
+ export { inceptCommand } from "./incept.js";
@@ -1,36 +1,18 @@
1
- import { ValidationError } from "../../core/errors.js";
2
- function printInitHelp() {
3
- console.log(`
4
- tufa init - Create a database and keystore
5
-
6
- Usage: tufa init [options]
7
-
8
- Options:
9
- --name, -n <name> Keystore name and file location of KERI keystore (required)
10
- --base, -b <base> Additional optional prefix to file location of KERI keystore
11
- --temp, -t Create a temporary keystore, used for testing
12
- --salt, -s <salt> Qualified base64 salt for creating key pairs
13
- --config-dir, -c <dir> Directory override for configuration data
14
- --config-file <file> Configuration filename override
15
- --passcode, -p <passcode> 22 character encryption passcode for keystore (is not saved)
16
- --nopasscode Create an unencrypted keystore
17
- --aeid, -a <aeid> Qualified base64 of non-transferable identifier prefix for authentication and encryption of secrets in keystore
18
- --seed, -e <seed> Qualified base64 private-signing key (seed) for the aeid from which the private decryption key may be derived
19
- --help, -h Show this help message
20
- `);
21
- }
22
- // TODO remove this ignore once init is finished
23
- // deno-lint-ignore require-yield
1
+ import { createQueue, spawn } from "effection";
2
+ import { PathError, ValidationError } from "../../core/errors.js";
3
+ import { createConfiger } from "../configing.js";
4
+ import { createHabery } from "../habbing.js";
5
+ /**
6
+ * Implements `tufa init`.
7
+ *
8
+ * Creates/open a habery keystore and database.
9
+ */
24
10
  export function* initCommand(args) {
25
- // Check for help flag
26
- if (args.help || args.h) {
27
- printInitHelp();
28
- return;
29
- }
30
- // Extract values from args (already parsed by Cliffy or test mocks)
11
+ // Extract values from args
31
12
  const initArgs = {
32
13
  name: args.name,
33
14
  base: args.base,
15
+ headDirPath: args.headDirPath,
34
16
  temp: args.temp,
35
17
  salt: args.salt,
36
18
  configDir: args.configDir,
@@ -46,10 +28,9 @@ export function* initCommand(args) {
46
28
  throw new ValidationError("Name is required and cannot be empty");
47
29
  }
48
30
  const base = initArgs.base || "";
31
+ const headDirPath = initArgs.headDirPath;
49
32
  const temp = initArgs.temp || false;
50
33
  let bran = initArgs.passcode;
51
- const configFile = initArgs.configFile;
52
- const configDir = initArgs.configDir;
53
34
  const nopasscode = initArgs.nopasscode || false;
54
35
  // Handle passcode input if not provided and not using nopasscode
55
36
  if (!nopasscode && !bran) {
@@ -63,14 +44,64 @@ export function* initCommand(args) {
63
44
  }
64
45
  bran = passcode || undefined;
65
46
  }
66
- // TODO: Implement actual keystore and database creation
67
- // This is a stub implementation that mirrors the KERIpy structure
68
- console.log("KERI Keystore created at: [stub - keystore path]");
69
- console.log("KERI Database created at: [stub - database path]");
70
- console.log("KERI Credential Store created at: [stub - credential store path]");
71
- if (initArgs.aeid) {
72
- console.log("\taeid:", initArgs.aeid);
73
- }
74
- console.log("\nInitialization complete!");
75
- console.log("Note: This is a stub implementation. Full keystore and database creation will be implemented in future versions.");
47
+ const cues = createQueue();
48
+ const doer = yield* spawn(function* () {
49
+ const cf = initArgs.configFile
50
+ ? (yield* createConfiger({
51
+ name: initArgs.configFile,
52
+ base: "",
53
+ temp: false,
54
+ headDirPath: initArgs.configDir,
55
+ reopen: true,
56
+ clear: false,
57
+ }))
58
+ : undefined;
59
+ let hby;
60
+ try {
61
+ hby = yield* createHabery({
62
+ name,
63
+ base,
64
+ headDirPath,
65
+ temp,
66
+ cf,
67
+ bran: bran ?? undefined,
68
+ aeid: initArgs.aeid,
69
+ seed: initArgs.seed,
70
+ salt: initArgs.salt,
71
+ });
72
+ }
73
+ catch (error) {
74
+ if (temp || !(error instanceof PathError)) {
75
+ throw error;
76
+ }
77
+ console.log("Persistent keystore path unavailable, retrying with temporary keystore mode.");
78
+ hby = yield* createHabery({
79
+ name,
80
+ base,
81
+ headDirPath,
82
+ temp: true,
83
+ cf,
84
+ bran: bran ?? undefined,
85
+ aeid: initArgs.aeid,
86
+ seed: initArgs.seed,
87
+ salt: initArgs.salt,
88
+ });
89
+ }
90
+ try {
91
+ console.log("KERI Keystore created at:", hby.ks.path);
92
+ console.log("KERI Database created at:", hby.db.path);
93
+ console.log("KERI Credential Store created at:", hby.db.path);
94
+ if (hby.mgr.aeid) {
95
+ console.log("\taeid:", hby.mgr.aeid);
96
+ }
97
+ cues.add({ kin: "init", mode: "native", name });
98
+ }
99
+ finally {
100
+ yield* hby.close();
101
+ }
102
+ });
103
+ yield* doer;
104
+ const cue = yield* cues.next();
105
+ if (cue.done)
106
+ return;
76
107
  }