@nipurn/xprompt-new 1.1.31 → 1.1.32
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.
Potentially problematic release.
This version of @nipurn/xprompt-new might be problematic. Click here for more details.
- package/package.json +12 -12
- package/postinstall.mjs +89 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nipurn/xprompt-new",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.32",
|
|
4
4
|
"bin": {
|
|
5
5
|
"100xprompt": "./bin/100xprompt.js"
|
|
6
6
|
},
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
9
9
|
},
|
|
10
10
|
"optionalDependencies": {
|
|
11
|
-
"nipurn-xprompt-new-linux-arm64": "1.1.
|
|
12
|
-
"nipurn-xprompt-new-linux-x64": "1.1.
|
|
13
|
-
"nipurn-xprompt-new-linux-x64-baseline": "1.1.
|
|
14
|
-
"nipurn-xprompt-new-linux-arm64-musl": "1.1.
|
|
15
|
-
"nipurn-xprompt-new-linux-x64-musl": "1.1.
|
|
16
|
-
"nipurn-xprompt-new-linux-x64-baseline-musl": "1.1.
|
|
17
|
-
"nipurn-xprompt-new-darwin-arm64": "1.1.
|
|
18
|
-
"nipurn-xprompt-new-darwin-x64": "1.1.
|
|
19
|
-
"nipurn-xprompt-new-darwin-x64-baseline": "1.1.
|
|
20
|
-
"nipurn-xprompt-new-windows-x64": "1.1.
|
|
21
|
-
"nipurn-xprompt-new-windows-x64-baseline": "1.1.
|
|
11
|
+
"nipurn-xprompt-new-linux-arm64": "1.1.32",
|
|
12
|
+
"nipurn-xprompt-new-linux-x64": "1.1.32",
|
|
13
|
+
"nipurn-xprompt-new-linux-x64-baseline": "1.1.32",
|
|
14
|
+
"nipurn-xprompt-new-linux-arm64-musl": "1.1.32",
|
|
15
|
+
"nipurn-xprompt-new-linux-x64-musl": "1.1.32",
|
|
16
|
+
"nipurn-xprompt-new-linux-x64-baseline-musl": "1.1.32",
|
|
17
|
+
"nipurn-xprompt-new-darwin-arm64": "1.1.32",
|
|
18
|
+
"nipurn-xprompt-new-darwin-x64": "1.1.32",
|
|
19
|
+
"nipurn-xprompt-new-darwin-x64-baseline": "1.1.32",
|
|
20
|
+
"nipurn-xprompt-new-windows-x64": "1.1.32",
|
|
21
|
+
"nipurn-xprompt-new-windows-x64-baseline": "1.1.32"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -99,37 +99,103 @@ function symlinkBinary(sourcePath, binaryName) {
|
|
|
99
99
|
|
|
100
100
|
function createConfig() {
|
|
101
101
|
const home = os.homedir()
|
|
102
|
-
|
|
102
|
+
// Primary: XDG config path (what the app reads via xdg-basedir)
|
|
103
|
+
const xdgConfigHome = process.env.XDG_CONFIG_HOME || path.join(home, ".config")
|
|
104
|
+
const configDir = path.join(xdgConfigHome, "100xprompt")
|
|
103
105
|
const configPath = path.join(configDir, "100xprompt.json")
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
// Legacy fallback: also check ~/.100xprompt
|
|
107
|
+
const legacyConfigDir = path.join(home, ".100xprompt")
|
|
108
|
+
const legacyConfigPath = path.join(legacyConfigDir, "100xprompt.json")
|
|
109
|
+
|
|
110
|
+
const defaultConfig = {
|
|
111
|
+
$schema: "https://opencode.ai/config.json",
|
|
112
|
+
compaction: {
|
|
113
|
+
auto: {
|
|
114
|
+
enabled: true,
|
|
115
|
+
// Note: The code automatically overrides this to 160k for Flash models
|
|
116
|
+
compactionThreshold: 80000,
|
|
117
|
+
tailPreserveTurns: 4,
|
|
118
|
+
},
|
|
119
|
+
micro: {
|
|
120
|
+
enabled: true,
|
|
121
|
+
hotTailCount: 5,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
108
124
|
}
|
|
109
125
|
|
|
110
126
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
// Determine which config path to use:
|
|
128
|
+
// If legacy path exists but XDG path doesn't, use legacy for validation/merge
|
|
129
|
+
// Otherwise prefer XDG path (the app reads from both)
|
|
130
|
+
let activeConfigDir = configDir
|
|
131
|
+
let activeConfigPath = configPath
|
|
132
|
+
if (fs.existsSync(legacyConfigPath) && !fs.existsSync(configPath)) {
|
|
133
|
+
activeConfigDir = legacyConfigDir
|
|
134
|
+
activeConfigPath = legacyConfigPath
|
|
113
135
|
}
|
|
114
136
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
137
|
+
if (!fs.existsSync(activeConfigDir)) {
|
|
138
|
+
fs.mkdirSync(activeConfigDir, { recursive: true })
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (fs.existsSync(activeConfigPath)) {
|
|
142
|
+
// Validate existing config and merge missing defaults
|
|
143
|
+
try {
|
|
144
|
+
const raw = fs.readFileSync(activeConfigPath, "utf-8")
|
|
145
|
+
const existing = JSON.parse(raw)
|
|
146
|
+
|
|
147
|
+
let needsUpdate = false
|
|
148
|
+
|
|
149
|
+
// Ensure compaction section exists with all required fields
|
|
150
|
+
if (!existing.compaction) {
|
|
151
|
+
existing.compaction = defaultConfig.compaction
|
|
152
|
+
needsUpdate = true
|
|
153
|
+
} else {
|
|
154
|
+
if (!existing.compaction.auto) {
|
|
155
|
+
existing.compaction.auto = defaultConfig.compaction.auto
|
|
156
|
+
needsUpdate = true
|
|
157
|
+
} else {
|
|
158
|
+
// Merge individual auto fields if missing
|
|
159
|
+
for (const [key, value] of Object.entries(defaultConfig.compaction.auto)) {
|
|
160
|
+
if (existing.compaction.auto[key] === undefined) {
|
|
161
|
+
existing.compaction.auto[key] = value
|
|
162
|
+
needsUpdate = true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (!existing.compaction.micro) {
|
|
167
|
+
existing.compaction.micro = defaultConfig.compaction.micro
|
|
168
|
+
needsUpdate = true
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (!existing.$schema) {
|
|
173
|
+
existing.$schema = defaultConfig.$schema
|
|
174
|
+
needsUpdate = true
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (needsUpdate) {
|
|
178
|
+
fs.writeFileSync(activeConfigPath, JSON.stringify(existing, null, 2))
|
|
179
|
+
try { fs.chmodSync(activeConfigPath, 0o644) } catch {}
|
|
180
|
+
console.log(`Config updated with missing defaults at ${activeConfigPath}`)
|
|
181
|
+
} else {
|
|
182
|
+
console.log(`Config already exists and is valid at ${activeConfigPath}, skipping.`)
|
|
183
|
+
}
|
|
184
|
+
} catch (parseError) {
|
|
185
|
+
// Existing file is corrupt — back it up and recreate
|
|
186
|
+
const backupPath = activeConfigPath + ".bak"
|
|
187
|
+
console.warn(`Config at ${activeConfigPath} is corrupt, backing up to ${backupPath} and recreating.`)
|
|
188
|
+
try { fs.copyFileSync(activeConfigPath, backupPath) } catch {}
|
|
189
|
+
fs.writeFileSync(activeConfigPath, JSON.stringify(defaultConfig, null, 2))
|
|
190
|
+
try { fs.chmodSync(activeConfigPath, 0o644) } catch {}
|
|
191
|
+
console.log(`Default config recreated at ${activeConfigPath}`)
|
|
192
|
+
}
|
|
193
|
+
return
|
|
129
194
|
}
|
|
130
195
|
|
|
131
|
-
fs.writeFileSync(
|
|
132
|
-
|
|
196
|
+
fs.writeFileSync(activeConfigPath, JSON.stringify(defaultConfig, null, 2))
|
|
197
|
+
try { fs.chmodSync(activeConfigPath, 0o644) } catch {}
|
|
198
|
+
console.log(`Default config created at ${activeConfigPath}`)
|
|
133
199
|
} catch (error) {
|
|
134
200
|
console.warn(`Failed to create default config: ${error.message}`)
|
|
135
201
|
// Don't fail postinstall just because config creation failed
|