@nicolasmondain/cli-agent 2.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.

Potentially problematic release.


This version of @nicolasmondain/cli-agent might be problematic. Click here for more details.

Files changed (78) hide show
  1. package/README.md +484 -0
  2. package/dist/cli/commands/list.command.d.ts +48 -0
  3. package/dist/cli/commands/list.command.d.ts.map +1 -0
  4. package/dist/cli/commands/list.command.js +87 -0
  5. package/dist/cli/commands/list.command.js.map +1 -0
  6. package/dist/cli/commands/mcp-manifest.command.d.ts +14 -0
  7. package/dist/cli/commands/mcp-manifest.command.d.ts.map +1 -0
  8. package/dist/cli/commands/mcp-manifest.command.js +87 -0
  9. package/dist/cli/commands/mcp-manifest.command.js.map +1 -0
  10. package/dist/cli/index.d.ts +9 -0
  11. package/dist/cli/index.d.ts.map +1 -0
  12. package/dist/cli/index.js +112 -0
  13. package/dist/cli/index.js.map +1 -0
  14. package/dist/command/dynamic-command.factory.d.ts +16 -0
  15. package/dist/command/dynamic-command.factory.d.ts.map +1 -0
  16. package/dist/command/dynamic-command.factory.js +153 -0
  17. package/dist/command/dynamic-command.factory.js.map +1 -0
  18. package/dist/config/config-loader.d.ts +24 -0
  19. package/dist/config/config-loader.d.ts.map +1 -0
  20. package/dist/config/config-loader.js +95 -0
  21. package/dist/config/config-loader.js.map +1 -0
  22. package/dist/config/config-schema.d.ts +73 -0
  23. package/dist/config/config-schema.d.ts.map +1 -0
  24. package/dist/config/config-schema.js +7 -0
  25. package/dist/config/config-schema.js.map +1 -0
  26. package/dist/config/config-validator.d.ts +20 -0
  27. package/dist/config/config-validator.d.ts.map +1 -0
  28. package/dist/config/config-validator.js +162 -0
  29. package/dist/config/config-validator.js.map +1 -0
  30. package/dist/executor/js-executor.d.ts +29 -0
  31. package/dist/executor/js-executor.d.ts.map +1 -0
  32. package/dist/executor/js-executor.js +77 -0
  33. package/dist/executor/js-executor.js.map +1 -0
  34. package/dist/executor/script-executor.d.ts +33 -0
  35. package/dist/executor/script-executor.d.ts.map +1 -0
  36. package/dist/executor/script-executor.js +45 -0
  37. package/dist/executor/script-executor.js.map +1 -0
  38. package/dist/executor/shell-executor.d.ts +33 -0
  39. package/dist/executor/shell-executor.d.ts.map +1 -0
  40. package/dist/executor/shell-executor.js +126 -0
  41. package/dist/executor/shell-executor.js.map +1 -0
  42. package/dist/executor/ts-executor.d.ts +33 -0
  43. package/dist/executor/ts-executor.d.ts.map +1 -0
  44. package/dist/executor/ts-executor.js +134 -0
  45. package/dist/executor/ts-executor.js.map +1 -0
  46. package/dist/index.d.ts +14 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +15 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/infra/logger.d.ts +42 -0
  51. package/dist/infra/logger.d.ts.map +1 -0
  52. package/dist/infra/logger.js +96 -0
  53. package/dist/infra/logger.js.map +1 -0
  54. package/dist/infra/output.d.ts +11 -0
  55. package/dist/infra/output.d.ts.map +1 -0
  56. package/dist/infra/output.js +70 -0
  57. package/dist/infra/output.js.map +1 -0
  58. package/dist/mcp/manifest-generator.d.ts +51 -0
  59. package/dist/mcp/manifest-generator.d.ts.map +1 -0
  60. package/dist/mcp/manifest-generator.js +130 -0
  61. package/dist/mcp/manifest-generator.js.map +1 -0
  62. package/dist/services/file-system.service.d.ts +53 -0
  63. package/dist/services/file-system.service.d.ts.map +1 -0
  64. package/dist/services/file-system.service.js +100 -0
  65. package/dist/services/file-system.service.js.map +1 -0
  66. package/dist/services/naming.service.d.ts +40 -0
  67. package/dist/services/naming.service.d.ts.map +1 -0
  68. package/dist/services/naming.service.js +86 -0
  69. package/dist/services/naming.service.js.map +1 -0
  70. package/dist/services/naming.service.test.d.ts +2 -0
  71. package/dist/services/naming.service.test.d.ts.map +1 -0
  72. package/dist/services/naming.service.test.js +99 -0
  73. package/dist/services/naming.service.test.js.map +1 -0
  74. package/dist/types/index.d.ts +51 -0
  75. package/dist/types/index.d.ts.map +1 -0
  76. package/dist/types/index.js +14 -0
  77. package/dist/types/index.js.map +1 -0
  78. package/package.json +70 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * TypeScript Executor
3
+ *
4
+ * Executes .ts files using tsx (preferred) or ts-node.
5
+ */
6
+ import { spawn } from 'node:child_process';
7
+ import { pathExists } from '../services/file-system.service.js';
8
+ /**
9
+ * Execute a TypeScript file
10
+ *
11
+ * Strategy:
12
+ * 1. Try to use tsx (fast, modern TS executor)
13
+ * 2. Fall back to ts-node
14
+ * 3. Return error with installation instructions if neither available
15
+ *
16
+ * The script must export a default async function that accepts ScriptContext
17
+ * and returns a CommandResult.
18
+ *
19
+ * @param scriptPath - Absolute path to the TypeScript file
20
+ * @param context - Execution context
21
+ * @returns Script execution result
22
+ */
23
+ export async function executeTypeScript(scriptPath, context) {
24
+ // Check if file exists
25
+ if (!(await pathExists(scriptPath))) {
26
+ return {
27
+ success: false,
28
+ error: `Script not found: ${scriptPath}`,
29
+ };
30
+ }
31
+ // Serialize context to pass to the script via environment variable
32
+ const contextJson = JSON.stringify(context);
33
+ // Try tsx first, then ts-node
34
+ const executors = ['tsx', 'ts-node'];
35
+ for (const executor of executors) {
36
+ const result = await runWithExecutor(executor, scriptPath, contextJson);
37
+ if (result !== null) {
38
+ return result;
39
+ }
40
+ }
41
+ return {
42
+ success: false,
43
+ error: 'No TypeScript executor found. Please install one:\n' +
44
+ ' npm install -g tsx (recommended, faster)\n' +
45
+ ' npm install -g ts-node',
46
+ };
47
+ }
48
+ /**
49
+ * Run script with a specific TypeScript executor
50
+ * Returns null if executor is not available
51
+ */
52
+ async function runWithExecutor(executor, scriptPath, contextJson) {
53
+ return new Promise((resolve) => {
54
+ const child = spawn(executor, [scriptPath], {
55
+ env: {
56
+ ...process.env,
57
+ CLI_AGENT_CONTEXT: contextJson,
58
+ },
59
+ stdio: ['inherit', 'pipe', 'pipe'],
60
+ shell: false,
61
+ });
62
+ let stdout = '';
63
+ let stderr = '';
64
+ child.stdout?.on('data', (data) => {
65
+ stdout += data.toString();
66
+ });
67
+ child.stderr?.on('data', (data) => {
68
+ stderr += data.toString();
69
+ });
70
+ child.on('error', (error) => {
71
+ // Executor not found - return null to try next one
72
+ if (error.code === 'ENOENT') {
73
+ resolve(null);
74
+ }
75
+ else {
76
+ resolve({
77
+ success: false,
78
+ error: `Failed to execute with ${executor}: ${error.message}`,
79
+ });
80
+ }
81
+ });
82
+ child.on('close', (code) => {
83
+ // Try to parse JSON output from script
84
+ const trimmedStdout = stdout.trim();
85
+ if (trimmedStdout) {
86
+ try {
87
+ const result = JSON.parse(trimmedStdout);
88
+ if (typeof result === 'object' && 'success' in result) {
89
+ resolve(result);
90
+ return;
91
+ }
92
+ }
93
+ catch {
94
+ // Not JSON output, continue to wrap
95
+ }
96
+ }
97
+ // Script didn't output valid JSON result, wrap output
98
+ if (code === 0) {
99
+ resolve({
100
+ success: true,
101
+ message: trimmedStdout || 'Script completed successfully',
102
+ });
103
+ }
104
+ else {
105
+ resolve({
106
+ success: false,
107
+ error: stderr.trim() || trimmedStdout || `Script exited with code ${code}`,
108
+ });
109
+ }
110
+ });
111
+ });
112
+ }
113
+ /**
114
+ * Helper to get context in TypeScript scripts
115
+ *
116
+ * Usage in script:
117
+ * ```typescript
118
+ * import { getScriptContext } from 'cli-agent';
119
+ * const context = getScriptContext();
120
+ * ```
121
+ */
122
+ export function getScriptContext() {
123
+ const contextJson = process.env.CLI_AGENT_CONTEXT;
124
+ if (!contextJson) {
125
+ return null;
126
+ }
127
+ try {
128
+ return JSON.parse(contextJson);
129
+ }
130
+ catch {
131
+ return null;
132
+ }
133
+ }
134
+ //# sourceMappingURL=ts-executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-executor.js","sourceRoot":"","sources":["../../src/executor/ts-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CA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OAAO,EAAE,aAAa,IAAI,+BAA+B;iBAC1D,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC;oBACN,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,aAAa,IAAI,2BAA2B,IAAI,EAAE;iBAC3E,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAClD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAkB,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Library Entry Point
3
+ *
4
+ * Exports the public API for consumers to use in their scripts.
5
+ */
6
+ export type { OutputFormat, LogLevel, CommandResult, ScriptContext, ExitCodeValue, } from "./types/index.js";
7
+ export { ExitCode } from "./types/index.js";
8
+ export type { CliConfig, CommandConfig, ArgumentConfig, OptionConfig, LoadConfigResult, } from "./config/config-schema.js";
9
+ export { toKebabCase, toPascalCase, toCamelCase, toScreamingSnakeCase, isValidFeatureName, getFeatureNameError, } from "./services/naming.service.js";
10
+ export { pathExists, isDirectory, createDirectory, createFile, resolvePath, joinPath, createEntries, checkExistingPaths, } from "./services/file-system.service.js";
11
+ export { setLogLevel, getLogLevel, logError, logWarn, logInfo, logSuccess, logDebug, logTrace, logBox, resetLogger, } from "./infra/logger.js";
12
+ export { outputResult } from "./infra/output.js";
13
+ export { getScriptContext } from "./executor/ts-executor.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,YAAY,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,EACX,QAAQ,EACR,aAAa,EACb,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Library Entry Point
3
+ *
4
+ * Exports the public API for consumers to use in their scripts.
5
+ */
6
+ export { ExitCode } from "./types/index.js";
7
+ // Utility Services (consumers can use these in their scripts)
8
+ export { toKebabCase, toPascalCase, toCamelCase, toScreamingSnakeCase, isValidFeatureName, getFeatureNameError, } from "./services/naming.service.js";
9
+ export { pathExists, isDirectory, createDirectory, createFile, resolvePath, joinPath, createEntries, checkExistingPaths, } from "./services/file-system.service.js";
10
+ // Infrastructure (consumers can use these in their scripts)
11
+ export { setLogLevel, getLogLevel, logError, logWarn, logInfo, logSuccess, logDebug, logTrace, logBox, resetLogger, } from "./infra/logger.js";
12
+ export { outputResult } from "./infra/output.js";
13
+ // Script context helper (for TypeScript scripts executed via tsx/ts-node)
14
+ export { getScriptContext } from "./executor/ts-executor.js";
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAW5C,8DAA8D;AAC9D,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,EACX,QAAQ,EACR,aAAa,EACb,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAE3C,4DAA4D;AAC5D,OAAO,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,0EAA0E;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { LogLevel } from '../types/index.js';
2
+ /**
3
+ * Set the log level for the logger
4
+ */
5
+ export declare function setLogLevel(level: LogLevel): void;
6
+ /**
7
+ * Get the current log level
8
+ */
9
+ export declare function getLogLevel(): LogLevel;
10
+ /**
11
+ * Log an error message (always shown unless quiet)
12
+ */
13
+ export declare function logError(message: string, ...args: unknown[]): void;
14
+ /**
15
+ * Log a warning message
16
+ */
17
+ export declare function logWarn(message: string, ...args: unknown[]): void;
18
+ /**
19
+ * Log an info message
20
+ */
21
+ export declare function logInfo(message: string, ...args: unknown[]): void;
22
+ /**
23
+ * Log a success message
24
+ */
25
+ export declare function logSuccess(message: string, ...args: unknown[]): void;
26
+ /**
27
+ * Log a debug message (only in verbose/debug mode)
28
+ */
29
+ export declare function logDebug(message: string, ...args: unknown[]): void;
30
+ /**
31
+ * Log a trace message (only in debug mode)
32
+ */
33
+ export declare function logTrace(message: string, ...args: unknown[]): void;
34
+ /**
35
+ * Create a boxed message for important outputs
36
+ */
37
+ export declare function logBox(message: string): void;
38
+ /**
39
+ * Reset logger instance (useful for testing)
40
+ */
41
+ export declare function resetLogger(): void;
42
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/infra/logger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAoClD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAKjD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAElE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAEjE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAEjE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAEpE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAElE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAElE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC"}
@@ -0,0 +1,96 @@
1
+ import { createConsola } from 'consola';
2
+ /**
3
+ * Logger instance configured for CLI usage
4
+ * - All logs go to stderr (keeps stdout clean for results)
5
+ * - Supports different verbosity levels
6
+ */
7
+ let loggerInstance = null;
8
+ let currentLogLevel = 'normal';
9
+ /**
10
+ * Map our log levels to consola log levels
11
+ */
12
+ const LOG_LEVEL_MAP = {
13
+ quiet: -1, // Only errors
14
+ normal: 3, // Info and above
15
+ verbose: 4, // Debug and above
16
+ debug: 5, // Trace and above
17
+ };
18
+ /**
19
+ * Create or get the logger instance
20
+ */
21
+ function getLogger() {
22
+ if (!loggerInstance) {
23
+ loggerInstance = createConsola({
24
+ level: LOG_LEVEL_MAP[currentLogLevel],
25
+ // Force output to stderr
26
+ stderr: process.stderr,
27
+ stdout: process.stderr,
28
+ });
29
+ }
30
+ return loggerInstance;
31
+ }
32
+ /**
33
+ * Set the log level for the logger
34
+ */
35
+ export function setLogLevel(level) {
36
+ currentLogLevel = level;
37
+ if (loggerInstance) {
38
+ loggerInstance.level = LOG_LEVEL_MAP[level];
39
+ }
40
+ }
41
+ /**
42
+ * Get the current log level
43
+ */
44
+ export function getLogLevel() {
45
+ return currentLogLevel;
46
+ }
47
+ /**
48
+ * Log an error message (always shown unless quiet)
49
+ */
50
+ export function logError(message, ...args) {
51
+ getLogger().error(message, ...args);
52
+ }
53
+ /**
54
+ * Log a warning message
55
+ */
56
+ export function logWarn(message, ...args) {
57
+ getLogger().warn(message, ...args);
58
+ }
59
+ /**
60
+ * Log an info message
61
+ */
62
+ export function logInfo(message, ...args) {
63
+ getLogger().info(message, ...args);
64
+ }
65
+ /**
66
+ * Log a success message
67
+ */
68
+ export function logSuccess(message, ...args) {
69
+ getLogger().success(message, ...args);
70
+ }
71
+ /**
72
+ * Log a debug message (only in verbose/debug mode)
73
+ */
74
+ export function logDebug(message, ...args) {
75
+ getLogger().debug(message, ...args);
76
+ }
77
+ /**
78
+ * Log a trace message (only in debug mode)
79
+ */
80
+ export function logTrace(message, ...args) {
81
+ getLogger().trace(message, ...args);
82
+ }
83
+ /**
84
+ * Create a boxed message for important outputs
85
+ */
86
+ export function logBox(message) {
87
+ getLogger().box(message);
88
+ }
89
+ /**
90
+ * Reset logger instance (useful for testing)
91
+ */
92
+ export function resetLogger() {
93
+ loggerInstance = null;
94
+ currentLogLevel = 'normal';
95
+ }
96
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/infra/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAwB,MAAM,SAAS,CAAC;AAG9D;;;;GAIG;AAEH,IAAI,cAAc,GAA2B,IAAI,CAAC;AAClD,IAAI,eAAe,GAAa,QAAQ,CAAC;AAEzC;;GAEG;AACH,MAAM,aAAa,GAA6B;IAC9C,KAAK,EAAE,CAAC,CAAC,EAAK,cAAc;IAC5B,MAAM,EAAE,CAAC,EAAK,iBAAiB;IAC/B,OAAO,EAAE,CAAC,EAAI,kBAAkB;IAChC,KAAK,EAAE,CAAC,EAAM,kBAAkB;CACjC,CAAC;AAEF;;GAEG;AACH,SAAS,SAAS;IAChB,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,aAAa,CAAC;YAC7B,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC;YACrC,yBAAyB;YACzB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAe;IACz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ED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,cAAc,GAAG,IAAI,CAAC;IACtB,eAAe,GAAG,QAAQ,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { CommandResult, OutputFormat } from "../types/index.js";
2
+ /**
3
+ * Output utilities for CLI commands
4
+ * - Results go to stdout (for piping/parsing)
5
+ * - Supports human-readable and JSON formats
6
+ */
7
+ /**
8
+ * Output a result to stdout in the specified format
9
+ */
10
+ export declare function outputResult<T>(result: CommandResult<T>, format: OutputFormat): void;
11
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/infra/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE;;;;GAIG;AAEH;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,MAAM,EAAE,YAAY,GACnB,IAAI,CAMN"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Output utilities for CLI commands
3
+ * - Results go to stdout (for piping/parsing)
4
+ * - Supports human-readable and JSON formats
5
+ */
6
+ /**
7
+ * Output a result to stdout in the specified format
8
+ */
9
+ export function outputResult(result, format) {
10
+ if (format === "json") {
11
+ outputJson(result);
12
+ }
13
+ else {
14
+ outputHuman(result);
15
+ }
16
+ }
17
+ /**
18
+ * Output result as JSON to stdout
19
+ */
20
+ function outputJson(result) {
21
+ process.stdout.write(JSON.stringify(result, null, 2) + "\n");
22
+ }
23
+ /**
24
+ * Output result in human-readable format to stdout
25
+ */
26
+ function outputHuman(result) {
27
+ if (result.success) {
28
+ if (result.message) {
29
+ console.log(result.message);
30
+ }
31
+ if (result.data !== undefined) {
32
+ formatData(result.data);
33
+ }
34
+ }
35
+ else {
36
+ console.error(`Error: ${result.error ?? "Unknown error"}`);
37
+ }
38
+ }
39
+ /**
40
+ * Format data for human-readable output
41
+ */
42
+ function formatData(data) {
43
+ if (data === null || data === undefined) {
44
+ return;
45
+ }
46
+ if (typeof data === "string") {
47
+ // String data - output directly
48
+ console.log(data);
49
+ }
50
+ else if (typeof data === "number" || typeof data === "boolean") {
51
+ // Primitive data - output directly
52
+ console.log(String(data));
53
+ }
54
+ else if (Array.isArray(data)) {
55
+ // Array data - output each item
56
+ for (const item of data) {
57
+ if (typeof item === "object" && item !== null) {
58
+ console.log(JSON.stringify(item, null, 2));
59
+ }
60
+ else {
61
+ console.log(String(item));
62
+ }
63
+ }
64
+ }
65
+ else if (typeof data === "object") {
66
+ // Object data - pretty print JSON
67
+ console.log(JSON.stringify(data, null, 2));
68
+ }
69
+ }
70
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/infra/output.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAwB,EACxB,MAAoB;IAEpB,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,UAAU,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAI,MAAwB;IAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAI,MAAwB;IAC9C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAA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AC7C,CAAC;AACH,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * MCP Manifest Generator
3
+ *
4
+ * Converts cli-agent configuration to MCP (Model Context Protocol) tool manifest.
5
+ * This enables native integration with Claude Code and other MCP-compatible clients.
6
+ */
7
+ import type { CliConfig, CommandConfig } from "../config/config-schema.js";
8
+ /**
9
+ * MCP Tool Input Schema (JSON Schema format)
10
+ */
11
+ export interface McpInputSchema {
12
+ type: "object";
13
+ properties: Record<string, McpPropertySchema>;
14
+ required?: string[];
15
+ }
16
+ /**
17
+ * MCP Property Schema
18
+ */
19
+ export interface McpPropertySchema {
20
+ type: string;
21
+ description?: string;
22
+ default?: unknown;
23
+ enum?: string[];
24
+ }
25
+ /**
26
+ * MCP Tool Definition
27
+ */
28
+ export interface McpTool {
29
+ name: string;
30
+ description: string;
31
+ inputSchema: McpInputSchema;
32
+ }
33
+ /**
34
+ * MCP Tools Manifest
35
+ */
36
+ export interface McpManifest {
37
+ tools: McpTool[];
38
+ }
39
+ /**
40
+ * Convert a command config to MCP tool definition
41
+ */
42
+ export declare function commandToMcpTool(cmd: CommandConfig): McpTool;
43
+ /**
44
+ * Generate MCP manifest from cli-agent configuration
45
+ */
46
+ export declare function generateMcpManifest(config: CliConfig): McpManifest;
47
+ /**
48
+ * Generate MCP manifest as formatted JSON string
49
+ */
50
+ export declare function generateMcpManifestJson(config: CliConfig, pretty?: boolean): string;
51
+ //# sourceMappingURL=manifest-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-generator.d.ts","sourceRoot":"","sources":["../../src/mcp/manifest-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAGd,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,cAAc,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAmFD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CA0C5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAIlE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,EACjB,MAAM,UAAO,GACZ,MAAM,CAGR"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * MCP Manifest Generator
3
+ *
4
+ * Converts cli-agent configuration to MCP (Model Context Protocol) tool manifest.
5
+ * This enables native integration with Claude Code and other MCP-compatible clients.
6
+ */
7
+ /**
8
+ * Parse option flags to extract the option name
9
+ * Examples:
10
+ * "-n, --name <value>" -> "name"
11
+ * "--verbose" -> "verbose"
12
+ * "-f, --force" -> "force"
13
+ */
14
+ function parseOptionName(flags) {
15
+ // Match --option-name or -o, --option-name patterns
16
+ const match = flags.match(/--([a-zA-Z][\w-]*)/);
17
+ if (match && match[1]) {
18
+ return match[1];
19
+ }
20
+ return flags.replace(/[^a-zA-Z0-9-]/g, "");
21
+ }
22
+ /**
23
+ * Determine if option takes a value based on flags
24
+ * Examples:
25
+ * "-n, --name <value>" -> true (required value)
26
+ * "--count [num]" -> true (optional value)
27
+ * "--verbose" -> false (boolean flag)
28
+ */
29
+ function optionTakesValue(flags) {
30
+ return flags.includes("<") || flags.includes("[");
31
+ }
32
+ /**
33
+ * Convert an argument config to MCP property schema
34
+ */
35
+ function argumentToProperty(arg) {
36
+ const property = {
37
+ type: "string",
38
+ };
39
+ if (arg.description) {
40
+ property.description = arg.description;
41
+ }
42
+ if (arg.variadic) {
43
+ // Variadic arguments accept multiple values
44
+ return {
45
+ type: "array",
46
+ description: arg.description,
47
+ };
48
+ }
49
+ return property;
50
+ }
51
+ /**
52
+ * Convert an option config to MCP property schema
53
+ */
54
+ function optionToProperty(opt) {
55
+ const takesValue = optionTakesValue(opt.flags);
56
+ const property = {
57
+ type: takesValue ? "string" : "boolean",
58
+ };
59
+ if (opt.description) {
60
+ property.description = opt.description;
61
+ }
62
+ if (opt.default !== undefined) {
63
+ property.default = opt.default;
64
+ // Infer type from default value
65
+ if (typeof opt.default === "number") {
66
+ property.type = "number";
67
+ }
68
+ else if (typeof opt.default === "boolean") {
69
+ property.type = "boolean";
70
+ }
71
+ }
72
+ if (opt.choices && opt.choices.length > 0) {
73
+ property.enum = opt.choices;
74
+ }
75
+ return property;
76
+ }
77
+ /**
78
+ * Convert a command config to MCP tool definition
79
+ */
80
+ export function commandToMcpTool(cmd) {
81
+ const properties = {};
82
+ const required = [];
83
+ // Convert arguments
84
+ if (cmd.arguments) {
85
+ for (const arg of cmd.arguments) {
86
+ properties[arg.name] = argumentToProperty(arg);
87
+ // Arguments are required by default unless explicitly set to false
88
+ if (arg.required !== false) {
89
+ required.push(arg.name);
90
+ }
91
+ }
92
+ }
93
+ // Convert options
94
+ if (cmd.options) {
95
+ for (const opt of cmd.options) {
96
+ const optName = parseOptionName(opt.flags);
97
+ properties[optName] = optionToProperty(opt);
98
+ if (opt.required) {
99
+ required.push(optName);
100
+ }
101
+ }
102
+ }
103
+ const tool = {
104
+ name: cmd.name,
105
+ description: cmd.description ?? `Execute ${cmd.name} command`,
106
+ inputSchema: {
107
+ type: "object",
108
+ properties,
109
+ },
110
+ };
111
+ if (required.length > 0) {
112
+ tool.inputSchema.required = required;
113
+ }
114
+ return tool;
115
+ }
116
+ /**
117
+ * Generate MCP manifest from cli-agent configuration
118
+ */
119
+ export function generateMcpManifest(config) {
120
+ const tools = config.commands.map(commandToMcpTool);
121
+ return { tools };
122
+ }
123
+ /**
124
+ * Generate MCP manifest as formatted JSON string
125
+ */
126
+ export function generateMcpManifestJson(config, pretty = true) {
127
+ const manifest = generateMcpManifest(config);
128
+ return pretty ? JSON.stringify(manifest, null, 2) : JSON.stringify(manifest);
129
+ }
130
+ //# sourceMappingURL=manifest-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-generator.js","sourceRoot":"","sources":["../../src/mcp/manifest-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4CH;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,KAAa;IACpC,oDAAoD;IACpD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAChD,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,GAAmB;IAC7C,MAAM,QAAQ,GAAsB;QAClC,IAAI,EAAE,QAAQ;KACf,CAAC;IAEF,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;QACpB,QAAQ,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;IACzC,CAAC;IAED,IAAI,GAAG,CAAC,QA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AAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAAM,GAAG,IAAI;IAEb,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Represents a file or directory to be created
3
+ */
4
+ export interface FileEntry {
5
+ /** Relative path from the base directory */
6
+ path: string;
7
+ /** Type of entry */
8
+ type: "file" | "directory";
9
+ /** Content for files (undefined for directories) */
10
+ content?: string;
11
+ }
12
+ /**
13
+ * File system service for creating files and directories
14
+ */
15
+ /**
16
+ * Check if a path exists
17
+ */
18
+ export declare function pathExists(path: string): Promise<boolean>;
19
+ /**
20
+ * Check if a path is a directory
21
+ */
22
+ export declare function isDirectory(path: string): Promise<boolean>;
23
+ /**
24
+ * Create a directory (and parent directories if needed)
25
+ */
26
+ export declare function createDirectory(path: string): Promise<void>;
27
+ /**
28
+ * Create a file with content
29
+ * Creates parent directories if they don't exist
30
+ */
31
+ export declare function createFile(path: string, content: string): Promise<void>;
32
+ /**
33
+ * Resolve a path relative to a base path
34
+ */
35
+ export declare function resolvePath(basePath: string, relativePath: string): string;
36
+ /**
37
+ * Join path segments
38
+ */
39
+ export declare function joinPath(...segments: string[]): string;
40
+ /**
41
+ * Create all entries (files and directories) for a feature
42
+ * Returns the list of created paths
43
+ */
44
+ export declare function createEntries(basePath: string, entries: FileEntry[]): Promise<{
45
+ files: string[];
46
+ directories: string[];
47
+ }>;
48
+ /**
49
+ * Check if any of the given paths already exist
50
+ * Returns the list of existing paths
51
+ */
52
+ export declare function checkExistingPaths(basePath: string, paths: string[]): Promise<string[]>;
53
+ //# sourceMappingURL=file-system.service.d.ts.map