Skip to content

Feat/pi local qwen wrappers - #1079

Merged
shunkakinoki merged 5 commits into
mainfrom
feat/pi-local-qwen-wrappers
Mar 13, 2026
Merged

Feat/pi local qwen wrappers#1079
shunkakinoki merged 5 commits into
mainfrom
feat/pi-local-qwen-wrappers

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Mar 13, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Adds local Qwen 3.5 9B support via LM Studio and new fish commands pixel/pixelh for Pi. Also switches Pi wrappers to the cliproxyapi provider and updates configs and tests.

  • New Features

    • Added lmstudio provider (OpenAI-compatible at 127.0.0.1:1234) with Qwen 3.5 9B.
    • New fish wrappers: pixel (interactive) and pixelh (print mode) to run Pi on the local Qwen model.
  • Refactors

    • Renamed provider key cli-proxy-api to cliproxyapi; set as default and enabled lmstudio/* and *qwen* in settings.
    • Replaced pi-agent with pi and switched models from presets to cliproxyapi/glm-4.7 (templated __GLM__).
    • Updated GLM preset placeholders to @preset/__GLM_NONDOT__.
    • Mapped new wrapper templates in scripts/llm-update.sh.
    • Updated and added fish specs for new models, wrappers, and print mode.

Written for commit d98f8c1. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 13, 2026 19:48
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 13, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Mar 13, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 800147e7-252b-4e9a-82b2-8be03f634f8b

📥 Commits

Reviewing files that changed from the base of the PR and between 713a8e1 and d98f8c1.

📒 Files selected for processing (24)
  • config/opencode/opencode.tpl.jsonc
  • config/pi/models.json
  • config/pi/models.tpl.json
  • config/pi/settings.json
  • config/pi/settings.tpl.json
  • home-manager/programs/fish/default.nix
  • home-manager/programs/fish/functions/_pixe_function.fish
  • home-manager/programs/fish/functions/_pixe_function.tpl.fish
  • home-manager/programs/fish/functions/_pixeh_function.fish
  • home-manager/programs/fish/functions/_pixeh_function.tpl.fish
  • home-manager/programs/fish/functions/_pixel_function.fish
  • home-manager/programs/fish/functions/_pixel_function.tpl.fish
  • home-manager/programs/fish/functions/_pixelh_function.fish
  • home-manager/programs/fish/functions/_pixelh_function.tpl.fish
  • scripts/llm-update.sh
  • spec/fish/_pixe_function.tpl_test.fish
  • spec/fish/_pixe_function_test.fish
  • spec/fish/_pixeh_function.tpl_test.fish
  • spec/fish/_pixeh_function_test.fish
  • spec/fish/_pixel_function.tpl_test.fish
  • spec/fish/_pixel_function_test.fish
  • spec/fish/_pixelh_function.tpl_test.fish
  • spec/fish/_pixelh_function_test.fish
  • spec/llm_update_spec.sh

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for local Qwen 3.5 (9B) model via LM Studio.
    • Introduced new shell abbreviations pixel and pixelh for quick access to local model functionality.
  • Updates

    • Renamed provider configuration for improved clarity.
    • Updated existing commands to utilize the new provider structure and enhanced model routing.

Walkthrough

This pull request renames the "cli-proxy-api" provider to "cliproxyapi", updates GLM-4.7 preset identifiers, adds a new "lmstudio" provider for local Qwen 3.5 models, and introduces new Fish shell functions to access the local Qwen model alongside updates to existing model-related functions and comprehensive test coverage.

Changes

Cohort / File(s) Summary
Provider Configuration
config/opencode/opencode.tpl.jsonc, config/pi/models.json, config/pi/models.tpl.json, config/pi/settings.json, config/pi/settings.tpl.json
Updated provider key from "cli-proxy-api" to "cliproxyapi", added new "lmstudio" provider with Qwen 3.5 9B model, updated GLM-4.7 preset ID from "@preset/glm-4-7" to "@preset/GLM_NONDOT", and updated default provider and enabled models list accordingly.
Fish Functions - Existing Updates
home-manager/programs/fish/functions/_pixe_function.*, home-manager/programs/fish/functions/_pixeh_function.*
Updated function descriptions and invocations to use new pi command with cliproxyapi model instead of pi-agent with openrouter-preset, adjusted argument ordering and print mode flags.
Fish Functions - New Additions
home-manager/programs/fish/functions/_pixel_function.*, home-manager/programs/fish/functions/_pixelh_function.*
Added four new Fish function files (template and concrete implementations) providing access to local Qwen model via lmstudio provider, supporting optional prompt arguments and print mode execution.
Fish Shell Configuration
home-manager/programs/fish/default.nix
Added two new shell abbreviations: pixel and pixelh mapped to corresponding function names, expanding available command shortcuts.
Build System
scripts/llm-update.sh
Added template-to-output mappings for two new pixel function templates to template processing pipeline.
Test Files - Existing Updates
spec/fish/_pixe_function.*_test.fish, spec/fish/_pixeh_function.*_test.fish
Updated test expectations to reference new pi command and cliproxyapi model instead of pi-agent and openrouter-preset, maintained assertion structure.
Test Files - New Additions
spec/fish/_pixel_function*_test.fish, spec/fish/_pixelh_function*_test.fish
Added comprehensive test suites for new functions validating no-argument and with-argument scenarios, model selection, print mode flags, and error handling for empty prompts.
Test Infrastructure
spec/llm_update_spec.sh
Updated template mapping test to include new pixel function template fixture in assertions.

Sequence Diagram

sequenceDiagram
    participant User
    participant ShellFunction as Shell Function<br/>(_pixe / _pixel)
    participant PiTool as Pi Tool
    participant Providers as Providers

    User->>ShellFunction: Invoke command with optional prompt
    ShellFunction->>ShellFunction: Parse arguments
    
    alt Existing Flow (OpenRouter)
        ShellFunction->>PiTool: pi --model 'cliproxyapi/glm-4.7' [prompt]
        PiTool->>Providers: Route to cliproxyapi provider
        Providers-->>PiTool: GLM-4.7 response
    else New Flow (Local Qwen)
        ShellFunction->>PiTool: pi --model 'lmstudio/qwen/qwen3.5-9b' [prompt]
        PiTool->>Providers: Route to lmstudio provider
        Providers-->>PiTool: Qwen response
    end
    
    PiTool-->>ShellFunction: Output
    ShellFunction-->>User: Display result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #1077: Modifies the same llm-update template mappings and Pi/OpenRouter model identifiers with fish function template/config changes.
  • PR #248: Adds lmstudio provider and adjusts AI provider configuration surface alongside existing provider changes.
  • PR #219: Updates the same fish shell abbreviations map in home-manager/programs/fish/default.nix with new abbreviation entries.

Suggested labels

enhancement


🐰 A rabbit hops through configs with glee,
New local Qwen models—so quick to see!
Pixel and pixelh, abbreviations bright,
Templates rendering, tests burning the night,
From cliproxyapi to lmstudio we race,
Building better tools, at a local space! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/pi-local-qwen-wrappers
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shunkakinoki
shunkakinoki merged commit 7241abb into main Mar 13, 2026
25 of 27 checks passed
@shunkakinoki
shunkakinoki deleted the feat/pi-local-qwen-wrappers branch March 13, 2026 19:48
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 13, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Added local wrappers for Qwen, likely for Raspberry Pi integration.

What changed?

File summaries were not provided, so a detailed list of changes by file cannot be given.

Description generated by Mesa. Update settings

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the system's capability by integrating local Qwen models through LM Studio, providing users with more flexible and private AI interaction options. It also refactors existing command-line interfaces for improved consistency and maintainability, ensuring a smoother user experience with both local and remote models.

Highlights

  • Local Qwen Model Support: Added configuration for Qwen 3.5 9B model via LM Studio, enabling local execution of this model.
  • New Fish Shell Functions: Introduced pixel and pixelh Fish shell functions for easy interaction with the local Qwen model, allowing free-form prompts and headless operation.
  • Refactoring of Existing Fish Functions: Updated _pixe_function and _pixeh_function to use the pi command directly instead of pi-agent, and standardized model references to cliproxyapi/glm-4.7.
  • Configuration Standardization: Renamed the cli-proxy-api provider to cliproxyapi across relevant configuration files for consistency.
Changelog
  • config/opencode/opencode.tpl.jsonc
    • Updated the GLM-4.7 model ID to use a templated placeholder.
  • config/pi/models.json
    • Renamed the 'cli-proxy-api' provider to 'cliproxyapi'.
    • Added a new 'lmstudio' provider configuration, including the Qwen 3.5 9B model.
  • config/pi/models.tpl.json
    • Renamed the 'cli-proxy-api' provider to 'cliproxyapi'.
    • Updated the GLM-4.7 model ID to use a templated placeholder.
    • Added a new 'lmstudio' provider configuration with a templated Qwen 3.5 9B model.
  • config/pi/settings.json
    • Updated the default provider from 'cli-proxy-api' to 'cliproxyapi'.
    • Added 'lmstudio/*' and 'qwen' to the list of enabled models.
  • config/pi/settings.tpl.json
    • Updated the default provider from 'cli-proxy-api' to 'cliproxyapi'.
    • Added 'lmstudio/*' and 'qwen' to the list of enabled models.
  • home-manager/programs/fish/default.nix
    • Added 'pixel' and 'pixelh' to the list of Fish shell aliases.
    • Added '_pixel_function' and '_pixelh_function' to the list of Fish shell completions.
  • home-manager/programs/fish/functions/_pixe_function.fish
    • Updated the function description.
    • Replaced 'pi-agent' command with 'pi'.
    • Changed the model reference to 'cliproxyapi/glm-4.7'.
  • home-manager/programs/fish/functions/_pixe_function.tpl.fish
    • Updated the function description.
    • Replaced 'pi-agent' command with 'pi'.
    • Changed the model reference to 'cliproxyapi/GLM'.
  • home-manager/programs/fish/functions/_pixeh_function.fish
    • Updated the function description.
    • Changed 'pi-agent' to 'pi' and added the '-p' flag for print mode.
    • Updated the model reference to 'cliproxyapi/glm-4.7'.
  • home-manager/programs/fish/functions/_pixeh_function.tpl.fish
    • Updated the function description.
    • Changed 'pi-agent' to 'pi' and added the '-p' flag for print mode.
    • Updated the model reference to 'cliproxyapi/GLM'.
  • home-manager/programs/fish/functions/_pixel_function.fish
    • Added a new Fish shell function to run Pi with the local Qwen model.
  • home-manager/programs/fish/functions/_pixel_function.tpl.fish
    • Added a new templated Fish shell function to run Pi with the local Qwen model.
  • home-manager/programs/fish/functions/_pixelh_function.fish
    • Added a new Fish shell function to run Pi headlessly with the local Qwen model.
  • home-manager/programs/fish/functions/_pixelh_function.tpl.fish
    • Added a new templated Fish shell function to run Pi headlessly with the local Qwen model.
  • scripts/llm-update.sh
    • Added the new '_pixel_function.tpl.fish' and '_pixelh_function.tpl.fish' templates to the update script's mappings.
  • spec/fish/_pixe_function.tpl_test.fish
    • Updated tests to reflect the change from 'pi-agent' to 'pi' and the new model reference.
    • Added a test for the templated cliproxyapi model.
  • spec/fish/_pixe_function_test.fish
    • Updated tests to reflect the change from 'pi-agent' to 'pi' and the new model reference.
    • Added a test for the cliproxyapi model.
  • spec/fish/_pixeh_function.tpl_test.fish
    • Added tests for non-empty prompts, templated cliproxyapi model, and print mode.
  • spec/fish/_pixeh_function_test.fish
    • Added tests for non-empty prompts, cliproxyapi model, and print mode.
  • spec/fish/_pixel_function.tpl_test.fish
    • Added tests for the new '_pixel_function.tpl.fish' including prompt building and templated local Qwen model usage.
  • spec/fish/_pixel_function_test.fish
    • Added tests for the new '_pixel_function.fish' including prompt building and local Qwen model usage.
  • spec/fish/_pixelh_function.tpl_test.fish
    • Added tests for the new '_pixelh_function.tpl.fish' including empty/non-empty prompts, templated local Qwen model, and print mode.
  • spec/fish/_pixelh_function_test.fish
    • Added tests for the new '_pixelh_function.fish' including empty/non-empty prompts, local Qwen model, and print mode.
  • spec/llm_update_spec.sh
    • Updated the test for fish wrapper templates to include '_pixel_function.tpl.fish'.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for a local Qwen model via LM Studio, introducing new pixel and pixelh fish commands. The changes include configuration updates, new wrapper scripts, and corresponding tests. The PR also refactors existing pi wrappers to use the cliproxyapi provider and switches from pi-agent to the pi command. The changes are applied consistently. My review includes one suggestion to address code duplication in the fish wrapper functions to improve long-term maintainability.

Comment on lines +1 to +11
function _pixel_function --description "Run Pi with a free-form prompt using the local Qwen model"
# Run Pi with a free-form prompt (spaces allowed) using the local Qwen model
# Usage: pixel [<prompt words...>]

if test (count $argv) -eq 0
pi --model 'lmstudio/qwen/qwen3.5-9b'
else
set -l prompt (string join " " -- $argv)
pi --model 'lmstudio/qwen/qwen3.5-9b' "$prompt"
end
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This function is almost identical to _pixe_function, with the only difference being the model string. Similarly, the new _pixelh_function is very similar to _pixeh_function. This introduces code duplication. To improve maintainability, consider creating helper functions.

For example, you could have a helper for interactive prompts:

# in a new helper function, e.g. _pi_interactive_wrapper.fish
function _pi_interactive_wrapper
    set -l model $argv[1]
    set -l prompt_args $argv[2..-1]

    if test (count $prompt_args) -eq 0
        pi --model "$model"
    else
        set -l prompt (string join " " -- $prompt_args)
        pi --model "$model" "$prompt"
    end
end

Then _pixel_function could be simplified to:

function _pixel_function --description "Run Pi with a free-form prompt using the local Qwen model"
    _pi_interactive_wrapper 'lmstudio/qwen/qwen3.5-9b' $argv
end

A similar helper could be created for the headless (-h) functions. This would make the code DRYer and easier to manage when adding more model wrappers in the future.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 24 files

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the repo’s LLM tooling/templates to support a local LM Studio Qwen model in Pi, and updates fish wrappers/config templates to use the pi CLI with cliproxyapi models instead of the older pi-agent/OpenRouter preset flow.

Changes:

  • Add pixel/pixelh fish wrapper functions (template + generated) targeting lmstudio Qwen, plus fishtape coverage.
  • Update existing pixe/pixeh wrappers (template + generated) to call pi --model cliproxyapi/... (and print mode for headless).
  • Update Pi/OpenCode config templates to use cliproxyapi naming, add lmstudio provider/models, and switch to placeholder-based preset IDs.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/llm_update_spec.sh Updates llm-update mapping coverage assertions for fish templates.
scripts/llm-update.sh Adds template→output mappings for new pixel/pixelh fish functions.
home-manager/programs/fish/default.nix Registers pixel/pixelh abbreviations and includes new functions in the managed set.
home-manager/programs/fish/functions/_pixel_function.tpl.fish New template function to run Pi using the local LM Studio Qwen model.
home-manager/programs/fish/functions/_pixel_function.fish Generated concrete pixel function using lmstudio/qwen/qwen3.5-9b.
home-manager/programs/fish/functions/_pixelh_function.tpl.fish New template headless Pi function using the local LM Studio Qwen model.
home-manager/programs/fish/functions/_pixelh_function.fish Generated concrete pixelh function using lmstudio/qwen/qwen3.5-9b with print mode.
home-manager/programs/fish/functions/_pixe_function.tpl.fish Migrates pixe template from pi-agent preset to pi --model cliproxyapi/__GLM__.
home-manager/programs/fish/functions/_pixe_function.fish Generated concrete pixe function using cliproxyapi/glm-4.7.
home-manager/programs/fish/functions/_pixeh_function.tpl.fish Migrates pixeh template to pi --model cliproxyapi/__GLM__ -p.
home-manager/programs/fish/functions/_pixeh_function.fish Generated concrete pixeh function using cliproxyapi/glm-4.7 with print mode.
spec/fish/_pixel_function.tpl_test.fish New fishtape tests for pixel template behavior and placeholder usage.
spec/fish/_pixel_function_test.fish New fishtape tests for generated pixel behavior.
spec/fish/_pixelh_function.tpl_test.fish New fishtape tests for pixelh template behavior and placeholder usage.
spec/fish/_pixelh_function_test.fish New fishtape tests for generated pixelh behavior.
spec/fish/_pixe_function.tpl_test.fish Updates pixe template test to stub pi and assert cliproxyapi/__GLM__.
spec/fish/_pixe_function_test.fish Updates pixe generated test to stub pi and assert cliproxyapi/glm-4.7.
spec/fish/_pixeh_function.tpl_test.fish Extends pixeh template tests to assert prompt forwarding/model/print mode.
spec/fish/_pixeh_function_test.fish Extends pixeh generated tests similarly.
config/pi/settings.tpl.json Switches default provider to cliproxyapi and enables lmstudio/* + *qwen*.
config/pi/settings.json Generated settings reflecting the new provider and enabled model patterns.
config/pi/models.tpl.json Renames provider key to cliproxyapi, uses __GLM_NONDOT__, and adds an lmstudio provider/model placeholder.
config/pi/models.json Generated models reflecting the renamed provider and new lmstudio model.
config/opencode/opencode.tpl.jsonc Uses @preset/__GLM_NONDOT__ for the OpenRouter preset model id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread spec/llm_update_spec.sh
Comment on lines +65 to +68
When run bash -c "grep '_ocxe_function.tpl.fish' '$SCRIPT' && grep '_pixe_function.tpl.fish' '$SCRIPT' && grep '_pixel_function.tpl.fish' '$SCRIPT'"
The output should include '_ocxe_function.tpl.fish'
The output should include '_pixe_function.tpl.fish'
The output should include '_pixel_function.tpl.fish'
Comment thread config/pi/models.json
},
"lmstudio": {
"baseUrl": "http://127.0.0.1:1234/v1",
"apiKey": "LM_API_TOKEN",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants