openkbs 0.0.89 → 0.0.92
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/package.json +1 -1
- package/src/actions.js +18 -27
- package/src/index.js +1 -1
- package/templates/.claude/CLAUDE.md +3 -6
- package/templates/.claude/skills/openkbs/SKILL.md +1 -1
- package/templates/.claude/skills/openkbs/metadata.json +1 -1
- package/templates/platform/openkbs.json +1 -0
- package/version.json +2 -2
- package/templates/platform/functions/settings.json +0 -4
- package/templates/platform/site/settings.json +0 -4
package/package.json
CHANGED
package/src/actions.js
CHANGED
|
@@ -32,15 +32,14 @@ const SERVICES = {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Find settings
|
|
36
|
-
* Returns
|
|
35
|
+
* Find settings (kbId, region) - checks settings.json locations and openkbs.json
|
|
36
|
+
* Returns object with kbId, region, etc.
|
|
37
37
|
*/
|
|
38
38
|
function findSettings() {
|
|
39
39
|
const paths = [
|
|
40
|
+
path.join(process.cwd(), 'openkbs.json'),
|
|
40
41
|
path.join(process.cwd(), 'settings.json'),
|
|
41
|
-
path.join(process.cwd(), 'app', 'settings.json')
|
|
42
|
-
path.join(process.cwd(), 'functions', 'settings.json'),
|
|
43
|
-
path.join(process.cwd(), 'site', 'settings.json')
|
|
42
|
+
path.join(process.cwd(), 'app', 'settings.json')
|
|
44
43
|
];
|
|
45
44
|
|
|
46
45
|
for (const settingsPath of paths) {
|
|
@@ -1118,7 +1117,7 @@ async function fnAction(subCommand, args = []) {
|
|
|
1118
1117
|
}
|
|
1119
1118
|
|
|
1120
1119
|
if (!kbId) {
|
|
1121
|
-
return console.red('No KB found.
|
|
1120
|
+
return console.red('No KB found. Add kbId to openkbs.json or settings.json.');
|
|
1122
1121
|
}
|
|
1123
1122
|
|
|
1124
1123
|
const { kbToken } = await fetchKBJWT(kbId);
|
|
@@ -1488,7 +1487,7 @@ async function storageAction(subCommand, args = []) {
|
|
|
1488
1487
|
}
|
|
1489
1488
|
|
|
1490
1489
|
if (!kbId) {
|
|
1491
|
-
return console.red('No KB found.
|
|
1490
|
+
return console.red('No KB found. Add kbId to openkbs.json or settings.json.');
|
|
1492
1491
|
}
|
|
1493
1492
|
|
|
1494
1493
|
const { kbToken } = await fetchKBJWT(kbId);
|
|
@@ -1879,7 +1878,7 @@ async function postgresAction(subCommand, args = []) {
|
|
|
1879
1878
|
}
|
|
1880
1879
|
|
|
1881
1880
|
if (!kbId) {
|
|
1882
|
-
return console.red('No KB found.
|
|
1881
|
+
return console.red('No KB found. Add kbId to openkbs.json or settings.json.');
|
|
1883
1882
|
}
|
|
1884
1883
|
|
|
1885
1884
|
const { kbToken } = await fetchKBJWT(kbId);
|
|
@@ -2016,17 +2015,10 @@ async function siteAction(subCommand, args = []) {
|
|
|
2016
2015
|
let kbId = findKbId();
|
|
2017
2016
|
let siteDir = process.cwd();
|
|
2018
2017
|
|
|
2019
|
-
// If
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
if (fs.existsSync(siteSettingsPath)) {
|
|
2024
|
-
siteDir = siteDirPath;
|
|
2025
|
-
try {
|
|
2026
|
-
const settings = JSON.parse(fs.readFileSync(siteSettingsPath, 'utf8'));
|
|
2027
|
-
kbId = settings.kbId;
|
|
2028
|
-
} catch (e) {}
|
|
2029
|
-
}
|
|
2018
|
+
// If running from project root, use site/ subdirectory
|
|
2019
|
+
const siteDirPath = path.join(process.cwd(), 'site');
|
|
2020
|
+
if (fs.existsSync(siteDirPath)) {
|
|
2021
|
+
siteDir = siteDirPath;
|
|
2030
2022
|
}
|
|
2031
2023
|
|
|
2032
2024
|
if (!kbId) {
|
|
@@ -2035,7 +2027,7 @@ async function siteAction(subCommand, args = []) {
|
|
|
2035
2027
|
}
|
|
2036
2028
|
|
|
2037
2029
|
if (!kbId) {
|
|
2038
|
-
return console.red('No KB found.
|
|
2030
|
+
return console.red('No KB found. Add kbId to openkbs.json or settings.json.');
|
|
2039
2031
|
}
|
|
2040
2032
|
|
|
2041
2033
|
const { kbToken } = await fetchKBJWT(kbId);
|
|
@@ -2059,7 +2051,7 @@ async function siteAction(subCommand, args = []) {
|
|
|
2059
2051
|
console.log(' openkbs site push [folder] Upload files to S3 (defaults to current dir or site/)');
|
|
2060
2052
|
console.log(' openkbs site spa <path> Enable SPA fallback (e.g., /app/index.html)');
|
|
2061
2053
|
console.log(' openkbs site spa --disable Disable SPA fallback');
|
|
2062
|
-
console.log('\nRun from a
|
|
2054
|
+
console.log('\nRun from a directory with openkbs.json or settings.json containing kbId.');
|
|
2063
2055
|
}
|
|
2064
2056
|
}
|
|
2065
2057
|
|
|
@@ -2074,9 +2066,8 @@ async function siteDeployAction(kbToken, kbId, siteDir, args) {
|
|
|
2074
2066
|
const fullPath = path.join(dir, entry.name);
|
|
2075
2067
|
const relativePath = path.relative(baseDir, fullPath);
|
|
2076
2068
|
|
|
2077
|
-
// Skip hidden files
|
|
2069
|
+
// Skip hidden files and node_modules
|
|
2078
2070
|
if (entry.name.startsWith('.') ||
|
|
2079
|
-
entry.name === 'settings.json' ||
|
|
2080
2071
|
entry.name === 'node_modules') {
|
|
2081
2072
|
continue;
|
|
2082
2073
|
}
|
|
@@ -2197,7 +2188,7 @@ async function pulseAction(subCommand, args = []) {
|
|
|
2197
2188
|
}
|
|
2198
2189
|
|
|
2199
2190
|
if (!kbId) {
|
|
2200
|
-
return console.red('No KB found.
|
|
2191
|
+
return console.red('No KB found. Add kbId to openkbs.json or settings.json.');
|
|
2201
2192
|
}
|
|
2202
2193
|
|
|
2203
2194
|
const { kbToken } = await fetchKBJWT(kbId);
|
|
@@ -2435,7 +2426,7 @@ async function elasticDeployAction() {
|
|
|
2435
2426
|
// Get KB token
|
|
2436
2427
|
const settings = findSettings();
|
|
2437
2428
|
if (!settings?.kbId) {
|
|
2438
|
-
return console.red('No kbId found.
|
|
2429
|
+
return console.red('No kbId found. Add kbId to openkbs.json or settings.json.');
|
|
2439
2430
|
}
|
|
2440
2431
|
|
|
2441
2432
|
const res = await fetchKBJWT(settings.kbId);
|
|
@@ -2532,7 +2523,7 @@ async function elasticDestroyAction() {
|
|
|
2532
2523
|
// Get KB token
|
|
2533
2524
|
const settings = findSettings();
|
|
2534
2525
|
if (!settings?.kbId) {
|
|
2535
|
-
return console.red('No kbId found.
|
|
2526
|
+
return console.red('No kbId found. Add kbId to openkbs.json or settings.json.');
|
|
2536
2527
|
}
|
|
2537
2528
|
|
|
2538
2529
|
const res = await fetchKBJWT(settings.kbId);
|
|
@@ -2655,7 +2646,7 @@ async function elasticStatusAction() {
|
|
|
2655
2646
|
// Get KB token
|
|
2656
2647
|
const settings = findSettings();
|
|
2657
2648
|
if (!settings?.kbId) {
|
|
2658
|
-
return console.red('No kbId found.
|
|
2649
|
+
return console.red('No kbId found. Add kbId to openkbs.json or settings.json.');
|
|
2659
2650
|
}
|
|
2660
2651
|
|
|
2661
2652
|
const res = await fetchKBJWT(settings.kbId);
|
package/src/index.js
CHANGED
|
@@ -268,7 +268,7 @@ Examples:
|
|
|
268
268
|
$ openkbs site push Push site/ folder (or current dir) to S3
|
|
269
269
|
$ openkbs site push ./dist Push specific folder to S3
|
|
270
270
|
|
|
271
|
-
Run from a directory
|
|
271
|
+
Run from a directory with openkbs.json or settings.json containing kbId.
|
|
272
272
|
`);
|
|
273
273
|
|
|
274
274
|
program
|
|
@@ -19,11 +19,8 @@ If auth error, ask user to run `openkbs login` first.
|
|
|
19
19
|
Pick the whitelabel agent kbId from the list.
|
|
20
20
|
|
|
21
21
|
### 2. Configure Settings
|
|
22
|
-
Update
|
|
23
|
-
|
|
24
|
-
**site/settings.json** and **functions/settings.json**:
|
|
22
|
+
Update `openkbs.json`:
|
|
25
23
|
- Replace `{{WHITELABEL_KB_ID}}` with kbId from step 1
|
|
26
|
-
- Replace `{{REGION}}` with region from openkbs.json
|
|
27
24
|
|
|
28
25
|
### 3. Deploy
|
|
29
26
|
```bash
|
|
@@ -33,7 +30,7 @@ openkbs fn push api # API function (optional)
|
|
|
33
30
|
```
|
|
34
31
|
|
|
35
32
|
## Project Structure
|
|
36
|
-
- `openkbs.json` -
|
|
37
|
-
- `site/` - Static frontend
|
|
33
|
+
- `openkbs.json` - Project config (kbId, region, elastic services)
|
|
34
|
+
- `site/` - Static frontend
|
|
38
35
|
- `functions/` - Serverless Lambda functions
|
|
39
36
|
- `agents/` - AI agents (optional, each gets own kbId on push)
|
|
@@ -40,7 +40,7 @@ Platform mode extends agent capabilities with:
|
|
|
40
40
|
- CloudFront distributions
|
|
41
41
|
- SSL certificates
|
|
42
42
|
|
|
43
|
-
This whitelabel `kbId` is
|
|
43
|
+
This whitelabel `kbId` is stored in `openkbs.json` in the project root. User-facing agents in `agents/` folder each get their own separate `kbId` when pushed.
|
|
44
44
|
|
|
45
45
|
## Project Structure
|
|
46
46
|
|
package/version.json
CHANGED