๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

Copilot for CLI ์ฒดํ—˜๊ธฐ ๐Ÿค–

ยท ์•ฝ 5๋ถ„
์‹ฌ์™„

GitHub Next์—์„œ ๊ณต๊ฐœํ•œ Copilot for CLI๋ฅผ ์ฒดํ—˜ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

์จ๋ณด๊ธฐ ์ „์— ๐Ÿšถโ€‹

GitHub Copilot์ด๋ž€?โ€‹

Copilot for CLI๋Š” GitHub์—์„œ ๋งŒ๋“  ์˜คํ”ˆ์†Œ์Šค ํ”„๋กœ์ ํŠธ๋กœ, GitHub Copilot์„ CLI์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค. ์•ž์˜ ๋งํฌ์—์„œ Sign up for the waitlist๋ฅผ ํด๋ฆญํ•˜๋ฉด, GitHub Copilot์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐํšŒ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์–ผ๋งˆ๋‚˜ ๊ธฐ๋‹ค๋ ค์•ผ ํ•˜๋‚˜์š”?โ€‹

์–ธ์ œ ์‹ ์ฒญํ–ˆ๋Š”์ง€ ์ •ํ™•ํžˆ ๊ธฐ์–ต์ด ๋‚˜์ง„ ์•Š์ง€๋งŒ, 1๋‹ฌ์ด ์ฑ„ ์ง€๋‚˜์ง€ ์•Š์•„ ์•„๋ž˜ ์ด๋ฉ”์ผ์ด ๋„์ฐฉํ–ˆ์Šต๋‹ˆ๋‹ค!

email-from-github-next

Copilot for CLI ์„ค์น˜ํ•˜๊ธฐ ๐Ÿ› โ€‹

์„ค์น˜โ€‹

npm์„ ์‚ฌ์šฉํ•˜์—ฌ ์ „์—ญ ์„ค์น˜๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

npm install -g @githubnext/github-copilot-cli

์ธ์ฆโ€‹

Copilot for CLI๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” GitHub Copilot์— ์ธ์ฆ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์ธ์ฆ์„ ์œ„ํ•ด์„œ๋Š” GitHub Copilot์— ๋กœ๊ทธ์ธํ•œ ํ›„, ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

github-copilot-cli auth

์•„๋ž˜ ์ด๋ฏธ์ง€์™€ ๊ฐ™์ด ์ง€์‹œ์‚ฌํ•ญ์„ ๋”ฐ๋ผ์„œ ๋กœ๊ทธ์ธํ•˜๋ฉด, ์ธ์ฆ์ด ์™„๋ฃŒ๋ฉ๋‹ˆ๋‹ค.

github-copilot-cli-auth

Copilot for CLI ์‚ฌ์šฉํ•ด๋ณด๊ธฐ ๐Ÿค–โ€‹

๋…ธํŠธ

์‹คํ–‰ํ™˜๊ฒฝ : WSL Ubuntu 22.04

์šฐ์„  github-copilot-cli -h๋กœ ๋ช…๋ น์–ด๋ฅผ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค.

Usage: Copilot CLI [options] [command]

A CLI experience for letting GitHub Copilot help you on the command line.

Options:
-V, --version output the version number
-h, --help display help for command

Commands:
auth Retrieve and store a GitHub Access Token.
alias <shell path> Add convenient GitHub Copilot CLI aliases to your shell.
what-the-shell [options] <query...> Use GitHub Copilot to get shell commands from natural
language descriptions.
git-assist [options] <query...> Translate a natural language description of a git command to
an actual git command.
gh-assist [options] <query...> Convert plain english to GitHub CLI commands.
help [command] display help for command

alias ์ถ”๊ฐ€ํ•˜๊ธฐโ€‹

alias ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, Copilot for CLI๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ํŽธ๋ฆฌํ•˜๊ฒŒ alias๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

eval "$(github-copilot-cli alias -- "$0")"

1. what-the-shell (??)โ€‹

what-the-shell ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, GitHub Copilot์„ ํ†ตํ•ด ์ž์—ฐ์–ด๋กœ Shell ๋ช…๋ น์–ด๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

recursiveํ•˜๊ฒŒ ์›ํ•˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ(docs, blog, src)๋งŒ tree๋กœ ์ถœ๋ ฅํ•˜๋Š” ๋ช…๋ น์–ด๋ฅผ ์ž‘์„ฑํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

github-copilot-cli what-the-shell "directory tree"

์œ„์˜ alias ์ถ”๊ฐ€ํ•˜๊ธฐ์—์„œ ์ถ”๊ฐ€ํ•œ alias๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, ์•„๋ž˜์™€ ๊ฐ™์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

?? "directory tree"

what-the-shell

tree -R docs blog src

์›ํ•˜๋˜ ๋ช…๋ น์–ด๊ฐ€ ๋‚˜์™”์Šต๋‹ˆ๋‹ค! ๐ŸŽ‰

2. git-assist (git?)โ€‹

git ๋ช…๋ น์–ด๋ฅผ ์ž์—ฐ์–ด๋กœ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

branch๋ฅผ ์‚ญ์ œํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

git-assist "delete branch" # git? "delete branch"

git-assist

๊นŒ๋จน๊ณ  ์•ˆ ์ง€์šด feature/giscus branch๋ฅผ ์‚ญ์ œํ–ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ˜…

3. gh-assist (gh?)โ€‹

์ •๋ณด

GitHub CLI๋ฅผ ์‚ฌ์šฉํ•ด๋ณด์ง€ ์•Š์•˜๋‹ค๋ฉด, GitHub CLI๋ฅผ ๋จผ์ € ์„ค์น˜ํ•ด์ฃผ์„ธ์š”. Windows๋ฅผ ์ œ์™ธํ•œ OS์—์„œ๋Š” ๊ณต์‹ ๊ฐ€์ด๋“œ๋ฅผ ๋”ฐ๋ผ์„œ ์„ค์น˜ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

GitHub CLI ๋ช…๋ น ๋ฐ ์ฟผ๋ฆฌ ์ธํ„ฐํŽ˜์ด์Šค์˜ ๊ฐ•๋ ฅํ•œ ๊ธฐ๋Šฅ๊ณผ ๋ณต์žกํ•œ ํ”Œ๋ž˜๊ทธ์™€ jq ํ‘œํ˜„์‹์„ ๋Œ€์‹  ์ƒ์„ฑํ•ด์ค๋‹ˆ๋‹ค.

์ƒˆ๋กœ์šด ์ด์Šˆ๋ฅผ ์ƒ์„ฑํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

gh-assist "open new issue" # gh? open new issue

gh-assist1

์ƒˆ๋กœ์šด ์ด์Šˆ๋ฅผ ์ƒ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค!

์ด์ œ ์ƒˆ๋กœ์šด PR์„ ์ƒ์„ฑํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

gh-assist "open new pull request" # gh? open new pull request

์ถ”๊ฐ€์ ์œผ๋กœ ์•„๋ž˜ 4๊ฐ€์ง€ ์ง€์‹œ์‚ฌํ•ญ์„ ์ถ”๊ฐ€ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

  • title "Copilot for CLI ์ฒดํ—˜๊ธฐ ๐Ÿค–"
  • content "Close #27"
  • assign to me
  • label documentation

gh-assist2 gh-assist3

๊ทธ๋™์•ˆ ์†์œผ๋กœ ์ž‘์„ฑํ–ˆ๋˜ PR์„ github cli๋กœ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

๋งˆ์น˜๋ฉฐ ๐ŸŽ‰โ€‹

์šฐ์„  ์ƒ๊ฐํ–ˆ๋˜ ๊ฒƒ๋ณด๋‹ค ์ดํ•ด๋ ฅ์ด ์ข‹์•„์„œ ๋†€๋ž์Šต๋‹ˆ๋‹ค.

๊ทธ๋™์•ˆ GUI ํ™˜๊ฒฝ์— ์ต์ˆ™ํ•ด์ ธ์„œ CLI๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ๋ฌด์–ธ๊ฐ€ ๋ถˆํŽธํ•จ์ด ์žˆ์—ˆ๋Š”๋ฐ, Copilot for CLI๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ CLI๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์—๋„ ์ต์ˆ™ํ•ด์งˆ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

ํŠนํžˆ gh-assist๋Š” GitHub CLI๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์—๋„ ๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.