@joshuafolkken/kit 1.1010.0 → 1.1050.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.json +1 -5
- package/.claude/skills/dependency-update/SKILL.md +6 -3
- package/.claude/skills/epic-commands/SKILL.md +46 -17
- package/.claude/skills/verify-ui/SKILL.md +1 -1
- package/.claude/skills/workflow-commands/SKILL.md +10 -25
- package/.claude/skills/workflow-commands/background-commands.md +1 -1
- package/.claude/skills/workflow-commands/backlogrun-child.md +6 -4
- package/.claude/skills/workflow-commands/backlogrun-lanes.md +1 -1
- package/.claude/skills/workflow-commands/backlogrun-park.md +6 -0
- package/.claude/skills/workflow-commands/backlogrun-progress.md +30 -36
- package/.claude/skills/workflow-commands/backlogrun-steps.md +16 -16
- package/.claude/skills/workflow-commands/backlogrun.md +3 -12
- package/.claude/skills/workflow-commands/chain-rule.md +2 -2
- package/.claude/skills/workflow-commands/followup-reference.md +2 -2
- package/.claude/skills/workflow-commands/fullrun-steps.md +4 -3
- package/.claude/skills/workflow-commands/fullrun.md +1 -1
- package/.claude/skills/workflow-commands/halfrun.md +2 -1
- package/.claude/skills/workflow-commands/into-target.md +1 -1
- package/.claude/skills/workflow-commands/issue-comments.md +1 -1
- package/.claude/skills/workflow-commands/observation-filing.md +80 -126
- package/.claude/skills/workflow-commands/pre-gate-cut.md +33 -36
- package/.claude/skills/workflow-commands/prerequisite.md +1 -1
- package/.claude/skills/workflow-commands/working-tree-hold.md +2 -2
- package/.codex/hooks.json +1 -5
- package/.github/workflows/auto-tag.yml +21 -0
- package/.github/workflows/publish.yml +9 -10
- package/.github/workflows/sonar-qube.yml +1 -1
- package/AGENTS.md +4 -25
- package/CLAUDE.md +24 -38
- package/GEMINI.md +4 -24
- package/README.md +22 -56
- package/dist/CLAUDE.md +24 -38
- package/dist/hooks/batch-guard.js +4 -4
- package/dist/hooks/{chunk-6PSTVOLH.js → chunk-5BK3K7V4.js} +114 -90
- package/dist/hooks/{chunk-PAXMLGSS.js → chunk-7VPDUBRN.js} +93 -175
- package/dist/hooks/{chunk-KPZN42RT.js → chunk-DMQN45FN.js} +3 -3
- package/dist/hooks/{chunk-WMIR5SNX.js → chunk-EJDX2TOB.js} +13 -3
- package/dist/hooks/{chunk-A2H5I2VD.js → chunk-GQ7KP45M.js} +2 -2
- package/dist/hooks/{chunk-4GDR2YTV.js → chunk-HJIISEAC.js} +4 -4
- package/dist/hooks/{chunk-AWTFKKFW.js → chunk-NAS4C7GP.js} +6 -33
- package/dist/hooks/{chunk-56LGMJJV.js → chunk-NJQOBE6L.js} +2 -2
- package/dist/hooks/{chunk-EZLHXKJ6.js → chunk-RLDX5SOC.js} +1222 -941
- package/dist/hooks/{chunk-GBJUERYK.js → chunk-WQ4OSBSS.js} +10 -3
- package/dist/hooks/codex-hook-adapter.js +10 -10
- package/dist/hooks/duplicate-read-guard.js +5 -5
- package/dist/hooks/format-edited.js +15 -34
- package/dist/hooks/investigation-guard.js +5 -5
- package/dist/hooks/pretool-guard.js +23 -16
- package/dist/hooks/stop-guard.js +21 -200
- package/dist/josh.js +42 -125
- package/dist/version/index.js +466 -42
- package/eslint/base.js +2 -11
- package/package.json +36 -10
- package/prompts/coding-standards.md +15 -290
- package/prompts/collaboration-workflow/cross-repo-epic.md +2 -51
- package/prompts/collaboration-workflow/epic-audit.md +2 -53
- package/prompts/collaboration-workflow/epic-bundle.md +2 -106
- package/prompts/collaboration-workflow/file-edits.md +6 -53
- package/prompts/collaboration-workflow/issue-template.md +4 -4
- package/prompts/collaboration-workflow/operating-rules.md +18 -75
- package/prompts/collaboration-workflow/principles.md +74 -0
- package/prompts/collaboration-workflow/residency.md +55 -15
- package/prompts/collaboration-workflow/rule-delivery.md +5 -46
- package/prompts/collaboration-workflow/shell-body.md +7 -9
- package/prompts/collaboration-workflow/turn-batching.md +21 -37
- package/prompts/collaboration-workflow/upstream-interrupt.md +1 -1
- package/prompts/collaboration-workflow/wip-cap.md +15 -18
- package/prompts/collaboration-workflow.md +22 -28
- package/prompts/sonar-hotspot-handling.md +1 -1
- package/scripts/adopt/adopt-logic.ts +2 -2
- package/scripts/adopt/adopt-toolkits.ts +3 -1
- package/scripts/adopt/adopt.ts +2 -2
- package/scripts/agent/agent-event.ts +2 -9
- package/scripts/agent/agent-exit-record.ts +2 -9
- package/scripts/auto-ok/auto-ok-cli.ts +9 -9
- package/scripts/backlog/backlog-budget-cli.ts +2 -6
- package/scripts/backlog/backlog-drive-cli.ts +20 -10
- package/scripts/backlog/backlog-drive.ts +50 -16
- package/scripts/backlog/backlog-next.ts +24 -8
- package/scripts/backlog/backlog-offer-cli.ts +6 -5
- package/scripts/backlog/backlog-plan-cli.ts +5 -1
- package/scripts/backlog/backlog-plan.ts +1 -1
- package/scripts/backlog/backlog-pool.ts +31 -11
- package/scripts/backlog/backlog-rank.ts +106 -0
- package/scripts/backlog/backlog-waves.ts +42 -29
- package/scripts/build/build-bin.ts +2 -1
- package/scripts/build/build-config-merge.ts +2 -1
- package/scripts/build/build-hooks.ts +31 -6
- package/scripts/build/build-managed-marker.ts +2 -1
- package/scripts/build/build-self-sync-guard.ts +2 -1
- package/scripts/build/build-version.ts +2 -1
- package/scripts/cases/cases-logic.ts +2 -6
- package/scripts/ci/pr-classification.ts +13 -11
- package/scripts/cost-runtime/cost-transcript.ts +4 -11
- package/scripts/delegation/delegation-policy.ts +11 -0
- package/scripts/doctor/doctor-consumer.ts +5 -12
- package/scripts/doctor/doctor-ports.ts +2 -2
- package/scripts/document/document-byte-budget.ts +13 -21
- package/scripts/document/document-section.ts +2 -6
- package/scripts/document/entry-read-budget.ts +6 -5
- package/scripts/{git/git-epic-add-body.ts → epic/epic-add-body.ts} +23 -23
- package/scripts/{git/git-epic-add-plan.ts → epic/epic-add-plan.ts} +23 -26
- package/scripts/{git/git-epic-add.ts → epic/epic-add.ts} +17 -17
- package/scripts/epic/epic-audit-cli.ts +4 -4
- package/scripts/epic/epic-audit-orphans.ts +2 -2
- package/scripts/epic/epic-audit-rationale.ts +1 -1
- package/scripts/epic/epic-audit.ts +1 -1
- package/scripts/{git/git-epic-body.ts → epic/epic-body.ts} +6 -6
- package/scripts/epic/epic-bundle-cli.ts +1 -1
- package/scripts/epic/epic-bundle.ts +2 -2
- package/scripts/epic/epic-candidate-confirm.ts +2 -1
- package/scripts/{git/git-epic-chains.ts → epic/epic-chains.ts} +4 -4
- package/{scripts-ai → scripts/epic}/epic-check.ts +5 -4
- package/{scripts-ai → scripts/epic}/epic-cli.ts +4 -4
- package/scripts/{git/git-epic-close-comment.ts → epic/epic-close-comment.ts} +9 -9
- package/scripts/{git/git-epic-close.ts → epic/epic-close.ts} +23 -19
- package/scripts/epic/epic-cross-repo.ts +21 -38
- package/scripts/{git/git-epic-decision.ts → epic/epic-decision.ts} +12 -14
- package/scripts/epic/epic-fetch.ts +3 -3
- package/scripts/epic/epic-graph.ts +3 -3
- package/scripts/epic/epic-index.ts +2 -2
- package/scripts/epic/epic-issue.ts +1 -1
- package/scripts/epic/epic-lane-offer.ts +11 -22
- package/scripts/epic/epic-next.ts +3 -3
- package/scripts/{git/git-epic-parse.ts → epic/epic-parse.ts} +3 -3
- package/scripts/{git/git-epic-promote.ts → epic/epic-promote.ts} +10 -10
- package/scripts/epic/epic-rank.ts +37 -0
- package/scripts/{git/git-epic-read.ts → epic/epic-read.ts} +9 -9
- package/scripts/{git/git-epic-reconcile.ts → epic/epic-reconcile.ts} +18 -20
- package/scripts/{git/git-epic-reference.ts → epic/epic-reference.ts} +4 -23
- package/scripts/epic/epic-relation-recheck.ts +4 -3
- package/scripts/{git/git-epic-relations.ts → epic/epic-relations.ts} +5 -5
- package/scripts/{git/git-epic-remove-plan.ts → epic/epic-remove-plan.ts} +17 -19
- package/scripts/{git/git-epic-remove.ts → epic/epic-remove.ts} +13 -13
- package/scripts/{git/git-epic-run.ts → epic/epic-run.ts} +27 -27
- package/scripts/{git/git-epic-sections.ts → epic/epic-sections.ts} +6 -6
- package/scripts/{git/git-epic-shape.ts → epic/epic-shape.ts} +7 -7
- package/scripts/epic/epic-solo.ts +29 -28
- package/scripts/{git/git-epic-validate.ts → epic/epic-validate.ts} +13 -13
- package/{scripts-ai → scripts/epic}/epic.ts +17 -16
- package/scripts/gh/fix-gh-packages.ts +2 -1
- package/scripts/gh/gh-spawn.ts +12 -10
- package/scripts/git/constants.ts +1 -1
- package/scripts/git/git-branch.ts +10 -1
- package/scripts/git/git-command.ts +2 -2
- package/scripts/git/git-error.ts +2 -5
- package/scripts/git/git-execa-error.ts +6 -1
- package/{scripts-ai → scripts/git}/git-followup-finish.ts +7 -7
- package/scripts/git/git-followup-flush.ts +74 -48
- package/scripts/git/git-followup-issue-close.ts +2 -2
- package/scripts/git/git-followup-label.ts +1 -1
- package/scripts/git/git-followup-pending.ts +1 -1
- package/{scripts-ai → scripts/git}/git-followup-workflow.ts +23 -11
- package/scripts/git/git-gh-exec.ts +85 -26
- package/scripts/git/git-gh-issue-read.ts +2 -2
- package/scripts/git/git-gh-issue-rest.ts +2 -2
- package/scripts/git/git-gh-issue-write.ts +6 -6
- package/scripts/git/git-gh-pr-read.ts +0 -21
- package/scripts/git/git-gh-pr.ts +2 -23
- package/scripts/git/git-next-issues.ts +34 -5
- package/scripts/git/git-pr-followup-wrapup.ts +2 -6
- package/scripts/git/git-preflight.ts +25 -10
- package/scripts/git/git-push-transport.ts +12 -69
- package/scripts/git/git-spawn.ts +79 -3
- package/scripts/git/git-ssh-keepalive.ts +74 -0
- package/scripts/git/git-staging.ts +21 -9
- package/{scripts-ai → scripts/git}/git-workflow.ts +11 -11
- package/scripts/git/github-issue-url.ts +1 -1
- package/scripts/git/gone-branch.ts +3 -2
- package/scripts/git/issue-labels.ts +13 -1
- package/scripts/git/issue-rank.ts +89 -0
- package/scripts/git/issue-reference.ts +19 -0
- package/scripts/git/main-merge.ts +2 -1
- package/scripts/git/main-sync.ts +3 -2
- package/scripts/git/schemas.ts +1 -1
- package/scripts/git/stash-pop-args.ts +7 -13
- package/scripts/git/stash-pop-cli.ts +2 -1
- package/{scripts-ai → scripts/git}/telegram-test-logic.ts +2 -2
- package/{scripts-ai → scripts/git}/telegram-test.ts +7 -7
- package/scripts/hooks/format-edited-cli.ts +15 -0
- package/scripts/hooks/format-edited-file.ts +2 -9
- package/scripts/hooks/format-rewrite-notice.ts +2 -8
- package/scripts/hooks/pretool-guard-cli.ts +21 -0
- package/scripts/hooks/pretool-guard.ts +14 -15
- package/scripts/init/init-ai-copy.ts +2 -5
- package/scripts/init/init.ts +8 -4
- package/scripts/init/start-exec.ts +7 -1
- package/scripts/init/start-plan.ts +18 -5
- package/scripts/init/start-setup-pr.ts +46 -19
- package/scripts/init/start-steps.ts +43 -10
- package/scripts/init/start.ts +42 -11
- package/scripts/issue/issue-cite.ts +19 -1
- package/scripts/issue/issue-comment-cli.ts +2 -1
- package/scripts/issue/issue-file-cli.ts +2 -1
- package/scripts/issue/issue-fold-cli.ts +9 -16
- package/scripts/issue/issue-scout-cli.ts +8 -13
- package/scripts/issue/measure-rerun-cli.ts +7 -6
- package/scripts/josh/josh-command-map.ts +0 -102
- package/scripts/josh/josh-commands-ai.ts +2 -2
- package/scripts/josh/josh-commands-backlog.ts +1 -1
- package/scripts/josh/josh-commands-development.ts +3 -3
- package/scripts/josh/josh-commands-project.ts +1 -1
- package/scripts/josh/josh-commands-workflow.ts +4 -4
- package/scripts/lane/lane-child-marker.ts +16 -2
- package/scripts/lane/lane-cli.ts +34 -15
- package/scripts/lane/lane-open.ts +3 -2
- package/scripts/lane/lane-registry.ts +3 -6
- package/scripts/lane/lane-report.ts +10 -4
- package/scripts/lib/cli-flags.ts +20 -2
- package/scripts/lib/error-message.ts +9 -0
- package/scripts/lib/read-file.ts +26 -2
- package/scripts/observations/observation-ledger-home.ts +98 -26
- package/scripts/observations/observation-ledger-migrate.ts +26 -21
- package/scripts/observations/observation-ledger-prepare.ts +10 -20
- package/scripts/observations/observation-ledger.ts +58 -25
- package/scripts/observations/observations-flush-cli.ts +6 -23
- package/scripts/observations/observations-flush-landing.ts +2 -1
- package/scripts/observations/observations-flush.ts +29 -20
- package/scripts/package/package-scout-cli.ts +8 -16
- package/scripts/ports/port-command.ts +2 -1
- package/scripts/propagate/propagate-plan.ts +185 -0
- package/scripts/propagate/propagate-publish.ts +6 -7
- package/scripts/propagate/propagate-run.ts +5 -1
- package/scripts/propagate/propagate-steps.ts +18 -2
- package/scripts/propagate/propagate-targets.ts +13 -2
- package/scripts/propagate/propagate.ts +63 -44
- package/scripts/refactor/import-graph.ts +2 -6
- package/scripts/registry-migration/migrate-logic.ts +1 -0
- package/scripts/registry-migration/migrate.ts +3 -2
- package/scripts/registry-migration/user-npmrc.ts +2 -2
- package/scripts/release/github-release.ts +1 -1
- package/scripts/release/release-cli.ts +2 -1
- package/scripts/repo/repo-setting.ts +10 -8
- package/scripts/review/review-attest.ts +44 -0
- package/scripts/review/review-brief-cli.ts +49 -2
- package/scripts/review/review-brief.ts +46 -1
- package/scripts/review/review-finding-ledger.ts +3 -3
- package/scripts/review/review-findings-cli.ts +4 -11
- package/scripts/review/review-record-cli.ts +14 -11
- package/scripts/review/review-record.ts +6 -16
- package/scripts/review/review-stamps.ts +7 -0
- package/scripts/rules/decision-oracle.ts +2 -2
- package/scripts/rules/implementation-cut.ts +1 -1
- package/scripts/rules/issue-fold.ts +1 -2
- package/scripts/rules/lane-carry-conflict.ts +1 -2
- package/scripts/rules/lane-park.ts +1 -2
- package/scripts/rules/pre-gate-cut.ts +2 -2
- package/scripts/rules/rule-body-guard.ts +2 -2
- package/scripts/rules/rule-value-cache.ts +99 -0
- package/scripts/rules/rule-value-cli.ts +10 -9
- package/scripts/rules/rule-value.ts +1 -1
- package/scripts/run/run-carry-args.ts +2 -6
- package/scripts/run/run-carry-cli.ts +5 -7
- package/scripts/run/run-cut-args.ts +7 -13
- package/scripts/run/run-ending-cli.ts +4 -7
- package/scripts/run/run-event-stream.ts +2 -5
- package/scripts/run/run-headless.ts +22 -6
- package/scripts/run/run-liveness-cli.ts +4 -7
- package/scripts/run/run-parent-cut-hook.ts +144 -0
- package/scripts/run/run-progress-args.ts +2 -6
- package/scripts/run/run-progress-cli.ts +2 -1
- package/scripts/run/run-progress-read.ts +2 -1
- package/scripts/run/run-progress.ts +21 -8
- package/scripts/run/run-ship-cli.ts +6 -74
- package/scripts/run/run-ship-preflight.ts +87 -0
- package/scripts/run/run-ship-review-steps.ts +5 -26
- package/scripts/run/run-ship-review.ts +9 -0
- package/scripts/run/run-ship-scoped.ts +44 -0
- package/scripts/run/run-ship-stage.ts +5 -1
- package/scripts/run/run-ship-steps.ts +105 -0
- package/scripts/run/run-ship.ts +2 -0
- package/scripts/run/run-tail-cli.ts +3 -3
- package/scripts/run/run-tidy-stashes.ts +7 -14
- package/scripts/run/run-wake-cli.ts +4 -8
- package/scripts/run/run-wake-describe.ts +19 -1
- package/scripts/run/run-wake-driver.ts +15 -2
- package/scripts/run/run-wake-session.ts +14 -4
- package/scripts/run/run-watcher-hook.ts +1 -1
- package/scripts/safe-chain/project-config.ts +3 -6
- package/scripts/security/security-audit-provision.ts +6 -7
- package/scripts/sonar/sonar-hotspots-cli.ts +2 -1
- package/scripts/sync/directory-copy-guard.ts +2 -1
- package/scripts/sync/sync-ai-files.ts +3 -3
- package/scripts/sync/template-source-logic.ts +3 -4
- package/scripts/test/e2e-retry-check.ts +3 -6
- package/scripts/time-runtime/time-bundle-call.ts +2 -2
- package/scripts/ui/ui-routes-cli.ts +3 -6
- package/scripts/version/bump-version.ts +2 -1
- package/scripts/version/npm-registry.ts +97 -0
- package/scripts/version/version-commands.ts +5 -4
- package/scripts/version/version-remote.ts +38 -33
- package/scripts/version/version-targets.ts +3 -3
- package/.claude/skills/workflow-commands/rule-residency.md +0 -267
- package/evals/scenarios/consult-not-execute.json +0 -20
- package/evals/scenarios/no-implicit-workflow.json +0 -26
- package/evals/scenarios/overrides-both-locations.json +0 -29
- package/evals/scenarios/upstream-interrupt.json +0 -23
- package/evals/scenarios/workflow-skill-loaded.json +0 -16
- package/prompts/agent-lint-protocol.json +0 -79
- package/prompts/agent-rules.md +0 -63
- package/prompts/collaboration-workflow/consultation-vs-execution.md +0 -8
- package/prompts/collaboration-workflow/distributed-docs.md +0 -7
- package/prompts/collaboration-workflow/durable-rules.md +0 -24
- package/prompts/collaboration-workflow/latest-first.md +0 -14
- package/prompts/collaboration-workflow/no-clones.md +0 -11
- package/prompts/collaboration-workflow/simplicity-first.md +0 -9
- package/prompts/collaboration-workflow/single-source-rules.md +0 -13
- package/scripts/build/shim-shell.ts +0 -25
- package/scripts/claude/skill-meta.ts +0 -37
- package/scripts/document/document-scan.ts +0 -108
- package/scripts/document/generate-catalog.ts +0 -69
- package/scripts/document/retired-phrases.ts +0 -143
- package/scripts/document/review-agent-type.ts +0 -46
- package/scripts/document/single-source.ts +0 -73
- package/scripts/git/git-fixture-workspace.ts +0 -88
- package/scripts/hooks/format-edited-file-fixtures.ts +0 -109
- package/scripts/hooks/prompt-hooks.ts +0 -38
- package/scripts/init/hook-command-bootstrap.ts +0 -83
- package/scripts/issue/issue-logic.ts +0 -50
- package/scripts/josh/__snapshots__/josh-command-map.test.ts.snap +0 -1227
- package/scripts/josh/josh-script-reader.ts +0 -11
- package/scripts/package/production-dependency-graph.ts +0 -68
- package/scripts/retrospective/retrospective-cli.ts +0 -97
- package/scripts/retrospective/retrospective.ts +0 -127
- package/scripts/rules/delivered-rules-harness.ts +0 -72
- package/scripts/rules/top-level-scripts-guard.ts +0 -47
- package/scripts/run/run-carry-flush.ts +0 -58
- package/scripts/run/run-transcript.golden.txt +0 -57
- package/scripts/run/run-wake-work.ts +0 -108
- package/scripts/sync/dependabot-pin-logic.ts +0 -135
- package/scripts/test/classify-isolation.ts +0 -149
- package/scripts/test/http-fault-injection.ts +0 -79
- package/scripts/test/josh-harness-environment.ts +0 -260
- package/scripts/test/josh-harness.ts +0 -96
- package/scripts/test/pilot-files.ts +0 -452
- package/scripts/test/pilot-measure.ts +0 -78
- package/scripts/test/test-network-guard.ts +0 -453
- package/scripts/test/test-repository-guard.ts +0 -317
- package/scripts/test/test-state-guard.ts +0 -85
- package/scripts/test/test-stdout-guard.ts +0 -54
- package/scripts/test/test-telegram-guard.ts +0 -90
- package/scripts/test/unit-guard-environment.ts +0 -12
- package/scripts/test/unit-projects.ts +0 -139
- package/scripts/test/vitest-include-globs.ts +0 -12
- package/scripts/time-runtime/time-batch-guard-fixtures.ts +0 -66
- package/scripts-ai/completion-gate.ts +0 -13
- package/scripts-ai/environment-loader.ts +0 -9
- /package/{scripts-ai → scripts/epic}/epic-cli-argv.ts +0 -0
- /package/{scripts-ai → scripts/epic}/epic-cli-remove.ts +0 -0
- /package/{scripts-ai → scripts/git}/followup-issue-number.ts +0 -0
package/dist/version/index.js
CHANGED
|
@@ -557,6 +557,12 @@ var agent_session_environment = {
|
|
|
557
557
|
removed_proxy_environment
|
|
558
558
|
};
|
|
559
559
|
|
|
560
|
+
// scripts/lib/error-message.ts
|
|
561
|
+
function message_of(error) {
|
|
562
|
+
return error instanceof Error ? error.message : String(error);
|
|
563
|
+
}
|
|
564
|
+
var error_text = { message_of };
|
|
565
|
+
|
|
560
566
|
// scripts/git/git-gh-exec.ts
|
|
561
567
|
import { execa as execa2, execaSync } from "execa";
|
|
562
568
|
|
|
@@ -664,8 +670,12 @@ function direct_environment() {
|
|
|
664
670
|
const removed = agent_session_environment.removed_proxy_environment();
|
|
665
671
|
return Object.keys(removed).length > 0 ? { env: removed } : {};
|
|
666
672
|
}
|
|
667
|
-
function to_spawn_options(timeout_ms) {
|
|
668
|
-
return {
|
|
673
|
+
function to_spawn_options(timeout_ms, cwd) {
|
|
674
|
+
return {
|
|
675
|
+
...to_timeout_option(timeout_ms),
|
|
676
|
+
...direct_environment(),
|
|
677
|
+
...cwd !== void 0 && { cwd }
|
|
678
|
+
};
|
|
669
679
|
}
|
|
670
680
|
var GH_REQUEST_TIMEOUT_MESSAGE = "gh request timed out";
|
|
671
681
|
function has_stderr_field(error) {
|
|
@@ -677,13 +687,10 @@ function has_stdout_field(error) {
|
|
|
677
687
|
function to_timeout_prefix(error) {
|
|
678
688
|
return has_timed_out(error) ? `${GH_REQUEST_TIMEOUT_MESSAGE}: ` : "";
|
|
679
689
|
}
|
|
680
|
-
function to_error_message(error) {
|
|
681
|
-
return error instanceof Error ? error.message : String(error);
|
|
682
|
-
}
|
|
683
690
|
function to_gh_error(error) {
|
|
684
691
|
const stderr = has_stderr_field(error) ? error.stderr.trim() : "";
|
|
685
692
|
const stdout = has_stdout_field(error) ? error.stdout.trim() : "";
|
|
686
|
-
const summary = stderr.length > 0 ? stderr :
|
|
693
|
+
const summary = stderr.length > 0 ? stderr : error_text.message_of(error);
|
|
687
694
|
const detail = stdout.length > 0 ? `${summary}
|
|
688
695
|
${stdout}` : summary;
|
|
689
696
|
return gh_failure.attach(
|
|
@@ -691,10 +698,11 @@ ${stdout}` : summary;
|
|
|
691
698
|
gh_failure.classify_stdout(stdout)
|
|
692
699
|
);
|
|
693
700
|
}
|
|
694
|
-
async function exec_gh_command(arguments_, timeout_ms) {
|
|
701
|
+
async function exec_gh_command(arguments_, timeout_ms, cwd) {
|
|
695
702
|
await check_gh_installed();
|
|
703
|
+
const options = to_spawn_options(timeout_ms, cwd);
|
|
696
704
|
try {
|
|
697
|
-
const { stdout } = await execa2("gh", arguments_,
|
|
705
|
+
const { stdout } = await execa2("gh", arguments_, options);
|
|
698
706
|
return stdout.trimEnd();
|
|
699
707
|
} catch (error) {
|
|
700
708
|
throw to_gh_error(error);
|
|
@@ -702,7 +710,7 @@ async function exec_gh_command(arguments_, timeout_ms) {
|
|
|
702
710
|
}
|
|
703
711
|
async function exec_gh_command_with_stdin(input) {
|
|
704
712
|
await check_gh_installed();
|
|
705
|
-
const options = { input: input.stdin_body, ...to_spawn_options(input.timeout_ms) };
|
|
713
|
+
const options = { input: input.stdin_body, ...to_spawn_options(input.timeout_ms, input.cwd) };
|
|
706
714
|
try {
|
|
707
715
|
const { stdout } = await execa2("gh", input.args, options);
|
|
708
716
|
return stdout.trimEnd();
|
|
@@ -715,6 +723,9 @@ function parse_status_line(output) {
|
|
|
715
723
|
const { status } = STATUS_LINE_PATTERN.exec(output)?.groups ?? {};
|
|
716
724
|
return status === void 0 ? void 0 : Number(status);
|
|
717
725
|
}
|
|
726
|
+
function status_of_failure(error) {
|
|
727
|
+
return has_stdout_field(error) ? parse_status_line(error.stdout) : void 0;
|
|
728
|
+
}
|
|
718
729
|
async function exec_gh_api_status(path5, timeout_ms) {
|
|
719
730
|
const options = to_spawn_options(timeout_ms);
|
|
720
731
|
try {
|
|
@@ -722,7 +733,16 @@ async function exec_gh_api_status(path5, timeout_ms) {
|
|
|
722
733
|
const { stdout } = await execa2("gh", ["api", "--include", "--silent", path5], options);
|
|
723
734
|
return parse_status_line(stdout);
|
|
724
735
|
} catch (error) {
|
|
725
|
-
return
|
|
736
|
+
return status_of_failure(error);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
function exec_gh_api_status_sync(path5, timeout_ms) {
|
|
740
|
+
const options = to_spawn_options(timeout_ms);
|
|
741
|
+
try {
|
|
742
|
+
const { stdout } = execaSync("gh", ["api", "--include", "--silent", path5], options);
|
|
743
|
+
return parse_status_line(stdout);
|
|
744
|
+
} catch (error) {
|
|
745
|
+
return status_of_failure(error);
|
|
726
746
|
}
|
|
727
747
|
}
|
|
728
748
|
var METHOD_FLAG = "--method";
|
|
@@ -749,16 +769,19 @@ function to_gh_api_args(request) {
|
|
|
749
769
|
}
|
|
750
770
|
async function exec_gh_api(request) {
|
|
751
771
|
const args = to_gh_api_args(request);
|
|
752
|
-
if (request.body === void 0)
|
|
772
|
+
if (request.body === void 0) {
|
|
773
|
+
return await exec_gh_command(args, request.timeout_ms, request.cwd);
|
|
774
|
+
}
|
|
753
775
|
return await exec_gh_command_with_stdin({
|
|
754
776
|
args,
|
|
755
777
|
stdin_body: request.body,
|
|
756
|
-
timeout_ms: request.timeout_ms
|
|
778
|
+
timeout_ms: request.timeout_ms,
|
|
779
|
+
cwd: request.cwd
|
|
757
780
|
});
|
|
758
781
|
}
|
|
759
782
|
function exec_gh_api_sync(request) {
|
|
760
783
|
const body_option = request.body === void 0 ? {} : { input: request.body };
|
|
761
|
-
const options = { ...body_option, ...to_spawn_options(request.timeout_ms) };
|
|
784
|
+
const options = { ...body_option, ...to_spawn_options(request.timeout_ms, request.cwd) };
|
|
762
785
|
try {
|
|
763
786
|
const { stdout } = execaSync("gh", to_gh_api_args(request), options);
|
|
764
787
|
return stdout.trimEnd();
|
|
@@ -766,19 +789,393 @@ function exec_gh_api_sync(request) {
|
|
|
766
789
|
throw to_gh_error(error);
|
|
767
790
|
}
|
|
768
791
|
}
|
|
792
|
+
function read_gh_api_sync(request) {
|
|
793
|
+
try {
|
|
794
|
+
return exec_gh_api_sync(request);
|
|
795
|
+
} catch {
|
|
796
|
+
return void 0;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
769
799
|
var git_gh_exec = {
|
|
770
800
|
direct_environment,
|
|
771
801
|
exec_gh_command,
|
|
772
802
|
exec_gh_command_with_stdin,
|
|
773
803
|
exec_gh_api,
|
|
774
804
|
exec_gh_api_sync,
|
|
805
|
+
read_gh_api_sync,
|
|
775
806
|
exec_gh_api_status,
|
|
807
|
+
exec_gh_api_status_sync,
|
|
776
808
|
parse_status_line
|
|
777
809
|
};
|
|
778
810
|
|
|
779
|
-
// scripts/
|
|
811
|
+
// scripts/gh/fix-gh-packages-logic.ts
|
|
812
|
+
import { loadAll } from "js-yaml";
|
|
813
|
+
import { z as z4 } from "zod";
|
|
814
|
+
var GH_PACKAGES_HOST = "npm.pkg.github.com";
|
|
815
|
+
var RESOLUTION_BLOCK = "\n resolution:\n";
|
|
816
|
+
var INTEGRITY_PREFIX = " integrity: ";
|
|
817
|
+
var TARBALL_PREFIX = " tarball: ";
|
|
818
|
+
var FLOW_RESOLUTION_LINE_START = "\n resolution: {";
|
|
819
|
+
var FLOW_TARBALL_KEY = ", tarball: ";
|
|
820
|
+
var NPMRC_AUTH_TOKEN_PREFIX = `//${GH_PACKAGES_HOST}/:_authToken=`;
|
|
821
|
+
var REGISTRY_KEY = ":registry=";
|
|
822
|
+
var lockfile_resolution_schema = z4.looseObject({
|
|
823
|
+
integrity: z4.string().optional(),
|
|
824
|
+
tarball: z4.string().optional()
|
|
825
|
+
});
|
|
826
|
+
var lockfile_package_schema = z4.looseObject({
|
|
827
|
+
resolution: lockfile_resolution_schema.optional()
|
|
828
|
+
});
|
|
829
|
+
var lockfile_document_schema = z4.looseObject({
|
|
830
|
+
packages: z4.record(z4.string(), lockfile_package_schema).optional()
|
|
831
|
+
});
|
|
832
|
+
function parse_lockfile_packages(raw) {
|
|
833
|
+
const merged = {};
|
|
834
|
+
for (const document of loadAll(raw)) {
|
|
835
|
+
const { packages } = lockfile_document_schema.parse(document);
|
|
836
|
+
if (packages !== void 0) Object.assign(merged, packages);
|
|
837
|
+
}
|
|
838
|
+
return merged;
|
|
839
|
+
}
|
|
840
|
+
function extract_gh_registry_scope(line) {
|
|
841
|
+
const trimmed = line.trim();
|
|
842
|
+
if (!trimmed.startsWith("@")) return void 0;
|
|
843
|
+
const eq_index = trimmed.indexOf(REGISTRY_KEY);
|
|
844
|
+
if (eq_index === -1) return void 0;
|
|
845
|
+
const registry = trimmed.slice(eq_index + REGISTRY_KEY.length).trim().replace(/\/$/u, "");
|
|
846
|
+
if (registry !== `https://${GH_PACKAGES_HOST}`) return void 0;
|
|
847
|
+
return trimmed.slice(0, eq_index);
|
|
848
|
+
}
|
|
849
|
+
function parse_gh_scopes(npmrc) {
|
|
850
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
851
|
+
for (const line of npmrc.split("\n")) {
|
|
852
|
+
const scope = extract_gh_registry_scope(line);
|
|
853
|
+
if (scope !== void 0) scopes.add(scope);
|
|
854
|
+
}
|
|
855
|
+
return scopes;
|
|
856
|
+
}
|
|
857
|
+
function extract_auth_token_from_line(line) {
|
|
858
|
+
const trimmed = line.trim();
|
|
859
|
+
if (!trimmed.startsWith(NPMRC_AUTH_TOKEN_PREFIX)) return void 0;
|
|
860
|
+
const value = trimmed.slice(NPMRC_AUTH_TOKEN_PREFIX.length);
|
|
861
|
+
if (value.startsWith("${") || value.length === 0) return void 0;
|
|
862
|
+
return value;
|
|
863
|
+
}
|
|
864
|
+
function parse_npmrc_auth_token(npmrc) {
|
|
865
|
+
for (const line of npmrc.split("\n")) {
|
|
866
|
+
const token = extract_auth_token_from_line(line);
|
|
867
|
+
if (token !== void 0) return token;
|
|
868
|
+
}
|
|
869
|
+
return void 0;
|
|
870
|
+
}
|
|
871
|
+
function scope_from_key(key) {
|
|
872
|
+
return key.startsWith("@") ? key.split("/", 1)[0] ?? "" : "";
|
|
873
|
+
}
|
|
874
|
+
function has_tarball(entry) {
|
|
875
|
+
return entry.resolution?.tarball !== void 0;
|
|
876
|
+
}
|
|
877
|
+
function package_path_from_key(key) {
|
|
878
|
+
const start = key.startsWith("@") ? 1 : 0;
|
|
879
|
+
const at_index = key.indexOf("@", start);
|
|
880
|
+
return at_index === -1 ? key : key.slice(0, at_index);
|
|
881
|
+
}
|
|
882
|
+
function package_version_from_key(key) {
|
|
883
|
+
const start = key.startsWith("@") ? 1 : 0;
|
|
884
|
+
const at_index = key.indexOf("@", start);
|
|
885
|
+
if (at_index === -1) return "";
|
|
886
|
+
return key.slice(at_index + 1).split("(", 1)[0] ?? "";
|
|
887
|
+
}
|
|
888
|
+
function should_fix_tarball(key, entry, scopes) {
|
|
889
|
+
if (has_tarball(entry)) return false;
|
|
890
|
+
const scope = scope_from_key(key);
|
|
891
|
+
return scope.length > 0 && scopes.has(scope);
|
|
892
|
+
}
|
|
893
|
+
function find_entry_start(content, package_key) {
|
|
894
|
+
const single = content.indexOf(`
|
|
895
|
+
'${package_key}':
|
|
896
|
+
`);
|
|
897
|
+
if (single !== -1) return single;
|
|
898
|
+
return content.indexOf(`
|
|
899
|
+
"${package_key}":
|
|
900
|
+
`);
|
|
901
|
+
}
|
|
902
|
+
function find_entry_end(content, entry_start) {
|
|
903
|
+
const next_match = /\n {2}['"]/u.exec(content.slice(entry_start + 1));
|
|
904
|
+
return next_match === null ? content.length : entry_start + 1 + next_match.index;
|
|
905
|
+
}
|
|
906
|
+
function find_integrity_eol_in_entry(entry_content) {
|
|
907
|
+
const resolution_pos = entry_content.indexOf(RESOLUTION_BLOCK);
|
|
908
|
+
if (resolution_pos === -1) return -1;
|
|
909
|
+
const integrity_pos = entry_content.indexOf(INTEGRITY_PREFIX, resolution_pos);
|
|
910
|
+
if (integrity_pos === -1) return -1;
|
|
911
|
+
return entry_content.indexOf("\n", integrity_pos);
|
|
912
|
+
}
|
|
913
|
+
function find_flow_resolution_brace(entry_content) {
|
|
914
|
+
const pos = entry_content.indexOf(FLOW_RESOLUTION_LINE_START);
|
|
915
|
+
if (pos === -1) return -1;
|
|
916
|
+
const line_end = entry_content.indexOf("\n", pos + 1);
|
|
917
|
+
const search_end = line_end === -1 ? entry_content.length : line_end;
|
|
918
|
+
const brace = entry_content.lastIndexOf("}", search_end);
|
|
919
|
+
if (brace <= pos) return -1;
|
|
920
|
+
return brace;
|
|
921
|
+
}
|
|
922
|
+
function insert_expanded_tarball(content, entry_start, entry_end, tarball) {
|
|
923
|
+
const entry_content = content.slice(entry_start, entry_end);
|
|
924
|
+
const integrity_eol = find_integrity_eol_in_entry(entry_content);
|
|
925
|
+
if (integrity_eol === -1) return void 0;
|
|
926
|
+
if (entry_content.slice(integrity_eol + 1).startsWith(TARBALL_PREFIX)) return content;
|
|
927
|
+
const patched = `${entry_content.slice(0, integrity_eol + 1)}${TARBALL_PREFIX}${tarball}
|
|
928
|
+
${entry_content.slice(integrity_eol + 1)}`;
|
|
929
|
+
return content.slice(0, entry_start) + patched + content.slice(entry_end);
|
|
930
|
+
}
|
|
931
|
+
function insert_flow_tarball(content, entry_start, entry_end, tarball) {
|
|
932
|
+
const entry_content = content.slice(entry_start, entry_end);
|
|
933
|
+
const brace_pos = find_flow_resolution_brace(entry_content);
|
|
934
|
+
if (brace_pos === -1) return void 0;
|
|
935
|
+
const open_brace = entry_content.lastIndexOf("{", brace_pos);
|
|
936
|
+
if (open_brace === -1) return void 0;
|
|
937
|
+
const flow_body = entry_content.slice(open_brace + 1, brace_pos);
|
|
938
|
+
if (/\btarball\s*:/u.test(flow_body)) return content;
|
|
939
|
+
const patched = `${entry_content.slice(0, brace_pos)}${FLOW_TARBALL_KEY}${tarball}${entry_content.slice(brace_pos)}`;
|
|
940
|
+
return content.slice(0, entry_start) + patched + content.slice(entry_end);
|
|
941
|
+
}
|
|
942
|
+
function insert_tarball_for_key(content, package_key, tarball) {
|
|
943
|
+
const entry_start = find_entry_start(content, package_key);
|
|
944
|
+
if (entry_start === -1) return content;
|
|
945
|
+
const entry_end = find_entry_end(content, entry_start);
|
|
946
|
+
return insert_expanded_tarball(content, entry_start, entry_end, tarball) ?? insert_flow_tarball(content, entry_start, entry_end, tarball) ?? content;
|
|
947
|
+
}
|
|
948
|
+
function patch_lockfile(content, patches) {
|
|
949
|
+
let result = content;
|
|
950
|
+
for (const [key, tarball] of patches) {
|
|
951
|
+
result = insert_tarball_for_key(result, key, tarball);
|
|
952
|
+
}
|
|
953
|
+
return result;
|
|
954
|
+
}
|
|
955
|
+
function resolve_token(environment_token, npmrc_token, get_fallback_token) {
|
|
956
|
+
if (environment_token !== void 0 && environment_token.length > 0) return environment_token;
|
|
957
|
+
if (npmrc_token !== void 0) return npmrc_token;
|
|
958
|
+
return get_fallback_token();
|
|
959
|
+
}
|
|
960
|
+
var fix_gh_packages_logic = {
|
|
961
|
+
parse_gh_scopes,
|
|
962
|
+
parse_npmrc_auth_token,
|
|
963
|
+
parse_lockfile_packages,
|
|
964
|
+
package_path_from_key,
|
|
965
|
+
package_version_from_key,
|
|
966
|
+
needs_tarball_fix: should_fix_tarball,
|
|
967
|
+
insert_tarball_for_key,
|
|
968
|
+
patch_lockfile,
|
|
969
|
+
resolve_token
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
// scripts/registry-migration/migrate-logic.ts
|
|
973
|
+
var SCOPE = "@joshuafolkken";
|
|
974
|
+
var REGISTRY_KEY2 = `${SCOPE}:registry`;
|
|
975
|
+
var PUBLIC_REGISTRY = "https://registry.npmjs.org/";
|
|
976
|
+
var GITHUB_REGISTRY = "https://npm.pkg.github.com/";
|
|
977
|
+
var MAPPING = `${REGISTRY_KEY2}=${PUBLIC_REGISTRY}`;
|
|
978
|
+
var REGISTRY_VALUE_INDEX = 1;
|
|
979
|
+
var SPLIT_LIMIT = 2;
|
|
980
|
+
function normalized_registry(value) {
|
|
981
|
+
let normalized = value.trim();
|
|
982
|
+
while (normalized.endsWith("/")) normalized = normalized.slice(0, -1);
|
|
983
|
+
return `${normalized}/`;
|
|
984
|
+
}
|
|
985
|
+
function mapping_lines(content) {
|
|
986
|
+
return content.split(/\r?\n/u).filter((line) => line.trimStart().startsWith(`${REGISTRY_KEY2}=`));
|
|
987
|
+
}
|
|
988
|
+
function registry_of(content) {
|
|
989
|
+
const lines = mapping_lines(content);
|
|
990
|
+
if (lines.length !== 1) return void 0;
|
|
991
|
+
return normalized_registry(lines[0]?.split("=", SPLIT_LIMIT)[REGISTRY_VALUE_INDEX] ?? "");
|
|
992
|
+
}
|
|
993
|
+
function scoped_packages(lockfile) {
|
|
994
|
+
const packages = fix_gh_packages_logic.parse_lockfile_packages(lockfile);
|
|
995
|
+
return Object.keys(packages).filter((key) => key.startsWith(`${SCOPE}/`)).map((key) => fix_gh_packages_logic.package_path_from_key(key)).filter((name, index, names) => names.indexOf(name) === index);
|
|
996
|
+
}
|
|
997
|
+
function scoped_versions(lockfile) {
|
|
998
|
+
const packages = fix_gh_packages_logic.parse_lockfile_packages(lockfile);
|
|
999
|
+
return Object.keys(packages).filter((key) => key.startsWith(`${SCOPE}/`)).map(
|
|
1000
|
+
(key) => [
|
|
1001
|
+
fix_gh_packages_logic.package_path_from_key(key),
|
|
1002
|
+
fix_gh_packages_logic.package_version_from_key(key)
|
|
1003
|
+
]
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
function is_github_tarball(value) {
|
|
1007
|
+
try {
|
|
1008
|
+
const url = new URL(value);
|
|
1009
|
+
return url.protocol === "https:" && url.hostname === "npm.pkg.github.com";
|
|
1010
|
+
} catch {
|
|
1011
|
+
return false;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
function github_tarballs(lockfile) {
|
|
1015
|
+
const packages = fix_gh_packages_logic.parse_lockfile_packages(lockfile);
|
|
1016
|
+
return Object.entries(packages).filter(
|
|
1017
|
+
([key, entry]) => key.startsWith(`${SCOPE}/`) && entry.resolution?.tarball !== void 0 && is_github_tarball(entry.resolution.tarball)
|
|
1018
|
+
).map(([key]) => key);
|
|
1019
|
+
}
|
|
1020
|
+
function remove_flow_tarball(line) {
|
|
1021
|
+
const marker = ", tarball: https://npm.pkg.github.com/";
|
|
1022
|
+
const start = line.indexOf(marker);
|
|
1023
|
+
if (start === -1) return line;
|
|
1024
|
+
const end = line.indexOf("}", start);
|
|
1025
|
+
if (end === -1) return line;
|
|
1026
|
+
return `${line.slice(0, start)}${line.slice(end)}`;
|
|
1027
|
+
}
|
|
1028
|
+
function is_package_entry(line) {
|
|
1029
|
+
return /^ {2}[^ ]/u.test(line);
|
|
1030
|
+
}
|
|
1031
|
+
function is_github_tarball_line(line) {
|
|
1032
|
+
return line.trimStart().startsWith("tarball: https://npm.pkg.github.com/");
|
|
1033
|
+
}
|
|
1034
|
+
function clean_kit_line(line, version, integrities) {
|
|
1035
|
+
if (!version) return line;
|
|
1036
|
+
if (is_github_tarball_line(line)) return void 0;
|
|
1037
|
+
const cleaned = remove_flow_tarball(line);
|
|
1038
|
+
const pair = integrities.get(version);
|
|
1039
|
+
if (pair === void 0) return cleaned;
|
|
1040
|
+
return cleaned.split(`integrity: ${pair[0]}`).join(`integrity: ${pair[1]}`);
|
|
1041
|
+
}
|
|
1042
|
+
function next_kit_version(line, version) {
|
|
1043
|
+
if (!is_package_entry(line)) return version;
|
|
1044
|
+
const prefix = " '@joshuafolkken/kit@";
|
|
1045
|
+
return line.startsWith(prefix) ? line.slice(prefix.length).split("'", 1)[0] ?? "" : "";
|
|
1046
|
+
}
|
|
1047
|
+
function integrity_pair(old_integrity, npm_integrity) {
|
|
1048
|
+
if (old_integrity === void 0 || npm_integrity === void 0) return void 0;
|
|
1049
|
+
return [old_integrity, npm_integrity];
|
|
1050
|
+
}
|
|
1051
|
+
function lock_integrities(lockfile, npm_integrities) {
|
|
1052
|
+
const packages = fix_gh_packages_logic.parse_lockfile_packages(lockfile);
|
|
1053
|
+
const pairs = /* @__PURE__ */ new Map();
|
|
1054
|
+
const kit_entries = Object.entries(packages).filter(([key]) => key.startsWith(`${SCOPE}/kit@`));
|
|
1055
|
+
for (const [key, entry] of kit_entries) {
|
|
1056
|
+
const version = fix_gh_packages_logic.package_version_from_key(key);
|
|
1057
|
+
const pair = integrity_pair(entry.resolution?.integrity, npm_integrities.get(version));
|
|
1058
|
+
if (pair !== void 0) pairs.set(version, pair);
|
|
1059
|
+
}
|
|
1060
|
+
return pairs;
|
|
1061
|
+
}
|
|
1062
|
+
function push_if_defined(lines, cleaned) {
|
|
1063
|
+
if (cleaned !== void 0) lines.push(cleaned);
|
|
1064
|
+
}
|
|
1065
|
+
function rewrite_kit_lockfile(lockfile, npm_integrities) {
|
|
1066
|
+
let kit_version = "";
|
|
1067
|
+
const lines = [];
|
|
1068
|
+
const integrities = lock_integrities(lockfile, npm_integrities);
|
|
1069
|
+
for (const line of lockfile.split("\n")) {
|
|
1070
|
+
kit_version = next_kit_version(line, kit_version);
|
|
1071
|
+
const cleaned = clean_kit_line(line, kit_version, integrities);
|
|
1072
|
+
push_if_defined(lines, cleaned);
|
|
1073
|
+
}
|
|
1074
|
+
return lines.join("\n");
|
|
1075
|
+
}
|
|
1076
|
+
function append_mapping(content, eol) {
|
|
1077
|
+
const separator = content && !content.endsWith("\n") ? eol : "";
|
|
1078
|
+
return `${content}${separator}${MAPPING}${eol}`;
|
|
1079
|
+
}
|
|
1080
|
+
function replace_mapping(content) {
|
|
1081
|
+
const lines = mapping_lines(content);
|
|
1082
|
+
const eol = content.includes("\r\n") ? "\r\n" : "\n";
|
|
1083
|
+
if (lines.length === 0) return append_mapping(content, eol);
|
|
1084
|
+
return content.split(/\r?\n/u).map((line) => line === lines[0] ? MAPPING : line).join(eol);
|
|
1085
|
+
}
|
|
1086
|
+
function unsupported_registry(project_npmrc) {
|
|
1087
|
+
const registry = registry_of(project_npmrc);
|
|
1088
|
+
if (registry === void 0 || [GITHUB_REGISTRY, PUBLIC_REGISTRY].includes(registry)) {
|
|
1089
|
+
return void 0;
|
|
1090
|
+
}
|
|
1091
|
+
return `unsupported project registry: ${registry}`;
|
|
1092
|
+
}
|
|
1093
|
+
function has_duplicate_mapping(project_npmrc, user_npmrc) {
|
|
1094
|
+
return mapping_lines(project_npmrc).length > 1 || mapping_lines(user_npmrc).length > 1;
|
|
1095
|
+
}
|
|
1096
|
+
function previous_registry(project_npmrc, user_npmrc) {
|
|
1097
|
+
return registry_of(project_npmrc) ?? registry_of(user_npmrc) ?? "default npm";
|
|
1098
|
+
}
|
|
1099
|
+
function plan(project_npmrc, user_npmrc, lockfile) {
|
|
1100
|
+
const packages = scoped_packages(lockfile);
|
|
1101
|
+
const blocked = packages.filter((name) => name !== `${SCOPE}/kit`);
|
|
1102
|
+
if (has_duplicate_mapping(project_npmrc, user_npmrc)) blocked.push("duplicate registry mappings");
|
|
1103
|
+
const unsupported = unsupported_registry(project_npmrc);
|
|
1104
|
+
if (unsupported !== void 0) blocked.push(unsupported);
|
|
1105
|
+
const before = previous_registry(project_npmrc, user_npmrc);
|
|
1106
|
+
const change = `${before} \u2192 ${PUBLIC_REGISTRY}`;
|
|
1107
|
+
return { content: replace_mapping(project_npmrc), packages, blocked, change };
|
|
1108
|
+
}
|
|
1109
|
+
var migrate_logic = {
|
|
1110
|
+
plan,
|
|
1111
|
+
github_tarballs,
|
|
1112
|
+
is_github_tarball,
|
|
1113
|
+
rewrite_kit_lockfile,
|
|
1114
|
+
registry_of,
|
|
1115
|
+
scoped_packages,
|
|
1116
|
+
scoped_versions
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
// scripts/version/npm-registry.ts
|
|
780
1120
|
import { execaSync as execaSync2 } from "execa";
|
|
781
|
-
|
|
1121
|
+
import { z as z5 } from "zod";
|
|
1122
|
+
var PUBLIC_REGISTRY2 = "https://registry.npmjs.org";
|
|
1123
|
+
var ABBREVIATED_ACCEPT = "application/vnd.npm.install-v1+json";
|
|
1124
|
+
var FULL_ACCEPT = "application/json";
|
|
1125
|
+
var REQUEST_TIMEOUT_MS = 1e4;
|
|
1126
|
+
var SCOPE_SEPARATOR = "/";
|
|
1127
|
+
var ENCODED_SCOPE_SEPARATOR = "%2f";
|
|
1128
|
+
var SCOPE_PATTERN = /^@[^/]+(?=\/)/u;
|
|
1129
|
+
var SCOPE_REGISTRY_SUFFIX = ":registry";
|
|
1130
|
+
var github_scopes = /* @__PURE__ */ new Map();
|
|
1131
|
+
var FETCH_SCRIPT = [
|
|
1132
|
+
"const [url, accept] = process.argv.slice(1)",
|
|
1133
|
+
"const response = await fetch(url, { headers: { accept } })",
|
|
1134
|
+
"if (!response.ok) process.exit(1)",
|
|
1135
|
+
"process.stdout.write(await response.text())"
|
|
1136
|
+
].join("\n");
|
|
1137
|
+
var latest_schema = z5.looseObject({ "dist-tags": z5.looseObject({ latest: z5.string() }) });
|
|
1138
|
+
var times_schema = z5.looseObject({ time: release_age.release_times_schema });
|
|
1139
|
+
function packument_url(package_name) {
|
|
1140
|
+
return `${PUBLIC_REGISTRY2}/${package_name.replace(SCOPE_SEPARATOR, () => ENCODED_SCOPE_SEPARATOR)}`;
|
|
1141
|
+
}
|
|
1142
|
+
function read_packument(package_name, accept) {
|
|
1143
|
+
const result = execaSync2(
|
|
1144
|
+
process.execPath,
|
|
1145
|
+
["--input-type=module", "-e", FETCH_SCRIPT, packument_url(package_name), accept],
|
|
1146
|
+
{ reject: false, timeout: REQUEST_TIMEOUT_MS }
|
|
1147
|
+
);
|
|
1148
|
+
if (result.exitCode !== 0) return void 0;
|
|
1149
|
+
return safe_json_parse(result.stdout);
|
|
1150
|
+
}
|
|
1151
|
+
function is_github_scope(scope) {
|
|
1152
|
+
const is_cached_github = github_scopes.get(scope);
|
|
1153
|
+
if (is_cached_github !== void 0) return is_cached_github;
|
|
1154
|
+
const result = execaSync2("pnpm", ["config", "get", `${scope}${SCOPE_REGISTRY_SUFFIX}`], {
|
|
1155
|
+
reject: false,
|
|
1156
|
+
timeout: REQUEST_TIMEOUT_MS
|
|
1157
|
+
});
|
|
1158
|
+
const is_github = result.exitCode === 0 && migrate_logic.is_github_tarball(result.stdout.trim());
|
|
1159
|
+
github_scopes.set(scope, is_github);
|
|
1160
|
+
return is_github;
|
|
1161
|
+
}
|
|
1162
|
+
function is_public_source(package_name) {
|
|
1163
|
+
const scope = SCOPE_PATTERN.exec(package_name)?.[0];
|
|
1164
|
+
return scope === void 0 || !is_github_scope(scope);
|
|
1165
|
+
}
|
|
1166
|
+
function read_latest(package_name) {
|
|
1167
|
+
if (!is_public_source(package_name)) return void 0;
|
|
1168
|
+
const parsed = latest_schema.safeParse(read_packument(package_name, ABBREVIATED_ACCEPT));
|
|
1169
|
+
return parsed.success ? parsed.data["dist-tags"].latest : void 0;
|
|
1170
|
+
}
|
|
1171
|
+
function read_release_times(package_name) {
|
|
1172
|
+
if (!is_public_source(package_name)) return void 0;
|
|
1173
|
+
const parsed = times_schema.safeParse(read_packument(package_name, FULL_ACCEPT));
|
|
1174
|
+
return parsed.success ? parsed.data.time : void 0;
|
|
1175
|
+
}
|
|
1176
|
+
var npm_registry = { packument_url, read_latest, read_release_times };
|
|
1177
|
+
|
|
1178
|
+
// scripts/version/version-remote.ts
|
|
782
1179
|
var TIMES_PAGE_SIZE = 100;
|
|
783
1180
|
var TIMES_JQ = "[.[] | {(.name): .created_at}] | add";
|
|
784
1181
|
function require_endpoint(versions_endpoint, package_name) {
|
|
@@ -787,21 +1184,21 @@ function require_endpoint(versions_endpoint, package_name) {
|
|
|
787
1184
|
`Could not derive a versions endpoint for ${package_name}; check its version-command config.`
|
|
788
1185
|
);
|
|
789
1186
|
}
|
|
790
|
-
function describe_failure(result) {
|
|
791
|
-
const stderr = result.stderr.trim();
|
|
792
|
-
if (stderr !== "") return stderr;
|
|
793
|
-
return result.shortMessage ?? GH_FAILURE_FALLBACK;
|
|
794
|
-
}
|
|
795
1187
|
function fetch_latest_version(versions_endpoint, package_name) {
|
|
796
1188
|
const endpoint = require_endpoint(versions_endpoint, package_name);
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
1189
|
+
const public_latest = npm_registry.read_latest(package_name);
|
|
1190
|
+
if (public_latest !== void 0) return public_latest;
|
|
1191
|
+
try {
|
|
1192
|
+
return git_gh_exec.exec_gh_api_sync({ path: endpoint, jq_filter: ".[0].name" }).trim();
|
|
1193
|
+
} catch (error) {
|
|
1194
|
+
const detail = error_text.message_of(error);
|
|
1195
|
+
throw new Error(
|
|
1196
|
+
`Failed to fetch latest version for ${package_name} via ${endpoint}: ${detail}`,
|
|
1197
|
+
{
|
|
1198
|
+
cause: error
|
|
1199
|
+
}
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
805
1202
|
}
|
|
806
1203
|
function with_page_size(endpoint, page_size) {
|
|
807
1204
|
const separator = endpoint.indexOf("?");
|
|
@@ -810,21 +1207,48 @@ function with_page_size(endpoint, page_size) {
|
|
|
810
1207
|
query.set("per_page", String(page_size));
|
|
811
1208
|
return `${path_part}?${query.toString()}`;
|
|
812
1209
|
}
|
|
813
|
-
function
|
|
814
|
-
if (versions_endpoint === void 0 || versions_endpoint.trim() === "") return void 0;
|
|
1210
|
+
function read_github_release_times(versions_endpoint) {
|
|
815
1211
|
const endpoint = with_page_size(versions_endpoint, TIMES_PAGE_SIZE);
|
|
816
|
-
const
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
});
|
|
820
|
-
if (result.exitCode !== 0) return void 0;
|
|
821
|
-
const parsed = release_age.release_times_schema.safeParse(safe_json_parse(result.stdout));
|
|
1212
|
+
const stdout = git_gh_exec.read_gh_api_sync({ path: endpoint, jq_filter: TIMES_JQ });
|
|
1213
|
+
if (stdout === void 0) return void 0;
|
|
1214
|
+
const parsed = release_age.release_times_schema.safeParse(safe_json_parse(stdout));
|
|
822
1215
|
return parsed.success ? parsed.data : void 0;
|
|
823
1216
|
}
|
|
1217
|
+
function fetch_release_times(versions_endpoint, package_name) {
|
|
1218
|
+
if (versions_endpoint === void 0 || versions_endpoint.trim() === "") return void 0;
|
|
1219
|
+
return npm_registry.read_release_times(package_name) ?? read_github_release_times(versions_endpoint);
|
|
1220
|
+
}
|
|
824
1221
|
|
|
825
1222
|
// scripts/version/version-targets.ts
|
|
826
|
-
import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
|
|
827
1223
|
import path4 from "node:path";
|
|
1224
|
+
|
|
1225
|
+
// scripts/lib/read-file.ts
|
|
1226
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
1227
|
+
var ABSENT_CODE = "ENOENT";
|
|
1228
|
+
function is_absent(error) {
|
|
1229
|
+
return error instanceof Error && "code" in error && error.code === ABSENT_CODE;
|
|
1230
|
+
}
|
|
1231
|
+
function read_optional(path5) {
|
|
1232
|
+
try {
|
|
1233
|
+
return readFileSync4(path5, "utf8");
|
|
1234
|
+
} catch (error) {
|
|
1235
|
+
if (is_absent(error)) return void 0;
|
|
1236
|
+
throw error;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
function read_file_or_empty(path5) {
|
|
1240
|
+
return read_optional(path5) ?? "";
|
|
1241
|
+
}
|
|
1242
|
+
function read_if_readable(path5) {
|
|
1243
|
+
try {
|
|
1244
|
+
return readFileSync4(path5, "utf8");
|
|
1245
|
+
} catch {
|
|
1246
|
+
return void 0;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
var file_reader = { read_optional, read_file_or_empty, read_if_readable };
|
|
1250
|
+
|
|
1251
|
+
// scripts/version/version-targets.ts
|
|
828
1252
|
import { execaSync as execaSync3 } from "execa";
|
|
829
1253
|
var NODE_MODULES2 = "node_modules";
|
|
830
1254
|
var PACKAGE_JSON3 = "package.json";
|
|
@@ -850,12 +1274,12 @@ function project_package_path(cwd, package_name) {
|
|
|
850
1274
|
}
|
|
851
1275
|
function read_project_version(cwd, package_name) {
|
|
852
1276
|
const package_path = project_package_path(cwd, package_name);
|
|
853
|
-
const raw =
|
|
1277
|
+
const raw = file_reader.read_optional(package_path);
|
|
854
1278
|
return parse_project_version(raw);
|
|
855
1279
|
}
|
|
856
1280
|
function read_workspace_version(cwd) {
|
|
857
1281
|
const package_path = path4.join(cwd, PACKAGE_JSON3);
|
|
858
|
-
const raw =
|
|
1282
|
+
const raw = file_reader.read_optional(package_path);
|
|
859
1283
|
return parse_project_version(raw);
|
|
860
1284
|
}
|
|
861
1285
|
var version_targets = {
|
|
@@ -876,12 +1300,12 @@ var version_targets = {
|
|
|
876
1300
|
var FAILURE_EXIT_CODE = 1;
|
|
877
1301
|
var ALREADY_UP_TO_DATE = "Already up to date";
|
|
878
1302
|
var NO_QUARANTINE_MINUTES2 = 0;
|
|
879
|
-
function read_release_hold(
|
|
1303
|
+
function read_release_hold(package_config, latest, versions) {
|
|
880
1304
|
if (versions.every((version) => version === void 0 || version === latest)) return void 0;
|
|
881
1305
|
const minimum_age_minutes = release_age.read_nearest_minimum_release_age(process.cwd());
|
|
882
1306
|
if (minimum_age_minutes <= NO_QUARANTINE_MINUTES2) return void 0;
|
|
883
1307
|
const installable = release_hold.resolve_installable(
|
|
884
|
-
fetch_release_times(versions_endpoint),
|
|
1308
|
+
fetch_release_times(package_config.versions_endpoint, package_config.package_name),
|
|
885
1309
|
latest,
|
|
886
1310
|
minimum_age_minutes,
|
|
887
1311
|
Date.now()
|
|
@@ -938,7 +1362,7 @@ function read_upstream_report(upstream, config, snapshot, is_hold_wanted) {
|
|
|
938
1362
|
const project_version = version_targets.read_project_version(process.cwd(), upstream.package_name);
|
|
939
1363
|
const report = { config: upstream, project_version, latest };
|
|
940
1364
|
attach_upstream_effective(report, config, snapshot, upstream);
|
|
941
|
-
const hold = is_hold_wanted ? read_release_hold(upstream
|
|
1365
|
+
const hold = is_hold_wanted ? read_release_hold(upstream, latest, [report.effective?.version]) : void 0;
|
|
942
1366
|
if (hold !== void 0) report.hold = hold;
|
|
943
1367
|
return report;
|
|
944
1368
|
}
|
package/eslint/base.js
CHANGED
|
@@ -29,13 +29,10 @@ import {
|
|
|
29
29
|
import { typescript_rules } from './rules/typescript.js'
|
|
30
30
|
import { unicorn_rules } from './rules/unicorn.js'
|
|
31
31
|
|
|
32
|
-
const SCRIPTS_AI_PATTERNS = ['scripts-ai/**/*.ts', 'scripts-ai/**/*.js']
|
|
33
|
-
|
|
34
32
|
const FILE_PATTERNS = {
|
|
35
33
|
d_ts: ['**/*.d.ts'],
|
|
36
34
|
typescript: ['**/*.ts', '**/*.tsx'],
|
|
37
|
-
|
|
38
|
-
scripts: ['scripts/**/*.ts', 'scripts/**/*.js', ...SCRIPTS_AI_PATTERNS],
|
|
35
|
+
scripts: ['scripts/**/*.ts', 'scripts/**/*.js'],
|
|
39
36
|
// joshuafolkken/kit#1414: `**/*.spec.ts` is deliberately absent. The same config bans that name
|
|
40
37
|
// outright, so handing it the test relaxation (`max-lines-per-function` 35 and the rest) is the
|
|
41
38
|
// config contradicting itself, and it is what makes `*.spec.ts` read as supported. A banned file
|
|
@@ -160,7 +157,7 @@ export function create_base_config({ gitignore_path, tsconfig_root_dir }) {
|
|
|
160
157
|
files: FILE_PATTERNS.scripts,
|
|
161
158
|
rules: {
|
|
162
159
|
'unicorn/no-process-exit': 'off',
|
|
163
|
-
// scripts under scripts/
|
|
160
|
+
// scripts under scripts/ are dual-purpose: shebang-executable
|
|
164
161
|
// (run via tsx) AND importable namespace modules (consumed via #scripts/* and
|
|
165
162
|
// in tests). unicorn/no-exports-in-scripts flags exports in any shebang file,
|
|
166
163
|
// which conflicts with the kit export { module } convention, so disable it here.
|
|
@@ -173,12 +170,6 @@ export function create_base_config({ gitignore_path, tsconfig_root_dir }) {
|
|
|
173
170
|
'@typescript-eslint/unbound-method': 'off',
|
|
174
171
|
},
|
|
175
172
|
},
|
|
176
|
-
{
|
|
177
|
-
files: FILE_PATTERNS.scripts_ai,
|
|
178
|
-
rules: {
|
|
179
|
-
'@typescript-eslint/no-restricted-imports': 'off',
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
173
|
{
|
|
183
174
|
files: FILE_PATTERNS.tests,
|
|
184
175
|
rules: {
|