@meltstudio/meltctl 4.38.0 → 4.38.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 (81) hide show
  1. package/dist/index.js +2178 -210
  2. package/package.json +4 -3
  3. package/dist/commands/audit.d.ts +0 -10
  4. package/dist/commands/audit.js +0 -191
  5. package/dist/commands/audit.test.d.ts +0 -1
  6. package/dist/commands/audit.test.js +0 -324
  7. package/dist/commands/coins.d.ts +0 -5
  8. package/dist/commands/coins.js +0 -51
  9. package/dist/commands/coins.test.d.ts +0 -1
  10. package/dist/commands/coins.test.js +0 -113
  11. package/dist/commands/feedback.d.ts +0 -7
  12. package/dist/commands/feedback.js +0 -90
  13. package/dist/commands/feedback.test.d.ts +0 -1
  14. package/dist/commands/feedback.test.js +0 -177
  15. package/dist/commands/init.d.ts +0 -8
  16. package/dist/commands/init.js +0 -520
  17. package/dist/commands/init.test.d.ts +0 -1
  18. package/dist/commands/init.test.js +0 -478
  19. package/dist/commands/login.d.ts +0 -1
  20. package/dist/commands/login.js +0 -90
  21. package/dist/commands/login.test.d.ts +0 -1
  22. package/dist/commands/login.test.js +0 -194
  23. package/dist/commands/logout.d.ts +0 -1
  24. package/dist/commands/logout.js +0 -12
  25. package/dist/commands/logout.test.d.ts +0 -1
  26. package/dist/commands/logout.test.js +0 -59
  27. package/dist/commands/plan.d.ts +0 -6
  28. package/dist/commands/plan.js +0 -123
  29. package/dist/commands/plan.test.d.ts +0 -1
  30. package/dist/commands/plan.test.js +0 -246
  31. package/dist/commands/standup.d.ts +0 -7
  32. package/dist/commands/standup.js +0 -74
  33. package/dist/commands/standup.test.d.ts +0 -1
  34. package/dist/commands/standup.test.js +0 -218
  35. package/dist/commands/templates.d.ts +0 -1
  36. package/dist/commands/templates.js +0 -37
  37. package/dist/commands/templates.test.d.ts +0 -1
  38. package/dist/commands/templates.test.js +0 -89
  39. package/dist/commands/update.d.ts +0 -2
  40. package/dist/commands/update.js +0 -74
  41. package/dist/commands/update.test.d.ts +0 -1
  42. package/dist/commands/update.test.js +0 -93
  43. package/dist/commands/version.d.ts +0 -1
  44. package/dist/commands/version.js +0 -43
  45. package/dist/commands/version.test.d.ts +0 -1
  46. package/dist/commands/version.test.js +0 -86
  47. package/dist/index.d.ts +0 -2
  48. package/dist/utils/analytics.d.ts +0 -1
  49. package/dist/utils/analytics.js +0 -54
  50. package/dist/utils/analytics.test.d.ts +0 -1
  51. package/dist/utils/analytics.test.js +0 -91
  52. package/dist/utils/api.d.ts +0 -3
  53. package/dist/utils/api.js +0 -23
  54. package/dist/utils/api.test.d.ts +0 -1
  55. package/dist/utils/api.test.js +0 -76
  56. package/dist/utils/auth.d.ts +0 -12
  57. package/dist/utils/auth.js +0 -54
  58. package/dist/utils/auth.test.d.ts +0 -1
  59. package/dist/utils/auth.test.js +0 -165
  60. package/dist/utils/banner.d.ts +0 -1
  61. package/dist/utils/banner.js +0 -22
  62. package/dist/utils/banner.test.d.ts +0 -1
  63. package/dist/utils/banner.test.js +0 -34
  64. package/dist/utils/debug.d.ts +0 -1
  65. package/dist/utils/debug.js +0 -6
  66. package/dist/utils/git.d.ts +0 -9
  67. package/dist/utils/git.js +0 -76
  68. package/dist/utils/git.test.d.ts +0 -1
  69. package/dist/utils/git.test.js +0 -184
  70. package/dist/utils/package-manager.d.ts +0 -7
  71. package/dist/utils/package-manager.js +0 -55
  72. package/dist/utils/package-manager.test.d.ts +0 -1
  73. package/dist/utils/package-manager.test.js +0 -76
  74. package/dist/utils/templates.d.ts +0 -2
  75. package/dist/utils/templates.js +0 -5
  76. package/dist/utils/templates.test.d.ts +0 -1
  77. package/dist/utils/templates.test.js +0 -38
  78. package/dist/utils/version-check.d.ts +0 -7
  79. package/dist/utils/version-check.js +0 -139
  80. package/dist/utils/version-check.test.d.ts +0 -1
  81. package/dist/utils/version-check.test.js +0 -189
@@ -1,189 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- vi.mock('child_process', () => ({
3
- execSync: vi.fn(),
4
- }));
5
- vi.mock('fs-extra', () => ({
6
- default: {
7
- readJson: vi.fn(),
8
- },
9
- }));
10
- vi.mock('@inquirer/prompts', () => ({
11
- confirm: vi.fn(),
12
- }));
13
- vi.mock('../commands/update.js', () => ({
14
- updateCommand: vi.fn().mockResolvedValue(undefined),
15
- }));
16
- import { execSync } from 'child_process';
17
- import fs from 'fs-extra';
18
- import { confirm } from '@inquirer/prompts';
19
- import { getCurrentCliVersion, getLatestCliVersion, compareVersions, getUpdateSeverity, isCI, checkAndEnforceUpdate, } from './version-check.js';
20
- beforeEach(() => {
21
- vi.clearAllMocks();
22
- vi.spyOn(console, 'log').mockImplementation(() => { });
23
- vi.spyOn(console, 'error').mockImplementation(() => { });
24
- // Clean up CI env vars
25
- delete process.env.CI;
26
- delete process.env.GITHUB_ACTIONS;
27
- delete process.env.GITLAB_CI;
28
- delete process.env.CIRCLECI;
29
- delete process.env.TRAVIS;
30
- delete process.env.JENKINS_URL;
31
- delete process.env.BUILDKITE;
32
- delete process.env.DRONE;
33
- delete process.env.MELTCTL_SKIP_UPDATE_CHECK;
34
- });
35
- describe('getCurrentCliVersion', () => {
36
- it('reads version from package.json', async () => {
37
- ;
38
- fs.readJson.mockResolvedValue({ version: '4.26.0' });
39
- const version = await getCurrentCliVersion();
40
- expect(version).toBe('4.26.0');
41
- });
42
- });
43
- describe('getLatestCliVersion', () => {
44
- it('returns version from npm registry', async () => {
45
- ;
46
- execSync.mockReturnValue('"4.27.0"\n');
47
- const version = await getLatestCliVersion();
48
- expect(version).toBe('4.27.0');
49
- });
50
- it('returns null on network error', async () => {
51
- ;
52
- execSync.mockImplementation(() => {
53
- throw new Error('network error');
54
- });
55
- const version = await getLatestCliVersion();
56
- expect(version).toBeNull();
57
- });
58
- });
59
- describe('compareVersions', () => {
60
- it('returns true when latest major is higher', () => {
61
- expect(compareVersions('1.0.0', '2.0.0')).toBe(true);
62
- });
63
- it('returns true when latest minor is higher', () => {
64
- expect(compareVersions('1.0.0', '1.1.0')).toBe(true);
65
- });
66
- it('returns true when latest patch is higher', () => {
67
- expect(compareVersions('1.0.0', '1.0.1')).toBe(true);
68
- });
69
- it('returns false when versions are equal', () => {
70
- expect(compareVersions('1.0.0', '1.0.0')).toBe(false);
71
- });
72
- it('returns false when current is newer', () => {
73
- expect(compareVersions('2.0.0', '1.0.0')).toBe(false);
74
- });
75
- it('returns true when latest is stable and current is pre-release', () => {
76
- expect(compareVersions('1.0.0-beta.1', '1.0.0')).toBe(true);
77
- });
78
- it('returns false when current is stable and latest is pre-release', () => {
79
- expect(compareVersions('1.0.0', '1.0.0-beta.1')).toBe(false);
80
- });
81
- it('compares pre-release strings lexicographically', () => {
82
- expect(compareVersions('1.0.0-alpha', '1.0.0-beta')).toBe(true);
83
- expect(compareVersions('1.0.0-beta', '1.0.0-alpha')).toBe(false);
84
- });
85
- it('returns false when both pre-releases are equal', () => {
86
- expect(compareVersions('1.0.0-beta', '1.0.0-beta')).toBe(false);
87
- });
88
- });
89
- describe('isCI', () => {
90
- it('returns false in non-CI environment', () => {
91
- expect(isCI()).toBe(false);
92
- });
93
- it('returns true when CI env var is set', () => {
94
- process.env.CI = 'true';
95
- expect(isCI()).toBe(true);
96
- });
97
- it('returns true when GITHUB_ACTIONS is set', () => {
98
- process.env.GITHUB_ACTIONS = 'true';
99
- expect(isCI()).toBe(true);
100
- });
101
- it('returns true when MELTCTL_SKIP_UPDATE_CHECK is set', () => {
102
- process.env.MELTCTL_SKIP_UPDATE_CHECK = '1';
103
- expect(isCI()).toBe(true);
104
- });
105
- });
106
- describe('getUpdateSeverity', () => {
107
- it('returns major when major version is higher', () => {
108
- expect(getUpdateSeverity('1.0.0', '2.0.0')).toBe('major');
109
- });
110
- it('returns minor when minor version is higher', () => {
111
- expect(getUpdateSeverity('1.0.0', '1.1.0')).toBe('minor');
112
- });
113
- it('returns patch when only patch is higher', () => {
114
- expect(getUpdateSeverity('1.0.0', '1.0.1')).toBe('patch');
115
- });
116
- it('returns none when versions are equal', () => {
117
- expect(getUpdateSeverity('1.0.0', '1.0.0')).toBe('none');
118
- });
119
- it('returns none when current is newer', () => {
120
- expect(getUpdateSeverity('2.0.0', '1.0.0')).toBe('none');
121
- });
122
- it('returns major over minor', () => {
123
- expect(getUpdateSeverity('1.5.3', '2.0.0')).toBe('major');
124
- });
125
- });
126
- describe('checkAndEnforceUpdate', () => {
127
- it('skips check in CI environment', async () => {
128
- process.env.CI = 'true';
129
- await checkAndEnforceUpdate();
130
- // Should return early without checking versions
131
- expect(fs.readJson).not.toHaveBeenCalled();
132
- });
133
- it('allows continuing when latest version cannot be fetched', async () => {
134
- ;
135
- fs.readJson.mockResolvedValue({ version: '4.26.0' });
136
- execSync.mockImplementation(() => {
137
- throw new Error('network error');
138
- });
139
- await checkAndEnforceUpdate();
140
- // Should not throw or exit
141
- });
142
- it('allows continuing when versions are equal', async () => {
143
- ;
144
- fs.readJson.mockResolvedValue({ version: '4.26.0' });
145
- execSync.mockReturnValue('"4.26.0"\n');
146
- await checkAndEnforceUpdate();
147
- // Should not throw or exit
148
- });
149
- it('exits when user declines update on minor bump', async () => {
150
- const exitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined);
151
- fs.readJson.mockResolvedValue({ version: '4.25.0' });
152
- execSync.mockReturnValue('"4.26.0"\n');
153
- vi.mocked(confirm).mockResolvedValue(false);
154
- await checkAndEnforceUpdate();
155
- expect(confirm).toHaveBeenCalled();
156
- expect(exitSpy).toHaveBeenCalledWith(1);
157
- });
158
- it('runs update when user accepts on minor bump', async () => {
159
- const exitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined);
160
- fs.readJson.mockResolvedValue({ version: '4.25.0' });
161
- execSync.mockReturnValue('"4.26.0"\n');
162
- vi.mocked(confirm).mockResolvedValue(true);
163
- await checkAndEnforceUpdate();
164
- expect(exitSpy).toHaveBeenCalledWith(0);
165
- });
166
- it('exits when user declines update on major bump', async () => {
167
- const exitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined);
168
- fs.readJson.mockResolvedValue({ version: '4.33.0' });
169
- execSync.mockReturnValue('"5.0.0"\n');
170
- vi.mocked(confirm).mockResolvedValue(false);
171
- await checkAndEnforceUpdate();
172
- expect(exitSpy).toHaveBeenCalledWith(1);
173
- });
174
- it('warns but does not block on patch update', async () => {
175
- const exitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined);
176
- fs.readJson.mockResolvedValue({ version: '4.33.0' });
177
- execSync.mockReturnValue('"4.33.2"\n');
178
- await checkAndEnforceUpdate();
179
- expect(exitSpy).not.toHaveBeenCalled();
180
- const logCalls = console.log.mock.calls.map((c) => String(c[0]));
181
- expect(logCalls.some((msg) => msg.includes('Update available'))).toBe(true);
182
- });
183
- it('allows continuing when getCurrentCliVersion throws', async () => {
184
- ;
185
- fs.readJson.mockRejectedValue(new Error('file not found'));
186
- await checkAndEnforceUpdate();
187
- // Should not throw - error is caught
188
- });
189
- });