steroids-cli 0.4.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +640 -0
- package/dist/cli/colors.d.ts +110 -0
- package/dist/cli/colors.d.ts.map +1 -0
- package/dist/cli/colors.js +228 -0
- package/dist/cli/colors.js.map +1 -0
- package/dist/cli/env.d.ts +159 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +227 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/errors.d.ts +166 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +244 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/flags.d.ts +75 -0
- package/dist/cli/flags.d.ts.map +1 -0
- package/dist/cli/flags.js +232 -0
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/help.d.ts +97 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +275 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +29 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/interactive.d.ts +58 -0
- package/dist/cli/interactive.d.ts.map +1 -0
- package/dist/cli/interactive.js +127 -0
- package/dist/cli/interactive.js.map +1 -0
- package/dist/cli/output.d.ts +116 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +178 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/commands/about.d.ts +7 -0
- package/dist/commands/about.d.ts.map +1 -0
- package/dist/commands/about.js +259 -0
- package/dist/commands/about.js.map +1 -0
- package/dist/commands/ai.d.ts +6 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +382 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/backup.d.ts +3 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +528 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/completion.d.ts +3 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +405 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +665 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/disputes.d.ts +3 -0
- package/dist/commands/disputes.d.ts.map +1 -0
- package/dist/commands/disputes.js +499 -0
- package/dist/commands/disputes.js.map +1 -0
- package/dist/commands/gc.d.ts +3 -0
- package/dist/commands/gc.d.ts.map +1 -0
- package/dist/commands/gc.js +300 -0
- package/dist/commands/gc.js.map +1 -0
- package/dist/commands/git.d.ts +3 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/git.js +458 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/health.d.ts +3 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +604 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/hooks.d.ts +6 -0
- package/dist/commands/hooks.d.ts.map +1 -0
- package/dist/commands/hooks.js +529 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +200 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/llm.d.ts +7 -0
- package/dist/commands/llm.d.ts.map +1 -0
- package/dist/commands/llm.js +285 -0
- package/dist/commands/llm.js.map +1 -0
- package/dist/commands/locks.d.ts +3 -0
- package/dist/commands/locks.d.ts.map +1 -0
- package/dist/commands/locks.js +431 -0
- package/dist/commands/locks.js.map +1 -0
- package/dist/commands/logs.d.ts +3 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +487 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/loop-phases.d.ts +11 -0
- package/dist/commands/loop-phases.d.ts.map +1 -0
- package/dist/commands/loop-phases.js +204 -0
- package/dist/commands/loop-phases.js.map +1 -0
- package/dist/commands/loop.d.ts +3 -0
- package/dist/commands/loop.d.ts.map +1 -0
- package/dist/commands/loop.js +396 -0
- package/dist/commands/loop.js.map +1 -0
- package/dist/commands/projects.d.ts +6 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +362 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/purge.d.ts +3 -0
- package/dist/commands/purge.d.ts.map +1 -0
- package/dist/commands/purge.js +516 -0
- package/dist/commands/purge.js.map +1 -0
- package/dist/commands/runners.d.ts +3 -0
- package/dist/commands/runners.d.ts.map +1 -0
- package/dist/commands/runners.js +1076 -0
- package/dist/commands/runners.js.map +1 -0
- package/dist/commands/scan.d.ts +3 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +291 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/sections-commands.d.ts +9 -0
- package/dist/commands/sections-commands.d.ts.map +1 -0
- package/dist/commands/sections-commands.js +282 -0
- package/dist/commands/sections-commands.js.map +1 -0
- package/dist/commands/sections-graph.d.ts +25 -0
- package/dist/commands/sections-graph.d.ts.map +1 -0
- package/dist/commands/sections-graph.js +180 -0
- package/dist/commands/sections-graph.js.map +1 -0
- package/dist/commands/sections.d.ts +3 -0
- package/dist/commands/sections.d.ts.map +1 -0
- package/dist/commands/sections.js +376 -0
- package/dist/commands/sections.js.map +1 -0
- package/dist/commands/stats.d.ts +6 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +324 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/tasks.d.ts +3 -0
- package/dist/commands/tasks.d.ts.map +1 -0
- package/dist/commands/tasks.js +1115 -0
- package/dist/commands/tasks.js.map +1 -0
- package/dist/commands/web.d.ts +7 -0
- package/dist/commands/web.d.ts.map +1 -0
- package/dist/commands/web.js +204 -0
- package/dist/commands/web.js.map +1 -0
- package/dist/config/ai-setup.d.ts +27 -0
- package/dist/config/ai-setup.d.ts.map +1 -0
- package/dist/config/ai-setup.js +432 -0
- package/dist/config/ai-setup.js.map +1 -0
- package/dist/config/browser.d.ts +9 -0
- package/dist/config/browser.d.ts.map +1 -0
- package/dist/config/browser.js +200 -0
- package/dist/config/browser.js.map +1 -0
- package/dist/config/json-schema.d.ts +28 -0
- package/dist/config/json-schema.d.ts.map +1 -0
- package/dist/config/json-schema.js +84 -0
- package/dist/config/json-schema.js.map +1 -0
- package/dist/config/loader.d.ts +152 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +270 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +34 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +437 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +32 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +187 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/database/connection.d.ts +35 -0
- package/dist/database/connection.d.ts.map +1 -0
- package/dist/database/connection.js +208 -0
- package/dist/database/connection.js.map +1 -0
- package/dist/database/queries.d.ts +218 -0
- package/dist/database/queries.d.ts.map +1 -0
- package/dist/database/queries.js +613 -0
- package/dist/database/queries.js.map +1 -0
- package/dist/database/schema.d.ts +8 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +160 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/disputes/behavior.d.ts +106 -0
- package/dist/disputes/behavior.d.ts.map +1 -0
- package/dist/disputes/behavior.js +150 -0
- package/dist/disputes/behavior.js.map +1 -0
- package/dist/disputes/create.d.ts +59 -0
- package/dist/disputes/create.d.ts.map +1 -0
- package/dist/disputes/create.js +222 -0
- package/dist/disputes/create.js.map +1 -0
- package/dist/disputes/index.d.ts +21 -0
- package/dist/disputes/index.d.ts.map +1 -0
- package/dist/disputes/index.js +76 -0
- package/dist/disputes/index.js.map +1 -0
- package/dist/disputes/markdown.d.ts +41 -0
- package/dist/disputes/markdown.d.ts.map +1 -0
- package/dist/disputes/markdown.js +261 -0
- package/dist/disputes/markdown.js.map +1 -0
- package/dist/disputes/queries.d.ts +83 -0
- package/dist/disputes/queries.d.ts.map +1 -0
- package/dist/disputes/queries.js +180 -0
- package/dist/disputes/queries.js.map +1 -0
- package/dist/disputes/resolve.d.ts +57 -0
- package/dist/disputes/resolve.d.ts.map +1 -0
- package/dist/disputes/resolve.js +171 -0
- package/dist/disputes/resolve.js.map +1 -0
- package/dist/disputes/stale.d.ts +98 -0
- package/dist/disputes/stale.d.ts.map +1 -0
- package/dist/disputes/stale.js +205 -0
- package/dist/disputes/stale.js.map +1 -0
- package/dist/disputes/types.d.ts +92 -0
- package/dist/disputes/types.d.ts.map +1 -0
- package/dist/disputes/types.js +100 -0
- package/dist/disputes/types.js.map +1 -0
- package/dist/git/push.d.ts +26 -0
- package/dist/git/push.d.ts.map +1 -0
- package/dist/git/push.js +97 -0
- package/dist/git/push.js.map +1 -0
- package/dist/git/status.d.ts +61 -0
- package/dist/git/status.d.ts.map +1 -0
- package/dist/git/status.js +251 -0
- package/dist/git/status.js.map +1 -0
- package/dist/hooks/events.d.ts +72 -0
- package/dist/hooks/events.d.ts.map +1 -0
- package/dist/hooks/events.js +120 -0
- package/dist/hooks/events.js.map +1 -0
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +48 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/integration.d.ts +69 -0
- package/dist/hooks/integration.d.ts.map +1 -0
- package/dist/hooks/integration.js +179 -0
- package/dist/hooks/integration.js.map +1 -0
- package/dist/hooks/merge.d.ts +115 -0
- package/dist/hooks/merge.d.ts.map +1 -0
- package/dist/hooks/merge.js +161 -0
- package/dist/hooks/merge.js.map +1 -0
- package/dist/hooks/orchestrator.d.ts +115 -0
- package/dist/hooks/orchestrator.d.ts.map +1 -0
- package/dist/hooks/orchestrator.js +226 -0
- package/dist/hooks/orchestrator.js.map +1 -0
- package/dist/hooks/payload.d.ts +294 -0
- package/dist/hooks/payload.d.ts.map +1 -0
- package/dist/hooks/payload.js +267 -0
- package/dist/hooks/payload.js.map +1 -0
- package/dist/hooks/script-runner.d.ts +63 -0
- package/dist/hooks/script-runner.d.ts.map +1 -0
- package/dist/hooks/script-runner.js +221 -0
- package/dist/hooks/script-runner.js.map +1 -0
- package/dist/hooks/templates.d.ts +104 -0
- package/dist/hooks/templates.d.ts.map +1 -0
- package/dist/hooks/templates.js +327 -0
- package/dist/hooks/templates.js.map +1 -0
- package/dist/hooks/webhook-runner.d.ts +69 -0
- package/dist/hooks/webhook-runner.d.ts.map +1 -0
- package/dist/hooks/webhook-runner.js +208 -0
- package/dist/hooks/webhook-runner.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +281 -0
- package/dist/index.js.map +1 -0
- package/dist/locking/cleanup.d.ts +70 -0
- package/dist/locking/cleanup.d.ts.map +1 -0
- package/dist/locking/cleanup.js +157 -0
- package/dist/locking/cleanup.js.map +1 -0
- package/dist/locking/queries.d.ts +116 -0
- package/dist/locking/queries.d.ts.map +1 -0
- package/dist/locking/queries.js +255 -0
- package/dist/locking/queries.js.map +1 -0
- package/dist/locking/section-lock.d.ts +74 -0
- package/dist/locking/section-lock.d.ts.map +1 -0
- package/dist/locking/section-lock.js +207 -0
- package/dist/locking/section-lock.js.map +1 -0
- package/dist/locking/task-lock.d.ts +92 -0
- package/dist/locking/task-lock.d.ts.map +1 -0
- package/dist/locking/task-lock.js +246 -0
- package/dist/locking/task-lock.js.map +1 -0
- package/dist/migrations/index.d.ts +7 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +37 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifest.d.ts +92 -0
- package/dist/migrations/manifest.d.ts.map +1 -0
- package/dist/migrations/manifest.js +270 -0
- package/dist/migrations/manifest.js.map +1 -0
- package/dist/migrations/runner.d.ts +84 -0
- package/dist/migrations/runner.d.ts.map +1 -0
- package/dist/migrations/runner.js +351 -0
- package/dist/migrations/runner.js.map +1 -0
- package/dist/orchestrator/coder.d.ts +32 -0
- package/dist/orchestrator/coder.d.ts.map +1 -0
- package/dist/orchestrator/coder.js +174 -0
- package/dist/orchestrator/coder.js.map +1 -0
- package/dist/orchestrator/coordinator.d.ts +28 -0
- package/dist/orchestrator/coordinator.d.ts.map +1 -0
- package/dist/orchestrator/coordinator.js +256 -0
- package/dist/orchestrator/coordinator.js.map +1 -0
- package/dist/orchestrator/reviewer.d.ts +35 -0
- package/dist/orchestrator/reviewer.d.ts.map +1 -0
- package/dist/orchestrator/reviewer.js +241 -0
- package/dist/orchestrator/reviewer.js.map +1 -0
- package/dist/orchestrator/task-selector.d.ts +102 -0
- package/dist/orchestrator/task-selector.d.ts.map +1 -0
- package/dist/orchestrator/task-selector.js +341 -0
- package/dist/orchestrator/task-selector.js.map +1 -0
- package/dist/prompts/coder.d.ts +36 -0
- package/dist/prompts/coder.d.ts.map +1 -0
- package/dist/prompts/coder.js +315 -0
- package/dist/prompts/coder.js.map +1 -0
- package/dist/prompts/prompt-helpers.d.ts +51 -0
- package/dist/prompts/prompt-helpers.d.ts.map +1 -0
- package/dist/prompts/prompt-helpers.js +312 -0
- package/dist/prompts/prompt-helpers.js.map +1 -0
- package/dist/prompts/reviewer.d.ts +40 -0
- package/dist/prompts/reviewer.d.ts.map +1 -0
- package/dist/prompts/reviewer.js +438 -0
- package/dist/prompts/reviewer.js.map +1 -0
- package/dist/providers/api-models.d.ts +65 -0
- package/dist/providers/api-models.d.ts.map +1 -0
- package/dist/providers/api-models.js +323 -0
- package/dist/providers/api-models.js.map +1 -0
- package/dist/providers/claude.d.ts +53 -0
- package/dist/providers/claude.d.ts.map +1 -0
- package/dist/providers/claude.js +229 -0
- package/dist/providers/claude.js.map +1 -0
- package/dist/providers/codex.d.ts +53 -0
- package/dist/providers/codex.d.ts.map +1 -0
- package/dist/providers/codex.js +214 -0
- package/dist/providers/codex.js.map +1 -0
- package/dist/providers/gemini.d.ts +58 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +242 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +49 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/interface.d.ts +173 -0
- package/dist/providers/interface.d.ts.map +1 -0
- package/dist/providers/interface.js +96 -0
- package/dist/providers/interface.js.map +1 -0
- package/dist/providers/invocation-logger.d.ts +114 -0
- package/dist/providers/invocation-logger.d.ts.map +1 -0
- package/dist/providers/invocation-logger.js +298 -0
- package/dist/providers/invocation-logger.js.map +1 -0
- package/dist/providers/openai.d.ts +53 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +232 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/registry.d.ts +100 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +178 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/runners/activity-log.d.ts +65 -0
- package/dist/runners/activity-log.d.ts.map +1 -0
- package/dist/runners/activity-log.js +148 -0
- package/dist/runners/activity-log.js.map +1 -0
- package/dist/runners/cron.d.ts +26 -0
- package/dist/runners/cron.d.ts.map +1 -0
- package/dist/runners/cron.js +176 -0
- package/dist/runners/cron.js.map +1 -0
- package/dist/runners/daemon.d.ts +71 -0
- package/dist/runners/daemon.d.ts.map +1 -0
- package/dist/runners/daemon.js +245 -0
- package/dist/runners/daemon.js.map +1 -0
- package/dist/runners/global-db.d.ts +31 -0
- package/dist/runners/global-db.d.ts.map +1 -0
- package/dist/runners/global-db.js +230 -0
- package/dist/runners/global-db.js.map +1 -0
- package/dist/runners/hang-detector.d.ts +38 -0
- package/dist/runners/hang-detector.d.ts.map +1 -0
- package/dist/runners/hang-detector.js +136 -0
- package/dist/runners/hang-detector.js.map +1 -0
- package/dist/runners/heartbeat.d.ts +39 -0
- package/dist/runners/heartbeat.d.ts.map +1 -0
- package/dist/runners/heartbeat.js +79 -0
- package/dist/runners/heartbeat.js.map +1 -0
- package/dist/runners/lock.d.ts +47 -0
- package/dist/runners/lock.d.ts.map +1 -0
- package/dist/runners/lock.js +150 -0
- package/dist/runners/lock.js.map +1 -0
- package/dist/runners/orchestrator-loop.d.ts +20 -0
- package/dist/runners/orchestrator-loop.d.ts.map +1 -0
- package/dist/runners/orchestrator-loop.js +285 -0
- package/dist/runners/orchestrator-loop.js.map +1 -0
- package/dist/runners/projects.d.ts +96 -0
- package/dist/runners/projects.d.ts.map +1 -0
- package/dist/runners/projects.js +255 -0
- package/dist/runners/projects.js.map +1 -0
- package/dist/runners/wakeup.d.ts +34 -0
- package/dist/runners/wakeup.d.ts.map +1 -0
- package/dist/runners/wakeup.js +291 -0
- package/dist/runners/wakeup.js.map +1 -0
- package/migrations/001_initial_schema.sql +106 -0
- package/migrations/002_add_commit_sha.sql +12 -0
- package/migrations/003_add_section_priority.sql +13 -0
- package/migrations/004_add_section_dependencies.sql +18 -0
- package/migrations/005_add_audit_actor_model.sql +10 -0
- package/migrations/006_add_task_invocations.sql +33 -0
- package/migrations/007_add_file_anchor.sql +14 -0
- package/migrations/manifest.json +62 -0
- package/package.json +49 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Dispute creation logic
|
|
4
|
+
*
|
|
5
|
+
* Creates disputes linked to tasks, sets appropriate positions
|
|
6
|
+
* based on the actor (coder or reviewer), and updates task status.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.createDispute = createDispute;
|
|
10
|
+
exports.createCoderDispute = createCoderDispute;
|
|
11
|
+
exports.createReviewerDispute = createReviewerDispute;
|
|
12
|
+
exports.createMajorDispute = createMajorDispute;
|
|
13
|
+
exports.createMinorDispute = createMinorDispute;
|
|
14
|
+
exports.createSystemDispute = createSystemDispute;
|
|
15
|
+
exports.logMinorDisagreement = logMinorDisagreement;
|
|
16
|
+
const queries_js_1 = require("./queries.js");
|
|
17
|
+
const queries_js_2 = require("../database/queries.js");
|
|
18
|
+
// ============ Validation ============
|
|
19
|
+
/**
|
|
20
|
+
* Validate dispute creation input
|
|
21
|
+
*/
|
|
22
|
+
function validateInput(db, input) {
|
|
23
|
+
// Check task exists
|
|
24
|
+
const task = (0, queries_js_2.getTask)(db, input.taskId);
|
|
25
|
+
if (!task) {
|
|
26
|
+
return {
|
|
27
|
+
success: false,
|
|
28
|
+
error: `Task not found: ${input.taskId}`,
|
|
29
|
+
code: 'TASK_NOT_FOUND',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// Check for existing open dispute (only for non-minor disputes)
|
|
33
|
+
if (input.type !== 'minor') {
|
|
34
|
+
const existingDispute = (0, queries_js_1.getOpenDisputeForTask)(db, task.id);
|
|
35
|
+
if (existingDispute) {
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
error: `Task already has an open dispute: ${existingDispute.id}`,
|
|
39
|
+
code: 'DISPUTE_EXISTS',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
// ============ Actor Detection ============
|
|
46
|
+
/**
|
|
47
|
+
* Determine if actor is coder or reviewer based on actor string
|
|
48
|
+
*/
|
|
49
|
+
function detectActorRole(actor) {
|
|
50
|
+
const lowerActor = actor.toLowerCase();
|
|
51
|
+
// Explicit role markers
|
|
52
|
+
if (lowerActor.includes('coder') || lowerActor.includes('sonnet')) {
|
|
53
|
+
return 'coder';
|
|
54
|
+
}
|
|
55
|
+
if (lowerActor.includes('reviewer') || lowerActor.includes('opus')) {
|
|
56
|
+
return 'reviewer';
|
|
57
|
+
}
|
|
58
|
+
// Model-based inference (Sonnet is typically coder, Opus is typically reviewer)
|
|
59
|
+
if (lowerActor.includes('claude-sonnet')) {
|
|
60
|
+
return 'coder';
|
|
61
|
+
}
|
|
62
|
+
if (lowerActor.includes('claude-opus')) {
|
|
63
|
+
return 'reviewer';
|
|
64
|
+
}
|
|
65
|
+
return 'unknown';
|
|
66
|
+
}
|
|
67
|
+
// ============ Main Create Function ============
|
|
68
|
+
/**
|
|
69
|
+
* Create a new dispute for a task
|
|
70
|
+
*
|
|
71
|
+
* This function:
|
|
72
|
+
* 1. Validates the input
|
|
73
|
+
* 2. Creates the dispute record
|
|
74
|
+
* 3. Sets the position based on actor role (coder or reviewer)
|
|
75
|
+
* 4. Updates task status to 'disputed' (except for minor disputes)
|
|
76
|
+
* 5. Adds an audit entry
|
|
77
|
+
*/
|
|
78
|
+
function createDispute(db, input) {
|
|
79
|
+
// Validate input
|
|
80
|
+
const validationError = validateInput(db, input);
|
|
81
|
+
if (validationError) {
|
|
82
|
+
return validationError;
|
|
83
|
+
}
|
|
84
|
+
// Get the task (we know it exists from validation)
|
|
85
|
+
const task = (0, queries_js_2.getTask)(db, input.taskId);
|
|
86
|
+
// Determine actor role and set appropriate position
|
|
87
|
+
const role = detectActorRole(input.createdBy);
|
|
88
|
+
let coderPosition;
|
|
89
|
+
let reviewerPosition;
|
|
90
|
+
if (role === 'coder') {
|
|
91
|
+
coderPosition = input.position;
|
|
92
|
+
}
|
|
93
|
+
else if (role === 'reviewer') {
|
|
94
|
+
reviewerPosition = input.position;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// Unknown role - set as coder position by default for 'coder' type disputes
|
|
98
|
+
// and reviewer position for 'reviewer' type disputes
|
|
99
|
+
if (input.type === 'reviewer') {
|
|
100
|
+
reviewerPosition = input.position;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
coderPosition = input.position;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Create the dispute record
|
|
107
|
+
const disputeId = (0, queries_js_1.insertDispute)(db, {
|
|
108
|
+
taskId: task.id,
|
|
109
|
+
type: input.type,
|
|
110
|
+
reason: input.reason,
|
|
111
|
+
createdBy: input.createdBy,
|
|
112
|
+
coderPosition,
|
|
113
|
+
reviewerPosition,
|
|
114
|
+
});
|
|
115
|
+
// Update task status to 'disputed' (except for minor disputes)
|
|
116
|
+
let taskStatusUpdated = false;
|
|
117
|
+
if (input.type !== 'minor' && task.status !== 'disputed') {
|
|
118
|
+
(0, queries_js_2.updateTaskStatus)(db, task.id, 'disputed', input.createdBy, `Dispute created: ${input.reason}`);
|
|
119
|
+
taskStatusUpdated = true;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
success: true,
|
|
123
|
+
disputeId,
|
|
124
|
+
taskId: task.id,
|
|
125
|
+
type: input.type,
|
|
126
|
+
taskStatusUpdated,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// ============ Specialized Create Functions ============
|
|
130
|
+
/**
|
|
131
|
+
* Create a coder dispute (coder disagrees with reviewer rejection)
|
|
132
|
+
*/
|
|
133
|
+
function createCoderDispute(db, taskId, reason, position, model) {
|
|
134
|
+
return createDispute(db, {
|
|
135
|
+
taskId,
|
|
136
|
+
type: 'coder',
|
|
137
|
+
reason,
|
|
138
|
+
position,
|
|
139
|
+
createdBy: `model:${model}`,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Create a reviewer dispute (reviewer raises concern)
|
|
144
|
+
*/
|
|
145
|
+
function createReviewerDispute(db, taskId, reason, position, model) {
|
|
146
|
+
return createDispute(db, {
|
|
147
|
+
taskId,
|
|
148
|
+
type: 'reviewer',
|
|
149
|
+
reason,
|
|
150
|
+
position,
|
|
151
|
+
createdBy: `model:${model}`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create a major dispute (blocks task, requires human resolution)
|
|
156
|
+
*/
|
|
157
|
+
function createMajorDispute(db, taskId, reason, position, createdBy) {
|
|
158
|
+
return createDispute(db, {
|
|
159
|
+
taskId,
|
|
160
|
+
type: 'major',
|
|
161
|
+
reason,
|
|
162
|
+
position,
|
|
163
|
+
createdBy,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Create a minor dispute (logged only, doesn't block)
|
|
168
|
+
*/
|
|
169
|
+
function createMinorDispute(db, taskId, reason, position, createdBy) {
|
|
170
|
+
return createDispute(db, {
|
|
171
|
+
taskId,
|
|
172
|
+
type: 'minor',
|
|
173
|
+
reason,
|
|
174
|
+
position,
|
|
175
|
+
createdBy,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create a system dispute (auto-created after 15 rejections)
|
|
180
|
+
* Called from the task rejection logic
|
|
181
|
+
*/
|
|
182
|
+
function createSystemDispute(db, taskId, reason = 'Exceeded 15 rejections') {
|
|
183
|
+
return createDispute(db, {
|
|
184
|
+
taskId,
|
|
185
|
+
type: 'system',
|
|
186
|
+
reason,
|
|
187
|
+
position: 'Task exceeded maximum rejection count and requires human intervention.',
|
|
188
|
+
createdBy: 'system',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// ============ Log Minor Disagreement ============
|
|
192
|
+
/**
|
|
193
|
+
* Log a minor disagreement without changing task status
|
|
194
|
+
* Used for non-blocking style/preference disagreements
|
|
195
|
+
*/
|
|
196
|
+
function logMinorDisagreement(db, taskId, notes, createdBy) {
|
|
197
|
+
const task = (0, queries_js_2.getTask)(db, taskId);
|
|
198
|
+
if (!task) {
|
|
199
|
+
return {
|
|
200
|
+
success: false,
|
|
201
|
+
error: `Task not found: ${taskId}`,
|
|
202
|
+
code: 'TASK_NOT_FOUND',
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
const disputeId = (0, queries_js_1.insertDispute)(db, {
|
|
206
|
+
taskId: task.id,
|
|
207
|
+
type: 'minor',
|
|
208
|
+
reason: 'style',
|
|
209
|
+
createdBy,
|
|
210
|
+
coderPosition: notes,
|
|
211
|
+
});
|
|
212
|
+
// Add audit entry for the minor disagreement
|
|
213
|
+
(0, queries_js_2.addAuditEntry)(db, task.id, task.status, task.status, createdBy, `Minor disagreement logged: ${notes}`);
|
|
214
|
+
return {
|
|
215
|
+
success: true,
|
|
216
|
+
disputeId,
|
|
217
|
+
taskId: task.id,
|
|
218
|
+
type: 'minor',
|
|
219
|
+
taskStatusUpdated: false,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/disputes/create.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAuGH,sCA8DC;AAOD,gDAcC;AAKD,sDAcC;AAKD,gDAcC;AAKD,gDAcC;AAMD,kDAYC;AAQD,oDAwCC;AAlTD,6CAAoE;AACpE,uDAAkF;AA0BlF,uCAAuC;AAEvC;;GAEG;AACH,SAAS,aAAa,CACpB,EAAqB,EACrB,KAAyB;IAEzB,oBAAoB;IACpB,MAAM,IAAI,GAAG,IAAA,oBAAO,EAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,mBAAmB,KAAK,CAAC,MAAM,EAAE;YACxC,IAAI,EAAE,gBAAgB;SACvB,CAAC;IACJ,CAAC;IAED,gEAAgE;IAChE,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,eAAe,GAAG,IAAA,kCAAqB,EAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3D,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,qCAAqC,eAAe,CAAC,EAAE,EAAE;gBAChE,IAAI,EAAE,gBAAgB;aACvB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,4C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C;QACV,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,mBAAmB,MAAM,EAAE;YAClC,IAAI,EAAE,gBAAgB;SACvB,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,0BAAa,EAAC,EAAE,EAAE;QAClC,MAAM,EAAE,IAAI,CAAC,EAAE;QACf,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,OAAO;QACf,SAAS;QACT,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,6CAA6C;IAC7C,IAAA,0BAAa,EACX,EAAE,EACF,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,SAAS,EACT,8BAA8B,KAAK,EAAE,CACtC,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,SAAS;QACT,MAAM,EAAE,IAAI,CAAC,EAAE;QACf,IAAI,EAAE,OAAO;QACb,iBAAiB,EAAE,KAAK;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disputes module
|
|
3
|
+
*
|
|
4
|
+
* Handles coder/reviewer disagreements gracefully.
|
|
5
|
+
* Disputes treat tasks as effectively complete and record
|
|
6
|
+
* both positions for optional human review.
|
|
7
|
+
*/
|
|
8
|
+
export type { DisputeType, DisputeReason, DisputeStatus, ResolutionDecision, Dispute, CreateDisputeInput, ResolveDisputeInput, } from './types.js';
|
|
9
|
+
export { DISPUTE_TYPES, DISPUTE_REASONS, DISPUTE_REASON_DESCRIPTIONS, isDisputeType, isDisputeReason, isResolutionDecision, getDisputeTypeMarker, getDisputeTypeDescription, } from './types.js';
|
|
10
|
+
export type { DisputeWithTask } from './queries.js';
|
|
11
|
+
export { getDispute, getDisputesForTask, getOpenDisputeForTask, listDisputes, getStaleDisputes, countDisputesByStatus, insertDispute, updateCoderPosition, updateReviewerPosition, resolveDispute, listDisputesWithTasks, calculateDaysOpen, } from './queries.js';
|
|
12
|
+
export type { CreateDisputeResult, CreateDisputeError, CreateDisputeOutcome, } from './create.js';
|
|
13
|
+
export { createDispute, createCoderDispute, createReviewerDispute, createMajorDispute, createMinorDispute, createSystemDispute, logMinorDisagreement, } from './create.js';
|
|
14
|
+
export type { ResolveDisputeResult, ResolveDisputeError, ResolveDisputeOutcome, } from './resolve.js';
|
|
15
|
+
export { resolve, resolveInFavorOfCoder, resolveInFavorOfReviewer, resolveWithCustomSolution, canResolve, getResolutionSummary, } from './resolve.js';
|
|
16
|
+
export type { StaleAlertType, StaleDisputesResult, StaleDisputeInfo, StaleAlertConfig, AlertResult, StaleCheckOptions, } from './stale.js';
|
|
17
|
+
export { DEFAULT_TIMEOUT_DAYS, checkStaleDisputes, getStaleDisputeSummary, alertStaleDisputes, performStaleCheck, listOpenDisputesByAge, formatDisputeAge, } from './stale.js';
|
|
18
|
+
export { generateDisputeMarkdown, writeDisputeFile, readDisputeFile, disputeFileExists, getDisputeFilePath, updateDisputeFile, generateSingleDisputeMarkdown, } from './markdown.js';
|
|
19
|
+
export type { DisputeBehaviorConfig, LoopBlockResult, DisputeBehavior, DisputeCreatedActions, DisputedTaskHandling, } from './behavior.js';
|
|
20
|
+
export { DEFAULT_DISPUTE_BEHAVIOR, checkLoopBlocked, getDisputeBehavior, getActionsOnDisputeCreated, getDisputeLoopSummary, canLoopProceed, getDisputedTaskHandling, TERMINAL_STATUSES, isTerminalStatus, } from './behavior.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/disputes/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B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,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Disputes module
|
|
4
|
+
*
|
|
5
|
+
* Handles coder/reviewer disagreements gracefully.
|
|
6
|
+
* Disputes treat tasks as effectively complete and record
|
|
7
|
+
* both positions for optional human review.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getDisputeBehavior = exports.checkLoopBlocked = exports.DEFAULT_DISPUTE_BEHAVIOR = exports.generateSingleDisputeMarkdown = exports.updateDisputeFile = exports.getDisputeFilePath = exports.disputeFileExists = exports.readDisputeFile = exports.writeDisputeFile = exports.generateDisputeMarkdown = exports.formatDisputeAge = exports.listOpenDisputesByAge = exports.performStaleCheck = exports.alertStaleDisputes = exports.getStaleDisputeSummary = exports.checkStaleDisputes = exports.DEFAULT_TIMEOUT_DAYS = exports.getResolutionSummary = exports.canResolve = exports.resolveWithCustomSolution = exports.resolveInFavorOfReviewer = exports.resolveInFavorOfCoder = exports.resolve = exports.logMinorDisagreement = exports.createSystemDispute = exports.createMinorDispute = exports.createMajorDispute = exports.createReviewerDispute = exports.createCoderDispute = exports.createDispute = exports.calculateDaysOpen = exports.listDisputesWithTasks = exports.resolveDispute = exports.updateReviewerPosition = exports.updateCoderPosition = exports.insertDispute = exports.countDisputesByStatus = exports.getStaleDisputes = exports.listDisputes = exports.getOpenDisputeForTask = exports.getDisputesForTask = exports.getDispute = exports.getDisputeTypeDescription = exports.getDisputeTypeMarker = exports.isResolutionDecision = exports.isDisputeReason = exports.isDisputeType = exports.DISPUTE_REASON_DESCRIPTIONS = exports.DISPUTE_REASONS = exports.DISPUTE_TYPES = void 0;
|
|
11
|
+
exports.isTerminalStatus = exports.TERMINAL_STATUSES = exports.getDisputedTaskHandling = exports.canLoopProceed = exports.getDisputeLoopSummary = exports.getActionsOnDisputeCreated = void 0;
|
|
12
|
+
var types_js_1 = require("./types.js");
|
|
13
|
+
Object.defineProperty(exports, "DISPUTE_TYPES", { enumerable: true, get: function () { return types_js_1.DISPUTE_TYPES; } });
|
|
14
|
+
Object.defineProperty(exports, "DISPUTE_REASONS", { enumerable: true, get: function () { return types_js_1.DISPUTE_REASONS; } });
|
|
15
|
+
Object.defineProperty(exports, "DISPUTE_REASON_DESCRIPTIONS", { enumerable: true, get: function () { return types_js_1.DISPUTE_REASON_DESCRIPTIONS; } });
|
|
16
|
+
Object.defineProperty(exports, "isDisputeType", { enumerable: true, get: function () { return types_js_1.isDisputeType; } });
|
|
17
|
+
Object.defineProperty(exports, "isDisputeReason", { enumerable: true, get: function () { return types_js_1.isDisputeReason; } });
|
|
18
|
+
Object.defineProperty(exports, "isResolutionDecision", { enumerable: true, get: function () { return types_js_1.isResolutionDecision; } });
|
|
19
|
+
Object.defineProperty(exports, "getDisputeTypeMarker", { enumerable: true, get: function () { return types_js_1.getDisputeTypeMarker; } });
|
|
20
|
+
Object.defineProperty(exports, "getDisputeTypeDescription", { enumerable: true, get: function () { return types_js_1.getDisputeTypeDescription; } });
|
|
21
|
+
var queries_js_1 = require("./queries.js");
|
|
22
|
+
Object.defineProperty(exports, "getDispute", { enumerable: true, get: function () { return queries_js_1.getDispute; } });
|
|
23
|
+
Object.defineProperty(exports, "getDisputesForTask", { enumerable: true, get: function () { return queries_js_1.getDisputesForTask; } });
|
|
24
|
+
Object.defineProperty(exports, "getOpenDisputeForTask", { enumerable: true, get: function () { return queries_js_1.getOpenDisputeForTask; } });
|
|
25
|
+
Object.defineProperty(exports, "listDisputes", { enumerable: true, get: function () { return queries_js_1.listDisputes; } });
|
|
26
|
+
Object.defineProperty(exports, "getStaleDisputes", { enumerable: true, get: function () { return queries_js_1.getStaleDisputes; } });
|
|
27
|
+
Object.defineProperty(exports, "countDisputesByStatus", { enumerable: true, get: function () { return queries_js_1.countDisputesByStatus; } });
|
|
28
|
+
Object.defineProperty(exports, "insertDispute", { enumerable: true, get: function () { return queries_js_1.insertDispute; } });
|
|
29
|
+
Object.defineProperty(exports, "updateCoderPosition", { enumerable: true, get: function () { return queries_js_1.updateCoderPosition; } });
|
|
30
|
+
Object.defineProperty(exports, "updateReviewerPosition", { enumerable: true, get: function () { return queries_js_1.updateReviewerPosition; } });
|
|
31
|
+
Object.defineProperty(exports, "resolveDispute", { enumerable: true, get: function () { return queries_js_1.resolveDispute; } });
|
|
32
|
+
Object.defineProperty(exports, "listDisputesWithTasks", { enumerable: true, get: function () { return queries_js_1.listDisputesWithTasks; } });
|
|
33
|
+
Object.defineProperty(exports, "calculateDaysOpen", { enumerable: true, get: function () { return queries_js_1.calculateDaysOpen; } });
|
|
34
|
+
var create_js_1 = require("./create.js");
|
|
35
|
+
Object.defineProperty(exports, "createDispute", { enumerable: true, get: function () { return create_js_1.createDispute; } });
|
|
36
|
+
Object.defineProperty(exports, "createCoderDispute", { enumerable: true, get: function () { return create_js_1.createCoderDispute; } });
|
|
37
|
+
Object.defineProperty(exports, "createReviewerDispute", { enumerable: true, get: function () { return create_js_1.createReviewerDispute; } });
|
|
38
|
+
Object.defineProperty(exports, "createMajorDispute", { enumerable: true, get: function () { return create_js_1.createMajorDispute; } });
|
|
39
|
+
Object.defineProperty(exports, "createMinorDispute", { enumerable: true, get: function () { return create_js_1.createMinorDispute; } });
|
|
40
|
+
Object.defineProperty(exports, "createSystemDispute", { enumerable: true, get: function () { return create_js_1.createSystemDispute; } });
|
|
41
|
+
Object.defineProperty(exports, "logMinorDisagreement", { enumerable: true, get: function () { return create_js_1.logMinorDisagreement; } });
|
|
42
|
+
var resolve_js_1 = require("./resolve.js");
|
|
43
|
+
Object.defineProperty(exports, "resolve", { enumerable: true, get: function () { return resolve_js_1.resolve; } });
|
|
44
|
+
Object.defineProperty(exports, "resolveInFavorOfCoder", { enumerable: true, get: function () { return resolve_js_1.resolveInFavorOfCoder; } });
|
|
45
|
+
Object.defineProperty(exports, "resolveInFavorOfReviewer", { enumerable: true, get: function () { return resolve_js_1.resolveInFavorOfReviewer; } });
|
|
46
|
+
Object.defineProperty(exports, "resolveWithCustomSolution", { enumerable: true, get: function () { return resolve_js_1.resolveWithCustomSolution; } });
|
|
47
|
+
Object.defineProperty(exports, "canResolve", { enumerable: true, get: function () { return resolve_js_1.canResolve; } });
|
|
48
|
+
Object.defineProperty(exports, "getResolutionSummary", { enumerable: true, get: function () { return resolve_js_1.getResolutionSummary; } });
|
|
49
|
+
var stale_js_1 = require("./stale.js");
|
|
50
|
+
Object.defineProperty(exports, "DEFAULT_TIMEOUT_DAYS", { enumerable: true, get: function () { return stale_js_1.DEFAULT_TIMEOUT_DAYS; } });
|
|
51
|
+
Object.defineProperty(exports, "checkStaleDisputes", { enumerable: true, get: function () { return stale_js_1.checkStaleDisputes; } });
|
|
52
|
+
Object.defineProperty(exports, "getStaleDisputeSummary", { enumerable: true, get: function () { return stale_js_1.getStaleDisputeSummary; } });
|
|
53
|
+
Object.defineProperty(exports, "alertStaleDisputes", { enumerable: true, get: function () { return stale_js_1.alertStaleDisputes; } });
|
|
54
|
+
Object.defineProperty(exports, "performStaleCheck", { enumerable: true, get: function () { return stale_js_1.performStaleCheck; } });
|
|
55
|
+
Object.defineProperty(exports, "listOpenDisputesByAge", { enumerable: true, get: function () { return stale_js_1.listOpenDisputesByAge; } });
|
|
56
|
+
Object.defineProperty(exports, "formatDisputeAge", { enumerable: true, get: function () { return stale_js_1.formatDisputeAge; } });
|
|
57
|
+
// Markdown log generation
|
|
58
|
+
var markdown_js_1 = require("./markdown.js");
|
|
59
|
+
Object.defineProperty(exports, "generateDisputeMarkdown", { enumerable: true, get: function () { return markdown_js_1.generateDisputeMarkdown; } });
|
|
60
|
+
Object.defineProperty(exports, "writeDisputeFile", { enumerable: true, get: function () { return markdown_js_1.writeDisputeFile; } });
|
|
61
|
+
Object.defineProperty(exports, "readDisputeFile", { enumerable: true, get: function () { return markdown_js_1.readDisputeFile; } });
|
|
62
|
+
Object.defineProperty(exports, "disputeFileExists", { enumerable: true, get: function () { return markdown_js_1.disputeFileExists; } });
|
|
63
|
+
Object.defineProperty(exports, "getDisputeFilePath", { enumerable: true, get: function () { return markdown_js_1.getDisputeFilePath; } });
|
|
64
|
+
Object.defineProperty(exports, "updateDisputeFile", { enumerable: true, get: function () { return markdown_js_1.updateDisputeFile; } });
|
|
65
|
+
Object.defineProperty(exports, "generateSingleDisputeMarkdown", { enumerable: true, get: function () { return markdown_js_1.generateSingleDisputeMarkdown; } });
|
|
66
|
+
var behavior_js_1 = require("./behavior.js");
|
|
67
|
+
Object.defineProperty(exports, "DEFAULT_DISPUTE_BEHAVIOR", { enumerable: true, get: function () { return behavior_js_1.DEFAULT_DISPUTE_BEHAVIOR; } });
|
|
68
|
+
Object.defineProperty(exports, "checkLoopBlocked", { enumerable: true, get: function () { return behavior_js_1.checkLoopBlocked; } });
|
|
69
|
+
Object.defineProperty(exports, "getDisputeBehavior", { enumerable: true, get: function () { return behavior_js_1.getDisputeBehavior; } });
|
|
70
|
+
Object.defineProperty(exports, "getActionsOnDisputeCreated", { enumerable: true, get: function () { return behavior_js_1.getActionsOnDisputeCreated; } });
|
|
71
|
+
Object.defineProperty(exports, "getDisputeLoopSummary", { enumerable: true, get: function () { return behavior_js_1.getDisputeLoopSummary; } });
|
|
72
|
+
Object.defineProperty(exports, "canLoopProceed", { enumerable: true, get: function () { return behavior_js_1.canLoopProceed; } });
|
|
73
|
+
Object.defineProperty(exports, "getDisputedTaskHandling", { enumerable: true, get: function () { return behavior_js_1.getDisputedTaskHandling; } });
|
|
74
|
+
Object.defineProperty(exports, "TERMINAL_STATUSES", { enumerable: true, get: function () { return behavior_js_1.TERMINAL_STATUSES; } });
|
|
75
|
+
Object.defineProperty(exports, "isTerminalStatus", { enumerable: true, get: function () { return behavior_js_1.isTerminalStatus; } });
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/disputes/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAaH,uCASoB;AARlB,yGAAA,aAAa,OAAA;AACb,2GAAA,eAAe,OAAA;AACf,uHAAA,2BAA2B,OAAA;AAC3B,yGAAA,aAAa,OAAA;AACb,2GAAA,eAAe,OAAA;AACf,gHAAA,oBAAoB,OAAA;AACpB,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AAM3B,2CAasB;AAZpB,wGAAA,UAAU,OAAA;AACV,gHAAA,kBAAkB,OAAA;AAClB,mHAAA,qBAAqB,OAAA;AACrB,0GAAA,YAAY,OAAA;AACZ,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA;AACrB,2GAAA,aAAa,OAAA;AACb,iHAAA,mBAAmB,OAAA;AACnB,oHAAA,sBAAsB,OAAA;AACtB,4GAAA,cAAc,OAAA;AACd,mHAAA,qBAAqB,OAAA;AACrB,+GAAA,iBAAiB,OAAA;AAUnB,yCAQqB;AAPnB,0GAAA,aAAa,OAAA;AACb,+GAAA,kBAAkB,OAAA;AAClB,kHAAA,qBAAqB,OAAA;AACrB,+GAAA,kBAAkB,OAAA;AAClB,+GAAA,kBAAkB,OAAA;AAClB,gHAAA,mBAAmB,OAAA;AACnB,iHAAA,oBAAoB,OAAA;AAUtB,2CAOsB;AANpB,qGAAA,OAAO,OAAA;AACP,mHAAA,qBAAqB,OAAA;AACrB,sHAAA,wBAAwB,OAAA;AACxB,uHAAA,yBAAyB,OAAA;AACzB,wGAAA,UAAU,OAAA;AACV,kHAAA,oBAAoB,OAAA;AAatB,uCAQoB;AAPlB,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,kHAAA,sBAAsB,OAAA;AACtB,8GAAA,kBAAkB,OAAA;AAClB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA;AACrB,4GAAA,gBAAgB,OAAA;AAGlB,0BAA0B;AAC1B,6CAQuB;AAPrB,sHAAA,uBAAuB,OAAA;AACvB,+GAAA,gBAAgB,OAAA;AAChB,8GAAA,eAAe,OAAA;AACf,gHAAA,iBAAiB,OAAA;AACjB,iHAAA,kBAAkB,OAAA;AAClB,gHAAA,iBAAiB,OAAA;AACjB,4HAAA,6BAA6B,OAAA;AAY/B,6CAUuB;AATrB,uHAAA,wBAAwB,OAAA;AACxB,+GAAA,gBAAgB,OAAA;AAChB,iHAAA,kBAAkB,OAAA;AAClB,yHAAA,0BAA0B,OAAA;AAC1B,oHAAA,qBAAqB,OAAA;AACrB,6GAAA,cAAc,OAAA;AACd,sHAAA,uBAAuB,OAAA;AACvB,gHAAA,iBAAiB,OAAA;AACjB,+GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispute markdown log generation
|
|
3
|
+
*
|
|
4
|
+
* Creates and updates a human-readable dispute.md file in the project root.
|
|
5
|
+
* This file provides a quick overview of all disputes for human review.
|
|
6
|
+
*/
|
|
7
|
+
import type Database from 'better-sqlite3';
|
|
8
|
+
import { type DisputeWithTask } from './queries.js';
|
|
9
|
+
/**
|
|
10
|
+
* Generate markdown content for all disputes
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateDisputeMarkdown(db: Database.Database): string;
|
|
13
|
+
/**
|
|
14
|
+
* Write dispute.md file to project root
|
|
15
|
+
*/
|
|
16
|
+
export declare function writeDisputeFile(db: Database.Database, projectPath?: string): {
|
|
17
|
+
path: string;
|
|
18
|
+
created: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Read current dispute.md content
|
|
22
|
+
*/
|
|
23
|
+
export declare function readDisputeFile(projectPath?: string): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Check if dispute.md exists
|
|
26
|
+
*/
|
|
27
|
+
export declare function disputeFileExists(projectPath?: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Get dispute.md file path
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDisputeFilePath(projectPath?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Update dispute.md after a dispute is created or resolved
|
|
34
|
+
* Called automatically by create/resolve operations
|
|
35
|
+
*/
|
|
36
|
+
export declare function updateDisputeFile(db: Database.Database, projectPath?: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Generate markdown for a single dispute (for display in CLI)
|
|
39
|
+
*/
|
|
40
|
+
export declare function generateSingleDisputeMarkdown(dispute: DisputeWithTask): string;
|
|
41
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/disputes/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAetB;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAsDrE;AAsJD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,WAAW,CAAC,EAAE,MAAM,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAYpC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAI/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAG/D;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,WAAW,CAAC,EAAE,MAAM,GACnB,IAAI,CAEN;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE9E"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Dispute markdown log generation
|
|
4
|
+
*
|
|
5
|
+
* Creates and updates a human-readable dispute.md file in the project root.
|
|
6
|
+
* This file provides a quick overview of all disputes for human review.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.generateDisputeMarkdown = generateDisputeMarkdown;
|
|
10
|
+
exports.writeDisputeFile = writeDisputeFile;
|
|
11
|
+
exports.readDisputeFile = readDisputeFile;
|
|
12
|
+
exports.disputeFileExists = disputeFileExists;
|
|
13
|
+
exports.getDisputeFilePath = getDisputeFilePath;
|
|
14
|
+
exports.updateDisputeFile = updateDisputeFile;
|
|
15
|
+
exports.generateSingleDisputeMarkdown = generateSingleDisputeMarkdown;
|
|
16
|
+
const node_fs_1 = require("node:fs");
|
|
17
|
+
const node_path_1 = require("node:path");
|
|
18
|
+
const queries_js_1 = require("./queries.js");
|
|
19
|
+
const types_js_1 = require("./types.js");
|
|
20
|
+
// ============ Configuration ============
|
|
21
|
+
const DISPUTE_FILE_NAME = 'dispute.md';
|
|
22
|
+
// ============ Markdown Generation ============
|
|
23
|
+
/**
|
|
24
|
+
* Generate markdown content for all disputes
|
|
25
|
+
*/
|
|
26
|
+
function generateDisputeMarkdown(db) {
|
|
27
|
+
const openDisputes = (0, queries_js_1.listDisputesWithTasks)(db, { status: 'open' });
|
|
28
|
+
const resolvedDisputes = (0, queries_js_1.listDisputesWithTasks)(db, { status: 'resolved' });
|
|
29
|
+
const lines = [];
|
|
30
|
+
// Header
|
|
31
|
+
lines.push('# Disputes');
|
|
32
|
+
lines.push('');
|
|
33
|
+
lines.push('> This file is auto-generated by Steroids CLI.');
|
|
34
|
+
lines.push('> It provides a human-readable view of coder/reviewer disagreements.');
|
|
35
|
+
lines.push('');
|
|
36
|
+
// Summary
|
|
37
|
+
lines.push('## Summary');
|
|
38
|
+
lines.push('');
|
|
39
|
+
lines.push(`- **Open disputes:** ${openDisputes.length}`);
|
|
40
|
+
lines.push(`- **Resolved disputes:** ${resolvedDisputes.length}`);
|
|
41
|
+
lines.push(`- **Total disputes:** ${openDisputes.length + resolvedDisputes.length}`);
|
|
42
|
+
lines.push('');
|
|
43
|
+
// Open Disputes
|
|
44
|
+
if (openDisputes.length > 0) {
|
|
45
|
+
lines.push('---');
|
|
46
|
+
lines.push('');
|
|
47
|
+
lines.push('## Active Disputes');
|
|
48
|
+
lines.push('');
|
|
49
|
+
for (const dispute of openDisputes) {
|
|
50
|
+
lines.push(generateDisputeSection(dispute));
|
|
51
|
+
lines.push('');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Resolved Disputes
|
|
55
|
+
if (resolvedDisputes.length > 0) {
|
|
56
|
+
lines.push('---');
|
|
57
|
+
lines.push('');
|
|
58
|
+
lines.push('## Resolved Disputes');
|
|
59
|
+
lines.push('');
|
|
60
|
+
for (const dispute of resolvedDisputes) {
|
|
61
|
+
lines.push(generateDisputeSection(dispute));
|
|
62
|
+
lines.push('');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Footer
|
|
66
|
+
lines.push('---');
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push(`*Last updated: ${new Date().toISOString()}*`);
|
|
69
|
+
lines.push('');
|
|
70
|
+
return lines.join('\n');
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Generate markdown section for a single dispute
|
|
74
|
+
*/
|
|
75
|
+
function generateDisputeSection(dispute) {
|
|
76
|
+
const lines = [];
|
|
77
|
+
const shortId = dispute.id.substring(0, 8);
|
|
78
|
+
const taskShortId = dispute.task_id.substring(0, 8);
|
|
79
|
+
const statusBadge = getStatusBadge(dispute.status, dispute.resolution);
|
|
80
|
+
const typeBadge = getTypeBadge(dispute.type);
|
|
81
|
+
// Header with badges
|
|
82
|
+
lines.push(`### Dispute: ${shortId} ${statusBadge}`);
|
|
83
|
+
lines.push('');
|
|
84
|
+
// Metadata table
|
|
85
|
+
lines.push(`| Field | Value |`);
|
|
86
|
+
lines.push(`|-------|-------|`);
|
|
87
|
+
lines.push(`| **Task** | ${dispute.task_title} (\`${taskShortId}\`) |`);
|
|
88
|
+
lines.push(`| **Type** | ${typeBadge} ${dispute.type} |`);
|
|
89
|
+
lines.push(`| **Reason** | ${formatReason(dispute.reason)} |`);
|
|
90
|
+
lines.push(`| **Created** | ${formatDate(dispute.created_at)} (${(0, queries_js_1.calculateDaysOpen)(dispute.created_at)} days ago) |`);
|
|
91
|
+
lines.push(`| **Created By** | ${dispute.created_by} |`);
|
|
92
|
+
lines.push('');
|
|
93
|
+
// Coder Position
|
|
94
|
+
if (dispute.coder_position) {
|
|
95
|
+
lines.push('#### Coder Position');
|
|
96
|
+
lines.push('');
|
|
97
|
+
lines.push(dispute.coder_position);
|
|
98
|
+
lines.push('');
|
|
99
|
+
}
|
|
100
|
+
// Reviewer Position
|
|
101
|
+
if (dispute.reviewer_position) {
|
|
102
|
+
lines.push('#### Reviewer Position');
|
|
103
|
+
lines.push('');
|
|
104
|
+
lines.push(dispute.reviewer_position);
|
|
105
|
+
lines.push('');
|
|
106
|
+
}
|
|
107
|
+
// Resolution (if resolved)
|
|
108
|
+
if (dispute.status === 'resolved' && dispute.resolution) {
|
|
109
|
+
lines.push('#### Resolution');
|
|
110
|
+
lines.push('');
|
|
111
|
+
lines.push(`**Decision:** ${formatResolution(dispute.resolution)}`);
|
|
112
|
+
if (dispute.resolved_by) {
|
|
113
|
+
lines.push(`**Resolved By:** ${dispute.resolved_by}`);
|
|
114
|
+
}
|
|
115
|
+
if (dispute.resolved_at) {
|
|
116
|
+
lines.push(`**Resolved At:** ${formatDate(dispute.resolved_at)}`);
|
|
117
|
+
}
|
|
118
|
+
if (dispute.resolution_notes) {
|
|
119
|
+
lines.push('');
|
|
120
|
+
lines.push(`**Notes:** ${dispute.resolution_notes}`);
|
|
121
|
+
}
|
|
122
|
+
lines.push('');
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Status for open disputes
|
|
126
|
+
lines.push('#### Status');
|
|
127
|
+
lines.push('');
|
|
128
|
+
lines.push('**AWAITING HUMAN DECISION**');
|
|
129
|
+
lines.push('');
|
|
130
|
+
lines.push(`Run \`steroids dispute resolve ${shortId} --decision <coder|reviewer>\` to resolve.`);
|
|
131
|
+
lines.push('');
|
|
132
|
+
}
|
|
133
|
+
return lines.join('\n');
|
|
134
|
+
}
|
|
135
|
+
// ============ Formatting Helpers ============
|
|
136
|
+
/**
|
|
137
|
+
* Get status badge emoji
|
|
138
|
+
*/
|
|
139
|
+
function getStatusBadge(status, resolution) {
|
|
140
|
+
if (status === 'open') {
|
|
141
|
+
return '[OPEN]';
|
|
142
|
+
}
|
|
143
|
+
if (resolution === 'coder') {
|
|
144
|
+
return '[RESOLVED: CODER]';
|
|
145
|
+
}
|
|
146
|
+
if (resolution === 'reviewer') {
|
|
147
|
+
return '[RESOLVED: REVIEWER]';
|
|
148
|
+
}
|
|
149
|
+
if (resolution === 'custom') {
|
|
150
|
+
return '[RESOLVED: CUSTOM]';
|
|
151
|
+
}
|
|
152
|
+
return '[RESOLVED]';
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get type badge emoji
|
|
156
|
+
*/
|
|
157
|
+
function getTypeBadge(type) {
|
|
158
|
+
switch (type) {
|
|
159
|
+
case 'major':
|
|
160
|
+
return '!!';
|
|
161
|
+
case 'minor':
|
|
162
|
+
return '~';
|
|
163
|
+
case 'coder':
|
|
164
|
+
return 'C';
|
|
165
|
+
case 'reviewer':
|
|
166
|
+
return 'R';
|
|
167
|
+
case 'system':
|
|
168
|
+
return 'S';
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Format reason with description if standard
|
|
173
|
+
*/
|
|
174
|
+
function formatReason(reason) {
|
|
175
|
+
if ((0, types_js_1.isDisputeReason)(reason)) {
|
|
176
|
+
return `${reason} - ${types_js_1.DISPUTE_REASON_DESCRIPTIONS[reason]}`;
|
|
177
|
+
}
|
|
178
|
+
return reason;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Format resolution decision
|
|
182
|
+
*/
|
|
183
|
+
function formatResolution(decision) {
|
|
184
|
+
switch (decision) {
|
|
185
|
+
case 'coder':
|
|
186
|
+
return "Coder's implementation accepted";
|
|
187
|
+
case 'reviewer':
|
|
188
|
+
return 'Reviewer position accepted, coder must fix';
|
|
189
|
+
case 'custom':
|
|
190
|
+
return 'Custom solution required';
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Format date for display
|
|
195
|
+
*/
|
|
196
|
+
function formatDate(isoDate) {
|
|
197
|
+
const date = new Date(isoDate);
|
|
198
|
+
return date.toLocaleDateString('en-US', {
|
|
199
|
+
year: 'numeric',
|
|
200
|
+
month: 'short',
|
|
201
|
+
day: 'numeric',
|
|
202
|
+
hour: '2-digit',
|
|
203
|
+
minute: '2-digit',
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
// ============ File Operations ============
|
|
207
|
+
/**
|
|
208
|
+
* Write dispute.md file to project root
|
|
209
|
+
*/
|
|
210
|
+
function writeDisputeFile(db, projectPath) {
|
|
211
|
+
const basePath = projectPath ?? process.cwd();
|
|
212
|
+
const filePath = (0, node_path_1.join)(basePath, DISPUTE_FILE_NAME);
|
|
213
|
+
const existed = (0, node_fs_1.existsSync)(filePath);
|
|
214
|
+
const content = generateDisputeMarkdown(db);
|
|
215
|
+
(0, node_fs_1.writeFileSync)(filePath, content, 'utf-8');
|
|
216
|
+
return {
|
|
217
|
+
path: filePath,
|
|
218
|
+
created: !existed,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Read current dispute.md content
|
|
223
|
+
*/
|
|
224
|
+
function readDisputeFile(projectPath) {
|
|
225
|
+
const basePath = projectPath ?? process.cwd();
|
|
226
|
+
const filePath = (0, node_path_1.join)(basePath, DISPUTE_FILE_NAME);
|
|
227
|
+
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return (0, node_fs_1.readFileSync)(filePath, 'utf-8');
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Check if dispute.md exists
|
|
234
|
+
*/
|
|
235
|
+
function disputeFileExists(projectPath) {
|
|
236
|
+
const basePath = projectPath ?? process.cwd();
|
|
237
|
+
const filePath = (0, node_path_1.join)(basePath, DISPUTE_FILE_NAME);
|
|
238
|
+
return (0, node_fs_1.existsSync)(filePath);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Get dispute.md file path
|
|
242
|
+
*/
|
|
243
|
+
function getDisputeFilePath(projectPath) {
|
|
244
|
+
const basePath = projectPath ?? process.cwd();
|
|
245
|
+
return (0, node_path_1.join)(basePath, DISPUTE_FILE_NAME);
|
|
246
|
+
}
|
|
247
|
+
// ============ Update Operations ============
|
|
248
|
+
/**
|
|
249
|
+
* Update dispute.md after a dispute is created or resolved
|
|
250
|
+
* Called automatically by create/resolve operations
|
|
251
|
+
*/
|
|
252
|
+
function updateDisputeFile(db, projectPath) {
|
|
253
|
+
writeDisputeFile(db, projectPath);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Generate markdown for a single dispute (for display in CLI)
|
|
257
|
+
*/
|
|
258
|
+
function generateSingleDisputeMarkdown(dispute) {
|
|
259
|
+
return generateDisputeSection(dispute);
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=markdown.js.map
|