diff --git a/docs/issue-management/README.md b/docs/issue-management/README.md index b96b0176c..b586d639e 100644 --- a/docs/issue-management/README.md +++ b/docs/issue-management/README.md @@ -82,6 +82,12 @@ New to Magpie? The [quick start](../quick-start.md) walks the whole path in one place โ€” install, the first `/magpie-setup:setup` run, and a recording of it happening โ€” plus the other agents and the secure-isolation setup to run next. +The first issue skill you run opens with a one-minute +[welcome guide](../../plugins/magpie-setup/skills/setup/setup_preflight/guides/issue.md): +the typical flow, what needs configuring, what to ask it, and how to make it yours. +Dismiss it, or hide it for good, from its last line; +*"show the issue welcome again"* or `/magpie-setup:welcome-guide issue` brings it back. + ### Before the first run diff --git a/plugins/magpie-setup/skills/setup/setup_preflight/guides/issue.md b/plugins/magpie-setup/skills/setup/setup_preflight/guides/issue.md new file mode 100644 index 000000000..9502cb4de --- /dev/null +++ b/plugins/magpie-setup/skills/setup/setup_preflight/guides/issue.md @@ -0,0 +1,57 @@ + + +# ๐Ÿฆ Magpie here โ€” your issue-management sidekick + +A one-minute tour, then straight back to what you asked for. + +## ๐Ÿ”„ The typical flow + +1. ๐Ÿท๏ธ **Triage** incoming issues and draft tracker replies โ€” *"triage the open issues"* +2. ๐Ÿ” **Deduplicate** related reports and propose which to keep โ€” *"find duplicate issues"* +3. ๐Ÿงช **Reproduce** a reported bug from its code โ€” *"reproduce issue ABC-123"* +4. ๐Ÿ” **Reassess** resolved or end-of-life issues against today's code โ€” *"re-assess old issues"* +5. ๐Ÿ› ๏ธ **Draft a fix** with tests and a hand-back โ€” *"draft a fix for ABC-123"* +6. ๐Ÿงน **Sweep stale issues** and review proposed actions โ€” *"find stale issues"* +7. ๐Ÿ“Š **Report** backlog and reassessment statistics โ€” *"show backlog statistics"* + +`reassess-stats` reports on reassessment results; `backlog-stats` reports on the backlog. +Tracker comments and issue closures require confirmation. +Stale closures need a second confirmation. +The fix workflow opens a draft PR only with `--draft-pr` and explicit approval. + +## โš™๏ธ Configure it + +Different skills need different project settings: + +- ๐Ÿ—‚๏ธ **Tracker** โ€” `issue-tracker-config.md` for triage, deduplication, reproduction, stale sweep, reassessment and statistics +- ๐Ÿ“– **Project** โ€” `project.md` additionally for triage and stale sweep +- ๐Ÿงช **Investigation** โ€” `reproducer-conventions.md` and `runtime-invocation.md` for reproduction; `reassess-pool-defaults.md` for reassessment +- ๐Ÿ› ๏ธ **Fixes** โ€” `fix-workflow.md` and `runtime-invocation.md` for drafting fixes + +Configure personally with `/magpie-setup:setup config`. +Shared adoption with `/magpie-setup:setup adopt` is a maintainer decision. + +## ๐Ÿ’ฌ Just ask + +Talk to Magpie in plain language: + +- *"triage these incoming bugs and show me draft replies"* +- *"find duplicates without closing anything"* +- *"reproduce this issue and explain what you found"* +- *"reassess the issue backlog and summarize the results"* +- *"draft a fix for this confirmed bug"* +- *"review stale issues before posting or closing"* +- *"show backlog and reassessment statistics"* + +## ๐ŸŽจ Make it yours + +Describe how you want the issue workflow to behave: + +- *"use our tracker conventions when drafting triage replies"* +- *"adjust the stale-issue thresholds for this project"* + +Review configuration or override proposals before applying them. +Useful elsewhere? Ask *"upstream this change to Magpie"* to prepare a contribution for review. + + diff --git a/tools/setup-preflight/tests/test_welcome.py b/tools/setup-preflight/tests/test_welcome.py index d5f4d77f8..34628ca4d 100644 --- a/tools/setup-preflight/tests/test_welcome.py +++ b/tools/setup-preflight/tests/test_welcome.py @@ -113,6 +113,29 @@ def test_the_pairing_family_guide_comes_on_the_next_run(project: Path, version) assert due(project, "self-review") == [("general", "again")] +def test_the_issue_family_guide_comes_on_the_next_run(project: Path, version) -> None: + for skill in ( + "backlog-stats", + "deduplicate", + "fix-workflow", + "reassess", + "reassess-stats", + "reproducer", + "stale-sweep", + ): + assert welcome.family_of(skill) == "issue" + + # The bare issue-triage name belongs to Security, not Issue. + assert welcome.family_of("issue-triage") == "security" + assert welcome.family_of("magpie-issue-triage") == "issue" + + assert due(project, "magpie-issue-triage") == [("general", "first-run")] + welcome.record(project, "general", "seen") + assert due(project, "magpie-issue-triage") == [("issue", "first-run")] + welcome.record(project, "issue", "seen") + assert due(project, "magpie-issue-triage") == [("general", "again")] + + def test_at_most_one_guide_per_run(project: Path, version) -> None: for _ in range(8): found = welcome_findings(project, SECURITY_SKILL) @@ -410,11 +433,11 @@ def test_show_without_color_prints_the_markdown(capsys) -> None: def test_the_rules_section_and_both_guides_ship() -> None: assert welcome.SECTION in sections.available() - assert {"general", "security", "utilities", "mentoring", "pairing"} <= set(welcome.guides()) + assert {"general", "security", "utilities", "mentoring", "pairing", "issue"} <= set(welcome.guides()) assert welcome.family_guides() == [g for g in welcome.guides() if g != "general"] -@pytest.mark.parametrize("name", ["general", "security", "utilities", "mentoring", "pairing"]) +@pytest.mark.parametrize("name", ["general", "security", "utilities", "mentoring", "pairing", "issue"]) def test_each_guide_is_short_and_ends_with_the_way_back(name: str) -> None: text = welcome.guide(name) or "" assert not text.startswith(" + +There is no `.apache-magpie.lock`, no `.apache-magpie-overrides/` and no +`.apache-magpie-local/` at the repo root. The running agent is Claude Code +with magpie-setup 0.4.0 and magpie-issue 0.4.0 installed. + +The user has already seen the initial general welcome guide on an earlier run. +The invoked skill's own frontmatter reads `name: triage` and +`surface_hash: sha256:fb90bdc45aec5f8a`; it belongs to the issue family. +This is the first time an issue-family skill has run here. +The user asked it to "triage these incoming issues". + +The pre-flight command printed: + +```json +{ + "findings": [ + { + "code": "welcome", + "facts": { + "family": "issue", + "guide": "# \ud83d\udc26 Magpie here \u2014 your issue-management sidekick\n\nA one-minute tour, then straight back to what you asked for.\n\n## \ud83d\udd04 The typical flow\n\n1. \ud83c\udff7\ufe0f **Triage** incoming issues and draft tracker replies \u2014 *\"triage the open issues\"*\n2. \ud83d\udd01 **Deduplicate** related reports and propose which to keep \u2014 *\"find duplicate issues\"*\n3. \ud83e\uddea **Reproduce** a reported bug from its code \u2014 *\"reproduce issue ABC-123\"*\n4. \ud83d\udd0d **Reassess** resolved or end-of-life issues against today's code \u2014 *\"re-assess old issues\"*\n5. \ud83d\udee0\ufe0f **Draft a fix** with tests and a hand-back \u2014 *\"draft a fix for ABC-123\"*\n6. \ud83e\uddf9 **Sweep stale issues** and review proposed actions \u2014 *\"find stale issues\"*\n7. \ud83d\udcca **Report** backlog and reassessment statistics \u2014 *\"show backlog statistics\"*\n\n`reassess-stats` reports on reassessment results; `backlog-stats` reports on the backlog.\nTracker comments and issue closures require confirmation.\nStale closures need a second confirmation.\nThe fix workflow opens a draft PR only with `--draft-pr` and explicit approval.\n\n## \u2699\ufe0f Configure it\n\nDifferent skills need different project settings:\n\n- \ud83d\uddc2\ufe0f **Tracker** \u2014 `issue-tracker-config.md` for triage, deduplication, reproduction, stale sweep, reassessment and statistics\n- \ud83d\udcd6 **Project** \u2014 `project.md` additionally for triage and stale sweep\n- \ud83e\uddea **Investigation** \u2014 `reproducer-conventions.md` and `runtime-invocation.md` for reproduction; `reassess-pool-defaults.md` for reassessment\n- \ud83d\udee0\ufe0f **Fixes** \u2014 `fix-workflow.md` and `runtime-invocation.md` for drafting fixes\n\nConfigure personally with `/magpie-setup:setup config`.\nShared adoption with `/magpie-setup:setup adopt` is a maintainer decision.\n\n## \ud83d\udcac Just ask\n\nTalk to Magpie in plain language:\n\n- *\"triage these incoming bugs and show me draft replies\"*\n- *\"find duplicates without closing anything\"*\n- *\"reproduce this issue and explain what you found\"*\n- *\"reassess the issue backlog and summarize the results\"*\n- *\"draft a fix for this confirmed bug\"*\n- *\"review stale issues before posting or closing\"*\n- *\"show backlog and reassessment statistics\"*\n\n## \ud83c\udfa8 Make it yours\n\nDescribe how you want the issue workflow to behave:\n\n- *\"use our tracker conventions when drafting triage replies\"*\n- *\"adjust the stale-issue thresholds for this project\"*\n\nReview configuration or override proposals before applying them.\nUseful elsewhere? Ask *\"upstream this change to Magpie\"* to prepare a contribution for review.\n\n## \ud83d\udc4b About this guide\n\n- **Continue** \u2014 show it again next time (three times at most)\n- **Dismiss** \u2014 hide it until the next Magpie upgrade\n- **Don't show again** \u2014 hide it for good; say *\"show the issue welcome again\"* to bring it back\n\nShow this again any time: `/magpie-setup:welcome-guide issue`\n(`/magpie-setup-welcome-guide issue` on a pinned snapshot).\n\n\ud83c\udf08 Prefer it in colour? Run this yourself \u2014 the `!` prefix runs it as a shell command:\n\n```text\n! PYTHONPATH=\".apache-magpie-local:$(git rev-parse --git-common-dir)/../.apache-magpie-local:$(git rev-parse --git-common-dir)/apache-magpie\" python3 -m setup_preflight.welcome show --family issue --color=always\n```\n", + "max_shown": 3, + "reason": "first-run", + "shown": 0 + }, + "scope": "family", + "section": "welcome" + } + ], + "rules": { + "welcome": "## welcome \u2014 a first-run welcome guide is due\n\nA welcome guide is due on this run: `facts.family` names it\n(`general`, for the first Magpie skill this user runs here, or the skill's own family),\nand `facts.reason` says why (`first-run`, `again`, or `upgraded` after a dismissal).\n`facts.guide` is the guide. The checker shows at most one guide per run and has already picked it.\n\n1. **Show `facts.guide` to the user verbatim**, as Markdown, before the work they asked for.\n Do not summarise, reword, trim, or add to it, and substitute nothing in it:\n its placeholders (``, ``, ``, \u2026) are meant to be read as written.\n2. **Offer the three choices in one line**:\n **Continue** (show again next time) \u00b7 **Dismiss** (hide until the next Magpie upgrade) \u00b7 **Don't show again**.\n3. **Record `seen` at once**, which is what no answer means, then carry on with the user's request in the same turn.\n Never block the requested work on the guide, and never wait for an answer before starting it.\n4. **When the user picks Dismiss or Don't show again** \u2014 now or later in the session \u2014 record that choice;\n it replaces `seen`. Continue needs nothing further.\n\n```bash\nPYTHONPATH=\".apache-magpie-local:$(git rev-parse --git-common-dir)/../.apache-magpie-local:$(git rev-parse --git-common-dir)/apache-magpie\" \\\n python3 -m setup_preflight.welcome record --family --choice \n```\n\n`seen` brings the guide back on a later run, `facts.max_shown` recorded showings in all (`facts.shown` so far);\n`dismiss` hides it until the framework version changes; `never` hides it until re-enabled.\nEvery write merges into the personal layer's `reconciled.json` under `welcome.`, keeping every other key;\nnever write it by hand.\nIf the command exits non-zero, say nothing more about it and carry on.\n\nAny guide can be shown again on request with `/magpie-setup:welcome-guide []`,\nwhich also turns a hidden one back on." + }, + "verdict": "action" +} +``` diff --git a/tools/skill-evals/evals/setup/preflight-floor/fixtures/case-13-issue-first-run/state.json b/tools/skill-evals/evals/setup/preflight-floor/fixtures/case-13-issue-first-run/state.json new file mode 100644 index 000000000..5c7603388 --- /dev/null +++ b/tools/skill-evals/evals/setup/preflight-floor/fixtures/case-13-issue-first-run/state.json @@ -0,0 +1,24 @@ +{ + "lock": null, + "plugins": [ + [ + "magpie-setup", + "0.4.0" + ], + [ + "magpie-issue", + "0.4.0" + ] + ], + "reconciled": { + "welcome": { + "general": { + "choice": "seen", + "shown": 1 + } + } + }, + "skill": "triage", + "welcome": true, + "hash": "sha256:fb90bdc45aec5f8a" +} diff --git a/tools/skill-evals/evals/setup/preflight-floor/fixtures/case-9-first-magpie-run/report.md b/tools/skill-evals/evals/setup/preflight-floor/fixtures/case-9-first-magpie-run/report.md index 66f7d419b..f70cb7a43 100644 --- a/tools/skill-evals/evals/setup/preflight-floor/fixtures/case-9-first-magpie-run/report.md +++ b/tools/skill-evals/evals/setup/preflight-floor/fixtures/case-9-first-magpie-run/report.md @@ -20,7 +20,7 @@ The pre-flight command printed: "code": "welcome", "facts": { "family": "general", - "guide": "# \ud83d\udc26 Hello from Magpie \u2014 your project's maintainer sidekick\n\nOne minute, then straight back to what you asked for.\n\n## \ud83d\ude80 Getting started\n\n- \ud83d\udce6 **Install** from your agent's marketplace (Claude Code shown):\n `/plugin marketplace add apache/magpie`,\n then `/plugin install magpie-setup@apache-magpie` and one `/plugin install magpie-@apache-magpie` per family you want\n- \ud83d\ude4b **Configure it for yourself** \u2014 personal settings, nothing committed \u2014 `/magpie-setup:setup config`\n- \ud83d\udc65 **Adopt it for your project** \u2014 the configuration is committed to your repo and shared with every contributor \u2014\n `/magpie-setup:setup adopt` (a maintainers' decision)\n\nOn a pinned-snapshot install the commands are shorter: `/magpie-setup config`, `/magpie-setup adopt`.\n\n## \ud83d\udd04 Staying current\n\n- \u270b **By hand:** `claude plugin marketplace update apache-magpie`, then `claude plugin update @apache-magpie`\n- \ud83e\udd16 **Automatically (Claude Code):** `/plugin` \u2192 **Marketplaces** \u2192 **apache-magpie** \u2192 **Enable auto-update** \u2014\n it is off by default for third-party marketplaces like this one\n- \ud83e\udde9 Gemini CLI takes `--auto-update` at install time; Codex has no auto-update, so run `codex plugin marketplace upgrade`\n\nAfter an update, the next skill you run checks your configuration against it and proposes any fixes;\n`/magpie-setup:setup reconcile` checks everything at once\n(on a pinned snapshot, `/magpie-setup upgrade` does the update).\n\n## \ud83d\udcac Just ask\n\nTalk to Magpie in plain language \u2014 no syntax to learn.\nNothing is written, posted, or sent without your OK.\nInterrupt at any time, say no, or change your mind halfway through.\n\n## \ud83c\udfa8 You are the creator\n\nDescribe what you want a skill to do for you:\n\n- *\"from now on, always ask me before closing a stale issue\"*\n- *\"when you triage PRs, leave the bot-authored ones alone\"*\n\nMagpie records it as an override for that skill (`/magpie-setup:setup override `).\nWorth sharing? Say *\"upstream this change to Magpie\"* \u2014\nit makes the change generic and opens a PR to `apache/magpie` for you to review (`/magpie-setup:override-upstream`).\n\n## \ud83d\udcda More guides\n\nEach family can bring its own short guide, shown the first time you use it:\n\n- `mentoring` \u2014 `/magpie-setup:welcome-guide mentoring`\n- `pairing` \u2014 `/magpie-setup:welcome-guide pairing`\n- `security` \u2014 `/magpie-setup:welcome-guide security`\n- `utilities` \u2014 `/magpie-setup:welcome-guide utilities`\n\n## \ud83d\udc4b About this guide\n\n- **Continue** \u2014 show it again next time (three times at most)\n- **Dismiss** \u2014 hide it until the next Magpie upgrade\n- **Don't show again** \u2014 hide it for good; say *\"show the Magpie welcome again\"* to bring it back\n\nShow this again any time: `/magpie-setup:welcome-guide []`\n(`/magpie-setup-welcome-guide []` on a pinned snapshot).\n\n\ud83c\udf08 Prefer it in colour? Run this yourself \u2014 the `!` prefix runs it as a shell command:\n\n```text\n! PYTHONPATH=\".apache-magpie-local:$(git rev-parse --git-common-dir)/../.apache-magpie-local:$(git rev-parse --git-common-dir)/apache-magpie\" python3 -m setup_preflight.welcome show --family general --color=always\n```\n", + "guide": "# \ud83d\udc26 Hello from Magpie \u2014 your project's maintainer sidekick\n\nOne minute, then straight back to what you asked for.\n\n## \ud83d\ude80 Getting started\n\n- \ud83d\udce6 **Install** from your agent's marketplace (Claude Code shown):\n `/plugin marketplace add apache/magpie`,\n then `/plugin install magpie-setup@apache-magpie` and one `/plugin install magpie-@apache-magpie` per family you want\n- \ud83d\ude4b **Configure it for yourself** \u2014 personal settings, nothing committed \u2014 `/magpie-setup:setup config`\n- \ud83d\udc65 **Adopt it for your project** \u2014 the configuration is committed to your repo and shared with every contributor \u2014\n `/magpie-setup:setup adopt` (a maintainers' decision)\n\nOn a pinned-snapshot install the commands are shorter: `/magpie-setup config`, `/magpie-setup adopt`.\n\n## \ud83d\udd04 Staying current\n\n- \u270b **By hand:** `claude plugin marketplace update apache-magpie`, then `claude plugin update @apache-magpie`\n- \ud83e\udd16 **Automatically (Claude Code):** `/plugin` \u2192 **Marketplaces** \u2192 **apache-magpie** \u2192 **Enable auto-update** \u2014\n it is off by default for third-party marketplaces like this one\n- \ud83e\udde9 Gemini CLI takes `--auto-update` at install time; Codex has no auto-update, so run `codex plugin marketplace upgrade`\n\nAfter an update, the next skill you run checks your configuration against it and proposes any fixes;\n`/magpie-setup:setup reconcile` checks everything at once\n(on a pinned snapshot, `/magpie-setup upgrade` does the update).\n\n## \ud83d\udcac Just ask\n\nTalk to Magpie in plain language \u2014 no syntax to learn.\nNothing is written, posted, or sent without your OK.\nInterrupt at any time, say no, or change your mind halfway through.\n\n## \ud83c\udfa8 You are the creator\n\nDescribe what you want a skill to do for you:\n\n- *\"from now on, always ask me before closing a stale issue\"*\n- *\"when you triage PRs, leave the bot-authored ones alone\"*\n\nMagpie records it as an override for that skill (`/magpie-setup:setup override `).\nWorth sharing? Say *\"upstream this change to Magpie\"* \u2014\nit makes the change generic and opens a PR to `apache/magpie` for you to review (`/magpie-setup:override-upstream`).\n\n## \ud83d\udcda More guides\n\nEach family can bring its own short guide, shown the first time you use it:\n\n- `issue` \u2014 `/magpie-setup:welcome-guide issue`\n- `mentoring` \u2014 `/magpie-setup:welcome-guide mentoring`\n- `pairing` \u2014 `/magpie-setup:welcome-guide pairing`\n- `security` \u2014 `/magpie-setup:welcome-guide security`\n- `utilities` \u2014 `/magpie-setup:welcome-guide utilities`\n\n## \ud83d\udc4b About this guide\n\n- **Continue** \u2014 show it again next time (three times at most)\n- **Dismiss** \u2014 hide it until the next Magpie upgrade\n- **Don't show again** \u2014 hide it for good; say *\"show the Magpie welcome again\"* to bring it back\n\nShow this again any time: `/magpie-setup:welcome-guide []`\n(`/magpie-setup-welcome-guide []` on a pinned snapshot).\n\n\ud83c\udf08 Prefer it in colour? Run this yourself \u2014 the `!` prefix runs it as a shell command:\n\n```text\n! PYTHONPATH=\".apache-magpie-local:$(git rev-parse --git-common-dir)/../.apache-magpie-local:$(git rev-parse --git-common-dir)/apache-magpie\" python3 -m setup_preflight.welcome show --family general --color=always\n```\n", "max_shown": 3, "reason": "first-run", "shown": 0