=== BEGIN ARTIFACT FEATURE-Output-Formats.md ===
# FEATURE: Output Formats
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide JSON conversion and jq output-format filters. |
| Depends On | FEATURE-String-Builtins.md, FEATURE-Json-IO.md |
| Provides | tostring, tojson, fromjson, @text, @json, @html, @uri, @urid, @csv, @tsv, @sh, @base64, @base64d |
| Consumes | string manipulation builtins, JSON serializer |
## Questions
- None.
## Intent
Implement conversion between jq values and JSON text, plus the required text, HTML, URI, CSV, TSV, shell, and base64 format filters. Preserve interpolation behavior and stream ordering.
## Programmatic Acceptance
=== AC text-002-conformance ===
Intent: The authoritative corpus cases covering JSON conversion and output-format filters pass.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"@text|@json|@html|@uri|@csv|@tsv|@sh|@base64|tojson|fromjson"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0
assert summary["error"] == 0
assert result.returncode == 0
=== END AC text-002-conformance ===
=== AC text-002-interface ===
Intent: The format-filter corpus slice executes through the candidate executable.
import json
import os
import subprocess
import sys
selector = r"@text|@json|@html|@uri|@csv|@tsv|@sh|@base64"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
assert report["summary"]["pass"] > 0
assert result.returncode == 0
=== END AC text-002-interface ===
## User Acceptance
- None.
## Guardrails
- Use only Python standard-library facilities.
- Preserve compact JSON values and one output per line.
- Do not modify staged scoring assets.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Regular-Expressions.md ===
# FEATURE: Regular Expressions
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq regular-expression matching and substitution filters. |
| Depends On | FEATURE-Output-Formats.md |
| Provides | test, match, capture, scan, splits, regex split, sub, gsub |
| Consumes | string manipulation builtins |
## Questions
- None.
## Intent
Implement the standard-library regular-expression surface required by the corpus, including supported flags, named and unnamed captures, Unicode offsets, streaming scans, splitting, and substitutions.
## Programmatic Acceptance
=== AC text-003-conformance ===
Intent: The authoritative corpus cases covering regular-expression filters pass.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"test\(|match\(|capture\(|scan\(|sub\(|gsub\("
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0
assert summary["error"] == 0
assert result.returncode == 0
=== END AC text-003-conformance ===
=== AC text-003-execution ===
Intent: The regex selector executes a non-empty corpus slice through jq.
import json
import os
import subprocess
import sys
selector = r"test\(|match\(|capture\(|scan\(|sub\(|gsub\("
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
assert report["summary"]["pass"] > 0
assert result.returncode == 0
=== END AC text-003-execution ===
## User Acceptance
- None.
## Guardrails
- Use only the Python standard library.
- Preserve generator multiplicity and match ordering.
- Keep diagnostics on stderr and do not alter staged sources.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Date-and-Time.md ===
# FEATURE: Date and Time
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq date parsing, formatting, and time conversion filters. |
| Depends On | FEATURE-Regular-Expressions.md |
| Provides | fromdateiso8601, todateiso8601, strptime, strftime, gmtime, localtime, mktime |
| Consumes | jq string and numeric values |
## Questions
- None.
## Intent
Implement UTC ISO-8601 conversion and the required low-level date and time filters using Python standard-library facilities. Support supplied valid and invalid-input behavior and the fixed interface's deterministic timezone expectations.
## Programmatic Acceptance
=== AC text-004-conformance ===
Intent: The authoritative corpus cases covering date and time filters pass.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"date|strftime|strptime|gmtime|mktime"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0
assert summary["error"] == 0
assert result.returncode == 0
=== END AC text-004-conformance ===
=== AC text-004-execution ===
Intent: The date and time selector executes a non-empty corpus slice through jq.
import json
import os
import subprocess
import sys
selector = r"date|strftime|strptime|gmtime|mktime"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
assert report["summary"]["pass"] > 0
assert result.returncode == 0
=== END AC text-004-execution ===
## User Acceptance
- None.
## Guardrails
- Use UTC for ISO date behavior and the supplied fixed interface.
- Use only Python standard-library facilities.
- Do not introduce wall-clock-dependent assertions or runtime dependencies.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Input-Streams.md ===
# FEATURE: Input Streams
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq controls for consuming additional JSON input values. |
| Depends On | FEATURE-Date-and-Time.md, FEATURE-Json-IO.md |
| Provides | input, inputs, input_filename, input_line_number |
| Consumes | executable JSON input boundary |
## Questions
- None.
## Intent
Implement `input` and `inputs` over the fixed stdin interface, preserving the distinction between the initially filtered value and remaining values. Provide the available filename and line-number metadata without adding unsupported command-line options.
## Programmatic Acceptance
=== AC io-001-conformance ===
Intent: The authoritative corpus cases covering input-stream controls pass.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"input|inputs"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0
assert summary["error"] == 0
assert result.returncode == 0
=== END AC io-001-conformance ===
=== AC io-001-execution ===
Intent: The input-stream selector executes a non-empty corpus slice through jq.
import json
import os
import subprocess
import sys
selector = r"input|inputs"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
assert report["summary"]["pass"] > 0
assert result.returncode == 0
=== END AC io-001-execution ===
## User Acceptance
- None.
## Guardrails
- Do not add command-line options beyond the fixed `-c` interface.
- Preserve input ordering and stream multiplicity.
- Use only the supplied stdin boundary and standard-library runtime.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Diagnostics.md ===
# FEATURE: Diagnostics
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq diagnostic, stderr, and halt-error filters. |
| Depends On | FEATURE-Input-Streams.md, FEATURE-Process-Contract.md |
| Provides | debug, stderr, halt_error |
| Consumes | process exit and diagnostic behavior |
## Questions
- None.
## Intent
Implement diagnostic filters that write to stderr, preserve stdout values, and terminate with the required status behavior. `debug` must retain the input stream, `stderr` must emit raw diagnostic data, and `halt_error` must stop processing with its requested exit code.
## Programmatic Acceptance
=== AC io-002-conformance ===
Intent: The authoritative corpus cases covering diagnostics and stderr behavior pass.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"debug|stderr|halt_error"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0
assert summary["error"] == 0
assert result.returncode == 0
=== END AC io-002-conformance ===
=== AC io-002-execution ===
Intent: The diagnostics selector executes a non-empty corpus slice through jq.
import json
import os
import subprocess
import sys
selector = r"debug|stderr|halt_error"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
assert report["summary"]["pass"] > 0
assert result.returncode == 0
=== END AC io-002-execution ===
## User Acceptance
- None.
## Guardrails
- Diagnostics must not be used as the output oracle.
- Preserve stdout values emitted before runtime termination.
- Keep diagnostic output on stderr and use only standard-library facilities.
=== END ARTIFACT ===Run artifact