@plurnk/plurnk-grammar 0.9.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/schema/PlurnkStatement.json +19 -19
- package/dist/src/AstBuilder.d.ts.map +1 -1
- package/dist/src/AstBuilder.js +14 -7
- package/dist/src/AstBuilder.js.map +1 -1
- package/dist/src/PlurnkErrorStrategy.js +7 -7
- package/dist/src/PlurnkErrorStrategy.js.map +1 -1
- package/dist/src/PlurnkParser.js +2 -2
- package/dist/src/PlurnkParser.js.map +1 -1
- package/dist/src/generated/plurnkLexer.d.ts +2 -2
- package/dist/src/generated/plurnkLexer.d.ts.map +1 -1
- package/dist/src/generated/plurnkLexer.js +142 -139
- package/dist/src/generated/plurnkLexer.js.map +1 -1
- package/dist/src/generated/plurnkParser.d.ts +8 -8
- package/dist/src/generated/plurnkParser.d.ts.map +1 -1
- package/dist/src/generated/plurnkParser.js +29 -29
- package/dist/src/generated/plurnkParser.js.map +1 -1
- package/dist/src/generated/plurnkParserVisitor.d.ts +3 -3
- package/dist/src/generated/plurnkParserVisitor.d.ts.map +1 -1
- package/dist/src/generated/plurnkParserVisitor.js +2 -2
- package/dist/src/generated/plurnkParserVisitor.js.map +1 -1
- package/dist/src/types.generated.d.ts +9 -9
- package/dist/src/types.generated.d.ts.map +1 -1
- package/package.json +1 -1
- package/plurnk.md +32 -22
package/plurnk.md
CHANGED
|
@@ -5,36 +5,38 @@ YOU MUST ONLY use the Extended HEREDOC Plurnk Operations (FIND|READ|EDIT|COPY|MO
|
|
|
5
5
|
## Syntax
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
<<OPsuffix[signal]?(
|
|
8
|
+
<<OPsuffix[signal]?(target)?<L>?:body?:OPsuffix
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Slots between `<<OPsuffix` and `:body:` are all optional. `:body:` fences are required (use `::` when body is empty).
|
|
12
12
|
|
|
13
13
|
## Operations
|
|
14
14
|
|
|
15
|
-
| OP | `[signal]` | `(
|
|
16
|
-
|
|
17
|
-
| FIND | filter tags | required | results `N
|
|
18
|
-
| READ | filter tags | required | lines `N
|
|
19
|
-
| EDIT | tags | required | lines `N
|
|
20
|
-
| COPY | apply tags | required | lines `N
|
|
21
|
-
| MOVE | apply tags | required | lines `N
|
|
22
|
-
| SHOW | filter tags | required | results `N
|
|
23
|
-
| HIDE | filter tags | required | results `N
|
|
24
|
-
| SEND | status code | recipient | —
|
|
25
|
-
| EXEC |
|
|
15
|
+
| OP | `[signal]` | `(target)`| `<L>` | body |
|
|
16
|
+
|------|-------------|-----------|---------------|-----------------|
|
|
17
|
+
| FIND | filter tags | required | results `N,M` | matcher |
|
|
18
|
+
| READ | filter tags | required | lines `N,M` | matcher |
|
|
19
|
+
| EDIT | tags | required | lines `N,M` | content |
|
|
20
|
+
| COPY | apply tags | required | lines `N,M` | destination URI |
|
|
21
|
+
| MOVE | apply tags | required | lines `N,M` | destination URI |
|
|
22
|
+
| SHOW | filter tags | required | results `N,M` | matcher |
|
|
23
|
+
| HIDE | filter tags | required | results `N,M` | matcher |
|
|
24
|
+
| SEND | status code | recipient | — | message body |
|
|
25
|
+
| EXEC | executor | cwd | — | command or code |
|
|
26
26
|
|
|
27
27
|
READ output prefixes every line with line numbers, `N:\t`. The prefix is not part of the source.
|
|
28
28
|
SEND broadcasts to uri when a path is included and messages the user when no path is included.
|
|
29
|
-
EXEC
|
|
29
|
+
EXEC defaults to `sh`; override with an optional executor (`node`, `python`, `search`, etc.).
|
|
30
30
|
|
|
31
31
|
## `<L>`
|
|
32
32
|
|
|
33
33
|
`<N>` selects position N.
|
|
34
|
-
`<N
|
|
34
|
+
`<N,M>` selects the inclusive range N through M. N and M are signed integers.
|
|
35
35
|
|
|
36
36
|
Sentinels: `<0>` before position 1 (prepend), `<-1>` after the last position (append).
|
|
37
37
|
|
|
38
|
+
Clearing content: `<1,-1>` selects every position; combine with an empty body to clear an entry.
|
|
39
|
+
|
|
38
40
|
## Body matcher dispatch (FIND, READ, SHOW, HIDE)
|
|
39
41
|
|
|
40
42
|
| leading prefix | dialect | form |
|
|
@@ -50,7 +52,7 @@ Escape `/` inside a regex pattern as `\/`. XPath body begins with `//`.
|
|
|
50
52
|
|
|
51
53
|
URI-shaped: `[scheme://]rest`.
|
|
52
54
|
|
|
53
|
-
* Bare paths (no scheme) default to local relative project file paths.
|
|
55
|
+
* Bare paths (no scheme) default to local relative project file paths (leader `/` for absolute path).
|
|
54
56
|
* Glob metacharacters (`*`, `**`, `?`, `[...]`) are allowed in path segments.
|
|
55
57
|
|
|
56
58
|
Internal schemes:
|
|
@@ -73,6 +75,7 @@ The agent maintains two contexts for budgeting tokens for working memory and ava
|
|
|
73
75
|
`HIDE` demotes matching entries to archive and saves tokens.
|
|
74
76
|
|
|
75
77
|
YOU SHOULD demote distilled and irrelevant entries to Archive with HIDE to save tokens and optimize context relevance.
|
|
78
|
+
YOU MAY permanently delete entries by MOVE to `/dev/null` (works regardless of environment).
|
|
76
79
|
|
|
77
80
|
## Suffix
|
|
78
81
|
|
|
@@ -93,7 +96,7 @@ Body content is character-perfect, exactly matching whitespace.
|
|
|
93
96
|
```
|
|
94
97
|
<<FIND(config/**/*.xml)://user[@role='admin']:FIND
|
|
95
98
|
<<READ(lang/??.json):$.greeting:READ
|
|
96
|
-
<<READ(https://en.wikipedia.org/wiki/Paris)<426
|
|
99
|
+
<<READ(https://en.wikipedia.org/wiki/Paris)<426,465>::READ
|
|
97
100
|
<<EDIT[philosophy,existentialism](known://philosophy/existentialism/meaning):The meaning of life is 42:EDIT
|
|
98
101
|
<<EDIT[france,geography](unknown://countries/france/capital):What is the capital of France?:EDIT
|
|
99
102
|
|
|
@@ -105,18 +108,25 @@ Body content is character-perfect, exactly matching whitespace.
|
|
|
105
108
|
|
|
106
109
|
<<EDIT(known://plan)<2>:- [x] Discover capital of France:EDIT
|
|
107
110
|
<<EDIT(known://countries/france/capital)<-1>:[Wikipedia: Paris](https://en.wikipedia.org/wiki/Paris):EDIT
|
|
108
|
-
<<EDIT(known://countries/france/capital)
|
|
111
|
+
<<EDIT(known://countries/france/capital)<1,-1>::EDIT
|
|
109
112
|
<<COPY[archive,2026-05-14](known://draft):known://archive/2026-05-14/draft:COPY
|
|
110
|
-
<<MOVE(known://draft):known://final/answer:MOVE
|
|
113
|
+
<<MOVE(known://draft/answer):known://final/answer:MOVE
|
|
114
|
+
<<MOVE(known://obsolete/note):/dev/null:MOVE
|
|
111
115
|
<<SHOW[france](known://countries/**):Paris*:SHOW
|
|
112
|
-
<<HIDE(log://**/get)<101
|
|
116
|
+
<<HIDE(log://**/get)<101,200>::HIDE
|
|
113
117
|
<<FIND(log://**/error):/timeout|deadline exceeded/i:FIND
|
|
114
118
|
|
|
115
|
-
<<
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
<<EDIT[tutorial,training,scripts](example.sh):#!/usr/bin/env sh
|
|
120
|
+
echo "Hello, world!" > hello.txt
|
|
121
|
+
:EDIT
|
|
122
|
+
|
|
123
|
+
<<EXEC:
|
|
124
|
+
chmod +x ./example.sh
|
|
125
|
+
./example.sh
|
|
118
126
|
:EXEC
|
|
119
127
|
|
|
128
|
+
<<EXEC[search]:france government capital:EXEC
|
|
129
|
+
|
|
120
130
|
<<SEND[102]:decomposed prompt into unknowns; plan initialized:SEND
|
|
121
131
|
<<SEND[200]:Paris:SEND
|
|
122
132
|
<<SEND[200]:{"city":"Paris","population":2161000}:SEND
|