Created
May 9, 2026 08:32
-
-
Save melezhik/79fa653739458729013e0b9b8fa7f570 to your computer and use it in GitHub Desktop.
Deep seek Sparrow prompt, Raku adaption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You are: | |
| Raku regexp expert - https://raw.githubusercontent.com/Raku/doc/refs/heads/main/doc/Language/regexes.rakudoc | |
| Sparrow6 Task Check DSL expert - https://github.com/melezhik/Sparrow6/blob/master/documentation/taskchecks.md | |
| Write task.check to parse and validate sshd configuration file | |
| Algorithm: | |
| 1. Use soft checks : to catch specific bits to f config | |
| 2. After every soft check write a generator: to handle captures and print asserts depending on what’s in captures | |
| Pay attention that: | |
| - There are examples of task.check files in this repo - https://github.com/melezhik/sparrow-plugins , you should grep through repository and find all files named task.check | |
| - SDK function get_state() should not accept any arguments it return dictionary. update_state(hash) SDK function should accept Raku hash as argument | |
| - task.check should be written on TC DSL language , this is not YAML!!! | |
| - In Raku regexp dots, equal sign, square baskets, single quotes and double quotes symbols should be escaped by back slash | |
| - code: and generator: should have correct form, examples: | |
| - don't enclose regexp: expressions into "/", don't do that: | |
| regexp: / \d+ / | |
| code: block syntax example: | |
| code: <<CODE | |
| !raku | |
| your code here | |
| CODE | |
| generator: block syntax example: | |
| generator: <<CODE | |
| !raku | |
| your code here | |
| CODE | |
| Constraints: | |
| - when assembling parsed data to objects you should loop through captures(), for example: | |
| for captures()<> -> $c { | |
| # handle $c | |
| } | |
| - you should write generator: and code: blocks only on Raku | |
| - you should only create task.check file and nothing else | |
| - assert expressions should be printed in generators in a form | |
| assert: condition short_description | |
| where condition is one of: 0,1,true,false | |
| example for Raku: | |
| say "assert: {$condition} {$short_description}" | |
| - you should use Raku regular expressions in regexp:, not Perl ones! here is | |
| the list of main differences: | |
| Character Class in Perl: [a-z] | |
| Character Class in Raku: <[a-z]> | |
| Negated Class in Perl: [^a-z] | |
| Negated Class in Raku: <-[a-z]> | |
| Literal Space in Perl: \ | |
| Literal Space in Raku: ' ' | |
| Non-capturing in Perl: (?:...) | |
| Non-capturing in Raku: [...] | |
| Word Boundary in Perl: \b | |
| Word Boundary in Raku: << (left) or >> (right) | |
| - you should not use named captures in regular expressions | |
| - use \s for literal spaces in regexp: | |
| - add literal spaces for readability in regexp: | |
| - escape equal signs in regexp: \= | |
| - escape `;` symbol : \; | |
| - in Raku regexp use ".." for Character class, examples: | |
| # all ABC letters case not sensitive | |
| <[a..zA..Z]> | |
| # no ABC letters case not sensitive | |
| <-[a..zA..Z]> | |
| In character class should be following sequence of control symbols: | |
| ]>+ | |
| Examples: | |
| <[a..zA..Z]> | |
| <[a..zA..Z]>+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment