feat(kugetsu): add env pass-through for agent delegation #84

Closed
shoko wants to merge 1 commits from feat/issue-76-env-pass-through into main
Owner

Summary

Add per-agent environment variable management for delegation.

Features

kugetsu env command

  • kugetsu env list - List all env files
  • kugetsu env show [agent] - Show env file contents (masked)
  • kugetsu env set <key> <value> [agent] - Set key=value in agent env
  • kugetsu env get <key> [agent] - Get value for key
  • kugetsu env rm <key> [agent] - Remove key from agent env

Sensitive Value Masking

Masks: GITEA_TOKEN, GITHUB_TOKEN, GITLAB_TOKEN, API_KEY, PASSWORD, TOKEN, SECRET

cmd_delegate

  • Loads pm-agent.env (or default.env) before running opencode
  • Passes GITEA_TOKEN from environment

cmd_init

  • Creates env directory with default.env and pm-agent.env templates
  • Adds git servers config to config file

Usage

# Set GITEA_TOKEN for PM agent
kugetsu env set GITEA_TOKEN your_token_here pm-agent

# Verify (token masked)
kugetsu env show pm-agent

# Delegate - agent will have GITEA_TOKEN
kugetsu delegate "post comment on #69"

Fixes #76
Related: #78 (includes cmd_server)

## Summary Add per-agent environment variable management for delegation. ## Features ### kugetsu env command - `kugetsu env list` - List all env files - `kugetsu env show [agent]` - Show env file contents (masked) - `kugetsu env set <key> <value> [agent]` - Set key=value in agent env - `kugetsu env get <key> [agent]` - Get value for key - `kugetsu env rm <key> [agent]` - Remove key from agent env ### Sensitive Value Masking Masks: GITEA_TOKEN, GITHUB_TOKEN, GITLAB_TOKEN, API_KEY, PASSWORD, TOKEN, SECRET ### cmd_delegate - Loads pm-agent.env (or default.env) before running opencode - Passes GITEA_TOKEN from environment ### cmd_init - Creates env directory with default.env and pm-agent.env templates - Adds git servers config to config file ## Usage ```bash # Set GITEA_TOKEN for PM agent kugetsu env set GITEA_TOKEN your_token_here pm-agent # Verify (token masked) kugetsu env show pm-agent # Delegate - agent will have GITEA_TOKEN kugetsu delegate "post comment on #69" ``` Fixes #76 Related: #78 (includes cmd_server)
shoko added 1 commit 2026-04-02 01:11:22 +02:00
Add 'kugetsu env' command for managing per-agent environment variables:
- kugetsu env list              List all env files
- kugetsu env show [agent]       Show env file contents (masked)
- kugetsu env set <k> <v> [a]  Set key=value in agent env
- kugetsu env get <k> [a]      Get value for key
- kugetsu env rm <k> [a]        Remove key from agent env

Add mask_sensitive_vars() to hide sensitive values in logs:
- Masks: GITEA_TOKEN, GITHUB_TOKEN, GITLAB_TOKEN, API_KEY, PASSWORD, TOKEN, SECRET

Update cmd_delegate to:
- Load pm-agent.env (or default.env) before running opencode
- Pass GITEA_TOKEN from environment if set

Update cmd_init to:
- Create git servers config in config file
- Create env directory with default.env and pm-agent.env templates

Also includes cmd_server from #78 fix.

Fixes #76
Related: #78
First-time contributor

my question is, is it needed to have a separate file for environment rather than utilizing config file?

my question is, is it needed to have a separate file for environment rather than utilizing config file?
shoko closed this pull request 2026-04-02 02:30:51 +02:00

Pull request closed

Sign in to join this conversation.