Skip to content

feat: migrate CLI + ai-context-migrate skill (1.1.0)#4

Merged
TimCrooker merged 27 commits into
mainfrom
feat/migrate-cli-and-skill
May 28, 2026
Merged

feat: migrate CLI + ai-context-migrate skill (1.1.0)#4
TimCrooker merged 27 commits into
mainfrom
feat/migrate-cli-and-skill

Conversation

@TimCrooker

@TimCrooker TimCrooker commented May 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • New ai-context migrate CLI subsystem (plan/status/apply/clean)
  • New ai-context-migrate bundled skill for agent-driven curation
  • EPMX-adapted gauntlet for validating migrations
  • Self-test against gauntlet fixture (scripts/test-migrate-on-gauntlet.sh)

Depends on

#3 (1.0.0 release) merging first. This branch is currently based on the 1.0.0 work; once #3 merges, this PR will rebase onto main.

Spec + plan

Validation

Empirically validated against EPMX Monorepo (EPMX PR #511):

  • 40 legacy entries → 39 migrated skills with proper cross-CLI mirror symlinks
  • EPMX-adapted gauntlet 5/5 stages PASS across Claude/Codex/Gemini
  • Pre-existing WIP changes (release-scope-risk-assessment) preserved through migration

Plus the kit's internal validation:

  • 34 test files, 173 tests passing (core: 25/131, templates: 2/22, cli: 7/20)
  • Self-test (scripts/test-migrate-on-gauntlet.sh) PASSES on synthetic legacy fixture
  • Full gauntlet from 1.0.0 (stages 1-11) continues to pass

The 4-phase model

Phase Tool Effect
1. Audit ai-context migrate plan Read-only; writes .ai/migration-plan.json
2. Curate (optional) ai-context-migrate skill (agent) Edits plan with merge/drop decisions
3. Apply ai-context migrate apply Executes plan; per-entry git commits
4. Verify ai-context build/verify/doctor + gauntlet Confirms healthy state

Test plan

  • All unit tests pass (pnpm -r test)
  • Typecheck clean (pnpm -r typecheck)
  • Build succeeds (pnpm -r build)
  • Migrate self-test passes (scripts/test-migrate-on-gauntlet.sh)
  • EPMX migration applied successfully (39 skills migrated, all cross-CLI discoverable)
  • EPMX gauntlet passes for Claude/Codex/Gemini

🤖 Generated with Claude Code

Note

Add ai-context migrate CLI and ai-context-migrate skill for migrating legacy skill layouts

  • Adds migrate plan, migrate status, migrate apply [--dry-run], and migrate clean subcommands to the CLI, each with console reporting and structured exit codes.
  • Implements four migration actions (move_dir, promote_bare_md, consolidate_symlink, keep_existing) in migrate.ts that reorganize legacy .claude/skills/ layouts into .ai/skills/<name>/SKILL.md with mirror symlinks under .agents/skills/ and .claude/skills/.
  • All apply operations run as git commits; applyPlan enforces a clean working tree, git repo presence, and a valid manifest skills block before executing.
  • Bundles a new ai-context-migrate skill (with reference docs) into the templates package via a refactored skills-bundler.ts that now discovers all skills under packages/templates/src/skills/*.
  • Adds eight new AICTX_MIGRATE_* error codes and full Vitest coverage across classify, plan, apply, serialize, and precondition modules.

Macroscope summarized e2a0126.

Copilot AI review requested due to automatic review settings May 26, 2026 18:11
@macroscopeapp

macroscopeapp Bot commented May 26, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

Unable to check for correctness in e2a0126. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds the 1.1 migration workflow on top of the skills system: a new ai-context migrate CLI, bundled migration curation skill, gauntlet/self-test assets, and expanded docs/templates for cross-CLI skills.

Changes:

  • Adds skills discovery/mirroring APIs, migration planning/apply APIs, and CLI commands for skills and migrate.
  • Bundles ai-context-kit and ai-context-migrate skills into templates and gauntlet fixtures.
  • Adds docs, tests, changesets, and validation scripts/results for skills and migration flows.

Reviewed changes

Copilot reviewed 167 out of 171 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/core/src/migrate.ts Implements migration plan generation and apply execution.
packages/core/src/skills.ts Adds skill parsing, discovery, mirror planning, symlink/copy creation.
packages/core/src/engine.ts Integrates skills into build/verify/diff/doctor/init.
packages/core/src/config.ts Adds manifest skills block loading.
packages/core/src/render.ts Adds kit-awareness stanza to generated root files.
packages/core/src/types.ts Adds skill and migration type definitions.
packages/core/src/io.ts Adds symlink/copy filesystem helpers.
packages/core/src/errors.ts Adds skill and migration error codes.
packages/core/src/index.ts Exports new skills and migrate APIs.
packages/cli/src/index.ts Registers new CLI subsystems and init flags.
packages/cli/src/commands/skills/* Adds skills list and skills create.
packages/cli/src/commands/migrate/* Adds migrate plan/status/apply/clean.
packages/templates/src/* Adds skills config and bundled skill assets to templates.
packages/templates/src/skills/** Adds bundled ai-context-kit and ai-context-migrate skills and references.
packages/*/test/**/*.ts Adds coverage for skills, migration, CLI, init upgrade, and rendering behavior.
docs/*.md Documents skills, migration, CLI contract, config, errors, and support policy.
scripts/test-migrate-on-gauntlet.sh Adds end-to-end migration self-test.
scripts/gauntlet/README.md Documents gauntlet runner stages.
scripts/epmx-gauntlet/* Adds EPMX-specific migration validation runner and docs.
examples/gauntlet/** Adds full skills gauntlet fixture, generated outputs, and validation transcripts.
.changeset/*.md Adds release notes for skills and migration changes.
README.md Adds top-level skills and migration sections.
package.json Adds pnpm gauntlet script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +400 to +408
entry.applied_at = new Date().toISOString();
report.applied.push({ name: entry.name, action: entry.action });
} catch (error) {
const reason = error instanceof ContextError ? `[${error.code}] ${error.message}` : String(error);
report.failed.push({ name: entry.name, reason });
throw new ContextError(
"AICTX_MIGRATE_ENTRY_FAILED",
`Failed to apply entry '${entry.name}': ${reason}. Migration halted. Fix and re-run.`
);
Comment on lines +33 to +38
log_stage() {
local stage="$1" outcome="$2" detail="${3:-}"
echo "- **$stage**: $outcome" >> "$REPORT"
[ -n "$detail" ] && echo " - $detail" >> "$REPORT"
echo "[epmx-gauntlet] $stage: $outcome${detail:+ — $detail}"
}
Comment on lines +427 to +434
if (fileExists && !options.force) {
if (options.upgrade) {
if (isMetaSkillFile && options.refreshMetaSkill) {
writeUtf8(abs, file.content.endsWith("\n") ? file.content : `${file.content}\n`);
written.push(file.path);
}
continue; // skip existing files in upgrade mode
}
TimCrooker and others added 26 commits May 28, 2026 19:21
Spec for the kit's migration capability — `ai-context migrate` CLI
(safe + deterministic) plus a bundled `ai-context-migrate` skill that
drives the agent's curation phase. EPMX Monorepo is the validating
consumer (40 entries → 39 .ai/skills/ subdirs).

Builds on v1.0.0 (PR #3). Sequencing: ship v1.0.0 → build/iterate this
on EPMX → ship 1.1.0 → land EPMX migration as separate PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
30 tasks across 10 phases. Phase A-G build the kit feature (TDD,
~commit-per-task). Phase H self-tests against the gauntlet fixture.
Phase I applies the migration to EPMX-Monorepo on a feature branch
at the EPMX repo root (not via worktree, per user preference).
Phase J ships kit 1.1.0.

Maps every spec section to at least one task. Includes the EPMX
gauntlet runner, the self-test harness, both PRs (kit + EPMX), and
the rollback path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@TimCrooker TimCrooker force-pushed the feat/migrate-cli-and-skill branch from f19e133 to e2a0126 Compare May 28, 2026 23:21
@TimCrooker TimCrooker merged commit 9074b1b into main May 28, 2026
7 checks passed
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.

2 participants