@michaelschnyder/teams-cli 0.1.0 → 0.1.1-canary.2.1.g2e6c221f
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 +64 -185
- package/dist/auth.js +9 -1
- package/dist/build-info.json +34 -0
- package/dist/cli.js +328 -58
- package/dist/commands/version.js +123 -13
- package/dist/config.js +2 -1
- package/dist/policy-editor-client.js +472 -0
- package/dist/policy-editor.js +617 -0
- package/dist/policy.js +88 -31
- package/dist/settings.js +51 -0
- package/dist/skills/teams-cli/SKILL.md +101 -18
- package/dist/skills.js +74 -5
- package/dist/storage.js +3 -2
- package/dist/teams-client.js +122 -2
- package/dist/update.js +86 -57
- package/dist/version.js +77 -2
- package/docs/releasing.md +22 -17
- package/docs/use/agent-skills.md +41 -0
- package/docs/use/assets/policy-editor.png +0 -0
- package/docs/use/authentication.md +65 -11
- package/docs/use/commands.md +121 -0
- package/docs/use/installation.md +136 -0
- package/docs/use/policies.md +146 -53
- package/docs/use/profiles.md +41 -25
- package/package.json +18 -7
- package/CHANGELOG.md +0 -12
- package/dist/skills/teams-authentication/SKILL.md +0 -30
- package/dist/skills/teams-messaging-policies/SKILL.md +0 -26
- package/dist/skills/teams-reading/SKILL.md +0 -29
- package/dist/upgrade.js +0 -45
package/README.md
CHANGED
|
@@ -1,248 +1,127 @@
|
|
|
1
1
|
# teams-cli
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A command-line client that gives people and compatible coding agents access to Microsoft Teams through a persistent local browser session.
|
|
4
4
|
|
|
5
5
|
> [!WARNING]
|
|
6
6
|
> This project relies on undocumented Microsoft Teams behavior and a Microsoft first-party client identity. It is unsupported, may be blocked by tenant policy, and may stop working without notice. Obtain organizational approval before using it, and never run live write tests against a production tenant.
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
- Node.js 22.20 or newer. Node.js 24 LTS is recommended.
|
|
11
|
-
- Microsoft Edge or Google Chrome.
|
|
12
|
-
- A Microsoft 365 account with Teams access.
|
|
13
|
-
|
|
14
|
-
### Install Node.js on Windows
|
|
15
|
-
|
|
16
|
-
Open PowerShell and install the current Node.js LTS release with Windows Package Manager:
|
|
17
|
-
|
|
18
|
-
```powershell
|
|
19
|
-
winget install --id OpenJS.NodeJS.LTS --exact --source winget
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Open a new terminal, then verify both tools:
|
|
23
|
-
|
|
24
|
-
```powershell
|
|
25
|
-
node --version
|
|
26
|
-
npm --version
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If `winget` is unavailable, install Microsoft App Installer or use the signed installer from the [Node.js download page](https://nodejs.org/en/download).
|
|
30
|
-
|
|
31
|
-
### Install Node.js on macOS
|
|
32
|
-
|
|
33
|
-
With [Homebrew](https://brew.sh/):
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
brew install node@24
|
|
37
|
-
echo 'export PATH="$(brew --prefix node@24)/bin:$PATH"' >> ~/.zshrc
|
|
38
|
-
source ~/.zshrc
|
|
39
|
-
node --version
|
|
40
|
-
npm --version
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Alternatively, use the signed macOS package from the [Node.js download page](https://nodejs.org/en/download).
|
|
44
|
-
|
|
45
|
-
### Install Node.js on Linux
|
|
46
|
-
|
|
47
|
-
Distribution repositories may contain a Node.js version older than this CLI requires. A version manager keeps the runtime separate from system packages. The following follows the [Node.js download guidance](https://nodejs.org/en/download) using `nvm`; inspect downloaded installation scripts before running them:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
curl -o nvm-install.sh https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh
|
|
51
|
-
less nvm-install.sh
|
|
52
|
-
bash nvm-install.sh
|
|
53
|
-
. "$HOME/.nvm/nvm.sh"
|
|
54
|
-
nvm install 24
|
|
55
|
-
node --version
|
|
56
|
-
npm --version
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Node.js also publishes signed standalone Linux archives on its download page.
|
|
8
|
+
## Quick start
|
|
60
9
|
|
|
61
|
-
|
|
10
|
+
You need Node.js 22.20 or newer, Microsoft Edge or Google Chrome, and a Microsoft 365 account with Teams access. Node.js 24 LTS is recommended. See the [installation guide](docs/use/installation.md) for operating-system-specific setup and troubleshooting.
|
|
62
11
|
|
|
63
|
-
Install the
|
|
12
|
+
### 1. Install the CLI
|
|
64
13
|
|
|
65
14
|
```bash
|
|
66
15
|
npm install --global @michaelschnyder/teams-cli
|
|
67
16
|
teams-cli --version
|
|
68
|
-
teams-cli --help
|
|
69
17
|
```
|
|
70
18
|
|
|
71
|
-
|
|
19
|
+
### 2. Sign in
|
|
72
20
|
|
|
73
21
|
```bash
|
|
74
|
-
|
|
22
|
+
teams-cli login
|
|
75
23
|
```
|
|
76
24
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## Quick start
|
|
80
|
-
|
|
81
|
-
Interactive login opens a dedicated Edge profile by default:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
teams-cli --profile work --tenant YOUR_TENANT_ID auth login
|
|
85
|
-
teams-cli --profile work auth whoami
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
The successful login records the verified tenant, user, and browser in the named profile. Subsequent commands reuse identity-isolated tokens and refresh them from the saved browser state when necessary.
|
|
89
|
-
|
|
90
|
-
Discover Teams data:
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
teams-cli --profile work person search "Alice" --json
|
|
94
|
-
teams-cli --profile work chat list --json
|
|
95
|
-
teams-cli --profile work channel list --json
|
|
96
|
-
teams-cli --profile work message list --chat CHAT_ID --json
|
|
97
|
-
```
|
|
25
|
+
`teams-cli login` is the convenient alias for `teams-cli auth login`. It opens a dedicated Microsoft Edge profile by default, or a dedicated Google Chrome profile when selected. It does not reuse your normal browser profile or its signed-in session. The CLI discovers the Teams tenant and user, then saves them in the implicit `default` profile. Most users never need to provide a tenant ID or create a named profile.
|
|
98
26
|
|
|
99
|
-
|
|
27
|
+
### 3. Install the agent skill
|
|
100
28
|
|
|
101
29
|
```bash
|
|
102
|
-
teams-cli
|
|
103
|
-
teams-cli --profile work policy check send --chat CHAT_ID
|
|
104
|
-
teams-cli --profile work message send --chat CHAT_ID --body "Hello"
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Use `--channel CHANNEL_ID` instead of `--chat CHAT_ID` for channel messages. A message body can also be piped on stdin.
|
|
108
|
-
|
|
109
|
-
## Command overview
|
|
110
|
-
|
|
111
|
-
```text
|
|
112
|
-
teams-cli [--profile NAME] [--tenant ID] [--user ID] [--browser edge|chrome]
|
|
113
|
-
|
|
114
|
-
version show the installed version or upgrade it
|
|
115
|
-
skills list, locate, install, and refresh packaged agent skills
|
|
116
|
-
auth login, refresh, whoami, tokens, logout
|
|
117
|
-
profile list, show, save, remove
|
|
118
|
-
policy init, list, show, check, activate
|
|
119
|
-
person search, get, image
|
|
120
|
-
chat list, get
|
|
121
|
-
channel list, get
|
|
122
|
-
message list, get, send
|
|
30
|
+
teams-cli skills install
|
|
123
31
|
```
|
|
124
32
|
|
|
125
|
-
|
|
33
|
+
The packaged `teams-cli` skill teaches compatible coding agents how to authenticate, discover Teams resources, read and send messages, and respect policies. Auto-detection supports Codex, Claude Code, Cursor, GitHub Copilot, OpenCode, Windsurf, Gemini CLI, Pi, and generic `.agents/skills` environments.
|
|
126
34
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
Person, chat, channel, and message commands that return data support `--json`. JSON payloads stay on stdout. Progress, warnings, update notices, and sanitized debug output stay on stderr, so scripts can safely pipe stdout.
|
|
35
|
+
Installing the CLI and its skill is usually everything needed to start using Teams with an agent. See [agent skill installation](docs/use/agent-skills.md) when auto-detection is unavailable or several agent environments are installed.
|
|
130
36
|
|
|
131
|
-
|
|
37
|
+
### 4. Add a workspace policy
|
|
132
38
|
|
|
133
|
-
|
|
39
|
+
Policies are optional but recommended for agent-assisted work. From the workspace the agent will operate in, run:
|
|
134
40
|
|
|
135
41
|
```bash
|
|
136
|
-
teams-cli
|
|
137
|
-
teams-cli profile show work
|
|
138
|
-
teams-cli --tenant TENANT_ID --user USER_ID --browser chrome profile save work
|
|
139
|
-
teams-cli profile remove work
|
|
42
|
+
teams-cli policy edit --open
|
|
140
43
|
```
|
|
141
44
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
See [profiles and precedence](docs/use/profiles.md) and [authentication and token handling](docs/use/authentication.md).
|
|
145
|
-
|
|
146
|
-
## Policies
|
|
147
|
-
|
|
148
|
-
Policies are optional. Inactive policies audit and warn without enforcing; active policies enforce the intersection of all matching subject-path rules. A malformed policy store puts authenticated operations into fail-safe mode. Active policies cannot be deactivated through this CLI.
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
teams-cli --profile work policy init project-agent
|
|
152
|
-
teams-cli policy show project-agent
|
|
153
|
-
teams-cli policy check send --chat CHAT_ID
|
|
154
|
-
teams-cli policy activate project-agent
|
|
155
|
-
```
|
|
45
|
+
Choose which people, group chats, and channels may be read or posted to, then save and activate the policy. Policies are cooperative CLI-level safeguards: they help prevent accidental access and posts through `teams-cli`, but they are not an operating-system sandbox or a server-side Teams permission.
|
|
156
46
|
|
|
157
|
-
|
|
47
|
+
See [workspace policies](docs/use/policies.md) for the editor, audit mode, activation, manual editing and deactivation, overlapping policies, and the security boundary.
|
|
158
48
|
|
|
159
|
-
###
|
|
49
|
+
### 5. Use Teams
|
|
160
50
|
|
|
161
|
-
|
|
51
|
+
Ask a compatible agent naturally after installing the skill, for example:
|
|
162
52
|
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
teams-cli --profile work auth tokens --decode
|
|
53
|
+
```text
|
|
54
|
+
Find my chat with Alice and summarize the latest five messages.
|
|
55
|
+
Draft a reply to the Project Phoenix channel, but show it to me before sending.
|
|
167
56
|
```
|
|
168
57
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
## Agent skills
|
|
172
|
-
|
|
173
|
-
The npm package includes skills that teach compatible coding agents how to use this CLI safely. Auto-detection supports Codex, Claude Code, Cursor, GitHub Copilot, OpenCode, Windsurf, Gemini CLI, Pi, and generic `.agents/skills` environments.
|
|
58
|
+
Or use the CLI directly:
|
|
174
59
|
|
|
175
60
|
```bash
|
|
176
|
-
teams-cli
|
|
177
|
-
teams-cli
|
|
178
|
-
teams-cli
|
|
61
|
+
teams-cli auth whoami
|
|
62
|
+
teams-cli person search "Alice" --json
|
|
63
|
+
teams-cli chat search "Alice" --json
|
|
64
|
+
teams-cli channel list --json
|
|
65
|
+
teams-cli message list --chat CHAT_ID --json
|
|
66
|
+
teams-cli message send --person alice@example.com --body "Hello"
|
|
179
67
|
```
|
|
180
68
|
|
|
181
|
-
|
|
69
|
+
For an existing group chat or channel, use `--chat CHAT_ID` or `--channel CHANNEL_ID`. You can optionally preview a known target with `teams-cli policy check send`; the send command always enforces the applicable policy again immediately before posting. Sending is externally visible and the CLI has no delete or undo command.
|
|
182
70
|
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
teams-cli
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
71
|
+
```mermaid
|
|
72
|
+
flowchart LR
|
|
73
|
+
install[Install teams-cli] --> login[Sign in once]
|
|
74
|
+
login --> skill[Install the agent skill]
|
|
75
|
+
skill --> policy[Recommended: add a workspace policy]
|
|
76
|
+
policy --> use[Ask an agent or run commands]
|
|
189
77
|
```
|
|
190
78
|
|
|
191
|
-
|
|
79
|
+
## Important concepts
|
|
192
80
|
|
|
193
|
-
|
|
81
|
+
### Default session
|
|
194
82
|
|
|
195
|
-
|
|
83
|
+
`teams-cli login` discovers and records the verified tenant, user, and browser in the `default` profile. The longer `teams-cli auth login` form remains available. Named profiles and explicit `--tenant` or `--user` flags are optional tools for people who deliberately maintain more than one identity. Profiles select configuration; they are not permission boundaries. See [authentication](docs/use/authentication.md) and [optional profiles](docs/use/profiles.md).
|
|
196
84
|
|
|
197
|
-
|
|
85
|
+
### Agent skill
|
|
198
86
|
|
|
199
|
-
|
|
200
|
-
export NO_UPDATE_NOTIFIER=1
|
|
201
|
-
# or
|
|
202
|
-
export TEAMS_CLI_DISABLE_UPDATE_CHECK=1
|
|
203
|
-
```
|
|
87
|
+
The skill gives an agent the operational knowledge that command help alone cannot provide: discover current IDs before using them, verify the active identity, keep JSON payloads separate from diagnostics, optionally preview policy decisions, and stop on denials. Installed copies can be refreshed when the CLI is upgraded.
|
|
204
88
|
|
|
205
|
-
|
|
89
|
+
### Cooperative policies
|
|
206
90
|
|
|
207
|
-
|
|
208
|
-
teams-cli version --upgrade
|
|
209
|
-
```
|
|
91
|
+
Policies are YAML files matched against the canonical working-directory path. Inactive policies audit and warn; active policies constrain identities, message reads, posts, and raw-token export. All matching active policies must allow an operation, so overlapping policies can only preserve or narrow access.
|
|
210
92
|
|
|
211
|
-
|
|
93
|
+
These safeguards apply to operations made through this CLI. A sufficiently privileged local process can change policy files, and a bearer token used by another HTTP client is outside the CLI's checks. Read-only file permissions add protection against accidental edits but do not make a policy immutable.
|
|
212
94
|
|
|
213
|
-
|
|
95
|
+
### Structured output
|
|
214
96
|
|
|
215
|
-
|
|
216
|
-
- Browser launch fails: install Edge or Chrome and select it with `--browser edge|chrome`.
|
|
217
|
-
- Login succeeds but Teams access fails: confirm that the account has a Teams-enabled Microsoft 365 license.
|
|
218
|
-
- Stored identity is rejected: run `auth login` again for the selected tenant, user, and profile.
|
|
219
|
-
- An agent environment is not detected: pass its name explicitly to `skills install`.
|
|
220
|
-
- Use `--debug` for sanitized request method, endpoint, status, duration, and retry diagnostics. Headers, tokens, cookies, query values, and bodies are not logged.
|
|
97
|
+
Person, chat, channel, and message commands support `--json`. JSON payloads stay on stdout, while progress, warnings, update notices, and sanitized diagnostics stay on stderr. Scripts and agents can therefore consume stdout without mixing it with status text.
|
|
221
98
|
|
|
222
|
-
##
|
|
99
|
+
## Command reference
|
|
223
100
|
|
|
224
|
-
|
|
101
|
+
| Command | Purpose | Examples and details |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| `login` | Sign in using the default session; alias for `auth login` | [Authentication](docs/use/authentication.md) |
|
|
104
|
+
| `version` | Inspect build provenance, check for updates, or select the notification channel | [Installation and upgrades](docs/use/installation.md) |
|
|
105
|
+
| `skills` | List, locate, install, and refresh the packaged agent skill | [Agent skill installation](docs/use/agent-skills.md) |
|
|
106
|
+
| `auth` | Login, refresh, inspect, export tokens, or logout | [Authentication](docs/use/authentication.md) |
|
|
107
|
+
| `profile` | Manage optional named identity selectors | [Profiles](docs/use/profiles.md) |
|
|
108
|
+
| `policy` | Create, inspect, check, activate, and edit safeguards | [Policies](docs/use/policies.md) |
|
|
109
|
+
| `person` | Search people, inspect profiles, and retrieve images | [Command examples](docs/use/commands.md) |
|
|
110
|
+
| `chat` | Search, explicitly enumerate, and inspect chats | [Command examples](docs/use/commands.md) |
|
|
111
|
+
| `channel` | List and inspect teams and channels | [Command examples](docs/use/commands.md) |
|
|
112
|
+
| `message` | List, get, and send messages | [Command examples](docs/use/commands.md) |
|
|
225
113
|
|
|
226
|
-
|
|
227
|
-
npm uninstall --global @michaelschnyder/teams-cli
|
|
228
|
-
```
|
|
114
|
+
Run `teams-cli --help` or `teams-cli <command> --help` for the complete options supported by the installed version.
|
|
229
115
|
|
|
230
|
-
|
|
116
|
+
## Local state and security
|
|
231
117
|
|
|
232
|
-
|
|
118
|
+
Configuration, authentication, dedicated browser state, policies, update state, and managed skill-installation records live under `~/.teams-cli/`. Secret-bearing files and directories use owner-only permissions on supported operating systems.
|
|
233
119
|
|
|
234
|
-
|
|
120
|
+
Raw bearer tokens can be exported by authentication commands when applicable policies allow it. Treat them like passwords: never paste them into prompts, logs, issues, or source files. See the [security model](docs/build/security-model.md) for the complete trust boundary.
|
|
235
121
|
|
|
236
|
-
|
|
237
|
-
npm install
|
|
238
|
-
npm run check
|
|
239
|
-
npm test
|
|
240
|
-
npm run build
|
|
241
|
-
npm run package:check
|
|
242
|
-
npm run package:smoke
|
|
243
|
-
```
|
|
122
|
+
## Contributing
|
|
244
123
|
|
|
245
|
-
See [CONTRIBUTING.md](
|
|
124
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing, and contribution guidance.
|
|
246
125
|
|
|
247
126
|
## License
|
|
248
127
|
|
package/dist/auth.js
CHANGED
|
@@ -12,6 +12,14 @@ const defaultDependencies = {
|
|
|
12
12
|
exchangeToken: exchangeInitialToken,
|
|
13
13
|
now: () => new Date(),
|
|
14
14
|
};
|
|
15
|
+
export class InteractiveLoginRequiredError extends Error {
|
|
16
|
+
code;
|
|
17
|
+
constructor(code) {
|
|
18
|
+
super(`Microsoft needs an interactive sign-in (${code}).`);
|
|
19
|
+
this.code = code;
|
|
20
|
+
this.name = "InteractiveLoginRequiredError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
15
23
|
const execFileAsync = promisify(execFile);
|
|
16
24
|
export async function passwordFromCommand(command) {
|
|
17
25
|
if (!isAbsolute(command))
|
|
@@ -113,7 +121,7 @@ function createStoredSession(tokens, exchanged, browser, expectedTenant, now) {
|
|
|
113
121
|
}
|
|
114
122
|
function interactiveRefreshError(error) {
|
|
115
123
|
if (error instanceof OAuthRedirectError) {
|
|
116
|
-
throw new
|
|
124
|
+
throw new InteractiveLoginRequiredError(error.code);
|
|
117
125
|
}
|
|
118
126
|
throw error;
|
|
119
127
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"version": "0.1.1-canary.2.1.g2e6c221f",
|
|
4
|
+
"channel": "canary",
|
|
5
|
+
"builtAt": "2026-09-04T04:46:46.454Z",
|
|
6
|
+
"source": {
|
|
7
|
+
"branch": "codex/canary-snapshot-channels",
|
|
8
|
+
"commit": "2e6c221f49e6aeb69fa7c33f98c1b0e09a42ffce",
|
|
9
|
+
"commitUrl": "https://github.com/michaelschnyder/teams-cli/commit/2e6c221f49e6aeb69fa7c33f98c1b0e09a42ffce",
|
|
10
|
+
"pullRequest": 11,
|
|
11
|
+
"pullRequestUrl": "https://github.com/michaelschnyder/teams-cli/pull/11",
|
|
12
|
+
"author": "michaelschnyder"
|
|
13
|
+
},
|
|
14
|
+
"trigger": {
|
|
15
|
+
"kind": "merged-pull-request",
|
|
16
|
+
"actor": "michaelschnyder"
|
|
17
|
+
},
|
|
18
|
+
"runner": {
|
|
19
|
+
"name": "GitHub Actions 1000001056",
|
|
20
|
+
"os": "Linux",
|
|
21
|
+
"architecture": "X64"
|
|
22
|
+
},
|
|
23
|
+
"workflow": {
|
|
24
|
+
"runId": "33837821954",
|
|
25
|
+
"runNumber": "2",
|
|
26
|
+
"runAttempt": "1",
|
|
27
|
+
"url": "https://github.com/michaelschnyder/teams-cli/actions/runs/33837821954"
|
|
28
|
+
},
|
|
29
|
+
"releaseNotes": {
|
|
30
|
+
"title": "Add canary and snapshot release channels",
|
|
31
|
+
"body": "## Summary\n\n- publish stable releases, merged-PR canaries, and authorized branch snapshots through one npm workflow\n- embed build provenance and release notes, add channel-aware updates, and protect npx executions\n- show the exact installed version and GitHub link in the policy editor\n- standardize CI on latest Node.js LTS across Linux, macOS, and Windows\n- remove the manually maintained changelog in favor of release, pull request, and commit notes\n\n## Verification\n\n- npm run check\n- npm test (97 tests)\n- npm run build\n- npm run package:check\n- npm run package:smoke\n- npm audit --omit=dev",
|
|
32
|
+
"url": "https://github.com/michaelschnyder/teams-cli/pull/11"
|
|
33
|
+
}
|
|
34
|
+
}
|