sekura 0.5.14 → 0.5.16

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.
@@ -51,7 +51,14 @@ function doneLine(s, where) {
51
51
  export function summaryParts(o) {
52
52
  const where = o.scope === 'user' ? 'Every project' : 'This project only';
53
53
  const sign = o.signIn === 'sign-in' ? ' · sign in with GitHub' : o.signIn === 'saved' ? ' · saved sign-in' : '';
54
- return { question: `Connect ${and(o.names)}?`, details: `${where} · ${o.skill ? 'with' : 'no'} skill${sign}` };
54
+ // More than three tools is too long a question for one line: fourteen named
55
+ // in it wrapped back to the left edge (Varsha's test v5, F3). The names go
56
+ // on the details line, which may wrap, and the question stays short.
57
+ const many = o.names.length > 3;
58
+ const details = `${where} · ${o.skill ? 'with' : 'no'} skill${sign}`;
59
+ return many
60
+ ? { question: `Connect these ${o.names.length} tools?`, details: `${o.names.join(', ')}\n ${details}` }
61
+ : { question: `Connect ${and(o.names)}?`, details };
55
62
  }
56
63
  export function summary(o) {
57
64
  // The question first, the details after it in brackets, so it reads at a
@@ -227,7 +234,8 @@ export async function runInit(opts) {
227
234
  step('Choose tools');
228
235
  const names = chosen.map((id) => toolById(id)?.name ?? id);
229
236
  const parts = summaryParts({ names, scope, skill, signIn: login ? (hasKey ? 'saved' : 'sign-in') : null });
230
- say(` ${c.dim(parts.details)}`);
237
+ for (const l of parts.details.split('\n'))
238
+ say(` ${c.dim(l.trim())}`);
231
239
  const answer = await select({
232
240
  message: parts.question,
233
241
  choices: [
@@ -53,17 +53,23 @@ export async function runAbandon(planId) {
53
53
  export async function runPay(link, opts = {}) {
54
54
  if (opts.abandon)
55
55
  return runAbandon(opts.plan);
56
- if (!link) {
57
- say(`${cross} Give the Checkout link Sekura answered with: npx sekura@latest pay <checkout-link> --plan <id>`);
56
+ // `pay --plan <id>` alone waits on a payment already open in the browser.
57
+ // The printed "To wait for it again" command carried the whole Checkout
58
+ // link, unquoted, and wrapped over three lines; pasted, zsh ran the link
59
+ // and --plan as commands of their own (Varsha's test v5, 30 November 2026).
60
+ if (!link && !opts.plan) {
61
+ say(`${cross} Give the plan id Sekura answered with: npx sekura@latest pay --plan <id>`);
58
62
  return PAY_EXIT.badLink;
59
63
  }
60
- const url = openableLink(link);
61
- if (!url) {
62
- say(`${cross} Not a Stripe Checkout or Sekura link, so it was not opened: ${link}`);
63
- return PAY_EXIT.badLink;
64
+ if (link) {
65
+ const url = openableLink(link);
66
+ if (!url) {
67
+ say(`${cross} Not a Stripe Checkout or Sekura link, so it was not opened: ${link}`);
68
+ return PAY_EXIT.badLink;
69
+ }
70
+ const opened = opts.open === false ? false : openBrowser(url.href);
71
+ sayOpened(url, opened);
64
72
  }
65
- const opened = opts.open === false ? false : openBrowser(url.href);
66
- sayOpened(url, opened);
67
73
  const key = readKey();
68
74
  if (!opts.plan || !key) {
69
75
  say(`${dot} ${key ? 'No plan id was given' : 'Not signed in here (npx sekura@latest login)'}, so this terminal cannot tell when the payment lands. After paying: npx sekura@latest plans`);
@@ -96,8 +102,8 @@ export async function runPay(link, opts = {}) {
96
102
  return PAY_EXIT.timeout;
97
103
  }
98
104
  export const payCommand = new Command('pay')
99
- .description('Open a Stripe Checkout link from a Sekura quote in your browser and wait until the payment lands.')
100
- .argument('[checkout-link]', 'the Checkout link Sekura answered with')
105
+ .description('Wait until a payment lands: give the plan id, and the Checkout link to open it in your browser.')
106
+ .argument('[checkout-link]', 'the Checkout link Sekura answered with, to open (optional)')
101
107
  .option('--plan <id>', 'the plan id from the same answer, to wait on')
102
108
  .option('--timeout <minutes>', 'how long to wait', '9')
103
109
  .option('--no-open', 'print the link instead of opening it')
@@ -203,6 +203,7 @@ export function quoteLines(text, repo) {
203
203
  let inAuth = false;
204
204
  let titleNext = false;
205
205
  const facts = [];
206
+ const held = [];
206
207
  const flushFacts = () => {
207
208
  if (!facts.length)
208
209
  return;
@@ -210,6 +211,10 @@ export function quoteLines(text, repo) {
210
211
  for (const [k, v] of facts)
211
212
  out.push(`${c.dim(k.padEnd(w))} ${v}`);
212
213
  facts.length = 0;
214
+ if (held.length) {
215
+ out.push('', ...held);
216
+ held.length = 0;
217
+ }
213
218
  };
214
219
  for (const raw of personText(text, repo).split('\n')) {
215
220
  const line = raw.trimEnd();
@@ -261,6 +266,14 @@ export function quoteLines(text, repo) {
261
266
  facts.push([fact[1], value]);
262
267
  continue;
263
268
  }
269
+ // The promotion-code sentence comes between Price and Payment; printed
270
+ // where it came, it split the table in two, and the second half lost the
271
+ // first half's alignment (Varsha's test v5, 30 November 2026, F6). It
272
+ // follows the table instead.
273
+ if (facts.length && /^Free with the code /.test(line)) {
274
+ held.push(line);
275
+ continue;
276
+ }
264
277
  const nothing = /^(.*?)\s*(Nothing has been (?:started|changed|cancelled)(?: or charged)?(?: yet)?\.)$/.exec(line);
265
278
  if (nothing && nothing[1]) {
266
279
  flushFacts();
@@ -456,5 +469,5 @@ export async function afterStart(key, o, opts) {
456
469
  return;
457
470
  }
458
471
  }
459
- throw new Exit(exitCodeOfStart(o), `No payment yet. The Checkout link stays valid for 24 hours, and the scan starts as soon as it is paid:\n ${o.checkoutUrl}${o.planId ? `\n To wait for it again: npx sekura@latest pay ${o.checkoutUrl} --plan ${o.planId} --no-open` : ''}`, { planId: o.planId, checkoutUrl: o.checkoutUrl });
472
+ throw new Exit(exitCodeOfStart(o), `No payment yet. The Checkout link stays valid for 24 hours, and the scan starts as soon as it is paid:\n ${o.checkoutUrl}${o.planId ? `\n To wait for it again: npx sekura@latest pay --plan ${o.planId}` : ''}`, { planId: o.planId, checkoutUrl: o.checkoutUrl });
460
473
  }
package/dist/flow.js CHANGED
@@ -180,7 +180,7 @@ export async function startWithPayment(key, op, args, opts = {}) {
180
180
  const planId = typeof due.planId === 'string' && due.planId ? due.planId : null;
181
181
  const opened = openLink(url.href, { browser: opts.browser });
182
182
  if (!opened.opened && !interactive()) {
183
- throw new Exit(EXIT.paymentNeedsBrowser, `Payment needs a browser. Open this link to pay; the scan starts once it is paid: ${url.href}${planId ? `\n To wait for it here: npx sekura@latest pay ${url.href} --plan ${planId} --no-open` : ''}`, { checkoutUrl: url.href, planId });
183
+ throw new Exit(EXIT.paymentNeedsBrowser, `Payment needs a browser. Open this link to pay; the scan starts once it is paid: ${url.href}${planId ? `\n To wait for it here: npx sekura@latest pay --plan ${planId}` : ''}`, { checkoutUrl: url.href, planId });
184
184
  }
185
185
  ;
186
186
  (opts.sayLink ?? sayCheckout)(opened, url);
package/dist/ui.js CHANGED
@@ -183,11 +183,17 @@ export async function waitFor(message, check, opts = {}) {
183
183
  const pause = (ms) => new Promise((r) => { const t = setTimeout(r, ms); wake = () => { clearTimeout(t); r(); }; });
184
184
  try {
185
185
  for (;;) {
186
+ // A blip is asked again; a key Sekura no longer accepts is not a blip.
187
+ // Swallowed, it read as "No payment yet" minutes later, while the
188
+ // account it was waiting on had been removed (Varsha's test v5, F6).
186
189
  try {
187
190
  if (await check())
188
191
  return 'done';
189
192
  }
190
- catch { /* a blip; ask again */ }
193
+ catch (e) {
194
+ if (e?.name === 'SignedOut')
195
+ throw e;
196
+ }
191
197
  if (skipped)
192
198
  return 'skipped';
193
199
  const left = deadline - Date.now();
package/dist/writers.js CHANGED
@@ -408,10 +408,23 @@ export function remove(t) {
408
408
  case 'json': return removeJson(t);
409
409
  case 'toml': return removeToml(t);
410
410
  case 'yaml': return removeYaml(t);
411
- case 'command': return runCommand(t.bin, t.remove);
411
+ case 'command': return removeCommand(t);
412
412
  case 'link': return { status: 'absent', where: t.href };
413
413
  }
414
414
  }
415
+ /** A tool's own remove command, where "there was nothing of ours" is not a
416
+ * failure. Factory Droid answers 'Server "sekura" not found in configuration'
417
+ * and Devin 'not found in local project config', with a non-zero exit, so an
418
+ * uninstall on a computer where neither had Sekura showed two red crosses
419
+ * beside tools that said "nothing to remove" (Varsha's test v5, 30 November
420
+ * 2026). */
421
+ const NOTHING_THERE = /\b(not found|no such (server|mcp)|does not exist|doesn't exist|not configured|no server named)\b/i;
422
+ function removeCommand(t) {
423
+ const r = runCommand(t.bin, t.remove);
424
+ if (r.status === 'failed' && 'why' in r && NOTHING_THERE.test(r.why) && !/command not found|ENOENT/i.test(r.why))
425
+ return { status: 'absent', where: r.where };
426
+ return r;
427
+ }
415
428
  /** Present, absent, or unknowable (a command's own store, or a file with comments). */
416
429
  export function has(t) {
417
430
  switch (t.kind) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sekura",
3
- "version": "0.5.14",
3
+ "version": "0.5.16",
4
4
  "description": "Set up Sekura and scan your GitHub repositories from the terminal, and connect your coding tools: npx sekura@latest",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.json && node -e \"require('fs').chmodSync('dist/cli.js', 0o755)\"",
40
- "test": "npm run build && node --test test/init.test.mjs test/login.test.mjs test/guide.test.mjs test/device.test.mjs test/skill.test.mjs test/pay.test.mjs test/keys.test.mjs test/commands.test.mjs test/endpoint.test.mjs test/errors.test.mjs test/exit.test.mjs test/state.test.mjs test/flow.test.mjs test/api.test.mjs",
40
+ "test": "npm run build && node --test test/init.test.mjs test/login.test.mjs test/guide.test.mjs test/device.test.mjs test/skill.test.mjs test/pay.test.mjs test/keys.test.mjs test/commands.test.mjs test/endpoint.test.mjs test/errors.test.mjs test/exit.test.mjs test/state.test.mjs test/flow.test.mjs test/api.test.mjs test/v5-fixes.test.mjs",
41
41
  "prepack": "npm run build"
42
42
  },
43
43
  "dependencies": {
@@ -211,12 +211,13 @@ the GitHub App), 6 that agreement is needed, 7 that a payment needs a browser.
211
211
 
212
212
  ## What to tell the user
213
213
 
214
- - After the first scan, a repository is scanned on a monthly plan; Sekura sells no one-time scan. A new account's first scan is started by the user themselves, in a terminal, with `npx sekura@latest`, and is free with the code FREESCAN10 on Stripe's page: say so when the user asks about it, and let them run it.
214
+ - After the first scan, a repository is scanned on a monthly plan; Sekura sells no one-time scan. A new account's first scan is quoted with `quoteScan` like any scan: $10 on a Stripe Checkout page, free with the code FREESCAN10, which the user types there themselves. Say so in the quote, and after their yes give them the Checkout link; never offer a saved card for it.
215
215
  - The plans a user can buy here: a monthly plan for
216
216
  one repository, Weekly ($10 a month per repository) or More frequently ($25 a
217
217
  month per repository). The quote's price is the one that counts. There is no
218
218
  trial. Enterprise is quoted by Sekura: give no price or plan name for it.
219
219
  - When `getAccount` says the Terms are not accepted or the GitHub App is not installed, tell the user to run `npx sekura@latest` in a terminal (or `npx sekura@latest terms`, or `npx sekura@latest repos --add`), or give them the link it names; for an unverified email, give the link. A scan cannot start before that.
220
+ - One Sekura account at a time. If the `sekura` server you were set up with fails (signed out, a 401, "connection is no longer valid"), stop and tell the user: their Sekura sign-in here no longer works, and `npx sekura@latest login` (with the same `--endpoint` it was set up with) signs in again. Never answer from another Sekura connection instead, such as the claude.ai connector: it can be a different account on a different server, with other scans and prices. If you use one at the user's request, first say which account and server it is (`getAccount`).
220
221
  - A scan can take a while. Offer `getScan` to check on it rather than polling in a loop.
221
222
  - Findings carry proof. When summarising, keep the evidence the finding gives; do not soften a severity.
222
223
  - Sekura scans only repositories the user has granted through the Sekura GitHub App. To add one: `npx sekura@latest repos --add` in a terminal.