Skip to content

Commit 5bc9dcd

Browse files
Copilotzrr1999
andauthored
Merge remote-tracking branch 'origin/main' into quality/basic-cli-ci-hygiene
# Conflicts: # .github/workflows/ci-tests.yml # README.md # spore.toml Co-authored-by: zrr1999 <46243324+zrr1999@users.noreply.github.com>
2 parents da38eae + b3d371d commit 5bc9dcd

14 files changed

Lines changed: 76 additions & 115 deletions

File tree

.github/workflows/ci-static-checks.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16-
actionlint:
17-
name: actionlint
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v6
21-
- uses: rhysd/actionlint@v1.7.12
22-
2316
prek:
2417
name: prek
2518
runs-on: ubuntu-latest

.github/workflows/ci-tests.yml

Lines changed: 15 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -36,97 +36,38 @@ jobs:
3636
spore:
3737
name: spore
3838
runs-on: ubuntu-latest
39-
env:
40-
SPORE_REPOSITORY: spore-lang/spore
41-
SPORE_REF: d96212aa5a4cfe24759c21d8690642adfd357018
4239
steps:
4340
- uses: actions/checkout@v6
4441

45-
- uses: actions/checkout@v6
46-
with:
47-
repository: ${{ env.SPORE_REPOSITORY }}
48-
ref: ${{ env.SPORE_REF }}
49-
path: _spore
42+
- uses: astral-sh/setup-uv@v6
5043

5144
- uses: dtolnay/rust-toolchain@stable
5245
with:
53-
toolchain: stable
54-
55-
- uses: Swatinem/rust-cache@v2
56-
with:
57-
workspaces: _spore
46+
toolchain: 1.95
5847

59-
- name: Build spore compiler
60-
run: cargo build --release --manifest-path _spore/Cargo.toml --bin spore
48+
- name: Install spore CLI
49+
run: uv tool install spore-lang==0.0.3
6150

6251
- name: Format Spore files
63-
run: |
64-
# `src/host.sp` is a legacy compatibility shim; validate package-backed behavior
65-
# via the example and platform modules rather than standalone file-mode checks.
66-
# Standalone file examples
67-
find examples -maxdepth 1 -name '*.sp' -type f | sort | xargs _spore/target/release/spore format
68-
# Project-mode examples (format their src files)
69-
if [ -d examples/hello-app/src ]; then
70-
find examples/hello-app/src -name '*.sp' -type f | sort | xargs _spore/target/release/spore format
71-
fi
72-
# Platform API modules
73-
find src/basic_cli -name '*.sp' -type f | sort | xargs _spore/target/release/spore format
74-
# Check tests if they exist
75-
if [ -d tests ]; then
76-
find tests -name '*.sp' -type f | sort | xargs _spore/target/release/spore format
77-
fi
78-
git diff --exit-code
52+
run: spore format --check
7953

8054
- name: Check Spore files
8155
run: |
82-
# `src/host.sp` is a legacy compatibility shim; validate package-backed behavior
83-
# via the example and platform modules rather than standalone file-mode checks.
84-
# Standalone file examples
85-
find examples -maxdepth 1 -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore check
86-
# Platform API modules
87-
find src/basic_cli -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore check
88-
# Project-mode examples: validate with spore check
89-
if [ -d examples/hello-app ]; then
90-
echo "✓ Checking project-mode example examples/hello-app/src/main.sp"
91-
_spore/target/release/spore check examples/hello-app/src/main.sp
92-
fi
93-
# Check tests if they exist
94-
if [ -d tests ]; then
95-
find tests -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore check
96-
fi
56+
find src/basic_cli -name '*.sp' -type f | sort | xargs -n 1 spore check
57+
spore check examples/hello-app/src/main.sp
9758
9859
- name: Build Spore files
9960
run: |
100-
# `src/host.sp` is a legacy compatibility shim; validate package-backed behavior
101-
# via the example and platform modules rather than standalone file-mode builds.
102-
# Standalone file examples
103-
find examples -maxdepth 1 -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore build
104-
# Platform API modules
105-
find src/basic_cli -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore build
106-
# Project-mode examples: validate with spore build
107-
if [ -d examples/hello-app ]; then
108-
echo "✓ Building project-mode example examples/hello-app/src/main.sp"
109-
_spore/target/release/spore build examples/hello-app/src/main.sp
110-
fi
111-
# Check tests if they exist
112-
if [ -d tests ]; then
113-
find tests -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore build
114-
fi
115-
116-
- name: Run standalone hello example
117-
run: _spore/target/release/spore run examples/hello.sp
61+
find src/basic_cli -name '*.sp' -type f | sort | xargs -n 1 spore build
62+
spore build examples/hello-app/src/main.sp
11863
11964
- name: Run project-mode hello-app example
12065
run: |
121-
if [ -d examples/hello-app ]; then
122-
echo "✓ Running project-mode example examples/hello-app/src/main.sp"
123-
_spore/target/release/spore run examples/hello-app/src/main.sp
124-
fi
66+
(
67+
cd examples/hello-app
68+
echo "✓ Running project-mode example (default entry)"
69+
spore run src/main.sp
70+
)
12571
12672
- name: Run Spore spec tests
127-
run: |
128-
if [ ! -d tests ]; then
129-
echo "No Spore spec tests yet; skipping spore test."
130-
exit 0
131-
fi
132-
find tests -name '*.sp' -type f | sort | xargs -r -n 1 _spore/target/release/spore test
73+
run: spore test

.learnings/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Project Learnings
2+
3+
## Gotchas
4+
- [Spore CI should target project-mode files explicitly](gotchas/spore-ci-project-mode.md) — spore, ci, project-mode
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "Spore CI should target project-mode files explicitly"
3+
category: gotchas
4+
tags: [spore, ci, project-mode, basic-cli]
5+
created: 2026-04-28
6+
context: "basic-cli CI needed to validate a package-backed example with the shipped compiler"
7+
---
8+
9+
## Problem
10+
11+
The current `spore` CLI validates package-backed examples reliably when given the explicit entry file, but bare directory invocations and standalone file assumptions can fail depending on current compiler surface and imports.
12+
13+
## Solution
14+
15+
Use explicit file targets for project-mode checks:
16+
17+
```bash
18+
spore check examples/hello-app/src/main.sp
19+
spore build examples/hello-app/src/main.sp
20+
cd examples/hello-app && spore run src/main.sp
21+
```
22+
23+
## Key points
24+
25+
- Keep CI focused on the canonical package-backed entry file.
26+
- Treat standalone `.sp` examples as separate from project-mode validation.
27+
- Re-run `spore format --check`, `spore check`, and `spore build` against explicit files when compiler behavior is in flux.

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# basic-cli
22

3-
Basic CLI platform for [Spore](https://github.com/spore-lang/spore) — provides file I/O, process execution, environment variables, and standard I/O capabilities.
3+
Basic CLI platform for [Spore](https://github.com/spore-lang/spore) — provides file I/O, process execution, environment variables, and standard I/O effects.
44

55
## Overview
66

7-
In Spore, a **platform** bridges the pure, capability-tracked language with real-world side effects. `basic-cli` is the standard platform for command-line applications.
7+
In Spore, a **platform** bridges the pure, effect-tracked language with real-world side effects. `basic-cli` is the standard platform for command-line applications.
88

99
```
10-
Your Spore App (pure, capability-checked)
10+
Your Spore App (pure, effect-checked)
1111
↕ (effect dispatch)
1212
basic-cli Platform API (.sp modules)
1313
↕ (foreign fn)
@@ -18,7 +18,7 @@ Operating System
1818

1919
## Modules
2020

21-
| Module | Capabilities | Description |
21+
| Module | Effects | Description |
2222
|--------|-------------|-------------|
2323
| `basic_cli.stdout` | `uses [Console]` | Standard output |
2424
| `basic_cli.stdin` | `uses [Console]` | Standard input |
@@ -46,9 +46,6 @@ default-entry = "app"
4646
[entries.app]
4747
path = "main.sp"
4848

49-
[capabilities]
50-
allow = ["Compute"]
51-
5249
[dependencies]
5350
basic-cli = { path = "../.." }
5451
```
@@ -100,19 +97,19 @@ basic-cli/
10097

10198
The current Platform contract MVP is intentionally split across two artifacts:
10299

103-
1. `spore.toml` `[platform]` metadata names the contract module, the startup contract symbol, the adapter function, and the handled capabilities.
100+
1. `spore.toml` `[platform]` metadata names the contract module, the startup contract symbol, the adapter function, and the handled effects.
104101
2. `src/platform_contract.sp` owns the startup contract itself:
105102
- a hole-backed `main` function carries the authoritative startup signature
106103
- `main_for_host` is the Platform-owned adapter that receives the application startup function
107104

108-
Applications targeting `basic-cli` must implement the same startup function name/signature in their entry module. The current compiler already resolves the package's `[platform]` metadata and `src/platform_contract.sp` to validate that startup shape. Runtime support is currently specialized to package-backed `basic-cli`: imported `basic_cli.*` foreign functions route through the built-in basic-cli host profile, while generic `[platform].handled-effects` enforcement and startup `spec` stacking are still follow-up work.
105+
Applications targeting `basic-cli` must implement the same startup function name/signature in their entry module. The current compiler already resolves the package's `[platform]` metadata and `src/platform_contract.sp` to validate that startup shape. Runtime support is currently specialized to package-backed `basic-cli`: imported `basic_cli.*` foreign functions route through the built-in basic-cli host profile, while generic handled-effects enforcement and startup `spec` stacking are still follow-up work.
109106

110107
`src/host.sp` remains as a compatibility copy of the adapter for older references; current manifest-backed projects use `src/platform_contract.sp`.
111108

112109
## Tutorial Contract
113110

114111
- `examples/hello-app/` is the **canonical project-mode example** — it is formatted, checked, built, and run in CI.
115-
- `examples/hello.sp` is a minimal standalone file for quick experiments (also validated in CI).
112+
- `examples/hello.sp` is a minimal standalone file for quick experiments.
116113
- `src/basic_cli/` is the API surface for the platform modules themselves.
117114
- `src/platform_contract.sp` is the package-owned startup contract surface.
118115
- Only add `tests/` when the repo has real Spore-side regression coverage worth running with `spore test`.
@@ -125,9 +122,9 @@ If you want to add a new tutorial/example, treat this as the bar:
125122

126123
## Design Philosophy
127124

128-
Following Spore's [SEP-0003 (Effect Capability System)](https://github.com/spore-lang/spore-evolution/blob/main/seps/SEP-0003-effect-capability-system.md):
125+
Following Spore's [SEP-0003 (Effect System)](https://github.com/spore-lang/spore-evolution/blob/main/seps/SEP-0003-effect-system.md):
129126

130-
- **Capability-gated**: Every I/O function declares its required capabilities via `uses [Cap]`
127+
- **Effect-gated**: Every I/O function declares its required effects via `uses [Effect]`
131128
- **Cost-annotated**: Platform functions can carry `cost [c, a, i, p]` budgets where meaningful
132129
- **Error-typed**: Functions declare error sets via `! ErrorType`
133130
- **Pure by default**: The platform boundary is the only place side effects occur
@@ -138,7 +135,7 @@ Following Spore's [SEP-0003 (Effect Capability System)](https://github.com/spore
138135

139136
The canonical example is the **package-backed project-mode** `examples/hello-app/` application. It already validates and runs with `[project].platform = "basic-cli"`, an in-repo path dependency, and `import basic_cli.stdout`.
140137

141-
The standalone file example (`examples/hello.sp`) stays around for quick experiments. The main remaining platform gaps are generic `[platform].handled-effects` enforcement, startup `spec` stacking, and lifting the runtime from its current explicit `basic-cli` host profile to a more general package-backed mechanism.
138+
The standalone file example (`examples/hello.sp`) stays around for quick experiments. The main remaining platform gaps are generic handled-effects enforcement, startup `spec` stacking, and lifting the runtime from its current explicit `basic-cli` host profile to a more general package-backed mechanism.
142139

143140
## License
144141

examples/hello-app/spore.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,5 @@ default-entry = "app"
1111
[entries.app]
1212
path = "main.sp"
1313

14-
[capabilities]
15-
allow = ["Compute"]
16-
1714
[dependencies]
1815
basic-cli = { path = "../.." }

examples/hello-app/src/main.sp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/// Canonical package-backed application example for basic-cli.
2-
///
3-
/// This mirrors the formatted `spore new` scaffold: import the
4-
/// platform module explicitly and call `println` directly from the
5-
/// imported basic-cli surface.
6-
/// Application entry point matching the platform contract.
1+
// Canonical package-backed application example for basic-cli.
2+
//
3+
// This mirrors the formatted `spore new` scaffold: import the
4+
// platform module explicitly and call `println` from the imported
5+
// basic-cli surface.
76
import basic_cli.stdout as stdout
87

8+
/// Application entry point matching the platform contract.
99
fn main() -> () uses [Console] {
10-
println("Hello from a project-mode Spore application!")
10+
println("Hello from a project-mode Spore application!");
1111
return
1212
}

prek.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ hooks = [
2222
{ id = "tombi-lint" },
2323
]
2424

25+
[[repos]]
26+
repo = "https://github.com/rhysd/actionlint"
27+
rev = "v1.7.12"
28+
hooks = [
29+
{ id = "actionlint" },
30+
]
31+
2532
[[repos]]
2633
repo = "https://github.com/crate-ci/typos"
2734
rev = "v1.33.1"

spore.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,4 @@ startup-contract = "main"
1010
adapter-function = "main_for_host"
1111
handled-effects = ["Console", "FileRead", "FileWrite", "Env", "Spawn", "Exit"]
1212

13-
[capabilities]
14-
allow = ["Compute"]
15-
1613
[dependencies]

src/basic_cli/cmd.sp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// basic-cli platform — Process execution
22
///
3-
/// Run external commands with capability tracking.
3+
/// Run external commands with effect tracking.
44

55
/// Run a command and capture its stdout as a string.
66
/// Returns the full stdout output on success.

0 commit comments

Comments
 (0)