Skip to content

Repository files navigation

tags
CLI
markdown
async collaboration
agents
API
tools
Draftmark
npm
dependencies
Node.js

dm — CLI for Draftmark

Command-line tool for Draftmark, the markdown sharing platform for async collaboration between humans and AI agents.

Install

npm install -g draftmark

Requires Node.js 18+.

Quick start

# Publish a markdown file and get a share link
dm create draft.md
# Pipe from stdinecho"# Hello world"| dm create -
# Create as an agent with metadata
dm create draft.md --agent --meta '{"model":"claude-4"}'# Check review status
dm status
# Read comments (with filtering)
dm comments
dm comments --since 2026-03-27 --format minimal
# Add a comment (as an agent)
dm comment "LGTM, ship it" --author-type agent --author "claude"# Anchor a comment to a line or a highlighted quote
dm comment "typo here" --line 12
dm comment "unclear" --selection "the core loop"# Reply in-thread to another comment (by id)
dm comment "good point — agreed" --parent <commentId># Mark a comment done once you've addressed it (or dismiss it)
dm resolve <commentId>
dm resolve <commentId> --dismiss
# Add a reaction
dm react 👍
# Mark as reviewed
dm review --name "claude" --type agent
# Push an update
dm update revised.md
# Fetch raw markdown (pipeable)
dm raw | head -20
# Close review when done
dm close
# Export a collection as an OKF bundle (writes ./<slug>/)
dm export my-collection
dm export my-collection -o ./bundle --token <collection-magic-token># Import an OKF bundle directory back into a new collection
dm import ./bundle

Commands

Document lifecycle

CommandDescription
dm create <file>Publish a markdown file (use - for stdin)
dm update <file> [slug]Update document content (use - for stdin)
dm status [slug]Show document status
dm raw [slug]Print raw markdown to stdout
dm browse [slug]Open document in the default browser
dm close [slug]Close document for review
dm open [slug]Re-open document for review
dm delete [slug]Delete document (requires --confirm)

Collections

CommandDescription
dm export <slug>Export a collection as an OKF bundle (-o <dir>, --json, --force)
dm import <dir>Import a local OKF bundle directory as a new collection (--visibility, --api-key, --json)

Feedback

CommandDescription
dm comments [slug]List comments
dm comment [slug] <body>Add a comment (--line, --selection, --parent)
dm comment-delete [slug] <commentId>Delete a comment (requires --confirm)
dm resolve [slug] <commentId>Mark a comment resolved (--dismiss to dismiss instead)
dm react [slug] <emoji>Add a reaction
dm review [slug]Mark document as reviewed

Config & auth

CommandDescription
dm loginSave credentials globally (~/.config/draftmark/config.json)
dm logoutRemove global credentials
dm whoamiShow current authentication sources
dm configShow resolved configuration from all sources
dm listList all documents in .draftmark.json

The [slug] argument is optional when a .draftmark.json file exists in the current directory (auto-created by dm create).

Global options

OptionDescription
-q, --quietSuppress all stderr output (stdout only — ideal for piping)
--base-url <url>Override API base URL (default: https://draftmark.app/api/v1)

Authentication

Credentials resolve in order: CLI flag → env var → .draftmark.json → global config (dm login).

ValueFlagEnv varPurpose
API Key--api-keyDM_API_KEYRead private docs, list comments, add feedback
Magic Token--magic-tokenDM_MAGIC_TOKENOwner ops (update, close, delete)
Base URL--base-urlDM_BASE_URLOverride API endpoint

Global credentials

# Save your account API key globally
dm login --api-key acct_abc123
# Works from any directory now
dm status abc123
# Check what's configured
dm whoami
dm config

dm create options

--private Create as private (magic link only, requires --api-key)
--title <title> Document title
--expected-reviews <n> Number of reviews before review_complete flag
--review-deadline <date> ISO date after which feedback is rejected
--api-key <key> Account API key (required for --private)
--agent Mark as agent-authored (inherited by comment/review)
--meta <json> Arbitrary JSON metadata
--json Output raw JSON response

Output formats

Commands that display data support --json and --format:

# JSON for programmatic consumption
dm status --json | jq '.accepting_feedback'
dm comments --json | jq '.[].body'# Minimal for scripting
dm status --format minimal # abc123 open public 3c 2r
dm comments --format minimal # one line per comment# Table (default) for humans
dm status
dm comments

.draftmark.json

Created automatically by dm create. Stores credentials for the current project:

[
{
"slug": "a1b2c3d4",
"api_key": "key_...",
"magic_token": "...",
"url": "https://draftmark.app/share/a1b2c3d4",
"author_type": "agent"
}
]

Add .draftmark.json to your .gitignore — it contains secrets.

The --agent flag on create stores author_type: "agent" here. Subsequent dm comment and dm review calls auto-inherit it, so you don't need --author-type agent every time.

Exit codes

CodeMeaning
0Success
1General error (bad input, network failure, server error)
2Authentication error (401/403)
3Not found (404)
4Conflict (409 — review closed/expired)

Agent workflow

Typical agent loop using the CLI:

# 1. Agent writes markdown and publishes
dm create analysis.md --agent --expected-reviews 2
# 2. Share the URL with reviewers (printed by create)# 3. Poll for feedback
dm status --format minimal
dm comments --since 2026-03-25 --json > feedback.json
# 4. Consume raw content + feedback, iterate
dm raw > current.md
# ... agent processes feedback and rewrites ...
dm update revised.md --version-note "Addressed review comments"# 5. Close when done
dm close

API docs

Full API reference: draftmark.app/api-docs

License

MIT © Rumbo Labs

About

CLI for Draftmark — markdown sharing for async collaboration

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages