style(deps): migrated from Prettier to Biome and updated formatting rules

- Removed Prettier configuration files (.prettierignore and .prettierrc) and migrated formatting to Biome.
- Updated Biome configuration from version 2.3.11 to 2.3.12 and changed arrowParentheses rule from 'always' to 'asNeeded'.
- Pinned @biomejs/biome dependency to exact version 2.3.12 in package.json and bun.lock.
- Applied consistent arrow function formatting across 489 files by removing unnecessary parentheses around single parameters.
- Removed blank lines after comment blocks and reorganized imports for consistency across the codebase.
This commit is contained in:
can1357
2026-01-24 04:20:19 +01:00
parent f901befd19
commit 779ca4872b
489 changed files with 1900 additions and 2215 deletions
@@ -5,7 +5,6 @@
* These features are now exposed directly on the ExtensionAPI, matching
* the CustomToolAPI interface.
*/
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
export default function (pi: ExtensionAPI) {
@@ -2,7 +2,6 @@
* Example extension that uses a 3rd party dependency (chalk).
* Tests that jiti can resolve npm modules correctly.
*/
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
import chalk from "chalk";
@@ -14,12 +13,12 @@ export default function (pi: ExtensionAPI) {
console.log(`${chalk.blue("[chalk-logger]")} Agent starting`);
});
pi.on("tool_call", async (event) => {
pi.on("tool_call", async event => {
console.log(`${chalk.yellow("[chalk-logger]")} Tool: ${chalk.cyan(event.toolName)}`);
return undefined;
});
pi.on("agent_end", async (event) => {
pi.on("agent_end", async event => {
const count = event.messages.length;
console.log(`${chalk.green("[chalk-logger]")} Done with ${chalk.bold(String(count))} messages`);
});
@@ -3,7 +3,6 @@
*
* Demonstrates using ExtensionAPI's logger, typebox, and pi module access.
*/
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
export default function (pi: ExtensionAPI) {
@@ -9,7 +9,6 @@
* 2. Use /pirate to toggle pirate mode
* 3. When enabled, the agent will respond like a pirate
*/
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
export default function pirateExtension(pi: ExtensionAPI) {
@@ -18,7 +18,6 @@
* 2. Use /plan to toggle plan mode on/off
* 3. Or start in plan mode with --plan flag
*/
import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
import { Key } from "@oh-my-pi/pi-tui";
@@ -120,12 +119,12 @@ const SAFE_COMMANDS = [
];
function isSafeCommand(command: string): boolean {
if (SAFE_COMMANDS.some((pattern) => pattern.test(command))) {
if (!DESTRUCTIVE_PATTERNS.some((pattern) => pattern.test(command))) {
if (SAFE_COMMANDS.some(pattern => pattern.test(command))) {
if (!DESTRUCTIVE_PATTERNS.some(pattern => pattern.test(command))) {
return true;
}
}
if (DESTRUCTIVE_PATTERNS.some((pattern) => pattern.test(command))) {
if (DESTRUCTIVE_PATTERNS.some(pattern => pattern.test(command))) {
return false;
}
return true;
@@ -223,7 +222,7 @@ export default function planModeExtension(pi: ExtensionAPI) {
// Helper to update status displays
function updateStatus(ctx: ExtensionContext) {
if (executionMode && todoItems.length > 0) {
const completed = todoItems.filter((t) => t.completed).length;
const completed = todoItems.filter(t => t.completed).length;
ctx.ui.setStatus("plan-mode", ctx.ui.theme.fg("accent", `📋 ${completed}/${todoItems.length}`));
} else if (planModeEnabled) {
ctx.ui.setStatus("plan-mode", ctx.ui.theme.fg("warning", "⏸ plan"));
@@ -293,13 +292,13 @@ export default function planModeExtension(pi: ExtensionAPI) {
// Register Shift+P shortcut
pi.registerShortcut(Key.shift("p"), {
description: "Toggle plan mode",
handler: async (ctx) => {
handler: async ctx => {
await togglePlanMode(ctx);
},
});
// Block destructive bash in plan mode
pi.on("tool_call", async (event) => {
pi.on("tool_call", async event => {
if (!planModeEnabled) return;
if (event.toolName !== "bash") return;
@@ -319,7 +318,7 @@ export default function planModeExtension(pi: ExtensionAPI) {
if (!executionMode || todoItems.length === 0) return;
// Mark the first uncompleted step as done when any tool succeeds
const nextStep = todoItems.find((t) => !t.completed);
const nextStep = todoItems.find(t => !t.completed);
if (nextStep) {
nextStep.completed = true;
updateStatus(ctx);
@@ -328,7 +327,7 @@ export default function planModeExtension(pi: ExtensionAPI) {
// Filter out stale plan mode context messages from LLM context
// This ensures the agent only sees the CURRENT state (plan mode on/off)
pi.on("context", async (event) => {
pi.on("context", async event => {
// Only filter when NOT in plan mode (i.e., when executing)
if (planModeEnabled) {
return;
@@ -336,7 +335,7 @@ export default function planModeExtension(pi: ExtensionAPI) {
// Remove any previous plan-mode-context messages
const _beforeCount = event.messages.length;
const filtered = event.messages.filter((m) => {
const filtered = event.messages.filter(m => {
if (m.role === "user" && Array.isArray(m.content)) {
const hasOldContext = m.content.some(
(c: { type: string; text?: string }) => c.type === "text" && c.text?.includes("[PLAN MODE ACTIVE]"),
@@ -381,8 +380,8 @@ Do NOT attempt to make changes - just describe what you would do.`,
}
if (executionMode && todoItems.length > 0) {
const remaining = todoItems.filter((t) => !t.completed);
const todoList = remaining.map((t) => `${t.step}. ${t.text}`).join("\n");
const remaining = todoItems.filter(t => !t.completed);
const todoList = remaining.map(t => `${t.step}. ${t.text}`).join("\n");
return {
message: {
customType: "plan-execution-context",
@@ -402,10 +401,10 @@ Execute each step in order.`,
pi.on("agent_end", async (event, ctx) => {
// In execution mode, check if all steps complete
if (executionMode && todoItems.length > 0) {
const allComplete = todoItems.every((t) => t.completed);
const allComplete = todoItems.every(t => t.completed);
if (allComplete) {
// Show final completed list in chat
const completedList = todoItems.map((t) => `~~${t.text}~~`).join("\n");
const completedList = todoItems.map(t => `~~${t.text}~~`).join("\n");
pi.sendMessage(
{
customType: "plan-complete",
@@ -428,7 +427,7 @@ Execute each step in order.`,
// Extract todos from last message
const messages = event.messages;
const lastAssistant = [...messages].reverse().find((m) => m.role === "assistant");
const lastAssistant = [...messages].reverse().find(m => m.role === "assistant");
if (lastAssistant && Array.isArray(lastAssistant.content)) {
const textContent = lastAssistant.content
.filter(
@@ -541,7 +540,7 @@ Execute each step in order.`,
// If no tools were called this turn, the agent was doing analysis/explanation
// Mark the next uncompleted step as done
if (!toolsCalledThisTurn) {
const nextStep = todoItems.find((t) => !t.completed);
const nextStep = todoItems.find(t => !t.completed);
if (nextStep) {
nextStep.completed = true;
updateStatus(ctx);
@@ -9,7 +9,6 @@
* proper branching - when you branch, the todo state is automatically
* correct for that point in history.
*/
import { StringEnum } from "@oh-my-pi/pi-ai";
import type { ExtensionAPI, ExtensionContext, Theme } from "@oh-my-pi/pi-coding-agent";
import { matchesKey, Text, truncateToWidth } from "@oh-my-pi/pi-tui";
@@ -74,7 +73,7 @@ class TodoListComponent {
if (this.todos.length === 0) {
lines.push(truncateToWidth(` ${th.fg("dim", "No todos yet. Ask the agent to add some!")}`, width));
} else {
const done = this.todos.filter((t) => t.done).length;
const done = this.todos.filter(t => t.done).length;
const total = this.todos.length;
lines.push(truncateToWidth(` ${th.fg("muted", `${done}/${total} completed`)}`, width));
lines.push("");
@@ -149,7 +148,7 @@ export default function (pi: ExtensionAPI) {
{
type: "text",
text: todos.length
? todos.map((t) => `[${t.done ? "x" : " "}] #${t.id}: ${t.text}`).join("\n")
? todos.map(t => `[${t.done ? "x" : " "}] #${t.id}: ${t.text}`).join("\n")
: "No todos",
},
],
@@ -178,7 +177,7 @@ export default function (pi: ExtensionAPI) {
details: { action: "toggle", todos: [...todos], nextId, error: "id required" } as TodoDetails,
};
}
const todo = todos.find((t) => t.id === params.id);
const todo = todos.find(t => t.id === params.id);
if (!todo) {
return {
content: [{ type: "text", text: `Todo #${params.id} not found` }],
@@ -8,7 +8,6 @@
* 1. Copy this file to ~/.omp/agent/extensions/ (legacy: ~/.pi/agent/extensions/) or your project's .omp/extensions/
* 2. Use /tools to open the tool selector
*/
import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
import { getSettingsListTheme } from "@oh-my-pi/pi-coding-agent";
import { Container, type SettingItem, SettingsList } from "@oh-my-pi/pi-tui";
@@ -71,7 +70,7 @@ export default function toolsExtension(pi: ExtensionAPI) {
await ctx.ui.custom((tui, theme, done) => {
// Build settings items for each tool
const items: SettingItem[] = allTools.map((tool) => ({
const items: SettingItem[] = allTools.map(tool => ({
id: tool,
label: tool,
currentValue: enabledTools.has(tool) ? "enabled" : "disabled",
@@ -4,7 +4,6 @@
*
* Requires: npm install in this directory
*/
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
import { Type } from "@sinclair/typebox";
import ms from "ms";