Skip to content

feat: add the create flags of sync tools add and sync skills add - #951

Open
ctawiah wants to merge 1 commit into
ctawiah/create-attachments-1e8afrom
ctawiah/create-attachment-flags-1e8a
Open

ctawiah wants to merge 1 commit into
ctawiah/create-attachments-1e8afrom
ctawiah/create-attachment-flags-1e8a

Conversation

@ctawiah

@ctawiah ctawiah commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Context

The previous PR added the create flow of sync tools add and sync skills add behind AddAction.Create. This PR adds the flags, the help, and the messages that name the create command.

In #940, a reviewer asked that the errors for a missing tool or skill name the command that creates it. At that time, no such command existed. This PR adds the command to those errors.

What changes

  • sync tools add gets --json-schema and --description. sync skills add gets --content, --name, and --description. Both get --yes. A content flag turns the add into a create. The command builds the create input only from flags that the command line sets.
  • The help of sync tools add and sync skills add describes both forms, and has an example of a create without prompting. The help of sync tools and sync skills names the add.
  • The errors for a missing tool or skill name the command that creates it:
# add without a content flag
tool demo/refund does not exist in LaunchDarkly. To create it, run ldcli sync tools add --project demo --key refund with --json-schema, and optionally --description.

# a tool file without upsert, in a plan
tool "escalate" does not exist in LaunchDarkly. To create it, add "upsert": true to its file and run ldcli sync tools --project demo --key escalate. To stop syncing it, run ldcli sync tools detach --project demo --key escalate.

# the same tool, when a variation push needs it
tool "escalate" does not exist in LaunchDarkly. To create it, add "upsert": true to its file and run ldcli sync tools --project demo --key escalate.
  • The JSON outcome of a skill create gets a create object, with the name that sync sent and its source: flag, frontMatter, or key. A skill that a normal sync creates from a hand-written file reports it in the same way.
{
  "resourceKind": "skill",
  "projectKey": "demo",
  "lookupKey": "handoff",
  "action": "create_server",
  "status": "succeeded",
  "version": 1,
  "create": {
    "name": "Handoff",
    "nameSource": "key"
  }
}

Design notes

  • The add hint names the whole add command, not only the flags. sync tools also starts this add in a repository without sync files, and that command has no --json-schema.
  • add --json-schema refuses a tool that already has a file. So the error for a file without upsert names the sync that creates the tool after the user adds upsert.
  • AddCommand moves from prompt into bootstrap, so that the add hint and the existing filter errors share it.
  • nameSource is an unexported field of a plan row. planAttachment sets frontMatter or key from the file. Only the create knows about --name, so it sets flag. It carries the value to the row that it applies, because the new file always has name:.

Review focus

  • Does each message name a command that works from where the user is?
  • Is the help clear about when add creates a resource and when it only starts syncing one?

Verification

  • go test ./... and golangci-lint run (v2.9.0) pass.
  • The message tests in plan_test.go, execute_test.go, bootstrap/attachments_test.go, create_test.go, and acceptance_test.go failed before the change and pass now.
  • TestCreateMakesASkillFromFlags checks the create object for key and flag, and TestSyncReportsTheNameOfASkillThatItCreatesFromAFile checks it for frontMatter and key. The first test fails when the create does not carry the name source to the applied row.
  • scope_test.go checks the new flags. It also checks that the create input comes only from flags that the command line sets, also when a flag has an empty value.
  • I built ldcli and ran a flag-only script against a stand-in for the LaunchDarkly API:
    • the help, and adds without a content flag
    • every content rule, with no request
    • a tool create: a dry run, no --yes, and --yes
    • skill creates with a name from the key and from --name
    • adopts of a tagged tool and of a renamed skill, and the refusals
    • a rejected create that removes its file, and a create that leaves other pending changes alone
    • the new error messages
  • I also ran a skill create in a terminal: the project picker, the key question, the name and description questions, and the confirmation. While the question waited, the file did not exist.
  • In plain text, a rejected create ends with unknown error occurred. main does the same for any failed apply, so the fix is tracked separately.

Related changes

This stack builds on #937 to #941, which are merged.

  1. fix: exclude expanded tools from prompt diffs #957: Exclude expanded tools from prompt diffs (ctawiah/fix-prompt-tool-diff-5b1c)
  2. fix: plan a tool or skill row when a variation newly references it #945: Plan a tool or skill row when a variation newly references it (ctawiah/plan-referenced-attachments-1e8a)
  3. feat: keep unused tools and skills, and detach any resource kind #946: Keep unused tools and skills, and detach any resource kind (ctawiah/keep-unused-attachments-1e8a)
  4. feat: add tools and skills from LaunchDarkly #947: Add tools and skills from LaunchDarkly (ctawiah/add-attachments-1e8a)
  5. feat: route sync, add, and detach by scope #948: Route sync, add, and detach by scope (ctawiah/route-scopes-1e8a)
  6. feat: add the sync all, sync tools, and sync skills commands #949: Add the sync all, sync tools, and sync skills commands (ctawiah/scope-commands-1e8a)
  7. feat: create a tool or a skill from the content of an add #950: Create a tool or a skill from the content of an add (ctawiah/create-attachments-1e8a)
  8. This PR: add the create flags of sync tools add and sync skills add (ctawiah/create-attachment-flags-1e8a)
  9. refactor: share the selection of a new variation, and check any kind before an add #952: Share the selection of a new variation, and check any kind before an add (ctawiah/share-variation-selection-1e8a)
  10. feat: create a prompt variation from the content of an add #953: Create a prompt variation from the content of an add (ctawiah/create-variations-1e8a)
  11. feat: add the create flags of sync prompts add #954: Add the create flags of sync prompts add (ctawiah/create-variation-flags-1e8a)

Note

Overview
sync tools add and sync skills add now support creating resources via CLI flags, not only adopting existing LaunchDarkly tools/skills.

Setting --json-schema (tools) or --content (skills) switches add into create mode; tools also get --description, skills get --name and --description, and both get --yes. Create input is built only from flags the user actually set on the command line (empty values still count). Help text and examples describe adopt vs create.

When a tool or skill is missing, errors point users at the right fix: run sync … add with the create flags, or add upsert to a local file and run sync tools/sync skills. AddCommand moves to bootstrap for shared hints. JSON outcomes for skill creates include a create object with name and nameSource (flag, frontMatter, or key).

Reviewed by Cursor Bugbot for commit 335233b. Bugbot is set up for automated code reviews on this repo. Configure here.

@ctawiah
ctawiah added this pull request to stack #955 October 22, 2026 22:19
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch from 5e03319 to ee136c2 Compare October 23, 2026 00:13
@ctawiah
ctawiah removed this pull request from stack #955 October 23, 2026 00:15
@ctawiah
ctawiah added this pull request to stack #960 October 23, 2026 00:16
@ctawiah
ctawiah marked this pull request as ready for review October 23, 2026 14:11
@ctawiah
ctawiah requested a review from a team as a code owner October 23, 2026 14:11
@ctawiah
ctawiah requested review from nkester-ld and wchieng and removed request for a team October 23, 2026 14:11
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch from ee136c2 to 7e87ae4 Compare October 23, 2026 14:27
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch from 7e87ae4 to b380be3 Compare October 23, 2026 14:40
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch 2 times, most recently from 036e3a4 to e03810e Compare October 23, 2026 14:56
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch from e03810e to a416640 Compare October 23, 2026 17:07
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch from a416640 to e64f4f3 Compare October 23, 2026 21:17
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch from e64f4f3 to f867cf6 Compare October 23, 2026 21:26
sync tools add takes --json-schema and --description, and sync skills
add takes --content, --name, and --description. A content flag turns the
add into a create. Both commands get --yes, which skips the confirmation
of a create. The command builds the create input only from flags that
the command line sets.

The errors for a missing tool or skill now name the command that creates
it. A missing resource without a content flag names the add with its
create flags. A tool or skill file without upsert names the sync that
creates it after the user adds upsert. AddCommand moves into bootstrap,
so that both packages use it.

A JSON outcome of a skill create has a create object with the name that
sync sent and its source: flag, frontMatter, or key.
@cursor
cursor Bot force-pushed the ctawiah/create-attachment-flags-1e8a branch from f867cf6 to 335233b Compare October 23, 2026 21:39
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