@ollie-shop/cli 0.3.0 → 0.3.3

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 (139) hide show
  1. package/.turbo/turbo-build.log +14 -2
  2. package/CHANGELOG.md +48 -0
  3. package/__tests__/mocks/core.ts +1 -1
  4. package/dist/index.d.ts +0 -2
  5. package/dist/index.js +40631 -75
  6. package/package.json +7 -6
  7. package/src/actions/component.actions.ts +148 -204
  8. package/src/actions/function.actions.ts +78 -171
  9. package/src/actions/project.actions.ts +16 -11
  10. package/src/commands/__tests__/component.test.ts +4 -7
  11. package/src/commands/__tests__/function.test.ts +1 -1
  12. package/src/commands/__tests__/store-version.test.ts +1 -4
  13. package/src/commands/component.ts +0 -10
  14. package/src/commands/function.ts +5 -56
  15. package/src/schemas/command.schema.ts +296 -6
  16. package/src/utils/__tests__/rich-progress.test.ts +22 -11
  17. package/src/utils/cli-progress-reporter.ts +2 -2
  18. package/src/utils/command-parser.ts +0 -5
  19. package/src/utils/console.ts +33 -4
  20. package/src/utils/constants.ts +32 -0
  21. package/src/utils/deploy-helpers.ts +357 -0
  22. package/src/utils/errors.ts +133 -2
  23. package/src/utils/interactive-builder.ts +61 -7
  24. package/src/utils/rich-progress.ts +25 -14
  25. package/src/utils/validation-helpers.ts +145 -12
  26. package/tsup.config.ts +15 -0
  27. package/dist/__tests__/helpers/cli-test-helper.d.ts +0 -89
  28. package/dist/__tests__/helpers/cli-test-helper.d.ts.map +0 -1
  29. package/dist/__tests__/helpers/cli-test-helper.js +0 -220
  30. package/dist/__tests__/mocks/index.d.ts +0 -69
  31. package/dist/__tests__/mocks/index.d.ts.map +0 -1
  32. package/dist/__tests__/mocks/index.js +0 -77
  33. package/dist/actions/component.actions.d.ts +0 -14
  34. package/dist/actions/component.actions.d.ts.map +0 -1
  35. package/dist/actions/component.actions.js +0 -273
  36. package/dist/actions/function.actions.d.ts +0 -15
  37. package/dist/actions/function.actions.d.ts.map +0 -1
  38. package/dist/actions/function.actions.js +0 -254
  39. package/dist/actions/project.actions.d.ts +0 -17
  40. package/dist/actions/project.actions.d.ts.map +0 -1
  41. package/dist/actions/project.actions.js +0 -97
  42. package/dist/actions/version.actions.d.ts +0 -19
  43. package/dist/actions/version.actions.d.ts.map +0 -1
  44. package/dist/actions/version.actions.js +0 -216
  45. package/dist/commands/component.d.ts +0 -3
  46. package/dist/commands/component.d.ts.map +0 -1
  47. package/dist/commands/component.js +0 -192
  48. package/dist/commands/docs.d.ts +0 -3
  49. package/dist/commands/docs.d.ts.map +0 -1
  50. package/dist/commands/docs.js +0 -16
  51. package/dist/commands/function.d.ts +0 -3
  52. package/dist/commands/function.d.ts.map +0 -1
  53. package/dist/commands/function.js +0 -243
  54. package/dist/commands/help.d.ts +0 -3
  55. package/dist/commands/help.d.ts.map +0 -1
  56. package/dist/commands/help.js +0 -20
  57. package/dist/commands/index.d.ts +0 -3
  58. package/dist/commands/index.d.ts.map +0 -1
  59. package/dist/commands/index.js +0 -26
  60. package/dist/commands/login.d.ts +0 -3
  61. package/dist/commands/login.d.ts.map +0 -1
  62. package/dist/commands/login.js +0 -175
  63. package/dist/commands/project.d.ts +0 -3
  64. package/dist/commands/project.d.ts.map +0 -1
  65. package/dist/commands/project.js +0 -78
  66. package/dist/commands/store-version.d.ts +0 -3
  67. package/dist/commands/store-version.d.ts.map +0 -1
  68. package/dist/commands/store-version.js +0 -241
  69. package/dist/commands/version.d.ts +0 -3
  70. package/dist/commands/version.d.ts.map +0 -1
  71. package/dist/commands/version.js +0 -46
  72. package/dist/commands/whoami.d.ts +0 -3
  73. package/dist/commands/whoami.d.ts.map +0 -1
  74. package/dist/commands/whoami.js +0 -41
  75. package/dist/index.d.ts.map +0 -1
  76. package/dist/prompts/component.prompts.d.ts +0 -14
  77. package/dist/prompts/component.prompts.d.ts.map +0 -1
  78. package/dist/prompts/component.prompts.js +0 -75
  79. package/dist/prompts/function.prompts.d.ts +0 -21
  80. package/dist/prompts/function.prompts.d.ts.map +0 -1
  81. package/dist/prompts/function.prompts.js +0 -127
  82. package/dist/schemas/command.schema.d.ts +0 -516
  83. package/dist/schemas/command.schema.d.ts.map +0 -1
  84. package/dist/schemas/command.schema.js +0 -267
  85. package/dist/types/index.d.ts +0 -147
  86. package/dist/types/index.d.ts.map +0 -1
  87. package/dist/types/index.js +0 -18
  88. package/dist/utils/auth.d.ts +0 -4
  89. package/dist/utils/auth.d.ts.map +0 -1
  90. package/dist/utils/auth.js +0 -26
  91. package/dist/utils/cli-progress-reporter.d.ts +0 -12
  92. package/dist/utils/cli-progress-reporter.d.ts.map +0 -1
  93. package/dist/utils/cli-progress-reporter.js +0 -77
  94. package/dist/utils/command-builder.d.ts +0 -22
  95. package/dist/utils/command-builder.d.ts.map +0 -1
  96. package/dist/utils/command-builder.js +0 -268
  97. package/dist/utils/command-helpers.d.ts +0 -19
  98. package/dist/utils/command-helpers.d.ts.map +0 -1
  99. package/dist/utils/command-helpers.js +0 -79
  100. package/dist/utils/command-parser.d.ts +0 -146
  101. package/dist/utils/command-parser.d.ts.map +0 -1
  102. package/dist/utils/command-parser.js +0 -179
  103. package/dist/utils/command-suggestions.d.ts +0 -35
  104. package/dist/utils/command-suggestions.d.ts.map +0 -1
  105. package/dist/utils/command-suggestions.js +0 -152
  106. package/dist/utils/console.d.ts +0 -44
  107. package/dist/utils/console.d.ts.map +0 -1
  108. package/dist/utils/console.js +0 -233
  109. package/dist/utils/constants.d.ts +0 -8
  110. package/dist/utils/constants.d.ts.map +0 -1
  111. package/dist/utils/constants.js +0 -10
  112. package/dist/utils/context-detector.d.ts +0 -12
  113. package/dist/utils/context-detector.d.ts.map +0 -1
  114. package/dist/utils/context-detector.js +0 -155
  115. package/dist/utils/enhanced-error-handler.d.ts +0 -47
  116. package/dist/utils/enhanced-error-handler.d.ts.map +0 -1
  117. package/dist/utils/enhanced-error-handler.js +0 -221
  118. package/dist/utils/error-handler.d.ts +0 -3
  119. package/dist/utils/error-handler.d.ts.map +0 -1
  120. package/dist/utils/error-handler.js +0 -55
  121. package/dist/utils/errors.d.ts +0 -44
  122. package/dist/utils/errors.d.ts.map +0 -1
  123. package/dist/utils/errors.js +0 -76
  124. package/dist/utils/interactive-builder.d.ts +0 -22
  125. package/dist/utils/interactive-builder.d.ts.map +0 -1
  126. package/dist/utils/interactive-builder.js +0 -246
  127. package/dist/utils/rich-progress.d.ts +0 -59
  128. package/dist/utils/rich-progress.d.ts.map +0 -1
  129. package/dist/utils/rich-progress.js +0 -234
  130. package/dist/utils/store.d.ts +0 -11
  131. package/dist/utils/store.d.ts.map +0 -1
  132. package/dist/utils/store.js +0 -19
  133. package/dist/utils/validation-error-formatter.d.ts +0 -25
  134. package/dist/utils/validation-error-formatter.d.ts.map +0 -1
  135. package/dist/utils/validation-error-formatter.js +0 -258
  136. package/dist/utils/validation-helpers.d.ts +0 -60
  137. package/dist/utils/validation-helpers.d.ts.map +0 -1
  138. package/dist/utils/validation-helpers.js +0 -152
  139. package/src/commands/__tests__/version.test.ts +0 -71
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.promptComponentCreation = promptComponentCreation;
7
- exports.promptComponentDeployment = promptComponentDeployment;
8
- const core_1 = require("@ollie-shop/core");
9
- const inquirer_1 = __importDefault(require("inquirer"));
10
- const validation_helpers_1 = require("../utils/validation-helpers");
11
- // Generate component slot choices from core enum
12
- const componentSlotChoices = core_1.ComponentSlot.options.map((slot) => ({
13
- name: slot.charAt(0).toUpperCase() + slot.slice(1).replace(/-/g, " "),
14
- value: slot,
15
- }));
16
- async function promptComponentCreation(name, slot) {
17
- const questions = [];
18
- if (!name) {
19
- questions.push({
20
- type: "input",
21
- name: "name",
22
- message: "What's the name of your component?",
23
- validate: (input) => {
24
- return (0, validation_helpers_1.validateComponentName)(input);
25
- },
26
- });
27
- }
28
- if (!slot) {
29
- questions.push({
30
- type: "list",
31
- name: "slot",
32
- message: "Which slot will this component occupy?",
33
- choices: componentSlotChoices,
34
- });
35
- }
36
- questions.push({
37
- type: "input",
38
- name: "description",
39
- message: "Enter a description (optional):",
40
- default: "",
41
- }, {
42
- type: "confirm",
43
- name: "includeTests",
44
- message: "Include test files?",
45
- default: true,
46
- });
47
- const answers = await inquirer_1.default.prompt(questions);
48
- return {
49
- name: name || answers.name,
50
- slot: slot || answers.slot,
51
- description: answers.description || undefined,
52
- includeTests: answers.includeTests,
53
- };
54
- }
55
- async function promptComponentDeployment() {
56
- const answers = await inquirer_1.default.prompt([
57
- {
58
- type: "input",
59
- name: "versionId",
60
- message: "Enter the version ID to deploy to:",
61
- validate: (input) => {
62
- if (!input.trim())
63
- return "Version ID is required";
64
- return true;
65
- },
66
- },
67
- {
68
- type: "confirm",
69
- name: "confirm",
70
- message: "Are you sure you want to deploy this component?",
71
- default: false,
72
- },
73
- ]);
74
- return answers;
75
- }
@@ -1,21 +0,0 @@
1
- import { type FunctionInvocationTypeType, type OnErrorBehaviorType } from "@ollie-shop/core";
2
- export interface FunctionCreationAnswers {
3
- name: string;
4
- invocation: FunctionInvocationTypeType;
5
- priority: number;
6
- onError: OnErrorBehaviorType;
7
- includeTests: boolean;
8
- description?: string;
9
- }
10
- export interface FunctionDeploymentAnswers {
11
- versionId: string;
12
- confirm: boolean;
13
- }
14
- export interface FunctionTestAnswers {
15
- pattern: string;
16
- }
17
- export declare function promptFunctionCreation(name?: string, invocation?: string, priority?: number, onError?: string): Promise<FunctionCreationAnswers>;
18
- export declare function promptFunctionDeployment(): Promise<FunctionDeploymentAnswers>;
19
- export declare function promptFunctionTest(): Promise<FunctionTestAnswers>;
20
- export declare function getInvocationDescription(invocation: FunctionInvocationTypeType): string;
21
- //# sourceMappingURL=function.prompts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"function.prompts.d.ts","sourceRoot":"","sources":["../../src/prompts/function.prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAE/B,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,0BAA0B,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAoBD,wBAAsB,sBAAsB,CAC1C,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,uBAAuB,CAAC,CAuElC;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAoBnF;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAWvE;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,0BAA0B,GACrC,MAAM,CAOR"}
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.promptFunctionCreation = promptFunctionCreation;
7
- exports.promptFunctionDeployment = promptFunctionDeployment;
8
- exports.promptFunctionTest = promptFunctionTest;
9
- exports.getInvocationDescription = getInvocationDescription;
10
- const core_1 = require("@ollie-shop/core");
11
- const inquirer_1 = __importDefault(require("inquirer"));
12
- const validation_helpers_1 = require("../utils/validation-helpers");
13
- // Generate function invocation choices from core enum
14
- const invocationChoices = core_1.FunctionInvocationType.options.map((type) => ({
15
- name: type === "request"
16
- ? "Request (before forwarding to target)"
17
- : "Response (after receiving from target)",
18
- value: type,
19
- }));
20
- // Generate error behavior choices from core enum
21
- const errorBehaviorChoices = core_1.OnErrorBehavior.options.map((behavior) => ({
22
- name: behavior === "throw"
23
- ? "Throw error and stop execution"
24
- : "Skip and continue with next function",
25
- value: behavior,
26
- }));
27
- async function promptFunctionCreation(name, invocation, priority, onError) {
28
- const questions = [];
29
- if (!name) {
30
- questions.push({
31
- type: "input",
32
- name: "name",
33
- message: "What's the name of your function?",
34
- validate: (input) => {
35
- return (0, validation_helpers_1.validateFunctionName)(input);
36
- },
37
- });
38
- }
39
- if (!invocation) {
40
- questions.push({
41
- type: "list",
42
- name: "invocation",
43
- message: "When should this function execute?",
44
- choices: invocationChoices,
45
- });
46
- }
47
- if (priority === undefined) {
48
- questions.push({
49
- type: "number",
50
- name: "priority",
51
- message: "Priority (0-100, higher = executes first):",
52
- default: 0,
53
- validate: (input) => {
54
- if (input < 0 || input > 100)
55
- return "Priority must be between 0 and 100";
56
- return true;
57
- },
58
- });
59
- }
60
- if (!onError) {
61
- questions.push({
62
- type: "list",
63
- name: "onError",
64
- message: "What should happen if this function fails?",
65
- choices: errorBehaviorChoices,
66
- });
67
- }
68
- questions.push({
69
- type: "input",
70
- name: "description",
71
- message: "Enter a description (optional):",
72
- default: "",
73
- }, {
74
- type: "confirm",
75
- name: "includeTests",
76
- message: "Include test files?",
77
- default: true,
78
- });
79
- const answers = await inquirer_1.default.prompt(questions);
80
- return {
81
- name: name || answers.name,
82
- invocation: invocation || answers.invocation,
83
- priority: priority ?? answers.priority,
84
- onError: onError || answers.onError,
85
- description: answers.description || undefined,
86
- includeTests: answers.includeTests,
87
- };
88
- }
89
- async function promptFunctionDeployment() {
90
- const answers = await inquirer_1.default.prompt([
91
- {
92
- type: "input",
93
- name: "versionId",
94
- message: "Enter the version ID to deploy to:",
95
- validate: (input) => {
96
- if (!input.trim())
97
- return "Version ID is required";
98
- return true;
99
- },
100
- },
101
- {
102
- type: "confirm",
103
- name: "confirm",
104
- message: "Are you sure you want to deploy this function?",
105
- default: false,
106
- },
107
- ]);
108
- return answers;
109
- }
110
- async function promptFunctionTest() {
111
- const answers = await inquirer_1.default.prompt([
112
- {
113
- type: "input",
114
- name: "pattern",
115
- message: "Enter test file pattern:",
116
- default: "**/*.test.{js,ts}",
117
- },
118
- ]);
119
- return answers;
120
- }
121
- function getInvocationDescription(invocation) {
122
- const descriptions = {
123
- request: "Executes before forwarding request to target URL",
124
- response: "Executes after receiving response from target URL",
125
- };
126
- return descriptions[invocation] || "Custom invocation handler";
127
- }