Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["ultracite/core"],
"plugins": [
"./lint-rules/no-stdout-write-in-commands.grit",
"./lint-rules/no-process-stdout-in-commands.grit"
],
"files": {
"includes": ["!docs", "!test/init-eval/templates"]
},
Expand Down Expand Up @@ -77,6 +81,31 @@
}
}
}
},
{
// Commands must use colorTag() from markdown.ts — not raw chalk.
// Raw chalk bypasses the plain-output pipeline (NO_COLOR, SENTRY_PLAIN_OUTPUT).
"includes": ["src/commands/**/*.ts"],
"linter": {
"rules": {
"style": {
"noRestrictedImports": {
"level": "error",
"options": {
"paths": {
"@stricli/core": {
"importNames": ["buildCommand"],
"message": "Import buildCommand from '../lib/command.js' instead. The wrapper injects telemetry, --log-level, and --verbose."
},
"chalk": {
"message": "Use colorTag() from formatters/markdown.js for colored output. Raw chalk bypasses the plain-output pipeline (NO_COLOR, SENTRY_PLAIN_OUTPUT)."
}
}
}
}
}
}
}
}
]
}
5 changes: 5 additions & 0 deletions lint-rules/no-process-stdout-in-commands.grit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file($name, $body) where {
$name <: r".*src/commands/.*",
$body <: contains `process.stdout` as $access,
register_diagnostic(span=$access, message="Don't use process.stdout in commands. Yield CommandOutput and let the buildCommand wrapper handle output.")
}
5 changes: 5 additions & 0 deletions lint-rules/no-stdout-write-in-commands.grit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file($name, $body) where {
$name <: r".*src/commands/.*",
$body <: contains `stdout.write($args)` as $call,
register_diagnostic(span=$call, message="Don't call stdout.write() in commands. Yield CommandOutput instead and let the buildCommand wrapper handle output rendering.")
}
9 changes: 5 additions & 4 deletions src/commands/issue/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { buildCommand } from "../../lib/command.js";
import {
formatEventDetails,
formatIssueDetails,
isPlainOutput,
muted,
} from "../../lib/formatters/index.js";
import { CommandOutput } from "../../lib/formatters/output.js";
Expand Down Expand Up @@ -159,11 +160,11 @@ export const viewCommand = buildCommand({
if (spanTreeResult) {
spanTreeLines = spanTreeResult.lines;
} else if (!orgSlug) {
spanTreeLines = [
muted("\nOrganization context required to fetch span tree."),
];
const msg = "\nOrganization context required to fetch span tree.";
spanTreeLines = [isPlainOutput() ? msg : muted(msg)];
} else if (!event) {
spanTreeLines = [muted("\nCould not fetch event to display span tree.")];
const msg = "\nCould not fetch event to display span tree.";
spanTreeLines = [isPlainOutput() ? msg : muted(msg)];
}

const trace = spanTreeResult?.success
Expand Down
Loading