claude-gh-ticket-gen 1.0.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 +406 -0
- package/bin/claude-ticket-gen.js +6 -0
- package/dist/cli/commands/config.d.ts +8 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +84 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +9 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +243 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/init.d.ts +8 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +160 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +54 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui.d.ts +38 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +148 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/core/config-manager.d.ts +48 -0
- package/dist/core/config-manager.d.ts.map +1 -0
- package/dist/core/config-manager.js +165 -0
- package/dist/core/config-manager.js.map +1 -0
- package/dist/core/duplicate-detector.d.ts +13 -0
- package/dist/core/duplicate-detector.d.ts.map +1 -0
- package/dist/core/duplicate-detector.js +123 -0
- package/dist/core/duplicate-detector.js.map +1 -0
- package/dist/core/github.d.ts +46 -0
- package/dist/core/github.d.ts.map +1 -0
- package/dist/core/github.js +187 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/parser.d.ts +17 -0
- package/dist/core/parser.d.ts.map +1 -0
- package/dist/core/parser.js +177 -0
- package/dist/core/parser.js.map +1 -0
- package/dist/core/types.d.ts +89 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +28 -0
- package/dist/core/types.js.map +1 -0
- package/dist/templates/issue-template.d.ts +17 -0
- package/dist/templates/issue-template.d.ts.map +1 -0
- package/dist/templates/issue-template.js +87 -0
- package/dist/templates/issue-template.js.map +1 -0
- package/dist/templates/parsing-prompt.d.ts +5 -0
- package/dist/templates/parsing-prompt.d.ts.map +1 -0
- package/dist/templates/parsing-prompt.js +70 -0
- package/dist/templates/parsing-prompt.js.map +1 -0
- package/dist/utils/logger.d.ts +69 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +136 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validators.d.ts +45 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +80 -0
- package/dist/utils/validators.js.map +1 -0
- package/examples/ROADMAP.example.md +84 -0
- package/examples/config.example.json +22 -0
- package/package.json +54 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate command implementation
|
|
3
|
+
*/
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import { loadConfig, validateConfig } from '../../core/config-manager.js';
|
|
6
|
+
import { parseWithRetry } from '../../core/parser.js';
|
|
7
|
+
import { checkGhInstalled, checkGhAuth, getCurrentRepo, createIssue, ensureLabelsExist, ensureCustomLabels } from '../../core/github.js';
|
|
8
|
+
import { checkDuplicate } from '../../core/duplicate-detector.js';
|
|
9
|
+
import { logger } from '../../utils/logger.js';
|
|
10
|
+
import { validateFilePath, validateRepoFormat, validatePriority } from '../../utils/validators.js';
|
|
11
|
+
import { startSpinner, succeedSpinner, failSpinner, displayPreview, displaySummary } from '../ui.js';
|
|
12
|
+
import inquirer from 'inquirer';
|
|
13
|
+
/**
|
|
14
|
+
* Generate command handler
|
|
15
|
+
*/
|
|
16
|
+
export async function generateCommand(file, options = {}) {
|
|
17
|
+
try {
|
|
18
|
+
// 1. Validate prerequisites
|
|
19
|
+
await validatePrerequisites();
|
|
20
|
+
// 2. Determine file path
|
|
21
|
+
const filePath = await resolveFilePath(file);
|
|
22
|
+
// 3. Determine target repo
|
|
23
|
+
const repo = await resolveRepo(options.repo);
|
|
24
|
+
// 4. Parse document
|
|
25
|
+
logger.header('Parsing Document');
|
|
26
|
+
const spinner = startSpinner('Parsing document with Claude AI...');
|
|
27
|
+
let tasks;
|
|
28
|
+
try {
|
|
29
|
+
tasks = await parseWithRetry(filePath);
|
|
30
|
+
succeedSpinner(spinner, `Parsed ${tasks.length} tasks from document`);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
failSpinner(spinner, 'Failed to parse document');
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
if (tasks.length === 0) {
|
|
37
|
+
logger.warning('No tasks found in document');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// 5. Filter tasks
|
|
41
|
+
const filteredTasks = filterTasks(tasks, options);
|
|
42
|
+
logger.info(`${filteredTasks.length} tasks after filtering`);
|
|
43
|
+
if (filteredTasks.length === 0) {
|
|
44
|
+
logger.warning('No tasks match the filter criteria');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// 6. Preview
|
|
48
|
+
const isDryRun = options.dryRun || false;
|
|
49
|
+
displayPreview(filteredTasks);
|
|
50
|
+
// 7. Confirm (unless dry-run)
|
|
51
|
+
if (!isDryRun) {
|
|
52
|
+
const { confirm } = await inquirer.prompt([
|
|
53
|
+
{
|
|
54
|
+
type: 'confirm',
|
|
55
|
+
name: 'confirm',
|
|
56
|
+
message: `Create ${filteredTasks.length} GitHub issues in ${repo}?`,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
]);
|
|
60
|
+
if (!confirm) {
|
|
61
|
+
logger.info('Cancelled by user');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// 8. Create labels if needed
|
|
66
|
+
const config = loadConfig();
|
|
67
|
+
if (config.preferences.autoCreateLabels && !isDryRun) {
|
|
68
|
+
const labelSpinner = startSpinner('Ensuring labels exist...');
|
|
69
|
+
try {
|
|
70
|
+
await ensureLabelsExist(repo, config.labelColors);
|
|
71
|
+
await ensureCustomLabels(filteredTasks, repo);
|
|
72
|
+
succeedSpinner(labelSpinner, 'Labels ready');
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
failSpinner(labelSpinner, 'Failed to create labels (continuing anyway)');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// 9. Create issues
|
|
79
|
+
logger.header('Creating Issues');
|
|
80
|
+
const summary = {
|
|
81
|
+
totalTasks: tasks.length,
|
|
82
|
+
filteredTasks: filteredTasks.length,
|
|
83
|
+
created: 0,
|
|
84
|
+
skipped: 0,
|
|
85
|
+
duplicates: 0,
|
|
86
|
+
errors: 0,
|
|
87
|
+
};
|
|
88
|
+
for (let i = 0; i < filteredTasks.length; i++) {
|
|
89
|
+
const task = filteredTasks[i];
|
|
90
|
+
const progress = `[${i + 1}/${filteredTasks.length}]`;
|
|
91
|
+
// Check for duplicates
|
|
92
|
+
if (config.preferences.checkDuplicates && !isDryRun) {
|
|
93
|
+
const dupCheck = await checkDuplicate(task, repo, config.preferences.duplicateThreshold);
|
|
94
|
+
if (dupCheck.isDuplicate) {
|
|
95
|
+
logger.warning(`${progress} Skipping "${task.title}" - duplicate of #${dupCheck.existingIssueNumber}`);
|
|
96
|
+
summary.duplicates++;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Create issue
|
|
101
|
+
const creationSpinner = startSpinner(`${progress} Creating: ${task.title}`);
|
|
102
|
+
try {
|
|
103
|
+
const result = await createIssue(task, repo, isDryRun);
|
|
104
|
+
if (result.success) {
|
|
105
|
+
if (isDryRun) {
|
|
106
|
+
succeedSpinner(creationSpinner, `${progress} [DRY RUN] ${task.title}`);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
succeedSpinner(creationSpinner, `${progress} Created #${result.issueNumber}: ${task.title}`);
|
|
110
|
+
}
|
|
111
|
+
summary.created++;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
failSpinner(creationSpinner, `${progress} Failed: ${result.error}`);
|
|
115
|
+
summary.errors++;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
failSpinner(creationSpinner, `${progress} Error: ${error.message}`);
|
|
120
|
+
summary.errors++;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// 10. Display summary
|
|
124
|
+
displaySummary(summary);
|
|
125
|
+
if (isDryRun) {
|
|
126
|
+
console.log();
|
|
127
|
+
logger.info('This was a dry run. No issues were created.');
|
|
128
|
+
logger.info('Run without --dry-run to create issues.');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
logger.error(error.message);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Validate prerequisites
|
|
138
|
+
*/
|
|
139
|
+
async function validatePrerequisites() {
|
|
140
|
+
// Check config
|
|
141
|
+
const validation = validateConfig();
|
|
142
|
+
if (!validation.valid) {
|
|
143
|
+
logger.error('Configuration errors:');
|
|
144
|
+
validation.errors.forEach((err) => logger.error(` ${err}`));
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
// Check gh CLI
|
|
148
|
+
if (!checkGhInstalled()) {
|
|
149
|
+
logger.error('GitHub CLI (gh) is not installed');
|
|
150
|
+
logger.info('Install it from: https://cli.github.com/');
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
// Check gh auth
|
|
154
|
+
if (!checkGhAuth()) {
|
|
155
|
+
logger.error('Not authenticated with GitHub CLI');
|
|
156
|
+
logger.info('Run: gh auth login');
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Resolve file path
|
|
162
|
+
*/
|
|
163
|
+
async function resolveFilePath(file) {
|
|
164
|
+
if (file) {
|
|
165
|
+
const absolutePath = resolve(file);
|
|
166
|
+
if (!validateFilePath(absolutePath)) {
|
|
167
|
+
throw new Error(`File not found: ${file}`);
|
|
168
|
+
}
|
|
169
|
+
return absolutePath;
|
|
170
|
+
}
|
|
171
|
+
// Try default from config
|
|
172
|
+
const config = loadConfig();
|
|
173
|
+
if (config.defaultDocPath) {
|
|
174
|
+
const defaultPath = resolve(config.defaultDocPath);
|
|
175
|
+
if (validateFilePath(defaultPath)) {
|
|
176
|
+
logger.info(`Using default file: ${config.defaultDocPath}`);
|
|
177
|
+
return defaultPath;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Fallback to ROADMAP.md
|
|
181
|
+
const fallback = resolve('ROADMAP.md');
|
|
182
|
+
if (validateFilePath(fallback)) {
|
|
183
|
+
logger.info('Using ROADMAP.md');
|
|
184
|
+
return fallback;
|
|
185
|
+
}
|
|
186
|
+
throw new Error('No file specified and no default found');
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Resolve target repository
|
|
190
|
+
*/
|
|
191
|
+
async function resolveRepo(repoOption) {
|
|
192
|
+
if (repoOption) {
|
|
193
|
+
if (!validateRepoFormat(repoOption)) {
|
|
194
|
+
throw new Error('Invalid repository format. Expected: "owner/repo"');
|
|
195
|
+
}
|
|
196
|
+
return repoOption;
|
|
197
|
+
}
|
|
198
|
+
// Try current repo
|
|
199
|
+
const currentRepo = getCurrentRepo();
|
|
200
|
+
if (currentRepo) {
|
|
201
|
+
logger.info(`Using current repository: ${currentRepo}`);
|
|
202
|
+
return currentRepo;
|
|
203
|
+
}
|
|
204
|
+
// Try config default
|
|
205
|
+
const config = loadConfig();
|
|
206
|
+
if (config.defaultRepo) {
|
|
207
|
+
logger.info(`Using default repository: ${config.defaultRepo}`);
|
|
208
|
+
return config.defaultRepo;
|
|
209
|
+
}
|
|
210
|
+
throw new Error('No repository specified and could not detect current repo');
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Filter tasks based on options
|
|
214
|
+
*/
|
|
215
|
+
function filterTasks(tasks, options) {
|
|
216
|
+
let filtered = [...tasks];
|
|
217
|
+
// Skip completed tasks
|
|
218
|
+
filtered = filtered.filter((task) => !task.isCompleted);
|
|
219
|
+
// Filter by phase
|
|
220
|
+
if (options.filterPhase) {
|
|
221
|
+
filtered = filtered.filter((task) => task.phase?.toLowerCase() === options.filterPhase?.toLowerCase());
|
|
222
|
+
}
|
|
223
|
+
// Filter by priority
|
|
224
|
+
if (options.minPriority) {
|
|
225
|
+
if (!validatePriority(options.minPriority)) {
|
|
226
|
+
logger.warning(`Invalid priority: ${options.minPriority}. Ignoring filter.`);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
const priorityLevels = ['P0', 'P1', 'P2', 'P3'];
|
|
230
|
+
const minIndex = priorityLevels.indexOf(options.minPriority);
|
|
231
|
+
filtered = filtered.filter((task) => {
|
|
232
|
+
const taskIndex = priorityLevels.indexOf(task.priority);
|
|
233
|
+
return taskIndex <= minIndex;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// Filter optional
|
|
238
|
+
if (!options.includeOptional) {
|
|
239
|
+
filtered = filtered.filter((task) => !task.isOptional);
|
|
240
|
+
}
|
|
241
|
+
return filtered;
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/cli/commands/generate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;A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AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAiKjD"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init command implementation - Interactive setup wizard
|
|
3
|
+
*/
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
import { setConfigValue, loadConfig, getConfigPath } from '../../core/config-manager.js';
|
|
6
|
+
import { getCurrentRepo } from '../../core/github.js';
|
|
7
|
+
import { logger } from '../../utils/logger.js';
|
|
8
|
+
import { validateApiKey, validateRepoFormat } from '../../utils/validators.js';
|
|
9
|
+
/**
|
|
10
|
+
* Init command handler
|
|
11
|
+
*/
|
|
12
|
+
export async function initCommand() {
|
|
13
|
+
try {
|
|
14
|
+
console.log();
|
|
15
|
+
logger.header('Claude Ticket Generator - Setup Wizard');
|
|
16
|
+
console.log();
|
|
17
|
+
logger.info('This wizard will help you configure the tool.');
|
|
18
|
+
console.log();
|
|
19
|
+
const config = loadConfig();
|
|
20
|
+
// 1. API Key
|
|
21
|
+
const { apiKey } = await inquirer.prompt([
|
|
22
|
+
{
|
|
23
|
+
type: 'password',
|
|
24
|
+
name: 'apiKey',
|
|
25
|
+
message: 'Anthropic API Key:',
|
|
26
|
+
default: config.anthropicApiKey,
|
|
27
|
+
validate: (input) => {
|
|
28
|
+
if (!input) {
|
|
29
|
+
return 'API key is required';
|
|
30
|
+
}
|
|
31
|
+
if (!validateApiKey(input)) {
|
|
32
|
+
return 'Invalid API key format. Should start with "sk-ant-"';
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
setConfigValue('anthropicApiKey', apiKey);
|
|
39
|
+
logger.success('API key saved');
|
|
40
|
+
// 2. Default Repository
|
|
41
|
+
const currentRepo = getCurrentRepo();
|
|
42
|
+
let defaultRepoValue = config.defaultRepo;
|
|
43
|
+
if (!defaultRepoValue && currentRepo) {
|
|
44
|
+
defaultRepoValue = currentRepo;
|
|
45
|
+
}
|
|
46
|
+
const { useDefaultRepo } = await inquirer.prompt([
|
|
47
|
+
{
|
|
48
|
+
type: 'confirm',
|
|
49
|
+
name: 'useDefaultRepo',
|
|
50
|
+
message: 'Set a default repository?',
|
|
51
|
+
default: Boolean(defaultRepoValue),
|
|
52
|
+
},
|
|
53
|
+
]);
|
|
54
|
+
if (useDefaultRepo) {
|
|
55
|
+
const { defaultRepo } = await inquirer.prompt([
|
|
56
|
+
{
|
|
57
|
+
type: 'input',
|
|
58
|
+
name: 'defaultRepo',
|
|
59
|
+
message: 'Default repository (owner/repo):',
|
|
60
|
+
default: defaultRepoValue,
|
|
61
|
+
validate: (input) => {
|
|
62
|
+
if (!input) {
|
|
63
|
+
return true; // Allow empty
|
|
64
|
+
}
|
|
65
|
+
if (!validateRepoFormat(input)) {
|
|
66
|
+
return 'Invalid format. Expected: "owner/repo"';
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
]);
|
|
72
|
+
if (defaultRepo) {
|
|
73
|
+
setConfigValue('defaultRepo', defaultRepo);
|
|
74
|
+
logger.success(`Default repository set to: ${defaultRepo}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// 3. Default Document Path
|
|
78
|
+
const { useDefaultDoc } = await inquirer.prompt([
|
|
79
|
+
{
|
|
80
|
+
type: 'confirm',
|
|
81
|
+
name: 'useDefaultDoc',
|
|
82
|
+
message: 'Set a default document path?',
|
|
83
|
+
default: Boolean(config.defaultDocPath && config.defaultDocPath !== 'ROADMAP.md'),
|
|
84
|
+
},
|
|
85
|
+
]);
|
|
86
|
+
if (useDefaultDoc) {
|
|
87
|
+
const { defaultDocPath } = await inquirer.prompt([
|
|
88
|
+
{
|
|
89
|
+
type: 'input',
|
|
90
|
+
name: 'defaultDocPath',
|
|
91
|
+
message: 'Default document path:',
|
|
92
|
+
default: config.defaultDocPath || 'ROADMAP.md',
|
|
93
|
+
},
|
|
94
|
+
]);
|
|
95
|
+
if (defaultDocPath) {
|
|
96
|
+
setConfigValue('defaultDocPath', defaultDocPath);
|
|
97
|
+
logger.success(`Default document path set to: ${defaultDocPath}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// 4. Preferences
|
|
101
|
+
console.log();
|
|
102
|
+
logger.info('Configure preferences (press Enter to keep current values):');
|
|
103
|
+
console.log();
|
|
104
|
+
const { autoCreateLabels, checkDuplicates, duplicateThreshold } = await inquirer.prompt([
|
|
105
|
+
{
|
|
106
|
+
type: 'confirm',
|
|
107
|
+
name: 'autoCreateLabels',
|
|
108
|
+
message: 'Automatically create missing labels?',
|
|
109
|
+
default: config.preferences.autoCreateLabels,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: 'confirm',
|
|
113
|
+
name: 'checkDuplicates',
|
|
114
|
+
message: 'Check for duplicate issues?',
|
|
115
|
+
default: config.preferences.checkDuplicates,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'number',
|
|
119
|
+
name: 'duplicateThreshold',
|
|
120
|
+
message: 'Duplicate detection threshold (0.0 - 1.0):',
|
|
121
|
+
default: config.preferences.duplicateThreshold,
|
|
122
|
+
validate: (input) => {
|
|
123
|
+
if (input < 0 || input > 1) {
|
|
124
|
+
return 'Threshold must be between 0.0 and 1.0';
|
|
125
|
+
}
|
|
126
|
+
return true;
|
|
127
|
+
},
|
|
128
|
+
when: (answers) => answers.checkDuplicates,
|
|
129
|
+
},
|
|
130
|
+
]);
|
|
131
|
+
setConfigValue('preferences.autoCreateLabels', autoCreateLabels);
|
|
132
|
+
setConfigValue('preferences.checkDuplicates', checkDuplicates);
|
|
133
|
+
if (checkDuplicates && duplicateThreshold !== undefined) {
|
|
134
|
+
setConfigValue('preferences.duplicateThreshold', duplicateThreshold);
|
|
135
|
+
}
|
|
136
|
+
// 5. Summary
|
|
137
|
+
console.log();
|
|
138
|
+
logger.header('Setup Complete');
|
|
139
|
+
console.log();
|
|
140
|
+
logger.success('Configuration saved successfully!');
|
|
141
|
+
logger.dim(`Config file: ${getConfigPath()}`);
|
|
142
|
+
console.log();
|
|
143
|
+
logger.info('Next steps:');
|
|
144
|
+
logger.log(' 1. Create or update your roadmap document (e.g., ROADMAP.md)');
|
|
145
|
+
logger.log(' 2. Run: claude-ticket-gen generate --dry-run');
|
|
146
|
+
logger.log(' 3. Review the preview');
|
|
147
|
+
logger.log(' 4. Run: claude-ticket-gen generate (to create issues)');
|
|
148
|
+
console.log();
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
if (error.isTtyError) {
|
|
152
|
+
logger.error('Prompt could not be rendered in this environment');
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
logger.error(`Init failed: ${error.message}`);
|
|
156
|
+
}
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,CAAC,MAAM,CAAC,wCAAwC,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,EAAE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AO,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;QACpD,MAAM,CAAC,GAAG,CAAC,gBAAgB,aAAa,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;QAC7E,MAAM,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;QAC7D,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAAa,CAAC,UAAU,EAAE,CAAC;YAC9B,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,gBAAiB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;GAEG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Main CLI entry point
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import { join, dirname } from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
// Get package.json for version
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = dirname(__filename);
|
|
12
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf-8'));
|
|
13
|
+
const program = new Command();
|
|
14
|
+
program
|
|
15
|
+
.name('claude-ticket-gen')
|
|
16
|
+
.description('AI-powered CLI tool to parse roadmap documents and generate GitHub issues')
|
|
17
|
+
.version(packageJson.version);
|
|
18
|
+
// Config command
|
|
19
|
+
program
|
|
20
|
+
.command('config')
|
|
21
|
+
.description('Manage configuration settings')
|
|
22
|
+
.argument('[action]', 'Action: set, get, list, reset')
|
|
23
|
+
.argument('[key]', 'Config key (for set/get)')
|
|
24
|
+
.argument('[value]', 'Config value (for set)')
|
|
25
|
+
.action(async (action, key, value) => {
|
|
26
|
+
const { configCommand } = await import('./commands/config.js');
|
|
27
|
+
await configCommand(action, key, value);
|
|
28
|
+
});
|
|
29
|
+
// Generate command
|
|
30
|
+
program
|
|
31
|
+
.command('generate')
|
|
32
|
+
.description('Parse document and generate GitHub issues')
|
|
33
|
+
.argument('[file]', 'Path to roadmap/planning document')
|
|
34
|
+
.option('--repo <owner/repo>', 'Target GitHub repository')
|
|
35
|
+
.option('--dry-run', 'Preview without creating issues')
|
|
36
|
+
.option('--filter-phase <name>', 'Filter by phase/section')
|
|
37
|
+
.option('--min-priority <level>', 'Minimum priority level (P0-P3)')
|
|
38
|
+
.option('--include-optional', 'Include optional items')
|
|
39
|
+
.option('--config <path>', 'Use specific config file')
|
|
40
|
+
.action(async (file, options) => {
|
|
41
|
+
const { generateCommand } = await import('./commands/generate.js');
|
|
42
|
+
await generateCommand(file, options);
|
|
43
|
+
});
|
|
44
|
+
// Init command
|
|
45
|
+
program
|
|
46
|
+
.command('init')
|
|
47
|
+
.description('Initialize configuration with interactive wizard')
|
|
48
|
+
.action(async () => {
|
|
49
|
+
const { initCommand } = await import('./commands/init.js');
|
|
50
|
+
await initCommand();
|
|
51
|
+
});
|
|
52
|
+
// Parse arguments
|
|
53
|
+
program.parse();
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0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L,mBAAmB;AACnB,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,2CAA2C,CAAC;KACxD,QAAQ,CAAC,QAAQ,EAAE,mCAAmC,CAAC;KACvD,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;KACzD,MAAM,CAAC,WAAW,EAAE,iCAAiC,CAAC;KACtD,MAAM,CAAC,uBAAuB,EAAE,yBAAyB,CAAC;KAC1D,MAAM,CAAC,wBAAwB,EAAE,gCAAgC,CAAC;KAClE,MAAM,CAAC,oBAAoB,EAAE,wBAAwB,CAAC;KACtD,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;KACrD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC9B,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;IACnE,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEL,eAAe;AACf,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,kDAAkD,CAAC;KAC/D,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC3D,MAAM,WAAW,EAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEL,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/cli/ui.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI helpers for CLI (spinners, tables, etc.)
|
|
3
|
+
*/
|
|
4
|
+
import { Ora } from 'ora';
|
|
5
|
+
import { ParsedTask, GenerationSummary } from '../core/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Create and start a spinner
|
|
8
|
+
*/
|
|
9
|
+
export declare function startSpinner(text: string): Ora;
|
|
10
|
+
/**
|
|
11
|
+
* Stop spinner with success
|
|
12
|
+
*/
|
|
13
|
+
export declare function succeedSpinner(spinner: Ora, text?: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Stop spinner with failure
|
|
16
|
+
*/
|
|
17
|
+
export declare function failSpinner(spinner: Ora, text?: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Update spinner text
|
|
20
|
+
*/
|
|
21
|
+
export declare function updateSpinner(spinner: Ora, text: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Display tasks in a table
|
|
24
|
+
*/
|
|
25
|
+
export declare function displayTasksTable(tasks: ParsedTask[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Display generation summary
|
|
28
|
+
*/
|
|
29
|
+
export declare function displaySummary(summary: GenerationSummary): void;
|
|
30
|
+
/**
|
|
31
|
+
* Display configuration in a table
|
|
32
|
+
*/
|
|
33
|
+
export declare function displayConfig(config: any): void;
|
|
34
|
+
/**
|
|
35
|
+
* Display a preview of what would be created
|
|
36
|
+
*/
|
|
37
|
+
export declare function displayPreview(tasks: ParsedTask[]): void;
|
|
38
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/cli/ui.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG/B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAE9C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAwB3D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAkB/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAoC/C;AAYD;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CA+BxD"}
|