@staff0rd/assist 0.600.0 → 0.601.0
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 +2 -0
- package/claude/commands/adopt-rules.md +79 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +532 -499
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ After installation, the `assist` command will be available globally. You can als
|
|
|
41
41
|
## Claude Commands
|
|
42
42
|
|
|
43
43
|
- `/add-command` - Add a new run command to assist.yml
|
|
44
|
+
- `/adopt-rules [path]` - Move a repo's existing rules into the canonical `## Rules` sections `assist rules` reads: inventories every `CLAUDE.md`, classifies each as rename (bullets already coded, just the heading is wrong), reword (prose or numbered lists, migrated one at a time via `assist rules add`) or leave, proposes the plan before touching anything, then records the scoped directories with `assist rules index`
|
|
44
45
|
- `/add-rule` - Capture a new `CLAUDE.md` rule from a review comment: words the rule from the note, infers the scope from the commented file (asking only when genuinely ambiguous, defaulting to the nearest `CLAUDE.md`), and writes it with `assist rules add`. Sent by the comment pane's **Add rule** button
|
|
45
46
|
- `/branch <description> [--jira KEY]` - Create a branch off the fresh remote default, deriving a kebab-case slug from the description
|
|
46
47
|
- `/bug` - File a bug with reproduction steps, expected and actual behavior
|
|
@@ -237,6 +238,7 @@ The Config tab of the sessions web dashboard never receives secret values: `GET
|
|
|
237
238
|
|
|
238
239
|
- `assist rules list [path]` - List the rules in scope for a path (default: cwd), read from the `## Rules` section of every `CLAUDE.md` from that path's directory up to the repo root, nearest scope first, grouped by the file each rule came from. Rules are `- **<code>** — <text>` bullets
|
|
239
240
|
- `assist rules add <text> [--scope <path>]` - Add a rule to the `## Rules` section of the scope's `CLAUDE.md`, creating the section when absent and allocating the next repo-wide code. `--scope` takes a file or directory (resolved to the nearest existing `CLAUDE.md` at or above it, defaulting to cwd) or a `CLAUDE.md` path written to directly and created if absent. After writing, the root `CLAUDE.md` records the directories that carry their own `## Rules` so scoped rules stay discoverable from the root
|
|
241
|
+
- `assist rules index [path]` - Record the directories that carry their own `## Rules` in the repo root's `CLAUDE.md`, rewriting the line in place rather than duplicating it. `rules add` does this on every add; run it directly after hand-editing a `## Rules` section (e.g. renaming an existing heading)
|
|
240
242
|
|
|
241
243
|
### Devlog
|
|
242
244
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Move a repo's existing rules into the canonical `## Rules` sections
|
|
3
|
+
allowed_args: "[path to the repo or directory, defaults to cwd]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are migrating a repo's existing written rules into the canonical `## Rules` sections that `assist rules` reads, so they become citable from the comment panes. `$ARGUMENTS` names the repo or directory to work on; default to the cwd.
|
|
7
|
+
|
|
8
|
+
Assist reads exactly one thing: a `## Rules` heading whose body holds `- **<code>** — <text>` bullets. Rules written any other way — numbered lists, prose sections, bullets under a differently-named heading — are invisible to the rule picker no matter how well written they are. This command finds them and moves them.
|
|
9
|
+
|
|
10
|
+
## Step 1: Inventory
|
|
11
|
+
|
|
12
|
+
Find every `CLAUDE.md` in the repo:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
git -C <repo> ls-files '**/CLAUDE.md' 'CLAUDE.md' 2>&1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Also check for untracked ones (`git status --short`) and mention any you find. Then, for each directory that has one, see what already parses:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
assist rules list <dir> 2>&1
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
A directory that prints "No rules in scope" has nothing assist can read yet — that is what you are fixing.
|
|
25
|
+
|
|
26
|
+
## Step 2: Find the rule-like content
|
|
27
|
+
|
|
28
|
+
Read each `CLAUDE.md` in full. A rule is a standing instruction to whoever writes in that scope — something you could be told you broke. Look for:
|
|
29
|
+
|
|
30
|
+
- Numbered lists of directives ("Every rule comes from a transcript…", "Numbered lists only.")
|
|
31
|
+
- `- **<code>** — <text>` bullets already in rule form but under a heading that is not `## Rules`
|
|
32
|
+
- Short prose sections that state one standing instruction ("Never hard-wrap.", "Attribute each quote as…")
|
|
33
|
+
|
|
34
|
+
Not rules, and left alone: where files live, what a directory is for, source locations, epic and project background, worked examples, anything describing the repo rather than constraining what you write in it.
|
|
35
|
+
|
|
36
|
+
## Step 3: Classify each file
|
|
37
|
+
|
|
38
|
+
**Rename** — the section's bullets are already `- **<code>** — <text>` and the whole section is rules. Rename that heading to `## Rules`. Nothing else changes, and the existing codes are preserved. This is the cheapest and safest migration; prefer it whenever it applies.
|
|
39
|
+
|
|
40
|
+
**Reword** — the rules are prose or a numbered list. Word each as one short imperative line, then add them one at a time:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
assist rules add '<rule text>' --scope <path to that CLAUDE.md> 2>&1
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`rules add` allocates the next repo-wide code, creates the `## Rules` section when the file has none, and keeps the root index current. Then delete the prose you migrated, so the rule is not stated in two places. If a prose section carried context beyond the rule itself, keep the context where it is and take only the instruction.
|
|
47
|
+
|
|
48
|
+
**Leave** — the file has no standing rules. Say so and move on.
|
|
49
|
+
|
|
50
|
+
## Constraints
|
|
51
|
+
|
|
52
|
+
- Assist reads only the **first** `## Rules` heading in a file. Never create a second one; merge into the existing section instead.
|
|
53
|
+
- Only rename a heading when _every_ bullet under it is a rule and each already carries a `**code**`. If the section mixes rules with prose, treat it as a reword.
|
|
54
|
+
- Preserve existing codes on a rename. Never renumber — a code that has been cited must keep meaning the same rule.
|
|
55
|
+
- Never hand-write a new code. Codes are unique repo-wide, and `assist rules add` is what allocates them.
|
|
56
|
+
- Keep the author's wording wherever it already reads as a rule. You are moving rules, not rewriting them.
|
|
57
|
+
- Do not hard-wrap: one line per bullet.
|
|
58
|
+
|
|
59
|
+
## Step 4: Propose, then apply
|
|
60
|
+
|
|
61
|
+
Show the user the plan before touching anything: one line per file saying rename, reword (with the rules you would write) or leave. Ask for confirmation.
|
|
62
|
+
|
|
63
|
+
Then apply it **one file at a time**, showing what changed after each, so a wrong call is caught before it repeats across the repo.
|
|
64
|
+
|
|
65
|
+
## Step 5: Record and verify
|
|
66
|
+
|
|
67
|
+
Once the files are migrated, record the scoped directories in the root `CLAUDE.md`:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
assist rules index <repo> 2>&1
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
A rename does not update that index by itself, so run this even if you only renamed headings. Then verify each scope reads back:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
assist rules list <dir> 2>&1
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Report what is now in scope where, and name anything you deliberately left behind and why.
|