247-cli 1.6.0 → 1.7.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/agent/dist/db/index.d.ts.map +1 -1
- package/agent/dist/db/index.js +22 -0
- package/agent/dist/db/index.js.map +1 -1
- package/agent/dist/db/issues.d.ts +83 -0
- package/agent/dist/db/issues.d.ts.map +1 -0
- package/agent/dist/db/issues.js +423 -0
- package/agent/dist/db/issues.js.map +1 -0
- package/agent/dist/db/projects.d.ts +63 -0
- package/agent/dist/db/projects.d.ts.map +1 -0
- package/agent/dist/db/projects.js +288 -0
- package/agent/dist/db/projects.js.map +1 -0
- package/agent/dist/db/schema.d.ts +64 -3
- package/agent/dist/db/schema.d.ts.map +1 -1
- package/agent/dist/db/schema.js +45 -2
- package/agent/dist/db/schema.js.map +1 -1
- package/agent/dist/db/sessions.d.ts.map +1 -1
- package/agent/dist/db/sessions.js +5 -3
- package/agent/dist/db/sessions.js.map +1 -1
- package/agent/dist/lib/init-script.d.ts +14 -2
- package/agent/dist/lib/init-script.d.ts.map +1 -1
- package/agent/dist/lib/init-script.js +234 -14
- package/agent/dist/lib/init-script.js.map +1 -1
- package/agent/dist/lib/planning-prompt.d.ts +7 -0
- package/agent/dist/lib/planning-prompt.d.ts.map +1 -0
- package/agent/dist/lib/planning-prompt.js +51 -0
- package/agent/dist/lib/planning-prompt.js.map +1 -0
- package/agent/dist/routes/index.d.ts +2 -0
- package/agent/dist/routes/index.d.ts.map +1 -1
- package/agent/dist/routes/index.js +2 -0
- package/agent/dist/routes/index.js.map +1 -1
- package/agent/dist/routes/issues.d.ts +6 -0
- package/agent/dist/routes/issues.d.ts.map +1 -0
- package/agent/dist/routes/issues.js +235 -0
- package/agent/dist/routes/issues.js.map +1 -0
- package/agent/dist/routes/managed-projects.d.ts +7 -0
- package/agent/dist/routes/managed-projects.d.ts.map +1 -0
- package/agent/dist/routes/managed-projects.js +230 -0
- package/agent/dist/routes/managed-projects.js.map +1 -0
- package/agent/dist/server.d.ts.map +1 -1
- package/agent/dist/server.js +10 -1
- package/agent/dist/server.js.map +1 -1
- package/agent/dist/services/index.d.ts +2 -0
- package/agent/dist/services/index.d.ts.map +1 -1
- package/agent/dist/services/index.js +1 -0
- package/agent/dist/services/index.js.map +1 -1
- package/agent/dist/services/planner.d.ts +79 -0
- package/agent/dist/services/planner.d.ts.map +1 -0
- package/agent/dist/services/planner.js +298 -0
- package/agent/dist/services/planner.js.map +1 -0
- package/agent/dist/terminal.d.ts +11 -1
- package/agent/dist/terminal.d.ts.map +1 -1
- package/agent/dist/terminal.js +18 -2
- package/agent/dist/terminal.js.map +1 -1
- package/agent/dist/websocket-handlers-planning.d.ts +10 -0
- package/agent/dist/websocket-handlers-planning.d.ts.map +1 -0
- package/agent/dist/websocket-handlers-planning.js +289 -0
- package/agent/dist/websocket-handlers-planning.js.map +1 -0
- package/agent/dist/websocket-handlers.d.ts.map +1 -1
- package/agent/dist/websocket-handlers.js +33 -1
- package/agent/dist/websocket-handlers.js.map +1 -1
- package/agent/node_modules/247-shared/dist/types/index.d.ts +191 -0
- package/agent/node_modules/247-shared/dist/types/index.d.ts.map +1 -1
- package/agent/node_modules/247-shared/dist/types/index.js +13 -0
- package/agent/node_modules/247-shared/dist/types/index.js.map +1 -1
- package/agent/node_modules/247-shared/package.json +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
export interface InitScriptOptions {
|
|
2
2
|
sessionName: string;
|
|
3
|
+
projectName: string;
|
|
3
4
|
customEnvVars?: Record<string, string>;
|
|
5
|
+
shell?: 'bash' | 'zsh';
|
|
6
|
+
/** Issue plan to inject as Claude context (written to .claude/current-task.md) */
|
|
7
|
+
issuePlan?: string;
|
|
8
|
+
/** Issue title for display in welcome message */
|
|
9
|
+
issueTitle?: string;
|
|
10
|
+
/** Planning prompt to start Claude with (for planning sessions) */
|
|
11
|
+
planningPrompt?: string;
|
|
4
12
|
}
|
|
5
13
|
/**
|
|
6
|
-
*
|
|
7
|
-
|
|
14
|
+
* Detects the user's default shell from environment.
|
|
15
|
+
*/
|
|
16
|
+
export declare function detectUserShell(): 'bash' | 'zsh';
|
|
17
|
+
/**
|
|
18
|
+
* Generates a bash/zsh init script for tmux session initialization.
|
|
19
|
+
* Features: adaptive prompt, tmux status bar, useful aliases, welcome message.
|
|
8
20
|
*/
|
|
9
21
|
export declare function generateInitScript(options: InitScriptOptions): string;
|
|
10
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-script.d.ts","sourceRoot":"","sources":["../../src/lib/init-script.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"init-script.d.ts","sourceRoot":"","sources":["../../src/lib/init-script.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,KAAK,CAIhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAyPrE;AAaD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAI5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAO3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE7D"}
|
|
@@ -2,33 +2,253 @@ import * as fs from 'fs';
|
|
|
2
2
|
import * as os from 'os';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
5
|
+
* Detects the user's default shell from environment.
|
|
6
|
+
*/
|
|
7
|
+
export function detectUserShell() {
|
|
8
|
+
const shell = process.env.SHELL || '';
|
|
9
|
+
if (shell.includes('zsh'))
|
|
10
|
+
return 'zsh';
|
|
11
|
+
return 'bash';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates a bash/zsh init script for tmux session initialization.
|
|
15
|
+
* Features: adaptive prompt, tmux status bar, useful aliases, welcome message.
|
|
7
16
|
*/
|
|
8
17
|
export function generateInitScript(options) {
|
|
9
|
-
const { sessionName, customEnvVars = {} } = options;
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
//
|
|
18
|
+
const { sessionName, projectName, customEnvVars = {}, shell = detectUserShell(), issuePlan, issueTitle, planningPrompt } = options;
|
|
19
|
+
const escapedSession = escapeForBash(sessionName);
|
|
20
|
+
const escapedProject = escapeForBash(projectName);
|
|
21
|
+
// Build custom env var exports
|
|
22
|
+
const customExports = [];
|
|
13
23
|
for (const [key, value] of Object.entries(customEnvVars)) {
|
|
14
24
|
if (value && value.trim() !== '') {
|
|
15
|
-
|
|
25
|
+
customExports.push(`export ${key}="${escapeForBash(value)}"`);
|
|
16
26
|
}
|
|
17
27
|
}
|
|
28
|
+
// Colors matching xterm theme (256-color codes)
|
|
29
|
+
const colors = {
|
|
30
|
+
orange: '208', // #f97316 - accent
|
|
31
|
+
green: '114', // #4ade80
|
|
32
|
+
cyan: '80', // #22d3ee
|
|
33
|
+
muted: '245', // #52525b
|
|
34
|
+
magenta: '141', // #c084fc - git branch
|
|
35
|
+
red: '203', // #f87171 - error
|
|
36
|
+
white: '255', // #e4e4e7
|
|
37
|
+
};
|
|
38
|
+
// tmux status bar config
|
|
39
|
+
const tmuxStatusConfig = `
|
|
40
|
+
# tmux status bar - minimal with project info
|
|
41
|
+
tmux set-option -t "${escapedSession}" status on 2>/dev/null
|
|
42
|
+
tmux set-option -t "${escapedSession}" status-position bottom 2>/dev/null
|
|
43
|
+
tmux set-option -t "${escapedSession}" status-interval 10 2>/dev/null
|
|
44
|
+
tmux set-option -t "${escapedSession}" status-style "bg=#1a1a2e,fg=#e4e4e7" 2>/dev/null
|
|
45
|
+
tmux set-option -t "${escapedSession}" status-left "#[fg=#f97316,bold] 247 #[fg=#52525b]|#[fg=#e4e4e7] ${escapedProject} " 2>/dev/null
|
|
46
|
+
tmux set-option -t "${escapedSession}" status-left-length 40 2>/dev/null
|
|
47
|
+
tmux set-option -t "${escapedSession}" status-right "#[fg=#52525b]|#[fg=#4ade80] %H:%M " 2>/dev/null
|
|
48
|
+
tmux set-option -t "${escapedSession}" status-right-length 20 2>/dev/null`;
|
|
49
|
+
// Prompt configuration - adapts to terminal width
|
|
50
|
+
// Note: $ doesn't need escaping in JS template literals except before {
|
|
51
|
+
const bashPromptConfig = `
|
|
52
|
+
# Adaptive prompt - compact on mobile, full on desktop
|
|
53
|
+
_247_prompt_command() {
|
|
54
|
+
local exit_code=$?
|
|
55
|
+
local cols=$(tput cols 2>/dev/null || echo 80)
|
|
56
|
+
|
|
57
|
+
# Exit code indicator (red X if failed)
|
|
58
|
+
local exit_ind=""
|
|
59
|
+
if [ $exit_code -ne 0 ]; then
|
|
60
|
+
exit_ind="\\[\\e[38;5;${colors.red}m\\]x \\[\\e[0m\\]"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Git branch (if in git repo)
|
|
64
|
+
local git_branch=""
|
|
65
|
+
if command -v git &>/dev/null; then
|
|
66
|
+
git_branch=$(git symbolic-ref --short HEAD 2>/dev/null)
|
|
67
|
+
if [ -n "$git_branch" ]; then
|
|
68
|
+
git_branch=" \\[\\e[38;5;${colors.magenta}m\\]($git_branch)\\[\\e[0m\\]"
|
|
69
|
+
fi
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Short path (last 2 components)
|
|
73
|
+
local short_path="\${PWD##*/}"
|
|
74
|
+
local parent="\${PWD%/*}"
|
|
75
|
+
parent="\${parent##*/}"
|
|
76
|
+
if [ "$parent" != "" ] && [ "$parent" != "$short_path" ]; then
|
|
77
|
+
short_path="$parent/$short_path"
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# Mobile (<60 cols): ultra-compact
|
|
81
|
+
# Desktop: full info with git branch
|
|
82
|
+
if [ "$cols" -lt 60 ]; then
|
|
83
|
+
PS1="\${exit_ind}\\[\\e[38;5;${colors.orange}m\\]$short_path\\[\\e[0m\\] \\[\\e[38;5;${colors.orange}m\\]>\\[\\e[0m\\] "
|
|
84
|
+
else
|
|
85
|
+
PS1="\${exit_ind}\\[\\e[38;5;${colors.muted}m\\][\\[\\e[38;5;${colors.green}m\\]$short_path\\[\\e[0m\\]\${git_branch}\\[\\e[38;5;${colors.muted}m\\]]\\[\\e[0m\\] \\[\\e[38;5;${colors.orange}m\\]>\\[\\e[0m\\] "
|
|
86
|
+
fi
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
PROMPT_COMMAND="_247_prompt_command"`;
|
|
90
|
+
const zshPromptConfig = `
|
|
91
|
+
# Adaptive prompt - compact on mobile, full on desktop
|
|
92
|
+
setopt PROMPT_SUBST
|
|
93
|
+
|
|
94
|
+
_247_precmd() {
|
|
95
|
+
local exit_code=$?
|
|
96
|
+
local cols=$COLUMNS
|
|
97
|
+
|
|
98
|
+
# Exit indicator
|
|
99
|
+
local exit_ind=""
|
|
100
|
+
if [[ $exit_code -ne 0 ]]; then
|
|
101
|
+
exit_ind="%F{${colors.red}}x %f"
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
# Git branch
|
|
105
|
+
local git_branch=""
|
|
106
|
+
if command -v git &>/dev/null; then
|
|
107
|
+
git_branch=$(git symbolic-ref --short HEAD 2>/dev/null)
|
|
108
|
+
[[ -n "$git_branch" ]] && git_branch=" %F{${colors.magenta}}($git_branch)%f"
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
# Mobile vs Desktop
|
|
112
|
+
if (( cols < 60 )); then
|
|
113
|
+
PROMPT="\${exit_ind}%F{${colors.orange}}%1~%f %F{${colors.orange}}>%f "
|
|
114
|
+
else
|
|
115
|
+
PROMPT="\${exit_ind}%F{${colors.muted}}[%F{${colors.green}}%2~%f\${git_branch}%F{${colors.muted}}]%f %F{${colors.orange}}>%f "
|
|
116
|
+
fi
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
precmd_functions+=(_247_precmd)`;
|
|
120
|
+
const historyConfig = shell === 'zsh'
|
|
121
|
+
? `
|
|
122
|
+
# History configuration (zsh)
|
|
123
|
+
HISTSIZE=50000
|
|
124
|
+
SAVEHIST=100000
|
|
125
|
+
setopt HIST_IGNORE_DUPS
|
|
126
|
+
setopt HIST_IGNORE_SPACE
|
|
127
|
+
setopt SHARE_HISTORY
|
|
128
|
+
setopt EXTENDED_HISTORY`
|
|
129
|
+
: `
|
|
130
|
+
# History configuration (bash)
|
|
131
|
+
export HISTSIZE=50000
|
|
132
|
+
export HISTFILESIZE=100000
|
|
133
|
+
export HISTCONTROL=ignoreboth:erasedups
|
|
134
|
+
export HISTIGNORE="ls:cd:pwd:exit:clear:history"
|
|
135
|
+
shopt -s histappend`;
|
|
136
|
+
const aliases = `
|
|
137
|
+
# 247 Aliases
|
|
138
|
+
alias c='claude'
|
|
139
|
+
alias cc='claude --continue'
|
|
140
|
+
alias cr='claude --resume'
|
|
141
|
+
|
|
142
|
+
# Git shortcuts
|
|
143
|
+
alias gs='git status'
|
|
144
|
+
alias gd='git diff'
|
|
145
|
+
alias gl='git log --oneline -15'
|
|
146
|
+
alias gco='git checkout'
|
|
147
|
+
|
|
148
|
+
# Navigation & dev
|
|
149
|
+
alias ll='ls -lah'
|
|
150
|
+
alias ..='cd ..'
|
|
151
|
+
alias ...='cd ../..'`;
|
|
152
|
+
// Issue plan injection - writes plan to .claude/current-task.md for Claude context
|
|
153
|
+
const escapedIssueTitle = issueTitle ? escapeForBash(issueTitle) : '';
|
|
154
|
+
const issuePlanSection = issuePlan ? `
|
|
155
|
+
# ═══════════════════════════════════════════════════════════════
|
|
156
|
+
# SECTION 6.5: Issue Plan Injection
|
|
157
|
+
# ═══════════════════════════════════════════════════════════════
|
|
158
|
+
mkdir -p .claude 2>/dev/null
|
|
159
|
+
cat > .claude/current-task.md << 'ISSUE_PLAN_EOF'
|
|
160
|
+
# Current Task
|
|
161
|
+
|
|
162
|
+
${issuePlan}
|
|
163
|
+
ISSUE_PLAN_EOF
|
|
164
|
+
echo -e "\\e[38;5;${colors.cyan}m[247] Issue plan written to .claude/current-task.md\\e[0m"
|
|
165
|
+
` : '';
|
|
166
|
+
const welcomeMessage = issueTitle ? `
|
|
167
|
+
# Welcome message (with issue)
|
|
168
|
+
echo ""
|
|
169
|
+
echo -e "\\e[38;5;${colors.muted}m─────────────────────────────────────────────\\e[0m"
|
|
170
|
+
echo -e "\\e[38;5;${colors.orange}m\\e[1m 247\\e[0m \\e[38;5;${colors.muted}m|\\e[0m \\e[38;5;${colors.green}m${escapedProject}\\e[0m"
|
|
171
|
+
echo -e "\\e[38;5;${colors.muted}m─────────────────────────────────────────────\\e[0m"
|
|
172
|
+
echo -e "\\e[38;5;${colors.muted}mSession:\\e[0m \\e[38;5;${colors.cyan}m${escapedSession}\\e[0m"
|
|
173
|
+
echo -e "\\e[38;5;${colors.muted}mTask: \\e[0m \\e[38;5;${colors.green}m${escapedIssueTitle}\\e[0m"
|
|
174
|
+
echo -e "\\e[38;5;${colors.muted}mTips: \\e[0m \\e[38;5;${colors.muted}mType\\e[0m c \\e[38;5;${colors.muted}mto start Claude Code\\e[0m"
|
|
175
|
+
echo -e "\\e[38;5;${colors.muted}m─────────────────────────────────────────────\\e[0m"
|
|
176
|
+
echo ""` : `
|
|
177
|
+
# Welcome message
|
|
178
|
+
echo ""
|
|
179
|
+
echo -e "\\e[38;5;${colors.muted}m─────────────────────────────────────────────\\e[0m"
|
|
180
|
+
echo -e "\\e[38;5;${colors.orange}m\\e[1m 247\\e[0m \\e[38;5;${colors.muted}m|\\e[0m \\e[38;5;${colors.green}m${escapedProject}\\e[0m"
|
|
181
|
+
echo -e "\\e[38;5;${colors.muted}m─────────────────────────────────────────────\\e[0m"
|
|
182
|
+
echo -e "\\e[38;5;${colors.muted}mSession:\\e[0m \\e[38;5;${colors.cyan}m${escapedSession}\\e[0m"
|
|
183
|
+
echo -e "\\e[38;5;${colors.muted}mTips: \\e[0m \\e[38;5;${colors.muted}mType\\e[0m c \\e[38;5;${colors.muted}mto start Claude Code\\e[0m"
|
|
184
|
+
echo -e "\\e[38;5;${colors.muted}m─────────────────────────────────────────────\\e[0m"
|
|
185
|
+
echo ""`;
|
|
186
|
+
const promptConfig = shell === 'zsh' ? zshPromptConfig : bashPromptConfig;
|
|
18
187
|
return `#!/bin/bash
|
|
19
188
|
# 247 Terminal Init Script - Auto-generated
|
|
20
189
|
# Session: ${sessionName}
|
|
190
|
+
# Project: ${projectName}
|
|
191
|
+
# Shell: ${shell}
|
|
21
192
|
# Generated: ${new Date().toISOString()}
|
|
22
193
|
|
|
23
|
-
#
|
|
24
|
-
|
|
194
|
+
# ═══════════════════════════════════════════════════════════════
|
|
195
|
+
# SECTION 1: Environment Variables
|
|
196
|
+
# ═══════════════════════════════════════════════════════════════
|
|
197
|
+
export CLAUDE_TMUX_SESSION="${escapedSession}"
|
|
198
|
+
export CLAUDE_PROJECT="${escapedProject}"
|
|
199
|
+
export TERM="xterm-256color"
|
|
200
|
+
export COLORTERM="truecolor"
|
|
201
|
+
export LANG="\${LANG:-en_US.UTF-8}"
|
|
202
|
+
export LC_ALL="\${LC_ALL:-en_US.UTF-8}"
|
|
203
|
+
${customExports.length > 0 ? customExports.join('\n') : ''}
|
|
204
|
+
|
|
205
|
+
# ═══════════════════════════════════════════════════════════════
|
|
206
|
+
# SECTION 2: tmux Configuration
|
|
207
|
+
# ═══════════════════════════════════════════════════════════════
|
|
208
|
+
tmux set-option -t "${escapedSession}" history-limit 50000 2>/dev/null
|
|
209
|
+
tmux set-option -t "${escapedSession}" mouse on 2>/dev/null
|
|
210
|
+
tmux set-option -t "${escapedSession}" focus-events on 2>/dev/null
|
|
211
|
+
${tmuxStatusConfig}
|
|
212
|
+
|
|
213
|
+
# ═══════════════════════════════════════════════════════════════
|
|
214
|
+
# SECTION 3: History Configuration
|
|
215
|
+
# ═══════════════════════════════════════════════════════════════
|
|
216
|
+
${historyConfig}
|
|
217
|
+
|
|
218
|
+
# ═══════════════════════════════════════════════════════════════
|
|
219
|
+
# SECTION 4: Prompt Configuration
|
|
220
|
+
# ═══════════════════════════════════════════════════════════════
|
|
221
|
+
${promptConfig}
|
|
222
|
+
|
|
223
|
+
# ═══════════════════════════════════════════════════════════════
|
|
224
|
+
# SECTION 5: Useful Aliases
|
|
225
|
+
# ═══════════════════════════════════════════════════════════════
|
|
226
|
+
${aliases}
|
|
227
|
+
${issuePlanSection}
|
|
228
|
+
# ═══════════════════════════════════════════════════════════════
|
|
229
|
+
# SECTION 6: Welcome Message
|
|
230
|
+
# ═══════════════════════════════════════════════════════════════
|
|
231
|
+
${welcomeMessage}
|
|
232
|
+
|
|
233
|
+
# ═══════════════════════════════════════════════════════════════
|
|
234
|
+
# SECTION 7: Start Session
|
|
235
|
+
# ═══════════════════════════════════════════════════════════════
|
|
236
|
+
${planningPrompt ? `
|
|
237
|
+
# Planning mode - write prompt to file and start Claude with it
|
|
238
|
+
PLANNING_PROMPT_FILE="/tmp/247-planning-${escapedSession}.md"
|
|
239
|
+
cat > "$PLANNING_PROMPT_FILE" << 'PLANNING_PROMPT_EOF'
|
|
240
|
+
${planningPrompt}
|
|
241
|
+
PLANNING_PROMPT_EOF
|
|
242
|
+
|
|
243
|
+
echo -e "\\e[38;5;${colors.cyan}m[247] Starting Claude with planning prompt...\\e[0m"
|
|
244
|
+
echo ""
|
|
25
245
|
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
tmux set-option -t "${escapeForBash(sessionName)}" mouse on 2>/dev/null
|
|
246
|
+
# Start Claude with the planning prompt content (passed as initial message)
|
|
247
|
+
claude "$(cat $PLANNING_PROMPT_FILE)"
|
|
29
248
|
|
|
30
|
-
#
|
|
31
|
-
exec
|
|
249
|
+
# After Claude exits, start interactive shell
|
|
250
|
+
exec ${shell} -i
|
|
251
|
+
` : `exec ${shell} -i`}
|
|
32
252
|
`;
|
|
33
253
|
}
|
|
34
254
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-script.js","sourceRoot":"","sources":["../../src/lib/init-script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"init-script.js","sourceRoot":"","sources":["../../src/lib/init-script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAe7B;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA0B;IAC3D,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,GAAG,EAAE,EAAE,KAAK,G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AC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,OAAe;IAClE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,YAAY,WAAW,KAAK,CAAC,CAAC;IACxE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,YAAY,WAAW,KAAK,CAAC,CAAC;IACxE,IAAI,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,gDAAgD;IAClD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,YAAY,WAAW,KAAK,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a planning prompt for Claude to help plan a project.
|
|
3
|
+
* This prompt instructs Claude on how to investigate the codebase,
|
|
4
|
+
* ask questions, and create issues via the API.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generatePlanningPrompt(projectId: string, projectName: string, description: string | null, agentUrl: string): string;
|
|
7
|
+
//# sourceMappingURL=planning-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning-prompt.d.ts","sourceRoot":"","sources":["../../src/lib/planning-prompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,QAAQ,EAAE,MAAM,GACf,MAAM,CA4CR"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a planning prompt for Claude to help plan a project.
|
|
3
|
+
* This prompt instructs Claude on how to investigate the codebase,
|
|
4
|
+
* ask questions, and create issues via the API.
|
|
5
|
+
*/
|
|
6
|
+
export function generatePlanningPrompt(projectId, projectName, description, agentUrl) {
|
|
7
|
+
return `You are a project planning assistant helping to plan: "${projectName}"
|
|
8
|
+
|
|
9
|
+
${description ? `## Description\n${description}\n` : ''}
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
1. **Investigate the codebase** - Understand the project structure, technologies, and patterns
|
|
13
|
+
2. **Ask clarifying questions** - If anything is unclear about what the user wants
|
|
14
|
+
3. **Create a plan** - Break down the work into concrete issues
|
|
15
|
+
|
|
16
|
+
## Creating Issues
|
|
17
|
+
|
|
18
|
+
When ready to create issues, use this command:
|
|
19
|
+
|
|
20
|
+
\`\`\`bash
|
|
21
|
+
curl -X POST ${agentUrl}/api/managed-projects/${projectId}/issues/batch \\
|
|
22
|
+
-H "Content-Type: application/json" \\
|
|
23
|
+
-d '{
|
|
24
|
+
"issues": [
|
|
25
|
+
{
|
|
26
|
+
"title": "Issue title",
|
|
27
|
+
"description": "Detailed description",
|
|
28
|
+
"priority": 2,
|
|
29
|
+
"plan": "Step 1: ...\\nStep 2: ..."
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}'
|
|
33
|
+
\`\`\`
|
|
34
|
+
|
|
35
|
+
Priority levels: 0=none, 1=low, 2=medium, 3=high, 4=urgent
|
|
36
|
+
|
|
37
|
+
## After Creating Issues
|
|
38
|
+
|
|
39
|
+
Update the project status to active:
|
|
40
|
+
|
|
41
|
+
\`\`\`bash
|
|
42
|
+
curl -X PATCH ${agentUrl}/api/managed-projects/${projectId}/status \\
|
|
43
|
+
-H "Content-Type: application/json" \\
|
|
44
|
+
-d '{"status": "active"}'
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
Start by exploring the codebase to understand its structure, then discuss the plan with the user.`;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=planning-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning-prompt.js","sourceRoot":"","sources":["../../src/lib/planning-prompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,WAAmB,EACnB,WAA0B,EAC1B,QAAgB;IAEhB,OAAO,0DAA0D,WAAW;;EAE5E,WAAW,CAAC,CAAC,CAAC,mBAAmB,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;eAYxC,QAAQ,yBAAyB,SAAS;;;;;;;;;;;;;;;;;;;;;gBAqBzC,QAAQ,yBAAyB,SAAS;;;;;;;kGAOwC,CAAC;AACnG,CAAC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Route aggregation - exports all route creators.
|
|
3
3
|
*/
|
|
4
4
|
export { createProjectRoutes } from './projects.js';
|
|
5
|
+
export { createManagedProjectRoutes } from './managed-projects.js';
|
|
6
|
+
export { createIssueRoutes } from './issues.js';
|
|
5
7
|
export { createEnvironmentRoutes } from './environments.js';
|
|
6
8
|
export { createSessionRoutes } from './sessions.js';
|
|
7
9
|
export { createHeartbeatRoutes } from './heartbeat.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Route aggregation - exports all route creators.
|
|
3
3
|
*/
|
|
4
4
|
export { createProjectRoutes } from './projects.js';
|
|
5
|
+
export { createManagedProjectRoutes } from './managed-projects.js';
|
|
6
|
+
export { createIssueRoutes } from './issues.js';
|
|
5
7
|
export { createEnvironmentRoutes } from './environments.js';
|
|
6
8
|
export { createSessionRoutes } from './sessions.js';
|
|
7
9
|
export { createHeartbeatRoutes } from './heartbeat.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/routes/issues.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAqBjC,wBAAgB,iBAAiB,IAAI,MAAM,CA4Q1C"}
|