pi-extensions 0.1.21 → 0.1.23

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,19 @@
1
+ name: Apply Skill Optimization
2
+ on:
3
+ issue_comment:
4
+ types: [created]
5
+
6
+ jobs:
7
+ apply:
8
+ if: >-
9
+ github.event.issue.pull_request &&
10
+ contains(github.event.comment.body, '/apply-optimize')
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ pull-requests: write
14
+ contents: write
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: tesslio/skill-review-and-optimize@d81583861aaf29d1da7f10e6539efef4e27b0dd5
18
+ with:
19
+ mode: 'apply'
@@ -0,0 +1,17 @@
1
+ name: Skill Review & Optimize
2
+ on:
3
+ pull_request:
4
+ paths: ['**/SKILL.md']
5
+
6
+ jobs:
7
+ review:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ pull-requests: write
11
+ contents: read
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: tesslio/skill-review-and-optimize@d81583861aaf29d1da7f10e6539efef4e27b0dd5
15
+ with:
16
+ optimize: 'true'
17
+ tessl-token: ${{ secrets.TESSL_API_TOKEN }}
@@ -0,0 +1,86 @@
1
+ name: weather-native-bridge
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+ id-token: write
9
+
10
+ jobs:
11
+ build-prebuilt:
12
+ name: build (${{ matrix.target }})
13
+ runs-on: ${{ matrix.runner }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ include:
18
+ - runner: macos-14
19
+ target: aarch64-apple-darwin
20
+ - runner: macos-14
21
+ target: x86_64-apple-darwin
22
+ - runner: ubuntu-latest
23
+ target: x86_64-unknown-linux-gnu
24
+ - runner: windows-latest
25
+ target: x86_64-pc-windows-msvc
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - name: Setup Node.js
31
+ uses: actions/setup-node@v4
32
+ with:
33
+ node-version: 20
34
+
35
+ - name: Setup Rust toolchain
36
+ uses: dtolnay/rust-toolchain@stable
37
+ with:
38
+ targets: ${{ matrix.target }}
39
+
40
+ - name: Install bridge dependencies
41
+ working-directory: weather/native/weathr-bridge
42
+ run: npm install --no-package-lock
43
+
44
+ - name: Build prebuilt binary
45
+ working-directory: weather/native/weathr-bridge
46
+ run: npx napi build --platform --release --dts native.d.ts --target ${{ matrix.target }}
47
+
48
+ - name: Upload binary artifact
49
+ uses: actions/upload-artifact@v4
50
+ with:
51
+ name: bindings-${{ matrix.target }}
52
+ path: weather/native/weathr-bridge/pi_weather_bridge.*.node
53
+ if-no-files-found: error
54
+
55
+ publish-platform-packages:
56
+ name: publish prebuilt packages
57
+ runs-on: ubuntu-latest
58
+ needs: build-prebuilt
59
+
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+
63
+ - name: Setup Node.js
64
+ uses: actions/setup-node@v4
65
+ with:
66
+ node-version: 20
67
+ registry-url: https://registry.npmjs.org
68
+
69
+ - name: Download artifacts
70
+ uses: actions/download-artifact@v4
71
+ with:
72
+ path: weather/native/weathr-bridge/artifacts
73
+
74
+ - name: Prepare npm package folders
75
+ working-directory: weather
76
+ run: npm run native:prepare-packages
77
+
78
+ - name: Sync artifacts into npm package folders
79
+ working-directory: weather
80
+ run: npm run native:sync-artifacts
81
+
82
+ - name: Publish platform packages
83
+ working-directory: weather
84
+ run: npm run native:publish-packages
85
+ env:
86
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,30 +1,61 @@
1
1
  ---
2
2
  name: extending-pi
3
- description: Guide for extending Pi — decide between skills, extensions, prompt templates, themes, context files, or custom models, then create and package them. Use when someone wants to extend Pi, add capabilities, create a skill, build an extension, or make a Pi package.
3
+ description: Guide for extending Pi — decide between skills, extensions, prompt templates, themes, context files, or custom models, then scaffold files, configure manifests, and package them. Use when someone wants to extend Pi, add capabilities, create a skill, build an extension, make a Pi package, scaffold extension files, or configure a manifest.json.
4
4
  ---
5
5
 
6
6
  # Extending Pi
7
7
 
8
- Help the user decide what to build and where to find guidance.
8
+ Help the user decide what to build, scaffold the right files, and point to detailed guidance.
9
9
 
10
10
  ## What to build
11
11
 
12
- | Goal | Build a… | Where |
13
- |------|----------|-------|
14
- | Teach Pi a workflow or how to use a tool/API/CLI | **Skill** | Read `skill-creator/SKILL.md` for detailed guidance |
15
- | Give Pi a new tool, command, or runtime behavior | **Extension** | Read Pi docs: `docs/extensions.md` |
16
- | Reuse a prompt pattern with variables | **Prompt template** | Read Pi docs: `docs/prompt-templates.md` |
17
- | Set project-wide coding guidelines | **Context file** | `AGENTS.md` in project root or `.pi/agent/` — just markdown |
18
- | Change Pi's appearance | **Theme** | Read Pi docs: `docs/themes.md` |
19
- | Add a model or provider | **Custom model** | Read Pi docs: `docs/models.md` (JSON) or `docs/custom-provider.md` (extension) |
20
- | Share any of the above | **Package** | Read Pi docs: `docs/packages.md` |
12
+ | Goal | Build a… | Key files to create | Where |
13
+ |------|----------|-------------------|-------|
14
+ | Teach Pi a workflow or how to use a tool/API/CLI | **Skill** | `SKILL.md` with YAML frontmatter + markdown body | Read `skill-creator/SKILL.md` for detailed guidance |
15
+ | Give Pi a new tool, command, or runtime behavior | **Extension** | `manifest.json` + `src/index.ts` entry point | Read Pi docs: `docs/extensions.md` |
16
+ | Reuse a prompt pattern with variables | **Prompt template** | `.md` file with `{{variable}}` placeholders | Read Pi docs: `docs/prompt-templates.md` |
17
+ | Set project-wide coding guidelines | **Context file** | `AGENTS.md` in project root or `.pi/agent/` — just markdown | No extra docs needed |
18
+ | Change Pi's appearance | **Theme** | `theme.json` with color and font definitions | Read Pi docs: `docs/themes.md` |
19
+ | Add a model or provider | **Custom model** | `models.json` or extension with provider registration | Read Pi docs: `docs/models.md` (JSON) or `docs/custom-provider.md` (extension) |
20
+ | Share any of the above | **Package** | `manifest.json` with dependencies and entry points | Read Pi docs: `docs/packages.md` |
21
21
 
22
22
  ## Skill vs Extension — the fuzzy boundary
23
23
 
24
- If `bash` + instructions can do it, prefer a **skill** (simpler, no code to maintain). If you need event hooks, typed tools, UI components, or policy enforcement, use an **extension**.
24
+ If `bash` + instructions can do it, prefer a **Skill** (simpler, no code to maintain). If you need event hooks, typed tools, UI components, or policy enforcement, use an **Extension**.
25
25
 
26
26
  Examples:
27
27
  - "Pi should know our deploy process" → **Skill** (workflow instructions)
28
28
  - "Pi should confirm before `rm -rf`" → **Extension** (event interception)
29
29
  - "Pi should use Brave Search" → **Skill** (instructions + CLI scripts)
30
30
  - "Pi should have a structured `db_query` tool" → **Extension** (registerTool)
31
+
32
+ ## Minimal working examples
33
+
34
+ **Skill** — place in `.pi/skills/my-skill/SKILL.md`:
35
+ ```markdown
36
+ ---
37
+ name: my-skill
38
+ description: Does X when the user asks to Y.
39
+ ---
40
+ # My Skill
41
+ Step 1: ...
42
+ Step 2: ...
43
+ ```
44
+
45
+ **Extension** — create `manifest.json` + `src/index.ts`:
46
+ ```json
47
+ { "name": "my-extension", "version": "0.1.0", "entry": "src/index.ts" }
48
+ ```
49
+ ```typescript
50
+ import { registerTool } from "@anthropic/pi-sdk";
51
+ registerTool("my_tool", { description: "..." }, async (input) => { /* ... */ });
52
+ ```
53
+
54
+ ## Quick-start steps
55
+
56
+ 1. **Pick the artifact type** from the table above.
57
+ 2. **Scaffold the files** — create the key files using the minimal examples above.
58
+ 3. **Validate locally**:
59
+ - Skills: place `SKILL.md` in `.pi/skills/<name>/` and invoke the skill — if it doesn't trigger, check that `name` and `description` in frontmatter are set correctly.
60
+ - Extensions: run `pi ext install .` — if it fails with "missing entry", verify the `entry` path in `manifest.json` points to an existing file.
61
+ 4. **Package and share** — follow `docs/packages.md` to bundle and publish.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmustier/pi-files-widget",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "In-terminal file browser and viewer for Pi.",
5
5
  "license": "MIT",
6
6
  "author": "Thomas Mustier",
@@ -15,8 +15,8 @@
15
15
  "bugs": "https://github.com/tmustier/pi-extensions/issues",
16
16
  "homepage": "https://github.com/tmustier/pi-extensions/tree/main/files-widget",
17
17
  "peerDependencies": {
18
- "@mariozechner/pi-coding-agent": "^0.50.0",
19
- "@mariozechner/pi-tui": "^0.50.0"
18
+ "@mariozechner/pi-coding-agent": "*",
19
+ "@mariozechner/pi-tui": "*"
20
20
  },
21
21
  "scripts": {
22
22
  "postinstall": "node -e \"console.log('pi-files-widget: required deps: bat, delta, glow. Install with: brew install bat git-delta glow')\""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-extensions",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "keywords": [
@@ -15,15 +15,11 @@
15
15
  "./arcade/tetris.ts",
16
16
  "./arcade/mario-not/mario-not.ts",
17
17
  "./code-actions/index.ts",
18
- "./control/control.ts",
19
18
  "./files-widget/index.ts",
20
19
  "./raw-paste/index.ts",
21
20
  "./ralph-wiggum/index.ts",
22
- "./review/review.ts",
23
- "./relaunch/index.ts",
24
21
  "./tab-status/tab-status.ts",
25
- "./usage-extension/index.ts",
26
- "./ready-status/ready-status.ts"
22
+ "./usage-extension/index.ts"
27
23
  ],
28
24
  "skills": [
29
25
  "./extending-pi/SKILL.md",
@@ -602,6 +602,11 @@ Examples:
602
602
  name: "ralph_start",
603
603
  label: "Start Ralph Loop",
604
604
  description: "Start a long-running development loop. Use for complex multi-iteration tasks.",
605
+ promptSnippet: "Start a persistent multi-iteration development loop with pacing and reflection controls.",
606
+ promptGuidelines: [
607
+ "Use this tool when the user explicitly wants an iterative loop, autonomous repeated passes, or paced multi-step execution.",
608
+ "After starting a loop, continue each finished iteration with ralph_done unless the completion marker has already been emitted.",
609
+ ],
605
610
  parameters: Type.Object({
606
611
  name: Type.String({ description: "Loop name (e.g., 'refactor-auth')" }),
607
612
  taskContent: Type.String({ description: "Task in markdown with goals and checklist" }),
@@ -653,6 +658,11 @@ Examples:
653
658
  name: "ralph_done",
654
659
  label: "Ralph Iteration Done",
655
660
  description: "Signal that you've completed this iteration of the Ralph loop. Call this after making progress to get the next iteration prompt. Do NOT call this if you've output the completion marker.",
661
+ promptSnippet: "Advance an active Ralph loop after completing the current iteration.",
662
+ promptGuidelines: [
663
+ "Call this after making real iteration progress so Ralph can queue the next prompt.",
664
+ "Do not call this if there is no active loop, if pending messages are already queued, or if the completion marker has already been emitted.",
665
+ ],
656
666
  parameters: Type.Object({}),
657
667
  async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
658
668
  if (!currentLoop) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmustier/pi-ralph-wiggum",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Long-running agent loops for iterative development in Pi.",
5
5
  "license": "MIT",
6
6
  "author": "Thomas Mustier",
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.4 - 2026-04-09
4
+ - Scan session files recursively so nested subagent runs are included in `/usage`
5
+ - Add deduped vs raw counting modes to compare copied branch history against raw file totals
6
+
3
7
  ## 0.1.3 - 2026-02-03
4
8
  - Add preview image metadata for the extension listing.
5
9
 
@@ -7,7 +7,7 @@ A Pi extension that displays aggregated usage statistics across all sessions.
7
7
  ## Compatibility
8
8
 
9
9
  - **Pi version:** 0.42.4+
10
- - **Last updated:** 2026-01-13
10
+ - **Last updated:** 2026-04-09
11
11
 
12
12
  ## Installation
13
13
 
@@ -65,6 +65,15 @@ In Pi, run:
65
65
 
66
66
  Use `Tab` or `←`/`→` to switch between periods.
67
67
 
68
+ ### Count Modes
69
+
70
+ | Mode | Definition |
71
+ |------|------------|
72
+ | **Deduped** | Default. Deduplicates copied assistant history across branched session files |
73
+ | **Raw** | Counts every assistant message found in every session file |
74
+
75
+ Both modes scan nested session files recursively, so subagent runs are included.
76
+
68
77
  ### Timezone
69
78
 
70
79
  Time periods are calculated in the local timezone where Pi runs. If you want to override it, set the `TZ` environment variable (IANA timezone, e.g. `TZ=UTC` or `TZ=America/New_York`) before launching Pi.
@@ -87,6 +96,9 @@ Time periods are calculated in the local timezone where Pi runs. If you want to
87
96
  | Key | Action |
88
97
  |-----|--------|
89
98
  | `Tab` / `←` `→` | Switch time period |
99
+ | `m` | Cycle count mode |
100
+ | `d` | Switch to deduped mode |
101
+ | `r` | Switch to raw mode |
90
102
  | `↑` `↓` | Select provider |
91
103
  | `Enter` / `Space` | Expand/collapse provider to show models |
92
104
  | `q` / `Esc` | Close |
@@ -111,7 +123,11 @@ The "Cache" column combines both read and write tokens.
111
123
 
112
124
  ## Data Source
113
125
 
114
- Statistics are parsed from session files in `~/.pi/agent/sessions/`. Each session is a JSONL file containing message entries with usage data. Assistant messages duplicated across branched session files are deduplicated by timestamp + total tokens (matching ccusage).
126
+ Statistics are parsed recursively from session files in `~/.pi/agent/sessions/`, including nested subagent runs such as `run-0/` directories. Each session is a JSONL file containing message entries with usage data.
127
+
128
+ In **Deduped** mode, assistant messages duplicated across branched session files are deduplicated by timestamp + total tokens (matching the extension's previous behavior and keeping totals comparable with earlier releases).
129
+
130
+ In **Raw** mode, every assistant message found in every session file is counted.
115
131
 
116
132
  Respects the `PI_CODING_AGENT_DIR` environment variable if set.
117
133