From 586e49b520c0f0aab2e6b3347322f498fd514bbe Mon Sep 17 00:00:00 2001 From: Mikers Date: Thu, 5 Feb 2026 08:22:56 -1000 Subject: [PATCH] CLI: add th up/run orchestration commands Promote th up as the primary one-command local flow, add th run alias, and keep th dev as a compatibility alias. Update docs and tests accordingly. --- Readme.md | 6 +++--- packages/cli/src/index.ts | 12 +++++++----- test/testCliDev.js | 27 +++++++++++++++++++++++---- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Readme.md b/Readme.md index 44c6528..24afcbf 100644 --- a/Readme.md +++ b/Readme.md @@ -12,14 +12,14 @@ Turns a Token Host Schema (THS) document into deterministic Solidity artifacts a ## Quickstart (New Pipeline) -Prereqs: Node >= 20, pnpm (repo uses `packageManager`), Foundry required for local anvil (`th dev` default) and for `th verify`. +Prereqs: Node >= 20, pnpm (repo uses `packageManager`), Foundry required for local anvil (`th up` default) and for `th verify`. ```bash pnpm install pnpm th doctor -# One command: validate + build + start anvil + deploy + serve UI -pnpm th dev apps/example/job-board.schema.json +# One command: validate + build + start anvil + deploy + serve UI + local faucet +pnpm th up apps/example/job-board.schema.json # Open http://127.0.0.1:3000/ # MetaMask: approve switching/adding the Anvil network (chainId 31337). diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 02841a4..a8eda70 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1074,7 +1074,7 @@ function buildFromSchema( console.log(''); console.log('Next steps:'); if (opts.schemaPathForHints) { - console.log(` th dev ${opts.schemaPathForHints} # build+deploy+preview (local)`); + console.log(` th up ${opts.schemaPathForHints} # build+deploy+preview (local)`); } console.log(` th deploy ${resolvedOutDir} --chain anvil # start anvil first`); console.log(` th deploy ${resolvedOutDir} --chain sepolia # requires RPC + funded key`); @@ -1302,7 +1302,7 @@ program '', '```bash', `pnpm th doctor`, - `pnpm th dev ${schemaPath}`, + `pnpm th up ${schemaPath}`, '```', '' ].join('\n') @@ -1473,9 +1473,11 @@ function anyPaidCreates(schema: ThsSchema): boolean { } program - .command('dev') + .command('up') + .alias('run') + .alias('dev') .argument('[schema]', 'Path to THS schema JSON file (defaults to an example schema when available)') - .description('All-in-one local dev: validate + build + (start anvil) + deploy + preview') + .description('All-in-one local flow: validate + build + (start anvil) + deploy + preview + faucet') .option('--out ', 'Build output directory (defaults to artifacts/)') .option('--chain ', 'Chain name (anvil|sepolia)', 'anvil') .option('--rpc ', 'RPC URL override') @@ -1562,7 +1564,7 @@ program } else { if (!interactive) { console.error('No schema provided and none found under apps/.'); - console.error('Run: th dev '); + console.error('Run: th up '); process.exitCode = 1; return; } diff --git a/test/testCliDev.js b/test/testCliDev.js index a9fe20b..8a64061 100644 --- a/test/testCliDev.js +++ b/test/testCliDev.js @@ -40,18 +40,37 @@ function minimalSchema(overrides = {}) { }; } -describe('th dev', function () { - it('supports --dry-run (no side effects)', function () { +describe('th up/run/dev', function () { + it('supports --dry-run (no side effects) via th up', function () { const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'th-dev-')); const schemaPath = path.join(dir, 'schema.json'); writeJson(schemaPath, minimalSchema()); - const res = runTh(['dev', schemaPath, '--dry-run'], process.cwd()); + const res = runTh(['up', schemaPath, '--dry-run'], process.cwd()); expect(res.status, res.stderr || res.stdout).to.equal(0); expect(res.stdout).to.include('Plan:'); expect(res.stdout).to.include('- build:'); expect(res.stdout).to.include('- deploy:'); expect(res.stdout).to.include('- preview:'); }); -}); + it('supports --dry-run via th run alias', function () { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'th-run-')); + const schemaPath = path.join(dir, 'schema.json'); + writeJson(schemaPath, minimalSchema()); + + const res = runTh(['run', schemaPath, '--dry-run'], process.cwd()); + expect(res.status, res.stderr || res.stdout).to.equal(0); + expect(res.stdout).to.include('Plan:'); + }); + + it('keeps th dev alias working', function () { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'th-dev-')); + const schemaPath = path.join(dir, 'schema.json'); + writeJson(schemaPath, minimalSchema()); + + const res = runTh(['dev', schemaPath, '--dry-run'], process.cwd()); + expect(res.status, res.stderr || res.stdout).to.equal(0); + expect(res.stdout).to.include('Plan:'); + }); +});