From 43a8c5017e9e5c3dcfad860f195ad7836f29b48f Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Fri, 10 Jul 2026 11:33:57 +0100 Subject: [PATCH] feat: environment discovery before setup questions in start-new-project (#55) Step 0 preflight: read-only detection of git identity, gh auth/owner, SSH host aliases and existing profile/project config before any setup question; precedence user instruction -> project config -> detected tool state -> ask; one-line confirmation on detected values; accepted values state where they are recorded; secrets never stored (standard tools authoritative); multiple accounts/clusters ask, never assume. GitHub step 6 and the HPC step consume the discovery. The user.yaml defaults half stays deferred/evidence-gated. Co-Authored-By: Claude Fable 5 --- skills/start-new-project.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/skills/start-new-project.md b/skills/start-new-project.md index e423b1e..54d5ebe 100644 --- a/skills/start-new-project.md +++ b/skills/start-new-project.md @@ -34,6 +34,31 @@ demand as the project matures. Match the user's intent to a phase and do only th ## Phase 1 — Create +### 0. Environment discovery — run before asking setup questions + +Any step that needs identity or infrastructure values (name/ORCID for `project.yaml` + +`CITATION.cff`, GitHub owner at step 6 / Collaborate, HPC alias for the `hpc/` step) +**discovers before it asks**. Precedence: the user's current instruction → project +configuration (`project.yaml`, `hpc/sync.conf`, `wiki/project/profile.md`) → detected +standard-tool state → ask one focused question. + +Detect from standard tools (read-only; never store, echo, or copy credentials): + +- Git identity: `git config user.name` / `git config user.email`. +- GitHub account + auth: `gh auth status`; default owner via `gh api user --jq .login`. +- SSH host aliases (candidate HPC targets): `grep -E '^Host ' ~/.ssh/config` (skip quietly + if absent or unreadable). +- The assistant profile (`wiki/project/profile.md`) and, inside a project, its `project.yaml`. + +When a detected value is used, say so in one line ("using GitHub owner `X` from `gh auth` — +correct?") so the user can override; when nothing is detected, ask. State where an accepted +value will be recorded (`project.yaml`, `profile.md`, or `hpc/sync.conf` — secrets only ever +live in `~/.ssh/config` / `gh auth`). Standard tools stay authoritative for authentication +and account selection: with multiple accounts, clusters, or SSH aliases detected, ask which +to use — never assume one global default. This is a lightweight preflight, not an onboarding +form: detect, state, confirm, move on. (A machine-local defaults file for non-secret values +is deliberately deferred until real multi-project usage shows which values recur.) + ### 1. Name > **What should this project be called?** (folder name, created at `/` *outside* > this assistant clone; short and descriptive, e.g. `slacs_subhalo`, `euclid_pilot`.) @@ -235,7 +260,8 @@ __pycache__/ *.pyc ``` -**Optional HPC step — ask once:** *"Set up an HPC folder for this project?"* +**Optional HPC step — ask once:** *"Set up an HPC folder for this project?"* (Offer step 0's +detected SSH host aliases as candidate clusters instead of asking cold.) - **Yes** → copy the assistant's `hpc/` (batch templates, `sync`, `template.py`) into the project and configure (job name, `--array`, `SCRIPT=`, `sample=`, `datasets=(...)`). - **No** → create only `hpc/README.md` containing the ready-to-paste prompt: @@ -254,7 +280,9 @@ to `~/.bashrc` (source the venv, `cd` in). ### 6. GitHub (private) — optional now, or at Collaborate Offer a **private** repo for backup/collaborators: -`gh repo create / --private --source=. --push`. Public comes only at Publish. +`gh repo create / --private --source=. --push` — `` from step 0's +discovery (confirm in one line), asking only if multiple accounts/orgs are plausible. +Public comes only at Publish. ---