Commit Graph

22 Commits

Author SHA1 Message Date
hugocasa b66e038a0f feat: add support for validateset in pwsh (#7158) 2025-11-17 11:29:58 +00:00
hugocasa c16bef8f29 feat: add support for switch and attributes in pwsh params (#7143) 2025-11-14 17:28:54 +00:00
hugocasa 51cba95d39 fix(backend): improve pwsh param block parsing (#7096)
* fix(backend): replace regex with one-pass algorithm for PowerShell param parsing

The previous regex-based approach used  which would
fail when encountering nested parentheses inside the param block, such as
 or .

This commit replaces the regex with a proper one-pass parser that:
- Tracks parenthesis depth to correctly handle nesting
- Respects string quotes (both single and double quotes)
- Handles PowerShell's backtick escape character
- Works correctly with complex default values and function calls

Changes:
- Removed RE_POWERSHELL_PARAM regex constant
- Added extract_powershell_param_block() function for extracting param contents
- Added extract_powershell_param_block_full() function for extracting full param block
- Updated parse_powershell_file() in windmill-parser-bash
- Updated pwsh_executor.rs to use the new extractor
- Added comprehensive test cases for nested parens and quoted strings

Fixes #7079

Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>

* refactor(backend): combine PowerShell param extraction functions

Merged extract_powershell_param_block() and extract_powershell_param_block_full()
into a single function with a boolean parameter to control output format:
- include_keyword=false returns just contents between parentheses
- include_keyword=true returns full param(...) block

This eliminates code duplication while maintaining all existing functionality.

Co-authored-by: hugocasa <hugocasa@users.noreply.github.com>

* fix(backend): improve pwsh param block parsing

* chore: publish parser

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
Co-authored-by: hugocasa <hugocasa@users.noreply.github.com>
2025-11-10 15:08:20 +00:00
Vivek Chavan 5529736784 fix(parser): Handle CRLF line endings in bash and PowerShell parsers (#6889)
Fixes #6867

The bash and PowerShell parsers were not properly handling CRLF (Windows-style)
line endings when parsing script arguments. The regex patterns were only
matching LF line endings, causing scripts with CRLF to fail metadata generation.

Changes:
- Updated RE_BASH regex to optionally match \r before line end (\r?$)
- Updated RE_POWERSHELL_ARGS regex to optionally match \r (\r?)
- Added test case test_parse_bash_sig_with_crlf() to verify CRLF handling

This fix ensures that bash scripts created on Windows (or with editors
using CRLF) will correctly parse arguments and generate proper metadata
via 'wmill script generate-metadata' command.

Python parser was verified to work correctly as it uses an AST parser
that inherently handles line endings properly.
2025-10-22 06:21:38 +00:00
hugocasa 898eb6231b feat(backend): array and object params support in pwsh (#6706)
* feat(backend): array and object params support in pwsh

* add bool and improve arg conversion

* fix bash

* update parser

* sqlx
2025-09-30 12:25:12 +00:00
HugoCasa 3950cfd7e3 fix: add support for ${} syntax without default in bash (#5594) 2025-04-09 19:40:44 +02:00
HugoCasa 7014389d67 fix(parsers): more robust pwsh param parsing (#4884) 2024-12-09 20:55:43 +01:00
HugoCasa ae8f29a4cb feat: http routing (#4339)
* feat: http routing

* all

* feat: improve UI

* final stuff

* fix: sqlx

* fix: nit

* fix: nits

* fix: error handler display

* fix: routes panel perms

* all

* fix: improve ability to paste from macos in vscode extension

* fix lock-write for deno

* all

* cleaning

* fix

* cli preprocessor

* nits

* nits

---------

Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
2024-09-20 15:38:38 +02:00
wendrul 858f63344f split script argument and dependency parser packages to lighten initial load of the script editor (#4287)
* Add feature flags to split parsers into different pkgs

* Split wasm parser imports

* Use regex-lite, reorganize the parser split

* Update imports to the new wasm parser split

* Remove panic system on wasm and simplify snake case convert logic

* Adapt new imports

* Fix to_snake_case + fix tests

* Adapt wasm test dependencies

* Add publish script

* Fix publish script

* Publish script relative to script location

* pkg diff + publish

* Fix TS WASM import + add pakcage lock

* Fix lint

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
2024-08-28 13:26:55 +02:00
HugoCasa 2b9b4eedc3 feat: multi sql statement with pg fix (#4134)
* Revert "Revert "feat: multi statement sql (#4104)" (#4133)"

This reverts commit c578f05e2d.

* fix: sort pg args
2024-07-26 09:23:39 +02:00
Ruben Fiszel c578f05e2d Revert "feat: multi statement sql (#4104)" (#4133)
This reverts commit 5bc0e96171.
2024-07-26 01:24:03 +02:00
HugoCasa 5bc0e96171 feat: multi statement sql (#4104)
* feat: multi statement pg

* fix: add other flavors

* feat: make pg params start at 1 and sequential

* fix: improve sql statement parsing

* add tests

* fix: allow no semi in last statement

* fix: merge conflict

* fix: minor improvement

* fix: parser version
2024-07-25 20:46:04 +02:00
HugoCasa a79e09d65f feat: improve parsers when no main func (#3805)
* feat: improve parsers when no main func

* chore: update parser version
2024-05-23 20:36:16 +02:00
lfanew 99335de925 PowerShell datetime & tests (#3299)
* Added pwsh datetime type supp and basic tests

* Added more comprehensive pwsh tests

* Removed unused vars in test string

Visual only change to make test code string
less confusing

---------

Co-authored-by: HugoCasa <hugo@casademont.ch>
2024-02-27 15:30:34 +01:00
HugoCasa 0af9b9b2b5 feat: powershell deps (#2820)
* feat: powershell deps v-1

* feat: powershell profile + editor helpers + arm img

* fix: make sure powershell cache dir exists
2023-12-13 07:09:08 +01:00
Ruben Fiszel da842a05a1 fix: windmill_status_code script now properly return + script bash default arg 2023-10-21 02:32:47 +02:00
HugoCasa 2f18b94b33 feat: add native powershell support (#2025)
* feat: add powershell support

* fix: lang build
2023-08-10 13:19:50 +00:00
HugoCasa c9681d3e67 fix: parse bash args with same-line comments (#1907) 2023-07-19 15:26:21 +02:00
Ruben Fiszel 74254af71a migrate all jsonschema parser to wasms 2023-06-06 10:52:04 +02:00
Ruben Fiszel 2d8e3acdef feat(bash): add default argument handling for bash 2023-03-10 15:04:34 +01:00
Ruben Fiszel cd8d0e5ea6 feat: deprecate previous_result in favor of results per id 2022-11-10 01:58:52 +01:00
Ruben Fiszel 7c97fac746 feat: support bash as 4th language (#865)
* bash support

* bash backend working

* frontend part

* bash backend working
2022-11-06 23:48:18 +01:00