From fcbfab765bfde897e10033411d42a7d38b35c9c2 Mon Sep 17 00:00:00 2001 From: can1357 Date: Fri, 23 Jan 2026 12:48:06 +0000 Subject: [PATCH] refactor: consolidated module import paths - Removed custom TypeScript path aliases and the associated transformation script. - Replaced aliased imports with direct `@oh-my-pi` package imports for improved clarity. - Simplified internal module references by removing explicit `/index` suffixes. --- AGENTS.md | 2 +- README.md | 16 +++- bun.lock | 16 ++-- package.json | 2 +- packages/agent/package.json | 2 +- packages/agent/test/agent-loop.test.ts | 20 ++-- packages/agent/test/agent.test.ts | 2 +- packages/agent/test/e2e.test.ts | 2 +- packages/agent/test/utils/calculate.ts | 2 +- packages/agent/test/utils/get-current-time.ts | 2 +- packages/agent/tsconfig.json | 5 - packages/ai/package.json | 8 +- packages/ai/src/cli.ts | 2 +- packages/ai/src/index.ts | 2 +- packages/ai/test/image-tool-result.test.ts | 4 +- packages/ai/test/oauth.ts | 2 +- packages/ai/tsconfig.json | 5 - packages/coding-agent/package.json | 2 +- .../src/capability/context-file.ts | 2 +- .../src/capability/extension-module.ts | 2 +- .../coding-agent/src/capability/extension.ts | 2 +- packages/coding-agent/src/capability/hook.ts | 2 +- .../src/capability/instruction.ts | 2 +- packages/coding-agent/src/capability/mcp.ts | 2 +- .../coding-agent/src/capability/prompt.ts | 2 +- packages/coding-agent/src/capability/rule.ts | 2 +- .../coding-agent/src/capability/settings.ts | 2 +- packages/coding-agent/src/capability/skill.ts | 2 +- .../src/capability/slash-command.ts | 2 +- packages/coding-agent/src/capability/ssh.ts | 2 +- .../src/capability/system-prompt.ts | 2 +- packages/coding-agent/src/capability/tool.ts | 2 +- packages/coding-agent/src/cli/args.ts | 2 +- packages/coding-agent/src/cli/plugin-cli.ts | 6 +- .../src/commit/agentic/tools/analyze-file.ts | 2 +- packages/coding-agent/src/config.ts | 10 -- .../src/config/settings-manager.ts | 4 +- .../coding-agent/src/discovery/agents-md.ts | 2 +- .../coding-agent/src/discovery/builtin.ts | 2 +- packages/coding-agent/src/discovery/claude.ts | 2 +- packages/coding-agent/src/discovery/cline.ts | 2 +- packages/coding-agent/src/discovery/codex.ts | 2 +- packages/coding-agent/src/discovery/cursor.ts | 2 +- packages/coding-agent/src/discovery/gemini.ts | 2 +- packages/coding-agent/src/discovery/github.ts | 2 +- packages/coding-agent/src/discovery/index.ts | 24 ++--- .../coding-agent/src/discovery/mcp-json.ts | 2 +- packages/coding-agent/src/discovery/ssh.ts | 2 +- packages/coding-agent/src/discovery/vscode.ts | 2 +- .../coding-agent/src/discovery/windsurf.ts | 2 +- .../extensibility/custom-commands/loader.ts | 2 +- .../extensibility/custom-commands/types.ts | 2 +- .../src/extensibility/custom-tools/loader.ts | 2 +- .../src/extensibility/custom-tools/types.ts | 2 +- .../src/extensibility/extensions/loader.ts | 2 +- .../src/extensibility/extensions/types.ts | 2 +- .../src/extensibility/hooks/loader.ts | 2 +- .../src/extensibility/hooks/types.ts | 6 +- packages/coding-agent/src/index.ts | 20 ++-- packages/coding-agent/src/lsp/index.ts | 2 +- packages/coding-agent/src/main.ts | 6 +- .../src/modes/components/tree-selector.ts | 2 +- .../controllers/extension-ui-controller.ts | 2 +- .../modes/controllers/selector-controller.ts | 2 +- .../src/modes/interactive-mode.ts | 6 +- .../coding-agent/src/modes/rpc/rpc-client.ts | 2 +- .../coding-agent/src/modes/rpc/rpc-mode.ts | 5 +- .../coding-agent/src/modes/rpc/rpc-types.ts | 2 +- packages/coding-agent/src/modes/types.ts | 4 +- packages/coding-agent/src/patch/index.ts | 12 +-- packages/coding-agent/src/patch/shared.ts | 2 +- packages/coding-agent/src/sdk.ts | 20 ++-- .../coding-agent/src/session/agent-session.ts | 6 +- packages/coding-agent/src/system-prompt.ts | 4 +- packages/coding-agent/src/task/executor.ts | 2 +- packages/coding-agent/src/tools/ask.ts | 2 +- packages/coding-agent/src/tools/bash.ts | 3 +- packages/coding-agent/src/tools/calculator.ts | 2 +- packages/coding-agent/src/tools/complete.ts | 2 +- packages/coding-agent/src/tools/fetch.ts | 4 +- packages/coding-agent/src/tools/find.ts | 2 +- packages/coding-agent/src/tools/grep.ts | 2 +- packages/coding-agent/src/tools/index.ts | 14 +-- packages/coding-agent/src/tools/ls.ts | 2 +- .../coding-agent/src/tools/output-utils.ts | 2 +- packages/coding-agent/src/tools/python.ts | 2 +- packages/coding-agent/src/tools/ssh.ts | 4 +- packages/coding-agent/src/tools/write.ts | 2 +- packages/coding-agent/src/tui/output-block.ts | 11 ++- packages/coding-agent/src/tui/utils.ts | 2 +- packages/coding-agent/src/web/search/index.ts | 2 +- .../test/agent-session-branching.test.ts | 2 +- .../test/agent-session-compaction.test.ts | 2 +- .../coding-agent/test/block-images.test.ts | 2 +- .../test/compaction-hooks-example.test.ts | 2 +- .../test/compaction-hooks.test.ts | 4 +- .../test/compaction-thinking-model.test.ts | 2 +- packages/coding-agent/test/compaction.test.ts | 2 +- .../test/python-tool-settings.test.ts | 2 +- .../test/settings-manager.test.ts | 49 ++++++---- packages/coding-agent/test/tools.test.ts | 2 +- .../coding-agent/test/tools/index.test.ts | 2 +- .../test/tools/lsp-batching.test.ts | 2 +- .../test/tools/python-execution.test.ts | 2 +- .../test/tools/python-fallback.test.ts | 4 +- .../test/tools/python-tool-mode.test.ts | 2 +- .../coding-agent/test/tools/python.test.ts | 2 +- .../test/tools/schema-validation.test.ts | 2 +- packages/coding-agent/test/utilities.ts | 2 +- packages/coding-agent/tsconfig.json | 5 - packages/pi-utils/package.json | 2 +- packages/{omp-stats => stats}/README.md | 0 packages/{omp-stats => stats}/build.ts | 0 packages/{omp-stats => stats}/package.json | 9 +- .../{omp-stats => stats}/src/aggregator.ts | 0 .../{omp-stats => stats}/src/client/App.tsx | 0 .../{omp-stats => stats}/src/client/api.ts | 0 .../src/client/components/RequestDetail.tsx | 0 .../src/client/components/RequestList.tsx | 0 .../src/client/components/StatCard.tsx | 0 .../{omp-stats => stats}/src/client/index.tsx | 0 .../{omp-stats => stats}/src/client/types.ts | 0 packages/{omp-stats => stats}/src/db.ts | 0 packages/{omp-stats => stats}/src/index.ts | 0 packages/{omp-stats => stats}/src/parser.ts | 0 packages/{omp-stats => stats}/src/server.ts | 0 packages/{omp-stats => stats}/src/types.ts | 0 .../{omp-stats => stats}/tsconfig.build.json | 0 .../{omp-stats => stats}/tsconfig.client.json | 0 packages/{omp-stats => stats}/tsconfig.json | 0 .../tsconfig.publish.json | 0 packages/tui/package.json | 2 +- packages/tui/src/components/box.ts | 4 +- .../tui/src/components/cancellable-loader.ts | 2 +- packages/tui/src/components/editor.ts | 16 +++- packages/tui/src/components/image.ts | 4 +- packages/tui/src/components/input.ts | 6 +- packages/tui/src/components/loader.ts | 2 +- packages/tui/src/components/markdown.ts | 10 +- packages/tui/src/components/select-list.ts | 8 +- packages/tui/src/components/settings-list.ts | 8 +- packages/tui/src/components/spacer.ts | 2 +- packages/tui/src/components/tab-bar.ts | 6 +- packages/tui/src/components/text.ts | 4 +- packages/tui/src/components/truncated-text.ts | 4 +- packages/tui/test/autocomplete.test.ts | 2 +- packages/tui/test/chat-simple.ts | 14 +-- packages/tui/test/editor.test.ts | 4 +- packages/tui/test/image-test.ts | 12 +-- packages/tui/test/key-tester.ts | 6 +- packages/tui/test/markdown.test.ts | 2 +- packages/tui/test/stdin-buffer.test.ts | 2 +- packages/tui/test/test-themes.ts | 2 +- packages/tui/test/truncated-text.test.ts | 4 +- packages/tui/test/virtual-terminal.ts | 2 +- packages/tui/test/wrap-ansi.test.ts | 2 +- packages/tui/tsconfig.json | 5 - scripts/transform-imports.ts | 91 ------------------- tsconfig.json | 11 +-- 159 files changed, 307 insertions(+), 406 deletions(-) rename packages/{omp-stats => stats}/README.md (100%) rename packages/{omp-stats => stats}/build.ts (100%) rename packages/{omp-stats => stats}/package.json (87%) rename packages/{omp-stats => stats}/src/aggregator.ts (100%) rename packages/{omp-stats => stats}/src/client/App.tsx (100%) rename packages/{omp-stats => stats}/src/client/api.ts (100%) rename packages/{omp-stats => stats}/src/client/components/RequestDetail.tsx (100%) rename packages/{omp-stats => stats}/src/client/components/RequestList.tsx (100%) rename packages/{omp-stats => stats}/src/client/components/StatCard.tsx (100%) rename packages/{omp-stats => stats}/src/client/index.tsx (100%) rename packages/{omp-stats => stats}/src/client/types.ts (100%) rename packages/{omp-stats => stats}/src/db.ts (100%) rename packages/{omp-stats => stats}/src/index.ts (100%) rename packages/{omp-stats => stats}/src/parser.ts (100%) rename packages/{omp-stats => stats}/src/server.ts (100%) rename packages/{omp-stats => stats}/src/types.ts (100%) rename packages/{omp-stats => stats}/tsconfig.build.json (100%) rename packages/{omp-stats => stats}/tsconfig.client.json (100%) rename packages/{omp-stats => stats}/tsconfig.json (100%) rename packages/{omp-stats => stats}/tsconfig.publish.json (100%) delete mode 100644 scripts/transform-imports.ts diff --git a/AGENTS.md b/AGENTS.md index 295cbd830..bd9a028b0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,7 +14,7 @@ This repo contains multiple packages, but **`packages/coding-agent/`** is the pr | `packages/agent` | Agent runtime with tool calling and state management | | `packages/coding-agent` | Main CLI application (primary focus) | | `packages/tui` | Terminal UI library with differential rendering | -| `packages/omp-stats` | Local observability dashboard (`omp stats`) | +| `packages/stats` | Local observability dashboard (`omp stats`) | | `packages/pi-utils` | Shared utilities (logger, streams, temp files) | ## Code Quality diff --git a/README.md b/README.md index b18504ba1..803a9ebea 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,18 @@ Download binaries directly from [GitHub Releases](https://github.com/can1357/oh- --- +## + Commit Tool (AI-Powered Git Commits) + +AI-powered conventional commit generation with intelligent change analysis: + +- **Agentic mode**: Tool-based git inspection with `git-overview`, `git-file-diff`, `git-hunk` for fine-grained analysis +- **Split commits**: Automatically separates unrelated changes into atomic commits with dependency ordering +- **Hunk-level staging**: Stage individual hunks when changes span multiple concerns +- **Changelog generation**: Proposes and applies changelog entries to `CHANGELOG.md` files +- **Commit validation**: Detects filler words, meta phrases, and enforces conventional commit format +- **Legacy mode**: `--legacy` flag for deterministic pipeline when preferred +- Run via `omp commit` with options: `--push`, `--dry-run`, `--no-changelog`, `--context` + ## + Python Tool (IPython Kernel)

@@ -93,6 +105,7 @@ Execute Python code with a persistent IPython kernel and 30+ shell-like helpers: - **Shared gateway**: Resource-efficient kernel reuse across sessions (`python.sharedGateway` setting) - **Custom modules**: Load extensions from `.omp/modules/` and `.pi/modules/` directories - **Rich output**: Supports `display()` for HTML, Markdown, images, and interactive JSON trees +- **Mermaid diagrams**: Renders mermaid code blocks as inline graphics in iTerm2/Kitty terminals - Install dependencies via `omp setup python` ## + LSP Integration (Language Server Protocol) @@ -151,6 +164,7 @@ Parallel execution framework with specialized agents and real-time streaming: - **Parallel exploration**: Reviewer agent can spawn explore agents for large codebase analysis - **Real-time artifact streaming**: Task outputs stream as they're created, not just at completion - **Output tool**: Read full agent outputs by ID when truncated previews aren't sufficient +- **Isolated execution**: `isolated: true` runs tasks in git worktrees, generates patches, and applies cleanly - User-level (`~/.omp/agent/agents/`) and project-level (`.omp/agents/`) custom agents - Concurrency-limited batch execution with progress tracking @@ -331,7 +345,7 @@ Handles whitespace and indentation variance automatically: | **[@oh-my-pi/pi-agent-core](packages/agent)** | Agent runtime with tool calling and state management | | **[@oh-my-pi/pi-coding-agent](packages/coding-agent)** | Interactive coding agent CLI | | **[@oh-my-pi/pi-tui](packages/tui)** | Terminal UI library with differential rendering | -| **[@oh-my-pi/omp-stats](packages/omp-stats)** | Local observability dashboard for AI usage statistics | +| **[@oh-my-pi/omp-stats](packages/stats)** | Local observability dashboard for AI usage statistics | --- diff --git a/bun.lock b/bun.lock index 6ad1c1569..ddc0dc2f7 100644 --- a/bun.lock +++ b/bun.lock @@ -22,7 +22,7 @@ }, "packages/agent": { "name": "@oh-my-pi/pi-agent-core", - "version": "8.0.0", + "version": "8.1.0", "dependencies": { "@oh-my-pi/pi-ai": "workspace:*", "@oh-my-pi/pi-tui": "workspace:*", @@ -36,7 +36,7 @@ }, "packages/ai": { "name": "@oh-my-pi/pi-ai", - "version": "8.0.0", + "version": "8.1.0", "bin": { "pi-ai": "./src/cli.ts", }, @@ -64,7 +64,7 @@ }, "packages/coding-agent": { "name": "@oh-my-pi/pi-coding-agent", - "version": "8.0.0", + "version": "8.1.0", "bin": { "omp": "src/cli.ts", }, @@ -100,9 +100,9 @@ "ms": "^2.1.3", }, }, - "packages/omp-stats": { + "packages/stats": { "name": "@oh-my-pi/omp-stats", - "version": "8.0.0", + "version": "8.1.0", "bin": { "omp-stats": "./src/index.ts", }, @@ -122,7 +122,7 @@ }, "packages/pi-utils": { "name": "@oh-my-pi/pi-utils", - "version": "8.0.0", + "version": "8.1.0", "dependencies": { "strip-ansi": "^7.1.2", "winston": "^3.17.0", @@ -151,7 +151,7 @@ }, "packages/tui": { "name": "@oh-my-pi/pi-tui", - "version": "8.0.0", + "version": "8.1.0", "dependencies": { "@types/mime-types": "^2.1.4", "chalk": "^5.5.0", @@ -340,7 +340,7 @@ "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.25.3", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "jose": "^6.1.1", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.0" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-vsAMBMERybvYgKbg/l4L1rhS7VXV1c0CtyJg72vwxONVX0l4ZfKVAnZEWTQixJGTzKnELjQ59e4NbdFDALRiAQ=="], - "@oh-my-pi/omp-stats": ["@oh-my-pi/omp-stats@workspace:packages/omp-stats"], + "@oh-my-pi/omp-stats": ["@oh-my-pi/omp-stats@workspace:packages/stats"], "@oh-my-pi/pi-agent-core": ["@oh-my-pi/pi-agent-core@workspace:packages/agent"], diff --git a/package.json b/package.json index e381c2941..123a5fc45 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "install:dev": "bun install && bun packages/coding-agent/scripts/generate-wasm-b64.ts && bun --cwd=packages/coding-agent link && bun --cwd=packages/ai link", "dev": "bun packages/coding-agent/src/cli.ts", "stats": "bun --cwd=packages/coding-agent src/cli.ts stats", - "check": "biome check --write . && bun --cwd=packages/coding-agent run check && bun --cwd=packages/omp-stats run check", + "check": "biome check --write . && bun --cwd=packages/coding-agent run check && bun --cwd=packages/stats run check", "fix": "biome check --write --unsafe . && bun --cwd=packages/coding-agent run format-prompts", "bench:gen-fixtures": "bun run packages/react-edit-benchmark/generate.ts --react-dir /tmp/react-source --count-per-type 3", "bench:edit": "bun --cwd=packages/react-edit-benchmark run start", diff --git a/packages/agent/package.json b/packages/agent/package.json index 25c056af2..d3de03d36 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -1,6 +1,6 @@ { "name": "@oh-my-pi/pi-agent-core", - "version": "8.0.0", + "version": "8.1.0", "description": "General-purpose agent with transport abstraction, state management, and attachment support", "type": "module", "main": "./src/index.ts", diff --git a/packages/agent/test/agent-loop.test.ts b/packages/agent/test/agent-loop.test.ts index 8f6136b28..18a4e9b0d 100644 --- a/packages/agent/test/agent-loop.test.ts +++ b/packages/agent/test/agent-loop.test.ts @@ -1,3 +1,13 @@ +import { agentLoop, agentLoopContinue } from "@oh-my-pi/pi-agent-core/agent-loop"; +import type { + AgentContext, + AgentEvent, + AgentLoopConfig, + AgentMessage, + AgentTool, + AgentToolContext, + ToolCallContext, +} from "@oh-my-pi/pi-agent-core/types"; import { type AssistantMessage, type AssistantMessageEvent, @@ -8,16 +18,6 @@ import { } from "@oh-my-pi/pi-ai"; import { Type } from "@sinclair/typebox"; import { describe, expect, it } from "vitest"; -import { agentLoop, agentLoopContinue } from "$agent/agent-loop"; -import type { - AgentContext, - AgentEvent, - AgentLoopConfig, - AgentMessage, - AgentTool, - AgentToolContext, - ToolCallContext, -} from "$agent/types"; // Mock stream for testing - mimics MockAssistantStream class MockAssistantStream extends EventStream { diff --git a/packages/agent/test/agent.test.ts b/packages/agent/test/agent.test.ts index 1b126bd5c..02dcdd9bb 100644 --- a/packages/agent/test/agent.test.ts +++ b/packages/agent/test/agent.test.ts @@ -1,3 +1,4 @@ +import { Agent } from "@oh-my-pi/pi-agent-core"; import { type AssistantMessage, type AssistantMessageEvent, @@ -7,7 +8,6 @@ import { type Usage, } from "@oh-my-pi/pi-ai"; import { describe, expect, it } from "vitest"; -import { Agent } from "$agent/index"; class MockAssistantStream extends EventStream { constructor() { diff --git a/packages/agent/test/e2e.test.ts b/packages/agent/test/e2e.test.ts index 2037eca8e..34b094464 100644 --- a/packages/agent/test/e2e.test.ts +++ b/packages/agent/test/e2e.test.ts @@ -1,7 +1,7 @@ +import { Agent } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, Model, ToolResultMessage, UserMessage } from "@oh-my-pi/pi-ai"; import { getModel } from "@oh-my-pi/pi-ai"; import { describe, expect, it } from "vitest"; -import { Agent } from "$agent/index"; import { calculateTool } from "./utils/calculate"; async function basicPrompt(model: Model) { diff --git a/packages/agent/test/utils/calculate.ts b/packages/agent/test/utils/calculate.ts index c7f40df68..2356fec0f 100644 --- a/packages/agent/test/utils/calculate.ts +++ b/packages/agent/test/utils/calculate.ts @@ -1,5 +1,5 @@ +import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core/types"; import { type Static, Type } from "@sinclair/typebox"; -import type { AgentTool, AgentToolResult } from "$agent/types"; export interface CalculateResult extends AgentToolResult { content: Array<{ type: "text"; text: string }>; diff --git a/packages/agent/test/utils/get-current-time.ts b/packages/agent/test/utils/get-current-time.ts index dfce23557..5b2fd995a 100644 --- a/packages/agent/test/utils/get-current-time.ts +++ b/packages/agent/test/utils/get-current-time.ts @@ -1,5 +1,5 @@ +import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core/types"; import { type Static, Type } from "@sinclair/typebox"; -import type { AgentTool, AgentToolResult } from "$agent/types"; export interface GetCurrentTimeResult extends AgentToolResult<{ utcTimestamp: number }> {} diff --git a/packages/agent/tsconfig.json b/packages/agent/tsconfig.json index f512af633..9f01e136d 100644 --- a/packages/agent/tsconfig.json +++ b/packages/agent/tsconfig.json @@ -4,11 +4,6 @@ "noEmit": true, "baseUrl": ".", "paths": { - "$agent/*": ["./src/*"], - "$ai/*": ["../ai/src/*"], - "$c/*": ["../coding-agent/src/*"], - "$tui/*": ["../tui/src/*"], - "$stats/*": ["../omp-stats/src/*"], "@oh-my-pi/pi-agent-core": ["./src/index.ts"], "@oh-my-pi/pi-agent-core/*": ["./src/*"], "@oh-my-pi/pi-ai": ["../ai/src/index.ts"], diff --git a/packages/ai/package.json b/packages/ai/package.json index 053c76950..27e9ec1ea 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -1,6 +1,6 @@ { "name": "@oh-my-pi/pi-ai", - "version": "8.0.0", + "version": "8.1.0", "description": "Unified LLM API with automatic model discovery and provider configuration", "type": "module", "main": "./src/index.ts", @@ -20,16 +20,18 @@ } }, "bin": { - "pi-ai": "./src/cli.ts" + "pi-ai": "./dist/cli.js" }, "files": [ + "dist", "src", "README.md" ], "scripts": { + "build": "tsgo -p tsconfig.build.json", "generate-models": "bun scripts/generate-models.ts", "test": "bun test", - "prepublishOnly": "cp tsconfig.publish.json tsconfig.json" + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json && bun run build" }, "dependencies": { "@oh-my-pi/pi-utils": "workspace:*", diff --git a/packages/ai/src/cli.ts b/packages/ai/src/cli.ts index 74a68b81a..4d94b7dad 100755 --- a/packages/ai/src/cli.ts +++ b/packages/ai/src/cli.ts @@ -2,12 +2,12 @@ import { createInterface } from "readline"; import { CliAuthStorage } from "./storage"; import "./utils/migrate-env"; +import { getOAuthProviders } from "./utils/oauth"; import { loginAnthropic } from "./utils/oauth/anthropic"; import { loginCursor } from "./utils/oauth/cursor"; import { loginGitHubCopilot } from "./utils/oauth/github-copilot"; import { loginAntigravity } from "./utils/oauth/google-antigravity"; import { loginGeminiCli } from "./utils/oauth/google-gemini-cli"; -import { getOAuthProviders } from "./utils/oauth/index"; import { loginOpenAICodex } from "./utils/oauth/openai-codex"; import type { OAuthCredentials, OAuthProvider } from "./utils/oauth/types"; diff --git a/packages/ai/src/index.ts b/packages/ai/src/index.ts index 0767cb898..90c64eccc 100644 --- a/packages/ai/src/index.ts +++ b/packages/ai/src/index.ts @@ -18,7 +18,7 @@ export * from "./usage/google-antigravity"; export * from "./usage/openai-codex"; export * from "./usage/zai"; export * from "./utils/event-stream"; -export * from "./utils/oauth/index"; +export * from "./utils/oauth"; export * from "./utils/overflow"; export * from "./utils/retry"; export * from "./utils/typebox-helpers"; diff --git a/packages/ai/test/image-tool-result.test.ts b/packages/ai/test/image-tool-result.test.ts index ee20cc688..83a1d3e47 100644 --- a/packages/ai/test/image-tool-result.test.ts +++ b/packages/ai/test/image-tool-result.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from "node:fs"; import { join } from "node:path"; -import type { Api, Context, Model, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/index"; -import { complete, getModel } from "@oh-my-pi/pi-ai/index"; +import type { Api, Context, Model, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai"; +import { complete, getModel } from "@oh-my-pi/pi-ai"; import type { OptionsForApi } from "@oh-my-pi/pi-ai/types"; import { Type } from "@sinclair/typebox"; import { describe, expect, it } from "vitest"; diff --git a/packages/ai/test/oauth.ts b/packages/ai/test/oauth.ts index 2e0e55193..29ed8ab19 100644 --- a/packages/ai/test/oauth.ts +++ b/packages/ai/test/oauth.ts @@ -6,7 +6,7 @@ */ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; -import { getOAuthApiKey } from "@oh-my-pi/pi-ai/utils/oauth/index"; +import { getOAuthApiKey } from "@oh-my-pi/pi-ai/utils/oauth"; import type { OAuthCredentials, OAuthProvider } from "@oh-my-pi/pi-ai/utils/oauth/types"; import { homedir } from "os"; import { dirname, join } from "path"; diff --git a/packages/ai/tsconfig.json b/packages/ai/tsconfig.json index 201b28d15..f889c005d 100644 --- a/packages/ai/tsconfig.json +++ b/packages/ai/tsconfig.json @@ -4,11 +4,6 @@ "noEmit": true, "baseUrl": ".", "paths": { - "$ai/*": ["./src/*"], - "$c/*": ["../coding-agent/src/*"], - "$tui/*": ["../tui/src/*"], - "$agent/*": ["../agent/src/*"], - "$stats/*": ["../omp-stats/src/*"], "@oh-my-pi/pi-ai": ["./src/index.ts"], "@oh-my-pi/pi-ai/*": ["./src/*"], "@oh-my-pi/pi-agent-core": ["../agent/src/index.ts"], diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json index e59521ce7..5c15536f8 100644 --- a/packages/coding-agent/package.json +++ b/packages/coding-agent/package.json @@ -1,6 +1,6 @@ { "name": "@oh-my-pi/pi-coding-agent", - "version": "8.0.0", + "version": "8.1.0", "description": "Coding agent CLI with read, bash, edit, write tools and session management", "type": "module", "ompConfig": { diff --git a/packages/coding-agent/src/capability/context-file.ts b/packages/coding-agent/src/capability/context-file.ts index fca460cf0..5b016f69e 100644 --- a/packages/coding-agent/src/capability/context-file.ts +++ b/packages/coding-agent/src/capability/context-file.ts @@ -5,7 +5,7 @@ * persistent guidance to the agent. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/extension-module.ts b/packages/coding-agent/src/capability/extension-module.ts index ab5e1b692..b4dc82cd8 100644 --- a/packages/coding-agent/src/capability/extension-module.ts +++ b/packages/coding-agent/src/capability/extension-module.ts @@ -4,7 +4,7 @@ * TypeScript/JavaScript extension modules loaded by the extension system. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/extension.ts b/packages/coding-agent/src/capability/extension.ts index db44a292c..48ba9fc89 100644 --- a/packages/coding-agent/src/capability/extension.ts +++ b/packages/coding-agent/src/capability/extension.ts @@ -4,7 +4,7 @@ * Gemini-style extensions that provide MCP servers, tools, and context. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { MCPServer } from "./mcp"; import type { SourceMeta } from "./types"; diff --git a/packages/coding-agent/src/capability/hook.ts b/packages/coding-agent/src/capability/hook.ts index 9dd22bc4a..d02fc7b0d 100644 --- a/packages/coding-agent/src/capability/hook.ts +++ b/packages/coding-agent/src/capability/hook.ts @@ -4,7 +4,7 @@ * Pre/post tool execution hooks defined as shell scripts. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/instruction.ts b/packages/coding-agent/src/capability/instruction.ts index 0fb844f75..04b62a3e4 100644 --- a/packages/coding-agent/src/capability/instruction.ts +++ b/packages/coding-agent/src/capability/instruction.ts @@ -4,7 +4,7 @@ * GitHub Copilot-style instructions with optional file pattern matching. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/mcp.ts b/packages/coding-agent/src/capability/mcp.ts index c07232dd7..de4314bb2 100644 --- a/packages/coding-agent/src/capability/mcp.ts +++ b/packages/coding-agent/src/capability/mcp.ts @@ -5,7 +5,7 @@ * All providers translate their native format to this shape. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/prompt.ts b/packages/coding-agent/src/capability/prompt.ts index 4e2637bf7..024fe939e 100644 --- a/packages/coding-agent/src/capability/prompt.ts +++ b/packages/coding-agent/src/capability/prompt.ts @@ -4,7 +4,7 @@ * Reusable prompt templates (Codex format) available via /prompts: menu. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/rule.ts b/packages/coding-agent/src/capability/rule.ts index 476a2f99f..3da252d27 100644 --- a/packages/coding-agent/src/capability/rule.ts +++ b/packages/coding-agent/src/capability/rule.ts @@ -5,7 +5,7 @@ * Translated to a canonical shape regardless of source format. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/settings.ts b/packages/coding-agent/src/capability/settings.ts index 05ce7eea4..ef95732ff 100644 --- a/packages/coding-agent/src/capability/settings.ts +++ b/packages/coding-agent/src/capability/settings.ts @@ -4,7 +4,7 @@ * Configuration settings from various sources (JSON, TOML, etc.) */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/skill.ts b/packages/coding-agent/src/capability/skill.ts index 7997f7f68..b03e26bd5 100644 --- a/packages/coding-agent/src/capability/skill.ts +++ b/packages/coding-agent/src/capability/skill.ts @@ -4,7 +4,7 @@ * Skills provide specialized knowledge or workflows that extend agent capabilities. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/slash-command.ts b/packages/coding-agent/src/capability/slash-command.ts index a8a5ec427..e84013cc3 100644 --- a/packages/coding-agent/src/capability/slash-command.ts +++ b/packages/coding-agent/src/capability/slash-command.ts @@ -4,7 +4,7 @@ * File-based slash commands defined as markdown files. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/ssh.ts b/packages/coding-agent/src/capability/ssh.ts index aa019cb45..4037915c5 100644 --- a/packages/coding-agent/src/capability/ssh.ts +++ b/packages/coding-agent/src/capability/ssh.ts @@ -4,7 +4,7 @@ * Canonical shape for SSH host entries, regardless of source format. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/system-prompt.ts b/packages/coding-agent/src/capability/system-prompt.ts index 1851ab6e7..f5ab8f247 100644 --- a/packages/coding-agent/src/capability/system-prompt.ts +++ b/packages/coding-agent/src/capability/system-prompt.ts @@ -5,7 +5,7 @@ * Distinct from context-files which are user instructions shown in conversation. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/capability/tool.ts b/packages/coding-agent/src/capability/tool.ts index 90e64505d..2d66c6780 100644 --- a/packages/coding-agent/src/capability/tool.ts +++ b/packages/coding-agent/src/capability/tool.ts @@ -4,7 +4,7 @@ * User-defined tools that extend agent capabilities. */ -import { defineCapability } from "./index"; +import { defineCapability } from "."; import type { SourceMeta } from "./types"; /** diff --git a/packages/coding-agent/src/cli/args.ts b/packages/coding-agent/src/cli/args.ts index d13975766..d1f2d96ab 100644 --- a/packages/coding-agent/src/cli/args.ts +++ b/packages/coding-agent/src/cli/args.ts @@ -4,7 +4,7 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "@oh-my-pi/pi-coding-agent/config"; -import { BUILTIN_TOOLS } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { BUILTIN_TOOLS } from "@oh-my-pi/pi-coding-agent/tools"; import chalk from "chalk"; export type Mode = "text" | "json" | "rpc"; diff --git a/packages/coding-agent/src/cli/plugin-cli.ts b/packages/coding-agent/src/cli/plugin-cli.ts index 6fc4eaa13..ff61d27e8 100644 --- a/packages/coding-agent/src/cli/plugin-cli.ts +++ b/packages/coding-agent/src/cli/plugin-cli.ts @@ -5,11 +5,7 @@ */ import { APP_NAME } from "@oh-my-pi/pi-coding-agent/config"; -import { - PluginManager, - parseSettingValue, - validateSetting, -} from "@oh-my-pi/pi-coding-agent/extensibility/plugins/index"; +import { PluginManager, parseSettingValue, validateSetting } from "@oh-my-pi/pi-coding-agent/extensibility/plugins"; import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import chalk from "chalk"; diff --git a/packages/coding-agent/src/commit/agentic/tools/analyze-file.ts b/packages/coding-agent/src/commit/agentic/tools/analyze-file.ts index 254ffa355..e0012faa1 100644 --- a/packages/coding-agent/src/commit/agentic/tools/analyze-file.ts +++ b/packages/coding-agent/src/commit/agentic/tools/analyze-file.ts @@ -9,7 +9,7 @@ import type { CustomTool, CustomToolContext } from "@oh-my-pi/pi-coding-agent/ex import type { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { TaskTool } from "@oh-my-pi/pi-coding-agent/task"; import type { TaskParams } from "@oh-my-pi/pi-coding-agent/task/types"; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { Type } from "@sinclair/typebox"; const analyzeFileSchema = Type.Object({ diff --git a/packages/coding-agent/src/config.ts b/packages/coding-agent/src/config.ts index 154312981..7bd5ea739 100644 --- a/packages/coding-agent/src/config.ts +++ b/packages/coding-agent/src/config.ts @@ -79,16 +79,6 @@ export function getAuthPath(): string { return join(getAgentDir(), "auth.json"); } -/** Get path to settings.json (legacy, use getConfigPath for config.yaml) */ -export function getLegacySettingsPath(): string { - return join(getAgentDir(), "settings.json"); -} - -/** Get path to config.yml (user settings) */ -export function getConfigPath(): string { - return join(getAgentDir(), "config.yml"); -} - /** * Gets the path to agent.db (SQLite database for settings and auth storage). * @param agentDir - Base agent directory, defaults to ~/.omp/agent diff --git a/packages/coding-agent/src/config/settings-manager.ts b/packages/coding-agent/src/config/settings-manager.ts index 19c233e4e..e9b8a7851 100644 --- a/packages/coding-agent/src/config/settings-manager.ts +++ b/packages/coding-agent/src/config/settings-manager.ts @@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "node:fs"; import { rename } from "node:fs/promises"; import { join } from "node:path"; import { type Settings as SettingsItem, settingsCapability } from "@oh-my-pi/pi-coding-agent/capability/settings"; -import { getAgentDbPath, getAgentDir, getConfigPath } from "@oh-my-pi/pi-coding-agent/config"; +import { getAgentDbPath, getAgentDir } from "@oh-my-pi/pi-coding-agent/config"; import { withFileLock } from "@oh-my-pi/pi-coding-agent/config/file-lock"; import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; import type { SymbolPreset } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; @@ -503,7 +503,7 @@ export class SettingsManager { * @returns Configured SettingsManager with merged global and user settings */ static async create(cwd: string = process.cwd(), agentDir: string = getAgentDir()): Promise { - const configPath = getConfigPath(); + const configPath = join(agentDir, "config.yml"); const storage = await AgentStorage.open(getAgentDbPath(agentDir)); // Migrate from legacy storage if config.yml doesn't exist diff --git a/packages/coding-agent/src/discovery/agents-md.ts b/packages/coding-agent/src/discovery/agents-md.ts index 268848927..b11568641 100644 --- a/packages/coding-agent/src/discovery/agents-md.ts +++ b/packages/coding-agent/src/discovery/agents-md.ts @@ -7,9 +7,9 @@ */ import { dirname, join, sep } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types"; import { calculateDepth, createSourceMeta } from "./helpers"; diff --git a/packages/coding-agent/src/discovery/builtin.ts b/packages/coding-agent/src/discovery/builtin.ts index d40a1ed9d..3fe623a05 100644 --- a/packages/coding-agent/src/discovery/builtin.ts +++ b/packages/coding-agent/src/discovery/builtin.ts @@ -5,6 +5,7 @@ * .pi is an alias for backwards compatibility. */ +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file"; import { type Extension, @@ -14,7 +15,6 @@ import { import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; import { readDirEntries, readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; import { type Hook, hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type Instruction, instructionCapability } from "@oh-my-pi/pi-coding-agent/capability/instruction"; import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import { type Prompt, promptCapability } from "@oh-my-pi/pi-coding-agent/capability/prompt"; diff --git a/packages/coding-agent/src/discovery/claude.ts b/packages/coding-agent/src/discovery/claude.ts index fd1c992e4..3cc78cdd7 100644 --- a/packages/coding-agent/src/discovery/claude.ts +++ b/packages/coding-agent/src/discovery/claude.ts @@ -6,11 +6,11 @@ */ import { join, sep } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file"; import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; import { type Hook, hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import { type Settings, settingsCapability } from "@oh-my-pi/pi-coding-agent/capability/settings"; import { type Skill, skillCapability } from "@oh-my-pi/pi-coding-agent/capability/skill"; diff --git a/packages/coding-agent/src/discovery/cline.ts b/packages/coding-agent/src/discovery/cline.ts index f35c68f6a..8b7d3b64d 100644 --- a/packages/coding-agent/src/discovery/cline.ts +++ b/packages/coding-agent/src/discovery/cline.ts @@ -6,8 +6,8 @@ */ import { dirname, resolve } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { readDirEntries, readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule"; import { ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule"; import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types"; diff --git a/packages/coding-agent/src/discovery/codex.ts b/packages/coding-agent/src/discovery/codex.ts index 0fadbda7e..823a98cd6 100644 --- a/packages/coding-agent/src/discovery/codex.ts +++ b/packages/coding-agent/src/discovery/codex.ts @@ -8,13 +8,13 @@ */ import { join } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import type { ContextFile } from "@oh-my-pi/pi-coding-agent/capability/context-file"; import { contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file"; import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; import type { Hook } from "@oh-my-pi/pi-coding-agent/capability/hook"; import { hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import type { MCPServer } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import { mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import type { Prompt } from "@oh-my-pi/pi-coding-agent/capability/prompt"; diff --git a/packages/coding-agent/src/discovery/cursor.ts b/packages/coding-agent/src/discovery/cursor.ts index 6ba9ca5d8..a30d46ba9 100644 --- a/packages/coding-agent/src/discovery/cursor.ts +++ b/packages/coding-agent/src/discovery/cursor.ts @@ -14,8 +14,8 @@ * - settings: From settings.json if present */ +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule"; import { ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule"; diff --git a/packages/coding-agent/src/discovery/gemini.ts b/packages/coding-agent/src/discovery/gemini.ts index 4cab30869..d3c4e4c2e 100644 --- a/packages/coding-agent/src/discovery/gemini.ts +++ b/packages/coding-agent/src/discovery/gemini.ts @@ -17,6 +17,7 @@ */ import { join, sep } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file"; import { type Extension, @@ -25,7 +26,6 @@ import { } from "@oh-my-pi/pi-coding-agent/capability/extension"; import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; import { readDirEntries, readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import { type Settings, settingsCapability } from "@oh-my-pi/pi-coding-agent/capability/settings"; import { type SystemPrompt, systemPromptCapability } from "@oh-my-pi/pi-coding-agent/capability/system-prompt"; diff --git a/packages/coding-agent/src/discovery/github.ts b/packages/coding-agent/src/discovery/github.ts index 5b1fc424f..8122f89d6 100644 --- a/packages/coding-agent/src/discovery/github.ts +++ b/packages/coding-agent/src/discovery/github.ts @@ -13,9 +13,9 @@ */ import { basename, dirname, sep } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type Instruction, instructionCapability } from "@oh-my-pi/pi-coding-agent/capability/instruction"; import type { LoadContext, LoadResult, SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types"; import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; diff --git a/packages/coding-agent/src/discovery/index.ts b/packages/coding-agent/src/discovery/index.ts index cf12b0e50..305342b16 100644 --- a/packages/coding-agent/src/discovery/index.ts +++ b/packages/coding-agent/src/discovery/index.ts @@ -17,28 +17,24 @@ import "../capability/rule"; import "../capability/settings"; import "../capability/skill"; import "../capability/slash-command"; -import "../capability/system-prompt"; import "../capability/ssh"; +import "../capability/system-prompt"; import "../capability/tool"; // Import providers (each registers itself on import) +import "./agents-md"; import "./builtin"; import "./claude"; -import "./codex"; -import "./gemini"; -import "./cursor"; -import "./windsurf"; import "./cline"; +import "./codex"; +import "./cursor"; +import "./gemini"; import "./github"; -import "./vscode"; -import "./agents-md"; import "./mcp-json"; import "./ssh"; +import "./vscode"; +import "./windsurf"; -export type { ContextFile } from "@oh-my-pi/pi-coding-agent/capability/context-file"; -export type { Extension, ExtensionManifest } from "@oh-my-pi/pi-coding-agent/capability/extension"; -export type { ExtensionModule } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; -export type { Hook } from "@oh-my-pi/pi-coding-agent/capability/hook"; // Re-export the main API from capability registry export { cacheStats, @@ -62,7 +58,11 @@ export { // Cache management reset, setDisabledProviders, -} from "@oh-my-pi/pi-coding-agent/capability/index"; +} from "@oh-my-pi/pi-coding-agent/capability"; +export type { ContextFile } from "@oh-my-pi/pi-coding-agent/capability/context-file"; +export type { Extension, ExtensionManifest } from "@oh-my-pi/pi-coding-agent/capability/extension"; +export type { ExtensionModule } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; +export type { Hook } from "@oh-my-pi/pi-coding-agent/capability/hook"; export type { Instruction } from "@oh-my-pi/pi-coding-agent/capability/instruction"; // Re-export capability item types export type { MCPServer } from "@oh-my-pi/pi-coding-agent/capability/mcp"; diff --git a/packages/coding-agent/src/discovery/mcp-json.ts b/packages/coding-agent/src/discovery/mcp-json.ts index b3912dd46..66846e656 100644 --- a/packages/coding-agent/src/discovery/mcp-json.ts +++ b/packages/coding-agent/src/discovery/mcp-json.ts @@ -8,8 +8,8 @@ */ import { join } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import type { LoadContext, LoadResult, SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types"; import { createSourceMeta, expandEnvVarsDeep, parseJSON } from "./helpers"; diff --git a/packages/coding-agent/src/discovery/ssh.ts b/packages/coding-agent/src/discovery/ssh.ts index ec72a07bc..4aac07430 100644 --- a/packages/coding-agent/src/discovery/ssh.ts +++ b/packages/coding-agent/src/discovery/ssh.ts @@ -6,8 +6,8 @@ */ import { join } from "node:path"; +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type SSHHost, sshCapability } from "@oh-my-pi/pi-coding-agent/capability/ssh"; import type { LoadContext, LoadResult, SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types"; import { createSourceMeta, expandEnvVarsDeep, parseJSON } from "./helpers"; diff --git a/packages/coding-agent/src/discovery/vscode.ts b/packages/coding-agent/src/discovery/vscode.ts index 6632ffe83..0e43a926f 100644 --- a/packages/coding-agent/src/discovery/vscode.ts +++ b/packages/coding-agent/src/discovery/vscode.ts @@ -5,8 +5,8 @@ * Supports MCP server discovery from `mcp.json` with nested `mcp.servers` structure. */ +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types"; import { createSourceMeta, expandEnvVarsDeep, getProjectPath, parseJSON } from "./helpers"; diff --git a/packages/coding-agent/src/discovery/windsurf.ts b/packages/coding-agent/src/discovery/windsurf.ts index 17203c40e..067714201 100644 --- a/packages/coding-agent/src/discovery/windsurf.ts +++ b/packages/coding-agent/src/discovery/windsurf.ts @@ -11,8 +11,8 @@ * - Legacy .windsurfrules file */ +import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability"; import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs"; -import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index"; import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; import { type Rule, ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule"; import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types"; diff --git a/packages/coding-agent/src/extensibility/custom-commands/loader.ts b/packages/coding-agent/src/extensibility/custom-commands/loader.ts index 8d2658789..4eea5148f 100644 --- a/packages/coding-agent/src/extensibility/custom-commands/loader.ts +++ b/packages/coding-agent/src/extensibility/custom-commands/loader.ts @@ -7,9 +7,9 @@ import { type Dirent, existsSync, readdirSync } from "node:fs"; import * as path from "node:path"; +import * as piCodingAgent from "@oh-my-pi/pi-coding-agent"; import { getAgentDir, getConfigDirs } from "@oh-my-pi/pi-coding-agent/config"; import { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec"; -import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; import { logger } from "@oh-my-pi/pi-utils"; import * as typebox from "@sinclair/typebox"; import { ReviewCommand } from "./bundled/review"; diff --git a/packages/coding-agent/src/extensibility/custom-commands/types.ts b/packages/coding-agent/src/extensibility/custom-commands/types.ts index 913d6a30f..4e180e767 100644 --- a/packages/coding-agent/src/extensibility/custom-commands/types.ts +++ b/packages/coding-agent/src/extensibility/custom-commands/types.ts @@ -23,7 +23,7 @@ export interface CustomCommandAPI { /** Injected @sinclair/typebox module */ typebox: typeof import("@sinclair/typebox"); /** Injected pi-coding-agent exports */ - pi: typeof import("../../index"); + pi: typeof import("../.."); } /** diff --git a/packages/coding-agent/src/extensibility/custom-tools/loader.ts b/packages/coding-agent/src/extensibility/custom-tools/loader.ts index 480fc36bb..df4d1745a 100644 --- a/packages/coding-agent/src/extensibility/custom-tools/loader.ts +++ b/packages/coding-agent/src/extensibility/custom-tools/loader.ts @@ -6,6 +6,7 @@ */ import * as path from "node:path"; +import * as piCodingAgent from "@oh-my-pi/pi-coding-agent"; import { toolCapability } from "@oh-my-pi/pi-coding-agent/capability/tool"; import { type CustomTool, loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; import { expandPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; @@ -13,7 +14,6 @@ import type { ExecOptions } from "@oh-my-pi/pi-coding-agent/exec/exec"; import { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec"; import type { HookUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/hooks/types"; import { getAllPluginToolPaths } from "@oh-my-pi/pi-coding-agent/extensibility/plugins/loader"; -import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { logger } from "@oh-my-pi/pi-utils"; import * as typebox from "@sinclair/typebox"; diff --git a/packages/coding-agent/src/extensibility/custom-tools/types.ts b/packages/coding-agent/src/extensibility/custom-tools/types.ts index 8712d3f87..d1c70b4e9 100644 --- a/packages/coding-agent/src/extensibility/custom-tools/types.ts +++ b/packages/coding-agent/src/extensibility/custom-tools/types.ts @@ -39,7 +39,7 @@ export interface CustomToolAPI { /** Injected @sinclair/typebox module */ typebox: typeof import("@sinclair/typebox"); /** Injected pi-coding-agent exports */ - pi: typeof import("../../index"); + pi: typeof import("../.."); } /** diff --git a/packages/coding-agent/src/extensibility/extensions/loader.ts b/packages/coding-agent/src/extensibility/extensions/loader.ts index 34bd8cae9..d91dc7894 100644 --- a/packages/coding-agent/src/extensibility/extensions/loader.ts +++ b/packages/coding-agent/src/extensibility/extensions/loader.ts @@ -6,12 +6,12 @@ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs"; import * as path from "node:path"; import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model, TextContent } from "@oh-my-pi/pi-ai"; +import * as piCodingAgent from "@oh-my-pi/pi-coding-agent"; import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; import { expandPath, getExtensionNameFromPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; import type { ExecOptions } from "@oh-my-pi/pi-coding-agent/exec/exec"; import { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec"; -import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; import type { CustomMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import { EventBus } from "@oh-my-pi/pi-coding-agent/utils/event-bus"; import type { KeyId } from "@oh-my-pi/pi-tui"; diff --git a/packages/coding-agent/src/extensibility/extensions/types.ts b/packages/coding-agent/src/extensibility/extensions/types.ts index eb4cc4a17..67e8f672c 100644 --- a/packages/coding-agent/src/extensibility/extensions/types.ts +++ b/packages/coding-agent/src/extensibility/extensions/types.ts @@ -10,11 +10,11 @@ import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai"; +import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent"; import type { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; import type { BashResult } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; import type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec"; -import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; import type { PythonResult } from "@oh-my-pi/pi-coding-agent/ipy/executor"; import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch"; diff --git a/packages/coding-agent/src/extensibility/hooks/loader.ts b/packages/coding-agent/src/extensibility/hooks/loader.ts index 1f87f5448..b812fcb4c 100644 --- a/packages/coding-agent/src/extensibility/hooks/loader.ts +++ b/packages/coding-agent/src/extensibility/hooks/loader.ts @@ -3,11 +3,11 @@ */ import * as path from "node:path"; +import * as piCodingAgent from "@oh-my-pi/pi-coding-agent"; import { hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook"; import type { Hook } from "@oh-my-pi/pi-coding-agent/discovery"; import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; import { expandPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; -import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; import type { HookMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import type { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { logger } from "@oh-my-pi/pi-utils"; diff --git a/packages/coding-agent/src/extensibility/hooks/types.ts b/packages/coding-agent/src/extensibility/hooks/types.ts index bd27d2041..d0ad87631 100644 --- a/packages/coding-agent/src/extensibility/hooks/types.ts +++ b/packages/coding-agent/src/extensibility/hooks/types.ts @@ -11,7 +11,7 @@ import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-regis import type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec"; import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch"; -import type { CompactionPreparation, CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction/index"; +import type { CompactionPreparation, CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction"; import type { HookMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import type { BranchSummaryEntry, @@ -26,7 +26,7 @@ import type { GrepToolDetails, LsToolDetails, ReadToolDetails, -} from "@oh-my-pi/pi-coding-agent/tools/index"; +} from "@oh-my-pi/pi-coding-agent/tools"; import type { Component, TUI } from "@oh-my-pi/pi-tui"; // Re-export for backward compatibility @@ -752,7 +752,7 @@ export interface HookAPI { /** Injected @sinclair/typebox module */ typebox: typeof import("@sinclair/typebox"); /** Injected pi-coding-agent exports */ - pi: typeof import("../../index"); + pi: typeof import("../.."); } /** diff --git a/packages/coding-agent/src/index.ts b/packages/coding-agent/src/index.ts index 785082349..16c72dcba 100644 --- a/packages/coding-agent/src/index.ts +++ b/packages/coding-agent/src/index.ts @@ -3,7 +3,7 @@ // TypeBox helper for string enums (convenience for custom tools) // Re-export from pi-ai which uses the correct enum-based schema format export { StringEnum } from "@oh-my-pi/pi-ai"; -export type { FileDiagnosticsResult } from "@oh-my-pi/pi-coding-agent/lsp/index"; +export type { FileDiagnosticsResult } from "@oh-my-pi/pi-coding-agent/lsp"; // UI components for extensions export { ArminComponent, @@ -37,7 +37,7 @@ export { UserMessageComponent, UserMessageSelectorComponent, type VisualTruncateResult, -} from "@oh-my-pi/pi-coding-agent/modes/components/index"; +} from "@oh-my-pi/pi-coding-agent/modes/components"; // Theme utilities for custom tools export { getLanguageFromPath, @@ -88,9 +88,9 @@ export type { ExecResult, LoadedCustomTool, RenderResultOptions, -} from "./extensibility/custom-tools/index"; +} from "./extensibility/custom-tools"; // Custom tools -export { CustomToolLoader, discoverAndLoadCustomTools, loadCustomTools } from "./extensibility/custom-tools/index"; +export { CustomToolLoader, discoverAndLoadCustomTools, loadCustomTools } from "./extensibility/custom-tools"; export type { AppAction, Extension, @@ -122,7 +122,7 @@ export type { UserBashEventResult, UserPythonEvent, UserPythonEventResult, -} from "./extensibility/extensions/index"; +} from "./extensibility/extensions"; // Extension types and utilities export { discoverAndLoadExtensions, @@ -135,9 +135,9 @@ export { isLsToolResult, isReadToolResult, isWriteToolResult, -} from "./extensibility/extensions/index"; +} from "./extensibility/extensions"; // Hook system types (legacy re-export) -export type * from "./extensibility/hooks/index"; +export type * from "./extensibility/hooks"; // Skills export { type LoadSkillsFromDirOptions, @@ -162,7 +162,7 @@ export { type RpcEventListener, runPrintMode, runRpcMode, -} from "./modes/index"; +} from "./modes"; // SDK for programmatic usage export { // Factory @@ -228,7 +228,7 @@ export { prepareBranchEntries, serializeConversation, shouldCompact, -} from "./session/compaction/index"; +} from "./session/compaction"; export { convertToLlm } from "./session/messages"; export { type BranchSummaryEntry, @@ -275,5 +275,5 @@ export { truncateLine, truncateTail, type WriteToolDetails, -} from "./tools/index"; +} from "./tools"; export { getShellConfig } from "./utils/shell"; diff --git a/packages/coding-agent/src/lsp/index.ts b/packages/coding-agent/src/lsp/index.ts index ea732bed9..9b15dd230 100644 --- a/packages/coding-agent/src/lsp/index.ts +++ b/packages/coding-agent/src/lsp/index.ts @@ -5,7 +5,7 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallb import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import lspDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/lsp.md" with { type: "text" }; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { resolveToCwd } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; import { throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; import { logger, once, untilAborted } from "@oh-my-pi/pi-utils"; diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts index 1c6e7a7c7..1ea3d06ad 100644 --- a/packages/coding-agent/src/main.ts +++ b/packages/coding-agent/src/main.ts @@ -28,10 +28,10 @@ import type { ModelRegistry } from "./config/model-registry"; import { parseModelPattern, parseModelString, resolveModelScope, type ScopedModel } from "./config/model-resolver"; import { SettingsManager } from "./config/settings-manager"; import { initializeWithSettings } from "./discovery"; -import { exportFromFile } from "./export/html/index"; +import { exportFromFile } from "./export/html"; import type { ExtensionUIContext } from "./extensibility/extensions/types"; import { runMigrations, showDeprecationWarnings } from "./migrations"; -import { InteractiveMode, runPrintMode, runRpcMode } from "./modes/index"; +import { InteractiveMode, runPrintMode, runRpcMode } from "./modes"; import { type CreateAgentSessionOptions, createAgentSession, discoverAuthStorage, discoverModels } from "./sdk"; import type { AgentSession } from "./session/agent-session"; import { type SessionInfo, SessionManager } from "./session/session-manager"; @@ -87,7 +87,7 @@ async function runInteractiveMode( initialMessages: string[], setExtensionUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined, - mcpManager: import("./mcp/index").MCPManager | undefined, + mcpManager: import("./mcp").MCPManager | undefined, initialMessage?: string, initialImages?: ImageContent[], ): Promise { diff --git a/packages/coding-agent/src/modes/components/tree-selector.ts b/packages/coding-agent/src/modes/components/tree-selector.ts index 444a5c9ee..97a105ab3 100644 --- a/packages/coding-agent/src/modes/components/tree-selector.ts +++ b/packages/coding-agent/src/modes/components/tree-selector.ts @@ -821,7 +821,7 @@ export class TreeSelectorComponent extends Container { new TruncatedText( theme.fg( "muted", - " Up/Down: move. Left/Right: page. Shift+L: label. Ctrl+O/Shift+Ctrl+O: filter. Alt+D/T/U/L/A: filter. Type to search", + "Up/Down: move. Left/Right: page. Shift+L: label. Ctrl+O/Shift+Ctrl+O: filter. Alt+D/T/U/L/A: filter. Type to search", ), 0, 0, diff --git a/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts b/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts index f8cfc3973..f0f43038b 100644 --- a/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts +++ b/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts @@ -5,7 +5,7 @@ import type { ExtensionContextActions, ExtensionError, ExtensionUIContext, -} from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +} from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; import { HookEditorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/hook-editor"; import { HookInputComponent } from "@oh-my-pi/pi-coding-agent/modes/components/hook-input"; import { HookSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/hook-selector"; diff --git a/packages/coding-agent/src/modes/controllers/selector-controller.ts b/packages/coding-agent/src/modes/controllers/selector-controller.ts index a6e025db4..2fc4d8717 100644 --- a/packages/coding-agent/src/modes/controllers/selector-controller.ts +++ b/packages/coding-agent/src/modes/controllers/selector-controller.ts @@ -21,7 +21,7 @@ import { } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; -import { setPreferredImageProvider, setPreferredWebSearchProvider } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { setPreferredImageProvider, setPreferredWebSearchProvider } from "@oh-my-pi/pi-coding-agent/tools"; import type { Component } from "@oh-my-pi/pi-tui"; import { Input, Loader, Spacer, Text } from "@oh-my-pi/pi-tui"; diff --git a/packages/coding-agent/src/modes/interactive-mode.ts b/packages/coding-agent/src/modes/interactive-mode.ts index 1b55d0896..c8c06d1ca 100644 --- a/packages/coding-agent/src/modes/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive-mode.ts @@ -8,7 +8,7 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai"; import { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; -import type { ExtensionUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +import type { ExtensionUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; import type { CompactOptions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; import { loadSlashCommands } from "@oh-my-pi/pi-coding-agent/extensibility/slash-commands"; import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; @@ -125,7 +125,7 @@ export class InteractiveMode implements InteractiveModeContext { private readonly changelogMarkdown: string | undefined; public readonly lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined = undefined; - public mcpManager?: import("@oh-my-pi/pi-coding-agent/mcp/index").MCPManager; + public mcpManager?: import("@oh-my-pi/pi-coding-agent/mcp").MCPManager; private readonly toolUiContextSetter: (uiContext: ExtensionUIContext, hasUI: boolean) => void; private readonly commandController: CommandController; @@ -141,7 +141,7 @@ export class InteractiveMode implements InteractiveModeContext { changelogMarkdown: string | undefined = undefined, setToolUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void = () => {}, lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined = undefined, - mcpManager?: import("@oh-my-pi/pi-coding-agent/mcp/index").MCPManager, + mcpManager?: import("@oh-my-pi/pi-coding-agent/mcp").MCPManager, ) { this.session = session; this.sessionManager = session.sessionManager; diff --git a/packages/coding-agent/src/modes/rpc/rpc-client.ts b/packages/coding-agent/src/modes/rpc/rpc-client.ts index e118f55cb..bb3e22d2f 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-client.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-client.ts @@ -8,7 +8,7 @@ import type { AgentEvent, AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent import type { ImageContent } from "@oh-my-pi/pi-ai"; import type { BashResult } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; import type { SessionStats } from "@oh-my-pi/pi-coding-agent/session/agent-session"; -import type { CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction/index"; +import type { CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction"; import { createSanitizerStream, createSplitterStream, createTextDecoderStream, ptree } from "@oh-my-pi/pi-utils"; import type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc-types"; diff --git a/packages/coding-agent/src/modes/rpc/rpc-mode.ts b/packages/coding-agent/src/modes/rpc/rpc-mode.ts index fc921f010..b78882a8c 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-mode.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-mode.ts @@ -11,10 +11,7 @@ * - Extension UI: Extension UI requests are emitted, client responds with extension_ui_response */ -import type { - ExtensionUIContext, - ExtensionUIDialogOptions, -} from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +import type { ExtensionUIContext, ExtensionUIDialogOptions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { readLines } from "@oh-my-pi/pi-utils"; diff --git a/packages/coding-agent/src/modes/rpc/rpc-types.ts b/packages/coding-agent/src/modes/rpc/rpc-types.ts index 7a84df275..dadbee42a 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-types.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-types.ts @@ -9,7 +9,7 @@ import type { AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model } from "@oh-my-pi/pi-ai"; import type { BashResult } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; import type { SessionStats } from "@oh-my-pi/pi-coding-agent/session/agent-session"; -import type { CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction/index"; +import type { CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction"; // ============================================================================ // RPC Commands (stdin) diff --git a/packages/coding-agent/src/modes/types.ts b/packages/coding-agent/src/modes/types.ts index a6e2c4856..7a58ffb17 100644 --- a/packages/coding-agent/src/modes/types.ts +++ b/packages/coding-agent/src/modes/types.ts @@ -2,9 +2,9 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai"; import type { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; -import type { ExtensionUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +import type { ExtensionUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; import type { CompactOptions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; -import type { MCPManager } from "@oh-my-pi/pi-coding-agent/mcp/index"; +import type { MCPManager } from "@oh-my-pi/pi-coding-agent/mcp"; import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import type { HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; import type { SessionContext, SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; diff --git a/packages/coding-agent/src/patch/index.ts b/packages/coding-agent/src/patch/index.ts index 273a7a4f1..f23712f33 100644 --- a/packages/coding-agent/src/patch/index.ts +++ b/packages/coding-agent/src/patch/index.ts @@ -18,10 +18,10 @@ import { flushLspWritethroughBatch, type WritethroughCallback, writethroughNoop, -} from "@oh-my-pi/pi-coding-agent/lsp/index"; +} from "@oh-my-pi/pi-coding-agent/lsp"; import patchDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/patch.md" with { type: "text" }; import replaceDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/replace.md" with { type: "text" }; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { outputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; import { resolveToCwd } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; import { Type } from "@sinclair/typebox"; @@ -48,13 +48,7 @@ export { computeEditDiff, computePatchDiff, generateDiffString, generateUnifiedD export { DEFAULT_FUZZY_THRESHOLD, findContextLine, findMatch as findEditMatch, findMatch, seekSequence } from "./fuzzy"; // Normalization -export { - adjustIndentation, - detectLineEnding, - normalizeToLF, - restoreLineEndings, - stripBom, -} from "./normalize"; +export { adjustIndentation, detectLineEnding, normalizeToLF, restoreLineEndings, stripBom } from "./normalize"; // Parsing export { normalizeCreateContent, normalizeDiff, parseHunks as parseDiffHunks } from "./parser"; diff --git a/packages/coding-agent/src/patch/shared.ts b/packages/coding-agent/src/patch/shared.ts index 30cb02196..c841fb76d 100644 --- a/packages/coding-agent/src/patch/shared.ts +++ b/packages/coding-agent/src/patch/shared.ts @@ -4,7 +4,7 @@ import type { ToolCallContext } from "@oh-my-pi/pi-agent-core"; import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; -import type { FileDiagnosticsResult } from "@oh-my-pi/pi-coding-agent/lsp/index"; +import type { FileDiagnosticsResult } from "@oh-my-pi/pi-coding-agent/lsp"; import { renderDiff as renderDiffColored } from "@oh-my-pi/pi-coding-agent/modes/components/diff"; import { getLanguageFromPath, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; diff --git a/packages/coding-agent/src/sdk.ts b/packages/coding-agent/src/sdk.ts index 12c415c0f..c73366cd6 100644 --- a/packages/coding-agent/src/sdk.ts +++ b/packages/coding-agent/src/sdk.ts @@ -32,7 +32,7 @@ import { join } from "node:path"; import { Agent, type AgentEvent, type AgentMessage, type AgentTool, type ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { type Message, type Model, supportsXhigh } from "@oh-my-pi/pi-ai"; // Import discovery to register all providers on startup -import { loadCapability } from "@oh-my-pi/pi-coding-agent/capability/index"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/capability"; import { type Rule, ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule"; import { getAgentDir, getConfigDirPaths } from "@oh-my-pi/pi-coding-agent/config"; import { CursorExecHandlers } from "@oh-my-pi/pi-coding-agent/cursor"; @@ -53,7 +53,7 @@ import "./discovery"; import { type CustomCommandsLoadResult, loadCustomCommands as loadCustomCommandsInternal, -} from "./extensibility/custom-commands/index"; +} from "./extensibility/custom-commands"; import type { CustomTool, CustomToolContext, CustomToolSessionEvent } from "./extensibility/custom-tools/types"; import { discoverAndLoadExtensions, @@ -67,7 +67,7 @@ import { loadExtensions, type ToolDefinition, wrapRegisteredTools, -} from "./extensibility/extensions/index"; +} from "./extensibility/extensions"; import { loadSkills as loadSkillsInternal, type Skill, type SkillWarning } from "./extensibility/skills"; import { type FileSlashCommand, loadSlashCommands as loadSlashCommandsInternal } from "./extensibility/slash-commands"; import { @@ -77,7 +77,7 @@ import { RuleProtocolHandler, SkillProtocolHandler, } from "./internal-urls"; -import { discoverAndLoadMCPTools, type MCPManager, type MCPToolsLoadResult } from "./mcp/index"; +import { discoverAndLoadMCPTools, type MCPManager, type MCPToolsLoadResult } from "./mcp"; import { AgentSession } from "./session/agent-session"; import { AuthStorage } from "./session/auth-storage"; import { convertToLlm } from "./session/messages"; @@ -88,8 +88,6 @@ import { loadProjectContextFiles as loadContextFilesInternal, } from "./system-prompt"; import { AgentOutputManager } from "./task/output-manager"; -import { ToolContextStore } from "./tools/context"; -import { getGeminiImageTools } from "./tools/gemini-image"; import { BashTool, BUILTIN_TOOLS, @@ -108,7 +106,9 @@ import { type ToolSession, WriteTool, warmupLspServers, -} from "./tools/index"; +} from "./tools"; +import { ToolContextStore } from "./tools/context"; +import { getGeminiImageTools } from "./tools/gemini-image"; import { wrapToolsWithMetaNotice } from "./tools/output-meta"; import { EventBus } from "./utils/event-bus"; import { time } from "./utils/timings"; @@ -218,11 +218,11 @@ export type { ExtensionContext, ExtensionFactory, ToolDefinition, -} from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +} from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; export type { Skill } from "@oh-my-pi/pi-coding-agent/extensibility/skills"; export type { FileSlashCommand } from "@oh-my-pi/pi-coding-agent/extensibility/slash-commands"; -export type { MCPManager, MCPServerConfig, MCPServerConnection, MCPToolsLoadResult } from "./mcp/index"; -export type { Tool } from "./tools/index"; +export type { MCPManager, MCPServerConfig, MCPServerConnection, MCPToolsLoadResult } from "./mcp"; +export type { Tool } from "./tools"; export { // Individual tool classes (for custom usage) diff --git a/packages/coding-agent/src/session/agent-session.ts b/packages/coding-agent/src/session/agent-session.ts index b2177dc53..dc58617d8 100644 --- a/packages/coding-agent/src/session/agent-session.ts +++ b/packages/coding-agent/src/session/agent-session.ts @@ -38,9 +38,9 @@ import { } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; import type { SettingsManager, SkillsSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; import { type BashResult, executeBash as executeBashCommand } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; -import { exportSessionToHtml } from "@oh-my-pi/pi-coding-agent/export/html/index"; +import { exportSessionToHtml } from "@oh-my-pi/pi-coding-agent/export/html"; import type { TtsrManager } from "@oh-my-pi/pi-coding-agent/export/ttsr"; -import type { LoadedCustomCommand } from "@oh-my-pi/pi-coding-agent/extensibility/custom-commands/index"; +import type { LoadedCustomCommand } from "@oh-my-pi/pi-coding-agent/extensibility/custom-commands"; import type { ExtensionCommandContext, ExtensionRunner, @@ -78,7 +78,7 @@ import { generateBranchSummary, prepareCompaction, shouldCompact, -} from "./compaction/index"; +} from "./compaction"; import { type BashExecutionMessage, type BranchSummaryMessage, diff --git a/packages/coding-agent/src/system-prompt.ts b/packages/coding-agent/src/system-prompt.ts index f0eab6605..e6af7655b 100644 --- a/packages/coding-agent/src/system-prompt.ts +++ b/packages/coding-agent/src/system-prompt.ts @@ -13,7 +13,7 @@ import { type ContextFile, loadCapability, type SystemPrompt as SystemPromptFile, -} from "@oh-my-pi/pi-coding-agent/discovery/index"; +} from "@oh-my-pi/pi-coding-agent/discovery"; import { loadSkills, type Skill } from "@oh-my-pi/pi-coding-agent/extensibility/skills"; import customSystemPromptTemplate from "@oh-my-pi/pi-coding-agent/prompts/system/custom-system-prompt.md" with { type: "text", @@ -21,7 +21,7 @@ import customSystemPromptTemplate from "@oh-my-pi/pi-coding-agent/prompts/system import systemPromptTemplate from "@oh-my-pi/pi-coding-agent/prompts/system/system-prompt.md" with { type: "text" }; import { $ } from "bun"; import chalk from "chalk"; -import type { ToolName } from "./tools/index"; +import type { ToolName } from "./tools"; interface GitContext { isRepo: boolean; diff --git a/packages/coding-agent/src/task/executor.ts b/packages/coding-agent/src/task/executor.ts index 0cad7f7ff..a20f8c7d0 100644 --- a/packages/coding-agent/src/task/executor.ts +++ b/packages/coding-agent/src/task/executor.ts @@ -9,7 +9,7 @@ import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; import { formatModelString, parseModelPattern } from "@oh-my-pi/pi-coding-agent/config/model-resolver"; import { checkPythonKernelAvailability } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; -import { LspTool } from "@oh-my-pi/pi-coding-agent/lsp/index"; +import { LspTool } from "@oh-my-pi/pi-coding-agent/lsp"; import type { LspParams } from "@oh-my-pi/pi-coding-agent/lsp/types"; import { callTool } from "@oh-my-pi/pi-coding-agent/mcp/client"; import type { MCPManager } from "@oh-my-pi/pi-coding-agent/mcp/manager"; diff --git a/packages/coding-agent/src/tools/ask.ts b/packages/coding-agent/src/tools/ask.ts index 5fe8816ac..b1c27d5e0 100644 --- a/packages/coding-agent/src/tools/ask.ts +++ b/packages/coding-agent/src/tools/ask.ts @@ -24,7 +24,7 @@ import { renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { ToolUIKit } from "./render-utils"; // ============================================================================= diff --git a/packages/coding-agent/src/tools/bash.ts b/packages/coding-agent/src/tools/bash.ts index 0b6e58519..4f5038644 100644 --- a/packages/coding-agent/src/tools/bash.ts +++ b/packages/coding-agent/src/tools/bash.ts @@ -12,9 +12,8 @@ import { renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/t import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; - +import type { ToolSession } from "."; import { checkBashInterception, checkSimpleLsInterception } from "./bash-interceptor"; -import type { ToolSession } from "./index"; import { allocateOutputArtifact, createTailBuffer } from "./output-utils"; import { resolveToCwd } from "./path-utils"; import { formatBytes, wrapBrackets } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/calculator.ts b/packages/coding-agent/src/tools/calculator.ts index 99adfadff..96cc9d7bf 100644 --- a/packages/coding-agent/src/tools/calculator.ts +++ b/packages/coding-agent/src/tools/calculator.ts @@ -8,7 +8,7 @@ import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { formatCount, formatEmptyMessage, diff --git a/packages/coding-agent/src/tools/complete.ts b/packages/coding-agent/src/tools/complete.ts index 257f8e7b3..6720c37b7 100644 --- a/packages/coding-agent/src/tools/complete.ts +++ b/packages/coding-agent/src/tools/complete.ts @@ -10,7 +10,7 @@ import { subprocessToolRegistry } from "@oh-my-pi/pi-coding-agent/task/subproces import type { Static, TObject } from "@sinclair/typebox"; import { Type } from "@sinclair/typebox"; import Ajv, { type ErrorObject, type ValidateFunction } from "ajv"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { jtdToJsonSchema } from "./jtd-to-json-schema"; export interface CompleteDetails { diff --git a/packages/coding-agent/src/tools/fetch.ts b/packages/coding-agent/src/tools/fetch.ts index 7d7a82ea3..3cc372680 100644 --- a/packages/coding-agent/src/tools/fetch.ts +++ b/packages/coding-agent/src/tools/fetch.ts @@ -9,7 +9,7 @@ import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; import { ToolAbortError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; import { renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager"; -import { specialHandlers } from "@oh-my-pi/pi-coding-agent/web/scrapers/index"; +import { specialHandlers } from "@oh-my-pi/pi-coding-agent/web/scrapers"; import type { RenderResult } from "@oh-my-pi/pi-coding-agent/web/scrapers/types"; import { finalizeOutput, loadPage, MAX_OUTPUT_CHARS } from "@oh-my-pi/pi-coding-agent/web/scrapers/types"; import { convertWithMarkitdown, fetchBinary } from "@oh-my-pi/pi-coding-agent/web/scrapers/utils"; @@ -19,7 +19,7 @@ import { ptree } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; import { nanoid } from "nanoid"; import { parse as parseHtml } from "node-html-parser"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { applyListLimit } from "./list-limit"; import { formatExpandHint } from "./render-utils"; import { toolResult } from "./tool-result"; diff --git a/packages/coding-agent/src/tools/find.ts b/packages/coding-agent/src/tools/find.ts index 1e00cc32c..98e6cee91 100644 --- a/packages/coding-agent/src/tools/find.ts +++ b/packages/coding-agent/src/tools/find.ts @@ -15,7 +15,7 @@ import { ptree, untilAborted } from "@oh-my-pi/pi-utils"; import type { Static } from "@sinclair/typebox"; import { Type } from "@sinclair/typebox"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { applyListLimit } from "./list-limit"; import { resolveToCwd } from "./path-utils"; import { formatCount, formatEmptyMessage, formatErrorMessage, PREVIEW_LIMITS } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/grep.ts b/packages/coding-agent/src/tools/grep.ts index af692b3bc..b55b6bc47 100644 --- a/packages/coding-agent/src/tools/grep.ts +++ b/packages/coding-agent/src/tools/grep.ts @@ -15,7 +15,7 @@ import { Text } from "@oh-my-pi/pi-tui"; import { ptree, readLines } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; import { $ } from "bun"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { applyListLimit } from "./list-limit"; import { resolveToCwd } from "./path-utils"; import { formatCount, formatEmptyMessage, formatErrorMessage, PREVIEW_LIMITS } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/index.ts b/packages/coding-agent/src/tools/index.ts index 53c540f80..0089c19ed 100644 --- a/packages/coding-agent/src/tools/index.ts +++ b/packages/coding-agent/src/tools/index.ts @@ -1,5 +1,5 @@ // Exa MCP tools (22 tools) -export { exaTools } from "@oh-my-pi/pi-coding-agent/exa/index"; +export { exaTools } from "@oh-my-pi/pi-coding-agent/exa"; export type { ExaRenderDetails, ExaSearchResponse, ExaSearchResult } from "@oh-my-pi/pi-coding-agent/exa/types"; export { type FileDiagnosticsResult, @@ -11,9 +11,9 @@ export { type LspWarmupOptions, type LspWarmupResult, warmupLspServers, -} from "@oh-my-pi/pi-coding-agent/lsp/index"; +} from "@oh-my-pi/pi-coding-agent/lsp"; export { EditTool, type EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch"; -export { BUNDLED_AGENTS, TaskTool } from "@oh-my-pi/pi-coding-agent/task/index"; +export { BUNDLED_AGENTS, TaskTool } from "@oh-my-pi/pi-coding-agent/task"; export { companyWebSearchTools, exaWebSearchTools, @@ -31,7 +31,7 @@ export { webSearchCustomTool, webSearchDeepTool, webSearchLinkedinTool, -} from "@oh-my-pi/pi-coding-agent/web/search/index"; +} from "@oh-my-pi/pi-coding-agent/web/search"; export { AskTool, type AskToolDetails } from "./ask"; export { BashTool, type BashToolDetails, type BashToolOptions } from "./bash"; export { CalculatorTool, type CalculatorToolDetails } from "./calculator"; @@ -64,13 +64,13 @@ import type { BashInterceptorRule } from "@oh-my-pi/pi-coding-agent/config/setti import type { InternalUrlRouter } from "@oh-my-pi/pi-coding-agent/internal-urls"; import { getPreludeDocs, warmPythonEnvironment } from "@oh-my-pi/pi-coding-agent/ipy/executor"; import { checkPythonKernelAvailability } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; -import { LspTool } from "@oh-my-pi/pi-coding-agent/lsp/index"; +import { LspTool } from "@oh-my-pi/pi-coding-agent/lsp"; import { EditTool } from "@oh-my-pi/pi-coding-agent/patch"; import type { ArtifactManager } from "@oh-my-pi/pi-coding-agent/session/artifacts"; -import { TaskTool } from "@oh-my-pi/pi-coding-agent/task/index"; +import { TaskTool } from "@oh-my-pi/pi-coding-agent/task"; import type { AgentOutputManager } from "@oh-my-pi/pi-coding-agent/task/output-manager"; import type { EventBus } from "@oh-my-pi/pi-coding-agent/utils/event-bus"; -import { WebSearchTool } from "@oh-my-pi/pi-coding-agent/web/search/index"; +import { WebSearchTool } from "@oh-my-pi/pi-coding-agent/web/search"; import { logger } from "@oh-my-pi/pi-utils"; import { AskTool } from "./ask"; import { BashTool } from "./bash"; diff --git a/packages/coding-agent/src/tools/ls.ts b/packages/coding-agent/src/tools/ls.ts index bfa1b2166..7047a2208 100644 --- a/packages/coding-agent/src/tools/ls.ts +++ b/packages/coding-agent/src/tools/ls.ts @@ -8,7 +8,7 @@ import { renderFileList, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui" import { type Component, Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { applyListLimit } from "./list-limit"; import { resolveToCwd } from "./path-utils"; import { diff --git a/packages/coding-agent/src/tools/output-utils.ts b/packages/coding-agent/src/tools/output-utils.ts index fac106db8..3cc6464a0 100644 --- a/packages/coding-agent/src/tools/output-utils.ts +++ b/packages/coding-agent/src/tools/output-utils.ts @@ -1,5 +1,5 @@ import { ArtifactManager } from "@oh-my-pi/pi-coding-agent/session/artifacts"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; export interface TailBuffer { append(chunk: string): void; diff --git a/packages/coding-agent/src/tools/python.ts b/packages/coding-agent/src/tools/python.ts index e79c4495f..082a124a2 100644 --- a/packages/coding-agent/src/tools/python.ts +++ b/packages/coding-agent/src/tools/python.ts @@ -15,7 +15,7 @@ import { getTreeBranch, getTreeContinuePrefix, renderCodeCell } from "@oh-my-pi/ import type { Component } from "@oh-my-pi/pi-tui"; import { Text, truncateToWidth } from "@oh-my-pi/pi-tui"; import { type Static, Type } from "@sinclair/typebox"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { allocateOutputArtifact, createTailBuffer } from "./output-utils"; import { resolveToCwd } from "./path-utils"; import { shortenPath, ToolUIKit, truncate } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/ssh.ts b/packages/coding-agent/src/tools/ssh.ts index 28fe8b231..82c5142f6 100644 --- a/packages/coding-agent/src/tools/ssh.ts +++ b/packages/coding-agent/src/tools/ssh.ts @@ -2,7 +2,7 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallb import type { SSHHost } from "@oh-my-pi/pi-coding-agent/capability/ssh"; import { sshCapability } from "@oh-my-pi/pi-coding-agent/capability/ssh"; import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; -import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery/index"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import sshDescriptionBase from "@oh-my-pi/pi-coding-agent/prompts/tools/ssh.md" with { type: "text" }; @@ -15,7 +15,7 @@ import { renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/t import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import type { ToolSession } from "./index"; +import type { ToolSession } from "."; import { allocateOutputArtifact, createTailBuffer } from "./output-utils"; import { formatBytes, wrapBrackets } from "./render-utils"; import { toolResult } from "./tool-result"; diff --git a/packages/coding-agent/src/tools/write.ts b/packages/coding-agent/src/tools/write.ts index 72a16e7e4..318165c26 100644 --- a/packages/coding-agent/src/tools/write.ts +++ b/packages/coding-agent/src/tools/write.ts @@ -12,7 +12,7 @@ import { type FileDiagnosticsResult, type WritethroughCallback, writethroughNoop, -} from "@oh-my-pi/pi-coding-agent/lsp/index"; +} from "@oh-my-pi/pi-coding-agent/lsp"; import { getLanguageFromPath, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import writeDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/write.md" with { type: "text" }; import type { ToolSession } from "@oh-my-pi/pi-coding-agent/sdk"; diff --git a/packages/coding-agent/src/tui/output-block.ts b/packages/coding-agent/src/tui/output-block.ts index 82d541436..4b755a019 100644 --- a/packages/coding-agent/src/tui/output-block.ts +++ b/packages/coding-agent/src/tui/output-block.ts @@ -21,8 +21,15 @@ export function renderOutputBlock(options: OutputBlockOptions, theme: Theme): st const v = theme.boxSharp.vertical; const cap = h.repeat(3); const lineWidth = Math.max(0, width); - const borderColor = - state === "error" ? "error" : state === "success" ? "success" : state === "warning" ? "warning" : "dim"; + // Border colors: running/pending use accent, success uses dim (gray), error/warning keep their colors + const borderColor: "error" | "warning" | "accent" | "dim" = + state === "error" + ? "error" + : state === "warning" + ? "warning" + : state === "running" || state === "pending" + ? "accent" + : "dim"; const border = (text: string) => theme.fg(borderColor, text); const bgFn = state ? (text: string) => theme.bg(getStateBgColor(state), text) : undefined; diff --git a/packages/coding-agent/src/tui/utils.ts b/packages/coding-agent/src/tui/utils.ts index a297bc02a..12eabbd23 100644 --- a/packages/coding-agent/src/tui/utils.ts +++ b/packages/coding-agent/src/tui/utils.ts @@ -40,7 +40,7 @@ export function getStateIcon(icon: IconType, theme: Theme, spinnerFrame?: number if (icon === "error") return theme.styledSymbol("status.error", "error"); if (icon === "warning") return theme.styledSymbol("status.warning", "warning"); if (icon === "info") return theme.styledSymbol("status.info", "accent"); - if (icon === "pending") return theme.styledSymbol("status.pending", "muted"); + if (icon === "pending") return theme.styledSymbol("status.pending", "accent"); if (spinnerFrame !== undefined) { const frames = theme.spinnerFrames; return frames[spinnerFrame % frames.length]; diff --git a/packages/coding-agent/src/web/search/index.ts b/packages/coding-agent/src/web/search/index.ts index e91f8c239..fcfcfeda5 100644 --- a/packages/coding-agent/src/web/search/index.ts +++ b/packages/coding-agent/src/web/search/index.ts @@ -31,7 +31,7 @@ import type { import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import webSearchSystemPrompt from "@oh-my-pi/pi-coding-agent/prompts/system/web-search.md" with { type: "text" }; import webSearchDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/web-search.md" with { type: "text" }; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { formatAge } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import { Type } from "@sinclair/typebox"; import { findAnthropicAuth } from "./auth"; diff --git a/packages/coding-agent/test/agent-session-branching.test.ts b/packages/coding-agent/test/agent-session-branching.test.ts index e1016899d..dae45be57 100644 --- a/packages/coding-agent/test/agent-session-branching.test.ts +++ b/packages/coding-agent/test/agent-session-branching.test.ts @@ -18,7 +18,7 @@ import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manag import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { nanoid } from "nanoid"; import { API_KEY } from "./utilities"; diff --git a/packages/coding-agent/test/agent-session-compaction.test.ts b/packages/coding-agent/test/agent-session-compaction.test.ts index 994053d4c..d39034239 100644 --- a/packages/coding-agent/test/agent-session-compaction.test.ts +++ b/packages/coding-agent/test/agent-session-compaction.test.ts @@ -18,7 +18,7 @@ import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manag import { AgentSession, type AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { nanoid } from "nanoid"; import { API_KEY } from "./utilities"; diff --git a/packages/coding-agent/test/block-images.test.ts b/packages/coding-agent/test/block-images.test.ts index 6e96649dd..e68307e91 100644 --- a/packages/coding-agent/test/block-images.test.ts +++ b/packages/coding-agent/test/block-images.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { processFileArguments } from "@oh-my-pi/pi-coding-agent/cli/file-processor"; import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read"; // 1x1 red PNG image as base64 (smallest valid PNG) diff --git a/packages/coding-agent/test/compaction-hooks-example.test.ts b/packages/coding-agent/test/compaction-hooks-example.test.ts index f007db321..6c81b899e 100644 --- a/packages/coding-agent/test/compaction-hooks-example.test.ts +++ b/packages/coding-agent/test/compaction-hooks-example.test.ts @@ -7,7 +7,7 @@ import type { HookAPI, SessionBeforeCompactEvent, SessionCompactEvent, -} from "@oh-my-pi/pi-coding-agent/extensibility/hooks/index"; +} from "@oh-my-pi/pi-coding-agent/extensibility/hooks"; describe("Documentation example", () => { it("custom compaction example should type-check correctly", () => { diff --git a/packages/coding-agent/test/compaction-hooks.test.ts b/packages/coding-agent/test/compaction-hooks.test.ts index 6443032f2..5942aec80 100644 --- a/packages/coding-agent/test/compaction-hooks.test.ts +++ b/packages/coding-agent/test/compaction-hooks.test.ts @@ -16,12 +16,12 @@ import { type SessionBeforeCompactEvent, type SessionCompactEvent, type SessionEvent, -} from "@oh-my-pi/pi-coding-agent/extensibility/hooks/index"; +} from "@oh-my-pi/pi-coding-agent/extensibility/hooks"; import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { nanoid } from "nanoid"; const API_KEY = process.env.ANTHROPIC_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY; diff --git a/packages/coding-agent/test/compaction-thinking-model.test.ts b/packages/coding-agent/test/compaction-thinking-model.test.ts index 00cf6a6ed..b8da25b1d 100644 --- a/packages/coding-agent/test/compaction-thinking-model.test.ts +++ b/packages/coding-agent/test/compaction-thinking-model.test.ts @@ -19,7 +19,7 @@ import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manag import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { nanoid } from "nanoid"; import { API_KEY } from "./utilities"; diff --git a/packages/coding-agent/test/compaction.test.ts b/packages/coding-agent/test/compaction.test.ts index 05fe5804b..b93ce272e 100644 --- a/packages/coding-agent/test/compaction.test.ts +++ b/packages/coding-agent/test/compaction.test.ts @@ -13,7 +13,7 @@ import { getLastAssistantUsage, prepareCompaction, shouldCompact, -} from "@oh-my-pi/pi-coding-agent/session/compaction/index"; +} from "@oh-my-pi/pi-coding-agent/session/compaction"; import { buildSessionContext, type CompactionEntry, diff --git a/packages/coding-agent/test/python-tool-settings.test.ts b/packages/coding-agent/test/python-tool-settings.test.ts index 599abd187..bb1a5bbc9 100644 --- a/packages/coding-agent/test/python-tool-settings.test.ts +++ b/packages/coding-agent/test/python-tool-settings.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import * as pythonExecutor from "@oh-my-pi/pi-coding-agent/ipy/executor"; import * as pythonKernel from "@oh-my-pi/pi-coding-agent/ipy/kernel"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python"; function createSettings(overrides?: Partial): ToolSession["settings"] { diff --git a/packages/coding-agent/test/settings-manager.test.ts b/packages/coding-agent/test/settings-manager.test.ts index 075393029..9645aec3f 100644 --- a/packages/coding-agent/test/settings-manager.test.ts +++ b/packages/coding-agent/test/settings-manager.test.ts @@ -1,9 +1,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { existsSync, mkdirSync, rmSync } from "node:fs"; import { join } from "node:path"; -import { getAgentDbPath } from "@oh-my-pi/pi-coding-agent/config"; import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; -import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage"; +import { YAML } from "bun"; describe("SettingsManager", () => { let testDir: string; @@ -23,6 +22,21 @@ describe("SettingsManager", () => { mkdirSync(join(projectDir, ".pi"), { recursive: true }); }); + const getConfigPath = () => join(agentDir, "config.yml"); + + const writeSettings = async (settings: Record) => { + await Bun.write(getConfigPath(), YAML.stringify(settings, null, 2)); + }; + + const readSettings = async (): Promise> => { + const file = Bun.file(getConfigPath()); + if (!(await file.exists())) return {}; + const content = await file.text(); + const parsed = YAML.parse(content); + if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {}; + return parsed as Record; + }; + afterEach(() => { if (existsSync(testDir)) { rmSync(testDir, { recursive: true }); @@ -33,9 +47,8 @@ describe("SettingsManager", () => { // This ensures external edits (via AgentStorage directly) aren't lost when the app saves. describe("preserves externally added settings", () => { it("should preserve enabledModels when changing thinking level", async () => { - // Seed initial settings in DB - const storage = await AgentStorage.open(getAgentDbPath(agentDir)); - storage.saveSettings({ + // Seed initial settings in config.yml + await writeSettings({ theme: "dark", modelRoles: { default: "claude-sonnet" }, }); @@ -44,60 +57,58 @@ describe("SettingsManager", () => { const manager = await SettingsManager.create(projectDir, agentDir); // Simulate external edit (e.g., user modifying DB directly or another process) - storage.saveSettings({ + await writeSettings({ theme: "dark", modelRoles: { default: "claude-sonnet" }, enabledModels: ["claude-opus-4-5", "gpt-5.2-codex"], }); // Manager saves a change - should merge, not overwrite - manager.setDefaultThinkingLevel("high"); + await manager.setDefaultThinkingLevel("high"); - const savedSettings = storage.getSettings() ?? {}; + const savedSettings = await readSettings(); expect(savedSettings.enabledModels).toEqual(["claude-opus-4-5", "gpt-5.2-codex"]); expect(savedSettings.defaultThinkingLevel).toBe("high"); expect(savedSettings.theme).toBe("dark"); - expect(savedSettings.modelRoles?.default).toBe("claude-sonnet"); + expect((savedSettings.modelRoles as { default?: string } | undefined)?.default).toBe("claude-sonnet"); }); it("should preserve custom settings when changing theme", async () => { - const storage = await AgentStorage.open(getAgentDbPath(agentDir)); - storage.saveSettings({ + await writeSettings({ modelRoles: { default: "claude-sonnet" }, }); const manager = await SettingsManager.create(projectDir, agentDir); - storage.saveSettings({ + await writeSettings({ modelRoles: { default: "claude-sonnet" }, shellPath: "/bin/zsh", extensions: ["/path/to/extension.ts"], }); - manager.setTheme("light"); + await manager.setTheme("light"); - const savedSettings = storage.getSettings() ?? {}; + const savedSettings = await readSettings(); expect(savedSettings.shellPath).toBe("/bin/zsh"); expect(savedSettings.extensions).toEqual(["/path/to/extension.ts"]); expect(savedSettings.theme).toBe("light"); }); it("should let in-memory changes override file changes for same key", async () => { - const storage = await AgentStorage.open(getAgentDbPath(agentDir)); - storage.saveSettings({ + await writeSettings({ theme: "dark", }); const manager = await SettingsManager.create(projectDir, agentDir); - storage.saveSettings({ + await writeSettings({ theme: "dark", defaultThinkingLevel: "low", }); - manager.setDefaultThinkingLevel("high"); + await manager.setDefaultThinkingLevel("high"); - const savedSettings = storage.getSettings() ?? {}; + const savedSettings = await readSettings(); expect(savedSettings.defaultThinkingLevel).toBe("high"); }); }); diff --git a/packages/coding-agent/test/tools.test.ts b/packages/coding-agent/test/tools.test.ts index 7714536c4..424bdf034 100644 --- a/packages/coding-agent/test/tools.test.ts +++ b/packages/coding-agent/test/tools.test.ts @@ -3,10 +3,10 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { EditTool } from "@oh-my-pi/pi-coding-agent/patch"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { BashTool } from "@oh-my-pi/pi-coding-agent/tools/bash"; import { FindTool } from "@oh-my-pi/pi-coding-agent/tools/find"; import { GrepTool } from "@oh-my-pi/pi-coding-agent/tools/grep"; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; import { LsTool } from "@oh-my-pi/pi-coding-agent/tools/ls"; import { wrapToolWithMetaNotice } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read"; diff --git a/packages/coding-agent/test/tools/index.test.ts b/packages/coding-agent/test/tools/index.test.ts index 93b2277ea..b35f462b8 100644 --- a/packages/coding-agent/test/tools/index.test.ts +++ b/packages/coding-agent/test/tools/index.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; process.env.OMP_PYTHON_SKIP_CHECK = "1"; diff --git a/packages/coding-agent/test/tools/lsp-batching.test.ts b/packages/coding-agent/test/tools/lsp-batching.test.ts index 0301a96a0..664a82b31 100644 --- a/packages/coding-agent/test/tools/lsp-batching.test.ts +++ b/packages/coding-agent/test/tools/lsp-batching.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { join } from "node:path"; +import { createLspWritethrough } from "@oh-my-pi/pi-coding-agent/lsp"; import * as lspConfig from "@oh-my-pi/pi-coding-agent/lsp/config"; -import { createLspWritethrough } from "@oh-my-pi/pi-coding-agent/lsp/index"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; describe("createLspWritethrough batching", () => { diff --git a/packages/coding-agent/test/tools/python-execution.test.ts b/packages/coding-agent/test/tools/python-execution.test.ts index 76fe9c419..750b0fc5e 100644 --- a/packages/coding-agent/test/tools/python-execution.test.ts +++ b/packages/coding-agent/test/tools/python-execution.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from "bun:test"; import * as pythonExecutor from "@oh-my-pi/pi-coding-agent/ipy/executor"; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; diff --git a/packages/coding-agent/test/tools/python-fallback.test.ts b/packages/coding-agent/test/tools/python-fallback.test.ts index 8784ad0f3..a47d6440f 100644 --- a/packages/coding-agent/test/tools/python-fallback.test.ts +++ b/packages/coding-agent/test/tools/python-fallback.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from "bun:test"; import * as pythonKernelModule from "@oh-my-pi/pi-coding-agent/ipy/kernel"; -import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; -import { createTools } from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; +import { createTools } from "@oh-my-pi/pi-coding-agent/tools"; function createTestSession(overrides: Partial = {}): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python-tool-mode.test.ts b/packages/coding-agent/test/tools/python-tool-mode.test.ts index 3dc7bd72f..23ad83380 100644 --- a/packages/coding-agent/test/tools/python-tool-mode.test.ts +++ b/packages/coding-agent/test/tools/python-tool-mode.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; function createSession(overrides: Partial = {}): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python.test.ts b/packages/coding-agent/test/tools/python.test.ts index 53de4c428..914195475 100644 --- a/packages/coding-agent/test/tools/python.test.ts +++ b/packages/coding-agent/test/tools/python.test.ts @@ -1,6 +1,6 @@ import { afterAll, beforeAll, describe, expect, it, vi } from "bun:test"; import * as pythonExecutor from "@oh-my-pi/pi-coding-agent/ipy/executor"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python"; import { createTempDirSync, type SyncTempDir } from "@oh-my-pi/pi-utils"; diff --git a/packages/coding-agent/test/tools/schema-validation.test.ts b/packages/coding-agent/test/tools/schema-validation.test.ts index c21130af7..4fcd3cf15 100644 --- a/packages/coding-agent/test/tools/schema-validation.test.ts +++ b/packages/coding-agent/test/tools/schema-validation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import { sanitizeSchemaForGoogle } from "@oh-my-pi/pi-ai"; -import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; /** * Problematic JSON Schema features that cause issues with various providers. diff --git a/packages/coding-agent/test/utilities.ts b/packages/coding-agent/test/utilities.ts index 4b77ef3bf..1ea1d9c5d 100644 --- a/packages/coding-agent/test/utilities.ts +++ b/packages/coding-agent/test/utilities.ts @@ -12,7 +12,7 @@ import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manag import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; -import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { nanoid } from "nanoid"; /** diff --git a/packages/coding-agent/tsconfig.json b/packages/coding-agent/tsconfig.json index d3786409c..0d9fa126f 100644 --- a/packages/coding-agent/tsconfig.json +++ b/packages/coding-agent/tsconfig.json @@ -4,11 +4,6 @@ "noEmit": true, "baseUrl": ".", "paths": { - "$c/*": ["./src/*"], - "$ai/*": ["../ai/src/*"], - "$tui/*": ["../tui/src/*"], - "$agent/*": ["../agent/src/*"], - "$stats/*": ["../omp-stats/src/*"], "@oh-my-pi/pi-ai": ["../ai/src/index.ts"], "@oh-my-pi/pi-ai/*": ["../ai/src/*"], "@oh-my-pi/pi-agent-core": ["../agent/src/index.ts"], diff --git a/packages/pi-utils/package.json b/packages/pi-utils/package.json index 305cb656b..54b93ca98 100644 --- a/packages/pi-utils/package.json +++ b/packages/pi-utils/package.json @@ -1,6 +1,6 @@ { "name": "@oh-my-pi/pi-utils", - "version": "8.0.0", + "version": "8.1.0", "description": "Shared utilities for pi packages", "type": "module", "main": "./src/index.ts", diff --git a/packages/omp-stats/README.md b/packages/stats/README.md similarity index 100% rename from packages/omp-stats/README.md rename to packages/stats/README.md diff --git a/packages/omp-stats/build.ts b/packages/stats/build.ts similarity index 100% rename from packages/omp-stats/build.ts rename to packages/stats/build.ts diff --git a/packages/omp-stats/package.json b/packages/stats/package.json similarity index 87% rename from packages/omp-stats/package.json rename to packages/stats/package.json index 303ab3994..1ca3e8813 100644 --- a/packages/omp-stats/package.json +++ b/packages/stats/package.json @@ -1,12 +1,12 @@ { "name": "@oh-my-pi/omp-stats", - "version": "8.0.0", + "version": "8.1.0", "description": "Local observability dashboard for pi AI usage statistics", "type": "module", "main": "./src/index.ts", "types": "./src/index.ts", "bin": { - "omp-stats": "./src/index.ts" + "omp-stats": "./dist/index.js" }, "exports": { ".": { @@ -23,6 +23,7 @@ } }, "files": [ + "dist", "src", "public", "README.md" @@ -39,14 +40,14 @@ "dev": "bun run src/index.ts", "check": "tsgo --noEmit && tsgo --noEmit -p tsconfig.client.json", "build": "bun run build.ts && tsgo -p tsconfig.build.json", - "prepublishOnly": "cp tsconfig.publish.json tsconfig.json" + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json && bun run build" }, "author": "Can Bölük", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/can1357/oh-my-pi.git", - "directory": "packages/omp-stats" + "directory": "packages/stats" }, "dependencies": { "@oh-my-pi/pi-ai": "workspace:*", diff --git a/packages/omp-stats/src/aggregator.ts b/packages/stats/src/aggregator.ts similarity index 100% rename from packages/omp-stats/src/aggregator.ts rename to packages/stats/src/aggregator.ts diff --git a/packages/omp-stats/src/client/App.tsx b/packages/stats/src/client/App.tsx similarity index 100% rename from packages/omp-stats/src/client/App.tsx rename to packages/stats/src/client/App.tsx diff --git a/packages/omp-stats/src/client/api.ts b/packages/stats/src/client/api.ts similarity index 100% rename from packages/omp-stats/src/client/api.ts rename to packages/stats/src/client/api.ts diff --git a/packages/omp-stats/src/client/components/RequestDetail.tsx b/packages/stats/src/client/components/RequestDetail.tsx similarity index 100% rename from packages/omp-stats/src/client/components/RequestDetail.tsx rename to packages/stats/src/client/components/RequestDetail.tsx diff --git a/packages/omp-stats/src/client/components/RequestList.tsx b/packages/stats/src/client/components/RequestList.tsx similarity index 100% rename from packages/omp-stats/src/client/components/RequestList.tsx rename to packages/stats/src/client/components/RequestList.tsx diff --git a/packages/omp-stats/src/client/components/StatCard.tsx b/packages/stats/src/client/components/StatCard.tsx similarity index 100% rename from packages/omp-stats/src/client/components/StatCard.tsx rename to packages/stats/src/client/components/StatCard.tsx diff --git a/packages/omp-stats/src/client/index.tsx b/packages/stats/src/client/index.tsx similarity index 100% rename from packages/omp-stats/src/client/index.tsx rename to packages/stats/src/client/index.tsx diff --git a/packages/omp-stats/src/client/types.ts b/packages/stats/src/client/types.ts similarity index 100% rename from packages/omp-stats/src/client/types.ts rename to packages/stats/src/client/types.ts diff --git a/packages/omp-stats/src/db.ts b/packages/stats/src/db.ts similarity index 100% rename from packages/omp-stats/src/db.ts rename to packages/stats/src/db.ts diff --git a/packages/omp-stats/src/index.ts b/packages/stats/src/index.ts similarity index 100% rename from packages/omp-stats/src/index.ts rename to packages/stats/src/index.ts diff --git a/packages/omp-stats/src/parser.ts b/packages/stats/src/parser.ts similarity index 100% rename from packages/omp-stats/src/parser.ts rename to packages/stats/src/parser.ts diff --git a/packages/omp-stats/src/server.ts b/packages/stats/src/server.ts similarity index 100% rename from packages/omp-stats/src/server.ts rename to packages/stats/src/server.ts diff --git a/packages/omp-stats/src/types.ts b/packages/stats/src/types.ts similarity index 100% rename from packages/omp-stats/src/types.ts rename to packages/stats/src/types.ts diff --git a/packages/omp-stats/tsconfig.build.json b/packages/stats/tsconfig.build.json similarity index 100% rename from packages/omp-stats/tsconfig.build.json rename to packages/stats/tsconfig.build.json diff --git a/packages/omp-stats/tsconfig.client.json b/packages/stats/tsconfig.client.json similarity index 100% rename from packages/omp-stats/tsconfig.client.json rename to packages/stats/tsconfig.client.json diff --git a/packages/omp-stats/tsconfig.json b/packages/stats/tsconfig.json similarity index 100% rename from packages/omp-stats/tsconfig.json rename to packages/stats/tsconfig.json diff --git a/packages/omp-stats/tsconfig.publish.json b/packages/stats/tsconfig.publish.json similarity index 100% rename from packages/omp-stats/tsconfig.publish.json rename to packages/stats/tsconfig.publish.json diff --git a/packages/tui/package.json b/packages/tui/package.json index a02fc8f6e..f8446472b 100644 --- a/packages/tui/package.json +++ b/packages/tui/package.json @@ -1,6 +1,6 @@ { "name": "@oh-my-pi/pi-tui", - "version": "8.0.0", + "version": "8.1.0", "description": "Terminal User Interface library with differential rendering for efficient text-based applications", "type": "module", "main": "src/index.ts", diff --git a/packages/tui/src/components/box.ts b/packages/tui/src/components/box.ts index f0214df63..22cd0db80 100644 --- a/packages/tui/src/components/box.ts +++ b/packages/tui/src/components/box.ts @@ -1,5 +1,5 @@ -import type { Component } from "$tui/tui"; -import { applyBackgroundToLine, visibleWidth } from "$tui/utils"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; +import { applyBackgroundToLine, visibleWidth } from "@oh-my-pi/pi-tui/utils"; /** * Box component - a container that applies padding and background to all children diff --git a/packages/tui/src/components/cancellable-loader.ts b/packages/tui/src/components/cancellable-loader.ts index 2e23b64fe..8d0a700ae 100644 --- a/packages/tui/src/components/cancellable-loader.ts +++ b/packages/tui/src/components/cancellable-loader.ts @@ -1,4 +1,4 @@ -import { matchesKey } from "$tui/keys"; +import { matchesKey } from "@oh-my-pi/pi-tui/keys"; import { Loader } from "./loader"; /** diff --git a/packages/tui/src/components/editor.ts b/packages/tui/src/components/editor.ts index 52cc34950..fb8fd6c04 100644 --- a/packages/tui/src/components/editor.ts +++ b/packages/tui/src/components/editor.ts @@ -1,8 +1,14 @@ -import type { AutocompleteProvider, CombinedAutocompleteProvider } from "$tui/autocomplete"; -import { matchesKey } from "$tui/keys"; -import type { SymbolTheme } from "$tui/symbols"; -import { type Component, CURSOR_MARKER, type Focusable } from "$tui/tui"; -import { getSegmenter, isPunctuationChar, isWhitespaceChar, truncateToWidth, visibleWidth } from "$tui/utils"; +import type { AutocompleteProvider, CombinedAutocompleteProvider } from "@oh-my-pi/pi-tui/autocomplete"; +import { matchesKey } from "@oh-my-pi/pi-tui/keys"; +import type { SymbolTheme } from "@oh-my-pi/pi-tui/symbols"; +import { type Component, CURSOR_MARKER, type Focusable } from "@oh-my-pi/pi-tui/tui"; +import { + getSegmenter, + isPunctuationChar, + isWhitespaceChar, + truncateToWidth, + visibleWidth, +} from "@oh-my-pi/pi-tui/utils"; import { SelectList, type SelectListTheme } from "./select-list"; const segmenter = getSegmenter(); diff --git a/packages/tui/src/components/image.ts b/packages/tui/src/components/image.ts index e1c4d0754..477705733 100644 --- a/packages/tui/src/components/image.ts +++ b/packages/tui/src/components/image.ts @@ -4,8 +4,8 @@ import { type ImageDimensions, imageFallback, renderImage, -} from "$tui/terminal-image"; -import type { Component } from "$tui/tui"; +} from "@oh-my-pi/pi-tui/terminal-image"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; export interface ImageTheme { fallbackColor: (str: string) => string; diff --git a/packages/tui/src/components/input.ts b/packages/tui/src/components/input.ts index be05fb16e..7fef511cc 100644 --- a/packages/tui/src/components/input.ts +++ b/packages/tui/src/components/input.ts @@ -1,6 +1,6 @@ -import { getEditorKeybindings } from "$tui/keybindings"; -import { type Component, CURSOR_MARKER, type Focusable } from "$tui/tui"; -import { getSegmenter, isPunctuationChar, isWhitespaceChar, visibleWidth } from "$tui/utils"; +import { getEditorKeybindings } from "@oh-my-pi/pi-tui/keybindings"; +import { type Component, CURSOR_MARKER, type Focusable } from "@oh-my-pi/pi-tui/tui"; +import { getSegmenter, isPunctuationChar, isWhitespaceChar, visibleWidth } from "@oh-my-pi/pi-tui/utils"; const segmenter = getSegmenter(); diff --git a/packages/tui/src/components/loader.ts b/packages/tui/src/components/loader.ts index 806b1340f..a059a858e 100644 --- a/packages/tui/src/components/loader.ts +++ b/packages/tui/src/components/loader.ts @@ -1,4 +1,4 @@ -import type { TUI } from "$tui/tui"; +import type { TUI } from "@oh-my-pi/pi-tui/tui"; import { Text } from "./text"; /** diff --git a/packages/tui/src/components/markdown.ts b/packages/tui/src/components/markdown.ts index 79d2f9e38..fca663189 100644 --- a/packages/tui/src/components/markdown.ts +++ b/packages/tui/src/components/markdown.ts @@ -1,9 +1,9 @@ +import type { MermaidImage } from "@oh-my-pi/pi-tui/mermaid"; +import type { SymbolTheme } from "@oh-my-pi/pi-tui/symbols"; +import { encodeITerm2, encodeKitty, getCapabilities, getCellDimensions } from "@oh-my-pi/pi-tui/terminal-image"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; +import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "@oh-my-pi/pi-tui/utils"; import { marked, type Token } from "marked"; -import type { MermaidImage } from "$tui/mermaid"; -import type { SymbolTheme } from "$tui/symbols"; -import { encodeITerm2, encodeKitty, getCapabilities, getCellDimensions } from "$tui/terminal-image"; -import type { Component } from "$tui/tui"; -import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "$tui/utils"; /** * Default text styling for markdown content. diff --git a/packages/tui/src/components/select-list.ts b/packages/tui/src/components/select-list.ts index 9fbeecb27..511b7a62c 100644 --- a/packages/tui/src/components/select-list.ts +++ b/packages/tui/src/components/select-list.ts @@ -1,7 +1,7 @@ -import { matchesKey } from "$tui/keys"; -import type { SymbolTheme } from "$tui/symbols"; -import type { Component } from "$tui/tui"; -import { truncateToWidth, visibleWidth } from "$tui/utils"; +import { matchesKey } from "@oh-my-pi/pi-tui/keys"; +import type { SymbolTheme } from "@oh-my-pi/pi-tui/symbols"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; +import { truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui/utils"; export interface SelectItem { value: string; diff --git a/packages/tui/src/components/settings-list.ts b/packages/tui/src/components/settings-list.ts index 5b3ae418f..570b5b193 100644 --- a/packages/tui/src/components/settings-list.ts +++ b/packages/tui/src/components/settings-list.ts @@ -1,6 +1,6 @@ -import { matchesKey } from "$tui/keys"; -import type { Component } from "$tui/tui"; -import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "$tui/utils"; +import { matchesKey } from "@oh-my-pi/pi-tui/keys"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; +import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@oh-my-pi/pi-tui/utils"; export interface SettingItem { /** Unique identifier for this setting */ @@ -131,7 +131,7 @@ export class SettingsList implements Component { // Add hint lines.push(""); - lines.push(this.theme.hint(" Enter/Space to change · Esc to cancel")); + lines.push(this.theme.hint("Enter/Space to change · Esc to cancel")); return lines; } diff --git a/packages/tui/src/components/spacer.ts b/packages/tui/src/components/spacer.ts index c2df10466..0419839b1 100644 --- a/packages/tui/src/components/spacer.ts +++ b/packages/tui/src/components/spacer.ts @@ -1,4 +1,4 @@ -import type { Component } from "$tui/tui"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; /** * Spacer component that renders empty lines diff --git a/packages/tui/src/components/tab-bar.ts b/packages/tui/src/components/tab-bar.ts index 61ee9248a..8bb6db96f 100644 --- a/packages/tui/src/components/tab-bar.ts +++ b/packages/tui/src/components/tab-bar.ts @@ -9,9 +9,9 @@ * - Shift+Tab / Arrow Left: Previous tab (wraps around) */ -import { matchesKey } from "$tui/keys"; -import type { Component } from "$tui/tui"; -import { wrapTextWithAnsi } from "$tui/utils"; +import { matchesKey } from "@oh-my-pi/pi-tui/keys"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; +import { wrapTextWithAnsi } from "@oh-my-pi/pi-tui/utils"; /** Tab definition */ export interface Tab { diff --git a/packages/tui/src/components/text.ts b/packages/tui/src/components/text.ts index da9b81966..3da34c63e 100644 --- a/packages/tui/src/components/text.ts +++ b/packages/tui/src/components/text.ts @@ -1,5 +1,5 @@ -import type { Component } from "$tui/tui"; -import { applyBackgroundToLine, wrapTextWithAnsi } from "$tui/utils"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; +import { applyBackgroundToLine, wrapTextWithAnsi } from "@oh-my-pi/pi-tui/utils"; /** * Text component - displays multi-line text with word wrapping diff --git a/packages/tui/src/components/truncated-text.ts b/packages/tui/src/components/truncated-text.ts index 91d4e3428..fff2351b4 100644 --- a/packages/tui/src/components/truncated-text.ts +++ b/packages/tui/src/components/truncated-text.ts @@ -1,5 +1,5 @@ -import type { Component } from "$tui/tui"; -import { truncateToWidth } from "$tui/utils"; +import type { Component } from "@oh-my-pi/pi-tui/tui"; +import { truncateToWidth } from "@oh-my-pi/pi-tui/utils"; /** * Text component that truncates to fit viewport width diff --git a/packages/tui/test/autocomplete.test.ts b/packages/tui/test/autocomplete.test.ts index c1e6ed0f9..8bbc17e27 100644 --- a/packages/tui/test/autocomplete.test.ts +++ b/packages/tui/test/autocomplete.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { CombinedAutocompleteProvider } from "$tui/autocomplete"; +import { CombinedAutocompleteProvider } from "@oh-my-pi/pi-tui/autocomplete"; describe("CombinedAutocompleteProvider", () => { describe("extractPathPrefix", () => { diff --git a/packages/tui/test/chat-simple.ts b/packages/tui/test/chat-simple.ts index c1a80b4c3..f71499c68 100644 --- a/packages/tui/test/chat-simple.ts +++ b/packages/tui/test/chat-simple.ts @@ -2,14 +2,14 @@ * Simple chat interface demo using tui.ts */ +import { CombinedAutocompleteProvider } from "@oh-my-pi/pi-tui/autocomplete"; +import { Editor } from "@oh-my-pi/pi-tui/components/editor"; +import { Loader } from "@oh-my-pi/pi-tui/components/loader"; +import { Markdown } from "@oh-my-pi/pi-tui/components/markdown"; +import { Text } from "@oh-my-pi/pi-tui/components/text"; +import { ProcessTerminal } from "@oh-my-pi/pi-tui/terminal"; +import { TUI } from "@oh-my-pi/pi-tui/tui"; import chalk from "chalk"; -import { CombinedAutocompleteProvider } from "$tui/autocomplete"; -import { Editor } from "$tui/components/editor"; -import { Loader } from "$tui/components/loader"; -import { Markdown } from "$tui/components/markdown"; -import { Text } from "$tui/components/text"; -import { ProcessTerminal } from "$tui/terminal"; -import { TUI } from "$tui/tui"; import { defaultEditorTheme, defaultMarkdownTheme } from "./test-themes"; // Create terminal diff --git a/packages/tui/test/editor.test.ts b/packages/tui/test/editor.test.ts index 29611040e..e928cd16a 100644 --- a/packages/tui/test/editor.test.ts +++ b/packages/tui/test/editor.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; import { stripVTControlCharacters } from "node:util"; -import { Editor } from "$tui/components/editor"; -import { visibleWidth } from "$tui/utils"; +import { Editor } from "@oh-my-pi/pi-tui/components/editor"; +import { visibleWidth } from "@oh-my-pi/pi-tui/utils"; import { defaultEditorTheme } from "./test-themes"; describe("Editor component", () => { diff --git a/packages/tui/test/image-test.ts b/packages/tui/test/image-test.ts index e0459826e..8eb0aac4e 100644 --- a/packages/tui/test/image-test.ts +++ b/packages/tui/test/image-test.ts @@ -1,9 +1,9 @@ -import { Image } from "$tui/components/image"; -import { Spacer } from "$tui/components/spacer"; -import { Text } from "$tui/components/text"; -import { ProcessTerminal } from "$tui/terminal"; -import { getCapabilities, getImageDimensions } from "$tui/terminal-image"; -import { TUI } from "$tui/tui"; +import { Image } from "@oh-my-pi/pi-tui/components/image"; +import { Spacer } from "@oh-my-pi/pi-tui/components/spacer"; +import { Text } from "@oh-my-pi/pi-tui/components/text"; +import { ProcessTerminal } from "@oh-my-pi/pi-tui/terminal"; +import { getCapabilities, getImageDimensions } from "@oh-my-pi/pi-tui/terminal-image"; +import { TUI } from "@oh-my-pi/pi-tui/tui"; const testImagePath = Bun.argv[2] || "/tmp/test-image.png"; diff --git a/packages/tui/test/key-tester.ts b/packages/tui/test/key-tester.ts index 05db1521e..3aed4a7ad 100755 --- a/packages/tui/test/key-tester.ts +++ b/packages/tui/test/key-tester.ts @@ -1,7 +1,7 @@ #!/usr/bin/env bun -import { matchesKey } from "$tui/keys"; -import { ProcessTerminal } from "$tui/terminal"; -import { type Component, TUI } from "$tui/tui"; +import { matchesKey } from "@oh-my-pi/pi-tui/keys"; +import { ProcessTerminal } from "@oh-my-pi/pi-tui/terminal"; +import { type Component, TUI } from "@oh-my-pi/pi-tui/tui"; /** * Simple key code logger component diff --git a/packages/tui/test/markdown.test.ts b/packages/tui/test/markdown.test.ts index 3ae6e3f10..f3f68c320 100644 --- a/packages/tui/test/markdown.test.ts +++ b/packages/tui/test/markdown.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; +import { Markdown } from "@oh-my-pi/pi-tui/components/markdown"; import { Chalk } from "chalk"; -import { Markdown } from "$tui/components/markdown"; import { defaultMarkdownTheme } from "./test-themes"; // Force full color in CI so ANSI assertions are deterministic diff --git a/packages/tui/test/stdin-buffer.test.ts b/packages/tui/test/stdin-buffer.test.ts index 3e463b794..214ed7407 100644 --- a/packages/tui/test/stdin-buffer.test.ts +++ b/packages/tui/test/stdin-buffer.test.ts @@ -6,7 +6,7 @@ */ import { beforeEach, describe, expect, it } from "bun:test"; -import { StdinBuffer } from "$tui/stdin-buffer"; +import { StdinBuffer } from "@oh-my-pi/pi-tui/stdin-buffer"; describe("StdinBuffer", () => { let buffer: StdinBuffer; diff --git a/packages/tui/test/test-themes.ts b/packages/tui/test/test-themes.ts index be9d1d729..1bf214935 100644 --- a/packages/tui/test/test-themes.ts +++ b/packages/tui/test/test-themes.ts @@ -2,8 +2,8 @@ * Default themes for TUI tests using chalk */ +import type { EditorTheme, MarkdownTheme, SelectListTheme, SymbolTheme } from "@oh-my-pi/pi-tui"; import { Chalk } from "chalk"; -import type { EditorTheme, MarkdownTheme, SelectListTheme, SymbolTheme } from "$tui/index"; const chalk = new Chalk({ level: 3 }); diff --git a/packages/tui/test/truncated-text.test.ts b/packages/tui/test/truncated-text.test.ts index 98d11f368..1fb480a14 100644 --- a/packages/tui/test/truncated-text.test.ts +++ b/packages/tui/test/truncated-text.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; +import { TruncatedText } from "@oh-my-pi/pi-tui/components/truncated-text"; +import { visibleWidth } from "@oh-my-pi/pi-tui/utils"; import { Chalk } from "chalk"; -import { TruncatedText } from "$tui/components/truncated-text"; -import { visibleWidth } from "$tui/utils"; // Force full color in CI so ANSI assertions are deterministic const chalk = new Chalk({ level: 3 }); diff --git a/packages/tui/test/virtual-terminal.ts b/packages/tui/test/virtual-terminal.ts index d423e1e6d..6b85de91d 100644 --- a/packages/tui/test/virtual-terminal.ts +++ b/packages/tui/test/virtual-terminal.ts @@ -1,6 +1,6 @@ +import type { Terminal } from "@oh-my-pi/pi-tui/terminal"; import type { Terminal as XtermTerminalType } from "@xterm/headless"; import xterm from "@xterm/headless"; -import type { Terminal } from "$tui/terminal"; // Extract Terminal class from the module const XtermTerminal = xterm.Terminal; diff --git a/packages/tui/test/wrap-ansi.test.ts b/packages/tui/test/wrap-ansi.test.ts index 4641fb2ae..b941ebf6a 100644 --- a/packages/tui/test/wrap-ansi.test.ts +++ b/packages/tui/test/wrap-ansi.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { visibleWidth, wrapTextWithAnsi } from "$tui/utils"; +import { visibleWidth, wrapTextWithAnsi } from "@oh-my-pi/pi-tui/utils"; describe("wrapTextWithAnsi", () => { describe("underline styling", () => { diff --git a/packages/tui/tsconfig.json b/packages/tui/tsconfig.json index 309e8d712..f9f4eda5e 100644 --- a/packages/tui/tsconfig.json +++ b/packages/tui/tsconfig.json @@ -4,11 +4,6 @@ "noEmit": true, "baseUrl": ".", "paths": { - "$tui/*": ["./src/*"], - "$ai/*": ["../ai/src/*"], - "$c/*": ["../coding-agent/src/*"], - "$agent/*": ["../agent/src/*"], - "$stats/*": ["../omp-stats/src/*"], "@oh-my-pi/pi-tui": ["./src/index.ts"], "@oh-my-pi/pi-tui/*": ["./src/*"], "@oh-my-pi/pi-ai": ["../ai/src/index.ts"], diff --git a/scripts/transform-imports.ts b/scripts/transform-imports.ts deleted file mode 100644 index eb7dd9077..000000000 --- a/scripts/transform-imports.ts +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bun -import { readFileSync, writeFileSync } from "node:fs"; -import { dirname, relative, resolve } from "node:path"; -import { Glob } from "bun"; - -const PACKAGES: Record = { - "coding-agent": "$c", - ai: "$ai", - tui: "$tui", - agent: "$agent", - "omp-stats": "$stats", -}; - -const ROOT = resolve(import.meta.dirname, ".."); - -async function transformFile(filePath: string, pkgName: string, prefix: string): Promise { - const content = readFileSync(filePath, "utf-8"); - const pkgRoot = resolve(ROOT, "packages", pkgName); - const srcRoot = resolve(pkgRoot, "src"); - const fileDir = dirname(filePath); - - let transformed = content; - let count = 0; - - // Match import/export from with relative paths starting with ../ - const importRegex = /(from\s+["'])(\.\.[^"']+)(["'])/g; - - transformed = content.replace(importRegex, (match, before, importPath, after) => { - // Resolve the relative import to absolute - const absolutePath = resolve(fileDir, importPath); - - // Check if it resolves within src/ - if (!absolutePath.startsWith(srcRoot)) { - return match; // Outside src, keep as-is - } - - // Get path relative to src/ - let relToSrc = relative(srcRoot, absolutePath); - - // Handle index imports - if pointing to a directory, it's importing index - // But we keep the path as-is since TS resolves index automatically - - const newImport = `${prefix}/${relToSrc}`; - count++; - return `${before}${newImport}${after}`; - }); - - if (count > 0) { - writeFileSync(filePath, transformed); - } - - return count; -} - -async function transformPackage(pkgName: string, prefix: string): Promise { - const pkgRoot = resolve(ROOT, "packages", pkgName); - const glob = new Glob("**/*.ts"); - let total = 0; - - for await (const file of glob.scan({ cwd: resolve(pkgRoot, "src"), absolute: true })) { - total += await transformFile(file, pkgName, prefix); - } - - // Also transform test files if directory exists - const testDir = resolve(pkgRoot, "test"); - try { - const testGlob = new Glob("**/*.ts"); - for await (const file of testGlob.scan({ cwd: testDir, absolute: true })) { - total += await transformFile(file, pkgName, prefix); - } - } catch { - // test dir doesn't exist, skip - } - - return total; -} - -async function main() { - console.log("Transforming relative imports to path aliases...\n"); - - let grandTotal = 0; - for (const [pkgName, prefix] of Object.entries(PACKAGES)) { - const count = await transformPackage(pkgName, prefix); - console.log(` ${pkgName}: ${count} imports transformed`); - grandTotal += count; - } - - console.log(`\nTotal: ${grandTotal} imports transformed`); -} - -main().catch(console.error); diff --git a/tsconfig.json b/tsconfig.json index 00172c6b2..e92f16924 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,11 +3,6 @@ "compilerOptions": { "noEmit": true, "paths": { - "$c/*": ["./packages/coding-agent/src/*"], - "$ai/*": ["./packages/ai/src/*"], - "$tui/*": ["./packages/tui/src/*"], - "$agent/*": ["./packages/agent/src/*"], - "$stats/*": ["./packages/omp-stats/src/*"], "*": ["./*"], "@oh-my-pi/pi-ai": ["./packages/ai/src/index.ts"], "@oh-my-pi/pi-ai/*": ["./packages/ai/src/*"], @@ -18,9 +13,9 @@ "@oh-my-pi/pi-coding-agent": ["./packages/coding-agent/src/index.ts"], "@oh-my-pi/pi-coding-agent/hooks": ["./packages/coding-agent/src/extensibility/hooks/index.ts"], "@oh-my-pi/pi-coding-agent/*": ["./packages/coding-agent/src/*"], - "@oh-my-pi/omp-stats": ["./packages/omp-stats/src/index.ts"], - "@oh-my-pi/omp-stats/src/*": ["./packages/omp-stats/src/*"], - "@oh-my-pi/omp-stats/*": ["./packages/omp-stats/src/*"], + "@oh-my-pi/omp-stats": ["./packages/stats/src/index.ts"], + "@oh-my-pi/omp-stats/src/*": ["./packages/stats/src/*"], + "@oh-my-pi/omp-stats/*": ["./packages/stats/src/*"], "@sinclair/typebox": ["./node_modules/@sinclair/typebox"], "@oh-my-pi/pi-tui": ["./packages/tui/src/index.ts"], "@oh-my-pi/pi-tui/*": ["./packages/tui/src/*"]