- Store source files as named CustomInstrumentFile rows per def - Render sidebar with disclosure groups - Drive editor via Monaco project models with activePath - Validate Add/Rename/Delete dialogs and submit on Enter - Fork installed hook packs into editable custom instruments - Reload instances on def change; clear stale compat reasons live - Focus editor on selection (native + Monaco)
33 lines
885 B
Swift
33 lines
885 B
Swift
import Foundation
|
|
|
|
public struct HookPack: Sendable {
|
|
public let id: String
|
|
public let manifest: HookPackManifest
|
|
public let folderURL: URL
|
|
|
|
public init(id: String, manifest: HookPackManifest, folderURL: URL) {
|
|
self.id = id
|
|
self.manifest = manifest
|
|
self.folderURL = folderURL
|
|
}
|
|
|
|
public var entrypointURL: URL {
|
|
folderURL.appendingPathComponent(manifest.entrypoint)
|
|
}
|
|
|
|
public var resolvedIcon: InstrumentIcon {
|
|
switch manifest.icon {
|
|
case nil:
|
|
return .symbolic("puzzle")
|
|
case .symbolic(let name):
|
|
return .symbolic(name)
|
|
case .file(let path):
|
|
let url = folderURL.appendingPathComponent(path)
|
|
if let data = try? Data(contentsOf: url) {
|
|
return .pixels(data)
|
|
}
|
|
return .symbolic("puzzle")
|
|
}
|
|
}
|
|
}
|