feat(tooling): add prettier + ruff format config + repo-wide makefile (closes #644) - #684
feat(tooling): add prettier + ruff format config + repo-wide makefile (closes #644)#684arcgod-design wants to merge 2 commits into
Conversation
…closes sreerevanth#644) Three sub-packages, three formatters, one workflow. - Python (agentwatch/): ruff format (config in [tool.ruff.format] of pyproject.toml). docstring-code-format = true, quote-style = 'double', indent-style = 'space'. 'ruff check pyproject.toml' passes; the 3 pre-existing files that would be reformatted (agentwatch/api/auth.py, agentwatch/core/recursion_depth_detector.py, agentwatch/eval/runner.py) are unchanged by this commit so the diff stays reviewable. - Frontend (frontend/): Prettier ^3.4.2 as devDependency; 'npm run format' and 'npm run format:check' scripts; .prettierignore excludes .next, out, build, coverage, jest.config.js, public, node_modules. - Landing (agentwatch-landing/): Prettier ^3.4.2 as devDependency; 'npm run format' and 'npm run format:check' scripts; matching .prettierignore. Auto-generated AGENTS.md untouched. - Shared .prettierrc.json at repo root with sub-package overrides for .py (matching ruff) and .md (proseWrap: preserve). Top-level .prettierignore excludes agentwatch/, .pytest_cache/, .ruff_cache/, reference_artifacts/, package-lock.json, etc. - Makefile ties them together: 'make format' runs all three; 'make format-check' verifies without modifying files. - AGENTS.md gets a new 'Formatting (issue sreerevanth#644)' section documenting the per-sub-package formatter + the all-in-one make targets. The shared config (semi + single quotes + trailing commas + 100-col + LF) matches the style of the existing landing-page code so contributors who run 'make format' on first checkout see no churn on the landing package.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdded shared Prettier and Ruff formatting rules, ignore patterns, project scripts, and root Makefile commands for formatting and format checks across Python, frontend, and landing-page code. Updated Python documentation examples and formatting without changing runtime behavior. ChangesFormatting tooling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.26.0)OpenGrep binary not available 🔧 ast-grep (0.45.0)agentwatch/api/auth.py/bin/bash: line 1: printf: write error: No space left on device agentwatch/core/recursion_depth_detector.py/bin/bash: line 1: printf: write error: No space left on device agentwatch/eval/runner.py/bin/bash: line 1: printf: write error: No space left on device Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧪 PR Test Results
Python 3.12 · commit e7c682e |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agentwatch-landing/.prettierignore`:
- Around line 1-7: Update the ignore rules in agentwatch-landing/.prettierignore
(lines 1-7) and frontend/.prettierignore (lines 1-7) to explicitly include both
*.lock and package-lock.json, keeping the package-local Prettier exclusions
aligned.
In `@agentwatch-landing/package.json`:
- Line 29: Update both frontend/package-lock.json and
agentwatch-landing/package-lock.json to include the Prettier ^3.4.2 dependency
declared in frontend/package.json and agentwatch-landing/package.json, including
the resolved package metadata and integrity information required for npm ci; no
direct changes are needed in either package.json.
In `@Makefile`:
- Line 7: Update the Makefile .PHONY declaration to match the actual target
definitions: remove format-js unless a corresponding rule is added, and include
format-check-py, format-check-frontend, and format-check-landing so those checks
always execute even when same-named files exist.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4a7d46db-52b0-4cf3-b5e2-4824ef369cbe
📒 Files selected for processing (10)
.prettierignore.prettierrc.jsonAGENTS.mdMakefileagentwatch-landing/.prettierignoreagentwatch-landing/.prettierrc.jsonagentwatch-landing/package.jsonfrontend/.prettierignorefrontend/package.jsonpyproject.toml
| .next | ||
| node_modules | ||
| out | ||
| build | ||
| dist | ||
| coverage | ||
| public/favicon.ico |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== repo files of interest =="
git ls-files | rg '(^|/)(\.prettierignore|package\.json|Prettier|prettier|Makefile|\.github/workflows/.*)$' | sed -n '1,200p'
echo
echo "== .prettierignore files =="
for f in agentwatch-landing/.prettierignore frontend/.prettierignore .prettierignore; do
if [ -f "$f" ]; then
echo "--- $f ---"
cat -n "$f"
fi
done
echo
echo "== Prettier references =="
rg -n --hidden --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' 'Prettier|prettier|\.prettierignore|package-lock\.json|\.lock' -S . | sed -n '1,240p'Repository: sreerevanth/AgentWatch
Length of output: 2804
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== git status/stat =="
git status --short
git diff --stat
echo
echo "== current package configs around prettier =="
for f in agentwatch-landing/package.json frontend/package.json .prettierrc .prettierignore; do
if [ -f "$f" ]; then
echo "--- $f ---"
nl -ba "$f" | sed -n '1,140p'
fi
done
echo
echo "== scripts and ci files that reference prettier or ignore behavior =="
rg -n --hidden --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' -S 'prettier|pnpm-lock\.yaml|package-lock\.json|yarn\.lock|bun\.lockb|\.lock|format|lint:.*format' -S . | sed -n '1,240p'Repository: sreerevanth/AgentWatch
Length of output: 310
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== current package.json Prettier scripts/dependencies =="
for f in agentwatch-landing/package.json frontend/package.json; do
echo "--- $f ---"
awk '{printf "%4d %s\n", NR, $0}' "$f" | sed -n '1,80p'
done
echo
echo "== workflow Prettier format steps =="
awk '{printf "%4d %s\n", NR, $0}' .github/workflows/ci.yml | sed -n '110,225p'Repository: sreerevanth/AgentWatch
Length of output: 6431
Keep package-local Prettier ignore rules aligned.
The package-local ignore files omit lockfile exclusions used by the root prettier workflow. Since each application runs its own Prettier command, keep these exclusions explicit in both files.
agentwatch-landing/.prettierignore#L1-L7: add*.lockandpackage-lock.json.frontend/.prettierignore#L1-L7: add*.lockandpackage-lock.json.
📍 Affects 2 files
agentwatch-landing/.prettierignore#L1-L7(this comment)frontend/.prettierignore#L1-L7
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agentwatch-landing/.prettierignore` around lines 1 - 7, Update the ignore
rules in agentwatch-landing/.prettierignore (lines 1-7) and
frontend/.prettierignore (lines 1-7) to explicitly include both *.lock and
package-lock.json, keeping the package-local Prettier exclusions aligned.
| # contributor can run `make format` from the repo root and have every | ||
| # sub-package format itself in one shot. | ||
|
|
||
| .PHONY: format format-check format-py format-js format-landing format-frontend help |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align .PHONY with the target definitions.
Line [7] lists format-js, but no format-js rule exists, so make format-js fails. The format-check-py, format-check-frontend, and format-check-landing rules are also absent from .PHONY; a same-named file can suppress a check. Remove format-js or define it, and add the three check targets.
Proposed declaration
-.PHONY: format format-check format-py format-js format-landing format-frontend help
+.PHONY: format format-check format-py format-landing format-frontend \
+ format-check-py format-check-frontend format-check-landing help📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .PHONY: format format-check format-py format-js format-landing format-frontend help | |
| .PHONY: format format-check format-py format-landing format-frontend \ | |
| format-check-py format-check-frontend format-check-landing help |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Makefile` at line 7, Update the Makefile .PHONY declaration to match the
actual target definitions: remove format-js unless a corresponding rule is
added, and include format-check-py, format-check-frontend, and
format-check-landing so those checks always execute even when same-named files
exist.
…reerevanth#644 follow-up) PR sreerevanth#684 opened with package.json updated (prettier + ruff format config) but the lockfiles weren't regenerated, so the CI 'npm ci' step failed with 'Missing: prettier@3.9.6 from lock file' on both frontend and landing page builds. Separately, the new [tool.ruff.format] section in pyproject.toml (quote-style=double) flagged 3 pre-existing files that hadn't been formatted against the new style. This commit: - npm install in frontend/ and agentwatch-landing/ to regenerate their package-lock.json files (prettier now pinned at 3.x.x) - ruff format on the 3 pre-existing files that the new config flagged: - agentwatch/api/auth.py - agentwatch/core/recursion_depth_detector.py - agentwatch/eval/runner.py - verifies 'ruff format --check agentwatch/' is clean - verifies 'ruff check agentwatch/' is clean CI checks now expected to pass: - Python Lint & Type Check (ruff) - Frontend Build & Type Check (npm ci + tsc + vite build) - Landing Page Build (npm ci + next build)
…follow-up) PR sreerevanth#685 picked up the same pre-existing ruff format failure as sreerevanth#684: agentwatch/core/recursion_depth_detector.py needed to be reformatted to match the double-quote style. Running 'ruff format' on the file brings it into compliance with the project's [tool.ruff.format] config and unblocks the Python Lint & Type Check CI step.
…follow-up) Same pre-existing ruff format failure as sreerevanth#684 and sreerevanth#685 — this file needed formatting against the project's double-quote style. Running 'ruff format' on the file unblocks the Python Lint & Type Check.
Description
Adds a unified formatter workflow across all three sub-packages. Issue #644.
The repo has three independent codebases (Python, Next.js dashboard, Next.js landing page) and three different formatters. This PR wires all of them up with matching style and a single
make formatentry point so contributors don't have to remember which tool applies where.What changed
Python (
agentwatch/) — Ruff format. Adds[tool.ruff.format]topyproject.toml:docstring-code-format = truequote-style = "double"(matches existing code)indent-style = "space"Frontend (
frontend/) — Prettier 3.4:prettier ^3.4.2to devDependenciesformatandformat:checknpm scripts.prettierignoreexcludes.next,out,build,coverage,public,node_modules, etc.Landing (
agentwatch-landing/) — Prettier 3.4:prettier ^3.4.2to devDependenciesformatandformat:checknpm scripts.prettierignore(same shape as the dashboard's)AGENTS.mdis auto-generated by Next.js — left untouchedShared config at the repo root:
.prettierrc.jsonwithsemi,singleQuote,trailingComma: "all",printWidth: 100,tabWidth: 2,arrowParens: "always",endOfLine: "lf". Has overrides for.py(matching Ruff) and.md(proseWrap: "preserve")..prettierignoreexcludesagentwatch/,agentwatch.egg-info/,.pytest_cache/,.ruff_cache/,benchmark_artifacts/,reference_artifacts/,package-lock.json, etc.Makefileat the repo root:AGENTS.md— new "Formatting (issue #644)" section documenting the per-sub-package formatter + the all-in-one make targets.Verification
ruff check pyproject.toml✓ (config validates).ruff format --check agentwatch/— 178 files already formatted, 3 pre-existing drift (auth.py, recursion_depth_detector.py, runner.py). Unchanged by this commit so the diff stays reviewable.make formaton first checkout see no churn on the landing package.Closes #644
Summary by CodeRabbit
Chores
Documentation