indusagi-coding-agent 0.1.28 → 0.1.30
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/CHANGELOG.md +23 -0
- package/LICENSE.md +22 -0
- package/README.md +2 -0
- package/dist/core/messages.d.ts +1 -76
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +1 -122
- package/dist/core/messages.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -447
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -1203
- package/dist/core/session-manager.js.map +1 -1
- package/package.json +2 -2
- package/docs/COMPLETE-GUIDE.md +0 -300
- package/docs/COMPREHENSIVE-CLI-SUMMARY.md +0 -900
- package/docs/MODES-ARCHITECTURE.md +0 -565
- package/docs/PRINT-MODE-GUIDE.md +0 -456
- package/docs/README.md +0 -78
- package/docs/RPC-GUIDE.md +0 -705
- package/docs/UTILS-IMPLEMENTATION-SUMMARY.md +0 -647
- package/docs/UTILS-MODULE-OVERVIEW.md +0 -1480
- package/docs/UTILS-QA-CHECKLIST.md +0 -1061
- package/docs/UTILS-USAGE-GUIDE.md +0 -1419
- package/docs/compaction.md +0 -390
- package/docs/custom-provider.md +0 -538
- package/docs/development.md +0 -69
- package/docs/extensions.md +0 -1733
- package/docs/hooks.md +0 -378
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/json.md +0 -79
- package/docs/keybindings.md +0 -162
- package/docs/models.md +0 -193
- package/docs/packages.md +0 -163
- package/docs/prompt-templates.md +0 -67
- package/docs/providers.md +0 -147
- package/docs/rpc.md +0 -1048
- package/docs/sdk.md +0 -969
- package/docs/session.md +0 -412
- package/docs/settings.md +0 -219
- package/docs/shell-aliases.md +0 -13
- package/docs/skills.md +0 -226
- package/docs/subagents.md +0 -225
- package/docs/terminal-setup.md +0 -65
- package/docs/themes.md +0 -295
- package/docs/tree.md +0 -219
- package/docs/tui.md +0 -887
- package/docs/web-tools.md +0 -304
- package/docs/windows.md +0 -17
- package/examples/README.md +0 -25
- package/examples/extensions/README.md +0 -192
- package/examples/extensions/antigravity-image-gen.ts +0 -414
- package/examples/extensions/auto-commit-on-exit.ts +0 -49
- package/examples/extensions/bookmark.ts +0 -50
- package/examples/extensions/claude-rules.ts +0 -86
- package/examples/extensions/confirm-destructive.ts +0 -59
- package/examples/extensions/custom-compaction.ts +0 -115
- package/examples/extensions/custom-footer.ts +0 -65
- package/examples/extensions/custom-header.ts +0 -73
- package/examples/extensions/custom-provider-anthropic/index.ts +0 -605
- package/examples/extensions/custom-provider-anthropic/package-lock.json +0 -24
- package/examples/extensions/custom-provider-anthropic/package.json +0 -19
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +0 -350
- package/examples/extensions/custom-provider-gitlab-duo/package.json +0 -16
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +0 -83
- package/examples/extensions/dirty-repo-guard.ts +0 -56
- package/examples/extensions/doom-overlay/README.md +0 -46
- package/examples/extensions/doom-overlay/doom/build/doom.js +0 -21
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +0 -152
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
- package/examples/extensions/doom-overlay/doom-component.ts +0 -133
- package/examples/extensions/doom-overlay/doom-engine.ts +0 -173
- package/examples/extensions/doom-overlay/doom-keys.ts +0 -105
- package/examples/extensions/doom-overlay/index.ts +0 -74
- package/examples/extensions/doom-overlay/wad-finder.ts +0 -51
- package/examples/extensions/event-bus.ts +0 -43
- package/examples/extensions/file-trigger.ts +0 -41
- package/examples/extensions/git-checkpoint.ts +0 -53
- package/examples/extensions/handoff.ts +0 -151
- package/examples/extensions/hello.ts +0 -25
- package/examples/extensions/inline-bash.ts +0 -94
- package/examples/extensions/input-transform.ts +0 -43
- package/examples/extensions/interactive-shell.ts +0 -196
- package/examples/extensions/mac-system-theme.ts +0 -47
- package/examples/extensions/message-renderer.ts +0 -60
- package/examples/extensions/modal-editor.ts +0 -86
- package/examples/extensions/model-status.ts +0 -31
- package/examples/extensions/notify.ts +0 -25
- package/examples/extensions/overlay-qa-tests.ts +0 -882
- package/examples/extensions/overlay-test.ts +0 -151
- package/examples/extensions/permission-gate.ts +0 -34
- package/examples/extensions/pirate.ts +0 -47
- package/examples/extensions/plan-mode/README.md +0 -65
- package/examples/extensions/plan-mode/index.ts +0 -341
- package/examples/extensions/plan-mode/utils.ts +0 -168
- package/examples/extensions/preset.ts +0 -399
- package/examples/extensions/protected-paths.ts +0 -30
- package/examples/extensions/qna.ts +0 -120
- package/examples/extensions/question.ts +0 -265
- package/examples/extensions/questionnaire.ts +0 -428
- package/examples/extensions/rainbow-editor.ts +0 -88
- package/examples/extensions/sandbox/index.ts +0 -318
- package/examples/extensions/sandbox/package-lock.json +0 -92
- package/examples/extensions/sandbox/package.json +0 -19
- package/examples/extensions/send-user-message.ts +0 -97
- package/examples/extensions/session-name.ts +0 -27
- package/examples/extensions/shutdown-command.ts +0 -63
- package/examples/extensions/snake.ts +0 -344
- package/examples/extensions/space-invaders.ts +0 -561
- package/examples/extensions/ssh.ts +0 -220
- package/examples/extensions/status-line.ts +0 -40
- package/examples/extensions/subagent/README.md +0 -172
- package/examples/extensions/subagent/agents/planner.md +0 -37
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/examples/extensions/subagent/agents/scout.md +0 -50
- package/examples/extensions/subagent/agents/worker.md +0 -24
- package/examples/extensions/subagent/agents.ts +0 -127
- package/examples/extensions/subagent/index.ts +0 -964
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- package/examples/extensions/summarize.ts +0 -196
- package/examples/extensions/timed-confirm.ts +0 -70
- package/examples/extensions/todo.ts +0 -300
- package/examples/extensions/tool-override.ts +0 -144
- package/examples/extensions/tools.ts +0 -147
- package/examples/extensions/trigger-compact.ts +0 -40
- package/examples/extensions/truncated-tool.ts +0 -193
- package/examples/extensions/widget-placement.ts +0 -17
- package/examples/extensions/with-deps/index.ts +0 -36
- package/examples/extensions/with-deps/package-lock.json +0 -31
- package/examples/extensions/with-deps/package.json +0 -22
- package/examples/sdk/01-minimal.ts +0 -22
- package/examples/sdk/02-custom-model.ts +0 -50
- package/examples/sdk/03-custom-prompt.ts +0 -55
- package/examples/sdk/04-skills.ts +0 -46
- package/examples/sdk/05-tools.ts +0 -56
- package/examples/sdk/06-extensions.ts +0 -88
- package/examples/sdk/07-context-files.ts +0 -40
- package/examples/sdk/08-prompt-templates.ts +0 -47
- package/examples/sdk/09-api-keys-and-oauth.ts +0 -48
- package/examples/sdk/10-settings.ts +0 -38
- package/examples/sdk/11-sessions.ts +0 -48
- package/examples/sdk/12-full-control.ts +0 -82
- package/examples/sdk/13-codex-oauth.ts +0 -37
- package/examples/sdk/README.md +0 -144
package/docs/PRINT-MODE-GUIDE.md
DELETED
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
# Print Mode Complete Guide
|
|
2
|
-
|
|
3
|
-
Comprehensive documentation for non-interactive mode used in scripting, CI/CD, and automation.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
1. [Output Formats in Detail](#output-formats-in-detail)
|
|
7
|
-
2. [Streaming Options](#streaming-options)
|
|
8
|
-
3. [Error Reporting](#error-reporting)
|
|
9
|
-
4. [Format Examples](#format-examples)
|
|
10
|
-
5. [Performance Considerations](#performance-considerations)
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Output Formats in Detail
|
|
15
|
-
|
|
16
|
-
### JSON Mode (--mode=json)
|
|
17
|
-
|
|
18
|
-
**Purpose:** Machine-readable event stream for integration with other tools.
|
|
19
|
-
|
|
20
|
-
**Format:** NDJSON (Newline-Delimited JSON) - one JSON object per line
|
|
21
|
-
|
|
22
|
-
**Events in Stream:**
|
|
23
|
-
|
|
24
|
-
```json
|
|
25
|
-
// Session initialization
|
|
26
|
-
{"type": "session_created", "session_id": "abc-123", "timestamp": 1677000000000}
|
|
27
|
-
|
|
28
|
-
// Prompting
|
|
29
|
-
{"type": "message_start", "role": "user", "content": "Analyze this code"}
|
|
30
|
-
{"type": "message_end", "role": "user"}
|
|
31
|
-
|
|
32
|
-
// Agent processing
|
|
33
|
-
{"type": "agent_start", "model": "gpt-4", "thinking_level": "medium"}
|
|
34
|
-
{"type": "tool_start", "tool_name": "bash", "tool_input": {"command": "ls -la"}}
|
|
35
|
-
{"type": "tool_output", "tool_name": "bash", "output": "total 48..."}
|
|
36
|
-
{"type": "tool_end", "tool_name": "bash", "success": true}
|
|
37
|
-
|
|
38
|
-
// Agent response
|
|
39
|
-
{"type": "message_start", "role": "assistant", "content": "The code does..."}
|
|
40
|
-
{"type": "message_end", "role": "assistant"}
|
|
41
|
-
|
|
42
|
-
// Completion
|
|
43
|
-
{"type": "agent_end", "total_tokens": 1523, "stop_reason": "end_turn"}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
**Usage in Scripts:**
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
# Process all events
|
|
50
|
-
indusagi --mode=json "prompt" | jq '.type'
|
|
51
|
-
|
|
52
|
-
# Filter specific event types
|
|
53
|
-
indusagi --mode=json "prompt" | jq 'select(.type == "tool_output")'
|
|
54
|
-
|
|
55
|
-
# Extract final response
|
|
56
|
-
indusagi --mode=json "prompt" | jq -s '.[] | select(.role == "assistant") | .content' -r
|
|
57
|
-
|
|
58
|
-
# Calculate total tokens
|
|
59
|
-
indusagi --mode=json "prompt" | jq -s '.[] | select(.type == "agent_end") | .total_tokens'
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### TEXT Mode (--mode=text)
|
|
63
|
-
|
|
64
|
-
**Purpose:** Human-readable formatted output for terminal display.
|
|
65
|
-
|
|
66
|
-
**Format:**
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
┌─ Session: abc-123 ─────────────────────────────┐
|
|
70
|
-
│ Model: gpt-4 │
|
|
71
|
-
│ Mode: interactive │
|
|
72
|
-
├────────────────────────────────────────────────┤
|
|
73
|
-
│ │
|
|
74
|
-
│ USER: │
|
|
75
|
-
│ Analyze this code │
|
|
76
|
-
│ │
|
|
77
|
-
│ AGENT: │
|
|
78
|
-
│ The code does... │
|
|
79
|
-
│ │
|
|
80
|
-
│ TOOLS EXECUTED: │
|
|
81
|
-
│ - bash: ls -la (success) │
|
|
82
|
-
│ │
|
|
83
|
-
├────────────────────────────────────────────────┤
|
|
84
|
-
│ Tokens: 1,523 (~1,142 words, ~$0.003 cost) │
|
|
85
|
-
│ Duration: 2.5s │
|
|
86
|
-
└────────────────────────────────────────────────┘
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**Usage:**
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# Display output
|
|
93
|
-
indusagi --mode=text "What does this code do?"
|
|
94
|
-
|
|
95
|
-
# Redirect to file
|
|
96
|
-
indusagi --mode=text "prompt" > output.txt
|
|
97
|
-
|
|
98
|
-
# Pipe to pager
|
|
99
|
-
indusagi --mode=text "prompt" | less
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### COMPACT Mode (--mode=compact)
|
|
103
|
-
|
|
104
|
-
**Purpose:** Minimal output - just the final response text.
|
|
105
|
-
|
|
106
|
-
**Format:** Plain text without formatting
|
|
107
|
-
|
|
108
|
-
**Usage:**
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
# Get just the answer
|
|
112
|
-
indusagi --mode=compact "What is 2+2?"
|
|
113
|
-
# Output: 4
|
|
114
|
-
|
|
115
|
-
# Use in scripting
|
|
116
|
-
result=$(indusagi --mode=compact "Summarize: $file_content")
|
|
117
|
-
echo "Summary: $result"
|
|
118
|
-
|
|
119
|
-
# Chain multiple commands
|
|
120
|
-
indusagi --mode=compact "List all Python files" | sort | uniq
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## Streaming Options
|
|
126
|
-
|
|
127
|
-
### Real-time Streaming (--stream)
|
|
128
|
-
|
|
129
|
-
**Purpose:** Show output as it's generated (streaming mode).
|
|
130
|
-
|
|
131
|
-
**Behavior:**
|
|
132
|
-
- Displays tokens as they arrive from the model
|
|
133
|
-
- Agent output updates in real-time
|
|
134
|
-
- Tools show execution progress
|
|
135
|
-
- Useful for long-running operations
|
|
136
|
-
|
|
137
|
-
**Example:**
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
indusagi --mode=text --stream "Write a detailed essay on quantum computing"
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
**Output:** Displays essay line-by-line as generated
|
|
144
|
-
|
|
145
|
-
### Buffered Output (default)
|
|
146
|
-
|
|
147
|
-
**Behavior:**
|
|
148
|
-
- Waits for agent to complete
|
|
149
|
-
- Shows full response at once
|
|
150
|
-
- Better for scripting (no partial output)
|
|
151
|
-
- Lower CPU usage during execution
|
|
152
|
-
|
|
153
|
-
**Example:**
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
indusagi --mode=json "prompt"
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**Output:** All events printed once available
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Error Reporting
|
|
164
|
-
|
|
165
|
-
### Error Output to stderr
|
|
166
|
-
|
|
167
|
-
All errors go to stderr while normal output goes to stdout:
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
# Capture errors separately
|
|
171
|
-
indusagi --mode=json "prompt" 2>errors.log 1>output.jsonl
|
|
172
|
-
|
|
173
|
-
# Display errors while piping output
|
|
174
|
-
indusagi --mode=text "prompt" 2>&1 | tee output.txt
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Error JSON Format
|
|
178
|
-
|
|
179
|
-
```json
|
|
180
|
-
{
|
|
181
|
-
"type": "error",
|
|
182
|
-
"timestamp": 1677000000000,
|
|
183
|
-
"code": "MODEL_ERROR",
|
|
184
|
-
"message": "Rate limit exceeded",
|
|
185
|
-
"severity": "error",
|
|
186
|
-
"retriable": true,
|
|
187
|
-
"details": {
|
|
188
|
-
"model": "gpt-4",
|
|
189
|
-
"retry_after": 60
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### Error Types
|
|
195
|
-
|
|
196
|
-
| Error Code | HTTP | Meaning | Retriable |
|
|
197
|
-
|-----------|------|---------|-----------|
|
|
198
|
-
| INVALID_ARGS | 400 | Invalid CLI arguments | No |
|
|
199
|
-
| SESSION_NOT_FOUND | 404 | Session doesn't exist | No |
|
|
200
|
-
| TOOL_ERROR | 500 | Tool execution failed | Yes |
|
|
201
|
-
| MODEL_ERROR | 429/503 | Model quota/availability | Yes |
|
|
202
|
-
| TIMEOUT | 504 | Operation exceeded timeout | Yes |
|
|
203
|
-
| PERMISSION_DENIED | 403 | No access to resource | No |
|
|
204
|
-
| INTERNAL_ERROR | 500 | Server error | Yes |
|
|
205
|
-
|
|
206
|
-
### Error Handling in Scripts
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
#!/bin/bash
|
|
210
|
-
|
|
211
|
-
# Capture both output and exit code
|
|
212
|
-
output=$(indusagi --mode=json "prompt" 2>&1)
|
|
213
|
-
exit_code=$?
|
|
214
|
-
|
|
215
|
-
case $exit_code in
|
|
216
|
-
0)
|
|
217
|
-
echo "Success!"
|
|
218
|
-
echo "$output" | jq '.'
|
|
219
|
-
;;
|
|
220
|
-
2)
|
|
221
|
-
echo "Invalid arguments"
|
|
222
|
-
echo "$output" | jq '.message'
|
|
223
|
-
;;
|
|
224
|
-
3)
|
|
225
|
-
echo "Session not found"
|
|
226
|
-
;;
|
|
227
|
-
4|5|6)
|
|
228
|
-
echo "Retriable error (code $exit_code), retrying..."
|
|
229
|
-
# Implement retry logic
|
|
230
|
-
;;
|
|
231
|
-
*)
|
|
232
|
-
echo "Unknown error: $exit_code"
|
|
233
|
-
;;
|
|
234
|
-
esac
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
## Format Examples
|
|
240
|
-
|
|
241
|
-
### Example 1: Code Summarization
|
|
242
|
-
|
|
243
|
-
**Command:**
|
|
244
|
-
```bash
|
|
245
|
-
indusagi --mode=json @app.ts "Summarize this code" | jq -s '.[] | select(.role == "assistant") | .content' -r
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
**Output:**
|
|
249
|
-
```
|
|
250
|
-
The code implements a REST API server using Express.js with the following features:
|
|
251
|
-
1. POST /api/users - Creates new users
|
|
252
|
-
2. GET /api/users/:id - Retrieves user by ID
|
|
253
|
-
3. DELETE /api/users/:id - Removes user
|
|
254
|
-
...
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Example 2: CI/CD Integration
|
|
258
|
-
|
|
259
|
-
**Script:**
|
|
260
|
-
```bash
|
|
261
|
-
#!/bin/bash
|
|
262
|
-
# Check if code changes are breaking
|
|
263
|
-
|
|
264
|
-
CHANGES=$(git diff HEAD~1 | head -1000)
|
|
265
|
-
ANALYSIS=$(indusagi --mode=json <<EOF
|
|
266
|
-
Review these code changes for breaking changes:
|
|
267
|
-
$CHANGES
|
|
268
|
-
EOF
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
if echo "$ANALYSIS" | jq -e '.[] | select(.content | contains("BREAKING"))' > /dev/null; then
|
|
272
|
-
echo "BREAKING CHANGES DETECTED"
|
|
273
|
-
exit 1
|
|
274
|
-
else
|
|
275
|
-
echo "No breaking changes"
|
|
276
|
-
exit 0
|
|
277
|
-
fi
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### Example 3: Batch Processing
|
|
281
|
-
|
|
282
|
-
**Script:**
|
|
283
|
-
```bash
|
|
284
|
-
#!/bin/bash
|
|
285
|
-
# Process multiple files
|
|
286
|
-
|
|
287
|
-
for file in *.ts; do
|
|
288
|
-
echo "Processing $file..."
|
|
289
|
-
|
|
290
|
-
result=$(indusagi --mode=text --timeout=30 @"$file" "Generate unit tests")
|
|
291
|
-
|
|
292
|
-
if [ $? -eq 0 ]; then
|
|
293
|
-
echo "$result" > "${file%.ts}.test.ts"
|
|
294
|
-
echo "✓ Generated tests"
|
|
295
|
-
else
|
|
296
|
-
echo "✗ Failed to generate tests"
|
|
297
|
-
fi
|
|
298
|
-
done
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### Example 4: Session Persistence
|
|
302
|
-
|
|
303
|
-
**Command:**
|
|
304
|
-
```bash
|
|
305
|
-
# Create persistent session
|
|
306
|
-
indusagi --session=my-project --mode=json "What is this codebase?"
|
|
307
|
-
|
|
308
|
-
# Continue in same session
|
|
309
|
-
indusagi --session=my-project --mode=json "How do I run tests?"
|
|
310
|
-
|
|
311
|
-
# Export session
|
|
312
|
-
indusagi --session=my-project --export=html > session.html
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
|
-
## Performance Considerations
|
|
318
|
-
|
|
319
|
-
### Optimization Tips
|
|
320
|
-
|
|
321
|
-
**1. Use Compact Mode for Simple Operations**
|
|
322
|
-
```bash
|
|
323
|
-
# Slower - parses full output
|
|
324
|
-
result=$(indusagi --mode=text "Is this syntax valid?")
|
|
325
|
-
|
|
326
|
-
# Faster - just the response
|
|
327
|
-
result=$(indusagi --mode=compact "Is this syntax valid?")
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
**2. Batch Requests**
|
|
331
|
-
```bash
|
|
332
|
-
# Slower - multiple processes
|
|
333
|
-
for item in ${items[@]}; do
|
|
334
|
-
indusagi --mode=compact "Process $item"
|
|
335
|
-
done
|
|
336
|
-
|
|
337
|
-
# Faster - single session
|
|
338
|
-
indusagi --session=batch <<EOF
|
|
339
|
-
Process item1
|
|
340
|
-
Process item2
|
|
341
|
-
Process item3
|
|
342
|
-
EOF
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
**3. Use Session Caching**
|
|
346
|
-
```bash
|
|
347
|
-
# Without session - rebuilds context each time
|
|
348
|
-
indusagi --mode=json "First question"
|
|
349
|
-
indusagi --mode=json "Follow-up question"
|
|
350
|
-
|
|
351
|
-
# With session - reuses context
|
|
352
|
-
indusagi --session=work --mode=json "First question"
|
|
353
|
-
indusagi --session=work --mode=json "Follow-up question"
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
**4. Limit Token Output**
|
|
357
|
-
```bash
|
|
358
|
-
# For large outputs, use jq to extract relevant parts
|
|
359
|
-
indusagi --mode=json "Explain..." | jq '.[] | select(.role == "assistant") | .content[:500]'
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
### Memory Management
|
|
363
|
-
|
|
364
|
-
**For Large File Processing:**
|
|
365
|
-
```bash
|
|
366
|
-
# Stream file instead of loading entirely
|
|
367
|
-
head -c 100000 large_file.ts | indusagi --mode=compact "Analyze this code"
|
|
368
|
-
|
|
369
|
-
# Or process in chunks
|
|
370
|
-
split -b 50K large_file.ts chunk_
|
|
371
|
-
for chunk in chunk_*; do
|
|
372
|
-
indusagi --mode=text @"$chunk" "What patterns do you see?"
|
|
373
|
-
done
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### Timeout Configuration
|
|
377
|
-
|
|
378
|
-
**Default:** 5 minutes per request
|
|
379
|
-
|
|
380
|
-
**Custom:**
|
|
381
|
-
```bash
|
|
382
|
-
indusagi --timeout=30 --mode=json "Quick question"
|
|
383
|
-
indusagi --timeout=600 --mode=json "Complex analysis"
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
### Resource Limits
|
|
387
|
-
|
|
388
|
-
**Recommended Defaults:**
|
|
389
|
-
- Max input size: 100 KB
|
|
390
|
-
- Max request timeout: 10 minutes
|
|
391
|
-
- Max concurrent sessions: 10
|
|
392
|
-
- Max output size: 5 MB
|
|
393
|
-
|
|
394
|
-
**Configuration:**
|
|
395
|
-
```json
|
|
396
|
-
{
|
|
397
|
-
"print_mode": {
|
|
398
|
-
"max_input_size": 102400,
|
|
399
|
-
"timeout_ms": 600000,
|
|
400
|
-
"max_output_size": 5242880,
|
|
401
|
-
"streaming": false,
|
|
402
|
-
"format": "json"
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
---
|
|
408
|
-
|
|
409
|
-
## Advanced Usage
|
|
410
|
-
|
|
411
|
-
### Using jq for Output Processing
|
|
412
|
-
|
|
413
|
-
```bash
|
|
414
|
-
# Pretty print JSON
|
|
415
|
-
indusagi --mode=json "..." | jq '.'
|
|
416
|
-
|
|
417
|
-
# Extract all assistant messages
|
|
418
|
-
indusagi --mode=json "..." | jq '.[] | select(.role == "assistant") | .content'
|
|
419
|
-
|
|
420
|
-
# Calculate statistics
|
|
421
|
-
indusagi --mode=json "..." | jq -s '[.[] | select(.type == "agent_end") | .total_tokens] | add'
|
|
422
|
-
|
|
423
|
-
# Format as table
|
|
424
|
-
indusagi --mode=json "..." | jq -r '.[].content' | column -t -s '|'
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Combining with Other Tools
|
|
428
|
-
|
|
429
|
-
```bash
|
|
430
|
-
# Parse with grep
|
|
431
|
-
indusagi --mode=json "..." | jq -r '.content' | grep "ERROR"
|
|
432
|
-
|
|
433
|
-
# Process with sed
|
|
434
|
-
indusagi --mode=text "..." | sed 's/old/new/g'
|
|
435
|
-
|
|
436
|
-
# Sort and unique
|
|
437
|
-
indusagi --mode=compact "..." | sort | uniq
|
|
438
|
-
|
|
439
|
-
# Count lines
|
|
440
|
-
indusagi --mode=text "..." | wc -l
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
### Shell Integration
|
|
444
|
-
|
|
445
|
-
```bash
|
|
446
|
-
# Save common commands
|
|
447
|
-
alias analyze='indusagi --mode=compact --timeout=30'
|
|
448
|
-
|
|
449
|
-
# Create wrapper function
|
|
450
|
-
function code_review() {
|
|
451
|
-
indusagi --session=review --mode=json "@$1" "Code review: suggest improvements"
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
# Use in scripts
|
|
455
|
-
code_review ./main.ts | jq '.[] | select(.content | contains("TODO"))'
|
|
456
|
-
```
|
package/docs/README.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Indusagi Coding Agent
|
|
2
|
-
|
|
3
|
-
A terminal-first coding agent with a small core and strong extensibility. Use it interactively, in scripts (print/JSON), over RPC, or as an SDK in your own apps.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g indusagi-coding-agent
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Quick Start
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
indusagi
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Authenticate using `/login` or set provider API keys.
|
|
18
|
-
|
|
19
|
-
## Modes
|
|
20
|
-
|
|
21
|
-
| Mode | Description | Docs |
|
|
22
|
-
|------|-------------|------|
|
|
23
|
-
| Interactive | Default mode with TUI | - |
|
|
24
|
-
| Print/JSON | For scripting | [json.md](json.md) |
|
|
25
|
-
| RPC | Process integration | [rpc.md](rpc.md) |
|
|
26
|
-
| SDK | Programmatic usage | [sdk.md](sdk.md) |
|
|
27
|
-
|
|
28
|
-
## Key Features
|
|
29
|
-
|
|
30
|
-
- **Multi-provider support** - Anthropic, OpenAI, Google, and more
|
|
31
|
-
- **Extensible** - Extensions, skills, hooks, and themes
|
|
32
|
-
- **Session management** - Tree-based navigation, branching, compaction
|
|
33
|
-
- **Tool system** - Built-in tools for files, bash, search
|
|
34
|
-
- **Subagents** - Spawn specialized agents for complex tasks
|
|
35
|
-
|
|
36
|
-
## Documentation Map
|
|
37
|
-
|
|
38
|
-
### Getting Started
|
|
39
|
-
- [Providers](providers.md) - Configure LLM providers
|
|
40
|
-
- [Settings](settings.md) - Global and project settings
|
|
41
|
-
|
|
42
|
-
### SDK & API
|
|
43
|
-
- [SDK Reference](sdk.md) - Programmatic usage
|
|
44
|
-
- [RPC Mode](rpc.md) - JSON-RPC integration
|
|
45
|
-
- [JSON Mode](json.md) - Scripting output
|
|
46
|
-
|
|
47
|
-
### Customization
|
|
48
|
-
- [Extensions](extensions.md) - Extend agent behavior
|
|
49
|
-
- [Skills](skills.md) - On-demand capability packages
|
|
50
|
-
- [Hooks](hooks.md) - Low-level interception
|
|
51
|
-
- [Subagents](subagents.md) - Spawn specialized agents
|
|
52
|
-
- [Prompt Templates](prompt-templates.md) - Custom prompts
|
|
53
|
-
- [Themes](themes.md) - UI theming
|
|
54
|
-
- [Packages](packages.md) - Share resources
|
|
55
|
-
|
|
56
|
-
### Session Management
|
|
57
|
-
- [Session Format](session.md) - File format and structure
|
|
58
|
-
- [Tree Navigation](tree.md) - Branch and navigate history
|
|
59
|
-
- [Compaction](compaction.md) - Context management
|
|
60
|
-
|
|
61
|
-
### Configuration
|
|
62
|
-
- [Settings](settings.md) - All configuration options
|
|
63
|
-
- [Custom Models](models.md) - Add custom providers
|
|
64
|
-
- [Custom Providers](custom-provider.md) - Proxy support
|
|
65
|
-
- [Keybindings](keybindings.md) - Keyboard shortcuts
|
|
66
|
-
|
|
67
|
-
### UI
|
|
68
|
-
- [TUI Components](tui.md) - Terminal UI
|
|
69
|
-
- [Terminal Setup](terminal-setup.md) - Terminal configuration
|
|
70
|
-
|
|
71
|
-
### Platform
|
|
72
|
-
- [Development](development.md) - Contributing
|
|
73
|
-
- [Shell Aliases](shell-aliases.md) - Shell integration
|
|
74
|
-
- [Windows](windows.md) - Windows-specific notes
|
|
75
|
-
|
|
76
|
-
## License
|
|
77
|
-
|
|
78
|
-
MIT
|