@cartesi/cli 2.0.0-alpha.8 → 2.0.0-alpha.9

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.
@@ -1,7 +1,3 @@
1
1
  import { Command } from "@commander-js/extra-typings";
2
- export declare const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
3
- export declare const createCreateCommand: () => Command<[string], {
4
- template: "cpp" | "cpp-low-level" | "go" | "javascript" | "lua" | "python" | "ruby" | "rust" | "typescript";
5
- branch: string;
6
- }, {}>;
2
+ export declare const createCreateCommand: () => Command<[], {}, {}>;
7
3
  //# sourceMappingURL=create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAM9D,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAmC5D,eAAO,MAAM,mBAAmB;;;MA0B/B,CAAC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,eAAO,MAAM,mBAAmB,2BAU/B,CAAC"}
@@ -1,51 +1,9 @@
1
- import { Command, Option } from "@commander-js/extra-typings";
1
+ import { Command } from "@commander-js/extra-typings";
2
2
  import chalk from "chalk";
3
- import { downloadTemplate } from "giget";
4
- import ora from "ora";
5
- export const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
6
- const TEMPLATES = [
7
- "cpp",
8
- "cpp-low-level",
9
- "go",
10
- "javascript",
11
- "lua",
12
- "python",
13
- "ruby",
14
- "rust",
15
- "typescript",
16
- ];
17
- const download = async (template, branch, out) => {
18
- const cartesiProvider = async (input) => {
19
- return {
20
- name: "cartesi",
21
- subdir: input,
22
- url: "https://github.com/cartesi/application-templates",
23
- tar: `https://codeload.github.com/cartesi/application-templates/tar.gz/refs/heads/${branch}`,
24
- };
25
- };
26
- const input = `cartesi:${template}`;
27
- return downloadTemplate(input, {
28
- dir: out,
29
- providers: { cartesi: cartesiProvider },
30
- });
31
- };
32
3
  export const createCreateCommand = () => {
33
4
  return new Command("create")
34
- .argument("<name>", "application and directory name")
35
- .addOption(new Option("-t, --template <template>", "template name to use")
36
- .choices(TEMPLATES)
37
- .makeOptionMandatory())
38
- .option("-b, --branch <branch>", "cartesi/application-templates repository branch name to use", DEFAULT_TEMPLATES_BRANCH)
39
- .action(async (name, { branch, template }) => {
40
- const spinner = ora("Creating application...").start();
41
- try {
42
- const { dir } = await download(template, branch, name);
43
- spinner.succeed(`Application created at ${chalk.cyan(dir)}`);
44
- }
45
- catch (e) {
46
- spinner.fail(e instanceof Error
47
- ? `Error creating application: ${chalk.red(e.message)}`
48
- : String(e));
49
- }
5
+ .summary("DEPRECATED: use 'rollups create' instead")
6
+ .action(async () => {
7
+ console.warn(chalk.yellow("create command is deprecated, use 'rollups create' instead"));
50
8
  });
51
9
  };
@@ -0,0 +1,7 @@
1
+ import { Command } from "@commander-js/extra-typings";
2
+ export declare const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
3
+ export declare const createCreateCommand: () => Command<[string], {
4
+ template: "cpp" | "cpp-low-level" | "go" | "javascript" | "lua" | "python" | "ruby" | "rust" | "typescript";
5
+ branch: string;
6
+ }, {}>;
7
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/rollups/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAK9D,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAc5D,eAAO,MAAM,mBAAmB;;;MA+B/B,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { Command, Option } from "@commander-js/extra-typings";
2
+ import chalk from "chalk";
3
+ import ora from "ora";
4
+ import { download } from "../../template.js";
5
+ export const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
6
+ const TEMPLATES = [
7
+ "cpp",
8
+ "cpp-low-level",
9
+ "go",
10
+ "javascript",
11
+ "lua",
12
+ "python",
13
+ "ruby",
14
+ "rust",
15
+ "typescript",
16
+ ];
17
+ export const createCreateCommand = () => {
18
+ return new Command("create")
19
+ .argument("<name>", "application and directory name")
20
+ .addOption(new Option("-t, --template <template>", "template name to use")
21
+ .choices(TEMPLATES)
22
+ .makeOptionMandatory())
23
+ .option("-b, --branch <branch>", "cartesi/application-templates repository branch name to use", DEFAULT_TEMPLATES_BRANCH)
24
+ .action(async (name, { branch, template }) => {
25
+ const spinner = ora("Creating application...").start();
26
+ try {
27
+ const { dir } = await download("rollups", template, branch, name);
28
+ spinner.succeed(`Application created at ${chalk.cyan(dir)}`);
29
+ }
30
+ catch (e) {
31
+ spinner.fail(e instanceof Error
32
+ ? `Error creating application: ${chalk.red(e.message)}`
33
+ : String(e));
34
+ }
35
+ });
36
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"rollups.d.ts","sourceRoot":"","sources":["../../src/commands/rollups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAOtD,eAAO,MAAM,oBAAoB;;MAgBhC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CACvC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAClD,CAAC"}
1
+ {"version":3,"file":"rollups.d.ts","sourceRoot":"","sources":["../../src/commands/rollups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAQtD,eAAO,MAAM,oBAAoB;;MAiBhC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CACvC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAClD,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { Command } from "@commander-js/extra-typings";
2
+ import { createCreateCommand } from "./rollups/create.js";
2
3
  import { createDeployCommand } from "./rollups/deploy.js";
3
4
  import { createLogsCommand } from "./rollups/logs.js";
4
5
  import { createStartCommand } from "./rollups/start.js";
@@ -15,5 +16,6 @@ export const createRollupsCommand = () => {
15
16
  command.addCommand(createStatusCommand());
16
17
  command.addCommand(createStopCommand());
17
18
  command.addCommand(createDeployCommand());
19
+ command.addCommand(createCreateCommand());
18
20
  return command;
19
21
  };
@@ -6,7 +6,7 @@ CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-info}"
6
6
  # features
7
7
  CARTESI_FEATURE_INPUT_READER_ENABLED="${CARTESI_FEATURE_INPUT_READER_ENABLED:-true}"
8
8
  CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED="${CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED:-true}"
9
- CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED="${CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED:-false}"
9
+ CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED="${CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED:-true}"
10
10
 
11
11
  # rollups
12
12
  CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES="${CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES:-3}"
package/dist/config.d.ts CHANGED
@@ -29,8 +29,8 @@ export declare class RequiredFieldError extends Error {
29
29
  export declare class InvalidStringArrayError extends Error {
30
30
  constructor();
31
31
  }
32
- export declare const DEFAULT_SDK_VERSION = "0.12.0-alpha.13";
33
- export declare const DEFAULT_SDK_IMAGE = "cartesi/sdk:0.12.0-alpha.13";
32
+ export declare const DEFAULT_SDK_VERSION = "0.12.0-alpha.15";
33
+ export declare const DEFAULT_SDK_IMAGE = "cartesi/sdk:0.12.0-alpha.15";
34
34
  type DriveFormat = "ext2" | "sqfs";
35
35
  export type ImageInfo = {
36
36
  cmd: string[];
package/dist/config.js CHANGED
@@ -64,7 +64,7 @@ export class InvalidStringArrayError extends Error {
64
64
  const DEFAULT_FORMAT = "ext2";
65
65
  const DEFAULT_RAM = "128Mi";
66
66
  const DEFAULT_RAM_IMAGE = "/usr/share/cartesi-machine/images/linux.bin";
67
- export const DEFAULT_SDK_VERSION = "0.12.0-alpha.13";
67
+ export const DEFAULT_SDK_VERSION = "0.12.0-alpha.15";
68
68
  export const DEFAULT_SDK_IMAGE = `cartesi/sdk:${DEFAULT_SDK_VERSION}`;
69
69
  export const defaultRootDriveConfig = () => ({
70
70
  builder: "docker",
@@ -1,6 +1,5 @@
1
1
  import { Address, Hash } from "viem";
2
2
  export type RollupsDeployment = {
3
- id: number;
4
3
  name: string;
5
4
  address: Address;
6
5
  templateHash: Hash;
@@ -1 +1 @@
1
- {"version":3,"file":"rollups.d.ts","sourceRoot":"","sources":["../../src/exec/rollups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGrC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACvB,UAAU,aAAa,KACxB,OAAO,CAAC,iBAAiB,EAAE,CAwB7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACjC,UAAU,aAAa,KACxB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CASvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,OAAO,GAAG,SAAS,CAGzE,CAAC"}
1
+ {"version":3,"file":"rollups.d.ts","sourceRoot":"","sources":["../../src/exec/rollups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGrC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACvB,UAAU,aAAa,KACxB,OAAO,CAAC,iBAAiB,EAAE,CAuB7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACjC,UAAU,aAAa,KACxB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CASvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,OAAO,GAAG,SAAS,CAGzE,CAAC"}
@@ -14,7 +14,6 @@ export const getDeployments = async (options) => {
14
14
  "list",
15
15
  ]);
16
16
  return JSON.parse(stdout).map((deployment) => ({
17
- id: deployment.id,
18
17
  name: deployment.name,
19
18
  address: deployment.iapplication_address,
20
19
  templateHash: deployment.template_hash,
@@ -0,0 +1,3 @@
1
+ import { DownloadTemplateResult } from "giget";
2
+ export declare const download: (framework: string, template: string, branch: string, out: string) => Promise<DownloadTemplateResult>;
3
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAoB,MAAM,OAAO,CAAC;AAEjE,eAAO,MAAM,QAAQ,GACjB,WAAW,MAAM,EACjB,UAAU,MAAM,EAChB,QAAQ,MAAM,EACd,KAAK,MAAM,KACZ,OAAO,CAAC,sBAAsB,CAehC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { downloadTemplate } from "giget";
2
+ export const download = async (framework, template, branch, out) => {
3
+ const cartesiProvider = async (input) => {
4
+ return {
5
+ name: "cartesi",
6
+ subdir: `${framework}/${input}`,
7
+ url: "https://github.com/cartesi/application-templates",
8
+ tar: `https://codeload.github.com/cartesi/application-templates/tar.gz/refs/heads/${branch}`,
9
+ };
10
+ };
11
+ const input = `cartesi:${template}`;
12
+ return downloadTemplate(input, {
13
+ dir: out,
14
+ providers: { cartesi: cartesiProvider },
15
+ });
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartesi/cli",
3
- "version": "2.0.0-alpha.8",
3
+ "version": "2.0.0-alpha.9",
4
4
  "description": "Cartesi CLI",
5
5
  "author": "Danilo Tuler <tuler@pobox.com>",
6
6
  "bin": {