|
| 1 | +# Cody hands on training |
| 2 | +Contains a number of training exercises to help engineers learn how to use Cody |
| 3 | + |
| 4 | +## Install the VS Code extension |
| 5 | +You can install VS Code directly from the [VS Code extension marketplace listing](https://marketplace.visualstudio.com/items?itemName=sourcegraph.cody-ai) or by following these steps directly within VS Code: |
| 6 | + |
| 7 | +Open VS Code editor on your local machine |
| 8 | +Click the Extensions icon in the Activity Bar on the side of VS Code, or use the keyboard shortcut Cmd+Shift+X (macOS) or Ctrl+Shift+X (Windows/Linux) |
| 9 | +Type Cody AI in the search bar and click the Install button |
| 10 | +After installing, you may be prompted to reload VS Code to activate the extension |
| 11 | + |
| 12 | +## Dependencies |
| 13 | + |
| 14 | +To install dependencies: |
| 15 | +``` |
| 16 | +curl -fsSL https://bun.sh/install | bash |
| 17 | +``` |
| 18 | + |
| 19 | +Verify the installation by running: |
| 20 | +``` |
| 21 | +bun --version |
| 22 | +``` |
| 23 | + |
| 24 | +if bun command not found - restart shell: |
| 25 | +``` |
| 26 | +source ~/.zshrc |
| 27 | +``` |
| 28 | + |
| 29 | +To run exercise files: |
| 30 | +``` |
| 31 | +bun run index.ts |
| 32 | +``` |
| 33 | + |
| 34 | +Upgrade bun |
| 35 | +``` |
| 36 | +bun upgrade |
| 37 | +``` |
| 38 | + |
| 39 | +Bun can directly execute .ts and .tsx files just like vanilla JavaScript, with no extra configuration. |
| 40 | +Bun internally transpiles it into JavaScript then executes the file. |
| 41 | + |
| 42 | +This project was created using `bun init` in bun v1.2.4. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. |
| 43 | + |
| 44 | +## Overview |
| 45 | +This full-day workshop is designed to provide hands-on training for engineers on using Cody, Sourcegraph's AI coding assistant. The session progresses from basic concepts to advanced techniques, ensuring participants leave with practical experience they can immediately apply to their daily work. |
| 46 | + |
| 47 | + |
| 48 | +## Exercise Repository Structure |
| 49 | +The repository contains progressive exercises in the following categories: |
| 50 | + |
| 51 | +### Stage 1: Beginner Exercises |
| 52 | +- **Exercise 1**: Code Explanation - Practice using Cody to understand unfamiliar code |
| 53 | +- **Exercise 2**: Documentation - Generate documentation for existing code |
| 54 | +- **Exercise 3**: Simple Generation - Use Cody to generate basic functions and utilities |
| 55 | + |
| 56 | +### Stage 2: Intermediate Exercises |
| 57 | +- **Exercise 1**: Debugging Workflows - Identify and fix bugs with Cody's assistance |
| 58 | +- **Exercise 2**: Test Generation - Create unit tests for existing functionality |
| 59 | +- **Exercise 3**: Code Refactoring - Improve a complex order processing system by applying refactoring techniques to enhance readability, performance, and maintainability |
| 60 | + |
| 61 | +### Stage 3: Advanced Exercises |
| 62 | +- **Exercise 1**: API Development & Feature Extension - Transform an existing order system into a REST API and implement new features |
| 63 | +- **Exercise 2**: Security Review - Identify and fix security vulnerabilities in code |
| 64 | +- **Exercise 3**: Performance Optimization - Analyze and improve code performance |
| 65 | + |
| 66 | +## Project structure |
| 67 | +``` |
| 68 | +cody_workshop/ |
| 69 | +├── prompts_0/ |
| 70 | +│ └── GUIDE.md |
| 71 | +├── stage_1/ |
| 72 | +│ ├── exercise_1_code_exaplanation/ |
| 73 | +│ │ ├── README.md |
| 74 | +│ │ └── sample_code.ts |
| 75 | +│ ├── exercise_2_documentation/ |
| 76 | +│ │ ├── README.md |
| 77 | +│ │ └── undocumented_code.ts |
| 78 | +│ └── exercise_3_simple_generation/ |
| 79 | +│ ├── README.md |
| 80 | +│ └── generate_function.ts |
| 81 | +├── stage_2/ |
| 82 | +│ ├── exercise_1_debugging/ |
| 83 | +│ │ ├── README.md |
| 84 | +│ │ └── buggy_code.ts |
| 85 | +│ ├── exercise_2_test_generation/ |
| 86 | +│ │ ├── README.md |
| 87 | +│ │ └── code_to_test.ts |
| 88 | +│ └── exercise_3_refactoring/ |
| 89 | +│ ├── README.md |
| 90 | +│ └── refactor_me.ts |
| 91 | +├── stage_3/ |
| 92 | +│ ├── exercise_1_api_development/ |
| 93 | +│ │ ├── README.md |
| 94 | +│ │ └── complex_app.ts |
| 95 | +│ ├── exercise_2_security_review/ |
| 96 | +│ │ ├── README.md |
| 97 | +│ │ ├── security_review.ts |
| 98 | +│ │ ├── setup_users_db.ts |
| 99 | +│ │ └── users.db |
| 100 | +│ └── exercise_3_performance/ |
| 101 | +│ ├── README.md |
| 102 | +│ └── optimise_me.ts |
| 103 | +├── README.md |
| 104 | +├── bun.lock |
| 105 | +├── hello_world.ts |
| 106 | +├── index.ts |
| 107 | +├── package-lock.json |
| 108 | +├── package.json |
| 109 | +└── tsconfig.json |
| 110 | +``` |
| 111 | + |
| 112 | + |
0 commit comments