Skip to content

comline add (onto main) - #41

Merged
Kinflou merged 1 commit into
mainfrom
feat/add-command
Oct 4, 2026
Merged

Kinflou merged 1 commit into
mainfrom
feat/add-command

Conversation

@Kinflou

@Kinflou Kinflou commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Lands comline add on main. It was reviewed and merged as cli#40, but cli#40 was stacked on cli#39's branch and merged into that branch after cli#39 had already merged, so it never reached main.

Same branch and commit as cli#40 (ed2aa8a), which sits directly on main: this diff is exactly cli#40's.

What it does, from cli#40:

comline add shared_types ../shared-types
comline add net --git https://github.com/acme/net --commit 4f2c9e1 --version 1.2.0
  1. Resolves first with core's deps::resolve (a git pin is fetched into .comline/deps-cache/), so an entry that wouldn't resolve is never written.
  2. Writes the entry into config.idp's dependencies block as a text edit in the file's own formatting.
  3. Pins hash to the content just compiled; --no-hash skips it.
  4. Reads the edit back with core's parser before writing anything.

It refuses, leaving config.idp alone, a name that's already declared, isn't an identifier, or is already one of the package's own namespaces; a directory that isn't a package; and a dependency that doesn't compile.

Test plan

  • cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check: clean on this commit. This PR also gets the CI run cli#40 never had: the workflow only runs on PRs into main.
  • Unit tests for the config.idp edit, and end-to-end tests on the real binary (path dependency pinned and importable, then a change to it fails check with "hash mismatch"; --no-hash; each refusal; a git dependency at a pinned commit), as described in cli#40.

Declares another Comline package as a dependency, the fourth step of the
editor-dependency design:

  comline add shared_types ../shared-types
  comline add net --git <uri> --commit <sha> --version 1.2.0

The dependency is resolved first with core's own deps::resolve (a git pin
is fetched into .comline/deps-cache/, then compiled), so an entry that
wouldn't resolve is never written. Its entry then goes into config.idp's
`dependencies` block (created at the end if there's none) as a text edit
in the file's own indentation, with `hash` pinned to the content just
compiled; --no-hash leaves it unpinned. The edit is read back with core's
parser before anything is written: it must declare exactly what was
declared before plus the new entry.

Refused, leaving config.idp alone: a name that's already declared, that
isn't an identifier, or that's already one of the package's own
namespaces (`use <name>::…` would mean both); a directory that isn't a
package; a dependency that doesn't compile.

A path dependency is a positional DIR rather than `--path`, which is
already the global "run against this directory" flag.

Also: docs/cli.md said `check` writes nothing to .comline/, but it fetches
git dependencies into .comline/deps-cache/.
@Kinflou
Kinflou merged commit cd7a86e into main Oct 4, 2026
2 checks passed
@Kinflou
Kinflou deleted the feat/add-command branch October 4, 2026 12:23
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