Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gemini/commands/explain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
description = "Explains the code or text provided in plain English."

prompt = """
You are a helpful coding tutor.
Please explain the following code or text in simple, easy-to-understand terms:

{{args}}
"""
1 change: 1 addition & 0 deletions GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This document outlines mandatory operational guidelines, constraints, and best p
#### 2.2. File System
- **Allowed Write Directories:** `saved_code/`, `saved_csv/`.
- **Prohibited Write Directories:** Client library source directories (e.g., `google-ads-python/`, `google-ads-perl/`), `api_examples/`, or other project source directories unless explicitly instructed.
- **NEVER** modify the files in `api_examples/`. If you need to use a file as a base for a request, copy the comments and put the file with modifications in `saved_code/`.
- **All new or modified code MUST be written to the `saved_code/` directory.**
- **File Naming:** Use descriptive, language-appropriate names (e.g., `get_campaign_metrics.py`, `GetCampaignMetrics.java`).
- **Temporary Files:** Use the system's temporary directory.
Expand Down
39 changes: 16 additions & 23 deletions setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,23 @@ param(

$ErrorActionPreference = "Stop"

# --- Project Directory Resolution ---
# Determine the root directory of the current git repository.
try {
$ProjectDirAbs = git rev-parse --show-toplevel 2>$null
if (-not $ProjectDirAbs) { throw "Not in a git repo" }
# Normalize path separator
$ProjectDirAbs = (Get-Item -LiteralPath $ProjectDirAbs).FullName
}
catch {
Write-Error "ERROR: This script must be run from within the google-ads-api-developer-assistant git repository."
exit 1
}

Write-Host "Detected project root: $ProjectDirAbs"

# --- Configuration ---
$DefaultParentDir = Join-Path $HOME "gaada"
$DefaultParentDir = Join-Path $ProjectDirAbs "client_libs"
$AllLangs = @("python", "php", "ruby", "java", "dotnet")

# Helper to get repo config
Expand Down Expand Up @@ -76,21 +91,6 @@ if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
exit 1
}

# --- Project Directory Resolution ---
# Determine the root directory of the current git repository.
try {
$ProjectDirAbs = git rev-parse --show-toplevel 2>$null
if (-not $ProjectDirAbs) { throw "Not in a git repo" }
# Normalize path separator
$ProjectDirAbs = (Get-Item -LiteralPath $ProjectDirAbs).FullName
}
catch {
Write-Error "ERROR: This script must be run from within the google-ads-api-developer-assistant git repository."
exit 1
}

Write-Host "Detected project root: $ProjectDirAbs"

# --- Path Resolution and Validation ---
Write-Host "Ensuring default library directory exists: $DefaultParentDir"
if (-not (Test-Path -LiteralPath $DefaultParentDir)) {
Expand All @@ -117,13 +117,6 @@ foreach ($Lang in $AllLangs) {
$Config = Get-RepoConfig -Lang $Lang
$RepoPath = Join-Path $DefaultParentDir $Config.Name
$LibPaths[$Lang] = $RepoPath

# Validation: check against project dir
# Simple string check for subdirectory
if ($RepoPath.StartsWith($ProjectDirAbs)) {
Write-Error "ERROR: $Lang path ($RepoPath) cannot be a subdirectory of the project directory ($ProjectDirAbs)"
exit 1
}
}
}

Expand Down
26 changes: 11 additions & 15 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
}

# --- Project Directory Resolution ---
# Determine the root directory of the current git repository.
if ! PROJECT_DIR_ABS=$(git rev-parse --show-toplevel 2>/dev/null); then
err "ERROR: This script must be run from within the google-ads-api-developer-assistant git repository."
exit 1
fi
readonly PROJECT_DIR_ABS
echo "Detected project root: ${PROJECT_DIR_ABS}"

# --- Configuration ---
readonly DEFAULT_PARENT_DIR="${HOME}/gaada"
readonly DEFAULT_PARENT_DIR="${PROJECT_DIR_ABS}/client_libs"
readonly ALL_LANGS="python php ruby java dotnet"

# Helper functions for repo info (Replacing associative arrays for Bash 3.2 compatibility)
Expand Down Expand Up @@ -161,15 +170,6 @@ while [[ $# -gt 0 ]]; do
esac
done

# --- Project Directory Resolution ---
# Determine the root directory of the current git repository.
if ! PROJECT_DIR_ABS=$(git rev-parse --show-toplevel 2>/dev/null); then
err "ERROR: This script must be run from within the google-ads-api-developer-assistant git repository."
exit 1
fi
readonly PROJECT_DIR_ABS
echo "Detected project root: ${PROJECT_DIR_ABS}"

# --- Language Selection Logic ---
# If no languages selected, select all
if [[ "${ANY_SELECTED}" == "false" ]]; then
Expand Down Expand Up @@ -219,11 +219,7 @@ for lang in $ALL_LANGS; do
# Bash 3.2 compatible way to set variable by name
eval "LIB_PATH_${lang}='${ABS_PATH}'"

# Validation: check against project dir
if [[ "${ABS_PATH}" == "${PROJECT_DIR_ABS}"* ]]; then
err "ERROR: ${lang} path (${ABS_PATH}) cannot be a subdirectory of the project directory (${PROJECT_DIR_ABS})"
exit 1
fi

fi
done

Expand Down
6 changes: 1 addition & 5 deletions update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,7 @@ try {

$AbsLibPath = (Get-Item -LiteralPath $LibPath).FullName

# Skip if it is the project directory itself or a subdirectory of it
if ($AbsLibPath.StartsWith($ProjectDirAbs)) {
Write-Host "Skipping internal directory: $AbsLibPath"
continue
}


# Check if it is a git repository
if (-not (Test-Path -LiteralPath (Join-Path $AbsLibPath ".git"))) {
Expand Down
6 changes: 1 addition & 5 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ for lib_path in "${INCLUDE_DIRS[@]}"; do
continue
fi

# Skip if it is the project directory itself or a subdirectory of it
if [[ "${abs_lib_path}" == "${PROJECT_DIR_ABS}"* ]]; then
echo "Skipping internal directory: ${abs_lib_path}"
continue
fi


# Check if it is a git repository
if [[ ! -d "${abs_lib_path}/.git" ]]; then
Expand Down