Skip to content

Commit 76e9e41

Browse files
authored
Merge branch 'badlogic:main' into main
2 parents 4f54224 + 8a8e2a8 commit 76e9e41

File tree

98 files changed

+3394
-1165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+3394
-1165
lines changed

.github/oss-weekend.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

.pi/extensions/diff.ts

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,64 @@ export default function (pi: ExtensionAPI) {
6666
return;
6767
}
6868

69+
const WINDOWS_UNSAFE_CMD_CHARS_RE = /[&|<>^%\r\n]/;
70+
const quoteCmdArg = (value: string) => `"${value.replace(/"/g, '""')}"`;
71+
72+
const openWithCode = async (file: string) => {
73+
if (process.platform === "win32") {
74+
if (WINDOWS_UNSAFE_CMD_CHARS_RE.test(file)) {
75+
ctx.ui.notify(
76+
`Refusing to open ${file}: path contains Windows cmd metacharacters (& | < > ^ % or newline).`,
77+
"error",
78+
);
79+
return null;
80+
}
81+
const commandLine = `code -g ${quoteCmdArg(file)}`;
82+
return pi.exec("cmd", ["/d", "/s", "/c", commandLine], { cwd: ctx.cwd });
83+
}
84+
return pi.exec("code", ["-g", file], { cwd: ctx.cwd });
85+
};
86+
6987
const openSelected = async (fileInfo: FileInfo): Promise<void> => {
7088
try {
7189
// Open in VS Code diff view.
7290
// For untracked files, git difftool won't work, so fall back to just opening the file.
7391
if (fileInfo.status === "?") {
74-
await pi.exec("code", ["-g", fileInfo.file], { cwd: ctx.cwd });
92+
const openResult = await openWithCode(fileInfo.file);
93+
if (!openResult) return;
94+
if (openResult.code !== 0) {
95+
const openStderr = openResult.stderr.trim();
96+
ctx.ui.notify(
97+
`Failed to open ${fileInfo.file} (exit ${openResult.code})${openStderr ? `: ${openStderr}` : ""}`,
98+
"error",
99+
);
100+
}
75101
return;
76102
}
77103

78104
const diffResult = await pi.exec("git", ["difftool", "-y", "--tool=vscode", fileInfo.file], {
79105
cwd: ctx.cwd,
80106
});
81107
if (diffResult.code !== 0) {
82-
await pi.exec("code", ["-g", fileInfo.file], { cwd: ctx.cwd });
108+
const diffStderr = diffResult.stderr.trim();
109+
ctx.ui.notify(
110+
`Failed to show diff with vscode for ${fileInfo.file} (exit ${diffResult.code})${diffStderr ? `: ${diffStderr}` : ""}`,
111+
"error",
112+
);
113+
ctx.ui.notify(
114+
"Troubleshooting: check git difftool config (e.g. `git config --get difftool.vscode.cmd`).",
115+
"info",
116+
);
117+
118+
const openResult = await openWithCode(fileInfo.file);
119+
if (!openResult) return;
120+
if (openResult.code !== 0) {
121+
const openStderr = openResult.stderr.trim();
122+
ctx.ui.notify(
123+
`Failed to open ${fileInfo.file} (exit ${openResult.code})${openStderr ? `: ${openStderr}` : ""}`,
124+
"error",
125+
);
126+
}
83127
}
84128
} catch (error) {
85129
const message = error instanceof Error ? error.message : String(error);

.pi/extensions/files.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,35 @@ export default function (pi: ExtensionAPI) {
8989
// Sort by most recent first
9090
const files = Array.from(fileMap.values()).sort((a, b) => b.lastTimestamp - a.lastTimestamp);
9191

92+
const WINDOWS_UNSAFE_CMD_CHARS_RE = /[&|<>^%\r\n]/;
93+
const quoteCmdArg = (value: string) => `"${value.replace(/"/g, '""')}"`;
94+
95+
const openWithCode = async (path: string) => {
96+
if (process.platform === "win32") {
97+
if (WINDOWS_UNSAFE_CMD_CHARS_RE.test(path)) {
98+
ctx.ui.notify(
99+
`Refusing to open ${path}: path contains Windows cmd metacharacters (& | < > ^ % or newline).`,
100+
"error",
101+
);
102+
return null;
103+
}
104+
const commandLine = `code -g ${quoteCmdArg(path)}`;
105+
return pi.exec("cmd", ["/d", "/s", "/c", commandLine], { cwd: ctx.cwd });
106+
}
107+
return pi.exec("code", ["-g", path], { cwd: ctx.cwd });
108+
};
109+
92110
const openSelected = async (file: FileEntry): Promise<void> => {
93111
try {
94-
await pi.exec("code", ["-g", file.path], { cwd: ctx.cwd });
112+
const openResult = await openWithCode(file.path);
113+
if (!openResult) return;
114+
if (openResult.code !== 0) {
115+
const openStderr = openResult.stderr.trim();
116+
ctx.ui.notify(
117+
`Failed to open ${file.path} (exit ${openResult.code})${openStderr ? `: ${openStderr}` : ""}`,
118+
"error",
119+
);
120+
}
95121
} catch (error) {
96122
const message = error instanceof Error ? error.message : String(error);
97123
ctx.ui.notify(`Failed to open ${file.path}: ${message}`, "error");

AGENTS.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,16 @@ Adding a new provider requires changes across multiple files:
136136
### 2. Provider Implementation (`packages/ai/src/providers/`)
137137
Create provider file exporting:
138138
- `stream<Provider>()` function returning `AssistantMessageEventStream`
139+
- `streamSimple<Provider>()` for `SimpleStreamOptions` mapping
140+
- Provider-specific options interface
139141
- Message/tool conversion functions
140142
- Response parsing emitting standardized events (`text`, `tool_call`, `thinking`, `usage`, `stop`)
141143

142-
### 3. Stream Integration (`packages/ai/src/stream.ts`)
143-
- Import provider's stream function and options type
144-
- Add credential detection in `getEnvApiKey()`
145-
- Add case in `mapOptionsForApi()` for `SimpleStreamOptions` mapping
146-
- Add provider to `streamFunctions` map
144+
### 3. Provider Exports and Lazy Registration
145+
- Add a package subpath export in `packages/ai/package.json` pointing at `./dist/providers/<provider>.js`
146+
- Add `export type` re-exports in `packages/ai/src/index.ts` for provider option types that should remain available from the root entry
147+
- Register the provider in `packages/ai/src/providers/register-builtins.ts` via lazy loader wrappers, do not statically import provider implementation modules there
148+
- Add credential detection in `packages/ai/src/env-api-keys.ts`
147149

148150
### 4. Model Generation (`packages/ai/scripts/generate-models.ts`)
149151
- Add logic to fetch/parse models from provider source

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
<!-- OSS_WEEKEND_START -->
2-
# 🏖️ OSS Weekend
3-
4-
**Issue tracker reopens Monday, March 16, 2026.**
5-
6-
OSS weekend runs Saturday, March 14, 2026 through Monday, March 16, 2026. New issues are auto-closed during this time. For support, join [Discord](https://discord.com/invite/3cU7Bz4UPx).
7-
<!-- OSS_WEEKEND_END -->
8-
9-
---
10-
111
<p align="center">
122
<a href="https://shittycodingagent.ai">
133
<img src="https://shittycodingagent.ai/logo.svg" alt="pi logo" width="128">

0 commit comments

Comments
 (0)