@lanonasis/cli 3.9.6 → 3.9.8

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
@@ -1,5 +1,57 @@
1
1
  # Changelog - @lanonasis/cli
2
2
 
3
+ ## [3.9.8] - 2026-02-25
4
+
5
+ ### ✨ New Features
6
+
7
+ - **Issue #98 (CLI Memory UX Enhancements)**:
8
+ - Added `onasis memory create --json <json>` for direct JSON payload creation.
9
+ - Added `onasis memory create --content-file <path>` for file-based content ingestion.
10
+ - Added `onasis memory save-session` to persist branch/status/changed-files session context as memory.
11
+ - **Behavior methods via CLI commands**:
12
+ - Added `onasis memory intelligence` subcommands for health check, tag suggestions, related lookup, duplicate detection, insight extraction, and pattern analysis.
13
+ - Added `onasis memory behavior` subcommands for `record`, `recall`, and `suggest` workflow behavior operations.
14
+
15
+ ### 🐛 Bug Fixes
16
+
17
+ - Normalized memory response handling for create/get/update wrappers (`{ data: ... }`) so CLI output fields like ID/Title/Type are consistently resolved.
18
+ - Ensured token refresh is executed before memory command paths to reduce intermittent re-auth prompts during active OAuth sessions.
19
+ - Aligned default semantic search thresholds to `0.55` across memory and MCP search command paths for consistent result behavior.
20
+
21
+ ## [3.9.7] - 2026-02-21
22
+
23
+ ### ✨ New Features
24
+
25
+ - **`onasis whoami` command**: Display full authenticated user profile including email, name, role, OAuth provider, project scope, and last login time. Fetches live data from `GET /v1/auth/me`.
26
+ - **Live profile on `auth status`**: `onasis auth status` now fetches the real user profile from the auth gateway and displays email, role, and plan — no longer relies solely on cached local state.
27
+ - **Live memory API probe on `auth status`**: After local auth check passes, `auth status` issues a real memory list request to confirm end-to-end API access, reporting `✓ accessible` or `✖ rejected (401)` with actionable guidance.
28
+ - **Manual endpoint override warning**: `auth status` now warns when `manualEndpointOverrides` is active and shows the configured endpoint URLs.
29
+
30
+ ### 🐛 Bug Fixes
31
+
32
+ - **OAuth sessions no longer show "Not Authenticated"**: Fixed `auth status` incorrectly reporting unauthenticated for valid OAuth PKCE sessions — was checking `if (isAuth && user)` when `user` may be undefined for OAuth sessions.
33
+ - **`process.exit(1)` no longer kills status probe**: Added `noExit` flag to `APIClient` so callers like `auth status` can catch 401/403 from the memory probe without the interceptor terminating the process.
34
+ - **Stale auth cache cleared on 401**: When the memory API returns 401, the CLI now calls `invalidateAuthCache()` to clear the 5-minute in-memory cache and the persisted `lastValidated` timestamp, preventing the 24-hour grace bypass.
35
+ - **24-hour `lastValidated` skip removed**: Eliminated a security hole that bypassed server re-validation for 24 hours after any successful auth check.
36
+ - **7-day offline grace restricted to network errors**: The offline grace period no longer applies to explicit 401/403 auth rejections — only genuine network failures.
37
+ - **Bogus vendor key always passed auth check**: `pingAuthHealth()` was hitting the unauthenticated `/health` endpoint. Replaced with `probeVendorKeyAuth()` which calls `POST /api/v1/memories/search` — a real protected endpoint. Interprets 401/403 as auth rejection, any other response (400, 405, 5xx) as auth accepted with a backend concern.
38
+ - **`discoverServices()` overwrote manual overrides**: Fixed auto-discovery ignoring `manualEndpointOverrides`; discovery now short-circuits when manual overrides are active.
39
+ - **Stale JWT cleared on vendor key switch**: When `setVendorKey()` sets `authMethod: 'vendor_key'`, any existing JWT tokens are now removed from config to prevent auth-method confusion in the API client.
40
+ - **Zod v4 compatibility**: Fixed `z.record(z.any())` → `z.record(z.string(), z.any())` (5 instances in `tool-schemas.ts`) and `error.errors` → `error.issues` (2 instances in schema validator).
41
+ - **Inquirer v9 compatibility**: Fixed deprecated `type: 'list'` → `type: 'select'` prompt type in `welcome.ts`.
42
+
43
+ ### 📡 Auth Gateway Integration (coordinated release)
44
+
45
+ These CLI changes are paired with server-side fixes in the same release:
46
+ - **Auth Gateway `requireAuth`**: Added opaque OAuth PKCE token introspection path — OAuth CLI sessions can now access `GET /v1/auth/me` and other protected endpoints.
47
+ - **Central API Gateway (`onasis-gateway`)**: `validateJWTToken()` now falls back to `POST /verify-token` when the session endpoint returns 401, enabling OAuth token passthrough for all proxied services. Added `get-me` tool to the auth-gateway MCP adapter.
48
+
49
+ ### 📚 Documentation
50
+
51
+ - Updated README with `onasis whoami` command reference.
52
+ - Added `auth status` live probe behavior to authentication section.
53
+ - Added `--no-mcp` flag to memory command examples.
54
+
3
55
  ## [3.9.6] - 2026-02-21
4
56
 
5
57
  ### 🐛 Bug Fixes
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @lanonasis/cli v3.9.6 - Auth Routing & Memory Reliability
1
+ # @lanonasis/cli v3.9.7 - OAuth PKCE Auth & whoami
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/@lanonasis/cli)](https://www.npmjs.com/package/@lanonasis/cli)
4
4
  [![Downloads](https://img.shields.io/npm/dt/@lanonasis/cli)](https://www.npmjs.com/package/@lanonasis/cli)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
  [![Golden Contract](https://img.shields.io/badge/Onasis--Core-v0.1%20Compliant-gold)](https://api.lanonasis.com/.well-known/onasis.json)
7
7
 
8
- 🎉 **NEW IN v3.9.6**: Fixed memory auth routing to the API gateway, added compatibility fallbacks for legacy memory endpoints, improved auth status verification, and stabilized OAuth/JWT refresh behavior during CLI memory operations.
8
+ 🎉 **NEW IN v3.9.7**: Full OAuth PKCE session support across CLI and API gateway. New `onasis whoami` command. `auth status` now shows live user profile and probes real memory API access. Seven auth verification fixes eliminate false-positive "Authenticated: Yes" reports.
9
9
 
10
10
  ## 🚀 Quick Start
11
11
 
@@ -172,13 +172,28 @@ Traditional username/password authentication:
172
172
  onasis login # Will prompt for email and password
173
173
  ```
174
174
 
175
- ### Authentication Status
175
+ ### Authentication Status & Profile
176
176
 
177
177
  ```bash
178
- onasis auth status # Check current authentication
178
+ onasis auth status # Check current authentication (probes live memory API access)
179
179
  onasis auth logout # Logout from current session
180
+ onasis whoami # Display full authenticated user profile
180
181
  ```
181
182
 
183
+ `auth status` now performs a live end-to-end check:
184
+ 1. Validates the local credential (vendor key probe hits a real protected endpoint, not `/health`)
185
+ 2. Fetches and displays your user profile from `GET /v1/auth/me`
186
+ 3. Issues a real memory list request to confirm API access is working
187
+ 4. Warns if manual endpoint overrides are active
188
+
189
+ `onasis whoami` displays:
190
+ - Email address and display name
191
+ - Role (admin, user, authenticated)
192
+ - Plan tier (free, pro, enterprise)
193
+ - OAuth provider (if applicable)
194
+ - Project scope
195
+ - Last login time
196
+
182
197
  **Auth Login Options:**
183
198
  | Short | Long | Description |
184
199
  |-------|------|-------------|
@@ -222,6 +237,7 @@ echo 'onasis --completion fish | source' >> ~/.config/fish/config.fish
222
237
  ```bash
223
238
  onasis health # Comprehensive system health check
224
239
  onasis status # Quick status overview
240
+ onasis whoami # Display authenticated user profile (email, role, plan, provider)
225
241
  onasis init # Initialize CLI configuration
226
242
  onasis guide # Interactive setup guide
227
243
  onasis quickstart # Essential commands reference
@@ -132,6 +132,16 @@ export async function generateCompletionData() {
132
132
  description: 'Show memory statistics',
133
133
  options: []
134
134
  },
135
+ {
136
+ name: 'intelligence',
137
+ description: 'Memory intelligence operations (use: memory intelligence --help)',
138
+ options: []
139
+ },
140
+ {
141
+ name: 'behavior',
142
+ description: 'Behavior pattern operations (use: memory behavior --help)',
143
+ options: []
144
+ },
135
145
  {
136
146
  name: 'bulk-delete',
137
147
  description: 'Delete multiple memories',
@@ -462,7 +462,7 @@ export function mcpCommands(program) {
462
462
  .description('Search memories via MCP')
463
463
  .argument('<query>', 'Search query')
464
464
  .option('-l, --limit <number>', 'Maximum results', '10')
465
- .option('-t, --threshold <number>', 'Similarity threshold (0-1)', '0.7')
465
+ .option('-t, --threshold <number>', 'Similarity threshold (0-1)', '0.55')
466
466
  .action(async (query, options) => {
467
467
  const spinner = ora('Searching memories via MCP...').start();
468
468
  try {
@@ -488,7 +488,7 @@ export function mcpCommands(program) {
488
488
  console.log(`\n${chalk.bold(`${index + 1}. ${memory.title}`)}`);
489
489
  console.log(` ID: ${chalk.gray(memory.id)}`);
490
490
  console.log(` Type: ${chalk.blue(memory.memory_type)}`);
491
- console.log(` Score: ${chalk.green((memory.relevance_score * 100).toFixed(1) + '%')}`);
491
+ console.log(` Score: ${chalk.green((memory.similarity_score * 100).toFixed(1) + '%')}`);
492
492
  console.log(` Content: ${memory.content.substring(0, 100)}...`);
493
493
  });
494
494
  }