ข้อมูลอ้างอิงคำสั่ง CLI
คำสั่ง postkub ทุกตัวพร้อม REST operation, scope ที่ต้องใช้, flag และ exit code
อัปเดตล่าสุด
เนื้อหาในหน้านี้
ข้อมูลอ้างอิงแบบสแกนได้ครบถ้วนของคำสั่ง postkub: ทุก operation ที่ยอมรับ พร้อม REST call ที่เรียก, scope ที่ key ต้องมี และ flag ที่แต่ละกลุ่มคำสั่งรับ โดย CLI ยังอยู่ในช่วง preview เท่านั้น — ดู คู่มือ CLI สำหรับการตั้งค่า ตัวอย่าง และการตั้งค่าคอนฟิก
ข้อควรระวัง
Postkub CLI ยังอยู่ในช่วง preview และยังไม่เปิดติดตั้งจาก npm ข้อมูลอ้างอิงนี้อธิบาย public interface ที่วางแผนไว้ ซึ่งคำสั่งและ flag อาจยังเปลี่ยนแปลงได้ก่อนเปิดตัวจริง
Operations ของ REST
คำสั่งทุกตัวด้านล่างเรียก REST ที่ได้รับอนุญาตเพียงหนึ่งครั้ง mutation ทุกตัวต้องมี UUID Idempotency-Key (สร้างให้เมื่อไม่ได้ส่ง --idempotency-key) และ resource ที่มีอยู่แล้วมี revision guard ด้วย --expected-revision โดย response 202 หมายถึงได้รับการยอมรับ ไม่ใช่ผู้ให้บริการทำเสร็จแล้ว
| Command | REST call | Required scope | ความหมาย |
|---|---|---|---|
brands list | GET /v1/brands | brand:read | แสดงรายการ Brand ที่ principal ที่ยืนยันตัวตนแล้วมองเห็น |
accounts list | GET /v1/accounts | account:read | แสดงรายการโซเชียลบัญชีที่เชื่อมต่อ กรองตาม Brand ได้ |
accounts schedule get | GET /v1/accounts/{id}/schedule-settings | account:read | อ่าน timezone และ weekly queue slot ของบัญชี |
accounts schedule update | PATCH /v1/accounts/{id}/schedule-settings | account:schedule | แก้ timezone และ/หรือ weekly queue slot ของบัญชี |
capabilities get | GET /v1/accounts/{id}/capabilities | account:read | อ่าน action ที่บัญชีนั้นทำได้พร้อมเหตุผล |
posts list | GET /v1/posts | post:read | แสดงรายการโพสต์พร้อม filter Brand, บัญชี, สถานะ และช่วงเวลา UTC |
posts get | GET /v1/posts/{id} | post:read | อ่านโพสต์หนึ่งรายการ |
posts create | POST /v1/posts | post:create | สร้าง draft |
posts update | PATCH /v1/posts/{id} | post:update | แก้ draft (มี revision guard) |
posts delete | DELETE /v1/posts/{id} | post:delete | ลบ draft ในเครื่องที่ยังไม่ถูกยอมรับ (มี revision guard) |
posts publish | POST /v1/posts/{id}/publish | post:publish | ยอมรับ publish-now สำหรับบัญชีที่เลือก (202 = ยอมรับแล้ว) |
posts schedule | POST /v1/posts/{id}/schedule | post:schedule | ยอมรับตารางที่ระบุ หรือจอง queue slot ถัดไปของแต่ละบัญชี (202 = ยอมรับแล้ว) |
posts cancel | POST /v1/posts/{id}/cancel | post:cancel | ยกเลิกงานที่ยังไม่เริ่มของบัญชีที่เลือก หรือขอ reconciliation |
posts retry | POST /v1/posts/{id}/retry | post:publish | ลองใหม่เฉพาะความล้มเหลวแบบ proven-no-effect ของบัญชีที่เลือก |
posts cover-retry | POST /v1/posts/{id}/cover-retry | post:publish | ลอง video cover ใหม่โดยไม่อัปโหลดวิดีโอซ้ำ |
threads list | GET /v1/threads | comment:read | แสดงรายการ inbox thread (filter: บัญชี, handled, โพสต์ที่ผูกไว้) |
threads get | GET /v1/threads/{id} | comment:read | อ่าน thread หนึ่งรายการพร้อมคอมเมนต์ |
threads update | PATCH /v1/threads/{id} | thread:update / thread:resolve | แก้สถานะ unread (thread:update) และ/หรือ handled (thread:resolve) |
comments list | GET /v1/comments | comment:read | แสดงรายการคอมเมนต์ (filter: บัญชี, thread, unread) |
comments reply | POST /v1/comments/{id}/replies | comment:reply | ยอมรับ reply แบบ durable (202 = ยอมรับแล้ว) |
insights account | GET /v1/accounts/{id}/insights | insight:read | อ่านเมตริกบัญชีที่บันทึกไว้และความสดของข้อมูล |
insights post | GET /v1/posts/{id}/insights | insight:read | อ่านเมตริกโพสต์ที่บันทึกไว้ตามบัญชีเป้าหมายที่ได้รับอนุญาต |
activity list | GET /v1/activity | activity:read | อ่านกิจกรรมโซเชียลใน scope พร้อมความล้มเหลวที่ทำความสะอาดแล้ว |
replies get | GET /v1/replies/{id} | comment:read | อ่านสถานะการทำงานและประวัติความพยายามของ reply |
requests get | GET /v1/requests/{requestId} | key ที่ถูกต้องใด ๆ | กู้ใบเสร็จ mutation แบบ durable ของ principal นี้ |
whoami | GET /v1/me | key ที่ถูกต้องใด ๆ | ตรวจดู principal, workspace, target ID และ action ที่ได้รับอนุญาต |
รายละเอียดระดับ API ของแต่ละ operation อยู่ใน API reference: discovery และ accounts, posts, publications, inbox, insights และ requests และ activity
Alias: inbox list รัน threads list, insights posts รัน insights post, และ threads resolve รัน threads update ด้วย handled: true (ตั้ง handled เป็น false ไม่ได้ และต้องใช้ scope thread:resolve)
คำสั่งในเครื่องและคำสั่งตั้งค่า
คำสั่งกลุ่มนี้ไม่ได้แมปกับ REST operation ทางโซเชียล โดย schema describe อ่านเอกสาร OpenAPI ของเซิร์ฟเวอร์ที่ GET /api/docs-json ส่วนที่เหลือรันในเครื่องทั้งหมด
| Command | ความหมาย |
|---|---|
postkub help, --help, -h | พิมพ์วิธีใช้คำสั่ง |
postkub --version, -v | พิมพ์เวอร์ชัน CLI |
postkub init [--non-interactive] | บันทึกและยืนยันการตั้งค่า, สรุป scope ที่ได้รับ และเสนอติดตั้ง agent guide |
postkub doctor [--verbose] | ตรวจเวอร์ชัน Node, config, รูปแบบ key, การเชื่อมต่อ, scope และความใหม่ของ CLI |
postkub config path/get/set/unset [--repo] | ดูหรือแก้ global และ repo config |
postkub context [--list / TOPIC] | พิมพ์หัวข้อ context ที่ agent อ่านได้ |
postkub completion bash/zsh/fish [--install] | พิมพ์หรือติดตั้ง shell completion |
postkub install claude/codex [--global] [--dry-run] | ติดตั้งคู่มือ Postkub ให้ coding agent |
postkub uninstall claude/codex [--global] [--dry-run] | ลบเนื้อหาคู่มือส่วนที่ Postkub จัดการออก |
postkub schema list | แสดงทุก operation ที่ยอมรับพร้อม scope และ flag (ในเครื่อง) |
postkub schema describe OPERATION | ดึง schema ของ operation หนึ่งตัวจากเอกสาร OpenAPI ที่เซิร์ฟเวอร์ให้บริการ |
init --non-interactive ยืนยันการตั้งค่าที่มีอยู่หรือ environment variables โดยไม่ถาม และ --output json ใช้ได้เฉพาะคู่กับ --non-interactive
Flag ทั่วไป (Global flags)
ใช้ได้กับทุกคำสั่ง ประเภท: value ต้องมีค่า, bool ไม่มีค่า, optvalue มีค่าได้หรือไม่มีก็ได้
| Flag | ประเภท | คำอธิบาย |
|---|---|---|
--output | value | auto (ค่าเริ่มต้น), pretty, human หรือ json; auto พิมพ์แบบมนุษย์บน TTY และ JSON เมื่อถูก pipe |
--timeout | value | deadline ต่อ request หน่วยวินาที 1–900 (ค่าเริ่มต้น 30) |
--quiet | bool | ซ่อนบรรทัดข้อมูลทาง stderr |
--verbose | bool | พิมพ์ rate-limit response header ทาง stderr |
--no-color | bool | ปิดสี ANSI |
Flag สำหรับ mutation
ใช้ได้กับทุก mutating command (ทุกอย่างที่ไม่ใช่ GET):
| Flag | ประเภท | คำอธิบาย |
|---|---|---|
--input | value | อินพุตแบบมีโครงสร้างจากไฟล์ หรือ - สำหรับ stdin |
--json | value | อินพุตแบบมีโครงสร้างในรูป JSON string แบบ inline |
--idempotency-key | value | UUID idempotency ที่ระบุเอง หากไม่ระบุจะสร้างให้ |
--wait | optvalue | หลังยอมรับ 202 จะ poll จนงานนิ่ง (ค่าเริ่มต้น 120 วินาที, exit code 6 เมื่อหมดเวลา) |
--dry-run | bool | ตรวจสอบในเครื่องและพรีวิว request เท่านั้น ไม่ส่งอะไร |
ใช้ได้เพียงหนึ่งใน --input / --json เท่านั้น โดย flag รายฟิลด์ช่วยเติมเอกสารได้ แต่แทนที่ฟิลด์ที่เอกสารระบุไว้แล้วไม่ได้
Flag สำหรับการอ่าน
ใช้ได้กับ GET command:
| Flag | ประเภท | คำอธิบาย |
|---|---|---|
--fields | value | projection แบบ dot path คั่นด้วยจุลภาค ขยายวงเล็บปีกกาได้, all คืนทั้งหมด |
--cursor | value | pagination cursor (เฉพาะ list command) |
--limit | value | ขนาดหน้า 1–100 (เฉพาะ list command) |
brands, accounts และ capabilities
| Command | Flag | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
brands list | --fields | value | ไม่ | ฉาย (project) response |
brands list | --cursor, --limit | value | ไม่ | Pagination |
accounts list | --brand-id | value | ไม่ | กรองตาม Brand หากไม่ใส่จะใช้ defaultBrandId ที่ตั้งไว้ |
accounts list | --fields, --cursor, --limit | value | ไม่ | Projection และ pagination |
accounts schedule get | --id หรือ --account-id | value | ใช้อย่างใดอย่างหนึ่ง | บัญชีเป้าหมาย, --account-id ใช้ defaultAccountId สำรอง |
accounts schedule get | --fields | value | ไม่ | ฉาย response |
accounts schedule update | --id หรือ --account-id | value | ใช้อย่างใดอย่างหนึ่ง | บัญชีเป้าหมาย |
accounts schedule update | --expected-revision | value | ใช่ | Revision guard |
accounts schedule update | --timezone | value | ไม่ | Timezone แบบ IANA เช่น Asia/Bangkok |
accounts schedule update | --slot | value (repeat) | ไม่ | Weekly slot รูปแบบ WEEKDAY:HH:MM, วันเป็น 1–7 หรือ mon–sun |
accounts schedule update | --clear-slots | bool | ไม่ | ลบ weekly slot ทั้งหมด ห้ามใช้คู่กับ --slot |
capabilities get | --account-id | value | ใช่ | บัญชีเป้าหมาย ใช้ defaultAccountId สำรอง |
capabilities get | --fields | value | ไม่ | ฉาย response |
posts
| Command | Flag | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
posts list | --brand-id | value | ไม่ | กรองตาม Brand หากไม่ใส่จะใช้ defaultBrandId |
posts list | --account-id | value | ไม่ | กรองตามบัญชี |
posts list | --status | value | ไม่ | ค่าใดค่าหนึ่งจาก draft, scheduled, publishing, published, failed, cancelled, needs_attention |
posts list | --from, --to | value | ไม่ | ช่วง UTC instant ต้องใส่คู่กัน |
posts list | --fields, --cursor, --limit | value | ไม่ | Projection และ pagination |
posts get | --id | value | ใช่ | Post ID |
posts create | --brand-id | value | ใช่ | Brand เจ้าของ |
posts create | --account-id | value (repeat) | ไม่ | บัญชีเป้าหมาย |
posts create | --text | value | ใช่ (หรือใน input) | ข้อความโพสต์ 1–5000 ตัวอักษร |
posts create | --media-url | value (repeat) | ไม่ | URL สื่อ HTTPS สาธารณะเรียงลำดับ |
posts create | --media-kind | value | ไม่ | image หรือ video, วิดีโอต้องมีสื่อรายการเดียว |
posts create | --first-comment | value | ไม่ | คอมเมนต์แรกพื้นฐาน (มากสุด 2200 ตัวอักษร, ขึ้นกับ capability) |
posts update | --id | value | ใช่ | Post ID |
posts update | --expected-revision | value | ใช่ (หรือใน input) | Revision guard |
posts update | --text, --media-url, --media-kind, --first-comment, --account-id | value / repeat | ไม่ | ความหมายเดียวกับ create |
posts delete | --id | value | ใช่ | Post ID ของ draft ที่ยังไม่ถูกยอมรับ |
posts delete | --expected-revision | value | ใช่ (หรือใน input) | Revision guard |
posts publish | --id | value | ใช่ | Post ID |
posts publish | --expected-revision | value | ไม่ | Revision guard หากไม่ใส่ต้องอยู่ในเอกสาร input |
posts publish | --account-id | value (repeat) | ไม่ | target ย่อย การเผยแพร่ต้องมีอย่างน้อยหนึ่งบัญชี |
posts publish | --replace-existing | bool | ไม่ | แทนที่งานที่ยังไม่เริ่มของบัญชีที่เลือก |
posts schedule | --id | value | ใช่ | Post ID |
posts schedule | --expected-revision | value | ใช่ (หรือใน input) | Revision guard |
posts schedule | --next-slot | bool | ไม่ | จอง weekly slot ว่างที่เร็วที่สุดของแต่ละบัญชีที่เลือก |
posts schedule | --account-id | value (repeat) | ไม่ | target ย่อย (ใช้คู่กับ --next-slot) |
posts cancel | --id | value | ใช่ | Post ID |
posts cancel | --expected-revision | value | ไม่ | Revision guard |
posts cancel | --account-id | value (repeat) | ไม่ | target ย่อยที่ต้องการยกเลิก |
posts retry / posts cover-retry | --id | value | ใช่ | Post ID |
posts retry / posts cover-retry | --expected-revision | value | ไม่ | Revision guard |
posts retry / posts cover-retry | --account-id | value (repeat) | ไม่ | target ย่อยที่ต้องการลองใหม่ |
posts create, posts update, posts schedule, posts cancel, posts retry, posts cover-retry และ posts delete ยังรับรูปแบบเอกสาร JSON เต็มผ่าน --input / --json ด้วยฟิลด์ที่อธิบายไว้ใน posts API และ publications API
inbox: threads, comments และ replies
| Command | Flag | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
threads list / inbox list | --account-id | value | ไม่ | กรองตามบัญชี หากไม่ใส่จะใช้ defaultAccountId |
threads list / inbox list | --handled | value | ไม่ | true หรือ false |
threads list / inbox list | --post-target-id | value | ไม่ | กรองตาม post target ที่ผูกไว้, ค่า none เลือก thread ที่ไม่ผูกกับโพสต์ |
threads list / inbox list | --fields, --cursor, --limit | value | ไม่ | Projection และ pagination |
threads get | --id | value | ใช่ | Thread ID |
threads update | --id | value | ใช่ | Thread ID |
threads update | --expected-revision | value | ใช่ (หรือใน input) | Revision guard |
threads update | --handled | value | ไม่ | true หรือ false, true ต้องใช้ thread:resolve |
threads update | --unread | value | ไม่ | true หรือ false, ต้องใช้ thread:update |
comments list | --account-id | value | ไม่ | กรองตามบัญชี หากไม่ใส่จะใช้ defaultAccountId |
comments list | --thread-id | value | ไม่ | กรองตาม thread |
comments list | --unread | value | ไม่ | true หรือ false |
comments list | --fields, --cursor, --limit | value | ไม่ | Projection และ pagination |
comments reply | --id | value | ใช่ | Comment ID ที่ต้องการตอบ |
comments reply | --text | value | ใช่ (หรือใน input) | ข้อความตอบ 1–2200 ตัวอักษร |
replies get | --id | value | ใช่ | Reply ID |
insights และ activity
| Command | Flag | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
insights account | --account-id หรือ --id | value | ใช้อย่างใดอย่างหนึ่ง | บัญชีเป้าหมาย, --account-id ใช้ defaultAccountId สำรอง |
insights account | --range-start-utc, --range-end-utc | value | ไม่ | คู่ UTC instant ห่างกันมากสุด 90 วัน, ค่าเริ่มต้นคือ 30 วันล่าสุด |
insights account | --fields | value | ไม่ | ฉาย response |
insights account | --dry-run | bool | ไม่ | พรีวิว request ในเครื่อง |
insights post / insights posts | --id | value | ใช่ | Post ID |
insights post / insights posts | --range-start-utc, --range-end-utc | value | ไม่ | คู่ UTC instant |
insights post / insights posts | --fields | value | ไม่ | ฉาย response |
insights post / insights posts | --dry-run | bool | ไม่ | พรีวิว request ในเครื่อง |
activity list | --brand-id | value | ไม่ | กรองตาม Brand หากไม่ใส่จะใช้ defaultBrandId |
activity list | --account-id, --post-id | value | ไม่ | กรองตามบัญชีหรือโพสต์ |
activity list | --from, --to | value | ไม่ | ช่วง UTC instant |
activity list | --fields, --cursor, --limit | value | ไม่ | Projection และ pagination |
ดูรูปร่าง response ได้ที่ insights API และ requests และ activity API
requests
| Command | Flag | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
requests get | --id | value | ใช่ | Request UUID โดย CLI พิมพ์ค่านี้ทาง stderr ก่อนทุก mutation |
config
| Command | Flag | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
config path | --repo | bool | ไม่ | พิมพ์ path ของ repo config แทน global |
config get | --repo | bool | ไม่ | อ่านค่า repo แทนค่าที่ใช้จริง |
config get | --all | bool | ไม่ | พิมพ์ทุกค่าที่ใช้จริง (เฉพาะ global) |
config set | KEY VALUE | positional | ใช่ | ตั้งค่า key ที่อนุญาต, apiKey จะถูกปฏิเสธ |
config set | --repo | bool | ไม่ | เขียนลง repo config |
config unset | KEY | positional | ใช่ | ลบ key ที่อนุญาต |
config unset | --repo | bool | ไม่ | ลบจาก repo config |
key ที่อนุญาต: defaultBrandId, defaultAccountId, output, timeout ในทั้งสองระดับ, apiUrl เฉพาะไฟล์ global (ผ่าน init) และ apiKey ห้ามตั้งผ่าน config set เด็ดขาด
init, doctor และคู่มือ agent
| Command | Flag | ประเภท | คำอธิบาย |
|---|---|---|---|
init | --non-interactive | bool | ใช้ environment หรือ config เดิม ไม่มีการถาม |
init | --output json | value | สรุปแบบ machine-readable ใช้ได้เฉพาะคู่กับ --non-interactive |
doctor | --verbose | bool | พิมพ์ทุกการตรวจ ไม่ใช่เฉพาะที่ล้มเหลว |
install claude/codex | --global | bool | เขียนที่ไฟล์คู่มือระดับผู้ใช้แทนระดับโปรเจกต์ |
install claude/codex | --dry-run | bool | พรีวิวการเปลี่ยนแปลงโดยไม่เขียนไฟล์ |
uninstall claude/codex | --global, --dry-run | bool | flag เดียวกับ install |
completion bash/zsh/fish | --install | bool | เขียน completion block ที่จัดการแล้วและรายงาน path |
context และ schema
| Command | Argument / flag | คำอธิบาย |
|---|---|---|
context | ไม่มี | พิมพ์ทุกหัวข้อ context เป็น markdown |
context --list | flag | พิมพ์รายการหัวข้อ |
context TOPIC | positional | พิมพ์หัวข้อเดียว, ดูตารางหัวข้อใน คู่มือ CLI |
schema list | ไม่มี | แสดงทุก operation ที่ยอมรับในเครื่อง |
schema describe | positional OPERATION | ดึง schema OpenAPI ที่เซิร์ฟเวอร์ให้บริการของ operation หนึ่งตัว |
Exit codes
ตาราง exit code ใช้ร่วมกับคู่มือ CLI: exit codes โดยสรุป: 0 ยอมรับ/เสร็จสมบูรณ์, 1 ข้อผิดพลาด client ที่ไม่คาดคิด, 2 usage/schema, 3 การยืนยันตัวตน/การอนุญาต, 4 API ปฏิเสธ, 5 transport/ไม่ชัดเจน, 6 หมดเวลารอ, 130 SIGINT, 143 SIGTERM
