@mmerterden/multi-agent-pipeline 24.4.0 → 24.6.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 +140 -0
- package/README.md +2 -2
- package/README.tr.md +2 -2
- package/docs/architecture.md +1 -1
- package/docs/ecosystem.md +7 -1
- package/docs/facts.json +3 -2
- package/install/_common.mjs +21 -1
- package/install/_dev-only-files.mjs +3 -0
- package/install/_external-source.mjs +174 -0
- package/install/_platform-filter.mjs +18 -17
- package/install/_plugin-skills.mjs +8 -21
- package/install/_rewrite-tree.mjs +5 -1
- package/install/claude.mjs +18 -15
- package/install/codex.mjs +96 -37
- package/install/copilot.mjs +35 -13
- package/install/index.mjs +82 -14
- package/manifest.json +49 -833
- package/package.json +4 -2
- package/pipeline/commands/multi-agent/update/SKILL.md +20 -13
- package/pipeline/lib/dev-routing.mjs +124 -0
- package/pipeline/lib/low-disk.mjs +33 -1
- package/pipeline/lib/plugins-source.mjs +206 -0
- package/pipeline/multi-agent-refs/cross-cli-contract.md +12 -5
- package/pipeline/multi-agent-refs/features/skill-conformance.md +2 -1
- package/pipeline/multi-agent-refs/features/stack-skill-routing.md +30 -8
- package/pipeline/multi-agent-refs/phases/phase-2-dev.md +1 -1
- package/pipeline/multi-agent-refs/sync/repo.md +1 -1
- package/pipeline/multi-agent-refs/sync/stack-plugins.md +12 -0
- package/pipeline/office/index.html +196 -11
- package/pipeline/schemas/agent-state.schema.json +30 -0
- package/pipeline/schemas/plugins-pin.json +204 -0
- package/pipeline/schemas/plugins-pin.schema.json +38 -0
- package/pipeline/schemas/prefs.schema.json +134 -48
- package/pipeline/scripts/_active-run.mjs +31 -14
- package/pipeline/scripts/check-skill-routing.mjs +260 -0
- package/pipeline/scripts/disk-cleaner.mjs +1 -1
- package/pipeline/scripts/gen-facts.mjs +9 -4
- package/pipeline/scripts/gen-plugins-pin.mjs +172 -0
- package/pipeline/scripts/note-skill-use.mjs +52 -0
- package/pipeline/scripts/pre-push-check.sh +6 -5
- package/pipeline/scripts/run-scope-guard.mjs +93 -1
- package/pipeline/scripts/skill-conformance.mjs +25 -0
- package/pipeline/scripts/smoke-cross-cli-behavior.sh +9 -0
- package/pipeline/scripts/task-mirror.mjs +16 -2
- package/pipeline/scripts/write-state.mjs +87 -0
- package/pipeline/skills/.skill-manifest.json +2 -2
- package/pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/SKILL.md +0 -147
- package/pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/agent-introspection-debugging/SKILL.md +0 -66
- package/pipeline/skills/shared/external/agent-introspection-debugging/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/alarmkit/SKILL.md +0 -341
- package/pipeline/skills/shared/external/alarmkit/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/alarmkit/references/alarmkit-code.md +0 -257
- package/pipeline/skills/shared/external/alarmkit/references/alarmkit-patterns.md +0 -555
- package/pipeline/skills/shared/external/android-architecture/SKILL.md +0 -438
- package/pipeline/skills/shared/external/android-architecture/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/android-architecture/references/code-examples.md +0 -68
- package/pipeline/skills/shared/external/android-architecture/references/patterns.md +0 -148
- package/pipeline/skills/shared/external/android-build-quality-gates/SKILL.md +0 -362
- package/pipeline/skills/shared/external/android-build-quality-gates/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/android-build-quality-gates/references/patterns.md +0 -451
- package/pipeline/skills/shared/external/android-datastore/SKILL.md +0 -237
- package/pipeline/skills/shared/external/android-datastore/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/android-datastore/references/patterns.md +0 -308
- package/pipeline/skills/shared/external/android-design-tokens-codegen/SKILL.md +0 -250
- package/pipeline/skills/shared/external/android-design-tokens-codegen/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/android-design-tokens-codegen/references/patterns.md +0 -278
- package/pipeline/skills/shared/external/android-jetpack-compose-expert/SKILL.md +0 -140
- package/pipeline/skills/shared/external/android-jetpack-compose-expert/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/android-jetpack-compose-expert/references/patterns.md +0 -153
- package/pipeline/skills/shared/external/android-mvi-viewmodel/SKILL.md +0 -296
- package/pipeline/skills/shared/external/android-mvi-viewmodel/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/android-mvi-viewmodel/references/patterns.md +0 -267
- package/pipeline/skills/shared/external/android-performance/SKILL.md +0 -247
- package/pipeline/skills/shared/external/android-performance/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/android-performance/references/patterns.md +0 -672
- package/pipeline/skills/shared/external/android-security/SKILL.md +0 -266
- package/pipeline/skills/shared/external/android-security/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/android-security/references/patterns.md +0 -706
- package/pipeline/skills/shared/external/api-patterns/SKILL.md +0 -117
- package/pipeline/skills/shared/external/api-patterns/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/api-patterns/references/contract-details.md +0 -137
- package/pipeline/skills/shared/external/api-security-best-practices/SKILL.md +0 -162
- package/pipeline/skills/shared/external/api-security-best-practices/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/api-security-best-practices/references/abuse-controls.md +0 -152
- package/pipeline/skills/shared/external/api-security-best-practices/references/identity-and-access.md +0 -220
- package/pipeline/skills/shared/external/api-security-best-practices/references/operations.md +0 -66
- package/pipeline/skills/shared/external/api-security-best-practices/references/request-handling.md +0 -187
- package/pipeline/skills/shared/external/app-clips/SKILL.md +0 -269
- package/pipeline/skills/shared/external/app-clips/evals/evals.json +0 -50
- package/pipeline/skills/shared/external/app-clips/references/data-handoff-notifications-location.md +0 -211
- package/pipeline/skills/shared/external/app-clips/references/routing-and-experiences.md +0 -185
- package/pipeline/skills/shared/external/app-clips/references/size-capabilities-and-promotion.md +0 -181
- package/pipeline/skills/shared/external/app-intents/SKILL.md +0 -405
- package/pipeline/skills/shared/external/app-intents/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/app-intents/references/appintents-advanced.md +0 -1018
- package/pipeline/skills/shared/external/app-intents/references/code-examples.md +0 -54
- package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +0 -317
- package/pipeline/skills/shared/external/app-store-optimization/evals/evals.json +0 -63
- package/pipeline/skills/shared/external/app-store-optimization/references/engagement-and-localization.md +0 -96
- package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +0 -169
- package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +0 -178
- package/pipeline/skills/shared/external/app-store-release-notes/SKILL.md +0 -92
- package/pipeline/skills/shared/external/app-store-release-notes/evals/evals.json +0 -40
- package/pipeline/skills/shared/external/app-store-release-notes/evals/trigger-eval.json +0 -11
- package/pipeline/skills/shared/external/app-store-release-notes/references/release-notes-guidelines.md +0 -64
- package/pipeline/skills/shared/external/app-store-release-notes/scripts/collect_release_changes.sh +0 -31
- package/pipeline/skills/shared/external/app-store-review/SKILL.md +0 -311
- package/pipeline/skills/shared/external/app-store-review/evals/evals.json +0 -56
- package/pipeline/skills/shared/external/app-store-review/references/monetization-and-submission.md +0 -138
- package/pipeline/skills/shared/external/app-store-review/references/privacy-manifest.md +0 -161
- package/pipeline/skills/shared/external/app-store-review/references/review-checklists.md +0 -151
- package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +0 -361
- package/pipeline/skills/shared/external/apple-on-device-ai/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-conversion.md +0 -346
- package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-optimization.md +0 -269
- package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models-code.md +0 -186
- package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models.md +0 -440
- package/pipeline/skills/shared/external/apple-on-device-ai/references/mlx-swift.md +0 -292
- package/pipeline/skills/shared/external/architecture/SKILL.md +0 -125
- package/pipeline/skills/shared/external/architecture/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/architecture/references/adr-and-review.md +0 -76
- package/pipeline/skills/shared/external/authentication/SKILL.md +0 -343
- package/pipeline/skills/shared/external/authentication/evals/evals.json +0 -48
- package/pipeline/skills/shared/external/authentication/references/code-examples.md +0 -59
- package/pipeline/skills/shared/external/authentication/references/keychain-biometric.md +0 -204
- package/pipeline/skills/shared/external/authentication/references/passkeys.md +0 -158
- package/pipeline/skills/shared/external/avkit/SKILL.md +0 -402
- package/pipeline/skills/shared/external/avkit/evals/evals.json +0 -55
- package/pipeline/skills/shared/external/avkit/references/avkit-patterns.md +0 -563
- package/pipeline/skills/shared/external/background-processing/SKILL.md +0 -390
- package/pipeline/skills/shared/external/background-processing/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/background-processing/references/background-task-patterns.md +0 -276
- package/pipeline/skills/shared/external/backlog/BACKLOG.md +0 -32
- package/pipeline/skills/shared/external/backlog/SKILL.md +0 -77
- package/pipeline/skills/shared/external/backlog/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/build-settings-audit/SKILL.md +0 -81
- package/pipeline/skills/shared/external/build-settings-audit/evals/evals.json +0 -54
- package/pipeline/skills/shared/external/build-settings-audit/references/build-optimization-sources.md +0 -119
- package/pipeline/skills/shared/external/build-settings-audit/references/build-settings-best-practices.md +0 -131
- package/pipeline/skills/shared/external/build-settings-audit/references/project-audit-checks.md +0 -146
- package/pipeline/skills/shared/external/build-settings-audit/references/recommendation-format.md +0 -95
- package/pipeline/skills/shared/external/build-time-benchmark/SKILL.md +0 -97
- package/pipeline/skills/shared/external/build-time-benchmark/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/build-time-benchmark/references/benchmark-artifacts.md +0 -96
- package/pipeline/skills/shared/external/build-time-benchmark/references/benchmarking-workflow.md +0 -59
- package/pipeline/skills/shared/external/build-time-benchmark/schemas/build-benchmark.schema.json +0 -123
- package/pipeline/skills/shared/external/build-time-benchmark/scripts/benchmark_builds.py +0 -334
- package/pipeline/skills/shared/external/build-time-fixes/SKILL.md +0 -227
- package/pipeline/skills/shared/external/build-time-fixes/evals/evals.json +0 -54
- package/pipeline/skills/shared/external/build-time-fixes/references/build-settings-best-practices.md +0 -131
- package/pipeline/skills/shared/external/build-time-fixes/references/fix-patterns.md +0 -342
- package/pipeline/skills/shared/external/build-time-fixes/references/recommendation-format.md +0 -95
- package/pipeline/skills/shared/external/build-time-fixes/scripts/benchmark_builds.py +0 -334
- package/pipeline/skills/shared/external/build-time-optimizer/SKILL.md +0 -168
- package/pipeline/skills/shared/external/build-time-optimizer/evals/evals.json +0 -54
- package/pipeline/skills/shared/external/build-time-optimizer/references/benchmark-artifacts.md +0 -96
- package/pipeline/skills/shared/external/build-time-optimizer/references/build-settings-best-practices.md +0 -131
- package/pipeline/skills/shared/external/build-time-optimizer/references/orchestration-report-template.md +0 -193
- package/pipeline/skills/shared/external/build-time-optimizer/references/recommendation-format.md +0 -95
- package/pipeline/skills/shared/external/build-time-optimizer/scripts/benchmark_builds.py +0 -334
- package/pipeline/skills/shared/external/build-time-optimizer/scripts/diagnose_compilation.py +0 -266
- package/pipeline/skills/shared/external/build-time-optimizer/scripts/generate_optimization_report.py +0 -408
- package/pipeline/skills/shared/external/callkit-voip/SKILL.md +0 -341
- package/pipeline/skills/shared/external/callkit-voip/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/callkit-voip/references/callkit-patterns.md +0 -286
- package/pipeline/skills/shared/external/callkit-voip/references/code-examples.md +0 -93
- package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +0 -209
- package/pipeline/skills/shared/external/ci-cd-pipelines/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/ci-cd-pipelines/references/pipeline-examples.md +0 -261
- package/pipeline/skills/shared/external/clean-code/SKILL.md +0 -163
- package/pipeline/skills/shared/external/clean-code/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/clean-code/references/code-examples.md +0 -56
- package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +0 -316
- package/pipeline/skills/shared/external/cloudkit-sync/evals/evals.json +0 -50
- package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-code.md +0 -214
- package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-patterns.md +0 -351
- package/pipeline/skills/shared/external/compose-components/SKILL.md +0 -417
- package/pipeline/skills/shared/external/compose-components/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/compose-components/references/code-examples.md +0 -89
- package/pipeline/skills/shared/external/compose-components/references/patterns.md +0 -207
- package/pipeline/skills/shared/external/compose-navigation/SKILL.md +0 -441
- package/pipeline/skills/shared/external/compose-navigation/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/compose-navigation/references/code-examples.md +0 -70
- package/pipeline/skills/shared/external/compose-navigation/references/patterns.md +0 -198
- package/pipeline/skills/shared/external/compose-testing/SKILL.md +0 -246
- package/pipeline/skills/shared/external/compose-testing/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/compose-testing/references/patterns.md +0 -646
- package/pipeline/skills/shared/external/contacts-framework/SKILL.md +0 -298
- package/pipeline/skills/shared/external/contacts-framework/evals/evals.json +0 -39
- package/pipeline/skills/shared/external/contacts-framework/references/contacts-patterns.md +0 -279
- package/pipeline/skills/shared/external/context-compression/SKILL.md +0 -134
- package/pipeline/skills/shared/external/context-compression/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/core-bluetooth/SKILL.md +0 -350
- package/pipeline/skills/shared/external/core-bluetooth/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/core-bluetooth/references/ble-patterns.md +0 -390
- package/pipeline/skills/shared/external/core-data/SKILL.md +0 -284
- package/pipeline/skills/shared/external/core-data/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/core-data/references/core-data-code.md +0 -221
- package/pipeline/skills/shared/external/core-motion/SKILL.md +0 -334
- package/pipeline/skills/shared/external/core-motion/evals/evals.json +0 -53
- package/pipeline/skills/shared/external/core-motion/references/motion-patterns.md +0 -346
- package/pipeline/skills/shared/external/core-nfc/SKILL.md +0 -357
- package/pipeline/skills/shared/external/core-nfc/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/core-nfc/references/code-examples.md +0 -98
- package/pipeline/skills/shared/external/core-nfc/references/nfc-patterns.md +0 -367
- package/pipeline/skills/shared/external/coreml/SKILL.md +0 -340
- package/pipeline/skills/shared/external/coreml/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/coreml/references/coreml-code.md +0 -208
- package/pipeline/skills/shared/external/coreml/references/coreml-swift-integration.md +0 -827
- package/pipeline/skills/shared/external/council/SKILL.md +0 -66
- package/pipeline/skills/shared/external/council/evals/evals.json +0 -41
- package/pipeline/skills/shared/external/cryptokit/SKILL.md +0 -354
- package/pipeline/skills/shared/external/cryptokit/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/cryptokit/references/cryptokit-patterns.md +0 -429
- package/pipeline/skills/shared/external/css-modern/SKILL.md +0 -347
- package/pipeline/skills/shared/external/css-modern/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/css-modern/references/code-examples.md +0 -149
- package/pipeline/skills/shared/external/database-patterns/SKILL.md +0 -241
- package/pipeline/skills/shared/external/database-patterns/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +0 -152
- package/pipeline/skills/shared/external/debugging-instruments/SKILL.md +0 -401
- package/pipeline/skills/shared/external/debugging-instruments/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/debugging-instruments/references/instruments-guide.md +0 -263
- package/pipeline/skills/shared/external/debugging-instruments/references/lldb-patterns.md +0 -259
- package/pipeline/skills/shared/external/debugging-strategies/SKILL.md +0 -151
- package/pipeline/skills/shared/external/debugging-strategies/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/debugging-strategies/references/hard-cases.md +0 -54
- package/pipeline/skills/shared/external/device-integrity/SKILL.md +0 -322
- package/pipeline/skills/shared/external/device-integrity/evals/evals.json +0 -49
- package/pipeline/skills/shared/external/device-integrity/references/device-integrity-patterns.md +0 -215
- package/pipeline/skills/shared/external/disk-cleaner/SKILL.md +0 -124
- package/pipeline/skills/shared/external/disk-cleaner/evals/evals.json +0 -62
- package/pipeline/skills/shared/external/disk-cleaner/scripts/disk-cleaner.mjs +0 -2018
- package/pipeline/skills/shared/external/docker-expert/SKILL.md +0 -169
- package/pipeline/skills/shared/external/docker-expert/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/docker-expert/references/patterns.md +0 -98
- package/pipeline/skills/shared/external/e2e-testing/SKILL.md +0 -148
- package/pipeline/skills/shared/external/e2e-testing/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/e2e-testing/references/document-fixtures.md +0 -65
- package/pipeline/skills/shared/external/energykit/SKILL.md +0 -333
- package/pipeline/skills/shared/external/energykit/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/energykit/references/energykit-patterns.md +0 -297
- package/pipeline/skills/shared/external/eventkit-calendar/SKILL.md +0 -377
- package/pipeline/skills/shared/external/eventkit-calendar/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/eventkit-calendar/references/eventkit-patterns.md +0 -283
- package/pipeline/skills/shared/external/evidence-github/SKILL.md +0 -47
- package/pipeline/skills/shared/external/evidence-github/evals/evals.json +0 -41
- package/pipeline/skills/shared/external/evidence-registry/SKILL.md +0 -35
- package/pipeline/skills/shared/external/evidence-registry/evals/evals.json +0 -41
- package/pipeline/skills/shared/external/fastapi-pro/SKILL.md +0 -120
- package/pipeline/skills/shared/external/fastapi-pro/evals/evals.json +0 -57
- package/pipeline/skills/shared/external/fastapi-pro/references/app-structure.md +0 -245
- package/pipeline/skills/shared/external/fastapi-pro/references/testing-and-deployment.md +0 -69
- package/pipeline/skills/shared/external/firebase-integration/SKILL.md +0 -140
- package/pipeline/skills/shared/external/firebase-integration/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/firebase-integration/references/functions-and-products.md +0 -51
- package/pipeline/skills/shared/external/firebase-integration/references/security-rules.md +0 -59
- package/pipeline/skills/shared/external/fix-review-verdicts/SKILL.md +0 -136
- package/pipeline/skills/shared/external/fix-review-verdicts/evals/evals.json +0 -57
- package/pipeline/skills/shared/external/free-llm-apis/SKILL.md +0 -70
- package/pipeline/skills/shared/external/free-llm-apis/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +0 -34
- package/pipeline/skills/shared/external/github-actions-templates/SKILL.md +0 -192
- package/pipeline/skills/shared/external/github-actions-templates/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/github-actions-templates/references/patterns.md +0 -96
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +0 -226
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/evals/evals.json +0 -58
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/references/patterns.md +0 -732
- package/pipeline/skills/shared/external/handle-request/SKILL.md +0 -97
- package/pipeline/skills/shared/external/handle-request/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/healthkit/SKILL.md +0 -382
- package/pipeline/skills/shared/external/healthkit/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/healthkit/references/healthkit-patterns.md +0 -541
- package/pipeline/skills/shared/external/hig-app-icons/SKILL.md +0 -159
- package/pipeline/skills/shared/external/hig-app-icons/evals/evals.json +0 -48
- package/pipeline/skills/shared/external/hig-app-icons/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/hig-app-icons/references/icon-workflow.md +0 -125
- package/pipeline/skills/shared/external/hig-components-content/SKILL.md +0 -78
- package/pipeline/skills/shared/external/hig-components-content/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/hig-components-content/references/content-views.md +0 -121
- package/pipeline/skills/shared/external/hig-components-layout/SKILL.md +0 -114
- package/pipeline/skills/shared/external/hig-components-layout/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/hig-components-layout/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/hig-components-layout/references/bars-and-tabs.md +0 -242
- package/pipeline/skills/shared/external/hig-components-layout/references/containers.md +0 -73
- package/pipeline/skills/shared/external/hig-components-status/SKILL.md +0 -154
- package/pipeline/skills/shared/external/hig-components-status/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/hig-components-system/SKILL.md +0 -80
- package/pipeline/skills/shared/external/hig-components-system/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/hig-components-system/references/surfaces.md +0 -98
- package/pipeline/skills/shared/external/hig-foundations/SKILL.md +0 -85
- package/pipeline/skills/shared/external/hig-foundations/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/hig-foundations/evals/trigger-eval.json +0 -21
- package/pipeline/skills/shared/external/hig-foundations/references/foundations-detail.md +0 -153
- package/pipeline/skills/shared/external/hig-foundations/references/type-color-spacing.md +0 -232
- package/pipeline/skills/shared/external/hig-inputs/SKILL.md +0 -152
- package/pipeline/skills/shared/external/hig-inputs/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/hig-patterns/SKILL.md +0 -99
- package/pipeline/skills/shared/external/hig-patterns/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/hig-patterns/references/onboarding-and-states.md +0 -199
- package/pipeline/skills/shared/external/hig-patterns/references/patterns.md +0 -86
- package/pipeline/skills/shared/external/hig-platforms/SKILL.md +0 -163
- package/pipeline/skills/shared/external/hig-platforms/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/hig-platforms/references/ipad-layout.md +0 -230
- package/pipeline/skills/shared/external/hig-technologies/SKILL.md +0 -65
- package/pipeline/skills/shared/external/hig-technologies/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/hig-technologies/references/technologies.md +0 -124
- package/pipeline/skills/shared/external/homekit-matter/SKILL.md +0 -385
- package/pipeline/skills/shared/external/homekit-matter/evals/evals.json +0 -50
- package/pipeline/skills/shared/external/homekit-matter/references/matter-commissioning.md +0 -363
- package/pipeline/skills/shared/external/html-semantic/SKILL.md +0 -263
- package/pipeline/skills/shared/external/html-semantic/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/html-semantic/references/code-examples.md +0 -54
- package/pipeline/skills/shared/external/humanizer/SKILL.md +0 -204
- package/pipeline/skills/shared/external/humanizer/evals/evals.json +0 -59
- package/pipeline/skills/shared/external/humanizer/references/turkish.md +0 -88
- package/pipeline/skills/shared/external/humanizer/references/voice.md +0 -24
- package/pipeline/skills/shared/external/ink-animation/SKILL.md +0 -230
- package/pipeline/skills/shared/external/ink-animation/evals/evals.json +0 -41
- package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +0 -333
- package/pipeline/skills/shared/external/ios-accessibility/evals/evals.json +0 -50
- package/pipeline/skills/shared/external/ios-accessibility/references/a11y-patterns.md +0 -470
- package/pipeline/skills/shared/external/ios-accessibility/references/assistive-tech-review.md +0 -224
- package/pipeline/skills/shared/external/ios-accessibility/references/large-content-and-appearance.md +0 -144
- package/pipeline/skills/shared/external/ios-accessibility/references/media-accessibility.md +0 -156
- package/pipeline/skills/shared/external/ios-accessibility/references/nutrition-labels.md +0 -212
- package/pipeline/skills/shared/external/ios-coding-standard/SKILL.md +0 -119
- package/pipeline/skills/shared/external/ios-coding-standard/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/ios-coding-standard/modules/_TEMPLATE.yml +0 -82
- package/pipeline/skills/shared/external/ios-coding-standard/references/STANDARD.md +0 -629
- package/pipeline/skills/shared/external/ios-coding-standard/references/lint-local.sh +0 -172
- package/pipeline/skills/shared/external/ios-coding-standard/references/rules.yml +0 -1959
- package/pipeline/skills/shared/external/ios-coding-standard/references/swiftlint.draft.yml +0 -370
- package/pipeline/skills/shared/external/ios-design-review/SKILL.md +0 -146
- package/pipeline/skills/shared/external/ios-design-review/evals/evals.json +0 -48
- package/pipeline/skills/shared/external/ios-design-review/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/ios-design-review/references/appearance-matrix.md +0 -144
- package/pipeline/skills/shared/external/ios-design-review/references/checklist.md +0 -208
- package/pipeline/skills/shared/external/ios-haptics/SKILL.md +0 -191
- package/pipeline/skills/shared/external/ios-haptics/evals/evals.json +0 -49
- package/pipeline/skills/shared/external/ios-haptics/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/ios-haptics/references/core-haptics.md +0 -226
- package/pipeline/skills/shared/external/ios-iphone-duo/SKILL.md +0 -178
- package/pipeline/skills/shared/external/ios-iphone-duo/evals/evals.json +0 -65
- package/pipeline/skills/shared/external/ios-iphone-duo/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/ios-iphone-duo/references/api-map.md +0 -223
- package/pipeline/skills/shared/external/ios-iphone-duo/references/fixed-assumptions.md +0 -217
- package/pipeline/skills/shared/external/ios-iphone-duo/references/poses-and-panes.md +0 -133
- package/pipeline/skills/shared/external/ios-localization/SKILL.md +0 -343
- package/pipeline/skills/shared/external/ios-localization/evals/evals.json +0 -49
- package/pipeline/skills/shared/external/ios-localization/references/code-examples.md +0 -30
- package/pipeline/skills/shared/external/ios-localization/references/formatstyle-locale.md +0 -454
- package/pipeline/skills/shared/external/ios-localization/references/string-catalogs.md +0 -463
- package/pipeline/skills/shared/external/ios-module-structure/SKILL.md +0 -102
- package/pipeline/skills/shared/external/ios-module-structure/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/ios-module-structure/modules/_TEMPLATE.yml +0 -152
- package/pipeline/skills/shared/external/ios-module-structure/references/rules.yml +0 -673
- package/pipeline/skills/shared/external/ios-module-structure/scripts/check_structure.py +0 -827
- package/pipeline/skills/shared/external/ios-networking/SKILL.md +0 -359
- package/pipeline/skills/shared/external/ios-networking/evals/evals.json +0 -50
- package/pipeline/skills/shared/external/ios-networking/references/background-websocket.md +0 -662
- package/pipeline/skills/shared/external/ios-networking/references/code-examples.md +0 -67
- package/pipeline/skills/shared/external/ios-networking/references/file-storage-patterns.md +0 -219
- package/pipeline/skills/shared/external/ios-networking/references/lightweight-clients.md +0 -141
- package/pipeline/skills/shared/external/ios-networking/references/network-framework.md +0 -375
- package/pipeline/skills/shared/external/ios-networking/references/urlsession-patterns.md +0 -832
- package/pipeline/skills/shared/external/ios-security/SKILL.md +0 -438
- package/pipeline/skills/shared/external/ios-security/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/ios-security/references/app-review-guidelines.md +0 -182
- package/pipeline/skills/shared/external/ios-security/references/code-examples.md +0 -84
- package/pipeline/skills/shared/external/ios-security/references/cryptokit-advanced.md +0 -311
- package/pipeline/skills/shared/external/ios-security/references/file-storage-patterns.md +0 -362
- package/pipeline/skills/shared/external/ios-security/references/privacy-manifest.md +0 -126
- package/pipeline/skills/shared/external/ios-sf-symbols/SKILL.md +0 -177
- package/pipeline/skills/shared/external/ios-sf-symbols/evals/evals.json +0 -49
- package/pipeline/skills/shared/external/ios-sf-symbols/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/ios-sf-symbols/references/effects-and-custom-symbols.md +0 -144
- package/pipeline/skills/shared/external/ios-simulator/SKILL.md +0 -359
- package/pipeline/skills/shared/external/ios-simulator/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/ios-simulator/references/simctl-commands.md +0 -236
- package/pipeline/skills/shared/external/ios-simulator-debugging/SKILL.md +0 -99
- package/pipeline/skills/shared/external/ios-simulator-debugging/evals/evals.json +0 -41
- package/pipeline/skills/shared/external/kotlin-coroutines-expert/SKILL.md +0 -153
- package/pipeline/skills/shared/external/kotlin-coroutines-expert/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/kotlin-coroutines-expert/references/patterns.md +0 -111
- package/pipeline/skills/shared/external/live-activities/SKILL.md +0 -363
- package/pipeline/skills/shared/external/live-activities/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/live-activities/references/activitykit-patterns.md +0 -742
- package/pipeline/skills/shared/external/live-activities/references/code-examples.md +0 -108
- package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +0 -88
- package/pipeline/skills/shared/external/localization-reuse-map/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/localization-reuse-map/example-mapping.json +0 -188
- package/pipeline/skills/shared/external/localization-reuse-map/references/format-and-output.md +0 -135
- package/pipeline/skills/shared/external/localization-reuse-map/references/project-settings.md +0 -22
- package/pipeline/skills/shared/external/localization-reuse-map/references/publish-and-snapshot.md +0 -78
- package/pipeline/skills/shared/external/localization-reuse-map/references/sources-and-recipes.md +0 -154
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/_shared.py +0 -201
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-artifact.py +0 -838
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-spreadsheet.py +0 -298
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-annotations.py +0 -291
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-legacy-labels.py +0 -114
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/publish-confluence.py +0 -224
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-key-shots.py +0 -234
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-overlay.py +0 -551
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-legacy-values.py +0 -191
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-new-values.py +0 -160
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/scan-screen-keys.py +0 -166
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/snapshot-resources.sh +0 -29
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/verify-map.py +0 -163
- package/pipeline/skills/shared/external/macos-app-distribution/SKILL.md +0 -149
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/bootstrap/Package.swift +0 -17
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/bootstrap/Sources/MyApp/MyApp.swift +0 -24
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/bootstrap/Sources/MyApp/Resources/.keep +0 -0
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/bootstrap/version.env +0 -4
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/build_icon.sh +0 -56
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/compile_and_run.sh +0 -84
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/launch.sh +0 -35
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/make_appcast.sh +0 -97
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/package_app.sh +0 -265
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/setup_dev_signing.sh +0 -63
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/sign-and-notarize.sh +0 -83
- package/pipeline/skills/shared/external/macos-app-distribution/assets/templates/version.env +0 -4
- package/pipeline/skills/shared/external/macos-app-distribution/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/macos-app-distribution/evals/trigger-eval.json +0 -10
- package/pipeline/skills/shared/external/macos-app-distribution/references/packaging.md +0 -49
- package/pipeline/skills/shared/external/macos-app-distribution/references/release.md +0 -57
- package/pipeline/skills/shared/external/macos-app-distribution/references/scaffold.md +0 -109
- package/pipeline/skills/shared/external/macos-menubar-utility/SKILL.md +0 -206
- package/pipeline/skills/shared/external/macos-menubar-utility/evals/evals.json +0 -52
- package/pipeline/skills/shared/external/macos-menubar-utility/evals/trigger-eval.json +0 -10
- package/pipeline/skills/shared/external/mapkit-location/SKILL.md +0 -371
- package/pipeline/skills/shared/external/mapkit-location/evals/evals.json +0 -51
- package/pipeline/skills/shared/external/mapkit-location/references/code-examples.md +0 -117
- package/pipeline/skills/shared/external/mapkit-location/references/mapkit-corelocation-patterns.md +0 -639
- package/pipeline/skills/shared/external/mapkit-location/references/mapkit-patterns.md +0 -712
- package/pipeline/skills/shared/external/metrickit-diagnostics/SKILL.md +0 -255
- package/pipeline/skills/shared/external/metrickit-diagnostics/evals/evals.json +0 -49
- package/pipeline/skills/shared/external/metrickit-diagnostics/references/metrickit-patterns.md +0 -183
- package/pipeline/skills/shared/external/monorepo-architect/SKILL.md +0 -166
- package/pipeline/skills/shared/external/monorepo-architect/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/monorepo-architect/references/patterns.md +0 -70
- package/pipeline/skills/shared/external/musickit-audio/SKILL.md +0 -298
- package/pipeline/skills/shared/external/musickit-audio/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/musickit-audio/references/musickit-patterns.md +0 -303
- package/pipeline/skills/shared/external/natural-language/SKILL.md +0 -292
- package/pipeline/skills/shared/external/natural-language/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/natural-language/references/translation-patterns.md +0 -282
- package/pipeline/skills/shared/external/nextjs-routing/SKILL.md +0 -333
- package/pipeline/skills/shared/external/nextjs-routing/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/nextjs-routing/references/app-router-examples.md +0 -127
- package/pipeline/skills/shared/external/nodejs-backend-patterns/SKILL.md +0 -104
- package/pipeline/skills/shared/external/nodejs-backend-patterns/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/nodejs-backend-patterns/references/runtime-patterns.md +0 -258
- package/pipeline/skills/shared/external/nodejs-backend-patterns/references/testing-and-frameworks.md +0 -57
- package/pipeline/skills/shared/external/observability-engineer/SKILL.md +0 -158
- package/pipeline/skills/shared/external/observability-engineer/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/observability-engineer/references/patterns.md +0 -75
- package/pipeline/skills/shared/external/package-build-audit/SKILL.md +0 -114
- package/pipeline/skills/shared/external/package-build-audit/evals/evals.json +0 -56
- package/pipeline/skills/shared/external/package-build-audit/references/build-optimization-sources.md +0 -119
- package/pipeline/skills/shared/external/package-build-audit/references/recommendation-format.md +0 -95
- package/pipeline/skills/shared/external/package-build-audit/references/spm-analysis-checks.md +0 -126
- package/pipeline/skills/shared/external/package-build-audit/scripts/check_spm_pins.py +0 -123
- package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +0 -367
- package/pipeline/skills/shared/external/passkit-wallet/evals/evals.json +0 -52
- package/pipeline/skills/shared/external/passkit-wallet/references/wallet-passes.md +0 -249
- package/pipeline/skills/shared/external/pdfkit/SKILL.md +0 -468
- package/pipeline/skills/shared/external/pdfkit/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/pdfkit/references/pdfkit-patterns.md +0 -651
- package/pipeline/skills/shared/external/pencilkit-drawing/SKILL.md +0 -367
- package/pipeline/skills/shared/external/pencilkit-drawing/evals/evals.json +0 -48
- package/pipeline/skills/shared/external/pencilkit-drawing/references/pencilkit-patterns.md +0 -279
- package/pipeline/skills/shared/external/permissionkit/SKILL.md +0 -359
- package/pipeline/skills/shared/external/permissionkit/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/permissionkit/references/code-examples.md +0 -37
- package/pipeline/skills/shared/external/permissionkit/references/permissionkit-patterns.md +0 -374
- package/pipeline/skills/shared/external/photos-camera-media/SKILL.md +0 -451
- package/pipeline/skills/shared/external/photos-camera-media/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/photos-camera-media/references/av-playback.md +0 -470
- package/pipeline/skills/shared/external/photos-camera-media/references/camera-capture.md +0 -544
- package/pipeline/skills/shared/external/photos-camera-media/references/image-loading-caching.md +0 -539
- package/pipeline/skills/shared/external/photos-camera-media/references/photokit-patterns.md +0 -465
- package/pipeline/skills/shared/external/play-store-review/SKILL.md +0 -284
- package/pipeline/skills/shared/external/play-store-review/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/play-store-review/references/signing-and-policies.md +0 -83
- package/pipeline/skills/shared/external/push-notifications/SKILL.md +0 -359
- package/pipeline/skills/shared/external/push-notifications/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/push-notifications/references/notification-code.md +0 -176
- package/pipeline/skills/shared/external/push-notifications/references/notification-patterns.md +0 -523
- package/pipeline/skills/shared/external/push-notifications/references/rich-notifications.md +0 -541
- package/pipeline/skills/shared/external/python-patterns/SKILL.md +0 -235
- package/pipeline/skills/shared/external/python-patterns/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/python-patterns/references/python-examples.md +0 -176
- package/pipeline/skills/shared/external/react-best-practices/SKILL.md +0 -293
- package/pipeline/skills/shared/external/react-best-practices/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/realitykit-ar/SKILL.md +0 -327
- package/pipeline/skills/shared/external/realitykit-ar/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/realitykit-ar/references/realitykit-patterns.md +0 -365
- package/pipeline/skills/shared/external/release-video/SKILL.md +0 -147
- package/pipeline/skills/shared/external/release-video/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/rest-api-design/SKILL.md +0 -239
- package/pipeline/skills/shared/external/rest-api-design/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/rest-api-design/references/api-examples.md +0 -233
- package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +0 -219
- package/pipeline/skills/shared/external/retrofit-networking/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/retrofit-networking/references/patterns.md +0 -654
- package/pipeline/skills/shared/external/reverse-engineer-own-app/SKILL.md +0 -230
- package/pipeline/skills/shared/external/reverse-engineer-own-app/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/room-database/SKILL.md +0 -227
- package/pipeline/skills/shared/external/room-database/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/room-database/references/patterns.md +0 -630
- package/pipeline/skills/shared/external/scenario-gap-analysis/SKILL.md +0 -129
- package/pipeline/skills/shared/external/scenario-gap-analysis/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/scenario-gap-analysis/references/scenario-schema.md +0 -60
- package/pipeline/skills/shared/external/search-first/SKILL.md +0 -73
- package/pipeline/skills/shared/external/search-first/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/security-review/SKILL.md +0 -76
- package/pipeline/skills/shared/external/security-review/evals/evals.json +0 -48
- package/pipeline/skills/shared/external/security-review/references/agentic-systems.md +0 -93
- package/pipeline/skills/shared/external/security-review/references/firebase-rules.md +0 -100
- package/pipeline/skills/shared/external/security-review/references/graphql.md +0 -82
- package/pipeline/skills/shared/external/security-review/references/llm-prompt-injection.md +0 -93
- package/pipeline/skills/shared/external/security-review/references/oauth-oidc.md +0 -100
- package/pipeline/skills/shared/external/security-review/references/owasp-mobile-top10-2024.md +0 -53
- package/pipeline/skills/shared/external/security-review/references/owasp-web-api-top10-2021.md +0 -56
- package/pipeline/skills/shared/external/security-review/references/supabase.md +0 -73
- package/pipeline/skills/shared/external/shareplay-activities/SKILL.md +0 -329
- package/pipeline/skills/shared/external/shareplay-activities/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/shareplay-activities/references/shareplay-patterns.md +0 -453
- package/pipeline/skills/shared/external/short-video-craft/SKILL.md +0 -177
- package/pipeline/skills/shared/external/short-video-craft/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/short-video-craft/references/generated-defaults.md +0 -24
- package/pipeline/skills/shared/external/signal-community/SKILL.md +0 -78
- package/pipeline/skills/shared/external/signal-community/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/skill-creator/SKILL.md +0 -88
- package/pipeline/skills/shared/external/skill-creator/audit.md +0 -63
- package/pipeline/skills/shared/external/skill-creator/checklist.md +0 -40
- package/pipeline/skills/shared/external/skill-creator/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/skill-creator/examples.md +0 -65
- package/pipeline/skills/shared/external/skill-creator/label-check.md +0 -55
- package/pipeline/skills/shared/external/skill-creator/scripts/audit-panel.js +0 -110
- package/pipeline/skills/shared/external/skill-creator/template.md +0 -83
- package/pipeline/skills/shared/external/spec-persona-walk/SKILL.md +0 -118
- package/pipeline/skills/shared/external/spec-persona-walk/evals/evals.json +0 -50
- package/pipeline/skills/shared/external/spec-persona-walk/scripts/persona-walk-anchors.mjs +0 -443
- package/pipeline/skills/shared/external/speech-recognition/SKILL.md +0 -296
- package/pipeline/skills/shared/external/speech-recognition/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/speech-recognition/references/speechanalyzer-patterns.md +0 -189
- package/pipeline/skills/shared/external/store-screenshots/SKILL.md +0 -441
- package/pipeline/skills/shared/external/store-screenshots/evals/evals.json +0 -115
- package/pipeline/skills/shared/external/store-screenshots/references/frames.md +0 -141
- package/pipeline/skills/shared/external/storekit/SKILL.md +0 -296
- package/pipeline/skills/shared/external/storekit/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/storekit/references/app-review-guidelines.md +0 -98
- package/pipeline/skills/shared/external/storekit/references/core-patterns.md +0 -445
- package/pipeline/skills/shared/external/storekit/references/storekit-advanced.md +0 -542
- package/pipeline/skills/shared/external/swift-api-design-guidelines/SKILL.md +0 -326
- package/pipeline/skills/shared/external/swift-api-design-guidelines/evals/evals.json +0 -48
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/argument-labels-and-parameters.md +0 -171
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/conventions-and-special-rules.md +0 -156
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/naming-and-clarity.md +0 -156
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/side-effects-and-mutating-pairs.md +0 -123
- package/pipeline/skills/shared/external/swift-architecture/SKILL.md +0 -269
- package/pipeline/skills/shared/external/swift-architecture/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/swift-architecture/references/pattern-examples.md +0 -295
- package/pipeline/skills/shared/external/swift-charts/SKILL.md +0 -314
- package/pipeline/skills/shared/external/swift-charts/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swift-charts/references/charts-patterns.md +0 -589
- package/pipeline/skills/shared/external/swift-codable/SKILL.md +0 -360
- package/pipeline/skills/shared/external/swift-codable/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/swift-codable/references/codable-recipes.md +0 -207
- package/pipeline/skills/shared/external/swift-compile-hotspots/SKILL.md +0 -93
- package/pipeline/skills/shared/external/swift-compile-hotspots/evals/evals.json +0 -54
- package/pipeline/skills/shared/external/swift-compile-hotspots/references/build-optimization-sources.md +0 -119
- package/pipeline/skills/shared/external/swift-compile-hotspots/references/code-compilation-checks.md +0 -126
- package/pipeline/skills/shared/external/swift-compile-hotspots/references/recommendation-format.md +0 -95
- package/pipeline/skills/shared/external/swift-compile-hotspots/scripts/diagnose_compilation.py +0 -266
- package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +0 -296
- package/pipeline/skills/shared/external/swift-concurrency/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/swift-concurrency/references/approachable-concurrency.md +0 -72
- package/pipeline/skills/shared/external/swift-concurrency/references/async-algorithms.md +0 -77
- package/pipeline/skills/shared/external/swift-concurrency/references/bridging-interop.md +0 -213
- package/pipeline/skills/shared/external/swift-concurrency/references/code-examples.md +0 -100
- package/pipeline/skills/shared/external/swift-concurrency/references/concurrency-patterns.md +0 -236
- package/pipeline/skills/shared/external/swift-concurrency/references/diagnostics.md +0 -64
- package/pipeline/skills/shared/external/swift-concurrency/references/swift-6-2-additions.md +0 -18
- package/pipeline/skills/shared/external/swift-concurrency/references/swiftui-concurrency.md +0 -170
- package/pipeline/skills/shared/external/swift-concurrency/references/synchronization-primitives.md +0 -293
- package/pipeline/skills/shared/external/swift-concurrency-fix/SKILL.md +0 -123
- package/pipeline/skills/shared/external/swift-concurrency-fix/evals/evals.json +0 -54
- package/pipeline/skills/shared/external/swift-concurrency-fix/evals/trigger-eval.json +0 -11
- package/pipeline/skills/shared/external/swift-concurrency-fix/references/approachable-concurrency.md +0 -67
- package/pipeline/skills/shared/external/swift-concurrency-fix/references/swift-6-2-concurrency.md +0 -214
- package/pipeline/skills/shared/external/swift-concurrency-fix/references/swiftui-concurrency-tour-wwdc.md +0 -79
- package/pipeline/skills/shared/external/swift-concurrency-review/SKILL.md +0 -148
- package/pipeline/skills/shared/external/swift-concurrency-review/evals/evals.json +0 -57
- package/pipeline/skills/shared/external/swift-concurrency-review/references/actors.md +0 -170
- package/pipeline/skills/shared/external/swift-concurrency-review/references/async-streams.md +0 -66
- package/pipeline/skills/shared/external/swift-concurrency-review/references/bridging.md +0 -100
- package/pipeline/skills/shared/external/swift-concurrency-review/references/bug-patterns.md +0 -138
- package/pipeline/skills/shared/external/swift-concurrency-review/references/cancellation.md +0 -114
- package/pipeline/skills/shared/external/swift-concurrency-review/references/diagnostics.md +0 -93
- package/pipeline/skills/shared/external/swift-concurrency-review/references/hotspots.md +0 -63
- package/pipeline/skills/shared/external/swift-concurrency-review/references/interop.md +0 -146
- package/pipeline/skills/shared/external/swift-concurrency-review/references/new-features.md +0 -256
- package/pipeline/skills/shared/external/swift-concurrency-review/references/structured.md +0 -113
- package/pipeline/skills/shared/external/swift-concurrency-review/references/testing.md +0 -244
- package/pipeline/skills/shared/external/swift-concurrency-review/references/unstructured.md +0 -69
- package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +0 -296
- package/pipeline/skills/shared/external/swift-formatstyle/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/swift-formatstyle/references/formatstyle-examples.md +0 -113
- package/pipeline/skills/shared/external/swift-language/SKILL.md +0 -406
- package/pipeline/skills/shared/external/swift-language/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swift-language/references/code-examples.md +0 -65
- package/pipeline/skills/shared/external/swift-language/references/swift-attributes-interop.md +0 -127
- package/pipeline/skills/shared/external/swift-language/references/swift-patterns-extended.md +0 -489
- package/pipeline/skills/shared/external/swift-security/SKILL.md +0 -217
- package/pipeline/skills/shared/external/swift-security/evals/evals.json +0 -48
- package/pipeline/skills/shared/external/swift-security/references/biometric-authentication.md +0 -456
- package/pipeline/skills/shared/external/swift-security/references/certificate-trust.md +0 -563
- package/pipeline/skills/shared/external/swift-security/references/common-anti-patterns.md +0 -457
- package/pipeline/skills/shared/external/swift-security/references/compliance-owasp-mapping.md +0 -382
- package/pipeline/skills/shared/external/swift-security/references/credential-storage-patterns.md +0 -773
- package/pipeline/skills/shared/external/swift-security/references/cryptokit-public-key.md +0 -485
- package/pipeline/skills/shared/external/swift-security/references/cryptokit-symmetric.md +0 -445
- package/pipeline/skills/shared/external/swift-security/references/keychain-access-control.md +0 -438
- package/pipeline/skills/shared/external/swift-security/references/keychain-fundamentals.md +0 -521
- package/pipeline/skills/shared/external/swift-security/references/keychain-item-classes.md +0 -531
- package/pipeline/skills/shared/external/swift-security/references/keychain-sharing.md +0 -417
- package/pipeline/skills/shared/external/swift-security/references/migration-legacy-stores.md +0 -530
- package/pipeline/skills/shared/external/swift-security/references/secure-enclave.md +0 -522
- package/pipeline/skills/shared/external/swift-security/references/testing-security-code.md +0 -569
- package/pipeline/skills/shared/external/swift-testing/SKILL.md +0 -280
- package/pipeline/skills/shared/external/swift-testing/evals/evals.json +0 -46
- package/pipeline/skills/shared/external/swift-testing/references/testing-advanced.md +0 -129
- package/pipeline/skills/shared/external/swift-testing/references/testing-patterns.md +0 -540
- package/pipeline/skills/shared/external/swift-testing-review/SKILL.md +0 -118
- package/pipeline/skills/shared/external/swift-testing-review/evals/evals.json +0 -59
- package/pipeline/skills/shared/external/swift-testing-review/evals/trigger-eval.json +0 -11
- package/pipeline/skills/shared/external/swift-testing-review/references/async-tests.md +0 -256
- package/pipeline/skills/shared/external/swift-testing-review/references/core-rules.md +0 -114
- package/pipeline/skills/shared/external/swift-testing-review/references/migrating-from-xctest.md +0 -51
- package/pipeline/skills/shared/external/swift-testing-review/references/new-features.md +0 -322
- package/pipeline/skills/shared/external/swift-testing-review/references/writing-better-tests.md +0 -293
- package/pipeline/skills/shared/external/swiftdata/SKILL.md +0 -379
- package/pipeline/skills/shared/external/swiftdata/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/swiftdata/references/code-examples.md +0 -140
- package/pipeline/skills/shared/external/swiftdata/references/core-data-coexistence.md +0 -316
- package/pipeline/skills/shared/external/swiftdata/references/indexing.md +0 -82
- package/pipeline/skills/shared/external/swiftdata/references/predicate-pitfalls.md +0 -78
- package/pipeline/skills/shared/external/swiftdata/references/swiftdata-advanced.md +0 -603
- package/pipeline/skills/shared/external/swiftdata/references/swiftdata-queries.md +0 -479
- package/pipeline/skills/shared/external/swiftdata-review/SKILL.md +0 -119
- package/pipeline/skills/shared/external/swiftdata-review/evals/evals.json +0 -50
- package/pipeline/skills/shared/external/swiftdata-review/evals/trigger-eval.json +0 -11
- package/pipeline/skills/shared/external/swiftdata-review/references/cloudkit.md +0 -37
- package/pipeline/skills/shared/external/swiftdata-review/references/indexing.md +0 -33
- package/pipeline/skills/shared/external/swiftdata-review/references/inheritance.md +0 -127
- package/pipeline/skills/shared/external/swiftdata-review/references/model-rules.md +0 -141
- package/pipeline/skills/shared/external/swiftdata-review/references/predicates.md +0 -67
- package/pipeline/skills/shared/external/swiftlint/SKILL.md +0 -288
- package/pipeline/skills/shared/external/swiftlint/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swiftlint/references/adoption-and-configuration.md +0 -241
- package/pipeline/skills/shared/external/swiftlint/references/custom-rules-and-analyze.md +0 -168
- package/pipeline/skills/shared/external/swiftlint/references/plugins-run-scripts-and-integrations.md +0 -300
- package/pipeline/skills/shared/external/swiftlint/references/rule-reference.md +0 -424
- package/pipeline/skills/shared/external/swiftlint/references/rules-suppressions-and-baselines.md +0 -232
- package/pipeline/skills/shared/external/swiftui-animation/SKILL.md +0 -401
- package/pipeline/skills/shared/external/swiftui-animation/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/swiftui-animation/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/swiftui-animation/references/animation-advanced.md +0 -562
- package/pipeline/skills/shared/external/swiftui-animation/references/core-animation-bridge.md +0 -519
- package/pipeline/skills/shared/external/swiftui-animation/references/scroll-effects.md +0 -197
- package/pipeline/skills/shared/external/swiftui-feature-builder/SKILL.md +0 -105
- package/pipeline/skills/shared/external/swiftui-feature-builder/evals/evals.json +0 -55
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/accessibility-patterns.md +0 -208
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/animation-advanced.md +0 -140
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/animation-basics.md +0 -229
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/animation-transitions.md +0 -216
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/charts-accessibility.md +0 -186
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/charts.md +0 -559
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/image-optimization.md +0 -189
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/latest-apis.md +0 -361
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/layout-best-practices.md +0 -238
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/liquid-glass.md +0 -33
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/list-patterns.md +0 -346
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/macos-scenes.md +0 -258
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/macos-views.md +0 -270
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/macos-window-styling.md +0 -216
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/performance-patterns.md +0 -364
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/scroll-patterns.md +0 -209
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/sheet-navigation-patterns.md +0 -307
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/state-management.md +0 -371
- package/pipeline/skills/shared/external/swiftui-feature-builder/references/view-structure.md +0 -342
- package/pipeline/skills/shared/external/swiftui-flow-recipes/SKILL.md +0 -110
- package/pipeline/skills/shared/external/swiftui-flow-recipes/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/app-wiring.md +0 -218
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/async-state.md +0 -111
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/components-index.md +0 -63
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/controls.md +0 -58
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/deeplinks.md +0 -77
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/focus.md +0 -118
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/form.md +0 -114
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/grids.md +0 -69
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/haptics.md +0 -9
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/input-toolbar.md +0 -64
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/lightweight-clients.md +0 -119
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/list.md +0 -85
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/loading-placeholders.md +0 -49
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/macos-settings.md +0 -71
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/matched-transitions.md +0 -76
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/media.md +0 -81
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/menu-bar.md +0 -115
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/navigationstack.md +0 -185
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/overlay.md +0 -48
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/performance.md +0 -64
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/previews.md +0 -48
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/scroll-reveal.md +0 -138
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/scrollview.md +0 -94
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/searchable.md +0 -86
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/sheets.md +0 -198
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/split-views.md +0 -75
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/tabview.md +0 -124
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/theming.md +0 -76
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/title-menus.md +0 -83
- package/pipeline/skills/shared/external/swiftui-flow-recipes/references/top-bar.md +0 -65
- package/pipeline/skills/shared/external/swiftui-gestures/SKILL.md +0 -364
- package/pipeline/skills/shared/external/swiftui-gestures/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/swiftui-gestures/references/gesture-patterns.md +0 -364
- package/pipeline/skills/shared/external/swiftui-glass-effects/SKILL.md +0 -247
- package/pipeline/skills/shared/external/swiftui-glass-effects/evals/evals.json +0 -47
- package/pipeline/skills/shared/external/swiftui-glass-effects/evals/trigger-eval.json +0 -22
- package/pipeline/skills/shared/external/swiftui-glass-effects/references/liquid-glass.md +0 -468
- package/pipeline/skills/shared/external/swiftui-glass-effects/references/uikit-glass.md +0 -241
- package/pipeline/skills/shared/external/swiftui-layout-components/SKILL.md +0 -353
- package/pipeline/skills/shared/external/swiftui-layout-components/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/swiftui-layout-components/references/form.md +0 -123
- package/pipeline/skills/shared/external/swiftui-layout-components/references/grids.md +0 -179
- package/pipeline/skills/shared/external/swiftui-layout-components/references/list.md +0 -87
- package/pipeline/skills/shared/external/swiftui-layout-components/references/scrollview.md +0 -161
- package/pipeline/skills/shared/external/swiftui-navigation/SKILL.md +0 -297
- package/pipeline/skills/shared/external/swiftui-navigation/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swiftui-navigation/references/deeplinks.md +0 -206
- package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +0 -187
- package/pipeline/skills/shared/external/swiftui-navigation/references/sheets.md +0 -217
- package/pipeline/skills/shared/external/swiftui-navigation/references/tabview.md +0 -161
- package/pipeline/skills/shared/external/swiftui-patterns/SKILL.md +0 -460
- package/pipeline/skills/shared/external/swiftui-patterns/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/swiftui-patterns/references/architecture-patterns.md +0 -581
- package/pipeline/skills/shared/external/swiftui-patterns/references/deprecated-migration.md +0 -965
- package/pipeline/skills/shared/external/swiftui-patterns/references/platform-and-sharing.md +0 -634
- package/pipeline/skills/shared/external/swiftui-performance/SKILL.md +0 -314
- package/pipeline/skills/shared/external/swiftui-performance/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swiftui-performance/references/demystify-swiftui-performance-wwdc23.md +0 -142
- package/pipeline/skills/shared/external/swiftui-performance/references/optimizing-swiftui-performance-instruments.md +0 -139
- package/pipeline/skills/shared/external/swiftui-performance/references/understanding-hangs-in-your-app.md +0 -156
- package/pipeline/skills/shared/external/swiftui-performance/references/understanding-improving-swiftui-performance.md +0 -99
- package/pipeline/skills/shared/external/swiftui-performance/references/wwdc-session-sources.md +0 -21
- package/pipeline/skills/shared/external/swiftui-performance-triage/SKILL.md +0 -107
- package/pipeline/skills/shared/external/swiftui-performance-triage/evals/evals.json +0 -55
- package/pipeline/skills/shared/external/swiftui-performance-triage/references/audit-layout.md +0 -50
- package/pipeline/skills/shared/external/swiftui-performance-triage/references/capture-checklist.md +0 -51
- package/pipeline/skills/shared/external/swiftui-performance-triage/references/hangs.md +0 -34
- package/pipeline/skills/shared/external/swiftui-performance-triage/references/instruments-guide.md +0 -68
- package/pipeline/skills/shared/external/swiftui-performance-triage/references/smell-catalog.md +0 -191
- package/pipeline/skills/shared/external/swiftui-performance-triage/references/update-model.md +0 -69
- package/pipeline/skills/shared/external/swiftui-review/SKILL.md +0 -111
- package/pipeline/skills/shared/external/swiftui-review/evals/evals.json +0 -45
- package/pipeline/skills/shared/external/swiftui-review/references/accessibility.md +0 -40
- package/pipeline/skills/shared/external/swiftui-review/references/api.md +0 -84
- package/pipeline/skills/shared/external/swiftui-review/references/data.md +0 -63
- package/pipeline/skills/shared/external/swiftui-review/references/design.md +0 -45
- package/pipeline/skills/shared/external/swiftui-review/references/hygiene.md +0 -18
- package/pipeline/skills/shared/external/swiftui-review/references/navigation.md +0 -24
- package/pipeline/skills/shared/external/swiftui-review/references/performance.md +0 -62
- package/pipeline/skills/shared/external/swiftui-review/references/swift.md +0 -84
- package/pipeline/skills/shared/external/swiftui-review/references/views.md +0 -60
- package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +0 -311
- package/pipeline/skills/shared/external/swiftui-uikit-interop/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swiftui-uikit-interop/references/hosting-migration.md +0 -361
- package/pipeline/skills/shared/external/swiftui-uikit-interop/references/interop-code.md +0 -198
- package/pipeline/skills/shared/external/swiftui-uikit-interop/references/representable-recipes.md +0 -747
- package/pipeline/skills/shared/external/swiftui-view-splitting/SKILL.md +0 -242
- package/pipeline/skills/shared/external/swiftui-view-splitting/evals/evals.json +0 -56
- package/pipeline/skills/shared/external/swiftui-view-splitting/references/mv-patterns.md +0 -188
- package/pipeline/skills/shared/external/swiftui-webkit/SKILL.md +0 -229
- package/pipeline/skills/shared/external/swiftui-webkit/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/swiftui-webkit/references/loading-and-observation.md +0 -148
- package/pipeline/skills/shared/external/swiftui-webkit/references/local-content-and-custom-schemes.md +0 -98
- package/pipeline/skills/shared/external/swiftui-webkit/references/migration-and-fallbacks.md +0 -97
- package/pipeline/skills/shared/external/swiftui-webkit/references/navigation-and-javascript.md +0 -147
- package/pipeline/skills/shared/external/tailwind-styling/SKILL.md +0 -240
- package/pipeline/skills/shared/external/tailwind-styling/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/tailwind-styling/evals/trigger-eval.json +0 -11
- package/pipeline/skills/shared/external/tailwind-styling/references/code-examples.md +0 -91
- package/pipeline/skills/shared/external/test-result-triage/SKILL.md +0 -160
- package/pipeline/skills/shared/external/test-result-triage/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/testing-backend/SKILL.md +0 -196
- package/pipeline/skills/shared/external/testing-backend/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/testing-backend/references/testing-examples.md +0 -266
- package/pipeline/skills/shared/external/thesis-writing/SKILL.md +0 -140
- package/pipeline/skills/shared/external/thesis-writing/evals/evals.json +0 -40
- package/pipeline/skills/shared/external/thesis-writing/references/review-checklist.md +0 -33
- package/pipeline/skills/shared/external/thesis-writing/references/turkish-thesis-conventions.md +0 -65
- package/pipeline/skills/shared/external/tipkit/SKILL.md +0 -381
- package/pipeline/skills/shared/external/tipkit/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/tipkit/references/tipkit-patterns.md +0 -658
- package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +0 -258
- package/pipeline/skills/shared/external/typescript-patterns/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/typescript-patterns/references/code-examples.md +0 -100
- package/pipeline/skills/shared/external/valven-rules/SKILL.md +0 -93
- package/pipeline/skills/shared/external/valven-rules/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/valven-rules/references/rules.yml +0 -186
- package/pipeline/skills/shared/external/vision-framework/SKILL.md +0 -346
- package/pipeline/skills/shared/external/vision-framework/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/vision-framework/references/code-examples.md +0 -26
- package/pipeline/skills/shared/external/vision-framework/references/vision-requests.md +0 -631
- package/pipeline/skills/shared/external/vision-framework/references/visionkit-scanner.md +0 -573
- package/pipeline/skills/shared/external/vue-composition/SKILL.md +0 -212
- package/pipeline/skills/shared/external/vue-composition/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/vue-composition/references/vue-examples.md +0 -187
- package/pipeline/skills/shared/external/weatherkit/SKILL.md +0 -256
- package/pipeline/skills/shared/external/weatherkit/evals/evals.json +0 -42
- package/pipeline/skills/shared/external/weatherkit/references/weatherkit-patterns.md +0 -459
- package/pipeline/skills/shared/external/web-accessibility/SKILL.md +0 -209
- package/pipeline/skills/shared/external/web-accessibility/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/web-accessibility/references/a11y-examples.md +0 -178
- package/pipeline/skills/shared/external/web-performance/SKILL.md +0 -290
- package/pipeline/skills/shared/external/web-performance/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/web-performance/references/code-examples.md +0 -77
- package/pipeline/skills/shared/external/web-testing/SKILL.md +0 -270
- package/pipeline/skills/shared/external/web-testing/evals/evals.json +0 -43
- package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +0 -213
- package/pipeline/skills/shared/external/widgetkit/SKILL.md +0 -365
- package/pipeline/skills/shared/external/widgetkit/evals/evals.json +0 -44
- package/pipeline/skills/shared/external/widgetkit/references/widgetkit-advanced.md +0 -801
|
@@ -1,2018 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* @file disk-cleaner.mjs - frees disk space on a macOS developer machine by
|
|
4
|
-
* deleting regenerable data from a fixed category allowlist, and nothing else.
|
|
5
|
-
*
|
|
6
|
-
* Measure first: the default run is a dry run that lists every candidate with
|
|
7
|
-
* its size and category, writes a JSON report and deletes nothing. `--apply`
|
|
8
|
-
* deletes the listed candidates; each category can be left out with --skip.
|
|
9
|
-
*
|
|
10
|
-
* Safety rules, enforced on every candidate at plan time and again right
|
|
11
|
-
* before it is deleted:
|
|
12
|
-
* - a symlink is never followed and never deleted; a category root that is a
|
|
13
|
-
* symlink is skipped whole
|
|
14
|
-
* - the real path must sit strictly inside one of the category's roots
|
|
15
|
-
* - never under ~/Documents, ~/Desktop, ~/Downloads, ~/Pictures, ~/Movies,
|
|
16
|
-
* ~/Music, iCloud Drive or CloudStorage, keychains, ~/.ssh, credential
|
|
17
|
-
* folders, or a memory folder under ~/.claude/projects
|
|
18
|
-
* - never a directory that is a git working tree, except a worktree under
|
|
19
|
-
* <repo>/.claude/worktrees that is clean, merged and not in use, removed
|
|
20
|
-
* through `git worktree remove`
|
|
21
|
-
* - never a file the user does not own, and never a path an open file
|
|
22
|
-
* handle or a running command line points into
|
|
23
|
-
*
|
|
24
|
-
* The Trash and old session transcripts are opt-in (--trash, --transcripts):
|
|
25
|
-
* the Trash holds the user's own files, and resume and past-session search
|
|
26
|
-
* read the transcripts. Processes are never stopped: orphaned children of
|
|
27
|
-
* ended sessions are listed in the report under `orphans` as information, and
|
|
28
|
-
* nothing here can signal a process. Unattended runs (--unattended or
|
|
29
|
-
* MULTI_AGENT_UNATTENDED=1) keep to UNATTENDED_SAFE and never touch the Trash,
|
|
30
|
-
* transcripts, worktrees, archives, device support or simulator runtimes.
|
|
31
|
-
*
|
|
32
|
-
* An item kept only because it was touched recently is measured and reported
|
|
33
|
-
* under `held`; --include-recent drops that age guard for one run (never
|
|
34
|
-
* unattended). Items in use, the current session's scratch and any session
|
|
35
|
-
* scratch touched within --scratch-hours (it may belong to another open
|
|
36
|
-
* session) stay held at any age. Folders the scan could not read are counted under `unreadable`.
|
|
37
|
-
*
|
|
38
|
-
* Deletion uses fs.rmSync, which unlinks a symlink instead of entering it.
|
|
39
|
-
* Pipeline scratch under /tmp and per-task pipeline logs are delegated to
|
|
40
|
-
* gc-tmp.sh and prune-logs.sh when those are installed, so their own grace
|
|
41
|
-
* windows and resumable-run rules apply.
|
|
42
|
-
*
|
|
43
|
-
* Usage:
|
|
44
|
-
* disk-cleaner.mjs [--dry-run] [--apply] [--only=a,b] [--skip=a,b]
|
|
45
|
-
* [--trash] [--transcripts] [--test-artifacts] [--unattended]
|
|
46
|
-
* [--include-recent]
|
|
47
|
-
* [--log-days=N] [--archive-days=N] [--transcript-days=N]
|
|
48
|
-
* [--artifact-days=N]
|
|
49
|
-
* [--scratch-hours=N] [--build-hours=N] [--orphan-minutes=N]
|
|
50
|
-
* [--runtime-days=N] [--depth=N] [--exclude=PATH]...
|
|
51
|
-
* [--root=DIR]... [--tmp-root=DIR]... [--artifact-root=DIR]...
|
|
52
|
-
* [--home=DIR]
|
|
53
|
-
* [--report=FILE] [--json] [--list] [--top=N]
|
|
54
|
-
*
|
|
55
|
-
* --root and --depth (defaults: the git repos under the usual dev folders,
|
|
56
|
-
* depth 8) also come from DISK_CLEANER_ROOTS (colon-separated) and
|
|
57
|
-
* DISK_CLEANER_DEPTH; --exclude from DISK_CLEANER_EXCLUDE (colon-separated).
|
|
58
|
-
* An excluded path, and any candidate that holds it, is kept.
|
|
59
|
-
*
|
|
60
|
-
* --artifact-root, also DISK_CLEANER_ARTIFACT_ROOTS (colon-separated), adds a
|
|
61
|
-
* tree to search for test run output beside the dev roots. It is where a
|
|
62
|
-
* harness that keeps its results outside a repository is named, so no product's
|
|
63
|
-
* paths live in this file.
|
|
64
|
-
*
|
|
65
|
-
* Every category in the JSON report carries `top` (its largest items, real
|
|
66
|
-
* paths and sizes, 5 unless --top says otherwise), `more` (how many items
|
|
67
|
-
* `top` leaves out) and `kept` (how many items were kept, per reason). The
|
|
68
|
-
* report also carries `reclaimableBytes` (categories whose tool is running
|
|
69
|
-
* are measured but left out), `disk.expectedFreeBytes`, `held` (items, bytes,
|
|
70
|
-
* how many only age holds and their bytes, how many are in use) and
|
|
71
|
-
* `unreadable` (count and a sample). --top=N also lists
|
|
72
|
-
* the top items under each row of the text table.
|
|
73
|
-
*
|
|
74
|
-
* Exit: 0 done, 1 one or more deletions failed, 2 usage error.
|
|
75
|
-
*
|
|
76
|
-
* @module disk-cleaner
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
import { spawnSync } from "node:child_process";
|
|
80
|
-
import {
|
|
81
|
-
closeSync,
|
|
82
|
-
existsSync,
|
|
83
|
-
lstatSync,
|
|
84
|
-
mkdirSync,
|
|
85
|
-
openSync,
|
|
86
|
-
readdirSync,
|
|
87
|
-
realpathSync,
|
|
88
|
-
readFileSync,
|
|
89
|
-
readSync,
|
|
90
|
-
rmSync,
|
|
91
|
-
statfsSync,
|
|
92
|
-
writeFileSync,
|
|
93
|
-
} from "node:fs";
|
|
94
|
-
import { homedir, tmpdir } from "node:os";
|
|
95
|
-
import { basename, dirname, join, sep } from "node:path";
|
|
96
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
97
|
-
|
|
98
|
-
export const VERSION = "1.2.0";
|
|
99
|
-
const DAY_MS = 86_400_000;
|
|
100
|
-
const HOUR_MS = 3_600_000;
|
|
101
|
-
const MAX_WALK_DEPTH = 8;
|
|
102
|
-
const DEFAULT_RUNTIME_DAYS = 30;
|
|
103
|
-
const KEEP_REPORTS = 20;
|
|
104
|
-
const DEFAULT_TOP = 5;
|
|
105
|
-
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
106
|
-
|
|
107
|
-
/** Folders under $HOME that hold the user's own files or secrets. */
|
|
108
|
-
export const PROTECTED_HOME = [
|
|
109
|
-
"Documents",
|
|
110
|
-
"Desktop",
|
|
111
|
-
"Downloads",
|
|
112
|
-
"Pictures",
|
|
113
|
-
"Movies",
|
|
114
|
-
"Music",
|
|
115
|
-
"Library/Mobile Documents",
|
|
116
|
-
"Library/CloudStorage",
|
|
117
|
-
"Library/Keychains",
|
|
118
|
-
"Library/Application Support/MobileSync",
|
|
119
|
-
".ssh",
|
|
120
|
-
".gnupg",
|
|
121
|
-
".aws",
|
|
122
|
-
".kube",
|
|
123
|
-
".docker",
|
|
124
|
-
".config/gh",
|
|
125
|
-
".netrc",
|
|
126
|
-
];
|
|
127
|
-
const MEMORY_DIR = /\/\.claude\/projects\/[^/]+\/memory(\/|$)/;
|
|
128
|
-
|
|
129
|
-
/** Cache folders under ~/Library/Caches that belong to developer tools. */
|
|
130
|
-
export const DEV_CACHE_DIRS = [
|
|
131
|
-
"com.apple.dt.Xcode",
|
|
132
|
-
"com.apple.dt.instruments",
|
|
133
|
-
"JetBrains",
|
|
134
|
-
"ms-playwright",
|
|
135
|
-
"ms-playwright-go",
|
|
136
|
-
"node-gyp",
|
|
137
|
-
"typescript",
|
|
138
|
-
"pip",
|
|
139
|
-
"go-build",
|
|
140
|
-
"com.microsoft.VSCode.ShipIt",
|
|
141
|
-
];
|
|
142
|
-
|
|
143
|
-
const WALK_SKIP = new Set([".git", "node_modules", ".build", "DerivedData", "Pods", "build"]);
|
|
144
|
-
|
|
145
|
-
// Never walked when a dev root contains them: app data, installed apps, media
|
|
146
|
-
// libraries and the user's own folders hold no project build output.
|
|
147
|
-
const DEV_WALK_PRUNE_HOME = ["Library", ".Trash", "Applications", ...PROTECTED_HOME];
|
|
148
|
-
const MEDIA_LIBRARY = /\.(photoslibrary|musiclibrary|tvlibrary)$/;
|
|
149
|
-
|
|
150
|
-
// Session children that outlive their session: log watchers, a symbol upload
|
|
151
|
-
// that never finished, and the shell wrapper Claude Code starts commands in.
|
|
152
|
-
const ORPHAN_PATTERNS = [
|
|
153
|
-
/^(\S*\/)?tail\s+(?:.*\s)?(-\S*[fF]\S*|--follow)(\s|$)/,
|
|
154
|
-
/(^|\/)upload-symbols(\s|$)/,
|
|
155
|
-
/^(\S*\/)?(ba|z)?sh\s+-c\b.*\/\.claude\/shell-snapshots\//,
|
|
156
|
-
];
|
|
157
|
-
|
|
158
|
-
// ---------------------------------------------------------------- utilities
|
|
159
|
-
|
|
160
|
-
function lstatOrNull(p) {
|
|
161
|
-
try {
|
|
162
|
-
return lstatSync(p);
|
|
163
|
-
} catch {
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function nativeReal(p) {
|
|
169
|
-
try {
|
|
170
|
-
return realpathSync.native(p);
|
|
171
|
-
} catch {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function realOrNull(p) {
|
|
177
|
-
try {
|
|
178
|
-
return realpathSync(p);
|
|
179
|
-
} catch {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function noteDenied(ctx, dir, e) {
|
|
185
|
-
if (ctx?.denied && (e?.code === "EACCES" || e?.code === "EPERM")) ctx.denied.add(dir);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function listDir(dir, ctx) {
|
|
189
|
-
try {
|
|
190
|
-
return readdirSync(dir).map((n) => join(dir, n));
|
|
191
|
-
} catch (e) {
|
|
192
|
-
noteDenied(ctx, dir, e);
|
|
193
|
-
return [];
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/** /tmp and /var are links to /private on macOS; compare in one spelling. */
|
|
198
|
-
export function normalizeTmp(p) {
|
|
199
|
-
return String(p).replace(/^\/(tmp|var|etc)(\/|$)/, "/private/$1$2");
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function inside(child, parent) {
|
|
203
|
-
return child.startsWith(parent.endsWith(sep) ? parent : parent + sep);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/** Seconds from a ps etime field: [[dd-]hh:]mm:ss. */
|
|
207
|
-
export function parseEtime(s) {
|
|
208
|
-
const m = /^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/.exec(String(s).trim());
|
|
209
|
-
if (!m) return 0;
|
|
210
|
-
const [, d, h, mi, se] = m;
|
|
211
|
-
return Number(d || 0) * 86400 + Number(h || 0) * 3600 + Number(mi) * 60 + Number(se);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export function human(bytes) {
|
|
215
|
-
if (bytes == null) return "?";
|
|
216
|
-
if (bytes >= 1e9) return `${(bytes / 1e9).toFixed(1)} GB`;
|
|
217
|
-
if (bytes >= 1e6) return `${Math.round(bytes / 1e6)} MB`;
|
|
218
|
-
return `${Math.round(bytes / 1e3)} KB`;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function realRun(cmd, args, opts = {}) {
|
|
222
|
-
const r = spawnSync(cmd, args, {
|
|
223
|
-
encoding: "utf8",
|
|
224
|
-
timeout: opts.timeout ?? 120_000,
|
|
225
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
226
|
-
...opts,
|
|
227
|
-
});
|
|
228
|
-
return { status: r.status ?? 127, stdout: r.stdout || "", stderr: r.stderr || "" };
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function realPs() {
|
|
232
|
-
const r = realRun("ps", ["-axww", "-o", "pid=,ppid=,uid=,etime=,command="], { timeout: 10_000 });
|
|
233
|
-
if (r.status !== 0) return [];
|
|
234
|
-
const rows = [];
|
|
235
|
-
for (const line of r.stdout.split("\n")) {
|
|
236
|
-
const m = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/.exec(line);
|
|
237
|
-
if (!m) continue;
|
|
238
|
-
rows.push({
|
|
239
|
-
pid: Number(m[1]),
|
|
240
|
-
ppid: Number(m[2]),
|
|
241
|
-
uid: Number(m[3]),
|
|
242
|
-
etimeSec: parseEtime(m[4]),
|
|
243
|
-
command: m[5],
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
return rows;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function realOpenPaths(uid) {
|
|
250
|
-
const r = realRun("lsof", ["-nP", "-w", "-u", String(uid), "-Fn"], { timeout: 60_000 });
|
|
251
|
-
return r.stdout
|
|
252
|
-
.split("\n")
|
|
253
|
-
.filter((l) => l.startsWith("n/"))
|
|
254
|
-
.map((l) => l.slice(1));
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** Sizes in bytes for many paths, one du call per batch. */
|
|
258
|
-
function duBytes(paths) {
|
|
259
|
-
const out = new Map();
|
|
260
|
-
for (let i = 0; i < paths.length; i += 200) {
|
|
261
|
-
const batch = paths.slice(i, i + 200);
|
|
262
|
-
const r = spawnSync("du", ["-sk", ...batch], {
|
|
263
|
-
encoding: "utf8",
|
|
264
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
265
|
-
});
|
|
266
|
-
for (const line of (r.stdout || "").split("\n")) {
|
|
267
|
-
const tab = line.indexOf("\t");
|
|
268
|
-
if (tab < 0) continue;
|
|
269
|
-
out.set(line.slice(tab + 1), Number(line.slice(0, tab)) * 1024);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return out;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export function diskStatus(path) {
|
|
276
|
-
try {
|
|
277
|
-
const s = statfsSync(path);
|
|
278
|
-
return { freeBytes: s.bavail * s.bsize, totalBytes: s.blocks * s.bsize };
|
|
279
|
-
} catch {
|
|
280
|
-
return { freeBytes: null, totalBytes: null };
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// ---------------------------------------------------------------- context
|
|
285
|
-
|
|
286
|
-
function defaultScriptsDir(home) {
|
|
287
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
288
|
-
if (existsSync(join(here, "gc-tmp.sh"))) return here;
|
|
289
|
-
return join(home, ".claude", "scripts");
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function defaultDevRoots(home) {
|
|
293
|
-
const roots = [];
|
|
294
|
-
const containers = ["", "Developer", "Projects", "src", "code", "repos", "work", "git"];
|
|
295
|
-
for (const c of containers) {
|
|
296
|
-
const dir = c ? join(home, c) : home;
|
|
297
|
-
for (const p of listDir(dir)) {
|
|
298
|
-
const st = lstatOrNull(p);
|
|
299
|
-
if (!st || !st.isDirectory() || st.isSymbolicLink()) continue;
|
|
300
|
-
if (existsSync(join(p, ".git"))) roots.push(p);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return roots;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Everything the planner reads from the machine, injectable so tests run on a
|
|
308
|
-
* temp home with stubbed commands.
|
|
309
|
-
*/
|
|
310
|
-
export function makeContext(o = {}) {
|
|
311
|
-
const home = o.home || homedir();
|
|
312
|
-
const uid = o.uid ?? (typeof process.getuid === "function" ? process.getuid() : -1);
|
|
313
|
-
const tmpRoots = o.tmpRoots || [
|
|
314
|
-
...new Set(["/private/tmp", normalizeTmp(realOrNull(tmpdir()) || tmpdir())]),
|
|
315
|
-
];
|
|
316
|
-
let psCache = null;
|
|
317
|
-
let openCache = null;
|
|
318
|
-
let simCache = null;
|
|
319
|
-
const ctx = {
|
|
320
|
-
home,
|
|
321
|
-
realHome: realOrNull(home) || home,
|
|
322
|
-
uid,
|
|
323
|
-
now: o.now ?? Date.now(),
|
|
324
|
-
tmpRoots,
|
|
325
|
-
devRoots: o.devRoots || defaultDevRoots(home),
|
|
326
|
-
artifactRoots: (o.artifactRoots || []).filter(Boolean).map((r) => nativeReal(r) || r),
|
|
327
|
-
scriptsDir: o.scriptsDir || defaultScriptsDir(home),
|
|
328
|
-
sessionId: o.sessionId ?? process.env.CLAUDE_CODE_SESSION_ID ?? "",
|
|
329
|
-
days: {
|
|
330
|
-
logs: o.logDays ?? 30,
|
|
331
|
-
archives: o.archiveDays ?? 90,
|
|
332
|
-
transcripts: o.transcriptDays ?? 90,
|
|
333
|
-
artifacts: o.artifactDays ?? 7,
|
|
334
|
-
},
|
|
335
|
-
includeRecent: Boolean(o.includeRecent),
|
|
336
|
-
scratchHours: o.scratchHours ?? 48,
|
|
337
|
-
repoBuildHours: o.repoBuildHours ?? 12,
|
|
338
|
-
tmpGraceMinutes: o.tmpGraceMinutes ?? 120,
|
|
339
|
-
orphanMinutes: o.orphanMinutes ?? 30,
|
|
340
|
-
runtimeDays: o.runtimeDays ?? DEFAULT_RUNTIME_DAYS,
|
|
341
|
-
maxDepth: o.maxDepth ?? MAX_WALK_DEPTH,
|
|
342
|
-
excludes: (o.excludes || []).filter(Boolean).map((p) => nativeReal(p) || p),
|
|
343
|
-
denied: new Set(),
|
|
344
|
-
trackedCache: new Map(),
|
|
345
|
-
run: o.run || realRun,
|
|
346
|
-
du: o.du || duBytes,
|
|
347
|
-
ps: () => (psCache ??= (o.ps || realPs)()),
|
|
348
|
-
openPaths: () =>
|
|
349
|
-
(openCache ??= (o.openPaths || (() => realOpenPaths(uid)))().map(normalizeTmp)),
|
|
350
|
-
simDevices: () => (simCache ??= [readSimDevices(ctx)])[0],
|
|
351
|
-
resetProbes() {
|
|
352
|
-
psCache = null;
|
|
353
|
-
openCache = null;
|
|
354
|
-
simCache = null;
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
|
-
return ctx;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function has(ctx, cmd) {
|
|
361
|
-
return ctx.run("/usr/bin/which", [cmd], { timeout: 5000 }).status === 0;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/** True when an open file or a running command line points into `path`. */
|
|
365
|
-
export function inUse(ctx, path) {
|
|
366
|
-
const p = normalizeTmp(path);
|
|
367
|
-
for (const open of ctx.openPaths()) if (open === p || inside(open, p)) return true;
|
|
368
|
-
for (const row of ctx.ps()) {
|
|
369
|
-
if (row.pid === process.pid) continue;
|
|
370
|
-
const cmd = normalizeTmp(row.command.replace(/\s\/(tmp|var)\//g, " /private/$1/"));
|
|
371
|
-
if (cmd.includes(p + "/") || cmd.endsWith(p) || cmd.includes(p + " ")) return true;
|
|
372
|
-
}
|
|
373
|
-
return false;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// ---------------------------------------------------------------- the guard
|
|
377
|
-
|
|
378
|
-
function protectedHit(real, ctx) {
|
|
379
|
-
for (const rel of PROTECTED_HOME) {
|
|
380
|
-
const p = join(ctx.realHome, rel);
|
|
381
|
-
if (real === p || inside(real, p)) return `~/${rel}`;
|
|
382
|
-
}
|
|
383
|
-
if (MEMORY_DIR.test(real)) return "a memory folder";
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Whether `path` may be deleted for a category whose roots are `roots`.
|
|
389
|
-
* @returns {{ok: true, real: string} | {ok: false, reason: string}}
|
|
390
|
-
*/
|
|
391
|
-
export function guardPath(path, ctx, roots) {
|
|
392
|
-
const st = lstatOrNull(path);
|
|
393
|
-
if (!st) return { ok: false, reason: "missing" };
|
|
394
|
-
if (st.isSymbolicLink()) return { ok: false, reason: "symlink, not followed" };
|
|
395
|
-
const real = realOrNull(path);
|
|
396
|
-
if (!real) return { ok: false, reason: "unresolvable path" };
|
|
397
|
-
const hit = protectedHit(real, ctx);
|
|
398
|
-
if (hit) return { ok: false, reason: `protected: ${hit}` };
|
|
399
|
-
const realRoots = roots.map(realOrNull).filter(Boolean);
|
|
400
|
-
if (!realRoots.some((r) => inside(real, r))) {
|
|
401
|
-
return { ok: false, reason: "outside the category roots" };
|
|
402
|
-
}
|
|
403
|
-
if (ctx.uid >= 0 && st.uid !== ctx.uid) return { ok: false, reason: "not owned by you" };
|
|
404
|
-
if (st.isDirectory() && existsSync(join(real, ".git"))) {
|
|
405
|
-
return { ok: false, reason: "git working tree" };
|
|
406
|
-
}
|
|
407
|
-
return { ok: true, real };
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// ---------------------------------------------------------------- discovery
|
|
411
|
-
|
|
412
|
-
function rootUsable(root, ctx, out) {
|
|
413
|
-
const st = lstatOrNull(root);
|
|
414
|
-
if (!st) return false;
|
|
415
|
-
if (st.isSymbolicLink()) {
|
|
416
|
-
out.skipped.push({ path: root, reason: "category root is a symlink, not followed" });
|
|
417
|
-
return false;
|
|
418
|
-
}
|
|
419
|
-
const real = realOrNull(root);
|
|
420
|
-
const hit = real && protectedHit(real, ctx);
|
|
421
|
-
if (hit) {
|
|
422
|
-
out.skipped.push({ path: root, reason: `protected: ${hit}` });
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
425
|
-
return st.isDirectory();
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
function addPath(out, ctx, path, roots, extra = {}) {
|
|
429
|
-
const g = guardPath(path, ctx, roots);
|
|
430
|
-
if (!g.ok) {
|
|
431
|
-
out.skipped.push({ path, reason: g.reason });
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
out.candidates.push({ kind: "path", path: g.real, roots, ...extra });
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function childrenOf(ctx, out, roots, filter = () => true) {
|
|
438
|
-
for (const root of roots) {
|
|
439
|
-
if (!rootUsable(root, ctx, out)) continue;
|
|
440
|
-
for (const p of listDir(root, ctx)) if (filter(p)) addPath(out, ctx, p, [root]);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
function hold(out, path, reason, held, bytes) {
|
|
445
|
-
out.skipped.push(bytes == null ? { path, reason, held } : { path, reason, held, bytes });
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
/** Whether a dev-root walk stays out of `dir`. */
|
|
449
|
-
function devPruned(ctx, dir, name) {
|
|
450
|
-
if (MEDIA_LIBRARY.test(name)) return true;
|
|
451
|
-
return DEV_WALK_PRUNE_HOME.some(
|
|
452
|
-
(rel) => dir === join(ctx.home, rel) || dir === join(ctx.realHome, rel),
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
function walk(dir, visit, { ctx, maxDepth = MAX_WALK_DEPTH, prune } = {}, depth = 0) {
|
|
457
|
-
if (depth > maxDepth) return;
|
|
458
|
-
let entries;
|
|
459
|
-
try {
|
|
460
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
461
|
-
} catch (e) {
|
|
462
|
-
noteDenied(ctx, dir, e);
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
for (const e of entries) {
|
|
466
|
-
const p = join(dir, e.name);
|
|
467
|
-
if (e.isSymbolicLink()) continue;
|
|
468
|
-
if (e.isDirectory()) {
|
|
469
|
-
if (WALK_SKIP.has(e.name) || prune?.(p, e.name)) continue;
|
|
470
|
-
walk(p, visit, { ctx, maxDepth, prune }, depth + 1);
|
|
471
|
-
} else if (e.isFile()) visit(p);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/** The age guard: false for every item when the run includes recent ones. */
|
|
476
|
-
function touchedWithin(ctx, mtimeMs, ms) {
|
|
477
|
-
return !ctx.includeRecent && ctx.now - mtimeMs < ms;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function olderThan(path, ms, ctx) {
|
|
481
|
-
const st = lstatOrNull(path);
|
|
482
|
-
return Boolean(st) && ctx.now - st.mtimeMs > ms;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
function newestMtime(path, depth) {
|
|
486
|
-
const st = lstatOrNull(path);
|
|
487
|
-
if (!st) return 0;
|
|
488
|
-
let t = st.mtimeMs;
|
|
489
|
-
if (depth > 0 && st.isDirectory()) {
|
|
490
|
-
for (const c of listDir(path)) t = Math.max(t, newestMtime(c, depth - 1));
|
|
491
|
-
}
|
|
492
|
-
return t;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
function processRunning(ctx, test) {
|
|
496
|
-
return ctx.ps().some((r) => (ctx.uid < 0 || r.uid === ctx.uid) && test(r));
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
const exeIs =
|
|
500
|
-
(...names) =>
|
|
501
|
-
(r) =>
|
|
502
|
-
names.includes(basename(r.command.split(/\s+/)[0] || ""));
|
|
503
|
-
|
|
504
|
-
const H = (ctx, ...rel) => join(ctx.home, ...rel);
|
|
505
|
-
|
|
506
|
-
function commandCandidate(out, ctx, { tool, args, measure, label }) {
|
|
507
|
-
const bytes = measure.filter((p) => existsSync(p));
|
|
508
|
-
out.candidates.push({ kind: "command", cmd: tool, args, path: label, measure: bytes });
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
function cacheWithTool(ctx, out, tool, args, dir) {
|
|
512
|
-
if (!existsSync(dir)) return;
|
|
513
|
-
if (!rootUsable(dir, ctx, out)) return;
|
|
514
|
-
if (has(ctx, tool)) {
|
|
515
|
-
commandCandidate(out, ctx, { tool, args, measure: [dir], label: `${tool} ${args.join(" ")}` });
|
|
516
|
-
} else {
|
|
517
|
-
childrenOf(ctx, out, [dir]);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function devicePairedVersions(ctx) {
|
|
522
|
-
const r = ctx.run("xcrun", ["xctrace", "list", "devices"], { timeout: 60_000 });
|
|
523
|
-
if (r.status !== 0) return null;
|
|
524
|
-
const versions = new Set();
|
|
525
|
-
let section = "";
|
|
526
|
-
for (const line of r.stdout.split("\n")) {
|
|
527
|
-
const h = /^==\s*(.+?)\s*==$/.exec(line.trim());
|
|
528
|
-
if (h) {
|
|
529
|
-
section = h[1];
|
|
530
|
-
continue;
|
|
531
|
-
}
|
|
532
|
-
if (/simulator/i.test(section)) continue;
|
|
533
|
-
for (const m of line.matchAll(/\((\d+(?:\.\d+)+)\)/g)) versions.add(m[1]);
|
|
534
|
-
}
|
|
535
|
-
return versions;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function gcTmpCandidates(ctx, out) {
|
|
539
|
-
const script = join(ctx.scriptsDir, "gc-tmp.sh");
|
|
540
|
-
if (!existsSync(script)) {
|
|
541
|
-
out.note = "gc-tmp.sh is not installed; pipeline scratch was not measured";
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
const reportFile = join(tmpdir(), `disk-cleaner-gc-${process.pid}-${Date.now()}.jsonl`);
|
|
545
|
-
ctx.run("bash", [script, "--report", reportFile], { timeout: 120_000 });
|
|
546
|
-
const text = readFileSafe(reportFile);
|
|
547
|
-
rmSync(reportFile, { force: true });
|
|
548
|
-
for (const line of text.split("\n")) {
|
|
549
|
-
if (!line.trim()) continue;
|
|
550
|
-
try {
|
|
551
|
-
const row = JSON.parse(line);
|
|
552
|
-
if (row.action !== "would-remove") continue;
|
|
553
|
-
out.candidates.push({
|
|
554
|
-
kind: "delegate",
|
|
555
|
-
tool: "gc-tmp",
|
|
556
|
-
path: row.path,
|
|
557
|
-
bytes: Number(row.sizeKb || 0) * 1024,
|
|
558
|
-
});
|
|
559
|
-
} catch {
|
|
560
|
-
/* a malformed row is not a candidate */
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function pruneLogsCandidates(ctx, out) {
|
|
566
|
-
const script = join(ctx.scriptsDir, "prune-logs.sh");
|
|
567
|
-
if (!existsSync(script)) {
|
|
568
|
-
out.note = "prune-logs.sh is not installed; pipeline task logs were not measured";
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
const logRoot = H(ctx, ".claude", "logs", "multi-agent");
|
|
572
|
-
if (!existsSync(logRoot)) return;
|
|
573
|
-
const r = ctx.run("bash", [script, `--older-than=${ctx.days.logs}`], {
|
|
574
|
-
timeout: 120_000,
|
|
575
|
-
env: { ...process.env, PRUNE_LOG_ROOT: logRoot },
|
|
576
|
-
});
|
|
577
|
-
let listing = false;
|
|
578
|
-
for (const line of r.stdout.split("\n")) {
|
|
579
|
-
if (line.startsWith("DRY-RUN")) {
|
|
580
|
-
listing = true;
|
|
581
|
-
continue;
|
|
582
|
-
}
|
|
583
|
-
if (!listing) continue;
|
|
584
|
-
if (!line.startsWith(" ")) break;
|
|
585
|
-
const rel = line.trim();
|
|
586
|
-
out.candidates.push({ kind: "delegate", tool: "prune-logs", path: join(logRoot, rel), rel });
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
function readFileSafe(p) {
|
|
591
|
-
try {
|
|
592
|
-
return readFileSync(p, "utf8");
|
|
593
|
-
} catch {
|
|
594
|
-
return "";
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
function worktreeCandidates(ctx, out) {
|
|
599
|
-
const bases = ["main", "master", "develop", "origin/main", "origin/master", "origin/develop"];
|
|
600
|
-
for (const repo of ctx.devRoots) {
|
|
601
|
-
const wtRoot = join(repo, ".claude", "worktrees");
|
|
602
|
-
if (!existsSync(wtRoot) || !rootUsable(wtRoot, ctx, out)) continue;
|
|
603
|
-
const list = ctx.run("git", ["-C", repo, "worktree", "list", "--porcelain"]);
|
|
604
|
-
const locked = new Set();
|
|
605
|
-
let current = null;
|
|
606
|
-
for (const line of list.stdout.split("\n")) {
|
|
607
|
-
if (line.startsWith("worktree ")) current = realOrNull(line.slice(9)) || line.slice(9);
|
|
608
|
-
else if (line.startsWith("locked") && current) locked.add(current);
|
|
609
|
-
}
|
|
610
|
-
const knownBases = bases.filter(
|
|
611
|
-
(b) => ctx.run("git", ["-C", repo, "rev-parse", "--verify", "--quiet", b]).status === 0,
|
|
612
|
-
);
|
|
613
|
-
for (const wt of listDir(wtRoot, ctx)) {
|
|
614
|
-
const st = lstatOrNull(wt);
|
|
615
|
-
if (!st || !st.isDirectory()) continue;
|
|
616
|
-
if (st.isSymbolicLink()) {
|
|
617
|
-
out.skipped.push({ path: wt, reason: "symlink, not followed" });
|
|
618
|
-
continue;
|
|
619
|
-
}
|
|
620
|
-
const real = realOrNull(wt);
|
|
621
|
-
const keep = (reason) => out.skipped.push({ path: wt, reason });
|
|
622
|
-
if (!existsSync(join(wt, ".git"))) {
|
|
623
|
-
keep("not a git worktree");
|
|
624
|
-
continue;
|
|
625
|
-
}
|
|
626
|
-
if (locked.has(real)) {
|
|
627
|
-
keep("locked worktree");
|
|
628
|
-
continue;
|
|
629
|
-
}
|
|
630
|
-
if (inUse(ctx, real)) {
|
|
631
|
-
keep("in use by a running process");
|
|
632
|
-
continue;
|
|
633
|
-
}
|
|
634
|
-
const status = ctx.run("git", ["-C", wt, "status", "--porcelain"]);
|
|
635
|
-
if (status.status !== 0) {
|
|
636
|
-
keep("git status failed");
|
|
637
|
-
continue;
|
|
638
|
-
}
|
|
639
|
-
if (status.stdout.trim()) {
|
|
640
|
-
keep("uncommitted changes");
|
|
641
|
-
continue;
|
|
642
|
-
}
|
|
643
|
-
const merged = knownBases.some(
|
|
644
|
-
(b) => ctx.run("git", ["-C", wt, "merge-base", "--is-ancestor", "HEAD", b]).status === 0,
|
|
645
|
-
);
|
|
646
|
-
if (!merged) {
|
|
647
|
-
keep("not merged into main, master or develop");
|
|
648
|
-
continue;
|
|
649
|
-
}
|
|
650
|
-
out.candidates.push({ kind: "worktree", path: real, repo });
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
function dsStoreCandidates(ctx, out) {
|
|
656
|
-
for (const root of ctx.devRoots) {
|
|
657
|
-
if (!rootUsable(root, ctx, out)) continue;
|
|
658
|
-
walk(
|
|
659
|
-
root,
|
|
660
|
-
(p) => {
|
|
661
|
-
if (basename(p) === ".DS_Store") addPath(out, ctx, p, [root]);
|
|
662
|
-
},
|
|
663
|
-
{ ctx, maxDepth: ctx.maxDepth, prune: (p, name) => devPruned(ctx, p, name) },
|
|
664
|
-
);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
// A folder is build output only when it carries what the build tool writes:
|
|
669
|
-
// a hand-made folder that happens to be called `.build` keeps its content.
|
|
670
|
-
const BUILD_SHAPE = {
|
|
671
|
-
".build": [
|
|
672
|
-
"build.db",
|
|
673
|
-
"manifest.db",
|
|
674
|
-
"checkouts",
|
|
675
|
-
"artifacts",
|
|
676
|
-
"repositories",
|
|
677
|
-
"debug",
|
|
678
|
-
"release",
|
|
679
|
-
"index-build",
|
|
680
|
-
"plugins",
|
|
681
|
-
],
|
|
682
|
-
DerivedData: ["Build", "Index.noindex", "ModuleCache.noindex", "info.plist", "SourcePackages"],
|
|
683
|
-
};
|
|
684
|
-
BUILD_SHAPE[".DerivedData"] = BUILD_SHAPE.DerivedData;
|
|
685
|
-
|
|
686
|
-
// Build output under a name nobody can enumerate.
|
|
687
|
-
//
|
|
688
|
-
// Matching on the folder's NAME finds the default layouts and nothing else. A
|
|
689
|
-
// tool that points `-derivedDataPath` somewhere of its own choosing - a test
|
|
690
|
-
// harness giving each lane its own copy, a CI script, a wrapper that keeps one
|
|
691
|
-
// per scheme - writes the same tree under a name this file has never heard of.
|
|
692
|
-
// Measured on one machine: four such copies beside a repository's worktrees
|
|
693
|
-
// held 104 GB, the walk descended through all of it looking for a folder called
|
|
694
|
-
// DerivedData, and the report came back with 11 GB.
|
|
695
|
-
//
|
|
696
|
-
// So the shape decides, not the name. Both tools write a signature no source
|
|
697
|
-
// tree carries: Xcode writes `Build` beside its `.noindex` caches, SwiftPM a
|
|
698
|
-
// `build.db` beside its manifest and checkouts. `Build` or `build.db` is tested
|
|
699
|
-
// first, one stat, and the rest only when that hits - so an ordinary directory
|
|
700
|
-
// costs a single extra stat.
|
|
701
|
-
const SHAPE_SIGNATURES = Object.freeze([
|
|
702
|
-
{
|
|
703
|
-
kind: "DerivedData",
|
|
704
|
-
lead: "Build",
|
|
705
|
-
others: ["Index.noindex", "ModuleCache.noindex", "SourcePackages", "Logs", "info.plist"],
|
|
706
|
-
least: 2,
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
kind: ".build",
|
|
710
|
-
lead: "build.db",
|
|
711
|
-
others: ["manifest.db", "checkouts", "artifacts", "repositories", "index-build"],
|
|
712
|
-
least: 1,
|
|
713
|
-
},
|
|
714
|
-
]);
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* What a directory is, read from what it holds rather than what it is called.
|
|
718
|
-
*
|
|
719
|
-
* @param {string} dir
|
|
720
|
-
* @returns {"DerivedData"|".build"|null}
|
|
721
|
-
*/
|
|
722
|
-
function shapeOf(dir) {
|
|
723
|
-
for (const sig of SHAPE_SIGNATURES) {
|
|
724
|
-
if (!existsSync(join(dir, sig.lead))) continue;
|
|
725
|
-
let found = 0;
|
|
726
|
-
for (const n of sig.others) {
|
|
727
|
-
if (existsSync(join(dir, n))) found++;
|
|
728
|
-
if (found >= sig.least) return sig.kind;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
return null;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
function repoBuildCandidates(ctx, out) {
|
|
735
|
-
const maxAge = ctx.repoBuildHours * HOUR_MS;
|
|
736
|
-
const visit = (root, dir, depth) => {
|
|
737
|
-
if (depth > ctx.maxDepth) return;
|
|
738
|
-
let entries;
|
|
739
|
-
try {
|
|
740
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
741
|
-
} catch (e) {
|
|
742
|
-
noteDenied(ctx, dir, e);
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
for (const e of entries) {
|
|
746
|
-
if (!e.isDirectory() || e.isSymbolicLink()) continue;
|
|
747
|
-
const p = join(dir, e.name);
|
|
748
|
-
if (devPruned(ctx, p, e.name)) continue;
|
|
749
|
-
// A folder with a build tool's NAME is a candidate when it also holds what
|
|
750
|
-
// that tool writes; one that does not is somebody's own directory, and the
|
|
751
|
-
// report says it was kept. A folder with any OTHER name is a candidate only
|
|
752
|
-
// when its shape says so, and then there is nothing to report about it.
|
|
753
|
-
const named = Boolean(BUILD_SHAPE[e.name]);
|
|
754
|
-
const shape = named ? BUILD_SHAPE[e.name] : BUILD_SHAPE[shapeOf(p) ?? ""];
|
|
755
|
-
if (shape) {
|
|
756
|
-
if (named && !shape.some((n) => existsSync(join(p, n)))) {
|
|
757
|
-
out.skipped.push({ path: p, reason: "does not look like build output" });
|
|
758
|
-
} else if (inUse(ctx, realOrNull(p) || p)) {
|
|
759
|
-
hold(out, p, "in use by a running process", "live");
|
|
760
|
-
} else if (touchedWithin(ctx, newestMtime(p, 1), maxAge)) {
|
|
761
|
-
hold(out, p, "touched recently", "age");
|
|
762
|
-
} else {
|
|
763
|
-
addPath(out, ctx, p, [root]);
|
|
764
|
-
}
|
|
765
|
-
continue;
|
|
766
|
-
}
|
|
767
|
-
if (e.name === ".git" || e.name === "node_modules" || e.name === "Pods") continue;
|
|
768
|
-
visit(root, p, depth + 1);
|
|
769
|
-
}
|
|
770
|
-
};
|
|
771
|
-
for (const root of ctx.devRoots) {
|
|
772
|
-
if (rootUsable(root, ctx, out)) visit(root, root, 0);
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
function oldFiles(ctx, out, roots, maxAgeMs, match = () => true) {
|
|
777
|
-
for (const root of roots) {
|
|
778
|
-
if (!rootUsable(root, ctx, out)) continue;
|
|
779
|
-
walk(
|
|
780
|
-
root,
|
|
781
|
-
(p) => {
|
|
782
|
-
if (match(p) && olderThan(p, maxAgeMs, ctx)) addPath(out, ctx, p, [root]);
|
|
783
|
-
},
|
|
784
|
-
{ ctx },
|
|
785
|
-
);
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
// What an `xcodebuild -derivedDataPath` or a SwiftPM `--scratch-path` leaves in
|
|
790
|
-
// a temp folder, whatever the folder is called. Names are compared exactly:
|
|
791
|
-
// the volume is case-insensitive, and an iOS backup carries Manifest.db and
|
|
792
|
-
// Info.plist.
|
|
793
|
-
function looksLikeTmpBuild(p) {
|
|
794
|
-
let names;
|
|
795
|
-
try {
|
|
796
|
-
names = new Set(readdirSync(p));
|
|
797
|
-
} catch {
|
|
798
|
-
return false;
|
|
799
|
-
}
|
|
800
|
-
const all = (...n) => n.every((x) => names.has(x));
|
|
801
|
-
if (names.has("ModuleCache.noindex") || all("Build", "Logs", "info.plist")) return true;
|
|
802
|
-
return names.has("build.db") && (names.has("workspace-state.json") || names.has("checkouts"));
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
function tmpBuildCandidates(ctx, out) {
|
|
806
|
-
for (const root of ctx.tmpRoots) {
|
|
807
|
-
if (!rootUsable(root, ctx, out)) continue;
|
|
808
|
-
for (const p of listDir(root, ctx)) {
|
|
809
|
-
const name = basename(p);
|
|
810
|
-
if (name.startsWith("claude-")) continue;
|
|
811
|
-
const st = lstatOrNull(p);
|
|
812
|
-
if (!st || !st.isDirectory()) continue;
|
|
813
|
-
if (ctx.uid >= 0 && st.uid !== ctx.uid) continue;
|
|
814
|
-
if (!/^dd-/.test(name) && !looksLikeTmpBuild(p)) continue;
|
|
815
|
-
if (inUse(ctx, realOrNull(p) || p)) {
|
|
816
|
-
hold(out, p, "in use by a running process", "live");
|
|
817
|
-
continue;
|
|
818
|
-
}
|
|
819
|
-
if (touchedWithin(ctx, st.mtimeMs, ctx.tmpGraceMinutes * 60_000)) {
|
|
820
|
-
hold(out, p, "touched recently", "age");
|
|
821
|
-
continue;
|
|
822
|
-
}
|
|
823
|
-
addPath(out, ctx, p, [root]);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
function claudeScratchCandidates(ctx, out) {
|
|
829
|
-
for (const root of ctx.tmpRoots) {
|
|
830
|
-
const base = join(root, `claude-${ctx.uid}`);
|
|
831
|
-
if (!existsSync(base) || !rootUsable(base, ctx, out)) continue;
|
|
832
|
-
for (const slug of listDir(base, ctx)) {
|
|
833
|
-
for (const session of listDir(slug, ctx)) {
|
|
834
|
-
const name = basename(session);
|
|
835
|
-
if (!UUID.test(name)) continue;
|
|
836
|
-
if (ctx.sessionId && name === ctx.sessionId) {
|
|
837
|
-
hold(out, session, "the current session", "live");
|
|
838
|
-
continue;
|
|
839
|
-
}
|
|
840
|
-
if (inUse(ctx, realOrNull(session) || session)) {
|
|
841
|
-
hold(out, session, "in use by a running process", "live");
|
|
842
|
-
continue;
|
|
843
|
-
}
|
|
844
|
-
if (ctx.now - newestMtime(session, 2) < ctx.scratchHours * HOUR_MS) {
|
|
845
|
-
hold(out, session, "touched recently, may be another open session", "live");
|
|
846
|
-
continue;
|
|
847
|
-
}
|
|
848
|
-
addPath(out, ctx, session, [base]);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
// What a test run leaves behind, found by shape.
|
|
855
|
-
//
|
|
856
|
-
// A run writes three kinds of output and all three are regenerable by running
|
|
857
|
-
// it again: the result bundle, the recordings and screenshots taken while it
|
|
858
|
-
// ran, and the report files. They are also the biggest thing on a machine that
|
|
859
|
-
// runs a suite every night, and nothing deleted them.
|
|
860
|
-
//
|
|
861
|
-
// The shape is the only safe way to find them. Naming the directories one
|
|
862
|
-
// harness happens to use would tie this file to that harness, and this
|
|
863
|
-
// repository carries no product's paths - an extra root belongs in preferences
|
|
864
|
-
// (DISK_CLEANER_ARTIFACT_ROOTS, --artifact-root), not here. So a run is
|
|
865
|
-
// recognised by what every harness writes: a result bundle, or a report file
|
|
866
|
-
// shaped like a test report. Media and report files count only inside such a
|
|
867
|
-
// directory, so a recording somebody saved among their own files is never a
|
|
868
|
-
// candidate.
|
|
869
|
-
//
|
|
870
|
-
// Opt-in, never unattended: a recording can be the only evidence of a failure
|
|
871
|
-
// anybody still has.
|
|
872
|
-
const RESULT_BUNDLE = /\.xcresult$/i;
|
|
873
|
-
const RUN_MEDIA = /\.(?:mp4|mov|m4v|png|jpe?g|heic)$/i;
|
|
874
|
-
const RUN_REPORT = /\.(?:html?|json|xml|junit|txt|log)$/i;
|
|
875
|
-
const JUNIT_HEAD = /<testsuites?[\s>]/i;
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* The names git tracks in one directory, cached per directory.
|
|
879
|
-
*
|
|
880
|
-
* A run's output is not in version control; a test fixture is. Without this the
|
|
881
|
-
* shape rules read a committed `TEST-*.xml` as a run's report and offer to
|
|
882
|
-
* delete the repository's own fixtures - found on the first real run, against
|
|
883
|
-
* this repository's test tree.
|
|
884
|
-
*
|
|
885
|
-
* `ls-files` is asked once per directory and only for that directory, so a
|
|
886
|
-
* directory of run output, which is normally ignored, costs one call that
|
|
887
|
-
* returns nothing.
|
|
888
|
-
*
|
|
889
|
-
* @returns {Set<string>} basenames; empty when the directory is not in a repository
|
|
890
|
-
*/
|
|
891
|
-
function trackedNames(dir, ctx) {
|
|
892
|
-
const cached = ctx.trackedCache.get(dir);
|
|
893
|
-
if (cached) return cached;
|
|
894
|
-
const names = new Set();
|
|
895
|
-
const r = ctx.run("git", ["-C", dir, "ls-files", "-z", "--", "."], { timeout: 20_000 });
|
|
896
|
-
if (r.status === 0 && r.stdout) {
|
|
897
|
-
for (const rel of r.stdout.split("\0")) {
|
|
898
|
-
if (!rel) continue;
|
|
899
|
-
// `.` is this directory, so a path with a separator names something below
|
|
900
|
-
// it - and the first segment is what sits here.
|
|
901
|
-
names.add(rel.split("/")[0]);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
ctx.trackedCache.set(dir, names);
|
|
905
|
-
return names;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
/** Does this directory hold a test run's output? */
|
|
909
|
-
function holdsRunOutput(dir, ctx) {
|
|
910
|
-
let names;
|
|
911
|
-
try {
|
|
912
|
-
names = listDir(dir, ctx).map((p) => basename(p));
|
|
913
|
-
} catch {
|
|
914
|
-
return false;
|
|
915
|
-
}
|
|
916
|
-
if (names.some((n) => RESULT_BUNDLE.test(n))) return true;
|
|
917
|
-
for (const n of names) {
|
|
918
|
-
if (!/\.xml$/i.test(n)) continue;
|
|
919
|
-
try {
|
|
920
|
-
// The head of the file, not the whole of it: a junit file can be large and
|
|
921
|
-
// the element that identifies it is the first one.
|
|
922
|
-
const fd = openSync(join(dir, n), "r");
|
|
923
|
-
try {
|
|
924
|
-
const buf = Buffer.alloc(512);
|
|
925
|
-
const read = readSync(fd, buf, 0, 512, 0);
|
|
926
|
-
if (JUNIT_HEAD.test(buf.subarray(0, read).toString("utf8"))) return true;
|
|
927
|
-
} finally {
|
|
928
|
-
closeSync(fd);
|
|
929
|
-
}
|
|
930
|
-
} catch {
|
|
931
|
-
/* unreadable; it decides nothing */
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
return false;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
function testArtifactCandidates(ctx, out) {
|
|
938
|
-
const maxAge = ctx.days.artifacts * DAY_MS;
|
|
939
|
-
const roots = [...ctx.devRoots, ...ctx.artifactRoots];
|
|
940
|
-
const seen = new Set();
|
|
941
|
-
for (const root of roots) {
|
|
942
|
-
if (seen.has(root) || !rootUsable(root, ctx, out)) continue;
|
|
943
|
-
seen.add(root);
|
|
944
|
-
const visit = (dir, depth) => {
|
|
945
|
-
if (depth > ctx.maxDepth) return;
|
|
946
|
-
let entries;
|
|
947
|
-
try {
|
|
948
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
949
|
-
} catch (e) {
|
|
950
|
-
noteDenied(ctx, dir, e);
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
// A result bundle is a directory. Take it whole and do not walk into it.
|
|
954
|
-
for (const e of entries) {
|
|
955
|
-
if (e.isSymbolicLink()) continue;
|
|
956
|
-
const path = join(dir, e.name);
|
|
957
|
-
if (e.isDirectory() && RESULT_BUNDLE.test(e.name)) {
|
|
958
|
-
take(path);
|
|
959
|
-
continue;
|
|
960
|
-
}
|
|
961
|
-
if (e.isDirectory()) {
|
|
962
|
-
if (WALK_SKIP.has(e.name) || devPruned(ctx, path, e.name)) continue;
|
|
963
|
-
if (e.name === ".git" || e.name === "node_modules" || e.name === "Pods") continue;
|
|
964
|
-
visit(path, depth + 1);
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
// Media and reports, only where a run's output is.
|
|
968
|
-
if (!holdsRunOutput(dir, ctx)) return;
|
|
969
|
-
for (const e of entries) {
|
|
970
|
-
if (!e.isFile() || e.isSymbolicLink()) continue;
|
|
971
|
-
if (!RUN_MEDIA.test(e.name) && !RUN_REPORT.test(e.name)) continue;
|
|
972
|
-
take(join(dir, e.name));
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
const take = (path) => {
|
|
976
|
-
if (trackedNames(dirname(path), ctx).has(basename(path))) {
|
|
977
|
-
out.skipped.push({ path, reason: "tracked by git" });
|
|
978
|
-
return;
|
|
979
|
-
}
|
|
980
|
-
if (!olderThan(path, maxAge, ctx)) {
|
|
981
|
-
hold(out, path, "touched recently", "age");
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
if (inUse(ctx, realOrNull(path) || path)) {
|
|
985
|
-
hold(out, path, "in use by a running process", "live");
|
|
986
|
-
return;
|
|
987
|
-
}
|
|
988
|
-
addPath(out, ctx, path, [root]);
|
|
989
|
-
};
|
|
990
|
-
visit(root, 0);
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
function transcriptCandidates(ctx, out) {
|
|
995
|
-
const maxAge = ctx.days.transcripts * DAY_MS;
|
|
996
|
-
const roots = [H(ctx, ".claude", "projects"), H(ctx, ".codex", "sessions")];
|
|
997
|
-
for (const root of roots) {
|
|
998
|
-
if (!rootUsable(root, ctx, out)) continue;
|
|
999
|
-
walk(
|
|
1000
|
-
root,
|
|
1001
|
-
(p) => {
|
|
1002
|
-
if (!p.endsWith(".jsonl") || MEMORY_DIR.test(p)) return;
|
|
1003
|
-
if (ctx.sessionId && p.includes(ctx.sessionId)) {
|
|
1004
|
-
out.skipped.push({ path: p, reason: "the current session" });
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
if (!olderThan(p, maxAge, ctx)) return;
|
|
1008
|
-
if (inUse(ctx, realOrNull(p) || p)) {
|
|
1009
|
-
out.skipped.push({ path: p, reason: "in use by a running process" });
|
|
1010
|
-
return;
|
|
1011
|
-
}
|
|
1012
|
-
addPath(out, ctx, p, [root]);
|
|
1013
|
-
},
|
|
1014
|
-
{ ctx },
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
/** Every simulator device simctl knows, with its runtime id, or null when simctl fails. */
|
|
1020
|
-
function readSimDevices(ctx) {
|
|
1021
|
-
const r = ctx.run("xcrun", ["simctl", "list", "devices", "-j"], { timeout: 60_000 });
|
|
1022
|
-
if (r.status !== 0) return null;
|
|
1023
|
-
try {
|
|
1024
|
-
const devices = [];
|
|
1025
|
-
for (const [runtime, list] of Object.entries(JSON.parse(r.stdout).devices || {})) {
|
|
1026
|
-
for (const d of list || []) devices.push({ ...d, runtime });
|
|
1027
|
-
}
|
|
1028
|
-
return { devices };
|
|
1029
|
-
} catch {
|
|
1030
|
-
return null;
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
function deviceBooted(ctx, udid) {
|
|
1035
|
-
const sim = ctx.simDevices();
|
|
1036
|
-
if (!sim) return true;
|
|
1037
|
-
return sim.devices.some((d) => d.udid === udid && d.state !== "Shutdown");
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
function simDeviceCacheCandidates(ctx, out) {
|
|
1041
|
-
const devicesRoot = realOrNull(H(ctx, "Library/Developer/CoreSimulator/Devices"));
|
|
1042
|
-
if (!devicesRoot) return;
|
|
1043
|
-
const sim = ctx.simDevices();
|
|
1044
|
-
if (!sim) {
|
|
1045
|
-
out.note = "could not list simulator devices, so every device cache was kept";
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
for (const d of sim.devices) {
|
|
1049
|
-
if (!d.dataPath || !d.udid) continue;
|
|
1050
|
-
const caches = join(d.dataPath, "Library", "Caches");
|
|
1051
|
-
const real = realOrNull(caches);
|
|
1052
|
-
if (!real || !inside(real, devicesRoot)) continue;
|
|
1053
|
-
if (d.state !== "Shutdown") {
|
|
1054
|
-
hold(out, caches, "device is booted", "live");
|
|
1055
|
-
continue;
|
|
1056
|
-
}
|
|
1057
|
-
if (!rootUsable(caches, ctx, out)) continue;
|
|
1058
|
-
const label = `${d.name} (${String(d.udid).slice(0, 8)})`;
|
|
1059
|
-
const recheck = (c) => (deviceBooted(c, d.udid) ? "device is booted" : null);
|
|
1060
|
-
for (const p of listDir(caches, ctx)) addPath(out, ctx, p, [caches], { label, recheck });
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
function versionParts(v) {
|
|
1065
|
-
return String(v)
|
|
1066
|
-
.split(".")
|
|
1067
|
-
.map((n) => Number.parseInt(n, 10) || 0);
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
export function compareVersions(a, b) {
|
|
1071
|
-
const x = versionParts(a);
|
|
1072
|
-
const y = versionParts(b);
|
|
1073
|
-
for (let i = 0; i < Math.max(x.length, y.length); i++) {
|
|
1074
|
-
const d = (x[i] || 0) - (y[i] || 0);
|
|
1075
|
-
if (d) return d;
|
|
1076
|
-
}
|
|
1077
|
-
return 0;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
function runtimePlatform(rt) {
|
|
1081
|
-
return /SimRuntime\.([A-Za-z]+)-/.exec(rt.runtimeIdentifier || "")?.[1] || rt.platformIdentifier;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
function bootedRuntimes(ctx) {
|
|
1085
|
-
const sim = ctx.simDevices();
|
|
1086
|
-
if (!sim) return null;
|
|
1087
|
-
return new Set(sim.devices.filter((d) => d.state !== "Shutdown").map((d) => d.runtime));
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
/** Why a simulator runtime is kept, or null when it may be deleted. */
|
|
1091
|
-
export function runtimeHoldReason(rt, ctx, newest, booted) {
|
|
1092
|
-
if (rt.deletable !== true) return "not deletable";
|
|
1093
|
-
if (!booted) return "could not list simulator devices";
|
|
1094
|
-
if (booted.has(rt.runtimeIdentifier)) return "backs a booted device";
|
|
1095
|
-
if (compareVersions(rt.version, newest.get(rt.platformIdentifier)) >= 0) {
|
|
1096
|
-
return `newest ${runtimePlatform(rt)}`;
|
|
1097
|
-
}
|
|
1098
|
-
const used = Date.parse(rt.lastUsedAt || "");
|
|
1099
|
-
if (!Number.isFinite(used)) return "last use unknown";
|
|
1100
|
-
if (ctx.now - used < ctx.runtimeDays * DAY_MS) {
|
|
1101
|
-
return `used in the last ${ctx.runtimeDays} days`;
|
|
1102
|
-
}
|
|
1103
|
-
return null;
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
function simRuntimeCandidates(ctx, out) {
|
|
1107
|
-
const r = ctx.run("xcrun", ["simctl", "runtime", "list", "-j"], { timeout: 60_000 });
|
|
1108
|
-
if (r.status !== 0) return;
|
|
1109
|
-
let runtimes;
|
|
1110
|
-
try {
|
|
1111
|
-
runtimes = Object.values(JSON.parse(r.stdout) || {});
|
|
1112
|
-
} catch {
|
|
1113
|
-
return;
|
|
1114
|
-
}
|
|
1115
|
-
if (!runtimes.length) return;
|
|
1116
|
-
const booted = bootedRuntimes(ctx);
|
|
1117
|
-
const newest = new Map();
|
|
1118
|
-
for (const rt of runtimes) {
|
|
1119
|
-
const cur = newest.get(rt.platformIdentifier);
|
|
1120
|
-
if (cur == null || compareVersions(rt.version, cur) > 0)
|
|
1121
|
-
newest.set(rt.platformIdentifier, rt.version);
|
|
1122
|
-
}
|
|
1123
|
-
for (const rt of runtimes) {
|
|
1124
|
-
const label = `${runtimePlatform(rt)} ${rt.version} (${rt.build})`;
|
|
1125
|
-
const bytes = Number(rt.sizeBytes) || 0;
|
|
1126
|
-
const reason = runtimeHoldReason(rt, ctx, newest, booted);
|
|
1127
|
-
if (reason) {
|
|
1128
|
-
const kind = reason === "backs a booted device" ? "live" : "policy";
|
|
1129
|
-
hold(out, label, reason, kind, bytes);
|
|
1130
|
-
continue;
|
|
1131
|
-
}
|
|
1132
|
-
out.candidates.push({
|
|
1133
|
-
kind: "command",
|
|
1134
|
-
cmd: "xcrun",
|
|
1135
|
-
args: ["simctl", "runtime", "delete", rt.identifier],
|
|
1136
|
-
path: label,
|
|
1137
|
-
measure: [],
|
|
1138
|
-
bytes,
|
|
1139
|
-
recheck: (c) => {
|
|
1140
|
-
const now = bootedRuntimes(c);
|
|
1141
|
-
return !now || now.has(rt.runtimeIdentifier) ? "backs a booted device" : null;
|
|
1142
|
-
},
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
if (out.candidates.length && !out.note) {
|
|
1146
|
-
out.note = "CoreSimulator frees runtime space in the background; df right after can undercount";
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
/** Orphaned session children, for the report only: pid and command, nothing to act on. */
|
|
1151
|
-
export function listOrphans(ctx) {
|
|
1152
|
-
const rows = ctx.ps();
|
|
1153
|
-
return findOrphans(rows, {
|
|
1154
|
-
uid: ctx.uid,
|
|
1155
|
-
minAgeSec: ctx.orphanMinutes * 60,
|
|
1156
|
-
selfChain: selfChain(rows),
|
|
1157
|
-
}).map((r) => ({ pid: r.pid, command: r.command }));
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
function selfChain(rows) {
|
|
1161
|
-
const parent = new Map(rows.map((r) => [r.pid, r.ppid]));
|
|
1162
|
-
const chain = new Set();
|
|
1163
|
-
let pid = process.pid;
|
|
1164
|
-
while (pid > 1 && !chain.has(pid)) {
|
|
1165
|
-
chain.add(pid);
|
|
1166
|
-
pid = parent.get(pid) ?? 0;
|
|
1167
|
-
}
|
|
1168
|
-
return chain;
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
/** Session children whose parent is gone: reparented to launchd, old enough, ours. */
|
|
1172
|
-
export function findOrphans(rows, { uid, minAgeSec, selfChain: own = new Set() }) {
|
|
1173
|
-
return rows.filter(
|
|
1174
|
-
(r) =>
|
|
1175
|
-
r.ppid === 1 &&
|
|
1176
|
-
r.uid === uid &&
|
|
1177
|
-
r.etimeSec >= minAgeSec &&
|
|
1178
|
-
!own.has(r.pid) &&
|
|
1179
|
-
ORPHAN_PATTERNS.some((re) => re.test(r.command)),
|
|
1180
|
-
);
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
// ---------------------------------------------------------------- categories
|
|
1184
|
-
|
|
1185
|
-
const XCODE = exeIs("Xcode", "xcodebuild");
|
|
1186
|
-
const SIMULATOR = exeIs("Simulator");
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* The allowlist. `unattended` marks the categories a run nobody watches may
|
|
1190
|
-
* apply; `optIn` names the flag a category needs before it is planned.
|
|
1191
|
-
*/
|
|
1192
|
-
export const CATEGORIES = [
|
|
1193
|
-
{
|
|
1194
|
-
id: "derived-data",
|
|
1195
|
-
label: "Xcode DerivedData",
|
|
1196
|
-
unattended: true,
|
|
1197
|
-
blocker: [XCODE, "Xcode or xcodebuild is running"],
|
|
1198
|
-
discover: (ctx, out) => childrenOf(ctx, out, [H(ctx, "Library/Developer/Xcode/DerivedData")]),
|
|
1199
|
-
},
|
|
1200
|
-
{
|
|
1201
|
-
id: "repo-build",
|
|
1202
|
-
label: "SwiftPM .build and DerivedData folders inside dev roots, untouched for the build age",
|
|
1203
|
-
unattended: true,
|
|
1204
|
-
blocker: [
|
|
1205
|
-
(r) => XCODE(r) || exeIs("swift-build", "swift-test", "sourcekit-lsp")(r),
|
|
1206
|
-
"Xcode, xcodebuild or a SwiftPM build is running",
|
|
1207
|
-
],
|
|
1208
|
-
discover: repoBuildCandidates,
|
|
1209
|
-
},
|
|
1210
|
-
{
|
|
1211
|
-
id: "xctest-devices",
|
|
1212
|
-
label: "per-run XCTest simulator clones untouched for the build age (du overstates them)",
|
|
1213
|
-
unattended: true,
|
|
1214
|
-
blocker: [XCODE, "Xcode or xcodebuild is running"],
|
|
1215
|
-
discover: (ctx, out) =>
|
|
1216
|
-
childrenOf(ctx, out, [H(ctx, "Library/Developer/XCTestDevices")], (p) => {
|
|
1217
|
-
if (!touchedWithin(ctx, lstatOrNull(p)?.mtimeMs ?? 0, ctx.repoBuildHours * HOUR_MS))
|
|
1218
|
-
return true;
|
|
1219
|
-
hold(out, p, "touched recently", "age");
|
|
1220
|
-
return false;
|
|
1221
|
-
}),
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
id: "xcode-caches",
|
|
1225
|
-
label: "Xcode SwiftUI preview, Interface Builder and documentation caches",
|
|
1226
|
-
unattended: true,
|
|
1227
|
-
blocker: [XCODE, "Xcode or xcodebuild is running"],
|
|
1228
|
-
discover: (ctx, out) =>
|
|
1229
|
-
childrenOf(ctx, out, [
|
|
1230
|
-
H(ctx, "Library/Developer/Xcode/UserData/Previews"),
|
|
1231
|
-
H(ctx, "Library/Developer/Xcode/UserData/IB Support"),
|
|
1232
|
-
H(ctx, "Library/Developer/Xcode/DocumentationCache"),
|
|
1233
|
-
H(ctx, "Library/Developer/Xcode/DocumentationIndex"),
|
|
1234
|
-
]),
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
id: "archives",
|
|
1238
|
-
label: "Xcode Archives older than the archive age",
|
|
1239
|
-
unattended: false,
|
|
1240
|
-
discover(ctx, out) {
|
|
1241
|
-
const root = H(ctx, "Library/Developer/Xcode/Archives");
|
|
1242
|
-
if (!rootUsable(root, ctx, out)) return;
|
|
1243
|
-
for (const day of listDir(root)) {
|
|
1244
|
-
for (const arc of listDir(day)) {
|
|
1245
|
-
if (arc.endsWith(".xcarchive") && olderThan(arc, ctx.days.archives * DAY_MS, ctx)) {
|
|
1246
|
-
addPath(out, ctx, arc, [root]);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
},
|
|
1251
|
-
},
|
|
1252
|
-
{
|
|
1253
|
-
id: "device-support",
|
|
1254
|
-
label: "iOS, watchOS and tvOS DeviceSupport for OS versions with no paired device",
|
|
1255
|
-
unattended: false,
|
|
1256
|
-
blocker: [XCODE, "Xcode or xcodebuild is running"],
|
|
1257
|
-
discover(ctx, out) {
|
|
1258
|
-
const roots = ["iOS", "watchOS", "tvOS"]
|
|
1259
|
-
.map((p) => H(ctx, `Library/Developer/Xcode/${p} DeviceSupport`))
|
|
1260
|
-
.filter((r) => existsSync(r));
|
|
1261
|
-
if (!roots.length) return;
|
|
1262
|
-
const paired = devicePairedVersions(ctx);
|
|
1263
|
-
if (!paired) {
|
|
1264
|
-
out.note = "could not list paired devices, so every DeviceSupport folder was kept";
|
|
1265
|
-
return;
|
|
1266
|
-
}
|
|
1267
|
-
const keep = (p) =>
|
|
1268
|
-
[...paired].some((v) =>
|
|
1269
|
-
new RegExp(`(^|\\s)${v.replace(/\./g, "\\.")}(\\s|$)`).test(basename(p)),
|
|
1270
|
-
);
|
|
1271
|
-
childrenOf(ctx, out, roots, (p) => {
|
|
1272
|
-
if (keep(p)) {
|
|
1273
|
-
out.skipped.push({ path: p, reason: "a paired device runs this version" });
|
|
1274
|
-
return false;
|
|
1275
|
-
}
|
|
1276
|
-
return true;
|
|
1277
|
-
});
|
|
1278
|
-
},
|
|
1279
|
-
},
|
|
1280
|
-
{
|
|
1281
|
-
id: "sim-unavailable",
|
|
1282
|
-
label: "CoreSimulator devices whose runtime is gone (simctl delete unavailable)",
|
|
1283
|
-
unattended: true,
|
|
1284
|
-
discover(ctx, out) {
|
|
1285
|
-
const r = ctx.run("xcrun", ["simctl", "list", "devices", "unavailable", "-j"], {
|
|
1286
|
-
timeout: 60_000,
|
|
1287
|
-
});
|
|
1288
|
-
if (r.status !== 0) return;
|
|
1289
|
-
let data;
|
|
1290
|
-
try {
|
|
1291
|
-
data = JSON.parse(r.stdout);
|
|
1292
|
-
} catch {
|
|
1293
|
-
return;
|
|
1294
|
-
}
|
|
1295
|
-
const dirs = [];
|
|
1296
|
-
for (const list of Object.values(data.devices || {})) {
|
|
1297
|
-
for (const d of list) if (d.dataPath) dirs.push(dirname(d.dataPath));
|
|
1298
|
-
}
|
|
1299
|
-
if (!dirs.length) return;
|
|
1300
|
-
out.candidates.push({
|
|
1301
|
-
kind: "command",
|
|
1302
|
-
cmd: "xcrun",
|
|
1303
|
-
args: ["simctl", "delete", "unavailable"],
|
|
1304
|
-
path: `xcrun simctl delete unavailable (${dirs.length} devices)`,
|
|
1305
|
-
measure: dirs.filter((d) => existsSync(d)),
|
|
1306
|
-
});
|
|
1307
|
-
},
|
|
1308
|
-
},
|
|
1309
|
-
{
|
|
1310
|
-
id: "sim-caches",
|
|
1311
|
-
label: "CoreSimulator caches",
|
|
1312
|
-
unattended: true,
|
|
1313
|
-
blocker: [SIMULATOR, "Simulator is running"],
|
|
1314
|
-
discover: (ctx, out) =>
|
|
1315
|
-
childrenOf(ctx, out, [H(ctx, "Library/Developer/CoreSimulator/Caches")]),
|
|
1316
|
-
},
|
|
1317
|
-
{
|
|
1318
|
-
id: "sim-device-caches",
|
|
1319
|
-
label: "each shut-down simulator device's own system cache (data/Library/Caches)",
|
|
1320
|
-
unattended: true,
|
|
1321
|
-
discover: simDeviceCacheCandidates,
|
|
1322
|
-
},
|
|
1323
|
-
{
|
|
1324
|
-
id: "sim-runtimes",
|
|
1325
|
-
label:
|
|
1326
|
-
"simulator runtimes not used for the runtime age; never the newest per platform or a booted one",
|
|
1327
|
-
unattended: false,
|
|
1328
|
-
discover: simRuntimeCandidates,
|
|
1329
|
-
},
|
|
1330
|
-
{
|
|
1331
|
-
id: "spm-cache",
|
|
1332
|
-
label: "SwiftPM package cache",
|
|
1333
|
-
unattended: true,
|
|
1334
|
-
blocker: [XCODE, "Xcode or xcodebuild is running"],
|
|
1335
|
-
discover: (ctx, out) => childrenOf(ctx, out, [H(ctx, "Library/Caches/org.swift.swiftpm")]),
|
|
1336
|
-
},
|
|
1337
|
-
{
|
|
1338
|
-
id: "pods-cache",
|
|
1339
|
-
label: "CocoaPods cache",
|
|
1340
|
-
unattended: true,
|
|
1341
|
-
discover: (ctx, out) =>
|
|
1342
|
-
cacheWithTool(
|
|
1343
|
-
ctx,
|
|
1344
|
-
out,
|
|
1345
|
-
"pod",
|
|
1346
|
-
["cache", "clean", "--all"],
|
|
1347
|
-
H(ctx, "Library/Caches/CocoaPods"),
|
|
1348
|
-
),
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
id: "gradle-cache",
|
|
1352
|
-
label: "Gradle caches",
|
|
1353
|
-
unattended: true,
|
|
1354
|
-
blocker: [(r) => /GradleDaemon/.test(r.command), "a Gradle daemon is running"],
|
|
1355
|
-
discover: (ctx, out) => childrenOf(ctx, out, [H(ctx, ".gradle/caches")]),
|
|
1356
|
-
},
|
|
1357
|
-
{
|
|
1358
|
-
id: "js-caches",
|
|
1359
|
-
label: "npm, yarn and pnpm caches",
|
|
1360
|
-
unattended: true,
|
|
1361
|
-
discover(ctx, out) {
|
|
1362
|
-
cacheWithTool(ctx, out, "npm", ["cache", "clean", "--force"], H(ctx, ".npm/_cacache"));
|
|
1363
|
-
cacheWithTool(ctx, out, "yarn", ["cache", "clean"], H(ctx, "Library/Caches/Yarn"));
|
|
1364
|
-
cacheWithTool(ctx, out, "pnpm", ["store", "prune"], H(ctx, "Library/pnpm/store"));
|
|
1365
|
-
},
|
|
1366
|
-
},
|
|
1367
|
-
{
|
|
1368
|
-
id: "homebrew",
|
|
1369
|
-
label: "Homebrew downloads and old versions (brew cleanup)",
|
|
1370
|
-
unattended: true,
|
|
1371
|
-
discover(ctx, out) {
|
|
1372
|
-
const dir = H(ctx, "Library/Caches/Homebrew");
|
|
1373
|
-
if (!existsSync(dir) || !has(ctx, "brew")) return;
|
|
1374
|
-
commandCandidate(out, ctx, {
|
|
1375
|
-
tool: "brew",
|
|
1376
|
-
args: ["cleanup", "--prune=all"],
|
|
1377
|
-
measure: [dir],
|
|
1378
|
-
label: "brew cleanup --prune=all",
|
|
1379
|
-
});
|
|
1380
|
-
},
|
|
1381
|
-
},
|
|
1382
|
-
{
|
|
1383
|
-
id: "tmp-builds",
|
|
1384
|
-
label:
|
|
1385
|
-
"build leftovers in /tmp and $TMPDIR (dd-*, or shaped like DerivedData or SwiftPM output)",
|
|
1386
|
-
unattended: true,
|
|
1387
|
-
discover: tmpBuildCandidates,
|
|
1388
|
-
},
|
|
1389
|
-
{
|
|
1390
|
-
id: "pipeline-scratch",
|
|
1391
|
-
label: "pipeline scratch in /tmp (through gc-tmp.sh)",
|
|
1392
|
-
unattended: true,
|
|
1393
|
-
discover: gcTmpCandidates,
|
|
1394
|
-
},
|
|
1395
|
-
{
|
|
1396
|
-
id: "claude-scratch",
|
|
1397
|
-
label: "scratchpads and task outputs of ended Claude Code sessions",
|
|
1398
|
-
unattended: true,
|
|
1399
|
-
discover: claudeScratchCandidates,
|
|
1400
|
-
},
|
|
1401
|
-
{
|
|
1402
|
-
id: "agent-worktrees",
|
|
1403
|
-
label: "merged, clean agent worktrees under .claude/worktrees",
|
|
1404
|
-
unattended: false,
|
|
1405
|
-
discover: worktreeCandidates,
|
|
1406
|
-
},
|
|
1407
|
-
{
|
|
1408
|
-
id: "dev-caches",
|
|
1409
|
-
label: "~/Library/Caches folders of developer tools",
|
|
1410
|
-
unattended: true,
|
|
1411
|
-
blocker: [XCODE, "Xcode or xcodebuild is running"],
|
|
1412
|
-
discover: (ctx, out) =>
|
|
1413
|
-
childrenOf(
|
|
1414
|
-
ctx,
|
|
1415
|
-
out,
|
|
1416
|
-
DEV_CACHE_DIRS.map((d) => H(ctx, "Library/Caches", d)),
|
|
1417
|
-
),
|
|
1418
|
-
},
|
|
1419
|
-
{
|
|
1420
|
-
id: "old-logs",
|
|
1421
|
-
label: "simulator logs and crash reports older than the log age",
|
|
1422
|
-
unattended: true,
|
|
1423
|
-
discover: (ctx, out) =>
|
|
1424
|
-
oldFiles(
|
|
1425
|
-
ctx,
|
|
1426
|
-
out,
|
|
1427
|
-
[H(ctx, "Library/Logs/CoreSimulator"), H(ctx, "Library/Logs/DiagnosticReports")],
|
|
1428
|
-
ctx.days.logs * DAY_MS,
|
|
1429
|
-
),
|
|
1430
|
-
},
|
|
1431
|
-
{
|
|
1432
|
-
id: "pipeline-logs",
|
|
1433
|
-
label: "finished pipeline task logs older than the log age (through prune-logs.sh)",
|
|
1434
|
-
unattended: true,
|
|
1435
|
-
discover: pruneLogsCandidates,
|
|
1436
|
-
},
|
|
1437
|
-
{
|
|
1438
|
-
id: "ds-store",
|
|
1439
|
-
label: ".DS_Store files inside dev roots",
|
|
1440
|
-
unattended: true,
|
|
1441
|
-
discover: dsStoreCandidates,
|
|
1442
|
-
},
|
|
1443
|
-
{
|
|
1444
|
-
id: "trash",
|
|
1445
|
-
label: "the Trash",
|
|
1446
|
-
unattended: false,
|
|
1447
|
-
optIn: "trash",
|
|
1448
|
-
discover: (ctx, out) => childrenOf(ctx, out, [H(ctx, ".Trash")]),
|
|
1449
|
-
},
|
|
1450
|
-
{
|
|
1451
|
-
id: "test-artifacts",
|
|
1452
|
-
label:
|
|
1453
|
-
"test run output under the dev and artifact roots, older than the artifact age: result bundles, recordings, screenshots and report files",
|
|
1454
|
-
unattended: false,
|
|
1455
|
-
optIn: "test-artifacts",
|
|
1456
|
-
discover: testArtifactCandidates,
|
|
1457
|
-
},
|
|
1458
|
-
{
|
|
1459
|
-
id: "transcripts",
|
|
1460
|
-
label: "Claude Code and Codex session transcripts older than the transcript age",
|
|
1461
|
-
unattended: false,
|
|
1462
|
-
optIn: "transcripts",
|
|
1463
|
-
discover: transcriptCandidates,
|
|
1464
|
-
},
|
|
1465
|
-
];
|
|
1466
|
-
|
|
1467
|
-
export const UNATTENDED_SAFE = new Set(CATEGORIES.filter((c) => c.unattended).map((c) => c.id));
|
|
1468
|
-
|
|
1469
|
-
/** The categories a run plans, after opt-ins, --only, --skip and the unattended set. */
|
|
1470
|
-
export function selectCategories(sel = {}) {
|
|
1471
|
-
return CATEGORIES.filter((c) => {
|
|
1472
|
-
if (sel.unattended && !c.unattended) return false;
|
|
1473
|
-
if (c.optIn && !sel[c.optIn]) return false;
|
|
1474
|
-
if (sel.only?.length && !sel.only.includes(c.id)) return false;
|
|
1475
|
-
if (sel.skip?.includes(c.id)) return false;
|
|
1476
|
-
return true;
|
|
1477
|
-
});
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
// ---------------------------------------------------------------- plan / apply
|
|
1481
|
-
|
|
1482
|
-
function excludedBy(ctx, path) {
|
|
1483
|
-
const p = nativeReal(path) || path;
|
|
1484
|
-
return ctx.excludes.some((e) => p === e || inside(p, e) || inside(e, p));
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
/** Move every candidate at, under or above an excluded path to the kept list. */
|
|
1488
|
-
function applyExcludes(ctx, out) {
|
|
1489
|
-
if (!ctx.excludes.length) return;
|
|
1490
|
-
out.candidates = out.candidates.filter((c) => {
|
|
1491
|
-
if (c.kind === "command" || !excludedBy(ctx, c.path)) return true;
|
|
1492
|
-
out.skipped.push({ path: c.path, reason: "excluded" });
|
|
1493
|
-
return false;
|
|
1494
|
-
});
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
/** Measure every selected category. Deletes nothing. */
|
|
1498
|
-
export function plan(ctx, sel = {}) {
|
|
1499
|
-
const categories = [];
|
|
1500
|
-
for (const cat of selectCategories(sel)) {
|
|
1501
|
-
const out = { id: cat.id, label: cat.label, candidates: [], skipped: [], note: null, bytes: 0 };
|
|
1502
|
-
if (cat.blocker && processRunning(ctx, cat.blocker[0])) {
|
|
1503
|
-
out.blocked = cat.blocker[1];
|
|
1504
|
-
out.note = `${cat.blocker[1]}; measured, not applied`;
|
|
1505
|
-
}
|
|
1506
|
-
cat.discover(ctx, out);
|
|
1507
|
-
applyExcludes(ctx, out);
|
|
1508
|
-
const toMeasure = [];
|
|
1509
|
-
for (const c of out.candidates) {
|
|
1510
|
-
if (c.kind === "path" || c.kind === "worktree") toMeasure.push(c.path);
|
|
1511
|
-
else if (c.kind === "command") toMeasure.push(...c.measure);
|
|
1512
|
-
else if (c.kind === "delegate" && c.bytes == null) toMeasure.push(c.path);
|
|
1513
|
-
}
|
|
1514
|
-
const heldItems = out.skipped.filter((k) => k.held);
|
|
1515
|
-
for (const k of heldItems) if (k.bytes == null && existsSync(k.path)) toMeasure.push(k.path);
|
|
1516
|
-
const sizes = toMeasure.length ? ctx.du(toMeasure) : new Map();
|
|
1517
|
-
for (const c of out.candidates) {
|
|
1518
|
-
if (c.kind === "command" && c.bytes == null) {
|
|
1519
|
-
c.bytes = c.measure.reduce((s, p) => s + (sizes.get(p) || 0), 0);
|
|
1520
|
-
} else if (c.bytes == null) c.bytes = sizes.get(c.path) ?? 0;
|
|
1521
|
-
c.category = cat.id;
|
|
1522
|
-
out.bytes += c.bytes;
|
|
1523
|
-
}
|
|
1524
|
-
out.held = { items: 0, bytes: 0, aged: 0, agedBytes: 0, live: 0 };
|
|
1525
|
-
for (const k of heldItems) {
|
|
1526
|
-
if (k.bytes == null) k.bytes = sizes.get(k.path) ?? 0;
|
|
1527
|
-
out.held.items++;
|
|
1528
|
-
out.held.bytes += k.bytes;
|
|
1529
|
-
if (k.held === "age") {
|
|
1530
|
-
out.held.aged++;
|
|
1531
|
-
out.held.agedBytes += k.bytes;
|
|
1532
|
-
} else if (k.held === "live") out.held.live++;
|
|
1533
|
-
}
|
|
1534
|
-
categories.push(out);
|
|
1535
|
-
}
|
|
1536
|
-
return {
|
|
1537
|
-
categories,
|
|
1538
|
-
totalBytes: categories.reduce((s, c) => s + c.bytes, 0),
|
|
1539
|
-
held: sumHeld(categories),
|
|
1540
|
-
unreadable: { count: ctx.denied.size, sample: [...ctx.denied].slice(0, 3) },
|
|
1541
|
-
};
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
function sumHeld(categories) {
|
|
1545
|
-
const total = { items: 0, bytes: 0, aged: 0, agedBytes: 0, live: 0 };
|
|
1546
|
-
for (const c of categories) for (const k of Object.keys(total)) total[k] += c.held[k];
|
|
1547
|
-
return total;
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
function deletePath(ctx, c) {
|
|
1551
|
-
const g = guardPath(c.path, ctx, c.roots);
|
|
1552
|
-
if (!g.ok) return { ok: false, reason: g.reason };
|
|
1553
|
-
try {
|
|
1554
|
-
rmSync(g.real, { recursive: true, force: true });
|
|
1555
|
-
return existsSync(g.real) ? { ok: false, reason: "still present" } : { ok: true };
|
|
1556
|
-
} catch (e) {
|
|
1557
|
-
return { ok: false, reason: e.code || "delete failed" };
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
function removeWorktree(ctx, c) {
|
|
1562
|
-
if (inUse(ctx, c.path)) return { ok: false, reason: "in use by a running process" };
|
|
1563
|
-
const status = ctx.run("git", ["-C", c.path, "status", "--porcelain"]);
|
|
1564
|
-
if (status.status !== 0 || status.stdout.trim()) return { ok: false, reason: "no longer clean" };
|
|
1565
|
-
const r = ctx.run("git", ["-C", c.repo, "worktree", "remove", c.path]);
|
|
1566
|
-
return r.status === 0 ? { ok: true } : { ok: false, reason: r.stderr.trim() || "git refused" };
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
function runDelegate(ctx, tool, items) {
|
|
1570
|
-
const listFile = join(tmpdir(), `disk-cleaner-${tool}-${process.pid}-${Date.now()}.txt`);
|
|
1571
|
-
try {
|
|
1572
|
-
if (tool === "gc-tmp") {
|
|
1573
|
-
writeFileSync(listFile, items.map((c) => c.path).join("\n") + "\n");
|
|
1574
|
-
const r = ctx.run("bash", [join(ctx.scriptsDir, "gc-tmp.sh"), "--yes", "--only", listFile]);
|
|
1575
|
-
return r.status === 0;
|
|
1576
|
-
}
|
|
1577
|
-
writeFileSync(listFile, items.map((c) => c.rel).join("\n") + "\n");
|
|
1578
|
-
const r = ctx.run(
|
|
1579
|
-
"bash",
|
|
1580
|
-
[
|
|
1581
|
-
join(ctx.scriptsDir, "prune-logs.sh"),
|
|
1582
|
-
`--older-than=${ctx.days.logs}`,
|
|
1583
|
-
`--only-from=${listFile}`,
|
|
1584
|
-
"--yes",
|
|
1585
|
-
],
|
|
1586
|
-
{ env: { ...process.env, PRUNE_LOG_ROOT: H(ctx, ".claude", "logs", "multi-agent") } },
|
|
1587
|
-
);
|
|
1588
|
-
return r.status === 0;
|
|
1589
|
-
} finally {
|
|
1590
|
-
rmSync(listFile, { force: true });
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
/**
|
|
1595
|
-
* Delete what `planned` lists. Every path passes the guard again first, a
|
|
1596
|
-
* worktree is re-checked for changes.
|
|
1597
|
-
*/
|
|
1598
|
-
export function applyPlan(ctx, planned) {
|
|
1599
|
-
ctx.resetProbes?.();
|
|
1600
|
-
const result = { removed: 0, failed: 0, failures: [], held: [] };
|
|
1601
|
-
for (const cat of planned.categories) {
|
|
1602
|
-
const def = CATEGORIES.find((c) => c.id === cat.id);
|
|
1603
|
-
if (cat.blocked || (def?.blocker && processRunning(ctx, def.blocker[0]))) {
|
|
1604
|
-
result.held.push({ category: cat.id, reason: def?.blocker?.[1] || cat.blocked });
|
|
1605
|
-
continue;
|
|
1606
|
-
}
|
|
1607
|
-
const delegates = new Map();
|
|
1608
|
-
for (const c of cat.candidates) {
|
|
1609
|
-
const why = c.recheck?.(ctx);
|
|
1610
|
-
if (why) {
|
|
1611
|
-
result.held.push({ category: cat.id, path: c.path, reason: why });
|
|
1612
|
-
continue;
|
|
1613
|
-
}
|
|
1614
|
-
let r;
|
|
1615
|
-
if (c.kind === "path") r = deletePath(ctx, c);
|
|
1616
|
-
else if (c.kind === "worktree") r = removeWorktree(ctx, c);
|
|
1617
|
-
else if (c.kind === "command") {
|
|
1618
|
-
const x = ctx.run(c.cmd, c.args, { timeout: 600_000 });
|
|
1619
|
-
r = x.status === 0 ? { ok: true } : { ok: false, reason: `${c.cmd} exited ${x.status}` };
|
|
1620
|
-
} else if (c.kind === "delegate") {
|
|
1621
|
-
if (!delegates.has(c.tool)) delegates.set(c.tool, []);
|
|
1622
|
-
delegates.get(c.tool).push(c);
|
|
1623
|
-
continue;
|
|
1624
|
-
}
|
|
1625
|
-
if (r.ok) result.removed++;
|
|
1626
|
-
else {
|
|
1627
|
-
result.failed++;
|
|
1628
|
-
result.failures.push({ category: cat.id, path: c.path, reason: r.reason });
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
for (const [tool, items] of delegates) {
|
|
1632
|
-
if (runDelegate(ctx, tool, items)) result.removed += items.length;
|
|
1633
|
-
else {
|
|
1634
|
-
result.failed += items.length;
|
|
1635
|
-
result.failures.push({ category: cat.id, path: tool, reason: `${tool} failed` });
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
return result;
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
// ---------------------------------------------------------------- CLI
|
|
1643
|
-
|
|
1644
|
-
function parseCli(argv) {
|
|
1645
|
-
const o = { only: [], skip: [], tmpRoots: [], devRoots: [], artifactRoots: [], excludes: [] };
|
|
1646
|
-
const num = (k, v) => {
|
|
1647
|
-
if (!/^\d+$/.test(v)) throw new Error(`${k} needs a whole number, got "${v}"`);
|
|
1648
|
-
return Number(v);
|
|
1649
|
-
};
|
|
1650
|
-
for (const a of argv) {
|
|
1651
|
-
const [k, v = ""] = a.includes("=")
|
|
1652
|
-
? [a.slice(0, a.indexOf("=")), a.slice(a.indexOf("=") + 1)]
|
|
1653
|
-
: [a, ""];
|
|
1654
|
-
switch (k) {
|
|
1655
|
-
case "--apply":
|
|
1656
|
-
o.apply = true;
|
|
1657
|
-
break;
|
|
1658
|
-
case "--dry-run":
|
|
1659
|
-
o.dryRun = true;
|
|
1660
|
-
break;
|
|
1661
|
-
case "--trash":
|
|
1662
|
-
case "--transcripts":
|
|
1663
|
-
case "--test-artifacts":
|
|
1664
|
-
case "--unattended":
|
|
1665
|
-
case "--json":
|
|
1666
|
-
case "--list":
|
|
1667
|
-
o[k.slice(2)] = true;
|
|
1668
|
-
break;
|
|
1669
|
-
case "--include-recent":
|
|
1670
|
-
o.includeRecent = true;
|
|
1671
|
-
break;
|
|
1672
|
-
case "--exclude":
|
|
1673
|
-
if (!v) throw new Error("--exclude needs a path");
|
|
1674
|
-
o.excludes.push(v);
|
|
1675
|
-
break;
|
|
1676
|
-
case "--artifact-root":
|
|
1677
|
-
if (!v) throw new Error("--artifact-root needs a path");
|
|
1678
|
-
o.artifactRoots.push(v);
|
|
1679
|
-
break;
|
|
1680
|
-
case "--artifact-days":
|
|
1681
|
-
o.artifactDays = num(k, v);
|
|
1682
|
-
break;
|
|
1683
|
-
case "--depth":
|
|
1684
|
-
o.depth = num(k, v);
|
|
1685
|
-
break;
|
|
1686
|
-
case "--runtime-days":
|
|
1687
|
-
o.runtimeDays = num(k, v);
|
|
1688
|
-
break;
|
|
1689
|
-
case "--only":
|
|
1690
|
-
case "--skip":
|
|
1691
|
-
o[k.slice(2)].push(...v.split(",").filter(Boolean));
|
|
1692
|
-
break;
|
|
1693
|
-
case "--root":
|
|
1694
|
-
o.devRoots.push(v);
|
|
1695
|
-
break;
|
|
1696
|
-
case "--tmp-root":
|
|
1697
|
-
o.tmpRoots.push(v);
|
|
1698
|
-
break;
|
|
1699
|
-
case "--home":
|
|
1700
|
-
o.home = v;
|
|
1701
|
-
break;
|
|
1702
|
-
case "--report":
|
|
1703
|
-
o.report = v;
|
|
1704
|
-
break;
|
|
1705
|
-
case "--log-days":
|
|
1706
|
-
o.logDays = num(k, v);
|
|
1707
|
-
break;
|
|
1708
|
-
case "--archive-days":
|
|
1709
|
-
o.archiveDays = num(k, v);
|
|
1710
|
-
break;
|
|
1711
|
-
case "--scratch-hours":
|
|
1712
|
-
o.scratchHours = num(k, v);
|
|
1713
|
-
break;
|
|
1714
|
-
case "--build-hours":
|
|
1715
|
-
o.buildHours = num(k, v);
|
|
1716
|
-
break;
|
|
1717
|
-
case "--transcript-days":
|
|
1718
|
-
o.transcriptDays = num(k, v);
|
|
1719
|
-
break;
|
|
1720
|
-
case "--orphan-minutes":
|
|
1721
|
-
o.orphanMinutes = num(k, v);
|
|
1722
|
-
break;
|
|
1723
|
-
case "--top":
|
|
1724
|
-
o.top = num(k, v);
|
|
1725
|
-
break;
|
|
1726
|
-
case "-h":
|
|
1727
|
-
case "--help":
|
|
1728
|
-
o.help = true;
|
|
1729
|
-
break;
|
|
1730
|
-
default:
|
|
1731
|
-
throw new Error(`unknown option ${a}`);
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
const known = new Set(CATEGORIES.map((c) => c.id));
|
|
1735
|
-
for (const id of [...o.only, ...o.skip]) {
|
|
1736
|
-
if (!known.has(id)) throw new Error(`unknown category "${id}"; --list shows them`);
|
|
1737
|
-
}
|
|
1738
|
-
return o;
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
function usage() {
|
|
1742
|
-
const lines = readFileSafe(fileURLToPath(import.meta.url)).split("\n");
|
|
1743
|
-
const start = lines.findIndex((l) => l.includes("Usage:"));
|
|
1744
|
-
const end = lines.findIndex((l, i) => i > start && l.includes("@module"));
|
|
1745
|
-
return lines
|
|
1746
|
-
.slice(start, end)
|
|
1747
|
-
.map((l) => l.replace(/^ \*\s?/, ""))
|
|
1748
|
-
.join("\n");
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
function writeReport(file, data) {
|
|
1752
|
-
mkdirSync(dirname(file), { recursive: true });
|
|
1753
|
-
writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
|
|
1754
|
-
const dir = dirname(file);
|
|
1755
|
-
const old = listDir(dir)
|
|
1756
|
-
.filter((p) => /^report-.*\.json$/.test(basename(p)))
|
|
1757
|
-
.sort()
|
|
1758
|
-
.slice(0, -KEEP_REPORTS);
|
|
1759
|
-
for (const p of old) rmSync(p, { force: true });
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
/** The largest items of a category, how many are left out, and why items were kept. */
|
|
1763
|
-
export function categorySummary(c, top = DEFAULT_TOP) {
|
|
1764
|
-
const sorted = [...c.candidates].sort((a, b) => (b.bytes || 0) - (a.bytes || 0));
|
|
1765
|
-
const kept = {};
|
|
1766
|
-
for (const k of c.skipped) kept[k.reason] = (kept[k.reason] || 0) + 1;
|
|
1767
|
-
return {
|
|
1768
|
-
top: sorted.slice(0, top).map((x) => ({
|
|
1769
|
-
path: x.path,
|
|
1770
|
-
bytes: x.bytes,
|
|
1771
|
-
kind: x.kind,
|
|
1772
|
-
...(x.label ? { label: x.label } : {}),
|
|
1773
|
-
})),
|
|
1774
|
-
more: Math.max(0, sorted.length - top),
|
|
1775
|
-
kept,
|
|
1776
|
-
};
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
/** What an apply of this plan would free: blocked categories are not applied. */
|
|
1780
|
-
export function reclaimable(p) {
|
|
1781
|
-
return p.categories.filter((c) => !c.blocked).reduce((s, c) => s + c.bytes, 0);
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
function printPlan(p, mode, disk, top = 0) {
|
|
1785
|
-
const lines = [];
|
|
1786
|
-
const pct = disk.totalBytes ? ((disk.freeBytes / disk.totalBytes) * 100).toFixed(1) : "?";
|
|
1787
|
-
lines.push(
|
|
1788
|
-
`disk-cleaner: ${mode === "dry-run" ? "dry run, nothing deleted" : "apply"}. Free: ${human(disk.freeBytes)} of ${human(disk.totalBytes)} (${pct}%).`,
|
|
1789
|
-
);
|
|
1790
|
-
lines.push("");
|
|
1791
|
-
lines.push(`${"category".padEnd(18)} ${"items".padStart(6)} ${"size".padStart(9)} note`);
|
|
1792
|
-
for (const c of p.categories) {
|
|
1793
|
-
const note = [c.note, c.skipped.length ? `${c.skipped.length} kept` : null]
|
|
1794
|
-
.filter(Boolean)
|
|
1795
|
-
.join("; ");
|
|
1796
|
-
lines.push(
|
|
1797
|
-
`${c.id.padEnd(18)} ${String(c.candidates.length).padStart(6)} ${human(c.bytes).padStart(9)} ${note}`,
|
|
1798
|
-
);
|
|
1799
|
-
if (top > 0) {
|
|
1800
|
-
const s = categorySummary(c, top);
|
|
1801
|
-
for (const x of s.top)
|
|
1802
|
-
lines.push(
|
|
1803
|
-
`${"".padEnd(18)} ${human(x.bytes).padStart(16)} ${x.label ? `${x.label} ` : ""}${x.path}`,
|
|
1804
|
-
);
|
|
1805
|
-
if (s.more) lines.push(`${"".padEnd(18)} ${"".padStart(16)} + ${s.more} more`);
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
lines.push(`${"total".padEnd(18)} ${"".padStart(6)} ${human(p.totalBytes).padStart(9)}`);
|
|
1809
|
-
return lines.join("\n");
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
function heldLines(p, includeRecent) {
|
|
1813
|
-
const out = [];
|
|
1814
|
-
const h = p.held;
|
|
1815
|
-
if (h.items) {
|
|
1816
|
-
const parts = [
|
|
1817
|
-
`${h.aged} by age only (${human(h.agedBytes)})`,
|
|
1818
|
-
`${h.live} in use`,
|
|
1819
|
-
`${h.items - h.aged - h.live} by a category rule`,
|
|
1820
|
-
];
|
|
1821
|
-
const hint = h.aged && !includeRecent ? "; --include-recent includes the age-held ones" : "";
|
|
1822
|
-
out.push(`held back: ${h.items} items (${human(h.bytes)}): ${parts.join(", ")}${hint}`);
|
|
1823
|
-
}
|
|
1824
|
-
if (p.unreadable.count) {
|
|
1825
|
-
out.push(
|
|
1826
|
-
`unreadable: ${p.unreadable.count} folders (permission denied), so this report is incomplete; grant the terminal Full Disk Access to measure them`,
|
|
1827
|
-
);
|
|
1828
|
-
}
|
|
1829
|
-
return out;
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
function summarizeSkips(p) {
|
|
1833
|
-
const out = [];
|
|
1834
|
-
for (const c of p.categories) {
|
|
1835
|
-
const reasons = new Map();
|
|
1836
|
-
for (const s of c.skipped) reasons.set(s.reason, (reasons.get(s.reason) || 0) + 1);
|
|
1837
|
-
if (reasons.size) {
|
|
1838
|
-
out.push(`kept in ${c.id}: ${[...reasons].map(([r, n]) => `${n} ${r}`).join(", ")}`);
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
return out;
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
export function main(argv, env = process.env) {
|
|
1845
|
-
let o;
|
|
1846
|
-
try {
|
|
1847
|
-
o = parseCli(argv);
|
|
1848
|
-
} catch (e) {
|
|
1849
|
-
process.stderr.write(`disk-cleaner: ${e.message}\n`);
|
|
1850
|
-
return 2;
|
|
1851
|
-
}
|
|
1852
|
-
if (o.help) {
|
|
1853
|
-
process.stdout.write(usage() + "\n");
|
|
1854
|
-
return 0;
|
|
1855
|
-
}
|
|
1856
|
-
if (o.list) {
|
|
1857
|
-
for (const c of CATEGORIES) {
|
|
1858
|
-
const tags = [c.unattended ? "unattended-safe" : null, c.optIn ? `needs --${c.optIn}` : null]
|
|
1859
|
-
.filter(Boolean)
|
|
1860
|
-
.join(", ");
|
|
1861
|
-
process.stdout.write(`${c.id.padEnd(18)} ${c.label}${tags ? ` [${tags}]` : ""}\n`);
|
|
1862
|
-
}
|
|
1863
|
-
return 0;
|
|
1864
|
-
}
|
|
1865
|
-
const noProbes = env.DISK_CLEANER_NO_PROBES === "1";
|
|
1866
|
-
if (noProbes && o.apply) {
|
|
1867
|
-
process.stderr.write("disk-cleaner: --apply needs the open-file and process probes\n");
|
|
1868
|
-
return 2;
|
|
1869
|
-
}
|
|
1870
|
-
const unattended = Boolean(o.unattended) || env.MULTI_AGENT_UNATTENDED === "1";
|
|
1871
|
-
if (o.dryRun) o.apply = false;
|
|
1872
|
-
let depth = o.depth;
|
|
1873
|
-
if (depth == null && env.DISK_CLEANER_DEPTH) {
|
|
1874
|
-
if (!/^\d+$/.test(env.DISK_CLEANER_DEPTH)) {
|
|
1875
|
-
process.stderr.write("disk-cleaner: DISK_CLEANER_DEPTH needs a whole number\n");
|
|
1876
|
-
return 2;
|
|
1877
|
-
}
|
|
1878
|
-
depth = Number(env.DISK_CLEANER_DEPTH);
|
|
1879
|
-
}
|
|
1880
|
-
const home = o.home || homedir();
|
|
1881
|
-
const excludes = [];
|
|
1882
|
-
for (const raw of [...(env.DISK_CLEANER_EXCLUDE?.split(":") ?? []), ...o.excludes]) {
|
|
1883
|
-
if (!raw) continue;
|
|
1884
|
-
const expanded = raw === "~" ? home : raw.startsWith("~/") ? join(home, raw.slice(2)) : raw;
|
|
1885
|
-
const real = nativeReal(expanded);
|
|
1886
|
-
if (!real) {
|
|
1887
|
-
process.stderr.write(`disk-cleaner: --exclude path does not exist: ${raw}\n`);
|
|
1888
|
-
return 2;
|
|
1889
|
-
}
|
|
1890
|
-
excludes.push(real);
|
|
1891
|
-
}
|
|
1892
|
-
const ctx = makeContext({
|
|
1893
|
-
home: o.home,
|
|
1894
|
-
tmpRoots: o.tmpRoots.length ? o.tmpRoots : undefined,
|
|
1895
|
-
devRoots: o.devRoots.length ? o.devRoots : env.DISK_CLEANER_ROOTS?.split(":").filter(Boolean),
|
|
1896
|
-
artifactRoots: o.artifactRoots.length
|
|
1897
|
-
? o.artifactRoots
|
|
1898
|
-
: (env.DISK_CLEANER_ARTIFACT_ROOTS?.split(":").filter(Boolean) ?? []),
|
|
1899
|
-
logDays: o.logDays,
|
|
1900
|
-
archiveDays: o.archiveDays,
|
|
1901
|
-
transcriptDays: o.transcriptDays,
|
|
1902
|
-
scratchHours: o.scratchHours,
|
|
1903
|
-
repoBuildHours: o.buildHours,
|
|
1904
|
-
orphanMinutes: o.orphanMinutes,
|
|
1905
|
-
runtimeDays: o.runtimeDays,
|
|
1906
|
-
maxDepth: depth,
|
|
1907
|
-
excludes,
|
|
1908
|
-
includeRecent: unattended ? false : Boolean(o.includeRecent),
|
|
1909
|
-
...(noProbes
|
|
1910
|
-
? { ps: () => [], openPaths: () => [], run: () => ({ status: 127, stdout: "", stderr: "" }) }
|
|
1911
|
-
: {}),
|
|
1912
|
-
});
|
|
1913
|
-
const sel = {
|
|
1914
|
-
only: o.only,
|
|
1915
|
-
skip: o.skip,
|
|
1916
|
-
unattended,
|
|
1917
|
-
trash: unattended ? false : o.trash,
|
|
1918
|
-
transcripts: unattended ? false : o.transcripts,
|
|
1919
|
-
"test-artifacts": unattended ? false : o["test-artifacts"],
|
|
1920
|
-
};
|
|
1921
|
-
const before = diskStatus(ctx.home);
|
|
1922
|
-
const planned = plan(ctx, sel);
|
|
1923
|
-
const mode = o.apply ? "apply" : "dry-run";
|
|
1924
|
-
const report = {
|
|
1925
|
-
version: VERSION,
|
|
1926
|
-
mode,
|
|
1927
|
-
unattended,
|
|
1928
|
-
includeRecent: ctx.includeRecent,
|
|
1929
|
-
startedAt: new Date(ctx.now).toISOString(),
|
|
1930
|
-
disk: {
|
|
1931
|
-
before,
|
|
1932
|
-
expectedFreeBytes: before.freeBytes == null ? null : before.freeBytes + reclaimable(planned),
|
|
1933
|
-
},
|
|
1934
|
-
totalBytes: planned.totalBytes,
|
|
1935
|
-
reclaimableBytes: reclaimable(planned),
|
|
1936
|
-
held: planned.held,
|
|
1937
|
-
unreadable: planned.unreadable,
|
|
1938
|
-
categories: planned.categories.map((c) => ({
|
|
1939
|
-
id: c.id,
|
|
1940
|
-
label: c.label,
|
|
1941
|
-
bytes: c.bytes,
|
|
1942
|
-
note: c.note,
|
|
1943
|
-
candidates: c.candidates.map((x) => ({ path: x.path, bytes: x.bytes, kind: x.kind })),
|
|
1944
|
-
skipped: c.skipped,
|
|
1945
|
-
held: c.held,
|
|
1946
|
-
blocked: c.blocked || null,
|
|
1947
|
-
...categorySummary(c, o.top ?? DEFAULT_TOP),
|
|
1948
|
-
})),
|
|
1949
|
-
orphans: listOrphans(ctx),
|
|
1950
|
-
};
|
|
1951
|
-
let applied = null;
|
|
1952
|
-
if (o.apply) {
|
|
1953
|
-
applied = applyPlan(ctx, planned);
|
|
1954
|
-
const after = diskStatus(ctx.home);
|
|
1955
|
-
report.disk.after = after;
|
|
1956
|
-
report.applied = {
|
|
1957
|
-
...applied,
|
|
1958
|
-
freedBytes:
|
|
1959
|
-
after.freeBytes != null && before.freeBytes != null
|
|
1960
|
-
? Math.max(0, after.freeBytes - before.freeBytes)
|
|
1961
|
-
: null,
|
|
1962
|
-
};
|
|
1963
|
-
}
|
|
1964
|
-
const reportFile =
|
|
1965
|
-
o.report ||
|
|
1966
|
-
join(
|
|
1967
|
-
ctx.home,
|
|
1968
|
-
".claude",
|
|
1969
|
-
"logs",
|
|
1970
|
-
"disk-cleaner",
|
|
1971
|
-
`report-${report.startedAt.replace(/[:.]/g, "-")}.json`,
|
|
1972
|
-
);
|
|
1973
|
-
try {
|
|
1974
|
-
writeReport(reportFile, report);
|
|
1975
|
-
} catch (e) {
|
|
1976
|
-
process.stderr.write(`disk-cleaner: could not write the report: ${e.message}\n`);
|
|
1977
|
-
}
|
|
1978
|
-
if (o.json) {
|
|
1979
|
-
process.stdout.write(JSON.stringify(report, null, 2) + "\n");
|
|
1980
|
-
} else {
|
|
1981
|
-
const lines = [
|
|
1982
|
-
printPlan(planned, mode, before, o.top || 0),
|
|
1983
|
-
...summarizeSkips(planned),
|
|
1984
|
-
...heldLines(planned, ctx.includeRecent),
|
|
1985
|
-
];
|
|
1986
|
-
if (report.orphans.length) {
|
|
1987
|
-
lines.push(
|
|
1988
|
-
`orphaned session processes: ${report.orphans.length} (information only; never stopped)`,
|
|
1989
|
-
);
|
|
1990
|
-
}
|
|
1991
|
-
if (applied) {
|
|
1992
|
-
lines.push(
|
|
1993
|
-
`removed ${applied.removed}, failed ${applied.failed}; freed ${human(report.applied.freedBytes)} (df before ${human(before.freeBytes)}, after ${human(report.disk.after.freeBytes)})`,
|
|
1994
|
-
);
|
|
1995
|
-
for (const f of applied.failures.slice(0, 10)) {
|
|
1996
|
-
lines.push(` failed ${f.category}: ${f.path} (${f.reason})`);
|
|
1997
|
-
}
|
|
1998
|
-
for (const h of applied.held) {
|
|
1999
|
-
lines.push(` held ${h.category}: ${h.reason}${h.path ? ` (${h.path})` : ""}`);
|
|
2000
|
-
}
|
|
2001
|
-
} else {
|
|
2002
|
-
lines.push("re-run with --apply to delete the listed items");
|
|
2003
|
-
}
|
|
2004
|
-
lines.push(`report: ${reportFile}`);
|
|
2005
|
-
process.stdout.write(lines.join("\n") + "\n");
|
|
2006
|
-
}
|
|
2007
|
-
return applied && applied.failed > 0 ? 1 : 0;
|
|
2008
|
-
}
|
|
2009
|
-
|
|
2010
|
-
function invokedDirectly() {
|
|
2011
|
-
try {
|
|
2012
|
-
return import.meta.url === pathToFileURL(realpathSync(process.argv[1] ?? "")).href;
|
|
2013
|
-
} catch {
|
|
2014
|
-
return false;
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
if (invokedDirectly()) process.exitCode = main(process.argv.slice(2));
|