Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zk lightnet logs command implementation. #520

Merged
merged 10 commits into from
Nov 29, 2023
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.15.1] - 2023-11-XX

### Added

- Lightnet sub-commands implementation (`logs`). [#520](https://github.com/o1-labs/zkapp-cli/pull/520)

## [0.15.0] - 2023-11-07

### Changed
### Added

- Lightnet sub-commands implementation (start/stop/status). [#510](https://github.com/o1-labs/zkapp-cli/pull/510)
- Lightnet sub-commands implementation (`start`/`stop`/`status`). [#510](https://github.com/o1-labs/zkapp-cli/pull/510)

## [0.14.1] - 2023-11-03

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zkapp-cli",
"version": "0.15.0",
"version": "0.15.1",
"description": "CLI to create zkApps (zero-knowledge apps) for Mina Protocol",
"homepage": "https://github.com/o1-labs/zkapp-cli/",
"keywords": [
Expand Down
43 changes: 39 additions & 4 deletions src/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { deploy } from '../lib/deploy.js';
import { example } from '../lib/example.js';
import { file } from '../lib/file.js';
import {
lightnetFollowLogs,
lightnetSaveLogs,
lightnetStart,
lightnetStatus,
startLightnet,
stopLightnet,
lightnetStop,
} from '../lib/lightnet.js';
import { project } from '../lib/project.js';
import system from '../lib/system.js';
Expand Down Expand Up @@ -193,7 +195,7 @@ yargs(hideBin(process.argv))
},
...commonOptions,
},
async (argv) => await startLightnet(argv)
async (argv) => await lightnetStart(argv)
)
.command(
['stop [save-logs] [clean-up] [debug]'],
Expand All @@ -219,7 +221,7 @@ yargs(hideBin(process.argv))
},
...commonOptions,
},
async (argv) => await stopLightnet(argv)
async (argv) => await lightnetStop(argv)
)
.command(
['status [debug]'],
Expand All @@ -233,6 +235,39 @@ yargs(hideBin(process.argv))
debug: argv.debug,
})
)
.command(
['logs <sub-command> [options]'],
'Handle the lightweight Mina blockchain network Docker container processes logs.',
(yargs) => {
yargs
.command(
['save [debug]'],
'Save the lightweight Mina blockchain network Docker container processes logs to the host file system.',
{
...commonOptions,
},
async (argv) => await lightnetSaveLogs(argv)
)
.command(
['follow [process] [debug]'],
'Follow one of the lightweight Mina blockchain network Docker container processes logs.',
{
process: {
alias: 'p',
demand: false,
string: true,
hidden: false,
choices: Object.values(Constants.lightnetProcessName),
description:
'The name of the Docker container process to follow the logs of.',
},
...commonOptions,
},
async (argv) => await lightnetFollowLogs(argv)
)
.demandCommand();
}
)
.demandCommand();
}
)
Expand Down
15 changes: 14 additions & 1 deletion src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import path from 'path';
* @typedef {'fast' | 'real'} LightnetType
* @typedef {'none' | 'full'} LightnetProofLevel
* @typedef {'o1js-main' | 'berkeley' | 'develop'} LightnetMinaBranch
* @typedef {{ archiveNodeApi: string, minaArchive: string, minaSingleNodeDaemon: string, minaFish1: string, minaFollowing1: string, minaSeed1: string, minaSnarkCoordinator1: string, minaSnarkWorker1: string, minaWhale1: string, minaWhale2: string }} LightnetProcessName
*
* @type {{ uiTypes: UiType[], exampleTypes: ExampleType[], feePayerCacheDir: string, lightnetWorkDir: string, lightnetModes: LightnetMode[], lightnetTypes: LightnetType[], lightnetProofLevels: LightnetProofLevel[], lightnetMinaBranches: LightnetMinaBranch[] }}
* @type {{ uiTypes: UiType[], exampleTypes: ExampleType[], feePayerCacheDir: string, lightnetWorkDir: string, lightnetModes: LightnetMode[], lightnetTypes: LightnetType[], lightnetProofLevels: LightnetProofLevel[], lightnetMinaBranches: LightnetMinaBranch[], lightnetProcessName: LightnetProcessName }}
*/
const Constants = Object.freeze({
uiTypes: ['next', 'svelte', 'nuxt', 'empty', 'none'],
Expand All @@ -20,6 +21,18 @@ const Constants = Object.freeze({
lightnetTypes: ['fast', 'real'],
lightnetProofLevels: ['none', 'full'],
lightnetMinaBranches: ['o1js-main', 'berkeley', 'develop'],
lightnetProcessName: Object.freeze({
archiveNodeApi: 'Archive-Node-API application',
minaArchive: 'Mina Archive process',
minaSingleNodeDaemon: 'Mina multi-purpose Daemon',
minaFish1: 'Fish BP #1',
minaFollowing1: 'Non-consensus node #1',
minaSeed1: 'Seed node #1',
minaSnarkCoordinator1: 'SNARK coordinator #1',
minaSnarkWorker1: 'SNARK worker #1',
minaWhale1: 'Whale BP #1',
minaWhale2: 'Whale BP #2',
}),
});

export default Constants;
Loading