@nullpay/cli 1.0.2 → 1.0.4

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.
@@ -119,6 +119,13 @@ function formatCurrencyLabel(currency) {
119
119
  return 'CREDITS + USDCX + USAD';
120
120
  return currency;
121
121
  }
122
+ function resolveOutputPath(input) {
123
+ const trimmed = input.trim();
124
+ if (!trimmed) {
125
+ return path.resolve(process.cwd(), 'nullpay.json');
126
+ }
127
+ return path.resolve(process.cwd(), trimmed);
128
+ }
122
129
  async function validateMerchant(secretKey, merchantAddress) {
123
130
  const res = await fetch(`${BACKEND_URL}/sdk/onboard/validate`, {
124
131
  method: 'POST',
@@ -172,19 +179,6 @@ async function pollForHash(salt, maxRetries = 60) {
172
179
  }
173
180
  return null;
174
181
  }
175
- function updateGitignore(projectRoot) {
176
- const filePath = path.join(projectRoot, '.gitignore');
177
- const entry = 'nullpay.json';
178
- const note = '# NullPay - contains sensitive salt values';
179
- if (fs.existsSync(filePath)) {
180
- const content = fs.readFileSync(filePath, 'utf-8');
181
- if (!content.includes(entry)) {
182
- fs.appendFileSync(filePath, `\n${note}\n${entry}\n`);
183
- }
184
- return;
185
- }
186
- fs.writeFileSync(filePath, `${note}\n${entry}\n`);
187
- }
188
182
  function renderInvoiceCard(inv, index) {
189
183
  const typeLabel = inv.type === 'multipay'
190
184
  ? tag('MULTI-PAY', C.brand)
@@ -491,15 +485,24 @@ async function onboard() {
491
485
  line(` ${C.rose('X')} ${C.white('No invoices confirmed. Exiting.')}`);
492
486
  process.exit(1);
493
487
  }
494
- const projectRoot = process.cwd();
495
- const outputPath = path.join(projectRoot, 'nullpay.json');
488
+ blank();
489
+ const defaultOutputPath = path.resolve(process.cwd(), 'nullpay.json');
490
+ const { outputPathInput } = await inquirer_1.default.prompt([{
491
+ type: 'input',
492
+ name: 'outputPathInput',
493
+ message: C.slate('Write nullpay.json to'),
494
+ prefix: C.brand(' >'),
495
+ default: defaultOutputPath,
496
+ validate: (v) => v.trim().length ? true : C.rose('Path cannot be empty'),
497
+ }]);
498
+ const outputPath = resolveOutputPath(outputPathInput);
496
499
  const output = {
497
500
  merchant: resolvedAddress,
498
501
  generated_at: new Date().toISOString(),
499
502
  invoices: generatedInvoices,
500
503
  };
504
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true });
501
505
  fs.writeFileSync(outputPath, JSON.stringify(output, null, 2));
502
- updateGitignore(projectRoot);
503
506
  blank();
504
507
  blank();
505
508
  line(rule('='));
@@ -516,8 +519,6 @@ async function onboard() {
516
519
  kv('Merchant', resolvedAddress, C.brandDim);
517
520
  kv('Deployed', `${generatedInvoices.length} / ${allInvoices.length} invoices`, C.success.bold);
518
521
  blank();
519
- line(` ${C.gold('!')} ${C.slate('nullpay.json added to .gitignore - keep salts private')}`);
520
- blank();
521
522
  line(rule('-'));
522
523
  blank();
523
524
  line(` ${C.white.bold('Usage')}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nullpay/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "NullPay CLI — Developer onboarding and invoice management tools",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {