@fargowealth/fargo-ai-cli 0.8.0 → 1.0.0
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/README.md +3 -3
- package/package.json +1 -1
- package/src/agent-install.mjs +16 -8
- package/src/constants.mjs +1 -1
- package/src/lego-deploy.mjs +2 -2
- package/src/lego-migrations.mjs +3 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Requires Node.js 20.19 or newer.
|
|
|
9
9
|
## Install or upgrade
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install -g @fargowealth/fargo-ai-cli@
|
|
12
|
+
npm install -g @fargowealth/fargo-ai-cli@latest
|
|
13
13
|
fargo version
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -43,8 +43,8 @@ reused by both MCP and local CLI operations.
|
|
|
43
43
|
|
|
44
44
|
```sh
|
|
45
45
|
fargo mcp tools
|
|
46
|
-
fargo mcp call
|
|
47
|
-
fargo mcp call
|
|
46
|
+
fargo mcp call lego_app_read --args '{"action":"get","appId":"app_xxx"}'
|
|
47
|
+
fargo mcp call lego_app_read --args-file ./arguments.json
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## LEGO source snapshots
|
package/package.json
CHANGED
package/src/agent-install.mjs
CHANGED
|
@@ -7,14 +7,15 @@ import { normalizeAgentType } from "./auth.mjs";
|
|
|
7
7
|
import { CLI_VERSION } from "./constants.mjs";
|
|
8
8
|
|
|
9
9
|
const PACKAGE_NAME = "@fargowealth/fargo-ai-cli";
|
|
10
|
-
const SERVER_NAME = "fargo-
|
|
10
|
+
const SERVER_NAME = "fargo-pass";
|
|
11
|
+
const LEGACY_SERVER_NAME = "fargo-ai";
|
|
11
12
|
|
|
12
13
|
export async function installAgentMcp(rawAgent, options = {}) {
|
|
13
14
|
const agent = normalizeAgentType(rawAgent);
|
|
14
15
|
const platform = options.platform ?? process.platform;
|
|
15
16
|
const env = options.env ?? process.env;
|
|
16
17
|
const homeDirectory = options.home ?? homedir();
|
|
17
|
-
const packageSpec = `${PACKAGE_NAME}@${options.packageVersion ??
|
|
18
|
+
const packageSpec = `${PACKAGE_NAME}@${options.packageVersion ?? "latest"}`;
|
|
18
19
|
const npxCommand = options.npxCommand ?? (platform === "darwin"
|
|
19
20
|
? await resolveNpxCommand({ env, execPath: options.execPath, platform })
|
|
20
21
|
: "npx");
|
|
@@ -96,10 +97,14 @@ async function installJsonMcp(agent, server, options) {
|
|
|
96
97
|
env: server.env
|
|
97
98
|
};
|
|
98
99
|
const previousServer = config.mcpServers?.[SERVER_NAME];
|
|
99
|
-
const
|
|
100
|
+
const hadLegacyServer = Boolean(config.mcpServers?.[LEGACY_SERVER_NAME]);
|
|
101
|
+
const changed = hadLegacyServer || JSON.stringify(previousServer) !== JSON.stringify(nextServer);
|
|
100
102
|
|
|
101
103
|
if (changed) {
|
|
102
|
-
|
|
104
|
+
const nextServers = { ...(config.mcpServers ?? {}) };
|
|
105
|
+
delete nextServers[LEGACY_SERVER_NAME];
|
|
106
|
+
nextServers[SERVER_NAME] = nextServer;
|
|
107
|
+
config.mcpServers = nextServers;
|
|
103
108
|
await writeConfig(options.configPath, config);
|
|
104
109
|
}
|
|
105
110
|
|
|
@@ -114,9 +119,12 @@ async function installHostCliMcp(agent, server, options) {
|
|
|
114
119
|
const removeArgs = agent === "codex"
|
|
115
120
|
? ["mcp", "remove", SERVER_NAME]
|
|
116
121
|
: ["mcp", "remove", "--scope", "user", SERVER_NAME];
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
for (const candidate of [SERVER_NAME, LEGACY_SERVER_NAME]) {
|
|
123
|
+
const candidateRemoveArgs = removeArgs.map((value) => value === SERVER_NAME ? candidate : value);
|
|
124
|
+
const removeResult = await runHostCommand(command, candidateRemoveArgs, options);
|
|
125
|
+
if (removeResult.exitCode !== 0 && !isMissingServer(removeResult)) {
|
|
126
|
+
throw new Error(`${agentLabel(agent)} could not replace the existing ${candidate} MCP entry: ${commandError(removeResult)}`);
|
|
127
|
+
}
|
|
120
128
|
}
|
|
121
129
|
|
|
122
130
|
const environmentArgs = Object.entries(server.env).flatMap(([key, value]) => agent === "codex"
|
|
@@ -181,7 +189,7 @@ function installationResult(agent, packageSpec, changed, extra) {
|
|
|
181
189
|
package: packageSpec,
|
|
182
190
|
...extra,
|
|
183
191
|
next_action: agent === "workbuddy"
|
|
184
|
-
? "Open WorkBuddy Custom Connectors, trust and enable fargo-
|
|
192
|
+
? "Open WorkBuddy Custom Connectors, trust and enable fargo-pass, then start a new task."
|
|
185
193
|
: `Restart ${agentLabel(agent)} or start a new Agent session, then call ping_who_am_i.`
|
|
186
194
|
};
|
|
187
195
|
}
|
package/src/constants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.
|
|
1
|
+
export const CLI_VERSION = "1.0.0";
|
|
2
2
|
export const DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
3
3
|
export const DEFAULT_AUTH_URL = "https://auth.fargowealth.app";
|
|
4
4
|
export const DEFAULT_API_URL = "https://mcp.fargowealth.app";
|
package/src/lego-deploy.mjs
CHANGED
|
@@ -60,8 +60,8 @@ export async function deployLocalLegoApp(store, input, options = {}) {
|
|
|
60
60
|
const deployArtifactId = uploadedArtifact.deployArtifact?.id;
|
|
61
61
|
if (!deployArtifactId) throw new Error("Deployment artifact upload did not return deployArtifact.id");
|
|
62
62
|
|
|
63
|
-
const tool = target === "pages" ? "lego_pages_deploy" : "lego_worker_deploy";
|
|
64
63
|
const deploymentInput = {
|
|
64
|
+
action: target,
|
|
65
65
|
appId: input.appId,
|
|
66
66
|
deployArtifactId,
|
|
67
67
|
entrypoint: artifact.entrypoint,
|
|
@@ -70,7 +70,7 @@ export async function deployLocalLegoApp(store, input, options = {}) {
|
|
|
70
70
|
versionName: input.versionName,
|
|
71
71
|
...(sourceSnapshotId ? { sourceSnapshotId } : {})
|
|
72
72
|
};
|
|
73
|
-
const deployment = mcpToolPayload(await callMcpTool(store,
|
|
73
|
+
const deployment = mcpToolPayload(await callMcpTool(store, "lego_deploy_prepare", deploymentInput, options));
|
|
74
74
|
|
|
75
75
|
return {
|
|
76
76
|
appId: input.appId,
|
package/src/lego-migrations.mjs
CHANGED
|
@@ -14,7 +14,7 @@ export async function planLegoMigrations(store, input, options = {}) {
|
|
|
14
14
|
|
|
15
15
|
async function buildMigrationPlan(store, input, options) {
|
|
16
16
|
const local = await readMigrationDirectory(input.directory, { tablePrefix: input.tablePrefix });
|
|
17
|
-
const remote = mcpToolPayload(await callMcpTool(store, "
|
|
17
|
+
const remote = mcpToolPayload(await callMcpTool(store, "lego_database", { action: "migrations_list", appId: input.appId }, options));
|
|
18
18
|
const applied = new Map((remote.migrations ?? []).map((migration) => [String(migration.version), migration]));
|
|
19
19
|
const migrations = local.map((migration) => {
|
|
20
20
|
const existing = applied.get(migration.version);
|
|
@@ -62,7 +62,8 @@ export async function applyLegoMigrations(store, input, options = {}) {
|
|
|
62
62
|
|
|
63
63
|
const applied = [];
|
|
64
64
|
for (const migration of plan.migrations.filter((item) => item.status === "pending")) {
|
|
65
|
-
const result = mcpToolPayload(await callMcpTool(store, "
|
|
65
|
+
const result = mcpToolPayload(await callMcpTool(store, "lego_database", {
|
|
66
|
+
action: "migration_apply",
|
|
66
67
|
appId: input.appId,
|
|
67
68
|
allowDataMigrations: migration.impact.dataStatementCount > 0 && input.allowDataMigrations === true,
|
|
68
69
|
contentSha256: migration.contentSha256,
|