wordpress-agent-kit 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,190 +2,289 @@
2
2
 
3
3
  [![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg?style=flat-square)](LICENSE)
4
4
  [![TypeScript](https://img.shields.io/badge/Written%20in-TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
5
- [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
- [![Version](https://img.shields.io/badge/version-0.2.2-blue?style=flat-square)](package.json)
5
+ [![Version](https://img.shields.io/badge/version-0.3.0-blue?style=flat-square)](package.json)
7
6
  [![Node](https://img.shields.io/badge/node-%3E%3D20.18-green?style=flat-square)](package.json)
7
+ [![CI](https://img.shields.io/badge/CI-passing-brightgreen?style=flat-square)](.github/workflows/ci.yml)
8
8
 
9
- **WordPress-focused AI agent starter kit** for GitHub Copilot, Cursor, Claude, and other LLM coding agents. Includes instructions, specialized WordPress skills, and workflow automation aligned with industry standards.
9
+ **WordPress-focused AI agent starter kit** for GitHub Copilot, Cursor, Claude, and Pi Coding Agent. Installs 13 specialized WordPress agent skills, an agent persona, workflow instructions, and AGENTS.md configuration — everything an AI coding agent needs to build WordPress plugins, themes, and blocks correctly.
10
10
 
11
11
  Maintained by [Kyle Brodeur](https://brodeur.me).
12
12
 
13
- ## Quick Start
13
+ ---
14
14
 
15
- ### Option 1: CLI (Recommended)
15
+ ## Getting Started
16
16
 
17
- #### Interactive Setup Wizard
18
- ```bash
19
- npx wp-agent-kit setup
20
- # or
21
- pnpm dlx wp-agent-kit setup
22
- ```
17
+ Choose your scenario:
18
+
19
+ ### Scenario 1: Brand New WordPress Project
23
20
 
24
- #### Non-Interactive (CI/Agent-Friendly)
25
21
  ```bash
26
- # Auto-detect project type and tech stack
27
- pnpm dlx wp-agent-kit setup --auto --json
22
+ # 1. Install the kit (copies skills, agents, instructions, AGENTS.md template)
23
+ npx wp-agent-kit install /path/to/my-plugin --platform github
24
+
25
+ # 2. Run auto-setup (detects project type and configures AGENTS.md)
26
+ npx wp-agent-kit setup /path/to/my-plugin --auto
28
27
 
29
- # Or specify explicitly (for full automation)
30
- pnpm dlx wp-agent-kit setup --project-type plugin --tech-stack gutenberg,rest-api,composer --platform github --yes --json
28
+ # 3. (Optional) Verify the triage report
29
+ node .github/skills/wp-project-triage/scripts/detect_wp_project.mjs
30
+ ```
31
+
32
+ **What gets installed:**
33
+ ```
34
+ my-plugin/
35
+ ├── AGENTS.md # Project-specific agent instructions
36
+ ├── AGENTS.template.md # Template reference for future updates
37
+ ├── .github/
38
+ │ ├── agents/
39
+ │ │ └── wp-architect.agent.md # WordPress Architect agent persona
40
+ │ ├── instructions/
41
+ │ │ └── wordpress-workflow.instructions.md
42
+ │ ├── prompts/
43
+ │ └── skills/ # 13 WordPress skills
44
+ │ ├── wp-project-triage/ # Project detection
45
+ │ ├── wp-plugin-development/ # Plugin architecture
46
+ │ ├── wp-block-development/ # Gutenberg blocks
47
+ │ ├── wp-block-themes/ # Block themes
48
+ │ ├── wp-rest-api/ # REST API
49
+ │ ├── wp-interactivity-api/ # Interactivity API
50
+ │ ├── wp-abilities-api/ # Abilities API
51
+ │ ├── wp-performance/ # Performance profiling
52
+ │ ├── wp-phpstan/ # Static analysis
53
+ │ ├── wp-wpcli-and-ops/ # WP-CLI operations
54
+ │ ├── wp-playground/ # Testing environments
55
+ │ ├── wpds/ # Design system
56
+ │ └── wordpress-router/ # Repo classification
57
+ └── .wp-agent-kit-manifest.github.json # Safe-update tracking
31
58
  ```
32
59
 
33
- #### Install Only (No Configuration)
60
+ ### Scenario 2: Existing WordPress Project
61
+
34
62
  ```bash
35
- # For GitHub Copilot / VS Code
36
- pnpm dlx wp-agent-kit@latest install --platform github
63
+ # 1. Install kit (preserves your existing AGENTS.md)
64
+ npx wp-agent-kit install /path/to/existing-plugin --platform github
37
65
 
38
- # For Cursor IDE
39
- pnpm dlx wp-agent-kit@latest install --platform cursor
66
+ # 2. Run triage to detect your project's type, tech stack, and tooling
67
+ node .github/skills/wp-project-triage/scripts/detect_wp_project.mjs
40
68
 
41
- # For Pi Coding Agent (recommended)
42
- pnpm dlx wp-agent-kit@latest install --platform pi
69
+ # 3. Configure based on detection (headless)
70
+ npx wp-agent-kit setup /path/to/existing-plugin --auto
43
71
 
44
- # For generic .agent workflows
45
- pnpm dlx wp-agent-kit@latest install --platform agent
72
+ # Or specify explicitly
73
+ npx wp-agent-kit setup /path/to/existing-plugin \
74
+ --project-type plugin \
75
+ --tech-stack gutenberg,rest-api,wpcli,composer,npm \
76
+ --package-manager pnpm \
77
+ --yes
46
78
  ```
47
79
 
48
- ### Option 2: Pre-built Bundles
80
+ **Key behavior:**
81
+ - Your existing `AGENTS.md` is **never overwritten** — only new sections are added
82
+ - Triage inspects your codebase and returns structured JSON with project kind, signals, and tooling
83
+ - Setup updates only the tooling/configuration sections of AGENTS.md
49
84
 
50
- Download from the [latest release](https://github.com/kylebrodeur/wordpress-agent-kit/releases):
51
- - `wordpress-agent-kit-github.tar.gz` — GitHub Copilot
52
- - `wordpress-agent-kit-cursor.tar.gz` — Cursor IDE
53
- - `wordpress-agent-kit-claude.tar.gz` — Claude
54
- - `wordpress-agent-kit-agent.tar.gz` — Generic `.agent`
85
+ ### Scenario 3: Upgrading an Existing Kit Installation
55
86
 
56
87
  ```bash
57
- cd /path/to/your-wordpress-project
58
- tar -xzf wordpress-agent-kit-github.tar.gz
88
+ # Check if an update is available
89
+ npx wp-agent-kit upgrade --check-only
90
+
91
+ # Preview what would change (dry-run)
92
+ npx wp-agent-kit install --dry-run
93
+
94
+ # Apply safe update (preserves your modifications)
95
+ npx wp-agent-kit upgrade --force
59
96
  ```
60
97
 
61
- ## Agent-Friendly Features (v0.2.2+)
98
+ **Safe update behavior:**
99
+ - Compares installed files against a manifest of original hashes
100
+ - Files you haven't modified → automatically updated
101
+ - Files you modified → **skipped** (preserved)
102
+ - Use `--force` to overwrite your modifications with upstream changes
103
+ - A backup is created at `.wp-agent-kit-backup-{timestamp}/` before making changes
62
104
 
63
- ### Structured JSON Output (`--json`)
64
- All commands output machine-readable JSON for programmatic use:
65
105
  ```bash
66
- wp-agent-kit install --platform github --json
67
- # {"success":true,"data":{"targetDir":"/path","platform":"github","filesCreated":[...],"durationMs":35}}
106
+ # Emergency: override all safety and replace everything
107
+ npx wp-agent-kit install --no-safe --force
68
108
  ```
69
109
 
70
- ### Headless/Non-Interactive Mode
71
- ```bash
72
- # Auto-detection
73
- wp-agent-kit setup --auto --json
110
+ ---
74
111
 
75
- # Explicit config (CI/CD ready)
76
- wp-agent-kit setup --project-type plugin --tech-stack gutenberg,rest-api --platform github --yes --json
77
- ```
112
+ ## Quick Reference
113
+
114
+ ### CLI Commands
115
+
116
+ | Command | Purpose |
117
+ |---------|---------|
118
+ | `install [dir]` | Install kit into a project |
119
+ | `setup [dir]` | Interactive or headless configuration |
120
+ | `sync-skills [ref]` | Pull latest skills from WordPress/agent-skills |
121
+ | `upgrade [dir]` | Check or apply version upgrades |
122
+ | `playground` | Launch local WordPress Playground |
123
+
124
+ ### Platform Flags
125
+
126
+ | Platform | Flag | Target Directory |
127
+ |----------|------|-----------------|
128
+ | GitHub Copilot / VS Code | `--platform github` | `.github/` |
129
+ | Cursor IDE | `--platform cursor` | `.cursor/` |
130
+ | Claude Code | `--platform claude` | `.claude/` |
131
+ | Pi Coding Agent | `--platform pi` | `.pi/agent/` |
132
+ | Generic .agent | `--platform agent` | `.agent/` |
133
+
134
+ ### Agent-Friendly Flags (All Commands)
135
+
136
+ | Flag | Description |
137
+ |------|-------------|
138
+ | `--json` | Machine-readable JSON output |
139
+ | `--dry-run` | Preview changes without applying |
140
+ | `--ndjson` | Newline-delimited JSON for streaming |
141
+ | `--quiet` | Suppress non-error output |
142
+
143
+ ---
144
+
145
+ ## Pi Coding Agent Integration
146
+
147
+ This package is also a Pi extension — install it once and all WordPress skills and tools are available to Pi:
78
148
 
79
- ### Dry-Run Preview (`--dry-run`)
80
149
  ```bash
81
- wp-agent-kit install --platform github --dry-run --json
82
- wp-agent-kit setup --project-type plugin --dry-run --json
150
+ pi install npm:wordpress-agent-kit
83
151
  ```
84
152
 
85
- ### Upgrade Existing Installations
86
- ```bash
87
- # Check for updates
88
- wp-agent-kit upgrade --check-only --json
153
+ ### Pi Tools (Callable by the Agent)
89
154
 
90
- # Apply upgrade
91
- wp-agent-kit upgrade --force --json
92
- ```
155
+ | Tool | What it does |
156
+ |------|-------------|
157
+ | `wp_triage` | Detect WordPress project type, signals, and tooling |
158
+ | `wp_install_kit` | Install/update kit into a project (safe by default) |
159
+ | `wp_sync_skills` | Sync skills from WordPress/agent-skills upstream |
160
+ | `wp_upgrade` | Check and apply version upgrades |
93
161
 
94
- ### Programmatic API
95
- ```typescript
96
- import { installKitApi, syncSkillsApi, runTriageApi, configureAgentsMdApi } from 'wordpress-agent-kit/api';
162
+ ### Pi Commands (Type `/` in Pi TUI)
97
163
 
98
- await installKitApi({ targetDir: '/path', platform: 'github', force: true });
99
- await syncSkillsApi({ ref: 'trunk' });
100
- const triage = await runTriageApi({ targetDir: '/path' });
101
- await configureAgentsMdApi({ targetDir: '/path', platform: 'github', config: { projectType: 'plugin', techStack: ['gutenberg'] }});
164
+ | Command | What it does |
165
+ |---------|-------------|
166
+ | `/wp-triage [dir]` | Run project detection, show in status bar |
167
+ | `/wp-install [dir]` | Install kit into current project |
168
+ | `/wp-sync-skills [ref]` | Sync skills from upstream |
169
+ | `/wp-upgrade` | Show installed vs latest version |
170
+
171
+ ---
172
+
173
+ ## Programmatic API
174
+
175
+ Import directly into scripts, tests, or other tools:
176
+
177
+ ```typescript
178
+ import {
179
+ installKitApi, // Install/update kit
180
+ syncSkillsApi, // Sync skills from upstream
181
+ runTriageApi, // Run project detection
182
+ configureAgentsMdApi, // Configure AGENTS.md
183
+ computeChanges, // Preview file changes (dry-run)
184
+ isKitInstalled, // Check if kit is installed
185
+ loadManifest, // Read install manifest
186
+ updateKit, // Raw safe update
187
+ ExitCode, // Semantic exit codes
188
+ } from 'wordpress-agent-kit/api';
189
+
190
+ // Install with safe update
191
+ const result = await installKitApi({
192
+ targetDir: '/path/to/my-plugin',
193
+ platform: 'github',
194
+ safe: true, // Use manifest-based diff
195
+ backup: true, // Create backup before changes
196
+ force: false, // Don't overwrite user mods
197
+ });
198
+
199
+ // Dry-run preview
200
+ const preview = await installKitApi({
201
+ targetDir: '/path/to/my-plugin',
202
+ platform: 'github',
203
+ dryRun: true,
204
+ });
205
+ // preview.data.actions → [{ type: 'create', target: '...', description: '...' }]
206
+
207
+ // Detect project type
208
+ const triage = await runTriageApi({ targetDir: '/path/to/project' });
209
+ console.log(triage.data.project.primary); // "plugin"
102
210
  ```
103
211
 
104
212
  ### Semantic Exit Codes
213
+
105
214
  | Code | Meaning |
106
215
  |------|---------|
107
216
  | 0 | Success |
108
- | 1 | General error |
109
217
  | 2 | Invalid arguments |
110
- | 3 | Not found (ENOENT) |
218
+ | 3 | Not found |
111
219
  | 4 | Permission denied |
112
- | 5 | Already exists (use --force) |
220
+ | 5 | Already exists |
113
221
  | 6 | Git error |
114
222
  | 7 | Network error |
115
223
  | 8 | Validation failed |
116
- | 130 | Cancelled (SIGINT) |
224
+ | 130 | Cancelled |
117
225
 
118
- ## Platform Comparison
226
+ ---
119
227
 
120
- | Platform | Target Dir | Interactive? | Best For |
121
- |----------|------------|--------------|----------|
122
- | `pi` | `.pi/agent/skills/` | ❌ | **Pi Coding Agent** |
123
- | `github` | `.github/skills/` | ❌ | GitHub Copilot, VS Code |
124
- | `cursor` | `.cursor/skills/` | ❌ | Cursor IDE |
125
- | `agent` | `.agent/skills/` | ❌ | Generic `.agent` workflows |
126
- | `claude` | `.claude/skills/` | ✅ | Claude Code (interactive) |
228
+ ## Skills Reference
127
229
 
128
- ## Commands Reference
230
+ All 13 skills follow the [AgentSkills.io](https://agentskills.io) specification:
129
231
 
130
- | Command | Description |
131
- |---------|-------------|
132
- | `install [dir] --platform <p> [--force] [--dry-run] [--json]` | Install kit to target directory |
133
- | `setup [dir] [--auto] [--project-type] [--tech-stack] [--yes] [--json]` | Interactive or headless setup |
134
- | `sync-skills [ref] [--dry-run] [--json]` | Sync skills from WordPress/agent-skills |
135
- | `playground [--port] [--no-auto-mount] [--json]` | Run local WordPress Playground |
136
- | `upgrade [dir] [--platform] [--force] [--check-only] [--json]` | Upgrade existing installation |
232
+ | Skill | When to Use |
233
+ |-------|------------|
234
+ | `wordpress-router` | Classify a WordPress repo and route to the right workflow |
235
+ | `wp-project-triage` | Run deterministic project detection (type, tooling, versions) |
236
+ | `wp-plugin-development` | Develop WordPress plugins (hooks, settings, security, release) |
237
+ | `wp-block-development` | Develop Gutenberg blocks (block.json, attributes, rendering) |
238
+ | `wp-block-themes` | Develop block themes (theme.json, templates, patterns, variations) |
239
+ | `wp-rest-api` | Build, extend, or debug REST API endpoints/routes |
240
+ | `wp-interactivity-api` | Build Interactive blocks with data-wp-* directives |
241
+ | `wp-abilities-api` | Register and consume WordPress Abilities API |
242
+ | `wp-performance` | Profile and optimize WordPress performance |
243
+ | `wp-phpstan` | Configure and run PHPStan static analysis |
244
+ | `wp-wpcli-and-ops` | WP-CLI commands, automation, multisite operations |
245
+ | `wp-playground` | Test in disposable WordPress Playground instances |
246
+ | `wpds` | Build UIs with the WordPress Design System |
247
+
248
+ ---
137
249
 
138
250
  ## Development
139
251
 
140
- ### Build CLI
141
252
  ```bash
142
- pnpm build
143
- ```
253
+ # Install dependencies
254
+ pnpm install
144
255
 
145
- ### Run Tests
146
- ```bash
147
- pnpm test:run
148
- ```
256
+ # Run in dev mode
257
+ pnpm dev
149
258
 
150
- ### Lint & Format
151
- ```bash
152
- pnpm run lint:check # Check only
153
- pnpm run lint # Auto-fix
154
- pnpm run format:check # Check formatting
155
- pnpm run format # Auto-format
156
- ```
259
+ # Type-check
260
+ pnpm check
157
261
 
158
- ### Build Release Bundles
159
- ```bash
160
- pnpm sync:skills
161
- pnpm build:bundles
162
- ```
262
+ # Lint & format
263
+ pnpm lint:check
264
+ pnpm format
163
265
 
164
- ### Pre-Publish (Runs All Checks)
165
- ```bash
166
- pnpm run prepublishOnly
167
- ```
266
+ # Run tests
267
+ pnpm test:run
268
+
269
+ # Build for distribution
270
+ pnpm build
168
271
 
169
- ## Customization
272
+ # Full pre-publish check (build + lint + test)
273
+ pnpm prepublishOnly
274
+ ```
170
275
 
171
- **Quick method:** Run the interactive or headless setup.
276
+ ---
172
277
 
173
- **Manual method:** Edit files directly:
174
- 1. Edit `AGENTS.md` to match your project's tech stack and conventions.
175
- 2. Run WordPress project triage (via `wp-project-triage` skill) to generate tailored instructions.
176
- 3. Update `.github/instructions/wordpress-workflow.instructions.md` with your workflow.
177
- 4. Keep prompts in `.github/prompts/` accurate for your plugin/theme.
278
+ ## Documentation
178
279
 
179
- ## CI/CD Integration
280
+ - **[CLI_REVIEW.md](CLI_REVIEW.md)** — Initial architecture review and design decisions
281
+ - **[CHANGELOG.md](CHANGELOG.md)** — Version history and release notes
282
+ - **[AGENTS.md](AGENTS.md)** — Agent instructions for this repository
180
283
 
181
- ```yaml
182
- # GitHub Actions example
183
- - name: Install WordPress Agent Kit
184
- run: pnpm dlx wordpress-agent-kit@latest install --platform github --json
185
- ```
284
+ ---
186
285
 
187
286
  ## Credits
188
287
 
189
- - **[AGENTS.md](https://agentskills.io)** - The agent configuration standard.
190
- - **[AgentSkills.io](https://agentskills.io)** - The open directory of agent skills.
191
- - **[WordPress/agent-skills](https://github.com/WordPress/agent-skills)** - Upstream skills repository.
288
+ - **[AgentSkills.io](https://agentskills.io)** The agent skills specification
289
+ - **[AGENTS.md](https://agentskills.io)** The agent configuration standard
290
+ - **[WordPress/agent-skills](https://github.com/WordPress/agent-skills)** Upstream skills repository
package/biome.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "useIgnoreFile": true
7
7
  },
8
8
  "files": {
9
- "include": ["src/**/*.ts", "tests/**/*.ts", "scripts/**/*.ts"],
9
+ "include": ["src/**/*.ts", "tests/**/*.ts", "scripts/**/*.ts", "extensions/**/*.ts"],
10
10
  "ignoreUnknown": true
11
11
  },
12
12
  "organizeImports": {
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { Command } from 'commander';
3
- import { installKitApi, } from '../lib/api.js';
3
+ import { installKitApi, isKitInstalled, loadManifest, } from '../lib/api.js';
4
4
  import { OutputFormatter, createFormatter } from '../utils/output.js';
5
5
  function isDryRunResult(result) {
6
6
  return result.success && 'wouldExecute' in (result.data || {});
@@ -12,12 +12,15 @@ function isRegularResult(result) {
12
12
  * Command to install the WordPress Agent Kit into a target directory.
13
13
  * Takes an optional directory argument, defaulting to the current working directory.
14
14
  * Supports --json, --quiet, --ndjson, --dry-run global flags.
15
+ * Safe update mode preserves user modifications on re-install.
15
16
  */
16
17
  export const installCommand = new Command('install')
17
18
  .description('Install the WordPress Agent Kit into a target directory')
18
19
  .argument('[dir]', 'Target directory to install into', process.cwd())
19
20
  .option('--platform <platform>', 'Target platform (github, cursor, claude, agent, pi)', 'github')
20
- .option('--force', 'Overwrite existing installation', false)
21
+ .option('--force', 'Overwrite user modifications on update', false)
22
+ .option('--no-safe', 'Disable safe update (use full nuke-and-replace)')
23
+ .option('--no-backup', 'Skip creating a backup before overwriting files')
21
24
  .action(async (dir, options, command) => {
22
25
  const globalOpts = command.parent?.opts() || {};
23
26
  const platform = options.platform;
@@ -32,11 +35,15 @@ export const installCommand = new Command('install')
32
35
  process.exit(OutputFormatter.getExitCode(result));
33
36
  }
34
37
  const targetDir = path.resolve(dir);
38
+ const isUpdate = isKitInstalled(targetDir, platform);
39
+ const existingManifest = loadManifest(targetDir, platform);
35
40
  const installOptions = {
36
41
  targetDir,
37
42
  platform: platform,
38
43
  force: options.force,
39
44
  dryRun: globalOpts.dryRun,
45
+ safe: options.safe !== false, // Default: true (safe)
46
+ backup: options.backup !== false, // Default: true
40
47
  };
41
48
  const result = await installKitApi(installOptions);
42
49
  if (globalOpts.json || globalOpts.ndjson || globalOpts.quiet) {
@@ -45,13 +52,47 @@ export const installCommand = new Command('install')
45
52
  // Human-readable output
46
53
  if (isRegularResult(result)) {
47
54
  const data = result.data;
48
- console.log(`✓ Installed WordPress Agent Kit (${platform}) to ${targetDir}`);
49
- console.log(` Files: ${data.filesCreated.length} created, ${data.filesSkipped.length} skipped`);
55
+ if (isUpdate) {
56
+ console.log(`✓ Updated WordPress Agent Kit (${platform}) in ${targetDir}`);
57
+ if (existingManifest) {
58
+ console.log(` Previous version: ${existingManifest.version}`);
59
+ }
60
+ console.log(` Files: ${data.filesCreated.length} created/updated`);
61
+ if (data.filesSkipped.length > 0) {
62
+ console.log(` Skipped: ${data.filesSkipped.length} files (user-modified, preserved)`);
63
+ }
64
+ if (data.conflicts && data.conflicts.length > 0) {
65
+ console.log(`\n⚠ ${data.conflicts.length} conflict(s) detected:`);
66
+ for (const conflict of data.conflicts) {
67
+ console.log(` - ${conflict}`);
68
+ }
69
+ console.log(' Re-run with --force to overwrite.');
70
+ }
71
+ if (data.backupDir) {
72
+ console.log(` Backup: ${data.backupDir}`);
73
+ }
74
+ }
75
+ else {
76
+ console.log(`✓ Installed WordPress Agent Kit (${platform}) to ${targetDir}`);
77
+ console.log(` Files: ${data.filesCreated.length} created, ${data.filesSkipped.length} skipped`);
78
+ }
50
79
  console.log(` Duration: ${data.durationMs}ms`);
51
80
  }
52
81
  else if (isDryRunResult(result)) {
53
- // Dry-run result - just show summary
54
- console.log(`✓ Dry-run: ${result.data.summary.filesCreated.length} files would be created`);
82
+ const summary = result.data.summary;
83
+ if (isUpdate) {
84
+ console.log(`✓ Dry-run update (${platform}) for ${targetDir}:`);
85
+ }
86
+ else {
87
+ console.log(`✓ Dry-run install (${platform}) to ${targetDir}:`);
88
+ }
89
+ console.log(` Would create: ${summary.filesCreated.length} files`);
90
+ if (summary.filesSkipped && summary.filesSkipped.length > 0) {
91
+ console.log(` Would skip: ${summary.filesSkipped.length} files (user-modified)`);
92
+ }
93
+ if (summary.conflicts && summary.conflicts.length > 0) {
94
+ console.log(` Conflicts: ${summary.conflicts.length} files (use --force to overwrite)`);
95
+ }
55
96
  }
56
97
  else {
57
98
  console.error(`✗ Installation failed: ${result.error?.message}`);
@@ -151,24 +151,53 @@ export const upgradeCommand = new Command('upgrade')
151
151
  platform,
152
152
  force: options.force,
153
153
  dryRun: globalOpts.dryRun,
154
+ safe: true,
155
+ backup: !options.force, // Skip backup if forcing
154
156
  });
155
157
  results.push({ platform, ...installResult });
156
158
  }
157
159
  const successCount = results.filter((r) => r.success).length;
158
- const totalFiles = results.reduce((sum, r) => {
160
+ const totalCreated = results.reduce((sum, r) => {
159
161
  if (!r.success)
160
162
  return sum;
161
163
  if (isRegularResult(r)) {
162
- return sum + (r.data.filesCreated.length || 0);
164
+ return sum + (r.data.filesCreated?.length || 0);
163
165
  }
164
166
  if (isDryRunResult(r)) {
165
- // Dry-run - summary has filesCreated
166
- return sum + (r.data.summary.filesCreated.length || 0);
167
+ return sum + (r.data.summary.filesCreated?.length || 0);
167
168
  }
168
169
  return sum;
169
170
  }, 0);
171
+ const totalSkipped = results.reduce((sum, r) => {
172
+ if (!r.success)
173
+ return sum;
174
+ if (isRegularResult(r)) {
175
+ return sum + (r.data.filesSkipped?.length || 0);
176
+ }
177
+ if (isDryRunResult(r)) {
178
+ return sum + (r.data.summary.filesSkipped?.length || 0);
179
+ }
180
+ return sum;
181
+ }, 0);
182
+ const allConflicts = results.reduce((acc, r) => {
183
+ if (!r.success)
184
+ return acc;
185
+ if (isRegularResult(r) && r.data.conflicts) {
186
+ acc.push(...r.data.conflicts);
187
+ }
188
+ if (isDryRunResult(r) && r.data.summary.conflicts) {
189
+ acc.push(...r.data.summary.conflicts);
190
+ }
191
+ return acc;
192
+ }, []);
170
193
  console.log(`\n✓ Upgraded ${successCount}/${results.length} platform(s)`);
171
- console.log(` Files updated: ${totalFiles}`);
194
+ console.log(` Files updated: ${totalCreated}`);
195
+ if (totalSkipped > 0) {
196
+ console.log(` Files preserved: ${totalSkipped} (user-modified)`);
197
+ }
198
+ if (allConflicts.length > 0) {
199
+ console.log(` ⚠ Conflicts: ${allConflicts.length} files (re-run with --force to overwrite)`);
200
+ }
172
201
  console.log(` Version: ${currentVersion} → ${CURRENT_VERSION}`);
173
202
  const failed = results.filter((r) => !r.success);
174
203
  if (failed.length > 0) {