package-installer-cli 2.1.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f72e918ed282dcc7672ab25ea9322c87e85a9755b9cb9bff15ffce32fe1bc8cd
4
- data.tar.gz: 71e28e506ed382c98dd940c1c889695c81a39c5b1094a04a3d327cae4a656df9
3
+ metadata.gz: 7fee63393b3cf7704114ca0c5207d6e0475e1c5fb44fd0e2c97e74317f94bdc7
4
+ data.tar.gz: 3e759325940315c4529927af8ffba125ce723925bc870f5e20810a02468e7551
5
5
  SHA512:
6
- metadata.gz: f7f03374bcbcac3df390a24bc9ac7397903d41cc10391ff278c88d3487a962ee31ce84d5d18d1a7bd6785ea0c6c4e8fe5603e2450c716901eb540e991058b7a4
7
- data.tar.gz: a2d4105fca8954487b25ce1670f34166c50ee58b78c3309e571f4065cdfee54d9e258c88f3d09be361a088c88a4311c7688a4b7f9faa0d18d81be3edfeb3f0d1
6
+ metadata.gz: 386104f48713b6552b551f6b796008f86ec4e213ecfb5a612d174d68c4a478f87a849e2ab21aa61886f4798522fa8aa28577da715c7b16556dd4bdb7e92ce764
7
+ data.tar.gz: bd897e9979f5d60bfabbcf7a083b4e84519e895dd172e3b1335b81a4166c238cd2db4711fca0c0f0ef42d1a99685748272eaef04ea598419ece1b936513eb96c
@@ -28382,158 +28382,158 @@ module.exports = [
28382
28382
  /***/ 4877:
28383
28383
  /***/ ((module) => {
28384
28384
 
28385
-
28386
-
28387
- module.exports = {
28388
- "aliceblue": [240, 248, 255],
28389
- "antiquewhite": [250, 235, 215],
28390
- "aqua": [0, 255, 255],
28391
- "aquamarine": [127, 255, 212],
28392
- "azure": [240, 255, 255],
28393
- "beige": [245, 245, 220],
28394
- "bisque": [255, 228, 196],
28395
- "black": [0, 0, 0],
28396
- "blanchedalmond": [255, 235, 205],
28397
- "blue": [0, 0, 255],
28398
- "blueviolet": [138, 43, 226],
28399
- "brown": [165, 42, 42],
28400
- "burlywood": [222, 184, 135],
28401
- "cadetblue": [95, 158, 160],
28402
- "chartreuse": [127, 255, 0],
28403
- "chocolate": [210, 105, 30],
28404
- "coral": [255, 127, 80],
28405
- "cornflowerblue": [100, 149, 237],
28406
- "cornsilk": [255, 248, 220],
28407
- "crimson": [220, 20, 60],
28408
- "cyan": [0, 255, 255],
28409
- "darkblue": [0, 0, 139],
28410
- "darkcyan": [0, 139, 139],
28411
- "darkgoldenrod": [184, 134, 11],
28412
- "darkgray": [169, 169, 169],
28413
- "darkgreen": [0, 100, 0],
28414
- "darkgrey": [169, 169, 169],
28415
- "darkkhaki": [189, 183, 107],
28416
- "darkmagenta": [139, 0, 139],
28417
- "darkolivegreen": [85, 107, 47],
28418
- "darkorange": [255, 140, 0],
28419
- "darkorchid": [153, 50, 204],
28420
- "darkred": [139, 0, 0],
28421
- "darksalmon": [233, 150, 122],
28422
- "darkseagreen": [143, 188, 143],
28423
- "darkslateblue": [72, 61, 139],
28424
- "darkslategray": [47, 79, 79],
28425
- "darkslategrey": [47, 79, 79],
28426
- "darkturquoise": [0, 206, 209],
28427
- "darkviolet": [148, 0, 211],
28428
- "deeppink": [255, 20, 147],
28429
- "deepskyblue": [0, 191, 255],
28430
- "dimgray": [105, 105, 105],
28431
- "dimgrey": [105, 105, 105],
28432
- "dodgerblue": [30, 144, 255],
28433
- "firebrick": [178, 34, 34],
28434
- "floralwhite": [255, 250, 240],
28435
- "forestgreen": [34, 139, 34],
28436
- "fuchsia": [255, 0, 255],
28437
- "gainsboro": [220, 220, 220],
28438
- "ghostwhite": [248, 248, 255],
28439
- "gold": [255, 215, 0],
28440
- "goldenrod": [218, 165, 32],
28441
- "gray": [128, 128, 128],
28442
- "green": [0, 128, 0],
28443
- "greenyellow": [173, 255, 47],
28444
- "grey": [128, 128, 128],
28445
- "honeydew": [240, 255, 240],
28446
- "hotpink": [255, 105, 180],
28447
- "indianred": [205, 92, 92],
28448
- "indigo": [75, 0, 130],
28449
- "ivory": [255, 255, 240],
28450
- "khaki": [240, 230, 140],
28451
- "lavender": [230, 230, 250],
28452
- "lavenderblush": [255, 240, 245],
28453
- "lawngreen": [124, 252, 0],
28454
- "lemonchiffon": [255, 250, 205],
28455
- "lightblue": [173, 216, 230],
28456
- "lightcoral": [240, 128, 128],
28457
- "lightcyan": [224, 255, 255],
28458
- "lightgoldenrodyellow": [250, 250, 210],
28459
- "lightgray": [211, 211, 211],
28460
- "lightgreen": [144, 238, 144],
28461
- "lightgrey": [211, 211, 211],
28462
- "lightpink": [255, 182, 193],
28463
- "lightsalmon": [255, 160, 122],
28464
- "lightseagreen": [32, 178, 170],
28465
- "lightskyblue": [135, 206, 250],
28466
- "lightslategray": [119, 136, 153],
28467
- "lightslategrey": [119, 136, 153],
28468
- "lightsteelblue": [176, 196, 222],
28469
- "lightyellow": [255, 255, 224],
28470
- "lime": [0, 255, 0],
28471
- "limegreen": [50, 205, 50],
28472
- "linen": [250, 240, 230],
28473
- "magenta": [255, 0, 255],
28474
- "maroon": [128, 0, 0],
28475
- "mediumaquamarine": [102, 205, 170],
28476
- "mediumblue": [0, 0, 205],
28477
- "mediumorchid": [186, 85, 211],
28478
- "mediumpurple": [147, 112, 219],
28479
- "mediumseagreen": [60, 179, 113],
28480
- "mediumslateblue": [123, 104, 238],
28481
- "mediumspringgreen": [0, 250, 154],
28482
- "mediumturquoise": [72, 209, 204],
28483
- "mediumvioletred": [199, 21, 133],
28484
- "midnightblue": [25, 25, 112],
28485
- "mintcream": [245, 255, 250],
28486
- "mistyrose": [255, 228, 225],
28487
- "moccasin": [255, 228, 181],
28488
- "navajowhite": [255, 222, 173],
28489
- "navy": [0, 0, 128],
28490
- "oldlace": [253, 245, 230],
28491
- "olive": [128, 128, 0],
28492
- "olivedrab": [107, 142, 35],
28493
- "orange": [255, 165, 0],
28494
- "orangered": [255, 69, 0],
28495
- "orchid": [218, 112, 214],
28496
- "palegoldenrod": [238, 232, 170],
28497
- "palegreen": [152, 251, 152],
28498
- "paleturquoise": [175, 238, 238],
28499
- "palevioletred": [219, 112, 147],
28500
- "papayawhip": [255, 239, 213],
28501
- "peachpuff": [255, 218, 185],
28502
- "peru": [205, 133, 63],
28503
- "pink": [255, 192, 203],
28504
- "plum": [221, 160, 221],
28505
- "powderblue": [176, 224, 230],
28506
- "purple": [128, 0, 128],
28507
- "rebeccapurple": [102, 51, 153],
28508
- "red": [255, 0, 0],
28509
- "rosybrown": [188, 143, 143],
28510
- "royalblue": [65, 105, 225],
28511
- "saddlebrown": [139, 69, 19],
28512
- "salmon": [250, 128, 114],
28513
- "sandybrown": [244, 164, 96],
28514
- "seagreen": [46, 139, 87],
28515
- "seashell": [255, 245, 238],
28516
- "sienna": [160, 82, 45],
28517
- "silver": [192, 192, 192],
28518
- "skyblue": [135, 206, 235],
28519
- "slateblue": [106, 90, 205],
28520
- "slategray": [112, 128, 144],
28521
- "slategrey": [112, 128, 144],
28522
- "snow": [255, 250, 250],
28523
- "springgreen": [0, 255, 127],
28524
- "steelblue": [70, 130, 180],
28525
- "tan": [210, 180, 140],
28526
- "teal": [0, 128, 128],
28527
- "thistle": [216, 191, 216],
28528
- "tomato": [255, 99, 71],
28529
- "turquoise": [64, 224, 208],
28530
- "violet": [238, 130, 238],
28531
- "wheat": [245, 222, 179],
28532
- "white": [255, 255, 255],
28533
- "whitesmoke": [245, 245, 245],
28534
- "yellow": [255, 255, 0],
28535
- "yellowgreen": [154, 205, 50]
28536
- };
28385
+
28386
+
28387
+ module.exports = {
28388
+ "aliceblue": [240, 248, 255],
28389
+ "antiquewhite": [250, 235, 215],
28390
+ "aqua": [0, 255, 255],
28391
+ "aquamarine": [127, 255, 212],
28392
+ "azure": [240, 255, 255],
28393
+ "beige": [245, 245, 220],
28394
+ "bisque": [255, 228, 196],
28395
+ "black": [0, 0, 0],
28396
+ "blanchedalmond": [255, 235, 205],
28397
+ "blue": [0, 0, 255],
28398
+ "blueviolet": [138, 43, 226],
28399
+ "brown": [165, 42, 42],
28400
+ "burlywood": [222, 184, 135],
28401
+ "cadetblue": [95, 158, 160],
28402
+ "chartreuse": [127, 255, 0],
28403
+ "chocolate": [210, 105, 30],
28404
+ "coral": [255, 127, 80],
28405
+ "cornflowerblue": [100, 149, 237],
28406
+ "cornsilk": [255, 248, 220],
28407
+ "crimson": [220, 20, 60],
28408
+ "cyan": [0, 255, 255],
28409
+ "darkblue": [0, 0, 139],
28410
+ "darkcyan": [0, 139, 139],
28411
+ "darkgoldenrod": [184, 134, 11],
28412
+ "darkgray": [169, 169, 169],
28413
+ "darkgreen": [0, 100, 0],
28414
+ "darkgrey": [169, 169, 169],
28415
+ "darkkhaki": [189, 183, 107],
28416
+ "darkmagenta": [139, 0, 139],
28417
+ "darkolivegreen": [85, 107, 47],
28418
+ "darkorange": [255, 140, 0],
28419
+ "darkorchid": [153, 50, 204],
28420
+ "darkred": [139, 0, 0],
28421
+ "darksalmon": [233, 150, 122],
28422
+ "darkseagreen": [143, 188, 143],
28423
+ "darkslateblue": [72, 61, 139],
28424
+ "darkslategray": [47, 79, 79],
28425
+ "darkslategrey": [47, 79, 79],
28426
+ "darkturquoise": [0, 206, 209],
28427
+ "darkviolet": [148, 0, 211],
28428
+ "deeppink": [255, 20, 147],
28429
+ "deepskyblue": [0, 191, 255],
28430
+ "dimgray": [105, 105, 105],
28431
+ "dimgrey": [105, 105, 105],
28432
+ "dodgerblue": [30, 144, 255],
28433
+ "firebrick": [178, 34, 34],
28434
+ "floralwhite": [255, 250, 240],
28435
+ "forestgreen": [34, 139, 34],
28436
+ "fuchsia": [255, 0, 255],
28437
+ "gainsboro": [220, 220, 220],
28438
+ "ghostwhite": [248, 248, 255],
28439
+ "gold": [255, 215, 0],
28440
+ "goldenrod": [218, 165, 32],
28441
+ "gray": [128, 128, 128],
28442
+ "green": [0, 128, 0],
28443
+ "greenyellow": [173, 255, 47],
28444
+ "grey": [128, 128, 128],
28445
+ "honeydew": [240, 255, 240],
28446
+ "hotpink": [255, 105, 180],
28447
+ "indianred": [205, 92, 92],
28448
+ "indigo": [75, 0, 130],
28449
+ "ivory": [255, 255, 240],
28450
+ "khaki": [240, 230, 140],
28451
+ "lavender": [230, 230, 250],
28452
+ "lavenderblush": [255, 240, 245],
28453
+ "lawngreen": [124, 252, 0],
28454
+ "lemonchiffon": [255, 250, 205],
28455
+ "lightblue": [173, 216, 230],
28456
+ "lightcoral": [240, 128, 128],
28457
+ "lightcyan": [224, 255, 255],
28458
+ "lightgoldenrodyellow": [250, 250, 210],
28459
+ "lightgray": [211, 211, 211],
28460
+ "lightgreen": [144, 238, 144],
28461
+ "lightgrey": [211, 211, 211],
28462
+ "lightpink": [255, 182, 193],
28463
+ "lightsalmon": [255, 160, 122],
28464
+ "lightseagreen": [32, 178, 170],
28465
+ "lightskyblue": [135, 206, 250],
28466
+ "lightslategray": [119, 136, 153],
28467
+ "lightslategrey": [119, 136, 153],
28468
+ "lightsteelblue": [176, 196, 222],
28469
+ "lightyellow": [255, 255, 224],
28470
+ "lime": [0, 255, 0],
28471
+ "limegreen": [50, 205, 50],
28472
+ "linen": [250, 240, 230],
28473
+ "magenta": [255, 0, 255],
28474
+ "maroon": [128, 0, 0],
28475
+ "mediumaquamarine": [102, 205, 170],
28476
+ "mediumblue": [0, 0, 205],
28477
+ "mediumorchid": [186, 85, 211],
28478
+ "mediumpurple": [147, 112, 219],
28479
+ "mediumseagreen": [60, 179, 113],
28480
+ "mediumslateblue": [123, 104, 238],
28481
+ "mediumspringgreen": [0, 250, 154],
28482
+ "mediumturquoise": [72, 209, 204],
28483
+ "mediumvioletred": [199, 21, 133],
28484
+ "midnightblue": [25, 25, 112],
28485
+ "mintcream": [245, 255, 250],
28486
+ "mistyrose": [255, 228, 225],
28487
+ "moccasin": [255, 228, 181],
28488
+ "navajowhite": [255, 222, 173],
28489
+ "navy": [0, 0, 128],
28490
+ "oldlace": [253, 245, 230],
28491
+ "olive": [128, 128, 0],
28492
+ "olivedrab": [107, 142, 35],
28493
+ "orange": [255, 165, 0],
28494
+ "orangered": [255, 69, 0],
28495
+ "orchid": [218, 112, 214],
28496
+ "palegoldenrod": [238, 232, 170],
28497
+ "palegreen": [152, 251, 152],
28498
+ "paleturquoise": [175, 238, 238],
28499
+ "palevioletred": [219, 112, 147],
28500
+ "papayawhip": [255, 239, 213],
28501
+ "peachpuff": [255, 218, 185],
28502
+ "peru": [205, 133, 63],
28503
+ "pink": [255, 192, 203],
28504
+ "plum": [221, 160, 221],
28505
+ "powderblue": [176, 224, 230],
28506
+ "purple": [128, 0, 128],
28507
+ "rebeccapurple": [102, 51, 153],
28508
+ "red": [255, 0, 0],
28509
+ "rosybrown": [188, 143, 143],
28510
+ "royalblue": [65, 105, 225],
28511
+ "saddlebrown": [139, 69, 19],
28512
+ "salmon": [250, 128, 114],
28513
+ "sandybrown": [244, 164, 96],
28514
+ "seagreen": [46, 139, 87],
28515
+ "seashell": [255, 245, 238],
28516
+ "sienna": [160, 82, 45],
28517
+ "silver": [192, 192, 192],
28518
+ "skyblue": [135, 206, 235],
28519
+ "slateblue": [106, 90, 205],
28520
+ "slategray": [112, 128, 144],
28521
+ "slategrey": [112, 128, 144],
28522
+ "snow": [255, 250, 250],
28523
+ "springgreen": [0, 255, 127],
28524
+ "steelblue": [70, 130, 180],
28525
+ "tan": [210, 180, 140],
28526
+ "teal": [0, 128, 128],
28527
+ "thistle": [216, 191, 216],
28528
+ "tomato": [255, 99, 71],
28529
+ "turquoise": [64, 224, 208],
28530
+ "violet": [238, 130, 238],
28531
+ "wheat": [245, 222, 179],
28532
+ "white": [255, 255, 255],
28533
+ "whitesmoke": [245, 245, 245],
28534
+ "yellow": [255, 255, 0],
28535
+ "yellowgreen": [154, 205, 50]
28536
+ };
28537
28537
 
28538
28538
 
28539
28539
  /***/ }),
@@ -51925,7 +51925,7 @@ async function createProjectFromTemplate(options) {
51925
51925
  if (projectName === '.') {
51926
51926
  projectPath = process.cwd();
51927
51927
  actualProjectName = external_path_.basename(process.cwd());
51928
- // Check if current directory is empty
51928
+ // Check if current directory is empty (allow if user is already in intended dir)
51929
51929
  const currentDirContents = await fs_extra_lib.readdir(projectPath);
51930
51930
  if (currentDirContents.length > 0) {
51931
51931
  const hasImportantFiles = currentDirContents.some(file => !file.startsWith('.') && file !== 'node_modules');
@@ -51958,8 +51958,56 @@ async function createProjectFromTemplate(options) {
51958
51958
  // Copy template files with filtering
51959
51959
  spinner.text = source/* default */.Ay.hex('#00d2d3')('Copying template files...');
51960
51960
  if (projectName === '.') {
51961
- // Copy files directly to current directory
51962
- await copyTemplateFilesToCurrentDir(templatePath, projectPath);
51961
+ // If template has a single top-level directory, copy its contents into current dir
51962
+ const nonSystemFiles = templateContents.filter(item => !item.startsWith('.') &&
51963
+ item !== 'node_modules' &&
51964
+ item !== 'dist' &&
51965
+ item !== 'build');
51966
+ if (nonSystemFiles.length === 1) {
51967
+ const singleItem = nonSystemFiles[0];
51968
+ const singleItemPath = external_path_.join(templatePath, singleItem);
51969
+ const stats = await fs_extra_lib.stat(singleItemPath);
51970
+ if (stats.isDirectory()) {
51971
+ await fs_extra_lib.copy(singleItemPath, projectPath, {
51972
+ filter: (src) => {
51973
+ const fileName = external_path_.basename(src);
51974
+ if (fileName === '.DS_Store' || fileName === 'Thumbs.db' || fileName === '.gitkeep')
51975
+ return false;
51976
+ const rel = external_path_.relative(singleItemPath, src);
51977
+ if (rel.split(external_path_.sep).includes('node_modules') || rel.split(external_path_.sep).includes('.git') || rel.split(external_path_.sep).includes('dist') || rel.split(external_path_.sep).includes('build') || rel.split(external_path_.sep).includes('.next'))
51978
+ return false;
51979
+ return true;
51980
+ }
51981
+ });
51982
+ }
51983
+ else {
51984
+ // Single file, just copy it
51985
+ await fs_extra_lib.copy(singleItemPath, external_path_.join(projectPath, singleItem));
51986
+ }
51987
+ }
51988
+ else {
51989
+ // Multiple items in template root, copy all to current dir
51990
+ for (const item of templateContents) {
51991
+ const sourcePath = external_path_.join(templatePath, item);
51992
+ const destPath = external_path_.join(projectPath, item);
51993
+ const stats = await fs_extra_lib.stat(sourcePath);
51994
+ if (stats.isDirectory()) {
51995
+ if (item === 'node_modules' || item === '.git' || item === 'dist' || item === 'build' || item === '.next')
51996
+ continue;
51997
+ await fs_extra_lib.copy(sourcePath, destPath, {
51998
+ filter: (src) => {
51999
+ const fileName = external_path_.basename(src);
52000
+ return fileName !== '.DS_Store' && fileName !== 'Thumbs.db' && fileName !== '.gitkeep';
52001
+ }
52002
+ });
52003
+ }
52004
+ else {
52005
+ if (item === '.DS_Store' || item === 'Thumbs.db' || item === '.gitkeep')
52006
+ continue;
52007
+ await fs_extra_lib.copy(sourcePath, destPath);
52008
+ }
52009
+ }
52010
+ }
51963
52011
  }
51964
52012
  else {
51965
52013
  // Create directory and copy files
@@ -52046,20 +52094,46 @@ async function copyTemplateFiles(templatePath, projectPath) {
52046
52094
  * Copy template files to current directory (for "." project name)
52047
52095
  */
52048
52096
  async function copyTemplateFilesToCurrentDir(templatePath, projectPath) {
52049
- const templateContents = await fs_extra_lib.readdir(templatePath);
52097
+ const templateContents = await fs.readdir(templatePath);
52098
+ // Filter out system and unwanted files/directories
52099
+ const nonSystemFiles = templateContents.filter(item => !item.startsWith('.') &&
52100
+ item !== 'node_modules' &&
52101
+ item !== 'dist' &&
52102
+ item !== 'build');
52103
+ // If the template has a single top-level directory, copy its contents into current dir
52104
+ if (nonSystemFiles.length === 1) {
52105
+ const singleItem = nonSystemFiles[0];
52106
+ const singleItemPath = path.join(templatePath, singleItem);
52107
+ const stats = await fs.stat(singleItemPath);
52108
+ if (stats.isDirectory()) {
52109
+ await fs.copy(singleItemPath, projectPath, {
52110
+ filter: (src) => {
52111
+ const fileName = path.basename(src);
52112
+ if (fileName === '.DS_Store' || fileName === 'Thumbs.db' || fileName === '.gitkeep')
52113
+ return false;
52114
+ // Skip unwanted directories inside the template
52115
+ const rel = path.relative(singleItemPath, src);
52116
+ if (rel.split(path.sep).includes('node_modules') || rel.split(path.sep).includes('.git') || rel.split(path.sep).includes('dist') || rel.split(path.sep).includes('build') || rel.split(path.sep).includes('.next'))
52117
+ return false;
52118
+ return true;
52119
+ }
52120
+ });
52121
+ return;
52122
+ }
52123
+ }
52050
52124
  for (const item of templateContents) {
52051
- const sourcePath = external_path_.join(templatePath, item);
52052
- const destPath = external_path_.join(projectPath, item);
52053
- const stats = await fs_extra_lib.stat(sourcePath);
52125
+ const sourcePath = path.join(templatePath, item);
52126
+ const destPath = path.join(projectPath, item);
52127
+ const stats = await fs.stat(sourcePath);
52054
52128
  if (stats.isDirectory()) {
52055
52129
  // Skip common directories that shouldn't be copied
52056
52130
  if (item === 'node_modules' || item === '.git' ||
52057
52131
  item === 'dist' || item === 'build' || item === '.next') {
52058
52132
  continue;
52059
52133
  }
52060
- await fs_extra_lib.copy(sourcePath, destPath, {
52134
+ await fs.copy(sourcePath, destPath, {
52061
52135
  filter: (src) => {
52062
- const fileName = external_path_.basename(src);
52136
+ const fileName = path.basename(src);
52063
52137
  return fileName !== '.DS_Store' && fileName !== 'Thumbs.db' && fileName !== '.gitkeep';
52064
52138
  }
52065
52139
  });
@@ -52069,7 +52143,7 @@ async function copyTemplateFilesToCurrentDir(templatePath, projectPath) {
52069
52143
  if (item === '.DS_Store' || item === 'Thumbs.db' || item === '.gitkeep') {
52070
52144
  continue;
52071
52145
  }
52072
- await fs_extra_lib.copy(sourcePath, destPath);
52146
+ await fs.copy(sourcePath, destPath);
52073
52147
  }
52074
52148
  }
52075
52149
  }
@@ -69028,7 +69102,7 @@ class AuthStore {
69028
69102
  if (!rec)
69029
69103
  throw new Error('User not found');
69030
69104
  if (rec.verified)
69031
- return true; // No limit for verified
69105
+ return true; // No limit for verified users
69032
69106
  if (typeof rec.usageCount !== 'number')
69033
69107
  rec.usageCount = 0;
69034
69108
  if (typeof rec.usageLimit !== 'number')
@@ -69039,7 +69113,6 @@ class AuthStore {
69039
69113
  await this.save();
69040
69114
  return true;
69041
69115
  }
69042
- // Reset usage when user is verified
69043
69116
  async verifyUser(email, password) {
69044
69117
  const record = this.records.find(r => r.email === email.toLowerCase());
69045
69118
  if (!record)
@@ -69074,10 +69147,11 @@ class AuthStore {
69074
69147
  }
69075
69148
  async login(email, password) {
69076
69149
  const ok = await this.verifyUser(email, password);
69077
- if (!ok)
69078
- return false;
69150
+ return !!ok;
69151
+ }
69152
+ // Create a session file for an already-verified authentication (does not verify password)
69153
+ async createSession(email) {
69079
69154
  await fs_extra_lib.writeJson(this.sessionFile, { email: email.toLowerCase(), loggedAt: new Date().toISOString() }, { spaces: 2 });
69080
- return true;
69081
69155
  }
69082
69156
  async logout() {
69083
69157
  if (await fs_extra_lib.pathExists(this.sessionFile)) {
@@ -69114,10 +69188,6 @@ class AuthStore {
69114
69188
  if (!rec)
69115
69189
  throw new Error('User not found');
69116
69190
  rec.verified = verified;
69117
- if (verified) {
69118
- rec.usageCount = undefined;
69119
- rec.usageLimit = undefined;
69120
- }
69121
69191
  await this.save();
69122
69192
  }
69123
69193
  async getTotpSecret(email) {
@@ -69145,10 +69215,11 @@ var main = __webpack_require__(6273);
69145
69215
 
69146
69216
 
69147
69217
 
69218
+
69148
69219
  async function setupTotp(email) {
69149
69220
  // Generate TOTP secret
69150
69221
  const secret = otplib.authenticator.generateSecret();
69151
- const otpauth = otplib.authenticator.keyuri(email, 'PackageInstallerCLI', secret);
69222
+ const otpauth = otplib.authenticator.keyuri(email, 'Package-Installer-CLI', secret);
69152
69223
  // Show QR code in terminal
69153
69224
  console.log(source/* default */.Ay.cyan('\nScan this QR code with Google Authenticator or a compatible app:'));
69154
69225
  main.generate(otpauth, { small: true });
@@ -69183,7 +69254,7 @@ async function setupAndVerifyTotp(email) {
69183
69254
  async function interactiveRegister() {
69184
69255
  const { email, password, confirm } = await lib["default"].prompt([
69185
69256
  { name: 'email', message: 'Email:', type: 'input', validate: (v) => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v) || 'Enter a valid email' },
69186
- { name: 'password', message: 'Password (min 8 chars):', type: 'password', mask: '*', validate: (v) => v.length >= 8 || 'Password must be at least 8 characters' },
69257
+ { name: 'password', message: 'Password (min 8 chars):', type: 'password', validate: (v) => v.length >= 8 || 'Password must be at least 8 characters' },
69187
69258
  { name: 'confirm', message: 'Confirm Password:', type: 'password', mask: '*' },
69188
69259
  ]);
69189
69260
  if (password !== confirm) {
@@ -69192,15 +69263,16 @@ async function interactiveRegister() {
69192
69263
  }
69193
69264
  let created = false;
69194
69265
  try {
69266
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.bold('Registering new user'), { padding: 1, borderColor: 'green' }));
69195
69267
  await authStore_authStore.createUser(email, password);
69196
69268
  created = true;
69197
69269
  }
69198
69270
  catch (err) {
69199
69271
  if (err.message && err.message.includes('already exists')) {
69200
- console.log(source/* default */.Ay.red('User already exists. Please login or use a different email.'));
69272
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.red('User already exists. Please login or use a different email.'), { padding: 1, borderColor: 'red' }));
69201
69273
  return;
69202
69274
  }
69203
- console.log(source/* default */.Ay.red(''), err.message || String(err));
69275
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.red('Registration failed: ' + (err.message || String(err))), { padding: 1, borderColor: 'red' }));
69204
69276
  return;
69205
69277
  }
69206
69278
  // Suggest 2FA setup
@@ -69208,26 +69280,28 @@ async function interactiveRegister() {
69208
69280
  { name: 'enable2fa', type: 'confirm', message: 'Would you like to enable 2FA (recommended)?', default: true }
69209
69281
  ]);
69210
69282
  if (enable2fa) {
69211
- await setupAndVerifyTotp(email);
69283
+ console.log(source/* default */.Ay.gray('Setting up 2FA...'));
69284
+ const verified = await setupAndVerifyTotp(email);
69285
+ if (!verified) {
69286
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.yellow('2FA setup incomplete. You can enable it later with: pi auth verify'), { padding: 1 }));
69287
+ }
69212
69288
  }
69213
69289
  else {
69214
- console.log(source/* default */.Ay.yellow('⚠️ 2FA is not enabled. You can enable it anytime with: pi auth verify'));
69290
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.yellow('⚠️ 2FA is not enabled. You can enable it anytime with: pi auth verify'), { padding: 1 }));
69215
69291
  }
69216
69292
  // Always auto-login after registration if user was created
69217
69293
  if (created) {
69218
- const ok = await authStore_authStore.login(email, password);
69219
- if (ok) {
69220
- console.log(source/* default */.Ay.green('✅ User registered and logged in.'));
69221
- }
69222
- else {
69223
- console.log(source/* default */.Ay.yellow('User registered, but auto-login failed. Please login manually.'));
69224
- }
69294
+ // Create session (auto-login)
69295
+ await authStore_authStore.createSession(email);
69296
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.green('✅ Registered and logged in — welcome!'), { padding: 1, borderColor: 'green' }));
69297
+ if (!enable2fa)
69298
+ console.log(source/* default */.Ay.yellow('Note: 2FA not enabled. Enable with: pi auth verify'));
69225
69299
  }
69226
69300
  }
69227
69301
  async function interactiveLogin() {
69228
69302
  const responses = await inquirer.prompt([
69229
69303
  { name: 'email', message: 'Email:', type: 'input', validate: (v) => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v) || 'Enter a valid email' },
69230
- { name: 'password', message: 'Password:', type: 'password', mask: '*', validate: (v) => v.length >= 8 || 'Password must be at least 8 characters' },
69304
+ { name: 'password', message: 'Password:', type: 'password', validate: (v) => v.length >= 8 || 'Password must be at least 8 characters' },
69231
69305
  ]);
69232
69306
  const { email, password } = responses;
69233
69307
  try {
@@ -69287,28 +69361,42 @@ async function handleAuthOptions(subcommand, value, opts = {}) {
69287
69361
  console.log(source/* default */.Ay.red('❌ Invalid email or password'));
69288
69362
  return;
69289
69363
  }
69290
- // Check verification
69364
+ // Check verification and handle totp provided for non-interactive flows
69291
69365
  const secret = await authStore_authStore.getTotpSecret(opts.email);
69292
69366
  const isVerified = await authStore_authStore.isVerified(opts.email);
69293
69367
  if (!secret) {
69294
69368
  console.log(source/* default */.Ay.red('❌ This account does not have 2FA set up. Please register again.'));
69295
- await authStore_authStore.logout();
69296
69369
  return;
69297
69370
  }
69298
69371
  if (!isVerified) {
69299
- console.log(source/* default */.Ay.red('❌ This account is not verified. Please complete TOTP verification during registration.'));
69300
- await authStore_authStore.logout();
69372
+ console.log(source/* default */.Ay.red('❌ This account is not verified. Please complete TOTP verification with: pi auth verify'));
69301
69373
  return;
69302
69374
  }
69303
- // Prompt for TOTP code
69304
- const { code } = await lib["default"].prompt([
69305
- { name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }
69306
- ]);
69307
- if (!otplib.authenticator.check(code, secret)) {
69308
- console.log(source/* default */.Ay.red('❌ Invalid code. Login aborted.'));
69309
- await authStore_authStore.logout();
69310
- return;
69375
+ // TOTP: allow up to 3 interactive attempts. If --totp provided, use it (single check).
69376
+ let code = opts.totp;
69377
+ if (code) {
69378
+ if (!otplib.authenticator.check(code, secret)) {
69379
+ console.log(source/* default */.Ay.red('❌ Invalid TOTP code provided. Login failed.'));
69380
+ return;
69381
+ }
69311
69382
  }
69383
+ else {
69384
+ let ok = false;
69385
+ for (let i = 0; i < 3; ++i) {
69386
+ const resp = await lib["default"].prompt([{ name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }]);
69387
+ if (otplib.authenticator.check(resp.code, secret)) {
69388
+ ok = true;
69389
+ break;
69390
+ }
69391
+ console.log(source/* default */.Ay.red('❌ Invalid code. Try again.'));
69392
+ }
69393
+ if (!ok) {
69394
+ console.log(source/* default */.Ay.red('❌ Too many invalid attempts. Login failed.'));
69395
+ return;
69396
+ }
69397
+ }
69398
+ // Create session now that password and 2FA are verified
69399
+ await authStore_authStore.createSession(opts.email);
69312
69400
  console.log(source/* default */.Ay.green('✅ Logged in successfully'));
69313
69401
  }
69314
69402
  catch (err) {
@@ -69335,22 +69423,27 @@ async function handleAuthOptions(subcommand, value, opts = {}) {
69335
69423
  const isVerified = await authStore_authStore.isVerified(email);
69336
69424
  if (!secret) {
69337
69425
  console.log(source/* default */.Ay.red('❌ This account does not have 2FA set up. Please register again.'));
69338
- await authStore_authStore.logout();
69339
69426
  return;
69340
69427
  }
69341
69428
  if (!isVerified) {
69342
- console.log(source/* default */.Ay.red('❌ This account is not verified. Please complete TOTP verification during registration.'));
69343
- await authStore_authStore.logout();
69429
+ console.log(source/* default */.Ay.red('❌ This account is not verified. Please complete TOTP verification with: pi auth verify'));
69344
69430
  return;
69345
69431
  }
69346
- const { code } = await lib["default"].prompt([
69347
- { name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }
69348
- ]);
69349
- if (!otplib.authenticator.check(code, secret)) {
69350
- console.log(source/* default */.Ay.red('❌ Invalid code. Login aborted.'));
69351
- await authStore_authStore.logout();
69432
+ // Interactive login: allow up to 3 attempts
69433
+ let okTotp = false;
69434
+ for (let i = 0; i < 3; ++i) {
69435
+ const { code } = await lib["default"].prompt([{ name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }]);
69436
+ if (otplib.authenticator.check(code, secret)) {
69437
+ okTotp = true;
69438
+ break;
69439
+ }
69440
+ console.log(source/* default */.Ay.red('❌ Invalid code. Try again.'));
69441
+ }
69442
+ if (!okTotp) {
69443
+ console.log(source/* default */.Ay.red('❌ Too many invalid attempts. Login failed.'));
69352
69444
  return;
69353
69445
  }
69446
+ await authStore_authStore.createSession(email);
69354
69447
  console.log(source/* default */.Ay.green('✅ Logged in successfully'));
69355
69448
  }
69356
69449
  return;
@@ -69358,27 +69451,26 @@ async function handleAuthOptions(subcommand, value, opts = {}) {
69358
69451
  case 'register': {
69359
69452
  if (opts.email && opts.password) {
69360
69453
  try {
69454
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.bold('Registering new user'), { padding: 1, borderColor: 'green' }));
69361
69455
  await authStore_authStore.createUser(opts.email, opts.password);
69362
- // TOTP setup
69363
- const secret = await setupTotp(opts.email);
69364
- await authStore_authStore.setTotpSecret(opts.email, secret);
69365
- const verified = await verifyTotpPrompt(secret);
69366
- if (!verified) {
69367
- console.log(source/* default */.Ay.red('❌ Verification failed. Registration incomplete.'));
69368
- return;
69369
- }
69370
- await authStore_authStore.setVerified(opts.email, true);
69371
- // Auto-login after registration
69372
- const ok = await authStore_authStore.login(opts.email, opts.password);
69373
- if (ok) {
69374
- console.log(source/* default */.Ay.green('✅ User registered, verified, and logged in.'));
69375
- }
69376
- else {
69377
- console.log(source/* default */.Ay.yellow('User registered and verified, but auto-login failed. Please login manually.'));
69456
+ // Suggest 2FA setup flow same as interactive
69457
+ if (opts.enable2fa || opts.enable2fa === undefined) {
69458
+ const secret = await setupTotp(opts.email);
69459
+ await authStore_authStore.setTotpSecret(opts.email, secret);
69460
+ const verified = await verifyTotpPrompt(secret);
69461
+ if (!verified) {
69462
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.yellow('2FA verification failed. Registration saved but 2FA incomplete.'), { padding: 1 }));
69463
+ await authStore_authStore.createSession(opts.email);
69464
+ return;
69465
+ }
69466
+ await authStore_authStore.setVerified(opts.email, true);
69378
69467
  }
69468
+ // Create session
69469
+ await authStore_authStore.createSession(opts.email);
69470
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.green('✅ User registered and logged in.'), { padding: 1, borderColor: 'green' }));
69379
69471
  }
69380
69472
  catch (err) {
69381
- console.log(source/* default */.Ay.red(''), err.message || String(err));
69473
+ console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.red('Registration failed: ' + (err.message || String(err))), { padding: 1, borderColor: 'red' }));
69382
69474
  }
69383
69475
  }
69384
69476
  else {
@@ -69590,23 +69682,21 @@ dist_program.hook('preAction', async (thisCommand, actionCommand) => {
69590
69682
  console.log(source/* default */.Ay.gray(`Run: pi auth --help to see authentication options`));
69591
69683
  process.exit(1);
69592
69684
  }
69593
- // 2FA enforcement and usage limit for unverified users
69685
+ // Previously there were additional 2FA/usage checks here. Per request, only enforce login at preAction.
69686
+ // Enforce usage limit for unverified users: allow auth verify/logout/help/version
69594
69687
  const session = await authStore_authStore.getSession();
69595
69688
  if (session && session.email) {
69596
69689
  const isVerified = await authStore_authStore.isVerified(session.email);
69597
- // Allow verify, logout, help for unverified users
69598
- const authSub = argv[1] || '';
69599
69690
  if (!isVerified) {
69691
+ const authSub = argv[1] || '';
69600
69692
  if (name === 'auth' && ['verify', 'logout', '', undefined].includes(authSub))
69601
69693
  return;
69602
- // Usage limit enforcement for unverified users
69603
- const allowed = await authStore_authStore.incrementUsage(session.email).catch(() => false);
69604
- if (!allowed) {
69694
+ const allowedUsage = await authStore_authStore.incrementUsage(session.email).catch(() => false);
69695
+ if (!allowedUsage) {
69605
69696
  console.log('\n' + source/* default */.Ay.red('❌ You have reached the maximum number of allowed commands as an unverified user.'));
69606
69697
  console.log(source/* default */.Ay.yellow('Please verify your account with: pi auth verify'));
69607
69698
  process.exit(1);
69608
69699
  }
69609
- // Show warning for unverified users
69610
69700
  console.log(source/* default */.Ay.yellow('⚠️ Your account is not verified. You have limited access until you complete 2FA.'));
69611
69701
  }
69612
69702
  }
@@ -69737,6 +69827,7 @@ dist_program
69737
69827
  .argument('[value]', 'Optional value for subcommand (not used)')
69738
69828
  .option('--email <email>', 'Email for login/register')
69739
69829
  .option('--password <password>', 'Password for login/register')
69830
+ .option('--totp <code>', 'TOTP code for non-interactive login')
69740
69831
  .option('-h, --help', 'Show help for auth command')
69741
69832
  .allowUnknownOption(true)
69742
69833
  .on('--help', () => { showAuthHelp(); })
@@ -0,0 +1,5 @@
1
+ {
2
+ "devDependencies": {
3
+ "@shadcn/ui": "^0.0.4"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "devDependencies": {
3
+ "@shadcn/ui": "^0.0.4"
4
+ }
5
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: package-installer-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sharique
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-07 00:00:00.000000000 Z
11
+ date: 2025-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -1457,6 +1457,8 @@ files:
1457
1457
  - bundle-standalone/features/ui/daisy/vuejs/typescript/package.json
1458
1458
  - bundle-standalone/features/ui/daisy/vuejs/typescript/src/assets/main.css
1459
1459
  - bundle-standalone/features/ui/daisy/vuejs/typescript/vite.config.ts
1460
+ - bundle-standalone/features/ui/shadcn/nextjs/package.json
1461
+ - bundle-standalone/features/ui/shadcn/reactjs/package.json
1460
1462
  - bundle-standalone/features/ui/ui.json
1461
1463
  - bundle-standalone/package.json
1462
1464
  - bundle-standalone/pi