Skip to content

Antigrav cli - #7

Open
jaybocc2 wants to merge 20 commits into
masterfrom
antigrav-cli
Open

Antigrav cli#7
jaybocc2 wants to merge 20 commits into
masterfrom
antigrav-cli

Conversation

@jaybocc2

Copy link
Copy Markdown
Owner

No description provided.

jaybocc2 added 20 commits May 19, 2026 13:30
- Add zsh wrapper function for agy to automatically add CWD/git root to trustedWorkspaces in settings.json
- Add git clean filter (clean-trusted-workspaces) using jq to strip local workspace paths from settings.json before staging/committing
- Add .gitattributes to apply the filter to settings.json
- Clean up old static trustedWorkspaces from settings.json

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the mcp-datadog script to serve as an MCP stdio transport, introduces Gemini/Antigravity CLI settings and skills (including humanizer and gh-cli documentation), and refactors install.sh and Zsh helpers for improved portability. The review feedback identifies several key areas for improvement: mcp-datadog needs robust error handling to prevent client hangs, proper home directory resolution, and clearer error messages; install.sh should avoid hardcoding 'master' as a fallback, include jq in its dependencies, and support non-interactive execution; the gowt Zsh function must be safer to prevent destroying branch history; and the gitconfig clean filter should handle null values gracefully.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread bin/mcp-datadog
Comment on lines +98 to +110
if (res.statusCode >= 200 && res.statusCode < 300) {
if (body.trim()) {
process.stdout.write(body.trim() + '\n');
}
} else {
console.error(body);
}
});
});

req.on('error', (e) => {
console.error(e.message);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If the HTTPS request fails (e.g., due to a network error) or returns a non-2xx status code, the script logs the error to console.error but does not write anything to process.stdout. Since this script acts as an MCP stdio transport, failing to return a response to stdout will cause the calling client (such as Claude or Gemini) to hang indefinitely waiting for a response to its request ID. To prevent this, you should parse the request ID from the incoming line and write a valid JSON-RPC error response to stdout when a failure occurs.

      if (res.statusCode >= 200 && res.statusCode < 300) {
        if (body.trim()) {
          process.stdout.write(body.trim() + '\n');
        }
      } else {
        console.error(body);
        try {
          const reqId = JSON.parse(line).id;
          if (reqId !== undefined) {
            process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: reqId, error: { code: -32603, message: 'Datadog API error: ' + res.statusCode } }) + '\n');
          }
        } catch (err) {}
      }
    });
  });

  req.on('error', (e) => {
    console.error(e.message);
    try {
      const reqId = JSON.parse(line).id;
      if (reqId !== undefined) {
        process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: reqId, error: { code: -32603, message: 'Network error: ' + e.message } }) + '\n');
      }
    } catch (err) {}
  });

Comment thread zsh/functions.zsh
Comment on lines +77 to +82
git fetch origin
local remote_head
remote_head=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)
local default_branch=${remote_head#refs/remotes/origin/}
default_branch=${default_branch:-main}
git reset --hard "origin/${default_branch}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If the branch already exists on origin (e.g., a remote branch you want to work on), resetting it to origin/${default_branch} (usually origin/main or origin/master) will destroy the branch's history and overwrite it with the default branch. It is much safer to check if origin/${branch} exists and reset to it, only falling back to the default branch if it is a completely new branch.

    git fetch origin
    if git rev-parse --verify "origin/${branch}" >/dev/null 2>&1; then
      git reset --hard "origin/${branch}"
    else
      local remote_head
      remote_head=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)
      local default_branch=${remote_head#refs/remotes/origin/}
      default_branch=${default_branch:-main}
      git reset --hard "origin/${default_branch}"
    fi

Comment thread bin/mcp-datadog
const path = require('path');
const readline = require('readline');

const envPath = path.join(process.env.HOME, '.env');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using process.env.HOME to locate the home directory can be unreliable or undefined in some environments. It is more robust and idiomatic in Node.js to use os.homedir() from the built-in os module.

const envPath = path.join(require('os').homedir(), '.env');

Comment thread bin/mcp-datadog
Comment on lines +30 to +32
if (!apiKey || !appKey || !site) {
process.exit(1);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When the required environment variables (DD_API_KEY, DD_APP_KEY, or DD_SITE) are missing, the script exits silently with code 1. It is highly recommended to print a descriptive error message to console.error before exiting so that users or MCP clients can easily diagnose the configuration issue.

if (!apiKey || !appKey || !site) {
  console.error('Error: Missing required environment variables. Please ensure DD_API_KEY, DD_APP_KEY, and DD_SITE are set.');
  process.exit(1);
}

Comment thread install.sh

DOT_FILES=$(git ls-tree '@{u}' | awk '{print $4}' | grep -Ev '(/|LICENSE|README|install.sh|shlibs|test.sh|.gitignore|.gitmodules|bashrc|^vim|vimrc|screenrc)')
# Check for upstream branch, but don't exit if it fails (first install might not have it)
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || echo "master")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Defaulting to 'master' when there is no upstream branch can cause the installation to fail if the repository's default branch is 'main' (which is standard for modern repositories). It is safer to fall back to the current local branch name using git rev-parse --abbrev-ref HEAD before defaulting to 'main'.

Suggested change
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || echo "master")
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")

Comment thread install.sh
Comment on lines 16 to 17
DEB_DEPS="zip unzip curl exuberant-ctags wget tmux zsh zsh-common vim git xclip zlib1g zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
libncurses5-dev libssl-dev build-essential htop libffi-dev libffi7 xz-utils"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The newly added gitconfig clean filter and the agy Zsh function both rely on jq to parse and manipulate JSON settings. However, jq is not included in DEB_DEPS, which means Linux users on Debian/Ubuntu-based systems might not have jq installed, causing these features to fail. Please add jq to DEB_DEPS.

Suggested change
DEB_DEPS="zip unzip curl exuberant-ctags wget tmux zsh zsh-common vim git xclip zlib1g zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
libncurses5-dev libssl-dev build-essential htop libffi-dev libffi7 xz-utils"
DEB_DEPS="zip unzip curl exuberant-ctags wget tmux zsh zsh-common vim git xclip zlib1g zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
libncurses5-dev libssl-dev build-essential htop libffi-dev libffi7 xz-utils jq"

Comment thread install.sh
Comment on lines +361 to +363
echo -n "File ${dst} already exists and is not a symlink. [B]ackup, [O]verwrite, [S]kip? (B/o/s) "
local action
read -n 1 -r action

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When running the installer in a non-interactive environment (e.g., automated scripts, CI, or SSH provisioning), the read -n 1 -r action command will fail or hang because there is no TTY. It is safer to check if stdin is a terminal using [[ -t 0 ]] and default to backing up the file if it is non-interactive.

Suggested change
echo -n "File ${dst} already exists and is not a symlink. [B]ackup, [O]verwrite, [S]kip? (B/o/s) "
local action
read -n 1 -r action
local action=""
if [[ -t 0 ]]; then
echo -n "File ${dst} already exists and is not a symlink. [B]ackup, [O]verwrite, [S]kip? (B/o/s) "
read -n 1 -r action
echo
else
echo "Non-interactive shell detected. Defaulting to Backup for ${dst}."
action="b"
fi

Comment thread gitconfig
syncmain = "!f() { CURRENT_BRANCH=$(git symbolic-ref --short HEAD); if [ \"$CURRENT_BRANCH\" = main ]; then echo 'Error: cannot run syncmain on main branch.' >&2; exit 1; fi; git checkout main && git pull origin main && git checkout \"$CURRENT_BRANCH\" && git rebase origin/main && git push origin \"$CURRENT_BRANCH\" --force-with-lease; }; f"

[filter "clean-trusted-workspaces"]
clean = "if command -v jq >/dev/null 2>&1; then jq --arg home \"$HOME\" '.trustedWorkspaces = [.trustedWorkspaces[] | select(. == ($home + \"/repos/jaybocc2/dotfiles\") or . == $home or (startswith($home + \"/repos/\") | not))]'; else cat; fi"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If trustedWorkspaces is missing or null in settings.json, jq will throw a 'cannot iterate over null' error and fail. Using the optional object identifier-index .trustedWorkspaces[]? instead of .trustedWorkspaces[] prevents this error and makes the clean filter more robust.

	clean = "if command -v jq >/dev/null 2>&1; then jq --arg home \"$HOME\" '.trustedWorkspaces = [.trustedWorkspaces[]? | select(. == ($home + \"/repos/jaybocc2/dotfiles\") or . == $home or (startswith($home + \"/repos/\") | not))]'; else cat; fi"

Comment on lines +1618 to +1620
gh codespace logs

--tail 100

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a formatting error inside the ````bash ````` code block where --tail 100 is placed on a separate line from the `gh codespace logs` command. These should be combined into a single command.

Suggested change
gh codespace logs
--tail 100
gh codespace logs --tail 100

>
> None of this means the tools are useless. It means they are tools. They do not replace judgment, and they do not eliminate the need for tests. If you do not have tests, you cannot tell whether the suggestion is right.

**What makes the below so obviously AI generated?**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The text refers to 'the below' when pointing to the draft rewrite, but the draft rewrite is actually located above this line. Please change 'below' to 'above' for clarity.

Suggested change
**What makes the below so obviously AI generated?**
**What makes the above so obviously AI generated?**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant