@gtrabanco/pi-web-github-pr-status 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The project follows [strict semantic versioning](./RELEASE-POLICY.md); the kind of the next release is registered in `package.json` (`nextRelease`) before `bun run publish` is executed.
4
+
5
+ ## 0.1.0 β€” initial development version
6
+
7
+ - GitHub PR workspace label: PR number link, CI ball (green/orange/red/none), dirty-worktree marker, push/pull arrows.
8
+ - Pull Request panel: PR card, CI check list, worktree summary, guarded one-click merge and confirmed close.
9
+ - Per-workspace settings in `.pi-web/github-pr.json` with an in-panel editor.
10
+ - Local-first release tooling (`bun run publish`), TypeScript 7, bun as package manager.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 gtrabanco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # GitHub PR Status β€” PI WEB plugin
2
+
3
+ PI WEB plugin that brings Claude Code–style pull request awareness to your workspaces:
4
+
5
+ - **PR number + link** for the workspace branch when an open PR exists.
6
+ - **CI ball**: 🟒 passing Β· 🟠 running Β· πŸ”΄ failing Β· **no ball** when the PR has no CI.
7
+ - **Worktree state at a glance**: ✎ uncommitted changes, ↑ unpushed commits, ↓ behind upstream.
8
+ - **Pull Request panel** with check details and **one-click merge / close without opening GitHub**.
9
+ - **Merge guardrails** (all configurable):
10
+ - refuses to merge when the worktree is dirty (uncommitted or untracked files);
11
+ - refuses to merge when local commits were not pushed (or the branch has no upstream);
12
+ - asks for explicit confirmation before merging with CI running (orange) or failing (red) β€” never when CI is green or absent.
13
+
14
+ Works on local and federated remote machines: all commands run through the workspace's own terminal helpers with the machine's `git` and `gh` CLI.
15
+
16
+ ## Requirements
17
+
18
+ - PI WEB (browser plugin API v2 β€” no session-daemon restart needed, browser-only plugin).
19
+ - `git` on the workspace machine (already required by PI WEB's Git panel).
20
+ - [`gh` CLI](https://cli.github.com) **installed and authenticated** (`gh auth login`) for PR/CI data, merge and close. Without it the plugin degrades gracefully: you still get worktree dirty/push state, and the panel explains what is missing.
21
+ - A POSIX shell (`sh`) on the workspace machine (Linux/macOS; WSL works, native Windows shells are not supported yet).
22
+
23
+ ## Install
24
+
25
+ ### From npm (recommended)
26
+
27
+ In PI WEB open **Settings β†’ Pi packages** and install:
28
+
29
+ ```text
30
+ npm:@gtrabanco/pi-web-github-pr-status
31
+ ```
32
+
33
+ Then reload the PI WEB tab. Manage enablement under **Settings β†’ PI WEB plugins** (`github-pr-status`, enabled by default).
34
+
35
+ ### Local development
36
+
37
+ ```bash
38
+ git clone https://github.com/gtrabanco/pi-web-github-pr-status.git
39
+ cd pi-web-github-pr-status
40
+ bun install
41
+ bun run build
42
+ mkdir -p ~/.pi-web/plugins
43
+ ln -s "$(pwd)" ~/.pi-web/plugins/github-pr-status
44
+ ```
45
+
46
+ Reload the PI WEB tab after editing (hard reload if the module is cached). Check discovery at `http://127.0.0.1:8504/pi-web-plugins/manifest.json`.
47
+
48
+ ## What you get
49
+
50
+ | Surface | Content |
51
+ | --- | --- |
52
+ | Workspace list / panel header / status bar | `#123` (link to the PR) Β· CI ball (link) Β· `✎n` dirty marker Β· `↑n` / `↓n` push state |
53
+ | **Pull Request** workspace tab | PR card (title, state, author, branch, conflicts, review), CI check list, worktree summary, **Merge** / **Close PR** buttons, inline settings editor |
54
+ | Action palette | Open Pull Request panel Β· Refresh GitHub PR status Β· Open pull request on GitHub |
55
+
56
+ ### Merge guardrails
57
+
58
+ Pressing **Merge** (default `gh pr merge <n> --merge`, non-interactive) is refused when:
59
+
60
+ - one-click merge is disabled in settings;
61
+ - there is no open PR, it is a draft, or GitHub reports merge conflicts;
62
+ - the worktree has uncommitted changes (staged, unstaged or untracked) β€” unless *Require clean worktree* is off;
63
+ - local commits were not pushed, or the branch has no upstream.
64
+
65
+ Pressing **Merge** asks for confirmation when CI is running or failing (only if a CI exists and *Require CI confirmation* is on), when the local branch is behind its upstream, or when GitHub reports a `BLOCKED`/`UNSTABLE` merge state. Green CI or no CI merges immediately.
66
+
67
+ Closing a PR always asks for confirmation. Both actions run in a visible workspace terminal (`gh pr merge` / `gh pr close`), and the panel surfaces the outcome with a link to the terminal output.
68
+
69
+ ## Configuration
70
+
71
+ Settings are stored **per workspace** in `.pi-web/github-pr.json` and can be edited from the panel (βš™ Settings β†’ Save) or by hand:
72
+
73
+ ```json
74
+ {
75
+ "showCI": true,
76
+ "refreshSeconds": 90,
77
+ "merge": {
78
+ "enabled": true,
79
+ "method": "merge",
80
+ "requireCleanWorktree": true,
81
+ "requireCI": true,
82
+ "deleteBranch": false
83
+ }
84
+ }
85
+ ```
86
+
87
+ | Setting | Default | Meaning |
88
+ | --- | --- | --- |
89
+ | `showCI` | `true` | Show the CI ball in labels and the CI section in the panel. |
90
+ | `refreshSeconds` | `90` | Automatic probe interval while the browser tab is visible (only for the selected workspace). `0` = manual refresh only. Max `3600`. |
91
+ | `merge.enabled` | `true` | Master switch for one-click merge from the panel. |
92
+ | `merge.method` | `"merge"` | `merge`, `squash` or `rebase` (passed to `gh pr merge`). |
93
+ | `merge.requireCleanWorktree` | `true` | Block merge when the worktree has uncommitted/untracked changes. |
94
+ | `merge.requireCI` | `true` | Require confirmation when CI is running (orange) or failing (red). Only applies when a CI actually exists. |
95
+ | `merge.deleteBranch` | `false` | Pass `--delete-branch` to `gh pr merge`. Off by default because it deletes the checked-out local branch. |
96
+
97
+ Missing or invalid values fall back to defaults with a warning in the panel. Tip: add `.pi-web/` to your `.gitignore` if you do not want settings or probe artifacts tracked β€” the plugin already excludes its own scratch directory from dirty detection.
98
+
99
+ ## How it works (no magic)
100
+
101
+ The plugin is **browser-only**. To get machine facts it writes a small POSIX `probe.sh` into `.pi-web/github-pr/`, runs it through the workspace terminal helper, and reads back per-fact files (`branch.txt`, `staged.txt`, `pr.json`, …) written by the script. PR/CI data comes from `gh pr view --json …` using the machine's existing gh auth; worktree facts come from `git`. Nothing leaves the machine except GitHub API calls made by `gh` itself.
102
+
103
+ Refresh happens when you open the workspace panel, on the configured interval (visible tab only), on palette refresh, and after merge/close actions. Labels for non-selected workspaces show the last data read from disk.
104
+
105
+ ## Development
106
+
107
+ ```bash
108
+ bun install # deps (bun)
109
+ bun run typecheck # tsc (TypeScript 7 native)
110
+ bun test # unit + integration tests (probe script runs for real)
111
+ bun run build # bundle -> dist/index.js
112
+ bun run check # all of the above + package contract validation
113
+ ```
114
+
115
+ Local CI is intentionally local: there is no hosted CI for this package; `bun run check` is the full gate and `bun run publish` runs it before every release.
116
+
117
+ ### Releases (strict semver)
118
+
119
+ 1. Register what the next release will be:
120
+
121
+ ```bash
122
+ bun run release:patch # or release:minor / release:major
123
+ ```
124
+
125
+ 2. When it is time to ship, from a clean `main`:
126
+
127
+ ```bash
128
+ bun run publish
129
+ ```
130
+
131
+ The script runs the full check suite, bumps the version according to the registered `nextRelease`, resets the marker to `patch`, updates `CHANGELOG.md`, commits `chore(release): vX.Y.Z`, tags `vX.Y.Z`, publishes with `bun publish`, and pushes the tag.
132
+
133
+ The first release publishes the current version as-is (nothing to bump yet). See [RELEASE-POLICY.md](./RELEASE-POLICY.md) for the full policy.
134
+
135
+ ## Discoverability / listing
136
+
137
+ There is no plugin marketplace or community listing for PI WEB yet (checked: neither pi-web.dev nor the pi-web repository expose one). Discoverability today:
138
+
139
+ - npm keywords on this package: `pi-web`, `pi-web-plugin`, `pi-coding-agent`, `github`, `pull-request`, `ci`, `merge`;
140
+ - GitHub repository topics on this repo (`pi-web`, `pi-web-plugin`, `github`, `pull-requests`, `ci`);
141
+ - the pi-web author accepts feedback/plugin proposals via GitHub issues β€” worth opening one to request a community listing.
142
+
143
+ ## License
144
+
145
+ MIT β€” see [LICENSE](./LICENSE).
@@ -0,0 +1,43 @@
1
+ # Release policy β€” strict semver
2
+
3
+ This package follows [Semantic Versioning](https://semver.org/) strictly once it reaches `1.0.0`. While in `0.x`, the public API (plugin id, settings schema, label/panel behavior) is still allowed to evolve; breaking changes during `0.x` bump the **minor** so users can pin safely.
4
+
5
+ ## Version meaning
6
+
7
+ | Bump | When |
8
+ | --- | --- |
9
+ | **MAJOR** | Breaking change: removal or semantic change of existing settings keys, label/panel contract changes users depend on, minimum PI WEB plugin API version raised, plugin id changed. |
10
+ | **MINOR** | Backwards-compatible features: new settings, new labels/actions, new panel sections, new supported gh fields. Also: breaking changes while the package is still `0.x`. |
11
+ | **PATCH** | Backwards-compatible fixes: bug fixes, shell script robustness, docs, dependency maintenance, packaging. |
12
+
13
+ Pre-release and build metadata (`-beta.1`, `+build`) are **not used** in this project.
14
+
15
+ ## Registering the next release
16
+
17
+ The kind of the next release is **registered in advance** in `package.json`:
18
+
19
+ ```json
20
+ {
21
+ "nextRelease": "minor"
22
+ }
23
+ ```
24
+
25
+ Register it with `bun run release:patch`, `bun run release:minor` or `bun run release:major`. `nextRelease` is always one of `patch`, `minor`, `major`; anything else fails the release.
26
+
27
+ ## Publishing
28
+
29
+ ```bash
30
+ bun run publish
31
+ ```
32
+
33
+ From a **clean `main`** worktree, the script:
34
+
35
+ 1. verifies the worktree is clean and the branch is `main`;
36
+ 2. looks up the current version on npm β€” the first release publishes the current version as-is;
37
+ 3. otherwise bumps the version by the registered `nextRelease` and resets the marker to `patch`;
38
+ 4. runs the full local gate (`bun run check`: typecheck with TypeScript 7, tests, build, package-contract validation);
39
+ 5. updates `CHANGELOG.md`, commits `chore(release): vX.Y.Z` and tags `vX.Y.Z`;
40
+ 6. publishes with `bun publish` (access public via `publishConfig`);
41
+ 7. pushes the release tag (best effort).
42
+
43
+ There is no hosted CI: everything that can be checked locally is checked locally by `bun run check`, and deployment to npm is manual from the maintainer's machine.