🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🔧 chore(alint): flag redundant API instructions (#20691)
Bryand50e2a1f382a
diff --git a/alint.config.toml b/alint.config.tomlindex 416004230a4..ed5e5f0b5f7 100644--- a/alint.config.toml+++ b/alint.config.toml@@ -197,7 +197,24 @@ lobehub = "./packages/alint/rules""lobehub/no-removal-only-tests" = "warn""lobehub/no-constant-stub-tests" = "warn"+# Ordinary API instructions: avoid removal announcements and locally redundant+# descriptions while preserving migration guidance and useful input semantics.+[[config.group]]+files = [ "docs/usage/**/*.mdx", "docs/usage/**/*.md", "packages/builtin-skills/**/*.md", "packages/builtin-skills/src/**/content.ts", "packages/builtin-skills/src/**/references/**/*.ts", "apps/cli/src/commands/**/*.ts", "packages/openapi/src/types/**/*.ts" ]+ignores = [ "**/*.test.ts", "**/__tests__/**", "**/generated/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/no-redundant-api-copy" = "warn"+# Calibration fixtures: one group per rule so a fixture only meets its own rule.+[[config.group]]+files = [ "packages/alint/fixtures/no-redundant-api-copy/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/no-redundant-api-copy" = "warn"+[[config.group]]files = [ "packages/alint/fixtures/no-constant-stub-tests/**" ][config.group.plugins]diff --git a/packages/alint/README.md b/packages/alint/README.mdindex c74a9fce0fd..472bb3675a6 100644--- a/packages/alint/README.md+++ b/packages/alint/README.md@@ -27,6 +27,8 @@ This is Phase 0: the rule set is a private workspace package (`@lobechat/alint`)| `no-unvalidated-redirect` | warn | server and web | unvalidated return/callback targets || `no-prototype-pollution` | warn | server, desktop main, shared utilities | untrusted keys/paths reaching prototype setters || `no-privileged-untrusted-electron` | warn | Electron main/preload | remote content with Node privileges or unrestricted IPC bridges |+| `no-removal-only-tests` | warn | app/package/client test and spec files | tests should prove behavior, not merely that a retired option is absent |+| `no-redundant-api-copy` | warn | usage guides, builtin skills, CLI commands, public schemas | keep ordinary instructions focused on supported actions |Package-level rules, kept next to the package they describe:diff --git a/packages/alint/fixtures/no-redundant-api-copy/bad-repeated-cli-summary.ts b/packages/alint/fixtures/no-redundant-api-copy/bad-repeated-cli-summary.tsnew file mode 100644index 00000000000..9414226efbb--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/bad-repeated-cli-summary.ts@@ -0,0 +1,8 @@+import { Command } from 'commander';++export const taskCommand = new Command('task')+ .command('create')+ // alint-expect+ .description('Create a task with its project identifier prefix, or T when no project is assigned')+ .option('--project <id>', 'Project ID; tasks use the project identifier prefix, otherwise T')+ .requiredOption('--instruction <text>', 'Task instruction');diff --git a/packages/alint/fixtures/no-redundant-api-copy/bad-tautological-schema.ts b/packages/alint/fixtures/no-redundant-api-copy/bad-tautological-schema.tsnew file mode 100644index 00000000000..5107584ea0b--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/bad-tautological-schema.ts@@ -0,0 +1,6 @@+import { z } from 'zod';++export const CreateTaskRequestSchema = z+ .object({ instruction: z.string() })+ // alint-expect+ .describe('Create task request schema');diff --git a/packages/alint/fixtures/no-redundant-api-copy/bad-usage-guide.mdx b/packages/alint/fixtures/no-redundant-api-copy/bad-usage-guide.mdxnew file mode 100644index 00000000000..9080918844a--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/bad-usage-guide.mdx@@ -0,0 +1,7 @@+# Creating tasks++Run `lh task create --instruction "Review the patch"`.++{/* alint-expect */}++CLI 不接受 `--prefix`。diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-concise-cli.ts b/packages/alint/fixtures/no-redundant-api-copy/good-concise-cli.tsnew file mode 100644index 00000000000..2e752b04584--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-concise-cli.ts@@ -0,0 +1,6 @@+import { Command } from 'commander';++export const taskCommand = new Command('task')+ .command('create')+ .description('Create a new task')+ .requiredOption('--instruction <text>', 'Task instruction');diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-internal-compatibility.ts b/packages/alint/fixtures/no-redundant-api-copy/good-internal-compatibility.tsnew file mode 100644index 00000000000..4cfb4001498--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-internal-compatibility.ts@@ -0,0 +1,5 @@+import { z } from 'zod';++// Released clients send T by default. Strip that obsolete input so server-owned+// project identifiers stay authoritative while legacy requests still succeed.+export const CreateTaskRequestSchema = z.object({ instruction: z.string() });diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-migration.md b/packages/alint/fixtures/no-redundant-api-copy/good-migration.mdnew file mode 100644index 00000000000..0dd668a4a81--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-migration.md@@ -0,0 +1,7 @@+# Migrating legacy task clients++## Upgrade from the custom-prefix API++The `--prefix` option was removed. Stop passing that option when upgrading your scripts.+For existing REST clients, remove `identifierPrefix` from requests; old payloads remain+accepted, and their supplied prefix is ignored in favor of the server-assigned identifier.diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-operational-limit.md b/packages/alint/fixtures/no-redundant-api-copy/good-operational-limit.mdnew file mode 100644index 00000000000..e79abd300e6--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-operational-limit.md@@ -0,0 +1,6 @@+# Task troubleshooting++Moving a task between projects is not supported. Create a task in the destination+project and link the original task when organizing work across projects.++If creation returns `FORBIDDEN`, check that your account has access to the workspace.diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-review-instructions.md b/packages/alint/fixtures/no-redundant-api-copy/good-review-instructions.mdnew file mode 100644index 00000000000..42c261a2758--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-review-instructions.md@@ -0,0 +1,5 @@+# Reviewing removal changes++Owner quote: “文档中不要留下这种「CLI 不接受 `--prefix`。」”++Preserve unrelated descriptions and existing skill markup when reviewing a diff.diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-schema-semantics.ts b/packages/alint/fixtures/no-redundant-api-copy/good-schema-semantics.tsnew file mode 100644index 00000000000..0d54b05b0a8--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-schema-semantics.ts@@ -0,0 +1,6 @@+import { z } from 'zod';++export const CreateTaskRequestSchema = z.object({+ instruction: z.string().min(1).describe('Work to perform; must contain at least one character'),+ timeout: z.number().default(60).describe('Timeout in seconds; omitted values use 60 seconds'),+});diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-skill-markup.ts b/packages/alint/fixtures/no-redundant-api-copy/good-skill-markup.tsnew file mode 100644index 00000000000..36f76986fb1--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-skill-markup.ts@@ -0,0 +1,9 @@+export const taskSkill = String.raw`+# Task skill++\<task\_skill\_guides>++Run lh task create --instruction "Review the patch".++\</task\_skill\_guides>+`;diff --git a/packages/alint/fixtures/no-redundant-api-copy/good-useful-default.md b/packages/alint/fixtures/no-redundant-api-copy/good-useful-default.mdnew file mode 100644index 00000000000..ff87d0e6e79--- /dev/null+++ b/packages/alint/fixtures/no-redundant-api-copy/good-useful-default.md@@ -0,0 +1,4 @@+# Task links++Tasks in a project use that project's identifier; tasks without a project use `T`.+Use the identifier returned by the server to share a link to the newly created task.diff --git a/packages/alint/rules/no-redundant-api-copy/rule.alint.toml b/packages/alint/rules/no-redundant-api-copy/rule.alint.tomlnew file mode 100644index 00000000000..90633542bd5--- /dev/null+++ b/packages/alint/rules/no-redundant-api-copy/rule.alint.toml@@ -0,0 +1,15 @@+name = "no-redundant-api-copy"+builtInAgent = "basic-structured"+instruction = """+Review one usage guide, builtin skill/reference, CLI command or public request schema. Team rule: ordinary product instructions explain supported behavior without removal announcements or redundant descriptions.++Do not report migration/release notes, legacy-client guidance, operational or safety limits, troubleshooting, useful defaults/constraints/units/examples, concise command action summaries, internal comments, developer review instructions, tests or skill markup. Negative wording and `.describe()` alone are not violations.++Report only:+1. Copy merely announcing that a command, option or customizable field is absent/removed, without a concrete migration action, troubleshooting scenario or operational decision.+2. A request-schema `.describe()` that merely repeats the schema name, or a command/schema summary repeating default-policy text already stated in the SAME file, with no added input/output semantics. Concise action summaries such as `Create a new task` are exempt.++Anchor once on the redundant sentence or description call. Quote the text and explain why it adds no guidance; suggest deleting it or shortening a verbose command summary to its action. Do not replace it with more removal/default-policy prose or change skill markup.++Use only supplied evidence. If redundancy requires a diff, another file or external requirements to establish, return no finding.+"""