@agentteams/cli 0.1.22
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/.agentteams/config.json +8 -0
- package/.agentteams/convention.md +100 -0
- package/.agentteams/platform/co-action-guide.md +144 -0
- package/.agentteams/platform/completion-report-guide.md +146 -0
- package/.agentteams/platform/convention-authoring-guide.md +112 -0
- package/.agentteams/platform/convention-ud-guide.md +59 -0
- package/.agentteams/platform/plan-guide.md +180 -0
- package/.agentteams/platform/plan-template.md +201 -0
- package/.agentteams/platform/post-mortem-guide.md +92 -0
- package/CODE_OF_CONDUCT.md +36 -0
- package/CONTRIBUTING.md +39 -0
- package/LICENSE +201 -0
- package/README.md +405 -0
- package/SECURITY.md +27 -0
- package/dist/api/coaction.d.ts +17 -0
- package/dist/api/coaction.d.ts.map +1 -0
- package/dist/api/coaction.js +102 -0
- package/dist/api/coaction.js.map +1 -0
- package/dist/api/comment.d.ts +13 -0
- package/dist/api/comment.d.ts.map +1 -0
- package/dist/api/comment.js +33 -0
- package/dist/api/comment.js.map +1 -0
- package/dist/api/feedback.d.ts +7 -0
- package/dist/api/feedback.d.ts.map +1 -0
- package/dist/api/feedback.js +6 -0
- package/dist/api/feedback.js.map +1 -0
- package/dist/api/linear.d.ts +5 -0
- package/dist/api/linear.d.ts.map +1 -0
- package/dist/api/linear.js +27 -0
- package/dist/api/linear.js.map +1 -0
- package/dist/api/member.d.ts +16 -0
- package/dist/api/member.d.ts.map +1 -0
- package/dist/api/member.js +6 -0
- package/dist/api/member.js.map +1 -0
- package/dist/api/plan.d.ts +51 -0
- package/dist/api/plan.d.ts.map +1 -0
- package/dist/api/plan.js +80 -0
- package/dist/api/plan.js.map +1 -0
- package/dist/api/postmortem.d.ts +6 -0
- package/dist/api/postmortem.d.ts.map +1 -0
- package/dist/api/postmortem.js +33 -0
- package/dist/api/postmortem.js.map +1 -0
- package/dist/api/report.d.ts +6 -0
- package/dist/api/report.d.ts.map +1 -0
- package/dist/api/report.js +33 -0
- package/dist/api/report.js.map +1 -0
- package/dist/api/search.d.ts +2 -0
- package/dist/api/search.d.ts.map +1 -0
- package/dist/api/search.js +20 -0
- package/dist/api/search.js.map +1 -0
- package/dist/api/status.d.ts +12 -0
- package/dist/api/status.d.ts.map +1 -0
- package/dist/api/status.js +33 -0
- package/dist/api/status.js.map +1 -0
- package/dist/commands/agentConfig.d.ts +4 -0
- package/dist/commands/agentConfig.d.ts.map +1 -0
- package/dist/commands/agentConfig.js +41 -0
- package/dist/commands/agentConfig.js.map +1 -0
- package/dist/commands/agentConfigCommand.d.ts +2 -0
- package/dist/commands/agentConfigCommand.d.ts.map +1 -0
- package/dist/commands/agentConfigCommand.js +20 -0
- package/dist/commands/agentConfigCommand.js.map +1 -0
- package/dist/commands/coaction.d.ts +2 -0
- package/dist/commands/coaction.d.ts.map +1 -0
- package/dist/commands/coaction.js +405 -0
- package/dist/commands/coaction.js.map +1 -0
- package/dist/commands/comment.d.ts +2 -0
- package/dist/commands/comment.d.ts.map +1 -0
- package/dist/commands/comment.js +63 -0
- package/dist/commands/comment.js.map +1 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +30 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/convention.d.ts +35 -0
- package/dist/commands/convention.d.ts.map +1 -0
- package/dist/commands/convention.js +680 -0
- package/dist/commands/convention.js.map +1 -0
- package/dist/commands/conventionRouter.d.ts +3 -0
- package/dist/commands/conventionRouter.d.ts.map +1 -0
- package/dist/commands/conventionRouter.js +46 -0
- package/dist/commands/conventionRouter.js.map +1 -0
- package/dist/commands/dependency.d.ts +4 -0
- package/dist/commands/dependency.d.ts.map +1 -0
- package/dist/commands/dependency.js +41 -0
- package/dist/commands/dependency.js.map +1 -0
- package/dist/commands/dependencyCommand.d.ts +2 -0
- package/dist/commands/dependencyCommand.d.ts.map +1 -0
- package/dist/commands/dependencyCommand.js +27 -0
- package/dist/commands/dependencyCommand.js.map +1 -0
- package/dist/commands/feedback.d.ts +2 -0
- package/dist/commands/feedback.d.ts.map +1 -0
- package/dist/commands/feedback.js +38 -0
- package/dist/commands/feedback.js.map +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +128 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +22 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +293 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/linear.d.ts +2 -0
- package/dist/commands/linear.d.ts.map +1 -0
- package/dist/commands/linear.js +41 -0
- package/dist/commands/linear.js.map +1 -0
- package/dist/commands/plan.d.ts +12 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +626 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/postmortem.d.ts +2 -0
- package/dist/commands/postmortem.d.ts.map +1 -0
- package/dist/commands/postmortem.js +157 -0
- package/dist/commands/postmortem.js.map +1 -0
- package/dist/commands/report.d.ts +2 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +213 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +29 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +60 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +750 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +237 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/atomicWrite.d.ts +2 -0
- package/dist/utils/atomicWrite.d.ts.map +1 -0
- package/dist/utils/atomicWrite.js +7 -0
- package/dist/utils/atomicWrite.js.map +1 -0
- package/dist/utils/authServer.d.ts +18 -0
- package/dist/utils/authServer.d.ts.map +1 -0
- package/dist/utils/authServer.js +215 -0
- package/dist/utils/authServer.js.map +1 -0
- package/dist/utils/config.d.ts +31 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +113 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/env.d.ts +7 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +19 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/errors.d.ts +6 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +112 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/formatter.d.ts +2 -0
- package/dist/utils/formatter.d.ts.map +1 -0
- package/dist/utils/formatter.js +55 -0
- package/dist/utils/formatter.js.map +1 -0
- package/dist/utils/git.d.ts +21 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +44 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/httpClient.d.ts +3 -0
- package/dist/utils/httpClient.d.ts.map +1 -0
- package/dist/utils/httpClient.js +45 -0
- package/dist/utils/httpClient.js.map +1 -0
- package/dist/utils/httpHeaders.d.ts +3 -0
- package/dist/utils/httpHeaders.d.ts.map +1 -0
- package/dist/utils/httpHeaders.js +11 -0
- package/dist/utils/httpHeaders.js.map +1 -0
- package/dist/utils/initOutput.d.ts +3 -0
- package/dist/utils/initOutput.d.ts.map +1 -0
- package/dist/utils/initOutput.js +45 -0
- package/dist/utils/initOutput.js.map +1 -0
- package/dist/utils/legacyCompat.d.ts +3 -0
- package/dist/utils/legacyCompat.d.ts.map +1 -0
- package/dist/utils/legacyCompat.js +20 -0
- package/dist/utils/legacyCompat.js.map +1 -0
- package/dist/utils/outputPolicy.d.ts +12 -0
- package/dist/utils/outputPolicy.d.ts.map +1 -0
- package/dist/utils/outputPolicy.js +171 -0
- package/dist/utils/outputPolicy.js.map +1 -0
- package/dist/utils/parsers.d.ts +14 -0
- package/dist/utils/parsers.d.ts.map +1 -0
- package/dist/utils/parsers.js +78 -0
- package/dist/utils/parsers.js.map +1 -0
- package/dist/utils/planFormat.d.ts +17 -0
- package/dist/utils/planFormat.d.ts.map +1 -0
- package/dist/utils/planFormat.js +81 -0
- package/dist/utils/planFormat.js.map +1 -0
- package/dist/utils/spinner.d.ts +6 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +34 -0
- package/dist/utils/spinner.js.map +1 -0
- package/dist/utils/updateCheck.d.ts +19 -0
- package/dist/utils/updateCheck.d.ts.map +1 -0
- package/dist/utils/updateCheck.js +103 -0
- package/dist/utils/updateCheck.js.map +1 -0
- package/package.json +55 -0
- package/rlarua-agentteams-cli-0.1.8.tgz +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, resolve } from 'node:path';
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { executeCommand } from './commands/index.js';
|
|
7
|
+
import { formatOutput } from './utils/formatter.js';
|
|
8
|
+
import { handleError } from './utils/errors.js';
|
|
9
|
+
import { createSummaryLines, shouldPrintSummary } from './utils/outputPolicy.js';
|
|
10
|
+
import { printInitResult } from './utils/initOutput.js';
|
|
11
|
+
import { startUpdateCheck, readCache, compareVersions, formatUpdateMessage } from './utils/updateCheck.js';
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const pkg = require('../package.json');
|
|
14
|
+
const program = new Command();
|
|
15
|
+
function normalizeFormat(format, fallback) {
|
|
16
|
+
if (format === 'json' || format === 'text')
|
|
17
|
+
return format;
|
|
18
|
+
return fallback;
|
|
19
|
+
}
|
|
20
|
+
function writeOutputFile(outputFile, content) {
|
|
21
|
+
const resolvedPath = resolve(outputFile);
|
|
22
|
+
mkdirSync(dirname(resolvedPath), { recursive: true });
|
|
23
|
+
writeFileSync(resolvedPath, content, 'utf-8');
|
|
24
|
+
const bytes = Buffer.byteLength(content, 'utf-8');
|
|
25
|
+
return { resolvedPath, bytes };
|
|
26
|
+
}
|
|
27
|
+
function printCommandResult(params) {
|
|
28
|
+
const outputText = typeof params.result === 'string' ? params.result : formatOutput(params.result, params.format);
|
|
29
|
+
const summaryLines = createSummaryLines(params.result, {
|
|
30
|
+
resource: params.resource,
|
|
31
|
+
action: params.action,
|
|
32
|
+
});
|
|
33
|
+
if (typeof params.outputFile === 'string' && params.outputFile.trim().length > 0) {
|
|
34
|
+
const { resolvedPath, bytes } = writeOutputFile(params.outputFile, outputText);
|
|
35
|
+
console.log(`Saved output to ${resolvedPath} (${bytes} bytes).`);
|
|
36
|
+
for (const line of summaryLines) {
|
|
37
|
+
console.log(line);
|
|
38
|
+
}
|
|
39
|
+
if (params.verbose) {
|
|
40
|
+
console.log(outputText);
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (shouldPrintSummary({
|
|
45
|
+
resource: params.resource,
|
|
46
|
+
action: params.action,
|
|
47
|
+
format: params.format,
|
|
48
|
+
formatExplicit: params.formatExplicit,
|
|
49
|
+
outputFile: params.outputFile,
|
|
50
|
+
verbose: params.verbose,
|
|
51
|
+
})) {
|
|
52
|
+
for (const line of summaryLines) {
|
|
53
|
+
console.log(line);
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
console.log(outputText);
|
|
58
|
+
}
|
|
59
|
+
const CONVENTION_HINT = `\nFor workflow rules and reporting guidelines, see: .agentteams/convention.md`;
|
|
60
|
+
program
|
|
61
|
+
.name('agentteams')
|
|
62
|
+
.description('CLI tool for AgentTeams API')
|
|
63
|
+
.version(pkg.version);
|
|
64
|
+
program
|
|
65
|
+
.command('init')
|
|
66
|
+
.description('Initialize AgentTeams CLI via OAuth')
|
|
67
|
+
.option('--format <format>', 'Output format (json, text)', 'text')
|
|
68
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
69
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
70
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
71
|
+
.action(async (options) => {
|
|
72
|
+
try {
|
|
73
|
+
const result = await executeCommand('init', 'start', {});
|
|
74
|
+
const format = normalizeFormat(options.format, 'text');
|
|
75
|
+
printInitResult(result, format);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.error(handleError(error));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
program
|
|
83
|
+
.command('sync')
|
|
84
|
+
.description('Sync local convention files from API')
|
|
85
|
+
.option('--format <format>', 'Output format (json, text)', 'text')
|
|
86
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
87
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
88
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
89
|
+
.action(async (options) => {
|
|
90
|
+
try {
|
|
91
|
+
const result = await executeCommand('sync', 'download', {
|
|
92
|
+
cwd: process.cwd(),
|
|
93
|
+
});
|
|
94
|
+
printCommandResult({
|
|
95
|
+
result,
|
|
96
|
+
format: normalizeFormat(options.format, 'text'),
|
|
97
|
+
outputFile: options.outputFile,
|
|
98
|
+
verbose: options.verbose,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error(handleError(error));
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
program
|
|
107
|
+
.command('plan')
|
|
108
|
+
.description('Manage plans')
|
|
109
|
+
.argument('<action>', 'Action to perform (list, get, show, create, update, delete, assign, download, cleanup, start, finish, quick, status, set-status, link-issue, unlink-issue, list-issues)')
|
|
110
|
+
.option('--id <id>', 'Plan ID')
|
|
111
|
+
.option('--title <title>', 'Plan title')
|
|
112
|
+
.option('--search <text>', 'Plan title/ID search keyword (list only)')
|
|
113
|
+
.option('--content <content>', 'Plan content (plain text or Tiptap JSON)')
|
|
114
|
+
.option('--interpret-escapes', 'Interpret \\n sequences in --content as newlines (create/update only)', false)
|
|
115
|
+
.option('--file <path>', 'Read plan content from a local file (create/update)')
|
|
116
|
+
.option('--template <name>', 'Plan content template (refactor-minimal, quick-minimal, create only)')
|
|
117
|
+
.option('--status <status>', 'Plan status (DRAFT, PENDING, ASSIGNED, IN_PROGRESS, BLOCKED, DONE, CANCELLED)')
|
|
118
|
+
.option('--type <type>', 'Plan type (FEATURE, BUG_FIX, ISSUE, REFACTOR, CHORE)')
|
|
119
|
+
.option('--priority <priority>', 'Plan priority (LOW, MEDIUM, HIGH)')
|
|
120
|
+
.option('--assigned-to <id>', 'Assigned agent config ID (list filter)')
|
|
121
|
+
.option('--task <text>', 'Task summary for plan start/finish')
|
|
122
|
+
.option('--report-title <title>', 'Completion report title (plan finish)')
|
|
123
|
+
.option('--report-file <path>', 'Read completion report content from a local file (plan finish)')
|
|
124
|
+
.option('--report-status <status>', 'Completion report status: COMPLETED, FAILED, PARTIAL (plan finish)')
|
|
125
|
+
.option('--quality-score <n>', 'Quality score 0-100 (plan finish)')
|
|
126
|
+
.option('--commit-hash <hash>', 'Git commit hash (plan finish, manual override)')
|
|
127
|
+
.option('--branch-name <name>', 'Git branch name (plan finish, manual override)')
|
|
128
|
+
.option('--files-modified <n>', 'Number of modified files (plan finish, manual override)')
|
|
129
|
+
.option('--lines-added <n>', 'Number of added lines (plan finish, manual override)')
|
|
130
|
+
.option('--lines-deleted <n>', 'Number of deleted lines (plan finish, manual override)')
|
|
131
|
+
.option('--duration-seconds <n>', 'Duration in seconds (plan finish, manual only)')
|
|
132
|
+
.option('--commit-start <hash>', 'Commit range start hash (plan finish, manual only)')
|
|
133
|
+
.option('--commit-end <hash>', 'Commit range end hash (plan finish, manual only)')
|
|
134
|
+
.option('--pull-request-id <id>', 'Pull request ID (plan finish, manual only)')
|
|
135
|
+
.option('--no-git', 'Disable git metrics auto-collection (plan finish)')
|
|
136
|
+
.option('--page <number>', 'Page number (list only)')
|
|
137
|
+
.option('--page-size <number>', 'Page size (list only)')
|
|
138
|
+
.option('--agent <agent>', 'Agent name or ID to assign')
|
|
139
|
+
.option('--provider <provider>', 'External issue provider (GITHUB, GITLAB, LINEAR)')
|
|
140
|
+
.option('--external-id <id>', 'External issue ID')
|
|
141
|
+
.option('--external-url <url>', 'External issue URL')
|
|
142
|
+
.option('--issue-id <id>', 'PlanExternalIssue ID (for unlink-issue)')
|
|
143
|
+
.option('--metadata <json>', 'Provider metadata as JSON (e.g. {"owner":"org","repo":"name"})')
|
|
144
|
+
.option('--include-deps', 'Include dependencies in plan get/show output', false)
|
|
145
|
+
.option('--format <format>', 'Output format (json, text)')
|
|
146
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
147
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
148
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
149
|
+
.action(async (action, options) => {
|
|
150
|
+
try {
|
|
151
|
+
const normalizedFormat = normalizeFormat(options.format, 'json');
|
|
152
|
+
const result = await executeCommand('plan', action, {
|
|
153
|
+
id: options.id,
|
|
154
|
+
title: options.title,
|
|
155
|
+
search: options.search,
|
|
156
|
+
content: options.content,
|
|
157
|
+
interpretEscapes: options.interpretEscapes,
|
|
158
|
+
file: options.file,
|
|
159
|
+
template: options.template,
|
|
160
|
+
status: options.status,
|
|
161
|
+
type: options.type,
|
|
162
|
+
priority: options.priority,
|
|
163
|
+
assignedTo: options.assignedTo,
|
|
164
|
+
task: options.task,
|
|
165
|
+
reportTitle: options.reportTitle,
|
|
166
|
+
reportFile: options.reportFile,
|
|
167
|
+
reportStatus: options.reportStatus,
|
|
168
|
+
qualityScore: options.qualityScore,
|
|
169
|
+
commitHash: options.commitHash,
|
|
170
|
+
branchName: options.branchName,
|
|
171
|
+
filesModified: options.filesModified,
|
|
172
|
+
linesAdded: options.linesAdded,
|
|
173
|
+
linesDeleted: options.linesDeleted,
|
|
174
|
+
durationSeconds: options.durationSeconds,
|
|
175
|
+
commitStart: options.commitStart,
|
|
176
|
+
commitEnd: options.commitEnd,
|
|
177
|
+
pullRequestId: options.pullRequestId,
|
|
178
|
+
git: options.git,
|
|
179
|
+
page: options.page,
|
|
180
|
+
pageSize: options.pageSize,
|
|
181
|
+
agent: options.agent,
|
|
182
|
+
provider: options.provider,
|
|
183
|
+
externalId: options.externalId,
|
|
184
|
+
externalUrl: options.externalUrl,
|
|
185
|
+
issueId: options.issueId,
|
|
186
|
+
metadata: options.metadata,
|
|
187
|
+
includeDeps: options.includeDeps,
|
|
188
|
+
format: normalizedFormat,
|
|
189
|
+
formatExplicit: typeof options.format === 'string',
|
|
190
|
+
});
|
|
191
|
+
printCommandResult({
|
|
192
|
+
result,
|
|
193
|
+
format: normalizedFormat,
|
|
194
|
+
outputFile: options.outputFile,
|
|
195
|
+
verbose: options.verbose,
|
|
196
|
+
resource: 'plan',
|
|
197
|
+
action,
|
|
198
|
+
formatExplicit: typeof options.format === 'string',
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
console.error(handleError(error));
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
program
|
|
207
|
+
.command('comment')
|
|
208
|
+
.description('Manage plan comments')
|
|
209
|
+
.argument('<action>', 'Action to perform (list, get, create, update, delete)')
|
|
210
|
+
.option('--id <id>', 'Comment ID')
|
|
211
|
+
.option('--plan-id <id>', 'Plan ID')
|
|
212
|
+
.option('--type <type>', 'Comment type (RISK, MODIFICATION, GENERAL)')
|
|
213
|
+
.option('--content <content>', 'Comment content')
|
|
214
|
+
.option('--affected-files <files>', 'Comma-separated list of affected file paths (create/update)')
|
|
215
|
+
.option('--page <number>', 'Page number (list only)')
|
|
216
|
+
.option('--page-size <number>', 'Page size (list only)')
|
|
217
|
+
.option('--format <format>', 'Output format (json, text)', 'json')
|
|
218
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
219
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
220
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
221
|
+
.action(async (action, options) => {
|
|
222
|
+
try {
|
|
223
|
+
const result = await executeCommand('comment', action, {
|
|
224
|
+
id: options.id,
|
|
225
|
+
planId: options.planId,
|
|
226
|
+
type: options.type,
|
|
227
|
+
content: options.content,
|
|
228
|
+
affectedFiles: options.affectedFiles,
|
|
229
|
+
page: options.page,
|
|
230
|
+
pageSize: options.pageSize,
|
|
231
|
+
});
|
|
232
|
+
printCommandResult({
|
|
233
|
+
result,
|
|
234
|
+
format: normalizeFormat(options.format, 'json'),
|
|
235
|
+
outputFile: options.outputFile,
|
|
236
|
+
verbose: options.verbose,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error(handleError(error));
|
|
241
|
+
process.exit(1);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
program
|
|
245
|
+
.command('report')
|
|
246
|
+
.description('Manage completion reports')
|
|
247
|
+
.argument('<action>', 'Action to perform (list, get, create, update, delete)')
|
|
248
|
+
.option('--id <id>', 'Report ID')
|
|
249
|
+
.option('--plan-id <id>', 'Plan ID (optional)')
|
|
250
|
+
.option('--title <title>', 'Report title')
|
|
251
|
+
.option('--file <path>', 'Read report content from a local file (create/update)')
|
|
252
|
+
.option('--status <status>', 'Report status (COMPLETED, FAILED, PARTIAL)')
|
|
253
|
+
.option('--commit-hash <hash>', 'Git commit hash (manual override)')
|
|
254
|
+
.option('--branch-name <name>', 'Git branch name (manual override)')
|
|
255
|
+
.option('--files-modified <n>', 'Number of modified files (manual override)')
|
|
256
|
+
.option('--lines-added <n>', 'Number of added lines (manual override)')
|
|
257
|
+
.option('--lines-deleted <n>', 'Number of deleted lines (manual override)')
|
|
258
|
+
.option('--duration-seconds <n>', 'Duration in seconds (manual only)')
|
|
259
|
+
.option('--commit-start <hash>', 'Commit range start hash (manual only)')
|
|
260
|
+
.option('--commit-end <hash>', 'Commit range end hash (manual only)')
|
|
261
|
+
.option('--pull-request-id <id>', 'Pull request ID (manual only)')
|
|
262
|
+
.option('--quality-score <n>', 'Quality score 0-100')
|
|
263
|
+
.option('--no-git', 'Disable git metrics auto-collection')
|
|
264
|
+
.option('--page <number>', 'Page number (list only)')
|
|
265
|
+
.option('--page-size <number>', 'Page size (list only)')
|
|
266
|
+
.option('--search <text>', 'Title keyword search (list only)')
|
|
267
|
+
.option('--limit <n>', 'Max results per page, alias for --page-size (list only)')
|
|
268
|
+
.option('--api-url <url>', 'Override API URL (optional)')
|
|
269
|
+
.option('--api-key <key>', 'Override API key (optional)')
|
|
270
|
+
.option('--project-id <id>', 'Override project ID (optional)')
|
|
271
|
+
.option('--team-id <id>', 'Override team ID (optional)')
|
|
272
|
+
.option('--agent-name <name>', 'Override agent name (optional)')
|
|
273
|
+
.option('--format <format>', 'Output format (json, text)')
|
|
274
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
275
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
276
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
277
|
+
.action(async (action, options) => {
|
|
278
|
+
try {
|
|
279
|
+
const normalizedFormat = normalizeFormat(options.format, 'json');
|
|
280
|
+
const result = await executeCommand('report', action, {
|
|
281
|
+
id: options.id,
|
|
282
|
+
planId: options.planId,
|
|
283
|
+
title: options.title,
|
|
284
|
+
file: options.file,
|
|
285
|
+
status: options.status,
|
|
286
|
+
commitHash: options.commitHash,
|
|
287
|
+
branchName: options.branchName,
|
|
288
|
+
filesModified: options.filesModified,
|
|
289
|
+
linesAdded: options.linesAdded,
|
|
290
|
+
linesDeleted: options.linesDeleted,
|
|
291
|
+
durationSeconds: options.durationSeconds,
|
|
292
|
+
commitStart: options.commitStart,
|
|
293
|
+
commitEnd: options.commitEnd,
|
|
294
|
+
pullRequestId: options.pullRequestId,
|
|
295
|
+
qualityScore: options.qualityScore,
|
|
296
|
+
git: options.git,
|
|
297
|
+
page: options.page,
|
|
298
|
+
pageSize: options.pageSize,
|
|
299
|
+
search: options.search,
|
|
300
|
+
limit: options.limit,
|
|
301
|
+
apiUrl: options.apiUrl,
|
|
302
|
+
apiKey: options.apiKey,
|
|
303
|
+
projectId: options.projectId,
|
|
304
|
+
teamId: options.teamId,
|
|
305
|
+
agentName: options.agentName,
|
|
306
|
+
});
|
|
307
|
+
printCommandResult({
|
|
308
|
+
result,
|
|
309
|
+
format: normalizedFormat,
|
|
310
|
+
outputFile: options.outputFile,
|
|
311
|
+
verbose: options.verbose,
|
|
312
|
+
resource: 'report',
|
|
313
|
+
action,
|
|
314
|
+
formatExplicit: typeof options.format === 'string',
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
console.error(handleError(error));
|
|
319
|
+
process.exit(1);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
program
|
|
323
|
+
.command('postmortem')
|
|
324
|
+
.description('Manage post mortems')
|
|
325
|
+
.argument('<action>', 'Action to perform (list, get, create, update, delete)')
|
|
326
|
+
.option('--id <id>', 'Post mortem ID')
|
|
327
|
+
.option('--plan-id <id>', 'Plan ID (optional)')
|
|
328
|
+
.option('--title <title>', 'Post mortem title')
|
|
329
|
+
.option('--content <content>', 'Post mortem markdown content (short text; use --file for long content)')
|
|
330
|
+
.option('--file <path>', 'Read postmortem content from a local file (create/update)')
|
|
331
|
+
.option('--action-items <csv>', 'Action items (comma-separated)')
|
|
332
|
+
.option('--status <status>', 'Post mortem status (OPEN, IN_PROGRESS, RESOLVED)')
|
|
333
|
+
.option('--page <number>', 'Page number (list only)')
|
|
334
|
+
.option('--page-size <number>', 'Page size (list only)')
|
|
335
|
+
.option('--search <text>', 'Title keyword search (list only)')
|
|
336
|
+
.option('--limit <n>', 'Max results per page, alias for --page-size (list only)')
|
|
337
|
+
.option('--api-url <url>', 'Override API URL (optional)')
|
|
338
|
+
.option('--api-key <key>', 'Override API key (optional)')
|
|
339
|
+
.option('--project-id <id>', 'Override project ID (optional)')
|
|
340
|
+
.option('--team-id <id>', 'Override team ID (optional)')
|
|
341
|
+
.option('--agent-name <name>', 'Override agent name (optional)')
|
|
342
|
+
.option('--format <format>', 'Output format (json, text)')
|
|
343
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
344
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
345
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
346
|
+
.action(async (action, options) => {
|
|
347
|
+
try {
|
|
348
|
+
const normalizedFormat = normalizeFormat(options.format, 'json');
|
|
349
|
+
const result = await executeCommand('postmortem', action, {
|
|
350
|
+
id: options.id,
|
|
351
|
+
planId: options.planId,
|
|
352
|
+
title: options.title,
|
|
353
|
+
content: options.content,
|
|
354
|
+
file: options.file,
|
|
355
|
+
actionItems: options.actionItems,
|
|
356
|
+
status: options.status,
|
|
357
|
+
page: options.page,
|
|
358
|
+
pageSize: options.pageSize,
|
|
359
|
+
search: options.search,
|
|
360
|
+
limit: options.limit,
|
|
361
|
+
apiUrl: options.apiUrl,
|
|
362
|
+
apiKey: options.apiKey,
|
|
363
|
+
projectId: options.projectId,
|
|
364
|
+
teamId: options.teamId,
|
|
365
|
+
agentName: options.agentName,
|
|
366
|
+
});
|
|
367
|
+
printCommandResult({
|
|
368
|
+
result,
|
|
369
|
+
format: normalizedFormat,
|
|
370
|
+
outputFile: options.outputFile,
|
|
371
|
+
verbose: options.verbose,
|
|
372
|
+
resource: 'postmortem',
|
|
373
|
+
action,
|
|
374
|
+
formatExplicit: typeof options.format === 'string',
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
catch (error) {
|
|
378
|
+
console.error(handleError(error));
|
|
379
|
+
process.exit(1);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
program
|
|
383
|
+
.command('coaction')
|
|
384
|
+
.description('Manage co-actions (session context dumps)')
|
|
385
|
+
.argument('<action>', 'Action to perform (list, get, create, update, delete, download, cleanup, takeaway-list, takeaway-create, takeaway-update, takeaway-delete, history, link-plan, unlink-plan, link-completion-report, unlink-completion-report, link-post-mortem, unlink-post-mortem)')
|
|
386
|
+
.option('--id <id>', 'Co-action ID')
|
|
387
|
+
.option('--takeaway-id <id>', 'Co-action takeaway ID (for takeaway-update/takeaway-delete)')
|
|
388
|
+
.option('--plan-id <id>', 'Plan ID (for link-plan/unlink-plan)')
|
|
389
|
+
.option('--completion-report-id <id>', 'Completion report ID for linking/unlinking')
|
|
390
|
+
.option('--post-mortem-id <id>', 'Post-mortem ID for linking/unlinking')
|
|
391
|
+
.option('--title <title>', 'Co-action title')
|
|
392
|
+
.option('--content <content>', 'Co-action content (short text; use --file for long content)')
|
|
393
|
+
.option('--file <path>', 'Read co-action content from a local file (create/update)')
|
|
394
|
+
.option('--status <status>', 'Co-action status (OPEN, CLOSED)')
|
|
395
|
+
.option('--visibility <visibility>', 'Co-action visibility (PRIVATE, PROJECT)')
|
|
396
|
+
.option('--page <number>', 'Page number (list only)')
|
|
397
|
+
.option('--page-size <number>', 'Page size (list only)')
|
|
398
|
+
.option('--search <text>', 'Title keyword search (list only)')
|
|
399
|
+
.option('--limit <n>', 'Max results per page, alias for --page-size (list only)')
|
|
400
|
+
.option('--api-url <url>', 'Override API URL (optional)')
|
|
401
|
+
.option('--api-key <key>', 'Override API key (optional)')
|
|
402
|
+
.option('--project-id <id>', 'Override project ID (optional)')
|
|
403
|
+
.option('--team-id <id>', 'Override team ID (optional)')
|
|
404
|
+
.option('--agent-name <name>', 'Override agent name (optional)')
|
|
405
|
+
.option('--format <format>', 'Output format (json, text)')
|
|
406
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
407
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
408
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
409
|
+
.action(async (action, options) => {
|
|
410
|
+
try {
|
|
411
|
+
const normalizedFormat = normalizeFormat(options.format, 'json');
|
|
412
|
+
const result = await executeCommand('coaction', action, {
|
|
413
|
+
id: options.id,
|
|
414
|
+
takeawayId: options.takeawayId,
|
|
415
|
+
planId: options.planId,
|
|
416
|
+
completionReportId: options.completionReportId,
|
|
417
|
+
postMortemId: options.postMortemId,
|
|
418
|
+
title: options.title,
|
|
419
|
+
content: options.content,
|
|
420
|
+
file: options.file,
|
|
421
|
+
status: options.status,
|
|
422
|
+
visibility: options.visibility,
|
|
423
|
+
page: options.page,
|
|
424
|
+
pageSize: options.pageSize,
|
|
425
|
+
search: options.search,
|
|
426
|
+
limit: options.limit,
|
|
427
|
+
apiUrl: options.apiUrl,
|
|
428
|
+
apiKey: options.apiKey,
|
|
429
|
+
projectId: options.projectId,
|
|
430
|
+
teamId: options.teamId,
|
|
431
|
+
agentName: options.agentName,
|
|
432
|
+
});
|
|
433
|
+
printCommandResult({
|
|
434
|
+
result,
|
|
435
|
+
format: normalizedFormat,
|
|
436
|
+
outputFile: options.outputFile,
|
|
437
|
+
verbose: options.verbose,
|
|
438
|
+
resource: 'coaction',
|
|
439
|
+
action,
|
|
440
|
+
formatExplicit: typeof options.format === 'string',
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
console.error(handleError(error));
|
|
445
|
+
process.exit(1);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
program
|
|
449
|
+
.command('feedback')
|
|
450
|
+
.description('Manage platform feedback')
|
|
451
|
+
.argument('<action>', 'Action to perform (create)')
|
|
452
|
+
.option('--category <category>', 'Feedback category (BUG, SUGGESTION, CONVENTION, UX)')
|
|
453
|
+
.option('--title <title>', 'Feedback title')
|
|
454
|
+
.option('--content <content>', 'Feedback content')
|
|
455
|
+
.option('--api-url <url>', 'Override API URL (optional)')
|
|
456
|
+
.option('--api-key <key>', 'Override API key (optional)')
|
|
457
|
+
.option('--project-id <id>', 'Override project ID (optional)')
|
|
458
|
+
.option('--team-id <id>', 'Override team ID (optional)')
|
|
459
|
+
.option('--agent-name <name>', 'Override agent name (optional)')
|
|
460
|
+
.option('--format <format>', 'Output format (json, text)', 'text')
|
|
461
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
462
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
463
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
464
|
+
.action(async (action, options) => {
|
|
465
|
+
try {
|
|
466
|
+
const normalizedFormat = normalizeFormat(options.format, 'text');
|
|
467
|
+
const result = await executeCommand('feedback', action, {
|
|
468
|
+
category: options.category,
|
|
469
|
+
title: options.title,
|
|
470
|
+
content: options.content,
|
|
471
|
+
apiUrl: options.apiUrl,
|
|
472
|
+
apiKey: options.apiKey,
|
|
473
|
+
projectId: options.projectId,
|
|
474
|
+
teamId: options.teamId,
|
|
475
|
+
agentName: options.agentName,
|
|
476
|
+
});
|
|
477
|
+
printCommandResult({
|
|
478
|
+
result,
|
|
479
|
+
format: normalizedFormat,
|
|
480
|
+
outputFile: options.outputFile,
|
|
481
|
+
verbose: options.verbose,
|
|
482
|
+
resource: 'feedback',
|
|
483
|
+
action,
|
|
484
|
+
formatExplicit: typeof options.format === 'string',
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
console.error(handleError(error));
|
|
489
|
+
process.exit(1);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
program
|
|
493
|
+
.command('convention')
|
|
494
|
+
.description('Manage project conventions')
|
|
495
|
+
.argument('<action>', 'Action to perform (list, show, download, create, update, delete)')
|
|
496
|
+
.option('--cwd <path>', 'Working directory (defaults to current)')
|
|
497
|
+
.option('-f, --file <path>', 'Target convention markdown file (repeatable; create requires a file under .agentteams/<category>/)', (value, previous = []) => previous.concat([value]), [])
|
|
498
|
+
.option('--apply', 'Apply changes to server (default: dry-run)', false)
|
|
499
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
500
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
501
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
502
|
+
.action(async (action, options) => {
|
|
503
|
+
try {
|
|
504
|
+
const result = await executeCommand('convention', action, {
|
|
505
|
+
cwd: options.cwd ?? process.cwd(),
|
|
506
|
+
file: options.file,
|
|
507
|
+
apply: options.apply,
|
|
508
|
+
});
|
|
509
|
+
printCommandResult({
|
|
510
|
+
result,
|
|
511
|
+
format: 'text',
|
|
512
|
+
outputFile: options.outputFile,
|
|
513
|
+
verbose: options.verbose,
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
console.error(handleError(error));
|
|
518
|
+
process.exit(1);
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
program
|
|
522
|
+
.command('dependency')
|
|
523
|
+
.description('Manage plan dependencies')
|
|
524
|
+
.argument('<action>', 'Action to perform (list, create, delete)')
|
|
525
|
+
.option('--plan-id <id>', 'Plan ID')
|
|
526
|
+
.option('--blocking-plan-id <id>', 'Blocking plan ID')
|
|
527
|
+
.option('--dep-id <id>', 'Dependency ID to delete')
|
|
528
|
+
.option('--format <format>', 'Output format (json, text)', 'json')
|
|
529
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
530
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
531
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
532
|
+
.action(async (action, options) => {
|
|
533
|
+
try {
|
|
534
|
+
const result = await executeCommand('dependency', action, {
|
|
535
|
+
planId: options.planId,
|
|
536
|
+
blockingPlanId: options.blockingPlanId,
|
|
537
|
+
depId: options.depId,
|
|
538
|
+
});
|
|
539
|
+
printCommandResult({
|
|
540
|
+
result,
|
|
541
|
+
format: normalizeFormat(options.format, 'json'),
|
|
542
|
+
outputFile: options.outputFile,
|
|
543
|
+
verbose: options.verbose,
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
catch (error) {
|
|
547
|
+
console.error(handleError(error));
|
|
548
|
+
process.exit(1);
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
program
|
|
552
|
+
.command('agent-config')
|
|
553
|
+
.description('Manage agent configurations')
|
|
554
|
+
.argument('<action>', 'Action to perform (list, get, delete)')
|
|
555
|
+
.option('--id <id>', 'Agent config ID')
|
|
556
|
+
.option('--format <format>', 'Output format (json, text)', 'json')
|
|
557
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
558
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
559
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
560
|
+
.action(async (action, options) => {
|
|
561
|
+
try {
|
|
562
|
+
const result = await executeCommand('agent-config', action, {
|
|
563
|
+
id: options.id,
|
|
564
|
+
});
|
|
565
|
+
printCommandResult({
|
|
566
|
+
result,
|
|
567
|
+
format: normalizeFormat(options.format, 'json'),
|
|
568
|
+
outputFile: options.outputFile,
|
|
569
|
+
verbose: options.verbose,
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
console.error(handleError(error));
|
|
574
|
+
process.exit(1);
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
program
|
|
578
|
+
.command('config')
|
|
579
|
+
.description('Manage configuration')
|
|
580
|
+
.argument('<action>', 'Action to perform (whoami)')
|
|
581
|
+
.option('--format <format>', 'Output format (json, text)', 'json')
|
|
582
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
583
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
584
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
585
|
+
.action(async (action, options) => {
|
|
586
|
+
try {
|
|
587
|
+
const result = await executeCommand('config', action, {});
|
|
588
|
+
printCommandResult({
|
|
589
|
+
result,
|
|
590
|
+
format: normalizeFormat(options.format, 'json'),
|
|
591
|
+
outputFile: options.outputFile,
|
|
592
|
+
verbose: options.verbose,
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
catch (error) {
|
|
596
|
+
console.error(handleError(error));
|
|
597
|
+
process.exit(1);
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
program
|
|
601
|
+
.command('search')
|
|
602
|
+
.description('Search across all entity types (plans, co-actions, reports, post-mortems, conventions)')
|
|
603
|
+
.option('--query <text>', 'Search query (required)')
|
|
604
|
+
.option('--types <types>', 'Comma-separated entity types to filter (PLAN, CO_ACTION, COMPLETION_REPORT, POST_MORTEM, CONVENTION)')
|
|
605
|
+
.option('--limit <n>', 'Max results (1-100, default: 20)')
|
|
606
|
+
.option('--max-tokens <n>', 'Token budget for response')
|
|
607
|
+
.option('--api-url <url>', 'Override API URL (optional)')
|
|
608
|
+
.option('--api-key <key>', 'Override API key (optional)')
|
|
609
|
+
.option('--project-id <id>', 'Override project ID (optional)')
|
|
610
|
+
.option('--team-id <id>', 'Override team ID (optional)')
|
|
611
|
+
.option('--agent-name <name>', 'Override agent name (optional)')
|
|
612
|
+
.option('--format <format>', 'Output format (json, text)', 'json')
|
|
613
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
614
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
615
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
616
|
+
.action(async (options) => {
|
|
617
|
+
try {
|
|
618
|
+
const normalizedFormat = normalizeFormat(options.format, 'json');
|
|
619
|
+
const result = await executeCommand('search', '', {
|
|
620
|
+
query: options.query,
|
|
621
|
+
types: options.types,
|
|
622
|
+
limit: options.limit,
|
|
623
|
+
maxTokens: options.maxTokens,
|
|
624
|
+
apiUrl: options.apiUrl,
|
|
625
|
+
apiKey: options.apiKey,
|
|
626
|
+
projectId: options.projectId,
|
|
627
|
+
teamId: options.teamId,
|
|
628
|
+
agentName: options.agentName,
|
|
629
|
+
});
|
|
630
|
+
printCommandResult({
|
|
631
|
+
result,
|
|
632
|
+
format: normalizedFormat,
|
|
633
|
+
outputFile: options.outputFile,
|
|
634
|
+
verbose: options.verbose,
|
|
635
|
+
resource: 'search',
|
|
636
|
+
formatExplicit: typeof options.format === 'string',
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
catch (error) {
|
|
640
|
+
console.error(handleError(error));
|
|
641
|
+
process.exit(1);
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
const linearCommand = program
|
|
645
|
+
.command('linear')
|
|
646
|
+
.description('Read Linear issues and add comments through the AgentTeams API')
|
|
647
|
+
.addHelpText('after', CONVENTION_HINT);
|
|
648
|
+
linearCommand
|
|
649
|
+
.command('issue')
|
|
650
|
+
.description('Read, create, or update a Linear issue')
|
|
651
|
+
.argument('<action>', 'Action to perform (get, create, update)')
|
|
652
|
+
.option('--issue-id <id>', 'Linear issue ID (required for get, update)')
|
|
653
|
+
.option('--team-id <id>', 'Linear team ID (required for create)')
|
|
654
|
+
.option('--title <text>', 'Issue title (required for create)')
|
|
655
|
+
.option('--description <text>', 'Issue description (optional, for create)')
|
|
656
|
+
.option('--state <name>', 'Issue state name, e.g. "Done", "Todo" (required for update, optional for create)')
|
|
657
|
+
.option('--api-url <url>', 'Override API URL (optional)')
|
|
658
|
+
.option('--api-key <key>', 'Override API key (optional)')
|
|
659
|
+
.option('--project-id <id>', 'Override project ID (optional)')
|
|
660
|
+
.option('--agent-name <name>', 'Override agent name (optional)')
|
|
661
|
+
.option('--format <format>', 'Output format (json, text)', 'text')
|
|
662
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
663
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
664
|
+
.action(async (action, options) => {
|
|
665
|
+
try {
|
|
666
|
+
if (action !== 'get' && action !== 'create' && action !== 'update') {
|
|
667
|
+
throw new Error(`Unknown action: ${action}`);
|
|
668
|
+
}
|
|
669
|
+
const actionMap = { get: 'issue-get', create: 'issue-create', update: 'issue-update' };
|
|
670
|
+
const commandAction = actionMap[action];
|
|
671
|
+
const normalizedFormat = normalizeFormat(options.format, action === 'get' ? 'text' : 'json');
|
|
672
|
+
const result = await executeCommand('linear', commandAction, {
|
|
673
|
+
issueId: options.issueId,
|
|
674
|
+
teamId: options.teamId,
|
|
675
|
+
title: options.title,
|
|
676
|
+
description: options.description,
|
|
677
|
+
state: options.state,
|
|
678
|
+
apiUrl: options.apiUrl,
|
|
679
|
+
apiKey: options.apiKey,
|
|
680
|
+
projectId: options.projectId,
|
|
681
|
+
agentName: options.agentName,
|
|
682
|
+
});
|
|
683
|
+
printCommandResult({
|
|
684
|
+
result,
|
|
685
|
+
format: normalizedFormat,
|
|
686
|
+
outputFile: options.outputFile,
|
|
687
|
+
verbose: options.verbose,
|
|
688
|
+
resource: 'linear',
|
|
689
|
+
action: commandAction,
|
|
690
|
+
formatExplicit: typeof options.format === 'string',
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
catch (error) {
|
|
694
|
+
console.error(handleError(error));
|
|
695
|
+
process.exit(1);
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
linearCommand
|
|
699
|
+
.command('comment')
|
|
700
|
+
.description('Create a comment on a Linear issue')
|
|
701
|
+
.argument('<action>', 'Action to perform (create)')
|
|
702
|
+
.option('--issue-id <id>', 'Linear issue ID')
|
|
703
|
+
.option('--body <text>', 'Comment body')
|
|
704
|
+
.option('--api-url <url>', 'Override API URL (optional)')
|
|
705
|
+
.option('--api-key <key>', 'Override API key (optional)')
|
|
706
|
+
.option('--project-id <id>', 'Override project ID (optional)')
|
|
707
|
+
.option('--team-id <id>', 'Override team ID (optional)')
|
|
708
|
+
.option('--agent-name <name>', 'Override agent name (optional)')
|
|
709
|
+
.option('--format <format>', 'Output format (json, text)', 'json')
|
|
710
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
711
|
+
.option('--verbose', 'Print full output to stdout (useful with --output-file)', false)
|
|
712
|
+
.action(async (action, options) => {
|
|
713
|
+
try {
|
|
714
|
+
if (action !== 'create') {
|
|
715
|
+
throw new Error(`Unknown action: ${action}`);
|
|
716
|
+
}
|
|
717
|
+
const normalizedFormat = normalizeFormat(options.format, 'json');
|
|
718
|
+
const result = await executeCommand('linear', 'comment-create', {
|
|
719
|
+
issueId: options.issueId,
|
|
720
|
+
body: options.body,
|
|
721
|
+
apiUrl: options.apiUrl,
|
|
722
|
+
apiKey: options.apiKey,
|
|
723
|
+
projectId: options.projectId,
|
|
724
|
+
teamId: options.teamId,
|
|
725
|
+
agentName: options.agentName,
|
|
726
|
+
});
|
|
727
|
+
printCommandResult({
|
|
728
|
+
result,
|
|
729
|
+
format: normalizedFormat,
|
|
730
|
+
outputFile: options.outputFile,
|
|
731
|
+
verbose: options.verbose,
|
|
732
|
+
resource: 'linear',
|
|
733
|
+
action: 'comment-create',
|
|
734
|
+
formatExplicit: typeof options.format === 'string',
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
catch (error) {
|
|
738
|
+
console.error(handleError(error));
|
|
739
|
+
process.exit(1);
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
startUpdateCheck(pkg.version);
|
|
743
|
+
program.parse();
|
|
744
|
+
process.on('beforeExit', () => {
|
|
745
|
+
const cache = readCache();
|
|
746
|
+
if (cache && compareVersions(pkg.version, cache.latestVersion)) {
|
|
747
|
+
process.stderr.write(formatUpdateMessage(pkg.version, cache.latestVersion));
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
//# sourceMappingURL=index.js.map
|