Skip to content

fix: env refs for Cursor/VS Code, one profile path, drafts survive quit, distinct secret names - #471

Merged
siracusa5 merged 11 commits into
mainfrom
fix/ux-backlog
Nov 17, 2026
Merged

siracusa5 merged 11 commits into
mainfrom
fix/ux-backlog

Conversation

@siracusa5

Copy link
Copy Markdown
Collaborator

Summary

Four fixes left over from the UX audit.

  1. Env references for Cursor and VS Code. These two tools resolve ${env:NAME}, not ${NAME}. Compile and Machine sync now write ${env:NAME} to .cursor/mcp.json and .vscode/mcp.json. Import, drift and the grid read both forms back as ${NAME}. VS Code variables like ${workspaceFolder} are left alone. .vscode/mcp.json now uses its real root key, servers.
  2. Captured secret names no longer collide. my-api and my_api used to share HARNESS_MY_API. A clash now gets _2, _3. Capturing again reuses a field's existing name.
  3. One personal profile path: ~/.harness/harness.yaml. The CLI already used it; the desktop app, share prompt and docs now do too. ~/.claude/harness.yaml is read only when the new file is missing, with a notice. It is never written or deleted. Onboarding, Drift and the portability snapshot all honor the fallback. The desktop reads the profile through the Rust read_harness_file command, so no new webview file access was added.
  4. Unsaved Profile drafts survive quit. Drafts are kept in localStorage. Quitting with drafts asks Don't Save, Cancel or Save All (Return saves). Rust holds a close only when the webview has reported drafts, and quits anyway if the webview doesn't answer within 2 seconds, so a hung webview can't trap the app.

Release notes

  • Cursor and VS Code/Copilot MCP files are written with ${env:NAME}. The next compile or sync rewrites existing ${NAME} references once; harness.yaml keeps ${NAME}.
  • Servers under the old mcpServers key in .vscode/mcp.json move to servers, which is the only key VS Code reads. Compile warns when it does this. On a name clash, the servers entry wins.
  • The personal profile moves to ~/.harness/harness.yaml in the desktop app. ~/.claude/harness.yaml is read only as a fallback, and the first desktop save creates the new file.
  • The CLI now falls back to ~/.claude/harness.yaml, so apply, reconcile, status --global and skills promote pick up a desktop-written profile they used to ignore. Each prints a one-line notice.
  • Quitting with unsaved Profile changes now asks first. The Quit menu item is a custom item with the same label and ⌘Q.
  • Captured secrets whose names collide get _2, _3, and capturing again keeps the existing names.

Not in this PR

  • Dock Quit, logout and shutdown don't show the quit prompt. Drafts still persist, so nothing is lost.
  • harness-kit capture --scope personal doesn't print the "ignored" notice when both profile files exist.

Test plan

  • core 1023, CLI 157, desktop vitest 1358, e2e 74, cargo test 308
  • tsc, check:capabilities, lint:styles, check-token-literals
  • Manual, in the running app: quit with an unsaved Profile edit (⌘Q and the red button); relaunch and see the draft restored; Drift Global with only ~/.harness/harness.yaml

🤖 Generated with Claude Code

siracusa5 and others added 11 commits November 16, 2026 23:40
…servers key

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
sanitizeCapturedSecrets named every secret from its path alone, so
`my-api` and `my_api` both became HARNESS_MY_API and shared one env
declaration. It now dedupes with _2, _3... through uniqueVariableName,
shared with the share Scrubber, and both derive names with one
MAX_VARIABLE_NAME_LENGTH (116) so a suffix still fits under 120.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ktop

Core exports PERSONAL_PROFILE_PATH and the legacy path. The CLI and desktop
read ~/.claude/harness.yaml only when the new file is absent, with a notice,
and always write the new path. ~/harness.yaml stays notice-only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A field already declared by an earlier capture (declaration description
names its path) reuses that variable instead of growing a _2, _3 suffix.
Declared names of other fields still count as taken.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Onboarding shows a legacy-read profile as a conflict; the portability
snapshot falls back to ~/.claude/harness.yaml; the CLI prints the legacy
and ignored notices once per process.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Drafts persist to localStorage (harness-kit:drafts:v1) and restore on launch.
Quit (Cmd+Q, Quit menu, window close) with unsaved drafts asks Save all /
Discard / Cancel; with none it quits at once. Rust holds the close request and
emits app://quit-requested; the webview answers via confirm_quit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ialog

Rust tracks whether drafts are unsaved: a close with none goes straight
through, and a held close force-quits if the webview does not acknowledge
within 2 s. Quit dialog order is Don't Save, Cancel, Save All (Return saves).
Stale drafts at legacy or unknown keys are migrated or dropped at load, and a
rejected confirm_quit is shown in the dialog.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rtability, fix Save All for moved legacy drafts

The webview fs scope does not cover ~/.harness/harness.yaml, so Drift Global and the portability snapshot saw it as absent. Both now use read_harness_file. Save All no longer sends a digest for a draft moved from the legacy file, and refuses it if the legacy file changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…; tighten tests and capture description

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CodeQL flagged /^_+|_+$/ on config-derived names (js/polynomial-redos).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siracusa5
siracusa5 merged commit df0abc2 into main Nov 17, 2026
22 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.

1 participant