pi-cc-extensions 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,109 +1,109 @@
1
- import type { ColorScheme, PresetDef, StatusLinePreset } from "./types.ts";
2
- import { getDefaultColors } from "./theme.ts";
3
-
4
- // Get base colors from theme.ts (single source of truth)
5
- const DEFAULT_COLORS: ColorScheme = getDefaultColors();
6
-
7
- // Minimal - more muted, less colorful
8
- const MINIMAL_COLORS: ColorScheme = {
9
- ...DEFAULT_COLORS,
10
- model: "text",
11
- path: "text",
12
- gitClean: "dim",
13
- };
14
-
15
- // Nerd - vibrant colors
16
- const NERD_COLORS: ColorScheme = {
17
- ...DEFAULT_COLORS,
18
- model: "accent",
19
- path: "success",
20
- tokens: "muted",
21
- cost: "warning",
22
- };
23
-
24
- export const PRESETS: Record<StatusLinePreset, PresetDef> = {
25
- default: {
26
- leftSegments: ["model", "thinking", "shell_mode", "path", "git", "context_pct", "cache_read", "cost"],
27
- rightSegments: [],
28
- secondarySegments: ["extension_statuses"],
29
- separator: "powerline-thin",
30
- colors: DEFAULT_COLORS,
31
- segmentOptions: {
32
- model: { showThinkingLevel: false },
33
- path: { mode: "basename" },
34
- git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true },
35
- },
36
- },
37
-
38
- minimal: {
39
- leftSegments: ["shell_mode", "path", "git"],
40
- rightSegments: ["context_pct"],
41
- separator: "slash",
42
- colors: MINIMAL_COLORS,
43
- segmentOptions: {
44
- path: { mode: "basename" },
45
- git: { showBranch: true, showStaged: false, showUnstaged: false, showUntracked: false },
46
- },
47
- },
48
-
49
- compact: {
50
- leftSegments: ["model", "shell_mode", "git"],
51
- rightSegments: ["cost", "context_pct"],
52
- separator: "pipe",
53
- colors: DEFAULT_COLORS,
54
- segmentOptions: {
55
- model: { showThinkingLevel: true },
56
- git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: false },
57
- },
58
- },
59
-
60
- full: {
61
- leftSegments: ["hostname", "model", "thinking", "shell_mode", "path", "git", "subagents"],
62
- rightSegments: ["token_in", "token_out", "cache_read", "cost", "context_pct", "time_spent", "time", "extension_statuses"],
63
- separator: "powerline",
64
- colors: DEFAULT_COLORS,
65
- segmentOptions: {
66
- model: { showThinkingLevel: false },
67
- path: { mode: "abbreviated", maxLength: 50 },
68
- git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true },
69
- time: { format: "24h", showSeconds: false },
70
- },
71
- },
72
-
73
- nerd: {
74
- leftSegments: ["hostname", "model", "thinking", "shell_mode", "path", "git", "session", "subagents"],
75
- rightSegments: ["token_in", "token_out", "cache_read", "cache_write", "cost", "context_pct", "context_total", "time_spent", "time", "extension_statuses"],
76
- separator: "powerline",
77
- colors: NERD_COLORS,
78
- segmentOptions: {
79
- model: { showThinkingLevel: false },
80
- path: { mode: "abbreviated", maxLength: 60 },
81
- git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true },
82
- time: { format: "24h", showSeconds: true },
83
- },
84
- },
85
-
86
- ascii: {
87
- leftSegments: ["model", "shell_mode", "path", "git"],
88
- rightSegments: ["token_total", "cost", "context_pct"],
89
- separator: "ascii",
90
- colors: MINIMAL_COLORS,
91
- segmentOptions: {
92
- model: { showThinkingLevel: true },
93
- path: { mode: "abbreviated", maxLength: 40 },
94
- git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true },
95
- },
96
- },
97
-
98
- custom: {
99
- leftSegments: ["model", "shell_mode", "path", "git"],
100
- rightSegments: ["token_total", "cost", "context_pct"],
101
- separator: "pipe",
102
- colors: DEFAULT_COLORS,
103
- segmentOptions: {},
104
- },
105
- };
106
-
107
- export function getPreset(name: StatusLinePreset): PresetDef {
108
- return PRESETS[name] ?? PRESETS.default;
109
- }
1
+ import type { ColorScheme, PresetDef, StatusLinePreset } from "./types.ts";
2
+ import { getDefaultColors } from "./theme.ts";
3
+
4
+ // Get base colors from theme.ts (single source of truth)
5
+ const DEFAULT_COLORS: ColorScheme = getDefaultColors();
6
+
7
+ // Minimal - more muted, less colorful
8
+ const MINIMAL_COLORS: ColorScheme = {
9
+ ...DEFAULT_COLORS,
10
+ model: "text",
11
+ path: "text",
12
+ gitClean: "dim",
13
+ };
14
+
15
+ // Nerd - vibrant colors
16
+ const NERD_COLORS: ColorScheme = {
17
+ ...DEFAULT_COLORS,
18
+ model: "accent",
19
+ path: "success",
20
+ tokens: "muted",
21
+ cost: "warning",
22
+ };
23
+
24
+ export const PRESETS: Record<StatusLinePreset, PresetDef> = {
25
+ default: {
26
+ leftSegments: ["model", "thinking", "shell_mode", "path", "git", "context_pct", "cache_read", "cost"],
27
+ rightSegments: [],
28
+ secondarySegments: ["extension_statuses"],
29
+ separator: "powerline-thin",
30
+ colors: DEFAULT_COLORS,
31
+ segmentOptions: {
32
+ model: { showThinkingLevel: false },
33
+ path: { mode: "basename" },
34
+ git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true, showLines: true },
35
+ },
36
+ },
37
+
38
+ minimal: {
39
+ leftSegments: ["shell_mode", "path", "git"],
40
+ rightSegments: ["context_pct"],
41
+ separator: "slash",
42
+ colors: MINIMAL_COLORS,
43
+ segmentOptions: {
44
+ path: { mode: "basename" },
45
+ git: { showBranch: true, showStaged: false, showUnstaged: false, showUntracked: false, showLines: false },
46
+ },
47
+ },
48
+
49
+ compact: {
50
+ leftSegments: ["model", "shell_mode", "git"],
51
+ rightSegments: ["cost", "context_pct"],
52
+ separator: "pipe",
53
+ colors: DEFAULT_COLORS,
54
+ segmentOptions: {
55
+ model: { showThinkingLevel: true },
56
+ git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: false, showLines: true },
57
+ },
58
+ },
59
+
60
+ full: {
61
+ leftSegments: ["hostname", "model", "thinking", "shell_mode", "path", "git", "subagents"],
62
+ rightSegments: ["token_in", "token_out", "cache_read", "cost", "context_pct", "time_spent", "time", "extension_statuses"],
63
+ separator: "powerline",
64
+ colors: DEFAULT_COLORS,
65
+ segmentOptions: {
66
+ model: { showThinkingLevel: false },
67
+ path: { mode: "abbreviated", maxLength: 50 },
68
+ git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true, showLines: true },
69
+ time: { format: "24h", showSeconds: false },
70
+ },
71
+ },
72
+
73
+ nerd: {
74
+ leftSegments: ["hostname", "model", "thinking", "shell_mode", "path", "git", "session", "subagents"],
75
+ rightSegments: ["token_in", "token_out", "cache_read", "cache_write", "cost", "context_pct", "context_total", "time_spent", "time", "extension_statuses"],
76
+ separator: "powerline",
77
+ colors: NERD_COLORS,
78
+ segmentOptions: {
79
+ model: { showThinkingLevel: false },
80
+ path: { mode: "abbreviated", maxLength: 60 },
81
+ git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true, showLines: true },
82
+ time: { format: "24h", showSeconds: true },
83
+ },
84
+ },
85
+
86
+ ascii: {
87
+ leftSegments: ["model", "shell_mode", "path", "git"],
88
+ rightSegments: ["token_total", "cost", "context_pct"],
89
+ separator: "ascii",
90
+ colors: MINIMAL_COLORS,
91
+ segmentOptions: {
92
+ model: { showThinkingLevel: true },
93
+ path: { mode: "abbreviated", maxLength: 40 },
94
+ git: { showBranch: true, showStaged: true, showUnstaged: true, showUntracked: true, showLines: false },
95
+ },
96
+ },
97
+
98
+ custom: {
99
+ leftSegments: ["model", "shell_mode", "path", "git"],
100
+ rightSegments: ["token_total", "cost", "context_pct"],
101
+ separator: "pipe",
102
+ colors: DEFAULT_COLORS,
103
+ segmentOptions: {},
104
+ },
105
+ };
106
+
107
+ export function getPreset(name: StatusLinePreset): PresetDef {
108
+ return PRESETS[name] ?? PRESETS.default;
109
+ }
@@ -130,7 +130,7 @@ const gitSegment: StatusLineSegment = {
130
130
  render(ctx) {
131
131
  const icons = getIcons();
132
132
  const opts = ctx.options.git ?? {};
133
- const { branch, staged, unstaged, untracked } = ctx.git;
133
+ const { branch, staged, unstaged, untracked, added, deleted } = ctx.git;
134
134
  const gitStatus = (staged > 0 || unstaged > 0 || untracked > 0)
135
135
  ? { staged, unstaged, untracked }
136
136
  : null;
@@ -169,6 +169,16 @@ const gitSegment: StatusLineSegment = {
169
169
  content += content ? ` ${indicatorText}` : indicatorText;
170
170
  }
171
171
  }
172
+
173
+ // Line-change indicators (added / deleted)
174
+ if (opts.showLines && (added > 0 || deleted > 0)) {
175
+ const lineParts: string[] = [];
176
+ if (added > 0) lineParts.push(applyColor(ctx.theme, "success", `+${added}`));
177
+ if (deleted > 0) lineParts.push(applyColor(ctx.theme, "error", `-${deleted}`));
178
+ if (lineParts.length > 0) {
179
+ content += ` ${lineParts.join(" ")}`;
180
+ }
181
+ }
172
182
  }
173
183
 
174
184
  if (!content) return { content: "", visible: false };
@@ -90,6 +90,7 @@ export interface StatusLineSegmentOptions {
90
90
  showStaged?: boolean;
91
91
  showUnstaged?: boolean;
92
92
  showUntracked?: boolean;
93
+ showLines?: boolean;
93
94
  polling?: "full" | "branch" | "off";
94
95
  };
95
96
  time?: { format?: "12h" | "24h"; showSeconds?: boolean };
@@ -136,6 +137,8 @@ export interface GitStatus {
136
137
  staged: number;
137
138
  unstaged: number;
138
139
  untracked: number;
140
+ added: number;
141
+ deleted: number;
139
142
  }
140
143
 
141
144
  // Usage statistics
@@ -2,7 +2,7 @@
2
2
  // AI-generated contextual working messages that match a user's preferred theme/vibe.
3
3
  // Uses module-level state (matching powerline-footer pattern).
4
4
 
5
- import { complete, type Context } from "@earendil-works/pi-ai";
5
+ import { complete, type Context } from "@earendil-works/pi-ai/compat";
6
6
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
7
7
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
8
8
  import { join, dirname } from "node:path";
@@ -256,10 +256,13 @@ function isToolExpanded(options: any, context: any): boolean {
256
256
 
257
257
  /** Keep the guide aligned when long result lines wrap at the viewport edge. */
258
258
  class ExpandedToolResultText {
259
- constructor(
260
- private readonly text: string,
261
- private readonly prefix: string,
262
- ) {}
259
+ private readonly text: string;
260
+ private readonly prefix: string;
261
+
262
+ constructor(text: string, prefix: string) {
263
+ this.text = text;
264
+ this.prefix = prefix;
265
+ }
263
266
 
264
267
  render(width: number): string[] {
265
268
  const prefixWidth = visibleWidth(this.prefix);
@@ -837,6 +840,25 @@ export default function (pi: ExtensionAPI) {
837
840
 
838
841
  pi.registerCommand("ccstyle", {
839
842
  description: "Configure Claude Code style and Powerline preset",
843
+ getArgumentCompletions: (prefix) => {
844
+ const topLevel = [
845
+ { value: "on", label: "on", description: "Enable Claude Code style" },
846
+ { value: "off", label: "off", description: "Disable Claude Code style" },
847
+ { value: "status", label: "status", description: "Show current toggle and mode" },
848
+ { value: "minimal", label: "minimal", description: "Hide most tool output in collapsed view" },
849
+ { value: "compact", label: "compact", description: "Show short summaries in collapsed view" },
850
+ { value: "powerline", label: "powerline", description: "Set Powerline preset (e.g. powerline compact)" },
851
+ ];
852
+ // If the user typed "powerline " — suggest available presets
853
+ const match = prefix.match(/^powerline\s+/i);
854
+ if (match) {
855
+ const after = prefix.slice(match[0].length);
856
+ return powerline.getPresets()
857
+ .filter((p) => p.startsWith(after))
858
+ .map((p) => ({ value: `powerline ${p}`, label: p, description: `Powerline preset: ${p}` }));
859
+ }
860
+ return topLevel.filter((item) => item.value.startsWith(prefix));
861
+ },
840
862
  handler: async (args, ctx) => {
841
863
  const arg = args.trim().toLowerCase();
842
864
  const parts = arg.split(/\s+/).filter(Boolean);
@@ -11,7 +11,7 @@
11
11
  ## 行为
12
12
 
13
13
  - 搜索全部 pi 历史 Session;当前 Workspace 的 Session 优先。
14
- - Session 模糊查询默认最多显示 3 个候选。
14
+ - Session 模糊查询默认最多显示 5 个候选。
15
15
  - 与 pi 原有 `@` 文件补全并存。
16
16
  - 若已加载 `pi-subagents`,`@` 补全会同时显示现有 SubAgent,并引用其当前有效上下文。
17
17
  - 支持一个 prompt 引用多个 Session,并自动去重;单次最多注入前 5 个。