Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(flash): never ask the person who typed `harness flash` to confirm

0xdiego2587967393bd0d
diff --git a/cli/src/lib/flash.spec.ts b/cli/src/lib/flash.spec.ts
index 69d215aca..bd549ebb1 100644
--- a/cli/src/lib/flash.spec.ts
+++ b/cli/src/lib/flash.spec.ts
@@ -90,7 +90,22 @@ describe('harness flash — handing over the flags', () => {
await flashCommand(args, deps)
- expect(calls.args[0]).toEqual(args)
+ // Untouched, and still in order — a flag the script grows next month works the day it ships,
+ // without this file learning it exists. `--yes` leads; see the next test for why.
+ expect(calls.args[0]).toEqual(['--yes', ...args])
+ })
+
+ it('never asks the person who typed `harness flash` to confirm', async () => {
+ // The script's prompt is for the standalone `curl | bash` case, where the operator may not know what
+ // is plugged in. Reaching a board through the product's own command, at the product's own device, is
+ // a different situation — and the check that actually prevents damage is the script refusing to write
+ // to anything that is not an ESP32-S3. Passing --yes first also leaves the user's own flags able to
+ // override anything they collide with.
+ const { deps, calls } = harness()
+
+ await flashCommand([], deps)
+
+ expect(calls.args[0]).toEqual(['--yes'])
})
/** `harness flash --detect-only` has to be usable in a shell condition, so the code is not swallowed. */
diff --git a/cli/src/lib/flash.ts b/cli/src/lib/flash.ts
index 309083508..223501163 100644
--- a/cli/src/lib/flash.ts
+++ b/cli/src/lib/flash.ts
@@ -127,7 +127,13 @@ export async function flashCommand(args: string[], overrides: Partial<FlashDeps>
const { source } = await resolveScript(deps)
deps.log(`>> circle flasher (${source === 'fetched' ? scriptUrl() : `cached: ${CACHED_SCRIPT}`})`)
try {
- return await deps.run(CACHED_SCRIPT, args)
+ // `--yes` FIRST, ALWAYS. The prompt in the script exists for the standalone `curl | bash` case, where
+ // the operator may not know what is plugged in; it still guards that path. Reaching a board through
+ // `harness flash` is a different situation — the person typed the product's own command at the
+ // product's own device — and the check that actually prevents damage is the script's refusal to write
+ // to anything that is not an ESP32-S3. A confirmation in front of a customer converting the device
+ // they own is friction wearing the clothes of safety. The user's own flags follow and still win.
+ return await deps.run(CACHED_SCRIPT, ['--yes', ...args])
} catch (err) {
// The only way `spawn` itself fails here in practice. Every macOS and Linux ships bash; a machine
// without it cannot run the flasher at all, so say what to do instead of just failing.