@nasebanal/cli 0.15.0 → 1.0.0

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
@@ -415,6 +415,27 @@ nb specs specs pull --name "Billing API" > spec.yaml # latest; the docume
415
415
  only advance once the provider has deployed, a pull of `latest` can return a version that
416
416
  nothing implements. Pinning a revision (and its hash) is the safe way to use it today.
417
417
 
418
+ ## Stability and compatibility
419
+
420
+ From **1.0.0**, `nb` follows [SemVer](https://semver.org/): 1.0.0 is the first stable release (the CLI is out of beta), and what is listed below changes in a *major* release only.
421
+
422
+ **What the promise covers** (the stable command groups):
423
+
424
+ - the names of commands, subcommands and flags, and what they mean;
425
+ - the exit status (`0` on success, non-zero on failure);
426
+ - the shape of the JSON a command prints on standard output (a field is not removed or renamed, and its type does not change);
427
+ - the environment variables and the config file the README documents (`NB_ENV`, `NB_<API>_BASE_URL`, ...).
428
+
429
+ **What a release may do without a major version:** add a command, a flag or a JSON field (minor); fix a bug (patch); change the wording of help, messages and errors written for people (standard error).
430
+
431
+ **Generated from the API contracts.** The command tree under each API group comes from the OpenAPI contracts a release bundles (`spec-versions.json`). A breaking change in a bundled contract that changes the commands, flags or output of a stable group is released as a *major* version of `nb`.
432
+
433
+ **Deprecation.** A command, flag or environment variable that is going away is first deprecated for at least one minor release, with a warning on standard error that names what to use instead.
434
+
435
+ **Beta.** The groups marked **[beta]** in `nb -h` (`assurance` and `specs`, which are NASEBANAL Evolution's beta) are **not** covered: they may change in any release, a minor one included. When Evolution leaves beta, the marker goes and the groups join the promise (a minor release, announced in the release notes).
436
+
437
+ **Before 1.0.0** (0.x), a breaking change bumps the minor version.
438
+
418
439
  ## Installation
419
440
 
420
441
  The CLI installs the `nb` command. Node ≥ 20 is required.
@@ -457,7 +478,8 @@ turns the notice off. A dev link to a source checkout is never overwritten:
457
478
 
458
479
  ### Versioning and releases
459
480
 
460
- Versions follow SemVer (0.x until 1.0: breaking changes bump the minor). Each
481
+ Versions follow SemVer; see [Stability and compatibility](#stability-and-compatibility)
482
+ for what 1.0.0 and later promise (0.x: breaking changes bump the minor). Each
461
483
  release bundles a fixed set of API contract versions, recorded in
462
484
  [`spec-versions.json`](spec-versions.json).
463
485
 
@@ -652,6 +674,8 @@ nb secrets -h # the tool's own usage
652
674
  nb -h # lists the installed tools, and where to get the ones that are not
653
675
  ```
654
676
 
677
+ Every tool's usage follows the same layout, `nb -h` included: `Usage:` first (as GNU tools and commander do), then one description line (`<emoji> NASEBANAL <Name> - <what it does>`), then `Commands:` and `Options:`. A tool's usage also says `Also runs as: nb <tool> ...` (nb 0.15.0 or later), and shows the name you typed: `nb secrets -h` prints `Usage: nb secrets <command>`, `nb-secrets -h` prints `Usage: nb-secrets <command>`.
678
+
655
679
  | Tool | What it is |
656
680
  |---|---|
657
681
  | [`nb-secrets`](https://github.com/nasebanal/nb-secrets) | Secrets in passphrase-encrypted files, handed to a command only when you type the passphrase |
@@ -661,7 +685,7 @@ How it behaves:
661
685
 
662
686
  - **A built-in command always wins.** A program called `nb-auth` on `PATH` cannot take over `nb auth`; the generated API groups are protected the same way. Only the first word after `nb` is looked at (`nb secrets ...`, not `nb --env local secrets ...`).
663
687
  - **Nothing is run to build the list.** `nb -h` must stay fast and must not execute whatever is called `nb-*` on your `PATH`, so a tool's one-line description is **read** from the first comment line after its shebang: `# nb-<name> - <what it does>`. A program that is not a script is listed by name only.
664
- - **A tool is started only when you type its name**, directly (never through a shell), with your terminal, environment and exit status passed through, and `NB_PLUGIN_NAME="nb <name>"` set so it can print its usage the way it was called. Ctrl-C is left to the tool (a passphrase prompt, for example).
688
+ - **A tool is started only when you type its name**, directly (never through a shell), with your terminal, environment and exit status passed through, and `NB_PLUGIN_NAME="nb <name>"` set so it can print its usage the way it was called (`nb-secrets` and `nb-quickstarts` do). Ctrl-C is left to the tool (a passphrase prompt, for example).
665
689
  - **A published tool that is not installed** gets a message with its repository instead of "unknown command".
666
690
  - Names are plain lowercase (`[a-z][a-z0-9-]*`); the first match on `PATH` wins; macOS and Linux only. Anything named `nb-<name>` and executable on your `PATH` runs with your rights, as with any command, so keep `PATH` to directories you trust.
667
691
 
package/dist/apis.js CHANGED
@@ -2,6 +2,6 @@ export const API_CATALOG = [
2
2
  { name: "account", spec: "account.yaml", summary: "User profiles, subscriptions, billing, and API tokens" },
3
3
  { name: "record", spec: "recorder.yaml", summary: "Records and tags (NASEBANAL Recorder)" },
4
4
  { name: "target", spec: "target.yaml", summary: "Targets, cells, and shares (NASEBANAL Target)" },
5
- { name: "assurance", spec: "assurance.yaml", summary: "Monitors and CI/CD test results of your specs (NASEBANAL Assurance, API quality assessment)" },
6
- { name: "specs", spec: "specs.yaml", summary: "Repositories and your own OpenAPI documents: the API catalog (NASEBANAL Evolution)" },
5
+ { name: "assurance", spec: "assurance.yaml", summary: "[beta] Monitors and CI/CD test results of your specs (NASEBANAL Assurance, API quality assessment)" },
6
+ { name: "specs", spec: "specs.yaml", summary: "[beta] Repositories and your own OpenAPI documents: the API catalog (NASEBANAL Evolution)" },
7
7
  ];
package/dist/index.js CHANGED
@@ -24,7 +24,8 @@ const { version } = createRequire(import.meta.url)("../package.json");
24
24
  const program = new Command();
25
25
  program
26
26
  .name("nb")
27
- .description("Command-line interface for NASEBANAL APIs (generated from OpenAPI contracts).")
27
+ // Usage first, then this one line, "<emoji> NASEBANAL <Name> - <what it does>": the layout nb-secrets and nb-quickstarts use.
28
+ .description("💻 NASEBANAL CLI - command-line interface for NASEBANAL APIs")
28
29
  .version(version)
29
30
  .option("--env <env>", "target environment: production | local")
30
31
  .option("--token <token>", "override the stored PAT for this invocation")
@@ -66,6 +67,7 @@ for (const api of API_CATALOG) {
66
67
  // External tools (`nb secrets` runs `nb-secrets` from PATH). A built-in command, a generated API group included, always
67
68
  // wins over a tool of the same name; `nb -h` lists what is installed (read from the scripts, nothing is run).
68
69
  const reserved = new Set(["help", ...program.commands.flatMap((c) => [c.name(), ...c.aliases()])]);
70
+ program.addHelpText("after", '\n[beta] marks the groups of NASEBANAL Evolution\'s beta: they may change in any release.\nSee README, "Stability and compatibility".');
69
71
  program.addHelpText("after", () => pluginHelp(findPlugins(process.env.PATH, reserved)));
70
72
  async function main() {
71
73
  const call = pluginCall(process.argv, process.env.PATH, reserved);
package/dist/plugins.js CHANGED
@@ -119,17 +119,17 @@ export function pluginCall(argv, pathEnv, reserved) {
119
119
  export function pluginHelp(plugins) {
120
120
  const lines = [""];
121
121
  if (plugins.length > 0) {
122
- lines.push("Tools (programs named nb-<name> on your PATH):");
122
+ lines.push("Tools:");
123
123
  const width = Math.max(...plugins.map((p) => p.name.length)) + 2;
124
124
  for (const p of plugins)
125
125
  lines.push(` ${p.name.padEnd(width)}${p.description}`.trimEnd());
126
- lines.push("Run `nb <tool> -h` for a tool's own usage.");
126
+ lines.push("", "A tool is a program named nb-<name> on your PATH; `nb <tool> -h` shows its own usage.");
127
127
  }
128
128
  const absent = Object.entries(KNOWN_TOOLS).filter(([name]) => !plugins.some((p) => p.name === name));
129
129
  if (absent.length > 0) {
130
130
  if (plugins.length > 0)
131
131
  lines.push("");
132
- lines.push("Other NASEBANAL tools (not installed; `nb <tool>` runs them once they are on your PATH):");
132
+ lines.push("Other tools (not installed; `nb <tool>` runs them once `nb-<tool>` is on your PATH):");
133
133
  const width = Math.max(...absent.map(([name]) => name.length)) + 2;
134
134
  for (const [name, t] of absent)
135
135
  lines.push(` ${name.padEnd(width)}${t.repo}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nasebanal/cli",
3
- "version": "0.15.0",
3
+ "version": "1.0.0",
4
4
  "description": "gcloud-style command-line interface for NASEBANAL APIs, generated from nb-api-specs OpenAPI contracts.",
5
5
  "license": "MIT",
6
6
  "type": "module",