@c15t/cli 1.8.3 → 2.0.0-rc.1
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/dist/760.mjs +1720 -0
- package/dist/__tests__/auth/config-store.test.d.ts +2 -0
- package/dist/__tests__/auth/config-store.test.d.ts.map +1 -0
- package/dist/__tests__/constants.test.d.ts +2 -0
- package/dist/__tests__/constants.test.d.ts.map +1 -0
- package/dist/__tests__/detection/layout.test.d.ts +2 -0
- package/dist/__tests__/detection/layout.test.d.ts.map +1 -0
- package/dist/__tests__/mocks/prompts.d.ts +25 -0
- package/dist/__tests__/mocks/prompts.d.ts.map +1 -0
- package/dist/__tests__/utils/validation.test.d.ts +2 -0
- package/dist/__tests__/utils/validation.test.d.ts.map +1 -0
- package/dist/auth/config-store.d.ts +63 -0
- package/dist/auth/config-store.d.ts.map +1 -0
- package/dist/auth/device-flow.d.ts +41 -0
- package/dist/auth/device-flow.d.ts.map +1 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/types.d.ts +90 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/commands/auth/index.d.ts +21 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/generate/index.d.ts +23 -2
- package/dist/commands/generate/index.d.ts.map +1 -1
- package/dist/commands/generate/options/c15t-mode.d.ts.map +1 -1
- package/dist/commands/generate/options/custom-mode.d.ts +3 -1
- package/dist/commands/generate/options/custom-mode.d.ts.map +1 -1
- package/dist/commands/generate/options/offline-mode.d.ts.map +1 -1
- package/dist/commands/generate/options/self-hosted-mode.d.ts.map +1 -1
- package/dist/commands/generate/options/shared/backend-options.d.ts +26 -0
- package/dist/commands/generate/options/shared/backend-options.d.ts.map +1 -0
- package/dist/commands/generate/options/shared/dev-tools.d.ts +9 -0
- package/dist/commands/generate/options/shared/dev-tools.d.ts.map +1 -0
- package/dist/commands/generate/options/shared/frontend-ui-options.d.ts +44 -0
- package/dist/commands/generate/options/shared/frontend-ui-options.d.ts.map +1 -0
- package/dist/commands/generate/options/shared/index.d.ts +9 -0
- package/dist/commands/generate/options/shared/index.d.ts.map +1 -0
- package/dist/commands/generate/options/shared/ssr.d.ts +21 -0
- package/dist/commands/generate/options/shared/ssr.d.ts.map +1 -0
- package/dist/commands/generate/options/utils/generate-files.d.ts +10 -2
- package/dist/commands/generate/options/utils/generate-files.d.ts.map +1 -1
- package/dist/commands/generate/preflight.d.ts +31 -0
- package/dist/commands/generate/preflight.d.ts.map +1 -0
- package/dist/commands/generate/prompts/expanded-theme.d.ts +46 -0
- package/dist/commands/generate/prompts/expanded-theme.d.ts.map +1 -0
- package/dist/commands/generate/prompts/index.d.ts +10 -0
- package/dist/commands/generate/prompts/index.d.ts.map +1 -0
- package/dist/commands/generate/prompts/instance.d.ts +33 -0
- package/dist/commands/generate/prompts/instance.d.ts.map +1 -0
- package/dist/commands/generate/prompts/mode-select.d.ts +42 -0
- package/dist/commands/generate/prompts/mode-select.d.ts.map +1 -0
- package/dist/commands/generate/prompts/scripts.d.ts +66 -0
- package/dist/commands/generate/prompts/scripts.d.ts.map +1 -0
- package/dist/commands/generate/prompts/theme.d.ts +46 -0
- package/dist/commands/generate/prompts/theme.d.ts.map +1 -0
- package/dist/commands/generate/prompts/ui-style.d.ts +36 -0
- package/dist/commands/generate/prompts/ui-style.d.ts.map +1 -0
- package/dist/commands/generate/summary.d.ts +37 -0
- package/dist/commands/generate/summary.d.ts.map +1 -0
- package/dist/commands/generate/templates/config.d.ts +7 -6
- package/dist/commands/generate/templates/config.d.ts.map +1 -1
- package/dist/commands/generate/templates/css.d.ts +12 -0
- package/dist/commands/generate/templates/css.d.ts.map +1 -0
- package/dist/commands/generate/templates/index.d.ts +1 -1
- package/dist/commands/generate/templates/index.d.ts.map +1 -1
- package/dist/commands/generate/templates/layout.d.ts +7 -0
- package/dist/commands/generate/templates/layout.d.ts.map +1 -1
- package/dist/commands/generate/templates/next/app/layout.d.ts +9 -2
- package/dist/commands/generate/templates/next/app/layout.d.ts.map +1 -1
- package/dist/commands/generate/templates/next/index.d.ts +7 -0
- package/dist/commands/generate/templates/next/index.d.ts.map +1 -1
- package/dist/commands/generate/templates/next/pages/layout.d.ts +3 -1
- package/dist/commands/generate/templates/next/pages/layout.d.ts.map +1 -1
- package/dist/commands/generate/templates/shared/components.d.ts +69 -0
- package/dist/commands/generate/templates/shared/components.d.ts.map +1 -0
- package/dist/commands/generate/templates/shared/directory.d.ts +71 -0
- package/dist/commands/generate/templates/shared/directory.d.ts.map +1 -0
- package/dist/commands/generate/templates/shared/expanded-components.d.ts +50 -0
- package/dist/commands/generate/templates/shared/expanded-components.d.ts.map +1 -0
- package/dist/commands/generate/templates/shared/framework-config.d.ts +18 -0
- package/dist/commands/generate/templates/shared/framework-config.d.ts.map +1 -0
- package/dist/commands/generate/templates/shared/layout-pipeline.d.ts +47 -0
- package/dist/commands/generate/templates/shared/layout-pipeline.d.ts.map +1 -0
- package/dist/commands/generate/templates/shared/module-specifier.d.ts +68 -0
- package/dist/commands/generate/templates/shared/module-specifier.d.ts.map +1 -0
- package/dist/commands/generate/templates/shared/options.d.ts +37 -20
- package/dist/commands/generate/templates/shared/options.d.ts.map +1 -1
- package/dist/commands/generate/templates/shared/scripts.d.ts +62 -0
- package/dist/commands/generate/templates/shared/scripts.d.ts.map +1 -0
- package/dist/commands/generate/templates/shared/server-components.d.ts +38 -0
- package/dist/commands/generate/templates/shared/server-components.d.ts.map +1 -0
- package/dist/commands/index.d.ts +8 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/instances/index.d.ts +22 -0
- package/dist/commands/instances/index.d.ts.map +1 -0
- package/dist/commands/self-host/migrate/migrator-result.d.ts +1 -1
- package/dist/commands/self-host/migrate/migrator-result.d.ts.map +1 -1
- package/dist/commands/self-host/migrate/orm-result.d.ts +1 -1
- package/dist/commands/self-host/migrate/orm-result.d.ts.map +1 -1
- package/dist/commands/self-host/migrate/read-config.d.ts +1 -1
- package/dist/commands/self-host/migrate/read-config.d.ts.map +1 -1
- package/dist/constants.d.ts +101 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/context/framework-detection.d.ts +1 -0
- package/dist/context/framework-detection.d.ts.map +1 -1
- package/dist/context/types.d.ts +3 -3
- package/dist/context/types.d.ts.map +1 -1
- package/dist/core/context.d.ts +24 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/errors.d.ts +214 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/logger.d.ts +50 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/parser.d.ts +35 -0
- package/dist/core/parser.d.ts.map +1 -0
- package/dist/core/telemetry.d.ts +78 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/detection/framework.d.ts +31 -0
- package/dist/detection/framework.d.ts.map +1 -0
- package/dist/detection/index.d.ts +7 -0
- package/dist/detection/index.d.ts.map +1 -0
- package/dist/detection/layout.d.ts +36 -0
- package/dist/detection/layout.d.ts.map +1 -0
- package/dist/detection/package-manager.d.ts +31 -0
- package/dist/detection/package-manager.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2066 -1836
- package/dist/machines/generate/actions.d.ts +116 -0
- package/dist/machines/generate/actions.d.ts.map +1 -0
- package/dist/machines/generate/actors/dependencies.d.ts +43 -0
- package/dist/machines/generate/actors/dependencies.d.ts.map +1 -0
- package/dist/machines/generate/actors/file-generation.d.ts +54 -0
- package/dist/machines/generate/actors/file-generation.d.ts.map +1 -0
- package/dist/machines/generate/actors/preflight.d.ts +46 -0
- package/dist/machines/generate/actors/preflight.d.ts.map +1 -0
- package/dist/machines/generate/actors/prompts.d.ts +122 -0
- package/dist/machines/generate/actors/prompts.d.ts.map +1 -0
- package/dist/machines/generate/guards.d.ts +180 -0
- package/dist/machines/generate/guards.d.ts.map +1 -0
- package/dist/machines/generate/machine.d.ts +250 -0
- package/dist/machines/generate/machine.d.ts.map +1 -0
- package/dist/machines/generate/runner.d.ts +40 -0
- package/dist/machines/generate/runner.d.ts.map +1 -0
- package/dist/machines/generate/types.d.ts +189 -0
- package/dist/machines/generate/types.d.ts.map +1 -0
- package/dist/machines/index.d.ts +20 -0
- package/dist/machines/index.d.ts.map +1 -0
- package/dist/machines/persistence.d.ts +65 -0
- package/dist/machines/persistence.d.ts.map +1 -0
- package/dist/machines/telemetry-plugin.d.ts +54 -0
- package/dist/machines/telemetry-plugin.d.ts.map +1 -0
- package/dist/machines/types.d.ts +104 -0
- package/dist/machines/types.d.ts.map +1 -0
- package/dist/mcp/client.d.ts +61 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/types.d.ts +84 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/types.d.ts +238 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/formatter.d.ts +71 -0
- package/dist/utils/formatter.d.ts.map +1 -0
- package/dist/utils/fs.d.ts +80 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/spinner.d.ts +60 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/telemetry.d.ts +4 -0
- package/dist/utils/telemetry.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +68 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/package.json +63 -64
- package/LICENSE.md +0 -595
- package/dist/commands/generate/options/utils/shared-frontend.d.ts +0 -14
- package/dist/commands/generate/options/utils/shared-frontend.d.ts.map +0 -1
- package/dist/commands/generate/templates/backend.d.ts +0 -10
- package/dist/commands/generate/templates/backend.d.ts.map +0 -1
- package/dist/commands/generate/templates/next/app/components.d.ts +0 -44
- package/dist/commands/generate/templates/next/app/components.d.ts.map +0 -1
- package/dist/commands/generate/templates/next/pages/components.d.ts +0 -22
- package/dist/commands/generate/templates/next/pages/components.d.ts.map +0 -1
- package/dist/commands/generate/templates/react/components.d.ts +0 -21
- package/dist/commands/generate/templates/react/components.d.ts.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for CLI state machines
|
|
3
|
+
*
|
|
4
|
+
* Base types and interfaces used across all state machines in the CLI.
|
|
5
|
+
*/
|
|
6
|
+
import type { Snapshot } from 'xstate';
|
|
7
|
+
/**
|
|
8
|
+
* Base context fields shared across all machines
|
|
9
|
+
*/
|
|
10
|
+
export interface BaseMachineContext {
|
|
11
|
+
/** Errors accumulated during execution */
|
|
12
|
+
errors: MachineError[];
|
|
13
|
+
/** History of state transitions for debugging/telemetry */
|
|
14
|
+
stateHistory: StateHistoryEntry[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Error tracked during machine execution
|
|
18
|
+
*/
|
|
19
|
+
export interface MachineError {
|
|
20
|
+
/** State where error occurred */
|
|
21
|
+
state: string;
|
|
22
|
+
/** The error object */
|
|
23
|
+
error: Error;
|
|
24
|
+
/** Timestamp when error occurred */
|
|
25
|
+
timestamp: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Entry in state history for telemetry
|
|
29
|
+
*/
|
|
30
|
+
export interface StateHistoryEntry {
|
|
31
|
+
/** State name */
|
|
32
|
+
state: string;
|
|
33
|
+
/** Entry timestamp */
|
|
34
|
+
timestamp: number;
|
|
35
|
+
/** Optional event that caused transition */
|
|
36
|
+
event?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* File modification tracking for rollback
|
|
40
|
+
*/
|
|
41
|
+
export interface FileModification {
|
|
42
|
+
/** Path to the file */
|
|
43
|
+
path: string;
|
|
44
|
+
/** Original content (for restoring) */
|
|
45
|
+
backup: string;
|
|
46
|
+
/** Type of modification */
|
|
47
|
+
type: 'created' | 'modified';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Common events that all machines should handle
|
|
51
|
+
*/
|
|
52
|
+
export type CommonEvents = {
|
|
53
|
+
type: 'CANCEL';
|
|
54
|
+
} | {
|
|
55
|
+
type: 'RETRY';
|
|
56
|
+
} | {
|
|
57
|
+
type: 'RESET';
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Snapshot type for persistence
|
|
61
|
+
*/
|
|
62
|
+
export type PersistedSnapshot<TContext, TStateValue> = Snapshot<unknown> & {
|
|
63
|
+
context: TContext;
|
|
64
|
+
value: TStateValue;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Result of an async actor operation
|
|
68
|
+
*/
|
|
69
|
+
export type ActorResult<T> = {
|
|
70
|
+
success: true;
|
|
71
|
+
data: T;
|
|
72
|
+
} | {
|
|
73
|
+
success: false;
|
|
74
|
+
error: Error;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Configuration for state machine execution
|
|
78
|
+
*/
|
|
79
|
+
export interface MachineExecutionConfig {
|
|
80
|
+
/** Enable verbose logging */
|
|
81
|
+
debug?: boolean;
|
|
82
|
+
/** Enable state persistence for resume */
|
|
83
|
+
persist?: boolean;
|
|
84
|
+
/** Path for persistence file */
|
|
85
|
+
persistPath?: string;
|
|
86
|
+
/** Enable telemetry tracking */
|
|
87
|
+
trackTelemetry?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Result of running a state machine to completion
|
|
91
|
+
*/
|
|
92
|
+
export interface MachineExecutionResult<TContext> {
|
|
93
|
+
/** Whether execution completed successfully */
|
|
94
|
+
success: boolean;
|
|
95
|
+
/** Final context */
|
|
96
|
+
context: TContext;
|
|
97
|
+
/** Final state value */
|
|
98
|
+
finalState: string;
|
|
99
|
+
/** Total execution time in ms */
|
|
100
|
+
duration: number;
|
|
101
|
+
/** Errors encountered during execution */
|
|
102
|
+
errors: MachineError[];
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/machines/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,0CAA0C;IAC1C,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,2DAA2D;IAC3D,YAAY,EAAE,iBAAiB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAErB;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,QAAQ,EAAE,WAAW,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG;IAC1E,OAAO,EAAE,QAAQ,CAAC;IAClB,KAAK,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IACtB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,QAAQ;IAC/C,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,OAAO,EAAE,QAAQ,CAAC;IAClB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,MAAM,EAAE,YAAY,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Client for c15t
|
|
3
|
+
*
|
|
4
|
+
* Wraps the MCP SDK to provide a typed interface for communicating
|
|
5
|
+
* with the c15t MCP server using StreamableHTTPClientTransport.
|
|
6
|
+
*/
|
|
7
|
+
import type { Instance } from '../types';
|
|
8
|
+
import type { CreateInstanceRequest, MCPClientConfig, MCPConnectionState } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* MCP Client for c15t instances
|
|
11
|
+
*
|
|
12
|
+
* Uses the MCP SDK's StreamableHTTPClientTransport for communication.
|
|
13
|
+
*/
|
|
14
|
+
export declare class C15tMCPClient {
|
|
15
|
+
private config;
|
|
16
|
+
private connected;
|
|
17
|
+
private client;
|
|
18
|
+
private transport;
|
|
19
|
+
constructor(config: MCPClientConfig);
|
|
20
|
+
/**
|
|
21
|
+
* Connect to the MCP server
|
|
22
|
+
*/
|
|
23
|
+
connect(): Promise<MCPConnectionState>;
|
|
24
|
+
/**
|
|
25
|
+
* Disconnect from the MCP server
|
|
26
|
+
*/
|
|
27
|
+
close(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Check if connected
|
|
30
|
+
*/
|
|
31
|
+
isConnected(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Call an MCP tool
|
|
34
|
+
*/
|
|
35
|
+
private callTool;
|
|
36
|
+
/**
|
|
37
|
+
* List all instances for the authenticated user
|
|
38
|
+
*/
|
|
39
|
+
listInstances(): Promise<Instance[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Get a specific instance by ID
|
|
42
|
+
*/
|
|
43
|
+
getInstance(id: string): Promise<Instance>;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new instance
|
|
46
|
+
*/
|
|
47
|
+
createInstance(request: CreateInstanceRequest): Promise<Instance>;
|
|
48
|
+
/**
|
|
49
|
+
* Delete an instance
|
|
50
|
+
*/
|
|
51
|
+
deleteInstance(id: string): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create and connect an MCP client
|
|
55
|
+
*/
|
|
56
|
+
export declare function createMCPClient(accessToken: string, baseUrl?: string): Promise<C15tMCPClient>;
|
|
57
|
+
/**
|
|
58
|
+
* Create an MCP client from stored config
|
|
59
|
+
*/
|
|
60
|
+
export declare function createMCPClientFromConfig(baseUrl?: string): Promise<C15tMCPClient | null>;
|
|
61
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EACX,qBAAqB,EAGrB,eAAe,EACf,kBAAkB,EAClB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAiB;gBAEtB,MAAM,EAAE,eAAe;IASnC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAoD5C;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAa5B;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;YACW,QAAQ;IA4CtB;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAM1C;;OAEG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAUhD;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAQvE;;OAEG;IACG,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C;AAED;;GAEG;AACH,wBAAsB,eAAe,CACpC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAwB,GAC/B,OAAO,CAAC,aAAa,CAAC,CAcxB;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC9C,OAAO,GAAE,MAAwB,GAC/B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAU/B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP module exports
|
|
3
|
+
*/
|
|
4
|
+
export { C15tMCPClient, createMCPClient, createMCPClientFromConfig, } from './client';
|
|
5
|
+
export type { CreateInstanceRequest, CreateInstanceResponse, ListInstancesResponse, MCPClientConfig, MCPConnectionState, MCPServerCapabilities, MCPToolCallRequest, MCPToolCallResponse, } from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACN,aAAa,EACb,eAAe,EACf,yBAAyB,GACzB,MAAM,UAAU,CAAC;AAElB,YAAY,EACX,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP (Model Context Protocol) types
|
|
3
|
+
*/
|
|
4
|
+
import type { Instance } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* MCP client configuration
|
|
7
|
+
*/
|
|
8
|
+
export interface MCPClientConfig {
|
|
9
|
+
/** Base URL of the MCP server */
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
/** Access token for authentication */
|
|
12
|
+
accessToken: string;
|
|
13
|
+
/** Client name */
|
|
14
|
+
clientName?: string;
|
|
15
|
+
/** Client version */
|
|
16
|
+
clientVersion?: string;
|
|
17
|
+
/** Request timeout in ms */
|
|
18
|
+
timeout?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* MCP connection state
|
|
22
|
+
*/
|
|
23
|
+
export interface MCPConnectionState {
|
|
24
|
+
/** Whether connected to the server */
|
|
25
|
+
connected: boolean;
|
|
26
|
+
/** Server capabilities */
|
|
27
|
+
capabilities?: MCPServerCapabilities;
|
|
28
|
+
/** Error if connection failed */
|
|
29
|
+
error?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* MCP server capabilities
|
|
33
|
+
*/
|
|
34
|
+
export interface MCPServerCapabilities {
|
|
35
|
+
/** Supported resources */
|
|
36
|
+
resources?: string[];
|
|
37
|
+
/** Supported tools */
|
|
38
|
+
tools?: string[];
|
|
39
|
+
/** Server version */
|
|
40
|
+
version?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* MCP tool call request
|
|
44
|
+
*/
|
|
45
|
+
export interface MCPToolCallRequest {
|
|
46
|
+
/** Tool name */
|
|
47
|
+
name: string;
|
|
48
|
+
/** Tool arguments */
|
|
49
|
+
arguments?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* MCP tool call response
|
|
53
|
+
*/
|
|
54
|
+
export interface MCPToolCallResponse {
|
|
55
|
+
/** Whether the call succeeded */
|
|
56
|
+
success: boolean;
|
|
57
|
+
/** Response content */
|
|
58
|
+
content?: unknown;
|
|
59
|
+
/** Error message if failed */
|
|
60
|
+
error?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Instance list response
|
|
64
|
+
*/
|
|
65
|
+
export interface ListInstancesResponse {
|
|
66
|
+
instances: Instance[];
|
|
67
|
+
total: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create instance request
|
|
71
|
+
*/
|
|
72
|
+
export interface CreateInstanceRequest {
|
|
73
|
+
/** Instance name */
|
|
74
|
+
name: string;
|
|
75
|
+
/** Instance configuration */
|
|
76
|
+
config?: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create instance response
|
|
80
|
+
*/
|
|
81
|
+
export interface CreateInstanceResponse {
|
|
82
|
+
instance: Instance;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,WAAW,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,WAAW,sBAAsB;IACtC,QAAQ,EAAE,QAAQ,CAAC;CACnB"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions for the c15t CLI
|
|
3
|
+
*/
|
|
4
|
+
import type { AvailablePackage as AvailablePackageType, StorageMode as StorageModeType } from './constants';
|
|
5
|
+
export type StorageMode = StorageModeType;
|
|
6
|
+
export type AvailablePackage = AvailablePackageType;
|
|
7
|
+
export interface CliCommand {
|
|
8
|
+
/** Command name used in CLI invocation */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Label shown in interactive prompts */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Short hint shown alongside the label */
|
|
13
|
+
hint: string;
|
|
14
|
+
/** Longer description for help text */
|
|
15
|
+
description: string;
|
|
16
|
+
/** Command handler function */
|
|
17
|
+
action: (context: CliContext) => Promise<void>;
|
|
18
|
+
/** Optional subcommands */
|
|
19
|
+
subcommands?: CliCommand[];
|
|
20
|
+
/** Whether this command is hidden from help */
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type FlagType = 'boolean' | 'string' | 'special';
|
|
24
|
+
export interface CliFlag {
|
|
25
|
+
/** Flag names (e.g., ['--help', '-h']) */
|
|
26
|
+
names: string[];
|
|
27
|
+
/** Description for help text */
|
|
28
|
+
description: string;
|
|
29
|
+
/** Flag type */
|
|
30
|
+
type: FlagType;
|
|
31
|
+
/** Whether the flag expects a value */
|
|
32
|
+
expectsValue: boolean;
|
|
33
|
+
/** Default value */
|
|
34
|
+
defaultValue?: string | boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ParsedArgs {
|
|
37
|
+
/** The command name if provided */
|
|
38
|
+
commandName: string | undefined;
|
|
39
|
+
/** Arguments passed after the command */
|
|
40
|
+
commandArgs: string[];
|
|
41
|
+
/** Parsed flags by their primary name */
|
|
42
|
+
parsedFlags: Record<string, string | boolean | undefined>;
|
|
43
|
+
}
|
|
44
|
+
export interface PackageInfo {
|
|
45
|
+
name: string;
|
|
46
|
+
version: string;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
export interface FrameworkDetectionResult {
|
|
50
|
+
/** Detected framework name */
|
|
51
|
+
framework: string | null;
|
|
52
|
+
/** Framework version */
|
|
53
|
+
frameworkVersion: string | null;
|
|
54
|
+
/** Recommended c15t package */
|
|
55
|
+
pkg: AvailablePackage;
|
|
56
|
+
/** Whether React is detected */
|
|
57
|
+
hasReact: boolean;
|
|
58
|
+
/** React version if detected */
|
|
59
|
+
reactVersion: string | null;
|
|
60
|
+
/** Tailwind version if detected */
|
|
61
|
+
tailwindVersion: string | null;
|
|
62
|
+
}
|
|
63
|
+
export interface LayoutDetectionResult {
|
|
64
|
+
/** Path to the layout file relative to project root */
|
|
65
|
+
path: string;
|
|
66
|
+
/** Type of router */
|
|
67
|
+
type: 'app' | 'pages';
|
|
68
|
+
/** Whether the layout is in a dynamic segment (e.g., [locale]) */
|
|
69
|
+
hasLocaleSegment: boolean;
|
|
70
|
+
/** The locale segment name if present (e.g., "[locale]") */
|
|
71
|
+
localeSegment?: string;
|
|
72
|
+
/** The app directory path */
|
|
73
|
+
appDirectory: string;
|
|
74
|
+
}
|
|
75
|
+
export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
76
|
+
export interface PackageManagerResult {
|
|
77
|
+
/** Detected package manager */
|
|
78
|
+
name: PackageManager;
|
|
79
|
+
/** Install command */
|
|
80
|
+
installCommand: string;
|
|
81
|
+
/** Add package command */
|
|
82
|
+
addCommand: string;
|
|
83
|
+
/** Run script command */
|
|
84
|
+
runCommand: string;
|
|
85
|
+
/** Execute command (npx, bunx, etc.) */
|
|
86
|
+
execCommand: string;
|
|
87
|
+
}
|
|
88
|
+
export interface CliLogger {
|
|
89
|
+
debug(message: string, ...args: unknown[]): void;
|
|
90
|
+
info(message: string, ...args: unknown[]): void;
|
|
91
|
+
warn(message: string, ...args: unknown[]): void;
|
|
92
|
+
error(message: string, ...args: unknown[]): void;
|
|
93
|
+
message(message: string): void;
|
|
94
|
+
note(content: string, title?: string): void;
|
|
95
|
+
success(message: string): void;
|
|
96
|
+
failed(message: string): never;
|
|
97
|
+
outro(message: string): void;
|
|
98
|
+
step(current: number, total: number, label: string): void;
|
|
99
|
+
}
|
|
100
|
+
export interface ErrorHandlers {
|
|
101
|
+
/** Handle an error and exit */
|
|
102
|
+
handleError: (error: unknown, message: string) => never;
|
|
103
|
+
/** Handle user cancellation */
|
|
104
|
+
handleCancel: (message?: string, context?: {
|
|
105
|
+
command?: string;
|
|
106
|
+
stage?: string;
|
|
107
|
+
}) => never;
|
|
108
|
+
}
|
|
109
|
+
export interface ConfigManagement {
|
|
110
|
+
/** Load c15t config from the project */
|
|
111
|
+
loadConfig: () => Promise<unknown | null>;
|
|
112
|
+
/** Load config or throw if not found */
|
|
113
|
+
requireConfig: () => Promise<unknown>;
|
|
114
|
+
/** Get path aliases from tsconfig/jsconfig */
|
|
115
|
+
getPathAliases: (configPath?: string) => Record<string, string> | null;
|
|
116
|
+
}
|
|
117
|
+
export interface FileSystemUtils {
|
|
118
|
+
/** Get package.json info */
|
|
119
|
+
getPackageInfo: () => PackageInfo;
|
|
120
|
+
/** Check if a file exists */
|
|
121
|
+
exists: (path: string) => Promise<boolean>;
|
|
122
|
+
/** Read a file */
|
|
123
|
+
read: (path: string) => Promise<string>;
|
|
124
|
+
/** Write a file */
|
|
125
|
+
write: (path: string, content: string) => Promise<void>;
|
|
126
|
+
/** Create a directory */
|
|
127
|
+
mkdir: (path: string) => Promise<void>;
|
|
128
|
+
}
|
|
129
|
+
export interface Telemetry {
|
|
130
|
+
/** Track an event */
|
|
131
|
+
trackEvent: (eventName: string, properties?: Record<string, string | number | boolean | undefined>) => void;
|
|
132
|
+
/** Track a command execution */
|
|
133
|
+
trackCommand: (command: string, args?: string[], flags?: Record<string, string | number | boolean | undefined>) => void;
|
|
134
|
+
/** Track an error */
|
|
135
|
+
trackError: (error: Error, command?: string) => void;
|
|
136
|
+
/** Flush pending events */
|
|
137
|
+
flushSync: () => void;
|
|
138
|
+
/** Shutdown the telemetry client */
|
|
139
|
+
shutdown: () => Promise<void>;
|
|
140
|
+
/** Check if telemetry is disabled */
|
|
141
|
+
isDisabled: () => boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface CliContext {
|
|
144
|
+
/** Logger instance */
|
|
145
|
+
logger: CliLogger;
|
|
146
|
+
/** Parsed command flags */
|
|
147
|
+
flags: ParsedArgs['parsedFlags'];
|
|
148
|
+
/** Current command name */
|
|
149
|
+
commandName: string | undefined;
|
|
150
|
+
/** Command arguments */
|
|
151
|
+
commandArgs: string[];
|
|
152
|
+
/** Current working directory */
|
|
153
|
+
cwd: string;
|
|
154
|
+
/** Error handling utilities */
|
|
155
|
+
error: ErrorHandlers;
|
|
156
|
+
/** Config management utilities */
|
|
157
|
+
config: ConfigManagement;
|
|
158
|
+
/** File system utilities */
|
|
159
|
+
fs: FileSystemUtils;
|
|
160
|
+
/** Telemetry instance */
|
|
161
|
+
telemetry: Telemetry;
|
|
162
|
+
/** Show a confirmation prompt */
|
|
163
|
+
confirm: (message: string, initialValue?: boolean) => Promise<boolean>;
|
|
164
|
+
/** Project root directory */
|
|
165
|
+
projectRoot: string;
|
|
166
|
+
/** Detected framework info */
|
|
167
|
+
framework: FrameworkDetectionResult;
|
|
168
|
+
/** Detected package manager */
|
|
169
|
+
packageManager: PackageManagerResult;
|
|
170
|
+
}
|
|
171
|
+
export interface GenerateOptions {
|
|
172
|
+
/** Storage mode */
|
|
173
|
+
mode: StorageMode;
|
|
174
|
+
/** Backend URL (for c15t or self-hosted mode) */
|
|
175
|
+
backendUrl?: string;
|
|
176
|
+
/** Instance ID (for c15t mode) */
|
|
177
|
+
instanceId?: string;
|
|
178
|
+
/** Selected scripts to configure */
|
|
179
|
+
scripts?: string[];
|
|
180
|
+
/** Theme preset */
|
|
181
|
+
theme?: string;
|
|
182
|
+
/** Whether to skip dependency installation */
|
|
183
|
+
skipInstall?: boolean;
|
|
184
|
+
/** Whether to skip confirmation prompts */
|
|
185
|
+
skipConfirm?: boolean;
|
|
186
|
+
}
|
|
187
|
+
export interface ExecutionPlan {
|
|
188
|
+
/** Storage mode */
|
|
189
|
+
mode: StorageMode;
|
|
190
|
+
/** Backend URL if applicable */
|
|
191
|
+
backendUrl?: string;
|
|
192
|
+
/** Files that will be created */
|
|
193
|
+
filesToCreate: string[];
|
|
194
|
+
/** Files that will be modified */
|
|
195
|
+
filesToModify: string[];
|
|
196
|
+
/** Dependencies to install */
|
|
197
|
+
dependencies: string[];
|
|
198
|
+
/** Dev dependencies to install */
|
|
199
|
+
devDependencies?: string[];
|
|
200
|
+
}
|
|
201
|
+
export interface PreflightResult {
|
|
202
|
+
/** Whether all required checks passed */
|
|
203
|
+
passed: boolean;
|
|
204
|
+
/** Individual check results */
|
|
205
|
+
checks: PreflightCheck[];
|
|
206
|
+
}
|
|
207
|
+
export interface PreflightCheck {
|
|
208
|
+
/** Check name */
|
|
209
|
+
name: string;
|
|
210
|
+
/** Check status */
|
|
211
|
+
status: 'pass' | 'warn' | 'fail';
|
|
212
|
+
/** Status message */
|
|
213
|
+
message: string;
|
|
214
|
+
/** Optional hint for fixing */
|
|
215
|
+
hint?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface Instance {
|
|
218
|
+
/** Instance ID */
|
|
219
|
+
id: string;
|
|
220
|
+
/** Instance name */
|
|
221
|
+
name: string;
|
|
222
|
+
/** Instance URL */
|
|
223
|
+
url: string;
|
|
224
|
+
/** Created timestamp */
|
|
225
|
+
createdAt: string;
|
|
226
|
+
/** Instance status */
|
|
227
|
+
status: 'active' | 'inactive' | 'pending';
|
|
228
|
+
}
|
|
229
|
+
export type RecoveryAction = 'retry' | 'skip' | 'manual' | 'troubleshoot' | 'abort';
|
|
230
|
+
export interface RecoveryOption {
|
|
231
|
+
/** Action identifier */
|
|
232
|
+
action: RecoveryAction;
|
|
233
|
+
/** Display label */
|
|
234
|
+
label: string;
|
|
235
|
+
/** Description */
|
|
236
|
+
description: string;
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACX,gBAAgB,IAAI,oBAAoB,EACxC,WAAW,IAAI,eAAe,EAC9B,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAC1C,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAGpD,MAAM,WAAW,UAAU;IAC1B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,MAAM,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,2BAA2B;IAC3B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAGD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,OAAO;IACvB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,uCAAuC;IACvC,YAAY,EAAE,OAAO,CAAC;IACtB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC;AAGD,MAAM,WAAW,UAAU;IAC1B,mCAAmC;IACnC,WAAW,EAAE,MAAM,GAAG,S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E,MAAM,CAAC;IACd,kBAAkB;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code formatting utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides Prettier integration for formatting generated code.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format options
|
|
8
|
+
*/
|
|
9
|
+
export interface FormatOptions {
|
|
10
|
+
/** File path (used to infer parser) */
|
|
11
|
+
filepath?: string;
|
|
12
|
+
/** Parser to use */
|
|
13
|
+
parser?: 'typescript' | 'json' | 'css' | 'html' | 'markdown';
|
|
14
|
+
/** Tab width */
|
|
15
|
+
tabWidth?: number;
|
|
16
|
+
/** Use tabs instead of spaces */
|
|
17
|
+
useTabs?: boolean;
|
|
18
|
+
/** Use single quotes */
|
|
19
|
+
singleQuote?: boolean;
|
|
20
|
+
/** Print semicolons */
|
|
21
|
+
semi?: boolean;
|
|
22
|
+
/** Trailing commas */
|
|
23
|
+
trailingComma?: 'none' | 'es5' | 'all';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Format code using Prettier
|
|
27
|
+
*
|
|
28
|
+
* Falls back to returning the original code if Prettier is not available.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatCode(code: string, options?: FormatOptions): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Format TypeScript/JavaScript code
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatTypeScript(code: string): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Format JSON
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatJson(data: unknown): Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Format CSS
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatCss(code: string): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Basic code indentation (for when Prettier is not available)
|
|
45
|
+
*/
|
|
46
|
+
export declare function indent(code: string, spaces?: number): string;
|
|
47
|
+
/**
|
|
48
|
+
* Remove leading indentation from a template literal
|
|
49
|
+
*/
|
|
50
|
+
export declare function dedent(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
51
|
+
/**
|
|
52
|
+
* Capitalize the first letter of a string
|
|
53
|
+
*/
|
|
54
|
+
export declare function capitalize(str: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Convert a string to camelCase
|
|
57
|
+
*/
|
|
58
|
+
export declare function camelCase(str: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Convert a string to PascalCase
|
|
61
|
+
*/
|
|
62
|
+
export declare function pascalCase(str: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Convert a string to kebab-case
|
|
65
|
+
*/
|
|
66
|
+
export declare function kebabCase(str: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Convert a string to snake_case
|
|
69
|
+
*/
|
|
70
|
+
export declare function snakeCase(str: string): string;
|
|
71
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;IAC7D,gBAAgB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uBAAuB;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;CACvC;AAsCD;;;;GAIG;AACH,wBAAsB,UAAU,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAG/D;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE7D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAM/D;AAED;;GAEG;AACH,wBAAgB,MAAM,CACrB,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE,OAAO,EAAE,GAClB,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File system utilities for the c15t CLI
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Check if a file or directory exists
|
|
6
|
+
*/
|
|
7
|
+
export declare function exists(filePath: string): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Read a file as text
|
|
10
|
+
*/
|
|
11
|
+
export declare function readFile(filePath: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Read a file as JSON
|
|
14
|
+
*/
|
|
15
|
+
export declare function readJson<T = unknown>(filePath: string): Promise<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Write content to a file
|
|
18
|
+
*/
|
|
19
|
+
export declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Write JSON to a file
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeJson(filePath: string, data: unknown, options?: {
|
|
24
|
+
indent?: number;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Create a directory recursively
|
|
28
|
+
*/
|
|
29
|
+
export declare function mkdir(dirPath: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Remove a file or directory
|
|
32
|
+
*/
|
|
33
|
+
export declare function remove(filePath: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Copy a file
|
|
36
|
+
*/
|
|
37
|
+
export declare function copyFile(src: string, dest: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* List files in a directory
|
|
40
|
+
*/
|
|
41
|
+
export declare function readDir(dirPath: string): Promise<string[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a path is a directory
|
|
44
|
+
*/
|
|
45
|
+
export declare function isDirectory(filePath: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a path is a file
|
|
48
|
+
*/
|
|
49
|
+
export declare function isFile(filePath: string): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Find files matching a pattern in a directory
|
|
52
|
+
*/
|
|
53
|
+
export declare function findFiles(dir: string, pattern: RegExp, options?: {
|
|
54
|
+
maxDepth?: number;
|
|
55
|
+
}): Promise<string[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the relative path from a base directory
|
|
58
|
+
*/
|
|
59
|
+
export declare function relativePath(from: string, to: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Join path segments
|
|
62
|
+
*/
|
|
63
|
+
export declare function joinPath(...segments: string[]): string;
|
|
64
|
+
/**
|
|
65
|
+
* Get the directory name from a path
|
|
66
|
+
*/
|
|
67
|
+
export declare function dirname(filePath: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Get the base name from a path
|
|
70
|
+
*/
|
|
71
|
+
export declare function basename(filePath: string, ext?: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Get the extension from a path
|
|
74
|
+
*/
|
|
75
|
+
export declare function extname(filePath: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve a path to an absolute path
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolvePath(...segments: string[]): string;
|
|
80
|
+
//# sourceMappingURL=fs.d.ts.map
|