@@ -34,7 +34,13 @@ const rootCommand = Command.make('ping-lf').pipe(
3434 Command . withDescription (
3535 'CLI for initializing, scaffolding, and updating Ping Login Widget and Login App custom component projects.' ,
3636 ) ,
37- Command . withSubcommands ( [ initCommand , generateCommand , updateCommand , releasesCommand , mcpCommand ] ) ,
37+ Command . withSubcommands ( [
38+ initCommand ,
39+ generateCommand ,
40+ updateCommand ,
41+ releasesCommand ,
42+ mcpCommand ,
43+ ] ) ,
3844) ;
3945
4046const cli = Command . run ( rootCommand , {
@@ -43,66 +49,66 @@ const cli = Command.run(rootCommand, {
4349} ) ;
4450
4551cli ( process . argv ) . pipe (
46- Effect . catchTag ( 'DirectoryConflictError' , ( err ) =>
47- Console . error (
48- `\nError: "${ err . path } " already contains a framework project.` +
49- `\n Did you mean to use --local?\n` +
50- `\n ping-lf init <new-directory> --local ${ err . path } \n` ,
51- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
52- ) ,
53- Effect . catchTag ( 'DirectoryNotEmptyError' , ( err ) =>
54- Console . error (
55- `\nError: "${ err . path } " already exists and is not empty.` +
56- `\n Choose a different directory name, or delete the existing directory first.\n` ,
57- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
58- ) ,
59- Effect . catchTag ( 'ReleaseNetworkError' , ( err ) =>
60- Console . error (
61- `\nError: Could not reach GitHub to download the release.\n` +
62- ` ${ err . cause } \n\n` +
63- ` • Check your network connection and try again.\n` +
64- ` • Use a local path: ping-lf init <dir> --local <path>\n` +
65- ` • Specify a version: ping-lf init <dir> --version v1.0.0\n` ,
66- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
67- ) ,
68- Effect . catchTag ( 'ReleaseParseError' , ( err ) =>
69- Console . error ( `\nError: Failed to parse the release data.\n ${ err . cause } \n` ) . pipe (
70- Effect . andThen ( Effect . die ( err ) ) ,
71- ) ,
72- ) ,
73- Effect . catchTag ( 'ReleaseFsError' , ( err ) =>
74- Console . error (
75- `\nError: Filesystem error during release download (${ err . operation } ).\n ${ err . cause } \n` ,
76- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
77- ) ,
78- Effect . catchTag ( 'InvalidVersionError' , ( err ) =>
79- Console . error (
80- `\nError: "${ err . version } " is not a valid version tag.\n` +
81- ` Expected semver format like v1.0.0.\n` +
82- ` Use "ping-lf releases" to list available versions.\n` ,
83- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
84- ) ,
85- Effect . catchTag ( 'ReleaseNotFoundError' , ( err ) =>
86- Console . error (
87- `\nError: No releases found on GitHub.` +
88- ( err . cause ? `\n ${ err . cause } ` : '' ) +
89- `\n\n • Check your network connection and try again.\n` +
90- ` • Use a local path: ping-lf init <dir> --local <path>\n` ,
91- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
92- ) ,
93- Effect . catchTag ( 'InvalidComponentNameError' , ( err ) =>
94- Console . error (
95- `\nError: "${ err . name } " is not a valid component name.\n` +
96- ` Names must be PascalCase, start with an uppercase letter, and contain only letters and digits.\n` +
97- ` Examples: MyCallback, JWTLogin, DefaultStage\n` ,
98- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
99- ) ,
100- Effect . catchTag ( 'ComponentAlreadyExistsError' , ( err ) =>
101- Console . error (
102- `\nError: component directory already exists: ${ err . path } \n` +
103- ` Choose a different name or delete the existing directory first.\n` ,
104- ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
52+ Effect . catchTag ( 'DirectoryConflictError' , ( err ) =>
53+ Console . error (
54+ `\nError: "${ err . path } " already contains a framework project.` +
55+ `\n Did you mean to use --local?\n` +
56+ `\n ping-lf init <new-directory> --local ${ err . path } \n` ,
57+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
58+ ) ,
59+ Effect . catchTag ( 'DirectoryNotEmptyError' , ( err ) =>
60+ Console . error (
61+ `\nError: "${ err . path } " already exists and is not empty.` +
62+ `\n Choose a different directory name, or delete the existing directory first.\n` ,
63+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
64+ ) ,
65+ Effect . catchTag ( 'ReleaseNetworkError' , ( err ) =>
66+ Console . error (
67+ `\nError: Could not reach GitHub to download the release.\n` +
68+ ` ${ err . cause } \n\n` +
69+ ` • Check your network connection and try again.\n` +
70+ ` • Use a local path: ping-lf init <dir> --local <path>\n` +
71+ ` • Specify a version: ping-lf init <dir> --version v1.0.0\n` ,
72+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
73+ ) ,
74+ Effect . catchTag ( 'ReleaseParseError' , ( err ) =>
75+ Console . error ( `\nError: Failed to parse the release data.\n ${ err . cause } \n` ) . pipe (
76+ Effect . andThen ( Effect . die ( err ) ) ,
10577 ) ,
106- Effect . provide ( Layer . mergeAll ( GithubReleaseLayer , NodeContext . layer ) ) ,
107- ( effect ) => NodeRuntime . runMain ( effect , { disableErrorReporting : true } ) ,
108- ) ;
78+ ) ,
79+ Effect . catchTag ( 'ReleaseFsError' , ( err ) =>
80+ Console . error (
81+ `\nError: Filesystem error during release download (${ err . operation } ).\n ${ err . cause } \n` ,
82+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
83+ ) ,
84+ Effect . catchTag ( 'InvalidVersionError' , ( err ) =>
85+ Console . error (
86+ `\nError: "${ err . version } " is not a valid version tag.\n` +
87+ ` Expected semver format like v1.0.0.\n` +
88+ ` Use "ping-lf releases" to list available versions.\n` ,
89+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
90+ ) ,
91+ Effect . catchTag ( 'ReleaseNotFoundError' , ( err ) =>
92+ Console . error (
93+ `\nError: No releases found on GitHub.` +
94+ ( err . cause ? `\n ${ err . cause } ` : '' ) +
95+ `\n\n • Check your network connection and try again.\n` +
96+ ` • Use a local path: ping-lf init <dir> --local <path>\n` ,
97+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
98+ ) ,
99+ Effect . catchTag ( 'InvalidComponentNameError' , ( err ) =>
100+ Console . error (
101+ `\nError: "${ err . name } " is not a valid component name.\n` +
102+ ` Names must be PascalCase, start with an uppercase letter, and contain only letters and digits.\n` +
103+ ` Examples: MyCallback, JWTLogin, DefaultStage\n` ,
104+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
105+ ) ,
106+ Effect . catchTag ( 'ComponentAlreadyExistsError' , ( err ) =>
107+ Console . error (
108+ `\nError: component directory already exists: ${ err . path } \n` +
109+ ` Choose a different name or delete the existing directory first.\n` ,
110+ ) . pipe ( Effect . andThen ( Effect . die ( err ) ) ) ,
111+ ) ,
112+ Effect . provide ( Layer . mergeAll ( GithubReleaseLayer , NodeContext . layer ) ) ,
113+ ( effect ) => NodeRuntime . runMain ( effect , { disableErrorReporting : true } ) ,
114+ ) ;
0 commit comments