Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Core authentication and state management
export { Auth } from "./auth";
export { state, setState, resetState, primeFromEnv, getState, getUIMode } from "./state";
export { systemArgs, type SystemArgsType } from "./system-args";
export { systemArgs, workflowArgs, type SystemArgsType } from "./system-args";
export { normalizeProcessArgs, normalizeArgv } from "./arg-normalizer";

// Main operation services
Expand Down
46 changes: 28 additions & 18 deletions src/core/system-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,6 @@ export const systemArgs = {
default: false,
},

// **Explicit ID Override for Workflow Operations**
contentIDs: {
describe:
"Comma-separated list of target content IDs to process. Bypasses mappings lookup when provided (e.g., --contentIDs=121,1221,345).",
demandOption: false,
alias: ["content-ids", "contentIds", "ContentIDs", "CONTENTIDS"],
type: "string" as const,
default: "",
},
pageIDs: {
describe:
"Comma-separated list of target page IDs to process. Bypasses mappings lookup when provided (e.g., --pageIDs=12,11,45).",
demandOption: false,
alias: ["page-ids", "pageIds", "PageIDs", "PAGEIDS"],
type: "string" as const,
default: "",
},

// Instance identification args
sourceGuid: {
describe:
Expand Down Expand Up @@ -149,6 +131,34 @@ export const systemArgs = {
},
};

/**
* Args exclusive to the `workflows` command (PROD-2230).
*
* These bypass the mappings lookup for workflow operations (publish/unpublish/
* approve/decline). They must NOT be spread into pull/push/sync's builders —
* those commands never read state.explicitContentIDs/explicitPageIDs (only
* lib/workflows/workflow-operation.ts does), so showing them there previously
* advertised a filter that silently did nothing.
*/
export const workflowArgs = {
contentIDs: {
describe:
"Comma-separated list of target content IDs to process. Bypasses mappings lookup when provided (e.g., --contentIDs=121,1221,345).",
demandOption: false,
alias: ["content-ids", "contentIds", "ContentIDs", "CONTENTIDS"],
type: "string" as const,
default: "",
},
pageIDs: {
describe:
"Comma-separated list of target page IDs to process. Bypasses mappings lookup when provided (e.g., --pageIDs=12,11,45).",
demandOption: false,
alias: ["page-ids", "pageIds", "PageIDs", "PAGEIDS"],
type: "string" as const,
default: "",
},
};

/**
* Type helper for command arguments that include system args
*/
Expand Down
27 changes: 22 additions & 5 deletions src/core/tests/system-args.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { systemArgs } from "../system-args";
import { systemArgs, workflowArgs } from "../system-args";

// ─── Structure ─────────────────────────────────────────────────────────────────

Expand All @@ -13,8 +13,6 @@ describe("systemArgs – required keys exist", () => {
"elements",
"models",
"modelsWithDeps",
"contentIDs",
"pageIDs",
"sourceGuid",
"targetGuid",
"overwrite",
Expand All @@ -41,13 +39,34 @@ describe("systemArgs – removed keys do not exist", () => {
"force",
"update",
"reset",
// PROD-2230: contentIDs/pageIDs only have an effect for `workflows` (which
// reads state.explicitContentIDs/explicitPageIDs) — pull/push/sync never
// consumed them, so showing them in those commands' --help was misleading.
// They now live in workflowArgs, scoped to the `workflows` builder only.
"contentIDs",
"pageIDs",
];

it.each(removedKeys)('no longer exposes "%s"', (key) => {
expect(systemArgs).not.toHaveProperty(key);
});
});

describe("workflowArgs – contentIDs/pageIDs scoped to `workflows` only (PROD-2230)", () => {
it.each(["contentIDs", "pageIDs"])('has key "%s"', (key) => {
expect(workflowArgs).toHaveProperty(key);
});

it.each(["contentIDs", "pageIDs"])('"%s" declares type "string"', (key) => {
expect((workflowArgs as any)[key].type).toBe("string");
});

it.each(["contentIDs", "pageIDs"])('"%s" has a non-empty describe (shown in --help)', (key) => {
expect(typeof (workflowArgs as any)[key].describe).toBe("string");
expect((workflowArgs as any)[key].describe.length).toBeGreaterThan(0);
});
});

describe("systemArgs – types", () => {
it('boolean args declare type "boolean"', () => {
const boolArgs = ["dev", "headless", "verbose", "overwrite"];
Expand All @@ -64,8 +83,6 @@ describe("systemArgs – types", () => {
"elements",
"models",
"modelsWithDeps",
"contentIDs",
"pageIDs",
"sourceGuid",
"targetGuid",
];
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
resetState,
primeFromEnv,
systemArgs,
workflowArgs,
normalizeProcessArgs,
normalizeArgv,
} from "./core";
Expand Down Expand Up @@ -290,6 +291,8 @@ yargs.command({
},
// System args (commonly repeated across commands)
...systemArgs,
// Explicit content/page ID overrides — only meaningful for workflow operations (PROD-2230)
...workflowArgs,
},
handler: async function (argv) {
resetState(); // Clear any previous command state
Expand Down
Loading