Skip to content

Commit 9ac6bde

Browse files
authored
Merge pull request #113 from sonesuke/feat/introduce-prek
feat: introduce prek for pre-commit hooks and cleanup project root
2 parents 78a719b + 7aa33a0 commit 9ac6bde

23 files changed

Lines changed: 346 additions & 265 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "docgraph-claude-plugins",
3-
"owner": {
4-
"name": "sonesuke"
5-
},
6-
"plugins": [
7-
{
8-
"name": "docgraph-plugin",
9-
"version": "0.1.0",
10-
"source": "./docgraph-plugin",
11-
"description": "Docgraph plugin for Claude"
12-
}
13-
]
14-
}
2+
"name": "docgraph-claude-plugins",
3+
"owner": {
4+
"name": "sonesuke"
5+
},
6+
"plugins": [
7+
{
8+
"name": "docgraph-plugin",
9+
"version": "0.1.0",
10+
"source": "./docgraph-plugin",
11+
"description": "Docgraph plugin for Claude"
12+
}
13+
]
14+
}

.devcontainer/devcontainer.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"name": "Docgraph Dev",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": ".."
2+
"name": "Docgraph Dev",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": ".."
6+
},
7+
"features": {
8+
"ghcr.io/devcontainers/features/common-utils:2": {
9+
"installZsh": "true",
10+
"username": "vscode",
11+
"userUid": "1000",
12+
"userGid": "1000",
13+
"upgradePackages": "false"
614
},
7-
"features": {
8-
"ghcr.io/devcontainers/features/common-utils:2": {
9-
"installZsh": "true",
10-
"username": "vscode",
11-
"userUid": "1000",
12-
"userGid": "1000",
13-
"upgradePackages": "false"
14-
},
15-
"ghcr.io/devcontainers/features/git:1": {}
16-
},
17-
"customizations": {
18-
"vscode": {}
19-
},
20-
"containerEnv": {
21-
"Z_AI_API_KEY": "${localEnv:Z_AI_API_KEY}",
22-
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
23-
},
24-
"postCreateCommand": "bash .devcontainer/post-create.sh",
25-
"remoteUser": "vscode"
26-
}
15+
"ghcr.io/devcontainers/features/git:1": {}
16+
},
17+
"customizations": {
18+
"vscode": {}
19+
},
20+
"containerEnv": {
21+
"Z_AI_API_KEY": "${localEnv:Z_AI_API_KEY}",
22+
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
23+
},
24+
"postCreateCommand": "bash .devcontainer/post-create.sh",
25+
"remoteUser": "vscode"
26+
}

.github/dependabot.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "cargo"
4-
directory: "/"
3+
- package-ecosystem: 'cargo'
4+
directory: '/'
55
schedule:
6-
interval: "weekly"
6+
interval: 'weekly'
77
groups:
88
dependencies:
99
patterns:
10-
- "*"
11-
- package-ecosystem: "github-actions"
12-
directory: "/"
10+
- '*'
11+
- package-ecosystem: 'github-actions'
12+
directory: '/'
1313
schedule:
14-
interval: "weekly"
15-
- package-ecosystem: "npm"
16-
directory: "/vsix"
14+
interval: 'weekly'
15+
- package-ecosystem: 'npm'
16+
directory: '/vsix'
1717
schedule:
18-
interval: "weekly"
19-
- package-ecosystem: "cargo"
20-
directory: "/zed-extension"
18+
interval: 'weekly'
19+
- package-ecosystem: 'cargo'
20+
directory: '/zed-extension'
2121
schedule:
22-
interval: "weekly"
22+
interval: 'weekly'
2323
groups:
2424
dependencies:
2525
patterns:
26-
- "*"
26+
- '*'

.github/workflows/ci.yml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ['main']
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ['main']
88
workflow_dispatch:
99

1010
env:
@@ -47,7 +47,7 @@ jobs:
4747
env: |
4848
CI=true
4949
GITHUB_ACTIONS=true
50-
runCmd: "true"
50+
runCmd: 'true'
5151

5252
- name: Cargo Build
5353
uses: devcontainers/ci@v0.3
@@ -88,18 +88,6 @@ jobs:
8888
push: never
8989
runCmd: cargo fmt -- --check
9090

91-
- name: Markdown Format Check
92-
uses: devcontainers/ci@v0.3
93-
env:
94-
CI: true
95-
with:
96-
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
97-
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
98-
push: never
99-
runCmd: |
100-
npm install
101-
npm run format:md -- --check
102-
10391
- name: Cargo Clippy
10492
uses: devcontainers/ci@v0.3
10593
env:
@@ -157,13 +145,8 @@ jobs:
157145
push: never
158146
runCmd: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
159147

160-
161148
- name: Upload coverage report
162149
uses: actions/upload-artifact@v6
163150
with:
164151
name: coverage-report
165152
path: lcov.info
166-
167-
168-
169-

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: "CodeQL"
1+
name: 'CodeQL'
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ['main']
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ['main']
88
schedule:
99
- cron: '0 6 * * 1'
1010

@@ -45,4 +45,4 @@ jobs:
4545
- name: Perform CodeQL Analysis
4646
uses: github/codeql-action/analyze@v4
4747
with:
48-
category: "/language:${{matrix.language}}"
48+
category: '/language:${{matrix.language}}'

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ jobs:
121121
name: docgraph.vsix
122122
path: docgraph.vsix
123123

124-
125124
create-release:
126125
needs: [build-rust, build-vsix]
127126
runs-on: ubuntu-latest

.zed/settings.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
22
"languages": {
33
"Markdown": {
4-
"language_servers": [
5-
"docgraph"
6-
],
4+
"language_servers": ["docgraph"],
75
"format_on_save": "on"
86
}
97
}
10-
}
8+
}

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,22 @@ IF = { desc = "Interface", template = "doc/templates/interface.md" }
6262

6363
[references.FR]
6464
rules = [
65-
{ dir = "from", targets = ["UC"], min = 1, desc = "Requirements must be derived from a use case" },
66-
{ dir = "to", targets = ["MOD"], min = 1, desc = "Requirements must be realized by a module" }
65+
{ dir = "from", targets = [
66+
"UC",
67+
], min = 1, desc = "Requirements must be derived from a use case" },
68+
{ dir = "to", targets = [
69+
"MOD",
70+
], min = 1, desc = "Requirements must be realized by a module" },
6771
]
6872

6973
[references.IF]
7074
rules = [
71-
{ dir = "from", targets = ["UC"], min = 1, desc = "Interfaces must be justified by a use case" },
72-
{ dir = "from", targets = ["FR"], min = 1, desc = "Interfaces must be defined by a functional requirement" }
75+
{ dir = "from", targets = [
76+
"UC",
77+
], min = 1, desc = "Interfaces must be justified by a use case" },
78+
{ dir = "from", targets = [
79+
"FR",
80+
], min = 1, desc = "Interfaces must be defined by a functional requirement" },
7381
]
7482
```
7583

@@ -137,6 +145,21 @@ docgraph check .
137145
docgraph trace UC_LOGIN FR_EMAIL_LOGIN
138146
```
139147

148+
#### Development Setup
149+
150+
If you are contributing to `docgraph`, please set up the pre-commit hooks to ensure code quality.
151+
152+
1. **Install prek**:
153+
```bash
154+
cargo install prek
155+
```
156+
2. **Install Git Hooks**:
157+
```bash
158+
prek install -f
159+
```
160+
161+
This will automatically run `cargo fmt`, `clippy`, `prettier`, `test`, and `docgraph check` before every commit.
162+
140163
## CLI Commands Reference
141164

142165
- `check [path]`: Validate the graph for broken links and rule violations.

cliff.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ parse_tags = true
3737
# https://docs.rs/regex/latest/regex/#syntax
3838
# split commits into groups
3939
commit_parsers = [
40-
{ message = "^feat", group = "Features" },
41-
{ message = "^fix", group = "Bug Fixes" },
42-
{ message = "^doc", group = "Documentation" },
43-
{ message = "^perf", group = "Performance" },
44-
{ message = "^refactor", group = "Refactor" },
45-
{ message = "^style", group = "Styling" },
46-
{ message = "^test", group = "Testing" },
47-
{ message = "^chore\\(release\\): prepare for", skip = true },
48-
{ message = "^chore", group = "Miscellaneous Tasks" },
49-
{ body = ".*security", group = "Security" },
40+
{ message = "^feat", group = "Features" },
41+
{ message = "^fix", group = "Bug Fixes" },
42+
{ message = "^doc", group = "Documentation" },
43+
{ message = "^perf", group = "Performance" },
44+
{ message = "^refactor", group = "Refactor" },
45+
{ message = "^style", group = "Styling" },
46+
{ message = "^test", group = "Testing" },
47+
{ message = "^chore\\(release\\): prepare for", skip = true },
48+
{ message = "^chore", group = "Miscellaneous Tasks" },
49+
{ body = ".*security", group = "Security" },
5050
]
5151
# protect breaking changes from being skipped due to matching a skipping commit_parser
5252
protect_breaking_commits = false

doc/architecture/design/development-norm.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ Defined in [.devcontainer/devcontainer.json](../../../.devcontainer/devcontainer
1313

1414
**Coding Standards:**
1515

16-
- **Formatting**: `cargo fmt` (Rust), `npm run format` (VSIX).
16+
- **Formatting**: `cargo fmt` (Rust), `npm run format` (VSIX), `prettier` (Markdown/JSON/TOML).
1717
- **Linting**: `cargo clippy` (Rust), `npm run lint` (VSIX).
18+
- **Pre-commit**: `prek` (Automates fmt, clippy, prettier, tests, and docgraph check).
1819
- **Security**: `cargo audit`.
1920

2021
**Performance:**

0 commit comments

Comments
 (0)