feat: log each project at squad init and add squad projects command#1391
feat: log each project at squad init and add squad projects command#1391barichter wants to merge 1 commit into
squad projects command#1391Conversation
Every repo-level 'squad init' now records the project (name, path, created_at) in a global projects.json under Squad's existing global home, and a new 'squad projects' command lists them newest-first. The write is additive, idempotent on path, and wrapped in try/catch so a registry failure never blocks init. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🟡 Impact Analysis — PR #1391Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-cli (4 files)
squad-sdk (2 files)
tests (1 file)
|
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ❌ | Branch up to date | dev is 88 commit(s) ahead — rebase recommended |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ❌ | No merge conflicts | Merge conflicts detected — resolve before review |
| ✅ | Copilot threads resolved | No Copilot review threads |
| ❌ | CI passing | 6 check(s) still running |
Files Changed (8 files, +186 −1)
| File | +/− |
|---|---|
.changeset/log-projects-at-init.md |
+15 −0 |
packages/squad-cli/src/cli-entry.ts |
+7 −0 |
packages/squad-cli/src/cli/commands/projects.ts |
+49 −0 |
packages/squad-cli/src/cli/core/command-help.ts |
+7 −0 |
packages/squad-cli/src/cli/core/init.ts |
+10 −1 |
packages/squad-sdk/src/index.ts |
+2 −0 |
packages/squad-sdk/src/projects-registry.ts |
+95 −0 |
test/cli/command-help.test.ts |
+1 −0 |
Total: +186 −1
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🏗️ Architectural Review
Automated architectural review — informational only. |
There was a problem hiding this comment.
Pull request overview
Adds a machine-wide “projects registry” that records each repo where squad init (non---global) runs, and introduces a new squad projects command to list those registered projects.
Changes:
- Introduces
readProjectsRegistry()/registerProject()insquad-sdkbacked by a globalprojects.jsonunderresolveGlobalSquadPath(). - Updates
squad init(repo init only) to register the current project in a best-effort manner. - Adds a new
squad projectsCLI command plus help/command listing updates and a test expectation update.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| .changeset/log-projects-at-init.md | Declares minor releases for CLI/SDK and documents the new registry + command behavior. |
| packages/squad-cli/src/cli-entry.ts | Adds projects to top-level help output and dispatches squad projects to the new command implementation. |
| packages/squad-cli/src/cli/commands/projects.ts | Implements squad projects output (sorted newest-first) from the SDK registry reader. |
| packages/squad-cli/src/cli/core/command-help.ts | Adds projects command help text to the help registry. |
| packages/squad-cli/src/cli/core/init.ts | Registers the repo in the global projects registry during non-global init (best-effort). |
| packages/squad-sdk/src/index.ts | Exposes the new projects registry functions/types as part of the public SDK API. |
| packages/squad-sdk/src/projects-registry.ts | Adds the global registry implementation (projects.json) with safe read + idempotent register. |
| test/cli/command-help.test.ts | Updates expected command list to include projects. |
| entries.push({ name, path: absPath, created_at: new Date().toISOString() }); | ||
| } | ||
|
|
||
| fs.writeFileSync(file, `${JSON.stringify(entries, null, 2)}\n`, 'utf8'); |
What
Adds a global, machine-wide registry of every repository where
squad initruns, plus a read-only
squad projectscommand to list them.squad init(non-global) now records the project in a globalprojects.jsonso you can later see all of your Squad projects and whereeach one lives on disk.
squad projectslists registered projects, newest first, showing name,path, and when each was first registered.
Why
Once you run Squad across several repos there is no way to recall what you
have initialized or where those projects live. This adds a lightweight,
purely additive memory of your projects. It never changes how a project is
initialized or how its own
.squad/state behaves.How
packages/squad-sdk/src/projects-registry.ts:ProjectRegistryEntry { name, path, created_at }readProjectsRegistry(): safe read, returns[]on a missing orcorrupt file so callers never have to guard.
registerProject(name, path): idempotent. Re-running for analready-registered path updates that entry in place (case-insensitive on
win32 and darwin, mirroring
FSStorageProvider) and preserves theoriginal
created_at.squad initwrites to the registry in a best-effort try/catch inside thenon-global branch, so a registry write failure can never block init.
--globalinit does NOT register (matches existing global semantics).squad projectsreader command (table + empty state).Scope and safety
.squad/state.readProjectsRegistry()degrades gracefully on a missing or malformedfile.
Tests / build
npm run buildclean (tsc).command-helptest updated; suite green.APPDATAsandbox: logs at init,
--globaldoes not log, idempotent re-init, tableoutput, and empty-state message all confirmed.
Files (8 changed, +186/-1)
Changeset
@bradygaster/squad-climinor,@bradygaster/squad-sdkminor.