Skip to content

Commit 586e49b

Browse files
committed
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.
1 parent d6c3cc8 commit 586e49b

3 files changed

Lines changed: 33 additions & 12 deletions

File tree

Readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Turns a Token Host Schema (THS) document into deterministic Solidity artifacts a
1212

1313
## Quickstart (New Pipeline)
1414

15-
Prereqs: Node >= 20, pnpm (repo uses `packageManager`), Foundry required for local anvil (`th dev` default) and for `th verify`.
15+
Prereqs: Node >= 20, pnpm (repo uses `packageManager`), Foundry required for local anvil (`th up` default) and for `th verify`.
1616

1717
```bash
1818
pnpm install
1919
pnpm th doctor
2020

21-
# One command: validate + build + start anvil + deploy + serve UI
22-
pnpm th dev apps/example/job-board.schema.json
21+
# One command: validate + build + start anvil + deploy + serve UI + local faucet
22+
pnpm th up apps/example/job-board.schema.json
2323

2424
# Open http://127.0.0.1:3000/
2525
# MetaMask: approve switching/adding the Anvil network (chainId 31337).

packages/cli/src/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ function buildFromSchema(
10741074
console.log('');
10751075
console.log('Next steps:');
10761076
if (opts.schemaPathForHints) {
1077-
console.log(` th dev ${opts.schemaPathForHints} # build+deploy+preview (local)`);
1077+
console.log(` th up ${opts.schemaPathForHints} # build+deploy+preview (local)`);
10781078
}
10791079
console.log(` th deploy ${resolvedOutDir} --chain anvil # start anvil first`);
10801080
console.log(` th deploy ${resolvedOutDir} --chain sepolia # requires RPC + funded key`);
@@ -1302,7 +1302,7 @@ program
13021302
'',
13031303
'```bash',
13041304
`pnpm th doctor`,
1305-
`pnpm th dev ${schemaPath}`,
1305+
`pnpm th up ${schemaPath}`,
13061306
'```',
13071307
''
13081308
].join('\n')
@@ -1473,9 +1473,11 @@ function anyPaidCreates(schema: ThsSchema): boolean {
14731473
}
14741474

14751475
program
1476-
.command('dev')
1476+
.command('up')
1477+
.alias('run')
1478+
.alias('dev')
14771479
.argument('[schema]', 'Path to THS schema JSON file (defaults to an example schema when available)')
1478-
.description('All-in-one local dev: validate + build + (start anvil) + deploy + preview')
1480+
.description('All-in-one local flow: validate + build + (start anvil) + deploy + preview + faucet')
14791481
.option('--out <dir>', 'Build output directory (defaults to artifacts/<appSlug>)')
14801482
.option('--chain <name>', 'Chain name (anvil|sepolia)', 'anvil')
14811483
.option('--rpc <url>', 'RPC URL override')
@@ -1562,7 +1564,7 @@ program
15621564
} else {
15631565
if (!interactive) {
15641566
console.error('No schema provided and none found under apps/.');
1565-
console.error('Run: th dev <path/to/schema.schema.json>');
1567+
console.error('Run: th up <path/to/schema.schema.json>');
15661568
process.exitCode = 1;
15671569
return;
15681570
}

test/testCliDev.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,37 @@ function minimalSchema(overrides = {}) {
4040
};
4141
}
4242

43-
describe('th dev', function () {
44-
it('supports --dry-run (no side effects)', function () {
43+
describe('th up/run/dev', function () {
44+
it('supports --dry-run (no side effects) via th up', function () {
4545
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'th-dev-'));
4646
const schemaPath = path.join(dir, 'schema.json');
4747
writeJson(schemaPath, minimalSchema());
4848

49-
const res = runTh(['dev', schemaPath, '--dry-run'], process.cwd());
49+
const res = runTh(['up', schemaPath, '--dry-run'], process.cwd());
5050
expect(res.status, res.stderr || res.stdout).to.equal(0);
5151
expect(res.stdout).to.include('Plan:');
5252
expect(res.stdout).to.include('- build:');
5353
expect(res.stdout).to.include('- deploy:');
5454
expect(res.stdout).to.include('- preview:');
5555
});
56-
});
5756

57+
it('supports --dry-run via th run alias', function () {
58+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'th-run-'));
59+
const schemaPath = path.join(dir, 'schema.json');
60+
writeJson(schemaPath, minimalSchema());
61+
62+
const res = runTh(['run', schemaPath, '--dry-run'], process.cwd());
63+
expect(res.status, res.stderr || res.stdout).to.equal(0);
64+
expect(res.stdout).to.include('Plan:');
65+
});
66+
67+
it('keeps th dev alias working', function () {
68+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'th-dev-'));
69+
const schemaPath = path.join(dir, 'schema.json');
70+
writeJson(schemaPath, minimalSchema());
71+
72+
const res = runTh(['dev', schemaPath, '--dry-run'], process.cwd());
73+
expect(res.status, res.stderr || res.stdout).to.equal(0);
74+
expect(res.stdout).to.include('Plan:');
75+
});
76+
});

0 commit comments

Comments
 (0)