@adkit/cli 1.13.23 → 1.13.25

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.
Files changed (2) hide show
  1. package/dist/cli.js +55 -9
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -162,7 +162,7 @@ function parseArgs(argv, options) {
162
162
  } else {
163
163
  key = arg.slice(2);
164
164
  const next = argv[i + 1];
165
- if (next && !next.startsWith("--")) {
165
+ if (next !== void 0 && !next.startsWith("--")) {
166
166
  value = next;
167
167
  i++;
168
168
  } else value = true;
@@ -1227,6 +1227,12 @@ async function createProject(client, options) {
1227
1227
  current: true
1228
1228
  };
1229
1229
  }
1230
+ async function updateProject(client, projectId, update) {
1231
+ const encodedProjectId = encodeURIComponent(projectId);
1232
+ const response = await client.patch(`/manage/projects/${encodedProjectId}`, update);
1233
+ if (!isUpdateProjectResponse(response)) throw new Error("Unexpected response from AdKit project update");
1234
+ return response.project;
1235
+ }
1230
1236
  async function listProjects(client, options = {}) {
1231
1237
  const qs = queryString({ query: options.query, limit: options.limit });
1232
1238
  const response = await client.get(`/manage/projects${qs}`);
@@ -1257,6 +1263,13 @@ function isCreateProjectResponse(value) {
1257
1263
  if (!("name" in value) || typeof value.name !== "string") return false;
1258
1264
  return !("website" in value) || typeof value.website === "string";
1259
1265
  }
1266
+ function isUpdateProjectResponse(value) {
1267
+ if (!value || typeof value !== "object" || !("project" in value)) return false;
1268
+ const project = value.project;
1269
+ if (!project || typeof project !== "object") return false;
1270
+ if (!("projectId" in project) || typeof project.projectId !== "string") return false;
1271
+ return "name" in project && typeof project.name === "string";
1272
+ }
1260
1273
  function mapProjectEntry(project, selectedProject) {
1261
1274
  const entry = {
1262
1275
  id: project.projectId,
@@ -4822,7 +4835,7 @@ Commands:
4822
4835
  library Browse ads and advertisers
4823
4836
  studio Create and manage Studio ads
4824
4837
  manage Manage ad platforms and drafts
4825
- projects Manage projects (list, create, use, current)
4838
+ projects Manage projects (list, create, update, use, current)
4826
4839
 
4827
4840
  Advanced:
4828
4841
  logout Remove stored API key
@@ -5125,6 +5138,7 @@ Note:
5125
5138
  list returns ad configuration only (creative, status, adset).
5126
5139
  AdKit hides deleted and archived ads by default. Use --status to include them.
5127
5140
  Single-image/video ads use --media. Carousel ads use --data with carouselCards.
5141
+ Copy flags are repeatable \u2014 pass every headline/primary-text/link-description the user supplies; Meta rotates them on one ad. If it is unclear whether they want one ad with variants or separate ads, ask before creating. Only when writing copy yourself, default to one per field unless the user asks for variants.
5128
5142
 
5129
5143
  Examples:
5130
5144
  # Create an ad with a local video file
@@ -5187,6 +5201,7 @@ Note:
5187
5201
  list returns ad configuration only (creative, status, adset).
5188
5202
  AdKit hides deleted and archived ads by default. Use --status to include them.
5189
5203
  Single-image/video ads use --media. Carousel ads use --data with carouselCards.
5204
+ Copy flags are repeatable \u2014 pass every headline/primary-text/link-description the user supplies; Meta rotates them on one ad. If it is unclear whether they want one ad with variants or separate ads, ask before creating. Only when writing copy yourself, default to one per field unless the user asks for variants.
5190
5205
 
5191
5206
  --data JSON fields:
5192
5207
  adsetId (required) Parent ad set ID
@@ -7034,23 +7049,28 @@ Examples:
7034
7049
 
7035
7050
  list List accessible projects
7036
7051
  create Create a project and make it active
7052
+ update <id> Update a project
7037
7053
  use <id> Switch active project
7038
7054
  current Show active project
7039
7055
 
7040
7056
  Flags:
7041
7057
  --query <text> Filter projects by name or website
7042
7058
  --limit <n> Max results (default: 20, max: 50)
7043
- --name <text> Project or business name (create)
7044
- --website <url> Project website URL or domain (create)
7059
+ --name <text> Project or business name (create/update)
7060
+ --website <url> Project website URL or domain (create/update)
7045
7061
  --workspace <id> Target workspace ID (create)
7046
- --description <t> Optional business description (create)
7047
- --industry <text> Optional business industry (create)
7048
- --category <text> Optional business category (create)
7049
- --tags <a,b> Optional comma-separated tags (create)
7062
+ --description <t> Business description (create/update)
7063
+ --industry <text> Business industry (create/update)
7064
+ --category <text> Business category (create/update)
7065
+ --tags <a,b> Tags; update replaces all tags
7066
+ --primary-color <hex> Primary brand color (update)
7067
+ --accent-color <hex> Accent brand color (update)
7068
+ --background-color <hex> Background brand color (update)
7050
7069
 
7051
7070
  Examples:
7052
7071
  adkit projects list
7053
7072
  adkit projects create --name "Acme" --website acme.com
7073
+ adkit projects update proj_abc123 --name "Acme Inc." --primary-color "#7c3aed"
7054
7074
  adkit projects use proj_abc123`.trim()
7055
7075
  };
7056
7076
  var STUDIO_GENERATE_HELP_FULL = `adkit studio generate \u2014 Create ad images with AI
@@ -9084,6 +9104,32 @@ ${pageInfo}`);
9084
9104
  else console.log(`Created and selected project: ${project.name} (${project.id})`);
9085
9105
  break;
9086
9106
  }
9107
+ case "update": {
9108
+ validateFlags(flags, ["name", "website", "description", "industry", "category", "tags", "primary-color", "accent-color", "background-color"], "projects update");
9109
+ const projectId = args[2];
9110
+ if (!projectId) throw new CliError("MISSING_ARGUMENT", "Missing required argument: `<project-id>`", "Run: adkit projects update <project-id> [flags]");
9111
+ const update = {};
9112
+ if (typeof flags.name === "string") update.name = flags.name;
9113
+ if (typeof flags.website === "string") update.website = flags.website;
9114
+ const descriptionValues = collectFlagValues(flags, "description");
9115
+ if (descriptionValues.length > 0) update.description = descriptionValues.join(" ");
9116
+ if (typeof flags.industry === "string") update.industry = flags.industry;
9117
+ if (typeof flags.category === "string") update.category = flags.category;
9118
+ if (typeof flags.tags === "string") {
9119
+ const tagParts = flags.tags.split(",");
9120
+ const trimmedTags = tagParts.map((tag) => tag.trim());
9121
+ update.tags = trimmedTags.filter(Boolean);
9122
+ }
9123
+ const colors = {};
9124
+ if (typeof flags["primary-color"] === "string") colors.primary = flags["primary-color"];
9125
+ if (typeof flags["accent-color"] === "string") colors.accent = flags["accent-color"];
9126
+ if (typeof flags["background-color"] === "string") colors.background = flags["background-color"];
9127
+ if (Object.keys(colors).length > 0) update.brand = { colors };
9128
+ const project = await updateProject(client, projectId, update);
9129
+ if (wantsJson(flags)) printResult(project, flags);
9130
+ else console.log(`Updated project: ${project.name} (${project.projectId})`);
9131
+ break;
9132
+ }
9087
9133
  case "use": {
9088
9134
  const projectId = args[2];
9089
9135
  if (!projectId) throw new CliError("MISSING_ARGUMENT", "Missing required argument: `<project-id>`", "Run: adkit projects use <project-id>");
@@ -9092,7 +9138,7 @@ ${pageInfo}`);
9092
9138
  break;
9093
9139
  }
9094
9140
  default:
9095
- throw new CliError("UNKNOWN_COMMAND", `Unknown action: projects ${action}`, "Available: list, create, use, current");
9141
+ throw new CliError("UNKNOWN_COMMAND", `Unknown action: projects ${action}`, "Available: list, create, update, use, current");
9096
9142
  }
9097
9143
  return;
9098
9144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adkit/cli",
3
- "version": "1.13.23",
3
+ "version": "1.13.25",
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",