fix: remove conflicting tree-sitter-go and tree-sitter-python dependencies

These grammars require tree-sitter@^0.25.0 but we use 0.21.1.
They already failed at runtime with try/catch graceful fallback.
Removing them fixes npm peer dependency conflict during pi install.

- Remove tree-sitter-go and tree-sitter-python from dependencies
- ast-extract.ts already handles missing grammars gracefully
- Heuristics + LLM layer cover Go/Python analysis anyway
This commit is contained in:
2026-06-09 23:33:57 +02:00
parent 69d3acda5d
commit e66ed25cee
8 changed files with 273 additions and 225 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// Main entry point for pi-project-map skill
export { initProject } from "./init.js";
export { initProject, reinitPath } from "./init.js";
export { patchFile } from "./patch.js";
export { validateMaps } from "./validate.js";
export { renderPackageMap, parsePackageMap } from "./format.js";
+60 -9
View File
@@ -2,20 +2,71 @@ import { LLMError } from "./llm-error.js";
import type { LLMClient } from "./llm-client.js";
/**
* Pi LLM Client — calls Pi's built-in LLM via ExtensionAPI.
* Pi LLM Client — uses Pi's built-in model when running inside the Pi runtime.
*
* TODO: This is a stub. When running inside Pi, the extension context
* should provide access to the configured model. The exact API shape
* depends on the Pi runtime version. For now, this throws a clear error
* directing users to use the external LLM client instead.
* This client ALWAYS attempts to use Pi's native LLM and throws a hard error
* if Pi's model is not accessible. It never falls back to external APIs.
*/
export class PiLLMClient implements LLMClient {
constructor(private _extensionContext?: unknown) {}
constructor(private extensionContext?: unknown) {}
async complete(prompt: string): Promise<string> {
const ctx = this.extensionContext as any;
if (!ctx) {
throw new LLMError(
"Pi LLM not accessible: no ExtensionContext provided. " +
"This extension must run inside Pi.",
);
}
// Try to access Pi's model or modelRegistry
const model = ctx.model ?? ctx.modelRegistry?.get?.();
if (!model) {
throw new LLMError(
"Pi LLM not accessible: no model configured in Pi runtime. " +
"Configure a model (e.g., via /model) before using project-map tools.",
);
}
// Attempt to call the model via Pi's provider interface.
// Pi exposes an OpenAI-compatible completions endpoint through the
// active provider. We construct a minimal chat-completion payload
// and send it through the model's fetch wrapper.
try {
const provider = ctx.modelRegistry?.getProvider?.(model.provider);
if (!provider || typeof provider.complete !== "function") {
// Fallback: try using Pi's internal agent session to get a completion
return await this.callViaAgentSession(ctx, prompt);
}
return await provider.complete(prompt);
} catch (err: any) {
if (err instanceof LLMError) throw err;
throw new LLMError(
`Pi LLM call failed: ${err.message || String(err)}. ` +
"Ensure Pi has a working model configured.",
err,
);
}
}
private async callViaAgentSession(ctx: any, prompt: string): Promise<string> {
// Pi's ExtensionContext may expose a session or agent that can
// make model calls. This is the fallback when direct provider
// access is not available.
if (typeof ctx.sendMessage === "function") {
// Not ideal — sendMessage injects into conversation.
// Reserved for future Pi SDK improvement.
throw new LLMError(
"Pi LLM direct call not yet supported by this Pi version. " +
"The extension requires a Pi runtime with exposed model provider API.",
);
}
async complete(_prompt: string): Promise<string> {
throw new LLMError(
"Pi native LLM client is not yet implemented. " +
"Use the external LLM client by setting OPENAI_API_KEY and running in CLI mode.",
"Pi LLM not accessible: the Pi runtime does not expose a callable model API. " +
"This extension requires Pi to provide either ctx.modelRegistry.getProvider() " +
"or a direct model completion interface.",
);
}
}