@simonesiega/codex-limits 0.1.5 → 0.1.6

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/.env.example CHANGED
@@ -16,3 +16,6 @@ CODEX_LIMITS_USAGE_ENDPOINT=
16
16
 
17
17
  # Optional: suppress global-install guidance from the non-interactive postinstall script.
18
18
  CODEX_LIMITS_SKIP_INIT=
19
+
20
+ # Optional: override pi's global agent configuration directory for integration setup.
21
+ PI_CODING_AGENT_DIR=
package/CHANGELOG.md CHANGED
@@ -16,6 +16,23 @@ All notable changes to codex-limits are documented in this file.
16
16
 
17
17
  ### Security
18
18
 
19
+ ## [0.1.6] - 2026-07-22
20
+
21
+ ### Breaking Changes
22
+
23
+ ### Added
24
+
25
+ - Added `codex-limits doctor` and `codex-limits doctor --json` for safe environment, connectivity, local usage, authentication, OpenCode, and pi integration diagnostics.
26
+ - Added the pi agent integration with `codex-limits agents install pi` and a read-only `/codex-limits` overlay that does not send limit data to the LLM.
27
+
28
+ ### Changed
29
+
30
+ ### Fixed
31
+
32
+ ### Removed
33
+
34
+ ### Security
35
+
19
36
  ## [0.1.5] - 2026-07-22
20
37
 
21
38
  ### Breaking Changes
package/README.md CHANGED
@@ -16,13 +16,13 @@
16
16
 
17
17
  <p align="center">
18
18
  <img src="https://img.shields.io/npm/v/@simonesiega/codex-limits?label=npm" alt="npm version" />
19
- <img src="https://img.shields.io/badge/TypeScript-5-blue?logo=typescript" alt="TypeScript" />
20
- <img src="https://img.shields.io/badge/Bun-toolchain-black?logo=bun" alt="Bun toolchain" />
19
+ <img src="https://img.shields.io/badge/test_coverage-96.3%25_lines-brightgreen" alt="Test coverage: 96.3% lines" />
21
20
  </p>
22
21
 
23
22
  <p align="center">
24
23
  <a href="#local-development">
25
- <img src="https://img.shields.io/badge/test_coverage-95.9%25_lines-brightgreen" alt="Test coverage: 95.9% lines" />
24
+ <img src="https://img.shields.io/badge/TypeScript-5-blue?logo=typescript" alt="TypeScript" />
25
+ <img src="https://img.shields.io/badge/Bun-toolchain-black?logo=bun" alt="Bun toolchain" />
26
26
  </a>
27
27
  </p>
28
28
 
@@ -54,7 +54,7 @@ The screenshots show the **`codex-limits`** terminal dashboards: clean, read-onl
54
54
  - [License](#license)
55
55
  - [Contributors](#contributors)
56
56
 
57
- > Last verified against: `@simonesiega/codex-limits` v0.1.5
57
+ > Last verified against: `@simonesiega/codex-limits` v0.1.6
58
58
  > Verification date: 2026-07-22
59
59
 
60
60
  ## Quick start
@@ -83,10 +83,11 @@ Install an optional agent integration by name:
83
83
  codex-limits agents install <agent-name>
84
84
  ```
85
85
 
86
- For example, install the OpenCode integration:
86
+ For example, install the OpenCode or pi integration:
87
87
 
88
88
  ```bash
89
89
  codex-limits agents install opencode
90
+ codex-limits agents install pi
90
91
  ```
91
92
 
92
93
  The existing `codex-limits init --<agent-name>` syntax remains supported as a compatibility command.
@@ -100,13 +101,15 @@ The existing `codex-limits init --<agent-name>` syntax remains supported as a co
100
101
  | Operating systems | Windows, macOS, and Linux are supported through their standard Codex data locations. Use `CODEX_LIMITS_HOME` or `CODEX_HOME` if your data is stored elsewhere. |
101
102
  | Internet connection | Local usage fallback can work offline. An internet connection is required for current live usage and reset-credit coupon information; unavailable network data is reported safely without breaking the dashboard. |
102
103
 
104
+ The standalone CLI supports Node.js 20 and newer. The optional pi integration runs inside the pi host; pi 0.81.x requires Node.js 22.19 or newer.
105
+
103
106
  ## Overview
104
107
 
105
108
  When you are working with Codex or agent-based coding tools, usage limits can interrupt your flow if you do not know what is left or when the next reset happens.
106
109
 
107
110
  **`codex-limits`** gives you that information in one clean terminal view. It shows the usage windows currently supplied by Codex, including weekly usage and the 5-hour window when available, together with remaining percentages, progress bars, reset times, and reset-credit coupons, so you can quickly check your status and continue coding without leaving the terminal.
108
111
 
109
- It also includes plain-text commands for quick checks, JSON output for scripts and automation, optional agent integrations through `codex-limits agents`, and safe output that never prints tokens, account IDs, auth headers, cookies, or raw local files.
112
+ It also includes plain-text commands for quick checks, a safe `codex-limits doctor` diagnostic report, JSON output for scripts and automation, optional agent integrations through `codex-limits agents`, and safe output that never prints tokens, account IDs, auth headers, cookies, private paths, or raw local files.
110
113
 
111
114
  ## Agent integrations
112
115
 
@@ -119,6 +122,7 @@ For installation details, adapter behavior, architecture, and contribution guida
119
122
  | Agent | Status | Agent command | Guide | Description |
120
123
  | -------- | --------- | --------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
121
124
  | OpenCode | Supported | `/codex-limits` | [Installation and usage](docs/readme/agents/opencode.md) | Opens a fast, read-only Codex limits dashboard directly inside OpenCode without sending the request to the LLM. |
125
+ | pi | Supported | `/codex-limits` | [Installation and usage](docs/readme/agents/pi.md) | Opens a themed, read-only Codex limits overlay directly inside pi without sending the request to the LLM. |
122
126
 
123
127
  Agent integrations are not enabled automatically during package installation. They must be installed with `codex-limits agents install` (or the compatible `codex-limits init` syntax) and are only available in the agent terminal after a restart. See [Adding new agents](#adding-new-agents) if you want to add support for another agent.
124
128
 
@@ -132,9 +136,17 @@ The OpenCode integration adds a `/codex-limits` command that opens a compact mod
132
136
  <img src="docs/photos/agents/opencode/opencode_result.png" alt="OpenCode codex-limits integration screenshot" width="740" />
133
137
  </p>
134
138
 
139
+ #### pi
140
+
141
+ The pi integration adds a `/codex-limits` command that opens a themed overlay inside the agent interface. It shows the same read-only usage windows and reset-credit summary without sending the request or limit data to the LLM.
142
+
143
+ <p align="center">
144
+ <img src="docs/photos/agents/pi/pi_result.png" alt="pi codex-limits integration screenshot" width="740" />
145
+ </p>
146
+
135
147
  ### Adding new agents
136
148
 
137
- New agents can be added by creating a dedicated adapter under `src/agents/<agent-name>` and registering it in `src/agents/index.ts`. Each integration should keep the same goal: show Codex limit information quickly, safely, and without exposing tokens, account IDs, cookies, auth headers, or raw local files.
149
+ New agents use the same four-file adapter layout under `src/agents/<agent-name>`: `format.ts`, `install.ts`, `integration.ts`, and `plugin.ts`. The integration descriptor owns its metadata, environment help, installer, and read-only diagnostic check; registering that descriptor in `src/agents/index.ts` automatically connects shared installation, compatibility help, and doctor diagnostics. Each integration should show Codex limit information quickly and safely without exposing tokens, account IDs, cookies, auth headers, or raw local files.
138
150
 
139
151
  See the [Contributing](./CONTRIBUTING.md) guide if you want to add support for another agent.
140
152
 
@@ -167,6 +179,7 @@ Environment variables are only used as a fallback when automatic discovery is no
167
179
  | `CODEX_LIMITS_ACCOUNT_ID` | Provides the account ID paired with `CODEX_LIMITS_ACCESS_TOKEN`. |
168
180
  | `CODEX_LIMITS_USAGE_ENDPOINT` | Overrides the live usage endpoint with HTTPS or loopback HTTP for advanced setups/tests. |
169
181
  | `CODEX_LIMITS_SKIP_INIT` | Suppresses optional global-install setup guidance from the non-interactive postinstall. |
182
+ | `PI_CODING_AGENT_DIR` | Overrides pi's global agent configuration directory for integration setup and checks. |
170
183
 
171
184
  ### Data access and safety
172
185
 
@@ -181,11 +194,39 @@ Local Codex data is inspected read-only with bounded file, directory, JSONL, and
181
194
  | `codex-limits coupons` | Prints reset-credit coupon information. |
182
195
  | `codex-limits coupons --json` | Prints machine-readable reset-credit coupon data only. |
183
196
  | `codex-limits --json` | Prints machine-readable usage and coupon data. |
197
+ | `codex-limits doctor` | Prints safe environment and connectivity diagnostics. |
198
+ | `codex-limits doctor --json` | Prints machine-readable diagnostics only. |
184
199
  | `codex-limits agents` | Lists the available agent-management subcommands. |
185
200
  | `codex-limits agents install <agent...>` | Installs one or more named agent integrations. |
186
201
  | `codex-limits agents install --all` | Installs every supported agent integration. |
187
202
  | `codex-limits init` | Runs the compatible interactive installation flow. |
188
203
 
204
+ ### Diagnostics
205
+
206
+ Run the read-only doctor command when Codex data, live usage, or an agent integration is unavailable:
207
+
208
+ ```bash
209
+ codex-limits doctor
210
+ ```
211
+
212
+ ```text
213
+ Codex Limits diagnostics
214
+
215
+ Package version: 0.1.6
216
+ Node.js version: 22.0.0
217
+ Operating system: Windows
218
+ Codex home detected: Yes
219
+ Authentication found: Yes
220
+ Local usage found: Yes
221
+ Live endpoint: Reachable
222
+ OpenCode integration: Installed
223
+ pi integration: Installed
224
+
225
+ No sensitive values were displayed.
226
+ ```
227
+
228
+ The doctor checks only whether recognized resources are available, including the OpenCode and pi integrations. It never prints credential values, private paths, endpoint URLs, configuration contents, or raw Codex data. The live check makes the same bounded authenticated read-only usage request as the dashboard; it is reported as `Not checked` when complete authentication is unavailable. Use `codex-limits doctor --json` for the stable machine-readable form documented in [JSON output](docs/readme/json-output.md#doctor-document).
229
+
189
230
  ### Agent management
190
231
 
191
232
  Use `codex-limits agents install` to install optional integrations. Installation only updates the selected agent configuration; it does not send a prompt to an LLM or modify Codex data.
@@ -209,7 +250,7 @@ Make sure Codex has been run and authenticated at least once. If its data is sto
209
250
 
210
251
  ### Usage information unavailable
211
252
 
212
- Run `codex-limits status` to view the safe warning summary. Confirm that Codex authentication is current and that the machine can reach the ChatGPT Codex service. Local session data may still provide a fallback when live usage is unavailable; coupon information requires an internet connection.
253
+ Run `codex-limits doctor` to check Codex home discovery, authentication presence, local usage, and live endpoint reachability without exposing sensitive values. Run `codex-limits status` to view the safe warning summary. Confirm that Codex authentication is current and that the machine can reach the ChatGPT Codex service. Local session data may still provide a fallback when live usage is unavailable; coupon information requires an internet connection.
213
254
 
214
255
  ### Permission errors
215
256
 
@@ -217,7 +258,7 @@ Confirm that your user can read the selected Codex directory and its session fil
217
258
 
218
259
  ### Agent command not appearing after installation
219
260
 
220
- Run the named installer again, for example `codex-limits agents install opencode`, and confirm that it reports the integration as installed or already installed. Restart the target agent terminal so it reloads its configuration. If the command is still missing, verify that the displayed configuration paths belong to the agent installation you are using.
261
+ Run the named installer again, for example `codex-limits agents install opencode` or `codex-limits agents install pi`, and confirm that it reports the integration as installed or already installed. Restart the target agent terminal so it reloads its configuration. If the command is still missing, verify that the displayed configuration paths belong to the agent installation you are using.
221
262
 
222
263
  ## Documentation
223
264
 
@@ -254,11 +295,12 @@ Useful development commands:
254
295
 
255
296
  ## Security
256
297
 
257
- | Operation | Reads | Writes | Network |
258
- | ------------------------- | ----------------------------------------------- | --------------------------------- | ------------------------------- |
259
- | `codex-limits` | Recognized Codex state and bounded session data | Nothing | Live usage and coupon endpoints |
260
- | `status` / `coupons` | Shared read-only core | Nothing | When live data is requested |
261
- | `agents install` / `init` | Selected agent configuration | Adds the integration registration | Does not send an LLM prompt |
298
+ | Operation | Reads | Writes | Network |
299
+ | ------------------------- | ----------------------------------------------- | --------------------------------- | -------------------------------------- |
300
+ | `codex-limits` | Recognized Codex state and bounded session data | Nothing | Live usage and coupon endpoints |
301
+ | `status` / `coupons` | Shared read-only core | Nothing | When live data is requested |
302
+ | `doctor` | Bounded Codex and agent configuration checks | Nothing | Live usage endpoint when authenticated |
303
+ | `agents install` / `init` | Selected agent configuration | Adds the integration registration | Does not send an LLM prompt |
262
304
 
263
305
  For vulnerability reports and local data safety details, see [`SECURITY.md`](./SECURITY.md).
264
306
 
package/SECURITY.md CHANGED
@@ -65,11 +65,15 @@ The CLI performs bounded, read-only inspection of recognized Codex home candidat
65
65
 
66
66
  For live usage and coupon information, the project contacts the default ChatGPT Codex endpoints. The only endpoint override is `CODEX_LIMITS_USAGE_ENDPOINT`, mainly for testing or advanced setups. Overrides must use HTTPS, except for loopback HTTP during local testing. Authenticated requests reject redirects, use bounded timeouts and responses, and never include credential headers in diagnostics.
67
67
 
68
- Agent integrations follow the same safety model: they should display a read-only summary by reusing the shared core, not send private Codex data to the agent, and not expose sensitive values inside the agent UI.
68
+ Agent integrations follow the same safety model: they should display a read-only summary by reusing the shared core, not send private Codex data to the agent, and not expose sensitive values inside the agent UI. The pi extension runs only its local command handler and does not inject a user or custom message into the model context.
69
+
70
+ Agent installers use bounded JSON reads and owner-only atomic replacements. The pi installer registers the already installed local package root and does not download a package or execute dependency lifecycle scripts.
71
+
72
+ The `codex-limits doctor` command exposes only package/runtime labels and bounded availability statuses. Its Codex, OpenCode, and pi checks never return credential values, private paths, endpoint URLs, configuration contents, or raw local files. The optional live reachability check uses the same authenticated, bounded, redirect-free usage transport as the dashboard.
69
73
 
70
74
  ### Command safety boundaries
71
75
 
72
- Every CLI command declares one enforced safety category. Dashboard, status, coupon, and agent-inspection commands are read-only and receive no write or account-mutation services. Agent installation is a local-write operation scoped to the selected agent configuration. Any future remote account mutation must use the separate `remote-mutation` category and declare an explicit boolean confirmation option before the router will execute it.
76
+ Every CLI command declares one enforced safety category. Dashboard, status, coupon, doctor, and agent-inspection commands are read-only and receive no write or account-mutation services. Agent installation is a local-write operation scoped to the selected agent configuration. Any future remote account mutation must use the separate `remote-mutation` category and declare an explicit boolean confirmation option before the router will execute it.
73
77
 
74
78
  The existing `codex-limits init` compatibility command and the preferred `codex-limits agents install` command share the same local-write implementation. Neither command modifies Codex data or sends an LLM prompt.
75
79
 
@@ -86,7 +90,7 @@ Relevant examples include:
86
90
  - agent integrations exposing private Codex data inside the agent UI;
87
91
  - unexpected writes to local Codex data;
88
92
  - unexpected network behavior related to usage or coupon discovery;
89
- - unsafe handling of `CODEX_LIMITS_HOME`, `CODEX_LIMITS_ACCESS_TOKEN`, `CODEX_LIMITS_ACCOUNT_ID`, or `CODEX_LIMITS_USAGE_ENDPOINT`.
93
+ - unsafe handling of `CODEX_LIMITS_HOME`, `CODEX_LIMITS_ACCESS_TOKEN`, `CODEX_LIMITS_ACCOUNT_ID`, `CODEX_LIMITS_USAGE_ENDPOINT`, or `PI_CODING_AGENT_DIR`.
90
94
 
91
95
  ## Safety expectations
92
96