@greenpandastudios/aug-cli 0.19.0 → 0.21.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 +9 -6
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/bin/aug.mjs +12 -2
- package/docs/about.md +27 -0
- package/docs/api/crypto.md +103 -69
- package/docs/api/io.md +35 -33
- package/docs/api/json.md +3 -3
- package/docs/api/memory.md +23 -19
- package/docs/api/time.md +10 -9
- package/docs/api/web.md +33 -38
- package/docs/assets/benchmarks/execution.svg +774 -637
- package/docs/assets/benchmarks/http.svg +278 -249
- package/docs/assets/benchmarks/improvements.svg +66 -66
- package/docs/assets/benchmarks/kernels-mobile.svg +1 -0
- package/docs/assets/benchmarks/kernels.svg +1 -0
- package/docs/assets/benchmarks/memory.svg +153 -153
- package/docs/benchmark-results.json +227089 -90363
- package/docs/compatibility.md +8 -8
- package/docs/contributing-benchmarks.md +68 -0
- package/docs/dev-containers.md +88 -0
- package/docs/dgx-consumers.json +122 -0
- package/docs/dgx-gyms.json +784 -0
- package/docs/dgx-kernels.json +1170 -0
- package/docs/dgx-performance.json +227849 -0
- package/docs/dgx-spark.md +64 -0
- package/docs/diagnostics.md +15 -5
- package/docs/docker.md +173 -12
- package/docs/editor.md +35 -0
- package/docs/example-projects.json +238 -24
- package/docs/examples/approved-design/counters.md +34 -126
- package/docs/examples/approved-design/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/approved-design/domain/app.md +13 -77
- package/docs/examples/approved-design/domain/export.md +5 -19
- package/docs/examples/approved-design/domain/models.md +4 -23
- package/docs/examples/approved-design/domain/numbers.md +24 -114
- package/docs/examples/approved-design/index.md +16 -7
- package/docs/examples/approved-design/main.md +19 -96
- package/docs/examples/benchmark/index.md +6 -5
- package/docs/examples/benchmark/main.md +7 -35
- package/docs/examples/calls-benchmark/index.md +36 -0
- package/docs/examples/calls-benchmark/main.md +78 -0
- package/docs/examples/calls-benchmark/operations.md +60 -0
- package/docs/examples/cli-args/index.md +6 -5
- package/docs/examples/cli-args/main.md +6 -31
- package/docs/examples/collections/index.md +6 -5
- package/docs/examples/collections/main.md +7 -35
- package/docs/examples/collections-benchmark/index.md +6 -5
- package/docs/examples/collections-benchmark/main.md +7 -35
- package/docs/examples/cpu-benchmark/index.md +6 -5
- package/docs/examples/cpu-benchmark/main.md +5 -24
- package/docs/examples/developer-workflow/calculator.md +39 -186
- package/docs/examples/developer-workflow/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/developer-workflow/index.md +16 -7
- package/docs/examples/developer-workflow/logging/console.md +10 -56
- package/docs/examples/developer-workflow/logging/export.md +4 -14
- package/docs/examples/developer-workflow/logging/logger.md +7 -43
- package/docs/examples/developer-workflow/main.md +17 -69
- package/docs/examples/drop/index.md +6 -5
- package/docs/examples/drop/main.md +7 -27
- package/docs/examples/drop/resource.md +7 -30
- package/docs/examples/errors/errors.md +7 -27
- package/docs/examples/errors/index.md +6 -5
- package/docs/examples/errors/main.md +7 -28
- package/docs/examples/errors-benchmark/index.md +36 -0
- package/docs/examples/errors-benchmark/main.md +92 -0
- package/docs/examples/errors-benchmark/operations.md +65 -0
- package/docs/examples/ffi/index.md +6 -5
- package/docs/examples/ffi/main.md +6 -20
- package/docs/examples/ffi/native.md +8 -34
- package/docs/examples/float-benchmark/index.md +35 -0
- package/docs/examples/float-benchmark/main.md +75 -0
- package/docs/examples/generic-di/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/generic-di/index.md +6 -5
- package/docs/examples/generic-di/main.md +9 -39
- package/docs/examples/generic-di/types.md +23 -92
- package/docs/examples/generics/index.md +6 -5
- package/docs/examples/generics/main.md +10 -47
- package/docs/examples/generics/types.md +25 -100
- package/docs/examples/hello/app/export.md +4 -12
- package/docs/examples/hello/app/greeter.md +13 -91
- package/docs/examples/hello/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/hello/index.md +17 -6
- package/docs/examples/hello/logging/console.md +10 -54
- package/docs/examples/hello/logging/export.md +4 -14
- package/docs/examples/hello/logging/logger.md +7 -45
- package/docs/examples/hello/main.md +9 -39
- package/docs/examples/http-benchmark/index.md +6 -5
- package/docs/examples/http-benchmark/main.md +6 -20
- package/docs/examples/http-benchmark/routes.md +9 -31
- package/docs/examples/index.md +63 -29
- package/docs/examples/interceptors/app.md +20 -139
- package/docs/examples/interceptors/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/interceptors/index.md +6 -5
- package/docs/examples/interceptors/interceptors.md +24 -148
- package/docs/examples/interceptors/logging.md +13 -76
- package/docs/examples/interceptors/main.md +10 -65
- package/docs/examples/json-benchmark/data.md +4 -20
- package/docs/examples/json-benchmark/dependencies/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +67 -0
- package/docs/examples/json-benchmark/index.md +7 -5
- package/docs/examples/json-benchmark/main-yaml.md +20 -0
- package/docs/examples/json-benchmark/main.md +10 -49
- package/docs/examples/list-benchmark/index.md +35 -0
- package/docs/examples/list-benchmark/main.md +78 -0
- package/docs/examples/map-churn-benchmark/index.md +35 -0
- package/docs/examples/map-churn-benchmark/main.md +106 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/api.md +104 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.md +54 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi-json.md +48 -0
- package/docs/examples/native-blake3/hashing.md +93 -0
- package/docs/examples/native-blake3/index.md +38 -0
- package/docs/examples/native-blake3/main.md +73 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/api.md +406 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.md +51 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.md +63 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi-json.md +161 -0
- package/docs/examples/native-pytorch/index.md +38 -0
- package/docs/examples/native-pytorch/main.md +73 -0
- package/docs/examples/native-pytorch/tensors.md +123 -0
- package/docs/examples/native-sqlite/database.md +116 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/api.md +284 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.md +51 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.md +75 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi-json.md +119 -0
- package/docs/examples/native-sqlite/index.md +38 -0
- package/docs/examples/native-sqlite/main.md +73 -0
- package/docs/examples/native-zlib/compression.md +99 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/api.md +153 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.md +54 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi-json.md +76 -0
- package/docs/examples/native-zlib/index.md +38 -0
- package/docs/examples/native-zlib/main.md +78 -0
- package/docs/examples/new-syntax/console.md +10 -52
- package/docs/examples/new-syntax/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/new-syntax/greeter.md +13 -71
- package/docs/examples/new-syntax/index.md +6 -5
- package/docs/examples/new-syntax/logger.md +7 -43
- package/docs/examples/new-syntax/main.md +10 -53
- package/docs/examples/new-syntax/math.md +6 -24
- package/docs/examples/oidc-login/client/contracts.md +10 -61
- package/docs/examples/oidc-login/client/endpoints.md +32 -154
- package/docs/examples/oidc-login/client/export.md +5 -23
- package/docs/examples/oidc-login/client/login.md +234 -344
- package/docs/examples/oidc-login/client/logout.md +38 -143
- package/docs/examples/oidc-login/client/protocol.md +183 -304
- package/docs/examples/oidc-login/client/session.md +41 -149
- package/docs/examples/oidc-login/client/views.md +13 -58
- package/docs/examples/oidc-login/common/export.md +6 -26
- package/docs/examples/oidc-login/common/headers.md +42 -72
- package/docs/examples/oidc-login/common/keys.md +40 -164
- package/docs/examples/oidc-login/common/settings.md +24 -40
- package/docs/examples/oidc-login/common/views.md +7 -28
- package/docs/examples/oidc-login/dependencies/packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/store.md +205 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +67 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +267 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/contracts.md +415 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/jose.md +271 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +89 -0
- package/docs/examples/oidc-login/index.md +8 -7
- package/docs/examples/oidc-login/main-yaml.md +7 -0
- package/docs/examples/oidc-login/main.md +26 -153
- package/docs/examples/oidc-login/provider/authorization.md +232 -275
- package/docs/examples/oidc-login/provider/contracts.md +24 -146
- package/docs/examples/oidc-login/provider/credentials.md +24 -57
- package/docs/examples/oidc-login/provider/discovery.md +48 -122
- package/docs/examples/oidc-login/provider/export.md +11 -37
- package/docs/examples/oidc-login/provider/token.md +159 -237
- package/docs/examples/oidc-login/provider/userinfo.md +47 -102
- package/docs/examples/oidc-login/provider/views.md +13 -53
- package/docs/examples/ownership/counter.md +17 -63
- package/docs/examples/ownership/index.md +6 -5
- package/docs/examples/ownership/main.md +7 -30
- package/docs/examples/ownership-transfer/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/ownership-transfer/index.md +6 -5
- package/docs/examples/ownership-transfer/main.md +10 -52
- package/docs/examples/ownership-transfer/resource.md +15 -67
- package/docs/examples/packages-app/dependencies/packages/@example/aug-math/0.1.0/arithmetic.md +12 -50
- package/docs/examples/packages-app/index.md +7 -6
- package/docs/examples/packages-app/main.md +7 -25
- package/docs/examples/packages-math/aug-package-json.md +1 -1
- package/docs/examples/packages-math/index.md +7 -6
- package/docs/examples/packages-math/src/arithmetic.md +12 -50
- package/docs/examples/packages-math/src/export.md +4 -12
- package/docs/examples/records-benchmark/data.md +55 -0
- package/docs/examples/records-benchmark/index.md +36 -0
- package/docs/examples/records-benchmark/main.md +85 -0
- package/docs/examples/startup-benchmark/index.md +6 -5
- package/docs/examples/startup-benchmark/main.md +5 -17
- package/docs/examples/strings-benchmark/index.md +35 -0
- package/docs/examples/strings-benchmark/main.md +76 -0
- package/docs/examples/tasks-benchmark/index.md +36 -0
- package/docs/examples/tasks-benchmark/main.md +89 -0
- package/docs/examples/tasks-benchmark/operations.md +58 -0
- package/docs/examples/visibility/counter.md +19 -67
- package/docs/examples/visibility/index.md +6 -5
- package/docs/examples/visibility/main.md +7 -31
- package/docs/examples/weather-api/forecasts.md +168 -0
- package/docs/examples/weather-api/index.md +42 -0
- package/docs/examples/weather-api/main-yaml.md +21 -0
- package/docs/examples/weather-api/main.md +65 -0
- package/docs/examples.json +10 -0
- package/docs/getting-started.md +105 -2
- package/docs/grammar.md +7 -5
- package/docs/guides/change-a-module.md +64 -0
- package/docs/guides/index.md +27 -0
- package/docs/gym-results.json +784 -0
- package/docs/implementation-map.md +6 -0
- package/docs/index.md +51 -29
- package/docs/kernel-results.json +1170 -0
- package/docs/language-conformance.md +7 -1
- package/docs/language-constructs.md +30 -22
- package/docs/language-design-audit.md +1 -1
- package/docs/learn/data-and-errors.md +77 -0
- package/docs/learn/index.md +30 -0
- package/docs/learn/modules-and-dependencies.md +73 -0
- package/docs/learn/state-and-tests.md +71 -0
- package/docs/learn/values-and-functions.md +62 -0
- package/docs/lesson-failures.json +8 -0
- package/docs/maintaining-docs.md +16 -4
- package/docs/native-implementation.md +276 -0
- package/docs/native-interop-llvm-plan.md +342 -0
- package/docs/native-package-examples.md +684 -0
- package/docs/native-packages.md +179 -0
- package/docs/packages.md +72 -126
- package/docs/performance.md +61 -68
- package/docs/production-readiness.md +16 -5
- package/docs/public/downloads/approved-design.zip +0 -0
- package/docs/public/downloads/benchmark.zip +0 -0
- package/docs/public/downloads/calls-benchmark.zip +0 -0
- package/docs/public/downloads/cli-args.zip +0 -0
- package/docs/public/downloads/collections-benchmark.zip +0 -0
- package/docs/public/downloads/collections.zip +0 -0
- package/docs/public/downloads/cpu-benchmark.zip +0 -0
- package/docs/public/downloads/developer-workflow.zip +0 -0
- package/docs/public/downloads/drop.zip +0 -0
- package/docs/public/downloads/errors-benchmark.zip +0 -0
- package/docs/public/downloads/errors.zip +0 -0
- package/docs/public/downloads/ffi.zip +0 -0
- package/docs/public/downloads/float-benchmark.zip +0 -0
- package/docs/public/downloads/generic-di.zip +0 -0
- package/docs/public/downloads/generics.zip +0 -0
- package/docs/public/downloads/hello.zip +0 -0
- package/docs/public/downloads/http-benchmark.zip +0 -0
- package/docs/public/downloads/interceptors.zip +0 -0
- package/docs/public/downloads/json-benchmark.zip +0 -0
- package/docs/public/downloads/list-benchmark.zip +0 -0
- package/docs/public/downloads/map-churn-benchmark.zip +0 -0
- package/docs/public/downloads/native-blake3.zip +0 -0
- package/docs/public/downloads/native-pytorch.zip +0 -0
- package/docs/public/downloads/native-sqlite.zip +0 -0
- package/docs/public/downloads/native-zlib.zip +0 -0
- package/docs/public/downloads/new-syntax.zip +0 -0
- package/docs/public/downloads/oidc-login.zip +0 -0
- package/docs/public/downloads/ownership-transfer.zip +0 -0
- package/docs/public/downloads/ownership.zip +0 -0
- package/docs/public/downloads/packages-app.zip +0 -0
- package/docs/public/downloads/packages-math.zip +0 -0
- package/docs/public/downloads/records-benchmark.zip +0 -0
- package/docs/public/downloads/startup-benchmark.zip +0 -0
- package/docs/public/downloads/strings-benchmark.zip +0 -0
- package/docs/public/downloads/tasks-benchmark.zip +0 -0
- package/docs/public/downloads/visibility.zip +0 -0
- package/docs/public/downloads/weather-api.zip +0 -0
- package/docs/qualification-results.md +66 -0
- package/docs/reference.md +47 -17
- package/docs/releasing.md +105 -16
- package/docs/research/code-to-natural-language.md +108 -0
- package/docs/research/ecosystem-workflow.md +41 -0
- package/docs/research/libtorch-native-qualification.md +115 -0
- package/docs/research/native-interop-llvm.md +197 -0
- package/docs/research/qualification-methods.md +15 -0
- package/docs/research/wiki-editorial-design.md +71 -0
- package/docs/roadmap.md +2 -1
- package/docs/safety-gyms.md +41 -0
- package/docs/specifications.md +27 -11
- package/docs/testing.md +19 -5
- package/docs/tooling.md +36 -22
- package/docs/weather-api.md +65 -0
- package/docs/web-library-gaps.md +1 -1
- package/docs/web.md +54 -18
- package/docs/writing-docs.md +49 -0
- package/examples/{hello/.aug-spec/august/0.19.0 → approved-design/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/approved-design/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/approved-design/.aug-spec/manifest.json +3 -3
- package/examples/approved-design/counters.aug +5 -4
- package/examples/approved-design/counters.aug.md +25 -132
- package/examples/approved-design/domain/app.aug +2 -1
- package/examples/approved-design/domain/app.aug.md +10 -80
- package/examples/approved-design/domain/export.aug +1 -0
- package/examples/approved-design/domain/export.aug.md +4 -20
- package/examples/approved-design/domain/models.aug +1 -0
- package/examples/approved-design/domain/models.aug.md +3 -25
- package/examples/approved-design/domain/numbers.aug +3 -2
- package/examples/approved-design/domain/numbers.aug.md +19 -116
- package/examples/approved-design/main.aug +1 -0
- package/examples/approved-design/main.aug.md +12 -95
- package/examples/benchmark/.aug-spec/manifest.json +1 -1
- package/examples/benchmark/main.aug +1 -0
- package/examples/benchmark/main.aug.md +6 -36
- package/examples/cli-args/.aug-spec/manifest.json +1 -1
- package/examples/cli-args/main.aug +1 -0
- package/examples/cli-args/main.aug.md +5 -32
- package/examples/collections/.aug-spec/manifest.json +1 -1
- package/examples/collections/main.aug +1 -0
- package/examples/collections/main.aug.md +6 -36
- package/examples/{generic-di/.aug-spec/august/0.19.0 → developer-workflow/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/developer-workflow/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/developer-workflow/.aug-spec/manifest.json +3 -3
- package/examples/developer-workflow/calculator.aug +3 -2
- package/examples/developer-workflow/calculator.aug.md +28 -189
- package/examples/developer-workflow/logging/console.aug +2 -1
- package/examples/developer-workflow/logging/console.aug.md +7 -57
- package/examples/developer-workflow/logging/export.aug +1 -0
- package/examples/developer-workflow/logging/export.aug.md +3 -15
- package/examples/developer-workflow/logging/logger.aug +1 -0
- package/examples/developer-workflow/logging/logger.aug.md +6 -46
- package/examples/developer-workflow/main.aug +1 -0
- package/examples/developer-workflow/main.aug.md +10 -68
- package/examples/drop/.aug-spec/manifest.json +1 -1
- package/examples/drop/main.aug +1 -0
- package/examples/drop/main.aug.md +6 -28
- package/examples/drop/resource.aug +1 -0
- package/examples/drop/resource.aug.md +6 -34
- package/examples/errors/.aug-spec/manifest.json +1 -1
- package/examples/errors/errors.aug +2 -1
- package/examples/errors/errors.aug.md +4 -27
- package/examples/errors/main.aug +1 -0
- package/examples/errors/main.aug.md +6 -29
- package/examples/ffi/.aug-spec/manifest.json +1 -1
- package/examples/ffi/main.aug +1 -0
- package/examples/ffi/main.aug.md +5 -21
- package/examples/ffi/native.aug +2 -1
- package/examples/ffi/native.aug.md +5 -35
- package/examples/{approved-design/.aug-spec/august/0.19.0 → generic-di/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/generic-di/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/generic-di/.aug-spec/manifest.json +3 -3
- package/examples/generic-di/main.aug +1 -0
- package/examples/generic-di/main.aug.md +8 -40
- package/examples/generic-di/types.aug +3 -2
- package/examples/generic-di/types.aug.md +18 -97
- package/examples/generics/.aug-spec/manifest.json +1 -1
- package/examples/generics/main.aug +1 -0
- package/examples/generics/main.aug.md +9 -48
- package/examples/generics/types.aug +4 -3
- package/examples/generics/types.aug.md +18 -104
- package/examples/{developer-workflow/.aug-spec/august/0.19.0 → hello/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/hello/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/hello/.aug-spec/manifest.json +3 -3
- package/examples/hello/app/export.aug +1 -0
- package/examples/hello/app/export.aug.md +3 -13
- package/examples/hello/app/greeter.aug +2 -1
- package/examples/hello/app/greeter.aug.md +10 -94
- package/examples/hello/logging/console.aug +2 -1
- package/examples/hello/logging/console.aug.md +7 -55
- package/examples/hello/logging/export.aug +1 -0
- package/examples/hello/logging/export.aug.md +3 -15
- package/examples/hello/logging/logger.aug +1 -0
- package/examples/hello/logging/logger.aug.md +6 -48
- package/examples/hello/main.aug +1 -0
- package/examples/hello/main.aug.md +8 -40
- package/examples/interceptors/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
- package/examples/interceptors/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/interceptors/.aug-spec/manifest.json +3 -3
- package/examples/interceptors/app.aug +3 -2
- package/examples/interceptors/app.aug.md +15 -141
- package/examples/interceptors/interceptors.aug +3 -2
- package/examples/interceptors/interceptors.aug.md +19 -152
- package/examples/interceptors/logging.aug +2 -1
- package/examples/interceptors/logging.aug.md +10 -79
- package/examples/interceptors/main.aug +1 -0
- package/examples/interceptors/main.aug.md +9 -66
- package/examples/native-blake3/.aug-spec/manifest.json +16 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.1/native.abi.json +29 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug +14 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug.md +34 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug +4 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug.md +8 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi.json +29 -0
- package/examples/native-blake3/AGENTS.md +5 -0
- package/examples/native-blake3/aug.lock.json +253 -0
- package/examples/native-blake3/hashing.aug +11 -0
- package/examples/native-blake3/hashing.aug.md +25 -0
- package/examples/native-blake3/main.aug +8 -0
- package/examples/native-blake3/main.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/manifest.json +18 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.1/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.3/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug +101 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug.md +160 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug +3 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug.md +8 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug +6 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi.json +142 -0
- package/examples/native-pytorch/AGENTS.md +5 -0
- package/examples/native-pytorch/aug.lock.json +309 -0
- package/examples/native-pytorch/main.aug +8 -0
- package/examples/native-pytorch/main.aug.md +13 -0
- package/examples/native-pytorch/tensors.aug +23 -0
- package/examples/native-pytorch/tensors.aug.md +35 -0
- package/examples/native-sqlite/.aug-spec/manifest.json +18 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.2/native.abi.json +100 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug +48 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug.md +91 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug +3 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug.md +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug.md +22 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi.json +100 -0
- package/examples/native-sqlite/AGENTS.md +5 -0
- package/examples/native-sqlite/aug.lock.json +236 -0
- package/examples/native-sqlite/database.aug +15 -0
- package/examples/native-sqlite/database.aug.md +27 -0
- package/examples/native-sqlite/main.aug +8 -0
- package/examples/native-sqlite/main.aug.md +13 -0
- package/examples/native-zlib/.aug-spec/manifest.json +16 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.1/native.abi.json +57 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug +29 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug.md +54 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug +4 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug.md +8 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi.json +57 -0
- package/examples/native-zlib/AGENTS.md +5 -0
- package/examples/native-zlib/aug.lock.json +236 -0
- package/examples/native-zlib/compression.aug +15 -0
- package/examples/native-zlib/compression.aug.md +27 -0
- package/examples/native-zlib/main.aug +10 -0
- package/examples/native-zlib/main.aug.md +13 -0
- package/examples/new-syntax/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
- package/examples/new-syntax/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/new-syntax/.aug-spec/manifest.json +3 -3
- package/examples/new-syntax/console.aug +2 -1
- package/examples/new-syntax/console.aug.md +7 -53
- package/examples/new-syntax/greeter.aug +2 -1
- package/examples/new-syntax/greeter.aug.md +10 -74
- package/examples/new-syntax/logger.aug +1 -0
- package/examples/new-syntax/logger.aug.md +6 -46
- package/examples/new-syntax/main.aug +1 -0
- package/examples/new-syntax/main.aug.md +9 -54
- package/examples/new-syntax/math.aug +2 -1
- package/examples/new-syntax/math.aug.md +3 -24
- package/examples/oidc-login/.aug-spec/manifest.json +13 -13
- package/examples/oidc-login/.aug-spec/packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/store.aug.md +71 -0
- package/examples/oidc-login/.aug-spec/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +17 -0
- package/examples/oidc-login/.aug-spec/packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +125 -0
- package/examples/oidc-login/.aug-spec/{august/0.19.0/crypto → packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40}/contracts.aug +12 -11
- package/examples/oidc-login/.aug-spec/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/contracts.aug.md +244 -0
- package/examples/oidc-login/.aug-spec/{august/0.19.0/crypto → packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40}/jose.aug +6 -5
- package/examples/oidc-login/.aug-spec/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/jose.aug.md +71 -0
- package/examples/oidc-login/.aug-spec/packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +30 -0
- package/examples/oidc-login/aug.lock.json +100 -0
- package/examples/oidc-login/client/contracts.aug +1 -0
- package/examples/oidc-login/client/contracts.aug.md +9 -66
- package/examples/oidc-login/client/endpoints.aug +6 -5
- package/examples/oidc-login/client/endpoints.aug.md +13 -145
- package/examples/oidc-login/client/export.aug +1 -0
- package/examples/oidc-login/client/export.aug.md +4 -24
- package/examples/oidc-login/client/login.aug +7 -6
- package/examples/oidc-login/client/login.aug.md +25 -303
- package/examples/oidc-login/client/logout.aug +5 -4
- package/examples/oidc-login/client/logout.aug.md +13 -135
- package/examples/oidc-login/client/protocol.aug +7 -6
- package/examples/oidc-login/client/protocol.aug.md +36 -283
- package/examples/oidc-login/client/session.aug +5 -4
- package/examples/oidc-login/client/session.aug.md +12 -139
- package/examples/oidc-login/client/views.aug +3 -2
- package/examples/oidc-login/client/views.aug.md +8 -57
- package/examples/oidc-login/common/export.aug +1 -0
- package/examples/oidc-login/common/export.aug.md +5 -27
- package/examples/oidc-login/common/headers.aug +4 -3
- package/examples/oidc-login/common/headers.aug.md +9 -67
- package/examples/oidc-login/common/keys.aug +6 -5
- package/examples/oidc-login/common/keys.aug.md +29 -165
- package/examples/oidc-login/common/settings.aug +2 -1
- package/examples/oidc-login/common/settings.aug.md +5 -39
- package/examples/oidc-login/common/views.aug +2 -1
- package/examples/oidc-login/common/views.aug.md +4 -28
- package/examples/oidc-login/main.aug +6 -16
- package/examples/oidc-login/main.aug.md +17 -146
- package/examples/oidc-login/main.yaml +7 -0
- package/examples/oidc-login/provider/authorization.aug +7 -6
- package/examples/oidc-login/provider/authorization.aug.md +23 -238
- package/examples/oidc-login/provider/contracts.aug +1 -0
- package/examples/oidc-login/provider/contracts.aug.md +23 -158
- package/examples/oidc-login/provider/credentials.aug +3 -2
- package/examples/oidc-login/provider/credentials.aug.md +9 -53
- package/examples/oidc-login/provider/discovery.aug +4 -3
- package/examples/oidc-login/provider/discovery.aug.md +11 -118
- package/examples/oidc-login/provider/export.aug +1 -0
- package/examples/oidc-login/provider/export.aug.md +6 -34
- package/examples/oidc-login/provider/token.aug +6 -5
- package/examples/oidc-login/provider/token.aug.md +16 -204
- package/examples/oidc-login/provider/userinfo.aug +4 -3
- package/examples/oidc-login/provider/userinfo.aug.md +10 -92
- package/examples/oidc-login/provider/views.aug +3 -2
- package/examples/oidc-login/provider/views.aug.md +8 -52
- package/examples/ownership/.aug-spec/manifest.json +1 -1
- package/examples/ownership/counter.aug +3 -2
- package/examples/ownership/counter.aug.md +12 -66
- package/examples/ownership/main.aug +1 -0
- package/examples/ownership/main.aug.md +6 -31
- package/examples/ownership-transfer/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
- package/examples/ownership-transfer/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/ownership-transfer/.aug-spec/manifest.json +3 -3
- package/examples/ownership-transfer/main.aug +1 -0
- package/examples/ownership-transfer/main.aug.md +9 -53
- package/examples/ownership-transfer/resource.aug +2 -1
- package/examples/ownership-transfer/resource.aug.md +12 -71
- package/examples/packages/app/.aug-spec/manifest.json +1 -1
- package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug +2 -1
- package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug.md +9 -51
- package/examples/packages/app/main.aug +1 -0
- package/examples/packages/app/main.aug.md +6 -26
- package/examples/packages/math/.aug-spec/manifest.json +1 -1
- package/examples/packages/math/aug-package.json +1 -1
- package/examples/packages/math/src/arithmetic.aug +2 -1
- package/examples/packages/math/src/arithmetic.aug.md +9 -51
- package/examples/packages/math/src/export.aug +1 -0
- package/examples/packages/math/src/export.aug.md +3 -13
- package/examples/visibility/.aug-spec/manifest.json +1 -1
- package/examples/visibility/counter.aug +4 -3
- package/examples/visibility/counter.aug.md +12 -68
- package/examples/visibility/main.aug +1 -0
- package/examples/visibility/main.aug.md +6 -32
- package/examples/weather-api/.aug-spec/manifest.json +8 -0
- package/examples/weather-api/AGENTS.md +17 -0
- package/examples/weather-api/README.md +19 -0
- package/examples/weather-api/forecasts.aug +47 -0
- package/examples/weather-api/forecasts.aug.md +32 -0
- package/examples/weather-api/main.aug +4 -0
- package/examples/weather-api/main.aug.md +15 -0
- package/examples/weather-api/main.yaml +5 -0
- package/examples/weather-api/weather.http +5 -0
- package/native/compiler-packs.json +43 -0
- package/package.json +4 -4
- package/runtime/aug_http.c +48 -21
- package/runtime/aug_http_ir.c +30 -0
- package/runtime/aug_http_ir.h +18 -0
- package/runtime/aug_ir.c +209 -0
- package/runtime/aug_ir.h +89 -0
- package/runtime/aug_json.c +6 -1
- package/runtime/aug_runtime.c +82 -16
- package/runtime/aug_runtime.h +16 -2
- package/runtime/aug_tasks.c +38 -7
- package/runtime/aug_values.c +12 -6
- package/scripts/bootstrap-native.mjs +184 -106
- package/scripts/native-setup.mjs +98 -0
- package/scripts/native-toolchain.mjs +28 -0
- package/src/ast.js +1 -1
- package/src/builtins.js +1 -1
- package/src/checker.js +369 -100
- package/src/cli.js +198 -26
- package/src/codegen.js +32 -7
- package/src/compiler-packs.js +66 -0
- package/src/config.js +3 -3
- package/src/contracts.js +10 -0
- package/src/editor.js +86 -22
- package/src/fixes.js +90 -2
- package/src/formatter.js +23 -10
- package/src/git-http.js +137 -0
- package/src/git-packages.js +118 -0
- package/src/help.js +33 -24
- package/src/http-contracts.js +14 -0
- package/src/http-policies.js +5 -5
- package/src/ir-types.js +5 -0
- package/src/ir-verify.js +277 -0
- package/src/ir.js +962 -0
- package/src/libraries.js +1 -1
- package/src/llvm-debug.js +101 -0
- package/src/llvm-native.js +152 -0
- package/src/llvm-platform.js +20 -0
- package/src/llvm.js +781 -0
- package/src/lsp.js +14 -5
- package/src/native-artifacts.js +207 -0
- package/src/native-bindings.js +189 -0
- package/src/native-contracts.js +295 -0
- package/src/native-declarations.js +68 -0
- package/src/native-facts.js +63 -0
- package/src/native.js +19 -13
- package/src/navigation.js +4 -2
- package/src/openapi.js +5 -4
- package/src/package-locking.js +88 -0
- package/src/package-manager.js +267 -68
- package/src/parser.js +32 -6
- package/src/policies.js +3 -3
- package/src/project-init.js +78 -4
- package/src/project.js +11 -9
- package/src/runtime-abi.js +23 -0
- package/src/runtime-adapters.js +18 -0
- package/src/schemas.js +24 -17
- package/src/semantic.js +54 -5
- package/src/snippets.js +60 -0
- package/src/spec-hints.js +56 -0
- package/src/spec-tree.js +241 -0
- package/src/spec.js +669 -305
- package/docs/examples/approved-design/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/developer-workflow/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/generic-di/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/hello/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/interceptors/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/json-benchmark/dependencies/august/0.19.0/json/contracts.md +0 -103
- package/docs/examples/new-syntax/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/contracts.md +0 -925
- package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/jose.md +0 -434
- package/docs/examples/oidc-login/dependencies/august/0.19.0/json/contracts.md +0 -103
- package/docs/examples/oidc-login/dependencies/august/0.19.0/memory/store.md +0 -374
- package/docs/examples/oidc-login/dependencies/august/0.19.0/time/contracts.md +0 -150
- package/docs/examples/oidc-login/dependencies/august/0.19.0/web/contracts.md +0 -532
- package/docs/examples/ownership-transfer/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/examples/approved-design/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/developer-workflow/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/generic-di/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/hello/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
- package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
- package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/contracts.aug.md +0 -791
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/jose.aug.md +0 -266
- package/examples/oidc-login/.aug-spec/august/0.19.0/json/contracts.aug.md +0 -55
- package/examples/oidc-login/.aug-spec/august/0.19.0/memory/store.aug.md +0 -250
- package/examples/oidc-login/.aug-spec/august/0.19.0/time/contracts.aug.md +0 -96
- package/examples/oidc-login/.aug-spec/august/0.19.0/web/contracts.aug.md +0 -420
- package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
- package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/memory → packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/store.aug +0 -0
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/json → packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/web → packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/time → packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
package/src/cli.js
CHANGED
|
@@ -4,6 +4,13 @@ import { spawnSync } from 'node:child_process';
|
|
|
4
4
|
import { typeName } from "./ast.js";
|
|
5
5
|
import { checkProject } from "./checker.js";
|
|
6
6
|
import { generateC } from "./codegen.js";
|
|
7
|
+
import { generateLLVM } from "./llvm.js";
|
|
8
|
+
import { lowerToIR, BackendUnsupported } from "./ir.js";
|
|
9
|
+
import { IRVerificationError } from "./ir-verify.js";
|
|
10
|
+
import { compileLLVM } from "./llvm-native.js";
|
|
11
|
+
import { prepareNativePackages } from "./native-artifacts.js";
|
|
12
|
+
import { prepareLLVMCompiler } from "./compiler-packs.js";
|
|
13
|
+
import { bindNativeHeader } from "./native-bindings.js";
|
|
7
14
|
import { diagnosticHelp } from "./help.js";
|
|
8
15
|
import { loadProject } from "./project.js";
|
|
9
16
|
import { definitionAt } from "./navigation.js";
|
|
@@ -11,26 +18,54 @@ import { checkUnitTests, discoverTests, mergeTestAnalysis, uniqueDiagnostics } f
|
|
|
11
18
|
import { describe, SemanticWorkspace } from "./semantic.js";
|
|
12
19
|
import { formatFile, migrateFile } from "./formatter.js";
|
|
13
20
|
import { updateSpecs } from "./spec.js";
|
|
21
|
+
import { updateSpecHints } from "./spec-hints.js";
|
|
14
22
|
import { runLanguageServer } from "./lsp.js";
|
|
15
23
|
import { benchmark, compileNative, writeCoverage } from "./native.js";
|
|
16
24
|
import { generateOpenApi } from "./openapi.js";
|
|
17
|
-
import { initPackage, installPackages, preparePackage, packPackage } from "./package-manager.js";
|
|
25
|
+
import { addPackage, initPackage, installPackages, preparePackage, packPackage, prepareRunPackages } from "./package-manager.js";
|
|
18
26
|
import { initProject } from "./project-init.js";
|
|
27
|
+
import { prepareNativeDependencies } from '../scripts/native-setup.mjs';
|
|
28
|
+
function failureMessage(error) {
|
|
29
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
30
|
+
if (error instanceof Error && 'code' in error && ['EACCES', 'EPERM', 'EROFS'].includes(String(error.code)))
|
|
31
|
+
return `${message}\nAugust needs a writable project and native cache. Check the folder permissions, or set AUG_NATIVE_HOME to a directory you own.`;
|
|
32
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOSPC')
|
|
33
|
+
return `${message}\nThere is not enough disk space to compile or prepare dependencies. Free space and retry aug run.`;
|
|
34
|
+
return message;
|
|
35
|
+
}
|
|
19
36
|
function printDiagnostics(diagnostics, json, root) {
|
|
20
37
|
if (json) {
|
|
21
38
|
process.stdout.write(JSON.stringify(diagnostics.map(issue => ({ ...issue,
|
|
22
39
|
help: diagnosticHelp[issue.code] }))) + '\n');
|
|
23
40
|
return;
|
|
24
41
|
}
|
|
42
|
+
const sources = new Map();
|
|
25
43
|
for (const issue of diagnostics) {
|
|
26
|
-
const file =
|
|
44
|
+
const file = relative(root, issue.file) || issue.file;
|
|
27
45
|
process.stderr.write(`${file}:${issue.line}:${issue.column}: ${issue.code}: ${issue.message}\n`);
|
|
46
|
+
try {
|
|
47
|
+
if (!sources.has(issue.file))
|
|
48
|
+
sources.set(issue.file, readFileSync(issue.file, 'utf8').split(/\r?\n/));
|
|
49
|
+
const line = sources.get(issue.file)?.[issue.line - 1];
|
|
50
|
+
if (line !== undefined) {
|
|
51
|
+
const column = Math.max(0, Math.min(line.length, issue.column - 1));
|
|
52
|
+
const start = Math.max(0, column - 70), end = Math.min(line.length, start + 150);
|
|
53
|
+
const text = (start ? '…' : '') + line.slice(start, end).replace(/\t/g, ' ') + (end < line.length ? '…' : '');
|
|
54
|
+
const padding = (start ? 1 : 0) + line.slice(start, column).replace(/\t/g, ' ').length;
|
|
55
|
+
process.stderr.write(` ${issue.line} | ${text}\n ${' '.repeat(String(issue.line).length)} | ${' '.repeat(padding)}^\n`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch { /* Source may have been removed; the location and help remain useful. */ }
|
|
59
|
+
if (diagnosticHelp[issue.code])
|
|
60
|
+
process.stderr.write(` help: ${diagnosticHelp[issue.code]}\n`);
|
|
28
61
|
}
|
|
29
62
|
}
|
|
30
63
|
function usage() {
|
|
31
64
|
process.stdout.write(`AugScript compiler\n\n` +
|
|
32
|
-
`Usage: aug <init|check|build|run|emit-c|test|openapi|format|migrate|spec|bench|explain|context|lsp|symbols|definition|complete|hover|fixes|semantic-tokens> [project directory] [options] [-- args]\n` +
|
|
33
|
-
`New application: aug init DIRECTORY\n` +
|
|
65
|
+
`Usage: aug <init|check|build|run|emit-c|emit-llvm|emit-ir|test|openapi|format|migrate|spec|bench|explain|context|lsp|symbols|definition|complete|hover|fixes|semantic-tokens> [project directory] [options] [-- args]\n` +
|
|
66
|
+
`New application: aug init DIRECTORY [--template hello|weather]\n` +
|
|
67
|
+
`Run: aug run [project directory] [--offline] [-- args] — prepare dependencies, compile, and start\n` +
|
|
68
|
+
`Backend: LLVM is the default on macOS 14+ ARM64 and GNU/Linux x64/ARM64 with glibc 2.36+. August installs its compiler pack; no separate native toolchain is needed. --backend c selects the migration reference.\n` +
|
|
34
69
|
`Tests: aug test [project directory] [GROUP_NAME] [--group GROUP_NAME] [--list] [--coverage] [--json] [--timeout milliseconds]\n` +
|
|
35
70
|
`Format: aug format [project directory] [--file path] [--write]\n` +
|
|
36
71
|
`Specifications: aug spec [project directory] [--check] [--json]\n` +
|
|
@@ -38,7 +73,8 @@ function usage() {
|
|
|
38
73
|
`Context: aug context [project directory] [--file path] [--name declaration] [--budget characters]\n` +
|
|
39
74
|
`Benchmark: aug bench [project directory] [--iterations 10] [--warmup 2] [--json] [-- args]\n` +
|
|
40
75
|
`Packages: aug package init DIRECTORY --name @owner/name; aug package pack DIRECTORY\n` +
|
|
41
|
-
`Dependencies: aug install [project directory] [--frozen] [--offline]\n` +
|
|
76
|
+
`Dependencies: aug add URL --as NAME [--project DIRECTORY]; aug install [project directory] [--frozen|--update] [--offline]\n` +
|
|
77
|
+
`Native maintainers: aug bind header HEADER --contract native.abi.json --target TRIPLE --output DIRECTORY --clang PATH [-- CLANG_FLAGS]\n` +
|
|
42
78
|
`Entry point: main.aug at the project root.\n`);
|
|
43
79
|
}
|
|
44
80
|
export async function main(argv) {
|
|
@@ -53,18 +89,75 @@ export async function main(argv) {
|
|
|
53
89
|
usage();
|
|
54
90
|
return 0;
|
|
55
91
|
}
|
|
92
|
+
if (command === 'bind') {
|
|
93
|
+
const boundary = argv.indexOf('--'), arguments_ = boundary < 0 ? argv : argv.slice(0, boundary), values = {};
|
|
94
|
+
if (arguments_[1] !== 'header' || !arguments_[2] || arguments_[2].startsWith('--')) {
|
|
95
|
+
process.stderr.write('Use aug bind header HEADER --contract FILE --target TRIPLE --output DIRECTORY --clang PATH\n');
|
|
96
|
+
return 2;
|
|
97
|
+
}
|
|
98
|
+
for (let index = 3; index < arguments_.length; index++) {
|
|
99
|
+
const flag = arguments_[index];
|
|
100
|
+
if (!['--contract', '--target', '--output', '--clang'].includes(flag) || values[flag] !== undefined || !arguments_[index + 1] || arguments_[index + 1].startsWith('--')) {
|
|
101
|
+
process.stderr.write('Invalid or duplicate native binding option: ' + flag + '\n');
|
|
102
|
+
return 2;
|
|
103
|
+
}
|
|
104
|
+
values[flag] = arguments_[++index];
|
|
105
|
+
}
|
|
106
|
+
if (['--contract', '--target', '--output', '--clang'].some(flag => !values[flag])) {
|
|
107
|
+
process.stderr.write('Native header validation requires --contract, --target, --output and --clang. No tool is installed automatically.\n');
|
|
108
|
+
return 2;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
bindNativeHeader({ header: arguments_[2], contract: values['--contract'], target: values['--target'], output: values['--output'], clang: values['--clang'], flags: boundary < 0 ? [] : argv.slice(boundary + 1) });
|
|
112
|
+
process.stdout.write('Checked native declarations written to ' + resolve(values['--output']) + '\n');
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
process.stderr.write(failureMessage(error) + '\n');
|
|
117
|
+
return 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (command === 'add') {
|
|
121
|
+
const aliasIndex = argv.indexOf('--as'), projectIndex = argv.indexOf('--project');
|
|
122
|
+
if (!argv[1] || argv[1].startsWith('--') || aliasIndex < 0 || !argv[aliasIndex + 1]) {
|
|
123
|
+
process.stderr.write('Use aug add URL --as NAME [--project DIRECTORY] [--offline]\n');
|
|
124
|
+
return 2;
|
|
125
|
+
}
|
|
126
|
+
for (let index = 2; index < argv.length; index++) {
|
|
127
|
+
if (['--as', '--project'].includes(argv[index])) {
|
|
128
|
+
if (!argv[++index] || argv[index].startsWith('--'))
|
|
129
|
+
return 2;
|
|
130
|
+
}
|
|
131
|
+
else if (argv[index] !== '--offline') {
|
|
132
|
+
process.stderr.write('Unknown add option: ' + argv[index] + '\n');
|
|
133
|
+
return 2;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const alias = argv[aliasIndex + 1], root = resolve(projectIndex < 0 ? process.cwd() : argv[projectIndex + 1]);
|
|
138
|
+
const lock = addPackage(root, argv[1], alias, argv.includes('--offline'));
|
|
139
|
+
await prepareNativePackages(root, { offline: argv.includes('--offline') });
|
|
140
|
+
process.stdout.write(`Added ${alias}; installed ${lock.packages.length} source package(s).\nImport public names with: import NAME from ${alias}\n`);
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
process.stderr.write(failureMessage(error) + '\n');
|
|
145
|
+
return 1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
56
148
|
if (command === 'init') {
|
|
57
|
-
|
|
58
|
-
|
|
149
|
+
const template = argv.length === 2 ? 'hello' : argv[2] === '--template' && argv.length === 4 ? argv[3] : undefined;
|
|
150
|
+
if (!argv[1] || argv[1].startsWith('--') || !['hello', 'weather'].includes(template ?? '')) {
|
|
151
|
+
process.stderr.write('Use aug init DIRECTORY [--template hello|weather]\n');
|
|
59
152
|
return 2;
|
|
60
153
|
}
|
|
61
154
|
try {
|
|
62
|
-
const root = initProject(argv[1]);
|
|
63
|
-
process.stdout.write(`Created August application in ${root}\nNext: cd ${argv[1]}
|
|
155
|
+
const root = initProject(argv[1], template);
|
|
156
|
+
process.stdout.write(`Created August application in ${root}\nNext: cd ${argv[1]}\n aug run\n`);
|
|
64
157
|
return 0;
|
|
65
158
|
}
|
|
66
159
|
catch (error) {
|
|
67
|
-
process.stderr.write(error
|
|
160
|
+
process.stderr.write(failureMessage(error) + '\n');
|
|
68
161
|
return 1;
|
|
69
162
|
}
|
|
70
163
|
}
|
|
@@ -73,17 +166,19 @@ export async function main(argv) {
|
|
|
73
166
|
const root = resolve((command === 'install' ? argv[1] : argv[2]) && !(command === 'install' ? argv[1] : argv[2]).startsWith('--')
|
|
74
167
|
? (command === 'install' ? argv[1] : argv[2]) : process.cwd());
|
|
75
168
|
if (command === 'install') {
|
|
76
|
-
const lock = installPackages(root, argv.includes('--frozen'), argv.includes('--offline'));
|
|
169
|
+
const lock = installPackages(root, argv.includes('--frozen'), argv.includes('--offline'), argv.includes('--update'));
|
|
170
|
+
await prepareNativePackages(root, { offline: argv.includes('--offline'), frozen: argv.includes('--frozen') });
|
|
77
171
|
process.stdout.write(`Installed ${lock.packages.length} August package(s); aug.lock.json is current.\n`);
|
|
78
172
|
}
|
|
79
173
|
else if (argv[1] === 'init') {
|
|
80
|
-
const name = argv[argv.indexOf('--name') + 1];
|
|
81
|
-
if (!
|
|
82
|
-
throw new Error('Use aug package init DIRECTORY --name @owner/name');
|
|
83
|
-
initPackage(root, name);
|
|
174
|
+
const name = argv.includes('--name') ? argv[argv.indexOf('--name') + 1] : root.split(/[\\/]/).at(-1);
|
|
175
|
+
if (!name)
|
|
176
|
+
throw new Error('Use aug package init DIRECTORY [--name @owner/name]');
|
|
177
|
+
initPackage(root, name, argv.includes('--name'));
|
|
84
178
|
process.stdout.write(`Created August library ${name} in ${root}\n`);
|
|
85
179
|
}
|
|
86
180
|
else if (argv[1] === 'pack') {
|
|
181
|
+
prepareRunPackages(root);
|
|
87
182
|
preparePackage(root);
|
|
88
183
|
const project = loadProject(root), checked = checkProject(project);
|
|
89
184
|
const tests = checkUnitTests(project, discoverTests(project).tests);
|
|
@@ -101,13 +196,13 @@ export async function main(argv) {
|
|
|
101
196
|
return 0;
|
|
102
197
|
}
|
|
103
198
|
catch (error) {
|
|
104
|
-
process.stderr.write(error
|
|
199
|
+
process.stderr.write(failureMessage(error) + '\n');
|
|
105
200
|
return 1;
|
|
106
201
|
}
|
|
107
202
|
}
|
|
108
203
|
if (command === 'lsp')
|
|
109
204
|
return runLanguageServer(resolve(argv[1] ?? process.cwd()));
|
|
110
|
-
if (!['check', 'build', 'run', 'emit-c', 'test', 'openapi', 'format', 'migrate', 'spec', 'bench', 'explain', 'context', 'symbols', 'definition',
|
|
205
|
+
if (!['check', 'build', 'run', 'emit-c', 'emit-llvm', 'emit-ir', 'test', 'openapi', 'format', 'migrate', 'spec', 'bench', 'explain', 'context', 'symbols', 'definition',
|
|
111
206
|
'complete', 'hover', 'fixes', 'semantic-tokens'].includes(command)) {
|
|
112
207
|
process.stderr.write(`Unknown command ${command}\n`);
|
|
113
208
|
usage();
|
|
@@ -116,7 +211,33 @@ export async function main(argv) {
|
|
|
116
211
|
const separator = argv.indexOf('--');
|
|
117
212
|
const options = separator >= 0 ? argv.slice(1, separator) : argv.slice(1);
|
|
118
213
|
const programArgs = separator >= 0 ? argv.slice(separator + 1) : [];
|
|
214
|
+
if (options.includes('--help')) {
|
|
215
|
+
usage();
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
const valueOptions = new Set(['--backend', '--out', '--stdin-file', '--file', '--name', '--offset', '--budget', '--baseline', '--group', '--case', '--timeout', '--iterations', '--warmup']);
|
|
219
|
+
const booleanOptions = new Set(['--json', '--coverage', '--list', '--write', '--check', '--offline', '--frozen']);
|
|
220
|
+
for (let index = 0; index < options.length; index++) {
|
|
221
|
+
const option = options[index];
|
|
222
|
+
if (valueOptions.has(option)) {
|
|
223
|
+
if (!options[index + 1] || options[index + 1].startsWith('--')) {
|
|
224
|
+
process.stderr.write(`${option} needs a value. See aug ${command} --help.\n`);
|
|
225
|
+
return 2;
|
|
226
|
+
}
|
|
227
|
+
index++;
|
|
228
|
+
}
|
|
229
|
+
else if (option.startsWith('-') && !booleanOptions.has(option)) {
|
|
230
|
+
process.stderr.write(`Unknown option ${option}. See aug ${command} --help. To pass an option to your program, put it after --.\n`);
|
|
231
|
+
return 2;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
119
234
|
const json = options.includes('--json');
|
|
235
|
+
const backendIndex = options.indexOf('--backend');
|
|
236
|
+
let backend = backendIndex < 0 ? 'llvm' : options[backendIndex + 1];
|
|
237
|
+
if (!['c', 'llvm'].includes(backend)) {
|
|
238
|
+
process.stderr.write('--backend must be c or llvm\n');
|
|
239
|
+
return 2;
|
|
240
|
+
}
|
|
120
241
|
const outIndex = options.indexOf('--out');
|
|
121
242
|
const outputOption = outIndex >= 0 ? options[outIndex + 1] : undefined;
|
|
122
243
|
const stdinIndex = options.indexOf('--stdin-file');
|
|
@@ -141,6 +262,7 @@ export async function main(argv) {
|
|
|
141
262
|
const iterations = iterationsIndex >= 0 ? Number(options[iterationsIndex + 1]) : 10;
|
|
142
263
|
const warmup = warmupIndex >= 0 ? Number(options[warmupIndex + 1]) : 2;
|
|
143
264
|
const positionals = options.filter((arg, i) => !arg.startsWith('--') &&
|
|
265
|
+
(backendIndex < 0 || i !== backendIndex + 1) &&
|
|
144
266
|
(outIndex < 0 || i !== outIndex + 1) &&
|
|
145
267
|
(stdinIndex < 0 || i !== stdinIndex + 1) &&
|
|
146
268
|
(fileIndex < 0 || i !== fileIndex + 1) &&
|
|
@@ -171,7 +293,13 @@ export async function main(argv) {
|
|
|
171
293
|
process.stdout.write(JSON.stringify(result) + '\n');
|
|
172
294
|
return 0;
|
|
173
295
|
}
|
|
296
|
+
if (!existsSync(root) || !statSync(root).isDirectory())
|
|
297
|
+
throw new Error(`Project directory does not exist: ${root}\nUse aug init DIRECTORY to create a project, or run aug run from the folder containing main.aug.`);
|
|
298
|
+
if (command === 'run')
|
|
299
|
+
prepareRunPackages(root, options.includes('--offline'), options.includes('--frozen'));
|
|
174
300
|
const project = loadProject(root, overrides);
|
|
301
|
+
if (backendIndex < 0)
|
|
302
|
+
backend = project.config.backend ?? 'llvm';
|
|
175
303
|
if (project.library && ['build', 'run', 'bench', 'openapi'].includes(command))
|
|
176
304
|
throw new Error('This is an August library; use check, test, or package pack. Import its exports from an application with main.aug to run it.');
|
|
177
305
|
if (command === 'format' || command === 'migrate') {
|
|
@@ -216,8 +344,17 @@ export async function main(argv) {
|
|
|
216
344
|
}
|
|
217
345
|
const results = [];
|
|
218
346
|
const coverage = options.includes('--coverage'), reports = [];
|
|
347
|
+
const nativeInputs = backend === 'llvm' ? await prepareNativePackages(root, { offline: options.includes('--offline'), frozen: options.includes('--frozen') }) : undefined;
|
|
348
|
+
const toolchain = backend === 'llvm' ? await prepareLLVMCompiler(options.includes('--offline'), { root, frozen: options.includes('--frozen') }) : undefined;
|
|
219
349
|
for (const [index, { unit, checked: testChecked }] of checks.entries()) {
|
|
220
|
-
|
|
350
|
+
let native;
|
|
351
|
+
if (backend === 'llvm')
|
|
352
|
+
native = compileLLVM(testChecked, { testIndex: index, coverage, native: nativeInputs, toolchain });
|
|
353
|
+
else {
|
|
354
|
+
const generated = generateC(testChecked, { coverage });
|
|
355
|
+
await prepareNativeDependencies(generated, { offline: options.includes('--offline') });
|
|
356
|
+
native = compileNative(root, generated, { testIndex: index, checked: testChecked });
|
|
357
|
+
}
|
|
221
358
|
const report = join(root, '.aug-build', 'tests', `coverage-${index}.tsv`);
|
|
222
359
|
reports.push(report);
|
|
223
360
|
if (coverage)
|
|
@@ -244,7 +381,7 @@ export async function main(argv) {
|
|
|
244
381
|
`${passed} passed, ${failed} failed\n` + (report ? `Coverage: ${report.covered}/${report.executable} statement lines (${report.percent.toFixed(1)}%); ${report.path}\n` : ''));
|
|
245
382
|
return failed ? 1 : 0;
|
|
246
383
|
}
|
|
247
|
-
|
|
384
|
+
let checked = checkProject(project);
|
|
248
385
|
const testChecks = checkUnitTests(project, discovered.tests);
|
|
249
386
|
checked.diagnostics = uniqueDiagnostics([...checked.diagnostics, ...discovered.diagnostics,
|
|
250
387
|
...testChecks.flatMap(entry => entry.checked.diagnostics)]);
|
|
@@ -305,15 +442,41 @@ export async function main(argv) {
|
|
|
305
442
|
process.stdout.write(json ? JSON.stringify(result) + '\n' : result.stale.length ? 'Stale specifications:\n' + result.stale.map(file => ' ' + file).join('\n') + '\n' : `${result.files} specification artifact(s) ${options.includes('--check') ? 'are current' : 'generated'}.\n`);
|
|
306
443
|
return result.stale.length ? 1 : 0;
|
|
307
444
|
}
|
|
308
|
-
|
|
445
|
+
if (['build', 'run', 'bench'].includes(command) && !options.includes('--frozen')) {
|
|
446
|
+
checked = updateSpecHints(checked);
|
|
447
|
+
if (checked.diagnostics.some(issue => issue.severity !== 'warning')) {
|
|
448
|
+
printDiagnostics(checked.diagnostics, json, root);
|
|
449
|
+
return 1;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if (command === 'emit-llvm') {
|
|
453
|
+
process.stdout.write(generateLLVM(lowerToIR(checked)));
|
|
454
|
+
return 0;
|
|
455
|
+
}
|
|
456
|
+
if (command === 'emit-ir') {
|
|
457
|
+
process.stdout.write(JSON.stringify(lowerToIR(checked), null, 2) + '\n');
|
|
458
|
+
return 0;
|
|
459
|
+
}
|
|
460
|
+
if ((backend === 'c' || command === 'emit-c') && checked.native.resources.size + checked.native.functions.size)
|
|
461
|
+
throw new Error('NATIVE_BACKEND: Checked native packages require --backend llvm. The C reference backend cannot lower this native ABI.');
|
|
309
462
|
if (command === 'emit-c') {
|
|
310
|
-
process.stdout.write(
|
|
463
|
+
process.stdout.write(generateC(checked));
|
|
311
464
|
return 0;
|
|
312
465
|
}
|
|
313
466
|
if (command === 'bench' && (!Number.isInteger(iterations) || iterations < 1 || iterations > 1000 ||
|
|
314
467
|
!Number.isInteger(warmup) || warmup < 0 || warmup > 100 || !Number.isInteger(timeout) || timeout < 1))
|
|
315
468
|
throw new Error('bench requires iterations 1–1000, warmup 0–100, and a positive timeout');
|
|
316
|
-
|
|
469
|
+
let native;
|
|
470
|
+
if (backend === 'llvm') {
|
|
471
|
+
const inputs = await prepareNativePackages(root, { offline: options.includes('--offline'), frozen: options.includes('--frozen') });
|
|
472
|
+
const toolchain = await prepareLLVMCompiler(options.includes('--offline'), { root, frozen: options.includes('--frozen') });
|
|
473
|
+
native = compileLLVM(checked, { output: outputOption, release: command === 'bench' || project.config.optimization === 'release', native: inputs, toolchain });
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
const generated = generateC(checked);
|
|
477
|
+
await prepareNativeDependencies(generated, { offline: options.includes('--offline') });
|
|
478
|
+
native = compileNative(root, generated, { output: outputOption, release: command === 'bench' ? true : undefined, checked });
|
|
479
|
+
}
|
|
317
480
|
const output = native.output;
|
|
318
481
|
if (native.status !== 0) {
|
|
319
482
|
if (native.diagnostics.length)
|
|
@@ -322,7 +485,8 @@ export async function main(argv) {
|
|
|
322
485
|
process.stderr.write(native.error + '\n');
|
|
323
486
|
return native.status;
|
|
324
487
|
}
|
|
325
|
-
|
|
488
|
+
if (!options.includes('--frozen'))
|
|
489
|
+
updateSpecs(checked);
|
|
326
490
|
if (command === 'build') {
|
|
327
491
|
process.stdout.write(json ? JSON.stringify({ output, sourceMap: output + '.augmap.json' }) + '\n' : `${output}\n`);
|
|
328
492
|
return 0;
|
|
@@ -334,11 +498,19 @@ export async function main(argv) {
|
|
|
334
498
|
}
|
|
335
499
|
const run = spawnSync(output, programArgs, { stdio: 'inherit', cwd: root });
|
|
336
500
|
if (run.error)
|
|
337
|
-
throw run.error;
|
|
501
|
+
throw new Error(`Cannot start the compiled program ${output}: ${run.error.message}.\nCheck executable permissions and the native shared-library paths.`);
|
|
502
|
+
if (run.signal)
|
|
503
|
+
process.stderr.write(`Program stopped by ${run.signal}. Check the runtime message above; aug run compiled and started ${output}.\n`);
|
|
504
|
+
else if (run.status !== 0)
|
|
505
|
+
process.stderr.write(`Program exited with status ${run.status}.\n`);
|
|
338
506
|
return run.status ?? 1;
|
|
339
507
|
}
|
|
340
508
|
catch (error) {
|
|
341
|
-
|
|
342
|
-
|
|
509
|
+
if (error instanceof BackendUnsupported || error instanceof IRVerificationError) {
|
|
510
|
+
printDiagnostics([{ ...error.span, code: error.code, message: error.message }], json, root);
|
|
511
|
+
return 1;
|
|
512
|
+
}
|
|
513
|
+
process.stderr.write(failureMessage(error) + '\n');
|
|
514
|
+
return error instanceof Error && 'exitCode' in error && typeof error.exitCode === 'number' ? error.exitCode : 1;
|
|
343
515
|
}
|
|
344
516
|
}
|
package/src/codegen.js
CHANGED
|
@@ -154,7 +154,7 @@ class CGenerator {
|
|
|
154
154
|
` aug_register_globals(aug_bindings, ${bindingCount});`,
|
|
155
155
|
` aug_set_cli_args(argc, argv);`,
|
|
156
156
|
...([...this.activeFiles].some(file => this.checked.project.files.get(file)?.items.some(item => item.kind === 'function' && !!item.endpoint) ||
|
|
157
|
-
|
|
157
|
+
this.checked.project.files.get(file)?.items.some(item => item.kind === 'function' && item.externC && item.name.startsWith('_aug_http_'))) ? [this.httpConfiguration()] : []),
|
|
158
158
|
...[...this.coverage.values()].map(point => ` aug_coverage_register(${cString(point.file)}, ${point.line});`),
|
|
159
159
|
initializeBindings,
|
|
160
160
|
` AugValue result = aug_main_body(NULL, 0);`,
|
|
@@ -206,7 +206,8 @@ class CGenerator {
|
|
|
206
206
|
` AugValue value = roots[${cls.fields.length}];`,
|
|
207
207
|
` value.as.object->field_names = ${this.name(def)}_field_names;`,
|
|
208
208
|
...(cls.kind === 'class' && initializationOf(cls).length ? [` ${this.initializerName(def)}(value, NULL, 0);`] : []),
|
|
209
|
-
|
|
209
|
+
` if (aug_has_error) { aug_drop_partial(value); value = aug_scalar_null(); }`,
|
|
210
|
+
...(cls.kind === 'class' && cls.record ? [' if (!aug_has_error) aug_freeze(value);'] : []),
|
|
210
211
|
` aug_frame_leave(&frame);`,
|
|
211
212
|
` return value;`,
|
|
212
213
|
`}`,
|
|
@@ -377,18 +378,25 @@ class BodyEmitter {
|
|
|
377
378
|
locals = new Map();
|
|
378
379
|
owned = new Set();
|
|
379
380
|
classFields = new Map();
|
|
381
|
+
ownedClassFields = new Set();
|
|
380
382
|
scalarSlots = new Set();
|
|
381
383
|
slots = 1;
|
|
382
384
|
labelCounter = 0;
|
|
383
385
|
errorTarget = 'aug_cleanup';
|
|
384
386
|
returnTarget = 'aug_cleanup';
|
|
385
387
|
continuation;
|
|
388
|
+
constructionNext = false;
|
|
389
|
+
constructorResults = new Set();
|
|
386
390
|
constructor(generator, file, def, owner) {
|
|
387
391
|
this.generator = generator;
|
|
388
392
|
this.file = file;
|
|
389
393
|
this.def = def;
|
|
390
394
|
if (owner)
|
|
391
|
-
fieldsOf(owner).forEach((field, index) =>
|
|
395
|
+
fieldsOf(owner).forEach((field, index) => {
|
|
396
|
+
this.classFields.set(field.name, index);
|
|
397
|
+
if (field.ownership === 'own')
|
|
398
|
+
this.ownedClassFields.add(field.name);
|
|
399
|
+
});
|
|
392
400
|
}
|
|
393
401
|
addParameter(name, index, owned = false) {
|
|
394
402
|
const slot = this.newSlot();
|
|
@@ -398,6 +406,7 @@ class BodyEmitter {
|
|
|
398
406
|
this.owned.add(slot);
|
|
399
407
|
}
|
|
400
408
|
initializeInterceptor(layer, params, name, method) {
|
|
409
|
+
this.constructionNext = layer.constructorResultFresh === true;
|
|
401
410
|
const receiver = method ? this.newSlot() : undefined;
|
|
402
411
|
if (receiver !== undefined)
|
|
403
412
|
this.line(`${this.slot(receiver)} = self;`);
|
|
@@ -448,6 +457,8 @@ class BodyEmitter {
|
|
|
448
457
|
const slot = this.newSlot();
|
|
449
458
|
this.line(`${this.slot(slot)} = ${next.target}(${next.receiver === undefined ? '' :
|
|
450
459
|
`${this.slot(next.receiver)}, `}${array}, ${args.length});`);
|
|
460
|
+
if (this.constructionNext)
|
|
461
|
+
this.constructorResults.add(slot);
|
|
451
462
|
this.line(`if (aug_has_error) goto ${this.errorTarget};`);
|
|
452
463
|
return slot;
|
|
453
464
|
}
|
|
@@ -478,7 +489,8 @@ class BodyEmitter {
|
|
|
478
489
|
if (expr.kind === 'handle' && expr.call.kind === 'call') {
|
|
479
490
|
const plan = this.generator.actionPlan(expr), endpoint = plan.endpoint.node.endpoint;
|
|
480
491
|
const metadata = { method: endpoint.method, path: endpoint.path, parameters: plan.parameters.map(({ param, type, form }) => ({ name: param.source?.name ?? param.name, source: param.source?.kind, form, schema: this.generator.actionSchema(type) })) };
|
|
481
|
-
const
|
|
492
|
+
const values = expr.call.args.map(argument => argument.kind === 'formInput' ? undefined : this.emitExpr(argument));
|
|
493
|
+
const args = plan.parameters.map(parameter => parameter.form || parameter.source === undefined ? undefined : values[parameter.source]);
|
|
482
494
|
const array = this.label('action_values'), slot = this.newSlot();
|
|
483
495
|
this.line(`AugValue ${array}[] = {${args.map(arg => arg === undefined ? 'aug_null()' : this.slot(arg)).join(', ') || 'aug_scalar_null()'}};`);
|
|
484
496
|
this.line(`${this.slot(slot)} = aug_http_action(${cString(JSON.stringify(metadata))}, ${array}, ${args.length});`);
|
|
@@ -513,7 +525,9 @@ class BodyEmitter {
|
|
|
513
525
|
thunk.line(`${thunk.slot(0)} = ${thunk.slot(result)};`);
|
|
514
526
|
const name = this.generator.taskThunk(thunk, args.length), array = this.label('task_args'), slot = this.newSlot();
|
|
515
527
|
this.line(`AugValue ${array}[] = {${args.map(arg => this.slot(arg)).join(', ') || 'aug_scalar_null()'}};`);
|
|
516
|
-
|
|
528
|
+
const captures = this.label('task_owned');
|
|
529
|
+
this.line(`const unsigned char ${captures}[] = {${args.map((_, i) => this.generator.callPlan(call)?.ownerships?.[i] === 'own' ? '1' : '0').join(', ') || '0'}};`);
|
|
530
|
+
this.line(`${this.slot(slot)} = aug_task_start_owned(${name}, ${receiver === undefined ? 'aug_scalar_null()' : this.slot(receiver)}, ${array}, ${args.length}, ${captures});`);
|
|
517
531
|
this.clearMovedArgs(call, (this.generator.callPlan(call)?.ownerships ?? []).map(ownership => ({ ownership: ownership ?? 'managed' })));
|
|
518
532
|
this.line(`if (aug_has_error) goto ${this.errorTarget};`);
|
|
519
533
|
return slot;
|
|
@@ -946,6 +960,8 @@ class BodyEmitter {
|
|
|
946
960
|
this.line(`aug_set_field(${this.slot(object)}, ${this.memberIndex(stmt.target.object, stmt.target.name)}, ${this.slot(value)});`);
|
|
947
961
|
}
|
|
948
962
|
let targetOwns = stmt.ownership === 'own';
|
|
963
|
+
if (stmt.target.kind === 'name' && !this.locals.has(stmt.target.name))
|
|
964
|
+
targetOwns ||= this.ownedClassFields.has(stmt.target.name);
|
|
949
965
|
if (stmt.target.kind === 'member') {
|
|
950
966
|
const memberName = stmt.target.name;
|
|
951
967
|
const node = this.generator.expressionType(stmt.target.object)?.def?.node;
|
|
@@ -1058,6 +1074,7 @@ class BodyEmitter {
|
|
|
1058
1074
|
}
|
|
1059
1075
|
emitTryAlways(stmt) {
|
|
1060
1076
|
const outerError = this.errorTarget, outerReturn = this.returnTarget;
|
|
1077
|
+
const ownedBefore = new Set(this.owned);
|
|
1061
1078
|
const caught = this.label('aug_final_catch'), failed = this.label('aug_final_error'), returned = this.label('aug_final_return');
|
|
1062
1079
|
const cleanup = this.label('aug_always'), done = this.label('aug_always_done'), after = this.label('aug_always_after');
|
|
1063
1080
|
const reason = this.label('aug_exit_reason'), depth = this.label('aug_final_depth'), cancellation = this.label('aug_final_cancel');
|
|
@@ -1070,8 +1087,11 @@ class BodyEmitter {
|
|
|
1070
1087
|
this.emitScoped(stmt.body);
|
|
1071
1088
|
this.line(`goto ${cleanup};`);
|
|
1072
1089
|
this.line(`${caught}:;`);
|
|
1073
|
-
this.line(`aug_scope_restore(${depth}); if (aug_cancelled) goto ${failed};`);
|
|
1074
1090
|
this.line(`aug_lock_restore(${locks});`);
|
|
1091
|
+
this.line(`aug_scope_restore(${depth}); if (aug_cancelled) goto ${failed};`);
|
|
1092
|
+
for (const slot of this.owned)
|
|
1093
|
+
if (!ownedBefore.has(slot))
|
|
1094
|
+
this.line(`aug_drop(${this.slot(slot)}); ${this.slot(slot)} = aug_scalar_null();`);
|
|
1075
1095
|
this.errorTarget = failed;
|
|
1076
1096
|
for (const clause of stmt.catches) {
|
|
1077
1097
|
this.line(`if (aug_error_is(${cString(clause.type.name)})) {`);
|
|
@@ -1087,8 +1107,12 @@ class BodyEmitter {
|
|
|
1087
1107
|
this.line(`${returned}: ${reason} = 1; goto ${cleanup};`);
|
|
1088
1108
|
this.line(`${failed}: ${reason} = 2;`);
|
|
1089
1109
|
this.line(`${cleanup}:;`);
|
|
1090
|
-
this.line(`aug_scope_restore(${depth}); ${this.slot(pending)} = aug_has_error ? aug_take_error() : aug_scalar_null();`);
|
|
1091
1110
|
this.line(`aug_lock_restore(${locks});`);
|
|
1111
|
+
this.line(`aug_scope_restore(${depth});`);
|
|
1112
|
+
for (const slot of this.owned)
|
|
1113
|
+
if (!ownedBefore.has(slot))
|
|
1114
|
+
this.line(`aug_drop(${this.slot(slot)}); ${this.slot(slot)} = aug_scalar_null();`);
|
|
1115
|
+
this.line(`${this.slot(pending)} = aug_has_error ? aug_take_error() : aug_scalar_null();`);
|
|
1092
1116
|
this.line(`${cancellation} = aug_cancelled; aug_cancelled = false;`);
|
|
1093
1117
|
this.errorTarget = done;
|
|
1094
1118
|
this.returnTarget = done;
|
|
@@ -1149,6 +1173,7 @@ class BodyEmitter {
|
|
|
1149
1173
|
` aug_lock_restore(aug_lock_base);`,
|
|
1150
1174
|
` aug_scope_join_to(aug_scope_base);`,
|
|
1151
1175
|
ownedCleanup,
|
|
1176
|
+
...[...this.constructorResults].map(slot => ` aug_constructor_result_cleanup(${this.slot(slot)}, ${this.slot(0)});`),
|
|
1152
1177
|
` aug_scope_restore(aug_scope_base);`,
|
|
1153
1178
|
` AugValue result = ${this.slot(0)};`,
|
|
1154
1179
|
` aug_frame_leave(&frame);`,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
5
|
+
import { compilerVersion } from "./package-manager.js";
|
|
6
|
+
import { ensureVerifiedArchive } from "./native-artifacts.js";
|
|
7
|
+
import { nativeHostTarget } from "./native-contracts.js";
|
|
8
|
+
import { withPackageLockAsync } from "./package-locking.js";
|
|
9
|
+
import { readRuntimePack } from "./llvm-native.js";
|
|
10
|
+
import { llvmPlatform } from "./llvm-platform.js";
|
|
11
|
+
/** The CLI owns installation. Packages cannot choose or execute a compiler driver. */
|
|
12
|
+
export async function prepareLLVMCompiler(offline = false, project) {
|
|
13
|
+
const compilerRoot = resolve(fileURLToPath(new URL('..', import.meta.url)));
|
|
14
|
+
const platform = llvmPlatform();
|
|
15
|
+
if (process.env.AUG_LLVM_HOME) {
|
|
16
|
+
const tools = resolve(process.env.AUG_LLVM_HOME), runtime = resolve(process.env.AUG_RUNTIME_PACK ?? join(compilerRoot, '.aug-native/llvm/runtime'));
|
|
17
|
+
const version = spawnSync(join(tools, 'bin/llc'), ['--version'], { encoding: 'utf8' });
|
|
18
|
+
if (version.status !== 0 || !version.stdout.includes('LLVM version 23.1.2'))
|
|
19
|
+
throw new Error('LLVM_TOOLS: Contributor override requires LLVM 23.1.2');
|
|
20
|
+
readRuntimePack(runtime);
|
|
21
|
+
if (project?.frozen)
|
|
22
|
+
throw new Error('LLVM_LOCK: A frozen build requires the pinned compiler pack. Remove contributor toolchain overrides.');
|
|
23
|
+
return { tools, runtime, developmentOverride: true };
|
|
24
|
+
}
|
|
25
|
+
const file = join(compilerRoot, 'native/compiler-packs.json');
|
|
26
|
+
if (!existsSync(file))
|
|
27
|
+
throw new Error('LLVM_TOOLS: This compiler has no published LLVM tool manifest. Install the matching LLVM preview release.');
|
|
28
|
+
const manifest = JSON.parse(readFileSync(file, 'utf8'));
|
|
29
|
+
if (manifest.format !== 1 || manifest.compiler !== compilerVersion() || manifest.llvm !== '23.1.2' || !Array.isArray(manifest.packs))
|
|
30
|
+
throw new Error('LLVM_TOOLS: Invalid compiler-owned LLVM manifest');
|
|
31
|
+
const host = process.platform + '-' + process.arch, target = nativeHostTarget(), pack = manifest.packs.find(p => p.host === host && p.target === target.triple);
|
|
32
|
+
if (!pack)
|
|
33
|
+
throw new Error('NATIVE_TARGET: No compiler pack is published for ' + platform.host + '. Available compiler packs: ' + manifest.packs.map(p => p.host).join(', '));
|
|
34
|
+
if (pack.minimumOS !== platform.minimumOS || pack.minimumLibc !== platform.minimumLibc)
|
|
35
|
+
throw new Error('LLVM_TOOLS: Compiler manifest has a different platform baseline');
|
|
36
|
+
const prepare = async () => {
|
|
37
|
+
const lockFile = project ? join(project.root, 'aug.lock.json') : undefined, initial = lockFile && existsSync(lockFile) ? readFileSync(lockFile, 'utf8') : undefined;
|
|
38
|
+
const lock = initial ? JSON.parse(initial) : { format: 1, compiler: compilerVersion(), specifications: {}, roots: {}, packages: [], npm: {} };
|
|
39
|
+
if (lock.compiler !== compilerVersion())
|
|
40
|
+
throw new Error('LLVM_LOCK: Project lock belongs to another compiler. Run aug install.');
|
|
41
|
+
const previous = lock.native?.compilers?.[host];
|
|
42
|
+
if (project?.frozen && (!previous || previous.artifactSha256 !== pack.archive.sha256))
|
|
43
|
+
throw new Error('LLVM_LOCK: Frozen build has no matching compiler artifact for ' + host + '. Run aug build --backend llvm online once on this host.');
|
|
44
|
+
const directory = await ensureVerifiedArchive(pack.archive, { offline, executables: platform.tools.map(tool => 'bin/' + tool) });
|
|
45
|
+
const identity = JSON.parse(readFileSync(join(directory, 'compiler-pack.json'), 'utf8'));
|
|
46
|
+
if (identity.format !== 1 || identity.compiler !== manifest.compiler || identity.llvm !== manifest.llvm || identity.host !== host || identity.target !== target.triple)
|
|
47
|
+
throw new Error('LLVM_TOOLS: Verified archive has a different compiler/host/target identity');
|
|
48
|
+
const runtime = readRuntimePack(join(directory, 'runtime'));
|
|
49
|
+
if (identity.runtime !== runtime.sourceSha256)
|
|
50
|
+
throw new Error('LLVM_TOOLS: Compiler pack runtime identity differs from its runtime manifest');
|
|
51
|
+
const selection = { version: manifest.compiler, llvm: manifest.llvm, host, target: target.triple, artifactSha256: pack.archive.sha256, runtimeSha256: runtime.sourceSha256 };
|
|
52
|
+
if (project?.frozen && JSON.stringify(previous) !== JSON.stringify(selection))
|
|
53
|
+
throw new Error('LLVM_LOCK: Frozen compiler/runtime identity changed for ' + host);
|
|
54
|
+
if (lockFile && !project?.frozen) {
|
|
55
|
+
lock.native ??= { format: 1, targets: {} };
|
|
56
|
+
lock.native.compilers ??= {};
|
|
57
|
+
lock.native.compilers[host] = selection;
|
|
58
|
+
if ((existsSync(lockFile) ? readFileSync(lockFile, 'utf8') : undefined) !== initial)
|
|
59
|
+
throw new Error('LLVM_LOCK: Source lock changed during compiler installation; retry');
|
|
60
|
+
writeFileSync(lockFile + '.llvm.tmp', JSON.stringify(lock, null, 2) + '\n');
|
|
61
|
+
renameSync(lockFile + '.llvm.tmp', lockFile);
|
|
62
|
+
}
|
|
63
|
+
return { tools: directory, runtime: join(directory, 'runtime'), archiveSha256: pack.archive.sha256, developmentOverride: false };
|
|
64
|
+
};
|
|
65
|
+
return project ? withPackageLockAsync(join(project.root, '.aug-install.lock'), prepare) : prepare();
|
|
66
|
+
}
|
package/src/config.js
CHANGED
|
@@ -55,7 +55,7 @@ export function loadConfig(root) {
|
|
|
55
55
|
seen.add(path);
|
|
56
56
|
if (path.startsWith('packages.')) {
|
|
57
57
|
if (!/^[a-z][a-z0-9_]*$/.test(entry[1]) || entry[1] === 'august' || !value)
|
|
58
|
-
report(index + 1, 'Packages map lowercase public aliases to local paths or npm:name@exact-version');
|
|
58
|
+
report(index + 1, 'Packages map lowercase public aliases to repository URLs, local paths, or npm:name@exact-version');
|
|
59
59
|
else
|
|
60
60
|
config.packages[entry[1]] = value;
|
|
61
61
|
continue;
|
|
@@ -101,7 +101,7 @@ export function loadConfig(root) {
|
|
|
101
101
|
}
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
|
-
if (!entry || !(entry[1] in config || entry[1]
|
|
104
|
+
if (!entry || !(entry[1] in config || ['output', 'backend'].includes(entry[1]))) {
|
|
105
105
|
report(index + 1, `Unsupported configuration line ${JSON.stringify(raw)}`);
|
|
106
106
|
continue;
|
|
107
107
|
}
|
|
@@ -131,7 +131,7 @@ export function loadConfig(root) {
|
|
|
131
131
|
config[key] = Number(value);
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
|
-
const choices = { optimization: ['debug', 'release'], assignment: ['equals', 'to'],
|
|
134
|
+
const choices = { backend: ['c', 'llvm'], optimization: ['debug', 'release'], assignment: ['equals', 'to'],
|
|
135
135
|
block_style: ['braces', 'indent'], indentation: ['spaces', 'tabs'] };
|
|
136
136
|
if (!value || choices[key] && !choices[key].includes(value))
|
|
137
137
|
report(index + 1, `${key} needs ${choices[key]?.join(' or ') ?? 'a value'}`);
|
package/src/contracts.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { schemaType } from "./schemas.js";
|
|
2
|
+
import { tyName } from "./types.js";
|
|
3
|
+
/** Checked contracts shared by the editor, documentation and wire schemas. */
|
|
4
|
+
export function callableResult(checked, method) {
|
|
5
|
+
return checked.callableContracts.get(method)?.result ?? schemaType(checked.project, method.returns, method.span.file);
|
|
6
|
+
}
|
|
7
|
+
export function callableErrors(checked, method) {
|
|
8
|
+
return [...new Set([...(checked.callableContracts.get(method)?.errors.map(tyName) ?? method.throws.map(type => tyName(schemaType(checked.project, type, method.span.file)))),
|
|
9
|
+
...(checked.interceptorPlans.get(method) ?? []).flatMap(layer => layer.errors.map(tyName))])].sort();
|
|
10
|
+
}
|