@erdoai/cli 0.178.1 → 0.181.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/dist/index.js +144 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124,7 +124,7 @@ function parseCSV(text) {
|
|
|
124
124
|
|
|
125
125
|
// src/index.ts
|
|
126
126
|
import { password, select } from "@inquirer/prompts";
|
|
127
|
-
import { Command as Command2, Option as Option2 } from "commander";
|
|
127
|
+
import { Argument, Command as Command2, Option as Option2 } from "commander";
|
|
128
128
|
|
|
129
129
|
// src/config.ts
|
|
130
130
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -223,6 +223,7 @@ function resolveOrgId(account, override) {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
// src/client.ts
|
|
226
|
+
var MEMBER_ACCESS_LEVELS = ["read_only", "full"];
|
|
226
227
|
function formatOrg(name, slug) {
|
|
227
228
|
if (name && slug) return `${name} (${slug})`;
|
|
228
229
|
return name || slug || "";
|
|
@@ -364,6 +365,27 @@ var ErdoClient = class {
|
|
|
364
365
|
input
|
|
365
366
|
);
|
|
366
367
|
}
|
|
368
|
+
setPaidMediaCampaignBidding(campaignId, input) {
|
|
369
|
+
return this.request(
|
|
370
|
+
"POST",
|
|
371
|
+
`/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/bidding`,
|
|
372
|
+
input
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
setPaidMediaCampaignNetworkSettings(campaignId, input) {
|
|
376
|
+
return this.request(
|
|
377
|
+
"POST",
|
|
378
|
+
`/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/network-settings`,
|
|
379
|
+
input
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
setPaidMediaNegativeKeywords(campaignId, input) {
|
|
383
|
+
return this.request(
|
|
384
|
+
"POST",
|
|
385
|
+
`/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/negative-keywords`,
|
|
386
|
+
input
|
|
387
|
+
);
|
|
388
|
+
}
|
|
367
389
|
setPaidMediaCampaignConversionGoals(campaignId, input) {
|
|
368
390
|
return this.request(
|
|
369
391
|
"POST",
|
|
@@ -406,6 +428,15 @@ var ErdoClient = class {
|
|
|
406
428
|
creditBalance() {
|
|
407
429
|
return this.request("GET", "/v1/credits/balance");
|
|
408
430
|
}
|
|
431
|
+
listMCPToolsets() {
|
|
432
|
+
return this.request("GET", "/v1/mcp/toolsets");
|
|
433
|
+
}
|
|
434
|
+
searchMCPTools(query, toolset, limit) {
|
|
435
|
+
const params = new URLSearchParams({ query });
|
|
436
|
+
if (toolset) params.set("toolset", toolset);
|
|
437
|
+
if (limit !== void 0) params.set("limit", String(limit));
|
|
438
|
+
return this.request("GET", `/v1/mcp/tools?${params.toString()}`);
|
|
439
|
+
}
|
|
409
440
|
async grantCredits(organization, amount, reason) {
|
|
410
441
|
try {
|
|
411
442
|
const result = await this.request(
|
|
@@ -1840,6 +1871,15 @@ var ErdoClient = class {
|
|
|
1840
1871
|
listIntegrations() {
|
|
1841
1872
|
return this.request("GET", "/v1/integrations");
|
|
1842
1873
|
}
|
|
1874
|
+
// What teammates may do through a shared connection made with someone's own
|
|
1875
|
+
// login: `read_only` (the default) or `full`. The owner always has full access.
|
|
1876
|
+
setIntegrationMemberAccess(integrationId, memberAccess) {
|
|
1877
|
+
return this.request(
|
|
1878
|
+
"POST",
|
|
1879
|
+
`/v1/integrations/${encodeURIComponent(integrationId)}/member-access`,
|
|
1880
|
+
{ member_access: memberAccess }
|
|
1881
|
+
);
|
|
1882
|
+
}
|
|
1843
1883
|
// Start or stop lending a connection to the organizations this one manages.
|
|
1844
1884
|
// `managed_organizations` names the orgs it now serves — empty when this org
|
|
1845
1885
|
// manages nobody yet, which is a truthful answer rather than a failure.
|
|
@@ -2476,7 +2516,8 @@ function formatIntegrationListRow(i) {
|
|
|
2476
2516
|
const unreadable = i.identity_unreadable ? " identity unreadable" : "";
|
|
2477
2517
|
const unchecked = i.identity_unchecked ? " identity not checked" : "";
|
|
2478
2518
|
const connectorAccount = i.connector_account_id ? ` connector_account_id=${i.connector_account_id}` : "";
|
|
2479
|
-
|
|
2519
|
+
const memberAccess = i.member_access ? ` members: ${i.member_access}` : "";
|
|
2520
|
+
return `${i.app} ${i.status} ${i.auth_type} ${i.name} ${i.id}${connectorAccount}${provided}${memberAccess}${unreadable}${unchecked}`;
|
|
2480
2521
|
}
|
|
2481
2522
|
function identityNotes(rows) {
|
|
2482
2523
|
const notes = [];
|
|
@@ -2828,6 +2869,30 @@ function compactEvalRunAttribution(run) {
|
|
|
2828
2869
|
var program = new Command2();
|
|
2829
2870
|
program.name("erdo").description("Erdo CLI").version(pkg.version);
|
|
2830
2871
|
bindScopeFlags(program);
|
|
2872
|
+
var mcpCatalog = program.command("mcp").description("Inspect the MCP tool catalog AI clients load");
|
|
2873
|
+
mcpCatalog.command("toolsets").description("List MCP toolsets and how many tools each one contains").action(async () => {
|
|
2874
|
+
try {
|
|
2875
|
+
print(await new ErdoClient().listMCPToolsets());
|
|
2876
|
+
} catch (error) {
|
|
2877
|
+
fail(error);
|
|
2878
|
+
}
|
|
2879
|
+
});
|
|
2880
|
+
mcpCatalog.command("tools").description("Search registered MCP tools").command("search <query...>").description("Find MCP tools by words in the name or description").option("--toolset <id>", "Limit the search to one toolset").option("--limit <n>", "Maximum matches, from 1 to 20").action(async (query, options) => {
|
|
2881
|
+
try {
|
|
2882
|
+
const text = query.join(" ").trim();
|
|
2883
|
+
if (!text) throw new Error("query is required");
|
|
2884
|
+
let limit;
|
|
2885
|
+
if (options.limit !== void 0) {
|
|
2886
|
+
if (!/^[0-9]+$/.test(options.limit) || Number(options.limit) < 1 || Number(options.limit) > 20) {
|
|
2887
|
+
throw new Error("--limit must be an integer from 1 to 20");
|
|
2888
|
+
}
|
|
2889
|
+
limit = Number(options.limit);
|
|
2890
|
+
}
|
|
2891
|
+
print(await new ErdoClient().searchMCPTools(text, options.toolset, limit));
|
|
2892
|
+
} catch (error) {
|
|
2893
|
+
fail(error);
|
|
2894
|
+
}
|
|
2895
|
+
});
|
|
2831
2896
|
var credits = program.command("credits").description("Read organization credits");
|
|
2832
2897
|
credits.command("balance").description("Read the current organization's credit balance (use --org to select)").action(async () => {
|
|
2833
2898
|
try {
|
|
@@ -3025,6 +3090,66 @@ paidMediaCampaigns.command("list").description("List the organization's owned Go
|
|
|
3025
3090
|
fail(e);
|
|
3026
3091
|
}
|
|
3027
3092
|
});
|
|
3093
|
+
function parsePaidMediaBool(value, name) {
|
|
3094
|
+
if (value === "true") return true;
|
|
3095
|
+
if (value === "false") return false;
|
|
3096
|
+
throw new Error(`${name} must be true or false`);
|
|
3097
|
+
}
|
|
3098
|
+
function parsePaidMediaKeyword(value) {
|
|
3099
|
+
const split = value.lastIndexOf(":");
|
|
3100
|
+
const text = split > 0 ? value.slice(0, split).trim() : "";
|
|
3101
|
+
const match = (split > 0 ? value.slice(split + 1) : "").trim().toUpperCase();
|
|
3102
|
+
if (!text || match !== "EXACT" && match !== "PHRASE" && match !== "BROAD") {
|
|
3103
|
+
throw new Error(`keyword ${JSON.stringify(value)} must be text:EXACT, text:PHRASE, or text:BROAD`);
|
|
3104
|
+
}
|
|
3105
|
+
return { text, match_type: match };
|
|
3106
|
+
}
|
|
3107
|
+
paidMediaCampaigns.command("bidding <campaignId>").description("Set a campaign's bidding strategy, including clearing a target CPA (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").requiredOption("--strategy <strategy>", "MAXIMIZE_CONVERSIONS, TARGET_CPA, MAXIMIZE_CONVERSION_VALUE, TARGET_ROAS, or MAXIMIZE_CLICKS").option("--target-cpa-micros <micros>", "target CPA in micros").option("--clear-target-cpa", "clear Maximize Conversions target CPA").option("--target-roas <roas>", "target ROAS").option("--cpc-bid-ceiling-micros <micros>", "CPC ceiling in micros for MAXIMIZE_CLICKS").option("--confirm-detach-portfolio", "detach a portfolio bidding strategy").option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
|
|
3108
|
+
try {
|
|
3109
|
+
print(await new ErdoClient().setPaidMediaCampaignBidding(campaignId, {
|
|
3110
|
+
provider: "google_ads",
|
|
3111
|
+
customer_id: opts.customerId,
|
|
3112
|
+
bidding_strategy_type: opts.strategy,
|
|
3113
|
+
target_cpa_micros: opts.targetCpaMicros === void 0 ? void 0 : Number(opts.targetCpaMicros),
|
|
3114
|
+
clear_target_cpa: opts.clearTargetCpa || void 0,
|
|
3115
|
+
target_roas: opts.targetRoas === void 0 ? void 0 : Number(opts.targetRoas),
|
|
3116
|
+
cpc_bid_ceiling_micros: opts.cpcBidCeilingMicros === void 0 ? void 0 : Number(opts.cpcBidCeilingMicros),
|
|
3117
|
+
confirm_detach_portfolio: opts.confirmDetachPortfolio || void 0,
|
|
3118
|
+
reason: opts.reason
|
|
3119
|
+
}));
|
|
3120
|
+
} catch (e) {
|
|
3121
|
+
fail(e);
|
|
3122
|
+
}
|
|
3123
|
+
});
|
|
3124
|
+
paidMediaCampaigns.command("network-settings <campaignId>").description("Set Search Partners and Display on a Search campaign (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").option("--search-partners <true|false>", "target_search_network, Search Partners").option("--display <true|false>", "target_content_network, Display").option("--confirm-network-expansion", "required to enable Search Partners or Display").option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
|
|
3125
|
+
try {
|
|
3126
|
+
if (opts.searchPartners === void 0 && opts.display === void 0) throw new Error("set --search-partners or --display");
|
|
3127
|
+
print(await new ErdoClient().setPaidMediaCampaignNetworkSettings(campaignId, {
|
|
3128
|
+
provider: "google_ads",
|
|
3129
|
+
customer_id: opts.customerId,
|
|
3130
|
+
target_search_network: opts.searchPartners === void 0 ? void 0 : parsePaidMediaBool(opts.searchPartners, "--search-partners"),
|
|
3131
|
+
target_content_network: opts.display === void 0 ? void 0 : parsePaidMediaBool(opts.display, "--display"),
|
|
3132
|
+
confirm_network_expansion: opts.confirmNetworkExpansion || void 0,
|
|
3133
|
+
reason: opts.reason
|
|
3134
|
+
}));
|
|
3135
|
+
} catch (e) {
|
|
3136
|
+
fail(e);
|
|
3137
|
+
}
|
|
3138
|
+
});
|
|
3139
|
+
paidMediaCampaigns.command("negative-keywords <campaignId>").description("Add or remove campaign or ad-group negative keywords (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").option("--adgroup-id <id>", "edit this ad group's negatives").option("--add <text:MATCH>", "keyword to add, repeatable", (value, previous) => previous.concat(value), []).option("--remove <text:MATCH>", "keyword to remove, repeatable", (value, previous) => previous.concat(value), []).option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
|
|
3140
|
+
try {
|
|
3141
|
+
print(await new ErdoClient().setPaidMediaNegativeKeywords(campaignId, {
|
|
3142
|
+
provider: "google_ads",
|
|
3143
|
+
customer_id: opts.customerId,
|
|
3144
|
+
adgroup_id: opts.adgroupId,
|
|
3145
|
+
add: opts.add.map(parsePaidMediaKeyword),
|
|
3146
|
+
remove: opts.remove.map(parsePaidMediaKeyword),
|
|
3147
|
+
reason: opts.reason
|
|
3148
|
+
}));
|
|
3149
|
+
} catch (e) {
|
|
3150
|
+
fail(e);
|
|
3151
|
+
}
|
|
3152
|
+
});
|
|
3028
3153
|
paidMediaCampaigns.command("conversion-goals <campaignId>").description("Set a campaign's custom conversion goal to exactly these conversion action ids").requiredOption("--actions <ids>", "comma-separated conversion action ids").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result").action(async (campaignId, opts) => {
|
|
3029
3154
|
try {
|
|
3030
3155
|
const ids = opts.actions.split(",").map((id) => id.trim()).filter(Boolean);
|
|
@@ -3041,6 +3166,10 @@ paidMediaCampaigns.command("conversion-goals <campaignId>").description("Set a c
|
|
|
3041
3166
|
if (result.status === "ready") {
|
|
3042
3167
|
console.log("status: ready");
|
|
3043
3168
|
if (result.goal_config_level) console.log(`goal config level: ${result.goal_config_level}`);
|
|
3169
|
+
} else if (result.status === "in_progress") {
|
|
3170
|
+
console.log("status: in progress (already approved; no decision pending)");
|
|
3171
|
+
console.log(`execution phase: ${result.execution_phase}`);
|
|
3172
|
+
console.log(`approval request id: ${result.approval_request_id}`);
|
|
3044
3173
|
} else {
|
|
3045
3174
|
console.log("status: pending approval");
|
|
3046
3175
|
console.log(`approval request id: ${result.approval_request_id}`);
|
|
@@ -3070,6 +3199,10 @@ paidMedia.command("conversion-actions").command("ensure").description("Find or a
|
|
|
3070
3199
|
if (result.status === "ready") {
|
|
3071
3200
|
console.log(`status: ready`);
|
|
3072
3201
|
if (result.conversion_action_id) console.log(`conversion action id: ${result.conversion_action_id}`);
|
|
3202
|
+
} else if (result.status === "in_progress") {
|
|
3203
|
+
console.log("status: in progress (already approved; no decision pending)");
|
|
3204
|
+
console.log(`execution phase: ${result.execution_phase}`);
|
|
3205
|
+
console.log(`approval request id: ${result.approval_request_id}`);
|
|
3073
3206
|
} else {
|
|
3074
3207
|
console.log(`status: pending approval`);
|
|
3075
3208
|
console.log(`approval request id: ${result.approval_request_id}`);
|
|
@@ -9699,6 +9832,15 @@ Provided to ${orgs.length} organization${orgs.length === 1 ? "" : "s"}:`);
|
|
|
9699
9832
|
fail(e);
|
|
9700
9833
|
}
|
|
9701
9834
|
});
|
|
9835
|
+
integrationsCmd.command("member-access").argument("<integration-id>").addArgument(new Argument("<member-access>", "read_only or full").choices(MEMBER_ACCESS_LEVELS)).description(
|
|
9836
|
+
"Set what teammates can do through a shared connection made with your login (connected apps and MCP servers such as GitHub): read_only lets them look things up, full also lets them make changes. You always keep full access"
|
|
9837
|
+
).action(async (integrationId, memberAccess) => {
|
|
9838
|
+
try {
|
|
9839
|
+
print(await new ErdoClient().setIntegrationMemberAccess(integrationId, memberAccess));
|
|
9840
|
+
} catch (e) {
|
|
9841
|
+
fail(e);
|
|
9842
|
+
}
|
|
9843
|
+
});
|
|
9702
9844
|
integrationsCmd.command("disconnect <app>").description("Disconnect an app \u2014 releases the stored credential and removes the connection; org admins can disconnect any of the org's connections").action(async (app) => {
|
|
9703
9845
|
try {
|
|
9704
9846
|
const client = new ErdoClient();
|