sekura 0.5.12 → 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.
package/README.md CHANGED
@@ -27,7 +27,7 @@ The GitHub-code sign-in, the Terms in the terminal, the report download and a fr
27
27
  7. **The Terms.** It prints the consent sentence and links to the documents, then asks **I accept** or **Not now**, and whether you want product emails. Nothing is accepted for you: `--yes` skips this step.
28
28
  8. **The GitHub App.** If Sekura cannot scan anything yet, or not the repository in this folder, it opens the install page on github.com and carries on by itself once the repository shows up. Enter skips the wait.
29
29
  9. **A repository.** This folder's GitHub remote first, otherwise your pick. It is saved as the default for `scan` and `plan`.
30
- 10. **A first scan**, when the account has none yet. The quote is printed as Sekura gives it, with the authorization wording and the price, and nothing starts until you agree. On a server with CLI onboarding, a new account's free first scan is started here, in the terminal, at no charge; otherwise Stripe Checkout opens and the CLI waits for the payment. Then it follows the scan (Enter stops watching; the scan carries on), prints the findings by severity and saves the report as `sekura-report-<scan-id>.html`.
30
+ 10. **A first scan**, when the account has none yet. The quote is printed as Sekura gives it, with the authorization wording and the price, and nothing starts until you agree. It is the $10 one-time scan: Stripe Checkout opens, the code FREESCAN10 entered there makes it $0, and the CLI waits for the payment. After the first scan, a repository is scanned on a monthly plan (`plan start`); Sekura sells no other one-time scan. Then it follows the scan (Enter stops watching; the scan carries on), prints the findings by severity and saves the report as `sekura-report-<scan-id>.html`.
31
31
  11. **Says what is next in each tool**, such as "Claude Code: start a new Claude Code session, then type /sekura", and how to scan again from the terminal.
32
32
 
33
33
  ## Commands
@@ -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')
@@ -13,7 +13,9 @@ const stateOf = (p) => p.status === 'pending' ? 'waiting on a payment'
13
13
  : p.status;
14
14
  const COLUMNS = [
15
15
  { header: 'REPOSITORY', value: (p) => (p.owner && p.name ? `${p.owner}/${p.name}` : p.id) },
16
- { header: 'PLAN', value: (p) => monthlyName(p) ?? 'One-time scan' },
16
+ // The first scan made free by FREESCAN10 is named for what it was, as the
17
+ // dashboard does (30 November 2026); never worded as an offer.
18
+ { header: 'PLAN', value: (p) => monthlyName(p) ?? (p.billing === 'free' ? 'First scan (free)' : 'One-time scan') },
17
19
  { header: 'SCHEDULE', value: (p) => (monthlyName(p) ? p.schedule?.description ?? '' : '') },
18
20
  { header: 'STATE', value: stateOf },
19
21
  { header: 'NEXT RUN (UTC)', value: (p) => when(p.nextRunAt) },
@@ -24,7 +26,7 @@ export async function runPlans(opts = {}) {
24
26
  const data = await ready(() => getPlans(key));
25
27
  const plans = data.plans ?? [];
26
28
  if (!plans.length && !opts.json) {
27
- say(`${dot} No plans yet. A one-time scan: npx sekura@latest scan owner/repo. A monthly plan: npx sekura@latest plan start owner/repo`);
29
+ say(`${dot} No plans yet. Your first scan: npx sekura@latest scan owner/repo. A monthly plan: npx sekura@latest plan start owner/repo`);
28
30
  return;
29
31
  }
30
32
  printTable(plans, COLUMNS, { json: opts.json, data });
@@ -105,6 +105,11 @@ const PERSON_REWRITES = [
105
105
  [/; call \w+ again for how it would be paid now\./g, '; run the same command again to see how it would be paid now.'],
106
106
  [/,? or call \w+ again for how it would be paid now\./g, ', or run the same command again to see how it would be paid now.'],
107
107
  [/\b[Cc]all (\w+)(?: again)?(?: with the same arguments)?,? (?:to )?show the person [^.]*?only once they (?:agree|pick one)\./g, 'Run the same command again to see it.'],
108
+ // After the first scan there is no one-time scan (Sudhir, 30 November 2026):
109
+ // the server's refusal names the plan tool, the reader gets the command.
110
+ [/To scan (\S+?), put it on a monthly plan: (.+?)\. Call \w+ with the repository and a schedule\./g,
111
+ (_m, repo, plans) => `To scan ${repo}, put it on a monthly plan: ${plans}. Start one with: npx sekura@latest plan start ${repo}`],
112
+ [/this is the account's first scan\./g, 'this is your first scan.'],
108
113
  [/in the person's browser/g, 'in your browser'],
109
114
  [/the person's name/g, 'your name'],
110
115
  [/as the person chooses/g, 'as you choose'],
@@ -198,6 +203,7 @@ export function quoteLines(text, repo) {
198
203
  let inAuth = false;
199
204
  let titleNext = false;
200
205
  const facts = [];
206
+ const held = [];
201
207
  const flushFacts = () => {
202
208
  if (!facts.length)
203
209
  return;
@@ -205,6 +211,10 @@ export function quoteLines(text, repo) {
205
211
  for (const [k, v] of facts)
206
212
  out.push(`${c.dim(k.padEnd(w))} ${v}`);
207
213
  facts.length = 0;
214
+ if (held.length) {
215
+ out.push('', ...held);
216
+ held.length = 0;
217
+ }
208
218
  };
209
219
  for (const raw of personText(text, repo).split('\n')) {
210
220
  const line = raw.trimEnd();
@@ -256,6 +266,14 @@ export function quoteLines(text, repo) {
256
266
  facts.push([fact[1], value]);
257
267
  continue;
258
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
+ }
259
277
  const nothing = /^(.*?)\s*(Nothing has been (?:started|changed|cancelled)(?: or charged)?(?: yet)?\.)$/.exec(line);
260
278
  if (nothing && nothing[1]) {
261
279
  flushFacts();
@@ -451,5 +469,5 @@ export async function afterStart(key, o, opts) {
451
469
  return;
452
470
  }
453
471
  }
454
- 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 });
455
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/payment.js CHANGED
@@ -40,7 +40,7 @@ export const cardsFingerprint = (b) => (b.cards ?? []).map((c) => `${c.masked}:$
40
40
  // still held by some accounts, so it reads as "Your monthly plan" rather than by
41
41
  // its old name. A row's `plan` is 'always' for every monthly tier, so the
42
42
  // tier is read first: by `plan` alone a More frequently plan reads as Weekly.
43
- const TIER_NAMES = { once: 'One-time scan', free: 'One-time scan', always: 'Weekly', pro: 'More frequently', plus: 'Your monthly plan' };
43
+ const TIER_NAMES = { once: 'One-time scan', free: 'First scan (free)', always: 'Weekly', pro: 'More frequently', plus: 'Your monthly plan' };
44
44
  /** A monthly plan's name, or undefined for a one-time scan. */
45
45
  export function monthlyName(p) {
46
46
  if (!p)
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.12",
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": {
@@ -25,7 +25,7 @@ the first word:
25
25
  anything the account still needs (see Setup, below), and the repositories
26
26
  Sekura can scan, then end with "Type `/sekura help` for commands."
27
27
  - `repos`: `listRepositories`.
28
- - `scan <owner/repo>`: `quoteScan` for that repository (a one-time scan), then the two-step rule below.
28
+ - `scan <owner/repo>`: `quoteScan` for that repository, then the two-step rule below. Only the account's first scan (free with the code FREESCAN10) or a scan Sekura owes is quoted; any other answers `once_not_sold`: offer Weekly or More frequently and quote with `quoteAlways`.
29
29
  - `scans`: `listScans`.
30
30
  - `scan-status <scan>`: `getScan`. `findings <scan>`: `getScanFindings`.
31
31
  - `report <scan>`: `getReportLink`.
@@ -67,7 +67,7 @@ Sekura: AI red team scans for your GitHub repositories
67
67
 
68
68
  /sekura account and repositories at a glance
69
69
  /sekura repos repositories Sekura can scan
70
- /sekura scan <owner/repo> quote a one-time scan; it starts only after you agree
70
+ /sekura scan <owner/repo> quote your first scan; it starts only after you agree
71
71
  /sekura scans your scans and their status
72
72
  /sekura scan-status <scan> one scan's progress
73
73
  /sekura findings <scan> a scan's findings, with proof
@@ -107,7 +107,7 @@ The server has twenty tools. Read, change nothing, no confirmation:
107
107
 
108
108
  Quote, then confirm. The quote changes nothing and charges nothing:
109
109
 
110
- - `quoteScan` → `startScan`: a one-time scan of one repository.
110
+ - `quoteScan` → `startScan`: the account's first scan, or a scan Sekura owes. After the first scan there is no one-time scan.
111
111
  - `quoteAlways` → `startAlways`: a monthly plan (Weekly or More frequently) for one repository.
112
112
  - `quoteSchedule` → `updateSchedule`: change when a repository on a monthly plan is scanned. It charges nothing.
113
113
  - `quotePlanChange` → `changePlan`: move a repository between Weekly and More frequently. Moving up charges the whole difference between the two monthly prices now and keeps the renewal date; moving down charges nothing and refunds nothing, and the lower price applies from the renewal.
@@ -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
- - Through these tools a scan is a one-time scan at the quoted price. Never offer or start a free scan through these tools. A new account's free first scan is started by the user themselves, in a terminal, with `npx sekura@latest`: say so when the user asks about it, and let them run it.
215
- - The plans a user can buy here: a one-time scan ($10), or a monthly plan for
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
+ - 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.