@flextudio/scenario 0.1.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/LICENSE +202 -0
- package/README.md +260 -0
- package/bin/flex-scenario.mjs +895 -0
- package/commands/flex-spec.md +28 -0
- package/contract-data/README.md +267 -0
- package/contract-data/examples/README.md +147 -0
- package/contract-data/examples/basic/basic-list-detail.json +2521 -0
- package/contract-data/examples/basic/delivery-address-popup.json +2175 -0
- package/contract-data/examples/basic/fixedtop-floating-form.json +1524 -0
- package/contract-data/examples/basic/search-period-popup.json +1524 -0
- package/contract-data/examples/design/booking-wizard-3step.json +1335 -0
- package/contract-data/examples/design/list-detail-form-3step.json +1516 -0
- package/contract-data/examples/design/list-filter-2step.json +1365 -0
- package/contract-data/examples/design/list-filter-detail-3step.json +1570 -0
- package/contract-data/examples/design/result-entry-wizard-4step.json +1861 -0
- package/contract-data/examples/intent/mock-employee-list.json +54 -0
- package/contract-data/examples/intent/script-cart-flow.json +96 -0
- package/contract-data/examples/intent/script-dialog-confirm.json +61 -0
- package/contract-data/runtime/v1/collection/README.md +119 -0
- package/contract-data/runtime/v1/collection/_c.md +205 -0
- package/contract-data/runtime/v1/collection/category.md +165 -0
- package/contract-data/runtime/v1/collection/collection.md +135 -0
- package/contract-data/runtime/v1/collection/lifecycle.md +140 -0
- package/contract-data/runtime/v1/collection/naming.md +174 -0
- package/contract-data/runtime/v1/collection/sector.md +176 -0
- package/contract-data/runtime/v1/collection/status.md +114 -0
- package/contract-data/runtime/v1/intent-system/INTENT.md +552 -0
- package/contract-data/runtime/v1/intent-system/README.md +118 -0
- package/contract-data/runtime/v1/intent-system/intent.schema.json +164 -0
- package/contract-data/runtime/v1/intent-system/kinds/_base.mjs +137 -0
- package/contract-data/runtime/v1/intent-system/kinds/clearCategory.mjs +35 -0
- package/contract-data/runtime/v1/intent-system/kinds/copyStepValues.mjs +100 -0
- package/contract-data/runtime/v1/intent-system/kinds/deleteActive.mjs +45 -0
- package/contract-data/runtime/v1/intent-system/kinds/dialog.mjs +127 -0
- package/contract-data/runtime/v1/intent-system/kinds/reloadGroup.mjs +28 -0
- package/contract-data/runtime/v1/intent-system/kinds/updateActive.mjs +74 -0
- package/contract-data/runtime/v1/intent-system/materialize.mjs +495 -0
- package/contract-data/runtime/v1/script/README.md +37 -0
- package/contract-data/runtime/v1/script/current_step.md +112 -0
- package/contract-data/runtime/v1/script/f_collection.md +142 -0
- package/contract-data/runtime/v1/script/f_content.md +133 -0
- package/contract-data/runtime/v1/script/f_messagebox.md +132 -0
- package/contract-data/runtime/v1/script/scenario-gen-rules.md +264 -0
- package/contract-data/schema/v1/SKELETON-SHELL.md +120 -0
- package/contract-data/schema/v1/bottom-buttons.md +155 -0
- package/contract-data/schema/v1/bottom-buttons.schema.json +134 -0
- package/contract-data/schema/v1/control/_base.schema.json +1296 -0
- package/contract-data/schema/v1/control/button.md +147 -0
- package/contract-data/schema/v1/control/button.schema.json +55 -0
- package/contract-data/schema/v1/control/calendar-navigator.md +143 -0
- package/contract-data/schema/v1/control/calendar-navigator.schema.json +164 -0
- package/contract-data/schema/v1/control/calendar.md +128 -0
- package/contract-data/schema/v1/control/calendar.schema.json +18 -0
- package/contract-data/schema/v1/control/check-box.md +117 -0
- package/contract-data/schema/v1/control/check-box.schema.json +41 -0
- package/contract-data/schema/v1/control/combo.md +293 -0
- package/contract-data/schema/v1/control/combo.schema.json +23 -0
- package/contract-data/schema/v1/control/embed.md +211 -0
- package/contract-data/schema/v1/control/embed.schema.json +30 -0
- package/contract-data/schema/v1/control/image-box.md +237 -0
- package/contract-data/schema/v1/control/image-box.schema.json +49 -0
- package/contract-data/schema/v1/control/input-date.md +175 -0
- package/contract-data/schema/v1/control/input-date.schema.json +27 -0
- package/contract-data/schema/v1/control/input-file.md +192 -0
- package/contract-data/schema/v1/control/input-file.schema.json +139 -0
- package/contract-data/schema/v1/control/input-mask.md +89 -0
- package/contract-data/schema/v1/control/input-mask.schema.json +45 -0
- package/contract-data/schema/v1/control/input-number.md +55 -0
- package/contract-data/schema/v1/control/input-number.schema.json +24 -0
- package/contract-data/schema/v1/control/input-text.md +73 -0
- package/contract-data/schema/v1/control/input-text.schema.json +24 -0
- package/contract-data/schema/v1/control/label.md +127 -0
- package/contract-data/schema/v1/control/label.schema.json +113 -0
- package/contract-data/schema/v1/control/multi-input-box.md +51 -0
- package/contract-data/schema/v1/control/multi-input-box.schema.json +19 -0
- package/contract-data/schema/v1/control/other.schema.json +24 -0
- package/contract-data/schema/v1/control/radio-box.md +150 -0
- package/contract-data/schema/v1/control/radio-box.schema.json +87 -0
- package/contract-data/schema/v1/control/search.md +163 -0
- package/contract-data/schema/v1/control/search.schema.json +23 -0
- package/contract-data/schema/v1/control/tab.md +240 -0
- package/contract-data/schema/v1/control/tab.schema.json +112 -0
- package/contract-data/schema/v1/control/tree.md +278 -0
- package/contract-data/schema/v1/control/tree.schema.json +83 -0
- package/contract-data/schema/v1/control.md +264 -0
- package/contract-data/schema/v1/control.schema.json +30 -0
- package/contract-data/schema/v1/data-objects.md +278 -0
- package/contract-data/schema/v1/data-objects.schema.json +161 -0
- package/contract-data/schema/v1/data-sources.md +215 -0
- package/contract-data/schema/v1/data-sources.schema.json +184 -0
- package/contract-data/schema/v1/design-system/DESIGN.md +282 -0
- package/contract-data/schema/v1/design-system/README.md +235 -0
- package/contract-data/schema/v1/design-system/design.schema.json +496 -0
- package/contract-data/schema/v1/design-system/error-mapping.mjs +132 -0
- package/contract-data/schema/v1/design-system/materialize.mjs +1435 -0
- package/contract-data/schema/v1/design-system/tests/_base.additional-meta.test.mjs +98 -0
- package/contract-data/schema/v1/design-system/tests/_base.materialize.test.mjs +596 -0
- package/contract-data/schema/v1/design-system/tests/checklist.test.mjs +135 -0
- package/contract-data/schema/v1/design-system/tests/design.schema.test.mjs +487 -0
- package/contract-data/schema/v1/design-system/tests/error-mapping.test.mjs +244 -0
- package/contract-data/schema/v1/design-system/tests/materialize.test.mjs +1093 -0
- package/contract-data/schema/v1/design-system/tests/move-step.test.mjs +119 -0
- package/contract-data/schema/v1/design-system/tests/override.integration.test.mjs +116 -0
- package/contract-data/schema/v1/design-system/tokens.json +76 -0
- package/contract-data/schema/v1/events.md +467 -0
- package/contract-data/schema/v1/events.schema.json +272 -0
- package/contract-data/schema/v1/group.md +146 -0
- package/contract-data/schema/v1/group.schema.json +133 -0
- package/contract-data/schema/v1/mockup-data.md +186 -0
- package/contract-data/schema/v1/naming-objects.schema.json +133 -0
- package/contract-data/schema/v1/node.md +32 -0
- package/contract-data/schema/v1/node.schema.json +24 -0
- package/contract-data/schema/v1/patterns/_base.additional-meta.mjs +135 -0
- package/contract-data/schema/v1/patterns/_base.controls.mjs +759 -0
- package/contract-data/schema/v1/patterns/_base.icon.mjs +61 -0
- package/contract-data/schema/v1/patterns/_base.id.mjs +15 -0
- package/contract-data/schema/v1/patterns/_base.materialize.mjs +1181 -0
- package/contract-data/schema/v1/patterns/_base.style.mjs +312 -0
- package/contract-data/schema/v1/patterns/atom/badge.materialize.mjs +68 -0
- package/contract-data/schema/v1/patterns/atom/badge.schema.json +44 -0
- package/contract-data/schema/v1/patterns/atom/button.materialize.mjs +91 -0
- package/contract-data/schema/v1/patterns/atom/button.schema.json +70 -0
- package/contract-data/schema/v1/patterns/atom/checkbox.materialize.mjs +40 -0
- package/contract-data/schema/v1/patterns/atom/checkbox.schema.json +39 -0
- package/contract-data/schema/v1/patterns/atom/segmented-radio.materialize.mjs +67 -0
- package/contract-data/schema/v1/patterns/atom/segmented-radio.schema.json +49 -0
- package/contract-data/schema/v1/patterns/atom/switch.materialize.mjs +58 -0
- package/contract-data/schema/v1/patterns/atom/switch.schema.json +27 -0
- package/contract-data/schema/v1/patterns/molecule/checklist.materialize.mjs +130 -0
- package/contract-data/schema/v1/patterns/molecule/checklist.schema.json +63 -0
- package/contract-data/schema/v1/patterns/molecule/input-action.materialize.mjs +356 -0
- package/contract-data/schema/v1/patterns/molecule/input-action.schema.json +251 -0
- package/contract-data/schema/v1/patterns/molecule/input-button.materialize.mjs +183 -0
- package/contract-data/schema/v1/patterns/molecule/input-button.schema.json +141 -0
- package/contract-data/schema/v1/patterns/molecule/input-pair.materialize.mjs +254 -0
- package/contract-data/schema/v1/patterns/molecule/input-pair.schema.json +210 -0
- package/contract-data/schema/v1/scenario.md +112 -0
- package/contract-data/schema/v1/scenario.schema.json +161 -0
- package/contract-data/schema/v1/service/CustomSystem.md +139 -0
- package/contract-data/schema/v1/service/CustomSystem.schema.json +41 -0
- package/contract-data/schema/v1/service/Firestore.md +125 -0
- package/contract-data/schema/v1/service/Firestore.schema.json +28 -0
- package/contract-data/schema/v1/service/FlexAutoQuery.md +128 -0
- package/contract-data/schema/v1/service/FlexAutoQuery.schema.json +35 -0
- package/contract-data/schema/v1/service/FlexSQL.md +96 -0
- package/contract-data/schema/v1/service/FlexSQL.schema.json +33 -0
- package/contract-data/schema/v1/service/Flextudio API.md +161 -0
- package/contract-data/schema/v1/service/Flextudio API.schema.json +115 -0
- package/contract-data/schema/v1/service/Flextudio.md +87 -0
- package/contract-data/schema/v1/service/Flextudio.schema.json +26 -0
- package/contract-data/schema/v1/service/GoogleSheet.md +71 -0
- package/contract-data/schema/v1/service/GoogleSheet.schema.json +31 -0
- package/contract-data/schema/v1/service/README.md +127 -0
- package/contract-data/schema/v1/service/_base.schema.json +31 -0
- package/contract-data/schema/v1/service/ksystem.md +76 -0
- package/contract-data/schema/v1/service/ksystem.schema.json +36 -0
- package/contract-data/schema/v1/service-binding.md +228 -0
- package/contract-data/schema/v1/service-binding.schema.json +51 -0
- package/contract-data/schema/v1/step.md +546 -0
- package/contract-data/schema/v1/step.schema.json +258 -0
- package/contract-data/schema/v1/style-objects.md +183 -0
- package/contract-data/schema/v1/style-objects.schema.json +155 -0
- package/contract-data/spec/catalog.json +406 -0
- package/contract-data/spec/rules.md +400 -0
- package/node_modules/@flextudio/contract-core/contract.mjs +367 -0
- package/node_modules/@flextudio/contract-core/index.mjs +16 -0
- package/node_modules/@flextudio/contract-core/package.json +21 -0
- package/node_modules/@flextudio/contract-core/paths.mjs +72 -0
- package/node_modules/@flextudio/contract-core/schemas.mjs +474 -0
- package/node_modules/@flextudio/contract-core/validators.mjs +2471 -0
- package/node_modules/ajv/.runkit_example.js +23 -0
- package/node_modules/ajv/LICENSE +22 -0
- package/node_modules/ajv/README.md +207 -0
- package/node_modules/ajv/dist/2019.d.ts +19 -0
- package/node_modules/ajv/dist/2019.js +61 -0
- package/node_modules/ajv/dist/2019.js.map +1 -0
- package/node_modules/ajv/dist/2020.d.ts +19 -0
- package/node_modules/ajv/dist/2020.js +55 -0
- package/node_modules/ajv/dist/2020.js.map +1 -0
- package/node_modules/ajv/dist/ajv.d.ts +18 -0
- package/node_modules/ajv/dist/ajv.js +50 -0
- package/node_modules/ajv/dist/ajv.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/code.d.ts +40 -0
- package/node_modules/ajv/dist/compile/codegen/code.js +156 -0
- package/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/index.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/index.js +697 -0
- package/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/scope.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/node_modules/ajv/dist/compile/errors.d.ts +13 -0
- package/node_modules/ajv/dist/compile/errors.js +123 -0
- package/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/node_modules/ajv/dist/compile/index.d.ts +80 -0
- package/node_modules/ajv/dist/compile/index.js +242 -0
- package/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/parse.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js +350 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js +236 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/types.d.ts +6 -0
- package/node_modules/ajv/dist/compile/jtd/types.js +14 -0
- package/node_modules/ajv/dist/compile/jtd/types.js.map +1 -0
- package/node_modules/ajv/dist/compile/names.d.ts +20 -0
- package/node_modules/ajv/dist/compile/names.js +28 -0
- package/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/node_modules/ajv/dist/compile/ref_error.d.ts +6 -0
- package/node_modules/ajv/dist/compile/ref_error.js +12 -0
- package/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/node_modules/ajv/dist/compile/resolve.d.ts +12 -0
- package/node_modules/ajv/dist/compile/resolve.js +155 -0
- package/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/node_modules/ajv/dist/compile/rules.d.ts +28 -0
- package/node_modules/ajv/dist/compile/rules.js +26 -0
- package/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/node_modules/ajv/dist/compile/util.d.ts +40 -0
- package/node_modules/ajv/dist/compile/util.js +178 -0
- package/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/applicability.d.ts +6 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +4 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/dataType.d.ts +17 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/defaults.d.ts +2 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/index.d.ts +42 -0
- package/node_modules/ajv/dist/compile/validate/index.js +520 -0
- package/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/keyword.d.ts +8 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/subschema.d.ts +47 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/node_modules/ajv/dist/core.d.ts +174 -0
- package/node_modules/ajv/dist/core.js +618 -0
- package/node_modules/ajv/dist/core.js.map +1 -0
- package/node_modules/ajv/dist/jtd.d.ts +47 -0
- package/node_modules/ajv/dist/jtd.js +72 -0
- package/node_modules/ajv/dist/jtd.js.map +1 -0
- package/node_modules/ajv/dist/refs/data.json +13 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +28 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +30 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/dist/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/dist/refs/jtd-schema.d.ts +3 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js +118 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/runtime/equal.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/equal.js +7 -0
- package/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/node_modules/ajv/dist/runtime/parseJson.d.ts +18 -0
- package/node_modules/ajv/dist/runtime/parseJson.js +185 -0
- package/node_modules/ajv/dist/runtime/parseJson.js.map +1 -0
- package/node_modules/ajv/dist/runtime/quote.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/quote.js +30 -0
- package/node_modules/ajv/dist/runtime/quote.js.map +1 -0
- package/node_modules/ajv/dist/runtime/re2.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/re2.js +6 -0
- package/node_modules/ajv/dist/runtime/re2.js.map +1 -0
- package/node_modules/ajv/dist/runtime/timestamp.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/timestamp.js +42 -0
- package/node_modules/ajv/dist/runtime/timestamp.js.map +1 -0
- package/node_modules/ajv/dist/runtime/ucs2length.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/node_modules/ajv/dist/runtime/uri.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/uri.js +6 -0
- package/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/node_modules/ajv/dist/runtime/validation_error.d.ts +7 -0
- package/node_modules/ajv/dist/runtime/validation_error.js +11 -0
- package/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/node_modules/ajv/dist/standalone/index.d.ts +6 -0
- package/node_modules/ajv/dist/standalone/index.js +90 -0
- package/node_modules/ajv/dist/standalone/index.js.map +1 -0
- package/node_modules/ajv/dist/standalone/instance.d.ts +12 -0
- package/node_modules/ajv/dist/standalone/instance.js +35 -0
- package/node_modules/ajv/dist/standalone/instance.js.map +1 -0
- package/node_modules/ajv/dist/types/index.d.ts +183 -0
- package/node_modules/ajv/dist/types/index.js +3 -0
- package/node_modules/ajv/dist/types/index.js.map +1 -0
- package/node_modules/ajv/dist/types/json-schema.d.ts +125 -0
- package/node_modules/ajv/dist/types/json-schema.js +3 -0
- package/node_modules/ajv/dist/types/json-schema.js.map +1 -0
- package/node_modules/ajv/dist/types/jtd-schema.d.ts +174 -0
- package/node_modules/ajv/dist/types/jtd-schema.js +3 -0
- package/node_modules/ajv/dist/types/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +7 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +21 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +11 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/code.d.ts +17 -0
- package/node_modules/ajv/dist/vocabularies/code.js +131 -0
- package/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/id.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js +23 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft7.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +30 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +51 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js +9 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +16 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +10 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/errors.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/errors.js +3 -0
- package/node_modules/ajv/dist/vocabularies/errors.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/format.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +71 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js +24 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js +43 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js +20 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js +29 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js +25 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +15 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js +149 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js +67 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js +69 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js +12 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js +51 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/metadata.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/next.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/next.js +8 -0
- package/node_modules/ajv/dist/vocabularies/next.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js +7 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +40 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +65 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +12 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.d.ts +16 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js +15 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +11 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/node_modules/ajv/lib/2019.ts +81 -0
- package/node_modules/ajv/lib/2020.ts +75 -0
- package/node_modules/ajv/lib/ajv.ts +70 -0
- package/node_modules/ajv/lib/compile/codegen/code.ts +169 -0
- package/node_modules/ajv/lib/compile/codegen/index.ts +852 -0
- package/node_modules/ajv/lib/compile/codegen/scope.ts +215 -0
- package/node_modules/ajv/lib/compile/errors.ts +184 -0
- package/node_modules/ajv/lib/compile/index.ts +324 -0
- package/node_modules/ajv/lib/compile/jtd/parse.ts +411 -0
- package/node_modules/ajv/lib/compile/jtd/serialize.ts +277 -0
- package/node_modules/ajv/lib/compile/jtd/types.ts +16 -0
- package/node_modules/ajv/lib/compile/names.ts +27 -0
- package/node_modules/ajv/lib/compile/ref_error.ts +13 -0
- package/node_modules/ajv/lib/compile/resolve.ts +149 -0
- package/node_modules/ajv/lib/compile/rules.ts +50 -0
- package/node_modules/ajv/lib/compile/util.ts +213 -0
- package/node_modules/ajv/lib/compile/validate/applicability.ts +22 -0
- package/node_modules/ajv/lib/compile/validate/boolSchema.ts +47 -0
- package/node_modules/ajv/lib/compile/validate/dataType.ts +230 -0
- package/node_modules/ajv/lib/compile/validate/defaults.ts +32 -0
- package/node_modules/ajv/lib/compile/validate/index.ts +582 -0
- package/node_modules/ajv/lib/compile/validate/keyword.ts +171 -0
- package/node_modules/ajv/lib/compile/validate/subschema.ts +135 -0
- package/node_modules/ajv/lib/core.ts +892 -0
- package/node_modules/ajv/lib/jtd.ts +132 -0
- package/node_modules/ajv/lib/refs/data.json +13 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +28 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +30 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/lib/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/lib/refs/jtd-schema.ts +130 -0
- package/node_modules/ajv/lib/runtime/equal.ts +7 -0
- package/node_modules/ajv/lib/runtime/parseJson.ts +177 -0
- package/node_modules/ajv/lib/runtime/quote.ts +31 -0
- package/node_modules/ajv/lib/runtime/re2.ts +6 -0
- package/node_modules/ajv/lib/runtime/timestamp.ts +46 -0
- package/node_modules/ajv/lib/runtime/ucs2length.ts +20 -0
- package/node_modules/ajv/lib/runtime/uri.ts +6 -0
- package/node_modules/ajv/lib/runtime/validation_error.ts +13 -0
- package/node_modules/ajv/lib/standalone/index.ts +100 -0
- package/node_modules/ajv/lib/standalone/instance.ts +36 -0
- package/node_modules/ajv/lib/types/index.ts +244 -0
- package/node_modules/ajv/lib/types/json-schema.ts +187 -0
- package/node_modules/ajv/lib/types/jtd-schema.ts +273 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +56 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +118 -0
- package/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +22 -0
- package/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/applicator/contains.ts +109 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +112 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +11 -0
- package/node_modules/ajv/lib/vocabularies/applicator/if.ts +80 -0
- package/node_modules/ajv/lib/vocabularies/applicator/index.ts +53 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items.ts +59 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +36 -0
- package/node_modules/ajv/lib/vocabularies/applicator/not.ts +38 -0
- package/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +82 -0
- package/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +91 -0
- package/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/applicator/properties.ts +57 -0
- package/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +50 -0
- package/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +13 -0
- package/node_modules/ajv/lib/vocabularies/code.ts +168 -0
- package/node_modules/ajv/lib/vocabularies/core/id.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/core/index.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/core/ref.ts +129 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/index.ts +113 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/types.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/draft2020.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/draft7.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +31 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +51 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/index.ts +9 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/errors.ts +18 -0
- package/node_modules/ajv/lib/vocabularies/format/format.ts +120 -0
- package/node_modules/ajv/lib/vocabularies/format/index.ts +6 -0
- package/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +89 -0
- package/node_modules/ajv/lib/vocabularies/jtd/elements.ts +32 -0
- package/node_modules/ajv/lib/vocabularies/jtd/enum.ts +45 -0
- package/node_modules/ajv/lib/vocabularies/jtd/error.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/jtd/index.ts +37 -0
- package/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +24 -0
- package/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +21 -0
- package/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +15 -0
- package/node_modules/ajv/lib/vocabularies/jtd/properties.ts +184 -0
- package/node_modules/ajv/lib/vocabularies/jtd/ref.ts +76 -0
- package/node_modules/ajv/lib/vocabularies/jtd/type.ts +75 -0
- package/node_modules/ajv/lib/vocabularies/jtd/union.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/jtd/values.ts +58 -0
- package/node_modules/ajv/lib/vocabularies/metadata.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/next.ts +8 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +7 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +47 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +85 -0
- package/node_modules/ajv/lib/vocabularies/validation/const.ts +28 -0
- package/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/validation/enum.ts +54 -0
- package/node_modules/ajv/lib/vocabularies/validation/index.ts +49 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +30 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +42 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +34 -0
- package/node_modules/ajv/lib/vocabularies/validation/pattern.ts +39 -0
- package/node_modules/ajv/lib/vocabularies/validation/required.ts +98 -0
- package/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +79 -0
- package/node_modules/ajv/package.json +126 -0
- package/node_modules/fast-deep-equal/LICENSE +21 -0
- package/node_modules/fast-deep-equal/README.md +96 -0
- package/node_modules/fast-deep-equal/es6/index.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/index.js +72 -0
- package/node_modules/fast-deep-equal/es6/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/react.js +79 -0
- package/node_modules/fast-deep-equal/index.d.ts +4 -0
- package/node_modules/fast-deep-equal/index.js +46 -0
- package/node_modules/fast-deep-equal/package.json +61 -0
- package/node_modules/fast-deep-equal/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/react.js +53 -0
- package/node_modules/fast-uri/.gitattributes +2 -0
- package/node_modules/fast-uri/.github/dependabot.yml +13 -0
- package/node_modules/fast-uri/.github/workflows/ci.yml +106 -0
- package/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +24 -0
- package/node_modules/fast-uri/LICENSE +30 -0
- package/node_modules/fast-uri/README.md +152 -0
- package/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
- package/node_modules/fast-uri/benchmark/equal.mjs +51 -0
- package/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
- package/node_modules/fast-uri/benchmark/package.json +17 -0
- package/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
- package/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
- package/node_modules/fast-uri/eslint.config.js +6 -0
- package/node_modules/fast-uri/index.js +406 -0
- package/node_modules/fast-uri/lib/schemes.js +267 -0
- package/node_modules/fast-uri/lib/utils.js +443 -0
- package/node_modules/fast-uri/package.json +68 -0
- package/node_modules/fast-uri/test/ajv.test.js +43 -0
- package/node_modules/fast-uri/test/equal.test.js +117 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
- package/node_modules/fast-uri/test/parse.test.js +323 -0
- package/node_modules/fast-uri/test/resolve.test.js +87 -0
- package/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +39 -0
- package/node_modules/fast-uri/test/security.test.js +133 -0
- package/node_modules/fast-uri/test/serialize.test.js +151 -0
- package/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
- package/node_modules/fast-uri/test/uri-js.test.js +912 -0
- package/node_modules/fast-uri/test/util.test.js +38 -0
- package/node_modules/fast-uri/tsconfig.json +9 -0
- package/node_modules/fast-uri/types/index.d.ts +60 -0
- package/node_modules/fast-uri/types/index.test-d.ts +17 -0
- package/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
- package/node_modules/json-schema-traverse/.github/FUNDING.yml +2 -0
- package/node_modules/json-schema-traverse/.github/workflows/build.yml +28 -0
- package/node_modules/json-schema-traverse/.github/workflows/publish.yml +27 -0
- package/node_modules/json-schema-traverse/LICENSE +21 -0
- package/node_modules/json-schema-traverse/README.md +95 -0
- package/node_modules/json-schema-traverse/index.d.ts +40 -0
- package/node_modules/json-schema-traverse/index.js +93 -0
- package/node_modules/json-schema-traverse/package.json +43 -0
- package/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
- package/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
- package/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
- package/node_modules/require-from-string/index.js +34 -0
- package/node_modules/require-from-string/license +21 -0
- package/node_modules/require-from-string/package.json +28 -0
- package/node_modules/require-from-string/readme.md +56 -0
- package/package.json +51 -0
- package/scripts/api-call.mjs +59 -0
- package/scripts/auth.mjs +262 -0
- package/scripts/build-skill-payload.mjs +338 -0
- package/scripts/cleanup.mjs +166 -0
- package/scripts/install-paths.mjs +146 -0
- package/scripts/postinstall.mjs +218 -0
- package/scripts/postpack.mjs +43 -0
- package/scripts/prepack.mjs +222 -0
- package/scripts/tty-menu.mjs +100 -0
- package/skill/README.md +55 -0
- package/skill/SKILL.md +138 -0
- package/skill/catalog.json +406 -0
- package/skill/design-rules.md +282 -0
- package/skill/design-system.md +235 -0
- package/skill/docs/SKELETON-SHELL.md +120 -0
- package/skill/docs/bottom-buttons.md +155 -0
- package/skill/docs/control/button.md +147 -0
- package/skill/docs/control/calendar-navigator.md +143 -0
- package/skill/docs/control/calendar.md +128 -0
- package/skill/docs/control/check-box.md +117 -0
- package/skill/docs/control/combo.md +293 -0
- package/skill/docs/control/embed.md +211 -0
- package/skill/docs/control/image-box.md +237 -0
- package/skill/docs/control/input-date.md +175 -0
- package/skill/docs/control/input-file.md +192 -0
- package/skill/docs/control/input-mask.md +89 -0
- package/skill/docs/control/input-number.md +55 -0
- package/skill/docs/control/input-text.md +73 -0
- package/skill/docs/control/label.md +127 -0
- package/skill/docs/control/multi-input-box.md +51 -0
- package/skill/docs/control/radio-box.md +150 -0
- package/skill/docs/control/search.md +163 -0
- package/skill/docs/control/tab.md +240 -0
- package/skill/docs/control/tree.md +278 -0
- package/skill/docs/control.md +264 -0
- package/skill/docs/data-objects.md +278 -0
- package/skill/docs/data-sources.md +215 -0
- package/skill/docs/events.md +467 -0
- package/skill/docs/group.md +146 -0
- package/skill/docs/index.json +125 -0
- package/skill/docs/mockup-data.md +186 -0
- package/skill/docs/node.md +32 -0
- package/skill/docs/scenario.md +112 -0
- package/skill/docs/service/CustomSystem.md +139 -0
- package/skill/docs/service/Firestore.md +125 -0
- package/skill/docs/service/FlexAutoQuery.md +128 -0
- package/skill/docs/service/FlexSQL.md +96 -0
- package/skill/docs/service/Flextudio API.md +161 -0
- package/skill/docs/service/Flextudio.md +87 -0
- package/skill/docs/service/GoogleSheet.md +71 -0
- package/skill/docs/service/README.md +127 -0
- package/skill/docs/service/ksystem.md +76 -0
- package/skill/docs/service-binding.md +228 -0
- package/skill/docs/step.md +546 -0
- package/skill/docs/style-objects.md +183 -0
- package/skill/examples/README.md +147 -0
- package/skill/examples/basic/basic-list-detail.json +2521 -0
- package/skill/examples/basic/delivery-address-popup.json +2175 -0
- package/skill/examples/basic/fixedtop-floating-form.json +1524 -0
- package/skill/examples/basic/search-period-popup.json +1524 -0
- package/skill/examples/design/booking-wizard-3step.json +1335 -0
- package/skill/examples/design/list-detail-form-3step.json +1516 -0
- package/skill/examples/design/list-filter-2step.json +1365 -0
- package/skill/examples/design/list-filter-detail-3step.json +1570 -0
- package/skill/examples/design/result-entry-wizard-4step.json +1861 -0
- package/skill/examples/index.json +150 -0
- package/skill/examples/intent/mock-employee-list.json +54 -0
- package/skill/examples/intent/script-cart-flow.json +96 -0
- package/skill/examples/intent/script-dialog-confirm.json +61 -0
- package/skill/intent-rules.md +552 -0
- package/skill/intent-system.md +118 -0
- package/skill/patterns/atom/badge.json +103 -0
- package/skill/patterns/atom/button.json +111 -0
- package/skill/patterns/atom/checkbox.json +70 -0
- package/skill/patterns/atom/segmented-radio.json +92 -0
- package/skill/patterns/atom/switch.json +57 -0
- package/skill/patterns/index.json +471 -0
- package/skill/patterns/molecule/checklist.json +107 -0
- package/skill/patterns/molecule/input-action.json +355 -0
- package/skill/patterns/molecule/input-button.json +212 -0
- package/skill/patterns/molecule/input-pair.json +284 -0
- package/skill/references/build-sequence.md +55 -0
- package/skill/references/patterns-cheatsheet.md +87 -0
- package/skill/references/spec-evolve/README.md +43 -0
- package/skill/references/spec-evolve/conventions.md +92 -0
- package/skill/references/spec-evolve/data-connection.md +102 -0
- package/skill/references/spec-evolve/intake.md +41 -0
- package/skill/references/spec-evolve/key-roles.md +44 -0
- package/skill/references/spec-evolve/lint.md +27 -0
- package/skill/references/spec-evolve/mockup.md +50 -0
- package/skill/references/spec-evolve/query-screens.md +66 -0
- package/skill/references/spec-evolve/routing.md +43 -0
- package/skill/references/spec-evolve/spec-format.md +76 -0
- package/skill/references/spec-evolve/templates/master-detail.spec.md +97 -0
- package/skill/references/spec-evolve/templates/query-screen.spec.md +96 -0
- package/skill/references/spec-evolve/templates/static-prototype.spec.md +54 -0
- package/skill/references/spec-evolve/templates-index.json +26 -0
- package/skill/rules.md +400 -0
- package/skill/schemas/bottom-buttons.schema.json +134 -0
- package/skill/schemas/control/_base.schema.json +1296 -0
- package/skill/schemas/control/button.schema.json +55 -0
- package/skill/schemas/control/calendar-navigator.schema.json +164 -0
- package/skill/schemas/control/calendar.schema.json +18 -0
- package/skill/schemas/control/check-box.schema.json +41 -0
- package/skill/schemas/control/combo.schema.json +23 -0
- package/skill/schemas/control/embed.schema.json +30 -0
- package/skill/schemas/control/image-box.schema.json +49 -0
- package/skill/schemas/control/input-date.schema.json +27 -0
- package/skill/schemas/control/input-file.schema.json +139 -0
- package/skill/schemas/control/input-mask.schema.json +45 -0
- package/skill/schemas/control/input-number.schema.json +24 -0
- package/skill/schemas/control/input-text.schema.json +24 -0
- package/skill/schemas/control/label.schema.json +113 -0
- package/skill/schemas/control/multi-input-box.schema.json +19 -0
- package/skill/schemas/control/other.schema.json +24 -0
- package/skill/schemas/control/radio-box.schema.json +87 -0
- package/skill/schemas/control/search.schema.json +23 -0
- package/skill/schemas/control/tab.schema.json +112 -0
- package/skill/schemas/control/tree.schema.json +83 -0
- package/skill/schemas/control.schema.json +30 -0
- package/skill/schemas/data-objects.schema.json +161 -0
- package/skill/schemas/data-sources.schema.json +184 -0
- package/skill/schemas/design-system/design.schema.json +496 -0
- package/skill/schemas/events.schema.json +272 -0
- package/skill/schemas/group.schema.json +133 -0
- package/skill/schemas/index.json +362 -0
- package/skill/schemas/naming-objects.schema.json +133 -0
- package/skill/schemas/node.schema.json +24 -0
- package/skill/schemas/patterns/atom/badge.schema.json +44 -0
- package/skill/schemas/patterns/atom/button.schema.json +70 -0
- package/skill/schemas/patterns/atom/checkbox.schema.json +39 -0
- package/skill/schemas/patterns/atom/segmented-radio.schema.json +49 -0
- package/skill/schemas/patterns/atom/switch.schema.json +27 -0
- package/skill/schemas/patterns/molecule/checklist.schema.json +63 -0
- package/skill/schemas/patterns/molecule/input-action.schema.json +251 -0
- package/skill/schemas/patterns/molecule/input-button.schema.json +141 -0
- package/skill/schemas/patterns/molecule/input-pair.schema.json +210 -0
- package/skill/schemas/scenario.schema.json +161 -0
- package/skill/schemas/service/CustomSystem.schema.json +41 -0
- package/skill/schemas/service/Firestore.schema.json +28 -0
- package/skill/schemas/service/FlexAutoQuery.schema.json +35 -0
- package/skill/schemas/service/FlexSQL.schema.json +33 -0
- package/skill/schemas/service/Flextudio API.schema.json +115 -0
- package/skill/schemas/service/Flextudio.schema.json +26 -0
- package/skill/schemas/service/GoogleSheet.schema.json +31 -0
- package/skill/schemas/service/_base.schema.json +31 -0
- package/skill/schemas/service/ksystem.schema.json +36 -0
- package/skill/schemas/service-binding.schema.json +51 -0
- package/skill/schemas/step.schema.json +258 -0
- package/skill/schemas/style-objects.schema.json +155 -0
- package/skill/skill-guides/README.md +50 -0
- package/skill/skill-guides/control-options.md +126 -0
- package/skill/skill-guides/events.md +61 -0
- package/skill/skill-guides/failure-discipline.md +95 -0
- package/skill/skill-guides/index.json +40 -0
- package/skill/skill-guides/prompt-interview.md +92 -0
- package/skill/skill-guides/scripts.md +169 -0
- package/skill/skill-guides/step-navigation.md +98 -0
|
@@ -0,0 +1,895 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// flex-scenario — 배포용 진입점 CLI (클린: otel/벤치 gen 없음).
|
|
3
|
+
//
|
|
4
|
+
// 서브커맨드:
|
|
5
|
+
// init [--agent <name>] 현재 폴더에 스킬/커맨드 재배치 (postinstall 수동 재실행).
|
|
6
|
+
// --agent claude|codex|antigravity. 미지정 시 메뉴로 물어봄.
|
|
7
|
+
// contract-root 는 전역 ~/.flex-scenario 에 둔다.
|
|
8
|
+
// validate <scenario.json> buildAjv + runAllCrossChecks 로 전체 검증.
|
|
9
|
+
// validate --schema <name> <fragment.json>
|
|
10
|
+
// 지정 schema 로 단편 검증.
|
|
11
|
+
// catalog --section <name> catalog.json 의 한 섹션 출력.
|
|
12
|
+
// examples list examples 디렉토리 트리.
|
|
13
|
+
// examples cat <relpath> 해당 example 본문 출력.
|
|
14
|
+
// contract info contract 메타 (version, schemas count) 출력.
|
|
15
|
+
// session {start|status|finish} build 세션 관리.
|
|
16
|
+
// doctor 환경 점검 — 에이전트 바이너리(optional) / SKILL.md / contract-root / core 모듈.
|
|
17
|
+
// uninstall [--scope <s>] 삭제 범위 메뉴(현재 폴더/모든 설치 폴더/완전 삭제/취소).
|
|
18
|
+
// full 은 cleanup 후 전역 패키지 제거까지 자동 실행
|
|
19
|
+
// (PM 은 receipt 의 userAgent 로 판별 — npm/pnpm/yarn/bun).
|
|
20
|
+
// (npm 7+ 는 preuninstall lifecycle 을 실행하지 않는다 —
|
|
21
|
+
// 삭제의 단일 진입점은 이 커맨드.) --scope here|all|full.
|
|
22
|
+
// version 버전 출력.
|
|
23
|
+
//
|
|
24
|
+
// 환경변수:
|
|
25
|
+
// FLEX_CONTRACT_ROOT schema/+rules.md 가 있는 디렉토리. 미지정 시 자동 추론.
|
|
26
|
+
//
|
|
27
|
+
// 시나리오 생성(gen)은 벤치 전용 — bench/cli_bench/bin/flex-gen.mjs 참조.
|
|
28
|
+
|
|
29
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, statSync, readdirSync } from "node:fs";
|
|
30
|
+
// (readdirSync, statSync 는 examples/findLatestScenario 가 공유)
|
|
31
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
32
|
+
import { dirname, join, resolve, relative, isAbsolute, sep } from "node:path";
|
|
33
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
34
|
+
import { homedir } from "node:os";
|
|
35
|
+
import { randomBytes } from "node:crypto";
|
|
36
|
+
|
|
37
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
38
|
+
const __dirname = dirname(__filename);
|
|
39
|
+
const PACKAGE_ROOT = resolve(__dirname, "..");
|
|
40
|
+
const importScript = (name) => import(pathToFileURL(join(PACKAGE_ROOT, "scripts", name)).href);
|
|
41
|
+
const VERSION = (() => {
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(readFileSync(join(PACKAGE_ROOT, "package.json"), "utf-8")).version || "0.0.0";
|
|
44
|
+
} catch {
|
|
45
|
+
return "0.0.0";
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
|
|
49
|
+
/* ─── arg parsing (no external dep) ─────────────────────────────────────── */
|
|
50
|
+
// 값 없는 boolean flag — 다음 토큰을 값으로 흡수하지 않는다.
|
|
51
|
+
// 누락 시 `--report scenario.json` 같은 호출에서 scenario.json 이 report 값으로
|
|
52
|
+
// 흡수되어 positional 이 비어 폭발하는 함정이 생긴다.
|
|
53
|
+
const BOOLEAN_FLAGS = new Set(["report", "no-write"]);
|
|
54
|
+
|
|
55
|
+
function parseArgs(argv) {
|
|
56
|
+
const positional = [];
|
|
57
|
+
const opts = {};
|
|
58
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
59
|
+
const a = argv[i];
|
|
60
|
+
if (a === "--") { positional.push(...argv.slice(i + 1)); break; }
|
|
61
|
+
if (a.startsWith("--")) {
|
|
62
|
+
const key = a.slice(2);
|
|
63
|
+
const eq = key.indexOf("=");
|
|
64
|
+
if (eq >= 0) {
|
|
65
|
+
opts[key.slice(0, eq)] = key.slice(eq + 1);
|
|
66
|
+
} else if (BOOLEAN_FLAGS.has(key)) {
|
|
67
|
+
opts[key] = true;
|
|
68
|
+
} else {
|
|
69
|
+
const next = argv[i + 1];
|
|
70
|
+
if (next === undefined || next.startsWith("--")) {
|
|
71
|
+
opts[key] = true;
|
|
72
|
+
} else {
|
|
73
|
+
opts[key] = next;
|
|
74
|
+
i += 1;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else if (a.startsWith("-")) {
|
|
78
|
+
opts[a.slice(1)] = true;
|
|
79
|
+
} else {
|
|
80
|
+
positional.push(a);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { positional, opts };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* ─── contract root 결정 ───────────────────────────────────────────────── */
|
|
87
|
+
function resolveContractRoot() {
|
|
88
|
+
const candidates = [];
|
|
89
|
+
if (process.env.FLEX_CONTRACT_ROOT) candidates.push(process.env.FLEX_CONTRACT_ROOT);
|
|
90
|
+
candidates.push(join(homedir(), ".flex-scenario", "contract-root"));
|
|
91
|
+
candidates.push(join(PACKAGE_ROOT, "contract-data"));
|
|
92
|
+
// 워크스페이스 모드: cli/ → repo root (한 단계 위)
|
|
93
|
+
candidates.push(resolve(PACKAGE_ROOT, ".."));
|
|
94
|
+
for (const c of candidates) {
|
|
95
|
+
try {
|
|
96
|
+
if (
|
|
97
|
+
existsSync(join(c, "schema")) &&
|
|
98
|
+
statSync(join(c, "schema")).isDirectory() &&
|
|
99
|
+
existsSync(join(c, "spec", "rules.md"))
|
|
100
|
+
) {
|
|
101
|
+
return c;
|
|
102
|
+
}
|
|
103
|
+
} catch { /* try next */ }
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const CONTRACT_ROOT = resolveContractRoot();
|
|
109
|
+
if (CONTRACT_ROOT) process.env.FLEX_CONTRACT_ROOT = CONTRACT_ROOT;
|
|
110
|
+
|
|
111
|
+
/* ─── 출력 헬퍼 ─────────────────────────────────────────────────────────── */
|
|
112
|
+
const out = (m) => process.stdout.write(m + "\n");
|
|
113
|
+
const err = (m) => process.stderr.write(m + "\n");
|
|
114
|
+
const ok = (m) => out(`✔ ${m}`);
|
|
115
|
+
const bad = (m) => err(`✘ ${m}`);
|
|
116
|
+
|
|
117
|
+
/* ─── cross-check 분류 키 → 1줄 fix-hint ──────────────────────────────────
|
|
118
|
+
* validate 결과의 errors[].hint 로 흘러간다. 모델이 자가검증 루프에서 어떤
|
|
119
|
+
* 방향으로 고칠지 즉시 알 수 있도록. raw 메시지보다 짧고 강한 1줄.
|
|
120
|
+
* 진실원본은 각각의 진실원본 (skill-guides/INTENT.md/design-rules.md) — 본 dict
|
|
121
|
+
* 은 단순 포인터 + 정책 한 줄 요약.
|
|
122
|
+
* ───────────────────────────────────────────────────────────────────── */
|
|
123
|
+
const CROSS_CHECK_FIX_HINTS = Object.freeze({
|
|
124
|
+
"caption-row":
|
|
125
|
+
"캡션 입력 + 비캡션 컨트롤(버튼 등)을 한 가로 행에 두지 말 것 — top 캡션이 박스 높이를 키워 세로 정렬이 어긋난다. 캡션을 별도 Label 로 행 위에 올리고(컬럼 gap 4), 입력+컨트롤만 같은 높이로 한 행에. DESIGN.md §Layout \"Captioned input in a row\".",
|
|
126
|
+
"back-button":
|
|
127
|
+
"Step.UseBackButton:true + 헤더에 표준 BackButton 컨트롤 (Next:'None'). 첫 Step 은 닫기, 이후 Step 은 이전 Step 복귀. skill-guides/step-navigation.md.",
|
|
128
|
+
"dialog-host":
|
|
129
|
+
"Combo/Search/InputDate 본체에 Dialog.Layouts[0].Controls[0] 자식 (ComboList/List/Calendar) 필수. memory: feedback_dialog_host_required.",
|
|
130
|
+
"dc-parent-ctx":
|
|
131
|
+
"Parent 필터는 조상 Group 에 DataConnection 이 있을 때만 — 독립 목록이면 Parent 필터 제거(일반 query), 1:N 이면 부모 Group 에 DC 먼저. data-objects.md §3.2.",
|
|
132
|
+
"embed-bind":
|
|
133
|
+
"Embed raw HTML 안 {=Field} 는 치환 안 됨 — 섹터 값은 {%return Load.sector.Field; %} (LoadScript 토큰). Load.sector 는 조상 DC 그룹 아래에서만 유효 (DC 밖이면 조용히 빈 문자열). 값 변경 시 f.Content(<부모그룹 fid>, <그 그룹을 그린 섹터>).reload() 타겟 리로드 필수. control/embed.md §섹터 값 바인딩.",
|
|
134
|
+
"template-script":
|
|
135
|
+
"{=Field} 토큰은 display 전용. Step 간 값 전달은 intent.script:{kind:'copyStepValues', from, to, map, reload?}. INTENT.md §copyStepValues.",
|
|
136
|
+
"script-allow":
|
|
137
|
+
"Script 본문은 intent.script 1순위 (dialog/updateActive/clearCategory/reloadGroup/deleteActive/copyStepValues). raw 는 표현 불가일 때만. INTENT.md.",
|
|
138
|
+
"no-inner-block":
|
|
139
|
+
"반복은 DataConnection.DataUsage:'query'. UseInnerBlock/InnerBlockKey/RepeatStyle 금지.",
|
|
140
|
+
"no-service":
|
|
141
|
+
"DataSourceType 은 Fixed 또는 Grid 만. Service/API/Collection 금지. EmbedScenarioPrefix 키 자체 금지.",
|
|
142
|
+
"mock-init":
|
|
143
|
+
"시작 Step.Init Action 에 intent.mock:{Ctg<Name>:[{...}]} 으로 카테고리 mock 섹터 박을 것. INTENT.md §mock.",
|
|
144
|
+
"category-name":
|
|
145
|
+
"카테고리명 'Ctg' 접두 + PascalCase. Ckeys/CategoryName 에 예약어(_SUID/for/class/length) 금지.",
|
|
146
|
+
"v1-only":
|
|
147
|
+
"v1 컨트롤 12종 외 사용 금지. 진실원본: catalog.json $.controlTypes.",
|
|
148
|
+
"event-ref":
|
|
149
|
+
"Action:'LinkedEvent' / dialog 의 button.event 는 scenario.Events 키에 정의되어 있어야 함.",
|
|
150
|
+
"display-key":
|
|
151
|
+
"DataSource 기반 Combo/Search 본체에 CtrlDisplayCkey 또는 비어있지 않은 DisplayValue 필수.",
|
|
152
|
+
"ds-key":
|
|
153
|
+
"ComboList/List 의 Title 에 DataSource 키 중 표시할 키 연결 필수 (예: ItemName/ItemValue) — 없으면 리스트에 명칭 안 보임. 본체-자식 Ckeys 도 동일해야. combo.md §ComboList.Title.",
|
|
154
|
+
"strict-fields":
|
|
155
|
+
"schema 미정의 키 발견. design 키는 허용(materialize 단계가 raw 로 expand) — 그 외엔 schema 본체 Read 후 정의된 키만 사용.",
|
|
156
|
+
"residual":
|
|
157
|
+
"design/intent short-form 이 전개 안 된 채 남음 — 거짓 완료 차단. 호스트 노드를 정상 컨테이너(Group Contents / Dialog.Layouts[*].Controls / Step FixedContents) 안으로 옮기거나 해당 키를 raw 필드로 직접 작성. design-system/materialize.mjs · INTENT.md.",
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/* ─── 서브커맨드: version ─────────────────────────────────────────────── */
|
|
161
|
+
function cmdVersion() { out(`flex-scenario ${VERSION}`); }
|
|
162
|
+
|
|
163
|
+
/* ─── 서브커맨드: help ─────────────────────────────────────────────────── */
|
|
164
|
+
function cmdHelp() {
|
|
165
|
+
out(`flex-scenario ${VERSION} — flextudio meta-contract v1 시나리오 CLI
|
|
166
|
+
|
|
167
|
+
USAGE
|
|
168
|
+
flex-scenario <subcommand> [options] (단축 별칭: fscn)
|
|
169
|
+
|
|
170
|
+
SUBCOMMANDS
|
|
171
|
+
init [--agent <name>] postinstall 재실행 (claude|codex|antigravity, 미지정 시 메뉴)
|
|
172
|
+
validate <scenario.json> 전체 시나리오 검증 (stdout=작은 ok 리포트, 산출물은 파일로 write-back)
|
|
173
|
+
validate --schema <name> <file> 단편 검증
|
|
174
|
+
validate ... --emit-materialized <path> materialized 본문을 별도 경로에도 저장 (stdout 아님)
|
|
175
|
+
validate ... --no-write 검증만 (파일 write-back 안 함)
|
|
176
|
+
catalog --section <name> catalog.json 의 한 섹션 출력
|
|
177
|
+
examples list examples 디렉토리 트리
|
|
178
|
+
examples cat <relpath> 해당 example 본문 출력
|
|
179
|
+
contract info contract 메타 (version, schemas count) (MCP contract_info 동형)
|
|
180
|
+
session start build_id 발급 (MCP start_build_sequence 동형)
|
|
181
|
+
session status --id <build_id> 현재 stage + next 힌트
|
|
182
|
+
session finish --id <build_id> [--artifact <path>] 세션 종료 + 산출물 경로 반환
|
|
183
|
+
doctor 환경 점검
|
|
184
|
+
login OIDC 로그인
|
|
185
|
+
logout 저장된 토큰 삭제
|
|
186
|
+
create --file <scenario.json> 시나리오 메타 파일을 새 시나리오로 생성
|
|
187
|
+
uninstall [--scope here|all|full] 삭제 범위 메뉴 (full = cleanup + 전역 패키지 자동 제거)
|
|
188
|
+
version 버전
|
|
189
|
+
help 이 도움말
|
|
190
|
+
|
|
191
|
+
ENVIRONMENT
|
|
192
|
+
FLEX_CONTRACT_ROOT schema/+rules.md 위치 (자동 추론 가능)
|
|
193
|
+
FLEX_AGENT 설치 대상 에이전트 (claude|codex|antigravity). init/postinstall 에서 사용
|
|
194
|
+
FLEX_SCENARIO_FORCE_UNINSTALL =1 이면 workspace dev 환경에서도 uninstall --scope full 의 npm 단계 수행
|
|
195
|
+
`);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* ─── 서브커맨드: init (postinstall 재실행) ───────────────────────────── */
|
|
199
|
+
// flex-scenario init [--agent <claude|codex|antigravity>]
|
|
200
|
+
// --agent 미지정 시 postinstall 이 TTY 메뉴(claude/codex/antigravity/나중에)로 물어본다.
|
|
201
|
+
async function cmdInit(opts = {}) {
|
|
202
|
+
const script = join(PACKAGE_ROOT, "scripts", "postinstall.mjs");
|
|
203
|
+
// init 은 "지금 있는 폴더"에 깐다 — postinstall 에 타겟을 명시 전달.
|
|
204
|
+
// (env 없으면 postinstall 은 INIT_CWD→cwd 순으로 폴백한다.)
|
|
205
|
+
const env = { ...process.env, FLEX_SCENARIO_INSTALL_DIR: process.cwd() };
|
|
206
|
+
if (opts.agent) env.FLEX_AGENT = String(opts.agent);
|
|
207
|
+
const res = spawnSync(process.execPath, [script], { stdio: "inherit", env });
|
|
208
|
+
process.exit(res.status ?? 1);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// SKILL.md 경로 해석 — 프로젝트 로컬 우선, 없으면 전역 폴백.
|
|
212
|
+
// 1. FLEX_SKILL_DIR 환경변수 (명시 override)
|
|
213
|
+
// 2. 베이스(cwd / CONTRACT_ROOT / home) × 에이전트 레이아웃(.claude / .agents / .agent)
|
|
214
|
+
// gen·doctor 가 공유한다. 모두 없으면 경고용으로 마지막 후보 경로를 반환.
|
|
215
|
+
function resolveSkillPath() {
|
|
216
|
+
const c = [];
|
|
217
|
+
if (process.env.FLEX_SKILL_DIR) c.push(join(process.env.FLEX_SKILL_DIR, "SKILL.md"));
|
|
218
|
+
const dotDirs = [".claude", ".agents", ".agent"];
|
|
219
|
+
const bases = [process.cwd(), CONTRACT_ROOT, homedir()].filter(Boolean);
|
|
220
|
+
for (const base of bases) {
|
|
221
|
+
for (const dot of dotDirs) c.push(join(base, dot, "skills", "scenario-gen", "SKILL.md"));
|
|
222
|
+
}
|
|
223
|
+
return c.find((p) => existsSync(p)) || c[c.length - 1];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* ─── 서브커맨드: uninstall ───────────────────────────────────────────── */
|
|
227
|
+
// 삭제의 단일 진입점 — npm 7+ 는 preuninstall lifecycle 을 실행하지 않으므로
|
|
228
|
+
// ("npm v7 does not [run] uninstall scripts" — npm 공식 문서) 삭제 시점은 여기서 만든다.
|
|
229
|
+
// 범위: here(현재 폴더의 설치) / all(모든 설치 폴더) / full(전부 + 전역 패키지 자동 제거).
|
|
230
|
+
// 순서 중요: cleanup/tty-menu/install-paths 와 패키지명은 spawn 전에 로드/확보 완료 →
|
|
231
|
+
// 패키지 디렉토리가 삭제돼도 (POSIX) 안전. spawn 이후엔 PACKAGE_ROOT 를 다시 읽지 않는다.
|
|
232
|
+
const UNINSTALL_SCOPES = new Set(["here", "all", "full"]);
|
|
233
|
+
|
|
234
|
+
// 전역 제거 커맨드 — postinstall 이 receipt 에 기록한 npm_config_user_agent
|
|
235
|
+
// ("pnpm/9.x npm/? node/…") 의 첫 토큰으로 설치 PM 을 판별한다. pnpm/yarn 전역
|
|
236
|
+
// 설치 사용자의 full 단계가 npm 으로 엉뚱한 제거를 시도하지 않도록. 미기록/미인식 → npm.
|
|
237
|
+
function resolvePmRemove(userAgent, pkgName) {
|
|
238
|
+
const pm = String(userAgent ?? "").trim().split("/")[0].toLowerCase();
|
|
239
|
+
if (pm === "pnpm") return { bin: "pnpm", args: ["remove", "-g", pkgName] };
|
|
240
|
+
if (pm === "yarn") return { bin: "yarn", args: ["global", "remove", pkgName] };
|
|
241
|
+
if (pm === "bun") return { bin: "bun", args: ["remove", "-g", pkgName] };
|
|
242
|
+
return { bin: "npm", args: ["uninstall", "-g", pkgName] };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function cmdUninstall(opts = {}) {
|
|
246
|
+
const { cleanup, collectInstalls, findInstallAt } =
|
|
247
|
+
await importScript("cleanup.mjs");
|
|
248
|
+
const { isWorkspaceDevEnv, INSTALL_RECEIPT } =
|
|
249
|
+
await importScript("install-paths.mjs");
|
|
250
|
+
const { resolveTTY, promptMenu } = await importScript("tty-menu.mjs");
|
|
251
|
+
|
|
252
|
+
// 패키지명은 manifest 에서 — prepack 이 프로파일별로 name 을 바꿔도 안전.
|
|
253
|
+
let pkgName = "@flextudio/scenario";
|
|
254
|
+
try {
|
|
255
|
+
pkgName = JSON.parse(readFileSync(join(PACKAGE_ROOT, "package.json"), "utf-8")).name || pkgName;
|
|
256
|
+
} catch { /* 폴백 이름 사용 */ }
|
|
257
|
+
// 설치 PM 판별 근거(userAgent)도 spawn 전에 확보.
|
|
258
|
+
let installUserAgent = null;
|
|
259
|
+
try {
|
|
260
|
+
installUserAgent = JSON.parse(readFileSync(INSTALL_RECEIPT, "utf-8")).userAgent ?? null;
|
|
261
|
+
} catch { /* receipt 없음/손상 → npm 폴백 */ }
|
|
262
|
+
const pmRemove = resolvePmRemove(installUserAgent, pkgName);
|
|
263
|
+
const manualCmd = `${pmRemove.bin} ${pmRemove.args.join(" ")}`;
|
|
264
|
+
|
|
265
|
+
const cwd = resolve(process.cwd());
|
|
266
|
+
// here = 현재 폴더가 receipt 에 기록된 설치 폴더 자신일 때만 (하위/부모 불인정,
|
|
267
|
+
// 심링크 차이만 realpath 로 흡수). 다른 위치의 설치는 all|full 로.
|
|
268
|
+
const hereInstall = findInstallAt(cwd);
|
|
269
|
+
|
|
270
|
+
// 범위 결정: --scope 플래그 → 검증 / 없으면 TTY 메뉴 / 비TTY+무플래그 → 안전 거부.
|
|
271
|
+
// (postinstall 의 "기본값 폴백"과 달리 파괴적 동작이라 묻지 못하면 지우지 않는다.)
|
|
272
|
+
let scope = opts.scope;
|
|
273
|
+
if (scope !== undefined) {
|
|
274
|
+
if (!UNINSTALL_SCOPES.has(scope)) {
|
|
275
|
+
bad(`--scope 는 here|all|full 중 하나여야 합니다 (받음: ${scope})`);
|
|
276
|
+
process.exit(2);
|
|
277
|
+
}
|
|
278
|
+
if (scope === "here" && !hereInstall) {
|
|
279
|
+
bad(`현재 폴더(${cwd})는 설치 기록(receipt)에 없습니다 — --scope all|full 을 사용하세요.`);
|
|
280
|
+
const dirs = [...new Set(collectInstalls().map((t) => t.dir))];
|
|
281
|
+
if (dirs.length) {
|
|
282
|
+
err(" 설치 기록 폴더:");
|
|
283
|
+
for (const d of dirs) err(` - ${d}`);
|
|
284
|
+
}
|
|
285
|
+
process.exit(2);
|
|
286
|
+
}
|
|
287
|
+
} else {
|
|
288
|
+
const io = resolveTTY();
|
|
289
|
+
if (!io) {
|
|
290
|
+
bad("비대화형 환경 — 삭제 범위를 물을 수 없습니다. --scope here|all|full 로 지정하세요.");
|
|
291
|
+
process.exit(2);
|
|
292
|
+
}
|
|
293
|
+
const items = [
|
|
294
|
+
...(hereInstall ? [{ key: "here", label: "현재 폴더만 — 이 폴더의 스킬/커맨드 삭제" }] : []),
|
|
295
|
+
{ key: "all", label: "모든 설치 폴더 — 설치된 모든 폴더의 스킬/커맨드 삭제" },
|
|
296
|
+
{ key: "full", label: "완전 삭제 — 모든 설치 폴더 + ~/.flex-scenario 삭제 후 전역 패키지 제거" },
|
|
297
|
+
{ key: "cancel", label: "취소" },
|
|
298
|
+
];
|
|
299
|
+
try {
|
|
300
|
+
scope = await promptMenu(io, { header: "삭제 범위를 선택하세요.", items, cancelKey: "cancel" });
|
|
301
|
+
} finally { io.close(); }
|
|
302
|
+
if (scope === "cancel") { out("취소했습니다."); return; }
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (scope === "full") {
|
|
306
|
+
try {
|
|
307
|
+
const m = await importScript("auth.mjs");
|
|
308
|
+
await m.runLogout();
|
|
309
|
+
} catch {}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// here 는 receipt 에 기록된 값(심링크 정규화 전 원본)을 넘겨 cleanup 의 dir 비교와 일치시킨다.
|
|
313
|
+
cleanup({ verbose: true, scope, dir: hereInstall?.dir ?? cwd }); // best-effort — 절대 throw 하지 않는다
|
|
314
|
+
|
|
315
|
+
if (scope !== "full") {
|
|
316
|
+
out("");
|
|
317
|
+
ok(`정리 완료 (${scope === "here" ? "현재 폴더" : "모든 설치 폴더"}) — CLI 와 ~/.flex-scenario 는 유지됩니다.`);
|
|
318
|
+
out(` 완전 삭제: flex-scenario uninstall --scope full`);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (process.env.FLEX_SCENARIO_FORCE_UNINSTALL !== "1" && isWorkspaceDevEnv()) {
|
|
323
|
+
out("");
|
|
324
|
+
out("· workspace dev 환경 감지 — 전역 패키지는 건드리지 않습니다 (cleanup 만 수행).");
|
|
325
|
+
out(` 전역 설치본까지 지우려면: ${manualCmd} (또는 FLEX_SCENARIO_FORCE_UNINSTALL=1)`);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
out("");
|
|
330
|
+
out(`→ ${manualCmd}`);
|
|
331
|
+
// win32: npm.cmd/pnpm.cmd/yarn.cmd 는 shell 없이는 spawn 불가 (Node 18.20+/20.12+ EINVAL).
|
|
332
|
+
// 실행 중인 .cmd shim 삭제로 종료 직후 cosmetic 한 cmd 경고가 날 수 있으나 무해.
|
|
333
|
+
const res = spawnSync(pmRemove.bin, pmRemove.args, {
|
|
334
|
+
stdio: "inherit",
|
|
335
|
+
shell: process.platform === "win32",
|
|
336
|
+
});
|
|
337
|
+
if (res.error || res.status !== 0) {
|
|
338
|
+
bad(`${pmRemove.bin} 전역 제거 실패${res.error ? ` — ${res.error.code || res.error.message}` : ` (exit=${res.status})`}`);
|
|
339
|
+
err("cleanup 은 완료됐습니다. 패키지 제거만 수동으로 마무리하세요:");
|
|
340
|
+
err(` ${manualCmd}`);
|
|
341
|
+
err(" (EACCES 면 sudo, 다른 PM 으로 전역 설치했다면 해당 PM 의 global remove 사용)");
|
|
342
|
+
process.exit(1);
|
|
343
|
+
}
|
|
344
|
+
out("");
|
|
345
|
+
ok(`완전 삭제 완료 — 설치 폴더 정리 + ~/.flex-scenario 삭제 + ${pkgName} 전역 패키지 제거.`);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* ─── 서브커맨드: catalog ─────────────────────────────────────────────── */
|
|
349
|
+
function cmdCatalog(opts) {
|
|
350
|
+
if (!CONTRACT_ROOT) {
|
|
351
|
+
bad("contract root 를 찾지 못함. FLEX_CONTRACT_ROOT 또는 'flex-scenario init' 실행 후 다시 시도.");
|
|
352
|
+
process.exit(2);
|
|
353
|
+
}
|
|
354
|
+
const section = opts.section;
|
|
355
|
+
const catalog = JSON.parse(readFileSync(join(CONTRACT_ROOT, "spec", "catalog.json"), "utf-8"));
|
|
356
|
+
if (!section) {
|
|
357
|
+
out("catalog sections:");
|
|
358
|
+
for (const k of Object.keys(catalog)) {
|
|
359
|
+
if (k.startsWith("$")) continue;
|
|
360
|
+
const v = catalog[k];
|
|
361
|
+
const size = Array.isArray(v) ? `[${v.length}]` : typeof v;
|
|
362
|
+
out(` - ${k} ${size}`);
|
|
363
|
+
}
|
|
364
|
+
out("\nusage: flex-scenario catalog --section <name>");
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (!(section in catalog)) {
|
|
368
|
+
bad(`unknown section: ${section}`);
|
|
369
|
+
process.exit(2);
|
|
370
|
+
}
|
|
371
|
+
out(JSON.stringify(catalog[section], null, 2));
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* ─── 서브커맨드: examples ───────────────────────────────────────────── */
|
|
375
|
+
function cmdExamples(positional /* [sub, arg] */) {
|
|
376
|
+
if (!CONTRACT_ROOT) {
|
|
377
|
+
bad("contract root 를 찾지 못함. FLEX_CONTRACT_ROOT 또는 'flex-scenario init' 실행 후 다시 시도.");
|
|
378
|
+
process.exit(2);
|
|
379
|
+
}
|
|
380
|
+
const sub = positional[0] ?? "list";
|
|
381
|
+
const root = join(CONTRACT_ROOT, "examples");
|
|
382
|
+
if (!existsSync(root)) { bad(`examples 디렉토리 없음: ${root}`); process.exit(2); }
|
|
383
|
+
|
|
384
|
+
if (sub === "list") {
|
|
385
|
+
const files = [];
|
|
386
|
+
(function walk(d) {
|
|
387
|
+
for (const e of readdirSync(d)) {
|
|
388
|
+
const f = join(d, e);
|
|
389
|
+
const st = statSync(f);
|
|
390
|
+
if (st.isDirectory()) walk(f);
|
|
391
|
+
else if (e.endsWith(".json")) files.push(relative(root, f));
|
|
392
|
+
}
|
|
393
|
+
})(root);
|
|
394
|
+
files.sort();
|
|
395
|
+
for (const f of files) out(f);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (sub === "cat") {
|
|
399
|
+
const rel = positional[1];
|
|
400
|
+
if (!rel) { bad("usage: flex-scenario examples cat <relative-path>"); process.exit(2); }
|
|
401
|
+
if (rel.includes("..") || isAbsolute(rel)) {
|
|
402
|
+
bad("examples 외부 경로 금지"); process.exit(2);
|
|
403
|
+
}
|
|
404
|
+
const f = join(root, rel);
|
|
405
|
+
if (!existsSync(f)) { bad(`not found: ${rel}`); process.exit(2); }
|
|
406
|
+
out(readFileSync(f, "utf-8"));
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
bad(`unknown subcommand: examples ${sub}`); process.exit(2);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/* ─── 서브커맨드: validate ────────────────────────────────────────────── */
|
|
413
|
+
async function cmdValidate(positional, opts) {
|
|
414
|
+
if (!CONTRACT_ROOT) {
|
|
415
|
+
bad("contract root 를 찾지 못함. FLEX_CONTRACT_ROOT 또는 'flex-scenario init' 실행 후 다시 시도.");
|
|
416
|
+
process.exit(2);
|
|
417
|
+
}
|
|
418
|
+
const file = positional[0];
|
|
419
|
+
if (!file) { bad("usage: flex-scenario validate [--schema <name>] <file>"); process.exit(2); }
|
|
420
|
+
if (!existsSync(file)) { bad(`not found: ${file}`); process.exit(2); }
|
|
421
|
+
|
|
422
|
+
// contract-core 는 schema/+rules.md 위치를 FLEX_CONTRACT_ROOT 로 받는다 — 이미 set.
|
|
423
|
+
const { buildAjv, runAllCrossChecks, buildKnownProps, denoiseErrors, foldOneOfCascade, surfaceControlBranchErrors } =
|
|
424
|
+
await import("@flextudio/contract-core");
|
|
425
|
+
|
|
426
|
+
// ajv 인스턴스 빌드 (stderr 로 timing 보고 — 무시 가능).
|
|
427
|
+
const { ajv, ajvStrict, schemaIndex, schemaCache } = buildAjv();
|
|
428
|
+
// oneOf 분기 cascade 노이즈 필터용 — MCP validate 경로와 동일 (대칭).
|
|
429
|
+
const knownProps = buildKnownProps(schemaCache);
|
|
430
|
+
|
|
431
|
+
const text = readFileSync(file, "utf-8");
|
|
432
|
+
let payload;
|
|
433
|
+
try { payload = JSON.parse(text); }
|
|
434
|
+
catch (e) { bad(`JSON parse 실패: ${e.message}`); process.exit(1); }
|
|
435
|
+
|
|
436
|
+
// schema 키 결정.
|
|
437
|
+
// --schema <name>:
|
|
438
|
+
// "scenario" → "scenario.schema.json"
|
|
439
|
+
// "step" → "step.schema.json"
|
|
440
|
+
// "group" → "group.schema.json"
|
|
441
|
+
// 직접 경로 → 그대로
|
|
442
|
+
const schemaArg = opts.schema || (opts.s === true ? null : opts.s);
|
|
443
|
+
const schemaKey = resolveSchemaKey(schemaArg ?? "scenario", schemaIndex);
|
|
444
|
+
if (!schemaKey) {
|
|
445
|
+
bad(`unknown schema: ${schemaArg}. 사용 가능: ${listSchemaShorthands(schemaIndex).join(", ")}`);
|
|
446
|
+
process.exit(2);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const errors = [];
|
|
450
|
+
|
|
451
|
+
// ─── [phase: materialize] ─────────────────────────────────────────────
|
|
452
|
+
// MCP 서버와 동일하게 strict-fields 진입 전에 pattern invocation 과
|
|
453
|
+
// raw control 의 `design` 키를 풀 메타데이터로 expand. 이 단계가 없으면
|
|
454
|
+
// 정상적인 `design` 키도 strict 가 `[strict-fields]` 로 거부한다.
|
|
455
|
+
try {
|
|
456
|
+
const materializeUrl = pathToFileURL(
|
|
457
|
+
join(CONTRACT_ROOT, "schema/v1/patterns/_base.materialize.mjs"),
|
|
458
|
+
).href;
|
|
459
|
+
const { materializeScenario, materializeFragment } = await import(materializeUrl);
|
|
460
|
+
const mr = schemaKey === "scenario.schema.json"
|
|
461
|
+
? await materializeScenario(payload)
|
|
462
|
+
: await materializeFragment(payload);
|
|
463
|
+
if (mr && typeof mr === "object") {
|
|
464
|
+
if (mr.scenario && typeof mr.scenario === "object") payload = mr.scenario;
|
|
465
|
+
else if (mr.fragment && typeof mr.fragment === "object") payload = mr.fragment;
|
|
466
|
+
for (const e of mr.errors ?? []) {
|
|
467
|
+
errors.push({
|
|
468
|
+
kind: e.kind ?? "materialize",
|
|
469
|
+
path: e.path ?? "<root>",
|
|
470
|
+
schemaPath: e.schemaPath,
|
|
471
|
+
message: e.message,
|
|
472
|
+
...(e.patternName ? { patternName: e.patternName } : {}),
|
|
473
|
+
...(e.hint ? { hint: e.hint } : {}),
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
} catch (e) {
|
|
478
|
+
errors.push({
|
|
479
|
+
kind: "materialize",
|
|
480
|
+
path: "<root>",
|
|
481
|
+
message: `materialize 단계 catastrophic: ${e.message}`,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// ─── [phase: intent] ──────────────────────────────────────────────────
|
|
486
|
+
// pattern + design 펼침 (materialize) 다음 단계로 intent (런타임 영역
|
|
487
|
+
// short-form) 펼침을 별도 모듈에서 호출. _base.materialize.mjs 와 책임 분리
|
|
488
|
+
// — pattern/design 은 컨트롤 트리, intent 는 컬렉션/스크립트/카테고리.
|
|
489
|
+
// 진실원본: runtime/v1/intent-system/INTENT.md, materialize.mjs
|
|
490
|
+
try {
|
|
491
|
+
const intentUrl = pathToFileURL(
|
|
492
|
+
join(CONTRACT_ROOT, "runtime/v1/intent-system/materialize.mjs"),
|
|
493
|
+
).href;
|
|
494
|
+
const { applyIntentToScenario, applyIntentToFragment } = await import(intentUrl);
|
|
495
|
+
const ir = schemaKey === "scenario.schema.json"
|
|
496
|
+
? applyIntentToScenario(payload)
|
|
497
|
+
: applyIntentToFragment(payload);
|
|
498
|
+
if (ir && typeof ir === "object") {
|
|
499
|
+
if (ir.scenario && typeof ir.scenario === "object") payload = ir.scenario;
|
|
500
|
+
else if (ir.fragment && typeof ir.fragment === "object") payload = ir.fragment;
|
|
501
|
+
for (const e of ir.errors ?? []) {
|
|
502
|
+
errors.push({
|
|
503
|
+
kind: e.kind ?? "intent",
|
|
504
|
+
path: e.path ?? "<root>",
|
|
505
|
+
message: e.message,
|
|
506
|
+
...(e.phase ? { phase: e.phase } : {}),
|
|
507
|
+
...(e.scope ? { scope: e.scope } : {}),
|
|
508
|
+
...(e.slot ? { slot: e.slot } : {}),
|
|
509
|
+
...(e.allowedScopes ? { allowedScopes: e.allowedScopes } : {}),
|
|
510
|
+
...(e.hint ? { hint: e.hint } : {}),
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
} catch (e) {
|
|
515
|
+
errors.push({
|
|
516
|
+
kind: "intent",
|
|
517
|
+
path: "<root>",
|
|
518
|
+
message: `intent 단계 catastrophic: ${e.message}`,
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const validate = ajv.getSchema(schemaKey);
|
|
523
|
+
if (!validate) { bad(`schema 미등록: ${schemaKey}`); process.exit(2); }
|
|
524
|
+
const validateStrict = ajvStrict.getSchema(schemaKey);
|
|
525
|
+
|
|
526
|
+
const passed = validate(payload);
|
|
527
|
+
if (!passed) {
|
|
528
|
+
// loose ajv 의 oneOf 분기 cascade 를 denoise → 남은 redundant oneOf wrapper fold
|
|
529
|
+
// → leaf 로 남은 oneOf wrapper 는 노드의 실제 ControlType/ContentsType 으로 재검증해
|
|
530
|
+
// actionable 한 concrete 에러(빠진 required 등)로 표면화 (bare wrapper 방지).
|
|
531
|
+
const looseErrors = surfaceControlBranchErrors(
|
|
532
|
+
foldOneOfCascade(denoiseErrors(validate.errors ?? [], knownProps)),
|
|
533
|
+
payload, ajv, schemaCache,
|
|
534
|
+
);
|
|
535
|
+
for (const e of looseErrors) {
|
|
536
|
+
errors.push({
|
|
537
|
+
kind: "schema",
|
|
538
|
+
path: e.instancePath || "<root>",
|
|
539
|
+
schemaPath: e.schemaPath,
|
|
540
|
+
message: e.message,
|
|
541
|
+
params: e.params,
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (validateStrict) {
|
|
546
|
+
const okStrict = validateStrict(payload);
|
|
547
|
+
if (!okStrict) {
|
|
548
|
+
// strict 변종은 cascade 가 가장 심함 — denoise 후 진짜 unknown 키만 남는다.
|
|
549
|
+
for (const e of denoiseErrors(validateStrict.errors ?? [], knownProps)) {
|
|
550
|
+
if (e.keyword !== "additionalProperties" && e.keyword !== "unevaluatedProperties") continue;
|
|
551
|
+
const extra = e.params?.additionalProperty ?? e.params?.unevaluatedProperty;
|
|
552
|
+
errors.push({
|
|
553
|
+
kind: "strict-fields",
|
|
554
|
+
path: e.instancePath || "<root>",
|
|
555
|
+
schemaPath: e.schemaPath,
|
|
556
|
+
message: `스키마 미정의 필드 '${extra}' — strict_fields ON.`,
|
|
557
|
+
params: e.params,
|
|
558
|
+
hint: CROSS_CHECK_FIX_HINTS["strict-fields"],
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// cross-check 는 전체 시나리오일 때만.
|
|
565
|
+
let crossCheckSummary = null;
|
|
566
|
+
if (schemaKey === "scenario.schema.json") {
|
|
567
|
+
const cross = runAllCrossChecks(payload, {
|
|
568
|
+
strictSample: true, strictImage: true, strictProto: true,
|
|
569
|
+
strictV1Controls: true, strictStepNav: true, strictNoInnerBlock: true,
|
|
570
|
+
strictNoService: true, strictScript: true, strictMockInit: true,
|
|
571
|
+
strictCategoryName: true,
|
|
572
|
+
});
|
|
573
|
+
crossCheckSummary = {};
|
|
574
|
+
for (const [tag, msgs] of Object.entries(cross)) {
|
|
575
|
+
crossCheckSummary[tag] = msgs.length;
|
|
576
|
+
const hint = CROSS_CHECK_FIX_HINTS[tag];
|
|
577
|
+
for (const m of msgs) errors.push({ kind: tag, message: m, ...(hint ? { hint } : {}) });
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// 실패 시 errors 는 상한 N 개로 잘라 신호를 작게 유지 (통과/실패 출력 대칭).
|
|
582
|
+
const ERROR_CAP = 30;
|
|
583
|
+
const result = {
|
|
584
|
+
ok: errors.length === 0,
|
|
585
|
+
schemaKey,
|
|
586
|
+
errorCount: errors.length,
|
|
587
|
+
...(crossCheckSummary ? { crossCheckSummary } : {}),
|
|
588
|
+
errors: errors.slice(0, ERROR_CAP),
|
|
589
|
+
...(errors.length > ERROR_CAP ? { truncated: true, errorTotal: errors.length } : {}),
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
// ─── [phase: write-back] ───────────────────────────────────────────────
|
|
593
|
+
// ok:true 일 때 materialized payload (design → raw expand 완료본) 를 입력
|
|
594
|
+
// 파일에 덮어쓴다. 런타임 엔진은 raw 스타일 필드만 소비하므로 design 키가
|
|
595
|
+
// 남아있으면 렌더 불가. ★ 이 파일이 곧 회수 대상(artifact) — 큰 산출물은
|
|
596
|
+
// 디스크 파일로만 존재하고 stdout/응답 채널을 통과시키지 않는다.
|
|
597
|
+
// --no-write 로 비활성 (dry-run / CI 검증 등). ok:false 면 절대 덮어쓰지 않음.
|
|
598
|
+
// 이미 materialize 된 파일이면 변경 없음 (idempotent).
|
|
599
|
+
if (result.ok && !opts["no-write"]) {
|
|
600
|
+
try {
|
|
601
|
+
writeFileSync(file, JSON.stringify(payload, null, 2) + "\n", "utf-8");
|
|
602
|
+
result.materialized = true;
|
|
603
|
+
result.writtenTo = file;
|
|
604
|
+
result.artifact = file; // 회수 대상 = materialized 입력 파일.
|
|
605
|
+
} catch (e) {
|
|
606
|
+
result.materialized = false;
|
|
607
|
+
result.writeError = e.message;
|
|
608
|
+
}
|
|
609
|
+
} else if (result.ok && opts["no-write"]) {
|
|
610
|
+
result.materialized = false;
|
|
611
|
+
result.writeSkipped = "--no-write";
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// --emit-materialized <path>: materialized 본문을 별도 경로에도 저장한다 (stdout 아님).
|
|
615
|
+
// 입력 파일과 다른 위치로 산출물을 분리하고 싶을 때만. stdout 엔 절대 본문을 안 냄.
|
|
616
|
+
const emitPath = opts["emit-materialized"];
|
|
617
|
+
if (result.ok && typeof emitPath === "string" && emitPath) {
|
|
618
|
+
try {
|
|
619
|
+
mkdirSync(dirname(resolve(emitPath)), { recursive: true });
|
|
620
|
+
writeFileSync(emitPath, JSON.stringify(payload, null, 2) + "\n", "utf-8");
|
|
621
|
+
result.emittedTo = emitPath;
|
|
622
|
+
if (!result.artifact) result.artifact = resolve(emitPath);
|
|
623
|
+
} catch (e) {
|
|
624
|
+
result.emitError = e.message;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// ─── [phase: emit] ─────────────────────────────────────────────────────
|
|
629
|
+
// 검증 신호(작음)와 산출물(큼)은 다른 채널. stdout 에는 통과/실패 모두 동일한
|
|
630
|
+
// 필드 집합의 작은 리포트({ ok, errorCount, errors?, artifact? }) 만 출력한다 —
|
|
631
|
+
// materialized 본문은 절대 stdout 에 싣지 않는다 (에이전트가 컨텍스트로 재독하지
|
|
632
|
+
// 않도록). 산출물은 write-back / --emit-materialized 로 파일에만 존재하고, 회수
|
|
633
|
+
// 주체는 result.artifact 경로로 직접 읽는다. exit code 와 ok 는 항상 일치.
|
|
634
|
+
out(JSON.stringify(result, null, 2));
|
|
635
|
+
if (result.ok) {
|
|
636
|
+
err(`✔ flex-scenario validate: ok (errors:0)${result.artifact ? ` — artifact → ${result.artifact}` : ""}`);
|
|
637
|
+
}
|
|
638
|
+
process.exit(result.ok ? 0 : 1);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function resolveSchemaKey(name, schemaIndex) {
|
|
642
|
+
// 1. exact match (file key)
|
|
643
|
+
for (const s of schemaIndex) if (s.key === name) return s.key;
|
|
644
|
+
// 2. .schema.json suffix
|
|
645
|
+
for (const s of schemaIndex) if (s.key === `${name}.schema.json`) return s.key;
|
|
646
|
+
// 3. basename match (예: name="scenario" → "scenario.schema.json")
|
|
647
|
+
for (const s of schemaIndex) if (s.basename === name) return s.key;
|
|
648
|
+
// 4. tail match — group / step 등 nested key 도 잡힘
|
|
649
|
+
const matches = schemaIndex.filter((s) => s.basename === name || s.key.endsWith(`/${name}.schema.json`));
|
|
650
|
+
if (matches.length === 1) return matches[0].key;
|
|
651
|
+
return null;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
function listSchemaShorthands(schemaIndex) {
|
|
655
|
+
// 상위 ~30 개만 노출.
|
|
656
|
+
return [...new Set(schemaIndex.map((s) => s.basename))].sort().slice(0, 30);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/* ─── 서브커맨드: doctor ─────────────────────────────────────────────── */
|
|
660
|
+
// PATH 에서 실행 파일 탐색 — win32 엔 which 가 없으므로 where 사용 (여러 줄 반환 → 첫 줄).
|
|
661
|
+
function findOnPath(bin) {
|
|
662
|
+
const r = spawnSync(process.platform === "win32" ? "where" : "which", [bin], { encoding: "utf-8" });
|
|
663
|
+
if (r.status !== 0 || !r.stdout) return null;
|
|
664
|
+
return r.stdout.split(/\r?\n/).map((s) => s.trim()).find(Boolean) ?? null;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
async function cmdDoctor() {
|
|
668
|
+
const checks = [];
|
|
669
|
+
|
|
670
|
+
// 1. 에이전트 바이너리 — receipt 에 기록된 설치 에이전트별로 점검 (기록 없으면 기본 에이전트).
|
|
671
|
+
// optional: 바이너리 부재가 스킬 자산 설치 상태를 깨뜨리진 않는다 — codex/antigravity
|
|
672
|
+
// 설치를 claude 부재로 실패 처리하지 않기 위함. PATH 바이너리가 없는 에이전트
|
|
673
|
+
// (antigravity = IDE 앱, AGENTS[].bin=null)는 점검 줄 자체를 생략.
|
|
674
|
+
const { collectInstalls } = await importScript("cleanup.mjs");
|
|
675
|
+
const { AGENTS, DEFAULT_AGENT } = await importScript("install-paths.mjs");
|
|
676
|
+
const installedAgents = [...new Set(collectInstalls().map((t) => t.agent))];
|
|
677
|
+
if (installedAgents.length === 0) installedAgents.push(DEFAULT_AGENT);
|
|
678
|
+
for (const agent of installedAgents) {
|
|
679
|
+
const bin = AGENTS[agent]?.bin;
|
|
680
|
+
if (!bin) continue;
|
|
681
|
+
const binPath = findOnPath(bin);
|
|
682
|
+
checks.push({
|
|
683
|
+
name: `${bin} binary`,
|
|
684
|
+
ok: !!binPath,
|
|
685
|
+
optional: true,
|
|
686
|
+
detail: binPath ?? `not found (PATH 에 ${bin} 없음)`,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// 2. SKILL.md 존재 — 프로젝트 로컬(cwd/.claude) 우선, 없으면 전역 폴백.
|
|
691
|
+
const skillPath = resolveSkillPath();
|
|
692
|
+
checks.push({ name: "SKILL.md installed", ok: existsSync(skillPath), detail: skillPath });
|
|
693
|
+
|
|
694
|
+
// 3. contract root.
|
|
695
|
+
checks.push({ name: "contract root", ok: !!CONTRACT_ROOT, detail: CONTRACT_ROOT ?? "(미해결)" });
|
|
696
|
+
|
|
697
|
+
// 4. core 모듈 require 가능 여부.
|
|
698
|
+
let coreOk = false; let coreDetail = "";
|
|
699
|
+
try {
|
|
700
|
+
const mod = await import("@flextudio/contract-core");
|
|
701
|
+
coreOk = typeof mod.buildAjv === "function" && typeof mod.runAllCrossChecks === "function";
|
|
702
|
+
coreDetail = coreOk ? "buildAjv + runAllCrossChecks 로드됨" : "import 성공했지만 expected exports 없음";
|
|
703
|
+
} catch (e) {
|
|
704
|
+
coreDetail = `import 실패: ${e.message}`;
|
|
705
|
+
}
|
|
706
|
+
checks.push({ name: "@flextudio/contract-core", ok: coreOk, detail: coreDetail });
|
|
707
|
+
|
|
708
|
+
out("flex-scenario doctor");
|
|
709
|
+
out("─".repeat(60));
|
|
710
|
+
let allOk = true;
|
|
711
|
+
for (const c of checks) {
|
|
712
|
+
const mark = c.ok ? "✔" : (c.optional ? "○" : "✘");
|
|
713
|
+
if (!c.ok && !c.optional) allOk = false;
|
|
714
|
+
const tag = (!c.ok && c.optional) ? " (optional)" : "";
|
|
715
|
+
out(`${mark} ${c.name.padEnd(34)} ${c.detail}${tag}`);
|
|
716
|
+
}
|
|
717
|
+
out("─".repeat(60));
|
|
718
|
+
out(allOk ? "all required checks passed." : "일부 필수 항목 실패 — 위 detail 참고.");
|
|
719
|
+
process.exit(allOk ? 0 : 1);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/* ─── 서브커맨드: contract info ─────────────────────────────────────── */
|
|
723
|
+
function cmdContract(positional) {
|
|
724
|
+
const sub = positional[0] ?? "info";
|
|
725
|
+
if (sub !== "info") { bad(`unknown subcommand: contract ${sub}`); process.exit(2); }
|
|
726
|
+
if (!CONTRACT_ROOT) {
|
|
727
|
+
bad("contract root 를 찾지 못함. FLEX_CONTRACT_ROOT 또는 'flex-scenario init' 실행 후 다시 시도.");
|
|
728
|
+
process.exit(2);
|
|
729
|
+
}
|
|
730
|
+
const catalog = (() => {
|
|
731
|
+
try { return JSON.parse(readFileSync(join(CONTRACT_ROOT, "spec", "catalog.json"), "utf-8")); }
|
|
732
|
+
catch { return {}; }
|
|
733
|
+
})();
|
|
734
|
+
const schemaDir = join(CONTRACT_ROOT, "schema", "v1");
|
|
735
|
+
let schemaCount = 0;
|
|
736
|
+
try {
|
|
737
|
+
const walk = (d) => {
|
|
738
|
+
for (const e of readdirSync(d)) {
|
|
739
|
+
const f = join(d, e);
|
|
740
|
+
const st = statSync(f);
|
|
741
|
+
if (st.isDirectory()) walk(f);
|
|
742
|
+
else if (e.endsWith(".schema.json")) schemaCount += 1;
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
walk(schemaDir);
|
|
746
|
+
} catch { /* ignore */ }
|
|
747
|
+
out(JSON.stringify({
|
|
748
|
+
contract: "flextudio meta-contract",
|
|
749
|
+
version: "v1",
|
|
750
|
+
contractRoot: CONTRACT_ROOT,
|
|
751
|
+
schemas: schemaCount,
|
|
752
|
+
catalogSections: Object.keys(catalog).filter((k) => !k.startsWith("$")),
|
|
753
|
+
}, null, 2));
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/* ─── 서브커맨드: session start/status/finish (MCP build_sequence 동형) ── */
|
|
757
|
+
const SESSIONS_DIR = join(homedir(), ".flex-scenario", "sessions");
|
|
758
|
+
function sessionPath(id) { return join(SESSIONS_DIR, `${id}.json`); }
|
|
759
|
+
function loadSession(id) {
|
|
760
|
+
const p = sessionPath(id);
|
|
761
|
+
if (!existsSync(p)) return null;
|
|
762
|
+
try { return JSON.parse(readFileSync(p, "utf-8")); }
|
|
763
|
+
catch { return null; }
|
|
764
|
+
}
|
|
765
|
+
function saveSession(s) {
|
|
766
|
+
mkdirSync(SESSIONS_DIR, { recursive: true });
|
|
767
|
+
writeFileSync(sessionPath(s.build_id), JSON.stringify(s, null, 2) + "\n", "utf-8");
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* 주어진 폴더 최상위에서 가장 최근의 시나리오 *.json (Steps 키 보유) 경로를 찾는다.
|
|
772
|
+
* 산출물 회수의 파일 기반 폴백 — 큰 본문을 stdout/응답으로 받지 않고 디스크에서 직접 읽는다.
|
|
773
|
+
* schema 파일($schema/$id 보유, Steps 없음)은 자동 배제.
|
|
774
|
+
* ★ 산출물은 "현재 작업 폴더(cwd)" 에 쓴다.
|
|
775
|
+
*/
|
|
776
|
+
function findLatestScenario(root) {
|
|
777
|
+
if (!root) return null;
|
|
778
|
+
let entries;
|
|
779
|
+
try { entries = readdirSync(root); } catch { return null; }
|
|
780
|
+
let best = null;
|
|
781
|
+
let bestMtime = -1;
|
|
782
|
+
for (const name of entries) {
|
|
783
|
+
if (!name.endsWith(".json")) continue;
|
|
784
|
+
const p = join(root, name);
|
|
785
|
+
let st;
|
|
786
|
+
try { st = statSync(p); } catch { continue; }
|
|
787
|
+
if (!st.isFile()) continue;
|
|
788
|
+
try {
|
|
789
|
+
const j = JSON.parse(readFileSync(p, "utf-8"));
|
|
790
|
+
if (j && typeof j === "object" && !Array.isArray(j) && j.Steps && typeof j.Steps === "object") {
|
|
791
|
+
if (st.mtimeMs > bestMtime) { bestMtime = st.mtimeMs; best = p; }
|
|
792
|
+
}
|
|
793
|
+
} catch { /* 비 JSON / 부분 쓰기 무시 */ }
|
|
794
|
+
}
|
|
795
|
+
return best;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function cmdSession(positional, opts) {
|
|
799
|
+
const sub = positional[0];
|
|
800
|
+
if (!sub) { bad("usage: flex-scenario session {start|status|finish} [--id <build_id>]"); process.exit(2); }
|
|
801
|
+
|
|
802
|
+
if (sub === "start") {
|
|
803
|
+
const build_id = randomBytes(8).toString("hex");
|
|
804
|
+
const session = {
|
|
805
|
+
build_id,
|
|
806
|
+
stage: "started",
|
|
807
|
+
next: "context_ready → README.md / examples/index.json Read",
|
|
808
|
+
created: new Date().toISOString(),
|
|
809
|
+
updated: new Date().toISOString(),
|
|
810
|
+
};
|
|
811
|
+
saveSession(session);
|
|
812
|
+
out(JSON.stringify({ build_id, stage: session.stage, next: session.next }, null, 2));
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
const id = opts.id;
|
|
817
|
+
if (!id) { bad("usage: flex-scenario session {status|finish} --id <build_id>"); process.exit(2); }
|
|
818
|
+
const s = loadSession(id);
|
|
819
|
+
if (!s) { bad(`session not found: ${id}`); process.exit(2); }
|
|
820
|
+
|
|
821
|
+
if (sub === "status") {
|
|
822
|
+
out(JSON.stringify(s, null, 2));
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
if (sub === "finish") {
|
|
826
|
+
s.stage = "finished";
|
|
827
|
+
s.updated = new Date().toISOString();
|
|
828
|
+
// 산출물 경로 결정 — 회수 주체가 stdout 파싱 없이 이 경로만 신뢰한다.
|
|
829
|
+
// 1) --artifact <path> 명시. 2) 현재 작업 폴더(cwd) 내 최신 시나리오 *.json.
|
|
830
|
+
let artifact = null;
|
|
831
|
+
if (typeof opts.artifact === "string" && opts.artifact) {
|
|
832
|
+
artifact = resolve(opts.artifact);
|
|
833
|
+
} else {
|
|
834
|
+
artifact = findLatestScenario(process.cwd());
|
|
835
|
+
}
|
|
836
|
+
if (artifact) s.artifact = artifact;
|
|
837
|
+
saveSession(s);
|
|
838
|
+
out(JSON.stringify({ build_id: id, stage: "finished", artifact }, null, 2));
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
bad(`unknown subcommand: session ${sub}`);
|
|
842
|
+
process.exit(2);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/* ─── 디스패치 ───────────────────────────────────────────────────────── */
|
|
846
|
+
async function main() {
|
|
847
|
+
const argv = process.argv.slice(2);
|
|
848
|
+
if (argv.length === 0) { cmdHelp(); return; }
|
|
849
|
+
const [cmd, ...rest] = argv;
|
|
850
|
+
const { positional, opts } = parseArgs(rest);
|
|
851
|
+
switch (cmd) {
|
|
852
|
+
case "version": case "--version": case "-v":
|
|
853
|
+
return cmdVersion();
|
|
854
|
+
case "help": case "--help": case "-h":
|
|
855
|
+
return cmdHelp();
|
|
856
|
+
case "init":
|
|
857
|
+
return cmdInit(opts);
|
|
858
|
+
case "uninstall":
|
|
859
|
+
return cmdUninstall(opts);
|
|
860
|
+
case "catalog":
|
|
861
|
+
return cmdCatalog(opts);
|
|
862
|
+
case "examples":
|
|
863
|
+
return cmdExamples(positional);
|
|
864
|
+
case "validate":
|
|
865
|
+
return cmdValidate(positional, opts);
|
|
866
|
+
case "contract":
|
|
867
|
+
return cmdContract(positional);
|
|
868
|
+
case "session":
|
|
869
|
+
return cmdSession(positional, opts);
|
|
870
|
+
case "doctor":
|
|
871
|
+
return cmdDoctor();
|
|
872
|
+
case "login": {
|
|
873
|
+
const m = await importScript("auth.mjs");
|
|
874
|
+
return m.runLogin(rest);
|
|
875
|
+
}
|
|
876
|
+
case "logout": {
|
|
877
|
+
const m = await importScript("auth.mjs");
|
|
878
|
+
return m.runLogout(rest);
|
|
879
|
+
}
|
|
880
|
+
case "create": {
|
|
881
|
+
const m = await importScript("api-call.mjs");
|
|
882
|
+
return m.runApiCall(rest);
|
|
883
|
+
}
|
|
884
|
+
default:
|
|
885
|
+
bad(`unknown subcommand: ${cmd}`);
|
|
886
|
+
out("");
|
|
887
|
+
cmdHelp();
|
|
888
|
+
process.exit(2);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
main().catch((e) => {
|
|
893
|
+
bad(e?.stack || e?.message || String(e));
|
|
894
|
+
process.exit(1);
|
|
895
|
+
});
|