aws / aws/agentcore-cli

feat: add ability to edit harness configuration after creation

Aperta
#1,102 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
TypeScript
Stelle
283
Fork
95
Merge medio
1g 2h
PR unite (30g)
183

Descrizione

### Description

There is no way to edit a harness's configuration after the initial `agentcore add harness` flow. If a user needs to change the system prompt, swap a model, add/remove tools, or fix a misconfigured gateway tool, they have no CLI-native path to do so.

This is especially painful for **gateway tools within a harness**. When a gateway is added during harness creation, the ARN and auth config are written to `app//harness.json` — a file users don't know exists. If the gateway ARN or OAuth config is wrong, deployments fail with no discoverable way to fix it from the CLI.

### Current Behavior

`HarnessPrimitive` only implements `add()` and `remove()`. All harness configuration is written once during `add()`:

- **Harness spec** → `app//harness.json` (via `configIO.writeHarnessSpec()`)
- **System prompt** → `app//system-prompt.md`
- **Project reference** → `agentcore/agentcore.json`

Properties that cannot be changed after creation:
- System prompt
- Model provider / model ID
- Tools (browser, code_interpreter, MCP servers, **gateway ARN + auth config**)
- Max iterations, max tokens, timeout
- Truncation strategy
- Network mode, subnets, security groups
- Container URI / Dockerfile path
- Authentication configuration

The only workarounds are:
1. Manually edit `app//harness.json` (undiscoverable)
2. `agentcore remove harness` + `agentcore add harness` (destructive — loses customizations)

### Expected Behavior

Users should be able to edit harness configuration after creation. For example:

```
agentcore edit harness
agentcore edit harness --name
```

This could re-enter the wizard with current values as defaults, or open the config in an editor, or support targeted flag-based edits — whatever fits the CLI's UX patterns best.

### Relevant Code

- **Harness spec written (once):** `src/cli/primitives/HarnessPrimitive.ts` line ~177
- **System prompt written (once):** `src/cli/primitives/HarnessPrimitive.ts` lines ~178-183
- **Gateway tool config built during add:** `src/cli/primitives/HarnessPrimitive.ts` lines 110-138
- **Harness spec file path:** `app//harness.json` (via `PathResolver.getHarnessConfigPath()`)
- **Tools passed to API unchanged on deploy:** `src/cli/operations/deploy/imperative/deployers/harness-mapper.ts` lines 248-254
- **No `update()` or `edit()` method on `HarnessPrimitive` or `BasePrimitive`**

### Impact

Harness iteration is a core development workflow. Users frequently need to tweak system prompts, swap models, fix gateway ARNs, or add/remove tools. Currently, any mistake during initial creation forces users out of the CLI workflow — either manually editing files they don't know about, or destroying and recreating the entire harness.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by reading src/cli/primitives/HarnessPrimitive.ts around add(), configIO.writeHarnessSpec(), and the system-prompt writes, then inspect BasePrimitive and the deploy mapping in src/cli/operations/deploy/imperative/deployers/harness-mapper.ts. Check existing CLI command and wizard patterns before choosing an edit flow. Done means an existing harness can have its configuration updated through the CLI, including gateway ARN and auth settings, without removal and recreation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
cli
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.