dotshare-cli 1.0.0 → 3.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.
Files changed (57) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +258 -189
  3. package/SECURITY.md +145 -0
  4. package/bin/dotshare-agent.js +7 -0
  5. package/bin/dotshare-cli.js +11 -7
  6. package/bin/dotshare-mcp.js +6 -0
  7. package/docs/AGENT_INTEGRATION.md +556 -0
  8. package/out/agent/commands.js +120 -0
  9. package/out/agent/server.js +98 -0
  10. package/out/cli/commands.js +129 -376
  11. package/package.json +34 -94
  12. package/bin/dotshare-scheduler.js +0 -208
  13. package/out/analytics.js +0 -67
  14. package/out/analytics.js.map +0 -1
  15. package/out/bluesky.js +0 -100
  16. package/out/bluesky.js.map +0 -1
  17. package/out/cli/commands.js.map +0 -1
  18. package/out/cli/config.js +0 -144
  19. package/out/cli/config.js.map +0 -1
  20. package/out/credential-provider.js +0 -92
  21. package/out/credential-provider.js.map +0 -1
  22. package/out/discord.js +0 -85
  23. package/out/discord.js.map +0 -1
  24. package/out/extension.js +0 -1383
  25. package/out/extension.js.map +0 -1
  26. package/out/facebook.js +0 -66
  27. package/out/facebook.js.map +0 -1
  28. package/out/gemini.js +0 -219
  29. package/out/gemini.js.map +0 -1
  30. package/out/linkedin.js +0 -110
  31. package/out/linkedin.js.map +0 -1
  32. package/out/message-handlers.js +0 -391
  33. package/out/message-handlers.js.map +0 -1
  34. package/out/openai.js +0 -217
  35. package/out/openai.js.map +0 -1
  36. package/out/post-executor.js +0 -168
  37. package/out/post-executor.js.map +0 -1
  38. package/out/reddit.js +0 -538
  39. package/out/reddit.js.map +0 -1
  40. package/out/scheduled-posts.js +0 -100
  41. package/out/scheduled-posts.js.map +0 -1
  42. package/out/scheduler.js +0 -98
  43. package/out/scheduler.js.map +0 -1
  44. package/out/storage-manager.js +0 -403
  45. package/out/storage-manager.js.map +0 -1
  46. package/out/telegram.js +0 -104
  47. package/out/telegram.js.map +0 -1
  48. package/out/types.js +0 -3
  49. package/out/types.js.map +0 -1
  50. package/out/webview-provider.js +0 -168
  51. package/out/webview-provider.js.map +0 -1
  52. package/out/x.js +0 -55
  53. package/out/x.js.map +0 -1
  54. package/out/xai.js +0 -235
  55. package/out/xai.js.map +0 -1
  56. package/src/cli/commands.ts +0 -380
  57. package/src/cli/config.ts +0 -148
package/SECURITY.md ADDED
@@ -0,0 +1,145 @@
1
+ # DotShare local security model
2
+
3
+ This describes the protections implemented in this checkout. It is not an
4
+ independent security certification or a claim that the entire operating system,
5
+ every platform adapter, or the separate DotSuite backend has been audited.
6
+
7
+ ## Credentials
8
+
9
+ - CLI/MCP platform credentials and the DotSuite session token live in the native
10
+ OS credential store, not JSON configuration, command arguments or MCP responses.
11
+ - On Linux, every entry explicitly requires **Secret Service**. An unavailable or
12
+ locked provider fails closed. Automatic fallback to the kernel keyutils store is
13
+ disabled. Existing kernel-fallback entries are not silently copied; reconnect
14
+ affected accounts through hidden CLI prompts after configuring Secret Service.
15
+ - macOS/Windows use their native OS stores. VS Code account/AI credentials continue
16
+ to use VS Code SecretStorage, with status-only responses to webviews and host-side
17
+ secret redaction. DotShare cannot attest how the chosen OS/VS Code provider
18
+ encrypts its own database; configure a password-protected provider and OS account.
19
+ - Local account IDs are shared by the OS user's CLI service, as before. Different
20
+ `DOTSHARE_HOME` directories are not separate user/security identities for platform
21
+ keys; use distinct IDs to avoid accidental replacement. Separate OS users are
22
+ required for isolation from other local users.
23
+ - The legacy CLI relay publishing path is disabled: it used to send raw platform
24
+ credentials to a configured intermediary. Legacy login no longer echoes secrets.
25
+ Use `accounts add` and the direct named-account publishing commands/tools.
26
+ - Cloud credential sync remains a separate explicit-consent feature of the extension;
27
+ this change does not verify or change the remote backend's credential storage.
28
+
29
+ ## Encrypted shared library
30
+
31
+ Saved agent drafts, custom templates and operation journals under `DOTSHARE_HOME`
32
+ use **AES-256-GCM** with a cryptographically random 256-bit key, a fresh random
33
+ 96-bit nonce per write and a required 128-bit authentication tag. Associated data
34
+ binds the format version, key ID, category and record filename; swapping or renaming
35
+ ciphertext between records fails authentication. A key-confirmation HMAC prevents
36
+ a substituted OS key from being used to overwrite records under the same key ID.
37
+ Encryption/decryption use Node's built-in crypto implementation.
38
+
39
+ The master key is stored only in the required OS credential store under a random
40
+ `vault:<keyId>` entry. `security.json` contains a public key ID and key confirmation,
41
+ not the master key. No password, master-key environment variable or local plaintext
42
+ file fallback is accepted. The first saved record needs an unlocked/available OS
43
+ keyring. Missing, malformed or mismatched keys do not trigger key regeneration for
44
+ an existing vault.
45
+
46
+ Directories/files are private (0700/0600 on Unix), checked for ownership and regular
47
+ file type. Symlinks and multiply linked files are refused. Writes use exclusive
48
+ private temporary files, file/directory fsync and atomic replacement. Exclusive
49
+ operation claims survive failed writes so an uncertain operation cannot simply be
50
+ resent. Short cross-process write/migration and record locks prevent concurrent
51
+ commits from silently replacing each other. Stale locks require inspection rather
52
+ than automatic removal. File reads and decoded records are bounded.
53
+
54
+ Account IDs/labels, non-secret CLI configuration and vault metadata remain private
55
+ metadata rather than encrypted content. Built-in recipes are public source data.
56
+ Original user-selected images and private temporary upload copies are not encrypted
57
+ by the record vault. Earlier platform-composer drafts remain in VS Code global state;
58
+ they are not silently migrated into the shared agent library.
59
+
60
+ ## Upgrading an existing library
61
+
62
+ Stop active publications, update/build the checkout, then run:
63
+
64
+ ```sh
65
+ node bin/dotshare-agent.js security status
66
+ node bin/dotshare-agent.js security protect
67
+ node bin/dotshare-agent.js doctor --check-accounts
68
+ ```
69
+
70
+ `status` inventories file formats/permissions without reading platform credentials
71
+ or the master key. It is not a decryption/authentication test. `protect` verifies
72
+ existing account access, tightens owned storage permissions, preflights JSON and
73
+ existing ciphertext, and encrypts legacy records in place under a write lock. Each
74
+ converted record is authenticated/read back and compared with its original content.
75
+ It preserves IDs, revisions and publication receipts. It does not publish, upload,
76
+ refresh tokens, change MCP configuration, export keys or create plaintext backups.
77
+ The migration is resumable; do not reset the vault if any record fails.
78
+
79
+ Restart **all** DotShare MCP clients and VS Code windows afterwards. Older already
80
+ running processes still contain the previous code and cannot be made safe by changing
81
+ files on disk alone. New code refuses legacy plaintext during normal reads instead
82
+ of silently continuing without encryption. `doctor` reports plaintext/unreadable
83
+ records separately, and checks key access only with account checks enabled.
84
+
85
+ Encrypting a file does not securely erase prior disk pages, OS snapshots, sync
86
+ copies, logs or backups. Review existing copies according to your storage/backup
87
+ policy; the application does not delete them automatically.
88
+
89
+ ## Recovery and rotation
90
+
91
+ Back up the encrypted records, `security.json` and the OS keyring using the OS/provider's
92
+ protected backup facilities. Files alone cannot recover a lost master key. Do not
93
+ delete the manifest, generate a replacement key, or copy a key beside ciphertext
94
+ as a recovery shortcut. Restore the matching original key/metadata. Vault master-key
95
+ rotation/export is not implemented by this change; perform a separately reviewed
96
+ re-encryption migration rather than editing `security.json` or the keyring entry.
97
+
98
+ For suspected platform-token compromise, revoke/rotate at the platform, then run
99
+ `accounts add` for that account using hidden prompts. Local account removal deletes
100
+ the local credential; it does not revoke the provider token. Inspect already claimed
101
+ operations before any new publish action.
102
+
103
+ ## Transport and disclosure controls
104
+
105
+ - Credential-bearing API requests do not follow HTTP redirects. Axios defaults and
106
+ direct requests are hardened; extension cloud fetches use `redirect:error`.
107
+ Insecure global TLS verification/agents are refused in these guarded paths.
108
+ - LinkedIn upload destinations must be HTTPS LinkedIn hosts before attaching the
109
+ bearer token. Discord webhooks require the canonical HTTPS Discord API shape.
110
+ - Known configured secrets, standard token patterns and Telegram/Discord credential
111
+ URL segments are redacted from diagnostics. Structured logging omits request
112
+ configs, headers and credential fields and handles circular values safely.
113
+ - Malformed credential JSON and corrupted stored JSON produce generic errors without
114
+ echoing input contents. Credential input files must be owned, private regular files;
115
+ hidden terminal prompts or stdin are preferred.
116
+ - Publishing/scheduling blocks known credentials in the selected content before
117
+ claiming/sending the action. This is a guard for registered secrets, not a general
118
+ proof that source code/images or arbitrary user text contain no secrets.
119
+ - MCP tools never expose the master/platform keys. The UI uses the same server,
120
+ respects configured tool allow/deny lists, escapes content as text, and publishes
121
+ saved drafts only with their exact revision/preview and stable request ID.
122
+
123
+ An unlocked OS account, same-user malware, a compromised extension/agent with code
124
+ execution, root/admin access, memory inspection and a compromised platform/backend
125
+ are outside the protection provided by local-file encryption. Use OS account
126
+ isolation, screen locking and full-disk encryption as appropriate. No application
127
+ can safely claim that keys are inaccessible to code running with the owner's full
128
+ permissions.
129
+
130
+ ## Verification and references
131
+
132
+ Unit/integration tests cover ciphertext-only persistence, tag/nonce/key tampering,
133
+ wrong record identity, missing/substituted keys, explicit migration, private file
134
+ checks, keyring pinning, redaction, redirect rejection and leak blocking.
135
+ `node scripts/verify-security.cjs` tests the real OS keyring and loopback redirects
136
+ with disposable keys/fixtures only. `verify-agent.cjs` and `verify-library.cjs` test
137
+ encrypted records across actual MCP/CLI processes without real publications. Tests
138
+ clean up their temporary keyring master entries. Dependency audit results are a
139
+ point-in-time known-advisory check, not a full supply-chain review.
140
+
141
+ - [Node crypto authenticated-encryption API](https://nodejs.org/api/crypto.html)
142
+ - [Keyring binding and Linux backend selection](https://github.com/Brooooooklyn/keyring-node)
143
+ - [LinkedIn upload URL documentation](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/documents-api)
144
+
145
+ Dotenvy integration remains independent of these protections and has not been added.
@@ -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; });
@@ -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('1.0.0')
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 "Hello World!" # Post to all configured platforms
35
- $ dotshare --media ./image.jpg # Post media file
36
- $ dotshare "Check this" --media ./video.mp4 --platforms telegram,linkedin
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.parse(process.argv);
51
+ program.parseAsync(process.argv).catch(() => { process.exitCode = 1; });
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ require('../out/agent/server.js').startAgentServer().catch(() => {
4
+ process.stderr.write('DotShare MCP could not start. Check configuration and the system keyring.\n');
5
+ process.exitCode = 1;
6
+ });