Skip to content

chore: add execute command to cli - #418

Merged
nlopes merged 11 commits into
mainfrom
nlopes-add-acdc-execute
Sep 27, 2026
Merged

nlopes merged 11 commits into
mainfrom
nlopes-add-acdc-execute

Conversation

@nlopes

@nlopes nlopes commented Jul 3, 2026 •

Copy link
Copy Markdown
Owner

This is just the skeleton/harness for building #396.
Screenshot 2026-07-03 at 19 38 49

Closes #396.

@nlopes nlopes self-assigned this Jul 3, 2026
@nlopes nlopes added enhancement New feature or request cli labels Jul 3, 2026
@nlopes nlopes mentioned this pull request Jul 3, 2026
@nlopes
nlopes force-pushed the nlopes-add-acdc-execute branch from 2567e4b to c34545c Compare July 11, 2026 15:52
@nlopes
nlopes force-pushed the nlopes-add-acdc-execute branch from c34545c to f9d7159 Compare September 26, 2026 15:38
nlopes pushed a commit to jdc-pub/acdc that referenced this pull request Sep 26, 2026
Add the acdc-execute workspace library crate and replace the PR nlopes#418
execution scaffold's todo!() placeholders with working behavior behind
the acdc-cli `execute` feature.

acdc-execute discovers command blocks - listing or source blocks
carrying the `command` role and an explicit id - from a parsed document,
including blocks nested in sections, admonitions, container delimited
blocks, and list items, and blocks reached through `include::`. Commands
declare prerequisites with `deps="a, b"`; the command graph reports
duplicate ids, unknown dependencies, cycles, missing ids, non-listing
command blocks, and invalid ids, and yields execution queues in
topological order that preserves document order for independent
commands.

Scripts run as parser-verbatim listing content written to a temporary
file passed to the interpreter named by the block's `[source, <lang>]`
header (default `sh`), in the caller's working directory and
environment. A non-zero exit is a command failure; an unwritable script
or unspawning interpreter is an infrastructure failure.

`acdc execute` selects commands with exact `--id` and `--id-regex`
selectors (a union that includes transitive dependencies, each command
run at most once; no selectors selects everything), supports `--dry-run`,
`--exit-on-failure`, and `-S` parser safe mode, and reports missing
selectors and malformed command blocks as normal CLI diagnostics.

Assisted-by: Goose:glm-5.3-flash
@nlopes
nlopes force-pushed the nlopes-add-acdc-execute branch from f9d7159 to 16ba007 Compare September 26, 2026 16:51
nlopes pushed a commit to jdc-pub/acdc that referenced this pull request Sep 26, 2026
Add the acdc-execute workspace library crate and replace the PR nlopes#418
execution scaffold's todo!() placeholders with working behavior behind
the acdc-cli `execute` feature.

acdc-execute discovers command blocks - listing or source blocks
carrying the `command` role and an explicit id - from a parsed document,
including blocks nested in sections, admonitions, container delimited
blocks, and list items, and blocks reached through `include::`. Commands
declare prerequisites with `deps="a, b"`; the command graph reports
duplicate ids, unknown dependencies, cycles, missing ids, non-listing
command blocks, and invalid ids, and yields execution queues in
topological order that preserves document order for independent
commands.

Scripts run as parser-verbatim listing content written to a temporary
file passed to the interpreter named by the block's `[source, <lang>]`
header (default `sh`), in the caller's working directory and
environment. A non-zero exit is a command failure; an unwritable script
or unspawning interpreter is an infrastructure failure.

`acdc execute` selects commands with exact `--id` and `--id-regex`
selectors (a union that includes transitive dependencies, each command
run at most once; no selectors selects everything), supports `--dry-run`,
`--exit-on-failure`, and `-S` parser safe mode, and reports missing
selectors and malformed command blocks as normal CLI diagnostics.

Assisted-by: Goose:glm-5.3-flash
nlopes pushed a commit to jdc-pub/acdc that referenced this pull request Sep 27, 2026
Add the acdc-execute workspace library crate and replace the PR nlopes#418
execution scaffold's todo!() placeholders with working behavior behind
the acdc-cli `execute` feature.

acdc-execute discovers command blocks - listing or source blocks
carrying the `command` role and an explicit id - from a parsed document,
including blocks nested in sections, admonitions, container delimited
blocks, and list items, and blocks reached through `include::`. Commands
declare prerequisites with `deps="a, b"`; the command graph reports
duplicate ids, unknown dependencies, cycles, missing ids, non-listing
command blocks, and invalid ids, and yields execution queues in
topological order that preserves document order for independent
commands.

Scripts run as parser-verbatim listing content written to a temporary
file passed to the interpreter named by the block's `[source, <lang>]`
header (default `sh`), in the caller's working directory and
environment. A non-zero exit is a command failure; an unwritable script
or unspawning interpreter is an infrastructure failure.

`acdc execute` selects commands with exact `--id` and `--id-regex`
selectors (a union that includes transitive dependencies, each command
run at most once; no selectors selects everything), supports `--dry-run`,
`--exit-on-failure`, and `-S` parser safe mode, and reports missing
selectors and malformed command blocks as normal CLI diagnostics.

Assisted-by: Goose:glm-5.3-flash
@nlopes
nlopes force-pushed the nlopes-add-acdc-execute branch from 16ba007 to 129d5d8 Compare September 27, 2026 15:45
nlopes pushed a commit to jdc-pub/acdc that referenced this pull request Sep 27, 2026
Add the acdc-execute workspace library crate and replace the PR nlopes#418
execution scaffold's todo!() placeholders with working behavior behind
the acdc-cli `execute` feature.

acdc-execute discovers command blocks - listing or source blocks
carrying the `command` role and an explicit id - from a parsed document,
including blocks nested in sections, admonitions, container delimited
blocks, and list items, and blocks reached through `include::`. Commands
declare prerequisites with `deps="a, b"`; the command graph reports
duplicate ids, unknown dependencies, cycles, missing ids, non-listing
command blocks, and invalid ids, and yields execution queues in
topological order that preserves document order for independent
commands.

Scripts run as parser-verbatim listing content written to a temporary
file passed to the interpreter named by the block's `[source, <lang>]`
header (default `sh`), in the caller's working directory and
environment. A non-zero exit is a command failure; an unwritable script
or unspawning interpreter is an infrastructure failure.

`acdc execute` selects commands with exact `--id` and `--id-regex`
selectors (a union that includes transitive dependencies, each command
run at most once; no selectors selects everything), supports `--dry-run`,
`--exit-on-failure`, and `-S` parser safe mode, and reports missing
selectors and malformed command blocks as normal CLI diagnostics.

Assisted-by: Goose:glm-5.3-flash
jdc-pub and others added 10 commits September 27, 2026 21:03
Add the acdc-execute workspace library crate and replace the PR #418
execution scaffold's todo!() placeholders with working behavior behind
the acdc-cli `execute` feature.

acdc-execute discovers command blocks - listing or source blocks
carrying the `command` role and an explicit id - from a parsed document,
including blocks nested in sections, admonitions, container delimited
blocks, and list items, and blocks reached through `include::`. Commands
declare prerequisites with `deps="a, b"`; the command graph reports
duplicate ids, unknown dependencies, cycles, missing ids, non-listing
command blocks, and invalid ids, and yields execution queues in
topological order that preserves document order for independent
commands.

Scripts run as parser-verbatim listing content written to a temporary
file passed to the interpreter named by the block's `[source, <lang>]`
header (default `sh`), in the caller's working directory and
environment. A non-zero exit is a command failure; an unwritable script
or unspawning interpreter is an infrastructure failure.

`acdc execute` selects commands with exact `--id` and `--id-regex`
selectors (a union that includes transitive dependencies, each command
run at most once; no selectors selects everything), supports `--dry-run`,
`--exit-on-failure`, and `-S` parser safe mode, and reports missing
selectors and malformed command blocks as normal CLI diagnostics.

Assisted-by: Goose:glm-5.3-flash
Rename command metadata and source parsing terminology from shell or language to interpreter while documenting the direct executable contract. Preserve dry-run blank lines and improve command graph diagnostics and coverage.

Assisted-by: Goose:glm-5
Assisted-by: Goose:gpt-5.6-luna
Read the source interpreter from the parser's language attribute and handle
fallible options construction in the safe-mode test.

The current parser already preserves malformed command IDs. Its replacement
attribute scanner also makes the old grammar workaround unnecessary once
command discovery uses the language attribute.
Retain block bodies after preprocessing and before inline substitutions.
Expose block metadata and locations through inherent methods, removing
the private Locateable trait.

Resolve locations to original files and retain source recovery diagnostics
after warnings are consumed, so execution can reject incomplete input.

Fix escaped attribute references and empty values in textual substitution.
Reduce allocations in conditional parsing and substitution checks.

Co-authored-by: Codex <noreply@openai.com>
Discover commands in source order across nested blocks and table cells.
Prepare owned scripts from retained source, expanding attributes only
when enabled and using the values in scope at each command.

Reject incomplete input, missing attributes, duplicate IDs, unknown
dependencies, and cycles before execution. Build deterministic plans
that include prerequisites and borrow command data from the graph.

Return structured outcomes, skip failed dependents, and stop on
infrastructure errors or signal termination. Support child-specific
working directories and environment overrides.

Adapt existing CLI calls to the new library API to keep this commit
buildable; integrate execution reports and CLI options separately.

Co-authored-by: Codex <noreply@openai.com>
Use dependency-aware execution plans and structured outcomes in the CLI.
Keep exact-ID and regex selector unions and automatic prerequisites,
and add command listings, child working directories, and environment
overrides. Dry-run shows prepared scripts; failed prerequisites block
dependents, and stop-on-failure halts the remaining plan.

Report errors at their original source locations and cache source reads
across diagnostic batches. Document script substitution and execution
trust boundaries.

Forward parser features consistently and add execute library,
execute-only, and feature-unification coverage to CI.

Co-authored-by: Codex <noreply@openai.com>
Rename adoc to discovery and expose DiscoveryError directly. Keep each
module's implementation and tests in mod.rs, with error definitions in a
private error.rs. Use direct parser imports and update the README and
changelog.
Render --list entries as bullets with labeled ids, effective interpreters,
direct prerequisites, descriptions, and nearest section titles. Quote
metadata and escape control characters to keep each entry on one line.

Preserve section context through nested blocks and includes, and restore
the outer title after leaving a section inside a table cell.
@nlopes

nlopes commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

Current state of the execute command:
Screenshot 2026-09-27 at 21 04 33

@nlopes
nlopes merged commit abef9a3 into main Sep 27, 2026
12 checks passed
nlopes pushed a commit that referenced this pull request Sep 27, 2026
Add the acdc-execute workspace library crate and replace the PR #418
execution scaffold's todo!() placeholders with working behavior behind
the acdc-cli `execute` feature.

acdc-execute discovers command blocks - listing or source blocks
carrying the `command` role and an explicit id - from a parsed document,
including blocks nested in sections, admonitions, container delimited
blocks, and list items, and blocks reached through `include::`. Commands
declare prerequisites with `deps="a, b"`; the command graph reports
duplicate ids, unknown dependencies, cycles, missing ids, non-listing
command blocks, and invalid ids, and yields execution queues in
topological order that preserves document order for independent
commands.

Scripts run as parser-verbatim listing content written to a temporary
file passed to the interpreter named by the block's `[source, <lang>]`
header (default `sh`), in the caller's working directory and
environment. A non-zero exit is a command failure; an unwritable script
or unspawning interpreter is an infrastructure failure.

`acdc execute` selects commands with exact `--id` and `--id-regex`
selectors (a union that includes transitive dependencies, each command
run at most once; no selectors selects everything), supports `--dry-run`,
`--exit-on-failure`, and `-S` parser safe mode, and reports missing
selectors and malformed command blocks as normal CLI diagnostics.

Assisted-by: Goose:glm-5.3-flash
@nlopes
nlopes deleted the nlopes-add-acdc-execute branch September 27, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command Runner

2 participants