-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add dev rig — CI, pre-commit hooks, release-plz #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| echo "Running cargo fmt check..." | ||
| cargo fmt -- --check | ||
|
|
||
| echo "Running cargo clippy..." | ||
| cargo clippy -- -D warnings | ||
|
|
||
| echo "Running cargo test..." | ||
| cargo test | ||
|
|
||
| echo "Pre-commit checks passed." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt, clippy | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Check formatting | ||
| run: cargo fmt -- --check | ||
|
|
||
| - name: Clippy | ||
| run: cargo clippy -- -D warnings | ||
|
|
||
| - name: Tests | ||
| run: cargo test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Release-plz | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: release-plz | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| release-plz-release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Release | ||
| uses: release-plz/action@v0.5 | ||
| with: | ||
| command: release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| release-plz-pr: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Release PR | ||
| uses: release-plz/action@v0.5 | ||
| with: | ||
| command: release-pr | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,5 @@ | |
| *.swo | ||
| .DS_Store | ||
| .env | ||
| .claude/settings.local.json | ||
| .claude/worktrees/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Zift | ||
|
|
||
| Static analysis tool that scans codebases for embedded authorization logic and generates Rego policies for OPA. | ||
|
|
||
| ## Setup | ||
|
|
||
| After cloning, configure the pre-commit hook: | ||
|
|
||
| ```bash | ||
| git config core.hooksPath .githooks | ||
| ``` | ||
|
|
||
| ## Build & Development | ||
|
|
||
| ```bash | ||
| cargo build | ||
| cargo build --release | ||
| cargo test | ||
| cargo fmt # required before committing | ||
| cargo clippy -- -D warnings | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| - **CLI** (`src/cli.rs`): Subcommands — `scan`, `extract`, `report`, `rules`, `init` | ||
| - **Scanner** (`src/scanner/`): Tree-sitter AST parsing and pattern matching across languages | ||
| - **Rules** (`rules/`): TOML-based pattern definitions with tree-sitter queries and Rego templates | ||
| - **Rego** (`src/rego/`): Policy generation from scan findings | ||
| - **Output** (`src/output/`): Formatters (JSON, text; SARIF planned) | ||
|
|
||
| ### Design principles | ||
|
|
||
| - Two-pass architecture: structural scan (tree-sitter, fast) then optional semantic scan (LLM-assisted) | ||
| - Rules are data (TOML), not code — easy to add new patterns without touching Rust | ||
| - Same finding schema for both passes | ||
|
|
||
| ### Language support | ||
|
|
||
| - v0.1: TypeScript, JavaScript (Java in progress) | ||
| - v0.2: Python, Go | ||
| - v0.3: C#, Kotlin, Ruby, PHP | ||
|
|
||
| ## Conventional Commits & Versioning | ||
|
|
||
| Uses release-plz for automated version bumping and changelog generation. | ||
|
|
||
| Trigger prefixes (cause version bump): | ||
| - `feat:` — new feature (minor) | ||
| - `fix:` — bug fix (patch) | ||
| - `refactor:` — code refactoring (patch) | ||
| - `perf:` — performance improvement (patch) | ||
|
|
||
| Skipped prefixes (no version bump): | ||
| - `docs:`, `test:`, `ci:`, `chore:`, `style:`, `build:` | ||
|
|
||
| PR titles must use a conventional commit prefix. | ||
|
|
||
| ## Hard Rules | ||
|
|
||
| - Never include `Co-Authored-By` in commit messages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| [workspace] | ||
| release_commits = "^(feat|fix|refactor|perf)[(!:]" | ||
| publish = false | ||
| semver_check = false | ||
| git_only = true | ||
| git_tag_enable = true | ||
| git_release_enable = true | ||
|
|
||
| [changelog] | ||
| protect_breaking_commits = true | ||
|
|
||
| commit_parsers = [ | ||
| { message = "^feat", group = "Added" }, | ||
| { message = "^fix", group = "Fixed" }, | ||
| { message = "^refactor", group = "Changed" }, | ||
| { message = "^perf", group = "Performance" }, | ||
| { message = "^doc", skip = true }, | ||
| { message = "^test", skip = true }, | ||
| { message = "^ci", skip = true }, | ||
| { message = "^chore", skip = true }, | ||
| { message = "^style", skip = true }, | ||
| { message = "^build", skip = true }, | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [toolchain] | ||
| channel = "stable" | ||
| components = ["rustfmt", "clippy"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.