phewsh 0.15.74 → 0.15.75
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/bin/phewsh.js +2 -0
- package/commands/feedback.js +62 -0
- package/package.json +1 -1
package/bin/phewsh.js
CHANGED
|
@@ -115,6 +115,7 @@ const COMMANDS = {
|
|
|
115
115
|
dispatch: () => require('../commands/task')(),
|
|
116
116
|
pack: () => require('../commands/pack')(),
|
|
117
117
|
hook: () => require('../commands/hook')(),
|
|
118
|
+
feedback: () => require('../commands/feedback')(),
|
|
118
119
|
welcome: () => require('../commands/welcome')(),
|
|
119
120
|
intro: () => require('../commands/welcome')(),
|
|
120
121
|
help: showHelp,
|
|
@@ -171,6 +172,7 @@ function showHelp() {
|
|
|
171
172
|
console.log(` ${cyan('bypass')} ${g('Went around phewsh? Record why — 10 seconds, no guilt')}`);
|
|
172
173
|
console.log('');
|
|
173
174
|
console.log(` ${b(w('configure'))}`);
|
|
175
|
+
console.log(` ${cyan('feedback')} ${g('Tell us where it breaks — prefilled GitHub issue, nothing hidden')}`);
|
|
174
176
|
console.log(` ${cyan('login')} ${g('Identity + API key + cloud sync')}`);
|
|
175
177
|
console.log(` ${cyan('link')} ${g('Link local .intent/ to cloud project')}`);
|
|
176
178
|
console.log(` ${cyan('update')} ${g('Update phewsh — or `phewsh update auto on` to stay current automatically')}`);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// phewsh feedback — the door the launch post points at.
|
|
2
|
+
//
|
|
3
|
+
// phewsh feedback open a prefilled GitHub issue in the browser
|
|
4
|
+
// phewsh feedback "it broke..." same, with your words already in the body
|
|
5
|
+
//
|
|
6
|
+
// Deliberately no hidden telemetry: everything sent is shown first, travels
|
|
7
|
+
// as a URL you can read, and lands in the public issue tracker. Email stays
|
|
8
|
+
// the quiet alternative for anything private.
|
|
9
|
+
|
|
10
|
+
const os = require('os');
|
|
11
|
+
const { execFileSync } = require('child_process');
|
|
12
|
+
|
|
13
|
+
const REPO_ISSUES = 'https://github.com/cleverIdeaz/phewsh-cli/issues/new';
|
|
14
|
+
const EMAIL = 'hello@phewsh.com';
|
|
15
|
+
|
|
16
|
+
const b = (s) => `\x1b[1m${s}\x1b[0m`;
|
|
17
|
+
const g = (s) => `\x1b[38;5;247m${s}\x1b[0m`;
|
|
18
|
+
const w = (s) => `\x1b[97m${s}\x1b[0m`;
|
|
19
|
+
const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
|
|
20
|
+
|
|
21
|
+
function buildUrl(text) {
|
|
22
|
+
const version = require('../package.json').version;
|
|
23
|
+
const body = [
|
|
24
|
+
text ? text.trim() : '<!-- What happened? What did you expect? -->',
|
|
25
|
+
'',
|
|
26
|
+
'---',
|
|
27
|
+
`phewsh ${version} · ${process.platform} ${os.release()} · node ${process.version}`,
|
|
28
|
+
].join('\n');
|
|
29
|
+
const params = new URLSearchParams({ title: text ? text.trim().slice(0, 72) : '', body });
|
|
30
|
+
return `${REPO_ISSUES}?${params.toString()}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Arg-array spawn only — the URL carries user text; it must never touch a shell.
|
|
34
|
+
function openBrowser(url) {
|
|
35
|
+
try {
|
|
36
|
+
if (process.platform === 'darwin') execFileSync('open', [url]);
|
|
37
|
+
else if (process.platform === 'win32') execFileSync('cmd', ['/c', 'start', '', url]);
|
|
38
|
+
else execFileSync('xdg-open', [url]);
|
|
39
|
+
return true;
|
|
40
|
+
} catch { return false; }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function main() {
|
|
44
|
+
const text = process.argv.slice(3).filter(a => !a.startsWith('--')).join(' ');
|
|
45
|
+
const url = buildUrl(text);
|
|
46
|
+
console.log('');
|
|
47
|
+
console.log(` ${b(w('phewsh feedback'))} ${g('— where it breaks is exactly what we want to hear')}`);
|
|
48
|
+
console.log(` ${g('Includes only what you see: your words + version/OS/node. Nothing else.')}`);
|
|
49
|
+
console.log('');
|
|
50
|
+
const opened = openBrowser(url);
|
|
51
|
+
if (opened) {
|
|
52
|
+
console.log(` ${cyan('●')} ${g('Opened a prefilled GitHub issue in your browser.')}`);
|
|
53
|
+
} else {
|
|
54
|
+
console.log(` ${g('Open this to file it:')}`);
|
|
55
|
+
console.log(` ${w(url)}`);
|
|
56
|
+
}
|
|
57
|
+
console.log(` ${g('Prefer email?')} ${w(EMAIL)}`);
|
|
58
|
+
console.log('');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = main;
|
|
62
|
+
module.exports.buildUrl = buildUrl;
|