agent-simple-english 0.3.0 → 0.3.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/plugin.schema.json",
|
|
3
3
|
"name": "simple-english",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"description": "Apply technical and house-style writing rules to writes, edits, and git commit messages.",
|
|
6
6
|
"repository": "https://github.com/jyooi/agent-simple-english",
|
|
7
7
|
"license": "MIT",
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getSessionControl,
|
|
10
10
|
setSessionEnabled,
|
|
11
11
|
setSessionStrict,
|
|
12
|
+
toggleSessionEnabled,
|
|
12
13
|
} from "./session-state.ts"
|
|
13
14
|
|
|
14
15
|
const USAGE = "Usage: /ase [on|off|status|strict|strict off]"
|
|
@@ -32,6 +33,12 @@ const updateEnabled = (sessionId: string, enabled: boolean) =>
|
|
|
32
33
|
catch: (cause) => new Error(`cannot update session state: ${cause}`),
|
|
33
34
|
})
|
|
34
35
|
|
|
36
|
+
const toggleEnabled = (sessionId: string) =>
|
|
37
|
+
Effect.tryPromise({
|
|
38
|
+
try: () => toggleSessionEnabled(sessionId),
|
|
39
|
+
catch: (cause) => new Error(`cannot update session state: ${cause}`),
|
|
40
|
+
})
|
|
41
|
+
|
|
35
42
|
const updateStrict = (sessionId: string, strict: boolean) =>
|
|
36
43
|
Effect.tryPromise({
|
|
37
44
|
try: () => setSessionStrict(sessionId, strict),
|
|
@@ -69,6 +76,11 @@ export function runSessionCommand(args: readonly string[]): Effect.Effect<string
|
|
|
69
76
|
return Effect.fail(new Error(USAGE))
|
|
70
77
|
}
|
|
71
78
|
const command = commandParts.join(" ").trim().toLowerCase()
|
|
79
|
+
if (command === "") {
|
|
80
|
+
return toggleEnabled(sessionId).pipe(
|
|
81
|
+
Effect.map((enabled) => `Writing-rule enforcement ${enabled ? "enabled" : "disabled"}.`),
|
|
82
|
+
)
|
|
83
|
+
}
|
|
72
84
|
if (command === "status") return status(sessionId, cwd)
|
|
73
85
|
if (command === "on") {
|
|
74
86
|
return updateEnabled(sessionId, true).pipe(Effect.as("Writing-rule enforcement enabled."))
|
package/src/cli/session-state.ts
CHANGED
|
@@ -147,15 +147,26 @@ export async function getSessionControl(sessionId: string): Promise<SessionContr
|
|
|
147
147
|
})
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
const setEnabled = (state: SessionState, enabled: boolean): SessionState => ({
|
|
151
|
+
...state,
|
|
152
|
+
enabled,
|
|
153
|
+
strict: enabled ? state.strict : false,
|
|
154
|
+
...(enabled || state.pendingFeedback === undefined ? {} : { pendingFeedback: undefined }),
|
|
155
|
+
})
|
|
156
|
+
|
|
150
157
|
export async function setSessionEnabled(sessionId: string, enabled: boolean): Promise<void> {
|
|
151
158
|
await withStateLock(sessionId, async () => {
|
|
152
159
|
const state = currentState(await readState(sessionId))
|
|
153
|
-
await writeState(sessionId,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
await writeState(sessionId, setEnabled(state, enabled))
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export async function toggleSessionEnabled(sessionId: string): Promise<boolean> {
|
|
165
|
+
return withStateLock(sessionId, async () => {
|
|
166
|
+
const state = currentState(await readState(sessionId))
|
|
167
|
+
const enabled = !state.enabled
|
|
168
|
+
await writeState(sessionId, setEnabled(state, enabled))
|
|
169
|
+
return enabled
|
|
159
170
|
})
|
|
160
171
|
}
|
|
161
172
|
|