-
Notifications
You must be signed in to change notification settings - Fork 368
Expand file tree
/
Copy pathjustfile
More file actions
142 lines (114 loc) · 5 KB
/
Copy pathjustfile
File metadata and controls
142 lines (114 loc) · 5 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
set shell := ["bash", "-euo", "pipefail", "-c"]
default:
@just --list
# Run the daemon from source. Extra args pass through, e.g. `just dev --foreground`.
dev *args:
cargo run -- start {{args}}
preflight:
./scripts/preflight.sh
preflight-ci:
./scripts/preflight.sh --ci
fmt-check:
cargo fmt --all -- --check
check-all:
cargo check --all-targets
clippy-all:
cargo clippy --all-targets
test-lib:
cargo test --lib
test-integration-compile:
cargo test --tests --no-run
# Link local SpaceUI packages for development.
# Expects the spaceui repo cloned adjacent to this repo (../spaceui).
spaceui-link:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -d ../spaceui/packages ]; then
echo "Error: ../spaceui not found. Clone it adjacent to this repo:"
echo " git clone https://github.com/spacedriveapp/spaceui ../spaceui"
exit 1
fi
cd ../spaceui
bun install && bun run build --filter='@spacedrive/primitives' --filter='@spacedrive/ai' --filter='@spacedrive/forms' --filter='@spacedrive/explorer' --filter='@spacedrive/tokens'
for pkg in primitives ai forms explorer tokens; do
cd packages/$pkg && bun link && cd ../..
done
cd "{{justfile_directory()}}/interface"
bun link @spacedrive/primitives @spacedrive/ai @spacedrive/forms @spacedrive/explorer @spacedrive/tokens
echo "SpaceUI packages linked successfully."
# Unlink SpaceUI packages and restore npm versions.
spaceui-unlink:
cd interface && bun unlink @spacedrive/primitives @spacedrive/ai @spacedrive/forms @spacedrive/explorer @spacedrive/tokens && bun install
gate-pr: preflight
./scripts/gate-pr.sh
typegen:
cargo run --bin openapi-spec > /tmp/spacebot-openapi.json
cd interface && bunx openapi-typescript /tmp/spacebot-openapi.json -o src/api/schema.d.ts
check-typegen:
cargo run --bin openapi-spec > /tmp/spacebot-openapi-check.json
cd interface && bunx openapi-typescript /tmp/spacebot-openapi-check.json -o /tmp/spacebot-schema-check.d.ts
diff interface/src/api/schema.d.ts /tmp/spacebot-schema-check.d.ts
typegen-package:
cargo run --bin openapi-spec > /tmp/spacebot-openapi-package.json
cd interface && bunx openapi-typescript /tmp/spacebot-openapi-package.json -o src/api/schema.d.ts
gate-pr-ci: preflight-ci
./scripts/gate-pr.sh --ci
gate-pr-ci-fast: preflight-ci
./scripts/gate-pr.sh --ci --fast
# Build the OpenCode embed bundle from a pinned upstream commit.
# Clones opencode, copies embed entry points, builds with Vite,
# and outputs to interface/public/opencode-embed/.
build-opencode-embed:
./scripts/build-opencode-embed.sh
# Cross-compile for aarch64 Linux (Raspberry Pi, ARM servers).
# Requires: cargo install cross --locked
# Output: target/aarch64-unknown-linux-gnu/release/spacebot
build-aarch64:
SPACEBOT_SKIP_FRONTEND_BUILD=1 cross build --target aarch64-unknown-linux-gnu --release
# Build the spacebot binary and copy it into the Tauri sidecar
# binaries directory with the correct target-triple suffix.
bundle-sidecar:
./scripts/bundle-sidecar.sh --release
# Run the desktop app in development mode.
# The desktop package script pre-bundles the sidecar, and Tauri starts Vite.
desktop-dev:
cd desktop && bun run tauri:dev
# Build the full desktop app (sidecar + frontend + Tauri bundle).
# The desktop package script pre-bundles the sidecar, and Tauri builds the frontend.
desktop-build:
cd desktop && bun run tauri:build
# Update the frontend node_modules hash in nix/default.nix after updating interface dependencies.
# Usage: Update interface/package.json or interface/bun.lock, then run: just update-frontend-hash
update-frontend-hash:
#!/usr/bin/env bash
set -euo pipefail
echo "Building frontend-updater to get new hash..."
output=$(nix build .#frontend-updater 2>&1 || true)
new_hash=$(echo "$output" | awk '/got:/ {print $2}' || true)
if [ -z "$new_hash" ]; then
echo "Error: Failed to extract hash from build output"
echo "Build output:"
echo "$output"
exit 1
fi
echo "New hash: $new_hash"
# Check if hash is already up to date
current_hash=$(grep -E 'hash \?' nix/default.nix | head -1 | sed -E 's/.*hash \? "([^"]+)".*/\1/')
if [ "$current_hash" = "$new_hash" ]; then
echo "Hash is already up to date!"
exit 0
fi
# Update the hash in nix/default.nix (POSIX-safe in-place edit)
tmpfile=$(mktemp)
sed -E "s|hash \? \"[^\"]+\"|hash ? \"$new_hash\"|" nix/default.nix > "$tmpfile"
mv "$tmpfile" nix/default.nix
echo "Updated nix/default.nix with new hash"
echo ""
echo "Next steps:"
echo " 1. Review the changes: git diff nix/default.nix"
echo " 2. Test the build: nix build .#frontend"
echo " 3. Commit the changes: git add nix/default.nix && git commit -m 'update: frontend node_modules hash'"
# Update all Nix flake inputs (flake.lock).
# Use this when you want to update dependencies like nixpkgs, crane, etc.
update-flake:
nix flake update --extra-experimental-features "nix-command flakes"