@base44-preview/cli 0.0.33-pr.286.ddceb19 → 0.0.34-pr.228.21866ae
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/dist/cli/index.js +71 -38
- package/dist/cli/index.js.map +4 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -185389,18 +185389,16 @@ async function fetchAgents() {
|
|
|
185389
185389
|
}
|
|
185390
185390
|
// src/core/resources/agent/config.ts
|
|
185391
185391
|
import { join as join3 } from "node:path";
|
|
185392
|
-
|
|
185393
|
-
return name2.toLowerCase().replace(/[^a-z0-9_]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "");
|
|
185394
|
-
}
|
|
185392
|
+
import { isDeepStrictEqual } from "node:util";
|
|
185395
185393
|
async function readAgentFile(agentPath) {
|
|
185396
|
-
const
|
|
185397
|
-
const result = AgentConfigSchema.safeParse(
|
|
185394
|
+
const raw2 = await readJsonFile(agentPath);
|
|
185395
|
+
const result = AgentConfigSchema.safeParse(raw2);
|
|
185398
185396
|
if (!result.success) {
|
|
185399
185397
|
throw new SchemaValidationError("Invalid agent file", result.error, agentPath);
|
|
185400
185398
|
}
|
|
185401
|
-
return result.data;
|
|
185399
|
+
return { data: result.data, raw: raw2 };
|
|
185402
185400
|
}
|
|
185403
|
-
async function
|
|
185401
|
+
async function readAgentFiles(agentsDir) {
|
|
185404
185402
|
if (!await pathExists(agentsDir)) {
|
|
185405
185403
|
return [];
|
|
185406
185404
|
}
|
|
@@ -185408,37 +185406,72 @@ async function readAllAgents(agentsDir) {
|
|
|
185408
185406
|
cwd: agentsDir,
|
|
185409
185407
|
absolute: true
|
|
185410
185408
|
});
|
|
185411
|
-
|
|
185412
|
-
|
|
185413
|
-
|
|
185414
|
-
|
|
185415
|
-
|
|
185409
|
+
return await Promise.all(files.map(async (filePath) => {
|
|
185410
|
+
const { data, raw: raw2 } = await readAgentFile(filePath);
|
|
185411
|
+
return { data, raw: raw2, filePath };
|
|
185412
|
+
}));
|
|
185413
|
+
}
|
|
185414
|
+
function buildNameToEntryMap(entries) {
|
|
185415
|
+
const nameToEntry = new Map;
|
|
185416
|
+
for (const entry of entries) {
|
|
185417
|
+
if (nameToEntry.has(entry.data.name)) {
|
|
185418
|
+
throw new InvalidInputError(`Duplicate agent name "${entry.data.name}"`, {
|
|
185419
|
+
hints: [
|
|
185420
|
+
{
|
|
185421
|
+
message: `Remove duplicate agents with name "${entry.data.name}" - only one agent per name is allowed`
|
|
185422
|
+
}
|
|
185423
|
+
]
|
|
185424
|
+
});
|
|
185425
|
+
}
|
|
185426
|
+
nameToEntry.set(entry.data.name, entry);
|
|
185427
|
+
}
|
|
185428
|
+
return nameToEntry;
|
|
185429
|
+
}
|
|
185430
|
+
async function readAllAgents(agentsDir) {
|
|
185431
|
+
const entries = await readAgentFiles(agentsDir);
|
|
185432
|
+
const nameToEntry = buildNameToEntryMap(entries);
|
|
185433
|
+
return [...nameToEntry.values()].map((e2) => e2.data);
|
|
185434
|
+
}
|
|
185435
|
+
function findAvailablePath(agentsDir, name2, claimedPaths) {
|
|
185436
|
+
const base = join3(agentsDir, `${name2}.${CONFIG_FILE_EXTENSION}`);
|
|
185437
|
+
if (!claimedPaths.has(base)) {
|
|
185438
|
+
return base;
|
|
185439
|
+
}
|
|
185440
|
+
for (let i = 1;; i++) {
|
|
185441
|
+
const candidate = join3(agentsDir, `${name2}_${i}.${CONFIG_FILE_EXTENSION}`);
|
|
185442
|
+
if (!claimedPaths.has(candidate)) {
|
|
185443
|
+
return candidate;
|
|
185416
185444
|
}
|
|
185417
|
-
names.add(agent.name);
|
|
185418
185445
|
}
|
|
185419
|
-
return agents;
|
|
185420
185446
|
}
|
|
185421
185447
|
async function writeAgents(agentsDir, remoteAgents) {
|
|
185422
|
-
const
|
|
185448
|
+
const entries = await readAgentFiles(agentsDir);
|
|
185449
|
+
const nameToEntry = buildNameToEntryMap(entries);
|
|
185423
185450
|
const newNames = new Set(remoteAgents.map((a) => a.name));
|
|
185424
|
-
const
|
|
185425
|
-
for (const
|
|
185426
|
-
|
|
185427
|
-
|
|
185428
|
-
|
|
185429
|
-
|
|
185430
|
-
|
|
185431
|
-
|
|
185432
|
-
|
|
185451
|
+
const deleted = [];
|
|
185452
|
+
for (const [name2, entry] of nameToEntry) {
|
|
185453
|
+
if (!newNames.has(name2)) {
|
|
185454
|
+
await deleteFile(entry.filePath);
|
|
185455
|
+
deleted.push(name2);
|
|
185456
|
+
}
|
|
185457
|
+
}
|
|
185458
|
+
const claimedPaths = new Set;
|
|
185459
|
+
for (const [name2, entry] of nameToEntry) {
|
|
185460
|
+
if (newNames.has(name2)) {
|
|
185461
|
+
claimedPaths.add(entry.filePath);
|
|
185433
185462
|
}
|
|
185434
185463
|
}
|
|
185464
|
+
const written = [];
|
|
185435
185465
|
for (const agent of remoteAgents) {
|
|
185436
|
-
const
|
|
185437
|
-
|
|
185466
|
+
const existing = nameToEntry.get(agent.name);
|
|
185467
|
+
if (existing && isDeepStrictEqual(existing.raw, agent)) {
|
|
185468
|
+
continue;
|
|
185469
|
+
}
|
|
185470
|
+
const filePath = existing?.filePath ?? findAvailablePath(agentsDir, agent.name, claimedPaths);
|
|
185471
|
+
claimedPaths.add(filePath);
|
|
185438
185472
|
await writeJsonFile(filePath, agent);
|
|
185473
|
+
written.push(agent.name);
|
|
185439
185474
|
}
|
|
185440
|
-
const written = remoteAgents.map((a) => a.name);
|
|
185441
|
-
const deleted = toDelete.map((a) => a.name);
|
|
185442
185475
|
return { written, deleted };
|
|
185443
185476
|
}
|
|
185444
185477
|
// src/core/resources/agent/resource.ts
|
|
@@ -185655,7 +185688,7 @@ async function removeConnector(integrationType) {
|
|
|
185655
185688
|
}
|
|
185656
185689
|
// src/core/resources/connector/config.ts
|
|
185657
185690
|
import { join as join4 } from "node:path";
|
|
185658
|
-
import { isDeepStrictEqual } from "node:util";
|
|
185691
|
+
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
185659
185692
|
async function readConnectorFile(connectorPath) {
|
|
185660
185693
|
const parsed = await readJsonFile(connectorPath);
|
|
185661
185694
|
const result = ConnectorResourceSchema.safeParse(parsed);
|
|
@@ -185716,7 +185749,7 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
|
|
|
185716
185749
|
type: connector.integrationType,
|
|
185717
185750
|
scopes: connector.scopes
|
|
185718
185751
|
};
|
|
185719
|
-
if (existing &&
|
|
185752
|
+
if (existing && isDeepStrictEqual2(existing.data, localConnector)) {
|
|
185720
185753
|
continue;
|
|
185721
185754
|
}
|
|
185722
185755
|
const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.integrationType}.${CONFIG_FILE_EXTENSION}`);
|
|
@@ -193925,7 +193958,7 @@ var {
|
|
|
193925
193958
|
// package.json
|
|
193926
193959
|
var package_default = {
|
|
193927
193960
|
name: "base44",
|
|
193928
|
-
version: "0.0.
|
|
193961
|
+
version: "0.0.34",
|
|
193929
193962
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
193930
193963
|
type: "module",
|
|
193931
193964
|
bin: {
|
|
@@ -194130,14 +194163,11 @@ async function pullAgentsAction() {
|
|
|
194130
194163
|
successMessage: "Agents fetched successfully",
|
|
194131
194164
|
errorMessage: "Failed to fetch agents"
|
|
194132
194165
|
});
|
|
194133
|
-
|
|
194134
|
-
return { outroMessage: "No agents found on Base44" };
|
|
194135
|
-
}
|
|
194136
|
-
const { written, deleted } = await runTask("Writing agent files", async () => {
|
|
194166
|
+
const { written, deleted } = await runTask("Syncing agent files", async () => {
|
|
194137
194167
|
return await writeAgents(agentsDir, remoteAgents.items);
|
|
194138
194168
|
}, {
|
|
194139
|
-
successMessage: "Agent files
|
|
194140
|
-
errorMessage: "Failed to
|
|
194169
|
+
successMessage: "Agent files synced successfully",
|
|
194170
|
+
errorMessage: "Failed to sync agent files"
|
|
194141
194171
|
});
|
|
194142
194172
|
if (written.length > 0) {
|
|
194143
194173
|
R2.success(`Written: ${written.join(", ")}`);
|
|
@@ -194145,6 +194175,9 @@ async function pullAgentsAction() {
|
|
|
194145
194175
|
if (deleted.length > 0) {
|
|
194146
194176
|
R2.warn(`Deleted: ${deleted.join(", ")}`);
|
|
194147
194177
|
}
|
|
194178
|
+
if (written.length === 0 && deleted.length === 0) {
|
|
194179
|
+
R2.info("All agents are already up to date");
|
|
194180
|
+
}
|
|
194148
194181
|
return {
|
|
194149
194182
|
outroMessage: `Pulled ${remoteAgents.total} agents to ${agentsDir}`
|
|
194150
194183
|
};
|
|
@@ -200605,4 +200638,4 @@ export {
|
|
|
200605
200638
|
CLIExitError
|
|
200606
200639
|
};
|
|
200607
200640
|
|
|
200608
|
-
//# debugId=
|
|
200641
|
+
//# debugId=A63E54C6B4BA468A64756E2164756E21
|