Repository navigation
feat(question): colorize tools question log digest #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dca5852
feat(question): colorize tools question log digest
genesiscz 92c07ee
feat(question): answer body always yellow (chip stays tag-tinted)
genesiscz 7c6b0e8
feat(question): shared formatQaEntry — tail == log + -n backlog
genesiscz 12d8b88
feat(question): show session id + 'tools claude resume' hint per entry
genesiscz 414a9f2
fix(question): telegram delivery (per-sink 9s budget) + rich notif he…
genesiscz 4a32335
fix(question): address PR #173 review (t2 CI format, t4 strict flag v…
genesiscz 46fb2ed
refactor(question): chalk → picocolors (t1 — codebase convention)
genesiscz f0e564e
chore(question): biome format/import-sort — fix PR #173 CI
genesiscz e02734a
chore(question): biome format log.ts/tail.ts/format.ts (complete PR #…
genesiscz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import pc from "picocolors"; | ||
| import type { QaEntry } from "./types"; | ||
|
|
||
| // picocolors (the codebase convention over chalk) auto-detects stdout: full | ||
| // color on a TTY, no-ops when piped/redirected — colorful in a terminal, | ||
| // clean ANSI-free for `| tools json`. | ||
| const TAG_TINT: Record<string, (s: string) => string> = { | ||
| question: (s) => pc.bold(pc.blue(s)), | ||
| action: (s) => pc.bold(pc.yellow(s)), | ||
| directive: (s) => pc.bold(pc.green(s)), | ||
| }; | ||
|
|
||
| type FormattableEntry = Pick<QaEntry, "ts" | "project" | "branch" | "tag" | "question" | "answerMd" | "sessionId">; | ||
|
|
||
| /** | ||
| * Single source of truth for one Q→A entry's terminal rendering. Used by both | ||
| * `tools question log` (newest-first digest) and `tools question tail` (live | ||
| * feed) so they are visually identical per entry. | ||
| */ | ||
| export function formatQaEntry(e: FormattableEntry): string { | ||
| const when = new Date(e.ts).toISOString().slice(0, 16).replace("T", " "); | ||
| const tint = TAG_TINT[e.tag] ?? ((s: string) => pc.bold(pc.gray(s))); | ||
| const head = `${pc.dim(when)} ${pc.bold(pc.cyan(e.project))} ${pc.dim("·")} ${pc.magenta(e.branch ?? "-")} ${tint(`[${e.tag}]`)}`; | ||
| const preview = pc.yellow(e.answerMd.split("\n").slice(0, 3).join("\n")); | ||
| const sid = e.sessionId && e.sessionId !== "unknown" ? e.sessionId.slice(0, 8) : null; | ||
| const resume = sid ? pc.dim(` ↩ ${sid} · tools claude resume ${sid}\n`) : ""; | ||
| return `${head}\n${pc.green("❯")} ${pc.bold(e.question)}\n${preview}\n${resume}`; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.