@eventmodelers/node-kit 0.0.8 → 0.0.10
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/cli.js +1 -1
- package/templates/realtime-agent/src/index.js +15 -4
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -221,7 +221,7 @@ program
|
|
|
221
221
|
try {
|
|
222
222
|
const cfg = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
223
223
|
console.log(`\nConnected to: ${cfg.baseUrl}`);
|
|
224
|
-
console.log(`Organization: ${cfg.
|
|
224
|
+
console.log(`Organization: ${cfg.organizationId}`);
|
|
225
225
|
console.log(`Board: ${cfg.boardId}`);
|
|
226
226
|
} catch {
|
|
227
227
|
console.log('\n⚠️ Config file is invalid JSON');
|
|
@@ -6,12 +6,23 @@ import { randomUUID } from 'crypto';
|
|
|
6
6
|
|
|
7
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
8
|
|
|
9
|
+
function findConfigPath(startDir) {
|
|
10
|
+
let dir = startDir;
|
|
11
|
+
while (true) {
|
|
12
|
+
const candidate = join(dir, '.eventmodelers', 'config.json');
|
|
13
|
+
if (existsSync(candidate)) return candidate;
|
|
14
|
+
const parent = dirname(dir);
|
|
15
|
+
if (parent === dir) throw new Error('No .eventmodelers/config.json found in current directory or any parent directory');
|
|
16
|
+
dir = parent;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
function loadLocalConfig() {
|
|
10
|
-
const configPath =
|
|
21
|
+
const configPath = findConfigPath(process.cwd());
|
|
11
22
|
const raw = readFileSync(configPath, 'utf-8');
|
|
12
23
|
const cfg = JSON.parse(raw);
|
|
13
24
|
|
|
14
|
-
for (const key of ['token', '
|
|
25
|
+
for (const key of ['token', 'organizationId', 'boardId', 'baseUrl']) {
|
|
15
26
|
if (!cfg[key]) throw new Error(`Missing config field: ${key}`);
|
|
16
27
|
}
|
|
17
28
|
|
|
@@ -39,7 +50,7 @@ async function getRealtimeToken(cfg) {
|
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
async function fetchAndPersistSlices(cfg, cwd) {
|
|
42
|
-
const url = `${cfg.baseUrl}/api/org/${cfg.
|
|
53
|
+
const url = `${cfg.baseUrl}/api/org/${cfg.organizationId}/boards/${cfg.boardId}/slicedata/slices`;
|
|
43
54
|
const res = await fetch(url, {
|
|
44
55
|
headers: { 'x-token': cfg.token, 'x-board-id': cfg.boardId },
|
|
45
56
|
});
|
|
@@ -85,7 +96,7 @@ async function start() {
|
|
|
85
96
|
const local = loadLocalConfig();
|
|
86
97
|
const cfg = await fetchPlatformConfig(local);
|
|
87
98
|
|
|
88
|
-
console.log(`[agent] Starting — org=${cfg.
|
|
99
|
+
console.log(`[agent] Starting — org=${cfg.organizationId}, board=${cfg.boardId}, base=${cfg.baseUrl}, cwd=${claudeCwd}`);
|
|
89
100
|
|
|
90
101
|
let realtimeToken = await getRealtimeToken(cfg);
|
|
91
102
|
|