structkit 3.1.0__py3-none-any.whl → 3.2.1__py3-none-any.whl
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.
- structkit/commands/generate.py +19 -8
- structkit/commands/sources.py +7 -3
- structkit/contribs/ansible-playbook.yaml +4 -0
- structkit/contribs/chef-cookbook.yaml +4 -0
- structkit/contribs/ci-cd-pipelines.yaml +4 -0
- structkit/contribs/cloudformation-files.yaml +4 -0
- structkit/contribs/configs/chglog.yaml +4 -0
- structkit/contribs/configs/codeowners.yaml +3 -0
- structkit/contribs/configs/devcontainer.yaml +4 -0
- structkit/contribs/configs/editor-config.yaml +4 -0
- structkit/contribs/configs/eslint.yaml +4 -0
- structkit/contribs/configs/jshint.yaml +4 -0
- structkit/contribs/configs/kubectl.yaml +4 -0
- structkit/contribs/configs/prettier.yaml +4 -0
- structkit/contribs/docker-files.yaml +4 -0
- structkit/contribs/documentation-template.yaml +4 -0
- structkit/contribs/git-hooks.yaml +4 -0
- structkit/contribs/github/chatmodes/plan.yaml +4 -0
- structkit/contribs/github/instructions/generic.yaml +4 -0
- structkit/contribs/github/prompts/generic.yaml +4 -0
- structkit/contribs/github/prompts/react-form.yaml +4 -0
- structkit/contribs/github/prompts/security-api.yaml +4 -0
- structkit/contribs/github/prompts/struct.yaml +4 -0
- structkit/contribs/github/templates.yaml +4 -0
- structkit/contribs/github/workflows/codeql.yaml +4 -0
- structkit/contribs/github/workflows/execute-tf-workflow.yaml +5 -0
- structkit/contribs/github/workflows/labeler.yaml +5 -0
- structkit/contribs/github/workflows/pre-commit.yaml +4 -0
- structkit/contribs/github/workflows/release-drafter.yaml +5 -0
- structkit/contribs/github/workflows/run-struct.yaml +4 -0
- structkit/contribs/github/workflows/stale.yaml +4 -0
- structkit/contribs/helm-chart.yaml +4 -0
- structkit/contribs/kubernetes-manifests.yaml +5 -0
- structkit/contribs/project/custom-structures.yaml +5 -0
- structkit/contribs/project/generic.yaml +6 -0
- structkit/contribs/project/go.yaml +4 -0
- structkit/contribs/project/java.yaml +5 -0
- structkit/contribs/project/n8n.yaml +5 -0
- structkit/contribs/project/nodejs.yaml +4 -0
- structkit/contribs/project/python.yaml +5 -0
- structkit/contribs/project/ruby.yaml +5 -0
- structkit/contribs/project/rust.yaml +5 -0
- structkit/contribs/prompts/run-struct-trigger.yaml +5 -0
- structkit/contribs/terraform/apps/aws-accounts.yaml +5 -0
- structkit/contribs/terraform/apps/environments.yaml +5 -0
- structkit/contribs/terraform/apps/generic.yaml +5 -0
- structkit/contribs/terraform/apps/github-organization.yaml +4 -0
- structkit/contribs/terraform/apps/init.yaml +4 -0
- structkit/contribs/terraform/modules/generic.yaml +5 -0
- structkit/contribs/vagrant-files.yaml +4 -0
- structkit/file_item.py +2 -0
- structkit/sources.py +225 -9
- structkit/struct_refs.py +140 -0
- {structkit-3.1.0.dist-info → structkit-3.2.1.dist-info}/METADATA +8 -8
- structkit-3.2.1.dist-info/RECORD +85 -0
- {structkit-3.1.0.dist-info → structkit-3.2.1.dist-info}/WHEEL +1 -1
- structkit-3.1.0.dist-info/RECORD +0 -84
- {structkit-3.1.0.dist-info → structkit-3.2.1.dist-info}/entry_points.txt +0 -0
- {structkit-3.1.0.dist-info → structkit-3.2.1.dist-info}/licenses/LICENSE +0 -0
- {structkit-3.1.0.dist-info → structkit-3.2.1.dist-info}/top_level.txt +0 -0
structkit/commands/generate.py
CHANGED
|
@@ -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':
|
|
408
|
+
'structure_definition': child_structure_definition,
|
|
400
409
|
'base_path': folder_path,
|
|
401
|
-
'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':
|
|
426
|
+
'structure_definition': child_structure_definition,
|
|
416
427
|
'base_path': folder_path,
|
|
417
|
-
'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
|
|
structkit/commands/sources.py
CHANGED
|
@@ -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(
|
|
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 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
|
+
|
|
1
5
|
files:
|
|
2
6
|
- .github/instructions/generic.instruction.md:
|
|
3
7
|
skip_if_exists: true
|
|
@@ -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,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,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,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,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
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
Creates a generic Terraform app scaffold with main.tf, variables.tf, outputs.tf,
|
|
3
|
+
providers.tf (with a remote backend on app.terraform.io), and README.md.
|
|
4
|
+
Uses variables for the remote backend organization and workspace names.
|
|
5
|
+
|
|
1
6
|
files:
|
|
2
7
|
- main.tf:
|
|
3
8
|
content: |
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
Creates a generic Terraform module scaffold with main.tf (EC2 instance example),
|
|
3
|
+
variables.tf, outputs.tf, versions.tf (with AWS and Datadog providers auto-versioned),
|
|
4
|
+
and README.md. Uses a module_name variable for documentation templating.
|
|
5
|
+
|
|
1
6
|
files:
|
|
2
7
|
- main.tf:
|
|
3
8
|
content: |
|
structkit/file_item.py
CHANGED