mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-03-25 05:20:52 +00:00
- Add colored terminal output support (GREEN, YELLOW, BLUE, NC) - Introduce `help` target to document all Makefile targets - Enhance `bump-version` to accept VERSION env var for manual version setting - Refactor jjpush: split into modular targets (jjpush-notes, jjpush-push, jjpush-tag) - Replace orla with aichat for AI-powered release notes generation - Add robust JSON parsing using Python for release notes extraction - Use stakk for PR submission (replacing raw `jj git push`) - Generate and store release notes in temp files for tag creation - Add installation instructions to release tags - Update .PHONY with new targets 4.4.20: Rope-based parsing, improved release tooling, and bug fixes ### Enhancements - **Rope-based parsing**: Added direct rope parsing for FASTA, EMBL, and FASTQ formats via `FastaChunkParserRope`, `EmblChunkParserRope`, and `FastqChunkRope` functions, eliminating unnecessary memory allocation via Pack(). Sequence extraction now supports U→T conversion and improved line ending detection. - **Rope scanner refactoring**: Unified rope scanning logic under a new `ropeScanner`, improving maintainability and consistency across parsers. - **Sequence handling**: Added `TakeQualities()` method to BioSequence for more efficient quality data handling. ### Bug Fixes - **Compression behavior**: Fixed CompressStream to correctly use the `compressed` variable instead of a hardcoded boolean. - **String splitting**: Replaced ambiguous `SplitInTwo` calls with precise `LeftSplitInTwo` or `RightSplitInTwo`, and added dedicated right-split utility. ### Tooling & Workflow Improvements - **Makefile enhancements**: Added colored terminal output, a `help` target for documenting all targets, and improved release workflow automation. - **Release process**: Refactored `jjpush` into modular targets (`jjpush-notes`, `jjpush-push`, `jjpush-tag`), replaced `orla` with `aichat` for AI-assisted release notes, and introduced robust JSON parsing using Python. Release notes are now generated and stored in temp files for tag creation. - **Versioning**: `bump-version` now supports the VERSION environment variable for manual version setting. - **Submission**: Switched from raw `jj git push` to `stakk` for PR submission. ### Internal Notes - Installation instructions are now included in release tags. - Fixed-size carry buffer replaced with dynamic slice for arbitrarily long line support without extra allocations.
37 lines
695 B
Python
Executable File
37 lines
695 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Read potentially malformed JSON from stdin (aichat output), extract title and
|
|
body, and print them as plain text: title on first line, blank line, then body.
|
|
Exits with 1 on failure (no output).
|
|
"""
|
|
|
|
import sys
|
|
import json
|
|
import re
|
|
|
|
text = sys.stdin.read()
|
|
|
|
m = re.search(r'\{.*\}', text, re.DOTALL)
|
|
if not m:
|
|
sys.exit(1)
|
|
|
|
s = m.group()
|
|
obj = None
|
|
|
|
try:
|
|
obj = json.loads(s)
|
|
except Exception:
|
|
s2 = re.sub(r'(?<!\\)\n', r'\\n', s)
|
|
try:
|
|
obj = json.loads(s2)
|
|
except Exception:
|
|
sys.exit(1)
|
|
|
|
title = obj.get('title', '').strip()
|
|
body = obj.get('body', '').strip()
|
|
|
|
if not title or not body:
|
|
sys.exit(1)
|
|
|
|
print(f"{title}\n\n{body}")
|