mit einem Klick
create-ghorg-workspace
// Creates a new ghorg reclone command for a VSCode workspace. Works on macOS, Linux, and Windows. Appends to the ghorg reclone.yaml config and creates a workspace repo list file.
// Creates a new ghorg reclone command for a VSCode workspace. Works on macOS, Linux, and Windows. Appends to the ghorg reclone.yaml config and creates a workspace repo list file.
| name | create-ghorg-workspace |
| description | Creates a new ghorg reclone command for a VSCode workspace. Works on macOS, Linux, and Windows. Appends to the ghorg reclone.yaml config and creates a workspace repo list file. |
Creates a ghorg reclone workspace configuration and its repository list file, then clones the repositories. After completion the workspace is ready to use.
PATH.This skill works on macOS, Linux, and Windows. All file paths are constructed using the resolved environment variables below. Path separators are determined by the host operating system — use / on macOS and Linux, and \ on Windows. When running shell commands, use the appropriate shell for the platform (bash/zsh on macOS/Linux, cmd/powershell on Windows).
| Variable | Description | Default |
|---|---|---|
| HOME_DIR | Home directory used as the base for all paths | Detected from the operating system (see below) |
| SCM_ORG | SCM organization to clone from | Required — must be provided by the user |
Resolve HOME_DIR using the following strategy:
$HOME_DIR (or %HOME_DIR% on Windows) is set, use that value.$HOME environment variable (typically /Users/<username> on macOS, /home/<username> on Linux).%USERPROFILE% environment variable (typically C:\Users\<username>).Resolve SCM_ORG using the following strategy:
$SCM_ORG (or %SCM_ORG% on Windows) is set, use that value.What is the SCM organization to clone from?
Example: my-github-org
Store as SCM_ORG. This value is required and cannot be empty.
All paths are relative to HOME_DIR. Use the platform-appropriate path separator.
| Variable | Path |
|---|---|
| GHORG_CONFIG_DIR | HOME_DIR/.config/ghorg |
| GHORG_RECLONE_CONFIG | HOME_DIR/.config/ghorg/reclone.yaml |
| WORKSPACE_DIR | HOME_DIR/workspaces |
| REPO_FILE_TEMPLATE | HOME_DIR/.config/ghorg/workspace-<WORKSPACE_NAME>.txt |
Windows note: On Windows the ghorg config directory may be at
%USERPROFILE%\.config\ghorg. Verify by checking if the directory exists or by runningghorg ls. Adjust paths accordingly.
Resolve HOME_DIR and SCM_ORG as described in the Environment variables section above. Both values must be resolved before continuing.
Prompt the user:
What should the new reclone workspace be called?
Example: my-reclone
Validation: Must match regex ^[a-z0-9-]+$ (lowercase letters, numbers, hyphens only).
Store as WORKSPACE_NAME. If invalid, ask again until valid.
Prompt the user:
List any repositories to include in this workspace.
Enter one repository per line. Press enter on an empty line when finished.
Example input:
repo-one
repo-two
repo-three
Store as REPO_LIST. If none provided, continue with an empty list (empty file).
Create the file:
HOME_DIR/.config/ghorg/workspace-<WORKSPACE_NAME>.txt
Example: HOME_DIR/.config/ghorg/workspace-my-reclone.txt
Append the following YAML block to HOME_DIR/.config/ghorg/reclone.yaml:
<WORKSPACE_NAME>:
cmd: "ghorg clone <SCM_ORG> --path=<HOME_DIR>/workspaces --target-repos-path=<HOME_DIR>/.config/ghorg/workspace-<WORKSPACE_NAME>.txt --output-dir=<WORKSPACE_NAME>"
description: "Workspace for <WORKSPACE_NAME>"
Replace <WORKSPACE_NAME>, <SCM_ORG>, and <HOME_DIR> with the resolved values.
Rules:
Run the following command:
ghorg reclone <WORKSPACE_NAME>
This clones the repositories into HOME_DIR/workspaces/<WORKSPACE_NAME>.
Create the file:
HOME_DIR/workspaces/<WORKSPACE_NAME>/<WORKSPACE_NAME>.code-workspace
With the following contents:
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
After all steps complete, output:
Workspace created and cloned successfully.
Workspace name:
<WORKSPACE_NAME>
SCM organization:
<SCM_ORG>
Repo list file:
<HOME_DIR>/.config/ghorg/workspace-<WORKSPACE_NAME>.txt
Config updated:
<HOME_DIR>/.config/ghorg/reclone.yaml
Cloned to:
<HOME_DIR>/workspaces/<WORKSPACE_NAME>
VS Code workspace file:
<HOME_DIR>/workspaces/<WORKSPACE_NAME>/<WORKSPACE_NAME>.code-workspace
Replace <WORKSPACE_NAME>, <SCM_ORG>, and <HOME_DIR> with the resolved values.
Stop and report an error (do not silently continue) if:
reclone.yaml.ghorg reclone command fails (non-zero exit code).Never silently continue after an error.