agent-simple-english 0.2.1 → 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.
@@ -11,7 +11,7 @@
11
11
  {
12
12
  "name": "simple-english",
13
13
  "description": "Apply technical and house-style writing rules to writes, edits, and git commit messages.",
14
- "version": "0.2.1",
14
+ "version": "0.3.1",
15
15
  "author": {
16
16
  "name": "JIA YI"
17
17
  },
@@ -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.2.1",
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/README.md CHANGED
@@ -69,17 +69,17 @@ Soft violations allow the event and add warning text.
69
69
 
70
70
  ### Session controls
71
71
 
72
- The `/ste` command controls the current Claude Code session.
72
+ The `/ase` command controls the current Claude Code session.
73
73
  New sessions start in enabled mode without a strict reply gate.
74
74
  A change in one session does not change a parallel session.
75
75
 
76
76
  | Command | Result |
77
77
  | --- | --- |
78
- | `/ste on` | Enable write, edit, commit, and reply checks. |
79
- | `/ste off` | Disable all checks and leave strict mode. |
80
- | `/ste status` | Show the mode, rule counts, and dictionary state. |
81
- | `/ste strict` | Enable the strict reply gate and all other checks. |
82
- | `/ste strict off` | Disable the strict reply gate and use reply feedback. |
78
+ | `/ase on` | Enable write, edit, commit, and reply checks. |
79
+ | `/ase off` | Disable all checks and leave strict mode. |
80
+ | `/ase status` | Show the mode, rule counts, and dictionary state. |
81
+ | `/ase strict` | Enable the strict reply gate and all other checks. |
82
+ | `/ase strict off` | Disable the strict reply gate and use reply feedback. |
83
83
 
84
84
  Strict mode blocks a `Stop` event when the reply has a hard violation.
85
85
  Claude Code then uses the violation details to write the reply again.
@@ -131,18 +131,18 @@ pi -e .
131
131
 
132
132
  The mode applies to the current pi session.
133
133
  The extension starts in enabled mode without strict reply gating.
134
- Type `/ste ` to see autocomplete suggestions for `on`, `off`, `status`, and `strict`.
134
+ Type `/ase ` to see autocomplete suggestions for `on`, `off`, `status`, and `strict`.
135
135
  The list changes to match the text that you type.
136
136
 
137
137
  | Command | Result |
138
138
  | --- | --- |
139
- | `/ste` | Toggle all enforcement. |
140
- | `/ste on` | Enable write, edit, commit, and reply checks. |
141
- | `/ste off` | Disable all checks and leave strict mode. |
142
- | `/ste status` | Show the mode, severity counts, and dictionary state. |
143
- | `/ste strict` | Enable strict reply gating and the other checks. |
144
- | `/ste strict on` | Enable strict reply gating and the other checks. |
145
- | `/ste strict off` | Disable strict reply gating without changing the other checks. |
139
+ | `/ase` | Toggle all enforcement. |
140
+ | `/ase on` | Enable write, edit, commit, and reply checks. |
141
+ | `/ase off` | Disable all checks and leave strict mode. |
142
+ | `/ase status` | Show the mode, severity counts, and dictionary state. |
143
+ | `/ase strict` | Enable strict reply gating and the other checks. |
144
+ | `/ase strict on` | Enable strict reply gating and the other checks. |
145
+ | `/ase strict off` | Disable strict reply gating without changing the other checks. |
146
146
 
147
147
  ## Install and use the CLI
148
148
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-simple-english",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Technical and house-style English lint engine, CLI, and host adapters",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,9 +9,10 @@ import {
9
9
  getSessionControl,
10
10
  setSessionEnabled,
11
11
  setSessionStrict,
12
+ toggleSessionEnabled,
12
13
  } from "./session-state.ts"
13
14
 
14
- const USAGE = "Usage: /ste [on|off|status|strict|strict off]"
15
+ const USAGE = "Usage: /ase [on|off|status|strict|strict off]"
15
16
 
16
17
  type DictionaryState = "loaded" | "not loaded" | `failed (${string})`
17
18
 
@@ -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."))
@@ -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
- ...state,
155
- enabled,
156
- strict: enabled ? state.strict : false,
157
- ...(enabled || state.pendingFeedback === undefined ? {} : { pendingFeedback: undefined }),
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
 
@@ -547,7 +547,7 @@ export default function simpleEnglishExtension(pi: ExtensionAPI): void {
547
547
  pi.setActiveTools(active ? [...tools, "say"] : tools)
548
548
  }
549
549
 
550
- pi.registerCommand("ste", {
550
+ pi.registerCommand("ase", {
551
551
  description: "Toggle writing-rule enforcement or show status. Use strict to gate replies.",
552
552
  getArgumentCompletions: (prefix) => {
553
553
  const completions = COMMAND_COMPLETIONS.filter((item) => item.value.startsWith(prefix))
@@ -576,7 +576,7 @@ export default function simpleEnglishExtension(pi: ExtensionAPI): void {
576
576
  return
577
577
  }
578
578
  if (command !== "" && command !== "on" && command !== "off") {
579
- ctx.ui.notify("Usage: /ste [on|off|status|strict|strict off]", "warning")
579
+ ctx.ui.notify("Usage: /ase [on|off|status|strict|strict off]", "warning")
580
580
  return
581
581
  }
582
582
 
File without changes