pi-profile-switch 0.4.6 → 0.4.8
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/README.md +63 -11
- package/README.zh-CN.md +63 -11
- package/examples/example.json +6 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | [中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
Named profiles for [Pi](https://github.com/badlogic/pi-mono). A profile
|
|
6
|
-
|
|
7
|
-
Use a read-only profile for Q&A and code exploration, a full-powered one for implementation — all against the same installed resources.
|
|
5
|
+
Named profiles for [Pi](https://github.com/badlogic/pi-mono). A profile is a named capability bundle you define: skills, extensions, MCP servers, tools (including tools exposed by MCP servers and extensions), model defaults, and extra system-prompt instructions. Switch bundles inside a running Pi session — no restart.
|
|
8
6
|
|
|
9
7
|
## Install
|
|
10
8
|
|
|
@@ -27,7 +25,18 @@ pi-profile ask
|
|
|
27
25
|
pi-profile ask -- --model openai/gpt-5.4
|
|
28
26
|
```
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
## Define your own profiles
|
|
29
|
+
|
|
30
|
+
Profiles live in two JSON files, both optional:
|
|
31
|
+
|
|
32
|
+
| File | Scope |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `~/.pi-profile-switch/profiles.json` | Global, all projects. `PI_PROFILE_SWITCH_DIR` overrides the root; `~/.pi/agent/profiles.json` is read as a legacy fallback for migration. |
|
|
35
|
+
| `<project>/.pi/profiles.json` | Project-level, trusted projects only. |
|
|
36
|
+
|
|
37
|
+
Create or change a profile by editing the JSON directly — schema: [`schemas/profiles.schema.json`](schemas/profiles.schema.json).
|
|
38
|
+
|
|
39
|
+
On install, pi-profile-switch seeds the global file with a starter **`ask`** profile — read-only Q&A and code exploration. It assumes nothing about your setup; edit or delete it freely:
|
|
31
40
|
|
|
32
41
|
```json
|
|
33
42
|
{
|
|
@@ -45,7 +54,56 @@ On install, pi-profile-switch seeds `~/.pi-profile-switch/profiles.json` (global
|
|
|
45
54
|
}
|
|
46
55
|
```
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
One profile can use every field at once. This example `impl` profile loads the TDD skill, the mcp-scripting skill (shipped by pi-mcp-adapter), and your internal skills; wires up two MCP servers; allows the built-in tools plus both servers' MCP tools by glob; and pins the model and standing instructions:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"schemaVersion": 1,
|
|
62
|
+
"profiles": {
|
|
63
|
+
"impl": {
|
|
64
|
+
"label": "Implementation",
|
|
65
|
+
"description": "Full-powered implementation profile: every available field, pinned model",
|
|
66
|
+
"skills": [
|
|
67
|
+
"tdd",
|
|
68
|
+
"internal-*",
|
|
69
|
+
"mcp-scripting"
|
|
70
|
+
],
|
|
71
|
+
"extensions": [
|
|
72
|
+
"pi-mcp-adapter"
|
|
73
|
+
],
|
|
74
|
+
"mcps": [
|
|
75
|
+
"github",
|
|
76
|
+
"linear"
|
|
77
|
+
],
|
|
78
|
+
"tools": [
|
|
79
|
+
"read",
|
|
80
|
+
"grep",
|
|
81
|
+
"find",
|
|
82
|
+
"ls",
|
|
83
|
+
"bash",
|
|
84
|
+
"edit",
|
|
85
|
+
"write",
|
|
86
|
+
"mcp__*",
|
|
87
|
+
"github_*",
|
|
88
|
+
"linear_*"
|
|
89
|
+
],
|
|
90
|
+
"defaultProvider": "anthropic",
|
|
91
|
+
"defaultModel": "claude-sonnet-4-5",
|
|
92
|
+
"defaultThinkingLevel": "high",
|
|
93
|
+
"instructions": "Prefer small, verifiable changes. Run the test suite before claiming completion."
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
How fields resolve:
|
|
100
|
+
|
|
101
|
+
- `skills`, `extensions`, `mcps`, `tools` take names or globs (e.g. `"internal-*"`) referencing resources you already installed or configured — profiles never copy them. Installed packages and files in standard locations are discovered automatically; no registration needed.
|
|
102
|
+
- `tools` expands against Pi's live tool registry — built-ins, extension-provided tools, and tools exposed by MCP servers. MCP tools are registered as `mcp__<server>` (proxy) and `<server>_<tool>` (direct tools, the adapter's default `toolPrefix`), so globs like `mcp__*` and `github_*` cover them.
|
|
103
|
+
- `mcps` references servers from your pi-mcp-adapter configuration; connection details stay in the adapter's own config.
|
|
104
|
+
- Any field you omit keeps plain Pi behavior.
|
|
105
|
+
|
|
106
|
+
The files in [`examples/`](examples/) mirror the two profiles above: `profiles.json` is the seeded starter, `example.json` the full-field demo.
|
|
49
107
|
|
|
50
108
|
## Commands
|
|
51
109
|
|
|
@@ -61,12 +119,6 @@ In the TUI, the `/profile` command family manages everything in-session:
|
|
|
61
119
|
|
|
62
120
|
All commands work in non-interactive modes (`--mode rpc|print|json`); CRUD wizards are TUI-only.
|
|
63
121
|
|
|
64
|
-
## Guarantees
|
|
65
|
-
|
|
66
|
-
- **Reference, never copy** — profiles point at resources you already own and maintain.
|
|
67
|
-
- **Pi-native** — anything a profile doesn't explicitly control keeps plain Pi behavior.
|
|
68
|
-
- **Fail safe** — untrusted project directories are never read; a failed switch rolls back to the last working configuration.
|
|
69
|
-
|
|
70
122
|
## Docs
|
|
71
123
|
|
|
72
124
|
- [Architecture](docs/architecture/overview.md) · [ADRs](docs/adr/) · [Glossary](CONTEXT.md) (Chinese)
|
package/README.zh-CN.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | [中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
[Pi](https://github.com/badlogic/pi-mono) 的命名 profile 扩展。一个 profile
|
|
6
|
-
|
|
7
|
-
问答与代码走读用只读 profile,实现需求用全量 profile——全部基于同一套已安装的资源。
|
|
5
|
+
[Pi](https://github.com/badlogic/pi-mono) 的命名 profile 扩展。一个 profile 是你自定义的命名能力组合:skills、extensions、MCP server、tools(包括 MCP server 和 extension 提供的工具)、默认模型,以及追加到系统提示词的 instructions。在同一个运行中的 Pi 会话里切换这些组合,无需重启。
|
|
8
6
|
|
|
9
7
|
## 安装
|
|
10
8
|
|
|
@@ -27,7 +25,18 @@ pi-profile ask
|
|
|
27
25
|
pi-profile ask -- --model openai/gpt-5.4
|
|
28
26
|
```
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
## 自定义 profile
|
|
29
|
+
|
|
30
|
+
profile 定义在两个 JSON 文件中,均可选:
|
|
31
|
+
|
|
32
|
+
| 文件 | 作用域 |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `~/.pi-profile-switch/profiles.json` | 全局,对所有项目生效。`PI_PROFILE_SWITCH_DIR` 可自定义根目录;`~/.pi/agent/profiles.json` 作为遗留路径向下兼容,用于迁移。 |
|
|
35
|
+
| `<项目>/.pi/profiles.json` | 项目级,仅对已信任项目生效。 |
|
|
36
|
+
|
|
37
|
+
直接编辑 JSON 即可创建或修改 profile——schema 见 [`schemas/profiles.schema.json`](schemas/profiles.schema.json)。
|
|
38
|
+
|
|
39
|
+
安装时,pi-profile-switch 会向全局文件播种一个初始 **`ask`** profile——只读的问答与代码走读模式。它不假设你安装过任何插件,可随意修改或删除:
|
|
31
40
|
|
|
32
41
|
```json
|
|
33
42
|
{
|
|
@@ -45,7 +54,56 @@ pi-profile ask -- --model openai/gpt-5.4
|
|
|
45
54
|
}
|
|
46
55
|
```
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
一个 profile 可以同时使用全部字段。下面这个 `impl` profile 示例加载 TDD skill、mcp-scripting skill(pi-mcp-adapter 自带)和你的内部 skills;接入两个 MCP server;tool 白名单用 glob 覆盖内建工具和这两个 server 的 MCP 工具;并钉住模型与常驻 instructions:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"schemaVersion": 1,
|
|
62
|
+
"profiles": {
|
|
63
|
+
"impl": {
|
|
64
|
+
"label": "Implementation",
|
|
65
|
+
"description": "Full-powered implementation profile: every available field, pinned model",
|
|
66
|
+
"skills": [
|
|
67
|
+
"tdd",
|
|
68
|
+
"internal-*",
|
|
69
|
+
"mcp-scripting"
|
|
70
|
+
],
|
|
71
|
+
"extensions": [
|
|
72
|
+
"pi-mcp-adapter"
|
|
73
|
+
],
|
|
74
|
+
"mcps": [
|
|
75
|
+
"github",
|
|
76
|
+
"linear"
|
|
77
|
+
],
|
|
78
|
+
"tools": [
|
|
79
|
+
"read",
|
|
80
|
+
"grep",
|
|
81
|
+
"find",
|
|
82
|
+
"ls",
|
|
83
|
+
"bash",
|
|
84
|
+
"edit",
|
|
85
|
+
"write",
|
|
86
|
+
"mcp__*",
|
|
87
|
+
"github_*",
|
|
88
|
+
"linear_*"
|
|
89
|
+
],
|
|
90
|
+
"defaultProvider": "anthropic",
|
|
91
|
+
"defaultModel": "claude-sonnet-4-5",
|
|
92
|
+
"defaultThinkingLevel": "high",
|
|
93
|
+
"instructions": "Prefer small, verifiable changes. Run the test suite before claiming completion."
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
字段解析规则:
|
|
100
|
+
|
|
101
|
+
- `skills`、`extensions`、`mcps`、`tools` 接受名称或 glob(如 `"internal-*"`),引用你已安装或已配置的资源——profile 从不复制资源。已安装的包和标准目录下的文件会被自动发现,无需注册。
|
|
102
|
+
- `tools` 针对 Pi 的实时工具注册表展开——内建工具、extension 提供的工具,以及 MCP server 暴露的工具。MCP 工具注册为 `mcp__<server>`(代理)和 `<server>_<tool>`(直接工具,adapter 默认 `toolPrefix`),因此 `mcp__*`、`github_*` 这类 glob 可以覆盖它们。
|
|
103
|
+
- `mcps` 引用 pi-mcp-adapter 配置中的 server;连接细节留在 adapter 自己的配置里。
|
|
104
|
+
- 未写的字段保持原生 Pi 行为。
|
|
105
|
+
|
|
106
|
+
[`examples/`](examples/) 中的两个文件与上面一一对应:`profiles.json` 是播种的初始 profile,`example.json` 是全字段演示。
|
|
49
107
|
|
|
50
108
|
## 命令
|
|
51
109
|
|
|
@@ -61,12 +119,6 @@ pi-profile ask -- --model openai/gpt-5.4
|
|
|
61
119
|
|
|
62
120
|
非交互模式(`--mode rpc|print|json`)下命令同样生效;CRUD 向导仅 TUI 可用。
|
|
63
121
|
|
|
64
|
-
## 保证
|
|
65
|
-
|
|
66
|
-
- **引用而非复制**——profile 指向你自己拥有和维护的资源。
|
|
67
|
-
- **Pi 原生**——profile 未显式控制的一切保持原生 Pi 行为。
|
|
68
|
-
- **失败安全**——未信任的项目目录从不读取;切换失败回滚到上一份可用配置。
|
|
69
|
-
|
|
70
122
|
## 文档
|
|
71
123
|
|
|
72
124
|
- [架构设计](docs/architecture/overview.md) · [ADR](docs/adr/) · [术语表](CONTEXT.md)
|
package/examples/example.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"description": "Full-powered implementation profile: every available field, pinned model",
|
|
7
7
|
"skills": [
|
|
8
8
|
"tdd",
|
|
9
|
-
"internal-*"
|
|
9
|
+
"internal-*",
|
|
10
|
+
"mcp-scripting"
|
|
10
11
|
],
|
|
11
12
|
"extensions": [
|
|
12
13
|
"pi-mcp-adapter"
|
|
@@ -22,7 +23,10 @@
|
|
|
22
23
|
"ls",
|
|
23
24
|
"bash",
|
|
24
25
|
"edit",
|
|
25
|
-
"write"
|
|
26
|
+
"write",
|
|
27
|
+
"mcp__*",
|
|
28
|
+
"github_*",
|
|
29
|
+
"linear_*"
|
|
26
30
|
],
|
|
27
31
|
"defaultProvider": "anthropic",
|
|
28
32
|
"defaultModel": "claude-sonnet-4-5",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-profile-switch",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Named profiles for Pi: reference skills, extensions, MCP servers, and tools per workflow, switched without restarting.",
|
|
3
|
+
"version": "0.4.8",
|
|
4
|
+
"description": "Named profiles for Pi: reference skills, extensions, MCP servers, and tools per workflow, switched without restarting. Install: npm install -g pi-profile-switch (not pi install).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"pi-package",
|