@aliou/pi-dev-kit 0.6.5 → 0.7.1

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.
@@ -5,9 +5,9 @@ import type {
5
5
  AgentToolResult,
6
6
  ExtensionAPI,
7
7
  Theme,
8
- } from "@mariozechner/pi-coding-agent";
9
- import { defineTool, keyHint, VERSION } from "@mariozechner/pi-coding-agent";
10
- import { Text } from "@mariozechner/pi-tui";
8
+ } from "@earendil-works/pi-coding-agent";
9
+ import { defineTool, keyHint, VERSION } from "@earendil-works/pi-coding-agent";
10
+ import { Text } from "@earendil-works/pi-tui";
11
11
  import { type Static, Type } from "typebox";
12
12
  import { findPiInstallation } from "./utils";
13
13
 
@@ -306,6 +306,10 @@ pi_changelog // Get latest changelog`,
306
306
  },
307
307
 
308
308
  renderResult(result, options, theme) {
309
+ if (options.isPartial) {
310
+ return new Text(theme.fg("dim", "Pi Changelog: loading..."), 0, 0);
311
+ }
312
+
309
313
  const { details } = result;
310
314
 
311
315
  // Check for missing expected fields to detect errors
@@ -417,6 +421,14 @@ const changelogVersionsTool = defineTool({
417
421
  },
418
422
 
419
423
  renderResult(result, options, theme) {
424
+ if (options.isPartial) {
425
+ return new Text(
426
+ theme.fg("dim", "Pi Changelog Versions: loading..."),
427
+ 0,
428
+ 0,
429
+ );
430
+ }
431
+
420
432
  const { details } = result;
421
433
 
422
434
  // Check for missing expected fields to detect errors
@@ -5,9 +5,9 @@ import type {
5
5
  AgentToolResult,
6
6
  ExtensionAPI,
7
7
  Theme,
8
- } from "@mariozechner/pi-coding-agent";
9
- import { defineTool, keyHint } from "@mariozechner/pi-coding-agent";
10
- import { Text } from "@mariozechner/pi-tui";
8
+ } from "@earendil-works/pi-coding-agent";
9
+ import { defineTool, keyHint } from "@earendil-works/pi-coding-agent";
10
+ import { Text } from "@earendil-works/pi-tui";
11
11
  import { type Static, Type } from "typebox";
12
12
  import { findPiInstallation } from "./utils";
13
13
 
@@ -1,4 +1,4 @@
1
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { setupChangelogTool } from "./changelog-tool";
3
3
  import { setupDocsTool } from "./docs-tool";
4
4
  import { setupPackageManagerTool } from "./package-manager-tool";
@@ -10,3 +10,7 @@ export function setupTools(pi: ExtensionAPI) {
10
10
  setupDocsTool(pi);
11
11
  setupChangelogTool(pi);
12
12
  }
13
+
14
+ export default function toolsExtension(pi: ExtensionAPI) {
15
+ setupTools(pi);
16
+ }
@@ -5,9 +5,9 @@ import type {
5
5
  AgentToolResult,
6
6
  ExtensionAPI,
7
7
  Theme,
8
- } from "@mariozechner/pi-coding-agent";
9
- import { defineTool } from "@mariozechner/pi-coding-agent";
10
- import { Text } from "@mariozechner/pi-tui";
8
+ } from "@earendil-works/pi-coding-agent";
9
+ import { defineTool } from "@earendil-works/pi-coding-agent";
10
+ import { Text } from "@earendil-works/pi-tui";
11
11
  import { type Static, Type } from "typebox";
12
12
 
13
13
  const Params = Type.Object({});
@@ -158,7 +158,11 @@ const packageManagerTool = defineTool({
158
158
  return renderPackageManagerCall(args, theme);
159
159
  },
160
160
 
161
- renderResult(result, _options, theme) {
161
+ renderResult(result, options, theme) {
162
+ if (options.isPartial) {
163
+ return new Text(theme.fg("dim", "Package Manager: detecting..."), 0, 0);
164
+ }
165
+
162
166
  const { details } = result;
163
167
 
164
168
  // Check for missing expected fields (framework passes {} on error)
@@ -1,38 +1,48 @@
1
1
  import * as fs from "node:fs";
2
+ import { createRequire } from "node:module";
2
3
  import * as path from "node:path";
3
4
 
5
+ const require = createRequire(import.meta.url);
6
+
7
+ const PI_PACKAGE_NAMES = [
8
+ "@earendil-works/pi-coding-agent",
9
+ "@mariozechner/pi-coding-agent",
10
+ ] as const;
11
+
4
12
  /**
5
13
  * Find the currently running Pi installation directory by resolving the
6
14
  * pi-coding-agent package location.
7
15
  */
8
16
  export function findPiInstallation(): string | null {
9
- try {
10
- const piModulePath = require.resolve(
11
- "@mariozechner/pi-coding-agent/package.json",
12
- );
13
- return path.dirname(piModulePath);
14
- } catch (_error) {
15
- const scriptPath = process.argv[1];
16
- if (scriptPath) {
17
- let currentDir = path.dirname(scriptPath);
17
+ for (const packageName of PI_PACKAGE_NAMES) {
18
+ try {
19
+ const piModulePath = require.resolve(`${packageName}/package.json`);
20
+ return path.dirname(piModulePath);
21
+ } catch {
22
+ // Try the next package namespace.
23
+ }
24
+ }
18
25
 
19
- while (currentDir !== path.dirname(currentDir)) {
20
- const packageJsonPath = path.join(currentDir, "package.json");
21
- if (fs.existsSync(packageJsonPath)) {
22
- try {
23
- const packageContent = fs.readFileSync(packageJsonPath, "utf-8");
24
- const packageJson = JSON.parse(packageContent);
25
- if (packageJson.name === "@mariozechner/pi-coding-agent") {
26
- return currentDir;
27
- }
28
- } catch {
29
- // Continue searching
26
+ const scriptPath = process.argv[1];
27
+ if (scriptPath) {
28
+ let currentDir = path.dirname(scriptPath);
29
+
30
+ while (currentDir !== path.dirname(currentDir)) {
31
+ const packageJsonPath = path.join(currentDir, "package.json");
32
+ if (fs.existsSync(packageJsonPath)) {
33
+ try {
34
+ const packageContent = fs.readFileSync(packageJsonPath, "utf-8");
35
+ const packageJson = JSON.parse(packageContent);
36
+ if (PI_PACKAGE_NAMES.includes(packageJson.name)) {
37
+ return currentDir;
30
38
  }
39
+ } catch {
40
+ // Continue searching
31
41
  }
32
- currentDir = path.dirname(currentDir);
33
42
  }
43
+ currentDir = path.dirname(currentDir);
34
44
  }
35
-
36
- return null;
37
45
  }
46
+
47
+ return null;
38
48
  }
@@ -3,9 +3,9 @@ import type {
3
3
  AgentToolResult,
4
4
  ExtensionAPI,
5
5
  Theme,
6
- } from "@mariozechner/pi-coding-agent";
7
- import { defineTool, VERSION } from "@mariozechner/pi-coding-agent";
8
- import { Text } from "@mariozechner/pi-tui";
6
+ } from "@earendil-works/pi-coding-agent";
7
+ import { defineTool, VERSION } from "@earendil-works/pi-coding-agent";
8
+ import { Text } from "@earendil-works/pi-tui";
9
9
  import { type Static, Type } from "typebox";
10
10
 
11
11
  const VersionParams = Type.Object({});
@@ -47,7 +47,11 @@ const versionTool = defineTool({
47
47
  return renderVersionCall(args, theme);
48
48
  },
49
49
 
50
- renderResult(result, _options, theme) {
50
+ renderResult(result, options, theme) {
51
+ if (options.isPartial) {
52
+ return new Text(theme.fg("dim", "Pi Version: loading..."), 0, 0);
53
+ }
54
+
51
55
  const { details } = result;
52
56
 
53
57
  if (!details?.version) {
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
2
- import { registerCommands } from "./commands";
3
- import { setupTools } from "./tools";
4
-
5
- export default function (pi: ExtensionAPI) {
6
- setupTools(pi);
7
- registerCommands(pi);
8
- }