@defai.digital/ax-cli 3.8.9 → 3.8.11
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 +54 -1
- package/dist/index.js +0 -0
- package/dist/llm/tools.d.ts +30 -3
- package/dist/llm/tools.js +73 -43
- package/dist/llm/tools.js.map +1 -1
- package/dist/tools/text-editor.js +71 -98
- package/dist/tools/text-editor.js.map +1 -1
- package/node_modules/@ax-cli/schemas/README.md +388 -0
- package/node_modules/@ax-cli/schemas/dist/index.d.ts +14 -0
- package/node_modules/@ax-cli/schemas/dist/index.d.ts.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/index.js +19 -0
- package/node_modules/@ax-cli/schemas/dist/index.js.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/brand-types.d.ts +308 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/brand-types.d.ts.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/brand-types.js +243 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/brand-types.js.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/enums.d.ts +227 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/enums.d.ts.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/enums.js +222 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/enums.js.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/id-types.d.ts +286 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/id-types.d.ts.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/id-types.js +136 -0
- package/node_modules/@ax-cli/schemas/dist/public/core/id-types.js.map +1 -0
- package/node_modules/@ax-cli/schemas/package.json +54 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +208 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/package.json +118 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5136 -0
- package/node_modules/zod/src/v4/classic/checks.ts +30 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +66 -0
- package/node_modules/zod/src/v4/classic/errors.ts +75 -0
- package/node_modules/zod/src/v4/classic/external.ts +50 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +33 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1594 -0
- package/node_modules/zod/src/v4/core/checks.ts +1283 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +134 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +424 -0
- package/node_modules/zod/src/v4/core/function.ts +176 -0
- package/node_modules/zod/src/v4/core/index.ts +15 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
- package/node_modules/zod/src/v4/core/parse.ts +94 -0
- package/node_modules/zod/src/v4/core/regexes.ts +135 -0
- package/node_modules/zod/src/v4/core/registries.ts +96 -0
- package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
- package/node_modules/zod/src/v4/core/util.ts +775 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +125 -0
- package/node_modules/zod/src/v4/locales/az.ts +121 -0
- package/node_modules/zod/src/v4/locales/be.ts +184 -0
- package/node_modules/zod/src/v4/locales/ca.ts +127 -0
- package/node_modules/zod/src/v4/locales/cs.ts +142 -0
- package/node_modules/zod/src/v4/locales/de.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +127 -0
- package/node_modules/zod/src/v4/locales/eo.ts +125 -0
- package/node_modules/zod/src/v4/locales/es.ts +125 -0
- package/node_modules/zod/src/v4/locales/fa.ts +134 -0
- package/node_modules/zod/src/v4/locales/fi.ts +131 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr.ts +124 -0
- package/node_modules/zod/src/v4/locales/he.ts +125 -0
- package/node_modules/zod/src/v4/locales/hu.ts +126 -0
- package/node_modules/zod/src/v4/locales/id.ts +125 -0
- package/node_modules/zod/src/v4/locales/index.ts +39 -0
- package/node_modules/zod/src/v4/locales/it.ts +125 -0
- package/node_modules/zod/src/v4/locales/ja.ts +122 -0
- package/node_modules/zod/src/v4/locales/kh.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +131 -0
- package/node_modules/zod/src/v4/locales/mk.ts +127 -0
- package/node_modules/zod/src/v4/locales/ms.ts +124 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/no.ts +124 -0
- package/node_modules/zod/src/v4/locales/ota.ts +125 -0
- package/node_modules/zod/src/v4/locales/pl.ts +126 -0
- package/node_modules/zod/src/v4/locales/ps.ts +133 -0
- package/node_modules/zod/src/v4/locales/pt.ts +123 -0
- package/node_modules/zod/src/v4/locales/ru.ts +184 -0
- package/node_modules/zod/src/v4/locales/sl.ts +126 -0
- package/node_modules/zod/src/v4/locales/sv.ts +127 -0
- package/node_modules/zod/src/v4/locales/ta.ts +125 -0
- package/node_modules/zod/src/v4/locales/th.ts +126 -0
- package/node_modules/zod/src/v4/locales/tr.ts +121 -0
- package/node_modules/zod/src/v4/locales/ua.ts +126 -0
- package/node_modules/zod/src/v4/locales/ur.ts +126 -0
- package/node_modules/zod/src/v4/locales/vi.ts +125 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
- package/node_modules/zod/src/v4/mini/external.ts +40 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +62 -0
- package/node_modules/zod/src/v4/mini/parse.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
- package/node_modules/zod/src/v4-mini/index.ts +1 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +111 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3775 -0
- package/node_modules/zod/v3/types.d.cts +1031 -0
- package/node_modules/zod/v3/types.d.ts +1031 -0
- package/node_modules/zod/v3/types.js +3693 -0
- package/node_modules/zod/v4/classic/checks.cjs +32 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +57 -0
- package/node_modules/zod/v4/classic/compat.d.cts +46 -0
- package/node_modules/zod/v4/classic/compat.d.ts +46 -0
- package/node_modules/zod/v4/classic/compat.js +27 -0
- package/node_modules/zod/v4/classic/errors.cjs +67 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +41 -0
- package/node_modules/zod/v4/classic/external.cjs +70 -0
- package/node_modules/zod/v4/classic/external.d.cts +13 -0
- package/node_modules/zod/v4/classic/external.d.ts +13 -0
- package/node_modules/zod/v4/classic/external.js +18 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/parse.cjs +32 -0
- package/node_modules/zod/v4/classic/parse.d.cts +23 -0
- package/node_modules/zod/v4/classic/parse.d.ts +23 -0
- package/node_modules/zod/v4/classic/parse.js +6 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
- package/node_modules/zod/v4/classic/schemas.js +1006 -0
- package/node_modules/zod/v4/core/api.cjs +1039 -0
- package/node_modules/zod/v4/core/api.d.cts +284 -0
- package/node_modules/zod/v4/core/api.d.ts +284 -0
- package/node_modules/zod/v4/core/api.js +906 -0
- package/node_modules/zod/v4/core/checks.cjs +591 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +565 -0
- package/node_modules/zod/v4/core/core.cjs +67 -0
- package/node_modules/zod/v4/core/core.d.cts +49 -0
- package/node_modules/zod/v4/core/core.d.ts +49 -0
- package/node_modules/zod/v4/core/core.js +61 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +226 -0
- package/node_modules/zod/v4/core/errors.d.cts +208 -0
- package/node_modules/zod/v4/core/errors.d.ts +208 -0
- package/node_modules/zod/v4/core/errors.js +195 -0
- package/node_modules/zod/v4/core/function.cjs +102 -0
- package/node_modules/zod/v4/core/function.d.cts +52 -0
- package/node_modules/zod/v4/core/function.d.ts +52 -0
- package/node_modules/zod/v4/core/function.js +75 -0
- package/node_modules/zod/v4/core/index.cjs +44 -0
- package/node_modules/zod/v4/core/index.d.cts +15 -0
- package/node_modules/zod/v4/core/index.d.ts +15 -0
- package/node_modules/zod/v4/core/index.js +15 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/parse.cjs +87 -0
- package/node_modules/zod/v4/core/parse.d.cts +25 -0
- package/node_modules/zod/v4/core/parse.d.ts +25 -0
- package/node_modules/zod/v4/core/parse.js +57 -0
- package/node_modules/zod/v4/core/regexes.cjs +103 -0
- package/node_modules/zod/v4/core/regexes.d.cts +62 -0
- package/node_modules/zod/v4/core/regexes.d.ts +62 -0
- package/node_modules/zod/v4/core/regexes.js +95 -0
- package/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +1748 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
- package/node_modules/zod/v4/core/schemas.js +1717 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.js +849 -0
- package/node_modules/zod/v4/core/util.cjs +539 -0
- package/node_modules/zod/v4/core/util.d.cts +183 -0
- package/node_modules/zod/v4/core/util.d.ts +183 -0
- package/node_modules/zod/v4/core/util.js +493 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +142 -0
- package/node_modules/zod/v4/locales/ar.d.cts +4 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +116 -0
- package/node_modules/zod/v4/locales/az.cjs +141 -0
- package/node_modules/zod/v4/locales/az.d.cts +4 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +115 -0
- package/node_modules/zod/v4/locales/be.cjs +190 -0
- package/node_modules/zod/v4/locales/be.d.cts +4 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +164 -0
- package/node_modules/zod/v4/locales/ca.cjs +144 -0
- package/node_modules/zod/v4/locales/ca.d.cts +4 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +118 -0
- package/node_modules/zod/v4/locales/cs.cjs +161 -0
- package/node_modules/zod/v4/locales/cs.d.cts +4 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +135 -0
- package/node_modules/zod/v4/locales/de.cjs +142 -0
- package/node_modules/zod/v4/locales/de.d.cts +4 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +116 -0
- package/node_modules/zod/v4/locales/en.cjs +145 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +5 -0
- package/node_modules/zod/v4/locales/en.js +117 -0
- package/node_modules/zod/v4/locales/eo.cjs +144 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +5 -0
- package/node_modules/zod/v4/locales/eo.js +116 -0
- package/node_modules/zod/v4/locales/es.cjs +143 -0
- package/node_modules/zod/v4/locales/es.d.cts +4 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +117 -0
- package/node_modules/zod/v4/locales/fa.cjs +148 -0
- package/node_modules/zod/v4/locales/fa.d.cts +4 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +122 -0
- package/node_modules/zod/v4/locales/fi.cjs +148 -0
- package/node_modules/zod/v4/locales/fi.d.cts +4 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +122 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +117 -0
- package/node_modules/zod/v4/locales/fr.cjs +142 -0
- package/node_modules/zod/v4/locales/fr.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +116 -0
- package/node_modules/zod/v4/locales/he.cjs +143 -0
- package/node_modules/zod/v4/locales/he.d.cts +4 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +117 -0
- package/node_modules/zod/v4/locales/hu.cjs +143 -0
- package/node_modules/zod/v4/locales/hu.d.cts +4 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +117 -0
- package/node_modules/zod/v4/locales/id.cjs +142 -0
- package/node_modules/zod/v4/locales/id.d.cts +4 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +116 -0
- package/node_modules/zod/v4/locales/index.cjs +84 -0
- package/node_modules/zod/v4/locales/index.d.cts +39 -0
- package/node_modules/zod/v4/locales/index.d.ts +39 -0
- package/node_modules/zod/v4/locales/index.js +39 -0
- package/node_modules/zod/v4/locales/it.cjs +143 -0
- package/node_modules/zod/v4/locales/it.d.cts +4 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +117 -0
- package/node_modules/zod/v4/locales/ja.cjs +141 -0
- package/node_modules/zod/v4/locales/ja.d.cts +4 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +115 -0
- package/node_modules/zod/v4/locales/kh.cjs +143 -0
- package/node_modules/zod/v4/locales/kh.d.cts +4 -0
- package/node_modules/zod/v4/locales/kh.d.ts +4 -0
- package/node_modules/zod/v4/locales/kh.js +117 -0
- package/node_modules/zod/v4/locales/ko.cjs +147 -0
- package/node_modules/zod/v4/locales/ko.d.cts +4 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +121 -0
- package/node_modules/zod/v4/locales/mk.cjs +144 -0
- package/node_modules/zod/v4/locales/mk.d.cts +4 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +118 -0
- package/node_modules/zod/v4/locales/ms.cjs +142 -0
- package/node_modules/zod/v4/locales/ms.d.cts +4 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +116 -0
- package/node_modules/zod/v4/locales/nl.cjs +143 -0
- package/node_modules/zod/v4/locales/nl.d.cts +4 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +117 -0
- package/node_modules/zod/v4/locales/no.cjs +142 -0
- package/node_modules/zod/v4/locales/no.d.cts +4 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +116 -0
- package/node_modules/zod/v4/locales/ota.cjs +143 -0
- package/node_modules/zod/v4/locales/ota.d.cts +4 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +117 -0
- package/node_modules/zod/v4/locales/pl.cjs +143 -0
- package/node_modules/zod/v4/locales/pl.d.cts +4 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +117 -0
- package/node_modules/zod/v4/locales/ps.cjs +148 -0
- package/node_modules/zod/v4/locales/ps.d.cts +4 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +122 -0
- package/node_modules/zod/v4/locales/pt.cjs +142 -0
- package/node_modules/zod/v4/locales/pt.d.cts +4 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +116 -0
- package/node_modules/zod/v4/locales/ru.cjs +190 -0
- package/node_modules/zod/v4/locales/ru.d.cts +4 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +164 -0
- package/node_modules/zod/v4/locales/sl.cjs +143 -0
- package/node_modules/zod/v4/locales/sl.d.cts +4 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +117 -0
- package/node_modules/zod/v4/locales/sv.cjs +144 -0
- package/node_modules/zod/v4/locales/sv.d.cts +4 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +118 -0
- package/node_modules/zod/v4/locales/ta.cjs +143 -0
- package/node_modules/zod/v4/locales/ta.d.cts +4 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +143 -0
- package/node_modules/zod/v4/locales/th.d.cts +4 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +117 -0
- package/node_modules/zod/v4/locales/tr.cjs +143 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +5 -0
- package/node_modules/zod/v4/locales/tr.js +115 -0
- package/node_modules/zod/v4/locales/ua.cjs +143 -0
- package/node_modules/zod/v4/locales/ua.d.cts +4 -0
- package/node_modules/zod/v4/locales/ua.d.ts +4 -0
- package/node_modules/zod/v4/locales/ua.js +117 -0
- package/node_modules/zod/v4/locales/ur.cjs +143 -0
- package/node_modules/zod/v4/locales/ur.d.cts +4 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +117 -0
- package/node_modules/zod/v4/locales/vi.cjs +142 -0
- package/node_modules/zod/v4/locales/vi.d.cts +4 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +116 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +116 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +117 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +47 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +17 -0
- package/node_modules/zod/v4/mini/external.cjs +62 -0
- package/node_modules/zod/v4/mini/external.d.cts +11 -0
- package/node_modules/zod/v4/mini/external.d.ts +11 -0
- package/node_modules/zod/v4/mini/external.js +13 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +60 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +30 -0
- package/node_modules/zod/v4/mini/parse.cjs +8 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +839 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
- package/node_modules/zod/v4/mini/schemas.js +732 -0
- package/node_modules/zod/v4-mini/index.cjs +17 -0
- package/node_modules/zod/v4-mini/index.d.cts +1 -0
- package/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/node_modules/zod/v4-mini/index.js +1 -0
- package/package.json +8 -3
- package/packages/schemas/dist/index.d.ts +14 -0
- package/packages/schemas/dist/index.d.ts.map +1 -0
- package/packages/schemas/dist/index.js +19 -0
- package/packages/schemas/dist/index.js.map +1 -0
- package/packages/schemas/dist/public/core/brand-types.d.ts +308 -0
- package/packages/schemas/dist/public/core/brand-types.d.ts.map +1 -0
- package/packages/schemas/dist/public/core/brand-types.js +243 -0
- package/packages/schemas/dist/public/core/brand-types.js.map +1 -0
- package/packages/schemas/dist/public/core/enums.d.ts +227 -0
- package/packages/schemas/dist/public/core/enums.d.ts.map +1 -0
- package/packages/schemas/dist/public/core/enums.js +222 -0
- package/packages/schemas/dist/public/core/enums.js.map +1 -0
- package/packages/schemas/dist/public/core/id-types.d.ts +286 -0
- package/packages/schemas/dist/public/core/id-types.d.ts.map +1 -0
- package/packages/schemas/dist/public/core/id-types.js +136 -0
- package/packages/schemas/dist/public/core/id-types.js.map +1 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
- [🚀 Quick Start](#-quick-start)
|
|
22
22
|
- [✨ Features](#-features)
|
|
23
|
-
- [🎉 What's New](#-whats-new-in-
|
|
23
|
+
- [🎉 What's New](#-whats-new-in-v3811)
|
|
24
24
|
- [📦 Installation](#-installation)
|
|
25
25
|
- [⚙️ Configuration](#️-configuration)
|
|
26
26
|
- [🔒 Security](#-security--api-key-handling)
|
|
@@ -150,6 +150,59 @@ AX CLI uses **industry-standard max tokens** based on research of leading AI cod
|
|
|
150
150
|
|
|
151
151
|
[View all features →](docs/features.md)
|
|
152
152
|
|
|
153
|
+
## 🎉 What's New in v3.8.11
|
|
154
|
+
|
|
155
|
+
**Critical npm Install Fix** - Fixes the `ERR_MODULE_NOT_FOUND` error when running ax-cli after npm install:
|
|
156
|
+
|
|
157
|
+
### 🐛 Bug Fixes
|
|
158
|
+
|
|
159
|
+
- **Fixed @ax-cli/schemas module not found** - Resolved the error where Node.js couldn't find the bundled `@ax-cli/schemas` package
|
|
160
|
+
- Added `prepublishOnly` script that properly copies workspace package to `node_modules/` before publishing
|
|
161
|
+
- Added `postpublish` script to restore workspace symlink for local development
|
|
162
|
+
- `bundleDependencies` now correctly includes the package files in the npm tarball
|
|
163
|
+
|
|
164
|
+
### 🔧 Technical Details
|
|
165
|
+
|
|
166
|
+
The issue was that npm's `bundleDependencies` doesn't follow workspace symlinks. The fix:
|
|
167
|
+
1. Before publish: Replace symlink with real directory copy
|
|
168
|
+
2. npm pack/publish: Bundles the actual files into tarball
|
|
169
|
+
3. After publish: Restore symlink for local development
|
|
170
|
+
|
|
171
|
+
### ✅ Quality
|
|
172
|
+
|
|
173
|
+
- Verified: Package extracts and runs correctly after npm install
|
|
174
|
+
- All tests passing
|
|
175
|
+
- Zero breaking changes
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 🎉 What's New in v3.8.10
|
|
180
|
+
|
|
181
|
+
**npm Publish Fix & Code Quality** - Critical fix for npm installation and continued refactoring:
|
|
182
|
+
|
|
183
|
+
### 🐛 Bug Fixes
|
|
184
|
+
|
|
185
|
+
- **Fixed npm install failure** - Resolved `EUNSUPPORTEDPROTOCOL` error when installing from npm
|
|
186
|
+
- Changed `workspace:*` (pnpm-specific) to `*` (npm-compatible) for `@ax-cli/schemas` dependency
|
|
187
|
+
- Added `bundleDependencies` to properly bundle the workspace package in npm tarball
|
|
188
|
+
- Users can now install with `npm install -g @defai.digital/ax-cli` without errors
|
|
189
|
+
|
|
190
|
+
### 🔧 Improvements
|
|
191
|
+
|
|
192
|
+
- **Centralized tool constants** - Added `TOOL_DEFAULTS` constant object in `src/llm/tools.ts`
|
|
193
|
+
- **Unified naming conventions** - Renamed `GROK_TOOLS` to `LLM_TOOLS` with backwards-compatible aliases
|
|
194
|
+
- **Enhanced text editor** - Added `EDITOR_CONFIG` and `ERROR_MESSAGES` constants for maintainability
|
|
195
|
+
- **Atomic file writes** - Extracted `atomicWriteFile()` helper to eliminate code duplication
|
|
196
|
+
|
|
197
|
+
### ✅ Quality
|
|
198
|
+
|
|
199
|
+
- All 2083 tests passing
|
|
200
|
+
- TypeScript strict mode passes
|
|
201
|
+
- Build succeeds
|
|
202
|
+
- Zero breaking changes
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
153
206
|
## 🎉 What's New in v3.8.9
|
|
154
207
|
|
|
155
208
|
**Refactoring & Configuration Improvements** - Further centralization and code quality enhancements:
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/llm/tools.d.ts
CHANGED
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
import { LLMTool } from "./client.js";
|
|
2
2
|
import { MCPManager, MCPTool } from "../mcp/client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Exported tool definitions
|
|
5
|
+
* @deprecated Use LLM_TOOLS instead of GROK_TOOLS (legacy name kept for backwards compatibility)
|
|
6
|
+
*/
|
|
3
7
|
export declare const GROK_TOOLS: LLMTool[];
|
|
8
|
+
export declare const LLM_TOOLS: LLMTool[];
|
|
9
|
+
/**
|
|
10
|
+
* Get or create the MCP manager singleton
|
|
11
|
+
*/
|
|
4
12
|
export declare function getMCPManager(): MCPManager;
|
|
5
13
|
/**
|
|
6
14
|
* Get the count of connected MCP servers
|
|
7
15
|
* Safe to call even if MCP manager is not initialized
|
|
8
16
|
*/
|
|
9
17
|
export declare function getMcpConnectionCount(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Initialize MCP servers from config
|
|
20
|
+
*/
|
|
10
21
|
export declare function initializeMCPServers(): Promise<void>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Convert MCP tool format to LLM tool format
|
|
24
|
+
*/
|
|
25
|
+
export declare function convertMCPToolToLLMTool(mcpTool: MCPTool): LLMTool;
|
|
26
|
+
/** @deprecated Use convertMCPToolToLLMTool instead */
|
|
27
|
+
export declare const convertMCPToolToGrokTool: typeof convertMCPToolToLLMTool;
|
|
28
|
+
/**
|
|
29
|
+
* Merge base tools with MCP tools
|
|
30
|
+
*/
|
|
31
|
+
export declare function mergeWithMCPTools(baseTools: LLMTool[]): LLMTool[];
|
|
32
|
+
/** @deprecated Use mergeWithMCPTools instead */
|
|
33
|
+
export declare const addMCPToolsToGrokTools: typeof mergeWithMCPTools;
|
|
34
|
+
/**
|
|
35
|
+
* Get all available tools (base + MCP)
|
|
36
|
+
* Handles MCP initialization with timeout
|
|
37
|
+
*/
|
|
38
|
+
export declare function getAllTools(): Promise<LLMTool[]>;
|
|
39
|
+
/** @deprecated Use getAllTools instead */
|
|
40
|
+
export declare const getAllGrokTools: typeof getAllTools;
|
package/dist/llm/tools.js
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { MCPManager } from "../mcp/client.js";
|
|
2
2
|
import { loadMCPConfig } from "../mcp/config.js";
|
|
3
3
|
import { extractErrorMessage } from "../utils/error-handler.js";
|
|
4
|
-
|
|
4
|
+
// Tool configuration constants
|
|
5
|
+
const TOOL_DEFAULTS = {
|
|
6
|
+
BASH_TIMEOUT_MS: 30000,
|
|
7
|
+
MCP_INIT_TIMEOUT_MS: 5000,
|
|
8
|
+
SEARCH_MAX_RESULTS: 50,
|
|
9
|
+
};
|
|
10
|
+
// MCP log messages to suppress (verbose connection logs)
|
|
11
|
+
const MCP_SUPPRESSED_LOG_PATTERNS = [
|
|
12
|
+
'Using existing client port',
|
|
13
|
+
'Connecting to remote server',
|
|
14
|
+
'Using transport strategy',
|
|
15
|
+
'Connected to remote server',
|
|
16
|
+
'Local STDIO server running',
|
|
17
|
+
'Proxy established successfully',
|
|
18
|
+
'Local→Remote',
|
|
19
|
+
'Remote→Local',
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Core tool definitions for the LLM agent
|
|
23
|
+
* Named BASE_LLM_TOOLS (not GROK) to reflect actual usage
|
|
24
|
+
*/
|
|
25
|
+
const BASE_LLM_TOOLS = [
|
|
5
26
|
{
|
|
6
27
|
type: "function",
|
|
7
28
|
function: {
|
|
@@ -130,7 +151,7 @@ const BASE_GROK_TOOLS = [
|
|
|
130
151
|
},
|
|
131
152
|
timeout: {
|
|
132
153
|
type: "number",
|
|
133
|
-
description:
|
|
154
|
+
description: `Timeout in milliseconds (default: ${TOOL_DEFAULTS.BASH_TIMEOUT_MS}). Ignored for background commands.`,
|
|
134
155
|
},
|
|
135
156
|
},
|
|
136
157
|
required: ["command"],
|
|
@@ -155,7 +176,7 @@ const BASE_GROK_TOOLS = [
|
|
|
155
176
|
},
|
|
156
177
|
timeout: {
|
|
157
178
|
type: "number",
|
|
158
|
-
description:
|
|
179
|
+
description: `Maximum time to wait in milliseconds if wait is true (default: ${TOOL_DEFAULTS.BASH_TIMEOUT_MS})`,
|
|
159
180
|
},
|
|
160
181
|
},
|
|
161
182
|
required: ["task_id"],
|
|
@@ -201,7 +222,7 @@ const BASE_GROK_TOOLS = [
|
|
|
201
222
|
},
|
|
202
223
|
max_results: {
|
|
203
224
|
type: "number",
|
|
204
|
-
description:
|
|
225
|
+
description: `Maximum number of results to return (default: ${TOOL_DEFAULTS.SEARCH_MAX_RESULTS})`,
|
|
205
226
|
},
|
|
206
227
|
file_types: {
|
|
207
228
|
type: "array",
|
|
@@ -348,14 +369,17 @@ const BASE_GROK_TOOLS = [
|
|
|
348
369
|
},
|
|
349
370
|
},
|
|
350
371
|
];
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
export const
|
|
357
|
-
// Global MCP manager instance
|
|
372
|
+
/**
|
|
373
|
+
* Exported tool definitions
|
|
374
|
+
* @deprecated Use LLM_TOOLS instead of GROK_TOOLS (legacy name kept for backwards compatibility)
|
|
375
|
+
*/
|
|
376
|
+
export const GROK_TOOLS = [...BASE_LLM_TOOLS];
|
|
377
|
+
export const LLM_TOOLS = GROK_TOOLS; // Preferred name
|
|
378
|
+
// Global MCP manager instance (singleton pattern)
|
|
358
379
|
let mcpManager = null;
|
|
380
|
+
/**
|
|
381
|
+
* Get or create the MCP manager singleton
|
|
382
|
+
*/
|
|
359
383
|
export function getMCPManager() {
|
|
360
384
|
if (!mcpManager) {
|
|
361
385
|
mcpManager = new MCPManager();
|
|
@@ -367,34 +391,30 @@ export function getMCPManager() {
|
|
|
367
391
|
* Safe to call even if MCP manager is not initialized
|
|
368
392
|
*/
|
|
369
393
|
export function getMcpConnectionCount() {
|
|
370
|
-
|
|
371
|
-
return 0;
|
|
372
|
-
}
|
|
373
|
-
return mcpManager.getServers().length;
|
|
394
|
+
return mcpManager?.getServers().length ?? 0;
|
|
374
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Check if a log message should be suppressed
|
|
398
|
+
*/
|
|
399
|
+
function shouldSuppressMcpLog(message) {
|
|
400
|
+
if (!message.includes('['))
|
|
401
|
+
return false;
|
|
402
|
+
return MCP_SUPPRESSED_LOG_PATTERNS.some(pattern => message.includes(pattern));
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Initialize MCP servers from config
|
|
406
|
+
*/
|
|
375
407
|
export async function initializeMCPServers() {
|
|
376
408
|
const manager = getMCPManager();
|
|
377
409
|
const config = loadMCPConfig();
|
|
378
|
-
//
|
|
410
|
+
// Temporarily suppress verbose MCP connection logs
|
|
379
411
|
const originalStderrWrite = process.stderr.write;
|
|
380
|
-
// Temporarily suppress stderr to hide verbose MCP connection logs
|
|
381
412
|
process.stderr.write = function (chunk, encoding, callback) {
|
|
382
|
-
|
|
383
|
-
const chunkStr = chunk.toString();
|
|
384
|
-
if (chunkStr.includes('[') && (chunkStr.includes('Using existing client port') ||
|
|
385
|
-
chunkStr.includes('Connecting to remote server') ||
|
|
386
|
-
chunkStr.includes('Using transport strategy') ||
|
|
387
|
-
chunkStr.includes('Connected to remote server') ||
|
|
388
|
-
chunkStr.includes('Local STDIO server running') ||
|
|
389
|
-
chunkStr.includes('Proxy established successfully') ||
|
|
390
|
-
chunkStr.includes('Local→Remote') ||
|
|
391
|
-
chunkStr.includes('Remote→Local'))) {
|
|
392
|
-
// Suppress these verbose logs
|
|
413
|
+
if (shouldSuppressMcpLog(chunk.toString())) {
|
|
393
414
|
if (callback)
|
|
394
415
|
callback();
|
|
395
416
|
return true;
|
|
396
417
|
}
|
|
397
|
-
// Allow other stderr output
|
|
398
418
|
return originalStderrWrite.call(this, chunk, encoding, callback);
|
|
399
419
|
};
|
|
400
420
|
try {
|
|
@@ -408,11 +428,13 @@ export async function initializeMCPServers() {
|
|
|
408
428
|
}
|
|
409
429
|
}
|
|
410
430
|
finally {
|
|
411
|
-
// Restore original stderr.write
|
|
412
431
|
process.stderr.write = originalStderrWrite;
|
|
413
432
|
}
|
|
414
433
|
}
|
|
415
|
-
|
|
434
|
+
/**
|
|
435
|
+
* Convert MCP tool format to LLM tool format
|
|
436
|
+
*/
|
|
437
|
+
export function convertMCPToolToLLMTool(mcpTool) {
|
|
416
438
|
return {
|
|
417
439
|
type: "function",
|
|
418
440
|
function: {
|
|
@@ -426,25 +448,32 @@ export function convertMCPToolToGrokTool(mcpTool) {
|
|
|
426
448
|
}
|
|
427
449
|
};
|
|
428
450
|
}
|
|
429
|
-
|
|
451
|
+
/** @deprecated Use convertMCPToolToLLMTool instead */
|
|
452
|
+
export const convertMCPToolToGrokTool = convertMCPToolToLLMTool;
|
|
453
|
+
/**
|
|
454
|
+
* Merge base tools with MCP tools
|
|
455
|
+
*/
|
|
456
|
+
export function mergeWithMCPTools(baseTools) {
|
|
430
457
|
if (!mcpManager) {
|
|
431
458
|
return baseTools;
|
|
432
459
|
}
|
|
433
|
-
const mcpTools = mcpManager.getTools();
|
|
434
|
-
|
|
435
|
-
return [...baseTools, ...grokMCPTools];
|
|
460
|
+
const mcpTools = mcpManager.getTools().map(convertMCPToolToLLMTool);
|
|
461
|
+
return [...baseTools, ...mcpTools];
|
|
436
462
|
}
|
|
437
|
-
|
|
463
|
+
/** @deprecated Use mergeWithMCPTools instead */
|
|
464
|
+
export const addMCPToolsToGrokTools = mergeWithMCPTools;
|
|
465
|
+
/**
|
|
466
|
+
* Get all available tools (base + MCP)
|
|
467
|
+
* Handles MCP initialization with timeout
|
|
468
|
+
*/
|
|
469
|
+
export async function getAllTools() {
|
|
438
470
|
const manager = getMCPManager();
|
|
439
|
-
// Try to initialize servers if not already done
|
|
440
|
-
// Log errors but continue without MCP tools rather than blocking
|
|
441
471
|
try {
|
|
442
|
-
// Create timeout with proper cleanup to prevent memory leak and unhandled rejection
|
|
443
472
|
let timeoutId;
|
|
444
473
|
const timeoutPromise = new Promise((_, reject) => {
|
|
445
|
-
timeoutId = setTimeout(() => reject(new Error('MCP init timeout')),
|
|
474
|
+
timeoutId = setTimeout(() => reject(new Error('MCP init timeout')), TOOL_DEFAULTS.MCP_INIT_TIMEOUT_MS);
|
|
446
475
|
});
|
|
447
|
-
//
|
|
476
|
+
// Prevent unhandled rejection if timeout loses race
|
|
448
477
|
timeoutPromise.catch(() => { });
|
|
449
478
|
await Promise.race([
|
|
450
479
|
manager.ensureServersInitialized().finally(() => {
|
|
@@ -456,8 +485,9 @@ export async function getAllGrokTools() {
|
|
|
456
485
|
}
|
|
457
486
|
catch (error) {
|
|
458
487
|
console.warn('MCP server initialization failed:', extractErrorMessage(error));
|
|
459
|
-
// Continue without MCP tools rather than blocking
|
|
460
488
|
}
|
|
461
|
-
return
|
|
489
|
+
return mergeWithMCPTools(LLM_TOOLS);
|
|
462
490
|
}
|
|
491
|
+
/** @deprecated Use getAllTools instead */
|
|
492
|
+
export const getAllGrokTools = getAllTools;
|
|
463
493
|
//# sourceMappingURL=tools.js.map
|
package/dist/llm/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/llm/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAW,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,eAAe,GAAc;
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/llm/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAW,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,+BAA+B;AAC/B,MAAM,aAAa,GAAG;IACpB,eAAe,EAAE,KAAK;IACtB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,EAAE;CACd,CAAC;AAEX,yDAAyD;AACzD,MAAM,2BAA2B,GAAG;IAClC,4BAA4B;IAC5B,6BAA6B;IAC7B,0BAA0B;IAC1B,4BAA4B;IAC5B,4BAA4B;IAC5B,gCAAgC;IAChC,cAAc;IACd,cAAc;CACN,CAAC;AAEX;;;GAGG;AACH,MAAM,cAAc,GAAc;IA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,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,mCAAmC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,0CAA0C;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC"}
|
|
@@ -4,10 +4,35 @@ import { writeFile as writeFilePromise } from "fs/promises";
|
|
|
4
4
|
import { ConfirmationService } from "../utils/confirmation-service.js";
|
|
5
5
|
import { validatePathSecure } from "../utils/path-security.js";
|
|
6
6
|
import { getMessageOptimizer } from "../utils/message-optimizer.js";
|
|
7
|
-
import { isDestructiveFileOperation } from "../utils/safety-rules.js";
|
|
8
|
-
import { getAutoAcceptLogger } from "../utils/auto-accept-logger.js";
|
|
9
|
-
import { getSettingsManager } from "../utils/settings-manager.js";
|
|
10
|
-
import { ErrorCategory, createToolError } from "../utils/error-handler.js";
|
|
7
|
+
import { isDestructiveFileOperation } from "../utils/safety-rules.js";
|
|
8
|
+
import { getAutoAcceptLogger } from "../utils/auto-accept-logger.js";
|
|
9
|
+
import { getSettingsManager } from "../utils/settings-manager.js";
|
|
10
|
+
import { ErrorCategory, createToolError } from "../utils/error-handler.js";
|
|
11
|
+
// Configuration constants
|
|
12
|
+
const EDITOR_CONFIG = {
|
|
13
|
+
/** Number of context lines to show in diffs */
|
|
14
|
+
DIFF_CONTEXT_LINES: 3,
|
|
15
|
+
/** Minimum similarity score for fuzzy line matching */
|
|
16
|
+
LINE_SIMILARITY_THRESHOLD: 0.75,
|
|
17
|
+
/** Minimum similarity score for block matching */
|
|
18
|
+
BLOCK_SIMILARITY_THRESHOLD: 0.55,
|
|
19
|
+
/** Minimum similarity for suggestions */
|
|
20
|
+
SUGGESTION_SIMILARITY_THRESHOLD: 0.4,
|
|
21
|
+
/** File encoding */
|
|
22
|
+
FILE_ENCODING: "utf-8",
|
|
23
|
+
};
|
|
24
|
+
// Error messages (centralized for consistency)
|
|
25
|
+
const ERROR_MESSAGES = {
|
|
26
|
+
FILE_NOT_FOUND: (filePath) => `File not found: ${filePath}`,
|
|
27
|
+
SECURITY_ERROR: (error) => `Security: ${error}`,
|
|
28
|
+
EMPTY_SEARCH_STRING: "Search string cannot be empty",
|
|
29
|
+
STRING_NOT_FOUND: (str) => `String not found in file: "${str}"`,
|
|
30
|
+
FILE_MODIFIED_DURING_CONFIRMATION: "File was modified by another process during confirmation. Please retry the operation.",
|
|
31
|
+
NO_EDITS_TO_UNDO: "No edits to undo",
|
|
32
|
+
EDIT_CANCELLED: (operation) => `${operation} cancelled by user`,
|
|
33
|
+
NO_EDITS_PROVIDED: "No edits provided",
|
|
34
|
+
EMPTY_OLD_STR: (index) => `Edit ${index + 1}: old_str cannot be empty`,
|
|
35
|
+
};
|
|
11
36
|
/**
|
|
12
37
|
* Check if file exists and return appropriate error if not
|
|
13
38
|
*/
|
|
@@ -16,11 +41,32 @@ async function checkFileExists(filePath) {
|
|
|
16
41
|
if (!(await fs.pathExists(resolvedPath))) {
|
|
17
42
|
return {
|
|
18
43
|
success: false,
|
|
19
|
-
error:
|
|
44
|
+
error: ERROR_MESSAGES.FILE_NOT_FOUND(filePath),
|
|
20
45
|
};
|
|
21
46
|
}
|
|
22
47
|
return null;
|
|
23
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Atomically write content to file using temp file + rename pattern
|
|
51
|
+
* Ensures either full write or no write (prevents partial writes)
|
|
52
|
+
*/
|
|
53
|
+
async function atomicWriteFile(filePath, content) {
|
|
54
|
+
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
55
|
+
try {
|
|
56
|
+
await writeFilePromise(tempPath, content, EDITOR_CONFIG.FILE_ENCODING);
|
|
57
|
+
await fs.rename(tempPath, filePath);
|
|
58
|
+
}
|
|
59
|
+
catch (writeError) {
|
|
60
|
+
// Clean up temp file on failure
|
|
61
|
+
try {
|
|
62
|
+
await fs.unlink(tempPath);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Ignore cleanup errors
|
|
66
|
+
}
|
|
67
|
+
throw writeError;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
24
70
|
export class TextEditorTool {
|
|
25
71
|
editHistory = [];
|
|
26
72
|
confirmationService = ConfirmationService.getInstance();
|
|
@@ -231,23 +277,8 @@ export class TextEditorTool {
|
|
|
231
277
|
}
|
|
232
278
|
// Create checkpoint before modification
|
|
233
279
|
await this.createCheckpointIfNeeded(filePath, 'str_replace');
|
|
234
|
-
//
|
|
235
|
-
|
|
236
|
-
const tempPath = `${resolvedPath}.tmp.${Date.now()}`;
|
|
237
|
-
try {
|
|
238
|
-
await writeFilePromise(tempPath, newContent, "utf-8");
|
|
239
|
-
await fs.rename(tempPath, resolvedPath);
|
|
240
|
-
}
|
|
241
|
-
catch (writeError) {
|
|
242
|
-
// Clean up temp file if it exists
|
|
243
|
-
try {
|
|
244
|
-
await fs.unlink(tempPath);
|
|
245
|
-
}
|
|
246
|
-
catch {
|
|
247
|
-
// Ignore cleanup errors
|
|
248
|
-
}
|
|
249
|
-
throw writeError;
|
|
250
|
-
}
|
|
280
|
+
// Atomic write
|
|
281
|
+
await atomicWriteFile(resolvedPath, newContent);
|
|
251
282
|
this.editHistory.push({
|
|
252
283
|
command: "str_replace",
|
|
253
284
|
path: filePath,
|
|
@@ -256,7 +287,7 @@ export class TextEditorTool {
|
|
|
256
287
|
});
|
|
257
288
|
return {
|
|
258
289
|
success: true,
|
|
259
|
-
output: diffContent,
|
|
290
|
+
output: diffContent,
|
|
260
291
|
};
|
|
261
292
|
}
|
|
262
293
|
catch (error) {
|
|
@@ -319,23 +350,8 @@ export class TextEditorTool {
|
|
|
319
350
|
await this.createCheckpointIfNeeded(filePath, 'create');
|
|
320
351
|
const dir = path.dirname(resolvedPath);
|
|
321
352
|
await fs.ensureDir(dir);
|
|
322
|
-
//
|
|
323
|
-
|
|
324
|
-
const tempPath = `${resolvedPath}.tmp.${Date.now()}`;
|
|
325
|
-
try {
|
|
326
|
-
await writeFilePromise(tempPath, content, "utf-8");
|
|
327
|
-
await fs.rename(tempPath, resolvedPath);
|
|
328
|
-
}
|
|
329
|
-
catch (writeError) {
|
|
330
|
-
// Clean up temp file if it exists
|
|
331
|
-
try {
|
|
332
|
-
await fs.unlink(tempPath);
|
|
333
|
-
}
|
|
334
|
-
catch {
|
|
335
|
-
// Ignore cleanup errors
|
|
336
|
-
}
|
|
337
|
-
throw writeError;
|
|
338
|
-
}
|
|
353
|
+
// Atomic write
|
|
354
|
+
await atomicWriteFile(resolvedPath, content);
|
|
339
355
|
this.editHistory.push({
|
|
340
356
|
command: "create",
|
|
341
357
|
path: filePath,
|
|
@@ -407,23 +423,8 @@ export class TextEditorTool {
|
|
|
407
423
|
const replacementLines = newContent.split("\n");
|
|
408
424
|
lines.splice(startLine - 1, endLine - startLine + 1, ...replacementLines);
|
|
409
425
|
const newFileContent = lines.join("\n");
|
|
410
|
-
//
|
|
411
|
-
|
|
412
|
-
const tempPath = `${resolvedPath}.tmp.${Date.now()}`;
|
|
413
|
-
try {
|
|
414
|
-
await writeFilePromise(tempPath, newFileContent, "utf-8");
|
|
415
|
-
await fs.rename(tempPath, resolvedPath);
|
|
416
|
-
}
|
|
417
|
-
catch (writeError) {
|
|
418
|
-
// Clean up temp file if it exists
|
|
419
|
-
try {
|
|
420
|
-
await fs.unlink(tempPath);
|
|
421
|
-
}
|
|
422
|
-
catch {
|
|
423
|
-
// Ignore cleanup errors
|
|
424
|
-
}
|
|
425
|
-
throw writeError;
|
|
426
|
-
}
|
|
426
|
+
// Atomic write
|
|
427
|
+
await atomicWriteFile(resolvedPath, newFileContent);
|
|
427
428
|
this.editHistory.push({
|
|
428
429
|
command: "str_replace",
|
|
429
430
|
path: filePath,
|
|
@@ -489,28 +490,13 @@ export class TextEditorTool {
|
|
|
489
490
|
if (!shouldProceed) {
|
|
490
491
|
return {
|
|
491
492
|
success: false,
|
|
492
|
-
error: "Insert operation
|
|
493
|
+
error: ERROR_MESSAGES.EDIT_CANCELLED("Insert operation"),
|
|
493
494
|
};
|
|
494
495
|
}
|
|
495
|
-
// Create checkpoint before modification
|
|
496
|
+
// Create checkpoint before modification
|
|
496
497
|
await this.createCheckpointIfNeeded(filePath, 'insert');
|
|
497
|
-
//
|
|
498
|
-
|
|
499
|
-
const tempPath = `${resolvedPath}.tmp.${Date.now()}`;
|
|
500
|
-
try {
|
|
501
|
-
await writeFilePromise(tempPath, newContent, "utf-8");
|
|
502
|
-
await fs.rename(tempPath, resolvedPath);
|
|
503
|
-
}
|
|
504
|
-
catch (writeError) {
|
|
505
|
-
// Clean up temp file if it exists
|
|
506
|
-
try {
|
|
507
|
-
await fs.unlink(tempPath);
|
|
508
|
-
}
|
|
509
|
-
catch {
|
|
510
|
-
// Ignore cleanup errors
|
|
511
|
-
}
|
|
512
|
-
throw writeError;
|
|
513
|
-
}
|
|
498
|
+
// Atomic write
|
|
499
|
+
await atomicWriteFile(resolvedPath, newContent);
|
|
514
500
|
this.editHistory.push({
|
|
515
501
|
command: "insert",
|
|
516
502
|
path: filePath,
|
|
@@ -659,27 +645,14 @@ export class TextEditorTool {
|
|
|
659
645
|
if (statsAfterConfirm.mtimeMs !== mtimeBefore) {
|
|
660
646
|
return {
|
|
661
647
|
success: false,
|
|
662
|
-
error:
|
|
648
|
+
error: ERROR_MESSAGES.FILE_MODIFIED_DURING_CONFIRMATION,
|
|
663
649
|
};
|
|
664
650
|
}
|
|
665
651
|
// Create checkpoint before modification
|
|
666
652
|
await this.createCheckpointIfNeeded(filePath, 'multi_edit');
|
|
667
653
|
// Atomic write
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
await writeFilePromise(tempPath, workingContent, "utf-8");
|
|
671
|
-
await fs.rename(tempPath, resolvedPath);
|
|
672
|
-
}
|
|
673
|
-
catch (writeError) {
|
|
674
|
-
try {
|
|
675
|
-
await fs.unlink(tempPath);
|
|
676
|
-
}
|
|
677
|
-
catch {
|
|
678
|
-
// Ignore cleanup errors
|
|
679
|
-
}
|
|
680
|
-
throw writeError;
|
|
681
|
-
}
|
|
682
|
-
// Record in edit history (record as single multi-edit operation)
|
|
654
|
+
await atomicWriteFile(resolvedPath, workingContent);
|
|
655
|
+
// Record in edit history
|
|
683
656
|
this.editHistory.push({
|
|
684
657
|
command: "str_replace",
|
|
685
658
|
path: filePath,
|
|
@@ -699,7 +672,7 @@ export class TextEditorTool {
|
|
|
699
672
|
if (this.editHistory.length === 0) {
|
|
700
673
|
return {
|
|
701
674
|
success: false,
|
|
702
|
-
error:
|
|
675
|
+
error: ERROR_MESSAGES.NO_EDITS_TO_UNDO,
|
|
703
676
|
};
|
|
704
677
|
}
|
|
705
678
|
const lastEdit = this.editHistory.pop();
|
|
@@ -809,7 +782,7 @@ export class TextEditorTool {
|
|
|
809
782
|
return true;
|
|
810
783
|
}
|
|
811
784
|
generateDiff(oldLines, newLines, filePath) {
|
|
812
|
-
const CONTEXT_LINES =
|
|
785
|
+
const CONTEXT_LINES = EDITOR_CONFIG.DIFF_CONTEXT_LINES;
|
|
813
786
|
const changes = [];
|
|
814
787
|
let i = 0, j = 0;
|
|
815
788
|
while (i < oldLines.length || j < newLines.length) {
|
|
@@ -1155,7 +1128,7 @@ export class TextEditorTool {
|
|
|
1155
1128
|
}
|
|
1156
1129
|
// Find the best matching block
|
|
1157
1130
|
let bestMatch = null;
|
|
1158
|
-
const minScore =
|
|
1131
|
+
const minScore = EDITOR_CONFIG.BLOCK_SIMILARITY_THRESHOLD;
|
|
1159
1132
|
// Normalize first search line for initial matching
|
|
1160
1133
|
const firstSearchLineNorm = this.normalizeLineAggressively(searchLinesNonEmpty[0]);
|
|
1161
1134
|
for (let i = 0; i < contentLines.length; i++) {
|
|
@@ -1163,7 +1136,7 @@ export class TextEditorTool {
|
|
|
1163
1136
|
// Quick check: first non-empty line should have some similarity (using normalized comparison)
|
|
1164
1137
|
if (firstContentLineNorm.length === 0)
|
|
1165
1138
|
continue;
|
|
1166
|
-
if (this.lineSimilarityNormalized(firstContentLineNorm, firstSearchLineNorm) <
|
|
1139
|
+
if (this.lineSimilarityNormalized(firstContentLineNorm, firstSearchLineNorm) < EDITOR_CONFIG.SUGGESTION_SIMILARITY_THRESHOLD) {
|
|
1167
1140
|
continue;
|
|
1168
1141
|
}
|
|
1169
1142
|
// Try to match the block starting at this position - wider window (+15 instead of +5)
|
|
@@ -1289,7 +1262,7 @@ export class TextEditorTool {
|
|
|
1289
1262
|
bestLineIdx = i;
|
|
1290
1263
|
}
|
|
1291
1264
|
}
|
|
1292
|
-
if (bestLineIdx >= 0 && bestSim >=
|
|
1265
|
+
if (bestLineIdx >= 0 && bestSim >= EDITOR_CONFIG.SUGGESTION_SIMILARITY_THRESHOLD) {
|
|
1293
1266
|
const actualLine = contentLines[bestLineIdx].trim();
|
|
1294
1267
|
const lineNum = bestLineIdx + 1;
|
|
1295
1268
|
if (bestSim < 0.9) {
|
|
@@ -1320,7 +1293,7 @@ export class TextEditorTool {
|
|
|
1320
1293
|
// Find best similar line
|
|
1321
1294
|
let bestLine = null;
|
|
1322
1295
|
let bestSim = 0;
|
|
1323
|
-
const minSim =
|
|
1296
|
+
const minSim = EDITOR_CONFIG.LINE_SIMILARITY_THRESHOLD;
|
|
1324
1297
|
for (const line of lines) {
|
|
1325
1298
|
const sim = this.lineSimilarity(line, searchStr);
|
|
1326
1299
|
if (sim > bestSim) {
|