Skip to content

Commit 3c6c7f9

Browse files
noelsaw1claude
andcommitted
fix: harden VS Code extension + wire-project, add UX refactor plan
- VS Code extension: fix MCP detection to check both .mcp.json and .mcp.local.json; add WordPress theme/plugin detection via style.css Theme Name and Plugin Name headers; fix status bar showing warning background for ready state; remove unused import - wire-project: use bash + start.sh instead of direct node (matches existing .mcp.json pattern, auto-builds if dist missing); never overwrite existing CLAUDE.md (append reference line only) - Move completed project docs (P1-INSTALL-SH, P1-SCD-FEEDBACK) to PROJECT/3-DONE - Add P1-UX-REFACTOR.md to PROJECT/1-INBOX Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e03fc09 commit 3c6c7f9

8 files changed

Lines changed: 314 additions & 42 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1313
- Do not edit a version block that has already been committed and pushed
1414
-->
1515

16+
## [1.4.2] - 2026-03-26
17+
18+
### Added
19+
- **`PROJECT/1-INBOX/P1-UX-REFACTOR.md`** — replaced a transient UX feedback transcript with a structured three-phase remediation plan covering assumption cleanup, supported project wiring and readiness checks, and safety hardening. The plan explicitly includes removing maintainer-local paths and environmental assumptions from shipped template files.
20+
1621
## [1.4.1] - 2026-03-26
1722

1823
### Fixed

PROJECT/1-INBOX/P1-UX-REFACTOR.md

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
---
2+
Author: GitHub Copilot
3+
Date: 2026-03-26
4+
Status: INBOX
5+
Goal: Reduce onboarding friction by turning AI-DDTK setup from a doc-driven process into a verified, discoverable, and safer product workflow.
6+
---
7+
8+
# P1 UX Refactor
9+
10+
## Why This Project Exists
11+
12+
Recent user feedback exposed the same core failure in several forms:
13+
14+
- setup feels like a set of instructions to give an AI, not a product with a reliable happy path
15+
- MCP installation and project wiring are not discoverable enough and do not guarantee live availability in the active editor session
16+
- workflow prerequisites are scattered across multiple docs and hidden behind local assumptions
17+
- some safety and verification steps are too easy for an agent to reinterpret or bypass
18+
- some verification instructions are underspecified enough that agents either skip them or execute them dangerously broadly
19+
20+
The refactor goal is to make AI-DDTK feel like this:
21+
22+
1. Install AI-DDTK once.
23+
2. Wire a project with one supported command.
24+
3. Run one doctor/preflight command.
25+
4. Use the workflow with explicit, validated prerequisites and safe defaults.
26+
27+
## Scope
28+
29+
In scope:
30+
31+
- onboarding and installation UX
32+
- project MCP wiring UX
33+
- readiness verification UX
34+
- documentation hierarchy and prerequisite clarity
35+
- guardrails around environment checks and search scope
36+
- removal of maintainer-local paths, names, and environment assumptions from templates
37+
38+
Out of scope for this project:
39+
40+
- building brand-new AI-DDTK feature areas unrelated to onboarding and verification
41+
- broad CLI redesign outside commands needed to improve setup and discovery
42+
- editor-specific extension work beyond what is needed to improve setup UX
43+
44+
## Desired Outcomes
45+
46+
- a new user can get from install to first successful workflow without reading multiple overlapping docs
47+
- project wiring is a first-class supported command, not an experimental side path
48+
- setup verification reports real readiness states, including fallback states when MCP is unavailable
49+
- canonical docs do not assume the maintainer's own LocalWP site names, file paths, users, or environment values
50+
- safety checks block risky behavior rather than being writable configuration suggestions
51+
- search and validation steps are scoped, bounded, and safe by default
52+
53+
## Success Metrics
54+
55+
- onboarding path reduced to install -> wire project -> doctor/preflight -> run workflow
56+
- no canonical template file contains maintainer-specific local paths, hostnames, site names, usernames, or environment-variable assumptions
57+
- docs present workflow prerequisites in one place before detailed instructions
58+
- project readiness output distinguishes between built, wired, detected, and live-available MCP states
59+
- no canonical instruction tells the agent to search an unbounded wp-content tree without exclusions or explicit scope
60+
61+
## Phase 1: Remove Hidden Assumptions
62+
63+
### Objective
64+
65+
Eliminate repo-shipped assumptions that make the toolkit appear tailored to one maintainer machine or one specific WordPress setup.
66+
67+
### Deliverables
68+
69+
- canonical prerequisite matrix for install and major workflows
70+
- audited templates with no maintainer-local paths or environmental assumptions
71+
- project wiring flow documented as a supported path rather than an implied agent task
72+
73+
### Tasks
74+
75+
- [ ] Audit all template and setup-facing files for maintainer-local absolute paths, site names, usernames, and environment-specific values.
76+
- [ ] Remove any local path and environment-variable assumptions from the repo's template files.
77+
- [ ] Replace examples that imply a default site name, admin account, or local folder naming convention with neutral placeholders and discovery steps.
78+
- [ ] Consolidate install prerequisites and workflow prerequisites into a single top-level matrix in README.
79+
- [ ] Rewrite project setup guidance so the default path is an explicit supported command, not "copy this file and tell the agent what to do."
80+
- [ ] Add a short decision table that tells users when MCP is required, optional, or unavailable with CLI fallback.
81+
82+
### Candidate Files
83+
84+
- README.md
85+
- README-AI-DDTK.md
86+
- AGENTS.md
87+
- templates/
88+
- docs/WORDPRESS-TESTING-QUICKSTART.md
89+
- docs/PW-AUTH-COMMANDS.md
90+
- docs/CLI-REFERENCE.md
91+
92+
### Exit Criteria
93+
94+
- no shipped template contains maintainer-local absolute paths or env-specific assumptions
95+
- docs no longer rely on implicit `admin` or maintainer site naming as the default setup story
96+
- a new user can identify all prerequisites before starting setup
97+
98+
## Phase 2: Productize Wiring And Readiness
99+
100+
### Objective
101+
102+
Replace multi-doc setup reconstruction with explicit commands and machine-readable readiness checks.
103+
104+
### Deliverables
105+
106+
- supported `install.sh wire-project` command
107+
- supported `doctor-project` or equivalent readiness command
108+
- improved preflight output that reports useful runtime states instead of partial signals
109+
110+
### Tasks
111+
112+
- [ ] Promote `experimental/wire-project` into a supported `install.sh` subcommand.
113+
- [ ] Ensure the supported wiring path handles `.mcp.local.json`, `.gitignore`, and agent-reference setup consistently.
114+
- [ ] Add a `doctor-project` style command that verifies toolkit install, project wiring, editor config presence, MCP build state, and relevant workflow prerequisites.
115+
- [ ] Update `preflight.sh` to distinguish between `built`, `configured`, `discoverable`, and `live session availability` where possible.
116+
- [ ] Make verification mandatory in the onboarding path rather than optional.
117+
- [ ] Clearly report fallback modes such as `MCP unavailable, CLI available` instead of treating setup as binary.
118+
119+
### Candidate Files
120+
121+
- install.sh
122+
- preflight.sh
123+
- experimental/wire-project
124+
- README.md
125+
- AGENTS.md
126+
- docs/TROUBLESHOOTING.md
127+
128+
### Exit Criteria
129+
130+
- project wiring is one documented command
131+
- readiness output is understandable without cross-referencing multiple docs
132+
- a user can tell whether they are blocked, partially configured, or ready to proceed
133+
134+
## Phase 3: Harden Safety And Execution Defaults
135+
136+
### Objective
137+
138+
Make the system safer by removing ambiguous instructions and replacing editable safeguards with real boundaries.
139+
140+
### Deliverables
141+
142+
- safer non-production guard model
143+
- scoped search and verification guidance
144+
- workflow docs that start with discovery rather than assumptions
145+
146+
### Tasks
147+
148+
- [ ] Redesign the `WP_ENVIRONMENT_TYPE` safeguard so it is not satisfied merely by editing config in-place during setup.
149+
- [ ] Require explicit user approval or an explicit override flag before changing environment-classification settings.
150+
- [ ] Start auth and browser workflows with discovery steps for site URL, site name, and available user accounts.
151+
- [ ] Replace broad grep/search instructions with scoped `rg`-based commands, explicit exclusions, and target-path guidance.
152+
- [ ] Add file-count or directory-scope stop conditions for expensive validation steps.
153+
- [ ] Audit docs and recipes for instructions that can be interpreted in unsafe or overly literal ways by agents.
154+
155+
### Candidate Files
156+
157+
- AGENTS.md
158+
- docs/WORDPRESS-TESTING-QUICKSTART.md
159+
- docs/PW-AUTH-COMMANDS.md
160+
- docs/CLI-REFERENCE.md
161+
- recipes/fix-iterate-loop.md
162+
- recipes/weekly-ux-audit.md
163+
164+
### Exit Criteria
165+
166+
- safety guards cannot be trivially bypassed by agent self-editing
167+
- verification/search steps are bounded and executable as written
168+
- auth and site workflows begin with discovery rather than hardcoded assumptions
169+
170+
## Implementation Order
171+
172+
1. Phase 1 first, because hidden assumptions are contaminating docs, templates, and workflow expectations.
173+
2. Phase 2 second, because a supported wiring and doctor flow removes most of the current setup confusion.
174+
3. Phase 3 third, because safety and execution hardening depends on the clearer setup model from Phases 1 and 2.
175+
176+
## Risks
177+
178+
- documentation changes alone may improve clarity without fully reducing runtime confusion if no doctor command is added
179+
- editor-specific MCP behaviors may remain inconsistent across clients even after clearer wiring docs
180+
- replacing weak safeguards with stronger ones may expose real workflow dependencies that were previously papered over by docs
181+
182+
## Open Questions
183+
184+
- should `wire-project` remain local-only via `.mcp.local.json`, or should AI-DDTK support generating checked-in project config variants as well?
185+
- how much live MCP availability can be detected from shell-side doctor commands versus editor-side runtime hooks?
186+
- should user/account discovery become a dedicated helper command rather than staying as documented workflow steps?
187+
188+
## Related Documents
189+
190+
- README.md
191+
- AGENTS.md
192+
- README-AI-DDTK.md
193+
- experimental/preflight.md
194+
- fix-iterate-loop.md
195+
196+
5. Remove hidden assumptions by forcing discovery.
197+
Every workflow that needs a site or user should start by discovering them, not assuming them.
198+
Examples:
199+
- list Local sites before using one
200+
- fetch available admin users before choosing `admin`
201+
- confirm site URL rather than assuming `my-site.local`
202+
- never bake personal site names into canonical instructions
203+
The docs already partly say this in AGENTS.md, but the workflows should operationalize it.
204+
205+
6. Fix the safety model around `WP_ENVIRONMENT_TYPE`.
206+
If the intent is “do not run on production,” then:
207+
- do not tell the agent to change the value as part of normal setup
208+
- do not treat “set this constant” as a safety check
209+
- require an explicit user action or explicit flag before any tool edits environment classification
210+
Better options:
211+
- require a CLI flag like `--allow-nonprod-config-change`
212+
- require a human confirmation step
213+
- use multiple signals, not one mutable constant: host pattern, LocalWP context, wp option URL, and environment type together
214+
The key point: a guard the agent can satisfy by editing config is not a guard.
215+
216+
7. Replace broad grep instructions with scoped review commands.
217+
The safe default should be one of these:
218+
- changed files only via `git diff --name-only`
219+
- target plugin/theme directory only
220+
- `rg` with explicit excludes for .git, `node_modules`, `vendor`, hidden directories, and generated files
221+
- a maximum file count threshold with “stop and ask” behavior
222+
In other words, make the instruction executable without interpretation.
223+
224+
**Product Direction**
225+
The toolkit should feel like this:
226+
227+
1. Install AI-DDTK once.
228+
2. Wire a project with one command.
229+
3. Run one doctor command.
230+
4. Use one workflow command or one clear prompt.
231+
232+
Right now it feels more like:
233+
234+
1. Install tools.
235+
2. Learn MCP.
236+
3. Learn editor wiring.
237+
4. Learn project wiring.
238+
5. Learn which doc applies.
239+
6. Tell the agent which steps to do.
240+
7. Hope the agent interprets the intent correctly.
241+
242+
That is the core UX problem.
243+
244+
**Concrete Rewrite Priorities**
245+
1. Make wire-project a supported install subcommand and surface it in README.md and install.sh.
246+
2. Add a single prerequisites matrix to the README and link deeper docs from there.
247+
3. Make setup verification mandatory, not optional.
248+
4. Add a “live MCP unavailable, falling back to CLI” state explicitly in preflight/doctor output.
249+
5. Rewrite all safety checks so they cannot be bypassed by agent self-editing.
250+
6. Audit every grep/search instruction and scope it to target paths plus excludes.
251+
252+
**Bottom Line**
253+
The user is not asking for better prose. They are asking for the toolkit to own state discovery, wiring, and safety boundaries instead of pushing that burden onto the human and the agent. That is the right diagnosis.
254+
255+
1. I can turn this into a prioritized UX issue list in a new project doc or inbox item.
256+
2. I can draft the actual onboarding rewrite for README.md, AGENTS.md, and README-AI-DDTK.md.
257+
3. I can implement the first structural fix by promoting wire-project into install.sh and tightening the preflight/doctor flow.
File renamed without changes.
File renamed without changes.

experimental/vscode-extension/src/commands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as vscode from 'vscode';
2-
import * as cp from 'child_process';
32
import * as path from 'path';
43
import { AiDdtkManager } from './manager';
54

experimental/vscode-extension/src/manager.ts

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ export class AiDdtkManager {
7474
}
7575

7676
const workspaceRoot = vscode.workspace.workspaceFolders[0].uri.fsPath;
77-
const mcpLocalPath = path.join(workspaceRoot, '.mcp.local.json');
78-
return fs.existsSync(mcpLocalPath);
77+
return (
78+
fs.existsSync(path.join(workspaceRoot, '.mcp.local.json')) ||
79+
fs.existsSync(path.join(workspaceRoot, '.mcp.json'))
80+
);
7981
}
8082

8183
async isWordPressProject(): Promise<boolean> {
@@ -84,20 +86,49 @@ export class AiDdtkManager {
8486
}
8587

8688
const workspaceRoot = vscode.workspace.workspaceFolders[0].uri.fsPath;
87-
const indicators = [
89+
90+
// Check for full WordPress installs
91+
const wpIndicators = [
8892
'wp-config.php',
8993
'wp-content/plugins',
9094
'wp-content/themes',
9195
'wp-includes',
9296
];
9397

94-
for (const indicator of indicators) {
95-
const fullPath = path.join(workspaceRoot, indicator);
96-
if (fs.existsSync(fullPath)) {
98+
for (const indicator of wpIndicators) {
99+
if (fs.existsSync(path.join(workspaceRoot, indicator))) {
97100
return true;
98101
}
99102
}
100103

104+
// Check for WordPress theme (style.css with Theme Name header)
105+
const styleCss = path.join(workspaceRoot, 'style.css');
106+
if (fs.existsSync(styleCss)) {
107+
try {
108+
const head = fs.readFileSync(styleCss, 'utf8').slice(0, 2048);
109+
if (/Theme Name:/i.test(head)) {
110+
return true;
111+
}
112+
} catch {
113+
// ignore read errors
114+
}
115+
}
116+
117+
// Check for WordPress plugin (any root .php with Plugin Name header)
118+
try {
119+
const rootFiles = fs.readdirSync(workspaceRoot);
120+
for (const file of rootFiles) {
121+
if (file.endsWith('.php')) {
122+
const head = fs.readFileSync(path.join(workspaceRoot, file), 'utf8').slice(0, 2048);
123+
if (/Plugin Name:/i.test(head)) {
124+
return true;
125+
}
126+
}
127+
}
128+
} catch {
129+
// ignore read errors
130+
}
131+
101132
return false;
102133
}
103134

experimental/vscode-extension/src/statusBar.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ export class StatusBarManager implements vscode.Disposable {
3030
if (status.wordPressProject) {
3131
if (status.mcpConfigured) {
3232
this.statusBarItem.text = '$(check) AI-DDTK Ready';
33-
this.statusBarItem.backgroundColor = new vscode.ThemeColor(
34-
'statusBarItem.warningBackground'
35-
);
33+
this.statusBarItem.backgroundColor = undefined;
3634
this.statusBarItem.tooltip = 'AI-DDTK is configured for this project';
3735
} else {
3836
this.statusBarItem.text = '$(warning) AI-DDTK Setup';

0 commit comments

Comments
 (0)