MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / feedback

Function feedback

openkb/cli.py:2219–2286  ·  view source on GitHub ↗

Submit feedback by opening a prefilled GitHub issue. Examples: \b openkb feedback # interactive openkb feedback "openkb add hangs on .docx" # one-line bug report openkb feedback --type feature "..." # tags the issue 'enhancement'

(ctx, message, feedback_type)

Source from the content-addressed store, hash-verified

2217)
2218@click.pass_context
2219def feedback(ctx, message, feedback_type):
2220 """Submit feedback by opening a prefilled GitHub issue.
2221
2222 Examples:
2223
2224 \b
2225 openkb feedback # interactive
2226 openkb feedback "openkb add hangs on .docx" # one-line bug report
2227 openkb feedback --type feature "..." # tags the issue 'enhancement'
2228
2229 The command does not send anything to OpenKB maintainers directly —
2230 it opens GitHub in your browser with title, body, and label prefilled.
2231 You log in with your own GitHub account and submit the issue.
2232 """
2233 if not message:
2234 click.echo(
2235 "What's your feedback? End with an empty line + Ctrl-D "
2236 "(Unix) or Ctrl-Z+Enter (Windows). Ctrl-C cancels."
2237 )
2238 message = sys.stdin.read().strip()
2239
2240 if not message:
2241 click.echo("No feedback provided. Aborted.")
2242 ctx.exit(1)
2243 return
2244
2245 if feedback_type is None:
2246 # Skip the prompt in non-TTY contexts (CI / piped stdin) so
2247 # ``echo "msg" | openkb feedback`` doesn't hang on the second
2248 # prompt after consuming all piped input for the message body.
2249 # Mirrors the ``_stdin_is_tty()`` gate added in PR #48.
2250 if _stdin_is_tty():
2251 feedback_type = click.prompt(
2252 "Type",
2253 default="other",
2254 type=click.Choice(_FEEDBACK_TYPES),
2255 show_default=True,
2256 show_choices=True,
2257 )
2258 else:
2259 feedback_type = "other"
2260
2261 diagnostics = _collect_feedback_diagnostics(ctx)
2262 url = _build_feedback_url(message, feedback_type, diagnostics)
2263
2264 click.echo("Copy this URL into a browser if the auto-open below fails:")
2265 click.echo(f" {url}")
2266
2267 import webbrowser
2268
2269 try:
2270 opened = webbrowser.open(url)
2271 except Exception as exc:
2272 # webbrowser.open rarely raises but be defensive — the printed URL
2273 # above is the fallback path.
2274 click.echo(f" (browser auto-open failed: {exc})", err=True)
2275 return
2276

Callers

nothing calls this directly

Calls 4

_stdin_is_ttyFunction · 0.85
_build_feedback_urlFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected