feat(unic-spec-review): self-contained auth and preflight (/setup-confluence, /spec-doctor)#211
Conversation
…fluence, /spec-doctor) The plugin had no way to set up credentials or verify prerequisites: both command stubs were unimplemented and the script layer was absent. A user who installed only unic-spec-review could not configure Confluence or preflight a review without first installing another plugin. Changes: - Add parseArgs to scripts/lib/args.mjs (CLI parser for the setup wizard) - Vendor scripts/setup-confluence.mjs by copying from unic-pr-review (no cross-import) - Add scripts/spec-doctor.mjs: Confluence credential + connectivity preflight (injectable deps) - Replace commands/setup-confluence.md stub with the full interactive wizard - Replace commands/spec-doctor.md stub with the orchestrator (script + Figma/Playwright MCP checks; absent MCPs are loud explicit failures with remediation) - Add unit tests for the wizard and the Confluence preflight logic; no live services - Add CHANGELOG bullets under [Unreleased] Refs #203 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔍 Comprehensive PR ReviewPR: #211 — feat(unic-spec-review): self-contained auth and preflight (/setup-confluence, /spec-doctor) SummaryClean, self-contained implementation. Both new scripts use the injectable-deps pattern correctly, import only from local Verdict: ✅
🟡 Medium Issues (Needs Decision)M1:
|
| # | Issue | Location | Fix |
|---|---|---|---|
| L1 | Dead skipped branch in formatLine — CheckResult.skipped never set |
spec-doctor.mjs:47,141 |
Remove branch (YAGNI) OR add — reserved for future optional checks comment to typedef |
| L2 | process.env.HOME in inline snippet not cross-platform (Windows native) |
commands/setup-confluence.md:26 |
Change to require('os').homedir() — mirrors what the Node.js script already does |
| L3 | setup-confluence.mjs top-level .catch omits stack trace (inconsistent with spec-doctor.mjs) |
scripts/setup-confluence.mjs:114 |
Change err?.message to err?.stack ?? err?.message ?? String(err) |
| L4 | runSpecDoctorCredentials HTTP-error path (e.g. 401) not tested end-to-end |
scripts/spec-doctor.mjs:185 |
Add one it() with pingHttp(401) — checkConfluence already covers it in isolation |
| L5 | args.mjs module-level description only describes parseReviewSpecArgs, not parseArgs |
scripts/lib/args.mjs:6 |
Broaden to: args.mjs — CLI argument parsers for unic-spec-review with two bullet entries |
✅ What's Good
- Self-containment is airtight — all imports resolve to
./lib/*within the same plugin; vendor copy ofparseArgsis character-for-character identical to the origin - Atomic credential write —
write(tmp) → chmod(tmp) → rename(tmp, target)prevents partial-write corruption on crash - Windows branch explicit — skips chmod and emits
icaclsremediation hint; never silent, never pretends chmod works - Discriminated-union
PingResult— eliminates exception path for network ops entirely - Targeted
SyntaxErrorcatch inwriteConfluenceCreds— only the known exception type caught; EACCES/ENOSPC propagate - Boundary condition tests — HTTP 199/200/299/300 all explicitly tested; 2xx predicate fully pinned
- MCP failure loudness —
spec-doctor.mdspecifies exact✗ ... not connectedoutput with remediation; "Missing MCPs are hard failures" documented - 93 pass / 0 fail across 18 suites on all CI platforms
- All docs were anticipatorily accurate — AGENTS.md, README.md, CONTEXT.md already reflected the final design; no sync lag
Next Steps
- 📝 Decide on M1 (
parseArgstests): fix in this PR or create follow-up issue - 🎯 Apply L1–L5 at discretion — none block merge
- ✅ Merge when ready
Reviewed by Archon comprehensive-pr-review workflow · 5 agents
Artifacts: /Users/oriol.torrent/.archon/workspaces/unic/unic-agents-plugins/artifacts/runs/f8fe1b4a1a348ed0d6cda23050c03da2/review/
- Add parseArgs test suite (7 cases) to args.test.mjs — covers all four
behavioural branches including boolean flags and throw-on-missing-value
- Add runSpecDoctorCredentials HTTP-error test (401 via pingHttp)
- Remove dead CheckResult.skipped typedef property and formatLine skipped
branch (YAGNI — nothing sets skipped: true in current code)
- Fix setup-confluence.mjs top-level catch to include err?.stack for
better debugging parity with spec-doctor.mjs
- Fix process.env.HOME → require('os').homedir() in setup-confluence.md
inline snippet for Windows-native portability
- Broaden args.mjs module description to cover both exported parsers
Tests: 101 pass / 0 fail (was 93)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
⚡ Self-Fix Report (Aggressive)Status: COMPLETE Fixes Applied (6 total)
View all fixes
Tests Added
Total: 101 pass / 0 fail (was 93) Skipped(none — all findings addressed) Validation✅ Type check | ✅ Lint | ✅ Tests (101 passed) Self-fix by Archon · aggressive mode · fixes pushed to |
There was a problem hiding this comment.
Pull request overview
Implements the previously stubbed /setup-confluence and /spec-doctor paths in unic-spec-review to make the plugin self-contained for Confluence credential setup and prerequisite preflight (per issue #203).
Changes:
- Added a shared
parseArgsCLI flag parser for setup scripts and covered it with tests. - Added
scripts/setup-confluence.mjs(writes~/.unic-confluence.jsonatomically, preserves existing fields) plus unit tests. - Added
scripts/spec-doctor.mjs(credential + Confluence reachability preflight with injectable deps) plus unit tests; updated command docs and bumped plugin version to0.1.2.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/claude-code/unic-spec-review/tests/spec-doctor.test.mjs | Unit tests for Confluence preflight and ping error mapping. |
| apps/claude-code/unic-spec-review/tests/setup-confluence.test.mjs | Unit tests for credential writer + env detection. |
| apps/claude-code/unic-spec-review/tests/args.test.mjs | Extends args tests to cover the new parseArgs. |
| apps/claude-code/unic-spec-review/scripts/spec-doctor.mjs | New Confluence credential/connectivity preflight script. |
| apps/claude-code/unic-spec-review/scripts/setup-confluence.mjs | New credential file writer script used by the wizard. |
| apps/claude-code/unic-spec-review/scripts/lib/args.mjs | Adds parseArgs alongside existing parseReviewSpecArgs. |
| apps/claude-code/unic-spec-review/package.json | Bumps package version to 0.1.2. |
| apps/claude-code/unic-spec-review/commands/spec-doctor.md | Implements spec-doctor command orchestration instructions. |
| apps/claude-code/unic-spec-review/commands/setup-confluence.md | Implements interactive setup wizard instructions. |
| apps/claude-code/unic-spec-review/CHANGELOG.md | Adds 0.1.2 release notes and resets Unreleased placeholders. |
| apps/claude-code/unic-spec-review/.claude-plugin/plugin.json | Bumps plugin manifest version to 0.1.2. |
| apps/claude-code/unic-spec-review/.claude-plugin/marketplace.json | Bumps marketplace version to 0.1.2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Issue #203's acceptance criterion forbids em dashes in authored text (except the mandated CHANGELOG version header). Copilot flagged the user-facing strings; this sweeps the rest too - JSDoc comments, command docs, spec-doctor/setup-confluence output, and test descriptions - so the whole slice complies. Replaced every " — " separator with " - ". The prior CHANGELOG note cited a now-removed org typography rule; reworded to ground the change in this slice's own acceptance criterion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Drop stale `:setup-jira` reference in writeConfluenceCreds JSDoc; that command exists in unic-pr-review (the vendoring source) but not in this plugin. Behavior unchanged. - Add tests for two untested in-scope pure-logic branches: isEnvConfigured rejecting a present-but-empty env var, and checkConfluence's raw-string fallback when the configured url is unparseable. Why: review surfaced a misleading vendored comment and two uncovered branches in the pure logic the slice's acceptance criteria require tested. No Critical/High findings; remaining suggestions are sub-threshold. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Why
unic-spec-reviewhad no way to set up credentials or verify prerequisites — both command stubs (/setup-confluence,/spec-doctor) were unimplemented and the script layer was absent. A user who installed only this plugin could not configure Confluence or preflight a review without first installing another plugin. This slice (S2, issue #203) makes the plugin self-contained for setup and preflight.What
parseArgsadded toscripts/lib/args.mjs(CLI parser the setup wizard imports);parseReviewSpecArgsuntouched.scripts/setup-confluence.mjs— vendored by copying fromunic-pr-review(no cross-import;./lib/args.mjsresolves locally). Writes~/.unic-confluence.jsonatomically, chmod 600 on POSIX, icacls hint on Windows, preserves existing fields (e.g.jiraUrl).scripts/spec-doctor.mjs— Confluence-only credential + connectivity preflight with injectableping/loadCreds. No az CLI, no Jira (out of scope per AC).commands/setup-confluence.md— full interactive wizard; routes the user to/unic-spec-review:spec-doctor(no Jira, nounic-pr-reviewreferences).commands/spec-doctor.md— orchestrator: runs the script, then checks Figma Dev Mode MCP and Playwright MCP. Absent MCPs are reported as loud explicit ✗ failures with remediation, never a silent skip.[Unreleased]; patch bump 0.1.1 → 0.1.2.Self-containment
No runtime or setup dependency on any other plugin. Vendored by copying from
unic-pr-review(the v2 plugin), never from the deprecated v1pr-review/.~/.unic-confluence.jsonis a shared credential store by convention, not a plugin coupling.Validation
pnpm --filter unic-spec-review typecheck✅pnpm --filter unic-spec-review test✅ 93 pass / 0 failpnpm --filter unic-spec-review verify:changelog✅ → 0.1.2pnpm check✅Refs #203.
🤖 Generated with Claude Code