Run artifact

workspace/targets/jq/ANALYSIS.md

Blueprint Analysis: drydock jq Uat Kit

Commander Expectations

Crew

CrewCharge
CommanderDefines intent and decides what done means.
Team LeadConfirms epic completeness and stakeholder expectations.
Planning CrewAuthors atomic specifications and the ordered Manifest.
Shipyard CrewBuilds the tickets without synchronous Commander access.

Story List

Feature: Executable Interface

IDStoryHigh-level AC
EXEC-001Implement executable jq entry point./jq -c '<program>' reads JSON stdin and emits compact JSON values line by line.
EXEC-002Implement process exit and diagnostic contractCompile failures exit 3, runtime failures exit 5, successful completion exits 0, and diagnostics use stderr.
EXEC-003Implement JSON input and output handlingMultiple input values, Unicode, special numeric values, and compact serialization are handled as required by the corpus.

Feature: Lexer and Parser

IDStoryHigh-level AC
PARSE-001Implement jq lexical scanningKeywords, identifiers, fields, bindings, literals, operators, comments, formats, and delimiters tokenize according to the supplied lexer specification.
PARSE-002Implement literals and string interpolationJSON escapes, Unicode, formatted strings, and \(expression) interpolation parse and evaluate correctly.
PARSE-003Implement filter expression grammarPipes, commas, precedence, indexing, slicing, arrays, objects, unary operators, and optional expressions compile correctly.
PARSE-004Implement declarations and control syntaxdef, imports/module grammar, conditionals, try/catch, reductions, foreach, labels, bindings, and destructuring syntax compile correctly, including required rejection cases.

Feature: Generator Evaluation Core

IDStoryHigh-level AC
CORE-001Implement stream-valued filter evaluationEvery filter evaluates as a generator with zero, one, or many outputs, preserving order and backtracking.
CORE-002Implement composition and cartesian evaluationPipes, commas, function arguments, array collection, object construction, and binary operators evaluate all required output combinations.
CORE-003Implement empty, errors, and optional evaluationempty, runtime errors, ?, try, and partial output before runtime failure follow jq semantics.
CORE-004Implement truthiness and comparison semanticsOnly false and null are falsey; equality and ordering follow jq's type ordering and numeric equivalence.

Feature: Values and Accessors

IDStoryHigh-level AC
VALUE-001Implement JSON value modelNull, booleans, numbers, strings, arrays, objects, NaN, and infinities are represented and processed as jq values.
VALUE-002Implement field and index accessObject fields, array indices, object values, optional access, negative indices, and missing values behave as specified.
VALUE-003Implement slices and iterationArray/string slices, iteration over arrays and objects, optional iteration, fractional bounds, and out-of-range behavior conform.
VALUE-004Implement type and numeric primitivestype, length, utf8bytelength, numeric predicates, conversion functions, arithmetic primitives, and math functions conform.

Feature: Operators and Control Flow

IDStoryHigh-level AC
FLOW-001Implement arithmetic and structural operators+, -, *, /, %, unary negation, recursive object merge, string repetition, and string splitting conform.
FLOW-002Implement boolean and alternative operatorsand, or, not, //, and //= preserve generator and short-circuit semantics.
FLOW-003Implement conditionals and exception flowif, elif, else, try, catch, and optional operators preserve branch streams and errors.
FLOW-004Implement labels and breaksLexically scoped label and break terminate the correct generator without leaking outputs.
FLOW-005Implement reductions and iteration controlreduce, foreach, range, limit, skip, first, last, and nth preserve state and backtracking.
FLOW-006Implement recursive generatorswhile, until, repeat, recurse, and recursive user functions operate correctly without incorrect termination.

Feature: Variables and Functions

IDStoryHigh-level AC
FUNC-001Implement lexical variable bindingsas bindings, nested scope, shadowing, keyword identifiers, and value lifetime conform.
FUNC-002Implement filter and value function parametersUser-defined functions support filter parameters, value parameters, multiple arities, closures, and cartesian arguments.
FUNC-003Implement function definitions and recursionDefinitions, redefinitions, lexical function scope, recursion, and forward/self references conform.
FUNC-004Implement destructuring patterns and alternativesArray/object patterns, missing bindings, ?//, and fallback binding behavior conform.

Feature: Paths and Assignment

IDStoryHigh-level AC
PATH-001Implement path discovery and projectionpath, paths, pick, and path expressions produce valid paths and projections.
PATH-002Implement path access and mutation primitivesgetpath, setpath, and delpaths create, update, read, and delete nested structures correctly.
PATH-003Implement deletion and assignment operatorsdel, =, `=`, arithmetic assignments, defined-or assignment, and multi-path behavior conform.
PATH-004Implement complex assignment edge casesIterated paths, empty updates, array expansion, invalid paths, negative indices, NaN indices, and depth limits conform.

Feature: Collections and Data Transformation

IDStoryHigh-level AC
DATA-001Implement collection transformation builtinsmap, map_values, select, add, flatten, transpose, combinations, and walk conform.
DATA-002Implement sorting and grouping builtinssort, sort_by, group_by, unique, unique_by, min, max, and keyed variants conform.
DATA-003Implement object-entry and containment builtinskeys, keys_unsorted, has, in, inside, contains, to_entries, from_entries, and with_entries conform.
DATA-004Implement index and membership utilitiesindices, index, rindex, bsearch, all, any, isempty, and SQL-style IN conform.

Feature: Strings, Formats, and Regular Expressions

IDStoryHigh-level AC
TEXT-001Implement string manipulation builtinsTrimming, prefix/suffix operations, case conversion, explode/implode, split, join, and interpolation conform.
TEXT-002Implement JSON and output format filterstostring, tojson, fromjson, @text, @json, @html, @uri, @urid, @csv, @tsv, @sh, @base64, and @base64d conform.
TEXT-003Implement regular-expression filterstest, match, capture, scan, split, splits, sub, and gsub support required flags, captures, offsets, and streams.
TEXT-004Implement date and time filtersISO dates, strptime, strftime, gmtime, localtime, and mktime conform for supplied cases.

Feature: I/O and Streaming

IDStoryHigh-level AC
IO-001Implement input stream controlsinput, inputs, input_filename, and input_line_number conform within the fixed interface.
IO-002Implement diagnostics and stderr outputdebug, stderr, and halt_error produce the specified output channels and exit behavior.
IO-003Implement streaming transformationstostream, fromstream, and truncate_stream conform for supplied streaming values.

Feature: Conformance Delivery

IDStoryHigh-level AC
CONF-001Stage immutable conformance assetsThe supplied manual, corpus, parser/lexer references, builtin reference, exclusions, runner, and full-test script are available at their required build paths without modification.
CONF-002Run scoped implementation verificationEach implementation slice can be exercised through run_conformance.py --select with JQ set to the candidate executable.
CONF-003Pass the complete conformance corpusOne terminal verification runs sh sources/full_test.sh unfiltered and exits zero with no failed or errored cases.

Story Guidance

Named stories planning must produce. Authoritative record: STORY_GUIDANCE.json.

Story IDProvenanceGateNote
EXEC-001plan`python3 sources/run_conformance.py --select ^(truefalsenull1)$`Build Instructions: interface contract
PARSE-001plan`python3 sources/run_conformance.py --select ^(truefalsenull1\.)$`lexer.l
PARSE-002plan`python3 sources/run_conformance.py --select interpolation@base64@uri`lexer.l and jq.test string/format cases
PARSE-003plan`python3 sources/run_conformance.py --select \.\[\{\+\-\*/%`parser.y expression grammar
PARSE-004plan`python3 sources/run_conformance.py --select %%FAILiftryreduceforeachdefaslabelmoduleinclude`parser.y declarations and control grammar
CORE-001plan`python3 sources/run_conformance.py --select \.,\[\.\]rangeempty`Build Instructions: generator core
CORE-002plan`python3 sources/run_conformance.py --select \,\[\{`jq-manual.txt generator semantics
CORE-003plan`python3 sources/run_conformance.py --select tryerror\?`jq-manual.txt error and optional semantics
CORE-004plan`python3 sources/run_conformance.py --select ==!=<=>=<>`jq-manual.txt comparison and truthiness
VALUE-001plan`python3 sources/run_conformance.py --select naninfinitetojsonfromjson`jq-manual.txt types and numeric values
VALUE-002plan`python3 sources/run_conformance.py --select \.[A-Za-z]\[[-0-9]`jq-manual.txt accessors
VALUE-003plan`python3 sources/run_conformance.py --select \[.*:\.\[\]`jq-manual.txt slices and iteration
VALUE-004plan`python3 sources/run_conformance.py --select lengthtypesqrtfloortonumber`jq-manual.txt types and numeric builtins
FLOW-001plan`python3 sources/run_conformance.py --select \+\-\*/%`jq-manual.txt builtin operators
FLOW-002plan`python3 sources/run_conformance.py --select andornot//`jq-manual.txt conditionals and comparisons
FLOW-003plan`python3 sources/run_conformance.py --select iftry\?`jq-manual.txt conditionals and try-catch
FLOW-004plan`python3 sources/run_conformance.py --select labelbreak`jq-manual.txt breaking out of control structures
FLOW-005plan`python3 sources/run_conformance.py --select reduceforeachlimitskipnthfirstlast`jq-manual.txt advanced generators
FLOW-006plan`python3 sources/run_conformance.py --select whileuntilrecurserepeat`jq-manual.txt recursive generators
FUNC-001plan`python3 sources/run_conformance.py --select as \$\$[A-Za-z]`jq-manual.txt variable binding
FUNC-002planpython3 sources/run_conformance.py --select def .*\(jq-manual.txt defining functions
FUNC-003planpython3 sources/run_conformance.py --select defjq-manual.txt function scoping and recursion
FUNC-004plan`python3 sources/run_conformance.py --select \?//as \{`jq-manual.txt destructuring alternatives
PATH-001plan`python3 sources/run_conformance.py --select path\(pathspick\(`jq-manual.txt paths
PATH-002plan`python3 sources/run_conformance.py --select getpathsetpathdelpaths`jq-manual.txt path primitives
PATH-003plan`python3 sources/run_conformance.py --select =\=\+=`jq-manual.txt assignment
PATH-004plan`python3 sources/run_conformance.py --select negativeNaNdepthempty`jq.test assignment edge cases
DATA-001plan`python3 sources/run_conformance.py --select mapflattentransposecombinationswalk`builtin.jq collection utilities
DATA-002plan`python3 sources/run_conformance.py --select sortgroup_byuniqueminmax`jq-manual.txt collection ordering
DATA-003plan`python3 sources/run_conformance.py --select keyshas\(containsinsideto_entriesfrom_entries`jq-manual.txt object and containment builtins
DATA-004plan`python3 sources/run_conformance.py --select indicesindex\(rindexbsearchanyallIN\(`builtin.jq generic iterator and membership utilities
TEXT-001plan`python3 sources/run_conformance.py --select splitjointrimascii_explodeimplodestartswithendswith`jq-manual.txt string builtins
TEXT-002plan`python3 sources/run_conformance.py --select @text@json@html@uri@csv@tsv@sh@base64`jq-manual.txt format strings and escaping
TEXT-003plan`python3 sources/run_conformance.py --select test\(match\(capture\(scan\(sub\(gsub\(`jq-manual.txt regular expressions
TEXT-004plan`python3 sources/run_conformance.py --select datestrftimestrptimegmtimemktime`jq-manual.txt dates
IO-001plan`python3 sources/run_conformance.py --select inputinputs`jq-manual.txt I/O
IO-002plan`python3 sources/run_conformance.py --select debugstderrhalt_error`jq-manual.txt diagnostics
IO-003plan`python3 sources/run_conformance.py --select tostreamfromstreamtruncate_stream`jq-manual.txt streaming
CONF-001planpython3 sources/run_conformance.py --listBuild Instructions: source roles and staged assets
CONF-002planpython3 sources/run_conformance.py --select reduceBuild Instructions: scoped verification
CONF-003plansh sources/full_test.shSea Trials and definition of done

Surfaced Acceptance Criteria

IDStory IDCriterion
AC-001EXEC-001The executable is named jq, is executable at the application root, and accepts only the exercised -c interface.
AC-002EXEC-003Output comparison preserves value order and emits one JSON value per output line.
AC-003PARSE-004Module syntax is parsed sufficiently to reject invalid module grammar without loading excluded module fixtures.
AC-004CONF-001Read-only scoring assets remain byte-for-byte unchanged and all staged runtime dependencies are present.
AC-005CONF-002Scoped checks use a selector matching the story's construct and never use the unscoped full corpus before the terminal story.

Source Inventory

PathContent kindDispositionReason
sources/INSTRUCTIONS.mdmarkdownanalyzedreadable UTF-8
sources/builtin.jqtextanalyzedreadable UTF-8
sources/exclusions.txttextanalyzedreadable UTF-8
sources/full_test.shcodeanalyzedreadable UTF-8
sources/jq-manual.txttextchunkedsplit into 11 bounded chunks
sources/jq.testtextchunkedsplit into 5 bounded chunks
sources/lexer.ltextanalyzedreadable UTF-8
sources/parser.ytextanalyzedreadable UTF-8
sources/run_conformance.pycodeanalyzedreadable UTF-8

Relationship Model

Source or groupRelationship typeRelated source or groupEvidenceDelivery implication
sources/lexer.lparser-to-normalizersources/parser.yLexer tokens and parser productions define the language front end.Build lexer behavior before parser execution.
sources/parser.yinstruction-to-testsources/jq.testGrammar and precedence are exercised by syntax and %%FAIL cases.Parser stories require focused corpus slices.
sources/jq-manual.txtreference-to-replacementimplementation storiesManual defines filter semantics and builtin behavior.Use as normative behavior reference.
sources/builtin.jqreference-to-replacementDATA, TEXT, FLOW, PATH, IO storiesReference definitions specify many builtin compositions.Implement the generator core before these builtins.
sources/jq.testtest-kit-to-implementationjqCorpus supplies program, input, and expected output cases.Stage unchanged and execute through the harness.
sources/run_conformance.pytest-kit-to-implementationjqRunner invokes JQ -c program and checks exit/output semantics.Preserve the executable interface and scoped verification.
sources/full_test.shtest-kit-to-implementationsources/run_conformance.pyFull script checks executable presence and delegates the complete run.Reserve for the terminal acceptance story and Sea Trial.
sources/exclusions.txttest-kit-to-implementationsources/jq.testExclusions identify module-loader cases by exact program text.Apply skips through the supplied harness only.
sources/INSTRUCTIONS.mdinstruction-to-testall implementation and conformance storiesBuild order, prohibitions, interface, and definition of done are explicit.Treat as author intent and project guardrails.

Source Roles

PathRolePlan dispositionBuild disposition
sources/INSTRUCTIONS.mdauthor intentcompassprompt-only
sources/jq-manual.txtnormative specificationcontextstage
sources/jq.testnormative specification and conformance test suitecontextstage
sources/parser.ynormative specificationcontextstage
sources/lexer.lnormative specificationcontextstage
sources/builtin.jqreference implementationcontextstage
sources/run_conformance.pyconformance harnesscontextstage
sources/full_test.shconformance harnesscontextstage
sources/exclusions.txtconformance harnesscontextstage

Planning Instructions

Delivery Shape

Deliver a standalone executable Python jq interpreter. It parses a jq filter, evaluates it over JSON input as an ordered stream of values, and writes compact JSON outputs. The execution flow is lexer/parser, AST or equivalent intermediate representation, generator evaluator, builtin/function runtime, and CLI serialization. The staged conformance runner drives one process per corpus case; excluded module-loader cases are skipped by the supplied exclusion list.

Story Realization Map

Story IDsDurable Blueprint scopeEvidenceRelated filesDelivery kind
EXEC-001–003executable CLI and JSON process boundarysources/INSTRUCTIONS.md, sources/run_conformance.pyjqcapability and acceptance contract
PARSE-001–004lexer, parser, syntax diagnosticssources/lexer.l, sources/parser.y, sources/jq.testjqcapability
CORE-001–004stream evaluator and runtime errorssources/INSTRUCTIONS.md, sources/jq-manual.txtjqcapability
VALUE-001–004value model, accessors, numeric behaviorsources/jq-manual.txt, sources/jq.testjqcapability
FLOW-001–006operators and control constructssources/builtin.jq, sources/parser.y, sources/jq.testjqcapability
FUNC-001–004bindings, functions, patternssources/parser.y, sources/jq.testjqcapability
PATH-001–004paths and immutable updatessources/jq-manual.txt, sources/jq.testjqcapability
DATA-001–004collection and relational builtinssources/builtin.jq, sources/jq-manual.txtjqcapability
TEXT-001–004strings, formats, regex, datessources/builtin.jq, sources/jq-manual.txtjqcapability
IO-001–003input, diagnostics, streamingsources/jq-manual.txt, sources/jq.testjqcapability
CONF-001–003staged assets, scoped runner use, terminal verificationsources/INSTRUCTIONS.md, sources/run_conformance.py, sources/full_test.shsources/*test harness and acceptance contract

Test and Acceptance Strategy

Implementation stories use focused sources/run_conformance.py --select slices matching their construct. Parser stories also exercise the supplied %%FAIL cases. No intermediate story runs full_test.sh or the unscoped runner. CONF-003 is the sole terminal full-suite story and declares Suite: full; it depends on all implementation stories and asserts only the full harness exit status. Sea Trial st-001 proves the same complete corpus requirement.

Sequencing and Dependencies

Build the executable boundary first, then lexer/parser, then generator evaluation and value semantics. Implement paths and assignment after accessors and generators. Add control flow and functions before higher-level builtins. Implement collection, text, regex, date, I/O, and streaming groups afterward. Stage all assets before acceptance execution. The terminal full-suite verification is last and depends on every implementation story. No external service or package dependency exists.

Source Conflicts and Gaps

No unresolved cross-source conflicts or blockers were found. The fixed Python standard-library runtime, executable contract, complete-corpus gate, excluded module-loader cases, and forbidden third-party implementations are consistent across the supplied instructions, harness, corpus, manual, lexer, parser, and builtin reference.

Analysis Notes

generated: 2026-08-22T00:00:00Z blueprint: /mnt/c/Users/barlo/projects/drydock/uat/jq/runs/20260822.044627/workspace/targets/jq/blueprint

Quality: Ready blockers: 0 questions: 0 features: 10 stories: 42 stack: Python standard library display_name: not proposed short_description: not proposed

The project type is cli. The source-defined story breakdown is broad but remains below the 100-story blocker threshold. The 42-story decomposition follows the supplied implementation order and major manual/conformance domains.