@5ive-tech/cli 1.0.8 → 1.0.11
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/README.md +1 -14
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +10 -10
- package/dist/commands/build.js +4 -4
- package/dist/commands/compile.js +15 -15
- package/dist/commands/config.js +17 -17
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/deploy.js +12 -12
- package/dist/commands/execute.d.ts +1 -1
- package/dist/commands/execute.js +26 -26
- package/dist/commands/help.d.ts +1 -1
- package/dist/commands/help.js +13 -15
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/index.d.ts +1 -5
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +5 -18
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.js +32 -32
- package/dist/commands/namespace.js +4 -4
- package/dist/commands/test.d.ts +1 -1
- package/dist/commands/test.js +11 -11
- package/dist/commands/version.d.ts +1 -1
- package/dist/commands/version.js +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ If you already have a deployed script account:
|
|
|
62
62
|
|
|
63
63
|
## Program ID Resolution
|
|
64
64
|
|
|
65
|
-
For on-chain commands (`deploy`, `execute`, `
|
|
65
|
+
For on-chain commands (`deploy`, `execute`, `namespace`), program ID precedence is:
|
|
66
66
|
|
|
67
67
|
1. `--program-id` flag
|
|
68
68
|
2. `five.toml` `[deploy].program_id`
|
|
@@ -83,12 +83,6 @@ If none are set, on-chain commands fail fast with a program ID setup error.
|
|
|
83
83
|
|
|
84
84
|
`5ive build` / `--project` use `five.toml` and the generated manifest to resolve artifacts.
|
|
85
85
|
|
|
86
|
-
### One-command deploy+execute (smoke tests)
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
5ive deploy-and-execute build/main.five --target devnet -f 0
|
|
90
|
-
```
|
|
91
|
-
|
|
92
86
|
### Run tests
|
|
93
87
|
|
|
94
88
|
```bash
|
|
@@ -131,13 +125,6 @@ If none are set, on-chain commands fail fast with a program ID setup error.
|
|
|
131
125
|
5ive deploy build/main.five --target devnet --dry-run --format json
|
|
132
126
|
```
|
|
133
127
|
|
|
134
|
-
### Deploy-and-execute for fast integration checks
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
5ive deploy-and-execute build/main.five --target devnet -f 0 -p "[100]"
|
|
138
|
-
5ive deploy-and-execute src/main.v --target local --debug --cleanup
|
|
139
|
-
```
|
|
140
|
-
|
|
141
128
|
### Advanced test modes
|
|
142
129
|
|
|
143
130
|
```bash
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
2
|
+
// 5IVE CLI entry point.
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { join } from 'path';
|
|
@@ -25,7 +25,7 @@ export class FiveCLI {
|
|
|
25
25
|
}
|
|
26
26
|
setupProgram() {
|
|
27
27
|
this.program
|
|
28
|
-
.name('
|
|
28
|
+
.name('5ive')
|
|
29
29
|
.description('')
|
|
30
30
|
.version(this.getVersion(), '-V, --version', 'Display version information')
|
|
31
31
|
.helpOption(false) // Disable default help to use our custom help
|
|
@@ -39,11 +39,11 @@ export class FiveCLI {
|
|
|
39
39
|
return `
|
|
40
40
|
${section('Quick Start')}
|
|
41
41
|
|
|
42
|
-
${commandExample('
|
|
43
|
-
${commandExample('
|
|
44
|
-
${commandExample('
|
|
45
|
-
${commandExample('
|
|
46
|
-
${commandExample('
|
|
42
|
+
${commandExample('5ive init my-project', 'Create a new 5IVE project')}
|
|
43
|
+
${commandExample('5ive compile script.v', 'Compile 5ive source to bytecode')}
|
|
44
|
+
${commandExample('5ive execute script.v --local', 'Local WASM execution')}
|
|
45
|
+
${commandExample('5ive deploy build/script.five --target mainnet', 'Deploy to Solana mainnet')}
|
|
46
|
+
${commandExample('5ive help <command>', 'Get help for specific command')}
|
|
47
47
|
`;
|
|
48
48
|
});
|
|
49
49
|
// Global options with styling
|
|
@@ -189,7 +189,7 @@ ${commandExample('five help <command>', 'Get help for specific command')}
|
|
|
189
189
|
this.program.outputHelp();
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
// Route `
|
|
192
|
+
// Route `5ive <command> --help` to command-specific help
|
|
193
193
|
const commandName = argv[2];
|
|
194
194
|
const isCommandHelpRequest = Boolean(commandName) &&
|
|
195
195
|
!commandName.startsWith('-') &&
|
|
@@ -198,7 +198,7 @@ ${commandExample('five help <command>', 'Get help for specific command')}
|
|
|
198
198
|
await this.program.parseAsync([argv[0], argv[1], 'help', commandName]);
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
// Top-level help (e.g. `
|
|
201
|
+
// Top-level help (e.g. `5ive --help`)
|
|
202
202
|
if (commandName === '--help' || commandName === '-h') {
|
|
203
203
|
this.program.help();
|
|
204
204
|
return;
|
|
@@ -323,7 +323,7 @@ function levenshteinDistance(a, b) {
|
|
|
323
323
|
return matrix[a.length][b.length];
|
|
324
324
|
}
|
|
325
325
|
/**
|
|
326
|
-
* Create and configure a new
|
|
326
|
+
* Create and configure a new 5IVE CLI instance
|
|
327
327
|
*/
|
|
328
328
|
export function createCLI(config = {}) {
|
|
329
329
|
const defaultConfig = {
|
package/dist/commands/build.js
CHANGED
|
@@ -2,7 +2,7 @@ import { loadProjectConfig } from '../project/ProjectLoader.js';
|
|
|
2
2
|
import { compileCommand } from './compile.js';
|
|
3
3
|
export const buildCommand = {
|
|
4
4
|
name: 'build',
|
|
5
|
-
description: 'Build a
|
|
5
|
+
description: 'Build a 5IVE project from five.toml',
|
|
6
6
|
aliases: ['b'],
|
|
7
7
|
options: [
|
|
8
8
|
{
|
|
@@ -30,15 +30,15 @@ export const buildCommand = {
|
|
|
30
30
|
arguments: [],
|
|
31
31
|
examples: [
|
|
32
32
|
{
|
|
33
|
-
command: '
|
|
33
|
+
command: '5ive build',
|
|
34
34
|
description: 'Build the project in the current directory (discovers five.toml)'
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
command: '
|
|
37
|
+
command: '5ive build --project ../my-app',
|
|
38
38
|
description: 'Build a project at the given path'
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
command: '
|
|
41
|
+
command: '5ive build --target solana',
|
|
42
42
|
description: 'Override target from five.toml during build'
|
|
43
43
|
}
|
|
44
44
|
],
|
package/dist/commands/compile.js
CHANGED
|
@@ -7,7 +7,7 @@ import { computeHash, loadProjectConfig, writeBuildManifest } from '../project/P
|
|
|
7
7
|
import { success as uiSuccess, error as uiError, section } from '../utils/cli-ui.js';
|
|
8
8
|
export const compileCommand = {
|
|
9
9
|
name: 'compile',
|
|
10
|
-
description: 'Compile
|
|
10
|
+
description: 'Compile 5ive source to bytecode',
|
|
11
11
|
aliases: ['c'],
|
|
12
12
|
options: [
|
|
13
13
|
{
|
|
@@ -82,30 +82,30 @@ export const compileCommand = {
|
|
|
82
82
|
arguments: [
|
|
83
83
|
{
|
|
84
84
|
name: 'input',
|
|
85
|
-
description: 'Input
|
|
85
|
+
description: 'Input 5ive source file(s) or glob pattern (optional with five.toml)',
|
|
86
86
|
required: false,
|
|
87
87
|
variadic: true
|
|
88
88
|
}
|
|
89
89
|
],
|
|
90
90
|
examples: [
|
|
91
91
|
{
|
|
92
|
-
command: '
|
|
93
|
-
description: 'Compile a single
|
|
92
|
+
command: '5ive compile src/main.v',
|
|
93
|
+
description: 'Compile a single 5ive source file'
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
command: '
|
|
97
|
-
description: 'Compile all
|
|
96
|
+
command: '5ive compile src/**/*.v -o build/',
|
|
97
|
+
description: 'Compile all 5ive files in src directory'
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
command: '
|
|
100
|
+
command: '5ive compile src/main.v -t solana -O 3 --abi main.abi.json',
|
|
101
101
|
description: 'Compile for Solana with maximum optimization and ABI generation'
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
command: '
|
|
104
|
+
command: '5ive compile src/main.v --analyze --debug',
|
|
105
105
|
description: 'Compile with debug info and bytecode analysis'
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
|
-
command: '
|
|
108
|
+
command: '5ive compile src/**/*.v --watch',
|
|
109
109
|
description: 'Watch for changes and auto-recompile'
|
|
110
110
|
}
|
|
111
111
|
],
|
|
@@ -136,7 +136,7 @@ export const compileCommand = {
|
|
|
136
136
|
};
|
|
137
137
|
const { files: inputFiles, mode } = await resolveInputFiles(inputArgs, resolveOptions, logger, projectContext);
|
|
138
138
|
if (inputFiles.length === 0) {
|
|
139
|
-
throw new Error('No
|
|
139
|
+
throw new Error('No 5ive source files found. Provide input paths, or run from a project with five.toml (entry_point/source_dir), or pass --project <path>.');
|
|
140
140
|
}
|
|
141
141
|
// Only show file count in verbose mode
|
|
142
142
|
if (context.options.verbose) {
|
|
@@ -287,7 +287,7 @@ async function resolveInputFiles(args, options, logger, projectContext) {
|
|
|
287
287
|
return { files: uniqueFiles, mode: 'single' };
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
|
-
* Validate files without compilation using
|
|
290
|
+
* Validate files without compilation using 5IVE SDK
|
|
291
291
|
*/
|
|
292
292
|
async function validateFiles(inputFiles, context) {
|
|
293
293
|
const { logger } = context;
|
|
@@ -295,7 +295,7 @@ async function validateFiles(inputFiles, context) {
|
|
|
295
295
|
for (const inputFile of inputFiles) {
|
|
296
296
|
try {
|
|
297
297
|
const sourceCode = await readFile(inputFile, 'utf8');
|
|
298
|
-
// Use
|
|
298
|
+
// Use 5IVE SDK to validate bytecode
|
|
299
299
|
const result = await FiveSDK.compile(sourceCode, { debug: false });
|
|
300
300
|
if (result.success) {
|
|
301
301
|
console.log(uiSuccess(`${inputFile} - valid syntax`));
|
|
@@ -428,7 +428,7 @@ async function compileFiles(inputFiles, options, context, projectContext) {
|
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
431
|
-
* Compile a single file using
|
|
431
|
+
* Compile a single file using 5IVE SDK
|
|
432
432
|
*/
|
|
433
433
|
async function compileSingleFile(inputFile, options, context, projectContext, sourceFiles) {
|
|
434
434
|
const { logger } = context;
|
|
@@ -451,7 +451,7 @@ async function compileSingleFile(inputFile, options, context, projectContext, so
|
|
|
451
451
|
metricsOutput: options.metricsOutput,
|
|
452
452
|
flatNamespace: Boolean(options.flatNamespace)
|
|
453
453
|
};
|
|
454
|
-
// Compile using
|
|
454
|
+
// Compile using 5IVE SDK (includes .five format generation)
|
|
455
455
|
// Compile using FiveCompilerWasm directly for rich errors
|
|
456
456
|
const { FiveCompilerWasm } = await import('../wasm/compiler.js');
|
|
457
457
|
const wasmCompiler = new FiveCompilerWasm(logger);
|
|
@@ -845,7 +845,7 @@ function displayOpcodeAnalysis(opcodeUsage, opcodeAnalysis, logger) {
|
|
|
845
845
|
}
|
|
846
846
|
if (opcodeAnalysis && opcodeAnalysis.summary) {
|
|
847
847
|
console.log('\n' + section('Comprehensive Opcode Analysis'));
|
|
848
|
-
console.log(` Available opcodes in
|
|
848
|
+
console.log(` Available opcodes in 5IVE VM: ${opcodeAnalysis.summary.total_opcodes_available}`);
|
|
849
849
|
console.log(` Opcodes used by this script: ${opcodeAnalysis.summary.opcodes_used}`);
|
|
850
850
|
console.log(` Opcodes unused: ${opcodeAnalysis.summary.opcodes_unused}`);
|
|
851
851
|
console.log(` Usage percentage: ${opcodeAnalysis.summary.usage_percentage.toFixed(1)}%`);
|
package/dist/commands/config.js
CHANGED
|
@@ -9,12 +9,12 @@ import { ConfigManager } from '../config/ConfigManager.js';
|
|
|
9
9
|
import { success as uiSuccess, warning as uiWarning, uiColors, section } from '../utils/cli-ui.js';
|
|
10
10
|
export const configCommand = {
|
|
11
11
|
name: 'config',
|
|
12
|
-
description: 'Manage
|
|
12
|
+
description: 'Manage 5IVE CLI configuration',
|
|
13
13
|
aliases: ['cfg'],
|
|
14
14
|
options: [
|
|
15
15
|
{
|
|
16
16
|
flags: '--program-id <id>',
|
|
17
|
-
description: 'Set
|
|
17
|
+
description: 'Set 5IVE VM program ID for current or specified target',
|
|
18
18
|
required: false
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -37,43 +37,43 @@ export const configCommand = {
|
|
|
37
37
|
],
|
|
38
38
|
examples: [
|
|
39
39
|
{
|
|
40
|
-
command: '
|
|
40
|
+
command: '5ive config init',
|
|
41
41
|
description: 'Initialize configuration with interactive setup'
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
command: '
|
|
44
|
+
command: '5ive config get',
|
|
45
45
|
description: 'Show all configuration values'
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
command: '
|
|
48
|
+
command: '5ive config get target',
|
|
49
49
|
description: 'Show current target network'
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
command: '
|
|
52
|
+
command: '5ive config set --target devnet',
|
|
53
53
|
description: 'Set target network to devnet'
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
command: '
|
|
56
|
+
command: '5ive config set --keypair ~/.solana/deployer.json',
|
|
57
57
|
description: 'Set keypair file path'
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
command: '
|
|
60
|
+
command: '5ive config set --rpc-url https://api.custom.solana.com',
|
|
61
61
|
description: 'Set custom RPC URL for current target'
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
command: '
|
|
65
|
-
description: 'Set
|
|
64
|
+
command: '5ive config set --program-id HJ5RXmE94poUCBoUSViKe1bmvs9pH7WBA9rRpCz3pKXg',
|
|
65
|
+
description: 'Set 5IVE VM program ID for current target'
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
|
-
command: '
|
|
69
|
-
description: 'Set
|
|
68
|
+
command: '5ive config set --program-id <ID> --target devnet',
|
|
69
|
+
description: 'Set 5IVE VM program ID for specific target'
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
command: '
|
|
72
|
+
command: '5ive config get programIds',
|
|
73
73
|
description: 'Show all configured program IDs'
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
|
-
command: '
|
|
76
|
+
command: '5ive config reset',
|
|
77
77
|
description: 'Reset configuration to defaults'
|
|
78
78
|
}
|
|
79
79
|
],
|
|
@@ -121,7 +121,7 @@ async function handleInit(configManager, options, logger) {
|
|
|
121
121
|
return new Promise((resolve) => rl.question(query, resolve));
|
|
122
122
|
};
|
|
123
123
|
// Interactive setup
|
|
124
|
-
console.log('Let\'s configure your
|
|
124
|
+
console.log('Let\'s configure your 5IVE CLI environment:\n');
|
|
125
125
|
// Target network selection
|
|
126
126
|
const targetAnswer = await question(`Select target network (local/devnet/testnet/mainnet) [devnet]: `);
|
|
127
127
|
const target = targetAnswer.trim() || 'devnet';
|
|
@@ -309,7 +309,7 @@ async function handleReset(configManager, options, logger) {
|
|
|
309
309
|
*/
|
|
310
310
|
function formatConfig(config) {
|
|
311
311
|
const lines = [];
|
|
312
|
-
lines.push(chalk.bold('
|
|
312
|
+
lines.push(chalk.bold('5IVE CLI Configuration:'));
|
|
313
313
|
lines.push('');
|
|
314
314
|
// Current target
|
|
315
315
|
lines.push(`${uiColors.info('Target:')} ${config.target}`);
|
|
@@ -389,7 +389,7 @@ function formatValue(value) {
|
|
|
389
389
|
configCommand.options = [
|
|
390
390
|
{
|
|
391
391
|
flags: '--program-id <id>',
|
|
392
|
-
description: 'Set
|
|
392
|
+
description: 'Set 5IVE VM program ID for current or specified target',
|
|
393
393
|
required: false
|
|
394
394
|
},
|
|
395
395
|
{
|
package/dist/commands/deploy.js
CHANGED
|
@@ -10,7 +10,7 @@ import { FiveFileManager } from '../utils/FiveFileManager.js';
|
|
|
10
10
|
import { computeHash, loadBuildManifest, loadProjectConfig } from '../project/ProjectLoader.js';
|
|
11
11
|
import { section, keyValue, success as uiSuccess, error as uiError, isTTY } from '../utils/cli-ui.js';
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 5IVE deploy command implementation
|
|
14
14
|
*/
|
|
15
15
|
export const deployCommand = {
|
|
16
16
|
name: 'deploy',
|
|
@@ -34,7 +34,7 @@ export const deployCommand = {
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
flags: '--program-id <pubkey>',
|
|
37
|
-
description: 'Specify the
|
|
37
|
+
description: 'Specify the 5IVE VM program ID to be the owner of the new script account',
|
|
38
38
|
required: false
|
|
39
39
|
},
|
|
40
40
|
{
|
|
@@ -112,29 +112,29 @@ export const deployCommand = {
|
|
|
112
112
|
arguments: [
|
|
113
113
|
{
|
|
114
114
|
name: 'bytecode',
|
|
115
|
-
description: '
|
|
115
|
+
description: '5IVE VM artifact file (.five or .bin)',
|
|
116
116
|
required: true
|
|
117
117
|
}
|
|
118
118
|
],
|
|
119
119
|
examples: [
|
|
120
120
|
{
|
|
121
|
-
command: '
|
|
121
|
+
command: '5ive deploy program.five',
|
|
122
122
|
description: 'Deploy to configured target (uses config defaults)'
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
|
-
command: '
|
|
125
|
+
command: '5ive deploy program.five --target mainnet',
|
|
126
126
|
description: 'Deploy to mainnet (overrides config)'
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
|
-
command: '
|
|
129
|
+
command: '5ive deploy program.five --keypair deployer.json --target devnet',
|
|
130
130
|
description: 'Deploy to devnet with specific keypair'
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
|
-
command: '
|
|
133
|
+
command: '5ive deploy program.five --dry-run --format json',
|
|
134
134
|
description: 'Simulate deployment with JSON output'
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
|
-
command: '
|
|
137
|
+
command: '5ive deploy large-program.bin --optimized --progress',
|
|
138
138
|
description: 'Deploy large program with optimized instructions (50-70% fewer transactions)'
|
|
139
139
|
}
|
|
140
140
|
],
|
|
@@ -183,7 +183,7 @@ export const deployCommand = {
|
|
|
183
183
|
// Show target context prefix
|
|
184
184
|
const targetPrefix = ConfigManager.getTargetPrefix(config.target);
|
|
185
185
|
if (context.options.verbose) {
|
|
186
|
-
logger.info(`${targetPrefix} Deploying
|
|
186
|
+
logger.info(`${targetPrefix} Deploying 5IVE VM bytecode`);
|
|
187
187
|
}
|
|
188
188
|
// Show config details if enabled
|
|
189
189
|
if (config.showConfig && context.options.verbose) {
|
|
@@ -226,7 +226,7 @@ export const deployCommand = {
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
// Validate bytecode using
|
|
229
|
+
// Validate bytecode using 5IVE SDK
|
|
230
230
|
if (context.options.verbose) {
|
|
231
231
|
logger.info('Validating bytecode...');
|
|
232
232
|
}
|
|
@@ -607,8 +607,8 @@ async function executeDeployment(deploymentOptions, options, context, config) {
|
|
|
607
607
|
if (context.options.debug) {
|
|
608
608
|
logger.debug(`deployer: ${deployerKeypair.publicKey.toString()}`);
|
|
609
609
|
}
|
|
610
|
-
// Deploy using
|
|
611
|
-
const spinner = isTTY() ? ora('Deploying via
|
|
610
|
+
// Deploy using 5IVE SDK
|
|
611
|
+
const spinner = isTTY() ? ora('Deploying via 5IVE SDK...').start() : null;
|
|
612
612
|
// Auto-detect large programs and use appropriate deployment method
|
|
613
613
|
const bytecodeArray = new Uint8Array(deploymentOptions.bytecode);
|
|
614
614
|
const isLargeProgram = bytecodeArray.length > 800 || options.forceChunked;
|
package/dist/commands/execute.js
CHANGED
|
@@ -9,11 +9,11 @@ import { FiveFileManager } from '../utils/FiveFileManager.js';
|
|
|
9
9
|
import { loadBuildManifest, loadProjectConfig } from '../project/ProjectLoader.js';
|
|
10
10
|
import { section, success as uiSuccess, error as uiError, hint, keyValue } from '../utils/cli-ui.js';
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* 5IVE execute command implementation
|
|
13
13
|
*/
|
|
14
14
|
export const executeCommand = {
|
|
15
15
|
name: 'execute',
|
|
16
|
-
description: 'Execute
|
|
16
|
+
description: 'Execute 5IVE VM bytecode',
|
|
17
17
|
aliases: ['exec', 'run'],
|
|
18
18
|
options: [
|
|
19
19
|
{
|
|
@@ -104,7 +104,7 @@ export const executeCommand = {
|
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
flags: '--program-id <id>',
|
|
107
|
-
description: 'Override
|
|
107
|
+
description: 'Override 5IVE VM program ID (for custom deployments)',
|
|
108
108
|
required: false
|
|
109
109
|
},
|
|
110
110
|
{
|
|
@@ -116,42 +116,42 @@ export const executeCommand = {
|
|
|
116
116
|
arguments: [
|
|
117
117
|
{
|
|
118
118
|
name: 'bytecode',
|
|
119
|
-
description: '
|
|
119
|
+
description: '5IVE VM artifact file (.five/.bin) or script account ID',
|
|
120
120
|
required: false
|
|
121
121
|
}
|
|
122
122
|
],
|
|
123
123
|
examples: [
|
|
124
124
|
{
|
|
125
|
-
command: '
|
|
125
|
+
command: '5ive execute program.five',
|
|
126
126
|
description: 'Execute using configured target (default)'
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
|
-
command: '
|
|
129
|
+
command: '5ive execute program.five --local',
|
|
130
130
|
description: 'Force local execution (overrides config)'
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
|
-
command: '
|
|
133
|
+
command: '5ive execute program.five --target devnet',
|
|
134
134
|
description: 'Execute on devnet (overrides config)'
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
|
-
command: '
|
|
137
|
+
command: '5ive execute program.five -f 0 -p params.json',
|
|
138
138
|
description: 'Execute function 0 with parameters'
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
|
-
command: '
|
|
141
|
+
command: '5ive execute program.five --validate --trace --format json',
|
|
142
142
|
description: 'Validate and execute with JSON trace output'
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
|
-
command: '
|
|
146
|
-
description: 'Compile and execute
|
|
145
|
+
command: '5ive execute src/main.v -f 0 --local --params "[10, 5]"',
|
|
146
|
+
description: 'Compile and execute 5ive source locally with parameters'
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
|
-
command: '
|
|
149
|
+
command: '5ive execute --script-account 459SanqV8nQDDYW3gWq5JZZAPCMYs78Z5ZnrtH4eFffw -f 0',
|
|
150
150
|
description: 'Execute deployed script by account ID on-chain'
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
|
-
command: '
|
|
154
|
-
description: 'Execute with custom
|
|
153
|
+
command: '5ive execute --script-account 459SanqV8nQDDYW3gWq5JZZAPCMYs78Z5ZnrtH4eFffw -f 0 --program-id 9MHGM73eszNUtmJS6ypDCESguxWhCBnkUPpTMyLGqURH',
|
|
154
|
+
description: 'Execute with custom 5IVE VM program ID (for custom deployments)'
|
|
155
155
|
}
|
|
156
156
|
],
|
|
157
157
|
handler: async (args, options, context) => {
|
|
@@ -208,10 +208,10 @@ export const executeCommand = {
|
|
|
208
208
|
logger.info(`${targetPrefix} Executing deployed script account on-chain`);
|
|
209
209
|
}
|
|
210
210
|
else if (executeLocally) {
|
|
211
|
-
logger.info(`${ConfigManager.getTargetPrefix('wasm')} Executing
|
|
211
|
+
logger.info(`${ConfigManager.getTargetPrefix('wasm')} Executing 5IVE VM bytecode locally`);
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
214
|
-
logger.info(`${targetPrefix} Executing
|
|
214
|
+
logger.info(`${targetPrefix} Executing 5IVE VM bytecode`);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
// Show config details only if explicitly enabled and verbose
|
|
@@ -237,20 +237,20 @@ export const executeCommand = {
|
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
/**
|
|
240
|
-
* Execute locally using
|
|
240
|
+
* Execute locally using 5IVE SDK
|
|
241
241
|
*/
|
|
242
242
|
async function executeLocallyWithSDK(inputFile, options, context, config) {
|
|
243
243
|
const { logger } = context;
|
|
244
244
|
// Initialize for local execution
|
|
245
245
|
if (context.options.verbose) {
|
|
246
246
|
const spinner = ora('Preparing local execution...').start();
|
|
247
|
-
spinner.succeed('
|
|
247
|
+
spinner.succeed('5IVE SDK ready for local execution');
|
|
248
248
|
}
|
|
249
249
|
try {
|
|
250
250
|
let result;
|
|
251
251
|
if (extname(inputFile) === '.v') {
|
|
252
|
-
// Compile and execute
|
|
253
|
-
logger.info(`Compiling and executing
|
|
252
|
+
// Compile and execute 5ive source file
|
|
253
|
+
logger.info(`Compiling and executing 5ive source: ${inputFile}`);
|
|
254
254
|
const sourceCode = await readFile(inputFile, 'utf8');
|
|
255
255
|
// For .v files, we don't have ABI yet, so we'll just use the provided function or default to 0
|
|
256
256
|
// The real fix here would be to compile first, extract ABI, then auto-detect the public function
|
|
@@ -338,7 +338,7 @@ async function executeLocallyWithSDK(inputFile, options, context, config) {
|
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
/**
|
|
341
|
-
* Execute deployed script account on-chain using
|
|
341
|
+
* Execute deployed script account on-chain using 5IVE SDK
|
|
342
342
|
*/
|
|
343
343
|
async function executeScriptAccount(scriptAccount, options, context, config) {
|
|
344
344
|
const { logger } = context;
|
|
@@ -445,13 +445,13 @@ async function executeScriptAccount(scriptAccount, options, context, config) {
|
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
|
-
* Execute on-chain using
|
|
448
|
+
* Execute on-chain using 5IVE SDK
|
|
449
449
|
*/
|
|
450
450
|
async function executeOnChain(inputFile, options, context, config) {
|
|
451
451
|
const { logger } = context;
|
|
452
452
|
const { Connection, Keypair } = await import('@solana/web3.js');
|
|
453
453
|
const targetPrefix = ConfigManager.getTargetPrefix(config.target);
|
|
454
|
-
logger.info(`${targetPrefix} On-chain execution using
|
|
454
|
+
logger.info(`${targetPrefix} On-chain execution using 5IVE SDK`);
|
|
455
455
|
try {
|
|
456
456
|
// Show configuration
|
|
457
457
|
console.log('\n' + section('Execution Configuration'));
|
|
@@ -504,8 +504,8 @@ async function executeOnChain(inputFile, options, context, config) {
|
|
|
504
504
|
logger.debug(`Could not fetch VM fees: ${e instanceof Error ? e.message : String(e)}`);
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
// Execute using
|
|
508
|
-
const spinner = ora('Executing on-chain via
|
|
507
|
+
// Execute using 5IVE SDK
|
|
508
|
+
const spinner = ora('Executing on-chain via 5IVE SDK...').start();
|
|
509
509
|
const executeOptions = {
|
|
510
510
|
debug: options.debug || context.options.debug || false,
|
|
511
511
|
network: config.target,
|
|
@@ -635,7 +635,7 @@ function displayOnChainExecutionResult(result, options, logger) {
|
|
|
635
635
|
if (result.logs && result.logs.length > 0) {
|
|
636
636
|
console.log('\n' + section('Logs'));
|
|
637
637
|
result.logs.forEach((log) => {
|
|
638
|
-
// Filter out system logs and show only
|
|
638
|
+
// Filter out system logs and show only 5IVE VM logs
|
|
639
639
|
if (log.includes('Five') || log.includes('success') || log.includes('error')) {
|
|
640
640
|
console.log(` ${log}`);
|
|
641
641
|
}
|