pi-dynamic-help 0.2.2 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.3
2
+
3
+ - 修复 npm 包中的模块导入:将所有 `.js` 导入改为 `.ts`,启用 `allowImportingTsExtensions`,确保 Pi 可以直接加载 TypeScript 源文件
4
+
1
5
  # Changelog
2
6
 
3
7
  ## 0.2.2
@@ -1,5 +1,5 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { registerHelpExtension } from "../src/extension.js";
2
+ import { registerHelpExtension } from "../src/extension.ts";
3
3
 
4
4
  export default function (pi: ExtensionAPI): void {
5
5
  registerHelpExtension(pi);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dynamic-help",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Dynamic /help dashboard for Pi commands, tools, MCP servers, and packages.",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/extension.ts CHANGED
@@ -2,11 +2,11 @@ import { homedir } from "node:os";
2
2
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
3
3
  import { DynamicBorder, getAgentDir, getMarkdownTheme } from "@earendil-works/pi-coding-agent";
4
4
  import { Container, Markdown, matchesKey, Text } from "@earendil-works/pi-tui";
5
- import { buildResourceIndex, readRuntimeMcpServers, readRuntimePackages } from "./resources/index.js";
6
- import { buildMarkdown } from "./render/markdown.js";
7
- import { createStatePaths, loadState, saveState } from "./state/store.js";
8
- import { findMatches, pruneState, recordUsageByName } from "./state/usage.js";
9
- import type { HelpState, ResourceIndex } from "./types.js";
5
+ import { buildResourceIndex, readRuntimeMcpServers, readRuntimePackages } from "./resources/index.ts";
6
+ import { buildMarkdown } from "./render/markdown.ts";
7
+ import { createStatePaths, loadState, saveState } from "./state/store.ts";
8
+ import { findMatches, pruneState, recordUsageByName } from "./state/usage.ts";
9
+ import type { HelpState, ResourceIndex } from "./types.ts";
10
10
 
11
11
  async function showMarkdownPanel(ctx: ExtensionContext, markdown: string): Promise<void> {
12
12
  if (!ctx.hasUI) {
package/src/identity.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { homedir } from "node:os";
2
2
  import { basename, isAbsolute, relative } from "node:path";
3
- import { PACKAGE_NAME } from "./constants.js";
4
- import type { ResourceKind } from "./types.js";
3
+ import { PACKAGE_NAME } from "./constants.ts";
4
+ import type { ResourceKind } from "./types.ts";
5
5
 
6
6
  const COMPACT_PREFIXES = ["local:", "project:", "pkg:", "mcp:", "npm:", "git:", "http://", "https://"];
7
7
 
@@ -1,7 +1,7 @@
1
- import { MAX_COMMON, MAX_SECTION } from "../constants.js";
2
- import { normalizeSearch } from "../identity.js";
3
- import { sortItems } from "../state/usage.js";
4
- import type { IndexedItem, ResourceIndex } from "../types.js";
1
+ import { MAX_COMMON, MAX_SECTION } from "../constants.ts";
2
+ import { normalizeSearch } from "../identity.ts";
3
+ import { sortItems } from "../state/usage.ts";
4
+ import type { IndexedItem, ResourceIndex } from "../types.ts";
5
5
 
6
6
  export function escapeMarkdownInline(value: string | undefined): string {
7
7
  return (value ?? "").replace(/([\\`*_{}\[\]()#+\-.!|>])/g, "\\$1");
@@ -1,10 +1,10 @@
1
1
  import { join } from "node:path";
2
- import { BUILTIN_COMMANDS } from "../constants.js";
3
- import { canonicalName, compactSourceRef, displayName, extractPackageNameFromPath, makeItemKey } from "../identity.js";
4
- import type { HelpState, IndexedItem, McpServerEntry, PackageEntry, ResourceIndex, ResourceScope } from "../types.js";
5
- import { upsertItem } from "../state/usage.js";
6
- import { mergePackageEntries, readPackagesFromSettings } from "./settings.js";
7
- import { readMcpServersFromConfig } from "./mcp.js";
2
+ import { BUILTIN_COMMANDS } from "../constants.ts";
3
+ import { canonicalName, compactSourceRef, displayName, extractPackageNameFromPath, makeItemKey } from "../identity.ts";
4
+ import type { HelpState, IndexedItem, McpServerEntry, PackageEntry, ResourceIndex, ResourceScope } from "../types.ts";
5
+ import { upsertItem } from "../state/usage.ts";
6
+ import { mergePackageEntries, readPackagesFromSettings } from "./settings.ts";
7
+ import { readMcpServersFromConfig } from "./mcp.ts";
8
8
 
9
9
  export interface CommandLike {
10
10
  name: string;
@@ -1,5 +1,5 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
- import type { McpServerEntry } from "../types.js";
2
+ import type { McpServerEntry } from "../types.ts";
3
3
 
4
4
  function loadJson(path: string): Record<string, unknown> {
5
5
  if (!existsSync(path)) return {};
@@ -1,5 +1,5 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
- import type { PackageEntry, ResourceScope } from "../types.js";
2
+ import type { PackageEntry, ResourceScope } from "../types.ts";
3
3
 
4
4
  function loadJson(path: string): Record<string, unknown> {
5
5
  if (!existsSync(path)) return {};
@@ -1,6 +1,6 @@
1
- import { STATE_VERSION } from "../constants.js";
2
- import { canonicalName, compactSourceRef, displayName, makeItemKey } from "../identity.js";
3
- import type { HelpState, IndexedItem, LegacyHelpState, ResourceKind, ResourceScope } from "../types.js";
1
+ import { STATE_VERSION } from "../constants.ts";
2
+ import { canonicalName, compactSourceRef, displayName, makeItemKey } from "../identity.ts";
3
+ import type { HelpState, IndexedItem, LegacyHelpState, ResourceKind, ResourceScope } from "../types.ts";
4
4
 
5
5
  export function emptyState(): HelpState {
6
6
  return { version: STATE_VERSION, items: {} };
@@ -1,7 +1,7 @@
1
1
  import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
- import type { HelpState, LegacyHelpState, PersistResult } from "../types.js";
4
- import { emptyState, migrateState } from "./migrate.js";
3
+ import type { HelpState, LegacyHelpState, PersistResult } from "../types.ts";
4
+ import { emptyState, migrateState } from "./migrate.ts";
5
5
 
6
6
  export interface StatePaths {
7
7
  stateDir: string;
@@ -1,7 +1,7 @@
1
- import { MAX_ITEMS } from "../constants.js";
2
- import { normalizeSearch } from "../identity.js";
3
- import type { HelpState, IndexedItem, ResourceKind } from "../types.js";
4
- import { mergeItem } from "./migrate.js";
1
+ import { MAX_ITEMS } from "../constants.ts";
2
+ import { normalizeSearch } from "../identity.ts";
3
+ import type { HelpState, IndexedItem, ResourceKind } from "../types.ts";
4
+ import { mergeItem } from "./migrate.ts";
5
5
 
6
6
  export function sortItems(a: IndexedItem, b: IndexedItem): number {
7
7
  if ((a.pinned ? 1 : 0) !== (b.pinned ? 1 : 0)) return (b.pinned ? 1 : 0) - (a.pinned ? 1 : 0);