loki-mode 4.2.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/LICENSE +21 -0
- package/README.md +691 -0
- package/SKILL.md +191 -0
- package/VERSION +1 -0
- package/autonomy/.loki/dashboard/index.html +2634 -0
- package/autonomy/CONSTITUTION.md +508 -0
- package/autonomy/README.md +201 -0
- package/autonomy/config.example.yaml +152 -0
- package/autonomy/loki +526 -0
- package/autonomy/run.sh +3636 -0
- package/bin/loki-mode.js +26 -0
- package/bin/postinstall.js +60 -0
- package/docs/ACKNOWLEDGEMENTS.md +234 -0
- package/docs/COMPARISON.md +325 -0
- package/docs/COMPETITIVE-ANALYSIS.md +333 -0
- package/docs/INSTALLATION.md +547 -0
- package/docs/auto-claude-comparison.md +276 -0
- package/docs/cursor-comparison.md +225 -0
- package/docs/dashboard-guide.md +355 -0
- package/docs/screenshots/README.md +149 -0
- package/docs/screenshots/dashboard-agents.png +0 -0
- package/docs/screenshots/dashboard-tasks.png +0 -0
- package/docs/thick2thin.md +173 -0
- package/package.json +48 -0
- package/references/advanced-patterns.md +453 -0
- package/references/agent-types.md +243 -0
- package/references/agents.md +1043 -0
- package/references/business-ops.md +550 -0
- package/references/competitive-analysis.md +216 -0
- package/references/confidence-routing.md +371 -0
- package/references/core-workflow.md +275 -0
- package/references/cursor-learnings.md +207 -0
- package/references/deployment.md +604 -0
- package/references/lab-research-patterns.md +534 -0
- package/references/mcp-integration.md +186 -0
- package/references/memory-system.md +467 -0
- package/references/openai-patterns.md +647 -0
- package/references/production-patterns.md +568 -0
- package/references/prompt-repetition.md +192 -0
- package/references/quality-control.md +437 -0
- package/references/sdlc-phases.md +410 -0
- package/references/task-queue.md +361 -0
- package/references/tool-orchestration.md +691 -0
- package/skills/00-index.md +120 -0
- package/skills/agents.md +249 -0
- package/skills/artifacts.md +174 -0
- package/skills/github-integration.md +218 -0
- package/skills/model-selection.md +125 -0
- package/skills/parallel-workflows.md +526 -0
- package/skills/patterns-advanced.md +188 -0
- package/skills/production.md +292 -0
- package/skills/quality-gates.md +180 -0
- package/skills/testing.md +149 -0
- package/skills/troubleshooting.md +109 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Loki Mode Configuration File
|
|
2
|
+
# Copy to .loki/config.yaml in your project or ~/.config/loki-mode/config.yaml
|
|
3
|
+
# Environment variables override these values
|
|
4
|
+
# Version: 4.1.0
|
|
5
|
+
|
|
6
|
+
#===============================================================================
|
|
7
|
+
# Core Settings
|
|
8
|
+
#===============================================================================
|
|
9
|
+
core:
|
|
10
|
+
# Max retry attempts for rate limits and transient failures
|
|
11
|
+
max_retries: 50
|
|
12
|
+
# Base wait time in seconds for exponential backoff
|
|
13
|
+
base_wait: 60
|
|
14
|
+
# Maximum wait time in seconds
|
|
15
|
+
max_wait: 3600
|
|
16
|
+
# Skip prerequisite checks (not recommended)
|
|
17
|
+
skip_prereqs: false
|
|
18
|
+
|
|
19
|
+
#===============================================================================
|
|
20
|
+
# Dashboard Settings
|
|
21
|
+
#===============================================================================
|
|
22
|
+
dashboard:
|
|
23
|
+
# Enable web dashboard
|
|
24
|
+
enabled: true
|
|
25
|
+
# Dashboard port
|
|
26
|
+
port: 57374
|
|
27
|
+
|
|
28
|
+
#===============================================================================
|
|
29
|
+
# Resource Monitoring
|
|
30
|
+
#===============================================================================
|
|
31
|
+
resources:
|
|
32
|
+
# Check resources every N seconds
|
|
33
|
+
check_interval: 300
|
|
34
|
+
# CPU percentage threshold to warn
|
|
35
|
+
cpu_threshold: 80
|
|
36
|
+
# Memory percentage threshold to warn
|
|
37
|
+
mem_threshold: 80
|
|
38
|
+
|
|
39
|
+
#===============================================================================
|
|
40
|
+
# Security & Safety
|
|
41
|
+
#===============================================================================
|
|
42
|
+
security:
|
|
43
|
+
# Require approval before execution (staged autonomy)
|
|
44
|
+
staged_autonomy: false
|
|
45
|
+
# Enable audit logging
|
|
46
|
+
audit_log: false
|
|
47
|
+
# Limit concurrent agent spawning
|
|
48
|
+
max_parallel_agents: 10
|
|
49
|
+
# Run in sandboxed container (requires Docker)
|
|
50
|
+
sandbox_mode: false
|
|
51
|
+
# Comma-separated paths agents can modify (empty = all)
|
|
52
|
+
allowed_paths: ""
|
|
53
|
+
# Comma-separated blocked shell commands
|
|
54
|
+
blocked_commands: "rm -rf /,dd if=,mkfs,:(){ :|:& };:"
|
|
55
|
+
|
|
56
|
+
#===============================================================================
|
|
57
|
+
# Testing Phases (enable/disable specific test phases)
|
|
58
|
+
#===============================================================================
|
|
59
|
+
phases:
|
|
60
|
+
unit_tests: true
|
|
61
|
+
api_tests: true
|
|
62
|
+
e2e_tests: true
|
|
63
|
+
security: true
|
|
64
|
+
integration: true
|
|
65
|
+
code_review: true
|
|
66
|
+
web_research: true
|
|
67
|
+
performance: true
|
|
68
|
+
accessibility: true
|
|
69
|
+
regression: true
|
|
70
|
+
uat: true
|
|
71
|
+
|
|
72
|
+
#===============================================================================
|
|
73
|
+
# Completion & Iteration Control
|
|
74
|
+
#===============================================================================
|
|
75
|
+
completion:
|
|
76
|
+
# EXPLICIT stop condition text (empty = runs until stopped)
|
|
77
|
+
promise: ""
|
|
78
|
+
# Max loop iterations before exit
|
|
79
|
+
max_iterations: 1000
|
|
80
|
+
# Ignore ALL completion signals (runs forever)
|
|
81
|
+
perpetual_mode: false
|
|
82
|
+
|
|
83
|
+
#===============================================================================
|
|
84
|
+
# Model & Routing Settings
|
|
85
|
+
#===============================================================================
|
|
86
|
+
model:
|
|
87
|
+
# Enable prompt repetition for Haiku agents
|
|
88
|
+
prompt_repetition: true
|
|
89
|
+
# Enable confidence-based routing
|
|
90
|
+
confidence_routing: true
|
|
91
|
+
# Autonomy level: perpetual, checkpoint, or supervised
|
|
92
|
+
autonomy_mode: perpetual
|
|
93
|
+
# Suggest compaction every N iterations
|
|
94
|
+
compaction_interval: 25
|
|
95
|
+
|
|
96
|
+
#===============================================================================
|
|
97
|
+
# Parallel Execution (Git Worktrees)
|
|
98
|
+
#===============================================================================
|
|
99
|
+
parallel:
|
|
100
|
+
# Enable git worktree-based parallelism
|
|
101
|
+
enabled: false
|
|
102
|
+
# Maximum parallel worktrees
|
|
103
|
+
max_worktrees: 5
|
|
104
|
+
# Maximum concurrent Claude sessions
|
|
105
|
+
max_sessions: 3
|
|
106
|
+
# Run testing stream in parallel
|
|
107
|
+
testing: true
|
|
108
|
+
# Run documentation stream in parallel
|
|
109
|
+
docs: true
|
|
110
|
+
# Run blog stream if site has blog
|
|
111
|
+
blog: false
|
|
112
|
+
# Auto-merge completed features
|
|
113
|
+
auto_merge: true
|
|
114
|
+
|
|
115
|
+
#===============================================================================
|
|
116
|
+
# Complexity Tier
|
|
117
|
+
#===============================================================================
|
|
118
|
+
complexity:
|
|
119
|
+
# Force complexity tier: auto, simple, moderate, complex, enterprise
|
|
120
|
+
tier: auto
|
|
121
|
+
|
|
122
|
+
#===============================================================================
|
|
123
|
+
# GitHub Integration
|
|
124
|
+
#===============================================================================
|
|
125
|
+
github:
|
|
126
|
+
# Import open issues as tasks
|
|
127
|
+
import: false
|
|
128
|
+
# Create PR when feature complete
|
|
129
|
+
pr: false
|
|
130
|
+
# Sync status back to issues
|
|
131
|
+
sync: false
|
|
132
|
+
# Override repo detection (owner/repo)
|
|
133
|
+
repo: ""
|
|
134
|
+
# Filter by labels (comma-separated)
|
|
135
|
+
labels: ""
|
|
136
|
+
# Filter by milestone
|
|
137
|
+
milestone: ""
|
|
138
|
+
# Filter by assignee
|
|
139
|
+
assignee: ""
|
|
140
|
+
# Max issues to import
|
|
141
|
+
limit: 100
|
|
142
|
+
# Label for PRs (empty = no label)
|
|
143
|
+
pr_label: ""
|
|
144
|
+
|
|
145
|
+
#===============================================================================
|
|
146
|
+
# Notifications
|
|
147
|
+
#===============================================================================
|
|
148
|
+
notifications:
|
|
149
|
+
# Enable desktop notifications
|
|
150
|
+
enabled: true
|
|
151
|
+
# Play sound with notifications
|
|
152
|
+
sound: true
|
package/autonomy/loki
ADDED
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#===============================================================================
|
|
3
|
+
# Loki Mode CLI Wrapper (v4.1.0)
|
|
4
|
+
# Simple command-line interface for Loki Mode
|
|
5
|
+
#
|
|
6
|
+
# Installation:
|
|
7
|
+
# ln -sf ~/.claude/skills/loki-mode/autonomy/loki /usr/local/bin/loki
|
|
8
|
+
#
|
|
9
|
+
# Usage:
|
|
10
|
+
# loki start [PRD] - Start Loki Mode (optionally with PRD)
|
|
11
|
+
# loki stop - Stop execution immediately
|
|
12
|
+
# loki pause - Pause after current session
|
|
13
|
+
# loki resume - Resume paused execution
|
|
14
|
+
# loki status - Show current status
|
|
15
|
+
# loki dashboard - Open dashboard in browser
|
|
16
|
+
# loki import - Import GitHub issues
|
|
17
|
+
# loki help - Show this help
|
|
18
|
+
#===============================================================================
|
|
19
|
+
|
|
20
|
+
set -euo pipefail
|
|
21
|
+
|
|
22
|
+
# Colors
|
|
23
|
+
RED='\033[0;31m'
|
|
24
|
+
GREEN='\033[0;32m'
|
|
25
|
+
YELLOW='\033[1;33m'
|
|
26
|
+
BLUE='\033[0;34m'
|
|
27
|
+
CYAN='\033[0;36m'
|
|
28
|
+
BOLD='\033[1m'
|
|
29
|
+
NC='\033[0m'
|
|
30
|
+
|
|
31
|
+
# Find the skill installation
|
|
32
|
+
find_skill_dir() {
|
|
33
|
+
local dirs=(
|
|
34
|
+
"$HOME/.claude/skills/loki-mode"
|
|
35
|
+
"$(dirname "$0")/.."
|
|
36
|
+
"."
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
for dir in "${dirs[@]}"; do
|
|
40
|
+
if [ -f "$dir/SKILL.md" ] && [ -f "$dir/autonomy/run.sh" ]; then
|
|
41
|
+
echo "$dir"
|
|
42
|
+
return 0
|
|
43
|
+
fi
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
echo ""
|
|
47
|
+
return 1
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
SKILL_DIR=$(find_skill_dir)
|
|
51
|
+
if [ -z "$SKILL_DIR" ]; then
|
|
52
|
+
echo -e "${RED}Error: Could not find Loki Mode installation${NC}"
|
|
53
|
+
echo "Expected at: ~/.claude/skills/loki-mode"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
RUN_SH="$SKILL_DIR/autonomy/run.sh"
|
|
58
|
+
LOKI_DIR=".loki"
|
|
59
|
+
|
|
60
|
+
# Get version from VERSION file
|
|
61
|
+
get_version() {
|
|
62
|
+
if [ -f "$SKILL_DIR/VERSION" ]; then
|
|
63
|
+
cat "$SKILL_DIR/VERSION"
|
|
64
|
+
else
|
|
65
|
+
echo "unknown"
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Show help
|
|
70
|
+
show_help() {
|
|
71
|
+
local version=$(get_version)
|
|
72
|
+
echo -e "${BOLD}Loki Mode v$version${NC}"
|
|
73
|
+
echo ""
|
|
74
|
+
echo "Usage: loki <command> [options]"
|
|
75
|
+
echo ""
|
|
76
|
+
echo "Commands:"
|
|
77
|
+
echo " start [PRD] Start Loki Mode (optionally with PRD file)"
|
|
78
|
+
echo " stop Stop execution immediately"
|
|
79
|
+
echo " pause Pause after current session"
|
|
80
|
+
echo " resume Resume paused execution"
|
|
81
|
+
echo " status Show current status"
|
|
82
|
+
echo " dashboard Open dashboard in browser"
|
|
83
|
+
echo " import Import GitHub issues as tasks"
|
|
84
|
+
echo " config [cmd] Manage configuration (show|init|edit|path)"
|
|
85
|
+
echo " version Show version"
|
|
86
|
+
echo " help Show this help"
|
|
87
|
+
echo ""
|
|
88
|
+
echo "Options for 'start':"
|
|
89
|
+
echo " --parallel Enable parallel mode with git worktrees"
|
|
90
|
+
echo " --simple Force simple complexity tier (3 phases)"
|
|
91
|
+
echo " --complex Force complex complexity tier (8 phases)"
|
|
92
|
+
echo " --github Enable GitHub issue import"
|
|
93
|
+
echo " --no-dashboard Disable web dashboard"
|
|
94
|
+
echo ""
|
|
95
|
+
echo "Examples:"
|
|
96
|
+
echo " loki start # Start in current directory"
|
|
97
|
+
echo " loki start ./prd.md # Start with PRD file"
|
|
98
|
+
echo " loki start --parallel # Start in parallel mode"
|
|
99
|
+
echo " loki pause # Pause execution"
|
|
100
|
+
echo " loki status # Check current status"
|
|
101
|
+
echo ""
|
|
102
|
+
echo "Environment Variables:"
|
|
103
|
+
echo " See: $RUN_SH (header comments)"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# Start Loki Mode
|
|
107
|
+
cmd_start() {
|
|
108
|
+
local args=()
|
|
109
|
+
local prd_file=""
|
|
110
|
+
|
|
111
|
+
while [[ $# -gt 0 ]]; do
|
|
112
|
+
case "$1" in
|
|
113
|
+
--parallel)
|
|
114
|
+
args+=("--parallel")
|
|
115
|
+
shift
|
|
116
|
+
;;
|
|
117
|
+
--simple)
|
|
118
|
+
export LOKI_COMPLEXITY=simple
|
|
119
|
+
shift
|
|
120
|
+
;;
|
|
121
|
+
--complex)
|
|
122
|
+
export LOKI_COMPLEXITY=complex
|
|
123
|
+
shift
|
|
124
|
+
;;
|
|
125
|
+
--github)
|
|
126
|
+
export LOKI_GITHUB_IMPORT=true
|
|
127
|
+
shift
|
|
128
|
+
;;
|
|
129
|
+
--no-dashboard)
|
|
130
|
+
export LOKI_DASHBOARD=false
|
|
131
|
+
shift
|
|
132
|
+
;;
|
|
133
|
+
-*)
|
|
134
|
+
echo -e "${RED}Unknown option: $1${NC}"
|
|
135
|
+
exit 1
|
|
136
|
+
;;
|
|
137
|
+
*)
|
|
138
|
+
prd_file="$1"
|
|
139
|
+
shift
|
|
140
|
+
;;
|
|
141
|
+
esac
|
|
142
|
+
done
|
|
143
|
+
|
|
144
|
+
if [ -n "$prd_file" ]; then
|
|
145
|
+
args+=("$prd_file")
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
echo -e "${GREEN}Starting Loki Mode...${NC}"
|
|
149
|
+
exec "$RUN_SH" "${args[@]}"
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Stop execution immediately
|
|
153
|
+
cmd_stop() {
|
|
154
|
+
if [ ! -d "$LOKI_DIR" ]; then
|
|
155
|
+
echo -e "${YELLOW}No .loki directory found. Is Loki Mode running?${NC}"
|
|
156
|
+
exit 1
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
touch "$LOKI_DIR/STOP"
|
|
160
|
+
echo -e "${RED}STOP signal sent. Execution will halt immediately.${NC}"
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
# Pause after current session
|
|
164
|
+
cmd_pause() {
|
|
165
|
+
if [ ! -d "$LOKI_DIR" ]; then
|
|
166
|
+
echo -e "${YELLOW}No .loki directory found. Is Loki Mode running?${NC}"
|
|
167
|
+
exit 1
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
touch "$LOKI_DIR/PAUSE"
|
|
171
|
+
echo -e "${YELLOW}PAUSE signal sent. Execution will pause after current session.${NC}"
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
# Resume paused execution
|
|
175
|
+
cmd_resume() {
|
|
176
|
+
if [ ! -d "$LOKI_DIR" ]; then
|
|
177
|
+
echo -e "${YELLOW}No .loki directory found.${NC}"
|
|
178
|
+
exit 1
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
if [ -f "$LOKI_DIR/PAUSE" ]; then
|
|
182
|
+
rm -f "$LOKI_DIR/PAUSE"
|
|
183
|
+
echo -e "${GREEN}PAUSE file removed. You may need to restart Loki Mode.${NC}"
|
|
184
|
+
elif [ -f "$LOKI_DIR/STOP" ]; then
|
|
185
|
+
rm -f "$LOKI_DIR/STOP"
|
|
186
|
+
echo -e "${GREEN}STOP file removed. You may need to restart Loki Mode.${NC}"
|
|
187
|
+
else
|
|
188
|
+
echo -e "${YELLOW}No pause/stop files found.${NC}"
|
|
189
|
+
fi
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
# Show current status
|
|
193
|
+
cmd_status() {
|
|
194
|
+
if [ ! -d "$LOKI_DIR" ]; then
|
|
195
|
+
echo -e "${YELLOW}No .loki directory found.${NC}"
|
|
196
|
+
echo "Loki Mode has not been initialized in this directory."
|
|
197
|
+
exit 0
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
echo -e "${BOLD}Loki Mode Status${NC}"
|
|
201
|
+
echo ""
|
|
202
|
+
|
|
203
|
+
# Check status file
|
|
204
|
+
if [ -f "$LOKI_DIR/STATUS.txt" ]; then
|
|
205
|
+
echo -e "${CYAN}Current Status:${NC}"
|
|
206
|
+
cat "$LOKI_DIR/STATUS.txt"
|
|
207
|
+
echo ""
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
# Check for signals
|
|
211
|
+
if [ -f "$LOKI_DIR/PAUSE" ]; then
|
|
212
|
+
echo -e "${YELLOW}PAUSE signal active${NC}"
|
|
213
|
+
fi
|
|
214
|
+
if [ -f "$LOKI_DIR/STOP" ]; then
|
|
215
|
+
echo -e "${RED}STOP signal active${NC}"
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
# Check orchestrator state
|
|
219
|
+
if [ -f "$LOKI_DIR/state/orchestrator.json" ]; then
|
|
220
|
+
echo -e "${CYAN}Orchestrator State:${NC}"
|
|
221
|
+
jq -r '.currentPhase // "unknown"' "$LOKI_DIR/state/orchestrator.json" 2>/dev/null || echo "unknown"
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
# Check pending tasks
|
|
225
|
+
if [ -f "$LOKI_DIR/queue/pending.json" ]; then
|
|
226
|
+
local task_count=$(jq '.tasks | length' "$LOKI_DIR/queue/pending.json" 2>/dev/null || echo "0")
|
|
227
|
+
echo -e "${CYAN}Pending Tasks:${NC} $task_count"
|
|
228
|
+
fi
|
|
229
|
+
|
|
230
|
+
# Check dashboard
|
|
231
|
+
if [ -f "$LOKI_DIR/dashboard/index.html" ]; then
|
|
232
|
+
local port=${LOKI_DASHBOARD_PORT:-57374}
|
|
233
|
+
echo -e "${CYAN}Dashboard:${NC} http://127.0.0.1:$port/dashboard/index.html"
|
|
234
|
+
fi
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
# Open dashboard in browser
|
|
238
|
+
cmd_dashboard() {
|
|
239
|
+
local port=${LOKI_DASHBOARD_PORT:-57374}
|
|
240
|
+
local url="http://127.0.0.1:$port/dashboard/index.html"
|
|
241
|
+
|
|
242
|
+
if [ ! -d "$LOKI_DIR/dashboard" ]; then
|
|
243
|
+
echo -e "${YELLOW}Dashboard not found. Start Loki Mode first.${NC}"
|
|
244
|
+
exit 1
|
|
245
|
+
fi
|
|
246
|
+
|
|
247
|
+
echo -e "${GREEN}Opening dashboard: $url${NC}"
|
|
248
|
+
|
|
249
|
+
# Open in browser (cross-platform)
|
|
250
|
+
if command -v open &> /dev/null; then
|
|
251
|
+
open "$url"
|
|
252
|
+
elif command -v xdg-open &> /dev/null; then
|
|
253
|
+
xdg-open "$url"
|
|
254
|
+
else
|
|
255
|
+
echo "Please open in browser: $url"
|
|
256
|
+
fi
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
# Import GitHub issues
|
|
260
|
+
cmd_import() {
|
|
261
|
+
if [ ! -d "$LOKI_DIR" ]; then
|
|
262
|
+
mkdir -p "$LOKI_DIR/queue"
|
|
263
|
+
fi
|
|
264
|
+
|
|
265
|
+
export LOKI_GITHUB_IMPORT=true
|
|
266
|
+
|
|
267
|
+
# Check gh CLI
|
|
268
|
+
if ! command -v gh &> /dev/null; then
|
|
269
|
+
echo -e "${RED}Error: gh CLI not found. Install with: brew install gh${NC}"
|
|
270
|
+
exit 1
|
|
271
|
+
fi
|
|
272
|
+
|
|
273
|
+
if ! gh auth status &> /dev/null; then
|
|
274
|
+
echo -e "${RED}Error: gh CLI not authenticated. Run: gh auth login${NC}"
|
|
275
|
+
exit 1
|
|
276
|
+
fi
|
|
277
|
+
|
|
278
|
+
echo -e "${GREEN}Importing GitHub issues...${NC}"
|
|
279
|
+
# Source the functions from run.sh and call import
|
|
280
|
+
source "$RUN_SH" 2>/dev/null || true
|
|
281
|
+
if type import_github_issues &>/dev/null; then
|
|
282
|
+
import_github_issues
|
|
283
|
+
else
|
|
284
|
+
echo -e "${YELLOW}Import function not available. Using fallback.${NC}"
|
|
285
|
+
gh issue list --json number,title,url --limit 20
|
|
286
|
+
fi
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
# Show configuration
|
|
290
|
+
cmd_config() {
|
|
291
|
+
local subcommand="${1:-show}"
|
|
292
|
+
|
|
293
|
+
case "$subcommand" in
|
|
294
|
+
show)
|
|
295
|
+
cmd_config_show
|
|
296
|
+
;;
|
|
297
|
+
init)
|
|
298
|
+
cmd_config_init
|
|
299
|
+
;;
|
|
300
|
+
edit)
|
|
301
|
+
cmd_config_edit
|
|
302
|
+
;;
|
|
303
|
+
path)
|
|
304
|
+
cmd_config_path
|
|
305
|
+
;;
|
|
306
|
+
*)
|
|
307
|
+
echo -e "${YELLOW}Usage: loki config [show|init|edit|path]${NC}"
|
|
308
|
+
echo ""
|
|
309
|
+
echo " show Show current configuration (default)"
|
|
310
|
+
echo " init Create a config file from template"
|
|
311
|
+
echo " edit Open config file in editor"
|
|
312
|
+
echo " path Show config file paths"
|
|
313
|
+
;;
|
|
314
|
+
esac
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
cmd_config_show() {
|
|
318
|
+
echo -e "${BOLD}Loki Mode Configuration${NC}"
|
|
319
|
+
echo ""
|
|
320
|
+
echo -e "${CYAN}Installation:${NC} $SKILL_DIR"
|
|
321
|
+
echo -e "${CYAN}Version:${NC} $(get_version)"
|
|
322
|
+
echo ""
|
|
323
|
+
|
|
324
|
+
# Check for config files
|
|
325
|
+
local config_file=""
|
|
326
|
+
if [ -f ".loki/config.yaml" ]; then
|
|
327
|
+
config_file=".loki/config.yaml"
|
|
328
|
+
echo -e "${GREEN}Config file:${NC} $config_file (project-local)"
|
|
329
|
+
elif [ -f ".loki/config.yml" ]; then
|
|
330
|
+
config_file=".loki/config.yml"
|
|
331
|
+
echo -e "${GREEN}Config file:${NC} $config_file (project-local)"
|
|
332
|
+
elif [ -f "${HOME}/.config/loki-mode/config.yaml" ]; then
|
|
333
|
+
config_file="${HOME}/.config/loki-mode/config.yaml"
|
|
334
|
+
echo -e "${GREEN}Config file:${NC} $config_file (user-global)"
|
|
335
|
+
elif [ -f "${HOME}/.config/loki-mode/config.yml" ]; then
|
|
336
|
+
config_file="${HOME}/.config/loki-mode/config.yml"
|
|
337
|
+
echo -e "${GREEN}Config file:${NC} $config_file (user-global)"
|
|
338
|
+
else
|
|
339
|
+
echo -e "${YELLOW}Config file:${NC} Not found (using defaults)"
|
|
340
|
+
fi
|
|
341
|
+
echo ""
|
|
342
|
+
|
|
343
|
+
echo -e "${CYAN}Current Settings:${NC}"
|
|
344
|
+
echo ""
|
|
345
|
+
echo "Core:"
|
|
346
|
+
echo " max_retries: ${LOKI_MAX_RETRIES:-50}"
|
|
347
|
+
echo " base_wait: ${LOKI_BASE_WAIT:-60}s"
|
|
348
|
+
echo " max_wait: ${LOKI_MAX_WAIT:-3600}s"
|
|
349
|
+
echo ""
|
|
350
|
+
echo "Dashboard:"
|
|
351
|
+
echo " enabled: ${LOKI_DASHBOARD:-true}"
|
|
352
|
+
echo " port: ${LOKI_DASHBOARD_PORT:-57374}"
|
|
353
|
+
echo ""
|
|
354
|
+
echo "Notifications:"
|
|
355
|
+
echo " enabled: ${LOKI_NOTIFICATIONS:-true}"
|
|
356
|
+
echo " sound: ${LOKI_NOTIFICATION_SOUND:-true}"
|
|
357
|
+
echo ""
|
|
358
|
+
echo "GitHub Integration:"
|
|
359
|
+
echo " import: ${LOKI_GITHUB_IMPORT:-false}"
|
|
360
|
+
echo " pr: ${LOKI_GITHUB_PR:-false}"
|
|
361
|
+
echo " sync: ${LOKI_GITHUB_SYNC:-false}"
|
|
362
|
+
echo ""
|
|
363
|
+
echo "Execution:"
|
|
364
|
+
echo " complexity: ${LOKI_COMPLEXITY:-auto}"
|
|
365
|
+
echo " parallel_mode: ${LOKI_PARALLEL_MODE:-false}"
|
|
366
|
+
echo " max_iterations: ${LOKI_MAX_ITERATIONS:-1000}"
|
|
367
|
+
echo " autonomy_mode: ${LOKI_AUTONOMY_MODE:-perpetual}"
|
|
368
|
+
echo ""
|
|
369
|
+
echo -e "Run ${CYAN}loki config path${NC} to see all config file locations"
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
cmd_config_init() {
|
|
373
|
+
local template="$SKILL_DIR/autonomy/config.example.yaml"
|
|
374
|
+
local target=".loki/config.yaml"
|
|
375
|
+
local global_target="${HOME}/.config/loki-mode/config.yaml"
|
|
376
|
+
|
|
377
|
+
if [ ! -f "$template" ]; then
|
|
378
|
+
echo -e "${RED}Error: Config template not found at $template${NC}"
|
|
379
|
+
exit 1
|
|
380
|
+
fi
|
|
381
|
+
|
|
382
|
+
echo -e "${BOLD}Initialize Configuration${NC}"
|
|
383
|
+
echo ""
|
|
384
|
+
echo "Where do you want to create the config file?"
|
|
385
|
+
echo ""
|
|
386
|
+
echo " 1) $target (project-local, recommended)"
|
|
387
|
+
echo " 2) $global_target (user-global)"
|
|
388
|
+
echo ""
|
|
389
|
+
read -p "Choice [1]: " choice
|
|
390
|
+
choice="${choice:-1}"
|
|
391
|
+
|
|
392
|
+
case "$choice" in
|
|
393
|
+
1)
|
|
394
|
+
mkdir -p ".loki"
|
|
395
|
+
cp "$template" "$target"
|
|
396
|
+
echo -e "${GREEN}Created: $target${NC}"
|
|
397
|
+
;;
|
|
398
|
+
2)
|
|
399
|
+
mkdir -p "${HOME}/.config/loki-mode"
|
|
400
|
+
cp "$template" "$global_target"
|
|
401
|
+
echo -e "${GREEN}Created: $global_target${NC}"
|
|
402
|
+
;;
|
|
403
|
+
*)
|
|
404
|
+
echo -e "${RED}Invalid choice${NC}"
|
|
405
|
+
exit 1
|
|
406
|
+
;;
|
|
407
|
+
esac
|
|
408
|
+
|
|
409
|
+
echo ""
|
|
410
|
+
echo "Edit with: loki config edit"
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
cmd_config_edit() {
|
|
414
|
+
local config_file=""
|
|
415
|
+
|
|
416
|
+
# Find existing config file
|
|
417
|
+
if [ -f ".loki/config.yaml" ]; then
|
|
418
|
+
config_file=".loki/config.yaml"
|
|
419
|
+
elif [ -f ".loki/config.yml" ]; then
|
|
420
|
+
config_file=".loki/config.yml"
|
|
421
|
+
elif [ -f "${HOME}/.config/loki-mode/config.yaml" ]; then
|
|
422
|
+
config_file="${HOME}/.config/loki-mode/config.yaml"
|
|
423
|
+
elif [ -f "${HOME}/.config/loki-mode/config.yml" ]; then
|
|
424
|
+
config_file="${HOME}/.config/loki-mode/config.yml"
|
|
425
|
+
fi
|
|
426
|
+
|
|
427
|
+
if [ -z "$config_file" ]; then
|
|
428
|
+
echo -e "${YELLOW}No config file found.${NC}"
|
|
429
|
+
read -p "Create one? [Y/n]: " create
|
|
430
|
+
create="${create:-Y}"
|
|
431
|
+
if [[ "$create" =~ ^[Yy] ]]; then
|
|
432
|
+
cmd_config_init
|
|
433
|
+
config_file=".loki/config.yaml"
|
|
434
|
+
else
|
|
435
|
+
exit 0
|
|
436
|
+
fi
|
|
437
|
+
fi
|
|
438
|
+
|
|
439
|
+
# Open in editor
|
|
440
|
+
local editor="${EDITOR:-${VISUAL:-vim}}"
|
|
441
|
+
echo -e "${GREEN}Opening $config_file with $editor${NC}"
|
|
442
|
+
"$editor" "$config_file"
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
cmd_config_path() {
|
|
446
|
+
echo -e "${BOLD}Config File Search Paths${NC}"
|
|
447
|
+
echo ""
|
|
448
|
+
echo "Loki Mode searches for config files in this order:"
|
|
449
|
+
echo ""
|
|
450
|
+
|
|
451
|
+
local paths=(
|
|
452
|
+
".loki/config.yaml"
|
|
453
|
+
".loki/config.yml"
|
|
454
|
+
"${HOME}/.config/loki-mode/config.yaml"
|
|
455
|
+
"${HOME}/.config/loki-mode/config.yml"
|
|
456
|
+
)
|
|
457
|
+
|
|
458
|
+
for path in "${paths[@]}"; do
|
|
459
|
+
if [ -f "$path" ]; then
|
|
460
|
+
echo -e " ${GREEN}[FOUND]${NC} $path"
|
|
461
|
+
else
|
|
462
|
+
echo -e " ${YELLOW}[-----]${NC} $path"
|
|
463
|
+
fi
|
|
464
|
+
done
|
|
465
|
+
|
|
466
|
+
echo ""
|
|
467
|
+
echo "Template: $SKILL_DIR/autonomy/config.example.yaml"
|
|
468
|
+
echo ""
|
|
469
|
+
echo "Create a config file with: loki config init"
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
# Show version
|
|
473
|
+
cmd_version() {
|
|
474
|
+
echo "Loki Mode v$(get_version)"
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
# Main command dispatcher
|
|
478
|
+
main() {
|
|
479
|
+
if [ $# -eq 0 ]; then
|
|
480
|
+
show_help
|
|
481
|
+
exit 0
|
|
482
|
+
fi
|
|
483
|
+
|
|
484
|
+
local command="$1"
|
|
485
|
+
shift
|
|
486
|
+
|
|
487
|
+
case "$command" in
|
|
488
|
+
start)
|
|
489
|
+
cmd_start "$@"
|
|
490
|
+
;;
|
|
491
|
+
stop)
|
|
492
|
+
cmd_stop
|
|
493
|
+
;;
|
|
494
|
+
pause)
|
|
495
|
+
cmd_pause
|
|
496
|
+
;;
|
|
497
|
+
resume)
|
|
498
|
+
cmd_resume
|
|
499
|
+
;;
|
|
500
|
+
status)
|
|
501
|
+
cmd_status
|
|
502
|
+
;;
|
|
503
|
+
dashboard)
|
|
504
|
+
cmd_dashboard
|
|
505
|
+
;;
|
|
506
|
+
import)
|
|
507
|
+
cmd_import
|
|
508
|
+
;;
|
|
509
|
+
config)
|
|
510
|
+
cmd_config "$@"
|
|
511
|
+
;;
|
|
512
|
+
version|--version|-v)
|
|
513
|
+
cmd_version
|
|
514
|
+
;;
|
|
515
|
+
help|--help|-h)
|
|
516
|
+
show_help
|
|
517
|
+
;;
|
|
518
|
+
*)
|
|
519
|
+
echo -e "${RED}Unknown command: $command${NC}"
|
|
520
|
+
echo "Run 'loki help' for usage."
|
|
521
|
+
exit 1
|
|
522
|
+
;;
|
|
523
|
+
esac
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
main "$@"
|