mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
从官方 Git 仓库导入 chandra447/pi-hermes-memory 在 tag v0.9.10 (df624056a2e8c68bc89ba0a81e1c120856ec9665,2026-10-02)的源码快照。 本次仅导入源码,尚未接入组合包:package.json、加载顺序、依赖与权限策略 均未改动。 - 原样导入 src/、tests/、docs/、scripts/、README、CHANGELOG、PLAN、 AGENTS 与 LICENSE;该快照共 156 个上游文件。 - 剔除嵌套 .git、上游 .github 工作流、.ralph/、.claude/、node_modules、 覆盖率与构建产物。 - 新增中文 UPSTREAM.md,记录来源,以及启用前必须完成的待决事项: 在 pi-compaction 之前注册加载顺序、better-sqlite3 版本与根 allowScripts 对齐、strip-ansi 解析确认。 - 说明选择 tag 而非 main 的原因:导入时上游 main 已领先至 24fcd8ad26fc27badb8d7dbaf8034645de07b893(2026-10-11),选 tag 是为 对应一个已发布、可复现的版本。 尚未接线。启用前还需反转 tests/extension-load.test.ts 中"不得加载 Hermes"的断言,并同步 pi-tool-search 分组、权限策略与文档。 验证:快照 156 个上游文件全部导入,目录内仅多出 UPSTREAM.md 一份; 已确认与上游 main 内容存在差异,证明取的是 tag 而非 main。
150 lines
3.7 KiB
Markdown
150 lines
3.7 KiB
Markdown
# Publishing to pi.dev/packages
|
|
|
|
## How pi.dev/packages Works
|
|
|
|
The [package gallery](https://pi.dev/packages) automatically displays any npm package tagged with the keyword `pi-package`. There is no manual submission — you publish to npm, and pi.dev picks it up.
|
|
|
|
## What We Need
|
|
|
|
### 1. Update `package.json` with Pi manifest
|
|
|
|
Current state:
|
|
```json
|
|
{
|
|
"name": "pi-hermes-memory",
|
|
"keywords": [] // missing pi-package keyword
|
|
// no "pi" manifest
|
|
}
|
|
```
|
|
|
|
Target state:
|
|
```json
|
|
{
|
|
"name": "pi-hermes-memory",
|
|
"version": "0.1.0",
|
|
"description": "Persistent memory and self-directed learning loop for Pi — ported from the Hermes agent harness.",
|
|
"keywords": [
|
|
"pi-package",
|
|
"pi-extension",
|
|
"memory",
|
|
"learning",
|
|
"hermes"
|
|
],
|
|
"files": [
|
|
"src",
|
|
"README.md",
|
|
"LICENSE"
|
|
],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/chandra447/pi-hermes-memory"
|
|
},
|
|
"pi": {
|
|
"extensions": ["./src/index.ts"],
|
|
"image": "https://raw.githubusercontent.com/chandra447/pi-hermes-memory/main/docs/assets/hermes-memory-preview.png"
|
|
},
|
|
"peerDependencies": {
|
|
"@earendil-works/pi-coding-agent": "*"
|
|
}
|
|
}
|
|
```
|
|
|
|
Key changes:
|
|
- `"keywords": ["pi-package", ...]` — **required** for pi.dev listing
|
|
- `"pi": { "extensions": ["./src/index.ts"] }` — tells Pi where the entry point is
|
|
- `"files": ["src", "README.md", "LICENSE"]` — only publish what's needed
|
|
- `"peerDependencies"` — Pi provides the API, no runtime deps needed
|
|
- `"pi": { "image": "..." }` — optional preview image for the gallery
|
|
|
|
### 2. npm account setup
|
|
|
|
```bash
|
|
# Login to npm (create account at npmjs.com if needed)
|
|
npm login
|
|
|
|
# Verify you're logged in
|
|
npm whoami
|
|
```
|
|
|
|
### 3. Publish
|
|
|
|
```bash
|
|
# Dry run first — verify what gets published
|
|
npm publish --dry-run
|
|
|
|
# Publish as public (scoped packages default to restricted)
|
|
npm publish --access public
|
|
```
|
|
|
|
### 4. Verify
|
|
|
|
After publishing:
|
|
1. Check `https://www.npmjs.com/package/pi-hermes-memory`
|
|
2. Check `https://pi.dev/packages` — should appear within minutes
|
|
3. Test install: `pi install npm:pi-hermes-memory`
|
|
|
|
## Post-Publish
|
|
|
|
### Installation becomes one command
|
|
|
|
Before (git):
|
|
```bash
|
|
pi install git:github.com/chandra447/pi-hermes-memory
|
|
```
|
|
|
|
After (npm):
|
|
```bash
|
|
pi install npm:pi-hermes-memory
|
|
```
|
|
|
|
### Update README installation instructions
|
|
|
|
Replace:
|
|
```
|
|
pi install git:github.com/chandra447/pi-hermes-memory
|
|
```
|
|
|
|
With:
|
|
```
|
|
pi install npm:pi-hermes-memory
|
|
```
|
|
|
|
Keep the git option as an alternative.
|
|
|
|
### Version updates
|
|
|
|
```bash
|
|
# Patch (0.1.0 → 0.1.1): bug fixes
|
|
npm version patch && npm publish
|
|
|
|
# Minor (0.1.0 → 0.2.0): new features, backwards compatible
|
|
npm version minor && npm publish
|
|
|
|
# Major (0.1.0 → 1.0.0): breaking changes
|
|
npm version major && npm publish
|
|
```
|
|
|
|
## Checklist
|
|
|
|
- [ ] Update `package.json` with `pi` manifest and `pi-package` keyword
|
|
- [ ] Remove `devDependencies` that shouldn't ship (keep `peerDependencies` only)
|
|
- [ ] Add `"files"` field to control what npm includes
|
|
- [ ] Create npm account if needed
|
|
- [ ] `npm login`
|
|
- [ ] `npm publish --dry-run` — verify contents
|
|
- [ ] `npm publish --access public`
|
|
- [ ] Verify on npmjs.com
|
|
- [ ] Verify on pi.dev/packages
|
|
- [ ] Test `pi install npm:pi-hermes-memory`
|
|
- [ ] Update README installation instructions
|
|
- [ ] Add demo screenshot/image for pi.dev gallery (optional but recommended)
|
|
- [ ] Tag release: `git tag v0.1.0-npm && git push --tags`
|
|
|
|
## Reference
|
|
|
|
- [Pi Packages docs](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent/docs/packages.md)
|
|
- [pi.dev/packages](https://pi.dev/packages)
|
|
- [npm search for pi-package](https://www.npmjs.com/search?q=keywords%3Api-package)
|
|
- Example: [@samfp/pi-memory](https://www.npmjs.com/package/@samfp/pi-memory) — 6k downloads, same pattern
|