vigthoria-cli 1.11.44 → 1.11.46
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/dist/commands/auth.js
CHANGED
|
@@ -4,6 +4,7 @@ import { homedir } from 'os';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import readline from 'readline';
|
|
6
6
|
import { Config } from '../utils/config.js';
|
|
7
|
+
import { clearGatewayPreflightCache } from '../utils/cli-state.js';
|
|
7
8
|
const DEFAULT_API_URL = 'https://coder.vigthoria.io';
|
|
8
9
|
const CONFIG_DIR = path.join(homedir(), '.vigthoria');
|
|
9
10
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
@@ -148,12 +149,16 @@ export function saveAuthConfig(config) {
|
|
|
148
149
|
// Best-effort on non-POSIX filesystems.
|
|
149
150
|
}
|
|
150
151
|
syncSharedConfig(config);
|
|
152
|
+
// A fresh login must never be blocked by a stale cached gateway-preflight
|
|
153
|
+
// failure from a prior (invalid) session.
|
|
154
|
+
clearGatewayPreflightCache();
|
|
151
155
|
}
|
|
152
156
|
export function clearAuthConfig() {
|
|
153
157
|
if (existsSync(CONFIG_FILE)) {
|
|
154
158
|
rmSync(CONFIG_FILE, { force: true });
|
|
155
159
|
}
|
|
156
160
|
clearSharedConfigAuth();
|
|
161
|
+
clearGatewayPreflightCache();
|
|
157
162
|
}
|
|
158
163
|
export function getAuthToken() {
|
|
159
164
|
return process.env.VIGTHORIA_TOKEN || loadAuthConfig().token;
|
|
@@ -51,4 +51,11 @@ export declare function readCachedLatestVersion(maxAgeMs?: number): string | nul
|
|
|
51
51
|
export declare function writeCachedLatestVersion(latestVersion: string, notifiedFor?: string): void;
|
|
52
52
|
export declare function readGatewayPreflightCache(maxAgeMs?: number): boolean | null;
|
|
53
53
|
export declare function writeGatewayPreflightCache(valid: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Invalidate any cached gateway-preflight result. Must be called on
|
|
56
|
+
* every login/logout/token change so a stale cached `false` from a
|
|
57
|
+
* prior (invalid) session can never block the very next auth-protected
|
|
58
|
+
* command run right after a fresh, successful login.
|
|
59
|
+
*/
|
|
60
|
+
export declare function clearGatewayPreflightCache(): void;
|
|
54
61
|
export declare function isSafeNpmPackageSpec(spec: string): boolean;
|
package/dist/utils/cli-state.js
CHANGED
|
@@ -163,6 +163,24 @@ export function writeGatewayPreflightCache(valid) {
|
|
|
163
163
|
// Best-effort.
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Invalidate any cached gateway-preflight result. Must be called on
|
|
168
|
+
* every login/logout/token change so a stale cached `false` from a
|
|
169
|
+
* prior (invalid) session can never block the very next auth-protected
|
|
170
|
+
* command run right after a fresh, successful login.
|
|
171
|
+
*/
|
|
172
|
+
export function clearGatewayPreflightCache() {
|
|
173
|
+
try {
|
|
174
|
+
const state = readStateUnchecked();
|
|
175
|
+
if (state.gatewayPreflight) {
|
|
176
|
+
delete state.gatewayPreflight;
|
|
177
|
+
saveCliState(state);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// Best-effort.
|
|
182
|
+
}
|
|
183
|
+
}
|
|
166
184
|
/**
|
|
167
185
|
* Validate an npm package spec used by `vigthoria update --from <spec>`.
|
|
168
186
|
* Returns `true` when the spec is acceptable. Rejects whitespace and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vigthoria-cli",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.46",
|
|
4
4
|
"description": "Vigthoria Coder CLI - AI-powered terminal coding assistant",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
"author": "Vigthoria Technologies",
|
|
88
88
|
"license": "MIT",
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"archiver": "^
|
|
90
|
+
"archiver": "^7.0.1",
|
|
91
91
|
"axios": "^1.6.0",
|
|
92
92
|
"chalk": "^5.3.0",
|
|
93
93
|
"chokidar": "^5.0.0",
|
|
94
94
|
"commander": "^11.1.0",
|
|
95
95
|
"conf": "^12.0.0",
|
|
96
96
|
"diff": "^5.1.0",
|
|
97
|
-
"glob": "^
|
|
97
|
+
"glob": "^13.0.6",
|
|
98
98
|
"inquirer": "^9.2.12",
|
|
99
99
|
"marked": "^11.0.0",
|
|
100
100
|
"marked-terminal": "^6.2.0",
|
|
@@ -115,5 +115,8 @@
|
|
|
115
115
|
},
|
|
116
116
|
"engines": {
|
|
117
117
|
"node": ">=18.0.0"
|
|
118
|
+
},
|
|
119
|
+
"overrides": {
|
|
120
|
+
"glob": "^13.0.6"
|
|
118
121
|
}
|
|
119
122
|
}
|