Add dft init for dbt-native repo bootstrap
Problem
Implement a first-class dft project bootstrap command for existing repos, especially dbt repos that will store dashboards under /faces. The command should detect dbt_project.yml, create or validate faces/ and optional dataface.yml, scaffold starter dashboards or partials, and avoid manual setup steps currently described only in docs. It should support the analytics repo as an internal example-customer path for future M2 dashboard authoring.
Context
- Dataface already assumes a dbt-native repo layout with
faces/as the canonical dashboard directory. - The docs describe a manual workflow rather than a first-class bootstrap command:
docs/docs/guides/installation.mddocs/docs/guides/cli-reference.md- The CLI currently has
validate,compile,serve,render,inspect,agent, andmcpcommands, but no repo/project bootstrap command: dataface/cli/main.py- Existing runtime behavior already auto-detects dbt project markers and repo structure in several places:
apps/playground/routes.pyapps/playground/file_watcher.py- IDE detection paths under
apps/ide/vscode-extension/ - The expected near-term analyst workflow is to add Dataface to an existing dbt repo, especially the internal analytics repo at
/Users/dave.fowler/Fivetran/analytics, and start authoring dashboards in/faces. - Today that requires users to know multiple undocumented or weakly-enforced conventions:
- create
faces/ - optionally add
dataface.yml - understand where starter dashboards/partials should go
- understand how Dataface discovers the dbt project root
- For M1 analyst work, this needs to become a predictable, low-friction command rather than a docs-only setup ritual.
Possible Solutions
Option 1: Improve docs only
- Expand installation and getting-started docs with an "existing dbt repo" recipe.
- Pros:
- Lowest engineering effort
- No CLI surface expansion
- Cons:
- Does not reduce analyst setup friction
- Easy to get slightly wrong in real repos
- Hard to enforce conventions consistently
Option 2: Add a minimal dft init that only creates missing files
- Add a CLI command that detects a dbt repo and creates
faces/,faces/partials/, and optionaldataface.yml. - Pros:
- Solves the main bootstrap problem
- Small surface area
- Cons:
- May still leave users without a useful starter workflow
- Risks becoming a thin wrapper around
mkdir
Option 3: Add a repo-aware dft init with templates and idempotent validation Recommended
- Add a first-class bootstrap command that:
- detects dbt repo/project root
- confirms whether Dataface is already initialized
- creates
faces/,faces/partials/, and optionaldataface.yml - scaffolds starter files
- supports safe re-runs without clobbering existing work
- prints next-step guidance tailored to the detected repo
- Pros:
- Matches the actual intended product workflow
- Gives analysts a single obvious command
- Establishes one canonical repo shape for future docs, IDE, and CI support
- Cons:
- More implementation work
- Requires decisions on template defaults and overwrite behavior
Plan
- Define the desired bootstrap contract for existing dbt repos.
- Inputs: current working directory or explicit
--project-dir- Detection:dbt_project.yml, existingfaces/, existingdataface.yml- Outputs: initialized repo layout plus clear terminal guidance - Add a new CLI command surface, likely
dft init, in the main CLI. - Implement project-root discovery and idempotent filesystem setup.
- Add starter templates.
- Minimum viable set:
faces/hello.ymlor equivalent starter facefaces/partials/_header.ymlif helpful- optional
dataface.yml
- Decide and implement safe overwrite policy. - Create missing files by default - Refuse to overwrite existing files unless an explicit force flag exists
- Add tests for:
- dbt repo detection
- non-dbt directory behavior
- re-running
dft init- project-dir override - Fixture repos: usetmp_pathcopies of minimal dbt layouts; do not require the internal analytics repo in CI. - Update docs to make
dft initthe primary path, not a manual sequence. - Manual validation: run the command against any checkout that contains
dbt_project.yml(e.g.~/Fivetran/analyticswhen that tree exists, or another internal dbt repo). This does not depend on the analytics branch/bootstrap task — only on having a normal dbt project directory to point--project-dirat.
Implementation Progress
- Initial planning notes:
- Confirmed there is currently no
dft initrepo bootstrap command indataface/cli/main.py. - Confirmed docs already describe the target conventions (
faces/, optionaldataface.yml, dbt repo auto-detection), so this task is mainly about productizing that convention. - Confirmed this should land before analyst-facing onboarding, not as a later polish item.
- Ordering vs analytics branch task: implement and test
dft initusing temp dirs + optional manual run in~/Fivetran/analytics(or any dbt repo). The create analytics repo Dataface branch task is for git workflow and internal rollout, not a prerequisite to build or test the CLI. -
faces/placement: must be at the same level asmodels/inside the dbt project dir.dft initdetectsdbt_project.ymland putsfaces/alongsidemodels/,macros/,tests/, etc. -
[x] Tests written first (TDD) —
tests/core/test_init_command.pywith 11 tests covering: - dbt project detection and non-dbt directory behavior
faces/,faces/partials/, starter face, and.gitkeepcreation- Idempotency: re-run skips existing files,
--forceoverwrites --project-diroverride and cwd default- [x] Core implementation —
dataface/cli/commands/init.py: init_command()returns anInitResultdataclass withproject_dir,dbt_detected,created_files,skipped_files- Detects
dbt_project.ymlat project root - Creates
faces/,faces/partials/,faces/hello.ymlstarter, andfaces/partials/.gitkeep - Never overwrites existing files unless
--forceis passed - [x] CLI wiring —
dft initregistered indataface/cli/main.pywith--project-dirand--forceoptions - Prints created/skipped files and next-step guidance
- [x] CI green — 3070 tests pass, lint and format clean
QA Exploration
- [x] QA exploration completed (or N/A for non-UI tasks)
N/A for browser QA. Verification should focus on CLI behavior in temporary repos and in the internal analytics repo.
Review Feedback
- [ ] Review cleared