takomi 2.0.5 → 2.0.6

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,121 +1,161 @@
1
- ---
2
- description: Spawn J Star Code Review bot into the current repository
3
- ---
4
-
5
- # /spawn-jstar - Add J Star Reviewer v2 to Any Project
6
-
7
- Works with **any programming language** TypeScript, Python, Rust, Go, etc.
8
-
9
- ## Prerequisites
10
- - Node.js 18+ installed on your machine
11
-
12
- ## Steps
13
-
14
- ### 1. Install the CLI Globally (One Time) use pnpm by default else revert to npm
15
- // turbo
16
- ```bash
17
- pnpm install -g jstar-reviewer
18
- ```
19
-
20
- ### 2. Run your First Command
21
- // turbo
22
- ```bash
23
- jstar setup
24
- ```
25
- *(Or simply run `jstar review` if you already have your keys ready)*
26
-
27
- This **auto-creates** (or updates):
28
- - `.jstar/` directory
29
- - `.env.example` with required variables
30
- - `.gitignore` (appends `.jstar/` and `.env.local`)
31
-
32
-
33
- ### 3. Configure Environment Variables
34
- ```bash
35
- cp .env.example .env.local
36
- ```
37
-
38
- Edit `.env.local` and add your API keys:
39
- ```env
40
- GEMINI_API_KEY=your_gemini_api_key_here
41
- GROQ_API_KEY=your_groq_api_key_here
42
- ```
43
-
44
- **Where to get keys:**
45
- - Google API Key: [Google AI Studio](https://aistudio.google.com/apikey)
46
- - Groq API Key: [console.groq.com](https://console.groq.com)
47
-
48
- ### 4. Index Your Codebase (Build the Brain)
49
- ```bash
50
- jstar init
51
- ```
52
-
53
- This scans your codebase and creates embeddings for context-aware reviews.
54
-
55
- ### 5. (Optional) Create Rules File
56
- Create `.jstar/rules.md` with your project-specific coding guidelines:
57
-
58
- ```markdown
59
- # Project Coding Rules
60
-
61
- ## General
62
- - Follow PEP 8 (Python) / Google Style Guide
63
- - Add docstrings to all public functions
64
-
65
-
66
-
67
- ## Security
68
- - Never log sensitive data
69
- - Validate all user inputs
70
- ```
71
-
72
- ### 6. Understanding Review Modes
73
- Before running a review, understand the available modes:
74
-
75
- | Mode | Command | Best For |
76
- | :--- | :--- | :--- |
77
- | **Standard** | `jstar review` | checking staged changes *before* committing. |
78
- | **Retroactive** | `jstar review --last` | checking the *last commit* (if you forgot to review). |
79
- | **Pull Request** | `jstar review --pr` | checking an entire feature branch against `main`. |
80
-
81
- ### 7. Run Your First Review
82
-
83
- **Agent Instruction:** Ask the user: *"Would you like to run the review yourself, or should I run a headless check for you?"*
84
-
85
- #### Option A: User Runs It (Recommended)
86
- The user runs the interactive TUI command in their terminal:
87
- ```bash
88
- jstar review
89
- ```
90
-
91
- #### Option B: Agent Runs It (Headless)
92
- If the user asks YOU to do it, use the headless flag to avoid hanging:
93
- // turbo
94
- ```bash
95
- jstar review --headless
96
- ```
97
- *(This outputs JSON-formatted results that you can parse)*
98
-
99
- The dashboard will be saved to `.jstar/last-review.md`.
100
-
101
- ## Done! 🎉
102
-
103
- **CLI Commands:**
104
- | Command | Description |
105
- |---------|-------------|
106
- | `jstar setup` | Create config files in current project |
107
- | `jstar init` | Index codebase (after major changes) |
108
- | `jstar review` | Review staged changes (Default) |
109
- | `jstar review --last` | Review last commit (Retroactive) |
110
- | `jstar review --pr` | Review branch against main (PR Mode) |
111
-
112
- **Output:**
113
- - Console: Quick summary with severity counts
114
- - `.jstar/last-review.md`: Full dashboard with fix prompts
115
-
116
- ## Alternative: Without Global Install
117
-
118
- If you don't want to install globally:
119
- ```bash
120
- npx jstar-reviewer review
121
- ```
1
+ ---
2
+ description: Install J-Star Reviewer in the current repository and set up the up-to-date review and audit flows.
3
+ ---
4
+
5
+ # /spawn-jstar - Install J-Star Reviewer in This Repository
6
+
7
+ Use this workflow to install the `jstar-reviewer` npm package and wire the repository for both code review and security audit.
8
+
9
+ ## Core Rule
10
+
11
+ `review` and `audit` are separate steps.
12
+
13
+ For a serious verification pass, run both. Do not present one as a substitute for the other.
14
+
15
+ ## Command Prefix
16
+
17
+ Examples below use `jstar`.
18
+
19
+ If you do not want a global install, replace `jstar` with `npx jstar-reviewer`.
20
+
21
+ ## 1. Prerequisites
22
+
23
+ - Node.js 18+
24
+ - Git repository
25
+ - Gemini API key
26
+ - Groq API key
27
+
28
+ ## 2. Install the CLI
29
+
30
+ Preferred:
31
+
32
+ ```bash
33
+ pnpm add -g jstar-reviewer
34
+ ```
35
+
36
+ Fallback:
37
+
38
+ ```bash
39
+ npm install -g jstar-reviewer
40
+ ```
41
+
42
+ No global install:
43
+
44
+ ```bash
45
+ npx jstar-reviewer --help
46
+ ```
47
+
48
+ ## 3. Set Up the Repository
49
+
50
+ ```bash
51
+ jstar setup
52
+ ```
53
+
54
+ This should create or update:
55
+ - `.jstar/`
56
+ - `.env.example`
57
+ - `.gitignore`
58
+
59
+ ## 4. Create `.env.local`
60
+
61
+ PowerShell:
62
+
63
+ ```powershell
64
+ Copy-Item .env.example .env.local
65
+ ```
66
+
67
+ POSIX shell:
68
+
69
+ ```bash
70
+ cp .env.example .env.local
71
+ ```
72
+
73
+ Required variables:
74
+
75
+ ```env
76
+ GEMINI_API_KEY=your_gemini_key
77
+ GROQ_API_KEY=your_groq_key
78
+ ```
79
+
80
+ Optional but useful:
81
+
82
+ ```env
83
+ GEMINI_EMBEDDING_MODEL=gemini-embedding-001
84
+ REVIEW_MODEL_NAME=moonshotai/kimi-k2-instruct-0905
85
+ ```
86
+
87
+ ## 5. Build the Local Index
88
+
89
+ ```bash
90
+ jstar init
91
+ ```
92
+
93
+ If indexing fails with a Google 404 for the embedding model, set:
94
+
95
+ ```env
96
+ GEMINI_EMBEDDING_MODEL=gemini-embedding-001
97
+ ```
98
+
99
+ ## 6. First Verification Pass
100
+
101
+ ### Option A: Interactive user flow
102
+
103
+ ```bash
104
+ jstar review
105
+ jstar audit
106
+ ```
107
+
108
+ Use this when the user wants the normal CLI/TUI experience.
109
+
110
+ ### Option B: Agent automation flow
111
+
112
+ ```bash
113
+ jstar review --json > .jstar/last-review.json
114
+ jstar audit --json > .jstar/audit_report.json
115
+ ```
116
+
117
+ Use this when an agent needs machine-readable output.
118
+
119
+ ### Option C: Review debate flow
120
+
121
+ ```bash
122
+ jstar chat --headless
123
+ ```
124
+
125
+ Headless commands:
126
+ - `{"action":"list"}`
127
+ - `{"action":"debate","issueId":0,"argument":"..."}`
128
+ - `{"action":"ignore","issueId":0}`
129
+ - `{"action":"accept","issueId":0}`
130
+ - `{"action":"exit"}`
131
+
132
+ ## 7. Common Target Modes
133
+
134
+ Staged changes:
135
+
136
+ ```bash
137
+ jstar review
138
+ jstar audit
139
+ ```
140
+
141
+ Last commit:
142
+
143
+ ```bash
144
+ jstar review --last
145
+ jstar audit --last
146
+ ```
147
+
148
+ Branch or PR scope:
149
+
150
+ ```bash
151
+ jstar review --pr
152
+ jstar audit --pr
153
+ ```
154
+
155
+ ## Outputs
156
+
157
+ - `.jstar/last-review.md`
158
+ - `.jstar/session.json`
159
+ - `.jstar/audit_report.md`
160
+ - `.jstar/audit_report.json`
161
+ - `.jstar/audit-ignore.json`
@@ -1,133 +1,96 @@
1
- ---
2
- description: Run the J-Star Code Reviewer loop to analyze and fix code quality issues.
3
- ---
4
-
5
- # J-Star Code Review Workflow
6
-
7
- This workflow executes the J-Star Reviewer on staged changes, allowing the agent to iteratively fix issues.
8
-
9
- ## 1. Build the Brain (Required once)
10
- If you haven't indexed the project yet, or if major files have changed, run:
11
- // turbo
12
- ```bash
13
- jstar init
14
- ```
15
-
16
- ## 2. Stage Current Changes
17
- Ensure all recent changes are staged so the reviewer can see them.
18
- // turbo
19
- ```bash
20
- git add .
21
- ```
22
-
23
- ## 3. Run Reviewer
24
- Execute the review pipeline.
25
-
26
- ### Standard Review (Staged Changes)
27
- ```bash
28
- jstar review
29
- ```
30
- *Use this when changes are staged but not yet committed.*
31
-
32
- ### Retroactive Review (Oops Mode)
33
- If you already committed changes but forgot to review:
34
- ```bash
35
- jstar review --last
36
- ```
37
- *Equivalent to checking the last commit `HEAD~1..HEAD`.*
38
-
39
- ### Branch/PR Review
40
- If working on a feature branch, check against main:
41
- ```bash
42
- jstar review --pr
43
- ```
44
- *Equivalent to `git diff main...HEAD`. Use this for full feature verification.*
45
-
46
- ## 4. Analyze and Fix
47
- **Agent Instructions:**
48
- 1. **Read the Output**: Check `.jstar/last-review.md` or the console summary.
49
- 2. **Prioritize**: Focus *only* on **P0_CRITICAL** and **P1_HIGH** issues first.
50
- 3. **Looping Strategy**:
51
- - **IF** P0/P1 issues are found:
52
- - Apply fixes to the code.
53
- - Stage changes: `git add .`
54
- - (Optional) Re-index if you added new files: `jstar init`
55
- - Restart this workflow (Stage -> Review).
56
- - **IF** only P2_MEDIUM issues remain:
57
- - You may fix them if they are quick/obvious.
58
- - Otherwise, consider the code "Good Enough" and stop.
59
- - **MAX LOOPS**: 3. Do not run this cycle more than 3 times. If issues persist, stop and ask the user.
60
-
61
- ## 5. Handling False Positives (Debate Mode)
62
-
63
- If the reviewer flags correct code as an issue (e.g., security false positives), use **Headless Chat** to resolve it.
64
-
65
- **Protocol:**
66
- 1. **Start Session:**
67
- Use the `run_command` tool to start the background process:
68
- ```bash
69
- jstar chat --headless
70
- ```
71
- *Note: Capture the `CommandId` returned by this tool.*
72
-
73
- 2. **List Issues (Get IDs):**
74
- Use `send_command_input` with the `CommandId`:
75
- ```json
76
- {"action": "list"}
77
- ```
78
- *Wait for output. Identify the numeric `id` of the issue you want to challenge.*
79
-
80
- 3. **Debate:**
81
- Use `send_command_input` to explain why it's a false positive:
82
- ```json
83
- {"action": "debate", "issueId": 0, "argument": "This is correct because..."}
84
- ```
85
- *Use the integer `id` from step 2.*
86
-
87
- 4. **Verify Result:**
88
- Check the output for `"status": "resolved"` and `"verdict": "LGTM"`.
89
-
90
- 5. **Exit:**
91
- Terminate the session cleanly:
92
- ```json
93
- {"action": "exit"}
94
- ```
95
-
96
- ---
97
-
98
- ## AI Agent Mode (Headless)
99
-
100
- For programmatic interaction without TUI navigation, use headless mode.
101
-
102
- ### JSON Review (One-Shot)
103
- Get findings as JSON for parsing:
104
- // turbo
105
- ```bash
106
- jstar review --json > .jstar/report.json
107
- ```
108
-
109
- ### Headless Chat (Interactive Protocol)
110
- For debating specific issues via stdin/stdout:
111
- ```bash
112
- echo '{"action": "list"}' | jstar chat --headless
113
- ```
114
-
115
- **Commands:**
116
- | Action | Parameters | Description |
117
- |--------|------------|-------------|
118
- | `list` | — | List all current issues |
119
- | `debate` | `issueId`, `argument` | Challenge an issue |
120
- | `ignore` | `issueId` | Mark issue as ignored |
121
- | `exit` | — | End session, get final report |
122
-
123
- See [Headless Mode Docs](../docs/features/headless-mode.md) for full protocol.
124
-
125
- ### AI Fix Cycle
126
- ```
127
- 1. jstar review --json → Parse findings
128
- 2. Apply code fixes
129
- 3. git add . → Stage changes
130
- 4. jstar init → Update brain (if new files added)
131
- 5. jstar review --json → Verify fixes
132
- 6. Repeat until P0/P1 = 0
133
- ```
1
+ ---
2
+ description: Run the up-to-date J-Star review and audit loop for a change set.
3
+ ---
4
+
5
+ # J-Star Review Workflow
6
+
7
+ Use this workflow when the repository already has J-Star installed and you need to verify a change set.
8
+
9
+ ## Core Rule
10
+
11
+ `review` and `audit` are separate steps.
12
+
13
+ For a serious verification pass, run both.
14
+
15
+ ## 1. Build the Local Index
16
+
17
+ If the repository is missing `.jstar/storage`, or if major files were added, run:
18
+
19
+ ```bash
20
+ jstar init
21
+ ```
22
+
23
+ ## 2. Choose the Scope
24
+
25
+ ### Staged changes
26
+
27
+ ```bash
28
+ git add .
29
+ jstar review
30
+ jstar audit
31
+ ```
32
+
33
+ ### Last commit
34
+
35
+ ```bash
36
+ jstar review --last
37
+ jstar audit --last
38
+ ```
39
+
40
+ ### Branch or PR scope
41
+
42
+ ```bash
43
+ jstar review --pr
44
+ jstar audit --pr
45
+ ```
46
+
47
+ ## 3. Read the Outputs
48
+
49
+ Review outputs:
50
+ - `.jstar/last-review.md`
51
+ - `.jstar/session.json`
52
+
53
+ Audit outputs:
54
+ - `.jstar/audit_report.md`
55
+ - `.jstar/audit_report.json`
56
+
57
+ ## 4. Fix Loop
58
+
59
+ Agent instructions:
60
+ 1. Read both the review and audit outputs.
61
+ 2. Prioritize review `P0_CRITICAL` and `P1_HIGH` issues first.
62
+ 3. Prioritize audit `CRITICAL` and `HIGH` findings first.
63
+ 4. Apply fixes.
64
+ 5. Stage changes with `git add .`.
65
+ 6. Re-run both `review` and `audit` for the same scope.
66
+ 7. If only lower-priority review issues remain, stop when the remaining work is not worth another loop.
67
+ 8. Maximum loops: 3. If issues persist, stop and ask the user.
68
+
69
+ ## 5. False Positives and Debate
70
+
71
+ For review findings that need challenge or adjudication:
72
+
73
+ ```bash
74
+ jstar chat --headless
75
+ ```
76
+
77
+ Headless commands:
78
+ - `{"action":"list"}`
79
+ - `{"action":"debate","issueId":0,"argument":"..."}`
80
+ - `{"action":"ignore","issueId":0}`
81
+ - `{"action":"accept","issueId":0}`
82
+ - `{"action":"exit"}`
83
+
84
+ For known deterministic audit false positives, use:
85
+ - `.jstar/audit-ignore.json`
86
+
87
+ ## 6. Automation Mode
88
+
89
+ Machine-readable review output:
90
+
91
+ ```bash
92
+ jstar review --json > .jstar/last-review.json
93
+ jstar audit --json > .jstar/audit_report.json
94
+ ```
95
+
96
+ Use `review --json` and `audit --json` for automation. Do not rely on `review --headless`.