From 917754a19ce0b5322b313e286eb388a574c9563c Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Tue, 19 May 2026 09:05:33 -0700 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=90=9E=20Fix=20500=20on=20moving-your?= =?UTF-8?q?-work-to-an-organization=20for=20GHES=20(#61294)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../account-management/moving-your-work-to-an-organization.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/account-and-profile/how-tos/account-management/moving-your-work-to-an-organization.md b/content/account-and-profile/how-tos/account-management/moving-your-work-to-an-organization.md index ea6a0595d0f7..3222fef4ced8 100644 --- a/content/account-and-profile/how-tos/account-management/moving-your-work-to-an-organization.md +++ b/content/account-and-profile/how-tos/account-management/moving-your-work-to-an-organization.md @@ -28,5 +28,9 @@ If you want your new organization to use your current personal account username, ## Further reading +{% ifversion fpt or ghec %} - [AUTOTITLE](/organizations/managing-membership-in-your-organization/inviting-users-to-join-your-organization) +{% else %} +- [AUTOTITLE](/organizations/managing-membership-in-your-organization/adding-people-to-your-organization) +{% endif %} - [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/maintaining-ownership-continuity-for-your-organization) From cea999ed19f234b0f868a291c94a763dbb2fe8e6 Mon Sep 17 00:00:00 2001 From: docs-bot <77750099+docs-bot@users.noreply.github.com> Date: Tue, 19 May 2026 09:26:17 -0700 Subject: [PATCH 2/7] Update docs changelog (for PR #61160) (#61257) Co-authored-by: github-actions[bot] Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2864ca1dec75..77343f06adb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ We published the first iteration of a [journey landing page](https://docs.github
+**15 May 2026** + +We've published a new [GitHub Secret Protection adoption journey landing page](https://docs.github.com/en/code-security/tutorials/secret-protection-adoption-path) for AppSec administrators. Our content audit found that while individual GHSP articles existed, there was no clear end-to-end path from evaluation to organization-wide rollout. + +The new page organizes existing content into a 5-phase adoption journey: assess secret risk, evaluate fit and cost, pilot with selected repositories, monitor metrics, and scale protection across your organization 🎉 + +
+ **12 May 2026** We have now published the GitHub Enterprise Server (GHES) 3.21 release candidate notes. You can read the full notes here: From a31c5c2f3238b9659212630cb778b6ab95e1d517 Mon Sep 17 00:00:00 2001 From: Siara <108543037+SiaraMist@users.noreply.github.com> Date: Tue, 19 May 2026 09:52:29 -0700 Subject: [PATCH 3/7] Copilot CLI Use case library (#61225) Co-authored-by: Kevin Sundstrom <74620456+kevinsundstrom@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .../extracting-information.md | 73 ---------- .../communicate-effectively/index.md | 13 -- .../debug-errors/diagnose-test-failures.md | 102 -------------- .../document-code/creating-issues.md | 80 ----------- .../analyze-functionality/analyze-feedback.md | 5 +- .../explore-implementations.md | 5 +- .../analyze-functionality/index.md | 3 +- .../analyze-security/find-vulnerabilities.md | 5 +- .../analyze-security/index.md | 3 +- .../manage-dependency-updates.md | 5 +- .../secure-your-repository.md | 5 +- .../creating-diagrams.md | 6 +- .../creating-templates.md | 6 +- .../generating-tables.md | 6 +- .../communicate-effectively/index.md | 16 +++ .../summarize-repository-activity.md | 59 ++++++++ .../synthesizing-research.md | 6 +- .../debug-errors/debug-invalid-json.md | 5 +- .../debug-errors/diagnose-ci-test-failures.md | 131 ++++++++++++++++++ .../debug-errors/handle-api-rate-limits.md | 5 +- .../debug-errors/index.md | 6 +- .../document-code/document-legacy-code.md | 5 +- .../document-code/explain-complex-logic.md | 5 +- .../document-code/explain-legacy-code.md | 5 +- ...iling-issues-without-breaking-your-flow.md | 107 ++++++++++++++ .../document-code/index.md | 5 +- .../document-code/sync-documentation.md | 5 +- .../write-discussions-or-blog-posts.md | 5 +- .../generate-code/implement-a-feature.md | 114 +++++++++++++++ .../copilot-cookbook/generate-code/index.md | 12 ++ .../index.md | 15 +- .../refactor-code/decouple-business-logic.md | 5 +- .../refactor-code/fix-database-deadlocks.md | 5 +- .../refactor-code/fix-lint-errors.md | 5 +- .../refactor-code/handle-cross-cutting.md | 5 +- .../refactor-code/improve-code-readability.md | 5 +- .../refactor-code/index.md | 3 +- .../refactor-data-access-layers.md | 5 +- .../refactor-code/refactor-design-patterns.md | 5 +- .../refactor-for-optimization.md | 5 +- .../refactor-for-sustainability.md | 6 +- .../simplify-inheritance-hierarchies.md | 5 +- .../refactor-code/translate-code.md | 5 +- .../testing-code/create-end-to-end-tests.md | 5 +- .../testing-code/create-mock-objects.md | 5 +- .../testing-code/generate-unit-tests.md | 5 +- .../testing-code/index.md | 3 +- .../testing-code/update-unit-tests.md | 8 +- .../tutorials/customization-library/index.md | 3 + content/copilot/tutorials/index.md | 4 +- content/index.md | 2 +- data/ui.yml | 1 + package-lock.json | 17 +++ .../tests/unit/frontmatter-schema.ts | 4 +- src/fixtures/fixtures/data/ui.yml | 1 + .../context/CategoryLandingContext.tsx | 11 +- src/frame/lib/frontmatter.ts | 14 ++ src/frame/middleware/context/generic-toc.ts | 2 + src/landings/components/CategoryLanding.tsx | 20 ++- .../components/CookBookArticleCard.tsx | 1 + .../components/CookBookFilter.module.scss | 5 + src/landings/components/CookBookFilter.tsx | 75 +++++++--- src/landings/types.ts | 6 + src/types/types.ts | 3 + 64 files changed, 703 insertions(+), 374 deletions(-) delete mode 100644 content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/extracting-information.md delete mode 100644 content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/index.md delete mode 100644 content/copilot/tutorials/copilot-chat-cookbook/debug-errors/diagnose-test-failures.md delete mode 100644 content/copilot/tutorials/copilot-chat-cookbook/document-code/creating-issues.md rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/analyze-functionality/analyze-feedback.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/analyze-functionality/explore-implementations.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/analyze-functionality/index.md (69%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/analyze-security/find-vulnerabilities.md (96%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/analyze-security/index.md (67%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/analyze-security/manage-dependency-updates.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/analyze-security/secure-your-repository.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/communicate-effectively/creating-diagrams.md (95%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/communicate-effectively/creating-templates.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/communicate-effectively/generating-tables.md (96%) create mode 100644 content/copilot/tutorials/copilot-cookbook/communicate-effectively/index.md create mode 100644 content/copilot/tutorials/copilot-cookbook/communicate-effectively/summarize-repository-activity.md rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/communicate-effectively/synthesizing-research.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/debug-errors/debug-invalid-json.md (96%) create mode 100644 content/copilot/tutorials/copilot-cookbook/debug-errors/diagnose-ci-test-failures.md rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/debug-errors/handle-api-rate-limits.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/debug-errors/index.md (61%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/document-code/document-legacy-code.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/document-code/explain-complex-logic.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/document-code/explain-legacy-code.md (97%) create mode 100644 content/copilot/tutorials/copilot-cookbook/document-code/filing-issues-without-breaking-your-flow.md rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/document-code/index.md (67%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/document-code/sync-documentation.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/document-code/write-discussions-or-blog-posts.md (98%) create mode 100644 content/copilot/tutorials/copilot-cookbook/generate-code/implement-a-feature.md create mode 100644 content/copilot/tutorials/copilot-cookbook/generate-code/index.md rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/index.md (67%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/decouple-business-logic.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/fix-database-deadlocks.md (99%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/fix-lint-errors.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/handle-cross-cutting.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/improve-code-readability.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/index.md (78%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/refactor-data-access-layers.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/refactor-design-patterns.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/refactor-for-optimization.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/refactor-for-sustainability.md (95%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/simplify-inheritance-hierarchies.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/refactor-code/translate-code.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/testing-code/create-end-to-end-tests.md (98%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/testing-code/create-mock-objects.md (97%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/testing-code/generate-unit-tests.md (96%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/testing-code/index.md (66%) rename content/copilot/tutorials/{copilot-chat-cookbook => copilot-cookbook}/testing-code/update-unit-tests.md (97%) diff --git a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/extracting-information.md b/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/extracting-information.md deleted file mode 100644 index eb85aef24285..000000000000 --- a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/extracting-information.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Extracting information -shortTitle: Extract information -intro: Copilot Chat in GitHub can help you extract key information from issues and discussions. -versions: - feature: copilot -complexity: - - Simple -octicon: copilot -category: - - Communicate effectively - - Author and optimize with Copilot - - Scale institutional knowledge -contentType: tutorials ---- - -{% data variables.copilot.copilot_chat %} can help you extract key information from issues and discussions, making it easier to summarize and understand the content. You can ask {% data variables.copilot.copilot_chat_short %} to identify important details, such as action items, deadlines, or specific requests. - -## Example scenario 1 - -You are reviewing a long discussion thread about a feature request. You want to quickly identify the main points and any action items that need to be addressed. - -## Example prompt - -```copilot copy -Can you summarize the key points and action items from this discussion? -``` - -## Example response - -{% data reusables.copilot.example-prompts.response-is-an-example %} - -````text -Key Points: -- The feature request aims to improve the user interface for better accessibility. -- There are concerns about the impact on existing users and workflows. -- Action items include gathering feedback from users and conducting usability testing. -Action Items: -- [ ] Gather feedback from users by the end of the week. -- [ ] Conduct usability testing with a focus group next month. -```` - -## Example scenario 2 - -You have a number of open issues assigned to you, and you want to extract the deadlines and priorities for each issue to help you prioritize your work. - -## Example prompt - -```copilot copy prompt -Can you list the open issues assigned to me, along with their deadlines and priorities? -``` - -## Example response - -{% data reusables.copilot.example-prompts.response-is-an-example %} - -````text -Issue 1: -- Deadline: Next Friday -- Priority: High - -Issue 2: -- Deadline: End of the month -- Priority: Medium - -Issue 3: -- Deadline: No specific deadline -- Priority: Low -```` - -## Further reading - -{% data reusables.copilot.example-prompts.further-reading-items %} diff --git a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/index.md b/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/index.md deleted file mode 100644 index 4b57a9b46ca1..000000000000 --- a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/index.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Communicate effectively -intro: 'Discover ways that you can use {% data variables.product.prodname_copilot %} to communicate effectively with your team and stakeholders.' -versions: - feature: copilot -children: - - /creating-templates - - /extracting-information - - /synthesizing-research - - /creating-diagrams - - /generating-tables -contentType: tutorials ---- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/diagnose-test-failures.md b/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/diagnose-test-failures.md deleted file mode 100644 index e1ad0dd947bc..000000000000 --- a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/diagnose-test-failures.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Diagnosing test failures -shortTitle: Diagnose test failures -intro: '{% data variables.copilot.copilot_chat_short %} can help you understand why a test is failing and suggest how to fix it.' -versions: - feature: copilot -category: - - Debugging code - - Author and optimize with Copilot - - Improve quality and maintainability -complexity: - - Intermediate -octicon: bug -contentType: tutorials ---- - -{% data variables.copilot.copilot_chat_short %} can analyze test failures and help identify potential causes. - -## Example scenario: Tests passing locally but failing in CI - -Consider a scenario where you have a test that passes on your local machine but sometimes fails in CI. {% data variables.copilot.copilot_chat_short %} can help identify the reason for the failure. - -In this example, the code being tested defines a simple order service (`order.py`), and there's a corresponding test that checks if an order was created today (`test_order_service.py`). - -## Example prompt - -The prompt below provides {% data variables.product.prodname_copilot_short %} with the relevant code and test files (using `#file:`) and includes a copy/paste of the relevant excerpt from the CI failure. - -```copilot copy -Please take a look at this CI failure message. The test passes locally, but intermittently fails in CI. Can you help me figure out if this looks like a code bug, environment issue, or a flaky test? - -Failure: - -___ TestOrderService.test_order_created_today ___ -> assert order["created_date"] == date.today() -E AssertionError: assert datetime.date(2024, 1, 15) == datetime.date(2024, 1, 16) - -test_order_service.py:45: AssertionError - -#file:order.py -#file:test_order_service.py - -``` - -## Example response - -{% data reusables.copilot.example-prompts.response-is-an-example %} - -{% data variables.copilot.copilot_chat_short %} notices that the dates are exactly one day apart and identifies that this could be a **timezone** or **time-boundary** issue. - -The local machine and CI runner may be using different timezone settings or deriving `today` from different clocks (UTC vs. local time), so when the test runs near midnight, `date.today()` can return different dates in each environment. - -{% data variables.copilot.copilot_chat_short %} suggests treating the failure as test flakiness caused by environment/time assumptions (and not a logic bug), and fixing it by standardizing how `today` is computed across environments. - -## Example scenario 2: Intermittent test failures - -Consider a scenario where a test sometimes passes and sometimes fails on the same machine. {% data variables.copilot.copilot_chat_short %} can compare logs from passing and failing runs to help identify the cause. - -In this example, the code under test uses a background job in `order_service.py` to update an order's status asynchronously, and a test in `test_order_service.py` asserts that the final status is `"processed"`. - -## Example prompt - -The prompt below provides {% data variables.product.prodname_copilot_short %} with the failure message, the log excerpts from both a passing and failing run, and the relevant code files (using `#file:`). - -```copilot copy -This test passes sometimes and fails sometimes. Can you compare the logs and help me figure out why? - -Failure message: - -> assert order.status == "processed" -E AssertionError: assert "pending" == "processed" - -test_order_service.py:62: AssertionError - -Logs from a passing run: -[DEBUG] Created order #1234 -[DEBUG] Background job started for order #1234 -[DEBUG] Background job completed (52ms) -[DEBUG] Checking order status -[DEBUG] Order #1234 status: processed - -Logs from the failing run: -[DEBUG] Created order #1234 -[DEBUG] Background job started for order #1234 -[DEBUG] Checking order status -[DEBUG] Order #1234 status: pending - -#file:order_service.py -#file:test_order_service.py -``` - -## Example response - -{% data reusables.copilot.example-prompts.response-is-an-example %} - -{% data variables.copilot.copilot_chat_short %} compares the two logs and notices that in the passing run, the background job completed *before* the status check, while in the failing run, the status was checked while the job was still running. {% data variables.copilot.copilot_chat_short %} notes that this is a **race condition**, as the test doesn't wait for the background job to finish. - -{% data variables.copilot.copilot_chat_short %} suggests adding a mechanism to ensure the job completes before asserting, such as running the job synchronously, awaiting completion (for example, via a callback), or polling. - -## Further reading - -{% data reusables.copilot.example-prompts.further-reading-items %} diff --git a/content/copilot/tutorials/copilot-chat-cookbook/document-code/creating-issues.md b/content/copilot/tutorials/copilot-chat-cookbook/document-code/creating-issues.md deleted file mode 100644 index 91e987a0f5e0..000000000000 --- a/content/copilot/tutorials/copilot-chat-cookbook/document-code/creating-issues.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: Creating issues -shortTitle: Create issues -intro: '{% data variables.copilot.copilot_chat_short %} can help you quickly create issues without filling out every field manually.' -versions: - feature: copilot -complexity: - - Simple -octicon: copilot -category: - - Documenting code - - Author and optimize with Copilot - - Scale institutional knowledge -contentType: tutorials ---- - -Creating issues manually can be time-consuming. {% data variables.copilot.copilot_chat_short %} lets you create issues from natural language, and automatically fills in the title, body, labels, and other metadata based on your prompt. - -## Example scenario - -You're working on an API service and need to add server-side validation to the `createUser` endpoint. Instead of drafting the issue manually, you use {% data variables.copilot.copilot_chat_short %} to generate a detailed issue description that includes an example implementation of the validation middleware. - -The following snippet shows the current implementation of the `createUser` route, before validation is added: - -```javascript -// Route -app.post('/users', validateCreateUser, (req, res) => { - const { username, email } = req.body; - // Simulate user creation - res.status(201).json({ message: 'User created', user: { username, email } }); -}); -``` - -## Example prompt - -`In octo-org/octo-repo, create an issue to add server-side validation for the createUser API endpoint. Include an example of how to validate the request body using an existing middleware pattern. Label it with "backend" and "enhancement".` - -## Example response - -{% data reusables.copilot.example-prompts.response-is-an-example %} - -When you submit the prompt, {% data variables.copilot.copilot_chat_short %} generates a draft issue based on your description and includes a code snippet. You can review and edit the draft before creating the issue. - -```markdown -## Problem -The `createUser` API endpoint currently lacks robust server-side validation for incoming requests. To ensure data integrity and security, we should validate the request body before proceeding with user creation. - -**Current API endpoint:** -// Route -app.post('/users', validateCreateUser, (req, res) => { - const { username, email } = req.body; - // Simulate user creation - res.status(201).json({ message: 'User created', user: { username, email } }); -}); - -## Proposal -- Add server-side validation for the request body using the existing middleware pattern. -- Ensure required fields (`username`, `email`) are present and valid. -- Return a 400 Bad Request response if validation fails. - -**Example (middleware pattern):** -function validateCreateUser(req, res, next) { - const { username, email } = req.body; - if (!username || !email) { - return res.status(400).json({ error: 'Username and email are required.' }); - } - // Additional validation logic here - next(); -} - -app.post('/users', validateCreateUser, (req, res) => { - // ... -}); - - -## Acceptance Criteria -- Server-side validation middleware is added to the `createUser` endpoint. -- Request body is properly validated. -- Appropriate error responses are returned for invalid requests. -``` diff --git a/content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/analyze-feedback.md b/content/copilot/tutorials/copilot-cookbook/analyze-functionality/analyze-feedback.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/analyze-feedback.md rename to content/copilot/tutorials/copilot-cookbook/analyze-functionality/analyze-feedback.md index 62023e3c7e3a..df8b0c17102b 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/analyze-feedback.md +++ b/content/copilot/tutorials/copilot-cookbook/analyze-functionality/analyze-feedback.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions/analyzing-and-incorporating-user-feedback - /copilot/tutorials/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions/analyzing-and-incorporating-user-feedback - /copilot/tutorials/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions/analyze-feedback + - /copilot/tutorials/copilot-chat-cookbook/analyze-functionality/analyze-feedback versions: feature: copilot category: - Functionality analysis - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Intermediate +surface: + - Chat octicon: lightbulb contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/explore-implementations.md b/content/copilot/tutorials/copilot-cookbook/analyze-functionality/explore-implementations.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/explore-implementations.md rename to content/copilot/tutorials/copilot-cookbook/analyze-functionality/explore-implementations.md index 61ad24b0d845..64546ac1bf8d 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/explore-implementations.md +++ b/content/copilot/tutorials/copilot-cookbook/analyze-functionality/explore-implementations.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions/exploring-potential-feature-implementations - /copilot/tutorials/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions/exploring-potential-feature-implementations - /copilot/tutorials/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions/explore-implementations + - /copilot/tutorials/copilot-chat-cookbook/analyze-functionality/explore-implementations versions: feature: copilot category: - Functionality analysis - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Intermediate +surface: + - Chat octicon: lightbulb contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/index.md b/content/copilot/tutorials/copilot-cookbook/analyze-functionality/index.md similarity index 69% rename from content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/index.md rename to content/copilot/tutorials/copilot-cookbook/analyze-functionality/index.md index 10077e227a4d..04bd0c963147 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/analyze-functionality/index.md +++ b/content/copilot/tutorials/copilot-cookbook/analyze-functionality/index.md @@ -1,10 +1,11 @@ --- title: Analyze functionality -intro: 'Discover ways that you can use {% data variables.product.prodname_copilot %} to improve the functionality of your project.' +intro: Discover ways that you can use {% data variables.product.prodname_copilot %} to improve the functionality of your project. redirect_from: - /copilot/example-prompts-for-github-copilot-chat/functionality-analysis-and-feature-suggestions - /copilot/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions - /copilot/tutorials/copilot-chat-cookbook/functionality-analysis-and-feature-suggestions + - /copilot/tutorials/copilot-chat-cookbook/analyze-functionality versions: feature: copilot children: diff --git a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/find-vulnerabilities.md b/content/copilot/tutorials/copilot-cookbook/analyze-security/find-vulnerabilities.md similarity index 96% rename from content/copilot/tutorials/copilot-chat-cookbook/analyze-security/find-vulnerabilities.md rename to content/copilot/tutorials/copilot-cookbook/analyze-security/find-vulnerabilities.md index e20c3fbf7d95..4722ee948ed1 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/find-vulnerabilities.md +++ b/content/copilot/tutorials/copilot-cookbook/analyze-security/find-vulnerabilities.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/security-analysis/finding-existing-vulnerabilities-in-code - /copilot/tutorials/copilot-chat-cookbook/security-analysis/finding-existing-vulnerabilities-in-code - /copilot/tutorials/copilot-chat-cookbook/security-analysis/find-vulnerabilities + - /copilot/tutorials/copilot-chat-cookbook/analyze-security/find-vulnerabilities versions: feature: copilot category: - Security analysis - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: code contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/index.md b/content/copilot/tutorials/copilot-cookbook/analyze-security/index.md similarity index 67% rename from content/copilot/tutorials/copilot-chat-cookbook/analyze-security/index.md rename to content/copilot/tutorials/copilot-cookbook/analyze-security/index.md index 599425b4f8b3..2ed673a2e750 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/index.md +++ b/content/copilot/tutorials/copilot-cookbook/analyze-security/index.md @@ -1,10 +1,11 @@ --- title: Analyze security -intro: 'Discover ways that you can use {% data variables.product.prodname_copilot %} to improve the security of your code.' +intro: Discover ways that you can use {% data variables.product.prodname_copilot %} to improve the security of your code. redirect_from: - /copilot/example-prompts-for-github-copilot-chat/security-analysis - /copilot/copilot-chat-cookbook/security-analysis - /copilot/tutorials/copilot-chat-cookbook/security-analysis + - /copilot/tutorials/copilot-chat-cookbook/analyze-security versions: feature: copilot children: diff --git a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/manage-dependency-updates.md b/content/copilot/tutorials/copilot-cookbook/analyze-security/manage-dependency-updates.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/analyze-security/manage-dependency-updates.md rename to content/copilot/tutorials/copilot-cookbook/analyze-security/manage-dependency-updates.md index 3428957a5011..0f241248470c 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/manage-dependency-updates.md +++ b/content/copilot/tutorials/copilot-cookbook/analyze-security/manage-dependency-updates.md @@ -8,12 +8,13 @@ category: - Security analysis - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Simple +surface: + - Chat octicon: code redirect_from: - /copilot/tutorials/copilot-chat-cookbook/security-analysis/managing-dependency-updates - /copilot/tutorials/copilot-chat-cookbook/security-analysis/manage-dependency-updates + - /copilot/tutorials/copilot-chat-cookbook/analyze-security/manage-dependency-updates contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/secure-your-repository.md b/content/copilot/tutorials/copilot-cookbook/analyze-security/secure-your-repository.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/analyze-security/secure-your-repository.md rename to content/copilot/tutorials/copilot-cookbook/analyze-security/secure-your-repository.md index 46000138080a..a959ba3632ab 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/analyze-security/secure-your-repository.md +++ b/content/copilot/tutorials/copilot-cookbook/analyze-security/secure-your-repository.md @@ -8,12 +8,13 @@ category: - Security analysis - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Simple +surface: + - Chat octicon: code redirect_from: - /copilot/tutorials/copilot-chat-cookbook/security-analysis/securing-your-repository - /copilot/tutorials/copilot-chat-cookbook/security-analysis/secure-your-repository + - /copilot/tutorials/copilot-chat-cookbook/analyze-security/secure-your-repository contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-diagrams.md b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/creating-diagrams.md similarity index 95% rename from content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-diagrams.md rename to content/copilot/tutorials/copilot-cookbook/communicate-effectively/creating-diagrams.md index e23d3ce97667..7e600a646932 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-diagrams.md +++ b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/creating-diagrams.md @@ -4,8 +4,8 @@ shortTitle: Create diagrams intro: GitHub Copilot Chat can help you create diagrams to better understand your data and communicate insights. versions: feature: copilot -complexity: - - Simple +surface: + - Chat octicon: copilot category: - Communicate effectively @@ -13,6 +13,8 @@ category: - Scale institutional knowledge - Author and optimize with Copilot contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-diagrams --- {% data variables.copilot.copilot_chat %} on {% data variables.product.prodname_dotcom_the_website %} can help you create Mermaid diagrams to visualize data, making it easier to understand and communicate insights. You can ask {% data variables.copilot.copilot_chat_short %} to generate diagrams based on your data or code, and it will provide you with the necessary code to create those diagrams. diff --git a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-templates.md b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/creating-templates.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-templates.md rename to content/copilot/tutorials/copilot-cookbook/communicate-effectively/creating-templates.md index 2a65e57e1f54..19697c309f3c 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-templates.md +++ b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/creating-templates.md @@ -8,10 +8,12 @@ category: - Communicate effectively - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Simple +surface: + - Chat octicon: copilot contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/communicate-effectively/creating-templates --- {% data variables.copilot.copilot_chat %} can help you create templates for various purposes, such as project documentation, code snippets, or issue tracking. By using templates, you can streamline your workflow and ensure consistency across your projects. diff --git a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/generating-tables.md b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/generating-tables.md similarity index 96% rename from content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/generating-tables.md rename to content/copilot/tutorials/copilot-cookbook/communicate-effectively/generating-tables.md index ba3157a9a43b..69e4add696dd 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/generating-tables.md +++ b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/generating-tables.md @@ -4,14 +4,16 @@ shortTitle: Generate tables intro: '{% data variables.copilot.copilot_chat_short %} can help you create tables to organize information and present it clearly.' versions: feature: copilot -complexity: - - Simple +surface: + - Chat octicon: copilot category: - Communicate effectively - Author and optimize with Copilot - Scale institutional knowledge contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/communicate-effectively/generating-tables --- {% data variables.copilot.copilot_chat %} can help you create tables for various purposes, such as organizing data, comparing options, or summarizing information. By using tables, you can present information in a clear and structured way that is easy to read and understand. You can ask {% data variables.copilot.copilot_chat_short %} to generate tables based on existing data or to create empty tables based on your specific requirements. diff --git a/content/copilot/tutorials/copilot-cookbook/communicate-effectively/index.md b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/index.md new file mode 100644 index 000000000000..a100c2b65dde --- /dev/null +++ b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/index.md @@ -0,0 +1,16 @@ +--- +title: Communicate effectively +intro: Discover ways that you can use {% data variables.product.prodname_copilot %} to communicate effectively with your team and stakeholders. +versions: + feature: copilot +children: + - /creating-templates + - /summarize-repository-activity + - /synthesizing-research + - /creating-diagrams + - /generating-tables +contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/communicate-effectively +--- + diff --git a/content/copilot/tutorials/copilot-cookbook/communicate-effectively/summarize-repository-activity.md b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/summarize-repository-activity.md new file mode 100644 index 000000000000..e3bed7038676 --- /dev/null +++ b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/summarize-repository-activity.md @@ -0,0 +1,59 @@ +--- +title: Triage and summarize repository activity +shortTitle: Summarize repository activity +intro: Copilot can extract key information from repositories you follow to keep you up-to-date on recent activity. +versions: + feature: copilot +surface: + - CLI +octicon: copilot +category: + - Communicate effectively + - Author and optimize with Copilot + - Scale institutional knowledge +contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/communicate-effectively/extracting-information + - /copilot/tutorials/copilot-chat-cookbook/communicate-effectively/summarize-repository-activity +--- + +{% data variables.copilot.copilot_cli %} can help you summarize all recent activity in a repository. {% data variables.copilot.copilot_cli_short %} will find information about issues, pull requests, commits, CI health, and security notifications, and you can ask it to summarize this information in a report for you. + +## Example scenario + +You are returning to a repository after a week away and need to catch up. You want a single report that covers recent activity and the current health of the project so you can prioritize your work. + +## Example prompt + +```text copy +Summarize activity in this repository over the past week. Highlight anything that looks blocked or urgent, and suggest what I should prioritize. +``` + +## Example response + +{% data reusables.copilot.example-prompts.response-is-an-example %} + +````text +Repository activity summary (past 7 days) + +P1 — Urgent +- CI failing on `main`: the `build-and-test` workflow has been red since commit a1b2c3d ("Refactor auth middleware"). Three subsequent PRs are blocked from merging. +- Security alert: a high-severity Dependabot alert for `lodash` (CVE-2025-12345) is open and unassigned. + +P2 — Needs attention soon +- PR #482 ("Add OAuth device flow support") has 2 approvals and passing checks, but has been waiting 4 days for a final sign-off from a code owner. +- Issue #475 ("Crash on startup with empty config file") was reopened after a regression; 5 new comments and a reproduction case were added yesterday. + +P3 — Routine +- 4 new issues opened, mostly minor UI bugs and documentation requests. None are labeled `bug:critical`. +- 12 commits merged to `main` across 6 PRs, primarily dependency bumps and test cleanup. + +Suggested next steps: +1. Investigate and fix the failing `build-and-test` workflow to unblock merges. +2. Triage the Dependabot alert and assign an owner. +3. Review PR #482 so it can ship. +```` + +## Further reading + +* [AUTOTITLE](/copilot/how-tos/copilot-cli) diff --git a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/synthesizing-research.md b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/synthesizing-research.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/synthesizing-research.md rename to content/copilot/tutorials/copilot-cookbook/communicate-effectively/synthesizing-research.md index 9ecb12be99df..3c2ce0e86637 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/communicate-effectively/synthesizing-research.md +++ b/content/copilot/tutorials/copilot-cookbook/communicate-effectively/synthesizing-research.md @@ -4,14 +4,16 @@ shortTitle: Synthesize research intro: Copilot Chat can help you synthesize research findings and insights from multiple sources into a cohesive summary. versions: feature: copilot -complexity: - - Simple +surface: + - Chat octicon: copilot category: - Communicate effectively - Author and optimize with Copilot - Scale institutional knowledge contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/communicate-effectively/synthesizing-research --- When working with research data, {% data variables.copilot.copilot_chat_short %} can assist you in synthesizing findings and insights from multiple sources into a cohesive summary. This can be particularly useful for preparing reports, presentations, or discussions with stakeholders. You can ask {% data variables.copilot.copilot_chat_short %} to identify key trends, insights, and recommendations based on the research data you provide. diff --git a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/debug-invalid-json.md b/content/copilot/tutorials/copilot-cookbook/debug-errors/debug-invalid-json.md similarity index 96% rename from content/copilot/tutorials/copilot-chat-cookbook/debug-errors/debug-invalid-json.md rename to content/copilot/tutorials/copilot-cookbook/debug-errors/debug-invalid-json.md index 40e73ccefdee..032304d897cb 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/debug-invalid-json.md +++ b/content/copilot/tutorials/copilot-cookbook/debug-errors/debug-invalid-json.md @@ -8,14 +8,15 @@ redirect_from: - /copilot/tutorials/copilot-chat-cookbook/debugging-errors/debugging-invalid-json - /copilot/tutorials/copilot-chat-cookbook/debugging-errors/debug-invalid-json - /copilot/copilot-chat-cookbook/debugging-errors/debugging-invalid-json + - /copilot/tutorials/copilot-chat-cookbook/debug-errors/debug-invalid-json versions: feature: copilot category: - Debugging code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: bug contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-cookbook/debug-errors/diagnose-ci-test-failures.md b/content/copilot/tutorials/copilot-cookbook/debug-errors/diagnose-ci-test-failures.md new file mode 100644 index 000000000000..84881418cd0d --- /dev/null +++ b/content/copilot/tutorials/copilot-cookbook/debug-errors/diagnose-ci-test-failures.md @@ -0,0 +1,131 @@ +--- +title: Diagnosing CI test failures +shortTitle: Diagnose CI test failures +intro: Use {% data variables.copilot.copilot_cli_short %} to pull CI logs, correlate failures to local code, and fix issues without leaving the terminal. +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/debug-errors/diagnose-test-failures + - /copilot/tutorials/copilot-chat-cookbook/debug-errors/diagnose-ci-test-failures +versions: + feature: copilot +category: + - Debugging code + - Author and optimize with Copilot + - Improve quality and maintainability +surface: + - CLI +octicon: bug +contentType: tutorials +--- + +{% data variables.copilot.copilot_cli_short %} ships with the GitHub MCP server, which gives it direct access to your GitHub Actions workflow runs, job logs, and check statuses. Combined with access to your local files, it can fetch CI failure details, correlate them to your code, and propose fixes from your terminal. + +## Example scenario 1: Tests pass locally but fail in CI + +You have a test that passes on your local machine but fails in CI. You can ask {% data variables.copilot.copilot_cli_short %} to investigate this test failure directly. + +In this example, the code being tested defines a simple order service (`order.py`), and there is a corresponding test that checks if an order was created today (`test_order_service.py`). + +### Example prompt + +```copilot copy +My CI is failing on this branch. Can you pull the latest workflow run +logs, figure out what is failing, and help me fix it? The relevant files +are @order.py and @test_order_service.py +``` + +### Example response + +{% data reusables.copilot.example-prompts.response-is-an-example %} + +{% data variables.copilot.copilot_cli_short %} uses the GitHub MCP server to fetch your latest workflow runs on the current branch, identifies the failed job, and retrieves its logs. It finds the following failure: + +```text +___ TestOrderService.test_order_created_today ___ +> assert order["created_date"] == date.today() +E AssertionError: assert datetime.date(2024, 1, 15) == datetime.date(2024, 1, 16) + +test_order_service.py:45: AssertionError +``` + +After reading both local files, {% data variables.copilot.copilot_cli_short %} notices that the dates are exactly one day apart and identifies this as a **timezone boundary issue**. The CI runner uses UTC while your local machine uses a different timezone. When the test runs near midnight, `date.today()` returns different dates in each environment. + +{% data variables.copilot.copilot_cli_short %} suggests standardizing how `today` is computed by injecting a clock dependency or pinning the timezone: + +```python +from datetime import timezone, datetime + +def get_today(): + return datetime.now(timezone.utc).date() +``` + +It applies the fix to both `order.py` and `test_order_service.py`, updating all references to use the new `get_today()` helper. + +After the fix, you can verify the changes and run the tests locally: + +1. Run `/diff` to review exactly what {% data variables.copilot.copilot_cli_short %} changed. +1. Run `!pytest test_order_service.py` to confirm tests pass locally. +1. Push the fix and let CI re-run. + +## Example scenario 2: Intermittent test failures with race conditions + +A test sometimes passes and sometimes fails on the same machine. You want {% data variables.copilot.copilot_cli_short %} to compare logs from passing and failing runs to identify the cause. + +In this example, the code under test uses a background job in `order_service.py` to update an order's status asynchronously, and a test in `test_order_service.py` asserts that the final status is `"processed"`. + +### Example prompt for race conditions + +```copilot copy +This test passes sometimes and fails sometimes. Can you pull the logs +from the last passing and failing CI runs for test_order_processed +on this branch, compare them, and figure out what is going wrong? +Relevant files: @order_service.py @test_order_service.py +``` + +### Example response for race conditions + +{% data reusables.copilot.example-prompts.response-is-an-example %} + +{% data variables.copilot.copilot_cli_short %} uses the GitHub MCP server to list recent workflow runs on the current branch, identifies one passing and one failing run, and retrieves the logs for both. It compares them: + +**Passing run:** + +```text +[DEBUG] Created order #1234 +[DEBUG] Background job started for order #1234 +[DEBUG] Background job completed (52ms) +[DEBUG] Checking order status +[DEBUG] Order #1234 status: processed +``` + +**Failing run:** + +```text +[DEBUG] Created order #1234 +[DEBUG] Background job started for order #1234 +[DEBUG] Checking order status +[DEBUG] Order #1234 status: pending +``` + +{% data variables.copilot.copilot_cli_short %} spots that in the passing run, the background job completed before the status check, while in the failing run, the status was checked while the job was still running. It identifies this as a **race condition** because the test does not wait for the background job to finish. + +{% data variables.copilot.copilot_cli_short %} suggests adding an explicit wait mechanism before asserting and proposes a fix using a polling helper: + +```python +import time + +def wait_for_status(order_id, expected, timeout=5): + start = time.time() + while time.time() - start < timeout: + order = get_order(order_id) + if order.status == expected: + return order + time.sleep(0.1) + raise TimeoutError( + f"Order {order_id} did not reach '{expected}' within {timeout}s" + ) +``` + + +## Further reading + +* - [AUTOTITLE](/copilot/how-tos/copilot-cli) diff --git a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/handle-api-rate-limits.md b/content/copilot/tutorials/copilot-cookbook/debug-errors/handle-api-rate-limits.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/debug-errors/handle-api-rate-limits.md rename to content/copilot/tutorials/copilot-cookbook/debug-errors/handle-api-rate-limits.md index b1a4681386e3..e6edff472870 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/handle-api-rate-limits.md +++ b/content/copilot/tutorials/copilot-cookbook/debug-errors/handle-api-rate-limits.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/debugging-errors/handling-api-rate-limits - /copilot/tutorials/copilot-chat-cookbook/debugging-errors/handling-api-rate-limits - /copilot/tutorials/copilot-chat-cookbook/debugging-errors/handle-api-rate-limits + - /copilot/tutorials/copilot-chat-cookbook/debug-errors/handle-api-rate-limits versions: feature: copilot category: - Debugging code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: bug contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/index.md b/content/copilot/tutorials/copilot-cookbook/debug-errors/index.md similarity index 61% rename from content/copilot/tutorials/copilot-chat-cookbook/debug-errors/index.md rename to content/copilot/tutorials/copilot-cookbook/debug-errors/index.md index 108e190f9229..2b9086a546d7 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/debug-errors/index.md +++ b/content/copilot/tutorials/copilot-cookbook/debug-errors/index.md @@ -1,15 +1,17 @@ --- title: Debug errors -intro: 'Discover ways that you can use {% data variables.product.prodname_copilot %} to debug errors during development.' +intro: Discover ways that you can use {% data variables.product.prodname_copilot %} to debug errors during development. redirect_from: - /copilot/example-prompts-for-github-copilot-chat/debugging-errors - /copilot/copilot-chat-cookbook/debugging-errors - /copilot/tutorials/copilot-chat-cookbook/debugging-errors + - /copilot/tutorials/copilot-chat-cookbook/debug-errors versions: feature: copilot children: - /debug-invalid-json - /handle-api-rate-limits - - /diagnose-test-failures + - /diagnose-ci-test-failures contentType: tutorials --- + diff --git a/content/copilot/tutorials/copilot-chat-cookbook/document-code/document-legacy-code.md b/content/copilot/tutorials/copilot-cookbook/document-code/document-legacy-code.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/document-code/document-legacy-code.md rename to content/copilot/tutorials/copilot-cookbook/document-code/document-legacy-code.md index d65232f0f999..84c1ce4fb606 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/document-code/document-legacy-code.md +++ b/content/copilot/tutorials/copilot-cookbook/document-code/document-legacy-code.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/documenting-code/documenting-legacy-code - /copilot/tutorials/copilot-chat-cookbook/documenting-code/documenting-legacy-code - /copilot/tutorials/copilot-chat-cookbook/documenting-code/document-legacy-code + - /copilot/tutorials/copilot-chat-cookbook/document-code/document-legacy-code versions: feature: copilot category: - Documenting code - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Simple +surface: + - Chat octicon: book contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/document-code/explain-complex-logic.md b/content/copilot/tutorials/copilot-cookbook/document-code/explain-complex-logic.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/document-code/explain-complex-logic.md rename to content/copilot/tutorials/copilot-cookbook/document-code/explain-complex-logic.md index 81f8796995b8..5eb0744b042d 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/document-code/explain-complex-logic.md +++ b/content/copilot/tutorials/copilot-cookbook/document-code/explain-complex-logic.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/documenting-code/explaining-complex-algorithms-or-logic - /copilot/tutorials/copilot-chat-cookbook/documenting-code/explaining-complex-algorithms-or-logic - /copilot/tutorials/copilot-chat-cookbook/documenting-code/explain-complex-logic + - /copilot/tutorials/copilot-chat-cookbook/document-code/explain-complex-logic versions: feature: copilot category: - Documenting code - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Intermediate +surface: + - Chat octicon: book contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/document-code/explain-legacy-code.md b/content/copilot/tutorials/copilot-cookbook/document-code/explain-legacy-code.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/document-code/explain-legacy-code.md rename to content/copilot/tutorials/copilot-cookbook/document-code/explain-legacy-code.md index b44355c91d0a..89c07c2349e5 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/document-code/explain-legacy-code.md +++ b/content/copilot/tutorials/copilot-cookbook/document-code/explain-legacy-code.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/documenting-code/explaining-legacy-code - /copilot/tutorials/copilot-chat-cookbook/documenting-code/explaining-legacy-code - /copilot/tutorials/copilot-chat-cookbook/documenting-code/explain-legacy-code + - /copilot/tutorials/copilot-chat-cookbook/document-code/explain-legacy-code versions: feature: copilot category: - Documenting code - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Simple +surface: + - Chat octicon: book contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-cookbook/document-code/filing-issues-without-breaking-your-flow.md b/content/copilot/tutorials/copilot-cookbook/document-code/filing-issues-without-breaking-your-flow.md new file mode 100644 index 000000000000..cc7a73f964de --- /dev/null +++ b/content/copilot/tutorials/copilot-cookbook/document-code/filing-issues-without-breaking-your-flow.md @@ -0,0 +1,107 @@ +--- +title: Filing issues without breaking your flow +shortTitle: File issues without breaking flow +intro: When something catches your attention mid-task, use {% data variables.copilot.copilot_cli_short %} to file a GitHub issue with code context, linked PRs, and labels, then get back to what you were doing. +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/document-code/creating-issues + - /copilot/tutorials/copilot-chat-cookbook/document-code/filing-issues-without-breaking-your-flow +versions: + feature: copilot +category: + - Documenting code + - Author and optimize with Copilot +surface: + - CLI +octicon: issue-opened +contentType: tutorials +--- + +{% data variables.copilot.copilot_cli_short %} can open GitHub issues for you from the terminal. Instead of switching to a browser and filling out an issue by hand, you describe what you want and Copilot gathers context from your repository and GitHub, then creates the issue so you can keep working. + +## Example scenario 1: Filing an issue from a CI failure + +Your CI is failing or you've spotted errors in production logs. Rather than manually tracing the stack trace back to a commit, you ask {% data variables.copilot.copilot_cli_short %} to investigate and file the issue for you. + +### Example prompt + +```text copy +The CI workflow on main has been failing since yesterday. Look at the failing +run, figure out what's breaking and which commit likely introduced it, then +create an issue with the stack trace, a link to the failing run, and the +suspected PR that caused it. Label it "bug" and "regression". +``` + +### Example response + +{% data reusables.copilot.example-prompts.response-is-an-example %} + +{% data variables.copilot.copilot_cli_short %} uses its GitHub MCP tools to: + + +1. **Fetch the failing workflow run** and extract the stack trace from the logs. +1. **Identify the responsible code** — for example, `src/services/payment.ts:94`. +1. **Search recent commits** touching that file and find the PR that introduced the change. +1. **Create an issue** with all the context assembled: + + ```text + Created issue #421: Regression: PaymentService throws TypeError after #398 + + What's failing: + The `build` job on main has failed since commit `a3f7c21`. Stack trace: + + TypeError: Cannot read properties of undefined (reading 'amount') at processRefund (src/services/payment.ts:94:22) + + Introduced by: PR #398 (merged 2 days ago) refactored the payment types but missed updating `processRefund` to handle the new nullable `transaction` field. + + Failing run: Actions run #2847 + + Suggested fix: Add a null check for `transaction` before accessing `transaction.amount` on line 94. + + Labels: `bug`, `regression` + ``` + +## Example scenario 2: Turning TODOs into tracked work + +Over time, TODO and FIXME comments accumulate in a codebase with no visibility. You can ask {% data variables.copilot.copilot_cli_short %} to scan for these comments, assess priority, and create issues so the work is tracked. + +### Example prompt + +```text copy +Scan this repo for TODO and FIXME comments. Group them by area, pick the 5 +most important ones based on the surrounding code context, and create an issue +for each. Include the code snippet, file location, and suggest a label. +``` + +### Example response + +{% data reusables.copilot.example-prompts.response-is-an-example %} + +{% data variables.copilot.copilot_cli_short %} searches the codebase, reads the context around each comment, and prioritizes based on severity: + +```text +Found 23 TODO/FIXME comments across the repo. Here are the 5 I'd prioritize: + +Created issue #422: FIXME: SQL injection risk in search query builder +- src/db/search.ts:34 — user input concatenated directly into query string +- Label: security, priority:high + +Created issue #423: TODO: Rate limiter bypassed for internal routes +- src/middleware/rate_limit.ts:12 — comment says "temporary bypass, remove before launch" +- Label: security, technical-debt + +Created issue #424: FIXME: Memory leak in WebSocket handler +- src/ws/handler.ts:87 — listeners are added on each connection but never cleaned up +- Label: bug, performance + +Created issue #425: TODO: Retry logic missing for payment webhook +- src/webhooks/payment.ts:56 — failures silently dropped, no retry queue +- Label: reliability, priority:medium + +Created issue #426: TODO: Migrate to new auth token format +- src/auth/token.ts:3 — comment references a closing down API version +- Label: technical-debt +``` + +## Further reading + +* [AUTOTITLE](/copilot/how-tos/copilot-cli) diff --git a/content/copilot/tutorials/copilot-chat-cookbook/document-code/index.md b/content/copilot/tutorials/copilot-cookbook/document-code/index.md similarity index 67% rename from content/copilot/tutorials/copilot-chat-cookbook/document-code/index.md rename to content/copilot/tutorials/copilot-cookbook/document-code/index.md index 038794594898..6bb0d4037ed9 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/document-code/index.md +++ b/content/copilot/tutorials/copilot-cookbook/document-code/index.md @@ -1,14 +1,15 @@ --- title: Document code -intro: 'Discover ways that you can use {% data variables.copilot.copilot_chat %} to document your code.' +intro: Discover ways that you can use {% data variables.copilot.copilot_chat %} to document your code. redirect_from: - /copilot/example-prompts-for-github-copilot-chat/documenting-code - /copilot/copilot-chat-cookbook/documenting-code - /copilot/tutorials/copilot-chat-cookbook/documenting-code + - /copilot/tutorials/copilot-chat-cookbook/document-code versions: feature: copilot children: - - /creating-issues + - /filing-issues-without-breaking-your-flow - /document-legacy-code - /explain-legacy-code - /explain-complex-logic diff --git a/content/copilot/tutorials/copilot-chat-cookbook/document-code/sync-documentation.md b/content/copilot/tutorials/copilot-cookbook/document-code/sync-documentation.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/document-code/sync-documentation.md rename to content/copilot/tutorials/copilot-cookbook/document-code/sync-documentation.md index 145a54eaae7a..b5f884f2f5e3 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/document-code/sync-documentation.md +++ b/content/copilot/tutorials/copilot-cookbook/document-code/sync-documentation.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/documenting-code/syncing-documentation-with-code-changes - /copilot/tutorials/copilot-chat-cookbook/documenting-code/syncing-documentation-with-code-changes - /copilot/tutorials/copilot-chat-cookbook/documenting-code/sync-documentation + - /copilot/tutorials/copilot-chat-cookbook/document-code/sync-documentation versions: feature: copilot category: - Documenting code - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Intermediate +surface: + - Chat octicon: book contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/document-code/write-discussions-or-blog-posts.md b/content/copilot/tutorials/copilot-cookbook/document-code/write-discussions-or-blog-posts.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/document-code/write-discussions-or-blog-posts.md rename to content/copilot/tutorials/copilot-cookbook/document-code/write-discussions-or-blog-posts.md index c182ff0b2385..4bd58f2d02c4 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/document-code/write-discussions-or-blog-posts.md +++ b/content/copilot/tutorials/copilot-cookbook/document-code/write-discussions-or-blog-posts.md @@ -8,13 +8,14 @@ category: - Documenting code - Author and optimize with Copilot - Scale institutional knowledge -complexity: - - Simple +surface: + - Chat octicon: book redirect_from: - /copilot/copilot-chat-cookbook/documenting-code/writing-discussions-or-blog-posts - /copilot/tutorials/copilot-chat-cookbook/documenting-code/writing-discussions-or-blog-posts - /copilot/tutorials/copilot-chat-cookbook/documenting-code/write-discussions-or-blog-posts + - /copilot/tutorials/copilot-chat-cookbook/document-code/write-discussions-or-blog-posts contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-cookbook/generate-code/implement-a-feature.md b/content/copilot/tutorials/copilot-cookbook/generate-code/implement-a-feature.md new file mode 100644 index 000000000000..84512b96e91c --- /dev/null +++ b/content/copilot/tutorials/copilot-cookbook/generate-code/implement-a-feature.md @@ -0,0 +1,114 @@ +--- +title: Implementing a feature from a GitHub Issue +shortTitle: Implement a feature +intro: Give a {% data variables.product.github %} issue to {% data variables.copilot.copilot_cli %}, then steer the conversation to implement the feature. +versions: + feature: copilot +category: + - Author and optimize with Copilot +surface: + - CLI +octicon: rocket +contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/generate-code/implement-a-feature +--- + +{% data variables.copilot.copilot_cli %} can read a {% data variables.product.github %} issue, propose an implementation plan, and draft code changes that satisfy the requirements. Because the workflow is conversational, you can correct assumptions, point to relevant files, and refine the approach as {% data variables.copilot.copilot_cli %} works. + +## Example scenario + +Imagine you work on a platform team that maintains an internal Node.js billing API that powers customer subscriptions. A product manager opens an issue requesting a new `GET /subscriptions/{id}/plan` endpoint that returns the plan attached to a given subscription, along with unit tests and an update to the OpenAPI specification. The issue includes the desired response shape, error cases for missing or cancelled subscriptions, and a link to the existing `/subscriptions/{id}` endpoint to follow as a pattern. You can hand the issue to {% data variables.copilot.copilot_cli %} and have it scaffold the route, controller, and tests, then open a pull request. + +## Example workflow + +{% data variables.copilot.copilot_cli %} can read the issue directly from {% data variables.product.github %}, plan the work, write the code, run your tests, and open a pull request. + +### Pull the issue into context + +Start in the root of the repository and reference the issue by URL or `owner/repo#number`. {% data variables.copilot.copilot_cli %} uses the {% data variables.product.github %} MCP server to fetch the issue body, comments, and linked items, then keeps that context available for the rest of the session. + +```text copy +Read octo-org/billing-api#482 and any issues or PRs it links to. +Summarize what needs to be implemented before we plan the work. +``` + +### Draft an implementation plan with `/plan` + +Switch to plan mode so {% data variables.copilot.copilot_cli %} thinks through the change before touching any files. + +```text copy +/plan Implement the subscription lookup endpoint described in the issue. +Follow the same conventions as the existing GET /subscriptions/{id} endpoint. +``` + +{% data reusables.copilot.example-prompts.response-is-an-example %} + +{% data variables.copilot.copilot_cli %} returns a plan similar to: + +```text +1. Add a `getPlanForSubscription` method in `src/services/subscriptionService.ts` that reuses the existing billing client, throws `NotFoundError` when the subscription or plan does not exist, and throws `CancelledSubscriptionError` when the subscription has been cancelled. +1. Add a `GET /subscriptions/:id/plan` route in `src/routes/subscriptions.ts`, mirroring the error handling in the sibling `GET /subscriptions/:id` route and mapping `CancelledSubscriptionError` to a `410` response. +1. Update `openapi/subscriptions.yaml` with the new path, response schema, and `404` and `410` responses. +1. Add unit tests in `test/services/subscriptionService.test.ts` and `test/routes/subscriptions.test.ts` covering the success case, missing subscription, cancelled subscription, and missing plan. +1. Run the test suite and update the changelog entry. +``` + +Review the plan, push back on anything that looks off, and ask {% data variables.copilot.copilot_cli %} to revise it before you approve. For example, you might reply with `Use the existing error classes in src/errors—NotFoundError for missing subscriptions or plans and CancelledSubscriptionError for cancelled subscriptions rather than introducing new ones` and have it update the affected steps. + +### Kick off the implementation and steer as needed + +Approve the plan to start coding. {% data variables.copilot.copilot_cli %} works through the steps one at a time, showing each edit before applying it. If it heads in the wrong direction, interrupt and redirect. + +For example, suppose {% data variables.copilot.copilot_cli %} adds a new database query in your `getPlanForSubscription` method instead of reusing the billing client your team standardized on. You can stop and steer it: + +```text copy +Don't add a new query here. The billing client in +src/clients/billingClient.ts already exposes a getPlan method. +Use that and update the service to handle its NotFound response. +``` + +{% data variables.copilot.copilot_cli %} revises the code and continues with the remaining plan steps. + +### Generate and run unit tests + +When {% data variables.copilot.copilot_cli %} reaches the testing step, it scaffolds tests that match the patterns in your existing test files. For the plan endpoint, it might add cases like: + +* Returns the plan record for an active subscription. +* Returns `404` when the subscription does not exist. +* Returns `410` when the subscription has been cancelled. +* Returns `404` when the subscription has no plan attached. + +After writing the tests, {% data variables.copilot.copilot_cli %} runs them in the terminal so you can see the results immediately. + +```text copy +Run the test suite for the new endpoint and fix any failures. +``` + +If a test fails, {% data variables.copilot.copilot_cli %} reads the failure output, updates the implementation, and re-runs until the test suite is green. Review each fix to make sure it's addressing the root cause rather than masking it. + +### Review the changes with `/diff` + +Use `/diff` to see a consolidated view of changes made across the session. + +```text copy +/diff +``` + +If something looks wrong, ask {% data variables.copilot.copilot_cli %} to revise it before you commit. For example, you might reply with `Revert the formatting changes in src/routes/subscriptions.ts to only keep the new route handler` to scope the diff back to the intended changes. + +### Open a pull request + +Once the feature is implemented, tested, and reviewed, ask {% data variables.copilot.copilot_cli %} to open a pull request. It uses the {% data variables.product.github %} MCP server to push the branch and create the pull request + +```text copy +Commit the changes on a new branch, push it, and open a pull request +against main. Link it to octo-org/billing-api#482 and summarize the +implementation, the tests added, and any follow-up work. +``` + +{% data variables.copilot.copilot_cli %} reports back with the pull request's URL so you can move it forward from there. + +## Further reading + +* [AUTOTITLE](/copilot/how-tos/copilot-cli) diff --git a/content/copilot/tutorials/copilot-cookbook/generate-code/index.md b/content/copilot/tutorials/copilot-cookbook/generate-code/index.md new file mode 100644 index 000000000000..b8072f820467 --- /dev/null +++ b/content/copilot/tutorials/copilot-cookbook/generate-code/index.md @@ -0,0 +1,12 @@ +--- +title: Generate code +intro: Use {% data variables.product.prodname_copilot %} to turn requirements into working code. +versions: + feature: copilot +children: + - /implement-a-feature +contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/generate-code +--- + diff --git a/content/copilot/tutorials/copilot-chat-cookbook/index.md b/content/copilot/tutorials/copilot-cookbook/index.md similarity index 67% rename from content/copilot/tutorials/copilot-chat-cookbook/index.md rename to content/copilot/tutorials/copilot-cookbook/index.md index e55140c45d9d..75e1fedb14b1 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/index.md +++ b/content/copilot/tutorials/copilot-cookbook/index.md @@ -1,30 +1,33 @@ --- -title: GitHub Copilot Chat Cookbook -intro: 'Find examples of prompts to use with {% data variables.copilot.copilot_chat %}.' +title: GitHub Copilot Cookbook +intro: Learn how to use {% data variables.product.prodname_copilot %} to accomplish specific tasks. allowTitleToDifferFromFilename: true redirect_from: - /copilot/example-prompts-for-github-copilot-chat - /copilot/copilot-chat-cookbook + - /copilot/tutorials/copilot-chat-cookbook versions: feature: copilot layout: category-landing sidebarLink: text: All prompts - href: /copilot/tutorials/copilot-chat-cookbook + href: /copilot/tutorials/copilot-cookbook spotlight: - - article: /testing-code/generate-unit-tests + - article: /generate-code/implement-a-feature + image: /assets/images/copilot-landing/improving_code_readability.png + - article: /debug-errors/diagnose-ci-test-failures image: /assets/images/copilot-landing/generating_unit_tests.png - article: /refactor-code/improve-code-readability - image: /assets/images/copilot-landing/improving_code_readability.png - - article: /debug-errors/debug-invalid-json image: /assets/images/copilot-landing/debugging_invalid_json.png children: - /communicate-effectively - /debug-errors - /analyze-functionality + - /generate-code - /refactor-code - /document-code - /testing-code - /analyze-security contentType: tutorials --- + diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/decouple-business-logic.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/decouple-business-logic.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/decouple-business-logic.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/decouple-business-logic.md index 1062d87c2c83..51841f583ab7 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/decouple-business-logic.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/decouple-business-logic.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/decoupling-business-logic-from-ui-components - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/decoupling-business-logic-from-ui-components - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/decouple-business-logic + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/decouple-business-logic versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Advanced +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-database-deadlocks.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/fix-database-deadlocks.md similarity index 99% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-database-deadlocks.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/fix-database-deadlocks.md index 4f3bf6515a73..ca9e591d9c0b 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-database-deadlocks.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/fix-database-deadlocks.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/fixing-database-deadlocks-or-data-integrity-issues - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/fixing-database-deadlocks-or-data-integrity-issues - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/fix-database-deadlocks + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-database-deadlocks versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Advanced +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-lint-errors.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/fix-lint-errors.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-lint-errors.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/fix-lint-errors.md index 217fbac0bac5..68dfe4943c08 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-lint-errors.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/fix-lint-errors.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/fixing-lint-errors - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/fixing-lint-errors - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/fix-lint-errors + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/fix-lint-errors versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/handle-cross-cutting.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/handle-cross-cutting.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/handle-cross-cutting.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/handle-cross-cutting.md index b31a6a833f70..389c56ca8557 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/handle-cross-cutting.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/handle-cross-cutting.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/handling-cross-cutting-concerns - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/handling-cross-cutting-concerns - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/handle-cross-cutting + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/handle-cross-cutting versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/improve-code-readability.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/improve-code-readability.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/improve-code-readability.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/improve-code-readability.md index 513c0c4a2804..31e09aa1c9d7 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/improve-code-readability.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/improve-code-readability.md @@ -8,14 +8,15 @@ redirect_from: - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/improving-code-readability-and-maintainability - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/improve-code-readability - /copilot/copilot-chat-cookbook/refactoring-code/improving-code-readability-and-maintainability + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/improve-code-readability versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Simple +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/index.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/index.md similarity index 78% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/index.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/index.md index 6b488e710623..51024a58008b 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/index.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/index.md @@ -1,10 +1,11 @@ --- title: Refactor code -intro: 'Discover ways that you can use {% data variables.product.prodname_copilot %} to refactor your code.' +intro: Discover ways that you can use {% data variables.product.prodname_copilot %} to refactor your code. redirect_from: - /copilot/example-prompts-for-github-copilot-chat/refactoring-code - /copilot/copilot-chat-cookbook/refactoring-code - /copilot/tutorials/copilot-chat-cookbook/refactoring-code + - /copilot/tutorials/copilot-chat-cookbook/refactor-code versions: feature: copilot children: diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-data-access-layers.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-data-access-layers.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-data-access-layers.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-data-access-layers.md index 6698e239db99..9ec7a76c741f 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-data-access-layers.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-data-access-layers.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/refactoring-data-access-layers - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/refactoring-data-access-layers - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/refactor-data-access-layers + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-data-access-layers versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Advanced +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-design-patterns.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-design-patterns.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-design-patterns.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-design-patterns.md index 253d5b84cd31..77fc180549ce 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-design-patterns.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-design-patterns.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/refactoring-to-implement-a-design-pattern - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/refactoring-to-implement-a-design-pattern - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/refactor-design-patterns + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-design-patterns versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-optimization.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-for-optimization.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-optimization.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-for-optimization.md index 257bc7b98c31..0b52d65054cf 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-optimization.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-for-optimization.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/refactoring-for-performance-optimization - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/refactoring-for-performance-optimization - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/refactor-for-optimization + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-optimization versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Simple +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-sustainability.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-for-sustainability.md similarity index 95% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-sustainability.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-for-sustainability.md index 0318578ce7f3..02a9677b78fa 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-sustainability.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/refactor-for-sustainability.md @@ -8,10 +8,12 @@ category: - Refactoring code - Improve quality and maintainability - Author and optimize with Copilot -complexity: - - Simple +surface: + - Chat octicon: rocket contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/refactor-for-sustainability --- Code that is inefficient in its use of computational resources can lead to higher energy consumption, which has a negative impact on the environment. Examples of such code include algorithms with high time complexity, excessive memory usage, and unnecessary processing. diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/simplify-inheritance-hierarchies.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/simplify-inheritance-hierarchies.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/simplify-inheritance-hierarchies.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/simplify-inheritance-hierarchies.md index 7929a5436e3d..0fec97156ad0 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/simplify-inheritance-hierarchies.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/simplify-inheritance-hierarchies.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/simplifying-complex-inheritance-hierarchies - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/simplifying-complex-inheritance-hierarchies - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/simplify-inheritance-hierarchies + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/simplify-inheritance-hierarchies versions: feature: copilot category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: rocket contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/translate-code.md b/content/copilot/tutorials/copilot-cookbook/refactor-code/translate-code.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/refactor-code/translate-code.md rename to content/copilot/tutorials/copilot-cookbook/refactor-code/translate-code.md index 3fe54cd94fa2..e5da7a7a0ee6 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/refactor-code/translate-code.md +++ b/content/copilot/tutorials/copilot-cookbook/refactor-code/translate-code.md @@ -8,13 +8,14 @@ category: - Refactoring code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Simple +surface: + - Chat octicon: rocket redirect_from: - /copilot/copilot-chat-cookbook/refactoring-code/translating-code-to-a-different-programming-language - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/translating-code-to-a-different-programming-language - /copilot/tutorials/copilot-chat-cookbook/refactoring-code/translate-code + - /copilot/tutorials/copilot-chat-cookbook/refactor-code/translate-code contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/create-end-to-end-tests.md b/content/copilot/tutorials/copilot-cookbook/testing-code/create-end-to-end-tests.md similarity index 98% rename from content/copilot/tutorials/copilot-chat-cookbook/testing-code/create-end-to-end-tests.md rename to content/copilot/tutorials/copilot-cookbook/testing-code/create-end-to-end-tests.md index 5931c19cbce3..1a0c6a1bc042 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/create-end-to-end-tests.md +++ b/content/copilot/tutorials/copilot-cookbook/testing-code/create-end-to-end-tests.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/testing-code/create-end-to-end-tests-for-a-webpage - /copilot/tutorials/copilot-chat-cookbook/testing-code/create-end-to-end-tests-for-a-webpage - /copilot/tutorials/copilot-chat-cookbook/testing-code/creating-end-to-end-tests-for-a-webpage + - /copilot/tutorials/copilot-chat-cookbook/testing-code/create-end-to-end-tests versions: feature: copilot category: - Testing code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Advanced +surface: + - Chat octicon: beaker contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/create-mock-objects.md b/content/copilot/tutorials/copilot-cookbook/testing-code/create-mock-objects.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/testing-code/create-mock-objects.md rename to content/copilot/tutorials/copilot-cookbook/testing-code/create-mock-objects.md index 6bacc74229da..24fd45641766 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/create-mock-objects.md +++ b/content/copilot/tutorials/copilot-cookbook/testing-code/create-mock-objects.md @@ -7,14 +7,15 @@ redirect_from: - /copilot/copilot-chat-cookbook/testing-code/create-mock-objects-to-abstract-layers - /copilot/tutorials/copilot-chat-cookbook/testing-code/create-mock-objects-to-abstract-layers - /copilot/tutorials/copilot-chat-cookbook/testing-code/creating-mock-objects-to-abstract-layers + - /copilot/tutorials/copilot-chat-cookbook/testing-code/create-mock-objects versions: feature: copilot category: - Testing code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: beaker contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/generate-unit-tests.md b/content/copilot/tutorials/copilot-cookbook/testing-code/generate-unit-tests.md similarity index 96% rename from content/copilot/tutorials/copilot-chat-cookbook/testing-code/generate-unit-tests.md rename to content/copilot/tutorials/copilot-cookbook/testing-code/generate-unit-tests.md index fbd47acd8e30..8cf3cd633378 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/generate-unit-tests.md +++ b/content/copilot/tutorials/copilot-cookbook/testing-code/generate-unit-tests.md @@ -5,14 +5,15 @@ intro: '{% data variables.copilot.copilot_chat_short %} can help with generating redirect_from: - /copilot/example-prompts-for-github-copilot-chat/testing-code/generate-unit-tests - /copilot/copilot-chat-cookbook/testing-code/generate-unit-tests + - /copilot/tutorials/copilot-chat-cookbook/testing-code/generate-unit-tests versions: feature: copilot category: - Testing code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: beaker contentType: tutorials --- diff --git a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/index.md b/content/copilot/tutorials/copilot-cookbook/testing-code/index.md similarity index 66% rename from content/copilot/tutorials/copilot-chat-cookbook/testing-code/index.md rename to content/copilot/tutorials/copilot-cookbook/testing-code/index.md index 9a380c69e628..ea48cf460929 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/index.md +++ b/content/copilot/tutorials/copilot-cookbook/testing-code/index.md @@ -1,9 +1,10 @@ --- title: Testing code -intro: 'Discover ways that you can use {% data variables.product.prodname_copilot %} to test your code.' +intro: Discover ways that you can use {% data variables.product.prodname_copilot %} to test your code. redirect_from: - /copilot/example-prompts-for-github-copilot-chat/testing-code - /copilot/copilot-chat-cookbook/testing-code + - /copilot/tutorials/copilot-chat-cookbook/testing-code versions: feature: copilot children: diff --git a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/update-unit-tests.md b/content/copilot/tutorials/copilot-cookbook/testing-code/update-unit-tests.md similarity index 97% rename from content/copilot/tutorials/copilot-chat-cookbook/testing-code/update-unit-tests.md rename to content/copilot/tutorials/copilot-cookbook/testing-code/update-unit-tests.md index 39373e14ddea..3a523a883914 100644 --- a/content/copilot/tutorials/copilot-chat-cookbook/testing-code/update-unit-tests.md +++ b/content/copilot/tutorials/copilot-cookbook/testing-code/update-unit-tests.md @@ -8,10 +8,12 @@ category: - Testing code - Author and optimize with Copilot - Improve quality and maintainability -complexity: - - Intermediate +surface: + - Chat octicon: beaker contentType: tutorials +redirect_from: + - /copilot/tutorials/copilot-chat-cookbook/testing-code/update-unit-tests --- When you make changes to your code, it's important to update any tests to verify the new behavior and catch any bugs that the new code has introduced. {% data variables.copilot.copilot_chat_short %} can help you quickly update tests to match your code changes, ensuring your test suite stays in sync with your implementation. @@ -118,4 +120,4 @@ if __name__ == '__main__': ## Further reading -{% data reusables.copilot.example-prompts.further-reading-items %} \ No newline at end of file +{% data reusables.copilot.example-prompts.further-reading-items %} diff --git a/content/copilot/tutorials/customization-library/index.md b/content/copilot/tutorials/customization-library/index.md index 585e8041e92a..a9eb2a2b77db 100644 --- a/content/copilot/tutorials/customization-library/index.md +++ b/content/copilot/tutorials/customization-library/index.md @@ -15,6 +15,9 @@ spotlight: image: /assets/images/copilot-landing/improving_code_readability.png - article: /custom-instructions/your-first-custom-agent image: /assets/images/copilot-landing/generating_unit_tests.png +filters: + - category + - complexity children: - /custom-instructions - /prompt-files diff --git a/content/copilot/tutorials/index.md b/content/copilot/tutorials/index.md index bd3cd20375b6..aadda46a0cc1 100644 --- a/content/copilot/tutorials/index.md +++ b/content/copilot/tutorials/index.md @@ -5,7 +5,7 @@ intro: Build skills and knowledge about {% data variables.product.prodname_copil versions: feature: copilot children: - - /copilot-chat-cookbook + - /copilot-cookbook - /customization-library - /cloud-agent - /spark @@ -41,7 +41,7 @@ sidebarLink: href: /copilot/tutorials carousels: recommended: - - /copilot/tutorials/copilot-chat-cookbook + - /copilot/tutorials/copilot-cookbook - /copilot/tutorials/customization-library - /copilot/tutorials/roll-out-at-scale includedCategories: diff --git a/content/index.md b/content/index.md index 4b8577bb525b..6fa6f3010d9c 100644 --- a/content/index.md +++ b/content/index.md @@ -114,7 +114,7 @@ childGroups: - copilot/get-started/plans - copilot/how-tos/use-copilot-agents/cloud-agent - copilot/tutorials - - copilot/tutorials/copilot-chat-cookbook + - copilot/tutorials/copilot-cookbook - copilot/tutorials/customization-library - copilot/how-tos/copilot-cli - name: CI/CD and DevOps diff --git a/data/ui.yml b/data/ui.yml index 18c2094a4b7e..dbb12deae55a 100644 --- a/data/ui.yml +++ b/data/ui.yml @@ -381,6 +381,7 @@ cookbook_landing: search_articles: Search examples category: Category complexity: Complexity + surface: Surface carousels: recommended: Recommended diff --git a/package-lock.json b/package-lock.json index dcab0838f66e..ad7d67a1f2ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5009,6 +5009,7 @@ "version": "2.5.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -5048,6 +5049,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5068,6 +5070,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5088,6 +5091,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5108,6 +5112,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5128,6 +5133,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5148,6 +5154,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5168,6 +5175,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5188,6 +5196,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5208,6 +5217,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5228,6 +5238,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5248,6 +5259,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5268,6 +5280,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5288,6 +5301,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5305,6 +5319,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, "license": "Apache-2.0", "optional": true, "bin": { @@ -10638,6 +10653,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -14551,6 +14567,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true, "license": "MIT", "optional": true }, diff --git a/src/content-linter/tests/unit/frontmatter-schema.ts b/src/content-linter/tests/unit/frontmatter-schema.ts index c6a18114a86b..a4ca19a5c20b 100644 --- a/src/content-linter/tests/unit/frontmatter-schema.ts +++ b/src/content-linter/tests/unit/frontmatter-schema.ts @@ -57,7 +57,7 @@ describe(frontmatterSchema.names.join(' - '), () => { " fpt: '*'", 'sidebarLink:', ' text: "All prompts"', - ' href: "/copilot/copilot-chat-cookbook"', + ' href: "/copilot/copilot-cookbook"', '---', ].join('\n') const result = await runRule(frontmatterSchema, { strings: { markdown }, ...fmOptions }) @@ -72,7 +72,7 @@ describe(frontmatterSchema.names.join(' - '), () => { 'versions:', " fpt: '*'", 'sidebarLink:', - ' href: "/copilot/copilot-chat-cookbook"', + ' href: "/copilot/copilot-cookbook"', '---', ].join('\n') const result = await runRule(frontmatterSchema, { strings: { markdown }, ...fmOptions }) diff --git a/src/fixtures/fixtures/data/ui.yml b/src/fixtures/fixtures/data/ui.yml index 18c2094a4b7e..dbb12deae55a 100644 --- a/src/fixtures/fixtures/data/ui.yml +++ b/src/fixtures/fixtures/data/ui.yml @@ -381,6 +381,7 @@ cookbook_landing: search_articles: Search examples category: Category complexity: Complexity + surface: Surface carousels: recommended: Recommended diff --git a/src/frame/components/context/CategoryLandingContext.tsx b/src/frame/components/context/CategoryLandingContext.tsx index a56c14843f2b..41da55f48f96 100644 --- a/src/frame/components/context/CategoryLandingContext.tsx +++ b/src/frame/components/context/CategoryLandingContext.tsx @@ -15,6 +15,7 @@ export type CategoryLandingContextT = { renderedPage: string currentLayout: string spotlight?: SpotlightItem[] + filters?: Array<'category' | 'surface' | 'complexity'> } export const CategoryLandingContext = createContext(null) @@ -49,6 +50,11 @@ interface ContextRequest { export const getCategoryLandingContextFromRequest = ( req: ContextRequest, ): CategoryLandingContextT => { + const spotlight = req.context.page.spotlight as SpotlightItem[] | undefined + const filters = req.context.page.filters as + | Array<'category' | 'surface' | 'complexity'> + | undefined + return { title: req.context.page.title, productCallout: (req.context.page.product as string) || '', @@ -61,6 +67,9 @@ export const getCategoryLandingContextFromRequest = ( featuredLinks: getFeaturedLinksFromReq(req), renderedPage: (req.context.renderedPage as string) || '', currentLayout: req.context.currentLayoutName || '', - spotlight: req.context.page.spotlight as SpotlightItem[] | undefined, + // `getServerSideProps` cannot serialize `undefined`, so only include these + // when they are actually defined on the page frontmatter. + ...(spotlight !== undefined && { spotlight }), + ...(filters !== undefined && { filters }), } } diff --git a/src/frame/lib/frontmatter.ts b/src/frame/lib/frontmatter.ts index 77e83ae7e70e..3f5eb65a938f 100644 --- a/src/frame/lib/frontmatter.ts +++ b/src/frame/lib/frontmatter.ts @@ -363,6 +363,9 @@ category: complexity: { type: 'array', }, + surface: { + type: 'array', + }, industry: { type: 'array', }, @@ -404,6 +407,17 @@ category: }, description: 'Array of articles to feature in the spotlight section', }, + // Filters to display on cookbook-style category landing pages. + // Allowed values: 'category' (always shown), 'surface', 'complexity'. + filters: { + type: 'array', + items: { + type: 'string', + enum: ['category', 'surface', 'complexity'], + }, + description: + 'Which filter menus to display on the category landing page. The category filter is always shown.', + }, // Carousels configuration for category landing pages (supports multiple carousels) carousels: { type: 'object', diff --git a/src/frame/middleware/context/generic-toc.ts b/src/frame/middleware/context/generic-toc.ts index 7a22c9053944..580e6159ba91 100644 --- a/src/frame/middleware/context/generic-toc.ts +++ b/src/frame/middleware/context/generic-toc.ts @@ -137,6 +137,7 @@ async function getTocItems(node: Tree, context: Context, opts: Options): Promise const octicon = page.octicon ?? null const category = page.category ? page.category : null const complexity = page.complexity ? page.complexity : null + const surface = page.surface ? page.surface : null const industry = page.industry ? page.industry : null let intro = null if (opts.renderIntros) { @@ -168,6 +169,7 @@ async function getTocItems(node: Tree, context: Context, opts: Options): Promise octicon, category, complexity, + surface, industry, childTocItems, } as ToC diff --git a/src/landings/components/CategoryLanding.tsx b/src/landings/components/CategoryLanding.tsx index e2d12bafeba8..ff5081490f00 100644 --- a/src/landings/components/CategoryLanding.tsx +++ b/src/landings/components/CategoryLanding.tsx @@ -17,7 +17,12 @@ import { UtmPreserver } from '@/frame/components/UtmPreserver' export const CategoryLanding = () => { const { t } = useTranslation('cookbook_landing') const router = useRouter() - const { title, intro, tocItems, spotlight } = useCategoryLandingContext() + const { title, intro, tocItems, spotlight, filters } = useCategoryLandingContext() + + // The category filter is always shown. Surface and complexity are opt-in via + // the `filters` frontmatter array on the landing page. + const showSurface = filters ? filters.includes('surface') : true + const showComplexity = filters ? filters.includes('complexity') : false // tocItems contains directories and its children, we only want the child articles const onlyFlatItems: ArticleCardItems = tocItems.flatMap((item) => item.childTocItems || []) @@ -25,6 +30,7 @@ export const CategoryLanding = () => { const [searchQuery, setSearchQuery] = useState('') const [selectedCategory, setSelectedCategory] = useState('All') const [selectedComplexity, setSelectedComplexity] = useState('All') + const [selectedSurface, setSelectedSurface] = useState('All') const applyFilters = () => { let results = onlyFlatItems @@ -53,6 +59,10 @@ export const CategoryLanding = () => { results = results.filter((item) => item.complexity?.includes(selectedComplexity)) } + if (selectedSurface !== 'All') { + results = results.filter((item) => item.surface?.includes(selectedSurface)) + } + return results } @@ -62,9 +72,11 @@ export const CategoryLanding = () => { setSearchQuery(query) } - const handleFilter = (option: string, type: 'category' | 'complexity') => { + const handleFilter = (option: string, type: 'category' | 'complexity' | 'surface') => { if (type === 'category') { setSelectedCategory(option) + } else if (type === 'surface') { + setSelectedSurface(option) } else if (type === 'complexity') { setSelectedComplexity(option) } @@ -73,6 +85,7 @@ export const CategoryLanding = () => { const handleResetFilter = () => { setSearchQuery('') setSelectedCategory('All') + setSelectedSurface('All') setSelectedComplexity('All') } @@ -156,6 +169,8 @@ export const CategoryLanding = () => { onSearch={handleSearch} handleFilter={handleFilter} handleResetFilter={handleResetFilter} + showSurface={showSurface} + showComplexity={showComplexity} /> @@ -170,6 +185,7 @@ export const CategoryLanding = () => { ...(item.industry || []), ...(item.category || []), ...(item.complexity || []), + ...(item.surface || []), ]} url={item.fullPath} /> diff --git a/src/landings/components/CookBookArticleCard.tsx b/src/landings/components/CookBookArticleCard.tsx index d11352af963a..6aec08b2acb9 100644 --- a/src/landings/components/CookBookArticleCard.tsx +++ b/src/landings/components/CookBookArticleCard.tsx @@ -14,6 +14,7 @@ type Props = { spotlight?: boolean image?: string complexity?: string + surface?: string } function setImage(image: string, alt: string) { diff --git a/src/landings/components/CookBookFilter.module.scss b/src/landings/components/CookBookFilter.module.scss index d12bcd8755e6..f320804bb0d5 100644 --- a/src/landings/components/CookBookFilter.module.scss +++ b/src/landings/components/CookBookFilter.module.scss @@ -11,3 +11,8 @@ color: var(--fgColor-muted, var(--color-fg-muted, #656d76)); display: inline-block; } + +.surfaceLabel { + color: var(--fgColor-muted, var(--color-fg-muted, #656d76)); + display: inline-block; +} diff --git a/src/landings/components/CookBookFilter.tsx b/src/landings/components/CookBookFilter.tsx index d6ab5cd51d3d..b68b6db1c279 100644 --- a/src/landings/components/CookBookFilter.tsx +++ b/src/landings/components/CookBookFilter.tsx @@ -10,8 +10,10 @@ type Props = { tokens: ArticleCardItems onSearch: (query: string) => void isSearchOpen?: boolean - handleFilter: (option: string, type: 'category' | 'complexity') => void + handleFilter: (option: string, type: 'category' | 'surface' | 'complexity') => void handleResetFilter: () => void + showSurface?: boolean + showComplexity?: boolean } export const CookBookFilter = ({ @@ -20,8 +22,11 @@ export const CookBookFilter = ({ tokens, handleFilter, handleResetFilter, + showSurface = true, + showComplexity = false, }: Props) => { const categories: string[] = ['All', ...new Set(tokens.flatMap((item) => item.category || []))] + const surfaces: string[] = ['All', ...new Set(tokens.flatMap((item) => item.surface || []))] const complexities: string[] = [ 'All', ...new Set(tokens.flatMap((item) => item.complexity || [])), @@ -29,13 +34,16 @@ export const CookBookFilter = ({ const { t } = useTranslation('cookbook_landing') const [selectedCategory, setSelectedCategory] = useState(0) + const [selectedSurface, setSelectedSurface] = useState(0) const [selectedComplexity, setSelectedComplexity] = useState(0) const inputRef = useRef(null) - const onFilter = (option: string, type: 'category' | 'complexity', index: number) => { + const onFilter = (option: string, type: 'category' | 'surface' | 'complexity', index: number) => { if (type === 'category') { setSelectedCategory(index) + } else if (type === 'surface') { + setSelectedSurface(index) } else if (type === 'complexity') { setSelectedComplexity(index) } @@ -44,6 +52,7 @@ export const CookBookFilter = ({ const onResetFilter = () => { setSelectedCategory(0) + setSelectedSurface(0) setSelectedComplexity(0) handleResetFilter() if (inputRef.current) { @@ -96,25 +105,49 @@ export const CookBookFilter = ({ - - - {t('complexity')}:{' '} - {complexities[selectedComplexity]} - - - - {complexities.map((complexity, index) => ( - onFilter(complexity, 'complexity', index)} - > - {complexity} - - ))} - - - + {showSurface && ( + + + {t('surface')}:{' '} + {surfaces[selectedSurface]} + + + + {surfaces.map((surface, index) => ( + onFilter(surface, 'surface', index)} + > + {surface} + + ))} + + + + )} + + {showComplexity && ( + + + {t('complexity')}:{' '} + {complexities[selectedComplexity]} + + + + {complexities.map((complexity, index) => ( + onFilter(complexity, 'complexity', index)} + > + {complexity} + + ))} + + + + )}