@renseiai/agentfactory-cli 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +123 -0
- package/dist/src/agent.d.ts +20 -0
- package/dist/src/agent.d.ts.map +1 -0
- package/dist/src/agent.js +109 -0
- package/dist/src/analyze-logs.d.ts +26 -0
- package/dist/src/analyze-logs.d.ts.map +1 -0
- package/dist/src/analyze-logs.js +152 -0
- package/dist/src/cleanup.d.ts +17 -0
- package/dist/src/cleanup.d.ts.map +1 -0
- package/dist/src/cleanup.js +111 -0
- package/dist/src/governor.d.ts +26 -0
- package/dist/src/governor.d.ts.map +1 -0
- package/dist/src/governor.js +305 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +76 -0
- package/dist/src/lib/agent-runner.d.ts +28 -0
- package/dist/src/lib/agent-runner.d.ts.map +1 -0
- package/dist/src/lib/agent-runner.js +272 -0
- package/dist/src/lib/analyze-logs-runner.d.ts +47 -0
- package/dist/src/lib/analyze-logs-runner.d.ts.map +1 -0
- package/dist/src/lib/analyze-logs-runner.js +216 -0
- package/dist/src/lib/auto-updater.d.ts +40 -0
- package/dist/src/lib/auto-updater.d.ts.map +1 -0
- package/dist/src/lib/auto-updater.js +109 -0
- package/dist/src/lib/cleanup-runner.d.ts +29 -0
- package/dist/src/lib/cleanup-runner.d.ts.map +1 -0
- package/dist/src/lib/cleanup-runner.js +295 -0
- package/dist/src/lib/governor-dependencies.d.ts +23 -0
- package/dist/src/lib/governor-dependencies.d.ts.map +1 -0
- package/dist/src/lib/governor-dependencies.js +361 -0
- package/dist/src/lib/governor-logger.d.ts +30 -0
- package/dist/src/lib/governor-logger.d.ts.map +1 -0
- package/dist/src/lib/governor-logger.js +210 -0
- package/dist/src/lib/governor-runner.d.ts +103 -0
- package/dist/src/lib/governor-runner.d.ts.map +1 -0
- package/dist/src/lib/governor-runner.js +210 -0
- package/dist/src/lib/linear-runner.d.ts +8 -0
- package/dist/src/lib/linear-runner.d.ts.map +1 -0
- package/dist/src/lib/linear-runner.js +7 -0
- package/dist/src/lib/orchestrator-runner.d.ts +51 -0
- package/dist/src/lib/orchestrator-runner.d.ts.map +1 -0
- package/dist/src/lib/orchestrator-runner.js +151 -0
- package/dist/src/lib/queue-admin-runner.d.ts +30 -0
- package/dist/src/lib/queue-admin-runner.d.ts.map +1 -0
- package/dist/src/lib/queue-admin-runner.js +378 -0
- package/dist/src/lib/sync-routes-runner.d.ts +28 -0
- package/dist/src/lib/sync-routes-runner.d.ts.map +1 -0
- package/dist/src/lib/sync-routes-runner.js +110 -0
- package/dist/src/lib/version.d.ts +35 -0
- package/dist/src/lib/version.d.ts.map +1 -0
- package/dist/src/lib/version.js +168 -0
- package/dist/src/lib/worker-fleet-runner.d.ts +32 -0
- package/dist/src/lib/worker-fleet-runner.d.ts.map +1 -0
- package/dist/src/lib/worker-fleet-runner.js +256 -0
- package/dist/src/lib/worker-runner.d.ts +33 -0
- package/dist/src/lib/worker-runner.d.ts.map +1 -0
- package/dist/src/lib/worker-runner.js +781 -0
- package/dist/src/linear.d.ts +37 -0
- package/dist/src/linear.d.ts.map +1 -0
- package/dist/src/linear.js +118 -0
- package/dist/src/orchestrator.d.ts +21 -0
- package/dist/src/orchestrator.d.ts.map +1 -0
- package/dist/src/orchestrator.js +190 -0
- package/dist/src/queue-admin.d.ts +25 -0
- package/dist/src/queue-admin.d.ts.map +1 -0
- package/dist/src/queue-admin.js +96 -0
- package/dist/src/sync-routes.d.ts +17 -0
- package/dist/src/sync-routes.d.ts.map +1 -0
- package/dist/src/sync-routes.js +100 -0
- package/dist/src/worker-fleet.d.ts +25 -0
- package/dist/src/worker-fleet.d.ts.map +1 -0
- package/dist/src/worker-fleet.js +140 -0
- package/dist/src/worker.d.ts +26 -0
- package/dist/src/worker.d.ts.map +1 -0
- package/dist/src/worker.js +135 -0
- package/package.json +175 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Linear CLI
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper around the linear runner.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* af-linear <command> [options]
|
|
9
|
+
*
|
|
10
|
+
* Commands:
|
|
11
|
+
* get-issue <id> Get issue details
|
|
12
|
+
* create-issue Create a new issue
|
|
13
|
+
* update-issue <id> Update an existing issue
|
|
14
|
+
* list-comments <issueId> List comments on an issue
|
|
15
|
+
* create-comment <issueId> Create a comment on an issue
|
|
16
|
+
* list-backlog-issues List backlog issues for a project
|
|
17
|
+
* list-unblocked-backlog List unblocked backlog issues
|
|
18
|
+
* check-blocked <id> Check if an issue is blocked
|
|
19
|
+
* add-relation <id> <id> Create relation between issues
|
|
20
|
+
* list-relations <id> List relations for an issue
|
|
21
|
+
* remove-relation <id> Remove a relation by ID
|
|
22
|
+
* list-sub-issues <id> List sub-issues of a parent issue
|
|
23
|
+
* list-sub-issue-statuses <id> List sub-issue statuses (lightweight)
|
|
24
|
+
* update-sub-issue <id> Update sub-issue status with comment
|
|
25
|
+
* check-deployment <PR> Check Vercel deployment status for a PR
|
|
26
|
+
* create-blocker <source-id> Create a human-needed blocker issue
|
|
27
|
+
*
|
|
28
|
+
* Array Values:
|
|
29
|
+
* --labels accepts comma-separated: --labels "Bug,Feature"
|
|
30
|
+
* For values with commas, use JSON: --labels '["Bug", "UI, UX"]'
|
|
31
|
+
* Text fields (--description, --title, --body) preserve commas.
|
|
32
|
+
*
|
|
33
|
+
* Environment:
|
|
34
|
+
* LINEAR_API_KEY Required API key for authentication
|
|
35
|
+
*/
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=linear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear.d.ts","sourceRoot":"","sources":["../../src/linear.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Linear CLI
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper around the linear runner.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* af-linear <command> [options]
|
|
9
|
+
*
|
|
10
|
+
* Commands:
|
|
11
|
+
* get-issue <id> Get issue details
|
|
12
|
+
* create-issue Create a new issue
|
|
13
|
+
* update-issue <id> Update an existing issue
|
|
14
|
+
* list-comments <issueId> List comments on an issue
|
|
15
|
+
* create-comment <issueId> Create a comment on an issue
|
|
16
|
+
* list-backlog-issues List backlog issues for a project
|
|
17
|
+
* list-unblocked-backlog List unblocked backlog issues
|
|
18
|
+
* check-blocked <id> Check if an issue is blocked
|
|
19
|
+
* add-relation <id> <id> Create relation between issues
|
|
20
|
+
* list-relations <id> List relations for an issue
|
|
21
|
+
* remove-relation <id> Remove a relation by ID
|
|
22
|
+
* list-sub-issues <id> List sub-issues of a parent issue
|
|
23
|
+
* list-sub-issue-statuses <id> List sub-issue statuses (lightweight)
|
|
24
|
+
* update-sub-issue <id> Update sub-issue status with comment
|
|
25
|
+
* check-deployment <PR> Check Vercel deployment status for a PR
|
|
26
|
+
* create-blocker <source-id> Create a human-needed blocker issue
|
|
27
|
+
*
|
|
28
|
+
* Array Values:
|
|
29
|
+
* --labels accepts comma-separated: --labels "Bug,Feature"
|
|
30
|
+
* For values with commas, use JSON: --labels '["Bug", "UI, UX"]'
|
|
31
|
+
* Text fields (--description, --title, --body) preserve commas.
|
|
32
|
+
*
|
|
33
|
+
* Environment:
|
|
34
|
+
* LINEAR_API_KEY Required API key for authentication
|
|
35
|
+
*/
|
|
36
|
+
import path from 'path';
|
|
37
|
+
import { config } from 'dotenv';
|
|
38
|
+
// Load environment variables from .env.local
|
|
39
|
+
config({ path: path.resolve(process.cwd(), '.env.local') });
|
|
40
|
+
import { runLinear, parseLinearArgs } from './lib/linear-runner.js';
|
|
41
|
+
function printHelp() {
|
|
42
|
+
console.log(`
|
|
43
|
+
AgentFactory Linear CLI — Linear issue tracker operations
|
|
44
|
+
|
|
45
|
+
Usage:
|
|
46
|
+
af-linear <command> [options]
|
|
47
|
+
|
|
48
|
+
Commands:
|
|
49
|
+
get-issue <id> Get issue details
|
|
50
|
+
create-issue Create a new issue
|
|
51
|
+
update-issue <id> Update an existing issue
|
|
52
|
+
list-comments <issueId> List comments on an issue
|
|
53
|
+
create-comment <issueId> Create a comment on an issue
|
|
54
|
+
list-backlog-issues List backlog issues for a project
|
|
55
|
+
list-unblocked-backlog List unblocked backlog issues
|
|
56
|
+
check-blocked <id> Check if an issue is blocked
|
|
57
|
+
add-relation <id> <id> Create relation between issues
|
|
58
|
+
list-relations <id> List relations for an issue
|
|
59
|
+
remove-relation <id> Remove a relation by ID
|
|
60
|
+
list-sub-issues <id> List sub-issues of a parent issue
|
|
61
|
+
list-sub-issue-statuses <id> List sub-issue statuses (lightweight)
|
|
62
|
+
update-sub-issue <id> Update sub-issue status with comment
|
|
63
|
+
check-deployment <PR> Check Vercel deployment status for a PR
|
|
64
|
+
create-blocker <source-id> Create a human-needed blocker issue
|
|
65
|
+
help Show this help message
|
|
66
|
+
|
|
67
|
+
Options:
|
|
68
|
+
--help, -h Show this help message
|
|
69
|
+
|
|
70
|
+
Array Values:
|
|
71
|
+
--labels accepts comma-separated: --labels "Bug,Feature"
|
|
72
|
+
For values with commas, use JSON: --labels '["Bug", "UI, UX"]'
|
|
73
|
+
|
|
74
|
+
Environment:
|
|
75
|
+
LINEAR_API_KEY Required API key for authentication
|
|
76
|
+
LINEAR_ACCESS_TOKEN Alternative to LINEAR_API_KEY
|
|
77
|
+
|
|
78
|
+
Examples:
|
|
79
|
+
af-linear get-issue PROJ-123
|
|
80
|
+
af-linear create-issue --title "Add auth" --team "Engineering" --project "Backend"
|
|
81
|
+
af-linear update-issue PROJ-123 --state "Finished"
|
|
82
|
+
af-linear list-backlog-issues --project "MyProject"
|
|
83
|
+
af-linear check-deployment 42
|
|
84
|
+
`);
|
|
85
|
+
}
|
|
86
|
+
async function main() {
|
|
87
|
+
const { command, args, positionalArgs } = parseLinearArgs(process.argv.slice(2));
|
|
88
|
+
if (!command || command === 'help' || args['help'] || args['h']) {
|
|
89
|
+
printHelp();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const apiKey = process.env.LINEAR_API_KEY || process.env.LINEAR_ACCESS_TOKEN;
|
|
93
|
+
const result = await runLinear({
|
|
94
|
+
command,
|
|
95
|
+
args,
|
|
96
|
+
positionalArgs,
|
|
97
|
+
apiKey,
|
|
98
|
+
});
|
|
99
|
+
// check-deployment with markdown format outputs a string, not JSON
|
|
100
|
+
if (typeof result.output === 'string') {
|
|
101
|
+
console.log(result.output);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
console.log(JSON.stringify(result.output, null, 2));
|
|
105
|
+
}
|
|
106
|
+
// Exit with error code if deployment check failed
|
|
107
|
+
if (command === 'check-deployment' &&
|
|
108
|
+
typeof result.output === 'object' &&
|
|
109
|
+
result.output !== null &&
|
|
110
|
+
'anyFailed' in result.output &&
|
|
111
|
+
result.output.anyFailed) {
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
main().catch((error) => {
|
|
116
|
+
console.error('Error:', error instanceof Error ? error.message : error);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Orchestrator CLI
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper around the orchestrator runner.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* af-orchestrator [options]
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* --project <name> Filter issues by project name
|
|
12
|
+
* --max <number> Maximum concurrent agents (default: 3)
|
|
13
|
+
* --single <id> Process a single issue by ID
|
|
14
|
+
* --no-wait Don't wait for agents to complete
|
|
15
|
+
* --dry-run Show what would be done without executing
|
|
16
|
+
*
|
|
17
|
+
* Environment:
|
|
18
|
+
* LINEAR_API_KEY Required API key for Linear authentication
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/orchestrator.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Orchestrator CLI
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper around the orchestrator runner.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* af-orchestrator [options]
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* --project <name> Filter issues by project name
|
|
12
|
+
* --max <number> Maximum concurrent agents (default: 3)
|
|
13
|
+
* --single <id> Process a single issue by ID
|
|
14
|
+
* --no-wait Don't wait for agents to complete
|
|
15
|
+
* --dry-run Show what would be done without executing
|
|
16
|
+
*
|
|
17
|
+
* Environment:
|
|
18
|
+
* LINEAR_API_KEY Required API key for Linear authentication
|
|
19
|
+
*/
|
|
20
|
+
import path from 'path';
|
|
21
|
+
import { config } from 'dotenv';
|
|
22
|
+
// Load environment variables from .env.local
|
|
23
|
+
config({ path: path.resolve(process.cwd(), '.env.local') });
|
|
24
|
+
import { runOrchestrator } from './lib/orchestrator-runner.js';
|
|
25
|
+
import { getVersion, checkForUpdate, printUpdateNotification } from './lib/version.js';
|
|
26
|
+
function parseArgs() {
|
|
27
|
+
const args = process.argv.slice(2);
|
|
28
|
+
const result = {
|
|
29
|
+
project: undefined,
|
|
30
|
+
max: 3,
|
|
31
|
+
single: undefined,
|
|
32
|
+
wait: true,
|
|
33
|
+
dryRun: false,
|
|
34
|
+
templates: undefined,
|
|
35
|
+
repo: undefined,
|
|
36
|
+
workType: undefined,
|
|
37
|
+
};
|
|
38
|
+
for (let i = 0; i < args.length; i++) {
|
|
39
|
+
const arg = args[i];
|
|
40
|
+
switch (arg) {
|
|
41
|
+
case '--project':
|
|
42
|
+
result.project = args[++i];
|
|
43
|
+
break;
|
|
44
|
+
case '--max':
|
|
45
|
+
result.max = parseInt(args[++i], 10);
|
|
46
|
+
break;
|
|
47
|
+
case '--single':
|
|
48
|
+
result.single = args[++i];
|
|
49
|
+
break;
|
|
50
|
+
case '--no-wait':
|
|
51
|
+
result.wait = false;
|
|
52
|
+
break;
|
|
53
|
+
case '--dry-run':
|
|
54
|
+
result.dryRun = true;
|
|
55
|
+
break;
|
|
56
|
+
case '--templates':
|
|
57
|
+
result.templates = args[++i];
|
|
58
|
+
break;
|
|
59
|
+
case '--repo':
|
|
60
|
+
result.repo = args[++i];
|
|
61
|
+
break;
|
|
62
|
+
case '--work-type':
|
|
63
|
+
result.workType = args[++i];
|
|
64
|
+
break;
|
|
65
|
+
case '--help':
|
|
66
|
+
case '-h':
|
|
67
|
+
printHelp();
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
function printHelp() {
|
|
74
|
+
console.log(`
|
|
75
|
+
AgentFactory Orchestrator — Multi-agent fleet management for coding agents
|
|
76
|
+
|
|
77
|
+
Usage:
|
|
78
|
+
af-orchestrator [options]
|
|
79
|
+
|
|
80
|
+
Options:
|
|
81
|
+
--project <name> Filter issues by project name
|
|
82
|
+
--max <number> Maximum concurrent agents (default: 3)
|
|
83
|
+
--single <id> Process a single issue by ID
|
|
84
|
+
--no-wait Don't wait for agents to complete
|
|
85
|
+
--dry-run Show what would be done without executing
|
|
86
|
+
--templates <path> Custom workflow template directory
|
|
87
|
+
--repo <url> Git repository URL for worktree cloning
|
|
88
|
+
--work-type <type> Force work type (use with --single)
|
|
89
|
+
--help, -h Show this help message
|
|
90
|
+
|
|
91
|
+
Environment:
|
|
92
|
+
LINEAR_API_KEY Required API key for Linear authentication
|
|
93
|
+
|
|
94
|
+
Examples:
|
|
95
|
+
# Process up to 3 backlog issues from a project
|
|
96
|
+
af-orchestrator --project MyProject
|
|
97
|
+
|
|
98
|
+
# Process a specific issue
|
|
99
|
+
af-orchestrator --single PROJ-123
|
|
100
|
+
|
|
101
|
+
# Preview what issues would be processed
|
|
102
|
+
af-orchestrator --project MyProject --dry-run
|
|
103
|
+
`);
|
|
104
|
+
}
|
|
105
|
+
async function main() {
|
|
106
|
+
const args = parseArgs();
|
|
107
|
+
if (!process.env.LINEAR_API_KEY) {
|
|
108
|
+
console.error('Error: LINEAR_API_KEY environment variable is required');
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
const version = getVersion();
|
|
112
|
+
console.log(`AgentFactory Orchestrator \x1b[2mv${version}\x1b[0m`);
|
|
113
|
+
console.log('========================');
|
|
114
|
+
console.log(`Project: ${args.project ?? 'All'}`);
|
|
115
|
+
console.log(`Max concurrent: ${args.max}`);
|
|
116
|
+
console.log(`Repo: ${args.repo ?? 'Any'}`);
|
|
117
|
+
console.log(`Dry run: ${args.dryRun}`);
|
|
118
|
+
console.log('');
|
|
119
|
+
// Update check (non-blocking)
|
|
120
|
+
const updateCheck = await checkForUpdate();
|
|
121
|
+
printUpdateNotification(updateCheck);
|
|
122
|
+
if (args.single) {
|
|
123
|
+
console.log(`Processing single issue: ${args.single}`);
|
|
124
|
+
if (args.dryRun) {
|
|
125
|
+
console.log('[DRY RUN] Would spawn agent for:', args.single);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const result = await runOrchestrator({
|
|
131
|
+
linearApiKey: process.env.LINEAR_API_KEY,
|
|
132
|
+
project: args.project,
|
|
133
|
+
max: args.max,
|
|
134
|
+
single: args.single,
|
|
135
|
+
wait: args.wait,
|
|
136
|
+
dryRun: args.dryRun,
|
|
137
|
+
templateDir: args.templates,
|
|
138
|
+
repository: args.repo,
|
|
139
|
+
workType: args.workType,
|
|
140
|
+
});
|
|
141
|
+
if (!args.single && !args.dryRun) {
|
|
142
|
+
console.log('');
|
|
143
|
+
console.log('Orchestrator started');
|
|
144
|
+
console.log(` Agents spawned: ${result.agentsSpawned}`);
|
|
145
|
+
console.log(` Errors: ${result.errors.length}`);
|
|
146
|
+
if (result.errors.length > 0) {
|
|
147
|
+
console.log('');
|
|
148
|
+
console.log('Errors:');
|
|
149
|
+
for (const { issueId, error } of result.errors) {
|
|
150
|
+
console.log(` ${issueId}: ${error.message}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (args.single) {
|
|
155
|
+
console.log(`Agent spawned for ${args.single}`);
|
|
156
|
+
}
|
|
157
|
+
if (args.wait && result.completed.length > 0) {
|
|
158
|
+
console.log('');
|
|
159
|
+
console.log('All agents completed');
|
|
160
|
+
console.log('Results:');
|
|
161
|
+
for (const agent of result.completed) {
|
|
162
|
+
const duration = agent.completedAt
|
|
163
|
+
? formatDuration(agent.completedAt.getTime() - agent.startedAt.getTime())
|
|
164
|
+
: 'unknown';
|
|
165
|
+
const status = agent.status === 'completed' ? 'SUCCESS' : 'FAILED';
|
|
166
|
+
console.log(` ${agent.identifier}: ${status} (${duration})`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
console.error('Orchestrator failed:', error instanceof Error ? error.message : error);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function formatDuration(ms) {
|
|
176
|
+
const seconds = Math.floor(ms / 1000);
|
|
177
|
+
const minutes = Math.floor(seconds / 60);
|
|
178
|
+
const hours = Math.floor(minutes / 60);
|
|
179
|
+
if (hours > 0) {
|
|
180
|
+
return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
181
|
+
}
|
|
182
|
+
if (minutes > 0) {
|
|
183
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
184
|
+
}
|
|
185
|
+
return `${seconds}s`;
|
|
186
|
+
}
|
|
187
|
+
main().catch((error) => {
|
|
188
|
+
console.error('Fatal error:', error);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Queue Admin CLI
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper around the queue-admin runner. Handles dotenv, arg parsing,
|
|
6
|
+
* and process.exit so the runner stays process-agnostic.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* af-queue-admin <command>
|
|
10
|
+
*
|
|
11
|
+
* Commands:
|
|
12
|
+
* list List all queued work items
|
|
13
|
+
* sessions List all sessions
|
|
14
|
+
* workers List all registered workers
|
|
15
|
+
* clear-claims Clear stale work claims
|
|
16
|
+
* clear-queue Clear the work queue
|
|
17
|
+
* clear-all Clear queue, sessions, claims, and workers
|
|
18
|
+
* reset Full state reset (claims + queue + stuck sessions)
|
|
19
|
+
* remove <id> Remove a specific session by ID (partial match)
|
|
20
|
+
*
|
|
21
|
+
* Environment (loaded from .env.local in CWD):
|
|
22
|
+
* REDIS_URL Required for Redis connection
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=queue-admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-admin.d.ts","sourceRoot":"","sources":["../../src/queue-admin.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Queue Admin CLI
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper around the queue-admin runner. Handles dotenv, arg parsing,
|
|
6
|
+
* and process.exit so the runner stays process-agnostic.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* af-queue-admin <command>
|
|
10
|
+
*
|
|
11
|
+
* Commands:
|
|
12
|
+
* list List all queued work items
|
|
13
|
+
* sessions List all sessions
|
|
14
|
+
* workers List all registered workers
|
|
15
|
+
* clear-claims Clear stale work claims
|
|
16
|
+
* clear-queue Clear the work queue
|
|
17
|
+
* clear-all Clear queue, sessions, claims, and workers
|
|
18
|
+
* reset Full state reset (claims + queue + stuck sessions)
|
|
19
|
+
* remove <id> Remove a specific session by ID (partial match)
|
|
20
|
+
*
|
|
21
|
+
* Environment (loaded from .env.local in CWD):
|
|
22
|
+
* REDIS_URL Required for Redis connection
|
|
23
|
+
*/
|
|
24
|
+
import path from 'path';
|
|
25
|
+
import { config } from 'dotenv';
|
|
26
|
+
// Load environment variables from .env.local in CWD
|
|
27
|
+
config({ path: path.resolve(process.cwd(), '.env.local') });
|
|
28
|
+
import { runQueueAdmin, C } from './lib/queue-admin-runner.js';
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Usage
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
function printUsage() {
|
|
33
|
+
console.log(`
|
|
34
|
+
${C.cyan}AgentFactory Queue Admin${C.reset} - Manage Redis work queue and sessions
|
|
35
|
+
|
|
36
|
+
${C.yellow}Usage:${C.reset}
|
|
37
|
+
af-queue-admin <command>
|
|
38
|
+
|
|
39
|
+
${C.yellow}Commands:${C.reset}
|
|
40
|
+
list List all queued work items
|
|
41
|
+
sessions List all sessions
|
|
42
|
+
workers List all registered workers
|
|
43
|
+
clear-claims Clear stale work claims
|
|
44
|
+
clear-queue Clear the work queue
|
|
45
|
+
clear-all Clear queue, sessions, claims, and workers
|
|
46
|
+
reset Full state reset (claims + queue + stuck sessions)
|
|
47
|
+
remove <id> Remove a specific session by ID (partial match)
|
|
48
|
+
|
|
49
|
+
${C.yellow}Examples:${C.reset}
|
|
50
|
+
af-queue-admin list
|
|
51
|
+
af-queue-admin sessions
|
|
52
|
+
af-queue-admin clear-queue
|
|
53
|
+
af-queue-admin reset
|
|
54
|
+
af-queue-admin remove abc123
|
|
55
|
+
`);
|
|
56
|
+
}
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Valid commands
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
const VALID_COMMANDS = new Set([
|
|
61
|
+
'list',
|
|
62
|
+
'sessions',
|
|
63
|
+
'workers',
|
|
64
|
+
'clear-claims',
|
|
65
|
+
'clear-queue',
|
|
66
|
+
'clear-all',
|
|
67
|
+
'reset',
|
|
68
|
+
'remove',
|
|
69
|
+
]);
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
// Main
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
async function main() {
|
|
74
|
+
const command = process.argv[2];
|
|
75
|
+
const arg = process.argv[3];
|
|
76
|
+
if (!command || command === 'help' || command === '--help' || command === '-h') {
|
|
77
|
+
printUsage();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!VALID_COMMANDS.has(command)) {
|
|
81
|
+
printUsage();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (command === 'remove' && !arg) {
|
|
85
|
+
console.error('Usage: af-queue-admin remove <session-id>');
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
await runQueueAdmin({
|
|
89
|
+
command: command,
|
|
90
|
+
sessionId: arg,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
main().catch((error) => {
|
|
94
|
+
console.error('Error:', error instanceof Error ? error.message : error);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Route Sync CLI
|
|
4
|
+
*
|
|
5
|
+
* Generates missing route.ts and page.tsx files from the route manifest.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* af-sync-routes [options]
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* --dry-run Preview what would be created
|
|
12
|
+
* --pages Also sync dashboard page.tsx files
|
|
13
|
+
* --app-dir <p> Custom app directory (default: src/app)
|
|
14
|
+
* --help, -h Show this help message
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=sync-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-routes.d.ts","sourceRoot":"","sources":["../../src/sync-routes.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Route Sync CLI
|
|
4
|
+
*
|
|
5
|
+
* Generates missing route.ts and page.tsx files from the route manifest.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* af-sync-routes [options]
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* --dry-run Preview what would be created
|
|
12
|
+
* --pages Also sync dashboard page.tsx files
|
|
13
|
+
* --app-dir <p> Custom app directory (default: src/app)
|
|
14
|
+
* --help, -h Show this help message
|
|
15
|
+
*/
|
|
16
|
+
import { runSyncRoutes } from './lib/sync-routes-runner.js';
|
|
17
|
+
function parseArgs() {
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
const result = {
|
|
20
|
+
dryRun: false,
|
|
21
|
+
pages: false,
|
|
22
|
+
help: false,
|
|
23
|
+
};
|
|
24
|
+
for (let i = 0; i < args.length; i++) {
|
|
25
|
+
const arg = args[i];
|
|
26
|
+
switch (arg) {
|
|
27
|
+
case '--dry-run':
|
|
28
|
+
result.dryRun = true;
|
|
29
|
+
break;
|
|
30
|
+
case '--pages':
|
|
31
|
+
result.pages = true;
|
|
32
|
+
break;
|
|
33
|
+
case '--app-dir':
|
|
34
|
+
result.appDir = args[++i];
|
|
35
|
+
break;
|
|
36
|
+
case '--help':
|
|
37
|
+
case '-h':
|
|
38
|
+
result.help = true;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
function printHelp() {
|
|
45
|
+
console.log(`
|
|
46
|
+
AgentFactory Route Sync — Generate missing route and page files
|
|
47
|
+
|
|
48
|
+
Usage:
|
|
49
|
+
af-sync-routes [options]
|
|
50
|
+
|
|
51
|
+
Options:
|
|
52
|
+
--dry-run Preview what would be created without writing files
|
|
53
|
+
--pages Also sync dashboard page.tsx files (requires @renseiai/agentfactory-dashboard)
|
|
54
|
+
--app-dir <p> Custom app directory (default: src/app)
|
|
55
|
+
--help, -h Show this help message
|
|
56
|
+
|
|
57
|
+
Examples:
|
|
58
|
+
# Preview missing routes
|
|
59
|
+
af-sync-routes --dry-run
|
|
60
|
+
|
|
61
|
+
# Create missing route files
|
|
62
|
+
af-sync-routes
|
|
63
|
+
|
|
64
|
+
# Also sync dashboard pages
|
|
65
|
+
af-sync-routes --pages
|
|
66
|
+
|
|
67
|
+
# After upgrading @renseiai packages
|
|
68
|
+
pnpm bump:af && af-sync-routes --pages
|
|
69
|
+
`);
|
|
70
|
+
}
|
|
71
|
+
function main() {
|
|
72
|
+
const args = parseArgs();
|
|
73
|
+
if (args.help) {
|
|
74
|
+
printHelp();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
console.log('\n=== AgentFactory Route Sync ===\n');
|
|
78
|
+
if (args.dryRun) {
|
|
79
|
+
console.log('[DRY RUN MODE - No files will be written]\n');
|
|
80
|
+
}
|
|
81
|
+
const result = runSyncRoutes({
|
|
82
|
+
dryRun: args.dryRun,
|
|
83
|
+
pages: args.pages,
|
|
84
|
+
appDir: args.appDir,
|
|
85
|
+
});
|
|
86
|
+
// Print warnings
|
|
87
|
+
for (const warning of result.warnings) {
|
|
88
|
+
console.log(`\n warning: ${warning}`);
|
|
89
|
+
}
|
|
90
|
+
// Print summary
|
|
91
|
+
console.log(`\nSummary: checked=${result.checked} created=${result.created} skipped=${result.skipped} errors=${result.errors.length}`);
|
|
92
|
+
if (result.errors.length > 0) {
|
|
93
|
+
console.error('\nErrors:');
|
|
94
|
+
for (const err of result.errors) {
|
|
95
|
+
console.error(` ${err.path}: ${err.error}`);
|
|
96
|
+
}
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
main();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AgentFactory Worker Fleet Manager
|
|
4
|
+
*
|
|
5
|
+
* Spawns and manages multiple worker processes for parallel agent execution.
|
|
6
|
+
* Thin wrapper around the programmatic runner in ./lib/worker-fleet-runner.js.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* af-worker-fleet [options]
|
|
10
|
+
*
|
|
11
|
+
* Options:
|
|
12
|
+
* -w, --workers <n> Number of worker processes (default: CPU cores / 2)
|
|
13
|
+
* -c, --capacity <n> Agents per worker (default: 3)
|
|
14
|
+
* -p, --projects <l> Comma-separated project names to accept (default: all)
|
|
15
|
+
* --dry-run Show configuration without starting workers
|
|
16
|
+
*
|
|
17
|
+
* Environment (loaded from .env.local in CWD):
|
|
18
|
+
* WORKER_FLEET_SIZE Number of workers (override)
|
|
19
|
+
* WORKER_CAPACITY Agents per worker (override)
|
|
20
|
+
* WORKER_PROJECTS Comma-separated project names to accept
|
|
21
|
+
* WORKER_API_URL Coordinator API URL (required)
|
|
22
|
+
* WORKER_API_KEY API key for authentication (required)
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=worker-fleet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-fleet.d.ts","sourceRoot":"","sources":["../../src/worker-fleet.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|