opencode-usage-limit 1.0.0 → 1.0.2

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
@@ -16,38 +16,42 @@ OpenCode 플러그인 — **오늘 남은 사용량 한도**를 사이드바 최
16
16
 
17
17
  ## 설치
18
18
 
19
- ### 방법 1 — opencode 자동 설치 (백그라운드 수집기)
19
+ ### PC (Linux / macOS / Windows)
20
20
 
21
- `~/.config/opencode/opencode.jsonc`의 `plugin` 배열에 패키지 이름 추가:
22
-
23
- ```jsonc
24
- {
25
- "plugin": ["opencode-usage-limit"]
26
- }
21
+ ```bash
22
+ npx opencode-usage-limit
27
23
  ```
28
24
 
29
- opencode 시작 시 npm에서 자동 설치되어 429 수집기가 로드됩니다.
25
+ npx가 TUI 게이지와 백그라운드 수집기를 `~/.config/opencode/`에 설치하고 설정까지 등록합니다 (재실행 안전). 설치 후 opencode를 재시작하세요.
30
26
 
31
- ### 방법 2 — TUI 게이지 설치
27
+ ### Android (Termux)
32
28
 
33
- 터미널에서 한 번 실행:
29
+ Termux는 표준 shebang 경로(`/usr/bin/env`)가 없어 `npx` 직접 실행이 안 됩니다. 전역 설치 후 node로 실행하세요:
34
30
 
35
31
  ```bash
36
- npx opencode-usage-limit
32
+ npm install -g opencode-usage-limit
33
+ node "$(npm root -g)/opencode-usage-limit/bin/opencode-usage-limit.mjs"
37
34
  ```
38
35
 
39
- 설치 CLI가 TUI 플러그인을 `~/.config/opencode/tui-plugins/`에 복사하고 `tui.json`에 등록합니다.
36
+ ### opencode의 plugin 배열로 설치 (선택)
40
37
 
41
- **두 단계 모두 필요합니다** (백그라운드 수집기 + TUI 게이지). 설치 후 opencode를 재시작하세요.
38
+ `~/.config/opencode/opencode.jsonc`에 추가하면 opencode가 npm에서 자동 설치합니다 (백그라운드 수집기만 해당):
39
+
40
+ ```jsonc
41
+ {
42
+ "plugin": ["opencode-usage-limit"]
43
+ }
44
+ ```
45
+
46
+ TUI 게이지는 위의 npx/node 실행으로 별도 설치가 필요합니다.
42
47
 
43
48
  ### 제거
44
49
 
45
50
  ```bash
46
- npx opencode-usage-limit --remove
51
+ npx opencode-usage-limit --remove # PC
52
+ # Termux: node "$(npm root -g)/opencode-usage-limit/bin/opencode-usage-limit.mjs" --remove
47
53
  ```
48
54
 
49
- 설치 스크립트는 재실행해도 안전합니다 (idempotent).
50
-
51
55
  ## 설정 (`~/.config/opencode/usage-tracker.json`)
52
56
 
53
57
  | 키 | 기본값 | 설명 |
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // opencode-usage-limit 설치 CLI
3
3
  // 사용:
4
- // node install.mjs (설치 — 소스 디렉토리에서 직접 실행)
5
- // npx opencode-usage-limit (npm 설치 후)
6
- // node install.mjs --remove (제거)
4
+ // npx opencode-usage-limit (설치)
5
+ // npx opencode-usage-limit --remove (제거)
7
6
  //
8
7
  // 설치 내용:
9
8
  // 1. 백그라운드 수집기(index.js) → ~/.config/opencode/plugins/usage-tracker-collector.js 복사 + opencode.jsonc 등록
@@ -12,9 +11,10 @@
12
11
  import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, rmSync } from "node:fs"
13
12
  import path from "node:path"
14
13
  import { homedir } from "node:os"
14
+ import { fileURLToPath } from "node:url"
15
15
 
16
16
  const remove = process.argv.includes("--remove")
17
- const SRC = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..")
17
+ const SRC = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..")
18
18
  const CONFIG_DIR = process.env.OPENCODE_CONFIG_DIR || path.join(homedir(), ".config/opencode")
19
19
 
20
20
  const COLLECTOR_SRC = path.join(SRC, "index.js")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-usage-limit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "OpenCode plugin that shows today's remaining usage limit as a sidebar gauge, tracks 429 rate limits, and provides a /usage dashboard",
5
5
  "type": "module",
6
6
  "main": "index.js",