@remix-run/cli 0.0.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.
Files changed (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -3
  3. package/bootstrap/.agents/skills/remix/SKILL.md +501 -0
  4. package/bootstrap/.agents/skills/remix/references/animate-elements.md +195 -0
  5. package/bootstrap/.agents/skills/remix/references/assets-and-browser-modules.md +122 -0
  6. package/bootstrap/.agents/skills/remix/references/auth-and-sessions.md +420 -0
  7. package/bootstrap/.agents/skills/remix/references/component-model.md +282 -0
  8. package/bootstrap/.agents/skills/remix/references/create-mixins.md +158 -0
  9. package/bootstrap/.agents/skills/remix/references/data-and-validation.md +363 -0
  10. package/bootstrap/.agents/skills/remix/references/hydration-frames-navigation.md +297 -0
  11. package/bootstrap/.agents/skills/remix/references/middleware-and-server.md +243 -0
  12. package/bootstrap/.agents/skills/remix/references/mixins-styling-events.md +213 -0
  13. package/bootstrap/.agents/skills/remix/references/routing-and-controllers.md +324 -0
  14. package/bootstrap/.agents/skills/remix/references/testing-patterns.md +156 -0
  15. package/bootstrap/AGENTS.md +39 -0
  16. package/bootstrap/README.md +27 -0
  17. package/bootstrap/app/assets/entry.ts +19 -0
  18. package/bootstrap/app/assets.ts +18 -0
  19. package/bootstrap/app/controllers/auth.tsx +21 -0
  20. package/bootstrap/app/controllers/home.tsx +11 -0
  21. package/bootstrap/app/router.ts +16 -0
  22. package/bootstrap/app/routes.ts +7 -0
  23. package/bootstrap/app/ui/document.tsx +26 -0
  24. package/bootstrap/app/ui/layout.tsx +22 -0
  25. package/bootstrap/app/ui/prompt-button.tsx +162 -0
  26. package/bootstrap/app/ui/scaffold-home-page.tsx +526 -0
  27. package/bootstrap/app/utils/render.tsx +26 -0
  28. package/bootstrap/package.json +22 -0
  29. package/bootstrap/server.ts +37 -0
  30. package/bootstrap/tsconfig.json +18 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +1 -0
  34. package/dist/lib/bootstrap-project.d.ts +17 -0
  35. package/dist/lib/bootstrap-project.d.ts.map +1 -0
  36. package/dist/lib/bootstrap-project.js +137 -0
  37. package/dist/lib/cli-context.d.ts +11 -0
  38. package/dist/lib/cli-context.d.ts.map +1 -0
  39. package/dist/lib/cli-context.js +19 -0
  40. package/dist/lib/cli.d.ts +6 -0
  41. package/dist/lib/cli.d.ts.map +1 -0
  42. package/dist/lib/cli.js +84 -0
  43. package/dist/lib/commands/completion.d.ts +3 -0
  44. package/dist/lib/commands/completion.d.ts.map +1 -0
  45. package/dist/lib/commands/completion.js +51 -0
  46. package/dist/lib/commands/doctor.d.ts +4 -0
  47. package/dist/lib/commands/doctor.d.ts.map +1 -0
  48. package/dist/lib/commands/doctor.js +293 -0
  49. package/dist/lib/commands/help.d.ts +4 -0
  50. package/dist/lib/commands/help.d.ts.map +1 -0
  51. package/dist/lib/commands/help.js +100 -0
  52. package/dist/lib/commands/new.d.ts +4 -0
  53. package/dist/lib/commands/new.d.ts.map +1 -0
  54. package/dist/lib/commands/new.js +70 -0
  55. package/dist/lib/commands/routes.d.ts +4 -0
  56. package/dist/lib/commands/routes.d.ts.map +1 -0
  57. package/dist/lib/commands/routes.js +161 -0
  58. package/dist/lib/commands/test.d.ts +4 -0
  59. package/dist/lib/commands/test.d.ts.map +1 -0
  60. package/dist/lib/commands/test.js +23 -0
  61. package/dist/lib/commands/version.d.ts +4 -0
  62. package/dist/lib/commands/version.d.ts.map +1 -0
  63. package/dist/lib/commands/version.js +29 -0
  64. package/dist/lib/completion.d.ts +12 -0
  65. package/dist/lib/completion.d.ts.map +1 -0
  66. package/dist/lib/completion.js +310 -0
  67. package/dist/lib/contained-path.d.ts +2 -0
  68. package/dist/lib/contained-path.d.ts.map +1 -0
  69. package/dist/lib/contained-path.js +10 -0
  70. package/dist/lib/controller-files.d.ts +14 -0
  71. package/dist/lib/controller-files.d.ts.map +1 -0
  72. package/dist/lib/controller-files.js +53 -0
  73. package/dist/lib/controller-ownership.d.ts +41 -0
  74. package/dist/lib/controller-ownership.d.ts.map +1 -0
  75. package/dist/lib/controller-ownership.js +224 -0
  76. package/dist/lib/display-path.d.ts +2 -0
  77. package/dist/lib/display-path.d.ts.map +1 -0
  78. package/dist/lib/display-path.js +12 -0
  79. package/dist/lib/doctor/controller-findings.d.ts +4 -0
  80. package/dist/lib/doctor/controller-findings.d.ts.map +1 -0
  81. package/dist/lib/doctor/controller-findings.js +132 -0
  82. package/dist/lib/doctor/controller-fix-plans.d.ts +4 -0
  83. package/dist/lib/doctor/controller-fix-plans.d.ts.map +1 -0
  84. package/dist/lib/doctor/controller-fix-plans.js +130 -0
  85. package/dist/lib/doctor/controller-placeholders.d.ts +4 -0
  86. package/dist/lib/doctor/controller-placeholders.d.ts.map +1 -0
  87. package/dist/lib/doctor/controller-placeholders.js +183 -0
  88. package/dist/lib/doctor/controllers.d.ts +8 -0
  89. package/dist/lib/doctor/controllers.d.ts.map +1 -0
  90. package/dist/lib/doctor/controllers.js +13 -0
  91. package/dist/lib/doctor/environment.d.ts +17 -0
  92. package/dist/lib/doctor/environment.d.ts.map +1 -0
  93. package/dist/lib/doctor/environment.js +226 -0
  94. package/dist/lib/doctor/fixes.d.ts +3 -0
  95. package/dist/lib/doctor/fixes.d.ts.map +1 -0
  96. package/dist/lib/doctor/fixes.js +65 -0
  97. package/dist/lib/doctor/project.d.ts +10 -0
  98. package/dist/lib/doctor/project.d.ts.map +1 -0
  99. package/dist/lib/doctor/project.js +371 -0
  100. package/dist/lib/doctor/types.d.ts +48 -0
  101. package/dist/lib/doctor/types.d.ts.map +1 -0
  102. package/dist/lib/doctor/types.js +15 -0
  103. package/dist/lib/errors.d.ts +167 -0
  104. package/dist/lib/errors.d.ts.map +1 -0
  105. package/dist/lib/errors.js +307 -0
  106. package/dist/lib/help-text.d.ts +13 -0
  107. package/dist/lib/help-text.d.ts.map +1 -0
  108. package/dist/lib/help-text.js +43 -0
  109. package/dist/lib/load-route-map-worker.d.ts +2 -0
  110. package/dist/lib/load-route-map-worker.d.ts.map +1 -0
  111. package/dist/lib/load-route-map-worker.js +92 -0
  112. package/dist/lib/parse-args.d.ts +22 -0
  113. package/dist/lib/parse-args.d.ts.map +1 -0
  114. package/dist/lib/parse-args.js +35 -0
  115. package/dist/lib/remix-version.d.ts +2 -0
  116. package/dist/lib/remix-version.d.ts.map +1 -0
  117. package/dist/lib/remix-version.js +58 -0
  118. package/dist/lib/reporter.d.ts +56 -0
  119. package/dist/lib/reporter.d.ts.map +1 -0
  120. package/dist/lib/reporter.js +357 -0
  121. package/dist/lib/route-map.d.ts +38 -0
  122. package/dist/lib/route-map.d.ts.map +1 -0
  123. package/dist/lib/route-map.js +195 -0
  124. package/dist/lib/terminal.d.ts +17 -0
  125. package/dist/lib/terminal.d.ts.map +1 -0
  126. package/dist/lib/terminal.js +66 -0
  127. package/package.json +47 -5
  128. package/src/index.ts +1 -0
  129. package/src/lib/bootstrap-project.ts +222 -0
  130. package/src/lib/cli-context.ts +38 -0
  131. package/src/lib/cli.ts +116 -0
  132. package/src/lib/commands/completion.ts +74 -0
  133. package/src/lib/commands/doctor.ts +393 -0
  134. package/src/lib/commands/help.ts +123 -0
  135. package/src/lib/commands/new.ts +104 -0
  136. package/src/lib/commands/routes.ts +251 -0
  137. package/src/lib/commands/test.ts +31 -0
  138. package/src/lib/commands/version.ts +39 -0
  139. package/src/lib/completion.ts +418 -0
  140. package/src/lib/contained-path.ts +13 -0
  141. package/src/lib/controller-files.ts +79 -0
  142. package/src/lib/controller-ownership.ts +397 -0
  143. package/src/lib/display-path.ts +16 -0
  144. package/src/lib/doctor/controller-findings.ts +157 -0
  145. package/src/lib/doctor/controller-fix-plans.ts +184 -0
  146. package/src/lib/doctor/controller-placeholders.ts +242 -0
  147. package/src/lib/doctor/controllers.ts +23 -0
  148. package/src/lib/doctor/environment.ts +289 -0
  149. package/src/lib/doctor/fixes.ts +84 -0
  150. package/src/lib/doctor/project.ts +435 -0
  151. package/src/lib/doctor/types.ts +95 -0
  152. package/src/lib/errors.ts +367 -0
  153. package/src/lib/help-text.ts +88 -0
  154. package/src/lib/load-route-map-worker.ts +110 -0
  155. package/src/lib/parse-args.ts +82 -0
  156. package/src/lib/remix-version.ts +80 -0
  157. package/src/lib/reporter.ts +535 -0
  158. package/src/lib/route-map.ts +303 -0
  159. package/src/lib/terminal.ts +86 -0
@@ -0,0 +1,48 @@
1
+ export type DoctorSuiteName = 'environment' | 'project' | 'controllers';
2
+ export type DoctorFindingSeverity = 'warn' | 'advice';
3
+ export type DoctorSuiteStatus = 'ok' | 'issues' | 'skipped';
4
+ export type DoctorFindingCode = 'project-root-not-found' | 'package-json-read-failed' | 'package-json-invalid' | 'node-engine-missing' | 'node-engine-unparseable' | 'node-version-unsupported' | 'remix-dependency-missing' | 'remix-install-missing' | 'routes-file-missing' | 'routes-export-missing' | 'route-map-invalid' | 'route-module-import-failed' | 'route-map-invalid-json' | 'route-map-loader-signal' | 'missing-owner' | 'wrong-owner-kind' | 'ambiguous-owner' | 'duplicate-owner-file' | 'incomplete-controller' | 'promotion-drift' | 'orphan-action' | 'orphan-controller' | 'orphan-route-directory';
5
+ export type DoctorFixKind = 'create-directory' | 'create-file' | 'update-file';
6
+ export interface DoctorFinding {
7
+ actualPath?: string;
8
+ code: DoctorFindingCode;
9
+ expectedPath?: string;
10
+ fixable?: boolean;
11
+ message: string;
12
+ routeName?: string;
13
+ severity: DoctorFindingSeverity;
14
+ suite: DoctorSuiteName;
15
+ }
16
+ export interface DoctorFixPlan {
17
+ code: DoctorFindingCode;
18
+ contents?: string;
19
+ kind: DoctorFixKind;
20
+ path: string;
21
+ routeName?: string;
22
+ suite: DoctorSuiteName;
23
+ }
24
+ export interface DoctorAppliedFix {
25
+ code: DoctorFindingCode;
26
+ kind: DoctorFixKind;
27
+ path: string;
28
+ routeName?: string;
29
+ suite: DoctorSuiteName;
30
+ }
31
+ export interface DoctorSuiteResult {
32
+ appliedFixes?: DoctorAppliedFix[];
33
+ findings: DoctorFinding[];
34
+ name: DoctorSuiteName;
35
+ reason?: string;
36
+ status: DoctorSuiteStatus;
37
+ }
38
+ export interface DoctorReport {
39
+ appliedFixes?: DoctorAppliedFix[];
40
+ appRoot?: string;
41
+ findings: DoctorFinding[];
42
+ remainingFindings?: DoctorFinding[];
43
+ routesFile?: string;
44
+ suites: DoctorSuiteResult[];
45
+ }
46
+ export declare function createDoctorSuite(name: DoctorSuiteName, findings: DoctorFinding[]): DoctorSuiteResult;
47
+ export declare function createSkippedDoctorSuite(name: DoctorSuiteName, reason: string): DoctorSuiteResult;
48
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/doctor/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,SAAS,GAAG,aAAa,CAAA;AACvE,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,CAAA;AACrD,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAA;AAE3D,MAAM,MAAM,iBAAiB,GACzB,wBAAwB,GACxB,0BAA0B,GAC1B,sBAAsB,GACtB,qBAAqB,GACrB,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,uBAAuB,GACvB,qBAAqB,GACrB,uBAAuB,GACvB,mBAAmB,GACnB,4BAA4B,GAC5B,wBAAwB,GACxB,yBAAyB,GACzB,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,sBAAsB,GACtB,uBAAuB,GACvB,iBAAiB,GACjB,eAAe,GACf,mBAAmB,GACnB,wBAAwB,CAAA;AAE5B,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,aAAa,GAAG,aAAa,CAAA;AAE9E,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,iBAAiB,CAAA;IACv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AI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAOjG"}
@@ -0,0 +1,15 @@
1
+ export function createDoctorSuite(name, findings) {
2
+ return {
3
+ findings,
4
+ name,
5
+ status: findings.some((finding) => finding.severity === 'warn') ? 'issues' : 'ok',
6
+ };
7
+ }
8
+ export function createSkippedDoctorSuite(name, reason) {
9
+ return {
10
+ findings: [],
11
+ name,
12
+ reason,
13
+ status: 'skipped',
14
+ };
15
+ }
@@ -0,0 +1,167 @@
1
+ export interface CliErrorDefinition {
2
+ code: string;
3
+ docsUrl?: string;
4
+ fix?: string;
5
+ title: string;
6
+ }
7
+ export type CliErrorContext = Record<string, boolean | number | string | null | undefined>;
8
+ export interface CliErrorOptions {
9
+ code: string;
10
+ context?: CliErrorContext;
11
+ docsUrl?: string;
12
+ fix?: string;
13
+ message: string;
14
+ showHelp?: boolean;
15
+ title: string;
16
+ }
17
+ export declare const CLI_ERROR_DEFINITIONS: {
18
+ appNameUnavailable: {
19
+ code: string;
20
+ title: string;
21
+ fix: string;
22
+ };
23
+ remixVersionUnavailable: {
24
+ code: string;
25
+ title: string;
26
+ };
27
+ invalidCompletionRequest: {
28
+ code: string;
29
+ title: string;
30
+ };
31
+ fetchUnavailable: {
32
+ code: string;
33
+ title: string;
34
+ fix: string;
35
+ };
36
+ internalError: {
37
+ code: string;
38
+ title: string;
39
+ };
40
+ invalidFlagCombination: {
41
+ code: string;
42
+ title: string;
43
+ fix: string;
44
+ };
45
+ invalidPackageName: {
46
+ code: string;
47
+ title: string;
48
+ fix: string;
49
+ };
50
+ missingOptionValue: {
51
+ code: string;
52
+ title: string;
53
+ fix: string;
54
+ };
55
+ missingTargetDirectory: {
56
+ code: string;
57
+ title: string;
58
+ fix: string;
59
+ };
60
+ projectRootNotFound: {
61
+ code: string;
62
+ title: string;
63
+ fix: string;
64
+ };
65
+ remoteSkillDataMissing: {
66
+ code: string;
67
+ title: string;
68
+ };
69
+ routeMapLoaderFailed: {
70
+ code: string;
71
+ title: string;
72
+ fix: string;
73
+ };
74
+ routeMapLoaderInvalidJson: {
75
+ code: string;
76
+ title: string;
77
+ fix: string;
78
+ };
79
+ routeMapLoaderSignal: {
80
+ code: string;
81
+ title: string;
82
+ fix: string;
83
+ };
84
+ routeOwnerPlanUnresolved: {
85
+ code: string;
86
+ title: string;
87
+ };
88
+ routesFileNotFound: {
89
+ code: string;
90
+ title: string;
91
+ fix: string;
92
+ };
93
+ targetDirectoryNotEmpty: {
94
+ code: string;
95
+ title: string;
96
+ fix: string;
97
+ };
98
+ targetPathNotDirectory: {
99
+ code: string;
100
+ title: string;
101
+ fix: string;
102
+ };
103
+ unexpectedExtraArgument: {
104
+ code: string;
105
+ title: string;
106
+ fix: string;
107
+ };
108
+ unknownArgument: {
109
+ code: string;
110
+ title: string;
111
+ fix: string;
112
+ };
113
+ unknownCommand: {
114
+ code: string;
115
+ title: string;
116
+ fix: string;
117
+ };
118
+ unknownCompletionShell: {
119
+ code: string;
120
+ title: string;
121
+ fix: string;
122
+ };
123
+ unknownHelpTopic: {
124
+ code: string;
125
+ title: string;
126
+ fix: string;
127
+ };
128
+ };
129
+ export declare class CliError extends Error {
130
+ code: string;
131
+ context?: CliErrorContext;
132
+ docsUrl?: string;
133
+ fix?: string;
134
+ showHelp: boolean;
135
+ title: string;
136
+ constructor(options: CliErrorOptions);
137
+ }
138
+ export declare class UsageError extends CliError {
139
+ constructor(options: CliErrorOptions);
140
+ }
141
+ export declare function appNameUnavailable(targetDir?: string): UsageError;
142
+ export declare function remixVersionUnavailable(): CliError;
143
+ export declare function invalidCompletionRequest(): CliError;
144
+ export declare function fetchUnavailable(): CliError;
145
+ export declare function invalidFlagCombination(details: string): UsageError;
146
+ export declare function invalidPackageName(input: string): UsageError;
147
+ export declare function missingOptionValue(option: string): UsageError;
148
+ export declare function missingTargetDirectory(): UsageError;
149
+ export declare function projectRootNotFound(startDir?: string): CliError;
150
+ export declare function remoteSkillDataMissing(name: string): CliError;
151
+ export declare function routeMapLoaderFailed(details: string): CliError;
152
+ export declare function routeMapLoaderInvalidJson(): CliError;
153
+ export declare function routeMapLoaderSignal(signal: NodeJS.Signals): CliError;
154
+ export declare function routeOwnerPlanUnresolved(routeName: string): CliError;
155
+ export declare function routesFileNotFound(startDir?: string): CliError;
156
+ export declare function targetDirectoryNotEmpty(targetDir: string): UsageError;
157
+ export declare function targetPathNotDirectory(targetDir: string): UsageError;
158
+ export declare function toCliError(error: unknown): CliError;
159
+ export declare function unknownArgument(argument: string): UsageError;
160
+ export declare function unknownCommand(command: string): UsageError;
161
+ export declare function unknownCompletionShell(shell: string): UsageError;
162
+ export declare function unknownHelpTopic(topic: string): UsageError;
163
+ export declare function unexpectedExtraArgument(argument: string): UsageError;
164
+ export declare function renderCliError(error: unknown, options?: {
165
+ helpText?: string;
166
+ }): string;
167
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +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;AAE1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AAOD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;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wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAKpE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CAK9D;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAKrE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAKpE;AAED,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"}
@@ -0,0 +1,307 @@
1
+ export const CLI_ERROR_DEFINITIONS = {
2
+ appNameUnavailable: {
3
+ code: 'RMX_APP_NAME_UNAVAILABLE',
4
+ title: 'Could not determine an app name',
5
+ fix: 'Pass --app-name or choose a target directory name that can become an app name.',
6
+ },
7
+ remixVersionUnavailable: {
8
+ code: 'RMX_REMIX_VERSION_UNAVAILABLE',
9
+ title: 'Could not determine the Remix version',
10
+ },
11
+ invalidCompletionRequest: {
12
+ code: 'RMX_INVALID_COMPLETION_REQUEST',
13
+ title: 'Invalid completion request',
14
+ },
15
+ fetchUnavailable: {
16
+ code: 'RMX_FETCH_UNAVAILABLE',
17
+ title: 'This runtime does not provide fetch()',
18
+ fix: 'Run the Remix CLI in a runtime that provides fetch().',
19
+ },
20
+ internalError: {
21
+ code: 'RMX_INTERNAL_ERROR',
22
+ title: 'Unexpected Remix CLI error',
23
+ },
24
+ invalidFlagCombination: {
25
+ code: 'RMX_INVALID_FLAG_COMBINATION',
26
+ title: 'Invalid flag combination',
27
+ fix: 'Remove one of the conflicting flags and try again.',
28
+ },
29
+ invalidPackageName: {
30
+ code: 'RMX_INVALID_PACKAGE_NAME',
31
+ title: 'Could not derive a valid package name',
32
+ fix: 'Choose an app name that can be normalized into a valid npm package name.',
33
+ },
34
+ missingOptionValue: {
35
+ code: 'RMX_MISSING_OPTION_VALUE',
36
+ title: 'Missing option value',
37
+ fix: 'Pass a value immediately after the option.',
38
+ },
39
+ missingTargetDirectory: {
40
+ code: 'RMX_MISSING_TARGET_DIRECTORY',
41
+ title: 'Missing target directory',
42
+ fix: 'Pass a target directory, for example `remix new my-remix-app`.',
43
+ },
44
+ projectRootNotFound: {
45
+ code: 'RMX_PROJECT_ROOT_NOT_FOUND',
46
+ title: 'Could not find a project root',
47
+ fix: 'Run this command inside a Remix project.',
48
+ },
49
+ remoteSkillDataMissing: {
50
+ code: 'RMX_REMOTE_SKILL_DATA_MISSING',
51
+ title: 'Could not find remote Remix skill data',
52
+ },
53
+ routeMapLoaderFailed: {
54
+ code: 'RMX_ROUTE_MAP_LOADER_FAILED',
55
+ title: 'Route-map loader failed',
56
+ fix: 'Check app/routes.ts and make sure it exports a named `routes` value with a valid route map.',
57
+ },
58
+ routeMapLoaderInvalidJson: {
59
+ code: 'RMX_ROUTE_MAP_LOADER_INVALID_JSON',
60
+ title: 'Route-map loader returned invalid JSON',
61
+ fix: 'Check app/routes.ts and make sure route-map loading does not write extra output.',
62
+ },
63
+ routeMapLoaderSignal: {
64
+ code: 'RMX_ROUTE_MAP_LOADER_SIGNAL',
65
+ title: 'Route-map loader exited from a signal',
66
+ fix: 'Check app/routes.ts for side effects or runtime issues and try again.',
67
+ },
68
+ routeOwnerPlanUnresolved: {
69
+ code: 'RMX_ROUTE_OWNER_PLAN_UNRESOLVED',
70
+ title: 'Could not resolve a route owner plan',
71
+ },
72
+ routesFileNotFound: {
73
+ code: 'RMX_ROUTES_FILE_NOT_FOUND',
74
+ title: 'Could not find app/routes.ts',
75
+ fix: 'Run this command inside a Remix app that has app/routes.ts.',
76
+ },
77
+ targetDirectoryNotEmpty: {
78
+ code: 'RMX_TARGET_DIRECTORY_NOT_EMPTY',
79
+ title: 'Target directory is not empty',
80
+ fix: 'Re-run with --force to continue.',
81
+ },
82
+ targetPathNotDirectory: {
83
+ code: 'RMX_TARGET_PATH_NOT_DIRECTORY',
84
+ title: 'Target path is not a directory',
85
+ fix: 'Choose a directory path for the new app target.',
86
+ },
87
+ unexpectedExtraArgument: {
88
+ code: 'RMX_UNEXPECTED_ARGUMENT',
89
+ title: 'Unexpected extra argument',
90
+ fix: 'Remove the extra argument or run the command with --help.',
91
+ },
92
+ unknownArgument: {
93
+ code: 'RMX_UNKNOWN_ARGUMENT',
94
+ title: 'Unknown argument',
95
+ fix: 'Run the command with --help to see supported arguments.',
96
+ },
97
+ unknownCommand: {
98
+ code: 'RMX_UNKNOWN_COMMAND',
99
+ title: 'Unknown command',
100
+ fix: 'Run `remix help` to see available commands.',
101
+ },
102
+ unknownCompletionShell: {
103
+ code: 'RMX_UNKNOWN_COMPLETION_SHELL',
104
+ title: 'Unknown completion shell',
105
+ fix: 'Run `remix completion bash` or `remix completion zsh`.',
106
+ },
107
+ unknownHelpTopic: {
108
+ code: 'RMX_UNKNOWN_HELP_TOPIC',
109
+ title: 'Unknown help topic',
110
+ fix: 'Run `remix help` to see available commands and help topics.',
111
+ },
112
+ };
113
+ export class CliError extends Error {
114
+ code;
115
+ context;
116
+ docsUrl;
117
+ fix;
118
+ showHelp;
119
+ title;
120
+ constructor(options) {
121
+ super(options.message);
122
+ this.code = options.code;
123
+ this.context = options.context;
124
+ this.docsUrl = options.docsUrl;
125
+ this.fix = options.fix;
126
+ this.name = 'CliError';
127
+ this.showHelp = options.showHelp ?? false;
128
+ this.title = options.title;
129
+ }
130
+ }
131
+ export class UsageError extends CliError {
132
+ constructor(options) {
133
+ super({ ...options, showHelp: options.showHelp ?? true });
134
+ this.name = 'UsageError';
135
+ }
136
+ }
137
+ export function appNameUnavailable(targetDir) {
138
+ return createUsageError(CLI_ERROR_DEFINITIONS.appNameUnavailable, {
139
+ context: targetDir == null ? undefined : { targetDir },
140
+ message: 'Could not determine an app name from the target directory.',
141
+ });
142
+ }
143
+ export function remixVersionUnavailable() {
144
+ return createCliError(CLI_ERROR_DEFINITIONS.remixVersionUnavailable, {
145
+ message: 'Could not determine the current Remix version.',
146
+ });
147
+ }
148
+ export function invalidCompletionRequest() {
149
+ return createCliError(CLI_ERROR_DEFINITIONS.invalidCompletionRequest, {
150
+ message: 'Invalid completion request.',
151
+ });
152
+ }
153
+ export function fetchUnavailable() {
154
+ return createCliError(CLI_ERROR_DEFINITIONS.fetchUnavailable, {
155
+ message: 'This runtime does not provide fetch().',
156
+ });
157
+ }
158
+ export function invalidFlagCombination(details) {
159
+ return createUsageError(CLI_ERROR_DEFINITIONS.invalidFlagCombination, {
160
+ context: { details },
161
+ message: details,
162
+ });
163
+ }
164
+ export function invalidPackageName(input) {
165
+ return createUsageError(CLI_ERROR_DEFINITIONS.invalidPackageName, {
166
+ context: { input },
167
+ message: `Could not derive a valid package name from "${input}".`,
168
+ });
169
+ }
170
+ export function missingOptionValue(option) {
171
+ return createUsageError(CLI_ERROR_DEFINITIONS.missingOptionValue, {
172
+ context: { option },
173
+ message: `${option} requires a value.`,
174
+ });
175
+ }
176
+ export function missingTargetDirectory() {
177
+ return createUsageError(CLI_ERROR_DEFINITIONS.missingTargetDirectory, {
178
+ message: 'A target directory is required.',
179
+ });
180
+ }
181
+ export function projectRootNotFound(startDir) {
182
+ return createCliError(CLI_ERROR_DEFINITIONS.projectRootNotFound, {
183
+ context: startDir == null ? undefined : { startDir },
184
+ message: 'Could not find a project root. Run this command inside a Remix project.',
185
+ });
186
+ }
187
+ export function remoteSkillDataMissing(name) {
188
+ return createCliError(CLI_ERROR_DEFINITIONS.remoteSkillDataMissing, {
189
+ context: { name },
190
+ message: `Could not find remote data for Remix skill: ${name}`,
191
+ });
192
+ }
193
+ export function routeMapLoaderFailed(details) {
194
+ return createCliError(CLI_ERROR_DEFINITIONS.routeMapLoaderFailed, {
195
+ context: { details },
196
+ message: details,
197
+ });
198
+ }
199
+ export function routeMapLoaderInvalidJson() {
200
+ return createCliError(CLI_ERROR_DEFINITIONS.routeMapLoaderInvalidJson, {
201
+ message: 'Route-map loader returned invalid JSON.',
202
+ });
203
+ }
204
+ export function routeMapLoaderSignal(signal) {
205
+ return createCliError(CLI_ERROR_DEFINITIONS.routeMapLoaderSignal, {
206
+ context: { signal },
207
+ message: `Route-map loader exited from signal ${signal}.`,
208
+ });
209
+ }
210
+ export function routeOwnerPlanUnresolved(routeName) {
211
+ return createCliError(CLI_ERROR_DEFINITIONS.routeOwnerPlanUnresolved, {
212
+ context: { routeName },
213
+ message: `Could not resolve owner plan for "${routeName}".`,
214
+ });
215
+ }
216
+ export function routesFileNotFound(startDir) {
217
+ return createCliError(CLI_ERROR_DEFINITIONS.routesFileNotFound, {
218
+ context: startDir == null ? undefined : { startDir },
219
+ message: 'Could not find app/routes.ts. Run this command inside a Remix app.',
220
+ });
221
+ }
222
+ export function targetDirectoryNotEmpty(targetDir) {
223
+ return createUsageError(CLI_ERROR_DEFINITIONS.targetDirectoryNotEmpty, {
224
+ context: { targetDir },
225
+ message: `Target directory is not empty: ${targetDir}. Re-run with --force to continue.`,
226
+ });
227
+ }
228
+ export function targetPathNotDirectory(targetDir) {
229
+ return createUsageError(CLI_ERROR_DEFINITIONS.targetPathNotDirectory, {
230
+ context: { targetDir },
231
+ message: `Target path is not a directory: ${targetDir}`,
232
+ });
233
+ }
234
+ export function toCliError(error) {
235
+ if (error instanceof CliError) {
236
+ return error;
237
+ }
238
+ if (error instanceof Error) {
239
+ return createCliError(CLI_ERROR_DEFINITIONS.internalError, { message: error.message });
240
+ }
241
+ return createCliError(CLI_ERROR_DEFINITIONS.internalError, { message: String(error) });
242
+ }
243
+ export function unknownArgument(argument) {
244
+ return createUsageError(CLI_ERROR_DEFINITIONS.unknownArgument, {
245
+ context: { argument },
246
+ message: `Unknown argument: ${argument}`,
247
+ });
248
+ }
249
+ export function unknownCommand(command) {
250
+ return createUsageError(CLI_ERROR_DEFINITIONS.unknownCommand, {
251
+ context: { command },
252
+ message: `Unknown command: ${command}`,
253
+ });
254
+ }
255
+ export function unknownCompletionShell(shell) {
256
+ return createUsageError(CLI_ERROR_DEFINITIONS.unknownCompletionShell, {
257
+ context: { shell },
258
+ message: `Unknown completion shell: ${shell}`,
259
+ });
260
+ }
261
+ export function unknownHelpTopic(topic) {
262
+ return createUsageError(CLI_ERROR_DEFINITIONS.unknownHelpTopic, {
263
+ context: { topic },
264
+ message: `Unknown help topic: ${topic}`,
265
+ });
266
+ }
267
+ export function unexpectedExtraArgument(argument) {
268
+ return createUsageError(CLI_ERROR_DEFINITIONS.unexpectedExtraArgument, {
269
+ context: { argument },
270
+ message: `Unexpected extra argument: ${argument}`,
271
+ });
272
+ }
273
+ export function renderCliError(error, options = {}) {
274
+ let cliError = toCliError(error);
275
+ let lines = [`Error [${cliError.code}] ${cliError.title}`, cliError.message];
276
+ if (cliError.fix != null && cliError.fix.length > 0) {
277
+ lines.push('', 'Try:', ` ${cliError.fix}`);
278
+ }
279
+ if (cliError.docsUrl != null && cliError.docsUrl.length > 0) {
280
+ lines.push('', 'Documentation:', ` ${cliError.docsUrl}`);
281
+ }
282
+ let output = `${lines.join('\n')}\n`;
283
+ if (cliError.showHelp && options.helpText != null) {
284
+ output += `\n${options.helpText}`;
285
+ }
286
+ return output;
287
+ }
288
+ function createCliError(definition, options) {
289
+ return new CliError({
290
+ code: definition.code,
291
+ context: options.context,
292
+ docsUrl: definition.docsUrl,
293
+ fix: definition.fix,
294
+ message: options.message,
295
+ title: definition.title,
296
+ });
297
+ }
298
+ function createUsageError(definition, options) {
299
+ return new UsageError({
300
+ code: definition.code,
301
+ context: options.context,
302
+ docsUrl: definition.docsUrl,
303
+ fix: definition.fix,
304
+ message: options.message,
305
+ title: definition.title,
306
+ });
307
+ }
@@ -0,0 +1,13 @@
1
+ export interface HelpTextSectionRow {
2
+ description: string;
3
+ label: string;
4
+ }
5
+ export interface HelpTextOptions {
6
+ commands?: HelpTextSectionRow[];
7
+ description?: string;
8
+ examples?: string[];
9
+ options?: HelpTextSectionRow[];
10
+ usage: string[];
11
+ }
12
+ export declare function formatHelpText(options: HelpTextOptions, target?: NodeJS.WriteStream): string;
13
+ //# sourceMappingURL=help-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help-text.d.ts","sourceRoot":"","sources":["../../src/lib/help-text.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAKD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,eAAe,EACxB,MAAM,GAAE,MAAM,CAAC,WAA4B,GAC1C,MAAM,CAoBR"}
@@ -0,0 +1,43 @@
1
+ import * as process from 'node:process';
2
+ import { boldLightBlue, lightYellow } from "./terminal.js";
3
+ const SECTION_INDENT = ' ';
4
+ const ROW_GAP = 2;
5
+ export function formatHelpText(options, target = process.stdout) {
6
+ let sections = [renderUsageSection(options.usage, target)];
7
+ if (options.description != null && options.description.length > 0) {
8
+ sections.push(options.description);
9
+ }
10
+ if (options.commands != null && options.commands.length > 0) {
11
+ sections.push(renderRowSection('Commands', options.commands, target));
12
+ }
13
+ if (options.options != null && options.options.length > 0) {
14
+ sections.push(renderRowSection('Options', options.options, target));
15
+ }
16
+ if (options.examples != null && options.examples.length > 0) {
17
+ sections.push(renderExamplesSection(options.examples, target));
18
+ }
19
+ return `${sections.join('\n\n')}\n`;
20
+ }
21
+ function renderUsageSection(usage, target) {
22
+ return renderSection('Usage', usage.map((line) => `${SECTION_INDENT}${highlightSyntax(line, target)}`), target);
23
+ }
24
+ function renderExamplesSection(examples, target) {
25
+ return renderSection('Examples', examples.map((line) => `${SECTION_INDENT}${highlightSyntax(line, target)}`), target);
26
+ }
27
+ function renderRowSection(title, rows, target) {
28
+ let labelWidth = rows.reduce((width, row) => Math.max(width, row.label.length), 0) + ROW_GAP;
29
+ let lines = rows.map((row) => {
30
+ let paddedLabel = row.label.padEnd(labelWidth);
31
+ return `${SECTION_INDENT}${highlightSyntax(paddedLabel, target)}${row.description}`;
32
+ });
33
+ return renderSection(title, lines, target);
34
+ }
35
+ function renderSection(title, lines, target) {
36
+ return `${formatHeading(title, target)}:\n${lines.join('\n')}`;
37
+ }
38
+ function formatHeading(title, target) {
39
+ return boldLightBlue(title, target);
40
+ }
41
+ function highlightSyntax(text, target) {
42
+ return text.replace(/(--[A-Za-z0-9-]+|-[A-Za-z]|\[[A-Za-z][A-Za-z0-9-]*\]|<[^>\n]+>)/g, (token) => lightYellow(token, target));
43
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=load-route-map-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-route-map-worker.d.ts","sourceRoot":"","sources":["../../src/lib/load-route-map-worker.ts"],"names":[],"mappings":""}