ast.ts 1.0 KB

1234567891011121314151617181920212223
  1. /**
  2. * The parsed command line, as this shell names it.
  3. *
  4. * `@yarnpkg/parsers` re-exports only part of its grammar's type map from the
  5. * package root, and its `exports` field forbids reaching the grammar module
  6. * directly, so the three missing members are derived from the ones it does
  7. * publish. `CommandChain` is `Command` plus an optional pipeline link, which
  8. * makes it usable wherever a command node is expected.
  9. * @module @deepseek-ai/dsh-experimental-webworker-runtime/src/shell/ast
  10. */
  11. import type { Argument, CommandChain } from '@yarnpkg/parsers'
  12. export type { ArgumentSegment, ArithmeticExpression, CommandChain, CommandLine, ShellLine } from '@yarnpkg/parsers'
  13. /** One command node: a program call, a subshell, a group, or bare assignments. */
  14. export type Command = CommandChain
  15. /** An argument that becomes argv fields. */
  16. export type ValueArgument = Extract<Argument, { type: 'argument' }>
  17. /** An argument that rewires a descriptor instead of becoming argv. */
  18. export type RedirectArgument = Extract<Argument, { type: 'redirection' }>