-
Notifications
You must be signed in to change notification settings - Fork 0
Add AGENTS.md, shellcheck automation, and version-check.sh #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ZippyType
wants to merge
1
commit into
main
Choose a base branch
from
feat/agents-and-automations-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| tasks: | ||
| installShellcheck: | ||
| name: Install shellcheck | ||
| description: Ensure shellcheck is available for linting shell scripts. | ||
| command: | | ||
| if ! command -v shellcheck &>/dev/null; then | ||
| sudo apt-get update -qq && sudo apt-get install -y shellcheck | ||
| else | ||
| echo "shellcheck $(shellcheck --version | grep version:) already installed" | ||
| fi | ||
| triggeredBy: | ||
| - postDevcontainerStart | ||
|
|
||
| lintScripts: | ||
| name: Lint shell scripts | ||
| description: Run shellcheck against all .sh files in the repo and report issues. | ||
| command: | | ||
| echo "=== Aaron Linux - Shell Script Lint ===" | ||
| echo "" | ||
|
|
||
| SCRIPTS=$(find . -name "*.sh" -not -path "./.git/*" | sort) | ||
| TOTAL=0 | ||
| FAILED=0 | ||
| PASSED=0 | ||
|
|
||
| for f in $SCRIPTS; do | ||
| TOTAL=$((TOTAL + 1)) | ||
| echo "Checking: $f" | ||
| if shellcheck -x "$f"; then | ||
| PASSED=$((PASSED + 1)) | ||
| else | ||
| FAILED=$((FAILED + 1)) | ||
| fi | ||
| echo "" | ||
| done | ||
|
|
||
| echo "=======================================" | ||
| echo "Results: $TOTAL scripts checked" | ||
| echo " Passed : $PASSED" | ||
| echo " Failed : $FAILED" | ||
| echo "=======================================" | ||
|
|
||
| if [ "$FAILED" -gt 0 ]; then | ||
| echo "Fix the issues above and re-run this task." | ||
| exit 1 | ||
| fi | ||
| triggeredBy: | ||
| - manual | ||
| dependsOn: | ||
| - installShellcheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # AGENTS.md | ||
|
|
||
| ## Project Overview | ||
|
|
||
| This repository is a Linux From Scratch (LFS) build environment. The goal is to compile a complete Linux system from source, following the [LFS book](https://www.linuxfromscratch.org/lfs/). | ||
|
|
||
| ## Environment | ||
|
|
||
| This project runs inside a Gitpod (Ona) dev container based on Ubuntu 24.04. | ||
|
|
||
| ### Verified Host Tool Versions | ||
|
|
||
| | Tool | Version | | ||
| |----------|----------------------------------| | ||
| | bash | 5.2.21(1)-release | | ||
| | Binutils | 2.42 | | ||
| | bison | 3.8.2 | | ||
| | gcc | 13.3.0 | | ||
| | g++ | 13.3.0 | | ||
| | glibc | 2.39 | | ||
| | make | 4.3 | | ||
|
|
||
| Run `bash version-check.sh` at any time to re-verify host tool availability. | ||
|
|
||
| ### Installed Tools | ||
|
|
||
| - **opencode** (v1.14.50) — AI coding assistant. Run with `opencode` in any project directory. | ||
| - **shellcheck** (v0.9.0) — Shell script static analysis tool. | ||
|
|
||
| ## Automations | ||
|
|
||
| Defined in `.ona/automations.yaml`. | ||
|
|
||
| | Task | Trigger | Description | | ||
| |------|---------|-------------| | ||
| | `installShellcheck` | `postDevcontainerStart` | Installs `shellcheck` if not present | | ||
| | `lintScripts` | manual | Runs `shellcheck` against all `.sh` files in the repo | | ||
|
|
||
| ### Running the linter | ||
|
|
||
| Via the Ona CLI: | ||
|
|
||
| ```bash | ||
| gitpod automations task start lintScripts | ||
| ``` | ||
|
|
||
| Or directly: | ||
|
|
||
| ```bash | ||
| find . -name "*.sh" -not -path "./.git/*" | sort | xargs shellcheck -x | ||
| ``` | ||
|
|
||
| The linter checks all shell scripts and reports issues by file. Fix `error` and `warning` level findings before committing. `info` level findings are advisory. | ||
|
|
||
| ## Agent Guidelines | ||
|
|
||
| ### General Rules | ||
|
|
||
| - Follow the LFS book chapter order. Do not skip steps or reorder package builds unless you have a specific reason documented here. | ||
| - All source packages must be downloaded to `$LFS/sources` and verified against their checksums before building. | ||
| - All builds happen inside `$LFS/sources/<package-dir>`. Clean up build directories after a successful install. | ||
| - Never modify files outside `$LFS` unless explicitly required by the host system setup chapters. | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| Before running any LFS build commands, ensure these are set: | ||
|
|
||
| ```bash | ||
| export LFS=/mnt/lfs | ||
| export LFS_TGT=$(uname -m)-lfs-linux-gnu | ||
| export PATH=/usr/bin:/bin | ||
| ``` | ||
|
|
||
| For cross-compilation chapters, prepend the toolchain to PATH: | ||
|
|
||
| ```bash | ||
| export PATH=$LFS/tools/bin:$PATH | ||
| ``` | ||
|
|
||
| ### Build Discipline | ||
|
|
||
| - Always `cd` into the extracted source directory before configuring or building. | ||
| - Use `make -j$(nproc)` for parallel builds unless a package is known to fail with parallel jobs. | ||
| - After `make install`, return to `$LFS/sources` and remove the build directory. | ||
| - Log build output for any package that fails: `make 2>&1 | tee build.log`. | ||
|
|
||
| ### Partition and Filesystem | ||
|
|
||
| - The LFS partition is expected at `$LFS` (`/mnt/lfs`). | ||
| - Do not run `mkfs` or `fdisk` commands without explicit user confirmation. | ||
|
|
||
| ### Committing Changes | ||
|
|
||
| - Commit scripts, patches, and configuration files — not compiled binaries or source tarballs. | ||
| - Keep `.gitignore` updated to exclude `$LFS/sources/*.tar.*` and build artifacts. | ||
| - Commit messages should state what LFS chapter/step the change relates to. | ||
| - All shell scripts must pass `shellcheck` before committing. | ||
|
|
||
| ### Using opencode | ||
|
|
||
| opencode is available for AI-assisted coding tasks: | ||
|
|
||
| ```bash | ||
| opencode # launch in the current directory | ||
| ``` | ||
|
|
||
| Use it for writing build scripts, debugging compilation errors, or generating patches. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/bash | ||
| export LC_ALL=C | ||
| bash --version | head -n1 | cut -d" " -f2-4 | ||
| echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- | ||
| bison --version | head -n1 | ||
| gcc --version | head -n1 | ||
| g++ --version | head -n1 | ||
| ldd --version | head -n1 | cut -d" " -f2- # glibc version | ||
| make --version | head -n1 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version-check.shis intended to verify tool availability, but each check is piped throughhead/cutwithoutpipefail, so a missing tool can still produce a successful pipeline status (e.g.,bison --version | head -n1returns 0 even whenbisonis not installed). In that case the script can exit successfully and report a false pass, which can let an invalid host environment proceed into later LFS steps and fail much later.Useful? React with 👍 / 👎.