Skip to content

Commit b82e8c0

Browse files
authored
Add gitagent.sh feature (bun install global) (#244)
1 parent c3bfbc1 commit b82e8c0

5 files changed

Lines changed: 113 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
| [feature-installer](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/feature-installer) | `feature-installer` — install devcontainer features at runtime | curl | 1.0.0 |
4949
| [fzf](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/fzf) | `fzf` — general-purpose command-line fuzzy finder | gh release | 1.0.0 |
5050
| [getdnote.com](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/getdnote.com) | `dnote` — simple command-line notebook for developers | gh release | 1.0.0 |
51+
| [gitagent.sh](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/gitagent.sh) | `gitagent` — framework-agnostic, git-native standard for defining AI agents | bun | 1.0.0 |
5152
| [github.com/cli](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/github.com-cli) | `gh` — GitHub CLI | curl | 1.0.1 |
5253
| [helix-editor.com](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/helix-editor.com) | `hx` — modal text editor with built-in LSP | gh release | 1.0.0 |
5354
| [hermes-agent.nousresearch.com](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/hermes-agent.nousresearch.com) | `hermes` — self-improving AI agent by Nous Research | curl | 1.0.0 |

src/gitagent.sh/NOTES.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# gitagent
2+
3+
## Project
4+
5+
- [gitagent](https://gitagent.sh)
6+
7+
## Description
8+
9+
A framework-agnostic, git-native standard for defining AI agents. `gitagent` lets you clone a repo and get an agent — version control, branching, and collaboration built in.
10+
11+
## Installation Method
12+
13+
Installed as a global package via [Bun](https://bun.sh) (`bun install -g @shreyaskapale/gitagent`). Bun is automatically installed if not already present.
14+
15+
## Other Notes
16+
17+
_No additional notes._
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "gitagent.sh",
3+
"id": "gitagent.sh",
4+
"version": "1.0.0",
5+
"description": "Install \"gitagent\" binary",
6+
"documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/gitagent.sh",
7+
"options": {
8+
"version": {
9+
"type": "string",
10+
"default": "latest",
11+
"proposals": [
12+
"latest"
13+
],
14+
"description": "Version of \"gitagent\" to install."
15+
}
16+
}
17+
}

src/gitagent.sh/install.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o pipefail
4+
set -o noclobber
5+
set -o nounset
6+
set -o allexport
7+
readonly binaryName='gitagent'
8+
readonly binaryTargetFolder='/usr/local/bin'
9+
apt_get_update() {
10+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
11+
echo "Running apt-get update..."
12+
apt-get update -y
13+
fi
14+
}
15+
apt_get_checkinstall() {
16+
if ! dpkg -s "$@" >/dev/null 2>&1; then
17+
apt_get_update
18+
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@"
19+
fi
20+
}
21+
apt_get_cleanup() {
22+
apt-get clean
23+
rm -rf /var/lib/apt/lists/*
24+
}
25+
echo_banner() {
26+
local text="$1"
27+
echo -e "\e[1m\e[97m\e[41m$text\e[0m"
28+
}
29+
utils_check_version() {
30+
local version=$1
31+
if ! [[ "${version:-}" =~ ^(latest|[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
32+
printf >&2 '=== [ERROR] Option "version" (value: "%s") is not "latest" or valid semantic version format "X.Y.Z" !\n' \
33+
"$version"
34+
exit 1
35+
fi
36+
}
37+
bun_ensure_installed() {
38+
if ! command -v bun >/dev/null 2>&1; then
39+
echo "Bun is not installed. Installing bun to /usr/local..."
40+
apt_get_checkinstall unzip curl ca-certificates
41+
export BUN_INSTALL=/usr/local
42+
curl -fsSL https://bun.sh/install | bash
43+
fi
44+
}
45+
install() {
46+
utils_check_version "$VERSION"
47+
export BUN_INSTALL=/usr/local
48+
bun_ensure_installed
49+
if [ "$VERSION" == 'latest' ] || [ -z "$VERSION" ]; then
50+
bun install -g @shreyaskapale/gitagent
51+
else
52+
bun install -g "@shreyaskapale/gitagent@${VERSION}"
53+
fi
54+
apt_get_cleanup
55+
}
56+
echo_banner "devcontainer.community"
57+
echo "Installing $binaryName..."
58+
install "$@"
59+
echo "(*) Done!"

test/gitagent.sh/test.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
4+
set -e
5+
6+
# Optional: Import test library bundled with the devcontainer CLI
7+
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
8+
# Provides the 'check' and 'reportResults' commands.
9+
source dev-container-features-test-lib
10+
11+
# Feature-specific tests
12+
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
13+
# check <LABEL> <cmd> [args...]
14+
15+
check "check existence" bash -c "ls -lah /usr/local/bin/gitagent"
16+
17+
# Report results
18+
# If any of the checks above exited with a non-zero exit code, the test will fail.
19+
reportResults

0 commit comments

Comments
 (0)