skill-universe 1.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/README.md +24 -0
- package/bin/skillc.mjs +3 -0
- package/build/dev/javascript/argv/_gleam_artefacts/argv.cache +0 -0
- package/build/dev/javascript/argv/_gleam_artefacts/argv.cache_inline +0 -0
- package/build/dev/javascript/argv/_gleam_artefacts/argv.cache_meta +0 -0
- package/build/dev/javascript/argv/argv.erl +12 -0
- package/build/dev/javascript/argv/argv.mjs +31 -0
- package/build/dev/javascript/argv/argv_ffi.erl +27 -0
- package/build/dev/javascript/argv/argv_ffi.mjs +20 -0
- package/build/dev/javascript/argv/gleam.mjs +1 -0
- package/build/dev/javascript/filepath/_gleam_artefacts/filepath.cache +0 -0
- package/build/dev/javascript/filepath/_gleam_artefacts/filepath.cache_inline +0 -0
- package/build/dev/javascript/filepath/_gleam_artefacts/filepath.cache_meta +0 -0
- package/build/dev/javascript/filepath/filepath.erl +425 -0
- package/build/dev/javascript/filepath/filepath.mjs +529 -0
- package/build/dev/javascript/filepath/filepath_ffi.erl +9 -0
- package/build/dev/javascript/filepath/filepath_ffi.mjs +6 -0
- package/build/dev/javascript/filepath/gleam.mjs +1 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/dict.mjs +710 -0
- package/build/dev/javascript/gleam_stdlib/gleam/bit_array.mjs +285 -0
- package/build/dev/javascript/gleam_stdlib/gleam/bool.mjs +313 -0
- package/build/dev/javascript/gleam_stdlib/gleam/bytes_tree.mjs +225 -0
- package/build/dev/javascript/gleam_stdlib/gleam/dict.mjs +456 -0
- package/build/dev/javascript/gleam_stdlib/gleam/dynamic/decode.mjs +985 -0
- package/build/dev/javascript/gleam_stdlib/gleam/dynamic.mjs +35 -0
- package/build/dev/javascript/gleam_stdlib/gleam/float.mjs +572 -0
- package/build/dev/javascript/gleam_stdlib/gleam/function.mjs +6 -0
- package/build/dev/javascript/gleam_stdlib/gleam/int.mjs +832 -0
- package/build/dev/javascript/gleam_stdlib/gleam/io.mjs +8 -0
- package/build/dev/javascript/gleam_stdlib/gleam/list.mjs +3160 -0
- package/build/dev/javascript/gleam_stdlib/gleam/option.mjs +418 -0
- package/build/dev/javascript/gleam_stdlib/gleam/order.mjs +178 -0
- package/build/dev/javascript/gleam_stdlib/gleam/pair.mjs +102 -0
- package/build/dev/javascript/gleam_stdlib/gleam/result.mjs +480 -0
- package/build/dev/javascript/gleam_stdlib/gleam/set.mjs +416 -0
- package/build/dev/javascript/gleam_stdlib/gleam/string.mjs +723 -0
- package/build/dev/javascript/gleam_stdlib/gleam/string_tree.mjs +133 -0
- package/build/dev/javascript/gleam_stdlib/gleam/uri.mjs +1155 -0
- package/build/dev/javascript/gleam_stdlib/gleam.mjs +1 -0
- package/build/dev/javascript/gleam_stdlib/gleam@bit_array.erl +347 -0
- package/build/dev/javascript/gleam_stdlib/gleam@bool.erl +352 -0
- package/build/dev/javascript/gleam_stdlib/gleam@bytes_tree.erl +211 -0
- package/build/dev/javascript/gleam_stdlib/gleam@dict.erl +521 -0
- package/build/dev/javascript/gleam_stdlib/gleam@dynamic.erl +106 -0
- package/build/dev/javascript/gleam_stdlib/gleam@dynamic@decode.erl +1112 -0
- package/build/dev/javascript/gleam_stdlib/gleam@float.erl +764 -0
- package/build/dev/javascript/gleam_stdlib/gleam@function.erl +18 -0
- package/build/dev/javascript/gleam_stdlib/gleam@int.erl +1004 -0
- package/build/dev/javascript/gleam_stdlib/gleam@io.erl +80 -0
- package/build/dev/javascript/gleam_stdlib/gleam@list.erl +2832 -0
- package/build/dev/javascript/gleam_stdlib/gleam@option.erl +413 -0
- package/build/dev/javascript/gleam_stdlib/gleam@order.erl +200 -0
- package/build/dev/javascript/gleam_stdlib/gleam@pair.erl +110 -0
- package/build/dev/javascript/gleam_stdlib/gleam@result.erl +532 -0
- package/build/dev/javascript/gleam_stdlib/gleam@set.erl +433 -0
- package/build/dev/javascript/gleam_stdlib/gleam@string.erl +1012 -0
- package/build/dev/javascript/gleam_stdlib/gleam@string_tree.erl +207 -0
- package/build/dev/javascript/gleam_stdlib/gleam@uri.erl +1049 -0
- package/build/dev/javascript/gleam_stdlib/gleam_stdlib.erl +529 -0
- package/build/dev/javascript/gleam_stdlib/gleam_stdlib.mjs +1050 -0
- package/build/dev/javascript/gleam_version +1 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@gleam_panic.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@gleam_panic.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@gleam_panic.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@reporting.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@reporting.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@reporting.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@should.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@should.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@should.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/gleam.mjs +1 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/gleam_panic.mjs +180 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/gleeunit_gleam_panic_ffi.erl +49 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/gleeunit_gleam_panic_ffi.mjs +91 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/reporting.mjs +256 -0
- package/build/dev/javascript/gleeunit/gleeunit/should.mjs +135 -0
- package/build/dev/javascript/gleeunit/gleeunit.erl +89 -0
- package/build/dev/javascript/gleeunit/gleeunit.mjs +62 -0
- package/build/dev/javascript/gleeunit/gleeunit@internal@gleam_panic.erl +56 -0
- package/build/dev/javascript/gleeunit/gleeunit@internal@reporting.erl +343 -0
- package/build/dev/javascript/gleeunit/gleeunit@should.erl +153 -0
- package/build/dev/javascript/gleeunit/gleeunit_ffi.erl +21 -0
- package/build/dev/javascript/gleeunit/gleeunit_ffi.mjs +100 -0
- package/build/dev/javascript/gleeunit/gleeunit_progress.erl +72 -0
- package/build/dev/javascript/prelude.mjs +1575 -0
- package/build/dev/javascript/simplifile/_gleam_artefacts/simplifile.cache +0 -0
- package/build/dev/javascript/simplifile/_gleam_artefacts/simplifile.cache_inline +0 -0
- package/build/dev/javascript/simplifile/_gleam_artefacts/simplifile.cache_meta +0 -0
- package/build/dev/javascript/simplifile/gleam.mjs +1 -0
- package/build/dev/javascript/simplifile/simplifile.erl +893 -0
- package/build/dev/javascript/simplifile/simplifile.mjs +893 -0
- package/build/dev/javascript/simplifile/simplifile_erl.erl +244 -0
- package/build/dev/javascript/simplifile/simplifile_js.mjs +400 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/cli_test.mjs +461 -0
- package/build/dev/javascript/skillc/compiler_test.mjs +3089 -0
- package/build/dev/javascript/skillc/config_test.mjs +308 -0
- package/build/dev/javascript/skillc/gleam.main.mjs +2 -0
- package/build/dev/javascript/skillc/gleam.mjs +1 -0
- package/build/dev/javascript/skillc/importer_test.mjs +1643 -0
- package/build/dev/javascript/skillc/parser_test.mjs +1601 -0
- package/build/dev/javascript/skillc/path_test.mjs +26 -0
- package/build/dev/javascript/skillc/provider_test.mjs +221 -0
- package/build/dev/javascript/skillc/registry_test.mjs +359 -0
- package/build/dev/javascript/skillc/scaffold_test.mjs +405 -0
- package/build/dev/javascript/skillc/skillc/compiler.mjs +724 -0
- package/build/dev/javascript/skillc/skillc/config.mjs +172 -0
- package/build/dev/javascript/skillc/skillc/error.mjs +145 -0
- package/build/dev/javascript/skillc/skillc/fs.mjs +40 -0
- package/build/dev/javascript/skillc/skillc/importer.mjs +975 -0
- package/build/dev/javascript/skillc/skillc/parser.mjs +427 -0
- package/build/dev/javascript/skillc/skillc/path.mjs +52 -0
- package/build/dev/javascript/skillc/skillc/platform.mjs +44 -0
- package/build/dev/javascript/skillc/skillc/provider.mjs +86 -0
- package/build/dev/javascript/skillc/skillc/registry.mjs +701 -0
- package/build/dev/javascript/skillc/skillc/scaffold.mjs +117 -0
- package/build/dev/javascript/skillc/skillc/semver.mjs +293 -0
- package/build/dev/javascript/skillc/skillc/shell.mjs +14 -0
- package/build/dev/javascript/skillc/skillc/template.mjs +1177 -0
- package/build/dev/javascript/skillc/skillc/types.mjs +249 -0
- package/build/dev/javascript/skillc/skillc/version_constraint.mjs +290 -0
- package/build/dev/javascript/skillc/skillc/yaml.mjs +51 -0
- package/build/dev/javascript/skillc/skillc.mjs +873 -0
- package/build/dev/javascript/skillc/skillc_ffi.mjs +30 -0
- package/build/dev/javascript/skillc/skillc_test.mjs +5 -0
- package/build/dev/javascript/skillc/template_test.mjs +1638 -0
- package/build/dev/javascript/skillc/version_constraint_test.mjs +1325 -0
- package/build/dev/javascript/yay/_gleam_artefacts/yay.cache +0 -0
- package/build/dev/javascript/yay/_gleam_artefacts/yay.cache_inline +0 -0
- package/build/dev/javascript/yay/_gleam_artefacts/yay.cache_meta +0 -0
- package/build/dev/javascript/yay/gleam.mjs +1 -0
- package/build/dev/javascript/yay/yaml_ffi.erl +106 -0
- package/build/dev/javascript/yay/yaml_ffi.mjs +373 -0
- package/build/dev/javascript/yay/yay.erl +1218 -0
- package/build/dev/javascript/yay/yay.mjs +1403 -0
- package/package.json +28 -0
- package/src/skillc/compiler.gleam +561 -0
- package/src/skillc/config.gleam +91 -0
- package/src/skillc/error.gleam +37 -0
- package/src/skillc/fs.gleam +31 -0
- package/src/skillc/importer.gleam +709 -0
- package/src/skillc/parser.gleam +279 -0
- package/src/skillc/path.gleam +30 -0
- package/src/skillc/platform.gleam +25 -0
- package/src/skillc/provider.gleam +58 -0
- package/src/skillc/registry.gleam +472 -0
- package/src/skillc/scaffold.gleam +112 -0
- package/src/skillc/semver.gleam +165 -0
- package/src/skillc/shell.gleam +12 -0
- package/src/skillc/template.gleam +885 -0
- package/src/skillc/types.gleam +93 -0
- package/src/skillc/version_constraint.gleam +163 -0
- package/src/skillc/yaml.gleam +27 -0
- package/src/skillc.gleam +466 -0
- package/src/skillc_ffi.mjs +30 -0
|
@@ -0,0 +1,975 @@
|
|
|
1
|
+
import * as $int from "../../gleam_stdlib/gleam/int.mjs";
|
|
2
|
+
import * as $list from "../../gleam_stdlib/gleam/list.mjs";
|
|
3
|
+
import * as $option from "../../gleam_stdlib/gleam/option.mjs";
|
|
4
|
+
import { None, Some } from "../../gleam_stdlib/gleam/option.mjs";
|
|
5
|
+
import * as $result from "../../gleam_stdlib/gleam/result.mjs";
|
|
6
|
+
import * as $string from "../../gleam_stdlib/gleam/string.mjs";
|
|
7
|
+
import * as $simplifile from "../../simplifile/simplifile.mjs";
|
|
8
|
+
import {
|
|
9
|
+
Ok,
|
|
10
|
+
Error,
|
|
11
|
+
toList,
|
|
12
|
+
Empty as $Empty,
|
|
13
|
+
prepend as listPrepend,
|
|
14
|
+
CustomType as $CustomType,
|
|
15
|
+
} from "../gleam.mjs";
|
|
16
|
+
import * as $error from "../skillc/error.mjs";
|
|
17
|
+
import { ImportError, map_file_error } from "../skillc/error.mjs";
|
|
18
|
+
import * as $fs from "../skillc/fs.mjs";
|
|
19
|
+
import * as $path from "../skillc/path.mjs";
|
|
20
|
+
import * as $platform from "../skillc/platform.mjs";
|
|
21
|
+
import * as $semver from "../skillc/semver.mjs";
|
|
22
|
+
import * as $shell from "../skillc/shell.mjs";
|
|
23
|
+
import * as $types from "../skillc/types.mjs";
|
|
24
|
+
import { ClaudeCode, Codex, FileCopy, OpenClaw } from "../skillc/types.mjs";
|
|
25
|
+
import * as $yaml from "../skillc/yaml.mjs";
|
|
26
|
+
|
|
27
|
+
export class FrontmatterPair extends $CustomType {
|
|
28
|
+
constructor(key, value) {
|
|
29
|
+
super();
|
|
30
|
+
this.key = key;
|
|
31
|
+
this.value = value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export const FrontmatterPair$FrontmatterPair = (key, value) =>
|
|
35
|
+
new FrontmatterPair(key, value);
|
|
36
|
+
export const FrontmatterPair$isFrontmatterPair = (value) =>
|
|
37
|
+
value instanceof FrontmatterPair;
|
|
38
|
+
export const FrontmatterPair$FrontmatterPair$key = (value) => value.key;
|
|
39
|
+
export const FrontmatterPair$FrontmatterPair$0 = (value) => value.key;
|
|
40
|
+
export const FrontmatterPair$FrontmatterPair$value = (value) => value.value;
|
|
41
|
+
export const FrontmatterPair$FrontmatterPair$1 = (value) => value.value;
|
|
42
|
+
|
|
43
|
+
export class Frontmatter extends $CustomType {
|
|
44
|
+
constructor(pairs, body) {
|
|
45
|
+
super();
|
|
46
|
+
this.pairs = pairs;
|
|
47
|
+
this.body = body;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export const Frontmatter$Frontmatter = (pairs, body) =>
|
|
51
|
+
new Frontmatter(pairs, body);
|
|
52
|
+
export const Frontmatter$isFrontmatter = (value) =>
|
|
53
|
+
value instanceof Frontmatter;
|
|
54
|
+
export const Frontmatter$Frontmatter$pairs = (value) => value.pairs;
|
|
55
|
+
export const Frontmatter$Frontmatter$0 = (value) => value.pairs;
|
|
56
|
+
export const Frontmatter$Frontmatter$body = (value) => value.body;
|
|
57
|
+
export const Frontmatter$Frontmatter$1 = (value) => value.body;
|
|
58
|
+
|
|
59
|
+
export class UniversalFields extends $CustomType {
|
|
60
|
+
constructor(name, description, version, license) {
|
|
61
|
+
super();
|
|
62
|
+
this.name = name;
|
|
63
|
+
this.description = description;
|
|
64
|
+
this.version = version;
|
|
65
|
+
this.license = license;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export const UniversalFields$UniversalFields = (name, description, version, license) =>
|
|
69
|
+
new UniversalFields(name, description, version, license);
|
|
70
|
+
export const UniversalFields$isUniversalFields = (value) =>
|
|
71
|
+
value instanceof UniversalFields;
|
|
72
|
+
export const UniversalFields$UniversalFields$name = (value) => value.name;
|
|
73
|
+
export const UniversalFields$UniversalFields$0 = (value) => value.name;
|
|
74
|
+
export const UniversalFields$UniversalFields$description = (value) =>
|
|
75
|
+
value.description;
|
|
76
|
+
export const UniversalFields$UniversalFields$1 = (value) => value.description;
|
|
77
|
+
export const UniversalFields$UniversalFields$version = (value) => value.version;
|
|
78
|
+
export const UniversalFields$UniversalFields$2 = (value) => value.version;
|
|
79
|
+
export const UniversalFields$UniversalFields$license = (value) => value.license;
|
|
80
|
+
export const UniversalFields$UniversalFields$3 = (value) => value.license;
|
|
81
|
+
|
|
82
|
+
export class SeparatedFields extends $CustomType {
|
|
83
|
+
constructor(universal, provider) {
|
|
84
|
+
super();
|
|
85
|
+
this.universal = universal;
|
|
86
|
+
this.provider = provider;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export const SeparatedFields$SeparatedFields = (universal, provider) =>
|
|
90
|
+
new SeparatedFields(universal, provider);
|
|
91
|
+
export const SeparatedFields$isSeparatedFields = (value) =>
|
|
92
|
+
value instanceof SeparatedFields;
|
|
93
|
+
export const SeparatedFields$SeparatedFields$universal = (value) =>
|
|
94
|
+
value.universal;
|
|
95
|
+
export const SeparatedFields$SeparatedFields$0 = (value) => value.universal;
|
|
96
|
+
export const SeparatedFields$SeparatedFields$provider = (value) =>
|
|
97
|
+
value.provider;
|
|
98
|
+
export const SeparatedFields$SeparatedFields$1 = (value) => value.provider;
|
|
99
|
+
|
|
100
|
+
export class SourceDirectory extends $CustomType {
|
|
101
|
+
constructor(path) {
|
|
102
|
+
super();
|
|
103
|
+
this.path = path;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export const ResolvedSource$SourceDirectory = (path) =>
|
|
107
|
+
new SourceDirectory(path);
|
|
108
|
+
export const ResolvedSource$isSourceDirectory = (value) =>
|
|
109
|
+
value instanceof SourceDirectory;
|
|
110
|
+
export const ResolvedSource$SourceDirectory$path = (value) => value.path;
|
|
111
|
+
export const ResolvedSource$SourceDirectory$0 = (value) => value.path;
|
|
112
|
+
|
|
113
|
+
export class SourceFile extends $CustomType {
|
|
114
|
+
constructor(path, directory) {
|
|
115
|
+
super();
|
|
116
|
+
this.path = path;
|
|
117
|
+
this.directory = directory;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export const ResolvedSource$SourceFile = (path, directory) =>
|
|
121
|
+
new SourceFile(path, directory);
|
|
122
|
+
export const ResolvedSource$isSourceFile = (value) =>
|
|
123
|
+
value instanceof SourceFile;
|
|
124
|
+
export const ResolvedSource$SourceFile$path = (value) => value.path;
|
|
125
|
+
export const ResolvedSource$SourceFile$0 = (value) => value.path;
|
|
126
|
+
export const ResolvedSource$SourceFile$directory = (value) => value.directory;
|
|
127
|
+
export const ResolvedSource$SourceFile$1 = (value) => value.directory;
|
|
128
|
+
|
|
129
|
+
export const ResolvedSource$path = (value) => value.path;
|
|
130
|
+
|
|
131
|
+
export class ImportResult extends $CustomType {
|
|
132
|
+
constructor(provider, skill_yaml, instructions_md, metadata_yaml, scripts, assets) {
|
|
133
|
+
super();
|
|
134
|
+
this.provider = provider;
|
|
135
|
+
this.skill_yaml = skill_yaml;
|
|
136
|
+
this.instructions_md = instructions_md;
|
|
137
|
+
this.metadata_yaml = metadata_yaml;
|
|
138
|
+
this.scripts = scripts;
|
|
139
|
+
this.assets = assets;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export const ImportResult$ImportResult = (provider, skill_yaml, instructions_md, metadata_yaml, scripts, assets) =>
|
|
143
|
+
new ImportResult(provider,
|
|
144
|
+
skill_yaml,
|
|
145
|
+
instructions_md,
|
|
146
|
+
metadata_yaml,
|
|
147
|
+
scripts,
|
|
148
|
+
assets);
|
|
149
|
+
export const ImportResult$isImportResult = (value) =>
|
|
150
|
+
value instanceof ImportResult;
|
|
151
|
+
export const ImportResult$ImportResult$provider = (value) => value.provider;
|
|
152
|
+
export const ImportResult$ImportResult$0 = (value) => value.provider;
|
|
153
|
+
export const ImportResult$ImportResult$skill_yaml = (value) => value.skill_yaml;
|
|
154
|
+
export const ImportResult$ImportResult$1 = (value) => value.skill_yaml;
|
|
155
|
+
export const ImportResult$ImportResult$instructions_md = (value) =>
|
|
156
|
+
value.instructions_md;
|
|
157
|
+
export const ImportResult$ImportResult$2 = (value) => value.instructions_md;
|
|
158
|
+
export const ImportResult$ImportResult$metadata_yaml = (value) =>
|
|
159
|
+
value.metadata_yaml;
|
|
160
|
+
export const ImportResult$ImportResult$3 = (value) => value.metadata_yaml;
|
|
161
|
+
export const ImportResult$ImportResult$scripts = (value) => value.scripts;
|
|
162
|
+
export const ImportResult$ImportResult$4 = (value) => value.scripts;
|
|
163
|
+
export const ImportResult$ImportResult$assets = (value) => value.assets;
|
|
164
|
+
export const ImportResult$ImportResult$5 = (value) => value.assets;
|
|
165
|
+
|
|
166
|
+
function find_closing_fence_loop(loop$lines, loop$acc) {
|
|
167
|
+
while (true) {
|
|
168
|
+
let lines = loop$lines;
|
|
169
|
+
let acc = loop$acc;
|
|
170
|
+
if (lines instanceof $Empty) {
|
|
171
|
+
return new Error(undefined);
|
|
172
|
+
} else {
|
|
173
|
+
let line = lines.head;
|
|
174
|
+
let rest = lines.tail;
|
|
175
|
+
let $ = $string.trim(line) === "---";
|
|
176
|
+
if ($) {
|
|
177
|
+
let yaml = $string.join($list.reverse(acc), "\n");
|
|
178
|
+
let _block;
|
|
179
|
+
if (rest instanceof $Empty) {
|
|
180
|
+
_block = "";
|
|
181
|
+
} else {
|
|
182
|
+
_block = $string.join(rest, "\n");
|
|
183
|
+
}
|
|
184
|
+
let body = _block;
|
|
185
|
+
let _block$1;
|
|
186
|
+
let $1 = $string.starts_with(body, "\n");
|
|
187
|
+
if ($1) {
|
|
188
|
+
_block$1 = $string.drop_start(body, 1);
|
|
189
|
+
} else {
|
|
190
|
+
_block$1 = body;
|
|
191
|
+
}
|
|
192
|
+
let body$1 = _block$1;
|
|
193
|
+
return new Ok([yaml, body$1]);
|
|
194
|
+
} else {
|
|
195
|
+
loop$lines = rest;
|
|
196
|
+
loop$acc = listPrepend(line, acc);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Find closing --- fence. Returns (yaml_content, body_after_fence).
|
|
204
|
+
*
|
|
205
|
+
* @ignore
|
|
206
|
+
*/
|
|
207
|
+
function find_closing_fence(content) {
|
|
208
|
+
let lines = $string.split(content, "\n");
|
|
209
|
+
return find_closing_fence_loop(lines, toList([]));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function split_key_value(line) {
|
|
213
|
+
let $ = $string.split_once(line, ":");
|
|
214
|
+
if ($ instanceof Ok) {
|
|
215
|
+
let key = $[0][0];
|
|
216
|
+
let value = $[0][1];
|
|
217
|
+
return [$string.trim(key), value];
|
|
218
|
+
} else {
|
|
219
|
+
return [line, ""];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function collect_indented(loop$lines, loop$acc) {
|
|
224
|
+
while (true) {
|
|
225
|
+
let lines = loop$lines;
|
|
226
|
+
let acc = loop$acc;
|
|
227
|
+
if (lines instanceof $Empty) {
|
|
228
|
+
return [acc, toList([])];
|
|
229
|
+
} else {
|
|
230
|
+
let line = lines.head;
|
|
231
|
+
let rest = lines.tail;
|
|
232
|
+
let $ = $string.starts_with(line, " ") || $string.starts_with(line, "\t");
|
|
233
|
+
if ($) {
|
|
234
|
+
loop$lines = rest;
|
|
235
|
+
loop$acc = listPrepend(line, acc);
|
|
236
|
+
} else {
|
|
237
|
+
let $1 = $string.trim(line);
|
|
238
|
+
if ($1 === "") {
|
|
239
|
+
loop$lines = rest;
|
|
240
|
+
loop$acc = acc;
|
|
241
|
+
} else {
|
|
242
|
+
return [acc, listPrepend(line, rest)];
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function parse_yaml_lines(loop$lines, loop$acc) {
|
|
250
|
+
while (true) {
|
|
251
|
+
let lines = loop$lines;
|
|
252
|
+
let acc = loop$acc;
|
|
253
|
+
if (lines instanceof $Empty) {
|
|
254
|
+
return $list.reverse(acc);
|
|
255
|
+
} else {
|
|
256
|
+
let line = lines.head;
|
|
257
|
+
let rest = lines.tail;
|
|
258
|
+
let $ = $string.trim(line);
|
|
259
|
+
if ($ === "") {
|
|
260
|
+
loop$lines = rest;
|
|
261
|
+
loop$acc = acc;
|
|
262
|
+
} else {
|
|
263
|
+
let $1 = $string.contains(line, ":") && !$string.starts_with(line, " ");
|
|
264
|
+
if ($1) {
|
|
265
|
+
let $2 = split_key_value(line);
|
|
266
|
+
let key;
|
|
267
|
+
let value;
|
|
268
|
+
key = $2[0];
|
|
269
|
+
value = $2[1];
|
|
270
|
+
let trimmed_value = $string.trim(value);
|
|
271
|
+
if (trimmed_value === "") {
|
|
272
|
+
let $3 = collect_indented(rest, toList([]));
|
|
273
|
+
let block_lines;
|
|
274
|
+
let remaining;
|
|
275
|
+
block_lines = $3[0];
|
|
276
|
+
remaining = $3[1];
|
|
277
|
+
let block_value = $string.join($list.reverse(block_lines), "\n");
|
|
278
|
+
loop$lines = remaining;
|
|
279
|
+
loop$acc = listPrepend(new FrontmatterPair(key, block_value), acc);
|
|
280
|
+
} else {
|
|
281
|
+
loop$lines = rest;
|
|
282
|
+
loop$acc = listPrepend(new FrontmatterPair(key, trimmed_value), acc);
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
loop$lines = rest;
|
|
286
|
+
loop$acc = acc;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Parse a YAML frontmatter block into key-value pairs.
|
|
295
|
+
*
|
|
296
|
+
* @ignore
|
|
297
|
+
*/
|
|
298
|
+
function parse_yaml_pairs(yaml) {
|
|
299
|
+
let lines = $string.split(yaml, "\n");
|
|
300
|
+
return parse_yaml_lines(lines, toList([]));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Split a SKILL.md into YAML frontmatter key-value pairs and the body markdown.
|
|
305
|
+
*/
|
|
306
|
+
export function parse_frontmatter(content) {
|
|
307
|
+
let trimmed = $string.trim_start(content);
|
|
308
|
+
let $ = $string.starts_with(trimmed, "---");
|
|
309
|
+
if ($) {
|
|
310
|
+
let after_open = $string.drop_start(trimmed, 3);
|
|
311
|
+
let _block;
|
|
312
|
+
let $1 = $string.starts_with(after_open, "\n");
|
|
313
|
+
if ($1) {
|
|
314
|
+
_block = $string.drop_start(after_open, 1);
|
|
315
|
+
} else {
|
|
316
|
+
_block = after_open;
|
|
317
|
+
}
|
|
318
|
+
let after_open$1 = _block;
|
|
319
|
+
let $2 = find_closing_fence(after_open$1);
|
|
320
|
+
if ($2 instanceof Ok) {
|
|
321
|
+
let yaml_block = $2[0][0];
|
|
322
|
+
let body = $2[0][1];
|
|
323
|
+
let pairs = parse_yaml_pairs(yaml_block);
|
|
324
|
+
return new Ok(new Frontmatter(pairs, body));
|
|
325
|
+
} else {
|
|
326
|
+
return new Error(
|
|
327
|
+
new ImportError(
|
|
328
|
+
"SKILL.md",
|
|
329
|
+
"Unclosed YAML frontmatter (missing closing ---)",
|
|
330
|
+
),
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
return new Error(
|
|
335
|
+
new ImportError(
|
|
336
|
+
"SKILL.md",
|
|
337
|
+
"No YAML frontmatter found (expected opening ---)",
|
|
338
|
+
),
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Heuristic provider auto-detection from frontmatter keys and directory.
|
|
345
|
+
*/
|
|
346
|
+
export function detect_provider(pairs, source_dir) {
|
|
347
|
+
let keys = $list.map(pairs, (pair) => { return pair.key; });
|
|
348
|
+
let has_openclaw = $list.any(
|
|
349
|
+
keys,
|
|
350
|
+
(k) => { return $string.starts_with(k, "metadata.openclaw"); },
|
|
351
|
+
);
|
|
352
|
+
if (has_openclaw) {
|
|
353
|
+
return new Ok(new OpenClaw());
|
|
354
|
+
} else {
|
|
355
|
+
let claude_code_keys = toList([
|
|
356
|
+
"user-invocable",
|
|
357
|
+
"allowed-tools",
|
|
358
|
+
"disable-model-invocation",
|
|
359
|
+
]);
|
|
360
|
+
let has_claude_code = $list.any(
|
|
361
|
+
keys,
|
|
362
|
+
(k) => { return $list.contains(claude_code_keys, k); },
|
|
363
|
+
);
|
|
364
|
+
if (has_claude_code) {
|
|
365
|
+
return new Ok(new ClaudeCode());
|
|
366
|
+
} else {
|
|
367
|
+
let $ = $simplifile.is_file(source_dir + "/agents/openai.yaml");
|
|
368
|
+
if ($ instanceof Ok) {
|
|
369
|
+
let $1 = $[0];
|
|
370
|
+
if ($1) {
|
|
371
|
+
return new Ok(new Codex());
|
|
372
|
+
} else {
|
|
373
|
+
return new Error(
|
|
374
|
+
new ImportError(
|
|
375
|
+
"detect",
|
|
376
|
+
"Cannot auto-detect provider. Pass --provider openclaw|claude-code|codex",
|
|
377
|
+
),
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
return new Error(
|
|
382
|
+
new ImportError(
|
|
383
|
+
"detect",
|
|
384
|
+
"Cannot auto-detect provider. Pass --provider openclaw|claude-code|codex",
|
|
385
|
+
),
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function find_pair_value(pairs, key) {
|
|
393
|
+
let $ = $list.find(pairs, (pair) => { return pair.key === key; });
|
|
394
|
+
if ($ instanceof Ok) {
|
|
395
|
+
let value = $[0].value;
|
|
396
|
+
return new Some(value);
|
|
397
|
+
} else {
|
|
398
|
+
return new None();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Require that an optional value is present and non-empty.
|
|
404
|
+
*
|
|
405
|
+
* @ignore
|
|
406
|
+
*/
|
|
407
|
+
function require_non_empty(value, field) {
|
|
408
|
+
if (value instanceof Some) {
|
|
409
|
+
let s = value[0];
|
|
410
|
+
let $ = $string.trim(s);
|
|
411
|
+
if ($ === "") {
|
|
412
|
+
return new Error(
|
|
413
|
+
new ImportError(
|
|
414
|
+
field,
|
|
415
|
+
("Required field '" + field) + "' must not be empty",
|
|
416
|
+
),
|
|
417
|
+
);
|
|
418
|
+
} else {
|
|
419
|
+
return new Ok(s);
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
return new Error(
|
|
423
|
+
new ImportError(
|
|
424
|
+
field,
|
|
425
|
+
("Required field '" + field) + "' is missing from frontmatter",
|
|
426
|
+
),
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Remove surrounding quotes from a YAML string value.
|
|
433
|
+
*
|
|
434
|
+
* @ignore
|
|
435
|
+
*/
|
|
436
|
+
function unquote_yaml_string(s) {
|
|
437
|
+
let trimmed = $string.trim(s);
|
|
438
|
+
let $ = $string.starts_with(trimmed, "\"") && $string.ends_with(trimmed, "\"");
|
|
439
|
+
if ($) {
|
|
440
|
+
let _block;
|
|
441
|
+
let _pipe = trimmed;
|
|
442
|
+
let _pipe$1 = $string.drop_start(_pipe, 1);
|
|
443
|
+
_block = $string.drop_end(_pipe$1, 1);
|
|
444
|
+
let inner = _block;
|
|
445
|
+
let inner$1 = $string.replace(inner, "\\n", "\n");
|
|
446
|
+
let inner$2 = $string.replace(inner$1, "\\\"", "\"");
|
|
447
|
+
return $string.replace(inner$2, "\\\\", "\\");
|
|
448
|
+
} else {
|
|
449
|
+
let $1 = $string.starts_with(trimmed, "'") && $string.ends_with(
|
|
450
|
+
trimmed,
|
|
451
|
+
"'",
|
|
452
|
+
);
|
|
453
|
+
if ($1) {
|
|
454
|
+
let _pipe = trimmed;
|
|
455
|
+
let _pipe$1 = $string.drop_start(_pipe, 1);
|
|
456
|
+
return $string.drop_end(_pipe$1, 1);
|
|
457
|
+
} else {
|
|
458
|
+
return trimmed;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function collect_sub_indented(loop$lines, loop$base_indent, loop$acc) {
|
|
464
|
+
while (true) {
|
|
465
|
+
let lines = loop$lines;
|
|
466
|
+
let base_indent = loop$base_indent;
|
|
467
|
+
let acc = loop$acc;
|
|
468
|
+
if (lines instanceof $Empty) {
|
|
469
|
+
return [acc, toList([])];
|
|
470
|
+
} else {
|
|
471
|
+
let line = lines.head;
|
|
472
|
+
let rest = lines.tail;
|
|
473
|
+
let stripped = $string.trim_start(line);
|
|
474
|
+
let line_indent = $string.length(line) - $string.length(stripped);
|
|
475
|
+
let $ = $string.trim(line);
|
|
476
|
+
if ($ === "") {
|
|
477
|
+
loop$lines = rest;
|
|
478
|
+
loop$base_indent = base_indent;
|
|
479
|
+
loop$acc = acc;
|
|
480
|
+
} else {
|
|
481
|
+
let $1 = line_indent > base_indent;
|
|
482
|
+
if ($1) {
|
|
483
|
+
let trimmed_line = $string.drop_start(line, base_indent + 2);
|
|
484
|
+
loop$lines = rest;
|
|
485
|
+
loop$base_indent = base_indent;
|
|
486
|
+
loop$acc = listPrepend(trimmed_line, acc);
|
|
487
|
+
} else {
|
|
488
|
+
return [acc, listPrepend(line, rest)];
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function parse_openclaw_lines(loop$lines, loop$acc) {
|
|
496
|
+
while (true) {
|
|
497
|
+
let lines = loop$lines;
|
|
498
|
+
let acc = loop$acc;
|
|
499
|
+
if (lines instanceof $Empty) {
|
|
500
|
+
return $list.reverse(acc);
|
|
501
|
+
} else {
|
|
502
|
+
let line = lines.head;
|
|
503
|
+
let rest = lines.tail;
|
|
504
|
+
let stripped = $string.trim_start(line);
|
|
505
|
+
let $ = $string.trim(stripped);
|
|
506
|
+
if ($ === "") {
|
|
507
|
+
loop$lines = rest;
|
|
508
|
+
loop$acc = acc;
|
|
509
|
+
} else {
|
|
510
|
+
let $1 = $string.contains(stripped, ":");
|
|
511
|
+
if ($1) {
|
|
512
|
+
let $2 = split_key_value(stripped);
|
|
513
|
+
let key;
|
|
514
|
+
let value;
|
|
515
|
+
key = $2[0];
|
|
516
|
+
value = $2[1];
|
|
517
|
+
let trimmed_value = $string.trim(value);
|
|
518
|
+
if (trimmed_value === "") {
|
|
519
|
+
let base_indent = $string.length(line) - $string.length(stripped);
|
|
520
|
+
let $3 = collect_sub_indented(rest, base_indent, toList([]));
|
|
521
|
+
let block_lines;
|
|
522
|
+
let remaining;
|
|
523
|
+
block_lines = $3[0];
|
|
524
|
+
remaining = $3[1];
|
|
525
|
+
let block_value = $string.join($list.reverse(block_lines), "\n");
|
|
526
|
+
loop$lines = remaining;
|
|
527
|
+
loop$acc = listPrepend(new FrontmatterPair(key, block_value), acc);
|
|
528
|
+
} else {
|
|
529
|
+
loop$lines = rest;
|
|
530
|
+
loop$acc = listPrepend(new FrontmatterPair(key, trimmed_value), acc);
|
|
531
|
+
}
|
|
532
|
+
} else {
|
|
533
|
+
loop$lines = rest;
|
|
534
|
+
loop$acc = acc;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Parse the indented block under metadata.openclaw: into key-value pairs.
|
|
543
|
+
*
|
|
544
|
+
* @ignore
|
|
545
|
+
*/
|
|
546
|
+
function parse_openclaw_block(block) {
|
|
547
|
+
let lines = $string.split(block, "\n");
|
|
548
|
+
return parse_openclaw_lines(lines, toList([]));
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Classify each frontmatter key as universal or provider-specific.
|
|
553
|
+
* Returns an error if required fields (name, description, version) are missing.
|
|
554
|
+
*/
|
|
555
|
+
export function separate_fields(pairs, provider) {
|
|
556
|
+
let universal_keys = toList(["name", "description", "version", "license"]);
|
|
557
|
+
return $result.try$(
|
|
558
|
+
(() => {
|
|
559
|
+
let _pipe = find_pair_value(pairs, "name");
|
|
560
|
+
let _pipe$1 = $option.map(_pipe, unquote_yaml_string);
|
|
561
|
+
return require_non_empty(_pipe$1, "name");
|
|
562
|
+
})(),
|
|
563
|
+
(name) => {
|
|
564
|
+
return $result.try$(
|
|
565
|
+
(() => {
|
|
566
|
+
let _pipe = find_pair_value(pairs, "description");
|
|
567
|
+
let _pipe$1 = $option.map(_pipe, unquote_yaml_string);
|
|
568
|
+
return require_non_empty(_pipe$1, "description");
|
|
569
|
+
})(),
|
|
570
|
+
(description) => {
|
|
571
|
+
return $result.try$(
|
|
572
|
+
(() => {
|
|
573
|
+
let _pipe = find_pair_value(pairs, "version");
|
|
574
|
+
let _pipe$1 = $option.map(_pipe, unquote_yaml_string);
|
|
575
|
+
return require_non_empty(_pipe$1, "version");
|
|
576
|
+
})(),
|
|
577
|
+
(version) => {
|
|
578
|
+
return $result.try$(
|
|
579
|
+
(() => {
|
|
580
|
+
let _pipe = $semver.parse(version);
|
|
581
|
+
return $result.map_error(
|
|
582
|
+
_pipe,
|
|
583
|
+
(_) => {
|
|
584
|
+
return new ImportError(
|
|
585
|
+
"version",
|
|
586
|
+
"Invalid version format: " + version,
|
|
587
|
+
);
|
|
588
|
+
},
|
|
589
|
+
);
|
|
590
|
+
})(),
|
|
591
|
+
(version) => {
|
|
592
|
+
let _block;
|
|
593
|
+
let _pipe = find_pair_value(pairs, "license");
|
|
594
|
+
_block = $option.map(_pipe, unquote_yaml_string);
|
|
595
|
+
let license = _block;
|
|
596
|
+
let universal = new UniversalFields(
|
|
597
|
+
name,
|
|
598
|
+
description,
|
|
599
|
+
version,
|
|
600
|
+
license,
|
|
601
|
+
);
|
|
602
|
+
let _block$1;
|
|
603
|
+
if (provider instanceof OpenClaw) {
|
|
604
|
+
let $ = find_pair_value(pairs, "metadata.openclaw");
|
|
605
|
+
if ($ instanceof Some) {
|
|
606
|
+
let block = $[0];
|
|
607
|
+
_block$1 = parse_openclaw_block(block);
|
|
608
|
+
} else {
|
|
609
|
+
_block$1 = $list.filter(
|
|
610
|
+
pairs,
|
|
611
|
+
(pair) => {
|
|
612
|
+
return !$list.contains(universal_keys, pair.key) && !$string.starts_with(
|
|
613
|
+
pair.key,
|
|
614
|
+
"metadata.openclaw",
|
|
615
|
+
);
|
|
616
|
+
},
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
} else {
|
|
620
|
+
_block$1 = $list.filter(
|
|
621
|
+
pairs,
|
|
622
|
+
(pair) => {
|
|
623
|
+
return !$list.contains(universal_keys, pair.key);
|
|
624
|
+
},
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
let provider_pairs = _block$1;
|
|
628
|
+
return new Ok(new SeparatedFields(universal, provider_pairs));
|
|
629
|
+
},
|
|
630
|
+
);
|
|
631
|
+
},
|
|
632
|
+
);
|
|
633
|
+
},
|
|
634
|
+
);
|
|
635
|
+
},
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Generate skill.yaml content from universal fields.
|
|
641
|
+
*/
|
|
642
|
+
export function generate_skill_yaml(fields) {
|
|
643
|
+
let lines = toList([
|
|
644
|
+
"name: " + $yaml.quote_string(fields.name),
|
|
645
|
+
"description: " + $yaml.quote_string(fields.description),
|
|
646
|
+
"version: " + $semver.to_string(fields.version),
|
|
647
|
+
]);
|
|
648
|
+
let _block;
|
|
649
|
+
let $ = fields.license;
|
|
650
|
+
if ($ instanceof Some) {
|
|
651
|
+
let l = $[0];
|
|
652
|
+
_block = $list.append(lines, toList(["license: " + $yaml.quote_string(l)]));
|
|
653
|
+
} else {
|
|
654
|
+
_block = lines;
|
|
655
|
+
}
|
|
656
|
+
let lines$1 = _block;
|
|
657
|
+
return $string.join(lines$1, "\n") + "\n";
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
function indent_block(block, spaces) {
|
|
661
|
+
let prefix = $string.repeat(" ", spaces);
|
|
662
|
+
let lines = $string.split(block, "\n");
|
|
663
|
+
let _pipe = $list.map(
|
|
664
|
+
lines,
|
|
665
|
+
(line) => {
|
|
666
|
+
let $ = $string.trim(line);
|
|
667
|
+
if ($ === "") {
|
|
668
|
+
return $;
|
|
669
|
+
} else {
|
|
670
|
+
return prefix + line;
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
);
|
|
674
|
+
return $string.join(_pipe, "\n");
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function format_pairs_as_yaml(pairs) {
|
|
678
|
+
if (pairs instanceof $Empty) {
|
|
679
|
+
return "";
|
|
680
|
+
} else {
|
|
681
|
+
let lines = $list.map(
|
|
682
|
+
pairs,
|
|
683
|
+
(pair) => {
|
|
684
|
+
let $ = $string.contains(pair.value, "\n");
|
|
685
|
+
if ($) {
|
|
686
|
+
return (pair.key + ":\n") + indent_block(pair.value, 2);
|
|
687
|
+
} else {
|
|
688
|
+
return (pair.key + ": ") + pair.value;
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
);
|
|
692
|
+
return $string.join(lines, "\n") + "\n";
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Generate metadata.yaml content from provider-specific pairs.
|
|
698
|
+
* For Codex, uses pre-read agents/openai.yaml content if available.
|
|
699
|
+
*/
|
|
700
|
+
export function generate_metadata_yaml(provider_pairs, codex_yaml) {
|
|
701
|
+
if (codex_yaml instanceof Some) {
|
|
702
|
+
let content = codex_yaml[0];
|
|
703
|
+
return content;
|
|
704
|
+
} else {
|
|
705
|
+
return format_pairs_as_yaml(provider_pairs);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
function resolve_local(source) {
|
|
710
|
+
let $ = $simplifile.is_file(source);
|
|
711
|
+
if ($ instanceof Ok) {
|
|
712
|
+
let $1 = $[0];
|
|
713
|
+
if ($1) {
|
|
714
|
+
return new Ok(new SourceFile(source, $path.parent_dir(source)));
|
|
715
|
+
} else {
|
|
716
|
+
return new Ok(new SourceDirectory(source));
|
|
717
|
+
}
|
|
718
|
+
} else {
|
|
719
|
+
return new Ok(new SourceDirectory(source));
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Extract the directory path from a resolved source.
|
|
725
|
+
*
|
|
726
|
+
* @ignore
|
|
727
|
+
*/
|
|
728
|
+
function resolved_directory(source) {
|
|
729
|
+
if (source instanceof SourceDirectory) {
|
|
730
|
+
let path = source.path;
|
|
731
|
+
return path;
|
|
732
|
+
} else {
|
|
733
|
+
let directory = source.directory;
|
|
734
|
+
return directory;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
function do_emit_imported(import_result, output_dir) {
|
|
739
|
+
let provider_str = $types.provider_to_string(import_result.provider);
|
|
740
|
+
let provider_dir = (output_dir + "/providers/") + provider_str;
|
|
741
|
+
return $result.try$(
|
|
742
|
+
(() => {
|
|
743
|
+
let _pipe = $simplifile.create_directory_all(provider_dir);
|
|
744
|
+
return map_file_error(_pipe, provider_dir);
|
|
745
|
+
})(),
|
|
746
|
+
(_) => {
|
|
747
|
+
return $result.try$(
|
|
748
|
+
(() => {
|
|
749
|
+
let _pipe = $simplifile.write(
|
|
750
|
+
output_dir + "/skill.yaml",
|
|
751
|
+
import_result.skill_yaml,
|
|
752
|
+
);
|
|
753
|
+
return map_file_error(_pipe, output_dir + "/skill.yaml");
|
|
754
|
+
})(),
|
|
755
|
+
(_) => {
|
|
756
|
+
return $result.try$(
|
|
757
|
+
(() => {
|
|
758
|
+
let _pipe = $simplifile.write(
|
|
759
|
+
output_dir + "/INSTRUCTIONS.md",
|
|
760
|
+
import_result.instructions_md,
|
|
761
|
+
);
|
|
762
|
+
return map_file_error(_pipe, output_dir + "/INSTRUCTIONS.md");
|
|
763
|
+
})(),
|
|
764
|
+
(_) => {
|
|
765
|
+
return $result.try$(
|
|
766
|
+
(() => {
|
|
767
|
+
let _pipe = $simplifile.write(
|
|
768
|
+
provider_dir + "/metadata.yaml",
|
|
769
|
+
import_result.metadata_yaml,
|
|
770
|
+
);
|
|
771
|
+
return map_file_error(_pipe, provider_dir + "/metadata.yaml");
|
|
772
|
+
})(),
|
|
773
|
+
(_) => {
|
|
774
|
+
return $result.try$(
|
|
775
|
+
$fs.copy_file_list(
|
|
776
|
+
import_result.scripts,
|
|
777
|
+
provider_dir + "/scripts",
|
|
778
|
+
),
|
|
779
|
+
(_) => {
|
|
780
|
+
return $result.try$(
|
|
781
|
+
$fs.copy_file_list(
|
|
782
|
+
import_result.assets,
|
|
783
|
+
provider_dir + "/assets",
|
|
784
|
+
),
|
|
785
|
+
(_) => { return new Ok(undefined); },
|
|
786
|
+
);
|
|
787
|
+
},
|
|
788
|
+
);
|
|
789
|
+
},
|
|
790
|
+
);
|
|
791
|
+
},
|
|
792
|
+
);
|
|
793
|
+
},
|
|
794
|
+
);
|
|
795
|
+
},
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Write the unified directory structure to disk.
|
|
801
|
+
*/
|
|
802
|
+
export function emit_imported(import_result, output_dir) {
|
|
803
|
+
let $ = $simplifile.is_file(output_dir + "/skill.yaml");
|
|
804
|
+
if ($ instanceof Ok) {
|
|
805
|
+
let $1 = $[0];
|
|
806
|
+
if ($1) {
|
|
807
|
+
return new Error(
|
|
808
|
+
new ImportError("emit", "skill.yaml already exists in " + output_dir),
|
|
809
|
+
);
|
|
810
|
+
} else {
|
|
811
|
+
return do_emit_imported(import_result, output_dir);
|
|
812
|
+
}
|
|
813
|
+
} else {
|
|
814
|
+
return do_emit_imported(import_result, output_dir);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
function collect_source_files(source_dir, subdir) {
|
|
819
|
+
let dir = (source_dir + "/") + subdir;
|
|
820
|
+
let $ = $simplifile.get_files(dir);
|
|
821
|
+
if ($ instanceof Ok) {
|
|
822
|
+
let files = $[0];
|
|
823
|
+
return $list.map(
|
|
824
|
+
files,
|
|
825
|
+
(f) => {
|
|
826
|
+
let relative = $string.replace(f, dir + "/", "");
|
|
827
|
+
return new FileCopy(f, relative);
|
|
828
|
+
},
|
|
829
|
+
);
|
|
830
|
+
} else {
|
|
831
|
+
return toList([]);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Simple string hash for temp directory naming.
|
|
837
|
+
*
|
|
838
|
+
* @ignore
|
|
839
|
+
*/
|
|
840
|
+
function hash_string(s) {
|
|
841
|
+
let chars = $string.to_utf_codepoints(s);
|
|
842
|
+
let hash = $list.fold(
|
|
843
|
+
chars,
|
|
844
|
+
0,
|
|
845
|
+
(acc, cp) => {
|
|
846
|
+
let code = $string.utf_codepoint_to_int(cp);
|
|
847
|
+
return ((acc * 31 % 999_999_937) + code) % 999_999_937;
|
|
848
|
+
},
|
|
849
|
+
);
|
|
850
|
+
let $ = hash < 0;
|
|
851
|
+
if ($) {
|
|
852
|
+
return $int.to_string(- hash);
|
|
853
|
+
} else {
|
|
854
|
+
return $int.to_string(hash);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function fetch_remote(url) {
|
|
859
|
+
let tmp_dir = ($platform.tmpdir() + "/skillc-import-") + hash_string(url);
|
|
860
|
+
let $ = $simplifile.create_directory_all(tmp_dir);
|
|
861
|
+
if ($ instanceof Ok) {
|
|
862
|
+
let cmd = (("curl -sSfL -o " + $shell.quote(tmp_dir + "/SKILL.md")) + " ") + $shell.quote(
|
|
863
|
+
url,
|
|
864
|
+
);
|
|
865
|
+
let $1 = $shell.exec(cmd);
|
|
866
|
+
if ($1 instanceof Ok) {
|
|
867
|
+
return new Ok(new SourceDirectory(tmp_dir));
|
|
868
|
+
} else {
|
|
869
|
+
let msg = $1[0];
|
|
870
|
+
return new Error(new ImportError(url, "Failed to download: " + msg));
|
|
871
|
+
}
|
|
872
|
+
} else {
|
|
873
|
+
return new Error(new ImportError(url, "Failed to create temp directory"));
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Resolve source: download URL to temp dir, or classify local path as
|
|
879
|
+
* file or directory.
|
|
880
|
+
*/
|
|
881
|
+
export function fetch_source(source) {
|
|
882
|
+
let $ = $string.starts_with(source, "http://") || $string.starts_with(
|
|
883
|
+
source,
|
|
884
|
+
"https://",
|
|
885
|
+
);
|
|
886
|
+
if ($) {
|
|
887
|
+
return fetch_remote(source);
|
|
888
|
+
} else {
|
|
889
|
+
return resolve_local(source);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Import a provider-specific skill into unified format.
|
|
895
|
+
*/
|
|
896
|
+
export function import_skill(source, provider_hint, output_dir) {
|
|
897
|
+
return $result.try$(
|
|
898
|
+
fetch_source(source),
|
|
899
|
+
(resolved) => {
|
|
900
|
+
let _block;
|
|
901
|
+
if (resolved instanceof SourceDirectory) {
|
|
902
|
+
let path = resolved.path;
|
|
903
|
+
_block = path + "/SKILL.md";
|
|
904
|
+
} else {
|
|
905
|
+
let path = resolved.path;
|
|
906
|
+
_block = path;
|
|
907
|
+
}
|
|
908
|
+
let skill_md_path = _block;
|
|
909
|
+
return $result.try$(
|
|
910
|
+
(() => {
|
|
911
|
+
let _pipe = $simplifile.read(skill_md_path);
|
|
912
|
+
return map_file_error(_pipe, skill_md_path);
|
|
913
|
+
})(),
|
|
914
|
+
(content) => {
|
|
915
|
+
return $result.try$(
|
|
916
|
+
parse_frontmatter(content),
|
|
917
|
+
(frontmatter) => {
|
|
918
|
+
let source_dir = resolved_directory(resolved);
|
|
919
|
+
return $result.try$(
|
|
920
|
+
(() => {
|
|
921
|
+
if (provider_hint instanceof Some) {
|
|
922
|
+
let p = provider_hint[0];
|
|
923
|
+
return new Ok(p);
|
|
924
|
+
} else {
|
|
925
|
+
return detect_provider(frontmatter.pairs, source_dir);
|
|
926
|
+
}
|
|
927
|
+
})(),
|
|
928
|
+
(provider) => {
|
|
929
|
+
let _block$1;
|
|
930
|
+
if (provider instanceof Codex) {
|
|
931
|
+
let $ = $simplifile.read(source_dir + "/agents/openai.yaml");
|
|
932
|
+
if ($ instanceof Ok) {
|
|
933
|
+
let content$1 = $[0];
|
|
934
|
+
_block$1 = new Some(content$1);
|
|
935
|
+
} else {
|
|
936
|
+
_block$1 = new None();
|
|
937
|
+
}
|
|
938
|
+
} else {
|
|
939
|
+
_block$1 = new None();
|
|
940
|
+
}
|
|
941
|
+
let codex_yaml = _block$1;
|
|
942
|
+
return $result.try$(
|
|
943
|
+
separate_fields(frontmatter.pairs, provider),
|
|
944
|
+
(separated) => {
|
|
945
|
+
let skill_yaml = generate_skill_yaml(separated.universal);
|
|
946
|
+
let metadata_yaml = generate_metadata_yaml(
|
|
947
|
+
separated.provider,
|
|
948
|
+
codex_yaml,
|
|
949
|
+
);
|
|
950
|
+
let instructions_md = $string.trim(frontmatter.body) + "\n";
|
|
951
|
+
let scripts = collect_source_files(source_dir, "scripts");
|
|
952
|
+
let assets = collect_source_files(source_dir, "assets");
|
|
953
|
+
let import_result = new ImportResult(
|
|
954
|
+
provider,
|
|
955
|
+
skill_yaml,
|
|
956
|
+
instructions_md,
|
|
957
|
+
metadata_yaml,
|
|
958
|
+
scripts,
|
|
959
|
+
assets,
|
|
960
|
+
);
|
|
961
|
+
return $result.try$(
|
|
962
|
+
emit_imported(import_result, output_dir),
|
|
963
|
+
(_) => { return new Ok(import_result); },
|
|
964
|
+
);
|
|
965
|
+
},
|
|
966
|
+
);
|
|
967
|
+
},
|
|
968
|
+
);
|
|
969
|
+
},
|
|
970
|
+
);
|
|
971
|
+
},
|
|
972
|
+
);
|
|
973
|
+
},
|
|
974
|
+
);
|
|
975
|
+
}
|