@leo000001/opencode-quota-sidebar 4.0.2 → 4.0.3
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/cli.d.ts +1 -0
- package/dist/cli.js +15 -2
- package/package.json +6 -2
package/dist/cli.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export declare function cliBaseUrl(): string;
|
|
|
15
15
|
export declare function cliServerCommandCandidates(platform?: NodeJS.Platform): CliServerCommand[];
|
|
16
16
|
export declare function runCli(argv: string[]): Promise<string>;
|
|
17
17
|
export declare function cliExitCodeForError(message: string): 0 | 1;
|
|
18
|
+
export declare function cliShouldRunMain(argv1?: string, modulePath?: string, resolvePath?: (filePath: string) => string): boolean;
|
|
18
19
|
export {};
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { spawn } from 'node:child_process';
|
|
4
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -335,6 +336,19 @@ export async function runCli(argv) {
|
|
|
335
336
|
export function cliExitCodeForError(message) {
|
|
336
337
|
return message === HELP_TEXT ? 0 : 1;
|
|
337
338
|
}
|
|
339
|
+
function resolveCliPath(filePath) {
|
|
340
|
+
try {
|
|
341
|
+
return realpathSync.native(filePath);
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
return path.resolve(filePath);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
export function cliShouldRunMain(argv1 = process.argv[1], modulePath = fileURLToPath(import.meta.url), resolvePath = resolveCliPath) {
|
|
348
|
+
if (!argv1)
|
|
349
|
+
return false;
|
|
350
|
+
return resolvePath(modulePath) === resolvePath(argv1);
|
|
351
|
+
}
|
|
338
352
|
async function main() {
|
|
339
353
|
try {
|
|
340
354
|
const output = await runCli(process.argv.slice(2));
|
|
@@ -348,7 +362,6 @@ async function main() {
|
|
|
348
362
|
process.exitCode = exitCode;
|
|
349
363
|
}
|
|
350
364
|
}
|
|
351
|
-
if (
|
|
352
|
-
path.resolve(fileURLToPath(import.meta.url)) === path.resolve(process.argv[1])) {
|
|
365
|
+
if (cliShouldRunMain()) {
|
|
353
366
|
void main();
|
|
354
367
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leo000001/opencode-quota-sidebar",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "OpenCode plugin that shows quota and token usage in TUI sidebar panels and compact session titles",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"opencode-quota": "./dist/cli.js"
|
|
9
9
|
},
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"default": "./dist/index.js"
|
|
15
15
|
},
|
|
16
|
+
"./server": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
16
20
|
"./tui": {
|
|
17
21
|
"types": "./dist/tui.d.ts",
|
|
18
22
|
"default": "./dist/tui.tsx"
|