@wix/web50-cli 0.1.0 → 0.1.2
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.
- package/bin/web5.js +1 -2
- package/dist/cjs/auth/deviceFlow.js +175 -16
- package/dist/cjs/auth/deviceFlow.js.map +1 -1
- package/dist/cjs/auth/index.js +93 -10
- package/dist/cjs/auth/index.js.map +1 -1
- package/dist/cjs/auth/secretStore.js.map +1 -1
- package/dist/cjs/cli.js +29 -1
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/commands/bundle.js +103 -0
- package/dist/cjs/commands/bundle.js.map +1 -0
- package/dist/cjs/commands/conversation.js +50 -0
- package/dist/cjs/commands/conversation.js.map +1 -0
- package/dist/cjs/commands/conversationWizard.js +528 -0
- package/dist/cjs/commands/conversationWizard.js.map +1 -0
- package/dist/cjs/commands/deploy.js +237 -0
- package/dist/cjs/commands/deploy.js.map +1 -0
- package/dist/cjs/commands/ecom.js +239 -0
- package/dist/cjs/commands/ecom.js.map +1 -0
- package/dist/cjs/commands/embed.js +118 -0
- package/dist/cjs/commands/embed.js.map +1 -0
- package/dist/cjs/commands/init.js +65 -29
- package/dist/cjs/commands/init.js.map +1 -1
- package/dist/cjs/commands/instructions.js +456 -0
- package/dist/cjs/commands/instructions.js.map +1 -0
- package/dist/cjs/commands/login.js +63 -4
- package/dist/cjs/commands/login.js.map +1 -1
- package/dist/cjs/commands/logout.js +16 -0
- package/dist/cjs/commands/logout.js.map +1 -0
- package/dist/cjs/commands/serve.js +122 -0
- package/dist/cjs/commands/serve.js.map +1 -0
- package/dist/cjs/commands/storybook.js +102 -0
- package/dist/cjs/commands/storybook.js.map +1 -0
- package/dist/cjs/commands/validate.js +617 -17
- package/dist/cjs/commands/validate.js.map +1 -1
- package/dist/cjs/commands/whoami.js +48 -0
- package/dist/cjs/commands/whoami.js.map +1 -0
- package/dist/cjs/templates/aiInstructionsSchema.js +5 -1
- package/dist/cjs/templates/aiInstructionsSchema.js.map +1 -1
- package/dist/cjs/templates/cmsMappingSchema.js +132 -0
- package/dist/cjs/templates/cmsMappingSchema.js.map +1 -0
- package/dist/cjs/utils/print.js +12 -0
- package/dist/cjs/utils/print.js.map +1 -1
- package/dist/cjs/utils/project.js +24 -0
- package/dist/cjs/utils/project.js.map +1 -1
- package/dist/cjs/utils/wixApi.js +57 -0
- package/dist/cjs/utils/wixApi.js.map +1 -0
- package/dist/esm/auth/deviceFlow.js +182 -17
- package/dist/esm/auth/deviceFlow.js.map +1 -1
- package/dist/esm/auth/index.js +98 -11
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/auth/secretStore.js.map +1 -1
- package/dist/esm/cli.js +29 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/commands/bundle.js +100 -0
- package/dist/esm/commands/bundle.js.map +1 -0
- package/dist/esm/commands/conversation.js +44 -0
- package/dist/esm/commands/conversation.js.map +1 -0
- package/dist/esm/commands/conversationWizard.js +529 -0
- package/dist/esm/commands/conversationWizard.js.map +1 -0
- package/dist/esm/commands/deploy.js +239 -0
- package/dist/esm/commands/deploy.js.map +1 -0
- package/dist/esm/commands/ecom.js +234 -0
- package/dist/esm/commands/ecom.js.map +1 -0
- package/dist/esm/commands/embed.js +112 -0
- package/dist/esm/commands/embed.js.map +1 -0
- package/dist/esm/commands/init.js +66 -30
- package/dist/esm/commands/init.js.map +1 -1
- package/dist/esm/commands/instructions.js +459 -0
- package/dist/esm/commands/instructions.js.map +1 -0
- package/dist/esm/commands/login.js +66 -6
- package/dist/esm/commands/login.js.map +1 -1
- package/dist/esm/commands/logout.js +12 -0
- package/dist/esm/commands/logout.js.map +1 -0
- package/dist/esm/commands/serve.js +117 -0
- package/dist/esm/commands/serve.js.map +1 -0
- package/dist/esm/commands/storybook.js +97 -0
- package/dist/esm/commands/storybook.js.map +1 -0
- package/dist/esm/commands/validate.js +623 -19
- package/dist/esm/commands/validate.js.map +1 -1
- package/dist/esm/commands/whoami.js +44 -0
- package/dist/esm/commands/whoami.js.map +1 -0
- package/dist/esm/templates/aiInstructionsSchema.js +5 -1
- package/dist/esm/templates/aiInstructionsSchema.js.map +1 -1
- package/dist/esm/templates/cmsMappingSchema.js +128 -0
- package/dist/esm/templates/cmsMappingSchema.js.map +1 -0
- package/dist/esm/utils/print.js +10 -0
- package/dist/esm/utils/print.js.map +1 -1
- package/dist/esm/utils/project.js +23 -0
- package/dist/esm/utils/project.js.map +1 -1
- package/dist/esm/utils/wixApi.js +53 -0
- package/dist/esm/utils/wixApi.js.map +1 -0
- package/dist/types/auth/deviceFlow.d.ts +3 -1
- package/dist/types/auth/deviceFlow.d.ts.map +1 -1
- package/dist/types/auth/index.d.ts +6 -1
- package/dist/types/auth/index.d.ts.map +1 -1
- package/dist/types/auth/secretStore.d.ts +2 -0
- package/dist/types/auth/secretStore.d.ts.map +1 -1
- package/dist/types/commands/bundle.d.ts +10 -0
- package/dist/types/commands/bundle.d.ts.map +1 -0
- package/dist/types/commands/conversation.d.ts +3 -0
- package/dist/types/commands/conversation.d.ts.map +1 -0
- package/dist/types/commands/conversationWizard.d.ts +3 -0
- package/dist/types/commands/conversationWizard.d.ts.map +1 -0
- package/dist/types/commands/deploy.d.ts +3 -0
- package/dist/types/commands/deploy.d.ts.map +1 -0
- package/dist/types/commands/ecom.d.ts +3 -0
- package/dist/types/commands/ecom.d.ts.map +1 -0
- package/dist/types/commands/embed.d.ts +3 -0
- package/dist/types/commands/embed.d.ts.map +1 -0
- package/dist/types/commands/init.d.ts.map +1 -1
- package/dist/types/commands/instructions.d.ts +3 -0
- package/dist/types/commands/instructions.d.ts.map +1 -0
- package/dist/types/commands/login.d.ts.map +1 -1
- package/dist/types/commands/logout.d.ts +3 -0
- package/dist/types/commands/logout.d.ts.map +1 -0
- package/dist/types/commands/serve.d.ts +3 -0
- package/dist/types/commands/serve.d.ts.map +1 -0
- package/dist/types/commands/storybook.d.ts +3 -0
- package/dist/types/commands/storybook.d.ts.map +1 -0
- package/dist/types/commands/validate.d.ts +7 -0
- package/dist/types/commands/validate.d.ts.map +1 -1
- package/dist/types/commands/whoami.d.ts +3 -0
- package/dist/types/commands/whoami.d.ts.map +1 -0
- package/dist/types/templates/aiInstructionsSchema.d.ts.map +1 -1
- package/dist/types/templates/cmsMappingSchema.d.ts +2 -0
- package/dist/types/templates/cmsMappingSchema.d.ts.map +1 -0
- package/dist/types/utils/print.d.ts +3 -0
- package/dist/types/utils/print.d.ts.map +1 -1
- package/dist/types/utils/project.d.ts +12 -0
- package/dist/types/utils/project.d.ts.map +1 -1
- package/dist/types/utils/wixApi.d.ts +9 -0
- package/dist/types/utils/wixApi.d.ts.map +1 -0
- package/package.json +5 -5
- package/defaults/package.json +0 -42
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.deployCommand = void 0;
|
|
5
|
+
var _commander = require("commander");
|
|
6
|
+
var fs = _interopRequireWildcard(require("fs"));
|
|
7
|
+
var path = _interopRequireWildcard(require("path"));
|
|
8
|
+
var _jsYaml = require("js-yaml");
|
|
9
|
+
var _project = require("../utils/project");
|
|
10
|
+
var _wixApi = require("../utils/wixApi");
|
|
11
|
+
var _print = require("../utils/print");
|
|
12
|
+
var _child_process = require("child_process");
|
|
13
|
+
var _validate = require("./validate");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
function getProjectRoot() {
|
|
16
|
+
const root = (0, _project.findProjectRoot)(process.cwd());
|
|
17
|
+
if (!root) {
|
|
18
|
+
(0, _print.error)('Not inside a web5 project. Run this command from your project directory.');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
return root;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ── Sub-deployers ─────────────────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
async function deployAiInstructions(root, opts = {}) {
|
|
27
|
+
const yamlPath = path.join(root, 'src', 'configuration', 'ai', 'prompt-instructions.yaml');
|
|
28
|
+
if (!fs.existsSync(yamlPath)) {
|
|
29
|
+
(0, _print.error)(`AI instructions file not found: ${yamlPath}`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
const content = fs.readFileSync(yamlPath, 'utf8');
|
|
33
|
+
const parsed = (0, _jsYaml.load)(content);
|
|
34
|
+
|
|
35
|
+
// Load action definitions from src/actions/*.yaml
|
|
36
|
+
const actionsDir = path.join(root, 'src', 'actions');
|
|
37
|
+
const actionInstruction = [];
|
|
38
|
+
if (fs.existsSync(actionsDir)) {
|
|
39
|
+
const files = fs.readdirSync(actionsDir).filter(f => f.endsWith('.yaml'));
|
|
40
|
+
for (const file of files) {
|
|
41
|
+
const action = (0, _jsYaml.load)(fs.readFileSync(path.join(actionsDir, file), 'utf8'));
|
|
42
|
+
if (action) {
|
|
43
|
+
actionInstruction.push(action);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const body = {
|
|
48
|
+
intents: parsed.intent ?? {},
|
|
49
|
+
semantics: parsed.semantics ?? {},
|
|
50
|
+
actions: actionInstruction,
|
|
51
|
+
content: parsed.instructions ?? ''
|
|
52
|
+
};
|
|
53
|
+
const sp = (0, _print.spinner)('Deploying AI instructions...');
|
|
54
|
+
try {
|
|
55
|
+
const data = await (0, _wixApi.wixRequest)({
|
|
56
|
+
path: '/web5/instruction/cli',
|
|
57
|
+
method: 'POST',
|
|
58
|
+
body
|
|
59
|
+
});
|
|
60
|
+
sp.stop();
|
|
61
|
+
(0, _print.success)(`AI instructions deployed (version ${data.instruction.version})`);
|
|
62
|
+
if (opts.activate) {
|
|
63
|
+
const version = data.instruction.version;
|
|
64
|
+
const sp2 = (0, _print.spinner)(`Activating version ${version}...`);
|
|
65
|
+
try {
|
|
66
|
+
await (0, _wixApi.wixRequest)({
|
|
67
|
+
path: `/web5/instructions/cli/activate/${version}`,
|
|
68
|
+
method: 'POST'
|
|
69
|
+
});
|
|
70
|
+
sp2.stop();
|
|
71
|
+
(0, _print.success)(`Activated version ${version}`);
|
|
72
|
+
} catch (err_) {
|
|
73
|
+
sp2.stop();
|
|
74
|
+
(0, _print.error)(err_.message);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
} catch (err_) {
|
|
79
|
+
sp.stop();
|
|
80
|
+
(0, _print.error)(err_.message);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function deployComponents() {
|
|
85
|
+
(0, _print.warn)('Components deploy: to be developed');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ── Rollback ──────────────────────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
async function rollbackInstructions() {
|
|
91
|
+
const sp = (0, _print.spinner)('Fetching instructions for rollback...');
|
|
92
|
+
try {
|
|
93
|
+
const data = await (0, _wixApi.wixRequest)({
|
|
94
|
+
path: '/web5/instructions/cli/query',
|
|
95
|
+
method: 'POST',
|
|
96
|
+
body: {
|
|
97
|
+
query: {}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
sp.stop();
|
|
101
|
+
const instructions = data.instructions ?? [];
|
|
102
|
+
const active = instructions.find(i => i.active);
|
|
103
|
+
if (!active) {
|
|
104
|
+
(0, _print.error)('No active instruction found — nothing to roll back from.');
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
const previous = instructions.filter(i => !i.active && i.version < active.version).sort((a, b) => b.version - a.version)[0];
|
|
108
|
+
if (!previous) {
|
|
109
|
+
(0, _print.error)(`No previous version found before v${active.version}.`);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
const sp2 = (0, _print.spinner)(`Rolling back to version ${previous.version}...`);
|
|
113
|
+
await (0, _wixApi.wixRequest)({
|
|
114
|
+
path: `/web5/instructions/cli/activate/${previous.version}`,
|
|
115
|
+
method: 'POST'
|
|
116
|
+
});
|
|
117
|
+
sp2.stop();
|
|
118
|
+
(0, _print.success)(`Rolled back to version ${previous.version} (was v${active.version})`);
|
|
119
|
+
} catch (err_) {
|
|
120
|
+
sp.stop();
|
|
121
|
+
(0, _print.error)(err_.message);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
127
|
+
|
|
128
|
+
function deriveValidationFilters(targets) {
|
|
129
|
+
const hasInstructions = targets.includes('instructions');
|
|
130
|
+
const hasComponents = targets.includes('components');
|
|
131
|
+
if (hasInstructions && hasComponents) {
|
|
132
|
+
return undefined; // validate everything
|
|
133
|
+
}
|
|
134
|
+
if (hasInstructions) {
|
|
135
|
+
return ['ai', 'actions'];
|
|
136
|
+
}
|
|
137
|
+
if (hasComponents) {
|
|
138
|
+
return ['cms', 'scripts', 'sections'];
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ── Stepped runner ────────────────────────────────────────────────────────────
|
|
144
|
+
|
|
145
|
+
async function runWithSteps(root, targets, opts = {}) {
|
|
146
|
+
const needsBundle = targets.includes('components');
|
|
147
|
+
|
|
148
|
+
// Calculate total steps
|
|
149
|
+
let totalSteps = 0;
|
|
150
|
+
if (!opts.skipValidate) {
|
|
151
|
+
totalSteps++;
|
|
152
|
+
}
|
|
153
|
+
if (needsBundle && !opts.skipBundle) {
|
|
154
|
+
totalSteps++;
|
|
155
|
+
}
|
|
156
|
+
totalSteps++; // deploy
|
|
157
|
+
|
|
158
|
+
let currentStep = 0;
|
|
159
|
+
if (!opts.skipValidate) {
|
|
160
|
+
(0, _print.step)(++currentStep, totalSteps, 'Verification');
|
|
161
|
+
const filters = deriveValidationFilters(targets);
|
|
162
|
+
const valid = (0, _validate.runValidation)(root, filters);
|
|
163
|
+
if (!valid) {
|
|
164
|
+
(0, _print.error)('Verification failed. Fix errors before deploying.');
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (needsBundle && !opts.skipBundle) {
|
|
169
|
+
(0, _print.step)(++currentStep, totalSteps, 'Bundle');
|
|
170
|
+
try {
|
|
171
|
+
(0, _child_process.execSync)('npm run bundle', {
|
|
172
|
+
cwd: root,
|
|
173
|
+
stdio: 'inherit'
|
|
174
|
+
});
|
|
175
|
+
} catch {
|
|
176
|
+
(0, _print.error)('Bundle failed. Fix errors before deploying.');
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
(0, _print.step)(++currentStep, totalSteps, 'Deploy');
|
|
181
|
+
for (const target of targets) {
|
|
182
|
+
if (target === 'components') {
|
|
183
|
+
await deployComponents();
|
|
184
|
+
}
|
|
185
|
+
if (target === 'instructions') {
|
|
186
|
+
await deployAiInstructions(root, {
|
|
187
|
+
activate: opts.activate
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
console.log('');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ── Subcommands ───────────────────────────────────────────────────────────────
|
|
195
|
+
|
|
196
|
+
const instructionsCmd = new _commander.Command('instructions').description('Deploy AI instructions from src/configuration/ai/prompt-instructions.yaml').option('--skip-validate', 'Skip the pre-deploy validation step').option('--activate', 'Automatically activate the deployed version').action(async opts => {
|
|
197
|
+
const root = getProjectRoot();
|
|
198
|
+
await runWithSteps(root, ['instructions'], {
|
|
199
|
+
skipValidate: opts.skipValidate,
|
|
200
|
+
activate: opts.activate
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
const componentsCmd = new _commander.Command('components').description('Deploy components').option('--skip-validate', 'Skip the pre-deploy validation step').option('--skip-bundle', 'Skip the bundle step (reuse existing build artifact)').action(async opts => {
|
|
204
|
+
const root = getProjectRoot();
|
|
205
|
+
await runWithSteps(root, ['components'], {
|
|
206
|
+
skipValidate: opts.skipValidate,
|
|
207
|
+
skipBundle: opts.skipBundle
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// ── Root deploy command ───────────────────────────────────────────────────────
|
|
212
|
+
|
|
213
|
+
const deployCommand = exports.deployCommand = new _commander.Command('deploy').description('Deploy project resources to the Web5 platform').option('--target <target>', 'What to deploy: instructions, components, or all').option('--skip-validate', 'Skip the pre-deploy validation step').option('--skip-bundle', 'Skip the bundle step (reuse existing build artifact)').option('--rollback', 'Re-activate the previous instruction version').action(async opts => {
|
|
214
|
+
const root = getProjectRoot();
|
|
215
|
+
if (opts.rollback) {
|
|
216
|
+
await rollbackInstructions();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
let targets;
|
|
220
|
+
if (!opts.target || opts.target === 'all') {
|
|
221
|
+
targets = ['components', 'instructions'];
|
|
222
|
+
} else if (opts.target === 'instructions' || opts.target === 'components') {
|
|
223
|
+
targets = [opts.target];
|
|
224
|
+
} else {
|
|
225
|
+
(0, _print.error)(`Unknown target: '${opts.target}'. Valid values: instructions, components, all`);
|
|
226
|
+
process.exit(1);
|
|
227
|
+
}
|
|
228
|
+
await runWithSteps(root, targets, {
|
|
229
|
+
skipValidate: opts.skipValidate,
|
|
230
|
+
skipBundle: opts.skipBundle
|
|
231
|
+
});
|
|
232
|
+
}).addCommand(instructionsCmd).addCommand(componentsCmd);
|
|
233
|
+
deployCommand.on('command:*', ([cmd]) => {
|
|
234
|
+
(0, _print.error)(`Unknown deploy target: '${cmd}'. Valid targets: components, instructions`);
|
|
235
|
+
process.exit(1);
|
|
236
|
+
});
|
|
237
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_commander","require","fs","_interopRequireWildcard","path","_jsYaml","_project","_wixApi","_print","_child_process","_validate","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getProjectRoot","root","findProjectRoot","process","cwd","error","exit","deployAiInstructions","opts","yamlPath","join","existsSync","content","readFileSync","parsed","yamlLoad","actionsDir","actionInstruction","files","readdirSync","filter","endsWith","file","action","push","body","intents","intent","semantics","actions","instructions","sp","spinner","data","wixRequest","method","stop","success","instruction","version","activate","sp2","err_","message","deployComponents","warn","rollbackInstructions","query","active","find","previous","sort","a","b","deriveValidationFilters","targets","hasInstructions","includes","hasComponents","undefined","runWithSteps","needsBundle","totalSteps","skipValidate","skipBundle","currentStep","step","filters","valid","runValidation","execSync","stdio","target","console","log","instructionsCmd","Command","description","option","componentsCmd","deployCommand","exports","rollback","addCommand","on","cmd"],"sources":["../../../src/commands/deploy.ts"],"sourcesContent":["import { Command } from 'commander';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { load as yamlLoad } from 'js-yaml';\nimport { findProjectRoot } from '../utils/project';\nimport { wixRequest } from '../utils/wixApi';\nimport { success, error, warn, spinner, step } from '../utils/print';\nimport { execSync } from 'child_process';\nimport { runValidation, DomainFilter } from './validate';\n\nfunction getProjectRoot(): string {\n const root = findProjectRoot(process.cwd());\n if (!root) {\n error(\n 'Not inside a web5 project. Run this command from your project directory.',\n );\n process.exit(1);\n }\n return root;\n}\n\n// ── Sub-deployers ─────────────────────────────────────────────────────────────\n\ninterface Instruction {\n id: string;\n version: number;\n content: string;\n active?: boolean;\n}\n\nasync function deployAiInstructions(\n root: string,\n opts: { activate?: boolean } = {},\n): Promise<void> {\n const yamlPath = path.join(\n root,\n 'src',\n 'configuration',\n 'ai',\n 'prompt-instructions.yaml',\n );\n\n if (!fs.existsSync(yamlPath)) {\n error(`AI instructions file not found: ${yamlPath}`);\n process.exit(1);\n }\n\n const content = fs.readFileSync(yamlPath, 'utf8');\n const parsed = yamlLoad(content) as {\n intent?: Record<string, string>;\n semantics?: Record<string, string>;\n instructions?: string;\n [key: string]: unknown;\n };\n\n // Load action definitions from src/actions/*.yaml\n const actionsDir = path.join(root, 'src', 'actions');\n const actionInstruction: unknown[] = [];\n if (fs.existsSync(actionsDir)) {\n const files = fs.readdirSync(actionsDir).filter((f) => f.endsWith('.yaml'));\n for (const file of files) {\n const action = yamlLoad(\n fs.readFileSync(path.join(actionsDir, file), 'utf8'),\n );\n if (action) {\n actionInstruction.push(action);\n }\n }\n }\n\n const body = {\n intents: parsed.intent ?? {},\n semantics: parsed.semantics ?? {},\n actions: actionInstruction,\n content: parsed.instructions ?? '',\n };\n\n const sp = spinner('Deploying AI instructions...');\n\n try {\n const data = await wixRequest<{ instruction: Instruction }>({\n path: '/web5/instruction/cli',\n method: 'POST',\n body,\n });\n sp.stop();\n success(`AI instructions deployed (version ${data.instruction.version})`);\n\n if (opts.activate) {\n const version = data.instruction.version;\n const sp2 = spinner(`Activating version ${version}...`);\n try {\n await wixRequest({\n path: `/web5/instructions/cli/activate/${version}`,\n method: 'POST',\n });\n sp2.stop();\n success(`Activated version ${version}`);\n } catch (err_) {\n sp2.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n }\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n}\n\nasync function deployComponents(): Promise<void> {\n warn('Components deploy: to be developed');\n}\n\n// ── Rollback ──────────────────────────────────────────────────────────────────\n\nasync function rollbackInstructions(): Promise<void> {\n const sp = spinner('Fetching instructions for rollback...');\n try {\n const data = await wixRequest<{ instructions: Instruction[] }>({\n path: '/web5/instructions/cli/query',\n method: 'POST',\n body: { query: {} },\n });\n sp.stop();\n\n const instructions = data.instructions ?? [];\n const active = instructions.find((i) => i.active);\n if (!active) {\n error('No active instruction found — nothing to roll back from.');\n process.exit(1);\n }\n\n const previous = instructions\n .filter((i) => !i.active && i.version < active.version)\n .sort((a, b) => b.version - a.version)[0];\n\n if (!previous) {\n error(`No previous version found before v${active.version}.`);\n process.exit(1);\n }\n\n const sp2 = spinner(`Rolling back to version ${previous.version}...`);\n await wixRequest({\n path: `/web5/instructions/cli/activate/${previous.version}`,\n method: 'POST',\n });\n sp2.stop();\n success(\n `Rolled back to version ${previous.version} (was v${active.version})`,\n );\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n}\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\nfunction deriveValidationFilters(\n targets: ('components' | 'instructions')[],\n): DomainFilter[] | undefined {\n const hasInstructions = targets.includes('instructions');\n const hasComponents = targets.includes('components');\n if (hasInstructions && hasComponents) {\n return undefined; // validate everything\n }\n if (hasInstructions) {\n return ['ai', 'actions'];\n }\n if (hasComponents) {\n return ['cms', 'scripts', 'sections'];\n }\n return undefined;\n}\n\n// ── Stepped runner ────────────────────────────────────────────────────────────\n\nasync function runWithSteps(\n root: string,\n targets: ('components' | 'instructions')[],\n opts: {\n skipValidate?: boolean;\n skipBundle?: boolean;\n activate?: boolean;\n } = {},\n): Promise<void> {\n const needsBundle = targets.includes('components');\n\n // Calculate total steps\n let totalSteps = 0;\n if (!opts.skipValidate) {\n totalSteps++;\n }\n if (needsBundle && !opts.skipBundle) {\n totalSteps++;\n }\n totalSteps++; // deploy\n\n let currentStep = 0;\n\n if (!opts.skipValidate) {\n step(++currentStep, totalSteps, 'Verification');\n const filters = deriveValidationFilters(targets);\n const valid = runValidation(root, filters);\n if (!valid) {\n error('Verification failed. Fix errors before deploying.');\n process.exit(1);\n }\n }\n\n if (needsBundle && !opts.skipBundle) {\n step(++currentStep, totalSteps, 'Bundle');\n try {\n execSync('npm run bundle', { cwd: root, stdio: 'inherit' });\n } catch {\n error('Bundle failed. Fix errors before deploying.');\n process.exit(1);\n }\n }\n\n step(++currentStep, totalSteps, 'Deploy');\n for (const target of targets) {\n if (target === 'components') {\n await deployComponents();\n }\n if (target === 'instructions') {\n await deployAiInstructions(root, { activate: opts.activate });\n }\n }\n\n console.log('');\n}\n\n// ── Subcommands ───────────────────────────────────────────────────────────────\n\nconst instructionsCmd = new Command('instructions')\n .description(\n 'Deploy AI instructions from src/configuration/ai/prompt-instructions.yaml',\n )\n .option('--skip-validate', 'Skip the pre-deploy validation step')\n .option('--activate', 'Automatically activate the deployed version')\n .action(async (opts: { skipValidate?: boolean; activate?: boolean }) => {\n const root = getProjectRoot();\n await runWithSteps(root, ['instructions'], {\n skipValidate: opts.skipValidate,\n activate: opts.activate,\n });\n });\n\nconst componentsCmd = new Command('components')\n .description('Deploy components')\n .option('--skip-validate', 'Skip the pre-deploy validation step')\n .option(\n '--skip-bundle',\n 'Skip the bundle step (reuse existing build artifact)',\n )\n .action(async (opts: { skipValidate?: boolean; skipBundle?: boolean }) => {\n const root = getProjectRoot();\n await runWithSteps(root, ['components'], {\n skipValidate: opts.skipValidate,\n skipBundle: opts.skipBundle,\n });\n });\n\n// ── Root deploy command ───────────────────────────────────────────────────────\n\nexport const deployCommand = new Command('deploy')\n .description('Deploy project resources to the Web5 platform')\n .option(\n '--target <target>',\n 'What to deploy: instructions, components, or all',\n )\n .option('--skip-validate', 'Skip the pre-deploy validation step')\n .option(\n '--skip-bundle',\n 'Skip the bundle step (reuse existing build artifact)',\n )\n .option('--rollback', 'Re-activate the previous instruction version')\n .action(\n async (opts: {\n target?: string;\n skipValidate?: boolean;\n skipBundle?: boolean;\n rollback?: boolean;\n }) => {\n const root = getProjectRoot();\n\n if (opts.rollback) {\n await rollbackInstructions();\n return;\n }\n\n type DeployTarget = 'components' | 'instructions';\n let targets: DeployTarget[];\n\n if (!opts.target || opts.target === 'all') {\n targets = ['components', 'instructions'];\n } else if (\n opts.target === 'instructions' ||\n opts.target === 'components'\n ) {\n targets = [opts.target as DeployTarget];\n } else {\n error(\n `Unknown target: '${opts.target}'. Valid values: instructions, components, all`,\n );\n process.exit(1);\n }\n\n await runWithSteps(root, targets, {\n skipValidate: opts.skipValidate,\n skipBundle: opts.skipBundle,\n });\n },\n )\n .addCommand(instructionsCmd)\n .addCommand(componentsCmd);\n\ndeployCommand.on('command:*', ([cmd]: string[]) => {\n error(\n `Unknown deploy target: '${cmd}'. Valid targets: components, instructions`,\n );\n process.exit(1);\n});\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,IAAA,GAAAD,uBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAAyD,SAAAE,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,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C,aAAa,CAACI,EAAE,CAAC,WAAW,EAAE,CAAC,CAACC,GAAG,CAAW,KAAK;EACjD,IAAAhF,YAAK,EACH,2BAA2BgF,GAAG,4CAChC,CAAC;EACDlF,OAAO,CAACG,IAAI,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.ecomCommand = void 0;
|
|
6
|
+
var _commander = require("commander");
|
|
7
|
+
var _inquirer = _interopRequireDefault(require("inquirer"));
|
|
8
|
+
var _open = _interopRequireDefault(require("open"));
|
|
9
|
+
var _wixApi = require("../utils/wixApi");
|
|
10
|
+
var _print = require("../utils/print");
|
|
11
|
+
const BASE = '/_api/ecom-integrations/v1/ecom-integrations';
|
|
12
|
+
|
|
13
|
+
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
// ── connect ───────────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
const POLL_INTERVAL_MS = 3000;
|
|
18
|
+
const POLL_TIMEOUT_MS = 120_000;
|
|
19
|
+
async function pollUntilActive() {
|
|
20
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
21
|
+
while (Date.now() < deadline) {
|
|
22
|
+
await new Promise(r => setTimeout(r, POLL_INTERVAL_MS));
|
|
23
|
+
try {
|
|
24
|
+
const data = await (0, _wixApi.wixRequest)({
|
|
25
|
+
path: `${BASE}/connection-status`,
|
|
26
|
+
method: 'GET'
|
|
27
|
+
});
|
|
28
|
+
if (data.status === 'ACTIVE') {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
// ignore transient errors and keep polling
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const connectCmd = new _commander.Command('connect').description('Connect a Shopify store via OAuth2 (opens browser)').option('--store-id <id>', 'Shopify store slug (e.g. mystore)').action(async opts => {
|
|
38
|
+
const statusSp = (0, _print.spinner)('Checking connection status...');
|
|
39
|
+
try {
|
|
40
|
+
const statusData = await (0, _wixApi.wixRequest)({
|
|
41
|
+
path: `${BASE}/connection-status`,
|
|
42
|
+
method: 'GET'
|
|
43
|
+
});
|
|
44
|
+
statusSp.stop();
|
|
45
|
+
if (statusData.status === 'ACTIVE') {
|
|
46
|
+
(0, _print.error)('Already connected. Use `web5 ecom disconnect` first to reconnect.');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
} catch {
|
|
50
|
+
statusSp.stop();
|
|
51
|
+
// not connected yet, proceed
|
|
52
|
+
}
|
|
53
|
+
let storeId = opts.storeId;
|
|
54
|
+
if (!storeId) {
|
|
55
|
+
const answer = await _inquirer.default.prompt([{
|
|
56
|
+
type: 'input',
|
|
57
|
+
name: 'storeId',
|
|
58
|
+
message: 'Shopify store slug (e.g. mystore):',
|
|
59
|
+
validate: v => v.trim().length > 0 || 'Store ID is required'
|
|
60
|
+
}]);
|
|
61
|
+
storeId = answer.storeId.trim();
|
|
62
|
+
}
|
|
63
|
+
const sp = (0, _print.spinner)('Initiating Shopify OAuth...');
|
|
64
|
+
try {
|
|
65
|
+
const data = await (0, _wixApi.wixRequest)({
|
|
66
|
+
path: `${BASE}/shopify-oauth/initiate`,
|
|
67
|
+
method: 'POST',
|
|
68
|
+
body: {
|
|
69
|
+
platform: 'SHOPIFY',
|
|
70
|
+
shopify: {
|
|
71
|
+
storeId
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
sp.stop();
|
|
76
|
+
const url = data.authorizationUrl ?? data.authorization_url;
|
|
77
|
+
if (!url) {
|
|
78
|
+
(0, _print.error)('No authorization URL returned by the server.');
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
(0, _print.info)(`Authorization URL: ${url}`);
|
|
82
|
+
await (0, _open.default)(url);
|
|
83
|
+
(0, _print.info)('Browser opened — complete the Shopify authorization...');
|
|
84
|
+
const polling = (0, _print.spinner)('Waiting for connection to become active...');
|
|
85
|
+
const active = await pollUntilActive();
|
|
86
|
+
polling.stop();
|
|
87
|
+
if (active) {
|
|
88
|
+
(0, _print.success)('Connected! Your Shopify store is now active.');
|
|
89
|
+
} else {
|
|
90
|
+
(0, _print.error)('Timed out waiting for the connection to become active. Run `web5 ecom status` to check.');
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
} catch (err_) {
|
|
94
|
+
sp.stop();
|
|
95
|
+
(0, _print.error)(err_.message);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// ── status ────────────────────────────────────────────────────────────────────
|
|
101
|
+
|
|
102
|
+
const statusCmd = new _commander.Command('status').description('Show the current ecom provider connection status').action(async () => {
|
|
103
|
+
const sp = (0, _print.spinner)('Fetching connection status...');
|
|
104
|
+
try {
|
|
105
|
+
const data = await (0, _wixApi.wixRequest)({
|
|
106
|
+
path: `${BASE}/connection-status`,
|
|
107
|
+
method: 'GET'
|
|
108
|
+
});
|
|
109
|
+
sp.stop();
|
|
110
|
+
if ((0, _print.isJsonMode)()) {
|
|
111
|
+
console.log(JSON.stringify(data));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const status = data.status ?? 'UNKNOWN';
|
|
115
|
+
if (status === 'UNKNOWN') {
|
|
116
|
+
(0, _print.info)('Status: not connected');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (status === 'ACTIVE') {
|
|
120
|
+
(0, _print.success)(`Status: ${status}`);
|
|
121
|
+
} else {
|
|
122
|
+
(0, _print.error)(`Status: ${status}`);
|
|
123
|
+
if (data.errorMessage) {
|
|
124
|
+
(0, _print.info)(`Error: ${data.errorMessage}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (data.lastFullSync) {
|
|
128
|
+
(0, _print.info)(`Last full sync: ${data.lastFullSync}`);
|
|
129
|
+
} else {
|
|
130
|
+
(0, _print.info)('Last full sync: never');
|
|
131
|
+
}
|
|
132
|
+
if (data.lastAlignmentSync) {
|
|
133
|
+
(0, _print.info)(`Last alignment: ${data.lastAlignmentSync}`);
|
|
134
|
+
} else {
|
|
135
|
+
(0, _print.info)('Last alignment: never');
|
|
136
|
+
}
|
|
137
|
+
} catch (err_) {
|
|
138
|
+
sp.stop();
|
|
139
|
+
(0, _print.error)(err_.message);
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// ── full-sync ─────────────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
const fullSyncCmd = new _commander.Command('full-sync').description('Trigger a full sync from the ecom provider into CMS').action(async () => {
|
|
147
|
+
const sp = (0, _print.spinner)('Running full sync...');
|
|
148
|
+
try {
|
|
149
|
+
const data = await (0, _wixApi.wixRequest)({
|
|
150
|
+
path: `${BASE}/full-sync`,
|
|
151
|
+
method: 'POST',
|
|
152
|
+
body: {}
|
|
153
|
+
});
|
|
154
|
+
sp.stop();
|
|
155
|
+
(0, _print.success)(data.status ?? 'Full sync triggered');
|
|
156
|
+
} catch (err_) {
|
|
157
|
+
sp.stop();
|
|
158
|
+
(0, _print.error)(err_.message);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// ── alignment-sync ────────────────────────────────────────────────────────────
|
|
164
|
+
|
|
165
|
+
const alignmentSyncCmd = new _commander.Command('alignment-sync').description('Run an alignment sync to catch any missed webhook updates').action(async () => {
|
|
166
|
+
const sp = (0, _print.spinner)('Running alignment sync...');
|
|
167
|
+
try {
|
|
168
|
+
const data = await (0, _wixApi.wixRequest)({
|
|
169
|
+
path: `${BASE}/alignment-sync`,
|
|
170
|
+
method: 'POST',
|
|
171
|
+
body: {}
|
|
172
|
+
});
|
|
173
|
+
sp.stop();
|
|
174
|
+
(0, _print.success)(data.status ?? 'Alignment sync complete');
|
|
175
|
+
const counts = data.syncedCounts ?? {};
|
|
176
|
+
for (const [table, count] of Object.entries(counts)) {
|
|
177
|
+
(0, _print.info)(` ${table}: ${count}`);
|
|
178
|
+
}
|
|
179
|
+
} catch (err_) {
|
|
180
|
+
sp.stop();
|
|
181
|
+
(0, _print.error)(err_.message);
|
|
182
|
+
process.exit(1);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// ── align-cms ─────────────────────────────────────────────────────────────────
|
|
187
|
+
|
|
188
|
+
const alignCmsCmd = new _commander.Command('align-cms').description('Align CMS collections with the ecom provider schema').action(async () => {
|
|
189
|
+
const sp = (0, _print.spinner)('Aligning CMS collections...');
|
|
190
|
+
try {
|
|
191
|
+
await (0, _wixApi.wixRequest)({
|
|
192
|
+
path: `${BASE}/align-cms-collections`,
|
|
193
|
+
method: 'POST',
|
|
194
|
+
body: {}
|
|
195
|
+
});
|
|
196
|
+
sp.stop();
|
|
197
|
+
(0, _print.success)('CMS collections aligned');
|
|
198
|
+
} catch (err_) {
|
|
199
|
+
sp.stop();
|
|
200
|
+
(0, _print.error)(err_.message);
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// ── disconnect ────────────────────────────────────────────────────────────────
|
|
206
|
+
|
|
207
|
+
const disconnectCmd = new _commander.Command('disconnect').description('Disconnect from the ecom provider').action(async () => {
|
|
208
|
+
const {
|
|
209
|
+
confirmed
|
|
210
|
+
} = await _inquirer.default.prompt([{
|
|
211
|
+
type: 'confirm',
|
|
212
|
+
name: 'confirmed',
|
|
213
|
+
message: 'Are you sure you want to disconnect from the ecom provider?',
|
|
214
|
+
default: false
|
|
215
|
+
}]);
|
|
216
|
+
if (!confirmed) {
|
|
217
|
+
(0, _print.info)('Disconnect cancelled.');
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const sp = (0, _print.spinner)('Disconnecting...');
|
|
221
|
+
try {
|
|
222
|
+
await (0, _wixApi.wixRequest)({
|
|
223
|
+
path: `${BASE}/disconnect`,
|
|
224
|
+
method: 'POST',
|
|
225
|
+
body: {}
|
|
226
|
+
});
|
|
227
|
+
sp.stop();
|
|
228
|
+
(0, _print.success)('Disconnected from ecom provider');
|
|
229
|
+
} catch (err_) {
|
|
230
|
+
sp.stop();
|
|
231
|
+
(0, _print.error)(err_.message);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// ── root ecom command ─────────────────────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
const ecomCommand = exports.ecomCommand = new _commander.Command('ecom').description('Manage ecom provider integrations').addCommand(connectCmd).addCommand(statusCmd).addCommand(fullSyncCmd).addCommand(alignmentSyncCmd).addCommand(alignCmsCmd).addCommand(disconnectCmd);
|
|
239
|
+
//# sourceMappingURL=ecom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_commander","require","_inquirer","_interopRequireDefault","_open","_wixApi","_print","BASE","POLL_INTERVAL_MS","POLL_TIMEOUT_MS","pollUntilActive","deadline","Date","now","Promise","r","setTimeout","data","wixRequest","path","method","status","connectCmd","Command","description","option","action","opts","statusSp","spinner","statusData","stop","error","process","exit","storeId","answer","inquirer","prompt","type","name","message","validate","v","trim","length","sp","body","platform","shopify","url","authorizationUrl","authorization_url","info","open","polling","active","success","err_","statusCmd","isJsonMode","console","log","JSON","stringify","errorMessage","lastFullSync","lastAlignmentSync","fullSyncCmd","alignmentSyncCmd","counts","syncedCounts","table","count","Object","entries","alignCmsCmd","disconnectCmd","confirmed","default","ecomCommand","exports","addCommand"],"sources":["../../../src/commands/ecom.ts"],"sourcesContent":["import { Command } from 'commander';\nimport inquirer from 'inquirer';\nimport open from 'open';\nimport { wixRequest } from '../utils/wixApi';\nimport { success, error, info, spinner, isJsonMode } from '../utils/print';\n\nconst BASE = '/_api/ecom-integrations/v1/ecom-integrations';\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\ninterface InitiateOAuthResponse {\n authorizationUrl?: string;\n authorization_url?: string;\n}\n\ninterface ConnectionStatusResponse {\n status?: string;\n platformMetadata?: Record<string, string>;\n lastFullSync?: string;\n lastAlignmentSync?: string;\n errorMessage?: string;\n}\n\ninterface SyncResponse {\n status?: string;\n syncedCounts?: Record<string, number>;\n}\n\n// ── connect ───────────────────────────────────────────────────────────────────\n\nconst POLL_INTERVAL_MS = 3000;\nconst POLL_TIMEOUT_MS = 120_000;\n\nasync function pollUntilActive(): Promise<boolean> {\n const deadline = Date.now() + POLL_TIMEOUT_MS;\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));\n try {\n const data = await wixRequest<ConnectionStatusResponse>({\n path: `${BASE}/connection-status`,\n method: 'GET',\n });\n if (data.status === 'ACTIVE') {\n return true;\n }\n } catch {\n // ignore transient errors and keep polling\n }\n }\n return false;\n}\n\nconst connectCmd = new Command('connect')\n .description('Connect a Shopify store via OAuth2 (opens browser)')\n .option('--store-id <id>', 'Shopify store slug (e.g. mystore)')\n .action(async (opts: { storeId?: string }) => {\n const statusSp = spinner('Checking connection status...');\n try {\n const statusData = await wixRequest<ConnectionStatusResponse>({\n path: `${BASE}/connection-status`,\n method: 'GET',\n });\n statusSp.stop();\n if (statusData.status === 'ACTIVE') {\n error(\n 'Already connected. Use `web5 ecom disconnect` first to reconnect.',\n );\n process.exit(1);\n }\n } catch {\n statusSp.stop();\n // not connected yet, proceed\n }\n\n let storeId = opts.storeId;\n\n if (!storeId) {\n const answer = await inquirer.prompt<{ storeId: string }>([\n {\n type: 'input',\n name: 'storeId',\n message: 'Shopify store slug (e.g. mystore):',\n validate: (v: string) =>\n v.trim().length > 0 || 'Store ID is required',\n },\n ]);\n storeId = answer.storeId.trim();\n }\n\n const sp = spinner('Initiating Shopify OAuth...');\n try {\n const data = await wixRequest<InitiateOAuthResponse>({\n path: `${BASE}/shopify-oauth/initiate`,\n method: 'POST',\n body: {\n platform: 'SHOPIFY',\n shopify: { storeId },\n },\n });\n sp.stop();\n\n const url = data.authorizationUrl ?? data.authorization_url;\n if (!url) {\n error('No authorization URL returned by the server.');\n process.exit(1);\n }\n\n info(`Authorization URL: ${url}`);\n await open(url);\n info('Browser opened — complete the Shopify authorization...');\n\n const polling = spinner('Waiting for connection to become active...');\n const active = await pollUntilActive();\n polling.stop();\n\n if (active) {\n success('Connected! Your Shopify store is now active.');\n } else {\n error(\n 'Timed out waiting for the connection to become active. Run `web5 ecom status` to check.',\n );\n process.exit(1);\n }\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n });\n\n// ── status ────────────────────────────────────────────────────────────────────\n\nconst statusCmd = new Command('status')\n .description('Show the current ecom provider connection status')\n .action(async () => {\n const sp = spinner('Fetching connection status...');\n try {\n const data = await wixRequest<ConnectionStatusResponse>({\n path: `${BASE}/connection-status`,\n method: 'GET',\n });\n sp.stop();\n\n if (isJsonMode()) {\n console.log(JSON.stringify(data));\n return;\n }\n\n const status = data.status ?? 'UNKNOWN';\n\n if (status === 'UNKNOWN') {\n info('Status: not connected');\n return;\n }\n\n if (status === 'ACTIVE') {\n success(`Status: ${status}`);\n } else {\n error(`Status: ${status}`);\n if (data.errorMessage) {\n info(`Error: ${data.errorMessage}`);\n }\n }\n\n if (data.lastFullSync) {\n info(`Last full sync: ${data.lastFullSync}`);\n } else {\n info('Last full sync: never');\n }\n\n if (data.lastAlignmentSync) {\n info(`Last alignment: ${data.lastAlignmentSync}`);\n } else {\n info('Last alignment: never');\n }\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n });\n\n// ── full-sync ─────────────────────────────────────────────────────────────────\n\nconst fullSyncCmd = new Command('full-sync')\n .description('Trigger a full sync from the ecom provider into CMS')\n .action(async () => {\n const sp = spinner('Running full sync...');\n try {\n const data = await wixRequest<SyncResponse>({\n path: `${BASE}/full-sync`,\n method: 'POST',\n body: {},\n });\n sp.stop();\n success(data.status ?? 'Full sync triggered');\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n });\n\n// ── alignment-sync ────────────────────────────────────────────────────────────\n\nconst alignmentSyncCmd = new Command('alignment-sync')\n .description('Run an alignment sync to catch any missed webhook updates')\n .action(async () => {\n const sp = spinner('Running alignment sync...');\n try {\n const data = await wixRequest<SyncResponse>({\n path: `${BASE}/alignment-sync`,\n method: 'POST',\n body: {},\n });\n sp.stop();\n success(data.status ?? 'Alignment sync complete');\n\n const counts = data.syncedCounts ?? {};\n for (const [table, count] of Object.entries(counts)) {\n info(` ${table}: ${count}`);\n }\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n });\n\n// ── align-cms ─────────────────────────────────────────────────────────────────\n\nconst alignCmsCmd = new Command('align-cms')\n .description('Align CMS collections with the ecom provider schema')\n .action(async () => {\n const sp = spinner('Aligning CMS collections...');\n try {\n await wixRequest({\n path: `${BASE}/align-cms-collections`,\n method: 'POST',\n body: {},\n });\n sp.stop();\n success('CMS collections aligned');\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n });\n\n// ── disconnect ────────────────────────────────────────────────────────────────\n\nconst disconnectCmd = new Command('disconnect')\n .description('Disconnect from the ecom provider')\n .action(async () => {\n const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([\n {\n type: 'confirm',\n name: 'confirmed',\n message: 'Are you sure you want to disconnect from the ecom provider?',\n default: false,\n },\n ]);\n\n if (!confirmed) {\n info('Disconnect cancelled.');\n return;\n }\n\n const sp = spinner('Disconnecting...');\n try {\n await wixRequest({\n path: `${BASE}/disconnect`,\n method: 'POST',\n body: {},\n });\n sp.stop();\n success('Disconnected from ecom provider');\n } catch (err_) {\n sp.stop();\n error((err_ as Error).message);\n process.exit(1);\n }\n });\n\n// ── root ecom command ─────────────────────────────────────────────────────────\n\nexport const ecomCommand = new Command('ecom')\n .description('Manage ecom provider integrations')\n .addCommand(connectCmd)\n .addCommand(statusCmd)\n .addCommand(fullSyncCmd)\n .addCommand(alignmentSyncCmd)\n .addCommand(alignCmsCmd)\n .addCommand(disconnectCmd);\n"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,IAAI,GAAG,8CAA8C;;AAE3D;;AAoBA;;AAEA,MAAMC,gBAAgB,GAAG,IAAI;AAC7B,MAAMC,eAAe,GAAG,OAAO;AAE/B,eAAeC,eAAeA,CAAA,EAAqB;EACjD,MAAMC,QAAQ,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGJ,eAAe;EAC7C,OAAOG,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,QAAQ,EAAE;IAC5B,MAAM,IAAIG,OAAO,CAAEC,CAAC,IAAKC,UAAU,CAACD,CAAC,EAAEP,gBAAgB,CAAC,CAAC;IACzD,IAAI;MACF,MAAMS,IAAI,GAAG,MAAM,IAAAC,kBAAU,EAA2B;QACtDC,IAAI,EAAE,GAAGZ,IAAI,oBAAoB;QACjCa,MAAM,EAAE;MACV,CAAC,CAAC;MACF,IAAIH,IAAI,CAACI,MAAM,KAAK,QAAQ,EAAE;QAC5B,OAAO,IAAI;MACb;IACF,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;EACA,OAAO,KAAK;AACd;AAEA,MAAMC,UAAU,GAAG,IAAIC,kBAAO,CAAC,SAAS,CAAC,CACtCC,WAAW,CAAC,oDAAoD,CAAC,CACjEC,MAAM,CAAC,iBAAiB,EAAE,mCAAmC,CAAC,CAC9DC,MAAM,CAAC,MAAOC,IAA0B,IAAK;EAC5C,MAAMC,QA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