phewsh 0.15.75 → 0.15.76
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 +1 -1
- package/commands/feedback.js +41 -1
- package/package.json +1 -1
package/bin/phewsh.js
CHANGED
|
@@ -172,7 +172,7 @@ function showHelp() {
|
|
|
172
172
|
console.log(` ${cyan('bypass')} ${g('Went around phewsh? Record why — 10 seconds, no guilt')}`);
|
|
173
173
|
console.log('');
|
|
174
174
|
console.log(` ${b(w('configure'))}`);
|
|
175
|
-
console.log(` ${cyan('feedback')} ${g('Tell us
|
|
175
|
+
console.log(` ${cyan('feedback')} ${g('Tell us what you need — prefilled GitHub issue; `feedback list` shows the queue')}`);
|
|
176
176
|
console.log(` ${cyan('login')} ${g('Identity + API key + cloud sync')}`);
|
|
177
177
|
console.log(` ${cyan('link')} ${g('Link local .intent/ to cloud project')}`);
|
|
178
178
|
console.log(` ${cyan('update')} ${g('Update phewsh — or `phewsh update auto on` to stay current automatically')}`);
|
package/commands/feedback.js
CHANGED
|
@@ -40,8 +40,47 @@ function openBrowser(url) {
|
|
|
40
40
|
} catch { return false; }
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Render the open feedback queue. Pure — testable without the network.
|
|
44
|
+
function formatIssues(issues) {
|
|
45
|
+
if (!Array.isArray(issues) || issues.length === 0) {
|
|
46
|
+
return [' No open feedback right now — the queue is clear.'];
|
|
47
|
+
}
|
|
48
|
+
const lines = issues.slice(0, 15).map(i => {
|
|
49
|
+
const age = Math.max(0, Math.floor((Date.now() - new Date(i.created_at).getTime()) / 86400000));
|
|
50
|
+
const labels = (i.labels || []).map(l => l.name).filter(Boolean).join(', ');
|
|
51
|
+
return ` ${g('#' + i.number)} ${w(String(i.title).slice(0, 70))} ${g(`· ${age}d${labels ? ' · ' + labels : ''}`)}`;
|
|
52
|
+
});
|
|
53
|
+
lines.push('');
|
|
54
|
+
lines.push(` ${g('Pull one into the project room:')} ${cyan('phewsh dispatch "fix: <title> (#<n>)"')} ${g('— teammate or agent claims it, PR closes the loop.')}`);
|
|
55
|
+
return lines;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// `phewsh feedback list` — read the public queue so feedback lands in
|
|
59
|
+
// phewsh's own loop (issue → task → claim → PR → record), with phewsh as
|
|
60
|
+
// the database rather than any one chat.
|
|
61
|
+
async function list() {
|
|
62
|
+
console.log('');
|
|
63
|
+
console.log(` ${b(w('Open feedback'))} ${g('— github.com/cleverIdeaz/phewsh-cli/issues')}`);
|
|
64
|
+
console.log('');
|
|
65
|
+
try {
|
|
66
|
+
const res = await fetch('https://api.github.com/repos/cleverIdeaz/phewsh-cli/issues?state=open&per_page=15', {
|
|
67
|
+
headers: { accept: 'application/vnd.github+json' },
|
|
68
|
+
signal: AbortSignal.timeout(6000),
|
|
69
|
+
});
|
|
70
|
+
if (!res.ok) throw new Error(`GitHub API ${res.status}`);
|
|
71
|
+
const issues = (await res.json()).filter(i => !i.pull_request); // issues only, not PRs
|
|
72
|
+
formatIssues(issues).forEach(l => console.log(l));
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.log(` ${g('Could not reach GitHub (' + err.message + ') — browse directly:')}`);
|
|
75
|
+
console.log(` ${w('https://github.com/cleverIdeaz/phewsh-cli/issues')}`);
|
|
76
|
+
}
|
|
77
|
+
console.log('');
|
|
78
|
+
}
|
|
79
|
+
|
|
43
80
|
function main() {
|
|
44
|
-
const
|
|
81
|
+
const argv = process.argv.slice(3);
|
|
82
|
+
if (argv[0] === 'list') return list();
|
|
83
|
+
const text = argv.filter(a => !a.startsWith('--')).join(' ');
|
|
45
84
|
const url = buildUrl(text);
|
|
46
85
|
console.log('');
|
|
47
86
|
console.log(` ${b(w('phewsh feedback'))} ${g('— where it breaks is exactly what we want to hear')}`);
|
|
@@ -60,3 +99,4 @@ function main() {
|
|
|
60
99
|
|
|
61
100
|
module.exports = main;
|
|
62
101
|
module.exports.buildUrl = buildUrl;
|
|
102
|
+
module.exports.formatIssues = formatIssues;
|