Skip to main content
← Back to list
01Issue
FeatureClosedSwamp Club
AssigneesNone

Add extension list command

Opened by swampadmin · 12/23/2024

Summary

Add an extension list (alias ls) command to show locally installed extensions. This is already specified in the design doc (design/extension.md) but not yet implemented.

Currently there's no way to see what extensions are installed without manually reading upstream_extensions.json. With push, pull, and rm already in place, list completes the extension management surface.

Why list (ls)

The verb list is the established convention across CLI tools for "show what's installed locally":

  • Docker: docker container ls, docker image ls, docker volume ls — consistently ls for enumerating local resources
  • npm: npm ls — lists installed packages
  • brew: brew list — lists installed formulae
  • pip: pip list — lists installed packages
  • cargo: cargo install --list — lists installed binaries

In contrast, search is the convention for querying a remote registry (e.g., npm search, docker search, brew search). Using list makes it immediately clear this operates on local state, not the registry.

Within swamp itself, list is already used by data list to enumerate items in a local scope. The extension command follows the same <noun> <verb> pattern as the rest of the CLI (extension push, extension pull, extension rm).

Behavior

  • Reads upstream_extensions.json from the models directory
  • Displays installed extensions sorted alphabetically by name
  • Supports both log and json output modes (like all swamp commands)
  • Default output: name, version, file count, pull date per extension
  • --verbose: additionally lists individual files under each extension (matching how extension rm --verbose shows per-file details)
  • --json: always includes the full files array for structured consumers
  • Empty state: shows "No upstream extensions installed." with a CTA directing the user to swamp extension pull @namespace/name

Options

  • --repo-dir <dir> — Repository directory (default: .)
  • Inherits global --json, --verbose, --quiet flags

Implementation

New files

  • src/presentation/output/extension_list_output.ts — output rendering
  • src/cli/commands/extension_list.ts — CLI command
  • integration/extension_list_test.ts — integration tests

Modified files

  • src/cli/commands/extension.ts — wire in the new subcommand

Reused infrastructure

  • readUpstreamExtensions() from extension_pull.ts
  • createContext(), requireInitializedRepo(), resolveModelsDir() from existing CLI utilities

Tests

  • --help shows usage
  • extension --help shows list subcommand
  • Requires initialized repo
  • Empty repo shows "No upstream extensions installed" with CTA
  • --json with no extensions returns { extensions: [] }
  • Populated upstream_extensions.json displays entries correctly in both modes
  • Verbose mode shows individual files
02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED

Closed

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.