refactor: restructured monorepo TypeScript config and build tasks for unified setup

- Migrated all package tsconfig files to extend tsconfig.workspace.json for unified TypeScript configuration across monorepo.
- Consolidated build and check scripts across 10+ packages to use biome for linting/formatting with separate type checking via tsgo.
- Renamed build scripts from build:native and build:binary to build for simplified command naming across packages/natives and packages/coding-agent.
- Refactored CI workflow to invoke bun tasks instead of inline shell scripts, reducing workflow complexity by 40+ lines.
- Removed sync-exports.ts and repro-stuck.ts scripts; deleted path aliases from tsconfig.base.json in favor of workspace-based configuration.
- Updated turbo.json with new task definitions (check:types, lint, fmt, fix) and removed build:native/embed:native tasks.
This commit is contained in:
can1357
2026-04-08 16:09:37 +02:00
parent 61dff04ab1
commit 52719d1a7c
55 changed files with 777 additions and 746 deletions
+11
View File
@@ -1,6 +1,17 @@
# Changelog
## [Unreleased]
### Added
- Exported `hooks` subpath for extensibility API access
- Added `build` script for compiling binary artifacts
### Changed
- Renamed `build:binary` script to `build`
- Refactored `check` script to include linting via Biome and type checking
- Added `check:types`, `lint`, `fmt`, and `fix` scripts for improved developer workflow
- Simplified TypeScript configuration by extending workspace-level config
## [14.0.1] - 2026-04-08
+1 -1
View File
@@ -1116,7 +1116,7 @@ Use only script names that exist in `packages/coding-agent/package.json`:
- Regenerate template artifacts:
- `bun --cwd=packages/coding-agent run generate-template`
- Build compiled binary artifact (`dist/omp`):
- `bun --cwd=packages/coding-agent run build:binary`
- `bun --cwd=packages/coding-agent run build`
`packages/coding-agent/README.md` intentionally delegates install/config/CLI docs to the monorepo root README (`../../README.md`) and keeps package-specific references to `CHANGELOG.md`, `docs/`, and `DEVELOPMENT.md`.
+18 -5
View File
@@ -31,13 +31,17 @@
"omp": "src/cli.ts"
},
"scripts": {
"check": "tsgo -p tsconfig.json",
"build": "bun --cwd=../stats scripts/generate-client-bundle.ts --generate && bun --cwd=../natives run embed:native && bun build --compile --define PI_COMPILED=true --external mupdf --root ../.. ./src/cli.ts --outfile dist/omp && bun --cwd=../natives run embed:native --reset && bun --cwd=../stats scripts/generate-client-bundle.ts --reset",
"check": "biome check . && bun run check:types",
"check:types": "tsgo -p tsconfig.json --noEmit",
"lint": "biome lint .",
"test": "bun test",
"fix": "biome check --write --unsafe . && bun run format-prompts && bun run generate-docs-index",
"fmt": "biome format --write . && bun run format-prompts",
"format-prompts": "bun scripts/format-prompts.ts",
"generate-docs-index": "bun scripts/generate-docs-index.ts",
"prepack": "bun scripts/generate-docs-index.ts",
"build:binary": "cd ../.. && bun --cwd=packages/stats scripts/generate-client-bundle.ts && bun --cwd=packages/natives run embed:native && bun build --compile --define PI_COMPILED=true --external mupdf --root . ./packages/coding-agent/src/cli.ts --outfile packages/coding-agent/dist/omp && bun --cwd=packages/natives run embed:native --reset && bun --cwd=packages/stats scripts/generate-client-bundle.ts --reset",
"generate-template": "bun scripts/generate-template.ts",
"test": "bun test"
"generate-template": "bun scripts/generate-template.ts"
},
"dependencies": {
"@agentclientprotocol/sdk": "0.16.1",
@@ -507,6 +511,15 @@
"./web/search/providers/*": {
"types": "./src/web/search/providers/*.ts",
"import": "./src/web/search/providers/*.ts"
}
},
"./hooks": {
"types": "./src/extensibility/hooks/index.ts",
"import": "./src/extensibility/hooks/index.ts"
},
"./hooks/*": {
"types": "./src/extensibility/hooks/*.ts",
"import": "./src/extensibility/hooks/*.ts"
},
"./*.js": "./src/*.ts"
}
}
@@ -1,77 +0,0 @@
---
name: oracle
description: Deep reasoning advisor for debugging dead ends, architecture decisions, and second opinions. Read-only.
tools: read, grep, find, bash, lsp, web_search, ast_grep
spawns: explore
model: pi/slow
thinking-level: high
blocking: true
---
You are a senior diagnostician and strategic technical advisor. You receive problems other agents are stuck on — doom loops, mysterious failures, architectural tradeoffs, subtle bugs — and return clear, actionable analysis.
You diagnose, explain, and recommend. You do not implement. Others act on your findings.
<critical>
You **MUST** operate as read-only. You **MUST NOT** write, edit, or modify files, nor execute any state-changing commands.
</critical>
<directives>
- You **MUST** reason from first principles. The caller already tried the obvious.
- You **MUST** use tools to verify claims. You **MUST NOT** speculate about code behavior — read it.
- You **MUST** identify root causes, not symptoms. If the caller says "X is broken", determine *why* X is broken.
- You **MUST** surface hidden assumptions — in the code, in the caller's framing, in the environment.
- You **SHOULD** consider at least two hypotheses before converging on one.
- You **SHOULD** invoke tools in parallel when investigating multiple hypotheses.
- When the problem is architectural, you **MUST** weigh tradeoffs explicitly: what does each option cost, what does it buy, what does it foreclose.
</directives>
<decision-framework>
Apply pragmatic minimalism:
- **Bias toward simplicity**: The right solution is the least complex one that fulfills actual requirements. Resist hypothetical future needs.
- **Leverage what exists**: Favor modifications to current code and established patterns over introducing new components. New dependencies or infrastructure require explicit justification.
- **One clear path**: Present a single primary recommendation. Mention alternatives only when they offer substantially different tradeoffs worth considering.
- **Match depth to complexity**: Quick questions get quick answers. Reserve thorough analysis for genuinely complex problems.
- **Signal the investment**: Tag recommendations with estimated effort — Quick (<1h), Short (1-4h), Medium (1-2d), Large (3d+).
</decision-framework>
<procedure>
1. Read the problem statement carefully. Identify what was already tried and why it failed.
2. Form 2-3 hypotheses for the root cause.
3. Use tools to gather evidence — read relevant code, trace data flow, check types, grep for related patterns. Parallelize independent reads.
4. Eliminate hypotheses based on evidence. Narrow to the most likely cause.
5. If the problem is a decision (not a bug), lay out options with concrete tradeoffs.
6. Deliver a clear verdict with supporting evidence.
</procedure>
<output>
Structure your response in tiers:
**Always include:**
- **Diagnosis**: What is actually wrong, or what the real tradeoff is. 2-3 sentences.
- **Evidence**: Specific file paths, line numbers, code excerpts that support your conclusion.
- **Recommendation**: What to do about it — concrete, actionable, with enough detail that an implementing agent can act without re-investigating. Numbered steps, each 1-2 sentences.
**Include when relevant:**
- **Caveats**: Anything you are not confident about. Uncertainty **MUST** be stated, not hidden.
- **Risks**: Edge cases, failure modes, or mitigation strategies.
**Only when genuinely applicable:**
- **Escalation triggers**: Conditions that would justify a more complex solution.
- **Alternative sketch**: High-level outline of an alternative path (not a full design).
You **MUST NOT** pad with meta-commentary. Dense and useful beats long and thorough.
</output>
<scope-discipline>
- Recommend ONLY what was asked. No unsolicited improvements.
- If you notice other issues, list at most 2 as "Optional future considerations" at the end.
- You **MUST NOT** expand the problem surface beyond the original request.
- Exhaust provided context before reaching for tools. External lookups fill genuine gaps, not curiosity.
</scope-discipline>
<critical>
You **MUST** keep going until you have a clear answer or have exhausted available evidence.
Before finalizing: re-scan for unstated assumptions, verify claims are grounded in code not invented, check for overly strong language not justified by evidence.
This matters. The caller is stuck. Get it right.
</critical>
+1 -2
View File
@@ -11,7 +11,7 @@ import exploreMd from "../prompts/agents/explore.md" with { type: "text" };
// Embed agent markdown files at build time
import agentFrontmatterTemplate from "../prompts/agents/frontmatter.md" with { type: "text" };
import librarianMd from "../prompts/agents/librarian.md" with { type: "text" };
import oracleMd from "../prompts/agents/oracle.md" with { type: "text" };
import planMd from "../prompts/agents/plan.md" with { type: "text" };
import reviewerMd from "../prompts/agents/reviewer.md" with { type: "text" };
import taskMd from "../prompts/agents/task.md" with { type: "text" };
@@ -45,7 +45,6 @@ const EMBEDDED_AGENT_DEFS: EmbeddedAgentDef[] = [
{ fileName: "plan.md", template: planMd },
{ fileName: "designer.md", template: designerMd },
{ fileName: "reviewer.md", template: reviewerMd },
{ fileName: "oracle.md", template: oracleMd },
{ fileName: "librarian.md", template: librarianMd },
{
fileName: "task.md",
@@ -1,8 +1,6 @@
import { describe, expect, it } from "bun:test";
import planModeApprovedPrompt from "@oh-my-pi/pi-coding-agent/prompts/system/plan-mode-approved.md" with {
type: "text",
};
import { prompt } from "@oh-my-pi/pi-utils";
import planModeApprovedPrompt from "../../src/prompts/system/plan-mode-approved.md" with { type: "text" };
describe("plan-mode-approved prompt", () => {
it("includes final plan artifact path in injected execution prompt", () => {
+4 -14
View File
@@ -1,16 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"noEmit": true,
"paths": {
"@oh-my-pi/pi-coding-agent": ["./src/index.ts"],
"@oh-my-pi/pi-coding-agent/hooks": ["./src/extensibility/hooks/index.ts"],
"@oh-my-pi/pi-tui": ["../tui/src/index.ts"],
"@oh-my-pi/pi-ai": ["../ai/src/index.ts"],
"@sinclair/typebox": ["../../node_modules/@sinclair/typebox"]
},
"skipLibCheck": true
},
"include": ["examples/**/*.ts"],
"exclude": ["node_modules", "dist"]
"extends": "../tsconfig.workspace.json",
"include": [
"examples"
]
}
+6 -6
View File
@@ -1,8 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"noEmit": true
},
"include": ["src/**/*.ts", "src/bun-imports.d.ts", "test/**/*.ts"],
"exclude": ["node_modules", "dist"]
"extends": "../tsconfig.workspace.json",
"include": [
"src",
"test",
"scripts"
]
}