@qelos/aidev 0.7.3 → 0.7.5
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/.env.aidev.example +105 -105
- package/CONTRIBUTING.md +78 -78
- package/LICENSE +21 -21
- package/README.md +755 -755
- package/dist/cli.js +0 -0
- package/dist/commands/help.js +80 -80
- package/dist/commands/init.js +105 -105
- package/dist/commands/run.d.ts +7 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +186 -159
- package/dist/commands/run.js.map +1 -1
- package/dist/github.js +27 -27
- package/dist/providers/linear.d.ts.map +1 -1
- package/dist/providers/linear.js +151 -116
- package/dist/providers/linear.js.map +1 -1
- package/dist/providers/monday.js +45 -45
- package/package.json +51 -51
- package/scripts/run-tests.cjs +18 -18
- package/.aidev/assets/86c8yjxrr/9ea11c36-311c-4022-889c-1bb0915122dc.jpg-40e6939e3b68e864260f7ae7e85bd623_exif.jpg +0 -0
- package/.aidev/assets/86c9n1mkf/65d079a2-dc39-4c4e-9ea9-964d37e0402c.jpg-a639447a10296e31cd4c85d521e9705e_exif.jpg +0 -0
- package/aidev.tasks.json +0 -1
- package/dist/autoCompress.d.ts +0 -54
- package/dist/autoCompress.d.ts.map +0 -1
- package/dist/autoCompress.js +0 -300
- package/dist/autoCompress.js.map +0 -1
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/commands/help.js
CHANGED
|
@@ -46,86 +46,86 @@ function windowsCursorAgentLine(opts) {
|
|
|
46
46
|
` ${y('!')} Cursor runner needs the Agent CLI. Install: ${c("irm 'https://cursor.com/install?win32=true' | iex")}\n`;
|
|
47
47
|
}
|
|
48
48
|
function helpCommand() {
|
|
49
|
-
console.log(`
|
|
50
|
-
${b('aidev')} ${d('v0.1.0')} — AI-powered task executor
|
|
51
|
-
|
|
52
|
-
${b('USAGE')}
|
|
53
|
-
${c('aidev')} ${d('[command]')}
|
|
54
|
-
|
|
55
|
-
${b('COMMANDS')}
|
|
56
|
-
${c('init')} Interactive setup — create ${d('.env.aidev')}
|
|
57
|
-
${c('run')} Process all open + pending-with-replies tasks
|
|
58
|
-
${c('run open')} Only open (non-pending) tasks
|
|
59
|
-
${c('run pending')} Only pending tasks — check for human replies
|
|
60
|
-
${c('run tasks')} Publish queued ${d('aidev.tasks.json')} entries and exit
|
|
61
|
-
${c('tasks add')} Queue a new task in ${d('aidev.tasks.json')} (interactive)
|
|
62
|
-
${c('tasks ls')} List queued tasks
|
|
63
|
-
${c('tasks update')} ${d('[id]')} Edit a queued task
|
|
64
|
-
${c('tasks remove')} ${d('[id]')} Delete a queued task
|
|
65
|
-
${c('tasks push')} Publish all queued tasks now (same as ${c('run tasks')})
|
|
66
|
-
${c('schedule set')} ${d('<cron>')} Set cron schedule for this directory
|
|
67
|
-
${c('schedule get')} Show current cron schedule
|
|
68
|
-
${c('help')} Show this help message
|
|
69
|
-
|
|
70
|
-
${b('TRIGGER WORD')}
|
|
71
|
-
When a task is skipped (branch exists or pending with no reply), post a comment
|
|
72
|
-
containing the trigger word ${d('(default: aidev-continue)')} to re-trigger processing.
|
|
73
|
-
The existing branch will be reused. Set ${c('AIDEV_TRIGGER_WORD')} to customise.
|
|
74
|
-
|
|
75
|
-
${b('HOOKS')}
|
|
76
|
-
Set ${c('AIDEV_HOOKS_PATH')} to a ${d('.ts')} or ${d('.js')} file to run optional async hooks
|
|
77
|
-
${d('(beforeRun, beforeEachTask, beforeResolveConflicts, …)')}. ${c('aidev init')} creates
|
|
78
|
-
${d('.aidev/aidev.hooks.ts')} and points this variable at it. Throw from a hook to abort that step.
|
|
79
|
-
|
|
80
|
-
${b('LOCAL PROVIDER')}
|
|
81
|
-
Set ${c('PROVIDER=local')} in ${d('.env.aidev')} to use file-based task management.
|
|
82
|
-
Tasks live in ${d('.aidev/tasks/')} under status folders: ${c('open')}, ${c('pending')},
|
|
83
|
-
${c('progress')}, ${c('review')}, ${c('done')}.
|
|
84
|
-
|
|
85
|
-
Each task is a markdown file with YAML frontmatter (title, priority, tags, etc.)
|
|
86
|
-
and a description body. Comments are stored in a ${d('.session.md')} companion file.
|
|
87
|
-
To add a comment, append a ${d('## your-name')} section to the session file.
|
|
88
|
-
Add ${c('type: non-code')} to frontmatter for tasks that skip git branching.
|
|
89
|
-
Run ${c('aidev init')} with provider ${c('local')} to create the folder structure.
|
|
90
|
-
|
|
91
|
-
${b('LOCAL TASKS FILE')}
|
|
92
|
-
${d('aidev.tasks.json')} queues tasks to publish to your remote provider. Each entry
|
|
93
|
-
has a title, description, type (${c('code')} | ${c('non-code')}), optional priority, tags, and cron.
|
|
94
|
-
Every ${c('aidev run')} publishes pending entries; one-shot entries are removed after
|
|
95
|
-
publishing, cron entries stay and re-publish on schedule. Manage with ${c('aidev tasks')}
|
|
96
|
-
${d('(add / ls / update / remove / push)')} or edit the JSON file directly.
|
|
97
|
-
|
|
98
|
-
${b('NON-CODE TASKS')}
|
|
99
|
-
Tasks tagged with the ${c('NON_CODE_TAG')} are executed without git branching —
|
|
100
|
-
no checkout, commit, push, or PR creation. The AI agent runs the task directly
|
|
101
|
-
in the current working directory. Useful for research, documentation, or tasks
|
|
102
|
-
that don't produce code changes requiring review.
|
|
103
|
-
Optionally use a different ClickUp team (${c('NON_CODE_CLICKUP_TEAM_ID')}) or
|
|
104
|
-
Jira project (${c('NON_CODE_JIRA_PROJECT')}) for non-code tasks.
|
|
105
|
-
If ${c('NON_CODE_TAG')} is not set, it defaults to ${d('<folder-name>-other')}.
|
|
106
|
-
|
|
107
|
-
${b('EXAMPLES')}
|
|
108
|
-
${d('$')} ${g('aidev init')}
|
|
109
|
-
${d('$')} ${g('aidev run')}
|
|
110
|
-
${d('$')} ${g('aidev run open')}
|
|
111
|
-
${d('$')} ${g('aidev schedule set "*/30 * * * *"')}
|
|
112
|
-
${d('$')} ${g('aidev schedule get')}
|
|
113
|
-
|
|
114
|
-
${b('CONFIG')} ${d('.env.aidev in your project directory')}
|
|
115
|
-
${d('PROVIDER')} ${c('clickup')} ${d('(default) | jira | linear | local | monday | notion | trello')}
|
|
116
|
-
${d('CLICKUP_API_KEY')} ClickUp personal API token
|
|
117
|
-
${d('CLICKUP_TEAM_ID')} Workspace / team ID
|
|
118
|
-
${d('CLICKUP_TAG')} Tag used to filter tasks ${d('(default: folder name)')}
|
|
119
|
-
${d('AGENTS')} Agent order: ${c('claude,cursor')} ${d('| antigravity | cursor | windsurf | …')}
|
|
120
|
-
${d('DEV_NOTES_MODE')} ${c('smart')} ${d('(default) | always')}
|
|
121
|
-
${d('AIDEV_TRIGGER_WORD')} Trigger word to re-process a skipped task ${d('(default: aidev-continue)')}
|
|
122
|
-
${d('AIDEV_HOOKS_PATH')} Optional hooks module ${d('(default from init: .aidev/aidev.hooks.ts)')}
|
|
123
|
-
${d('NON_CODE_TAG')} Tag for non-code tasks ${d('(default: <folder-name>-other)')}
|
|
124
|
-
${d('GIT_REMOTE')} Remote name ${d('(auto-detected if unset)')}
|
|
125
|
-
${d('GITHUB_BASE_BRANCH')} Base branch ${d('(default: main)')}
|
|
126
|
-
${d('GITHUB_REPO')} ${d('owner/repo')} for PR links
|
|
127
|
-
${ghStatusLine()}${windowsCursorAgentLine()}
|
|
128
|
-
Run ${c('aidev init')} to configure interactively.
|
|
49
|
+
console.log(`
|
|
50
|
+
${b('aidev')} ${d('v0.1.0')} — AI-powered task executor
|
|
51
|
+
|
|
52
|
+
${b('USAGE')}
|
|
53
|
+
${c('aidev')} ${d('[command]')}
|
|
54
|
+
|
|
55
|
+
${b('COMMANDS')}
|
|
56
|
+
${c('init')} Interactive setup — create ${d('.env.aidev')}
|
|
57
|
+
${c('run')} Process all open + pending-with-replies tasks
|
|
58
|
+
${c('run open')} Only open (non-pending) tasks
|
|
59
|
+
${c('run pending')} Only pending tasks — check for human replies
|
|
60
|
+
${c('run tasks')} Publish queued ${d('aidev.tasks.json')} entries and exit
|
|
61
|
+
${c('tasks add')} Queue a new task in ${d('aidev.tasks.json')} (interactive)
|
|
62
|
+
${c('tasks ls')} List queued tasks
|
|
63
|
+
${c('tasks update')} ${d('[id]')} Edit a queued task
|
|
64
|
+
${c('tasks remove')} ${d('[id]')} Delete a queued task
|
|
65
|
+
${c('tasks push')} Publish all queued tasks now (same as ${c('run tasks')})
|
|
66
|
+
${c('schedule set')} ${d('<cron>')} Set cron schedule for this directory
|
|
67
|
+
${c('schedule get')} Show current cron schedule
|
|
68
|
+
${c('help')} Show this help message
|
|
69
|
+
|
|
70
|
+
${b('TRIGGER WORD')}
|
|
71
|
+
When a task is skipped (branch exists or pending with no reply), post a comment
|
|
72
|
+
containing the trigger word ${d('(default: aidev-continue)')} to re-trigger processing.
|
|
73
|
+
The existing branch will be reused. Set ${c('AIDEV_TRIGGER_WORD')} to customise.
|
|
74
|
+
|
|
75
|
+
${b('HOOKS')}
|
|
76
|
+
Set ${c('AIDEV_HOOKS_PATH')} to a ${d('.ts')} or ${d('.js')} file to run optional async hooks
|
|
77
|
+
${d('(beforeRun, beforeEachTask, beforeResolveConflicts, …)')}. ${c('aidev init')} creates
|
|
78
|
+
${d('.aidev/aidev.hooks.ts')} and points this variable at it. Throw from a hook to abort that step.
|
|
79
|
+
|
|
80
|
+
${b('LOCAL PROVIDER')}
|
|
81
|
+
Set ${c('PROVIDER=local')} in ${d('.env.aidev')} to use file-based task management.
|
|
82
|
+
Tasks live in ${d('.aidev/tasks/')} under status folders: ${c('open')}, ${c('pending')},
|
|
83
|
+
${c('progress')}, ${c('review')}, ${c('done')}.
|
|
84
|
+
|
|
85
|
+
Each task is a markdown file with YAML frontmatter (title, priority, tags, etc.)
|
|
86
|
+
and a description body. Comments are stored in a ${d('.session.md')} companion file.
|
|
87
|
+
To add a comment, append a ${d('## your-name')} section to the session file.
|
|
88
|
+
Add ${c('type: non-code')} to frontmatter for tasks that skip git branching.
|
|
89
|
+
Run ${c('aidev init')} with provider ${c('local')} to create the folder structure.
|
|
90
|
+
|
|
91
|
+
${b('LOCAL TASKS FILE')}
|
|
92
|
+
${d('aidev.tasks.json')} queues tasks to publish to your remote provider. Each entry
|
|
93
|
+
has a title, description, type (${c('code')} | ${c('non-code')}), optional priority, tags, and cron.
|
|
94
|
+
Every ${c('aidev run')} publishes pending entries; one-shot entries are removed after
|
|
95
|
+
publishing, cron entries stay and re-publish on schedule. Manage with ${c('aidev tasks')}
|
|
96
|
+
${d('(add / ls / update / remove / push)')} or edit the JSON file directly.
|
|
97
|
+
|
|
98
|
+
${b('NON-CODE TASKS')}
|
|
99
|
+
Tasks tagged with the ${c('NON_CODE_TAG')} are executed without git branching —
|
|
100
|
+
no checkout, commit, push, or PR creation. The AI agent runs the task directly
|
|
101
|
+
in the current working directory. Useful for research, documentation, or tasks
|
|
102
|
+
that don't produce code changes requiring review.
|
|
103
|
+
Optionally use a different ClickUp team (${c('NON_CODE_CLICKUP_TEAM_ID')}) or
|
|
104
|
+
Jira project (${c('NON_CODE_JIRA_PROJECT')}) for non-code tasks.
|
|
105
|
+
If ${c('NON_CODE_TAG')} is not set, it defaults to ${d('<folder-name>-other')}.
|
|
106
|
+
|
|
107
|
+
${b('EXAMPLES')}
|
|
108
|
+
${d('$')} ${g('aidev init')}
|
|
109
|
+
${d('$')} ${g('aidev run')}
|
|
110
|
+
${d('$')} ${g('aidev run open')}
|
|
111
|
+
${d('$')} ${g('aidev schedule set "*/30 * * * *"')}
|
|
112
|
+
${d('$')} ${g('aidev schedule get')}
|
|
113
|
+
|
|
114
|
+
${b('CONFIG')} ${d('.env.aidev in your project directory')}
|
|
115
|
+
${d('PROVIDER')} ${c('clickup')} ${d('(default) | jira | linear | local | monday | notion | trello')}
|
|
116
|
+
${d('CLICKUP_API_KEY')} ClickUp personal API token
|
|
117
|
+
${d('CLICKUP_TEAM_ID')} Workspace / team ID
|
|
118
|
+
${d('CLICKUP_TAG')} Tag used to filter tasks ${d('(default: folder name)')}
|
|
119
|
+
${d('AGENTS')} Agent order: ${c('claude,cursor')} ${d('| antigravity | cursor | windsurf | …')}
|
|
120
|
+
${d('DEV_NOTES_MODE')} ${c('smart')} ${d('(default) | always')}
|
|
121
|
+
${d('AIDEV_TRIGGER_WORD')} Trigger word to re-process a skipped task ${d('(default: aidev-continue)')}
|
|
122
|
+
${d('AIDEV_HOOKS_PATH')} Optional hooks module ${d('(default from init: .aidev/aidev.hooks.ts)')}
|
|
123
|
+
${d('NON_CODE_TAG')} Tag for non-code tasks ${d('(default: <folder-name>-other)')}
|
|
124
|
+
${d('GIT_REMOTE')} Remote name ${d('(auto-detected if unset)')}
|
|
125
|
+
${d('GITHUB_BASE_BRANCH')} Base branch ${d('(default: main)')}
|
|
126
|
+
${d('GITHUB_REPO')} ${d('owner/repo')} for PR links
|
|
127
|
+
${ghStatusLine()}${windowsCursorAgentLine()}
|
|
128
|
+
Run ${c('aidev init')} to configure interactively.
|
|
129
129
|
`);
|
|
130
130
|
}
|
|
131
131
|
//# sourceMappingURL=help.js.map
|
package/dist/commands/init.js
CHANGED
|
@@ -367,111 +367,111 @@ function printGhSuggestion(remote) {
|
|
|
367
367
|
console.log(` PRs will be created automatically after pushing branches.`);
|
|
368
368
|
console.log();
|
|
369
369
|
}
|
|
370
|
-
const HOOKS_BOILERPLATE = `// aidev hooks — customize the AI task automation pipeline
|
|
371
|
-
//
|
|
372
|
-
// Each export below is an async (context, vm) hook. Return a new/updated context object to
|
|
373
|
-
// change prompts, subtasks, etc.; return nothing to keep the incoming context. Throw to abort
|
|
374
|
-
// the current step (whole run, single task, conflict resolution, etc., depending on the hook).
|
|
375
|
-
//
|
|
376
|
-
// vm: run AI (first available agent), postComment, updateStatus, getComments, log.info/warn/error
|
|
377
|
-
//
|
|
378
|
-
// .ts files are loaded via jiti — no TypeScript compiler or toolchain needed.
|
|
379
|
-
|
|
380
|
-
// ─── Context types (mirror aidev's internal shapes — tweak here for editor hints) ─
|
|
381
|
-
|
|
382
|
-
interface RunContext {
|
|
383
|
-
config: Record<string, unknown>;
|
|
384
|
-
filter: string;
|
|
385
|
-
taskCount: number;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
interface TaskContext {
|
|
389
|
-
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
390
|
-
config: Record<string, unknown>;
|
|
391
|
-
branchName: string;
|
|
392
|
-
prompt: string;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
interface ResolveConflictsContext {
|
|
396
|
-
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
397
|
-
config: Record<string, unknown>;
|
|
398
|
-
branchName: string;
|
|
399
|
-
conflictFiles: string[];
|
|
400
|
-
prompt: string;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
interface NonCodeTaskContext {
|
|
404
|
-
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
405
|
-
config: Record<string, unknown>;
|
|
406
|
-
prompt: string;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
interface ThinkingTaskContext {
|
|
410
|
-
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
411
|
-
config: Record<string, unknown>;
|
|
412
|
-
branchName: string;
|
|
413
|
-
subtasks: Array<{ id: number; title: string; description: string; status: string }>;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
interface HookVM {
|
|
417
|
-
runAI(prompt: string): Promise<{ success: boolean; output: string; error: string }>;
|
|
418
|
-
postComment(taskId: string, text: string): Promise<void>;
|
|
419
|
-
updateStatus(taskId: string, status: string): Promise<void>;
|
|
420
|
-
getComments(taskId: string): Promise<Array<{ id: string; text: string; author: string }>>;
|
|
421
|
-
log: { info(msg: string): void; warn(msg: string): void; error(msg: string): void };
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// ─── Hooks (fill in — ask an AI: "implement beforeEachTask to append X to the prompt") ─
|
|
425
|
-
|
|
426
|
-
/** Once before any task. AI idea: log counts, or throw if CI env var is missing. */
|
|
427
|
-
export async function beforeRun(_context: RunContext, _vm: HookVM): Promise<RunContext | void> {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/** After all tasks in this run. AI idea: post a summary comment or call an external webhook. */
|
|
432
|
-
export async function afterRun(_context: RunContext & { processed: number; skipped: number }, _vm: HookVM): Promise<void> {
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/** Before each code task AI run. AI idea: append coding standards or repo-specific rules to context.prompt. */
|
|
437
|
-
export async function beforeEachTask(_context: TaskContext, _vm: HookVM): Promise<TaskContext | void> {
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/** After a code task completes the success path (push + review). */
|
|
442
|
-
export async function afterEachTask(_context: TaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/** Before AI-driven merge conflict resolution. AI idea: tighten context.prompt for your stack. */
|
|
447
|
-
export async function beforeResolveConflicts(_context: ResolveConflictsContext, _vm: HookVM): Promise<ResolveConflictsContext | void> {
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/** After conflict resolution; context.resolved is false when all runners failed. */
|
|
452
|
-
export async function afterResolveConflicts(_context: ResolveConflictsContext & { resolved: boolean }, _vm: HookVM): Promise<void> {
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/** Before non-code task AI run. AI idea: format context.prompt for ticket-style replies. */
|
|
457
|
-
export async function beforeNonCodeTask(_context: NonCodeTaskContext, _vm: HookVM): Promise<NonCodeTaskContext | void> {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/** After non-code task; context.output is the agent response text posted to the ticket. */
|
|
462
|
-
export async function afterNonCodeTask(_context: NonCodeTaskContext & { success: boolean; output: string }, _vm: HookVM): Promise<void> {
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/** After the plan exists, before subtasks run. AI idea: rewrite subtask descriptions for clarity. */
|
|
467
|
-
export async function beforeThinkingTask(_context: ThinkingTaskContext, _vm: HookVM): Promise<ThinkingTaskContext | void> {
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/** After all thinking-task subtasks complete. AI idea: notify or archive artifacts. */
|
|
472
|
-
export async function afterThinkingTask(_context: ThinkingTaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
370
|
+
const HOOKS_BOILERPLATE = `// aidev hooks — customize the AI task automation pipeline
|
|
371
|
+
//
|
|
372
|
+
// Each export below is an async (context, vm) hook. Return a new/updated context object to
|
|
373
|
+
// change prompts, subtasks, etc.; return nothing to keep the incoming context. Throw to abort
|
|
374
|
+
// the current step (whole run, single task, conflict resolution, etc., depending on the hook).
|
|
375
|
+
//
|
|
376
|
+
// vm: run AI (first available agent), postComment, updateStatus, getComments, log.info/warn/error
|
|
377
|
+
//
|
|
378
|
+
// .ts files are loaded via jiti — no TypeScript compiler or toolchain needed.
|
|
379
|
+
|
|
380
|
+
// ─── Context types (mirror aidev's internal shapes — tweak here for editor hints) ─
|
|
381
|
+
|
|
382
|
+
interface RunContext {
|
|
383
|
+
config: Record<string, unknown>;
|
|
384
|
+
filter: string;
|
|
385
|
+
taskCount: number;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
interface TaskContext {
|
|
389
|
+
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
390
|
+
config: Record<string, unknown>;
|
|
391
|
+
branchName: string;
|
|
392
|
+
prompt: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
interface ResolveConflictsContext {
|
|
396
|
+
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
397
|
+
config: Record<string, unknown>;
|
|
398
|
+
branchName: string;
|
|
399
|
+
conflictFiles: string[];
|
|
400
|
+
prompt: string;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface NonCodeTaskContext {
|
|
404
|
+
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
405
|
+
config: Record<string, unknown>;
|
|
406
|
+
prompt: string;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
interface ThinkingTaskContext {
|
|
410
|
+
task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
|
|
411
|
+
config: Record<string, unknown>;
|
|
412
|
+
branchName: string;
|
|
413
|
+
subtasks: Array<{ id: number; title: string; description: string; status: string }>;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
interface HookVM {
|
|
417
|
+
runAI(prompt: string): Promise<{ success: boolean; output: string; error: string }>;
|
|
418
|
+
postComment(taskId: string, text: string): Promise<void>;
|
|
419
|
+
updateStatus(taskId: string, status: string): Promise<void>;
|
|
420
|
+
getComments(taskId: string): Promise<Array<{ id: string; text: string; author: string }>>;
|
|
421
|
+
log: { info(msg: string): void; warn(msg: string): void; error(msg: string): void };
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// ─── Hooks (fill in — ask an AI: "implement beforeEachTask to append X to the prompt") ─
|
|
425
|
+
|
|
426
|
+
/** Once before any task. AI idea: log counts, or throw if CI env var is missing. */
|
|
427
|
+
export async function beforeRun(_context: RunContext, _vm: HookVM): Promise<RunContext | void> {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/** After all tasks in this run. AI idea: post a summary comment or call an external webhook. */
|
|
432
|
+
export async function afterRun(_context: RunContext & { processed: number; skipped: number }, _vm: HookVM): Promise<void> {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** Before each code task AI run. AI idea: append coding standards or repo-specific rules to context.prompt. */
|
|
437
|
+
export async function beforeEachTask(_context: TaskContext, _vm: HookVM): Promise<TaskContext | void> {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** After a code task completes the success path (push + review). */
|
|
442
|
+
export async function afterEachTask(_context: TaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** Before AI-driven merge conflict resolution. AI idea: tighten context.prompt for your stack. */
|
|
447
|
+
export async function beforeResolveConflicts(_context: ResolveConflictsContext, _vm: HookVM): Promise<ResolveConflictsContext | void> {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** After conflict resolution; context.resolved is false when all runners failed. */
|
|
452
|
+
export async function afterResolveConflicts(_context: ResolveConflictsContext & { resolved: boolean }, _vm: HookVM): Promise<void> {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/** Before non-code task AI run. AI idea: format context.prompt for ticket-style replies. */
|
|
457
|
+
export async function beforeNonCodeTask(_context: NonCodeTaskContext, _vm: HookVM): Promise<NonCodeTaskContext | void> {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** After non-code task; context.output is the agent response text posted to the ticket. */
|
|
462
|
+
export async function afterNonCodeTask(_context: NonCodeTaskContext & { success: boolean; output: string }, _vm: HookVM): Promise<void> {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/** After the plan exists, before subtasks run. AI idea: rewrite subtask descriptions for clarity. */
|
|
467
|
+
export async function beforeThinkingTask(_context: ThinkingTaskContext, _vm: HookVM): Promise<ThinkingTaskContext | void> {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/** After all thinking-task subtasks complete. AI idea: notify or archive artifacts. */
|
|
472
|
+
export async function afterThinkingTask(_context: ThinkingTaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
475
|
`;
|
|
476
476
|
function ensureHooksBoilerplate(dir = process.cwd()) {
|
|
477
477
|
const aidevDir = path.join(dir, '.aidev');
|
package/dist/commands/run.d.ts
CHANGED
|
@@ -29,6 +29,12 @@ export declare function formatSubtaskId(id: number | string): string;
|
|
|
29
29
|
export declare function subtaskDepth(id: number | string): number;
|
|
30
30
|
export declare function formatSubtaskList(plan: ThinkingTaskPlan): string;
|
|
31
31
|
export declare function runCommand(filter: RunFilter, config: Config, provider: TaskProvider, runners: AIRunner[], nonCodeProvider?: TaskProvider, hooks?: AidevHooks, vm?: HookVM): Promise<void>;
|
|
32
|
+
export declare function isAidevComment(text: string, commentPrefix?: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* True when someone other than aidev spoke after an aidev message: there is a non-aidev
|
|
35
|
+
* comment that has at least one earlier [aidev]-prefixed comment in the thread.
|
|
36
|
+
* Ignores trailing aidev-only noise after the human (e.g. another bot post or sync).
|
|
37
|
+
*/
|
|
32
38
|
export declare function hasHumanReply(comments: Comment[], commentPrefix?: string): boolean;
|
|
33
39
|
/**
|
|
34
40
|
* Returns true if the last comment contains the trigger word.
|
|
@@ -52,6 +58,7 @@ export declare function buildNonCodePrompt(task: Task, context: string): string;
|
|
|
52
58
|
export declare function buildNonCodeCompletionComment(config: Config, agentResponse?: string): string;
|
|
53
59
|
export declare function hasAidevComment(comments: Comment[], commentPrefix?: string): boolean;
|
|
54
60
|
export declare function filterAutomatedComments(comments: Comment[], commentPrefix?: string): Comment[];
|
|
61
|
+
export declare function hasHumanComment(comments: Comment[], commentPrefix?: string): boolean;
|
|
55
62
|
export declare function parseReplyDirectives(output: string): Array<{
|
|
56
63
|
threadId: string;
|
|
57
64
|
body: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAIL,YAAY,EACb,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,UAAU,EAAE,MAAM,EAGnB,MAAM,UAAU,CAA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