From b14adcaf8398c9a834b07dd681ae1be7bf6f0c6c Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Mon, 27 Jul 2026 22:30:26 -0400 Subject: [PATCH] docs: forbid type-position import references (#39234) --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index 027d22647e..72d635ae33 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -60,6 +60,7 @@ const { a, b } = obj ### Imports - Never alias imports. Do not use `import { foo as bar } from "..."` or renamed imports like `resolve as pathResolve`. +- Never use type-position `import("...")` references such as `Schema.declare`. Only when two imports genuinely collide on a name and no other option exists, an aliased type import (`import type { Plugin as PluginDefinition } from "..."`) is permitted as a last resort — still strongly preferred not to. - Never use star imports. Do not use `import * as Foo from "..."` or `import type * as Foo from "..."`. - If a namespace-style value is needed, import the module's own exported namespace by name, for example `import { Project } from "@opencode-ai/core/project"`, then reference `Project.ID`. - Prefer dynamic imports for heavy modules that are only needed in selected code paths, especially in startup-sensitive entrypoints. Destructure dynamic import bindings near the top of the narrowest scope that needs them so they read like normal imports. Avoid inline chains such as `await import("./module").then((mod) => mod.value())` or `(await import("./module")).value()`. Keep branch-specific imports inside the branch that needs them to preserve lazy loading.