Repository navigation
fix(scaffold): adopt existing repos safely - #12
Merged
Merged
Conversation
Reviewer's GuideThe scaffold now adopts existing repositories conservatively: it detects filename and layout conflicts, avoids duplicate tests, normalizes beads prefixes, restores hooks after Sequence diagram for beads initialization and hook restorationsequenceDiagram
participant Scaffold
participant Repo
participant BD as bd
participant Settings as settings.json
Scaffold->>Repo: inspect origin and current branch
Scaffold->>BD: bd init --prefix BD_PREFIX
BD->>Repo: commit initialization on current branch
BD->>Settings: rewrite hooks, retaining SessionStart
Scaffold->>Settings: restore missing bd prime hooks from template
Scaffold-->>Repo: warn about main/master and origin sync target
Flow diagram for safe brownfield scaffold adoptionflowchart TD
A["Start scaffold"] --> B{"Lowercase agents.md exists?"}
B -- Yes --> X["Abort before writing files"]
B -- No --> C{"pyproject.toml exists?"}
C -- Yes --> D["Keep existing package layout"]
C -- No --> E["Create src/<pkg>"]
D --> F["Initialize beads with lowercase hyphenated prefix"]
E --> F
F --> G["Restore missing bd prime hooks"]
G --> H{"Real tests already exist?"}
H -- Yes --> I["Skip test_smoke.py"]
H -- No --> J["Create test_smoke.py"]
I --> K["Warn about branch and beads remote"]
J --> K
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
- preflight: abort if a lowercase agents.md exists (bd init would add AGENTS.md beside it) - existing pyproject: don't create src/<pkg>; skip test_smoke.py when real tests exist - re-add missing bd prime hooks AFTER bd init (it drops PreCompact, also on greenfield) - bd init --prefix: lowercase, hyphenated project name - warn when bd init commits on main and which origin beads will sync its DB to - SKILL.md: brownfield checklist; next steps: verify CI from a clean clone
R0SEWT
force-pushed
the
fix/scaffold-existing-repos
branch
from
October 5, 2026 22:06
24c9931 to
2d7d5e0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lecciones al aplicar el scaffold a un repo existente de cliente (Wachi). Cierra project-kit-5ni.
Cambios
agents.md: aborta si hay unagents.mden minúsculas (bd init crearíaAGENTS.mdal lado).pyproject.tomlpresente): no creasrc/<pkg>; no createst_smoke.pysi ya hay tests reales.bd initreescribe.claude/settings.jsony deja soloSessionStart→ se re-añaden losbd primefaltantes (PreCompact) después debd init. Afecta también a proyectos nuevos.--prefixen minúsculas con guiones.bd initva a commitear enmain, y a quéoriginsincronizará beads su DB (en Wachi apuntaba al repo del cliente).Verificación (local)
bash -nok; dry-run de CI okagents.md→ exit 1 antes de escribir nadasrc/<pkg>ni smoke test, hooks[PreCompact, SessionStart], plugin conservado, aviso de origin[PreCompact, SessionStart], prefijogreen-demoshellcheck no está instalado localmente; lo corre la CI.
Summary by Sourcery
Make scaffolding safe for existing repositories while preserving their structure, maintaining required hooks, and highlighting potentially unsafe beads configuration.
Bug Fixes:
Enhancements:
Documentation: