@oh-my-pi/pi-coding-agent 8.0.16 → 8.1.0

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.
Files changed (166) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/package.json +14 -11
  3. package/scripts/generate-wasm-b64.ts +24 -0
  4. package/src/capability/context-file.ts +1 -1
  5. package/src/capability/extension-module.ts +1 -1
  6. package/src/capability/extension.ts +1 -1
  7. package/src/capability/hook.ts +1 -1
  8. package/src/capability/instruction.ts +1 -1
  9. package/src/capability/mcp.ts +1 -1
  10. package/src/capability/prompt.ts +1 -1
  11. package/src/capability/rule.ts +1 -1
  12. package/src/capability/settings.ts +1 -1
  13. package/src/capability/skill.ts +1 -1
  14. package/src/capability/slash-command.ts +1 -1
  15. package/src/capability/ssh.ts +1 -1
  16. package/src/capability/system-prompt.ts +1 -1
  17. package/src/capability/tool.ts +1 -1
  18. package/src/cli/args.ts +1 -1
  19. package/src/cli/plugin-cli.ts +1 -5
  20. package/src/commit/agentic/agent.ts +309 -0
  21. package/src/commit/agentic/fallback.ts +96 -0
  22. package/src/commit/agentic/index.ts +359 -0
  23. package/src/commit/agentic/prompts/analyze-file.md +22 -0
  24. package/src/commit/agentic/prompts/session-user.md +26 -0
  25. package/src/commit/agentic/prompts/split-confirm.md +1 -0
  26. package/src/commit/agentic/prompts/system.md +40 -0
  27. package/src/commit/agentic/state.ts +74 -0
  28. package/src/commit/agentic/tools/analyze-file.ts +131 -0
  29. package/src/commit/agentic/tools/git-file-diff.ts +194 -0
  30. package/src/commit/agentic/tools/git-hunk.ts +50 -0
  31. package/src/commit/agentic/tools/git-overview.ts +84 -0
  32. package/src/commit/agentic/tools/index.ts +56 -0
  33. package/src/commit/agentic/tools/propose-changelog.ts +128 -0
  34. package/src/commit/agentic/tools/propose-commit.ts +154 -0
  35. package/src/commit/agentic/tools/recent-commits.ts +81 -0
  36. package/src/commit/agentic/tools/split-commit.ts +284 -0
  37. package/src/commit/agentic/topo-sort.ts +44 -0
  38. package/src/commit/agentic/trivial.ts +51 -0
  39. package/src/commit/agentic/validation.ts +200 -0
  40. package/src/commit/analysis/conventional.ts +169 -0
  41. package/src/commit/analysis/index.ts +4 -0
  42. package/src/commit/analysis/scope.ts +242 -0
  43. package/src/commit/analysis/summary.ts +114 -0
  44. package/src/commit/analysis/validation.ts +66 -0
  45. package/src/commit/changelog/detect.ts +36 -0
  46. package/src/commit/changelog/generate.ts +112 -0
  47. package/src/commit/changelog/index.ts +233 -0
  48. package/src/commit/changelog/parse.ts +44 -0
  49. package/src/commit/cli.ts +93 -0
  50. package/src/commit/git/diff.ts +148 -0
  51. package/src/commit/git/errors.ts +11 -0
  52. package/src/commit/git/index.ts +217 -0
  53. package/src/commit/git/operations.ts +53 -0
  54. package/src/commit/index.ts +5 -0
  55. package/src/commit/map-reduce/.map-phase.ts.kate-swp +0 -0
  56. package/src/commit/map-reduce/index.ts +63 -0
  57. package/src/commit/map-reduce/map-phase.ts +193 -0
  58. package/src/commit/map-reduce/reduce-phase.ts +147 -0
  59. package/src/commit/map-reduce/utils.ts +9 -0
  60. package/src/commit/message.ts +11 -0
  61. package/src/commit/model-selection.ts +84 -0
  62. package/src/commit/pipeline.ts +242 -0
  63. package/src/commit/prompts/analysis-system.md +155 -0
  64. package/src/commit/prompts/analysis-user.md +41 -0
  65. package/src/commit/prompts/changelog-system.md +56 -0
  66. package/src/commit/prompts/changelog-user.md +19 -0
  67. package/src/commit/prompts/file-observer-system.md +26 -0
  68. package/src/commit/prompts/file-observer-user.md +9 -0
  69. package/src/commit/prompts/reduce-system.md +60 -0
  70. package/src/commit/prompts/reduce-user.md +17 -0
  71. package/src/commit/prompts/summary-retry.md +4 -0
  72. package/src/commit/prompts/summary-system.md +52 -0
  73. package/src/commit/prompts/summary-user.md +13 -0
  74. package/src/commit/prompts/types-description.md +2 -0
  75. package/src/commit/types.ts +109 -0
  76. package/src/commit/utils/exclusions.ts +42 -0
  77. package/src/config/file-lock.ts +111 -0
  78. package/src/config/model-registry.ts +16 -7
  79. package/src/config/settings-manager.ts +115 -40
  80. package/src/config.ts +5 -5
  81. package/src/discovery/agents-md.ts +1 -1
  82. package/src/discovery/builtin.ts +1 -1
  83. package/src/discovery/claude.ts +1 -1
  84. package/src/discovery/cline.ts +1 -1
  85. package/src/discovery/codex.ts +1 -1
  86. package/src/discovery/cursor.ts +1 -1
  87. package/src/discovery/gemini.ts +1 -1
  88. package/src/discovery/github.ts +1 -1
  89. package/src/discovery/index.ts +11 -11
  90. package/src/discovery/mcp-json.ts +1 -1
  91. package/src/discovery/ssh.ts +1 -1
  92. package/src/discovery/vscode.ts +1 -1
  93. package/src/discovery/windsurf.ts +1 -1
  94. package/src/extensibility/custom-commands/loader.ts +1 -1
  95. package/src/extensibility/custom-commands/types.ts +1 -1
  96. package/src/extensibility/custom-tools/loader.ts +1 -1
  97. package/src/extensibility/custom-tools/types.ts +1 -1
  98. package/src/extensibility/extensions/loader.ts +1 -1
  99. package/src/extensibility/extensions/types.ts +1 -1
  100. package/src/extensibility/hooks/loader.ts +1 -1
  101. package/src/extensibility/hooks/types.ts +3 -3
  102. package/src/index.ts +10 -10
  103. package/src/ipy/executor.ts +97 -1
  104. package/src/lsp/index.ts +1 -1
  105. package/src/lsp/render.ts +90 -46
  106. package/src/main.ts +16 -3
  107. package/src/mcp/loader.ts +3 -3
  108. package/src/migrations.ts +3 -3
  109. package/src/modes/components/assistant-message.ts +29 -1
  110. package/src/modes/components/tool-execution.ts +5 -3
  111. package/src/modes/components/tree-selector.ts +1 -1
  112. package/src/modes/controllers/extension-ui-controller.ts +1 -1
  113. package/src/modes/controllers/selector-controller.ts +1 -1
  114. package/src/modes/interactive-mode.ts +5 -3
  115. package/src/modes/rpc/rpc-client.ts +1 -1
  116. package/src/modes/rpc/rpc-mode.ts +1 -4
  117. package/src/modes/rpc/rpc-types.ts +1 -1
  118. package/src/modes/theme/mermaid-cache.ts +89 -0
  119. package/src/modes/theme/theme.ts +2 -0
  120. package/src/modes/types.ts +2 -2
  121. package/src/patch/index.ts +3 -9
  122. package/src/patch/shared.ts +33 -5
  123. package/src/prompts/tools/task.md +2 -0
  124. package/src/sdk.ts +60 -22
  125. package/src/session/agent-session.ts +3 -3
  126. package/src/session/agent-storage.ts +32 -28
  127. package/src/session/artifacts.ts +24 -1
  128. package/src/session/auth-storage.ts +25 -10
  129. package/src/session/storage-migration.ts +12 -53
  130. package/src/system-prompt.ts +2 -2
  131. package/src/task/.executor.ts.kate-swp +0 -0
  132. package/src/task/executor.ts +1 -1
  133. package/src/task/index.ts +10 -1
  134. package/src/task/output-manager.ts +94 -0
  135. package/src/task/render.ts +7 -12
  136. package/src/task/worker.ts +1 -1
  137. package/src/tools/ask.ts +35 -13
  138. package/src/tools/bash.ts +80 -87
  139. package/src/tools/calculator.ts +42 -40
  140. package/src/tools/complete.ts +1 -1
  141. package/src/tools/fetch.ts +67 -104
  142. package/src/tools/find.ts +83 -86
  143. package/src/tools/grep.ts +80 -96
  144. package/src/tools/index.ts +10 -7
  145. package/src/tools/ls.ts +39 -65
  146. package/src/tools/notebook.ts +48 -64
  147. package/src/tools/output-utils.ts +1 -1
  148. package/src/tools/python.ts +71 -183
  149. package/src/tools/read.ts +74 -15
  150. package/src/tools/render-utils.ts +1 -15
  151. package/src/tools/ssh.ts +43 -24
  152. package/src/tools/todo-write.ts +27 -15
  153. package/src/tools/write.ts +93 -64
  154. package/src/tui/code-cell.ts +115 -0
  155. package/src/tui/file-list.ts +48 -0
  156. package/src/tui/index.ts +11 -0
  157. package/src/tui/output-block.ts +73 -0
  158. package/src/tui/status-line.ts +40 -0
  159. package/src/tui/tree-list.ts +56 -0
  160. package/src/tui/types.ts +17 -0
  161. package/src/tui/utils.ts +49 -0
  162. package/src/vendor/photon/photon_rs_bg.wasm.b64.js +1 -0
  163. package/src/web/search/auth.ts +1 -1
  164. package/src/web/search/index.ts +1 -1
  165. package/src/web/search/render.ts +119 -163
  166. package/tsconfig.json +0 -42
@@ -1,11 +1,14 @@
1
+ import { existsSync, readFileSync } from "node:fs";
1
2
  import { rename } from "node:fs/promises";
2
3
  import { join } from "node:path";
3
4
  import { type Settings as SettingsItem, settingsCapability } from "@oh-my-pi/pi-coding-agent/capability/settings";
4
5
  import { getAgentDbPath, getAgentDir } from "@oh-my-pi/pi-coding-agent/config";
6
+ import { withFileLock } from "@oh-my-pi/pi-coding-agent/config/file-lock";
5
7
  import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery";
6
8
  import type { SymbolPreset } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
7
9
  import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage";
8
10
  import { logger } from "@oh-my-pi/pi-utils";
11
+ import { YAML } from "bun";
9
12
 
10
13
  export interface CompactionSettings {
11
14
  enabled?: boolean; // default: true
@@ -117,6 +120,15 @@ export interface PythonSettings {
117
120
  sharedGateway?: boolean;
118
121
  }
119
122
 
123
+ export interface CommitSettings {
124
+ mapReduceEnabled?: boolean;
125
+ mapReduceMinFiles?: number;
126
+ mapReduceMaxFileTokens?: number;
127
+ mapReduceTimeoutMs?: number;
128
+ mapReduceMaxConcurrency?: number;
129
+ changelogMaxDiffChars?: number;
130
+ }
131
+
120
132
  export interface EditSettings {
121
133
  fuzzyMatch?: boolean; // default: true (accept high-confidence fuzzy matches for whitespace/indentation)
122
134
  fuzzyThreshold?: number; // default: 0.95 (similarity threshold for fuzzy matching)
@@ -214,6 +226,7 @@ export interface Settings {
214
226
  mcp?: MCPSettings;
215
227
  lsp?: LspSettings;
216
228
  python?: PythonSettings;
229
+ commit?: CommitSettings;
217
230
  edit?: EditSettings;
218
231
  ttsr?: TtsrSettings;
219
232
  todoCompletion?: TodoCompletionSettings;
@@ -424,8 +437,10 @@ function deepMergeSettings(base: Settings, overrides: Settings): Settings {
424
437
  }
425
438
 
426
439
  export class SettingsManager {
427
- /** SQLite storage for persisted settings (null for in-memory mode) */
440
+ /** SQLite storage for auth/cache (null for in-memory mode) */
428
441
  private storage: AgentStorage | null;
442
+ /** Path to config.yml (null for in-memory mode) */
443
+ private configPath: string | null;
429
444
  private cwd: string | null;
430
445
  private globalSettings: Settings;
431
446
  private overrides: Settings;
@@ -434,7 +449,8 @@ export class SettingsManager {
434
449
 
435
450
  /**
436
451
  * Private constructor - use static factory methods instead.
437
- * @param storage - SQLite storage instance for persistence, or null for in-memory mode
452
+ * @param storage - SQLite storage instance for auth/cache, or null for in-memory mode
453
+ * @param configPath - Path to config.yml for persistence, or null for in-memory mode
438
454
  * @param cwd - Current working directory for project settings discovery
439
455
  * @param initialSettings - Initial global settings to use
440
456
  * @param persist - Whether to persist settings changes to storage
@@ -442,12 +458,14 @@ export class SettingsManager {
442
458
  */
443
459
  private constructor(
444
460
  storage: AgentStorage | null,
461
+ configPath: string | null,
445
462
  cwd: string | null,
446
463
  initialSettings: Settings,
447
464
  persist: boolean,
448
465
  projectSettings: Settings,
449
466
  ) {
450
467
  this.storage = storage;
468
+ this.configPath = configPath;
451
469
  this.cwd = cwd;
452
470
  this.persist = persist;
453
471
  this.globalSettings = initialSettings;
@@ -479,14 +497,17 @@ export class SettingsManager {
479
497
  }
480
498
 
481
499
  /**
482
- * Create a SettingsManager that loads from persistent SQLite storage.
500
+ * Create a SettingsManager that loads from persistent config.yml.
483
501
  * @param cwd - Current working directory for project settings discovery
484
- * @param agentDir - Agent directory containing agent.db
502
+ * @param agentDir - Agent directory containing config.yml
485
503
  * @returns Configured SettingsManager with merged global and user settings
486
504
  */
487
505
  static async create(cwd: string = process.cwd(), agentDir: string = getAgentDir()): Promise<SettingsManager> {
488
- const storage = AgentStorage.open(getAgentDbPath(agentDir));
489
- await SettingsManager.migrateLegacySettingsFile(storage, agentDir);
506
+ const configPath = join(agentDir, "config.yml");
507
+ const storage = await AgentStorage.open(getAgentDbPath(agentDir));
508
+
509
+ // Migrate from legacy storage if config.yml doesn't exist
510
+ await SettingsManager.migrateToYaml(storage, agentDir, configPath);
490
511
 
491
512
  // Use capability API to load user-level settings from all providers
492
513
  const result = await loadCapability(settingsCapability.id, { cwd });
@@ -499,14 +520,14 @@ export class SettingsManager {
499
520
  }
500
521
  }
501
522
 
502
- // Load persisted settings from agent.db (legacy settings.json is migrated separately)
503
- const storedSettings = SettingsManager.loadFromStorage(storage);
523
+ // Load persisted settings from config.yml
524
+ const storedSettings = SettingsManager.loadFromYaml(configPath);
504
525
  globalSettings = deepMergeSettings(globalSettings, storedSettings);
505
526
 
506
527
  // Load project settings before construction (constructor is sync)
507
528
  const projectSettings = await SettingsManager.loadProjectSettingsStatic(cwd);
508
529
 
509
- return new SettingsManager(storage, cwd, globalSettings, true, projectSettings);
530
+ return new SettingsManager(storage, configPath, cwd, globalSettings, true, projectSettings);
510
531
  }
511
532
 
512
533
  /**
@@ -515,7 +536,7 @@ export class SettingsManager {
515
536
  * @returns SettingsManager that won't persist changes to disk
516
537
  */
517
538
  static inMemory(settings: Partial<Settings> = {}): SettingsManager {
518
- return new SettingsManager(null, null, settings, false, {});
539
+ return new SettingsManager(null, null, null, settings, false, {});
519
540
  }
520
541
 
521
542
  /**
@@ -534,41 +555,82 @@ export class SettingsManager {
534
555
  }
535
556
 
536
557
  /**
537
- * Load settings from SQLite storage, applying any schema migrations.
538
- * @param storage - AgentStorage instance, or null for in-memory mode
539
- * @returns Parsed and migrated settings, or empty object if storage is null/empty
558
+ * Load settings from config.yml, applying any schema migrations.
559
+ * @param configPath - Path to config.yml, or null for in-memory mode
560
+ * @returns Parsed and migrated settings, or empty object if file doesn't exist
540
561
  */
541
- private static loadFromStorage(storage: AgentStorage | null): Settings {
542
- if (!storage) {
562
+ private static loadFromYaml(configPath: string | null): Settings {
563
+ if (!configPath || !existsSync(configPath)) {
543
564
  return {};
544
565
  }
545
- const settings = storage.getSettings();
546
- if (!settings) {
566
+ try {
567
+ const content = readFileSync(configPath, "utf-8");
568
+ const parsed = YAML.parse(content);
569
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
570
+ return {};
571
+ }
572
+ return SettingsManager.migrateSettings(parsed as Record<string, unknown>);
573
+ } catch (error) {
574
+ logger.warn("SettingsManager failed to load config.yml", { path: configPath, error: String(error) });
547
575
  return {};
548
576
  }
549
- return SettingsManager.migrateSettings(settings as Record<string, unknown>);
550
577
  }
551
578
 
552
- private static async migrateLegacySettingsFile(storage: AgentStorage, agentDir: string): Promise<void> {
553
- const settingsPath = join(agentDir, "settings.json");
554
- const settingsFile = Bun.file(settingsPath);
555
- if (!(await settingsFile.exists())) return;
556
- if (storage.getSettings() !== null) return;
579
+ /**
580
+ * Migrate settings from legacy sources to config.yml.
581
+ * Migration order: settings.json -> agent.db -> config.yml
582
+ * Only migrates if config.yml doesn't exist.
583
+ */
584
+ private static async migrateToYaml(storage: AgentStorage, agentDir: string, configPath: string): Promise<void> {
585
+ // Skip if config.yml already exists
586
+ if (existsSync(configPath)) return;
587
+
588
+ let settings: Settings = {};
589
+ let migrated = false;
557
590
 
591
+ // 1. Try to migrate from settings.json (oldest legacy format)
592
+ const settingsJsonPath = join(agentDir, "settings.json");
558
593
  try {
559
- const parsed = JSON.parse(await settingsFile.text());
560
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
561
- return;
594
+ const settingsFile = Bun.file(settingsJsonPath);
595
+ if (await settingsFile.exists()) {
596
+ const parsed = JSON.parse(await settingsFile.text());
597
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
598
+ settings = deepMergeSettings(settings, SettingsManager.migrateSettings(parsed));
599
+ migrated = true;
600
+ // Backup settings.json
601
+ try {
602
+ await rename(settingsJsonPath, `${settingsJsonPath}.bak`);
603
+ } catch (error) {
604
+ logger.warn("SettingsManager failed to backup settings.json", { error: String(error) });
605
+ }
606
+ }
562
607
  }
563
- const migrated = SettingsManager.migrateSettings(parsed as Record<string, unknown>);
564
- storage.saveSettings(migrated);
608
+ } catch (error) {
609
+ logger.warn("SettingsManager failed to read settings.json", { error: String(error) });
610
+ }
611
+
612
+ // 2. Migrate from agent.db settings table
613
+ try {
614
+ const dbSettings = storage.getSettings();
615
+ if (dbSettings) {
616
+ settings = deepMergeSettings(
617
+ settings,
618
+ SettingsManager.migrateSettings(dbSettings as Record<string, unknown>),
619
+ );
620
+ migrated = true;
621
+ }
622
+ } catch (error) {
623
+ logger.warn("SettingsManager failed to read agent.db settings", { error: String(error) });
624
+ }
625
+
626
+ // 3. Write merged settings to config.yml if we found any
627
+ if (migrated && Object.keys(settings).length > 0) {
565
628
  try {
566
- await rename(settingsPath, `${settingsPath}.bak`);
629
+ await Bun.write(configPath, YAML.stringify(settings, null, 2));
630
+ logger.debug("SettingsManager migrated settings to config.yml", { path: configPath });
567
631
  } catch (error) {
568
- logger.warn("SettingsManager failed to backup settings.json", { error: String(error) });
632
+ logger.warn("SettingsManager failed to write config.yml", { path: configPath, error: String(error) });
569
633
  }
570
- } catch (error) {
571
- logger.warn("SettingsManager failed to migrate settings.json", { error: String(error) });
572
634
  }
573
635
  }
574
636
 
@@ -620,22 +682,24 @@ export class SettingsManager {
620
682
  }
621
683
 
622
684
  /**
623
- * Persist current global settings to SQLite storage and rebuild merged settings.
624
- * Merges with any concurrent changes in storage before saving.
685
+ * Persist current global settings to config.yml and rebuild merged settings.
686
+ * Uses file locking to prevent concurrent write races.
625
687
  */
626
688
  private async save(): Promise<void> {
627
- if (this.persist && this.storage) {
689
+ if (this.persist && this.configPath) {
690
+ const configPath = this.configPath;
628
691
  try {
629
- const currentSettings = this.storage.getSettings() ?? {};
630
- const mergedSettings = deepMergeSettings(currentSettings, this.globalSettings);
631
- this.globalSettings = mergedSettings;
632
- this.storage.saveSettings(this.globalSettings);
692
+ await withFileLock(configPath, async () => {
693
+ const currentSettings = SettingsManager.loadFromYaml(configPath);
694
+ const mergedSettings = deepMergeSettings(currentSettings, this.globalSettings);
695
+ this.globalSettings = mergedSettings;
696
+ await Bun.write(configPath, YAML.stringify(this.globalSettings, null, 2));
697
+ });
633
698
  } catch (error) {
634
699
  logger.warn("SettingsManager save failed", { error: String(error) });
635
700
  }
636
701
  }
637
702
 
638
- // Always re-merge to update active settings (needed for both file and inMemory modes)
639
703
  const projectSettings = await this.loadProjectSettings();
640
704
  this.rebuildSettings(projectSettings);
641
705
  }
@@ -800,6 +864,17 @@ export class SettingsManager {
800
864
  };
801
865
  }
802
866
 
867
+ getCommitSettings(): Required<CommitSettings> {
868
+ return {
869
+ mapReduceEnabled: this.settings.commit?.mapReduceEnabled ?? true,
870
+ mapReduceMinFiles: this.settings.commit?.mapReduceMinFiles ?? 4,
871
+ mapReduceMaxFileTokens: this.settings.commit?.mapReduceMaxFileTokens ?? 50_000,
872
+ mapReduceTimeoutMs: this.settings.commit?.mapReduceTimeoutMs ?? 120_000,
873
+ mapReduceMaxConcurrency: this.settings.commit?.mapReduceMaxConcurrency ?? 5,
874
+ changelogMaxDiffChars: this.settings.commit?.changelogMaxDiffChars ?? 120_000,
875
+ };
876
+ }
877
+
803
878
  getRetryMaxRetries(): number {
804
879
  return this.settings.retry?.maxRetries ?? 3;
805
880
  }
package/src/config.ts CHANGED
@@ -69,16 +69,16 @@ export function getModelsPath(): string {
69
69
  return join(getAgentDir(), "models.json");
70
70
  }
71
71
 
72
+ /** Get path to models.yml (preferred over models.json) */
73
+ export function getModelsYamlPath(): string {
74
+ return join(getAgentDir(), "models.yml");
75
+ }
76
+
72
77
  /** Get path to auth.json */
73
78
  export function getAuthPath(): string {
74
79
  return join(getAgentDir(), "auth.json");
75
80
  }
76
81
 
77
- /** Get path to settings.json */
78
- export function getSettingsPath(): string {
79
- return join(getAgentDir(), "settings.json");
80
- }
81
-
82
82
  /**
83
83
  * Gets the path to agent.db (SQLite database for settings and auth storage).
84
84
  * @param agentDir - Base agent directory, defaults to ~/.omp/agent
@@ -7,9 +7,9 @@
7
7
  */
8
8
 
9
9
  import { dirname, join, sep } from "node:path";
10
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
10
11
  import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file";
11
12
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
12
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
13
13
  import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types";
14
14
  import { calculateDepth, createSourceMeta } from "./helpers";
15
15
 
@@ -5,6 +5,7 @@
5
5
  * .pi is an alias for backwards compatibility.
6
6
  */
7
7
 
8
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
8
9
  import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file";
9
10
  import {
10
11
  type Extension,
@@ -14,7 +15,6 @@ import {
14
15
  import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module";
15
16
  import { readDirEntries, readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
16
17
  import { type Hook, hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook";
17
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
18
18
  import { type Instruction, instructionCapability } from "@oh-my-pi/pi-coding-agent/capability/instruction";
19
19
  import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
20
20
  import { type Prompt, promptCapability } from "@oh-my-pi/pi-coding-agent/capability/prompt";
@@ -6,11 +6,11 @@
6
6
  */
7
7
 
8
8
  import { join, sep } from "node:path";
9
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
9
10
  import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file";
10
11
  import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module";
11
12
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
12
13
  import { type Hook, hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook";
13
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
14
14
  import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
15
15
  import { type Settings, settingsCapability } from "@oh-my-pi/pi-coding-agent/capability/settings";
16
16
  import { type Skill, skillCapability } from "@oh-my-pi/pi-coding-agent/capability/skill";
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import { dirname, resolve } from "node:path";
9
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
9
10
  import { readDirEntries, readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
10
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
11
11
  import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule";
12
12
  import { ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule";
13
13
  import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types";
@@ -8,13 +8,13 @@
8
8
  */
9
9
 
10
10
  import { join } from "node:path";
11
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
11
12
  import type { ContextFile } from "@oh-my-pi/pi-coding-agent/capability/context-file";
12
13
  import { contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file";
13
14
  import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module";
14
15
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
15
16
  import type { Hook } from "@oh-my-pi/pi-coding-agent/capability/hook";
16
17
  import { hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook";
17
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
18
18
  import type { MCPServer } from "@oh-my-pi/pi-coding-agent/capability/mcp";
19
19
  import { mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
20
20
  import type { Prompt } from "@oh-my-pi/pi-coding-agent/capability/prompt";
@@ -14,8 +14,8 @@
14
14
  * - settings: From settings.json if present
15
15
  */
16
16
 
17
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
17
18
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
18
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
19
19
  import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
20
20
  import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule";
21
21
  import { ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule";
@@ -17,6 +17,7 @@
17
17
  */
18
18
 
19
19
  import { join, sep } from "node:path";
20
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
20
21
  import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file";
21
22
  import {
22
23
  type Extension,
@@ -25,7 +26,6 @@ import {
25
26
  } from "@oh-my-pi/pi-coding-agent/capability/extension";
26
27
  import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module";
27
28
  import { readDirEntries, readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
28
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
29
29
  import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
30
30
  import { type Settings, settingsCapability } from "@oh-my-pi/pi-coding-agent/capability/settings";
31
31
  import { type SystemPrompt, systemPromptCapability } from "@oh-my-pi/pi-coding-agent/capability/system-prompt";
@@ -13,9 +13,9 @@
13
13
  */
14
14
 
15
15
  import { basename, dirname, sep } from "node:path";
16
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
16
17
  import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file";
17
18
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
18
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
19
19
  import { type Instruction, instructionCapability } from "@oh-my-pi/pi-coding-agent/capability/instruction";
20
20
  import type { LoadContext, LoadResult, SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types";
21
21
  import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter";
@@ -17,28 +17,24 @@ import "../capability/rule";
17
17
  import "../capability/settings";
18
18
  import "../capability/skill";
19
19
  import "../capability/slash-command";
20
- import "../capability/system-prompt";
21
20
  import "../capability/ssh";
21
+ import "../capability/system-prompt";
22
22
  import "../capability/tool";
23
23
 
24
24
  // Import providers (each registers itself on import)
25
+ import "./agents-md";
25
26
  import "./builtin";
26
27
  import "./claude";
28
+ import "./cline";
27
29
  import "./codex";
28
- import "./gemini";
29
30
  import "./cursor";
30
- import "./windsurf";
31
- import "./cline";
31
+ import "./gemini";
32
32
  import "./github";
33
- import "./vscode";
34
- import "./agents-md";
35
33
  import "./mcp-json";
36
34
  import "./ssh";
35
+ import "./vscode";
36
+ import "./windsurf";
37
37
 
38
- export type { ContextFile } from "@oh-my-pi/pi-coding-agent/capability/context-file";
39
- export type { Extension, ExtensionManifest } from "@oh-my-pi/pi-coding-agent/capability/extension";
40
- export type { ExtensionModule } from "@oh-my-pi/pi-coding-agent/capability/extension-module";
41
- export type { Hook } from "@oh-my-pi/pi-coding-agent/capability/hook";
42
38
  // Re-export the main API from capability registry
43
39
  export {
44
40
  cacheStats,
@@ -62,7 +58,11 @@ export {
62
58
  // Cache management
63
59
  reset,
64
60
  setDisabledProviders,
65
- } from "@oh-my-pi/pi-coding-agent/capability/index";
61
+ } from "@oh-my-pi/pi-coding-agent/capability";
62
+ export type { ContextFile } from "@oh-my-pi/pi-coding-agent/capability/context-file";
63
+ export type { Extension, ExtensionManifest } from "@oh-my-pi/pi-coding-agent/capability/extension";
64
+ export type { ExtensionModule } from "@oh-my-pi/pi-coding-agent/capability/extension-module";
65
+ export type { Hook } from "@oh-my-pi/pi-coding-agent/capability/hook";
66
66
  export type { Instruction } from "@oh-my-pi/pi-coding-agent/capability/instruction";
67
67
  // Re-export capability item types
68
68
  export type { MCPServer } from "@oh-my-pi/pi-coding-agent/capability/mcp";
@@ -8,8 +8,8 @@
8
8
  */
9
9
 
10
10
  import { join } from "node:path";
11
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
11
12
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
12
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
13
13
  import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
14
14
  import type { LoadContext, LoadResult, SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types";
15
15
  import { createSourceMeta, expandEnvVarsDeep, parseJSON } from "./helpers";
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import { join } from "node:path";
9
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
9
10
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
10
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
11
11
  import { type SSHHost, sshCapability } from "@oh-my-pi/pi-coding-agent/capability/ssh";
12
12
  import type { LoadContext, LoadResult, SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types";
13
13
  import { createSourceMeta, expandEnvVarsDeep, parseJSON } from "./helpers";
@@ -5,8 +5,8 @@
5
5
  * Supports MCP server discovery from `mcp.json` with nested `mcp.servers` structure.
6
6
  */
7
7
 
8
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
8
9
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
9
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
10
10
  import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
11
11
  import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types";
12
12
  import { createSourceMeta, expandEnvVarsDeep, getProjectPath, parseJSON } from "./helpers";
@@ -11,8 +11,8 @@
11
11
  * - Legacy .windsurfrules file
12
12
  */
13
13
 
14
+ import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability";
14
15
  import { readFile } from "@oh-my-pi/pi-coding-agent/capability/fs";
15
- import { registerProvider } from "@oh-my-pi/pi-coding-agent/capability/index";
16
16
  import { type MCPServer, mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp";
17
17
  import { type Rule, ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule";
18
18
  import type { LoadContext, LoadResult } from "@oh-my-pi/pi-coding-agent/capability/types";
@@ -7,9 +7,9 @@
7
7
 
8
8
  import { type Dirent, existsSync, readdirSync } from "node:fs";
9
9
  import * as path from "node:path";
10
+ import * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
10
11
  import { getAgentDir, getConfigDirs } from "@oh-my-pi/pi-coding-agent/config";
11
12
  import { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec";
12
- import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index";
13
13
  import { logger } from "@oh-my-pi/pi-utils";
14
14
  import * as typebox from "@sinclair/typebox";
15
15
  import { ReviewCommand } from "./bundled/review";
@@ -23,7 +23,7 @@ export interface CustomCommandAPI {
23
23
  /** Injected @sinclair/typebox module */
24
24
  typebox: typeof import("@sinclair/typebox");
25
25
  /** Injected pi-coding-agent exports */
26
- pi: typeof import("../../index");
26
+ pi: typeof import("../..");
27
27
  }
28
28
 
29
29
  /**
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import * as path from "node:path";
9
+ import * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
9
10
  import { toolCapability } from "@oh-my-pi/pi-coding-agent/capability/tool";
10
11
  import { type CustomTool, loadCapability } from "@oh-my-pi/pi-coding-agent/discovery";
11
12
  import { expandPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers";
@@ -13,7 +14,6 @@ import type { ExecOptions } from "@oh-my-pi/pi-coding-agent/exec/exec";
13
14
  import { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec";
14
15
  import type { HookUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/hooks/types";
15
16
  import { getAllPluginToolPaths } from "@oh-my-pi/pi-coding-agent/extensibility/plugins/loader";
16
- import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index";
17
17
  import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
18
18
  import { logger } from "@oh-my-pi/pi-utils";
19
19
  import * as typebox from "@sinclair/typebox";
@@ -39,7 +39,7 @@ export interface CustomToolAPI {
39
39
  /** Injected @sinclair/typebox module */
40
40
  typebox: typeof import("@sinclair/typebox");
41
41
  /** Injected pi-coding-agent exports */
42
- pi: typeof import("../../index");
42
+ pi: typeof import("../..");
43
43
  }
44
44
 
45
45
  /**
@@ -6,12 +6,12 @@ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
6
6
  import * as path from "node:path";
7
7
  import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
8
8
  import type { ImageContent, Model, TextContent } from "@oh-my-pi/pi-ai";
9
+ import * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
9
10
  import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module";
10
11
  import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery";
11
12
  import { expandPath, getExtensionNameFromPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers";
12
13
  import type { ExecOptions } from "@oh-my-pi/pi-coding-agent/exec/exec";
13
14
  import { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec";
14
- import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index";
15
15
  import type { CustomMessage } from "@oh-my-pi/pi-coding-agent/session/messages";
16
16
  import { EventBus } from "@oh-my-pi/pi-coding-agent/utils/event-bus";
17
17
  import type { KeyId } from "@oh-my-pi/pi-tui";
@@ -10,11 +10,11 @@
10
10
 
11
11
  import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
12
12
  import type { ImageContent, Model, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai";
13
+ import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
13
14
  import type { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings";
14
15
  import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry";
15
16
  import type { BashResult } from "@oh-my-pi/pi-coding-agent/exec/bash-executor";
16
17
  import type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec";
17
- import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index";
18
18
  import type { PythonResult } from "@oh-my-pi/pi-coding-agent/ipy/executor";
19
19
  import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
20
20
  import type { EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch";
@@ -3,11 +3,11 @@
3
3
  */
4
4
 
5
5
  import * as path from "node:path";
6
+ import * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
6
7
  import { hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook";
7
8
  import type { Hook } from "@oh-my-pi/pi-coding-agent/discovery";
8
9
  import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery";
9
10
  import { expandPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers";
10
- import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index";
11
11
  import type { HookMessage } from "@oh-my-pi/pi-coding-agent/session/messages";
12
12
  import type { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager";
13
13
  import { logger } from "@oh-my-pi/pi-utils";
@@ -11,7 +11,7 @@ import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-regis
11
11
  import type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec";
12
12
  import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
13
13
  import type { EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch";
14
- import type { CompactionPreparation, CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction/index";
14
+ import type { CompactionPreparation, CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction";
15
15
  import type { HookMessage } from "@oh-my-pi/pi-coding-agent/session/messages";
16
16
  import type {
17
17
  BranchSummaryEntry,
@@ -26,7 +26,7 @@ import type {
26
26
  GrepToolDetails,
27
27
  LsToolDetails,
28
28
  ReadToolDetails,
29
- } from "@oh-my-pi/pi-coding-agent/tools/index";
29
+ } from "@oh-my-pi/pi-coding-agent/tools";
30
30
  import type { Component, TUI } from "@oh-my-pi/pi-tui";
31
31
 
32
32
  // Re-export for backward compatibility
@@ -752,7 +752,7 @@ export interface HookAPI {
752
752
  /** Injected @sinclair/typebox module */
753
753
  typebox: typeof import("@sinclair/typebox");
754
754
  /** Injected pi-coding-agent exports */
755
- pi: typeof import("../../index");
755
+ pi: typeof import("../..");
756
756
  }
757
757
 
758
758
  /**