sekura 0.5.8 → 0.5.9

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/api.js CHANGED
@@ -143,6 +143,8 @@ export const tools = {
143
143
  startAlways: (key, args) => call(key, 'startAlways', args),
144
144
  quoteSchedule: (key, args) => call(key, 'quoteSchedule', args),
145
145
  updateSchedule: (key, args) => call(key, 'updateSchedule', args),
146
+ quotePlanChange: (key, args) => call(key, 'quotePlanChange', args),
147
+ changePlan: (key, args) => call(key, 'changePlan', args),
146
148
  quoteRunNow: (key, args) => call(key, 'quoteRunNow', args),
147
149
  runNow: (key, args) => call(key, 'runNow', args),
148
150
  previewCancelPlan: (key, args) => call(key, 'previewCancelPlan', args),
@@ -194,6 +194,56 @@ export async function runPlanSchedule(repo, opts = {}) {
194
194
  await afterStart(key, outcome, { what: `The new schedule for ${repository}`, watch: false, json: opts.json });
195
195
  });
196
196
  }
197
+ /**
198
+ * Move a repository between Weekly and More frequently (Sudhir, 29 November
199
+ * 2026: "add plan changes to cli and coding tool"). Quoted first like every
200
+ * change that can charge: an upgrade charges the difference for the rest of
201
+ * the month now, a downgrade nothing until the renewal. The two plans run on
202
+ * different schedules, so the new plan's schedule is asked for (or taken from
203
+ * --weekday/--every/--on-demand) with the change.
204
+ */
205
+ export async function runPlanChange(repo, opts = {}) {
206
+ const key = requireKey();
207
+ const repository = resolveRepository(repo, opts.cwd);
208
+ const command = `npx sekura@latest plan change ${repository}`;
209
+ await ready(async () => {
210
+ let args = { repository };
211
+ let toName = 'the other plan';
212
+ if (!opts.confirm) {
213
+ const plan = await planFor(key, repository);
214
+ if (!plan || !monthlyName(plan))
215
+ throw new Exit(EXIT.error, `${repository} has no monthly plan to change. To start one: npx sekura@latest plan start ${repository}`);
216
+ const now = tierOf(plan.tier === 'pro' ? 'pro' : 'always');
217
+ const to = opts.to ? tierOf(opts.to) : now === 'pro' ? 'always' : 'pro';
218
+ if (to === now)
219
+ throw new Exit(EXIT.error, `${repository} is already on ${monthlyName(plan)}. To change when it scans: npx sekura@latest plan schedule ${repository}`);
220
+ toName = to === 'pro' ? 'More frequently' : 'Weekly';
221
+ if (!flagged(opts) && interactive())
222
+ say(` ${toName} scans ${to === 'pro' ? 'every one to three days' : 'once a week'}. Choose its schedule:`);
223
+ args = { repository, tier: to, schedule: await scheduleFor(to, opts, command) };
224
+ }
225
+ const agreed = await confirmQuote({
226
+ op: 'quotePlanChange',
227
+ args,
228
+ fetch: () => tools.quotePlanChange(key, args),
229
+ flags: opts,
230
+ command,
231
+ question: `Move ${repository} to ${toName}?`,
232
+ sayQuote: sayText,
233
+ });
234
+ if (agreed.kind === 'quoted')
235
+ return;
236
+ const outcome = await startWithPayment(key, agreed.confirmOperation, agreed.confirmArguments, { quoteId: agreed.quoteId, browser: opts.browser });
237
+ if (outcome.kind === 'started') {
238
+ if (opts.json)
239
+ printJson(outcome.data);
240
+ else
241
+ sayText(outcome.text);
242
+ return;
243
+ }
244
+ await afterStart(key, outcome, { what: `The plan change for ${repository}`, watch: false, json: opts.json });
245
+ });
246
+ }
197
247
  export async function runPlanRun(repo, opts = {}) {
198
248
  const key = requireKey();
199
249
  const repository = resolveRepository(repo, opts.cwd);
@@ -247,6 +297,11 @@ const schedule = withScheduleOptions(withQuoteOptions(new Command('schedule')
247
297
  .description('Change when a monthly plan scans: shows the change, asks, then applies it.')
248
298
  .argument('[repo]', REPO_ARG)))
249
299
  .action(async (repo, opts) => { await runPlanSchedule(repo, opts); });
300
+ const change = withScheduleOptions(withQuoteOptions(new Command('change')
301
+ .description('Move a repository to the other monthly plan, up to More frequently or down to Weekly: shows the change and what it costs, asks, then applies it.')
302
+ .argument('[repo]', REPO_ARG)
303
+ .option('--to <plan>', 'weekly (Weekly) or frequent (More frequently); the default is the plan it is not on')))
304
+ .action(async (repo, opts) => { await runPlanChange(repo, opts); });
250
305
  const run = withFollowOptions(withQuoteOptions(new Command('run')
251
306
  .description('Start a monthly plan\'s scan now, within the plan\'s run limit: shows what it does, asks, then starts.')
252
307
  .argument('[repo]', REPO_ARG)))
@@ -256,8 +311,9 @@ const cancel = withQuoteOptions(new Command('cancel')
256
311
  .argument('[repo]', REPO_ARG))
257
312
  .action(async (repo, opts) => { await runPlanCancel(repo, opts); });
258
313
  export const planCommand = new Command('plan')
259
- .description('Start, schedule, run or cancel a monthly plan for a repository. sekura plans lists them.')
314
+ .description('Start, change, schedule, run or cancel a monthly plan for a repository. sekura plans lists them.')
260
315
  .addCommand(start)
316
+ .addCommand(change)
261
317
  .addCommand(schedule)
262
318
  .addCommand(run)
263
319
  .addCommand(cancel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sekura",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
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",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sekura
3
3
  description: Use when the user wants a GitHub repository scanned for vulnerabilities, wants to read scan findings or a report, or wants to put a repository on a monthly plan. Covers the sekura MCP tools and the rule that every scan and plan is quoted first and started only after the user agrees.
4
- argument-hint: "[help | repos | scan <owner/repo> | scans | scan-status <scan> | findings <scan> | report <scan> | cancel <scan|owner/repo> | monthly <owner/repo> | schedule <owner/repo> | plans | billing]"
4
+ argument-hint: "[help | repos | scan <owner/repo> | scans | scan-status <scan> | findings <scan> | report <scan> | cancel <scan|owner/repo> | monthly <owner/repo> | change <owner/repo> | schedule <owner/repo> | plans | billing]"
5
5
  ---
6
6
 
7
7
  # Sekura
@@ -45,6 +45,12 @@ the first word:
45
45
  a day.
46
46
  - On demand: `onDemand` true, keeping the plan's own `kind`, with `minute` and
47
47
  `tz`. Nothing runs until the user asks; `quoteRunNow` then `runNow` starts each scan.
48
+ - `change <owner/repo>`: move the repository to the other monthly plan, up to More
49
+ frequently (`tier` `pro`) or down to Weekly (`tier` `always`). Ask which plan if it
50
+ is not clear, and ask the schedule on the new plan (the two plans run on different
51
+ schedules), then `quotePlanChange` and the two-step rule (`changePlan`). Say the
52
+ money as the quote does: an upgrade charges the difference for the rest of the
53
+ month now; a downgrade charges nothing until the renewal.
48
54
  - `schedule <owner/repo>`: `quoteSchedule` for that repository with the schedule
49
55
  the user gives (ask for one if they gave none), then the two-step rule.
50
56
  - `plans`: `getPlans`. `billing`: `getBilling`.
@@ -65,6 +71,7 @@ Sekura: AI red team scans for your GitHub repositories
65
71
  /sekura cancel <scan> what cancelling a scan means; cancels only after you agree
66
72
  /sekura cancel <owner/repo> the same for a repository's monthly plan
67
73
  /sekura monthly <owner/repo> quote a monthly plan: Weekly or More frequently
74
+ /sekura change <owner/repo> move a monthly plan up or down (Weekly, More frequently)
68
75
  /sekura schedule <owner/repo> change when a monthly plan runs
69
76
  /sekura plans repositories on a monthly plan
70
77
  /sekura billing what is being billed
@@ -99,6 +106,7 @@ Quote, then confirm. The quote changes nothing and charges nothing:
99
106
  - `quoteScan` → `startScan`: a one-time scan of one repository.
100
107
  - `quoteAlways` → `startAlways`: a monthly plan (Weekly or More frequently) for one repository.
101
108
  - `quoteSchedule` → `updateSchedule`: change when a repository on a monthly plan is scanned. It charges nothing.
109
+ - `quotePlanChange` → `changePlan`: move a repository between Weekly and More frequently. Moving up charges the difference for the rest of the month now; moving down charges nothing until the renewal.
102
110
  - `quoteRunNow` → `runNow`: run a monthly plan's next scan now: brought forward on a schedule, started on demand. It is one of the plan's own runs, so there is no charge. Over the plan's limit it is refused with the first day a scan may start; tell the user that day.
103
111
 
104
112
  Preview, then act. The preview cancels nothing: