Skip to content

Conversation

@pyramation
Copy link
Contributor

Summary

Adds an inspect() method to TemplateScaffolder that clones/caches a template and reads its .boilerplate.json configuration without scaffolding any files. This enables metadata-driven workflows where callers can read the template's type field before deciding how to handle scaffolding.

New types exported:

  • InspectOptions: options for inspecting a template (template, branch, fromPath)
  • InspectResult: result containing templateDir, resolvedTemplatePath, cacheUsed, cacheExpired, and the parsed .boilerplate.json config

The flow: clone/cache repo → resolve fromPath via .boilerplates.json → read .boilerplate.json → return config (never calls templatizer.process()).

Review & Testing Checklist for Human

  • Code duplication risk: inspectRemote() duplicates cache/clone logic from scaffoldFromRemote() (lines 189-235 vs 266-320). Verify they stay in sync and consider extracting shared logic.
  • No tests added: The inspect() method has no dedicated tests. Consider if this is acceptable or if tests should be added before merge.
  • Cache behavior: Verify that when cache is valid, inspect() reads from cache without network fetch. When cache is expired, it will re-clone before reading config.

Test plan:

  1. Publish a new version after merge
  2. Test with the companion constructive PR that uses inspectTemplate() for metadata-driven pgpm init
  3. Verify pgpm init workspace and pgpm init module correctly read the template's type field and branch accordingly

Notes

This is part of a two-PR solution for metadata-driven CLI architecture:

  • PR 1 (this): Add inspect() method to create-gen-app
  • PR 2 (constructive): Refactor pgpm init to single entry point using metadata-driven flow

Link to Devin run: https://app.devin.ai/sessions/48555739db3d4f1b9e9edfa9ea1e559a
Requested by: Dan Lynch (@pyramation)

Adds inspect() method that clones/caches a template and reads its
.boilerplate.json configuration WITHOUT scaffolding any files.

This enables metadata-driven workflows where callers can read the
template's type field before deciding how to handle scaffolding.

New types:
- InspectOptions: options for inspecting a template
- InspectResult: result containing template metadata and config

The inspect flow:
1. Clone/cache the template repo (or use existing cache if valid)
2. Resolve fromPath via .boilerplates.json convention
3. Read .boilerplate.json from the resolved template path
4. Return config without calling templatizer.process()

This is useful for CLI tools like pgpm that want to use a single
entry point (pgpm init <anything>) and branch behavior based on
the template's declared type.
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 0ee0f6c into main Dec 25, 2025
34 checks passed
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.

2 participants