Preset composition: no mode for extending arrays at the same @path

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
typescript
Domain
cli

Research direction

The issue does not name implementation files, tests, or an entry point. Start by locating the preset composition and remove handling, then resolve the open questions around deduplication, ordering, and user-added matching entries before defining what a completed change should verify.

Written by the indexing model from the issue text.

Description

Problem

Two presets cannot both contribute to the same array-valued config path. Existing modes:

  • replace — last writer wins; second install clobbers the first
  • merge — object key-merge only; doesn't apply to arrays
Concrete scenario

Today jdtls-lombok writes to `lsp.jdtls.command`:

```json
["jdtls", "--jvm-arg=-javaagent:{{cache}}/lombok.jar"]
```

If a future `jdtls-heap` preset also wanted to extend that command (e.g. `--jvm-arg=-Xmx4g`), there's no clean way to install both. Installing the second overwrites the first.

Same shape would hit any future preset that wants to add a JVM arg, classpath entry, or CLI flag to an LSP that's already configured by another preset.

Workarounds today

  1. Bundle into one preset (loses modularity)
  2. Hand-edit opencode.json after install (breaks remove, breaks idempotency)
  3. Ship a personal preset via OPENCODE_PRESETS_PATH that shadows the bundled one

Proposed direction (not committing to it)

A third mode — append / extend — that concatenates into the array at @path, deduping by exact element match. remove would strip exactly the elements the preset added.

Open questions:

  • Dedup semantics (exact match? structural? by key prefix like `--jvm-arg=-javaagent:`?)
  • Order guarantees across multiple appenders
  • How remove interacts with user-added entries that happen to match

Why file now

No real second use case yet. Filing so it's not lost when one shows up — don't implement speculatively.

Dominant language
TypeScript
Stars
2
Forks
0
Avg merge
2m
Merged PRs (30d)
9

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.