@mimicprotocol/cli 0.0.1-rc.35 → 0.0.1-rc.36

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
@@ -1,5 +1,11 @@
1
1
  # @mimicprotocol/cli
2
2
 
3
+ ## 0.0.1-rc.36
4
+
5
+ ### Patch Changes
6
+
7
+ - 6a4fb70: rename to use functions
8
+
3
9
  ## 0.0.1-rc.35
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -27,12 +27,12 @@
27
27
 
28
28
  The `mimic` CLI is a command-line interface to:
29
29
 
30
- - Initialize a Mimic-compatible task project
31
- - Generate types from your task manifest and ABIs
32
- - Compile your AssemblyScript tasks to WebAssembly
33
- - Test your tasks
34
- - Deploy compiled tasks to IPFS and the Mimic Registry
35
- - Link tasks to a project in the Mimic explorer
30
+ - Initialize a Mimic-compatible function project
31
+ - Generate types from your function manifest and ABIs
32
+ - Compile your AssemblyScript functions to WebAssembly
33
+ - Test your functions
34
+ - Deploy compiled functions to IPFS and the Mimic Registry
35
+ - Link functions to a project in the Mimic explorer
36
36
 
37
37
  ## Setup
38
38
 
@@ -64,15 +64,15 @@ COMMANDS
64
64
  logout Remove stored credentials for a profile
65
65
  profiles List all configured authentication profiles
66
66
  codegen Generates typed interfaces for declared inputs and ABIs from your manifest.yaml file
67
- compile Compiles task
68
- test Tests your tasks
69
- deploy Uploads your compiled task artifacts to IPFS and registers it into the Mimic Registry
67
+ compile Compiles the function
68
+ test Tests your functions
69
+ deploy Uploads your compiled function artifacts to IPFS and registers it into the Mimic Registry
70
70
  init Initializes a new Mimic-compatible project structure in the specified directory
71
71
  ```
72
72
 
73
73
  ### Authentication
74
74
 
75
- Before deploying tasks, you need to authenticate with your Mimic API key:
75
+ Before deploying functions, you need to authenticate with your Mimic API key:
76
76
 
77
77
  ```bash
78
78
  # Interactive login (recommended)
@@ -9,22 +9,22 @@ const compile_1 = __importDefault(require("./compile"));
9
9
  class Build extends core_1.Command {
10
10
  async run() {
11
11
  const { flags } = await this.parse(Build);
12
- const { manifest, task, output, types, clean } = flags;
12
+ const { manifest, function: functionFile, output, types, clean } = flags;
13
13
  const codegenArgs = ['--manifest', manifest, '--output', types];
14
14
  if (clean)
15
15
  codegenArgs.push('--clean');
16
16
  await codegen_1.default.run(codegenArgs);
17
- const compileArgs = ['--task', task, '--manifest', manifest, '--output', output];
17
+ const compileArgs = ['--function', functionFile, '--manifest', manifest, '--output', output];
18
18
  await compile_1.default.run(compileArgs);
19
19
  }
20
20
  }
21
- Build.description = 'Runs code generation and then compiles the task';
21
+ Build.description = 'Runs code generation and then compiles the function';
22
22
  Build.examples = [
23
- '<%= config.bin %> <%= command.id %> --manifest ./manifest.yaml --task src/task.ts --output ./build --types ./src/types',
23
+ '<%= config.bin %> <%= command.id %> --manifest ./manifest.yaml --function src/function.ts --output ./build --types ./src/types',
24
24
  ];
25
25
  Build.flags = {
26
26
  manifest: core_1.Flags.string({ char: 'm', description: 'manifest to use', default: 'manifest.yaml' }),
27
- task: core_1.Flags.string({ char: 't', description: 'task to compile', default: 'src/task.ts' }),
27
+ function: core_1.Flags.string({ char: 'f', description: 'function to compile', default: 'src/function.ts' }),
28
28
  output: core_1.Flags.string({ char: 'o', description: 'output directory for build artifacts', default: './build' }),
29
29
  types: core_1.Flags.string({ char: 'y', description: 'output directory for generated types', default: './src/types' }),
30
30
  clean: core_1.Flags.boolean({
@@ -45,8 +45,8 @@ const log_1 = __importDefault(require("../log"));
45
45
  class Compile extends core_1.Command {
46
46
  async run() {
47
47
  const { flags } = await this.parse(Compile);
48
- const { task: taskFile, output: outputDir, manifest: manifestDir } = flags;
49
- const absTaskFile = path.resolve(taskFile);
48
+ const { function: functionFile, output: outputDir, manifest: manifestDir } = flags;
49
+ const absFunctionFile = path.resolve(functionFile);
50
50
  const absOutputDir = path.resolve(outputDir);
51
51
  if (!fs.existsSync(absOutputDir))
52
52
  fs.mkdirSync(absOutputDir, { recursive: true });
@@ -54,11 +54,11 @@ class Compile extends core_1.Command {
54
54
  const manifest = ManifestHandler_1.default.load(this, manifestDir);
55
55
  log_1.default.startAction('Compiling');
56
56
  const ascArgs = [
57
- absTaskFile,
57
+ absFunctionFile,
58
58
  '--target',
59
59
  'release',
60
60
  '--outFile',
61
- path.join(absOutputDir, 'task.wasm'),
61
+ path.join(absOutputDir, 'function.wasm'),
62
62
  '--optimize',
63
63
  '--exportRuntime',
64
64
  '--transform',
@@ -77,10 +77,10 @@ class Compile extends core_1.Command {
77
77
  console.log(`Build complete! Artifacts in ${outputDir}/`);
78
78
  }
79
79
  }
80
- Compile.description = 'Compiles task';
81
- Compile.examples = ['<%= config.bin %> <%= command.id %> --task src/task.ts --output ./output'];
80
+ Compile.description = 'Compiles function';
81
+ Compile.examples = ['<%= config.bin %> <%= command.id %> --function src/function.ts --output ./output'];
82
82
  Compile.flags = {
83
- task: core_1.Flags.string({ char: 't', description: 'task to compile', default: 'src/task.ts' }),
83
+ function: core_1.Flags.string({ char: 'f', description: 'function to compile', default: 'src/function.ts' }),
84
84
  manifest: core_1.Flags.string({ char: 'm', description: 'manifest to validate', default: 'manifest.yaml' }),
85
85
  output: core_1.Flags.string({ char: 'o', description: 'output directory', default: './build' }),
86
86
  };
@@ -59,7 +59,7 @@ class Deploy extends authenticate_1.default {
59
59
  this.error('Code generation failed', { code: 'CodegenError', suggestions: ['Fix manifest and ABI files'] });
60
60
  const compile = (0, packageManager_1.execBinCommand)('mimic', ['compile', '--output', fullInputDir], process.cwd());
61
61
  if (compile.status !== 0)
62
- this.error('Compilation failed', { code: 'BuildError', suggestions: ['Check the task source code'] });
62
+ this.error('Compilation failed', { code: 'BuildError', suggestions: ['Check the function source code'] });
63
63
  }
64
64
  log_1.default.startAction('Validating');
65
65
  if (!fs.existsSync(fullInputDir))
@@ -67,7 +67,7 @@ class Deploy extends authenticate_1.default {
67
67
  code: 'Directory Not Found',
68
68
  suggestions: ['Use the --input flag to specify the correct path'],
69
69
  });
70
- const neededFiles = ['manifest.json', 'task.wasm'].map((file) => (0, path_1.join)(fullInputDir, file));
70
+ const neededFiles = ['manifest.json', 'function.wasm'].map((file) => (0, path_1.join)(fullInputDir, file));
71
71
  for (const file of neededFiles) {
72
72
  if (!fs.existsSync(file))
73
73
  this.error(`Could not find ${file}`, {
@@ -83,12 +83,12 @@ class Deploy extends authenticate_1.default {
83
83
  fs.mkdirSync(fullOutputDir, { recursive: true });
84
84
  fs.writeFileSync((0, path_1.join)(fullOutputDir, 'CID.json'), JSON.stringify({ CID }, null, 2));
85
85
  console.log(`CID saved at ${log_1.default.highlightText(fullOutputDir)}`);
86
- console.log(`Task deployed!`);
86
+ console.log(`Function deployed!`);
87
87
  }
88
88
  async uploadToRegistry(files, credentials, registryUrl) {
89
89
  try {
90
90
  const form = filesToForm(files);
91
- const { data } = await axios_1.default.post(`${registryUrl}/tasks`, form, {
91
+ const { data } = await axios_1.default.post(`${registryUrl}/functions`, form, {
92
92
  headers: {
93
93
  'x-api-key': credentials.apiKey,
94
94
  'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`,
@@ -115,7 +115,7 @@ class Deploy extends authenticate_1.default {
115
115
  this.error(`${message} - ${err.message}`, { code: `${statusCode} Error`, suggestions: errors_1.GENERIC_SUGGESTION });
116
116
  }
117
117
  }
118
- Deploy.description = 'Uploads your compiled task artifacts to IPFS and registers it into the Mimic Registry';
118
+ Deploy.description = 'Uploads your compiled function artifacts to IPFS and registers it into the Mimic Registry';
119
119
  Deploy.examples = [
120
120
  '<%= config.bin %> <%= command.id %> --input ./dist --output ./dist',
121
121
  '<%= config.bin %> <%= command.id %> --profile staging',
@@ -73,7 +73,7 @@ class Login extends authenticate_1.default {
73
73
  console.log(`✓ Credentials saved for profile ${log_1.default.highlightText(profileName)}`);
74
74
  console.log(` Location: ${log_1.default.highlightText('~/.mimic/credentials')}`);
75
75
  console.log();
76
- console.log(`You can now deploy tasks using: ${log_1.default.highlightText('mimic deploy')}`);
76
+ console.log(`You can now deploy functions using: ${log_1.default.highlightText('mimic deploy')}`);
77
77
  if (profileName !== CredentialsManager_1.CredentialsManager.getDefaultProfileName()) {
78
78
  console.log(`Or with your profile: ${log_1.default.highlightText(`mimic deploy --profile ${profileName}`)}`);
79
79
  }
@@ -54,10 +54,10 @@ class Test extends core_1.Command {
54
54
  this.exit(result.status ?? 1);
55
55
  }
56
56
  }
57
- Test.description = 'Runs task tests';
57
+ Test.description = 'Runs function tests';
58
58
  Test.examples = ['<%= config.bin %> <%= command.id %> --directory ./'];
59
59
  Test.flags = {
60
- directory: core_1.Flags.string({ char: 'd', description: 'task directory', default: './' }),
60
+ directory: core_1.Flags.string({ char: 'd', description: 'function directory', default: './' }),
61
61
  'skip-compile': core_1.Flags.boolean({ description: 'skip codegen and compile steps' }),
62
62
  };
63
63
  exports.default = Test;
@@ -17,7 +17,7 @@ exports.default = {
17
17
  ` ${inputsMapping}`,
18
18
  '}',
19
19
  '',
20
- '// The class name is intentionally lowercase and plural to resemble a namespace when used in a task.',
20
+ '// The class name is intentionally lowercase and plural to resemble a namespace when used in a function.',
21
21
  'export class inputs {',
22
22
  ` ${inputsClass}`,
23
23
  '}',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mimicprotocol/cli",
3
- "version": "0.0.1-rc.35",
3
+ "version": "0.0.1-rc.36",
4
4
  "license": "GPL-3.0",
5
5
  "private": false,
6
6
  "type": "commonjs",