From cb3d325fcbcf3fc8f35c3dfb8ef8029169716cc9 Mon Sep 17 00:00:00 2001 From: "Anaz S. Aji" <12648688+ajianaz@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:18:26 +0000 Subject: [PATCH 1/3] docs: merge .agent.md into AGENT.md and correct its stale facts Closes #799. --- .agent.md | 111 -------------------------------------------- AGENT.md | 52 ++++++++++++++++----- CHANGELOG.md | 1 + tests/docs_drift.rs | 35 +++++++++----- 4 files changed, 65 insertions(+), 134 deletions(-) delete mode 100644 .agent.md diff --git a/.agent.md b/.agent.md deleted file mode 100644 index f4ae7ef..0000000 --- a/.agent.md +++ /dev/null @@ -1,111 +0,0 @@ -# Agent Context — cora-code - -## Pre-Release Checklist - -Before creating any release PR, verify ALL of the following are updated: - -### Code - -- [ ] `Cargo.toml` — version bump -- [ ] All target issues merged to `develop` -- [ ] `cargo test` — all 567+ tests pass -- [ ] `cargo clippy --all-targets -- -D warnings` — clean -- [ ] `cargo fmt --all -- --check` — clean -- [ ] `cargo build --release` — no errors -- [ ] Binary smoke test: `cora --version`, `cora mcp --help`, `cora review --staged` - -### Documentation - -- [ ] `README.md` — feature list, commands table, config examples, all links to `codecora.dev` -- [ ] `CHANGELOG.md` — new version entry with ALL changes -- [ ] `docs/changelog.md` — generated from `CHANGELOG.md` by the docs build and git-ignored; never edit or commit it -- [ ] `docs/roadmap.md` — completed items ✓ Done, future items accurate -- [ ] `docs/getting-started.md` — new major features mentioned, links valid -- [ ] `docs/configuration.md` — all new config sections present -- [ ] `docs/cli-reference.md` — all commands listed including new subcommands -- [ ] `docs/usage.md` — exit codes, sections up to date -- [ ] `docs/examples.md` — CI examples work, marketplace action reference correct -- [ ] `docs/providers.md` — provider list and env vars accurate -- [ ] `docs/installation.md` — version pin example uses latest -- [ ] `AGENT.md` — code structure, test count, features list current - -### Cross-Check - -- [ ] Feature coverage: every feature in README + CHANGELOG + config docs + roadmap -- [ ] Consistent terminology across all files -- [ ] No broken links (all `codecora.dev` links resolve) -- [ ] Version numbers consistent across all docs -- [ ] Star History chart includes all relevant repos - -### CI & Scanning - -- [ ] CI: 10/10 checks green on develop -- [ ] Code Scanning: 0 open alerts -- [ ] No open PRs blocking release -- [ ] Pre-commit hook passes (`cora review --staged`) - -### Post-Release - -- [ ] `release.yml` triggers on `v*` tag -- [ ] 4 platform binaries on GitHub Releases -- [ ] `crates.io` publish succeeds -- [ ] `codecora.dev` reflects new docs -- [ ] Marketplace action still works - -## Release Authority - -**Owner approval required before ANY release.** Agent must: -1. Complete Pre-Release Checklist (all green) -2. Generate validation report -3. Present to owner -4. Wait for explicit approval ("oke kerjakan" / "go ahead" / "rilis") -5. Only then: bump version + tag + push - -Agent must NEVER trigger release without owner approval. - -## Branch Conventions - -- All PRs target `develop` (not `main`) -- Feature branches: `feat/-` -- Fix branches: `fix/` -- Release branches: `release/vX.Y.Z` -- Pre-commit hook must pass before each commit -- **One issue = one branch = one PR = wait CI green = merge = next** - -## Config Architecture (v0.5.0+) - -| File | Contents | -|------|----------| -| `~/.codecora/cora-code/auth.toml` | API key only (secret, chmod 600) | -| `~/.codecora/cora-code/config.yaml` | Provider, model, base_url, settings (global) | -| `.cora.yaml` | Per-project overrides | - -## Key Decisions - -- License: MIT (Rust CLI ecosystem standard) -- CORA_API_KEY env var: CI use only, not for local dev -- Provider info auto-migrated from auth.toml → config.yaml -- Config priority: CLI flags → env vars → .cora.yaml → config.yaml → auto-detect → defaults -- Marketplace action: separate repo `codecoradev/cora-review-action` (not in-tree) -- Quality gate: exit code 2 on failure (1 = error, 0 = success) -- `merge_into()` returns `Result<(), CoraError>` — fail-fast on invalid profile config -- MCP server: JSON-RPC 2.0 over stdio, 22 tools - -## CI Required Checks (10) - -Check, Format, Clippy, Test, Build, Security Audit (CVE), Website Build, NPM Audit, Cargo Outdated, Cora Review - -## Module Dependencies - -``` -config/ → engine/ → formatters/ - ↗ ↘ -main.rs → commands/ → output - ↘ ↗ - git/ → engine/review - mcp/ → engine/* (rules, security_scanner, secrets_scanner, profiles, diff_parser) - hook/ -``` - -Key: engine modules should NOT depend on commands or config/loader directly. -mcp/tools uses engine internals via `crate::engine::*`. diff --git a/AGENT.md b/AGENT.md index 87034b9..9209ca8 100644 --- a/AGENT.md +++ b/AGENT.md @@ -112,6 +112,18 @@ src/ └── template.rs # Hook script templates ``` +### Dependency rules + +``` +config/ → engine/ → formatters/ +main.rs → commands/ → output +commands/, mcp/ → engine/* (rules, scanners, profiles, diff_parser, index_bridge) +git/, hook/ are leaf helpers +``` + +Engine modules must not depend on `commands/` or on `config/loader` directly; `mcp/tools` +reaches the engine through `crate::engine::*`. + ## Key Files | File | Purpose | @@ -142,12 +154,24 @@ The pre-commit hook runs the installed `cora` binary on the staged diff. Never s ## CI/CD -Three GitHub Actions workflows in `.github/workflows/`: - -1. **ci.yml** — PR checks: build, test, clippy, fmt on push to `develop` and PRs -2. **release.yml** — Triggered by `v*` tags; builds for 4 platforms (Linux x86_64, - macOS x86_64, macOS ARM64, Windows x86_64), publishes to crates.io -3. **deploy-website.yml** — Deploys project website/docs +The workflows in `.github/workflows/`: + +1. **ci.yml** — Check, Format, Clippy, Test, Build, Security Audit (CVE), Website Build, + NPM Audit and Cargo Outdated on every PR and on pushes to `develop` and `main`. The + push to `develop` exists to fill the Rust build cache that PRs restore (a cache + written inside a PR is visible to that PR only); docs-only pushes are skipped. +2. **cora-review.yml** — Cora Review on every PR (`pull_request_target`; the config comes + from the base branch, never from the PR). +3. **pr-checks.yml** — Branch Naming, Conventional Commits and PR Description. +4. **release.yml** — Triggered by `v*` tags; builds the 4 platform binaries with the code + model bundled, publishes to crates.io, signs the checksums and creates the GitHub Release. +5. **deploy-website.yml** — Deploys the project website and docs. +6. **project-sync.yml** — Moves linked issues to Done on the roadmap board. +7. **anthropic-wif-smoke.yml** — Smoke test of the Anthropic workload identity federation. + +Required checks on a PR (13): Check, Format, Clippy, Test, Build, Security Audit (CVE), +Website Build, NPM Audit, Cargo Outdated, Cora Review, Branch Naming, Conventional +Commits, PR Description. ## Config System @@ -166,6 +190,11 @@ API keys live in a separate `auth.toml` file (`~/.codecora/cora-code/auth.toml`) ## Design Decisions +- **Exit codes:** 0 success, 1 error, 2 quality gate failed. +- **`CORA_API_KEY`** is for CI; local use keeps the key in `~/.codecora/cora-code/auth.toml`. +- **The Marketplace action** lives in its own repository, `codecoradev/cora-review-action`, + not in this tree. +- **`merge_into()`** returns `Result<(), CoraError>`: an invalid profile config fails fast. - **Severity comparison uses `<=` not `>=`**: Severity filtering uses `<=` because the ordinal maps info=1, warning=2, error=3 — so `--severity warning` means "include warning and below (info)", not "warning and above (error)". This is @@ -308,7 +337,6 @@ reality BEFORE version bump. | `docs/code-intelligence.md` | Index, brain, trace, arch, multi-project DB, data directory | | `docs/installation.md` | Version pin example uses latest. Platforms list accurate | | `AGENT.md` | Code structure tree current. Test count current. Key files table current | -| `.agent.md` | Pre-release checklist current. CI checks count current. Module dependencies current | ### 3. Cross-Check @@ -320,7 +348,7 @@ reality BEFORE version bump. ### 4. CI & Scanning -- [ ] CI: 10/10 checks green on develop branch +- [ ] CI: 13/13 checks green on the release PR - [ ] Code Scanning: 0 open alerts (fix or dismiss each with reason) - [ ] No open PRs blocking the release @@ -360,7 +388,7 @@ Generate a comprehensive pre-release report covering: ✅ TESTS: N pass (unit + CLI + config) ✅ CLIPPY: Clean ✅ FORMAT: Clean -✅ CI: 10/10 green +✅ CI: 13/13 green ✅ CODE SCANNING: 0 open ✅ OPEN PRs: 0 ✅ OPEN ISSUES: N (all post-release scope) @@ -475,9 +503,9 @@ When submitting cora to directories, aggregators, or showcases (Trendshift, etc. ### Key Metrics to Mention -- Test count (708+) -- Lines of Rust code (26,400+) -- CI checks (10) +- Test count (1,500+) +- Lines of Rust code (67,000+) +- CI checks (13) - GitHub Marketplace action published - MCP server with 22 tools - Apache-2.0 license diff --git a/CHANGELOG.md b/CHANGELOG.md index b914151..cd0e426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- **One agent guide (#799).** `.agent.md` is merged into `AGENT.md` and deleted; the facts that only it had and are still true (module dependency rules, a few decisions) moved over, the wrong ones (the license, the number of required checks) did not, and the CI section lists all seven workflows, kept in step by a test. - **Dead code removed (#790).** About 500 lines that nothing used are gone, among them the YAML agent-config path, an unused `IssueType` enum, unused graph helpers and five error variants that were never created, and the 60 `#[allow(dead_code)]` attributes that hid them. The compiler now reports unused code again; the few items that are written but not wired in yet carry a narrow, commented allow that points to #792. `cora install --yes` is still accepted but has no effect (`install` never asks questions), and its help says so. - **A README and docs that are easier to read.** The README opens with a diagram of how cora works and a three-command quick start, groups the features (review, code intelligence, agents and CI), tucks upgrade and Gatekeeper details into a collapsed section and shows the timings as a chart next to the table. `docs/usage.md` shows how a review runs and `docs/agent-integration.md` how an agent uses cora, each with a diagram. The four SVG diagrams (`docs/public/diagrams/`) carry their own light and dark colors, a title and a description, and are checked by `tests/docs_drift.rs` (accessible, self-contained, used somewhere, and the chart matches the README table). diff --git a/tests/docs_drift.rs b/tests/docs_drift.rs index e191402..70549fa 100644 --- a/tests/docs_drift.rs +++ b/tests/docs_drift.rs @@ -26,17 +26,11 @@ fn read(rel: &str) -> String { /// `docs/changelog.md` is generated from CHANGELOG.md by the docs build, and the /// design notes and standards keep history, so they are not checked. fn doc_files() -> Vec { - let mut files: Vec = [ - "README.md", - "CONTRIBUTING.md", - "AGENT.md", - ".agent.md", - "SECURITY.md", - ] - .iter() - .filter(|f| root().join(f).exists()) - .map(|f| f.to_string()) - .collect(); + let mut files: Vec = ["README.md", "CONTRIBUTING.md", "AGENT.md", "SECURITY.md"] + .iter() + .filter(|f| root().join(f).exists()) + .map(|f| f.to_string()) + .collect(); let mut pages: Vec = fs::read_dir(root().join("docs")) .expect("docs/") .filter_map(|e| e.ok()) @@ -539,3 +533,22 @@ fn the_performance_chart_shows_the_numbers_of_the_readme_table() { } assert_eq!(seen, 3, "the performance chart should label three bars"); } + +#[test] +fn agent_md_names_every_workflow() { + // The CI/CD section of AGENT.md lists the workflows; a new or renamed one must show up there. + let agent = read("AGENT.md"); + let dir = root().join(".github/workflows"); + let mut seen = 0; + for entry in fs::read_dir(&dir).expect(".github/workflows") { + let name = entry.unwrap().file_name().to_string_lossy().to_string(); + if name.ends_with(".yml") || name.ends_with(".yaml") { + seen += 1; + assert!( + agent.contains(&name), + "AGENT.md does not mention the workflow {name}" + ); + } + } + assert!(seen >= 5, "found only {seen} workflows"); +} From 8c549bc67cf16a91d9b3145e9b63c1c19c779b3b Mon Sep 17 00:00:00 2001 From: "Anaz S. Aji" <12648688+ajianaz@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:20:31 +0000 Subject: [PATCH 2/3] docs(changelog): one Fixed and one Changed section under Unreleased Refs #799. --- CHANGELOG.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd0e426..9ea2cc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,21 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed - - **`index-breaking-change` no longer reports a removal whose callers are deleted in the same change (#794).** The index predates the diff, so a helper removed together with its only caller was reported as "breaks 1 caller" and blocked the review; callers whose call site is one of the removed lines (or in a deleted file) are now ignored, and the finding stays for callers that remain. -### Changed +- **Documentation corrected against the code (#782).** The README's quick install now uses `install.sh`, which verifies the SHA-256 checksum and the Sigstore signature (the script it named before did neither, and the `CORA_VERSION` pin in the examples never reached the installer); the License section says Apache-2.0; the global config directory is `~/.codecora/cora-code/` everywhere (it said `~/.cora/`); Tree-sitter is no longer called opt-in; language, rule and pattern counts, the Rust badge, the Homebrew claim, the download URL and the release flow in CONTRIBUTING were wrong or stale. +### Changed - **One agent guide (#799).** `.agent.md` is merged into `AGENT.md` and deleted; the facts that only it had and are still true (module dependency rules, a few decisions) moved over, the wrong ones (the license, the number of required checks) did not, and the CI section lists all seven workflows, kept in step by a test. - **Dead code removed (#790).** About 500 lines that nothing used are gone, among them the YAML agent-config path, an unused `IssueType` enum, unused graph helpers and five error variants that were never created, and the 60 `#[allow(dead_code)]` attributes that hid them. The compiler now reports unused code again; the few items that are written but not wired in yet carry a narrow, commented allow that points to #792. `cora install --yes` is still accepted but has no effect (`install` never asks questions), and its help says so. - **A README and docs that are easier to read.** The README opens with a diagram of how cora works and a three-command quick start, groups the features (review, code intelligence, agents and CI), tucks upgrade and Gatekeeper details into a collapsed section and shows the timings as a chart next to the table. `docs/usage.md` shows how a review runs and `docs/agent-integration.md` how an agent uses cora, each with a diagram. The four SVG diagrams (`docs/public/diagrams/`) carry their own light and dark colors, a title and a description, and are checked by `tests/docs_drift.rs` (accessible, self-contained, used somewhere, and the chart matches the README table). -### Fixed - -- **Documentation corrected against the code (#782).** The README's quick install now uses `install.sh`, which verifies the SHA-256 checksum and the Sigstore signature (the script it named before did neither, and the `CORA_VERSION` pin in the examples never reached the installer); the License section says Apache-2.0; the global config directory is `~/.codecora/cora-code/` everywhere (it said `~/.cora/`); Tree-sitter is no longer called opt-in; language, rule and pattern counts, the Rust badge, the Homebrew claim, the download URL and the release flow in CONTRIBUTING were wrong or stale. - -### Changed - - **A shorter README and docs that cannot drift silently (#783).** Configuration, Commands and Environment Variables in the README are summaries that link to the single source in `docs/`. `tests/docs_drift.rs` fails CI when a document names the legacy config path, a version pin or the license differs from `Cargo.toml`, a tool or language count differs from the server or the language table, a default feature is called opt-in, a link or anchor is broken, the installer named in the docs does not verify its download, or the README misses a page of the docs site. `docs/changelog.md` is generated by the docs build and no longer committed. ## [0.21.1] - 2026-11-17 From 32b75a9269f92bb1a87b320fa93ed35dea887b9e Mon Sep 17 00:00:00 2001 From: "Anaz S. Aji" <12648688+ajianaz@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:20:40 +0000 Subject: [PATCH 3/3] docs(changelog): uniform spacing under Unreleased Refs #799. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ea2cc2..51c08ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed + - **`index-breaking-change` no longer reports a removal whose callers are deleted in the same change (#794).** The index predates the diff, so a helper removed together with its only caller was reported as "breaks 1 caller" and blocked the review; callers whose call site is one of the removed lines (or in a deleted file) are now ignored, and the finding stays for callers that remain. - **Documentation corrected against the code (#782).** The README's quick install now uses `install.sh`, which verifies the SHA-256 checksum and the Sigstore signature (the script it named before did neither, and the `CORA_VERSION` pin in the examples never reached the installer); the License section says Apache-2.0; the global config directory is `~/.codecora/cora-code/` everywhere (it said `~/.cora/`); Tree-sitter is no longer called opt-in; language, rule and pattern counts, the Rust badge, the Homebrew claim, the download URL and the release flow in CONTRIBUTING were wrong or stale. ### Changed + - **One agent guide (#799).** `.agent.md` is merged into `AGENT.md` and deleted; the facts that only it had and are still true (module dependency rules, a few decisions) moved over, the wrong ones (the license, the number of required checks) did not, and the CI section lists all seven workflows, kept in step by a test. + - **Dead code removed (#790).** About 500 lines that nothing used are gone, among them the YAML agent-config path, an unused `IssueType` enum, unused graph helpers and five error variants that were never created, and the 60 `#[allow(dead_code)]` attributes that hid them. The compiler now reports unused code again; the few items that are written but not wired in yet carry a narrow, commented allow that points to #792. `cora install --yes` is still accepted but has no effect (`install` never asks questions), and its help says so. + - **A README and docs that are easier to read.** The README opens with a diagram of how cora works and a three-command quick start, groups the features (review, code intelligence, agents and CI), tucks upgrade and Gatekeeper details into a collapsed section and shows the timings as a chart next to the table. `docs/usage.md` shows how a review runs and `docs/agent-integration.md` how an agent uses cora, each with a diagram. The four SVG diagrams (`docs/public/diagrams/`) carry their own light and dark colors, a title and a description, and are checked by `tests/docs_drift.rs` (accessible, self-contained, used somewhere, and the chart matches the README table). - **A shorter README and docs that cannot drift silently (#783).** Configuration, Commands and Environment Variables in the README are summaries that link to the single source in `docs/`. `tests/docs_drift.rs` fails CI when a document names the legacy config path, a version pin or the license differs from `Cargo.toml`, a tool or language count differs from the server or the language table, a default feature is called opt-in, a link or anchor is broken, the installer named in the docs does not verify its download, or the README misses a page of the docs site. `docs/changelog.md` is generated by the docs build and no longer committed.