@codyswann/lisa 1.0.2 → 1.0.5
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/all/copy-overwrite/.claude/commands/project/fix-linter-error.md +56 -23
- package/all/copy-overwrite/.claude/commands/project/reduce-max-lines-per-function.md +76 -0
- package/all/copy-overwrite/.claude/commands/project/reduce-max-lines.md +75 -0
- package/all/copy-overwrite/HUMAN.md +18 -0
- package/expo/copy-overwrite/.github/workflows/deploy.yml +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -389,6 +389,8 @@ Pre-built workflows for common tasks:
|
|
|
389
389
|
| `/project:implement` | Execute all planned tasks |
|
|
390
390
|
| `/project:review` | Run code review |
|
|
391
391
|
| `/project:verify` | Run all quality checks |
|
|
392
|
+
| `/project:reduce-max-lines` | Reduce max file lines threshold and fix violations |
|
|
393
|
+
| `/project:reduce-max-lines-per-function` | Reduce max lines per function threshold and fix violations |
|
|
392
394
|
| `/git:commit` | Create conventional commit |
|
|
393
395
|
| `/git:submit-pr` | Create pull request |
|
|
394
396
|
| `/lisa:review-implementation` | Compare project files against Lisa templates, upstream changes |
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Fix all violations of
|
|
2
|
+
description: Fix all violations of one or more ESLint rules across the codebase
|
|
3
3
|
allowed-tools: Read, Write, Edit, Bash, Task, TaskCreate, TaskUpdate, TaskList, TaskGet
|
|
4
|
-
argument-hint: <
|
|
4
|
+
argument-hint: <rule-1> [rule-2] [rule-3] ...
|
|
5
5
|
model: sonnet
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Fix Linter Errors
|
|
9
9
|
|
|
10
|
-
Target
|
|
10
|
+
Target rules: $ARGUMENTS
|
|
11
11
|
|
|
12
|
-
If no
|
|
12
|
+
Parse the arguments as space-separated ESLint rule names. If no arguments provided, prompt the user for at least one lint rule name.
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
@@ -17,38 +17,71 @@ Check for active project: `cat .claude-active-project 2>/dev/null`
|
|
|
17
17
|
|
|
18
18
|
If active, include `metadata: { "project": "<project-name>" }` in TaskCreate calls.
|
|
19
19
|
|
|
20
|
-
## Step 1:
|
|
20
|
+
## Step 1: Parse Rules
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Split `$ARGUMENTS` into individual rule names (space-separated).
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Example inputs:
|
|
25
|
+
- `sonarjs/cognitive-complexity` → 1 rule
|
|
26
|
+
- `sonarjs/cognitive-complexity @typescript-eslint/no-explicit-any` → 2 rules
|
|
27
|
+
- `react-hooks/exhaustive-deps import/order prefer-const` → 3 rules
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
## Step 2: Enable Rules
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
For each rule, find the ESLint config and set it to `"error"` severity if not already enabled. NOTE: Make sure to scan for overrides that need to be changed too. For example eslint.config.local.ts.
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
## Step 3: Identify Violations
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
Run linting and collect violations for all target rules:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bun run lint 2>&1 | grep -E "(rule-1|rule-2|...)"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Group violations by:
|
|
42
|
+
1. **Rule name** (primary grouping)
|
|
43
|
+
2. **File path** (secondary grouping)
|
|
44
|
+
|
|
45
|
+
Count violations per file per rule.
|
|
46
|
+
|
|
47
|
+
## Step 4: Create Tasks
|
|
48
|
+
|
|
49
|
+
Create tasks organized by rule, then by file:
|
|
50
|
+
|
|
51
|
+
For each rule:
|
|
52
|
+
- Create a parent task: "Fix all [rule-name] violations ([N] files, [M] total)"
|
|
53
|
+
- Create child tasks for each file with violations, ordered by count (highest first)
|
|
54
|
+
|
|
55
|
+
Each file task should include:
|
|
56
|
+
- File path and violation count for that specific rule
|
|
34
57
|
- Sample error messages
|
|
35
58
|
- Fix approach based on rule type:
|
|
36
|
-
- **Complexity rules
|
|
37
|
-
- **Style rules
|
|
38
|
-
- **Best practice rules
|
|
39
|
-
- **Type rules
|
|
59
|
+
- **Complexity rules** (`sonarjs/*`): Extract functions, use early returns, simplify conditions
|
|
60
|
+
- **Style rules** (`prettier/*`, `import/order`): Apply formatting fixes
|
|
61
|
+
- **Best practice rules** (`react-hooks/*`, `prefer-const`): Refactor to follow recommended pattern
|
|
62
|
+
- **Type rules** (`@typescript-eslint/*`): Add proper types, remove `any`
|
|
40
63
|
|
|
41
|
-
## Step
|
|
64
|
+
## Step 5: Execute
|
|
42
65
|
|
|
43
|
-
|
|
66
|
+
Process rules sequentially (to avoid conflicts), but parallelize file fixes within each rule:
|
|
44
67
|
|
|
45
|
-
|
|
68
|
+
For each rule:
|
|
69
|
+
1. Launch up to 5 sub-agents to fix files for that rule in parallel
|
|
70
|
+
2. Wait for all files to be fixed
|
|
71
|
+
3. Run `bun run lint` to verify rule is now clean
|
|
72
|
+
4. Commit all fixes for that rule with message: `fix(lint): resolve [rule-name] violations`
|
|
73
|
+
5. Move to next rule
|
|
46
74
|
|
|
47
|
-
## Step
|
|
75
|
+
## Step 6: Report
|
|
48
76
|
|
|
49
77
|
```
|
|
50
78
|
Lint rule fix complete:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
|
|
80
|
+
| Rule | Files Fixed | Violations Resolved |
|
|
81
|
+
|------|-------------|---------------------|
|
|
82
|
+
| rule-1 | N1 | M1 |
|
|
83
|
+
| rule-2 | N2 | M2 |
|
|
84
|
+
| ... | ... | ... |
|
|
85
|
+
|
|
86
|
+
Total: [N] files fixed, [M] violations resolved
|
|
54
87
|
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Reduce max lines per function threshold and fix violations
|
|
3
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Task, TaskCreate, TaskUpdate, TaskList, TaskGet
|
|
4
|
+
argument-hint: <max-lines-per-function-value>
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Reduce Max Lines Per Function
|
|
9
|
+
|
|
10
|
+
Target threshold: $ARGUMENTS lines per function
|
|
11
|
+
|
|
12
|
+
If no argument provided, prompt the user for a target.
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### Step 0: Check Project Context
|
|
17
|
+
|
|
18
|
+
Check if there's an active project for task syncing:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cat .claude-active-project 2>/dev/null
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If a project is active, include `metadata: { "project": "<project-name>" }` in all TaskCreate calls.
|
|
25
|
+
|
|
26
|
+
### Step 1: Locate Configuration
|
|
27
|
+
|
|
28
|
+
Read the eslint thresholds config (`eslint.thresholds.json` or similar).
|
|
29
|
+
|
|
30
|
+
### Step 2: Update Threshold
|
|
31
|
+
|
|
32
|
+
Set the `maxLinesPerFunction` threshold to $ARGUMENTS (e.g., `"maxLinesPerFunction": $ARGUMENTS`).
|
|
33
|
+
|
|
34
|
+
### Step 3: Identify Violations
|
|
35
|
+
|
|
36
|
+
Run lint to find all functions exceeding the new threshold. Note file path, function name, and current line count.
|
|
37
|
+
|
|
38
|
+
If no violations, report success and exit.
|
|
39
|
+
|
|
40
|
+
### Step 4: Create Task List
|
|
41
|
+
|
|
42
|
+
Create a task for each function needing refactoring, ordered by line count (highest first).
|
|
43
|
+
|
|
44
|
+
Each task should have:
|
|
45
|
+
- **subject**: "Reduce lines in [function-name]" (imperative form)
|
|
46
|
+
- **description**: File path and line number, function name, current line count, target threshold, refactoring strategies
|
|
47
|
+
- **activeForm**: "Reducing lines in [function-name]" (present continuous)
|
|
48
|
+
- **metadata**: `{ "project": "<active-project>" }` if project context exists
|
|
49
|
+
|
|
50
|
+
Refactoring strategies:
|
|
51
|
+
- **Extract functions**: Break function into smaller named functions
|
|
52
|
+
- **Early returns**: Reduce nesting with guard clauses
|
|
53
|
+
- **Extract conditions**: Move complex boolean logic into named variables
|
|
54
|
+
- **Use lookup tables**: Replace complex switch/if-else chains with object maps
|
|
55
|
+
- **Consolidate logic**: Merge similar code paths
|
|
56
|
+
|
|
57
|
+
### Step 5: Parallel Execution
|
|
58
|
+
|
|
59
|
+
Launch **up to 5 sub-agents** using the `code-simplifier` subagent to refactor in parallel.
|
|
60
|
+
|
|
61
|
+
### Step 6: Iterate
|
|
62
|
+
|
|
63
|
+
Check for remaining pending tasks. Re-run lint to verify.
|
|
64
|
+
|
|
65
|
+
If violations remain, repeat from Step 3.
|
|
66
|
+
|
|
67
|
+
Continue until all functions meet or are under $ARGUMENTS lines.
|
|
68
|
+
|
|
69
|
+
### Step 7: Report
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Max lines per function reduction complete:
|
|
73
|
+
- Target threshold: $ARGUMENTS
|
|
74
|
+
- Functions refactored: [count]
|
|
75
|
+
- Functions reduced: [list with line counts]
|
|
76
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Reduce max file lines threshold and fix violations
|
|
3
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Task, TaskCreate, TaskUpdate, TaskList, TaskGet
|
|
4
|
+
argument-hint: <max-lines-value>
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Reduce Max Lines
|
|
9
|
+
|
|
10
|
+
Target threshold: $ARGUMENTS lines per file
|
|
11
|
+
|
|
12
|
+
If no argument provided, prompt the user for a target.
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### Step 0: Check Project Context
|
|
17
|
+
|
|
18
|
+
Check if there's an active project for task syncing:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cat .claude-active-project 2>/dev/null
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If a project is active, include `metadata: { "project": "<project-name>" }` in all TaskCreate calls.
|
|
25
|
+
|
|
26
|
+
### Step 1: Locate Configuration
|
|
27
|
+
|
|
28
|
+
Read the eslint thresholds config (`eslint.thresholds.json` or similar).
|
|
29
|
+
|
|
30
|
+
### Step 2: Update Threshold
|
|
31
|
+
|
|
32
|
+
Set the `maxLines` threshold to $ARGUMENTS (e.g., `"maxLines": $ARGUMENTS`).
|
|
33
|
+
|
|
34
|
+
### Step 3: Identify Violations
|
|
35
|
+
|
|
36
|
+
Run lint to find all files exceeding the new threshold. Note file path and current line count.
|
|
37
|
+
|
|
38
|
+
If no violations, report success and exit.
|
|
39
|
+
|
|
40
|
+
### Step 4: Create Task List
|
|
41
|
+
|
|
42
|
+
Create a task for each file needing refactoring, ordered by line count (highest first).
|
|
43
|
+
|
|
44
|
+
Each task should have:
|
|
45
|
+
- **subject**: "Reduce lines in [file]" (imperative form)
|
|
46
|
+
- **description**: File path, current line count, target threshold, refactoring strategies
|
|
47
|
+
- **activeForm**: "Reducing lines in [file]" (present continuous)
|
|
48
|
+
- **metadata**: `{ "project": "<active-project>" }` if project context exists
|
|
49
|
+
|
|
50
|
+
Refactoring strategies:
|
|
51
|
+
- **Extract modules**: Break file into smaller focused modules
|
|
52
|
+
- **Remove duplication**: Consolidate repeated logic
|
|
53
|
+
- **Delete dead code**: Remove unused functions/code paths
|
|
54
|
+
- **Simplify logic**: Use early returns, reduce nesting
|
|
55
|
+
|
|
56
|
+
### Step 5: Parallel Execution
|
|
57
|
+
|
|
58
|
+
Launch **up to 5 sub-agents** using the `code-simplifier` subagent to refactor in parallel.
|
|
59
|
+
|
|
60
|
+
### Step 6: Iterate
|
|
61
|
+
|
|
62
|
+
Check for remaining pending tasks. Re-run lint to verify.
|
|
63
|
+
|
|
64
|
+
If violations remain, repeat from Step 3.
|
|
65
|
+
|
|
66
|
+
Continue until all files meet or are under $ARGUMENTS lines.
|
|
67
|
+
|
|
68
|
+
### Step 7: Report
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Max lines reduction complete:
|
|
72
|
+
- Target threshold: $ARGUMENTS
|
|
73
|
+
- Files refactored: [count]
|
|
74
|
+
- Files reduced: [list with line counts]
|
|
75
|
+
```
|
|
@@ -80,6 +80,8 @@ Commands are organized by category. Sub-commands (commands that are called by ot
|
|
|
80
80
|
| `/project:fix-linter-error` | Fix all violations of a specific ESLint rule | `<eslint-rule-name>` (required) | - |
|
|
81
81
|
| `/project:lower-code-complexity` | Reduce code complexity threshold by 2 and fix violations | none | - |
|
|
82
82
|
| `/project:add-test-coverage` | Increase test coverage to a specified threshold | `<threshold-percentage>` (required) | - |
|
|
83
|
+
| `/project:reduce-max-lines` | Reduce max file lines threshold and fix violations | `<max-lines-value>` (required) | - |
|
|
84
|
+
| `/project:reduce-max-lines-per-function` | Reduce max lines per function threshold and fix violations | `<max-lines-per-function-value>` (required) | - |
|
|
83
85
|
|
|
84
86
|
### Git Commands
|
|
85
87
|
|
|
@@ -330,6 +332,22 @@ Updates coverage config thresholds, identifies the 20 files with lowest coverage
|
|
|
330
332
|
|
|
331
333
|
---
|
|
332
334
|
|
|
335
|
+
### `/project:reduce-max-lines`
|
|
336
|
+
|
|
337
|
+
**Arguments:** `<max-lines-value>` (required)
|
|
338
|
+
|
|
339
|
+
Reduces the max file lines threshold, identifies all files exceeding the new limit, creates tasks ordered by line count, and launches up to 5 code-simplifier agents to refactor in parallel. Iterates until all files meet or are under the target.
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
### `/project:reduce-max-lines-per-function`
|
|
344
|
+
|
|
345
|
+
**Arguments:** `<max-lines-per-function-value>` (required)
|
|
346
|
+
|
|
347
|
+
Reduces the max lines per function threshold, identifies all functions exceeding the new limit, creates tasks ordered by line count, and launches up to 5 code-simplifier agents to refactor in parallel. Iterates until all functions meet or are under the target.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
333
351
|
### `/git:commit`
|
|
334
352
|
|
|
335
353
|
**Arguments:** `[commit-message-hint]` (optional)
|
|
@@ -175,6 +175,22 @@ jobs:
|
|
|
175
175
|
with:
|
|
176
176
|
source: ".env.${{ needs.determine_environment.outputs.environment == 'dev' && 'development' || needs.determine_environment.outputs.environment }}"
|
|
177
177
|
target: '.env.production'
|
|
178
|
+
- name: Copy amplify file (if exists)
|
|
179
|
+
run: |
|
|
180
|
+
ENV="${{ needs.determine_environment.outputs.environment }}"
|
|
181
|
+
if [ "$ENV" == "staging" ]; then
|
|
182
|
+
SOURCE_FILE="staging.aws-exports.js"
|
|
183
|
+
elif [ "$ENV" == "dev" ]; then
|
|
184
|
+
SOURCE_FILE="dev.aws-exports.js"
|
|
185
|
+
else
|
|
186
|
+
SOURCE_FILE="prod.aws-exports.js"
|
|
187
|
+
fi
|
|
188
|
+
if [ -f "$SOURCE_FILE" ]; then
|
|
189
|
+
cp "$SOURCE_FILE" aws-exports.js
|
|
190
|
+
echo "Copied $SOURCE_FILE to aws-exports.js"
|
|
191
|
+
else
|
|
192
|
+
echo "Skipping: $SOURCE_FILE does not exist"
|
|
193
|
+
fi
|
|
178
194
|
- name: Get version for deploy message
|
|
179
195
|
id: get_version
|
|
180
196
|
run: |
|
package/package.json
CHANGED
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@ast-grep/cli"
|
|
76
76
|
],
|
|
77
77
|
"name": "@codyswann/lisa",
|
|
78
|
-
"version": "1.0.
|
|
78
|
+
"version": "1.0.5",
|
|
79
79
|
"description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
|
|
80
80
|
"main": "dist/index.js",
|
|
81
81
|
"bin": {
|