@zalify/cli 0.17.1 → 0.18.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 +1 -0
- package/dist/cli.js +33 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,6 +101,7 @@ its new home under `shop`.
|
|
|
101
101
|
| --- | --- |
|
|
102
102
|
| `ads create <dir>` | Provision an Autopilot brand-instance GitHub repo (POST `/api/repos`, GitHub App), scaffold the starter locally (`identity.yaml`, `brand.yaml`, `policy/`, `campaigns/`, `media-plans/`, `signals/`, `decisions/`), and push with a short-lived repo-scoped token. Writes `.zalify/brand-repo.json` so later commands run arg-free. The directory name becomes the slug — use the workspace's store slug so the service's digest writer can find the repo |
|
|
103
103
|
| `ads` / `ads list` | List the workspace's brand instances and their provisioning status |
|
|
104
|
+
| `ads remove <slug>` | Deprecate a brand instance — soft-deletes the record (drops out of `ads list` and the service's repo-token minting; survives for history). The GitHub repo is deliberately untouched: deleting real campaign intent is a human-on-GitHub decision |
|
|
104
105
|
|
|
105
106
|
The engine commands — `plan` / `apply` / `creative` / `report` — join this
|
|
106
107
|
group as `@zalify/ads-engine` merges in. Until then, drafting and applying
|
package/dist/cli.js
CHANGED
|
@@ -11776,20 +11776,20 @@ function managerFor(binPath) {
|
|
|
11776
11776
|
if (binPath.includes("/pnpm/") || binPath.includes("/.pnpm/")) {
|
|
11777
11777
|
return {
|
|
11778
11778
|
cmd: "pnpm",
|
|
11779
|
-
update: (
|
|
11779
|
+
update: (spec) => ["add", "-g", spec],
|
|
11780
11780
|
remove: `pnpm rm -g ${PACKAGES.join(" ")}`
|
|
11781
11781
|
};
|
|
11782
11782
|
}
|
|
11783
11783
|
if (binPath.includes("/.bun/")) {
|
|
11784
11784
|
return {
|
|
11785
11785
|
cmd: "bun",
|
|
11786
|
-
update: (
|
|
11786
|
+
update: (spec) => ["add", "-g", spec],
|
|
11787
11787
|
remove: `bun remove -g ${PACKAGES.join(" ")}`
|
|
11788
11788
|
};
|
|
11789
11789
|
}
|
|
11790
11790
|
return {
|
|
11791
11791
|
cmd: "npm",
|
|
11792
|
-
update: (
|
|
11792
|
+
update: (spec) => ["install", "-g", spec],
|
|
11793
11793
|
remove: `npm rm -g ${PACKAGES.join(" ")}`
|
|
11794
11794
|
};
|
|
11795
11795
|
}
|
|
@@ -11819,25 +11819,26 @@ async function selfUpdate(currentVersion) {
|
|
|
11819
11819
|
const running = real(process.argv[1] ?? "");
|
|
11820
11820
|
const manager = managerFor(running);
|
|
11821
11821
|
const pkg = packageFor(running);
|
|
11822
|
+
let latest = null;
|
|
11823
|
+
try {
|
|
11824
|
+
const info = await updateNotifier({
|
|
11825
|
+
pkg: { name: "@zalify/cli", version: currentVersion }
|
|
11826
|
+
}).fetchInfo();
|
|
11827
|
+
latest = info?.latest ?? null;
|
|
11828
|
+
} catch {}
|
|
11829
|
+
const target = latest ? `${pkg}@${latest}` : `${pkg}@latest`;
|
|
11822
11830
|
console.log(`Current version: ${currentVersion}`);
|
|
11823
|
-
console.log(`Updating via: ${manager.cmd} ${manager.update(
|
|
11831
|
+
console.log(`Updating via: ${manager.cmd} ${manager.update(target).join(" ")}
|
|
11824
11832
|
`);
|
|
11825
|
-
const result = spawnSync(manager.cmd, manager.update(
|
|
11833
|
+
const result = spawnSync(manager.cmd, manager.update(target), {
|
|
11826
11834
|
stdio: "inherit"
|
|
11827
11835
|
});
|
|
11828
11836
|
if (result.error || result.status !== 0) {
|
|
11829
11837
|
console.error(`
|
|
11830
11838
|
Update failed${result.error ? `: ${result.error.message}` : ""}.` + `
|
|
11831
|
-
Try manually: ${manager.cmd} ${manager.update(
|
|
11839
|
+
Try manually: ${manager.cmd} ${manager.update(target).join(" ")}`);
|
|
11832
11840
|
process.exit(result.status ?? 1);
|
|
11833
11841
|
}
|
|
11834
|
-
let latest = null;
|
|
11835
|
-
try {
|
|
11836
|
-
const info = await updateNotifier({
|
|
11837
|
-
pkg: { name: "@zalify/cli", version: currentVersion }
|
|
11838
|
-
}).fetchInfo();
|
|
11839
|
-
latest = info?.latest ?? null;
|
|
11840
|
-
} catch {}
|
|
11841
11842
|
const hits = zalifysOnPath();
|
|
11842
11843
|
const first = hits[0];
|
|
11843
11844
|
const firstVersion = first ? versionOf(first) : null;
|
|
@@ -13192,14 +13193,15 @@ function apiError3(status, json) {
|
|
|
13192
13193
|
return new Error(`repos API ${status}: ${JSON.stringify(json)}`);
|
|
13193
13194
|
}
|
|
13194
13195
|
async function request2(auth, method, path9, body) {
|
|
13196
|
+
const hasBody = method !== "GET";
|
|
13195
13197
|
const url = method === "GET" ? `${auth.appUrl}${path9}${path9.includes("?") ? "&" : "?"}workspaceId=${auth.workspaceId}` : `${auth.appUrl}${path9}`;
|
|
13196
13198
|
const res = await fetch(url, {
|
|
13197
13199
|
method,
|
|
13198
13200
|
headers: {
|
|
13199
13201
|
Authorization: `Bearer ${auth.key}`,
|
|
13200
|
-
...
|
|
13202
|
+
...hasBody ? { "Content-Type": "application/json" } : {}
|
|
13201
13203
|
},
|
|
13202
|
-
...
|
|
13204
|
+
...hasBody ? { body: JSON.stringify({ workspaceId: auth.workspaceId, ...body }) } : {}
|
|
13203
13205
|
});
|
|
13204
13206
|
const json = await res.json().catch(() => ({}));
|
|
13205
13207
|
if (!res.ok)
|
|
@@ -13312,6 +13314,19 @@ Next steps:
|
|
|
13312
13314
|
` + ` - flip consent: true once the brand owner has signed off
|
|
13313
13315
|
` + ` - the Autopilot service picks the instance up from there`);
|
|
13314
13316
|
}
|
|
13317
|
+
async function adsRemove(slug) {
|
|
13318
|
+
const auth = requireActive();
|
|
13319
|
+
const json = await request2(auth, "GET", "/api/repos");
|
|
13320
|
+
const row = (json.repos ?? []).find((r) => r.slug === slug);
|
|
13321
|
+
if (!row) {
|
|
13322
|
+
throw new Error(`No brand instance "${slug}" in workspace "${auth.workspaceName}" — see \`zalify ads list\`.`);
|
|
13323
|
+
}
|
|
13324
|
+
await request2(auth, "DELETE", `/api/repos/${row.id}`);
|
|
13325
|
+
console.log(`✓ removed ${slug}`);
|
|
13326
|
+
if (row.githubRepo) {
|
|
13327
|
+
console.log(` ${row.githubRepo} itself is untouched — archive or delete it on GitHub if it should go too.`);
|
|
13328
|
+
}
|
|
13329
|
+
}
|
|
13315
13330
|
async function adsList() {
|
|
13316
13331
|
const auth = requireActive();
|
|
13317
13332
|
const json = await request2(auth, "GET", "/api/repos");
|
|
@@ -13922,6 +13937,9 @@ ads.command("create <dir>").description("Provision the brand-instance GitHub rep
|
|
|
13922
13937
|
ads.command("list", { isDefault: true }).description("List the workspace's brand instances").action(async () => {
|
|
13923
13938
|
await adsList();
|
|
13924
13939
|
});
|
|
13940
|
+
ads.command("remove <slug>").description("Deprecate a brand instance (record soft-deleted; the GitHub repo is left untouched)").action(async (slug) => {
|
|
13941
|
+
await adsRemove(slug);
|
|
13942
|
+
});
|
|
13925
13943
|
var theme = program2.command("theme").description("Theme source code — scaffold a copy and upgrade it without losing your edits");
|
|
13926
13944
|
theme.command("create <dir>").description("Scaffold only — no Zalify hosting (self-host path; `site create` is the fully-hosted launch)").option("-t, --template <name>", "liquid | hydrogen | nextjs", "nextjs").option("--editor", "include the Zalify canvas-editor (z1) wiring").option("--store-domain <domain>", "your-store.myshopify.com (default: mock.shop demo data)").option("--storefront-token <token>", "public Storefront API access token").option("--to <version>", "theme version (default: latest)").option("--no-install", "skip dependency install").option("--no-git", "skip git init + initial commit").option("--tarball <path>", "use a local @zalify/theme-templates .tgz instead of npm").action(async (dir2, options) => {
|
|
13927
13945
|
await themeCreate(dir2, options);
|