diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 5a379eb..6f6dc3f 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -58,7 +58,9 @@ jobs: - name: Format Spore files run: | - paths=(examples platform) + # `src/host.sp` is the package host entry; validate it via package/example flows, + # not standalone file-mode formatting. + paths=(examples src/basic_cli) if [ -d tests ]; then paths+=(tests) fi @@ -67,7 +69,9 @@ jobs: - name: Check Spore files run: | - paths=(examples platform) + # `src/host.sp` is the package host entry; validate it via package/example flows, + # not standalone file-mode checks. + paths=(examples src/basic_cli) if [ -d tests ]; then paths+=(tests) fi @@ -75,7 +79,9 @@ jobs: - name: Build Spore files run: | - paths=(examples platform) + # `src/host.sp` is the package host entry; validate it via package/example flows, + # not standalone file-mode builds. + paths=(examples src/basic_cli) if [ -d tests ]; then paths+=(tests) fi diff --git a/.gitignore b/.gitignore index 7c76b93..3a34a7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Build artifacts target/ host/target/ +/.spore-store # OS .DS_Store diff --git a/README.md b/README.md index bfd16e7..8a19506 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ Operating System | Module | Capabilities | Description | |--------|-------------|-------------| -| `Stdout` | `uses [Console]` | Standard output | -| `Stdin` | `uses [Console]` | Standard input | -| `File` | `uses [FileRead]` or `uses [FileWrite]` | File system operations | -| `Dir` | `uses [FileRead]` or `uses [FileWrite]` | Directory listing and creation | -| `Env` | `uses [Env]` | Environment variables | -| `Cmd` | `uses [Spawn]` | Process execution | +| `basic_cli.stdout` | `uses [Console]` | Standard output | +| `basic_cli.stdin` | `uses [Console]` | Standard input | +| `basic_cli.file` | `uses [FileRead]` or `uses [FileWrite]` | File system operations | +| `basic_cli.dir` | `uses [FileRead]` or `uses [FileWrite]` | Directory listing and creation | +| `basic_cli.env` | `uses [Env]` | Environment variables | +| `basic_cli.cmd` | `uses [Spawn]` | Process execution | ## Quick Start @@ -43,19 +43,21 @@ spore run examples/hello.sp ``` This repository currently keeps `examples/` limited to files that PR CI validates today. -It also intentionally keeps the current loose `.sp` file layout for now; the manifest/package-layout migration is deferred to a follow-up change. ## Project Structure ``` basic-cli/ -├── platform/ # Spore API modules (.sp files), checked and built in CI -│ ├── Stdout.sp # Standard output operations -│ ├── Stdin.sp # Standard input operations -│ ├── File.sp # File read/write operations -│ ├── Dir.sp # Directory operations -│ ├── Env.sp # Environment variable access -│ ├── Cmd.sp # Process execution +├── spore.toml # Platform manifest +├── src/ +│ ├── host.sp # Default platform entry point +│ └── basic_cli/ # Spore API modules, checked and built in CI +│ ├── stdout.sp # Standard output operations +│ ├── stdin.sp # Standard input operations +│ ├── file.sp # File read/write operations +│ ├── dir.sp # Directory operations +│ ├── env.sp # Environment variable access +│ └── cmd.sp # Process execution ├── host/ # Rust host implementation │ ├── Cargo.toml │ └── src/ @@ -66,7 +68,7 @@ basic-cli/ ## Tutorial Contract - `examples/` is for truthful, CI-validated examples only. -- `platform/` is the API surface for the platform modules themselves. +- `src/basic_cli/` is the API surface for the platform modules themselves. - Only add `tests/` when the repo has real Spore-side regression coverage worth running with `spore test`. If you want to add a new tutorial/example, treat this as the bar: diff --git a/spore.toml b/spore.toml new file mode 100644 index 0000000..cc23f3f --- /dev/null +++ b/spore.toml @@ -0,0 +1,10 @@ +[package] +name = "basic-cli" +version = "0.1.0" +type = "platform" +spore-version = ">=0.1.0" + +[capabilities] +allow = ["Compute"] + +[dependencies] diff --git a/platform/Cmd.sp b/src/basic_cli/cmd.sp similarity index 100% rename from platform/Cmd.sp rename to src/basic_cli/cmd.sp diff --git a/platform/Dir.sp b/src/basic_cli/dir.sp similarity index 100% rename from platform/Dir.sp rename to src/basic_cli/dir.sp diff --git a/platform/Env.sp b/src/basic_cli/env.sp similarity index 100% rename from platform/Env.sp rename to src/basic_cli/env.sp diff --git a/platform/File.sp b/src/basic_cli/file.sp similarity index 100% rename from platform/File.sp rename to src/basic_cli/file.sp diff --git a/platform/Stdin.sp b/src/basic_cli/stdin.sp similarity index 100% rename from platform/Stdin.sp rename to src/basic_cli/stdin.sp diff --git a/platform/Stdout.sp b/src/basic_cli/stdout.sp similarity index 100% rename from platform/Stdout.sp rename to src/basic_cli/stdout.sp diff --git a/src/host.sp b/src/host.sp new file mode 100644 index 0000000..389a630 --- /dev/null +++ b/src/host.sp @@ -0,0 +1,6 @@ +/// Platform startup adapter. +/// This is where the platform sets up effect handlers before calling the application startup function. +pub fn main_for_host(app_main: () -> ()) -> () { + app_main() + return +}