Files
awesome-copilot/cookbook/copilot-sdk/nodejs/recipe
James Montemagno 33f544c71d Align Copilot SDK documentation with permission handling requirements (#1107)
* Apply permission handler requirements across Copilot SDK docs

Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jamesmontemagno/awesome-copilot/sessions/adf27a88-92f8-4ca6-b3fe-1204e3bb9963

* Polish permission update formatting in SDK examples

Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jamesmontemagno/awesome-copilot/sessions/adf27a88-92f8-4ca6-b3fe-1204e3bb9963

* Fix review comments on SDK permission handling PR

Address 5 review comments from PR #1103:

1. Fix invalid object literal syntax (stray comma) in resumeSession
   example in copilot-sdk-nodejs.instructions.md

2. Replace unused PermissionHandler import with actual usage in
   cookbook/copilot-sdk/python/recipe/ralph_loop.py (was using
   inline lambda instead)

3. Replace unused approveAll import with actual usage in
   cookbook/copilot-sdk/nodejs/recipe/ralph-loop.ts (was using
   inline handler instead)

4. Add missing PermissionHandler import to 4 Python code snippets
   in skills/copilot-sdk/SKILL.md that reference it without importing

5. Add missing approveAll import to 3 TypeScript code snippets
   in skills/copilot-sdk/SKILL.md that reference it without importing

* Refactor session creation to improve code formatting and consistency across SDK examples

* Fix formatting: split multi-property lines and put closing braces on own lines

Address review comments on PR #1107:
- Split OnPermissionRequest + Model onto separate lines in Go, C#, TypeScript
- Put closing }); on its own line consistently across all examples
- Fix indentation in SKILL.md Quick Start, CLI URL, Error Handling sections
- Fix cookbook Go multiple-sessions and error-handling formatting
- Fix ralph-loop.md TypeScript indentation

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
2026-03-23 11:11:19 +11:00
..
2026-02-11 14:23:25 -08:00
2026-02-02 14:01:22 +11:00

Runnable Recipe Examples

This folder contains standalone, executable TypeScript examples for each cookbook recipe. Each file can be run directly with tsx or via npm scripts.

Prerequisites

  • Node.js 18 or later
  • Install dependencies (this links to the local SDK in the repo):
npm install

Running Examples

Each .ts file is a complete, runnable program. You can run them in two ways:

Using npm scripts:

npm run <script-name>

Using tsx directly:

npx tsx <filename>.ts

Available Recipes

Recipe npm script Direct command Description
Error Handling npm run error-handling npx tsx error-handling.ts Demonstrates error handling patterns
Multiple Sessions npm run multiple-sessions npx tsx multiple-sessions.ts Manages multiple independent conversations
Managing Local Files npm run managing-local-files npx tsx managing-local-files.ts Organizes files using AI grouping
PR Visualization npm run pr-visualization npx tsx pr-visualization.ts Generates PR age charts
Persisting Sessions npm run persisting-sessions npx tsx persisting-sessions.ts Save and resume sessions across restarts

Examples with Arguments

PR Visualization with specific repo:

npx tsx pr-visualization.ts --repo github/copilot-sdk

Managing Local Files (edit the file to change target folder):

# Edit the targetFolder variable in managing-local-files.ts first
npx tsx managing-local-files.ts

Local SDK Development

The package.json references the local Copilot SDK using "*", which resolves to the local SDK source. This means:

  • Changes to the SDK source are immediately available
  • No need to publish or install from npm
  • Perfect for testing and development

If you modify the SDK source, you may need to rebuild:

cd ../../src
npm run build

TypeScript Features

These examples use modern TypeScript/Node.js features:

  • Top-level await (requires "type": "module" in package.json)
  • ESM imports
  • Type safety with TypeScript
  • async/await patterns

Learning Resources