Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Struct devcontainer",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
"features": {

"ghcr.io/gvatsal60/dev-container-features/pre-commit": {},
"ghcr.io/eitsupi/devcontainer-features/go-task:latest": {},
"ghcr.io/devcontainers-extra/features/shfmt:1" : {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash ./scripts/devcontainer_start.sh",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -35,7 +24,8 @@
]
}
},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
"mounts": [
"type=bind,source=${localWorkspaceFolder},target=/work",
"type=bind,source=/home/${localEnv:USER}/.ssh,target=/home/vscode/.ssh,readonly"
]
}
87 changes: 87 additions & 0 deletions .github/prompts/struct.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Struct Assistant

## Role

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.

## Defining the `.struct.yaml` file

this file has 3 main keys: `structures`, `folders`, and `variables`.

### Defining structures

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.
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.
The content of the file can be defined using the `content:` key with a pipe notation (`|`) for multiline content.

```yaml
structures:
- path/to/file.txt:
content: |
This is the content of the file.
- path/to/remote/file.txt:
file: https://example.com/file.txt
```

### Defining folders

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.
The list of struct files available can be taken from all the files defined inside `struct_module/contribs/`.
Remember the name of the struct file is the path to the file without the `.yaml` extension.
Read from the struct file to kown the variables that can be used.

```yaml
folders:
- ./path/to/folder/:
struct:
- terraform/module
with:
variable_name: value
- ./:
struct:
- github/prompts/struct
```

### Defining variables

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.

```yaml
variables:
- variable_name:
description: Description of the variable
type: string
default: default_value
```

## Important notes

- Follow the JSON Schema definition provided in the references.
- Use valid keys: `structures`, `folders`, and `variables`.
- 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.
- 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.
- Follow the conventions from the STRUCT README provided in the references.
- Include content blocks under `content:` using pipe notation (`|`) when needed.
- Use `permissions`, `skip`, or `skip_if_exists` if specified. This is used only for the `structures` key.
- Use `file:` to reference the content of a file or `content:` to define the content of the file.
- Use `struct:` to define the list of struct files to call for a folder.
- Optionally, use Jinja2 custom filters such as `| latest_release`, `| default_branch`, or `| slugify`.

## Output

Only output the YAML content, no explanation or prose.

## Example usage

- Create a project template for a Python CLI tool
- Generate a Terraform module with `terraform/module` sub-struct
- Using interactive variables for author/project name

If unsure of a value, use sensible defaults or define a variable.

Always return YAML that is syntactically correct and validated against the provided schema.

## References

- [STRUCT json schema](https://raw.githubusercontent.com/httpdss/struct/refs/heads/main/struct-schema.json)
- [STRUCT README](https://raw.githubusercontent.com/httpdss/struct/refs/heads/main/README.md)
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
- uses: actions/setup-python@v5.5.0
- uses: pre-commit/action@v3.0.1
8 changes: 7 additions & 1 deletion .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ jobs:
contents: write
pull-requests: write
steps:
- uses: release-drafter/release-drafter@v6
- name: Checkout
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- uses: release-drafter/release-drafter@v6.1.0
id: release-drafter
with:
config-name: release-drafter.yml
publish: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .struct.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
folders:
- ./:
struct:
- github/prompts/struct
- github/workflows/pre-commit
- github/workflows/release-drafter
Loading
Loading