@oked/sdk 0.6.25 → 0.6.26

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 CHANGED
@@ -93,7 +93,7 @@ Returns `true` when `GET https://api.oked.ai/health` succeeds within 3 seconds.
93
93
 
94
94
  - `classify(toolName, toolInput)` returns a risk tier for a tool call. `review` and `high_stakes` wait for a person. `rm` of non-temp data, PowerShell `Remove-Item -Recurse`, `rmdir /s`, `rd /s`, `del /s`, `Format-Volume`, `format X:`, a drive root or `$HOME` / `%USERPROFILE%`, `git clean -fdx` and `find -delete` outside a temp or build directory, `git push --force`, and a `curl` GraphQL `volumeDelete` are `high_stakes`. A temp directory or `build` / `dist` / `.next` delete stays `warning`. `bash -c`, `sh -c`, `powershell -Command`, `pwsh -c`, and `cmd /c` are classified by the inner command. Pass `{ sandboxEnforced: false }` to ask (`review`) before an opaque runner (`cargo test`, `npm test`, `npm run`, `pytest`, `go test`, `make`, `./script.sh`, `node scripts/x.mjs`, `npx`). Omit the option, or pass `true`, and those commands stay `safe`. Claude Code sets this from sandbox settings. Other hosts omit it. The runner's child processes are not in the tool call: a `cargo test` that runs `rm -rf ~` is the runner, not the `rm`.
95
95
  - `describe(toolName, toolInput, ctx?)` returns a one-line description.
96
- - `describeFields(toolName, toolInput, ctx?)` returns the card fields.
96
+ - `describeFields(toolName, toolInput, ctx?)` returns the card fields. A production deploy (`vercel --prod`, `netlify deploy --prod`, `fly deploy`, and the same class) has kind `deploy`. The tier stays `high_stakes`. A preview deploy stays `review`.
97
97
 
98
98
  Full type definitions ship in the package (`dist/index.d.ts`).
99
99
 
@@ -1,4 +1,14 @@
1
1
  import type { RiskTier } from "./types.js";
2
+ export interface ProductionDeployCard {
3
+ title: string;
4
+ target?: string;
5
+ }
6
+ /**
7
+ * A production deploy the tier logic already treats as high_stakes.
8
+ * Preview deploys, deletes, help, and dry runs return null.
9
+ * Calling this does not change the tier. describe() uses it for the card.
10
+ */
11
+ export declare function productionDeployCard(stage: string): ProductionDeployCard | null;
2
12
  /**
3
13
  * `sandboxEnforced: false` asks for `review` before an opaque code runner
4
14
  * (a test runner, package script, script file, or npx tool). `true` or omitted
package/dist/classify.js CHANGED
@@ -604,6 +604,98 @@ function classifyCloudCliStage(stage) {
604
604
  }
605
605
  return null;
606
606
  }
607
+ /**
608
+ * A production deploy the tier logic already treats as high_stakes.
609
+ * Preview deploys, deletes, help, and dry runs return null.
610
+ * Calling this does not change the tier. describe() uses it for the card.
611
+ */
612
+ export function productionDeployCard(stage) {
613
+ let bare = stage.trim().replace(DELETE_LEAD, "");
614
+ bare = bare.replace(/^(?:\w+=\S+\s+)+/, "");
615
+ const args = splitArgs(bare.replace(CLI_RUNNER_RE, ""));
616
+ const tool = (args.shift() ?? "").replace(/^.*\//, "").replace(/(?<=.)@.*$/, "");
617
+ const sep = args.indexOf("--");
618
+ const head = sep === -1 ? args : args.slice(0, sep);
619
+ if (head.some((arg) => CLI_PREVIEW_ARG_RE.test(arg)))
620
+ return null;
621
+ if (cliPositionals(args)[0] === "help")
622
+ return null;
623
+ const flag = (names) => {
624
+ for (let i = 0; i < args.length; i++) {
625
+ const arg = args[i];
626
+ for (const name of names) {
627
+ if (arg === name && args[i + 1])
628
+ return args[i + 1];
629
+ if (arg.startsWith(`${name}=`))
630
+ return arg.slice(name.length + 1);
631
+ }
632
+ }
633
+ return undefined;
634
+ };
635
+ switch (tool) {
636
+ case "vercel": {
637
+ const [sub, op] = cliPositionals(args, VERCEL_VALUE_FLAGS);
638
+ const prod = args.some((arg, i) => arg === "--prod" || arg === "--target=production" ||
639
+ (arg === "--target" && args[i + 1] === "production"));
640
+ const path = sub !== undefined && sub !== "deploy" && !VERCEL_SUBCOMMANDS.has(sub);
641
+ if ((sub === undefined || sub === "deploy" || path) && prod) {
642
+ return { title: "Deploy to Vercel production", target: path ? sub : undefined };
643
+ }
644
+ if (sub === "redeploy" && prod)
645
+ return { title: "Redeploy on Vercel production" };
646
+ if (sub === "promote")
647
+ return { title: "Promote a Vercel deployment to production", target: op };
648
+ return null;
649
+ }
650
+ case "netlify": {
651
+ const words = cliPositionals(args, new Set(["--site", "--dir", "-d", "--auth", "--filter", "-a", "-s", "-m", "--message", "--alias"]));
652
+ const prod = args.some((arg) => /^(?:--prod|-p|--prodIfUnlocked|--prod-if-unlocked)$/.test(arg));
653
+ if (words[0] === "deploy" && prod)
654
+ return { title: "Deploy to Netlify production", target: flag(["--site", "-s"]) };
655
+ return null;
656
+ }
657
+ case "fly":
658
+ case "flyctl": {
659
+ const words = cliPositionals(args, new Set(["-a", "--app", "-c", "--config", "-r", "--region", "--image", "-t", "--access-token"]));
660
+ if (words[0] === "deploy")
661
+ return { title: "Deploy to Fly", target: flag(["-a", "--app"]) };
662
+ return null;
663
+ }
664
+ case "wrangler": {
665
+ const words = cliPositionals(args, new Set(["-c", "--config", "-e", "--env", "--name"]));
666
+ const name = flag(["--name"]);
667
+ if (words.includes("publish"))
668
+ return { title: "Publish with Wrangler", target: name };
669
+ if (words.includes("deploy"))
670
+ return { title: "Deploy with Wrangler", target: name };
671
+ return null;
672
+ }
673
+ case "firebase": {
674
+ const words = cliPositionals(args, new Set(["-P", "--project", "--only", "--except", "--token"]));
675
+ if (words[0] === "deploy")
676
+ return { title: "Deploy to Firebase", target: flag(["-P", "--project"]) };
677
+ return null;
678
+ }
679
+ case "serverless":
680
+ case "sls":
681
+ return cliPositionals(args)[0] === "deploy" ? { title: "Deploy with Serverless" } : null;
682
+ case "cdk":
683
+ return cliPositionals(args)[0] === "deploy" ? { title: "Deploy with AWS CDK" } : null;
684
+ case "gcloud": {
685
+ const words = cliPositionals(args, new Set(["--project", "--account", "--configuration", "--format", "--verbosity", "--impersonate-service-account"]));
686
+ const local = ["config", "auth", "components", "info", "init", "version", "topic"];
687
+ if (local.includes(words[0] ?? ""))
688
+ return null;
689
+ const verbs = words.slice(1);
690
+ const at = verbs.indexOf("deploy");
691
+ if (at === -1)
692
+ return null;
693
+ return { title: "Deploy with gcloud", target: verbs[at + 1] };
694
+ }
695
+ default:
696
+ return null;
697
+ }
698
+ }
607
699
  /**
608
700
  * `gh api` is curl for GitHub: a mutating method, or fields without a method
609
701
  * (gh then sends a POST), is an outward write like a curl POST. A GraphQL call
package/dist/describe.js CHANGED
@@ -10,7 +10,7 @@
10
10
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
11
11
  import { homedir } from "node:os";
12
12
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
13
- import { blankTextCommandArgs, classify, classifyBashSteps, extractShellWriteOps, splitTopLevel, stripCodeHeredocBodies, stripInlineScriptBodies } from "./classify.js";
13
+ import { blankTextCommandArgs, classify, classifyBashSteps, extractShellWriteOps, productionDeployCard, splitTopLevel, stripCodeHeredocBodies, stripInlineScriptBodies } from "./classify.js";
14
14
  import { TIER_ORDER } from "./degraded.js";
15
15
  const BODY_PREVIEW_MAX = 200;
16
16
  const COMMAND_INLINE_MAX = 50;
@@ -449,6 +449,11 @@ function summarizeBash(command, sizeBytes, cwd, sandboxEnforced) {
449
449
  return { title: "Unpublish package from npm", kind: "npm_unpublish" };
450
450
  if (/\bnpx\s+.*\s+deploy\b/.test(shellText(cmd)))
451
451
  return { title: "Deploy via npx", body: truncateBody(cmd), kind: "npx_deploy" };
452
+ // Production deploys (vercel --prod, fly deploy, and the same class).
453
+ // The tier already comes from classify(). This only names the card.
454
+ const prodDeploy = productionDeployCard(cmd);
455
+ if (prodDeploy)
456
+ return { title: prodDeploy.title, target: prodDeploy.target, kind: "deploy" };
452
457
  // sudo / chmod (kill/pkill/killall are handled in command position above,
453
458
  // ahead of the compound catch-all).
454
459
  if (/\bsudo\b/.test(cmd)) {
package/dist/kinds.d.ts CHANGED
@@ -6,5 +6,5 @@
6
6
  * pattern maps to a kind, so historical rows stay attributable to the
7
7
  * classifier that produced them.
8
8
  */
9
- export declare const CLASSIFIER_VERSION = "v3";
9
+ export declare const CLASSIFIER_VERSION = "v4";
10
10
  export type OperationKind = "file_create" | "file_append" | "file_edit" | "file_touch" | "file_copy" | "file_move" | "file_delete" | "sql_drop" | "sql_truncate" | "sql_alter" | "sql_create" | "sql_delete_rows" | "sql_delete_all_rows" | "sql_update_rows" | "sql_update_every_row" | "sql_insert" | "sql_query" | "sql_migrate" | "git_push" | "git_force_push" | "git_reset_hard" | "git_clean" | "git_checkout" | "git_restore" | "git_commit" | "git_pr_create" | "git_pr_merge" | "git_pr_write" | "gh_write" | "git_branch_delete" | "deploy" | "ssh_remote" | "http_get" | "http_post" | "http_put" | "http_delete" | "http_pipe_to_shell" | "docker_up" | "docker_down" | "docker_rm" | "docker_rmi" | "docker_prune" | "npm_install" | "npm_run" | "npm_test" | "npm_publish" | "npm_unpublish" | "npx_deploy" | "kill_process" | "sudo" | "chmod_777" | "email_send" | "email_delete" | "email_purge" | "payment_charge" | "payment_create" | "chat_message" | "mcp_delete" | "mcp_update" | "mcp_create" | "mcp_post" | "mcp_publish" | "mcp_send" | "mcp_submit_form" | "mcp_fill" | "mcp_submit" | "mcp_query" | "browser_navigate" | "browser_interact" | "browser_script" | "browser_dev_server" | "folder_access" | "session_control" | "session_housekeeping" | "session_start" | "simulator" | "script_run" | "worktree" | "schedule" | "agent_message" | "web_fetch" | "monitor" | "artifact" | "agent_launch" | "shell_pipeline" | "unknown_bash" | "unknown_tool";
package/dist/kinds.js CHANGED
@@ -6,4 +6,4 @@
6
6
  * pattern maps to a kind, so historical rows stay attributable to the
7
7
  * classifier that produced them.
8
8
  */
9
- export const CLASSIFIER_VERSION = "v3";
9
+ export const CLASSIFIER_VERSION = "v4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oked/sdk",
3
- "version": "0.6.25",
3
+ "version": "0.6.26",
4
4
  "description": "OKed SDK - human approval layer for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "@oked/receipt-core": "0.6.25"
48
+ "@oked/receipt-core": "0.6.26"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^26.6.5",