musubix2 0.1.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/bin/musubix.mjs +28 -0
- package/dist/cli.d.ts +87 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1091 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -0
package/bin/musubix.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { CLIDispatcher, createCLIDispatcher, getDefaultCommands, parseArgs, showHelp } from '../dist/index.js';
|
|
3
|
+
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
|
|
6
|
+
if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
|
|
7
|
+
console.log(showHelp());
|
|
8
|
+
process.exit(0);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
12
|
+
const pkg = await import('../package.json', { with: { type: 'json' } });
|
|
13
|
+
console.log(`musubix2 v${pkg.default.version}`);
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const dispatcher = createCLIDispatcher();
|
|
18
|
+
const commands = getDefaultCommands();
|
|
19
|
+
commands.forEach(cmd => dispatcher.register(cmd.name, cmd.description, cmd.handler));
|
|
20
|
+
|
|
21
|
+
const parsed = parseArgs(args);
|
|
22
|
+
try {
|
|
23
|
+
const exitCode = await dispatcher.dispatch(parsed.command, parsed.args, parsed.flags);
|
|
24
|
+
process.exit(exitCode);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.error('Error:', err instanceof Error ? err.message : err);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MUSUBIX2 CLI Entry Point — DES-PKG-001
|
|
3
|
+
*
|
|
4
|
+
* Unified CLI for all MUSUBIX2 commands.
|
|
5
|
+
* Lightweight dispatcher with argument parsing, --help support,
|
|
6
|
+
* and wired-up handlers for tasks / init commands.
|
|
7
|
+
*
|
|
8
|
+
* @see REQ-ARC-003, REQ-SDD-004, REQ-SDD-005
|
|
9
|
+
*/
|
|
10
|
+
import { type ExitCodeValue } from '@musubix2/core';
|
|
11
|
+
export interface ParsedArgs {
|
|
12
|
+
command: string;
|
|
13
|
+
subcommand?: string;
|
|
14
|
+
args: string[];
|
|
15
|
+
flags: Record<string, string | boolean>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parse raw argv tokens into a structured ParsedArgs object.
|
|
19
|
+
* Supports `--flag`, `--key value`, `-h`, and positional args.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
22
|
+
/**
|
|
23
|
+
* Return formatted help text. If `command` is given, return subcommand help;
|
|
24
|
+
* otherwise return root-level help listing all commands.
|
|
25
|
+
*/
|
|
26
|
+
export declare function showHelp(command?: string): string;
|
|
27
|
+
export interface CLICommand {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
options?: Array<{
|
|
31
|
+
flag: string;
|
|
32
|
+
description: string;
|
|
33
|
+
default?: unknown;
|
|
34
|
+
}>;
|
|
35
|
+
action: (args: Record<string, unknown>) => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface CLIConfig {
|
|
38
|
+
name: string;
|
|
39
|
+
version: string;
|
|
40
|
+
description: string;
|
|
41
|
+
commands: CLICommand[];
|
|
42
|
+
}
|
|
43
|
+
export declare class CLIDispatcher {
|
|
44
|
+
private commands;
|
|
45
|
+
private config;
|
|
46
|
+
constructor(config: CLIConfig);
|
|
47
|
+
register(command: CLICommand): void;
|
|
48
|
+
registerBatch(commands: CLICommand[]): void;
|
|
49
|
+
getCommand(name: string): CLICommand | undefined;
|
|
50
|
+
listCommands(): CLICommand[];
|
|
51
|
+
dispatch(commandName: string, args?: Record<string, unknown>): Promise<void>;
|
|
52
|
+
getHelp(): string;
|
|
53
|
+
getVersion(): string;
|
|
54
|
+
/**
|
|
55
|
+
* High-level entry: parse argv, handle --help / -h, dispatch command,
|
|
56
|
+
* and return an ExitCode value.
|
|
57
|
+
*/
|
|
58
|
+
run(argv: string[]): Promise<ExitCodeValue>;
|
|
59
|
+
}
|
|
60
|
+
import { type TaskInfo } from '@musubix2/workflow-engine';
|
|
61
|
+
/**
|
|
62
|
+
* Parse a simple markdown task file into TaskInfo objects.
|
|
63
|
+
* Expected format — one task per line: `- [status] id | title | priority | complexity`
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseTaskFile(content: string): TaskInfo[];
|
|
66
|
+
export declare function handleTasksValidate(filePath: string): Promise<ExitCodeValue>;
|
|
67
|
+
export declare function handleTasksList(filePath?: string): Promise<ExitCodeValue>;
|
|
68
|
+
export declare function handleTasksStats(filePath?: string): Promise<ExitCodeValue>;
|
|
69
|
+
export declare function handleInit(targetPath?: string, name?: string, force?: boolean): Promise<ExitCodeValue>;
|
|
70
|
+
export declare function handleTrace(sub: string | undefined, args: string[]): Promise<ExitCodeValue>;
|
|
71
|
+
export declare function handleTraceVerify(): Promise<ExitCodeValue>;
|
|
72
|
+
export declare function handlePolicy(sub: string | undefined, args: string[]): Promise<ExitCodeValue>;
|
|
73
|
+
export declare function handleOntology(sub: string | undefined): Promise<ExitCodeValue>;
|
|
74
|
+
export declare function handleCodegraph(sub: string | undefined, args: string[]): Promise<ExitCodeValue>;
|
|
75
|
+
export declare function handleSecurity(filePath: string): Promise<ExitCodeValue>;
|
|
76
|
+
export declare function handleWorkflow(sub: string | undefined, args: string[]): Promise<ExitCodeValue>;
|
|
77
|
+
export declare function handleStatus(): Promise<ExitCodeValue>;
|
|
78
|
+
export declare function handleReqValidate(filePath: string): Promise<ExitCodeValue>;
|
|
79
|
+
export declare function handleReqWizard(): Promise<ExitCodeValue>;
|
|
80
|
+
export declare function handleDesignGenerate(filePath: string): Promise<ExitCodeValue>;
|
|
81
|
+
export declare function handleDesignC4(filePath: string, level?: string): Promise<ExitCodeValue>;
|
|
82
|
+
export declare function handleDesignVerify(filePath: string): Promise<ExitCodeValue>;
|
|
83
|
+
export declare function handleCodegen(name: string, type?: string): Promise<ExitCodeValue>;
|
|
84
|
+
export declare function handleTestGen(filePath: string): Promise<ExitCodeValue>;
|
|
85
|
+
export declare function getDefaultCommands(): CLICommand[];
|
|
86
|
+
export declare function createCLIDispatcher(): CLIDispatcher;
|
|
87
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgC9D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAmDpD;AA4DD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAuBjD;AAID,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC1E,MAAM,EAAE,CAAC,IAAI,EAAE,MAA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