Skip to content

refactor: dev scripts#2573

Merged
asvishnyakov merged 103 commits intomainfrom
feat/refactor-scripts
Apr 8, 2026
Merged

refactor: dev scripts#2573
asvishnyakov merged 103 commits intomainfrom
feat/refactor-scripts

Conversation

@asvishnyakov
Copy link
Copy Markdown
Member

@asvishnyakov asvishnyakov commented Oct 6, 2025

PR summary

What

Completes the developer tooling refactor: unified workspace commands, Python tooling parity, CI restructure, parallel E2E, and shared agent config.

Frontend commands — root package.json now owns all entrypoints:

Area Check / Run Fix
Lint JS/TS pnpm lint pnpm lint:fix
Format JS/TS pnpm format-check pnpm format
Type check pnpm type-check
Build pnpm build
Unit tests pnpm test
E2E tests pnpm test:e2e
E2E tests (interactive) pnpm test:e2e:interactive

Note: Copilot is excluded from type checking because of its unusual structure: it depends directly on frontend sources rather than on a shared package.

Python tooling — mirrors the JS side; all run from repo root:

Area Check Fix
Lint uv run scripts/lint.py uv run scripts/lint.py --fix
Format uv run scripts/format.py --check uv run scripts/format.py
Type check uv run scripts/type_check.py
  • Root pyproject.toml added: ruff, mypy, and pytest config moved here from backend/pyproject.toml
  • uv.lock promoted to repo root
  • Python <3.14 now explicitly declared.

Other changes

CI — restructure checks so CI, lint-staged, and local dev all call the same entrypoints, eliminating the class of "works locally but fails in CI" bugs:

  • Rename and restructure lint workflows to use a matrix (lint / format / type-check), now calling the same commands as local dev:
Old New Commands
lint-backend check-backend - scripts/lint.py
- scripts/format.py --check
- scripts/type_check.py
lint-ui check-frontend - pnpm lint
- pnpm format-check
- pnpm type-check
  • Rename pytest.yamltests.yaml; add pnpm test alongside pytest so frontend unit tests run in CI too
  • Pin action versions across all workflows
  • Add concurrency cancellation for non-main branches

E2E — reduce CI time and improve isolation:

  • Add cypress-split to distribute specs across configurable parallel shards per OS
  • Cache the Cypress binary before pnpm install
  • Upload screenshots per OS + shard index

lint-staged — use new root commands for all pre-commit checks:

  • JS/TS lint, format, and type-check now go through the same root pnpm commands as CI
  • Add actionlint for .github/workflows/ changes

AI agent config — introduce .shared/ so Claude, Cursor, and Copilot read agent settings, rules, and skills from one place:

  • Add MCP-first requirement to AGENTS.md
  • Refresh CONTRIBUTING.md and Copilot instructions to match new commands

Docs — add CI cache P2 implementation plan

Why

  • Developers, CI, and lint-staged were calling different entrypoints for the same tools; now all three use the same commands.
  • Python tooling lacked the file-scopeable, locally runnable wrappers that JS already had.
  • Matrix-based check-backend / check-frontend surface individual failures faster than the old monolithic lint jobs.
  • Parallel E2E shards reduce total CI time proportionally to shard count; binary caching eliminates a repeated download on every run.
  • .shared/ removes copy-paste drift across Claude, Cursor, and Copilot configurations.

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 21, 2025
@github-actions
Copy link
Copy Markdown

This PR was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this Oct 29, 2025
@asvishnyakov asvishnyakov reopened this Nov 7, 2025
@github-actions github-actions bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 8, 2025
@asvishnyakov asvishnyakov marked this pull request as ready for review April 8, 2026 01:53
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. dev-tooling Relating to developer/contributor toolings. labels Apr 8, 2026
@asvishnyakov
Copy link
Copy Markdown
Member Author

@hayescode @sandangel It's ready for review now. There are still room for improvement, especially regardless E2E tests, but I think it's better to merge this "as is" and then contribute separate PRs after. If you have any questions - please write here.

Earlier restores used the local main ref, which diverged from origin/main.

Co-Authored-By: Cursor <cursoragent@cursor.com>
Made-with: Cursor
Copy link
Copy Markdown
Contributor

@hayescode hayescode left a comment

Choose a reason for hiding this comment

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

Well done @asvishnyakov much faster!

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

8 issues found across 51 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="CONTRIBUTING.md">

<violation number="1" location="CONTRIBUTING.md:174">
P2: Use shell comment syntax (`#`) or separate explanatory text; `//` inline comments make these documented commands invalid when copy-pasted.</violation>
</file>

<file name="scripts/lint.py">

<violation number="1" location="scripts/lint.py:9">
P3: Function docstring is inaccurate: `main()` runs Ruff, not pytest.</violation>
</file>

<file name="package.json">

<violation number="1" location="package.json:33">
P1: `format:files`/`format` combine Prettier `--check` with `--write`, so format commands fail instead of writing fixes.</violation>
</file>

<file name="libs/copilot/package.json">

<violation number="1" location="libs/copilot/package.json:10">
P2: This `type-check` script silently skips TypeScript validation while still returning success, so workspace type-checking can pass with unchecked copilot type errors.</violation>
</file>

<file name="docs/plans/2026-03-31-eslint-v9-migration.md">

<violation number="1" location="docs/plans/2026-03-31-eslint-v9-migration.md:319">
P2: The added glob explanation line is malformed and uses an incorrect pattern (`backend/**/_.py`), which can misdocument the intended lint scope.</violation>
</file>

<file name="libs/react-client/package.json">

<violation number="1" location="libs/react-client/package.json:6">
P1: `preinstall` enforces pnpm in a published library package, which blocks npm/yarn users from installing `@chainlit/react-client`.</violation>
</file>

<file name="scripts/format.py">

<violation number="1" location="scripts/format.py:9">
P3: The function docstring is incorrect: this script runs `ruff format`, not pytest.</violation>
</file>

<file name="docs/research/ci-cache-optimization.md">

<violation number="1" location="docs/research/ci-cache-optimization.md:243">
P2: The added CI example uses removed workflow names/paths (`lint-ui.yaml`, `lint-backend.yaml`), so the snippet is incorrect and not runnable as written.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread package.json
Comment thread libs/react-client/package.json Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread libs/copilot/package.json
Comment thread docs/plans/2026-03-31-eslint-v9-migration.md Outdated
Comment thread docs/research/ci-cache-optimization.md
Comment thread scripts/lint.py Outdated
Comment thread scripts/format.py Outdated
@asvishnyakov
Copy link
Copy Markdown
Member Author

asvishnyakov commented Apr 8, 2026

@hayescode I forgot to dry run publish workflows to make sure nothing breaks on publishing, please don't merge before I do it

UPD. Done

image image

asvishnyakov and others added 7 commits April 8, 2026 03:59
Keep reusable child workflows from cancelling each other so publish and publish-libs can run side by side while ci.yaml remains the single concurrency gate.

Co-Authored-By: GPT-5.4 <noreply@openai.com>
Made-with: Cursor
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="CONTRIBUTING.md">

<violation number="1" location="CONTRIBUTING.md:86">
P3: The new root-level run command makes the subsequent sample-file path guidance inconsistent; update that guidance to `backend/chainlit/sample/hello.py` to avoid contributor confusion.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread CONTRIBUTING.md
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/publish.yaml">

<violation number="1" location=".github/workflows/publish.yaml:70">
P1: `packages-dir` now points to `dist` at repo root, but artifacts are still built under `backend/dist`, so publish will fail to find packages.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .github/workflows/publish.yaml
@asvishnyakov asvishnyakov added this pull request to the merge queue Apr 8, 2026
Merged via the queue into main with commit b30bfa0 Apr 8, 2026
48 checks passed
@asvishnyakov asvishnyakov deleted the feat/refactor-scripts branch April 8, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-tooling Relating to developer/contributor toolings. keep-for-a-while Don’t mark as stale. This label should be used only for confirmed bugs or other important things size:XL This PR changes 500-999 lines, ignoring generated files. stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants