Skip to content

Commit c310fec

Browse files
committed
chore: reorganize imports and add Lefthook git hooks setup
- Reorder imports in kv-rocksdb and sql-spin-sqlite components for consistency - Add Lefthook configuration for pre-commit formatting hooks - Add lefthook-install and setup targets to justfile for streamlined development workflow - Move setup target definition for better organization in justfile
1 parent 9c90324 commit c310fec

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

components/infrastructure/kv-rocksdb/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ mod bindings {
1010
});
1111
}
1212

13-
use bindings::exports::keel::infrastructure::kv as wit_kv;
1413
use crate::bindings::export;
14+
use bindings::exports::keel::infrastructure::kv as wit_kv;
1515

1616
struct Adapter;
1717

components/infrastructure/sql-spin-sqlite/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ mod bindings {
1212
});
1313
}
1414

15-
use bindings::exports::keel::infrastructure::sql::{self as wit_sql};
1615
use crate::bindings::export;
16+
use bindings::exports::keel::infrastructure::sql::{self as wit_sql};
1717

1818
// Map WIT sql-value to Spin SQLite Value
1919
fn to_spin_value(v: &wit_sql::SqlValue) -> Result<SpinValue, wit_sql::SqlError> {

justfile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,32 @@ e2e_url := "http://127.0.0.1:3000"
44
help:
55
@just --list
66

7+
# One-shot setup: toolchains, JS deps, and Spin CLI
8+
setup:
9+
just init
10+
just spin-install
11+
just spin-check
12+
just spin-install-plugins
13+
just lefthook-install
14+
715
# Quick commit via llmc, then push (existing behavior)
816
commit:
917
llmc
1018
git push
1119

20+
# Install Lefthook and Git hooks
21+
lefthook-install:
22+
if command -v lefthook >/dev/null 2>&1; then \
23+
lefthook install; \
24+
elif command -v brew >/dev/null 2>&1; then \
25+
brew install lefthook && lefthook install; \
26+
elif command -v npm >/dev/null 2>&1; then \
27+
npm i -g lefthook && lefthook install; \
28+
else \
29+
echo "Install lefthook from https://github.com/evilmartians/lefthook (or 'brew install lefthook' / 'npm i -g lefthook')" >&2; \
30+
exit 1; \
31+
fi
32+
1233
# Install toolchains and JS deps (Rust + Node)
1334

1435
# - Adds wasm32-wasip2 target and installs Node packages
@@ -45,13 +66,6 @@ spin-install:
4566
echo "On native Windows, use winget/choco or see the official guide: https://developer.fermyon.com/spin/v2/install" >&2; \
4667
exit 1; fi
4768

48-
# One-shot setup: toolchains, JS deps, and Spin CLI
49-
setup:
50-
just init
51-
just spin-install
52-
just spin-check
53-
just spin-install-plugins
54-
5569
# Print Windows install instructions (native Windows / PowerShell)
5670
spin-install-windows:
5771
echo "Spin installation on Windows (native):"; \

lefthook.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pre-commit:
2+
parallel: false
3+
commands:
4+
fmt:
5+
run: just fmt
6+
stage_fixed: true
7+
# Ensures rustfmt changes are re-staged before committing
8+

0 commit comments

Comments
 (0)