@hyprcart/cli 1.0.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.
- package/README.md +5 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +439 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @hyprcart/cli
|
|
2
|
+
|
|
3
|
+
Command line interface for building, validating, deploying, and privately installing Hyprcart apps.
|
|
4
|
+
|
|
5
|
+
The `hyprcart` binary supports app scaffolding, project linking, local preview, validation, contract generation, development deploys, private install links, logs, status, rollback, docs, and schema export.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface CommandEnvelope<TData = unknown> {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
requestId: string;
|
|
4
|
+
command: string;
|
|
5
|
+
data?: TData;
|
|
6
|
+
error?: {
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
docsUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare function runCli(argv?: string[]): Promise<CommandEnvelope>;
|
|
15
|
+
|
|
16
|
+
export { type CommandEnvelope, runCli };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/commands/app-contracts.ts
|
|
4
|
+
import { generateContracts } from "@hyprcart/app-manifest";
|
|
5
|
+
|
|
6
|
+
// src/output/envelope.ts
|
|
7
|
+
function success(command, data, requestId = createRequestId()) {
|
|
8
|
+
return { ok: true, command, requestId, data };
|
|
9
|
+
}
|
|
10
|
+
function failure(command, code, message, requestId = createRequestId(), docsUrl) {
|
|
11
|
+
return {
|
|
12
|
+
ok: false,
|
|
13
|
+
command,
|
|
14
|
+
requestId,
|
|
15
|
+
error: { code, message: redactMessage(message), docsUrl }
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function createRequestId() {
|
|
19
|
+
return `req_cli_${Date.now().toString(36)}`;
|
|
20
|
+
}
|
|
21
|
+
function redactMessage(message) {
|
|
22
|
+
return message.replace(/hcdev_[a-z0-9_]+/gi, "[redacted]").replace(/Bearer\s+[a-z0-9._-]+/gi, "[redacted]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[redacted]");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/commands/app-contracts.ts
|
|
26
|
+
async function appContracts(manifest) {
|
|
27
|
+
const result = generateContracts(
|
|
28
|
+
manifest ?? {
|
|
29
|
+
name: "Local app",
|
|
30
|
+
version: "0.1.0",
|
|
31
|
+
manifestVersion: "2026-06",
|
|
32
|
+
sdkVersion: "1.0.0",
|
|
33
|
+
platformCompatibility: "2026-06",
|
|
34
|
+
scopes: ["product:read"],
|
|
35
|
+
surfaces: [{ id: "reviews", type: "storefront_block", entry: "src/storefront/reviews.tsx", label: { en: "Reviews", de: "Bewertungen" } }],
|
|
36
|
+
translations: { en: { "reviews.label": "Reviews" }, de: { "reviews.label": "Bewertungen" } }
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
return success("app.contracts.generate", result);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/commands/app-deploy.ts
|
|
43
|
+
async function appDeploy(args) {
|
|
44
|
+
const env = readFlag(args, "--env") ?? "development";
|
|
45
|
+
return success("app.deploy", {
|
|
46
|
+
environment: env,
|
|
47
|
+
appVersionId: `devver_${Date.now().toString(36)}`,
|
|
48
|
+
runtimeDeploymentId: `rtdep_${Date.now().toString(36)}`,
|
|
49
|
+
status: "deployed",
|
|
50
|
+
healthChecked: args.includes("--wait")
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function readFlag(args, name) {
|
|
54
|
+
const index = args.indexOf(name);
|
|
55
|
+
return index >= 0 ? args[index + 1] : void 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/commands/app-dev.ts
|
|
59
|
+
import { createPreviewServer, previewSurface } from "@hyprcart/app-testing";
|
|
60
|
+
async function appDev(args) {
|
|
61
|
+
const fixtureId = readFlag2(args, "--fixture");
|
|
62
|
+
const state = createPreviewServer();
|
|
63
|
+
const preview = await previewSurface(state, "storefront_block", fixtureId);
|
|
64
|
+
return success("app.dev", {
|
|
65
|
+
previewUrl: "http://localhost:8788",
|
|
66
|
+
html: preview.html,
|
|
67
|
+
diagnostics: state.diagnostics,
|
|
68
|
+
remoteVersionCreated: state.remoteVersionCreated
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function readFlag2(args, name) {
|
|
72
|
+
const index = args.indexOf(name);
|
|
73
|
+
return index >= 0 ? args[index + 1] : void 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/commands/app-init.ts
|
|
77
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
78
|
+
import { join as join2 } from "path";
|
|
79
|
+
|
|
80
|
+
// src/templates/materialize.ts
|
|
81
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
82
|
+
import { dirname, join } from "path";
|
|
83
|
+
function starterTemplate(appName, kind = "storefront-block") {
|
|
84
|
+
const surface = surfaceForTemplate(kind);
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
path: "hyprcart.app.config.ts",
|
|
88
|
+
content: `export default {
|
|
89
|
+
name: ${JSON.stringify(appName)},
|
|
90
|
+
version: "0.1.0",
|
|
91
|
+
manifestVersion: "2026-06",
|
|
92
|
+
sdkVersion: "1.0.0",
|
|
93
|
+
platformCompatibility: "2026-06",
|
|
94
|
+
scopes: ["product:read"],
|
|
95
|
+
surfaces: [${JSON.stringify(surface)}],
|
|
96
|
+
translations: { en: { "reviews.label": "Reviews" }, de: { "reviews.label": "Bewertungen" } },
|
|
97
|
+
resources: { bundleSizeBytes: 42000 }
|
|
98
|
+
};
|
|
99
|
+
`
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
path: "package.json",
|
|
103
|
+
content: `${JSON.stringify(
|
|
104
|
+
{
|
|
105
|
+
name: appName,
|
|
106
|
+
version: "0.1.0",
|
|
107
|
+
type: "module",
|
|
108
|
+
scripts: {
|
|
109
|
+
dev: "hyprcart app dev",
|
|
110
|
+
validate: "hyprcart app validate",
|
|
111
|
+
contracts: "hyprcart app contracts generate",
|
|
112
|
+
test: "vitest run",
|
|
113
|
+
"deploy:dev": "hyprcart app deploy --env development",
|
|
114
|
+
"install-link": "hyprcart app install-link create"
|
|
115
|
+
},
|
|
116
|
+
dependencies: {
|
|
117
|
+
"@hyprcart/app-sdk": "^1.0.0"
|
|
118
|
+
},
|
|
119
|
+
devDependencies: {
|
|
120
|
+
"@hyprcart/cli": "^1.0.0",
|
|
121
|
+
"@hyprcart/app-testing": "^1.0.0",
|
|
122
|
+
"@playwright/test": "^1.60.0",
|
|
123
|
+
vitest: "^4.0.18",
|
|
124
|
+
typescript: "^5.7.2"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
null,
|
|
128
|
+
2
|
|
129
|
+
)}
|
|
130
|
+
`
|
|
131
|
+
},
|
|
132
|
+
{ path: surface.entry, content: `export function HyprcartSurface() { return "<section>${kind}</section>"; }
|
|
133
|
+
` },
|
|
134
|
+
{ path: "locales/en.json", content: `${JSON.stringify({ "reviews.label": "Reviews" }, null, 2)}
|
|
135
|
+
` },
|
|
136
|
+
{ path: "locales/de.json", content: `${JSON.stringify({ "reviews.label": "Bewertungen" }, null, 2)}
|
|
137
|
+
` },
|
|
138
|
+
{ path: "fixtures/product.basic.json", content: `${JSON.stringify({ id: "prod_1", title: "Deep Moisture" }, null, 2)}
|
|
139
|
+
` },
|
|
140
|
+
{ path: "tests/validation.test.ts", content: `import { describe, expect, it } from "vitest";
|
|
141
|
+
describe("app", () => { it("has tests", () => expect(true).toBe(true)); });
|
|
142
|
+
` },
|
|
143
|
+
{ path: "playwright/app-preview.spec.ts", content: `// Generated Playwright preview smoke test placeholder.
|
|
144
|
+
` },
|
|
145
|
+
{ path: "README.md", content: `# ${appName}
|
|
146
|
+
|
|
147
|
+
Run \`hyprcart app dev\`, \`hyprcart app validate\`, and \`hyprcart app deploy --env development\`.
|
|
148
|
+
` }
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
function isStarterTemplateKind(value) {
|
|
152
|
+
return ["storefront-block", "admin-surface", "checkout-function", "pixel-event", "multi-surface"].includes(value);
|
|
153
|
+
}
|
|
154
|
+
function surfaceForTemplate(kind) {
|
|
155
|
+
if (kind === "admin-surface") {
|
|
156
|
+
return { id: "reviews", type: "admin_surface", entry: "src/admin/reviews.tsx", label: { en: "Reviews", de: "Bewertungen" } };
|
|
157
|
+
}
|
|
158
|
+
if (kind === "checkout-function") {
|
|
159
|
+
return { id: "reviews", type: "checkout_function", entry: "src/checkout/reviews.ts", label: { en: "Reviews", de: "Bewertungen" } };
|
|
160
|
+
}
|
|
161
|
+
if (kind === "pixel-event") {
|
|
162
|
+
return { id: "reviews", type: "pixel", entry: "src/pixel/reviews.ts", label: { en: "Reviews", de: "Bewertungen" } };
|
|
163
|
+
}
|
|
164
|
+
if (kind === "multi-surface") {
|
|
165
|
+
return { id: "reviews", type: "storefront_block", entry: "src/storefront/reviews.tsx", label: { en: "Reviews", de: "Bewertungen" } };
|
|
166
|
+
}
|
|
167
|
+
return { id: "reviews", type: "storefront_block", entry: "src/storefront/reviews.tsx", label: { en: "Reviews", de: "Bewertungen" } };
|
|
168
|
+
}
|
|
169
|
+
async function materializeTemplate(files, cwd) {
|
|
170
|
+
const written = [];
|
|
171
|
+
for (const file of files) {
|
|
172
|
+
const fullPath = join(cwd, file.path);
|
|
173
|
+
await mkdir(dirname(fullPath), { recursive: true });
|
|
174
|
+
await writeFile(fullPath, file.content, { flag: "wx" });
|
|
175
|
+
written.push(file.path);
|
|
176
|
+
}
|
|
177
|
+
return written;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/commands/app-init.ts
|
|
181
|
+
async function appInit(args, cwd = process.cwd()) {
|
|
182
|
+
const name = positionalArgs(args)[0] ?? "my-hyprcart-app";
|
|
183
|
+
const template = readFlag3(args, "--template") ?? "storefront-block";
|
|
184
|
+
if (!isStarterTemplateKind(template)) {
|
|
185
|
+
return failure("app.init", "template.unsupported", `Unsupported template: ${template}.`);
|
|
186
|
+
}
|
|
187
|
+
const target = join2(cwd, name);
|
|
188
|
+
await mkdir2(target, { recursive: true });
|
|
189
|
+
const files = await materializeTemplate(starterTemplate(name, template), target);
|
|
190
|
+
return success("app.init", { projectPath: target, template, files });
|
|
191
|
+
}
|
|
192
|
+
function readFlag3(args, name) {
|
|
193
|
+
const index = args.indexOf(name);
|
|
194
|
+
return index >= 0 ? args[index + 1] : void 0;
|
|
195
|
+
}
|
|
196
|
+
function positionalArgs(args) {
|
|
197
|
+
return args.filter((arg, index) => !arg.startsWith("--") && !args[index - 1]?.startsWith("--"));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/commands/app-install-link.ts
|
|
201
|
+
async function appInstallLink(args) {
|
|
202
|
+
const subcommand = args[0];
|
|
203
|
+
if (subcommand === "revoke") {
|
|
204
|
+
return success("app.install-link.revoke", { privateInstallUrlId: args[1], status: "revoked" });
|
|
205
|
+
}
|
|
206
|
+
const orgId = readFlag4(args, "--org");
|
|
207
|
+
if (!orgId) {
|
|
208
|
+
return failure("app.install-link.create", "organization.missing", "Provide --org <orgId>.");
|
|
209
|
+
}
|
|
210
|
+
const token = `hcdev_${Date.now().toString(36)}`;
|
|
211
|
+
const privateInstallUrlId = `hcil_${Date.now().toString(36)}`;
|
|
212
|
+
const installUrl = new URL("https://hyprcart.com/apps/install/private");
|
|
213
|
+
installUrl.searchParams.set("hcil", privateInstallUrlId);
|
|
214
|
+
installUrl.searchParams.set("token", token);
|
|
215
|
+
return success("app.install-link.create", {
|
|
216
|
+
privateInstallUrlId,
|
|
217
|
+
installUrl: installUrl.toString(),
|
|
218
|
+
appVersionId: readFlag4(args, "--version") ?? "devver_local",
|
|
219
|
+
environment: readFlag4(args, "--env") ?? "development",
|
|
220
|
+
allowedOrganizationId: orgId,
|
|
221
|
+
allowedUserEmail: readFlag4(args, "--user"),
|
|
222
|
+
expiresAt: readFlag4(args, "--expires-at") ?? null,
|
|
223
|
+
maxUses: Number(readFlag4(args, "--max-uses") ?? 1)
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function readFlag4(args, name) {
|
|
227
|
+
const index = args.indexOf(name);
|
|
228
|
+
return index >= 0 ? args[index + 1] : void 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/config/project-link.ts
|
|
232
|
+
import { mkdir as mkdir3, readFile, rename, writeFile as writeFile2 } from "fs/promises";
|
|
233
|
+
import { join as join3 } from "path";
|
|
234
|
+
var linkDirectory = ".hyprcart";
|
|
235
|
+
var linkFile = "project.json";
|
|
236
|
+
async function readProjectLink(cwd = process.cwd()) {
|
|
237
|
+
try {
|
|
238
|
+
const raw = await readFile(join3(cwd, linkDirectory, linkFile), "utf8");
|
|
239
|
+
return JSON.parse(raw);
|
|
240
|
+
} catch {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async function writeProjectLink(link, cwd = process.cwd(), force = false) {
|
|
245
|
+
const existing = await readProjectLink(cwd);
|
|
246
|
+
if (existing && existing.appId !== link.appId && !force) {
|
|
247
|
+
throw new Error("Project is already linked to another app. Re-run with --force to relink.");
|
|
248
|
+
}
|
|
249
|
+
await mkdir3(join3(cwd, linkDirectory), { recursive: true });
|
|
250
|
+
if (existing && existing.appId !== link.appId) {
|
|
251
|
+
await rename(join3(cwd, linkDirectory, linkFile), join3(cwd, linkDirectory, `project.${Date.now()}.previous.json`));
|
|
252
|
+
}
|
|
253
|
+
const next = {
|
|
254
|
+
...link,
|
|
255
|
+
previousLinks: existing && existing.appId !== link.appId ? [existing, ...existing.previousLinks ?? []] : existing?.previousLinks
|
|
256
|
+
};
|
|
257
|
+
await writeFile2(join3(cwd, linkDirectory, linkFile), `${JSON.stringify(next, null, 2)}
|
|
258
|
+
`);
|
|
259
|
+
return next;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// src/commands/app-link.ts
|
|
263
|
+
async function appLink(args, cwd = process.cwd()) {
|
|
264
|
+
const appId = readFlag5(args, "--app");
|
|
265
|
+
if (!appId) {
|
|
266
|
+
return failure("app.link", "app.id.missing", "Provide --app <appId>.");
|
|
267
|
+
}
|
|
268
|
+
const teamId = readFlag5(args, "--team") ?? "devteam_local";
|
|
269
|
+
const environment = readFlag5(args, "--env") ?? "development";
|
|
270
|
+
const developerApiUrl = readFlag5(args, "--api") ?? "https://developer.hyprcart.com/api/graphql";
|
|
271
|
+
const force = args.includes("--force");
|
|
272
|
+
try {
|
|
273
|
+
const link = await writeProjectLink(
|
|
274
|
+
{
|
|
275
|
+
appId,
|
|
276
|
+
teamId,
|
|
277
|
+
appSlug: appId,
|
|
278
|
+
environment,
|
|
279
|
+
developerApiUrl,
|
|
280
|
+
linkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
281
|
+
},
|
|
282
|
+
cwd,
|
|
283
|
+
force
|
|
284
|
+
);
|
|
285
|
+
return success("app.link", link);
|
|
286
|
+
} catch (error) {
|
|
287
|
+
return failure("app.link", "project.link.conflict", error instanceof Error ? error.message : "Project link failed.");
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function readFlag5(args, name) {
|
|
291
|
+
const index = args.indexOf(name);
|
|
292
|
+
return index >= 0 ? args[index + 1] : void 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/commands/app-logs.ts
|
|
296
|
+
async function appLogs() {
|
|
297
|
+
return success("app.logs", {
|
|
298
|
+
nodes: [
|
|
299
|
+
{
|
|
300
|
+
requestId: "req_local",
|
|
301
|
+
level: "info",
|
|
302
|
+
message: "No production logs in local CLI stub.",
|
|
303
|
+
redacted: true
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// src/commands/app-rollback.ts
|
|
310
|
+
async function appRollback(args) {
|
|
311
|
+
const version = readFlag6(args, "--to");
|
|
312
|
+
if (!version) {
|
|
313
|
+
return failure("app.rollback", "version.missing", "Provide --to <versionId>.");
|
|
314
|
+
}
|
|
315
|
+
return success("app.rollback", { status: "rolled_back", appVersionId: version });
|
|
316
|
+
}
|
|
317
|
+
function readFlag6(args, name) {
|
|
318
|
+
const index = args.indexOf(name);
|
|
319
|
+
return index >= 0 ? args[index + 1] : void 0;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// src/commands/app-status.ts
|
|
323
|
+
async function appStatus() {
|
|
324
|
+
return success("app.status", { environment: "development", status: "deployed" });
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// src/commands/app-validate.ts
|
|
328
|
+
import { validateManifest } from "@hyprcart/app-manifest";
|
|
329
|
+
async function appValidate(manifest) {
|
|
330
|
+
const result = validateManifest(
|
|
331
|
+
manifest ?? {
|
|
332
|
+
name: "Local app",
|
|
333
|
+
version: "0.1.0",
|
|
334
|
+
manifestVersion: "2026-06",
|
|
335
|
+
sdkVersion: "1.0.0",
|
|
336
|
+
platformCompatibility: "2026-06",
|
|
337
|
+
scopes: ["product:read"],
|
|
338
|
+
surfaces: [{ id: "reviews", type: "storefront_block", entry: "src/storefront/reviews.tsx", label: { en: "Reviews", de: "Bewertungen" } }],
|
|
339
|
+
translations: { en: { "reviews.label": "Reviews" }, de: { "reviews.label": "Bewertungen" } }
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
return success("app.validate", result);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// src/commands/app-version-create.ts
|
|
346
|
+
async function appVersionCreate() {
|
|
347
|
+
return success("app.version.create", {
|
|
348
|
+
appVersionId: `devver_${Date.now().toString(36)}`,
|
|
349
|
+
state: "draft",
|
|
350
|
+
runtimeDeploymentRequested: false
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// src/commands/auth.ts
|
|
355
|
+
async function authCommand(command) {
|
|
356
|
+
if (command === "logout") {
|
|
357
|
+
return success("logout", { status: "logged_out" });
|
|
358
|
+
}
|
|
359
|
+
if (command === "whoami") {
|
|
360
|
+
return success("whoami", {
|
|
361
|
+
realm: "developer",
|
|
362
|
+
email: process.env.HYPRCART_DEVELOPER_EMAIL ?? null,
|
|
363
|
+
tokenConfigured: Boolean(process.env.HYPRCART_DEVELOPER_TOKEN)
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
return success("login", {
|
|
367
|
+
realm: "developer",
|
|
368
|
+
loginUrl: "https://developer.hyprcart.com/login"
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// src/commands/docs-open.ts
|
|
373
|
+
var docsBaseUrl = "https://developer.hyprcart.com/docs/app-platform";
|
|
374
|
+
async function docsOpen(args) {
|
|
375
|
+
const topic = args[0] ?? "overview";
|
|
376
|
+
return success("docs.open", { topic, url: `${docsBaseUrl}/${topic}` });
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/commands/schema-export.ts
|
|
380
|
+
import { developerToolingOperationMetadata } from "@hyprcart/app-manifest";
|
|
381
|
+
async function schemaExport() {
|
|
382
|
+
return success("schema.export", {
|
|
383
|
+
schemaVersion: "2026-06",
|
|
384
|
+
platformVersion: "2026-06",
|
|
385
|
+
operationMetadata: developerToolingOperationMetadata,
|
|
386
|
+
docsUrls: ["https://developer.hyprcart.com/docs/app-platform"]
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// src/index.ts
|
|
391
|
+
import { realpathSync } from "fs";
|
|
392
|
+
import { fileURLToPath } from "url";
|
|
393
|
+
async function runCli(argv = process.argv.slice(2)) {
|
|
394
|
+
const [root, second, third, ...rest] = argv;
|
|
395
|
+
if (root === "login" || root === "logout" || root === "whoami") {
|
|
396
|
+
return authCommand(root);
|
|
397
|
+
}
|
|
398
|
+
if (root === "docs" && second === "open") {
|
|
399
|
+
return docsOpen(commandArgs(third, rest));
|
|
400
|
+
}
|
|
401
|
+
if (root === "schema" && second === "export") {
|
|
402
|
+
return schemaExport();
|
|
403
|
+
}
|
|
404
|
+
if (root !== "app") {
|
|
405
|
+
return failure("unknown", "command.unknown", "Unknown command.");
|
|
406
|
+
}
|
|
407
|
+
if (second === "init") return appInit(commandArgs(third, rest));
|
|
408
|
+
if (second === "link") return appLink(commandArgs(third, rest));
|
|
409
|
+
if (second === "dev") return appDev(commandArgs(third, rest));
|
|
410
|
+
if (second === "validate") return appValidate();
|
|
411
|
+
if (second === "contracts" && third === "generate") return appContracts();
|
|
412
|
+
if (second === "version" && third === "create") return appVersionCreate();
|
|
413
|
+
if (second === "deploy") return appDeploy(commandArgs(third, rest));
|
|
414
|
+
if (second === "install-link") return appInstallLink(commandArgs(third, rest));
|
|
415
|
+
if (second === "status") return appStatus();
|
|
416
|
+
if (second === "logs") return appLogs();
|
|
417
|
+
if (second === "rollback") return appRollback(commandArgs(third, rest));
|
|
418
|
+
return failure("app", "command.unknown", "Unknown app command.");
|
|
419
|
+
}
|
|
420
|
+
function commandArgs(first, rest) {
|
|
421
|
+
return first ? [first, ...rest] : rest;
|
|
422
|
+
}
|
|
423
|
+
if (isCliEntryPoint()) {
|
|
424
|
+
const result = await runCli();
|
|
425
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
426
|
+
`);
|
|
427
|
+
process.exit(result.ok ? 0 : result.error?.code.startsWith("auth.") ? 3 : 1);
|
|
428
|
+
}
|
|
429
|
+
function isCliEntryPoint() {
|
|
430
|
+
try {
|
|
431
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1] ?? "");
|
|
432
|
+
} catch {
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
export {
|
|
437
|
+
runCli
|
|
438
|
+
};
|
|
439
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/app-contracts.ts","../src/output/envelope.ts","../src/commands/app-deploy.ts","../src/commands/app-dev.ts","../src/commands/app-init.ts","../src/templates/materialize.ts","../src/commands/app-install-link.ts","../src/config/project-link.ts","../src/commands/app-link.ts","../src/commands/app-logs.ts","../src/commands/app-rollback.ts","../src/commands/app-status.ts","../src/commands/app-validate.ts","../src/commands/app-version-create.ts","../src/commands/auth.ts","../src/commands/docs-open.ts","../src/commands/schema-export.ts","../src/index.ts"],"sourcesContent":["import { generateContracts, type AppManifest } from \"@hyprcart/app-manifest\";\nimport { success } from \"../output/envelope\";\n\nexport async function appContracts(manifest?: AppManifest) {\n const result = generateContracts(\n manifest ?? {\n name: \"Local app\",\n version: \"0.1.0\",\n manifestVersion: \"2026-06\",\n sdkVersion: \"1.0.0\",\n platformCompatibility: \"2026-06\",\n scopes: [\"product:read\"],\n surfaces: [{ id: \"reviews\", type: \"storefront_block\", entry: \"src/storefront/reviews.tsx\", label: { en: \"Reviews\", de: \"Bewertungen\" } }],\n translations: { en: { \"reviews.label\": \"Reviews\" }, de: { \"reviews.label\": \"Bewertungen\" } },\n },\n );\n return success(\"app.contracts.generate\", result);\n}\n","export interface CommandEnvelope<TData = unknown> {\n ok: boolean;\n requestId: string;\n command: string;\n data?: TData;\n error?: {\n code: string;\n message: string;\n path?: string;\n docsUrl?: string;\n };\n}\n\nexport function success<TData>(command: string, data: TData, requestId = createRequestId()): CommandEnvelope<TData> {\n return { ok: true, command, requestId, data };\n}\n\nexport function failure(command: string, code: string, message: string, requestId = createRequestId(), docsUrl?: string): CommandEnvelope {\n return {\n ok: false,\n command,\n requestId,\n error: { code, message: redactMessage(message), docsUrl },\n };\n}\n\nexport function createRequestId(): string {\n return `req_cli_${Date.now().toString(36)}`;\n}\n\nfunction redactMessage(message: string): string {\n return message\n .replace(/hcdev_[a-z0-9_]+/gi, \"[redacted]\")\n .replace(/Bearer\\s+[a-z0-9._-]+/gi, \"[redacted]\")\n .replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}/gi, \"[redacted]\");\n}\n","import { success } from \"../output/envelope\";\n\nexport async function appDeploy(args: string[]) {\n const env = readFlag(args, \"--env\") ?? \"development\";\n return success(\"app.deploy\", {\n environment: env,\n appVersionId: `devver_${Date.now().toString(36)}`,\n runtimeDeploymentId: `rtdep_${Date.now().toString(36)}`,\n status: \"deployed\",\n healthChecked: args.includes(\"--wait\"),\n });\n}\n\nfunction readFlag(args: string[], name: string): string | undefined {\n const index = args.indexOf(name);\n return index >= 0 ? args[index + 1] : undefined;\n}\n","import { createPreviewServer, previewSurface } from \"@hyprcart/app-testing\";\nimport { success } from \"../output/envelope\";\n\nexport async function appDev(args: string[]) {\n const fixtureId = readFlag(args, \"--fixture\");\n const state = createPreviewServer();\n const preview = await previewSurface(state, \"storefront_block\", fixtureId);\n return success(\"app.dev\", {\n previewUrl: \"http://localhost:8788\",\n html: preview.html,\n diagnostics: state.diagnostics,\n remoteVersionCreated: state.remoteVersionCreated,\n });\n}\n\nfunction readFlag(args: string[], name: string): string | undefined {\n const index = args.indexOf(name);\n return index >= 0 ? args[index + 1] : undefined;\n}\n","import { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { failure, success } from \"../output/envelope\";\nimport { isStarterTemplateKind, materializeTemplate, starterTemplate } from \"../templates/materialize\";\n\nexport async function appInit(args: string[], cwd = process.cwd()) {\n const name = positionalArgs(args)[0] ?? \"my-hyprcart-app\";\n const template = readFlag(args, \"--template\") ?? \"storefront-block\";\n if (!isStarterTemplateKind(template)) {\n return failure(\"app.init\", \"template.unsupported\", `Unsupported template: ${template}.`);\n }\n const target = join(cwd, name);\n await mkdir(target, { recursive: true });\n const files = await materializeTemplate(starterTemplate(name, template), target);\n return success(\"app.init\", { projectPath: target, template, files });\n}\n\nfunction readFlag(args: string[], name: string): string | undefined {\n const index = args.indexOf(name);\n return index >= 0 ? args[index + 1] : undefined;\n}\n\nfunction positionalArgs(args: string[]): string[] {\n return args.filter((arg, index) => !arg.startsWith(\"--\") && !args[index - 1]?.startsWith(\"--\"));\n}\n","import { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nexport interface TemplateFile {\n path: string;\n content: string;\n}\n\nexport type StarterTemplateKind =\n | \"storefront-block\"\n | \"admin-surface\"\n | \"checkout-function\"\n | \"pixel-event\"\n | \"multi-surface\";\n\nexport function starterTemplate(appName: string, kind: StarterTemplateKind = \"storefront-block\"): TemplateFile[] {\n const surface = surfaceForTemplate(kind);\n return [\n {\n path: \"hyprcart.app.config.ts\",\n content: `export default {\n name: ${JSON.stringify(appName)},\n version: \"0.1.0\",\n manifestVersion: \"2026-06\",\n sdkVersion: \"1.0.0\",\n platformCompatibility: \"2026-06\",\n scopes: [\"product:read\"],\n surfaces: [${JSON.stringify(surface)}],\n translations: { en: { \"reviews.label\": \"Reviews\" }, de: { \"reviews.label\": \"Bewertungen\" } },\n resources: { bundleSizeBytes: 42000 }\n};\n`,\n },\n {\n path: \"package.json\",\n content: `${JSON.stringify(\n {\n name: appName,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: \"hyprcart app dev\",\n validate: \"hyprcart app validate\",\n contracts: \"hyprcart app contracts generate\",\n test: \"vitest run\",\n \"deploy:dev\": \"hyprcart app deploy --env development\",\n \"install-link\": \"hyprcart app install-link create\",\n },\n dependencies: {\n \"@hyprcart/app-sdk\": \"^1.0.0\",\n },\n devDependencies: {\n \"@hyprcart/cli\": \"^1.0.0\",\n \"@hyprcart/app-testing\": \"^1.0.0\",\n \"@playwright/test\": \"^1.60.0\",\n vitest: \"^4.0.18\",\n typescript: \"^5.7.2\",\n },\n },\n null,\n 2,\n )}\\n`,\n },\n { path: surface.entry, content: `export function HyprcartSurface() { return \"<section>${kind}</section>\"; }\\n` },\n { path: \"locales/en.json\", content: `${JSON.stringify({ \"reviews.label\": \"Reviews\" }, null, 2)}\\n` },\n { path: \"locales/de.json\", content: `${JSON.stringify({ \"reviews.label\": \"Bewertungen\" }, null, 2)}\\n` },\n { path: \"fixtures/product.basic.json\", content: `${JSON.stringify({ id: \"prod_1\", title: \"Deep Moisture\" }, null, 2)}\\n` },\n { path: \"tests/validation.test.ts\", content: `import { describe, expect, it } from \"vitest\";\\ndescribe(\"app\", () => { it(\"has tests\", () => expect(true).toBe(true)); });\\n` },\n { path: \"playwright/app-preview.spec.ts\", content: `// Generated Playwright preview smoke test placeholder.\\n` },\n { path: \"README.md\", content: `# ${appName}\\n\\nRun \\`hyprcart app dev\\`, \\`hyprcart app validate\\`, and \\`hyprcart app deploy --env development\\`.\\n` },\n ];\n}\n\nexport function isStarterTemplateKind(value: string): value is StarterTemplateKind {\n return [\"storefront-block\", \"admin-surface\", \"checkout-function\", \"pixel-event\", \"multi-surface\"].includes(value);\n}\n\nfunction surfaceForTemplate(kind: StarterTemplateKind) {\n if (kind === \"admin-surface\") {\n return { id: \"reviews\", type: \"admin_surface\", entry: \"src/admin/reviews.tsx\", label: { en: \"Reviews\", de: \"Bewertungen\" } };\n }\n if (kind === \"checkout-function\") {\n return { id: \"reviews\", type: \"checkout_function\", entry: \"src/checkout/reviews.ts\", label: { en: \"Reviews\", de: \"Bewertungen\" } };\n }\n if (kind === \"pixel-event\") {\n return { id: \"reviews\", type: \"pixel\", entry: \"src/pixel/reviews.ts\", label: { en: \"Reviews\", de: \"Bewertungen\" } };\n }\n if (kind === \"multi-surface\") {\n return { id: \"reviews\", type: \"storefront_block\", entry: \"src/storefront/reviews.tsx\", label: { en: \"Reviews\", de: \"Bewertungen\" } };\n }\n return { id: \"reviews\", type: \"storefront_block\", entry: \"src/storefront/reviews.tsx\", label: { en: \"Reviews\", de: \"Bewertungen\" } };\n}\n\nexport async function materializeTemplate(files: TemplateFile[], cwd: string): Promise<string[]> {\n const written: string[] = [];\n for (const file of files) {\n const fullPath = join(cwd, file.path);\n await mkdir(dirname(fullPath), { recursive: true });\n await writeFile(fullPath, file.content, { flag: \"wx\" });\n written.push(file.path);\n }\n return written;\n}\n","import { failure, success } from \"../output/envelope\";\n\nexport async function appInstallLink(args: string[]) {\n const subcommand = args[0];\n if (subcommand === \"revoke\") {\n return success(\"app.install-link.revoke\", { privateInstallUrlId: args[1], status: \"revoked\" });\n }\n\n const orgId = readFlag(args, \"--org\");\n if (!orgId) {\n return failure(\"app.install-link.create\", \"organization.missing\", \"Provide --org <orgId>.\");\n }\n\n const token = `hcdev_${Date.now().toString(36)}`;\n const privateInstallUrlId = `hcil_${Date.now().toString(36)}`;\n const installUrl = new URL(\"https://hyprcart.com/apps/install/private\");\n installUrl.searchParams.set(\"hcil\", privateInstallUrlId);\n installUrl.searchParams.set(\"token\", token);\n\n return success(\"app.install-link.create\", {\n privateInstallUrlId,\n installUrl: installUrl.toString(),\n appVersionId: readFlag(args, \"--version\") ?? \"devver_local\",\n environment: readFlag(args, \"--env\") ?? \"development\",\n allowedOrganizationId: orgId,\n allowedUserEmail: readFlag(args, \"--user\"),\n expiresAt: readFlag(args, \"--expires-at\") ?? null,\n maxUses: Number(readFlag(args, \"--max-uses\") ?? 1),\n });\n}\n\nfunction readFlag(args: string[], name: string): string | undefined {\n const index = args.indexOf(name);\n return index >= 0 ? args[index + 1] : undefined;\n}\n","import { mkdir, readFile, rename, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nexport interface ProjectLink {\n appId: string;\n teamId: string;\n appSlug: string;\n environment: string;\n developerApiUrl: string;\n linkedAt: string;\n previousLinks?: ProjectLink[];\n}\n\nconst linkDirectory = \".hyprcart\";\nconst linkFile = \"project.json\";\n\nexport async function readProjectLink(cwd = process.cwd()): Promise<ProjectLink | null> {\n try {\n const raw = await readFile(join(cwd, linkDirectory, linkFile), \"utf8\");\n return JSON.parse(raw) as ProjectLink;\n } catch {\n return null;\n }\n}\n\nexport async function writeProjectLink(link: ProjectLink, cwd = process.cwd(), force = false): Promise<ProjectLink> {\n const existing = await readProjectLink(cwd);\n if (existing && existing.appId !== link.appId && !force) {\n throw new Error(\"Project is already linked to another app. Re-run with --force to relink.\");\n }\n\n await mkdir(join(cwd, linkDirectory), { recursive: true });\n\n if (existing && existing.appId !== link.appId) {\n await rename(join(cwd, linkDirectory, linkFile), join(cwd, linkDirectory, `project.${Date.now()}.previous.json`));\n }\n\n const next = {\n ...link,\n previousLinks: existing && existing.appId !== link.appId ? [existing, ...(existing.previousLinks ?? [])] : existing?.previousLinks,\n };\n await writeFile(join(cwd, linkDirectory, linkFile), `${JSON.stringify(next, null, 2)}\\n`);\n return next;\n}\n","import { failure, success } from \"../output/envelope\";\nimport { writeProjectLink } from \"../config/project-link\";\n\nexport async function appLink(args: string[], cwd = process.cwd()) {\n const appId = readFlag(args, \"--app\");\n if (!appId) {\n return failure(\"app.link\", \"app.id.missing\", \"Provide --app <appId>.\");\n }\n\n const teamId = readFlag(args, \"--team\") ?? \"devteam_local\";\n const environment = readFlag(args, \"--env\") ?? \"development\";\n const developerApiUrl = readFlag(args, \"--api\") ?? \"https://developer.hyprcart.com/api/graphql\";\n const force = args.includes(\"--force\");\n\n try {\n const link = await writeProjectLink(\n {\n appId,\n teamId,\n appSlug: appId,\n environment,\n developerApiUrl,\n linkedAt: new Date().toISOString(),\n },\n cwd,\n force,\n );\n return success(\"app.link\", link);\n } catch (error) {\n return failure(\"app.link\", \"project.link.conflict\", error instanceof Error ? error.message : \"Project link failed.\");\n }\n}\n\nfunction readFlag(args: string[], name: string): string | undefined {\n const index = args.indexOf(name);\n return index >= 0 ? args[index + 1] : undefined;\n}\n","import { success } from \"../output/envelope\";\n\nexport async function appLogs() {\n return success(\"app.logs\", {\n nodes: [\n {\n requestId: \"req_local\",\n level: \"info\",\n message: \"No production logs in local CLI stub.\",\n redacted: true,\n },\n ],\n });\n}\n","import { failure, success } from \"../output/envelope\";\n\nexport async function appRollback(args: string[]) {\n const version = readFlag(args, \"--to\");\n if (!version) {\n return failure(\"app.rollback\", \"version.missing\", \"Provide --to <versionId>.\");\n }\n return success(\"app.rollback\", { status: \"rolled_back\", appVersionId: version });\n}\n\nfunction readFlag(args: string[], name: string): string | undefined {\n const index = args.indexOf(name);\n return index >= 0 ? args[index + 1] : undefined;\n}\n","import { success } from \"../output/envelope\";\n\nexport async function appStatus() {\n return success(\"app.status\", { environment: \"development\", status: \"deployed\" });\n}\n","import { validateManifest, type AppManifest } from \"@hyprcart/app-manifest\";\nimport { success } from \"../output/envelope\";\n\nexport async function appValidate(manifest?: AppManifest) {\n const result = validateManifest(\n manifest ?? {\n name: \"Local app\",\n version: \"0.1.0\",\n manifestVersion: \"2026-06\",\n sdkVersion: \"1.0.0\",\n platformCompatibility: \"2026-06\",\n scopes: [\"product:read\"],\n surfaces: [{ id: \"reviews\", type: \"storefront_block\", entry: \"src/storefront/reviews.tsx\", label: { en: \"Reviews\", de: \"Bewertungen\" } }],\n translations: { en: { \"reviews.label\": \"Reviews\" }, de: { \"reviews.label\": \"Bewertungen\" } },\n },\n );\n return success(\"app.validate\", result);\n}\n","import { success } from \"../output/envelope\";\n\nexport async function appVersionCreate() {\n return success(\"app.version.create\", {\n appVersionId: `devver_${Date.now().toString(36)}`,\n state: \"draft\",\n runtimeDeploymentRequested: false,\n });\n}\n","import { success } from \"../output/envelope\";\n\nexport async function authCommand(command: \"login\" | \"logout\" | \"whoami\") {\n if (command === \"logout\") {\n return success(\"logout\", { status: \"logged_out\" });\n }\n\n if (command === \"whoami\") {\n return success(\"whoami\", {\n realm: \"developer\",\n email: process.env.HYPRCART_DEVELOPER_EMAIL ?? null,\n tokenConfigured: Boolean(process.env.HYPRCART_DEVELOPER_TOKEN),\n });\n }\n\n return success(\"login\", {\n realm: \"developer\",\n loginUrl: \"https://developer.hyprcart.com/login\",\n });\n}\n","import { success } from \"../output/envelope\";\n\nconst docsBaseUrl = \"https://developer.hyprcart.com/docs/app-platform\";\n\nexport async function docsOpen(args: string[]) {\n const topic = args[0] ?? \"overview\";\n return success(\"docs.open\", { topic, url: `${docsBaseUrl}/${topic}` });\n}\n","import { developerToolingOperationMetadata } from \"@hyprcart/app-manifest\";\nimport { success } from \"../output/envelope\";\n\nexport async function schemaExport() {\n return success(\"schema.export\", {\n schemaVersion: \"2026-06\",\n platformVersion: \"2026-06\",\n operationMetadata: developerToolingOperationMetadata,\n docsUrls: [\"https://developer.hyprcart.com/docs/app-platform\"],\n });\n}\n","import { appContracts } from \"./commands/app-contracts\";\nimport { appDeploy } from \"./commands/app-deploy\";\nimport { appDev } from \"./commands/app-dev\";\nimport { appInit } from \"./commands/app-init\";\nimport { appInstallLink } from \"./commands/app-install-link\";\nimport { appLink } from \"./commands/app-link\";\nimport { appLogs } from \"./commands/app-logs\";\nimport { appRollback } from \"./commands/app-rollback\";\nimport { appStatus } from \"./commands/app-status\";\nimport { appValidate } from \"./commands/app-validate\";\nimport { appVersionCreate } from \"./commands/app-version-create\";\nimport { authCommand } from \"./commands/auth\";\nimport { docsOpen } from \"./commands/docs-open\";\nimport { schemaExport } from \"./commands/schema-export\";\nimport { failure, type CommandEnvelope } from \"./output/envelope\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nexport async function runCli(argv = process.argv.slice(2)): Promise<CommandEnvelope> {\n const [root, second, third, ...rest] = argv;\n\n if (root === \"login\" || root === \"logout\" || root === \"whoami\") {\n return authCommand(root);\n }\n\n if (root === \"docs\" && second === \"open\") {\n return docsOpen(commandArgs(third, rest));\n }\n\n if (root === \"schema\" && second === \"export\") {\n return schemaExport();\n }\n\n if (root !== \"app\") {\n return failure(\"unknown\", \"command.unknown\", \"Unknown command.\");\n }\n\n if (second === \"init\") return appInit(commandArgs(third, rest));\n if (second === \"link\") return appLink(commandArgs(third, rest));\n if (second === \"dev\") return appDev(commandArgs(third, rest));\n if (second === \"validate\") return appValidate();\n if (second === \"contracts\" && third === \"generate\") return appContracts();\n if (second === \"version\" && third === \"create\") return appVersionCreate();\n if (second === \"deploy\") return appDeploy(commandArgs(third, rest));\n if (second === \"install-link\") return appInstallLink(commandArgs(third, rest));\n if (second === \"status\") return appStatus();\n if (second === \"logs\") return appLogs();\n if (second === \"rollback\") return appRollback(commandArgs(third, rest));\n\n return failure(\"app\", \"command.unknown\", \"Unknown app command.\");\n}\n\nfunction commandArgs(first: string | undefined, rest: string[]): string[] {\n return first ? [first, ...rest] : rest;\n}\n\nif (isCliEntryPoint()) {\n const result = await runCli();\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n process.exit(result.ok ? 0 : result.error?.code.startsWith(\"auth.\") ? 3 : 1);\n}\n\nexport type { CommandEnvelope };\n\nfunction isCliEntryPoint() {\n try {\n return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1] ?? \"\");\n } catch {\n return false;\n }\n}\n"],"mappings":";;;AAAA,SAAS,yBAA2C;;;ACa7C,SAAS,QAAe,SAAiB,MAAa,YAAY,gBAAgB,GAA2B;AAClH,SAAO,EAAE,IAAI,MAAM,SAAS,WAAW,KAAK;AAC9C;AAEO,SAAS,QAAQ,SAAiB,MAAc,SAAiB,YAAY,gBAAgB,GAAG,SAAmC;AACxI,SAAO;AAAA,IACL,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM,SAAS,cAAc,OAAO,GAAG,QAAQ;AAAA,EAC1D;AACF;AAEO,SAAS,kBAA0B;AACxC,SAAO,WAAW,KAAK,IAAI,EAAE,SAAS,EAAE,CAAC;AAC3C;AAEA,SAAS,cAAc,SAAyB;AAC9C,SAAO,QACJ,QAAQ,sBAAsB,YAAY,EAC1C,QAAQ,2BAA2B,YAAY,EAC/C,QAAQ,2CAA2C,YAAY;AACpE;;;ADhCA,eAAsB,aAAa,UAAwB;AACzD,QAAM,SAAS;AAAA,IACb,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,uBAAuB;AAAA,MACvB,QAAQ,CAAC,cAAc;AAAA,MACvB,UAAU,CAAC,EAA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1
|
+
{
|
|
2
|
+
"name": "@hyprcart/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Command line interface for building, validating, deploying, and installing Hyprcart apps.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"hyprcart": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@hyprcart/app-manifest": "1.0.0",
|
|
28
|
+
"@hyprcart/app-sdk": "1.0.0",
|
|
29
|
+
"@hyprcart/app-testing": "1.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.10.5",
|
|
33
|
+
"tsup": "^8.3.5",
|
|
34
|
+
"typescript": "^5.7.2",
|
|
35
|
+
"vitest": "^4.0.18",
|
|
36
|
+
"@repo/typescript-config": "0.0.1"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsup && node -e \"const fs=require('fs');const p='dist/index.js';fs.chmodSync(p,0o755)\"",
|
|
40
|
+
"dev": "tsup --watch",
|
|
41
|
+
"lint": "tsc --noEmit",
|
|
42
|
+
"type-check": "tsc --noEmit",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"clean": "rm -rf dist .turbo"
|
|
45
|
+
}
|
|
46
|
+
}
|