oh-pi 0.1.36 → 0.1.38

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.
package/dist/index.js CHANGED
@@ -44,7 +44,6 @@ async function quickFlow(env) {
44
44
  theme: "dark",
45
45
  keybindings: "default",
46
46
  extensions: ["safe-guard", "git-guard", "auto-session-name", "custom-footer", "compact-header", "auto-update"],
47
- skills: ["quick-setup", "debug-helper", "git-workflow", "context7", "web-search", "web-fetch", "liquid-glass", "glassmorphism", "claymorphism", "neubrutalism"],
48
47
  prompts: ["review", "fix", "explain", "commit", "test"],
49
48
  agents: "general-developer",
50
49
  thinking: "medium",
@@ -104,7 +103,6 @@ async function customFlow(env) {
104
103
  theme,
105
104
  keybindings,
106
105
  extensions,
107
- skills: ["quick-setup", "debug-helper", "git-workflow", "context7", "web-search", "web-fetch", "liquid-glass", "glassmorphism", "claymorphism", "neubrutalism"],
108
106
  prompts: ["review", "fix", "explain", "commit", "test", "refactor", "optimize", "security", "document", "pr"],
109
107
  agents,
110
108
  thinking: "medium",
@@ -15,7 +15,6 @@ export async function confirmApply(config, env) {
15
15
  `${t("confirm.thinking")} ${chalk.cyan(config.thinking)}`,
16
16
  `${t("confirm.compaction")} ${chalk.cyan(t("confirm.compactionValue", { pct: Math.round((config.compactThreshold ?? 0.75) * 100) }))}`,
17
17
  `${t("confirm.extensions")} ${chalk.cyan(config.extensions.join(", ") || t("confirm.none"))}`,
18
- `${t("confirm.skills")} ${chalk.cyan(config.skills.join(", ") || t("confirm.none"))}`,
19
18
  `${t("confirm.prompts")} ${chalk.cyan(t("confirm.promptsValue", { count: config.prompts.length }))}`,
20
19
  `${t("confirm.agents")} ${chalk.cyan(config.agents)}`,
21
20
  ].join("\n");
@@ -24,7 +23,6 @@ export async function confirmApply(config, env) {
24
23
  if (env.hasExistingConfig) {
25
24
  const diff = [
26
25
  `Extensions: ${chalk.dim(countExisting(env, "extensions"))} ${chalk.yellow("→")} ${chalk.green(config.extensions.length)}`,
27
- `Skills: ${chalk.dim(countExisting(env, "skills"))} ${chalk.yellow("→")} ${chalk.green(config.skills.length)}`,
28
26
  `Prompts: ${chalk.dim(countExisting(env, "prompts"))} ${chalk.yellow("→")} ${chalk.green(config.prompts.length)}`,
29
27
  ].join("\n");
30
28
  p.note(diff, t("confirm.changes"));
@@ -80,7 +78,7 @@ export async function confirmApply(config, env) {
80
78
  `${chalk.gray("├── ")}AGENTS.md ${chalk.dim(config.agents)}`,
81
79
  ...(config.extensions.length > 0 ? [`${chalk.gray("├── ")}extensions/ ${chalk.dim(`${config.extensions.length} items`)}`] : []),
82
80
  ...(config.prompts.length > 0 ? [`${chalk.gray("├── ")}prompts/ ${chalk.dim(`${config.prompts.length} templates`)}`] : []),
83
- ...(config.skills.length > 0 ? [`${chalk.gray("├── ")}skills/ ${chalk.dim(`${config.skills.length} skills`)}`] : []),
81
+ `${chalk.gray("├── ")}skills/ ${chalk.dim("auto-discovered")}`,
84
82
  ...(!["dark", "light"].includes(config.theme) ? [`${chalk.gray("└── ")}themes/ ${chalk.dim(config.theme)}`] : []),
85
83
  ].join("\n");
86
84
  p.note(tree, t("confirm.installed"));
@@ -6,7 +6,6 @@ const PRESETS = {
6
6
  config: {
7
7
  theme: "dark", keybindings: "default", thinking: "medium",
8
8
  extensions: ["safe-guard", "git-guard", "auto-session-name", "custom-footer", "compact-header", "auto-update"],
9
- skills: ["quick-setup", "debug-helper", "context7", "web-search", "web-fetch"],
10
9
  prompts: ["review", "fix", "explain", "commit"],
11
10
  agents: "general-developer",
12
11
  },
@@ -16,7 +15,6 @@ const PRESETS = {
16
15
  config: {
17
16
  theme: "catppuccin-mocha", keybindings: "default", thinking: "high",
18
17
  extensions: ["safe-guard", "git-guard", "auto-session-name", "custom-footer", "compact-header", "auto-update"],
19
- skills: ["quick-setup", "debug-helper", "git-workflow", "context7", "web-search", "web-fetch", "liquid-glass", "glassmorphism", "claymorphism", "neubrutalism"],
20
18
  prompts: ["review", "fix", "explain", "commit", "test", "refactor", "optimize", "document", "pr"],
21
19
  agents: "fullstack-developer",
22
20
  },
@@ -26,7 +24,6 @@ const PRESETS = {
26
24
  config: {
27
25
  theme: "cyberpunk", keybindings: "default", thinking: "high",
28
26
  extensions: ["safe-guard", "custom-footer", "compact-header", "auto-update"],
29
- skills: ["debug-helper", "context7", "web-search", "web-fetch"],
30
27
  prompts: ["review", "security", "fix", "explain"],
31
28
  agents: "security-researcher",
32
29
  },
@@ -36,7 +33,6 @@ const PRESETS = {
36
33
  config: {
37
34
  theme: "tokyo-night", keybindings: "default", thinking: "medium",
38
35
  extensions: ["safe-guard", "git-guard", "auto-session-name", "custom-footer", "compact-header", "auto-update"],
39
- skills: ["quick-setup", "debug-helper", "context7", "web-search", "web-fetch"],
40
36
  prompts: ["review", "fix", "explain", "optimize", "document", "test"],
41
37
  agents: "data-ai-engineer",
42
38
  },
@@ -45,7 +41,7 @@ const PRESETS = {
45
41
  labelKey: "preset.minimal", hintKey: "preset.minimalHint",
46
42
  config: {
47
43
  theme: "dark", keybindings: "default", thinking: "off",
48
- extensions: [], skills: [], prompts: [], agents: "general-developer",
44
+ extensions: [], prompts: [], agents: "general-developer",
49
45
  },
50
46
  },
51
47
  full: {
@@ -53,7 +49,6 @@ const PRESETS = {
53
49
  config: {
54
50
  theme: "dark", keybindings: "default", thinking: "high",
55
51
  extensions: ["safe-guard", "git-guard", "auto-session-name", "custom-footer", "compact-header", "ant-colony", "auto-update"],
56
- skills: ["quick-setup", "debug-helper", "git-workflow", "ant-colony", "context7", "web-search", "web-fetch", "liquid-glass", "glassmorphism", "claymorphism", "neubrutalism"],
57
52
  prompts: ["review", "fix", "explain", "commit", "test", "refactor", "optimize", "security", "document", "pr"],
58
53
  agents: "colony-operator",
59
54
  },
package/dist/types.d.ts CHANGED
@@ -27,8 +27,6 @@ export interface OhPConfig {
27
27
  keybindings: string;
28
28
  /** 启用的扩展列表 */
29
29
  extensions: string[];
30
- /** 启用的技能列表 */
31
- skills: string[];
32
30
  /** 提示词模板列表 */
33
31
  prompts: string[];
34
32
  /** Agent 配置路径 */
@@ -159,18 +159,18 @@ export function applyConfig(config) {
159
159
  }
160
160
  catch { /* skip */ }
161
161
  }
162
- // 8. Copy skills
162
+ // 8. Copy skills (auto-discover all from pi-package/skills/)
163
163
  const skillDir = join(agentDir, "skills");
164
164
  cleanDir(skillDir);
165
- for (const s of config.skills) {
166
- const srcDir = resources.skill(s);
167
- const destDir = join(skillDir, s);
168
- ensureDir(destDir);
169
- try {
170
- copyFileSync(join(srcDir, "SKILL.md"), join(destDir, "SKILL.md"));
165
+ const skillsSrcDir = resources.skillsDir();
166
+ try {
167
+ for (const entry of readdirSync(skillsSrcDir, { withFileTypes: true })) {
168
+ if (entry.isDirectory() && existsSync(join(skillsSrcDir, entry.name, "SKILL.md"))) {
169
+ copyDir(join(skillsSrcDir, entry.name), join(skillDir, entry.name));
170
+ }
171
171
  }
172
- catch { /* skip */ }
173
172
  }
173
+ catch { /* skills dir not found, skip */ }
174
174
  // 9. Copy themes (only custom ones)
175
175
  const themeDir = join(agentDir, "themes");
176
176
  cleanDir(themeDir);
@@ -4,5 +4,6 @@ export declare const resources: {
4
4
  extensionFile: (name: string) => string;
5
5
  prompt: (name: string) => string;
6
6
  skill: (name: string) => string;
7
+ skillsDir: () => string;
7
8
  theme: (name: string) => string;
8
9
  };
@@ -11,5 +11,6 @@ export const resources = {
11
11
  extensionFile: (name) => join(RESOURCES, "extensions", `${name}.ts`),
12
12
  prompt: (name) => join(RESOURCES, "prompts", `${name}.md`),
13
13
  skill: (name) => join(RESOURCES, "skills", name),
14
+ skillsDir: () => join(RESOURCES, "skills"),
14
15
  theme: (name) => join(RESOURCES, "themes", `${name}.json`),
15
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-pi",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "One-click setup for pi-coding-agent. Like oh-my-zsh for pi.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -241,21 +241,79 @@ For simple single-file tasks, work directly without the colony.`,
241
241
  const details = result.details as ColonyDetails | undefined;
242
242
 
243
243
  // ─── 运行中 ───
244
- if (!details?.state) {
244
+ if (!details?.state || (details.state.status !== "done" && details.state.status !== "failed")) {
245
+ const state = details?.state;
245
246
  const log = details?.log ?? [];
246
247
  const container = new Container();
247
- container.addChild(new Text(
248
- theme.fg("warning", "🐜 ") + theme.fg("toolTitle", theme.bold("Colony ")) +
249
- theme.fg("accent", details?.phase || "initializing..."),
250
- 0, 0,
251
- ));
252
- const recent = log.slice(expanded ? -20 : -5);
253
- if (recent.length > 0) {
254
- container.addChild(new Text(recent.map(l => theme.fg("dim", ` ${l}`)).join("\n"), 0, 0));
248
+
249
+ if (state) {
250
+ const m = state.metrics;
251
+ const elapsed = formatDuration(Date.now() - state.createdAt);
252
+
253
+ // 标题行:● N ants launched (phase)
254
+ const activeAnts = state.ants.filter(a => a.status === "working");
255
+ const totalAnts = state.ants.length;
256
+ container.addChild(new Text(
257
+ theme.fg("warning", "● ") +
258
+ theme.fg("toolTitle", theme.bold(`${totalAnts} ant${totalAnts !== 1 ? "s" : ""} launched `)) +
259
+ theme.fg("muted", `(${state.status}) `) +
260
+ theme.fg("dim", `${elapsed} │ ${formatCost(m.totalCost)}`),
261
+ 0, 0,
262
+ ));
263
+
264
+ // 进度条
265
+ if (m.tasksTotal > 0) {
266
+ container.addChild(new Text(` ${progressBar(m.tasksDone, m.tasksTotal, 20, theme)}`, 0, 0));
267
+ }
268
+
269
+ // 蚂蚁树
270
+ const ants = expanded ? state.ants : state.ants.slice(-8);
271
+ for (let i = 0; i < ants.length; i++) {
272
+ const a = ants[i];
273
+ const isLast = i === ants.length - 1;
274
+ const branch = isLast ? "└─" : "├─";
275
+ const pipe = isLast ? " " : "│ ";
276
+
277
+ const statusDot = a.status === "working" ? theme.fg("warning", "◉")
278
+ : a.status === "done" ? theme.fg("success", "✓")
279
+ : theme.fg("error", "✗");
280
+
281
+ const task = state.tasks.find(t => t.id === a.taskId);
282
+ const taskTitle = task?.title?.slice(0, 55) || "...";
283
+ const dur = a.finishedAt ? formatDuration(a.finishedAt - a.startedAt) : formatDuration(Date.now() - a.startedAt);
284
+ const turns = a.usage.turns > 0 ? `${a.usage.turns}t` : "";
285
+
286
+ container.addChild(new Text(
287
+ theme.fg("muted", ` ${branch} `) + statusDot + " " +
288
+ theme.fg("accent", `@${a.id.slice(0, 20)} `) +
289
+ theme.fg("dim", `(${a.caste}) ${dur}${turns ? " │ " + turns : ""}`),
290
+ 0, 0,
291
+ ));
292
+ container.addChild(new Text(
293
+ theme.fg("muted", ` ${pipe}`) + theme.fg("dim", `⎿ ${taskTitle}`),
294
+ 0, 0,
295
+ ));
296
+ }
297
+ if (!expanded && state.ants.length > 8) {
298
+ container.addChild(new Text(theme.fg("muted", ` ⋯ +${state.ants.length - 8} more (expand to see all)`), 0, 0));
299
+ }
300
+ } else {
301
+ container.addChild(new Text(
302
+ theme.fg("warning", "● ") + theme.fg("toolTitle", theme.bold("Colony ")) +
303
+ theme.fg("accent", details?.phase || "initializing..."),
304
+ 0, 0,
305
+ ));
255
306
  }
256
- if (!expanded && log.length > 5) {
257
- container.addChild(new Text(theme.fg("muted", ` ⋯ ${log.length - 5} more`), 0, 0));
307
+
308
+ // 最近日志(仅展开时)
309
+ if (expanded && log.length > 0) {
310
+ container.addChild(new Spacer(1));
311
+ const recent = log.slice(-10);
312
+ for (const l of recent) {
313
+ container.addChild(new Text(theme.fg("dim", ` ${l}`), 0, 0));
314
+ }
258
315
  }
316
+
259
317
  return container;
260
318
  }
261
319