structkit 3.1.0__tar.gz → 3.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. {structkit-3.1.0/structkit.egg-info → structkit-3.2.1}/PKG-INFO +8 -8
  2. {structkit-3.1.0 → structkit-3.2.1}/README.md +4 -4
  3. {structkit-3.1.0 → structkit-3.2.1}/pyproject.toml +4 -4
  4. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/generate.py +19 -8
  5. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/sources.py +7 -3
  6. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/ansible-playbook.yaml +4 -0
  7. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/chef-cookbook.yaml +4 -0
  8. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/ci-cd-pipelines.yaml +4 -0
  9. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/cloudformation-files.yaml +4 -0
  10. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/configs/chglog.yaml +4 -0
  11. structkit-3.2.1/structkit/contribs/configs/codeowners.yaml +6 -0
  12. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/configs/devcontainer.yaml +4 -0
  13. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/configs/editor-config.yaml +4 -0
  14. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/configs/eslint.yaml +4 -0
  15. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/configs/jshint.yaml +4 -0
  16. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/configs/kubectl.yaml +4 -0
  17. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/configs/prettier.yaml +4 -0
  18. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/docker-files.yaml +4 -0
  19. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/documentation-template.yaml +4 -0
  20. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/git-hooks.yaml +4 -0
  21. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/chatmodes/plan.yaml +4 -0
  22. structkit-3.2.1/structkit/contribs/github/instructions/generic.yaml +9 -0
  23. structkit-3.2.1/structkit/contribs/github/prompts/generic.yaml +8 -0
  24. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/prompts/react-form.yaml +4 -0
  25. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/prompts/security-api.yaml +4 -0
  26. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/prompts/struct.yaml +4 -0
  27. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/templates.yaml +4 -0
  28. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/workflows/codeql.yaml +4 -0
  29. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/workflows/execute-tf-workflow.yaml +5 -0
  30. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/workflows/labeler.yaml +5 -0
  31. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/workflows/pre-commit.yaml +4 -0
  32. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/workflows/release-drafter.yaml +5 -0
  33. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/workflows/run-struct.yaml +4 -0
  34. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/github/workflows/stale.yaml +4 -0
  35. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/helm-chart.yaml +4 -0
  36. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/kubernetes-manifests.yaml +5 -0
  37. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/custom-structures.yaml +5 -0
  38. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/generic.yaml +6 -0
  39. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/go.yaml +4 -0
  40. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/java.yaml +5 -0
  41. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/n8n.yaml +5 -0
  42. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/nodejs.yaml +4 -0
  43. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/python.yaml +5 -0
  44. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/ruby.yaml +5 -0
  45. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/project/rust.yaml +5 -0
  46. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/prompts/run-struct-trigger.yaml +5 -0
  47. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/terraform/apps/aws-accounts.yaml +5 -0
  48. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/terraform/apps/environments.yaml +5 -0
  49. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/terraform/apps/generic.yaml +5 -0
  50. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/terraform/apps/github-organization.yaml +4 -0
  51. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/terraform/apps/init.yaml +4 -0
  52. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/terraform/modules/generic.yaml +5 -0
  53. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/vagrant-files.yaml +4 -0
  54. {structkit-3.1.0 → structkit-3.2.1}/structkit/file_item.py +2 -0
  55. structkit-3.2.1/structkit/sources.py +371 -0
  56. structkit-3.2.1/structkit/struct_refs.py +140 -0
  57. {structkit-3.1.0 → structkit-3.2.1/structkit.egg-info}/PKG-INFO +8 -8
  58. {structkit-3.1.0 → structkit-3.2.1}/structkit.egg-info/SOURCES.txt +1 -0
  59. {structkit-3.1.0 → structkit-3.2.1}/tests/test_file_item.py +29 -0
  60. structkit-3.2.1/tests/test_sources_command.py +304 -0
  61. structkit-3.1.0/structkit/contribs/configs/codeowners.yaml +0 -3
  62. structkit-3.1.0/structkit/contribs/github/instructions/generic.yaml +0 -5
  63. structkit-3.1.0/structkit/contribs/github/prompts/generic.yaml +0 -4
  64. structkit-3.1.0/structkit/sources.py +0 -155
  65. structkit-3.1.0/tests/test_sources_command.py +0 -135
  66. {structkit-3.1.0 → structkit-3.2.1}/LICENSE +0 -0
  67. {structkit-3.1.0 → structkit-3.2.1}/MANIFEST.in +0 -0
  68. {structkit-3.1.0 → structkit-3.2.1}/setup.cfg +0 -0
  69. {structkit-3.1.0 → structkit-3.2.1}/setup.py +0 -0
  70. {structkit-3.1.0 → structkit-3.2.1}/structkit/__init__.py +0 -0
  71. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/__init__.py +0 -0
  72. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/completion.py +0 -0
  73. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/explain.py +0 -0
  74. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/generate_schema.py +0 -0
  75. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/graph.py +0 -0
  76. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/import.py +0 -0
  77. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/info.py +0 -0
  78. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/init.py +0 -0
  79. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/lint.py +0 -0
  80. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/list.py +0 -0
  81. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/mcp.py +0 -0
  82. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/search.py +0 -0
  83. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/validate.py +0 -0
  84. {structkit-3.1.0 → structkit-3.2.1}/structkit/commands/vars.py +0 -0
  85. {structkit-3.1.0 → structkit-3.2.1}/structkit/completers.py +0 -0
  86. {structkit-3.1.0 → structkit-3.2.1}/structkit/content_fetcher.py +0 -0
  87. {structkit-3.1.0 → structkit-3.2.1}/structkit/contribs/README.md +0 -0
  88. {structkit-3.1.0 → structkit-3.2.1}/structkit/filters.py +0 -0
  89. {structkit-3.1.0 → structkit-3.2.1}/structkit/input_store.py +0 -0
  90. {structkit-3.1.0 → structkit-3.2.1}/structkit/logging_config.py +0 -0
  91. {structkit-3.1.0 → structkit-3.2.1}/structkit/main.py +0 -0
  92. {structkit-3.1.0 → structkit-3.2.1}/structkit/mcp_server.py +0 -0
  93. {structkit-3.1.0 → structkit-3.2.1}/structkit/model_wrapper.py +0 -0
  94. {structkit-3.1.0 → structkit-3.2.1}/structkit/template_renderer.py +0 -0
  95. {structkit-3.1.0 → structkit-3.2.1}/structkit/utils.py +0 -0
  96. {structkit-3.1.0 → structkit-3.2.1}/structkit.egg-info/dependency_links.txt +0 -0
  97. {structkit-3.1.0 → structkit-3.2.1}/structkit.egg-info/entry_points.txt +0 -0
  98. {structkit-3.1.0 → structkit-3.2.1}/structkit.egg-info/requires.txt +0 -0
  99. {structkit-3.1.0 → structkit-3.2.1}/structkit.egg-info/top_level.txt +0 -0
  100. {structkit-3.1.0 → structkit-3.2.1}/tests/test_commands.py +0 -0
  101. {structkit-3.1.0 → structkit-3.2.1}/tests/test_commands_more.py +0 -0
  102. {structkit-3.1.0 → structkit-3.2.1}/tests/test_completers.py +0 -0
  103. {structkit-3.1.0 → structkit-3.2.1}/tests/test_completion_command.py +0 -0
  104. {structkit-3.1.0 → structkit-3.2.1}/tests/test_content_fetcher_more.py +0 -0
  105. {structkit-3.1.0 → structkit-3.2.1}/tests/test_env_var_cli_args.py +0 -0
  106. {structkit-3.1.0 → structkit-3.2.1}/tests/test_env_var_structures_path.py +0 -0
  107. {structkit-3.1.0 → structkit-3.2.1}/tests/test_explain_command.py +0 -0
  108. {structkit-3.1.0 → structkit-3.2.1}/tests/test_file_item_strategies.py +0 -0
  109. {structkit-3.1.0 → structkit-3.2.1}/tests/test_filters.py +0 -0
  110. {structkit-3.1.0 → structkit-3.2.1}/tests/test_filters_more.py +0 -0
  111. {structkit-3.1.0 → structkit-3.2.1}/tests/test_graph_command.py +0 -0
  112. {structkit-3.1.0 → structkit-3.2.1}/tests/test_hooks.py +0 -0
  113. {structkit-3.1.0 → structkit-3.2.1}/tests/test_init_command.py +0 -0
  114. {structkit-3.1.0 → structkit-3.2.1}/tests/test_input_store.py +0 -0
  115. {structkit-3.1.0 → structkit-3.2.1}/tests/test_mcp_integration.py +0 -0
  116. {structkit-3.1.0 → structkit-3.2.1}/tests/test_messages_and_summary.py +0 -0
  117. {structkit-3.1.0 → structkit-3.2.1}/tests/test_model_wrapper.py +0 -0
  118. {structkit-3.1.0 → structkit-3.2.1}/tests/test_search_command.py +0 -0
  119. {structkit-3.1.0 → structkit-3.2.1}/tests/test_template_helpers.py +0 -0
  120. {structkit-3.1.0 → structkit-3.2.1}/tests/test_template_renderer.py +0 -0
  121. {structkit-3.1.0 → structkit-3.2.1}/tests/test_utils_more.py +0 -0
@@ -1,15 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: structkit
3
- Version: 3.1.0
3
+ Version: 3.2.1
4
4
  Summary: YAML-first project scaffolding tool with remote content fetching, AI/MCP integration, and DevOps automation
5
5
  Author: httpdss
6
6
  License: MIT
7
- Project-URL: Homepage, https://httpdss.github.io/structkit/
7
+ Project-URL: Homepage, https://structkit.app/
8
8
  Project-URL: Repository, https://github.com/httpdss/structkit
9
9
  Project-URL: Issues, https://github.com/httpdss/structkit/issues
10
10
  Project-URL: Discussions, https://github.com/httpdss/structkit/discussions
11
- Project-URL: Documentation, https://httpdss.github.io/structkit/docs/
12
- Project-URL: Funding, https://httpdss.github.io/structkit/docs/funding/
11
+ Project-URL: Documentation, https://structkit.app/docs/
12
+ Project-URL: Funding, https://structkit.app/docs/funding/
13
13
  Keywords: project-scaffolding,project-template,scaffolding,cookiecutter-alternative,copier-alternative,yaml-template,code-generation,devops,mcp,model-context-protocol,devex,platform-engineering,project-structure,boilerplate
14
14
  Classifier: Development Status :: 4 - Beta
15
15
  Classifier: Intended Audience :: Developers
@@ -59,8 +59,6 @@ Dynamic: license-file
59
59
 
60
60
  > Define project structures once in YAML, then generate consistent repos, CI files, docs, Terraform modules, and app layouts locally, in CI, or through an AI assistant via MCP.
61
61
 
62
- ![StructKit demo: generate project structure from YAML](./docs/assets/github-hero.gif)
63
-
64
62
  [![codecov](https://codecov.io/github/httpdss/structkit/graph/badge.svg?token=JL5WIO1C9T)](https://codecov.io/github/httpdss/structkit)
65
63
  ![GitHub issues](https://img.shields.io/github/issues/httpdss/structkit)
66
64
  ![GitHub pull requests](https://img.shields.io/github/issues-pr/httpdss/structkit)
@@ -68,7 +66,7 @@ Dynamic: license-file
68
66
 
69
67
  **StructKit** replaces copy-pasted boilerplate and aging "golden repos" with reusable YAML structures. It can render template variables, fetch canonical files from remote sources, preview changes before writing, and expose your scaffolds to AI assistants through the Model Context Protocol.
70
68
 
71
- > 🚀 **[Quick Start](docs/quickstart.md)** | 📚 **[Docs](docs/index.md)** | 🧩 **[Examples](examples/)** | 🤖 **[MCP Guide](docs/mcp-integration.md)** | 💬 **[Discussions](https://github.com/httpdss/structkit/discussions)**
69
+ > 🚀 **[Quick Start](docs/quickstart.md)** | 📚 **[Docs](docs/index.md)** | 🧩 **[Examples](examples/)** | 🤖 **[MCP / AI Agent Guide](docs/mcp-integration.md)** | 🧠 **[Agent Skills](docs/agent-skills.md)** | 💬 **[Discussions](https://github.com/httpdss/structkit/discussions)**
72
70
 
73
71
  ## ⚡ Try it in 60 seconds
74
72
 
@@ -115,6 +113,7 @@ Project scaffolding tools exist in most ecosystems, but StructKit solves problem
115
113
 
116
114
  - **Remote-first content:** Reference your organization's canonical CI template from GitHub directly in your StructKit config. When the template updates, all new projects get the update — no copy-paste maintenance.
117
115
  - **AI-native via MCP:** Start the StructKit MCP server so your AI assistant can generate project scaffolds from natural language using your templates as the source of truth.
116
+ - **Agent skill ready:** Install the companion [`httpdss/structkit-skills`](https://github.com/httpdss/structkit-skills) workflow skill so AI assistants consistently inspect, preview, generate, and validate StructKit structures.
118
117
  - **YAML-first:** Define structures directly in YAML. No separate template repository is required.
119
118
  - **Safe by default:** Use dry-run previews and file conflict strategies before writing into existing projects.
120
119
 
@@ -193,7 +192,8 @@ Our comprehensive documentation is organized into the following sections:
193
192
  - **[Hooks](docs/hooks.md)** - Pre and post-generation automation
194
193
  - **[Mappings](docs/mappings.md)** - External data integration
195
194
  - **[GitHub Integration](docs/github-integration.md)** - Automation with GitHub Actions
196
- - **[MCP Integration](docs/mcp-integration.md)** - Model Context Protocol for AI-assisted workflows
195
+ - **[MCP / AI Agent Workflow](docs/mcp-integration.md)** - Model Context Protocol for approved-template scaffolding with AI assistants
196
+ - **[Agent Skills](docs/agent-skills.md)** - Installable StructKit workflow skill for AI assistants
197
197
  - **[Command-Line Completion](docs/completion.md)** - Enhanced CLI experience
198
198
 
199
199
  ### 👩‍💻 Development
@@ -2,8 +2,6 @@
2
2
 
3
3
  > Define project structures once in YAML, then generate consistent repos, CI files, docs, Terraform modules, and app layouts locally, in CI, or through an AI assistant via MCP.
4
4
 
5
- ![StructKit demo: generate project structure from YAML](./docs/assets/github-hero.gif)
6
-
7
5
  [![codecov](https://codecov.io/github/httpdss/structkit/graph/badge.svg?token=JL5WIO1C9T)](https://codecov.io/github/httpdss/structkit)
8
6
  ![GitHub issues](https://img.shields.io/github/issues/httpdss/structkit)
9
7
  ![GitHub pull requests](https://img.shields.io/github/issues-pr/httpdss/structkit)
@@ -11,7 +9,7 @@
11
9
 
12
10
  **StructKit** replaces copy-pasted boilerplate and aging "golden repos" with reusable YAML structures. It can render template variables, fetch canonical files from remote sources, preview changes before writing, and expose your scaffolds to AI assistants through the Model Context Protocol.
13
11
 
14
- > 🚀 **[Quick Start](docs/quickstart.md)** | 📚 **[Docs](docs/index.md)** | 🧩 **[Examples](examples/)** | 🤖 **[MCP Guide](docs/mcp-integration.md)** | 💬 **[Discussions](https://github.com/httpdss/structkit/discussions)**
12
+ > 🚀 **[Quick Start](docs/quickstart.md)** | 📚 **[Docs](docs/index.md)** | 🧩 **[Examples](examples/)** | 🤖 **[MCP / AI Agent Guide](docs/mcp-integration.md)** | 🧠 **[Agent Skills](docs/agent-skills.md)** | 💬 **[Discussions](https://github.com/httpdss/structkit/discussions)**
15
13
 
16
14
  ## ⚡ Try it in 60 seconds
17
15
 
@@ -58,6 +56,7 @@ Project scaffolding tools exist in most ecosystems, but StructKit solves problem
58
56
 
59
57
  - **Remote-first content:** Reference your organization's canonical CI template from GitHub directly in your StructKit config. When the template updates, all new projects get the update — no copy-paste maintenance.
60
58
  - **AI-native via MCP:** Start the StructKit MCP server so your AI assistant can generate project scaffolds from natural language using your templates as the source of truth.
59
+ - **Agent skill ready:** Install the companion [`httpdss/structkit-skills`](https://github.com/httpdss/structkit-skills) workflow skill so AI assistants consistently inspect, preview, generate, and validate StructKit structures.
61
60
  - **YAML-first:** Define structures directly in YAML. No separate template repository is required.
62
61
  - **Safe by default:** Use dry-run previews and file conflict strategies before writing into existing projects.
63
62
 
@@ -136,7 +135,8 @@ Our comprehensive documentation is organized into the following sections:
136
135
  - **[Hooks](docs/hooks.md)** - Pre and post-generation automation
137
136
  - **[Mappings](docs/mappings.md)** - External data integration
138
137
  - **[GitHub Integration](docs/github-integration.md)** - Automation with GitHub Actions
139
- - **[MCP Integration](docs/mcp-integration.md)** - Model Context Protocol for AI-assisted workflows
138
+ - **[MCP / AI Agent Workflow](docs/mcp-integration.md)** - Model Context Protocol for approved-template scaffolding with AI assistants
139
+ - **[Agent Skills](docs/agent-skills.md)** - Installable StructKit workflow skill for AI assistants
140
140
  - **[Command-Line Completion](docs/completion.md)** - Enhanced CLI experience
141
141
 
142
142
  ### 👩‍💻 Development
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "structkit"
7
- version = "3.1.0"
7
+ version = "3.2.1"
8
8
  description = "YAML-first project scaffolding tool with remote content fetching, AI/MCP integration, and DevOps automation"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -78,12 +78,12 @@ dev = [
78
78
  ]
79
79
 
80
80
  [project.urls]
81
- Homepage = "https://httpdss.github.io/structkit/"
81
+ Homepage = "https://structkit.app/"
82
82
  Repository = "https://github.com/httpdss/structkit"
83
83
  Issues = "https://github.com/httpdss/structkit/issues"
84
84
  Discussions = "https://github.com/httpdss/structkit/discussions"
85
- Documentation = "https://httpdss.github.io/structkit/docs/"
86
- Funding = "https://httpdss.github.io/structkit/docs/funding/"
85
+ Documentation = "https://structkit.app/docs/"
86
+ Funding = "https://structkit.app/docs/funding/"
87
87
 
88
88
  [project.scripts]
89
89
  structkit = "structkit.main:main"
@@ -6,6 +6,7 @@ from structkit.file_item import FileItem, ContentFetchError
6
6
  from structkit.completers import file_strategy_completer, structures_completer
7
7
  from structkit.template_renderer import TemplateRenderer, TemplateVariableError
8
8
  from structkit.sources import SourceError, resolve_structures_path
9
+ from structkit.struct_refs import SourceContext, resolve_struct_reference
9
10
  from structkit.input_store import InputStoreError
10
11
 
11
12
  import subprocess
@@ -208,7 +209,7 @@ class GenerateCommand(Command):
208
209
  # Actually generate structure
209
210
  try:
210
211
  self._create_structure(args, mappings)
211
- except (GenerateConfigError, TemplateVariableError, ContentFetchError, InputStoreError) as exc:
212
+ except (GenerateConfigError, SourceError, TemplateVariableError, ContentFetchError, InputStoreError) as exc:
212
213
  self.logger.error(f"❗ {exc}")
213
214
  raise SystemExit(1) from None
214
215
 
@@ -217,7 +218,7 @@ class GenerateCommand(Command):
217
218
  self.logger.error("Post-hook failed.")
218
219
  return
219
220
 
220
- def _create_structure(self, args, mappings=None, summary=None, print_summary=True):
221
+ def _create_structure(self, args, mappings=None, summary=None, print_summary=True, source_context=None):
221
222
  if isinstance(args, dict):
222
223
  args = argparse.Namespace(**args)
223
224
 
@@ -225,6 +226,12 @@ class GenerateCommand(Command):
225
226
  self._load_yaml_config(args.structure_definition, args.structures_path)
226
227
  )
227
228
 
229
+ is_top_level_source_context = source_context is None
230
+ source_context = (source_context or SourceContext.from_global()).merge_inline(
231
+ config.get('sources'),
232
+ allow_override=is_top_level_source_context,
233
+ )
234
+
228
235
  # Safely parse template variables
229
236
  template_vars = self._parse_template_vars(args.vars) if getattr(args, 'vars', None) else {}
230
237
  config_structure = config.get('files', config.get('structure', []))
@@ -395,10 +402,12 @@ class GenerateCommand(Command):
395
402
  merged_vars = merged_vars if merged_vars else None
396
403
 
397
404
  if isinstance(content['struct'], str):
405
+ child_structures_path, child_structure_definition = resolve_struct_reference(
406
+ content['struct'], args.structures_path, source_context)
398
407
  self._create_structure({
399
- 'structure_definition': content['struct'],
408
+ 'structure_definition': child_structure_definition,
400
409
  'base_path': folder_path,
401
- 'structures_path': args.structures_path,
410
+ 'structures_path': child_structures_path,
402
411
  'dry_run': args.dry_run,
403
412
  'diff': getattr(args, 'diff', False),
404
413
  'output': getattr(args, 'output', 'file'),
@@ -408,13 +417,15 @@ class GenerateCommand(Command):
408
417
  'global_system_prompt': args.global_system_prompt,
409
418
  'input_store': args.input_store,
410
419
  'non_interactive': args.non_interactive,
411
- }, mappings=mappings, summary=summary, print_summary=False)
420
+ }, mappings=mappings, summary=summary, print_summary=False, source_context=source_context)
412
421
  elif isinstance(content['struct'], list):
413
422
  for struct in content['struct']:
423
+ child_structures_path, child_structure_definition = resolve_struct_reference(
424
+ struct, args.structures_path, source_context)
414
425
  self._create_structure({
415
- 'structure_definition': struct,
426
+ 'structure_definition': child_structure_definition,
416
427
  'base_path': folder_path,
417
- 'structures_path': args.structures_path,
428
+ 'structures_path': child_structures_path,
418
429
  'dry_run': args.dry_run,
419
430
  'diff': getattr(args, 'diff', False),
420
431
  'output': getattr(args, 'output', 'file'),
@@ -424,7 +435,7 @@ class GenerateCommand(Command):
424
435
  'global_system_prompt': args.global_system_prompt,
425
436
  'input_store': args.input_store,
426
437
  'non_interactive': args.non_interactive,
427
- }, mappings=mappings, summary=summary, print_summary=False)
438
+ }, mappings=mappings, summary=summary, print_summary=False, source_context=source_context)
428
439
  else:
429
440
  self.logger.warning(f"Unsupported content in folder: {folder}")
430
441
 
@@ -15,14 +15,18 @@ class SourcesCommand(Command):
15
15
  def __init__(self, parser):
16
16
  super().__init__(parser)
17
17
  parser.description = "Manage named custom structure sources"
18
- parser.add_argument('--config-path', type=str, help='Override sources config path (env: STRUCTKIT_SOURCES_CONFIG)')
18
+ parser.add_argument(
19
+ '--config-path',
20
+ type=str,
21
+ help='Override sources config path (env: STRUCTKIT_SOURCES_CONFIG)',
22
+ )
19
23
  subparsers = parser.add_subparsers(dest='sources_command')
20
24
 
21
25
  subparsers.add_parser('list', help='List configured sources').set_defaults(sources_func=self.list_sources)
22
26
 
23
- add_parser = subparsers.add_parser('add', help='Add or update a local source')
27
+ add_parser = subparsers.add_parser('add', help='Add or update a local, GitHub, or git-backed source')
24
28
  add_parser.add_argument('name')
25
- add_parser.add_argument('path_or_url')
29
+ add_parser.add_argument('path_or_url', help='Local directory, owner/repo, github://owner/repo, or git URL')
26
30
  add_parser.set_defaults(sources_func=self.add_source)
27
31
 
28
32
  remove_parser = subparsers.add_parser('remove', help='Remove a configured source')
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates an Ansible playbook scaffold with main.yml, vars.yml, tasks/main.yml,
3
+ handlers/main.yml, a templates directory, and a README.md.
4
+
1
5
  files:
2
6
  - main.yml:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a Chef cookbook scaffold for configuring NGINX, including a default recipe,
3
+ node attributes, an nginx.conf.erb template, a default index.html, and a README.md.
4
+
1
5
  files:
2
6
  - recipes/default.rb:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates CI/CD pipeline configuration files for multiple platforms: GitLab CI (.gitlab-ci.yml),
3
+ Jenkins (Jenkinsfile), and GitHub Actions (ci.yml and cd.yml) with build, test, and deploy stages.
4
+
1
5
  files:
2
6
  - .gitlab-ci.yml:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates AWS CloudFormation files: a template.yaml defining an S3 bucket resource,
3
+ a parameters.json file, and a deploy.sh script for deploying the stack via the AWS CLI.
4
+
1
5
  files:
2
6
  - template.yaml:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates git-chglog configuration files (.chglog/config.yaml and CHANGELOG.tpl.md)
3
+ for automated changelog generation with GitHub-style commit parsing and Markdown output.
4
+
1
5
  files:
2
6
  - .chglog/config.yaml:
3
7
  content: |
@@ -0,0 +1,6 @@
1
+ description: >
2
+ Creates a CODEOWNERS file assigning all repository files to a configurable GitHub username.
3
+
4
+ files:
5
+ - CODEOWNERS: |
6
+ * @github_username
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a VS Code dev container configuration using Python 3.12 (bullseye) with
3
+ yamlfmt and pre-commit features pre-installed.
4
+
1
5
  files:
2
6
  - .devcontainer/devcontainer.json:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates an .editorconfig file enforcing consistent coding style across editors:
3
+ UTF-8, LF line endings, 2-space indentation, and trailing whitespace trimming.
4
+
1
5
  files:
2
6
  - .editorconfig:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates ESLint configuration files (.eslintrc.json and .eslintignore) for a
3
+ React/ES2021 project with eslint:recommended and react/recommended rules enabled.
4
+
1
5
  files:
2
6
  - .eslintrc.json:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates JSHint configuration files (.jshintrc and .jshintignore) for Node.js/ES6
3
+ JavaScript linting, excluding node_modules and dist directories.
4
+
1
5
  files:
2
6
  - .jshintrc:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a .kuberc kubectl preferences file with a custom alias for creating namespaces
3
+ and a forced --interactive=true flag for kubectl delete commands.
4
+
1
5
  files:
2
6
  - .kuberc:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates Prettier code-formatting configuration files (.prettierrc and .prettierignore)
3
+ with standard style settings: single quotes, ES5 trailing commas, 80-char print width.
4
+
1
5
  files:
2
6
  - .prettierrc:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates Docker configuration files: a Dockerfile (nginx-based), .dockerignore,
3
+ a docker-compose.yml with web and db (MySQL) services, and a .env file.
4
+
1
5
  files:
2
6
  - Dockerfile:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates standard open-source project documentation files: README.md, CONTRIBUTING.md,
3
+ CODE_OF_CONDUCT.md, and LICENSE.md, all templated with a project_name variable.
4
+
1
5
  files:
2
6
  - README.md:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates executable Git hook shell scripts under .git/hooks/: pre-commit,
3
+ pre-push, and commit-msg, each with a placeholder for custom hook logic.
4
+
1
5
  files:
2
6
  - .git/hooks/pre-commit:
3
7
  permissions: 755
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Copilot chat mode file (plan.chatmode.md) that configures an AI
3
+ planning assistant for generating implementation plans without making any code edits.
4
+
1
5
  files:
2
6
  - ./github/chatmodes/plan.chatmode.md:
3
7
  content: |
@@ -0,0 +1,9 @@
1
+ description: >
2
+ Creates a generic GitHub Copilot instructions file (.github/instructions/generic.instruction.md)
3
+ as a blank starter template for defining AI coding guidelines and context.
4
+
5
+ files:
6
+ - .github/instructions/generic.instruction.md:
7
+ skip_if_exists: true
8
+ content: |
9
+ Your instructions here
@@ -0,0 +1,8 @@
1
+ description: >
2
+ Creates a generic GitHub Copilot prompt file (.github/prompts/generic.prompt.md)
3
+ as a blank starter template for defining reusable AI prompts.
4
+
5
+ files:
6
+ - .github/prompts/generic.prompt.md:
7
+ content: |
8
+ Your prompt here
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Copilot prompt for generating React form components using
3
+ react-hook-form (uncontrolled), yup validation schemas, and TypeScript types.
4
+
1
5
  files:
2
6
  - .github/prompts/react-form.prompt.md:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Copilot prompt for reviewing REST API security, covering
3
+ authentication, input validation, rate limiting, and security event logging.
4
+
1
5
  files:
2
6
  - .github/prompts/security-api.prompt.md:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Copilot prompt that configures an AI assistant for generating
3
+ valid .struct.yaml files for the StructKit tool, with schema references and usage examples.
4
+
1
5
  files:
2
6
  - .github/prompts/struct.prompt.md:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates GitHub PR templates (bug fix, feature request, general PR) under
3
+ .github/PULL_REQUEST_TEMPLATE/ and an issue template under .github/ISSUE_TEMPLATE/.
4
+
1
5
  files:
2
6
  - .github/PULL_REQUEST_TEMPLATE/bug_fix_template.md:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Actions CodeQL analysis workflow (z-codeql.yaml) for JavaScript
3
+ security scanning, triggered on push/PR to default branches and on a weekly schedule.
4
+
1
5
  files:
2
6
  - .github/workflows/z-codeql.yaml:
3
7
  content: | # yaml
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a GitHub Actions workflow for running Terraform plan on PRs and apply on pushes
3
+ to main, scoped to a specific app path under .devops/apps/. Uses variables for app name,
4
+ working directory path, and GitHub token.
5
+
1
6
  files:
2
7
  - .github/workflows/execute-tf-{{@ app_name | slugify @}}.yaml:
3
8
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a GitHub Actions labeler workflow (labeler.yaml) and a labeler config
3
+ (.github/labeler.yml) that auto-assigns PR labels based on changed file paths
4
+ and branch name patterns (feature, bug, docs, release).
5
+
1
6
  files:
2
7
  - .github/labeler.yml:
3
8
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Actions pre-commit workflow (z-pre-commit.yaml) and a
3
+ .pre-commit-config.yaml with check-yaml, end-of-file-fixer, and trailing-whitespace hooks.
4
+
1
5
  files:
2
6
  - .github/workflows/z-pre-commit.yaml:
3
7
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a release drafter workflow (z-release-drafter.yaml), a major tagging workflow
3
+ (z-major-tagging.yaml), and a release-drafter.yml config with feature/bugfix/patch
4
+ label categories and semantic versioning resolution.
5
+
1
6
  files:
2
7
  - .github/workflows/z-release-drafter.yaml:
3
8
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Actions workflow (run-struct.yaml) that can be manually triggered
3
+ via workflow_dispatch to run struct file generation, plus a starter .struct.yaml file.
4
+
1
5
  files:
2
6
  - .github/workflows/run-struct.yaml:
3
7
  skip_if_exists: true
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a GitHub Actions workflow (stale.yaml) that runs daily on a cron schedule
3
+ to mark inactive issues and pull requests as stale with configurable messages.
4
+
1
5
  files:
2
6
  - .github/workflows/stale.yaml:
3
7
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a complete Helm chart scaffold including Chart.yaml, values.yaml,
3
+ Deployment/Service/Ingress templates, a helpers partial, and .helmignore.
4
+
1
5
  files:
2
6
  - Chart.yaml:
3
7
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates Kubernetes manifest files for deploying a containerised application:
3
+ Deployment, Service, Ingress, ConfigMap, Secret, and README.md.
4
+ Uses variables for app name, deployment name, and Docker image details.
5
+
1
6
  files:
2
7
  - deployment.yaml:
3
8
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates the scaffolding for a custom StructKit structures repository: README.md,
3
+ custom-mappings.yaml, a structures/ directory, and common configs via sub-structures
4
+ (devcontainer, editor-config, prettier, run-struct, release-drafter, pre-commit).
5
+
1
6
  files:
2
7
  - README.md:
3
8
  content: |
@@ -1,3 +1,9 @@
1
+ description: >
2
+ Creates a comprehensive generic project scaffold with standard directory structure
3
+ (.config, .build, src, test, doc, tools, dep), common config files (.editorconfig,
4
+ .gitignore, Dockerfile, docker-compose.yml), GitHub community files, and Terraform
5
+ environment apps (prod, stage, qa, dev, init).
6
+
1
7
  files:
2
8
  - .config/REMOVE_ME.md:
3
9
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a Go project scaffold with standard directory layout (cmd, pkg, internal, api, test),
3
+ main.go entry point, .editorconfig, .gitignore, README.md, and Apache 2.0 LICENSE.
4
+
1
5
  files:
2
6
  - .editorconfig:
3
7
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a Java Maven project scaffold with pom.xml, standard Maven directory layout
3
+ (src/main/java, src/test/java), App.java and AppTest.java starters, .editorconfig,
4
+ .gitignore, README.md, and Apache 2.0 LICENSE.
5
+
1
6
  files:
2
7
  - .editorconfig:
3
8
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a self-hosted n8n workflow automation setup with docker-compose.yaml
3
+ (n8n container + Traefik reverse proxy with automatic HTTPS), .env configuration,
4
+ and a local-files/ directory. Uses variables for domain, subdomain, timezone, and SSL email.
5
+
1
6
  files:
2
7
  - .gitignore:
3
8
  content: |
@@ -1,3 +1,7 @@
1
+ description: >
2
+ Creates a Node.js project scaffold with package.json, src/index.js and utils.js,
3
+ public/index.html, a test starter, .editorconfig, .gitignore, README.md, and Apache 2.0 LICENSE.
4
+
1
5
  files:
2
6
  - .editorconfig:
3
7
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a Python project scaffold with setup.py, setup.cfg, pyproject.toml,
3
+ Makefile (with venv management), requirements.txt, src and tests directories
4
+ with starter modules, .editorconfig, .gitignore, and Apache 2.0 LICENSE.
5
+
1
6
  files:
2
7
  - .editorconfig:
3
8
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a Ruby project scaffold with .rubocop.yml, RSpec test structure (spec/),
3
+ lib directory with versioned module and main class, bin/console and bin/setup scripts,
4
+ .editorconfig, .gitignore, README.md, and Apache 2.0 LICENSE.
5
+
1
6
  files:
2
7
  - .editorconfig:
3
8
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates a Rust project scaffold with Cargo.toml, src/main.rs and lib.rs, module files,
3
+ integration tests, benchmarks, .cargo/config for cross-compilation, .editorconfig,
4
+ .gitignore, README.md, and Apache 2.0 LICENSE.
5
+
1
6
  files:
2
7
  - .editorconfig:
3
8
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates an AI agent prompt file that instructs the assistant to query GitHub for
3
+ repositories matching a given topic in a specified organization, then trigger the
4
+ run-struct workflow on each of them.
5
+
1
6
  files:
2
7
  - run-struct-trigger.md:
3
8
  content: |
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates Terraform app directories for nonprod and prod AWS accounts under
3
+ .devops/apps/accounts/, each using the generic app structure with a remote backend,
4
+ plus execute-tf-workflow GitHub Actions workflows for each account.
5
+
1
6
  folders:
2
7
  - .devops/apps/accounts/nonprod:
3
8
  struct: terraform/apps/generic
@@ -1,3 +1,8 @@
1
+ description: >
2
+ Creates Terraform app directories for four environments (dev, qa, stage, prod) under
3
+ .devops/apps/environments/, using the generic app structure with a remote backend,
4
+ plus execute-tf-workflow GitHub Actions workflows for each environment.
5
+
1
6
  folders:
2
7
  - .devops/apps/environments/dev:
3
8
  struct: terraform/apps/generic