Skip to content

Commit 9cd3263

Browse files
committed
feat: Implement documentation deployment, build infrastructure, and refine scanner parsing logic.
1 parent d393719 commit 9cd3263

34 files changed

+1166
-248
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
pull_request:
10+
branches: ["main"]
11+
12+
jobs:
13+
test:
14+
name: Test on Rust ${{ matrix.rust }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
# Pin CI to stable. Add `beta` / `nightly` later if desired.
20+
rust: ["stable"]
21+
22+
steps:
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
25+
- name: Install Rust toolchain
26+
uses: dtolnay/rust-toolchain@stable
27+
with:
28+
toolchain: ${{ matrix.rust }}
29+
components: rustfmt, clippy
30+
31+
- name: Cache cargo registry & build
32+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
33+
with:
34+
path: |
35+
~/.cargo/registry
36+
~/.cargo/git
37+
target
38+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-cargo-
41+
42+
- name: Install apdev-rs
43+
run: cargo install apdev-rs
44+
continue-on-error: true
45+
46+
- name: Check characters
47+
run: apdev-rs check-chars src/
48+
continue-on-error: true
49+
50+
- name: Check formatting
51+
run: cargo fmt --all -- --check
52+
53+
- name: Lint with Clippy
54+
run: cargo clippy --all-targets --all-features -- -D warnings
55+
56+
- name: Build
57+
run: cargo build --all-features
58+
59+
- name: Run tests
60+
run: cargo test --all-features

.github/workflows/deploy-docs.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "mkdocs.yml"
10+
- "README.md"
11+
- "apexe-logo.svg"
12+
- ".github/workflows/deploy-docs.yml"
13+
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
29+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
30+
with:
31+
python-version: "3.x"
32+
33+
- run: pip install mkdocs-material
34+
35+
- name: Prepare docs for MkDocs
36+
run: |
37+
# Copy README as index page
38+
cp README.md docs/index.md
39+
40+
# Copy logo into docs assets
41+
mkdir -p docs/assets
42+
cp apexe-logo.svg docs/assets/
43+
44+
# Fix links in index.md: docs/X → X (since we're now inside docs/)
45+
sed -i 's|\./docs/|./|g' docs/index.md
46+
sed -i 's|(docs/|(|g' docs/index.md
47+
48+
# Fix logo reference in index.md
49+
sed -i 's|\./apexe-logo\.svg|./assets/apexe-logo.svg|g' docs/index.md
50+
51+
- run: mkdocs build
52+
53+
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
54+
with:
55+
path: site
56+
57+
deploy:
58+
needs: build
59+
runs-on: ubuntu-latest
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
steps:
64+
- id: deployment
65+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac553fd0d28 # v4.0.5

CLAUDE.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# CLAUDE.md — apexe Development & Code Quality Specification
2+
3+
## Project Overview
4+
5+
`apexe` is an Outside-In CLI-to-Agent Bridge — automatically wraps existing CLI tools into governed apcore modules, served via MCP/A2A.
6+
7+
---
8+
9+
## Rust Code Quality
10+
11+
### Readability
12+
13+
- Use precise, full-word names; standard abbreviations only when idiomatic (`buf`, `cfg`, `ctx`).
14+
- Functions ≤50 lines, single responsibility, verb-named (`parse_request`, `build_schema`).
15+
- Avoid obscure tricks, overly chained iterators, unnecessary macros, or excessive generics.
16+
- Break complex logic into small, well-named helper functions.
17+
18+
### Types (Mandatory)
19+
20+
- Provide explicit types on all public items; do not rely on inference for public API surfaces.
21+
- Prefer `struct` over raw tuples for anything with more than 2 fields.
22+
- Use **`newtype`** wrappers (`struct TaskId(Uuid);`) to encode domain semantics.
23+
- Use **`enum`** for exhaustive variants; avoid stringly-typed logic.
24+
- Implement `serde::Serialize` / `serde::Deserialize` on all public data types.
25+
26+
### Design
27+
28+
- Favor **composition over inheritance**; use `trait` only for true behavioral interfaces.
29+
- Prefer plain functions + data structs; minimize trait object (`dyn Trait`) indirection.
30+
- No circular module dependencies.
31+
- Use **dependency injection** (constructor arguments) for config, logging, DB connections, etc.
32+
- Keep `pub` surface minimal — default to module-private, expose only what consumers need.
33+
34+
### Errors & Resources
35+
36+
- Define domain errors with **`thiserror`**; no bare `Box<dyn Error>` in library code.
37+
- Propagate errors with `?`; no `unwrap()` / `expect()` in library paths (tests excepted).
38+
- If `unwrap()` / `expect()` is truly unreachable, document with a `// SAFETY:` or `// INVARIANT:` comment.
39+
- Validate and sanitize all public inputs at crate boundaries.
40+
- Use RAII / `Drop` for resource cleanup; avoid manual teardown.
41+
42+
### Async
43+
44+
- Runtime: **Tokio** (`features = ["full"]`).
45+
- Never block the async executor — use `tokio::task::spawn_blocking` for CPU-heavy work.
46+
- Use `tokio::time::sleep` / `tokio::time::timeout`, not `std::thread::sleep`.
47+
48+
### Logging
49+
50+
- Use **`tracing`** — no `println!` / `eprintln!` in production code.
51+
- Level guide:
52+
- `tracing::error!` — unrecoverable failures
53+
- `tracing::warn!` — recoverable anomalies
54+
- `tracing::info!` — key business events
55+
- `tracing::debug!` — internal state for debugging
56+
- Always include structured fields: `tracing::info!(task_id = %id, "task started")`.
57+
58+
### Testing
59+
60+
- Run with: `cargo test --all-features`
61+
- **Unit tests**: in the same file under `#[cfg(test)] mod tests { ... }`.
62+
- **Integration tests**: in `tests/` directory.
63+
- Test names: `test_<unit>_<behavior>` (e.g., `test_parse_request_returns_error_on_empty_body`).
64+
- Never change production code without adding or updating corresponding tests.
65+
- Use **`tokio-test`** for async test helpers.
66+
67+
### Serialization
68+
69+
- JSON: `serde_json`. YAML: `serde_yaml`.
70+
- Avoid manual `Serialize` / `Deserialize` impls unless schema shape requires it.
71+
72+
---
73+
74+
## Mandatory Quality Gates (CI — all must pass)
75+
76+
Run `make check` before every commit (mirrors CI exactly):
77+
78+
| Command | Purpose |
79+
|---------|---------|
80+
| `cargo fmt --all -- --check` | Formatting |
81+
| `cargo clippy --all-targets --all-features -- -D warnings` | Lint (warnings = errors) |
82+
| `apdev-rs check-chars src/` | Character validation |
83+
| `cargo build --all-features` | Full build |
84+
| `cargo test --all-features` | Tests |
85+
86+
```bash
87+
make setup # One-time: installs apdev-rs + pre-commit hook
88+
make fmt # Auto-format
89+
make check # Run all gates (do this before git commit)
90+
```
91+
92+
### Clippy & Formatting Rules
93+
94+
- `#[allow(...)]` to silence Clippy requires an inline comment explaining why.
95+
- `#[rustfmt::skip]` is forbidden without documented justification.
96+
- `Cargo.lock` **must be committed** (reproducible CI builds).
97+
98+
### CI Security
99+
100+
- All `uses:` actions must be pinned to a **full commit SHA** (not just a tag):
101+
```yaml
102+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
103+
```
104+
- Workflow default permissions: `contents: read` (minimum privilege).
105+
106+
---
107+
108+
## Dependency Management
109+
110+
- Evaluate necessity before adding a new dependency.
111+
- Specify minimum compatible versions; avoid over-pinning patch versions.
112+
- Dev-only crates go in `[dev-dependencies]`, never `[dependencies]`.
113+
114+
---
115+
116+
## General Guidelines
117+
118+
- **English only** for all code, comments, doc comments, error messages, and commit messages.
119+
- Fully understand surrounding code before making changes.
120+
- Do not generate unnecessary documentation stubs, example files, or boilerplate unless explicitly requested.
121+
- No secrets hardcoded — use environment variables or configuration files.

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.PHONY: setup check test lint fmt clean
2+
3+
# One-time dev environment setup
4+
setup:
5+
@echo "Installing apdev-rs..."
6+
@command -v apdev-rs >/dev/null 2>&1 || cargo install apdev-rs
7+
@echo "Installing git pre-commit hook..."
8+
@mkdir -p .git/hooks
9+
@cp hooks/pre-commit .git/hooks/pre-commit
10+
@chmod +x .git/hooks/pre-commit
11+
@echo "Done! Development environment is ready."
12+
13+
# Run all checks (same as pre-commit hook)
14+
check: fmt-check lint check-chars test
15+
16+
check-chars:
17+
apdev-rs check-chars src/
18+
19+
fmt-check:
20+
cargo fmt --all -- --check
21+
22+
lint:
23+
cargo clippy --all-targets --all-features -- -D warnings
24+
25+
test:
26+
cargo test --all-features
27+
28+
fmt:
29+
cargo fmt --all
30+
31+
clean:
32+
cargo clean

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ RUST_LOG=debug apexe scan git
219219
apexe --log-level debug scan git
220220
```
221221

222+
## Documentation
223+
224+
| Document | Description |
225+
|----------|-------------|
226+
| [User Manual](docs/user-manual.md) | Installation, commands, configuration, and troubleshooting guide |
227+
| [Technical Design](docs/tech-design.md) | Architecture, design decisions, and protocol details |
228+
| [Feature Manifest](docs/FEATURE_MANIFEST.md) | Feature decomposition, status, and scope summary |
229+
| [Feature Specs](docs/features/overview.md) | Detailed specifications for each feature (F1–F5) |
230+
222231
## License
223232

224233
Apache-2.0

0 commit comments

Comments
 (0)