Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions Sources/AiSTKit/AnalyzerConfiguration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// AnalyzerConfiguration.swift
// SyntaxKit
//
// Created by Leo Dion.
// Copyright © 2026 BrightDigit.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//

/// Configuration for the SyntaxKit analyzer, assembled by the `skit analyze`
/// subcommand from parsed command-line arguments and handed to
/// `SyntaxKitAnalyzer`.
public struct AnalyzerConfiguration: Sendable {
/// Folder containing `dsl.swift` and `expected.swift`.
public let inputFolderPath: String
/// Path to the existing SyntaxKit library sources.
public let syntaxKitPath: String
/// Where to write the updated library.
public let outputFolderPath: String
/// Claude API key.
public let apiKey: String
/// Claude model identifier.
public let model: String
/// Enables verbose progress output.
public let verbose: Bool

/// Creates an analyzer configuration.
///
/// - Parameters:
/// - inputFolderPath: Folder containing `dsl.swift` and `expected.swift`.
/// - syntaxKitPath: Path to the existing SyntaxKit library sources.
/// - outputFolderPath: Where to write the updated library.
/// - apiKey: Claude API key.
/// - model: Claude model identifier.
/// - verbose: Enables verbose progress output.
public init(
inputFolderPath: String,
syntaxKitPath: String,
outputFolderPath: String,
apiKey: String,
model: String,
verbose: Bool
) {
self.inputFolderPath = inputFolderPath
self.syntaxKitPath = syntaxKitPath
self.outputFolderPath = outputFolderPath
self.apiKey = apiKey
self.model = model
self.verbose = verbose
}
}
49 changes: 49 additions & 0 deletions Sources/AiSTKit/AnalyzerError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// AnalyzerError.swift
// SyntaxKit
//
// Created by Leo Dion.
// Copyright © 2026 BrightDigit.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//

/// Errors thrown by the `skit analyze` pipeline. Each case carries a
/// human-readable message; the subcommand decides how to present it.
public enum AnalyzerError: Error {
/// Required command-line arguments were not provided.
case missingRequiredArguments(String)
/// No API key was provided via flag or the `ANTHROPIC_API_KEY`
/// environment variable.
case missingAPIKey(String)
/// The input or SyntaxKit path does not exist.
case invalidPath(String)
/// A required input file (`dsl.swift`, `expected.swift`) was not found
/// in the input folder.
case missingInputFile(String)
/// Generating the AST from the input sources failed.
case astGenerationError(String)
/// The Claude API call failed (network, authentication, rate limit, …).
case apiError(String)
/// Parsing the generated code out of Claude's response failed.
case codeGenerationError(String)
}
Loading