@leejungkiin/awkit 1.3.8 → 1.4.2

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.
Files changed (135) hide show
  1. package/bin/awk.js +630 -52
  2. package/bin/claude-generators.js +122 -0
  3. package/core/AGENTS.md +54 -0
  4. package/core/CLAUDE.md +155 -0
  5. package/core/GEMINI.md +44 -9
  6. package/core/GEMINI.md.bak +126 -199
  7. package/package.json +1 -1
  8. package/skills/ai-sprite-maker/SKILL.md +81 -0
  9. package/skills/ai-sprite-maker/scripts/animate_sprite.py +102 -0
  10. package/skills/ai-sprite-maker/scripts/process_sprites.py +140 -0
  11. package/skills/awf-session-restore/SKILL.md +12 -2
  12. package/skills/brainstorm-agent/SKILL.md +11 -8
  13. package/skills/code-review/SKILL.md +21 -33
  14. package/skills/gitnexus/gitnexus-cli/SKILL.md +82 -0
  15. package/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
  16. package/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
  17. package/skills/gitnexus/gitnexus-guide/SKILL.md +64 -0
  18. package/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
  19. package/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
  20. package/skills/lucylab-tts/SKILL.md +64 -0
  21. package/skills/lucylab-tts/resources/voices_library.json +908 -0
  22. package/skills/lucylab-tts/scripts/.env +1 -0
  23. package/skills/lucylab-tts/scripts/lucylab_tts.py +506 -0
  24. package/skills/nm-memory-sync/SKILL.md +14 -1
  25. package/skills/orchestrator/SKILL.md +5 -38
  26. package/skills/ship-to-code/SKILL.md +115 -0
  27. package/skills/short-maker/SKILL.md +150 -0
  28. package/skills/short-maker/_backup/storyboard.html +106 -0
  29. package/skills/short-maker/_backup/video_mixer.py +296 -0
  30. package/skills/short-maker/outputs/fitbite-promo/background.jpg +0 -0
  31. package/skills/short-maker/outputs/fitbite-promo/final/promo-final.mp4 +0 -0
  32. package/skills/short-maker/outputs/fitbite-promo/script.md +19 -0
  33. package/skills/short-maker/outputs/fitbite-promo/segments/scene-01.mp4 +0 -0
  34. package/skills/short-maker/outputs/fitbite-promo/segments/scene-02.mp4 +0 -0
  35. package/skills/short-maker/outputs/fitbite-promo/segments/scene-03.mp4 +0 -0
  36. package/skills/short-maker/outputs/fitbite-promo/segments/scene-04.mp4 +0 -0
  37. package/skills/short-maker/outputs/fitbite-promo/storyboard/scene-01.png +0 -0
  38. package/skills/short-maker/outputs/fitbite-promo/storyboard/scene-02.png +0 -0
  39. package/skills/short-maker/outputs/fitbite-promo/storyboard/scene-03.png +0 -0
  40. package/skills/short-maker/outputs/fitbite-promo/storyboard/scene-04.png +0 -0
  41. package/skills/short-maker/outputs/fitbite-promo/storyboard.html +133 -0
  42. package/skills/short-maker/outputs/fitbite-promo/storyboard.json +38 -0
  43. package/skills/short-maker/outputs/fitbite-promo/temp/merged_chroma.mp4 +0 -0
  44. package/skills/short-maker/outputs/fitbite-promo/temp/merged_crossfaded.mp4 +0 -0
  45. package/skills/short-maker/outputs/fitbite-promo/temp/ready_00.mp4 +0 -0
  46. package/skills/short-maker/outputs/fitbite-promo/temp/ready_01.mp4 +0 -0
  47. package/skills/short-maker/outputs/fitbite-promo/temp/ready_02.mp4 +0 -0
  48. package/skills/short-maker/outputs/fitbite-promo/temp/ready_03.mp4 +0 -0
  49. package/skills/short-maker/outputs/fitbite-promo/tts/manifest.json +31 -0
  50. package/skills/short-maker/outputs/fitbite-promo/tts/scene-01.wav +0 -0
  51. package/skills/short-maker/outputs/fitbite-promo/tts/scene-02.wav +0 -0
  52. package/skills/short-maker/outputs/fitbite-promo/tts/scene-03.wav +0 -0
  53. package/skills/short-maker/outputs/fitbite-promo/tts/scene-04.wav +0 -0
  54. package/skills/short-maker/outputs/fitbite-promo/tts_script.txt +11 -0
  55. package/skills/short-maker/scripts/google-flow-cli/.project-identity +41 -0
  56. package/skills/short-maker/scripts/google-flow-cli/.trae/rules/project_rules.md +52 -0
  57. package/skills/short-maker/scripts/google-flow-cli/CODEBASE.md +67 -0
  58. package/skills/short-maker/scripts/google-flow-cli/GoogleFlowCli.code-workspace +29 -0
  59. package/skills/short-maker/scripts/google-flow-cli/README.md +168 -0
  60. package/skills/short-maker/scripts/google-flow-cli/docs/specs/PROJECT.md +12 -0
  61. package/skills/short-maker/scripts/google-flow-cli/docs/specs/REQUIREMENTS.md +22 -0
  62. package/skills/short-maker/scripts/google-flow-cli/docs/specs/ROADMAP.md +16 -0
  63. package/skills/short-maker/scripts/google-flow-cli/docs/specs/TECH-SPEC.md +13 -0
  64. package/skills/short-maker/scripts/google-flow-cli/gflow/__init__.py +3 -0
  65. package/skills/short-maker/scripts/google-flow-cli/gflow/api/__init__.py +19 -0
  66. package/skills/short-maker/scripts/google-flow-cli/gflow/api/client.py +1921 -0
  67. package/skills/short-maker/scripts/google-flow-cli/gflow/api/models.py +64 -0
  68. package/skills/short-maker/scripts/google-flow-cli/gflow/api/rpc_ids.py +98 -0
  69. package/skills/short-maker/scripts/google-flow-cli/gflow/auth/__init__.py +15 -0
  70. package/skills/short-maker/scripts/google-flow-cli/gflow/auth/browser_auth.py +692 -0
  71. package/skills/short-maker/scripts/google-flow-cli/gflow/auth/humanizer.py +417 -0
  72. package/skills/short-maker/scripts/google-flow-cli/gflow/auth/proxy_ext.py +120 -0
  73. package/skills/short-maker/scripts/google-flow-cli/gflow/auth/recaptcha.py +482 -0
  74. package/skills/short-maker/scripts/google-flow-cli/gflow/batchexecute/__init__.py +5 -0
  75. package/skills/short-maker/scripts/google-flow-cli/gflow/batchexecute/client.py +414 -0
  76. package/skills/short-maker/scripts/google-flow-cli/gflow/cli/__init__.py +1 -0
  77. package/skills/short-maker/scripts/google-flow-cli/gflow/cli/main.py +1075 -0
  78. package/skills/short-maker/scripts/google-flow-cli/pyproject.toml +36 -0
  79. package/skills/short-maker/scripts/google-flow-cli/script.txt +22 -0
  80. package/skills/short-maker/scripts/google-flow-cli/tests/__init__.py +0 -0
  81. package/skills/short-maker/scripts/google-flow-cli/tests/test_batchexecute.py +113 -0
  82. package/skills/short-maker/scripts/google-flow-cli/tests/test_client.py +190 -0
  83. package/skills/short-maker/templates/aida_script.md +40 -0
  84. package/skills/short-maker/templates/mimic_analyzer.md +29 -0
  85. package/skills/single-flow-task-execution/SKILL.md +412 -0
  86. package/skills/single-flow-task-execution/code-quality-reviewer-prompt.md +20 -0
  87. package/skills/single-flow-task-execution/implementer-prompt.md +78 -0
  88. package/skills/single-flow-task-execution/spec-reviewer-prompt.md +61 -0
  89. package/skills/skill-creator/SKILL.md +44 -0
  90. package/skills/spm-build-analysis/SKILL.md +92 -0
  91. package/skills/spm-build-analysis/references/build-optimization-sources.md +155 -0
  92. package/skills/spm-build-analysis/references/recommendation-format.md +85 -0
  93. package/skills/spm-build-analysis/references/spm-analysis-checks.md +105 -0
  94. package/skills/spm-build-analysis/scripts/check_spm_pins.py +118 -0
  95. package/skills/symphony-enforcer/SKILL.md +83 -97
  96. package/skills/symphony-orchestrator/SKILL.md +1 -1
  97. package/skills/trello-sync/SKILL.md +52 -45
  98. package/skills/verification-gate/SKILL.md +13 -2
  99. package/skills/xcode-build-benchmark/SKILL.md +88 -0
  100. package/skills/xcode-build-benchmark/references/benchmark-artifacts.md +94 -0
  101. package/skills/xcode-build-benchmark/references/benchmarking-workflow.md +67 -0
  102. package/skills/xcode-build-benchmark/schemas/build-benchmark.schema.json +230 -0
  103. package/skills/xcode-build-benchmark/scripts/benchmark_builds.py +308 -0
  104. package/skills/xcode-build-fixer/SKILL.md +218 -0
  105. package/skills/xcode-build-fixer/references/build-settings-best-practices.md +216 -0
  106. package/skills/xcode-build-fixer/references/fix-patterns.md +290 -0
  107. package/skills/xcode-build-fixer/references/recommendation-format.md +85 -0
  108. package/skills/xcode-build-fixer/scripts/benchmark_builds.py +308 -0
  109. package/skills/xcode-build-orchestrator/SKILL.md +156 -0
  110. package/skills/xcode-build-orchestrator/references/benchmark-artifacts.md +94 -0
  111. package/skills/xcode-build-orchestrator/references/build-settings-best-practices.md +216 -0
  112. package/skills/xcode-build-orchestrator/references/orchestration-report-template.md +143 -0
  113. package/skills/xcode-build-orchestrator/references/recommendation-format.md +85 -0
  114. package/skills/xcode-build-orchestrator/scripts/benchmark_builds.py +308 -0
  115. package/skills/xcode-build-orchestrator/scripts/diagnose_compilation.py +273 -0
  116. package/skills/xcode-build-orchestrator/scripts/generate_optimization_report.py +533 -0
  117. package/skills/xcode-compilation-analyzer/SKILL.md +89 -0
  118. package/skills/xcode-compilation-analyzer/references/build-optimization-sources.md +155 -0
  119. package/skills/xcode-compilation-analyzer/references/code-compilation-checks.md +106 -0
  120. package/skills/xcode-compilation-analyzer/references/recommendation-format.md +85 -0
  121. package/skills/xcode-compilation-analyzer/scripts/diagnose_compilation.py +273 -0
  122. package/skills/xcode-project-analyzer/SKILL.md +76 -0
  123. package/skills/xcode-project-analyzer/references/build-optimization-sources.md +155 -0
  124. package/skills/xcode-project-analyzer/references/build-settings-best-practices.md +216 -0
  125. package/skills/xcode-project-analyzer/references/project-audit-checks.md +101 -0
  126. package/skills/xcode-project-analyzer/references/recommendation-format.md +85 -0
  127. package/templates/CODEBASE.md +26 -42
  128. package/templates/configs/trello-config.json +2 -2
  129. package/templates/workflow_dual_mode_template.md +5 -5
  130. package/workflows/_uncategorized/conductor-codex.md +125 -0
  131. package/workflows/_uncategorized/conductor.md +97 -0
  132. package/workflows/_uncategorized/ship-to-code.md +85 -0
  133. package/workflows/_uncategorized/trello-sync.md +52 -0
  134. package/workflows/context/codebase-sync.md +10 -87
  135. package/workflows/quality/visual-debug.md +66 -12
@@ -0,0 +1,155 @@
1
+ # Build Optimization Sources
2
+
3
+ This file stores the external sources that the README and skill docs should cite consistently.
4
+
5
+ ## Apple: Improving the speed of incremental builds
6
+
7
+ Source:
8
+
9
+ - <https://developer.apple.com/documentation/xcode/improving-the-speed-of-incremental-builds>
10
+
11
+ Key takeaways:
12
+
13
+ - Measure first with `Build With Timing Summary` or `xcodebuild -showBuildTimingSummary`.
14
+ - Accurate target dependencies improve correctness and parallelism.
15
+ - Run scripts should declare inputs and outputs so Xcode can skip unnecessary work.
16
+ - `.xcfilelist` files are appropriate when scripts have many inputs or outputs.
17
+ - Custom frameworks and libraries benefit from module maps, typically by enabling `DEFINES_MODULE`.
18
+ - Module reuse is strongest when related sources compile with consistent options.
19
+ - Breaking monolithic targets into better-scoped modules can reduce unnecessary rebuilds.
20
+
21
+ ## Apple: Improving build efficiency with good coding practices
22
+
23
+ Source:
24
+
25
+ - <https://developer.apple.com/documentation/xcode/improving-build-efficiency-with-good-coding-practices>
26
+
27
+ Key takeaways:
28
+
29
+ - Use framework-qualified imports when module maps are available.
30
+ - Keep Objective-C bridging surfaces narrow.
31
+ - Prefer explicit type information when inference becomes expensive.
32
+ - Use explicit delegate protocols instead of overly generic delegate types.
33
+ - Simplify complex expressions that are hard for the compiler to type-check.
34
+
35
+ ## Apple: Building your project with explicit module dependencies
36
+
37
+ Source:
38
+
39
+ - <https://developer.apple.com/documentation/xcode/building-your-project-with-explicit-module-dependencies>
40
+
41
+ Key takeaways:
42
+
43
+ - Explicit module builds make module work visible in the build log and improve scheduling.
44
+ - Repeated builds of the same module often point to avoidable module variants.
45
+ - Inconsistent build options across targets can force duplicate module builds.
46
+ - Timing summaries can reveal option drift that prevents module reuse.
47
+
48
+ ## SwiftLee: Build performance analysis for speeding up Xcode builds
49
+
50
+ Source:
51
+
52
+ - <https://www.avanderlee.com/optimization/analysing-build-performance-xcode/>
53
+
54
+ Key takeaways:
55
+
56
+ - Clean and incremental builds should both be measured because they reveal different problems.
57
+ - Build Timeline and Build Timing Summary are practical starting points for build optimization.
58
+ - Build scripts often produce large incremental-build wins when guarded correctly.
59
+ - `-warn-long-function-bodies` and `-warn-long-expression-type-checking` help surface compile hotspots.
60
+ - Typical debug and release build setting mismatches are worth auditing, especially in older projects.
61
+
62
+ ## Apple: Xcode Release Notes -- Compilation Caching
63
+
64
+ Source:
65
+
66
+ - Xcode Release Notes (149700201)
67
+
68
+ Key takeaways:
69
+
70
+ - Compilation caching is an opt-in feature for Swift and C-family languages.
71
+ - It caches prior compilation results and reuses them when the same source inputs are recompiled.
72
+ - Branch switching and clean builds benefit the most.
73
+ - Can be enabled via the "Enable Compilation Caching" build setting or per-user project settings.
74
+
75
+ ## Apple: Demystify explicitly built modules (WWDC24)
76
+
77
+ Source:
78
+
79
+ - <https://developer.apple.com/videos/play/wwdc2024/10171/>
80
+
81
+ Key takeaways:
82
+
83
+ - Explains how explicitly built modules divide compilation into scan, module build, and source compile stages.
84
+ - Unrelated modules build in parallel, improving CPU utilization.
85
+ - Module variant duplication is a key bottleneck -- uniform compiler options across targets prevent it.
86
+ - The build log shows each module as a discrete task, making it easier to diagnose scheduling issues.
87
+
88
+ ## Swift Compile-Time Best Practices
89
+
90
+ Well-known Swift language patterns that reduce type-checker workload during compilation:
91
+
92
+ - Mark classes `final` when they are not intended for subclassing. This eliminates dynamic dispatch overhead and allows the compiler to de-virtualize method calls.
93
+ - Restrict access control to the narrowest useful scope (`private`, `fileprivate`). Fewer visible symbols reduce the compiler's search space during type resolution.
94
+ - Prefer value types (`struct`, `enum`) over `class` when reference semantics are not needed. Value types are simpler for the compiler to reason about.
95
+ - Break long method chains (`.map().flatMap().filter()`) into intermediate `let` bindings with explicit type annotations. Even simple-looking chains can take seconds to type-check.
96
+ - Provide explicit return types on closures passed to generic functions, especially in SwiftUI result-builder contexts.
97
+ - Decompose large SwiftUI `body` properties into smaller extracted subviews. Each subview narrows the scope of the result-builder expression the type-checker must resolve.
98
+
99
+ ## Bitrise: Demystifying Explicitly Built Modules for Xcode
100
+
101
+ Source:
102
+
103
+ - <https://bitrise.io/blog/post/demystifying-explicitly-built-modules-for-xcode>
104
+
105
+ Key takeaways:
106
+
107
+ - Explicit module builds give `xcodebuild` visibility into smaller compilation tasks for better parallelism.
108
+ - Enabled by default for C/Objective-C in Xcode 16+; experimental for Swift.
109
+ - Minimizing module variants by aligning build options is the primary optimization lever.
110
+ - Some projects see regressions from dependency scanning overhead -- benchmark before and after.
111
+
112
+ ## Bitrise: Xcode Compilation Cache FAQ
113
+
114
+ Source:
115
+
116
+ - <https://docs.bitrise.io/en/bitrise-build-cache/build-cache-for-xcode/xcode-compilation-cache-faq.html>
117
+
118
+ Key takeaways:
119
+
120
+ - Granular caching is controlled by `SWIFT_ENABLE_COMPILE_CACHE` and `CLANG_ENABLE_COMPILE_CACHE`, under the umbrella `COMPILATION_CACHING` setting.
121
+ - Non-cacheable tasks include `CompileStoryboard`, `CompileXIB`, `CompileAssetCatalogVariant`, `PhaseScriptExecution`, `DataModelCompile`, `CopyPNGFile`, `GenerateDSYMFile`, and `Ld`.
122
+ - SPM dependencies are not yet cacheable as of Xcode 26 beta.
123
+
124
+ ## RocketSim Docs: Build Insights
125
+
126
+ Sources:
127
+
128
+ - <https://www.rocketsim.app/docs/features/build-insights/build-insights/>
129
+ - <https://www.rocketsim.app/docs/features/build-insights/team-build-insights/>
130
+
131
+ Key takeaways:
132
+
133
+ - RocketSim automatically tracks clean vs incremental builds over time without build scripts.
134
+ - It reports build counts, duration trends, and percentile-based metrics such as p75 and p95.
135
+ - Team Build Insights adds machine, Xcode, and macOS comparisons for cross-team visibility.
136
+ - This repository is best positioned as the point-in-time analyze-and-improve toolkit, while RocketSim is the monitor-over-time companion.
137
+
138
+ ## Swift Forums: Slow incremental builds because of planning swift module
139
+
140
+ Source:
141
+
142
+ - <https://forums.swift.org/t/slow-incremental-builds-because-of-planning-swift-module/84803>
143
+
144
+ Key takeaways:
145
+
146
+ - "Planning Swift module" can dominate incremental builds (up to 30s per module), sometimes exceeding clean build time.
147
+ - Replanning every module without scheduling compiles is a sign that build inputs are being modified unexpectedly (e.g., a misconfigured linter touching file timestamps).
148
+ - Enable **Task Backtraces** (Xcode 16.4+: Scheme Editor > Build > Build Debugging) to see why each task re-ran in an incremental build.
149
+ - Heavy Swift macro usage (e.g., TCA / swift-syntax) can cause trivial changes to cascade into near-full rebuilds.
150
+ - `swift-syntax` builds universally (all architectures) when no prebuilt binary is available, adding significant overhead.
151
+ - `SwiftEmitModule` can take 60s+ after a single-line change in large modules.
152
+ - Asset catalog compilation is single-threaded per target; splitting assets into separate bundles across targets enables parallel compilation.
153
+ - Multi-platform targets (e.g., adding watchOS) can cause SPM packages to build 3x (iOS arm64, iOS x86_64, watchOS arm64).
154
+ - Zero-change incremental builds still incur ~10s of fixed overhead: compute dependencies, send project description, create build description, script phases, codesigning, and validation.
155
+ - Codesigning and validation run even when output has not changed.
@@ -0,0 +1,106 @@
1
+ # Code Compilation Checks
2
+
3
+ Use this reference when a build benchmark shows compilation dominating build time.
4
+
5
+ ## Primary Evidence Sources
6
+
7
+ - `xcodebuild -showBuildTimingSummary`
8
+ - build log compile tasks
9
+ - `-warn-long-function-bodies`
10
+ - `-warn-long-expression-type-checking`
11
+ - `-debug-time-compilation` (per-file compile time ranking)
12
+ - `-debug-time-function-bodies` (unfiltered per-function timing)
13
+ - `-driver-time-compilation` (driver overhead)
14
+ - `-stats-output-dir` (detailed compiler statistics as JSON)
15
+
16
+ ## Triage Questions
17
+
18
+ 1. Is one file or expression dominating compile time?
19
+ 2. Is the issue mostly Swift type-checking, mixed-language bridging, or header import churn?
20
+ 3. Are multiple files in the same module paying the same module-setup cost repeatedly?
21
+ 4. Is `SwiftEmitModule` disproportionately large for any target? If a single-line change triggers 60s+ of module emission, the target is likely too large or heavily macro-dependent.
22
+ 5. Does `Planning Swift module` dominate incremental builds? If modules are replanned but no compiles are scheduled, build inputs are being invalidated unexpectedly.
23
+
24
+ ## Checklist
25
+
26
+ ### Explicit typing
27
+
28
+ - Add explicit property or local variable types when initialization expressions are complex.
29
+ - Prefer intermediate typed variables over one giant inferred expression.
30
+
31
+ ### Expression simplification
32
+
33
+ - Break long chains into smaller expressions.
34
+ - Split complex result-builder code into smaller helpers or subviews.
35
+ - Replace nested ternaries or overloaded generic chains with simpler steps.
36
+
37
+ ### Delegate typing
38
+
39
+ - Avoid `AnyObject?` or overly generic delegate surfaces.
40
+ - Prefer a named delegate protocol so the compiler has a narrower lookup space.
41
+
42
+ ### Objective-C and Swift bridging
43
+
44
+ - Keep the Objective-C bridging header narrow.
45
+ - Move internal-only Objective-C declarations out of the bridging surface.
46
+ - Mark Swift members `private` when they do not need Objective-C visibility.
47
+
48
+ ### Framework-qualified imports
49
+
50
+ - Prefer `#import <Framework/Header.h>` or module imports when a module map exists.
51
+ - Watch for textual includes that defeat module-cache reuse.
52
+
53
+ ### Access control and dispatch optimization
54
+
55
+ - Mark classes not intended for subclassing as `final`. This eliminates virtual dispatch overhead and lets the compiler de-virtualize method calls, reducing both compile and runtime cost.
56
+ - Use `private` or `fileprivate` for properties and methods not used outside their declaration or file. Narrower visibility reduces the compiler's symbol search space.
57
+ - Prefer `internal` (the default) over `public` unless the symbol genuinely crosses module boundaries. Wider access forces the compiler to consider more call sites.
58
+
59
+ ### Value types over reference types
60
+
61
+ - Prefer `struct` and `enum` over `class` when reference semantics are not needed. Value types are simpler for the compiler to reason about and do not require vtable dispatch.
62
+ - When a class exists solely to group data without identity semantics, convert it to a struct.
63
+
64
+ ### SwiftUI view decomposition
65
+
66
+ - Extract subviews into dedicated `struct View` types instead of using `@ViewBuilder` helper properties. Separate structs reduce the type-checker scope per `body` property.
67
+ - Break monolithic `body` properties (roughly 50+ lines) into smaller composed subviews. Large result-builder bodies are among the most expensive expressions to type-check.
68
+ - Avoid deeply nested `Group`/`VStack`/`HStack` hierarchies within a single body.
69
+
70
+ ### Closure and chain patterns
71
+
72
+ - Avoid long method chains like `.map().flatMap().filter().reduce()` without intermediate type annotations. Each link in the chain multiplies the type-checker's candidate set.
73
+ - Break complex closures into named functions with explicit parameter and return types.
74
+ - Add explicit return types to closures passed to generic functions so the compiler does not need to infer them from context.
75
+
76
+ ### Generic constraint complexity
77
+
78
+ - Minimize deeply nested generic constraints (e.g., `where T: Collection, T.Element: Comparable, T.Element.SubSequence: ...`). Each additional constraint widens the compiler's search space.
79
+ - Use type aliases to flatten complex generic stacks into readable names.
80
+ - Prefer `some Protocol` (opaque return types) over unconstrained generics when the concrete type does not need to be visible to callers.
81
+
82
+ ### Module emission and planning overhead
83
+
84
+ - Check `SwiftEmitModule` time in the Build Timing Summary. Large modules with many public symbols take longer to emit, and this cost is paid on every incremental build that touches the module.
85
+ - If `SwiftEmitModule` exceeds compile time for the same target, the module's public API surface may be unnecessarily wide -- narrow access control or split the module.
86
+ - Check `Planning Swift module` time. If it is significant in incremental builds, escalate to `xcode-project-analyzer` to investigate unexpected input invalidation or misconfigured scripts.
87
+
88
+ ### Precompiled and prefix headers
89
+
90
+ - For mixed-language projects with large Objective-C codebases, verify that prefix headers are not bloated with unnecessary imports. Every import in a prefix header is parsed for every translation unit.
91
+ - Migrate away from prefix headers toward explicit module imports where possible.
92
+
93
+ ## Recommendation Heuristics
94
+
95
+ - High impact: repeated type-check warnings in a hot module, giant bridging headers, or a few files dominating compile time.
96
+ - Medium impact: several moderate hotspots in result builders or overloaded generic code.
97
+ - Low impact: isolated warnings without measurable benchmark impact.
98
+
99
+ ## Escalation Guidance
100
+
101
+ Hand findings to `xcode-project-analyzer` when:
102
+
103
+ - build scripts dominate instead of compilation
104
+ - module reuse is blocked by project settings
105
+ - target structure or explicit-module settings appear to be the real bottleneck
106
+ - `Planning Swift module` overhead points to input invalidation or script-related causes rather than source complexity
@@ -0,0 +1,85 @@
1
+ # Recommendation Format
2
+
3
+ All optimization skills should report recommendations in a shared structure so the orchestrator can merge and prioritize them cleanly.
4
+
5
+ ## Required Fields
6
+
7
+ Each recommendation should include:
8
+
9
+ - `title`
10
+ - `wait_time_impact` -- plain-language statement of expected wall-clock impact, e.g. "Expected to reduce your clean build by ~3s", "Reduces parallel compile work but unlikely to reduce build wait time", or "Impact on wait time is uncertain -- re-benchmark to confirm"
11
+ - `actionability` -- classifies how fixable the issue is from the project (see values below)
12
+ - `category`
13
+ - `observed_evidence`
14
+ - `estimated_impact`
15
+ - `confidence`
16
+ - `approval_required`
17
+ - `benchmark_verification_status`
18
+
19
+ ### Actionability Values
20
+
21
+ Every recommendation must include an `actionability` classification:
22
+
23
+ - `repo-local` -- Fix lives entirely in project files, source code, or local configuration. The developer can apply it without side effects outside the repo.
24
+ - `package-manager` -- Requires CocoaPods or SPM configuration changes that may have broad side effects (e.g., linkage mode, dependency restructuring). These should be benchmarked before and after.
25
+ - `xcode-behavior` -- Observed cost is driven by Xcode internals and is not suppressible from the project. Report the finding for awareness but do not promise a fix.
26
+ - `upstream` -- Requires changes in a third-party dependency or external tool. The developer cannot fix it locally.
27
+
28
+ ## Suggested Optional Fields
29
+
30
+ - `scope`
31
+ - `affected_files`
32
+ - `affected_targets`
33
+ - `affected_packages`
34
+ - `implementation_notes`
35
+ - `risk_level`
36
+
37
+ ## JSON Example
38
+
39
+ ```json
40
+ {
41
+ "recommendations": [
42
+ {
43
+ "title": "Guard a release-only symbol upload script",
44
+ "wait_time_impact": "Expected to reduce your incremental build by approximately 6 seconds.",
45
+ "actionability": "repo-local",
46
+ "category": "project",
47
+ "observed_evidence": [
48
+ "Incremental builds spend 6.3 seconds in a run script phase.",
49
+ "The script runs for Debug builds even though the output is only needed in Release."
50
+ ],
51
+ "estimated_impact": "High incremental-build improvement",
52
+ "confidence": "High",
53
+ "approval_required": true,
54
+ "benchmark_verification_status": "Not yet verified",
55
+ "scope": "Target build phase",
56
+ "risk_level": "Low"
57
+ }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ ## Markdown Rendering Guidance
63
+
64
+ When rendering for human review, preserve the same field order:
65
+
66
+ 1. title
67
+ 2. wait-time impact
68
+ 3. actionability
69
+ 4. observed evidence
70
+ 5. estimated impact
71
+ 6. confidence
72
+ 7. approval required
73
+ 8. benchmark verification status
74
+
75
+ That makes it easier for the developer to approve or reject specific items quickly.
76
+
77
+ ## Verification Status Values
78
+
79
+ Recommended values:
80
+
81
+ - `Not yet verified`
82
+ - `Queued for verification`
83
+ - `Verified improvement`
84
+ - `No measurable improvement`
85
+ - `Inconclusive due to benchmark noise`
@@ -0,0 +1,273 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """Run a single Xcode build with -Xfrontend diagnostics to find slow type-checking."""
4
+
5
+ import argparse
6
+ import json
7
+ import re
8
+ import subprocess
9
+ import sys
10
+ import time
11
+ from datetime import datetime, timezone
12
+ from pathlib import Path
13
+ from typing import Dict, List, Optional
14
+
15
+ _TYPECHECK_RE = re.compile(
16
+ r"^(?P<file>.+?):(?P<line>\d+):(?P<col>\d+): warning: "
17
+ r"(?P<kind>instance method|global function|getter|type-check|expression) "
18
+ r"'?(?P<name>[^']*?)'?\s+took\s+(?P<ms>\d+)ms\s+to\s+type-check"
19
+ )
20
+
21
+ _EXPRESSION_RE = re.compile(
22
+ r"^(?P<file>.+?):(?P<line>\d+):(?P<col>\d+): warning: "
23
+ r"expression took\s+(?P<ms>\d+)ms\s+to\s+type-check"
24
+ )
25
+
26
+ _FILE_TIME_RE = re.compile(
27
+ r"^\s*(?P<seconds>\d+(?:\.\d+)?)\s+seconds\s+.*\s+compiling\s+(?P<file>\S+)"
28
+ )
29
+
30
+
31
+ def parse_args() -> argparse.Namespace:
32
+ parser = argparse.ArgumentParser(
33
+ description="Run an Xcode build with -Xfrontend type-checking diagnostics."
34
+ )
35
+ group = parser.add_mutually_exclusive_group(required=True)
36
+ group.add_argument("--workspace", help="Path to the .xcworkspace file")
37
+ group.add_argument("--project", help="Path to the .xcodeproj file")
38
+ parser.add_argument("--scheme", required=True, help="Scheme to build")
39
+ parser.add_argument("--configuration", default="Debug", help="Build configuration")
40
+ parser.add_argument("--destination", help="xcodebuild destination string")
41
+ parser.add_argument("--derived-data-path", help="DerivedData path override")
42
+ parser.add_argument("--output-dir", default=".build-benchmark", help="Output directory")
43
+ parser.add_argument(
44
+ "--threshold",
45
+ type=int,
46
+ default=100,
47
+ help="Millisecond threshold for -warn-long-function-bodies and "
48
+ "-warn-long-expression-type-checking (default: 100)",
49
+ )
50
+ parser.add_argument("--skip-clean", action="store_true", help="Skip clean before build")
51
+ parser.add_argument(
52
+ "--per-file-timing",
53
+ action="store_true",
54
+ help="Add -Xfrontend -debug-time-compilation to report per-file compile times.",
55
+ )
56
+ parser.add_argument(
57
+ "--stats-output",
58
+ action="store_true",
59
+ help="Add -Xfrontend -stats-output-dir to collect detailed compiler statistics.",
60
+ )
61
+ parser.add_argument(
62
+ "--extra-arg",
63
+ action="append",
64
+ default=[],
65
+ help="Additional xcodebuild argument. Can be passed multiple times.",
66
+ )
67
+ return parser.parse_args()
68
+
69
+
70
+ def command_base(args: argparse.Namespace) -> List[str]:
71
+ command = ["xcodebuild"]
72
+ if args.workspace:
73
+ command.extend(["-workspace", args.workspace])
74
+ if args.project:
75
+ command.extend(["-project", args.project])
76
+ command.extend(["-scheme", args.scheme, "-configuration", args.configuration])
77
+ if args.destination:
78
+ command.extend(["-destination", args.destination])
79
+ if args.derived_data_path:
80
+ command.extend(["-derivedDataPath", args.derived_data_path])
81
+ command.extend(args.extra_arg)
82
+ return command
83
+
84
+
85
+ def parse_diagnostics(output: str) -> List[Dict]:
86
+ """Extract type-checking warnings from xcodebuild output."""
87
+ warnings: List[Dict] = []
88
+ seen = set()
89
+ for raw_line in output.splitlines():
90
+ line = raw_line.strip()
91
+ match = _TYPECHECK_RE.match(line)
92
+ if match:
93
+ key = (match.group("file"), match.group("line"), match.group("col"), "function-body")
94
+ if key in seen:
95
+ continue
96
+ seen.add(key)
97
+ warnings.append(
98
+ {
99
+ "file": match.group("file"),
100
+ "line": int(match.group("line")),
101
+ "column": int(match.group("col")),
102
+ "duration_ms": int(match.group("ms")),
103
+ "kind": "function-body",
104
+ "name": match.group("name"),
105
+ }
106
+ )
107
+ continue
108
+ match = _EXPRESSION_RE.match(line)
109
+ if match:
110
+ key = (match.group("file"), match.group("line"), match.group("col"), "expression")
111
+ if key in seen:
112
+ continue
113
+ seen.add(key)
114
+ warnings.append(
115
+ {
116
+ "file": match.group("file"),
117
+ "line": int(match.group("line")),
118
+ "column": int(match.group("col")),
119
+ "duration_ms": int(match.group("ms")),
120
+ "kind": "expression",
121
+ "name": "",
122
+ }
123
+ )
124
+ warnings.sort(key=lambda w: w["duration_ms"], reverse=True)
125
+ return warnings
126
+
127
+
128
+ def parse_file_timings(output: str) -> List[Dict]:
129
+ """Extract per-file compile times from -debug-time-compilation output."""
130
+ timings: List[Dict] = []
131
+ seen = set()
132
+ for raw_line in output.splitlines():
133
+ match = _FILE_TIME_RE.match(raw_line.strip())
134
+ if match:
135
+ filepath = match.group("file")
136
+ if filepath in seen:
137
+ continue
138
+ seen.add(filepath)
139
+ timings.append(
140
+ {
141
+ "file": filepath,
142
+ "duration_seconds": float(match.group("seconds")),
143
+ }
144
+ )
145
+ timings.sort(key=lambda t: t["duration_seconds"], reverse=True)
146
+ return timings
147
+
148
+
149
+ def main() -> int:
150
+ args = parse_args()
151
+ output_dir = Path(args.output_dir)
152
+ output_dir.mkdir(parents=True, exist_ok=True)
153
+
154
+ timestamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
155
+ scheme_slug = args.scheme.replace(" ", "-").lower()
156
+ artifact_stem = f"{timestamp}-{scheme_slug}"
157
+ base = command_base(args)
158
+
159
+ if not args.skip_clean:
160
+ print("Cleaning build products...")
161
+ clean = subprocess.run([*base, "clean"], capture_output=True, text=True)
162
+ if clean.returncode != 0:
163
+ sys.stderr.write(clean.stdout + clean.stderr)
164
+ return clean.returncode
165
+
166
+ threshold = str(args.threshold)
167
+ swift_flags = (
168
+ f"$(inherited) -Xfrontend -warn-long-function-bodies={threshold} "
169
+ f"-Xfrontend -warn-long-expression-type-checking={threshold}"
170
+ )
171
+ if args.per_file_timing:
172
+ swift_flags += " -Xfrontend -debug-time-compilation"
173
+
174
+ stats_dir: Optional[Path] = None
175
+ if args.stats_output:
176
+ stats_dir = output_dir / f"{artifact_stem}-stats"
177
+ stats_dir.mkdir(parents=True, exist_ok=True)
178
+ swift_flags += f" -Xfrontend -stats-output-dir -Xfrontend {stats_dir}"
179
+
180
+ build_command = [
181
+ *base,
182
+ "build",
183
+ "-showBuildTimingSummary",
184
+ f"OTHER_SWIFT_FLAGS={swift_flags}",
185
+ ]
186
+
187
+ extras = []
188
+ if args.per_file_timing:
189
+ extras.append("per-file timing")
190
+ if args.stats_output:
191
+ extras.append("stats output")
192
+ extras_label = f" + {', '.join(extras)}" if extras else ""
193
+ print(f"Building with type-check threshold {threshold}ms{extras_label}...")
194
+ started = time.perf_counter()
195
+ result = subprocess.run(build_command, capture_output=True, text=True)
196
+ elapsed = round(time.perf_counter() - started, 3)
197
+
198
+ combined_output = result.stdout + result.stderr
199
+ log_path = output_dir / f"{artifact_stem}-diagnostics.log"
200
+ log_path.write_text(combined_output)
201
+
202
+ warnings = parse_diagnostics(combined_output)
203
+
204
+ file_timings: Optional[List[Dict]] = None
205
+ if args.per_file_timing:
206
+ file_timings = parse_file_timings(combined_output)
207
+
208
+ artifact = {
209
+ "schema_version": "1.0.0",
210
+ "created_at": datetime.now(timezone.utc).isoformat(),
211
+ "type": "compilation-diagnostics",
212
+ "build": {
213
+ "entrypoint": "workspace" if args.workspace else "project",
214
+ "path": args.workspace or args.project,
215
+ "scheme": args.scheme,
216
+ "configuration": args.configuration,
217
+ "destination": args.destination or "",
218
+ },
219
+ "threshold_ms": args.threshold,
220
+ "build_duration_seconds": elapsed,
221
+ "build_success": result.returncode == 0,
222
+ "raw_log_path": str(log_path),
223
+ "warnings": warnings,
224
+ "summary": {
225
+ "total_warnings": len(warnings),
226
+ "function_body_warnings": sum(1 for w in warnings if w["kind"] == "function-body"),
227
+ "expression_warnings": sum(1 for w in warnings if w["kind"] == "expression"),
228
+ "slowest_ms": warnings[0]["duration_ms"] if warnings else 0,
229
+ },
230
+ }
231
+
232
+ if file_timings is not None:
233
+ artifact["per_file_timings"] = file_timings
234
+ if stats_dir is not None:
235
+ artifact["stats_dir"] = str(stats_dir)
236
+
237
+ artifact_path = output_dir / f"{artifact_stem}-diagnostics.json"
238
+ artifact_path.write_text(json.dumps(artifact, indent=2) + "\n")
239
+
240
+ print(f"\nSaved diagnostics artifact: {artifact_path}")
241
+ print(f"Build {'succeeded' if result.returncode == 0 else 'failed'} in {elapsed}s")
242
+ print(f"Found {len(warnings)} type-check warnings above {threshold}ms threshold\n")
243
+
244
+ if warnings:
245
+ print(f"{'Duration':>10} {'Kind':<15} {'Location'}")
246
+ print(f"{'--------':>10} {'----':<15} {'--------'}")
247
+ for w in warnings[:20]:
248
+ loc = f"{w['file']}:{w['line']}:{w['column']}"
249
+ label = w["name"] if w["name"] else "(expression)"
250
+ print(f"{w['duration_ms']:>8}ms {w['kind']:<15} {loc} {label}")
251
+ if len(warnings) > 20:
252
+ print(f"\n ... and {len(warnings) - 20} more (see {artifact_path})")
253
+ else:
254
+ print("No type-checking hotspots found above threshold.")
255
+
256
+ if file_timings:
257
+ print(f"\nPer-file compile times (top 20):\n")
258
+ print(f"{'Duration':>12} {'File'}")
259
+ print(f"{'--------':>12} {'----'}")
260
+ for t in file_timings[:20]:
261
+ print(f"{t['duration_seconds']:>10.3f}s {t['file']}")
262
+ if len(file_timings) > 20:
263
+ print(f"\n ... and {len(file_timings) - 20} more (see {artifact_path})")
264
+
265
+ if stats_dir is not None:
266
+ stat_files = list(stats_dir.glob("*.json"))
267
+ print(f"\nCompiler statistics: {len(stat_files)} files written to {stats_dir}")
268
+
269
+ return 0
270
+
271
+
272
+ if __name__ == "__main__":
273
+ raise SystemExit(main())