newtype-cli 0.0.4 → 0.0.5

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/package.json +12 -12
  2. package/postinstall.mjs +36 -8
package/package.json CHANGED
@@ -6,19 +6,19 @@
6
6
  "scripts": {
7
7
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
8
8
  },
9
- "version": "0.0.4",
9
+ "version": "0.0.5",
10
10
  "license": "MIT",
11
11
  "optionalDependencies": {
12
- "newtype-cli-linux-x64": "0.0.4",
13
- "newtype-cli-linux-arm64-musl": "0.0.4",
14
- "newtype-cli-darwin-x64-baseline": "0.0.4",
15
- "newtype-cli-linux-x64-baseline": "0.0.4",
16
- "newtype-cli-windows-x64-baseline": "0.0.4",
17
- "newtype-cli-linux-arm64": "0.0.4",
18
- "newtype-cli-linux-x64-baseline-musl": "0.0.4",
19
- "newtype-cli-windows-x64": "0.0.4",
20
- "newtype-cli-linux-x64-musl": "0.0.4",
21
- "newtype-cli-darwin-x64": "0.0.4",
22
- "newtype-cli-darwin-arm64": "0.0.4"
12
+ "newtype-cli-darwin-x64-baseline": "0.0.5",
13
+ "newtype-cli-darwin-x64": "0.0.5",
14
+ "newtype-cli-linux-x64-baseline-musl": "0.0.5",
15
+ "newtype-cli-linux-arm64": "0.0.5",
16
+ "newtype-cli-linux-x64-musl": "0.0.5",
17
+ "newtype-cli-windows-x64-baseline": "0.0.5",
18
+ "newtype-cli-darwin-arm64": "0.0.5",
19
+ "newtype-cli-windows-x64": "0.0.5",
20
+ "newtype-cli-linux-x64": "0.0.5",
21
+ "newtype-cli-linux-x64-baseline": "0.0.5",
22
+ "newtype-cli-linux-arm64-musl": "0.0.5"
23
23
  }
24
24
  }
package/postinstall.mjs CHANGED
@@ -101,22 +101,50 @@ async function main() {
101
101
  try {
102
102
  if (os.platform() === "win32") {
103
103
  // On Windows, the .exe is already included in the package and bin field points to it
104
- // No postinstall setup needed
104
+ // No binary postinstall setup needed — config creation still runs below
105
105
  console.log("Windows detected: binary setup not needed (using packaged .exe)")
106
- return
106
+ } else {
107
+ // On non-Windows platforms, just verify the binary package exists
108
+ // Don't replace the wrapper script - it handles binary execution
109
+ const { binaryPath } = findBinary()
110
+ console.log(`Platform binary verified at: ${binaryPath}`)
111
+ console.log("Wrapper script will handle binary execution")
107
112
  }
108
-
109
- // On non-Windows platforms, just verify the binary package exists
110
- // Don't replace the wrapper script - it handles binary execution
111
- const { binaryPath } = findBinary()
112
- console.log(`Platform binary verified at: ${binaryPath}`)
113
- console.log("Wrapper script will handle binary execution")
114
113
  } catch (error) {
115
114
  console.error("Failed to setup newtype binary:", error.message)
116
115
  console.error("This is not fatal - the wrapper script will attempt to find the binary at runtime.")
117
116
  // Don't exit(1) - postinstall failure should not block installation
118
117
  // The bin/newtype wrapper script handles binary resolution at runtime
119
118
  }
119
+
120
+ // Auto-create default config if it doesn't exist
121
+ try {
122
+ const configDir = path.join(os.homedir(), ".config", "newtype")
123
+ const configFile = path.join(configDir, "newtype-profile.json")
124
+
125
+ if (!fs.existsSync(configFile)) {
126
+ if (!fs.existsSync(configDir)) {
127
+ fs.mkdirSync(configDir, { recursive: true })
128
+ }
129
+
130
+ const defaultConfig = {
131
+ agents: {
132
+ chief: { model: "opencode/glm-4.7-free" },
133
+ researcher: { model: "opencode/glm-4.7-free" },
134
+ archivist: { model: "opencode/glm-4.7-free" },
135
+ writer: { model: "opencode/glm-4.7-free" },
136
+ },
137
+ }
138
+
139
+ fs.writeFileSync(configFile, JSON.stringify(defaultConfig, null, 2) + "\n")
140
+ console.log(`Default config created at: ${configFile}`)
141
+ } else {
142
+ console.log(`Config already exists at: ${configFile}`)
143
+ }
144
+ } catch (error) {
145
+ console.error("Failed to create default config:", error.message)
146
+ // Non-fatal - user can create config manually
147
+ }
120
148
  }
121
149
 
122
150
  main().catch((error) => {