keri-ts 0.2.2 → 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.
- package/README.md +44 -120
- package/esm/app/cli/agent.js +0 -19
- package/esm/app/cli/annotate.js +7 -2
- package/esm/app/cli/benchmark.js +210 -0
- package/esm/app/cli/cli.js +50 -52
- package/esm/app/cli/command-definitions.js +258 -6
- package/esm/app/cli/common/existing.js +40 -0
- package/esm/app/cli/common/parsing.js +20 -0
- package/esm/app/cli/export.js +51 -0
- package/esm/app/cli/incept.js +106 -0
- package/esm/app/cli/index.js +9 -0
- package/esm/app/cli/init.js +72 -41
- package/esm/app/configing.js +261 -0
- package/esm/app/habbing.js +386 -0
- package/esm/app/index.js +10 -0
- package/esm/app/keeping.js +321 -0
- package/esm/app/version.js +2 -2
- package/esm/db/basing.js +66 -1
- package/esm/db/core/lmdber.js +13 -7
- package/esm/db/core/path-manager.js +193 -169
- package/esm/db/index.js +1 -0
- package/esm/db/keeping.js +214 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/_os.js +12 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/os.js +5 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +7 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.js +46 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +235 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/basename.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/common.js +33 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/constants.js +17 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/dirname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/extname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/format.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +83 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.js +42 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/mod.js +216 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/parse.js +39 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.js +52 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +64 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.js +93 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +21 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.js +45 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +58 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.js +115 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.js +106 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +59 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +20 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/relative.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/resolve.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/types.js +3 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.js +47 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +113 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +38 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +41 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +135 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.js +176 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.js +131 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +154 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +49 -0
- package/esm/npm/index.js +7 -2
- package/package.json +6 -3
- package/types/app/cli/agent.d.ts.map +1 -1
- package/types/app/cli/annotate.d.ts.map +1 -1
- package/types/app/cli/benchmark.d.ts +11 -0
- package/types/app/cli/benchmark.d.ts.map +1 -0
- package/types/app/cli/cli.d.ts.map +1 -1
- package/types/app/cli/command-definitions.d.ts +5 -2
- package/types/app/cli/command-definitions.d.ts.map +1 -1
- package/types/app/cli/command-types.d.ts +12 -0
- package/types/app/cli/command-types.d.ts.map +1 -1
- package/types/app/cli/common/existing.d.ts +4 -0
- package/types/app/cli/common/existing.d.ts.map +1 -0
- package/types/app/cli/common/parsing.d.ts +15 -0
- package/types/app/cli/common/parsing.d.ts.map +1 -0
- package/types/app/cli/export.d.ts +8 -0
- package/types/app/cli/export.d.ts.map +1 -0
- package/types/app/cli/incept.d.ts +8 -0
- package/types/app/cli/incept.d.ts.map +1 -0
- package/types/app/cli/index.d.ts +10 -0
- package/types/app/cli/index.d.ts.map +1 -0
- package/types/app/cli/init.d.ts +5 -0
- package/types/app/cli/init.d.ts.map +1 -1
- package/types/app/configing.d.ts +57 -0
- package/types/app/configing.d.ts.map +1 -0
- package/types/app/habbing.d.ts +107 -0
- package/types/app/habbing.d.ts.map +1 -0
- package/types/app/index.d.ts +11 -0
- package/types/app/index.d.ts.map +1 -0
- package/types/app/keeping.d.ts +72 -0
- package/types/app/keeping.d.ts.map +1 -0
- package/types/app/version.d.ts +2 -2
- package/types/app/version.d.ts.map +1 -1
- package/types/db/basing.d.ts +16 -1
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/lmdber.d.ts +8 -4
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/path-manager.d.ts +88 -24
- package/types/db/core/path-manager.d.ts.map +1 -1
- package/types/db/index.d.ts +1 -0
- package/types/db/index.d.ts.map +1 -1
- package/types/db/keeping.d.ts +73 -0
- package/types/db/keeping.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
- package/types/npm/index.d.ts +7 -2
- package/types/npm/index.d.ts.map +1 -1
- package/esm/app/cli/stub-commands.js +0 -61
- package/types/app/cli/stub-commands.d.ts +0 -6
- package/types/app/cli/stub-commands.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,150 +1,74 @@
|
|
|
1
|
-
# keri-ts
|
|
1
|
+
# keri-ts
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
in TypeScript.
|
|
3
|
+
KERI TypeScript runtime package with the `tufa` CLI.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## Install
|
|
7
6
|
|
|
8
7
|
```bash
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Initialize a keystore
|
|
13
|
-
deno task tufa init --name mykeystore
|
|
14
|
-
|
|
15
|
-
# Get help for specific commands
|
|
16
|
-
deno task tufa init --help
|
|
17
|
-
|
|
18
|
-
# Show CLI version
|
|
19
|
-
deno task tufa version
|
|
20
|
-
deno task tufa --version
|
|
21
|
-
|
|
22
|
-
# Annotate a CESR file
|
|
23
|
-
deno task tufa annotate --in samples/cesr-streams/CESR_1_0-oor-auth-vc.cesr
|
|
24
|
-
|
|
25
|
-
# Annotate CESR from stdin
|
|
26
|
-
cat samples/cesr-streams/CESR_1_0-oor-auth-vc.cesr | deno task tufa annotate
|
|
27
|
-
```
|
|
8
|
+
# As a dependency
|
|
9
|
+
npm install keri-ts
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# npm (global)
|
|
11
|
+
# Global CLI install
|
|
33
12
|
npm install -g keri-ts
|
|
34
|
-
tufa --help
|
|
35
|
-
|
|
36
|
-
# Deno (global)
|
|
37
|
-
deno install --global --allow-all --unstable-ffi --name tufa mod.ts
|
|
38
|
-
tufa --help
|
|
39
|
-
|
|
40
|
-
# make sure to add the Deno bin path to your PATH var
|
|
41
|
-
export PATH="$HOME/.deno/bin:$PATH"
|
|
42
13
|
```
|
|
43
14
|
|
|
44
|
-
|
|
15
|
+
## CLI quick start
|
|
45
16
|
|
|
46
|
-
|
|
47
|
-
CESR 2.0
|
|
48
|
-
- TODO Creates and manages keystores
|
|
49
|
-
- TODO Parses and packs CESR streams
|
|
50
|
-
- ✅ Provides CLI for interaction with KERI keystores (basic implementation)
|
|
51
|
-
- TODO Provides a mailbox agent, controller agent, direct mode, and indirect
|
|
52
|
-
mode agents.
|
|
53
|
-
- TODO Creates, Issues, and Verifies ACDC credentials.
|
|
54
|
-
- TODO Provides a JSON Schema server to host ACDC schemas.
|
|
55
|
-
|
|
56
|
-
### Importing library
|
|
57
|
-
|
|
58
|
-
TBD
|
|
59
|
-
|
|
60
|
-
### Build scripts (Deno)
|
|
17
|
+
`tufa version` and `tufa annotate` are the fastest way to verify your setup.
|
|
61
18
|
|
|
62
19
|
```bash
|
|
63
|
-
#
|
|
64
|
-
|
|
20
|
+
# Version
|
|
21
|
+
tufa version
|
|
22
|
+
tufa --version
|
|
23
|
+
|
|
24
|
+
# Annotate CESR from file
|
|
25
|
+
tufa annotate --in ./mystream.cesr
|
|
65
26
|
|
|
66
|
-
#
|
|
67
|
-
|
|
27
|
+
# Annotate from stdin
|
|
28
|
+
cat ./mystream.cesr | tufa annotate
|
|
68
29
|
```
|
|
69
30
|
|
|
70
|
-
|
|
31
|
+
## Benchmark CESR parser
|
|
71
32
|
|
|
72
|
-
|
|
73
|
-
- Runtime CLI version strings are generated from package manifest versions.
|
|
74
|
-
- CI builds automatically append build metadata to CLI display versions.
|
|
33
|
+
Benchmark any CESR stream from file or stdin:
|
|
75
34
|
|
|
76
35
|
```bash
|
|
77
|
-
#
|
|
78
|
-
|
|
36
|
+
# Benchmark a stream file
|
|
37
|
+
tufa benchmark cesr --in ./mystream.cesr
|
|
79
38
|
|
|
80
|
-
#
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
# Regenerate and verify runtime version modules
|
|
84
|
-
deno task version:generate
|
|
85
|
-
deno task version:check
|
|
39
|
+
# Benchmark from stdin with explicit chunk simulation
|
|
40
|
+
cat ./mystream.cesr | tufa benchmark cesr --chunk-size 256 --iterations 25 --warmup 5
|
|
86
41
|
```
|
|
87
42
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
43
|
+
- `--in <path>`: input file path (defaults to stdin)
|
|
44
|
+
- `--iterations <count>`: measured benchmark runs (default `50`)
|
|
45
|
+
- `--warmup <count>`: warmup runs before measurement (default `5`)
|
|
46
|
+
- `--chunk-size <bytes>`: chunk size for streaming simulation (`0` = full
|
|
47
|
+
stream)
|
|
48
|
+
- `--framed`: benchmark parser in framed mode
|
|
49
|
+
- `--compat`: benchmark parser with compat attachment dispatch mode
|
|
50
|
+
- `--allow-errors`: continue benchmark even when parse errors are emitted
|
|
51
|
+
- `--json`: print one JSON result line
|
|
94
52
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
After installing dependencies, rebuild the `lmdb` package with v1 data format
|
|
98
|
-
support:
|
|
53
|
+
## Annotate options
|
|
99
54
|
|
|
100
55
|
```bash
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
npm run recompile
|
|
104
|
-
cd ../..
|
|
56
|
+
tufa annotate --in <path> --out <path> --pretty
|
|
57
|
+
tufa annotate --qb2 --in <binary.qb2> --out <annotation.txt>
|
|
105
58
|
```
|
|
106
59
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
- If you encounter `malloc` errors or database format incompatibility errors
|
|
112
|
-
when opening KERIpy-created databases
|
|
60
|
+
- `--in <path>`: input file path (defaults to stdin)
|
|
61
|
+
- `--out <path>`: output file path (defaults to stdout)
|
|
62
|
+
- `--qb2`: parse input as qb2 binary
|
|
63
|
+
- `--pretty`: pretty-print annotation output
|
|
113
64
|
|
|
114
|
-
|
|
65
|
+
## Package entrypoints
|
|
115
66
|
|
|
116
67
|
```bash
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Note**: The v1 format uses LMDB 0.9.29 (via `lmdb-data-v1`), which is
|
|
122
|
-
compatible with KERIpy's LMDB 0.9.33. Some newer LMDB features (encryption,
|
|
123
|
-
remapping) are not available with v1 format.
|
|
124
|
-
|
|
125
|
-
## Development Notes
|
|
126
|
-
|
|
127
|
-
### Deno install locally
|
|
68
|
+
# CLI help
|
|
69
|
+
npx tufa --help
|
|
128
70
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
```zsh
|
|
133
|
-
deno install --global \
|
|
134
|
-
--config /Users/kbull/code/keri/kentbull/keri-ts/deno.json \
|
|
135
|
-
--node-modules-dir=auto \
|
|
136
|
-
--allow-scripts=npm:lmdb,npm:msgpackr-extract \
|
|
137
|
-
--allow-all \
|
|
138
|
-
--unstable-ffi \
|
|
139
|
-
--name tufa \
|
|
140
|
-
/Users/kbull/code/keri/kentbull/keri-ts/mod.ts
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
This is because of how Deno blocks build/install scripts for installed
|
|
144
|
-
dependencies unless explicitly allowed.
|
|
145
|
-
|
|
146
|
-
You may need to warm dependencies once with the following command:
|
|
147
|
-
|
|
148
|
-
```zsh
|
|
149
|
-
deno install --node-modules-dir=auto --allow-scripts=npm:lmdb,npm:msgpackr-extract
|
|
71
|
+
# From source in this repo
|
|
72
|
+
deno task tufa --help
|
|
73
|
+
deno task tufa version
|
|
150
74
|
```
|
package/esm/app/cli/agent.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { ValidationError } from "../../core/errors.js";
|
|
2
2
|
import { startServer } from "../server.js";
|
|
3
|
-
function printAgentHelp() {
|
|
4
|
-
console.log(`
|
|
5
|
-
tufa agent - Start the KERI agent server
|
|
6
|
-
|
|
7
|
-
Usage: tufa agent [options]
|
|
8
|
-
|
|
9
|
-
Options:
|
|
10
|
-
--port, -p <port> Port number for the server (default: 8000)
|
|
11
|
-
--help, -h Show this help message
|
|
12
|
-
|
|
13
|
-
The agent server provides HTTP endpoints for interacting with keri-ts.
|
|
14
|
-
The server will run until interrupted with SIGINT (Ctrl+C).
|
|
15
|
-
`);
|
|
16
|
-
}
|
|
17
3
|
/**
|
|
18
4
|
* Agent command operation - starts the HTTP server
|
|
19
5
|
*
|
|
@@ -21,11 +7,6 @@ The server will run until interrupted with SIGINT (Ctrl+C).
|
|
|
21
7
|
* @returns Operation that runs the server until shutdown
|
|
22
8
|
*/
|
|
23
9
|
export function* agentCommand(args) {
|
|
24
|
-
// Check for help flag
|
|
25
|
-
if (args.help || args.h) {
|
|
26
|
-
printAgentHelp();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
10
|
// Extract port from args (default to 8000)
|
|
30
11
|
const port = args.port ? Number(args.port) : 8000;
|
|
31
12
|
// Validate port number
|
package/esm/app/cli/annotate.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
2
|
import { annotate } from "cesr-ts";
|
|
3
3
|
const TEXT_DECODER = new TextDecoder();
|
|
4
|
+
/**
|
|
5
|
+
* Reads bytes from stdin in chunks of 64KB and returns them as a single Uint8Array
|
|
6
|
+
* @returns All bytes read from stdin
|
|
7
|
+
*/
|
|
4
8
|
function readAllStdinSync() {
|
|
5
9
|
const chunks = [];
|
|
6
10
|
let total = 0;
|
|
7
11
|
while (true) {
|
|
8
|
-
const chunk = new Uint8Array(64 * 1024);
|
|
9
|
-
const read = dntShim.Deno.stdin.readSync(chunk);
|
|
12
|
+
const chunk = new Uint8Array(64 * 1024); // 64KB chunk size
|
|
13
|
+
const read = dntShim.Deno.stdin.readSync(chunk); // reads up to 64KB chunk, returns num bytes
|
|
10
14
|
if (read === null) {
|
|
15
|
+
// read until EOF (null)
|
|
11
16
|
break;
|
|
12
17
|
}
|
|
13
18
|
const used = chunk.subarray(0, read);
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { createParser } from "cesr-ts";
|
|
3
|
+
/**
|
|
4
|
+
* Synchronously consume stdin for CLI benchmark mode.
|
|
5
|
+
*
|
|
6
|
+
* Maintainer note:
|
|
7
|
+
* - Synchronous read keeps CLI command implementation simple and deterministic.
|
|
8
|
+
* - This function should remain isolated; parser benchmark internals themselves
|
|
9
|
+
* are IO-agnostic.
|
|
10
|
+
*/
|
|
11
|
+
function readAllStdinSync() {
|
|
12
|
+
const chunks = [];
|
|
13
|
+
let total = 0;
|
|
14
|
+
while (true) {
|
|
15
|
+
const chunk = new Uint8Array(64 * 1024);
|
|
16
|
+
const read = dntShim.Deno.stdin.readSync(chunk);
|
|
17
|
+
if (read === null) {
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
const used = chunk.subarray(0, read);
|
|
21
|
+
chunks.push(used);
|
|
22
|
+
total += read;
|
|
23
|
+
}
|
|
24
|
+
const output = new Uint8Array(total);
|
|
25
|
+
let offset = 0;
|
|
26
|
+
for (const chunk of chunks) {
|
|
27
|
+
output.set(chunk, offset);
|
|
28
|
+
offset += chunk.length;
|
|
29
|
+
}
|
|
30
|
+
return output;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validate positive integer options with explicit field-scoped errors.
|
|
34
|
+
*/
|
|
35
|
+
function asPositiveInteger(value, fallback, fieldName) {
|
|
36
|
+
if (value === undefined) {
|
|
37
|
+
return fallback;
|
|
38
|
+
}
|
|
39
|
+
if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) {
|
|
40
|
+
throw new Error(`${fieldName} must be a positive integer`);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate non-negative integer options with explicit field-scoped errors.
|
|
46
|
+
*/
|
|
47
|
+
function asNonNegativeInteger(value, fallback, fieldName) {
|
|
48
|
+
if (value === undefined) {
|
|
49
|
+
return fallback;
|
|
50
|
+
}
|
|
51
|
+
if (!Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
|
|
52
|
+
throw new Error(`${fieldName} must be a non-negative integer`);
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Normalize optional chunk sizing into a legal parse feed shape.
|
|
58
|
+
*/
|
|
59
|
+
function normalizeChunkSize(chunkSize, inputLength) {
|
|
60
|
+
if (chunkSize <= 0 || chunkSize >= inputLength) {
|
|
61
|
+
return inputLength;
|
|
62
|
+
}
|
|
63
|
+
return chunkSize;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build ordered chunk views over the input stream.
|
|
67
|
+
*
|
|
68
|
+
* Invariant:
|
|
69
|
+
* - uses `subarray` so benchmark execution does not add avoidable copy overhead.
|
|
70
|
+
*/
|
|
71
|
+
function createChunks(input, chunkSize) {
|
|
72
|
+
if (chunkSize >= input.length) {
|
|
73
|
+
return [input];
|
|
74
|
+
}
|
|
75
|
+
const chunks = [];
|
|
76
|
+
for (let offset = 0; offset < input.length; offset += chunkSize) {
|
|
77
|
+
chunks.push(input.subarray(offset, Math.min(offset + chunkSize, input.length)));
|
|
78
|
+
}
|
|
79
|
+
return chunks;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Execute one complete parser pass and aggregate frame/error events.
|
|
83
|
+
*/
|
|
84
|
+
function parseStreamOnce(input, chunkSize, parserOptions) {
|
|
85
|
+
const parser = createParser(parserOptions);
|
|
86
|
+
let frameCount = 0;
|
|
87
|
+
let errorCount = 0;
|
|
88
|
+
for (const chunk of createChunks(input, chunkSize)) {
|
|
89
|
+
for (const event of parser.feed(chunk)) {
|
|
90
|
+
if (event.type === "frame") {
|
|
91
|
+
frameCount++;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
errorCount++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
for (const event of parser.flush()) {
|
|
99
|
+
if (event.type === "frame") {
|
|
100
|
+
frameCount++;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
errorCount++;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { frameCount, errorCount };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Run timed parser benchmark loop for `tufa benchmark cesr`.
|
|
110
|
+
*
|
|
111
|
+
* Boundary contract:
|
|
112
|
+
* - warmup runs are excluded from timing.
|
|
113
|
+
* - correctness remains first: parse errors fail the benchmark unless
|
|
114
|
+
* explicitly allowed.
|
|
115
|
+
*/
|
|
116
|
+
function benchmarkParser(input, options) {
|
|
117
|
+
if (input.length === 0) {
|
|
118
|
+
throw new Error("Benchmark input stream must not be empty");
|
|
119
|
+
}
|
|
120
|
+
const iterations = asPositiveInteger(options.iterations, 50, "iterations");
|
|
121
|
+
const warmupIterations = asNonNegativeInteger(options.warmupIterations, 5, "warmup");
|
|
122
|
+
const parsedChunkSize = asNonNegativeInteger(options.chunkSize, 0, "chunkSize");
|
|
123
|
+
const chunkSize = normalizeChunkSize(parsedChunkSize, input.length);
|
|
124
|
+
const failOnParseError = !(options.allowErrors ?? false);
|
|
125
|
+
const parserOptions = {
|
|
126
|
+
framed: options.framed ?? false,
|
|
127
|
+
attachmentDispatchMode: options.compat ? "compat" : "strict",
|
|
128
|
+
};
|
|
129
|
+
for (let i = 0; i < warmupIterations; i++) {
|
|
130
|
+
parseStreamOnce(input, chunkSize, parserOptions);
|
|
131
|
+
}
|
|
132
|
+
let totalFrames = 0;
|
|
133
|
+
let totalErrors = 0;
|
|
134
|
+
const startMs = performance.now();
|
|
135
|
+
for (let i = 0; i < iterations; i++) {
|
|
136
|
+
const summary = parseStreamOnce(input, chunkSize, parserOptions);
|
|
137
|
+
totalFrames += summary.frameCount;
|
|
138
|
+
totalErrors += summary.errorCount;
|
|
139
|
+
if (failOnParseError && summary.errorCount > 0) {
|
|
140
|
+
throw new Error(`Benchmark run produced parse errors (run=${i + 1}, errorCount=${summary.errorCount})`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const elapsedMs = Math.max(performance.now() - startMs, Number.EPSILON);
|
|
144
|
+
const throughputMiBPerSec = ((input.length * iterations * 1000) / elapsedMs) /
|
|
145
|
+
(1024 * 1024);
|
|
146
|
+
const framesPerSec = (totalFrames * 1000) / elapsedMs;
|
|
147
|
+
return {
|
|
148
|
+
iterations,
|
|
149
|
+
warmupIterations,
|
|
150
|
+
bytesPerIteration: input.length,
|
|
151
|
+
chunkSize,
|
|
152
|
+
totalFrames,
|
|
153
|
+
totalErrors,
|
|
154
|
+
elapsedMs,
|
|
155
|
+
avgIterationMs: elapsedMs / iterations,
|
|
156
|
+
throughputMiBPerSec,
|
|
157
|
+
framesPerSec,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Render maintainer-oriented benchmark output for terminal use.
|
|
162
|
+
*/
|
|
163
|
+
function formatBenchmarkText(sourceLabel, result) {
|
|
164
|
+
const chunkLabel = result.chunkSize === result.bytesPerIteration
|
|
165
|
+
? "full stream"
|
|
166
|
+
: `${result.chunkSize} bytes`;
|
|
167
|
+
return [
|
|
168
|
+
"CESR parser benchmark",
|
|
169
|
+
`source: ${sourceLabel}`,
|
|
170
|
+
`iterations: ${result.iterations} (warmup: ${result.warmupIterations})`,
|
|
171
|
+
`input bytes/iteration: ${result.bytesPerIteration}`,
|
|
172
|
+
`chunk size: ${chunkLabel}`,
|
|
173
|
+
`frames/iteration: ${(result.totalFrames / result.iterations).toFixed(2)}`,
|
|
174
|
+
`errors/iteration: ${(result.totalErrors / result.iterations).toFixed(2)}`,
|
|
175
|
+
`avg iteration: ${result.avgIterationMs.toFixed(3)} ms`,
|
|
176
|
+
`throughput: ${result.throughputMiBPerSec.toFixed(3)} MiB/s`,
|
|
177
|
+
`frame rate: ${result.framesPerSec.toFixed(2)} frames/s`,
|
|
178
|
+
].join("\n");
|
|
179
|
+
}
|
|
180
|
+
// deno-lint-ignore require-yield
|
|
181
|
+
/**
|
|
182
|
+
* Effection command handler for `tufa benchmark cesr`.
|
|
183
|
+
*
|
|
184
|
+
* Responsibility boundary:
|
|
185
|
+
* - parse command options from dispatch args,
|
|
186
|
+
* - read stream input from file/stdin,
|
|
187
|
+
* - execute benchmark and emit one result payload (text or JSON).
|
|
188
|
+
*/
|
|
189
|
+
export function* benchmarkCommand(args) {
|
|
190
|
+
const options = {
|
|
191
|
+
inPath: args.inPath,
|
|
192
|
+
iterations: args.iterations,
|
|
193
|
+
warmupIterations: args.warmupIterations,
|
|
194
|
+
chunkSize: args.chunkSize,
|
|
195
|
+
framed: args.framed,
|
|
196
|
+
compat: args.compat,
|
|
197
|
+
allowErrors: args.allowErrors,
|
|
198
|
+
json: args.json,
|
|
199
|
+
};
|
|
200
|
+
const sourceLabel = options.inPath ? options.inPath : "stdin";
|
|
201
|
+
const inputBytes = options.inPath
|
|
202
|
+
? dntShim.Deno.readFileSync(options.inPath)
|
|
203
|
+
: readAllStdinSync();
|
|
204
|
+
const result = benchmarkParser(inputBytes, options);
|
|
205
|
+
if (options.json) {
|
|
206
|
+
console.log(JSON.stringify({ source: sourceLabel, ...result }));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
console.log(formatBenchmarkText(sourceLabel, result));
|
|
210
|
+
}
|
package/esm/app/cli/cli.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { AppError } from "../../core/errors.js";
|
|
4
|
-
import { createCoreCommandHandlers, registerCoreCommands, } from "./command-definitions.js";
|
|
5
|
-
import { createStubCommandHandlers, isStubCommandsEnabled, registerStubCommands, } from "./stub-commands.js";
|
|
6
4
|
import { DISPLAY_VERSION } from "../version.js";
|
|
5
|
+
import { createCmdHandlers, registerCmds } from "./command-definitions.js";
|
|
7
6
|
/**
|
|
8
7
|
* Create the CLI program with action handlers that signal command execution.
|
|
9
8
|
* Command declaration is delegated to focused command modules.
|
|
@@ -13,68 +12,67 @@ function createCLIProgram(onCommand) {
|
|
|
13
12
|
program.name("tufa").version(DISPLAY_VERSION).description("Trust Utilities for Agents CLI");
|
|
14
13
|
// Prevent Commander from exiting automatically so we can run Effection operations
|
|
15
14
|
program.exitOverride();
|
|
16
|
-
|
|
17
|
-
if (isStubCommandsEnabled()) {
|
|
18
|
-
registerStubCommands(program, onCommand);
|
|
19
|
-
}
|
|
15
|
+
registerCmds(program, onCommand);
|
|
20
16
|
return program;
|
|
21
17
|
}
|
|
18
|
+
function parseCLIArgs(program, args) {
|
|
19
|
+
// Commander expects full argv or args array.
|
|
20
|
+
// In Deno, Deno.args gives us the arguments without executable info.
|
|
21
|
+
const argsToParse = args.length > 0 ? args : dntShim.Deno.args;
|
|
22
|
+
program.parse(argsToParse, { from: "user" });
|
|
23
|
+
}
|
|
24
|
+
function isCommanderExitError(error) {
|
|
25
|
+
return !!(error && typeof error === "object" && "code" in error);
|
|
26
|
+
}
|
|
27
|
+
function isExpectedCommanderExit(code) {
|
|
28
|
+
return (code === "commander.help" ||
|
|
29
|
+
code === "commander.helpDisplayed" ||
|
|
30
|
+
code === "commander.version" ||
|
|
31
|
+
code === "commander.unknownCommand" ||
|
|
32
|
+
code === "commander.missingArgument");
|
|
33
|
+
}
|
|
34
|
+
function handleParseError(error) {
|
|
35
|
+
if (isCommanderExitError(error) && isExpectedCommanderExit(error.code)) {
|
|
36
|
+
// Commander already printed any relevant help/error output.
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
40
|
+
if (error instanceof AppError && error.context) {
|
|
41
|
+
console.error(`Error: ${message}`, error.context);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.error(`Error: ${message}`);
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
function* runCmd(selection, commandHandlers) {
|
|
49
|
+
if (!selection) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const handler = commandHandlers.get(selection.name);
|
|
53
|
+
if (!handler) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Execute command operation within Effection's structured concurrency.
|
|
57
|
+
yield* handler(selection.args);
|
|
58
|
+
}
|
|
22
59
|
/**
|
|
23
60
|
* Main CLI operation - runs within Effection's structured concurrency
|
|
24
61
|
* This is the outermost runtime, not JavaScript's event loop
|
|
25
62
|
*/
|
|
26
63
|
export function* tufa(args = []) {
|
|
27
|
-
const
|
|
28
|
-
const commandHandlers =
|
|
29
|
-
if (isStubCommandsEnabled()) {
|
|
30
|
-
for (const [key, handler] of createStubCommandHandlers()) {
|
|
31
|
-
commandHandlers.set(key, handler);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
64
|
+
const dispatch = {};
|
|
65
|
+
const commandHandlers = createCmdHandlers();
|
|
34
66
|
// Use Commander.js for all command parsing
|
|
35
67
|
const program = createCLIProgram((next) => {
|
|
36
|
-
|
|
68
|
+
dispatch.selection = next;
|
|
37
69
|
});
|
|
38
70
|
try {
|
|
39
|
-
|
|
40
|
-
// In Deno, Deno.args gives us the arguments without the executable info
|
|
41
|
-
const argsToParse = args.length > 0 ? args : dntShim.Deno.args;
|
|
42
|
-
program.parse(argsToParse, { from: "user" });
|
|
71
|
+
parseCLIArgs(program, args);
|
|
43
72
|
}
|
|
44
73
|
catch (error) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const commanderError = error;
|
|
48
|
-
// Help was requested - Commander already printed it, just return
|
|
49
|
-
if (commanderError.code === "commander.help" ||
|
|
50
|
-
commanderError.code === "commander.helpDisplayed" ||
|
|
51
|
-
commanderError.code === "commander.version") {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// Unknown command or other parsing errors - Commander already printed the error
|
|
55
|
-
if (commanderError.code === "commander.unknownCommand" ||
|
|
56
|
-
commanderError.code === "commander.missingArgument") {
|
|
57
|
-
// Commander already printed the error message, just exit gracefully
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// For other errors, log and rethrow
|
|
62
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
63
|
-
if (error instanceof AppError && error.context) {
|
|
64
|
-
console.error(`Error: ${message}`, error.context);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
console.error(`Error: ${message}`);
|
|
68
|
-
}
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
// Execute the appropriate command operation based on context
|
|
72
|
-
const selected = executionContext.selection;
|
|
73
|
-
if (selected) {
|
|
74
|
-
const handler = commandHandlers.get(selected.name);
|
|
75
|
-
if (handler) {
|
|
76
|
-
// Execute the command operation within Effection's structured concurrency
|
|
77
|
-
yield* handler(selected.args);
|
|
78
|
-
}
|
|
74
|
+
handleParseError(error);
|
|
75
|
+
return;
|
|
79
76
|
}
|
|
77
|
+
yield* runCmd(dispatch.selection, commandHandlers);
|
|
80
78
|
}
|