@payfit/iac 0.1.0-ephemeral-nx-common-packages-migration.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.
Files changed (60) hide show
  1. package/README.md +85 -0
  2. package/dist/executors/stack-migration/README.md +79 -0
  3. package/dist/executors/stack-migration/lib/constants.d.ts +33 -0
  4. package/dist/executors/stack-migration/lib/constants.js +44 -0
  5. package/dist/executors/stack-migration/lib/constants.js.map +1 -0
  6. package/dist/executors/stack-migration/lib/file-operations.d.ts +23 -0
  7. package/dist/executors/stack-migration/lib/file-operations.js +121 -0
  8. package/dist/executors/stack-migration/lib/file-operations.js.map +1 -0
  9. package/dist/executors/stack-migration/lib/git-operations.d.ts +19 -0
  10. package/dist/executors/stack-migration/lib/git-operations.js +90 -0
  11. package/dist/executors/stack-migration/lib/git-operations.js.map +1 -0
  12. package/dist/executors/stack-migration/lib/index.d.ts +10 -0
  13. package/dist/executors/stack-migration/lib/index.js +14 -0
  14. package/dist/executors/stack-migration/lib/index.js.map +1 -0
  15. package/dist/executors/stack-migration/lib/logger.d.ts +9 -0
  16. package/dist/executors/stack-migration/lib/logger.js +33 -0
  17. package/dist/executors/stack-migration/lib/logger.js.map +1 -0
  18. package/dist/executors/stack-migration/lib/migration-helper.d.ts +40 -0
  19. package/dist/executors/stack-migration/lib/migration-helper.js +209 -0
  20. package/dist/executors/stack-migration/lib/migration-helper.js.map +1 -0
  21. package/dist/executors/stack-migration/lib/migration-tool.d.ts +71 -0
  22. package/dist/executors/stack-migration/lib/migration-tool.js +857 -0
  23. package/dist/executors/stack-migration/lib/migration-tool.js.map +1 -0
  24. package/dist/executors/stack-migration/lib/path-builder.d.ts +20 -0
  25. package/dist/executors/stack-migration/lib/path-builder.js +58 -0
  26. package/dist/executors/stack-migration/lib/path-builder.js.map +1 -0
  27. package/dist/executors/stack-migration/lib/spacelift-client.d.ts +25 -0
  28. package/dist/executors/stack-migration/lib/spacelift-client.js +117 -0
  29. package/dist/executors/stack-migration/lib/spacelift-client.js.map +1 -0
  30. package/dist/executors/stack-migration/lib/templates/index.d.ts +7 -0
  31. package/dist/executors/stack-migration/lib/templates/index.js +11 -0
  32. package/dist/executors/stack-migration/lib/templates/index.js.map +1 -0
  33. package/dist/executors/stack-migration/lib/templates/mermaid-diagram.d.ts +13 -0
  34. package/dist/executors/stack-migration/lib/templates/mermaid-diagram.js +45 -0
  35. package/dist/executors/stack-migration/lib/templates/mermaid-diagram.js.map +1 -0
  36. package/dist/executors/stack-migration/lib/templates/message-templates.d.ts +16 -0
  37. package/dist/executors/stack-migration/lib/templates/message-templates.js +42 -0
  38. package/dist/executors/stack-migration/lib/templates/message-templates.js.map +1 -0
  39. package/dist/executors/stack-migration/lib/templates/pr-templates.d.ts +32 -0
  40. package/dist/executors/stack-migration/lib/templates/pr-templates.js +108 -0
  41. package/dist/executors/stack-migration/lib/templates/pr-templates.js.map +1 -0
  42. package/dist/executors/stack-migration/lib/templates/procedure-template.d.ts +6 -0
  43. package/dist/executors/stack-migration/lib/templates/procedure-template.js +62 -0
  44. package/dist/executors/stack-migration/lib/templates/procedure-template.js.map +1 -0
  45. package/dist/executors/stack-migration/lib/types.d.ts +53 -0
  46. package/dist/executors/stack-migration/lib/types.js +3 -0
  47. package/dist/executors/stack-migration/lib/types.js.map +1 -0
  48. package/dist/executors/stack-migration/schema.d.ts +20 -0
  49. package/dist/executors/stack-migration/schema.json +60 -0
  50. package/dist/executors/stack-migration/stack-migration.d.ts +4 -0
  51. package/dist/executors/stack-migration/stack-migration.js +79 -0
  52. package/dist/executors/stack-migration/stack-migration.js.map +1 -0
  53. package/dist/index.d.ts +10 -0
  54. package/dist/index.js +155 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/utils/terraform-detection.d.ts +2 -0
  57. package/dist/utils/terraform-detection.js +10 -0
  58. package/dist/utils/terraform-detection.js.map +1 -0
  59. package/executors.json +9 -0
  60. package/package.json +38 -0
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MigrationHelper = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const child_process_1 = require("child_process");
6
+ const fs = tslib_1.__importStar(require("fs"));
7
+ const constants_1 = require("./constants");
8
+ const file_operations_1 = require("./file-operations");
9
+ const git_operations_1 = require("./git-operations");
10
+ const logger_1 = require("./logger");
11
+ const path_builder_1 = require("./path-builder");
12
+ class MigrationHelper {
13
+ constructor(dryRun = false, serviceRepoPath = process.cwd()) {
14
+ this.dryRun = dryRun;
15
+ this.logger = new logger_1.MigrationLogger();
16
+ this.config = {
17
+ serviceRepository: {
18
+ name: '',
19
+ path: serviceRepoPath,
20
+ domain: '',
21
+ team: '',
22
+ oktaGroups: [],
23
+ },
24
+ repositories: {
25
+ domainEnrollment: '',
26
+ iacDeploy: '',
27
+ },
28
+ stacks: [],
29
+ generatedFiles: {},
30
+ };
31
+ this.paths = new path_builder_1.MigrationPaths(serviceRepoPath);
32
+ this.git = new git_operations_1.GitOperations(dryRun, this.logger);
33
+ this.files = new file_operations_1.FileOperations(dryRun, this.logger);
34
+ }
35
+ async ask(question) {
36
+ const answer = await logger_1.consola.prompt(question, {
37
+ type: 'text',
38
+ });
39
+ if (answer === null || answer === undefined) {
40
+ // User cancelled
41
+ process.exit(0);
42
+ }
43
+ return String(answer).trim();
44
+ }
45
+ async confirm(question, defaultYes = false) {
46
+ const answer = await logger_1.consola.prompt(question, {
47
+ type: 'confirm',
48
+ initial: defaultYes,
49
+ });
50
+ if (answer === null || answer === undefined) {
51
+ // User cancelled
52
+ process.exit(0);
53
+ }
54
+ return Boolean(answer);
55
+ }
56
+ async getOrAskConfig(optionValue, promptText, defaultValue) {
57
+ if (optionValue) {
58
+ return Array.isArray(optionValue) ? optionValue.join(',') : optionValue;
59
+ }
60
+ const answer = await logger_1.consola.prompt(promptText, {
61
+ type: 'text',
62
+ initial: defaultValue,
63
+ });
64
+ if (answer === null || answer === undefined) {
65
+ // User cancelled
66
+ process.exit(0);
67
+ }
68
+ return String(answer) || defaultValue || '';
69
+ }
70
+ generateBranchName(prefix) {
71
+ return `${prefix}-${Date.now()}`;
72
+ }
73
+ exitWithMessage(message) {
74
+ this.logger.warn(message);
75
+ this.logger.info('Run this script again when ready');
76
+ process.exit(0);
77
+ }
78
+ exec(command, options = {}) {
79
+ try {
80
+ const result = (0, child_process_1.execSync)(command, {
81
+ encoding: 'utf-8',
82
+ cwd: options.cwd || process.cwd(),
83
+ stdio: options.silent ? 'pipe' : 'inherit',
84
+ maxBuffer: 100 * 1024 * 1024,
85
+ });
86
+ return result ? result.trim() : '';
87
+ }
88
+ catch (error) {
89
+ const errorMessage = error instanceof Error ? error.message : String(error);
90
+ throw new Error(`Command failed: ${command}\n${errorMessage}`);
91
+ }
92
+ }
93
+ execSilent(command, cwd) {
94
+ return this.exec(command, { cwd, silent: true });
95
+ }
96
+ isSpacectlInstalled() {
97
+ try {
98
+ this.execSilent('which spacectl');
99
+ return true;
100
+ }
101
+ catch {
102
+ return false;
103
+ }
104
+ }
105
+ async ensureSpacectlInstalled() {
106
+ if (this.isSpacectlInstalled()) {
107
+ this.logger.success('spacectl CLI is installed');
108
+ return;
109
+ }
110
+ this.logger.warn('spacectl CLI is not installed');
111
+ if (this.dryRun) {
112
+ this.logger.info('[DRY RUN] Would install spacectl');
113
+ return;
114
+ }
115
+ const shouldInstall = await this.confirm('Install spacectl using brew now?', true);
116
+ if (!shouldInstall) {
117
+ this.logger.error('spacectl CLI is required');
118
+ this.logger.info('Install spacectl using:');
119
+ this.logger.info(' brew install spacelift-io/spacelift/spacectl');
120
+ this.logger.info('');
121
+ this.logger.info('Or visit: https://github.com/spacelift-io/spacectl#installation');
122
+ throw new Error('spacectl CLI is required. Please install it and try again.');
123
+ }
124
+ this.logger.info('Installing spacectl...');
125
+ try {
126
+ this.exec('brew install spacelift-io/spacelift/spacectl');
127
+ this.logger.success('spacectl installed successfully');
128
+ }
129
+ catch (error) {
130
+ this.logger.error('Failed to install spacectl');
131
+ this.logger.info('Please install manually:');
132
+ this.logger.info(' brew install spacelift-io/spacelift/spacectl');
133
+ throw error;
134
+ }
135
+ }
136
+ isSpacectlAuthenticated() {
137
+ try {
138
+ this.execSilent('spacectl profile current');
139
+ return true;
140
+ }
141
+ catch {
142
+ return false;
143
+ }
144
+ }
145
+ async ensureSpacectlAuthentication() {
146
+ if (this.dryRun) {
147
+ this.logger.info('Skipping spacectl authentication check (dry-run mode)');
148
+ return;
149
+ }
150
+ if (this.isSpacectlAuthenticated()) {
151
+ this.logger.success('spacectl is authenticated');
152
+ return;
153
+ }
154
+ this.logger.warn('spacectl is not authenticated');
155
+ const shouldLogin = await this.confirm('Run spacectl profile login payfit now?', true);
156
+ if (!shouldLogin) {
157
+ throw new Error('spacectl authentication required. Run: spacectl profile login --endpoint https://payfit.app.spacelift.io/ payfit');
158
+ }
159
+ this.logger.info('Running spacectl profile login payfit...');
160
+ try {
161
+ this.exec('spacectl profile login --endpoint https://payfit.app.spacelift.io/ payfit');
162
+ this.logger.success('spacectl authentication complete');
163
+ }
164
+ catch (error) {
165
+ this.logger.error('Failed to authenticate with spacectl');
166
+ this.logger.info('Please run manually:');
167
+ this.logger.info(' spacectl profile login --endpoint https://payfit.app.spacelift.io/ payfit');
168
+ throw error;
169
+ }
170
+ }
171
+ getStacksGeneratorModuleKey(stack) {
172
+ return `${stack.identifier}${stack.environment ? `-${stack.environment}` : '-global'}${stack.region ? `-${stack.region}` : '-global'}`;
173
+ }
174
+ getStackModuleKey(stack) {
175
+ return `${stack.identifier}${stack.environment ? `-${stack.environment}` : ''}${stack.region ? `-${stack.region}` : ''}`;
176
+ }
177
+ saveMigrationState() {
178
+ if (this.dryRun) {
179
+ this.logger.info(`[DRY RUN] Would save migration state to ${constants_1.FILE_NAMES.migrationState}`);
180
+ return;
181
+ }
182
+ const stateFile = this.paths.migrationState;
183
+ const state = {
184
+ timestamp: new Date().toISOString(),
185
+ config: this.config,
186
+ };
187
+ fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
188
+ this.logger.info(`Migration state saved to ${stateFile}`);
189
+ }
190
+ loadMigrationState() {
191
+ const stateFile = this.paths.migrationState;
192
+ if (!fs.existsSync(stateFile)) {
193
+ return false;
194
+ }
195
+ try {
196
+ const state = JSON.parse(fs.readFileSync(stateFile, 'utf-8'));
197
+ this.config = { ...this.config, ...state.config, resuming: true };
198
+ this.logger.success('Loaded existing migration state');
199
+ this.logger.info(` Started at: ${state.timestamp}`);
200
+ return true;
201
+ }
202
+ catch (error) {
203
+ this.logger.warn(`Failed to load migration state: ${error instanceof Error ? error.message : String(error)}`);
204
+ return false;
205
+ }
206
+ }
207
+ }
208
+ exports.MigrationHelper = MigrationHelper;
209
+ //# sourceMappingURL=migration-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-helper.js","sourceRoot":"","sources":["../../../../src/executors/stack-migration/lib/migration-helper.ts"],"names":[],"mappings":";;;;AAAA,iDAAwC;AACxC,+CAAwB;AAIxB,2CAAwC;AACxC,uDAAkD;AAClD,qDAAgD;AAChD,qCAAmD;AACnD,iDAA+C;AAE/C,MAAa,eAAe;IAQ1B,YAAY,MAAM,GAAG,KAAK,EAAE,kBAA0B,OAAO,CAAC,GAAG,EAAE;QACjE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,wBAAe,EAAE,CAAA;QACnC,IAAI,CAAC,MAAM,GAAG;YACZ,iBAAiB,EAAE;gBACjB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;gBACR,UAAU,EAAE,EAAE;aACf;YACD,YAAY,EAAE;gBACZ,gBAAgB,EAAE,EAAE;gBACpB,SAAS,EAAE,EAAE;aACd;YACD,MAAM,EAAE,EAAE;YACV,cAAc,EAAE,EAAE;SACnB,CAAA;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,6BAAc,CAAC,eAAe,CAA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+ import { MigrationHelper } from './migration-helper';
2
+ export declare class MigrationTool extends MigrationHelper {
3
+ setupRepositories(options?: {
4
+ name?: string;
5
+ domain?: string;
6
+ team?: string;
7
+ oktaGroups?: string[];
8
+ }): Promise<void>;
9
+ /**
10
+ * Step 2: Load Configuration
11
+ * Load stacks from iac-deploy
12
+ */
13
+ loadConfiguration(): Promise<void>;
14
+ /**
15
+ * Step 3: Create Safety Net PR (disable autodeploy for stacks)
16
+ */
17
+ createSafetyNetPR(): Promise<void>;
18
+ /**
19
+ * Step 4: Create Domain Enrollment PR
20
+ */
21
+ createDomainEnrollmentPR(): Promise<void>;
22
+ /**
23
+ * Step 6: Create Service Repository PR (spacelift.yaml, import.tf)
24
+ */
25
+ createServiceRepositoryPR(): Promise<void>;
26
+ /**
27
+ * Generate import.tf file with import blocks for stacks
28
+ * Uses stack configuration from YAML (contexts and stack_dependencies)
29
+ */
30
+ private generateImportTf;
31
+ /**
32
+ * Add Spacelift provider to version.tf content
33
+ * Returns the updated content with spacelift provider added to required_providers
34
+ * Handles both cases: with existing required_providers block and without
35
+ */
36
+ addSpaceliftProviderToVersionTf(existingContent: string): string;
37
+ /**
38
+ * Remove Spacelift provider from version.tf content
39
+ * Returns the updated content with spacelift provider removed from required_providers
40
+ * If spacelift is the only provider, removes the entire required_providers block
41
+ */
42
+ removeSpaceliftProviderFromVersionTf(existingContent: string): string;
43
+ /**
44
+ * Step 5: Create iac-deploy Cleanup PR
45
+ */
46
+ createIacDeployCleanupPR(): Promise<void>;
47
+ /**
48
+ * Create cleanup PR for iac-deploy (internal)
49
+ */
50
+ private doCreateIacDeployCleanupPR;
51
+ /**
52
+ * Step 7: Generate State Removal Commands
53
+ */
54
+ generateStateRemovalCommands(): Promise<void>;
55
+ /**
56
+ * Step 8: Generate Migration Procedure
57
+ */
58
+ generateMigrationProcedure(): Promise<void>;
59
+ /**
60
+ * Display migration state
61
+ */
62
+ checkMigrationState(): Promise<void>;
63
+ /**
64
+ * Clean up migration (creates PR + removes local files)
65
+ */
66
+ cleanupMigration(): Promise<void>;
67
+ /**
68
+ * Full migration workflow
69
+ */
70
+ run(): Promise<void>;
71
+ }