create-yaebal 0.0.0-test → 0.1.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/LICENSE +21 -0
- package/README.md +100 -0
- package/bin/cli.mjs +3 -0
- package/lib/args.d.ts +27 -0
- package/lib/args.d.ts.map +1 -0
- package/lib/args.js +122 -0
- package/lib/args.js.map +1 -0
- package/lib/args.test.d.ts +2 -0
- package/lib/args.test.d.ts.map +1 -0
- package/lib/args.test.js +38 -0
- package/lib/args.test.js.map +1 -0
- package/lib/catalog.d.ts +56 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/catalog.js +241 -0
- package/lib/catalog.js.map +1 -0
- package/lib/config.d.ts +21 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +35 -0
- package/lib/config.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +125 -0
- package/lib/index.js.map +1 -0
- package/lib/prompts.d.ts +10 -0
- package/lib/prompts.d.ts.map +1 -0
- package/lib/prompts.js +95 -0
- package/lib/prompts.js.map +1 -0
- package/lib/scaffold.d.ts +29 -0
- package/lib/scaffold.d.ts.map +1 -0
- package/lib/scaffold.js +296 -0
- package/lib/scaffold.js.map +1 -0
- package/lib/scaffold.test.d.ts +2 -0
- package/lib/scaffold.test.d.ts.map +1 -0
- package/lib/scaffold.test.js +96 -0
- package/lib/scaffold.test.js.map +1 -0
- package/lib/tui/ansi.d.ts +39 -0
- package/lib/tui/ansi.d.ts.map +1 -0
- package/lib/tui/ansi.js +84 -0
- package/lib/tui/ansi.js.map +1 -0
- package/lib/tui/app.d.ts +20 -0
- package/lib/tui/app.d.ts.map +1 -0
- package/lib/tui/app.js +381 -0
- package/lib/tui/app.js.map +1 -0
- package/lib/tui/app.test.d.ts +2 -0
- package/lib/tui/app.test.d.ts.map +1 -0
- package/lib/tui/app.test.js +87 -0
- package/lib/tui/app.test.js.map +1 -0
- package/lib/tui/theme.d.ts +23 -0
- package/lib/tui/theme.d.ts.map +1 -0
- package/lib/tui/theme.js +23 -0
- package/lib/tui/theme.js.map +1 -0
- package/lib/util.d.ts +27 -0
- package/lib/util.d.ts.map +1 -0
- package/lib/util.js +95 -0
- package/lib/util.js.map +1 -0
- package/package.json +38 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 neverlane
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# create-yaebal
|
|
2
|
+
|
|
3
|
+
scaffold a type-safe [yaebal](https://github.com/neverlane/yaebal) telegram bot — a beautiful
|
|
4
|
+
terminal ui when your terminal supports it, plain prompts when it doesn't, and a one-shot flags
|
|
5
|
+
mode for ci.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm create yaebal
|
|
9
|
+
# or: npm create yaebal@latest · bun create yaebal · deno run -A npm:create-yaebal
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## the interactive ui
|
|
13
|
+
|
|
14
|
+
in a real terminal you get a centred, keyboard-driven wizard rendered with pure ansi — no react, no
|
|
15
|
+
solid, **no native dependencies**, just `node:readline` and escape codes. it walks six steps:
|
|
16
|
+
**name → runtime → package manager → template → plugins → review**.
|
|
17
|
+
|
|
18
|
+
| key | does |
|
|
19
|
+
|:----------|:----------------------------------------|
|
|
20
|
+
| `↑ / ↓` | move within a list |
|
|
21
|
+
| `enter` | confirm the step / create |
|
|
22
|
+
| `space` | toggle a plugin or a git/install switch |
|
|
23
|
+
| `a` / `n` | select all / none on the plugins step |
|
|
24
|
+
| `←` | back a step |
|
|
25
|
+
| `esc` | back, or cancel on the first step |
|
|
26
|
+
|
|
27
|
+
because it's pure ansi, the ui runs **everywhere out of the box** — node 20+, bun and deno, no flags,
|
|
28
|
+
no prebuilt binaries. no tty (piped, `CI`, dumb terminal, or `--no-tui`)? it falls back to plain
|
|
29
|
+
one-line prompts, and then to defaults — same output, only the way you answer changes.
|
|
30
|
+
|
|
31
|
+
## flags mode
|
|
32
|
+
|
|
33
|
+
pass an answer as a flag to skip that question; pass `--yes` to skip all of them.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pnpm create yaebal my-bot --runtime bun --template commands --plugins session,again,fmt
|
|
37
|
+
pnpm create yaebal my-bot --plugins all --yes --no-install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| flag | does |
|
|
41
|
+
|:-------------------------------------------|:---------------------------------------|
|
|
42
|
+
| `-r, --runtime <node\|bun\|deno>` | target runtime (default: detected) |
|
|
43
|
+
| `-m, --pm <npm\|pnpm\|yarn\|bun\|deno>` | package manager (default: detected) |
|
|
44
|
+
| `-t, --template <minimal\|echo\|commands>` | starter template |
|
|
45
|
+
| `-p, --plugins <a,b \| all \| none>` | comma list of `@yaebal` plugins |
|
|
46
|
+
| `--git` / `--no-git` | initialise a git repo (+ first commit) |
|
|
47
|
+
| `--install` / `--no-install` | install dependencies after scaffolding |
|
|
48
|
+
| `--tui` / `--no-tui` | force the interactive ui on/off |
|
|
49
|
+
| `-y, --yes` | accept defaults, no prompts |
|
|
50
|
+
| `-h, --help` · `-v, --version` | |
|
|
51
|
+
|
|
52
|
+
## templates
|
|
53
|
+
|
|
54
|
+
a template pulls in the plugins it needs, adds the real imports + wiring, and (for `webhook` /
|
|
55
|
+
`runner`) swaps the bootstrap. everything it generates type-checks against the real `@yaebal/*` apis.
|
|
56
|
+
|
|
57
|
+
| template | what you get |
|
|
58
|
+
|:------------------|:------------------------------------------------------------------|
|
|
59
|
+
| `minimal` | just `/start` + a text echo |
|
|
60
|
+
| `echo` | echo text, photos and stickers back |
|
|
61
|
+
| `commands` | `/start /help /ping` with a command menu |
|
|
62
|
+
| `buttons` | inline keyboard + typed `callback_data` (keyboard, callback-data) |
|
|
63
|
+
| `conversation` | await-style multi-step dialog (conversation) |
|
|
64
|
+
| `i18n` | multi-language bot with a `/lang` toggle (i18n) |
|
|
65
|
+
| `session-counter` | per-chat counter on `ctx.session` (session) |
|
|
66
|
+
| `webhook` | edge/serverless deploy via `serve()` (web) |
|
|
67
|
+
| `runner` | concurrent long-polling via `run()` (runner) |
|
|
68
|
+
|
|
69
|
+
bracketed plugins are added & wired automatically, on top of anything you pick yourself.
|
|
70
|
+
|
|
71
|
+
## runtimes & plugins
|
|
72
|
+
|
|
73
|
+
- **runtimes** — `node` (the project standard, ts via type-stripping), `bun`, `deno`. the generated
|
|
74
|
+
`package.json` scripts match your pick.
|
|
75
|
+
- **plugins** — every published `@yaebal/*` plugin is offered. the cleanly-wired ones (`session`,
|
|
76
|
+
`again`, `throttle`, `ratelimiter`, `i18n`, `files`, `prompt`) drop straight into the bot chain;
|
|
77
|
+
the rest are added to `package.json` with a commented import so the starter always type-checks.
|
|
78
|
+
|
|
79
|
+
## what you get
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
my-bot/
|
|
83
|
+
package.json # scripts for your runtime, @yaebal deps
|
|
84
|
+
tsconfig.json # strict, esm, nodenext
|
|
85
|
+
src/index.ts # a working bot, wired with the plugins you picked
|
|
86
|
+
.env.example # BOT_TOKEN=
|
|
87
|
+
.gitignore
|
|
88
|
+
README.md
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
cd my-bot
|
|
93
|
+
pnpm install
|
|
94
|
+
# add your BOT_TOKEN to .env
|
|
95
|
+
pnpm dev
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
part of [**yaebal**](https://github.com/neverlane/yaebal) — a type-safe, runtime-agnostic Telegram Bot API framework. MIT.
|
package/bin/cli.mjs
ADDED
package/lib/args.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dependency-free argv parser. produces a partial set of scaffold options plus
|
|
3
|
+
* the behavioural flags (`--yes`, `--no-install`, `--no-tui`, …). anything the
|
|
4
|
+
* user didn't pass stays `undefined` so a front-end can ask for it.
|
|
5
|
+
*/
|
|
6
|
+
import { type PackageManager, type Runtime, type TemplateId } from "./catalog.js";
|
|
7
|
+
export interface ParsedArgs {
|
|
8
|
+
name?: string;
|
|
9
|
+
runtime?: Runtime;
|
|
10
|
+
packageManager?: PackageManager;
|
|
11
|
+
template?: TemplateId;
|
|
12
|
+
/** undefined = not provided; [] = explicitly none */
|
|
13
|
+
plugins?: string[];
|
|
14
|
+
git?: boolean;
|
|
15
|
+
install?: boolean;
|
|
16
|
+
/** force tui on/off; undefined = auto-detect */
|
|
17
|
+
tui?: boolean;
|
|
18
|
+
/** accept defaults for everything not provided (non-interactive) */
|
|
19
|
+
yes: boolean;
|
|
20
|
+
help: boolean;
|
|
21
|
+
version: boolean;
|
|
22
|
+
/** unknown flags we encountered, surfaced as warnings */
|
|
23
|
+
unknown: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
26
|
+
export declare const HELP = "create-yaebal \u2014 scaffold a type-safe telegram bot\n\nusage:\n create-yaebal [name] [options]\n\noptions:\n -r, --runtime <node|bun|deno> target runtime (default: detected)\n -m, --pm <npm|pnpm|yarn|bun|deno> package manager (default: detected)\n -t, --template <minimal|echo|commands>\n -p, --plugins <a,b | all | none> comma list of @yaebal plugins\n --git / --no-git initialise a git repo (+ first commit)\n --install / --no-install install dependencies after scaffolding\n --tui / --no-tui force the interactive ui on/off\n -y, --yes accept defaults, no prompts\n -h, --help show this help\n -v, --version print version\n\nexamples:\n create-yaebal my-bot\n create-yaebal my-bot -r bun -t commands -p session,again,fmt\n create-yaebal my-bot --plugins all --yes --no-install\n";
|
|
27
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIN,KAAK,cAAc,EAEnB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,UAAU;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,oEAAoE;IACpE,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAcD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAgFpD;AAED,eAAO,MAAM,IAAI,48BAqBhB,CAAC"}
|
package/lib/args.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dependency-free argv parser. produces a partial set of scaffold options plus
|
|
3
|
+
* the behavioural flags (`--yes`, `--no-install`, `--no-tui`, …). anything the
|
|
4
|
+
* user didn't pass stays `undefined` so a front-end can ask for it.
|
|
5
|
+
*/
|
|
6
|
+
import { isPackageManager, isRuntime, isTemplate, PLUGIN_IDS, } from "./catalog.js";
|
|
7
|
+
function resolvePlugins(raw) {
|
|
8
|
+
const v = raw.trim().toLowerCase();
|
|
9
|
+
if (v === "" || v === "none")
|
|
10
|
+
return [];
|
|
11
|
+
if (v === "all")
|
|
12
|
+
return [...PLUGIN_IDS];
|
|
13
|
+
return v
|
|
14
|
+
.split(",")
|
|
15
|
+
.map((s) => s.trim())
|
|
16
|
+
.filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
export function parseArgs(argv) {
|
|
19
|
+
const out = { yes: false, help: false, version: false, unknown: [] };
|
|
20
|
+
for (let i = 0; i < argv.length; i++) {
|
|
21
|
+
const arg = argv[i];
|
|
22
|
+
if (arg === undefined)
|
|
23
|
+
continue;
|
|
24
|
+
// allow `--flag=value`
|
|
25
|
+
const eq = arg.indexOf("=");
|
|
26
|
+
const flag = arg.startsWith("--") && eq !== -1 ? arg.slice(0, eq) : arg;
|
|
27
|
+
const inlineValue = arg.startsWith("--") && eq !== -1 ? arg.slice(eq + 1) : undefined;
|
|
28
|
+
const next = () => inlineValue ?? argv[++i];
|
|
29
|
+
switch (flag) {
|
|
30
|
+
case "-h":
|
|
31
|
+
case "--help":
|
|
32
|
+
out.help = true;
|
|
33
|
+
break;
|
|
34
|
+
case "-v":
|
|
35
|
+
case "--version":
|
|
36
|
+
out.version = true;
|
|
37
|
+
break;
|
|
38
|
+
case "-y":
|
|
39
|
+
case "--yes":
|
|
40
|
+
out.yes = true;
|
|
41
|
+
break;
|
|
42
|
+
case "-r":
|
|
43
|
+
case "--runtime": {
|
|
44
|
+
const v = next();
|
|
45
|
+
if (v && isRuntime(v))
|
|
46
|
+
out.runtime = v;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case "-m":
|
|
50
|
+
case "--pm":
|
|
51
|
+
case "--package-manager": {
|
|
52
|
+
const v = next();
|
|
53
|
+
if (v && isPackageManager(v))
|
|
54
|
+
out.packageManager = v;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case "-t":
|
|
58
|
+
case "--template": {
|
|
59
|
+
const v = next();
|
|
60
|
+
if (v && isTemplate(v))
|
|
61
|
+
out.template = v;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "-p":
|
|
65
|
+
case "--plugins": {
|
|
66
|
+
const v = next();
|
|
67
|
+
if (v !== undefined)
|
|
68
|
+
out.plugins = resolvePlugins(v);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case "--git":
|
|
72
|
+
out.git = true;
|
|
73
|
+
break;
|
|
74
|
+
case "--no-git":
|
|
75
|
+
out.git = false;
|
|
76
|
+
break;
|
|
77
|
+
case "--install":
|
|
78
|
+
out.install = true;
|
|
79
|
+
break;
|
|
80
|
+
case "--no-install":
|
|
81
|
+
out.install = false;
|
|
82
|
+
break;
|
|
83
|
+
case "--tui":
|
|
84
|
+
out.tui = true;
|
|
85
|
+
break;
|
|
86
|
+
case "--no-tui":
|
|
87
|
+
out.tui = false;
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
if (arg.startsWith("-"))
|
|
91
|
+
out.unknown.push(arg);
|
|
92
|
+
else if (out.name === undefined)
|
|
93
|
+
out.name = arg.trim();
|
|
94
|
+
else
|
|
95
|
+
out.unknown.push(arg);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
export const HELP = `create-yaebal — scaffold a type-safe telegram bot
|
|
101
|
+
|
|
102
|
+
usage:
|
|
103
|
+
create-yaebal [name] [options]
|
|
104
|
+
|
|
105
|
+
options:
|
|
106
|
+
-r, --runtime <node|bun|deno> target runtime (default: detected)
|
|
107
|
+
-m, --pm <npm|pnpm|yarn|bun|deno> package manager (default: detected)
|
|
108
|
+
-t, --template <minimal|echo|commands>
|
|
109
|
+
-p, --plugins <a,b | all | none> comma list of @yaebal plugins
|
|
110
|
+
--git / --no-git initialise a git repo (+ first commit)
|
|
111
|
+
--install / --no-install install dependencies after scaffolding
|
|
112
|
+
--tui / --no-tui force the interactive ui on/off
|
|
113
|
+
-y, --yes accept defaults, no prompts
|
|
114
|
+
-h, --help show this help
|
|
115
|
+
-v, --version print version
|
|
116
|
+
|
|
117
|
+
examples:
|
|
118
|
+
create-yaebal my-bot
|
|
119
|
+
create-yaebal my-bot -r bun -t commands -p session,again,fmt
|
|
120
|
+
create-yaebal my-bot --plugins all --yes --no-install
|
|
121
|
+
`;
|
|
122
|
+
//# sourceMappingURL=args.js.map
|
package/lib/args.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACN,gBAAgB,EAChB,SAAS,EACT,UAAU,EAEV,UAAU,GAGV,MAAM,cAAc,CAAC;AAqBtB,SAAS,cAAc,CAAC,GAAW;IAClC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAEnC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IACxC,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,CAAC,GAAG,UAAU,CAA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,KAAK,WAAW;gBACf,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;gBACnB,MAAM;YACP,KAAK,cAAc;gBAClB,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;gBACpB,MAAM;YACP,KAAK,OAAO;gBACX,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC;gBACf,MAAM;YACP,KAAK,UAAU;gBACd,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC;gBAChB,MAAM;YACP;gBACC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;oBAAE,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;qBAC1C,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;oBAAE,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;;oBAClD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.test.d.ts","sourceRoot":"","sources":["../src/args.test.ts"],"names":[],"mappings":""}
|
package/lib/args.test.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { parseArgs } from "./args.js";
|
|
4
|
+
import { PLUGIN_IDS } from "./catalog.js";
|
|
5
|
+
test("parseArgs: positional name + short flags", () => {
|
|
6
|
+
const a = parseArgs(["my-bot", "-r", "bun", "-t", "commands", "-p", "session,again"]);
|
|
7
|
+
assert.equal(a.name, "my-bot");
|
|
8
|
+
assert.equal(a.runtime, "bun");
|
|
9
|
+
assert.equal(a.template, "commands");
|
|
10
|
+
assert.deepEqual(a.plugins, ["session", "again"]);
|
|
11
|
+
});
|
|
12
|
+
test("parseArgs: --flag=value form and pm alias", () => {
|
|
13
|
+
const a = parseArgs(["bot", "--runtime=deno", "--pm=npm"]);
|
|
14
|
+
assert.equal(a.runtime, "deno");
|
|
15
|
+
assert.equal(a.packageManager, "npm");
|
|
16
|
+
});
|
|
17
|
+
test("parseArgs: plugins all / none", () => {
|
|
18
|
+
assert.deepEqual(parseArgs(["b", "-p", "all"]).plugins, [...PLUGIN_IDS]);
|
|
19
|
+
assert.deepEqual(parseArgs(["b", "-p", "none"]).plugins, []);
|
|
20
|
+
assert.equal(parseArgs(["b"]).plugins, undefined); // not provided
|
|
21
|
+
});
|
|
22
|
+
test("parseArgs: boolean toggles and yes", () => {
|
|
23
|
+
const a = parseArgs(["b", "--no-install", "--git", "--no-tui", "-y"]);
|
|
24
|
+
assert.equal(a.install, false);
|
|
25
|
+
assert.equal(a.git, true);
|
|
26
|
+
assert.equal(a.tui, false);
|
|
27
|
+
assert.equal(a.yes, true);
|
|
28
|
+
});
|
|
29
|
+
test("parseArgs: invalid enum values are ignored, unknown flags collected", () => {
|
|
30
|
+
const a = parseArgs(["b", "-r", "rust", "--frobnicate"]);
|
|
31
|
+
assert.equal(a.runtime, undefined);
|
|
32
|
+
assert.ok(a.unknown.includes("--frobnicate"));
|
|
33
|
+
});
|
|
34
|
+
test("parseArgs: help / version", () => {
|
|
35
|
+
assert.equal(parseArgs(["--help"]).help, true);
|
|
36
|
+
assert.equal(parseArgs(["-v"]).version, true);
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=args.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.test.js","sourceRoot":"","sources":["../src/args.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,IA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scaffolder can offer: runtimes, package
|
|
3
|
+
* managers, project templates and the full `@yaebal/*` plugin set.
|
|
4
|
+
*
|
|
5
|
+
* this module is pure data + a couple of tiny lookups. both the tui and the
|
|
6
|
+
* plain prompt fallback read from here, so the two front-ends can never drift.
|
|
7
|
+
*/
|
|
8
|
+
export type Runtime = "node" | "bun" | "deno";
|
|
9
|
+
export type PackageManager = "npm" | "pnpm" | "yarn" | "bun" | "deno";
|
|
10
|
+
export type TemplateId = "minimal" | "echo" | "commands" | "buttons" | "conversation" | "i18n" | "session-counter" | "webhook" | "runner";
|
|
11
|
+
export interface Choice<T extends string> {
|
|
12
|
+
value: T;
|
|
13
|
+
label: string;
|
|
14
|
+
hint: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const RUNTIMES: Choice<Runtime>[];
|
|
17
|
+
export declare const PACKAGE_MANAGERS: Choice<PackageManager>[];
|
|
18
|
+
export declare const TEMPLATES: Choice<TemplateId>[];
|
|
19
|
+
/**
|
|
20
|
+
* how a plugin is wired into the generated `src/index.ts`:
|
|
21
|
+
* - `install` → added to the `new Bot(token).install(expr)` chain
|
|
22
|
+
* - `setup` → a statement run against `bot.api` after the bot is built
|
|
23
|
+
* - `dep` → dependency + a commented import hint (wire it yourself)
|
|
24
|
+
*/
|
|
25
|
+
export type WireKind = "install" | "setup" | "dep";
|
|
26
|
+
export interface PluginDef {
|
|
27
|
+
/** key used on the cli (`--plugins a,b`) and in prompts */
|
|
28
|
+
id: string;
|
|
29
|
+
/** npm package added to dependencies */
|
|
30
|
+
dep: string;
|
|
31
|
+
/** one-line description shown in pickers */
|
|
32
|
+
hint: string;
|
|
33
|
+
wire: WireKind;
|
|
34
|
+
/** import line emitted at the top of the file */
|
|
35
|
+
import: string;
|
|
36
|
+
/** expression for `.install(...)` when wire === "install" */
|
|
37
|
+
install?: string;
|
|
38
|
+
/** statement appended after bot creation when wire === "setup" */
|
|
39
|
+
setup?: string;
|
|
40
|
+
/** recommended in the default selection */
|
|
41
|
+
recommended?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* the full plugin catalog — every published `@yaebal/*` plugin is supported.
|
|
45
|
+
*
|
|
46
|
+
* `install`/`setup` plugins generate fully-wired, type-checking code; `dep`
|
|
47
|
+
* plugins are added to package.json with a commented import so the starter
|
|
48
|
+
* never ships code that doesn't compile, while still pulling the package in.
|
|
49
|
+
*/
|
|
50
|
+
export declare const PLUGINS: PluginDef[];
|
|
51
|
+
export declare const PLUGIN_IDS: string[];
|
|
52
|
+
export declare function findPlugin(id: string): PluginDef | undefined;
|
|
53
|
+
export declare function isRuntime(v: string): v is Runtime;
|
|
54
|
+
export declare function isPackageManager(v: string): v is PackageManager;
|
|
55
|
+
export declare function isTemplate(v: string): v is TemplateId;
|
|
56
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AACtE,MAAM,MAAM,UAAU,GACnB,SAAS,GACT,MAAM,GACN,UAAU,GACV,SAAS,GACT,cAAc,GACd,MAAM,GACN,iBAAiB,GACjB,SAAS,GACT,QAAQ,CAAC;AAEZ,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,MAAM;IACvC,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,EAIrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,cAAc,CAAC,EAMpD,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,EAUzC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;AAEnD,MAAM,WAAW,SAAS;IACzB,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,EA6L9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAAM,EAA6B,CAAC;AAE7D,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE5D;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,OAAO,CAEjD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,cAAc,CAE/D;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,UAAU,CAErD"}
|
package/lib/catalog.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* static catalog of everything the scaffolder can offer: runtimes, package
|
|
3
|
+
* managers, project templates and the full `@yaebal/*` plugin set.
|
|
4
|
+
*
|
|
5
|
+
* this module is pure data + a couple of tiny lookups. both the tui and the
|
|
6
|
+
* plain prompt fallback read from here, so the two front-ends can never drift.
|
|
7
|
+
*/
|
|
8
|
+
export const RUNTIMES = [
|
|
9
|
+
{ value: "node", label: "node.js", hint: "the project standard — ts via type-stripping" },
|
|
10
|
+
{ value: "bun", label: "bun", hint: "fast all-in-one runtime, runs ts natively" },
|
|
11
|
+
{ value: "deno", label: "deno", hint: "secure by default, native ts & web apis" },
|
|
12
|
+
];
|
|
13
|
+
export const PACKAGE_MANAGERS = [
|
|
14
|
+
{ value: "npm", label: "npm", hint: "ships with node" },
|
|
15
|
+
{ value: "pnpm", label: "pnpm", hint: "fast, disk-efficient (recommended)" },
|
|
16
|
+
{ value: "yarn", label: "yarn", hint: "classic / berry" },
|
|
17
|
+
{ value: "bun", label: "bun", hint: "bun's built-in installer" },
|
|
18
|
+
{ value: "deno", label: "deno", hint: "no install step — deno cache" },
|
|
19
|
+
];
|
|
20
|
+
export const TEMPLATES = [
|
|
21
|
+
{ value: "minimal", label: "minimal", hint: "just /start + a text echo" },
|
|
22
|
+
{ value: "echo", label: "echo", hint: "echo text, photos and stickers back" },
|
|
23
|
+
{ value: "commands", label: "commands", hint: "/start /help /ping with a command menu" },
|
|
24
|
+
{ value: "buttons", label: "buttons", hint: "inline keyboard + typed callback_data" },
|
|
25
|
+
{ value: "conversation", label: "conversation", hint: "await-style multi-step dialog" },
|
|
26
|
+
{ value: "i18n", label: "i18n", hint: "multi-language bot with /lang toggle" },
|
|
27
|
+
{ value: "session-counter", label: "session-counter", hint: "per-chat counter on ctx.session" },
|
|
28
|
+
{ value: "webhook", label: "webhook", hint: "edge/serverless deploy via @yaebal/web" },
|
|
29
|
+
{ value: "runner", label: "runner", hint: "concurrent long-polling via @yaebal/runner" },
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* the full plugin catalog — every published `@yaebal/*` plugin is supported.
|
|
33
|
+
*
|
|
34
|
+
* `install`/`setup` plugins generate fully-wired, type-checking code; `dep`
|
|
35
|
+
* plugins are added to package.json with a commented import so the starter
|
|
36
|
+
* never ships code that doesn't compile, while still pulling the package in.
|
|
37
|
+
*/
|
|
38
|
+
export const PLUGINS = [
|
|
39
|
+
// ── wired: installed into the bot chain ───────────────────────────────
|
|
40
|
+
{
|
|
41
|
+
id: "session",
|
|
42
|
+
dep: "@yaebal/session",
|
|
43
|
+
hint: "per-chat state on ctx.session",
|
|
44
|
+
wire: "install",
|
|
45
|
+
import: 'import { session } from "@yaebal/session";',
|
|
46
|
+
install: "session({ initial: () => ({ count: 0 }) })",
|
|
47
|
+
recommended: true,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "i18n",
|
|
51
|
+
dep: "@yaebal/i18n",
|
|
52
|
+
hint: "per-chat locale + ctx.t",
|
|
53
|
+
wire: "install",
|
|
54
|
+
import: 'import { i18n } from "@yaebal/i18n";',
|
|
55
|
+
install: 'i18n({ defaultLocale: "en", locales: { en: { hi: "hi there!" } } })',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "ratelimiter",
|
|
59
|
+
dep: "@yaebal/ratelimiter",
|
|
60
|
+
hint: "drop floods of incoming updates",
|
|
61
|
+
wire: "install",
|
|
62
|
+
import: 'import { ratelimiter } from "@yaebal/ratelimiter";',
|
|
63
|
+
install: "ratelimiter()",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "files",
|
|
67
|
+
dep: "@yaebal/files",
|
|
68
|
+
hint: "ctx.files: resolve & download telegram files",
|
|
69
|
+
wire: "install",
|
|
70
|
+
import: 'import { files } from "@yaebal/files";',
|
|
71
|
+
install: "files()",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "prompt",
|
|
75
|
+
dep: "@yaebal/prompt",
|
|
76
|
+
hint: "ctx.prompt — ask & await one reply",
|
|
77
|
+
wire: "install",
|
|
78
|
+
import: 'import { prompt } from "@yaebal/prompt";',
|
|
79
|
+
install: "prompt()",
|
|
80
|
+
},
|
|
81
|
+
// ── wired: api transformers applied after build ───────────────────────
|
|
82
|
+
{
|
|
83
|
+
id: "again",
|
|
84
|
+
dep: "@yaebal/again",
|
|
85
|
+
hint: "auto-retry on 429 / flood-wait / 5xx",
|
|
86
|
+
wire: "setup",
|
|
87
|
+
import: 'import { autoRetry } from "@yaebal/again";',
|
|
88
|
+
setup: "autoRetry(bot.api);",
|
|
89
|
+
recommended: true,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "throttle",
|
|
93
|
+
dep: "@yaebal/throttle",
|
|
94
|
+
hint: "space out outgoing api calls",
|
|
95
|
+
wire: "setup",
|
|
96
|
+
import: 'import { throttle } from "@yaebal/throttle";',
|
|
97
|
+
setup: "throttle(bot.api);",
|
|
98
|
+
},
|
|
99
|
+
// ── dep-only: pulled in + commented import, wire to taste ──────────────
|
|
100
|
+
{
|
|
101
|
+
id: "fmt",
|
|
102
|
+
dep: "@yaebal/fmt",
|
|
103
|
+
hint: "html`` / md`` tagged templates",
|
|
104
|
+
wire: "dep",
|
|
105
|
+
import: 'import { html, md } from "@yaebal/fmt";',
|
|
106
|
+
recommended: true,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "keyboard",
|
|
110
|
+
dep: "@yaebal/keyboard",
|
|
111
|
+
hint: "fluent inline & reply keyboards",
|
|
112
|
+
wire: "dep",
|
|
113
|
+
import: 'import { InlineKeyboard, Keyboard } from "@yaebal/keyboard";',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "filters",
|
|
117
|
+
dep: "@yaebal/filters",
|
|
118
|
+
hint: "composable type-narrowing filters",
|
|
119
|
+
wire: "dep",
|
|
120
|
+
import: 'import { and, command, isPrivate, regex, text } from "@yaebal/filters";',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "callback-data",
|
|
124
|
+
dep: "@yaebal/callback-data",
|
|
125
|
+
hint: "typed callback_data pack/unpack",
|
|
126
|
+
wire: "dep",
|
|
127
|
+
import: 'import { callbackData } from "@yaebal/callback-data";',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "commands",
|
|
131
|
+
dep: "@yaebal/commands",
|
|
132
|
+
hint: "command registry + telegram menu",
|
|
133
|
+
wire: "dep",
|
|
134
|
+
import: 'import { commands } from "@yaebal/commands";',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "conversation",
|
|
138
|
+
dep: "@yaebal/conversation",
|
|
139
|
+
hint: "await-style multi-step dialogs",
|
|
140
|
+
wire: "dep",
|
|
141
|
+
import: 'import { conversation } from "@yaebal/conversation";',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "scenes",
|
|
145
|
+
dep: "@yaebal/scenes",
|
|
146
|
+
hint: "finite-state scene flows",
|
|
147
|
+
wire: "dep",
|
|
148
|
+
import: 'import { scenes } from "@yaebal/scenes";',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "onboarding",
|
|
152
|
+
dep: "@yaebal/onboarding",
|
|
153
|
+
hint: "declarative first-run product tours",
|
|
154
|
+
wire: "dep",
|
|
155
|
+
import: 'import { createOnboarding } from "@yaebal/onboarding";',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "morda",
|
|
159
|
+
dep: "@yaebal/morda",
|
|
160
|
+
hint: "declarative windows & stack navigation",
|
|
161
|
+
wire: "dep",
|
|
162
|
+
import: 'import { dialogs, button, back, switchTo } from "@yaebal/morda";',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: "router",
|
|
166
|
+
dep: "@yaebal/router",
|
|
167
|
+
hint: "file-system style update routing",
|
|
168
|
+
wire: "dep",
|
|
169
|
+
import: 'import { routeFromFile } from "@yaebal/router";',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: "pagination",
|
|
173
|
+
dep: "@yaebal/pagination",
|
|
174
|
+
hint: "paginated inline lists",
|
|
175
|
+
wire: "dep",
|
|
176
|
+
import: 'import { pagination } from "@yaebal/pagination";',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "media-group",
|
|
180
|
+
dep: "@yaebal/media-group",
|
|
181
|
+
hint: "collect album updates into one call",
|
|
182
|
+
wire: "dep",
|
|
183
|
+
import: 'import { mediaGroup } from "@yaebal/media-group";',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: "media-cache",
|
|
187
|
+
dep: "@yaebal/media-cache",
|
|
188
|
+
hint: "reuse file_id instead of re-uploading",
|
|
189
|
+
wire: "dep",
|
|
190
|
+
import: 'import { mediaCache } from "@yaebal/media-cache";',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: "broadcast",
|
|
194
|
+
dep: "@yaebal/broadcast",
|
|
195
|
+
hint: "send a message to many chats",
|
|
196
|
+
wire: "dep",
|
|
197
|
+
import: 'import { broadcast } from "@yaebal/broadcast";',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "split",
|
|
201
|
+
dep: "@yaebal/split",
|
|
202
|
+
hint: "split long text across messages",
|
|
203
|
+
wire: "dep",
|
|
204
|
+
import: 'import { split } from "@yaebal/split";',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: "runner",
|
|
208
|
+
dep: "@yaebal/runner",
|
|
209
|
+
hint: "concurrent update processing (run())",
|
|
210
|
+
wire: "dep",
|
|
211
|
+
import: 'import { run } from "@yaebal/runner";',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: "web",
|
|
215
|
+
dep: "@yaebal/web",
|
|
216
|
+
hint: "run on edge/web via webhooks",
|
|
217
|
+
wire: "dep",
|
|
218
|
+
import: 'import { webhook, serve } from "@yaebal/web";',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
id: "workers",
|
|
222
|
+
dep: "@yaebal/workers",
|
|
223
|
+
hint: "offload cpu-heavy work to a pool",
|
|
224
|
+
wire: "dep",
|
|
225
|
+
import: 'import { createPool } from "@yaebal/workers";',
|
|
226
|
+
},
|
|
227
|
+
];
|
|
228
|
+
export const PLUGIN_IDS = PLUGINS.map((p) => p.id);
|
|
229
|
+
export function findPlugin(id) {
|
|
230
|
+
return PLUGINS.find((p) => p.id === id);
|
|
231
|
+
}
|
|
232
|
+
export function isRuntime(v) {
|
|
233
|
+
return v === "node" || v === "bun" || v === "deno";
|
|
234
|
+
}
|
|
235
|
+
export function isPackageManager(v) {
|
|
236
|
+
return v === "npm" || v === "pnpm" || v === "yarn" || v === "bun" || v === "deno";
|
|
237
|
+
}
|
|
238
|
+
export function isTemplate(v) {
|
|
239
|
+
return TEMPLATES.some((t) => t.value === v);
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,MAAM,CAAC,MAAM,QAAQ,GAAsB;IAC1C,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,8CAA8C,EAAE;IACzF,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,2CAA2C,EAAE;IACjF,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,yCAAyC,EAAE;CACjF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACzD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACvD,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,oCAAoC,EAAE;IAC5E,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACzD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,0BAA0B,EAAE;IAChE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE;CACtE,CAAC;AAE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