sekura 0.5.17 → 0.5.21

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/dist/session.js CHANGED
@@ -2,7 +2,7 @@ import { ISSUER, adoptSavedKey, credentialsPath, forgetKey, keyName, readKey, re
2
2
  import { cliApi, getAccount, isMissingRoute, isToolError, SignedOut } from './api.js';
3
3
  import { ENDPOINT, HOST } from './catalogue.js';
4
4
  import { DEVICE_GRANT, TokenRouteMissing, form, pollForToken } from './device.js';
5
- import { reach, refusal } from './errors.js';
5
+ import { reach, refusal, timed } from './errors.js';
6
6
  import { signInHere as legacySignInHere } from './guide.js';
7
7
  import { copyToClipboard, openLink } from './open.js';
8
8
  import { cross, dot, say, spinner, tick } from './ui.js';
@@ -30,7 +30,7 @@ export async function startGithubSignIn() {
30
30
  export async function pollGithubSignIn(code, opts = {}) {
31
31
  let data;
32
32
  try {
33
- data = await pollForToken(() => fetch(`${ISSUER}/oauth/github/token`, form({ grant_type: DEVICE_GRANT, device_code: code.device_code, resource: ENDPOINT })), code, { ...opts, routeMayBeMissing: true, denied: 'the sign-in was cancelled on github.com' });
33
+ data = await pollForToken(() => fetch(`${ISSUER}/oauth/github/token`, timed(form({ grant_type: DEVICE_GRANT, device_code: code.device_code, resource: ENDPOINT }))), code, { ...opts, routeMayBeMissing: true, denied: 'the sign-in was cancelled on github.com' });
34
34
  }
35
35
  catch (e) {
36
36
  if (e instanceof TokenRouteMissing)
@@ -59,7 +59,11 @@ export async function currentSession(opts = {}) {
59
59
  const account = await getAccount(existing);
60
60
  if (!fromEnv)
61
61
  adoptSavedKey();
62
- tell(`${tick} Signed in to Sekura as ${who(account, existing)}${fromEnv ? ' (SEKURA_API_KEY)' : ''}`);
62
+ if (opts.already) {
63
+ tell(`${tick} Already signed in as ${who(account, existing)}${fromEnv ? ' (SEKURA_API_KEY)' : ''}. To use another account, ${fromEnv ? 'set SEKURA_API_KEY to its key' : 'run npx sekura@latest logout first'}.`);
64
+ }
65
+ else
66
+ tell(`${tick} Signed in to Sekura as ${who(account, existing)}${fromEnv ? ' (SEKURA_API_KEY)' : ''}`);
63
67
  return { key: existing, account, kind, fresh: false };
64
68
  }
65
69
  catch (e) {
@@ -124,7 +128,7 @@ export async function signInFresh(flags = {}) {
124
128
  }
125
129
  }
126
130
  export async function obtainSession(opts) {
127
- const s = await currentSession({ quiet: opts.quiet });
131
+ const s = await currentSession({ quiet: opts.quiet, already: opts.already });
128
132
  if (s || !opts.interactive)
129
133
  return s;
130
134
  return signInFresh(opts);
package/dist/skill.js CHANGED
@@ -11,13 +11,31 @@
11
11
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
12
12
  import { dirname, join } from 'node:path';
13
13
  import { fileURLToPath } from 'node:url';
14
- import { DOCS, ENDPOINT, SERVER_NAME } from './catalogue.js';
14
+ import { DOCS, ENDPOINT, PRODUCTION, SERVER_NAME } from './catalogue.js';
15
15
  const here = dirname(fileURLToPath(import.meta.url));
16
16
  /** The packaged skill: dist/ sits beside skills/ in the published package. */
17
17
  export const SKILL_SOURCE = join(here, '..', 'skills', SERVER_NAME, 'SKILL.md');
18
18
  /** LF whatever the checkout did: a Windows clone with autocrlf would otherwise
19
19
  * install a skill whose every line ends in \r, and a rerun would rewrite it. */
20
20
  export const skillText = () => readFileSync(SKILL_SOURCE, 'utf8').replace(/\r\n/g, '\n');
21
+ /**
22
+ * The skill as it is installed for one server. The packaged text names
23
+ * production; installed for dev.sekura.ai, its commands ran against
24
+ * production, and after a logout Claude Code told the person to run
25
+ * `npx sekura@latest login` with no --endpoint, for an account that lives on
26
+ * dev (Varsha's 0.5.20 test, 1 December 2026, bug 8). Off production every
27
+ * `npx sekura@latest` becomes `npx sekura@latest --endpoint <server>`, as the
28
+ * CLI's own printed commands do, and the server's address is this one.
29
+ */
30
+ export function skillTextFor(endpoint = ENDPOINT) {
31
+ const text = skillText();
32
+ const origin = new URL(endpoint).origin;
33
+ if (origin === new URL(PRODUCTION).origin)
34
+ return text;
35
+ return text
36
+ .replace(/npx sekura@latest(?! --endpoint)/g, `npx sekura@latest --endpoint ${origin}`)
37
+ .split(PRODUCTION).join(endpoint);
38
+ }
21
39
  export function skillPaths(root, claude, scope, agents = true) {
22
40
  const out = agents ? [join(root, '.agents', 'skills', SERVER_NAME, 'SKILL.md')] : [];
23
41
  if (claude || (scope === 'project' && existsSync(join(root, '.claude'))))
@@ -25,7 +43,7 @@ export function skillPaths(root, claude, scope, agents = true) {
25
43
  return out;
26
44
  }
27
45
  export function writeSkill(path) {
28
- const text = skillText();
46
+ const text = skillTextFor();
29
47
  if (existsSync(path) && readFileSync(path, 'utf8') === text)
30
48
  return { status: 'unchanged', where: path };
31
49
  mkdirSync(dirname(path), { recursive: true });
package/dist/state.js CHANGED
@@ -3,6 +3,7 @@ import { dirname, join } from 'node:path';
3
3
  import { ENDPOINT, credentialsPath } from './catalogue.js';
4
4
  import { writeConfig } from './writers.js';
5
5
  export const QUOTE_TTL_MS = 15 * 60_000;
6
+ export const CHECKOUT_LINK_TTL_MS = 24 * 60 * 60_000;
6
7
  export const statePath = () => join(dirname(credentialsPath()), 'state.json');
7
8
  function readFile() {
8
9
  try {
@@ -24,6 +25,7 @@ function writeFile(s) {
24
25
  writeConfig(p, JSON.stringify(s, null, 2) + '\n', true);
25
26
  }
26
27
  const live = (quotes, now) => Object.fromEntries(Object.entries(quotes ?? {}).filter(([, q]) => q && Date.parse(q.expiresAt) > now));
28
+ const payable = (codes, now) => Object.fromEntries(Object.entries(codes ?? {}).filter(([, c]) => c && typeof c.code === 'string' && Date.parse(c.savedAt) + CHECKOUT_LINK_TTL_MS > now));
27
29
  export function readState(endpoint = ENDPOINT) {
28
30
  const s = readFile().servers[endpoint];
29
31
  return s && typeof s === 'object' ? s : {};
@@ -35,6 +37,9 @@ export function updateState(change, endpoint = ENDPOINT) {
35
37
  next.quotes = live(next.quotes, Date.now());
36
38
  if (!Object.keys(next.quotes).length)
37
39
  delete next.quotes;
40
+ next.checkoutCodes = payable(next.checkoutCodes, Date.now());
41
+ if (!Object.keys(next.checkoutCodes).length)
42
+ delete next.checkoutCodes;
38
43
  if (Object.keys(next).length)
39
44
  file.servers[endpoint] = next;
40
45
  else
@@ -70,3 +75,16 @@ export function dropQuote(quoteId, endpoint = ENDPOINT) {
70
75
  updateState((s) => { if (s.quotes)
71
76
  delete s.quotes[quoteId]; }, endpoint);
72
77
  }
78
+ export function saveCheckoutCode(planId, c, endpoint = ENDPOINT) {
79
+ updateState((s) => { s.checkoutCodes = { ...(s.checkoutCodes ?? {}), [planId]: { code: c.code, saving: c.saving, savedAt: new Date().toISOString() } }; }, endpoint);
80
+ }
81
+ export function checkoutCodeFor(planId, endpoint = ENDPOINT) {
82
+ const c = payable(readState(endpoint).checkoutCodes, Date.now())[planId];
83
+ return c ? { code: c.code, saving: typeof c.saving === 'string' ? c.saving : null } : null;
84
+ }
85
+ export function dropCheckoutCode(planId, endpoint = ENDPOINT) {
86
+ if (!readState(endpoint).checkoutCodes?.[planId])
87
+ return;
88
+ updateState((s) => { if (s.checkoutCodes)
89
+ delete s.checkoutCodes[planId]; }, endpoint);
90
+ }
package/dist/steps.js CHANGED
@@ -2,7 +2,7 @@ import { readKey, readToolKey, redact } from './auth.js';
2
2
  import { getAccount, getBilling, getPlans, isMissingRoute, isToolError, listRepositories, SignedOut } from './api.js';
3
3
  import { ENDPOINT, HOST, carriesKey, link } from './catalogue.js';
4
4
  import { EXIT, Exit, SIGN_IN_HINT } from './exit.js';
5
- import { openLink } from './open.js';
5
+ import { GITHUB_APP_HOSTS, NOT_OPENED, SEKURA_HOSTS, openTrusted } from './open.js';
6
6
  import { cardLines, planLines } from './payment.js';
7
7
  import { buildPlan, detectTools, stepPresent } from './plan.js';
8
8
  import { currentGithubRepo } from './repo.js';
@@ -43,6 +43,24 @@ export function localConnections(opts = {}) {
43
43
  });
44
44
  return { detected: detected.length, rows, skipped: plan.skipped.map((s) => ({ name: s.tool.name, why: s.why })), connected };
45
45
  }
46
+ /** The saved default repository, as the account names it, when it is one of
47
+ * the repositories the account can scan; otherwise null (bug 17). */
48
+ export const scannableOf = (saved, names) => (saved ? names.find((n) => same(n, saved)) ?? null : null);
49
+ /** The saved default, when the signed-in account can scan it. Null when it
50
+ * cannot, or when the list could not be read: a hint that names a
51
+ * repository the account cannot scan sends the person to a refusal. */
52
+ export async function scannableDefault(key) {
53
+ const saved = defaultRepository();
54
+ if (!saved)
55
+ return null;
56
+ try {
57
+ const names = repositoriesOf(await listRepositories(key)).filter((r) => !r.empty).map((r) => r.fullName);
58
+ return scannableOf(saved, names);
59
+ }
60
+ catch {
61
+ return null;
62
+ }
63
+ }
46
64
  const settled = async (p) => {
47
65
  try {
48
66
  return { ok: true, value: await p };
@@ -60,7 +78,11 @@ export async function readiness(key, opts = {}) {
60
78
  detail: tools.connected.length ? `connected: ${tools.connected.join(', ')}` : tools.detected ? 'none of the tools on this machine is connected' : 'no supported coding tool found on this machine',
61
79
  ...(tools.connected.length ? {} : { fix: tools.detected ? 'npx sekura@latest init' : 'npx sekura@latest init --tools <tool>' }),
62
80
  };
63
- const base = { server: ENDPOINT, repositories: [], defaultRepository: defaultRepository(), plans: [], billing: null, tools };
81
+ // The saved default is named only once the signed-in account is known to
82
+ // scan it. After a logout and a sign-in as another account, status still
83
+ // read "default Srivarsha1031/NodeGoat", the first account's repository
84
+ // (Varsha's 0.5.20 test, 1 December 2026, bug 17).
85
+ const base = { server: ENDPOINT, repositories: [], defaultRepository: null, plans: [], billing: null, tools };
64
86
  if (!key) {
65
87
  return {
66
88
  ...base, signedIn: false, ready: false, account: null,
@@ -93,6 +115,7 @@ export async function readiness(key, opts = {}) {
93
115
  if (repos.ok) {
94
116
  const installs = repos.value.installations ?? [];
95
117
  names = installs.flatMap((i) => i.repositories).filter((r) => !r.empty).map((r) => r.fullName);
118
+ base.defaultRepository = scannableOf(defaultRepository(), names);
96
119
  const accounts = installs.map((i) => i.account).filter((a) => !!a);
97
120
  const broken = installs.filter((i) => i.error && i.error !== 'partial').map((i) => `${i.account}: ${i.error}`);
98
121
  checks.push(installs.length
@@ -143,7 +166,7 @@ export const readinessJson = (r) => ({
143
166
  tools: r.tools,
144
167
  });
145
168
  export async function ensureSignedIn(flags = {}) {
146
- const s = await obtainSession({ interactive: isInteractive(flags), legacy: flags.legacy, device: flags.device, browser: flags.browser, quiet: flags.json });
169
+ const s = await obtainSession({ interactive: isInteractive(flags), legacy: flags.legacy, device: flags.device, browser: flags.browser, quiet: flags.json, already: flags.already });
147
170
  if (!s) {
148
171
  throw new Exit(EXIT.notSignedIn, isInteractive(flags)
149
172
  ? 'Not signed in; nothing was changed. Run npx sekura@latest login to try again.'
@@ -160,6 +183,9 @@ async function refreshAccount(s) {
160
183
  }
161
184
  return s.account;
162
185
  }
186
+ /** What a person who has not accepted the Terms reads: the one step left
187
+ * and how to take it, not a fault. */
188
+ export const TERMS_LATER = 'One step before your first scan: accept the Terms. When you are ready, run npx sekura@latest terms.';
163
189
  export async function ensureTerms(s, flags = {}) {
164
190
  const interactive = isInteractive(flags);
165
191
  const a = s.account ?? await refreshAccount(s);
@@ -171,7 +197,7 @@ export async function ensureTerms(s, flags = {}) {
171
197
  await refreshAccount(s);
172
198
  if (outcome === 'declined') {
173
199
  if (flags.soft) {
174
- say(`${dot} Terms not accepted yet. A scan cannot start before that: run npx sekura@latest terms when you are ready.`);
200
+ say(`${dot} ${TERMS_LATER}`);
175
201
  return 'declined';
176
202
  }
177
203
  throw new Exit(EXIT.declined, 'Terms not accepted; nothing was started. Run npx sekura@latest terms when you are ready.');
@@ -189,10 +215,10 @@ export async function ensureTerms(s, flags = {}) {
189
215
  const page = a?.links?.dashboard ?? link('/app');
190
216
  say(`${dot} Accept the Terms before your first scan: ${page}`);
191
217
  if (interactive && await ask(`Open ${HOST} to do that now?`, { default: true, short: 'Open it now?' })) {
192
- const o = openLink(page, { browser: flags.browser });
218
+ const o = openTrusted(page, SEKURA_HOSTS, { browser: flags.browser });
193
219
  if (!o.opened)
194
- say(` Open ${page}`);
195
- const r = await waitFor(`Waiting for the Terms on ${HOST}… press Enter to skip`, async () => {
220
+ say(o.why === 'untrusted' ? ` ${NOT_OPENED} ${page}` : ` Open ${page}`);
221
+ const r = await waitFor(`Accept the Terms on ${HOST}; this continues by itself (Enter skips)`, async () => {
196
222
  const now = await getAccount(s.key);
197
223
  s.account = now;
198
224
  return now.termsAccepted !== false;
@@ -271,27 +297,36 @@ export async function ensureApp(s, flags = {}) {
271
297
  // The install link carries a long state token: printed after "Opened" it
272
298
  // wrapped back to the left edge and was no use to anyone (Varsha's test,
273
299
  // F8). Opened, it is not printed; otherwise it gets a line of its own.
274
- const opened = openLink(url, { browser: flags.browser });
300
+ const opened = openTrusted(url, GITHUB_APP_HOSTS, { browser: flags.browser });
275
301
  if (opened.opened)
276
302
  say(` Opened ${onGithub ? 'github.com' : HOST} in your browser.`);
277
303
  else {
278
- say(' Open this link to install it:');
304
+ say(opened.why === 'untrusted' ? ` ${NOT_OPENED}` : ' Open this link to install it:');
279
305
  say(` ${url}`);
280
306
  }
281
307
  const before = new Set(repos.map((r) => r.fullName.toLowerCase()));
282
- const r = await waitFor('Waiting for the GitHub App install… press Enter to skip', async () => {
308
+ const r = await waitFor('Finish the install on github.com; this continues by itself (Enter skips)', async () => {
283
309
  list = await listRepositories(s.key, { refresh: true });
284
310
  repos = repositoriesOf(list);
285
- if (want)
286
- return repos.some((x) => same(x.fullName, want));
311
+ if (want && repos.some((x) => same(x.fullName, want)))
312
+ return true;
287
313
  if (ownMissing)
288
314
  return accountsOf(list).some((a) => same(a, own));
289
- return flags.add && before.size ? repos.some((x) => !before.has(x.fullName.toLowerCase())) : repos.length > 0;
315
+ // A first install is done when it lands, whatever was picked on GitHub.
316
+ // Waiting only for this folder's repository kept the terminal at "press
317
+ // Enter to skip" after the person had installed the App on another
318
+ // account without it (Tikka, 1 December 2026).
319
+ if (!before.size)
320
+ return repos.length > 0;
321
+ return repos.some((x) => !before.has(x.fullName.toLowerCase()));
290
322
  }, flags.wait);
291
323
  const found = r === 'done';
324
+ const hasWant = !!want && repos.some((x) => same(x.fullName, want));
292
325
  say(found
293
- ? `${tick} ${want ? `Sekura can scan ${want}` : ownMissing ? `The Sekura GitHub App is installed on ${own}` : before.size ? 'Sekura can scan more repositories now' : 'The Sekura GitHub App is installed'}`
326
+ ? `${tick} ${hasWant ? `Sekura can scan ${want}` : ownMissing ? `The Sekura GitHub App is installed on ${own}` : before.size ? 'Sekura can scan more repositories now' : 'The Sekura GitHub App is installed'}`
294
327
  : `${dot} Not there yet; you can finish the install later with npx sekura@latest repos --add`);
328
+ if (found && want && !hasWant)
329
+ say(` ${want} was not among the repositories you chose; pick one below, or add it later with npx sekura@latest repos --add`);
295
330
  return { installed: repos.length > 0, found, repositories: repos, link: url, accounts: accountsOf(list) };
296
331
  }
297
332
  export async function ensureRepository(s, flags = {}) {
package/dist/verify.js CHANGED
@@ -4,15 +4,15 @@
4
4
  // installer wrote will not connect, which the person should hear now rather
5
5
  // than from their tool later.
6
6
  import { ENDPOINT } from './catalogue.js';
7
- import { unreachable } from './errors.js';
7
+ import { unreachable, withAgent } from './errors.js';
8
8
  async function verifyWithKey(endpoint, key, signal) {
9
- const r = await fetch(endpoint, {
9
+ const r = await fetch(endpoint, withAgent({
10
10
  method: 'POST',
11
11
  headers: { authorization: `Bearer ${key}`, 'content-type': 'application/json', accept: 'application/json, text/event-stream' },
12
12
  body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'ping' }),
13
13
  signal,
14
14
  redirect: 'manual',
15
- });
15
+ }));
16
16
  if (r.status === 200)
17
17
  return { ok: true, detail: `Connected to ${new URL(endpoint).host}` };
18
18
  if (r.status === 401)
@@ -27,7 +27,7 @@ export async function verifyEndpoint(endpoint = ENDPOINT, timeoutMs = 8000, key)
27
27
  try {
28
28
  if (key)
29
29
  return await verifyWithKey(endpoint, key, ctl.signal);
30
- const r = await fetch(endpoint, { method: 'GET', headers: { accept: 'application/json' }, signal: ctl.signal, redirect: 'manual' });
30
+ const r = await fetch(endpoint, withAgent({ method: 'GET', headers: { accept: 'application/json' }, signal: ctl.signal, redirect: 'manual' }));
31
31
  const type = r.headers.get('content-type') || '';
32
32
  if (r.status === 401 && type.includes('json'))
33
33
  return { ok: true, detail: `${endpoint} answers and asks for a key, as it should` };
package/dist/writers.js CHANGED
@@ -15,7 +15,8 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, renameSyn
15
15
  import { randomBytes } from 'node:crypto';
16
16
  import { dirname } from 'node:path';
17
17
  import { spawnSync } from 'node:child_process';
18
- import { ENDPOINT, PENDING_KEY, SERVER_NAME } from './catalogue.js';
18
+ import { platform } from 'node:os';
19
+ import { ENDPOINT, PENDING_KEY, SERVER_NAME, pathOf } from './catalogue.js';
19
20
  import { redactAll } from './auth.js';
20
21
  export const SECRET_MODE = 0o600;
21
22
  export function writeConfig(path, text, secret) {
@@ -261,11 +262,28 @@ export function hasYaml(t) {
261
262
  const at = yamlLayout(lines, t.key);
262
263
  return 'entry' in at && !!at.entry && yamlOk(t, lines.slice(at.entry[0] + 1, at.entry[1]));
263
264
  }
264
- // ── commands ────────────────────────────────────────────────────────────────
265
- /** A read-only question (get, list) is given a time limit: a tool that
266
- * stopped to ask something on a closed stdin would hang `status` forever. */
267
265
  function spawn(bin, args, timeout) {
268
- return spawnSync(bin, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], ...(timeout ? { timeout } : {}) });
266
+ const options = { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], ...(timeout ? { timeout } : {}) };
267
+ const shim = platform() === 'win32' ? batchShimOf(bin) : null;
268
+ if (!shim)
269
+ return spawnSync(bin, args, options);
270
+ const line = batchCommandLine(shim, args);
271
+ if (line === null)
272
+ return { status: null, stdout: '', stderr: '', error: new Error(`${bin} cannot be run with these arguments on Windows`) };
273
+ return spawnSync(process.env.ComSpec || 'cmd.exe', ['/d', '/v:off', '/s', '/c', line], { ...options, windowsVerbatimArguments: true, windowsHide: true });
274
+ }
275
+ const BATCH_SHIM = /\.(cmd|bat)$/i;
276
+ export function batchShimOf(bin) {
277
+ const found = pathOf(bin);
278
+ return found && BATCH_SHIM.test(found) ? found : null;
279
+ }
280
+ const UNSAFE_IN_CMD = /["%\r\n\0]/;
281
+ const cmdQuoted = (word) => `"${word.replace(/(\\+)$/, '$1$1')}"`;
282
+ export function batchCommandLine(shim, args) {
283
+ const words = [shim, ...args];
284
+ if (words.some((w) => UNSAFE_IN_CMD.test(w)))
285
+ return null;
286
+ return `"${words.map(cmdQuoted).join(' ')}"`;
269
287
  }
270
288
  export function runCommand(bin, args) {
271
289
  const r = spawn(bin, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sekura",
3
- "version": "0.5.17",
3
+ "version": "0.5.21",
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 test/v5-fixes.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 test/v520-fixes.test.mjs",
41
41
  "prepack": "npm run build"
42
42
  },
43
43
  "dependencies": {
@@ -37,7 +37,7 @@ the first word:
37
37
  monthly plans: Weekly (`tier` `always`, the default) and More frequently
38
38
  (`tier` `pro`). Use `pro` only when the user asks for More frequently, and
39
39
  call it More frequently, never by its schedule kind (`daily`). It needs a
40
- schedule; if the user gave none, ask before quoting, and always ask the time zone.
40
+ schedule; if the user gave none, ask before quoting. Always ask the time zone, and offer the computer's own first (run `date +%Z` or read the system's zone); never assume one, such as America/Los_Angeles.
41
41
  - Weekly: a weekday and a time (`schedule.kind` `weekly`), or on demand. At most
42
42
  one scan in seven days.
43
43
  - More frequently: every day, every second day or every third day at a time
@@ -211,13 +211,14 @@ 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
+ - A refusal (`ok: false` with a `code`) is an expected answer, not a failure: relay its words as they are, and never show the person its code (such as `once_not_sold`) or an internal id (such as a `plan_…` id).
214
215
  - 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
216
  - The plans a user can buy here: a monthly plan for
216
217
  one repository, Weekly ($10 a month per repository) or More frequently ($25 a
217
218
  month per repository). The quote's price is the one that counts. There is no
218
219
  trial. Enterprise is quoted by Sekura: give no price or plan name for it.
219
220
  - 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`).
221
+ - 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 give the full command for the server this tool points at, as this skill writes it: `npx sekura@latest login`. A copy installed for a server other than sekura.ai already carries its `--endpoint` in every command; if the `sekura` server's address in this tool's settings is on a server other than sekura.ai and the command here has no `--endpoint`, add `--endpoint` with that server's origin (for example `--endpoint https://dev.sekura.ai`). 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`).
221
222
  - A scan can take a while. Offer `getScan` to check on it rather than polling in a loop.
222
223
  - Findings carry proof. When summarising, keep the evidence the finding gives; do not soften a severity.
223
224
  - Sekura scans only repositories the user has granted through the Sekura GitHub App. To add one: `npx sekura@latest repos --add` in a terminal.