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,709 @@
|
|
|
1
|
+
import gleam/int
|
|
2
|
+
import gleam/list
|
|
3
|
+
import gleam/option.{type Option, None, Some}
|
|
4
|
+
import gleam/result
|
|
5
|
+
import gleam/string
|
|
6
|
+
import simplifile
|
|
7
|
+
import skillc/error.{type SkillError, ImportError, map_file_error}
|
|
8
|
+
import skillc/fs
|
|
9
|
+
import skillc/path
|
|
10
|
+
import skillc/platform
|
|
11
|
+
import skillc/semver.{type SemVer}
|
|
12
|
+
import skillc/shell
|
|
13
|
+
import skillc/types.{type FileCopy, type Provider, ClaudeCode, Codex, FileCopy, OpenClaw}
|
|
14
|
+
import skillc/yaml
|
|
15
|
+
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Types
|
|
18
|
+
// ============================================================================
|
|
19
|
+
|
|
20
|
+
/// A single key-value pair from YAML frontmatter.
|
|
21
|
+
pub type FrontmatterPair {
|
|
22
|
+
FrontmatterPair(key: String, value: String)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// Parsed YAML frontmatter and the markdown body that follows it.
|
|
26
|
+
pub type Frontmatter {
|
|
27
|
+
Frontmatter(pairs: List(FrontmatterPair), body: String)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Universal skill fields extracted from frontmatter.
|
|
31
|
+
pub type UniversalFields {
|
|
32
|
+
UniversalFields(
|
|
33
|
+
name: String,
|
|
34
|
+
description: String,
|
|
35
|
+
version: SemVer,
|
|
36
|
+
license: Option(String),
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// Result of separating frontmatter into universal and provider-specific parts.
|
|
41
|
+
pub type SeparatedFields {
|
|
42
|
+
SeparatedFields(
|
|
43
|
+
universal: UniversalFields,
|
|
44
|
+
provider: List(FrontmatterPair),
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// A resolved import source — either a directory or a single file.
|
|
49
|
+
pub type ResolvedSource {
|
|
50
|
+
SourceDirectory(path: String)
|
|
51
|
+
SourceFile(path: String, directory: String)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// The result of a successful import operation.
|
|
55
|
+
pub type ImportResult {
|
|
56
|
+
ImportResult(
|
|
57
|
+
provider: Provider,
|
|
58
|
+
skill_yaml: String,
|
|
59
|
+
instructions_md: String,
|
|
60
|
+
metadata_yaml: String,
|
|
61
|
+
scripts: List(FileCopy),
|
|
62
|
+
assets: List(FileCopy),
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ============================================================================
|
|
67
|
+
// Main orchestrator
|
|
68
|
+
// ============================================================================
|
|
69
|
+
|
|
70
|
+
/// Import a provider-specific skill into unified format.
|
|
71
|
+
pub fn import_skill(
|
|
72
|
+
source: String,
|
|
73
|
+
provider_hint: Option(Provider),
|
|
74
|
+
output_dir: String,
|
|
75
|
+
) -> Result(ImportResult, SkillError) {
|
|
76
|
+
// Resolve source (local path or URL)
|
|
77
|
+
use resolved <- result.try(fetch_source(source))
|
|
78
|
+
|
|
79
|
+
// Read SKILL.md
|
|
80
|
+
let skill_md_path = case resolved {
|
|
81
|
+
SourceFile(path:, ..) -> path
|
|
82
|
+
SourceDirectory(path:) -> path <> "/SKILL.md"
|
|
83
|
+
}
|
|
84
|
+
use content <- result.try(
|
|
85
|
+
simplifile.read(skill_md_path)
|
|
86
|
+
|> map_file_error(skill_md_path),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
// Parse frontmatter
|
|
90
|
+
use frontmatter <- result.try(parse_frontmatter(content))
|
|
91
|
+
|
|
92
|
+
// Detect provider
|
|
93
|
+
let source_dir = resolved_directory(resolved)
|
|
94
|
+
use provider <- result.try(case provider_hint {
|
|
95
|
+
Some(p) -> Ok(p)
|
|
96
|
+
None -> detect_provider(frontmatter.pairs, source_dir)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
// Read codex yaml before separation (keeps generate_metadata_yaml pure)
|
|
100
|
+
let codex_yaml = case provider {
|
|
101
|
+
Codex ->
|
|
102
|
+
case simplifile.read(source_dir <> "/agents/openai.yaml") {
|
|
103
|
+
Ok(content) -> Some(content)
|
|
104
|
+
Error(_) -> None
|
|
105
|
+
}
|
|
106
|
+
_ -> None
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Separate fields (validates name, description, version)
|
|
110
|
+
use separated <- result.try(separate_fields(frontmatter.pairs, provider))
|
|
111
|
+
|
|
112
|
+
// Generate files
|
|
113
|
+
let skill_yaml = generate_skill_yaml(separated.universal)
|
|
114
|
+
let metadata_yaml =
|
|
115
|
+
generate_metadata_yaml(separated.provider, codex_yaml)
|
|
116
|
+
let instructions_md = string.trim(frontmatter.body) <> "\n"
|
|
117
|
+
|
|
118
|
+
// Collect scripts and assets from source dir
|
|
119
|
+
let scripts = collect_source_files(source_dir, "scripts")
|
|
120
|
+
let assets = collect_source_files(source_dir, "assets")
|
|
121
|
+
|
|
122
|
+
let import_result =
|
|
123
|
+
ImportResult(
|
|
124
|
+
provider: provider,
|
|
125
|
+
skill_yaml: skill_yaml,
|
|
126
|
+
instructions_md: instructions_md,
|
|
127
|
+
metadata_yaml: metadata_yaml,
|
|
128
|
+
scripts: scripts,
|
|
129
|
+
assets: assets,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
// Emit to disk
|
|
133
|
+
use _ <- result.try(emit_imported(import_result, output_dir))
|
|
134
|
+
|
|
135
|
+
Ok(import_result)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ============================================================================
|
|
139
|
+
// Frontmatter parsing
|
|
140
|
+
// ============================================================================
|
|
141
|
+
|
|
142
|
+
/// Split a SKILL.md into YAML frontmatter key-value pairs and the body markdown.
|
|
143
|
+
pub fn parse_frontmatter(
|
|
144
|
+
content: String,
|
|
145
|
+
) -> Result(Frontmatter, SkillError) {
|
|
146
|
+
let trimmed = string.trim_start(content)
|
|
147
|
+
case string.starts_with(trimmed, "---") {
|
|
148
|
+
False ->
|
|
149
|
+
Error(ImportError(
|
|
150
|
+
"SKILL.md",
|
|
151
|
+
"No YAML frontmatter found (expected opening ---)",
|
|
152
|
+
))
|
|
153
|
+
True -> {
|
|
154
|
+
let after_open = string.drop_start(trimmed, 3)
|
|
155
|
+
let after_open = case string.starts_with(after_open, "\n") {
|
|
156
|
+
True -> string.drop_start(after_open, 1)
|
|
157
|
+
False -> after_open
|
|
158
|
+
}
|
|
159
|
+
case find_closing_fence(after_open) {
|
|
160
|
+
Error(Nil) ->
|
|
161
|
+
Error(ImportError(
|
|
162
|
+
"SKILL.md",
|
|
163
|
+
"Unclosed YAML frontmatter (missing closing ---)",
|
|
164
|
+
))
|
|
165
|
+
Ok(#(yaml_block, body)) -> {
|
|
166
|
+
let pairs = parse_yaml_pairs(yaml_block)
|
|
167
|
+
Ok(Frontmatter(pairs: pairs, body: body))
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/// Find closing --- fence. Returns (yaml_content, body_after_fence).
|
|
175
|
+
fn find_closing_fence(content: String) -> Result(#(String, String), Nil) {
|
|
176
|
+
let lines = string.split(content, "\n")
|
|
177
|
+
find_closing_fence_loop(lines, [])
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
fn find_closing_fence_loop(
|
|
181
|
+
lines: List(String),
|
|
182
|
+
acc: List(String),
|
|
183
|
+
) -> Result(#(String, String), Nil) {
|
|
184
|
+
case lines {
|
|
185
|
+
[] -> Error(Nil)
|
|
186
|
+
[line, ..rest] -> {
|
|
187
|
+
case string.trim(line) == "---" {
|
|
188
|
+
True -> {
|
|
189
|
+
let yaml = string.join(list.reverse(acc), "\n")
|
|
190
|
+
let body = case rest {
|
|
191
|
+
[] -> ""
|
|
192
|
+
_ -> string.join(rest, "\n")
|
|
193
|
+
}
|
|
194
|
+
let body = case string.starts_with(body, "\n") {
|
|
195
|
+
True -> string.drop_start(body, 1)
|
|
196
|
+
False -> body
|
|
197
|
+
}
|
|
198
|
+
Ok(#(yaml, body))
|
|
199
|
+
}
|
|
200
|
+
False -> find_closing_fence_loop(rest, [line, ..acc])
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/// Parse a YAML frontmatter block into key-value pairs.
|
|
207
|
+
fn parse_yaml_pairs(yaml: String) -> List(FrontmatterPair) {
|
|
208
|
+
let lines = string.split(yaml, "\n")
|
|
209
|
+
parse_yaml_lines(lines, [])
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
fn parse_yaml_lines(
|
|
213
|
+
lines: List(String),
|
|
214
|
+
acc: List(FrontmatterPair),
|
|
215
|
+
) -> List(FrontmatterPair) {
|
|
216
|
+
case lines {
|
|
217
|
+
[] -> list.reverse(acc)
|
|
218
|
+
[line, ..rest] -> {
|
|
219
|
+
case string.trim(line) {
|
|
220
|
+
"" -> parse_yaml_lines(rest, acc)
|
|
221
|
+
_ -> {
|
|
222
|
+
case string.contains(line, ":") && !string.starts_with(line, " ") {
|
|
223
|
+
True -> {
|
|
224
|
+
let #(key, value) = split_key_value(line)
|
|
225
|
+
let trimmed_value = string.trim(value)
|
|
226
|
+
case trimmed_value {
|
|
227
|
+
"" -> {
|
|
228
|
+
let #(block_lines, remaining) = collect_indented(rest, [])
|
|
229
|
+
let block_value =
|
|
230
|
+
string.join(list.reverse(block_lines), "\n")
|
|
231
|
+
parse_yaml_lines(remaining, [
|
|
232
|
+
FrontmatterPair(key:, value: block_value),
|
|
233
|
+
..acc
|
|
234
|
+
])
|
|
235
|
+
}
|
|
236
|
+
_ ->
|
|
237
|
+
parse_yaml_lines(rest, [
|
|
238
|
+
FrontmatterPair(key:, value: trimmed_value),
|
|
239
|
+
..acc
|
|
240
|
+
])
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
False -> parse_yaml_lines(rest, acc)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
fn split_key_value(line: String) -> #(String, String) {
|
|
252
|
+
case string.split_once(line, ":") {
|
|
253
|
+
Ok(#(key, value)) -> #(string.trim(key), value)
|
|
254
|
+
Error(Nil) -> #(line, "")
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
fn collect_indented(
|
|
259
|
+
lines: List(String),
|
|
260
|
+
acc: List(String),
|
|
261
|
+
) -> #(List(String), List(String)) {
|
|
262
|
+
case lines {
|
|
263
|
+
[] -> #(acc, [])
|
|
264
|
+
[line, ..rest] -> {
|
|
265
|
+
case string.starts_with(line, " ") || string.starts_with(line, "\t") {
|
|
266
|
+
True -> collect_indented(rest, [line, ..acc])
|
|
267
|
+
False -> {
|
|
268
|
+
case string.trim(line) {
|
|
269
|
+
"" -> collect_indented(rest, acc)
|
|
270
|
+
_ -> #(acc, [line, ..rest])
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// ============================================================================
|
|
279
|
+
// Provider detection
|
|
280
|
+
// ============================================================================
|
|
281
|
+
|
|
282
|
+
/// Heuristic provider auto-detection from frontmatter keys and directory.
|
|
283
|
+
pub fn detect_provider(
|
|
284
|
+
pairs: List(FrontmatterPair),
|
|
285
|
+
source_dir: String,
|
|
286
|
+
) -> Result(Provider, SkillError) {
|
|
287
|
+
let keys = list.map(pairs, fn(pair) { pair.key })
|
|
288
|
+
|
|
289
|
+
// 1. Key starting with metadata.openclaw → OpenClaw
|
|
290
|
+
let has_openclaw =
|
|
291
|
+
list.any(keys, fn(k) { string.starts_with(k, "metadata.openclaw") })
|
|
292
|
+
case has_openclaw {
|
|
293
|
+
True -> Ok(OpenClaw)
|
|
294
|
+
False -> {
|
|
295
|
+
// 2. Claude Code specific keys
|
|
296
|
+
let claude_code_keys = [
|
|
297
|
+
"user-invocable", "allowed-tools", "disable-model-invocation",
|
|
298
|
+
]
|
|
299
|
+
let has_claude_code =
|
|
300
|
+
list.any(keys, fn(k) { list.contains(claude_code_keys, k) })
|
|
301
|
+
case has_claude_code {
|
|
302
|
+
True -> Ok(ClaudeCode)
|
|
303
|
+
False -> {
|
|
304
|
+
// 3. Codex: agents/openai.yaml exists in source dir
|
|
305
|
+
case simplifile.is_file(source_dir <> "/agents/openai.yaml") {
|
|
306
|
+
Ok(True) -> Ok(Codex)
|
|
307
|
+
_ ->
|
|
308
|
+
Error(ImportError(
|
|
309
|
+
"detect",
|
|
310
|
+
"Cannot auto-detect provider. Pass --provider openclaw|claude-code|codex",
|
|
311
|
+
))
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// ============================================================================
|
|
320
|
+
// Field separation
|
|
321
|
+
// ============================================================================
|
|
322
|
+
|
|
323
|
+
/// Classify each frontmatter key as universal or provider-specific.
|
|
324
|
+
/// Returns an error if required fields (name, description, version) are missing.
|
|
325
|
+
pub fn separate_fields(
|
|
326
|
+
pairs: List(FrontmatterPair),
|
|
327
|
+
provider: Provider,
|
|
328
|
+
) -> Result(SeparatedFields, SkillError) {
|
|
329
|
+
let universal_keys = ["name", "description", "version", "license"]
|
|
330
|
+
|
|
331
|
+
// Extract and validate required fields
|
|
332
|
+
use name <- result.try(
|
|
333
|
+
find_pair_value(pairs, "name")
|
|
334
|
+
|> option.map(unquote_yaml_string)
|
|
335
|
+
|> require_non_empty("name"),
|
|
336
|
+
)
|
|
337
|
+
use description <- result.try(
|
|
338
|
+
find_pair_value(pairs, "description")
|
|
339
|
+
|> option.map(unquote_yaml_string)
|
|
340
|
+
|> require_non_empty("description"),
|
|
341
|
+
)
|
|
342
|
+
use version <- result.try(
|
|
343
|
+
find_pair_value(pairs, "version")
|
|
344
|
+
|> option.map(unquote_yaml_string)
|
|
345
|
+
|> require_non_empty("version"),
|
|
346
|
+
)
|
|
347
|
+
use version <- result.try(
|
|
348
|
+
semver.parse(version)
|
|
349
|
+
|> result.map_error(fn(_) {
|
|
350
|
+
ImportError("version", "Invalid version format: " <> version)
|
|
351
|
+
}),
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
let license =
|
|
355
|
+
find_pair_value(pairs, "license")
|
|
356
|
+
|> option.map(unquote_yaml_string)
|
|
357
|
+
|
|
358
|
+
let universal =
|
|
359
|
+
UniversalFields(
|
|
360
|
+
name: name,
|
|
361
|
+
description: description,
|
|
362
|
+
version: version,
|
|
363
|
+
license: license,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
let provider_pairs = case provider {
|
|
367
|
+
OpenClaw -> {
|
|
368
|
+
case find_pair_value(pairs, "metadata.openclaw") {
|
|
369
|
+
Some(block) -> parse_openclaw_block(block)
|
|
370
|
+
None ->
|
|
371
|
+
list.filter(pairs, fn(pair) {
|
|
372
|
+
!list.contains(universal_keys, pair.key)
|
|
373
|
+
&& !string.starts_with(pair.key, "metadata.openclaw")
|
|
374
|
+
})
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
_ ->
|
|
378
|
+
list.filter(pairs, fn(pair) {
|
|
379
|
+
!list.contains(universal_keys, pair.key)
|
|
380
|
+
})
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
Ok(SeparatedFields(universal: universal, provider: provider_pairs))
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
fn find_pair_value(
|
|
387
|
+
pairs: List(FrontmatterPair),
|
|
388
|
+
key: String,
|
|
389
|
+
) -> Option(String) {
|
|
390
|
+
case list.find(pairs, fn(pair) { pair.key == key }) {
|
|
391
|
+
Ok(FrontmatterPair(value:, ..)) -> Some(value)
|
|
392
|
+
Error(Nil) -> None
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/// Require that an optional value is present and non-empty.
|
|
397
|
+
fn require_non_empty(
|
|
398
|
+
value: Option(String),
|
|
399
|
+
field: String,
|
|
400
|
+
) -> Result(String, SkillError) {
|
|
401
|
+
case value {
|
|
402
|
+
None ->
|
|
403
|
+
Error(ImportError(
|
|
404
|
+
field,
|
|
405
|
+
"Required field '" <> field <> "' is missing from frontmatter",
|
|
406
|
+
))
|
|
407
|
+
Some(s) ->
|
|
408
|
+
case string.trim(s) {
|
|
409
|
+
"" ->
|
|
410
|
+
Error(ImportError(
|
|
411
|
+
field,
|
|
412
|
+
"Required field '" <> field <> "' must not be empty",
|
|
413
|
+
))
|
|
414
|
+
_ -> Ok(s)
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/// Remove surrounding quotes from a YAML string value.
|
|
420
|
+
fn unquote_yaml_string(s: String) -> String {
|
|
421
|
+
let trimmed = string.trim(s)
|
|
422
|
+
case
|
|
423
|
+
string.starts_with(trimmed, "\"") && string.ends_with(trimmed, "\"")
|
|
424
|
+
{
|
|
425
|
+
True -> {
|
|
426
|
+
let inner = trimmed |> string.drop_start(1) |> string.drop_end(1)
|
|
427
|
+
let inner = string.replace(inner, "\\n", "\n")
|
|
428
|
+
let inner = string.replace(inner, "\\\"", "\"")
|
|
429
|
+
string.replace(inner, "\\\\", "\\")
|
|
430
|
+
}
|
|
431
|
+
False ->
|
|
432
|
+
case
|
|
433
|
+
string.starts_with(trimmed, "'") && string.ends_with(trimmed, "'")
|
|
434
|
+
{
|
|
435
|
+
True -> trimmed |> string.drop_start(1) |> string.drop_end(1)
|
|
436
|
+
False -> trimmed
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/// Parse the indented block under metadata.openclaw: into key-value pairs.
|
|
442
|
+
fn parse_openclaw_block(block: String) -> List(FrontmatterPair) {
|
|
443
|
+
let lines = string.split(block, "\n")
|
|
444
|
+
parse_openclaw_lines(lines, [])
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
fn parse_openclaw_lines(
|
|
448
|
+
lines: List(String),
|
|
449
|
+
acc: List(FrontmatterPair),
|
|
450
|
+
) -> List(FrontmatterPair) {
|
|
451
|
+
case lines {
|
|
452
|
+
[] -> list.reverse(acc)
|
|
453
|
+
[line, ..rest] -> {
|
|
454
|
+
let stripped = string.trim_start(line)
|
|
455
|
+
case string.trim(stripped) {
|
|
456
|
+
"" -> parse_openclaw_lines(rest, acc)
|
|
457
|
+
_ -> {
|
|
458
|
+
case string.contains(stripped, ":") {
|
|
459
|
+
True -> {
|
|
460
|
+
let #(key, value) = split_key_value(stripped)
|
|
461
|
+
let trimmed_value = string.trim(value)
|
|
462
|
+
case trimmed_value {
|
|
463
|
+
"" -> {
|
|
464
|
+
let base_indent =
|
|
465
|
+
string.length(line) - string.length(stripped)
|
|
466
|
+
let #(block_lines, remaining) =
|
|
467
|
+
collect_sub_indented(rest, base_indent, [])
|
|
468
|
+
let block_value =
|
|
469
|
+
string.join(list.reverse(block_lines), "\n")
|
|
470
|
+
parse_openclaw_lines(remaining, [
|
|
471
|
+
FrontmatterPair(key:, value: block_value),
|
|
472
|
+
..acc
|
|
473
|
+
])
|
|
474
|
+
}
|
|
475
|
+
_ ->
|
|
476
|
+
parse_openclaw_lines(rest, [
|
|
477
|
+
FrontmatterPair(key:, value: trimmed_value),
|
|
478
|
+
..acc
|
|
479
|
+
])
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
False -> parse_openclaw_lines(rest, acc)
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
fn collect_sub_indented(
|
|
491
|
+
lines: List(String),
|
|
492
|
+
base_indent: Int,
|
|
493
|
+
acc: List(String),
|
|
494
|
+
) -> #(List(String), List(String)) {
|
|
495
|
+
case lines {
|
|
496
|
+
[] -> #(acc, [])
|
|
497
|
+
[line, ..rest] -> {
|
|
498
|
+
let stripped = string.trim_start(line)
|
|
499
|
+
let line_indent = string.length(line) - string.length(stripped)
|
|
500
|
+
case string.trim(line) {
|
|
501
|
+
"" -> collect_sub_indented(rest, base_indent, acc)
|
|
502
|
+
_ -> {
|
|
503
|
+
case line_indent > base_indent {
|
|
504
|
+
True -> {
|
|
505
|
+
let trimmed_line = string.drop_start(line, base_indent + 2)
|
|
506
|
+
collect_sub_indented(rest, base_indent, [trimmed_line, ..acc])
|
|
507
|
+
}
|
|
508
|
+
False -> #(acc, [line, ..rest])
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// ============================================================================
|
|
517
|
+
// YAML generation
|
|
518
|
+
// ============================================================================
|
|
519
|
+
|
|
520
|
+
/// Generate skill.yaml content from universal fields.
|
|
521
|
+
pub fn generate_skill_yaml(fields: UniversalFields) -> String {
|
|
522
|
+
let lines = [
|
|
523
|
+
"name: " <> yaml.quote_string(fields.name),
|
|
524
|
+
"description: " <> yaml.quote_string(fields.description),
|
|
525
|
+
"version: " <> semver.to_string(fields.version),
|
|
526
|
+
]
|
|
527
|
+
let lines = case fields.license {
|
|
528
|
+
Some(l) -> list.append(lines, ["license: " <> yaml.quote_string(l)])
|
|
529
|
+
None -> lines
|
|
530
|
+
}
|
|
531
|
+
string.join(lines, "\n") <> "\n"
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/// Generate metadata.yaml content from provider-specific pairs.
|
|
535
|
+
/// For Codex, uses pre-read agents/openai.yaml content if available.
|
|
536
|
+
pub fn generate_metadata_yaml(
|
|
537
|
+
provider_pairs: List(FrontmatterPair),
|
|
538
|
+
codex_yaml: Option(String),
|
|
539
|
+
) -> String {
|
|
540
|
+
case codex_yaml {
|
|
541
|
+
Some(content) -> content
|
|
542
|
+
None -> format_pairs_as_yaml(provider_pairs)
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
fn format_pairs_as_yaml(pairs: List(FrontmatterPair)) -> String {
|
|
547
|
+
case pairs {
|
|
548
|
+
[] -> ""
|
|
549
|
+
_ -> {
|
|
550
|
+
let lines =
|
|
551
|
+
list.map(pairs, fn(pair) {
|
|
552
|
+
case string.contains(pair.value, "\n") {
|
|
553
|
+
True -> pair.key <> ":\n" <> indent_block(pair.value, 2)
|
|
554
|
+
False -> pair.key <> ": " <> pair.value
|
|
555
|
+
}
|
|
556
|
+
})
|
|
557
|
+
string.join(lines, "\n") <> "\n"
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
fn indent_block(block: String, spaces: Int) -> String {
|
|
563
|
+
let prefix = string.repeat(" ", spaces)
|
|
564
|
+
let lines = string.split(block, "\n")
|
|
565
|
+
list.map(lines, fn(line) {
|
|
566
|
+
case string.trim(line) {
|
|
567
|
+
"" -> ""
|
|
568
|
+
_ -> prefix <> line
|
|
569
|
+
}
|
|
570
|
+
})
|
|
571
|
+
|> string.join("\n")
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// ============================================================================
|
|
575
|
+
// Source resolution
|
|
576
|
+
// ============================================================================
|
|
577
|
+
|
|
578
|
+
/// Resolve source: download URL to temp dir, or classify local path as
|
|
579
|
+
/// file or directory.
|
|
580
|
+
pub fn fetch_source(source: String) -> Result(ResolvedSource, SkillError) {
|
|
581
|
+
case
|
|
582
|
+
string.starts_with(source, "http://")
|
|
583
|
+
|| string.starts_with(source, "https://")
|
|
584
|
+
{
|
|
585
|
+
True -> fetch_remote(source)
|
|
586
|
+
False -> resolve_local(source)
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
fn fetch_remote(url: String) -> Result(ResolvedSource, SkillError) {
|
|
591
|
+
let tmp_dir = platform.tmpdir() <> "/skillc-import-" <> hash_string(url)
|
|
592
|
+
case simplifile.create_directory_all(tmp_dir) {
|
|
593
|
+
Error(_) ->
|
|
594
|
+
Error(ImportError(url, "Failed to create temp directory"))
|
|
595
|
+
Ok(_) -> {
|
|
596
|
+
let cmd =
|
|
597
|
+
"curl -sSfL -o "
|
|
598
|
+
<> shell.quote(tmp_dir <> "/SKILL.md")
|
|
599
|
+
<> " "
|
|
600
|
+
<> shell.quote(url)
|
|
601
|
+
case shell.exec(cmd) {
|
|
602
|
+
Ok(_) -> Ok(SourceDirectory(tmp_dir))
|
|
603
|
+
Error(msg) ->
|
|
604
|
+
Error(ImportError(url, "Failed to download: " <> msg))
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
fn resolve_local(source: String) -> Result(ResolvedSource, SkillError) {
|
|
611
|
+
case simplifile.is_file(source) {
|
|
612
|
+
Ok(True) -> Ok(SourceFile(path: source, directory: path.parent_dir(source)))
|
|
613
|
+
_ -> Ok(SourceDirectory(source))
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/// Extract the directory path from a resolved source.
|
|
618
|
+
fn resolved_directory(source: ResolvedSource) -> String {
|
|
619
|
+
case source {
|
|
620
|
+
SourceDirectory(path:) -> path
|
|
621
|
+
SourceFile(directory:, ..) -> directory
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// ============================================================================
|
|
626
|
+
// Emit to disk
|
|
627
|
+
// ============================================================================
|
|
628
|
+
|
|
629
|
+
/// Write the unified directory structure to disk.
|
|
630
|
+
pub fn emit_imported(
|
|
631
|
+
import_result: ImportResult,
|
|
632
|
+
output_dir: String,
|
|
633
|
+
) -> Result(Nil, SkillError) {
|
|
634
|
+
case simplifile.is_file(output_dir <> "/skill.yaml") {
|
|
635
|
+
Ok(True) ->
|
|
636
|
+
Error(ImportError(
|
|
637
|
+
"emit",
|
|
638
|
+
"skill.yaml already exists in " <> output_dir,
|
|
639
|
+
))
|
|
640
|
+
_ -> do_emit_imported(import_result, output_dir)
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
fn do_emit_imported(
|
|
645
|
+
import_result: ImportResult,
|
|
646
|
+
output_dir: String,
|
|
647
|
+
) -> Result(Nil, SkillError) {
|
|
648
|
+
let provider_str = types.provider_to_string(import_result.provider)
|
|
649
|
+
let provider_dir = output_dir <> "/providers/" <> provider_str
|
|
650
|
+
|
|
651
|
+
use _ <- result.try(
|
|
652
|
+
simplifile.create_directory_all(provider_dir)
|
|
653
|
+
|> map_file_error(provider_dir),
|
|
654
|
+
)
|
|
655
|
+
use _ <- result.try(
|
|
656
|
+
simplifile.write(output_dir <> "/skill.yaml", import_result.skill_yaml)
|
|
657
|
+
|> map_file_error(output_dir <> "/skill.yaml"),
|
|
658
|
+
)
|
|
659
|
+
use _ <- result.try(
|
|
660
|
+
simplifile.write(
|
|
661
|
+
output_dir <> "/INSTRUCTIONS.md",
|
|
662
|
+
import_result.instructions_md,
|
|
663
|
+
)
|
|
664
|
+
|> map_file_error(output_dir <> "/INSTRUCTIONS.md"),
|
|
665
|
+
)
|
|
666
|
+
use _ <- result.try(
|
|
667
|
+
simplifile.write(
|
|
668
|
+
provider_dir <> "/metadata.yaml",
|
|
669
|
+
import_result.metadata_yaml,
|
|
670
|
+
)
|
|
671
|
+
|> map_file_error(provider_dir <> "/metadata.yaml"),
|
|
672
|
+
)
|
|
673
|
+
use _ <- result.try(fs.copy_file_list(
|
|
674
|
+
import_result.scripts,
|
|
675
|
+
provider_dir <> "/scripts",
|
|
676
|
+
))
|
|
677
|
+
use _ <- result.try(fs.copy_file_list(
|
|
678
|
+
import_result.assets,
|
|
679
|
+
provider_dir <> "/assets",
|
|
680
|
+
))
|
|
681
|
+
|
|
682
|
+
Ok(Nil)
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
fn collect_source_files(source_dir: String, subdir: String) -> List(FileCopy) {
|
|
686
|
+
let dir = source_dir <> "/" <> subdir
|
|
687
|
+
case simplifile.get_files(dir) {
|
|
688
|
+
Ok(files) ->
|
|
689
|
+
list.map(files, fn(f) {
|
|
690
|
+
let relative = string.replace(f, dir <> "/", "")
|
|
691
|
+
FileCopy(src: f, relative_path: relative)
|
|
692
|
+
})
|
|
693
|
+
Error(_) -> []
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/// Simple string hash for temp directory naming.
|
|
698
|
+
fn hash_string(s: String) -> String {
|
|
699
|
+
let chars = string.to_utf_codepoints(s)
|
|
700
|
+
let hash =
|
|
701
|
+
list.fold(chars, 0, fn(acc, cp) {
|
|
702
|
+
let code = string.utf_codepoint_to_int(cp)
|
|
703
|
+
{ { acc * 31 } % 999_999_937 + code } % 999_999_937
|
|
704
|
+
})
|
|
705
|
+
case hash < 0 {
|
|
706
|
+
True -> int.to_string(-hash)
|
|
707
|
+
False -> int.to_string(hash)
|
|
708
|
+
}
|
|
709
|
+
}
|