Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Requires [Rust](https://rustup.rs) (stable).
```sh
git clone https://github.com/polyhook/steplock.git
cd steplock
cargo build --release
mv target/release/steplock /usr/local/bin/
cargo build --release --manifest-path core/Cargo.toml
mv core/target/release/steplock /usr/local/bin/
```

### Package managers
Expand Down
8 changes: 3 additions & 5 deletions core/Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ run(event, repo_root)
├─ reset = "always":
│ block on initial state, no state file
│
└─ reset = "session" | "branch":
└─ reset = "session":
│
├── get_scope_key → session-id or branch name
├── get_scope_key → session-id, or the fallback-id
├── create .steplock/sessions/<scope-key>/ if absent
├── load state.json (or init from flow.initial)
│
Expand Down Expand Up @@ -48,11 +48,9 @@ Built from `stateDiagram-v2` Mermaid syntax by `flow::parse_mmd`. Only two const

## Scope key resolution

`get_scope_key` is called for `reset = "session"` and `reset = "branch"`:
`get_scope_key` is called for `reset = "session"`:

- **session**: uses `event.session_id` if non-empty; otherwise reads or generates a UUID in `.steplock/sessions/fallback-id`.
- **branch**: reads `.git/HEAD` walking up from the repo root. Falls back to `"unknown-branch"` if no `.git` found.

## Session state file

`.steplock/sessions/<scope-key>/state.json` is the single source of truth. steplock writes it (via `save_state`) on each block and on each `steplock step done`; the deprecated `ack.sh` writes it via `jq + mv`. Both use atomic writes to avoid corruption under concurrent agent access.
Expand Down
3 changes: 3 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Rust library implementing the steplock gate logic. Used by the `steplock` CLI bi
| Module | Responsibility |
| ------------ | -------------- |
| `run` | Entry point — evaluates all checklists and returns `HookResponse` |
| `catalog` | Discovers checklist directories under a checklists dir |
| `gate` | Evaluates one checklist against a hook event |
| `config` | Parses `config.toml` (`ChecklistConfig`) |
| `global_config` | Finds the global steplock directory (`global_steplock_dir`) shared by every project |
| `flow` | Parses `flow.mmd` into a `FlowGraph` (Mermaid `stateDiagram-v2`) |
| `state` | `SessionState` — read/write `state.json` atomically |
| `cel_eval` | Evaluates `match_input` CEL expressions against a `HookEvent` |
Expand Down
Loading