├── .swift-version ├── .periphery.yml ├── Macros ├── Options │ ├── .swift-version │ ├── .periphery.yml │ ├── codecov.yml │ ├── .hound.yml │ ├── Mintfile │ ├── logo.png │ ├── .spi.yml │ ├── Scripts │ │ ├── docc.sh │ │ └── lint.sh │ ├── project.yml │ ├── .gitrepo │ ├── Package.swift │ ├── LICENSE │ ├── .swiftformat │ ├── Tests │ │ └── OptionsTests │ │ │ ├── Mocks │ │ │ ├── MockError.swift │ │ │ └── MockDictionaryEnum.swift │ │ │ └── MappedValueRepresentableTests.swift │ ├── Sources │ │ ├── OptionsMacros │ │ │ ├── InvalidDeclError.swift │ │ │ ├── MacrosPlugin.swift │ │ │ └── Extensions │ │ │ │ ├── DeclModifierSyntax.swift │ │ │ │ ├── Array.swift │ │ │ │ ├── TypeAliasDeclSyntax.swift │ │ │ │ ├── DeclModifierListSyntax.swift │ │ │ │ ├── DictionaryExprSyntax.swift │ │ │ │ ├── EnumDeclSyntax.swift │ │ │ │ ├── InheritanceClauseSyntax.swift │ │ │ │ ├── ArrayExprSyntax.swift │ │ │ │ └── DictionaryElementSyntax.swift │ │ └── Options │ │ │ ├── MappedValues.swift │ │ │ ├── Macro.swift │ │ │ ├── MappedValueRepresentableError.swift │ │ │ └── CodingOptions.swift │ └── Package@swift-6.1.swift └── SKSampleMacro │ ├── .gitignore │ ├── Sources │ ├── SKSampleMacroClient │ │ └── main.swift │ ├── SKSampleMacro │ │ └── SKSampleMacro.swift │ └── SKSampleMacroMacros │ │ └── SKSampleMacroMacro.swift │ ├── Package.resolved │ └── Tests │ └── SKSampleMacroTests │ └── SKSampleMacroTests.swift ├── Examples ├── Completed │ ├── attributes │ │ ├── syntax.json │ │ ├── code.swift │ │ └── dsl.swift │ ├── enum_generator │ │ ├── Package.resolved │ │ ├── api-config.json │ │ ├── Package.swift │ │ ├── generate.swift │ │ ├── before │ │ │ ├── HTTPStatus.swift │ │ │ ├── APIEndpoint.swift │ │ │ └── NetworkError.swift │ │ ├── code.swift │ │ └── after │ │ │ └── Generated.swift │ ├── swiftui │ │ └── code.swift │ ├── errors_async │ │ └── code.swift │ ├── for_loops │ │ └── code.swift │ ├── concurrency │ │ ├── code.swift │ │ └── dsl.swift │ ├── blackjack │ │ └── code.swift │ ├── card_game │ │ └── code.swift │ └── protocols │ │ └── code.swift └── Remaining │ └── generics │ ├── code.swift │ └── dsl.swift ├── codecov.yml ├── Mintfile ├── .spi.yml ├── Tests ├── SyntaxKitTests │ ├── Integration │ │ ├── .swiftlint.yml │ │ └── BlackjackCardTests.swift │ └── Unit │ │ ├── Expressions │ │ └── LiteralTests.swift │ │ ├── Utilities │ │ └── NormalizeOptions.swift │ │ ├── ErrorHandling │ │ └── ThrowEdgeCaseTests.swift │ │ ├── ControlFlow │ │ └── ForLoopTests.swift │ │ └── Integration │ │ └── OptionsMacroIntegrationTestsAPI.swift └── SyntaxDocTests │ ├── DocumentationTestError.swift │ └── Settings.swift ├── Sources ├── SyntaxKit │ ├── Documentation.docc │ │ └── Resources │ │ │ ├── SyntaxKit_Logo.png │ │ │ ├── SyntaxKit_Logo.pxd │ │ │ ├── SyntaxKit_Logo@2x.png │ │ │ └── SyntaxKit_Logo@3x.png │ ├── Expressions │ │ ├── Infix+Comparison.swift │ │ ├── Literal+PatternConvertible.swift │ │ ├── LiteralValue.swift │ │ ├── PropertyAccessible.swift │ │ └── Literal+Convenience.swift │ ├── Parser │ │ ├── SyntaxResponse.swift │ │ ├── SyntaxType.swift │ │ ├── String+Extensions.swift │ │ ├── SourceRange.swift │ │ ├── StructureValue.swift │ │ ├── Token.swift │ │ └── StructureProperty.swift │ ├── Collections │ │ ├── Literal+DictionaryValue.swift │ │ ├── CodeBlockableLiteral.swift │ │ ├── PatternCodeBlock.swift │ │ └── DictionaryValue.swift │ ├── Utilities │ │ ├── CodeBlockable.swift │ │ ├── CommentBuilderResult.swift │ │ ├── Fallthrough.swift │ │ └── Break.swift │ ├── Variables │ │ ├── VariableKind.swift │ │ └── AttributeArguments.swift │ ├── Core │ │ ├── TypeRepresentable.swift │ │ ├── String+TypeRepresentable.swift │ │ ├── Keyword+AccessModifier.swift │ │ ├── PatternConvertible.swift │ │ ├── Keyword+CaptureReferenceType.swift │ │ ├── CaptureReferenceType.swift │ │ ├── Line+Trivia.swift │ │ └── AccessModifier.swift │ ├── CodeBlocks │ │ ├── ExprCodeBlock.swift │ │ ├── CodeBlockBuilder.swift │ │ └── EmptyCodeBlock.swift │ ├── Patterns │ │ ├── String+PatternConvertible.swift │ │ └── Int+PatternConvertible.swift │ └── Attributes │ │ ├── AttributeInfo.swift │ │ └── Trivia+Comments.swift ├── DocumentationHarness │ ├── CompilationResult.swift │ ├── CodeBlockExtractorError.swift │ ├── CodeBlockType.swift │ ├── TestType.swift │ ├── CodeBlockExtractor.swift │ ├── CodeBlock.swift │ ├── ValidationParameters.swift │ └── CodeBlockValidationParameters.swift └── skit │ └── main.swift ├── project.yml ├── .cursor ├── mcp.json └── rules │ └── cursor_rules.mdc ├── .mcp.json ├── .vscode └── launch.json ├── .claude └── commands │ └── tm │ ├── setup │ └── quick-install-taskmaster.md │ ├── set-status │ ├── to-pending.md │ ├── to-in-progress.md │ ├── to-review.md │ ├── to-done.md │ ├── to-deferred.md │ └── to-cancelled.md │ ├── list │ ├── list-tasks-with-subtasks.md │ ├── list-tasks-by-status.md │ └── list-tasks.md │ ├── init │ ├── init-project-quick.md │ └── init-project.md │ ├── expand │ ├── expand-all-tasks.md │ └── expand-task.md │ ├── models │ ├── view-models.md │ └── setup-models.md │ ├── parse-prd │ ├── parse-prd.md │ └── parse-prd-with-research.md │ ├── add-dependency │ └── add-dependency.md │ ├── remove-dependency │ └── remove-dependency.md │ ├── workflows │ ├── smart-workflow.md │ └── command-pipeline.md │ ├── validate-dependencies │ └── validate-dependencies.md │ ├── add-subtask │ └── convert-task-to-subtask.md │ ├── status │ └── project-status.md │ └── next │ └── next-task.md ├── .taskmaster └── config.json ├── Package.resolved ├── LICENSE ├── .env.example └── .devcontainer ├── devcontainer.json ├── swift-6.0 └── devcontainer.json ├── swift-6.1 └── devcontainer.json ├── swift-6.1-nightly └── devcontainer.json └── swift-6.2-nightly └── devcontainer.json /.swift-version: -------------------------------------------------------------------------------- 1 | 6.1 2 | -------------------------------------------------------------------------------- /.periphery.yml: -------------------------------------------------------------------------------- 1 | retain_public: true 2 | -------------------------------------------------------------------------------- /Macros/Options/.swift-version: -------------------------------------------------------------------------------- 1 | 5.7 2 | -------------------------------------------------------------------------------- /Examples/Completed/attributes/syntax.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Macros/Options/.periphery.yml: -------------------------------------------------------------------------------- 1 | retain_public: true 2 | -------------------------------------------------------------------------------- /Macros/Options/codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "Tests" 3 | -------------------------------------------------------------------------------- /Macros/Options/.hound.yml: -------------------------------------------------------------------------------- 1 | swiftlint: 2 | config_file: .swiftlint.yml 3 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "Tests" 3 | - "Sources/SyntaxKit/parser" 4 | -------------------------------------------------------------------------------- /Macros/Options/Mintfile: -------------------------------------------------------------------------------- 1 | nicklockwood/SwiftFormat@0.53.5 2 | realm/SwiftLint@0.54.0 -------------------------------------------------------------------------------- /Macros/Options/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brightdigit/SyntaxKit/HEAD/Macros/Options/logo.png -------------------------------------------------------------------------------- /Mintfile: -------------------------------------------------------------------------------- 1 | swiftlang/swift-format@600.0.0 2 | realm/SwiftLint@0.58.2 3 | peripheryapp/periphery@3.0.1 4 | -------------------------------------------------------------------------------- /Macros/Options/.spi.yml: -------------------------------------------------------------------------------- 1 | version: 1 2 | builder: 3 | configs: 4 | - documentation_targets: [Options] 5 | -------------------------------------------------------------------------------- /.spi.yml: -------------------------------------------------------------------------------- 1 | version: 1 2 | builder: 3 | configs: 4 | - documentation_targets: [SyntaxKit] 5 | swift_version: 6.1 -------------------------------------------------------------------------------- /Tests/SyntaxKitTests/Integration/.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - file_length 3 | - closure_body_length 4 | - function_body_length 5 | - type_body_length -------------------------------------------------------------------------------- /Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brightdigit/SyntaxKit/HEAD/Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo.png -------------------------------------------------------------------------------- /Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo.pxd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brightdigit/SyntaxKit/HEAD/Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo.pxd -------------------------------------------------------------------------------- /Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brightdigit/SyntaxKit/HEAD/Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo@2x.png -------------------------------------------------------------------------------- /Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brightdigit/SyntaxKit/HEAD/Sources/SyntaxKit/Documentation.docc/Resources/SyntaxKit_Logo@3x.png -------------------------------------------------------------------------------- /Macros/SKSampleMacro/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | xcuserdata/ 5 | DerivedData/ 6 | .swiftpm/configuration/registries.json 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | .netrc 9 | -------------------------------------------------------------------------------- /Macros/SKSampleMacro/Sources/SKSampleMacroClient/main.swift: -------------------------------------------------------------------------------- 1 | import SKSampleMacro 2 | 3 | let a = 17 4 | let b = 25 5 | 6 | let (result, code) = #stringify(a, b) 7 | 8 | print("The value \(result) was produced by the code \"\(code)\"") 9 | -------------------------------------------------------------------------------- /Examples/Completed/attributes/code.swift: -------------------------------------------------------------------------------- 1 | @objc 2 | class Foo { 3 | @Published var bar: String = "bar" 4 | 5 | @available(iOS 17.0, *) 6 | func bar() { 7 | print("bar") 8 | } 9 | 10 | @MainActor 11 | func baz() { 12 | print("baz") 13 | } 14 | } -------------------------------------------------------------------------------- /Macros/Options/Scripts/docc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | xcodebuild docbuild -scheme SimulatorServices -derivedDataPath DerivedData -destination 'platform=macOS' 3 | $(xcrun --find docc) process-archive transform-for-static-hosting DerivedData/Build/Products/Debug/SimulatorServices.doccarchive --output-path Output -------------------------------------------------------------------------------- /Macros/Options/project.yml: -------------------------------------------------------------------------------- 1 | name: Options 2 | settings: 3 | LINT_MODE: ${LINT_MODE} 4 | packages: 5 | StealthyStash: 6 | path: . 7 | aggregateTargets: 8 | Lint: 9 | buildScripts: 10 | - path: Scripts/lint.sh 11 | name: Lint 12 | basedOnDependencyAnalysis: false 13 | schemes: {} -------------------------------------------------------------------------------- /Examples/Completed/attributes/dsl.swift: -------------------------------------------------------------------------------- 1 | Class("Foo") { 2 | Variable(.var, name: "bar", type: "String", defaultValue: "bar").attribute("Published") 3 | Function("bar") { 4 | print("bar") 5 | }.attribute("available", arguments: ["iOS 17.0", "*"]) 6 | Function("baz") { 7 | }.attribute("objc")}.attribute("objc") -------------------------------------------------------------------------------- /project.yml: -------------------------------------------------------------------------------- 1 | name: SyntaxKit 2 | settings: 3 | LINT_MODE: ${LINT_MODE} 4 | SKIP_DOCS: 1 5 | packages: 6 | SyntaxKit: 7 | path: . 8 | SKSampleMacro: 9 | path: Macros/SKSampleMacro 10 | Options: 11 | path: Macros/Options 12 | aggregateTargets: 13 | Lint: 14 | buildScripts: 15 | - path: Scripts/lint.sh 16 | name: Lint 17 | basedOnDependencyAnalysis: false 18 | schemes: {} 19 | -------------------------------------------------------------------------------- /Tests/SyntaxKitTests/Unit/Expressions/LiteralTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Testing 3 | 4 | @testable import SyntaxKit 5 | 6 | internal struct LiteralTests { 7 | @Test internal func testGroupWithLiterals() { 8 | let group = Group { 9 | Return { 10 | Literal.integer(1) 11 | } 12 | } 13 | let generated = group.generateCode() 14 | #expect(generated.trimmingCharacters(in: .whitespacesAndNewlines) == "return 1") 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Macros/Options/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = git@github.com:brightdigit/Options.git 8 | branch = syntaxkit-sample 9 | commit = a2fd9e31d5fdf1a0e9d61fe76ab5a4461d10b08a 10 | parent = 12b377f8e1df18994e1c9693f6c6399e7f9ddeb2 11 | method = merge 12 | cmdver = 0.4.9 13 | -------------------------------------------------------------------------------- /Macros/SKSampleMacro/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "originHash" : "9eace0238bc49301f22ac682c8f3e981d6f1a63573efd4e1a727b71527c4ebb0", 3 | "pins" : [ 4 | { 5 | "identity" : "swift-syntax", 6 | "kind" : "remoteSourceControl", 7 | "location" : "https://github.com/swiftlang/swift-syntax.git", 8 | "state" : { 9 | "revision" : "f99ae8aa18f0cf0d53481901f88a0991dc3bd4a2", 10 | "version" : "601.0.1" 11 | } 12 | } 13 | ], 14 | "version" : 3 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "originHash" : "c5bd65f4f345021e7806b39997c51d5a17954bc52771eed2c9bfa11650859c84", 3 | "pins" : [ 4 | { 5 | "identity" : "swift-syntax", 6 | "kind" : "remoteSourceControl", 7 | "location" : "https://github.com/swiftlang/swift-syntax.git", 8 | "state" : { 9 | "revision" : "f99ae8aa18f0cf0d53481901f88a0991dc3bd4a2", 10 | "version" : "601.0.1" 11 | } 12 | } 13 | ], 14 | "version" : 3 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Remaining/generics/code.swift: -------------------------------------------------------------------------------- 1 | struct Stack { 2 | private var items: [Element] = [] 3 | 4 | mutating func push(_ item: Element) { 5 | items.append(item) 6 | } 7 | 8 | mutating func pop() -> Element? { 9 | items.popLast() 10 | } 11 | 12 | func peek() -> Element? { 13 | items.last 14 | } 15 | 16 | var isEmpty: Bool { 17 | items.isEmpty 18 | } 19 | 20 | var count: Int { 21 | items.count 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Macros/SKSampleMacro/Sources/SKSampleMacro/SKSampleMacro.swift: -------------------------------------------------------------------------------- 1 | // The Swift Programming Language 2 | // https://docs.swift.org/swift-book 3 | 4 | /// A macro that produces both a value and a string containing the 5 | /// source code that generated the value. For example, 6 | /// 7 | /// #stringify(x + y) 8 | /// 9 | /// produces a tuple `(x + y, "x + y")`. 10 | @freestanding(expression) 11 | public macro stringify(_ lhs: T, _ rhs: T) -> (T, String) = #externalMacro(module: "SKSampleMacroMacros", type: "StringifyMacro") 12 | -------------------------------------------------------------------------------- /Tests/SyntaxDocTests/DocumentationTestError.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal enum DocumentationTestError: Error, CustomStringConvertible { 4 | case exampleValidationFailed(String) 5 | case sdkPathNotFound 6 | case fileNotFound(String) 7 | 8 | internal var description: String { 9 | switch self { 10 | case .exampleValidationFailed(let details): 11 | return "Documentation example validation failed: \(details)" 12 | case .sdkPathNotFound: 13 | return "Could not determine SDK path for compilation" 14 | case .fileNotFound(let path): 15 | return "Documentation file not found: \(path)" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.cursor/mcp.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "task-master-ai": { 4 | "command": "npx", 5 | "args": ["-y", "--package=task-master-ai", "task-master-ai"], 6 | "env": { 7 | "ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE", 8 | "PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE", 9 | "OPENAI_API_KEY": "YOUR_OPENAI_KEY_HERE", 10 | "GOOGLE_API_KEY": "YOUR_GOOGLE_KEY_HERE", 11 | "XAI_API_KEY": "YOUR_XAI_KEY_HERE", 12 | "OPENROUTER_API_KEY": "YOUR_OPENROUTER_KEY_HERE", 13 | "MISTRAL_API_KEY": "YOUR_MISTRAL_KEY_HERE", 14 | "AZURE_OPENAI_API_KEY": "YOUR_AZURE_KEY_HERE", 15 | "OLLAMA_API_KEY": "YOUR_OLLAMA_API_KEY_HERE" 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Examples/Completed/swiftui/code.swift: -------------------------------------------------------------------------------- 1 | public import SwiftUI 2 | 3 | 4 | public struct TodoItemRow: View { 5 | private let item: TodoItem 6 | private let onToggle: @MainActor @Sendable (Date) -> Void 7 | 8 | public var body: some View { 9 | HStack { 10 | Button(action: onToggle) { 11 | Image(systemName: item.isCompleted ? "checkmark.circle.fill" : "circle") 12 | .foregroundColor(item.isCompleted ? .green : .gray) 13 | } 14 | 15 | Button(action: { 16 | Task { @MainActor [weak self] in 17 | self?.onToggle(Date()) 18 | } 19 | }) { 20 | Image(systemName: "trash") 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.mcp.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "task-master-ai": { 4 | "type": "stdio", 5 | "command": "npx", 6 | "args": [ 7 | "-y", 8 | "--package=task-master-ai", 9 | "task-master-ai" 10 | ], 11 | "env": { 12 | "ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE", 13 | "PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE", 14 | "OPENAI_API_KEY": "YOUR_OPENAI_KEY_HERE", 15 | "GOOGLE_API_KEY": "YOUR_GOOGLE_KEY_HERE", 16 | "XAI_API_KEY": "YOUR_XAI_KEY_HERE", 17 | "OPENROUTER_API_KEY": "YOUR_OPENROUTER_KEY_HERE", 18 | "MISTRAL_API_KEY": "YOUR_MISTRAL_KEY_HERE", 19 | "AZURE_OPENAI_API_KEY": "YOUR_AZURE_KEY_HERE", 20 | "OLLAMA_API_KEY": "YOUR_OLLAMA_API_KEY_HERE" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "type": "swift", 5 | "request": "launch", 6 | "args": [], 7 | "cwd": "${workspaceFolder:SyntaxKit}", 8 | "name": "Debug skit", 9 | "program": "${workspaceFolder:SyntaxKit}/.build/debug/skit", 10 | "preLaunchTask": "swift: Build Debug skit" 11 | }, 12 | { 13 | "type": "swift", 14 | "request": "launch", 15 | "args": [], 16 | "cwd": "${workspaceFolder:SyntaxKit}", 17 | "name": "Release skit", 18 | "program": "${workspaceFolder:SyntaxKit}/.build/release/skit", 19 | "preLaunchTask": "swift: Build Release skit" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /.claude/commands/tm/setup/quick-install-taskmaster.md: -------------------------------------------------------------------------------- 1 | Quick install Task Master globally if not already installed. 2 | 3 | Execute this streamlined installation: 4 | 5 | ```bash 6 | # Check and install in one command 7 | task-master --version 2>/dev/null || npm install -g task-master-ai 8 | 9 | # Verify installation 10 | task-master --version 11 | 12 | # Quick setup check 13 | task-master models --status || echo "Note: You'll need to set up an AI provider API key" 14 | ``` 15 | 16 | If you see "command not found" after installation, you may need to: 17 | 1. Restart your terminal 18 | 2. Or add npm global bin to PATH: `export PATH=$(npm bin -g):$PATH` 19 | 20 | Once installed, you can use all the Task Master commands! 21 | 22 | Quick test: Run `/project:help` to see all available commands. -------------------------------------------------------------------------------- /Macros/Options/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 6.0 2 | 3 | // swiftlint:disable explicit_top_level_acl 4 | // swiftlint:disable prefixed_toplevel_constant 5 | // swiftlint:disable explicit_acl 6 | 7 | import PackageDescription 8 | 9 | let package = Package( 10 | name: "Options", 11 | products: [ 12 | .library( 13 | name: "Options", 14 | targets: ["Options"] 15 | ) 16 | ], 17 | dependencies: [ 18 | // Dependencies declare other packages that this package depends on. 19 | ], 20 | targets: [ 21 | .target( 22 | name: "Options", 23 | dependencies: [] 24 | ), 25 | .testTarget( 26 | name: "OptionsTests", 27 | dependencies: ["Options"] 28 | ) 29 | ] 30 | ) 31 | 32 | // swiftlint:enable explicit_top_level_acl 33 | // swiftlint:enable prefixed_toplevel_constant 34 | // swiftlint:enable explicit_acl 35 | -------------------------------------------------------------------------------- /.claude/commands/tm/set-status/to-pending.md: -------------------------------------------------------------------------------- 1 | Set a task's status to pending. 2 | 3 | Arguments: $ARGUMENTS (task ID) 4 | 5 | ## Setting Task to Pending 6 | 7 | This moves a task back to the pending state, useful for: 8 | - Resetting erroneously started tasks 9 | - Deferring work that was prematurely begun 10 | - Reorganizing sprint priorities 11 | 12 | ## Execution 13 | 14 | ```bash 15 | task-master set-status --id=$ARGUMENTS --status=pending 16 | ``` 17 | 18 | ## Validation 19 | 20 | Before setting to pending: 21 | - Warn if task is currently in-progress 22 | - Check if this will block other tasks 23 | - Suggest documenting why it's being reset 24 | - Preserve any work already done 25 | 26 | ## Smart Actions 27 | 28 | After setting to pending: 29 | - Update sprint planning if needed 30 | - Notify about freed resources 31 | - Suggest priority reassessment 32 | - Log the status change with context -------------------------------------------------------------------------------- /Examples/Completed/errors_async/code.swift: -------------------------------------------------------------------------------- 1 | 2 | var vendingMachine = VendingMachine() 3 | vendingMachine.coinsDeposited = 8 4 | do { 5 | try buyFavoriteSnack(person: "Alice", vendingMachine: vendingMachine) 6 | print("Success! Yum.") 7 | } catch VendingMachineError.invalidSelection { 8 | print("Invalid Selection.") 9 | } catch VendingMachineError.outOfStock { 10 | print("Out of Stock.") 11 | } catch VendingMachineError.insufficientFunds(let coinsNeeded) { 12 | print("Insufficient funds. Please insert an additional \(coinsNeeded) coins.") 13 | } catch { 14 | print("Unexpected error: \(error).") 15 | } 16 | 17 | func summarize(_ ratings: [Int]) throws(StatisticsError) { 18 | guard !ratings.isEmpty else { throw .noRatings } 19 | } 20 | 21 | async let data = fetchUserData(id: 1) 22 | async let posts = fetchUserPosts(id: 1) 23 | let (fetchedData, fetchedPosts) = try await (data, posts) -------------------------------------------------------------------------------- /.claude/commands/tm/list/list-tasks-with-subtasks.md: -------------------------------------------------------------------------------- 1 | List all tasks including their subtasks in a hierarchical view. 2 | 3 | This command shows all tasks with their nested subtasks, providing a complete project overview. 4 | 5 | ## Execution 6 | 7 | Run the Task Master list command with subtasks flag: 8 | ```bash 9 | task-master list --with-subtasks 10 | ``` 11 | 12 | ## Enhanced Display 13 | 14 | I'll organize the output to show: 15 | - Parent tasks with clear indicators 16 | - Nested subtasks with proper indentation 17 | - Status badges for quick scanning 18 | - Dependencies and blockers highlighted 19 | - Progress indicators for tasks with subtasks 20 | 21 | ## Smart Filtering 22 | 23 | Based on the task hierarchy: 24 | - Show completion percentage for parent tasks 25 | - Highlight blocked subtask chains 26 | - Group by functional areas 27 | - Indicate critical path items 28 | 29 | This gives you a complete tree view of your project structure. -------------------------------------------------------------------------------- /Examples/Completed/for_loops/code.swift: -------------------------------------------------------------------------------- 1 | // MARK: - Basic For-in Loop 2 | // Simple for-in loop over an array 3 | let names = ["Alice", "Bob", "Charlie"] 4 | for name in names { 5 | print("Hello, \(name)!") 6 | } 7 | 8 | // MARK: - For-in with Enumerated 9 | // For-in loop with enumerated() to get index and value 10 | print("\n=== For-in with Enumerated ===") 11 | for (index, name) in names.enumerated() { 12 | print("Index: \(index), Name: \(name)") 13 | } 14 | 15 | // MARK: - For-in with Where Clause 16 | // For-in loop with where clause 17 | print("\n=== For-in with Where Clause ===") 18 | let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 19 | for number in numbers where number % 2 == 0 { 20 | print("Even number: \(number)") 21 | } 22 | 23 | // MARK: - For-in with Dictionary 24 | // For-in loop over dictionary 25 | print("\n=== For-in with Dictionary ===") 26 | let scores = ["Alice": 95, "Bob": 87, "Charlie": 92] 27 | for (name, score) in scores { 28 | print("\(name): \(score)") 29 | } 30 | -------------------------------------------------------------------------------- /Examples/Remaining/generics/dsl.swift: -------------------------------------------------------------------------------- 1 | import SyntaxKit 2 | 3 | // Example of generating a BlackjackCard struct with a nested Suit enum 4 | let structExample = Struct("Stack", generic: "Element") { 5 | Variable(.var, name: "items", type: "[Element]", equals: "[]") 6 | 7 | Function("push") parameters:{ 8 | Parameter(name: "item", type: "Element") 9 | } { 10 | VariableExp("output").call("append") { 11 | Parameter(name: "item", value: "item") 12 | } 13 | } 14 | 15 | Function("pop", returns: "Element?") { 16 | VariableExp("items").call("popLast") 17 | } 18 | 19 | Function("peek", returns: "Element?") { 20 | VariableExp("items").property("last") 21 | } 22 | 23 | ComputedProperty("isEmpty") { 24 | VariableExp("items").property("isEmpty") 25 | } 26 | 27 | ComputedProperty("count") { 28 | VariableExp("items").property("count") 29 | } 30 | } 31 | 32 | // Generate and print the code 33 | print(structExample.generateCode()) -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/api-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "endpoints": { 3 | "users": "/api/v2/users", 4 | "posts": "/api/v2/posts", 5 | "comments": "/api/v2/comments", 6 | "userProfile": "/api/v2/users/{id}", 7 | "analytics": "/api/v2/analytics", 8 | "search": "/api/v2/search", 9 | "notifications": "/api/v2/notifications" 10 | }, 11 | "statusCodes": { 12 | "success": 200, 13 | "created": 201, 14 | "badRequest": 400, 15 | "unauthorized": 401, 16 | "forbidden": 403, 17 | "notFound": 404, 18 | "internalError": 500, 19 | "serviceUnavailable": 503 20 | }, 21 | "errorTypes": [ 22 | { 23 | "name": "invalidURL", 24 | "associatedData": ["url: String"] 25 | }, 26 | { 27 | "name": "httpError", 28 | "associatedData": ["statusCode: Int", "message: String"] 29 | }, 30 | { 31 | "name": "networkUnavailable" 32 | }, 33 | { 34 | "name": "decodingError", 35 | "associatedData": ["DecodingError"] 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.1 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "EnumGeneratorExample", 6 | platforms: [ 7 | .macOS(.v13), 8 | .iOS(.v13), 9 | .watchOS(.v6), 10 | .tvOS(.v13) 11 | ], 12 | products: [ 13 | .executable(name: "enum-generator-demo", targets: ["EnumGeneratorDemo"]), 14 | .executable(name: "integration-demo", targets: ["IntegrationDemo"]) 15 | ], 16 | dependencies: [ 17 | .package(path: "../../../") // SyntaxKit 18 | ], 19 | targets: [ 20 | .executableTarget( 21 | name: "EnumGeneratorDemo", 22 | dependencies: ["SyntaxKit"], 23 | path: ".", 24 | sources: ["after/enum_generator.swift"] 25 | ), 26 | .executableTarget( 27 | name: "IntegrationDemo", 28 | dependencies: [], 29 | path: ".", 30 | sources: ["integration_demo.swift"] 31 | ) 32 | ] 33 | ) -------------------------------------------------------------------------------- /.taskmaster/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "models": { 3 | "main": { 4 | "provider": "claude-code", 5 | "modelId": "sonnet", 6 | "maxTokens": 64000, 7 | "temperature": 0.2 8 | }, 9 | "research": { 10 | "provider": "claude-code", 11 | "modelId": "opus", 12 | "maxTokens": 32000, 13 | "temperature": 0.1 14 | }, 15 | "fallback": { 16 | "provider": "claude-code", 17 | "modelId": "sonnet", 18 | "maxTokens": 64000, 19 | "temperature": 0.2 20 | } 21 | }, 22 | "global": { 23 | "logLevel": "info", 24 | "debug": false, 25 | "defaultNumTasks": 10, 26 | "defaultSubtasks": 5, 27 | "defaultPriority": "medium", 28 | "projectName": "Taskmaster", 29 | "ollamaBaseURL": "http://localhost:11434/api", 30 | "bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com", 31 | "responseLanguage": "English", 32 | "defaultTag": "master", 33 | "azureOpenaiBaseURL": "https://your-endpoint.openai.azure.com/", 34 | "userId": "1234567890" 35 | }, 36 | "claudeCode": {} 37 | } -------------------------------------------------------------------------------- /Macros/Options/Scripts/lint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "$SRCROOT" ]; then 4 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 5 | PACKAGE_DIR="${SCRIPT_DIR}/.." 6 | else 7 | PACKAGE_DIR="${SRCROOT}" 8 | fi 9 | 10 | if [ -z "$GITHUB_ACTION" ]; then 11 | MINT_CMD="/opt/homebrew/bin/mint" 12 | else 13 | MINT_CMD="mint" 14 | fi 15 | 16 | export MINT_PATH="$PACKAGE_DIR/.mint" 17 | MINT_ARGS="-n -m $PACKAGE_DIR/Mintfile --silent" 18 | MINT_RUN="$MINT_CMD run $MINT_ARGS" 19 | 20 | pushd $PACKAGE_DIR 21 | 22 | $MINT_CMD bootstrap -m Mintfile 23 | 24 | if [ "$LINT_MODE" == "NONE" ]; then 25 | exit 26 | elif [ "$LINT_MODE" == "STRICT" ]; then 27 | SWIFTFORMAT_OPTIONS="" 28 | SWIFTLINT_OPTIONS="--strict" 29 | else 30 | SWIFTFORMAT_OPTIONS="" 31 | SWIFTLINT_OPTIONS="" 32 | fi 33 | 34 | pushd $PACKAGE_DIR 35 | 36 | if [ -z "$CI" ]; then 37 | $MINT_RUN swiftformat . 38 | $MINT_RUN swiftlint --fix 39 | fi 40 | 41 | $MINT_RUN swiftformat --lint $SWIFTFORMAT_OPTIONS . 42 | $MINT_RUN swiftlint lint $SWIFTLINT_OPTIONS 43 | 44 | popd 45 | -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/generate.swift: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env swift 2 | 3 | // Create a simple script that can run the enum generator 4 | import Foundation 5 | 6 | // Execute the dsl script and capture output 7 | let process = Process() 8 | process.executableURL = URL(fileURLWithPath: "/usr/bin/swift") 9 | process.arguments = [ 10 | "run", "--package-path", "../../../", "swift", 11 | "Examples/Completed/enum_generator/dsl.swift" 12 | ] 13 | process.currentDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) 14 | 15 | let pipe = Pipe() 16 | process.standardOutput = pipe 17 | 18 | do { 19 | try process.run() 20 | process.waitUntilExit() 21 | 22 | let data = pipe.fileHandleForReading.readDataToEndOfFile() 23 | if let output = String(data: data, encoding: .utf8) { 24 | // Write the generated code to code.swift 25 | try output.write(toFile: "code.swift", atomically: true, encoding: .utf8) 26 | print("Generated code written to code.swift") 27 | } 28 | } catch { 29 | print("Error: \(error)") 30 | } -------------------------------------------------------------------------------- /.claude/commands/tm/set-status/to-in-progress.md: -------------------------------------------------------------------------------- 1 | Start working on a task by setting its status to in-progress. 2 | 3 | Arguments: $ARGUMENTS (task ID) 4 | 5 | ## Starting Work on Task 6 | 7 | This command does more than just change status - it prepares your environment for productive work. 8 | 9 | ## Pre-Start Checks 10 | 11 | 1. Verify dependencies are met 12 | 2. Check if another task is already in-progress 13 | 3. Ensure task details are complete 14 | 4. Validate test strategy exists 15 | 16 | ## Execution 17 | 18 | ```bash 19 | task-master set-status --id=$ARGUMENTS --status=in-progress 20 | ``` 21 | 22 | ## Environment Setup 23 | 24 | After setting to in-progress: 25 | 1. Create/checkout appropriate git branch 26 | 2. Open relevant documentation 27 | 3. Set up test watchers if applicable 28 | 4. Display task details and acceptance criteria 29 | 5. Show similar completed tasks for reference 30 | 31 | ## Smart Suggestions 32 | 33 | - Estimated completion time based on complexity 34 | - Related files from similar tasks 35 | - Potential blockers to watch for 36 | - Recommended first steps -------------------------------------------------------------------------------- /Tests/SyntaxKitTests/Integration/BlackjackCardTests.swift: -------------------------------------------------------------------------------- 1 | import SyntaxKit 2 | import Testing 3 | 4 | @Suite 5 | internal struct BlackjackCardTests { 6 | @Test internal func testBlackjackCardExample() throws { 7 | let blackjackCard = Struct("BlackjackCard") { 8 | Enum("Suit") { 9 | EnumCase("spades").equals("♠") 10 | EnumCase("hearts").equals("♡") 11 | EnumCase("diamonds").equals("♢") 12 | EnumCase("clubs").equals("♣") 13 | }.inherits("Character") 14 | } 15 | 16 | let expected = """ 17 | struct BlackjackCard { 18 | enum Suit: Character { 19 | case spades = "♠" 20 | case hearts = "♡" 21 | case diamonds = "♢" 22 | case clubs = "♣" 23 | } 24 | } 25 | """ 26 | 27 | // Normalize whitespace, remove comments and modifiers, and normalize colon spacing 28 | let normalizedGenerated = blackjackCard.syntax.description.normalize() 29 | 30 | let normalizedExpected = expected.normalize() 31 | 32 | #expect(normalizedGenerated == normalizedExpected) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.claude/commands/tm/init/init-project-quick.md: -------------------------------------------------------------------------------- 1 | Quick initialization with auto-confirmation. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | Initialize a Task Master project without prompts, accepting all defaults. 6 | 7 | ## Quick Setup 8 | 9 | ```bash 10 | task-master init -y 11 | ``` 12 | 13 | ## What It Does 14 | 15 | 1. Creates `.taskmaster/` directory structure 16 | 2. Initializes empty `tasks.json` 17 | 3. Sets up default configuration 18 | 4. Uses directory name as project name 19 | 5. Skips all confirmation prompts 20 | 21 | ## Smart Defaults 22 | 23 | - Project name: Current directory name 24 | - Description: "Task Master Project" 25 | - Model config: Existing environment vars 26 | - Task structure: Standard format 27 | 28 | ## Next Steps 29 | 30 | After quick init: 31 | 1. Configure AI models if needed: 32 | ``` 33 | /project:tm/models/setup 34 | ``` 35 | 36 | 2. Parse PRD if available: 37 | ``` 38 | /project:tm/parse-prd 39 | ``` 40 | 41 | 3. Or create first task: 42 | ``` 43 | /project:tm/add-task create initial setup 44 | ``` 45 | 46 | Perfect for rapid project setup! -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "originHash" : "3a9631966aed0489b1d0415c39c345f4083602bf6a2ddfdc7954cd286093542f", 3 | "pins" : [ 4 | { 5 | "identity" : "swift-docc-plugin", 6 | "kind" : "remoteSourceControl", 7 | "location" : "https://github.com/swiftlang/swift-docc-plugin", 8 | "state" : { 9 | "revision" : "3e4f133a77e644a5812911a0513aeb7288b07d06", 10 | "version" : "1.4.5" 11 | } 12 | }, 13 | { 14 | "identity" : "swift-docc-symbolkit", 15 | "kind" : "remoteSourceControl", 16 | "location" : "https://github.com/swiftlang/swift-docc-symbolkit", 17 | "state" : { 18 | "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", 19 | "version" : "1.0.0" 20 | } 21 | }, 22 | { 23 | "identity" : "swift-syntax", 24 | "kind" : "remoteSourceControl", 25 | "location" : "https://github.com/swiftlang/swift-syntax.git", 26 | "state" : { 27 | "revision" : "f99ae8aa18f0cf0d53481901f88a0991dc3bd4a2", 28 | "version" : "601.0.1" 29 | } 30 | } 31 | ], 32 | "version" : 3 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 leogdion 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.claude/commands/tm/set-status/to-review.md: -------------------------------------------------------------------------------- 1 | Set a task's status to review. 2 | 3 | Arguments: $ARGUMENTS (task ID) 4 | 5 | ## Marking Task for Review 6 | 7 | This status indicates work is complete but needs verification before final approval. 8 | 9 | ## When to Use Review Status 10 | 11 | - Code complete but needs peer review 12 | - Implementation done but needs testing 13 | - Documentation written but needs proofreading 14 | - Design complete but needs stakeholder approval 15 | 16 | ## Execution 17 | 18 | ```bash 19 | task-master set-status --id=$ARGUMENTS --status=review 20 | ``` 21 | 22 | ## Review Preparation 23 | 24 | When setting to review: 25 | 1. **Generate Review Checklist** 26 | - Link to PR/MR if applicable 27 | - Highlight key changes 28 | - Note areas needing attention 29 | - Include test results 30 | 31 | 2. **Documentation** 32 | - Update task with review notes 33 | - Link relevant artifacts 34 | - Specify reviewers if known 35 | 36 | 3. **Smart Actions** 37 | - Create review reminders 38 | - Track review duration 39 | - Suggest reviewers based on expertise 40 | - Prepare rollback plan if needed -------------------------------------------------------------------------------- /Tests/SyntaxKitTests/Unit/Utilities/NormalizeOptions.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Options for string normalization 4 | public struct NormalizeOptions: OptionSet, Sendable { 5 | /// Preserve newlines between sibling elements (useful for SwiftUI) 6 | public static let preserveSiblingNewlines = NormalizeOptions(rawValue: 1 << 0) 7 | 8 | /// Preserve newlines after braces 9 | public static let preserveBraceNewlines = NormalizeOptions(rawValue: 1 << 1) 10 | 11 | /// Preserve indentation structure 12 | public static let preserveIndentation = NormalizeOptions(rawValue: 1 << 2) 13 | 14 | /// Default options for general code comparison 15 | public static let `default`: NormalizeOptions = [] 16 | 17 | /// Options for SwiftUI code that needs to preserve some formatting 18 | public static let swiftUI: NormalizeOptions = [.preserveSiblingNewlines, .preserveBraceNewlines] 19 | 20 | /// Options for structural comparison (ignores all formatting) 21 | public static let structural: NormalizeOptions = [] 22 | 23 | public let rawValue: Int 24 | 25 | public init(rawValue: Int) { 26 | self.rawValue = rawValue 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.claude/commands/tm/set-status/to-done.md: -------------------------------------------------------------------------------- 1 | Mark a task as completed. 2 | 3 | Arguments: $ARGUMENTS (task ID) 4 | 5 | ## Completing a Task 6 | 7 | This command validates task completion and updates project state intelligently. 8 | 9 | ## Pre-Completion Checks 10 | 11 | 1. Verify test strategy was followed 12 | 2. Check if all subtasks are complete 13 | 3. Validate acceptance criteria met 14 | 4. Ensure code is committed 15 | 16 | ## Execution 17 | 18 | ```bash 19 | task-master set-status --id=$ARGUMENTS --status=done 20 | ``` 21 | 22 | ## Post-Completion Actions 23 | 24 | 1. **Update Dependencies** 25 | - Identify newly unblocked tasks 26 | - Update sprint progress 27 | - Recalculate project timeline 28 | 29 | 2. **Documentation** 30 | - Generate completion summary 31 | - Update CLAUDE.md with learnings 32 | - Log implementation approach 33 | 34 | 3. **Next Steps** 35 | - Show newly available tasks 36 | - Suggest logical next task 37 | - Update velocity metrics 38 | 39 | ## Celebration & Learning 40 | 41 | - Show impact of completion 42 | - Display unblocked work 43 | - Recognize achievement 44 | - Capture lessons learned -------------------------------------------------------------------------------- /Examples/Completed/concurrency/code.swift: -------------------------------------------------------------------------------- 1 | enum VendingMachineError: Error { 2 | case invalidSelection 3 | case insufficientFunds(coinsNeeded: Int) 4 | case outOfStock 5 | } 6 | 7 | class VendingMachine { 8 | var inventory = [ 9 | "Candy Bar": Item(price: 12, count: 7), 10 | "Chips": Item(price: 10, count: 4), 11 | "Pretzels": Item(price: 7, count: 11) 12 | ] 13 | var coinsDeposited = 0 14 | 15 | 16 | func vend(itemNamed name: String) throws { 17 | guard let item = inventory[name] else { 18 | throw VendingMachineError.invalidSelection 19 | } 20 | 21 | 22 | guard item.count > 0 else { 23 | throw VendingMachineError.outOfStock 24 | } 25 | 26 | 27 | guard item.price <= coinsDeposited else { 28 | throw VendingMachineError.insufficientFunds(coinsNeeded: item.price - coinsDeposited) 29 | } 30 | 31 | 32 | coinsDeposited -= item.price 33 | 34 | 35 | var newItem = item 36 | newItem.count -= 1 37 | inventory[name] = newItem 38 | 39 | 40 | print("Dispensing \(name)") 41 | } 42 | } -------------------------------------------------------------------------------- /.claude/commands/tm/list/list-tasks-by-status.md: -------------------------------------------------------------------------------- 1 | List tasks filtered by a specific status. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | Parse the status from arguments and list only tasks matching that status. 6 | 7 | ## Status Options 8 | - `pending` - Not yet started 9 | - `in-progress` - Currently being worked on 10 | - `done` - Completed 11 | - `review` - Awaiting review 12 | - `deferred` - Postponed 13 | - `cancelled` - Cancelled 14 | 15 | ## Execution 16 | 17 | Based on $ARGUMENTS, run: 18 | ```bash 19 | task-master list --status=$ARGUMENTS 20 | ``` 21 | 22 | ## Enhanced Display 23 | 24 | For the filtered results: 25 | - Group by priority within the status 26 | - Show time in current status 27 | - Highlight tasks approaching deadlines 28 | - Display blockers and dependencies 29 | - Suggest next actions for each status group 30 | 31 | ## Intelligent Insights 32 | 33 | Based on the status filter: 34 | - **Pending**: Show recommended start order 35 | - **In-Progress**: Display idle time warnings 36 | - **Done**: Show newly unblocked tasks 37 | - **Review**: Indicate review duration 38 | - **Deferred**: Show reactivation criteria 39 | - **Cancelled**: Display impact analysis -------------------------------------------------------------------------------- /Macros/Options/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Bright Digit, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # API Keys (Required to enable respective provider) 2 | ANTHROPIC_API_KEY="your_anthropic_api_key_here" # Required: Format: sk-ant-api03-... 3 | PERPLEXITY_API_KEY="your_perplexity_api_key_here" # Optional: Format: pplx-... 4 | OPENAI_API_KEY="your_openai_api_key_here" # Optional, for OpenAI models. Format: sk-proj-... 5 | GOOGLE_API_KEY="your_google_api_key_here" # Optional, for Google Gemini models. 6 | MISTRAL_API_KEY="your_mistral_key_here" # Optional, for Mistral AI models. 7 | XAI_API_KEY="YOUR_XAI_KEY_HERE" # Optional, for xAI AI models. 8 | GROQ_API_KEY="YOUR_GROQ_KEY_HERE" # Optional, for Groq models. 9 | OPENROUTER_API_KEY="YOUR_OPENROUTER_KEY_HERE" # Optional, for OpenRouter models. 10 | AZURE_OPENAI_API_KEY="your_azure_key_here" # Optional, for Azure OpenAI models (requires endpoint in .taskmaster/config.json). 11 | OLLAMA_API_KEY="your_ollama_api_key_here" # Optional: For remote Ollama servers that require authentication. 12 | GITHUB_API_KEY="your_github_api_key_here" # Optional: For GitHub import/export features. Format: ghp_... or github_pat_... -------------------------------------------------------------------------------- /.claude/commands/tm/set-status/to-deferred.md: -------------------------------------------------------------------------------- 1 | Defer a task for later consideration. 2 | 3 | Arguments: $ARGUMENTS (task ID) 4 | 5 | ## Deferring a Task 6 | 7 | This status indicates a task is valid but not currently actionable or prioritized. 8 | 9 | ## Valid Reasons for Deferral 10 | 11 | - Waiting for external dependencies 12 | - Reprioritized for future sprint 13 | - Blocked by technical limitations 14 | - Resource constraints 15 | - Strategic timing considerations 16 | 17 | ## Execution 18 | 19 | ```bash 20 | task-master set-status --id=$ARGUMENTS --status=deferred 21 | ``` 22 | 23 | ## Deferral Management 24 | 25 | When deferring: 26 | 1. **Document Reason** 27 | - Capture why it's being deferred 28 | - Set reactivation criteria 29 | - Note any partial work completed 30 | 31 | 2. **Impact Analysis** 32 | - Check dependent tasks 33 | - Update project timeline 34 | - Notify affected stakeholders 35 | 36 | 3. **Future Planning** 37 | - Set review reminders 38 | - Tag for specific milestone 39 | - Preserve context for reactivation 40 | - Link to blocking issues 41 | 42 | ## Smart Tracking 43 | 44 | - Monitor deferral duration 45 | - Alert when criteria met 46 | - Prevent scope creep 47 | - Regular review cycles -------------------------------------------------------------------------------- /.claude/commands/tm/expand/expand-all-tasks.md: -------------------------------------------------------------------------------- 1 | Expand all pending tasks that need subtasks. 2 | 3 | ## Bulk Task Expansion 4 | 5 | Intelligently expands all tasks that would benefit from breakdown. 6 | 7 | ## Execution 8 | 9 | ```bash 10 | task-master expand --all 11 | ``` 12 | 13 | ## Smart Selection 14 | 15 | Only expands tasks that: 16 | - Are marked as pending 17 | - Have high complexity (>5) 18 | - Lack existing subtasks 19 | - Would benefit from breakdown 20 | 21 | ## Expansion Process 22 | 23 | 1. **Analysis Phase** 24 | - Identify expansion candidates 25 | - Group related tasks 26 | - Plan expansion strategy 27 | 28 | 2. **Batch Processing** 29 | - Expand tasks in logical order 30 | - Maintain consistency 31 | - Preserve relationships 32 | - Optimize for parallelism 33 | 34 | 3. **Quality Control** 35 | - Ensure subtask quality 36 | - Avoid over-decomposition 37 | - Maintain task coherence 38 | - Update dependencies 39 | 40 | ## Options 41 | 42 | - Add `force` to expand all regardless of complexity 43 | - Add `research` for enhanced AI analysis 44 | 45 | ## Results 46 | 47 | After bulk expansion: 48 | - Summary of tasks expanded 49 | - New subtask count 50 | - Updated complexity metrics 51 | - Suggested task order -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/before/HTTPStatus.swift: -------------------------------------------------------------------------------- 1 | // HTTPStatus.swift - Manual maintenance approach 2 | // ❌ Manually maintained, incomplete coverage 3 | 4 | import Foundation 5 | 6 | /// HTTP status codes 7 | /// ⚠️ WARNING: Only covers basic status codes, missing many standard ones 8 | public enum HTTPStatus: Int, CaseIterable { 9 | case success = 200 10 | case created = 201 11 | case badRequest = 400 12 | case unauthorized = 401 13 | case notFound = 404 14 | case internalError = 500 15 | // ❌ Missing: forbidden (403), serviceUnavailable (503) 16 | // ❌ Developer only added status codes as needed, incomplete set 17 | } 18 | 19 | // MARK: - Additional Problems: 20 | /* 21 | Issues with manual HTTP status enum: 22 | 23 | 1. INCOMPLETE COVERAGE: Missing forbidden (403), serviceUnavailable (503) 24 | 2. INCONSISTENT NAMING: Some call it "success", others call it "ok" 25 | 3. NO STANDARDIZATION: Different developers add codes differently 26 | 4. MISSING DOCUMENTATION: No explanation of when to use each code 27 | 5. STATIC LIST: Can't easily adapt to API-specific status codes 28 | 29 | When the backend starts returning 503 Service Unavailable errors, 30 | the iOS app has no enum case to handle it properly. 31 | */ -------------------------------------------------------------------------------- /.claude/commands/tm/models/view-models.md: -------------------------------------------------------------------------------- 1 | View current AI model configuration. 2 | 3 | ## Model Configuration Display 4 | 5 | Shows the currently configured AI providers and models for Task Master. 6 | 7 | ## Execution 8 | 9 | ```bash 10 | task-master models 11 | ``` 12 | 13 | ## Information Displayed 14 | 15 | 1. **Main Provider** 16 | - Model ID and name 17 | - API key status (configured/missing) 18 | - Usage: Primary task generation 19 | 20 | 2. **Research Provider** 21 | - Model ID and name 22 | - API key status 23 | - Usage: Enhanced research mode 24 | 25 | 3. **Fallback Provider** 26 | - Model ID and name 27 | - API key status 28 | - Usage: Backup when main fails 29 | 30 | ## Visual Status 31 | 32 | ``` 33 | Task Master AI Model Configuration 34 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 35 | Main: ✅ claude-3-5-sonnet (configured) 36 | Research: ✅ perplexity-sonar (configured) 37 | Fallback: ⚠️ Not configured (optional) 38 | 39 | Available Models: 40 | - claude-3-5-sonnet 41 | - gpt-4-turbo 42 | - gpt-3.5-turbo 43 | - perplexity-sonar 44 | ``` 45 | 46 | ## Next Actions 47 | 48 | Based on configuration: 49 | - If missing API keys → Suggest setup 50 | - If no research model → Explain benefits 51 | - If all configured → Show usage tips -------------------------------------------------------------------------------- /.claude/commands/tm/init/init-project.md: -------------------------------------------------------------------------------- 1 | Initialize a new Task Master project. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | Parse arguments to determine initialization preferences. 6 | 7 | ## Initialization Process 8 | 9 | 1. **Parse Arguments** 10 | - PRD file path (if provided) 11 | - Project name 12 | - Auto-confirm flag (-y) 13 | 14 | 2. **Project Setup** 15 | ```bash 16 | task-master init 17 | ``` 18 | 19 | 3. **Smart Initialization** 20 | - Detect existing project files 21 | - Suggest project name from directory 22 | - Check for git repository 23 | - Verify AI provider configuration 24 | 25 | ## Configuration Options 26 | 27 | Based on arguments: 28 | - `quick` / `-y` → Skip confirmations 29 | - `` → Use as PRD after init 30 | - `--name=` → Set project name 31 | - `--description=` → Set description 32 | 33 | ## Post-Initialization 34 | 35 | After successful init: 36 | 1. Show project structure created 37 | 2. Verify AI models configured 38 | 3. Suggest next steps: 39 | - Parse PRD if available 40 | - Configure AI providers 41 | - Set up git hooks 42 | - Create first tasks 43 | 44 | ## Integration 45 | 46 | If PRD file provided: 47 | ``` 48 | /project:tm/init my-prd.md 49 | → Automatically runs parse-prd after init 50 | ``` -------------------------------------------------------------------------------- /.claude/commands/tm/expand/expand-task.md: -------------------------------------------------------------------------------- 1 | Break down a complex task into subtasks. 2 | 3 | Arguments: $ARGUMENTS (task ID) 4 | 5 | ## Intelligent Task Expansion 6 | 7 | Analyzes a task and creates detailed subtasks for better manageability. 8 | 9 | ## Execution 10 | 11 | ```bash 12 | task-master expand --id=$ARGUMENTS 13 | ``` 14 | 15 | ## Expansion Process 16 | 17 | 1. **Task Analysis** 18 | - Review task complexity 19 | - Identify components 20 | - Detect technical challenges 21 | - Estimate time requirements 22 | 23 | 2. **Subtask Generation** 24 | - Create 3-7 subtasks typically 25 | - Each subtask 1-4 hours 26 | - Logical implementation order 27 | - Clear acceptance criteria 28 | 29 | 3. **Smart Breakdown** 30 | - Setup/configuration tasks 31 | - Core implementation 32 | - Testing components 33 | - Integration steps 34 | - Documentation updates 35 | 36 | ## Enhanced Features 37 | 38 | Based on task type: 39 | - **Feature**: Setup → Implement → Test → Integrate 40 | - **Bug Fix**: Reproduce → Diagnose → Fix → Verify 41 | - **Refactor**: Analyze → Plan → Refactor → Validate 42 | 43 | ## Post-Expansion 44 | 45 | After expansion: 46 | 1. Show subtask hierarchy 47 | 2. Update time estimates 48 | 3. Suggest implementation order 49 | 4. Highlight critical path -------------------------------------------------------------------------------- /Tests/SyntaxDocTests/Settings.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Settings.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion on 9/5/25. 6 | // 7 | 8 | import Foundation 9 | 10 | internal enum Settings { 11 | /// Project root directory calculated from the current file location 12 | internal static let projectRoot: URL = { 13 | let currentFileURL = URL(fileURLWithPath: #filePath) 14 | return 15 | currentFileURL 16 | .deletingLastPathComponent() // Tests/SyntaxDocTests 17 | .deletingLastPathComponent() // Tests 18 | .deletingLastPathComponent() // Project root 19 | }() 20 | 21 | /// Document paths to search for documentation files 22 | internal static let docPaths = [ 23 | "Sources/SyntaxKit/Documentation.docc", 24 | "README.md", 25 | "Examples", 26 | ] 27 | 28 | /// Resolves a relative file path to absolute path 29 | internal static func resolveFilePath(_ filePath: String) throws -> URL { 30 | if filePath.hasPrefix("/") { 31 | if #available(iOS 16.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, *) { 32 | return .init(filePath: filePath) 33 | } else { 34 | return .init(fileURLWithPath: filePath) 35 | } 36 | } else { 37 | return Self.projectRoot.appendingPathComponent(filePath) 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Tests/SyntaxKitTests/Unit/ErrorHandling/ThrowEdgeCaseTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Testing 3 | 4 | @testable import SyntaxKit 5 | 6 | @Suite internal struct ThrowEdgeCaseTests { 7 | // MARK: - Edge Cases 8 | 9 | @Test("Throw with nil literal generates correct syntax") 10 | internal func testThrowWithNilLiteral() throws { 11 | let throwStatement = Throw(Literal.nil) 12 | 13 | let generated = throwStatement.generateCode() 14 | let expected = "throw nil" 15 | 16 | #expect(generated.normalize() == expected.normalize()) 17 | } 18 | 19 | @Test("Throw with float literal generates correct syntax") 20 | internal func testThrowWithFloatLiteral() throws { 21 | let throwStatement = Throw(Literal.float(3.14)) 22 | 23 | let generated = throwStatement.generateCode() 24 | let expected = "throw 3.14" 25 | 26 | #expect(generated.normalize() == expected.normalize()) 27 | } 28 | 29 | @Test("Throw with reference literal generates correct syntax") 30 | internal func testThrowWithReferenceLiteral() throws { 31 | let throwStatement = Throw(Literal.ref("globalError")) 32 | 33 | let generated = throwStatement.generateCode() 34 | let expected = "throw globalError" 35 | 36 | #expect(generated.normalize() == expected.normalize()) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /.claude/commands/tm/parse-prd/parse-prd.md: -------------------------------------------------------------------------------- 1 | Parse a PRD document to generate tasks. 2 | 3 | Arguments: $ARGUMENTS (PRD file path) 4 | 5 | ## Intelligent PRD Parsing 6 | 7 | Analyzes your requirements document and generates a complete task breakdown. 8 | 9 | ## Execution 10 | 11 | ```bash 12 | task-master parse-prd --input=$ARGUMENTS 13 | ``` 14 | 15 | ## Parsing Process 16 | 17 | 1. **Document Analysis** 18 | - Extract key requirements 19 | - Identify technical components 20 | - Detect dependencies 21 | - Estimate complexity 22 | 23 | 2. **Task Generation** 24 | - Create 10-15 tasks by default 25 | - Include implementation tasks 26 | - Add testing tasks 27 | - Include documentation tasks 28 | - Set logical dependencies 29 | 30 | 3. **Smart Enhancements** 31 | - Group related functionality 32 | - Set appropriate priorities 33 | - Add acceptance criteria 34 | - Include test strategies 35 | 36 | ## Options 37 | 38 | Parse arguments for modifiers: 39 | - Number after filename → `--num-tasks` 40 | - `research` → Use research mode 41 | - `comprehensive` → Generate more tasks 42 | 43 | ## Post-Generation 44 | 45 | After parsing: 46 | 1. Display task summary 47 | 2. Show dependency graph 48 | 3. Suggest task expansion for complex items 49 | 4. Recommend sprint planning -------------------------------------------------------------------------------- /.claude/commands/tm/parse-prd/parse-prd-with-research.md: -------------------------------------------------------------------------------- 1 | Parse PRD with enhanced research mode for better task generation. 2 | 3 | Arguments: $ARGUMENTS (PRD file path) 4 | 5 | ## Research-Enhanced Parsing 6 | 7 | Uses the research AI provider (typically Perplexity) for more comprehensive task generation with current best practices. 8 | 9 | ## Execution 10 | 11 | ```bash 12 | task-master parse-prd --input=$ARGUMENTS --research 13 | ``` 14 | 15 | ## Research Benefits 16 | 17 | 1. **Current Best Practices** 18 | - Latest framework patterns 19 | - Security considerations 20 | - Performance optimizations 21 | - Accessibility requirements 22 | 23 | 2. **Technical Deep Dive** 24 | - Implementation approaches 25 | - Library recommendations 26 | - Architecture patterns 27 | - Testing strategies 28 | 29 | 3. **Comprehensive Coverage** 30 | - Edge cases consideration 31 | - Error handling tasks 32 | - Monitoring setup 33 | - Deployment tasks 34 | 35 | ## Enhanced Output 36 | 37 | Research mode typically: 38 | - Generates more detailed tasks 39 | - Includes industry standards 40 | - Adds compliance considerations 41 | - Suggests modern tooling 42 | 43 | ## When to Use 44 | 45 | - New technology domains 46 | - Complex requirements 47 | - Regulatory compliance needed 48 | - Best practices crucial -------------------------------------------------------------------------------- /.claude/commands/tm/models/setup-models.md: -------------------------------------------------------------------------------- 1 | Run interactive setup to configure AI models. 2 | 3 | ## Interactive Model Configuration 4 | 5 | Guides you through setting up AI providers for Task Master. 6 | 7 | ## Execution 8 | 9 | ```bash 10 | task-master models --setup 11 | ``` 12 | 13 | ## Setup Process 14 | 15 | 1. **Environment Check** 16 | - Detect existing API keys 17 | - Show current configuration 18 | - Identify missing providers 19 | 20 | 2. **Provider Selection** 21 | - Choose main provider (required) 22 | - Select research provider (recommended) 23 | - Configure fallback (optional) 24 | 25 | 3. **API Key Configuration** 26 | - Prompt for missing keys 27 | - Validate key format 28 | - Test connectivity 29 | - Save configuration 30 | 31 | ## Smart Recommendations 32 | 33 | Based on your needs: 34 | - **For best results**: Claude + Perplexity 35 | - **Budget conscious**: GPT-3.5 + Perplexity 36 | - **Maximum capability**: GPT-4 + Perplexity + Claude fallback 37 | 38 | ## Configuration Storage 39 | 40 | Keys can be stored in: 41 | 1. Environment variables (recommended) 42 | 2. `.env` file in project 43 | 3. Global `.taskmaster/config` 44 | 45 | ## Post-Setup 46 | 47 | After configuration: 48 | - Test each provider 49 | - Show usage examples 50 | - Suggest next steps 51 | - Verify parse-prd works -------------------------------------------------------------------------------- /Examples/Completed/blackjack/code.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | struct BlackjackCard { 4 | // nested Suit enumeration 5 | enum Suit: Character { 6 | case spades = "♠" 7 | case hearts = "♡" 8 | case diamonds = "♢" 9 | case clubs = "♣" 10 | } 11 | 12 | // nested Rank enumeration 13 | enum Rank: Int { 14 | case two = 2 15 | case three 16 | case four 17 | case five 18 | case six 19 | case seven 20 | case eight 21 | case nine 22 | case ten 23 | case jack 24 | case queen 25 | case king 26 | case ace 27 | 28 | struct Values { 29 | let first: Int, second: Int? 30 | } 31 | 32 | var values: Values { 33 | switch self { 34 | case .ace: 35 | return Values(first: 1, second: 11) 36 | case .jack, .queen, .king: 37 | return Values(first: 10, second: nil) 38 | default: 39 | return Values(first: self.rawValue, second: nil) 40 | } 41 | } 42 | } 43 | 44 | // BlackjackCard properties and methods 45 | let rank: Rank 46 | let suit: Suit 47 | var description: String { 48 | var output = "suit is \(suit.rawValue)," 49 | output += " value is \(rank.values.first)" 50 | if let second = rank.values.second { 51 | output += " or \(second)" 52 | } 53 | return output 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Macros/Options/.swiftformat: -------------------------------------------------------------------------------- 1 | --indent 2 2 | --header "\n .*?\.swift\n SimulatorServices\n\n Created by Leo Dion.\n Copyright © {year} BrightDigit.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the “Software”), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or\n sell copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n \n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n" 3 | --commas inline 4 | --disable wrapMultilineStatementBraces, redundantInternal 5 | --extensionacl on-declarations 6 | --decimalgrouping 3,4 7 | --exclude .build, DerivedData, .swiftpm 8 | -------------------------------------------------------------------------------- /Tests/SyntaxKitTests/Unit/ControlFlow/ForLoopTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Testing 3 | 4 | @testable import SyntaxKit 5 | 6 | @Suite 7 | internal final class ForLoopTests { 8 | @Test 9 | internal func testSimpleForInLoop() throws { 10 | let forLoop = For( 11 | VariableExp("item"), 12 | in: VariableExp("items"), 13 | then: { 14 | Call("print") { 15 | ParameterExp(name: "", value: "item") 16 | } 17 | } 18 | ) 19 | let generated = forLoop.syntax.description 20 | let expected = "for item in items {\n print(item)\n}" 21 | #expect(generated.contains("for item in items")) 22 | #expect(generated.contains("print(item)")) 23 | } 24 | 25 | @Test 26 | internal func testForInWithWhereClause() throws { 27 | let forLoop = try For( 28 | VariableExp("number"), 29 | in: VariableExp("numbers"), 30 | where: { 31 | try Infix("%") { 32 | VariableExp("number") 33 | Literal.integer(2) 34 | } 35 | }, 36 | then: { 37 | Call("print") { 38 | ParameterExp(name: "", value: "number") 39 | } 40 | } 41 | ) 42 | let generated = forLoop.syntax.description 43 | #expect(generated.contains("for number in numbers where number % 2")) 44 | #expect(generated.contains("print(number)")) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.claude/commands/tm/set-status/to-cancelled.md: -------------------------------------------------------------------------------- 1 | Cancel a task permanently. 2 | 3 | Arguments: $ARGUMENTS (task ID) 4 | 5 | ## Cancelling a Task 6 | 7 | This status indicates a task is no longer needed and won't be completed. 8 | 9 | ## Valid Reasons for Cancellation 10 | 11 | - Requirements changed 12 | - Feature deprecated 13 | - Duplicate of another task 14 | - Strategic pivot 15 | - Technical approach invalidated 16 | 17 | ## Pre-Cancellation Checks 18 | 19 | 1. Confirm no critical dependencies 20 | 2. Check for partial implementation 21 | 3. Verify cancellation rationale 22 | 4. Document lessons learned 23 | 24 | ## Execution 25 | 26 | ```bash 27 | task-master set-status --id=$ARGUMENTS --status=cancelled 28 | ``` 29 | 30 | ## Cancellation Impact 31 | 32 | When cancelling: 33 | 1. **Dependency Updates** 34 | - Notify dependent tasks 35 | - Update project scope 36 | - Recalculate timelines 37 | 38 | 2. **Clean-up Actions** 39 | - Remove related branches 40 | - Archive any work done 41 | - Update documentation 42 | - Close related issues 43 | 44 | 3. **Learning Capture** 45 | - Document why cancelled 46 | - Note what was learned 47 | - Update estimation models 48 | - Prevent future duplicates 49 | 50 | ## Historical Preservation 51 | 52 | - Keep for reference 53 | - Tag with cancellation reason 54 | - Link to replacement if any 55 | - Maintain audit trail -------------------------------------------------------------------------------- /Examples/Completed/card_game/code.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // MARK: - Models 4 | /// Represents a playing card in a standard 52-card deck 5 | /// 6 | /// A card has a rank (2-10, J, Q, K, A) and a suit (hearts, diamonds, clubs, spades). 7 | /// Each card can be compared to other cards based on its rank. 8 | struct Card: Comparable { 9 | /// The rank of the card (2-10, J, Q, K, A) 10 | let rank: Rank 11 | /// The suit of the card (hearts, diamonds, clubs, spades) 12 | let suit: Suit 13 | } 14 | 15 | // MARK: - Enums 16 | /// Represents the possible ranks of a playing card 17 | enum Rank: Int, CaseIterable { 18 | case two = 2 19 | case three 20 | case four 21 | case five 22 | case six 23 | case seven 24 | case eight 25 | case nine 26 | case ten 27 | case jack 28 | case queen 29 | case king 30 | case ace 31 | 32 | /// Returns a string representation of the rank 33 | var description: String { 34 | switch self { 35 | case .jack: return "J" 36 | case .queen: return "Q" 37 | case .king: return "K" 38 | case .ace: return "A" 39 | default: return "\(rawValue)" 40 | } 41 | } 42 | } 43 | 44 | /// Represents the four suits in a standard deck of cards 45 | enum Suit: String, CaseIterable { 46 | case hearts = "♥" 47 | case diamonds = "♦" 48 | case clubs = "♣" 49 | case spades = "♠" 50 | } 51 | -------------------------------------------------------------------------------- /Macros/SKSampleMacro/Sources/SKSampleMacroMacros/SKSampleMacroMacro.swift: -------------------------------------------------------------------------------- 1 | import SwiftCompilerPlugin 2 | import SwiftSyntax 3 | //import SwiftSyntaxBuilder 4 | import SwiftSyntaxMacros 5 | import SyntaxKit 6 | 7 | /// Implementation of the `stringify` macro, which takes an expression 8 | /// of any type and produces a tuple containing the value of that expression 9 | /// and the source code that produced the value. For example 10 | /// 11 | /// #stringify(x + y) 12 | /// 13 | /// will expand to 14 | /// 15 | /// (x + y, "x + y") 16 | public struct StringifyMacro: ExpressionMacro { 17 | public static func expansion( 18 | of node: some FreestandingMacroExpansionSyntax, 19 | in context: some MacroExpansionContext 20 | ) -> ExprSyntax { 21 | let first = node.arguments.first?.expression 22 | let second = node.arguments.last?.expression 23 | guard let first, let second else { 24 | fatalError("compiler bug: the macro does not have any arguments") 25 | } 26 | 27 | return Tuple{ 28 | try Infix("+") { 29 | VariableExp(first.description) 30 | VariableExp(second.description) 31 | } 32 | Literal.string("\(first.description) + \(second.description)") 33 | }.expr 34 | } 35 | } 36 | 37 | @main 38 | struct SKSampleMacroPlugin: CompilerPlugin { 39 | let providingMacros: [Macro.Type] = [ 40 | StringifyMacro.self, 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Expressions/Infix+Comparison.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Infix+Comparison.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | // MARK: - Comparison Operators 33 | 34 | extension Infix { 35 | } 36 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Parser/SyntaxResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SyntaxResponse.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | package struct SyntaxResponse: Codable { 33 | package let syntaxJSON: String 34 | } 35 | -------------------------------------------------------------------------------- /Macros/Options/Tests/OptionsTests/Mocks/MockError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockError.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | internal struct MockError: Error { 33 | internal let value: T 34 | } 35 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Collections/Literal+DictionaryValue.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Literal+DictionaryValue.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | extension Literal: DictionaryValue { 31 | // Literal already has exprSyntax from ExprCodeBlock protocol 32 | } 33 | -------------------------------------------------------------------------------- /.claude/commands/tm/add-dependency/add-dependency.md: -------------------------------------------------------------------------------- 1 | Add a dependency between tasks. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | Parse the task IDs to establish dependency relationship. 6 | 7 | ## Adding Dependencies 8 | 9 | Creates a dependency where one task must be completed before another can start. 10 | 11 | ## Argument Parsing 12 | 13 | Parse natural language or IDs: 14 | - "make 5 depend on 3" → task 5 depends on task 3 15 | - "5 needs 3" → task 5 depends on task 3 16 | - "5 3" → task 5 depends on task 3 17 | - "5 after 3" → task 5 depends on task 3 18 | 19 | ## Execution 20 | 21 | ```bash 22 | task-master add-dependency --id= --depends-on= 23 | ``` 24 | 25 | ## Validation 26 | 27 | Before adding: 28 | 1. **Verify both tasks exist** 29 | 2. **Check for circular dependencies** 30 | 3. **Ensure dependency makes logical sense** 31 | 4. **Warn if creating complex chains** 32 | 33 | ## Smart Features 34 | 35 | - Detect if dependency already exists 36 | - Suggest related dependencies 37 | - Show impact on task flow 38 | - Update task priorities if needed 39 | 40 | ## Post-Addition 41 | 42 | After adding dependency: 43 | 1. Show updated dependency graph 44 | 2. Identify any newly blocked tasks 45 | 3. Suggest task order changes 46 | 4. Update project timeline 47 | 48 | ## Example Flows 49 | 50 | ``` 51 | /project:tm/add-dependency 5 needs 3 52 | → Task #5 now depends on Task #3 53 | → Task #5 is now blocked until #3 completes 54 | → Suggested: Also consider if #5 needs #4 55 | ``` -------------------------------------------------------------------------------- /Sources/DocumentationHarness/CompilationResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CompilationResult.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | // internal struct SyntaxValidationResult { 33 | // internal let success: Bool 34 | // internal let error: String? 35 | // } 36 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Utilities/CodeBlockable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlockable.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | /// Can export a `CodeBlock`. 31 | public protocol CodeBlockable: Sendable { 32 | /// Returns a `CodeBlock`. 33 | var codeBlock: any CodeBlock { get } 34 | } 35 | -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/before/APIEndpoint.swift: -------------------------------------------------------------------------------- 1 | // APIEndpoint.swift - Manual maintenance approach 2 | // Last updated: 2025-08-15 (3 weeks ago!) 3 | // ❌ This file is manually maintained and often gets out of sync 4 | 5 | import Foundation 6 | 7 | /// API endpoints for the application 8 | /// 9 | /// ⚠️ WARNING: Remember to update this enum when backend API changes! 10 | /// ⚠️ Last sync with api-config.json: Unknown 11 | public enum APIEndpoint: String, CaseIterable { 12 | case users = "/api/v1/users" // ❌ Still v1, should be v2 13 | case posts = "/api/v2/posts" // ✅ Correct 14 | case comments = "/api/v2/comments" // ✅ Correct 15 | case userProfile = "/api/v2/users/{id}" // ✅ Correct 16 | // ❌ Missing: analytics, search, notifications endpoints 17 | // ❌ Developer forgot to add new endpoints from latest API update 18 | } 19 | 20 | // MARK: - Problems with manual approach: 21 | /* 22 | Issues discovered in this file: 23 | 24 | 1. VERSION MISMATCH: users endpoint still points to v1 instead of v2 25 | 2. MISSING ENDPOINTS: analytics, search, notifications endpoints not added 26 | 3. NO VALIDATION: No way to verify this matches server configuration 27 | 4. MANUAL PROCESS: Developers forget to update when API changes 28 | 5. STALE DOCUMENTATION: Comments don't indicate last sync date 29 | 6. HUMAN ERROR: Easy to make typos in endpoint URLs 30 | 31 | This leads to runtime failures when the iOS app tries to hit endpoints 32 | that don't exist or uses wrong API versions. 33 | */ -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Swift", 3 | "image": "swift:6.1", 4 | "features": { 5 | "ghcr.io/devcontainers/features/common-utils:2": { 6 | "installZsh": "false", 7 | "username": "vscode", 8 | "upgradePackages": "false" 9 | }, 10 | "ghcr.io/devcontainers/features/git:1": { 11 | "version": "os-provided", 12 | "ppa": "false" 13 | } 14 | }, 15 | "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", 16 | "runArgs": [ 17 | "--cap-add=SYS_PTRACE", 18 | "--security-opt", 19 | "seccomp=unconfined" 20 | ], 21 | // Configure tool-specific properties. 22 | "customizations": { 23 | // Configure properties specific to VS Code. 24 | "vscode": { 25 | // Set *default* container specific settings.json values on container create. 26 | "settings": { 27 | "lldb.library": "/usr/lib/liblldb.so" 28 | }, 29 | // Add the IDs of extensions you want installed when the container is created. 30 | "extensions": [ 31 | "sswg.swift-lang" 32 | ] 33 | } 34 | }, 35 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 36 | // "forwardPorts": [], 37 | 38 | // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 39 | "remoteUser": "root" 40 | } -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/InvalidDeclError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InvalidDeclError.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | @preconcurrency import SwiftSyntax 31 | 32 | internal enum InvalidDeclError: Error, Sendable { 33 | case kind(SyntaxKind) 34 | case rawValue(Int) 35 | } 36 | -------------------------------------------------------------------------------- /.devcontainer/swift-6.0/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Swift", 3 | "image": "swift:6.0", 4 | "features": { 5 | "ghcr.io/devcontainers/features/common-utils:2": { 6 | "installZsh": "false", 7 | "username": "vscode", 8 | "upgradePackages": "false" 9 | }, 10 | "ghcr.io/devcontainers/features/git:1": { 11 | "version": "os-provided", 12 | "ppa": "false" 13 | } 14 | }, 15 | "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", 16 | "runArgs": [ 17 | "--cap-add=SYS_PTRACE", 18 | "--security-opt", 19 | "seccomp=unconfined" 20 | ], 21 | // Configure tool-specific properties. 22 | "customizations": { 23 | // Configure properties specific to VS Code. 24 | "vscode": { 25 | // Set *default* container specific settings.json values on container create. 26 | "settings": { 27 | "lldb.library": "/usr/lib/liblldb.so" 28 | }, 29 | // Add the IDs of extensions you want installed when the container is created. 30 | "extensions": [ 31 | "sswg.swift-lang" 32 | ] 33 | } 34 | }, 35 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 36 | // "forwardPorts": [], 37 | 38 | // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 39 | "remoteUser": "root" 40 | } -------------------------------------------------------------------------------- /.devcontainer/swift-6.1/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Swift", 3 | "image": "swift:6.1", 4 | "features": { 5 | "ghcr.io/devcontainers/features/common-utils:2": { 6 | "installZsh": "false", 7 | "username": "vscode", 8 | "upgradePackages": "false" 9 | }, 10 | "ghcr.io/devcontainers/features/git:1": { 11 | "version": "os-provided", 12 | "ppa": "false" 13 | } 14 | }, 15 | "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", 16 | "runArgs": [ 17 | "--cap-add=SYS_PTRACE", 18 | "--security-opt", 19 | "seccomp=unconfined" 20 | ], 21 | // Configure tool-specific properties. 22 | "customizations": { 23 | // Configure properties specific to VS Code. 24 | "vscode": { 25 | // Set *default* container specific settings.json values on container create. 26 | "settings": { 27 | "lldb.library": "/usr/lib/liblldb.so" 28 | }, 29 | // Add the IDs of extensions you want installed when the container is created. 30 | "extensions": [ 31 | "sswg.swift-lang" 32 | ] 33 | } 34 | }, 35 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 36 | // "forwardPorts": [], 37 | 38 | // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 39 | "remoteUser": "root" 40 | } -------------------------------------------------------------------------------- /Sources/SyntaxKit/Collections/CodeBlockableLiteral.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlockableLiteral.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// A protocol for tuple literal values that can be used as literals. 33 | public typealias CodeBlockableLiteral = LiteralValue & CodeBlockable 34 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Collections/PatternCodeBlock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PatternCodeBlock.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// A protocol for tuple patterns that can be used as CodeBlocks for for-in loops. 33 | public typealias PatternCodeBlock = CodeBlock & PatternConvertible 34 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Parser/SyntaxType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SyntaxType.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | internal enum SyntaxType: String, Codable, Equatable { 33 | case decl 34 | case expr 35 | case pattern 36 | case type 37 | case collection 38 | case other 39 | } 40 | -------------------------------------------------------------------------------- /.devcontainer/swift-6.1-nightly/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Swift", 3 | "image": "swift:6.1", 4 | "features": { 5 | "ghcr.io/devcontainers/features/common-utils:2": { 6 | "installZsh": "false", 7 | "username": "vscode", 8 | "upgradePackages": "false" 9 | }, 10 | "ghcr.io/devcontainers/features/git:1": { 11 | "version": "os-provided", 12 | "ppa": "false" 13 | } 14 | }, 15 | "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", 16 | "runArgs": [ 17 | "--cap-add=SYS_PTRACE", 18 | "--security-opt", 19 | "seccomp=unconfined" 20 | ], 21 | // Configure tool-specific properties. 22 | "customizations": { 23 | // Configure properties specific to VS Code. 24 | "vscode": { 25 | // Set *default* container specific settings.json values on container create. 26 | "settings": { 27 | "lldb.library": "/usr/lib/liblldb.so" 28 | }, 29 | // Add the IDs of extensions you want installed when the container is created. 30 | "extensions": [ 31 | "sswg.swift-lang" 32 | ] 33 | } 34 | }, 35 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 36 | // "forwardPorts": [], 37 | 38 | // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 39 | "remoteUser": "root" 40 | } -------------------------------------------------------------------------------- /Macros/Options/Package@swift-6.1.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 6.1 2 | 3 | // swiftlint:disable explicit_top_level_acl 4 | // swiftlint:disable prefixed_toplevel_constant 5 | // swiftlint:disable explicit_acl 6 | 7 | import CompilerPluginSupport 8 | import PackageDescription 9 | 10 | 11 | let package = Package( 12 | name: "Options", 13 | platforms: [ 14 | .macOS(.v13), 15 | .iOS(.v13), 16 | .watchOS(.v6), 17 | .tvOS(.v13), 18 | .visionOS(.v1) 19 | ], 20 | products: [ 21 | .library( 22 | name: "Options", 23 | targets: ["Options"] 24 | ) 25 | ], 26 | dependencies: [ 27 | .package(path: "../.."), 28 | .package(url: "https://github.com/swiftlang/swift-syntax.git", from: "601.0.1") 29 | // Dependencies declare other packages that this package depends on. 30 | // .package(url: /* package url */, from: "1.0.0") 31 | ], 32 | targets: [ 33 | .target( 34 | name: "Options", 35 | dependencies: ["OptionsMacros"] 36 | ), 37 | .macro( 38 | name: "OptionsMacros", 39 | dependencies: [ 40 | .product(name: "SyntaxKit", package: "SyntaxKit"), 41 | .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), 42 | .product(name: "SwiftCompilerPlugin", package: "swift-syntax") 43 | ] 44 | ), 45 | .testTarget( 46 | name: "OptionsTests", 47 | dependencies: ["Options"] 48 | ) 49 | ] 50 | ) 51 | 52 | // swiftlint:enable explicit_top_level_acl 53 | // swiftlint:enable prefixed_toplevel_constant 54 | // swiftlint:enable explicit_acl 55 | -------------------------------------------------------------------------------- /.devcontainer/swift-6.2-nightly/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Swift", 3 | "image": "swiftlang/swift:nightly-6.2-noble", 4 | "features": { 5 | "ghcr.io/devcontainers/features/common-utils:2": { 6 | "installZsh": "false", 7 | "username": "vscode", 8 | "upgradePackages": "false" 9 | }, 10 | "ghcr.io/devcontainers/features/git:1": { 11 | "version": "os-provided", 12 | "ppa": "false" 13 | } 14 | }, 15 | "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", 16 | "runArgs": [ 17 | "--cap-add=SYS_PTRACE", 18 | "--security-opt", 19 | "seccomp=unconfined" 20 | ], 21 | // Configure tool-specific properties. 22 | "customizations": { 23 | // Configure properties specific to VS Code. 24 | "vscode": { 25 | // Set *default* container specific settings.json values on container create. 26 | "settings": { 27 | "lldb.library": "/usr/lib/liblldb.so" 28 | }, 29 | // Add the IDs of extensions you want installed when the container is created. 30 | "extensions": [ 31 | "sswg.swift-lang" 32 | ] 33 | } 34 | }, 35 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 36 | // "forwardPorts": [], 37 | 38 | // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 39 | "remoteUser": "root" 40 | } -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/before/NetworkError.swift: -------------------------------------------------------------------------------- 1 | // NetworkError.swift - Manual maintenance approach 2 | // ❌ Inconsistent with backend error specifications 3 | 4 | import Foundation 5 | 6 | /// Network errors that can occur during API calls 7 | /// ⚠️ WARNING: This enum structure doesn't match backend error format 8 | public enum NetworkError: Error { 9 | case badURL // ❌ Backend calls this "invalidURL" 10 | case httpFailure(Int) // ❌ Backend sends statusCode + message 11 | case offline // ❌ Backend calls this "networkUnavailable" 12 | case parseError // ❌ Backend sends specific DecodingError 13 | } 14 | 15 | // MARK: - Synchronization Problems: 16 | /* 17 | Issues with manual NetworkError enum: 18 | 19 | 1. NAMING INCONSISTENCY: 20 | - iOS: "badURL" vs Backend: "invalidURL" 21 | - iOS: "offline" vs Backend: "networkUnavailable" 22 | - iOS: "parseError" vs Backend: "decodingError" 23 | 24 | 2. STRUCTURE MISMATCH: 25 | - iOS: httpFailure(Int) 26 | - Backend: httpError(statusCode: Int, message: String) 27 | 28 | 3. MISSING ERROR CONTEXT: 29 | - iOS parseError has no details 30 | - Backend decodingError includes full DecodingError 31 | 32 | 4. NO VALIDATION: No way to verify this matches backend error spec 33 | 34 | 5. EVOLUTION PROBLEMS: When backend adds new error types, 35 | iOS enum becomes incomplete 36 | 37 | This leads to poor error handling where the iOS app can't properly 38 | parse or display backend error responses. 39 | */ -------------------------------------------------------------------------------- /Sources/SyntaxKit/Variables/VariableKind.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VariableKind.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// Represents the kind of variable declaration. 33 | public enum VariableKind: Sendable, Equatable { 34 | /// A `let` declaration. 35 | case `let` 36 | /// A `var` declaration. 37 | case `var` 38 | } 39 | -------------------------------------------------------------------------------- /Sources/DocumentationHarness/CodeBlockExtractorError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlockExtractorError.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | /// Errors that can occur during code block extraction from markdown 31 | package enum CodeBlockExtractorError: Error { 32 | /// The extractor instance has already been used and cannot be reused 33 | case alreadyUsed 34 | } 35 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/MacrosPlugin.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MacrosPlugin.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftCompilerPlugin 31 | import SwiftSyntax 32 | import SwiftSyntaxMacros 33 | 34 | @main 35 | internal struct MacrosPlugin: CompilerPlugin { 36 | internal let providingMacros: [any Macro.Type] = [ 37 | OptionsMacro.self 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/TypeRepresentable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TypeRepresentable.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | /// Types that can be represented as a Swift type. 33 | public protocol TypeRepresentable: Sendable { 34 | /// Returns the SwiftSyntax representation of the conforming type. 35 | var typeSyntax: TypeSyntax { get } 36 | } 37 | -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/code.swift: -------------------------------------------------------------------------------- 1 | // MARK: - Generated API Enums 2 | // ⚡ Auto-generated from api-config.json using SyntaxKit 3 | // ✅ Always synchronized with backend configuration 4 | // 🚀 Generated on: 2025-09-01T19:15:30Z 5 | 6 | /// API endpoints for the application 7 | /// 8 | /// ⚡ Generated automatically from api-config.json 9 | /// ✅ Always synchronized with backend configuration 10 | public enum APIEndpoint: String, CaseIterable { 11 | case analytics = "/api/v2/analytics" 12 | case comments = "/api/v2/comments" 13 | case notifications = "/api/v2/notifications" 14 | case posts = "/api/v2/posts" 15 | case search = "/api/v2/search" 16 | case userProfile = "/api/v2/users/{id}" 17 | case users = "/api/v2/users" 18 | } 19 | 20 | /// HTTP status codes for API responses 21 | /// 22 | /// ⚡ Generated automatically from api-config.json 23 | /// ✅ Complete coverage of all backend status codes 24 | public enum HTTPStatus: Int, CaseIterable { 25 | case success = 200 26 | case created = 201 27 | case badRequest = 400 28 | case unauthorized = 401 29 | case forbidden = 403 30 | case notFound = 404 31 | case internalError = 500 32 | case serviceUnavailable = 503 33 | } 34 | 35 | /// Network errors that can occur during API calls 36 | /// 37 | /// ⚡ Generated automatically from api-config.json 38 | /// ✅ Perfect structural match with backend error format 39 | public enum NetworkError: Error, Equatable { 40 | case invalidURL(url: String) 41 | case httpError(statusCode: Int, message: String) 42 | case networkUnavailable 43 | case decodingError(DecodingError) 44 | } -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/String+TypeRepresentable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+TypeRepresentable.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | extension String: TypeRepresentable { 33 | /// Returns the SwiftSyntax representation of the conforming type. 34 | public var typeSyntax: TypeSyntax { TypeSyntax(IdentifierTypeSyntax(name: .identifier(self))) } 35 | } 36 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/CodeBlocks/ExprCodeBlock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExprCodeBlock.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | /// A protocol for types that can be represented as an ExprSyntax node. 33 | public protocol ExprCodeBlock: Sendable { 34 | /// The SwiftSyntax expression representation of the code block. 35 | var exprSyntax: ExprSyntax { get } 36 | } 37 | -------------------------------------------------------------------------------- /Tests/SyntaxKitTests/Unit/Integration/OptionsMacroIntegrationTestsAPI.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Testing 3 | 4 | @testable import SyntaxKit 5 | 6 | internal struct OptionsMacroIntegrationTestsAPI { 7 | // MARK: - API Validation Tests 8 | 9 | @Test internal func testNewSyntaxKitAPICompleteness() { 10 | // Verify that all the new API components work together correctly 11 | 12 | // Test LiteralValue protocol 13 | let array: [String] = ["a", "b", "c"] 14 | #expect(array.typeName == "[String]") 15 | #expect(array.literalString == "[\"a\", \"b\", \"c\"]") 16 | 17 | let dict: [Int: String] = [1: "a", 2: "b"] 18 | #expect(dict.typeName == "[Int: String]") 19 | #expect(dict.literalString.contains("1: \"a\"")) 20 | #expect(dict.literalString.contains("2: \"b\"")) 21 | 22 | // Test Variable with static support 23 | let staticVar = Variable(.let, name: "test", equals: array).withExplicitType().static() 24 | let staticGenerated = staticVar.generateCode().normalize() 25 | #expect(staticGenerated.contains("static let test: [String] = [\"a\", \"b\", \"c\"]")) 26 | 27 | // Test Extension with inheritance 28 | let ext = Extension("Test") { 29 | // Empty content 30 | }.inherits("Protocol1", "Protocol2") 31 | 32 | let extGenerated = ext.generateCode().normalize() 33 | #expect(extGenerated.contains("extension Test: Protocol1, Protocol2")) 34 | 35 | // Test TypeAlias 36 | let alias = TypeAlias("MyType", equals: "String") 37 | let aliasGenerated = alias.generateCode().normalize() 38 | #expect(aliasGenerated.contains("typealias MyType = String")) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Examples/Completed/enum_generator/after/Generated.swift: -------------------------------------------------------------------------------- 1 | // MARK: - Generated API Enums 2 | // ⚡ Auto-generated from api-config.json using SyntaxKit 3 | // ✅ Always synchronized with backend configuration 4 | // 🚀 Generated on: 2025-09-01T19:15:30Z 5 | 6 | /// API endpoints for the application 7 | /// 8 | /// ⚡ Generated automatically from api-config.json 9 | /// ✅ Always synchronized with backend configuration 10 | public enum APIEndpoint: String, CaseIterable { 11 | case analytics = "/api/v2/analytics" 12 | case comments = "/api/v2/comments" 13 | case notifications = "/api/v2/notifications" 14 | case posts = "/api/v2/posts" 15 | case search = "/api/v2/search" 16 | case userProfile = "/api/v2/users/{id}" 17 | case users = "/api/v2/users" 18 | } 19 | 20 | /// HTTP status codes for API responses 21 | /// 22 | /// ⚡ Generated automatically from api-config.json 23 | /// ✅ Complete coverage of all backend status codes 24 | public enum HTTPStatus: Int, CaseIterable { 25 | case success = 200 26 | case created = 201 27 | case badRequest = 400 28 | case unauthorized = 401 29 | case forbidden = 403 30 | case notFound = 404 31 | case internalError = 500 32 | case serviceUnavailable = 503 33 | } 34 | 35 | /// Network errors that can occur during API calls 36 | /// 37 | /// ⚡ Generated automatically from api-config.json 38 | /// ✅ Perfect structural match with backend error format 39 | public enum NetworkError: Error, Equatable { 40 | case invalidURL(url: String) 41 | case httpError(statusCode: Int, message: String) 42 | case networkUnavailable 43 | case decodingError(DecodingError) 44 | } -------------------------------------------------------------------------------- /Sources/SyntaxKit/Utilities/CommentBuilderResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CommentBuilderResult.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | /// A result builder for creating arrays of ``Line``s for comments. 31 | @resultBuilder 32 | public enum CommentBuilderResult: Sendable, Equatable { 33 | /// Builds a block of ``Line``s. 34 | public static func buildBlock(_ components: Line...) -> [Line] { components } 35 | } 36 | -------------------------------------------------------------------------------- /Sources/DocumentationHarness/CodeBlockType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlockType.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | internal enum CodeBlockType: Sendable { 33 | case example 34 | @available( 35 | *, unavailable, 36 | message: "Parsing Package.swift manifests as documentation code blocks is unsupported." 37 | ) 38 | case packageManifest 39 | case shellCommand 40 | } 41 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/Keyword+AccessModifier.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Keyword+AccessModifier.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | extension Keyword { 33 | /// Creates a Keyword from an AccessModifier. 34 | /// - Parameter accessModifier: The access modifier to convert. 35 | public init(_ accessModifier: AccessModifier) { 36 | self = accessModifier.keyword 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /.claude/commands/tm/remove-dependency/remove-dependency.md: -------------------------------------------------------------------------------- 1 | Remove a dependency between tasks. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | Parse the task IDs to remove dependency relationship. 6 | 7 | ## Removing Dependencies 8 | 9 | Removes a dependency relationship, potentially unblocking tasks. 10 | 11 | ## Argument Parsing 12 | 13 | Parse natural language or IDs: 14 | - "remove dependency between 5 and 3" 15 | - "5 no longer needs 3" 16 | - "unblock 5 from 3" 17 | - "5 3" → remove dependency of 5 on 3 18 | 19 | ## Execution 20 | 21 | ```bash 22 | task-master remove-dependency --id= --depends-on= 23 | ``` 24 | 25 | ## Pre-Removal Checks 26 | 27 | 1. **Verify dependency exists** 28 | 2. **Check impact on task flow** 29 | 3. **Warn if it breaks logical sequence** 30 | 4. **Show what will be unblocked** 31 | 32 | ## Smart Analysis 33 | 34 | Before removing: 35 | - Show why dependency might have existed 36 | - Check if removal makes tasks executable 37 | - Verify no critical path disruption 38 | - Suggest alternative dependencies 39 | 40 | ## Post-Removal 41 | 42 | After removing: 43 | 1. Show updated task status 44 | 2. List newly unblocked tasks 45 | 3. Update project timeline 46 | 4. Suggest next actions 47 | 48 | ## Safety Features 49 | 50 | - Confirm if removing critical dependency 51 | - Show tasks that become immediately actionable 52 | - Warn about potential issues 53 | - Keep removal history 54 | 55 | ## Example 56 | 57 | ``` 58 | /project:tm/remove-dependency 5 from 3 59 | → Removed: Task #5 no longer depends on #3 60 | → Task #5 is now UNBLOCKED and ready to start 61 | → Warning: Consider if #5 still needs #2 completed first 62 | ``` -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/PatternConvertible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PatternConvertible.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | public import SwiftSyntax 32 | 33 | /// Types that can be turned into a `PatternSyntax` suitable for a `switch` case pattern. 34 | public protocol PatternConvertible: Sendable { 35 | /// SwiftSyntax representation of the pattern. 36 | var patternSyntax: PatternSyntax { get } 37 | } 38 | -------------------------------------------------------------------------------- /.claude/commands/tm/workflows/smart-workflow.md: -------------------------------------------------------------------------------- 1 | Execute an intelligent workflow based on current project state and recent commands. 2 | 3 | This command analyzes: 4 | 1. Recent commands you've run 5 | 2. Current project state 6 | 3. Time of day / day of week 7 | 4. Your working patterns 8 | 9 | Arguments: $ARGUMENTS 10 | 11 | ## Intelligent Workflow Selection 12 | 13 | Based on context, I'll determine the best workflow: 14 | 15 | ### Context Analysis 16 | - Previous command executed 17 | - Current task states 18 | - Unfinished work from last session 19 | - Your typical patterns 20 | 21 | ### Smart Execution 22 | 23 | If last command was: 24 | - `status` → Likely starting work → Run daily standup 25 | - `complete` → Task finished → Find next task 26 | - `list pending` → Planning → Suggest sprint planning 27 | - `expand` → Breaking down work → Show complexity analysis 28 | - `init` → New project → Show onboarding workflow 29 | 30 | If no recent commands: 31 | - Morning? → Daily standup workflow 32 | - Many pending tasks? → Sprint planning 33 | - Tasks blocked? → Dependency resolution 34 | - Friday? → Weekly review 35 | 36 | ### Workflow Composition 37 | 38 | I'll chain appropriate commands: 39 | 1. Analyze current state 40 | 2. Execute primary workflow 41 | 3. Suggest follow-up actions 42 | 4. Prepare environment for coding 43 | 44 | ### Learning Mode 45 | 46 | This command learns from your patterns: 47 | - Track command sequences 48 | - Note time preferences 49 | - Remember common workflows 50 | - Adapt to your style 51 | 52 | Example flows detected: 53 | - Morning: standup → next → start 54 | - After lunch: status → continue task 55 | - End of day: complete → commit → status -------------------------------------------------------------------------------- /Macros/SKSampleMacro/Tests/SKSampleMacroTests/SKSampleMacroTests.swift: -------------------------------------------------------------------------------- 1 | import SwiftSyntax 2 | import SwiftSyntaxBuilder 3 | import SwiftSyntaxMacros 4 | import SwiftSyntaxMacrosTestSupport 5 | import Testing 6 | 7 | // Macro implementations build for the host, so the corresponding module is not available when cross-compiling. Cross-compiled tests may still make use of the macro itself in end-to-end tests. 8 | #if canImport(SKSampleMacroMacros) 9 | import SKSampleMacroMacros 10 | 11 | let testMacros: [String: Macro.Type] = [ 12 | "stringify": StringifyMacro.self, 13 | ] 14 | #endif 15 | 16 | @Suite 17 | struct SKSampleMacroTests { 18 | @Test 19 | func macro() throws { 20 | #if canImport(SKSampleMacroMacros) 21 | assertMacroExpansion( 22 | """ 23 | #stringify(a + b) 24 | """, 25 | expandedSource: """ 26 | (a + b, "a + b") 27 | """, 28 | macros: testMacros 29 | ) 30 | #else 31 | throw Test.Skip("macros are only supported when running tests for the host platform") 32 | #endif 33 | } 34 | 35 | @Test 36 | func macroWithStringLiteral() throws { 37 | #if canImport(SKSampleMacroMacros) 38 | assertMacroExpansion( 39 | #""" 40 | #stringify("Hello, \(name)") 41 | """#, 42 | expandedSource: #""" 43 | ("Hello, \(name)", #""Hello, \(name)""#) 44 | """#, 45 | macros: testMacros 46 | ) 47 | #else 48 | throw Test.Skip("macros are only supported when running tests for the host platform") 49 | #endif 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sources/DocumentationHarness/TestType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestType.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// Represents the type of test performed on a code block 33 | package enum TestType { 34 | /// Code was parsed for syntax validation only 35 | case parsing 36 | /// Code was executed (compiled and run) 37 | case execution 38 | /// Code validation was skipped 39 | case skipped 40 | } 41 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Patterns/String+PatternConvertible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+PatternConvertible.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | extension String: PatternConvertible { 33 | /// SwiftSyntax representation of the string as an identifier pattern. 34 | public var patternSyntax: PatternSyntax { 35 | PatternSyntax(IdentifierPatternSyntax(identifier: .identifier(self))) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Parser/String+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Extensions.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | extension String { 33 | internal func replaceHTMLWhitespacesToSymbols() -> String { 34 | self 35 | .replacingOccurrences(of: " ", with: "") 36 | .replacingOccurrences(of: "
", with: "") 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Attributes/AttributeInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AttributeInfo.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | /// Internal representation of a Swift attribute with its arguments. 31 | internal struct AttributeInfo { 32 | internal let name: String 33 | internal let arguments: [String] 34 | 35 | internal init(name: String, arguments: [String] = []) { 36 | self.name = name 37 | self.arguments = arguments 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/DeclModifierSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DeclModifierSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | #if !canImport(SyntaxKit) 33 | extension DeclModifierSyntax { 34 | internal var isNeededAccessLevelModifier: Bool { 35 | switch name.tokenKind { 36 | case .keyword(.public): return true 37 | default: return false 38 | } 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/CodeBlocks/CodeBlockBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlockBuilder.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// A protocol for types that can build a ``CodeBlock``. 33 | public protocol CodeBlockBuilder: Sendable, Equatable { 34 | /// The type of ``CodeBlock`` that this builder creates. 35 | associatedtype Result: CodeBlock 36 | /// Builds the ``CodeBlock``. 37 | func build() -> Result 38 | } 39 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/Array.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Array.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | extension Array { 33 | internal init?(keyValues: KeyValues) where Element == String { 34 | self.init() 35 | for key in 0 ..< keyValues.count { 36 | guard let value = keyValues.get(key) else { 37 | return nil 38 | } 39 | append(value) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Expressions/Literal+PatternConvertible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Literal+PatternConvertible.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | extension Literal: PatternConvertible { 33 | /// SwiftSyntax representation of the literal as a pattern. 34 | public var patternSyntax: PatternSyntax { 35 | let expr = self.exprSyntax 36 | return PatternSyntax(ExpressionPatternSyntax(expression: expr)) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/CodeBlocks/EmptyCodeBlock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EmptyCodeBlock.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | public import SwiftSyntax 32 | 33 | /// An empty code block that generates no syntax. 34 | internal struct EmptyCodeBlock: CodeBlock, Sendable, Equatable { 35 | /// The syntax for an empty code block. 36 | internal var syntax: any SyntaxProtocol { 37 | StringSegmentSyntax(content: .unknown("")) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/Keyword+CaptureReferenceType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Keyword+CaptureReferenceType.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | extension Keyword { 33 | /// Creates a Keyword from a CaptureReferenceType. 34 | /// - Parameter captureReferenceType: The capture reference type to convert. 35 | public init(_ captureReferenceType: CaptureReferenceType) { 36 | self = captureReferenceType.keyword 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Expressions/LiteralValue.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LiteralValue.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// A protocol for types that can be represented as literal values in Swift code. 33 | public protocol LiteralValue: Sendable { 34 | /// The Swift type name for this literal value. 35 | var typeName: String { get } 36 | 37 | /// Renders this value as a Swift literal string. 38 | var literalString: String { get } 39 | } 40 | -------------------------------------------------------------------------------- /Sources/DocumentationHarness/CodeBlockExtractor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlockExtractor.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | /// Function type for extracting code blocks from markdown content 31 | /// - Parameter content: The markdown content to parse 32 | /// - Returns: Array of extracted code blocks 33 | /// - Throws: CodeBlockExtractorError if extraction fails 34 | package typealias CodeBlockExtractor = @Sendable (String) throws(CodeBlockExtractorError) -> 35 | [CodeBlock] 36 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/TypeAliasDeclSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TypeAliasDeclSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | 33 | #if !canImport(SyntaxKit) 34 | extension TypeAliasDeclSyntax { 35 | internal init(name: TokenSyntax, for initializerTypeName: TokenSyntax) { 36 | self.init( 37 | name: name, 38 | initializer: .init(value: IdentifierTypeSyntax(name: initializerTypeName)) 39 | ) 40 | } 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Patterns/Int+PatternConvertible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Int+PatternConvertible.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | extension Int: PatternConvertible { 33 | /// SwiftSyntax representation of the integer as a pattern. 34 | public var patternSyntax: PatternSyntax { 35 | let expr = ExprSyntax(IntegerLiteralExprSyntax(literal: .integerLiteral(String(self)))) 36 | return PatternSyntax(ExpressionPatternSyntax(expression: expr)) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Utilities/Fallthrough.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Fallthrough.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | /// A `fallthrough` statement. 33 | public struct Fallthrough: CodeBlock { 34 | public var syntax: any SyntaxProtocol { 35 | StmtSyntax( 36 | FallThroughStmtSyntax( 37 | fallthroughKeyword: .keyword(.fallthrough, trailingTrivia: .newline) 38 | ) 39 | ) 40 | } 41 | 42 | /// Creates a `fallthrough` statement. 43 | public init() {} 44 | } 45 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/DeclModifierListSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DeclModifierListSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | 33 | #if !canImport(SyntaxKit) 34 | extension DeclModifierListSyntax { 35 | internal init(keywordModifier: Keyword?) { 36 | if let keywordModifier { 37 | self.init { 38 | DeclModifierSyntax(name: .keyword(keywordModifier)) 39 | } 40 | } else { 41 | self.init([]) 42 | } 43 | } 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /Sources/DocumentationHarness/CodeBlock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlock.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// Represents a code block extracted from documentation 33 | package struct CodeBlock: Sendable { 34 | /// The raw Swift code content 35 | internal let code: String 36 | /// Line number where this code block starts in the source file 37 | internal let lineNumber: Int 38 | /// The type of code block (example, shell command, etc.) 39 | internal let blockType: CodeBlockType 40 | } 41 | -------------------------------------------------------------------------------- /Sources/DocumentationHarness/ValidationParameters.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ValidationParameters.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// Protocol defining the parameters required for Swift code validation 33 | internal protocol ValidationParameters { 34 | /// The Swift code to validate 35 | var code: String { get } 36 | 37 | /// The file URL where the code was found 38 | var fileURL: URL { get } 39 | 40 | /// The line number where the code was found 41 | var lineNumber: Int { get } 42 | } 43 | -------------------------------------------------------------------------------- /.cursor/rules/cursor_rules.mdc: -------------------------------------------------------------------------------- 1 | --- 2 | description: Guidelines for creating and maintaining Cursor rules to ensure consistency and effectiveness. 3 | globs: .cursor/rules/*.mdc 4 | alwaysApply: true 5 | --- 6 | 7 | - **Required Rule Structure:** 8 | ```markdown 9 | --- 10 | description: Clear, one-line description of what the rule enforces 11 | globs: path/to/files/*.ext, other/path/**/* 12 | alwaysApply: boolean 13 | --- 14 | 15 | - **Main Points in Bold** 16 | - Sub-points with details 17 | - Examples and explanations 18 | ``` 19 | 20 | - **File References:** 21 | - Use `[filename](mdc:path/to/file)` ([filename](mdc:filename)) to reference files 22 | - Example: [prisma.mdc](mdc:.cursor/rules/prisma.mdc) for rule references 23 | - Example: [schema.prisma](mdc:prisma/schema.prisma) for code references 24 | 25 | - **Code Examples:** 26 | - Use language-specific code blocks 27 | ```typescript 28 | // ✅ DO: Show good examples 29 | const goodExample = true; 30 | 31 | // ❌ DON'T: Show anti-patterns 32 | const badExample = false; 33 | ``` 34 | 35 | - **Rule Content Guidelines:** 36 | - Start with high-level overview 37 | - Include specific, actionable requirements 38 | - Show examples of correct implementation 39 | - Reference existing code when possible 40 | - Keep rules DRY by referencing other rules 41 | 42 | - **Rule Maintenance:** 43 | - Update rules when new patterns emerge 44 | - Add examples from actual codebase 45 | - Remove outdated patterns 46 | - Cross-reference related rules 47 | 48 | - **Best Practices:** 49 | - Use bullet points for clarity 50 | - Keep descriptions concise 51 | - Include both DO and DON'T examples 52 | - Reference actual code over theoretical examples 53 | - Use consistent formatting across rules -------------------------------------------------------------------------------- /.claude/commands/tm/list/list-tasks.md: -------------------------------------------------------------------------------- 1 | List tasks with intelligent argument parsing. 2 | 3 | Parse arguments to determine filters and display options: 4 | - Status: pending, in-progress, done, review, deferred, cancelled 5 | - Priority: high, medium, low (or priority:high) 6 | - Special: subtasks, tree, dependencies, blocked 7 | - IDs: Direct numbers (e.g., "1,3,5" or "1-5") 8 | - Complex: "pending high" = pending AND high priority 9 | 10 | Arguments: $ARGUMENTS 11 | 12 | Let me parse your request intelligently: 13 | 14 | 1. **Detect Filter Intent** 15 | - If arguments contain status keywords → filter by status 16 | - If arguments contain priority → filter by priority 17 | - If arguments contain "subtasks" → include subtasks 18 | - If arguments contain "tree" → hierarchical view 19 | - If arguments contain numbers → show specific tasks 20 | - If arguments contain "blocked" → show blocked tasks only 21 | 22 | 2. **Smart Combinations** 23 | Examples of what I understand: 24 | - "pending high" → pending tasks with high priority 25 | - "done today" → tasks completed today 26 | - "blocked" → tasks with unmet dependencies 27 | - "1-5" → tasks 1 through 5 28 | - "subtasks tree" → hierarchical view with subtasks 29 | 30 | 3. **Execute Appropriate Query** 31 | Based on parsed intent, run the most specific task-master command 32 | 33 | 4. **Enhanced Display** 34 | - Group by relevant criteria 35 | - Show most important information first 36 | - Use visual indicators for quick scanning 37 | - Include relevant metrics 38 | 39 | 5. **Intelligent Suggestions** 40 | Based on what you're viewing, suggest next actions: 41 | - Many pending? → Suggest priority order 42 | - Many blocked? → Show dependency resolution 43 | - Looking at specific tasks? → Show related tasks -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/DictionaryExprSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DictionaryExprSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | 33 | #if !canImport(SyntaxKit) 34 | extension DictionaryExprSyntax { 35 | internal init(keyValues: KeyValues) { 36 | let dictionaryElements = keyValues.dictionary.map(DictionaryElementSyntax.init(pair:)) 37 | 38 | let list = DictionaryElementListSyntax { 39 | .init(dictionaryElements) 40 | } 41 | self.init(content: .elements(list)) 42 | } 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/EnumDeclSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EnumDeclSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | 33 | #if !canImport(SyntaxKit) 34 | extension EnumDeclSyntax { 35 | internal var caseElements: [EnumCaseElementSyntax] { 36 | memberBlock.members.flatMap { member in 37 | guard let caseDecl = member.decl.as(EnumCaseDeclSyntax.self) else { 38 | return [EnumCaseElementSyntax]() 39 | } 40 | 41 | return Array(caseDecl.elements) 42 | } 43 | } 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/InheritanceClauseSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InheritanceClauseSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | 33 | #if !canImport(SyntaxKit) 34 | extension InheritanceClauseSyntax { 35 | internal init(protocols: [SwiftSyntax.TypeSyntax]) { 36 | self.init( 37 | inheritedTypes: .init { 38 | .init( 39 | protocols.map { typeSyntax in 40 | InheritedTypeSyntax(type: typeSyntax) 41 | } 42 | ) 43 | } 44 | ) 45 | } 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /Examples/Completed/concurrency/dsl.swift: -------------------------------------------------------------------------------- 1 | Enum("VendingMachineError") { 2 | Case("invalidSelection") 3 | Case("insufficientFunds").associatedValue("coinsNeeded", type: "Int") 4 | Case("outOfStock") 5 | } 6 | 7 | Class("VendingMachine") { 8 | Variable(.var, name: "inventory", equals: Literal.dictionary(Dictionary(uniqueKeysWithValues: [ 9 | ("Candy Bar", Item(price: 12, count: 7)), 10 | ("Chips", Item(price: 10, count: 4)), 11 | ("Pretzels", Item(price: 7, count: 11)) 12 | ]))) 13 | Variable(.var, name: "coinsDeposited", equals: 0) 14 | 15 | Function("vend"){ 16 | Parameter("name", labeled: "itemNamed", type: "String") 17 | } _: { 18 | Guard("let item = inventory[itemNamed]") else: { 19 | Throw( 20 | EnumValue("VendingMachineError", case: "invalidSelection") 21 | ) 22 | } 23 | Guard("item.count > 0") else: { 24 | Throw( 25 | EnumValue("VendingMachineError", case: "outOfStock") 26 | ) 27 | } 28 | Guard("item.price <= coinsDeposited") else: { 29 | Throw( 30 | EnumValue("VendingMachineError", case: "insufficientFunds"){ 31 | ParameterExp("coinsNeeded", value: Infix("-"){ 32 | VariableExp("item").property("price") 33 | VariableExp("coinsDeposited") 34 | }) 35 | } 36 | ) 37 | } 38 | Infix("-=", "coinsDeposited", VariableExp("item").property("price")) 39 | Variable("newItem", equals: VariableExp("item")) 40 | Infix("-=", "newItem.count", 1) 41 | Assignment("inventory[itemNamed]", .ref("newItem")) 42 | Call("print", "Dispensing \\(itemNamed)") 43 | } 44 | } 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Macros/Options/Sources/Options/MappedValues.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MappedValues.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// Protocol which provides a method for ``MappedValueRepresented`` to pull values. 33 | public protocol MappedValues { 34 | /// Raw Value Type 35 | associatedtype Value: Equatable 36 | /// Key Value Type 37 | associatedtype Key: Equatable 38 | /// get the key vased on the value. 39 | func key(value: Value) throws -> Key 40 | /// get the value based on the key/index. 41 | func value(key: Key) throws -> Value 42 | } 43 | -------------------------------------------------------------------------------- /Macros/Options/Sources/Options/Macro.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Macro.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | #if swift(>=5.10) 33 | /// Sets an enumeration up to implement 34 | /// ``MappedValueRepresentable`` and ``MappedValueRepresented``. 35 | @attached( 36 | extension, 37 | conformances: MappedValueRepresentable, MappedValueRepresented, 38 | names: named(MappedType), named(mappedValues) 39 | ) 40 | @attached(peer, names: suffixed(Set)) 41 | public macro Options() = #externalMacro(module: "OptionsMacros", type: "OptionsMacro") 42 | #endif 43 | -------------------------------------------------------------------------------- /Macros/Options/Tests/OptionsTests/MappedValueRepresentableTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MappedValueRepresentableTests.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | @testable import Options 31 | import Testing 32 | 33 | @Suite 34 | internal struct MappedValueRepresentableTests { 35 | @Test 36 | internal func stringValue() throws { 37 | #expect(try MockCollectionEnum.a.mappedValue() == "a") 38 | #expect(try MockCollectionEnum.b.mappedValue() == "b") 39 | #expect(try MockCollectionEnum.c.mappedValue() == "c") 40 | #expect(try MockCollectionEnum.d.mappedValue() == "d") 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/CaptureReferenceType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CaptureReferenceType.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | /// Represents the type of reference capture in closures. 33 | public enum CaptureReferenceType: CaseIterable, Sendable, Equatable { 34 | case weak 35 | case unowned 36 | 37 | /// Returns the corresponding SwiftSyntax Keyword for this capture reference type. 38 | public var keyword: Keyword { 39 | switch self { 40 | case .weak: 41 | return .weak 42 | case .unowned: 43 | return .unowned 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.claude/commands/tm/validate-dependencies/validate-dependencies.md: -------------------------------------------------------------------------------- 1 | Validate all task dependencies for issues. 2 | 3 | ## Dependency Validation 4 | 5 | Comprehensive check for dependency problems across the entire project. 6 | 7 | ## Execution 8 | 9 | ```bash 10 | task-master validate-dependencies 11 | ``` 12 | 13 | ## Validation Checks 14 | 15 | 1. **Circular Dependencies** 16 | - A depends on B, B depends on A 17 | - Complex circular chains 18 | - Self-dependencies 19 | 20 | 2. **Missing Dependencies** 21 | - References to non-existent tasks 22 | - Deleted task references 23 | - Invalid task IDs 24 | 25 | 3. **Logical Issues** 26 | - Completed tasks depending on pending 27 | - Cancelled tasks in dependency chains 28 | - Impossible sequences 29 | 30 | 4. **Complexity Warnings** 31 | - Over-complex dependency chains 32 | - Too many dependencies per task 33 | - Bottleneck tasks 34 | 35 | ## Smart Analysis 36 | 37 | The validation provides: 38 | - Visual dependency graph 39 | - Critical path analysis 40 | - Bottleneck identification 41 | - Suggested optimizations 42 | 43 | ## Report Format 44 | 45 | ``` 46 | Dependency Validation Report 47 | ━━━━━━━━━━━━━━━━━━━━━━━━━━ 48 | ✅ No circular dependencies found 49 | ⚠️ 2 warnings found: 50 | - Task #23 has 7 dependencies (consider breaking down) 51 | - Task #45 blocks 5 other tasks (potential bottleneck) 52 | ❌ 1 error found: 53 | - Task #67 depends on deleted task #66 54 | 55 | Critical Path: #1 → #5 → #23 → #45 → #50 (15 days) 56 | ``` 57 | 58 | ## Actionable Output 59 | 60 | For each issue found: 61 | - Clear description 62 | - Impact assessment 63 | - Suggested fix 64 | - Command to resolve 65 | 66 | ## Next Steps 67 | 68 | After validation: 69 | - Run `/project:tm/fix-dependencies` to auto-fix 70 | - Manually adjust problematic dependencies 71 | - Rerun to verify fixes -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/ArrayExprSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ArrayExprSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | 33 | #if !canImport(SyntaxKit) 34 | extension ArrayExprSyntax { 35 | internal init( 36 | from items: some Collection, 37 | _ closure: @escaping @Sendable (T) -> some ExprSyntaxProtocol 38 | ) { 39 | let values = items.map(closure).map { ArrayElementSyntax(expression: $0) } 40 | let arrayElement = ArrayElementListSyntax { 41 | .init(values) 42 | } 43 | self.init(elements: arrayElement) 44 | } 45 | } 46 | #endif 47 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Parser/SourceRange.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceRange.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | internal struct SourceRange: Codable, Equatable { 33 | internal let startRow: Int 34 | internal let startColumn: Int 35 | internal let endRow: Int 36 | internal let endColumn: Int 37 | } 38 | 39 | extension SourceRange: CustomStringConvertible { 40 | internal var description: String { 41 | """ 42 | { 43 | startRow: \(startRow) 44 | startColumn: \(startColumn) 45 | endRow: \(endRow) 46 | endColumn: \(endColumn) 47 | } 48 | """ 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /.claude/commands/tm/add-subtask/convert-task-to-subtask.md: -------------------------------------------------------------------------------- 1 | Convert an existing task into a subtask. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | Parse parent ID and task ID to convert. 6 | 7 | ## Task Conversion 8 | 9 | Converts an existing standalone task into a subtask of another task. 10 | 11 | ## Argument Parsing 12 | 13 | - "move task 8 under 5" 14 | - "make 8 a subtask of 5" 15 | - "nest 8 in 5" 16 | - "5 8" → make task 8 a subtask of task 5 17 | 18 | ## Execution 19 | 20 | ```bash 21 | task-master add-subtask --parent= --task-id= 22 | ``` 23 | 24 | ## Pre-Conversion Checks 25 | 26 | 1. **Validation** 27 | - Both tasks exist and are valid 28 | - No circular parent relationships 29 | - Task isn't already a subtask 30 | - Logical hierarchy makes sense 31 | 32 | 2. **Impact Analysis** 33 | - Dependencies that will be affected 34 | - Tasks that depend on converting task 35 | - Priority alignment needed 36 | - Status compatibility 37 | 38 | ## Conversion Process 39 | 40 | 1. Change task ID from "8" to "5.1" (next available) 41 | 2. Update all dependency references 42 | 3. Inherit parent's context where appropriate 43 | 4. Adjust priorities if needed 44 | 5. Update time estimates 45 | 46 | ## Smart Features 47 | 48 | - Preserve task history 49 | - Maintain dependencies 50 | - Update all references 51 | - Create conversion log 52 | 53 | ## Example 54 | 55 | ``` 56 | /project:tm/add-subtask/from-task 5 8 57 | → Converting: Task #8 becomes subtask #5.1 58 | → Updated: 3 dependency references 59 | → Parent task #5 now has 1 subtask 60 | → Note: Subtask inherits parent's priority 61 | 62 | Before: #8 "Implement validation" (standalone) 63 | After: #5.1 "Implement validation" (subtask of #5) 64 | ``` 65 | 66 | ## Post-Conversion 67 | 68 | - Show new task hierarchy 69 | - List updated dependencies 70 | - Verify project integrity 71 | - Suggest related conversions -------------------------------------------------------------------------------- /Sources/SyntaxKit/Collections/DictionaryValue.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DictionaryValue.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | /// A protocol for types that can be used as dictionary values. 33 | public protocol DictionaryValue: Sendable { 34 | /// The expression syntax representation of this dictionary value. 35 | var exprSyntax: ExprSyntax { get } 36 | } 37 | 38 | extension Call: DictionaryValue {} 39 | extension Init: DictionaryValue {} 40 | extension VariableExp: DictionaryValue {} 41 | extension PropertyAccessExp: DictionaryValue {} 42 | extension FunctionCallExp: DictionaryValue {} 43 | extension Infix: DictionaryValue {} 44 | -------------------------------------------------------------------------------- /Examples/Completed/protocols/code.swift: -------------------------------------------------------------------------------- 1 | // MARK: - Protocol Definition 2 | protocol Vehicle { 3 | var numberOfWheels: Int { get } 4 | var brand: String { get } 5 | func start() 6 | func stop() 7 | } 8 | 9 | // MARK: - Protocol Extension 10 | extension Vehicle { 11 | func start() { 12 | print("Starting \(brand) vehicle...") 13 | } 14 | 15 | func stop() { 16 | print("Stopping \(brand) vehicle...") 17 | } 18 | } 19 | 20 | // MARK: - Protocol Composition 21 | protocol Electric { 22 | var batteryLevel: Double { get set } 23 | func charge() 24 | } 25 | 26 | // MARK: - Concrete Types 27 | struct Car: Vehicle { 28 | let numberOfWheels: Int = 4 29 | let brand: String 30 | 31 | func start() { 32 | print("Starting \(brand) car engine...") 33 | } 34 | } 35 | 36 | struct ElectricCar: Vehicle, Electric { 37 | let numberOfWheels: Int = 4 38 | let brand: String 39 | var batteryLevel: Double 40 | 41 | func charge() { 42 | print("Charging \(brand) electric car...") 43 | batteryLevel = 100.0 44 | } 45 | } 46 | 47 | // MARK: - Usage Example 48 | let tesla = ElectricCar(brand: "Tesla", batteryLevel: 75.0) 49 | let toyota = Car(brand: "Toyota") 50 | 51 | // Demonstrate protocol usage 52 | func demonstrateVehicle(_ vehicle: Vehicle) { 53 | print("Vehicle brand: \(vehicle.brand)") 54 | print("Number of wheels: \(vehicle.numberOfWheels)") 55 | vehicle.start() 56 | vehicle.stop() 57 | } 58 | 59 | // Demonstrate protocol composition 60 | func demonstrateElectricVehicle(_ vehicle: Vehicle & Electric) { 61 | demonstrateVehicle(vehicle) 62 | print("Battery level: \(vehicle.batteryLevel)%") 63 | vehicle.charge() 64 | } 65 | 66 | // Test the implementations 67 | print("Testing regular car:") 68 | demonstrateVehicle(toyota) 69 | 70 | print("\nTesting electric car:") 71 | demonstrateElectricVehicle(tesla) 72 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Parser/StructureValue.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StructureValue.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | internal struct StructureValue: Codable, Equatable { 33 | internal let text: String 34 | internal let kind: String? 35 | 36 | internal init(text: String, kind: String? = nil) { 37 | self.text = text.escapeHTML().replaceHTMLWhitespacesToSymbols() 38 | self.kind = kind?.escapeHTML() 39 | } 40 | } 41 | 42 | extension StructureValue: CustomStringConvertible { 43 | internal var description: String { 44 | """ 45 | { 46 | text: \(text) 47 | kind: \(String(describing: kind)) 48 | } 49 | """ 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Variables/AttributeArguments.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AttributeArguments.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | /// Represents attribute arguments for variable declarations. 33 | internal struct AttributeArguments { 34 | internal let leftParen: TokenSyntax? 35 | internal let rightParen: TokenSyntax? 36 | internal let arguments: AttributeSyntax.Arguments? 37 | 38 | internal init( 39 | leftParen: TokenSyntax? = nil, 40 | rightParen: TokenSyntax? = nil, 41 | arguments: AttributeSyntax.Arguments? = nil 42 | ) { 43 | self.leftParen = leftParen 44 | self.rightParen = rightParen 45 | self.arguments = arguments 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.claude/commands/tm/workflows/command-pipeline.md: -------------------------------------------------------------------------------- 1 | Execute a pipeline of commands based on a specification. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | ## Command Pipeline Execution 6 | 7 | Parse pipeline specification from arguments. Supported formats: 8 | 9 | ### Simple Pipeline 10 | `init → expand-all → sprint-plan` 11 | 12 | ### Conditional Pipeline 13 | `status → if:pending>10 → sprint-plan → else → next` 14 | 15 | ### Iterative Pipeline 16 | `for:pending-tasks → expand → complexity-check` 17 | 18 | ### Smart Pipeline Patterns 19 | 20 | **1. Project Setup Pipeline** 21 | ``` 22 | init [prd] → 23 | expand-all → 24 | complexity-report → 25 | sprint-plan → 26 | show first-sprint 27 | ``` 28 | 29 | **2. Daily Work Pipeline** 30 | ``` 31 | standup → 32 | if:in-progress → continue → 33 | else → next → start 34 | ``` 35 | 36 | **3. Task Completion Pipeline** 37 | ``` 38 | complete [id] → 39 | git-commit → 40 | if:blocked-tasks-freed → show-freed → 41 | next 42 | ``` 43 | 44 | **4. Quality Check Pipeline** 45 | ``` 46 | list in-progress → 47 | for:each → check-idle-time → 48 | if:idle>1day → prompt-update 49 | ``` 50 | 51 | ### Pipeline Features 52 | 53 | **Variables** 54 | - Store results: `status → $count=pending-count` 55 | - Use in conditions: `if:$count>10` 56 | - Pass between commands: `expand $high-priority-tasks` 57 | 58 | **Error Handling** 59 | - On failure: `try:complete → catch:show-blockers` 60 | - Skip on error: `optional:test-run` 61 | - Retry logic: `retry:3:commit` 62 | 63 | **Parallel Execution** 64 | - Parallel branches: `[analyze | test | lint]` 65 | - Join results: `parallel → join:report` 66 | 67 | ### Execution Flow 68 | 69 | 1. Parse pipeline specification 70 | 2. Validate command sequence 71 | 3. Execute with state passing 72 | 4. Handle conditions and loops 73 | 5. Aggregate results 74 | 6. Show summary 75 | 76 | This enables complex workflows like: 77 | `parse-prd → expand-all → filter:complex>70 → assign:senior → sprint-plan:weighted` -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/Line+Trivia.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Line+Trivia.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | // MARK: - Internal helpers 33 | 34 | extension Line { 35 | /// Convert the `Line` to a SwiftSyntax `TriviaPiece`. 36 | internal var triviaPiece: TriviaPiece { 37 | switch kind { 38 | case .line: 39 | return .lineComment("// " + (text ?? "")) 40 | case .doc: 41 | // Empty doc line should still contain the comment marker so we keep a single `/` if no text. 42 | if let text = text, !text.isEmpty { 43 | return .docLineComment("/// " + text) 44 | } else { 45 | return .docLineComment("///") 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Expressions/PropertyAccessible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PropertyAccessible.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | /// A protocol for types that can access properties. 31 | public protocol PropertyAccessible: CodeBlock, Sendable { 32 | /// Accesses a property on the current property access expression (chaining). 33 | /// - Parameter propertyName: The name of the next property to access. 34 | /// - Returns: A property accessible code block representing the chained property access. 35 | func property(_ propertyName: String) -> any PropertyAccessible 36 | 37 | /// Negates the property access expression. 38 | /// - Returns: A negated property access expression. 39 | func not() -> any CodeBlock 40 | } 41 | -------------------------------------------------------------------------------- /.claude/commands/tm/status/project-status.md: -------------------------------------------------------------------------------- 1 | Enhanced status command with comprehensive project insights. 2 | 3 | Arguments: $ARGUMENTS 4 | 5 | ## Intelligent Status Overview 6 | 7 | ### 1. **Executive Summary** 8 | Quick dashboard view: 9 | - 🏃 Active work (in-progress tasks) 10 | - 📊 Progress metrics (% complete, velocity) 11 | - 🚧 Blockers and risks 12 | - ⏱️ Time analysis (estimated vs actual) 13 | - 🎯 Sprint/milestone progress 14 | 15 | ### 2. **Contextual Analysis** 16 | 17 | Based on $ARGUMENTS, focus on: 18 | - "sprint" → Current sprint progress and burndown 19 | - "blocked" → Dependency chains and resolution paths 20 | - "team" → Task distribution and workload 21 | - "timeline" → Schedule adherence and projections 22 | - "risk" → High complexity or overdue items 23 | 24 | ### 3. **Smart Insights** 25 | 26 | **Workflow Health:** 27 | - Idle tasks (in-progress > 24h without updates) 28 | - Bottlenecks (multiple tasks waiting on same dependency) 29 | - Quick wins (low complexity, high impact) 30 | 31 | **Predictive Analytics:** 32 | - Completion projections based on velocity 33 | - Risk of missing deadlines 34 | - Recommended task order for optimal flow 35 | 36 | ### 4. **Visual Intelligence** 37 | 38 | Dynamic visualization based on data: 39 | ``` 40 | Sprint Progress: ████████░░ 80% (16/20 tasks) 41 | Velocity Trend: ↗️ +15% this week 42 | Blocked Tasks: 🔴 3 critical path items 43 | 44 | Priority Distribution: 45 | High: ████████ 8 tasks (2 blocked) 46 | Medium: ████░░░░ 4 tasks 47 | Low: ██░░░░░░ 2 tasks 48 | ``` 49 | 50 | ### 5. **Actionable Recommendations** 51 | 52 | Based on analysis: 53 | 1. **Immediate actions** (unblock critical path) 54 | 2. **Today's focus** (optimal task sequence) 55 | 3. **Process improvements** (recurring patterns) 56 | 4. **Resource needs** (skills, time, dependencies) 57 | 58 | ### 6. **Historical Context** 59 | 60 | Compare to previous periods: 61 | - Velocity changes 62 | - Pattern recognition 63 | - Improvement areas 64 | - Success patterns to repeat -------------------------------------------------------------------------------- /Macros/Options/Sources/Options/MappedValueRepresentableError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MappedValueRepresentableError.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | // swiftlint:disable file_types_order 33 | #if swift(>=5.10) 34 | /// An Error thrown when the `MappedType` value or `RawType` value 35 | /// are invalid for an `Enum`. 36 | public enum MappedValueRepresentableError: Error, Sendable { 37 | /// Whenever a value or key cannot be found. 38 | case valueNotFound 39 | } 40 | #else 41 | /// An Error thrown when the `MappedType` value or `RawType` value 42 | /// are invalid for an `Enum`. 43 | public enum MappedValueRepresentableError: Error { 44 | case valueNotFound 45 | } 46 | #endif 47 | // swiftlint:enable file_types_order 48 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Parser/Token.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Token.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | internal struct Token: Codable, Equatable { 33 | internal let kind: String 34 | internal var leadingTrivia: String 35 | internal var trailingTrivia: String 36 | 37 | internal init(kind: String, leadingTrivia: String, trailingTrivia: String) { 38 | self.kind = kind.escapeHTML() 39 | self.leadingTrivia = leadingTrivia 40 | self.trailingTrivia = trailingTrivia 41 | } 42 | } 43 | 44 | extension Token: CustomStringConvertible { 45 | internal var description: String { 46 | """ 47 | { 48 | kind: \(kind) 49 | leadingTrivia: \(leadingTrivia) 50 | trailingTrivia: \(trailingTrivia) 51 | } 52 | """ 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Macros/Options/Sources/OptionsMacros/Extensions/DictionaryElementSyntax.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DictionaryElementSyntax.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import SwiftSyntax 31 | 32 | 33 | #if !canImport(SyntaxKit) 34 | extension DictionaryElementSyntax { 35 | internal init(pair: (key: Int, value: String)) { 36 | self.init(key: pair.key, value: pair.value) 37 | } 38 | 39 | internal init(key: Int, value: String) { 40 | self.init( 41 | key: IntegerLiteralExprSyntax(integerLiteral: key), 42 | value: StringLiteralExprSyntax( 43 | openingQuote: .stringQuoteToken(), 44 | segments: .init([.stringSegment(.init(content: .stringSegment(value)))]), 45 | closingQuote: .stringQuoteToken() 46 | ) 47 | ) 48 | } 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Core/AccessModifier.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccessModifier.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | /// Represents Swift access modifiers. 33 | public enum AccessModifier: CaseIterable, Sendable, Equatable { 34 | case `public` 35 | case `private` 36 | case `internal` 37 | case `fileprivate` 38 | case `open` 39 | 40 | /// Returns the corresponding SwiftSyntax Keyword for this access modifier. 41 | public var keyword: Keyword { 42 | switch self { 43 | case .public: 44 | return .public 45 | case .private: 46 | return .private 47 | case .internal: 48 | return .internal 49 | case .fileprivate: 50 | return .fileprivate 51 | case .open: 52 | return .open 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Parser/StructureProperty.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StructureProperty.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | internal struct StructureProperty: Codable, Equatable { 33 | internal let name: String 34 | internal let value: StructureValue? 35 | internal let ref: String? 36 | 37 | internal init(name: String, value: StructureValue? = nil, ref: String? = nil) { 38 | self.name = name.escapeHTML() 39 | self.value = value 40 | self.ref = ref?.escapeHTML() 41 | } 42 | } 43 | 44 | extension StructureProperty: CustomStringConvertible { 45 | internal var description: String { 46 | """ 47 | { 48 | name: \(name) 49 | value: \(String(describing: value)) 50 | ref: \(String(describing: ref)) 51 | } 52 | """ 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Macros/Options/Sources/Options/CodingOptions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodingOptions.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// Options for how a ``MappedValueRepresentable`` type is encoding and decoded. 33 | public struct CodingOptions: OptionSet, Sendable { 34 | /// Allow decoding from String 35 | public static let allowMappedValueDecoding: CodingOptions = .init(rawValue: 1) 36 | 37 | /// Encode the value as a String. 38 | public static let encodeAsMappedValue: CodingOptions = .init(rawValue: 2) 39 | 40 | /// Default options. 41 | public static let `default`: CodingOptions = 42 | [.allowMappedValueDecoding, encodeAsMappedValue] 43 | 44 | public let rawValue: Int 45 | 46 | public init(rawValue: Int) { 47 | self.rawValue = rawValue 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sources/skit/main.swift: -------------------------------------------------------------------------------- 1 | // 2 | // main.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | import SyntaxKit 32 | 33 | // Read Swift code from stdin 34 | internal let code = 35 | String(data: FileHandle.standardInput.readDataToEndOfFile(), encoding: .utf8) ?? "" 36 | 37 | do { 38 | // Parse the code using SyntaxKit 39 | let response = try SyntaxParser.parse(code: code, options: ["fold"]) 40 | 41 | // Output the JSON to stdout 42 | print(response.syntaxJSON) 43 | } catch { 44 | // If there's an error, output it as JSON 45 | let errorResponse = ["error": error.localizedDescription] 46 | if let jsonData = try? JSONSerialization.data(withJSONObject: errorResponse), 47 | let jsonString = String(data: jsonData, encoding: .utf8) 48 | { 49 | print(jsonString) 50 | } 51 | exit(1) 52 | } 53 | -------------------------------------------------------------------------------- /.claude/commands/tm/next/next-task.md: -------------------------------------------------------------------------------- 1 | Intelligently determine and prepare the next action based on comprehensive context. 2 | 3 | This enhanced version of 'next' considers: 4 | - Current task states 5 | - Recent activity 6 | - Time constraints 7 | - Dependencies 8 | - Your working patterns 9 | 10 | Arguments: $ARGUMENTS 11 | 12 | ## Intelligent Next Action 13 | 14 | ### 1. **Context Gathering** 15 | Let me analyze the current situation: 16 | - Active tasks (in-progress) 17 | - Recently completed tasks 18 | - Blocked tasks 19 | - Time since last activity 20 | - Arguments provided: $ARGUMENTS 21 | 22 | ### 2. **Smart Decision Tree** 23 | 24 | **If you have an in-progress task:** 25 | - Has it been idle > 2 hours? → Suggest resuming or switching 26 | - Near completion? → Show remaining steps 27 | - Blocked? → Find alternative task 28 | 29 | **If no in-progress tasks:** 30 | - Unblocked high-priority tasks? → Start highest 31 | - Complex tasks need breakdown? → Suggest expansion 32 | - All tasks blocked? → Show dependency resolution 33 | 34 | **Special arguments handling:** 35 | - "quick" → Find task < 2 hours 36 | - "easy" → Find low complexity task 37 | - "important" → Find high priority regardless of complexity 38 | - "continue" → Resume last worked task 39 | 40 | ### 3. **Preparation Workflow** 41 | 42 | Based on selected task: 43 | 1. Show full context and history 44 | 2. Set up development environment 45 | 3. Run relevant tests 46 | 4. Open related files 47 | 5. Show similar completed tasks 48 | 6. Estimate completion time 49 | 50 | ### 4. **Alternative Suggestions** 51 | 52 | Always provide options: 53 | - Primary recommendation 54 | - Quick alternative (< 1 hour) 55 | - Strategic option (unblocks most tasks) 56 | - Learning option (new technology/skill) 57 | 58 | ### 5. **Workflow Integration** 59 | 60 | Seamlessly connect to: 61 | - `/project:task-master:start [selected]` 62 | - `/project:workflows:auto-implement` 63 | - `/project:task-master:expand` (if complex) 64 | - `/project:utils:complexity-report` (if unsure) 65 | 66 | The goal: Zero friction from decision to implementation. -------------------------------------------------------------------------------- /Sources/SyntaxKit/Attributes/Trivia+Comments.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Trivia+Comments.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | extension Trivia { 33 | /// Extracts comment strings from the trivia collection. 34 | /// 35 | /// This includes line comments, documentation comments, and block comments. 36 | public var comments: [String] { 37 | compactMap { piece in 38 | switch piece { 39 | case .lineComment(let text), 40 | .blockComment(let text), 41 | .docLineComment(let text), 42 | .docBlockComment(let text): 43 | return text 44 | default: 45 | return nil 46 | } 47 | } 48 | } 49 | 50 | /// A Boolean value that indicates whether the trivia contains any comments. 51 | public var hasComments: Bool { 52 | !comments.isEmpty 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Utilities/Break.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Break.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | public import SwiftSyntax 31 | 32 | /// A `break` statement. 33 | public struct Break: CodeBlock { 34 | private let label: String? 35 | 36 | public var syntax: any SyntaxProtocol { 37 | let breakStmt = BreakStmtSyntax( 38 | breakKeyword: .keyword(.break, trailingTrivia: .newline) 39 | ) 40 | 41 | if let label = label { 42 | return StmtSyntax( 43 | breakStmt.with( 44 | \.label, 45 | .identifier(label) 46 | ) 47 | ) 48 | } else { 49 | return StmtSyntax(breakStmt) 50 | } 51 | } 52 | 53 | /// Creates a `break` statement. 54 | /// - Parameter label: An optional label to break from a specific loop or switch. 55 | public init(_ label: String? = nil) { 56 | self.label = label 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Macros/Options/Tests/OptionsTests/Mocks/MockDictionaryEnum.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockDictionaryEnum.swift 3 | // SimulatorServices 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2024 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Options 31 | 32 | #if swift(>=5.10) 33 | // swiftlint:disable identifier_name 34 | @Options 35 | internal enum MockDictionaryEnum: Int, Sendable { 36 | case a = 2 37 | case b = 5 38 | case c = 6 39 | case d = 12 40 | } 41 | #else 42 | // swiftlint:disable identifier_name 43 | internal enum MockDictionaryEnum: Int, MappedValueDictionaryRepresented, Codable { 44 | case a = 2 45 | case b = 5 46 | case c = 6 47 | case d = 12 48 | internal typealias MappedType = String 49 | internal static var mappedValues = [ 50 | 2: "a", 51 | 5: "b", 52 | 6: "c", 53 | 12: "d" 54 | ] 55 | } 56 | 57 | typealias MockDictionaryEnumSet = EnumSet 58 | #endif 59 | -------------------------------------------------------------------------------- /Sources/DocumentationHarness/CodeBlockValidationParameters.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeBlockValidationParameters.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | /// Parameters for validating code blocks with additional metadata 33 | internal struct CodeBlockValidationParameters: ValidationParameters, Sendable { 34 | internal let codeBlock: CodeBlock 35 | internal let fileURL: URL 36 | internal let blockIndex: Int 37 | 38 | // MARK: - ValidationParameters conformance 39 | internal var code: String { 40 | codeBlock.code 41 | } 42 | 43 | internal var lineNumber: Int { 44 | codeBlock.lineNumber 45 | } 46 | } 47 | 48 | extension URL { 49 | internal func codeBlock(_ codeBlock: CodeBlock, at blockIndex: Int) 50 | -> CodeBlockValidationParameters 51 | { 52 | .init(codeBlock: codeBlock, fileURL: self, blockIndex: blockIndex) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Sources/SyntaxKit/Expressions/Literal+Convenience.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Literal+Convenience.swift 3 | // SyntaxKit 4 | // 5 | // Created by Leo Dion. 6 | // Copyright © 2025 BrightDigit. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the “Software”), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | import Foundation 31 | 32 | // MARK: - Convenience Methods 33 | 34 | extension Literal { 35 | /// Converts a Literal.tuple to a TupleLiteral for use in Variable declarations. 36 | public var asTupleLiteral: (any CodeBlockableLiteral)? { 37 | switch self { 38 | case .tuple(let elements): 39 | return TupleLiteralArray(elements) 40 | default: 41 | return nil 42 | } 43 | } 44 | 45 | /// Creates a tuple literal from an array of optional literals (for patterns with wildcards). 46 | public static func tuplePattern(_ elements: [Literal?]) -> Literal { 47 | .tuple(elements) 48 | } 49 | 50 | /// Creates an integer literal. 51 | public static func int(_ value: Int) -> Literal { 52 | .integer(value) 53 | } 54 | } 55 | --------------------------------------------------------------------------------