@simplysm/sd-claude 13.0.83 → 13.0.85
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/claude/rules/sd-claude-rules.md +12 -6
- package/claude/rules/sd-library-issue.md +7 -0
- package/claude/rules/sd-simplysm-usage.md +5 -5
- package/claude/sd-statusline.py +5 -2
- package/claude/skills/sd-api-review/SKILL.md +49 -53
- package/claude/skills/sd-check/SKILL.md +45 -41
- package/claude/skills/sd-commit/SKILL.md +31 -31
- package/claude/skills/sd-debug/SKILL.md +77 -68
- package/claude/skills/sd-document/SKILL.md +56 -56
- package/claude/skills/sd-document/__pycache__/_common.cpython-313.pyc +0 -0
- package/claude/skills/sd-email-analyze/SKILL.md +22 -22
- package/claude/skills/sd-init/SKILL.md +63 -63
- package/claude/skills/sd-plan/SKILL.md +127 -66
- package/claude/skills/sd-readme/SKILL.md +59 -59
- package/claude/skills/sd-review/SKILL.md +42 -35
- package/claude/skills/sd-simplify/SKILL.md +37 -30
- package/package.json +4 -1
- package/scripts/cli.mjs +12 -0
- package/scripts/postinstall.mjs +20 -4
|
@@ -1,126 +1,126 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sd-readme
|
|
3
|
-
description: "README
|
|
3
|
+
description: Used when requesting "README documentation generation", "sd-readme", etc.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# SD Readme —
|
|
6
|
+
# SD Readme — Monorepo Package README Documentation Generator
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Automatically generates README.md documentation for each package in the monorepo. Applies Progressive Disclosure principles by choosing either a single README.md or a README.md + docs/*.md structure depending on the package size.
|
|
9
9
|
|
|
10
|
-
ARGUMENTS:
|
|
10
|
+
ARGUMENTS: Package name (optional). If specified, only that package is processed; if omitted, all packages are processed in parallel.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Workflow
|
|
13
13
|
|
|
14
14
|
```mermaid
|
|
15
15
|
flowchart TD
|
|
16
|
-
A[
|
|
17
|
-
B -- Yes --> C[README.md
|
|
18
|
-
B -- No --> D[public
|
|
19
|
-
D --> E[
|
|
20
|
-
E --
|
|
16
|
+
A[Parse arguments] --> B{Package name specified?}
|
|
17
|
+
B -- Yes --> C[Generate README.md]
|
|
18
|
+
B -- No --> D[Collect public package list]
|
|
19
|
+
D --> E[Run Agent per package in parallel]
|
|
20
|
+
E -- Each Agent --> C
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
### A.
|
|
23
|
+
### A. Parse Arguments
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Extract the package name from the ARGUMENTS passed when invoking the skill.
|
|
26
26
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
27
|
+
- **Package name specified** → Find the corresponding directory under `packages/` and proceed directly to **C. Generate README.md**.
|
|
28
|
+
- **Package name not specified** → Proceed to **D. Collect public package list**.
|
|
29
29
|
|
|
30
|
-
### C. README.md
|
|
30
|
+
### C. Generate README.md
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Perform the following for a single target package.
|
|
33
33
|
|
|
34
|
-
#### C-1. package.json
|
|
34
|
+
#### C-1. Analyze package.json
|
|
35
35
|
|
|
36
|
-
`packages/<name>/package.json
|
|
36
|
+
Read `packages/<name>/package.json`:
|
|
37
37
|
|
|
38
|
-
1. `name`
|
|
39
|
-
2. `"private": true
|
|
40
|
-
3.
|
|
38
|
+
1. Check the `name` and `description` fields.
|
|
39
|
+
2. If `"private": true`, **skip** this package.
|
|
40
|
+
3. Identify the package entry point source code.
|
|
41
41
|
|
|
42
|
-
#### C-2.
|
|
42
|
+
#### C-2. Analyze Source Code
|
|
43
43
|
|
|
44
|
-
1.
|
|
45
|
-
2. JSDoc
|
|
44
|
+
1. Recursively read the entry point file and all exports to collect every public API.
|
|
45
|
+
2. If JSDoc comments exist, use them as descriptions for each item.
|
|
46
46
|
|
|
47
|
-
#### C-3.
|
|
47
|
+
#### C-3. Determine Document Structure and Generate
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Examine the source code size and the number of logical categories, then **autonomously** decide which of the two structures below is appropriate:
|
|
50
50
|
|
|
51
|
-
-
|
|
52
|
-
- **README.md + docs/*.md**:
|
|
51
|
+
- **Single README.md**: When the package is small, has few APIs, and category classification is unnecessary
|
|
52
|
+
- **README.md + docs/*.md**: When the package is large or has multiple logical categories
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
If an existing README.md or docs/ directory exists, **modify only the changed parts** based on the existing content. If no existing documentation exists, create it from scratch.
|
|
55
|
+
If the structure changes (B to A), delete the now-unnecessary `docs/` directory.
|
|
56
|
+
Write in **English**.
|
|
57
57
|
|
|
58
|
-
#### C-4. package.json files
|
|
58
|
+
#### C-4. Manage package.json files Field
|
|
59
59
|
|
|
60
|
-
`docs/`
|
|
60
|
+
When creating or deleting the `docs/` directory, update the `files` array in `package.json` accordingly:
|
|
61
61
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
62
|
+
- **When applying Structure B**: If the `files` array does not contain `"docs"`, add it.
|
|
63
|
+
- **When applying Structure A**: If the `files` array contains `"docs"`, remove it.
|
|
64
64
|
|
|
65
65
|
---
|
|
66
66
|
|
|
67
|
-
#####
|
|
67
|
+
##### Structure A: Single README.md (Small Packages)
|
|
68
68
|
|
|
69
|
-
`packages/<name>/README.md`
|
|
69
|
+
Create the `packages/<name>/README.md` file:
|
|
70
70
|
|
|
71
71
|
```markdown
|
|
72
72
|
# <package-name from package.json>
|
|
73
73
|
|
|
74
74
|
> <description from package.json>
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
<Write a detailed description of the package's main features and purpose in English>
|
|
77
77
|
|
|
78
78
|
## API Reference
|
|
79
79
|
|
|
80
80
|
### <exportedName>
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
|
-
<export
|
|
83
|
+
<export signature code>
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
<Description of this API>
|
|
87
87
|
|
|
88
88
|
---
|
|
89
89
|
|
|
90
|
-
(...
|
|
90
|
+
(... Repeat for all exported items ...)
|
|
91
91
|
|
|
92
92
|
## Usage Examples
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
95
|
import { ... } from "<package-name>";
|
|
96
96
|
|
|
97
|
-
//
|
|
97
|
+
// Main usage example code
|
|
98
98
|
```
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
---
|
|
102
102
|
|
|
103
|
-
#####
|
|
103
|
+
##### Structure B: README.md + docs/*.md (Large Packages)
|
|
104
104
|
|
|
105
|
-
**README.md** — `packages/<name>/README.md`
|
|
105
|
+
**README.md** — Create the `packages/<name>/README.md` file:
|
|
106
106
|
|
|
107
107
|
```markdown
|
|
108
108
|
# <package-name from package.json>
|
|
109
109
|
|
|
110
110
|
> <description from package.json>
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
<Write a detailed description of the package's main features and purpose in English>
|
|
113
113
|
|
|
114
114
|
## Documentation
|
|
115
115
|
|
|
116
116
|
| Category | Description |
|
|
117
117
|
|----------|-------------|
|
|
118
|
-
| [<Category1>](docs/<category1>.md) |
|
|
119
|
-
| [<Category2>](docs/<category2>.md) |
|
|
118
|
+
| [<Category1>](docs/<category1>.md) | <Category description and list of key items> |
|
|
119
|
+
| [<Category2>](docs/<category2>.md) | <Category description and list of key items> |
|
|
120
120
|
| ... | ... |
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
**docs/*.md** —
|
|
123
|
+
**docs/*.md** — Create a `packages/<name>/docs/<category>.md` file for each category:
|
|
124
124
|
|
|
125
125
|
```markdown
|
|
126
126
|
# <Category Name>
|
|
@@ -128,39 +128,39 @@ import { ... } from "<package-name>";
|
|
|
128
128
|
## <exportedName>
|
|
129
129
|
|
|
130
130
|
```typescript
|
|
131
|
-
<export
|
|
131
|
+
<export signature code>
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
<Description of this API>
|
|
135
135
|
|
|
136
136
|
---
|
|
137
137
|
|
|
138
|
-
(...
|
|
138
|
+
(... Repeat for all exported items in this category ...)
|
|
139
139
|
|
|
140
140
|
## Usage Examples
|
|
141
141
|
|
|
142
142
|
```typescript
|
|
143
143
|
import { ... } from "<package-name>";
|
|
144
144
|
|
|
145
|
-
//
|
|
145
|
+
// Main usage example code for this category
|
|
146
146
|
```
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
Determine category names and classifications autonomously, considering the source code directory structure, functional similarity, etc.
|
|
150
150
|
|
|
151
151
|
---
|
|
152
152
|
|
|
153
|
-
### D.
|
|
153
|
+
### D. Collect Public Package List
|
|
154
154
|
|
|
155
|
-
`packages/*/package.json
|
|
155
|
+
Use Glob to search `packages/*/package.json`, excluding packages with `private: true`.
|
|
156
156
|
|
|
157
157
|
---
|
|
158
158
|
|
|
159
|
-
### E.
|
|
159
|
+
### E. Run Agent Per Package in Parallel
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
For each remaining package, use the Agent tool to pass the following prompt **in parallel**:
|
|
162
162
|
```
|
|
163
|
-
/sd-readme
|
|
163
|
+
/sd-readme <package-name>
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
Terminate once all subagents have completed.
|
|
@@ -1,65 +1,72 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sd-review
|
|
3
|
-
description:
|
|
3
|
+
description: Used when requesting "bug review", "sd-review", "code review", "find bugs", etc. Analyzes code at the specified path for potential bugs, then creates a plan and applies fixes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# SD Review —
|
|
6
|
+
# SD Review — Potential Bug Detection
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Reads the code at the specified path, analyzes it for potential bugs, then creates and executes a plan via the `/sd-plan` process.
|
|
9
9
|
|
|
10
|
-
ARGUMENTS:
|
|
10
|
+
ARGUMENTS: Target path (required). Specify any path within the repo.
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
## Step 1:
|
|
14
|
+
## Step 1: Validate Arguments
|
|
15
15
|
|
|
16
|
-
1.
|
|
17
|
-
2.
|
|
16
|
+
1. Extract the target path from ARGUMENTS.
|
|
17
|
+
2. If no path is provided, display "Please specify a target path. Example: `/sd-review packages/my-pkg`" and stop.
|
|
18
18
|
|
|
19
|
-
## Step 2:
|
|
19
|
+
## Step 2: Bug Analysis (Do Not Modify Code)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
Read the code at the target path and search for potential bugs from the following 5 perspectives.
|
|
22
|
+
Do not modify the code under any circumstances. Only compile and output a list of findings.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
1.
|
|
26
|
-
2. **Null/Undefined
|
|
27
|
-
3.
|
|
28
|
-
4.
|
|
29
|
-
5.
|
|
24
|
+
**Analysis Perspectives:**
|
|
25
|
+
1. **Logic/Correctness** — Incorrect conditions, off-by-one errors, wrong operators, unintended branching
|
|
26
|
+
2. **Null/Undefined Safety** — Missing null checks, unused optional chaining, misuse of type assertions
|
|
27
|
+
3. **Error Handling** — Swallowed errors, missing catch blocks, improper error propagation
|
|
28
|
+
4. **Edge Cases** — Empty arrays/strings, boundary values, concurrency/race conditions, missing await
|
|
29
|
+
5. **Resource Management** — Unclosed connections, event listener leaks, memory leak patterns
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Write each finding in the following format:
|
|
32
32
|
```
|
|
33
|
-
-
|
|
33
|
+
- **filepath:line**
|
|
34
|
+
- Current code: (excerpt of the relevant code)
|
|
35
|
+
- Problem description:
|
|
36
|
+
- Suggested fix:
|
|
37
|
+
- Reasons to fix: Rationale for applying the fix
|
|
38
|
+
- Reasons not to fix: Rationale for keeping the current code
|
|
34
39
|
```
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
If no findings are discovered, display "No potential bugs were found." and stop.
|
|
37
42
|
|
|
38
|
-
## Step 3: sd-plan
|
|
43
|
+
## Step 3: Create Plan via sd-plan
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
Using the list of findings from Step 2 as the task description, invoke `sd-plan` via the Skill tool. Pass the following as args:
|
|
41
46
|
|
|
42
47
|
```
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
The following are potential bug fixes **analyzed and suggested by the LLM**.
|
|
49
|
+
Since these fixes were not explicitly requested by the user, treat them as uncertain.
|
|
45
50
|
|
|
46
|
-
##
|
|
47
|
-
|
|
51
|
+
## Target
|
|
52
|
+
<target path>
|
|
48
53
|
|
|
49
|
-
## LLM
|
|
50
|
-
|
|
54
|
+
## LLM-Suggested Fixes
|
|
55
|
+
When asking the user about uncertain fixes, **always present** the following information first so the user can understand the context.
|
|
51
56
|
|
|
52
57
|
```
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
+
Fix:
|
|
59
|
+
- Filepath:line:
|
|
60
|
+
- Current code: (excerpt of the relevant code)
|
|
61
|
+
- Problem description:
|
|
62
|
+
- Suggested fix:
|
|
63
|
+
- Reasons to fix:
|
|
64
|
+
- Reasons not to fix:
|
|
58
65
|
```
|
|
59
66
|
|
|
60
|
-
<
|
|
67
|
+
<Full list of findings from Step 2>
|
|
61
68
|
```
|
|
62
69
|
|
|
63
|
-
## Step 4:
|
|
70
|
+
## Step 4: Execute Plan
|
|
64
71
|
|
|
65
|
-
sd-plan
|
|
72
|
+
Once sd-plan completes and produces a finalized plan, apply the code modifications according to that plan.
|
|
@@ -1,59 +1,66 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sd-simplify
|
|
3
|
-
description: "
|
|
3
|
+
description: Used when requesting "code simplification", "simplify", "sd-simplify", "code refinement", etc. Analyzes code at a specified path, creates a plan, and applies modifications.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# SD Simplify —
|
|
6
|
+
# SD Simplify — Path-Specific Code Simplification
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Analyzes code at a specified path using the built-in `/simplify`, then creates and executes a plan via the `/sd-plan` process.
|
|
9
9
|
|
|
10
|
-
ARGUMENTS:
|
|
10
|
+
ARGUMENTS: Target path (required). Specify any path within the repository.
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
## Step 1:
|
|
14
|
+
## Step 1: Validate Arguments
|
|
15
15
|
|
|
16
|
-
1.
|
|
17
|
-
2.
|
|
16
|
+
1. Extract the target path from ARGUMENTS.
|
|
17
|
+
2. If no path is provided, display the message "Please specify a target path. Example: `/sd-simplify packages/my-pkg`" and stop.
|
|
18
18
|
|
|
19
|
-
## Step 2: simplify
|
|
19
|
+
## Step 2: simplify Analysis (Do Not Modify)
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Invoke `simplify` using the Skill tool. Pass the following instructions as args:
|
|
22
22
|
|
|
23
23
|
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
24
|
+
Review the current codebase at the <target path> path. (Not recently changed code)
|
|
25
|
+
Do NOT modify any code. Only compile and output a list of items to fix.
|
|
26
|
+
Write each item in the following format:
|
|
27
|
+
- **file-path:line**
|
|
28
|
+
- Current code: (excerpt of the relevant code)
|
|
29
|
+
- Problem description:
|
|
30
|
+
- Suggested improvement:
|
|
31
|
+
- Reasons to change: Rationale for applying the improvement
|
|
32
|
+
- Reasons not to change: Rationale for keeping the current code
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
Replace the `<target path>` placeholder with the actual path extracted in Step 1.
|
|
31
36
|
|
|
32
|
-
## Step 3: sd-plan
|
|
37
|
+
## Step 3: Create a Plan with sd-plan
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
Using the list of items to fix from Step 2 as the task description, invoke `sd-plan` using the Skill tool. Pass the following as args:
|
|
35
40
|
|
|
36
41
|
```
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
The following are code improvement suggestions **proposed by an LLM analysis**.
|
|
43
|
+
Since these suggestions were not explicitly requested by the user, treat them as unclear.
|
|
39
44
|
|
|
40
|
-
##
|
|
41
|
-
|
|
45
|
+
## Target
|
|
46
|
+
<target path>
|
|
42
47
|
|
|
43
|
-
## LLM
|
|
44
|
-
|
|
48
|
+
## LLM-Suggested Improvements
|
|
49
|
+
When asking the user about unclear suggestions, **always present** the following details first so the user can understand the context.
|
|
45
50
|
|
|
46
51
|
```
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
+
Suggestion:
|
|
53
|
+
- File path:line:
|
|
54
|
+
- Current code: (excerpt of the relevant code)
|
|
55
|
+
- Problem description:
|
|
56
|
+
- Suggested improvement:
|
|
57
|
+
- Reasons to change:
|
|
58
|
+
- Reasons not to change:
|
|
52
59
|
```
|
|
53
60
|
|
|
54
|
-
<
|
|
61
|
+
<Full list of items to fix from Step 2>
|
|
55
62
|
```
|
|
56
63
|
|
|
57
|
-
## Step 4:
|
|
64
|
+
## Step 4: Execute the Plan
|
|
58
65
|
|
|
59
|
-
sd-plan
|
|
66
|
+
Once sd-plan completes and a finalized plan is produced, modify the code according to that plan.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/sd-claude",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.85",
|
|
4
4
|
"description": "Simplysm Claude Code asset installer",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"directory": "packages/sd-claude"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
|
+
"bin": {
|
|
14
|
+
"sd-claude": "scripts/cli.mjs"
|
|
15
|
+
},
|
|
13
16
|
"files": [
|
|
14
17
|
"scripts",
|
|
15
18
|
"claude"
|
package/scripts/cli.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const command = process.argv[2];
|
|
4
|
+
|
|
5
|
+
if (command === "postinstall") {
|
|
6
|
+
await import("./postinstall.mjs");
|
|
7
|
+
} else {
|
|
8
|
+
console.log("Usage: sd-claude <command>");
|
|
9
|
+
console.log("Commands:");
|
|
10
|
+
console.log(" postinstall Install Claude Code assets to .claude/");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -46,7 +46,7 @@ try {
|
|
|
46
46
|
console.warn("[@simplysm/sd-claude] postinstall warning:", err.message);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/** Finds the project root from INIT_CWD
|
|
49
|
+
/** Finds the project root from INIT_CWD, node_modules path, or cwd. */
|
|
50
50
|
function findProjectRoot(dirname) {
|
|
51
51
|
if (process.env["INIT_CWD"] != null) {
|
|
52
52
|
return process.env["INIT_CWD"];
|
|
@@ -55,7 +55,12 @@ function findProjectRoot(dirname) {
|
|
|
55
55
|
const sep = path.sep;
|
|
56
56
|
const marker = sep + "node_modules" + sep;
|
|
57
57
|
const idx = dirname.indexOf(marker);
|
|
58
|
-
|
|
58
|
+
if (idx !== -1) {
|
|
59
|
+
return dirname.substring(0, idx);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Fallback to cwd for manual CLI invocation (e.g., npx sd-claude postinstall)
|
|
63
|
+
return process.cwd();
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
/** Checks if this is the simplysm monorepo with the same major version. */
|
|
@@ -107,16 +112,27 @@ function setupSettings(targetDir) {
|
|
|
107
112
|
// statusLine: always overwrite
|
|
108
113
|
settings["statusLine"] = { type: "command", command: "python .claude/sd-statusline.py" };
|
|
109
114
|
|
|
115
|
+
// Migrate: move root-level SessionStart to hooks.SessionStart
|
|
116
|
+
if (settings["SessionStart"] != null) {
|
|
117
|
+
settings["hooks"] = settings["hooks"] ?? {};
|
|
118
|
+
settings["hooks"]["SessionStart"] = [
|
|
119
|
+
...(settings["hooks"]["SessionStart"] ?? []),
|
|
120
|
+
...settings["SessionStart"],
|
|
121
|
+
];
|
|
122
|
+
delete settings["SessionStart"];
|
|
123
|
+
}
|
|
124
|
+
|
|
110
125
|
// SessionStart: ensure sd-session-start hook exists with correct config
|
|
126
|
+
settings["hooks"] = settings["hooks"] ?? {};
|
|
111
127
|
const sdSessionEntry = {
|
|
112
128
|
matcher: "startup|resume|clear|compact",
|
|
113
129
|
hooks: [{ type: "command", command: "bash .claude/sd-session-start.sh" }],
|
|
114
130
|
};
|
|
115
131
|
|
|
116
|
-
const sessionStart = settings["SessionStart"];
|
|
132
|
+
const sessionStart = settings["hooks"]["SessionStart"];
|
|
117
133
|
|
|
118
134
|
if (sessionStart == null) {
|
|
119
|
-
settings["SessionStart"] = [sdSessionEntry];
|
|
135
|
+
settings["hooks"]["SessionStart"] = [sdSessionEntry];
|
|
120
136
|
} else {
|
|
121
137
|
const idx = sessionStart.findIndex((entry) =>
|
|
122
138
|
entry.hooks?.some((hook) => hook.command.includes("sd-session-start")),
|