feat: add native HCL runtime and deps #8
Merged
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.
Summary
Testing
go test ./...Prompt
🗂️ Story Card – “Native-HCL Runtime, Blocks-only Vars/Env, Array Deps, Built-ins, E2E Test”
Hand this directly to Codex. It contains requirements, expectations, and acceptance tests only — no code skeletons, no file-layout mandates (except for the single test-data directory).
📌 Goal
Deliver full HCL Taskfile support such that:
Block syntax only for variables and environment:
Both root-level and inside each
taskblock.Dependencies are expressed as an ordered list (array) – not a map:
– The list order is respected during execution.
– Each entry is either a bare task reference or
task(name, vars)expression.All interpolation uses native HCL expressions:
echo "${upper(vars.FOO)} - ${env.PATH}"– Variable access is always
vars.Xorenv.Y.Runtime HCL evaluation provides built-in functions:
sh(cmd)/bin/sh -c cmd, return trimmed stdoutbash(cmd)/bin/bash -c cmdzsh(cmd)/bin/zsh -c cmdtask(name, vars?)**Go-template (
{{ }}) syntax is invalid inside HCL files.🛠️ Functional Requirements & Expectations
vars {}andenv {}only (attribute formvars = {}must raise parse error).depsattribute must decode as ordered list of HCL expressions.varsandenvobjects and the built-ins above.${vars.FOO}orupper(vars.FOO)evaluates to the current value.shsh("echo hi")returns"hi"(newline trimmed). Non-zero exit → task fails with clear message."hi"; failure path triggers task error.tasktask("build")runs the task before returning. Returned string equals that task’s combined stdout. Overrides passed via second arg apply only to that invocation.deps = [task("one"), task("two")], Task “one” executes before “two”.vars.Xandenv.Yare the only legal references. AccessingFOOor.FOOdirectly must fail eval.${FOO}➜ evaluation error.{{ .FOO }}in HCL raises parse error.🧪 Required Tests
Taskfile.hclin HCLE2ETest – must demonstrate:Root
vars { ORIGINAL = "foo" }Root
env { PATH_COPY = env("PATH") }Task
build:Task
lintwith var override viatask():Task
all:Integration test (
TestHCLE2E):Run
task -t testdata/HCLE2ETest/Taskfile.hcl all.Assertions (order matters):
BUILD:1.2.3ONE-DONEbeforeTWO-DONELINT MODE fastFINAL fooPATH=plus a non-empty valueUnit tests (examples, not code):
TestBlockSyntaxEnforced: file usingvars = {}returns parse error.TestShFunctionSuccess/TestShFunctionFail.TestTaskFunctionStdoutCapture.TestInvalidReference:${FOO}raises evaluation error.TestTemplateSyntaxRejected:{{ .FOO }}in HCL raises parse error.📎 General Guidance for Codex
go test ./...passes and prints the HCLE2ETest markers in correct order.No further implementation details or file names are prescribed beyond the test-data directory above.
https://chatgpt.com/codex/tasks/task_e_68921dd450d08330945d7ec60c6a40aa