Skip to content

Implement per-pack command populator step in installer engine #165

@virtualian

Description

@virtualian

Context

Implementation of the recommendation from issue #146's investigation. See:

Today engine/command-migration.ts symlinks ~/.claude/commands/<name>.md~/.pai/commands/<name>.md but nothing populates ~/.pai/commands/ from the pack source. Result: pack-shipped commands (e.g. cs.md from ContextSearch) never reach the runtime.

Recommended approach

Per-pack populator that walks Packs/*/src/commands/<name>.md on every install, with per-file copy-if-not-exists semantics (preserves user edits; lets new pack commands land on existing installs).

Acceptance

  • New file at Releases/v4.0.3+/.claude/PAI-Install/engine/pack-source-staging.ts (or extension of an existing module in that same directory) walks Packs/*/src/commands/<name>.md, copies each into ~/.pai/commands/<name>.md only if dest does not exist
  • Releases/v4.0.3+/.claude/PAI-Install/engine/actions.ts:runRepository invokes the new step BEFORE migratePerPackCommands
  • Soft-fail per file (matches existing migrator pattern)
  • Idempotent: second run on an unchanged install does no writes
  • Test fixture covers: fresh install (populator creates files); upgrade with user-edits (populator skips); upgrade shipping new command (populator stages new file)

Out of scope

Refs

Closes #146 when merged. Refs #145 (skill-side analogue), #144 (two-root restructure dependency), PR #164 (investigation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions