feat: desktop terminal-action bridge (Push, Add datasource, New project) - #15
Closed
ElfredSeow wants to merge 24 commits into
Closed
feat: desktop terminal-action bridge (Push, Add datasource, New project)#15ElfredSeow wants to merge 24 commits into
ElfredSeow wants to merge 24 commits into
Conversation
Push / Add-datasource / Create-new-project buttons + chat intents, all routed through Controller.action() so button and chat share one implementation per action. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
9 tasks: buildAndPush, datasource.js, scaffold-cli.js, chat.js intent routing, control.js + agent.js wiring, server.js routing, chat.html UI, and a desktop vendoring fix so New Project works in the packaged app (not just dev mode). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implements buildAndPush() to run npm run build (when present) followed
by pac code push. Also exports runPac as an alias for pac() so datasource.js
can spawn pac without duplicating binary-resolution logic.
New functions:
- buildAndPush(root, { appDir, emit, _push }) — orchestrate build+push
- hasBuildScript(root) — check if package.json has a build script
- runNpmBuild(root, { emit }) — execute npm run build
Adds 4 selftest checks covering successful build with push, build failure,
and skipping build when no script exists.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
.superpowers/ is the subagent-driven-development progress ledger (git-ignored scratch). package-lock.json changes are npm normalizing stray "peer": true markers on install — unrelated to any task.
Implements the datasource module wrapping pac code add-data-source for wiring Dataverse tables and connectors into Code App power.config.json. Includes comprehensive test coverage via selftest.js checks for api validation, flag construction, and error handling. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ion paths Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… a full new-project scaffold
…resolution - Sanitize the 'name' parameter in scaffoldNewProject() to prevent path-traversal - Add selftest check for binPath() real two-candidate resolution - Add selftest check for path-traversal-shaped name sanitization - Mirror changes to starter template Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… not substring Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…loy phrasing Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…sh and deploy do Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Add case 'push': gated on allowPush, calls pacInit.buildAndPush() - Add case 'add-datasource': gated on allowPush, calls addDataSource() - Both emit progress to the dashboard and return ok/error appropriately - Add test checks in selftest.js to verify gating and reachability Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…assertion Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…xtraction; revert out-of-scope AGENT_SYSTEM edit Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Task 6's fix subagent claimed this was already reverted but the working tree still carried escaped-straight-quote apostrophes, outside that task's declared scope (run() + top-level requires only).
…oint Task 7: scaffoldProject() closure function spawns Task 3's scaffoldNewProject() then switches workspace via openProject(); POST /api/action with type:scaffold-project routing; /api/agent post-processing for agent.run()'s kind:scaffold-project result; GET /api/dataverse-state for the Add-datasource picker (Task 8). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…real npm install The scaffoldProject route now tests its failure path directly by passing a non-existent targetDir. This causes scaffoldProject()'s own fs.statSync check to fail fast with "That folder no longer exists," before ever reaching scaffoldCli.scaffoldNewProject()—so the real bin/create-powercodex.js is never spawned, preventing network calls and global npm state mutation. The test runs in seconds instead of 8+ seconds waiting on npm install. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…aching innerHTML - Replace straight apostrophe in "It's ready to build" with curly quote (U+2019) to fix JS parse error in newProjectBtn handler - Escape user-controlled table and connector names in dsGo handler before passing to innerHTML (XSS fix) - Escape user-supplied project name in newProjectBtn handler before passing to innerHTML (XSS fix) - Add regression check to validate inline script parses without syntax errors Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…w project works in the packaged app Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…roject", not just anywhere in the message Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bridges three terminal actions into the chat/desktop UI, each reachable via both a toolbar button and a typed chat request:
npm run build(if present) thenpac code pushpac code add-data-source, with a picker for already-created Dataverse tablesPush and Add datasource are gated on the existing
allowPushconsent flag (Approved_rights/approval.json) — off by default, enforced independently on both the button path (Controller.action()) and the chat path (agent.js). New project has no gate (local-only scaffolding).Design spec:
docs/superpowers/specs/2026-07-13-desktop-terminal-action-bridge-design.mdImplementation plan:
docs/superpowers/plans/2026-07-13-desktop-terminal-action-bridge.mdWhy stacked on
feat/strengthen-the-PRDThis branch reuses the
pacCLI wiring (pac-init.js) landed in PR #14, which isn't onmainyet.Notable fixes found during review
templates/starter, notbin/create-powercodex.jsor the rest oftemplates/, so "New project" would have silently failed once packaged (not just in a repo checkout). Fixed indesktop/scripts/sync-lifecycle.js.<script>tag's parse, and two new handlers concatenated user input (a free-text connector id, a project name fromprompt()) unescaped into aninnerHTMLsink — both fixed and covered by new regression checks (including a check that actually parses the script).npm installon everynpm run lifecycle:selftestrun — fixed to fail fast before any spawn.Test plan
npm run lifecycle:selftest— 215/215 checks passing (up from 160 baseline)tools/lifecycle/file change mirrored byte-identically totemplates/starter/tools/lifecycle/(verified viadiff)cd desktop && npm start, click "✨ New project" end-to-end in a real Electron window (no display was available in this session — flagged as a follow-up before/at merge)🤖 Generated with Claude Code