@magentrix-corp/magentrix-cli 1.3.15 → 1.3.17

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 (68) hide show
  1. package/LICENSE +25 -25
  2. package/README.md +1166 -1166
  3. package/actions/autopublish.old.js +293 -293
  4. package/actions/config.js +182 -182
  5. package/actions/create.js +466 -466
  6. package/actions/help.js +164 -164
  7. package/actions/iris/buildStage.js +874 -874
  8. package/actions/iris/delete.js +256 -256
  9. package/actions/iris/dev.js +391 -391
  10. package/actions/iris/index.js +6 -6
  11. package/actions/iris/link.js +375 -375
  12. package/actions/iris/recover.js +268 -268
  13. package/actions/main.js +80 -80
  14. package/actions/publish.js +1420 -1420
  15. package/actions/pull.js +684 -684
  16. package/actions/setup.js +148 -148
  17. package/actions/status.js +17 -17
  18. package/actions/update.js +248 -248
  19. package/bin/magentrix.js +393 -393
  20. package/package.json +55 -55
  21. package/utils/assetPaths.js +158 -158
  22. package/utils/autopublishLock.js +77 -77
  23. package/utils/cacher.js +206 -206
  24. package/utils/cli/checkInstanceUrl.js +76 -45
  25. package/utils/cli/helpers/compare.js +282 -282
  26. package/utils/cli/helpers/ensureApiKey.js +63 -63
  27. package/utils/cli/helpers/ensureCredentials.js +68 -68
  28. package/utils/cli/helpers/ensureInstanceUrl.js +75 -75
  29. package/utils/cli/writeRecords.js +262 -262
  30. package/utils/compare.js +135 -135
  31. package/utils/compress.js +17 -17
  32. package/utils/config.js +527 -527
  33. package/utils/debug.js +144 -144
  34. package/utils/diagnostics/testPublishLogic.js +96 -96
  35. package/utils/diff.js +49 -49
  36. package/utils/downloadAssets.js +291 -291
  37. package/utils/filetag.js +115 -115
  38. package/utils/hash.js +14 -14
  39. package/utils/iris/backup.js +411 -411
  40. package/utils/iris/builder.js +541 -541
  41. package/utils/iris/config-reader.js +664 -664
  42. package/utils/iris/deleteHelper.js +150 -150
  43. package/utils/iris/errors.js +537 -537
  44. package/utils/iris/linker.js +601 -601
  45. package/utils/iris/lock.js +360 -360
  46. package/utils/iris/validation.js +360 -360
  47. package/utils/iris/validator.js +281 -281
  48. package/utils/iris/zipper.js +248 -248
  49. package/utils/logger.js +291 -291
  50. package/utils/magentrix/api/assets.js +220 -220
  51. package/utils/magentrix/api/auth.js +107 -107
  52. package/utils/magentrix/api/createEntity.js +61 -61
  53. package/utils/magentrix/api/deleteEntity.js +55 -55
  54. package/utils/magentrix/api/iris.js +251 -251
  55. package/utils/magentrix/api/meqlQuery.js +36 -36
  56. package/utils/magentrix/api/retrieveEntity.js +86 -86
  57. package/utils/magentrix/api/updateEntity.js +66 -66
  58. package/utils/magentrix/fetch.js +168 -168
  59. package/utils/merge.js +22 -22
  60. package/utils/permissionError.js +70 -70
  61. package/utils/preferences.js +40 -40
  62. package/utils/progress.js +469 -469
  63. package/utils/spinner.js +43 -43
  64. package/utils/template.js +52 -52
  65. package/utils/updateFileBase.js +121 -121
  66. package/utils/workspaces.js +108 -108
  67. package/vars/config.js +11 -11
  68. package/vars/global.js +50 -50
package/actions/config.js CHANGED
@@ -1,182 +1,182 @@
1
- import chalk from 'chalk';
2
- import inquirer from 'inquirer';
3
- import Config from '../utils/config.js';
4
- import { HASHED_CWD } from '../vars/global.js';
5
-
6
- const config = new Config();
7
-
8
- /**
9
- * Interactive configuration wizard
10
- */
11
- export const configWizard = async () => {
12
- console.clear();
13
- console.log(chalk.cyan.bold('\n⚙️ Magentrix CLI Configuration'));
14
- console.log(chalk.gray('─'.repeat(50)));
15
- console.log('');
16
-
17
- while (true) {
18
- const { action } = await inquirer.prompt([
19
- {
20
- type: 'list',
21
- name: 'action',
22
- message: 'What would you like to do?',
23
- pageSize: 10,
24
- loop: false,
25
- choices: [
26
- {
27
- name: ' 📋 Log File Settings',
28
- value: 'logs',
29
- short: 'Log Settings'
30
- },
31
- {
32
- name: ' 🔧 View All Settings',
33
- value: 'view',
34
- short: 'View Settings'
35
- },
36
- new inquirer.Separator(),
37
- {
38
- name: chalk.gray(' Exit'),
39
- value: 'exit',
40
- short: 'Exit'
41
- }
42
- ]
43
- }
44
- ]);
45
-
46
- if (action === 'exit') {
47
- console.log('');
48
- console.log(chalk.green('✓ Configuration saved'));
49
- console.log('');
50
- break;
51
- }
52
-
53
- console.clear();
54
- console.log(chalk.cyan.bold('\n⚙️ Magentrix CLI Configuration'));
55
- console.log(chalk.gray('─'.repeat(50)));
56
-
57
- switch (action) {
58
- case 'logs':
59
- await configureLogSettings();
60
- break;
61
- case 'view':
62
- await viewAllSettings();
63
- break;
64
- }
65
-
66
- console.clear();
67
- console.log(chalk.cyan.bold('\n⚙️ Magentrix CLI Configuration'));
68
- console.log(chalk.gray('─'.repeat(50)));
69
- console.log('');
70
- }
71
- };
72
-
73
- /**
74
- * Configure log file settings
75
- */
76
- async function configureLogSettings() {
77
- const currentSetting = config.read('saveLogs', { global: true });
78
-
79
- console.log('');
80
- console.log(chalk.cyan.bold('📋 Log File Settings'));
81
- console.log(chalk.gray('Detailed operation logs can be saved to .magentrix/logs/ for debugging.'));
82
- console.log('');
83
-
84
- // Show current status with better formatting
85
- const currentStatus = currentSetting === true || currentSetting === 'true'
86
- ? chalk.green('● ENABLED') + chalk.gray(' - Logs are being saved')
87
- : currentSetting === false || currentSetting === 'false'
88
- ? chalk.yellow('○ DISABLED') + chalk.gray(' - No log files created')
89
- : chalk.gray('○ Not set') + chalk.gray(' - Will prompt on first use');
90
-
91
- console.log(chalk.bold('Current Status: ') + currentStatus);
92
- console.log('');
93
-
94
- const { setting } = await inquirer.prompt([
95
- {
96
- type: 'list',
97
- name: 'setting',
98
- message: 'Choose preference:',
99
- pageSize: 10,
100
- loop: false,
101
- choices: [
102
- {
103
- name: ' ' + chalk.green('● Enable logs'),
104
- value: true,
105
- short: 'Enable'
106
- },
107
- {
108
- name: ' ' + chalk.yellow('○ Disable logs'),
109
- value: false,
110
- short: 'Disable'
111
- },
112
- new inquirer.Separator(),
113
- {
114
- name: chalk.gray(' ← Back'),
115
- value: 'back',
116
- short: 'Back'
117
- }
118
- ],
119
- default: currentSetting === true || currentSetting === 'true' ? 0 : (currentSetting === false || currentSetting === 'false' ? 1 : 0)
120
- }
121
- ]);
122
-
123
- if (setting === 'back') return;
124
-
125
- config.save('saveLogs', setting, { global: true });
126
-
127
- console.log('');
128
- if (setting) {
129
- console.log(chalk.green('✓ Logs enabled'));
130
- console.log(chalk.gray(' → Logs will be saved to .magentrix/logs/'));
131
- } else {
132
- console.log(chalk.yellow('✓ Logs disabled'));
133
- console.log(chalk.gray(' → No log files will be created'));
134
- }
135
-
136
- console.log('');
137
- console.log(chalk.gray('Press Enter to continue...'));
138
- await inquirer.prompt([{ type: 'input', name: 'continue', message: '' }]);
139
- }
140
-
141
- /**
142
- * View all current settings
143
- */
144
- async function viewAllSettings() {
145
- console.log('');
146
- console.log(chalk.cyan.bold('🔧 All Settings'));
147
- console.log('');
148
-
149
- // Log settings
150
- const saveLogs = config.read('saveLogs', { global: true });
151
- const logsStatus = saveLogs === true || saveLogs === 'true'
152
- ? chalk.green('● Enabled')
153
- : saveLogs === false || saveLogs === 'false'
154
- ? chalk.yellow('○ Disabled')
155
- : chalk.gray('○ Not set');
156
- console.log(chalk.bold(' Log Files'));
157
- console.log(` ${logsStatus}`);
158
- console.log('');
159
-
160
- // API Key (masked) - read with pathHash like setup command does
161
- const apiKey = config.read('apiKey', { global: true, pathHash: HASHED_CWD });
162
- const keyStatus = apiKey
163
- ? chalk.green('****' + String(apiKey).slice(-4))
164
- : chalk.gray('Not configured');
165
- console.log(chalk.bold(' API Key'));
166
- console.log(` ${keyStatus}`);
167
- console.log('');
168
-
169
- // Instance URL - read with pathHash like setup command does
170
- const instanceUrl = config.read('instanceUrl', { global: true, pathHash: HASHED_CWD });
171
- const urlStatus = instanceUrl
172
- ? chalk.cyan(instanceUrl)
173
- : chalk.gray('Not configured');
174
- console.log(chalk.bold(' Instance URL'));
175
- console.log(` ${urlStatus}`);
176
- console.log('');
177
-
178
- console.log(chalk.gray('─'.repeat(50)));
179
- console.log('');
180
- console.log(chalk.gray('Press Enter to continue...'));
181
- await inquirer.prompt([{ type: 'input', name: 'continue', message: '' }]);
182
- }
1
+ import chalk from 'chalk';
2
+ import inquirer from 'inquirer';
3
+ import Config from '../utils/config.js';
4
+ import { HASHED_CWD } from '../vars/global.js';
5
+
6
+ const config = new Config();
7
+
8
+ /**
9
+ * Interactive configuration wizard
10
+ */
11
+ export const configWizard = async () => {
12
+ console.clear();
13
+ console.log(chalk.cyan.bold('\n⚙️ Magentrix CLI Configuration'));
14
+ console.log(chalk.gray('─'.repeat(50)));
15
+ console.log('');
16
+
17
+ while (true) {
18
+ const { action } = await inquirer.prompt([
19
+ {
20
+ type: 'list',
21
+ name: 'action',
22
+ message: 'What would you like to do?',
23
+ pageSize: 10,
24
+ loop: false,
25
+ choices: [
26
+ {
27
+ name: ' 📋 Log File Settings',
28
+ value: 'logs',
29
+ short: 'Log Settings'
30
+ },
31
+ {
32
+ name: ' 🔧 View All Settings',
33
+ value: 'view',
34
+ short: 'View Settings'
35
+ },
36
+ new inquirer.Separator(),
37
+ {
38
+ name: chalk.gray(' Exit'),
39
+ value: 'exit',
40
+ short: 'Exit'
41
+ }
42
+ ]
43
+ }
44
+ ]);
45
+
46
+ if (action === 'exit') {
47
+ console.log('');
48
+ console.log(chalk.green('✓ Configuration saved'));
49
+ console.log('');
50
+ break;
51
+ }
52
+
53
+ console.clear();
54
+ console.log(chalk.cyan.bold('\n⚙️ Magentrix CLI Configuration'));
55
+ console.log(chalk.gray('─'.repeat(50)));
56
+
57
+ switch (action) {
58
+ case 'logs':
59
+ await configureLogSettings();
60
+ break;
61
+ case 'view':
62
+ await viewAllSettings();
63
+ break;
64
+ }
65
+
66
+ console.clear();
67
+ console.log(chalk.cyan.bold('\n⚙️ Magentrix CLI Configuration'));
68
+ console.log(chalk.gray('─'.repeat(50)));
69
+ console.log('');
70
+ }
71
+ };
72
+
73
+ /**
74
+ * Configure log file settings
75
+ */
76
+ async function configureLogSettings() {
77
+ const currentSetting = config.read('saveLogs', { global: true });
78
+
79
+ console.log('');
80
+ console.log(chalk.cyan.bold('📋 Log File Settings'));
81
+ console.log(chalk.gray('Detailed operation logs can be saved to .magentrix/logs/ for debugging.'));
82
+ console.log('');
83
+
84
+ // Show current status with better formatting
85
+ const currentStatus = currentSetting === true || currentSetting === 'true'
86
+ ? chalk.green('● ENABLED') + chalk.gray(' - Logs are being saved')
87
+ : currentSetting === false || currentSetting === 'false'
88
+ ? chalk.yellow('○ DISABLED') + chalk.gray(' - No log files created')
89
+ : chalk.gray('○ Not set') + chalk.gray(' - Will prompt on first use');
90
+
91
+ console.log(chalk.bold('Current Status: ') + currentStatus);
92
+ console.log('');
93
+
94
+ const { setting } = await inquirer.prompt([
95
+ {
96
+ type: 'list',
97
+ name: 'setting',
98
+ message: 'Choose preference:',
99
+ pageSize: 10,
100
+ loop: false,
101
+ choices: [
102
+ {
103
+ name: ' ' + chalk.green('● Enable logs'),
104
+ value: true,
105
+ short: 'Enable'
106
+ },
107
+ {
108
+ name: ' ' + chalk.yellow('○ Disable logs'),
109
+ value: false,
110
+ short: 'Disable'
111
+ },
112
+ new inquirer.Separator(),
113
+ {
114
+ name: chalk.gray(' ← Back'),
115
+ value: 'back',
116
+ short: 'Back'
117
+ }
118
+ ],
119
+ default: currentSetting === true || currentSetting === 'true' ? 0 : (currentSetting === false || currentSetting === 'false' ? 1 : 0)
120
+ }
121
+ ]);
122
+
123
+ if (setting === 'back') return;
124
+
125
+ config.save('saveLogs', setting, { global: true });
126
+
127
+ console.log('');
128
+ if (setting) {
129
+ console.log(chalk.green('✓ Logs enabled'));
130
+ console.log(chalk.gray(' → Logs will be saved to .magentrix/logs/'));
131
+ } else {
132
+ console.log(chalk.yellow('✓ Logs disabled'));
133
+ console.log(chalk.gray(' → No log files will be created'));
134
+ }
135
+
136
+ console.log('');
137
+ console.log(chalk.gray('Press Enter to continue...'));
138
+ await inquirer.prompt([{ type: 'input', name: 'continue', message: '' }]);
139
+ }
140
+
141
+ /**
142
+ * View all current settings
143
+ */
144
+ async function viewAllSettings() {
145
+ console.log('');
146
+ console.log(chalk.cyan.bold('🔧 All Settings'));
147
+ console.log('');
148
+
149
+ // Log settings
150
+ const saveLogs = config.read('saveLogs', { global: true });
151
+ const logsStatus = saveLogs === true || saveLogs === 'true'
152
+ ? chalk.green('● Enabled')
153
+ : saveLogs === false || saveLogs === 'false'
154
+ ? chalk.yellow('○ Disabled')
155
+ : chalk.gray('○ Not set');
156
+ console.log(chalk.bold(' Log Files'));
157
+ console.log(` ${logsStatus}`);
158
+ console.log('');
159
+
160
+ // API Key (masked) - read with pathHash like setup command does
161
+ const apiKey = config.read('apiKey', { global: true, pathHash: HASHED_CWD });
162
+ const keyStatus = apiKey
163
+ ? chalk.green('****' + String(apiKey).slice(-4))
164
+ : chalk.gray('Not configured');
165
+ console.log(chalk.bold(' API Key'));
166
+ console.log(` ${keyStatus}`);
167
+ console.log('');
168
+
169
+ // Instance URL - read with pathHash like setup command does
170
+ const instanceUrl = config.read('instanceUrl', { global: true, pathHash: HASHED_CWD });
171
+ const urlStatus = instanceUrl
172
+ ? chalk.cyan(instanceUrl)
173
+ : chalk.gray('Not configured');
174
+ console.log(chalk.bold(' Instance URL'));
175
+ console.log(` ${urlStatus}`);
176
+ console.log('');
177
+
178
+ console.log(chalk.gray('─'.repeat(50)));
179
+ console.log('');
180
+ console.log(chalk.gray('Press Enter to continue...'));
181
+ await inquirer.prompt([{ type: 'input', name: 'continue', message: '' }]);
182
+ }