dotshare-cli 1.0.0 → 3.0.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 +201 -21
- package/README.md +245 -189
- package/SECURITY.md +145 -0
- package/bin/dotshare-agent.js +7 -0
- package/bin/dotshare-cli.js +11 -7
- package/bin/dotshare-mcp.js +6 -0
- package/docs/AGENT_INTEGRATION.md +541 -0
- package/out/agent/commands.js +119 -0
- package/out/agent/server.js +97 -0
- package/out/cli/commands.js +128 -376
- package/package.json +34 -94
- package/bin/dotshare-scheduler.js +0 -208
- package/out/analytics.js +0 -67
- package/out/analytics.js.map +0 -1
- package/out/bluesky.js +0 -100
- package/out/bluesky.js.map +0 -1
- package/out/cli/commands.js.map +0 -1
- package/out/cli/config.js +0 -144
- package/out/cli/config.js.map +0 -1
- package/out/credential-provider.js +0 -92
- package/out/credential-provider.js.map +0 -1
- package/out/discord.js +0 -85
- package/out/discord.js.map +0 -1
- package/out/extension.js +0 -1383
- package/out/extension.js.map +0 -1
- package/out/facebook.js +0 -66
- package/out/facebook.js.map +0 -1
- package/out/gemini.js +0 -219
- package/out/gemini.js.map +0 -1
- package/out/linkedin.js +0 -110
- package/out/linkedin.js.map +0 -1
- package/out/message-handlers.js +0 -391
- package/out/message-handlers.js.map +0 -1
- package/out/openai.js +0 -217
- package/out/openai.js.map +0 -1
- package/out/post-executor.js +0 -168
- package/out/post-executor.js.map +0 -1
- package/out/reddit.js +0 -538
- package/out/reddit.js.map +0 -1
- package/out/scheduled-posts.js +0 -100
- package/out/scheduled-posts.js.map +0 -1
- package/out/scheduler.js +0 -98
- package/out/scheduler.js.map +0 -1
- package/out/storage-manager.js +0 -403
- package/out/storage-manager.js.map +0 -1
- package/out/telegram.js +0 -104
- package/out/telegram.js.map +0 -1
- package/out/types.js +0 -3
- package/out/types.js.map +0 -1
- package/out/webview-provider.js +0 -168
- package/out/webview-provider.js.map +0 -1
- package/out/x.js +0 -55
- package/out/x.js.map +0 -1
- package/out/xai.js +0 -235
- package/out/xai.js.map +0 -1
- package/src/cli/commands.ts +0 -380
- package/src/cli/config.ts +0 -148
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
const { Command } = require('commander');
|
|
4
|
+
const { setupAgentCommands } = require('../out/agent/commands.js');
|
|
5
|
+
const program = new Command().name('dotshare-agent').description('DotShare publishing tools for AI agents');
|
|
6
|
+
setupAgentCommands(program);
|
|
7
|
+
program.parseAsync(process.argv).catch(() => { process.exitCode = 1; });
|
package/bin/dotshare-cli.js
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* DotShare CLI - Interactive command-line interface for social media posting
|
|
5
5
|
* Usage: dotshare [command] [options]
|
|
6
|
+
*
|
|
7
|
+
* Built output lives in ../out/cli/commands.js (see esbuild.js, "Standalone CLI").
|
|
6
8
|
*/
|
|
7
9
|
|
|
8
10
|
const { Command } = require('commander');
|
|
9
|
-
const { setupInitCommand, setupLoginCommand, setupWhoamiCommand, setupDefaultCommand } = require('../out/cli/commands.js');
|
|
11
|
+
const { setupInitCommand, setupLoginCommand, setupWhoamiCommand, setupDefaultCommand, setupAgentCommands } = require('../out/cli/commands.js');
|
|
12
|
+
const { version } = require('../package.json');
|
|
10
13
|
|
|
11
14
|
const program = new Command();
|
|
12
15
|
|
|
@@ -14,7 +17,7 @@ const program = new Command();
|
|
|
14
17
|
program
|
|
15
18
|
.name('dotshare')
|
|
16
19
|
.description('DotShare CLI - Post to social media platforms')
|
|
17
|
-
.version(
|
|
20
|
+
.version(version)
|
|
18
21
|
.option('-v, --verbose', 'Enable verbose output');
|
|
19
22
|
|
|
20
23
|
// Setup all commands
|
|
@@ -22,6 +25,7 @@ setupInitCommand(program);
|
|
|
22
25
|
setupLoginCommand(program);
|
|
23
26
|
setupWhoamiCommand(program);
|
|
24
27
|
setupDefaultCommand(program);
|
|
28
|
+
setupAgentCommands(program);
|
|
25
29
|
|
|
26
30
|
// Add help examples
|
|
27
31
|
program.addHelpText('after', `
|
|
@@ -29,11 +33,11 @@ Examples:
|
|
|
29
33
|
$ dotshare init # Initialize CLI configuration
|
|
30
34
|
$ dotshare login telegram # Authenticate with Telegram
|
|
31
35
|
$ dotshare login linkedin # Authenticate with LinkedIn
|
|
32
|
-
$ dotshare login reddit # Authenticate with Reddit
|
|
33
36
|
$ dotshare whoami # Show current configuration
|
|
34
|
-
$ dotshare
|
|
35
|
-
$ dotshare
|
|
36
|
-
$ dotshare
|
|
37
|
+
$ dotshare accounts list # List local agent accounts
|
|
38
|
+
$ dotshare drafts list # Read saved drafts
|
|
39
|
+
$ dotshare security protect # Encrypt existing local records
|
|
40
|
+
$ dotshare publish --input post.json # Publish directly to named accounts
|
|
37
41
|
|
|
38
42
|
For more information, visit: https://github.com/kareem2099/DotShare
|
|
39
43
|
`);
|
|
@@ -44,4 +48,4 @@ if (process.argv.length === 2) {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
// Parse arguments
|
|
47
|
-
program.
|
|
51
|
+
program.parseAsync(process.argv).catch(() => { process.exitCode = 1; });
|
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
# DotShare for AI agents
|
|
2
|
+
|
|
3
|
+
Connect Codex or another MCP client to DotShare, then ask it to publish a post,
|
|
4
|
+
images, a thread, or a Dev.to article to named accounts. The agent supplies content;
|
|
5
|
+
DotShare handles credentials, platform requests and durable publication receipts.
|
|
6
|
+
The local MCP server uses stdio and does not require a separate model/API key.
|
|
7
|
+
|
|
8
|
+
## Install and set up
|
|
9
|
+
|
|
10
|
+
Requires Node.js 22.12+ and an unlocked OS credential store. On Linux, a working
|
|
11
|
+
Secret Service/keyring session is required. There is no plaintext secret fallback.
|
|
12
|
+
|
|
13
|
+
Download `dotshare-cli-3.0.0.tgz` from the [GitHub release](https://github.com/kareem2099/DotShare/releases/tag/v3.6.0).
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install -g ./dotshare-cli-3.0.0.tgz
|
|
17
|
+
dotshare-agent setup
|
|
18
|
+
dotshare-agent doctor
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To build and configure from source instead:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm ci
|
|
25
|
+
npm run compile
|
|
26
|
+
node bin/dotshare-agent.js setup
|
|
27
|
+
node bin/dotshare-agent.js doctor
|
|
28
|
+
node bin/dotshare-agent.js accounts add personal-mastodon --platform mastodon --name "Personal Mastodon"
|
|
29
|
+
node bin/dotshare-agent.js accounts add work-linkedin --platform linkedin --name "Work LinkedIn"
|
|
30
|
+
node bin/dotshare-agent.js accounts list
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Account setup prompts hide typed credentials. Connect each account in your
|
|
34
|
+
terminal; do not paste platform secrets into an agent conversation. Existing VS Code
|
|
35
|
+
accounts are not automatically copied. Multiple accounts on one platform use
|
|
36
|
+
different IDs. To replace an account's credentials, run `accounts add` with its ID.
|
|
37
|
+
`accounts remove <id>` removes the local account and deletes its credential from the OS keyring.
|
|
38
|
+
It does not revoke the token on the platform. Expired/revoked platform tokens must
|
|
39
|
+
be replaced using `accounts add`; the local agent does not run browser OAuth or
|
|
40
|
+
automatically refresh user-supplied OAuth tokens.
|
|
41
|
+
|
|
42
|
+
After packaging/installing the CLI, the same commands are available through
|
|
43
|
+
`dotshare`, `dotshare-agent`, and the dedicated `dotshare-mcp` server entrypoint.
|
|
44
|
+
|
|
45
|
+
### Credential fields
|
|
46
|
+
|
|
47
|
+
| Platform | Fields entered during setup |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| LinkedIn | `accessToken` (user OAuth token with posting access) |
|
|
50
|
+
| X | `accessToken` (user OAuth token; media also requires media upload access) |
|
|
51
|
+
| Telegram | `botToken`, `chatId` (the bot must be able to post in this chat/channel) |
|
|
52
|
+
| Discord | `webhookUrl` (HTTPS `discord.com/api/.../webhooks/...` URL) |
|
|
53
|
+
| Bluesky | `identifier`, `password` (use an app password) |
|
|
54
|
+
| Mastodon | `instance`, `accessToken` (status/media publishing scopes) |
|
|
55
|
+
| Dev.to | `apiKey` |
|
|
56
|
+
|
|
57
|
+
For automated local setup, `accounts add --input -` reads account JSON from stdin:
|
|
58
|
+
`{"id":"personal","name":"Personal","platform":"mastodon","credentials":{"instance":"https://your.instance","accessToken":"..."}}`.
|
|
59
|
+
Credentials are saved to the OS keyring. Only account IDs, labels and platform names
|
|
60
|
+
are written to `~/.dotshare/accounts.json`. Use stdin or an interactive terminal;
|
|
61
|
+
avoid putting credentials in command arguments or committed files.
|
|
62
|
+
|
|
63
|
+
## Local storage protection
|
|
64
|
+
|
|
65
|
+
Linux entries require Secret Service explicitly; there is no automatic kernel-keyring
|
|
66
|
+
fallback. macOS/Windows use their native OS credential stores. New drafts, custom
|
|
67
|
+
templates and operation journals always use authenticated AES-256-GCM encryption.
|
|
68
|
+
The master key is generated randomly and stored in the OS keyring only; a locked,
|
|
69
|
+
missing or mismatched key fails closed. Restore the original OS key and security.json
|
|
70
|
+
instead of generating a replacement key for existing ciphertext.
|
|
71
|
+
|
|
72
|
+
For an existing installation, stop active publications, then run:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
node bin/dotshare-agent.js security status
|
|
76
|
+
node bin/dotshare-agent.js security protect
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`protect` verifies existing account access, repairs private permissions and converts
|
|
80
|
+
existing plaintext records in place. It verifies preserved content without making
|
|
81
|
+
plaintext backups. Restart all DotShare MCP clients and VS Code windows afterwards
|
|
82
|
+
so older processes cannot write the previous format. Prior snapshots/backups may
|
|
83
|
+
still contain plaintext; the migration does not securely erase old disk pages.
|
|
84
|
+
|
|
85
|
+
Credential JSON input files must be private (0600 on Unix), regular files owned by
|
|
86
|
+
the current user; interactive hidden prompts or stdin are preferred. The old CLI
|
|
87
|
+
relay posting/login path is disabled because it forwarded platform keys or echoed
|
|
88
|
+
legacy input. Use named local accounts and the direct agent publishing workflow.
|
|
89
|
+
|
|
90
|
+
See [the security model, recovery and limits](../SECURITY.md). Platform keys are not
|
|
91
|
+
stored in draft/template files. Account IDs/labels remain private metadata rather
|
|
92
|
+
than encrypted records. Encryption here does not attest the OS provider's own
|
|
93
|
+
at-rest encryption, protect an unlocked account from same-user malware, or audit
|
|
94
|
+
the separate DotSuite backend.
|
|
95
|
+
|
|
96
|
+
## Setup and diagnostics
|
|
97
|
+
|
|
98
|
+
Run these after installing the CLI package (or prefix the commands with
|
|
99
|
+
`node bin/dotshare-agent.js` when using this checkout):
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
dotshare-agent setup
|
|
103
|
+
dotshare-agent doctor
|
|
104
|
+
dotshare-agent accounts add personal-mastodon --platform mastodon
|
|
105
|
+
dotshare-agent doctor --account personal-mastodon
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`setup` verifies a real MCP handshake, registers the current installation in Codex,
|
|
109
|
+
uses absolute Node/server paths, and forwards the Linux desktop session for keyring
|
|
110
|
+
access. It preserves other settings, comments and server entries, creates a private
|
|
111
|
+
backup when replacing an existing file, and does not rewrite an unchanged entry.
|
|
112
|
+
Restart/reconnect Codex after setup; setup cannot prove a running client has reloaded.
|
|
113
|
+
|
|
114
|
+
Local images remain disabled on a fresh setup until directories are explicitly
|
|
115
|
+
allowed. Existing allowed directories are retained when setup runs again:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
dotshare-agent setup --media-root /absolute/path/to/images
|
|
119
|
+
dotshare-agent setup --text-only
|
|
120
|
+
dotshare-agent setup --dry-run
|
|
121
|
+
dotshare-agent setup --client generic
|
|
122
|
+
dotshare-agent setup --config /absolute/path/to/config.toml --json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`--dry-run` checks the server and prints a configuration preview without writing
|
|
126
|
+
settings. `--client generic` prints an `mcpServers` JSON snippet for manual import;
|
|
127
|
+
adapt the wrapper key to your client's format. A different existing DotShare server
|
|
128
|
+
is preserved unless `--replace` is explicitly supplied. Existing inline/dotted-key
|
|
129
|
+
DotShare TOML entries must be converted to `[mcp_servers.dotshare]` before automatic
|
|
130
|
+
updates; malformed config files are never overwritten. `CODEX_HOME` is honored.
|
|
131
|
+
|
|
132
|
+
`doctor` checks Node, build output, native keyring binding, client configuration,
|
|
133
|
+
image roots, account metadata and a real stdio MCP handshake. It never changes
|
|
134
|
+
settings or publishes content. Default checks do not read credentials or contact
|
|
135
|
+
platform APIs. Use `--check-accounts` to read credentials and call identity endpoints,
|
|
136
|
+
or `--account ID` to check just one account. These checks do not create posts,
|
|
137
|
+
uploads, OAuth sessions or refresh tokens. Bluesky only resolves the handle and
|
|
138
|
+
reports password validity as unverified. A platform HTTP 403 is a warning about read
|
|
139
|
+
scopes/API access, not proof that a publishing token is invalid.
|
|
140
|
+
|
|
141
|
+
Reports distinguish `PASS`, `WARN`, and `FAIL`, with actionable fixes. `--json`
|
|
142
|
+
returns a structured report. Failed checks exit with status 1; warnings alone exit
|
|
143
|
+
0. `doctor --skip-mcp` performs local checks and reports `mcpReady: null`, never a
|
|
144
|
+
successful connection. Generic-client diagnostics verify the server, not the other
|
|
145
|
+
client's configuration. Identity verification does not prove posting permissions
|
|
146
|
+
or encrypted-at-rest keyring storage.
|
|
147
|
+
|
|
148
|
+
## Manual Codex configuration
|
|
149
|
+
|
|
150
|
+
From this checkout, replace the paths with absolute paths on your machine:
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
codex mcp add dotshare -- node /absolute/path/to/DotShare/bin/dotshare-mcp.js
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Or merge this into your existing `~/.codex/config.toml`:
|
|
157
|
+
|
|
158
|
+
```toml
|
|
159
|
+
[mcp_servers.dotshare]
|
|
160
|
+
command = "node"
|
|
161
|
+
args = ["/absolute/path/to/DotShare/bin/dotshare-mcp.js"]
|
|
162
|
+
cwd = "/absolute/path/to/DotShare"
|
|
163
|
+
startup_timeout_sec = 20
|
|
164
|
+
tool_timeout_sec = 600
|
|
165
|
+
# Forward the desktop session for Linux OS keyring access.
|
|
166
|
+
env_vars = ["DBUS_SESSION_BUS_ADDRESS", "XDG_RUNTIME_DIR", "DISPLAY", "WAYLAND_DISPLAY"]
|
|
167
|
+
|
|
168
|
+
[mcp_servers.dotshare.env]
|
|
169
|
+
DOTSHARE_MEDIA_ROOTS = "/absolute/path/to/your/images"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Restart/reconnect the MCP client after adding the server. Configure another client
|
|
173
|
+
with the same command/arguments and stdio transport. Official Codex configuration:
|
|
174
|
+
<https://learn.chatgpt.com/docs/extend/mcp?surface=cli>.
|
|
175
|
+
|
|
176
|
+
`DOTSHARE_HOME` optionally changes the metadata/history directory. Credential keys
|
|
177
|
+
in the OS keyring are shared between home directories; account IDs should be unique
|
|
178
|
+
if using several directories. `DOTSHARE_MEDIA_ROOTS` contains allowed image directories
|
|
179
|
+
separated by the OS path delimiter (`:` on Linux/macOS, `;` on Windows). Each entry
|
|
180
|
+
must be an absolute path. When it is unset or invalid, local images are disabled and
|
|
181
|
+
text-only posts still work. Real paths are checked, including symlink targets.
|
|
182
|
+
The server never downloads arbitrary social-media URLs or reads credentials from
|
|
183
|
+
tool arguments. Diagnostics go to stderr; stdout is reserved for MCP JSON.
|
|
184
|
+
|
|
185
|
+
Example requests after connecting:
|
|
186
|
+
|
|
187
|
+
> List my DotShare accounts and preview this post for LinkedIn and Mastodon.
|
|
188
|
+
|
|
189
|
+
> Publish the previewed post to work-linkedin and personal-mastodon, with this image.
|
|
190
|
+
|
|
191
|
+
> Turn this release announcement into a thread on my Bluesky account and publish it.
|
|
192
|
+
|
|
193
|
+
The server exposes `list_accounts`, `preview_post`, `publish_post`, `get_operation`,
|
|
194
|
+
`list_history`, `list_cloud_connections`, `schedule_post`, `list_scheduled_posts`, and
|
|
195
|
+
`cancel_scheduled_post`, plus `create_draft`, `get_draft`, `list_drafts`,
|
|
196
|
+
`update_draft`, `preview_draft`, and `publish_draft`, plus `list_templates`,
|
|
197
|
+
`get_template`, `save_template`, `delete_template`, `render_template`,
|
|
198
|
+
`create_draft_from_template`, `get_draft_variants` and `set_draft_variant`
|
|
199
|
+
(23 tools total).
|
|
200
|
+
`dotshare://guide` describes the workflow, and the
|
|
201
|
+
`release-announcement` prompt helps prepare drafts from release notes.
|
|
202
|
+
|
|
203
|
+
## Saved drafts: Draft, Preview and Published
|
|
204
|
+
|
|
205
|
+
Use the saved-draft workflow when preparing content over several messages or when
|
|
206
|
+
publication must match a reviewed preview. The existing `preview_post` is an
|
|
207
|
+
unsaved preview: it does not create a post, draft ID or durable preview snapshot.
|
|
208
|
+
For a saved draft, always use `publish_draft`; copying its text into `publish_post`
|
|
209
|
+
bypasses the draft workflow and is not a substitute for publishing the saved preview.
|
|
210
|
+
|
|
211
|
+
| Status | Meaning |
|
|
212
|
+
| --- | --- |
|
|
213
|
+
| `Draft` | Saved locally; not published. New edits invalidate an earlier preview. |
|
|
214
|
+
| `Preview` | A valid preview of this revision is saved; nothing has been published. |
|
|
215
|
+
| `Publishing` | A publication was reserved or is in progress. Recover its operation; do not issue a new request ID. |
|
|
216
|
+
| `Published` | Publication completed. Per-account delivery results and receipt URLs are returned. |
|
|
217
|
+
| `NeedsReview` | Publication failed, was interrupted or may have partially succeeded. Inspect receipts and the destination before further action. |
|
|
218
|
+
| `SavedRemotely` | Dev.to accepted the article as a remote draft (`published:false`); it is not a public article. |
|
|
219
|
+
|
|
220
|
+
For mixed social/Dev.to targets, `publication.deliveries` distinguishes public
|
|
221
|
+
posts from Dev.to remote drafts. A timeout is never presented as a successful post.
|
|
222
|
+
|
|
223
|
+
A typical agent conversation:
|
|
224
|
+
|
|
225
|
+
> Save this announcement as a draft for personal-mastodon. Do not publish yet.
|
|
226
|
+
|
|
227
|
+
> Edit that draft to use the English version, then preview it.
|
|
228
|
+
|
|
229
|
+
> Publish that saved preview.
|
|
230
|
+
|
|
231
|
+
`create_draft` takes `{title?, content}` and returns `draft.id`, `draft.revision`
|
|
232
|
+
and `draft.status`. Incomplete drafts are allowed, including an empty `accountIds`
|
|
233
|
+
list. `update_draft` takes `draftId`, `expectedRevision`, and a `patch` of content
|
|
234
|
+
fields and/or `title`. Omitted fields are preserved; set `posts` or `article` to
|
|
235
|
+
`null` to remove them, or `overrides:null` to clear per-account variants. Each edit
|
|
236
|
+
increments the revision and resets the state to Draft.
|
|
237
|
+
|
|
238
|
+
`preview_draft` requires `draftId` and `expectedRevision`. It validates content,
|
|
239
|
+
accounts and local images, saves exact thread parts, and returns `draft.preview.id`.
|
|
240
|
+
A failed preview leaves the draft in Draft with validation errors. Repeating preview
|
|
241
|
+
creates a new preview ID, even when the content revision is unchanged.
|
|
242
|
+
|
|
243
|
+
`publish_draft` requires all four fields:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"draftId": "UUID_FROM_CREATE_DRAFT",
|
|
248
|
+
"expectedRevision": 2,
|
|
249
|
+
"previewId": "UUID_FROM_PREVIEW_DRAFT",
|
|
250
|
+
"requestId": "saved-release-2026-11-02-1"
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Before sending anything, publication checks the saved content/plan, current instance
|
|
255
|
+
limits, account credential bindings and local image fingerprints. A changed image,
|
|
256
|
+
account, credential or platform plan requires a new preview. Verified local image
|
|
257
|
+
bytes are copied privately for the attempt, so editing the source during publication
|
|
258
|
+
cannot change a later upload. Dev.to public image URLs are bound by URL; this does
|
|
259
|
+
not freeze the remote server's image contents.
|
|
260
|
+
|
|
261
|
+
Retries use the same request ID, revision and preview ID. Completed/uncertain
|
|
262
|
+
operations are replayed from the journal without resending, even after a restart.
|
|
263
|
+
`get_draft` recovers receipt/status updates from that journal if the process stopped
|
|
264
|
+
before saving final draft status. A draft with a publication attempt cannot be edited
|
|
265
|
+
or submitted under a new ID. A new draft represents a separately authorized action,
|
|
266
|
+
not a way to bypass an uncertain result. Short local commit locks and revision checks
|
|
267
|
+
prevent concurrent agents from overwriting each other's edits.
|
|
268
|
+
|
|
269
|
+
### Draft commands
|
|
270
|
+
|
|
271
|
+
For the following commands, `draft.json` contains
|
|
272
|
+
`{"title":"MCP release","content":{"accountIds":["personal-mastodon"],"text":"Our release is ready."}}`.
|
|
273
|
+
The edit file contains `{"patch":{"text":"Updated release announcement."}}`.
|
|
274
|
+
|
|
275
|
+
```sh
|
|
276
|
+
dotshare-agent drafts create --input draft.json
|
|
277
|
+
dotshare-agent drafts list --status Draft
|
|
278
|
+
dotshare-agent drafts get DRAFT_ID
|
|
279
|
+
dotshare-agent drafts update DRAFT_ID --revision 1 --input edit.json
|
|
280
|
+
dotshare-agent drafts preview DRAFT_ID --revision 2
|
|
281
|
+
dotshare-agent drafts publish DRAFT_ID --revision 2 --preview-id PREVIEW_ID --request-id saved-release-1
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
`drafts create --title "Release announcement"` creates an empty draft for later
|
|
285
|
+
editing. From a source checkout, prefix commands with `node bin/dotshare-agent.js`.
|
|
286
|
+
The MCP client must reconnect after an upgrade to discover new tools;
|
|
287
|
+
`doctor` verifies the complete tool set from a newly started server.
|
|
288
|
+
|
|
289
|
+
Draft records contain full post bodies, preview snapshots and publication references
|
|
290
|
+
under `DOTSHARE_HOME/drafts` (default `~/.dotshare/drafts`). These JSON files are
|
|
291
|
+
encrypted with AES-256-GCM; directory/file permissions are 0700/0600. The random master key stays in the required OS keyring, never beside these files. Credentials are kept
|
|
292
|
+
in the OS keyring; drafts contain credential fingerprints, not the keys themselves.
|
|
293
|
+
`list_drafts` returns summaries without post bodies. Draft content is limited to
|
|
294
|
+
1 MiB, and preview plans to 2 MiB. The VS Code Publishing Library uses this same
|
|
295
|
+
store through the configured MCP installation. Earlier platform-composer drafts
|
|
296
|
+
remain separate; no automatic migration is performed.
|
|
297
|
+
|
|
298
|
+
## Reusable templates and account versions
|
|
299
|
+
|
|
300
|
+
Templates are local content recipes, not scheduled jobs or public posts. They need
|
|
301
|
+
no cloud subscription or model API key. The agent can write/adapt wording when
|
|
302
|
+
asked; the template engine only substitutes the literal values supplied to it.
|
|
303
|
+
|
|
304
|
+
Start with `list_templates`, then `get_template` to inspect the recipe and parameters.
|
|
305
|
+
Five read-only recipes are included: `builtin-release`, `builtin-progress`,
|
|
306
|
+
`builtin-launch`, `builtin-bugfix` and `builtin-article`. Built-ins are English starter
|
|
307
|
+
formats; custom recipes and values can use any language. Copy a built-in's name,
|
|
308
|
+
description, content, variables and variant maps into `save_template` under a custom
|
|
309
|
+
ID to customize it. Do not pass derived read-only fields such as `parameters`.
|
|
310
|
+
|
|
311
|
+
A custom template definition:
|
|
312
|
+
|
|
313
|
+
```json
|
|
314
|
+
{
|
|
315
|
+
"id": "my-release",
|
|
316
|
+
"name": "My release announcement",
|
|
317
|
+
"description": "A short announcement plus a professional LinkedIn version.",
|
|
318
|
+
"variables": {
|
|
319
|
+
"version": {"description": "Actual release version"},
|
|
320
|
+
"link": {"type": "url", "description": "Verified release URL"},
|
|
321
|
+
"hashtags": {"default": "#OpenSource"}
|
|
322
|
+
},
|
|
323
|
+
"content": {
|
|
324
|
+
"text": "{{project}} {{version}} is out!\n\n{{highlights}}\n\n{{link}}\n{{hashtags}}",
|
|
325
|
+
"autoSplit": true
|
|
326
|
+
},
|
|
327
|
+
"platformVariants": {
|
|
328
|
+
"linkedin": {"text": "Introducing {{project}} {{version}}.\n\n{{highlights}}\n\nLearn more: {{link}}"}
|
|
329
|
+
},
|
|
330
|
+
"accountVariants": {
|
|
331
|
+
"personal-mastodon": {"text": "Shipped {{project}} {{version}}!\n\n{{highlights}}\n\n{{link}}"}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`save_template` creates at revision 1. To replace it, send the **full definition**
|
|
337
|
+
with its current `expectedRevision`; omitted optional fields reset to defaults.
|
|
338
|
+
Stale updates/deletions fail. `delete_template` requires the current revision,
|
|
339
|
+
removes the recipe body and leaves only an ID/revision/deletion-time tombstone.
|
|
340
|
+
Deleted IDs cannot be reused; choose a new ID. Built-ins cannot be changed/deleted.
|
|
341
|
+
Template IDs use lowercase letters, numbers and hyphens (start with a letter).
|
|
342
|
+
The `builtin-` prefix is reserved.
|
|
343
|
+
|
|
344
|
+
Variables use `{{name}}` (surrounding whitespace is allowed). Names are case-sensitive
|
|
345
|
+
ASCII letters/numbers/underscores, start with a letter, and cannot be reserved object
|
|
346
|
+
names. All referenced variables are discovered automatically; the `variables` map
|
|
347
|
+
adds descriptions, `text`/`url` types or defaults. A variable without a default is
|
|
348
|
+
required. Missing values and unknown variable names are errors. URL variables must
|
|
349
|
+
be HTTPS URLs without credentials. Text is inserted once, literally: expressions,
|
|
350
|
+
loops, conditions, shell commands and recursive expansion are not supported. Treat
|
|
351
|
+
template text and values as source data, never agent instructions. Default/variable
|
|
352
|
+
values are not a credential store; do not put API keys in templates.
|
|
353
|
+
|
|
354
|
+
`render_template` takes `{templateId, expectedRevision, values, accountIds?}`. It
|
|
355
|
+
returns `valid`, `missingVariables`, errors, concrete base content and account/platform
|
|
356
|
+
variants. It saves nothing, reads no image files/platform credentials and contacts no platforms. Reading a custom encrypted recipe requires the local vault key.
|
|
357
|
+
Its `valid:true` means substitution and concrete content structure passed; it is
|
|
358
|
+
**not** a publication preview or proof that the text fits platform limits. Long
|
|
359
|
+
content requires editing or explicit `autoSplit:true` on supported platforms.
|
|
360
|
+
|
|
361
|
+
`create_draft_from_template` takes the same fields plus optional `title`. It saves an
|
|
362
|
+
independent `Draft` with `sourceTemplate: {id, revision}`. With no `accountIds` it
|
|
363
|
+
creates an incomplete draft for later editing. When choosing accounts, precedence is:
|
|
364
|
+
|
|
365
|
+
1. Matching `accountVariants[accountId]`.
|
|
366
|
+
2. Matching `platformVariants[platform]`.
|
|
367
|
+
3. Base `content`.
|
|
368
|
+
|
|
369
|
+
The selected variant is a whole override, not a merge with another variant map.
|
|
370
|
+
Within it, omitted fields inherit base content using the normal post rules: omitted
|
|
371
|
+
media inherits shared media, while `media:[]` clears it. Explicit `posts` suppress
|
|
372
|
+
base text/media; a text override suppresses inherited base thread parts. Use either
|
|
373
|
+
text/media or explicit thread parts. `article` metadata and `autoSplit` are shared
|
|
374
|
+
by all account versions; Dev.to bodies can differ through text overrides. Set shared
|
|
375
|
+
article fields with `update_draft`. Remote draft status for Dev.to still requires
|
|
376
|
+
`article.published:false` explicitly; built-in article recipes use `true` and are
|
|
377
|
+
only published after a separate explicit `publish_draft` request.
|
|
378
|
+
|
|
379
|
+
`get_draft_variants` shows effective text, media, thread parts, shared article
|
|
380
|
+
metadata and character counts for each selected account, without network requests.
|
|
381
|
+
`limitSource` distinguishes platform-default estimates from saved preview limits.
|
|
382
|
+
For automatic splitting, the final numbered parts/counts are in `preview_draft`.
|
|
383
|
+
`set_draft_variant` takes `{draftId, expectedRevision, accountId, variant}` and
|
|
384
|
+
**replaces** one account override, preserving every other account. `variant:null`
|
|
385
|
+
restores inheritance from the draft's current base content. It does not reapply an
|
|
386
|
+
old platform recipe. It increments the revision and invalidates the saved preview.
|
|
387
|
+
It cannot edit a draft that already has a publication attempt.
|
|
388
|
+
|
|
389
|
+
Changing/deleting a template never changes earlier drafts. Each draft holds its own
|
|
390
|
+
filled content, and its publishing snapshot/retry safeguards remain in effect.
|
|
391
|
+
Template files live under `DOTSHARE_HOME/templates` with 0700/0600 permissions;
|
|
392
|
+
like draft bodies and operation records, they are encrypted with an OS-keyring master key. Stored templates and expanded content
|
|
393
|
+
are bounded to 1 MiB; templates allow at most 100 distinct variables. No VS Code
|
|
394
|
+
template/draft migration is performed. The Publishing Library connects directly to
|
|
395
|
+
this same store; see [the visual workflow](PUBLISHING_LIBRARY.md).
|
|
396
|
+
|
|
397
|
+
Example agent requests:
|
|
398
|
+
|
|
399
|
+
> Show available templates and the release template's required variables.
|
|
400
|
+
|
|
401
|
+
> Use the release template with these verified release notes and this URL. Save a
|
|
402
|
+
> draft for personal-mastodon and work-linkedin. Do not publish.
|
|
403
|
+
|
|
404
|
+
> Show both account versions. Make LinkedIn more formal and keep Mastodon short.
|
|
405
|
+
> Preview the updated draft without publishing.
|
|
406
|
+
|
|
407
|
+
> Publish that saved preview.
|
|
408
|
+
|
|
409
|
+
CLI equivalents (`recipe.json` contains the definition above; `values.json` contains
|
|
410
|
+
`{"values":{"project":"DotShare","version":"vNext","highlights":"Supplied release notes","link":"https://example.com/release"},"accountIds":["personal-mastodon"]}`;
|
|
411
|
+
`variant.json` contains `{"text":"My revised Mastodon text"}`):
|
|
412
|
+
|
|
413
|
+
```sh
|
|
414
|
+
dotshare-agent templates list
|
|
415
|
+
dotshare-agent templates get builtin-release
|
|
416
|
+
dotshare-agent templates save --input recipe.json
|
|
417
|
+
dotshare-agent templates render my-release --revision 1 --input values.json
|
|
418
|
+
dotshare-agent templates use my-release --revision 1 --input values.json
|
|
419
|
+
dotshare-agent drafts variants DRAFT_ID
|
|
420
|
+
dotshare-agent drafts set-variant DRAFT_ID personal-mastodon --revision 1 --input variant.json
|
|
421
|
+
dotshare-agent drafts preview DRAFT_ID --revision 2
|
|
422
|
+
dotshare-agent drafts publish DRAFT_ID --revision 2 --preview-id PREVIEW_ID --request-id my-release-1
|
|
423
|
+
dotshare-agent templates delete my-release --revision 1
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Use JSON `null` as the set-variant input to reset an account to base inheritance.
|
|
427
|
+
All commands taking `--input` also accept `-` for stdin. From this checkout prefix
|
|
428
|
+
commands with `node bin/dotshare-agent.js`.
|
|
429
|
+
|
|
430
|
+
## Content and preview
|
|
431
|
+
|
|
432
|
+
Use the same post structure for `preview_post` and `publish_post`. Publishing also
|
|
433
|
+
requires a stable `requestId` identifying one user-authorized action:
|
|
434
|
+
|
|
435
|
+
```json
|
|
436
|
+
{
|
|
437
|
+
"requestId": "dotshare-release-2026-11-02-1",
|
|
438
|
+
"accountIds": ["personal-mastodon", "work-linkedin"],
|
|
439
|
+
"text": "DotShare now works with AI agents!",
|
|
440
|
+
"media": ["/absolute/path/to/your/images/launch.png"],
|
|
441
|
+
"autoSplit": true,
|
|
442
|
+
"overrides": {
|
|
443
|
+
"work-linkedin": { "text": "We shipped agent-driven publishing in DotShare." }
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Omit `requestId` when calling `preview_post` (schemas reject unrelated fields).
|
|
449
|
+
The CLI accepts the same JSON through `preview --input file.json` or
|
|
450
|
+
`publish --input file.json`; `--input -` reads stdin. Preview returns exact planned
|
|
451
|
+
text, image paths, character counts, limits and validation errors, and publishes
|
|
452
|
+
nothing. Mastodon instance limits are fetched when that account is previewed.
|
|
453
|
+
|
|
454
|
+
`posts: [{"text":"First"},{"text":"Second","media":["/path/image.png"]}]`
|
|
455
|
+
creates an explicit thread on X, Bluesky or Mastodon. Use either `posts` or
|
|
456
|
+
`text`/`media`. `autoSplit` splits long text into numbered thread parts on those three
|
|
457
|
+
platforms, with common images attached to the first part. `overrides` can specify
|
|
458
|
+
different text, images or explicit thread parts per account. Unsupported threads,
|
|
459
|
+
empty posts, missing images and oversized content fail preflight before any account
|
|
460
|
+
is published to. Character counts for combined emoji on X/Bluesky are conservative.
|
|
461
|
+
|
|
462
|
+
| Agent media support | Limits |
|
|
463
|
+
| --- | --- |
|
|
464
|
+
| Local images | PNG/JPEG; WebP also on Bluesky, Mastodon and Discord |
|
|
465
|
+
| Size | 1,000,000 bytes/image on Bluesky; 8 MiB/image otherwise, subject to platform limits |
|
|
466
|
+
| Images/post | X/Bluesky/Mastodon up to 4 (Mastodon also checks instance limits); LinkedIn 1; Telegram/Discord 10 |
|
|
467
|
+
| Telegram | Caption limited to 1,024 characters; multiple images are sent as separate messages, caption on first |
|
|
468
|
+
| Dev.to | Public HTTPS image URLs; local files are rejected |
|
|
469
|
+
| Video/GIF | Not supported by this initial agent interface |
|
|
470
|
+
|
|
471
|
+
Dev.to requires `article: {"title":"Release notes","tags":["opensource"],"published":true}`.
|
|
472
|
+
Optional article fields include `canonicalUrl`, `coverImage`, `description`, and
|
|
473
|
+
`series`. Set `published:false` to create a Dev.to draft intentionally.
|
|
474
|
+
|
|
475
|
+
## Retry and recovery
|
|
476
|
+
|
|
477
|
+
Each publish/schedule/cancel operation is claimed atomically and retained in
|
|
478
|
+
`~/.dotshare/operations` with private file permissions. The journal records receipts
|
|
479
|
+
as each thread part is published. It stores a request fingerprint and result metadata,
|
|
480
|
+
not platform credentials or full post bodies.
|
|
481
|
+
|
|
482
|
+
- Repeat the **same requestId and payload** to retrieve the existing result without
|
|
483
|
+
sending another publication request, including after a reconnect/process restart.
|
|
484
|
+
- Reusing an ID for different content fails. IDs have no automatic expiry.
|
|
485
|
+
- A timeout can occur after a platform accepted a post. `needs_review`, `uncertain`,
|
|
486
|
+
and stale `running` operations require inspection of the destination, not an
|
|
487
|
+
automatic retry with a new ID. Already published parts are not rolled back.
|
|
488
|
+
- To intentionally publish the same content again, provide a new user-authorized ID.
|
|
489
|
+
- `operation <requestId>` and `history` recover local results. Credentials must be
|
|
490
|
+
available for all target accounts before the first publication starts.
|
|
491
|
+
|
|
492
|
+
This prevents application retries from resending a claimed action; it does not
|
|
493
|
+
provide a distributed exactly-once guarantee across external platform APIs or
|
|
494
|
+
after deleting the local journal. Back up the journal if migrating machines.
|
|
495
|
+
|
|
496
|
+
## Cloud scheduling
|
|
497
|
+
|
|
498
|
+
```sh
|
|
499
|
+
node bin/dotshare-agent.js cloud login
|
|
500
|
+
node bin/dotshare-agent.js cloud connections
|
|
501
|
+
node bin/dotshare-agent.js cloud schedule --input schedule.json
|
|
502
|
+
node bin/dotshare-agent.js cloud list
|
|
503
|
+
node bin/dotshare-agent.js cloud cancel SCHEDULED_POST_ID --request-id cancel-post-1
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
Connect the desired platform accounts in the DotSuite dashboard first. Local named
|
|
507
|
+
accounts and cloud connections are separate: cloud requests select platforms, using
|
|
508
|
+
the accounts already connected on the server. No local platform keys are synced.
|
|
509
|
+
The DotSuite session token is entered in your terminal and stored in the OS keyring.
|
|
510
|
+
Backend plan limits, permissions and available connections still apply.
|
|
511
|
+
|
|
512
|
+
```json
|
|
513
|
+
{
|
|
514
|
+
"requestId": "scheduled-launch-1",
|
|
515
|
+
"platforms": ["mastodon", "x"],
|
|
516
|
+
"text": "Our release is live!",
|
|
517
|
+
"mediaUrls": ["https://your-public-cdn.example/launch.png"],
|
|
518
|
+
"scheduledAt": "2026-12-01T10:00:00+02:00"
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
Scheduling requires a timezone and at least one minute of lead time. It supports one
|
|
523
|
+
post with public HTTPS image URLs, without local file uploads, threads or account
|
|
524
|
+
overrides. Discord cloud scheduling is unavailable. `DOTSUITE_API_URL` optionally
|
|
525
|
+
selects a compatible HTTPS backend. It cannot contain credentials/query parameters.
|
|
526
|
+
|
|
527
|
+
## Build and validate
|
|
528
|
+
|
|
529
|
+
```sh
|
|
530
|
+
npm run lint
|
|
531
|
+
npx tsc --noEmit
|
|
532
|
+
npm run test:all -- --runInBand
|
|
533
|
+
npm run test:agent:stdio
|
|
534
|
+
npm run package:cli
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
The packaging command builds production bundles and stages the CLI in a temporary
|
|
538
|
+
directory, leaving the VS Code `package.json` unchanged. The resulting npm tarball
|
|
539
|
+
is saved under `artifacts/`; it can be installed locally with `npm install -g PATH.tgz`.
|
|
540
|
+
Unit/integration tests use mocked platform APIs. The subprocess smoke test checks
|
|
541
|
+
the real MCP transport and CLI binaries without publishing anything publicly.
|