Skip to content

[Request]: Make init --with extension composition independent of argument order #337

Closed

Description

@jimhoyd

Problem or use case

urlcode init <site> --with presents a set of extensions, but the current implementation treats the flag sequence as host setup and activation order. That leaks a hidden implementation constraint into the declarative authoring path:

  • packages/store/src/scaffold.ts refuses --with store,auth; it requires auth,store only because store emits a bare projectSha256 reference that auth happens to declare first.
  • packages/ui/src/host/scaffold.ts documents that UI must be named first for ui,auth,admin; packages/admin/src/scaffold.ts refuses UI after admin because activation needs the kit.
  • src/init-with.ts calls scaffolds and renders imports, setup and extension entries in the user-supplied order.

An authoring agent has no semantic reason to distinguish store,auth from auth,store, and a growing ecosystem will make prescribed permutations an unreliable, non-composable interface. The dependency/activation ordering is real; making the CLI spelling carry it is the problem.

Proposed behavior and alternatives

Treat --with as an unordered requested set. Extend the scaffold contract (or normalize host fragments) with explicit, declarative ordering requirements/provided capabilities, then topologically order host setup, activation entries, README sections and close hooks deterministically. Keep the runtime activation requirements strict: for example, a presentation-dependent extension still activates after UI.

Acceptance:

  • --with auth,store and --with store,auth both create an equivalent site with the same extension behavior and revision pin.
  • --with ui,auth,admin works in any input permutation that contains all required extensions; emitted host order is canonical and reviewable.
  • A missing requirement, conflict or cycle refuses before writing, naming the extension and dependency instead of prescribing a magic flag order.
  • Preserve standalone extension use, exact pins and core’s no-build-time-import boundary. Do not auto-add auth/UI or infer security policy from the requested set.

A smaller alternative is requiring each scaffold to use namespaced, self-contained host bindings, but activation order still needs an explicit contract once third-party extensions depend on capabilities. This should stay an extension composition contract, not route YAML.

Activity

  1. added
    ai-first
    extension
    in-progress
    on Sep 20, 2026
  2. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Progress: an agent has started on this; a PR will be linked here when it opens.

  3. removed
    in-progress
    on Sep 20, 2026
  4. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Fixed in #342: --with is an unordered set. Scaffolds declare provides, requires, after and conflicts; init-with orders them canonically, so auth,store and store,auth (and any ui,auth,admin permutation) produce the same site and revision pin. A missing requirement, conflict or cycle refuses before anything is written and names the extensions. Store now reads its pin as storeProjectSha256. Capability names (ui.kit, auth.service, store.collections) are a proposal; initAdministration and initAuthentication still hard-code ui-first composition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-firstextension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions