structkit 3.0.0__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.
Files changed (77) hide show
  1. structkit/__init__.py +6 -0
  2. structkit/commands/__init__.py +17 -0
  3. structkit/commands/completion.py +65 -0
  4. structkit/commands/generate.py +397 -0
  5. structkit/commands/generate_schema.py +67 -0
  6. structkit/commands/import.py +63 -0
  7. structkit/commands/info.py +87 -0
  8. structkit/commands/init.py +52 -0
  9. structkit/commands/list.py +89 -0
  10. structkit/commands/mcp.py +100 -0
  11. structkit/commands/validate.py +129 -0
  12. structkit/completers.py +54 -0
  13. structkit/content_fetcher.py +249 -0
  14. structkit/contribs/README.md +271 -0
  15. structkit/contribs/ansible-playbook.yaml +38 -0
  16. structkit/contribs/chef-cookbook.yaml +51 -0
  17. structkit/contribs/ci-cd-pipelines.yaml +67 -0
  18. structkit/contribs/cloudformation-files.yaml +21 -0
  19. structkit/contribs/configs/chglog.yaml +31 -0
  20. structkit/contribs/configs/codeowners.yaml +3 -0
  21. structkit/contribs/configs/devcontainer.yaml +35 -0
  22. structkit/contribs/configs/editor-config.yaml +11 -0
  23. structkit/contribs/configs/eslint.yaml +30 -0
  24. structkit/contribs/configs/jshint.yaml +11 -0
  25. structkit/contribs/configs/kubectl.yaml +23 -0
  26. structkit/contribs/configs/prettier.yaml +19 -0
  27. structkit/contribs/docker-files.yaml +27 -0
  28. structkit/contribs/documentation-template.yaml +33 -0
  29. structkit/contribs/git-hooks.yaml +19 -0
  30. structkit/contribs/github/chatmodes/plan.yaml +18 -0
  31. structkit/contribs/github/instructions/generic.yaml +5 -0
  32. structkit/contribs/github/prompts/generic.yaml +4 -0
  33. structkit/contribs/github/prompts/react-form.yaml +17 -0
  34. structkit/contribs/github/prompts/security-api.yaml +8 -0
  35. structkit/contribs/github/prompts/struct.yaml +90 -0
  36. structkit/contribs/github/templates.yaml +91 -0
  37. structkit/contribs/github/workflows/codeql.yaml +88 -0
  38. structkit/contribs/github/workflows/execute-tf-workflow.yaml +39 -0
  39. structkit/contribs/github/workflows/labeler.yaml +77 -0
  40. structkit/contribs/github/workflows/pre-commit.yaml +27 -0
  41. structkit/contribs/github/workflows/release-drafter.yaml +77 -0
  42. structkit/contribs/github/workflows/run-struct.yaml +30 -0
  43. structkit/contribs/github/workflows/stale.yaml +16 -0
  44. structkit/contribs/helm-chart.yaml +160 -0
  45. structkit/contribs/kubernetes-manifests.yaml +103 -0
  46. structkit/contribs/project/custom-structures.yaml +24 -0
  47. structkit/contribs/project/generic.yaml +309 -0
  48. structkit/contribs/project/go.yaml +104 -0
  49. structkit/contribs/project/java.yaml +85 -0
  50. structkit/contribs/project/n8n.yaml +100 -0
  51. structkit/contribs/project/nodejs.yaml +101 -0
  52. structkit/contribs/project/python.yaml +136 -0
  53. structkit/contribs/project/ruby.yaml +130 -0
  54. structkit/contribs/project/rust.yaml +106 -0
  55. structkit/contribs/prompts/run-struct-trigger.yaml +18 -0
  56. structkit/contribs/terraform/apps/aws-accounts.yaml +21 -0
  57. structkit/contribs/terraform/apps/environments.yaml +41 -0
  58. structkit/contribs/terraform/apps/generic.yaml +41 -0
  59. structkit/contribs/terraform/apps/github-organization.yaml +40 -0
  60. structkit/contribs/terraform/apps/init.yaml +11 -0
  61. structkit/contribs/terraform/modules/generic.yaml +58 -0
  62. structkit/contribs/vagrant-files.yaml +21 -0
  63. structkit/file_item.py +182 -0
  64. structkit/filters.py +112 -0
  65. structkit/input_store.py +35 -0
  66. structkit/logging_config.py +36 -0
  67. structkit/main.py +85 -0
  68. structkit/mcp_server.py +347 -0
  69. structkit/model_wrapper.py +47 -0
  70. structkit/template_renderer.py +258 -0
  71. structkit/utils.py +36 -0
  72. structkit-3.0.0.dist-info/METADATA +182 -0
  73. structkit-3.0.0.dist-info/RECORD +77 -0
  74. structkit-3.0.0.dist-info/WHEEL +5 -0
  75. structkit-3.0.0.dist-info/entry_points.txt +2 -0
  76. structkit-3.0.0.dist-info/licenses/LICENSE +201 -0
  77. structkit-3.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,249 @@
1
+ # FILE: content_fetcher.py
2
+ import os
3
+ import re
4
+ import requests
5
+ import subprocess
6
+ from pathlib import Path
7
+ import hashlib
8
+ import logging
9
+
10
+ try:
11
+ import boto3
12
+ from botocore.exceptions import NoCredentialsError, ClientError
13
+ boto3_available = True
14
+ except ImportError:
15
+ boto3_available = False
16
+
17
+ try:
18
+ from google.cloud import storage
19
+ from google.api_core.exceptions import GoogleAPIError
20
+ gcs_available = True
21
+ except ImportError:
22
+ gcs_available = False
23
+
24
+ class ContentFetcher:
25
+ def __init__(self, cache_dir=None):
26
+ self.logger = logging.getLogger(__name__)
27
+ self.cache_dir = Path(cache_dir or os.path.expanduser("~/.struct/cache"))
28
+ self.cache_dir.mkdir(parents=True, exist_ok=True)
29
+
30
+ def fetch_content(self, content_location):
31
+ """
32
+ Fetch content from a given location. Supported protocols:
33
+ - Local file (file://)
34
+ - HTTP/HTTPS (https://)
35
+ - GitHub repository (github://owner/repo/branch/file_path)
36
+ - GitHub HTTPS (githubhttps://owner/repo/branch/file_path)
37
+ - GitHub SSH (githubssh://owner/repo/branch/file_path)
38
+ - S3 bucket (s3://bucket_name/key)
39
+ - Google Cloud Storage (gs://bucket_name/key)
40
+ """
41
+ protocol_map = {
42
+ "file://": self._fetch_local_file,
43
+ "https://": self._fetch_http_url,
44
+ "github://": self._fetch_github_file,
45
+ "githubhttps://": self._fetch_github_https_file,
46
+ "githubssh://": self._fetch_github_ssh_file,
47
+ }
48
+
49
+ if boto3_available:
50
+ protocol_map["s3://"] = self._fetch_s3_file
51
+ if gcs_available:
52
+ protocol_map["gs://"] = self._fetch_gcs_file
53
+
54
+ for prefix, method in protocol_map.items():
55
+ if content_location.startswith(prefix):
56
+ # Only treat the raw HTTPS prefix as a direct URL fetch. All other
57
+ # custom prefixes (e.g., githubhttps://, githubssh://) should have
58
+ # their prefix stripped and be dispatched to the appropriate handler.
59
+ if prefix == "https://":
60
+ return method(content_location)
61
+ else:
62
+ return method(content_location[len(prefix):])
63
+
64
+ raise ValueError(f"Unsupported content location: {content_location}")
65
+
66
+ def _fetch_local_file(self, file_path):
67
+ self.logger.debug(f"Fetching content from local file: {file_path}")
68
+ file_path = Path(file_path)
69
+ with file_path.open('r') as file:
70
+ return file.read()
71
+
72
+ def _fetch_http_url(self, url):
73
+ self.logger.debug(f"Fetching content from URL: {url}")
74
+ # Create a hash of the URL to use as a cache key
75
+ cache_key = hashlib.md5(url.encode()).hexdigest()
76
+ cache_file_path = self.cache_dir / cache_key
77
+
78
+ if cache_file_path.exists():
79
+ self.logger.debug(f"Loading content from cache: {cache_file_path}")
80
+ with cache_file_path.open('r') as file:
81
+ return file.read()
82
+
83
+ response = requests.get(url)
84
+ response.raise_for_status()
85
+ with cache_file_path.open('w') as file:
86
+ file.write(response.text)
87
+
88
+ return response.text
89
+
90
+ def _fetch_github_file(self, github_path):
91
+ """
92
+ Fetch a file from a GitHub repository using HTTPS.
93
+ Dispatcher passes: owner/repo/branch/file_path
94
+ """
95
+ self.logger.debug(f"Fetching content from GitHub: {github_path}")
96
+ match = re.match(r"([^/]+)/([^/]+)/([^/]+)/(.+)", github_path)
97
+ if not match:
98
+ raise ValueError("Invalid GitHub path. Expected owner/repo/branch/file_path")
99
+
100
+ owner, repo, branch, file_path = match.groups()
101
+ return self._github_fetch_with_raw_then_git(owner, repo, branch, file_path, use_https=True)
102
+
103
+ def _fetch_github_https_file(self, github_path):
104
+ """
105
+ Fetch a file from a GitHub repository using HTTPS.
106
+ Dispatcher passes: owner/repo/branch/file_path
107
+ """
108
+ self.logger.debug(f"Fetching content from GitHub (HTTPS): {github_path}")
109
+ match = re.match(r"([^/]+)/([^/]+)/([^/]+)/(.+)", github_path)
110
+ if not match:
111
+ raise ValueError("Invalid GitHub path. Expected owner/repo/branch/file_path")
112
+
113
+ owner, repo, branch, file_path = match.groups()
114
+ return self._github_fetch_with_raw_then_git(owner, repo, branch, file_path, use_https=True)
115
+
116
+ def _fetch_github_ssh_file(self, github_path):
117
+ """
118
+ Fetch a file from a GitHub repository using SSH.
119
+ Dispatcher passes: owner/repo/branch/file_path
120
+ """
121
+ self.logger.debug(f"Fetching content from GitHub (SSH): {github_path}")
122
+ match = re.match(r"([^/]+)/([^/]+)/([^/]+)/(.+)", github_path)
123
+ if not match:
124
+ raise ValueError("Invalid GitHub path. Expected owner/repo/branch/file_path")
125
+
126
+ owner, repo, branch, file_path = match.groups()
127
+ return self._github_fetch_with_raw_then_git(owner, repo, branch, file_path, use_https=False)
128
+
129
+ def _clone_or_fetch_github(self, owner, repo, branch, file_path, https=True):
130
+ repo_cache_path = self.cache_dir / f"{owner}_{repo}_{branch}"
131
+ clone_url = f"https://github.com/{owner}/{repo}.git" if https else f"git@github.com:{owner}/{repo}.git"
132
+
133
+ # Clone or fetch the repository
134
+ if not repo_cache_path.exists():
135
+ self.logger.debug(f"Cloning repository: {owner}/{repo} (branch: {branch})")
136
+ subprocess.run(["git", "clone", "-b", branch, clone_url, str(repo_cache_path)], check=True)
137
+ else:
138
+ self.logger.debug(f"Repository already cloned. Pulling latest changes for: {repo_cache_path}")
139
+ subprocess.run(["git", "-C", str(repo_cache_path), "pull"], check=True)
140
+
141
+ # Read the requested file
142
+ file_full_path = repo_cache_path / file_path
143
+ if not file_full_path.exists():
144
+ raise FileNotFoundError(f"File {file_path} not found in repository {owner}/{repo} on branch {branch}")
145
+
146
+ with file_full_path.open('r') as file:
147
+ return file.read()
148
+
149
+ def _github_fetch_with_raw_then_git(self, owner, repo, branch, file_path, use_https=True):
150
+ """
151
+ Try lightweight fetch via raw.githubusercontent.com first. If it fails
152
+ (network disabled, HTTP error, etc.), fall back to git clone/pull.
153
+ If a local cache repo exists already, prefer using git path directly
154
+ to avoid surprise network requests.
155
+ """
156
+ # Deny network option
157
+ if os.getenv("STRUCTKIT_DENY_NETWORK") == "1":
158
+ self.logger.debug("Network denied by STRUCTKIT_DENY_NETWORK=1; using git fallback if available")
159
+ return self._clone_or_fetch_github(owner, repo, branch, file_path, https=use_https)
160
+
161
+ repo_cache_path = self.cache_dir / f"{owner}_{repo}_{branch}"
162
+ if repo_cache_path.exists():
163
+ # Keep existing behavior: use git path if cache exists
164
+ return self._clone_or_fetch_github(owner, repo, branch, file_path, https=use_https)
165
+
166
+ # Attempt raw fetch
167
+ raw_url = f"https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{file_path}"
168
+ timeout = float(os.getenv("STRUCTKIT_HTTP_TIMEOUT", "10"))
169
+ retries = int(os.getenv("STRUCTKIT_HTTP_RETRIES", "2"))
170
+
171
+ last_err = None
172
+ for attempt in range(retries + 1):
173
+ try:
174
+ self.logger.debug(f"Attempting raw fetch: {raw_url} (attempt {attempt+1}/{retries+1})")
175
+ resp = requests.get(raw_url, timeout=timeout)
176
+ resp.raise_for_status()
177
+ return resp.text
178
+ except Exception as e:
179
+ last_err = e
180
+ # simple backoff
181
+ try:
182
+ import time
183
+ time.sleep(min(2 ** attempt, 5))
184
+ except Exception:
185
+ pass
186
+
187
+ self.logger.warning(f"Raw GitHub fetch failed, falling back to git. Last error: {last_err}")
188
+ return self._clone_or_fetch_github(owner, repo, branch, file_path, https=use_https)
189
+
190
+ def _fetch_s3_file(self, s3_path):
191
+ """
192
+ Fetch a file from an S3 bucket.
193
+ Dispatcher passes: bucket_name/key
194
+ """
195
+ if not boto3_available:
196
+ raise ImportError("boto3 is not installed. Please install it to use S3 fetching.")
197
+
198
+ self.logger.debug(f"Fetching content from S3: {s3_path}")
199
+ match = re.match(r"([^/]+)/(.+)", s3_path)
200
+ if not match:
201
+ raise ValueError("Invalid S3 path. Expected bucket_name/key")
202
+
203
+ bucket_name, key = match.groups()
204
+ local_file_path = self.cache_dir / Path(key).name
205
+
206
+ try:
207
+ session = boto3.Session() # Create a new session
208
+ s3_client = session.client("s3")
209
+ s3_client.download_file(bucket_name, key, str(local_file_path))
210
+ self.logger.debug(f"Downloaded S3 file to: {local_file_path}")
211
+ except NoCredentialsError:
212
+ raise RuntimeError("AWS credentials not found. Ensure that your credentials are configured properly.")
213
+ except ClientError as e:
214
+ error_code = e.response.get("Error", {}).get("Code")
215
+ if error_code == "404":
216
+ raise FileNotFoundError(f"The specified S3 key does not exist: {key}")
217
+ else:
218
+ raise RuntimeError(f"Failed to download S3 file: {e}")
219
+
220
+ with local_file_path.open('r') as file:
221
+ return file.read()
222
+
223
+ def _fetch_gcs_file(self, gcs_path):
224
+ """
225
+ Fetch a file from Google Cloud Storage.
226
+ Dispatcher passes: bucket_name/key
227
+ """
228
+ if not gcs_available:
229
+ raise ImportError("google-cloud-storage is not installed. Please install it to use GCS fetching.")
230
+
231
+ self.logger.debug(f"Fetching content from GCS: {gcs_path}")
232
+ match = re.match(r"([^/]+)/(.+)", gcs_path)
233
+ if not match:
234
+ raise ValueError("Invalid GCS path. Expected bucket_name/key")
235
+
236
+ bucket_name, key = match.groups()
237
+ local_file_path = self.cache_dir / Path(key).name
238
+
239
+ try:
240
+ gcs_client = storage.Client()
241
+ bucket = gcs_client.bucket(bucket_name)
242
+ blob = bucket.blob(key)
243
+ blob.download_to_filename(str(local_file_path))
244
+ self.logger.debug(f"Downloaded GCS file to: {local_file_path}")
245
+ except GoogleAPIError as e:
246
+ raise RuntimeError(f"Failed to download GCS file: {e}")
247
+
248
+ with local_file_path.open('r') as file:
249
+ return file.read()
@@ -0,0 +1,271 @@
1
+ # Contribs Sub-Structs
2
+
3
+ The `contribs` folder contains various sub-structs that can be used to generate specific project structures or configurations. Below is a list of all the YAML files in this folder, along with a brief description of what they do and when to use them.
4
+
5
+ ## Table of content
6
+
7
+ ## Table of Contents
8
+
9
+ - [Contribs Sub-Structs](#contribs-sub-structs)
10
+ - [Sub-Structs](#sub-structs)
11
+ - [General](#general)
12
+ - [`ansible-playbook`](#ansible-playbook)
13
+ - [`chef-cookbook`](#chef-cookbook)
14
+ - [`ci-cd-pipelines`](#ci-cd-pipelines)
15
+ - [`cloudformation-files`](#cloudformation-files)
16
+ - [`docker-files`](#docker-files)
17
+ - [`documentation-template`](#documentation-template)
18
+ - [`git-hooks`](#git-hooks)
19
+ - [`helm-chart`](#helm-chart)
20
+ - [`kubernetes-manifests`](#kubernetes-manifests)
21
+ - [`vagrant-files`](#vagrant-files)
22
+ - [Configs](#configs)
23
+ - [`configs/codeowners`](#configscodeowners)
24
+ - [`configs/devcontainer`](#configsdevcontainer)
25
+ - [`configs/editor-config`](#configseditor-config)
26
+ - [`configs/eslint`](#configseslint)
27
+ - [`configs/jshint`](#configsjshint)
28
+ - [`configs/prettier`](#configsprettier)
29
+ - [Github](#github)
30
+ - [`github/workflows/execute-tf-workflow`](#githubworkflowsexecute-tf-workflow)
31
+ - [`github/workflows/pre-commit`](#githubworkflowspre-commit)
32
+ - [`github/workflows/labeler`](#githubworkflowslabeler)
33
+ - [`github/workflows/release-drafter`](#githubworkflowsrelease-drafter)
34
+ - [`github/workflows/run-struct`](#githubworkflowsrun-struct)
35
+ - [`github/workflows/stale`](#githubworkflowsstale)
36
+ - [`github/templates`](#githubtemplates)
37
+ - [`github/prompts/generic`](#githubpromptsgeneric)
38
+ - [`github/prompts/react-form`](#githubpromptsreact-form)
39
+ - [`github/prompts/security-api`](#githubpromptssecurity-api)
40
+ - [`github/prompts/struct`](#githubpromptsstruct)
41
+ - [Project](#project)
42
+ - [`project/generic`](#projectgeneric)
43
+ - [`project/java`](#projectjava)
44
+ - [`project/nodejs`](#projectnodejs)
45
+ - [`project/rust`](#projectrust)
46
+ - [`project/python`](#projectpython)
47
+ - [`project/go`](#projectgo)
48
+ - [`project/ruby`](#projectruby)
49
+ - [Terraform](#terraform)
50
+ - [`terraform/modules/generic`](#terraformmodulesgeneric)
51
+ - [`terraform/apps/generic`](#terraformappsgeneric)
52
+ - [`terraform/apps/aws-accounts`](#terraformappsaws-accounts)
53
+ - [`terraform/apps/github-organization`](#terraformappsgithub-organization)
54
+ - [`terraform/apps/environments`](#terraformappsenvironments)
55
+ - [`terraform/apps/init`](#terraformappsinit)
56
+
57
+ ## Sub-Structs
58
+
59
+ ### General
60
+
61
+ #### `ansible-playbook`
62
+
63
+ - **Description**: Generates a basic structure for an Ansible playbook, including tasks, variables, handlers, and templates.
64
+ - **When to Use**: Use this sub-structkit when you need to create an Ansible playbook for automating infrastructure or application deployments.
65
+
66
+ #### `chef-cookbook`
67
+
68
+ - **Description**: Creates a Chef cookbook structure with recipes, attributes, templates, and files.
69
+ - **When to Use**: Use this sub-structkit when you need to create a Chef cookbook for automating infrastructure or application deployments.
70
+
71
+ #### `ci-cd-pipelines`
72
+
73
+ - **Description**: Provides a structure for setting up CI/CD pipelines.
74
+ - **When to Use**: this sub-structkit should only be used as a reference for setting up CI/CD pipelines.
75
+
76
+ #### `cloudformation-files`
77
+
78
+ - **Description**: Generates a basic structure for AWS CloudFormation templates, including a deployment script and parameters file.
79
+ - **When to Use**: Use this sub-structkit when you need to define and deploy AWS infrastructure using CloudFormation.
80
+
81
+ #### `docker-files`
82
+
83
+ - **Description**: Creates a structure for Docker-related files, such as Dockerfiles and docker-compose configurations.
84
+ - **When to Use**: Use this sub-structkit when you need to define and build Docker images for your application. Another use case is when you need to define and run multi-container applications using Docker Compose.
85
+
86
+ #### `documentation-template`
87
+
88
+ - **Description**: Provides a template for project documentation.
89
+ - **Description**: This sub-structkit is useful when you need to create a documentation structure for your project.
90
+
91
+ #### `git-hooks`
92
+
93
+ - **Description**: Sets up Git hooks, such as pre-commit, pre-push, and commit-msg hooks.
94
+ - **When to Use**: Use this sub-structkit when you need to enforce custom Git workflows or validations.
95
+
96
+ #### `helm-chart`
97
+
98
+ - **Description**: Generates a Helm chart structure for Kubernetes deployments, including templates and configuration files.
99
+ - **When to Use**: Use this sub-structkit when you need to deploy applications to Kubernetes using Helm.
100
+
101
+ #### `kubernetes-manifests`
102
+
103
+ - **Description**: Creates a structure for Kubernetes manifests, such as deployments, services, and ingress configurations.
104
+ - **When to Use**: Use this sub-structkit when you need to define and deploy Kubernetes resources for your application.
105
+
106
+ #### `vagrant-files`
107
+
108
+ - **Description**: Provides a structure for setting up a Vagrant development environment, including a Vagrantfile and provisioning scripts.
109
+ - **When to Use**: Use this sub-structkit when you need to create a Vagrant development environment for your project.
110
+
111
+ ### Configs
112
+
113
+ #### `configs/codeowners`
114
+
115
+ - **Description**: Provides a template for the `.github/CODEOWNERS` file.
116
+ - **When to Use**: Use this sub-structkit when you need to define code owners for your project's repository.
117
+
118
+ #### `configs/devcontainer`
119
+
120
+ - **Description**: Provides a template for the `.devcontainer` folder, which contains configuration files for Visual Studio Code's Remote - Containers extension.
121
+ - **When to Use**: Use this sub-structkit when you need to define development container configurations for your project.
122
+
123
+ #### `configs/editor-config`
124
+
125
+ - **Description**: Provides a template for the `.editorconfig` file, which defines coding styles and formatting rules for different editors and IDEs.
126
+ - **When to Use**: Use this sub-structkit when you need to define coding styles and formatting rules for your project.
127
+
128
+ #### `configs/eslint`
129
+
130
+ - **Description**: Provides a template for the `.eslintrc` file, which defines ESLint configurations for JavaScript projects.
131
+ - **When to Use**: Use this sub-structkit when you need to define ESLint configurations for your JavaScript project.
132
+
133
+ #### `configs/jshint`
134
+
135
+ - **Description**: Provides a template for the `.jshintrc` file, which defines JSHint configurations for JavaScript projects.
136
+ - **When to Use**: Use this sub-structkit when you need to define JSHint configurations for your JavaScript project.
137
+
138
+ #### `configs/prettier`
139
+
140
+ - **Description**: Provides a template for the `.prettierrc` file, which defines Prettier configurations for code formatting.
141
+ - **When to Use**: Use this sub-structkit when you need to define Prettier configurations for your project.
142
+
143
+ ### Github
144
+
145
+ #### `github/workflows/execute-tf-workflow`
146
+
147
+ - **Description**: Provides a template for a GitHub Actions workflow that executes Terraform commands.
148
+ - **When to Use**: Use this sub-structkit when you need to automate Terraform workflows using GitHub Actions. each terraform app should have a workflow that executes terraform commands.
149
+
150
+ #### `github/workflows/pre-commit`
151
+
152
+ - **Description**: Provides a template for a GitHub Actions workflow that runs pre-commit checks.
153
+ - **When to Use**: Use this sub-structkit when you need to run pre-commit checks on your codebase using GitHub Actions.
154
+
155
+ #### `github/workflows/labeler`
156
+
157
+ - **Description**: Provides a template for a GitHub Actions workflow that labels issues and pull requests.
158
+ - **When to Use**: Use this sub-structkit when you need to automatically label issues and pull requests based on certain criteria.
159
+
160
+ #### `github/workflows/release-drafter`
161
+
162
+ - **Description**: Provides a template for a GitHub Actions workflow that generates release notes using Release Drafter.
163
+ - **When to Use**: Use this sub-structkit when you need to automatically generate release notes for your project using Release Drafter.
164
+
165
+ #### `github/workflows/run-struct`
166
+
167
+ - **Description**: Provides a template for a GitHub Actions workflow that runs the structkit CLI.
168
+ - **When to Use**: Use this sub-structkit when you need to run the structkit CLI as part of your GitHub Actions workflows.
169
+
170
+ #### `github/workflows/stale`
171
+
172
+ - **Description**: Provides a template for a GitHub Actions workflow that closes stale issues and pull requests.
173
+ - **When to Use**: Use this sub-structkit when you need to automatically close stale issues and pull requests in your repository.
174
+
175
+ #### `github/templates`
176
+
177
+ - **Description**: Provides templates for GitHub issue and pull request templates.
178
+ - **When to Use**: Use this sub-structkit when you need to define issue and pull request templates for your GitHub repository.
179
+
180
+ #### `github/prompts/generic`
181
+
182
+ - **Description**: Provides a generic prompt for creating a new project structure.
183
+ - **When to Use**: Use this sub-structkit when you need to create a new project structure using the structkit CLI.
184
+
185
+ #### `github/prompts/react-form`
186
+
187
+ - **Description**: Provides a prompt for creating a React form component.
188
+ - **When to Use**: Use this sub-structkit when you need to create a React form component.
189
+
190
+ #### `github/prompts/security-api`
191
+
192
+ - **Description**: Provides a prompt for creating a security API.
193
+ - **When to Use**: Use this sub-structkit when you need to create a security API.
194
+
195
+ #### `github/prompts/struct`
196
+
197
+ - **Description**: Provides a prompt for creating a new .struct.yaml file and workflow to run struct.
198
+ - **When to Use**: Use this sub-structkit when you need to create a new .struct.yaml file and workflow to run struct.
199
+
200
+ ### Project
201
+
202
+ #### `project/generic`
203
+
204
+ - **Description**: Provides a generic project structure with directories for source code, documentation, and tests.
205
+ - **When to Use**: Use this sub-structkit when you need to create a generic project structure for your application.
206
+
207
+ #### `project/java`
208
+
209
+ - **Description**: Provides a Java project structure with directories for source code, resources, and tests.
210
+ - **When to Use**: Use this sub-structkit when you need to create a Java project structure for your application.
211
+
212
+ #### `project/nodejs`
213
+
214
+ - **Description**: Provides a Node.js project structure with directories for source code, tests, and configuration files.
215
+ - **When to Use**: Use this sub-structkit when you need to create a Node.js project structure for your application.
216
+
217
+ #### `project/rust`
218
+
219
+ - **Description**: Provides a Rust project structure with directories for source code, tests, and configuration files.
220
+ - **When to Use**: Use this sub-structkit when you need to create a Rust project structure for your application.
221
+
222
+ #### `project/python`
223
+
224
+ - **Description**: Provides a Python project structure with directories for source code, tests, and configuration files.
225
+ - **When to Use**: Use this sub-structkit when you need to create a Python project structure for your application.
226
+
227
+ #### `project/go`
228
+
229
+ - **Description**: Provides a Go project structure with directories for source code, tests, and configuration files.
230
+ - **When to Use**: Use this sub-structkit when you need to create a Go project structure for your application.
231
+
232
+ #### `project/ruby`
233
+
234
+ - **Description**: Provides a Ruby project structure with directories for source code, tests, and configuration files.
235
+ - **When to Use**: Use this sub-structkit when you need to create a Ruby project structure for your application.
236
+
237
+ ### Terraform
238
+
239
+ #### `terraform/modules/generic`
240
+
241
+ - **Description**: Provides a generic Terraform module structure with directories for resources, variables, and outputs.
242
+ - **When to Use**: Use this sub-structkit when you need to create a generic Terraform module for your infrastructure.
243
+
244
+ #### `terraform/apps/generic`
245
+
246
+ - **Description**: Provides a generic Terraform application structure with directories for modules, environments, and configurations.
247
+ - **When to Use**: Use this sub-structkit when you need to create a generic Terraform application for your infrastructure.
248
+
249
+ #### `terraform/apps/aws-accounts`
250
+
251
+ - **Description**: Provides a Terraform application structure for managing AWS accounts.
252
+ - **When to Use**: Use this sub-structkit when you need to manage AWS accounts using Terraform.
253
+
254
+ #### `terraform/apps/github-organization`
255
+
256
+ - **Description**: Provides a Terraform application structure for managing GitHub organizations.
257
+ - **When to Use**: Use this sub-structkit when you need to manage GitHub organizations using Terraform.
258
+
259
+ #### `terraform/apps/environments`
260
+
261
+ - **Description**: Provides a Terraform application structure for managing environments.
262
+ - **When to Use**: Use this sub-structkit when you need to manage environments using Terraform.
263
+
264
+ #### `terraform/apps/init`
265
+
266
+ - **Description**: Provides a Terraform application structure for initializing a new project.
267
+ - **When to Use**: Use this sub-structkit when you need to initialize a new Terraform project.
268
+
269
+ ---
270
+
271
+ Each of these sub-structs is designed to simplify the process of setting up specific project structures or configurations. Refer to the individual YAML files for more details on their usage and customization options.
@@ -0,0 +1,38 @@
1
+ files:
2
+ - main.yml:
3
+ content: |
4
+ - name: Example Playbook
5
+ hosts: all
6
+ become: yes
7
+ roles:
8
+ - example-role
9
+ - vars.yml:
10
+ content: |
11
+ example_variable: "value"
12
+ - tasks/main.yml:
13
+ content: |
14
+ - name: Install packages
15
+ apt:
16
+ name: "{{ item }}"
17
+ state: present
18
+ with_items:
19
+ - git
20
+ - curl
21
+ - handlers/main.yml:
22
+ content: |
23
+ - name: Restart service
24
+ service:
25
+ name: example-service
26
+ state: restarted
27
+ - templates/README.md:
28
+ content: |
29
+ # Example Template
30
+ This template contains example configuration files.
31
+ - README.md:
32
+ content: |
33
+ # Playbook Name
34
+ This playbook installs necessary packages and configures services.
35
+ ## Usage
36
+ ```bash
37
+ ansible-playbook -i inventory main.yml
38
+ ```
@@ -0,0 +1,51 @@
1
+ files:
2
+ - recipes/default.rb:
3
+ content: |
4
+ package 'nginx' do
5
+ action :install
6
+ end
7
+ service 'nginx' do
8
+ action [ :enable, :start ]
9
+ end
10
+ - attributes/default.rb:
11
+ content: |
12
+ default['nginx']['version'] = 'latest'
13
+ - templates/default/nginx.conf.erb:
14
+ content: |
15
+ user nginx;
16
+ worker_processes auto;
17
+ error_log /var/log/nginx/error.log warn;
18
+ pid /var/run/nginx.pid;
19
+ events {
20
+ worker_connections 1024;
21
+ }
22
+ http {
23
+ include /etc/nginx/mime.types;
24
+ default_type application/octet-stream;
25
+ sendfile on;
26
+ keepalive_timeout 65;
27
+ server {
28
+ listen 80;
29
+ server_name localhost;
30
+ location / {
31
+ root html;
32
+ index index.html index.htm;
33
+ }
34
+ }
35
+ }
36
+ - files/default/index.html:
37
+ content: |
38
+ <html>
39
+ <head>
40
+ <title>Welcome to nginx!</title>
41
+ </head>
42
+ <body>
43
+ <h1>Success! The nginx server is working!</h1>
44
+ </body>
45
+ </html>
46
+ - README.md:
47
+ content: |
48
+ # Cookbook Name
49
+ Chef cookbook for configuring NGINX.
50
+ ## Usage
51
+ Add the cookbook to your Chef server and include it in your run list.
@@ -0,0 +1,67 @@
1
+ files:
2
+ - .gitlab-ci.yml:
3
+ content: |
4
+ stages:
5
+ - build
6
+ - test
7
+ - deploy
8
+ build_job:
9
+ stage: build
10
+ script:
11
+ - echo "Building the project"
12
+ test_job:
13
+ stage: test
14
+ script:
15
+ - echo "Running tests"
16
+ deploy_job:
17
+ stage: deploy
18
+ script:
19
+ - echo "Deploying the project"
20
+ - Jenkinsfile:
21
+ content: |
22
+ pipeline {
23
+ agent any
24
+ stages {
25
+ stage('Build') {
26
+ steps {
27
+ echo 'Building the project'
28
+ }
29
+ }
30
+ stage('Test') {
31
+ steps {
32
+ echo 'Running tests'
33
+ }
34
+ }
35
+ stage('Deploy') {
36
+ steps {
37
+ echo 'Deploying the project'
38
+ }
39
+ }
40
+ }
41
+ }
42
+ - .github/workflows/ci.yml:
43
+ content: |
44
+ name: CI
45
+ on: [push, pull_request]
46
+ jobs:
47
+ build:
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - name: Checkout code
51
+ uses: actions/checkout@v2
52
+ - name: Build
53
+ run: echo "Building the project"
54
+ - name: Test
55
+ run: echo "Running tests"
56
+ - .github/workflows/cd.yml:
57
+ content: |
58
+ name: CD
59
+ on: [push]
60
+ jobs:
61
+ deploy:
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - name: Checkout code
65
+ uses: actions/checkout@v2
66
+ - name: Deploy
67
+ run: echo "Deploying the project"