Skip to content

[Bug]: Preset script artifacts cannot be resolved to usable paths through the CLI #4819

Description

@nicolehaugen

Bug Description

Preset-provided scripts can be registered and discovered as artifacts, but the CLI does not expose an effective, ready-to-load script path. In Specify 1.0.7, specify preset resolve <name> reports "not found" for a named .mjs adapter registered with type: script. The same file resolves successfully when registered with type: template.

This blocks a Designer integration that already uses specify preset resolve <name> to locate page templates and needs to locate preset-provided JavaScript adapters through Specify's resolution stack. Consumers should not have to implement their own priority resolution or script composition.

Steps to Reproduce

  1. In an initialized Specify project, create a local preset with an adapters/page-adapter.mjs file and the following manifest:

    schema_version: "1.0"
    preset:
      id: designer-adapter-repro
      name: Designer Adapter Repro
      version: "1.0.0"
      description: Reproduce preset script lookup
    requires:
      speckit_version: ">=1.0.7"
    provides:
      templates:
        - type: script
          name: designer-page-adapter
          file: adapters/page-adapter.mjs
          strategy: replace
  2. Install it with specify preset add --dev ./designer-adapter-repro.

  3. Run specify preset resolve designer-page-adapter.

  4. Inspect the registered script using specify artifact info --json with the appropriate script artifact identifier.

  5. As a control, change the entry's type to template, reinstall the preset, and resolve the same logical name again.

The reporting user tested the script-versus-template behavior on Specify 1.0.7. The minimal fixture above illustrates that report; it has not been independently executed during issue preparation.

Expected Behavior

A consumer should have a Specify-owned CLI interface to resolve a registered script by logical name, respecting the enabled resolution stack and priority.

For strategy: replace, it should expose the winning script's usable path. For supported composition, Specify should own composition and provide an explicitly documented way to obtain usable output, rather than requiring consumers to reconstruct it from artifact metadata.

This could be an explicit script-type option on a resolver or a dedicated artifact-resolution command; it need not change the existing template-only command's default behavior. Any materialization contract for JavaScript modules should also document module-relative import behavior.

Actual Behavior

  • A .mjs adapter registered as type: script is reported as "not found" by specify preset resolve <name>.
  • specify artifact info --json identifies contributing packages but does not give Designer a ready-to-load composed script path.
  • Registering the same file as a named type: template asset allows preset resolve to locate it.

Specify CLI Version

1.0.7 (reported by the user)

AI Agent

Not applicable — CLI artifact resolution for a Designer integration.

Operating System

Not reported for the user's reproduction.

Python Version

Not reported for the user's reproduction.

Error Logs

User-reported result; a full command transcript was not supplied:

specify preset resolve <script-name>
# Reports: not found

Additional Context

Inspection of the current default branch explains the lookup behavior:

  • command_resolve.py selects command for dotted names and template otherwise; it never selects script.
  • _resolver.py supports Python-level resolve(name, "script") and resolve_content(name, "script"). The former returns a source path rather than materialized composition; the latter returns composed text. This is not a CLI ready-to-load module-path contract. These observations concern the current branch, not an independently verified 1.0.7 Python API.
  • _manifest.py accepts script entries with replace or wrap strategies.
  • The bundled Lean preset registers command prompts, not script artifacts. The scaffold command references existing core shell/PowerShell scripts through command frontmatter, which is distinct from resolving preset-provided script artifacts.
  • presets/scaffold/preset.yml still labels its commented-out script artifact example "reserved for future use", whereas the preset documentation describes script composition support. Clarifying the supported consumption path would help.

Current workaround: register the JavaScript adapter as a named template asset with strategy: replace. This permits existing CLI lookup but misclassifies executable code as a template. Directly loading a known installed preset file also bypasses stack resolution and is not an equivalent solution.

Even template resolution can display a contributing layer's path rather than a materialized composed result, so this report is not proposing that consumers treat any displayed layer path as composed output.

AI Disclosure

Prepared by GitHub Copilot in Auto mode, human-supervised, from the user's reported Specify 1.0.7 behavior and read-only inspection of the repository's current default branch. Auto mode selected the underlying model; its identity and reasoning-effort setting were not available. AI assistance covered repository investigation and drafting/submitting this issue. No independent runtime reproduction was performed.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions