Skip to content

Commit 6b0091a

Browse files
committed
refactor(comments): exempt TSDoc tags, drop test carve-outs, strip obvious comments
GEN-004 was measuring the wrong thing: a flat prose bound made TSDoc tags compete with the summary for budget, so an earlier sweep dissolved 8 @param tags and an @example into prose. Three changes fix that. 1. Structured documentation is exempt. A structural TSDoc tag (@param, @returns, @throws, @example, @see, @typeparam, ...) opens a section that does not count toward the 5-line bound — its length tracks the API surface, not narrative. Prose containers (@remarks, @description, @notes, @todo, @fixme) still count, so relabelling narrative cannot buy budget. Implemented identically in both layers. 2. No directory-level carve-outs. The tests/** size exemption and the tests/fixtures/** full exemption are gone from .oxlintrc.json and the companion rules file; the ADR now records that any future exemption belongs in the ADR, not in lint config. Removing them surfaced only 10 blocks and zero narration, because the tag exemption covers the reason test comments legitimately grow. 3. Obvious comments removed. A 12-agent sweep over 238 files deleted 248 comments that restate the code they sit above, keeping every comment carrying a why, an invariant, a footgun, a security property, or a pointer. Verified by diffing ADR references, issue links, and TSDoc tags per file: no net loss anywhere except duplicate copies of one upstream bug link. Also restores the tags the earlier sweep dissolved, syncs rules-shim.ts (the user-facing rules.d.ts) with formats/rules.ts, and rescues the CLI perf baselines into agent memory. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
1 parent f2c9a1c commit 6b0091a

135 files changed

Lines changed: 642 additions & 776 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.archgate/adrs/ARCH-005-testing-standards.rules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export default {
99
description: "Test directory structure should mirror src/ structure",
1010
severity: "error",
1111
async check(ctx) {
12-
// Get all src modules (non-index, non-cli.ts)
1312
const srcFiles = await ctx.glob("src/**/*.ts");
1413
const testFiles = await ctx.glob("tests/**/*.test.ts");
1514

.archgate/adrs/ARCH-007-cross-platform-subprocess-execution.rules.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default {
1010
(f) => !f.includes("tests/") && !f.includes(".archgate/")
1111
);
1212

13-
// Check for Bun.$ template literal usage
1413
const bunShellMatches = await Promise.all(
1514
files.map((file) => ctx.grep(file, /Bun\.\$`/u))
1615
);
@@ -26,7 +25,6 @@ export default {
2625
}
2726
}
2827

29-
// Check for $ import from "bun" (the shell API)
3028
const dollarImportMatches = await Promise.all(
3129
files.map((file) =>
3230
ctx.grep(file, /import\s*\{[^}]*\$[^}]*\}\s*from\s*["']bun["']/u)
@@ -44,7 +42,6 @@ export default {
4442
}
4543
}
4644

47-
// Check for await $` pattern (destructured $ usage)
4845
const destructuredMatches = await Promise.all(
4946
files.map((file) => ctx.grep(file, /await\s+\$`/u))
5047
);

.archgate/adrs/ARCH-008-typed-command-options.rules.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
* Description strings that enumerate a fixed set of values, e.g.
1212
* "editor integration to configure (claude, cursor, vscode, copilot)" or
1313
* "ADR domain: backend, frontend, data, architecture, general".
14-
* Same heuristic as the previous regex rule, but applied to the parsed
15-
* Literal VALUE rather than raw source text.
14+
* Matched against the parsed Literal VALUE, not raw source text.
1615
*/
1716
const CHOICE_ENUMERATION = /(?:claude.*cursor|backend.*frontend)/u;
1817

.archgate/adrs/ARCH-012-command-error-boundaries.rules.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ export default {
147147
"Async command actions must include try-catch error boundaries",
148148
severity: "warning",
149149
async check(ctx) {
150-
// Only check non-index command files
151150
const files = ctx.scopedFiles.filter(
152151
(f) => f.includes("commands/") && !f.endsWith("index.ts")
153152
);
@@ -229,15 +228,13 @@ export default {
229228
description:
230229
"Catch blocks in async command actions must re-throw ExitPromptError for proper Ctrl+C handling (exit 130)",
231230
async check(ctx) {
232-
// Only check non-index command files that have async actions
233231
const files = ctx.scopedFiles.filter(
234232
(f) => f.includes("commands/") && !f.endsWith("index.ts")
235233
);
236234

237235
const checks = files.map(async (file) => {
238236
const content = await ctx.readFile(file);
239237

240-
// Only check files with async actions that have try-catch
241238
const hasAsyncActionWithTryCatch =
242239
/\.action\(\s*async\s[\s\S]*?\btry\s*\{/u.test(content);
243240
if (!hasAsyncActionWithTryCatch) return;

.archgate/adrs/ARCH-015-cli-command-documentation-coverage.rules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default {
3535
commandNames.add(name);
3636
}
3737

38-
// Collect docs stems.
3938
const docFiles = await ctx.glob(`${DOCS_DIR}/*.mdx`);
4039
const docStems = new Set<string>();
4140
for (const file of docFiles) {

.archgate/adrs/ARCH-016-cli-subcommand-documentation-accuracy.rules.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@ export default {
1616
// is checked: deeper files like adr/domain/add.ts are sub-subcommands
1717
// documented as a table in the parent's section, not as headings.
1818

19-
// Find all parent command groups (dirs with an index.ts).
2019
const groupIndexFiles = await ctx.glob(`${COMMANDS_DIR}/*/index.ts`);
2120

22-
// Extract parent names from index files.
2321
const parentNames = groupIndexFiles.map((indexFile) => {
2422
const rel = indexFile.slice(COMMANDS_DIR.length + 1);
2523
return rel.split("/")[0];
2624
});
2725

28-
// Discover subcommands for all parents in parallel.
2926
const subResults = await Promise.all(
3027
parentNames.map(async (parentName) => {
3128
const [subFiles, nestedGroupFiles] = await Promise.all([
@@ -35,7 +32,6 @@ export default {
3532

3633
const subs = new Set<string>();
3734

38-
// Single-file subcommands
3935
for (const sf of subFiles) {
4036
const fileName = sf.slice(
4137
`${COMMANDS_DIR}/${parentName}/`.length
@@ -44,7 +40,6 @@ export default {
4440
subs.add(fileName.slice(0, -".ts".length));
4541
}
4642

47-
// Nested command groups
4843
for (const ngf of nestedGroupFiles) {
4944
const nestedRel = ngf.slice(
5045
`${COMMANDS_DIR}/${parentName}/`.length
@@ -68,7 +63,6 @@ export default {
6863
// ### archgate adr domain
6964
const headingPattern = /^#{1,4}\s+.*archgate\s+(\S+)\s+(\S+)/giu;
7065

71-
// Read all docs files in parallel.
7266
const docsResults = await Promise.all(
7367
[...subcommandsByParent.entries()].map(
7468
async ([parentName, subNames]) => {
@@ -85,7 +79,6 @@ export default {
8579
)
8680
);
8781

88-
// Report violations.
8982
for (const {
9083
parentName,
9184
subNames,
@@ -94,7 +87,6 @@ export default {
9487
} of docsResults) {
9588
if (docsContent === null) continue;
9689

97-
// Extract documented subcommand names from headings
9890
const documentedSubs = new Set<string>();
9991
let match;
10092
headingPattern.lastIndex = 0;

.archgate/adrs/ARCH-022-ast-aware-rule-context.rules.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ export default {
7272
}
7373
return;
7474
}
75-
// Fallback: inline `ast(path, language) { … }` object method, in
76-
// case the implementation is ever moved back onto the object.
75+
// Fallback: inline `ast(path, language) { … }` object method, for
76+
// an implementation that lives directly on the returned object.
7777
if (n.type === "Property") {
7878
const key = n.key as (EsTreeNode & { name?: string }) | undefined;
7979
const value = n.value as EsTreeNode | undefined;

.archgate/adrs/CI-001-pin-github-actions-by-hash.rules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default {
4242
);
4343

4444
for (const m of matches) {
45-
// Extract the full `uses:` value from the matched line
4645
const usesMatch = m.content.match(
4746
/uses:\s+(?!\.\/|docker:\/\/)(\S+@\S+)/u
4847
);

.archgate/adrs/GEN-002-docs-i18n.rules.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const LOCALES = ["pt-br", "nb"];
99

1010
const CONTENT_ROOT = "docs/src/content/docs";
1111

12-
/** Patterns that match locale-prefixed internal links in MDX files. */
1312
const LOCALE_LINK_PATTERNS = LOCALES.map(
1413
(locale) => new RegExp(`(?:href="|\\]\\()/${locale}/`, "gu")
1514
);
@@ -53,7 +52,6 @@ export default {
5352
async check(ctx) {
5453
const allMdxFiles = await ctx.glob(`${CONTENT_ROOT}/**/*.mdx`);
5554

56-
// Separate root files from locale files
5755
const rootFiles: string[] = [];
5856
const localeFiles = new Map<string, string[]>();
5957

@@ -128,7 +126,6 @@ export default {
128126

129127
if (changedRootFiles.length === 0) return;
130128

131-
// Pre-build a set of all existing locale files for fast lookup
132129
const localeFileArrays = await Promise.all(
133130
LOCALES.map((locale) =>
134131
ctx.glob(`${CONTENT_ROOT}/${locale}/**/*.mdx`)

.archgate/adrs/GEN-003-tool-invocation-via-scripts.rules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default {
1313
"Lint/format tools must be invoked via package.json scripts, not bunx/npx",
1414
severity: "error",
1515
async check(ctx) {
16-
// Build an alternation like (prettier|oxfmt|oxlint|eslint|biome).
1716
const toolGroup = LINT_FORMAT_TOOLS.join("|");
1817
// Match `bunx <tool>` or `npx <tool>`, allowing flags between the
1918
// runner and the tool name (e.g. `bunx --bun oxfmt`).

0 commit comments

Comments
 (0)