patchwork-os 1.2.0-beta.3.canary.920 → 1.2.0-beta.3.canary.921

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/dist/index.js CHANGED
@@ -5091,19 +5091,37 @@ if (process.argv[2] === "policy") {
5091
5091
  args.includes("--help") ||
5092
5092
  args.includes("-h") ||
5093
5093
  !args[1]) {
5094
- process.stdout.write("Usage: patchwork policy explain <recipe|file.yaml> [tool] [--json]\n\n" +
5094
+ process.stdout.write("Usage: patchwork policy explain <recipe|file.yaml> [tool] [--start manual|cron|webhook] [--json]\n\n" +
5095
5095
  "What can this recipe / worker / tool actually do right now, and why?\n" +
5096
5096
  "Walks every gate in runtime order — kill switch, tool registration, worker\n" +
5097
5097
  "authority, tool tier, trigger, privacy, standing permission — using the SAME\n" +
5098
5098
  "decision functions the runner enforces with (src/governance/effectivePolicy.ts).\n" +
5099
- "Pass a tool id (or `agent`) to restrict to matching steps. Reads only.\n");
5099
+ "Pass a tool id (or `agent`) to restrict to matching steps. Reads only.\n\n" +
5100
+ " --start <s> explain a run started this way instead of the way the\n" +
5101
+ " recipe fires on its own: `manual` is a dashboard Run now\n" +
5102
+ " (a cron recipe started by hand is evaluated as manual).\n");
5100
5103
  process.exit(verb === "explain" && !args[1] ? 2 : 0);
5101
5104
  }
5105
+ const startIdx = args.indexOf("--start");
5106
+ const startRaw = startIdx >= 0 ? args[startIdx + 1] : undefined;
5107
+ if (startIdx >= 0 &&
5108
+ startRaw !== "manual" &&
5109
+ startRaw !== "cron" &&
5110
+ startRaw !== "webhook") {
5111
+ process.stderr.write("[policy] --start must be one of: manual, cron, webhook\n");
5112
+ process.exit(2);
5113
+ }
5102
5114
  const { explainRecipePolicy, formatExplainReport } = await import("./commands/policyExplain.js");
5103
- const positional = args.slice(1).filter((a) => !a.startsWith("--"));
5115
+ const positional = args.slice(1).filter(
5116
+ // `i` indexes args.slice(1), so the --start VALUE (args[startIdx + 1])
5117
+ // sits at i === startIdx and must not be read as the recipe or tool.
5118
+ (a, i) => !a.startsWith("--") && !(startIdx >= 0 && i === startIdx));
5104
5119
  try {
5105
5120
  const report = await explainRecipePolicy(positional[0], {
5106
5121
  ...(positional[1] && { tool: positional[1] }),
5122
+ ...(startRaw !== undefined && {
5123
+ start: startRaw,
5124
+ }),
5107
5125
  });
5108
5126
  process.stdout.write(args.includes("--json")
5109
5127
  ? `${JSON.stringify(report, null, 2)}\n`