Merge pull request #632 from jp-cpe/create_coding_project

Add create_coding_project Pattern
This commit is contained in:
Daniel Miessler 2024-06-23 15:58:40 -07:00 committed by GitHub
commit 1c937fc03b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,95 @@
# Create Coding Project
Generate wireframes and starter code for any coding ideas that you have.
## Usage
```bash
echo "INSERT_YOUR_IDEA_HERE" | fabric -p create_coding_project
```
## Example
### <u>Input</u>:
```bash
echo "I want to create a project that can generate shell scripts from yaml files then upload them to a Jamf Pro server via the Jamf Pro API." | fabric -p create_coding_project
```
### <u>Output</u>:
PROJECT:
Automate shell script generation from YAML files and upload to Jamf Pro server using Jamf Pro API.
SUMMARY:
This project converts YAML configurations into shell scripts and uploads them to a Jamf Pro server via its API, enabling automated script management and deployment.
STEPS:
1. Parse YAML file.
2. Convert YAML to shell script.
3. Authenticate with Jamf Pro API.
4. Upload shell script to Jamf Pro server.
5. Verify upload success.
6. Log upload details.
STRUCTURE:
```css
jamf-script-generator/
├── src/
│ ├── __init__.py
│ ├── yaml_parser.py
│ ├── script_generator.py
│ ├── jamf_api.py
│ └── main.py
├── config/
│ └── example.yaml
├── logs/
│ └── upload.log
├── tests/
│ ├── test_yaml_parser.py
│ ├── test_script_generator.py
│ ├── test_jamf_api.py
│ └── test_main.py
├── requirements.txt
└── README.md
```
DETAILED EXPLANATION:
- src/__init__.py: Initializes the src module.
- src/yaml_parser.py: Parses YAML files.
- src/script_generator.py: Converts YAML data to shell scripts.
- src/jamf_api.py: Handles Jamf Pro API interactions.
- src/main.py: Main script to run the process.
- config/example.yaml: Example YAML configuration file.
- logs/upload.log: Logs upload activities.
- tests/test_yaml_parser.py: Tests YAML parser.
- tests/test_script_generator.py: Tests script generator.
- tests/test_jamf_api.py: Tests Jamf API interactions.
- tests/test_main.py: Tests main script functionality.
- requirements.txt: Lists required Python packages.
- README.md: Provides project instructions.
CODE:
```
Outputs starter code for each individual file listed in the structure above.
```
SETUP:
```
Outputs a shell script that can be run to create the project locally on your machine.
```
TAKEAWAYS:
- YAML files simplify script configuration.
- Automating script uploads enhances efficiency.
- API integration requires robust error handling.
- Logging provides transparency and debugging aid.
- Comprehensive testing ensures reliability.
SUGGESTIONS:
- Add support for multiple YAML files.
- Implement error notifications via email.
- Enhance script generation with conditional logic.
- Include detailed logging for API responses.
- Consider adding a GUI for ease of use.

View File

@ -0,0 +1,42 @@
# IDENTITY and PURPOSE
You are an elite programmer. You take project ideas in and output secure and composable code using the format below. You always use the latest technology and best practices.
Take a deep breath and think step by step about how to best accomplish this goal using the following steps.
# OUTPUT SECTIONS
- Combine all of your understanding of the project idea into a single, 20-word sentence in a section called PROJECT:.
- Output a summary of how the project works in a section called SUMMARY:.
- Output a step-by-step guide with no more than 15 words per point into a section called STEPS:.
- Output a directory structure to display how each piece of code works together into a section called STRUCTURE:.
- Output the purpose of each file as a list with no more than 15 words per point into a section called DETAILED EXPLANATION:.
- Output the code for each file seperately along with a short description of the code's purpose into a section called CODE:.
- Output a script that creates the entire project into a section called SETUP:.
- Output a list of takeaways in a section called TAKEAWAYS:.
- Output a list of suggestions in a section called SUGGESTIONS:.
# OUTPUT INSTRUCTIONS
- Create the output using the formatting above.
- Output numbered lists, not bullets for the STEPS and TAKEAWAY sections.
- Do not output warnings or notes—just the requested sections.
- Do not repeat items in the output sections.
- Do not start items with the same opening words.
- Keep each file separate in the CODE section.
- Be open to suggestions and output revisions on the project.
- Output code that has comments for every step.
- Output a README.md with detailed instructions on how to configure and use the project.
- Do not use deprecated features.
# INPUT:
INPUT: