diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 1bda0df..48a61da 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -16,7 +16,7 @@ ".roo/**", ".windsurf/**", "tools/oxlint/anti-slop/**", - "src/anti-overengineering.md", + "src/skills/anti-overengineering.md", "node_modules/**", "dist/**", "coverage/**", diff --git a/package.json b/package.json index 6dc0fe5..533f9c4 100644 --- a/package.json +++ b/package.json @@ -5,27 +5,27 @@ "type": "module", "exports": { "./agents": { - "types": "./dist/agents.d.ts", + "types": "./dist/agents/agents.d.ts", "import": "./dist/agents.js" }, "./multi-work": { - "types": "./dist/multi-work.d.ts", + "types": "./dist/multi-work/multi-work.d.ts", "import": "./dist/multi-work.js" }, "./quota": { - "types": "./dist/quota-plugin.d.ts", + "types": "./dist/quota/quota-plugin.d.ts", "import": "./dist/quota-plugin.js" }, "./tui": { - "types": "./dist/tui.d.ts", + "types": "./dist/quota/tui.d.ts", "import": "./dist/tui.js" }, "./quota/tui": { - "types": "./dist/tui.d.ts", + "types": "./dist/quota/tui.d.ts", "import": "./dist/tui.js" }, "./quota-rpc": { - "types": "./dist/quota-rpc.d.ts", + "types": "./dist/quota/quota-rpc.d.ts", "import": "./dist/quota-rpc.js" } }, diff --git a/scripts/build.ts b/scripts/build.ts index 0ee3381..f1001f5 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -7,24 +7,27 @@ export async function build() { const results = await Promise.all([ Bun.build({ entrypoints: [ - "src/agents.ts", - "src/multi-work.ts", - "src/quota-plugin.ts", - "src/quota-rpc.ts", + "src/agents/agents.ts", + "src/multi-work/multi-work.ts", + "src/quota/quota-plugin.ts", + "src/quota/quota-rpc.ts", ], outdir: "dist", + naming: "[name].[ext]", target: "bun", format: "esm", }), Bun.build({ entrypoints: ["scripts/install.ts"], outdir: "dist", + naming: "[name].[ext]", target: "bun", format: "esm", }), Bun.build({ - entrypoints: ["src/tui.tsx"], + entrypoints: ["src/quota/tui.tsx"], outdir: "dist", + naming: "[name].[ext]", target: "bun", format: "esm", external: ["@opencode/plugin/tui", "@opentui/solid", "solid-js"], diff --git a/scripts/test-multi-work-host.ts b/scripts/test-multi-work-host.ts index 514b109..5b907e3 100644 --- a/scripts/test-multi-work-host.ts +++ b/scripts/test-multi-work-host.ts @@ -5,7 +5,7 @@ import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { createServer } from "node:net"; import { OpenCode } from "@opencode/client"; -import { command } from "../src/herdr.js"; +import { command } from "../src/multi-work/herdr.js"; import { z } from "zod"; const binary = process.env.OPENCODE_2022; @@ -358,7 +358,7 @@ try { server.kill(); await server.exited; const quotaBuild = await Bun.build({ - entrypoints: [resolve("src/quota-plugin.ts")], + entrypoints: [resolve("src/quota/quota-plugin.ts")], outdir: join(temp, "plugin", "quota"), naming: "index.js", target: "bun", diff --git a/src/agents-rpc.ts b/src/agents/agents-rpc.ts similarity index 100% rename from src/agents-rpc.ts rename to src/agents/agents-rpc.ts diff --git a/src/agents.ts b/src/agents/agents.ts similarity index 98% rename from src/agents.ts rename to src/agents/agents.ts index 597f6ba..59ff9e3 100644 --- a/src/agents.ts +++ b/src/agents/agents.ts @@ -8,8 +8,8 @@ import { descriptions, routingGuide } from "./routing.js"; import { Skill } from "@opencode/schema/skill"; import { AbsolutePath } from "@opencode/schema/schema"; import { fileURLToPath } from "node:url"; -import antiOverengineering from "./anti-overengineering.md" with { type: "text" }; -import taskPlanning from "./task-planning.md" with { type: "text" }; +import antiOverengineering from "../skills/anti-overengineering.md" with { type: "text" }; +import taskPlanning from "../skills/task-planning.md" with { type: "text" }; import { AgentsRpc } from "./agents-rpc.js"; // Permission actions use wildcards, not filesystem globs. diff --git a/src/config.ts b/src/agents/config.ts similarity index 100% rename from src/config.ts rename to src/agents/config.ts diff --git a/src/model.ts b/src/agents/model.ts similarity index 100% rename from src/model.ts rename to src/agents/model.ts diff --git a/src/provider.ts b/src/agents/provider.ts similarity index 100% rename from src/provider.ts rename to src/agents/provider.ts diff --git a/src/routing.ts b/src/agents/routing.ts similarity index 100% rename from src/routing.ts rename to src/agents/routing.ts diff --git a/src/herdr.ts b/src/multi-work/herdr.ts similarity index 100% rename from src/herdr.ts rename to src/multi-work/herdr.ts diff --git a/src/multi-work.ts b/src/multi-work/multi-work.ts similarity index 99% rename from src/multi-work.ts rename to src/multi-work/multi-work.ts index 3d9810d..c9c3ec7 100644 --- a/src/multi-work.ts +++ b/src/multi-work/multi-work.ts @@ -4,12 +4,12 @@ import { Session } from "@opencode/schema/session"; import { AbsolutePath } from "@opencode/schema/schema"; import type { Context } from "@opencode/plugin/effect/plugin"; import { Plugin } from "@opencode/plugin/effect"; -import { AgentsRpc } from "./agents-rpc.js"; +import { AgentsRpc } from "../agents/agents-rpc.js"; import { Cause, Effect, Schedule, Stream } from "effect"; import { z } from "zod"; import { randomUUID } from "node:crypto"; import { Herdr, rootSchema } from "./herdr.js"; -import { multiWorkGuide } from "./routing.js"; +import { multiWorkGuide } from "../agents/routing.js"; export const bindingSchema = z .object({ diff --git a/src/claude-quota.ts b/src/quota/claude-quota.ts similarity index 100% rename from src/claude-quota.ts rename to src/quota/claude-quota.ts diff --git a/src/quota-plugin.ts b/src/quota/quota-plugin.ts similarity index 100% rename from src/quota-plugin.ts rename to src/quota/quota-plugin.ts diff --git a/src/quota-rpc.ts b/src/quota/quota-rpc.ts similarity index 100% rename from src/quota-rpc.ts rename to src/quota/quota-rpc.ts diff --git a/src/quota.ts b/src/quota/quota.ts similarity index 100% rename from src/quota.ts rename to src/quota/quota.ts diff --git a/src/tui.tsx b/src/quota/tui.tsx similarity index 100% rename from src/tui.tsx rename to src/quota/tui.tsx diff --git a/src/anti-overengineering.md b/src/skills/anti-overengineering.md similarity index 100% rename from src/anti-overengineering.md rename to src/skills/anti-overengineering.md diff --git a/src/task-planning.md b/src/skills/task-planning.md similarity index 100% rename from src/task-planning.md rename to src/skills/task-planning.md diff --git a/tests/claude-quota.test.ts b/tests/claude-quota.test.ts index f4ecd4c..784b81d 100644 --- a/tests/claude-quota.test.ts +++ b/tests/claude-quota.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, expect, test } from "bun:test"; import { mkdtemp, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { ClaudeQuotaTracker, normalizeClaudeQuota } from "../src/claude-quota.js"; +import { ClaudeQuotaTracker, normalizeClaudeQuota } from "../src/quota/claude-quota.js"; const payload = { five_hour: { utilization: 12.5, resets_at: "2026-10-07T12:00:00+00:00" }, diff --git a/tests/fixtures/native-agents-plugin.ts b/tests/fixtures/native-agents-plugin.ts index 16093e2..4d54d33 100644 --- a/tests/fixtures/native-agents-plugin.ts +++ b/tests/fixtures/native-agents-plugin.ts @@ -1,7 +1,7 @@ import { Plugin, Model, Provider } from "@opencode/plugin/effect"; import { fromPromise } from "@opencode/plugin/promise/adapter"; import { Effect } from "effect"; -import agents from "../../src/agents.js"; +import agents from "../../src/agents/agents.js"; export default Plugin.define({ id: agents.id, diff --git a/tests/fixtures/native-host-plugin.ts b/tests/fixtures/native-host-plugin.ts index 5ff8877..85f0f7e 100644 --- a/tests/fixtures/native-host-plugin.ts +++ b/tests/fixtures/native-host-plugin.ts @@ -6,7 +6,7 @@ import { Tool } from "@opencode/schema/tool"; import { Cause, Effect } from "effect"; import { z } from "zod"; import { appendFile } from "node:fs/promises"; -import multiWork from "../../src/multi-work.js"; +import multiWork from "../../src/multi-work/multi-work.js"; const probe = Rpc.define({ id: "multi-work-test", diff --git a/tests/herdr.test.ts b/tests/herdr.test.ts index 60769b6..724e527 100644 --- a/tests/herdr.test.ts +++ b/tests/herdr.test.ts @@ -2,7 +2,7 @@ import { afterEach, expect, test } from "bun:test"; import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { command, Herdr } from "../src/herdr.js"; +import { command, Herdr } from "../src/multi-work/herdr.js"; const directories: string[] = []; afterEach(async () => { diff --git a/tests/multi-work.test.ts b/tests/multi-work.test.ts index bbd22aa..9e93905 100644 --- a/tests/multi-work.test.ts +++ b/tests/multi-work.test.ts @@ -9,8 +9,8 @@ import type { ToolEditor, ToolHooks } from "@opencode/plugin/effect/tool"; import type { AgentEditor } from "@opencode/plugin/effect/agent"; import type { SessionContext } from "@opencode/plugin/effect/session"; import { z } from "zod"; -import { Herdr, type HerdrRoot } from "../src/herdr.js"; -import { bindingKey, bindingSchema, installMultiWork } from "../src/multi-work.js"; +import { Herdr, type HerdrRoot } from "../src/multi-work/herdr.js"; +import { bindingKey, bindingSchema, installMultiWork } from "../src/multi-work/multi-work.js"; class FixtureHerdr extends Herdr { eligible = true; diff --git a/tests/plugin.test.ts b/tests/plugin.test.ts index 14c1ba7..f08d721 100644 --- a/tests/plugin.test.ts +++ b/tests/plugin.test.ts @@ -7,10 +7,10 @@ import type { SkillEditor } from "@opencode/plugin/promise/skill"; import type { DeepMutable } from "@opencode/plugin/promise/types"; import type { Skill } from "@opencode/schema/skill"; import type { ModelInfo } from "@opencode/client"; -import plugin from "../src/agents.js"; -import { model } from "../src/model.js"; +import plugin from "../src/agents/agents.js"; +import { model } from "../src/agents/model.js"; import { z } from "zod"; -import { AgentsRpc } from "../src/agents-rpc.js"; +import { AgentsRpc } from "../src/agents/agents-rpc.js"; const cleanups: Plugin.Cleanup[] = []; afterEach(async () => { diff --git a/tests/plugins.test.ts b/tests/plugins.test.ts index e35fe92..b38bd30 100644 --- a/tests/plugins.test.ts +++ b/tests/plugins.test.ts @@ -1,7 +1,7 @@ import { expect, test } from "bun:test"; import type { Plugin } from "@opencode/plugin"; -import quota from "../src/quota-plugin.js"; -import { QuotaRpc } from "../src/quota-rpc.js"; +import quota from "../src/quota/quota-plugin.js"; +import { QuotaRpc } from "../src/quota/quota-rpc.js"; test("Quota loads independently and retains its RPC ID and nullable status", async () => { let controller: ReadableStreamDefaultController; diff --git a/tests/quota.test.ts b/tests/quota.test.ts index 0a05ada..0e9e50f 100644 --- a/tests/quota.test.ts +++ b/tests/quota.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "bun:test"; import type { Schema } from "effect"; -import { normalizeQuota, QuotaTracker } from "../src/quota.js"; +import { normalizeQuota, QuotaTracker } from "../src/quota/quota.js"; const plus = { plan_type: "plus", diff --git a/tests/tui.test.ts b/tests/tui.test.ts index efc796f..a7513b0 100644 --- a/tests/tui.test.ts +++ b/tests/tui.test.ts @@ -4,7 +4,7 @@ import type { Route, SlotMap } from "@opencode/plugin/tui/context"; import { testRender, type JSX } from "@opentui/solid"; import { createSignal } from "solid-js"; import { build } from "../scripts/build.js"; -import type { QuotaStatus } from "../src/quota.js"; +import type { QuotaStatus } from "../src/quota/quota.js"; type SidebarSlotRender = (input: { readonly sessionID: string }) => JSX.Element; type HomeSlotRender = (input: SlotMap["prompt.footer"]) => JSX.Element; @@ -27,7 +27,7 @@ const status = (plan: string, remaining: number): QuotaStatus => ({ test("built quota slot stays reactive across pending, empty, failure, update, and session states", async () => { await build(); // Resolve the built bundle at runtime; tsc runs before build creates dist/tui.js. - const tui: typeof import("../src/tui.js") = await import( + const tui: typeof import("../src/quota/tui.js") = await import( new URL("../dist/tui.js", import.meta.url).href ); const { default: plugin } = tui;