autark-cli 0.4.1 → 0.5.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/autark.mjs +3 -90
- package/package.json +1 -1
package/autark.mjs
CHANGED
|
@@ -227,10 +227,6 @@ async function main() {
|
|
|
227
227
|
if (command === 'delete') return feedbackDelete(rest)
|
|
228
228
|
if (!command || command === '--help' || command === '-h') return feedbackUsage()
|
|
229
229
|
}
|
|
230
|
-
if (group === 'deliverability') {
|
|
231
|
-
if (command === 'check') return deliverabilityCheck(rest)
|
|
232
|
-
if (!command || command === '--help' || command === '-h') return deliverabilityUsage()
|
|
233
|
-
}
|
|
234
230
|
if (group === 'context') {
|
|
235
231
|
if (!command || command === '--help' || command === '-h') return contextUsage()
|
|
236
232
|
return context([command, ...rest].filter(Boolean))
|
|
@@ -782,60 +778,6 @@ function feedbackUsage() {
|
|
|
782
778
|
autark feedback delete <feedback-id>`)
|
|
783
779
|
}
|
|
784
780
|
|
|
785
|
-
// ====================================================== deliverability
|
|
786
|
-
|
|
787
|
-
// Pre-send email validator. Calls AgentMail's recipient-check endpoint so the
|
|
788
|
-
// agent can avoid blasting a guessed/permutated address and inflating the
|
|
789
|
-
// bounce rate. Falls back to a syntactic check if the endpoint is unreachable.
|
|
790
|
-
async function deliverabilityCheck(rest) {
|
|
791
|
-
const opts = parseArgs(rest)
|
|
792
|
-
const email = required(opts.email || opts._[0], 'email')
|
|
793
|
-
const creds = loadCredentials() || {}
|
|
794
|
-
const token = creds.agentmail_token
|
|
795
|
-
let verdict = { email, deliverable: null, source: 'syntactic', reason: '' }
|
|
796
|
-
|
|
797
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
|
798
|
-
verdict = { ...verdict, deliverable: false, reason: 'malformed address' }
|
|
799
|
-
console.log(JSON.stringify(verdict, null, 2))
|
|
800
|
-
process.exitCode = 1
|
|
801
|
-
return
|
|
802
|
-
}
|
|
803
|
-
if (!token) {
|
|
804
|
-
verdict.reason = 'no agentmail token; syntactic check only'
|
|
805
|
-
console.log(JSON.stringify(verdict, null, 2))
|
|
806
|
-
return
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
try {
|
|
810
|
-
const res = await fetch('https://api.agentmail.to/v0/deliverability/check', {
|
|
811
|
-
method: 'POST',
|
|
812
|
-
headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
|
|
813
|
-
body: JSON.stringify({ email }),
|
|
814
|
-
})
|
|
815
|
-
if (!res.ok) {
|
|
816
|
-
verdict.reason = `agentmail check ${res.status}; fell back to syntactic`
|
|
817
|
-
verdict.deliverable = null
|
|
818
|
-
} else {
|
|
819
|
-
const body = await res.json().catch(() => ({}))
|
|
820
|
-
verdict.source = 'agentmail'
|
|
821
|
-
verdict.deliverable = body.deliverable !== false
|
|
822
|
-
verdict.reason = body.reason || ''
|
|
823
|
-
if (body.risk) verdict.risk = body.risk
|
|
824
|
-
}
|
|
825
|
-
} catch (err) {
|
|
826
|
-
verdict.reason = `network error: ${err.message}`
|
|
827
|
-
}
|
|
828
|
-
console.log(JSON.stringify(verdict, null, 2))
|
|
829
|
-
if (verdict.deliverable === false) process.exitCode = 1
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
function deliverabilityUsage() {
|
|
833
|
-
console.log(`autark deliverability check <email>
|
|
834
|
-
Returns JSON {email, deliverable, source, reason}. Exits non-zero when the
|
|
835
|
-
address is known-undeliverable. Call this before logging an email action so
|
|
836
|
-
bounces don't tank your domain rep.`)
|
|
837
|
-
}
|
|
838
|
-
|
|
839
781
|
// rejectUnsendableAddress is defined near the top of the file (before main()
|
|
840
782
|
// runs) so the const Sets it depends on are out of TDZ when mailSend invokes
|
|
841
783
|
// it. See block tagged "address reject" up top.
|
|
@@ -856,9 +798,6 @@ async function mail(command, rest) {
|
|
|
856
798
|
if (command === 'raw') return mailRaw(rest)
|
|
857
799
|
if (command === 'attachment') return mailAttachment(rest)
|
|
858
800
|
if (command === 'request') return mailRequest(rest)
|
|
859
|
-
if (command === 'suppress') return mailSuppress(rest)
|
|
860
|
-
if (command === 'unsuppress') return mailUnsuppress(rest)
|
|
861
|
-
if (command === 'suppressed') return mailSuppressed(rest)
|
|
862
801
|
if (command === 'lint') return mailLint(rest)
|
|
863
802
|
mailUsage()
|
|
864
803
|
process.exit(1)
|
|
@@ -937,27 +876,6 @@ async function mailLint(rest) {
|
|
|
937
876
|
process.exit(1)
|
|
938
877
|
}
|
|
939
878
|
|
|
940
|
-
async function mailSuppress(rest) {
|
|
941
|
-
const opts = parseArgs(rest)
|
|
942
|
-
const entry = required(opts.email || opts._[0], 'email')
|
|
943
|
-
const reason = opts.reason || 'manual'
|
|
944
|
-
const result = await api('POST', '/v1/suppression', { entry, reason })
|
|
945
|
-
printJson(result)
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
async function mailUnsuppress(rest) {
|
|
949
|
-
const opts = parseArgs(rest)
|
|
950
|
-
const entry = required(opts.email || opts._[0], 'email')
|
|
951
|
-
const result = await api('DELETE', `/v1/suppression/${encodeURIComponent(entry)}`)
|
|
952
|
-
printJson(result)
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
async function mailSuppressed(rest) {
|
|
956
|
-
const opts = parseArgs(rest)
|
|
957
|
-
const limit = opts.limit ? Number(opts.limit) : 100
|
|
958
|
-
const result = await api('GET', `/v1/suppression?limit=${limit}`)
|
|
959
|
-
printJson(result)
|
|
960
|
-
}
|
|
961
879
|
|
|
962
880
|
async function mailSetup(rest) {
|
|
963
881
|
const opts = parseArgs(rest)
|
|
@@ -1414,15 +1332,11 @@ function mailUsage() {
|
|
|
1414
1332
|
raw <message_id>
|
|
1415
1333
|
attachment --message-id <id> --attachment-id <id> [--out file]
|
|
1416
1334
|
request <METHOD> <path> [--body @json] [--raw]
|
|
1417
|
-
suppress <email> [--reason "<text>"] add to org-wide send-block list
|
|
1418
|
-
unsuppress <email> remove from send-block list
|
|
1419
|
-
suppressed [--limit N] list blocked addresses
|
|
1420
1335
|
lint --body @draft.txt | <stdin> grade a draft for AI-tells; exit 1 on violations
|
|
1421
1336
|
|
|
1422
|
-
Mail uses the inbox-scoped token in ~/.autark/credentials.json.
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
hard-fail checks against a draft.`)
|
|
1337
|
+
Mail uses the inbox-scoped token in ~/.autark/credentials.json. --dry-run
|
|
1338
|
+
prints the payload without hitting SES. lint is fully local — runs the
|
|
1339
|
+
outreach skill's hard-fail checks against a draft.`)
|
|
1426
1340
|
}
|
|
1427
1341
|
|
|
1428
1342
|
function usage() {
|
|
@@ -1440,7 +1354,6 @@ function usage() {
|
|
|
1440
1354
|
log action record one outreach touch
|
|
1441
1355
|
action escalate flag an action for human attention
|
|
1442
1356
|
feedback record|delete leave a free-text nudge on a hypothesis
|
|
1443
|
-
deliverability check pre-send check for an email address
|
|
1444
1357
|
context [<slug>|...] pull product or hypothesis context
|
|
1445
1358
|
|
|
1446
1359
|
mail setup|send|reply|... send/read mail via your AgentMail inbox
|
package/package.json
CHANGED