@covibes/zeroshot 5.4.0 → 5.4.1
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 +1 -1
- package/README.md +8 -465
- package/cli/index.js +101 -5231
- package/package.json +16 -130
- package/CHANGELOG.md +0 -537
- package/cli/commands/providers.js +0 -149
- package/cli/lib/first-run.js +0 -211
- package/cli/lib/update-checker.js +0 -281
- package/cli/message-formatter-utils.js +0 -75
- package/cli/message-formatters-normal.js +0 -275
- package/cli/message-formatters-watch.js +0 -181
- package/cluster-templates/base-templates/debug-workflow.json +0 -375
- package/cluster-templates/base-templates/full-workflow.json +0 -581
- package/cluster-templates/base-templates/single-worker.json +0 -63
- package/cluster-templates/base-templates/worker-validator.json +0 -208
- package/cluster-templates/conductor-bootstrap.json +0 -124
- package/docker/zeroshot-cluster/Dockerfile +0 -152
- package/docker/zeroshot-cluster/pre-baked-deps.json +0 -28
- package/lib/completion.js +0 -174
- package/lib/docker-config.js +0 -220
- package/lib/git-remote-utils.js +0 -165
- package/lib/id-detector.js +0 -56
- package/lib/provider-defaults.js +0 -62
- package/lib/provider-detection.js +0 -59
- package/lib/provider-names.js +0 -57
- package/lib/settings/claude-auth.js +0 -78
- package/lib/settings.js +0 -503
- package/lib/stream-json-parser.js +0 -10
- package/scripts/fix-node-pty-permissions.js +0 -75
- package/scripts/record-demo.sh +0 -279
- package/scripts/setup-merge-queue.sh +0 -170
- package/scripts/test-install.sh +0 -40
- package/scripts/validate-templates.js +0 -100
- package/src/agent/agent-config.js +0 -246
- package/src/agent/agent-context-builder.js +0 -444
- package/src/agent/agent-hook-executor.js +0 -599
- package/src/agent/agent-lifecycle.js +0 -743
- package/src/agent/agent-stuck-detector.js +0 -256
- package/src/agent/agent-task-executor.js +0 -1690
- package/src/agent/agent-trigger-evaluator.js +0 -67
- package/src/agent/output-extraction.js +0 -217
- package/src/agent/output-reformatter.js +0 -175
- package/src/agent/schema-utils.js +0 -146
- package/src/agent-wrapper.js +0 -579
- package/src/agents/git-pusher-template.js +0 -285
- package/src/attach/attach-client.js +0 -438
- package/src/attach/attach-server.js +0 -543
- package/src/attach/index.js +0 -35
- package/src/attach/protocol.js +0 -220
- package/src/attach/ring-buffer.js +0 -121
- package/src/attach/socket-discovery.js +0 -267
- package/src/claude-task-runner.js +0 -574
- package/src/config-router.js +0 -80
- package/src/config-validator.js +0 -1925
- package/src/copy-worker.js +0 -43
- package/src/input-helpers.js +0 -65
- package/src/isolation-manager.js +0 -1471
- package/src/issue-providers/README.md +0 -305
- package/src/issue-providers/azure-devops-provider.js +0 -273
- package/src/issue-providers/base-provider.js +0 -232
- package/src/issue-providers/github-provider.js +0 -179
- package/src/issue-providers/gitlab-provider.js +0 -241
- package/src/issue-providers/index.js +0 -196
- package/src/issue-providers/jira-provider.js +0 -239
- package/src/ledger.js +0 -631
- package/src/lib/safe-exec.js +0 -88
- package/src/logic-engine.js +0 -223
- package/src/message-bus-bridge.js +0 -139
- package/src/message-bus.js +0 -249
- package/src/name-generator.js +0 -232
- package/src/orchestrator.js +0 -2815
- package/src/preflight.js +0 -639
- package/src/process-metrics.js +0 -608
- package/src/providers/anthropic/cli-builder.js +0 -73
- package/src/providers/anthropic/index.js +0 -204
- package/src/providers/anthropic/models.js +0 -23
- package/src/providers/anthropic/output-parser.js +0 -177
- package/src/providers/base-provider.js +0 -251
- package/src/providers/capabilities.js +0 -60
- package/src/providers/google/cli-builder.js +0 -55
- package/src/providers/google/index.js +0 -116
- package/src/providers/google/models.js +0 -24
- package/src/providers/google/output-parser.js +0 -101
- package/src/providers/index.js +0 -91
- package/src/providers/openai/cli-builder.js +0 -133
- package/src/providers/openai/index.js +0 -136
- package/src/providers/openai/models.js +0 -21
- package/src/providers/openai/output-parser.js +0 -143
- package/src/providers/opencode/cli-builder.js +0 -42
- package/src/providers/opencode/index.js +0 -103
- package/src/providers/opencode/models.js +0 -55
- package/src/providers/opencode/output-parser.js +0 -122
- package/src/schemas/sub-cluster.js +0 -185
- package/src/status-footer.js +0 -1026
- package/src/sub-cluster-wrapper.js +0 -601
- package/src/task-runner.js +0 -30
- package/src/template-resolver.js +0 -372
- package/src/tui/CHANGES.txt +0 -133
- package/src/tui/LAYOUT.md +0 -261
- package/src/tui/README.txt +0 -192
- package/src/tui/TWO-LEVEL-NAVIGATION.md +0 -186
- package/src/tui/data-poller.js +0 -349
- package/src/tui/demo.js +0 -208
- package/src/tui/formatters.js +0 -129
- package/src/tui/index.js +0 -193
- package/src/tui/keybindings.js +0 -324
- package/src/tui/layout.js +0 -334
- package/src/tui/renderer.js +0 -184
- package/task-lib/attachable-watcher.js +0 -309
- package/task-lib/claude-recovery.js +0 -156
- package/task-lib/commands/clean.js +0 -50
- package/task-lib/commands/episodes.js +0 -105
- package/task-lib/commands/get-log-path.js +0 -23
- package/task-lib/commands/kill.js +0 -32
- package/task-lib/commands/list.js +0 -105
- package/task-lib/commands/logs.js +0 -453
- package/task-lib/commands/resume.js +0 -42
- package/task-lib/commands/run.js +0 -57
- package/task-lib/commands/schedule.js +0 -105
- package/task-lib/commands/scheduler-cmd.js +0 -96
- package/task-lib/commands/schedules.js +0 -148
- package/task-lib/commands/status.js +0 -44
- package/task-lib/commands/unschedule.js +0 -16
- package/task-lib/completion.js +0 -9
- package/task-lib/config.js +0 -8
- package/task-lib/name-generator.js +0 -230
- package/task-lib/package.json +0 -3
- package/task-lib/runner.js +0 -201
- package/task-lib/scheduler.js +0 -252
- package/task-lib/store.js +0 -529
- package/task-lib/tui/formatters.js +0 -215
- package/task-lib/tui/index.js +0 -197
- package/task-lib/tui/layout.js +0 -111
- package/task-lib/tui/renderer.js +0 -129
- package/task-lib/tui.js +0 -425
- package/task-lib/watcher.js +0 -226
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { addSchedule, generateScheduleId, ensureDirs } from '../store.js';
|
|
3
|
-
import { parseInterval, calculateNextRun, getDaemonStatus } from '../scheduler.js';
|
|
4
|
-
import { fork } from 'child_process';
|
|
5
|
-
import { join, dirname } from 'path';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
|
|
10
|
-
export function createSchedule(prompt, options = {}) {
|
|
11
|
-
if (!prompt || prompt.trim().length === 0) {
|
|
12
|
-
console.log(chalk.red('Error: Prompt is required'));
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (!options.every && !options.cron) {
|
|
17
|
-
console.log(chalk.red('Error: Either --every or --cron is required'));
|
|
18
|
-
console.log(chalk.dim(' Examples:'));
|
|
19
|
-
console.log(chalk.dim(' zeroshot schedule "backup" --every 1d'));
|
|
20
|
-
console.log(chalk.dim(' zeroshot schedule "cleanup" --cron "0 2 * * *"'));
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
ensureDirs();
|
|
25
|
-
|
|
26
|
-
let interval = null;
|
|
27
|
-
let cron = null;
|
|
28
|
-
|
|
29
|
-
if (options.every) {
|
|
30
|
-
interval = parseInterval(options.every);
|
|
31
|
-
if (!interval) {
|
|
32
|
-
console.log(chalk.red(`Error: Invalid interval format "${options.every}"`));
|
|
33
|
-
console.log(chalk.dim(' Valid formats: 30s, 5m, 2h, 1d, 1w'));
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (options.cron) {
|
|
39
|
-
cron = options.cron;
|
|
40
|
-
// Basic validation
|
|
41
|
-
if (cron.trim().split(/\s+/).length !== 5) {
|
|
42
|
-
console.log(chalk.red(`Error: Invalid cron format "${options.cron}"`));
|
|
43
|
-
console.log(chalk.dim(' Format: minute hour day month weekday'));
|
|
44
|
-
console.log(chalk.dim(' Example: "0 2 * * *" (daily at 2am)'));
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const schedule = {
|
|
50
|
-
id: generateScheduleId(),
|
|
51
|
-
prompt: prompt.slice(0, 200) + (prompt.length > 200 ? '...' : ''),
|
|
52
|
-
fullPrompt: prompt,
|
|
53
|
-
cwd: options.cwd || process.cwd(),
|
|
54
|
-
interval,
|
|
55
|
-
cron,
|
|
56
|
-
nextRunAt: null,
|
|
57
|
-
lastRunAt: null,
|
|
58
|
-
lastTaskId: null,
|
|
59
|
-
enabled: true,
|
|
60
|
-
createdAt: new Date().toISOString(),
|
|
61
|
-
updatedAt: new Date().toISOString(),
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// Calculate first run time
|
|
65
|
-
const nextRun = calculateNextRun(schedule);
|
|
66
|
-
schedule.nextRunAt = nextRun ? nextRun.toISOString() : null;
|
|
67
|
-
|
|
68
|
-
addSchedule(schedule);
|
|
69
|
-
|
|
70
|
-
console.log(chalk.green(`\n✓ Schedule created: ${chalk.cyan(schedule.id)}`));
|
|
71
|
-
console.log(chalk.dim(` Prompt: ${schedule.prompt}`));
|
|
72
|
-
console.log(chalk.dim(` CWD: ${schedule.cwd}`));
|
|
73
|
-
|
|
74
|
-
if (interval) {
|
|
75
|
-
const humanInterval = options.every;
|
|
76
|
-
console.log(chalk.dim(` Interval: every ${humanInterval}`));
|
|
77
|
-
}
|
|
78
|
-
if (cron) {
|
|
79
|
-
console.log(chalk.dim(` Cron: ${cron}`));
|
|
80
|
-
}
|
|
81
|
-
console.log(chalk.dim(` Next run: ${nextRun ? nextRun.toISOString() : 'N/A'}`));
|
|
82
|
-
|
|
83
|
-
// Check if scheduler is running, start if not
|
|
84
|
-
const status = getDaemonStatus();
|
|
85
|
-
if (!status.running) {
|
|
86
|
-
console.log(chalk.yellow('\n⚠ Scheduler daemon is not running'));
|
|
87
|
-
console.log(chalk.dim(' Starting scheduler daemon...'));
|
|
88
|
-
|
|
89
|
-
// Fork scheduler as detached process
|
|
90
|
-
const scheduler = fork(join(__dirname, '..', 'scheduler.js'), [], {
|
|
91
|
-
detached: true,
|
|
92
|
-
stdio: 'ignore',
|
|
93
|
-
});
|
|
94
|
-
scheduler.unref();
|
|
95
|
-
|
|
96
|
-
console.log(chalk.green(' ✓ Scheduler daemon started'));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
console.log(chalk.dim('\nCommands:'));
|
|
100
|
-
console.log(chalk.dim(` zeroshot schedules # List all schedules`));
|
|
101
|
-
console.log(chalk.dim(` zeroshot unschedule ${schedule.id} # Remove this schedule`));
|
|
102
|
-
console.log();
|
|
103
|
-
|
|
104
|
-
return schedule;
|
|
105
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { fork } from 'child_process';
|
|
3
|
-
import { join, dirname } from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import { getDaemonStatus, stopDaemon } from '../scheduler.js';
|
|
6
|
-
import { SCHEDULER_LOG } from '../config.js';
|
|
7
|
-
import { existsSync, readFileSync } from 'fs';
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
|
|
11
|
-
export function schedulerCommand(action) {
|
|
12
|
-
switch (action) {
|
|
13
|
-
case 'start':
|
|
14
|
-
startScheduler();
|
|
15
|
-
break;
|
|
16
|
-
case 'stop':
|
|
17
|
-
stopScheduler();
|
|
18
|
-
break;
|
|
19
|
-
case 'status':
|
|
20
|
-
showStatus();
|
|
21
|
-
break;
|
|
22
|
-
case 'logs':
|
|
23
|
-
showLogs();
|
|
24
|
-
break;
|
|
25
|
-
default:
|
|
26
|
-
console.log(chalk.red(`Unknown action: ${action}`));
|
|
27
|
-
console.log(chalk.dim('Available actions: start, stop, status, logs'));
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function startScheduler() {
|
|
33
|
-
const status = getDaemonStatus();
|
|
34
|
-
|
|
35
|
-
if (status.running) {
|
|
36
|
-
console.log(chalk.yellow(`Scheduler already running (PID: ${status.pid})`));
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (status.stale) {
|
|
41
|
-
console.log(chalk.dim('Cleaning up stale PID file...'));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
console.log(chalk.dim('Starting scheduler daemon...'));
|
|
45
|
-
|
|
46
|
-
const scheduler = fork(join(__dirname, '..', 'scheduler.js'), [], {
|
|
47
|
-
detached: true,
|
|
48
|
-
stdio: 'ignore',
|
|
49
|
-
});
|
|
50
|
-
scheduler.unref();
|
|
51
|
-
|
|
52
|
-
// Give it a moment to start
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
const newStatus = getDaemonStatus();
|
|
55
|
-
if (newStatus.running) {
|
|
56
|
-
console.log(chalk.green(`✓ Scheduler started (PID: ${newStatus.pid})`));
|
|
57
|
-
} else {
|
|
58
|
-
console.log(chalk.red('Failed to start scheduler. Check logs:'));
|
|
59
|
-
console.log(chalk.dim(` zeroshot scheduler logs`));
|
|
60
|
-
}
|
|
61
|
-
}, 500);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function stopScheduler() {
|
|
65
|
-
const stopped = stopDaemon();
|
|
66
|
-
if (!stopped) {
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function showStatus() {
|
|
72
|
-
const status = getDaemonStatus();
|
|
73
|
-
|
|
74
|
-
if (status.running) {
|
|
75
|
-
console.log(chalk.green(`Scheduler: running`));
|
|
76
|
-
console.log(chalk.dim(` PID: ${status.pid}`));
|
|
77
|
-
console.log(chalk.dim(` Log: ${SCHEDULER_LOG}`));
|
|
78
|
-
} else if (status.stale) {
|
|
79
|
-
console.log(chalk.yellow('Scheduler: not running (stale PID file)'));
|
|
80
|
-
console.log(chalk.dim(' Run: zeroshot scheduler start'));
|
|
81
|
-
} else {
|
|
82
|
-
console.log(chalk.red('Scheduler: not running'));
|
|
83
|
-
console.log(chalk.dim(' Run: zeroshot scheduler start'));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function showLogs() {
|
|
88
|
-
if (!existsSync(SCHEDULER_LOG)) {
|
|
89
|
-
console.log(chalk.dim('No scheduler logs found.'));
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const content = readFileSync(SCHEDULER_LOG, 'utf-8');
|
|
94
|
-
const lines = content.split('\n').slice(-50); // Last 50 lines
|
|
95
|
-
console.log(lines.join('\n'));
|
|
96
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { loadSchedules } from '../store.js';
|
|
3
|
-
import { getDaemonStatus } from '../scheduler.js';
|
|
4
|
-
|
|
5
|
-
export function listSchedules(_options = {}) {
|
|
6
|
-
const schedules = loadSchedules();
|
|
7
|
-
const scheduleList = Object.values(schedules);
|
|
8
|
-
|
|
9
|
-
// Check daemon status
|
|
10
|
-
const daemonStatus = getDaemonStatus();
|
|
11
|
-
|
|
12
|
-
if (scheduleList.length === 0) {
|
|
13
|
-
printNoSchedules();
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
printDaemonStatus(daemonStatus);
|
|
18
|
-
|
|
19
|
-
// Sort by next run time
|
|
20
|
-
sortSchedulesByNextRun(scheduleList);
|
|
21
|
-
|
|
22
|
-
printScheduleHeader();
|
|
23
|
-
|
|
24
|
-
for (const schedule of scheduleList) {
|
|
25
|
-
printSchedule(schedule);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
console.log(chalk.dim(`Total: ${scheduleList.length} schedule(s)`));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function printNoSchedules() {
|
|
32
|
-
console.log(chalk.dim('No schedules found.'));
|
|
33
|
-
console.log(chalk.dim('\nCreate a schedule:'));
|
|
34
|
-
console.log(chalk.dim(' zeroshot schedule "your prompt" --every 1h'));
|
|
35
|
-
console.log(chalk.dim(' zeroshot schedule "your prompt" --cron "0 * * * *"'));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function printDaemonStatus(daemonStatus) {
|
|
39
|
-
if (daemonStatus.running) {
|
|
40
|
-
console.log(chalk.green(`Scheduler: running (PID: ${daemonStatus.pid})`));
|
|
41
|
-
} else if (daemonStatus.stale) {
|
|
42
|
-
console.log(chalk.yellow('Scheduler: not running (stale PID file)'));
|
|
43
|
-
} else {
|
|
44
|
-
console.log(chalk.red('Scheduler: not running'));
|
|
45
|
-
console.log(chalk.dim(' Run: zeroshot scheduler start'));
|
|
46
|
-
}
|
|
47
|
-
console.log();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function sortSchedulesByNextRun(scheduleList) {
|
|
51
|
-
scheduleList.sort((a, b) => {
|
|
52
|
-
if (!a.nextRunAt) return 1;
|
|
53
|
-
if (!b.nextRunAt) return -1;
|
|
54
|
-
return new Date(a.nextRunAt) - new Date(b.nextRunAt);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function printScheduleHeader() {
|
|
59
|
-
console.log(chalk.bold('Scheduled Tasks:'));
|
|
60
|
-
console.log();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function printSchedule(schedule) {
|
|
64
|
-
printScheduleHeaderLine(schedule);
|
|
65
|
-
printSchedulePrompt(schedule);
|
|
66
|
-
printScheduleInterval(schedule);
|
|
67
|
-
printScheduleCron(schedule);
|
|
68
|
-
printScheduleNextRun(schedule);
|
|
69
|
-
printScheduleLastRun(schedule);
|
|
70
|
-
printScheduleVerify(schedule);
|
|
71
|
-
console.log();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function printScheduleHeaderLine(schedule) {
|
|
75
|
-
const statusColor = schedule.enabled ? chalk.green : chalk.red;
|
|
76
|
-
const statusText = schedule.enabled ? '●' : '○';
|
|
77
|
-
console.log(`${statusColor(statusText)} ${chalk.cyan(schedule.id)}`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function printSchedulePrompt(schedule) {
|
|
81
|
-
console.log(chalk.dim(` Prompt: ${schedule.prompt}`));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function printScheduleInterval(schedule) {
|
|
85
|
-
if (!schedule.interval) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
const human = formatInterval(schedule.interval);
|
|
89
|
-
console.log(chalk.dim(` Interval: every ${human}`));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function printScheduleCron(schedule) {
|
|
93
|
-
if (schedule.cron) {
|
|
94
|
-
console.log(chalk.dim(` Cron: ${schedule.cron}`));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function printScheduleNextRun(schedule) {
|
|
99
|
-
if (!schedule.nextRunAt) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const nextRun = new Date(schedule.nextRunAt);
|
|
103
|
-
const timeUntil = formatTimeUntil(nextRun);
|
|
104
|
-
console.log(chalk.dim(` Next run: ${nextRun.toISOString()} (${timeUntil})`));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function printScheduleLastRun(schedule) {
|
|
108
|
-
if (!schedule.lastRunAt) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
console.log(chalk.dim(` Last run: ${schedule.lastRunAt}`));
|
|
112
|
-
if (schedule.lastTaskId) {
|
|
113
|
-
console.log(chalk.dim(` Last task: ${schedule.lastTaskId}`));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function printScheduleVerify(schedule) {
|
|
118
|
-
if (schedule.verify) {
|
|
119
|
-
console.log(chalk.dim(` Verify: enabled`));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function formatInterval(ms) {
|
|
124
|
-
if (ms >= 7 * 24 * 60 * 60 * 1000) return `${ms / (7 * 24 * 60 * 60 * 1000)}w`;
|
|
125
|
-
if (ms >= 24 * 60 * 60 * 1000) return `${ms / (24 * 60 * 60 * 1000)}d`;
|
|
126
|
-
if (ms >= 60 * 60 * 1000) return `${ms / (60 * 60 * 1000)}h`;
|
|
127
|
-
if (ms >= 60 * 1000) return `${ms / (60 * 1000)}m`;
|
|
128
|
-
return `${ms / 1000}s`;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function formatTimeUntil(nextRun) {
|
|
132
|
-
const now = new Date();
|
|
133
|
-
const diff = nextRun - now;
|
|
134
|
-
|
|
135
|
-
if (diff < 0) {
|
|
136
|
-
return 'overdue';
|
|
137
|
-
}
|
|
138
|
-
if (diff < 60000) {
|
|
139
|
-
return 'in < 1m';
|
|
140
|
-
}
|
|
141
|
-
if (diff < 3600000) {
|
|
142
|
-
return `in ${Math.round(diff / 60000)}m`;
|
|
143
|
-
}
|
|
144
|
-
if (diff < 86400000) {
|
|
145
|
-
return `in ${Math.round(diff / 3600000)}h`;
|
|
146
|
-
}
|
|
147
|
-
return `in ${Math.round(diff / 86400000)}d`;
|
|
148
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { getTask } from '../store.js';
|
|
3
|
-
import { isProcessRunning } from '../runner.js';
|
|
4
|
-
|
|
5
|
-
export function showStatus(taskId) {
|
|
6
|
-
const task = getTask(taskId);
|
|
7
|
-
|
|
8
|
-
if (!task) {
|
|
9
|
-
console.log(chalk.red(`Task not found: ${taskId}`));
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Verify running status
|
|
14
|
-
let status = task.status;
|
|
15
|
-
if (status === 'running' && !isProcessRunning(task.pid)) {
|
|
16
|
-
status = 'stale (process died)';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const statusColor =
|
|
20
|
-
{
|
|
21
|
-
running: chalk.green,
|
|
22
|
-
completed: chalk.green,
|
|
23
|
-
failed: chalk.red,
|
|
24
|
-
}[task.status] || chalk.yellow;
|
|
25
|
-
|
|
26
|
-
console.log(chalk.bold(`\nTask: ${task.id}\n`));
|
|
27
|
-
console.log(`${chalk.dim('Status:')} ${statusColor(status)}`);
|
|
28
|
-
console.log(`${chalk.dim('Created:')} ${task.createdAt}`);
|
|
29
|
-
console.log(`${chalk.dim('Updated:')} ${task.updatedAt}`);
|
|
30
|
-
console.log(`${chalk.dim('CWD:')} ${task.cwd}`);
|
|
31
|
-
console.log(`${chalk.dim('PID:')} ${task.pid || 'N/A'}`);
|
|
32
|
-
console.log(`${chalk.dim('Exit Code:')} ${task.exitCode ?? 'N/A'}`);
|
|
33
|
-
console.log(`${chalk.dim('Session:')} ${task.sessionId || 'N/A'}`);
|
|
34
|
-
console.log(`${chalk.dim('Log File:')} ${task.logFile}`);
|
|
35
|
-
|
|
36
|
-
console.log(`\n${chalk.dim('Prompt:')}`);
|
|
37
|
-
console.log(task.fullPrompt || task.prompt);
|
|
38
|
-
|
|
39
|
-
if (task.error) {
|
|
40
|
-
console.log(`\n${chalk.red('Error:')} ${task.error}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
console.log();
|
|
44
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { getSchedule, removeSchedule } from '../store.js';
|
|
3
|
-
|
|
4
|
-
export function deleteSchedule(scheduleId) {
|
|
5
|
-
const schedule = getSchedule(scheduleId);
|
|
6
|
-
|
|
7
|
-
if (!schedule) {
|
|
8
|
-
console.log(chalk.red(`Schedule not found: ${scheduleId}`));
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
removeSchedule(scheduleId);
|
|
13
|
-
|
|
14
|
-
console.log(chalk.green(`✓ Schedule removed: ${chalk.cyan(scheduleId)}`));
|
|
15
|
-
console.log(chalk.dim(` Prompt: ${schedule.prompt}`));
|
|
16
|
-
}
|
package/task-lib/completion.js
DELETED
package/task-lib/config.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { homedir } from 'os';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
|
|
4
|
-
export const TASKS_DIR = join(homedir(), '.claude-zeroshot');
|
|
5
|
-
export const LOGS_DIR = join(TASKS_DIR, 'logs');
|
|
6
|
-
export const SCHEDULER_PID_FILE = join(TASKS_DIR, 'scheduler.pid');
|
|
7
|
-
export const SCHEDULER_LOG = join(TASKS_DIR, 'scheduler.log');
|
|
8
|
-
export const DEFAULT_MODEL = 'sonnet';
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Human-readable name generator (like Weights & Biases)
|
|
3
|
-
* Generates names like "wandering-forest-42" or "bright-star-17"
|
|
4
|
-
*
|
|
5
|
-
* No prefix - short forms used everywhere for simplicity
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const ADJECTIVES = [
|
|
9
|
-
// Colors
|
|
10
|
-
'amber',
|
|
11
|
-
'azure',
|
|
12
|
-
'crimson',
|
|
13
|
-
'emerald',
|
|
14
|
-
'golden',
|
|
15
|
-
'indigo',
|
|
16
|
-
'jade',
|
|
17
|
-
'ruby',
|
|
18
|
-
'sapphire',
|
|
19
|
-
'silver',
|
|
20
|
-
'violet',
|
|
21
|
-
'bronze',
|
|
22
|
-
'coral',
|
|
23
|
-
'ivory',
|
|
24
|
-
'pearl',
|
|
25
|
-
'platinum',
|
|
26
|
-
'scarlet',
|
|
27
|
-
'cobalt',
|
|
28
|
-
'copper',
|
|
29
|
-
'obsidian',
|
|
30
|
-
'onyx',
|
|
31
|
-
'opal',
|
|
32
|
-
'topaz',
|
|
33
|
-
'turquoise',
|
|
34
|
-
// Nature
|
|
35
|
-
'wandering',
|
|
36
|
-
'bright',
|
|
37
|
-
'silent',
|
|
38
|
-
'ancient',
|
|
39
|
-
'swift',
|
|
40
|
-
'noble',
|
|
41
|
-
'bold',
|
|
42
|
-
'wild',
|
|
43
|
-
'gentle',
|
|
44
|
-
'hidden',
|
|
45
|
-
'fierce',
|
|
46
|
-
'calm',
|
|
47
|
-
'frozen',
|
|
48
|
-
'misty',
|
|
49
|
-
'stormy',
|
|
50
|
-
'sunny',
|
|
51
|
-
// Cosmic
|
|
52
|
-
'cosmic',
|
|
53
|
-
'crystal',
|
|
54
|
-
'electric',
|
|
55
|
-
'lunar',
|
|
56
|
-
'solar',
|
|
57
|
-
'stellar',
|
|
58
|
-
'astral',
|
|
59
|
-
'orbital',
|
|
60
|
-
'mystic',
|
|
61
|
-
'quantum',
|
|
62
|
-
'radiant',
|
|
63
|
-
'twilight',
|
|
64
|
-
'vivid',
|
|
65
|
-
'zen',
|
|
66
|
-
'infinite',
|
|
67
|
-
'eternal',
|
|
68
|
-
// Tech/Abstract
|
|
69
|
-
'clever',
|
|
70
|
-
'rapid',
|
|
71
|
-
'steady',
|
|
72
|
-
'agile',
|
|
73
|
-
'nimble',
|
|
74
|
-
'keen',
|
|
75
|
-
'sharp',
|
|
76
|
-
'quick',
|
|
77
|
-
'prime',
|
|
78
|
-
'binary',
|
|
79
|
-
'neural',
|
|
80
|
-
'atomic',
|
|
81
|
-
'sonic',
|
|
82
|
-
'hyper',
|
|
83
|
-
'mega',
|
|
84
|
-
'ultra',
|
|
85
|
-
// Descriptive
|
|
86
|
-
'blazing',
|
|
87
|
-
'gleaming',
|
|
88
|
-
'glowing',
|
|
89
|
-
'shining',
|
|
90
|
-
'burning',
|
|
91
|
-
'flaming',
|
|
92
|
-
'sparkling',
|
|
93
|
-
'dazzling',
|
|
94
|
-
'roaring',
|
|
95
|
-
'rushing',
|
|
96
|
-
'soaring',
|
|
97
|
-
'flying',
|
|
98
|
-
'rising',
|
|
99
|
-
'falling',
|
|
100
|
-
'spinning',
|
|
101
|
-
'dancing',
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
const NOUNS = [
|
|
105
|
-
// Nature
|
|
106
|
-
'forest',
|
|
107
|
-
'river',
|
|
108
|
-
'mountain',
|
|
109
|
-
'ocean',
|
|
110
|
-
'thunder',
|
|
111
|
-
'canyon',
|
|
112
|
-
'summit',
|
|
113
|
-
'valley',
|
|
114
|
-
'cascade',
|
|
115
|
-
'glacier',
|
|
116
|
-
'volcano',
|
|
117
|
-
'desert',
|
|
118
|
-
'meadow',
|
|
119
|
-
'tundra',
|
|
120
|
-
'jungle',
|
|
121
|
-
'reef',
|
|
122
|
-
// Space
|
|
123
|
-
'star',
|
|
124
|
-
'comet',
|
|
125
|
-
'nebula',
|
|
126
|
-
'galaxy',
|
|
127
|
-
'pulsar',
|
|
128
|
-
'quasar',
|
|
129
|
-
'aurora',
|
|
130
|
-
'eclipse',
|
|
131
|
-
'meteor',
|
|
132
|
-
'nova',
|
|
133
|
-
'cosmos',
|
|
134
|
-
'orbit',
|
|
135
|
-
'void',
|
|
136
|
-
'horizon',
|
|
137
|
-
'zenith',
|
|
138
|
-
'equinox',
|
|
139
|
-
// Mythical
|
|
140
|
-
'phoenix',
|
|
141
|
-
'dragon',
|
|
142
|
-
'griffin',
|
|
143
|
-
'sphinx',
|
|
144
|
-
'hydra',
|
|
145
|
-
'kraken',
|
|
146
|
-
'titan',
|
|
147
|
-
'atlas',
|
|
148
|
-
'oracle',
|
|
149
|
-
'rune',
|
|
150
|
-
'sigil',
|
|
151
|
-
'glyph',
|
|
152
|
-
'totem',
|
|
153
|
-
'aegis',
|
|
154
|
-
'aether',
|
|
155
|
-
'flux',
|
|
156
|
-
// Animals
|
|
157
|
-
'falcon',
|
|
158
|
-
'eagle',
|
|
159
|
-
'wolf',
|
|
160
|
-
'bear',
|
|
161
|
-
'tiger',
|
|
162
|
-
'hawk',
|
|
163
|
-
'lion',
|
|
164
|
-
'panther',
|
|
165
|
-
'raven',
|
|
166
|
-
'serpent',
|
|
167
|
-
'shark',
|
|
168
|
-
'owl',
|
|
169
|
-
'fox',
|
|
170
|
-
'lynx',
|
|
171
|
-
'viper',
|
|
172
|
-
'condor',
|
|
173
|
-
// Architecture
|
|
174
|
-
'citadel',
|
|
175
|
-
'temple',
|
|
176
|
-
'spire',
|
|
177
|
-
'tower',
|
|
178
|
-
'fortress',
|
|
179
|
-
'bastion',
|
|
180
|
-
'vault',
|
|
181
|
-
'sanctum',
|
|
182
|
-
'beacon',
|
|
183
|
-
'arch',
|
|
184
|
-
'bridge',
|
|
185
|
-
'gate',
|
|
186
|
-
'hall',
|
|
187
|
-
'keep',
|
|
188
|
-
'dome',
|
|
189
|
-
'obelisk',
|
|
190
|
-
// Abstract
|
|
191
|
-
'cipher',
|
|
192
|
-
'echo',
|
|
193
|
-
'nexus',
|
|
194
|
-
'prism',
|
|
195
|
-
'relic',
|
|
196
|
-
'vertex',
|
|
197
|
-
'vortex',
|
|
198
|
-
'pulse',
|
|
199
|
-
'surge',
|
|
200
|
-
'spark',
|
|
201
|
-
'flame',
|
|
202
|
-
'storm',
|
|
203
|
-
'wave',
|
|
204
|
-
'drift',
|
|
205
|
-
'shift',
|
|
206
|
-
'core',
|
|
207
|
-
];
|
|
208
|
-
|
|
209
|
-
// 96 adjectives × 96 nouns × 100 numbers = 921,600 combinations
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Generate a human-readable name
|
|
213
|
-
* @param {string} _prefix - DEPRECATED: Ignored for backwards compat, short form always used
|
|
214
|
-
* @returns {string} Human-readable name (e.g., 'wandering-forest-42')
|
|
215
|
-
*/
|
|
216
|
-
export function generateName(_prefix = '') {
|
|
217
|
-
const adjective = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)];
|
|
218
|
-
const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)];
|
|
219
|
-
const number = Math.floor(Math.random() * 100);
|
|
220
|
-
|
|
221
|
-
return `${adjective}-${noun}-${number}`;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Generate a short unique suffix (for collision prevention)
|
|
226
|
-
* @returns {string} Short random suffix (e.g., 'a3f9')
|
|
227
|
-
*/
|
|
228
|
-
export function generateSuffix() {
|
|
229
|
-
return Math.random().toString(36).slice(2, 6);
|
|
230
|
-
}
|
package/task-lib/package.json
DELETED