@adkit/cli 1.13.12 → 1.13.14
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 +2 -1
- package/dist/cli.js +79 -12
- package/package.json +2 -6
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1120,16 +1120,29 @@ function unwrapList(data) {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
1122
1122
|
// src/commands/projects.ts
|
|
1123
|
+
async function createProject(client, options) {
|
|
1124
|
+
const response = await client.post("/manage/projects", options);
|
|
1125
|
+
if (!isCreateProjectResponse(response)) throw new Error("Unexpected response from AdKit project creation");
|
|
1126
|
+
writeConfig({ selectedProject: response.projectId });
|
|
1127
|
+
return {
|
|
1128
|
+
id: response.projectId,
|
|
1129
|
+
name: response.name,
|
|
1130
|
+
website: response.website,
|
|
1131
|
+
workspaceId: response.workspaceId,
|
|
1132
|
+
current: true
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1123
1135
|
async function listProjects(client, options = {}) {
|
|
1124
1136
|
const qs = queryString({ query: options.query, limit: options.limit });
|
|
1125
1137
|
const response = await client.get(`/manage/projects${qs}`);
|
|
1126
1138
|
if (!isProjectsResponse(response)) throw new Error("Unexpected response from AdKit projects");
|
|
1127
1139
|
const config = readConfig() ?? {};
|
|
1128
|
-
|
|
1140
|
+
const projects = response.projects.map((project) => mapProjectEntry(project, config.selectedProject));
|
|
1141
|
+
return { projects, workspaces: response.workspaces ?? [] };
|
|
1129
1142
|
}
|
|
1130
1143
|
async function useProject(client, projectId) {
|
|
1131
|
-
const
|
|
1132
|
-
const project = projects.find((entry) => entry.id === projectId);
|
|
1144
|
+
const result = await listProjects(client, { limit: "50" });
|
|
1145
|
+
const project = result.projects.find((entry) => entry.id === projectId);
|
|
1133
1146
|
if (!project) throw new Error(`Project not found: ${projectId}`);
|
|
1134
1147
|
writeConfig({ selectedProject: projectId });
|
|
1135
1148
|
}
|
|
@@ -1143,13 +1156,20 @@ function isProjectsResponse(value) {
|
|
|
1143
1156
|
if (!("projects" in value)) return false;
|
|
1144
1157
|
return Array.isArray(value.projects);
|
|
1145
1158
|
}
|
|
1159
|
+
function isCreateProjectResponse(value) {
|
|
1160
|
+
if (!value || typeof value !== "object") return false;
|
|
1161
|
+
if (!("projectId" in value) || typeof value.projectId !== "string") return false;
|
|
1162
|
+
if (!("name" in value) || typeof value.name !== "string") return false;
|
|
1163
|
+
return "website" in value && typeof value.website === "string";
|
|
1164
|
+
}
|
|
1146
1165
|
function mapProjectEntry(project, selectedProject) {
|
|
1147
1166
|
const entry = {
|
|
1148
1167
|
id: project.projectId,
|
|
1149
1168
|
name: project.name,
|
|
1150
1169
|
website: project.website,
|
|
1151
1170
|
role: project.role,
|
|
1152
|
-
platforms: project.platforms
|
|
1171
|
+
platforms: project.platforms,
|
|
1172
|
+
workspaceId: project.workspaceId
|
|
1153
1173
|
};
|
|
1154
1174
|
if (selectedProject === project.projectId) entry.current = true;
|
|
1155
1175
|
return entry;
|
|
@@ -4609,7 +4629,7 @@ Commands:
|
|
|
4609
4629
|
library Browse ads and advertisers
|
|
4610
4630
|
studio Create and manage Studio ads
|
|
4611
4631
|
manage Manage ad platforms and drafts
|
|
4612
|
-
projects Manage projects (list, use, current)
|
|
4632
|
+
projects Manage projects (list, create, use, current)
|
|
4613
4633
|
|
|
4614
4634
|
Advanced:
|
|
4615
4635
|
logout Remove stored API key
|
|
@@ -6096,22 +6116,34 @@ ${FLAG.data}
|
|
|
6096
6116
|
--campaign-ids <ids> Comma-separated campaign IDs for filtered reads
|
|
6097
6117
|
--campaign <id> Parent campaign ID (create only)
|
|
6098
6118
|
--name <name> Ad group name
|
|
6099
|
-
--status <s> active, paused
|
|
6119
|
+
--status <s> active, paused (create default: paused)
|
|
6100
6120
|
--budget-daily <n> Daily budget in account currency
|
|
6101
6121
|
--budget-lifetime <n> Lifetime budget in account currency
|
|
6102
6122
|
--start-date <value> Optional TikTok schedule datetime; omit to start now
|
|
6103
6123
|
--end-date <value> Optional TikTok schedule datetime; required with lifetime budget
|
|
6104
6124
|
--billing-event <s> cpc, cpm, ocpm
|
|
6105
6125
|
--bid-strategy <s> bid_type_no_bid, bid_type_custom, bid_type_max_conversion
|
|
6106
|
-
--optimization <s> click, convert, lead_generation, video_view, reach
|
|
6126
|
+
--optimization <s> click, convert, lead_generation, video_view, reach, value
|
|
6107
6127
|
--bid-amount <n> Custom bid in account currency; conversion/OCPM maps to cost per conversion
|
|
6108
6128
|
--event-type <s> purchase, add_to_cart, view_content, complete_registration, lead, submit_form
|
|
6109
6129
|
--pixel <id> Pixel ID; falls back to account default pixel when conversion is used
|
|
6110
6130
|
--placement <ids> Override TikTok placement IDs (publish default: PLACEMENT_TIKTOK)
|
|
6111
6131
|
|
|
6132
|
+
Value Optimization (website):
|
|
6133
|
+
--optimization value bids on purchase value. It needs --event-type purchase plus a pixel (--pixel, or the account default), and rejects --bid-strategy, --bid-amount, and any --billing-event other than ocpm.
|
|
6134
|
+
targetRoas has no flag \u2014 send it with --data. targetRoas set = Minimum ROAS (0.01-1000, where 1.5 = 150%); targetRoas omitted = Highest Value.
|
|
6135
|
+
update only retunes targetRoas on an ad group that already uses Value Optimization. TikTok cannot move an ordinary ad group onto it \u2014 create a new ad group instead.
|
|
6136
|
+
TikTok checks account and pixel eligibility, so a valid payload can still be rejected at publish.
|
|
6137
|
+
|
|
6112
6138
|
Examples:
|
|
6113
6139
|
adkit manage tiktok ad-groups create --campaign 1770 --name "US Broad" --budget-daily 50 --billing-event cpc --optimization click
|
|
6114
|
-
adkit manage tiktok ad-groups create --data '{"adGroups":[{"campaignId":"1770","name":"Purchase","budget":{"daily":50},"startDate":"2026-05-15 12:00:00","bidAmount":80,"conversion":{"eventType":"purchase"},"targeting":{"geoLocations":{"include":[{"type":"country","country":"US"}]}}}]}'
|
|
6140
|
+
adkit manage tiktok ad-groups create --data '{"adGroups":[{"campaignId":"1770","name":"Purchase","budget":{"daily":50},"startDate":"2026-05-15 12:00:00","bidAmount":80,"conversion":{"eventType":"purchase"},"targeting":{"geoLocations":{"include":[{"type":"country","country":"US"}]}}}]}'
|
|
6141
|
+
# Highest Value
|
|
6142
|
+
adkit manage tiktok ad-groups create --campaign 1770 --name "Highest value" --budget-daily 50 --optimization value --event-type purchase
|
|
6143
|
+
# Minimum ROAS 1.5x
|
|
6144
|
+
adkit manage tiktok ad-groups create --data '{"adGroups":[{"campaignId":"1770","name":"Min ROAS 1.5x","budget":{"daily":50},"optimization":"value","targetRoas":1.5,"conversion":{"eventType":"purchase"}}]}'
|
|
6145
|
+
# Retune the ROAS target on an existing Value Optimization ad group
|
|
6146
|
+
adkit manage tiktok ad-groups update 1770000000000000000 --data '{"targetRoas":2}'`.trim(),
|
|
6115
6147
|
"tiktok ads": `adkit manage tiktok ads \u2014 TikTok video ads
|
|
6116
6148
|
|
|
6117
6149
|
list List ads
|
|
@@ -6719,15 +6751,24 @@ Examples:
|
|
|
6719
6751
|
projects: `adkit projects \u2014 Manage projects
|
|
6720
6752
|
|
|
6721
6753
|
list List accessible projects
|
|
6754
|
+
create Create a project and make it active
|
|
6722
6755
|
use <id> Switch active project
|
|
6723
6756
|
current Show active project
|
|
6724
6757
|
|
|
6725
6758
|
Flags:
|
|
6726
6759
|
--query <text> Filter projects by name or website
|
|
6727
6760
|
--limit <n> Max results (default: 20, max: 50)
|
|
6761
|
+
--name <text> Project or business name (create)
|
|
6762
|
+
--website <url> Project website URL or domain (create)
|
|
6763
|
+
--workspace <id> Target workspace ID (create)
|
|
6764
|
+
--description <t> Optional business description (create)
|
|
6765
|
+
--industry <text> Optional business industry (create)
|
|
6766
|
+
--category <text> Optional business category (create)
|
|
6767
|
+
--tags <a,b> Optional comma-separated tags (create)
|
|
6728
6768
|
|
|
6729
6769
|
Examples:
|
|
6730
6770
|
adkit projects list
|
|
6771
|
+
adkit projects create --name "Acme" --website acme.com
|
|
6731
6772
|
adkit projects use proj_abc123`.trim()
|
|
6732
6773
|
};
|
|
6733
6774
|
var STUDIO_GENERATE_HELP_FULL = `adkit studio generate \u2014 Create ad images with AI
|
|
@@ -8693,13 +8734,18 @@ ${pageInfo}`);
|
|
|
8693
8734
|
case void 0: {
|
|
8694
8735
|
const query = typeof flags.query === "string" ? flags.query : void 0;
|
|
8695
8736
|
const limit = typeof flags.limit === "string" ? flags.limit : void 0;
|
|
8696
|
-
const
|
|
8697
|
-
if (
|
|
8737
|
+
const result = await listProjects(client, { query, limit });
|
|
8738
|
+
if (wantsJson(flags)) printResult(result, flags);
|
|
8698
8739
|
else {
|
|
8699
|
-
|
|
8740
|
+
if (result.projects.length === 0) console.log("No projects found.");
|
|
8741
|
+
for (const p of result.projects) {
|
|
8700
8742
|
const marker = p.current ? "* " : " ";
|
|
8701
8743
|
console.log(`${marker}${p.name} (${p.id})`);
|
|
8702
8744
|
}
|
|
8745
|
+
if (result.workspaces.length > 0) {
|
|
8746
|
+
console.log("\nWorkspaces:");
|
|
8747
|
+
for (const workspace of result.workspaces) console.log(` ${workspace.name} (${workspace.workspaceId})`);
|
|
8748
|
+
}
|
|
8703
8749
|
}
|
|
8704
8750
|
break;
|
|
8705
8751
|
}
|
|
@@ -8709,6 +8755,27 @@ ${pageInfo}`);
|
|
|
8709
8755
|
else console.log(`Active project: ${project.id}`);
|
|
8710
8756
|
break;
|
|
8711
8757
|
}
|
|
8758
|
+
case "create": {
|
|
8759
|
+
const name = requireFlag(flags, "name", 'Run: adkit projects create --name "Acme" --website acme.com');
|
|
8760
|
+
const website = requireFlag(flags, "website", 'Run: adkit projects create --name "Acme" --website acme.com');
|
|
8761
|
+
const descriptionValues = collectFlagValues(flags, "description");
|
|
8762
|
+
const description = descriptionValues.length > 0 ? descriptionValues.join(" ") : void 0;
|
|
8763
|
+
const tagsFlag = typeof flags.tags === "string" ? flags.tags : void 0;
|
|
8764
|
+
const tagParts = tagsFlag ? tagsFlag.split(",") : [];
|
|
8765
|
+
const tags = tagParts.map((tag) => tag.trim()).filter(Boolean);
|
|
8766
|
+
const project = await createProject(client, {
|
|
8767
|
+
name,
|
|
8768
|
+
website,
|
|
8769
|
+
description,
|
|
8770
|
+
industry: typeof flags.industry === "string" ? flags.industry : void 0,
|
|
8771
|
+
category: typeof flags.category === "string" ? flags.category : void 0,
|
|
8772
|
+
tags: tags.length > 0 ? tags : void 0,
|
|
8773
|
+
workspaceId: typeof flags.workspace === "string" ? flags.workspace : void 0
|
|
8774
|
+
});
|
|
8775
|
+
if (wantsJson(flags)) printResult(project, flags);
|
|
8776
|
+
else console.log(`Created and selected project: ${project.name} (${project.id})`);
|
|
8777
|
+
break;
|
|
8778
|
+
}
|
|
8712
8779
|
case "use": {
|
|
8713
8780
|
const projectId = args[2];
|
|
8714
8781
|
if (!projectId) throw new CliError("MISSING_ARGUMENT", "Missing required argument: `<project-id>`", "Run: adkit projects use <project-id>");
|
|
@@ -8717,7 +8784,7 @@ ${pageInfo}`);
|
|
|
8717
8784
|
break;
|
|
8718
8785
|
}
|
|
8719
8786
|
default:
|
|
8720
|
-
throw new CliError("UNKNOWN_COMMAND", `Unknown action: projects ${action}`, "Available: list, use, current");
|
|
8787
|
+
throw new CliError("UNKNOWN_COMMAND", `Unknown action: projects ${action}`, "Available: list, create, use, current");
|
|
8721
8788
|
}
|
|
8722
8789
|
return;
|
|
8723
8790
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adkit/cli",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.14",
|
|
4
4
|
"description": "The Ads CLI for AI agents — manage Meta & Google ad campaigns, browse the ad library, and generate creatives from your terminal.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ads cli",
|
|
@@ -18,11 +18,7 @@
|
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
|
-
"
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "git+https://github.com/adkit/adkit-monorepo.git",
|
|
24
|
-
"directory": "packages/cli"
|
|
25
|
-
},
|
|
21
|
+
"homepage": "https://adkit.so",
|
|
26
22
|
"type": "module",
|
|
27
23
|
"bin": {
|
|
28
24
|
"adkit": "dist/cli.js"
|