@iksdev/shard-cli 0.1.44 → 0.1.45

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 (2) hide show
  1. package/bin/shard.js +34 -7
  2. package/package.json +1 -1
package/bin/shard.js CHANGED
@@ -1144,7 +1144,7 @@ async function syncFolder(positionals, flags) {
1144
1144
  }
1145
1145
  }
1146
1146
 
1147
- async function main() {
1147
+ async function main() {
1148
1148
  const { command, positionals, flags } = parseArgs(process.argv.slice(2));
1149
1149
 
1150
1150
  // Vérifie la mise à jour à chaque commande (sauf --help)
@@ -1212,10 +1212,37 @@ async function main() {
1212
1212
  throw new Error('Usage: shard config show | shard config set-server <url>');
1213
1213
  }
1214
1214
 
1215
- throw new Error(`Commande inconnue: ${command}`);
1216
- }
1217
-
1218
- main().catch((error) => {
1219
- console.error(`Erreur: ${error.message}`);
1220
- process.exitCode = 1;
1215
+ throw new Error(`Commande inconnue: ${command}`);
1216
+ }
1217
+
1218
+ function printPlanLimitBox(error) {
1219
+ const data = error?.data || {};
1220
+ const plan = String(data.plan || '').toUpperCase() || 'FREE';
1221
+ const maxFileSize = Number(data.maxFileSize || 0);
1222
+ const fileSize = Number(data.fileSize || 0);
1223
+ const maxLabel = maxFileSize > 0 ? formatBytes(maxFileSize) : '?';
1224
+ const fileLabel = fileSize > 0 ? formatBytes(fileSize) : '?';
1225
+ const lines = [
1226
+ '',
1227
+ '╔════════════════════════════════════════════════════╗',
1228
+ `║ ⚠ Limite du plan ${plan}`.padEnd(52) + ' ║',
1229
+ '╠════════════════════════════════════════════════════╣',
1230
+ `║ Taille fichier : ${fileLabel}`.padEnd(52) + ' ║',
1231
+ `║ Limite max : ${maxLabel} / fichier`.padEnd(52) + ' ║',
1232
+ '║ ║',
1233
+ '║ Passe a une offre superieure pour continuer. ║',
1234
+ '╚════════════════════════════════════════════════════╝',
1235
+ ''
1236
+ ];
1237
+ console.error(lines.join('\n'));
1238
+ }
1239
+
1240
+ main().catch((error) => {
1241
+ if (error?.data?.code === 'PLAN_FILE_LIMIT_EXCEEDED') {
1242
+ printPlanLimitBox(error);
1243
+ process.exitCode = 1;
1244
+ return;
1245
+ }
1246
+ console.error(`Erreur: ${error.message}`);
1247
+ process.exitCode = 1;
1221
1248
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iksdev/shard-cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "CLI pour synchroniser un dossier local avec Shard",
5
5
  "bin": {
6
6
  "shard": "bin/shard.js"