@hype-stack/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +5 -0
- package/dist/cli-B_f7CCee.js +548 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/commands/add.d.ts +2 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/constants.d.ts +30 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/clone.d.ts +6 -0
- package/dist/core/clone.d.ts.map +1 -0
- package/dist/core/editor-config.d.ts +13 -0
- package/dist/core/editor-config.d.ts.map +1 -0
- package/dist/core/post-clone.d.ts +4 -0
- package/dist/core/post-clone.d.ts.map +1 -0
- package/dist/core/stack-config.d.ts +9 -0
- package/dist/core/stack-config.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/ui/banner.d.ts +3 -0
- package/dist/ui/banner.d.ts.map +1 -0
- package/dist/ui/logger.d.ts +9 -0
- package/dist/ui/logger.d.ts.map +1 -0
- package/dist/ui/theme.d.ts +37 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/utils/exec.d.ts +10 -0
- package/dist/utils/exec.d.ts.map +1 -0
- package/dist/utils/fs.d.ts +8 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/validate.d.ts +2 -0
- package/dist/utils/validate.d.ts.map +1 -0
- package/package.json +37 -0
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
import { Command as e } from "commander";
|
|
2
|
+
import t from "node:path";
|
|
3
|
+
import * as n from "@clack/prompts";
|
|
4
|
+
import { downloadTemplate as r } from "giget";
|
|
5
|
+
import i from "node:fs/promises";
|
|
6
|
+
import { spawn as a } from "node:child_process";
|
|
7
|
+
import o from "picocolors";
|
|
8
|
+
//#region src/constants.ts
|
|
9
|
+
var s = "0.0.1", c = "gh:BetterTyped/hype-stack", l = "stack.json", u = "/schema/stack.json", d = "https://hypestack.dev", f = "HYPE_STACK_API_URL", p = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, m = [
|
|
10
|
+
{
|
|
11
|
+
value: "cursor",
|
|
12
|
+
label: "Cursor",
|
|
13
|
+
hint: "default"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: "claude",
|
|
17
|
+
label: "Claude Code"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: "windsurf",
|
|
21
|
+
label: "Windsurf"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: "copilot",
|
|
25
|
+
label: "GitHub Copilot"
|
|
26
|
+
}
|
|
27
|
+
], h = m.map((e) => e.value), g = ".cursor/rules", _ = ".cursor", v = ".agents";
|
|
28
|
+
function ee() {
|
|
29
|
+
let e = process.env[f];
|
|
30
|
+
return e ? (te(e), e.replace(/\/+$/, "")) : d;
|
|
31
|
+
}
|
|
32
|
+
function te(e) {
|
|
33
|
+
try {
|
|
34
|
+
let t = new URL(e);
|
|
35
|
+
if (!t.protocol.startsWith("http")) throw Error(`${f} must use http or https protocol, got "${t.protocol}"`);
|
|
36
|
+
} catch (t) {
|
|
37
|
+
throw t instanceof TypeError ? Error(`${f} is not a valid URL: "${e}"`, { cause: t }) : t;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function ne() {
|
|
41
|
+
return `${ee()}${u}`;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/core/clone.ts
|
|
45
|
+
async function re(e) {
|
|
46
|
+
let t = await r(c, {
|
|
47
|
+
dir: e,
|
|
48
|
+
force: !0
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
dir: t.dir,
|
|
52
|
+
source: t.source
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/utils/fs.ts
|
|
57
|
+
async function y(e) {
|
|
58
|
+
return (await i.stat(e).catch(() => null))?.isDirectory() ?? !1;
|
|
59
|
+
}
|
|
60
|
+
async function b(e) {
|
|
61
|
+
return (await i.stat(e).catch(() => null))?.isFile() ?? !1;
|
|
62
|
+
}
|
|
63
|
+
async function ie(e) {
|
|
64
|
+
return (await i.readdir(e).catch(() => [])).length === 0;
|
|
65
|
+
}
|
|
66
|
+
async function x(e) {
|
|
67
|
+
let t = await i.readFile(e, "utf-8").catch(() => null);
|
|
68
|
+
return t ? JSON.parse(t) : null;
|
|
69
|
+
}
|
|
70
|
+
async function S(e, t) {
|
|
71
|
+
await i.writeFile(e, JSON.stringify(t, null, 2) + "\n", "utf-8");
|
|
72
|
+
}
|
|
73
|
+
async function C(e) {
|
|
74
|
+
let n = {};
|
|
75
|
+
if (!await y(e)) return n;
|
|
76
|
+
let r = await i.readdir(e, { withFileTypes: !0 });
|
|
77
|
+
for (let i of r) i.isDirectory() && await b(t.join(e, i.name, "package.json")) && (n[i.name] = t.relative(t.dirname(e), t.join(e, i.name)));
|
|
78
|
+
return n;
|
|
79
|
+
}
|
|
80
|
+
async function w(e) {
|
|
81
|
+
await i.rm(e, {
|
|
82
|
+
recursive: !0,
|
|
83
|
+
force: !0
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/core/editor-config.ts
|
|
88
|
+
function T(e) {
|
|
89
|
+
let t = {
|
|
90
|
+
globs: [],
|
|
91
|
+
alwaysApply: !1
|
|
92
|
+
};
|
|
93
|
+
if (!e.startsWith("---")) return {
|
|
94
|
+
frontmatter: t,
|
|
95
|
+
content: e
|
|
96
|
+
};
|
|
97
|
+
let n = e.indexOf("---", 3);
|
|
98
|
+
if (n === -1) return {
|
|
99
|
+
frontmatter: t,
|
|
100
|
+
content: e
|
|
101
|
+
};
|
|
102
|
+
let r = e.slice(3, n).trim(), i = e.slice(n + 3).trimStart(), a = r.split("\n"), o = 0;
|
|
103
|
+
for (; o < a.length;) {
|
|
104
|
+
let e = a[o].trim();
|
|
105
|
+
if (e.startsWith("description:")) t.description = e.slice(12).trim();
|
|
106
|
+
else if (e.startsWith("alwaysApply:")) t.alwaysApply = e.slice(12).trim() === "true";
|
|
107
|
+
else if (e.startsWith("globs:")) {
|
|
108
|
+
let n = e.slice(6).trim();
|
|
109
|
+
if (n) t.globs = n.split(",").map((e) => e.trim()).filter(Boolean);
|
|
110
|
+
else {
|
|
111
|
+
let e = [];
|
|
112
|
+
for (; o + 1 < a.length && a[o + 1].trim().startsWith("- ");) o++, e.push(a[o].trim().slice(2).trim());
|
|
113
|
+
t.globs = e;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
o++;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
frontmatter: t,
|
|
120
|
+
content: i
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function E(e) {
|
|
124
|
+
return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
|
|
125
|
+
}
|
|
126
|
+
function D(e) {
|
|
127
|
+
let t;
|
|
128
|
+
t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
|
|
129
|
+
let n = [`trigger: ${t}`];
|
|
130
|
+
if (t === "glob") {
|
|
131
|
+
let t = e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n");
|
|
132
|
+
n.push(`globs:\n${t}`);
|
|
133
|
+
}
|
|
134
|
+
return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
|
|
135
|
+
}
|
|
136
|
+
function ae(e) {
|
|
137
|
+
return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
|
|
138
|
+
}
|
|
139
|
+
var oe = {
|
|
140
|
+
claude: {
|
|
141
|
+
rulesDir: ".claude/rules",
|
|
142
|
+
extension: ".md",
|
|
143
|
+
convert: E
|
|
144
|
+
},
|
|
145
|
+
windsurf: {
|
|
146
|
+
rulesDir: ".windsurf/rules",
|
|
147
|
+
extension: ".md",
|
|
148
|
+
convert: D
|
|
149
|
+
},
|
|
150
|
+
copilot: {
|
|
151
|
+
rulesDir: ".github/instructions",
|
|
152
|
+
extension: ".instructions.md",
|
|
153
|
+
convert: ae
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
async function se(e) {
|
|
157
|
+
let n = t.join(e, g), r = (await i.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
|
|
158
|
+
return await Promise.all(r.map(async (e) => {
|
|
159
|
+
let r = t.join(n, e.name), { frontmatter: a, content: o } = T(await i.readFile(r, "utf-8"));
|
|
160
|
+
return {
|
|
161
|
+
frontmatter: a,
|
|
162
|
+
content: o,
|
|
163
|
+
filename: e.name
|
|
164
|
+
};
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
async function ce(e, n) {
|
|
168
|
+
if (n === "cursor") return;
|
|
169
|
+
let r = oe[n], a = await se(e), o = t.join(e, r.rulesDir);
|
|
170
|
+
await i.mkdir(o, { recursive: !0 }), await Promise.all(a.map((e) => {
|
|
171
|
+
let n = r.convert(e), a = e.filename.replace(/\.mdc$/, r.extension);
|
|
172
|
+
return i.writeFile(t.join(o, a), n, "utf-8");
|
|
173
|
+
})), await w(t.join(e, _)), await w(t.join(e, v));
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/utils/exec.ts
|
|
177
|
+
function O(e, t, n) {
|
|
178
|
+
return new Promise((r, i) => {
|
|
179
|
+
let o = a(e, t, {
|
|
180
|
+
cwd: n.cwd,
|
|
181
|
+
stdio: [
|
|
182
|
+
"ignore",
|
|
183
|
+
"pipe",
|
|
184
|
+
"pipe"
|
|
185
|
+
]
|
|
186
|
+
}), s = "", c = "";
|
|
187
|
+
o.stdout.on("data", (e) => {
|
|
188
|
+
let t = e.toString();
|
|
189
|
+
if (s += t, n.onData) {
|
|
190
|
+
let e = t.split("\n").filter(Boolean);
|
|
191
|
+
for (let t of e) n.onData(t);
|
|
192
|
+
}
|
|
193
|
+
}), o.stderr.on("data", (e) => {
|
|
194
|
+
let t = e.toString();
|
|
195
|
+
if (c += t, n.onData) {
|
|
196
|
+
let e = t.split("\n").filter(Boolean);
|
|
197
|
+
for (let t of e) n.onData(t);
|
|
198
|
+
}
|
|
199
|
+
}), o.on("error", i), o.on("close", (e) => {
|
|
200
|
+
r({
|
|
201
|
+
exitCode: e ?? 1,
|
|
202
|
+
stdout: s,
|
|
203
|
+
stderr: c
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/core/post-clone.ts
|
|
210
|
+
var k = "@hype-stack/", A = "hype-stack";
|
|
211
|
+
async function le(e) {
|
|
212
|
+
await w(t.join(e, ".git"));
|
|
213
|
+
}
|
|
214
|
+
async function ue(e) {
|
|
215
|
+
await O("git", ["init"], { cwd: e }), await O("git", ["add", "."], { cwd: e }), await O("git", [
|
|
216
|
+
"-c",
|
|
217
|
+
"user.name=Hype Stack CLI",
|
|
218
|
+
"-c",
|
|
219
|
+
"user.email=cli@hypestack.dev",
|
|
220
|
+
"commit",
|
|
221
|
+
"-m",
|
|
222
|
+
"Initial commit from Hype Stack CLI"
|
|
223
|
+
], { cwd: e });
|
|
224
|
+
}
|
|
225
|
+
async function de(e, t) {
|
|
226
|
+
let n = `@${t}/`, r = await me(e);
|
|
227
|
+
for (let e of r) {
|
|
228
|
+
let t = await x(e);
|
|
229
|
+
if (!t) continue;
|
|
230
|
+
let r = !1;
|
|
231
|
+
t.name?.startsWith(k) && (t.name = t.name.replace(k, n), r = !0), j(t.dependencies, n) && (r = !0), j(t.devDependencies, n) && (r = !0), t.nx && fe(t.nx, n) && (r = !0);
|
|
232
|
+
let a = await i.readFile(e, "utf-8");
|
|
233
|
+
if (a.includes(k)) {
|
|
234
|
+
let t = a.replaceAll(k, n);
|
|
235
|
+
await i.writeFile(e, t, "utf-8");
|
|
236
|
+
} else r && await S(e, t);
|
|
237
|
+
}
|
|
238
|
+
await pe(e, t);
|
|
239
|
+
}
|
|
240
|
+
function j(e, t) {
|
|
241
|
+
if (!e) return !1;
|
|
242
|
+
let n = !1;
|
|
243
|
+
for (let r of Object.keys(e)) if (r.startsWith(k)) {
|
|
244
|
+
let i = r.replace(k, t);
|
|
245
|
+
e[i] = e[r], delete e[r], n = !0;
|
|
246
|
+
}
|
|
247
|
+
return n;
|
|
248
|
+
}
|
|
249
|
+
function fe(e, t) {
|
|
250
|
+
if (!e) return !1;
|
|
251
|
+
let n = !1;
|
|
252
|
+
if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(k) ? (n = !0, e.replace(k, t)) : e), e.targets) {
|
|
253
|
+
for (let r of Object.values(e.targets)) if (r.buildTarget?.includes(k) && (r.buildTarget = r.buildTarget.replaceAll(k, t), n = !0), r.dependsOn &&= r.dependsOn.map((e) => e.includes(k) ? (n = !0, e.replaceAll(k, t)) : e), r.configurations) for (let e of Object.values(r.configurations)) e.buildTarget?.includes(k) && (e.buildTarget = e.buildTarget.replaceAll(k, t), n = !0);
|
|
254
|
+
}
|
|
255
|
+
return n;
|
|
256
|
+
}
|
|
257
|
+
async function pe(e, n) {
|
|
258
|
+
let r = t.join(e, "packages/enums/src/app/index.ts"), a = await i.readFile(r, "utf-8").catch(() => null);
|
|
259
|
+
if (!a) return;
|
|
260
|
+
let o = n.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), s = a.replaceAll(`id: "${A}"`, `id: "${n}"`).replaceAll(`name: "${A}"`, `name: "${n}"`).replace(/name: "Hype Stack"/, `name: "${o}"`).replace(/description: ".*?"/, `description: "${o} application"`);
|
|
261
|
+
await i.writeFile(r, s, "utf-8");
|
|
262
|
+
}
|
|
263
|
+
async function me(e) {
|
|
264
|
+
let n = [], r = t.join(e, "package.json");
|
|
265
|
+
(await i.stat(r).catch(() => null))?.isFile() && n.push(r);
|
|
266
|
+
for (let r of [
|
|
267
|
+
"apps",
|
|
268
|
+
"packages",
|
|
269
|
+
"libs",
|
|
270
|
+
"shared"
|
|
271
|
+
]) {
|
|
272
|
+
let a = t.join(e, r), o = await i.readdir(a, { withFileTypes: !0 }).catch(() => []);
|
|
273
|
+
for (let e of o) {
|
|
274
|
+
if (!e.isDirectory()) continue;
|
|
275
|
+
let r = t.join(a, e.name, "package.json");
|
|
276
|
+
(await i.stat(r).catch(() => null))?.isFile() && n.push(r);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return n;
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/core/stack-config.ts
|
|
283
|
+
async function he(e) {
|
|
284
|
+
return x(t.join(e, l));
|
|
285
|
+
}
|
|
286
|
+
async function M(e) {
|
|
287
|
+
return b(t.join(e, l));
|
|
288
|
+
}
|
|
289
|
+
async function N(e, n) {
|
|
290
|
+
await S(t.join(e, l), n);
|
|
291
|
+
}
|
|
292
|
+
async function P(e) {
|
|
293
|
+
let n = t.join(e, "apps"), r = t.join(e, "packages"), [i, a] = await Promise.all([C(n), C(r)]);
|
|
294
|
+
return {
|
|
295
|
+
apps: i,
|
|
296
|
+
packages: a
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function F(e, t) {
|
|
300
|
+
return {
|
|
301
|
+
$schema: ne(),
|
|
302
|
+
version: 1,
|
|
303
|
+
name: e,
|
|
304
|
+
apps: t.apps,
|
|
305
|
+
packages: t.packages
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
async function I(e) {
|
|
309
|
+
let n = t.join(e, "package.json"), r = t.join(e, "apps"), [i, a] = await Promise.all([b(n), y(r)]);
|
|
310
|
+
return i && a;
|
|
311
|
+
}
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/ui/theme.ts
|
|
314
|
+
var L = (e) => `\x1b[38;5;208m${e}\x1b[39m`, R = (e) => `\x1b[38;5;214m${e}\x1b[39m`, z = (e) => `\x1b[38;5;220m${e}\x1b[39m`, B = (e) => `\x1b[38;5;33m${e}\x1b[39m`, V = (e) => `\x1b[38;5;39m${e}\x1b[39m`, H = (e) => `\x1b[38;5;81m${e}\x1b[39m`, U = {
|
|
315
|
+
orange: L,
|
|
316
|
+
orangeBright: R,
|
|
317
|
+
amber: z,
|
|
318
|
+
deepBlue: B,
|
|
319
|
+
skyBlue: V,
|
|
320
|
+
lightBlue: H
|
|
321
|
+
}, W = {
|
|
322
|
+
brand: (e) => L(e),
|
|
323
|
+
brandBold: (e) => o.bold(L(e)),
|
|
324
|
+
accent: (e) => V(e),
|
|
325
|
+
accentBold: (e) => o.bold(V(e)),
|
|
326
|
+
success: (e) => o.green(e),
|
|
327
|
+
error: (e) => o.red(e),
|
|
328
|
+
warning: (e) => o.yellow(e),
|
|
329
|
+
muted: (e) => o.dim(e),
|
|
330
|
+
bold: (e) => o.bold(e),
|
|
331
|
+
highlight: (e) => o.bold(o.white(e)),
|
|
332
|
+
path: (e) => o.underline(V(e)),
|
|
333
|
+
command: (e) => o.bold(z(e)),
|
|
334
|
+
label: (e) => o.dim(o.bold(e))
|
|
335
|
+
}, G = {
|
|
336
|
+
arrow: L("›"),
|
|
337
|
+
bullet: W.muted("·"),
|
|
338
|
+
dash: W.muted("─"),
|
|
339
|
+
corner: W.muted("╰"),
|
|
340
|
+
pipe: W.muted("│"),
|
|
341
|
+
dot: W.muted("•"),
|
|
342
|
+
spark: z("✦"),
|
|
343
|
+
sparkSmall: R("✧"),
|
|
344
|
+
bolt: z("⚡")
|
|
345
|
+
}, K = [
|
|
346
|
+
L,
|
|
347
|
+
L,
|
|
348
|
+
R,
|
|
349
|
+
z,
|
|
350
|
+
B,
|
|
351
|
+
V,
|
|
352
|
+
H,
|
|
353
|
+
H
|
|
354
|
+
];
|
|
355
|
+
function ge(e) {
|
|
356
|
+
let t = [...e], n = t.length;
|
|
357
|
+
return t.map((e, t) => {
|
|
358
|
+
if (e === " " || e === "\n") return e;
|
|
359
|
+
let r = t / Math.max(n - 1, 1);
|
|
360
|
+
return K[Math.min(Math.floor(r * K.length), K.length - 1)](e);
|
|
361
|
+
}).join("");
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/ui/banner.ts
|
|
365
|
+
var _e = [
|
|
366
|
+
" ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
|
|
367
|
+
" ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
|
|
368
|
+
" ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
|
|
369
|
+
" ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
|
|
370
|
+
" ██║ ██║ ██║ ██║ ███████╗",
|
|
371
|
+
" ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
|
|
372
|
+
], ve = [
|
|
373
|
+
" ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
|
|
374
|
+
" ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
|
|
375
|
+
" ███████╗ ██║ ███████║ ██║ █████╔╝ ",
|
|
376
|
+
" ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
|
|
377
|
+
" ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
|
|
378
|
+
" ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
|
|
379
|
+
];
|
|
380
|
+
function ye() {
|
|
381
|
+
console.log();
|
|
382
|
+
for (let e of _e) console.log(U.orange(e));
|
|
383
|
+
for (let e of ve) console.log(U.skyBlue(e));
|
|
384
|
+
console.log(), console.log(` ${G.spark} ${o.dim("v" + s)} ${o.dim("·")} ${ge("Ship web + desktop apps from one codebase")}`), console.log();
|
|
385
|
+
}
|
|
386
|
+
function q() {
|
|
387
|
+
console.log(), console.log(` ${G.bolt} ${U.orange("Hype")}${U.skyBlue("Stack")} ${o.dim("v" + s)}`), console.log();
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/ui/logger.ts
|
|
391
|
+
function be(e) {
|
|
392
|
+
n.note(e.map((e) => `${G.arrow} ${e}`).join("\n"), "Next steps");
|
|
393
|
+
}
|
|
394
|
+
function J() {
|
|
395
|
+
n.cancel(W.muted("Operation cancelled.")), process.exit(0);
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/utils/validate.ts
|
|
399
|
+
function Y(e) {
|
|
400
|
+
if (!e.trim()) return "Project name cannot be empty";
|
|
401
|
+
if (!p.test(e)) return "Project name must be lowercase, alphanumeric, and may contain hyphens, dots, or underscores";
|
|
402
|
+
if (e.length > 214) return "Project name is too long (max 214 characters)";
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/commands/create.ts
|
|
406
|
+
async function X(e) {
|
|
407
|
+
ye(), n.intro(W.brandBold("Create a new Hype Stack project"));
|
|
408
|
+
let r = await n.text({
|
|
409
|
+
message: "What is your project named?",
|
|
410
|
+
placeholder: "my-app",
|
|
411
|
+
initialValue: e.name ?? "",
|
|
412
|
+
validate: (e) => Y(e ?? "")
|
|
413
|
+
});
|
|
414
|
+
n.isCancel(r) && J();
|
|
415
|
+
let i = r, a = await n.text({
|
|
416
|
+
message: "Where should we create it?",
|
|
417
|
+
placeholder: `./${i}`,
|
|
418
|
+
initialValue: e.directory ?? `./${i}`
|
|
419
|
+
});
|
|
420
|
+
n.isCancel(a) && J();
|
|
421
|
+
let o = a, s = e.editor && h.includes(e.editor) ? e.editor : null, c;
|
|
422
|
+
if (s) c = s;
|
|
423
|
+
else {
|
|
424
|
+
let e = await n.select({
|
|
425
|
+
message: "Which code editor do you use?",
|
|
426
|
+
options: m.map((e) => ({
|
|
427
|
+
value: e.value,
|
|
428
|
+
label: e.label,
|
|
429
|
+
hint: "hint" in e ? e.hint : void 0
|
|
430
|
+
})),
|
|
431
|
+
initialValue: "cursor"
|
|
432
|
+
});
|
|
433
|
+
n.isCancel(e) && J(), c = e;
|
|
434
|
+
}
|
|
435
|
+
let l = m.find((e) => e.value === c)?.label ?? c, u = await n.confirm({ message: `Create ${W.highlight(i)} in ${W.path(o)} with ${W.highlight(l)} config?` });
|
|
436
|
+
(n.isCancel(u) || !u) && J();
|
|
437
|
+
let d = t.resolve(o);
|
|
438
|
+
if (await y(d) && !await ie(d)) {
|
|
439
|
+
let e = await n.confirm({
|
|
440
|
+
message: `Directory ${W.path(d)} is not empty. Continue anyway?`,
|
|
441
|
+
initialValue: !1
|
|
442
|
+
});
|
|
443
|
+
(n.isCancel(e) || !e) && J();
|
|
444
|
+
}
|
|
445
|
+
let f = n.spinner();
|
|
446
|
+
f.start("Cloning Hype Stack template..."), await re(d), f.stop(W.success("Template cloned"));
|
|
447
|
+
let p = n.spinner();
|
|
448
|
+
p.start("Setting up project..."), await le(d), await de(d, i), await ce(d, c), await N(d, F(i, await P(d))), p.stop(W.success("Project configured"));
|
|
449
|
+
let g = n.spinner();
|
|
450
|
+
g.start("Installing dependencies..."), (await O("pnpm", ["install"], { cwd: d })).exitCode === 0 ? g.stop(W.success("Dependencies installed")) : (g.stop(W.warning("Dependencies installed with warnings")), n.log.warn(W.muted("You may need to run `pnpm install` manually to resolve issues.")));
|
|
451
|
+
let _ = n.spinner();
|
|
452
|
+
_.start("Initializing git repository..."), await ue(d), _.stop(W.success("Git repository initialized with clean history")), n.log.success(`${W.brandBold("Hype Stack")} project ${W.highlight(i)} is ready!`);
|
|
453
|
+
let v = t.relative(process.cwd(), d) || ".";
|
|
454
|
+
be([
|
|
455
|
+
`${W.command(`cd ${v}`)}`,
|
|
456
|
+
`Copy ${W.path(".env.example")} to ${W.path(".env")} and configure`,
|
|
457
|
+
`${W.command("docker compose up -d")} ${W.muted("(start Postgres, Valkey, RustFS)")}`,
|
|
458
|
+
`${W.command("pnpm dev")} ${W.muted("(start frontend + backend)")}`
|
|
459
|
+
]), n.outro(W.muted("Happy building!"));
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/commands/init.ts
|
|
463
|
+
async function Z(e) {
|
|
464
|
+
let r = e.cwd ?? process.cwd(), i = e.silent ?? !1;
|
|
465
|
+
if (i || (q(), n.intro(W.brandBold("Initialize Hype Stack configuration"))), !await I(r)) {
|
|
466
|
+
n.log.error(`This doesn't look like a Hype Stack project. ${W.muted("Expected apps/ directory and package.json")}`), n.outro(W.muted(`Run ${W.command("hype-stack create")} to scaffold a new project.`));
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
if (await M(r)) {
|
|
470
|
+
let e = await he(r);
|
|
471
|
+
if (e && !i) {
|
|
472
|
+
n.log.info(`Found existing ${W.path("stack.json")} for project ${W.highlight(e.name)}`);
|
|
473
|
+
let t = await n.confirm({
|
|
474
|
+
message: "Overwrite existing configuration?",
|
|
475
|
+
initialValue: !1
|
|
476
|
+
});
|
|
477
|
+
if (n.isCancel(t) || !t) {
|
|
478
|
+
n.outro(W.muted("Keeping existing configuration."));
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
let a = await P(r);
|
|
484
|
+
if (!i) {
|
|
485
|
+
let e = Object.entries(a.apps), t = Object.entries(a.packages);
|
|
486
|
+
if (e.length > 0) {
|
|
487
|
+
n.log.info(W.bold("Detected apps:"));
|
|
488
|
+
for (let [t, r] of e) n.log.message(` ${G.arrow} ${W.highlight(t)} ${W.muted(`→ ${r}`)}`);
|
|
489
|
+
}
|
|
490
|
+
if (t.length > 0) {
|
|
491
|
+
n.log.info(W.bold("Detected packages:"));
|
|
492
|
+
for (let [e, r] of t) n.log.message(` ${G.arrow} ${W.highlight(e)} ${W.muted(`→ ${r}`)}`);
|
|
493
|
+
}
|
|
494
|
+
e.length === 0 && t.length === 0 && n.log.warn("No apps or packages detected in the workspace.");
|
|
495
|
+
}
|
|
496
|
+
let o = (await x(t.join(r, "package.json")))?.name?.replace(/^@/, "").replace(/\/source$/, "") ?? "my-app", s = o;
|
|
497
|
+
if (!i) {
|
|
498
|
+
let e = await n.text({
|
|
499
|
+
message: "Project name for stack.json?",
|
|
500
|
+
placeholder: o,
|
|
501
|
+
initialValue: o
|
|
502
|
+
});
|
|
503
|
+
n.isCancel(e) && J(), s = e;
|
|
504
|
+
}
|
|
505
|
+
await N(r, F(s, a)), i || (n.log.success(`${W.path("stack.json")} written successfully`), n.outro(W.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
|
|
506
|
+
}
|
|
507
|
+
async function Q(e) {
|
|
508
|
+
await M(e) || (n.log.warn(`No ${W.path("stack.json")} found. Let's set one up first.`), await Z({
|
|
509
|
+
cwd: e,
|
|
510
|
+
silent: !1
|
|
511
|
+
}));
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/commands/add.ts
|
|
515
|
+
async function $(e, t) {
|
|
516
|
+
let r = process.cwd();
|
|
517
|
+
q(), await Q(r), n.intro(W.brandBold("Add to your project"));
|
|
518
|
+
let i = e && t ? `${e} "${t}"` : e ?? "content";
|
|
519
|
+
n.note([
|
|
520
|
+
`Adding ${W.highlight(i)} is ${W.accentBold("coming soon")}.`,
|
|
521
|
+
"",
|
|
522
|
+
"Planned content types:",
|
|
523
|
+
` ${W.brand("component")} ${W.muted("Reusable UI pieces")}`,
|
|
524
|
+
` ${W.brand("module")} ${W.muted("Full feature bundles (backend + frontend)")}`,
|
|
525
|
+
` ${W.brand("layout")} ${W.muted("Page-level structures")}`,
|
|
526
|
+
"",
|
|
527
|
+
`Follow ${W.path("https://github.com/BetterTyped/hype-stack")} for updates.`
|
|
528
|
+
].join("\n"), "Coming Soon"), n.outro(W.muted("Stay tuned!"));
|
|
529
|
+
}
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/cli.ts
|
|
532
|
+
function xe() {
|
|
533
|
+
let t = new e();
|
|
534
|
+
return t.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(s, "-v, --version"), t.command("create").description("Create a new Hype Stack project").option("-n, --name <name>", "Project name").option("-d, --directory <path>", "Target directory").option("-e, --editor <editor>", "Code editor (cursor, claude, windsurf, copilot)").option("--no-install", "Skip dependency installation").action(async (e) => {
|
|
535
|
+
await X({
|
|
536
|
+
name: e.name,
|
|
537
|
+
directory: e.directory,
|
|
538
|
+
install: e.install,
|
|
539
|
+
editor: e.editor
|
|
540
|
+
});
|
|
541
|
+
}), t.command("init").description("Initialize stack.json in the current project").action(async () => {
|
|
542
|
+
await Z({});
|
|
543
|
+
}), t.command("add").description("Add a component, module, or layout to your project").argument("[type]", "Type of content (component, module, layout)").argument("[name]", "Name of the content to add").action(async (e, t) => {
|
|
544
|
+
await $(e, t);
|
|
545
|
+
}), t;
|
|
546
|
+
}
|
|
547
|
+
//#endregion
|
|
548
|
+
export { X as a, Z as i, $ as n, Q as r, xe as t };
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,aAAa,IAAI,OAAO,CAyCvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAKA,wBAAsB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,aAAa,CAAC;AAa7D,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA8HzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAmB/C,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA8FrE;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ3D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const VERSION = "0.0.1";
|
|
2
|
+
export declare const TEMPLATE_REPO = "gh:BetterTyped/hype-stack";
|
|
3
|
+
export declare const STACK_CONFIG_FILE = "stack.json";
|
|
4
|
+
export declare const SCHEMA_PATH = "/schema/stack.json";
|
|
5
|
+
export declare const DEFAULT_API_URL = "https://hypestack.dev";
|
|
6
|
+
export declare const API_URL_ENV_KEY = "HYPE_STACK_API_URL";
|
|
7
|
+
export declare const STACK_CONFIG_VERSION = 1;
|
|
8
|
+
export declare const PROJECT_NAME_REGEX: RegExp;
|
|
9
|
+
export declare const EDITOR_CHOICES: readonly [{
|
|
10
|
+
readonly value: "cursor";
|
|
11
|
+
readonly label: "Cursor";
|
|
12
|
+
readonly hint: "default";
|
|
13
|
+
}, {
|
|
14
|
+
readonly value: "claude";
|
|
15
|
+
readonly label: "Claude Code";
|
|
16
|
+
}, {
|
|
17
|
+
readonly value: "windsurf";
|
|
18
|
+
readonly label: "Windsurf";
|
|
19
|
+
}, {
|
|
20
|
+
readonly value: "copilot";
|
|
21
|
+
readonly label: "GitHub Copilot";
|
|
22
|
+
}];
|
|
23
|
+
export declare const VALID_EDITORS: ("cursor" | "claude" | "windsurf" | "copilot")[];
|
|
24
|
+
export declare const CURSOR_RULES_DIR = ".cursor/rules";
|
|
25
|
+
export declare const CURSOR_DIR = ".cursor";
|
|
26
|
+
export declare const AGENTS_DIR = ".agents";
|
|
27
|
+
export declare function getApiUrl(): string;
|
|
28
|
+
export declare function validateApiUrl(url: string): void;
|
|
29
|
+
export declare function getSchemaUrl(): string;
|
|
30
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,eAAO,MAAM,aAAa,8BAA8B,CAAC;AAEzD,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAE9C,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAEhD,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,eAAO,MAAM,eAAe,uBAAuB,CAAC;AAEpD,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,kBAAkB,QAAwC,CAAC;AAExE,eAAO,MAAM,cAAc;;;;;;;;;;;;;EAKjB,CAAC;AAEX,eAAO,MAAM,aAAa,kDAAqC,CAAC;AAEhE,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAChD,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,UAAU,YAAY,CAAC;AAEpC,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAYhD;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/core/clone.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAU3E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CodeEditor } from '../types.js';
|
|
2
|
+
interface MdcFrontmatter {
|
|
3
|
+
description?: string;
|
|
4
|
+
globs: string[];
|
|
5
|
+
alwaysApply: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseMdcFrontmatter(raw: string): {
|
|
8
|
+
frontmatter: MdcFrontmatter;
|
|
9
|
+
content: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function convertEditorConfig(projectDir: string, editor: CodeEditor): Promise<void>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=editor-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-config.d.ts","sourceRoot":"","sources":["../../src/core/editor-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAcD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,WAAW,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA2CjG;AAqFD,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB/F"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function cleanGitDirectory(projectDir: string): Promise<void>;
|
|
2
|
+
export declare function initGitRepo(projectDir: string): Promise<void>;
|
|
3
|
+
export declare function updateProjectName(projectDir: string, name: string): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=post-clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-clone.d.ts","sourceRoot":"","sources":["../../src/core/post-clone.ts"],"names":[],"mappings":"AAuBA,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnE;AAED,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCvF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DetectedWorkspace, StackConfig } from '../types.js';
|
|
2
|
+
export declare function loadStackConfig(cwd: string): Promise<StackConfig | null>;
|
|
3
|
+
export declare function hasStackConfig(cwd: string): Promise<boolean>;
|
|
4
|
+
export declare function writeStackConfig(cwd: string, config: StackConfig): Promise<void>;
|
|
5
|
+
export declare function detectWorkspace(cwd: string): Promise<DetectedWorkspace>;
|
|
6
|
+
export declare function createStackConfig(name: string, workspace: DetectedWorkspace): StackConfig;
|
|
7
|
+
export declare function ensureStackConfig(cwd: string): Promise<StackConfig | null>;
|
|
8
|
+
export declare function isHypeStackProject(cwd: string): Promise<boolean>;
|
|
9
|
+
//# sourceMappingURL=stack-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-config.d.ts","sourceRoot":"","sources":["../../src/core/stack-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGlE,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAG9E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGlE;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtF;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAO7E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,WAAW,CAQzF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAMhF;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOtE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createProgram } from './cli.js';
|
|
2
|
+
export { createCommand } from './commands/create.js';
|
|
3
|
+
export { initCommand, ensureInit } from './commands/init.js';
|
|
4
|
+
export { addCommand } from './commands/add.js';
|
|
5
|
+
export type { StackConfig, CreateOptions, InitOptions, DetectedWorkspace, CodeEditor } from './types.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type CodeEditor = "cursor" | "claude" | "windsurf" | "copilot";
|
|
2
|
+
export interface StackConfig {
|
|
3
|
+
$schema?: string;
|
|
4
|
+
version: number;
|
|
5
|
+
name: string;
|
|
6
|
+
apps: Record<string, string>;
|
|
7
|
+
packages: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateOptions {
|
|
10
|
+
name?: string;
|
|
11
|
+
directory?: string;
|
|
12
|
+
install?: boolean;
|
|
13
|
+
editor?: CodeEditor;
|
|
14
|
+
}
|
|
15
|
+
export interface InitOptions {
|
|
16
|
+
cwd?: string;
|
|
17
|
+
silent?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface DetectedWorkspace {
|
|
20
|
+
apps: Record<string, string>;
|
|
21
|
+
packages: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAEtE,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/ui/banner.ts"],"names":[],"mappings":"AAuBA,wBAAgB,WAAW,IAAI,IAAI,CAelC;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAMzC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function info(message: string): void;
|
|
2
|
+
export declare function success(message: string): void;
|
|
3
|
+
export declare function warn(message: string): void;
|
|
4
|
+
export declare function error(message: string): void;
|
|
5
|
+
export declare function step(message: string): void;
|
|
6
|
+
export declare function detail(label: string, value: string): void;
|
|
7
|
+
export declare function nextSteps(steps: string[]): void;
|
|
8
|
+
export declare function handleCancel(): never;
|
|
9
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/ui/logger.ts"],"names":[],"mappings":"AAGA,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAE/C;AAED,wBAAgB,YAAY,IAAI,KAAK,CAGpC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const brand: {
|
|
2
|
+
orange: (text: string) => string;
|
|
3
|
+
orangeBright: (text: string) => string;
|
|
4
|
+
amber: (text: string) => string;
|
|
5
|
+
deepBlue: (text: string) => string;
|
|
6
|
+
skyBlue: (text: string) => string;
|
|
7
|
+
lightBlue: (text: string) => string;
|
|
8
|
+
};
|
|
9
|
+
export declare const colors: {
|
|
10
|
+
brand: (text: string) => string;
|
|
11
|
+
brandBold: (text: string) => string;
|
|
12
|
+
accent: (text: string) => string;
|
|
13
|
+
accentBold: (text: string) => string;
|
|
14
|
+
success: (text: string) => string;
|
|
15
|
+
error: (text: string) => string;
|
|
16
|
+
warning: (text: string) => string;
|
|
17
|
+
muted: (text: string) => string;
|
|
18
|
+
bold: (text: string) => string;
|
|
19
|
+
highlight: (text: string) => string;
|
|
20
|
+
path: (text: string) => string;
|
|
21
|
+
command: (text: string) => string;
|
|
22
|
+
label: (text: string) => string;
|
|
23
|
+
};
|
|
24
|
+
export declare const symbols: {
|
|
25
|
+
arrow: string;
|
|
26
|
+
bullet: string;
|
|
27
|
+
dash: string;
|
|
28
|
+
corner: string;
|
|
29
|
+
pipe: string;
|
|
30
|
+
dot: string;
|
|
31
|
+
spark: string;
|
|
32
|
+
sparkSmall: string;
|
|
33
|
+
bolt: string;
|
|
34
|
+
};
|
|
35
|
+
export declare function gradient(text: string): string;
|
|
36
|
+
export declare function gradientVertical(lines: string[], topColor: (s: string) => string, bottomColor: (s: string) => string): string[];
|
|
37
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/ui/theme.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,KAAK;mBAPI,MAAM;yBACA,MAAM;kBACb,MAAM;qBACH,MAAM;oBACP,MAAM;sBACJ,MAAM;CAEmD,CAAC;AAEnF,eAAO,MAAM,MAAM;kBACH,MAAM;sBACF,MAAM;mBACT,MAAM;uBACF,MAAM;oBACT,MAAM;kBACR,MAAM;oBACJ,MAAM;kBACR,MAAM;iBACP,MAAM;sBACD,MAAM;iBACX,MAAM;oBACH,MAAM;kBACR,MAAM;CACrB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;CAUnB,CAAC;AAIF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY7C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,EAAE,CAS/H"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ExecResult {
|
|
2
|
+
exitCode: number;
|
|
3
|
+
stdout: string;
|
|
4
|
+
stderr: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function exec(command: string, args: string[], options: {
|
|
7
|
+
cwd: string;
|
|
8
|
+
onData?: (line: string) => void;
|
|
9
|
+
}): Promise<ExecResult>;
|
|
10
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,IAAI,CAClB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;IACP,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,GACA,OAAO,CAAC,UAAU,CAAC,CAsCrB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function directoryExists(dir: string): Promise<boolean>;
|
|
2
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
3
|
+
export declare function isDirectoryEmpty(dir: string): Promise<boolean>;
|
|
4
|
+
export declare function readJson<T>(filePath: string): Promise<T | null>;
|
|
5
|
+
export declare function writeJson(filePath: string, data: unknown): Promise<void>;
|
|
6
|
+
export declare function findPackageJsonDirs(baseDir: string): Promise<Record<string, string>>;
|
|
7
|
+
export declare function removeDirectory(dir: string): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAGA,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGnE;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGnE;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGpE;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAIrE;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9E;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAoB1F;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAcpE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hype-stack/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"bin": {
|
|
11
|
+
"hype-stack": "./dist/bin.js"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/BetterTyped/hype-stack-internal.git",
|
|
16
|
+
"directory": "packages/cli"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "vite build",
|
|
23
|
+
"dev": "vite build --watch",
|
|
24
|
+
"format": "pnpm --dir ../.. exec oxfmt --write packages/cli",
|
|
25
|
+
"typecheck": "pnpm --dir ../.. exec tsgo -p packages/cli/tsconfig.json --noEmit",
|
|
26
|
+
"lint": "pnpm --dir ../.. exec oxlint --fix packages/cli"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@clack/prompts": "^1.2.0",
|
|
30
|
+
"commander": "^13.0.0",
|
|
31
|
+
"giget": "^3.2.0",
|
|
32
|
+
"picocolors": "^1.1.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^25.6.0"
|
|
36
|
+
}
|
|
37
|
+
}
|