Extract the shell-syntax scanner from parse-command.ts into its own module

Abierto
#2,466 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
44/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

Read src/shared/parse-command.ts, focusing on scanShellSyntax, skipHeredoc, walkBodyPayloads, and the placeholder and line-continuation helpers; use PR #2068 for context. Extract the scanner and its private helpers into src/shared/parse-command-scanner.ts, making their shared state explicit. Run the existing test suite; done when it passes without assertion changes and parseCommand's exported contract is unchanged.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

scanShellSyntax in src/shared/parse-command.ts is roughly two thirds of the file — 2,150 of 3,230 lines — and its two largest pieces, skipHeredoc and walkBodyPayloads, are inner closures that share mutable scanner state. Moving it into a module of its own would let each rule be read and tested on its own.

  • Move scanShellSyntax and the helpers only it uses (skipHeredoc, walkBodyPayloads, the placeholder and line-continuation helpers) into e.g. src/shared/parse-command-scanner.ts, leaving parseCommand and the tokenizer as its only consumer.
  • Make the state the two closures share explicit at the boundary — which quote or substitution the scanner is inside, the results collected so far, the nesting depth — passed or returned as a named object instead of captured.
  • Change no behavior: parseCommand's exported contract stays as is, and the existing test suite stays green with no assertion changes.

Context: PR #2068 (https://github.com/Zoo-Code-Org/Zoo-Code/pull/2068), commit b193815dddcd6e82e80bf31bc5ea84dd15bd48e4.

Lenguaje dominante
TypeScript
Estrellas
2k
Forks
301
Merge medio
3 d 14 h
PR fusionados (30 d)
103

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Zoo-Code-Org/Zoo-Code

Todos los issues de Zoo-Code-Org/Zoo-Code

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.