sekura 0.5.14 → 0.5.17
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 +1 -1
- package/dist/commands/init.js +10 -2
- package/dist/commands/pay.js +16 -10
- package/dist/commands/plans.js +1 -1
- package/dist/commands/shared.js +14 -1
- package/dist/flow.js +1 -1
- package/dist/ui.js +7 -1
- package/dist/writers.js +14 -1
- package/package.json +2 -2
- package/skills/sekura/SKILL.md +3 -2
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. It is the $10 one-time scan: Stripe Checkout opens, the code
|
|
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 NPMSCAN 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
|
package/dist/commands/init.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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: [
|
package/dist/commands/pay.js
CHANGED
|
@@ -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
|
-
|
|
57
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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('
|
|
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')
|
package/dist/commands/plans.js
CHANGED
|
@@ -13,7 +13,7 @@ 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
|
-
// The first scan made free by
|
|
16
|
+
// The first scan made free by NPMSCAN is named for what it was, as the
|
|
17
17
|
// dashboard does (30 November 2026); never worded as an offer.
|
|
18
18
|
{ header: 'PLAN', value: (p) => monthlyName(p) ?? (p.billing === 'free' ? 'First scan (free)' : 'One-time scan') },
|
|
19
19
|
{ header: 'SCHEDULE', value: (p) => (monthlyName(p) ? p.schedule?.description ?? '' : '') },
|
package/dist/commands/shared.js
CHANGED
|
@@ -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
|
|
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
|
|
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 {
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.5.17",
|
|
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": {
|
package/skills/sekura/SKILL.md
CHANGED
|
@@ -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, then the two-step rule below. Only the account's first scan (free with the code
|
|
28
|
+
- `scan <owner/repo>`: `quoteScan` for that repository, then the two-step rule below. Only the account's first scan (free with the code NPMSCAN) 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`.
|
|
@@ -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
|
|
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 NPMSCAN, 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.
|