@pollis-inc/cli 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,17 @@
1
+ # {{name}}
2
+
3
+ A [Pollis](https://pollis.com) App. It answers `/hello` with a greeting.
4
+
5
+ ```sh
6
+ pnpm install
7
+ pnpm test # build, then run src/app.test.ts against the built App, offline
8
+ pnpm build # writes dist/app.wasm and dist/pollis-app.json, prints the App hash
9
+ ```
10
+
11
+ - `src/app.ts`: the App. Its `manifest` says what it needs; its handlers say what it does.
12
+ - `src/app.test.ts`: tests. Each one runs the built App in the same sandbox the bot
13
+ runtime uses, so anything the manifest does not allow fails here too.
14
+ - `dist/`: build output. The App hash identifies exactly this build; an admin approves it.
15
+
16
+ The developer guide explains every handler, what `ctx` can do, the manifest and the
17
+ sandbox's limits: https://github.com/pollis-app/pollis/blob/main/docs/bots/developer-guide.md
@@ -0,0 +1,2 @@
1
+ node_modules/
2
+ dist/
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "version": "0.1.0",
4
+ "description": "A Pollis App.",
5
+ "private": true,
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "pollis app build",
9
+ "test": "pollis app test",
10
+ "typecheck": "tsc"
11
+ },
12
+ "dependencies": {
13
+ "@pollis-inc/app": "{{app}}"
14
+ },
15
+ "devDependencies": {
16
+ "@pollis-inc/cli": "{{cli}}",
17
+ "@types/node": "^22.19.0",
18
+ "typescript": "5.9.3"
19
+ }
20
+ }
@@ -0,0 +1,22 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { testApp } from "@pollis-inc/app/testing";
4
+
5
+ // Runs the built App in the same sandbox the bot runtime uses, offline.
6
+ const app = await testApp();
7
+
8
+ test("/hello greets by name", async () => {
9
+ const result = await app.command("hello", "Sam");
10
+ assert.ok(result.ok, result.error?.message);
11
+ assert.deepEqual(result.replies, ["Hello, Sam!"]);
12
+ });
13
+
14
+ test("/hello with no name greets the sender", async () => {
15
+ const result = await app.command("hello", "", { message: { author: { displayName: "Ann" } } });
16
+ assert.deepEqual(result.replies, ["Hello, Ann!"]);
17
+ });
18
+
19
+ test("a command the App did not declare never reaches it", async () => {
20
+ const result = await app.command("weather");
21
+ assert.deepEqual(result.actions, []);
22
+ });
@@ -0,0 +1,23 @@
1
+ import { app } from "@pollis-inc/app";
2
+
3
+ export default app({
4
+ manifest: {
5
+ // Where the App works. "*" means: whichever channels the admin picks
6
+ // when approving it. Use "#name" to ask for one channel by name.
7
+ read: { channels: ["*"] },
8
+ // What the App may do there. The admin sees this list before approving.
9
+ actions: ["reply"],
10
+ // No `egress`: this App cannot send anything outside the group.
11
+ // The slash commands members can pick in the composer.
12
+ commands: [{ name: "hello", description: "Say hello", arg_hint: "[name]" }],
13
+ },
14
+
15
+ // Runs when a member sends one of the commands above, e.g. "/hello Sam".
16
+ async onCommand(cmd, ctx) {
17
+ if (cmd.name !== "hello") {
18
+ return;
19
+ }
20
+ const who = cmd.args.trim() || cmd.message.author.displayName;
21
+ await ctx.reply(cmd.message, `Hello, ${who}!`);
22
+ },
23
+ });
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "skipLibCheck": true,
9
+ "types": ["node"]
10
+ },
11
+ "include": ["src"]
12
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.