with one click
build-swift-package
// Build or refactor a Swift package API on top of SwiftASB without leaking raw app-server wire models, while keeping live Codex probes opt-in, isolated, timeout-bounded, and documented.
// Build or refactor a Swift package API on top of SwiftASB without leaking raw app-server wire models, while keeping live Codex probes opt-in, isolated, timeout-bounded, and documented.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | build-swift-package |
| description | Build or refactor a Swift package API on top of SwiftASB without leaking raw app-server wire models, while keeping live Codex probes opt-in, isolated, timeout-bounded, and documented. |
| license | Apache-2.0 |
| compatibility | Designed for Codex and compatible Agent Skills clients working with SwiftASB v1.3.1 or newer, Swift 6, SwiftPM, package libraries, command-line tools, and local Codex app-server integrations. |
| metadata | {"owner":"gaelic-ghost","repo":"socket","package":"SwiftASB","category":"swiftasb-package"} |
| allowed-tools | Read Bash(rg:*) Bash(git:*) Bash(swift:*) |
Help a Swift package use SwiftASB internally while exposing the package's own small, Swift-native API to its callers.
The real job is to keep the package's public surface understandable. SwiftASB can own Codex runtime startup, app-wide library state, stable worktree groups, repository/worktree filters, selected-worktree Git status, project identity and thread-source facts, app-server-owned worktree snapshots, app-server-routed filesystem/config/extension/MCP-resource reads, workspace permission facts, feature policy, feature-operation events, typed threads, turns, events, diagnostics, query descriptors, and local history inside the implementation, but the package author should decide deliberately whether consumers see SwiftASB handles directly or a narrower domain-specific API.
Before implementing or proposing package structure, read the relevant SwiftPM and Swift documentation through Apple Dev Skills, Swift.org, or official Apple docs.
Minimum rules to rely on:
Package.swift manifest at the package root.Package defines package name, products, targets, dependencies, platforms, resources, and Swift language mode.Authoritative docs:
swiftasb:choose-integration-shape selects a package library, command-line package, helper package, or test harness shape.Verify current SwiftASB docs and public API before editing:
README.mdSources/SwiftASB/SwiftASB.docc/GettingStartedWithSwiftASB.mdSources/SwiftASB/SwiftASB.docc/HandlingTurnProgressAndApprovals.mdSources/SwiftASB/SwiftASB.docc/ReadingDiagnosticsAndHistory.mdSources/SwiftASB/SwiftASB.docc/ThreadHistoryAndObservables.mdSources/SwiftASB/SwiftASB.docc/CodexFS.mdSources/SwiftASB/SwiftASB.docc/CodexConfig.mdSources/SwiftASB/SwiftASB.docc/CodexExtensions.mdSources/SwiftASB/SwiftASB.docc/CodexWorkspace.mdSources/SwiftASB/SwiftASB.docc/FeaturePermissionPolicy.mdSources/SwiftASB/SwiftASB.docc/ThreadManagement.mdSources/SwiftASB/Public/CodexAppServer+Library.swiftSources/SwiftASB/Public/CodexAppServer+LoadedThreads.swiftSources/SwiftASB/Public/CodexAppServer+CodexExtensions.swiftSources/SwiftASB/Public/CodexAppServer+MCP.swiftSources/SwiftASB/Public/CodexFS.swiftSources/SwiftASB/Public/CodexConfig.swiftSources/SwiftASB/Public/CodexWorkspace.swiftSources/SwiftASB/Public/CodexAppServer+Bootstrap.swiftSources/SwiftASB/Public/CodexAppServer.swiftSources/SwiftASB/Public/CodexDiagnostics.swiftSources/SwiftASB/Public/CodexErrors.swiftSources/SwiftASB/Public/CodexThread.swiftSources/SwiftASB/Public/CodexTurnHandle.swiftAs of SwiftASB v1.3.1, package integrations should prefer:
CodexAppServer.start(_:) with CodexAppServer.StartupRequest for normal one-call subprocess startup, compatibility validation, initialization, and typed CodexAppServerStartupError failuresCodexAppServer.start(), cliExecutableDiagnostics(), and initialize(_:) only when the package intentionally owns custom diagnostics, compatibility policy, or test setup before initializationCodexAppServer for subprocess ownership, diagnostics, stored-thread operations, MCP resource reads, model capability reads, MCP status reads, feature-operation-event streams, and hook diagnosticsCodexAppServer.makeLibrary(configuration:) when the package intentionally exposes app-wide stored-thread lists, cwd or repository grouping, stable worktree groups, repository/worktree filters, selected worktree or repository context, selected-worktree Git status, library-local selection, CodexWorkspace.ProjectInfo project identity, CodexAppServer.ThreadSource source facts, or app-wide model/MCP/hook snapshots that refresh when app-server app/skill/MCP state changesCodexAppServer.fs, CodexAppServer.config, and CodexAppServer.extensions when the package intentionally exposes app-server-owned filesystem, config, app, skill, plugin, collaboration-mode facts, plugin detail reads, or already-configured marketplace upgradesCodexAppServer.readMcpResource(_:) when the package intentionally exposes app-wide or thread-scoped MCP resource contentsSwiftASBFeaturePolicy and CodexAppServer.featureOperationEvents() when the package intentionally exposes SwiftASB-owned authority choices or mutation-operation recordsCodexWorkspace when consumers need session cwd, app-server-owned worktree snapshots, project identity, Git repository facts, selected Git status snapshots, active permission profile, or runtime filesystem/network permission factsCodexThread for conversation-scoped turn creation, archive/unarchive, thread actions, thread goals, request responses, and local historyCodexTurnHandle for one active turn, including events, steering, interruption, request responses, and completion handoffhttps://github.com/gaelic-ghost/SwiftASB1.3.1 when using one-call startup with typed startup errors, app-wide library, stable worktree groups, repository/worktree filters, selected-worktree Git status, feature policy, feature-operation events, extension marketplace maintenance, project identity, thread source, filesystem match metadata, MCP resource reads, config warnings, extension inventory, workspace, query-descriptor, thread archive/unarchive, or recent-activity guidance; otherwise verify the support window in SwiftASB's READMESwiftASBswift build and swift test, plus any repo-documented checks.Prefer a narrow package-owned facade when the package is not primarily a SwiftASB wrapper:
import SwiftASB
public struct WorkspaceSummaryRequest: Sendable {
public var workspacePath: String
public var prompt: String
public init(workspacePath: String, prompt: String) {
self.workspacePath = workspacePath
self.prompt = prompt
}
}
public struct WorkspaceSummary: Sendable {
public var text: String
}
public actor WorkspaceSummarizer {
private let appServer: CodexAppServer
public init() {
self.appServer = CodexAppServer()
}
public func shutdown() async {
await appServer.stop()
}
public func summarize(_ request: WorkspaceSummaryRequest) async throws -> WorkspaceSummary {
_ = try await appServer.start(
.init(
clientInfo: .init(
name: "WorkspaceSummarizer",
title: "Workspace Summarizer",
version: "1.0.0"
)
)
)
let thread = try await appServer.startThread(
.init(currentDirectoryPath: request.workspacePath)
)
let turn = try await thread.startTextTurn(request.prompt)
for try await event in turn.events {
if case .completed = event {
_ = try await turn.complete()
return WorkspaceSummary(text: "Summary completed.")
}
}
throw WorkspaceSummaryError.turnEndedWithoutCompletion
}
}
public enum WorkspaceSummaryError: Error, Sendable {
case turnEndedWithoutCompletion
}
Use this as a shape, not as a file to paste blindly. Most packages should return their own real result data, stream their own progress values, and map SwiftASB failures into errors their consumers can understand.
CodexAppServer, CodexThread, or CodexTurnHandle only when the package is intentionally a thin SwiftASB extension surface.CodexWire... models out of public API unless the user explicitly asks for protocol-level work.CodexAppServer.fs, CodexAppServer.config, CodexAppServer.extensions, CodexAppServer.readMcpResource(_:), CodexWorkspace, and SwiftASBFeaturePolicy over direct local reads when the package needs facts owned by the Codex app-server, including worktree snapshots, selected Git status, project identity, repository facts, extension inventory, marketplace maintenance, and feature-category choices.CodexThread.CodexTurnHandle silently when the package promises cancellation behavior.swift test deterministic and free of live Codex subprocess requirements.SWIFTASB_LIVE_TESTS=1.Run the repository's documented validation path. For plain Swift packages, the baseline is:
swift build
swift test
If the package is also an Xcode app workspace, use the repository's documented Xcode workflow instead of assuming SwiftPM is sufficient.
swiftasb:explain-swiftasb when the user needs adoption tradeoffs before implementation.swiftasb:choose-integration-shape when ownership or public API shape is unclear.swiftasb:diagnose-integration when startup, turn, approval, MCP, diagnostics, or history behavior fails.apple-dev-skills:sync-swift-package-guidance when the package repo's AGENTS.md or maintainer workflow needs alignment./Users/..., ~/..., or ../SwiftASB into public package manifests.CodexAppServerStartupError cases when mapping errors into package-owned error types.