Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
205 lines (173 loc) · 8.34 KB
/
Copy pathjustfile
File metadata and controls
205 lines (173 loc) · 8.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
set shell := ["bash", "-euo", "pipefail", "-c"]
# A shebang recipe writes its script here. The Codex sandbox makes just's default, $XDG_RUNTIME_DIR/just, read-only.
# A nested just reads this setting again, but not the --tempdir of its caller. JUST_TEMPDIR and --tempdir still win. See #79.
set tempdir := "/tmp"
go-tools := 'GOTOOLCHAIN="$(go -C "' + justfile_directory() + '/tools" env GOVERSION)" go tool -modfile="' + justfile_directory() + '/tools/go.mod"'
golangci := go-tools + " golangci-lint"
# Each fixture extension repository of the test kit is a Go module of its own, which ./... skips.
standalone := "testdata/extensions/standalone testdata/extensions/standalone-named"
# List the recipes
default:
@just --list
# Print the next card of the plan, or the step that unblocks it
[group('plan')]
next:
@go -C tools run ./cmd/plan next "{{ justfile_directory() }}"
# Show the XT and COR tables from frontmatter
[group('plan')]
status:
@go -C tools run ./cmd/plan status "{{ justfile_directory() }}"
# Build ncly into $XDG_BIN_HOME or ~/.local/bin and the first-party extensions into Nicely's data folder, or only the given names, such as ncly agent
[positional-arguments]
install *names:
@exec bash scripts/install.sh "$@"
# Run every check that signoff requires, up to the first failure, or each one with --keep-going
[group('checks')]
[positional-arguments]
check *flags:
@exec bash scripts/check.sh "$@"
# Run just check on each layer of a stack, bottom to top, as origin holds it
[group('checks')]
[positional-arguments]
check-layers *branches:
@exec bash scripts/check-layers.sh "$@"
# Check this host for a UAT, and the given fixture folders, without changing anything
[group('checks')]
[positional-arguments]
preflight *fixtures:
@exec bash scripts/preflight.sh "$@"
# Build ncly into a scratch folder for the verify-nicely skill, or run one of its steps
[group('checks')]
[positional-arguments]
[no-exit-message]
verify *args:
@bash .agents/skills/verify-nicely/scripts/verify.sh "$@"
# Run testscript scenarios by exact name, each N times: just scenario <name>|<group>/<name>... [--count N]
[group('checks')]
[positional-arguments]
scenario *args:
@bash scripts/scenario.sh "$@"
# Run the Go tests, the testscript scenarios, and the tests of the scripts
[group('checks')]
test *args:
#!/usr/bin/env bash
set -Eeuo pipefail
# A hook or a caller can export GIT_DIR. Fixture commits must see a normal repository.
while IFS= read -r git_variable; do unset "${git_variable}"; done < <(git rev-parse --local-env-vars)
# ./... skips testdata/, so the Go fixture extensions are named.
go test ./... ./testdata/extensions/... {{ args }}
# Its test kit builds ncly, whose source the test cache of the fixture never rechecks.
for dir in {{ standalone }}; do go -C "$dir" test -count=1 ./... {{ args }}; done
# Go's test cache never rechecks a file outside the tools module, such as the docs or the release workflow, so these tests run uncached.
(cd tools && go test -count=1 ./cmd/... {{ args }})
bash scripts/release-check-test.sh
bash scripts/release-verify-test.sh
bash scripts/test-hook-env.sh
bash scripts/check-layers-test.sh
bash scripts/signoff-test.sh
bash scripts/check-test.sh
bash scripts/preflight-test.sh
bash scripts/scenario-test.sh
bash scripts/install-test.sh
# Check the TLA+ models of verification/tlc.json with the pinned TLC, then write their record. A local jar needs the pinned SHA-256 too
[group('checks')]
verify-models jar="":
go run ./sdk/extensionrepo/cmd/extensionrepo verify-models {{ if jar == "" { "" } else { quote(join(invocation_directory(), jar)) } }}
# Render the extension template and check the rendered repository
[group('checks')]
template:
bash scripts/template-test.sh
# Run the Go tests of sdk and internal under the race detector, without the scenarios
[group('checks')]
race:
go test -race ./sdk/... ./internal/...
# Check transcript, template and Verify Python with ruff; transcript also gets pyright and pytest
[group('checks')]
python:
#!/usr/bin/env bash
set -Eeuo pipefail
# pyright resolves a sibling module only from the engine folder. Its pyrightconfig.json makes
# that folder the root of pyright, which otherwise takes the first parent with a pyproject.toml,
# such as a home folder, and checks all of it.
cd extensions/transcript/python
uv tool run ruff@0.16.9 check --isolated . ../../../template/worker ../../../.agents/skills/verify-nicely/scripts/cleanup-stress.py
uv tool run ruff@0.16.9 format --isolated --check . ../../../template/worker ../../../.agents/skills/verify-nicely/scripts/cleanup-stress.py
requirements="$(mktemp)"
trap 'rm -f "$requirements"' EXIT
uv export --quiet --no-hashes --script transcript.py > "$requirements"
# The header pins the runtime packages; this recipe pins only the tools. pyright reads the tests, so it needs pytest.
# The nodejs extra brings its own Node.js. Without Node on PATH, the nodeenv fallback fails on the alpha versions of Node 27.
uv tool run --with-requirements "$requirements" --with pytest==9.1.1 'pyright[nodejs]@1.1.414'
uv tool run --with-requirements "$requirements" --with pytest-xdist==3.8.0 pytest@9.1.1 -n auto
# Lint the Go code, and run the analyzers of sdk/analysis
[group('checks')]
lint:
{{ golangci }} run ./... ./testdata/extensions/...
for dir in {{ standalone }}; do (cd "$dir" && {{ golangci }} run ./...); done
cd tools && go tool golangci-lint run ./cmd/...
go vet -vettool="$(go tool -n nicelyvet)" ./... ./testdata/extensions/...
vettool="$(go tool -n nicelyvet)"; for dir in {{ standalone }}; do (cd "$dir" && go vet -vettool="$vettool" ./...); done
# Fail when a Go file needs formatting
[group('checks')]
fmt-check:
{{ golangci }} fmt --diff ./... ./testdata/extensions/...
for dir in {{ standalone }}; do (cd "$dir" && {{ golangci }} fmt --diff); done
cd tools && go tool golangci-lint fmt --diff
# Check the shell scripts, those of the skills too, and the GitHub workflows, the template's too
[group('checks')]
release-lint:
shellcheck scripts/*.sh .agents/skills/*/scripts/*.sh
shfmt -d scripts/*.sh .agents/skills/*/scripts/*.sh
{{ go-tools }} actionlint
{{ go-tools }} actionlint template/.github/workflows/check.yml
# Build and inspect a local release without publishing
[group('checks')]
release-check version:
bash scripts/release-check.sh {{ quote(version) }}
# Write one version's GitHub release notes from the previous tag to HEAD
[group('release')]
[positional-arguments]
changelog version previous="":
@exec bash scripts/changelog.sh "$@"
# Check a published release and the formula of the Homebrew tap, without changing either
[group('checks')]
release-verify version:
bash scripts/release-verify.sh {{ quote(version) }}
# Fail when go.mod or tools/go.mod needs tidying
[group('checks')]
tidy-check:
go mod tidy -diff
for dir in {{ standalone }}; do go -C "$dir" mod tidy -diff; done
cd tools && go mod tidy -diff
# Scan the whole history for keys, home folders, and private addresses
[group('checks')]
gitleaks:
gitleaks git --no-banner --redact --log-level warn
# Refuse a change that grows a file past its size or adds a sentence over 25 words
[group('checks')]
limits *args:
@go -C tools run ./cmd/plan limits "{{ justfile_directory() }}" {{ args }}
# Scan the staged changes, as the pre-commit hook does
[group('checks')]
gitleaks-staged:
gitleaks git --staged --no-banner --redact --log-level warn --verbose --no-color
# Prove the leak rules: every line of leaks.txt is blocked, every line of clean.txt passes
[group('checks')]
gitleaks-rules:
@exec bash scripts/gitleaks-rules.sh
# Format the Go files in place, or only the given files
fmt *files:
{{ golangci }} fmt {{ files }}
# Run the checks, then mark the pushed HEAD green on GitHub
[group('checks')]
signoff:
@exec bash scripts/signoff.sh
# Sign off each layer of a stack after its checks pass, up to the first failure
[group('checks')]
[positional-arguments]
signoff-layers *branches:
@exec bash scripts/check-layers.sh --signoff "$@"
# Merge this branch's pull request: sign off if needed, push the signed SHA to main, then update the nicely clone on every fleet machine
[positional-arguments]
merge *args:
@exec uv run ~/.claude/skills/fleet/scripts/fleet_merge.py --method fast-forward "$@"