@adkit/cli 1.13.13 → 1.13.15
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 +73 -14
- 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
|
|
@@ -5168,7 +5188,7 @@ Notes:
|
|
|
5168
5188
|
|
|
5169
5189
|
Examples:
|
|
5170
5190
|
adkit manage meta lead-forms list --page pg_123`;
|
|
5171
|
-
var GOOGLE_ASSET_HELP = `adkit manage google assets \u2014
|
|
5191
|
+
var GOOGLE_ASSET_HELP = `adkit manage google assets \u2014 Google manual and read-only location assets
|
|
5172
5192
|
|
|
5173
5193
|
list List reusable assets
|
|
5174
5194
|
create Create a reusable asset
|
|
@@ -5178,7 +5198,7 @@ var GOOGLE_ASSET_HELP = `adkit manage google assets \u2014 Reusable Google manua
|
|
|
5178
5198
|
<id> View asset details
|
|
5179
5199
|
|
|
5180
5200
|
Flags (list):
|
|
5181
|
-
--type <type> callout, sitelink, structured-snippet
|
|
5201
|
+
--type <type> callout, sitelink, structured-snippet, call, location
|
|
5182
5202
|
--scope <scope> account, campaign, ad-group
|
|
5183
5203
|
--scope-id <id> Google campaign/ad group ID (platformId); required for campaign/ad-group scope
|
|
5184
5204
|
|
|
@@ -5202,12 +5222,13 @@ Examples:
|
|
|
5202
5222
|
adkit manage google assets detach asset:123 --type callout --scope campaign --scope-id 456 --account 1234567890
|
|
5203
5223
|
|
|
5204
5224
|
Notes:
|
|
5225
|
+
Location assets are read-only and available through list --type location.
|
|
5205
5226
|
Raw callout text and "text|url" sitelinks exact-match reuse an existing asset first, otherwise AdKit creates and attaches a new one.
|
|
5206
5227
|
A single reusable asset can be attached to multiple account/campaign/ad-group scopes over time.
|
|
5207
5228
|
Use google assets when you want reusable libraries, account-level links, or richer sitelinks via --data.
|
|
5208
5229
|
|
|
5209
5230
|
Run --help full for all fields and advanced options.`;
|
|
5210
|
-
var GOOGLE_ASSET_HELP_FULL = `adkit manage google assets \u2014
|
|
5231
|
+
var GOOGLE_ASSET_HELP_FULL = `adkit manage google assets \u2014 Google manual and read-only location assets
|
|
5211
5232
|
|
|
5212
5233
|
list List reusable assets
|
|
5213
5234
|
create Create a reusable asset
|
|
@@ -5217,7 +5238,7 @@ var GOOGLE_ASSET_HELP_FULL = `adkit manage google assets \u2014 Reusable Google
|
|
|
5217
5238
|
<id> View asset details
|
|
5218
5239
|
|
|
5219
5240
|
Flags (list):
|
|
5220
|
-
--type <type> callout, sitelink, structured-snippet
|
|
5241
|
+
--type <type> callout, sitelink, structured-snippet, call, location
|
|
5221
5242
|
--scope <scope> account, campaign, ad-group
|
|
5222
5243
|
--scope-id <id> Google campaign/ad group ID (platformId); required for campaign/ad-group scope
|
|
5223
5244
|
${FLAG.account}
|
|
@@ -5254,7 +5275,10 @@ Examples:
|
|
|
5254
5275
|
adkit manage google assets create --data '{"assets":[{"type":"sitelink","linkText":"Pricing","finalUrls":["https://example.com/pricing"],"description1":"See plans","description2":"Starts free"}]}' --account 1234567890
|
|
5255
5276
|
adkit manage google assets update 123 --type callout --text "Free Returns" --account 1234567890
|
|
5256
5277
|
adkit manage google assets attach asset:123 --type callout --scope campaign --scope-id 456 --account 1234567890
|
|
5257
|
-
adkit manage google assets detach asset:123 --type callout --scope campaign --scope-id 456 --account 1234567890
|
|
5278
|
+
adkit manage google assets detach asset:123 --type callout --scope campaign --scope-id 456 --account 1234567890
|
|
5279
|
+
|
|
5280
|
+
Notes:
|
|
5281
|
+
Location assets are read-only and available through list --type location.`.trim();
|
|
5258
5282
|
var GOOGLE_CAMPAIGN_HELP = `adkit manage google campaigns \u2014 Google Ads campaigns
|
|
5259
5283
|
|
|
5260
5284
|
list List campaigns
|
|
@@ -6731,15 +6755,24 @@ Examples:
|
|
|
6731
6755
|
projects: `adkit projects \u2014 Manage projects
|
|
6732
6756
|
|
|
6733
6757
|
list List accessible projects
|
|
6758
|
+
create Create a project and make it active
|
|
6734
6759
|
use <id> Switch active project
|
|
6735
6760
|
current Show active project
|
|
6736
6761
|
|
|
6737
6762
|
Flags:
|
|
6738
6763
|
--query <text> Filter projects by name or website
|
|
6739
6764
|
--limit <n> Max results (default: 20, max: 50)
|
|
6765
|
+
--name <text> Project or business name (create)
|
|
6766
|
+
--website <url> Project website URL or domain (create)
|
|
6767
|
+
--workspace <id> Target workspace ID (create)
|
|
6768
|
+
--description <t> Optional business description (create)
|
|
6769
|
+
--industry <text> Optional business industry (create)
|
|
6770
|
+
--category <text> Optional business category (create)
|
|
6771
|
+
--tags <a,b> Optional comma-separated tags (create)
|
|
6740
6772
|
|
|
6741
6773
|
Examples:
|
|
6742
6774
|
adkit projects list
|
|
6775
|
+
adkit projects create --name "Acme" --website acme.com
|
|
6743
6776
|
adkit projects use proj_abc123`.trim()
|
|
6744
6777
|
};
|
|
6745
6778
|
var STUDIO_GENERATE_HELP_FULL = `adkit studio generate \u2014 Create ad images with AI
|
|
@@ -8705,13 +8738,18 @@ ${pageInfo}`);
|
|
|
8705
8738
|
case void 0: {
|
|
8706
8739
|
const query = typeof flags.query === "string" ? flags.query : void 0;
|
|
8707
8740
|
const limit = typeof flags.limit === "string" ? flags.limit : void 0;
|
|
8708
|
-
const
|
|
8709
|
-
if (
|
|
8741
|
+
const result = await listProjects(client, { query, limit });
|
|
8742
|
+
if (wantsJson(flags)) printResult(result, flags);
|
|
8710
8743
|
else {
|
|
8711
|
-
|
|
8744
|
+
if (result.projects.length === 0) console.log("No projects found.");
|
|
8745
|
+
for (const p of result.projects) {
|
|
8712
8746
|
const marker = p.current ? "* " : " ";
|
|
8713
8747
|
console.log(`${marker}${p.name} (${p.id})`);
|
|
8714
8748
|
}
|
|
8749
|
+
if (result.workspaces.length > 0) {
|
|
8750
|
+
console.log("\nWorkspaces:");
|
|
8751
|
+
for (const workspace of result.workspaces) console.log(` ${workspace.name} (${workspace.workspaceId})`);
|
|
8752
|
+
}
|
|
8715
8753
|
}
|
|
8716
8754
|
break;
|
|
8717
8755
|
}
|
|
@@ -8721,6 +8759,27 @@ ${pageInfo}`);
|
|
|
8721
8759
|
else console.log(`Active project: ${project.id}`);
|
|
8722
8760
|
break;
|
|
8723
8761
|
}
|
|
8762
|
+
case "create": {
|
|
8763
|
+
const name = requireFlag(flags, "name", 'Run: adkit projects create --name "Acme" --website acme.com');
|
|
8764
|
+
const website = requireFlag(flags, "website", 'Run: adkit projects create --name "Acme" --website acme.com');
|
|
8765
|
+
const descriptionValues = collectFlagValues(flags, "description");
|
|
8766
|
+
const description = descriptionValues.length > 0 ? descriptionValues.join(" ") : void 0;
|
|
8767
|
+
const tagsFlag = typeof flags.tags === "string" ? flags.tags : void 0;
|
|
8768
|
+
const tagParts = tagsFlag ? tagsFlag.split(",") : [];
|
|
8769
|
+
const tags = tagParts.map((tag) => tag.trim()).filter(Boolean);
|
|
8770
|
+
const project = await createProject(client, {
|
|
8771
|
+
name,
|
|
8772
|
+
website,
|
|
8773
|
+
description,
|
|
8774
|
+
industry: typeof flags.industry === "string" ? flags.industry : void 0,
|
|
8775
|
+
category: typeof flags.category === "string" ? flags.category : void 0,
|
|
8776
|
+
tags: tags.length > 0 ? tags : void 0,
|
|
8777
|
+
workspaceId: typeof flags.workspace === "string" ? flags.workspace : void 0
|
|
8778
|
+
});
|
|
8779
|
+
if (wantsJson(flags)) printResult(project, flags);
|
|
8780
|
+
else console.log(`Created and selected project: ${project.name} (${project.id})`);
|
|
8781
|
+
break;
|
|
8782
|
+
}
|
|
8724
8783
|
case "use": {
|
|
8725
8784
|
const projectId = args[2];
|
|
8726
8785
|
if (!projectId) throw new CliError("MISSING_ARGUMENT", "Missing required argument: `<project-id>`", "Run: adkit projects use <project-id>");
|
|
@@ -8729,7 +8788,7 @@ ${pageInfo}`);
|
|
|
8729
8788
|
break;
|
|
8730
8789
|
}
|
|
8731
8790
|
default:
|
|
8732
|
-
throw new CliError("UNKNOWN_COMMAND", `Unknown action: projects ${action}`, "Available: list, use, current");
|
|
8791
|
+
throw new CliError("UNKNOWN_COMMAND", `Unknown action: projects ${action}`, "Available: list, create, use, current");
|
|
8733
8792
|
}
|
|
8734
8793
|
return;
|
|
8735
8794
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adkit/cli",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.15",
|
|
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"
|