Skip to content

CLI: repeatable --plugin <module[@prefix]> flag for config-file-free app mounting #594

Description

@melvincarvalho

Follow-up 1 from #592 (the other follow-up there, pluginDataDir, stays tracked in #592's thread).

Motivation

Since #593 / 0.0.216, jss start -c config.json mounts plugins — but the simple case still requires writing a config file for what is conceptually one argument. A repeatable flag closes that:

jss start --root ./data --public --plugin ./chat/plugin.js@/chat --plugin tideholm/jss-plugin/tideholm-jss.js@/tideholm

It's also the seam servejss needs to stay a pure flag translator: with this flag, servejss --plugin ./chat/plugin.js@/chat ./public forwards verbatim, and jsserve never learns plugin semantics (consistent with its How-it-works contract: JSS owns loading, the wrapper owns the CLI).

Proposed shape

  • Repeatable: commander collect pattern; each occurrence appends one entry.
  • Syntax: module[@prefix] — split on the last @ whose remainder starts with /, so scoped packages parse unambiguously (@scope/pkg/plugin.js@/app → module @scope/pkg/plugin.js, prefix /app; bare @scope/pkg/plugin.js → no prefix).
  • Merging: CLI entries append to config.plugins from the file (both sources usable together), rather than the usual CLI-replaces-file scalar rule — replacing would make -c plus one --plugin silently drop the file's apps.
  • Scope limits: per-plugin config objects and explicit id stay config-file territory; the flag covers the module + prefix case only. Entries go through the existing loader untouched, so prefix validation, duplicate-id rejection, and fail-loudly-on-import-error all apply as-is.

Non-goals

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions