autark-cli 0.4.1 → 0.4.2

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 (2) hide show
  1. package/autark.mjs +23 -1
  2. package/package.json +1 -1
package/autark.mjs CHANGED
@@ -990,9 +990,10 @@ async function mailSend(rest) {
990
990
  rejectUnsendableAddress(to)
991
991
  const subject = opts.subject || ''
992
992
  const body = mailBody(opts, { to, subject })
993
+ const anchor = readAnchorOpts(opts)
993
994
  const dryRun = opts['dry-run'] === true || opts.dry_run === true
994
995
  if (dryRun) {
995
- printJson({ dry_run: true, would_send: { inbox: creds.inboxId, to, subject, body } })
996
+ printJson({ dry_run: true, would_send: { inbox: creds.inboxId, to, subject, body, anchor } })
996
997
  return
997
998
  }
998
999
  const result = await agentmailRequest('POST', `/inboxes/${encodeURIComponent(creds.inboxId)}/messages/send`, body)
@@ -1002,10 +1003,30 @@ async function mailSend(rest) {
1002
1003
  recipient: to.join(','),
1003
1004
  subject,
1004
1005
  response: result,
1006
+ metadata: anchor ? { anchor_quote: anchor.quote, anchor_url: anchor.url } : {},
1005
1007
  })
1006
1008
  printJson({ ...result, autark_action_id: action?.id })
1007
1009
  }
1008
1010
 
1011
+ // Optional anchor-quote primitive. The cold-outreach skill recommends that
1012
+ // every send carry a verbatim quote from the recipient's public surface
1013
+ // (HN comment, GitHub issue, tweet) plus the URL it was lifted from. The
1014
+ // CLI doesn't (yet) enforce — when both are present they're validated and
1015
+ // logged into the action's metadata; when absent the send still goes
1016
+ // through. Flip to required once the prompt-side discipline catches up.
1017
+ function readAnchorOpts(opts) {
1018
+ let quote = opts['anchor-quote'] || opts.anchor_quote
1019
+ const url = opts['anchor-url'] || opts.anchor_url
1020
+ if (quote && String(quote).startsWith('@')) {
1021
+ quote = fs.readFileSync(String(quote).slice(1), 'utf8').trim()
1022
+ }
1023
+ if (!quote && !url) return null
1024
+ if (!quote || !url) throw new Error('--anchor-quote and --anchor-url must both be provided (or both omitted)')
1025
+ if (String(quote).length < 30) throw new Error(`--anchor-quote too short (${String(quote).length} chars); need >=30 chars of verbatim recipient text`)
1026
+ if (!/^https?:\/\//.test(String(url))) throw new Error(`--anchor-url must be a full URL, got: ${url}`)
1027
+ return { quote: String(quote).trim(), url: String(url).trim() }
1028
+ }
1029
+
1009
1030
  async function mailReply(rest, mode) {
1010
1031
  const opts = parseArgs(rest)
1011
1032
  const creds = requireAgentmailCredentials()
@@ -1404,6 +1425,7 @@ function mailUsage() {
1404
1425
 
1405
1426
  setup --prefix <name> [--force]
1406
1427
  send --to <email[,email]> --subject <s> --text @body.txt [--run-id <id>] [--dry-run]
1428
+ [--anchor-quote @./q.txt --anchor-url <url>] record the recipient's verbatim public quote
1407
1429
  reply --message-id <id> --text @reply.txt [--run-id <id>]
1408
1430
  reply-all --message-id <id> --text @reply.txt [--run-id <id>]
1409
1431
  forward --message-id <id> --to <email> [--text @body.txt] [--run-id <id>]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autark-cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "CLI for autark \u2014 hypothesis-driven product runbooks. Track products, hypotheses, runs, and actions from the terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",