woml-cli 1.0.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.
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "woml-cli",
3
+ "version": "1.0.1",
4
+ "description": "WOML workflow automation runtime and command-line interface",
5
+ "author": "Mohamed Ali Ben Othmen",
6
+ "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/dali-benothmen/woml.git",
10
+ "directory": "woml-cli"
11
+ },
12
+ "homepage": "https://github.com/dali-benothmen/woml#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/dali-benothmen/woml/issues"
15
+ },
16
+ "type": "module",
17
+ "bin": {
18
+ "woml": "./dist/cli.js"
19
+ },
20
+ "files": [
21
+ "dist/cli.js",
22
+ "dist/script-host.js",
23
+ "dist/script-host-worker.js",
24
+ "dist/notification-provider-host.js",
25
+ "dist/custom-notification-provider-host.js",
26
+ "dist/custom-notification-provider-worker.js",
27
+ "dist/cli.js.map",
28
+ "dist/script-host.js.map",
29
+ "dist/script-host-worker.js.map",
30
+ "dist/notification-provider-host.js.map",
31
+ "dist/custom-notification-provider-host.js.map",
32
+ "dist/custom-notification-provider-worker.js.map",
33
+ "slack/README.md",
34
+ "slack/manifest.json",
35
+ "README.md",
36
+ "LICENSE",
37
+ "NOTICE.md"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "engines": {
43
+ "bun": ">=1.3.14"
44
+ },
45
+ "optionalDependencies": {
46
+ "@woml-org/cli-darwin-x64": "1.0.1",
47
+ "@woml-org/cli-darwin-arm64": "1.0.1",
48
+ "@woml-org/cli-win32-x64-msvc": "1.0.1",
49
+ "@woml-org/cli-win32-arm64-msvc": "1.0.1",
50
+ "@woml-org/cli-linux-x64-gnu": "1.0.1",
51
+ "@woml-org/cli-linux-arm64-gnu": "1.0.1"
52
+ }
53
+ }
@@ -0,0 +1,132 @@
1
+ # WOML Slack Setup
2
+
3
+ This is the one-time workspace setup for WOML Slack approvals and Slack
4
+ triggers. WOML uses Socket Mode, so it does not need a public callback URL or
5
+ `woml serve`.
6
+
7
+ ## Install the app
8
+
9
+ 1. In Slack's app management page, choose **Create New App → From an app
10
+ manifest** and paste `manifest.json` from this directory.
11
+ 2. Install the app to the workspace. The manifest requests the scopes used for
12
+ approval messages, channel lookup, app mentions, and direct messages.
13
+ 3. Under **Basic Information → App-Level Tokens**, generate an app token with
14
+ the `connections:write` scope.
15
+ 4. Copy the **Bot User OAuth Token** (`xoxb-...`) and the **App-Level Token**
16
+ (`xapp-...`) into WOML's protected secret store:
17
+
18
+ ```text
19
+ woml secrets set SLACK_BOT_TOKEN
20
+ woml secrets set SLACK_APP_TOKEN
21
+ ```
22
+
23
+ Enter each value only at the hidden prompt. Do not place either token in a
24
+ `.woml` file, shell argument, environment committed to source control, or
25
+ chat message.
26
+
27
+ After changing any Bot Token Scope, choose **Reinstall to Workspace** and copy
28
+ the Bot User OAuth Token from that same Slack app again. The installed token,
29
+ not merely the permissions displayed in the app editor, is what Slack checks.
30
+ Its Bot Token Scopes must include:
31
+
32
+ ```text
33
+ chat:write
34
+ chat:write.public
35
+ app_mentions:read
36
+ channels:read
37
+ groups:read
38
+ im:history
39
+ ```
40
+
41
+ `channels:history` does not replace `channels:read`. WOML uses
42
+ `conversations.list` to resolve a readable `#channel` alias. Supplying a stable
43
+ Slack conversation ID (`C...` or `G...`) bypasses that name lookup, but does not
44
+ replace the permission required to post or the requirement to invite the app
45
+ to a private channel.
46
+
47
+ ## Choose channels
48
+
49
+ Public channel aliases such as `#woml-testing` work with the manifest as-is.
50
+ For a private channel, invite the WOML app to that channel first. Slack channel
51
+ IDs (`C...` or `G...`) are the most stable option and avoid name lookup.
52
+
53
+ ```xml
54
+ <notify>
55
+ <slack
56
+ channels="#woml-testing"
57
+ bot-token="{{secrets.SLACK_BOT_TOKEN}}"
58
+ app-token="{{secrets.SLACK_APP_TOKEN}}"
59
+ />
60
+ </notify>
61
+ ```
62
+
63
+ Then run the workflow normally:
64
+
65
+ ```text
66
+ woml run workflow.woml
67
+ ```
68
+
69
+ The repository includes `examples/slackApprovalWorkflow.woml` as a live smoke
70
+ test. Change its `channels` value to a channel in your workspace before running
71
+ it.
72
+
73
+ The terminal remains attached while Socket Mode waits for a reviewer. Clicking
74
+ Approve or Reject in any delivered channel resolves the one shared approval,
75
+ updates all delivered messages, and continues only the selected WOML route.
76
+
77
+ ## Define a Slack trigger
78
+
79
+ ```xml
80
+ <triggers>
81
+ <slack
82
+ id="agentMessage"
83
+ events="app-mention,direct-message"
84
+ channels="woml-testing,agent-support"
85
+ bot-token="{{secrets.SLACK_BOT_TOKEN}}"
86
+ app-token="{{secrets.SLACK_APP_TOKEN}}"
87
+ />
88
+ </triggers>
89
+ ```
90
+
91
+ WOML validates and compiles this definition into Model v7. Keep
92
+ `woml run workflow.woml` active, then mention the app in a listed channel or
93
+ send it a direct message. A valid message starts one durable workflow run and
94
+ is available to scripts as:
95
+
96
+ ```js
97
+ context.payload.type
98
+ context.payload.text
99
+ context.payload.userId
100
+ context.payload.channelId
101
+ context.payload.messageTs
102
+ context.payload.threadTs
103
+ context.payload.teamId
104
+ ```
105
+
106
+ Channel filters apply to app mentions; direct messages remain accepted when
107
+ `direct-message` is enabled. Repeating the same Slack event does not execute a
108
+ second run. After changing scopes or event subscriptions, reinstall the app to
109
+ the workspace and refresh the stored bot token.
110
+
111
+ The repository includes `examples/slackTriggerWorkflow.woml`, configured for
112
+ `#woml-testing`. Edit that channel filter if your workspace uses another name.
113
+
114
+ ## Common failures
115
+
116
+ - `WOML_SLACK_AUTH_FAILED`: replace a revoked, expired, or wrong token.
117
+ - `WOML_SLACK_PERMISSION_DENIED`: verify the scopes above under **Bot Token
118
+ Scopes**, reinstall the app, refresh the stored `xoxb-...` token, and ensure
119
+ the app belongs to a private destination. When Slack returns safe scope
120
+ metadata, WOML prints the failed operation, missing scopes, granted scopes,
121
+ destination, and reinstall action directly in the terminal.
122
+ - `WOML_SLACK_DESTINATION_INVALID`: verify the channel name/ID and app
123
+ visibility.
124
+ - `WOML_SLACK_RATE_LIMITED`: WOML follows Slack's `Retry-After` value through
125
+ its durable retry policy.
126
+ - `WOML_SLACK_TRIGGER_SCOPE_MISSING`: add the missing scopes, reinstall the
127
+ app, and refresh the stored token.
128
+ - `WOML_SLACK_TRIGGER_UNAVAILABLE`: keep WOML active and restore Socket Mode;
129
+ an event is not acknowledged before durable admission, so Slack may redeliver
130
+ it safely.
131
+ - `WOML_NOTIFICATION_DELIVERY_AMBIGUOUS`: the connection ended after a send
132
+ may have reached Slack. WOML fails closed instead of creating a duplicate.
@@ -0,0 +1,39 @@
1
+ {
2
+ "display_information": {
3
+ "name": "WOML Approvals",
4
+ "description": "Approve or reject WOML workflow runs from Slack.",
5
+ "background_color": "#4f46e5"
6
+ },
7
+ "features": {
8
+ "bot_user": {
9
+ "display_name": "WOML",
10
+ "always_online": false
11
+ }
12
+ },
13
+ "oauth_config": {
14
+ "scopes": {
15
+ "bot": [
16
+ "chat:write",
17
+ "chat:write.public",
18
+ "app_mentions:read",
19
+ "channels:read",
20
+ "groups:read",
21
+ "im:history"
22
+ ]
23
+ }
24
+ },
25
+ "settings": {
26
+ "event_subscriptions": {
27
+ "bot_events": [
28
+ "app_mention",
29
+ "message.im"
30
+ ]
31
+ },
32
+ "interactivity": {
33
+ "is_enabled": true
34
+ },
35
+ "org_deploy_enabled": false,
36
+ "socket_mode_enabled": true,
37
+ "token_rotation_enabled": false
38
+ }
39
+ }