Skip to content

feat: log each project at squad init and add squad projects command#1391

Open
barichter wants to merge 1 commit into
bradygaster:devfrom
barichter:feat/squad-init-project-registry
Open

feat: log each project at squad init and add squad projects command#1391
barichter wants to merge 1 commit into
bradygaster:devfrom
barichter:feat/squad-init-project-registry

Conversation

@barichter

Copy link
Copy Markdown

What

Adds a global, machine-wide registry of every repository where squad init
runs, plus a read-only squad projects command to list them.

  • squad init (non-global) now records the project in a global
    projects.json so you can later see all of your Squad projects and where
    each one lives on disk.
  • squad projects lists 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

  • New packages/squad-sdk/src/projects-registry.ts:
    • ProjectRegistryEntry { name, path, created_at }
    • readProjectsRegistry(): safe read, returns [] on a missing or
      corrupt file so callers never have to guard.
    • registerProject(name, path): idempotent. Re-running for an
      already-registered path updates that entry in place (case-insensitive on
      win32 and darwin, mirroring FSStorageProvider) and preserves the
      original created_at.
  • squad init writes to the registry in a best-effort try/catch inside the
    non-global branch, so a registry write failure can never block init.
  • --global init does NOT register (matches existing global semantics).
  • New squad projects reader command (table + empty state).

Scope and safety

  • Additive only. No change to existing init behavior or .squad/ state.
  • Registry file lives alongside the existing global Squad state.
  • readProjectsRegistry() degrades gracefully on a missing or malformed
    file.

Tests / build

  • npm run build clean (tsc).
  • Lint clean.
  • command-help test updated; suite green.
  • Verified end-to-end against the built CLI in an isolated APPDATA
    sandbox: logs at init, --global does not log, idempotent re-init, table
    output, and empty-state message all confirmed.

Files (8 changed, +186/-1)

.changeset/log-projects-at-init.md
packages/squad-cli/src/cli-entry.ts
packages/squad-cli/src/cli/commands/projects.ts
packages/squad-cli/src/cli/core/command-help.ts
packages/squad-cli/src/cli/core/init.ts
packages/squad-sdk/src/index.ts
packages/squad-sdk/src/projects-registry.ts
test/cli/command-help.test.ts

Changeset

@bradygaster/squad-cli minor, @bradygaster/squad-sdk minor.

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>
Copilot AI review requested due to automatic review settings June 25, 2026 22:16
@github-actions

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1391

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 8
Files added 3
Files modified 5
Files deleted 0
Modules touched 4
Critical files 1

🎯 Risk Factors

  • 8 files changed (6-20 → MEDIUM)
  • 4 modules touched (2-4 → MEDIUM)
  • Critical files touched: packages/squad-sdk/src/index.ts

📦 Modules Affected

root (1 file)
  • .changeset/log-projects-at-init.md
squad-cli (4 files)
  • packages/squad-cli/src/cli-entry.ts
  • packages/squad-cli/src/cli/commands/projects.ts
  • packages/squad-cli/src/cli/core/command-help.ts
  • packages/squad-cli/src/cli/core/init.ts
squad-sdk (2 files)
  • packages/squad-sdk/src/index.ts
  • packages/squad-sdk/src/projects-registry.ts
tests (1 file)
  • test/cli/command-help.test.ts

⚠️ Critical Files

  • packages/squad-sdk/src/index.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit b186993

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 4 item(s) to address before review

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.

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Architectural Review

⚠️ Architectural review: 2 warning(s).

Severity Category Finding Files
🟡 warning bootstrap-area 2 file(s) in the bootstrap area (packages/squad-cli/src/cli/core/) were modified. These files must maintain zero external dependencies. Review carefully. packages/squad-cli/src/cli/core/command-help.ts, packages/squad-cli/src/cli/core/init.ts
🟡 warning export-surface Package entry point(s) modified with 6 new/changed export(s). New public API surface requires careful review for backward compatibility. packages/squad-sdk/src/index.ts

Automated architectural review — informational only.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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() in squad-sdk backed by a global projects.json under resolveGlobalSquadPath().
  • Updates squad init (repo init only) to register the current project in a best-effort manner.
  • Adds a new squad projects CLI 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');
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.

3 participants