Skip to content
Open
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
67 changes: 51 additions & 16 deletions .claude/skills/grid-api/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,36 +55,71 @@ For detailed information, read these reference files in the `references/` direct

## Configuration

**Prerequisites**: Build the CLI before first use:
**IMPORTANT**: Before building the CLI, you MUST configure credentials. Follow this order:

### Step 1: Check Environment Variables

First, check if credentials are already set in the current environment:
```bash
cd cli && npm install && npm run build && cd ..
echo "Token ID: ${GRID_API_TOKEN_ID:+[set]}"
echo "Client Secret: ${GRID_API_CLIENT_SECRET:+[set]}"
echo "Base URL: ${GRID_BASE_URL:-https://api.lightspark.com/grid/2025-10-13}"
```

### Quick Setup (Recommended)
**IMPORTANT**: Never output or echo actual credential values. Only check if they are set.

If both show `[set]`, skip to Step 4 (Build CLI). If either is empty, continue to Step 2.
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect skip condition

The instruction “If both show [set], skip to Step 4” is incorrect because Step 1 prints three lines and only two can ever show [set] (Token ID + Client Secret); the Base URL line prints the URL value even when unset. This makes the “both show” condition impossible to satisfy as written and will confuse users following the setup flow. Consider rephrasing to explicitly key off the two required vars (e.g., “If Token ID and Client Secret show [set], …”).

Prompt To Fix With AI
This is a comment left during a code review.
Path: .claude/skills/grid-api/SKILL.md
Line: 71:71

Comment:
**Incorrect skip condition**

The instruction “If both show `[set]`, skip to Step 4” is incorrect because Step 1 prints three lines and only two can ever show `[set]` (Token ID + Client Secret); the Base URL line prints the URL value even when unset. This makes the “both show” condition impossible to satisfy as written and will confuse users following the setup flow. Consider rephrasing to explicitly key off the two required vars (e.g., “If Token ID and Client Secret show `[set]`, …”).

How can I resolve this? If you propose a fix, please make it concise.


### Step 2: Check for Setup Script

Run the interactive configuration command:
If environment variables are not set, check for the setup script:
```bash
node cli/dist/index.js configure
ls -la setup-grid-credentials.sh 2>/dev/null
```

This will:
1. Prompt for your API Token ID and Client Secret
2. Validate the credentials against the API
3. Save them to `~/.grid-credentials`
If the script exists, source it to load credentials:
```bash
source ./setup-grid-credentials.sh
```
Comment on lines +81 to +83
Copy link
Contributor

Choose a reason for hiding this comment

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

Unsafe sourcing guidance

source ./setup-grid-credentials.sh executes an arbitrary local script with the user’s shell privileges. For a repo doc, this is risky guidance unless the script is guaranteed to be created by this project and its expected contents are verified. At minimum, the instructions should constrain this to a trusted, repo-provided script (or replace with an explicit export ... flow) so users don’t copy/paste a command that runs an unknown file.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .claude/skills/grid-api/SKILL.md
Line: 81:83

Comment:
**Unsafe sourcing guidance**

`source ./setup-grid-credentials.sh` executes an arbitrary local script with the user’s shell privileges. For a repo doc, this is risky guidance unless the script is guaranteed to be created by this project and its expected contents are verified. At minimum, the instructions should constrain this to a trusted, repo-provided script (or replace with an explicit `export ...` flow) so users don’t copy/paste a command that runs an unknown file.

How can I resolve this? If you propose a fix, please make it concise.


### Alternative: Environment Variables
Then verify the credentials are now set (repeat Step 1 check).

You can also configure via environment variables:
- `GRID_API_TOKEN_ID` - API token ID
- `GRID_API_CLIENT_SECRET` - API client secret
- `GRID_BASE_URL` - Base URL (defaults to `https://api.lightspark.com/grid/2025-10-13`)
### Step 3: Prompt for Credentials (if needed)

**Skip this step if** environment variables are set (Step 1) OR the setup script exists (Step 2).

Only if neither exists, prompt the user for credentials one at a time:

### Non-Interactive Setup
1. First, ask for their **API Token ID** (`GRID_API_TOKEN_ID`)
2. After receiving the token ID, ask for their **Client Secret** (`GRID_API_CLIENT_SECRET`)
3. Finally, ask if they want to override the default base URL (`https://api.lightspark.com/grid/2025-10-13`). Only request `GRID_BASE_URL` if they say yes.

**SECURITY**: When the user provides credentials:
- Never echo, log, or display the credential values
- Never include credentials in command output or error messages
- Export them directly without confirmation output

Once provided, export the credentials silently (do not echo):
```bash
node cli/dist/index.js configure --token-id <id> --client-secret <secret>
export GRID_API_TOKEN_ID="<user-provided-token-id>"
export GRID_API_CLIENT_SECRET="<user-provided-client-secret>"
# Optional: only if user provided a custom base URL
export GRID_BASE_URL="<user-provided-base-url>"
```

### Step 4: Build the CLI

Only after credentials are configured, build the CLI:
```bash
cd cli && npm install && npm run build && cd ..
```

### Environment Variables Reference

- `GRID_API_TOKEN_ID` - API token ID (required)
- `GRID_API_CLIENT_SECRET` - API client secret (required)
- `GRID_BASE_URL` - Base URL (defaults to `https://api.lightspark.com/grid/2025-10-13`)

## CLI Commands

Run all CLI commands from the repo root using: `node cli/dist/index.js <command>`
Expand Down