@remix-run/cli 0.1.0 → 0.2.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 +0 -3
- package/bootstrap/.agents/skills/remix/SKILL.md +501 -0
- package/bootstrap/.agents/skills/remix/references/animate-elements.md +195 -0
- package/bootstrap/.agents/skills/remix/references/assets-and-browser-modules.md +122 -0
- package/bootstrap/.agents/skills/remix/references/auth-and-sessions.md +420 -0
- package/bootstrap/.agents/skills/remix/references/component-model.md +282 -0
- package/bootstrap/.agents/skills/remix/references/create-mixins.md +158 -0
- package/bootstrap/.agents/skills/remix/references/data-and-validation.md +363 -0
- package/bootstrap/.agents/skills/remix/references/hydration-frames-navigation.md +297 -0
- package/bootstrap/.agents/skills/remix/references/middleware-and-server.md +243 -0
- package/bootstrap/.agents/skills/remix/references/mixins-styling-events.md +213 -0
- package/bootstrap/.agents/skills/remix/references/routing-and-controllers.md +324 -0
- package/bootstrap/.agents/skills/remix/references/testing-patterns.md +156 -0
- package/bootstrap/AGENTS.md +4 -0
- package/bootstrap/app/assets/entry.ts +19 -0
- package/bootstrap/app/assets.ts +18 -0
- package/bootstrap/app/controllers/auth.tsx +2 -2
- package/bootstrap/app/controllers/home.tsx +3 -18
- package/bootstrap/app/router.ts +6 -0
- package/bootstrap/app/routes.ts +2 -1
- package/bootstrap/app/ui/document.tsx +6 -1
- package/bootstrap/app/ui/prompt-button.tsx +162 -0
- package/bootstrap/app/ui/scaffold-home-page.tsx +526 -0
- package/bootstrap/app/utils/render.tsx +22 -3
- package/bootstrap/server.ts +13 -13
- package/bootstrap/tsconfig.json +0 -1
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +7 -10
- package/dist/lib/commands/help.d.ts.map +1 -1
- package/dist/lib/commands/help.js +9 -33
- package/dist/lib/commands/test.d.ts +1 -1
- package/dist/lib/commands/test.d.ts.map +1 -1
- package/dist/lib/commands/test.js +8 -4
- package/dist/lib/completion.d.ts.map +1 -1
- package/dist/lib/completion.js +3 -101
- package/dist/lib/errors.d.ts +0 -6
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +0 -11
- package/package.json +3 -4
- package/src/lib/cli.ts +7 -11
- package/src/lib/commands/help.ts +9 -43
- package/src/lib/commands/test.ts +10 -4
- package/src/lib/completion.ts +3 -146
- package/src/lib/errors.ts +0 -12
- package/dist/lib/commands/skills.d.ts +0 -6
- package/dist/lib/commands/skills.d.ts.map +0 -1
- package/dist/lib/commands/skills.js +0 -222
- package/dist/lib/skills-cache.d.ts +0 -19
- package/dist/lib/skills-cache.d.ts.map +0 -1
- package/dist/lib/skills-cache.js +0 -89
- package/dist/lib/skills.d.ts +0 -30
- package/dist/lib/skills.d.ts.map +0 -1
- package/dist/lib/skills.js +0 -441
- package/src/lib/commands/skills.ts +0 -306
- package/src/lib/skills-cache.ts +0 -140
- package/src/lib/skills.ts +0 -706
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import * as process from 'node:process';
|
|
2
|
-
import { getCompletionCommandHelpText } from "./completion.js";
|
|
3
2
|
import { renderCliError, toCliError, unknownHelpTopic } from "../errors.js";
|
|
4
3
|
import { formatHelpText } from "../help-text.js";
|
|
5
|
-
import { getDoctorCommandHelpText } from "./doctor.js";
|
|
6
|
-
import { getNewCommandHelpText } from "./new.js";
|
|
7
|
-
import { getRoutesCommandHelpText } from "./routes.js";
|
|
8
|
-
import { getSkillsCommandHelpText, getSkillsInstallCommandHelpText, getSkillsListCommandHelpText, } from "./skills.js";
|
|
9
|
-
import { getTestCommandHelpText } from "./test.js";
|
|
10
|
-
import { getVersionCommandHelpText } from "./version.js";
|
|
11
4
|
export async function runHelpCommand(argv) {
|
|
12
5
|
if (argv.includes('-h') || argv.includes('--help')) {
|
|
13
6
|
process.stdout.write(getHelpCommandHelpText());
|
|
14
7
|
return 0;
|
|
15
8
|
}
|
|
16
9
|
try {
|
|
17
|
-
process.stdout.write(getCommandHelpText(argv));
|
|
10
|
+
process.stdout.write(await getCommandHelpText(argv));
|
|
18
11
|
return 0;
|
|
19
12
|
}
|
|
20
13
|
catch (error) {
|
|
@@ -30,7 +23,6 @@ export function getCliHelpText(target = process.stdout) {
|
|
|
30
23
|
{ description: 'Create a new Remix project', label: 'new <name>' },
|
|
31
24
|
{ description: 'Check project health for the current project', label: 'doctor' },
|
|
32
25
|
{ description: 'Show the route tree for the current project', label: 'routes' },
|
|
33
|
-
{ description: 'Manage Remix skills for the current project', label: 'skills' },
|
|
34
26
|
{ description: 'Run tests for the current project', label: 'test [glob]' },
|
|
35
27
|
{ description: 'Show the current Remix version', label: 'version' },
|
|
36
28
|
],
|
|
@@ -39,12 +31,10 @@ export function getCliHelpText(target = process.stdout) {
|
|
|
39
31
|
'remix help',
|
|
40
32
|
'remix help completion',
|
|
41
33
|
'remix help doctor',
|
|
42
|
-
'remix help skills install',
|
|
43
34
|
'remix doctor',
|
|
44
35
|
'remix new my-remix-app',
|
|
45
36
|
'remix new my-remix-app --app-name "My Remix App"',
|
|
46
37
|
'remix routes',
|
|
47
|
-
'remix skills install',
|
|
48
38
|
'remix test',
|
|
49
39
|
'remix version',
|
|
50
40
|
],
|
|
@@ -65,14 +55,13 @@ export function getHelpCommandHelpText(target = process.stdout) {
|
|
|
65
55
|
'remix help doctor',
|
|
66
56
|
'remix help new',
|
|
67
57
|
'remix help routes',
|
|
68
|
-
'remix help skills install',
|
|
69
58
|
'remix help test',
|
|
70
59
|
'remix help version',
|
|
71
60
|
],
|
|
72
61
|
usage: ['remix help [command]'],
|
|
73
62
|
}, target);
|
|
74
63
|
}
|
|
75
|
-
function getCommandHelpText(argv) {
|
|
64
|
+
async function getCommandHelpText(argv) {
|
|
76
65
|
if (argv.length === 0) {
|
|
77
66
|
return getCliHelpText();
|
|
78
67
|
}
|
|
@@ -81,24 +70,27 @@ function getCommandHelpText(argv) {
|
|
|
81
70
|
return rest.length === 0 ? getHelpCommandHelpText() : getNestedHelpText(command, rest);
|
|
82
71
|
}
|
|
83
72
|
if (command === 'new' && rest.length === 0) {
|
|
73
|
+
let { getNewCommandHelpText } = await import("./new.js");
|
|
84
74
|
return getNewCommandHelpText();
|
|
85
75
|
}
|
|
86
76
|
if (command === 'completion' && rest.length === 0) {
|
|
77
|
+
let { getCompletionCommandHelpText } = await import("./completion.js");
|
|
87
78
|
return getCompletionCommandHelpText();
|
|
88
79
|
}
|
|
89
80
|
if (command === 'doctor' && rest.length === 0) {
|
|
81
|
+
let { getDoctorCommandHelpText } = await import("./doctor.js");
|
|
90
82
|
return getDoctorCommandHelpText();
|
|
91
83
|
}
|
|
92
84
|
if (command === 'routes' && rest.length === 0) {
|
|
85
|
+
let { getRoutesCommandHelpText } = await import("./routes.js");
|
|
93
86
|
return getRoutesCommandHelpText();
|
|
94
87
|
}
|
|
95
|
-
if (command === 'skills') {
|
|
96
|
-
return getSkillsHelpText(rest);
|
|
97
|
-
}
|
|
98
88
|
if (command === 'test' && rest.length === 0) {
|
|
99
|
-
|
|
89
|
+
let { getTestCommandHelpText } = await import("./test.js");
|
|
90
|
+
return await getTestCommandHelpText();
|
|
100
91
|
}
|
|
101
92
|
if (command === 'version' && rest.length === 0) {
|
|
93
|
+
let { getVersionCommandHelpText } = await import("./version.js");
|
|
102
94
|
return getVersionCommandHelpText();
|
|
103
95
|
}
|
|
104
96
|
throw unknownHelpTopic(argv.join(' '));
|
|
@@ -106,19 +98,3 @@ function getCommandHelpText(argv) {
|
|
|
106
98
|
function getNestedHelpText(command, argv) {
|
|
107
99
|
throw unknownHelpTopic(`${command} ${argv.join(' ')}`);
|
|
108
100
|
}
|
|
109
|
-
function getSkillsHelpText(argv) {
|
|
110
|
-
if (argv.length === 0) {
|
|
111
|
-
return getSkillsCommandHelpText();
|
|
112
|
-
}
|
|
113
|
-
let [subcommand, ...rest] = argv;
|
|
114
|
-
if (rest.length > 0) {
|
|
115
|
-
throw unknownHelpTopic(`skills ${argv.join(' ')}`);
|
|
116
|
-
}
|
|
117
|
-
if (subcommand === 'install') {
|
|
118
|
-
return getSkillsInstallCommandHelpText();
|
|
119
|
-
}
|
|
120
|
-
if (subcommand === 'list') {
|
|
121
|
-
return getSkillsListCommandHelpText();
|
|
122
|
-
}
|
|
123
|
-
throw unknownHelpTopic(`skills ${argv.join(' ')}`);
|
|
124
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CliContext } from '../cli-context.ts';
|
|
2
2
|
export declare function runTestCommand(argv: string[], context: CliContext): Promise<number>;
|
|
3
|
-
export declare function getTestCommandHelpText(target?: NodeJS.WriteStream): string
|
|
3
|
+
export declare function getTestCommandHelpText(target?: NodeJS.WriteStream): Promise<string>;
|
|
4
4
|
//# sourceMappingURL=test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/test.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBzF;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,GAAE,MAAM,CAAC,WAA4B,GAC1C,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { getRemixTestHelpText, runRemixTest } from '@remix-run/test/cli';
|
|
2
1
|
import * as process from 'node:process';
|
|
3
2
|
import { renderCliError, toCliError } from "../errors.js";
|
|
4
3
|
export async function runTestCommand(argv, context) {
|
|
5
4
|
if (argv.includes('-h') || argv.includes('--help')) {
|
|
6
|
-
process.stdout.write(`${getTestCommandHelpText()}\n`);
|
|
5
|
+
process.stdout.write(`${await getTestCommandHelpText()}\n`);
|
|
7
6
|
return 0;
|
|
8
7
|
}
|
|
9
8
|
try {
|
|
9
|
+
let { runRemixTest } = await import('@remix-run/test/cli');
|
|
10
10
|
return await runRemixTest({ argv, cwd: context.cwd });
|
|
11
11
|
}
|
|
12
12
|
catch (error) {
|
|
13
|
-
|
|
13
|
+
let helpText = await getTestCommandHelpText(process.stderr);
|
|
14
|
+
process.stderr.write(renderCliError(toCliError(error), {
|
|
15
|
+
helpText,
|
|
16
|
+
}));
|
|
14
17
|
return 1;
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
|
-
export function getTestCommandHelpText(target = process.stdout) {
|
|
20
|
+
export async function getTestCommandHelpText(target = process.stdout) {
|
|
21
|
+
let { getRemixTestHelpText } = await import('@remix-run/test/cli');
|
|
18
22
|
return getRemixTestHelpText(target);
|
|
19
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/lib/completion.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACjC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,QAAA,MAAM,iBAAiB,0BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/lib/completion.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACjC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,QAAA,MAAM,iBAAiB,0BAA2B,CAAA;AAIlD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEhE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAM3F;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAQvE;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CA4E5C"}
|
package/dist/lib/completion.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
const COMPLETION_SHELLS = ['bash', 'zsh'];
|
|
2
|
-
const HELP_COMMANDS = [
|
|
3
|
-
|
|
4
|
-
'doctor',
|
|
5
|
-
'help',
|
|
6
|
-
'new',
|
|
7
|
-
'routes',
|
|
8
|
-
'skills',
|
|
9
|
-
'test',
|
|
10
|
-
'version',
|
|
11
|
-
];
|
|
12
|
-
const ROOT_COMMANDS = [
|
|
13
|
-
'completion',
|
|
14
|
-
'doctor',
|
|
15
|
-
'help',
|
|
16
|
-
'new',
|
|
17
|
-
'routes',
|
|
18
|
-
'skills',
|
|
19
|
-
'test',
|
|
20
|
-
'version',
|
|
21
|
-
];
|
|
22
|
-
const SKILLS_COMMANDS = ['install', 'list'];
|
|
2
|
+
const HELP_COMMANDS = ['completion', 'doctor', 'help', 'new', 'routes', 'test', 'version'];
|
|
3
|
+
const ROOT_COMMANDS = ['completion', 'doctor', 'help', 'new', 'routes', 'test', 'version'];
|
|
23
4
|
export function isCompletionShell(value) {
|
|
24
5
|
return COMPLETION_SHELLS.includes(value);
|
|
25
6
|
}
|
|
@@ -152,9 +133,6 @@ function completeCommand(command, tokens, currentWord, usedGlobalFlags) {
|
|
|
152
133
|
if (command === 'routes') {
|
|
153
134
|
return completeRoutes(tokens, currentWord, usedGlobalFlags);
|
|
154
135
|
}
|
|
155
|
-
if (command === 'skills') {
|
|
156
|
-
return completeSkills(tokens, currentWord, usedGlobalFlags);
|
|
157
|
-
}
|
|
158
136
|
if (command === 'version') {
|
|
159
137
|
return completeSimpleFlags(tokens, currentWord, usedGlobalFlags, []);
|
|
160
138
|
}
|
|
@@ -178,11 +156,8 @@ function completeHelp(tokens, currentWord, usedGlobalFlags) {
|
|
|
178
156
|
if (filteredTokens.length === 0) {
|
|
179
157
|
return completeValues(withHelpFlags([...HELP_COMMANDS], usedGlobalFlags), currentWord);
|
|
180
158
|
}
|
|
181
|
-
let [
|
|
159
|
+
let [, ...rest] = filteredTokens;
|
|
182
160
|
if (rest.length === 0) {
|
|
183
|
-
if (topic === 'skills') {
|
|
184
|
-
return completeValues(withHelpFlags([...SKILLS_COMMANDS], usedGlobalFlags), currentWord);
|
|
185
|
-
}
|
|
186
161
|
return completeValues([], currentWord);
|
|
187
162
|
}
|
|
188
163
|
return completeValues([], currentWord);
|
|
@@ -264,79 +239,6 @@ function completeRoutes(tokens, currentWord, usedGlobalFlags) {
|
|
|
264
239
|
], usedGlobalFlags);
|
|
265
240
|
return completeValues(flags, currentWord);
|
|
266
241
|
}
|
|
267
|
-
function completeSkills(tokens, currentWord, usedGlobalFlags) {
|
|
268
|
-
let filteredTokens = filterGlobalCommandTokens(tokens, usedGlobalFlags);
|
|
269
|
-
if (filteredTokens == null) {
|
|
270
|
-
return completeValues([], currentWord);
|
|
271
|
-
}
|
|
272
|
-
if (filteredTokens.length === 0) {
|
|
273
|
-
return completeValues(withHelpFlags([...SKILLS_COMMANDS], usedGlobalFlags), currentWord);
|
|
274
|
-
}
|
|
275
|
-
let [subcommand, ...rest] = filteredTokens;
|
|
276
|
-
if (subcommand === 'install') {
|
|
277
|
-
return completeSkillsInstall(rest, currentWord, usedGlobalFlags);
|
|
278
|
-
}
|
|
279
|
-
if (subcommand === 'list') {
|
|
280
|
-
return completeSkillsList(rest, currentWord, usedGlobalFlags);
|
|
281
|
-
}
|
|
282
|
-
return completeValues([], currentWord);
|
|
283
|
-
}
|
|
284
|
-
function completeSkillsInstall(tokens, currentWord, usedGlobalFlags) {
|
|
285
|
-
let filteredTokens = filterGlobalCommandTokens(tokens, usedGlobalFlags);
|
|
286
|
-
if (filteredTokens == null) {
|
|
287
|
-
return completeValues([], currentWord);
|
|
288
|
-
}
|
|
289
|
-
let hasDir = false;
|
|
290
|
-
let expectsDir = false;
|
|
291
|
-
for (let token of filteredTokens) {
|
|
292
|
-
if (expectsDir) {
|
|
293
|
-
expectsDir = false;
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
if (token === '--dir') {
|
|
297
|
-
hasDir = true;
|
|
298
|
-
expectsDir = true;
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
return completeValues([], currentWord);
|
|
302
|
-
}
|
|
303
|
-
if (expectsDir) {
|
|
304
|
-
return { mode: 'files' };
|
|
305
|
-
}
|
|
306
|
-
return completeValues(withHelpFlags(!hasDir ? ['--dir'] : [], usedGlobalFlags), currentWord);
|
|
307
|
-
}
|
|
308
|
-
function completeSkillsList(tokens, currentWord, usedGlobalFlags) {
|
|
309
|
-
return completeSkillsDirectoryCommand(tokens, currentWord, usedGlobalFlags);
|
|
310
|
-
}
|
|
311
|
-
function completeSkillsDirectoryCommand(tokens, currentWord, usedGlobalFlags) {
|
|
312
|
-
let filteredTokens = filterGlobalCommandTokens(tokens, usedGlobalFlags);
|
|
313
|
-
if (filteredTokens == null) {
|
|
314
|
-
return completeValues([], currentWord);
|
|
315
|
-
}
|
|
316
|
-
let hasDir = false;
|
|
317
|
-
let hasJson = false;
|
|
318
|
-
let expectsDir = false;
|
|
319
|
-
for (let token of filteredTokens) {
|
|
320
|
-
if (expectsDir) {
|
|
321
|
-
expectsDir = false;
|
|
322
|
-
continue;
|
|
323
|
-
}
|
|
324
|
-
if (token === '--dir') {
|
|
325
|
-
hasDir = true;
|
|
326
|
-
expectsDir = true;
|
|
327
|
-
continue;
|
|
328
|
-
}
|
|
329
|
-
if (token === '--json') {
|
|
330
|
-
hasJson = true;
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
|
-
return completeValues([], currentWord);
|
|
334
|
-
}
|
|
335
|
-
if (expectsDir) {
|
|
336
|
-
return { mode: 'files' };
|
|
337
|
-
}
|
|
338
|
-
return completeValues(withHelpFlags([...(!hasDir ? ['--dir'] : []), ...(!hasJson ? ['--json'] : [])], usedGlobalFlags), currentWord);
|
|
339
|
-
}
|
|
340
242
|
function completeCompletionCommand(tokens, currentWord, usedGlobalFlags) {
|
|
341
243
|
let filteredTokens = filterGlobalCommandTokens(tokens, usedGlobalFlags);
|
|
342
244
|
if (filteredTokens == null) {
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -125,11 +125,6 @@ export declare const CLI_ERROR_DEFINITIONS: {
|
|
|
125
125
|
title: string;
|
|
126
126
|
fix: string;
|
|
127
127
|
};
|
|
128
|
-
unknownSkillsCommand: {
|
|
129
|
-
code: string;
|
|
130
|
-
title: string;
|
|
131
|
-
fix: string;
|
|
132
|
-
};
|
|
133
128
|
};
|
|
134
129
|
export declare class CliError extends Error {
|
|
135
130
|
code: string;
|
|
@@ -165,7 +160,6 @@ export declare function unknownArgument(argument: string): UsageError;
|
|
|
165
160
|
export declare function unknownCommand(command: string): UsageError;
|
|
166
161
|
export declare function unknownCompletionShell(shell: string): UsageError;
|
|
167
162
|
export declare function unknownHelpTopic(topic: string): UsageError;
|
|
168
|
-
export declare function unknownSkillsCommand(command: string): UsageError;
|
|
169
163
|
export declare function unexpectedExtraArgument(argument: string): UsageError;
|
|
170
164
|
export declare function renderCliError(error: unknown, options?: {
|
|
171
165
|
helpText?: string;
|
package/dist/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;AAE1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AED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAUnD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAK5D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAK1D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAKhE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAK1D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAKpE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAmB1F"}
|
package/dist/lib/errors.js
CHANGED
|
@@ -109,11 +109,6 @@ export const CLI_ERROR_DEFINITIONS = {
|
|
|
109
109
|
title: 'Unknown help topic',
|
|
110
110
|
fix: 'Run `remix help` to see available commands and help topics.',
|
|
111
111
|
},
|
|
112
|
-
unknownSkillsCommand: {
|
|
113
|
-
code: 'RMX_UNKNOWN_SKILLS_COMMAND',
|
|
114
|
-
title: 'Unknown skills command',
|
|
115
|
-
fix: 'Run `remix skills --help` to see available skills commands.',
|
|
116
|
-
},
|
|
117
112
|
};
|
|
118
113
|
export class CliError extends Error {
|
|
119
114
|
code;
|
|
@@ -269,12 +264,6 @@ export function unknownHelpTopic(topic) {
|
|
|
269
264
|
message: `Unknown help topic: ${topic}`,
|
|
270
265
|
});
|
|
271
266
|
}
|
|
272
|
-
export function unknownSkillsCommand(command) {
|
|
273
|
-
return createUsageError(CLI_ERROR_DEFINITIONS.unknownSkillsCommand, {
|
|
274
|
-
context: { command },
|
|
275
|
-
message: `Unknown skills command: ${command}`,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
267
|
export function unexpectedExtraArgument(argument) {
|
|
279
268
|
return createUsageError(CLI_ERROR_DEFINITIONS.unexpectedExtraArgument, {
|
|
280
269
|
context: { argument },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix-run/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Command-line interface for Remix",
|
|
5
5
|
"author": "Michael Jackson <mjijackson@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,15 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"semver": "^7.7.4",
|
|
34
|
-
"@remix-run/test": "^0.
|
|
35
|
-
"@remix-run/tar-parser": "^0.7.1",
|
|
34
|
+
"@remix-run/test": "^0.3.0",
|
|
36
35
|
"@remix-run/terminal": "^0.1.0"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
38
|
"@types/node": "^24.6.0",
|
|
40
39
|
"@types/semver": "^7.5.8",
|
|
41
40
|
"@typescript/native-preview": "7.0.0-dev.20251125.1",
|
|
42
|
-
"@remix-run/assert": "^0.
|
|
41
|
+
"@remix-run/assert": "^0.2.0"
|
|
43
42
|
},
|
|
44
43
|
"keywords": [
|
|
45
44
|
"remix",
|
package/src/lib/cli.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import * as process from 'node:process'
|
|
2
2
|
|
|
3
|
-
import { runCompletionCommand } from './commands/completion.ts'
|
|
4
|
-
import { runDoctorCommand } from './commands/doctor.ts'
|
|
5
3
|
import { getCliHelpText, runHelpCommand } from './commands/help.ts'
|
|
6
|
-
import { runNewCommand } from './commands/new.ts'
|
|
7
|
-
import { runRoutesCommand } from './commands/routes.ts'
|
|
8
|
-
import { runSkillsCommand } from './commands/skills.ts'
|
|
9
|
-
import { runTestCommand } from './commands/test.ts'
|
|
10
|
-
import { runVersionCommand } from './commands/version.ts'
|
|
11
4
|
import { resolveCliContext, type CliContext } from './cli-context.ts'
|
|
12
5
|
import { renderCliError, unknownCommand } from './errors.ts'
|
|
13
6
|
import { configureColors, restoreTerminalFormatting } from './terminal.ts'
|
|
@@ -56,34 +49,37 @@ async function runCommand(command: string, argv: string[], context: CliContext):
|
|
|
56
49
|
}
|
|
57
50
|
|
|
58
51
|
if (command === '-v' || command === '--version') {
|
|
52
|
+
let { runVersionCommand } = await import('./commands/version.ts')
|
|
59
53
|
return runVersionCommand([], context)
|
|
60
54
|
}
|
|
61
55
|
|
|
62
56
|
if (command === 'new') {
|
|
57
|
+
let { runNewCommand } = await import('./commands/new.ts')
|
|
63
58
|
return runNewCommand(argv, context)
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
if (command === 'completion') {
|
|
62
|
+
let { runCompletionCommand } = await import('./commands/completion.ts')
|
|
67
63
|
return runCompletionCommand(argv)
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
if (command === 'doctor') {
|
|
67
|
+
let { runDoctorCommand } = await import('./commands/doctor.ts')
|
|
71
68
|
return runDoctorCommand(argv, context)
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
if (command === 'skills') {
|
|
75
|
-
return runSkillsCommand(argv, context)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
71
|
if (command === 'routes') {
|
|
72
|
+
let { runRoutesCommand } = await import('./commands/routes.ts')
|
|
79
73
|
return runRoutesCommand(argv, context)
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
if (command === 'test') {
|
|
77
|
+
let { runTestCommand } = await import('./commands/test.ts')
|
|
83
78
|
return runTestCommand(argv, context)
|
|
84
79
|
}
|
|
85
80
|
|
|
86
81
|
if (command === 'version') {
|
|
82
|
+
let { runVersionCommand } = await import('./commands/version.ts')
|
|
87
83
|
return runVersionCommand(argv, context)
|
|
88
84
|
}
|
|
89
85
|
|
package/src/lib/commands/help.ts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import * as process from 'node:process'
|
|
2
2
|
|
|
3
|
-
import { getCompletionCommandHelpText } from './completion.ts'
|
|
4
3
|
import { renderCliError, toCliError, unknownHelpTopic } from '../errors.ts'
|
|
5
4
|
import { formatHelpText } from '../help-text.ts'
|
|
6
|
-
import { getDoctorCommandHelpText } from './doctor.ts'
|
|
7
|
-
import { getNewCommandHelpText } from './new.ts'
|
|
8
|
-
import { getRoutesCommandHelpText } from './routes.ts'
|
|
9
|
-
import {
|
|
10
|
-
getSkillsCommandHelpText,
|
|
11
|
-
getSkillsInstallCommandHelpText,
|
|
12
|
-
getSkillsListCommandHelpText,
|
|
13
|
-
} from './skills.ts'
|
|
14
|
-
import { getTestCommandHelpText } from './test.ts'
|
|
15
|
-
import { getVersionCommandHelpText } from './version.ts'
|
|
16
5
|
|
|
17
6
|
export async function runHelpCommand(argv: string[]): Promise<number> {
|
|
18
7
|
if (argv.includes('-h') || argv.includes('--help')) {
|
|
@@ -21,7 +10,7 @@ export async function runHelpCommand(argv: string[]): Promise<number> {
|
|
|
21
10
|
}
|
|
22
11
|
|
|
23
12
|
try {
|
|
24
|
-
process.stdout.write(getCommandHelpText(argv))
|
|
13
|
+
process.stdout.write(await getCommandHelpText(argv))
|
|
25
14
|
return 0
|
|
26
15
|
} catch (error) {
|
|
27
16
|
process.stderr.write(
|
|
@@ -40,7 +29,6 @@ export function getCliHelpText(target: NodeJS.WriteStream = process.stdout): str
|
|
|
40
29
|
{ description: 'Create a new Remix project', label: 'new <name>' },
|
|
41
30
|
{ description: 'Check project health for the current project', label: 'doctor' },
|
|
42
31
|
{ description: 'Show the route tree for the current project', label: 'routes' },
|
|
43
|
-
{ description: 'Manage Remix skills for the current project', label: 'skills' },
|
|
44
32
|
{ description: 'Run tests for the current project', label: 'test [glob]' },
|
|
45
33
|
{ description: 'Show the current Remix version', label: 'version' },
|
|
46
34
|
],
|
|
@@ -49,12 +37,10 @@ export function getCliHelpText(target: NodeJS.WriteStream = process.stdout): str
|
|
|
49
37
|
'remix help',
|
|
50
38
|
'remix help completion',
|
|
51
39
|
'remix help doctor',
|
|
52
|
-
'remix help skills install',
|
|
53
40
|
'remix doctor',
|
|
54
41
|
'remix new my-remix-app',
|
|
55
42
|
'remix new my-remix-app --app-name "My Remix App"',
|
|
56
43
|
'remix routes',
|
|
57
|
-
'remix skills install',
|
|
58
44
|
'remix test',
|
|
59
45
|
'remix version',
|
|
60
46
|
],
|
|
@@ -79,7 +65,6 @@ export function getHelpCommandHelpText(target: NodeJS.WriteStream = process.stdo
|
|
|
79
65
|
'remix help doctor',
|
|
80
66
|
'remix help new',
|
|
81
67
|
'remix help routes',
|
|
82
|
-
'remix help skills install',
|
|
83
68
|
'remix help test',
|
|
84
69
|
'remix help version',
|
|
85
70
|
],
|
|
@@ -89,7 +74,7 @@ export function getHelpCommandHelpText(target: NodeJS.WriteStream = process.stdo
|
|
|
89
74
|
)
|
|
90
75
|
}
|
|
91
76
|
|
|
92
|
-
function getCommandHelpText(argv: string[]): string {
|
|
77
|
+
async function getCommandHelpText(argv: string[]): Promise<string> {
|
|
93
78
|
if (argv.length === 0) {
|
|
94
79
|
return getCliHelpText()
|
|
95
80
|
}
|
|
@@ -101,30 +86,32 @@ function getCommandHelpText(argv: string[]): string {
|
|
|
101
86
|
}
|
|
102
87
|
|
|
103
88
|
if (command === 'new' && rest.length === 0) {
|
|
89
|
+
let { getNewCommandHelpText } = await import('./new.ts')
|
|
104
90
|
return getNewCommandHelpText()
|
|
105
91
|
}
|
|
106
92
|
|
|
107
93
|
if (command === 'completion' && rest.length === 0) {
|
|
94
|
+
let { getCompletionCommandHelpText } = await import('./completion.ts')
|
|
108
95
|
return getCompletionCommandHelpText()
|
|
109
96
|
}
|
|
110
97
|
|
|
111
98
|
if (command === 'doctor' && rest.length === 0) {
|
|
99
|
+
let { getDoctorCommandHelpText } = await import('./doctor.ts')
|
|
112
100
|
return getDoctorCommandHelpText()
|
|
113
101
|
}
|
|
114
102
|
|
|
115
103
|
if (command === 'routes' && rest.length === 0) {
|
|
104
|
+
let { getRoutesCommandHelpText } = await import('./routes.ts')
|
|
116
105
|
return getRoutesCommandHelpText()
|
|
117
106
|
}
|
|
118
107
|
|
|
119
|
-
if (command === 'skills') {
|
|
120
|
-
return getSkillsHelpText(rest)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
108
|
if (command === 'test' && rest.length === 0) {
|
|
124
|
-
|
|
109
|
+
let { getTestCommandHelpText } = await import('./test.ts')
|
|
110
|
+
return await getTestCommandHelpText()
|
|
125
111
|
}
|
|
126
112
|
|
|
127
113
|
if (command === 'version' && rest.length === 0) {
|
|
114
|
+
let { getVersionCommandHelpText } = await import('./version.ts')
|
|
128
115
|
return getVersionCommandHelpText()
|
|
129
116
|
}
|
|
130
117
|
|
|
@@ -134,24 +121,3 @@ function getCommandHelpText(argv: string[]): string {
|
|
|
134
121
|
function getNestedHelpText(command: string, argv: string[]): string {
|
|
135
122
|
throw unknownHelpTopic(`${command} ${argv.join(' ')}`)
|
|
136
123
|
}
|
|
137
|
-
|
|
138
|
-
function getSkillsHelpText(argv: string[]): string {
|
|
139
|
-
if (argv.length === 0) {
|
|
140
|
-
return getSkillsCommandHelpText()
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
let [subcommand, ...rest] = argv
|
|
144
|
-
if (rest.length > 0) {
|
|
145
|
-
throw unknownHelpTopic(`skills ${argv.join(' ')}`)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (subcommand === 'install') {
|
|
149
|
-
return getSkillsInstallCommandHelpText()
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (subcommand === 'list') {
|
|
153
|
-
return getSkillsListCommandHelpText()
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
throw unknownHelpTopic(`skills ${argv.join(' ')}`)
|
|
157
|
-
}
|
package/src/lib/commands/test.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getRemixTestHelpText, runRemixTest } from '@remix-run/test/cli'
|
|
2
1
|
import * as process from 'node:process'
|
|
3
2
|
|
|
4
3
|
import type { CliContext } from '../cli-context.ts'
|
|
@@ -6,20 +5,27 @@ import { renderCliError, toCliError } from '../errors.ts'
|
|
|
6
5
|
|
|
7
6
|
export async function runTestCommand(argv: string[], context: CliContext): Promise<number> {
|
|
8
7
|
if (argv.includes('-h') || argv.includes('--help')) {
|
|
9
|
-
process.stdout.write(`${getTestCommandHelpText()}\n`)
|
|
8
|
+
process.stdout.write(`${await getTestCommandHelpText()}\n`)
|
|
10
9
|
return 0
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
try {
|
|
13
|
+
let { runRemixTest } = await import('@remix-run/test/cli')
|
|
14
14
|
return await runRemixTest({ argv, cwd: context.cwd })
|
|
15
15
|
} catch (error) {
|
|
16
|
+
let helpText = await getTestCommandHelpText(process.stderr)
|
|
16
17
|
process.stderr.write(
|
|
17
|
-
renderCliError(toCliError(error), {
|
|
18
|
+
renderCliError(toCliError(error), {
|
|
19
|
+
helpText,
|
|
20
|
+
}),
|
|
18
21
|
)
|
|
19
22
|
return 1
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
export function getTestCommandHelpText(
|
|
26
|
+
export async function getTestCommandHelpText(
|
|
27
|
+
target: NodeJS.WriteStream = process.stdout,
|
|
28
|
+
): Promise<string> {
|
|
29
|
+
let { getRemixTestHelpText } = await import('@remix-run/test/cli')
|
|
24
30
|
return getRemixTestHelpText(target)
|
|
25
31
|
}
|