openkbs 0.0.79 → 0.0.80
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/elastic/README.md +17 -9
- package/elastic/functions.md +9 -2
- package/package.json +1 -1
- package/scripts/deploy-templates.js +17 -2
- package/src/actions.js +47 -12
- package/templates/.claude/skills/openkbs/SKILL.md +11 -8
- package/templates/.claude/skills/openkbs/examples/monitoring-bot/openkbs.json +4 -1
- package/templates/.claude/skills/openkbs/examples/nodejs-demo/openkbs.json +9 -10
- package/templates/.claude/skills/openkbs/metadata.json +3 -1
- package/templates/.claude/skills/openkbs/reference/elastic-services.md +22 -20
- package/templates/platform/openkbs.json +10 -15
- package/version.json +3 -3
package/elastic/README.md
CHANGED
|
@@ -91,14 +91,15 @@ Create `openkbs.json`:
|
|
|
91
91
|
{
|
|
92
92
|
"name": "my-app",
|
|
93
93
|
"region": "us-east-1",
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
"pulse": true
|
|
94
|
+
"spa": "/app/index.html",
|
|
95
|
+
"postgres": true,
|
|
96
|
+
"storage": {
|
|
97
|
+
"cloudfront": "media"
|
|
100
98
|
},
|
|
101
|
-
"
|
|
99
|
+
"pulse": true,
|
|
100
|
+
"functions": [
|
|
101
|
+
{ "name": "api", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
102
|
+
],
|
|
102
103
|
"site": "./site"
|
|
103
104
|
}
|
|
104
105
|
```
|
|
@@ -839,8 +840,15 @@ functions/
|
|
|
839
840
|
```json
|
|
840
841
|
{
|
|
841
842
|
"name": "my-app",
|
|
842
|
-
"
|
|
843
|
-
"
|
|
843
|
+
"region": "us-east-1",
|
|
844
|
+
"spa": "/app/index.html",
|
|
845
|
+
"postgres": true,
|
|
846
|
+
"functions": [
|
|
847
|
+
{ "name": "auth", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 },
|
|
848
|
+
{ "name": "posts", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 },
|
|
849
|
+
{ "name": "payments", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
850
|
+
],
|
|
851
|
+
"site": "./site"
|
|
844
852
|
}
|
|
845
853
|
```
|
|
846
854
|
|
package/elastic/functions.md
CHANGED
|
@@ -261,8 +261,15 @@ functions/
|
|
|
261
261
|
```json
|
|
262
262
|
{
|
|
263
263
|
"name": "my-app",
|
|
264
|
-
"
|
|
265
|
-
"
|
|
264
|
+
"region": "us-east-1",
|
|
265
|
+
"spa": "/app/index.html",
|
|
266
|
+
"postgres": true,
|
|
267
|
+
"functions": [
|
|
268
|
+
{ "name": "auth", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 },
|
|
269
|
+
{ "name": "posts", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 },
|
|
270
|
+
{ "name": "payments", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
271
|
+
],
|
|
272
|
+
"site": "./site"
|
|
266
273
|
}
|
|
267
274
|
```
|
|
268
275
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { execSync } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
const path = require('path');
|
|
5
6
|
|
|
6
7
|
const BUCKET = 'openkbs-downloads';
|
|
7
8
|
const TEMPLATES_DIR = path.join(__dirname, '../templates');
|
|
9
|
+
const METADATA_PATH = path.join(TEMPLATES_DIR, '.claude/skills/openkbs/metadata.json');
|
|
10
|
+
|
|
11
|
+
function bumpVersion(version) {
|
|
12
|
+
const parts = version.split('.').map(Number);
|
|
13
|
+
parts[2] = (parts[2] || 0) + 1;
|
|
14
|
+
return parts.join('.');
|
|
15
|
+
}
|
|
8
16
|
|
|
9
17
|
async function deployTemplates() {
|
|
10
18
|
try {
|
|
19
|
+
// Bump skill version
|
|
20
|
+
const metadata = JSON.parse(fs.readFileSync(METADATA_PATH, 'utf8'));
|
|
21
|
+
const oldVersion = metadata.version;
|
|
22
|
+
metadata.version = bumpVersion(oldVersion);
|
|
23
|
+
fs.writeFileSync(METADATA_PATH, JSON.stringify(metadata, null, 2) + '\n');
|
|
24
|
+
console.log(`Bumped skill version: ${oldVersion} -> ${metadata.version}`);
|
|
25
|
+
|
|
11
26
|
console.log('Syncing templates to S3...');
|
|
12
|
-
|
|
27
|
+
|
|
13
28
|
const syncCommand = `aws s3 sync "${TEMPLATES_DIR}" s3://${BUCKET}/templates --delete`;
|
|
14
29
|
execSync(syncCommand, { stdio: 'inherit' });
|
|
15
|
-
|
|
30
|
+
|
|
16
31
|
console.log('Templates synced successfully!');
|
|
17
32
|
} catch (error) {
|
|
18
33
|
console.error('Error syncing templates:', error);
|
package/src/actions.js
CHANGED
|
@@ -2315,6 +2315,35 @@ async function pulsePublishAction(kbToken, channel, message) {
|
|
|
2315
2315
|
}
|
|
2316
2316
|
}
|
|
2317
2317
|
|
|
2318
|
+
/**
|
|
2319
|
+
* Normalize openkbs.json config - supports both flat and elastic wrapper formats
|
|
2320
|
+
* Flat format (preferred): { postgres: true, storage: {...}, pulse: true }
|
|
2321
|
+
* Legacy format: { elastic: { postgres: true, storage: {...}, pulse: true } }
|
|
2322
|
+
*/
|
|
2323
|
+
function normalizeElasticConfig(config) {
|
|
2324
|
+
// If using legacy elastic wrapper, return as-is
|
|
2325
|
+
if (config.elastic) {
|
|
2326
|
+
return {
|
|
2327
|
+
postgres: config.elastic.postgres,
|
|
2328
|
+
storage: config.elastic.storage,
|
|
2329
|
+
pulse: config.elastic.pulse
|
|
2330
|
+
};
|
|
2331
|
+
}
|
|
2332
|
+
// Flat format - read directly from config
|
|
2333
|
+
return {
|
|
2334
|
+
postgres: config.postgres,
|
|
2335
|
+
storage: config.storage,
|
|
2336
|
+
pulse: config.pulse
|
|
2337
|
+
};
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Check if config has any elastic services configured
|
|
2342
|
+
*/
|
|
2343
|
+
function hasElasticServices(config) {
|
|
2344
|
+
return config.elastic || config.postgres || config.storage || config.pulse;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2318
2347
|
/**
|
|
2319
2348
|
* Deploy from openkbs.json config file
|
|
2320
2349
|
* Enables elastic services and deploys functions/site
|
|
@@ -2357,12 +2386,16 @@ async function elasticDeployAction() {
|
|
|
2357
2386
|
const kbToken = res.kbToken;
|
|
2358
2387
|
|
|
2359
2388
|
// Deploy elastic services if configured
|
|
2360
|
-
|
|
2389
|
+
const elasticConfig = normalizeElasticConfig(config);
|
|
2390
|
+
if (hasElasticServices(config) || config.spa) {
|
|
2361
2391
|
console.log('\nEnabling Elastic services...');
|
|
2362
2392
|
const elasticRes = await makePostRequest(KB_API_URL, {
|
|
2363
2393
|
token: kbToken,
|
|
2364
2394
|
action: 'deployElastic',
|
|
2365
|
-
|
|
2395
|
+
// Send flat format to backend
|
|
2396
|
+
postgres: elasticConfig.postgres,
|
|
2397
|
+
storage: elasticConfig.storage,
|
|
2398
|
+
pulse: elasticConfig.pulse,
|
|
2366
2399
|
spa: config.spa,
|
|
2367
2400
|
region
|
|
2368
2401
|
});
|
|
@@ -2464,13 +2497,14 @@ async function elasticDestroyAction() {
|
|
|
2464
2497
|
}
|
|
2465
2498
|
|
|
2466
2499
|
// Disable elastic services
|
|
2467
|
-
|
|
2500
|
+
const elasticConfig = normalizeElasticConfig(config);
|
|
2501
|
+
if (hasElasticServices(config)) {
|
|
2468
2502
|
console.log('\nDisabling Elastic services...');
|
|
2469
2503
|
|
|
2470
|
-
if (
|
|
2504
|
+
if (elasticConfig.storage) {
|
|
2471
2505
|
// First remove CloudFront behavior/origin if configured
|
|
2472
|
-
const cloudfrontPath = typeof
|
|
2473
|
-
?
|
|
2506
|
+
const cloudfrontPath = typeof elasticConfig.storage === 'object'
|
|
2507
|
+
? elasticConfig.storage.cloudfront
|
|
2474
2508
|
: null;
|
|
2475
2509
|
|
|
2476
2510
|
if (cloudfrontPath) {
|
|
@@ -2504,7 +2538,7 @@ async function elasticDestroyAction() {
|
|
|
2504
2538
|
}
|
|
2505
2539
|
}
|
|
2506
2540
|
|
|
2507
|
-
if (
|
|
2541
|
+
if (elasticConfig.postgres) {
|
|
2508
2542
|
try {
|
|
2509
2543
|
await makePostRequest(KB_API_URL, {
|
|
2510
2544
|
token: kbToken,
|
|
@@ -2516,7 +2550,7 @@ async function elasticDestroyAction() {
|
|
|
2516
2550
|
}
|
|
2517
2551
|
}
|
|
2518
2552
|
|
|
2519
|
-
if (
|
|
2553
|
+
if (elasticConfig.pulse) {
|
|
2520
2554
|
try {
|
|
2521
2555
|
await makePostRequest(KB_API_URL, {
|
|
2522
2556
|
token: kbToken,
|
|
@@ -2593,10 +2627,11 @@ async function elasticStatusAction() {
|
|
|
2593
2627
|
}
|
|
2594
2628
|
|
|
2595
2629
|
// Check elastic services
|
|
2596
|
-
|
|
2630
|
+
const elasticConfig = normalizeElasticConfig(config);
|
|
2631
|
+
if (hasElasticServices(config)) {
|
|
2597
2632
|
console.log('Elastic Services:');
|
|
2598
2633
|
|
|
2599
|
-
if (
|
|
2634
|
+
if (elasticConfig.storage) {
|
|
2600
2635
|
const storageRes = await makePostRequest(KB_API_URL, {
|
|
2601
2636
|
token: kbToken,
|
|
2602
2637
|
action: 'getElasticStorage'
|
|
@@ -2608,7 +2643,7 @@ async function elasticStatusAction() {
|
|
|
2608
2643
|
}
|
|
2609
2644
|
}
|
|
2610
2645
|
|
|
2611
|
-
if (
|
|
2646
|
+
if (elasticConfig.postgres) {
|
|
2612
2647
|
const pgRes = await makePostRequest(KB_API_URL, {
|
|
2613
2648
|
token: kbToken,
|
|
2614
2649
|
action: 'getElasticPostgres'
|
|
@@ -2620,7 +2655,7 @@ async function elasticStatusAction() {
|
|
|
2620
2655
|
}
|
|
2621
2656
|
}
|
|
2622
2657
|
|
|
2623
|
-
if (
|
|
2658
|
+
if (elasticConfig.pulse) {
|
|
2624
2659
|
const pulseRes = await makePostRequest(KB_API_URL, {
|
|
2625
2660
|
token: kbToken,
|
|
2626
2661
|
action: 'getElasticPulse'
|
|
@@ -84,14 +84,17 @@ my-platform/
|
|
|
84
84
|
### openkbs.json
|
|
85
85
|
```json
|
|
86
86
|
{
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
"region": "us-east-1",
|
|
88
|
+
"spa": "/app/index.html",
|
|
89
|
+
"postgres": true,
|
|
90
|
+
"storage": {
|
|
91
|
+
"cloudfront": "media"
|
|
92
|
+
},
|
|
93
|
+
"pulse": true,
|
|
94
|
+
"functions": [
|
|
95
|
+
{ "name": "api", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
96
|
+
],
|
|
97
|
+
"site": "./site"
|
|
95
98
|
}
|
|
96
99
|
```
|
|
97
100
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodejs-demo",
|
|
3
3
|
"region": "us-east-1",
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
"storage": {
|
|
9
|
-
"cloudfront": "media"
|
|
10
|
-
}
|
|
4
|
+
"spa": "/app/index.html",
|
|
5
|
+
"postgres": true,
|
|
6
|
+
"storage": {
|
|
7
|
+
"cloudfront": "media"
|
|
11
8
|
},
|
|
12
|
-
|
|
13
|
-
"functions": [
|
|
14
|
-
|
|
9
|
+
"pulse": true,
|
|
10
|
+
"functions": [
|
|
11
|
+
{ "name": "auth", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 },
|
|
12
|
+
{ "name": "posts", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
13
|
+
],
|
|
15
14
|
"site": "./site"
|
|
16
15
|
}
|
|
@@ -15,18 +15,17 @@ OpenKBS provides managed cloud infrastructure that scales automatically.
|
|
|
15
15
|
|
|
16
16
|
```json
|
|
17
17
|
{
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
18
|
+
"region": "us-east-1",
|
|
19
|
+
"spa": "/app/index.html",
|
|
20
|
+
"postgres": true,
|
|
21
|
+
"storage": {
|
|
22
|
+
"cloudfront": "media"
|
|
23
|
+
},
|
|
24
|
+
"pulse": true,
|
|
25
|
+
"functions": [
|
|
26
|
+
{ "name": "hello", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
27
|
+
],
|
|
28
|
+
"site": "./site"
|
|
30
29
|
}
|
|
31
30
|
```
|
|
32
31
|
|
|
@@ -344,14 +343,17 @@ Complete Node.js application with all services:
|
|
|
344
343
|
|
|
345
344
|
```json
|
|
346
345
|
{
|
|
347
|
-
"
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
"
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
346
|
+
"region": "us-east-1",
|
|
347
|
+
"spa": "/app/index.html",
|
|
348
|
+
"postgres": true,
|
|
349
|
+
"storage": {
|
|
350
|
+
"cloudfront": "media"
|
|
351
|
+
},
|
|
352
|
+
"pulse": true,
|
|
353
|
+
"functions": [
|
|
354
|
+
{ "name": "api", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
355
|
+
],
|
|
356
|
+
"site": "./site"
|
|
355
357
|
}
|
|
356
358
|
```
|
|
357
359
|
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "{{APP_NAME}}",
|
|
3
3
|
"region": "us-east-1",
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"memory": 512,
|
|
15
|
-
"timeout": 30
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
4
|
+
"spa": "/app/index.html",
|
|
5
|
+
"postgres": true,
|
|
6
|
+
"storage": {
|
|
7
|
+
"cloudfront": "media"
|
|
8
|
+
},
|
|
9
|
+
"pulse": true,
|
|
10
|
+
"functions": [
|
|
11
|
+
{ "name": "api", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
|
|
12
|
+
],
|
|
13
|
+
"site": "./site"
|
|
19
14
|
}
|
package/version.json
CHANGED