@nicolasmondain/cli-agent 3.0.2
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/README.md +183 -0
- package/dist/cli/commands/list.command.d.ts +48 -0
- package/dist/cli/commands/list.command.d.ts.map +1 -0
- package/dist/cli/commands/list.command.js +87 -0
- package/dist/cli/commands/list.command.js.map +1 -0
- package/dist/cli/commands/mcp-serve.command.d.ts +13 -0
- package/dist/cli/commands/mcp-serve.command.d.ts.map +1 -0
- package/dist/cli/commands/mcp-serve.command.js +42 -0
- package/dist/cli/commands/mcp-serve.command.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +111 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/command/dynamic-command.factory.d.ts +16 -0
- package/dist/command/dynamic-command.factory.d.ts.map +1 -0
- package/dist/command/dynamic-command.factory.js +161 -0
- package/dist/command/dynamic-command.factory.js.map +1 -0
- package/dist/config/config-loader.d.ts +24 -0
- package/dist/config/config-loader.d.ts.map +1 -0
- package/dist/config/config-loader.js +95 -0
- package/dist/config/config-loader.js.map +1 -0
- package/dist/config/config-schema.d.ts +73 -0
- package/dist/config/config-schema.d.ts.map +1 -0
- package/dist/config/config-schema.js +7 -0
- package/dist/config/config-schema.js.map +1 -0
- package/dist/config/config-validator.d.ts +20 -0
- package/dist/config/config-validator.d.ts.map +1 -0
- package/dist/config/config-validator.js +162 -0
- package/dist/config/config-validator.js.map +1 -0
- package/dist/executor/js-executor.d.ts +29 -0
- package/dist/executor/js-executor.d.ts.map +1 -0
- package/dist/executor/js-executor.js +77 -0
- package/dist/executor/js-executor.js.map +1 -0
- package/dist/executor/script-executor.d.ts +33 -0
- package/dist/executor/script-executor.d.ts.map +1 -0
- package/dist/executor/script-executor.js +45 -0
- package/dist/executor/script-executor.js.map +1 -0
- package/dist/executor/shell-executor.d.ts +33 -0
- package/dist/executor/shell-executor.d.ts.map +1 -0
- package/dist/executor/shell-executor.js +126 -0
- package/dist/executor/shell-executor.js.map +1 -0
- package/dist/executor/ts-executor.d.ts +33 -0
- package/dist/executor/ts-executor.d.ts.map +1 -0
- package/dist/executor/ts-executor.js +134 -0
- package/dist/executor/ts-executor.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/logger.d.ts +42 -0
- package/dist/infra/logger.d.ts.map +1 -0
- package/dist/infra/logger.js +96 -0
- package/dist/infra/logger.js.map +1 -0
- package/dist/infra/output.d.ts +11 -0
- package/dist/infra/output.d.ts.map +1 -0
- package/dist/infra/output.js +70 -0
- package/dist/infra/output.js.map +1 -0
- package/dist/mcp/mcp-server.d.ts +21 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -0
- package/dist/mcp/mcp-server.js +183 -0
- package/dist/mcp/mcp-server.js.map +1 -0
- package/dist/services/file-system.service.d.ts +53 -0
- package/dist/services/file-system.service.d.ts.map +1 -0
- package/dist/services/file-system.service.js +100 -0
- package/dist/services/file-system.service.js.map +1 -0
- package/dist/services/naming.service.d.ts +40 -0
- package/dist/services/naming.service.d.ts.map +1 -0
- package/dist/services/naming.service.js +86 -0
- package/dist/services/naming.service.js.map +1 -0
- package/dist/services/naming.service.test.d.ts +2 -0
- package/dist/services/naming.service.test.d.ts.map +1 -0
- package/dist/services/naming.service.test.js +99 -0
- package/dist/services/naming.service.test.js.map +1 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +14 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Naming service for converting between different case conventions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Convert a string to kebab-case
|
|
6
|
+
* @example "UserProfile" -> "user-profile"
|
|
7
|
+
* @example "user_profile" -> "user-profile"
|
|
8
|
+
* @example "user profile" -> "user-profile"
|
|
9
|
+
*/
|
|
10
|
+
export function toKebabCase(input) {
|
|
11
|
+
return input
|
|
12
|
+
// Insert hyphen before uppercase letters
|
|
13
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
14
|
+
// Replace underscores and spaces with hyphens
|
|
15
|
+
.replace(/[_\s]+/g, '-')
|
|
16
|
+
// Convert to lowercase
|
|
17
|
+
.toLowerCase()
|
|
18
|
+
// Remove any non-alphanumeric characters except hyphens
|
|
19
|
+
.replace(/[^a-z0-9-]/g, '')
|
|
20
|
+
// Remove consecutive hyphens
|
|
21
|
+
.replace(/-+/g, '-')
|
|
22
|
+
// Remove leading/trailing hyphens
|
|
23
|
+
.replace(/^-|-$/g, '');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Convert a string to PascalCase
|
|
27
|
+
* @example "user-profile" -> "UserProfile"
|
|
28
|
+
* @example "user_profile" -> "UserProfile"
|
|
29
|
+
*/
|
|
30
|
+
export function toPascalCase(input) {
|
|
31
|
+
return toKebabCase(input)
|
|
32
|
+
.split('-')
|
|
33
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
34
|
+
.join('');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Convert a string to camelCase
|
|
38
|
+
* @example "user-profile" -> "userProfile"
|
|
39
|
+
* @example "user_profile" -> "userProfile"
|
|
40
|
+
*/
|
|
41
|
+
export function toCamelCase(input) {
|
|
42
|
+
const pascal = toPascalCase(input);
|
|
43
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Convert a string to SCREAMING_SNAKE_CASE
|
|
47
|
+
* @example "user-profile" -> "USER_PROFILE"
|
|
48
|
+
* @example "UserProfile" -> "USER_PROFILE"
|
|
49
|
+
*/
|
|
50
|
+
export function toScreamingSnakeCase(input) {
|
|
51
|
+
return toKebabCase(input).replace(/-/g, '_').toUpperCase();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validate that a name is a valid feature name
|
|
55
|
+
* - Must not be empty
|
|
56
|
+
* - Must contain only alphanumeric characters, hyphens, or underscores
|
|
57
|
+
* - Must start with a letter
|
|
58
|
+
*/
|
|
59
|
+
export function isValidFeatureName(name) {
|
|
60
|
+
if (!name || name.trim().length === 0) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
// After converting to kebab-case, check if it's valid
|
|
64
|
+
const kebab = toKebabCase(name);
|
|
65
|
+
return /^[a-z][a-z0-9-]*$/.test(kebab);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get validation error message for an invalid feature name
|
|
69
|
+
*/
|
|
70
|
+
export function getFeatureNameError(name) {
|
|
71
|
+
if (!name || name.trim().length === 0) {
|
|
72
|
+
return 'Feature name cannot be empty';
|
|
73
|
+
}
|
|
74
|
+
const kebab = toKebabCase(name);
|
|
75
|
+
if (kebab.length === 0) {
|
|
76
|
+
return 'Feature name must contain at least one alphanumeric character';
|
|
77
|
+
}
|
|
78
|
+
if (!/^[a-z]/.test(kebab)) {
|
|
79
|
+
return 'Feature name must start with a letter';
|
|
80
|
+
}
|
|
81
|
+
if (!/^[a-z][a-z0-9-]*$/.test(kebab)) {
|
|
82
|
+
return 'Feature name can only contain letters, numbers, and hyphens';
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=naming.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.service.js","sourceRoot":"","sources":["../../src/services/naming.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,KAAK;QACV,yCAAyC;SACxC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;QACpC,8CAA8C;SAC7C,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;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CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,8BAA8B,CAAC;IACxC,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,+DAA+D,CAAC;IACzE,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,uCAAuC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,6DAA6D,CAAC;IACvE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.service.test.d.ts","sourceRoot":"","sources":["../../src/services/naming.service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { toKebabCase, toPascalCase, toCamelCase, toScreamingSnakeCase, isValidFeatureName, getFeatureNameError, } from './naming.service.js';
|
|
3
|
+
describe('Naming Service', () => {
|
|
4
|
+
describe('toKebabCase', () => {
|
|
5
|
+
it('should convert PascalCase to kebab-case', () => {
|
|
6
|
+
expect(toKebabCase('UserProfile')).toBe('user-profile');
|
|
7
|
+
expect(toKebabCase('MyAwesomeFeature')).toBe('my-awesome-feature');
|
|
8
|
+
});
|
|
9
|
+
it('should convert camelCase to kebab-case', () => {
|
|
10
|
+
expect(toKebabCase('userProfile')).toBe('user-profile');
|
|
11
|
+
expect(toKebabCase('myAwesomeFeature')).toBe('my-awesome-feature');
|
|
12
|
+
});
|
|
13
|
+
it('should convert snake_case to kebab-case', () => {
|
|
14
|
+
expect(toKebabCase('user_profile')).toBe('user-profile');
|
|
15
|
+
expect(toKebabCase('my_awesome_feature')).toBe('my-awesome-feature');
|
|
16
|
+
});
|
|
17
|
+
it('should convert spaces to hyphens', () => {
|
|
18
|
+
expect(toKebabCase('user profile')).toBe('user-profile');
|
|
19
|
+
expect(toKebabCase('my awesome feature')).toBe('my-awesome-feature');
|
|
20
|
+
});
|
|
21
|
+
it('should handle already kebab-case strings', () => {
|
|
22
|
+
expect(toKebabCase('user-profile')).toBe('user-profile');
|
|
23
|
+
});
|
|
24
|
+
it('should remove non-alphanumeric characters', () => {
|
|
25
|
+
expect(toKebabCase('user@profile!')).toBe('userprofile');
|
|
26
|
+
});
|
|
27
|
+
it('should handle consecutive hyphens', () => {
|
|
28
|
+
expect(toKebabCase('user--profile')).toBe('user-profile');
|
|
29
|
+
});
|
|
30
|
+
it('should remove leading/trailing hyphens', () => {
|
|
31
|
+
expect(toKebabCase('-user-profile-')).toBe('user-profile');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('toPascalCase', () => {
|
|
35
|
+
it('should convert kebab-case to PascalCase', () => {
|
|
36
|
+
expect(toPascalCase('user-profile')).toBe('UserProfile');
|
|
37
|
+
expect(toPascalCase('my-awesome-feature')).toBe('MyAwesomeFeature');
|
|
38
|
+
});
|
|
39
|
+
it('should convert snake_case to PascalCase', () => {
|
|
40
|
+
expect(toPascalCase('user_profile')).toBe('UserProfile');
|
|
41
|
+
});
|
|
42
|
+
it('should handle single word', () => {
|
|
43
|
+
expect(toPascalCase('user')).toBe('User');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe('toCamelCase', () => {
|
|
47
|
+
it('should convert kebab-case to camelCase', () => {
|
|
48
|
+
expect(toCamelCase('user-profile')).toBe('userProfile');
|
|
49
|
+
expect(toCamelCase('my-awesome-feature')).toBe('myAwesomeFeature');
|
|
50
|
+
});
|
|
51
|
+
it('should handle single word', () => {
|
|
52
|
+
expect(toCamelCase('user')).toBe('user');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe('toScreamingSnakeCase', () => {
|
|
56
|
+
it('should convert kebab-case to SCREAMING_SNAKE_CASE', () => {
|
|
57
|
+
expect(toScreamingSnakeCase('user-profile')).toBe('USER_PROFILE');
|
|
58
|
+
expect(toScreamingSnakeCase('my-awesome-feature')).toBe('MY_AWESOME_FEATURE');
|
|
59
|
+
});
|
|
60
|
+
it('should convert PascalCase to SCREAMING_SNAKE_CASE', () => {
|
|
61
|
+
expect(toScreamingSnakeCase('UserProfile')).toBe('USER_PROFILE');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('isValidFeatureName', () => {
|
|
65
|
+
it('should return true for valid names', () => {
|
|
66
|
+
expect(isValidFeatureName('user-profile')).toBe(true);
|
|
67
|
+
expect(isValidFeatureName('UserProfile')).toBe(true);
|
|
68
|
+
expect(isValidFeatureName('user123')).toBe(true);
|
|
69
|
+
expect(isValidFeatureName('a')).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
it('should return false for empty names', () => {
|
|
72
|
+
expect(isValidFeatureName('')).toBe(false);
|
|
73
|
+
expect(isValidFeatureName(' ')).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
it('should return false for names starting with number', () => {
|
|
76
|
+
expect(isValidFeatureName('123user')).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
it('should return false for names with only special characters', () => {
|
|
79
|
+
expect(isValidFeatureName('@#$%')).toBe(false);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('getFeatureNameError', () => {
|
|
83
|
+
it('should return null for valid names', () => {
|
|
84
|
+
expect(getFeatureNameError('user-profile')).toBeNull();
|
|
85
|
+
expect(getFeatureNameError('UserProfile')).toBeNull();
|
|
86
|
+
});
|
|
87
|
+
it('should return error for empty names', () => {
|
|
88
|
+
expect(getFeatureNameError('')).toBe('Feature name cannot be empty');
|
|
89
|
+
expect(getFeatureNameError(' ')).toBe('Feature name cannot be empty');
|
|
90
|
+
});
|
|
91
|
+
it('should return error for names with only special characters', () => {
|
|
92
|
+
expect(getFeatureNameError('@#$%')).toBe('Feature name must contain at least one alphanumeric character');
|
|
93
|
+
});
|
|
94
|
+
it('should return error for names starting with number', () => {
|
|
95
|
+
expect(getFeatureNameError('123user')).toBe('Feature name must start with a letter');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=naming.service.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.service.test.js","sourceRoot":"","sources":["../../src/services/naming.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACxD,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACxD,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAA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EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACvD,MAAM,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;YACrE,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;YACpE,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CACtC,+DAA+D,CAChE,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC5D,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CACzC,uCAAuC,CACxC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the CLI wrapper
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Output format for CLI commands
|
|
6
|
+
*/
|
|
7
|
+
export type OutputFormat = "human" | "json";
|
|
8
|
+
/**
|
|
9
|
+
* Log level for verbosity control
|
|
10
|
+
*/
|
|
11
|
+
export type LogLevel = "quiet" | "normal" | "verbose" | "debug";
|
|
12
|
+
/**
|
|
13
|
+
* Result of a CLI command execution
|
|
14
|
+
*
|
|
15
|
+
* Scripts must return this structure for proper handling.
|
|
16
|
+
*/
|
|
17
|
+
export interface CommandResult<T = unknown> {
|
|
18
|
+
/** Whether the command succeeded */
|
|
19
|
+
success: boolean;
|
|
20
|
+
/** Result data (type depends on the command) */
|
|
21
|
+
data?: T;
|
|
22
|
+
/** Error message if success is false */
|
|
23
|
+
error?: string;
|
|
24
|
+
/** Human-readable message */
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Context passed to scripts during execution
|
|
29
|
+
*/
|
|
30
|
+
export interface ScriptContext {
|
|
31
|
+
/** Parsed positional arguments */
|
|
32
|
+
args: Record<string, unknown>;
|
|
33
|
+
/** Parsed options */
|
|
34
|
+
options: Record<string, unknown>;
|
|
35
|
+
/** Current working directory */
|
|
36
|
+
cwd: string;
|
|
37
|
+
/** Output format requested */
|
|
38
|
+
format: OutputFormat;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Exit codes for the CLI
|
|
42
|
+
*/
|
|
43
|
+
export declare const ExitCode: {
|
|
44
|
+
readonly SUCCESS: 0;
|
|
45
|
+
readonly GENERAL_ERROR: 1;
|
|
46
|
+
readonly INVALID_ARGUMENT: 2;
|
|
47
|
+
readonly CONFIG_ERROR: 3;
|
|
48
|
+
readonly SCRIPT_ERROR: 4;
|
|
49
|
+
};
|
|
50
|
+
export type ExitCodeValue = (typeof ExitCode)[keyof typeof ExitCode];
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0CH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;CACP,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nicolasmondain/cli-agent",
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"description": "MCP server that turns your scripts into AI-powered tools for Claude and other AI assistants",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"cli-agent": "./dist/cli/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/nicolasmondain/cli-agent.git"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"dev": "tsc --watch",
|
|
24
|
+
"start": "node ./dist/cli/index.js",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
"test:coverage": "vitest run --coverage",
|
|
28
|
+
"lint": "eslint src --ext .ts",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"clean": "rm -rf dist",
|
|
31
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
32
|
+
"release": "release-it",
|
|
33
|
+
"release:dry": "release-it --dry-run"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"cli",
|
|
37
|
+
"cli-wrapper",
|
|
38
|
+
"command-line",
|
|
39
|
+
"commander",
|
|
40
|
+
"ai",
|
|
41
|
+
"ai-agent",
|
|
42
|
+
"llm",
|
|
43
|
+
"mcp",
|
|
44
|
+
"model-context-protocol",
|
|
45
|
+
"claude",
|
|
46
|
+
"automation",
|
|
47
|
+
"scripts",
|
|
48
|
+
"natural-language",
|
|
49
|
+
"nlp",
|
|
50
|
+
"tool-use",
|
|
51
|
+
"function-calling"
|
|
52
|
+
],
|
|
53
|
+
"author": "Nicolas Mondain",
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=20.0.0"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
60
|
+
"commander": "^12.1.0",
|
|
61
|
+
"consola": "^3.2.3",
|
|
62
|
+
"zod": "^3.25.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@release-it/conventional-changelog": "^10.0.4",
|
|
66
|
+
"@types/node": "^20.11.0",
|
|
67
|
+
"release-it": "^19.2.4",
|
|
68
|
+
"tsx": "^4.21.0",
|
|
69
|
+
"typescript": "^5.3.3",
|
|
70
|
+
"vitest": "^2.1.8"
|
|
71
|
+
}
|
|
72
|
+
}
|