@phuetz/code-buddy 0.1.25 → 0.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/README.md +1049 -741
- package/dist/agent/codebuddy-agent.d.ts +5 -0
- package/dist/agent/codebuddy-agent.js +46 -1
- package/dist/agent/codebuddy-agent.js.map +1 -1
- package/dist/agent/execution/agent-executor.d.ts +12 -0
- package/dist/agent/execution/agent-executor.js +147 -6
- package/dist/agent/execution/agent-executor.js.map +1 -1
- package/dist/agent/lessons-tracker.d.ts +50 -0
- package/dist/agent/lessons-tracker.js +234 -0
- package/dist/agent/lessons-tracker.js.map +1 -0
- package/dist/agent/message-queue.d.ts +39 -2
- package/dist/agent/message-queue.js +67 -2
- package/dist/agent/message-queue.js.map +1 -1
- package/dist/agent/middleware/index.d.ts +1 -0
- package/dist/agent/middleware/index.js +1 -0
- package/dist/agent/middleware/index.js.map +1 -1
- package/dist/agent/middleware/workflow-guard.d.ts +21 -0
- package/dist/agent/middleware/workflow-guard.js +94 -0
- package/dist/agent/middleware/workflow-guard.js.map +1 -0
- package/dist/agent/orchestrator/supervisor-agent.d.ts +9 -0
- package/dist/agent/orchestrator/supervisor-agent.js +21 -1
- package/dist/agent/orchestrator/supervisor-agent.js.map +1 -1
- package/dist/agent/repo-profiler.d.ts +61 -0
- package/dist/agent/repo-profiler.js +295 -0
- package/dist/agent/repo-profiler.js.map +1 -0
- package/dist/agent/response-constraint.d.ts +61 -0
- package/dist/agent/response-constraint.js +91 -0
- package/dist/agent/response-constraint.js.map +1 -0
- package/dist/agent/todo-tracker.d.ts +67 -0
- package/dist/agent/todo-tracker.js +245 -0
- package/dist/agent/todo-tracker.js.map +1 -0
- package/dist/agent/tool-handler.d.ts +11 -0
- package/dist/agent/tool-handler.js +79 -1
- package/dist/agent/tool-handler.js.map +1 -1
- package/dist/agent/types.d.ts +20 -2
- package/dist/agent/wide-research.d.ts +93 -0
- package/dist/agent/wide-research.js +232 -0
- package/dist/agent/wide-research.js.map +1 -0
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.js +2 -0
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/pro/callback-router.d.ts +54 -0
- package/dist/channels/pro/callback-router.js +178 -0
- package/dist/channels/pro/callback-router.js.map +1 -0
- package/dist/channels/pro/ci-watcher.d.ts +86 -0
- package/dist/channels/pro/ci-watcher.js +343 -0
- package/dist/channels/pro/ci-watcher.js.map +1 -0
- package/dist/channels/pro/diff-first.d.ts +63 -0
- package/dist/channels/pro/diff-first.js +187 -0
- package/dist/channels/pro/diff-first.js.map +1 -0
- package/dist/channels/pro/enhanced-commands.d.ts +83 -0
- package/dist/channels/pro/enhanced-commands.js +218 -0
- package/dist/channels/pro/enhanced-commands.js.map +1 -0
- package/dist/channels/pro/index.d.ts +19 -0
- package/dist/channels/pro/index.js +21 -0
- package/dist/channels/pro/index.js.map +1 -0
- package/dist/channels/pro/pro-features.d.ts +79 -0
- package/dist/channels/pro/pro-features.js +203 -0
- package/dist/channels/pro/pro-features.js.map +1 -0
- package/dist/channels/pro/run-commands.d.ts +59 -0
- package/dist/channels/pro/run-commands.js +122 -0
- package/dist/channels/pro/run-commands.js.map +1 -0
- package/dist/channels/pro/run-tracker.d.ts +74 -0
- package/dist/channels/pro/run-tracker.js +252 -0
- package/dist/channels/pro/run-tracker.js.map +1 -0
- package/dist/channels/pro/scoped-auth.d.ts +97 -0
- package/dist/channels/pro/scoped-auth.js +340 -0
- package/dist/channels/pro/scoped-auth.js.map +1 -0
- package/dist/channels/pro/text-formatter.d.ts +27 -0
- package/dist/channels/pro/text-formatter.js +269 -0
- package/dist/channels/pro/text-formatter.js.map +1 -0
- package/dist/channels/pro/types.d.ts +242 -0
- package/dist/channels/pro/types.js +14 -0
- package/dist/channels/pro/types.js.map +1 -0
- package/dist/channels/streaming-policy.d.ts +66 -0
- package/dist/channels/streaming-policy.js +266 -0
- package/dist/channels/streaming-policy.js.map +1 -0
- package/dist/channels/telegram/ci-watcher.d.ts +5 -0
- package/dist/channels/telegram/ci-watcher.js +5 -0
- package/dist/channels/telegram/ci-watcher.js.map +1 -0
- package/dist/channels/telegram/client.d.ts +28 -0
- package/dist/channels/telegram/client.js +147 -1
- package/dist/channels/telegram/client.js.map +1 -1
- package/dist/channels/telegram/diff-first.d.ts +5 -0
- package/dist/channels/telegram/diff-first.js +5 -0
- package/dist/channels/telegram/diff-first.js.map +1 -0
- package/dist/channels/telegram/enhanced-commands.d.ts +6 -0
- package/dist/channels/telegram/enhanced-commands.js +6 -0
- package/dist/channels/telegram/enhanced-commands.js.map +1 -0
- package/dist/channels/telegram/index.d.ts +6 -0
- package/dist/channels/telegram/index.js +6 -0
- package/dist/channels/telegram/index.js.map +1 -1
- package/dist/channels/telegram/pro-formatter.d.ts +30 -0
- package/dist/channels/telegram/pro-formatter.js +276 -0
- package/dist/channels/telegram/pro-formatter.js.map +1 -0
- package/dist/channels/telegram/run-commands.d.ts +5 -0
- package/dist/channels/telegram/run-commands.js +6 -0
- package/dist/channels/telegram/run-commands.js.map +1 -0
- package/dist/channels/telegram/run-tracker.d.ts +5 -0
- package/dist/channels/telegram/run-tracker.js +5 -0
- package/dist/channels/telegram/run-tracker.js.map +1 -0
- package/dist/channels/telegram/scoped-auth.d.ts +6 -0
- package/dist/channels/telegram/scoped-auth.js +5 -0
- package/dist/channels/telegram/scoped-auth.js.map +1 -0
- package/dist/channels/telegram/types.d.ts +34 -0
- package/dist/codebuddy/client.js +14 -1
- package/dist/codebuddy/client.js.map +1 -1
- package/dist/commands/dev/index.d.ts +12 -0
- package/dist/commands/dev/index.js +231 -0
- package/dist/commands/dev/index.js.map +1 -0
- package/dist/commands/dev/workflows.d.ts +31 -0
- package/dist/commands/dev/workflows.js +214 -0
- package/dist/commands/dev/workflows.js.map +1 -0
- package/dist/commands/execpolicy.d.ts +17 -0
- package/dist/commands/execpolicy.js +155 -0
- package/dist/commands/execpolicy.js.map +1 -0
- package/dist/commands/knowledge.d.ts +13 -0
- package/dist/commands/knowledge.js +142 -0
- package/dist/commands/knowledge.js.map +1 -0
- package/dist/commands/lessons.d.ts +11 -0
- package/dist/commands/lessons.js +129 -0
- package/dist/commands/lessons.js.map +1 -0
- package/dist/commands/pairing.d.ts +14 -0
- package/dist/commands/pairing.js +132 -0
- package/dist/commands/pairing.js.map +1 -0
- package/dist/commands/research/index.d.ts +13 -0
- package/dist/commands/research/index.js +91 -0
- package/dist/commands/research/index.js.map +1 -0
- package/dist/commands/run-cli/index.d.ts +11 -0
- package/dist/commands/run-cli/index.js +49 -0
- package/dist/commands/run-cli/index.js.map +1 -0
- package/dist/commands/slash/builtin-commands.js +70 -2
- package/dist/commands/slash/builtin-commands.js.map +1 -1
- package/dist/commands/todos.d.ts +9 -0
- package/dist/commands/todos.js +119 -0
- package/dist/commands/todos.js.map +1 -0
- package/dist/config/toml-config.d.ts +21 -0
- package/dist/config/toml-config.js +15 -0
- package/dist/config/toml-config.js.map +1 -1
- package/dist/context/enhanced-compression.js +12 -1
- package/dist/context/enhanced-compression.js.map +1 -1
- package/dist/context/observation-variator.d.ts +44 -0
- package/dist/context/observation-variator.js +83 -0
- package/dist/context/observation-variator.js.map +1 -0
- package/dist/context/precompaction-flush.d.ts +40 -0
- package/dist/context/precompaction-flush.js +134 -0
- package/dist/context/precompaction-flush.js.map +1 -0
- package/dist/context/restorable-compression.d.ts +80 -0
- package/dist/context/restorable-compression.js +228 -0
- package/dist/context/restorable-compression.js.map +1 -0
- package/dist/daemon/daily-reset.d.ts +77 -0
- package/dist/daemon/daily-reset.js +175 -0
- package/dist/daemon/daily-reset.js.map +1 -0
- package/dist/daemon/index.d.ts +1 -0
- package/dist/daemon/index.js +1 -0
- package/dist/daemon/index.js.map +1 -1
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -1
- package/dist/knowledge/knowledge-manager.d.ts +77 -0
- package/dist/knowledge/knowledge-manager.js +244 -0
- package/dist/knowledge/knowledge-manager.js.map +1 -0
- package/dist/memory/semantic-memory-search.d.ts +7 -0
- package/dist/memory/semantic-memory-search.js +49 -5
- package/dist/memory/semantic-memory-search.js.map +1 -1
- package/dist/observability/run-store.d.ts +133 -0
- package/dist/observability/run-store.js +419 -0
- package/dist/observability/run-store.js.map +1 -0
- package/dist/observability/run-viewer.d.ts +33 -0
- package/dist/observability/run-viewer.js +254 -0
- package/dist/observability/run-viewer.js.map +1 -0
- package/dist/optimization/cache-breakpoints.d.ts +52 -0
- package/dist/optimization/cache-breakpoints.js +97 -0
- package/dist/optimization/cache-breakpoints.js.map +1 -0
- package/dist/persistence/session-store.d.ts +3 -1
- package/dist/persistence/session-store.js +1 -1
- package/dist/persistence/session-store.js.map +1 -1
- package/dist/prompts/system-base.js +51 -7
- package/dist/prompts/system-base.js.map +1 -1
- package/dist/prompts/variation-injector.d.ts +55 -0
- package/dist/prompts/variation-injector.js +171 -0
- package/dist/prompts/variation-injector.js.map +1 -0
- package/dist/prompts/workflow-rules.d.ts +10 -0
- package/dist/prompts/workflow-rules.js +79 -0
- package/dist/prompts/workflow-rules.js.map +1 -0
- package/dist/sandbox/execpolicy.d.ts +45 -0
- package/dist/sandbox/execpolicy.js +80 -0
- package/dist/sandbox/execpolicy.js.map +1 -1
- package/dist/sandbox/os-sandbox.d.ts +25 -0
- package/dist/sandbox/os-sandbox.js +73 -0
- package/dist/sandbox/os-sandbox.js.map +1 -1
- package/dist/scheduler/cron-scheduler.d.ts +9 -0
- package/dist/scheduler/cron-scheduler.js +17 -1
- package/dist/scheduler/cron-scheduler.js.map +1 -1
- package/dist/security/security-audit.d.ts +10 -0
- package/dist/security/security-audit.js +116 -0
- package/dist/security/security-audit.js.map +1 -1
- package/dist/security/shell-env-policy.d.ts +45 -0
- package/dist/security/shell-env-policy.js +141 -0
- package/dist/security/shell-env-policy.js.map +1 -0
- package/dist/security/ssrf-guard.d.ts +61 -0
- package/dist/security/ssrf-guard.js +382 -0
- package/dist/security/ssrf-guard.js.map +1 -0
- package/dist/security/write-policy.d.ts +57 -0
- package/dist/security/write-policy.js +117 -0
- package/dist/security/write-policy.js.map +1 -0
- package/dist/services/prompt-builder.js +37 -0
- package/dist/services/prompt-builder.js.map +1 -1
- package/dist/themes/theme-schema.d.ts +10 -10
- package/dist/tools/ask-human-tool.d.ts +62 -0
- package/dist/tools/ask-human-tool.js +112 -0
- package/dist/tools/ask-human-tool.js.map +1 -0
- package/dist/tools/bash/bash-tool.d.ts +15 -0
- package/dist/tools/bash/bash-tool.js +62 -0
- package/dist/tools/bash/bash-tool.js.map +1 -1
- package/dist/tools/bash/command-validator.d.ts +1 -0
- package/dist/tools/bash/command-validator.js +5 -0
- package/dist/tools/bash/command-validator.js.map +1 -1
- package/dist/tools/create-skill-tool.d.ts +87 -0
- package/dist/tools/create-skill-tool.js +142 -0
- package/dist/tools/create-skill-tool.js.map +1 -0
- package/dist/tools/fetch-tool.js +5 -3
- package/dist/tools/fetch-tool.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/plan-tool.d.ts +22 -0
- package/dist/tools/plan-tool.js +128 -0
- package/dist/tools/plan-tool.js.map +1 -0
- package/dist/tools/registry/attention-tools.d.ts +32 -0
- package/dist/tools/registry/attention-tools.js +225 -0
- package/dist/tools/registry/attention-tools.js.map +1 -0
- package/dist/tools/registry/index.d.ts +9 -1
- package/dist/tools/registry/index.js +30 -2
- package/dist/tools/registry/index.js.map +1 -1
- package/dist/tools/registry/knowledge-tools.d.ts +46 -0
- package/dist/tools/registry/knowledge-tools.js +293 -0
- package/dist/tools/registry/knowledge-tools.js.map +1 -0
- package/dist/tools/registry/lessons-tools.d.ts +48 -0
- package/dist/tools/registry/lessons-tools.js +359 -0
- package/dist/tools/registry/lessons-tools.js.map +1 -0
- package/dist/tools/registry/plan-tools.d.ts +2 -0
- package/dist/tools/registry/plan-tools.js +7 -0
- package/dist/tools/registry/plan-tools.js.map +1 -0
- package/dist/tools/registry/script-tools.d.ts +2 -0
- package/dist/tools/registry/script-tools.js +7 -0
- package/dist/tools/registry/script-tools.js.map +1 -0
- package/dist/tools/registry/tool-aliases.d.ts +44 -0
- package/dist/tools/registry/tool-aliases.js +130 -0
- package/dist/tools/registry/tool-aliases.js.map +1 -0
- package/dist/tools/run-script-tool.d.ts +13 -0
- package/dist/tools/run-script-tool.js +146 -0
- package/dist/tools/run-script-tool.js.map +1 -0
- package/dist/tools/web-search.d.ts +25 -0
- package/dist/tools/web-search.js +68 -6
- package/dist/tools/web-search.js.map +1 -1
- package/dist/utils/config-validation/schema.d.ts +2 -2
- package/dist/utils/debug-logger.d.ts +1 -1
- package/dist/utils/stable-json.d.ts +27 -0
- package/dist/utils/stable-json.js +50 -0
- package/dist/utils/stable-json.js.map +1 -0
- package/dist/webhooks/webhook-manager.d.ts +7 -0
- package/dist/webhooks/webhook-manager.js +29 -0
- package/dist/webhooks/webhook-manager.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Commands
|
|
3
|
+
*
|
|
4
|
+
* Rich slash commands for repo info, branch, PR, tasks, YOLO mode,
|
|
5
|
+
* and context pinning. Channel-agnostic - returns structured data
|
|
6
|
+
* for formatters to render.
|
|
7
|
+
*/
|
|
8
|
+
import type { ScopedAuthManager } from './scoped-auth.js';
|
|
9
|
+
import type { ContextPin, RepoInfo, BranchInfo, PRInfo, PRSummary } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Handles enhanced slash commands. Returns structured data;
|
|
12
|
+
* formatting is delegated to ChannelProFormatter.
|
|
13
|
+
*/
|
|
14
|
+
export declare class EnhancedCommands {
|
|
15
|
+
private authManager?;
|
|
16
|
+
private pins;
|
|
17
|
+
private yoloTimers;
|
|
18
|
+
constructor(authManager?: ScopedAuthManager | undefined);
|
|
19
|
+
/**
|
|
20
|
+
* Handle /repo command - returns structured data
|
|
21
|
+
*/
|
|
22
|
+
handleRepo(_chatId: string, _repoName?: string): {
|
|
23
|
+
success: true;
|
|
24
|
+
data: RepoInfo;
|
|
25
|
+
} | {
|
|
26
|
+
success: false;
|
|
27
|
+
error: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Handle /branch command - returns structured data
|
|
31
|
+
*/
|
|
32
|
+
handleBranch(_chatId: string, branchName?: string): {
|
|
33
|
+
success: true;
|
|
34
|
+
data: BranchInfo;
|
|
35
|
+
} | {
|
|
36
|
+
success: false;
|
|
37
|
+
error: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Handle /pr command - returns structured data
|
|
41
|
+
*/
|
|
42
|
+
handlePR(_chatId: string, prNumber?: string): {
|
|
43
|
+
success: true;
|
|
44
|
+
data: PRInfo;
|
|
45
|
+
} | {
|
|
46
|
+
success: true;
|
|
47
|
+
list: PRSummary[];
|
|
48
|
+
} | {
|
|
49
|
+
success: false;
|
|
50
|
+
error: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Handle /task command - create an agent task
|
|
54
|
+
*/
|
|
55
|
+
handleTask(_chatId: string, _userId: string, description: string): {
|
|
56
|
+
text: string;
|
|
57
|
+
objective: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Handle /yolo command - timed full access
|
|
61
|
+
*/
|
|
62
|
+
handleYolo(_chatId: string, userId: string, minutesStr?: string): {
|
|
63
|
+
text: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Pin context for future reference
|
|
67
|
+
*/
|
|
68
|
+
handlePinContext(chatId: string, userId: string, content: string, tags?: string[]): ContextPin;
|
|
69
|
+
/**
|
|
70
|
+
* Get pins for a chat
|
|
71
|
+
*/
|
|
72
|
+
getPins(chatId: string): ContextPin[];
|
|
73
|
+
/**
|
|
74
|
+
* Remove a pin
|
|
75
|
+
*/
|
|
76
|
+
removePin(pinId: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Clean up timers
|
|
79
|
+
*/
|
|
80
|
+
destroy(): void;
|
|
81
|
+
private execGit;
|
|
82
|
+
private getMainBranch;
|
|
83
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Commands
|
|
3
|
+
*
|
|
4
|
+
* Rich slash commands for repo info, branch, PR, tasks, YOLO mode,
|
|
5
|
+
* and context pinning. Channel-agnostic - returns structured data
|
|
6
|
+
* for formatters to render.
|
|
7
|
+
*/
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
/**
|
|
10
|
+
* Handles enhanced slash commands. Returns structured data;
|
|
11
|
+
* formatting is delegated to ChannelProFormatter.
|
|
12
|
+
*/
|
|
13
|
+
export class EnhancedCommands {
|
|
14
|
+
authManager;
|
|
15
|
+
pins = new Map();
|
|
16
|
+
yoloTimers = new Map();
|
|
17
|
+
constructor(authManager) {
|
|
18
|
+
this.authManager = authManager;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Handle /repo command - returns structured data
|
|
22
|
+
*/
|
|
23
|
+
handleRepo(_chatId, _repoName) {
|
|
24
|
+
try {
|
|
25
|
+
const cwd = process.cwd();
|
|
26
|
+
const remote = this.execGit('git remote get-url origin', cwd);
|
|
27
|
+
const branch = this.execGit('git branch --show-current', cwd);
|
|
28
|
+
const commitCount = this.execGit('git rev-list --count HEAD', cwd);
|
|
29
|
+
const lastCommit = this.execGit('git log -1 --format="%h %s"', cwd);
|
|
30
|
+
const recentCommits = this.execGit('git log -5 --format="%h %s (%ar)"', cwd);
|
|
31
|
+
let openPRs;
|
|
32
|
+
try {
|
|
33
|
+
const prCount = this.execGit('gh pr list --state open --json number | wc -l', cwd);
|
|
34
|
+
if (prCount) {
|
|
35
|
+
openPRs = prCount.trim();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// gh not available
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
success: true,
|
|
43
|
+
data: { remote, branch, commitCount, lastCommit, recentCommits, openPRs },
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
error: `Failed to get repo info: ${error instanceof Error ? error.message : String(error)}`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Handle /branch command - returns structured data
|
|
55
|
+
*/
|
|
56
|
+
handleBranch(_chatId, branchName) {
|
|
57
|
+
try {
|
|
58
|
+
const cwd = process.cwd();
|
|
59
|
+
const branch = branchName || this.execGit('git branch --show-current', cwd);
|
|
60
|
+
const mainBranch = this.getMainBranch(cwd);
|
|
61
|
+
let diffStat;
|
|
62
|
+
let commitsAhead = '0';
|
|
63
|
+
let commitsBehind = '0';
|
|
64
|
+
try {
|
|
65
|
+
diffStat = this.execGit(`git diff ${mainBranch}...${branch} --stat`, cwd);
|
|
66
|
+
commitsBehind = this.execGit(`git rev-list --count ${branch}..${mainBranch}`, cwd).trim();
|
|
67
|
+
commitsAhead = this.execGit(`git rev-list --count ${mainBranch}..${branch}`, cwd).trim();
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Could not compare with main branch
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
data: { branch, mainBranch, diffStat, commitsAhead, commitsBehind },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
error: `Failed to get branch info: ${error instanceof Error ? error.message : String(error)}`,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Handle /pr command - returns structured data
|
|
86
|
+
*/
|
|
87
|
+
handlePR(_chatId, prNumber) {
|
|
88
|
+
try {
|
|
89
|
+
const cwd = process.cwd();
|
|
90
|
+
if (prNumber) {
|
|
91
|
+
const prJson = this.execGit(`gh pr view ${prNumber} --json title,state,author,body,url,additions,deletions,changedFiles`, cwd);
|
|
92
|
+
const pr = JSON.parse(prJson);
|
|
93
|
+
return {
|
|
94
|
+
success: true,
|
|
95
|
+
data: {
|
|
96
|
+
number: prNumber,
|
|
97
|
+
title: pr.title,
|
|
98
|
+
state: pr.state,
|
|
99
|
+
author: pr.author?.login || 'unknown',
|
|
100
|
+
additions: pr.additions,
|
|
101
|
+
deletions: pr.deletions,
|
|
102
|
+
changedFiles: pr.changedFiles,
|
|
103
|
+
body: pr.body || '(no description)',
|
|
104
|
+
url: pr.url,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const prsJson = this.execGit('gh pr list --state open --json number,title,author --limit 10', cwd);
|
|
109
|
+
const prs = JSON.parse(prsJson);
|
|
110
|
+
return {
|
|
111
|
+
success: true,
|
|
112
|
+
list: prs.map((pr) => ({
|
|
113
|
+
number: pr.number,
|
|
114
|
+
title: pr.title,
|
|
115
|
+
author: pr.author?.login || 'unknown',
|
|
116
|
+
})),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return {
|
|
121
|
+
success: false,
|
|
122
|
+
error: `Failed to get PR info: ${error instanceof Error ? error.message : String(error)}`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Handle /task command - create an agent task
|
|
128
|
+
*/
|
|
129
|
+
handleTask(_chatId, _userId, description) {
|
|
130
|
+
return {
|
|
131
|
+
text: `Task created: ${description}`,
|
|
132
|
+
objective: description,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Handle /yolo command - timed full access
|
|
137
|
+
*/
|
|
138
|
+
handleYolo(_chatId, userId, minutesStr) {
|
|
139
|
+
if (!this.authManager) {
|
|
140
|
+
return { text: 'Auth manager not configured.' };
|
|
141
|
+
}
|
|
142
|
+
const minutes = parseInt(minutesStr || '10', 10);
|
|
143
|
+
if (isNaN(minutes) || minutes < 1 || minutes > 60) {
|
|
144
|
+
return { text: 'YOLO duration must be 1-60 minutes.' };
|
|
145
|
+
}
|
|
146
|
+
const durationMs = minutes * 60 * 1000;
|
|
147
|
+
const existingTimer = this.yoloTimers.get(userId);
|
|
148
|
+
if (existingTimer) {
|
|
149
|
+
clearTimeout(existingTimer);
|
|
150
|
+
}
|
|
151
|
+
this.authManager.grantTemporaryFullAccess(userId, durationMs, userId);
|
|
152
|
+
const timer = setTimeout(() => {
|
|
153
|
+
this.authManager?.revokeTemporaryAccess(userId);
|
|
154
|
+
this.yoloTimers.delete(userId);
|
|
155
|
+
}, durationMs);
|
|
156
|
+
this.yoloTimers.set(userId, timer);
|
|
157
|
+
return {
|
|
158
|
+
text: `YOLO mode activated for ${minutes} minutes. Full access granted. Auto-revokes at ${new Date(Date.now() + durationMs).toLocaleTimeString()}.`,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Pin context for future reference
|
|
163
|
+
*/
|
|
164
|
+
handlePinContext(chatId, userId, content, tags) {
|
|
165
|
+
const pin = {
|
|
166
|
+
id: `pin_${Date.now().toString(36)}`,
|
|
167
|
+
content,
|
|
168
|
+
pinnedBy: userId,
|
|
169
|
+
chatId,
|
|
170
|
+
timestamp: Date.now(),
|
|
171
|
+
tags: tags || [],
|
|
172
|
+
};
|
|
173
|
+
this.pins.set(pin.id, pin);
|
|
174
|
+
return pin;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get pins for a chat
|
|
178
|
+
*/
|
|
179
|
+
getPins(chatId) {
|
|
180
|
+
return Array.from(this.pins.values())
|
|
181
|
+
.filter((p) => p.chatId === chatId)
|
|
182
|
+
.sort((a, b) => b.timestamp - a.timestamp);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Remove a pin
|
|
186
|
+
*/
|
|
187
|
+
removePin(pinId) {
|
|
188
|
+
return this.pins.delete(pinId);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Clean up timers
|
|
192
|
+
*/
|
|
193
|
+
destroy() {
|
|
194
|
+
for (const timer of this.yoloTimers.values()) {
|
|
195
|
+
clearTimeout(timer);
|
|
196
|
+
}
|
|
197
|
+
this.yoloTimers.clear();
|
|
198
|
+
}
|
|
199
|
+
execGit(cmd, cwd) {
|
|
200
|
+
return execSync(cmd, { cwd, encoding: 'utf-8', timeout: 10000 }).trim();
|
|
201
|
+
}
|
|
202
|
+
getMainBranch(cwd) {
|
|
203
|
+
try {
|
|
204
|
+
this.execGit('git rev-parse --verify main', cwd);
|
|
205
|
+
return 'main';
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
try {
|
|
209
|
+
this.execGit('git rev-parse --verify master', cwd);
|
|
210
|
+
return 'master';
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return 'main';
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=enhanced-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-commands.js","sourceRoot":"","sources":["../../../src/channels/pro/enhanced-commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAIP;IAHZ,IAAI,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC1C,UAAU,GAAgC,IAAI,GAAG,EAAE,CAAC;IAE5D,YAAoB,WAA+B;QAA/B,gBAAW,GAAX,WAAW,CAAoB;IAAG,CAAC;IAEvD;;OAEG;IACH,UAAU,CACR,OAAe,EACf,SAAkB;QAElB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAE1B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;YAC9D,MAAM,MAAM,GAAG,IAAI,C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IAAI,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;YACjD,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC;gBACH,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;gBACnD,OAAO,QAAQ,CAAC;YAClB,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pro Features Module
|
|
3
|
+
*
|
|
4
|
+
* Channel-agnostic pro features that any channel adapter can use.
|
|
5
|
+
* Barrel re-exports for all pro modules.
|
|
6
|
+
*/
|
|
7
|
+
export type { AuthScope, AuthDecision, ScopedPermission, SecretHandle, PendingConfirm, TemporaryAccess, ScopeCheckContext, DiffFirstConfig, FileDiffSummary, PendingDiff, ApplyResult, RunStatus, RunStep, RunArtifact, RunRecord, CIAlertType, CIProviderType, CIProvider, CIWatchConfig, CIEvent, ContextPin, RepoInfo, BranchInfo, PRInfo, PRSummary, MessageButton, ProFormattedMessage, CommandEntry, ChannelProFormatter, } from './types.js';
|
|
8
|
+
export { SCOPE_LEVEL } from './types.js';
|
|
9
|
+
export { ScopedAuthManager } from './scoped-auth.js';
|
|
10
|
+
export { DiffFirstManager } from './diff-first.js';
|
|
11
|
+
export { RunTracker } from './run-tracker.js';
|
|
12
|
+
export { RunCommands } from './run-commands.js';
|
|
13
|
+
export { EnhancedCommands } from './enhanced-commands.js';
|
|
14
|
+
export { CIWatcher } from './ci-watcher.js';
|
|
15
|
+
export { TextProFormatter } from './text-formatter.js';
|
|
16
|
+
export { ProCallbackRouter, parseCallbackData } from './callback-router.js';
|
|
17
|
+
export type { ParsedCallback, SendFn, EmitTaskFn } from './callback-router.js';
|
|
18
|
+
export { ProFeatures } from './pro-features.js';
|
|
19
|
+
export type { ProFeaturesConfig } from './pro-features.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pro Features Module
|
|
3
|
+
*
|
|
4
|
+
* Channel-agnostic pro features that any channel adapter can use.
|
|
5
|
+
* Barrel re-exports for all pro modules.
|
|
6
|
+
*/
|
|
7
|
+
export { SCOPE_LEVEL } from './types.js';
|
|
8
|
+
// Core managers
|
|
9
|
+
export { ScopedAuthManager } from './scoped-auth.js';
|
|
10
|
+
export { DiffFirstManager } from './diff-first.js';
|
|
11
|
+
export { RunTracker } from './run-tracker.js';
|
|
12
|
+
export { RunCommands } from './run-commands.js';
|
|
13
|
+
export { EnhancedCommands } from './enhanced-commands.js';
|
|
14
|
+
export { CIWatcher } from './ci-watcher.js';
|
|
15
|
+
// Formatter
|
|
16
|
+
export { TextProFormatter } from './text-formatter.js';
|
|
17
|
+
// Router
|
|
18
|
+
export { ProCallbackRouter, parseCallbackData } from './callback-router.js';
|
|
19
|
+
// Bundle
|
|
20
|
+
export { ProFeatures } from './pro-features.js';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/channels/pro/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkCH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,SAAS;AACT,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG5E,SAAS;AACT,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pro Features Bundle
|
|
3
|
+
*
|
|
4
|
+
* Composition helper that bundles all 6 pro features with lazy loading.
|
|
5
|
+
* Any channel can opt in by creating a ProFeatures instance.
|
|
6
|
+
*/
|
|
7
|
+
import type { ChannelProFormatter, DiffFirstConfig, CIWatchConfig, AuthScope } from './types.js';
|
|
8
|
+
import type { SendFn, EmitTaskFn } from './callback-router.js';
|
|
9
|
+
import { ScopedAuthManager } from './scoped-auth.js';
|
|
10
|
+
import { DiffFirstManager } from './diff-first.js';
|
|
11
|
+
import { RunTracker } from './run-tracker.js';
|
|
12
|
+
import { RunCommands } from './run-commands.js';
|
|
13
|
+
import { EnhancedCommands } from './enhanced-commands.js';
|
|
14
|
+
import { CIWatcher } from './ci-watcher.js';
|
|
15
|
+
import { ProCallbackRouter } from './callback-router.js';
|
|
16
|
+
/** Configuration for ProFeatures */
|
|
17
|
+
export interface ProFeaturesConfig {
|
|
18
|
+
/** Admin user IDs */
|
|
19
|
+
adminUsers?: string[];
|
|
20
|
+
/** Custom formatter (defaults to TextProFormatter) */
|
|
21
|
+
formatter?: ChannelProFormatter;
|
|
22
|
+
/** Scoped auth config */
|
|
23
|
+
scopedAuth?: {
|
|
24
|
+
defaultScopes?: AuthScope[];
|
|
25
|
+
adminScopes?: AuthScope[];
|
|
26
|
+
};
|
|
27
|
+
/** Diff-first config */
|
|
28
|
+
diffFirst?: Partial<DiffFirstConfig>;
|
|
29
|
+
/** CI watcher config */
|
|
30
|
+
ciWatch?: Partial<CIWatchConfig>;
|
|
31
|
+
/** Enable enhanced commands (default true) */
|
|
32
|
+
enhancedCommands?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Bundles all 6 pro features with lazy loading.
|
|
36
|
+
* Channels opt in by creating a ProFeatures instance.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ProFeatures {
|
|
39
|
+
private _scopedAuth?;
|
|
40
|
+
private _diffFirst?;
|
|
41
|
+
private _runTracker?;
|
|
42
|
+
private _runCommands?;
|
|
43
|
+
private _enhancedCommands?;
|
|
44
|
+
private _ciWatcher?;
|
|
45
|
+
private _callbackRouter?;
|
|
46
|
+
private _formatter?;
|
|
47
|
+
private config;
|
|
48
|
+
constructor(config?: ProFeaturesConfig);
|
|
49
|
+
/** Get the formatter */
|
|
50
|
+
get formatter(): ChannelProFormatter;
|
|
51
|
+
/** Lazy getter for ScopedAuthManager */
|
|
52
|
+
get scopedAuth(): ScopedAuthManager;
|
|
53
|
+
/** Lazy getter for DiffFirstManager */
|
|
54
|
+
get diffFirst(): DiffFirstManager;
|
|
55
|
+
/** Lazy getter for RunTracker */
|
|
56
|
+
get runTracker(): RunTracker;
|
|
57
|
+
/** Lazy getter for RunCommands */
|
|
58
|
+
get runCommands(): RunCommands;
|
|
59
|
+
/** Lazy getter for EnhancedCommands */
|
|
60
|
+
get enhancedCommands(): EnhancedCommands;
|
|
61
|
+
/** Lazy getter for CIWatcher */
|
|
62
|
+
get ciWatcher(): CIWatcher;
|
|
63
|
+
/** Lazy getter for ProCallbackRouter */
|
|
64
|
+
get callbackRouter(): ProCallbackRouter;
|
|
65
|
+
/**
|
|
66
|
+
* Route a slash command to the appropriate handler.
|
|
67
|
+
* Returns true if the command was handled.
|
|
68
|
+
*/
|
|
69
|
+
routeCommand(cmd: string, args: string[], chatId: string, userId: string, sendFn: SendFn): Promise<boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* Route a callback query to the correct handler.
|
|
72
|
+
* Returns true if handled.
|
|
73
|
+
*/
|
|
74
|
+
routeCallback(data: string, userId: string, chatId: string, sendFn: SendFn, emitTask?: EmitTaskFn): Promise<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Clean up all resources
|
|
77
|
+
*/
|
|
78
|
+
destroy(): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pro Features Bundle
|
|
3
|
+
*
|
|
4
|
+
* Composition helper that bundles all 6 pro features with lazy loading.
|
|
5
|
+
* Any channel can opt in by creating a ProFeatures instance.
|
|
6
|
+
*/
|
|
7
|
+
import { ScopedAuthManager } from './scoped-auth.js';
|
|
8
|
+
import { DiffFirstManager } from './diff-first.js';
|
|
9
|
+
import { RunTracker } from './run-tracker.js';
|
|
10
|
+
import { RunCommands } from './run-commands.js';
|
|
11
|
+
import { EnhancedCommands } from './enhanced-commands.js';
|
|
12
|
+
import { CIWatcher } from './ci-watcher.js';
|
|
13
|
+
import { TextProFormatter } from './text-formatter.js';
|
|
14
|
+
import { ProCallbackRouter } from './callback-router.js';
|
|
15
|
+
/**
|
|
16
|
+
* Bundles all 6 pro features with lazy loading.
|
|
17
|
+
* Channels opt in by creating a ProFeatures instance.
|
|
18
|
+
*/
|
|
19
|
+
export class ProFeatures {
|
|
20
|
+
_scopedAuth;
|
|
21
|
+
_diffFirst;
|
|
22
|
+
_runTracker;
|
|
23
|
+
_runCommands;
|
|
24
|
+
_enhancedCommands;
|
|
25
|
+
_ciWatcher;
|
|
26
|
+
_callbackRouter;
|
|
27
|
+
_formatter;
|
|
28
|
+
config;
|
|
29
|
+
constructor(config = {}) {
|
|
30
|
+
this.config = config;
|
|
31
|
+
}
|
|
32
|
+
/** Get the formatter */
|
|
33
|
+
get formatter() {
|
|
34
|
+
if (!this._formatter) {
|
|
35
|
+
this._formatter = this.config.formatter || new TextProFormatter();
|
|
36
|
+
}
|
|
37
|
+
return this._formatter;
|
|
38
|
+
}
|
|
39
|
+
/** Lazy getter for ScopedAuthManager */
|
|
40
|
+
get scopedAuth() {
|
|
41
|
+
if (!this._scopedAuth) {
|
|
42
|
+
this._scopedAuth = new ScopedAuthManager(this.config.adminUsers || []);
|
|
43
|
+
}
|
|
44
|
+
return this._scopedAuth;
|
|
45
|
+
}
|
|
46
|
+
/** Lazy getter for DiffFirstManager */
|
|
47
|
+
get diffFirst() {
|
|
48
|
+
if (!this._diffFirst) {
|
|
49
|
+
this._diffFirst = new DiffFirstManager(this.config.diffFirst);
|
|
50
|
+
}
|
|
51
|
+
return this._diffFirst;
|
|
52
|
+
}
|
|
53
|
+
/** Lazy getter for RunTracker */
|
|
54
|
+
get runTracker() {
|
|
55
|
+
if (!this._runTracker) {
|
|
56
|
+
this._runTracker = new RunTracker();
|
|
57
|
+
}
|
|
58
|
+
return this._runTracker;
|
|
59
|
+
}
|
|
60
|
+
/** Lazy getter for RunCommands */
|
|
61
|
+
get runCommands() {
|
|
62
|
+
if (!this._runCommands) {
|
|
63
|
+
this._runCommands = new RunCommands(this.runTracker, this._scopedAuth);
|
|
64
|
+
}
|
|
65
|
+
return this._runCommands;
|
|
66
|
+
}
|
|
67
|
+
/** Lazy getter for EnhancedCommands */
|
|
68
|
+
get enhancedCommands() {
|
|
69
|
+
if (!this._enhancedCommands) {
|
|
70
|
+
this._enhancedCommands = new EnhancedCommands(this._scopedAuth);
|
|
71
|
+
}
|
|
72
|
+
return this._enhancedCommands;
|
|
73
|
+
}
|
|
74
|
+
/** Lazy getter for CIWatcher */
|
|
75
|
+
get ciWatcher() {
|
|
76
|
+
if (!this._ciWatcher) {
|
|
77
|
+
this._ciWatcher = new CIWatcher(this.config.ciWatch ? { ...this.config.ciWatch, mutedPatterns: this.config.ciWatch.mutedPatterns || [] } : undefined, this._scopedAuth);
|
|
78
|
+
}
|
|
79
|
+
return this._ciWatcher;
|
|
80
|
+
}
|
|
81
|
+
/** Lazy getter for ProCallbackRouter */
|
|
82
|
+
get callbackRouter() {
|
|
83
|
+
if (!this._callbackRouter) {
|
|
84
|
+
this._callbackRouter = new ProCallbackRouter(this.diffFirst, this.runCommands, this.ciWatcher, this.enhancedCommands, this.formatter);
|
|
85
|
+
}
|
|
86
|
+
return this._callbackRouter;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Route a slash command to the appropriate handler.
|
|
90
|
+
* Returns true if the command was handled.
|
|
91
|
+
*/
|
|
92
|
+
async routeCommand(cmd, args, chatId, userId, sendFn) {
|
|
93
|
+
if (this.config.enhancedCommands === false)
|
|
94
|
+
return false;
|
|
95
|
+
switch (cmd) {
|
|
96
|
+
case 'repo': {
|
|
97
|
+
const result = this.enhancedCommands.handleRepo(chatId, args[0]);
|
|
98
|
+
if (result.success) {
|
|
99
|
+
const formatted = this.formatter.formatRepoInfo(result.data);
|
|
100
|
+
await sendFn(chatId, formatted.text, formatted.buttons);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
await sendFn(chatId, result.error);
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
case 'branch': {
|
|
108
|
+
const result = this.enhancedCommands.handleBranch(chatId, args[0]);
|
|
109
|
+
if (result.success) {
|
|
110
|
+
const formatted = this.formatter.formatBranchInfo(result.data);
|
|
111
|
+
await sendFn(chatId, formatted.text, formatted.buttons);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
await sendFn(chatId, result.error);
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
case 'pr': {
|
|
119
|
+
const result = this.enhancedCommands.handlePR(chatId, args[0]);
|
|
120
|
+
if (!result.success) {
|
|
121
|
+
await sendFn(chatId, result.error);
|
|
122
|
+
}
|
|
123
|
+
else if ('data' in result) {
|
|
124
|
+
const formatted = this.formatter.formatPRInfo(result.data);
|
|
125
|
+
await sendFn(chatId, formatted.text, formatted.buttons);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const formatted = this.formatter.formatPRList(result.list);
|
|
129
|
+
await sendFn(chatId, formatted.text, formatted.buttons);
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
case 'task': {
|
|
134
|
+
const desc = args.join(' ');
|
|
135
|
+
if (!desc) {
|
|
136
|
+
await sendFn(chatId, 'Usage: /task <description>');
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
const result = this.enhancedCommands.handleTask(chatId, userId, desc);
|
|
140
|
+
await sendFn(chatId, result.text);
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
case 'yolo': {
|
|
144
|
+
const result = this.enhancedCommands.handleYolo(chatId, userId, args[0]);
|
|
145
|
+
await sendFn(chatId, result.text);
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
case 'runs': {
|
|
149
|
+
const result = this.runCommands.handleRunsList(chatId, userId);
|
|
150
|
+
const formatted = this.formatter.formatRunsList(result.runs);
|
|
151
|
+
await sendFn(chatId, formatted.text, formatted.buttons);
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
case 'run': {
|
|
155
|
+
if (!args[0]) {
|
|
156
|
+
await sendFn(chatId, 'Usage: /run <id>');
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
const detail = this.runCommands.handleRunDetail(chatId, args[0]);
|
|
160
|
+
if (detail) {
|
|
161
|
+
const formatted = this.formatter.formatRunDetail(detail.run, detail.testSteps, detail.commitRefs);
|
|
162
|
+
await sendFn(chatId, formatted.text, formatted.buttons);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
await sendFn(chatId, `Run not found: ${args[0]}`);
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
case 'pins': {
|
|
170
|
+
const pins = this.enhancedCommands.getPins(chatId);
|
|
171
|
+
if (pins.length === 0) {
|
|
172
|
+
await sendFn(chatId, 'No pinned context.');
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
const text = pins
|
|
176
|
+
.map((p) => `[${p.id}] ${p.content.slice(0, 100)}${p.tags.length > 0 ? ` (${p.tags.join(', ')})` : ''}`)
|
|
177
|
+
.join('\n');
|
|
178
|
+
await sendFn(chatId, `Pinned Context:\n${text}`);
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
default:
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Route a callback query to the correct handler.
|
|
188
|
+
* Returns true if handled.
|
|
189
|
+
*/
|
|
190
|
+
async routeCallback(data, userId, chatId, sendFn, emitTask) {
|
|
191
|
+
return this.callbackRouter.route(data, userId, chatId, sendFn, emitTask);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Clean up all resources
|
|
195
|
+
*/
|
|
196
|
+
destroy() {
|
|
197
|
+
if (this._ciWatcher)
|
|
198
|
+
this._ciWatcher.stop();
|
|
199
|
+
if (this._enhancedCommands)
|
|
200
|
+
this._enhancedCommands.destroy();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=pro-features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pro-features.js","sourceRoot":"","sources":["../../../src/channels/pro/pro-features.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAqBzD;;;GAGG;AACH,MAAM,OAAO,WAAW;IACd,WAAW,CAAqB;IAChC,UAAU,CAAoB;IAC9B,WAAW,CAAc;IACzB,YAAY,C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