pi-dynamic-help 0.1.0 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1
4
+
5
+ - 移除 `/help` 输出中硬编码的 MCP 用法示例(包含特定服务器名 chrome-devtools/screenshot)
6
+ - 移除 `/help` 输出中硬编码的"示例"工作流部分(需求分析/系统设计//goal//brainstorm)
7
+ - `/help` 现在只显示动态生成的内容,不再包含可能不一致的硬编码示例
8
+ ## 0.2.0
9
+
10
+ - Refactor the extension into maintainable modules for state, identity, resource indexing, rendering, and extension wiring.
11
+ - Add state v3 canonical identities for command names and package sources.
12
+ - Preserve this package's `/help` and `/help-brief` usage/pins across local, npm, git, and node_modules source forms.
13
+ - Add safe state loading with corrupt-state backups and save-failure warnings.
14
+ - Make markdown rendering pure and escape dynamic resource fields.
15
+ - Expand hermetic tests for migration, state persistence failures, rendering, settings parsing, and pin matching.
16
+ - Tighten Pi peer dependency ranges to `>=0.78.0 <1`.
17
+
3
18
  ## 0.1.0
4
19
 
5
- - Initial package extraction for the dynamic `/help` dashboard.
20
+ - 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 usage counters.
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
- The old file is not deleted. Migration preserves usage counts, pinned items, and timestamps where possible. The package normalizes source keys idempotently to avoid repeated `local:local:...` prefixes.
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 /absolute/path/to/pi-dynamic-help
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.