Skip to content

Commit 780f8ad

Browse files
authored
chore(pi): rename pi package scope (#52)
Switch pi SDK imports and package metadata to the new @earendil-works scope. Keep compatibility testing on the last five pi release lines by aliasing older @mariozechner packages into the new names where needed.
1 parent 06b98d4 commit 780f8ad

8 files changed

Lines changed: 203 additions & 163 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ updates:
1111
groups:
1212
pi-sdk:
1313
patterns:
14-
- "@mariozechner/pi-coding-agent"
15-
- "@mariozechner/pi-ai"
14+
- "@earendil-works/pi-coding-agent"
15+
- "@earendil-works/pi-ai"
1616

1717
- package-ecosystem: github-actions
1818
directory: /

.github/scripts/resolve-pi-versions.mjs

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@ import { tmpdir } from "node:os";
55
import { join } from "node:path";
66
import { execFileSync } from "node:child_process";
77

8-
const packages = ["@mariozechner/pi-coding-agent", "@mariozechner/pi-ai"];
9-
const count = Number(process.env.PI_VERSION_COUNT ?? "6");
8+
const packageFamilies = [
9+
{
10+
name: "pi-coding-agent",
11+
alias: "@earendil-works/pi-coding-agent",
12+
sources: ["@earendil-works/pi-coding-agent", "@mariozechner/pi-coding-agent"],
13+
},
14+
{
15+
name: "pi-ai",
16+
alias: "@earendil-works/pi-ai",
17+
sources: ["@earendil-works/pi-ai", "@mariozechner/pi-ai"],
18+
},
19+
];
20+
const count = Number(process.env.PI_VERSION_COUNT ?? "5");
1021
const stableVersionPattern = /^\d+\.\d+\.\d+$/;
1122

1223
if (!Number.isInteger(count) || count <= 0) {
@@ -43,9 +54,20 @@ function compareVersions(a, b) {
4354
return 0;
4455
}
4556

57+
const familyVersions = packageFamilies.map((family) => {
58+
const versionsBySource = family.sources.map((packageName) => ({
59+
packageName,
60+
versions: npmViewVersions(packageName),
61+
}));
62+
const versions = [...new Set(versionsBySource.flatMap(({ versions }) => versions))].sort(
63+
compareVersions,
64+
);
65+
return { ...family, versions, versionsBySource };
66+
});
67+
4668
const sharedVersions =
47-
packages
48-
.map((packageName) => npmViewVersions(packageName))
69+
familyVersions
70+
.map(({ versions }) => versions)
4971
.reduce((commonVersions, packageVersions) => {
5072
if (commonVersions === null) {
5173
return packageVersions;
@@ -75,12 +97,38 @@ const selectedVersions = releaseLines.map(({ version }) => version).slice(-count
7597

7698
if (selectedVersions.length < count) {
7799
throw new Error(
78-
`Expected at least ${count} shared stable pi release lines across ${packages.join(", ")}, found ${selectedVersions.length}`,
100+
`Expected at least ${count} shared stable pi release lines across ${packageFamilies
101+
.map(({ sources }) => sources.join("/"))
102+
.join(", ")}, found ${selectedVersions.length}`,
79103
);
80104
}
81105

106+
function installSpecFor(family, version) {
107+
const source = family.versionsBySource.find(({ versions }) =>
108+
versions.includes(version),
109+
)?.packageName;
110+
if (!source) {
111+
throw new Error(`No source package found for ${family.name}@${version}`);
112+
}
113+
return source === family.alias
114+
? `${family.alias}@${version}`
115+
: `${family.alias}@npm:${source}@${version}`;
116+
}
117+
118+
const selectedTargets = selectedVersions.map((version) => ({
119+
version,
120+
piAiSpec: installSpecFor(
121+
familyVersions.find(({ name }) => name === "pi-ai"),
122+
version,
123+
),
124+
piCodingAgentSpec: installSpecFor(
125+
familyVersions.find(({ name }) => name === "pi-coding-agent"),
126+
version,
127+
),
128+
}));
129+
82130
const outputs = {
83-
versions: JSON.stringify(selectedVersions),
131+
versions: JSON.stringify(selectedTargets),
84132
latest: selectedVersions[selectedVersions.length - 1],
85133
oldest: selectedVersions[0],
86134
};

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Record installed pi version
3838
run: |
39-
version=$(node -p "require('./node_modules/@mariozechner/pi-coding-agent/package.json').version")
39+
version=$(node -p "require('./node_modules/@earendil-works/pi-coding-agent/package.json').version")
4040
echo "PI_COMPAT_VERSION=${version}" >> "$GITHUB_ENV"
4141
4242
- name: Check formatting, lint, and types
@@ -79,11 +79,11 @@ jobs:
7979
- name: Resolve supported pi versions
8080
id: pi_versions
8181
env:
82-
PI_VERSION_COUNT: 6
82+
PI_VERSION_COUNT: 5
8383
run: node ./.github/scripts/resolve-pi-versions.mjs
8484

8585
integration-compat:
86-
name: Integration compatibility (Node ${{ matrix.node-version }}, pi ${{ matrix.pi-version }})
86+
name: Integration compatibility (Node ${{ matrix.node-version }}, pi ${{ matrix.pi-target.version }})
8787
needs: resolve-pi-compat
8888
runs-on: ubuntu-latest
8989
timeout-minutes: 20
@@ -93,7 +93,7 @@ jobs:
9393
node-version:
9494
- 22
9595
- 24
96-
pi-version: ${{ fromJson(needs.resolve-pi-compat.outputs.pi-versions) }}
96+
pi-target: ${{ fromJson(needs.resolve-pi-compat.outputs.pi-versions) }}
9797

9898
steps:
9999
- name: Check out repository
@@ -118,11 +118,11 @@ jobs:
118118
run: pnpm install --frozen-lockfile
119119

120120
- name: Install pi compatibility target
121-
run: pnpm add -D @mariozechner/pi-ai@${{ matrix.pi-version }} @mariozechner/pi-coding-agent@${{ matrix.pi-version }} --lockfile=false
121+
run: pnpm add -D ${{ matrix.pi-target.piAiSpec }} ${{ matrix.pi-target.piCodingAgentSpec }} --lockfile=false
122122

123-
- name: Run integration tests against pi ${{ matrix.pi-version }}
123+
- name: Run integration tests against pi ${{ matrix.pi-target.version }}
124124
env:
125-
PI_COMPAT_VERSION: ${{ matrix.pi-version }}
125+
PI_COMPAT_VERSION: ${{ matrix.pi-target.version }}
126126
run: pnpm run test:integration
127127

128128
- name: Summarize compatibility target
@@ -131,6 +131,6 @@ jobs:
131131
echo "## Integration compatibility target"
132132
echo
133133
echo "Resolved compatibility window: ${{ needs.resolve-pi-compat.outputs.pi-versions }}"
134-
echo "This job tested: Node ${{ matrix.node-version }}, pi ${{ matrix.pi-version }}"
134+
echo "This job tested: Node ${{ matrix.node-version }}, pi ${{ matrix.pi-target.version }}"
135135
echo
136136
} >> "$GITHUB_STEP_SUMMARY"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![npm version](https://img.shields.io/npm/v/%40braintrust%2Fpi-extension)](https://www.npmjs.com/package/@braintrust/pi-extension)
44

5-
Braintrust extension for [pi](https://github.com/mariozechner/pi-coding-agent).
5+
Braintrust extension for [pi](https://github.com/earendil-works/pi-coding-agent).
66

77
Today this extension automatically traces pi sessions, turns, model calls, and tool executions to Braintrust.
88

@@ -47,7 +47,7 @@ pi -e .
4747

4848
## Compatibility
4949

50-
This package supports the **latest patch release from each of the last six stable pi minor versions**, currently excluding pi versions before `0.65.0`.
50+
This package supports the **latest patch release from each of the last five stable pi minor versions**, currently excluding pi versions before `0.65.0`.
5151

5252
Our GitHub Actions compatibility job automatically resolves and tests that compatibility window, so new pi releases are picked up without manually updating the matrix.
5353

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@
4242
"valibot": "^1.3.1"
4343
},
4444
"devDependencies": {
45-
"@mariozechner/pi-ai": "^0.73.0",
46-
"@mariozechner/pi-coding-agent": "^0.73.0",
45+
"@earendil-works/pi-ai": "^0.74.0",
46+
"@earendil-works/pi-coding-agent": "^0.74.0",
4747
"@types/node": "^25.6.0",
4848
"typescript": "^6.0.2",
4949
"vite-plus": "^0.1.16",
5050
"vitest": "^4.1.4"
5151
},
5252
"peerDependencies": {
53-
"@mariozechner/pi-coding-agent": "*"
53+
"@earendil-works/pi-coding-agent": "*"
5454
},
5555
"devEngines": {
5656
"packageManager": {

0 commit comments

Comments
 (0)