@wirecat/cli-core 0.454.0 → 0.455.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/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ shape of this file.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.455.0 — 27.10.2026
11
+
12
+ ### Added
13
+
14
+ - **A CLI that is not a messenger reuses the shared permission helpers.** `./cli` exports `terminalAsker(command)`,
15
+ the guard's question at a terminal, and `refuseUnknownPermissionKeys`, the unknown-key refusal for a command the
16
+ shared check does not key (`api call`, `mcp`). `guardFor` takes `permissionDefaults` on its settings, so a key
17
+ the CLI defaults to `ask` asks instead of being allowed; without them it keeps the messenger defaults.
18
+ `terminalAsker`'s `confirmation_required` now names the key in `details.permission`.
19
+
10
20
  ## 0.454.0 — 27.10.2026
11
21
 
12
22
  ### Added
@@ -86,6 +86,7 @@ export { readMeetingProjectCandidates } from "./meeting-project-candidates-read.
86
86
  export { meetingResultItem } from "./meeting-results.js";
87
87
  export { type MeetingSeriesInventoryReader, readMeetingSeriesInventory } from "./meeting-series-inventory-read.js";
88
88
  export { accountFileFor, profilesHere, rememberAccount } from "./messenger/accounts.js";
89
+ export { terminalAsker } from "./messenger/ask.js";
89
90
  export type { CompletionOptions } from "./messenger/complete-command.js";
90
91
  export { type ConnectOptions, connectFor, type Messenger, type MessengerContext, messengerContext, type ReadConnection, type StoredMessages, } from "./messenger/context.js";
91
92
  export { COMMAND_NEEDS } from "./messenger/lacks.js";
@@ -103,7 +104,7 @@ export { storeSummary } from "./messenger/store-maintenance-command.js";
103
104
  export { type Saving, stored } from "./messenger/stored.js";
104
105
  export { MODEL_CATALOGUE_QUERY, type ModelCatalogueOptions } from "./model-catalogue-command.js";
105
106
  export { window, withPaging } from "./paging.js";
106
- export { type CommandPermissions, commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, type PermissionKeyOf, type PermissionKeySource, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
107
+ export { type CommandPermissions, commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, type PermissionKeyOf, type PermissionKeySource, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
107
108
  export { asFirstWord, commandWords, liftProfile, profileFree, refuseCommandName, rootOf, takesProfile, usableProfileName, } from "./profile.js";
108
109
  export { createProgram, type ProgramDefinition, type ProgramOptions, type RunOptions, run } from "./program.js";
109
110
  export { fieldsOf, projectFields } from "./result-fields.js";
package/dist/cli/index.js CHANGED
@@ -79,6 +79,7 @@ export { readMeetingProjectCandidates } from "./meeting-project-candidates-read.
79
79
  export { meetingResultItem } from "./meeting-results.js";
80
80
  export { readMeetingSeriesInventory } from "./meeting-series-inventory-read.js";
81
81
  export { accountFileFor, profilesHere, rememberAccount } from "./messenger/accounts.js";
82
+ export { terminalAsker } from "./messenger/ask.js";
82
83
  export { connectFor, messengerContext, } from "./messenger/context.js";
83
84
  export { COMMAND_NEEDS } from "./messenger/lacks.js";
84
85
  export { httpTokenFile, serverEntry } from "./messenger/mcp-command.js";
@@ -94,7 +95,7 @@ export { storeSummary } from "./messenger/store-maintenance-command.js";
94
95
  export { stored } from "./messenger/stored.js";
95
96
  export { MODEL_CATALOGUE_QUERY } from "./model-catalogue-command.js";
96
97
  export { window, withPaging } from "./paging.js";
97
- export { commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
98
+ export { commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
98
99
  export { asFirstWord, commandWords, liftProfile, profileFree, refuseCommandName, rootOf, takesProfile, usableProfileName, } from "./profile.js";
99
100
  export { createProgram, run } from "./program.js";
100
101
  export { fieldsOf, projectFields } from "./result-fields.js";
@@ -67,7 +67,7 @@ export const terminalAsker = (command) => async (key, request) => {
67
67
  : await (environmentOf(command).answer ?? fromTerminal)(`${what(key, request)} — go ahead? [y/N] `);
68
68
  if (answer === null) {
69
69
  throw new CliError("confirmation_required", `${key} asks before it acts (its permission level is ask), and nobody is at a terminal to answer — ` +
70
- `add ${flag} to go ahead`);
70
+ `add ${flag} to go ahead`, { permission: key });
71
71
  }
72
72
  if (!/^\s*y(es)?\s*$/i.test(answer))
73
73
  throw new CliError("cancelled", `${key}: not done — the answer was no`);
@@ -93,6 +93,8 @@ export interface GuardSettings {
93
93
  readOnlyLock?: string;
94
94
  permissions: Readonly<Record<PermissionKey, Level>>;
95
95
  permissionSources: Readonly<Record<PermissionKey, string>>;
96
+ /** A CLI's own defaults (`commandPermissions`); without them a key falls back to the messenger's. */
97
+ permissionDefaults?: Readonly<Record<PermissionKey, Level>>;
96
98
  sendsPerHour: number;
97
99
  }
98
100
  /**
@@ -259,6 +259,7 @@ export const guardFor = (app, settings, warn, env = process.env, ask) => sendGua
259
259
  ...(settings.readOnlyLock ? { readOnlyLock: settings.readOnlyLock } : {}),
260
260
  permissions: () => settings.permissions,
261
261
  permissionSources: settings.permissionSources,
262
+ ...(settings.permissionDefaults ? { permissionDefaults: settings.permissionDefaults } : {}),
262
263
  ...(ask ? { ask } : {}),
263
264
  sendsPerHour: settings.sendsPerHour,
264
265
  journal: new SendJournal(sendsPathFor(app, settings.profile, env), { service: app.command, version: app.version }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.454.0",
3
+ "version": "0.455.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",