Skip to content

feat: local web cockpit (repo settings, MR sidebar, reviews via worktrees) - #8

Open
naashw wants to merge 5 commits into
developfrom
feat/web-config-page
Open

feat: local web cockpit (repo settings, MR sidebar, reviews via worktrees)#8
naashw wants to merge 5 commits into
developfrom
feat/web-config-page

Conversation

@naashw

@naashw naashw commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Content

The local web cockpit, built up in one branch as agreed.

Repo settings page

  • GET /api/config, PUT /api/config/rules, PUT /api/config/sync-auto-push (per-server CSRF token, same pattern as POST /api/fix).
  • RepoSettings.vue: edit .codesema/RULES.md, toggle auto-sync.

Open MRs and local branches sidebar

  • forge-mrs.ts: lists open MRs through gh/glab (forge detection shared with prep.ts via detectForgeHint), strict JSON validation, graceful available: false when there is no remote/CLI.
  • GET /api/branches: local branches with current/worktree markers (git worktree list --porcelain) and last-commit info.
  • MrSidebar.vue + BranchSidebar.vue sections wired into the existing navigation.

Agentless preview on click

  • Pure diff computation extracted from prep.ts (no disk writes): GET /api/preview returns source/target branches, commits, files with +/- and statuses; GET /api/preview/diff serves one file's diff on demand (size-capped with a truncated flag, path validated against the diff file list).
  • PreviewPanel.vue: branches, commit list, file list, per-file colored diff.

Run reviews via disposable worktrees

  • Unified runner (mr-review-runner.ts): source is an MR (fetched with an explicit refspec) or a local branch; a branch already checked out gets a detached worktree on the same commit. Worktree always created in a temp dir and removed in a finally; archive written to the main repo's .codesema.
  • POST /api/mrs/review (token-protected, 409 when a run is active, 404 for unknown source) and GET /api/mrs/review/status.
  • review.ts refactor: runSimpleFlow/runDualFlow shared by the CLI command and the web runner.
  • "Run review" / "Run dual review" buttons on MRs and branches, auto-switch to the live view.

363 tests pass, full build green. Version 0.11.0, changelog updated.

Known limitation

syncAutoPush is a global-only setting in config.ts: the UI toggle flips it globally, not per repo. Per-repo override (with matching codesema config menu support) is a follow-up.

Test it

bun run build && node packages/cli/dist/index.mjs show

Open the printed URL: MRs and branches on the left, pick one to see the diff without any agent, run a review from there; "Repo settings" for rules and auto-sync.

🤖 Generated with Claude Code

@getcodesema getcodesema Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Codesema Code Review — ✅ Approuvé

MR bien construite et testée : une page « Paramètres du dépôt » dans l'UI locale permet d'éditer .codesema/RULES.md et de basculer l'auto-sync, via 3 endpoints (GET /api/config, PUT /api/config/rules, PUT /api/config/sync-auto-push) protégés par un jeton CSRF par serveur, calqué sur /api/fix. Le changement cassant (cwd désormais obligatoire sur startServer) est propagé à TOUS les appelants (review, show, tests), la propriété de sécurité « un dépôt ne peut pas activer l'auto-push lui-même » est verrouillée par un test dédié, et le correctif readJsonBody (drainage au lieu de destruction de socket) est soigné et commenté. Conventions respectées (test colocalisé, composant Vue au bon endroit). Seul point mineur : l'interrupteur « Auto-sync » présenté sous « Paramètres du dépôt » écrit en réalité un réglage global — à clarifier. Verdict : approuvé.

2 points relevés

  • INFO packages/cli/src/repo-config.test.ts:57 — Bon réflexe : ce test fige la garantie qu'un dépôt ne peut pas activer lui-même syncAutoPush (seule la config globale décide), ce qui empêche un dépôt cloné d'auto-pousser des revues vers l'extérieur.
  • INFO packages/cli/src/serve.ts:233 — Au lieu de détruire la socket sur un corps trop volumineux (ce qui coupait la connexion avant l'envoi de la réponse d'erreur), le flag tooLarge draine la requête puis laisse le handler répondre proprement 400 — le commentaire en explique clairement la raison.

🤝 MR approuvée · 1 remarque en ligne par @getCodesema[bot].

👉 Voir la review complète (diff annoté + explications)

Review générée automatiquement par l'agent Codesema.

Comment thread packages/web/src/i18n.ts Outdated
'settings.saved': 'Saved ✓',
'settings.saveError': 'Could not save the rules.',
'settings.autoSyncTitle': 'Auto-sync',
'settings.autoSyncHint': 'Automatically push every completed review to codesema.com.',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 CONCEPTION · MINOR — Le bouton « Auto-sync » est présenté sous « Paramètres du dépôt » mais écrit en réalité la config globale (setSyncAutoPush → saveGlobalConfig). Un utilisateur qui l'active en pensant ne concerner que ce dépôt fera aussi pousser automatiquement vers codesema.com les revues de TOUS ses autres dépôts. Préciser dans le libellé/hint que la synchronisation automatique est un réglage global (tous les dépôts), et ajuster de même la version fr.

@naashw naashw changed the title feat: repo settings page in the web UI feat: local web cockpit (repo settings, MR sidebar, reviews via worktrees) Jul 29, 2026
Comment thread packages/cli/src/prep.test.ts Fixed
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.

2 participants