-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
100 lines (86 loc) · 3.65 KB
/
Copy pathJustfile
File metadata and controls
100 lines (86 loc) · 3.65 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
# fragmentation
#
# T2 of fragmentation-mcp added the `install` recipe — installs the
# `frgmnt` binary (the MCP server) to ${INSTALL_DIR:-~/.local/bin}.
# Pattern-matched on mirror's Justfile install recipe; matching shape
# keeps the binary's discoverability consistent across the substrate.
# Install destination for `just install`. Override on the CLI:
# just install INSTALL_DIR=/usr/local/bin
INSTALL_DIR := env_var_or_default("INSTALL_DIR", env_var("HOME") + "/.local/bin")
# Cargo target dir — honour the flake's CARGO_TARGET_DIR if present;
# fall back to the in-tree default.
CARGO_TARGET := env_var_or_default("CARGO_TARGET_DIR", justfile_directory() + "/target")
# The `frgmnt` binary's release path (per vcs/mcp/Cargo.toml [[bin]]).
FRGMNT_BIN_RELEASE := CARGO_TARGET + "/release/frgmnt"
check: lint test test-gleam format-check
lint:
cargo clippy --workspace --all-features -- -D warnings
# Test the fragmentation workspace.
#
# Default test command uses the workspace's package-specific features that
# actually exist. `cli`/`fuse` live on `fragmentation-git` (not the root),
# so we enable them via package-qualified syntax. SSH is on fragmentation.
test:
cargo test --workspace --features fragmentation/ssh,fragmentation-git/cli,fragmentation-git/fuse
test-gleam:
sh -c 'cd "$(git rev-parse --show-toplevel)/gleam" && gleam test'
test-mount:
cargo test --workspace --all-features
format-check:
cargo fmt -- --check
pre-commit: check
pre-push: check
format:
cargo fmt
# Build the `frgmnt` MCP server binary in release mode.
build-frgmnt:
cargo build -p fragmentation-mcp --release --bin frgmnt
# Install the `frgmnt` release binary to {{INSTALL_DIR}}/frgmnt.
# Override with `just install INSTALL_DIR=/usr/local/bin`.
#
# Match the pattern of mirror's Justfile install recipe — the goal
# is `just install` puts `frgmnt` on PATH so MCP clients can find
# it via the bare binary name in their `.mcp.json` configs.
install: build-frgmnt
@mkdir -p {{INSTALL_DIR}}
install -m 0755 {{FRGMNT_BIN_RELEASE}} {{INSTALL_DIR}}/frgmnt
@echo "installed: {{INSTALL_DIR}}/frgmnt"
@echo "ensure PATH contains {{INSTALL_DIR}}"
# Merge the current branch into main.
#
# - Refuses if on main, or if working tree is dirty.
# - Fast-forwards if possible; falls back to --no-ff merge commit.
# - Runs the test suite after the merge.
# - Rebuilds + installs the frgmnt binary so the live MCP picks up
# the new substrate.
# - Push stays explicit — run `git push origin main` when ready.
merge:
#!/usr/bin/env bash
set -euo pipefail
branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$branch" = "main" ]; then
echo "✖ error: already on main" >&2
exit 1
fi
# Allow only submodule pointer drift (the `m` status line) and untracked
# files that are gitignored already (no `??` should appear under normal
# operation). Anything else — reject.
dirty=$(git status --porcelain --ignore-submodules=all | grep -v '^?? ' || true)
if [ -n "$dirty" ]; then
echo "✖ error: working tree dirty. Commit or stash first." >&2
git status --short >&2
exit 1
fi
echo "→ merging $branch into main"
git checkout main
git pull --ff-only origin main
if ! git merge --ff-only "$branch" 2>/dev/null; then
echo "→ ff-only failed; creating merge commit"
git merge --no-ff --no-gpg-sign "$branch" -m "🔀 merge $branch into main"
fi
echo "→ running tests"
just test
echo "→ rebuilding and installing frgmnt"
just install
echo "✔ merged $branch into main; frgmnt reinstalled at {{INSTALL_DIR}}/frgmnt"
echo " next: \`git push origin main\` when ready"