From 4e0516ab7e96a9592f96144d4570abb7cd404862 Mon Sep 17 00:00:00 2001 From: hyxx-su Date: Sat, 21 Nov 2026 09:32:09 +0900 Subject: [PATCH 1/2] fix(cli): use the pack output directory in the suggested release command --- NectoMac/Sources/necto-cli/NectoCLI.swift | 5 ++++- NectoMac/Sources/necto-cli/PluginHelp.swift | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/NectoMac/Sources/necto-cli/NectoCLI.swift b/NectoMac/Sources/necto-cli/NectoCLI.swift index ec07294..08e3128 100644 --- a/NectoMac/Sources/necto-cli/NectoCLI.swift +++ b/NectoMac/Sources/necto-cli/NectoCLI.swift @@ -353,9 +353,12 @@ struct Pack: AsyncParsableCommand { // The next step is only news to someone doing this by hand. A script that // packages several plugins is going to publish them together. if !quiet { + let assets = [archivePath, manifestPath].map { file in + shellArgument(output == nil ? "./\(file.lastPathComponent)" : file.path) + }.joined(separator: " ") print("") print("Next:") - print(" gh release create \(archivePath.lastPathComponent) \(manifestPath.lastPathComponent)") + print(" gh release create \(assets)") } } diff --git a/NectoMac/Sources/necto-cli/PluginHelp.swift b/NectoMac/Sources/necto-cli/PluginHelp.swift index 36362bf..f87d547 100644 --- a/NectoMac/Sources/necto-cli/PluginHelp.swift +++ b/NectoMac/Sources/necto-cli/PluginHelp.swift @@ -118,10 +118,6 @@ enum PluginHelp { return displayText(lines.joined(separator: "\n")) } - private static func shellArgument(_ value: String) -> String { - "'" + value.replacingOccurrences(of: "'", with: "'\"'\"'") + "'" - } - static func schemaLines(_ schema: NectoJSONValue, name: String? = nil, required: Bool = false, depth: Int = 0) -> [String] { let indent = String(repeating: " ", count: depth + 1) guard depth < 12 else { return [indent + "… See --json for the complete schema."] } @@ -143,6 +139,10 @@ enum PluginHelp { } } +func shellArgument(_ value: String) -> String { + "'" + value.replacingOccurrences(of: "'", with: "'\"'\"'") + "'" +} + func displayText(_ text: String) -> String { String(text.unicodeScalars.filter { !CharacterSet.controlCharacters.contains($0) || $0 == "\n" || $0 == "\t" }) } From a65e8caafccafacc94e15c00b9d5856234198980 Mon Sep 17 00:00:00 2001 From: hyxx-su Date: Sat, 21 Nov 2026 09:33:48 +0900 Subject: [PATCH 2/2] test(cli): check both paths in the pack release command --- .../NectoCLITests/NectoCLIBlackBoxTests.swift | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/NectoMac/Tests/NectoCLITests/NectoCLIBlackBoxTests.swift b/NectoMac/Tests/NectoCLITests/NectoCLIBlackBoxTests.swift index e6b0de6..34463f1 100644 --- a/NectoMac/Tests/NectoCLITests/NectoCLIBlackBoxTests.swift +++ b/NectoMac/Tests/NectoCLITests/NectoCLIBlackBoxTests.swift @@ -212,6 +212,34 @@ struct NectoCLIBlackBoxTests { #expect(result.status == 130) } + @Test("pack's release command names both files in the selected output directory") + func packReleasePaths() async throws { + let fixture = try CLIProcessFixture() + defer { fixture.close() } + let panel = fixture.directory.appending(path: "dist") + try FileManager.default.createDirectory(at: panel, withIntermediateDirectories: true) + let manifest = NectoPluginManifest( + id: "sample", name: "Sample", description: "Sample panel", version: "1.0.0", + author: "Necto", icon: .init(systemName: "terminal"), assets: ["index.html"], + allowedOrigins: ["self"], operations: [] + ) + try JSONEncoder().encode(manifest).write(to: panel.appending(path: "manifest.json")) + try Data("".utf8).write(to: panel.appending(path: "index.html")) + + let output = fixture.directory.appending(path: "Author's releases") + let result = try await fixture.run(["plugin", "pack", panel.path, "--output", output.path]) + try #require(result.status == 0, "\(result.error)") + let command = try #require(result.output.split(separator: "\n").last).trimmingCharacters(in: .whitespaces) + let prefix = "gh release create " + try #require(command.hasPrefix(prefix)) + let parsed = try await fixture.run(["-c", "printf '%s\\n' " + command.dropFirst(prefix.count)], + executable: URL(filePath: "/bin/sh")) + let files = ["sample-1.0.0.zip", "sample-1.0.0.manifest.json"].map { output.appending(path: $0).path } + #expect(parsed.status == 0) + #expect(parsed.output.split(separator: "\n").map(String.init) == files) + #expect(files.allSatisfy { FileManager.default.fileExists(atPath: $0) }) + } + @Test("skills install for both agents without Necto and protect user edits") func skillInstallation() async throws { let fixture = try CLIProcessFixture()