{{cow_greeting}}
-diff --git a/docs/WORKFLOW-DISPOSITION.adoc b/docs/WORKFLOW-DISPOSITION.adoc index 5bfda1a..437df10 100644 --- a/docs/WORKFLOW-DISPOSITION.adoc +++ b/docs/WORKFLOW-DISPOSITION.adoc @@ -34,9 +34,17 @@ prohibited-language objects were: |`engines/terrapin-ssg/terrapin-ssg.py` |`100755` |`b6ee989e6176c775c7b95aa56f2fa32df800a8e6` |=== -They remain unsupported historical experiments. This is not permission to -introduce or develop Python runtime code, and neither file is deleted to -make a language check pass. +Both objects were retired on the owner's ruling of 2026-11-26 ("do them in +cow and logo, get rid of python entirely") and are deleted from the tree. They +remain in source history through the preserved import above. The milk-ssg +engine is the COW source `satellites/milk-ssg/src/milk-ssg.cow` and the +terrapin-ssg engine is the Logo source +`satellites/terrapin-ssg/src/terrapin-ssg.logo`. The engine-level workflows +under `engines/milk-ssg/` and `engines/terrapin-ssg/` no longer call Python; +they validate those COW and Logo sources. After the retirement the gate +expects no retained prohibited-language objects, so any `.py` file reappearing +at either path is a violation. This is not permission to introduce or develop +Python runtime code. This gate checks a *source-object delta*, not execution or activation. An added shell wrapper could invoke an unchanged historical file while the exact diff --git a/engines/milk-ssg/.github/workflows/ci.yml b/engines/milk-ssg/.github/workflows/ci.yml index c291a53..e02a281 100644 --- a/engines/milk-ssg/.github/workflows/ci.yml +++ b/engines/milk-ssg/.github/workflows/ci.yml @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MPL-2.0-or-later +# milk-ssg is the COW engine at satellites/milk-ssg/src/milk-ssg.cow. +# The former Python interpreter (engines/milk-ssg/milk-ssg.py) was retired on +# the owner's ruling of 2026-11-26. This check validates the COW source only. name: milk-ssg CI on: @@ -6,61 +10,28 @@ on: pull_request: branches: [main, master] -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - - name: Set up Python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 - with: - python-version: '3.11' - - - name: Test COW Interpreter - run: python3 milk-ssg.py test-cow - - - name: Test Markdown - run: python3 milk-ssg.py test-markdown - - - name: Test Frontmatter - run: python3 milk-ssg.py test-frontmatter +permissions: + contents: read - - name: Test Full Pipeline - run: python3 milk-ssg.py test-full - - build: +jobs: + validate: runs-on: ubuntu-latest - needs: test steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - - name: Set up Python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - python-version: '3.11' + persist-credentials: false - - name: Build sample site + - name: No Python in the engine directory run: | - mkdir -p _site - python3 milk-ssg.py build || echo "Build completed" - - - name: Upload artifact - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 - with: - path: _site + if find engines/milk-ssg -type f -name '*.py' | grep -q .; then + echo 'Python found in engines/milk-ssg; the engine is COW only' >&2 + exit 1 + fi - deploy: - if: github.ref == 'refs/heads/main' - needs: build - runs-on: ubuntu-latest - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 + - name: COW engine source is present and holds COW commands + run: | + src=satellites/milk-ssg/src/milk-ssg.cow + test -f "$src" + count=$(grep -o 'moo\|mOo\|moO\|mOO\|Moo\|MOo\|MoO\|MOO\|OOO\|MMM\|OOM\|oom' "$src" | wc -l) + echo "COW commands: $count" + test "$count" -gt 0 diff --git a/engines/milk-ssg/milk-ssg.py b/engines/milk-ssg/milk-ssg.py deleted file mode 100755 index 1024c99..0000000 --- a/engines/milk-ssg/milk-ssg.py +++ /dev/null @@ -1,424 +0,0 @@ -#!/usr/bin/env python3 -""" -milk-ssg - COW esoteric language powered static site generator - -Moo! A brainfuck variant SSG, because why not. - -COW has 12 instructions based on case variations of "moo": - moo - Move back one instruction (loop start) - moO - Move memory pointer forward - mOo - Move memory pointer backward - mOO - Execute value at memory as instruction - Moo - If current memory is 0, read char, else print char - MOo - Decrement current memory - MoO - Increment current memory - MOO - Loop: if memory is 0, skip to matching moo - OOO - Set current memory to 0 - MMM - If memory is 0, register block, else restore - OOM - Print current memory as number - oom - Read number into current memory - -For the SSG, we use COW programs to generate site content, -with a wrapper that handles file I/O and templates. -""" - -import sys -import os -import re -import json -from typing import List, Tuple, Dict, Optional -from dataclasses import dataclass, field - -# ============================================================================ -# COW Interpreter -# ============================================================================ - -COW_INSTRUCTIONS = { - 'moo': 0, # loop end / back jump - 'moO': 1, # pointer++ - 'mOo': 2, # pointer-- - 'mOO': 3, # execute memory as instruction - 'Moo': 4, # if mem==0 read, else print - 'MOo': 5, # mem-- - 'MoO': 6, # mem++ - 'MOO': 7, # loop start - 'OOO': 8, # mem = 0 - 'MMM': 9, # register/restore block - 'OOM': 10, # print mem as number - 'oom': 11, # read number -} - -def parse_cow(source: str) -> List[int]: - """Parse COW source into instruction list.""" - tokens = re.findall(r'[mMoO]{3}', source) - return [COW_INSTRUCTIONS.get(t, -1) for t in tokens if t in COW_INSTRUCTIONS] - -def run_cow(program: List[int], input_data: str = "") -> str: - """Execute COW program and return output.""" - memory = [0] * 30000 - ptr = 0 - ip = 0 - output = [] - input_pos = 0 - register = None - max_steps = 1000000 - - steps = 0 - while ip < len(program) and steps < max_steps: - steps += 1 - instr = program[ip] - - if instr == 0: # moo - jump back to matching MOO - depth = 1 - ip -= 1 - while ip >= 0 and depth > 0: - if program[ip] == 7: depth -= 1 - elif program[ip] == 0: depth += 1 - if depth > 0: ip -= 1 - elif instr == 1: # moO - pointer++ - ptr += 1 - elif instr == 2: # mOo - pointer-- - ptr -= 1 - elif instr == 3: # mOO - execute memory as instruction - if 0 <= memory[ptr] <= 11: - program.insert(ip + 1, memory[ptr]) - elif instr == 4: # Moo - print/read char - if memory[ptr] == 0: - if input_pos < len(input_data): - memory[ptr] = ord(input_data[input_pos]) - input_pos += 1 - else: - output.append(chr(memory[ptr] % 256)) - elif instr == 5: # MOo - mem-- - memory[ptr] -= 1 - elif instr == 6: # MoO - mem++ - memory[ptr] += 1 - elif instr == 7: # MOO - loop start - if memory[ptr] == 0: - depth = 1 - ip += 1 - while ip < len(program) and depth > 0: - if program[ip] == 7: depth += 1 - elif program[ip] == 0: depth -= 1 - if depth > 0: ip += 1 - elif instr == 8: # OOO - clear memory - memory[ptr] = 0 - elif instr == 9: # MMM - register/restore - if memory[ptr] == 0: - register = ip - elif register is not None: - ip = register - register = None - elif instr == 10: # OOM - print number - output.append(str(memory[ptr])) - elif instr == 11: # oom - read number - # Skip for now - pass - - ip += 1 - - return ''.join(output) - -# ============================================================================ -# COW Programs (pre-compiled for common SSG tasks) -# ============================================================================ - -# "Hello" in COW (generates the word Hello) -COW_HELLO = """ -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo -moO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo -MoO MoO MoO MoO MoO MoO MoO Moo -Moo -moO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO -MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo -""" - -# ============================================================================ -# Frontmatter & Markdown Parser -# ============================================================================ - -@dataclass -class Frontmatter: - title: str = "" - date: str = "" - tags: List[str] = field(default_factory=list) - draft: bool = False - template: str = "default" - -def parse_frontmatter(content: str) -> Tuple[Frontmatter, str]: - """Parse YAML frontmatter from content.""" - lines = content.split('\n') - if not lines or lines[0].strip() != '---': - return Frontmatter(), content - - fm = Frontmatter() - body_start = 1 - for i, line in enumerate(lines[1:], 1): - if line.strip() == '---': - body_start = i + 1 - break - if ':' in line: - key, value = line.split(':', 1) - key, value = key.strip(), value.strip() - if key == 'title': - fm.title = value - elif key == 'date': - fm.date = value - elif key == 'draft': - fm.draft = value.lower() in ('true', 'yes') - elif key == 'tags': - if value.startswith('['): - fm.tags = [t.strip().strip('"\'') for t in value[1:-1].split(',')] - else: - fm.tags = [t.strip() for t in value.split(',')] - - return fm, '\n'.join(lines[body_start:]) - -def escape_html(s: str) -> str: - return s.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"') - -def parse_markdown(content: str) -> str: - """Simple markdown to HTML conversion.""" - html = [] - in_code = False - in_para = False - in_list = False - - for line in content.split('\n'): - stripped = line.strip() - - # Code blocks - if stripped.startswith('```'): - if in_code: - html.append('') - in_code = False - else: - if in_para: - html.append('
') - in_para = False - if in_list: - html.append('') - in_list = False - html.append('')
- in_code = True
- continue
-
- if in_code:
- html.append(escape_html(line))
- continue
-
- # Empty line
- if not stripped:
- if in_para:
- html.append('')
- in_para = False
- if in_list:
- html.append('')
- in_list = False
- continue
-
- # Headers
- for i in range(6, 0, -1):
- prefix = '#' * i + ' '
- if stripped.startswith(prefix):
- if in_para:
- html.append('')
- in_para = False
- content_text = process_inline(stripped[i+1:].strip())
- html.append(f'{content_text} ')
- break
- else:
- # List items
- if stripped.startswith('- ') or stripped.startswith('* '):
- if in_para:
- html.append('')
- in_para = False
- if not in_list:
- html.append('')
- in_list = True
- item = process_inline(stripped[2:].strip())
- html.append(f'- {item}
')
- else:
- # Paragraph
- if not in_para:
- html.append('')
- in_para = True
- else:
- html.append(' ')
- html.append(process_inline(stripped))
-
- if in_para:
- html.append('
')
- if in_list:
- html.append('
')
- if in_code:
- html.append('')
-
- return '\n'.join(html)
-
-def process_inline(text: str) -> str:
- """Process inline markdown formatting."""
- # Bold
- text = re.sub(r'\*\*(.+?)\*\*', r'\1', text)
- # Italic
- text = re.sub(r'\*(.+?)\*', r'\1', text)
- # Code
- text = re.sub(r'`(.+?)`', r'\1', text)
- return text
-
-# ============================================================================
-# Template Engine
-# ============================================================================
-
-DEFAULT_TEMPLATE = '''
-
-
-
-
-{{cow_greeting}}
-')
- in_code = True
- continue
-
- if in_code:
- html.append(escape_html(line))
- continue
-
- # Empty line
- if not stripped:
- if in_para:
- html.append('')
- in_para = False
- if in_list:
- html.append('')
- in_list = False
- continue
-
- # Headers
- for i in range(6, 0, -1):
- prefix = '#' * i + ' '
- if stripped.startswith(prefix):
- if in_para:
- html.append('')
- in_para = False
- content_text = process_inline(stripped[i+1:].strip())
- html.append(f'{content_text} ')
- break
- else:
- # List items
- if stripped.startswith('- ') or stripped.startswith('* '):
- if in_para:
- html.append('')
- in_para = False
- if not in_list:
- html.append('')
- in_list = True
- item = process_inline(stripped[2:].strip())
- html.append(f'- {item}
')
- else:
- # Paragraph
- if not in_para:
- html.append('')
- in_para = True
- else:
- html.append(' ')
- html.append(process_inline(stripped))
-
- if in_para:
- html.append('
')
- if in_list:
- html.append('
')
- if in_code:
- html.append('')
-
- return '\n'.join(html)
-
-def process_inline(text: str) -> str:
- """Process inline formatting."""
- text = re.sub(r'\*\*(.+?)\*\*', r'\1', text)
- text = re.sub(r'\*(.+?)\*', r'\1', text)
- text = re.sub(r'`(.+?)`', r'\1', text)
- return text
-
-# ============================================================================
-# Template Engine
-# ============================================================================
-
-DEFAULT_TEMPLATE = '''
-
-
-
-
-