pi-dynamic-help 0.1.0 → 0.2.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.
- package/CHANGELOG.md +11 -1
- package/README.md +23 -9
- package/extensions/help.ts +4 -843
- package/package.json +4 -3
- package/src/constants.ts +26 -0
- package/src/extension.ts +154 -0
- package/src/identity.ts +92 -0
- package/src/render/markdown.ts +114 -0
- package/src/resources/index.ts +201 -0
- package/src/resources/mcp.ts +31 -0
- package/src/resources/settings.ts +45 -0
- package/src/state/migrate.ts +80 -0
- package/src/state/store.ts +70 -0
- package/src/state/usage.ts +60 -0
- package/src/types.ts +56 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- Refactor the extension into maintainable modules for state, identity, resource indexing, rendering, and extension wiring.
|
|
6
|
+
- Add state v3 canonical identities for command names and package sources.
|
|
7
|
+
- Preserve this package's `/help` and `/help-brief` usage/pins across local, npm, git, and node_modules source forms.
|
|
8
|
+
- Add safe state loading with corrupt-state backups and save-failure warnings.
|
|
9
|
+
- Make markdown rendering pure and escape dynamic resource fields.
|
|
10
|
+
- Expand hermetic tests for migration, state persistence failures, rendering, settings parsing, and pin matching.
|
|
11
|
+
- Tighten Pi peer dependency ranges to `>=0.78.0 <1`.
|
|
12
|
+
|
|
3
13
|
## 0.1.0
|
|
4
14
|
|
|
5
|
-
- Initial package
|
|
15
|
+
- Initial package release for the dynamic `/help` dashboard.
|
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ Dynamic `/help` dashboard for [Pi](https://pi.dev). It summarizes loaded slash c
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
+
```bash
|
|
8
|
+
pi install npm:pi-dynamic-help
|
|
9
|
+
```
|
|
10
|
+
|
|
7
11
|
Local development install:
|
|
8
12
|
|
|
9
13
|
```bash
|
|
@@ -16,18 +20,12 @@ Temporary test run without adding it to settings:
|
|
|
16
20
|
pi -e /absolute/path/to/pi-dynamic-help
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
NPM install:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pi install npm:pi-dynamic-help
|
|
23
|
-
```
|
|
24
|
-
|
|
25
23
|
After installing, run `/reload` or restart Pi if the command is not visible immediately.
|
|
26
24
|
|
|
27
25
|
## Commands
|
|
28
26
|
|
|
29
27
|
- `/help` — open the dynamic help dashboard.
|
|
30
|
-
- `/help refresh` — refresh the resource index and
|
|
28
|
+
- `/help refresh` — refresh the resource index and persist state.
|
|
31
29
|
- `/help search <term>` — filter the dashboard by a term.
|
|
32
30
|
- `/help pin <term>` — pin the best matching resource.
|
|
33
31
|
- `/help unpin <term>` — unpin the best matching resource.
|
|
@@ -41,6 +39,10 @@ After installing, run `/reload` or restart Pi if the command is not visible imme
|
|
|
41
39
|
|
|
42
40
|
The dashboard keeps command/tool/package/MCP sections separate so the resource type is clear.
|
|
43
41
|
|
|
42
|
+
## Usage counters
|
|
43
|
+
|
|
44
|
+
Usage counters currently focus on tools and MCP calls, based on Pi session/tool-result data that is available to the extension. Commands are ranked by pinning and known metadata unless Pi exposes reliable command-usage data in the future.
|
|
45
|
+
|
|
44
46
|
## State and migration
|
|
45
47
|
|
|
46
48
|
Runtime metadata is stored under the user's Pi agent state directory:
|
|
@@ -55,7 +57,15 @@ The old local-extension state file, if present, is read as a migration source:
|
|
|
55
57
|
~/.pi/agent/state/dynamic-help.json
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
State uses stable identities for resources. Command identities normalize `/help` and `help` to the same item, and this package's own local/npm/git/node_modules sources normalize to `pkg:pi-dynamic-help`, preserving `/help` and `/help-brief` pins and usage across install-source changes.
|
|
61
|
+
|
|
62
|
+
If the current state file is corrupt, it is moved aside as:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
~/.pi/agent/state/pi-dynamic-help/state.corrupt-<timestamp>.json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then the extension starts from legacy state or an empty state. State save failures show a warning but should not prevent `/help` from rendering.
|
|
59
69
|
|
|
60
70
|
Runtime state is not part of the npm package and should not be committed or published.
|
|
61
71
|
|
|
@@ -72,11 +82,14 @@ npm run test
|
|
|
72
82
|
npm run pack:dry
|
|
73
83
|
```
|
|
74
84
|
|
|
85
|
+
Tests are hermetic and use temporary directories for state-store coverage; they should not write to your real `~/.pi/agent/state`.
|
|
86
|
+
|
|
75
87
|
Useful local smoke test:
|
|
76
88
|
|
|
77
89
|
```bash
|
|
90
|
+
npm pack
|
|
78
91
|
TMP_AGENT_DIR=$(mktemp -d /tmp/pi-dynamic-help-agent-XXXXXX)
|
|
79
|
-
PI_CODING_AGENT_DIR="$TMP_AGENT_DIR" pi install
|
|
92
|
+
PI_CODING_AGENT_DIR="$TMP_AGENT_DIR" pi install ./pi-dynamic-help-0.2.0.tgz
|
|
80
93
|
PI_CODING_AGENT_DIR="$TMP_AGENT_DIR" pi --no-session -p "/help"
|
|
81
94
|
PI_CODING_AGENT_DIR="$TMP_AGENT_DIR" pi --no-session -p "/help refresh"
|
|
82
95
|
PI_CODING_AGENT_DIR="$TMP_AGENT_DIR" pi --no-session -p "/help search mcp"
|
|
@@ -90,3 +103,4 @@ PI_CODING_AGENT_DIR="$TMP_AGENT_DIR" pi --no-session -p "/help unpin bash"
|
|
|
90
103
|
- State looks stale: run `/help refresh`.
|
|
91
104
|
- A pin targets the wrong resource: use a more specific search term with `/help pin <term>` or undo it with `/help unpin <term>`.
|
|
92
105
|
- Installed package is not shown: confirm it is listed in `~/.pi/agent/settings.json` or project `.pi/settings.json`, then run `/help refresh`.
|
|
106
|
+
- State corruption warning appears: inspect the generated `state.corrupt-*.json` backup and continue using `/help`; the extension will create a fresh state file.
|