drafted 1.11.8 → 1.11.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/install-mcp.sh +28 -12
  2. package/package.json +1 -1
package/install-mcp.sh CHANGED
@@ -827,19 +827,35 @@ struct Actions {
827
827
  alert.runModal()
828
828
  }
829
829
 
830
- // Installed version via the CLI, run through a login shell so the npm-global
831
- // bin is on PATH (the same shell the manual update uses).
830
+ // Installed version, resolved WITHOUT depending on the login-shell PATH
831
+ // the installer's npm prefix (~/.drafted/npm-global) is never written to any
832
+ // login profile, so `bash -lc "drafted"` finds nothing. Read the installed
833
+ // package.json at the fixed prefix first (the source npm itself writes), then
834
+ // fall back to the absolute binary, then a login shell (custom prefixes on PATH).
832
835
  static func installedVersion() -> String? {
833
- let process = Process()
834
- process.executableURL = URL(fileURLWithPath: "/bin/bash")
835
- process.arguments = ["-lc", "drafted --version 2>/dev/null"]
836
- let pipe = Pipe()
837
- process.standardOutput = pipe
838
- process.standardError = FileHandle.nullDevice
839
- do { try process.run(); process.waitUntilExit() } catch { return nil }
840
- let data = pipe.fileHandleForReading.readDataToEndOfFile()
841
- guard let out = String(data: data, encoding: .utf8) else { return nil }
842
- return firstSemver(in: out)
836
+ let pkg = home.appendingPathComponent(".drafted/npm-global/lib/node_modules/drafted/package.json")
837
+ if
838
+ let data = try? Data(contentsOf: pkg),
839
+ let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
840
+ let version = json["version"] as? String,
841
+ isSemver(version)
842
+ { return version }
843
+
844
+ let bin = home.appendingPathComponent(".drafted/npm-global/bin/drafted").path
845
+ for command in ["\"\(bin)\" --version 2>/dev/null", "drafted --version 2>/dev/null"] {
846
+ let process = Process()
847
+ process.executableURL = URL(fileURLWithPath: "/bin/bash")
848
+ process.arguments = ["-lc", command]
849
+ let pipe = Pipe()
850
+ process.standardOutput = pipe
851
+ process.standardError = FileHandle.nullDevice
852
+ do { try process.run(); process.waitUntilExit() } catch { continue }
853
+ let data = pipe.fileHandleForReading.readDataToEndOfFile()
854
+ if let out = String(data: data, encoding: .utf8), let version = firstSemver(in: out) {
855
+ return version
856
+ }
857
+ }
858
+ return nil
843
859
  }
844
860
 
845
861
  static func latestVersion(_ completion: @escaping (String?) -> Void) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.11.8",
3
+ "version": "1.11.9",
4
4
  "description": "Drafted — visual thinking surface for humans and AI agents. Renders HTML, markdown, images, and code as frames on a zoomable canvas, with MCP tools for AI agents and real-time sync for humans.",
5
5
  "type": "module",
6
6
  "files": [