idletime 0.1.1 → 0.1.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
@@ -178,6 +178,19 @@ bun run typecheck
178
178
  bun test
179
179
  ```
180
180
 
181
+ Release QA:
182
+
183
+ ```bash
184
+ bun run qa
185
+ ```
186
+
187
+ That QA pass reads:
188
+
189
+ - `qa/data/user-journeys.csv` for installed-binary shell journeys
190
+ - `qa/data/coverage-matrix.csv` for required release coverage rows
191
+
192
+ It builds the package, packs the current checkout, installs the tarball into an isolated temp `BUN_INSTALL`, seeds synthetic Codex session logs, and runs the shell journeys against the installed `idletime` binary.
193
+
181
194
  ## Release Prep
182
195
 
183
196
  Build the publishable CLI bundle:
@@ -192,6 +205,13 @@ Dry-run the release checks:
192
205
  bun run check:release
193
206
  ```
194
207
 
208
+ `check:release` now runs:
209
+
210
+ - `bun run typecheck`
211
+ - `bun test`
212
+ - `bun run qa`
213
+ - `npm pack --dry-run`
214
+
195
215
  Dry-run the Bun publish flow:
196
216
 
197
217
  ```bash
@@ -206,11 +226,15 @@ bun run pack:dry-run
206
226
 
207
227
  ## GitHub Release Flow
208
228
 
209
- This repo now includes a publish workflow at `.github/workflows/publish.yml`.
229
+ This repo now includes:
230
+
231
+ - `.github/workflows/ci.yml` for push and pull-request release checks
232
+ - `.github/workflows/publish.yml` for the actual npm publish flow
210
233
 
211
234
  What it does:
212
235
 
213
- - runs on manual dispatch or GitHub release publish
236
+ - `ci.yml` runs on pushes to `dev` and `main`, plus pull requests
237
+ - `publish.yml` runs on manual dispatch or GitHub release publish
214
238
  - installs Bun and Node on a GitHub-hosted runner
215
239
  - runs `bun run check:release`
216
240
  - publishes to npm with `npm publish --access public --provenance`
package/dist/idletime.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // package.json
3
3
  var package_default = {
4
4
  name: "idletime",
5
- version: "0.1.1",
5
+ version: "0.1.2",
6
6
  description: "Visual CLI for Codex focus, token burn, spikes, and idle time from local session logs.",
7
7
  author: "ParkerRex",
8
8
  main: "./dist/idletime.js",
@@ -46,12 +46,15 @@ var package_default = {
46
46
  sideEffects: false,
47
47
  scripts: {
48
48
  build: "bun run src/release/build-package.ts",
49
- "check:release": "bun run typecheck && bun test && bun run build && npm pack --dry-run",
49
+ "check:release": "bun run typecheck && bun test && bun run qa && npm pack --dry-run",
50
50
  dev: "bun run src/cli/idletime-bin.ts",
51
51
  idletime: "bun run src/cli/idletime-bin.ts",
52
52
  "pack:dry-run": "npm pack --dry-run",
53
53
  "publish:dry-run": "bun run build && bun publish --dry-run --access public",
54
54
  prepublishOnly: "bun run check:release",
55
+ qa: "bun run qa:gaps && bun run qa:journeys",
56
+ "qa:gaps": "bun run qa/find-gaps.ts",
57
+ "qa:journeys": "bun run qa/run-shell-journeys.ts",
55
58
  test: "bun test",
56
59
  typecheck: "tsc --noEmit"
57
60
  },
@@ -518,6 +521,16 @@ function parseCodexLogLine(lineText, sourceFilePath, lineNumber) {
518
521
  }
519
522
 
520
523
  // src/codex-session-log/token-usage.ts
524
+ function zeroTokenUsage() {
525
+ return {
526
+ inputTokens: 0,
527
+ cachedInputTokens: 0,
528
+ outputTokens: 0,
529
+ reasoningOutputTokens: 0,
530
+ totalTokens: 0,
531
+ practicalBurn: 0
532
+ };
533
+ }
521
534
  function readTokenUsage(value, label) {
522
535
  const record = expectObject(value, label);
523
536
  const inputTokens = readNumber(record, "input_tokens", label);
@@ -545,7 +558,7 @@ function subtractTokenUsages(currentUsage, previousUsage) {
545
558
  };
546
559
  for (const [key, value] of Object.entries(nextUsage)) {
547
560
  if (value < 0) {
548
- throw new Error(`Token usage regressed for ${key}.`);
561
+ return null;
549
562
  }
550
563
  }
551
564
  return nextUsage;
@@ -567,9 +580,11 @@ function extractTokenPoints(records) {
567
580
  continue;
568
581
  }
569
582
  const infoRecord = expectObject(info, "event_msg.payload.info");
583
+ const lastUsageValue = infoRecord.last_token_usage;
570
584
  tokenPoints.push({
571
585
  timestamp: record.timestamp,
572
- usage: readTokenUsage(infoRecord.total_token_usage, "event_msg.payload.info.total_token_usage")
586
+ usage: readTokenUsage(infoRecord.total_token_usage, "event_msg.payload.info.total_token_usage"),
587
+ lastUsage: lastUsageValue === null || lastUsageValue === undefined ? null : readTokenUsage(lastUsageValue, "event_msg.payload.info.last_token_usage")
573
588
  });
574
589
  }
575
590
  return tokenPoints.sort((leftPoint, rightPoint) => leftPoint.timestamp.getTime() - rightPoint.timestamp.getTime());
@@ -581,12 +596,21 @@ function buildTokenDeltaPoints(tokenPoints) {
581
596
  deltaPoints.push({
582
597
  timestamp: tokenPoint.timestamp,
583
598
  cumulativeUsage: tokenPoint.usage,
584
- deltaUsage: previousPoint ? subtractTokenUsages(tokenPoint.usage, previousPoint.usage) : tokenPoint.usage
599
+ deltaUsage: resolveTokenDeltaUsage(tokenPoint, previousPoint)
585
600
  });
586
601
  previousPoint = tokenPoint;
587
602
  }
588
603
  return deltaPoints;
589
604
  }
605
+ function resolveTokenDeltaUsage(tokenPoint, previousPoint) {
606
+ if (tokenPoint.lastUsage) {
607
+ return tokenPoint.lastUsage;
608
+ }
609
+ if (!previousPoint) {
610
+ return tokenPoint.usage;
611
+ }
612
+ return subtractTokenUsages(tokenPoint.usage, previousPoint.usage) ?? zeroTokenUsage();
613
+ }
590
614
 
591
615
  // src/codex-session-log/extract-turn-attribution.ts
592
616
  function extractTurnAttribution(records) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idletime",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Visual CLI for Codex focus, token burn, spikes, and idle time from local session logs.",
5
5
  "author": "ParkerRex",
6
6
  "main": "./dist/idletime.js",
@@ -44,12 +44,15 @@
44
44
  "sideEffects": false,
45
45
  "scripts": {
46
46
  "build": "bun run src/release/build-package.ts",
47
- "check:release": "bun run typecheck && bun test && bun run build && npm pack --dry-run",
47
+ "check:release": "bun run typecheck && bun test && bun run qa && npm pack --dry-run",
48
48
  "dev": "bun run src/cli/idletime-bin.ts",
49
49
  "idletime": "bun run src/cli/idletime-bin.ts",
50
50
  "pack:dry-run": "npm pack --dry-run",
51
51
  "publish:dry-run": "bun run build && bun publish --dry-run --access public",
52
52
  "prepublishOnly": "bun run check:release",
53
+ "qa": "bun run qa:gaps && bun run qa:journeys",
54
+ "qa:gaps": "bun run qa/find-gaps.ts",
55
+ "qa:journeys": "bun run qa/run-shell-journeys.ts",
53
56
  "test": "bun test",
54
57
  "typecheck": "tsc --noEmit"
55
58
  },