@choiceopen/automation-plugin-cli 0.2.0 → 0.2.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.
Files changed (38) hide show
  1. package/README.md +65 -65
  2. package/dist/commands/auth/login.js +5 -5
  3. package/dist/commands/auth/status.js +2 -2
  4. package/dist/commands/plugin/init.js +7 -2
  5. package/dist/commands/plugin/refresh-key.js +2 -2
  6. package/dist/templates/OVERVIEW.md +58 -0
  7. package/dist/templates/common/.claude/commands/commit.md +13 -0
  8. package/dist/templates/common/.env +2 -0
  9. package/dist/templates/common/.gitignore.eta +6 -0
  10. package/dist/templates/common/.spec/ARCHITECTURE.md +193 -0
  11. package/dist/templates/common/LICENSE.md.eta +21 -0
  12. package/dist/templates/common/PRIVACY.md.eta +47 -0
  13. package/dist/templates/typescript/.editorconfig +15 -0
  14. package/dist/templates/typescript/.typesafe-i18n.json +8 -0
  15. package/dist/templates/typescript/README.md.eta +21 -0
  16. package/dist/templates/typescript/biome.json.eta +32 -0
  17. package/dist/templates/typescript/package.json.eta +57 -0
  18. package/dist/templates/typescript/src/README.md.eta +24 -0
  19. package/dist/templates/typescript/src/i18n/README.md +29 -0
  20. package/dist/templates/typescript/src/i18n/en-US/README.md +12 -0
  21. package/dist/templates/typescript/src/i18n/en-US/index.ts.eta +13 -0
  22. package/dist/templates/typescript/src/i18n/formatters.ts.eta +12 -0
  23. package/dist/templates/typescript/src/i18n/i18n-node.ts.eta +31 -0
  24. package/dist/templates/typescript/src/i18n/i18n-types.ts.eta +79 -0
  25. package/dist/templates/typescript/src/i18n/i18n-util.async.ts.eta +33 -0
  26. package/dist/templates/typescript/src/i18n/i18n-util.sync.ts.eta +26 -0
  27. package/dist/templates/typescript/src/i18n/i18n-util.ts.eta +63 -0
  28. package/dist/templates/typescript/src/i18n/zh-Hans/README.md +12 -0
  29. package/dist/templates/typescript/src/i18n/zh-Hans/index.ts.eta +13 -0
  30. package/dist/templates/typescript/src/index.ts.eta +25 -0
  31. package/dist/templates/typescript/src/tools/README.md +18 -0
  32. package/dist/templates/typescript/src/tools/demo.ts.eta +29 -0
  33. package/dist/templates/typescript/test/README.md +15 -0
  34. package/dist/templates/typescript/test/index.test.ts.eta +65 -0
  35. package/dist/templates/typescript/tsconfig.json.eta +20 -0
  36. package/dist/templates/typescript/tsdown.config.ts.eta +11 -0
  37. package/oclif.manifest.json +1 -1
  38. package/package.json +13 -14
@@ -0,0 +1,65 @@
1
+ import { describe, expect, it, vi } from "vitest"
2
+
3
+ // Mock the SDK before importing anything that uses it
4
+ vi.mock("@choiceopen/automation-plugin-sdk-js", () => ({
5
+ createPlugin: vi.fn(() => ({
6
+ addCredential: vi.fn(),
7
+ addTool: vi.fn(),
8
+ addModel: vi.fn(),
9
+ run: vi.fn(),
10
+ })),
11
+ }))
12
+
13
+ // Mock i18n
14
+ vi.mock("./i18n/i18n-node", () => ({
15
+ t: vi.fn((key: string) => key),
16
+ }))
17
+
18
+ vi.mock("./i18n/i18n-util", () => ({
19
+ locales: ["en-US"],
20
+ }))
21
+
22
+ vi.mock("./i18n/i18n-util.async", () => ({
23
+ loadAllLocalesAsync: vi.fn(),
24
+ }))
25
+
26
+ import { createPlugin } from "@choiceopen/automation-plugin-sdk-js"
27
+
28
+ describe("createPlugin", () => {
29
+ it("should create a plugin object", () => {
30
+ const plugin = createPlugin({
31
+ name: "test-plugin",
32
+ display_name: {en_US: "Test Plugin"},
33
+ description: {en_US: "A test plugin"},
34
+ icon: "🧪",
35
+ author: "Test",
36
+ email: "test@test.com",
37
+ version: "1.0.0",
38
+ repo: "https://github.com/test/test",
39
+ locales: ["en"],
40
+ transporterOptions: {},
41
+ })
42
+
43
+ expect(plugin).toBeDefined()
44
+ expect(plugin).toHaveProperty("run")
45
+ expect(typeof plugin.run).toBe("function")
46
+ })
47
+
48
+ it("should be able to call run() method", () => {
49
+ const plugin = createPlugin({
50
+ name: "test-plugin",
51
+ display_name: {en_US: "Test Plugin"},
52
+ description: {en_US: "A test plugin"},
53
+ icon: "🧪",
54
+ author: "Test",
55
+ email: "test@test.com",
56
+ version: "1.0.0",
57
+ repo: "https://github.com/test/test",
58
+ locales: ["en"],
59
+ transporterOptions: {},
60
+ })
61
+
62
+ expect(() => plugin.run()).not.toThrow()
63
+ expect(plugin.run).toHaveBeenCalledTimes(1)
64
+ })
65
+ })
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "lib": ["es2023"],
5
+ "moduleDetection": "force",
6
+ "module": "preserve",
7
+ "moduleResolution": "bundler",
8
+ "resolveJsonModule": true,
9
+ "types": ["bun"],
10
+ "strict": true,
11
+ "noUnusedLocals": true,
12
+ "declaration": true,
13
+ "emitDeclarationOnly": true,
14
+ "esModuleInterop": true,
15
+ "isolatedModules": true,
16
+ "verbatimModuleSyntax": true,
17
+ "skipLibCheck": true
18
+ },
19
+ "include": ["src"]
20
+ }
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from "tsdown"
2
+
3
+ export default defineConfig({
4
+ dts: true,
5
+ entry: ["src/index.ts"],
6
+ exports: {
7
+ devExports: "development",
8
+ },
9
+ format: "esm",
10
+ platform: "neutral",
11
+ })
@@ -450,5 +450,5 @@
450
450
  ]
451
451
  }
452
452
  },
453
- "version": "0.2.0"
453
+ "version": "0.2.3"
454
454
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@choiceopen/automation-plugin-cli",
3
- "version": "0.2.0",
4
- "description": "A command-line utility for building and publishing Choiceform Automation Plugin.",
3
+ "version": "0.2.3",
4
+ "description": "A command-line utility for building and publishing Choiceform Atomemo Plugin.",
5
5
  "keywords": [
6
6
  "oclif"
7
7
  ],
@@ -17,7 +17,7 @@
17
17
  "main": "dist/index.js",
18
18
  "types": "dist/index.d.ts",
19
19
  "bin": {
20
- "automation": "bin/run.js",
20
+ "atomemo": "bin/run.js",
21
21
  "cap": "bin/run.js"
22
22
  },
23
23
  "files": [
@@ -26,7 +26,7 @@
26
26
  "./oclif.manifest.json"
27
27
  ],
28
28
  "scripts": {
29
- "build": "shx rm -rf dist && tsc --build",
29
+ "build": "shx rm -rf dist && tsc --build && shx cp -r src/templates dist/",
30
30
  "check": "biome check --write",
31
31
  "prepack": "oclif manifest && oclif readme",
32
32
  "postpack": "shx rm -f oclif.manifest.json",
@@ -36,12 +36,11 @@
36
36
  },
37
37
  "oclif": {
38
38
  "alias": [
39
- "automation",
40
- "cap"
39
+ "atomemo"
41
40
  ],
42
- "bin": "automation",
41
+ "bin": "atomemo",
43
42
  "commands": "./dist/commands",
44
- "dirname": "automation",
43
+ "dirname": "atomemo",
45
44
  "helpOptions": {
46
45
  "flagSortOrder": "none"
47
46
  },
@@ -54,15 +53,15 @@
54
53
  "topicSeparator": " "
55
54
  },
56
55
  "dependencies": {
57
- "@inquirer/checkbox": "^5.0.3",
58
- "@inquirer/confirm": "^6.0.3",
59
- "@inquirer/input": "^5.0.3",
60
- "@inquirer/select": "^5.0.3",
56
+ "@inquirer/checkbox": "^5.0.4",
57
+ "@inquirer/confirm": "^6.0.4",
58
+ "@inquirer/input": "^5.0.4",
59
+ "@inquirer/select": "^5.0.4",
61
60
  "@oclif/core": "^4.8.0",
62
61
  "@oclif/plugin-autocomplete": "^3.2.39",
63
62
  "@oclif/plugin-help": "^6.2.36",
64
63
  "@oclif/plugin-version": "^2.2.36",
65
- "es-toolkit": "^1.43.0",
64
+ "es-toolkit": "^1.44.0",
66
65
  "eta": "^4.5.0",
67
66
  "open": "^11.0.0",
68
67
  "ts-dedent": "^2.2.0",
@@ -77,7 +76,7 @@
77
76
  "@types/node": "20.19.27",
78
77
  "chai": "4.5.0",
79
78
  "mocha": "10.8.2",
80
- "oclif": "^4.22.63",
79
+ "oclif": "^4.22.65",
81
80
  "shx": "^0.4.0",
82
81
  "ts-node": "^10.9.2",
83
82
  "typescript": "^5.9.3"