@creact-labs/creact 0.1.8 → 0.2.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.
Files changed (146) hide show
  1. package/README.md +85 -22
  2. package/dist/cli.d.ts +11 -0
  3. package/dist/cli.js +88 -0
  4. package/dist/index.d.ts +19 -44
  5. package/dist/index.js +20 -68
  6. package/dist/jsx/index.d.ts +2 -0
  7. package/dist/jsx/index.js +1 -0
  8. package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
  9. package/dist/jsx/jsx-dev-runtime.js +4 -0
  10. package/dist/jsx/jsx-runtime.d.ts +38 -0
  11. package/dist/jsx/jsx-runtime.js +38 -0
  12. package/dist/jsx/types.d.ts +12 -0
  13. package/dist/jsx/types.js +4 -0
  14. package/dist/primitives/context.d.ts +34 -0
  15. package/dist/primitives/context.js +63 -0
  16. package/dist/primitives/index.d.ts +3 -0
  17. package/dist/primitives/index.js +3 -0
  18. package/dist/primitives/instance.d.ts +72 -0
  19. package/dist/primitives/instance.js +235 -0
  20. package/dist/primitives/store.d.ts +22 -0
  21. package/dist/primitives/store.js +97 -0
  22. package/dist/provider/backend.d.ts +110 -0
  23. package/dist/provider/backend.js +37 -0
  24. package/dist/provider/interface.d.ts +48 -0
  25. package/dist/provider/interface.js +39 -0
  26. package/dist/reactive/effect.d.ts +11 -0
  27. package/dist/reactive/effect.js +42 -0
  28. package/dist/reactive/index.d.ts +3 -0
  29. package/dist/reactive/index.js +3 -0
  30. package/dist/reactive/signal.d.ts +32 -0
  31. package/dist/reactive/signal.js +60 -0
  32. package/dist/reactive/tracking.d.ts +41 -0
  33. package/dist/reactive/tracking.js +161 -0
  34. package/dist/runtime/fiber.d.ts +21 -0
  35. package/dist/runtime/fiber.js +16 -0
  36. package/dist/runtime/index.d.ts +4 -0
  37. package/dist/runtime/index.js +4 -0
  38. package/dist/runtime/reconcile.d.ts +66 -0
  39. package/dist/runtime/reconcile.js +210 -0
  40. package/dist/runtime/render.d.ts +42 -0
  41. package/dist/runtime/render.js +231 -0
  42. package/dist/runtime/run.d.ts +119 -0
  43. package/dist/runtime/run.js +334 -0
  44. package/dist/runtime/state-machine.d.ts +95 -0
  45. package/dist/runtime/state-machine.js +209 -0
  46. package/dist/types.d.ts +13 -0
  47. package/dist/types.js +4 -0
  48. package/package.json +29 -24
  49. package/dist/cli/commands/BuildCommand.d.ts +0 -40
  50. package/dist/cli/commands/BuildCommand.js +0 -151
  51. package/dist/cli/commands/DeployCommand.d.ts +0 -38
  52. package/dist/cli/commands/DeployCommand.js +0 -194
  53. package/dist/cli/commands/DevCommand.d.ts +0 -52
  54. package/dist/cli/commands/DevCommand.js +0 -394
  55. package/dist/cli/commands/PlanCommand.d.ts +0 -39
  56. package/dist/cli/commands/PlanCommand.js +0 -164
  57. package/dist/cli/commands/index.d.ts +0 -36
  58. package/dist/cli/commands/index.js +0 -43
  59. package/dist/cli/core/ArgumentParser.d.ts +0 -46
  60. package/dist/cli/core/ArgumentParser.js +0 -127
  61. package/dist/cli/core/BaseCommand.d.ts +0 -75
  62. package/dist/cli/core/BaseCommand.js +0 -95
  63. package/dist/cli/core/CLIContext.d.ts +0 -68
  64. package/dist/cli/core/CLIContext.js +0 -183
  65. package/dist/cli/core/CommandRegistry.d.ts +0 -64
  66. package/dist/cli/core/CommandRegistry.js +0 -89
  67. package/dist/cli/core/index.d.ts +0 -36
  68. package/dist/cli/core/index.js +0 -43
  69. package/dist/cli/index.d.ts +0 -35
  70. package/dist/cli/index.js +0 -100
  71. package/dist/cli/output.d.ts +0 -204
  72. package/dist/cli/output.js +0 -437
  73. package/dist/cli/utils.d.ts +0 -59
  74. package/dist/cli/utils.js +0 -76
  75. package/dist/context/createContext.d.ts +0 -90
  76. package/dist/context/createContext.js +0 -113
  77. package/dist/context/index.d.ts +0 -30
  78. package/dist/context/index.js +0 -35
  79. package/dist/core/CReact.d.ts +0 -409
  80. package/dist/core/CReact.js +0 -1151
  81. package/dist/core/CloudDOMBuilder.d.ts +0 -447
  82. package/dist/core/CloudDOMBuilder.js +0 -1234
  83. package/dist/core/ContextDependencyTracker.d.ts +0 -165
  84. package/dist/core/ContextDependencyTracker.js +0 -448
  85. package/dist/core/ErrorRecoveryManager.d.ts +0 -145
  86. package/dist/core/ErrorRecoveryManager.js +0 -443
  87. package/dist/core/EventBus.d.ts +0 -91
  88. package/dist/core/EventBus.js +0 -185
  89. package/dist/core/ProviderOutputTracker.d.ts +0 -211
  90. package/dist/core/ProviderOutputTracker.js +0 -476
  91. package/dist/core/ReactiveUpdateQueue.d.ts +0 -76
  92. package/dist/core/ReactiveUpdateQueue.js +0 -121
  93. package/dist/core/Reconciler.d.ts +0 -415
  94. package/dist/core/Reconciler.js +0 -1044
  95. package/dist/core/RenderScheduler.d.ts +0 -153
  96. package/dist/core/RenderScheduler.js +0 -519
  97. package/dist/core/Renderer.d.ts +0 -336
  98. package/dist/core/Renderer.js +0 -944
  99. package/dist/core/Runtime.d.ts +0 -246
  100. package/dist/core/Runtime.js +0 -640
  101. package/dist/core/StateBindingManager.d.ts +0 -121
  102. package/dist/core/StateBindingManager.js +0 -309
  103. package/dist/core/StateMachine.d.ts +0 -441
  104. package/dist/core/StateMachine.js +0 -883
  105. package/dist/core/StructuralChangeDetector.d.ts +0 -140
  106. package/dist/core/StructuralChangeDetector.js +0 -363
  107. package/dist/core/Validator.d.ts +0 -127
  108. package/dist/core/Validator.js +0 -279
  109. package/dist/core/errors.d.ts +0 -153
  110. package/dist/core/errors.js +0 -202
  111. package/dist/core/index.d.ts +0 -38
  112. package/dist/core/index.js +0 -64
  113. package/dist/core/types.d.ts +0 -265
  114. package/dist/core/types.js +0 -48
  115. package/dist/hooks/context.d.ts +0 -147
  116. package/dist/hooks/context.js +0 -334
  117. package/dist/hooks/useContext.d.ts +0 -113
  118. package/dist/hooks/useContext.js +0 -169
  119. package/dist/hooks/useEffect.d.ts +0 -105
  120. package/dist/hooks/useEffect.js +0 -540
  121. package/dist/hooks/useInstance.d.ts +0 -139
  122. package/dist/hooks/useInstance.js +0 -455
  123. package/dist/hooks/useState.d.ts +0 -120
  124. package/dist/hooks/useState.js +0 -298
  125. package/dist/jsx.d.ts +0 -143
  126. package/dist/jsx.js +0 -76
  127. package/dist/providers/DummyBackendProvider.d.ts +0 -193
  128. package/dist/providers/DummyBackendProvider.js +0 -189
  129. package/dist/providers/DummyCloudProvider.d.ts +0 -128
  130. package/dist/providers/DummyCloudProvider.js +0 -157
  131. package/dist/providers/IBackendProvider.d.ts +0 -177
  132. package/dist/providers/IBackendProvider.js +0 -31
  133. package/dist/providers/ICloudProvider.d.ts +0 -230
  134. package/dist/providers/ICloudProvider.js +0 -31
  135. package/dist/providers/index.d.ts +0 -31
  136. package/dist/providers/index.js +0 -31
  137. package/dist/test-event-callbacks.d.ts +0 -0
  138. package/dist/test-event-callbacks.js +0 -1
  139. package/dist/utils/Logger.d.ts +0 -144
  140. package/dist/utils/Logger.js +0 -220
  141. package/dist/utils/Output.d.ts +0 -161
  142. package/dist/utils/Output.js +0 -401
  143. package/dist/utils/deepEqual.d.ts +0 -71
  144. package/dist/utils/deepEqual.js +0 -276
  145. package/dist/utils/naming.d.ts +0 -241
  146. package/dist/utils/naming.js +0 -376
package/package.json CHANGED
@@ -1,9 +1,27 @@
1
1
  {
2
2
  "name": "@creact-labs/creact",
3
- "version": "0.1.8",
4
- "description": "CReact - React for Infrastructure. Render JSX to CloudDOM.",
3
+ "version": "0.2.1",
4
+ "description": "Declarative universal reactive runtime",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./jsx-runtime": {
13
+ "types": "./dist/jsx/jsx-runtime.d.ts",
14
+ "default": "./dist/jsx/jsx-runtime.js"
15
+ },
16
+ "./jsx-dev-runtime": {
17
+ "types": "./dist/jsx/jsx-dev-runtime.d.ts",
18
+ "default": "./dist/jsx/jsx-dev-runtime.js"
19
+ },
20
+ "./jsx": {
21
+ "types": "./dist/jsx/index.d.ts",
22
+ "default": "./dist/jsx/index.js"
23
+ }
24
+ },
7
25
  "typesVersions": {
8
26
  "*": {
9
27
  "jsx": [
@@ -26,26 +44,20 @@
26
44
  "prepublishOnly": "npm run build"
27
45
  },
28
46
  "keywords": [
29
- "infrastructure",
30
- "infrastructure-as-code",
31
- "iac",
47
+ "reactive",
48
+ "declarative",
49
+ "runtime",
32
50
  "jsx",
33
- "react",
51
+ "ai-agents",
52
+ "automation",
53
+ "orchestration",
54
+ "workflow",
55
+ "infrastructure-as-code",
34
56
  "cloud",
35
- "terraform",
36
- "aws",
37
- "kubernetes",
38
57
  "devops",
39
58
  "deployment",
40
- "orchestration",
41
- "clouddom",
42
59
  "reconciler",
43
- "reactive",
44
- "pulumi",
45
- "cdk",
46
- "helm",
47
- "multi-cloud",
48
- "declarative"
60
+ "multi-cloud"
49
61
  ],
50
62
  "author": "Daniel Coutinho Ribeiro <dcoutinho.96@gmail.com>",
51
63
  "license": "Apache-2.0",
@@ -67,25 +79,18 @@
67
79
  ],
68
80
  "devDependencies": {
69
81
  "@eslint/js": "^9.37.0",
70
- "@types/better-sqlite3": "^7.6.13",
71
- "@types/cli-progress": "^3.11.6",
72
82
  "@types/node": "^20.0.0",
73
83
  "@typescript-eslint/eslint-plugin": "^8.45.0",
74
84
  "@typescript-eslint/parser": "^8.45.0",
75
- "better-sqlite3": "^12.4.1",
76
85
  "eslint": "^9.37.0",
77
86
  "eslint-config-prettier": "^10.1.8",
78
87
  "eslint-plugin-prettier": "^5.5.4",
79
88
  "prettier": "^3.6.2",
80
- "ts-node": "^10.9.2",
81
89
  "typescript": "^5.0.0",
82
90
  "typescript-eslint": "^8.45.0",
83
91
  "vitest": "^3.2.4"
84
92
  },
85
93
  "dependencies": {
86
- "chalk": "^4.1.2",
87
- "cli-progress": "^3.12.0",
88
- "ora": "^5.4.1",
89
94
  "tsx": "^4.20.6"
90
95
  }
91
96
  }
@@ -1,40 +0,0 @@
1
- /**
2
-
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
-
5
- * you may not use this file except in compliance with the License.
6
-
7
- * You may obtain a copy of the License at
8
-
9
- *
10
-
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- *
14
-
15
- * Unless required by applicable law or agreed to in writing, software
16
-
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
-
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
-
21
- * See the License for the specific language governing permissions and
22
-
23
- * limitations under the License.
24
-
25
- *
26
-
27
- * Copyright 2025 Daniel Coutinho Ribeiro
28
-
29
- */
30
- /**
31
- * Build Command - builds CloudDOM from entry file
32
- */
33
- import { BaseCommand, CommandResult } from '../core/BaseCommand';
34
- export declare class BuildCommand extends BaseCommand {
35
- getName(): string;
36
- getDescription(): string;
37
- execute(): Promise<CommandResult>;
38
- private printVerboseOutput;
39
- private countResources;
40
- }
@@ -1,151 +0,0 @@
1
- "use strict";
2
- /**
3
-
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
-
6
- * you may not use this file except in compliance with the License.
7
-
8
- * You may obtain a copy of the License at
9
-
10
- *
11
-
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
-
14
- *
15
-
16
- * Unless required by applicable law or agreed to in writing, software
17
-
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
-
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
-
22
- * See the License for the specific language governing permissions and
23
-
24
- * limitations under the License.
25
-
26
- *
27
-
28
- * Copyright 2025 Daniel Coutinho Ribeiro
29
-
30
- */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.BuildCommand = void 0;
33
- /**
34
- * Build Command - builds CloudDOM from entry file
35
- */
36
- const BaseCommand_1 = require("../core/BaseCommand");
37
- const CLIContext_1 = require("../core/CLIContext");
38
- const Output_1 = require("../../utils/Output");
39
- const Logger_1 = require("../../utils/Logger");
40
- const logger = Logger_1.LoggerFactory.getLogger('cli');
41
- class BuildCommand extends BaseCommand_1.BaseCommand {
42
- getName() {
43
- return 'build';
44
- }
45
- getDescription() {
46
- return 'Build CloudDOM from entry file';
47
- }
48
- async execute() {
49
- const output = (0, Output_1.createOutputManager)({
50
- json: this.json,
51
- quiet: !!this.context.flags.quiet,
52
- verbose: this.verbose,
53
- });
54
- try {
55
- // Find entry file
56
- logger.debug('BuildCommand: Starting execution');
57
- let entryPath;
58
- try {
59
- entryPath = CLIContext_1.CLIContextManager.findEntryFile(this.context.flags.entry);
60
- logger.debug(`BuildCommand: Entry file resolved to ${entryPath}`);
61
- }
62
- catch (error) {
63
- output.showError('Entry file resolution failed', {
64
- cause: error.message,
65
- stackTrace: this.verbose ? error.stack : undefined,
66
- });
67
- return { exitCode: 1 };
68
- }
69
- // Load entry file and create CLI instance
70
- output.showInfo('Loading entry file and configuring providers...');
71
- let result;
72
- try {
73
- result = await CLIContext_1.CLIContextManager.createCLIInstance(entryPath, this.verbose);
74
- logger.debug(`BuildCommand: CloudDOM built with ${result.cloudDOM.length} resources`);
75
- }
76
- catch (error) {
77
- output.showError('Failed to load entry file and configure providers', {
78
- cause: error.message,
79
- stackTrace: this.verbose ? error.stack : undefined,
80
- });
81
- return { exitCode: 1 };
82
- }
83
- output.showSuccess('Entry file loaded and providers configured');
84
- // Success output
85
- const message = `Build complete: ${result.cloudDOM.length} resources`;
86
- if (this.verbose && !this.json) {
87
- this.printVerboseOutput(result, output);
88
- }
89
- output.showSuccess(message);
90
- if (this.json) {
91
- console.log(JSON.stringify({
92
- status: 'success',
93
- resourceCount: result.cloudDOM.length,
94
- entryFile: entryPath,
95
- stackName: result.stackName,
96
- resources: result.cloudDOM.map((node) => ({
97
- id: node.id,
98
- type: node.construct?.name || 'Unknown',
99
- path: node.path,
100
- })),
101
- }, null, 2));
102
- }
103
- return { exitCode: 0 };
104
- }
105
- catch (error) {
106
- output.showError('Build failed', {
107
- cause: error.message,
108
- stackTrace: this.verbose ? error.stack : undefined,
109
- });
110
- return { exitCode: 1 };
111
- }
112
- }
113
- printVerboseOutput(result, output) {
114
- console.log('\nCloudDOM Summary:');
115
- const resourceCounts = this.countResources(result.cloudDOM);
116
- if (Object.keys(resourceCounts).length === 0) {
117
- console.log(' No resources found');
118
- }
119
- else {
120
- for (const [type, count] of Object.entries(resourceCounts)) {
121
- console.log(` ${type}: ${count}`);
122
- }
123
- }
124
- // Show first few resource IDs for debugging
125
- if (result.cloudDOM.length > 0) {
126
- console.log('\nResource IDs:');
127
- const sampleIds = result.cloudDOM.slice(0, 5).map((node) => node.id);
128
- sampleIds.forEach((id) => {
129
- console.log(` • ${id}`);
130
- });
131
- if (result.cloudDOM.length > 5) {
132
- console.log(` ... and ${result.cloudDOM.length - 5} more`);
133
- }
134
- }
135
- }
136
- countResources(cloudDOM) {
137
- const counts = {};
138
- const walk = (nodes) => {
139
- for (const node of nodes) {
140
- const type = node.construct?.name || 'Unknown';
141
- counts[type] = (counts[type] || 0) + 1;
142
- if (node.children && node.children.length > 0) {
143
- walk(node.children);
144
- }
145
- }
146
- };
147
- walk(cloudDOM);
148
- return counts;
149
- }
150
- }
151
- exports.BuildCommand = BuildCommand;
@@ -1,38 +0,0 @@
1
- /**
2
-
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
-
5
- * you may not use this file except in compliance with the License.
6
-
7
- * You may obtain a copy of the License at
8
-
9
- *
10
-
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- *
14
-
15
- * Unless required by applicable law or agreed to in writing, software
16
-
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
-
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
-
21
- * See the License for the specific language governing permissions and
22
-
23
- * limitations under the License.
24
-
25
- *
26
-
27
- * Copyright 2025 Daniel Coutinho Ribeiro
28
-
29
- */
30
- /**
31
- * Deploy Command - deploys CloudDOM to cloud provider
32
- */
33
- import { BaseCommand, CommandResult } from '../core/BaseCommand';
34
- export declare class DeployCommand extends BaseCommand {
35
- getName(): string;
36
- getDescription(): string;
37
- execute(): Promise<CommandResult>;
38
- }
@@ -1,194 +0,0 @@
1
- "use strict";
2
- /**
3
-
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
-
6
- * you may not use this file except in compliance with the License.
7
-
8
- * You may obtain a copy of the License at
9
-
10
- *
11
-
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
-
14
- *
15
-
16
- * Unless required by applicable law or agreed to in writing, software
17
-
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
-
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
-
22
- * See the License for the specific language governing permissions and
23
-
24
- * limitations under the License.
25
-
26
- *
27
-
28
- * Copyright 2025 Daniel Coutinho Ribeiro
29
-
30
- */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.DeployCommand = void 0;
33
- /**
34
- * Deploy Command - deploys CloudDOM to cloud provider
35
- */
36
- const BaseCommand_1 = require("../core/BaseCommand");
37
- const CLIContext_1 = require("../core/CLIContext");
38
- const Output_1 = require("../../utils/Output");
39
- const Reconciler_1 = require("../../core/Reconciler");
40
- const Logger_1 = require("../../utils/Logger");
41
- const logger = Logger_1.LoggerFactory.getLogger('cli');
42
- class DeployCommand extends BaseCommand_1.BaseCommand {
43
- getName() {
44
- return 'deploy';
45
- }
46
- getDescription() {
47
- return 'Deploy CloudDOM to cloud provider';
48
- }
49
- async execute() {
50
- const output = (0, Output_1.createOutputManager)({
51
- json: this.json,
52
- quiet: !!this.context.flags.quiet,
53
- verbose: this.verbose,
54
- });
55
- const dryRun = !!this.context.flags['dry-run'];
56
- try {
57
- // Find entry file
58
- logger.debug('DeployCommand: Starting execution');
59
- let entryPath;
60
- try {
61
- entryPath = CLIContext_1.CLIContextManager.findEntryFile(this.context.flags.entry);
62
- logger.debug(`DeployCommand: Entry file resolved to ${entryPath}`);
63
- }
64
- catch (error) {
65
- output.showError('Entry file resolution failed', {
66
- cause: error.message,
67
- stackTrace: this.verbose ? error.stack : undefined,
68
- });
69
- return { exitCode: 1 };
70
- }
71
- // Load entry file and create CLI instance
72
- output.showInfo('Loading entry file and configuring providers...');
73
- let result;
74
- try {
75
- result = await CLIContext_1.CLIContextManager.createCLIInstance(entryPath, this.verbose);
76
- logger.debug(`DeployCommand: CloudDOM built with ${result.cloudDOM.length} resources`);
77
- }
78
- catch (error) {
79
- output.showError('Failed to load entry file and configure providers', {
80
- cause: error.message,
81
- stackTrace: this.verbose ? error.stack : undefined,
82
- });
83
- return { exitCode: 1 };
84
- }
85
- output.showSuccess('Entry file loaded and providers configured');
86
- // Validate providers
87
- output.showInfo('Validating providers...');
88
- if (!result.instance.getCloudProvider()) {
89
- output.showError('Cloud provider not configured', {
90
- cause: 'CReact.cloudProvider must be set in entry file',
91
- });
92
- return { exitCode: 1 };
93
- }
94
- if (!result.instance.getBackendProvider()) {
95
- output.showError('Backend provider not configured', {
96
- cause: 'CReact.backendProvider must be set in entry file',
97
- });
98
- return { exitCode: 1 };
99
- }
100
- output.showSuccess('Providers validated');
101
- // Load previous state and show plan
102
- output.showInfo('Loading previous state...');
103
- let previousCloudDOM = [];
104
- try {
105
- const previousState = await result.instance.getBackendProvider().getState(result.stackName);
106
- if (previousState && previousState.cloudDOM) {
107
- previousCloudDOM = previousState.cloudDOM;
108
- logger.debug(`DeployCommand: Previous CloudDOM loaded with ${previousCloudDOM.length} resources`);
109
- }
110
- else {
111
- logger.debug('DeployCommand: No previous state found (first deployment)');
112
- }
113
- }
114
- catch (stateError) {
115
- logger.debug(`DeployCommand: Could not load previous state: ${stateError.message}`);
116
- }
117
- // Compute and show plan
118
- const reconciler = new Reconciler_1.Reconciler();
119
- const changeSet = reconciler.reconcile(previousCloudDOM, result.cloudDOM);
120
- output.showPlanHeader(result.stackName);
121
- output.showPlanChanges(changeSet);
122
- output.showPlanSummary(changeSet);
123
- if (dryRun) {
124
- logger.debug('DeployCommand: Dry run mode - deployment will be simulated');
125
- output.showInfo('Dry run mode - no changes will be applied');
126
- return { exitCode: 0 };
127
- }
128
- // Deploy using CReact instance
129
- output.showDeployHeader();
130
- const startTime = Date.now();
131
- const deployedResources = [];
132
- try {
133
- // Track deployment progress
134
- for (const nodeId of changeSet.deploymentOrder) {
135
- const node = [...changeSet.creates, ...changeSet.updates].find((n) => n.id === nodeId);
136
- if (node) {
137
- const action = changeSet.creates.includes(node) ? 'Creating' : 'Updating';
138
- const resourceStart = Date.now();
139
- output.showResourceProgress(nodeId, action);
140
- // Actual deployment happens in CReact.deploy()
141
- // This is just for progress tracking
142
- deployedResources.push(nodeId);
143
- const resourceDuration = (Date.now() - resourceStart) / 1000;
144
- output.showResourceComplete(nodeId, action.replace('ing', 'ed'), resourceDuration);
145
- }
146
- }
147
- await result.instance.deploy(result.cloudDOM, result.stackName, 'cli-user');
148
- const duration = (Date.now() - startTime) / 1000;
149
- const deployResult = {
150
- resourceCount: result.cloudDOM.length,
151
- duration,
152
- creates: changeSet.creates.length,
153
- updates: changeSet.updates.length,
154
- deletes: changeSet.deletes.length,
155
- };
156
- output.showDeploySummary(deployResult);
157
- if (this.json) {
158
- console.log(JSON.stringify({
159
- status: 'success',
160
- ...deployResult,
161
- stackName: result.stackName,
162
- entryFile: entryPath,
163
- }, null, 2));
164
- }
165
- return { exitCode: 0 };
166
- }
167
- catch (deployError) {
168
- const duration = (Date.now() - startTime) / 1000;
169
- const deployResult = {
170
- resourceCount: result.cloudDOM.length,
171
- duration,
172
- creates: changeSet.creates.length,
173
- updates: changeSet.updates.length,
174
- deletes: changeSet.deletes.length,
175
- errors: [{ resourceId: 'unknown', message: deployError.message }],
176
- };
177
- output.showDeploySummary(deployResult);
178
- output.showError('Deployment failed', {
179
- cause: deployError.message,
180
- stackTrace: this.verbose ? deployError.stack : undefined,
181
- });
182
- return { exitCode: 1 };
183
- }
184
- }
185
- catch (error) {
186
- output.showError('Deploy command failed', {
187
- cause: error.message,
188
- stackTrace: this.verbose ? error.stack : undefined,
189
- });
190
- return { exitCode: 1 };
191
- }
192
- }
193
- }
194
- exports.DeployCommand = DeployCommand;
@@ -1,52 +0,0 @@
1
- /**
2
-
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
-
5
- * you may not use this file except in compliance with the License.
6
-
7
- * You may obtain a copy of the License at
8
-
9
- *
10
-
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- *
14
-
15
- * Unless required by applicable law or agreed to in writing, software
16
-
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
-
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
-
21
- * See the License for the specific language governing permissions and
22
-
23
- * limitations under the License.
24
-
25
- *
26
-
27
- * Copyright 2025 Daniel Coutinho Ribeiro
28
-
29
- */
30
- /**
31
- * Dev Command - hot reload development mode with auto/manual approval
32
- */
33
- import { BaseCommand, CommandResult } from '../core/BaseCommand';
34
- export declare class DevCommand extends BaseCommand {
35
- private isWatching;
36
- private watchTimeout;
37
- private autoApprove;
38
- private currentReadline;
39
- private output;
40
- private state;
41
- getName(): string;
42
- getDescription(): string;
43
- execute(): Promise<CommandResult>;
44
- private performInitialDeploy;
45
- private performHotReload;
46
- private deployChanges;
47
- private promptForApproval;
48
- private startWatching;
49
- private shouldIgnoreFile;
50
- private keepAlive;
51
- private stopWatching;
52
- }