kingminos 0.2.1 → 2026.10.2300

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
@@ -103,6 +103,18 @@ node dist/kingminos.js --help
103
103
  npm run ci
104
104
  ```
105
105
 
106
+ ## Releases & versioning
107
+
108
+ Published npm versions use **CalVer** in npm-safe semver form: `YYYY.M.DDNN` (UTC calendar date, month without a leading zero, day encoded in the patch as `DD×100+NN`). Examples: `2026.10.2300` (first release on 2026-10-23), `2026.10.2301` (second that day), `2027.1.500` (2027-01-05). Git tags are `v` plus that version (e.g. `v2026.10.2300`).
109
+
110
+ On `main`, `package.json` stays at a **placeholder** (`0.0.0-dev`). The authoritative version for each release is the git tag; CI bumps `package.json` only in the publish job before `npm publish`, without committing back to `main`.
111
+
112
+ After [CI](.github/workflows/ci.yml) succeeds on a push to `main` (or on a manual **Publish** workflow run on `main`), [.github/workflows/publish.yml](.github/workflows/publish.yml) plans the next version, skips when there are no releasable commits since the last tag, builds and tests, publishes to npm with OIDC trusted publishing (`npm publish --provenance`), then creates the git tag and GitHub release. Preview locally:
113
+
114
+ ```bash
115
+ npm run release:preview
116
+ ```
117
+
106
118
  ## License
107
119
 
108
120
  MIT — see [LICENSE](LICENSE).
package/dist/kingminos.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/kingminos.ts
4
- import { readFileSync, realpathSync } from "fs";
5
- import { fileURLToPath } from "url";
4
+ import { readFileSync as readFileSync2, realpathSync } from "fs";
5
+ import { fileURLToPath as fileURLToPath2 } from "url";
6
6
 
7
7
  // src/sanitize.ts
8
8
  function stripSafeToWrite(value) {
@@ -98,7 +98,7 @@ var BYOK_PROVIDERS = [
98
98
  function isByokProvider(value) {
99
99
  return BYOK_PROVIDERS.includes(value);
100
100
  }
101
- var BOOLEAN_FLAGS = /* @__PURE__ */ new Set(["help", "h", "dry-run", "skip-cache", "json"]);
101
+ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set(["help", "h", "version", "V", "dry-run", "skip-cache", "json"]);
102
102
  var GLOBAL_FLAGS = /* @__PURE__ */ new Set(["token", "base-url", "help", "h", "json"]);
103
103
  var EXIT = {
104
104
  ok: 0,
@@ -416,6 +416,10 @@ function parseArgv(argv) {
416
416
  flags[name] = value;
417
417
  continue;
418
418
  }
419
+ if (arg === "-V" || arg === "-v") {
420
+ flags.version = true;
421
+ continue;
422
+ }
419
423
  if (arg === "-h") {
420
424
  flags.help = true;
421
425
  continue;
@@ -604,9 +608,9 @@ function pathForPriority(priority) {
604
608
  return priority;
605
609
  }
606
610
  function applyPriority(body, priority, _capability) {
607
- const path = pathForPriority(priority);
611
+ const path2 = pathForPriority(priority);
608
612
  const routing = body.routing && typeof body.routing === "object" && !Array.isArray(body.routing) ? body.routing : {};
609
- return { ...body, routing: { ...routing, path } };
613
+ return { ...body, routing: { ...routing, path: path2 } };
610
614
  }
611
615
  function formatDecisionNotes(body) {
612
616
  if (!body || typeof body !== "object" || Array.isArray(body)) {
@@ -739,10 +743,10 @@ function buildRequest(command, flags, loader) {
739
743
  return assertNever(command);
740
744
  }
741
745
  }
742
- function capabilityPost(path, body, flags, options) {
746
+ function capabilityPost(path2, body, flags, options) {
743
747
  return {
744
748
  method: "POST",
745
- path,
749
+ path: path2,
746
750
  headers: {
747
751
  ...explainSchemaHeaders(flags),
748
752
  ...optionalHeader("Idempotency-Key", flagString(flags, "idempotency-key")),
@@ -965,10 +969,10 @@ function personB2bSocialBody(flags, loader) {
965
969
  }
966
970
  function assignRouting(body, flags) {
967
971
  assignJson(body, "routing", flags);
968
- const path = flagString(flags, "path");
969
- if (path !== void 0) {
972
+ const path2 = flagString(flags, "path");
973
+ if (path2 !== void 0) {
970
974
  const routing = body.routing && typeof body.routing === "object" && !Array.isArray(body.routing) ? body.routing : {};
971
- body.routing = { ...routing, path };
975
+ body.routing = { ...routing, path: path2 };
972
976
  }
973
977
  }
974
978
  function expectedCompany(flags) {
@@ -1046,11 +1050,11 @@ function loadBodyObject(raw, loader) {
1046
1050
  return parseObjectJson(loader.stdin, "--body -");
1047
1051
  }
1048
1052
  if (raw.startsWith("@")) {
1049
- const path = raw.slice(1);
1050
- if (!path) {
1053
+ const path2 = raw.slice(1);
1054
+ if (!path2) {
1051
1055
  throw new UsageError("--body @file requires a path");
1052
1056
  }
1053
- return parseObjectJson(loader.readFile(path), `--body @${path}`);
1057
+ return parseObjectJson(loader.readFile(path2), `--body @${path2}`);
1054
1058
  }
1055
1059
  return parseObjectJson(raw, "--body");
1056
1060
  }
@@ -1511,6 +1515,22 @@ function stringField2(body, key) {
1511
1515
  return typeof value === "string" && value !== "" ? value : void 0;
1512
1516
  }
1513
1517
 
1518
+ // src/version.ts
1519
+ import { readFileSync } from "fs";
1520
+ import path from "path";
1521
+ import { fileURLToPath } from "url";
1522
+ var cachedVersion;
1523
+ function getPackageVersion() {
1524
+ if (cachedVersion !== void 0) {
1525
+ return cachedVersion;
1526
+ }
1527
+ const entryDir = path.dirname(fileURLToPath(import.meta.url));
1528
+ const pkgPath = path.join(entryDir, "..", "package.json");
1529
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
1530
+ cachedVersion = typeof pkg.version === "string" ? pkg.version : "0.0.0";
1531
+ return cachedVersion;
1532
+ }
1533
+
1514
1534
  // src/kingminos.ts
1515
1535
  async function runCli(io) {
1516
1536
  try {
@@ -1530,6 +1550,11 @@ async function runCli(io) {
1530
1550
  }
1531
1551
  async function runCliUnsafe(io) {
1532
1552
  const parsed = parseArgv(io.argv);
1553
+ if (parsed.flags.version === true || parsed.flags.V === true) {
1554
+ io.stdout(`${getPackageVersion()}
1555
+ `);
1556
+ return 0;
1557
+ }
1533
1558
  if (parsed.flags.help === true || parsed.flags.h === true) {
1534
1559
  if (parsed.positionals.length === 0) {
1535
1560
  io.stdout(ROOT_HELP);
@@ -1549,7 +1574,7 @@ async function runCliUnsafe(io) {
1549
1574
  return runBatch(io, command, parsed.flags);
1550
1575
  }
1551
1576
  const request = buildRequest(command, parsed.flags, {
1552
- readFile: io.readFile ?? ((path) => readFileSync(path, "utf8")),
1577
+ readFile: io.readFile ?? ((path2) => readFileSync2(path2, "utf8")),
1553
1578
  stdin: io.stdin ?? ""
1554
1579
  });
1555
1580
  const token = request.auth ? requireToken(parsed.flags, io.env) : void 0;
@@ -1608,7 +1633,7 @@ async function runBatch(io, command, flags) {
1608
1633
  );
1609
1634
  }
1610
1635
  const loader = {
1611
- readFile: io.readFile ?? ((path) => readFileSync(path, "utf8")),
1636
+ readFile: io.readFile ?? ((path2) => readFileSync2(path2, "utf8")),
1612
1637
  stdin: io.stdin ?? ""
1613
1638
  };
1614
1639
  const raw = file === "-" ? loader.stdin : loader.readFile(file);
@@ -1768,7 +1793,7 @@ function redact(text, secrets) {
1768
1793
  return secrets.reduce((out, secret) => out.split(secret).join("[redacted]"), text);
1769
1794
  }
1770
1795
  function launchedAsCli() {
1771
- const self = fileURLToPath(import.meta.url);
1796
+ const self = fileURLToPath2(import.meta.url);
1772
1797
  const argv1 = process.argv[1];
1773
1798
  if (!argv1) {
1774
1799
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kingminos",
3
- "version": "0.2.1",
3
+ "version": "2026.10.2300",
4
4
  "description": "KingMinos CLI — call the KingMinos API from your terminal",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,12 +29,16 @@
29
29
  "scripts": {
30
30
  "build": "tsup",
31
31
  "typecheck": "tsc -p tsconfig.json --noEmit",
32
- "test": "npm run build && node --experimental-strip-types --test test/*.test.ts",
33
- "ci": "npm run typecheck && npm run test"
32
+ "test": "npm run build && node --experimental-strip-types --test test/*.test.ts && node --test test/release-calver.test.mjs",
33
+ "ci": "npm run typecheck && npm run test",
34
+ "release:preview": "node scripts/release-calver.mjs --dry-run"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@types/node": "^22.15.29",
37
38
  "tsup": "^8.5.0",
38
39
  "typescript": "^5.8.3"
40
+ },
41
+ "allowScripts": {
42
+ "esbuild@0.27.7": true
39
43
  }
40
44
  }