@clearlydev/nx-archweave 0.2.2 → 0.3.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/README.md +9 -6
- package/dist/bin/review-verdict.js +37 -11
- 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 +130 -944
- package/dist/generators/doctor/generator.js +247 -36
- package/dist/generators/init/generator.js +188 -951
- package/package.json +4 -6
- package/src/generators/init/schema.json +6 -0
|
@@ -228,6 +228,30 @@ function buildOverEngineeringPrompt(locale) {
|
|
|
228
228
|
return [...body, "", renderFindingSchemaInstruction(locale, OVER_ENGINEERING_PRIORITIES), "", renderDedupInstruction(locale)].join("\n");
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
// ../review-policy/dist/verdict-gate/verdict-comment.js
|
|
232
|
+
var VERDICT_MARKER = "<!-- archweave-verdict -->";
|
|
233
|
+
function renderCommitLine(locale, shortSha) {
|
|
234
|
+
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>`;
|
|
235
|
+
}
|
|
236
|
+
var NOT_RUN_REASON = {
|
|
237
|
+
en: {
|
|
238
|
+
secret: (secretName) => `the ${secretName} secret is not registered`,
|
|
239
|
+
fork: () => "this pull request comes from a fork, and GitHub passes no secrets to runs from forks",
|
|
240
|
+
dependabot: (secretName) => `Dependabot runs receive only Dependabot secrets, and ${secretName} is not one of them`,
|
|
241
|
+
rounds: (_secretName, maxRounds) => `the automated review round limit (${maxRounds}) is reached`
|
|
242
|
+
},
|
|
243
|
+
ko: {
|
|
244
|
+
secret: (secretName) => `${secretName} \uC2DC\uD06C\uB9BF\uC774 \uB4F1\uB85D\uB418\uC9C0 \uC54A\uC74C`,
|
|
245
|
+
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",
|
|
246
|
+
dependabot: (secretName) => `Dependabot \uC2E4\uD589\uC740 Dependabot \uC2DC\uD06C\uB9BF\uB9CC \uBC1B\uB294\uB370, ${secretName}\uB294 \uADF8\uC911\uC5D0 \uC5C6\uC74C`,
|
|
247
|
+
rounds: (_secretName, maxRounds) => `\uC790\uB3D9 \uB9AC\uBDF0 \uB77C\uC6B4\uB4DC \uD55C\uB3C4(${maxRounds})\uC5D0 \uB3C4\uB2EC\uD568`
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
function renderNotRunNotice(locale, reason, secretName, maxRounds) {
|
|
251
|
+
const why = NOT_RUN_REASON[locale][reason](secretName, maxRounds);
|
|
252
|
+
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.`;
|
|
253
|
+
}
|
|
254
|
+
|
|
231
255
|
// ../review-policy/dist/verdict-gate/verdict-gate.js
|
|
232
256
|
var ROUND_MARKER = "<!-- archweave-review-round -->";
|
|
233
257
|
|
|
@@ -321,8 +345,35 @@ function renderRoundGateStep(maxRounds) {
|
|
|
321
345
|
" fi"
|
|
322
346
|
].join("\n");
|
|
323
347
|
}
|
|
348
|
+
function shellQuote(text) {
|
|
349
|
+
return `'${text.replace(/'/g, `'\\''`)}'`;
|
|
350
|
+
}
|
|
351
|
+
function renderNotRunFunction(secretName, maxRounds, locale) {
|
|
352
|
+
const reasons = ["secret", "fork", "dependabot", "rounds"];
|
|
353
|
+
const [commitBefore, commitAfter] = renderCommitLine(locale, "\0").split("\0");
|
|
354
|
+
return [
|
|
355
|
+
"not_run() {",
|
|
356
|
+
' case "$1" in',
|
|
357
|
+
...reasons.map((reason) => ` ${reason}) annotation=${shellQuote(renderNotRunNotice("en", reason, secretName, maxRounds))}; notice=${shellQuote(renderNotRunNotice(locale, reason, secretName, maxRounds))} ;;`),
|
|
358
|
+
" esac",
|
|
359
|
+
' echo "::notice title=AI review did not run::$annotation"',
|
|
360
|
+
` printf '%s\\n' "$notice" >> "$GITHUB_STEP_SUMMARY"`,
|
|
361
|
+
` short_sha=$(printf '%s' "$HEAD_SHA" | cut -c1-7)`,
|
|
362
|
+
' case "$short_sha" in',
|
|
363
|
+
" '' | *[!0-9a-f]*) short_sha= ;;",
|
|
364
|
+
" esac",
|
|
365
|
+
" {",
|
|
366
|
+
' echo "notice-body<<ARCHWEAVE_NOT_RUN_EOF"',
|
|
367
|
+
` printf '%s\\n' ${shellQuote(VERDICT_MARKER)} "\u2139\uFE0F $notice"`,
|
|
368
|
+
` if [ -n "$short_sha" ]; then printf '\\n%s\\n' ${shellQuote(commitBefore)}"$short_sha"${shellQuote(commitAfter)}; fi`,
|
|
369
|
+
' echo "ARCHWEAVE_NOT_RUN_EOF"',
|
|
370
|
+
' echo "run=false"',
|
|
371
|
+
' } >> "$GITHUB_OUTPUT"',
|
|
372
|
+
"}"
|
|
373
|
+
];
|
|
374
|
+
}
|
|
324
375
|
var JUDGE_CONDITION = "steps.ai-review-result.outputs.run == 'true'";
|
|
325
|
-
function renderAiReviewResultStep() {
|
|
376
|
+
function renderAiReviewResultStep(secretName, maxRounds, locale) {
|
|
326
377
|
return [
|
|
327
378
|
"- name: Check the AI review result",
|
|
328
379
|
" id: ai-review-result",
|
|
@@ -331,15 +382,26 @@ function renderAiReviewResultStep() {
|
|
|
331
382
|
" REVIEW_ENABLED: ${{ needs.ai-review.outputs.enabled }}",
|
|
332
383
|
" REVIEW_ALLOWED: ${{ needs.ai-review.outputs.allowed }}",
|
|
333
384
|
" LAST_COMMENT_ID: ${{ needs.ai-review.outputs.last-comment-id }}",
|
|
385
|
+
" HEAD_SHA: ${{ github.event.pull_request.head.sha }}",
|
|
386
|
+
" HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}",
|
|
387
|
+
" REPOSITORY: ${{ github.repository }}",
|
|
388
|
+
" PR_AUTHOR: ${{ github.event.pull_request.user.login }}",
|
|
334
389
|
" run: |",
|
|
390
|
+
...renderNotRunFunction(secretName, maxRounds, locale).map((line) => ` ${line}`),
|
|
335
391
|
' if [ "$AI_REVIEW_RESULT" != success ]; then',
|
|
336
392
|
` echo "::error title=AI review did not succeed::The AI review job ended with '$AI_REVIEW_RESULT'."`,
|
|
337
393
|
" exit 1",
|
|
338
394
|
" fi",
|
|
339
395
|
' case "$REVIEW_ENABLED/$REVIEW_ALLOWED" in',
|
|
340
|
-
" false/*
|
|
341
|
-
'
|
|
342
|
-
|
|
396
|
+
" false/*)",
|
|
397
|
+
' if [ "$HEAD_REPOSITORY" != "$REPOSITORY" ]; then not_run fork',
|
|
398
|
+
` elif [ "$PR_AUTHOR" = 'dependabot[bot]' ]; then not_run dependabot`,
|
|
399
|
+
" else not_run secret",
|
|
400
|
+
" fi",
|
|
401
|
+
" exit 0",
|
|
402
|
+
" ;;",
|
|
403
|
+
" true/false)",
|
|
404
|
+
" not_run rounds",
|
|
343
405
|
" exit 0",
|
|
344
406
|
" ;;",
|
|
345
407
|
" true/true)",
|
|
@@ -383,7 +445,7 @@ function renderBlockStep() {
|
|
|
383
445
|
"- name: Fail on a blocking verdict",
|
|
384
446
|
" if: steps.verdict.outputs.blocked == 'true'",
|
|
385
447
|
" run: |",
|
|
386
|
-
' echo "The review verdict is BLOCK
|
|
448
|
+
' echo "The review check failed: the verdict is BLOCK, or the AI review left no readable summary. See the verdict comment on this pull request."',
|
|
387
449
|
" exit 1"
|
|
388
450
|
].join("\n");
|
|
389
451
|
}
|
|
@@ -398,6 +460,9 @@ function renderVerdictCommentStep() {
|
|
|
398
460
|
" PREVIOUS_ID: ${{ needs.review.outputs.previous-comment-id }}",
|
|
399
461
|
" run: |",
|
|
400
462
|
` payload=$(jq -n --arg body "$VERDICT_BODY" '{body: $body}')`,
|
|
463
|
+
' if [ -z "$PREVIOUS_ID" ]; then',
|
|
464
|
+
` 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=`,
|
|
465
|
+
" fi",
|
|
401
466
|
' case "$PREVIOUS_ID" in',
|
|
402
467
|
" ''|*[!0-9]*) PREVIOUS_ID= ;;",
|
|
403
468
|
" esac",
|
|
@@ -468,10 +533,11 @@ function renderWorkspaceSetupSteps(packageManager) {
|
|
|
468
533
|
].join("\n"));
|
|
469
534
|
return steps.join("\n\n");
|
|
470
535
|
}
|
|
536
|
+
var REVIEW_JOB_TIMEOUT_MINUTES = 15;
|
|
471
537
|
function renderReviewWorkflow(input, parts) {
|
|
472
538
|
const aiReviewSteps = [renderSecretGateStep(parts.secretName), renderRoundGateStep(input.maxRounds), ...parts.reviewSteps];
|
|
473
539
|
const reviewSteps = [
|
|
474
|
-
renderAiReviewResultStep(),
|
|
540
|
+
renderAiReviewResultStep(parts.secretName, input.maxRounds, input.locale),
|
|
475
541
|
renderCheckoutStep(JUDGE_CONDITION),
|
|
476
542
|
renderWorkspaceSetupSteps(input.packageManager),
|
|
477
543
|
renderVerdictGateStep(input.maxRounds, input.locale),
|
|
@@ -489,6 +555,7 @@ function renderReviewWorkflow(input, parts) {
|
|
|
489
555
|
"jobs:",
|
|
490
556
|
" ai-review:",
|
|
491
557
|
" runs-on: ubuntu-latest",
|
|
558
|
+
` timeout-minutes: ${REVIEW_JOB_TIMEOUT_MINUTES}`,
|
|
492
559
|
indentBlock(renderReviewPermissions(parts.idToken), 4),
|
|
493
560
|
" outputs:",
|
|
494
561
|
" enabled: ${{ steps.secret-gate.outputs.enabled }}",
|
|
@@ -501,11 +568,12 @@ function renderReviewWorkflow(input, parts) {
|
|
|
501
568
|
" needs: ai-review",
|
|
502
569
|
" if: always()",
|
|
503
570
|
" runs-on: ubuntu-latest",
|
|
571
|
+
` timeout-minutes: ${REVIEW_JOB_TIMEOUT_MINUTES}`,
|
|
504
572
|
" permissions:",
|
|
505
573
|
" contents: read",
|
|
506
574
|
" pull-requests: read",
|
|
507
575
|
" outputs:",
|
|
508
|
-
" comment-body: ${{ steps.verdict.outputs.comment-body }}",
|
|
576
|
+
" comment-body: ${{ steps.verdict.outputs.comment-body || steps.ai-review-result.outputs.notice-body }}",
|
|
509
577
|
" previous-comment-id: ${{ steps.verdict.outputs.previous-comment-id }}",
|
|
510
578
|
" steps:",
|
|
511
579
|
indentBlock(reviewSteps.join("\n\n"), 6),
|
|
@@ -515,6 +583,7 @@ function renderReviewWorkflow(input, parts) {
|
|
|
515
583
|
// Runs after a BLOCK failed the review job, too: the comment explains the red check.
|
|
516
584
|
" if: ${{ !cancelled() && needs.review.outputs.comment-body != '' }}",
|
|
517
585
|
" runs-on: ubuntu-latest",
|
|
586
|
+
` timeout-minutes: ${REVIEW_JOB_TIMEOUT_MINUTES}`,
|
|
518
587
|
" permissions:",
|
|
519
588
|
" pull-requests: write",
|
|
520
589
|
" steps:",
|
|
@@ -526,17 +595,27 @@ function renderReviewWorkflow(input, parts) {
|
|
|
526
595
|
// ../template-engine/dist/review/claude/claude-provider.js
|
|
527
596
|
var SECRET_NAME = "CLAUDE_CODE_OAUTH_TOKEN";
|
|
528
597
|
var ALLOWED_TOOLS = "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)";
|
|
598
|
+
var CLAUDE_STEP_ID = "claude-review";
|
|
599
|
+
var PR_CONTEXT = ["REPO: ${{ github.repository }}", "PR NUMBER: ${{ github.event.pull_request.number }}"];
|
|
529
600
|
function renderWorkflowInstructions(locale) {
|
|
530
601
|
const lines = locale === "en" ? [
|
|
531
|
-
|
|
532
|
-
"
|
|
602
|
+
...PR_CONTEXT,
|
|
603
|
+
"",
|
|
604
|
+
"Review the diff of this pull request using `gh pr diff <PR NUMBER>` and `gh pr view <PR NUMBER>`.",
|
|
605
|
+
"Post specific findings as inline comments with `mcp__github_inline_comment__create_inline_comment` (pass `confirmed: true`), and exactly one top-level summary comment.",
|
|
606
|
+
"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 `$(...)`.",
|
|
607
|
+
"Run each `gh` command on its own: no pipes to other programs, no `&&` chains.",
|
|
533
608
|
`Always include the literal marker ${ROUND_MARKER} in the top-level summary comment.`,
|
|
534
609
|
"If there are no findings that require action, post exactly one top-level comment saying so (and still include the marker).",
|
|
535
610
|
"Do not modify any code, and never approve or merge the pull request.",
|
|
536
611
|
"Write summaries and explanations in English; keep file names, function names, and identifiers verbatim."
|
|
537
612
|
] : [
|
|
538
|
-
|
|
539
|
-
"
|
|
613
|
+
...PR_CONTEXT,
|
|
614
|
+
"",
|
|
615
|
+
"\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.",
|
|
616
|
+
"\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.",
|
|
617
|
+
"\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.",
|
|
618
|
+
"`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.",
|
|
540
619
|
`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.`,
|
|
541
620
|
'\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).',
|
|
542
621
|
"\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).",
|
|
@@ -553,6 +632,20 @@ function composePrompt(input) {
|
|
|
553
632
|
sections.push(renderFindingsBlockInstruction(input.locale));
|
|
554
633
|
return sections.join("\n\n---\n\n");
|
|
555
634
|
}
|
|
635
|
+
function renderDeniedToolsStep() {
|
|
636
|
+
return [
|
|
637
|
+
"- name: Show denied tool calls",
|
|
638
|
+
` if: always() && steps.${CLAUDE_STEP_ID}.outputs.execution_file != ''`,
|
|
639
|
+
" env:",
|
|
640
|
+
` EXECUTION_FILE: \${{ steps.${CLAUDE_STEP_ID}.outputs.execution_file }}`,
|
|
641
|
+
" run: |",
|
|
642
|
+
' [ -f "$EXECUTION_FILE" ] || exit 0',
|
|
643
|
+
` stop_token="archweave-$(od -An -N16 -tx1 /dev/urandom | tr -d ' \\n')"`,
|
|
644
|
+
' echo "::stop-commands::$stop_token"',
|
|
645
|
+
` jq -c '.[] | select(.type == "result") | .permission_denials[]? | {tool: .tool_name, command: ((.tool_input.command // "") | tostring | .[0:200])}' "$EXECUTION_FILE" || echo "Could not read the execution file."`,
|
|
646
|
+
' echo "::$stop_token::"'
|
|
647
|
+
].join("\n");
|
|
648
|
+
}
|
|
556
649
|
function buildWorkflowYaml(input) {
|
|
557
650
|
return renderReviewWorkflow(input, {
|
|
558
651
|
name: "Claude Code Review",
|
|
@@ -563,6 +656,7 @@ function buildWorkflowYaml(input) {
|
|
|
563
656
|
renderCheckoutStep(REVIEW_GATE_CONDITION),
|
|
564
657
|
[
|
|
565
658
|
"- name: Run Claude review",
|
|
659
|
+
` id: ${CLAUDE_STEP_ID}`,
|
|
566
660
|
` if: ${REVIEW_GATE_CONDITION}`,
|
|
567
661
|
` uses: ${pinnedUses("anthropics/claude-code-action")}`,
|
|
568
662
|
" with:",
|
|
@@ -571,7 +665,8 @@ function buildWorkflowYaml(input) {
|
|
|
571
665
|
indentBlock(composePrompt(input), 6),
|
|
572
666
|
" claude_args: |",
|
|
573
667
|
` --allowedTools "${ALLOWED_TOOLS}"`
|
|
574
|
-
].join("\n")
|
|
668
|
+
].join("\n"),
|
|
669
|
+
renderDeniedToolsStep()
|
|
575
670
|
]
|
|
576
671
|
});
|
|
577
672
|
}
|
|
@@ -639,7 +734,9 @@ function buildWorkflowYaml2(input) {
|
|
|
639
734
|
` CURSOR_API_KEY: \${{ secrets.${SECRET_NAME2} }}`,
|
|
640
735
|
" GH_TOKEN: ${{ github.token }}",
|
|
641
736
|
" run: |",
|
|
642
|
-
|
|
737
|
+
// cursor-agent stops at "Workspace Trust Required" without --trust (2026.10.22 on
|
|
738
|
+
// Actions); the folder is this run's own checkout, and forks never get the secret.
|
|
739
|
+
` agent --trust -p "$(cat <<'${PROMPT_HEREDOC_DELIMITER}'`,
|
|
643
740
|
indentBlock(composePrompt2(input), 4),
|
|
644
741
|
` ${PROMPT_HEREDOC_DELIMITER}`,
|
|
645
742
|
' )"'
|
|
@@ -683,6 +780,7 @@ function composePrompt3(input) {
|
|
|
683
780
|
sections.push(renderFindingsBlockInstruction(input.locale));
|
|
684
781
|
return sections.join("\n\n---\n\n");
|
|
685
782
|
}
|
|
783
|
+
var GEMINI_CLI_VERSION = "0.65.0";
|
|
686
784
|
function buildWorkflowYaml3(input) {
|
|
687
785
|
return renderReviewWorkflow(input, {
|
|
688
786
|
name: "Gemini Code Review",
|
|
@@ -697,8 +795,13 @@ function buildWorkflowYaml3(input) {
|
|
|
697
795
|
` uses: ${pinnedUses("google-github-actions/run-gemini-cli")}`,
|
|
698
796
|
" env:",
|
|
699
797
|
" GITHUB_TOKEN: ${{ github.token }}",
|
|
798
|
+
// Gemini CLI 0.65 refuses to run in a folder it hasn't been told to trust (measured
|
|
799
|
+
// 2026-10-25 on Actions). The folder is this run's own checkout; pull requests from forks
|
|
800
|
+
// never get here, because they get no secret.
|
|
801
|
+
" GEMINI_CLI_TRUST_WORKSPACE: 'true'",
|
|
700
802
|
" with:",
|
|
701
803
|
` gemini_api_key: \${{ secrets.${SECRET_NAME3} }}`,
|
|
804
|
+
` gemini_cli_version: '${GEMINI_CLI_VERSION}'`,
|
|
702
805
|
" prompt: |",
|
|
703
806
|
indentBlock(composePrompt3(input), 6)
|
|
704
807
|
].join("\n")
|
|
@@ -1267,6 +1370,39 @@ function buildFsdPolicyNotes(locale, notes) {
|
|
|
1267
1370
|
return lines.length === 0 ? "" : [text.heading, ...lines].join("\n");
|
|
1268
1371
|
}
|
|
1269
1372
|
|
|
1373
|
+
// ../templates/dist/agents/module-boundaries.js
|
|
1374
|
+
function buildModuleBoundariesSection(locale, tags) {
|
|
1375
|
+
const { frontend, backend, shared } = tags;
|
|
1376
|
+
if (locale === "ko") {
|
|
1377
|
+
return {
|
|
1378
|
+
id: "module-boundaries",
|
|
1379
|
+
heading: "\uBAA8\uB4C8 \uACBD\uACC4",
|
|
1380
|
+
body: [
|
|
1381
|
+
"\uB8E8\uD2B8 ESLint \uC124\uC815\uC758 `@nx/enforce-module-boundaries` \uADDC\uCE59\uC774 \uD504\uB85C\uC81D\uD2B8 \uD0DC\uADF8\uB85C \uD504\uB860\uD2B8\uC5D4\uB4DC\uC640 \uBC31\uC5D4\uB4DC\uB97C \uB098\uB208\uB2E4:",
|
|
1382
|
+
`- \`${frontend}\` \uD504\uB85C\uC81D\uD2B8\uB294 \`${backend}\` \uD504\uB85C\uC81D\uD2B8\uB97C import\uD558\uC9C0 \uC54A\uACE0, \uADF8 \uBC18\uB300\uB3C4 \uB9C8\uCC2C\uAC00\uC9C0\uB2E4.`,
|
|
1383
|
+
`- \`${shared}\` \uD504\uB85C\uC81D\uD2B8(shared-types \uB77C\uC774\uBE0C\uB7EC\uB9AC \uB4F1)\uB294 \uC5B4\uB290 \uCABD\uB3C4 import\uD558\uC9C0 \uC54A\uB294\uB2E4.`,
|
|
1384
|
+
"- \uC774 \uD0DC\uADF8\uAC00 \uD558\uB098\uB3C4 \uC5C6\uB294 \uD504\uB85C\uC81D\uD2B8\uB294 \uADDC\uCE59 \uBC16\uC5D0 \uC788\uB2E4. \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB9CC\uB4E4 \uB54C\uB294 \uBC14\uB85C \uC790\uAE30 \uCABD \uD0DC\uADF8\uB97C \uBD99\uC778\uB2E4:",
|
|
1385
|
+
` \`nx g @nx/js:lib libs/<name> --tags=${shared}\` (\uD504\uB860\uD2B8\uC5D4\uB4DC \uC804\uC6A9\uC774\uBA74 \`${frontend}\`, \uBC31\uC5D4\uB4DC \uC804\uC6A9\uC774\uBA74 \`${backend}\`).`,
|
|
1386
|
+
`import\uB97C \uD1B5\uACFC\uC2DC\uD0A4\uB824\uACE0 \uD0DC\uADF8\uB97C \uC9C0\uC6B0\uAC70\uB098 \`depConstraints\`\uB97C \uB290\uC2A8\uD558\uAC8C \uD558\uC9C0 \uC54A\uB294\uB2E4. \uD568\uAED8 \uC4F0\uB294 \uCF54\uB4DC\uB294 \`${shared}\``,
|
|
1387
|
+
"\uB77C\uC774\uBE0C\uB7EC\uB9AC\uB85C \uC62E\uAE34\uB2E4."
|
|
1388
|
+
].join("\n")
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
return {
|
|
1392
|
+
id: "module-boundaries",
|
|
1393
|
+
heading: "Module Boundaries",
|
|
1394
|
+
body: [
|
|
1395
|
+
"The root ESLint config's `@nx/enforce-module-boundaries` rule keeps the frontend and the backend apart by project tag:",
|
|
1396
|
+
`- \`${frontend}\` projects never import \`${backend}\` projects, and the other way round.`,
|
|
1397
|
+
`- \`${shared}\` projects (such as the shared-types library) import neither side.`,
|
|
1398
|
+
"- A project with none of these tags is outside the rule. When you create a library, give it its side right away:",
|
|
1399
|
+
` \`nx g @nx/js:lib libs/<name> --tags=${shared}\` (\`${frontend}\` or \`${backend}\` for code only one side uses).`,
|
|
1400
|
+
`Never remove a tag or loosen the \`depConstraints\` to make an import pass; move the shared code into a \`${shared}\``,
|
|
1401
|
+
"library instead."
|
|
1402
|
+
].join("\n")
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1270
1406
|
// ../templates/dist/fsd/fsd-eslint.js
|
|
1271
1407
|
var FSD_ESLINT_MODULE = "@clearlydev/nx-archweave/eslint";
|
|
1272
1408
|
function buildFsdEslintImportLine() {
|
|
@@ -1890,6 +2026,11 @@ function composeAgentRules(input) {
|
|
|
1890
2026
|
|
|
1891
2027
|
${notes}` } : section;
|
|
1892
2028
|
});
|
|
2029
|
+
if (input.moduleBoundaries !== void 0 && input.sections === void 0) {
|
|
2030
|
+
const anchor = sections.findIndex((section) => section.id === FSD_AGENT_SECTION_ID);
|
|
2031
|
+
const at = (anchor === -1 ? sections.findIndex((section) => section.id === "code-structure") : anchor) + 1;
|
|
2032
|
+
sections.splice(at, 0, buildModuleBoundariesSection(input.locale, input.moduleBoundaries));
|
|
2033
|
+
}
|
|
1893
2034
|
const content = renderSections(sections);
|
|
1894
2035
|
return input.files.map((filePath) => ({ filePath, content }));
|
|
1895
2036
|
}
|
|
@@ -1975,933 +2116,8 @@ function resolveDryRun(options) {
|
|
|
1975
2116
|
// src/generators/shared/frontend-app.ts
|
|
1976
2117
|
import { getProjects } from "@nx/devkit";
|
|
1977
2118
|
|
|
1978
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
1979
|
-
function createScanner(text, ignoreTrivia = false) {
|
|
1980
|
-
const len = text.length;
|
|
1981
|
-
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
1982
|
-
function scanHexDigits(count, exact) {
|
|
1983
|
-
let digits = 0;
|
|
1984
|
-
let value2 = 0;
|
|
1985
|
-
while (digits < count || !exact) {
|
|
1986
|
-
let ch = text.charCodeAt(pos);
|
|
1987
|
-
if (ch >= 48 && ch <= 57) {
|
|
1988
|
-
value2 = value2 * 16 + ch - 48;
|
|
1989
|
-
} else if (ch >= 65 && ch <= 70) {
|
|
1990
|
-
value2 = value2 * 16 + ch - 65 + 10;
|
|
1991
|
-
} else if (ch >= 97 && ch <= 102) {
|
|
1992
|
-
value2 = value2 * 16 + ch - 97 + 10;
|
|
1993
|
-
} else {
|
|
1994
|
-
break;
|
|
1995
|
-
}
|
|
1996
|
-
pos++;
|
|
1997
|
-
digits++;
|
|
1998
|
-
}
|
|
1999
|
-
if (digits < count) {
|
|
2000
|
-
value2 = -1;
|
|
2001
|
-
}
|
|
2002
|
-
return value2;
|
|
2003
|
-
}
|
|
2004
|
-
function setPosition(newPosition) {
|
|
2005
|
-
pos = newPosition;
|
|
2006
|
-
value = "";
|
|
2007
|
-
tokenOffset = 0;
|
|
2008
|
-
token = 16;
|
|
2009
|
-
scanError = 0;
|
|
2010
|
-
}
|
|
2011
|
-
function scanNumber() {
|
|
2012
|
-
let start = pos;
|
|
2013
|
-
if (text.charCodeAt(pos) === 48) {
|
|
2014
|
-
pos++;
|
|
2015
|
-
} else {
|
|
2016
|
-
pos++;
|
|
2017
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2018
|
-
pos++;
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
2022
|
-
pos++;
|
|
2023
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2024
|
-
pos++;
|
|
2025
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2026
|
-
pos++;
|
|
2027
|
-
}
|
|
2028
|
-
} else {
|
|
2029
|
-
scanError = 3;
|
|
2030
|
-
return text.substring(start, pos);
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
let end = pos;
|
|
2034
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
2035
|
-
pos++;
|
|
2036
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
2037
|
-
pos++;
|
|
2038
|
-
}
|
|
2039
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2040
|
-
pos++;
|
|
2041
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2042
|
-
pos++;
|
|
2043
|
-
}
|
|
2044
|
-
end = pos;
|
|
2045
|
-
} else {
|
|
2046
|
-
scanError = 3;
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
return text.substring(start, end);
|
|
2050
|
-
}
|
|
2051
|
-
function scanString() {
|
|
2052
|
-
let result = "", start = pos;
|
|
2053
|
-
while (true) {
|
|
2054
|
-
if (pos >= len) {
|
|
2055
|
-
result += text.substring(start, pos);
|
|
2056
|
-
scanError = 2;
|
|
2057
|
-
break;
|
|
2058
|
-
}
|
|
2059
|
-
const ch = text.charCodeAt(pos);
|
|
2060
|
-
if (ch === 34) {
|
|
2061
|
-
result += text.substring(start, pos);
|
|
2062
|
-
pos++;
|
|
2063
|
-
break;
|
|
2064
|
-
}
|
|
2065
|
-
if (ch === 92) {
|
|
2066
|
-
result += text.substring(start, pos);
|
|
2067
|
-
pos++;
|
|
2068
|
-
if (pos >= len) {
|
|
2069
|
-
scanError = 2;
|
|
2070
|
-
break;
|
|
2071
|
-
}
|
|
2072
|
-
const ch2 = text.charCodeAt(pos++);
|
|
2073
|
-
switch (ch2) {
|
|
2074
|
-
case 34:
|
|
2075
|
-
result += '"';
|
|
2076
|
-
break;
|
|
2077
|
-
case 92:
|
|
2078
|
-
result += "\\";
|
|
2079
|
-
break;
|
|
2080
|
-
case 47:
|
|
2081
|
-
result += "/";
|
|
2082
|
-
break;
|
|
2083
|
-
case 98:
|
|
2084
|
-
result += "\b";
|
|
2085
|
-
break;
|
|
2086
|
-
case 102:
|
|
2087
|
-
result += "\f";
|
|
2088
|
-
break;
|
|
2089
|
-
case 110:
|
|
2090
|
-
result += "\n";
|
|
2091
|
-
break;
|
|
2092
|
-
case 114:
|
|
2093
|
-
result += "\r";
|
|
2094
|
-
break;
|
|
2095
|
-
case 116:
|
|
2096
|
-
result += " ";
|
|
2097
|
-
break;
|
|
2098
|
-
case 117:
|
|
2099
|
-
const ch3 = scanHexDigits(4, true);
|
|
2100
|
-
if (ch3 >= 0) {
|
|
2101
|
-
result += String.fromCharCode(ch3);
|
|
2102
|
-
} else {
|
|
2103
|
-
scanError = 4;
|
|
2104
|
-
}
|
|
2105
|
-
break;
|
|
2106
|
-
default:
|
|
2107
|
-
scanError = 5;
|
|
2108
|
-
}
|
|
2109
|
-
start = pos;
|
|
2110
|
-
continue;
|
|
2111
|
-
}
|
|
2112
|
-
if (ch >= 0 && ch <= 31) {
|
|
2113
|
-
if (isLineBreak(ch)) {
|
|
2114
|
-
result += text.substring(start, pos);
|
|
2115
|
-
scanError = 2;
|
|
2116
|
-
break;
|
|
2117
|
-
} else {
|
|
2118
|
-
scanError = 6;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
pos++;
|
|
2122
|
-
}
|
|
2123
|
-
return result;
|
|
2124
|
-
}
|
|
2125
|
-
function scanNext() {
|
|
2126
|
-
value = "";
|
|
2127
|
-
scanError = 0;
|
|
2128
|
-
tokenOffset = pos;
|
|
2129
|
-
lineStartOffset = lineNumber;
|
|
2130
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
2131
|
-
if (pos >= len) {
|
|
2132
|
-
tokenOffset = len;
|
|
2133
|
-
return token = 17;
|
|
2134
|
-
}
|
|
2135
|
-
let code = text.charCodeAt(pos);
|
|
2136
|
-
if (isWhiteSpace(code)) {
|
|
2137
|
-
do {
|
|
2138
|
-
pos++;
|
|
2139
|
-
value += String.fromCharCode(code);
|
|
2140
|
-
code = text.charCodeAt(pos);
|
|
2141
|
-
} while (isWhiteSpace(code));
|
|
2142
|
-
return token = 15;
|
|
2143
|
-
}
|
|
2144
|
-
if (isLineBreak(code)) {
|
|
2145
|
-
pos++;
|
|
2146
|
-
value += String.fromCharCode(code);
|
|
2147
|
-
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
2148
|
-
pos++;
|
|
2149
|
-
value += "\n";
|
|
2150
|
-
}
|
|
2151
|
-
lineNumber++;
|
|
2152
|
-
tokenLineStartOffset = pos;
|
|
2153
|
-
return token = 14;
|
|
2154
|
-
}
|
|
2155
|
-
switch (code) {
|
|
2156
|
-
// tokens: []{}:,
|
|
2157
|
-
case 123:
|
|
2158
|
-
pos++;
|
|
2159
|
-
return token = 1;
|
|
2160
|
-
case 125:
|
|
2161
|
-
pos++;
|
|
2162
|
-
return token = 2;
|
|
2163
|
-
case 91:
|
|
2164
|
-
pos++;
|
|
2165
|
-
return token = 3;
|
|
2166
|
-
case 93:
|
|
2167
|
-
pos++;
|
|
2168
|
-
return token = 4;
|
|
2169
|
-
case 58:
|
|
2170
|
-
pos++;
|
|
2171
|
-
return token = 6;
|
|
2172
|
-
case 44:
|
|
2173
|
-
pos++;
|
|
2174
|
-
return token = 5;
|
|
2175
|
-
// strings
|
|
2176
|
-
case 34:
|
|
2177
|
-
pos++;
|
|
2178
|
-
value = scanString();
|
|
2179
|
-
return token = 10;
|
|
2180
|
-
// comments
|
|
2181
|
-
case 47:
|
|
2182
|
-
const start = pos - 1;
|
|
2183
|
-
if (text.charCodeAt(pos + 1) === 47) {
|
|
2184
|
-
pos += 2;
|
|
2185
|
-
while (pos < len) {
|
|
2186
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
2187
|
-
break;
|
|
2188
|
-
}
|
|
2189
|
-
pos++;
|
|
2190
|
-
}
|
|
2191
|
-
value = text.substring(start, pos);
|
|
2192
|
-
return token = 12;
|
|
2193
|
-
}
|
|
2194
|
-
if (text.charCodeAt(pos + 1) === 42) {
|
|
2195
|
-
pos += 2;
|
|
2196
|
-
const safeLength = len - 1;
|
|
2197
|
-
let commentClosed = false;
|
|
2198
|
-
while (pos < safeLength) {
|
|
2199
|
-
const ch = text.charCodeAt(pos);
|
|
2200
|
-
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
2201
|
-
pos += 2;
|
|
2202
|
-
commentClosed = true;
|
|
2203
|
-
break;
|
|
2204
|
-
}
|
|
2205
|
-
pos++;
|
|
2206
|
-
if (isLineBreak(ch)) {
|
|
2207
|
-
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
2208
|
-
pos++;
|
|
2209
|
-
}
|
|
2210
|
-
lineNumber++;
|
|
2211
|
-
tokenLineStartOffset = pos;
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
if (!commentClosed) {
|
|
2215
|
-
pos++;
|
|
2216
|
-
scanError = 1;
|
|
2217
|
-
}
|
|
2218
|
-
value = text.substring(start, pos);
|
|
2219
|
-
return token = 13;
|
|
2220
|
-
}
|
|
2221
|
-
value += String.fromCharCode(code);
|
|
2222
|
-
pos++;
|
|
2223
|
-
return token = 16;
|
|
2224
|
-
// numbers
|
|
2225
|
-
case 45:
|
|
2226
|
-
value += String.fromCharCode(code);
|
|
2227
|
-
pos++;
|
|
2228
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
2229
|
-
return token = 16;
|
|
2230
|
-
}
|
|
2231
|
-
// found a minus, followed by a number so
|
|
2232
|
-
// we fall through to proceed with scanning
|
|
2233
|
-
// numbers
|
|
2234
|
-
case 48:
|
|
2235
|
-
case 49:
|
|
2236
|
-
case 50:
|
|
2237
|
-
case 51:
|
|
2238
|
-
case 52:
|
|
2239
|
-
case 53:
|
|
2240
|
-
case 54:
|
|
2241
|
-
case 55:
|
|
2242
|
-
case 56:
|
|
2243
|
-
case 57:
|
|
2244
|
-
value += scanNumber();
|
|
2245
|
-
return token = 11;
|
|
2246
|
-
// literals and unknown symbols
|
|
2247
|
-
default:
|
|
2248
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
2249
|
-
pos++;
|
|
2250
|
-
code = text.charCodeAt(pos);
|
|
2251
|
-
}
|
|
2252
|
-
if (tokenOffset !== pos) {
|
|
2253
|
-
value = text.substring(tokenOffset, pos);
|
|
2254
|
-
switch (value) {
|
|
2255
|
-
case "true":
|
|
2256
|
-
return token = 8;
|
|
2257
|
-
case "false":
|
|
2258
|
-
return token = 9;
|
|
2259
|
-
case "null":
|
|
2260
|
-
return token = 7;
|
|
2261
|
-
}
|
|
2262
|
-
return token = 16;
|
|
2263
|
-
}
|
|
2264
|
-
value += String.fromCharCode(code);
|
|
2265
|
-
pos++;
|
|
2266
|
-
return token = 16;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
function isUnknownContentCharacter(code) {
|
|
2270
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
2271
|
-
return false;
|
|
2272
|
-
}
|
|
2273
|
-
switch (code) {
|
|
2274
|
-
case 125:
|
|
2275
|
-
case 93:
|
|
2276
|
-
case 123:
|
|
2277
|
-
case 91:
|
|
2278
|
-
case 34:
|
|
2279
|
-
case 58:
|
|
2280
|
-
case 44:
|
|
2281
|
-
case 47:
|
|
2282
|
-
return false;
|
|
2283
|
-
}
|
|
2284
|
-
return true;
|
|
2285
|
-
}
|
|
2286
|
-
function scanNextNonTrivia() {
|
|
2287
|
-
let result;
|
|
2288
|
-
do {
|
|
2289
|
-
result = scanNext();
|
|
2290
|
-
} while (result >= 12 && result <= 15);
|
|
2291
|
-
return result;
|
|
2292
|
-
}
|
|
2293
|
-
return {
|
|
2294
|
-
setPosition,
|
|
2295
|
-
getPosition: () => pos,
|
|
2296
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
2297
|
-
getToken: () => token,
|
|
2298
|
-
getTokenValue: () => value,
|
|
2299
|
-
getTokenOffset: () => tokenOffset,
|
|
2300
|
-
getTokenLength: () => pos - tokenOffset,
|
|
2301
|
-
getTokenStartLine: () => lineStartOffset,
|
|
2302
|
-
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
2303
|
-
getTokenError: () => scanError
|
|
2304
|
-
};
|
|
2305
|
-
}
|
|
2306
|
-
function isWhiteSpace(ch) {
|
|
2307
|
-
return ch === 32 || ch === 9;
|
|
2308
|
-
}
|
|
2309
|
-
function isLineBreak(ch) {
|
|
2310
|
-
return ch === 10 || ch === 13;
|
|
2311
|
-
}
|
|
2312
|
-
function isDigit(ch) {
|
|
2313
|
-
return ch >= 48 && ch <= 57;
|
|
2314
|
-
}
|
|
2315
|
-
var CharacterCodes;
|
|
2316
|
-
(function(CharacterCodes2) {
|
|
2317
|
-
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
2318
|
-
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
2319
|
-
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
2320
|
-
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
2321
|
-
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
2322
|
-
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
2323
|
-
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
2324
|
-
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
2325
|
-
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
2326
|
-
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
2327
|
-
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
2328
|
-
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
2329
|
-
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
2330
|
-
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
2331
|
-
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
2332
|
-
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
2333
|
-
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
2334
|
-
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
2335
|
-
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
2336
|
-
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
2337
|
-
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
2338
|
-
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
2339
|
-
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
2340
|
-
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
2341
|
-
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
2342
|
-
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
2343
|
-
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
2344
|
-
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
2345
|
-
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
2346
|
-
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
2347
|
-
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
2348
|
-
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
2349
|
-
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
2350
|
-
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
2351
|
-
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
2352
|
-
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
2353
|
-
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
2354
|
-
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
2355
|
-
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
2356
|
-
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
2357
|
-
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
2358
|
-
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
2359
|
-
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
2360
|
-
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
2361
|
-
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
2362
|
-
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
2363
|
-
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
2364
|
-
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
2365
|
-
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
2366
|
-
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
2367
|
-
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
2368
|
-
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
2369
|
-
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
2370
|
-
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
2371
|
-
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
2372
|
-
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
2373
|
-
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
2374
|
-
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
2375
|
-
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
2376
|
-
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
2377
|
-
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
2378
|
-
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
2379
|
-
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
2380
|
-
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
2381
|
-
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
2382
|
-
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
2383
|
-
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
2384
|
-
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
2385
|
-
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
2386
|
-
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
2387
|
-
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
2388
|
-
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
2389
|
-
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
2390
|
-
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
2391
|
-
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
2392
|
-
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
2393
|
-
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
2394
|
-
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
2395
|
-
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
2396
|
-
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
2397
|
-
})(CharacterCodes || (CharacterCodes = {}));
|
|
2398
|
-
|
|
2399
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
2400
|
-
var cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
2401
|
-
return " ".repeat(index);
|
|
2402
|
-
});
|
|
2403
|
-
var maxCachedValues = 200;
|
|
2404
|
-
var cachedBreakLinesWithSpaces = {
|
|
2405
|
-
" ": {
|
|
2406
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
2407
|
-
return "\n" + " ".repeat(index);
|
|
2408
|
-
}),
|
|
2409
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
2410
|
-
return "\r" + " ".repeat(index);
|
|
2411
|
-
}),
|
|
2412
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
2413
|
-
return "\r\n" + " ".repeat(index);
|
|
2414
|
-
})
|
|
2415
|
-
},
|
|
2416
|
-
" ": {
|
|
2417
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
2418
|
-
return "\n" + " ".repeat(index);
|
|
2419
|
-
}),
|
|
2420
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
2421
|
-
return "\r" + " ".repeat(index);
|
|
2422
|
-
}),
|
|
2423
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
2424
|
-
return "\r\n" + " ".repeat(index);
|
|
2425
|
-
})
|
|
2426
|
-
}
|
|
2427
|
-
};
|
|
2428
|
-
|
|
2429
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
2430
|
-
var ParseOptions;
|
|
2431
|
-
(function(ParseOptions2) {
|
|
2432
|
-
ParseOptions2.DEFAULT = {
|
|
2433
|
-
allowTrailingComma: false
|
|
2434
|
-
};
|
|
2435
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
2436
|
-
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
2437
|
-
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
2438
|
-
function ensurePropertyComplete(endOffset) {
|
|
2439
|
-
if (currentParent.type === "property") {
|
|
2440
|
-
currentParent.length = endOffset - currentParent.offset;
|
|
2441
|
-
currentParent = currentParent.parent;
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
|
-
function onValue(valueNode) {
|
|
2445
|
-
currentParent.children.push(valueNode);
|
|
2446
|
-
return valueNode;
|
|
2447
|
-
}
|
|
2448
|
-
const visitor = {
|
|
2449
|
-
onObjectBegin: (offset) => {
|
|
2450
|
-
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
2451
|
-
},
|
|
2452
|
-
onObjectProperty: (name, offset, length) => {
|
|
2453
|
-
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
2454
|
-
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
2455
|
-
},
|
|
2456
|
-
onObjectEnd: (offset, length) => {
|
|
2457
|
-
ensurePropertyComplete(offset + length);
|
|
2458
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
2459
|
-
currentParent = currentParent.parent;
|
|
2460
|
-
ensurePropertyComplete(offset + length);
|
|
2461
|
-
},
|
|
2462
|
-
onArrayBegin: (offset, length) => {
|
|
2463
|
-
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
2464
|
-
},
|
|
2465
|
-
onArrayEnd: (offset, length) => {
|
|
2466
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
2467
|
-
currentParent = currentParent.parent;
|
|
2468
|
-
ensurePropertyComplete(offset + length);
|
|
2469
|
-
},
|
|
2470
|
-
onLiteralValue: (value, offset, length) => {
|
|
2471
|
-
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
2472
|
-
ensurePropertyComplete(offset + length);
|
|
2473
|
-
},
|
|
2474
|
-
onSeparator: (sep, offset, length) => {
|
|
2475
|
-
if (currentParent.type === "property") {
|
|
2476
|
-
if (sep === ":") {
|
|
2477
|
-
currentParent.colonOffset = offset;
|
|
2478
|
-
} else if (sep === ",") {
|
|
2479
|
-
ensurePropertyComplete(offset);
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
},
|
|
2483
|
-
onError: (error, offset, length) => {
|
|
2484
|
-
errors.push({ error, offset, length });
|
|
2485
|
-
}
|
|
2486
|
-
};
|
|
2487
|
-
visit(text, visitor, options);
|
|
2488
|
-
const result = currentParent.children[0];
|
|
2489
|
-
if (result) {
|
|
2490
|
-
delete result.parent;
|
|
2491
|
-
}
|
|
2492
|
-
return result;
|
|
2493
|
-
}
|
|
2494
|
-
function findNodeAtLocation(root, path) {
|
|
2495
|
-
if (!root) {
|
|
2496
|
-
return void 0;
|
|
2497
|
-
}
|
|
2498
|
-
let node = root;
|
|
2499
|
-
for (let segment of path) {
|
|
2500
|
-
if (typeof segment === "string") {
|
|
2501
|
-
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
2502
|
-
return void 0;
|
|
2503
|
-
}
|
|
2504
|
-
let found = false;
|
|
2505
|
-
for (const propertyNode of node.children) {
|
|
2506
|
-
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
2507
|
-
node = propertyNode.children[1];
|
|
2508
|
-
found = true;
|
|
2509
|
-
break;
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
if (!found) {
|
|
2513
|
-
return void 0;
|
|
2514
|
-
}
|
|
2515
|
-
} else {
|
|
2516
|
-
const index = segment;
|
|
2517
|
-
if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
2518
|
-
return void 0;
|
|
2519
|
-
}
|
|
2520
|
-
node = node.children[index];
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
return node;
|
|
2524
|
-
}
|
|
2525
|
-
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
2526
|
-
const _scanner = createScanner(text, false);
|
|
2527
|
-
const _jsonPath = [];
|
|
2528
|
-
let suppressedCallbacks = 0;
|
|
2529
|
-
function toNoArgVisit(visitFunction) {
|
|
2530
|
-
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
2531
|
-
}
|
|
2532
|
-
function toOneArgVisit(visitFunction) {
|
|
2533
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
2534
|
-
}
|
|
2535
|
-
function toOneArgVisitWithPath(visitFunction) {
|
|
2536
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
2537
|
-
}
|
|
2538
|
-
function toBeginVisit(visitFunction) {
|
|
2539
|
-
return visitFunction ? () => {
|
|
2540
|
-
if (suppressedCallbacks > 0) {
|
|
2541
|
-
suppressedCallbacks++;
|
|
2542
|
-
} else {
|
|
2543
|
-
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
2544
|
-
if (cbReturn === false) {
|
|
2545
|
-
suppressedCallbacks = 1;
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
} : () => true;
|
|
2549
|
-
}
|
|
2550
|
-
function toEndVisit(visitFunction) {
|
|
2551
|
-
return visitFunction ? () => {
|
|
2552
|
-
if (suppressedCallbacks > 0) {
|
|
2553
|
-
suppressedCallbacks--;
|
|
2554
|
-
}
|
|
2555
|
-
if (suppressedCallbacks === 0) {
|
|
2556
|
-
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
2557
|
-
}
|
|
2558
|
-
} : () => true;
|
|
2559
|
-
}
|
|
2560
|
-
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);
|
|
2561
|
-
const disallowComments = options && options.disallowComments;
|
|
2562
|
-
const allowTrailingComma = options && options.allowTrailingComma;
|
|
2563
|
-
function scanNext() {
|
|
2564
|
-
while (true) {
|
|
2565
|
-
const token = _scanner.scan();
|
|
2566
|
-
switch (_scanner.getTokenError()) {
|
|
2567
|
-
case 4:
|
|
2568
|
-
handleError(
|
|
2569
|
-
14
|
|
2570
|
-
/* ParseErrorCode.InvalidUnicode */
|
|
2571
|
-
);
|
|
2572
|
-
break;
|
|
2573
|
-
case 5:
|
|
2574
|
-
handleError(
|
|
2575
|
-
15
|
|
2576
|
-
/* ParseErrorCode.InvalidEscapeCharacter */
|
|
2577
|
-
);
|
|
2578
|
-
break;
|
|
2579
|
-
case 3:
|
|
2580
|
-
handleError(
|
|
2581
|
-
13
|
|
2582
|
-
/* ParseErrorCode.UnexpectedEndOfNumber */
|
|
2583
|
-
);
|
|
2584
|
-
break;
|
|
2585
|
-
case 1:
|
|
2586
|
-
if (!disallowComments) {
|
|
2587
|
-
handleError(
|
|
2588
|
-
11
|
|
2589
|
-
/* ParseErrorCode.UnexpectedEndOfComment */
|
|
2590
|
-
);
|
|
2591
|
-
}
|
|
2592
|
-
break;
|
|
2593
|
-
case 2:
|
|
2594
|
-
handleError(
|
|
2595
|
-
12
|
|
2596
|
-
/* ParseErrorCode.UnexpectedEndOfString */
|
|
2597
|
-
);
|
|
2598
|
-
break;
|
|
2599
|
-
case 6:
|
|
2600
|
-
handleError(
|
|
2601
|
-
16
|
|
2602
|
-
/* ParseErrorCode.InvalidCharacter */
|
|
2603
|
-
);
|
|
2604
|
-
break;
|
|
2605
|
-
}
|
|
2606
|
-
switch (token) {
|
|
2607
|
-
case 12:
|
|
2608
|
-
case 13:
|
|
2609
|
-
if (disallowComments) {
|
|
2610
|
-
handleError(
|
|
2611
|
-
10
|
|
2612
|
-
/* ParseErrorCode.InvalidCommentToken */
|
|
2613
|
-
);
|
|
2614
|
-
} else {
|
|
2615
|
-
onComment();
|
|
2616
|
-
}
|
|
2617
|
-
break;
|
|
2618
|
-
case 16:
|
|
2619
|
-
handleError(
|
|
2620
|
-
1
|
|
2621
|
-
/* ParseErrorCode.InvalidSymbol */
|
|
2622
|
-
);
|
|
2623
|
-
break;
|
|
2624
|
-
case 15:
|
|
2625
|
-
case 14:
|
|
2626
|
-
break;
|
|
2627
|
-
default:
|
|
2628
|
-
return token;
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
2633
|
-
onError(error);
|
|
2634
|
-
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
2635
|
-
let token = _scanner.getToken();
|
|
2636
|
-
while (token !== 17) {
|
|
2637
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
2638
|
-
scanNext();
|
|
2639
|
-
break;
|
|
2640
|
-
} else if (skipUntil.indexOf(token) !== -1) {
|
|
2641
|
-
break;
|
|
2642
|
-
}
|
|
2643
|
-
token = scanNext();
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
}
|
|
2647
|
-
function parseString(isValue) {
|
|
2648
|
-
const value = _scanner.getTokenValue();
|
|
2649
|
-
if (isValue) {
|
|
2650
|
-
onLiteralValue(value);
|
|
2651
|
-
} else {
|
|
2652
|
-
onObjectProperty(value);
|
|
2653
|
-
_jsonPath.push(value);
|
|
2654
|
-
}
|
|
2655
|
-
scanNext();
|
|
2656
|
-
return true;
|
|
2657
|
-
}
|
|
2658
|
-
function parseLiteral() {
|
|
2659
|
-
switch (_scanner.getToken()) {
|
|
2660
|
-
case 11:
|
|
2661
|
-
const tokenValue = _scanner.getTokenValue();
|
|
2662
|
-
let value = Number(tokenValue);
|
|
2663
|
-
if (isNaN(value)) {
|
|
2664
|
-
handleError(
|
|
2665
|
-
2
|
|
2666
|
-
/* ParseErrorCode.InvalidNumberFormat */
|
|
2667
|
-
);
|
|
2668
|
-
value = 0;
|
|
2669
|
-
}
|
|
2670
|
-
onLiteralValue(value);
|
|
2671
|
-
break;
|
|
2672
|
-
case 7:
|
|
2673
|
-
onLiteralValue(null);
|
|
2674
|
-
break;
|
|
2675
|
-
case 8:
|
|
2676
|
-
onLiteralValue(true);
|
|
2677
|
-
break;
|
|
2678
|
-
case 9:
|
|
2679
|
-
onLiteralValue(false);
|
|
2680
|
-
break;
|
|
2681
|
-
default:
|
|
2682
|
-
return false;
|
|
2683
|
-
}
|
|
2684
|
-
scanNext();
|
|
2685
|
-
return true;
|
|
2686
|
-
}
|
|
2687
|
-
function parseProperty() {
|
|
2688
|
-
if (_scanner.getToken() !== 10) {
|
|
2689
|
-
handleError(3, [], [
|
|
2690
|
-
2,
|
|
2691
|
-
5
|
|
2692
|
-
/* SyntaxKind.CommaToken */
|
|
2693
|
-
]);
|
|
2694
|
-
return false;
|
|
2695
|
-
}
|
|
2696
|
-
parseString(false);
|
|
2697
|
-
if (_scanner.getToken() === 6) {
|
|
2698
|
-
onSeparator(":");
|
|
2699
|
-
scanNext();
|
|
2700
|
-
if (!parseValue()) {
|
|
2701
|
-
handleError(4, [], [
|
|
2702
|
-
2,
|
|
2703
|
-
5
|
|
2704
|
-
/* SyntaxKind.CommaToken */
|
|
2705
|
-
]);
|
|
2706
|
-
}
|
|
2707
|
-
} else {
|
|
2708
|
-
handleError(5, [], [
|
|
2709
|
-
2,
|
|
2710
|
-
5
|
|
2711
|
-
/* SyntaxKind.CommaToken */
|
|
2712
|
-
]);
|
|
2713
|
-
}
|
|
2714
|
-
_jsonPath.pop();
|
|
2715
|
-
return true;
|
|
2716
|
-
}
|
|
2717
|
-
function parseObject() {
|
|
2718
|
-
onObjectBegin();
|
|
2719
|
-
scanNext();
|
|
2720
|
-
let needsComma = false;
|
|
2721
|
-
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
2722
|
-
if (_scanner.getToken() === 5) {
|
|
2723
|
-
if (!needsComma) {
|
|
2724
|
-
handleError(4, [], []);
|
|
2725
|
-
}
|
|
2726
|
-
onSeparator(",");
|
|
2727
|
-
scanNext();
|
|
2728
|
-
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
2729
|
-
break;
|
|
2730
|
-
}
|
|
2731
|
-
} else if (needsComma) {
|
|
2732
|
-
handleError(6, [], []);
|
|
2733
|
-
}
|
|
2734
|
-
if (!parseProperty()) {
|
|
2735
|
-
handleError(4, [], [
|
|
2736
|
-
2,
|
|
2737
|
-
5
|
|
2738
|
-
/* SyntaxKind.CommaToken */
|
|
2739
|
-
]);
|
|
2740
|
-
}
|
|
2741
|
-
needsComma = true;
|
|
2742
|
-
}
|
|
2743
|
-
onObjectEnd();
|
|
2744
|
-
if (_scanner.getToken() !== 2) {
|
|
2745
|
-
handleError(7, [
|
|
2746
|
-
2
|
|
2747
|
-
/* SyntaxKind.CloseBraceToken */
|
|
2748
|
-
], []);
|
|
2749
|
-
} else {
|
|
2750
|
-
scanNext();
|
|
2751
|
-
}
|
|
2752
|
-
return true;
|
|
2753
|
-
}
|
|
2754
|
-
function parseArray() {
|
|
2755
|
-
onArrayBegin();
|
|
2756
|
-
scanNext();
|
|
2757
|
-
let isFirstElement = true;
|
|
2758
|
-
let needsComma = false;
|
|
2759
|
-
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
2760
|
-
if (_scanner.getToken() === 5) {
|
|
2761
|
-
if (!needsComma) {
|
|
2762
|
-
handleError(4, [], []);
|
|
2763
|
-
}
|
|
2764
|
-
onSeparator(",");
|
|
2765
|
-
scanNext();
|
|
2766
|
-
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
2767
|
-
break;
|
|
2768
|
-
}
|
|
2769
|
-
} else if (needsComma) {
|
|
2770
|
-
handleError(6, [], []);
|
|
2771
|
-
}
|
|
2772
|
-
if (isFirstElement) {
|
|
2773
|
-
_jsonPath.push(0);
|
|
2774
|
-
isFirstElement = false;
|
|
2775
|
-
} else {
|
|
2776
|
-
_jsonPath[_jsonPath.length - 1]++;
|
|
2777
|
-
}
|
|
2778
|
-
if (!parseValue()) {
|
|
2779
|
-
handleError(4, [], [
|
|
2780
|
-
4,
|
|
2781
|
-
5
|
|
2782
|
-
/* SyntaxKind.CommaToken */
|
|
2783
|
-
]);
|
|
2784
|
-
}
|
|
2785
|
-
needsComma = true;
|
|
2786
|
-
}
|
|
2787
|
-
onArrayEnd();
|
|
2788
|
-
if (!isFirstElement) {
|
|
2789
|
-
_jsonPath.pop();
|
|
2790
|
-
}
|
|
2791
|
-
if (_scanner.getToken() !== 4) {
|
|
2792
|
-
handleError(8, [
|
|
2793
|
-
4
|
|
2794
|
-
/* SyntaxKind.CloseBracketToken */
|
|
2795
|
-
], []);
|
|
2796
|
-
} else {
|
|
2797
|
-
scanNext();
|
|
2798
|
-
}
|
|
2799
|
-
return true;
|
|
2800
|
-
}
|
|
2801
|
-
function parseValue() {
|
|
2802
|
-
switch (_scanner.getToken()) {
|
|
2803
|
-
case 3:
|
|
2804
|
-
return parseArray();
|
|
2805
|
-
case 1:
|
|
2806
|
-
return parseObject();
|
|
2807
|
-
case 10:
|
|
2808
|
-
return parseString(true);
|
|
2809
|
-
default:
|
|
2810
|
-
return parseLiteral();
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
scanNext();
|
|
2814
|
-
if (_scanner.getToken() === 17) {
|
|
2815
|
-
if (options.allowEmptyContent) {
|
|
2816
|
-
return true;
|
|
2817
|
-
}
|
|
2818
|
-
handleError(4, [], []);
|
|
2819
|
-
return false;
|
|
2820
|
-
}
|
|
2821
|
-
if (!parseValue()) {
|
|
2822
|
-
handleError(4, [], []);
|
|
2823
|
-
return false;
|
|
2824
|
-
}
|
|
2825
|
-
if (_scanner.getToken() !== 17) {
|
|
2826
|
-
handleError(9, [], []);
|
|
2827
|
-
}
|
|
2828
|
-
return true;
|
|
2829
|
-
}
|
|
2830
|
-
function getNodeType(value) {
|
|
2831
|
-
switch (typeof value) {
|
|
2832
|
-
case "boolean":
|
|
2833
|
-
return "boolean";
|
|
2834
|
-
case "number":
|
|
2835
|
-
return "number";
|
|
2836
|
-
case "string":
|
|
2837
|
-
return "string";
|
|
2838
|
-
case "object": {
|
|
2839
|
-
if (!value) {
|
|
2840
|
-
return "null";
|
|
2841
|
-
} else if (Array.isArray(value)) {
|
|
2842
|
-
return "array";
|
|
2843
|
-
}
|
|
2844
|
-
return "object";
|
|
2845
|
-
}
|
|
2846
|
-
default:
|
|
2847
|
-
return "null";
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
|
|
2851
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
2852
|
-
var ScanError;
|
|
2853
|
-
(function(ScanError2) {
|
|
2854
|
-
ScanError2[ScanError2["None"] = 0] = "None";
|
|
2855
|
-
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
2856
|
-
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
2857
|
-
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
2858
|
-
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
2859
|
-
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
2860
|
-
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
2861
|
-
})(ScanError || (ScanError = {}));
|
|
2862
|
-
var SyntaxKind;
|
|
2863
|
-
(function(SyntaxKind2) {
|
|
2864
|
-
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
2865
|
-
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
2866
|
-
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
2867
|
-
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
2868
|
-
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
2869
|
-
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
2870
|
-
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
2871
|
-
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
2872
|
-
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
2873
|
-
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
2874
|
-
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
2875
|
-
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
2876
|
-
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
2877
|
-
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
2878
|
-
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
2879
|
-
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
2880
|
-
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
2881
|
-
})(SyntaxKind || (SyntaxKind = {}));
|
|
2882
|
-
var parseTree2 = parseTree;
|
|
2883
|
-
var findNodeAtLocation2 = findNodeAtLocation;
|
|
2884
|
-
var ParseErrorCode;
|
|
2885
|
-
(function(ParseErrorCode2) {
|
|
2886
|
-
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
2887
|
-
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
2888
|
-
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
2889
|
-
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
2890
|
-
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
2891
|
-
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
2892
|
-
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
2893
|
-
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
2894
|
-
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
2895
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
2896
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
2897
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
2898
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
2899
|
-
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
2900
|
-
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
2901
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
2902
|
-
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
2903
|
-
|
|
2904
2119
|
// src/generators/shared/json-edit.ts
|
|
2120
|
+
import { findNodeAtLocation, parseTree } from "jsonc-parser";
|
|
2905
2121
|
function detectIndent(raw) {
|
|
2906
2122
|
for (const line of raw.split("\n")) {
|
|
2907
2123
|
const match = /^(\t+| +)/.exec(line);
|
|
@@ -2959,14 +2175,14 @@ function insertProperty(raw, object, key, value, style) {
|
|
|
2959
2175
|
}
|
|
2960
2176
|
function setJsonValue(raw, path, value) {
|
|
2961
2177
|
const style = styleOf(raw);
|
|
2962
|
-
const root =
|
|
2178
|
+
const root = parseTree(raw);
|
|
2963
2179
|
if (root === void 0) throw new Error("setJsonValue: not a JSON document");
|
|
2964
|
-
const existing =
|
|
2180
|
+
const existing = findNodeAtLocation(root, path);
|
|
2965
2181
|
if (existing !== void 0) {
|
|
2966
2182
|
return splice(raw, existing.offset, existing.offset + existing.length, renderValue(value, lineIndentAt(raw, existing.offset), style));
|
|
2967
2183
|
}
|
|
2968
2184
|
for (let depth = path.length - 1; depth >= 0; depth--) {
|
|
2969
|
-
const parent = depth === 0 ? root :
|
|
2185
|
+
const parent = depth === 0 ? root : findNodeAtLocation(root, path.slice(0, depth));
|
|
2970
2186
|
if (parent === void 0) continue;
|
|
2971
2187
|
if (parent.type !== "object") throw new Error(`setJsonValue: ${path.slice(0, depth).join(".") || "the root"} is not an object`);
|
|
2972
2188
|
return insertProperty(raw, parent, path[depth], nest(path.slice(depth + 1), value), style);
|
|
@@ -2975,8 +2191,8 @@ function setJsonValue(raw, path, value) {
|
|
|
2975
2191
|
}
|
|
2976
2192
|
function appendJsonArrayItem(raw, path, item) {
|
|
2977
2193
|
const style = styleOf(raw);
|
|
2978
|
-
const root =
|
|
2979
|
-
const array = root === void 0 ? void 0 :
|
|
2194
|
+
const root = parseTree(raw);
|
|
2195
|
+
const array = root === void 0 ? void 0 : findNodeAtLocation(root, path);
|
|
2980
2196
|
if (array === void 0) return setJsonValue(raw, path, [item]);
|
|
2981
2197
|
if (array.type !== "array") throw new Error(`appendJsonArrayItem: ${path.join(".")} is not an array`);
|
|
2982
2198
|
const items = array.children ?? [];
|
|
@@ -3430,6 +2646,7 @@ function renderAddAgentRulesReport(report) {
|
|
|
3430
2646
|
|
|
3431
2647
|
// src/generators/add-review/render.ts
|
|
3432
2648
|
var DEPENDABOT_PATH = ".github/dependabot.yml";
|
|
2649
|
+
var PROVIDER_STATUS_URL = "https://github.com/clearlydev/nx-archweave/blob/main/docs/pr-review.md#provider-status";
|
|
3433
2650
|
function renderLineDiff(existing, generated) {
|
|
3434
2651
|
const a = existing.split("\n");
|
|
3435
2652
|
const b = generated.split("\n");
|
|
@@ -3527,6 +2744,10 @@ function renderAddReviewReport(report) {
|
|
|
3527
2744
|
}
|
|
3528
2745
|
lines.push("");
|
|
3529
2746
|
lines.push(`Note: the review workflow stays green-skipped until you register the ${report.requiredSecretName} secret.`);
|
|
2747
|
+
if (report.betaProvider !== void 0) {
|
|
2748
|
+
lines.push(`Note: the ${report.betaProvider} provider is in beta \u2014 its workflow hasn't finished a review end to end on`);
|
|
2749
|
+
lines.push(`GitHub Actions yet. Status, costs and known issues: ${PROVIDER_STATUS_URL}`);
|
|
2750
|
+
}
|
|
3530
2751
|
lines.push("Note: this workflow runs with elevated permissions only after it is merged to the default branch \u2014");
|
|
3531
2752
|
lines.push("merging is the first real validation.");
|
|
3532
2753
|
return lines.join("\n");
|
|
@@ -3594,6 +2815,10 @@ function resolveFsdStructure(config) {
|
|
|
3594
2815
|
const frontend = config?.["frontend"];
|
|
3595
2816
|
return typeof frontend === "string" && frontend !== "none";
|
|
3596
2817
|
}
|
|
2818
|
+
function resolveModuleBoundaries(config) {
|
|
2819
|
+
const backend = config?.["backend"];
|
|
2820
|
+
return backend === "express" || backend === "nest" ? readBoundaryTags(config) : void 0;
|
|
2821
|
+
}
|
|
3597
2822
|
var POLICY_KEYS = ["preset", "sliceGroups", "sharedPublicApi", "testFiles"];
|
|
3598
2823
|
function resolveFsdPolicyNotes(config) {
|
|
3599
2824
|
const fsd = config?.["fsd"];
|
|
@@ -3601,14 +2826,22 @@ function resolveFsdPolicyNotes(config) {
|
|
|
3601
2826
|
const policy = resolveFsdPolicy(fsd);
|
|
3602
2827
|
return { sliceGroups: policy.sliceGroups !== false, sharedPublicApi: policy.sharedPublicApi, testFiles: policy.testFiles !== false };
|
|
3603
2828
|
}
|
|
3604
|
-
function runAddAgentRules(tree, options, { recordHosts = true, fsdStructure } = {}) {
|
|
2829
|
+
function runAddAgentRules(tree, options, { recordHosts = true, fsdStructure, moduleBoundaries } = {}) {
|
|
3605
2830
|
const config = readToolkitConfig(tree);
|
|
3606
2831
|
const hosts = resolveAiHostsOption(options.hosts, config);
|
|
3607
2832
|
const files = rulesFilesFor(hosts);
|
|
3608
2833
|
const locale = resolveLocaleOption(options.locale, config);
|
|
3609
2834
|
const teamRules = resolveTeamRules(options.teamRules, config);
|
|
3610
2835
|
const dryRun = options.dryRun ?? false;
|
|
3611
|
-
const
|
|
2836
|
+
const boundaries = moduleBoundaries === void 0 ? resolveModuleBoundaries(config) : moduleBoundaries ?? void 0;
|
|
2837
|
+
const composed = composeAgentRules({
|
|
2838
|
+
files,
|
|
2839
|
+
locale,
|
|
2840
|
+
teamRules,
|
|
2841
|
+
fsdStructure: fsdStructure ?? resolveFsdStructure(config),
|
|
2842
|
+
fsdPolicy: resolveFsdPolicyNotes(config),
|
|
2843
|
+
...boundaries !== void 0 ? { moduleBoundaries: boundaries } : {}
|
|
2844
|
+
});
|
|
3612
2845
|
const results = composed.map(({ filePath, content }) => {
|
|
3613
2846
|
if (!validateAgentRules(content, teamRules ? ["team-rules"] : [])) {
|
|
3614
2847
|
throw new Error(
|
|
@@ -3760,6 +2993,7 @@ function deepEqual(a, b) {
|
|
|
3760
2993
|
return aKeys.every((key) => deepEqual(a[key], b[key]));
|
|
3761
2994
|
}
|
|
3762
2995
|
var PROVIDERS = ["claude", "gemini", "gpt", "cursor"];
|
|
2996
|
+
var BETA_PROVIDERS = ["gemini", "gpt", "cursor"];
|
|
3763
2997
|
var MODES = ["fast", "standard", "thorough"];
|
|
3764
2998
|
function recordedReview(config) {
|
|
3765
2999
|
const review = config?.["review"];
|
|
@@ -3779,9 +3013,10 @@ function runAddReview(tree, options) {
|
|
|
3779
3013
|
const packageManager = options.packageManager ?? detectedPm ?? "pnpm";
|
|
3780
3014
|
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;
|
|
3781
3015
|
const recorded = recordedReview(config.parsed);
|
|
3016
|
+
const provider = options.provider ?? recorded.provider ?? "claude";
|
|
3782
3017
|
const plan = composeReviewSetup({
|
|
3783
3018
|
enabled: true,
|
|
3784
|
-
provider
|
|
3019
|
+
provider,
|
|
3785
3020
|
mode: options.mode ?? recorded.mode ?? "standard",
|
|
3786
3021
|
locale: resolveLocale(options.locale, config),
|
|
3787
3022
|
maxRounds: options.maxRounds ?? recorded.maxRounds ?? 3,
|
|
@@ -3876,7 +3111,8 @@ function runAddReview(tree, options) {
|
|
|
3876
3111
|
configError: null,
|
|
3877
3112
|
dependabot,
|
|
3878
3113
|
dependabotProposal: dependabot === "proposed" ? dependabotFile.content : null,
|
|
3879
|
-
...packageManagerNote !== void 0 ? { packageManagerNote } : {}
|
|
3114
|
+
...packageManagerNote !== void 0 ? { packageManagerNote } : {},
|
|
3115
|
+
...BETA_PROVIDERS.includes(provider) ? { betaProvider: provider } : {}
|
|
3880
3116
|
};
|
|
3881
3117
|
}
|
|
3882
3118
|
|
|
@@ -4310,7 +3546,7 @@ function renderInitReport(report) {
|
|
|
4310
3546
|
}
|
|
4311
3547
|
}
|
|
4312
3548
|
const ranDirty = report.allowDirty === true && !report.cleanTree && !report.dryRun;
|
|
4313
|
-
if (ranDirty) {
|
|
3549
|
+
if (ranDirty && report.dirtyFromCaller !== true) {
|
|
4314
3550
|
lines.push("");
|
|
4315
3551
|
lines.push("Note: --allowDirty was set and the working tree already had uncommitted changes \u2014");
|
|
4316
3552
|
lines.push("restoring the files this run modified also reverts your earlier changes to them.");
|
|
@@ -4528,8 +3764,8 @@ function runInit(tree, options, deps) {
|
|
|
4528
3764
|
dryRun
|
|
4529
3765
|
},
|
|
4530
3766
|
// init records aiHosts below, with its other choices; the FSD section follows this run's
|
|
4531
|
-
// frontend axis
|
|
4532
|
-
{ recordHosts: false, fsdStructure: fsdEnabled }
|
|
3767
|
+
// frontend axis, the Module Boundaries section its backend axis
|
|
3768
|
+
{ recordHosts: false, fsdStructure: fsdEnabled, moduleBoundaries: backend === "none" ? null : readBoundaryTags(recorded) }
|
|
4533
3769
|
);
|
|
4534
3770
|
sections.push({ id: "agentRules", enabled: true, report: { kind: "agentRules", report } });
|
|
4535
3771
|
} else {
|
|
@@ -4628,6 +3864,7 @@ function runInit(tree, options, deps) {
|
|
|
4628
3864
|
dryRun,
|
|
4629
3865
|
cleanTree,
|
|
4630
3866
|
allowDirty,
|
|
3867
|
+
dirtyFromCaller: options.dirtyFromCaller ?? false,
|
|
4631
3868
|
refused: false,
|
|
4632
3869
|
sections,
|
|
4633
3870
|
config: configOutcome,
|