@mohndoe/pi-atlas 0.1.3 → 0.1.5

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.
@@ -0,0 +1,25 @@
1
+ on:
2
+ push:
3
+ branches:
4
+ - main
5
+
6
+ permissions:
7
+ contents: write
8
+ issues: write
9
+ pull-requests: write
10
+
11
+ name: release-please
12
+
13
+ jobs:
14
+ release-please:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: googleapis/release-please-action@v4
18
+ with:
19
+ # this assumes that you have created a personal access token
20
+ # (PAT) and configured it as a GitHub action secret named
21
+ # `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
22
+ token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
23
+ # this is a built-in strategy in release-please, see "Action Inputs"
24
+ # for more options
25
+ release-type: node
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ ## [0.1.5](https://github.com/MohnDoe/pi-atlas/compare/v0.1.4...v0.1.5) (2026-06-29)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * very small currency display more decimal numbers ([2ef2a44](https://github.com/MohnDoe/pi-atlas/commit/2ef2a44daf8e7ae236acd3f0fb4ba4b10a7d2dd1))
9
+ * very small currency display more decimal numbers ([63da93b](https://github.com/MohnDoe/pi-atlas/commit/63da93b0699b3f94b25a24055072bca2bce78dc3))
10
+
11
+ ## [0.1.4](https://github.com/MohnDoe/pi-atlas/compare/v0.1.3...v0.1.4) (2026-06-29)
12
+
13
+
14
+ ### Features
15
+
16
+ * add Release Please GH Action ([5629007](https://github.com/MohnDoe/pi-atlas/commit/5629007ecacbeb013277bbccd4171b50ff3d3c36))
17
+ * add screenshot for pi.dev packages directory ([413890d](https://github.com/MohnDoe/pi-atlas/commit/413890d1c694b2c81b4dfcb7bb4219a36ad43937))
18
+ * add screenshot to README ([5e0895d](https://github.com/MohnDoe/pi-atlas/commit/5e0895d4620ac3220ddc0c93a0edcb5e659ee4c5))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **compute:** consolidate fragile double-sort into single sort ([781c5e4](https://github.com/MohnDoe/pi-atlas/commit/781c5e4950473b0c9d10371400147c24334f851b))
24
+ * Release Please workflow ([81b47ff](https://github.com/MohnDoe/pi-atlas/commit/81b47ff1797984d1bfc0e1b70f53e33bc17de615))
25
+ * replace invalid locale "en-EN" with "en-US" ([8e7f360](https://github.com/MohnDoe/pi-atlas/commit/8e7f3609761e8ce113e4d0601429521515f905e1))
26
+ * tables for languages, models, projects and usage have better proportions ([9866ef1](https://github.com/MohnDoe/pi-atlas/commit/9866ef173459be29158d3ef6d55676b93d48e9a9))
27
+
28
+
29
+ ### Miscellaneous Chores
30
+
31
+ * force version ([899f17d](https://github.com/MohnDoe/pi-atlas/commit/899f17d508689dd18c2d8adc5b247e51b412ef87))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohndoe/pi-atlas",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "See your agent usage and cost directly in Pi — costs, languages, models, projects, and tools from session logs.",
5
5
  "keywords": [
6
6
  "pi",
@@ -201,10 +201,31 @@ describe("formatNumber", () => {
201
201
  });
202
202
 
203
203
  describe("formatCost", () => {
204
- it("formats small costs with $ and least decimals possible", () => {
204
+ it("formats small costs with least decimals possible", () => {
205
205
  expect(formatCost(0)).toBe("$0");
206
+
207
+ expect(formatCost(0.00008)).toBe("$0.0001");
208
+ expect(formatCost(0.0005)).toBe("$0.0005");
209
+ expect(formatCost(0.004)).toBe("$0.004");
210
+ expect(formatCost(0.04)).toBe("$0.04");
211
+ expect(formatCost(0.049)).toBe("$0.05");
212
+
213
+ expect(formatCost(0.324)).toBe("$0.32");
214
+ expect(formatCost(0.328)).toBe("$0.33");
215
+ expect(formatCost(0.32557)).toBe("$0.33");
216
+
217
+ expect(formatCost(1.004)).toBe("$1.01");
218
+
206
219
  expect(formatCost(1.5)).toBe("$1.5");
220
+ expect(formatCost(1.23)).toBe("$1.23");
221
+ expect(formatCost(1.231)).toBe("$1.23");
222
+ expect(formatCost(1.238)).toBe("$1.24");
223
+
207
224
  expect(formatCost(999.99)).toBe("$999.99");
225
+ expect(formatCost(999.991)).toBe("$999.99");
226
+
227
+ expect(formatCost(999.9949)).toBe("$1,000");
228
+ expect(formatCost(999.999)).toBe("$1,000");
208
229
  });
209
230
 
210
231
  it("formats thousands with k", () => {
package/src/format.ts CHANGED
@@ -150,6 +150,13 @@ const usdFormatter = new Intl.NumberFormat("en-US", {
150
150
  maximumFractionDigits: 2,
151
151
  });
152
152
 
153
+ const smallUsdFormatter = new Intl.NumberFormat("en-US", {
154
+ style: "currency",
155
+ currency: "USD",
156
+ minimumFractionDigits: 0,
157
+ maximumFractionDigits: 4,
158
+ });
159
+
153
160
  // ---- Number formatting ----
154
161
 
155
162
  export function formatNumber(n: number): string {
@@ -162,7 +169,22 @@ export function formatNumber(n: number): string {
162
169
  export function formatCost(n: number): string {
163
170
  if (n >= 1_000_000) return usdFormatter.format(n / 1_000_000) + "M";
164
171
  if (n >= 1_000) return usdFormatter.format(n / 1_000) + "k";
165
- return usdFormatter.format(n);
172
+
173
+ // Very small values (< 1¢): show with up to 3 significant digits
174
+ if (n > 0 && n < 0.01) {
175
+ return smallUsdFormatter.format(n);
176
+ }
177
+
178
+ // >= $1: round to nearest cent with small fudge
179
+ // to compensate for floating-point imprecision (e.g., 1.004 → $1.01)
180
+ if (n >= 1) {
181
+ const rounded = Math.round(n * 100 + 0.1) / 100;
182
+ return usdFormatter.format(rounded);
183
+ }
184
+
185
+ // >= 1¢, < $1: standard rounding to nearest cent
186
+ const rounded = Math.round(n * 100) / 100;
187
+ return usdFormatter.format(rounded);
166
188
  }
167
189
 
168
190
  // ---- Timestamp formatting ----
@@ -69,10 +69,10 @@ export class Languages extends Container {
69
69
  this.table = new SortedTable(
70
70
  {
71
71
  columns: [
72
- { header: cell.header("Name"), width: 12 },
73
- { header: cell.header("Share %"), width: "fill" },
74
- { header: cell.header("Edits"), width: 8 },
75
- { header: cell.header("Lines"), width: 14 },
72
+ { header: cell.header("Name"), width: "fill" },
73
+ { header: cell.header("Share %"), width: 20 },
74
+ { header: cell.header("Edits"), width: 10 },
75
+ { header: cell.header("Lines"), width: 12 },
76
76
  ],
77
77
  rows: this.rows,
78
78
  maxHeight: this.maxHeight,
@@ -68,11 +68,11 @@ export class Models extends Container {
68
68
  this.table = new SortedTable(
69
69
  {
70
70
  columns: [
71
- { header: cell.header("Name"), width: 32 },
72
- { header: cell.header("Provider"), width: 16 },
73
- { header: cell.header("Cost %"), width: "fill" },
71
+ { header: cell.header("Name"), width: "fill" },
72
+ { header: cell.header("Provider"), width: 20 },
73
+ { header: cell.header("Cost %"), width: 14 },
74
74
  { header: cell.header("Calls"), width: 10 },
75
- { header: cell.header("Cost"), width: 12 },
75
+ { header: cell.header("Cost"), width: 10 },
76
76
  ],
77
77
  rows: this.rows,
78
78
  maxHeight: this.maxHeight,
@@ -64,9 +64,9 @@ export class Projects extends Container {
64
64
  this.table = new SortedTable(
65
65
  {
66
66
  columns: [
67
- { header: cell.header("Name"), width: 20 },
68
- { header: cell.header("Share %"), width: "fill" },
69
- { header: cell.header("Sessions"), width: 14 },
67
+ { header: cell.header("Name"), width: "fill" },
68
+ { header: cell.header("Share %"), width: 14 },
69
+ { header: cell.header("Sessions"), width: 10 },
70
70
  { header: cell.header("Cost"), width: 10 },
71
71
  ],
72
72
  rows: this.rows,
package/src/tabs/Usage.ts CHANGED
@@ -152,8 +152,8 @@ export class Usage extends Container {
152
152
  this.table = new SortedTable(
153
153
  {
154
154
  columns: [
155
- { header: cell.header("Command"), width: 20 },
156
- { header: cell.header("Share %"), width: "fill" },
155
+ { header: cell.header("Command"), width: "fill" },
156
+ { header: cell.header("Share %"), width: 20 },
157
157
  { header: cell.header("Calls"), width: 12 },
158
158
  ],
159
159
  rows: this.rows,