hive-stream 3.0.5 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.1.0] - 2026-07-13
9
+
10
+ ### ✨ Added
11
+ - **App Scaffolding CLI** - New `hive-stream` binary for scaffolding Hive app projects
12
+ - Files: `src/cli/`
13
+ - **Roulette Contract** - Added roulette game contract and usage examples
14
+ - Files: `src/contracts/`
15
+ - **Non-Custodial Asset Trading** - Added non-custodial asset trading with checkpoint support
16
+ - Files: `src/contracts/`
17
+
8
18
  ## [Unreleased]
9
19
 
10
20
  ### 🔒 Security
package/DOCUMENTATION.md CHANGED
@@ -13,6 +13,30 @@ This document focuses on the contract system and how to build robust contracts u
13
13
 
14
14
  ---
15
15
 
16
+ ## CLI
17
+
18
+ Hive Stream ships a scaffolding CLI. It generates a complete TypeScript app — package.json, tsconfig, `.env.example`, a wired-up `src/index.ts`, a starter custom contract, and a README with payload examples for every registered contract action.
19
+
20
+ ```shell
21
+ npx hive-stream new <name> [options] # scaffold a new app
22
+ npx hive-stream list # show templates and adapters
23
+ ```
24
+
25
+ Run `new` without options for interactive prompts, or pass flags for non-interactive use:
26
+
27
+ | Flag | Description |
28
+ | --- | --- |
29
+ | `-t, --template <id>` | `minimal`, `game`, `exchange`, `social`, `blog`, `token`, or `assets` |
30
+ | `-a, --adapter <id>` | `sqlite` (default), `mongodb`, or `postgresql` |
31
+ | `-u, --username <name>` | Hive account the app runs as |
32
+ | `--api` | Enable the built-in HTTP API server |
33
+ | `--install` | Run `npm install` after scaffolding |
34
+ | `-y, --yes` | Skip prompts and accept defaults |
35
+
36
+ Generated apps read `HIVE_USERNAME`, `HIVE_POSTING_KEY`, and `HIVE_ACTIVE_KEY` from `.env` via `new Streamer({ env: true })`.
37
+
38
+ ---
39
+
16
40
  ## Concepts
17
41
 
18
42
  ### Contracts
@@ -299,6 +323,7 @@ export const TipJar = defineContract({
299
323
  - `createTokenContract` - SQL-backed fungible tokens
300
324
  - `createNFTContract` - SQL-backed NFTs
301
325
  - `createRpsContract` - Rock/Paper/Scissors
326
+ - `createRouletteContract` - Roulette with straight, color, parity, dozen, column, and low/high bets
302
327
  - `createPollContract` - Polls and votes
303
328
  - `createTipJarContract` - Tip jar + message log
304
329
  - `createExchangeContract` - Deposits/withdrawals/orders/matching (SQL)
@@ -329,14 +354,16 @@ export const TipJar = defineContract({
329
354
  - `createPayrollContract` - Recurring payroll budgets with scheduled runs and recipient balances
330
355
  - `createProposalTimelockContract` - Timelock approval queues for delayed governance-style actions
331
356
  - `createBundleMarketplaceContract` - Bundle storefronts with inventory, purchases, and fulfillment tracking
332
- - `createTicketingContract` - Event ticket sales with check-ins, refunds, and capacity limits
357
+ - `createTicketingContract` - Event ticket sales with check-ins, refunds, capacity limits, transfers, and peer-to-peer resale
333
358
  - `createFanClubContract` - Paid clubs with member renewals, points, and perk redemptions
359
+ - `createCheckpointContract` - Periodic on-chain state hashes so independent operators can verify they derive identical state
334
360
 
335
361
  ### Example Snippets
336
362
 
337
363
  Quick-start snippets live in `examples/contracts/`:
338
364
 
339
365
  - `examples/contracts/rps.ts`
366
+ - `examples/contracts/roulette.ts`
340
367
  - `examples/contracts/poll.ts`
341
368
  - `examples/contracts/tipjar.ts`
342
369
  - `examples/contracts/exchange.ts`
@@ -435,6 +462,60 @@ When the built-in API server is running, the following endpoints are available:
435
462
 
436
463
  ---
437
464
 
465
+ ## Non-Custodial Assets Guide
466
+
467
+ The NFT and ticketing contracts support fully non-custodial trading: buyers pay sellers **directly**, and the contract only verifies the on-chain payment and flips ownership. Funds never pass through the app account.
468
+
469
+ ### Direct NFT sales
470
+
471
+ 1. The owner lists with `listNFT` (custom_json): `{"collectionSymbol":"ART","tokenId":"piece-1","price":"10.000","currency":"HIVE"}`.
472
+ 2. The buyer sends the exact price **to the seller's account** with the memo `{"hive_stream":{"contract":"nft","action":"buyNFTDirect","payload":{"collectionSymbol":"ART","tokenId":"piece-1"}}}`.
473
+ 3. The contract verifies the transfer recipient is the seller and the amount/currency match the listing, then transfers ownership.
474
+
475
+ The examples above assume the contract was registered as `createNFTContract({ name: 'nft' })` (what scaffolded apps do); the default registered name is `hivenft`.
476
+
477
+ Royalties cannot be enforced on a peer-to-peer payment; `buyNFTDirect` records the royalty owed (`royaltyDue`, `royaltyRecipient`) in the emitted event so marketplaces and sellers can honour them. The custodial `buyNFT` flow (payment to the app account, which pays out the seller and royalties) remains available.
478
+
479
+ ### Batch minting
480
+
481
+ `mintBatchNFT` (custom_json, collection creator only) mints many tokens in one operation, either as numbered editions or an explicit list:
482
+
483
+ ```json
484
+ {"collectionSymbol":"TICKETS","to":"some-account","editions":{"baseTokenId":"GA","count":100}}
485
+ {"collectionSymbol":"TICKETS","to":"some-account","tokens":[{"tokenId":"VIP-1","metadata":"{\"seat\":\"A1\"}"}]}
486
+ ```
487
+
488
+ Editions mint `GA-1` … `GA-100` (up to 1,000 per operation); explicit lists allow up to 50 tokens with per-token metadata. Both respect the collection's maximum supply atomically.
489
+
490
+ ### Ticket transfers and resale
491
+
492
+ Tickets from the ticketing contract are bearer assets:
493
+
494
+ - `transferTicket` (custom_json, owner only): `{"ticketId":"ticket-1","to":"friend-account"}`
495
+ - `listTicket` / `unlistTicket` (custom_json, owner only): `{"ticketId":"ticket-1","price":"3.000"}` — asset defaults to the event's asset
496
+ - `buyTicketDirect` (transfer memo): buyer pays the listed price **directly to the seller** with `{"hive_stream":{"contract":"ticketing","action":"buyTicketDirect","payload":{"ticketId":"ticket-1"}}}`
497
+
498
+ Transferring a ticket deactivates any active resale listing, and stale listings (where the seller no longer owns the ticket) are rejected at purchase time.
499
+
500
+ ### State checkpoints
501
+
502
+ Because contract state is derived off-chain, anyone can verify an app by replaying the chain. `createCheckpointContract` makes that verification cheap: it periodically publishes a deterministic sha256 hash of your contract tables as a custom_json operation, and records other operators' published hashes with a match/mismatch verdict.
503
+
504
+ ```ts
505
+ import { createCheckpointContract, TimeAction } from 'hive-stream';
506
+
507
+ await streamer.registerContract(createCheckpointContract({
508
+ account: 'my-app-account',
509
+ tables: ['nft_collections', 'nft_tokens', 'nft_listings']
510
+ }));
511
+
512
+ await streamer.registerAction(new TimeAction('1h', 'state-checkpoint', 'checkpoint', 'publishCheckpoint', {}));
513
+ ```
514
+
515
+ The hash is order-independent (rows are hashed individually and sorted), so any adapter backend that holds the same logical state produces the same digest. Publishing requires a posting key for the configured account. Results land in the `state_checkpoints` table; a `matched = 0` row means your node's state diverges from the publisher's (or the hash was computed after state moved on — recompute at the same cadence to confirm).
516
+
517
+ ---
518
+
438
519
  ## Social Operations
439
520
 
440
521
  Follow, unfollow, mute, and reblog users directly from the streamer:
package/README.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  A Node.js layer for Hive that allows you to watch for specific actions on the Hive blockchain.
4
4
 
5
+ ## Scaffold a new app
6
+
7
+ The fastest way to start is the bundled CLI. It scaffolds a ready-to-run Hive app — game, exchange, social platform, blog, token/NFT project, non-custodial asset platform, or a minimal starter — wired up with the storage adapter of your choice:
8
+
9
+ ```shell
10
+ npx hive-stream new my-app
11
+ ```
12
+
13
+ Answer a few prompts (or skip them with flags) and you get a TypeScript project with contracts registered, a `.env.example`, and a README with copy-paste payload examples for every contract action:
14
+
15
+ ```shell
16
+ npx hive-stream new my-game --template game --username my-account
17
+ npx hive-stream new my-exchange --template exchange --adapter postgresql --api
18
+ npx hive-stream list # see all templates and adapters
19
+ ```
20
+
21
+ Templates: `minimal`, `game` (dice, coinflip, roulette, RPS), `exchange` (order book + matching engine), `social` (fan clubs, subscriptions, tips), `blog` (paywall, tips, post streaming), `token` (tokens + NFTs), `assets` (non-custodial NFTs, event tickets, peer-to-peer sales, on-chain state checkpoints). Adapters: `sqlite`, `mongodb`, `postgresql`.
22
+
5
23
  ## Install
6
24
 
7
25
  ```shell
@@ -559,6 +577,7 @@ The library includes several built-in contract examples in the `src/contracts` f
559
577
  - `createTokenContract` - A contract for token operations
560
578
  - `createNFTContract` - A contract for NFT operations
561
579
  - `createRpsContract` - A rock-paper-scissors game contract
580
+ - `createRouletteContract` - A roulette game contract with straight, color, parity, dozen, column, and low/high bets
562
581
  - `createPollContract` - A poll/voting contract
563
582
  - `createTipJarContract` - A tip jar + message board contract
564
583
  - `createExchangeContract` - A basic exchange with deposits, withdrawals, balances, and order matching (SQL adapter required)
@@ -595,7 +614,7 @@ The library includes several built-in contract examples in the `src/contracts` f
595
614
  These can be imported and used as examples for building your own contracts:
596
615
 
597
616
  ```javascript
598
- import { createDiceContract, createCoinflipContract, createLottoContract } from 'hive-stream';
617
+ import { createDiceContract, createCoinflipContract, createLottoContract, createRouletteContract } from 'hive-stream';
599
618
  ```
600
619
 
601
620
  Most built-in contracts in `src/contracts` persist SQL tables internally, so they require a SQL-capable adapter such as SQLite or PostgreSQL. MongoDB remains supported for streamer persistence and custom contracts that do not depend on raw SQL queries.
@@ -605,6 +624,7 @@ Most built-in contracts in `src/contracts` persist SQL tables internally, so the
605
624
  Sample snippets for the newest contracts live in `examples/contracts/`:
606
625
 
607
626
  - `examples/contracts/rps.ts`
627
+ - `examples/contracts/roulette.ts`
608
628
  - `examples/contracts/poll.ts`
609
629
  - `examples/contracts/tipjar.ts`
610
630
  - `examples/contracts/exchange.ts`
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,209 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const child_process_1 = require("child_process");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const prompts_1 = require("./prompts");
11
+ const scaffold_1 = require("./scaffold");
12
+ const templates_1 = require("./templates");
13
+ const FLAG_ALIASES = {
14
+ t: 'template',
15
+ a: 'adapter',
16
+ u: 'username',
17
+ y: 'yes',
18
+ h: 'help',
19
+ v: 'version'
20
+ };
21
+ const VALUE_FLAGS = new Set(['template', 'adapter', 'username']);
22
+ function getPackageVersion() {
23
+ const packagePath = path_1.default.join(__dirname, '..', '..', 'package.json');
24
+ const contents = JSON.parse(fs_1.default.readFileSync(packagePath, 'utf8'));
25
+ return contents.version;
26
+ }
27
+ function parseArgs(argv) {
28
+ const parsed = { command: null, positional: [], flags: {} };
29
+ let index = 0;
30
+ while (index < argv.length) {
31
+ const arg = argv[index];
32
+ if (arg.startsWith('--') || (arg.startsWith('-') && arg.length === 2)) {
33
+ const raw = arg.replace(/^-+/, '');
34
+ const name = FLAG_ALIASES[raw] ?? raw;
35
+ if (VALUE_FLAGS.has(name)) {
36
+ const value = argv[index + 1];
37
+ if (value === undefined || value.startsWith('-')) {
38
+ fail(`Flag --${name} requires a value.`);
39
+ }
40
+ parsed.flags[name] = value;
41
+ index += 2;
42
+ continue;
43
+ }
44
+ parsed.flags[name] = true;
45
+ index += 1;
46
+ continue;
47
+ }
48
+ if (parsed.command === null) {
49
+ parsed.command = arg;
50
+ }
51
+ else {
52
+ parsed.positional.push(arg);
53
+ }
54
+ index += 1;
55
+ }
56
+ return parsed;
57
+ }
58
+ function fail(message) {
59
+ console.error(`${prompts_1.color.red('error')} ${message}`);
60
+ process.exit(1);
61
+ }
62
+ function printHelp() {
63
+ const lines = [
64
+ '',
65
+ `${prompts_1.color.bold('hive-stream')} — build apps on the Hive blockchain`,
66
+ '',
67
+ `${prompts_1.color.bold('Usage')}`,
68
+ ` hive-stream new <name> [options] Scaffold a new Hive app`,
69
+ ` hive-stream list Show available templates and adapters`,
70
+ ` hive-stream help Show this help`,
71
+ '',
72
+ `${prompts_1.color.bold('Options for new')}`,
73
+ ` -t, --template <id> App template (${templates_1.TEMPLATES.map((template) => template.id).join(', ')})`,
74
+ ` -a, --adapter <id> Storage adapter (${templates_1.ADAPTERS.map((adapter) => adapter.id).join(', ')})`,
75
+ ` -u, --username <name> Hive account the app runs as`,
76
+ ` --api Enable the built-in HTTP API server`,
77
+ ` --install Run npm install after scaffolding`,
78
+ ` -y, --yes Skip prompts and accept defaults`,
79
+ '',
80
+ `${prompts_1.color.bold('Examples')}`,
81
+ ` npx hive-stream new my-game --template game --username my-account`,
82
+ ` npx hive-stream new my-exchange -t exchange -a postgresql --api`,
83
+ ''
84
+ ];
85
+ console.log(lines.join('\n'));
86
+ }
87
+ function printList() {
88
+ console.log('');
89
+ console.log(prompts_1.color.bold('Templates'));
90
+ for (const template of templates_1.TEMPLATES) {
91
+ console.log(` ${prompts_1.color.cyan(template.id.padEnd(12))} ${template.description}`);
92
+ }
93
+ console.log('');
94
+ console.log(prompts_1.color.bold('Adapters'));
95
+ for (const adapter of templates_1.ADAPTERS) {
96
+ console.log(` ${prompts_1.color.cyan(adapter.id.padEnd(12))} ${adapter.description}`);
97
+ }
98
+ console.log('');
99
+ console.log(prompts_1.color.dim('Scaffold an app with: npx hive-stream new <name> --template <id>'));
100
+ console.log('');
101
+ }
102
+ async function runNew(parsed) {
103
+ const skipPrompts = Boolean(parsed.flags.yes) || !(0, prompts_1.isInteractive)();
104
+ let name = parsed.positional[0] ?? '';
105
+ if (!name && !skipPrompts) {
106
+ name = await (0, prompts_1.text)('Project name:', 'my-hive-app', scaffold_1.validateProjectName);
107
+ }
108
+ else if (!name) {
109
+ fail('Project name is required. Usage: hive-stream new <name>');
110
+ }
111
+ const nameError = (0, scaffold_1.validateProjectName)(name);
112
+ if (nameError) {
113
+ fail(nameError);
114
+ }
115
+ const targetDir = path_1.default.resolve(process.cwd(), name);
116
+ const usable = (0, scaffold_1.isDirectoryUsable)(targetDir);
117
+ if (!usable.usable) {
118
+ fail(`Cannot create ${name}: ${usable.reason}`);
119
+ }
120
+ let template = typeof parsed.flags.template === 'string' ? parsed.flags.template : '';
121
+ if (template && !(0, templates_1.getTemplate)(template)) {
122
+ fail(`Unknown template '${template}'. Available: ${templates_1.TEMPLATES.map((entry) => entry.id).join(', ')}`);
123
+ }
124
+ if (!template) {
125
+ template = skipPrompts ? 'minimal' : await (0, prompts_1.select)('What are you building?', templates_1.TEMPLATES.map((entry) => ({ value: entry.id, label: entry.label, hint: entry.description })), 'minimal');
126
+ }
127
+ let adapter = typeof parsed.flags.adapter === 'string' ? parsed.flags.adapter : '';
128
+ if (adapter && !(0, templates_1.getAdapter)(adapter)) {
129
+ fail(`Unknown adapter '${adapter}'. Available: ${templates_1.ADAPTERS.map((entry) => entry.id).join(', ')}`);
130
+ }
131
+ if (!adapter) {
132
+ adapter = skipPrompts ? 'sqlite' : await (0, prompts_1.select)('Where should app state be stored?', templates_1.ADAPTERS.map((entry) => ({ value: entry.id, label: entry.label, hint: entry.description })), 'sqlite');
133
+ }
134
+ let username = typeof parsed.flags.username === 'string' ? parsed.flags.username : '';
135
+ if (!username) {
136
+ username = skipPrompts
137
+ ? 'your-account'
138
+ : await (0, prompts_1.text)('Hive account the app runs as:', 'your-account');
139
+ }
140
+ username = username.replace(/^@/, '');
141
+ let api = Boolean(parsed.flags.api);
142
+ if (!parsed.flags.api && !skipPrompts) {
143
+ api = await (0, prompts_1.confirm)('Enable the built-in HTTP API server?', false);
144
+ }
145
+ const { files, template: templateDef, adapter: adapterDef } = (0, scaffold_1.generateProjectFiles)({
146
+ name,
147
+ template,
148
+ adapter,
149
+ username,
150
+ api,
151
+ hiveStreamVersion: getPackageVersion()
152
+ });
153
+ const written = (0, scaffold_1.writeProjectFiles)(targetDir, files);
154
+ console.log('');
155
+ console.log(`${prompts_1.color.green('✔')} Created ${prompts_1.color.bold(name)} (${templateDef.label} template, ${adapterDef.label} storage)`);
156
+ console.log('');
157
+ for (const file of written) {
158
+ console.log(` ${prompts_1.color.dim(name + '/')}${file}`);
159
+ }
160
+ if (parsed.flags.install) {
161
+ console.log('');
162
+ console.log(`${prompts_1.color.cyan('→')} Installing dependencies...`);
163
+ const install = (0, child_process_1.spawnSync)('npm', ['install'], { cwd: targetDir, stdio: 'inherit', shell: process.platform === 'win32' });
164
+ if (install.status !== 0) {
165
+ console.log(`${prompts_1.color.yellow('!')} npm install failed. Run it manually inside ${name}.`);
166
+ }
167
+ }
168
+ const steps = [`cd ${name}`];
169
+ if (!parsed.flags.install) {
170
+ steps.push('npm install');
171
+ }
172
+ steps.push('cp .env.example .env # add your Hive account and keys');
173
+ steps.push('npm run dev');
174
+ console.log('');
175
+ console.log(prompts_1.color.bold('Next steps'));
176
+ for (const step of steps) {
177
+ console.log(` ${step}`);
178
+ }
179
+ console.log('');
180
+ console.log(prompts_1.color.dim('Usage examples for your contracts are in the generated README.md.'));
181
+ console.log('');
182
+ }
183
+ async function main() {
184
+ const parsed = parseArgs(process.argv.slice(2));
185
+ if (parsed.flags.version) {
186
+ console.log(getPackageVersion());
187
+ return;
188
+ }
189
+ if (parsed.flags.help || parsed.command === 'help' || parsed.command === null) {
190
+ printHelp();
191
+ return;
192
+ }
193
+ switch (parsed.command) {
194
+ case 'new':
195
+ case 'create':
196
+ await runNew(parsed);
197
+ break;
198
+ case 'list':
199
+ printList();
200
+ break;
201
+ default:
202
+ fail(`Unknown command '${parsed.command}'. Run hive-stream help for usage.`);
203
+ }
204
+ }
205
+ main().catch((error) => {
206
+ console.error(error);
207
+ process.exit(1);
208
+ });
209
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;AAEA,iDAA0C;AAC1C,4CAAoB;AACpB,gDAAwB;AAExB,uCAAwE;AACxE,yCAA6G;AAC7G,2CAA2E;AAQ3E,MAAM,YAAY,GAA2B;IACzC,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,KAAK;IACR,CAAC,EAA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;IAC7B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC,CAAC;IAC5F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC;AAED,KAAK,UAAU,IAAI;IACf,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhD,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACjC,OAAO;IACX,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAC5E,SAAS,EAAE,CAAC;QACZ,OAAO;IACX,CAAC;IAED,QAAQ,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,KAAK,KAAK,CAAC;QACX,KAAK,QAAQ;YACT,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;YACrB,MAAM;QACV,KAAK,MAAM;YACP,SAAS,EAAE,CAAC;YACZ,MAAM;QACV;YACI,IAAI,CAAC,oBAAoB,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;IACrF,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface Choice<T extends string = string> {
2
+ value: T;
3
+ label: string;
4
+ hint?: string;
5
+ }
6
+ export declare const color: {
7
+ bold: (text: string) => string;
8
+ dim: (text: string) => string;
9
+ cyan: (text: string) => string;
10
+ green: (text: string) => string;
11
+ red: (text: string) => string;
12
+ yellow: (text: string) => string;
13
+ };
14
+ export declare function isInteractive(): boolean;
15
+ export declare function text(question: string, defaultValue: string, validate?: (value: string) => string | null): Promise<string>;
16
+ export declare function select<T extends string>(question: string, choices: Choice<T>[], defaultValue: T): Promise<T>;
17
+ export declare function confirm(question: string, defaultValue: boolean): Promise<boolean>;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.color = void 0;
7
+ exports.isInteractive = isInteractive;
8
+ exports.text = text;
9
+ exports.select = select;
10
+ exports.confirm = confirm;
11
+ const readline_1 = __importDefault(require("readline"));
12
+ const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
13
+ exports.color = {
14
+ bold: (text) => (useColor ? `\x1b[1m${text}\x1b[0m` : text),
15
+ dim: (text) => (useColor ? `\x1b[2m${text}\x1b[0m` : text),
16
+ cyan: (text) => (useColor ? `\x1b[36m${text}\x1b[0m` : text),
17
+ green: (text) => (useColor ? `\x1b[32m${text}\x1b[0m` : text),
18
+ red: (text) => (useColor ? `\x1b[31m${text}\x1b[0m` : text),
19
+ yellow: (text) => (useColor ? `\x1b[33m${text}\x1b[0m` : text)
20
+ };
21
+ function isInteractive() {
22
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY);
23
+ }
24
+ function createInterface() {
25
+ return readline_1.default.createInterface({ input: process.stdin, output: process.stdout });
26
+ }
27
+ function ask(rl, question) {
28
+ return new Promise((resolve) => {
29
+ rl.question(question, (answer) => {
30
+ resolve(answer.trim());
31
+ });
32
+ });
33
+ }
34
+ async function text(question, defaultValue, validate) {
35
+ if (!isInteractive()) {
36
+ return defaultValue;
37
+ }
38
+ const rl = createInterface();
39
+ try {
40
+ while (true) {
41
+ const suffix = defaultValue ? exports.color.dim(` (${defaultValue})`) : '';
42
+ const answer = await ask(rl, `${exports.color.cyan('?')} ${question}${suffix} `);
43
+ const value = answer || defaultValue;
44
+ const error = validate ? validate(value) : null;
45
+ if (!error) {
46
+ return value;
47
+ }
48
+ console.log(` ${exports.color.red(error)}`);
49
+ }
50
+ }
51
+ finally {
52
+ rl.close();
53
+ }
54
+ }
55
+ async function select(question, choices, defaultValue) {
56
+ if (!isInteractive()) {
57
+ return defaultValue;
58
+ }
59
+ const rl = createInterface();
60
+ try {
61
+ console.log(`${exports.color.cyan('?')} ${question}`);
62
+ choices.forEach((choice, index) => {
63
+ const marker = choice.value === defaultValue ? exports.color.green('●') : exports.color.dim('○');
64
+ const hint = choice.hint ? ` ${exports.color.dim(`- ${choice.hint}`)}` : '';
65
+ console.log(` ${marker} ${exports.color.bold(String(index + 1))}. ${choice.label}${hint}`);
66
+ });
67
+ const defaultIndex = choices.findIndex((choice) => choice.value === defaultValue) + 1;
68
+ while (true) {
69
+ const answer = await ask(rl, ` ${exports.color.dim(`Choose 1-${choices.length} (${defaultIndex})`)} `);
70
+ if (!answer) {
71
+ return defaultValue;
72
+ }
73
+ const index = Number(answer);
74
+ if (Number.isInteger(index) && index >= 1 && index <= choices.length) {
75
+ return choices[index - 1].value;
76
+ }
77
+ console.log(` ${exports.color.red(`Enter a number between 1 and ${choices.length}.`)}`);
78
+ }
79
+ }
80
+ finally {
81
+ rl.close();
82
+ }
83
+ }
84
+ async function confirm(question, defaultValue) {
85
+ if (!isInteractive()) {
86
+ return defaultValue;
87
+ }
88
+ const rl = createInterface();
89
+ try {
90
+ const suffix = defaultValue ? 'Y/n' : 'y/N';
91
+ while (true) {
92
+ const answer = (await ask(rl, `${exports.color.cyan('?')} ${question} ${exports.color.dim(`(${suffix})`)} `)).toLowerCase();
93
+ if (!answer) {
94
+ return defaultValue;
95
+ }
96
+ if (['y', 'yes'].includes(answer)) {
97
+ return true;
98
+ }
99
+ if (['n', 'no'].includes(answer)) {
100
+ return false;
101
+ }
102
+ console.log(` ${exports.color.red('Enter y or n.')}`);
103
+ }
104
+ }
105
+ finally {
106
+ rl.close();
107
+ }
108
+ }
109
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/cli/prompts.ts"],"names":[],"mappings":";;;;;;AAmBA,sCAEC;AAcD,oBAuBC;AAED,wBAqCC;AAED,0BA8BC;AAjID,wDAAgC;AAQhC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAElD,QAAA,KAAK,GAAG;IACjB,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,GAAG,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,GAAG,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;CACzE,CAAC;AAEF,SAAgB,aAAa;IACzB,OAAO,OAAO,CAAC,OAAO,C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,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO,YAAY,CAAC;YACxB,CAAC;YAED,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACjB,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,KAAK,aAAK,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;YAAS,CAAC;QACP,EAAE,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { AdapterDefinition, TemplateDefinition } from './templates';
2
+ export interface ScaffoldOptions {
3
+ name: string;
4
+ template: string;
5
+ adapter: string;
6
+ username: string;
7
+ api: boolean;
8
+ hiveStreamVersion: string;
9
+ }
10
+ export interface ScaffoldResult {
11
+ files: Record<string, string>;
12
+ template: TemplateDefinition;
13
+ adapter: AdapterDefinition;
14
+ }
15
+ export declare function validateProjectName(name: string): string | null;
16
+ export declare function generateProjectFiles(options: ScaffoldOptions): ScaffoldResult;
17
+ export declare function writeProjectFiles(targetDir: string, files: Record<string, string>): string[];
18
+ export declare function isDirectoryUsable(targetDir: string): {
19
+ usable: boolean;
20
+ reason?: string;
21
+ };