mushroom-mentor 0.1.0 → 0.1.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/README.ja.md +2 -2
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/index.ts +22 -2
- package/src/state.ts +3 -2
package/README.ja.md
CHANGED
|
@@ -34,9 +34,9 @@ opencode plugin add mushroom-mentor
|
|
|
34
34
|
| `/mushroom-review [対象]` | コードを変更せずレビューする |
|
|
35
35
|
| `/mushroom-help` | 簡単な案内を表示する |
|
|
36
36
|
|
|
37
|
-
状態はセッション単位。新規セッションは
|
|
37
|
+
状態はセッション単位。新規セッションはOFFで開始する。`/mushroom`で有効化する。規則は通常のターン、ツール後の継続、圧縮へ適用する。タイトル生成には適用しない。
|
|
38
38
|
|
|
39
|
-
Ponytailが読み込まれ有効な場合、Mushroom
|
|
39
|
+
Ponytailが読み込まれ有効な場合、Mushroomは有効化を拒否し、先に`/ponytail off`を実行するよう案内する。Ponytailの状態は変更しない。
|
|
40
40
|
|
|
41
41
|
## 規則
|
|
42
42
|
|
package/README.md
CHANGED
|
@@ -36,11 +36,11 @@ For local development, point `plugins` at this directory instead.
|
|
|
36
36
|
| `/mushroom-review [target]` | Review changes without changing code |
|
|
37
37
|
| `/mushroom-help` | Show the quick reference |
|
|
38
38
|
|
|
39
|
-
The state is per session. New sessions start
|
|
39
|
+
The state is per session. New sessions start OFF. Run /mushroom to turn it on. Rules apply to normal turns,
|
|
40
40
|
tool continuations, and compaction, not to title generation.
|
|
41
41
|
|
|
42
|
-
If Ponytail is loaded and on, Mushroom
|
|
43
|
-
It never changes Ponytail's state.
|
|
42
|
+
If Ponytail is loaded and on, Mushroom refuses to turn on and asks you to run
|
|
43
|
+
`/ponytail off` first. It never changes Ponytail's state.
|
|
44
44
|
|
|
45
45
|
## Rules
|
|
46
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mushroom-mentor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Coding rules that keep generated code clear, changeable, and honest about why",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"check": "biome check . && rumdl check .",
|
|
33
33
|
"check:write": "biome check --write .",
|
|
34
34
|
"check:md": "rumdl check .",
|
|
35
|
-
"prepublishOnly": "npm run verify",
|
|
35
|
+
"prepublishOnly": "npm run verify && bun scripts/check-release.ts",
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
37
|
"test": "bun test",
|
|
38
38
|
"verify": "npm run check && tsc --noEmit && bun test"
|
package/src/index.ts
CHANGED
|
@@ -113,6 +113,26 @@ export default Plugin.define({
|
|
|
113
113
|
|
|
114
114
|
const enabled = action === "on";
|
|
115
115
|
const ponytail = enabled ? await isPonytailLoadedAndActive(ctx) : false;
|
|
116
|
+
if (ponytail) {
|
|
117
|
+
const current = await readState(ctx, sessionID).catch(() => "unknown" as const);
|
|
118
|
+
if (current === "unknown") {
|
|
119
|
+
await ctx.session.prompt({
|
|
120
|
+
sessionID,
|
|
121
|
+
delivery,
|
|
122
|
+
text: "Tell the user in their language that the Mushroom state could not be read. Do not guess it.",
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (!isEnabled(current)) {
|
|
127
|
+
await ctx.session.prompt({
|
|
128
|
+
sessionID,
|
|
129
|
+
delivery,
|
|
130
|
+
text: 'Mushroom is still OFF. Ponytail is active; tell the user in their language to run /ponytail off, then run /mushroom again. Reply with a short line containing exactly "Mushroom: OFF". Do not change Ponytail yourself.',
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
116
136
|
try {
|
|
117
137
|
await runSerial(sessionID, () => writeState(ctx, sessionID, enabled));
|
|
118
138
|
} catch (error) {
|
|
@@ -152,9 +172,9 @@ Mushroom applies human-friendly coding rules to every turn in this session.
|
|
|
152
172
|
- /mushroom-review [target]: review changes without changing code
|
|
153
173
|
- /mushroom-help: this card
|
|
154
174
|
|
|
155
|
-
Ponytail cannot run at the same time; run /ponytail off to stop it.
|
|
175
|
+
Ponytail cannot run at the same time; run /ponytail off to stop it. Mushroom will not turn on until it is off.
|
|
156
176
|
|
|
157
|
-
State is ON or OFF for one session. New sessions start
|
|
177
|
+
State is ON or OFF for one session. New sessions start OFF; run /mushroom to turn it on.
|
|
158
178
|
Rules cover naming, structure, why comments, reuse, safety, and honest reasons. Minimum line count is not a goal.
|
|
159
179
|
|
|
160
180
|
Answer in the user's language.${prompt.text.trim() ? ` Ignore these arguments: ${prompt.text.trim()}` : ""}`,
|
package/src/state.ts
CHANGED
|
@@ -24,9 +24,10 @@ export async function writeState(ctx: Plugin.Context, sessionID: string, enabled
|
|
|
24
24
|
await ctx.storage.set(stateKey(sessionID), { schema: 1, enabled });
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// "new" counts as
|
|
27
|
+
// "new" counts as OFF so installing the plugin never adds a second ruleset
|
|
28
|
+
// until the user turns Mushroom on.
|
|
28
29
|
export function isEnabled(state: SessionState): boolean {
|
|
29
|
-
return state === "on"
|
|
30
|
+
return state === "on";
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
const tails = new Map<string, Promise<unknown>>();
|