Skip to content

Commit 6d33ba6

Browse files
authored
Merge pull request #1 from httpdss/main
update from upstream
2 parents 48fcbbf + b13add8 commit 6d33ba6

21 files changed

Lines changed: 814 additions & 41 deletions

.devcontainer/devcontainer.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/python
31
{
42
"name": "Struct devcontainer",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
63
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
74
"features": {
8-
5+
"ghcr.io/gvatsal60/dev-container-features/pre-commit": {},
6+
"ghcr.io/eitsupi/devcontainer-features/go-task:latest": {},
7+
"ghcr.io/devcontainers-extra/features/shfmt:1" : {}
98
},
10-
11-
// Features to add to the dev container. More info: https://containers.dev/features.
12-
// "features": {},
13-
14-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
// "forwardPorts": [],
16-
17-
// Use 'postCreateCommand' to run commands after the container is created.
189
"postCreateCommand": "bash ./scripts/devcontainer_start.sh",
19-
20-
// Configure tool-specific properties.
2110
"customizations": {
2211
"vscode": {
2312
"extensions": [
13+
"ms-python.python",
14+
"Github.copilot",
15+
"kameshkotwani.google-search",
16+
"lacroixdavid1.vscode-format-context-menu",
17+
"task.vscode-task",
18+
"redhat.vscode-yaml",
19+
"esbenp.prettier-vscode",
20+
"editorconfig.editorconfig",
21+
"davidanson.vscode-markdownlint",
22+
"foxundermoon.shell-format",
23+
"gruntfuggly.todo-tree"
2424
]
2525
}
2626
},
27-
28-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
29-
"remoteUser": "root"
27+
"mounts": [
28+
"type=bind,source=${localWorkspaceFolder},target=/work",
29+
"type=bind,source=/home/${localEnv:USER}/.ssh,target=/home/vscode/.ssh,readonly"
30+
]
3031
}

.github/prompts/struct.prompt.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Struct Assistant
2+
3+
## Role
4+
5+
You are an expert assistant that generates valid `.struct.yaml` files for the [STRUCT tool](https://github.com/httpdss/struct), which automates project structure generation from YAML configuration.
6+
7+
## Defining the `.struct.yaml` file
8+
9+
this file has 3 main keys: `structures`, `folders`, and `variables`.
10+
11+
### Defining structures
12+
13+
The `structures` key is used to define files that are created. Each file path should have a reference to the content it needs to put on the file or the content of the file itself.
14+
For referencing the content of a file, you can use the `file:` key with the path to the file. this can also be a remote https file.
15+
The content of the file can be defined using the `content:` key with a pipe notation (`|`) for multiline content.
16+
17+
```yaml
18+
structures:
19+
- path/to/file.txt:
20+
content: |
21+
This is the content of the file.
22+
- path/to/remote/file.txt:
23+
file: https://example.com/file.txt
24+
```
25+
26+
### Defining folders
27+
28+
The `folders` key is used to define folders that are created. Each folder path should include a `struct` key with a list of struct files to call. Optionally, you can define the value of a variable using the `with:` key.
29+
The list of struct files available can be taken from all the files defined inside `struct_module/contribs/`.
30+
Remember the name of the struct file is the path to the file without the `.yaml` extension.
31+
Read from the struct file to kown the variables that can be used.
32+
33+
```yaml
34+
folders:
35+
- ./path/to/folder/:
36+
struct:
37+
- terraform/module
38+
with:
39+
variable_name: value
40+
- ./:
41+
struct:
42+
- github/prompts/struct
43+
```
44+
45+
### Defining variables
46+
47+
The `variables` key is used to define variables that can be used in the struct files. Each variable should have a description, type, and optional default value.
48+
49+
```yaml
50+
variables:
51+
- variable_name:
52+
description: Description of the variable
53+
type: string
54+
default: default_value
55+
```
56+
57+
## Important notes
58+
59+
- Follow the JSON Schema definition provided in the references.
60+
- Use valid keys: `structures`, `folders`, and `variables`.
61+
- if you want to define files, use the `structures:` key, and a list of file paths that are created. each file path should have a content key.
62+
- if you want to define folders, use the `folders:` key, and a list of folder paths that are created. each folder path should have a list of folder paths and each folder path needs to have a list of struct keys. also if you want to define the value of a variable then you should use the `with:` key.
63+
- Follow the conventions from the STRUCT README provided in the references.
64+
- Include content blocks under `content:` using pipe notation (`|`) when needed.
65+
- Use `permissions`, `skip`, or `skip_if_exists` if specified. This is used only for the `structures` key.
66+
- Use `file:` to reference the content of a file or `content:` to define the content of the file.
67+
- Use `struct:` to define the list of struct files to call for a folder.
68+
- Optionally, use Jinja2 custom filters such as `| latest_release`, `| default_branch`, or `| slugify`.
69+
70+
## Output
71+
72+
Only output the YAML content, no explanation or prose.
73+
74+
## Example usage
75+
76+
- Create a project template for a Python CLI tool
77+
- Generate a Terraform module with `terraform/module` sub-struct
78+
- Using interactive variables for author/project name
79+
80+
If unsure of a value, use sensible defaults or define a variable.
81+
82+
Always return YAML that is syntactically correct and validated against the provided schema.
83+
84+
## References
85+
86+
- [STRUCT json schema](https://raw.githubusercontent.com/httpdss/struct/refs/heads/main/struct-schema.json)
87+
- [STRUCT README](https://raw.githubusercontent.com/httpdss/struct/refs/heads/main/README.md)
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
1+
name: deploy-pages
32

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
75
branches: ["main"]
6+
paths:
7+
- "site/**"
88

9-
# Allows you to run this workflow manually from the Actions tab
109
workflow_dispatch:
1110

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1311
permissions:
1412
contents: read
1513
pages: write
1614
id-token: write
1715

18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2016
concurrency:
2117
group: "pages"
2218
cancel-in-progress: false
2319

2420
jobs:
25-
# Single deploy job since we're just deploying
2621
deploy:
2722
environment:
2823
name: github-pages
@@ -31,13 +26,15 @@ jobs:
3126
steps:
3227
- name: Checkout
3328
uses: actions/checkout@v4
29+
3430
- name: Setup Pages
3531
uses: actions/configure-pages@v5
32+
3633
- name: Upload artifact
3734
uses: actions/upload-pages-artifact@v3
3835
with:
39-
# Upload entire repository
40-
path: '.'
36+
path: './site'
37+
4138
- name: Deploy to GitHub Pages
4239
id: deployment
4340
uses: actions/deploy-pages@v4

.github/workflows/pre-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4.2.2
14-
- uses: actions/setup-python@v5.3.0
14+
- uses: actions/setup-python@v5.5.0
1515
- uses: pre-commit/action@v3.0.1

.github/workflows/push-to-registry.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: push-to-registry
22

33
on:
44
push:
5-
branches: ['main']
65
tags:
7-
- 'v**'
6+
- v**
87

98

109
env:

.github/workflows/release-drafter.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ jobs:
1212
contents: write
1313
pull-requests: write
1414
steps:
15-
- uses: release-drafter/release-drafter@v6
15+
- name: Checkout
16+
uses: actions/checkout@v4.2.2
17+
with:
18+
fetch-depth: 0
19+
- uses: release-drafter/release-drafter@v6.1.0
1620
id: release-drafter
1721
with:
1822
config-name: release-drafter.yml
23+
publish: false
24+
prerelease: false
1925
env:
2026
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/struct-generate.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,17 @@ jobs:
9494
-s ./custom-structures/${{ inputs.custom_structure_path }}
9595
9696
struct generate \
97+
--non-interactive \
9798
-s ./custom-structures/${{ inputs.custom_structure_path }} \
9899
${{ inputs.args }} \
99100
${{ inputs.struct_file }} \
100101
${{ inputs.output_dir }}
101102
else
102103
struct list
103104
104-
struct generate ${{ inputs.args }} \
105+
struct generate \
106+
--non-interactive \
107+
${{ inputs.args }} \
105108
${{ inputs.struct_file }} \
106109
${{ inputs.output_dir }}
107110
fi

.struct.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
folders:
22
- ./:
33
struct:
4+
- github/prompts/struct
45
- github/workflows/pre-commit
56
- github/workflows/release-drafter

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
![Struct Banner](extras/banner.png)
66

7-
> [!WARNING]
8-
> This project is still in development and may contain bugs. Use it at your own risk.
9-
107
## 📄 Table of Contents
118

129
- [Introduction](#-introduction)

0 commit comments

Comments
 (0)