@coderook/cli 0.35.0 → 0.37.0
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/.claude-plugin/plugin.json +1 -1
- package/README.md +100 -1
- package/dist/cli/src/actions_command.js +254 -0
- package/dist/cli/src/api.js +36 -3
- package/dist/cli/src/build_command.js +8 -0
- package/dist/cli/src/cli.js +256 -2
- package/dist/cli/src/community_command.js +136 -0
- package/dist/cli/src/config.js +2 -1
- package/dist/cli/src/issue_command.js +186 -0
- package/dist/cli/src/pr_command.js +318 -0
- package/dist/cli/src/private_command.js +65 -0
- package/dist/cli/src/project_commands.js +2 -1
- package/dist/cli/src/runner.js +73 -8
- package/dist/cli/src/service_commands.js +121 -5
- package/dist/cli/src/verify_command.js +135 -0
- package/package.json +1 -1
- package/skills/coderook/SKILL.md +51 -0
package/dist/cli/src/cli.js
CHANGED
|
@@ -32,6 +32,12 @@ const build_command_js_1 = require("./build_command.js");
|
|
|
32
32
|
const node_check_js_1 = require("./node_check.js");
|
|
33
33
|
const pages_command_js_1 = require("./pages_command.js");
|
|
34
34
|
const mods_command_js_1 = require("./mods_command.js");
|
|
35
|
+
const private_command_js_1 = require("./private_command.js");
|
|
36
|
+
const actions_command_js_1 = require("./actions_command.js");
|
|
37
|
+
const issue_command_js_1 = require("./issue_command.js");
|
|
38
|
+
const verify_command_js_1 = require("./verify_command.js");
|
|
39
|
+
const community_command_js_1 = require("./community_command.js");
|
|
40
|
+
const pr_command_js_1 = require("./pr_command.js");
|
|
35
41
|
const project_commands_js_1 = require("./project_commands.js");
|
|
36
42
|
const track_commands_js_1 = require("./track_commands.js");
|
|
37
43
|
const tracks_js_1 = require("../../cbx/src/core/tracks.js");
|
|
@@ -2793,6 +2799,31 @@ const SPECS = [
|
|
|
2793
2799
|
],
|
|
2794
2800
|
run: pages_command_js_1.commandPages,
|
|
2795
2801
|
},
|
|
2802
|
+
{
|
|
2803
|
+
name: "private",
|
|
2804
|
+
group: "Your projects",
|
|
2805
|
+
summary: "files and folders only the project's own people may see",
|
|
2806
|
+
usage: "private [list|add|remove|set] [pattern…] [--project <project>]",
|
|
2807
|
+
detail: "Keeps chosen files out of sight in a public project: visitors, the\n" +
|
|
2808
|
+
"public API, git clone, zips, Pages and search leave them out, while\n" +
|
|
2809
|
+
"members see everything. Patterns work like a .gitignore:\n\n" +
|
|
2810
|
+
" design/ a folder of that name, anywhere\n" +
|
|
2811
|
+
" *.psd every file of a type\n" +
|
|
2812
|
+
" docs/internal a path from the top of the project\n" +
|
|
2813
|
+
" src/**/*.key any depth in between\n\n" +
|
|
2814
|
+
"The list is kept on the project, not in a file, so it covers every\n" +
|
|
2815
|
+
"version at once, old ones included, and a save cannot undo it. Only the\n" +
|
|
2816
|
+
"project's owner or an admin can change it.",
|
|
2817
|
+
options: [
|
|
2818
|
+
{ flags: "--project <project>", description: "a project other than this folder's" },
|
|
2819
|
+
],
|
|
2820
|
+
examples: [
|
|
2821
|
+
'cbx private add "design/" "*.psd"',
|
|
2822
|
+
"cbx private list",
|
|
2823
|
+
'cbx private remove "*.psd"',
|
|
2824
|
+
],
|
|
2825
|
+
run: private_command_js_1.commandPrivate,
|
|
2826
|
+
},
|
|
2796
2827
|
{
|
|
2797
2828
|
name: "mods",
|
|
2798
2829
|
group: "Your projects",
|
|
@@ -2881,6 +2912,34 @@ const SPECS = [
|
|
|
2881
2912
|
],
|
|
2882
2913
|
run: service_commands_js_1.commandIssues,
|
|
2883
2914
|
},
|
|
2915
|
+
{
|
|
2916
|
+
name: "issue",
|
|
2917
|
+
group: "Your projects",
|
|
2918
|
+
summary: "read, answer, close, label or assign one issue",
|
|
2919
|
+
usage: "issue view|comment|close|reopen|label|assign <number> … | issue labels | issue rules",
|
|
2920
|
+
detail: "Closing says why: completed (the default), --reason not-planned, or\n" +
|
|
2921
|
+
"--duplicate-of <n>. Labels and assignment need write access; replying\n" +
|
|
2922
|
+
"needs only read access, as on the website.\n\n" +
|
|
2923
|
+
"Inside a run, CODEROOK_TOKEN and CODEROOK_PROJECT are set, so a workflow\n" +
|
|
2924
|
+
"can comment on or label the issue that started it with no setup.",
|
|
2925
|
+
options: [
|
|
2926
|
+
{ flags: "-m, --message <text>", description: "what to say (comment, or a note when closing)" },
|
|
2927
|
+
{ flags: "--reason <completed|not-planned>", description: "why it is closed" },
|
|
2928
|
+
{ flags: "--duplicate-of <n>", description: "close as a duplicate of another issue" },
|
|
2929
|
+
{ flags: "--remove", description: "take the labels off instead" },
|
|
2930
|
+
{ flags: "--starter", description: "with labels: add the usual set" },
|
|
2931
|
+
{ flags: "--project <name>", description: "which project" },
|
|
2932
|
+
],
|
|
2933
|
+
examples: [
|
|
2934
|
+
"cbx issue view 12",
|
|
2935
|
+
'cbx issue comment 12 -m "Fixed in v41"',
|
|
2936
|
+
"cbx issue close 12 --duplicate-of 9",
|
|
2937
|
+
"cbx issue label 12 bug,ui",
|
|
2938
|
+
"cbx issue assign 12 sam",
|
|
2939
|
+
"cbx issue labels --starter",
|
|
2940
|
+
],
|
|
2941
|
+
run: issue_command_js_1.commandIssue,
|
|
2942
|
+
},
|
|
2884
2943
|
{
|
|
2885
2944
|
name: "releases",
|
|
2886
2945
|
aliases: ["tags"],
|
|
@@ -2909,7 +2968,9 @@ const SPECS = [
|
|
|
2909
2968
|
"The signing secret is generated by the service and shown once, when\n" +
|
|
2910
2969
|
"the hook is added — no route hands it back afterwards.\n\n" +
|
|
2911
2970
|
"Events: version.published, merge.opened, merge.applied, merge.cancelled,\n" +
|
|
2912
|
-
"check.reported, change_request.opened, change_request.reviewed
|
|
2971
|
+
"check.reported, change_request.opened, change_request.reviewed,\n" +
|
|
2972
|
+
"issue.opened, issue.closed, issue.reopened, issue.commented,\n" +
|
|
2973
|
+
"issue.labeled, run.finished, run.failed, release.published.\n" +
|
|
2913
2974
|
"Naming none of them sends all of them.",
|
|
2914
2975
|
options: [
|
|
2915
2976
|
{ flags: "--add <url>", description: "notify this address; https only" },
|
|
@@ -3159,16 +3220,96 @@ const SPECS = [
|
|
|
3159
3220
|
options: [
|
|
3160
3221
|
{ flags: "--version <n>", description: "name this version instead of the newest" },
|
|
3161
3222
|
{ flags: "--notes <text>", description: "what changed, for the release page" },
|
|
3223
|
+
{ flags: "--generate-notes", description: "write the notes from what changed since the last release" },
|
|
3224
|
+
{ flags: "--draft", description: "save it as a draft: nothing is public until cbx release publish" },
|
|
3225
|
+
{ flags: "--prerelease", description: "keep it off the default update feed" },
|
|
3226
|
+
{ flags: "--channel <name>", description: "the update channel, like beta or nightly (stable by default)" },
|
|
3162
3227
|
{ flags: "--downloads <public|private>", description: "who can take what is attached, apart from the source" },
|
|
3163
3228
|
],
|
|
3164
3229
|
examples: [
|
|
3165
3230
|
"cbx release v1.0",
|
|
3231
|
+
"cbx release v2.0 --draft --generate-notes",
|
|
3232
|
+
"cbx release publish --version 41",
|
|
3233
|
+
"cbx release v2.1.0-beta.1 --prerelease --channel beta",
|
|
3166
3234
|
'cbx release v1.2 --version 41 --notes "Fixes the export dialog"',
|
|
3167
3235
|
"cbx release 1.4.0 --downloads public",
|
|
3168
3236
|
"cbx release --downloads private --version 41",
|
|
3169
3237
|
],
|
|
3170
3238
|
run: service_commands_js_1.commandRelease,
|
|
3171
3239
|
},
|
|
3240
|
+
{
|
|
3241
|
+
name: "fork",
|
|
3242
|
+
group: "Your projects",
|
|
3243
|
+
summary: "your own copy of somebody's project, and offering work back",
|
|
3244
|
+
usage: "fork <owner/project> [--name <slug>] | fork offer [line] --title <text> | fork sync",
|
|
3245
|
+
detail: "A fork is a private project under your account with the original's latest\n" +
|
|
3246
|
+
"public version (its private files left out). Nothing is uploaded again.\n\n" +
|
|
3247
|
+
"Inside a fork, `cbx fork offer <line>` offers that line to the original as\n" +
|
|
3248
|
+
"a pull request (offered again, the same pull request moves to your newest\n" +
|
|
3249
|
+
"save). Its runs there wait for the project's approval and get none of its\n" +
|
|
3250
|
+
"secrets. `cbx fork sync` brings the original's latest into an `upstream`\n" +
|
|
3251
|
+
"line of your fork, to merge when you choose.",
|
|
3252
|
+
options: [
|
|
3253
|
+
{ flags: "--name <slug>", description: "what to call your copy" },
|
|
3254
|
+
{ flags: "--title <text>", description: "offer: the pull request's title" },
|
|
3255
|
+
{ flags: "--body <text>", description: "offer: its description" },
|
|
3256
|
+
{ flags: "--project <name>", description: "offer/sync: which fork" },
|
|
3257
|
+
],
|
|
3258
|
+
examples: ["cbx fork sam/editor", 'cbx fork offer fix-export --title "Fix the export dialog"', "cbx fork sync"],
|
|
3259
|
+
run: community_command_js_1.commandFork,
|
|
3260
|
+
},
|
|
3261
|
+
{
|
|
3262
|
+
name: "security",
|
|
3263
|
+
group: "Your projects",
|
|
3264
|
+
summary: "report a vulnerability privately, or handle reports",
|
|
3265
|
+
usage: "security report <owner/project> --title <text> | security list | view|reply|mark S-<n>",
|
|
3266
|
+
detail: "A report is seen only by the project's owner and admins, and by whoever\n" +
|
|
3267
|
+
"sent it. Please use this rather than a public issue for anything that\n" +
|
|
3268
|
+
"could hurt people using the project.",
|
|
3269
|
+
options: [
|
|
3270
|
+
{ flags: "--title <text>", description: "report: what is wrong" },
|
|
3271
|
+
{ flags: "--body <text>", description: "report: details and how to reproduce it" },
|
|
3272
|
+
{ flags: "--severity <level>", description: "report: low, medium, high or critical" },
|
|
3273
|
+
{ flags: "-m, --message <text>", description: "reply: what to say" },
|
|
3274
|
+
{ flags: "--project <name>", description: "list/view/reply/mark: which project" },
|
|
3275
|
+
],
|
|
3276
|
+
examples: [
|
|
3277
|
+
'cbx security report sam/editor --title "Path traversal in export" --severity high',
|
|
3278
|
+
"cbx security list",
|
|
3279
|
+
'cbx security reply S-3 -m "Confirmed; fix in 2.0.1"',
|
|
3280
|
+
"cbx security mark S-3 fixed",
|
|
3281
|
+
],
|
|
3282
|
+
run: community_command_js_1.commandSecurity,
|
|
3283
|
+
},
|
|
3284
|
+
{
|
|
3285
|
+
name: "verify",
|
|
3286
|
+
group: "Your projects",
|
|
3287
|
+
summary: "check a download against its release's signed manifest",
|
|
3288
|
+
usage: "verify <owner/project> <release> <file…>",
|
|
3289
|
+
detail: "Every public release has a manifest listing each file with its size and\n" +
|
|
3290
|
+
"SHA-256, signed with CodeRook's release key. This checks the signature,\n" +
|
|
3291
|
+
"then the files you downloaded. A mismatch means do not run it.",
|
|
3292
|
+
options: [{ flags: "--key <base64>", description: "pin the release key instead of the one cbx knows" }],
|
|
3293
|
+
examples: ["cbx verify sam/editor v2.0.0 ./editor-setup.exe"],
|
|
3294
|
+
run: verify_command_js_1.commandVerify,
|
|
3295
|
+
},
|
|
3296
|
+
{
|
|
3297
|
+
name: "deps",
|
|
3298
|
+
group: "Your projects",
|
|
3299
|
+
summary: "known vulnerabilities in a save's dependencies",
|
|
3300
|
+
usage: "deps [version]",
|
|
3301
|
+
detail: "Reads the lockfiles in the save (package-lock.json, yarn.lock,\n" +
|
|
3302
|
+
"requirements.txt, poetry.lock, Pipfile.lock, Cargo.lock, go.sum,\n" +
|
|
3303
|
+
"composer.lock, Gemfile.lock) and asks OSV about every pinned version.\n" +
|
|
3304
|
+
"Only names and versions are sent, never code. Pull requests carry the\n" +
|
|
3305
|
+
"same answer as the coderook/dependencies check.",
|
|
3306
|
+
options: [
|
|
3307
|
+
{ flags: "--fresh", description: "ask OSV again rather than reading the kept report" },
|
|
3308
|
+
{ flags: "--project <name>", description: "which project" },
|
|
3309
|
+
],
|
|
3310
|
+
examples: ["cbx deps", "cbx deps 41 --fresh"],
|
|
3311
|
+
run: verify_command_js_1.commandDeps,
|
|
3312
|
+
},
|
|
3172
3313
|
{
|
|
3173
3314
|
name: "actions",
|
|
3174
3315
|
aliases: ["workflows"],
|
|
@@ -3181,7 +3322,10 @@ const SPECS = [
|
|
|
3181
3322
|
"ran against, so a passing build becomes a download without anybody\n" +
|
|
3182
3323
|
"opening the website. --ship turns that on for one action.\n\n" +
|
|
3183
3324
|
"Attaching is publishing: what an action ships onto a public version\n" +
|
|
3184
|
-
"is a download anybody can take, from the moment the run passes
|
|
3325
|
+
"is a download anybody can take, from the moment the run passes.\n\n" +
|
|
3326
|
+
"cbx actions check [files…] checks workflow files (.rook/workflows)\n" +
|
|
3327
|
+
"before you save them. cbx actions set <action> changes one made on the\n" +
|
|
3328
|
+
"website: --schedule, --timeout, --approval, --concurrency.",
|
|
3185
3329
|
options: [
|
|
3186
3330
|
{ flags: "--ship <action>", description: "its builds become downloads on the version" },
|
|
3187
3331
|
{ flags: "--no-ship <action>", description: "keep its files without attaching them" },
|
|
@@ -3189,15 +3333,123 @@ const SPECS = [
|
|
|
3189
3333
|
{ flags: "--on-proposal <action>", description: "run it on proposals; its result becomes a check" },
|
|
3190
3334
|
{ flags: "--by-hand <action>", description: "run it only when somebody starts it" },
|
|
3191
3335
|
{ flags: "--project <name>", description: "which project" },
|
|
3336
|
+
{ flags: "--schedule <cron>", description: "with set: run it on a schedule (UTC); off to stop" },
|
|
3337
|
+
{ flags: "--timeout <minutes>", description: "with set: stop a run that takes longer; off to stop" },
|
|
3338
|
+
{ flags: "--approval <on|off>", description: "with set: each run waits for somebody to approve it" },
|
|
3339
|
+
{ flags: "--concurrency <group>", description: "with set: one run of the group at a time; off to stop" },
|
|
3340
|
+
{ flags: "--cancel-old", description: "with set: a new run cancels the group's older ones" },
|
|
3341
|
+
{ flags: "--keep-old", description: "with set: a new run waits its turn" },
|
|
3192
3342
|
],
|
|
3193
3343
|
examples: [
|
|
3194
3344
|
"cbx actions",
|
|
3345
|
+
"cbx actions check",
|
|
3346
|
+
'cbx actions set "Nightly" --schedule "0 3 * * *" --timeout 30',
|
|
3347
|
+
'cbx actions set Deploy --approval on --concurrency deploy --cancel-old',
|
|
3195
3348
|
'cbx actions --ship "Windows installer"',
|
|
3196
3349
|
'cbx actions --no-ship "Windows installer"',
|
|
3197
3350
|
'cbx actions --on-proposal Tests',
|
|
3198
3351
|
],
|
|
3199
3352
|
run: service_commands_js_1.commandWorkflows,
|
|
3200
3353
|
},
|
|
3354
|
+
{
|
|
3355
|
+
name: "pr",
|
|
3356
|
+
group: "Working with a folder",
|
|
3357
|
+
summary: "pull requests: list, read, review, comment, merge",
|
|
3358
|
+
usage: "pr <list|view|files|comment|approve|request-changes|ask|label|title|ready|draft|retarget|close|reopen|merge> [M-3] …",
|
|
3359
|
+
detail: "A pull request is a line offered to another line (cbx propose opens one).\n" +
|
|
3360
|
+
"This is the Pull requests tab of the website, from here:\n\n" +
|
|
3361
|
+
" list [--all|--state merged] [--mine] [--label bug] the project's pull requests\n" +
|
|
3362
|
+
" view M-3 description, reviews, checks, conversation, blockers\n" +
|
|
3363
|
+
" files M-3 what it changes\n" +
|
|
3364
|
+
" comment M-3 -m \"…\" [--line path:12] a comment, or one on a line\n" +
|
|
3365
|
+
" approve M-3 [-m \"…\"] approve it\n" +
|
|
3366
|
+
" request-changes M-3 -m \"…\" ask for changes\n" +
|
|
3367
|
+
" ask M-3 sam,priya ask people to review it\n" +
|
|
3368
|
+
" label M-3 bug,ui set its labels\n" +
|
|
3369
|
+
" title M-3 \"New title\" rename it\n" +
|
|
3370
|
+
" ready M-3 | draft M-3 ready for review, or back to draft\n" +
|
|
3371
|
+
" retarget M-3 release land it on another line\n" +
|
|
3372
|
+
" close M-3 | reopen M-3 close without merging, or reopen\n" +
|
|
3373
|
+
" merge M-3 merge it, once nothing stands in the way\n\n" +
|
|
3374
|
+
"An approval stops counting when new saves land on the line: it was of the\n" +
|
|
3375
|
+
"code somebody looked at. A draft cannot be merged until it is marked ready.",
|
|
3376
|
+
options: [
|
|
3377
|
+
{ flags: "-m, --message <text>", description: "comment, review or title text" },
|
|
3378
|
+
{ flags: "--line <path:line>", description: "comment: on this line of a changed file" },
|
|
3379
|
+
{ flags: "--project <project>", description: "a project other than this folder's" },
|
|
3380
|
+
{ flags: "--state <state>", description: "list: open, merged, closed or all" },
|
|
3381
|
+
{ flags: "--label <name>", description: "list: only those with this label" },
|
|
3382
|
+
{ flags: "--author <username>", description: "list: only those opened by this person" },
|
|
3383
|
+
{ flags: "--all", description: "list: every state" },
|
|
3384
|
+
{ flags: "--mine", description: "list: only those waiting on your review" },
|
|
3385
|
+
{ flags: "--squash", description: "merge / auto-merge: land as one save, without the line's own saves" },
|
|
3386
|
+
{ flags: "--off", description: "auto-merge: stop waiting to merge by itself" },
|
|
3387
|
+
],
|
|
3388
|
+
examples: [
|
|
3389
|
+
"cbx pr list",
|
|
3390
|
+
"cbx pr view M-3",
|
|
3391
|
+
'cbx pr comment M-3 --line src/app.ts:42 -m "This can be null"',
|
|
3392
|
+
"cbx pr approve M-3",
|
|
3393
|
+
"cbx pr merge M-3",
|
|
3394
|
+
"cbx pr merge M-3 --squash",
|
|
3395
|
+
"cbx pr auto-merge M-3",
|
|
3396
|
+
],
|
|
3397
|
+
run: pr_command_js_1.commandPr,
|
|
3398
|
+
},
|
|
3399
|
+
{
|
|
3400
|
+
name: "cancel",
|
|
3401
|
+
group: "Actions",
|
|
3402
|
+
summary: "stop a run that is waiting or working",
|
|
3403
|
+
usage: "cancel <number> [project]",
|
|
3404
|
+
detail: "Marks the run cancelled at once. A runner working on it is told at its next\n" +
|
|
3405
|
+
"heartbeat and stops the work, including anything the command started.",
|
|
3406
|
+
examples: ["cbx cancel 12"],
|
|
3407
|
+
run: service_commands_js_1.commandCancel,
|
|
3408
|
+
},
|
|
3409
|
+
{
|
|
3410
|
+
name: "rerun",
|
|
3411
|
+
group: "Actions",
|
|
3412
|
+
summary: "run a finished run again",
|
|
3413
|
+
usage: "rerun <number> [project]",
|
|
3414
|
+
detail: "Queues the same action against the same save. When the run was checking a\n" +
|
|
3415
|
+
"pull request that is still open, its check goes back to waiting.",
|
|
3416
|
+
examples: ["cbx rerun 12"],
|
|
3417
|
+
run: service_commands_js_1.commandRerun,
|
|
3418
|
+
},
|
|
3419
|
+
{
|
|
3420
|
+
name: "approve",
|
|
3421
|
+
group: "Actions",
|
|
3422
|
+
summary: "let a run that waits for approval start",
|
|
3423
|
+
usage: "approve <number> [project]",
|
|
3424
|
+
detail: "An action marked as needing approval (often one that publishes) waits\n" +
|
|
3425
|
+
"after it is set off until somebody who can change the project approves it.",
|
|
3426
|
+
examples: ["cbx approve 12"],
|
|
3427
|
+
run: actions_command_js_1.commandApprove,
|
|
3428
|
+
},
|
|
3429
|
+
{
|
|
3430
|
+
name: "secret",
|
|
3431
|
+
aliases: ["secrets"],
|
|
3432
|
+
group: "Actions",
|
|
3433
|
+
summary: "values runs need that must not be in the files",
|
|
3434
|
+
usage: "secret list | set <NAME> | remove <NAME>",
|
|
3435
|
+
detail: "A secret is handed to each run as an environment variable of the same\n" +
|
|
3436
|
+
"name, but only to runs started by people who can change the project.\n" +
|
|
3437
|
+
"Run logs show *** in its place. Its value is never shown again.\n\n" +
|
|
3438
|
+
"The value is read from what is piped in, from another variable with\n" +
|
|
3439
|
+
"--from-env, or typed at a hidden prompt; never from an argument, which\n" +
|
|
3440
|
+
"would stay in your shell history.",
|
|
3441
|
+
options: [
|
|
3442
|
+
{ flags: "--from-env <VAR>", description: "take the value from this environment variable" },
|
|
3443
|
+
{ flags: "--project <name>", description: "which project" },
|
|
3444
|
+
],
|
|
3445
|
+
examples: [
|
|
3446
|
+
"cbx secret list",
|
|
3447
|
+
"cbx secret set DEPLOY_TOKEN",
|
|
3448
|
+
"cbx secret set SIGNING_KEY < key.pem",
|
|
3449
|
+
"cbx secret remove DEPLOY_TOKEN",
|
|
3450
|
+
],
|
|
3451
|
+
run: actions_command_js_1.commandSecret,
|
|
3452
|
+
},
|
|
3201
3453
|
{
|
|
3202
3454
|
name: "runs",
|
|
3203
3455
|
group: "Actions",
|
|
@@ -3224,6 +3476,7 @@ const SPECS = [
|
|
|
3224
3476
|
"stderr is shown in red. Exits 1 when the run failed, so this can be\n" +
|
|
3225
3477
|
"the last line of a script.",
|
|
3226
3478
|
examples: ["cbx logs 12", "cbx logs #12 my-project"],
|
|
3479
|
+
options: [{ flags: "--follow", description: "keep printing as it runs, until it ends" }],
|
|
3227
3480
|
run: service_commands_js_1.commandLogs,
|
|
3228
3481
|
},
|
|
3229
3482
|
{
|
|
@@ -3481,6 +3734,7 @@ SPECS.push({
|
|
|
3481
3734
|
"a command of your own, describe the build in coderook.build.json\n" +
|
|
3482
3735
|
"(cbx build init writes one), which is saved with the project.",
|
|
3483
3736
|
options: [
|
|
3737
|
+
{ flags: "--docker", description: "allow a Docker container as a last resort (never used otherwise)" },
|
|
3484
3738
|
{ flags: "-t, --target <list>", description: "windows-x64, linux-arm64, macos-arm64 … or win, linux, mac, all" },
|
|
3485
3739
|
{ flags: "--plan", description: "say how each target would be built, build nothing" },
|
|
3486
3740
|
{ flags: "--preset <name>", description: "go, bun, deno, rust, dotnet, electron, pyinstaller, python or custom" },
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commandFork = commandFork;
|
|
4
|
+
exports.commandSecurity = commandSecurity;
|
|
5
|
+
/**
|
|
6
|
+
* `cbx fork` — your own copy of somebody's project, and offering work back.
|
|
7
|
+
* `cbx security` — private vulnerability reports.
|
|
8
|
+
*
|
|
9
|
+
* cbx fork sam/editor [--name my-editor] copy it into your account
|
|
10
|
+
* cbx fork offer [line] --title "…" offer this fork's line to the original as a pull request
|
|
11
|
+
* cbx fork sync bring the original's latest into the "upstream" line
|
|
12
|
+
*
|
|
13
|
+
* cbx security report sam/editor --title "…" [--severity high] [--body "…"]
|
|
14
|
+
* cbx security list | view S-3 | reply S-3 -m "…" | mark S-3 fixed
|
|
15
|
+
*/
|
|
16
|
+
const api_js_1 = require("./api.js");
|
|
17
|
+
const colour_js_1 = require("./colour.js");
|
|
18
|
+
const project_commands_js_1 = require("./project_commands.js");
|
|
19
|
+
function flagText(parsed, ...names) {
|
|
20
|
+
for (const name of names) {
|
|
21
|
+
const value = parsed.flags.get(name);
|
|
22
|
+
if (typeof value === "string")
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
async function commandFork(parsed) {
|
|
28
|
+
const sub = parsed.positional[0] ?? "";
|
|
29
|
+
if (sub === "offer" || sub === "sync") {
|
|
30
|
+
const project = await (0, project_commands_js_1.resolveProject)(flagText(parsed, "project"));
|
|
31
|
+
if (!project)
|
|
32
|
+
return 1;
|
|
33
|
+
if (sub === "sync") {
|
|
34
|
+
const result = await (0, api_js_1.callApi)(`/v1/repositories/${encodeURIComponent(project.id)}/sync-upstream`, { method: "POST" });
|
|
35
|
+
console.log(`${(0, colour_js_1.green)("Brought in.")} The original's latest is v${result.sequence} on the ${(0, colour_js_1.accent)("upstream")} line.`);
|
|
36
|
+
console.log((0, colour_js_1.dim)(" Merge it into yours when you are ready: cbx propose upstream, or on the website."));
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
const line = parsed.positional[1] ?? "main";
|
|
40
|
+
const result = await (0, api_js_1.callApi)(`/v1/repositories/${encodeURIComponent(project.id)}/upstream-pulls`, { method: "POST", body: { line, title: flagText(parsed, "title", "m", "message") ?? `Changes from ${line}`, body: flagText(parsed, "body") ?? null } });
|
|
41
|
+
console.log(result.updated
|
|
42
|
+
? `${(0, colour_js_1.green)("Updated")} ${result.pull.reference} with your newest save on ${line}.`
|
|
43
|
+
: `${(0, colour_js_1.green)("Opened")} ${result.pull.reference} on the original, from ${result.line}.`);
|
|
44
|
+
console.log((0, colour_js_1.dim)(" Its runs there wait for the project's approval and get none of its secrets."));
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
const reference = sub;
|
|
48
|
+
if (!reference || !reference.includes("/")) {
|
|
49
|
+
console.error((0, colour_js_1.red)("Whose project? Try: cbx fork sam/editor (or: cbx fork offer, cbx fork sync)"));
|
|
50
|
+
return 1;
|
|
51
|
+
}
|
|
52
|
+
const source = await (0, api_js_1.findProject)(reference);
|
|
53
|
+
if (!source) {
|
|
54
|
+
console.error((0, colour_js_1.red)(`No project ${reference} that you can see.`));
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
const fork = await (0, api_js_1.callApi)(`/v1/repositories/${encodeURIComponent(source.id)}/fork`, {
|
|
58
|
+
method: "POST",
|
|
59
|
+
body: flagText(parsed, "name") ? { slug: flagText(parsed, "name") } : {},
|
|
60
|
+
});
|
|
61
|
+
console.log(`${(0, colour_js_1.green)("Forked")} ${reference} as ${(0, colour_js_1.bold)(fork.slug)} (private, v${fork.sequence}).`);
|
|
62
|
+
console.log((0, colour_js_1.dim)(` Get it: cbx get ${fork.slug} Offer changes back: cbx fork offer <line> --title "…"`));
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
async function commandSecurity(parsed) {
|
|
66
|
+
const sub = parsed.positional[0] ?? "list";
|
|
67
|
+
if (sub === "report") {
|
|
68
|
+
const reference = parsed.positional[1];
|
|
69
|
+
const target = reference ? await (0, api_js_1.findProject)(reference) : await (0, project_commands_js_1.resolveProject)(flagText(parsed, "project"));
|
|
70
|
+
if (!target) {
|
|
71
|
+
console.error((0, colour_js_1.red)(reference ? `No project ${reference} that you can see.` : "Which project? cbx security report sam/editor --title \"…\""));
|
|
72
|
+
return 1;
|
|
73
|
+
}
|
|
74
|
+
const title = flagText(parsed, "title", "m", "message");
|
|
75
|
+
if (!title) {
|
|
76
|
+
console.error((0, colour_js_1.red)('Say what is wrong: --title "Path traversal in export"'));
|
|
77
|
+
return 1;
|
|
78
|
+
}
|
|
79
|
+
const created = await (0, api_js_1.callApi)(`/v1/repositories/${encodeURIComponent(target.id)}/security-reports`, {
|
|
80
|
+
method: "POST",
|
|
81
|
+
body: { title, body: flagText(parsed, "body") ?? "", severity: flagText(parsed, "severity") ?? "unknown" },
|
|
82
|
+
});
|
|
83
|
+
console.log(`${(0, colour_js_1.green)("Sent privately")} as S-${created.number}. Only the project's owner and admins can read it; you hear when they reply.`);
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
const project = await (0, project_commands_js_1.resolveProject)(flagText(parsed, "project"));
|
|
87
|
+
if (!project)
|
|
88
|
+
return 1;
|
|
89
|
+
const base = `/v1/repositories/${encodeURIComponent(project.id)}/security-reports`;
|
|
90
|
+
if (sub === "list") {
|
|
91
|
+
const { reports } = await (0, api_js_1.callApi)(base);
|
|
92
|
+
if (!reports.length) {
|
|
93
|
+
console.log((0, colour_js_1.dim)(`No security reports on ${project.slug} that you can see.`));
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
for (const report of reports) {
|
|
97
|
+
console.log(` ${(0, colour_js_1.accent)(`S-${report.number}`)} ${report.title} ${(0, colour_js_1.dim)(`${report.severity} · ${report.state} · ${report.reporter ?? "?"}`)}`);
|
|
98
|
+
}
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
const number = Number((parsed.positional[1] ?? "").replace(/^S-/i, ""));
|
|
102
|
+
if (!Number.isInteger(number) || number < 1) {
|
|
103
|
+
console.error((0, colour_js_1.red)(`Which report? cbx security ${sub} S-3`));
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
if (sub === "view") {
|
|
107
|
+
const report = await (0, api_js_1.callApi)(`${base}/${number}`);
|
|
108
|
+
console.log(`${(0, colour_js_1.bold)(`S-${report.number} ${report.title}`)} ${(0, colour_js_1.dim)(`${report.severity} · ${report.state} · from ${report.reporter ?? "?"}`)}`);
|
|
109
|
+
console.log(report.body || (0, colour_js_1.dim)("(no details)"));
|
|
110
|
+
for (const comment of report.comments)
|
|
111
|
+
console.log(`\n${(0, colour_js_1.accent)(comment.author ?? "Somebody")} ${(0, colour_js_1.dim)(new Date(comment.createdAt).toLocaleString())}\n${comment.body}`);
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
if (sub === "reply") {
|
|
115
|
+
const body = flagText(parsed, "m", "message");
|
|
116
|
+
if (!body) {
|
|
117
|
+
console.error((0, colour_js_1.red)('Say something: cbx security reply S-3 -m "Confirmed, fixing"'));
|
|
118
|
+
return 1;
|
|
119
|
+
}
|
|
120
|
+
await (0, api_js_1.callApi)(`${base}/${number}/comments`, { method: "POST", body: { body } });
|
|
121
|
+
console.log((0, colour_js_1.green)(`Replied on S-${number}.`));
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
if (sub === "mark") {
|
|
125
|
+
const state = parsed.positional[2];
|
|
126
|
+
if (!state || !["open", "accepted", "fixed", "declined"].includes(state)) {
|
|
127
|
+
console.error((0, colour_js_1.red)("Mark it open, accepted, fixed or declined: cbx security mark S-3 fixed"));
|
|
128
|
+
return 1;
|
|
129
|
+
}
|
|
130
|
+
await (0, api_js_1.callApi)(`${base}/${number}`, { method: "PATCH", body: { state } });
|
|
131
|
+
console.log((0, colour_js_1.green)(`S-${number} is ${state}. Whoever reported it is told.`));
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
console.error((0, colour_js_1.red)(`cbx security has no "${sub}". `) + "Try: report, list, view, reply, mark");
|
|
135
|
+
return 1;
|
|
136
|
+
}
|
package/dist/cli/src/config.js
CHANGED
|
@@ -32,7 +32,8 @@ const node_os_1 = require("node:os");
|
|
|
32
32
|
const node_path_1 = __importDefault(require("node:path"));
|
|
33
33
|
exports.DEFAULT_API = "https://api.coderook.com";
|
|
34
34
|
function apiOrigin() {
|
|
35
|
-
|
|
35
|
+
/* CODEROOK_API is what a run is handed (with CODEROOK_TOKEN), so cbx inside a run needs no setup. */
|
|
36
|
+
return (process.env.CODEROOK_API_URL || process.env.CODEROOK_API || exports.DEFAULT_API).replace(/\/+$/, "");
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* The website that goes with the service, for a link somebody can open.
|