restructure: flatten scripts dirs, remove roster, update SKILL.md
This commit is contained in:
@@ -12,7 +12,7 @@ description: Git operations for hangman-lab.top - manage accounts, tokens, repos
|
|||||||
Verify git credentials are configured correctly.
|
Verify git credentials are configured correctly.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/git/git-ctrl check-git-cred
|
{baseDir}/scripts/git-ctrl check-git-cred
|
||||||
```
|
```
|
||||||
|
|
||||||
### Create Git Account
|
### Create Git Account
|
||||||
@@ -22,7 +22,7 @@ Create a new git account and configure access.
|
|||||||
> ⚠️ **Warning**: Do not execute this command unless explicitly requested. If you don't have a git account, contact **agent-resource-director** or **hangman** to guide you through the process.
|
> ⚠️ **Warning**: Do not execute this command unless explicitly requested. If you don't have a git account, contact **agent-resource-director** or **hangman** to guide you through the process.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/git/git-ctrl create-git-account --username <username> --email <email>
|
{baseDir}/scripts/git-ctrl create-git-account
|
||||||
```
|
```
|
||||||
|
|
||||||
### Generate Access Token
|
### Generate Access Token
|
||||||
@@ -30,7 +30,7 @@ Create a new git account and configure access.
|
|||||||
Generate an access token for the current user.
|
Generate an access token for the current user.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/git/git-ctrl generate-access-token
|
{baseDir}/scripts/git-ctrl generate-access-token
|
||||||
```
|
```
|
||||||
|
|
||||||
### Link Keycloak Account
|
### Link Keycloak Account
|
||||||
@@ -38,7 +38,7 @@ Generate an access token for the current user.
|
|||||||
Link Keycloak account with Gitea (for OAuth binding).
|
Link Keycloak account with Gitea (for OAuth binding).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/git/git-ctrl link-keycloak
|
{baseDir}/scripts/git-ctrl link-keycloak
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add Repository Collaborator
|
### Add Repository Collaborator
|
||||||
@@ -46,12 +46,7 @@ Link Keycloak account with Gitea (for OAuth binding).
|
|||||||
Add a collaborator to a repository.
|
Add a collaborator to a repository.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Add to specific repository
|
{baseDir}/scripts/git-ctrl repo-add-collaborators --user <user> --repo <repo>
|
||||||
{baseDir}/scripts/git/git-ctrl repo-add-collaborators --user <user> --repo <repo>
|
|
||||||
|
|
||||||
# Add to roster repository (hzhang/.roster)
|
|
||||||
# ⚠️ This command can only be executed by agent-resource-director
|
|
||||||
{baseDir}/scripts/git/git-ctrl repo-add-collaborators --user <user> --roster
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Repository Config
|
### Repository Config
|
||||||
@@ -59,7 +54,7 @@ Add a collaborator to a repository.
|
|||||||
When you clone a repository from git.hangman-lab.top and are ready to develop, or after creating a new local repo with git init, run:
|
When you clone a repository from git.hangman-lab.top and are ready to develop, or after creating a new local repo with git init, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/git/git-ctrl repo-config --repo-path <path to your repo> --email <your email>
|
{baseDir}/scripts/git-ctrl repo-config --repo-path <path to your repo>
|
||||||
```
|
```
|
||||||
|
|
||||||
### External Login Control
|
### External Login Control
|
||||||
@@ -67,8 +62,8 @@ When you clone a repository from git.hangman-lab.top and are ready to develop, o
|
|||||||
Enable or disable local login on Gitea.
|
Enable or disable local login on Gitea.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/git/git-ctrl external-login-ctrl --enable
|
{baseDir}/scripts/git-ctrl external-login-ctrl --enable
|
||||||
{baseDir}/scripts/git/git-ctrl external-login-ctrl --disable
|
{baseDir}/scripts/git-ctrl external-login-ctrl --disable
|
||||||
```
|
```
|
||||||
|
|
||||||
### Reset Password
|
### Reset Password
|
||||||
@@ -76,5 +71,5 @@ Enable or disable local login on Gitea.
|
|||||||
Reset password for the current user (reads username from secret-mgr).
|
Reset password for the current user (reads username from secret-mgr).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/git/git-ctrl reset-password
|
{baseDir}/scripts/git-ctrl reset-password
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Get the directory where this script is located
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
||||||
|
|
||||||
# Get username from ego-mgr
|
|
||||||
username=$(ego-mgr get default-username)
|
|
||||||
|
|
||||||
# Check if username is provided
|
|
||||||
if [[ -z "$username" ]]; then
|
|
||||||
echo "Error: default-username not set in ego-mgr, please contact ard"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
roster=false
|
|
||||||
|
|
||||||
# Parse arguments
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case $1 in
|
|
||||||
--repo)
|
|
||||||
repo="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--user)
|
|
||||||
user="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--roster)
|
|
||||||
roster=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown option: $1"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check if user is provided
|
|
||||||
if [[ -z "$user" ]]; then
|
|
||||||
echo "Usage: $0 --user <user> [--repo <repo>] [--roster]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle roster mode
|
|
||||||
if [[ "$roster" == "true" ]]; then
|
|
||||||
owner="hzhang"
|
|
||||||
repo=".roster"
|
|
||||||
|
|
||||||
# Check if git-adm key exists
|
|
||||||
if ! secret-mgr list | grep -q "git-adm"; then
|
|
||||||
echo "you dont have permission to run this script"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
token=$(secret-mgr get-secret --key git-adm)
|
|
||||||
else
|
|
||||||
# Check if repo and git-access-token are provided
|
|
||||||
if [[ -z "$repo" ]]; then
|
|
||||||
echo "Usage: $0 --user <user> --repo <repo>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! secret-mgr list | grep -q "git-access-token"; then
|
|
||||||
echo "generate your access token first"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
owner=$(secret-mgr get-username --key git)
|
|
||||||
token=$(secret-mgr get-secret --key git-access-token)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Execute
|
|
||||||
curl -X PUT -H "Authorization: token $token" -H "Content-Type: application/json" -d '{"permission":"write"}' "https://git.hangman-lab.top/api/v1/repos/$owner/$repo/collaborators/$user"
|
|
||||||
49
git-hangman-lab/scripts/repo-add-collaborators
Executable file
49
git-hangman-lab/scripts/repo-add-collaborators
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Get the directory where this script is located
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
|
||||||
|
# Get username from ego-mgr
|
||||||
|
username=$(ego-mgr get default-username)
|
||||||
|
|
||||||
|
# Check if username is provided
|
||||||
|
if [[ -z "$username" ]]; then
|
||||||
|
echo "Error: default-username not set in ego-mgr, please contact ard"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
--repo)
|
||||||
|
repo="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--user)
|
||||||
|
user="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if user and repo are provided
|
||||||
|
if [[ -z "$user" || -z "$repo" ]]; then
|
||||||
|
echo "Usage: $0 --user <user> --repo <repo>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if git-access-token exists
|
||||||
|
if ! secret-mgr list | grep -q "git-access-token"; then
|
||||||
|
echo "generate your access token first"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
owner=$(secret-mgr get-username --key git)
|
||||||
|
token=$(secret-mgr get-secret --key git-access-token)
|
||||||
|
|
||||||
|
# Execute
|
||||||
|
curl -X PUT -H "Authorization: token $token" -H "Content-Type: application/json" -d '{"permission":"write"}' "https://git.hangman-lab.top/api/v1/repos/$owner/$repo/collaborators/$user"
|
||||||
@@ -14,7 +14,7 @@ Create a new Keycloak account.
|
|||||||
> ⚠️ **Warning**: Do not execute this command unless explicitly requested. If you don't have a Keycloak account, contact **agent-resource-director** or **hangman** to guide you through the process.
|
> ⚠️ **Warning**: Do not execute this command unless explicitly requested. If you don't have a Keycloak account, contact **agent-resource-director** or **hangman** to guide you through the process.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/keycloak/kc-ctrl create-keycloak-account --username <username> --email <email>
|
{baseDir}/scripts/kc-ctrl create-keycloak-account
|
||||||
```
|
```
|
||||||
|
|
||||||
### Verify Email
|
### Verify Email
|
||||||
@@ -22,7 +22,7 @@ Create a new Keycloak account.
|
|||||||
Verify user email in Keycloak.
|
Verify user email in Keycloak.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/keycloak/kc-ctrl verify-email
|
{baseDir}/scripts/kc-ctrl verify-email
|
||||||
```
|
```
|
||||||
|
|
||||||
### Set User Name
|
### Set User Name
|
||||||
@@ -30,7 +30,7 @@ Verify user email in Keycloak.
|
|||||||
Set user firstName and lastName in Keycloak.
|
Set user firstName and lastName in Keycloak.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/keycloak/kc-ctrl set-name
|
{baseDir}/scripts/kc-ctrl set-name
|
||||||
```
|
```
|
||||||
|
|
||||||
### Reset Password
|
### Reset Password
|
||||||
@@ -38,5 +38,5 @@ Set user firstName and lastName in Keycloak.
|
|||||||
Reset password for the current user (reads username from secret-mgr).
|
Reset password for the current user (reads username from secret-mgr).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
{baseDir}/scripts/keycloak/kc-ctrl reset-password
|
{baseDir}/scripts/kc-ctrl reset-password
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user