@clearlydev/nx-archweave 0.2.2 → 0.3.1
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 +9 -6
- package/dist/bin/review-verdict.js +60 -17
- package/dist/generators/add-agent-rules/generator.js +76 -931
- package/dist/generators/add-backend/generator.js +6 -931
- package/dist/generators/add-fsd-lite/generator.js +4 -929
- package/dist/generators/add-review/generator.js +138 -945
- package/dist/generators/doctor/generator.js +255 -37
- package/dist/generators/init/generator.js +196 -952
- package/package.json +4 -6
- package/src/generators/init/schema.json +6 -0
|
@@ -133,6 +133,30 @@ function buildOverEngineeringPrompt(locale) {
|
|
|
133
133
|
return [...body, "", renderFindingSchemaInstruction(locale, OVER_ENGINEERING_PRIORITIES), "", renderDedupInstruction(locale)].join("\n");
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// ../review-policy/dist/verdict-gate/verdict-comment.js
|
|
137
|
+
var VERDICT_MARKER = "<!-- archweave-verdict -->";
|
|
138
|
+
function renderCommitLine(locale, shortSha) {
|
|
139
|
+
return locale === "en" ? `<sub>Commit \`${shortSha}\` \xB7 this comment is updated on every review round.</sub>` : `<sub>\uCEE4\uBC0B \`${shortSha}\` \xB7 \uC774 \uCF54\uBA58\uD2B8\uB294 \uB9AC\uBDF0 \uB77C\uC6B4\uB4DC\uB9C8\uB2E4 \uAC31\uC2E0\uB429\uB2C8\uB2E4.</sub>`;
|
|
140
|
+
}
|
|
141
|
+
var NOT_RUN_REASON = {
|
|
142
|
+
en: {
|
|
143
|
+
secret: (secretName) => `the ${secretName} secret is not registered`,
|
|
144
|
+
fork: () => "this pull request comes from a fork, and GitHub passes no secrets to runs from forks",
|
|
145
|
+
dependabot: (secretName) => `Dependabot runs receive only Dependabot secrets, and ${secretName} is not one of them`,
|
|
146
|
+
rounds: (_secretName, maxRounds) => `the automated review round limit (${maxRounds}) is reached`
|
|
147
|
+
},
|
|
148
|
+
ko: {
|
|
149
|
+
secret: (secretName) => `${secretName} \uC2DC\uD06C\uB9BF\uC774 \uB4F1\uB85D\uB418\uC9C0 \uC54A\uC74C`,
|
|
150
|
+
fork: () => "\uD3EC\uD06C\uC5D0\uC11C \uC628 pull request\uC774\uACE0, GitHub\uB294 \uD3EC\uD06C \uC2E4\uD589\uC5D0 \uC2DC\uD06C\uB9BF\uC744 \uB118\uAE30\uC9C0 \uC54A\uC74C",
|
|
151
|
+
dependabot: (secretName) => `Dependabot \uC2E4\uD589\uC740 Dependabot \uC2DC\uD06C\uB9BF\uB9CC \uBC1B\uB294\uB370, ${secretName}\uB294 \uADF8\uC911\uC5D0 \uC5C6\uC74C`,
|
|
152
|
+
rounds: (_secretName, maxRounds) => `\uC790\uB3D9 \uB9AC\uBDF0 \uB77C\uC6B4\uB4DC \uD55C\uB3C4(${maxRounds})\uC5D0 \uB3C4\uB2EC\uD568`
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
function renderNotRunNotice(locale, reason, secretName, maxRounds) {
|
|
156
|
+
const why = NOT_RUN_REASON[locale][reason](secretName, maxRounds);
|
|
157
|
+
return locale === "en" ? `AI review did not run for this commit (${why}). A green check here does not mean the change was reviewed.` : `\uC774 \uCEE4\uBC0B\uC5D0\uB294 AI \uB9AC\uBDF0\uAC00 \uC2E4\uD589\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4(${why}). \uC774 green \uCCB4\uD06C\uB294 \uBCC0\uACBD \uC0AC\uD56D\uC774 \uB9AC\uBDF0\uB418\uC5C8\uB2E4\uB294 \uB73B\uC774 \uC544\uB2D9\uB2C8\uB2E4.`;
|
|
158
|
+
}
|
|
159
|
+
|
|
136
160
|
// ../review-policy/dist/verdict-gate/verdict-gate.js
|
|
137
161
|
var ROUND_MARKER = "<!-- archweave-review-round -->";
|
|
138
162
|
|
|
@@ -226,8 +250,35 @@ function renderRoundGateStep(maxRounds) {
|
|
|
226
250
|
" fi"
|
|
227
251
|
].join("\n");
|
|
228
252
|
}
|
|
253
|
+
function shellQuote(text) {
|
|
254
|
+
return `'${text.replace(/'/g, `'\\''`)}'`;
|
|
255
|
+
}
|
|
256
|
+
function renderNotRunFunction(secretName, maxRounds, locale) {
|
|
257
|
+
const reasons = ["secret", "fork", "dependabot", "rounds"];
|
|
258
|
+
const [commitBefore, commitAfter] = renderCommitLine(locale, "\0").split("\0");
|
|
259
|
+
return [
|
|
260
|
+
"not_run() {",
|
|
261
|
+
' case "$1" in',
|
|
262
|
+
...reasons.map((reason) => ` ${reason}) annotation=${shellQuote(renderNotRunNotice("en", reason, secretName, maxRounds))}; notice=${shellQuote(renderNotRunNotice(locale, reason, secretName, maxRounds))} ;;`),
|
|
263
|
+
" esac",
|
|
264
|
+
' echo "::notice title=AI review did not run::$annotation"',
|
|
265
|
+
` printf '%s\\n' "$notice" >> "$GITHUB_STEP_SUMMARY"`,
|
|
266
|
+
` short_sha=$(printf '%s' "$HEAD_SHA" | cut -c1-7)`,
|
|
267
|
+
' case "$short_sha" in',
|
|
268
|
+
" '' | *[!0-9a-f]*) short_sha= ;;",
|
|
269
|
+
" esac",
|
|
270
|
+
" {",
|
|
271
|
+
' echo "notice-body<<ARCHWEAVE_NOT_RUN_EOF"',
|
|
272
|
+
` printf '%s\\n' ${shellQuote(VERDICT_MARKER)} "\u2139\uFE0F $notice"`,
|
|
273
|
+
` if [ -n "$short_sha" ]; then printf '\\n%s\\n' ${shellQuote(commitBefore)}"$short_sha"${shellQuote(commitAfter)}; fi`,
|
|
274
|
+
' echo "ARCHWEAVE_NOT_RUN_EOF"',
|
|
275
|
+
' echo "run=false"',
|
|
276
|
+
' } >> "$GITHUB_OUTPUT"',
|
|
277
|
+
"}"
|
|
278
|
+
];
|
|
279
|
+
}
|
|
229
280
|
var JUDGE_CONDITION = "steps.ai-review-result.outputs.run == 'true'";
|
|
230
|
-
function renderAiReviewResultStep() {
|
|
281
|
+
function renderAiReviewResultStep(secretName, maxRounds, locale) {
|
|
231
282
|
return [
|
|
232
283
|
"- name: Check the AI review result",
|
|
233
284
|
" id: ai-review-result",
|
|
@@ -236,15 +287,26 @@ function renderAiReviewResultStep() {
|
|
|
236
287
|
" REVIEW_ENABLED: ${{ needs.ai-review.outputs.enabled }}",
|
|
237
288
|
" REVIEW_ALLOWED: ${{ needs.ai-review.outputs.allowed }}",
|
|
238
289
|
" LAST_COMMENT_ID: ${{ needs.ai-review.outputs.last-comment-id }}",
|
|
290
|
+
" HEAD_SHA: ${{ github.event.pull_request.head.sha }}",
|
|
291
|
+
" HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}",
|
|
292
|
+
" REPOSITORY: ${{ github.repository }}",
|
|
293
|
+
" PR_AUTHOR: ${{ github.event.pull_request.user.login }}",
|
|
239
294
|
" run: |",
|
|
295
|
+
...renderNotRunFunction(secretName, maxRounds, locale).map((line) => ` ${line}`),
|
|
240
296
|
' if [ "$AI_REVIEW_RESULT" != success ]; then',
|
|
241
297
|
` echo "::error title=AI review did not succeed::The AI review job ended with '$AI_REVIEW_RESULT'."`,
|
|
242
298
|
" exit 1",
|
|
243
299
|
" fi",
|
|
244
300
|
' case "$REVIEW_ENABLED/$REVIEW_ALLOWED" in',
|
|
245
|
-
" false/*
|
|
246
|
-
'
|
|
247
|
-
|
|
301
|
+
" false/*)",
|
|
302
|
+
' if [ "$HEAD_REPOSITORY" != "$REPOSITORY" ]; then not_run fork',
|
|
303
|
+
` elif [ "$PR_AUTHOR" = 'dependabot[bot]' ]; then not_run dependabot`,
|
|
304
|
+
" else not_run secret",
|
|
305
|
+
" fi",
|
|
306
|
+
" exit 0",
|
|
307
|
+
" ;;",
|
|
308
|
+
" true/false)",
|
|
309
|
+
" not_run rounds",
|
|
248
310
|
" exit 0",
|
|
249
311
|
" ;;",
|
|
250
312
|
" true/true)",
|
|
@@ -285,10 +347,17 @@ function renderVerdictGateStep(maxRounds, locale) {
|
|
|
285
347
|
}
|
|
286
348
|
function renderBlockStep() {
|
|
287
349
|
return [
|
|
288
|
-
"- name: Fail
|
|
350
|
+
"- name: Fail the review check",
|
|
289
351
|
" if: steps.verdict.outputs.blocked == 'true'",
|
|
352
|
+
" env:",
|
|
353
|
+
" BLOCK_REASON: ${{ steps.verdict.outputs.block-reason }}",
|
|
290
354
|
" run: |",
|
|
291
|
-
'
|
|
355
|
+
' case "$BLOCK_REASON" in',
|
|
356
|
+
' block) echo "The AI verdict is BLOCK: fix the P0/P1 findings in the verdict comment and push." ;;',
|
|
357
|
+
' no-summary) echo "The AI review posted no summary for this commit, so there is no verdict. Re-run all jobs to review it again, or review it yourself." ;;',
|
|
358
|
+
' unreadable) echo "The AI review summary has no readable findings block, so there is no verdict. Re-run all jobs to review it again, or review it yourself." ;;',
|
|
359
|
+
' *) echo "The review check failed. See the verdict comment on this pull request." ;;',
|
|
360
|
+
" esac",
|
|
292
361
|
" exit 1"
|
|
293
362
|
].join("\n");
|
|
294
363
|
}
|
|
@@ -303,6 +372,9 @@ function renderVerdictCommentStep() {
|
|
|
303
372
|
" PREVIOUS_ID: ${{ needs.review.outputs.previous-comment-id }}",
|
|
304
373
|
" run: |",
|
|
305
374
|
` payload=$(jq -n --arg body "$VERDICT_BODY" '{body: $body}')`,
|
|
375
|
+
' if [ -z "$PREVIOUS_ID" ]; then',
|
|
376
|
+
` PREVIOUS_ID=$(gh api "repos/$REPOSITORY/issues/$PR_NUMBER/comments" --paginate --jq '.[] | select(.user.login == "github-actions[bot]") | select(.body | contains("${VERDICT_MARKER}")) | .id' | tail -n 1) || PREVIOUS_ID=`,
|
|
377
|
+
" fi",
|
|
306
378
|
' case "$PREVIOUS_ID" in',
|
|
307
379
|
" ''|*[!0-9]*) PREVIOUS_ID= ;;",
|
|
308
380
|
" esac",
|
|
@@ -373,10 +445,11 @@ function renderWorkspaceSetupSteps(packageManager) {
|
|
|
373
445
|
].join("\n"));
|
|
374
446
|
return steps.join("\n\n");
|
|
375
447
|
}
|
|
448
|
+
var REVIEW_JOB_TIMEOUT_MINUTES = 15;
|
|
376
449
|
function renderReviewWorkflow(input, parts) {
|
|
377
450
|
const aiReviewSteps = [renderSecretGateStep(parts.secretName), renderRoundGateStep(input.maxRounds), ...parts.reviewSteps];
|
|
378
451
|
const reviewSteps = [
|
|
379
|
-
renderAiReviewResultStep(),
|
|
452
|
+
renderAiReviewResultStep(parts.secretName, input.maxRounds, input.locale),
|
|
380
453
|
renderCheckoutStep(JUDGE_CONDITION),
|
|
381
454
|
renderWorkspaceSetupSteps(input.packageManager),
|
|
382
455
|
renderVerdictGateStep(input.maxRounds, input.locale),
|
|
@@ -394,6 +467,7 @@ function renderReviewWorkflow(input, parts) {
|
|
|
394
467
|
"jobs:",
|
|
395
468
|
" ai-review:",
|
|
396
469
|
" runs-on: ubuntu-latest",
|
|
470
|
+
` timeout-minutes: ${REVIEW_JOB_TIMEOUT_MINUTES}`,
|
|
397
471
|
indentBlock(renderReviewPermissions(parts.idToken), 4),
|
|
398
472
|
" outputs:",
|
|
399
473
|
" enabled: ${{ steps.secret-gate.outputs.enabled }}",
|
|
@@ -406,11 +480,12 @@ function renderReviewWorkflow(input, parts) {
|
|
|
406
480
|
" needs: ai-review",
|
|
407
481
|
" if: always()",
|
|
408
482
|
" runs-on: ubuntu-latest",
|
|
483
|
+
` timeout-minutes: ${REVIEW_JOB_TIMEOUT_MINUTES}`,
|
|
409
484
|
" permissions:",
|
|
410
485
|
" contents: read",
|
|
411
486
|
" pull-requests: read",
|
|
412
487
|
" outputs:",
|
|
413
|
-
" comment-body: ${{ steps.verdict.outputs.comment-body }}",
|
|
488
|
+
" comment-body: ${{ steps.verdict.outputs.comment-body || steps.ai-review-result.outputs.notice-body }}",
|
|
414
489
|
" previous-comment-id: ${{ steps.verdict.outputs.previous-comment-id }}",
|
|
415
490
|
" steps:",
|
|
416
491
|
indentBlock(reviewSteps.join("\n\n"), 6),
|
|
@@ -420,6 +495,7 @@ function renderReviewWorkflow(input, parts) {
|
|
|
420
495
|
// Runs after a BLOCK failed the review job, too: the comment explains the red check.
|
|
421
496
|
" if: ${{ !cancelled() && needs.review.outputs.comment-body != '' }}",
|
|
422
497
|
" runs-on: ubuntu-latest",
|
|
498
|
+
` timeout-minutes: ${REVIEW_JOB_TIMEOUT_MINUTES}`,
|
|
423
499
|
" permissions:",
|
|
424
500
|
" pull-requests: write",
|
|
425
501
|
" steps:",
|
|
@@ -431,17 +507,27 @@ function renderReviewWorkflow(input, parts) {
|
|
|
431
507
|
// ../template-engine/dist/review/claude/claude-provider.js
|
|
432
508
|
var SECRET_NAME = "CLAUDE_CODE_OAUTH_TOKEN";
|
|
433
509
|
var ALLOWED_TOOLS = "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)";
|
|
510
|
+
var CLAUDE_STEP_ID = "claude-review";
|
|
511
|
+
var PR_CONTEXT = ["REPO: ${{ github.repository }}", "PR NUMBER: ${{ github.event.pull_request.number }}"];
|
|
434
512
|
function renderWorkflowInstructions(locale) {
|
|
435
513
|
const lines = locale === "en" ? [
|
|
436
|
-
|
|
437
|
-
"
|
|
514
|
+
...PR_CONTEXT,
|
|
515
|
+
"",
|
|
516
|
+
"Review the diff of this pull request using `gh pr diff <PR NUMBER>` and `gh pr view <PR NUMBER>`.",
|
|
517
|
+
"Post specific findings as inline comments with `mcp__github_inline_comment__create_inline_comment` (pass `confirmed: true`), and exactly one top-level summary comment.",
|
|
518
|
+
"Post the summary with `gh pr comment <PR NUMBER> --body-file - <<'ARCHWEAVE_EOF'`, the body on the following lines, then a line `ARCHWEAVE_EOF` (the quoted delimiter keeps backticks and `$` literal). Never pass the body with `--body \"...\"` or `$(...)`.",
|
|
519
|
+
"Run each `gh` command on its own: no pipes to other programs, no `&&` chains.",
|
|
438
520
|
`Always include the literal marker ${ROUND_MARKER} in the top-level summary comment.`,
|
|
439
521
|
"If there are no findings that require action, post exactly one top-level comment saying so (and still include the marker).",
|
|
440
522
|
"Do not modify any code, and never approve or merge the pull request.",
|
|
441
523
|
"Write summaries and explanations in English; keep file names, function names, and identifiers verbatim."
|
|
442
524
|
] : [
|
|
443
|
-
|
|
444
|
-
"
|
|
525
|
+
...PR_CONTEXT,
|
|
526
|
+
"",
|
|
527
|
+
"\uC774 pull request\uC758 diff\uB97C `gh pr diff <PR NUMBER>`\uC640 `gh pr view <PR NUMBER>`\uB85C \uD655\uC778\uD558\uACE0 \uB9AC\uBDF0\uD558\uC138\uC694.",
|
|
528
|
+
"\uAD6C\uCCB4\uC801 \uC9C0\uC801\uC740 `mcp__github_inline_comment__create_inline_comment`(`confirmed: true` \uC804\uB2EC)\uB85C inline comment\uB97C \uB2EC\uACE0, \uC804\uCCB4 \uC694\uC57D\uC740 \uC815\uD655\uD788 \uD55C \uAC1C\uC758 top-level comment\uB85C \uAC8C\uC2DC\uD558\uC138\uC694.",
|
|
529
|
+
"\uC694\uC57D\uC740 `gh pr comment <PR NUMBER> --body-file - <<'ARCHWEAVE_EOF'`\uB85C \uAC8C\uC2DC\uD558\uC138\uC694. \uB2E4\uC74C \uC904\uBD80\uD130 \uBCF8\uBB38\uC744 \uC4F0\uACE0, \uB9C8\uC9C0\uB9C9 \uC904\uC5D0 `ARCHWEAVE_EOF`\uB9CC \uC4F0\uC138\uC694(\uB530\uC634\uD45C \uCE5C \uAD6C\uBD84\uC790\uB77C \uBC31\uD2F1\uACFC `$`\uAC00 \uADF8\uB300\uB85C \uB0A8\uC544\uC694). \uBCF8\uBB38\uC744 `--body \"...\"`\uB098 `$(...)`\uB85C \uB118\uAE30\uC9C0 \uB9C8\uC138\uC694.",
|
|
530
|
+
"`gh` \uBA85\uB839\uC740 \uD558\uB098\uC529 \uB530\uB85C \uC2E4\uD589\uD558\uC138\uC694. \uB2E4\uB978 \uD504\uB85C\uADF8\uB7A8\uC73C\uB85C \uD30C\uC774\uD504\uD558\uAC70\uB098 `&&`\uB85C \uC787\uC9C0 \uB9C8\uC138\uC694.",
|
|
445
531
|
`top-level \uC694\uC57D \uCF54\uBA58\uD2B8\uC5D0\uB294 \uBC18\uB4DC\uC2DC \uB9AC\uD130\uB7F4 \uB9C8\uCEE4 ${ROUND_MARKER}\uB97C \uD3EC\uD568\uD558\uC138\uC694.`,
|
|
446
532
|
'\uC870\uCE58\uAC00 \uD544\uC694\uD55C \uBB38\uC81C\uAC00 \uC5C6\uC73C\uBA74 "\uC870\uCE58\uAC00 \uD544\uC694\uD55C \uBB38\uC81C\uB97C \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."\uB77C\uB294 top-level comment\uB97C \uC815\uD655\uD788 \uD55C \uAC1C \uAC8C\uC2DC\uD558\uC138\uC694(\uC774\uB54C\uB3C4 \uB9C8\uCEE4\uB294 \uD3EC\uD568).',
|
|
447
533
|
"\uCF54\uB4DC\uB97C \uC218\uC815\uD558\uC9C0 \uB9C8\uC138\uC694(Do not modify any code). PR\uC744 \uC2B9\uC778\uD558\uAC70\uB098 \uBCD1\uD569\uD558\uC9C0 \uB9C8\uC138\uC694(never approve or merge).",
|
|
@@ -458,6 +544,20 @@ function composePrompt(input) {
|
|
|
458
544
|
sections.push(renderFindingsBlockInstruction(input.locale));
|
|
459
545
|
return sections.join("\n\n---\n\n");
|
|
460
546
|
}
|
|
547
|
+
function renderDeniedToolsStep() {
|
|
548
|
+
return [
|
|
549
|
+
"- name: Show denied tool calls",
|
|
550
|
+
` if: always() && steps.${CLAUDE_STEP_ID}.outputs.execution_file != ''`,
|
|
551
|
+
" env:",
|
|
552
|
+
` EXECUTION_FILE: \${{ steps.${CLAUDE_STEP_ID}.outputs.execution_file }}`,
|
|
553
|
+
" run: |",
|
|
554
|
+
' [ -f "$EXECUTION_FILE" ] || exit 0',
|
|
555
|
+
` stop_token="archweave-$(od -An -N16 -tx1 /dev/urandom | tr -d ' \\n')"`,
|
|
556
|
+
' echo "::stop-commands::$stop_token"',
|
|
557
|
+
` jq -c '.[] | select(.type == "result") | ((.permission_denials[]? | {tool: .tool_name, command: ((.tool_input.command // "") | tostring | .[0:200])}), (select(.is_error == true) | {error: ((.result // "") | tostring | .[0:300])}))' "$EXECUTION_FILE" || echo "Could not read the execution file."`,
|
|
558
|
+
' echo "::$stop_token::"'
|
|
559
|
+
].join("\n");
|
|
560
|
+
}
|
|
461
561
|
function buildWorkflowYaml(input) {
|
|
462
562
|
return renderReviewWorkflow(input, {
|
|
463
563
|
name: "Claude Code Review",
|
|
@@ -468,6 +568,7 @@ function buildWorkflowYaml(input) {
|
|
|
468
568
|
renderCheckoutStep(REVIEW_GATE_CONDITION),
|
|
469
569
|
[
|
|
470
570
|
"- name: Run Claude review",
|
|
571
|
+
` id: ${CLAUDE_STEP_ID}`,
|
|
471
572
|
` if: ${REVIEW_GATE_CONDITION}`,
|
|
472
573
|
` uses: ${pinnedUses("anthropics/claude-code-action")}`,
|
|
473
574
|
" with:",
|
|
@@ -476,7 +577,8 @@ function buildWorkflowYaml(input) {
|
|
|
476
577
|
indentBlock(composePrompt(input), 6),
|
|
477
578
|
" claude_args: |",
|
|
478
579
|
` --allowedTools "${ALLOWED_TOOLS}"`
|
|
479
|
-
].join("\n")
|
|
580
|
+
].join("\n"),
|
|
581
|
+
renderDeniedToolsStep()
|
|
480
582
|
]
|
|
481
583
|
});
|
|
482
584
|
}
|
|
@@ -544,7 +646,9 @@ function buildWorkflowYaml2(input) {
|
|
|
544
646
|
` CURSOR_API_KEY: \${{ secrets.${SECRET_NAME2} }}`,
|
|
545
647
|
" GH_TOKEN: ${{ github.token }}",
|
|
546
648
|
" run: |",
|
|
547
|
-
|
|
649
|
+
// cursor-agent stops at "Workspace Trust Required" without --trust (2026.10.22 on
|
|
650
|
+
// Actions); the folder is this run's own checkout, and forks never get the secret.
|
|
651
|
+
` agent --trust -p "$(cat <<'${PROMPT_HEREDOC_DELIMITER}'`,
|
|
548
652
|
indentBlock(composePrompt2(input), 4),
|
|
549
653
|
` ${PROMPT_HEREDOC_DELIMITER}`,
|
|
550
654
|
' )"'
|
|
@@ -588,6 +692,7 @@ function composePrompt3(input) {
|
|
|
588
692
|
sections.push(renderFindingsBlockInstruction(input.locale));
|
|
589
693
|
return sections.join("\n\n---\n\n");
|
|
590
694
|
}
|
|
695
|
+
var GEMINI_CLI_VERSION = "0.65.0";
|
|
591
696
|
function buildWorkflowYaml3(input) {
|
|
592
697
|
return renderReviewWorkflow(input, {
|
|
593
698
|
name: "Gemini Code Review",
|
|
@@ -602,8 +707,13 @@ function buildWorkflowYaml3(input) {
|
|
|
602
707
|
` uses: ${pinnedUses("google-github-actions/run-gemini-cli")}`,
|
|
603
708
|
" env:",
|
|
604
709
|
" GITHUB_TOKEN: ${{ github.token }}",
|
|
710
|
+
// Gemini CLI 0.65 refuses to run in a folder it hasn't been told to trust (measured
|
|
711
|
+
// 2026-10-25 on Actions). The folder is this run's own checkout; pull requests from forks
|
|
712
|
+
// never get here, because they get no secret.
|
|
713
|
+
" GEMINI_CLI_TRUST_WORKSPACE: 'true'",
|
|
605
714
|
" with:",
|
|
606
715
|
` gemini_api_key: \${{ secrets.${SECRET_NAME3} }}`,
|
|
716
|
+
` gemini_cli_version: '${GEMINI_CLI_VERSION}'`,
|
|
607
717
|
" prompt: |",
|
|
608
718
|
indentBlock(composePrompt3(input), 6)
|
|
609
719
|
].join("\n")
|
|
@@ -754,933 +864,8 @@ function renderTemplateFiles(srcFolder, target, substitutions) {
|
|
|
754
864
|
).sort((a, b) => a.filePath.localeCompare(b.filePath));
|
|
755
865
|
}
|
|
756
866
|
|
|
757
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
758
|
-
function createScanner(text, ignoreTrivia = false) {
|
|
759
|
-
const len = text.length;
|
|
760
|
-
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
761
|
-
function scanHexDigits(count, exact) {
|
|
762
|
-
let digits = 0;
|
|
763
|
-
let value2 = 0;
|
|
764
|
-
while (digits < count || !exact) {
|
|
765
|
-
let ch = text.charCodeAt(pos);
|
|
766
|
-
if (ch >= 48 && ch <= 57) {
|
|
767
|
-
value2 = value2 * 16 + ch - 48;
|
|
768
|
-
} else if (ch >= 65 && ch <= 70) {
|
|
769
|
-
value2 = value2 * 16 + ch - 65 + 10;
|
|
770
|
-
} else if (ch >= 97 && ch <= 102) {
|
|
771
|
-
value2 = value2 * 16 + ch - 97 + 10;
|
|
772
|
-
} else {
|
|
773
|
-
break;
|
|
774
|
-
}
|
|
775
|
-
pos++;
|
|
776
|
-
digits++;
|
|
777
|
-
}
|
|
778
|
-
if (digits < count) {
|
|
779
|
-
value2 = -1;
|
|
780
|
-
}
|
|
781
|
-
return value2;
|
|
782
|
-
}
|
|
783
|
-
function setPosition(newPosition) {
|
|
784
|
-
pos = newPosition;
|
|
785
|
-
value = "";
|
|
786
|
-
tokenOffset = 0;
|
|
787
|
-
token = 16;
|
|
788
|
-
scanError = 0;
|
|
789
|
-
}
|
|
790
|
-
function scanNumber() {
|
|
791
|
-
let start = pos;
|
|
792
|
-
if (text.charCodeAt(pos) === 48) {
|
|
793
|
-
pos++;
|
|
794
|
-
} else {
|
|
795
|
-
pos++;
|
|
796
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
797
|
-
pos++;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
801
|
-
pos++;
|
|
802
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
803
|
-
pos++;
|
|
804
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
805
|
-
pos++;
|
|
806
|
-
}
|
|
807
|
-
} else {
|
|
808
|
-
scanError = 3;
|
|
809
|
-
return text.substring(start, pos);
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
let end = pos;
|
|
813
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
814
|
-
pos++;
|
|
815
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
816
|
-
pos++;
|
|
817
|
-
}
|
|
818
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
819
|
-
pos++;
|
|
820
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
821
|
-
pos++;
|
|
822
|
-
}
|
|
823
|
-
end = pos;
|
|
824
|
-
} else {
|
|
825
|
-
scanError = 3;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
return text.substring(start, end);
|
|
829
|
-
}
|
|
830
|
-
function scanString() {
|
|
831
|
-
let result = "", start = pos;
|
|
832
|
-
while (true) {
|
|
833
|
-
if (pos >= len) {
|
|
834
|
-
result += text.substring(start, pos);
|
|
835
|
-
scanError = 2;
|
|
836
|
-
break;
|
|
837
|
-
}
|
|
838
|
-
const ch = text.charCodeAt(pos);
|
|
839
|
-
if (ch === 34) {
|
|
840
|
-
result += text.substring(start, pos);
|
|
841
|
-
pos++;
|
|
842
|
-
break;
|
|
843
|
-
}
|
|
844
|
-
if (ch === 92) {
|
|
845
|
-
result += text.substring(start, pos);
|
|
846
|
-
pos++;
|
|
847
|
-
if (pos >= len) {
|
|
848
|
-
scanError = 2;
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
const ch2 = text.charCodeAt(pos++);
|
|
852
|
-
switch (ch2) {
|
|
853
|
-
case 34:
|
|
854
|
-
result += '"';
|
|
855
|
-
break;
|
|
856
|
-
case 92:
|
|
857
|
-
result += "\\";
|
|
858
|
-
break;
|
|
859
|
-
case 47:
|
|
860
|
-
result += "/";
|
|
861
|
-
break;
|
|
862
|
-
case 98:
|
|
863
|
-
result += "\b";
|
|
864
|
-
break;
|
|
865
|
-
case 102:
|
|
866
|
-
result += "\f";
|
|
867
|
-
break;
|
|
868
|
-
case 110:
|
|
869
|
-
result += "\n";
|
|
870
|
-
break;
|
|
871
|
-
case 114:
|
|
872
|
-
result += "\r";
|
|
873
|
-
break;
|
|
874
|
-
case 116:
|
|
875
|
-
result += " ";
|
|
876
|
-
break;
|
|
877
|
-
case 117:
|
|
878
|
-
const ch3 = scanHexDigits(4, true);
|
|
879
|
-
if (ch3 >= 0) {
|
|
880
|
-
result += String.fromCharCode(ch3);
|
|
881
|
-
} else {
|
|
882
|
-
scanError = 4;
|
|
883
|
-
}
|
|
884
|
-
break;
|
|
885
|
-
default:
|
|
886
|
-
scanError = 5;
|
|
887
|
-
}
|
|
888
|
-
start = pos;
|
|
889
|
-
continue;
|
|
890
|
-
}
|
|
891
|
-
if (ch >= 0 && ch <= 31) {
|
|
892
|
-
if (isLineBreak(ch)) {
|
|
893
|
-
result += text.substring(start, pos);
|
|
894
|
-
scanError = 2;
|
|
895
|
-
break;
|
|
896
|
-
} else {
|
|
897
|
-
scanError = 6;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
pos++;
|
|
901
|
-
}
|
|
902
|
-
return result;
|
|
903
|
-
}
|
|
904
|
-
function scanNext() {
|
|
905
|
-
value = "";
|
|
906
|
-
scanError = 0;
|
|
907
|
-
tokenOffset = pos;
|
|
908
|
-
lineStartOffset = lineNumber;
|
|
909
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
910
|
-
if (pos >= len) {
|
|
911
|
-
tokenOffset = len;
|
|
912
|
-
return token = 17;
|
|
913
|
-
}
|
|
914
|
-
let code = text.charCodeAt(pos);
|
|
915
|
-
if (isWhiteSpace(code)) {
|
|
916
|
-
do {
|
|
917
|
-
pos++;
|
|
918
|
-
value += String.fromCharCode(code);
|
|
919
|
-
code = text.charCodeAt(pos);
|
|
920
|
-
} while (isWhiteSpace(code));
|
|
921
|
-
return token = 15;
|
|
922
|
-
}
|
|
923
|
-
if (isLineBreak(code)) {
|
|
924
|
-
pos++;
|
|
925
|
-
value += String.fromCharCode(code);
|
|
926
|
-
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
927
|
-
pos++;
|
|
928
|
-
value += "\n";
|
|
929
|
-
}
|
|
930
|
-
lineNumber++;
|
|
931
|
-
tokenLineStartOffset = pos;
|
|
932
|
-
return token = 14;
|
|
933
|
-
}
|
|
934
|
-
switch (code) {
|
|
935
|
-
// tokens: []{}:,
|
|
936
|
-
case 123:
|
|
937
|
-
pos++;
|
|
938
|
-
return token = 1;
|
|
939
|
-
case 125:
|
|
940
|
-
pos++;
|
|
941
|
-
return token = 2;
|
|
942
|
-
case 91:
|
|
943
|
-
pos++;
|
|
944
|
-
return token = 3;
|
|
945
|
-
case 93:
|
|
946
|
-
pos++;
|
|
947
|
-
return token = 4;
|
|
948
|
-
case 58:
|
|
949
|
-
pos++;
|
|
950
|
-
return token = 6;
|
|
951
|
-
case 44:
|
|
952
|
-
pos++;
|
|
953
|
-
return token = 5;
|
|
954
|
-
// strings
|
|
955
|
-
case 34:
|
|
956
|
-
pos++;
|
|
957
|
-
value = scanString();
|
|
958
|
-
return token = 10;
|
|
959
|
-
// comments
|
|
960
|
-
case 47:
|
|
961
|
-
const start = pos - 1;
|
|
962
|
-
if (text.charCodeAt(pos + 1) === 47) {
|
|
963
|
-
pos += 2;
|
|
964
|
-
while (pos < len) {
|
|
965
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
966
|
-
break;
|
|
967
|
-
}
|
|
968
|
-
pos++;
|
|
969
|
-
}
|
|
970
|
-
value = text.substring(start, pos);
|
|
971
|
-
return token = 12;
|
|
972
|
-
}
|
|
973
|
-
if (text.charCodeAt(pos + 1) === 42) {
|
|
974
|
-
pos += 2;
|
|
975
|
-
const safeLength = len - 1;
|
|
976
|
-
let commentClosed = false;
|
|
977
|
-
while (pos < safeLength) {
|
|
978
|
-
const ch = text.charCodeAt(pos);
|
|
979
|
-
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
980
|
-
pos += 2;
|
|
981
|
-
commentClosed = true;
|
|
982
|
-
break;
|
|
983
|
-
}
|
|
984
|
-
pos++;
|
|
985
|
-
if (isLineBreak(ch)) {
|
|
986
|
-
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
987
|
-
pos++;
|
|
988
|
-
}
|
|
989
|
-
lineNumber++;
|
|
990
|
-
tokenLineStartOffset = pos;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
if (!commentClosed) {
|
|
994
|
-
pos++;
|
|
995
|
-
scanError = 1;
|
|
996
|
-
}
|
|
997
|
-
value = text.substring(start, pos);
|
|
998
|
-
return token = 13;
|
|
999
|
-
}
|
|
1000
|
-
value += String.fromCharCode(code);
|
|
1001
|
-
pos++;
|
|
1002
|
-
return token = 16;
|
|
1003
|
-
// numbers
|
|
1004
|
-
case 45:
|
|
1005
|
-
value += String.fromCharCode(code);
|
|
1006
|
-
pos++;
|
|
1007
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
1008
|
-
return token = 16;
|
|
1009
|
-
}
|
|
1010
|
-
// found a minus, followed by a number so
|
|
1011
|
-
// we fall through to proceed with scanning
|
|
1012
|
-
// numbers
|
|
1013
|
-
case 48:
|
|
1014
|
-
case 49:
|
|
1015
|
-
case 50:
|
|
1016
|
-
case 51:
|
|
1017
|
-
case 52:
|
|
1018
|
-
case 53:
|
|
1019
|
-
case 54:
|
|
1020
|
-
case 55:
|
|
1021
|
-
case 56:
|
|
1022
|
-
case 57:
|
|
1023
|
-
value += scanNumber();
|
|
1024
|
-
return token = 11;
|
|
1025
|
-
// literals and unknown symbols
|
|
1026
|
-
default:
|
|
1027
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
1028
|
-
pos++;
|
|
1029
|
-
code = text.charCodeAt(pos);
|
|
1030
|
-
}
|
|
1031
|
-
if (tokenOffset !== pos) {
|
|
1032
|
-
value = text.substring(tokenOffset, pos);
|
|
1033
|
-
switch (value) {
|
|
1034
|
-
case "true":
|
|
1035
|
-
return token = 8;
|
|
1036
|
-
case "false":
|
|
1037
|
-
return token = 9;
|
|
1038
|
-
case "null":
|
|
1039
|
-
return token = 7;
|
|
1040
|
-
}
|
|
1041
|
-
return token = 16;
|
|
1042
|
-
}
|
|
1043
|
-
value += String.fromCharCode(code);
|
|
1044
|
-
pos++;
|
|
1045
|
-
return token = 16;
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
function isUnknownContentCharacter(code) {
|
|
1049
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
1050
|
-
return false;
|
|
1051
|
-
}
|
|
1052
|
-
switch (code) {
|
|
1053
|
-
case 125:
|
|
1054
|
-
case 93:
|
|
1055
|
-
case 123:
|
|
1056
|
-
case 91:
|
|
1057
|
-
case 34:
|
|
1058
|
-
case 58:
|
|
1059
|
-
case 44:
|
|
1060
|
-
case 47:
|
|
1061
|
-
return false;
|
|
1062
|
-
}
|
|
1063
|
-
return true;
|
|
1064
|
-
}
|
|
1065
|
-
function scanNextNonTrivia() {
|
|
1066
|
-
let result;
|
|
1067
|
-
do {
|
|
1068
|
-
result = scanNext();
|
|
1069
|
-
} while (result >= 12 && result <= 15);
|
|
1070
|
-
return result;
|
|
1071
|
-
}
|
|
1072
|
-
return {
|
|
1073
|
-
setPosition,
|
|
1074
|
-
getPosition: () => pos,
|
|
1075
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
1076
|
-
getToken: () => token,
|
|
1077
|
-
getTokenValue: () => value,
|
|
1078
|
-
getTokenOffset: () => tokenOffset,
|
|
1079
|
-
getTokenLength: () => pos - tokenOffset,
|
|
1080
|
-
getTokenStartLine: () => lineStartOffset,
|
|
1081
|
-
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
1082
|
-
getTokenError: () => scanError
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
function isWhiteSpace(ch) {
|
|
1086
|
-
return ch === 32 || ch === 9;
|
|
1087
|
-
}
|
|
1088
|
-
function isLineBreak(ch) {
|
|
1089
|
-
return ch === 10 || ch === 13;
|
|
1090
|
-
}
|
|
1091
|
-
function isDigit(ch) {
|
|
1092
|
-
return ch >= 48 && ch <= 57;
|
|
1093
|
-
}
|
|
1094
|
-
var CharacterCodes;
|
|
1095
|
-
(function(CharacterCodes2) {
|
|
1096
|
-
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
1097
|
-
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
1098
|
-
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
1099
|
-
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
1100
|
-
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
1101
|
-
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
1102
|
-
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
1103
|
-
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
1104
|
-
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
1105
|
-
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
1106
|
-
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
1107
|
-
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
1108
|
-
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
1109
|
-
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
1110
|
-
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
1111
|
-
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
1112
|
-
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
1113
|
-
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
1114
|
-
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
1115
|
-
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
1116
|
-
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
1117
|
-
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
1118
|
-
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
1119
|
-
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
1120
|
-
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
1121
|
-
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
1122
|
-
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
1123
|
-
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
1124
|
-
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
1125
|
-
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
1126
|
-
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
1127
|
-
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
1128
|
-
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
1129
|
-
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
1130
|
-
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
1131
|
-
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
1132
|
-
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
1133
|
-
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
1134
|
-
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
1135
|
-
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
1136
|
-
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
1137
|
-
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
1138
|
-
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
1139
|
-
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
1140
|
-
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
1141
|
-
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
1142
|
-
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
1143
|
-
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
1144
|
-
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
1145
|
-
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
1146
|
-
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
1147
|
-
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
1148
|
-
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
1149
|
-
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
1150
|
-
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
1151
|
-
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
1152
|
-
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
1153
|
-
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
1154
|
-
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
1155
|
-
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
1156
|
-
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
1157
|
-
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
1158
|
-
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
1159
|
-
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
1160
|
-
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
1161
|
-
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
1162
|
-
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
1163
|
-
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
1164
|
-
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
1165
|
-
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
1166
|
-
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
1167
|
-
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
1168
|
-
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
1169
|
-
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
1170
|
-
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
1171
|
-
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
1172
|
-
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
1173
|
-
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
1174
|
-
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
1175
|
-
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
1176
|
-
})(CharacterCodes || (CharacterCodes = {}));
|
|
1177
|
-
|
|
1178
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
1179
|
-
var cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
1180
|
-
return " ".repeat(index);
|
|
1181
|
-
});
|
|
1182
|
-
var maxCachedValues = 200;
|
|
1183
|
-
var cachedBreakLinesWithSpaces = {
|
|
1184
|
-
" ": {
|
|
1185
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
1186
|
-
return "\n" + " ".repeat(index);
|
|
1187
|
-
}),
|
|
1188
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
1189
|
-
return "\r" + " ".repeat(index);
|
|
1190
|
-
}),
|
|
1191
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
1192
|
-
return "\r\n" + " ".repeat(index);
|
|
1193
|
-
})
|
|
1194
|
-
},
|
|
1195
|
-
" ": {
|
|
1196
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
1197
|
-
return "\n" + " ".repeat(index);
|
|
1198
|
-
}),
|
|
1199
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
1200
|
-
return "\r" + " ".repeat(index);
|
|
1201
|
-
}),
|
|
1202
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
1203
|
-
return "\r\n" + " ".repeat(index);
|
|
1204
|
-
})
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
|
|
1208
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
1209
|
-
var ParseOptions;
|
|
1210
|
-
(function(ParseOptions2) {
|
|
1211
|
-
ParseOptions2.DEFAULT = {
|
|
1212
|
-
allowTrailingComma: false
|
|
1213
|
-
};
|
|
1214
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
1215
|
-
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
1216
|
-
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
1217
|
-
function ensurePropertyComplete(endOffset) {
|
|
1218
|
-
if (currentParent.type === "property") {
|
|
1219
|
-
currentParent.length = endOffset - currentParent.offset;
|
|
1220
|
-
currentParent = currentParent.parent;
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
function onValue(valueNode) {
|
|
1224
|
-
currentParent.children.push(valueNode);
|
|
1225
|
-
return valueNode;
|
|
1226
|
-
}
|
|
1227
|
-
const visitor = {
|
|
1228
|
-
onObjectBegin: (offset) => {
|
|
1229
|
-
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
1230
|
-
},
|
|
1231
|
-
onObjectProperty: (name, offset, length) => {
|
|
1232
|
-
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
1233
|
-
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
1234
|
-
},
|
|
1235
|
-
onObjectEnd: (offset, length) => {
|
|
1236
|
-
ensurePropertyComplete(offset + length);
|
|
1237
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
1238
|
-
currentParent = currentParent.parent;
|
|
1239
|
-
ensurePropertyComplete(offset + length);
|
|
1240
|
-
},
|
|
1241
|
-
onArrayBegin: (offset, length) => {
|
|
1242
|
-
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
1243
|
-
},
|
|
1244
|
-
onArrayEnd: (offset, length) => {
|
|
1245
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
1246
|
-
currentParent = currentParent.parent;
|
|
1247
|
-
ensurePropertyComplete(offset + length);
|
|
1248
|
-
},
|
|
1249
|
-
onLiteralValue: (value, offset, length) => {
|
|
1250
|
-
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
1251
|
-
ensurePropertyComplete(offset + length);
|
|
1252
|
-
},
|
|
1253
|
-
onSeparator: (sep, offset, length) => {
|
|
1254
|
-
if (currentParent.type === "property") {
|
|
1255
|
-
if (sep === ":") {
|
|
1256
|
-
currentParent.colonOffset = offset;
|
|
1257
|
-
} else if (sep === ",") {
|
|
1258
|
-
ensurePropertyComplete(offset);
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
},
|
|
1262
|
-
onError: (error, offset, length) => {
|
|
1263
|
-
errors.push({ error, offset, length });
|
|
1264
|
-
}
|
|
1265
|
-
};
|
|
1266
|
-
visit(text, visitor, options);
|
|
1267
|
-
const result = currentParent.children[0];
|
|
1268
|
-
if (result) {
|
|
1269
|
-
delete result.parent;
|
|
1270
|
-
}
|
|
1271
|
-
return result;
|
|
1272
|
-
}
|
|
1273
|
-
function findNodeAtLocation(root, path) {
|
|
1274
|
-
if (!root) {
|
|
1275
|
-
return void 0;
|
|
1276
|
-
}
|
|
1277
|
-
let node = root;
|
|
1278
|
-
for (let segment of path) {
|
|
1279
|
-
if (typeof segment === "string") {
|
|
1280
|
-
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
1281
|
-
return void 0;
|
|
1282
|
-
}
|
|
1283
|
-
let found = false;
|
|
1284
|
-
for (const propertyNode of node.children) {
|
|
1285
|
-
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
1286
|
-
node = propertyNode.children[1];
|
|
1287
|
-
found = true;
|
|
1288
|
-
break;
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
if (!found) {
|
|
1292
|
-
return void 0;
|
|
1293
|
-
}
|
|
1294
|
-
} else {
|
|
1295
|
-
const index = segment;
|
|
1296
|
-
if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
1297
|
-
return void 0;
|
|
1298
|
-
}
|
|
1299
|
-
node = node.children[index];
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
return node;
|
|
1303
|
-
}
|
|
1304
|
-
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
1305
|
-
const _scanner = createScanner(text, false);
|
|
1306
|
-
const _jsonPath = [];
|
|
1307
|
-
let suppressedCallbacks = 0;
|
|
1308
|
-
function toNoArgVisit(visitFunction) {
|
|
1309
|
-
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
1310
|
-
}
|
|
1311
|
-
function toOneArgVisit(visitFunction) {
|
|
1312
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
1313
|
-
}
|
|
1314
|
-
function toOneArgVisitWithPath(visitFunction) {
|
|
1315
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
1316
|
-
}
|
|
1317
|
-
function toBeginVisit(visitFunction) {
|
|
1318
|
-
return visitFunction ? () => {
|
|
1319
|
-
if (suppressedCallbacks > 0) {
|
|
1320
|
-
suppressedCallbacks++;
|
|
1321
|
-
} else {
|
|
1322
|
-
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
1323
|
-
if (cbReturn === false) {
|
|
1324
|
-
suppressedCallbacks = 1;
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
} : () => true;
|
|
1328
|
-
}
|
|
1329
|
-
function toEndVisit(visitFunction) {
|
|
1330
|
-
return visitFunction ? () => {
|
|
1331
|
-
if (suppressedCallbacks > 0) {
|
|
1332
|
-
suppressedCallbacks--;
|
|
1333
|
-
}
|
|
1334
|
-
if (suppressedCallbacks === 0) {
|
|
1335
|
-
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
1336
|
-
}
|
|
1337
|
-
} : () => true;
|
|
1338
|
-
}
|
|
1339
|
-
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
1340
|
-
const disallowComments = options && options.disallowComments;
|
|
1341
|
-
const allowTrailingComma = options && options.allowTrailingComma;
|
|
1342
|
-
function scanNext() {
|
|
1343
|
-
while (true) {
|
|
1344
|
-
const token = _scanner.scan();
|
|
1345
|
-
switch (_scanner.getTokenError()) {
|
|
1346
|
-
case 4:
|
|
1347
|
-
handleError(
|
|
1348
|
-
14
|
|
1349
|
-
/* ParseErrorCode.InvalidUnicode */
|
|
1350
|
-
);
|
|
1351
|
-
break;
|
|
1352
|
-
case 5:
|
|
1353
|
-
handleError(
|
|
1354
|
-
15
|
|
1355
|
-
/* ParseErrorCode.InvalidEscapeCharacter */
|
|
1356
|
-
);
|
|
1357
|
-
break;
|
|
1358
|
-
case 3:
|
|
1359
|
-
handleError(
|
|
1360
|
-
13
|
|
1361
|
-
/* ParseErrorCode.UnexpectedEndOfNumber */
|
|
1362
|
-
);
|
|
1363
|
-
break;
|
|
1364
|
-
case 1:
|
|
1365
|
-
if (!disallowComments) {
|
|
1366
|
-
handleError(
|
|
1367
|
-
11
|
|
1368
|
-
/* ParseErrorCode.UnexpectedEndOfComment */
|
|
1369
|
-
);
|
|
1370
|
-
}
|
|
1371
|
-
break;
|
|
1372
|
-
case 2:
|
|
1373
|
-
handleError(
|
|
1374
|
-
12
|
|
1375
|
-
/* ParseErrorCode.UnexpectedEndOfString */
|
|
1376
|
-
);
|
|
1377
|
-
break;
|
|
1378
|
-
case 6:
|
|
1379
|
-
handleError(
|
|
1380
|
-
16
|
|
1381
|
-
/* ParseErrorCode.InvalidCharacter */
|
|
1382
|
-
);
|
|
1383
|
-
break;
|
|
1384
|
-
}
|
|
1385
|
-
switch (token) {
|
|
1386
|
-
case 12:
|
|
1387
|
-
case 13:
|
|
1388
|
-
if (disallowComments) {
|
|
1389
|
-
handleError(
|
|
1390
|
-
10
|
|
1391
|
-
/* ParseErrorCode.InvalidCommentToken */
|
|
1392
|
-
);
|
|
1393
|
-
} else {
|
|
1394
|
-
onComment();
|
|
1395
|
-
}
|
|
1396
|
-
break;
|
|
1397
|
-
case 16:
|
|
1398
|
-
handleError(
|
|
1399
|
-
1
|
|
1400
|
-
/* ParseErrorCode.InvalidSymbol */
|
|
1401
|
-
);
|
|
1402
|
-
break;
|
|
1403
|
-
case 15:
|
|
1404
|
-
case 14:
|
|
1405
|
-
break;
|
|
1406
|
-
default:
|
|
1407
|
-
return token;
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
1412
|
-
onError(error);
|
|
1413
|
-
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
1414
|
-
let token = _scanner.getToken();
|
|
1415
|
-
while (token !== 17) {
|
|
1416
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
1417
|
-
scanNext();
|
|
1418
|
-
break;
|
|
1419
|
-
} else if (skipUntil.indexOf(token) !== -1) {
|
|
1420
|
-
break;
|
|
1421
|
-
}
|
|
1422
|
-
token = scanNext();
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
function parseString(isValue) {
|
|
1427
|
-
const value = _scanner.getTokenValue();
|
|
1428
|
-
if (isValue) {
|
|
1429
|
-
onLiteralValue(value);
|
|
1430
|
-
} else {
|
|
1431
|
-
onObjectProperty(value);
|
|
1432
|
-
_jsonPath.push(value);
|
|
1433
|
-
}
|
|
1434
|
-
scanNext();
|
|
1435
|
-
return true;
|
|
1436
|
-
}
|
|
1437
|
-
function parseLiteral() {
|
|
1438
|
-
switch (_scanner.getToken()) {
|
|
1439
|
-
case 11:
|
|
1440
|
-
const tokenValue = _scanner.getTokenValue();
|
|
1441
|
-
let value = Number(tokenValue);
|
|
1442
|
-
if (isNaN(value)) {
|
|
1443
|
-
handleError(
|
|
1444
|
-
2
|
|
1445
|
-
/* ParseErrorCode.InvalidNumberFormat */
|
|
1446
|
-
);
|
|
1447
|
-
value = 0;
|
|
1448
|
-
}
|
|
1449
|
-
onLiteralValue(value);
|
|
1450
|
-
break;
|
|
1451
|
-
case 7:
|
|
1452
|
-
onLiteralValue(null);
|
|
1453
|
-
break;
|
|
1454
|
-
case 8:
|
|
1455
|
-
onLiteralValue(true);
|
|
1456
|
-
break;
|
|
1457
|
-
case 9:
|
|
1458
|
-
onLiteralValue(false);
|
|
1459
|
-
break;
|
|
1460
|
-
default:
|
|
1461
|
-
return false;
|
|
1462
|
-
}
|
|
1463
|
-
scanNext();
|
|
1464
|
-
return true;
|
|
1465
|
-
}
|
|
1466
|
-
function parseProperty() {
|
|
1467
|
-
if (_scanner.getToken() !== 10) {
|
|
1468
|
-
handleError(3, [], [
|
|
1469
|
-
2,
|
|
1470
|
-
5
|
|
1471
|
-
/* SyntaxKind.CommaToken */
|
|
1472
|
-
]);
|
|
1473
|
-
return false;
|
|
1474
|
-
}
|
|
1475
|
-
parseString(false);
|
|
1476
|
-
if (_scanner.getToken() === 6) {
|
|
1477
|
-
onSeparator(":");
|
|
1478
|
-
scanNext();
|
|
1479
|
-
if (!parseValue()) {
|
|
1480
|
-
handleError(4, [], [
|
|
1481
|
-
2,
|
|
1482
|
-
5
|
|
1483
|
-
/* SyntaxKind.CommaToken */
|
|
1484
|
-
]);
|
|
1485
|
-
}
|
|
1486
|
-
} else {
|
|
1487
|
-
handleError(5, [], [
|
|
1488
|
-
2,
|
|
1489
|
-
5
|
|
1490
|
-
/* SyntaxKind.CommaToken */
|
|
1491
|
-
]);
|
|
1492
|
-
}
|
|
1493
|
-
_jsonPath.pop();
|
|
1494
|
-
return true;
|
|
1495
|
-
}
|
|
1496
|
-
function parseObject() {
|
|
1497
|
-
onObjectBegin();
|
|
1498
|
-
scanNext();
|
|
1499
|
-
let needsComma = false;
|
|
1500
|
-
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
1501
|
-
if (_scanner.getToken() === 5) {
|
|
1502
|
-
if (!needsComma) {
|
|
1503
|
-
handleError(4, [], []);
|
|
1504
|
-
}
|
|
1505
|
-
onSeparator(",");
|
|
1506
|
-
scanNext();
|
|
1507
|
-
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
1508
|
-
break;
|
|
1509
|
-
}
|
|
1510
|
-
} else if (needsComma) {
|
|
1511
|
-
handleError(6, [], []);
|
|
1512
|
-
}
|
|
1513
|
-
if (!parseProperty()) {
|
|
1514
|
-
handleError(4, [], [
|
|
1515
|
-
2,
|
|
1516
|
-
5
|
|
1517
|
-
/* SyntaxKind.CommaToken */
|
|
1518
|
-
]);
|
|
1519
|
-
}
|
|
1520
|
-
needsComma = true;
|
|
1521
|
-
}
|
|
1522
|
-
onObjectEnd();
|
|
1523
|
-
if (_scanner.getToken() !== 2) {
|
|
1524
|
-
handleError(7, [
|
|
1525
|
-
2
|
|
1526
|
-
/* SyntaxKind.CloseBraceToken */
|
|
1527
|
-
], []);
|
|
1528
|
-
} else {
|
|
1529
|
-
scanNext();
|
|
1530
|
-
}
|
|
1531
|
-
return true;
|
|
1532
|
-
}
|
|
1533
|
-
function parseArray() {
|
|
1534
|
-
onArrayBegin();
|
|
1535
|
-
scanNext();
|
|
1536
|
-
let isFirstElement = true;
|
|
1537
|
-
let needsComma = false;
|
|
1538
|
-
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
1539
|
-
if (_scanner.getToken() === 5) {
|
|
1540
|
-
if (!needsComma) {
|
|
1541
|
-
handleError(4, [], []);
|
|
1542
|
-
}
|
|
1543
|
-
onSeparator(",");
|
|
1544
|
-
scanNext();
|
|
1545
|
-
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
1546
|
-
break;
|
|
1547
|
-
}
|
|
1548
|
-
} else if (needsComma) {
|
|
1549
|
-
handleError(6, [], []);
|
|
1550
|
-
}
|
|
1551
|
-
if (isFirstElement) {
|
|
1552
|
-
_jsonPath.push(0);
|
|
1553
|
-
isFirstElement = false;
|
|
1554
|
-
} else {
|
|
1555
|
-
_jsonPath[_jsonPath.length - 1]++;
|
|
1556
|
-
}
|
|
1557
|
-
if (!parseValue()) {
|
|
1558
|
-
handleError(4, [], [
|
|
1559
|
-
4,
|
|
1560
|
-
5
|
|
1561
|
-
/* SyntaxKind.CommaToken */
|
|
1562
|
-
]);
|
|
1563
|
-
}
|
|
1564
|
-
needsComma = true;
|
|
1565
|
-
}
|
|
1566
|
-
onArrayEnd();
|
|
1567
|
-
if (!isFirstElement) {
|
|
1568
|
-
_jsonPath.pop();
|
|
1569
|
-
}
|
|
1570
|
-
if (_scanner.getToken() !== 4) {
|
|
1571
|
-
handleError(8, [
|
|
1572
|
-
4
|
|
1573
|
-
/* SyntaxKind.CloseBracketToken */
|
|
1574
|
-
], []);
|
|
1575
|
-
} else {
|
|
1576
|
-
scanNext();
|
|
1577
|
-
}
|
|
1578
|
-
return true;
|
|
1579
|
-
}
|
|
1580
|
-
function parseValue() {
|
|
1581
|
-
switch (_scanner.getToken()) {
|
|
1582
|
-
case 3:
|
|
1583
|
-
return parseArray();
|
|
1584
|
-
case 1:
|
|
1585
|
-
return parseObject();
|
|
1586
|
-
case 10:
|
|
1587
|
-
return parseString(true);
|
|
1588
|
-
default:
|
|
1589
|
-
return parseLiteral();
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
scanNext();
|
|
1593
|
-
if (_scanner.getToken() === 17) {
|
|
1594
|
-
if (options.allowEmptyContent) {
|
|
1595
|
-
return true;
|
|
1596
|
-
}
|
|
1597
|
-
handleError(4, [], []);
|
|
1598
|
-
return false;
|
|
1599
|
-
}
|
|
1600
|
-
if (!parseValue()) {
|
|
1601
|
-
handleError(4, [], []);
|
|
1602
|
-
return false;
|
|
1603
|
-
}
|
|
1604
|
-
if (_scanner.getToken() !== 17) {
|
|
1605
|
-
handleError(9, [], []);
|
|
1606
|
-
}
|
|
1607
|
-
return true;
|
|
1608
|
-
}
|
|
1609
|
-
function getNodeType(value) {
|
|
1610
|
-
switch (typeof value) {
|
|
1611
|
-
case "boolean":
|
|
1612
|
-
return "boolean";
|
|
1613
|
-
case "number":
|
|
1614
|
-
return "number";
|
|
1615
|
-
case "string":
|
|
1616
|
-
return "string";
|
|
1617
|
-
case "object": {
|
|
1618
|
-
if (!value) {
|
|
1619
|
-
return "null";
|
|
1620
|
-
} else if (Array.isArray(value)) {
|
|
1621
|
-
return "array";
|
|
1622
|
-
}
|
|
1623
|
-
return "object";
|
|
1624
|
-
}
|
|
1625
|
-
default:
|
|
1626
|
-
return "null";
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
1631
|
-
var ScanError;
|
|
1632
|
-
(function(ScanError2) {
|
|
1633
|
-
ScanError2[ScanError2["None"] = 0] = "None";
|
|
1634
|
-
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
1635
|
-
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
1636
|
-
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
1637
|
-
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
1638
|
-
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
1639
|
-
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
1640
|
-
})(ScanError || (ScanError = {}));
|
|
1641
|
-
var SyntaxKind;
|
|
1642
|
-
(function(SyntaxKind2) {
|
|
1643
|
-
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
1644
|
-
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
1645
|
-
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
1646
|
-
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
1647
|
-
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
1648
|
-
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
1649
|
-
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
1650
|
-
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
1651
|
-
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
1652
|
-
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
1653
|
-
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
1654
|
-
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
1655
|
-
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
1656
|
-
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
1657
|
-
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
1658
|
-
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
1659
|
-
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
1660
|
-
})(SyntaxKind || (SyntaxKind = {}));
|
|
1661
|
-
var parseTree2 = parseTree;
|
|
1662
|
-
var findNodeAtLocation2 = findNodeAtLocation;
|
|
1663
|
-
var ParseErrorCode;
|
|
1664
|
-
(function(ParseErrorCode2) {
|
|
1665
|
-
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
1666
|
-
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
1667
|
-
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
1668
|
-
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
1669
|
-
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
1670
|
-
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
1671
|
-
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
1672
|
-
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
1673
|
-
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
1674
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
1675
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
1676
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
1677
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
1678
|
-
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
1679
|
-
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
1680
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
1681
|
-
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
1682
|
-
|
|
1683
867
|
// src/generators/shared/json-edit.ts
|
|
868
|
+
import { findNodeAtLocation, parseTree } from "jsonc-parser";
|
|
1684
869
|
function detectIndent(raw) {
|
|
1685
870
|
for (const line of raw.split("\n")) {
|
|
1686
871
|
const match = /^(\t+| +)/.exec(line);
|
|
@@ -1738,14 +923,14 @@ function insertProperty(raw, object, key, value, style) {
|
|
|
1738
923
|
}
|
|
1739
924
|
function setJsonValue(raw, path, value) {
|
|
1740
925
|
const style = styleOf(raw);
|
|
1741
|
-
const root =
|
|
926
|
+
const root = parseTree(raw);
|
|
1742
927
|
if (root === void 0) throw new Error("setJsonValue: not a JSON document");
|
|
1743
|
-
const existing =
|
|
928
|
+
const existing = findNodeAtLocation(root, path);
|
|
1744
929
|
if (existing !== void 0) {
|
|
1745
930
|
return splice(raw, existing.offset, existing.offset + existing.length, renderValue(value, lineIndentAt(raw, existing.offset), style));
|
|
1746
931
|
}
|
|
1747
932
|
for (let depth = path.length - 1; depth >= 0; depth--) {
|
|
1748
|
-
const parent = depth === 0 ? root :
|
|
933
|
+
const parent = depth === 0 ? root : findNodeAtLocation(root, path.slice(0, depth));
|
|
1749
934
|
if (parent === void 0) continue;
|
|
1750
935
|
if (parent.type !== "object") throw new Error(`setJsonValue: ${path.slice(0, depth).join(".") || "the root"} is not an object`);
|
|
1751
936
|
return insertProperty(raw, parent, path[depth], nest(path.slice(depth + 1), value), style);
|
|
@@ -1776,6 +961,7 @@ function treePackageManager(tree, config) {
|
|
|
1776
961
|
|
|
1777
962
|
// src/generators/add-review/render.ts
|
|
1778
963
|
var DEPENDABOT_PATH = ".github/dependabot.yml";
|
|
964
|
+
var PROVIDER_STATUS_URL = "https://github.com/clearlydev/nx-archweave/blob/main/docs/pr-review.md#provider-status";
|
|
1779
965
|
function renderLineDiff(existing, generated) {
|
|
1780
966
|
const a = existing.split("\n");
|
|
1781
967
|
const b = generated.split("\n");
|
|
@@ -1873,6 +1059,10 @@ function renderAddReviewReport(report) {
|
|
|
1873
1059
|
}
|
|
1874
1060
|
lines.push("");
|
|
1875
1061
|
lines.push(`Note: the review workflow stays green-skipped until you register the ${report.requiredSecretName} secret.`);
|
|
1062
|
+
if (report.betaProvider !== void 0) {
|
|
1063
|
+
lines.push(`Note: the ${report.betaProvider} provider is in beta \u2014 its workflow hasn't finished a review end to end on`);
|
|
1064
|
+
lines.push(`GitHub Actions yet. Status, costs and known issues: ${PROVIDER_STATUS_URL}`);
|
|
1065
|
+
}
|
|
1876
1066
|
lines.push("Note: this workflow runs with elevated permissions only after it is merged to the default branch \u2014");
|
|
1877
1067
|
lines.push("merging is the first real validation.");
|
|
1878
1068
|
return lines.join("\n");
|
|
@@ -1913,6 +1103,7 @@ function deepEqual(a, b) {
|
|
|
1913
1103
|
return aKeys.every((key) => deepEqual(a[key], b[key]));
|
|
1914
1104
|
}
|
|
1915
1105
|
var PROVIDERS = ["claude", "gemini", "gpt", "cursor"];
|
|
1106
|
+
var BETA_PROVIDERS = ["gemini", "gpt", "cursor"];
|
|
1916
1107
|
var MODES = ["fast", "standard", "thorough"];
|
|
1917
1108
|
function recordedReview(config) {
|
|
1918
1109
|
const review = config?.["review"];
|
|
@@ -1932,9 +1123,10 @@ function runAddReview(tree, options) {
|
|
|
1932
1123
|
const packageManager = options.packageManager ?? detectedPm ?? "pnpm";
|
|
1933
1124
|
const packageManagerNote = options.packageManager === void 0 && detectedPm === null ? "the package manager could not be detected (no pnpm, yarn, bun or npm lockfile) \u2014 the workflow was rendered for pnpm; re-run with --packageManager=npm|yarn|bun if that is wrong." : void 0;
|
|
1934
1125
|
const recorded = recordedReview(config.parsed);
|
|
1126
|
+
const provider = options.provider ?? recorded.provider ?? "claude";
|
|
1935
1127
|
const plan = composeReviewSetup({
|
|
1936
1128
|
enabled: true,
|
|
1937
|
-
provider
|
|
1129
|
+
provider,
|
|
1938
1130
|
mode: options.mode ?? recorded.mode ?? "standard",
|
|
1939
1131
|
locale: resolveLocale(options.locale, config),
|
|
1940
1132
|
maxRounds: options.maxRounds ?? recorded.maxRounds ?? 3,
|
|
@@ -2029,7 +1221,8 @@ function runAddReview(tree, options) {
|
|
|
2029
1221
|
configError: null,
|
|
2030
1222
|
dependabot,
|
|
2031
1223
|
dependabotProposal: dependabot === "proposed" ? dependabotFile.content : null,
|
|
2032
|
-
...packageManagerNote !== void 0 ? { packageManagerNote } : {}
|
|
1224
|
+
...packageManagerNote !== void 0 ? { packageManagerNote } : {},
|
|
1225
|
+
...BETA_PROVIDERS.includes(provider) ? { betaProvider: provider } : {}
|
|
2033
1226
|
};
|
|
2034
1227
|
}
|
|
2035
1228
|
async function addReviewGenerator(tree, options) {
|