@mmerterden/multi-agent-pipeline 20.33.0 → 20.35.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/CHANGELOG.md +98 -1
- package/README.md +3 -1
- package/README.tr.md +2 -1
- package/docs/adr/0018-cross-repo-links-not-a-global-graph.md +43 -0
- package/docs/adr/README.md +2 -1
- package/docs/facts.json +5 -4
- package/docs/features.md +1 -1
- package/install/_dev-only-files.mjs +1 -0
- package/install/catalog-history.json +1 -1
- package/install/claude.mjs +24 -2
- package/install/templates/claude-hooks.json +34 -1
- package/manifest.json +393 -339
- package/package.json +3 -1
- package/pipeline/agents/bulk-reader.md +3 -0
- package/pipeline/agents/code-reviewer.md +9 -0
- package/pipeline/agents/explorer.md +4 -0
- package/pipeline/agents/plan-critic.md +4 -2
- package/pipeline/commands/multi-agent/SKILL.md +17 -136
- package/pipeline/commands/multi-agent/channels/SKILL.md +16 -298
- package/pipeline/commands/multi-agent/graph/SKILL.md +5 -2
- package/pipeline/commands/multi-agent/language/SKILL.md +3 -3
- package/pipeline/commands/multi-agent/office-on/SKILL.md +7 -3
- package/pipeline/commands/multi-agent/office-status/SKILL.md +3 -2
- package/pipeline/commands/multi-agent/resume/SKILL.md +8 -22
- package/pipeline/commands/multi-agent/review/SKILL.md +7 -131
- package/pipeline/commands/multi-agent/setup/SKILL.md +19 -224
- package/pipeline/contract/CHANGELOG.md +9 -0
- package/pipeline/contract/README.md +6 -2
- package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
- package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
- package/pipeline/contract/fixtures/error-unsigned.json +1 -1
- package/pipeline/contract/manifest.json +14 -1
- package/pipeline/contract/types/index.d.ts +24 -2
- package/pipeline/lib/json-file-lock.mjs +61 -15
- package/pipeline/lib/office-remote.mjs +228 -0
- package/pipeline/lib/qr-code.mjs +360 -0
- package/pipeline/lib/repo-hygiene.sh +1 -0
- package/pipeline/lib/run-completion.mjs +17 -0
- package/pipeline/multi-agent-refs/channels/generator.md +146 -0
- package/pipeline/multi-agent-refs/channels/issue-comment.md +1 -1
- package/pipeline/multi-agent-refs/channels/menu.md +55 -0
- package/pipeline/multi-agent-refs/channels/multi-repo.md +6 -0
- package/pipeline/multi-agent-refs/channels/preview.md +25 -0
- package/pipeline/multi-agent-refs/channels/reference.md +98 -0
- package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +1 -1
- package/pipeline/multi-agent-refs/features/code-graph.md +27 -0
- package/pipeline/multi-agent-refs/features/office-remote-protocol.md +166 -0
- package/pipeline/multi-agent-refs/features/office-threat-model.md +2 -2
- package/pipeline/multi-agent-refs/features/plan-critic.md +5 -2
- package/pipeline/multi-agent-refs/features/review-delta.md +4 -1
- package/pipeline/multi-agent-refs/features/scope-check.md +25 -1
- package/pipeline/multi-agent-refs/features/verify-by-test.md +10 -0
- package/pipeline/multi-agent-refs/keychain.md +7 -0
- package/pipeline/multi-agent-refs/knowledge.md +9 -0
- package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +163 -0
- package/pipeline/multi-agent-refs/phases/phase-0-init.md +6 -2
- package/pipeline/multi-agent-refs/phases/phase-1-plan.md +8 -10
- package/pipeline/multi-agent-refs/phases/phase-2-dev.md +18 -20
- package/pipeline/multi-agent-refs/phases/phase-3-review.md +20 -14
- package/pipeline/multi-agent-refs/phases/phase-4-commit.md +8 -7
- package/pipeline/multi-agent-refs/phases/phase-5-report.md +6 -3
- package/pipeline/multi-agent-refs/picker-contract.md +1 -1
- package/pipeline/multi-agent-refs/resume/details.md +35 -0
- package/pipeline/multi-agent-refs/review/inputs.md +87 -0
- package/pipeline/multi-agent-refs/review/module-guides.md +25 -0
- package/pipeline/multi-agent-refs/review/valven.md +42 -0
- package/pipeline/multi-agent-refs/rules.md +3 -2
- package/pipeline/multi-agent-refs/setup/accounts.md +27 -0
- package/pipeline/multi-agent-refs/setup/app-store-connect.md +5 -0
- package/pipeline/multi-agent-refs/setup/firebase.md +5 -0
- package/pipeline/multi-agent-refs/setup/google-play.md +4 -0
- package/pipeline/multi-agent-refs/setup/hooks-and-plugins.md +21 -0
- package/pipeline/multi-agent-refs/setup/language.md +46 -0
- package/pipeline/multi-agent-refs/setup/multi-repo-group.md +51 -0
- package/pipeline/multi-agent-refs/setup/summaries.md +63 -0
- package/pipeline/multi-agent-refs/setup/token-save-flow.md +51 -0
- package/pipeline/multi-agent-refs/tracker-contract.md +1 -1
- package/pipeline/office/NOTICE.md +4 -1
- package/pipeline/office/assets/char_12.png +0 -0
- package/pipeline/office/assets/char_13.png +0 -0
- package/pipeline/office/assets/char_14.png +0 -0
- package/pipeline/office/assets/char_15.png +0 -0
- package/pipeline/office/assets/char_16.png +0 -0
- package/pipeline/office/assets/char_17.png +0 -0
- package/pipeline/office/assets/char_18.png +0 -0
- package/pipeline/office/assets/char_19.png +0 -0
- package/pipeline/office/assets/char_20.png +0 -0
- package/pipeline/office/assets/char_21.png +0 -0
- package/pipeline/office/assets/char_22.png +0 -0
- package/pipeline/office/assets/char_23.png +0 -0
- package/pipeline/office/assets/char_24.png +0 -0
- package/pipeline/office/assets/char_25.png +0 -0
- package/pipeline/office/assets/char_26.png +0 -0
- package/pipeline/office/assets/char_27.png +0 -0
- package/pipeline/office/assets/char_28.png +0 -0
- package/pipeline/office/assets/char_29.png +0 -0
- package/pipeline/office/assets/char_30.png +0 -0
- package/pipeline/office/index.html +304 -55
- package/pipeline/office/toolkit.json +1 -1
- package/pipeline/rules/response-shape.md +6 -7
- package/pipeline/schemas/agent-state.schema.json +36 -0
- package/pipeline/schemas/phases.json +4 -4
- package/pipeline/schemas/plan-critique.schema.json +9 -2
- package/pipeline/schemas/planning-output.schema.json +43 -2
- package/pipeline/schemas/pr-reach.schema.json +55 -0
- package/pipeline/schemas/prefs.schema.json +37 -8
- package/pipeline/schemas/reviewer-output.schema.json +20 -2
- package/pipeline/schemas/token-budget.json +4 -4
- package/pipeline/schemas/triage-output.schema.json +32 -3
- package/pipeline/schemas/unattended-policy.json +2 -1
- package/pipeline/scripts/_graph-analysis.mjs +270 -0
- package/pipeline/scripts/_guard_rules.py +449 -1
- package/pipeline/scripts/_memory-policy.mjs +165 -0
- package/pipeline/scripts/_secret-scan.mjs +105 -0
- package/pipeline/scripts/_test-gaming.mjs +36 -0
- package/pipeline/scripts/_unified-diff.mjs +2 -2
- package/pipeline/scripts/agent-guard.py +79 -19
- package/pipeline/scripts/anonymize-findings.mjs +99 -0
- package/pipeline/scripts/answer-check.mjs +113 -0
- package/pipeline/scripts/answer-check.sh +20 -0
- package/pipeline/scripts/autopilot-publish.mjs +9 -2
- package/pipeline/scripts/capture-flush.sh +12 -2
- package/pipeline/scripts/check-read-size.sh +9 -0
- package/pipeline/scripts/code-graph-rules/android.json +8 -3
- package/pipeline/scripts/contract-server.mjs +71 -16
- package/pipeline/scripts/debt-ledger.mjs +323 -0
- package/pipeline/scripts/file-context.mjs +261 -0
- package/pipeline/scripts/file-context.sh +20 -0
- package/pipeline/scripts/gate-ledger.mjs +144 -21
- package/pipeline/scripts/graph-links.mjs +230 -0
- package/pipeline/scripts/graph-query.mjs +133 -1
- package/pipeline/scripts/graph-report.mjs +65 -0
- package/pipeline/scripts/learn-from-transcripts.mjs +12 -48
- package/pipeline/scripts/learnings-ledger.mjs +143 -24
- package/pipeline/scripts/office-build.mjs +276 -5
- package/pipeline/scripts/office-control.mjs +70 -10
- package/pipeline/scripts/office-pair.mjs +407 -0
- package/pipeline/scripts/office-remote-client.mjs +463 -0
- package/pipeline/scripts/phase-tracker.sh +8 -0
- package/pipeline/scripts/phase0-exit-gate.mjs +40 -37
- package/pipeline/scripts/phone-devices.mjs +9 -1
- package/pipeline/scripts/plan-critique-gate.mjs +11 -2
- package/pipeline/scripts/pre-commit-check.sh +28 -2
- package/pipeline/scripts/pre-push-check.sh +6 -12
- package/pipeline/scripts/rework-base.mjs +87 -0
- package/pipeline/scripts/rework-rulings.mjs +106 -0
- package/pipeline/scripts/run-commit-check.mjs +104 -0
- package/pipeline/scripts/run-scope-guard.mjs +58 -3
- package/pipeline/scripts/run-scope-guard.sh +13 -1
- package/pipeline/scripts/scope-check-gate.mjs +213 -2
- package/pipeline/scripts/task-mirror.mjs +106 -15
- package/pipeline/scripts/task-mirror.sh +3 -2
- package/pipeline/scripts/test-stability-gate.mjs +112 -0
- package/pipeline/scripts/triage-memory.mjs +64 -37
- package/pipeline/scripts/update-check.sh +7 -1
- package/pipeline/scripts/update-issue-progress.sh +73 -8
- package/pipeline/scripts/validate-planning.mjs +172 -4
- package/pipeline/scripts/validate-reviewer.mjs +20 -0
- package/pipeline/scripts/validate-triage.mjs +149 -4
- package/pipeline/scripts/work-items.mjs +119 -1
- package/pipeline/scripts/worktree-prepare-all.mjs +200 -0
- package/pipeline/scripts/worktree-prepare.sh +40 -4
- package/pipeline/scripts/write-state.mjs +67 -24
- package/pipeline/skills/.skill-manifest.json +9 -9
- package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +5 -5
- package/pipeline/skills/shared/core/google-play-compliance/references/rules.yml +1 -1
- package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +5 -2
- package/pipeline/skills/shared/core/multi-agent-language/SKILL.md +4 -4
- package/pipeline/skills/shared/core/multi-agent-office-status/SKILL.md +2 -2
- package/pipeline/skills/shared/core/multi-agent-review/SKILL.md +2 -0
- package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +4 -4
- package/pipeline/skills/shared/external/alarmkit/references/alarmkit-patterns.md +14 -0
- package/pipeline/skills/shared/external/android-architecture/references/patterns.md +6 -0
- package/pipeline/skills/shared/external/android-build-quality-gates/references/patterns.md +10 -0
- package/pipeline/skills/shared/external/android-datastore/references/patterns.md +11 -0
- package/pipeline/skills/shared/external/android-design-tokens-codegen/references/patterns.md +8 -0
- package/pipeline/skills/shared/external/android-jetpack-compose-expert/references/patterns.md +6 -0
- package/pipeline/skills/shared/external/android-mvi-viewmodel/references/patterns.md +10 -0
- package/pipeline/skills/shared/external/android-performance/references/patterns.md +13 -0
- package/pipeline/skills/shared/external/android-security/references/patterns.md +16 -0
- package/pipeline/skills/shared/external/api-patterns/references/contract-details.md +9 -0
- package/pipeline/skills/shared/external/api-security-best-practices/references/abuse-controls.md +12 -0
- package/pipeline/skills/shared/external/api-security-best-practices/references/identity-and-access.md +13 -0
- package/pipeline/skills/shared/external/api-security-best-practices/references/request-handling.md +12 -0
- package/pipeline/skills/shared/external/app-clips/references/data-handoff-notifications-location.md +9 -0
- package/pipeline/skills/shared/external/app-clips/references/routing-and-experiences.md +8 -0
- package/pipeline/skills/shared/external/app-clips/references/size-capabilities-and-promotion.md +10 -0
- package/pipeline/skills/shared/external/app-intents/references/appintents-advanced.md +21 -0
- package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +9 -0
- package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +7 -0
- package/pipeline/skills/shared/external/app-store-review/SKILL.md +2 -2
- package/pipeline/skills/shared/external/app-store-review/references/privacy-manifest.md +10 -0
- package/pipeline/skills/shared/external/app-store-review/references/review-checklists.md +10 -1
- package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-conversion.md +22 -0
- package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-optimization.md +17 -0
- package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models.md +22 -0
- package/pipeline/skills/shared/external/apple-on-device-ai/references/mlx-swift.md +17 -0
- package/pipeline/skills/shared/external/authentication/references/keychain-biometric.md +9 -0
- package/pipeline/skills/shared/external/authentication/references/passkeys.md +11 -0
- package/pipeline/skills/shared/external/avkit/references/avkit-patterns.md +13 -0
- package/pipeline/skills/shared/external/background-processing/references/background-task-patterns.md +9 -0
- package/pipeline/skills/shared/external/callkit-voip/references/callkit-patterns.md +10 -0
- package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-patterns.md +15 -0
- package/pipeline/skills/shared/external/compose-components/references/patterns.md +7 -0
- package/pipeline/skills/shared/external/compose-navigation/references/patterns.md +7 -0
- package/pipeline/skills/shared/external/compose-testing/references/patterns.md +15 -0
- package/pipeline/skills/shared/external/contacts-framework/references/contacts-patterns.md +9 -0
- package/pipeline/skills/shared/external/core-bluetooth/references/ble-patterns.md +11 -0
- package/pipeline/skills/shared/external/core-motion/references/motion-patterns.md +10 -0
- package/pipeline/skills/shared/external/core-nfc/references/nfc-patterns.md +13 -0
- package/pipeline/skills/shared/external/coreml/references/coreml-swift-integration.md +20 -0
- package/pipeline/skills/shared/external/cryptokit/references/cryptokit-patterns.md +16 -0
- package/pipeline/skills/shared/external/debugging-instruments/references/instruments-guide.md +16 -0
- package/pipeline/skills/shared/external/debugging-instruments/references/lldb-patterns.md +14 -0
- package/pipeline/skills/shared/external/device-integrity/references/device-integrity-patterns.md +13 -0
- package/pipeline/skills/shared/external/energykit/references/energykit-patterns.md +10 -0
- package/pipeline/skills/shared/external/eventkit-calendar/references/eventkit-patterns.md +10 -0
- package/pipeline/skills/shared/external/fastapi-pro/references/app-structure.md +10 -0
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/references/patterns.md +17 -0
- package/pipeline/skills/shared/external/healthkit/references/healthkit-patterns.md +12 -0
- package/pipeline/skills/shared/external/hig-app-icons/references/icon-workflow.md +10 -0
- package/pipeline/skills/shared/external/hig-components-content/references/content-views.md +10 -0
- package/pipeline/skills/shared/external/hig-components-layout/references/bars-and-tabs.md +11 -0
- package/pipeline/skills/shared/external/hig-foundations/references/foundations-detail.md +13 -0
- package/pipeline/skills/shared/external/hig-foundations/references/type-color-spacing.md +13 -0
- package/pipeline/skills/shared/external/hig-patterns/references/onboarding-and-states.md +11 -0
- package/pipeline/skills/shared/external/hig-platforms/references/ipad-layout.md +12 -0
- package/pipeline/skills/shared/external/hig-technologies/references/technologies.md +16 -0
- package/pipeline/skills/shared/external/homekit-matter/references/matter-commissioning.md +9 -0
- package/pipeline/skills/shared/external/ios-accessibility/references/a11y-patterns.md +18 -0
- package/pipeline/skills/shared/external/ios-accessibility/references/large-content-and-appearance.md +9 -0
- package/pipeline/skills/shared/external/ios-accessibility/references/media-accessibility.md +9 -0
- package/pipeline/skills/shared/external/ios-accessibility/references/nutrition-labels.md +7 -0
- package/pipeline/skills/shared/external/ios-coding-standard/references/STANDARD.md +13 -0
- package/pipeline/skills/shared/external/ios-design-review/references/appearance-matrix.md +9 -0
- package/pipeline/skills/shared/external/ios-design-review/references/checklist.md +15 -0
- package/pipeline/skills/shared/external/ios-haptics/references/core-haptics.md +11 -0
- package/pipeline/skills/shared/external/ios-iphone-duo/references/api-map.md +11 -0
- package/pipeline/skills/shared/external/ios-iphone-duo/references/fixed-assumptions.md +15 -0
- package/pipeline/skills/shared/external/ios-iphone-duo/references/poses-and-panes.md +11 -0
- package/pipeline/skills/shared/external/ios-localization/references/formatstyle-locale.md +18 -0
- package/pipeline/skills/shared/external/ios-localization/references/string-catalogs.md +19 -0
- package/pipeline/skills/shared/external/ios-networking/references/background-websocket.md +15 -0
- package/pipeline/skills/shared/external/ios-networking/references/file-storage-patterns.md +7 -0
- package/pipeline/skills/shared/external/ios-networking/references/lightweight-clients.md +8 -0
- package/pipeline/skills/shared/external/ios-networking/references/network-framework.md +12 -0
- package/pipeline/skills/shared/external/ios-networking/references/urlsession-patterns.md +17 -0
- package/pipeline/skills/shared/external/ios-security/references/app-review-guidelines.md +8 -0
- package/pipeline/skills/shared/external/ios-security/references/cryptokit-advanced.md +14 -0
- package/pipeline/skills/shared/external/ios-security/references/file-storage-patterns.md +8 -0
- package/pipeline/skills/shared/external/ios-security/references/privacy-manifest.md +9 -0
- package/pipeline/skills/shared/external/ios-sf-symbols/references/effects-and-custom-symbols.md +9 -0
- package/pipeline/skills/shared/external/ios-simulator/references/simctl-commands.md +13 -0
- package/pipeline/skills/shared/external/kotlin-coroutines-expert/references/patterns.md +8 -0
- package/pipeline/skills/shared/external/live-activities/references/activitykit-patterns.md +21 -0
- package/pipeline/skills/shared/external/localization-reuse-map/reference/format-and-output.md +9 -0
- package/pipeline/skills/shared/external/localization-reuse-map/reference/sources-and-recipes.md +12 -0
- package/pipeline/skills/shared/external/mapkit-location/references/mapkit-corelocation-patterns.md +16 -0
- package/pipeline/skills/shared/external/mapkit-location/references/mapkit-patterns.md +21 -0
- package/pipeline/skills/shared/external/metrickit-diagnostics/references/metrickit-patterns.md +10 -0
- package/pipeline/skills/shared/external/musickit-audio/references/musickit-patterns.md +9 -0
- package/pipeline/skills/shared/external/natural-language/references/translation-patterns.md +12 -0
- package/pipeline/skills/shared/external/nodejs-backend-patterns/references/runtime-patterns.md +11 -0
- package/pipeline/skills/shared/external/passkit-wallet/references/wallet-passes.md +11 -0
- package/pipeline/skills/shared/external/pdfkit/references/pdfkit-patterns.md +18 -0
- package/pipeline/skills/shared/external/pencilkit-drawing/references/pencilkit-patterns.md +11 -0
- package/pipeline/skills/shared/external/permissionkit/references/permissionkit-patterns.md +11 -0
- package/pipeline/skills/shared/external/photos-camera-media/references/av-playback.md +15 -0
- package/pipeline/skills/shared/external/photos-camera-media/references/camera-capture.md +14 -0
- package/pipeline/skills/shared/external/photos-camera-media/references/image-loading-caching.md +14 -0
- package/pipeline/skills/shared/external/photos-camera-media/references/photokit-patterns.md +14 -0
- package/pipeline/skills/shared/external/push-notifications/references/notification-patterns.md +14 -0
- package/pipeline/skills/shared/external/push-notifications/references/rich-notifications.md +10 -0
- package/pipeline/skills/shared/external/realitykit-ar/references/realitykit-patterns.md +12 -0
- package/pipeline/skills/shared/external/retrofit-networking/references/patterns.md +14 -0
- package/pipeline/skills/shared/external/room-database/references/patterns.md +16 -0
- package/pipeline/skills/shared/external/shareplay-activities/references/shareplay-patterns.md +10 -0
- package/pipeline/skills/shared/external/speech-recognition/references/speechanalyzer-patterns.md +10 -0
- package/pipeline/skills/shared/external/spm-build-analysis/references/build-optimization-sources.md +14 -0
- package/pipeline/skills/shared/external/spm-build-analysis/references/spm-analysis-checks.md +19 -0
- package/pipeline/skills/shared/external/storekit/references/core-patterns.md +13 -0
- package/pipeline/skills/shared/external/storekit/references/storekit-advanced.md +31 -0
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/argument-labels-and-parameters.md +8 -0
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/conventions-and-special-rules.md +9 -0
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/naming-and-clarity.md +10 -0
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/side-effects-and-mutating-pairs.md +8 -0
- package/pipeline/skills/shared/external/swift-charts/references/charts-patterns.md +24 -0
- package/pipeline/skills/shared/external/swift-concurrency/references/bridging-interop.md +8 -0
- package/pipeline/skills/shared/external/swift-concurrency/references/concurrency-patterns.md +14 -0
- package/pipeline/skills/shared/external/swift-concurrency/references/swiftui-concurrency.md +12 -0
- package/pipeline/skills/shared/external/swift-concurrency/references/synchronization-primitives.md +10 -0
- package/pipeline/skills/shared/external/swift-concurrency-expert/references/swift-6-2-concurrency.md +8 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/actors.md +10 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/cancellation.md +7 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/interop.md +10 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/new-features.md +11 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/structured.md +9 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/testing.md +13 -0
- package/pipeline/skills/shared/external/swift-language/references/swift-attributes-interop.md +7 -0
- package/pipeline/skills/shared/external/swift-language/references/swift-patterns-extended.md +14 -0
- package/pipeline/skills/shared/external/swift-security/references/biometric-authentication.md +16 -0
- package/pipeline/skills/shared/external/swift-security/references/certificate-trust.md +17 -0
- package/pipeline/skills/shared/external/swift-security/references/common-anti-patterns.md +19 -0
- package/pipeline/skills/shared/external/swift-security/references/compliance-owasp-mapping.md +16 -0
- package/pipeline/skills/shared/external/swift-security/references/credential-storage-patterns.md +19 -0
- package/pipeline/skills/shared/external/swift-security/references/cryptokit-public-key.md +18 -0
- package/pipeline/skills/shared/external/swift-security/references/cryptokit-symmetric.md +16 -0
- package/pipeline/skills/shared/external/swift-security/references/keychain-access-control.md +17 -0
- package/pipeline/skills/shared/external/swift-security/references/keychain-fundamentals.md +17 -0
- package/pipeline/skills/shared/external/swift-security/references/keychain-item-classes.md +17 -0
- package/pipeline/skills/shared/external/swift-security/references/keychain-sharing.md +18 -0
- package/pipeline/skills/shared/external/swift-security/references/migration-legacy-stores.md +21 -0
- package/pipeline/skills/shared/external/swift-security/references/secure-enclave.md +16 -0
- package/pipeline/skills/shared/external/swift-security/references/testing-security-code.md +16 -0
- package/pipeline/skills/shared/external/swift-testing/references/testing-advanced.md +9 -0
- package/pipeline/skills/shared/external/swift-testing/references/testing-patterns.md +24 -0
- package/pipeline/skills/shared/external/swift-testing-pro/references/async-tests.md +9 -0
- package/pipeline/skills/shared/external/swift-testing-pro/references/new-features.md +11 -0
- package/pipeline/skills/shared/external/swift-testing-pro/references/writing-better-tests.md +13 -0
- package/pipeline/skills/shared/external/swiftdata/references/core-data-coexistence.md +8 -0
- package/pipeline/skills/shared/external/swiftdata/references/swiftdata-advanced.md +17 -0
- package/pipeline/skills/shared/external/swiftdata/references/swiftdata-queries.md +12 -0
- package/pipeline/skills/shared/external/swiftlint/references/adoption-and-configuration.md +11 -0
- package/pipeline/skills/shared/external/swiftlint/references/custom-rules-and-analyze.md +7 -0
- package/pipeline/skills/shared/external/swiftlint/references/plugins-run-scripts-and-integrations.md +13 -0
- package/pipeline/skills/shared/external/swiftlint/references/rule-reference.md +24 -0
- package/pipeline/skills/shared/external/swiftlint/references/rules-suppressions-and-baselines.md +12 -0
- package/pipeline/skills/shared/external/swiftui-animation/references/animation-advanced.md +15 -0
- package/pipeline/skills/shared/external/swiftui-animation/references/core-animation-bridge.md +15 -0
- package/pipeline/skills/shared/external/swiftui-animation/references/scroll-effects.md +12 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/accessibility-patterns.md +11 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-advanced.md +7 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-basics.md +13 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-transitions.md +9 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts-accessibility.md +9 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts.md +17 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/image-optimization.md +9 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/latest-apis.md +10 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/layout-best-practices.md +12 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/list-patterns.md +12 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-scenes.md +13 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-views.md +12 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-window-styling.md +12 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/performance-patterns.md +7 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/scroll-patterns.md +9 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/sheet-navigation-patterns.md +10 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/state-management.md +18 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/view-structure.md +16 -0
- package/pipeline/skills/shared/external/swiftui-gestures/references/gesture-patterns.md +11 -0
- package/pipeline/skills/shared/external/swiftui-layout-components/references/form.md +8 -0
- package/pipeline/skills/shared/external/swiftui-layout-components/references/grids.md +14 -0
- package/pipeline/skills/shared/external/swiftui-layout-components/references/scrollview.md +9 -0
- package/pipeline/skills/shared/external/swiftui-liquid-glass/references/liquid-glass.md +22 -0
- package/pipeline/skills/shared/external/swiftui-liquid-glass/references/uikit-glass.md +14 -0
- package/pipeline/skills/shared/external/swiftui-navigation/references/deeplinks.md +10 -0
- package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +10 -0
- package/pipeline/skills/shared/external/swiftui-navigation/references/sheets.md +13 -0
- package/pipeline/skills/shared/external/swiftui-navigation/references/tabview.md +10 -0
- package/pipeline/skills/shared/external/swiftui-patterns/references/architecture-patterns.md +14 -0
- package/pipeline/skills/shared/external/swiftui-patterns/references/deprecated-migration.md +30 -0
- package/pipeline/skills/shared/external/swiftui-patterns/references/platform-and-sharing.md +16 -0
- package/pipeline/skills/shared/external/swiftui-performance/references/demystify-swiftui-performance-wwdc23.md +11 -0
- package/pipeline/skills/shared/external/swiftui-performance/references/optimizing-swiftui-performance-instruments.md +11 -0
- package/pipeline/skills/shared/external/swiftui-performance/references/understanding-hangs-in-your-app.md +10 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/code-smells.md +8 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/app-wiring.md +12 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/menu-bar.md +10 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/navigationstack.md +11 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scroll-reveal.md +12 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/sheets.md +14 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/tabview.md +10 -0
- package/pipeline/skills/shared/external/swiftui-uikit-interop/references/hosting-migration.md +10 -0
- package/pipeline/skills/shared/external/swiftui-uikit-interop/references/representable-recipes.md +13 -0
- package/pipeline/skills/shared/external/swiftui-view-refactor/references/mv-patterns.md +12 -0
- package/pipeline/skills/shared/external/swiftui-webkit/references/loading-and-observation.md +8 -0
- package/pipeline/skills/shared/external/swiftui-webkit/references/navigation-and-javascript.md +8 -0
- package/pipeline/skills/shared/external/tipkit/references/tipkit-patterns.md +14 -0
- package/pipeline/skills/shared/external/vision-framework/references/vision-requests.md +17 -0
- package/pipeline/skills/shared/external/vision-framework/references/visionkit-scanner.md +11 -0
- package/pipeline/skills/shared/external/weatherkit/references/weatherkit-patterns.md +11 -0
- package/pipeline/skills/shared/external/widgetkit/references/widgetkit-advanced.md +27 -0
- package/pipeline/skills/shared/external/xcode-build-fixer/references/build-settings-best-practices.md +9 -0
- package/pipeline/skills/shared/external/xcode-build-fixer/references/fix-patterns.md +7 -0
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/build-settings-best-practices.md +9 -0
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/build-optimization-sources.md +14 -0
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/code-compilation-checks.md +8 -0
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-optimization-sources.md +14 -0
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-settings-best-practices.md +9 -0
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/project-audit-checks.md +13 -0
|
@@ -38,10 +38,15 @@
|
|
|
38
38
|
"kind": "class",
|
|
39
39
|
"regex": "\\bclass\\s+([A-Z][A-Za-z0-9_]*)"
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
"id": "composable",
|
|
43
|
+
"kind": "composable",
|
|
44
|
+
"regex": "\\bfun\\s+(?:<[^>]*>\\s*)?(?:[A-Za-z_][A-Za-z0-9_.]*\\.)?([A-Z][A-Za-z0-9_]*)\\s*\\("
|
|
45
|
+
},
|
|
41
46
|
{
|
|
42
47
|
"id": "fun",
|
|
43
48
|
"kind": "fun",
|
|
44
|
-
"regex": "\\bfun\\s+(?:<[^>]*>\\s*)?([
|
|
49
|
+
"regex": "\\bfun\\s+(?:<[^>]*>\\s*)?(?:[A-Za-z_][A-Za-z0-9_.]*\\.)?([a-z_][A-Za-z0-9_]*)"
|
|
45
50
|
}
|
|
46
51
|
],
|
|
47
52
|
"importPatterns": [
|
|
@@ -50,9 +55,9 @@
|
|
|
50
55
|
"regex": "^\\s*import\\s+(?:static\\s+)?(?:[A-Za-z_][A-Za-z0-9_]*\\.)+([A-Z][A-Za-z0-9_]*)"
|
|
51
56
|
}
|
|
52
57
|
],
|
|
53
|
-
"referenceKinds": ["class", "interface", "object", "enum", "record", "typealias"],
|
|
58
|
+
"referenceKinds": ["class", "interface", "object", "enum", "record", "typealias", "composable"],
|
|
54
59
|
"supertypes": { "syntax": "colon", "kinds": ["class", "interface", "object", "enum"] },
|
|
55
|
-
"referenceKindsNote": "fun is deliberately absent, for the reason Swift's rules record for func: a bare lowercase name matched across files is almost never a call to that exact declaration, and on a large app the generic ones (invoke, build, create, get) take the top god-node slots purely because each happened to be declared once.
|
|
60
|
+
"referenceKindsNote": "fun is deliberately absent, for the reason Swift's rules record for func: a bare lowercase name matched across files is almost never a call to that exact declaration, and on a large app the generic ones (invoke, build, create, get) take the top god-node slots purely because each happened to be declared once. A capitalised fun is the exception and gets its own kind, composable: Kotlin names ordinary functions in lowerCamelCase, so a capitalised fun is in practice a Compose UI function (or a factory named after the type it builds), and it is called by that exact name the way a type is.",
|
|
56
61
|
"ignoredIdentifiers": [
|
|
57
62
|
"this",
|
|
58
63
|
"super",
|
|
@@ -305,7 +305,7 @@ import { runMain } from "../lib/fatal.mjs";
|
|
|
305
305
|
import { invokedDirectly } from "../lib/invoked-directly.mjs";
|
|
306
306
|
|
|
307
307
|
/** The contract as a whole; pipeline/contract/manifest.json carries the same. */
|
|
308
|
-
export const CONTRACT_VERSION = "1.
|
|
308
|
+
export const CONTRACT_VERSION = "1.7.0";
|
|
309
309
|
/** The majors `?v=` accepts. A new major keeps the previous one here for one minor. */
|
|
310
310
|
export const SUPPORTED_MAJORS = [1];
|
|
311
311
|
export const BIND_HOST = "127.0.0.1";
|
|
@@ -907,20 +907,35 @@ async function control(args) {
|
|
|
907
907
|
/**
|
|
908
908
|
* For a read whose answer is the same for every caller: a request that
|
|
909
909
|
* arrives while one runs gets that one's answer instead of starting another.
|
|
910
|
+
* With `limit`, at most `limit.max` distinct keys of `limit.group` run at
|
|
911
|
+
* once; one more is 429, like `oneAtATime`.
|
|
910
912
|
*/
|
|
911
913
|
const inFlight = new Map();
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
.
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
914
|
+
const groupRunning = new Map();
|
|
915
|
+
const shared =
|
|
916
|
+
(keyOf, fn, limit = null) =>
|
|
917
|
+
(ctx) => {
|
|
918
|
+
const key = keyOf(ctx);
|
|
919
|
+
if (!inFlight.has(key)) {
|
|
920
|
+
if (limit) {
|
|
921
|
+
const n = groupRunning.get(limit.group) ?? 0;
|
|
922
|
+
if (n >= limit.max) {
|
|
923
|
+
throw new HttpError(429, "busy", "too many of these are running; try again shortly");
|
|
924
|
+
}
|
|
925
|
+
groupRunning.set(limit.group, n + 1);
|
|
926
|
+
}
|
|
927
|
+
inFlight.set(
|
|
928
|
+
key,
|
|
929
|
+
Promise.resolve()
|
|
930
|
+
.then(() => fn(ctx))
|
|
931
|
+
.finally(() => {
|
|
932
|
+
inFlight.delete(key);
|
|
933
|
+
if (limit) groupRunning.set(limit.group, groupRunning.get(limit.group) - 1);
|
|
934
|
+
}),
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
return inFlight.get(key);
|
|
938
|
+
};
|
|
924
939
|
|
|
925
940
|
/** One request at a time per key; a second one while the first runs is 429. */
|
|
926
941
|
const running = new Set();
|
|
@@ -1513,6 +1528,33 @@ function evidenceRoute({ params }) {
|
|
|
1513
1528
|
}
|
|
1514
1529
|
}
|
|
1515
1530
|
|
|
1531
|
+
/**
|
|
1532
|
+
* GET /v1/prs/reach: work-items.mjs reach as a child process, because loading
|
|
1533
|
+
* a repository's graph is a synchronous parse of a file that can run to tens
|
|
1534
|
+
* of megabytes, and no other route may wait behind it.
|
|
1535
|
+
*/
|
|
1536
|
+
async function prReachRoute() {
|
|
1537
|
+
const r = await spawnAsync(process.execPath, [join(HERE, "work-items.mjs"), "reach"], {
|
|
1538
|
+
env: process.env,
|
|
1539
|
+
timeoutMs: 180_000,
|
|
1540
|
+
maxBytes: 2 * 1024 * 1024,
|
|
1541
|
+
});
|
|
1542
|
+
let doc;
|
|
1543
|
+
try {
|
|
1544
|
+
doc = JSON.parse(r.stdout);
|
|
1545
|
+
} catch {
|
|
1546
|
+
doc = null;
|
|
1547
|
+
}
|
|
1548
|
+
if (r.status !== 0 || !doc || !Array.isArray(doc.items)) {
|
|
1549
|
+
throw new HttpError(
|
|
1550
|
+
502,
|
|
1551
|
+
"upstream-failed",
|
|
1552
|
+
"the reach of the pull requests could not be measured",
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
return doc;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1516
1558
|
function workError(err) {
|
|
1517
1559
|
if (!(err instanceof WorkError)) return err;
|
|
1518
1560
|
if (err.code === "no-run" || err.code === "bad-key")
|
|
@@ -1790,7 +1832,7 @@ export const ROUTES = [
|
|
|
1790
1832
|
method: "GET",
|
|
1791
1833
|
path: "/v1/autopilot",
|
|
1792
1834
|
query: [],
|
|
1793
|
-
handle:
|
|
1835
|
+
handle: shared(() => "autopilot-status", autopilotGet),
|
|
1794
1836
|
},
|
|
1795
1837
|
{
|
|
1796
1838
|
method: "POST",
|
|
@@ -1870,13 +1912,26 @@ export const ROUTES = [
|
|
|
1870
1912
|
method: "GET",
|
|
1871
1913
|
path: "/v1/issues/{key}/maturity",
|
|
1872
1914
|
query: [],
|
|
1873
|
-
handle:
|
|
1915
|
+
handle: shared(({ params }) => `maturity:${params.key}`, maturityRoute, {
|
|
1916
|
+
group: "maturity",
|
|
1917
|
+
max: 2,
|
|
1918
|
+
}),
|
|
1874
1919
|
},
|
|
1875
1920
|
{
|
|
1876
1921
|
method: "GET",
|
|
1877
1922
|
path: "/v1/prs",
|
|
1878
1923
|
query: [],
|
|
1879
|
-
handle:
|
|
1924
|
+
handle: shared(
|
|
1925
|
+
({ redact }) => `prs:${redact ? 1 : 0}`,
|
|
1926
|
+
({ redact }) => pullRequests({ redact }),
|
|
1927
|
+
),
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
method: "GET",
|
|
1931
|
+
path: "/v1/prs/reach",
|
|
1932
|
+
query: [],
|
|
1933
|
+
remote: "local-only",
|
|
1934
|
+
handle: shared(() => "prs-reach", prReachRoute),
|
|
1880
1935
|
},
|
|
1881
1936
|
{ method: "GET", path: "/v1/tools", query: [], handle: toolsRoute },
|
|
1882
1937
|
{
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file debt-ledger.mjs - the known limits a repository carries, in one list.
|
|
4
|
+
*
|
|
5
|
+
* Three sources feed it, each a limit somebody accepted on purpose:
|
|
6
|
+
*
|
|
7
|
+
* shortcut a `shortcut: <limit>, <when to replace>` marker a diff adds
|
|
8
|
+
* (features/scope-check.md, "Known limits in the code")
|
|
9
|
+
* deferred a triage finding deferred as out of scope
|
|
10
|
+
* parked a finding parked by rework-rulings.mjs at the rework cap
|
|
11
|
+
*
|
|
12
|
+
* Storage: $HOME/.claude/memory/multi-agent/<repo-slug>/debt.jsonl, append-only,
|
|
13
|
+
* one row per item; the same item from the same task is written once. Every
|
|
14
|
+
* row passes the secret scan before it is written (_secret-scan.mjs).
|
|
15
|
+
*
|
|
16
|
+
* Subcommands:
|
|
17
|
+
* markers --patch <unified diff|-> print the markers the diff adds (no write)
|
|
18
|
+
* add --patch <diff> --task <id> record those markers
|
|
19
|
+
* from-run --triage <path> [--state <agent-state.json>] --task <id>
|
|
20
|
+
* record deferred findings and parked rulings
|
|
21
|
+
* list [--open] [--json] rows, newest first
|
|
22
|
+
* resolve --id <id> mark one row resolved (appends a resolution row)
|
|
23
|
+
* [--repo-slug <slug>] on every subcommand; else $MULTI_AGENT_REPO_SLUG, then the git repo name.
|
|
24
|
+
*
|
|
25
|
+
* Exit: 0 done · 1 IO error · 2 nothing to record or unknown id · 64 usage
|
|
26
|
+
*
|
|
27
|
+
* @module pipeline/scripts/debt-ledger
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { execFileSync } from "node:child_process";
|
|
31
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, realpathSync } from "node:fs";
|
|
32
|
+
import { homedir } from "node:os";
|
|
33
|
+
import { basename, dirname, join } from "node:path";
|
|
34
|
+
import { fileURLToPath } from "node:url";
|
|
35
|
+
|
|
36
|
+
import { shortId } from "./_retrieval.mjs";
|
|
37
|
+
import { parseUnifiedDiff } from "./_unified-diff.mjs";
|
|
38
|
+
import { checkedSlug, memoryExcluded } from "./_memory-policy.mjs";
|
|
39
|
+
import { openScanner, stripPrivate } from "./_secret-scan.mjs";
|
|
40
|
+
|
|
41
|
+
const COMMENT_OPENERS = ["//", "#", "/*", "<!--", "--", ";", "*"];
|
|
42
|
+
const MAX_LINE = 2000;
|
|
43
|
+
const MAX_TEXT = 300;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* True when position `at` of the line sits inside a string literal. With
|
|
47
|
+
* `apostrophes: false` a single quote opens nothing: before a `//` or `#`
|
|
48
|
+
* comment it is as often a lifetime or a word's apostrophe as a string.
|
|
49
|
+
*/
|
|
50
|
+
function insideString(line, at, apostrophes = true) {
|
|
51
|
+
let quote = null;
|
|
52
|
+
for (let i = 0; i < at; i++) {
|
|
53
|
+
const c = line[i];
|
|
54
|
+
if (quote) {
|
|
55
|
+
if (c === "\\") i++;
|
|
56
|
+
else if (c === quote) quote = null;
|
|
57
|
+
} else if (c === '"' || c === "`" || (apostrophes && c === "'")) {
|
|
58
|
+
quote = c;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return quote !== null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The text after `shortcut:` when it opens a comment (only spaces between the
|
|
66
|
+
* comment opener and the marker, the opener outside any string), else null.
|
|
67
|
+
* `--` counts only at the start of the line, so a CLI flag is not a comment.
|
|
68
|
+
* Lowercase only, as documented.
|
|
69
|
+
*/
|
|
70
|
+
function markerIn(line) {
|
|
71
|
+
const at = line.indexOf("shortcut:");
|
|
72
|
+
if (at === -1) return null;
|
|
73
|
+
const before = line.slice(0, at).trimEnd();
|
|
74
|
+
const opener = COMMENT_OPENERS.find((o) => before.endsWith(o));
|
|
75
|
+
if (!opener) return null;
|
|
76
|
+
const openAt = before.length - opener.length;
|
|
77
|
+
if (opener === "--" && before.trim() !== "--") return null;
|
|
78
|
+
if (insideString(line, openAt, opener !== "//" && opener !== "#")) return null;
|
|
79
|
+
return line.slice(at + "shortcut:".length).trim();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Markers added by a unified diff: [{file, line, text}]. */
|
|
83
|
+
export function markersIn(patch) {
|
|
84
|
+
const out = [];
|
|
85
|
+
for (const [file, diff] of parseUnifiedDiff(patch)) {
|
|
86
|
+
for (const { line, text: raw } of diff.addedAt) {
|
|
87
|
+
const marker = markerIn(raw.slice(0, MAX_LINE));
|
|
88
|
+
if (marker === null) continue;
|
|
89
|
+
let text = marker;
|
|
90
|
+
for (const close of ["*/", "-->"])
|
|
91
|
+
if (text.endsWith(close)) text = text.slice(0, -close.length);
|
|
92
|
+
text = text.trimEnd();
|
|
93
|
+
if (text) out.push({ file, line, text });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Deferred findings and parked rulings of one run: [{kind, file, line, text}]. */
|
|
100
|
+
export function runItems(triage, state) {
|
|
101
|
+
const items = [];
|
|
102
|
+
for (const d of triage?.deferred ?? []) {
|
|
103
|
+
const f = d?.finding ?? {};
|
|
104
|
+
if (!f.issue) continue;
|
|
105
|
+
items.push({
|
|
106
|
+
kind: "deferred",
|
|
107
|
+
file: f.file ?? null,
|
|
108
|
+
line: Number.isInteger(f.line) ? f.line : null,
|
|
109
|
+
text: `${f.issue}${d.reason ? ` (deferred: ${d.reason})` : ""}`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const iterations = Array.isArray(state?.reviewIterations) ? state.reviewIterations : [];
|
|
113
|
+
for (const r of iterations.at(-1)?.rulings ?? []) {
|
|
114
|
+
if (r?.ruling !== "parked" || !r.issue) continue;
|
|
115
|
+
items.push({
|
|
116
|
+
kind: "parked",
|
|
117
|
+
file: r.file ?? null,
|
|
118
|
+
line: Number.isInteger(r.line) ? r.line : null,
|
|
119
|
+
text: `${r.issue} (${r.reason})`,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return items;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const rowId = (r) => shortId("D", r.kind, r.file ?? "", r.text);
|
|
126
|
+
|
|
127
|
+
function parseFlags(argv) {
|
|
128
|
+
const flags = {};
|
|
129
|
+
for (let i = 0; i < argv.length; i++) {
|
|
130
|
+
const a = argv[i];
|
|
131
|
+
if (!a.startsWith("--")) continue;
|
|
132
|
+
const next = argv[i + 1];
|
|
133
|
+
if (next !== undefined && !next.startsWith("--")) {
|
|
134
|
+
flags[a.slice(2)] = next;
|
|
135
|
+
i++;
|
|
136
|
+
} else flags[a.slice(2)] = true;
|
|
137
|
+
}
|
|
138
|
+
return flags;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function repoSlug(flags) {
|
|
142
|
+
return checkedSlug(rawRepoSlug(flags));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function rawRepoSlug(flags) {
|
|
146
|
+
if (typeof flags["repo-slug"] === "string") return flags["repo-slug"];
|
|
147
|
+
if (process.env.MULTI_AGENT_REPO_SLUG) return process.env.MULTI_AGENT_REPO_SLUG;
|
|
148
|
+
try {
|
|
149
|
+
const common = execFileSync(
|
|
150
|
+
"git",
|
|
151
|
+
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
152
|
+
{
|
|
153
|
+
encoding: "utf8",
|
|
154
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
155
|
+
},
|
|
156
|
+
).trim();
|
|
157
|
+
const root = basename(common) === ".git" ? dirname(common) : common.replace(/\.git$/, "");
|
|
158
|
+
if (basename(root)) return basename(root);
|
|
159
|
+
} catch {
|
|
160
|
+
/* not a git repo */
|
|
161
|
+
}
|
|
162
|
+
return "default";
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const ledgerPath = (slug) =>
|
|
166
|
+
join(homedir(), ".claude", "memory", "multi-agent", slug, "debt.jsonl");
|
|
167
|
+
|
|
168
|
+
function readRows(slug) {
|
|
169
|
+
const p = ledgerPath(slug);
|
|
170
|
+
if (!existsSync(p)) return [];
|
|
171
|
+
return readFileSync(p, "utf8")
|
|
172
|
+
.split("\n")
|
|
173
|
+
.filter((l) => l.trim())
|
|
174
|
+
.flatMap((l) => {
|
|
175
|
+
try {
|
|
176
|
+
return [JSON.parse(l)];
|
|
177
|
+
} catch {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Current state per id: the last row wins, so a resolution closes its item. */
|
|
184
|
+
function current(rows) {
|
|
185
|
+
const byId = new Map();
|
|
186
|
+
for (const r of rows) byId.set(r.id, { ...byId.get(r.id), ...r });
|
|
187
|
+
return [...byId.values()];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function record(slug, items, task) {
|
|
191
|
+
if (memoryExcluded(slug)) return { added: 0, droppedBySecretScan: 0, excluded: true };
|
|
192
|
+
const p = ledgerPath(slug);
|
|
193
|
+
const seen = new Set(readRows(slug).map((r) => `${r.id}::${r.task}`));
|
|
194
|
+
const scan = openScanner();
|
|
195
|
+
let added = 0;
|
|
196
|
+
let droppedBySecretScan = 0;
|
|
197
|
+
try {
|
|
198
|
+
for (const it of items) {
|
|
199
|
+
const whole = stripPrivate(it.text).replace(/\s+/g, " ").trim();
|
|
200
|
+
if (!whole) continue;
|
|
201
|
+
// Scanned whole and cut afterwards: a token across the cut would
|
|
202
|
+
// otherwise be shortened below the scanner's minimum and stored.
|
|
203
|
+
const text = whole.slice(0, MAX_TEXT);
|
|
204
|
+
const row = { kind: it.kind, file: it.file, line: it.line, text };
|
|
205
|
+
const id = rowId(row);
|
|
206
|
+
if (seen.has(`${id}::${task}`)) continue;
|
|
207
|
+
if (!scan.isClean(`${whole}\n${it.file ?? ""}`)) {
|
|
208
|
+
droppedBySecretScan++;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
mkdirSync(dirname(p), { recursive: true });
|
|
212
|
+
appendFileSync(
|
|
213
|
+
p,
|
|
214
|
+
JSON.stringify({ v: 1, id, ts: new Date().toISOString(), task, status: "open", ...row }) +
|
|
215
|
+
"\n",
|
|
216
|
+
);
|
|
217
|
+
seen.add(`${id}::${task}`);
|
|
218
|
+
added++;
|
|
219
|
+
}
|
|
220
|
+
} finally {
|
|
221
|
+
scan.close();
|
|
222
|
+
}
|
|
223
|
+
return { added, droppedBySecretScan };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function readJson(path) {
|
|
227
|
+
try {
|
|
228
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
229
|
+
} catch {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function readPatch(path) {
|
|
235
|
+
return path === "-" ? readFileSync(0, "utf8") : readFileSync(path, "utf8");
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function main(argv) {
|
|
239
|
+
const sub = argv[0];
|
|
240
|
+
const flags = parseFlags(argv.slice(1));
|
|
241
|
+
const out = (doc) => process.stdout.write(JSON.stringify(doc) + "\n");
|
|
242
|
+
const slug = repoSlug(flags);
|
|
243
|
+
const task = typeof flags.task === "string" ? flags.task : null;
|
|
244
|
+
|
|
245
|
+
if (sub === "markers" || sub === "add") {
|
|
246
|
+
if (typeof flags.patch !== "string") return usage();
|
|
247
|
+
const markers = markersIn(readPatch(flags.patch));
|
|
248
|
+
if (sub === "markers") {
|
|
249
|
+
out({ markers });
|
|
250
|
+
return 0;
|
|
251
|
+
}
|
|
252
|
+
if (!task) return usage();
|
|
253
|
+
const r = record(
|
|
254
|
+
slug,
|
|
255
|
+
markers.map((m) => ({ kind: "shortcut", ...m })),
|
|
256
|
+
task,
|
|
257
|
+
);
|
|
258
|
+
out({ ok: true, slug, ...r });
|
|
259
|
+
return r.added ? 0 : 2;
|
|
260
|
+
}
|
|
261
|
+
if (sub === "from-run") {
|
|
262
|
+
if (typeof flags.triage !== "string" || !task) return usage();
|
|
263
|
+
const triage = readJson(flags.triage);
|
|
264
|
+
if (!triage) {
|
|
265
|
+
console.error(`debt-ledger: triage unreadable: ${flags.triage}`);
|
|
266
|
+
return 1;
|
|
267
|
+
}
|
|
268
|
+
const state = typeof flags.state === "string" ? readJson(flags.state) : null;
|
|
269
|
+
const r = record(slug, runItems(triage, state), task);
|
|
270
|
+
out({ ok: true, slug, ...r });
|
|
271
|
+
return r.added ? 0 : 2;
|
|
272
|
+
}
|
|
273
|
+
if (sub === "list") {
|
|
274
|
+
let rows = current(readRows(slug)).reverse();
|
|
275
|
+
if (flags.open) rows = rows.filter((r) => r.status === "open");
|
|
276
|
+
if (flags.json) out({ slug, rows });
|
|
277
|
+
else
|
|
278
|
+
for (const r of rows)
|
|
279
|
+
process.stdout.write(
|
|
280
|
+
`${r.id} ${r.status} ${r.kind} ${r.file ?? "-"}${r.line ? `:${r.line}` : ""} ${r.text}\n`,
|
|
281
|
+
);
|
|
282
|
+
return 0;
|
|
283
|
+
}
|
|
284
|
+
if (sub === "resolve") {
|
|
285
|
+
if (typeof flags.id !== "string") return usage();
|
|
286
|
+
if (!current(readRows(slug)).some((r) => r.id === flags.id)) {
|
|
287
|
+
console.error(`debt-ledger: no item ${flags.id}`);
|
|
288
|
+
return 2;
|
|
289
|
+
}
|
|
290
|
+
appendFileSync(
|
|
291
|
+
ledgerPath(slug),
|
|
292
|
+
JSON.stringify({ id: flags.id, status: "resolved", resolvedAt: new Date().toISOString() }) +
|
|
293
|
+
"\n",
|
|
294
|
+
);
|
|
295
|
+
out({ ok: true, slug, resolved: flags.id });
|
|
296
|
+
return 0;
|
|
297
|
+
}
|
|
298
|
+
return usage();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function usage() {
|
|
302
|
+
console.error(
|
|
303
|
+
"usage: debt-ledger.mjs markers --patch <diff|-> | add --patch <diff> --task <id> | from-run --triage <path> [--state <path>] --task <id> | list [--open] [--json] | resolve --id <id>",
|
|
304
|
+
);
|
|
305
|
+
return 64;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const invoked = () => {
|
|
309
|
+
try {
|
|
310
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
311
|
+
} catch {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
if (invoked()) {
|
|
317
|
+
try {
|
|
318
|
+
process.exitCode = main(process.argv.slice(2));
|
|
319
|
+
} catch (e) {
|
|
320
|
+
console.error(`debt-ledger: ${e.message}`);
|
|
321
|
+
process.exitCode = 1;
|
|
322
|
+
}
|
|
323
|
+
}
|