Skip to content

Commit dad19e5

Browse files
committed
docs(feedback): drop --print-url and --no-diagnostics, keep one flag
The two flags added complexity without changing the day-one user experience: - --print-url: URL is already printed before webbrowser.open is attempted (the "Copy this URL..." line), so SSH/sandbox users can copy it from the terminal regardless of whether the auto-open succeeds. The flag was redundant. - --no-diagnostics: the diagnostics block is intentionally tiny (openkb version, Python, OS, kb_initialised yes/no) — no paths, usernames, env vars, or keys. Maintainers benefit from having it on every issue without exception, and the privacy cost is negligible. Surface shrinks to one flag (--type) plus the positional message. Help text and README updated. 19 feedback tests still pass (329 total).
1 parent 18dd708 commit dad19e5

3 files changed

Lines changed: 14 additions & 55 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ A single source might touch 10-15 wiki pages. Knowledge accumulates: each docume
156156
| `openkb lint` | Run structural + knowledge health checks |
157157
| `openkb list` | List indexed documents and concepts |
158158
| `openkb status` | Show knowledge base stats |
159-
| <code>openkb&nbsp;feedback&nbsp;["msg"]</code> | File feedback by opening a prefilled GitHub issue (use `--type bug/feature/question`, `--print-url` for SSH / sandbox) |
159+
| <code>openkb&nbsp;feedback&nbsp;["msg"]</code> | File feedback by opening a prefilled GitHub issue (use `--type bug/feature/question` to tag the issue) |
160160

161161
<!-- | `openkb lint --fix` | Auto-fix what it can | -->
162162

openkb/cli.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,16 +1216,8 @@ def _build_feedback_url(
12161216
default=None,
12171217
help="Feedback type — sets the GitHub issue label.",
12181218
)
1219-
@click.option(
1220-
"--print-url", is_flag=True, default=False,
1221-
help="Print the prefilled GitHub issue URL instead of opening a browser.",
1222-
)
1223-
@click.option(
1224-
"--no-diagnostics", is_flag=True, default=False,
1225-
help="Don't attach the diagnostics block (openkb version, Python, OS, KB present).",
1226-
)
12271219
@click.pass_context
1228-
def feedback(ctx, message, feedback_type, print_url, no_diagnostics):
1220+
def feedback(ctx, message, feedback_type):
12291221
"""Submit feedback by opening a prefilled GitHub issue.
12301222
12311223
Examples:
@@ -1234,7 +1226,6 @@ def feedback(ctx, message, feedback_type, print_url, no_diagnostics):
12341226
openkb feedback # interactive
12351227
openkb feedback "openkb add hangs on .docx" # one-line bug report
12361228
openkb feedback --type feature "..." # tags the issue 'enhancement'
1237-
openkb feedback --print-url "..." # SSH / sandbox-friendly
12381229
12391230
The command does not send anything to OpenKB maintainers directly —
12401231
it opens GitHub in your browser with title, body, and label prefilled.
@@ -1268,13 +1259,9 @@ def feedback(ctx, message, feedback_type, print_url, no_diagnostics):
12681259
else:
12691260
feedback_type = "other"
12701261

1271-
diagnostics = {} if no_diagnostics else _collect_feedback_diagnostics(ctx)
1262+
diagnostics = _collect_feedback_diagnostics(ctx)
12721263
url = _build_feedback_url(message, feedback_type, diagnostics)
12731264

1274-
if print_url:
1275-
click.echo(url)
1276-
return
1277-
12781265
click.echo("Copy this URL into a browser if the auto-open below fails:")
12791266
click.echo(f" {url}")
12801267

tests/test_feedback.py

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ def test_build_url_diagnostics_attached_when_provided():
9696

9797

9898
def test_build_url_no_diagnostics_block_when_empty():
99-
"""Empty dict means user passed --no-diagnostics; body is just the message."""
99+
"""When called with an empty dict the function omits the details block.
100+
Defensive: the CLI always passes a populated dict, but keeping the
101+
branch tested guards against accidental regression."""
100102
url = _build_feedback_url("just the message", "bug", {})
101103
params = _parse(url)
102104
assert params["body"] == "just the message"
@@ -141,20 +143,8 @@ class _Ctx:
141143
# ---------------------------------------------------------------------------
142144

143145

144-
def test_feedback_one_liner_print_url_does_not_open_browser():
145-
"""--print-url is the SSH / sandbox path: it must NOT call webbrowser.open."""
146-
runner = CliRunner()
147-
with patch("webbrowser.open") as mock_open:
148-
result = runner.invoke(
149-
cli, ["feedback", "--type", "bug", "--print-url", "openkb crashes on .ppt"],
150-
)
151-
152-
assert result.exit_code == 0, result.output
153-
assert "https://github.com/VectifyAI/OpenKB/issues/new" in result.output
154-
mock_open.assert_not_called()
155-
156-
157-
def test_feedback_one_liner_default_opens_browser_with_url():
146+
def test_feedback_one_liner_opens_browser_with_url():
147+
"""Default path: build URL, print it for copy-fallback, and open browser."""
158148
runner = CliRunner()
159149
with patch("webbrowser.open") as mock_open:
160150
result = runner.invoke(cli, ["feedback", "--type", "bug", "test message"])
@@ -163,8 +153,7 @@ def test_feedback_one_liner_default_opens_browser_with_url():
163153
mock_open.assert_called_once()
164154
called_url = mock_open.call_args[0][0]
165155
assert called_url.startswith("https://github.com/VectifyAI/OpenKB/issues/new?")
166-
# The fallback URL should also be printed so the user has a copy if the
167-
# auto-open fails.
156+
# The URL is also printed so the user has a copy if auto-open fails.
168157
assert called_url in result.output
169158

170159

@@ -177,33 +166,18 @@ def test_feedback_empty_message_aborts_with_exit_1():
177166
assert "No feedback provided" in result.output
178167

179168

180-
def test_feedback_no_diagnostics_strips_block_from_body():
181-
runner = CliRunner()
182-
with patch("webbrowser.open") as mock_open:
183-
result = runner.invoke(
184-
cli,
185-
["feedback", "--type", "bug", "--print-url", "--no-diagnostics", "just this"],
186-
)
187-
188-
assert result.exit_code == 0
189-
url = result.output.strip().splitlines()[-1]
190-
assert "Diagnostics" not in url
191-
assert "details" not in url # no <details> block
192-
mock_open.assert_not_called()
193-
194-
195169
def test_feedback_prompts_for_type_when_not_given_via_flag():
196-
"""If --type isn't on the command line, prompt the user."""
170+
"""If --type isn't on the command line and stdin is a TTY, prompt the user."""
197171
runner = CliRunner()
198-
with patch("webbrowser.open") as mock_open, \
172+
with patch("webbrowser.open"), \
199173
patch("openkb.cli._stdin_is_tty", return_value=True):
200174
result = runner.invoke(
201-
cli, ["feedback", "--print-url", "missing-type prompt test"],
175+
cli, ["feedback", "missing-type prompt test"],
202176
input="feature\n",
203177
)
204178

205179
assert result.exit_code == 0
206-
# The URL should be tagged with the chosen type (mapped to 'enhancement').
180+
# The URL printed for fallback-copy carries the chosen type's label.
207181
url_line = [ln for ln in result.output.splitlines() if "issues/new" in ln][-1]
208182
assert "labels=enhancement" in url_line
209183

@@ -219,9 +193,7 @@ def test_feedback_skips_type_prompt_when_stdin_is_not_a_tty():
219193
runner = CliRunner()
220194
with patch("webbrowser.open"), \
221195
patch("openkb.cli._stdin_is_tty", return_value=False):
222-
result = runner.invoke(
223-
cli, ["feedback", "--print-url", "non-tty feedback"],
224-
)
196+
result = runner.invoke(cli, ["feedback", "non-tty feedback"])
225197

226198
assert result.exit_code == 0, result.output
227199
# Non-TTY → falls back to "other", which has no label param

0 commit comments

Comments
 (0)