Skip to content

Update the recipe files.#132

Open
devsecfranklin wants to merge 7 commits into
mainfrom
dev132-20260424
Open

Update the recipe files.#132
devsecfranklin wants to merge 7 commits into
mainfrom
dev132-20260424

Conversation

@devsecfranklin
Copy link
Copy Markdown
Collaborator

@devsecfranklin devsecfranklin commented Apr 27, 2026

YAML Frontmatter Schema Definition

Defining a strict YAML schema ensures predictable parsing for automated tooling, such as Bill of Materials (BOM) generation and document rendering. The frontmatter must be placed at the very beginning of the .md file, enclosed by --- delimiters.

The ingredients and step-by-step instructions should remain in the standard markdown body to leverage native rendering, while the YAML block handles all structured metadata.

Schema Structure and Data Types

  • title: (String) The exact name of the recipe.
  • author: (String) The handle of the contributor (e.g., devsecfranklin).
  • date: (Date: YYYY-MM-DD) The original submission or last modification date.
  • prep_time: (Integer) Preparation time required, defined in minutes.
  • cook_time: (Integer) Active or passive cooking time, defined in minutes.
  • yield: (String) Total servings or output volume.
  • difficulty: (String) Categorical variable (e.g., low, medium, high).
  • tags: (List of Strings) Classifications for indexing and searching.
  • hardware: (List of Strings) Required tools or kitchen equipment to execute the recipe.

Implementation Template

Create a skeleton file at .admin/templates/recipe_skel.md containing the following template:

---
title: ""
author: ""
date: "YYYY-MM-DD"
prep_time: 0
cook_time: 0
yield: ""
difficulty: ""
tags:
  - 
hardware:
  - 
---

## Ingredients

* ## Instructions

1. 

To insert this schema into an existing recipe file, open the target file using vi and execute the following command in normal mode to read the template into the top of the current buffer:

:0r .admin/templates/recipe_skel.md

This structure strictly organizes the metadata and ensures that the downstream Python parsers can extract the necessary fields for BOM creation without encountering markdown cross-reference markers.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the build system by removing Docker-related configurations, restructuring LaTeX source files into a dedicated directory, and simplifying the bootstrap.sh script. Feedback highlights critical issues in the new bom target regarding path resolution and virtual environment activation. Furthermore, the removal of OS detection in bootstrap.sh breaks required OpenBSD support. Other recommendations include cleaning up .PHONY targets in the Makefile, removing an unused variable, and simplifying the autotools execution sequence.

Comment thread .admin/Makefile.am Outdated
Comment on lines +9 to +11
. $(PY39)/bin/activate && \
pip install -r .admin/src/requirements.txt && \
python .admin/src/generate_bom.py -d ../recipes -o ../BOM.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The bom target contains several issues that will cause it to fail:

  1. Incorrect Activation: It attempts to source $(PY39)/bin/activate. However, PY39 is defined in configure.ac as the Python interpreter name (e.g., python3.9), not the virtual environment directory. It should use $(VENV) (which is .venv).
  2. Path Resolution: The paths .admin/src/requirements.txt and .admin/src/generate_bom.py are incorrect. Since this Makefile is already located within the .admin/ directory, these paths will resolve to .admin/.admin/.... They should be relative to the Makefile's location.
  3. Best Practice: It is recommended to use the venv-specific binaries (e.g., $(VENV)/bin/python) to ensure the correct environment is used, consistent with the python target implementation.
	. $(VENV)/bin/activate && \
	$(VENV)/bin/python -m pip install -r src/requirements.txt && \
	$(VENV)/bin/python src/generate_bom.py -d ../recipes -o ../BOM.md

Comment thread .admin/bootstrap.sh
check_docker
detect_os
#check_installed doxygen
required_files
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The removal of the detect_os call (and its definition) breaks OpenBSD support. The MY_OS variable will now remain at its default value of "unknown", which causes the script to skip the necessary environment variable overrides (e.g., AUTOCONF_VERSION=2.71) required for OpenBSD in functions like run_aclocal. Given that the repository style guide (GEMINI.md, line 33) explicitly mentions OpenBSD support, this detection logic should be preserved.

Comment thread .admin/Makefile.am Outdated
@@ -5,6 +5,11 @@ PYTHON = $(VENV)/bin/python3

.PHONY: clean docker python
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The docker target has been removed from the Makefile, but it remains in the .PHONY declaration. Additionally, the new bom target should be added to .PHONY to ensure it executes correctly even if a file named bom exists.

.PHONY: clean python bom

Comment thread .admin/bootstrap.sh
echo "Running libtoolize..."
libtoolize --force --copy --automake || exit 1
}
DEB_PKG=(fig2dev gnuplot)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The DEB_PKG array is defined here but is never used in the script, as the package installation functions (like install_debian) have been removed in this PR.

Comment thread .admin/bootstrap.sh
Comment on lines 121 to 123
run_aclocal
run_autoconf
run_automake
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The explicit calls to run_aclocal, run_autoconf, and run_automake are redundant. The run_autoconf function invokes autoreconf -i, which is designed to automatically run all necessary autotools (aclocal, autoconf, autoheader, automake, etc.) in the correct sequence. You can simplify the main function by relying on autoreconf.

Suggested change
run_aclocal
run_autoconf
run_automake
run_autoconf

@devsecfranklin
Copy link
Copy Markdown
Collaborator Author

/gemini review

@devsecfranklin
Copy link
Copy Markdown
Collaborator Author

/gemini summary

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the project's build and maintenance infrastructure, transitioning from a Docker-centric setup to a local Autotools and Python-based workflow. Significant changes include the removal of Docker-related files, the simplification of the bootstrap.sh script by removing OS-specific installation logic, and the addition of a Python script that uses the Gemini API to automatically populate recipe metadata. Furthermore, the Bill of Materials generation was updated, and recipe files were standardized with YAML frontmatter. Review feedback highlights several critical issues: the Makefile.am violates the repository style guide by removing the PY39 variable and hardcoding the virtual environment path to /tmp, which poses multi-user risks. Additionally, the new AI script uses an invalid model identifier and contains a prompt that could lead to JSON parsing failures. There are also inconsistencies in the Makefile regarding virtual environment execution and unused variables in the bootstrap script.

Comment thread .admin/Makefile.am
bom:
. $(VENV)/bin/activate && \
$(PYTHON) -m pip install -r src/requirements.txt && \
$(PYTHON) src/generate_bom.py -d ../recipes -o ../BOM.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The generate_bom.py script has been updated and no longer accepts a -d argument; it now uses -b (or --base-dir) which defaults to ... Furthermore, using $(PYTHON) (the system Python) inside the activation block is incorrect as it bypasses the virtual environment's interpreter and its installed dependencies. You should use the Python executable from the virtual environment.

	$(VENV)/bin/python src/generate_bom.py -b .. -o ../BOM.md

try:
# New SDK syntax for content generation
response = client.models.generate_content(
model='gemini-2.5-flash',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The model name gemini-2.5-flash is not a valid model identifier. Please use a supported model name such as gemini-2.0-flash or gemini-1.5-flash.

Suggested change
model='gemini-2.5-flash',
model='gemini-2.0-flash',

Comment thread .admin/Makefile.am
ACLOCAL_AMFLAGS = -I config/m4 -I aclocal
VENV = .venv
PYTHON = $(VENV)/bin/python3
VENV = /tmp/venv
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding the virtual environment to /tmp/venv can lead to permission issues or collisions in multi-user environments. It is generally better to keep the virtual environment local to the project directory (e.g., .venv). Additionally, the removal of the PY39 variable violates the repository style guide.

References
  1. Always use the $(PY39) variable defined in the Makefile for virtual environments. (link)

Comment thread .admin/bootstrap.sh
echo "Running libtoolize..."
libtoolize --force --copy --automake || exit 1
}
DEB_PKG=(fig2dev gnuplot)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The DEB_PKG variable is defined but never used, as the installation logic was removed in this PR. This should be cleaned up to avoid confusion.

Comment on lines +33 to +42
{{
"title": "Recipe Name",
"author": "devsecfranklin",
"prep_time": 15, // integer in minutes (guess if not explicit)
"cook_time": 30, // integer in minutes (guess if not explicit)
"yield": "4 servings",
"difficulty": "medium", // low, medium, or high
"tags": ["tag1", "tag2"], // e.g., breakfast, dessert, vegan, high-availability
"hardware": ["skillet", "mixing bowl"]
}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The prompt includes // comments within the JSON structure. Since standard JSON does not support comments, json.loads() will fail if the model includes them in the response. It is recommended to remove these comments from the prompt example.

Suggested change
{{
"title": "Recipe Name",
"author": "devsecfranklin",
"prep_time": 15, // integer in minutes (guess if not explicit)
"cook_time": 30, // integer in minutes (guess if not explicit)
"yield": "4 servings",
"difficulty": "medium", // low, medium, or high
"tags": ["tag1", "tag2"], // e.g., breakfast, dessert, vegan, high-availability
"hardware": ["skillet", "mixing bowl"]
}}
{{
"title": "Recipe Name",
"author": "devsecfranklin",
"prep_time": 15,
"cook_time": 30,
"yield": "4 servings",
"difficulty": "medium",
"tags": ["tag1", "tag2"],
"hardware": ["skillet", "mixing bowl"]
}}

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

This pull request standardizes the recipe repository by implementing a strict YAML frontmatter schema across all markdown files. It includes new tooling to automate the population of this metadata using AI, alongside significant cleanup of the build system and directory structure to improve maintainability and support automated documentation generation.

Highlights

  • YAML Frontmatter Standardization: Introduced a mandatory YAML frontmatter schema for all recipe files to facilitate automated metadata extraction and Bill of Materials (BOM) generation.
  • AI-Powered Metadata Population: Added a new utility script, populate_frontmatter.py, which leverages the Gemini API to automatically infer and populate missing recipe metadata.
  • Build System Refactoring: Cleaned up the build environment by removing Docker-related files, renaming the tex directory to latex, and updating the Makefile.am to support automated BOM generation.
Ignored Files
  • Ignored by pattern: .gemini/** (1)
    • .gemini/CONTEXT.md
Activity
  • The PR was created by devsecfranklin.
  • Automated code review identified several issues regarding Makefile targets, path resolution, and incorrect model identifiers.
  • Reviewers noted that the removal of OS detection logic broke OpenBSD support and that the new BOM generation script had incorrect argument handling.
  • Concerns were raised regarding the hardcoding of the virtual environment path to /tmp/venv and the inclusion of comments in the JSON prompt example.

Copy link
Copy Markdown
Collaborator

@OIFhax OIFhax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants