notusci 0.1.4 → 0.1.5

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.4",
3
+ "version": "0.1.5",
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
@@ -365,11 +365,15 @@ async function main(s, input) {
365
365
  return print({ status: "revoked", id: input.id });
366
366
  case "target set": {
367
367
  const repo = repoOrOrigin(input.repo);
368
- let config;
369
- try { config = JSON.parse(readFileSync(input.file, "utf8")); }
370
- catch { throw new CliError({ code: "usage", error: `${input.file} must be a readable JSON file`, next: "Fix --file and retry." }); }
371
- await api(s, `/api/repos/${repo}/target`, { method: "PUT", body: { config, digitaloceanToken: process.env.DIGITALOCEAN_TOKEN, autoPromote: input.autoPromote } });
372
- return print({ status: "saved", repo });
368
+ const { autoPromote, autoRelease } = input;
369
+ /** @type {Record<string, unknown>} */
370
+ let body = { autoPromote, autoRelease };
371
+ if (input.file) {
372
+ try { body = { ...body, config: JSON.parse(readFileSync(input.file, "utf8")), digitaloceanToken: process.env.DIGITALOCEAN_TOKEN }; }
373
+ catch { throw new CliError({ code: "usage", error: `${input.file} must be a readable JSON file`, next: "Fix --file and retry." }); }
374
+ }
375
+ const saved = await api(s, `/api/repos/${repo}/target`, { method: "PUT", body });
376
+ return print({ status: "saved", ...saved, ...(saved.autoRelease ? { note: "Every successful push to the default branch now ships itself; with autoPromote on, anyone who can push there deploys to production. Protect the branch." } : {}) });
373
377
  }
374
378
  case "verify": {
375
379
  const { root, repo } = gitRepo();
package/src/core.mjs CHANGED
@@ -33,7 +33,7 @@ const OPTIONS = {
33
33
  init: { scope: { type: "string" }, "no-mcp": { type: "boolean" }, billing: { type: "boolean" } },
34
34
  login: { scope: { type: "string" } },
35
35
  doctor: {}, logout: {}, token: {}, whoami: {}, repos: {}, version: {}, "--version": {},
36
- target: { repo: { type: "string" }, file: { type: "string" }, "auto-promote": { type: "string" } },
36
+ target: { repo: { type: "string" }, file: { type: "string" }, "auto-promote": { type: "string" }, "auto-release": { type: "string" } },
37
37
  verify: { workflow: { type: "string" }, timeout: { type: "string" } },
38
38
  wait: { repo: { type: "string" }, timeout: { type: "string" } },
39
39
  failures: { repo: { type: "string" } },
@@ -50,7 +50,7 @@ export const HELP = {
50
50
  commands: [
51
51
  "init [--scope SCOPES] [--no-mcp] [--billing]", "billing [--repo OWNER/REPO] [--timeout SECONDS]", "doctor",
52
52
  "login [--scope SCOPES]", "logout", "whoami", "repos", "token list", "token revoke ID",
53
- "target set [--repo OWNER/REPO] --file TARGET.json [--auto-promote on|off]", "verify [--workflow PATH] [--timeout SECONDS]",
53
+ "target set [--repo OWNER/REPO] [--file TARGET.json] [--auto-promote on|off] [--auto-release on|off]", "verify [--workflow PATH] [--timeout SECONDS]",
54
54
  "wait ID [--repo OWNER/REPO] [--timeout SECONDS]", "failures ID [--repo OWNER/REPO]", "ship ID [--repo OWNER/REPO]",
55
55
  "approve ID [--repo OWNER/REPO]", "repo set [--repo OWNER/REPO] --push-workflow PATH|--off",
56
56
  "migrations list [--repo OWNER/REPO]", "migrations approve MANIFEST_DIGEST --push ID --reason TEXT [--repo OWNER/REPO] [--force-destructive]",
@@ -100,10 +100,15 @@ export function parseCommand(args) {
100
100
  }
101
101
  if (command === "target") {
102
102
  expect("set");
103
- if (!values.file) throw usage("--file is required");
104
- const auto = values["auto-promote"];
105
- if (auto !== undefined && auto !== "on" && auto !== "off") throw usage("--auto-promote must be on or off");
106
- return { command: "target set", repo: values.repo, file: values.file, autoPromote: auto === undefined ? undefined : auto === "on" };
103
+ /** @param {string} name */
104
+ const flag = name => {
105
+ const value = values[name];
106
+ if (value !== undefined && value !== "on" && value !== "off") throw usage(`--${name} must be on or off`);
107
+ return value === undefined ? undefined : value === "on";
108
+ };
109
+ const autoPromote = flag("auto-promote"); const autoRelease = flag("auto-release");
110
+ if (!values.file && autoPromote === undefined && autoRelease === undefined) throw usage("target set needs --file, --auto-promote or --auto-release");
111
+ return { command: "target set", repo: values.repo, file: values.file, autoPromote, autoRelease };
107
112
  }
108
113
  if (command === "repo") {
109
114
  expect("set");