@asterai/cli 0.1.1 → 0.1.3

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 CHANGED
@@ -20,7 +20,7 @@ $ npm install -g @asterai/cli
20
20
  $ asterai COMMAND
21
21
  running command...
22
22
  $ asterai (--version)
23
- @asterai/cli/0.1.1 linux-x64 node-v20.12.2
23
+ @asterai/cli/0.1.3 linux-x64 node-v20.12.2
24
24
  $ asterai --help [COMMAND]
25
25
  USAGE
26
26
  $ asterai COMMAND
@@ -53,7 +53,7 @@ EXAMPLES
53
53
  $ asterai auth
54
54
  ```
55
55
 
56
- _See code: [src/commands/auth.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.1/src/commands/auth.ts)_
56
+ _See code: [src/commands/auth.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.3/src/commands/auth.ts)_
57
57
 
58
58
  ## `asterai build [INPUT]`
59
59
 
@@ -73,7 +73,7 @@ EXAMPLES
73
73
  $ asterai build
74
74
  ```
75
75
 
76
- _See code: [src/commands/build.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.1/src/commands/build.ts)_
76
+ _See code: [src/commands/build.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.3/src/commands/build.ts)_
77
77
 
78
78
  ## `asterai codegen`
79
79
 
@@ -94,7 +94,7 @@ EXAMPLES
94
94
  $ asterai codegen
95
95
  ```
96
96
 
97
- _See code: [src/commands/codegen.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.1/src/commands/codegen.ts)_
97
+ _See code: [src/commands/codegen.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.3/src/commands/codegen.ts)_
98
98
 
99
99
  ## `asterai deploy [INPUT]`
100
100
 
@@ -117,7 +117,7 @@ EXAMPLES
117
117
  $ asterai deploy --app 66a46b12-b1a7-4b72-a64a-0e4fe21902b6
118
118
  ```
119
119
 
120
- _See code: [src/commands/deploy.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.1/src/commands/deploy.ts)_
120
+ _See code: [src/commands/deploy.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.3/src/commands/deploy.ts)_
121
121
 
122
122
  ## `asterai help [COMMAND]`
123
123
 
@@ -154,5 +154,5 @@ EXAMPLES
154
154
  $ asterai init project-name
155
155
  ```
156
156
 
157
- _See code: [src/commands/init.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.1/src/commands/init.ts)_
157
+ _See code: [src/commands/init.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.1.3/src/commands/init.ts)_
158
158
  <!-- commandsstop -->
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "plugin",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "author": "asterai",
6
+ "license": "MIT",
7
+ "scripts": {
8
+ "auth": "asterai auth",
9
+ "codegen": "asterai codegen",
10
+ "build": "asterai build",
11
+ "deploy": "asterai deploy"
12
+ },
13
+ "type": "module",
14
+ "devDependencies": {
15
+ "@asterai/sdk": "0.1.3"
16
+ },
17
+ "peerDependencies": {
18
+ "assemblyscript": "0.27.27"
19
+ }
20
+ }
@@ -0,0 +1,9 @@
1
+ name: plugin
2
+ functions:
3
+ - name: orderBurger
4
+ description: >-
5
+ orders a burger to be delivered to the specified address
6
+ arguments:
7
+ - name: address
8
+ type: string
9
+ description: the address to deliver the burger to
@@ -0,0 +1,7 @@
1
+ import { OrderBurgerArgs } from "./generated/OrderBurgerArgs";
2
+ export * from "@asterai/sdk/exports";
3
+
4
+ export function orderBurger(args: OrderBurgerArgs): string {
5
+ // TODO: make http call to burger API.
6
+ return `burger delivered to ${args.address}`;
7
+ }
package/bin/dev.js CHANGED
File without changes
@@ -27,11 +27,11 @@ const ManifestFunctionArgumentSchema = z.object({
27
27
  const ManifestFunctionSchema = z.object({
28
28
  name: z.string(),
29
29
  description: z.string(),
30
- arguments: z.array(ManifestFunctionArgumentSchema),
30
+ arguments: z.array(ManifestFunctionArgumentSchema).optional(),
31
31
  });
32
32
  const ManifestSchema = z.object({
33
33
  name: z.string(),
34
- functions: z.array(ManifestFunctionSchema),
34
+ functions: z.array(ManifestFunctionSchema).optional(),
35
35
  });
36
36
  export default class Codegen extends Command {
37
37
  static args = {};
@@ -55,6 +55,9 @@ export default class Codegen extends Command {
55
55
  const baseDir = path.dirname(manifestPath);
56
56
  const outDir = path.join(baseDir, flags.outputDir);
57
57
  const manifest = ManifestSchema.parse(YAML.parse(fs.readFileSync(manifestPath, "utf8")));
58
+ if (!manifest.functions) {
59
+ return;
60
+ }
58
61
  if (!fs.existsSync(outDir)) {
59
62
  fs.mkdirSync(outDir, { recursive: true });
60
63
  }
@@ -63,7 +66,7 @@ export default class Codegen extends Command {
63
66
  const fileName = `${className}.ts`;
64
67
  const filePath = path.join(outDir, fileName);
65
68
  const stream = fs.createWriteStream(filePath);
66
- writeFunctionFile(className, func.arguments, stream);
69
+ writeFunctionFile(className, func.arguments ?? [], stream);
67
70
  }
68
71
  }
69
72
  }
@@ -198,5 +198,5 @@
198
198
  ]
199
199
  }
200
200
  },
201
- "version": "0.1.1"
201
+ "version": "0.1.3"
202
202
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@asterai/cli",
3
3
  "description": "CLI for building and deploying AsterAI plugins",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "author": "asterai <support@asterai.io>",
6
6
  "repository": "asterai-io/asterai-sdk",
7
7
  "homepage": "https://github.com/asterai-io/asterai-sdk",
@@ -13,18 +13,6 @@
13
13
  "license": "UNLICENSED",
14
14
  "main": "dist/index.js",
15
15
  "type": "module",
16
- "scripts": {
17
- "prepare": "cd .. && husky cli/.husky",
18
- "build": "shx rm -rf dist && tsc -b",
19
- "lint": "eslint . --ext .ts",
20
- "postpack": "shx rm -f oclif.manifest.json",
21
- "posttest": "pnpm run lint",
22
- "prepack": "oclif manifest && oclif readme",
23
- "test": "mocha --forbid-only \"test/**/*.test.ts\"",
24
- "version": "oclif readme && git add README.md",
25
- "format": "prettier --write .",
26
- "format-staged": "pretty-quick --staged"
27
- },
28
16
  "bin": {
29
17
  "asterai": "./bin/run.js"
30
18
  },
@@ -35,7 +23,8 @@
35
23
  "files": [
36
24
  "/bin",
37
25
  "/dist",
38
- "/oclif.manifest.json"
26
+ "/oclif.manifest.json",
27
+ "/asterai-init-plugin"
39
28
  ],
40
29
  "oclif": {
41
30
  "bin": "asterai",
@@ -77,5 +66,14 @@
77
66
  "shx": "^0.3.3",
78
67
  "ts-node": "^10",
79
68
  "typescript": "^5"
69
+ },
70
+ "scripts": {
71
+ "build": "shx rm -rf dist && tsc -b",
72
+ "lint": "eslint . --ext .ts",
73
+ "posttest": "pnpm run lint",
74
+ "test": "mocha --forbid-only \"test/**/*.test.ts\"",
75
+ "version": "oclif readme && git add README.md",
76
+ "format": "prettier --write .",
77
+ "format-staged": "pretty-quick --staged"
80
78
  }
81
- }
79
+ }