Skip to content

feat(tooling): add prettier + ruff format config + repo-wide makefile (closes #644) - #684

Open
arcgod-design wants to merge 2 commits into
sreerevanth:mainfrom
arcgod-design:feat/issue-644-prettier
Open

feat(tooling): add prettier + ruff format config + repo-wide makefile (closes #644)#684
arcgod-design wants to merge 2 commits into
sreerevanth:mainfrom
arcgod-design:feat/issue-644-prettier

Conversation

@arcgod-design

@arcgod-design arcgod-design commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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 format entry point so contributors don't have to remember which tool applies where.

What changed

Python (agentwatch/) — Ruff format. Adds [tool.ruff.format] to pyproject.toml:

  • docstring-code-format = true
  • quote-style = "double" (matches existing code)
  • indent-style = "space"

Frontend (frontend/) — Prettier 3.4:

  • Adds prettier ^3.4.2 to devDependencies
  • Adds format and format:check npm scripts
  • .prettierignore excludes .next, out, build, coverage, public, node_modules, etc.

Landing (agentwatch-landing/) — Prettier 3.4:

  • Adds prettier ^3.4.2 to devDependencies
  • Adds format and format:check npm scripts
  • .prettierignore (same shape as the dashboard's)
  • AGENTS.md is auto-generated by Next.js — left untouched

Shared config at the repo root:

  • .prettierrc.json with semi, singleQuote, trailingComma: "all", printWidth: 100, tabWidth: 2, arrowParens: "always", endOfLine: "lf". Has overrides for .py (matching Ruff) and .md (proseWrap: "preserve").
  • .prettierignore excludes agentwatch/, agentwatch.egg-info/, .pytest_cache/, .ruff_cache/, benchmark_artifacts/, reference_artifacts/, package-lock.json, etc.

Makefile at the repo root:

make format                # Format Python + frontend + landing
make format-check          # Verify formatting without modifying
make format-py             # ruff format (Python only)
make format-frontend       # Prettier (frontend/ only)
make format-landing        # Prettier (agentwatch-landing/ only)

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.
  • 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.

Closes #644

Summary by CodeRabbit

  • Chores

    • Introduced consistent formatting standards across Python, frontend, and landing-page code.
    • Added commands to format code and verify formatting automatically.
    • Configured tooling to ignore generated files, build outputs, caches, coverage data, and other non-source artifacts.
  • Documentation

    • Added guidance for running formatting and verification workflows.
    • Updated code examples and documentation formatting for improved consistency.

…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.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c58c574e-f629-4c46-9808-a4c553a2e158

📥 Commits

Reviewing files that changed from the base of the PR and between 962017a and e7c682e.

⛔ Files ignored due to path filters (2)
  • agentwatch-landing/package-lock.json is excluded by !**/package-lock.json
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • agentwatch/api/auth.py
  • agentwatch/core/recursion_depth_detector.py
  • agentwatch/eval/runner.py

📝 Walkthrough

Walkthrough

Added 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.

Changes

Formatting tooling

Layer / File(s) Summary
Define formatting rules
.prettierrc.json, pyproject.toml, .prettierignore
Added shared Prettier rules, Ruff formatter settings, and root ignore patterns.
Enable project formatting
agentwatch-landing/..., frontend/...
Added project-specific Prettier configurations, ignore patterns, scripts, and development dependencies.
Wire root commands
Makefile, AGENTS.md
Added root formatting and format-check targets with contributor instructions.
Align source documentation
agentwatch/api/auth.py, agentwatch/core/recursion_depth_detector.py, agentwatch/eval/runner.py
Reformatted documentation examples and a pattern-compilation assignment without changing runtime behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: documentation, level: beginner

Suggested reviewers: sakethsumanbathini

Poem

A rabbit checks each tidy line,
Prettier rules fall into line.
Ruff formats the Python trail,
Make commands guide without fail.
Clean diffs bloom beneath my tail.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the added Prettier and Ruff formatting configuration and repository-wide Makefile.
Linked Issues check ✅ Passed The changes add shared Prettier configuration and format scripts for both frontend packages, satisfying issue #644.
Out of Scope Changes check ✅ Passed The Makefile, Ruff configuration, documentation, and Python formatting changes support the stated unified formatting workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
ast-grep config was not available before execution

agentwatch/core/recursion_depth_detector.py

/bin/bash: line 1: printf: write error: No space left on device
ast-grep config was not available before execution

agentwatch/eval/runner.py

/bin/bash: line 1: printf: write error: No space left on device
ast-grep config was not available before execution


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🧪 PR Test Results

Check Result
Tests (pytest tests/) ✅ success
Lint (ruff check .) ✅ success
Coverage (agentwatch) 74.19%

Python 3.12 · commit e7c682e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d94dfd0 and 962017a.

📒 Files selected for processing (10)
  • .prettierignore
  • .prettierrc.json
  • AGENTS.md
  • Makefile
  • agentwatch-landing/.prettierignore
  • agentwatch-landing/.prettierrc.json
  • agentwatch-landing/package.json
  • frontend/.prettierignore
  • frontend/package.json
  • pyproject.toml

Comment on lines +1 to +7
.next
node_modules
out
build
dist
coverage
public/favicon.ico

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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 *.lock and package-lock.json.
  • frontend/.prettierignore#L1-L7: add *.lock and package-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.

Comment thread agentwatch-landing/package.json
Comment thread Makefile
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
.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)
arcgod-design added a commit to arcgod-design/AgentWatch that referenced this pull request Aug 3, 2026
…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.
arcgod-design added a commit to arcgod-design/AgentWatch that referenced this pull request Aug 3, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Implement Prettier for automated code formatting

1 participant