chore: align repo with agentic SDLC scaffolding practices - #599
NilashishC wants to merge 8 commits into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Comment |
|
@coderabbitai review |
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #599 +/- ##
==========================================
- Coverage 95.69% 95.69% -0.01%
==========================================
Files 231 231
Lines 14296 14298 +2
Branches 3857 3859 +2
==========================================
+ Hits 13681 13682 +1
- Misses 601 602 +1
Partials 14 14
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Centralize git hooks on pre-commit, enforce plugin import boundaries via ESLint, document fast-feedback commands, and wire pre-commit into install-deps. Assisted-by: Claude Sonnet 5
Add Husky and pre-commit commit-msg validation that rejects Co-authored-by lines naming AI tools, and document Assisted-by / Generated by as the accepted attribution patterns. Assisted-by: Composer
Prune lint-staged from the lockfile so yarn install --immutable passes in CI. Add PR change summary for repo scaffolding work. Assisted-by: Composer
The test.yml pre-commit job has no yarn install, so eslint and OpenAPI hooks fail there. They already run in pr.yml after dependencies are installed. Assisted-by: Composer
Fix line wrapping in files left unformatted after ESLint auto-fix so pre-commit run --all-files passes in CI. Assisted-by: Composer
Unpinned prettier resolved to latest on CI fresh installs while local caches kept older versions, causing prettier hook failures in test.yml. Pin prettier@3.6.2 and run ESLint before Prettier so --fix changes are formatted on commit. Assisted-by: Composer
The IAAPService Pick<> interface was left in eslint --fix layout that prettier 3.6.2 reformats on CI fresh installs. Assisted-by: Composer
Document follow-up commits (test.yml skip, prettier pin, formatting) and how to reproduce test.yml locally with a fresh pre-commit environment. Assisted-by: Composer
bb43798 to
041a9ac
Compare
|



Description
Align ansible-backstage-plugins with Agentic SDLC repo scaffolding best practices — better AI agent context, deterministic enforcement, and contributor onboarding.
Ref: https://gitlab.cee.redhat.com/global-engineering/wg-agentic-sdlc/-/blob/main/best-practices/repo-scaffolding/README.md?ref_type=heads
Changes
1. Agent context (Tier 1)
.cursorrules- trimmed to pointer (~186 lines removed)Change: Replaced duplicated project guidance with a short pointer to
AGENTS.md.Reasoning: Best practice 1.2: single source of truth for agent context. Duplicated
.cursorrules/AGENTS.mdcontent drifts over time; agents and humans should read one canonical file.AGENTS.md- expanded and correctedChanges:
yarn workspace <pkg> exec <bin>does not work in Yarn 4 withnodeLinker: node-modulesReasoning: Best practice 1.3: agents need copy-paste commands that actually work. Wrong commands (e.g. broken
exec tsc) waste agent cycles. Documenting architecture boundaries helps agents avoid invalid imports before CI catches them.2. Deterministic enforcement (Tier 2)
.husky/pre-commit- delegate topre-commitChange: Replaced
yarn lint-stagedwithpre-commit run --hook-stage pre-commit.Reasoning: Best practice 2.2: one IDE-agnostic enforcement layer. Husky is only the Git entry point; hook logic lives in
.pre-commit-config.yaml(same locally and in CI)..pre-commit-config.yaml- ESLint + commit-msg hooksChanges:
eslintlocal hook →scripts/pre-commit-lint.shalways_run: truefrom Prettier (only runs on staged matching files)check-commit-attributionhook (stages: [commit-msg])Reasoning: Centralizes all commit-time checks. ESLint via Backstage CLI handles monorepo package boundaries; attribution hook enforces Red Hat AI commit policy at commit time, not only in CodeRabbit review.
scripts/pre-commit-lint.sh(new)Change: Runs
yarn backstage-cli repo lint --fix; if e2e files are staged, runstsc --noEmitine2e-tests/.Reasoning: Root
npx eslintbreaks on e2e TypeScript (wrong config/parser). Backstage CLI is monorepo-aware; e2e gets a separate type-check only when relevant files are staged.package.json- removedlint-stagedChange: Dropped
lint-stagedscript, config block, and devDependency.Reasoning: Avoids two parallel lint paths (lint-staged vs pre-commit). Single source of truth reduces drift and “passes locally, fails in CI” surprises.
.config/eslint-architecture.js(new)Change: Shared ESLint rules for three plugin tiers:
AAPClient/ScmClientfrom common barrelReasoning: Best practice 3.3: architectural boundaries should be machine-enforced, not just documented. Matches the dependency flow in
AGENTS.mdand prevents frontend → AAP direct access.Plugin
.eslintrc.jsfiles (6 plugins)Change: Each extends
eslint-architecture.jswith the appropriate profile (frontend,backend, orcommon).Reasoning: Wires boundary rules into each package’s existing Backstage ESLint factory config.
Minor Prettier formatting fixes (8 source files)
Files:
GitlabClient.ts,helpers.ts,prepareForPublish.ts,EEDetailsPage.tsx,useLatestCIActivity.ts,AAPResourcePicker.tsx,CollectionsPickerExtension.tsxReasoning: Incidental — auto-fixed when ESLint/Prettier ran during the new pre-commit hook. No behavior change.
3. Onboarding (Tier 2)
install-deps: install pre-commit CLIChange: After
yarn install, runspython3 -m pip install pre-commitandpre-commit install-hooks(with fallback viapython3 -m pre_commit).Reasoning: Closes onboarding gap. Contributors previously had to manually
pip install pre-commitor commits would fail at the Husky hook. Prefetching hook envs speeds up the first commit..config/requirements.txt: addedpre-commitChange: One-line addition at top of requirements file.
Reasoning: Aligns Python dev deps with what CI/docs expect; available for docs tooling installs.
README.md,CONTRIBUTING.md,docs/installation.mdChanges:
install-depsinstalls pre-commitAssisted-by/Generated by, no email required)Reasoning: Onboarding docs should match actual setup flow. Contributors shouldn’t discover missing
pre-commitonly at firstgit commit.4. AI commit attribution (Tier 2 + policy)
scripts/check-commit-attribution.sh(new)Change:
commit-msgvalidation that rejectsCo-authored-by:lines naming AI tools/bots (Cursor, Claude, Copilot,[bot], etc.). Allows human co-authors and accepted patterns:Reasoning: Red Hat policy and Linux kernel precedent: AI tools must not use
Co-authored-by. Enforcement at commit time is stronger than CodeRabbit warnings alone. Human pair-programming co-authors remain valid..husky/commit-msg(new)Change: Runs
pre-commit run check-commit-attribution --hook-stage commit-msg --commit-msg-filename "$1".Reasoning: Husky triggers validation; only the attribution hook runs (not Prettier on
.git/COMMIT_EDITMSG, which caused failures when all hooks ran on commit-msg stage)..coderabbit.yaml:ai-attributioninstruction updateChange: Clarified accepted patterns:
"Assisted-by: <tool>"or"Generated by <tool>"(no email required).Reasoning: Keeps automated PR review aligned with local hook policy and contributor docs.
Related Issues
N/A
Type of Change
Testing
N/A
Screenshots (if applicable)
N/A
Checklist