init workspace

This commit is contained in:
dauren_moldabayev 2026-05-31 20:02:20 +00:00
commit 3f3da68275
5 changed files with 79 additions and 0 deletions

7
.gitconfig Normal file
View File

@ -0,0 +1,7 @@
[user]
name = dauren_moldabayev
email = daurenmoldabaev99@gmail.com
[credential]
helper = store
[credential "https://git.vibe42.kz"]
username = dauren_moldabayev

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.git-credentials

20
AGENTS.md Normal file
View File

@ -0,0 +1,20 @@
# Agent Instructions
This workspace belongs to `dauren_moldabayev`.
Use the self-hosted Git server only:
- Git: https://git.vibe42.kz
- User profile: https://git.vibe42.kz/dauren_moldabayev
- Pages: https://pages.git.vibe42.kz/dauren_moldabayev/<repo>/
Credentials are already configured in `/workspaces/dauren_moldabayev/.git-credentials`.
Do not ask the user for a GitHub URL or a token.
To create a new project, run:
```bash
cd /workspaces/dauren_moldabayev
./new-project NAME
cd NAME
```

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# Workspace dauren_moldabayev
OpenCode рабочая папка пользователя `dauren_moldabayev`.
Создать проект:
```bash
./new-project my-project
cd my-project
```
Git profile: https://git.vibe42.kz/dauren_moldabayev
Pages base: https://pages.git.vibe42.kz/dauren_moldabayev/

38
new-project Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="${1:-}"
if [ -z "$REPO" ]; then
echo "Usage: ./new-project repo-name"
exit 1
fi
case "$REPO" in
*[!A-Za-z0-9._-]*|"."|".."|"") echo "Repo name: only latin letters, digits, dot, underscore, dash"; exit 1;;
esac
USER="dauren_moldabayev"
TOKEN="$(head -n 1 "$SCRIPT_DIR/.git-credentials" | sed -E 's#^https?://[^:]+:([^@]+)@.*#\1#')"
echo "Creating repo $USER/$REPO..."
HTTP_CODE=$(curl -sS -o /tmp/gitea-create-repo.json -w "%{http_code}" -X POST "http://gitea:3000/api/v1/user/repos" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"name\":\"$REPO\",\"private\":false,\"auto_init\":true,\"default_branch\":\"main\"}")
if [ "$HTTP_CODE" != "201" ] && [ "$HTTP_CODE" != "409" ] && [ "$HTTP_CODE" != "422" ]; then
cat /tmp/gitea-create-repo.json
exit 1
fi
if [ ! -d "$REPO" ]; then
echo "Cloning..."
HOME="$SCRIPT_DIR" GIT_CONFIG_GLOBAL="$SCRIPT_DIR/.gitconfig" \
git clone "http://gitea:3000/$USER/$REPO.git"
git -C "$REPO" remote set-url origin "http://gitea:3000/$USER/$REPO.git"
fi
echo "Done: $REPO"
echo "Git: https://git.vibe42.kz/$USER/$REPO"
echo "Pages: https://pages.git.vibe42.kz/$USER/$REPO/"