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 +4 -0
- package/extensions/help.ts +1 -1
- package/package.json +1 -1
- package/src/extension.ts +5 -5
- package/src/identity.ts +2 -2
- package/src/render/markdown.ts +4 -4
- package/src/resources/index.ts +6 -6
- package/src/resources/mcp.ts +1 -1
- package/src/resources/settings.ts +1 -1
- package/src/state/migrate.ts +3 -3
- package/src/state/store.ts +2 -2
- package/src/state/usage.ts +4 -4
package/CHANGELOG.md
CHANGED
package/extensions/help.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { registerHelpExtension } from "../src/extension.
|
|
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
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.
|
|
6
|
-
import { buildMarkdown } from "./render/markdown.
|
|
7
|
-
import { createStatePaths, loadState, saveState } from "./state/store.
|
|
8
|
-
import { findMatches, pruneState, recordUsageByName } from "./state/usage.
|
|
9
|
-
import type { HelpState, ResourceIndex } from "./types.
|
|
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.
|
|
4
|
-
import type { ResourceKind } from "./types.
|
|
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
|
|
package/src/render/markdown.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MAX_COMMON, MAX_SECTION } from "../constants.
|
|
2
|
-
import { normalizeSearch } from "../identity.
|
|
3
|
-
import { sortItems } from "../state/usage.
|
|
4
|
-
import type { IndexedItem, ResourceIndex } from "../types.
|
|
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");
|
package/src/resources/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { BUILTIN_COMMANDS } from "../constants.
|
|
3
|
-
import { canonicalName, compactSourceRef, displayName, extractPackageNameFromPath, makeItemKey } from "../identity.
|
|
4
|
-
import type { HelpState, IndexedItem, McpServerEntry, PackageEntry, ResourceIndex, ResourceScope } from "../types.
|
|
5
|
-
import { upsertItem } from "../state/usage.
|
|
6
|
-
import { mergePackageEntries, readPackagesFromSettings } from "./settings.
|
|
7
|
-
import { readMcpServersFromConfig } from "./mcp.
|
|
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;
|
package/src/resources/mcp.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import type { PackageEntry, ResourceScope } from "../types.
|
|
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 {};
|
package/src/state/migrate.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { STATE_VERSION } from "../constants.
|
|
2
|
-
import { canonicalName, compactSourceRef, displayName, makeItemKey } from "../identity.
|
|
3
|
-
import type { HelpState, IndexedItem, LegacyHelpState, ResourceKind, ResourceScope } from "../types.
|
|
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: {} };
|
package/src/state/store.ts
CHANGED
|
@@ -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.
|
|
4
|
-
import { emptyState, migrateState } from "./migrate.
|
|
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;
|
package/src/state/usage.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MAX_ITEMS } from "../constants.
|
|
2
|
-
import { normalizeSearch } from "../identity.
|
|
3
|
-
import type { HelpState, IndexedItem, ResourceKind } from "../types.
|
|
4
|
-
import { mergeItem } from "./migrate.
|
|
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);
|