Skip to content

fix(create): use harness-first language when project already exists#1594

Open
tejaskash wants to merge 1 commit into
mainfrom
tkashina/harness-first-existing-project-message
Open

fix(create): use harness-first language when project already exists#1594
tejaskash wants to merge 1 commit into
mainfrom
tkashina/harness-first-existing-project-message

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Problem

When a user runs agentcore create inside an existing project, the existing-project-error screen tells them only:

Use add agent to create a new agent in the existing project.

As part of the harness GA cutover, the create experience is harness-first. This message should lead with add harness.

Change

One file — src/cli/tui/screens/create/CreateScreen.tsx (the existing-project-error phase). The message now reads:

A project already exists at this location.
Found: <path>

Use add harness to add a harness to the existing project.
Or use add agent to add a code-based agent.

Unconditional — no isPreviewEnabled() branch — matching the post-merge GA state where there's a single CLI and harness is a first-class create option. This is consistent with the harness-first voice already used in the create-type picker in the same screen (Harness (recommended)).

This is the only place this message exists; the CLI flag path (validate.ts) only checks folder-name collisions and has no equivalent message.

Addresses the "harness-first language" action item (#4) in the Harness GA plan.

⚠️ Ordering dependency

add harness is still preview-gated today:

// src/cli/primitives/registry.ts
export const harnessPrimitive = isPreviewEnabled() ? new HarnessPrimitive() : undefined;

This message is only correct once harness is ungated for all builds — i.e. it must land with or after the __PREVIEW__ / isPreviewEnabled removal work. It should not ship to the latest npm tag before that gating is removed, or a GA build would point users at an add harness command that doesn't exist in that build.

Testing

  • npm run typecheck
  • eslint (pre-commit) ✅ / prettier ✅
  • create.test.ts — 16/16 pass
  • Rendered live in the TUI harness on a preview build (target state): both lines display correctly when running create from inside an existing project.

When a user runs `agentcore create` inside an existing project, the
existing-project-error screen now leads with `add harness` and offers
`add agent` as the code-based alternative, instead of pointing only at
`add agent`.

Part of the harness GA cutover (single CLI, harness as a first-class
create option). Unconditional — no isPreviewEnabled() branch — matching
the post-merge GA state.
@tejaskash tejaskash requested a review from a team June 18, 2026 20:38
@github-actions github-actions Bot added the size/xs PR size: XS label Jun 18, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jun 18, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 18, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.1.tgz

How to install

gh release download pr-1594-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.20.1.tgz

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 36.92% 13501 / 36559
🔵 Statements 36.21% 14356 / 39642
🔵 Functions 31.49% 2310 / 7335
🔵 Branches 30.69% 8917 / 29052
Generated in workflow #3724 for commit 6891012 by the Vitest Coverage Report Action

@agentcore-cli-automation agentcore-cli-automation 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.

Tiny, focused message change — implementation is correct. My only concern is the ordering dependency you've flagged in the PR description: the PR points users at add harness unconditionally, but on main that command is still preview-gated, and a release from main runs npm run build (not build:preview) so __PREVIEW__ = false and harnessPrimitive ends up undefined (registry.ts:26). A GA user hitting the existing-project-error screen would be told to run a command that isn't registered in their build. Left an inline comment with options.

<Box marginTop={1} flexDirection="column">
<Text>
Use <Text color="cyan">add agent</Text> to create a new agent in the existing project.
Use <Text color="cyan">add harness</Text> to add a harness to the existing project.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR description correctly calls out that this is only safe once add harness is ungated, but the change as written doesn't enforce that — the message renders the same regardless of __PREVIEW__. Today on main:

  • src/cli/primitives/registry.ts:26harnessPrimitive = isPreviewEnabled() ? new HarnessPrimitive() : undefined
  • src/cli/cli.ts:131-132 only registers commands for primitives in ALL_PRIMITIVES, so add harness is not registered in GA builds
  • .github/workflows/release.yml runs npm run build (GA, __PREVIEW__ = false) when releasing from main to npm latest

So if this PR merges to main and a latest release happens before harness is ungated, GA users will land on the existing-project-error screen, follow the instruction to run agentcore add harness, and hit error: 'harness' is not a valid subcommand.

A few ways to address:

  1. Gate the message on isPreviewEnabled() — show the new harness-first wording only in preview builds, keep the existing "Use add agent…" wording in GA. When the harness ungating PR lands and removes isPreviewEnabled() from registry.ts, it can also remove this branch and leave just the new message. Most defensive option, makes this PR independently safe to merge.
  2. Hold the PR and merge it as part of (or immediately after) the harness ungating PR, with a release-branch coordination so a latest build never goes out with this message but without add harness registered.
  3. Add a guard at registration time so the message is sourced from whether harnessPrimitive is defined (e.g. import harnessPrimitive and conditionally render the harness line). Same effect as option 1 but keyed off the actual registration rather than the build flag.

Option 1 or 3 would let this land independently of release sequencing.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants