phewsh 0.15.43 → 0.15.45
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.
- package/commands/update.js +18 -3
- package/lib/slash-commands.js +7 -3
- package/package.json +1 -1
package/commands/update.js
CHANGED
|
@@ -112,9 +112,24 @@ async function main() {
|
|
|
112
112
|
if (code === 0) {
|
|
113
113
|
console.log(` ${green('✓')} Updated to v${latest}. New shells pick it up immediately.`);
|
|
114
114
|
} else {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
// NEVER suggest `sudo npm i -g` — that root-owns the package dir and
|
|
116
|
+
// poisons every future non-sudo update (the exact trap users hit). The
|
|
117
|
+
// correct fix is to OWN the package, once, then update normally.
|
|
118
|
+
let prefix = '';
|
|
119
|
+
try {
|
|
120
|
+
prefix = require('child_process').execFileSync('npm', ['config', 'get', 'prefix'],
|
|
121
|
+
{ encoding: 'utf-8', timeout: 3000 }).trim();
|
|
122
|
+
} catch { /* unknown prefix */ }
|
|
123
|
+
const pkgDir = prefix ? `${prefix}/lib/node_modules/${pkg.name}` : `$(npm prefix -g)/lib/node_modules/${pkg.name}`;
|
|
124
|
+
const binLink = prefix ? `${prefix}/bin/${pkg.name}` : `$(npm prefix -g)/bin/${pkg.name}`;
|
|
125
|
+
console.log(` ${yellow('Update failed')} (npm exited ${code}) — almost certainly a permissions issue.`);
|
|
126
|
+
console.log(` ${g('The phewsh package is probably root-owned from a past `sudo` install.')}`);
|
|
127
|
+
console.log(` ${b('Own it once, then updates never need sudo again:')}`);
|
|
128
|
+
console.log(` ${w(`sudo chown -R $(whoami) "${pkgDir}"`)}`);
|
|
129
|
+
console.log(` ${w(`sudo chown -h $(whoami) "${binLink}"`)}`);
|
|
130
|
+
console.log(` ${w(`phewsh update`)}`);
|
|
131
|
+
console.log(` ${g('Or reinstall with the installer (handles this for you):')} ${w('curl -fsSL phewsh.com/install.sh | sh')}`);
|
|
132
|
+
console.log(` ${g('Do NOT run `sudo npm i -g` — that is what caused this.')}`);
|
|
118
133
|
}
|
|
119
134
|
console.log('');
|
|
120
135
|
process.exit(code ?? 0);
|
package/lib/slash-commands.js
CHANGED
|
@@ -28,10 +28,14 @@ If there is no \`.intent/\` directory here, say so and tell me I can create one
|
|
|
28
28
|
|
|
29
29
|
// Tools that support file-based custom slash commands, and how each wants them.
|
|
30
30
|
// parentDir must already exist (the tool is installed) before we write.
|
|
31
|
+
//
|
|
32
|
+
// Claude Code is deliberately EXCLUDED: it already ships a phewsh `/intent`
|
|
33
|
+
// SKILL (the artifact generator) and gets the SessionStart hook brief, so a
|
|
34
|
+
// global `/intent` command here just collides with the canonical one (two
|
|
35
|
+
// `/intent` entries). We add `/intent` only where it's genuinely absent.
|
|
31
36
|
const SLASH_TARGETS = [
|
|
32
|
-
{ id: '
|
|
33
|
-
{ id: '
|
|
34
|
-
{ id: 'gemini', parent: '.gemini', sub: 'commands', file: 'intent.toml', fmt: 'gemini' },
|
|
37
|
+
{ id: 'codex', parent: '.codex', sub: 'prompts', file: 'intent.md', fmt: 'codex' },
|
|
38
|
+
{ id: 'gemini', parent: '.gemini', sub: 'commands', file: 'intent.toml', fmt: 'gemini' },
|
|
35
39
|
];
|
|
36
40
|
|
|
37
41
|
function bodyFor(fmt) {
|