notusci 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notusci",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "CI for coding agents: verify uncommitted changes with your GitHub Actions workflow and get typed JSON",
5
5
  "license": "MIT",
6
6
  "homepage": "https://ci.notusworks.com",
package/src/cli.mjs CHANGED
@@ -381,6 +381,16 @@ async function main(s, input) {
381
381
  const { shipId } = await api(s, "/api/ships", { method: "POST", body: { repo, pushRunId: input.runId } });
382
382
  return report(await waitUntilReady(s, `/api/ships/${shipId}/wait`, repo));
383
383
  }
384
+ case "repo set": {
385
+ const repo = repoOrOrigin(input.repo);
386
+ return print(await api(s, `/api/repos/${repo}/settings`, { method: "PUT", body: { pushWorkflow: input.pushWorkflow } }));
387
+ }
388
+ case "migrations list": return print(await api(s, `/api/repos/${repoOrOrigin(input.repo)}/migrations`));
389
+ case "migrations approve": {
390
+ const { manifestDigest, pushRunId, reason, forceDestructive } = input;
391
+ return print(await api(s, `/api/repos/${repoOrOrigin(input.repo)}/migrations/approvals`, { method: "POST",
392
+ body: { manifestDigest, pushRunId, reason, ...(forceDestructive ? { forceDestructive } : {}) } }));
393
+ }
384
394
  case "approve": {
385
395
  const repo = repoOrOrigin(input.repo);
386
396
  return print(await api(s, `/api/pull-requests/${input.runId}/approve`, { method: "POST", query: { repo } }));
package/src/core.mjs CHANGED
@@ -41,6 +41,8 @@ const OPTIONS = {
41
41
  "rerun-failed": { timeout: { type: "string" } },
42
42
  ship: { repo: { type: "string" } },
43
43
  approve: { repo: { type: "string" } },
44
+ repo: { repo: { type: "string" }, "push-workflow": { type: "string" }, off: { type: "boolean" } },
45
+ migrations: { repo: { type: "string" }, push: { type: "string" }, reason: { type: "string" }, "force-destructive": { type: "boolean" } },
44
46
  billing: { repo: { type: "string" }, timeout: { type: "string" } },
45
47
  };
46
48
 
@@ -50,7 +52,8 @@ export const HELP = {
50
52
  "login [--scope SCOPES]", "logout", "whoami", "repos", "token list", "token revoke ID",
51
53
  "target set [--repo OWNER/REPO] --file TARGET.json [--auto-promote on|off]", "verify [--workflow PATH] [--timeout SECONDS]",
52
54
  "wait ID [--repo OWNER/REPO] [--timeout SECONDS]", "failures ID [--repo OWNER/REPO]", "ship ID [--repo OWNER/REPO]",
53
- "approve ID [--repo OWNER/REPO]",
55
+ "approve ID [--repo OWNER/REPO]", "repo set [--repo OWNER/REPO] --push-workflow PATH|--off",
56
+ "migrations list [--repo OWNER/REPO]", "migrations approve MANIFEST_DIGEST --push ID --reason TEXT [--repo OWNER/REPO] [--force-destructive]",
54
57
  "search-logs ID --query LITERAL [--limit COUNT] [--repo OWNER/REPO]",
55
58
  "rerun-failed ID [--timeout SECONDS]", "--version",
56
59
  ],
@@ -102,6 +105,20 @@ export function parseCommand(args) {
102
105
  if (auto !== undefined && auto !== "on" && auto !== "off") throw usage("--auto-promote must be on or off");
103
106
  return { command: "target set", repo: values.repo, file: values.file, autoPromote: auto === undefined ? undefined : auto === "on" };
104
107
  }
108
+ if (command === "repo") {
109
+ expect("set");
110
+ if ((values["push-workflow"] === undefined) === (values.off !== true)) throw usage("repo set needs exactly one of --push-workflow PATH or --off");
111
+ return { command: "repo set", repo: values.repo, pushWorkflow: values.off ? null : values["push-workflow"] };
112
+ }
113
+ if (command === "migrations") {
114
+ if (positionals[0] === "list") { expect("list"); return { command: "migrations list", repo: values.repo }; }
115
+ expect("approve", "*");
116
+ if (!/^[0-9a-f]{64}$/.test(positionals[1]) || !isPushRunId(values.push?.toLowerCase() ?? "") || !values.reason?.trim()) {
117
+ throw usage("migrations approve needs a 64-hex manifest digest, --push PUSH_UUID and --reason TEXT");
118
+ }
119
+ return { command: "migrations approve", repo: values.repo, manifestDigest: positionals[1], pushRunId: values.push.toLowerCase(),
120
+ reason: values.reason, forceDestructive: values["force-destructive"] === true };
121
+ }
105
122
  if (command === "verify") {
106
123
  expect();
107
124
  if (values.workflow === "") throw usage("--workflow must not be empty");