mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
refactor: notify/footer 持久配置收编到 config/,chrome bridge 地址固定
仓库规则要求 config/ 为唯一配置来源、不以环境变量作持久默认值: - pi-notify 改读 config/pi-notify.json(逐字段校验回退,复用原 parsers 钳制) - pi-minimal-footer 改读 config/pi-minimal-footer.json - pi-chrome 移除 PI_CHROME_BRIDGE_HOST/PORT,固定 127.0.0.1:17318 (浏览器端 service_worker.js 硬编码同一地址,单侧可配只会断连) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
0c45b1a438
commit
e996f59469
@@ -15,6 +15,7 @@ import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { homedir } from "node:os";
|
||||
import { collectFooterStatusItems } from "./status.ts";
|
||||
import { readFooterSettings } from "./settings.ts";
|
||||
|
||||
// ============ Types ============
|
||||
|
||||
@@ -43,19 +44,6 @@ interface GitCache {
|
||||
const USAGE_REFRESH_INTERVAL = 5 * 60_000; // 5 minutes
|
||||
const usageCache = new Map<string, UsageSnapshot>(); // keyed by provider
|
||||
|
||||
// ============ Env Flags ============
|
||||
|
||||
function parseBooleanEnv(value: string | undefined, fallback: boolean): boolean {
|
||||
if (value === undefined) return fallback;
|
||||
|
||||
const normalized = value.trim().toLowerCase();
|
||||
if (!normalized) return fallback;
|
||||
|
||||
if (["1", "true", "yes", "on"].includes(normalized)) return true;
|
||||
if (["0", "false", "no", "off"].includes(normalized)) return false;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
// ============ Identity Cache ============
|
||||
|
||||
let codexEmailPrefix: string | null | undefined; // undefined = not yet resolved
|
||||
@@ -754,9 +742,8 @@ export default function (pi: ExtensionAPI) {
|
||||
const BAR_FILLED = "━";
|
||||
const BAR_EMPTY = "─";
|
||||
|
||||
// Optional visibility toggles (default: enabled)
|
||||
const showCwd = parseBooleanEnv(process.env.PI_MINIMAL_FOOTER_SHOW_CWD, true);
|
||||
const showBranch = parseBooleanEnv(process.env.PI_MINIMAL_FOOTER_SHOW_BRANCH, true);
|
||||
// Optional visibility toggles from bundle config (default: enabled)
|
||||
const { showCwd, showBranch } = readFooterSettings();
|
||||
|
||||
function formatTokenCount(tokens: number): string {
|
||||
if (tokens >= 1_000_000) {
|
||||
|
||||
Reference in New Issue
Block a user