@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.
- package/README.md +65 -65
- package/dist/commands/auth/login.js +5 -5
- package/dist/commands/auth/status.js +2 -2
- package/dist/commands/plugin/init.js +7 -2
- package/dist/commands/plugin/refresh-key.js +2 -2
- package/dist/templates/OVERVIEW.md +58 -0
- package/dist/templates/common/.claude/commands/commit.md +13 -0
- package/dist/templates/common/.env +2 -0
- package/dist/templates/common/.gitignore.eta +6 -0
- package/dist/templates/common/.spec/ARCHITECTURE.md +193 -0
- package/dist/templates/common/LICENSE.md.eta +21 -0
- package/dist/templates/common/PRIVACY.md.eta +47 -0
- package/dist/templates/typescript/.editorconfig +15 -0
- package/dist/templates/typescript/.typesafe-i18n.json +8 -0
- package/dist/templates/typescript/README.md.eta +21 -0
- package/dist/templates/typescript/biome.json.eta +32 -0
- package/dist/templates/typescript/package.json.eta +57 -0
- package/dist/templates/typescript/src/README.md.eta +24 -0
- package/dist/templates/typescript/src/i18n/README.md +29 -0
- package/dist/templates/typescript/src/i18n/en-US/README.md +12 -0
- package/dist/templates/typescript/src/i18n/en-US/index.ts.eta +13 -0
- package/dist/templates/typescript/src/i18n/formatters.ts.eta +12 -0
- package/dist/templates/typescript/src/i18n/i18n-node.ts.eta +31 -0
- package/dist/templates/typescript/src/i18n/i18n-types.ts.eta +79 -0
- package/dist/templates/typescript/src/i18n/i18n-util.async.ts.eta +33 -0
- package/dist/templates/typescript/src/i18n/i18n-util.sync.ts.eta +26 -0
- package/dist/templates/typescript/src/i18n/i18n-util.ts.eta +63 -0
- package/dist/templates/typescript/src/i18n/zh-Hans/README.md +12 -0
- package/dist/templates/typescript/src/i18n/zh-Hans/index.ts.eta +13 -0
- package/dist/templates/typescript/src/index.ts.eta +25 -0
- package/dist/templates/typescript/src/tools/README.md +18 -0
- package/dist/templates/typescript/src/tools/demo.ts.eta +29 -0
- package/dist/templates/typescript/test/README.md +15 -0
- package/dist/templates/typescript/test/index.test.ts.eta +65 -0
- package/dist/templates/typescript/tsconfig.json.eta +20 -0
- package/dist/templates/typescript/tsdown.config.ts.eta +11 -0
- package/oclif.manifest.json +1 -1
- 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
|
+
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@choiceopen/automation-plugin-cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "A command-line utility for building and publishing Choiceform
|
|
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
|
-
"
|
|
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
|
-
"
|
|
40
|
-
"cap"
|
|
39
|
+
"atomemo"
|
|
41
40
|
],
|
|
42
|
-
"bin": "
|
|
41
|
+
"bin": "atomemo",
|
|
43
42
|
"commands": "./dist/commands",
|
|
44
|
-
"dirname": "
|
|
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.
|
|
58
|
-
"@inquirer/confirm": "^6.0.
|
|
59
|
-
"@inquirer/input": "^5.0.
|
|
60
|
-
"@inquirer/select": "^5.0.
|
|
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.
|
|
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.
|
|
79
|
+
"oclif": "^4.22.65",
|
|
81
80
|
"shx": "^0.4.0",
|
|
82
81
|
"ts-node": "^10.9.2",
|
|
83
82
|
"typescript": "^5.9.3"
|