-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.ts
More file actions
45 lines (40 loc) · 1.62 KB
/
Copy pathprogram.ts
File metadata and controls
45 lines (40 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Commander.js program configuration with I/O separation.
*
* Per CONTEXT.md D-04: All 8 commands registered with stub implementations.
* Per CONTEXT.md D-06: configureOutput separates stdout/stderr channels.
*/
import { Command } from 'commander';
import { createGenerateCommand } from '../commands/generate.js';
import { createScanCommand } from '../commands/scan.js';
import { createListCommand } from '../commands/list.js';
import { createSearchCommand } from '../commands/search.js';
import { createUpdateCommand } from '../commands/update.js';
import { createExamplesCommand } from '../commands/examples.js';
import { createSchemaCommand } from '../commands/schema.js';
/**
* Creates the Commander.js program with all commands registered.
*/
export function createProgram(): Command {
const program = new Command();
program.name('gitignorer');
program.description('Generate intelligent .gitignore files');
program.version('1.0.0');
// Configure I/O separation (per OUTPUT-06)
program.configureOutput({
writeOut: (str: string) => process.stdout.write(str),
writeErr: (str: string) => process.stderr.write(str),
outputError: (str: string, write: (s: string) => void) => {
write(`\x1b[31m${str}\x1b[0m`);
},
});
// Register commands (help is built-in to Commander.js)
program.addCommand(createGenerateCommand());
program.addCommand(createScanCommand());
program.addCommand(createListCommand());
program.addCommand(createSearchCommand());
program.addCommand(createUpdateCommand());
program.addCommand(createExamplesCommand());
program.addCommand(createSchemaCommand());
return program;
}