@boltic/cli 1.0.6-beta.11 → 1.0.6-beta.2
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/.claude/settings.local.json +16 -0
- package/README.md +0 -1
- package/commands/integration.js +1 -128
- package/helper/folder.js +4 -19
- package/package.json +2 -9
- package/templates/schemas.js +5 -23
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
> A powerful CLI tool for creating, managing, and publishing Boltic integrations.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@boltic/cli)
|
|
6
|
-
[](https://github.com/<your-username>/<your-repo>)
|
|
7
6
|
[](./LICENSE)
|
|
8
7
|
|
|
9
8
|
---
|
package/commands/integration.js
CHANGED
|
@@ -50,10 +50,6 @@ const commands = {
|
|
|
50
50
|
description: "Show detailed information about an integration",
|
|
51
51
|
action: handleStatus,
|
|
52
52
|
},
|
|
53
|
-
test: {
|
|
54
|
-
description: "Run tests for the integration",
|
|
55
|
-
action: handleTest,
|
|
56
|
-
},
|
|
57
53
|
help: {
|
|
58
54
|
description: "Show help for integration commands",
|
|
59
55
|
action: showHelp,
|
|
@@ -151,19 +147,6 @@ async function handleSync(args) {
|
|
|
151
147
|
if (fs.existsSync(specPath)) {
|
|
152
148
|
const specContent = JSON.parse(fs.readFileSync(specPath, "utf8"));
|
|
153
149
|
// Update integration with spec.json content
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
specContent.trigger_type &&
|
|
157
|
-
specContent.trigger_type !== "CloudTrigger"
|
|
158
|
-
) {
|
|
159
|
-
console.error(
|
|
160
|
-
chalk.red(
|
|
161
|
-
`Error: Invalid trigger_type "${specContent.trigger_type}". It should be "CloudTrigger" or null.`
|
|
162
|
-
)
|
|
163
|
-
);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
150
|
const updatedIntegration = await updateIntegration(
|
|
168
151
|
apiUrl,
|
|
169
152
|
token,
|
|
@@ -262,19 +245,6 @@ async function handlePublish(args) {
|
|
|
262
245
|
if (fs.existsSync(specPath)) {
|
|
263
246
|
const specContent = JSON.parse(fs.readFileSync(specPath, "utf8"));
|
|
264
247
|
// Update integration with spec.json content
|
|
265
|
-
|
|
266
|
-
if (
|
|
267
|
-
specContent.trigger_type &&
|
|
268
|
-
specContent.trigger_type !== "CloudTrigger"
|
|
269
|
-
) {
|
|
270
|
-
console.error(
|
|
271
|
-
chalk.red(
|
|
272
|
-
`Error: Invalid trigger_type "${specContent.trigger_type}". It should be "CloudTrigger" or null.`
|
|
273
|
-
)
|
|
274
|
-
);
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
248
|
const updatedIntegration = await updateIntegration(
|
|
279
249
|
apiUrl,
|
|
280
250
|
token,
|
|
@@ -604,10 +574,7 @@ async function handleCreate() {
|
|
|
604
574
|
);
|
|
605
575
|
|
|
606
576
|
// Create folder structure with the integration name
|
|
607
|
-
await createIntegrationFolderStructure(
|
|
608
|
-
integration,
|
|
609
|
-
create_catalogue
|
|
610
|
-
);
|
|
577
|
+
await createIntegrationFolderStructure(integration);
|
|
611
578
|
|
|
612
579
|
// Also share Documentation URL to the user: https://docs.boltic.io/docs/integration-builder/develop/boilerplate
|
|
613
580
|
const documentationUrl =
|
|
@@ -1033,100 +1000,6 @@ async function handleStatus() {
|
|
|
1033
1000
|
}
|
|
1034
1001
|
}
|
|
1035
1002
|
|
|
1036
|
-
async function handleTest(args) {
|
|
1037
|
-
// Parse command line arguments
|
|
1038
|
-
let currentDir = process.cwd();
|
|
1039
|
-
const pathIndex = args.indexOf("--path");
|
|
1040
|
-
|
|
1041
|
-
if (pathIndex !== -1 && args[pathIndex + 1]) {
|
|
1042
|
-
currentDir = args[pathIndex + 1];
|
|
1043
|
-
// Validate the provided path
|
|
1044
|
-
if (!fs.existsSync(currentDir)) {
|
|
1045
|
-
console.error(
|
|
1046
|
-
chalk.red(
|
|
1047
|
-
`Error: The specified path does not exist: ${currentDir}`
|
|
1048
|
-
)
|
|
1049
|
-
);
|
|
1050
|
-
return;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
const { spawn } = await import("child_process");
|
|
1055
|
-
|
|
1056
|
-
console.log(chalk.cyan.bold("\n🧪 Running integration tests...\n"));
|
|
1057
|
-
|
|
1058
|
-
// Look for test directory
|
|
1059
|
-
const testDirs = ["test", "tests", "__tests__"];
|
|
1060
|
-
let testDir = null;
|
|
1061
|
-
|
|
1062
|
-
for (const dir of testDirs) {
|
|
1063
|
-
if (fs.existsSync(dir)) {
|
|
1064
|
-
testDir = dir;
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
if (!testDir) {
|
|
1070
|
-
console.log(
|
|
1071
|
-
chalk.yellow(
|
|
1072
|
-
"⚠️ No test directory found. Looked for: test, tests, __tests__"
|
|
1073
|
-
)
|
|
1074
|
-
);
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
console.log(chalk.dim(`📁 Found test directory: ${testDir}`));
|
|
1079
|
-
|
|
1080
|
-
// Check if Jest is available
|
|
1081
|
-
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
1082
|
-
let hasJest = false;
|
|
1083
|
-
|
|
1084
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
1085
|
-
try {
|
|
1086
|
-
const packageJson = JSON.parse(
|
|
1087
|
-
fs.readFileSync(packageJsonPath, "utf-8")
|
|
1088
|
-
);
|
|
1089
|
-
hasJest = !!(
|
|
1090
|
-
packageJson.devDependencies?.jest ||
|
|
1091
|
-
packageJson.dependencies?.jest
|
|
1092
|
-
);
|
|
1093
|
-
} catch (error) {
|
|
1094
|
-
console.log(chalk.yellow("⚠️ Could not read package.json"));
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
if (!hasJest) {
|
|
1099
|
-
console.log(
|
|
1100
|
-
chalk.red(
|
|
1101
|
-
"❌ Jest is not installed. Please install Jest to run tests."
|
|
1102
|
-
)
|
|
1103
|
-
);
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
// Run Jest with the test directory
|
|
1108
|
-
return new Promise((resolve, reject) => {
|
|
1109
|
-
const jestProcess = spawn("npx", ["jest", testDir, "--verbose"], {
|
|
1110
|
-
stdio: "inherit",
|
|
1111
|
-
shell: true,
|
|
1112
|
-
});
|
|
1113
|
-
|
|
1114
|
-
jestProcess.on("close", (code) => {
|
|
1115
|
-
if (code === 0) {
|
|
1116
|
-
console.log(chalk.green.bold("\n✅ All tests passed!"));
|
|
1117
|
-
} else {
|
|
1118
|
-
console.log(chalk.red.bold("\n❌ Some tests failed."));
|
|
1119
|
-
}
|
|
1120
|
-
resolve(code);
|
|
1121
|
-
});
|
|
1122
|
-
|
|
1123
|
-
jestProcess.on("error", (error) => {
|
|
1124
|
-
console.error(chalk.red("❌ Error running tests:"), error.message);
|
|
1125
|
-
reject(error);
|
|
1126
|
-
});
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
1003
|
export default {
|
|
1131
1004
|
execute,
|
|
1132
1005
|
};
|
package/helper/folder.js
CHANGED
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
webhook,
|
|
10
10
|
} from "../templates/schemas.js";
|
|
11
11
|
|
|
12
|
-
export const createIntegrationFolderStructure = async (
|
|
13
|
-
integration,
|
|
14
|
-
create_catalogue
|
|
15
|
-
) => {
|
|
12
|
+
export const createIntegrationFolderStructure = async (integration) => {
|
|
16
13
|
const { id, name, description, icon, activity_type, trigger_type, meta } =
|
|
17
14
|
integration;
|
|
18
15
|
|
|
@@ -50,25 +47,13 @@ export const createIntegrationFolderStructure = async (
|
|
|
50
47
|
// Create template files
|
|
51
48
|
const files = {
|
|
52
49
|
"schemas/resources/resource1.json": JSON.stringify(resource1, null, 4),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
authentication,
|
|
56
|
-
null,
|
|
57
|
-
4
|
|
58
|
-
),
|
|
59
|
-
}),
|
|
60
|
-
"schemas/base.json": JSON.stringify(
|
|
61
|
-
base(name, create_catalogue),
|
|
62
|
-
null,
|
|
63
|
-
4
|
|
64
|
-
),
|
|
50
|
+
"schemas/authentication.json": JSON.stringify(authentication, null, 4),
|
|
51
|
+
"schemas/base.json": JSON.stringify(base(name), null, 4),
|
|
65
52
|
...(!isEmpty(trigger_type) && {
|
|
66
53
|
"schemas/webhook.json": JSON.stringify(webhook(name), null, 4),
|
|
67
54
|
}),
|
|
68
55
|
"spec.json": JSON.stringify(spec, null, 4),
|
|
69
|
-
|
|
70
|
-
"Authentication.mdx": `# ${name} Authentication`,
|
|
71
|
-
}),
|
|
56
|
+
"Authentication.mdx": `# ${name} Authentication`,
|
|
72
57
|
"Documentation.mdx": `# ${name} Documentation`,
|
|
73
58
|
};
|
|
74
59
|
|
package/package.json
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boltic/cli",
|
|
3
|
-
"version": "1.0.6-beta.
|
|
3
|
+
"version": "1.0.6-beta.2",
|
|
4
4
|
"description": "A powerful CLI tool for managing Boltic Workflow integrations",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"boltic": "index.js"
|
|
8
8
|
},
|
|
9
9
|
"author": "Ahmed Sakri <ahmedsakri@gofynd.com>",
|
|
10
|
-
"
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/bolticio/cli.git"
|
|
13
|
-
},
|
|
14
|
-
"homepage": "https://github.com/bolticio/cli#readme",
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://github.com/bolticio/cli/issues"
|
|
17
|
-
},
|
|
10
|
+
"homepage": "https://www.boltic.io",
|
|
18
11
|
"scripts": {
|
|
19
12
|
"start": "node index.js",
|
|
20
13
|
"dev": "nodemon index.js",
|
package/templates/schemas.js
CHANGED
|
@@ -45,24 +45,10 @@ const authentication = {
|
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const base = (name
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
meta: {
|
|
53
|
-
displayName: "Service Account",
|
|
54
|
-
displayType: "hidden",
|
|
55
|
-
placeholder: "Select Service Account",
|
|
56
|
-
description:
|
|
57
|
-
"Your service account credentials are encrypted & can be removed at any time.",
|
|
58
|
-
options: [],
|
|
59
|
-
value: `__BOLTIC_INTEGRATION_${name.toUpperCase()}`,
|
|
60
|
-
validation: {
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
: {
|
|
48
|
+
const base = (name) => {
|
|
49
|
+
return {
|
|
50
|
+
parameters: [
|
|
51
|
+
{
|
|
66
52
|
name: "secret",
|
|
67
53
|
meta: {
|
|
68
54
|
displayName: "Service Account",
|
|
@@ -86,11 +72,7 @@ const base = (name, create_catalogue) => {
|
|
|
86
72
|
required: true,
|
|
87
73
|
},
|
|
88
74
|
},
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
parameters: [
|
|
93
|
-
secretParameter,
|
|
75
|
+
},
|
|
94
76
|
{
|
|
95
77
|
name: "resource",
|
|
96
78
|
meta: {
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Boltic.io
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|