🎨 style(vscode): 清零 lint 欠账

非纯格式的改动:
- logger:info 级日志原先走 console.log(no-console 禁止),改为通过 VS Code
  LogOutputChannel(Output 面板 "Superpowers")输出 info/warn/error,并在
  activate 时注册 dispose
- esbuild.mjs:顶层 await 收进 async main(),失败时退出码 1;构建脚本打印
  进度属正当输出,文件级关闭 no-console 并注明原因
- KanbanPanel 资源路径正则:去掉 `\.\/[^"]+` 分支(已被 `[^"/][^"]*` 完全
  覆盖),匹配结果不变
- webhook/server:onError/onListening 互相引用,改为函数声明消除先用后定义
- SettingsModal:删掉针对未启用规则 react-hooks/exhaustive-deps 的失效
  disable 注释,effect 依赖 [open] 保持不变(按打开时机重置表单是有意的)
- issues.ts 提示词里两处全角空格换成普通空格
- 其余为 node:process / node:buffer 显式导入与 switch 拆行

Claude-Session: https://claude.ai/code/session_01HTMgwaE3woqM5yvsHiuSAa
This commit is contained in:
cruldra committed 2026-08-31 22:33:11 +08:00
1 parent 8c22a29ce5
commit dae1232f19
17 files changed
+60 -29

No files matched your search

+16 -12
View File
@@ -3,15 +3,16 @@
*
* Both the extension host and the webview share access to these entries
* via the panel's message bridge; the webview surfaces them in a modal
* opened from the IssueDetailPanel. Entries are also mirrored to the
* Extension Host console so they remain visible during local debugging.
* opened from the IssueDetailPanel. Entries are also mirrored to a VS Code
* LogOutputChannel ("Superpowers" in the Output panel) so they remain
* visible without the webview and honour the user's log level.
*
* No filesystem persistence — buffer is capped at the last 500 entries
* and lost on extension reload.
*/
import type { Event } from 'vscode'
import { EventEmitter } from 'vscode'
import type { Event, LogOutputChannel } from 'vscode'
import { EventEmitter, window } from 'vscode'
export type LogLevel = 'info' | 'warn' | 'error'
@@ -30,13 +31,14 @@ class Logger {
private buf: LogEntry[] = []
private readonly cap = 500
private readonly emitter = new EventEmitter<LogEntry>()
private readonly channel: LogOutputChannel = window.createOutputChannel('Superpowers', { log: true })
readonly onEntry: Event<LogEntry> = this.emitter.event
/**
* Record a new entry. Stamps with the current time, trims the buffer to
* the last `cap` entries, fires the change event, and mirrors to the
* Extension Host console.
* output channel.
*/
add(entry: Omit<LogEntry, 'ts'>): void {
const full: LogEntry = { ...entry, ts: Date.now() }
@@ -45,16 +47,13 @@ class Logger {
this.buf.splice(0, this.buf.length - this.cap)
const line = `[${full.source}] ${full.message}`
// Mirror to Extension Host console for parity with existing console.warn/error.
const args = full.details === undefined ? [] : [full.details]
if (full.level === 'error')
console.error(line, full.details ?? '')
this.channel.error(line, ...args)
else if (full.level === 'warn')
console.warn(line, full.details ?? '')
this.channel.warn(line, ...args)
else
console.log(line, full.details ?? '')
this.channel.info(line, ...args)
this.emitter.fire(full)
}
@@ -68,6 +67,11 @@ class Logger {
clear(): void {
this.buf = []
}
dispose(): void {
this.channel.dispose()
this.emitter.dispose()
}
}
export const logger = new Logger()