@tocca-systems/twp-cli 0.124.0 → 0.125.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/CHANGELOG.public.md +8 -0
- package/README.md +19 -4
- package/dist/{agent-loop-YZDERKOZ.js → agent-loop-DDEL6F4B.js} +1 -1
- package/dist/{api-command-PUJG2C46.js → api-command-Z5LXIW43.js} +1 -1
- package/dist/{app-RXPPP6OY.js → app-STLDLWJJ.js} +1 -1
- package/dist/{brief-D2SB55CL.js → brief-2JDLQOYS.js} +1 -1
- package/dist/{chunk-36RJGHYX.js → chunk-267PCVC4.js} +22 -11
- package/dist/{chunk-NBFEYISM.js → chunk-2LFYNWTT.js} +1 -1
- package/dist/{chunk-BYVBFDKK.js → chunk-37G5JJIY.js} +1 -1
- package/dist/{knowledge-K4227CPL.js → chunk-ERMKZMGS.js} +19 -11
- package/dist/{chunk-5IQPCE23.js → chunk-WDE24TCO.js} +6 -6
- package/dist/cli.js +42 -7
- package/dist/{commands-3ES4OSE6.js → commands-TSQN2TW7.js} +5 -5
- package/dist/knowledge-WVHKCKC4.js +5 -0
- package/dist/{media-S4O6UQOF.js → media-FEZK3NAX.js} +1 -1
- package/dist/note-2RJWN5TQ.js +83 -0
- package/dist/{plan-submit-4NJUCFSZ.js → plan-submit-WY6MIKFG.js} +1 -1
- package/dist/{registry-2NQMVPRH.js → registry-NC3KLYHI.js} +1 -1
- package/dist/{run-XO6IDWIW.js → run-GUA6UQTY.js} +1 -1
- package/dist/{sns-6VTN3EJD.js → sns-BINSUYD4.js} +33 -8
- package/dist/{teams-7AGJSV5H.js → teams-NQFFNTBK.js} +1 -1
- package/package.json +1 -1
package/CHANGELOG.public.md
CHANGED
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
`CHANGELOG.md` に残してあります。顧客向けの履歴は public 公開以降を対象とします。
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
|
+
## 0.125.0
|
|
15
|
+
|
|
16
|
+
`twp note` でノートを作成・更新・削除できるようになりました(`twp note create` / `update` / `delete`)。あわせて、コメントの一覧・投稿・書き換え・削除(`twp note comment`)、お気に入り(`twp note favorite`)、いいね(`twp note reaction`)、タグとカテゴリの一覧(`twp note tag list` / `twp note category list`)、他テナントのノートの購読(`twp note subscription`)、サムネイルの作り直し(`twp note thumbnail regenerate`)ができます。`twp note list` は `--category`・`--subscribed`(購読先のノート)・`--public`(公開ノート)で絞り込めるようになりました。
|
|
17
|
+
|
|
18
|
+
`twp teams mention list` がチャットとチャネルを別々に問い合わせるようになり、取りこぼしが起きにくくなりました。上限に達したときの案内を原因ごとに正し、`--strict` で取りこぼしの可能性があるときに終了コード 3 を返せるようになりました。
|
|
19
|
+
|
|
20
|
+
`twp sns edit` で、TWP の下書き・予約中の SNS 投稿の本文と画像を編集できるようになりました。送る前に変更前後の本文と画像の枚数を表示し、画面など他で更新されていた投稿は上書きせずに止めます。
|
|
21
|
+
|
|
14
22
|
## 0.124.0
|
|
15
23
|
|
|
16
24
|
`twp task list` の `--status` でステータスのコードを `default:` を省いて指定できるようになりました(例: `--status open`)。未完了のタスクだけを出す `--open-only` と、指定したステータスを除く `--status-not`(複数回指定・カンマ区切り可)を追加しました。個人タスク(`--project __private__`)でも使えます。
|
package/README.md
CHANGED
|
@@ -83,11 +83,11 @@ TWP(Tocca Working Platform)を、ターミナルから使うための CLI
|
|
|
83
83
|
| **できる** | `twp budget` による予実管理(年度の予実ダッシュボード・サマリー・部署行の内訳と未割当・CSV 出力、目標の一覧・JSON でのまとめ登録・前年度からのコピー・CSV の取り込みと雛形、プロジェクトの部署按分の参照と全件置換)。分析の権限と予実管理ページの閲覧対象への登録が要り、目標の書き込みは全体管理者か分析の権限が「管理者」の人です |
|
|
84
84
|
| **できる** | `twp workflow` による、自分が申請できる申請書・申請書の定義(管理者)・自分の申請・承認履歴・自分の承認待ちの参照(申請書は名前でも指定できます)と、申請の起票・提出・更新・削除、承認・却下・差し戻し・取下げ、承認画面の AIチェックの結果の表示と承認者コメント |
|
|
85
85
|
| **できる** | `twp report` による自分のレポート(日報)の一覧(フォーマット・状態・語で絞り込み)・詳細と、下書きの作成(フォーマットの入力項目から雛形を出せます)・更新・提出・AI アドバイス、使えるレポートフォーマットの一覧。確認者としての一覧(未読・書いた人・作成日で絞り込み)・既読・コメント・確認済み・確認の取り消し・差し戻し |
|
|
86
|
-
| **できる** | `twp wiki` / `twp note` / `twp meeting` による、wiki ページ(親ページ直下の子の一覧を含む)・ノート・議事録(開催日の期間で絞り込み)の一覧と、本文を `--output text` で文書として読むこと。wiki
|
|
86
|
+
| **できる** | `twp wiki` / `twp note` / `twp meeting` による、wiki ページ(親ページ直下の子の一覧を含む)・ノート・議事録(開催日の期間で絞り込み)の一覧と、本文を `--output text` で文書として読むこと。wiki ページの作成・更新・移動・削除と、ノートの作成・更新・削除・コメント・お気に入り・いいね・購読と、親子構造・タグ・版の履歴と差分・被リンク・関連タスクの読み取り、索引(`twp wiki digest`)の出力 |
|
|
87
87
|
| **できる** | `twp knowledge` によるドメイン知識(社内 Wiki 相当のナレッジベース)の一覧・詳細・作成・設定変更・削除と、記事の一覧(ディレクトリ・深さで絞り込み)・本文(Markdown)を読む・作成・更新・移動・削除。KB は ID でも slug でも指定できます。KB の作成・設定変更・削除はドメイン知識の管理者だけです |
|
|
88
88
|
| **できる** | `twp outlook` / `twp teams` / `twp onedrive` による Microsoft 365 の読み取り(メール・添付・予定、Teams のチーム・チャネル・チャット(メンバーを含む)・メッセージ・スレッド返信・自分宛てメンション、OneDrive のファイルの一覧・情報・ダウンロード)。TWP に Microsoft アカウントでログインしたことがあるユーザーが対象です。書き込みはメールの送信・返信・全員返信・転送(`twp outlook mail send` / `reply` / `reply-all` / `forward`)、Teams のチャット送信・チャネル投稿・スレッド返信(`twp teams message send` / `reply send`)とリアクションの付け外し(`twp teams reaction add` / `remove`)、予定の作成・更新・削除(`twp outlook event create` / `update` / `delete`)、共有リンクの作成(`twp onedrive link create`)ができ(いずれも `--yes` が必要)、OneDrive へのアップロード(`twp onedrive item upload`)もできます |
|
|
89
89
|
| **できる** | `twp slack` による Slack の読み取り(登録済みワークスペース・チャネル・DM・メンバー・メッセージ・スレッド返信・自分宛てメンション・メッセージ検索)と、メッセージ送信・スレッド返信(`twp slack message send` / `reply send`・`--yes` が必要)、お気に入りのチャネル・DM の管理(`twp slack favorite`)。TWP の個人設定で Slack のユーザートークンを登録したユーザーが対象です |
|
|
90
|
-
| **できる** | `twp sns` による広報の SNS 投稿(連携しているアカウントの一覧、X 上の自分の投稿と公開指標の一覧、TWP
|
|
90
|
+
| **できる** | `twp sns` による広報の SNS 投稿(連携しているアカウントの一覧、X 上の自分の投稿と公開指標の一覧、TWP の下書き・予約の一覧と編集、X への投稿・画像付き投稿・予約、X の投稿と TWP の下書き・予約の削除、AI による投稿原稿の作成)。投稿系でいま使えるのは X だけです(LinkedIn・Facebookページ・Instagram は順次対応)。連携は画面で行います。投稿・削除・原稿作成・X からの取り直しは `--yes` が必要で、X の費用を送る前に表示します |
|
|
91
91
|
| **できる** | `twp task-loop` による、TWP のタスクキューを手元の AI CLI に実行させる常駐ループ |
|
|
92
92
|
| **できる** | `twp task-loop item` / `history` による、エージェントループのキューの一覧・投入・更新・先頭への移動・削除と、期間を指定した実行履歴の参照。更新・移動・削除はテナントの管理者の権限が要ります |
|
|
93
93
|
| **できる** | `twp completion bash` / `zsh` / `fish` / `powershell` によるシェル補完(コマンド名・操作名・フラグ名。プロジェクトやステータスの値は補完しません)と、`twp configure` による既定のプロジェクト・出力形式・Backlog スペース・既定プロファイルの対話設定 |
|
|
@@ -1945,8 +1945,20 @@ twp wiki update <ページID> --section <見出し> --content-file <パス|-> [
|
|
|
1945
1945
|
twp wiki append <ページID> --content-file <パス|-> [--if-version <版>] # 本文の末尾へ追記する
|
|
1946
1946
|
twp wiki move <ページID> [--parent <ページID>|root] [--sort-order <順>]
|
|
1947
1947
|
twp wiki delete <ページID> --yes
|
|
1948
|
-
twp note list [--mine] [--favorite] [--status <draft|published>] [--visibility <private|tenant|external|public>] [--keyword <語>] [--all]
|
|
1948
|
+
twp note list [--mine] [--favorite] [--status <draft|published>] [--visibility <private|tenant|external|public>] [--category <カテゴリID>] [--tag <タグ>] [--keyword <語>] [--all]
|
|
1949
|
+
twp note list --subscribed [--tenant <テナントID>] [--tag <タグ>] [--keyword <語>] [--all] # 購読している他テナントのノート
|
|
1950
|
+
twp note list --public [--tag <タグ>] [--keyword <語>] [--all] # 公開範囲 public のノート
|
|
1949
1951
|
twp note get <ノートID> --output text
|
|
1952
|
+
twp note create --title <件名> --content-file <パス|-> [--content-format <html|markdown>] [--status <draft|published>] [--visibility <公開範囲>] [--category <カテゴリID>] [--tag <タグ>]... [--eyecatch <ファイルID>] [--anonymous|--no-anonymous]
|
|
1953
|
+
twp note update <ノートID> [--title <件名>] [--content-file <パス|->] [--status ...] [--visibility ...] [--category <カテゴリID>|--clear-category] [--tag <タグ>...|--clear-tags] [--eyecatch <ファイルID>|--clear-eyecatch]
|
|
1954
|
+
twp note delete <ノートID> --yes
|
|
1955
|
+
twp note comment list|create|update|delete <ノートID> [<コメントID>] [--body <本文>|--body-file <パス|->] # delete は --yes
|
|
1956
|
+
twp note favorite add|remove <ノートID>
|
|
1957
|
+
twp note reaction list|toggle <ノートID>
|
|
1958
|
+
twp note tag list
|
|
1959
|
+
twp note category list
|
|
1960
|
+
twp note subscription list|available|add|remove [<テナントID>] # available / add / remove はノートの管理者のみ・remove は --yes
|
|
1961
|
+
twp note thumbnail regenerate <ノートID> --yes
|
|
1950
1962
|
twp meeting list [--from <YYYY-MM-DD>] [--to <YYYY-MM-DD>] [--project <コード|ID>] [--keyword <語>] [--tag <タグ>]... [--all]
|
|
1951
1963
|
twp meeting get <議事録ID> --output text
|
|
1952
1964
|
```
|
|
@@ -1967,7 +1979,8 @@ twp meeting get <議事録ID> --output text
|
|
|
1967
1979
|
- `twp wiki append` と `twp wiki update --section <見出し>` は全文を取得・送信せずに本文を部分的に変えます(サーバが全文を組み立て、版・版の履歴・活動履歴・リンクは全文更新と同じように更新されます)。`append` は末尾へ足し(Markdown は空行を1つ挟む)、`--section` は見出しの行を残してその節の本文だけを差し替えます。節は同じか上位の次の見出しの直前までで、下位の見出しはまとめて差し替わります。見出しは `wiki get --section` と同じ規則で探しますが、見つからない・同名が複数あるときはサーバが断り、何も変えずに終了コード 3 です。`--if-version` を付けなくてもサーバは読んだ版を条件に書くので他の更新を消しません。結果には更新後の版を出します(本文は出しません)。`--section` と一緒に使えるのは `--content-file` と `--if-version` だけです
|
|
1968
1980
|
- ナレッジの鮮度は `--verified-at`(最終実測日。`today` は日本時間の今日)・`--evidence-task`(根拠タスクのキー・複数回可・置き換え)・`--kind`(種別)でページに記録します。`twp wiki list --stale-days <N>` は最終実測日が N 日以上前のページと未設定のページを、実測日の古い順に出します(要約列は `status` / `verified_at` / `knowledge_kind` / `evidence_task_keys`)。サーバがこの属性を返さない古い版だと絞り込みが効かないので、そのときは stderr で知らせます
|
|
1969
1981
|
- 編集・移動・削除できるのはページの作成者・wiki の管理者・組織の管理者です。権限が無ければサーバの文面をそのまま出して終了コード 3 です
|
|
1970
|
-
-
|
|
1982
|
+
- ノートの本文は wiki と同じく `--content-file` から読み、`--content-format` を省くと拡張子で形式を決めます(決まらなければサーバの既定の HTML)。本文の上限はサーバと同じ 300,000 バイト(UTF-8)です。`update` は指定した項目だけを送ります。`twp note favorite add` はサーバがノートの存在を確かめないので、ID は `twp note list` から取ってください。`twp note reaction toggle` は押すたびに付く/外れるが入れ替わり、結果の `reacted` が操作後の状態です。`twp note thumbnail regenerate` は AI 画像の作り直しを依頼するだけで(非同期)、テナントのクレジットを消費するので `--yes` が要ります
|
|
1983
|
+
- 議事録の書き込みはまだできません(`twp api /api/v2/meetings/...` で到達できます)。ヘルプは `twp wiki help` / `twp note help` / `twp meeting help`
|
|
1971
1984
|
|
|
1972
1985
|
### ドメイン知識(ナレッジベース)を操作する
|
|
1973
1986
|
|
|
@@ -2259,6 +2272,7 @@ twp sns list --channel x --fetch --yes # X から新着と
|
|
|
2259
2272
|
twp sns list --channel x --status <draft|scheduled|publishing|published|failed|all> [--all] # TWP の下書き・予約
|
|
2260
2273
|
twp sns post --channel x (--text <文字列> | --text-file <パス>) [--media <画像> …] [--at <日時>] --yes
|
|
2261
2274
|
twp sns post --channel x --text <1件目> --thread <2件目> [--thread <3件目> …] [--at <日時>] --yes # X のスレッド(--thread-file <パス> でも可)
|
|
2275
|
+
twp sns edit --channel x <UUID> [--text <文字列> | --text-file <パス>] [--media <画像> … | --clear-media] --yes # TWP の下書き・予約を編集
|
|
2262
2276
|
twp sns delete --channel x <ID> --yes # 数字 = X の投稿 / UUID = TWP の下書き・予約
|
|
2263
2277
|
twp sns draft --channel <x|linkedin|facebook|instagram> [--channel …] (--from content:<ID> | --from post:<ID> | --text-file <パス>) [--tone polite|casual|business] --yes
|
|
2264
2278
|
```
|
|
@@ -2268,6 +2282,7 @@ twp sns draft --channel <x|linkedin|facebook|instagram> [--channel …] (--from
|
|
|
2268
2282
|
- `post` は下書きを作り、画像をアップロードして紐づけ、投稿(`--at` があれば予約)します。本文か画像のどちらかがあれば送れます(画像だけの投稿もできます)。途中で止まったら作った下書きを消します。通信の失敗・サーバの一時エラーで止まったときは投稿・予約が成立していることがあるので、打ち直す前に `list` で確かめてください。画像は JPEG・PNG・WEBP・GIF を4枚まで(5MB・GIF は 15MB まで)。`--at` のタイムゾーンを省くと日本時間です
|
|
2269
2283
|
- `post --thread`(または `--thread-file`)を繰り返すと、2件目以降を返信としてつなげた **X のスレッド**にします(予約でも使えます)。1件目を含めて25件まで・各件 X の上限(280。日本語は1字2)まで・続きの空は不可で、超えるものは送らずに止めます。**費用は件ごと**で、URL を含む件だけがリンク付きの単価です(URL を2件目以降に置けば1件目は通常の単価)。送る前に件ごとの費用と合計を表示します。画像は1件目にだけ付きます。途中で失敗すると、それまでの件は X に出たまま残ります(再送はしません)。何件目まで出たかを `list --status all` と `list` で確かめてから打ち直してください
|
|
2270
2284
|
- `list` は既定で X 上の投稿を TWP のキャッシュから返します。キャッシュが6時間より古いとサーバが新着だけを取りに行き、その読み取りもクレジットを消費します(画面で開いたときと同じ。送る前に注記し、実際に読み取ったら知らせます)。まだ一度も取得していない連携は `--fetch --yes` で取得するまで空です
|
|
2285
|
+
- `edit` は TWP の下書き・予約中の投稿(`list --status draft|scheduled` の id)の本文と画像を書き換えます。送る前に変更前後の本文と画像の枚数を表示します(`--dry-run` で確かめられます)。`--media` は画像を置き換え(いまの画像は外れます)、`--clear-media` はすべて外します(画像の差し替えはいま X だけ)。予約日時とスレッドの続きは変えません。取得してから送るまでに画面など他で更新されていたら、上書きせずに止めます(終了コード 3)。投稿済みの X の投稿は X に編集の API が無いため編集できません
|
|
2271
2286
|
- `delete` は ID の形で対象が変わります。**予約の取り消し**は `list --status scheduled` の id(UUID)を渡します。TWP から投稿済みの記録は TWP 側では消せないので、X 上の投稿(数字の ID)を消してください(案内を表示します)
|
|
2272
2287
|
- `draft` は原稿を作るだけで保存も投稿もしません(AI クレジットを消費)。`--output text` で読める形に出せます。素材は 20,000 文字まで送り、超えた分は切ったことを表示します
|
|
2273
2288
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{stepToItem}from"./chunk-YAN3G35K.js";import{loadLocalConfig}from"./chunk-7QHDTO2Z.js";import{parseOperations}from"./chunk-DWW7EKJD.js";import"./chunk-VYDPW2YO.js";import"./chunk-TTST7UDR.js";import
|
|
3
|
+
import{stepToItem}from"./chunk-YAN3G35K.js";import"./chunk-VEEZJNOB.js";import{loadLocalConfig}from"./chunk-7QHDTO2Z.js";import{parseOperations}from"./chunk-DWW7EKJD.js";import"./chunk-VYDPW2YO.js";import"./chunk-TTST7UDR.js";import{loadAiConfig}from"./chunk-ZFSWQQH3.js";import{SKILL_PREFIX_RE,setSkillPrefix}from"./chunk-6CS5L24D.js";import"./chunk-N2UVRM3Z.js";import{parseRequiredPlatforms}from"./chunk-VAC2M4RC.js";import"./chunk-GYX2ZXQM.js";
|
|
4
4
|
import{PRIVATE_PROJECT_PREFIX,PRIVATE_PROJECT_REF,isPrivateProjectRef,privateProjectId}from"./chunk-RMFLTSOV.js";import"./chunk-BD7O73GK.js";import"./chunk-VGT2EGH6.js";import"./chunk-SBRTBKEZ.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{requireResolved,singleRef,withResolved}from"./chunk-PS5QFKHB.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";
|
|
5
5
|
import"./chunk-PMOUHEJQ.js";import"./chunk-J7QYPKVK.js";import"./chunk-5WGOHFAS.js";import"./chunk-RZVI6PMW.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LABEL="\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30EB\u30FC\u30D7\u306E\u30A2\u30A4\u30C6\u30E0";var STATUSES=["pending","processing","completed","failed","cancelled"];var AI_TYPES=["claude","gemini","codex","copilot"];var EFFORTS=["low","medium","high","xhigh","max"];var PRIORITIES=["P0","P1","P2","P3"];var LIST_COLUMNS=["item_id","status","task_key","label","ai_type","ai_effort","runner_id","created_at"];var GET_COLUMNS=["item_id","status","task_key","label","prompt","ai_type","ai_model","ai_e\
|
|
6
6
|
ffort","runner_id","attempt_count","reclaim_count","error_message","created_by_name","created_at","started_at","completed_at"];var HISTORY_COLUMNS=["item_id","status","task_key","skill","ai_type","runner_id","duration_ms","cost_usd","created_at"];var PLAN_RESULTS=["enqueued","empty","json_not_found","ai_failed","error","skipped","gated","locked","abandoned"];var PLAN_HISTORY_COLUMNS=["plan_run_id","result","runner_id","ai_type","duration_ms","cost_usd","step_count","started_at"];var PROJECT_FLAG={
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{CommandModelMissingError,MAX_REPORTED_VIOLATIONS,loadCommandModelDomain,loadCommandModelRoutes,validateBody,validateQuery}from"./chunk-4UVHLNUA.js";import{exitCodeFor,fetchAllPages,reportError}from"./chunk-
|
|
3
|
+
import{CommandModelMissingError,MAX_REPORTED_VIOLATIONS,loadCommandModelDomain,loadCommandModelRoutes,validateBody,validateQuery}from"./chunk-4UVHLNUA.js";import{exitCodeFor,fetchAllPages,reportError}from"./chunk-37G5JJIY.js";import"./chunk-WDE24TCO.js";import{evaluateQuery}from"./chunk-F5QDUPQO.js";import{renderOutput}from"./chunk-P4QSPSOQ.js";import"./chunk-Q3B65OFC.js";import{describeWaitResult,parseWaitOptions,waitUntilTerminal}from"./chunk-WVCEKC7V.js";
|
|
4
4
|
import{readBody}from"./chunk-HEH3PUW2.js";import{ALLOW_REDACTED_FLAG,NO_REDACT_FLAG,NO_REDACT_NOTICE}from"./chunk-W4NLJ2YK.js";import{redactSecretValues,redactSecrets,withDebug}from"./chunk-BD7O73GK.js";import{parseOperationArgs,repeatedValues}from"./chunk-VGT2EGH6.js";import"./chunk-QV4K6V2L.js";import{ApiError,RepeatedQueryValue,TwpApiClient,appendQuery,appendRepeatable,isArrayQueryKey}from"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";
|
|
5
5
|
import"./chunk-MMVXE2CJ.js";import"./chunk-SBRTBKEZ.js";import{DEFAULT_MAX_ITEMS,DEFAULT_MAX_PAGES,envelopePaging,isPageNumberEnvelope,pageRangeNotes,positiveInteger,readEnvelopeCursor,readPageNumberCursor,shellQuote}from"./chunk-MI6HVYR2.js";import"./chunk-3ZRMMBP5.js";import{ApiResponseError,EXIT_OK,EXIT_WAIT_TIMEOUT,NetworkError,UsageError}from"./chunk-VFPY2A23.js";import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{AuthSession,NotLoggedInError,SessionExpiredError,
|
|
6
6
|
loadCredentials}from"./chunk-XNLIEUAW.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{effectiveApiUrl,resolveConfiguredOutput,resolveProfile}from"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import{HELP_TOKEN}from"./chunk-KD4YXQOZ.js";import"./chunk-OKATZ4SN.js";import{OUTPUT_FORMATS,resolveOutputFormat}from"./chunk-RKBUJKI5.js";import"./chunk-UREA4ZIG.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var MIN_SEGMENT_CHARS=3;var parsedCache=new WeakMap;function splitSegments(path){return path.split("/").filter(segment=>segment!=="")}function parseRoutes(routes){const cached=parsedCache.get(routes);if(cached!==void 0)return cached;const parsed=[];for(const[key,domain]of Object.entries(routes.routes)){const space=key.indexOf(" ");if(space<=0)continue;const template=key.slice(space+1);parsed.push({method:key.slice(0,space),template,domain,segments:splitSegments(template).map(segment=>/^\{[^/{}]+\}$/.
|
|
@@ -1212,7 +1212,7 @@ cwd()){const listed=await gitListFiles(cwd2);const raw=listed??await walkFiles(c
|
|
|
1212
1212
|
1;const after=/^[^\s]*/.exec(text.slice(cursor))?.[0]??"";return{query,start,end:cursor+after.length}}var TWP_SLASH_ROUTES={"/tasks":{domain:"task",operation:"list"},"/task":{domain:"task",operation:"get"},"/projects":{domain:"project",operation:"list"}};function isTwpSlashCommand(name){return Object.hasOwn(TWP_SLASH_ROUTES,name)}async function runTwpSlashCommand(name,args,deps){const route=TWP_SLASH_ROUTES[name];if(!Object.hasOwn(TWP_SLASH_ROUTES,name)||route===void 0){return{code:2,out:"",err:`\u4E0D\u660E\u306A\u30B3\u30DE\u30F3\u30C9: ${name}
|
|
1213
1213
|
`}}const parsed=parseArgv([route.domain,route.operation,...args]);if(parsed.command!=="domain"||parsed.domain!==route.domain){return{code:2,out:"",err:`${name}: \u3053\u306E\u5F15\u6570\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08${args.join(" ")}\uFF09
|
|
1214
1214
|
`}}if(parsed.unknown.length>0){return{code:2,out:"",err:`\u4E0D\u660E\u306A\u5F15\u6570: ${formatUnknownArgs(parsed.unknown)}
|
|
1215
|
-
`}}let out="";let err="";const io={out:text=>void(out+=text),err:text=>void(err+=text),isTty:true};const globals={profile:parsed.profile??deps.profile,...parsed.output!==void 0?{output:parsed.output}:{},...parsed.query!==void 0?{query:parsed.query}:{},dryRun:parsed.dryRun,debug:parsed.debug,yes:parsed.yes,refresh:parsed.refresh};const{runDomain}=await import("./run-
|
|
1215
|
+
`}}let out="";let err="";const io={out:text=>void(out+=text),err:text=>void(err+=text),isTty:true};const globals={profile:parsed.profile??deps.profile,...parsed.output!==void 0?{output:parsed.output}:{},...parsed.query!==void 0?{query:parsed.query}:{},dryRun:parsed.dryRun,debug:parsed.debug,yes:parsed.yes,refresh:parsed.refresh};const{runDomain}=await import("./run-GUA6UQTY.js");try{const code=await runDomain({domain:route.domain,...parsed.operation!==void 0?{operation:parsed.operation}:
|
|
1216
1216
|
{},argv:parsed.domainArgv,help:parsed.domainHelp,globals,version:deps.version,io,...deps.fetchImpl!==void 0?{fetchImpl:deps.fetchImpl}:{}});return{code,out,err}}catch(e){return{code:1,out,err:`${err}${e.message}
|
|
1217
1217
|
`}}}var GIT_LOG_OUTPUT=["9f3c1a2 feat(ui): \u4E00\u89A7\u306E\u30D5\u30A3\u30EB\u30BF\u3092 URL \u30AF\u30A8\u30EA\u3068\u540C\u671F\u3059\u308B","4b8e0d7 fix(ui): \u4EEE\u60F3\u30B9\u30AF\u30ED\u30FC\u30EB\u306E\u884C\u9AD8\u3055\u3092\u5B9F\u6E2C\u5024\u306B\u5408\u308F\u305B\u308B","c15a99e refactor(api): \u4E00\u89A7\u53D6\u5F97\u306E\u30DA\u30FC\u30B8\u30F3\u30B0\u51E6\u7406\u3092\u5171\u901A\u5316\u3059\u308B","2d70f4b test: \u4E00\u89A7\u30D5\u30A3\u30EB\u30BF\u306E\u56DE\u5E30\u30C6\u30B9\u30C8\u3092\u8FFD\u52A0\u3059\u308B",
|
|
1218
1218
|
"a6e2b38 fix(api): \u7A7A\u306E\u691C\u7D22\u6761\u4EF6\u3067\u5168\u4EF6\u8FD4\u3089\u306A\u3044\u3088\u3046\u306B\u3059\u308B","7c40d51 chore(deps): \u958B\u767A\u4F9D\u5B58\u3092\u6700\u65B0\u3078\u66F4\u65B0\u3059\u308B","e83b1c6 docs: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u624B\u9806\u306B Node 22 \u306E\u524D\u63D0\u3092\u8FFD\u8A18\u3059\u308B","b91f7a4 fix(ui): \u30E2\u30FC\u30C0\u30EB\u306E\u91CD\u306A\u308A\u9806\u3092\u6307\u5B9A\u3059\u308B","5a2c8e0 perf(api): \u4E00\u89A7\u306E N+1 \u3092\u89E3\u6D88\u3059\u308B",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{notificationDomain}from"./chunk-WDTGZ5G6.js";import{outlookDomain}from"./chunk-PYJP4RPG.js";import{reportDomain}from"./chunk-OTQ3D7SR.js";import{teamsDomain}from"./chunk-
|
|
3
|
+
import{notificationDomain}from"./chunk-WDTGZ5G6.js";import{outlookDomain}from"./chunk-PYJP4RPG.js";import{reportDomain}from"./chunk-OTQ3D7SR.js";import{teamsDomain}from"./chunk-267PCVC4.js";import"./chunk-5JUE6FZC.js";import{graphData}from"./chunk-M37IYSEG.js";import"./chunk-Q3B65OFC.js";import{workflowDomain}from"./chunk-NOUYMQNO.js";import"./chunk-BE3KTK6C.js";import"./chunk-RB74YCRT.js";import"./chunk-57RI73JO.js";import"./chunk-JJSBBWJ5.js";
|
|
4
4
|
import"./chunk-HEH3PUW2.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-VGT2EGH6.js";import"./chunk-QV4K6V2L.js";import{ApiError}from"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import{ms365NotConnectedGuidance}from"./chunk-MMVXE2CJ.js";import"./chunk-SBRTBKEZ.js";import{positiveInteger}from"./chunk-MI6HVYR2.js";import"./chunk-PS5QFKHB.js";import{isRecord}from"./chunk-3ZRMMBP5.js";
|
|
5
5
|
import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var BRIEF_SOURCES=["events","tasks","mail","mentions","reports","approvals","notifications"];var SOURCE_LABEL={events:"\u4E88\u5B9A",tasks:"\u30BF\u30B9\u30AF\uFF08\u671F\u9650\u5207\u308C\u30FB\u4ECA\u65E5\u30FB\u660E\u65E5\uFF09",mail:"\u672A\u8AAD\u30E1\u30FC\u30EB",mentions:"\u672A\u8AAD\u30E1\u30F3\u30B7\u30E7\u30F3\uFF08Teams\uFF09",reports:"\u672A\u8AAD\u306E\u65E5\u5831\uFF08\u78BA\u8A8D\u8005\u3068\u3057\u3066\uFF09",approvals:"\u627F\u8A8D\u5F85\u3061",notifications:"\u901A\u77E5"};var BRIEF_SCHEMA_VERSION=1;
|
|
6
6
|
var DAYS_MAX=14;var MAIL_LIMIT_DEFAULT=5;var MAIL_LIMIT_MAX=50;var MAIL_COUNT_SCAN=200;var EVENT_SCAN=100;var REPORT_PAGE_LIMIT=100;var REPORT_MAX_PAGES=5;var CONCURRENCY=4;var SOURCE_TIMEOUT_MS=6e4;var TASKS_MY_GROUPED_PATH="/api/v2/tasks/my/grouped";var TASK_GROUPS=["overdue","today","this_week","later","no_due_date"];var USAGE="twp brief [--days <N>] [--mail-limit <N>] [--include <\u30BD\u30FC\u30B9,...>] [--exclude <\u30BD\u30FC\u30B9,...>]";function sourceList(raw,flag){if(raw===void 0)return void 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
3
|
import{textToHtml}from"./chunk-5JUE6FZC.js";import{cursorFlag,graphData,graphListFlags,graphPaging,graphPagingHelp,graphPagingNotes,graphValue,ms365Forbidden,plainText,str,teamsFromText,topFlag}from"./chunk-M37IYSEG.js";import{readBody}from"./chunk-HEH3PUW2.js";import{repeatedValues}from"./chunk-VGT2EGH6.js";import{assertMs365PathSegment,ms365Path,ms365Segment}from"./chunk-MMVXE2CJ.js";import{nonEmpty}from"./chunk-MI6HVYR2.js";import{requireResolved,singleRef,
|
|
4
|
-
withResolved}from"./chunk-PS5QFKHB.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";var KINDS=["channel","chat"];var TEAM_ID=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var DESCRIPTION_MAX=2e3;var NAME_MAX=255;var FAVORITE_COLUMNS=["kind","display_name","description","sort_order","team_id","id"];var KIND_FLAG={name:"--kind",summary:"\u7A2E\u5225\u3067\u7D5E\u308B\uFF08channel | chat\uFF09",takesValue:true,placeholder:"<\u7A2E\u5225>"};var TEAM_FLAG={name:"--team",summary:"\u30C1\u30FC\u30E0\uFF08\u540D\u524D\u304B ID\uFF09",takesValue:true,placeholder:"<\u540D\u524D\
|
|
4
|
+
withResolved}from"./chunk-PS5QFKHB.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";var KINDS=["channel","chat"];var TEAM_ID=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var DESCRIPTION_MAX=2e3;var NAME_MAX=255;var FAVORITE_COLUMNS=["kind","display_name","description","sort_order","team_id","id"];var KIND_FLAG={name:"--kind",summary:"\u7A2E\u5225\u3067\u7D5E\u308B\uFF08channel | chat\uFF09",takesValue:true,placeholder:"<\u7A2E\u5225>"};var TEAM_FLAG={name:"--team",summary:"\u30C1\u30FC\u30E0\uFF08\u540D\u524D\u304B ID\uFF09",takesValue:true,placeholder:"<\u540D\u524D\
|
|
5
5
|
|ID>"};var CHANNEL_FLAG={name:"--channel",summary:"\u30C1\u30E3\u30CD\u30EB\uFF08\u540D\u524D\u304B ID\uFF09",takesValue:true,placeholder:"<\u540D\u524D|ID>"};var CHAT_FLAG={name:"--chat",summary:"\u30C1\u30E3\u30C3\u30C8ID\uFF08twp teams chat list \u306E id\uFF09",takesValue:true,placeholder:"<ID>"};var DESCRIPTION_FLAG={name:"--description",summary:`\u7528\u9014\u306E\u8AAC\u660E\uFF08${DESCRIPTION_MAX}\u6587\u5B57\u307E\u3067\u3002"" \u3067\u7A7A\u306B\u3059\u308B\uFF09`,takesValue:true,placeholder:"\
|
|
6
6
|
<\u6587>"};var NAME_FLAG={name:"--name",summary:"\u8868\u793A\u540D\uFF08\u7701\u304F\u3068\u30C1\u30E3\u30CD\u30EB\u306F\u30C1\u30E3\u30CD\u30EB\u540D\u3001\u30C1\u30E3\u30C3\u30C8\u306F\u30C8\u30D4\u30C3\u30AF\u304B\u81EA\u5206\u4EE5\u5916\u306E\u53C2\u52A0\u8005\u540D\uFF09",takesValue:true,placeholder:"<\u540D\u524D>"};var FAVORITES_PATH="/teams/favorites";function parseKind(raw,usage){if(raw===void 0)return void 0;const kind=raw.trim();if(!KINDS.includes(kind)){throw new UsageError(`\u7A2E\u5225\u306B\u6307\u5B9A\u3067\u304D\
|
|
7
7
|
\u308B\u306E\u306F channel / chat \u3067\u3059\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${raw}\uFF09`,usage)}return kind}function parseKey(raw,usage){const slash=raw.indexOf("/");if(slash<0){throw new UsageError(`\u304A\u6C17\u306B\u5165\u308A\u306F <\u7A2E\u5225>/<ID> \u306E\u5F62\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${raw}\uFF09`,usage)}const kind=parseKind(raw.slice(0,slash),usage);const id=assertMs365PathSegment(raw.slice(slash+1).
|
|
@@ -148,14 +148,25 @@ graphPagingHelp(MESSAGE_TOP_MAX),flags:[{name:"--message",summary:"\u6295\u7A3FI
|
|
|
148
148
|
message,"\u6295\u7A3FID");const teamId=await resolveTeam(input,ctx,usage);return withResolved(input,{messageId,teamId,channelId:await resolveChannel(input,ctx,teamId,usage)})},plan(input){const message=ms365Segment(requireResolved(input,"messageId"),"\u6295\u7A3FID");return{method:"GET",path:ms365Path(`${channelPath2(input)}/messages/${message}/replies`),query:{top:topFlag(input,MESSAGE_TOP_MAX),skiptoken:cursorFlag(input,"skiptoken")}}},summarize:body=>graphValue(body,"\u8FD4\u4FE1\u4E00\u89A7").
|
|
149
149
|
map(messageRow),raw:body=>graphValue(body,"\u8FD4\u4FE1\u4E00\u89A7"),notes:body=>graphPagingNotes(body,"\u8FD4\u4FE1\u4E00\u89A7")},replySendOperation]};var reactionResource={name:"reaction",summary:"\u30E1\u30C3\u30BB\u30FC\u30B8\u3078\u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\uFF08\u30B9\u30BF\u30F3\u30D7\uFF09\u3092\u4ED8\u3051\u308B\u30FB\u5916\u3059",operations:reactionOperations({teamFlag:TEAM_FLAG3,channelFlag:CHANNEL_FLAG3})};function mentionResult(body){const data=graphData(body,"\u30E1\u30F3\u30B7\u30E7\u30F3\
|
|
150
150
|
\u4E00\u89A7");if(!Array.isArray(data["mentions"])){throw new ApiResponseError("\u30E1\u30F3\u30B7\u30E7\u30F3\u4E00\u89A7\u306E\u5FDC\u7B54\u306B mentions \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return data}function mentionRow(row){const source=isRecord(row)?row:{};const from=isRecord(source["from"])?str(source["from"]["display_name"]):null;const where=source["scope"]==="chat"?str(source["chat_topic"])??
|
|
151
|
-
"\u30C1\u30E3\u30C3\u30C8":"\u30C1\u30E3\u30CD\u30EB";return pick({...source,from,where},MENTION_COLUMNS)}var
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
"\u30C1\u30E3\u30C3\u30C8":"\u30C1\u30E3\u30CD\u30EB";return pick({...source,from,where},MENTION_COLUMNS)}var MENTION_LIMIT_DEFAULT=50;var MENTION_STRICT_KEY=Symbol("mention-strict");var MENTION_FAILED_KEY=Symbol("mention-failed");var MENTION_BUDGET_GUIDANCE={chat_list_pages:"\u30C1\u30E3\u30C3\u30C8\u4E00\u89A7\u306E\u8AAD\u307F\u53D6\u308A\u4E0A\u9650\uFF081,000\u4EF6\uFF09\u306B\u9054\u3057\u307E\u3057\u305F\u3002\u30B5\u30FC\u30D0\u304C\u4E00\u89A7\u3092\u6700\u7D42\u30E1\u30C3\u30BB\u30FC\u30B8\u9806\u3067\u6253\u3061\u5207\u308C\u3066\u3044\u306A\u3044\uFF08\u4E26\u3079\u66FF\u3048\u975E\u5BFE\u5FDC\u30FB\u66F4\u65B0\u524D\u306E\u30B5\u30FC\u30D0\uFF09\u306A\u3089\u30C1\u30E3\u30C3\u30C8\u306E\u7DCF\u6570\u3067\u6C7A\u307E\u308A\u3001\u671F\u9593\u3092\u77ED\u304F\u3057\u3066\u3082\u89E3\u6D88\u3057\u307E\u305B\u3093\u3002\u6CE8\u8A18\u306B\u4E26\u3079\u66FF\u3048\u306E\u8A18\u8F09\u304C\u7121\u3051\u308C\u3070\u3001\u671F\u9593\u5185\u306B\u52D5\u3044\u305F\u30C1\u30E3\u30C3\u30C8\u304C\u591A\u3059\u304E\u308B\u306E\u3067\u671F\u9593\u3092\u77ED\u304F\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
152
|
+
active_chats:"\u671F\u9593\u5185\u306B\u52D5\u3044\u305F\u30C1\u30E3\u30C3\u30C8\u304C50\u4EF6\u3092\u8D85\u3048\u3001\u65B0\u3057\u304450\u4EF6\u3060\u3051\u3092\u898B\u307E\u3057\u305F\u3002--since \u3092\u9045\u3089\u305B\u308B\uFF08\u671F\u9593\u3092\u77ED\u304F\u3059\u308B\uFF09\u3068\u89E3\u6D88\u3057\u307E\u3059",chat_message_pages:"1\u3064\u306E\u30C1\u30E3\u30C3\u30C8\u3067\u671F\u9593\u5185\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C250\u4EF6\u3092\u8D85\u3048\u3001\u53E4\u3044\u5206\u3092\u898B\u3066\u3044\u307E\u305B\u3093\u3002\u671F\u9593\u3092\u77ED\u304F\u3059\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059",
|
|
153
|
+
search_pages:"\u30C1\u30E3\u30CD\u30EB\u691C\u7D22\u306E\u4E0A\u9650\uFF08200\u4EF6\uFF09\u306B\u9054\u3057\u307E\u3057\u305F\u3002\u691C\u7D22\u306F\u95A2\u9023\u5EA6\u9806\u306E\u305F\u3081\u3001\u671F\u9593\u3092\u77ED\u304F\u3057\u3066\u3082\u89E3\u6D88\u3059\u308B\u3068\u306F\u9650\u308A\u307E\u305B\u3093",wall_clock:"\u6642\u9593\u306E\u4E0A\u9650\uFF081\u56DE20\u79D2\uFF09\u306B\u9054\u3057\u307E\u3057\u305F\u3002\u671F\u9593\u3092\u77ED\u304F\u3057\u3066\u304F\u3060\u3055\u3044"};function mentionBudgetNote(scope,kinds){
|
|
154
|
+
if(kinds.length===0)return null;const label=scope==="chats"?"\u30C1\u30E3\u30C3\u30C8":"\u30C1\u30E3\u30CD\u30EB";const detail=kinds.map(kind=>`${kind}: ${MENTION_BUDGET_GUIDANCE[kind]??"\u4E0A\u9650\u306B\u9054\u3057\u307E\u3057\u305F"}`).join(" \uFF0F ");return`${label}\u306E\u8D70\u67FB\u304C\u4E0A\u9650\u306B\u9054\u3057\u305F\u305F\u3081\u3001\u53D6\u308A\u3053\u307C\u3057\u304C\u3042\u308A\u3048\u307E\u3059\uFF08${detail}\uFF09\u3002`}function mentionTime(row){const at=isRecord(row)?Date.parse(
|
|
155
|
+
String(row["created_at"])):NaN;return Number.isNaN(at)?-Infinity:at}function stringList(value){return Array.isArray(value)?value.map(String):[]}function mentionScopes(input){const scope=nonEmpty(input.flags,"--scope")?.trim();if(scope!==void 0&&!["chats","channels","all"].includes(scope)){throw new UsageError(`--scope \u306B\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F chats / channels / all \u3067\u3059\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${scope}\uFF09`)}return scope==="chats"||scope==="ch\
|
|
156
|
+
annels"?[scope]:["chats","channels"]}function mentionPlan(input,scope){return{method:"GET",path:ms365Path("/teams/mentions"),query:{since:nonEmpty(input.flags,"--since"),until:nonEmpty(input.flags,"--until"),unread_only:input.flags.has("--unread")?"true":void 0,scope,limit:topFlag(input,MENTION_LIMIT_MAX),mention_types:nonEmpty(input.flags,"--type")}}}async function executeMentionList(input,ctx){const scopes=mentionScopes(input);const parts=[];const failed=[];for(const scope of scopes){try{parts.
|
|
157
|
+
push({scope,data:mentionResult(await ctx.send(mentionPlan(input,scope)))})}catch(error){failed.push({scope,error})}}if(parts.length===0)throw failed[0]?.error;const limit=Number(topFlag(input,MENTION_LIMIT_MAX)??MENTION_LIMIT_DEFAULT);const all=parts.flatMap(({data})=>data["mentions"]).sort((a,b)=>mentionTime(b)-mentionTime(a));const matched=parts.reduce((sum,{data})=>sum+(Number(data["matched_count"])||0),0);const mentions2=all.slice(0,limit);const scanned={};for(const{data}of parts){if(!isRecord(
|
|
158
|
+
data["scanned"]))continue;for(const[key,value]of Object.entries(data["scanned"]))scanned[key]=(scanned[key]??0)+(Number(value)||0)}const byScope={};for(const{scope,data}of parts)byScope[scope]=stringList(data["budget_exhausted"]);const first=parts[0]?.data??{};const merged={mentions:mentions2,returned_count:mentions2.length,matched_count:matched,truncated:matched>mentions2.length,query:{...isRecord(first["query"])?first["query"]:{},scope:scopes.length>1?"all":scopes[0]},scanned,budget_exhausted:[
|
|
159
|
+
...new Set(Object.values(byScope).flat())],budget_exhausted_by_scope:byScope,errors:[...parts.flatMap(({data})=>Array.isArray(data["errors"])?data["errors"]:[]),...failed.map(({scope,error})=>({scope,status:null,message:error?.message??String(error)}))],notes:[...new Set(parts.flatMap(({data})=>stringList(data["notes"])))]};Object.defineProperty(merged,MENTION_STRICT_KEY,{value:input.flags.has("--strict"),enumerable:false});Object.defineProperty(merged,MENTION_FAILED_KEY,{value:failed,enumerable:false});
|
|
160
|
+
return{success:true,status:200,data:merged}}var mentionResource={name:"mention",summary:"\u81EA\u5206\u5B9B\u3066\u306E\u30E1\u30F3\u30B7\u30E7\u30F3\uFF08\u30C1\u30E3\u30C3\u30C8\u30FB\u30C1\u30E3\u30CD\u30EB\u6A2A\u65AD\uFF09",operations:[{name:"list",summary:"\u81EA\u5206\u5B9B\u3066\u306E\u30E1\u30F3\u30B7\u30E7\u30F3\u3092\u4E00\u89A7\u3059\u308B\uFF08\u65E2\u5B9A\u306F\u76F4\u8FD17\u65E5\uFF09",usage:"twp teams mention list [--since <\u65E5\u6642>] [--until <\u65E5\u6642>] [--unread] [--scope chats|channels|a\
|
|
161
|
+
ll] [--limit <\u4EF6\u6570>] [--type <\u7A2E\u985E>] [--strict]",description:"\u30C1\u30E3\u30C3\u30C8\u3068\u30C1\u30E3\u30CD\u30EB\u3092\u6A2A\u65AD\u3057\u3066\u3001\u81EA\u5206\u5B9B\u3066\uFF08\u500B\u4EBA\u30FB\u30BF\u30B0\u30FB\u30C1\u30E3\u30CD\u30EB\u5168\u4F53\uFF09\u306E\u30E1\u30F3\u30B7\u30E7\u30F3\u3092\u65B0\u3057\u3044\u9806\u306B\u8FD4\u3057\u307E\u3059\u3002\n\u65E2\u5B9A\u306E\u671F\u9593\u306F --until\uFF08\u65E2\u5B9A\u306F\u4ECA\uFF09\u304B\u3089\u9061\u3063\u30667\u65E5\u3067\u3059\u3002--since / --until \u306F 2026-10-01 \u3084\n2026-10-01T09:00:00+09:00 \u306E\u5F62\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002\u65E5\u4ED8\u3060\u3051\u306A\u3089\u305D\u306E\u65E5\u306E 0\u6642\uFF08\u65E5\u672C\u6642\u9593\uFF09\u306A\u306E\u3067\u3001\n--until 2026-10-01 \u306F 10\u67081\u65E5\u3092\u542B\u307F\u307E\u305B\u3093\uFF08\u542B\u3081\u308B\u306A\u3089 --until 2026-10-02\uFF09\u3002\n--type \u306F user / tag / conversation \u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u3002\n\n\u30B5\u30FC\u30D0\u304C\u8D70\u67FB\u3057\u3066\u7D50\u679C\u3092\u8FD4\u3059\u306E\u3067\u3001\u30DA\u30FC\u30B8\u30F3\u30B0\u306F\u3042\u308A\u307E\u305B\u3093\uFF08--all \u306F\u7121\u304F\u3001--limit \u306E\u65E2\u5B9A\u306F 50\u30FB\u4E0A\u9650\u306F 200\uFF09\u3002\n\u4E00\u81F4\u3057\u305F\u4EF6\u6570\u304C --limit \u3092\u8D85\u3048\u305F\u30FB\u8D70\u67FB\u304C\u6642\u9593\u3084\u4EF6\u6570\u306E\u4E0A\u9650\u306B\u9054\u3057\u305F\u30FB\u4E00\u90E8\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u305F\u5834\u5408\u306F\u3001\n\u305D\u306E\u3053\u3068\u3092\u5FC5\u305A\u8868\u793A\u3057\u307E\u3059\uFF08\u8868\u793A\u304C\u7121\u3051\u308C\u3070\u53D6\u308A\u3053\u307C\u3057\u306F\u3042\
|
|
162
|
+
\u308A\u307E\u305B\u3093\uFF09\u3002\n\n--scope all\uFF08\u65E2\u5B9A\uFF09\u306F\u30C1\u30E3\u30C3\u30C8\u3068\u30C1\u30E3\u30CD\u30EB\u3092\u5225\u3005\u306B\u554F\u3044\u5408\u308F\u305B\u3066\u7D50\u5408\u3057\u307E\u3059\uFF08\u305D\u308C\u305E\u308C\u304C\u6642\u9593\u306E\u4E0A\u9650\u3092\u6301\u3064\u305F\u3081\uFF09\u3002\n--strict \u3092\u4ED8\u3051\u308B\u3068\u3001\u8D70\u67FB\u304C\u4E0A\u9650\u306B\u9054\u3057\u305F\u30FB\u4E00\u90E8\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u305F\u3068\u304D\u306B\u7D42\u4E86\u30B3\u30FC\u30C9\u3092 3 \u306B\u3057\u307E\u3059\uFF08\u81EA\u52D5\u51E6\u7406\u3067\u53D6\u308A\u3053\u307C\u3057\u3092\u691C\u77E5\u3059\u308B\u7528\uFF09\u3002\n\n--output json \u306F\u4EF6\u6570\u30FB\u8D70\u67FB\u7BC4\u56F2\u30FB\u6CE8\u8A18\u3092\u542B\u3080\u691C\u7D22\u7D50\u679C\u5168\u4F53\u3092\u51FA\u3057\u307E\u3059\uFF08\u4E00\u89A7\u306F mentions\u30FB\u7BC4\u56F2\u3054\u3068\u306E\u4E0A\u9650\u306F budget_exhausted_by_scope\uFF09\u3002\n\u30C1\u30E3\u30CD\u30EB\u6295\u7A3F\u306E\u672A\u8AAD\u306F Microsoft 365 \u304B\u3089\u53D6\u5F97\u3067\u304D\u306A\u3044\u305F\u3081\u3001is_unread \u304C null \u306B\u306A\u308A\u307E\u3059\uFF08--unread \u3067\u3082\u6B8B\u3057\u307E\u3059\uFF09\u3002",
|
|
154
163
|
flags:[{name:"--since",summary:"\u3053\u306E\u65E5\u6642\u4EE5\u964D\uFF08\u65E2\u5B9A\u306F --until \u306E7\u65E5\u524D\uFF09",takesValue:true,placeholder:"<\u65E5\u6642>"},{name:"--until",summary:"\u3053\u306E\u65E5\u6642\u307E\u3067\uFF08\u65E2\u5B9A\u306F\u4ECA\uFF09",takesValue:true,placeholder:"<\u65E5\u6642>"},{name:"--unread",summary:"\u672A\u8AAD\u3060\u3051\u306B\u3059\u308B",takesValue:false},{name:"--scope",summary:"\u63A2\u3059\u7BC4\u56F2\uFF08chats | channels | all\u30FB\u65E2\u5B9A all\uFF09",
|
|
155
|
-
takesValue:true,placeholder:"<\u7BC4\u56F2>"},{name:"--limit",summary:`\u8FD4\u3059\u4EF6\u6570\uFF08\u65E2\u5B9A 50\u30FB\u4E0A\u9650 ${MENTION_LIMIT_MAX}\uFF09`,takesValue:true,placeholder:"<\u4EF6\u6570>"},{name:"--type",summary:"\u30E1\u30F3\u30B7\u30E7\u30F3\u306E\u7A2E\u985E\uFF08user,tag,conversation\uFF09",takesValue:true,placeholder:"<\u7A2E\u985E>"}
|
|
156
|
-
void 0?NaN:Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(raw.trim())?`${raw.trim()}T00:00:00+09:00`:raw.trim());if(!Number.isNaN(at(since))&&!Number.isNaN(at(until))&&at(since)>at(until)){throw new UsageError(`--until \u306F --since \u3088\u308A\u5F8C\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08--since ${String(since)} / --
|
|
157
|
-
|
|
158
|
-
if(data["truncated"]===true){out.push(`\u4E00\u81F4\u3057\u305F ${String(data["matched_count"])} \u4EF6\u306E\u3046\u3061 ${String(data["returned_count"])} \u4EF6\u3060\u3051\u3092\u8868\u793A\u3057\u3066\u3044\u307E\u3059\uFF08--limit \u3067\u5897\u3084\u305B\u307E\u3059\u3002\u4E0A\u9650 ${MENTION_LIMIT_MAX}\uFF09\u3002`)}const
|
|
159
|
-
|
|
160
|
-
isArray(data["notes"])?data["notes"]:[]){if(typeof note==="string"&¬e!=="")out.push(note)}return out}
|
|
161
|
-
|
|
164
|
+
takesValue:true,placeholder:"<\u7BC4\u56F2>"},{name:"--limit",summary:`\u8FD4\u3059\u4EF6\u6570\uFF08\u65E2\u5B9A 50\u30FB\u4E0A\u9650 ${MENTION_LIMIT_MAX}\uFF09`,takesValue:true,placeholder:"<\u4EF6\u6570>"},{name:"--type",summary:"\u30E1\u30F3\u30B7\u30E7\u30F3\u306E\u7A2E\u985E\uFF08user,tag,conversation\uFF09",takesValue:true,placeholder:"<\u7A2E\u985E>"},{name:"--strict",summary:"\u8D70\u67FB\u306E\u4E0A\u9650\u5230\u9054\u30FB\u53D6\u5F97\u5931\u6557\u3067\u7D42\u4E86\u30B3\u30FC\u30C9 3 \u306B\u3059\u308B",
|
|
165
|
+
takesValue:false}],forbidden:ms365Forbidden,plan(input){const since=nonEmpty(input.flags,"--since");const until=nonEmpty(input.flags,"--until");const at=raw=>raw===void 0?NaN:Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(raw.trim())?`${raw.trim()}T00:00:00+09:00`:raw.trim());if(!Number.isNaN(at(since))&&!Number.isNaN(at(until))&&at(since)>at(until)){throw new UsageError(`--until \u306F --since \u3088\u308A\u5F8C\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08--since ${String(since)} / --unti\
|
|
166
|
+
l ${String(until)}\uFF09`)}return mentionPlan(input,mentionScopes(input)[0])},plannedNotes(input){return mentionScopes(input).length>1?["\u3053\u306E\u3042\u3068\u540C\u3058\u6761\u4EF6\u3067 --scope channels \u3082\u9001\u308A\u3001\u7D50\u679C\u3092\u7D50\u5408\u3057\u307E\u3059\uFF08\u30C1\u30E3\u30C3\u30C8\u3068\u30C1\u30E3\u30CD\u30EB\u306F\u5225\u3005\u306B\u554F\u3044\u5408\u308F\u305B\u307E\u3059\uFF09\u3002"]:[]},execute:executeMentionList,summarize:body=>mentionResult(body)["mentions"].
|
|
167
|
+
map(mentionRow),raw:mentionResult,notes(body){const data=mentionResult(body);const out=[];if(data["truncated"]===true){out.push(`\u4E00\u81F4\u3057\u305F ${String(data["matched_count"])} \u4EF6\u306E\u3046\u3061 ${String(data["returned_count"])} \u4EF6\u3060\u3051\u3092\u8868\u793A\u3057\u3066\u3044\u307E\u3059\uFF08--limit \u3067\u5897\u3084\u305B\u307E\u3059\u3002\u4E0A\u9650 ${MENTION_LIMIT_MAX}\uFF09\u3002`)}const byScope=isRecord(data["budget_exhausted_by_scope"])?data["budget_exhausted_by_\
|
|
168
|
+
scope"]:{};for(const scope of["chats","channels"]){const note=mentionBudgetNote(scope,stringList(byScope[scope]));if(note!==null)out.push(note)}const errors=Array.isArray(data["errors"])?data["errors"]:[];if(errors.length>0){out.push(`${errors.length} \u4EF6\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u305F\u305F\u3081\u3001\u305D\u306E\u5206\u306E\u30E1\u30F3\u30B7\u30E7\u30F3\u306F\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093\uFF08--output json \u306E errors \u306B\u8A73\u7D30\u304C\u3042\u308A\u307E\u3059\uFF09\u3002`)}
|
|
169
|
+
for(const note of Array.isArray(data["notes"])?data["notes"]:[]){if(typeof note==="string"&¬e!=="")out.push(note)}return out},failures(body){const out=[];const failed=isRecord(body)&&isRecord(body["data"])?body["data"][MENTION_FAILED_KEY]:void 0;for(const{scope,error}of Array.isArray(failed)?failed:[]){out.push({target:`\u30E1\u30F3\u30B7\u30E7\u30F3\uFF08${scope}\uFF09`,error})}const data=isRecord(body)&&isRecord(body["data"])?body["data"]:null;if(data===null||data[MENTION_STRICT_KEY]!==true)
|
|
170
|
+
return out;const byScope=isRecord(data["budget_exhausted_by_scope"])?data["budget_exhausted_by_scope"]:{};for(const scope of["chats","channels"]){const exhausted=stringList(byScope[scope]);if(exhausted.length>0){out.push({target:`\u30E1\u30F3\u30B7\u30E7\u30F3\u8D70\u67FB\uFF08${scope}\uFF09`,error:new ApiRejectedError(`\u8D70\u67FB\u304C\u4E0A\u9650\u306B\u9054\u3057\u307E\u3057\u305F\uFF08${exhausted.join("\u3001")}\uFF09\u3002\u53D6\u308A\u3053\u307C\u3057\u304C\u3042\u308A\u3048\u307E\u3059\u3002`)})}}
|
|
171
|
+
const reported=(Array.isArray(data["errors"])?data["errors"]:[]).length-out.filter(f=>f.target.startsWith("\u30E1\u30F3\u30B7\u30E7\u30F3\uFF08")).length;if(reported>0){out.push({target:"\u30E1\u30F3\u30B7\u30E7\u30F3\u53D6\u5F97",error:new ApiRejectedError(`${reported} \u4EF6\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08--output json \u306E errors \u306B\u8A73\u7D30\u304C\u3042\u308A\u307E\u3059\uFF09\u3002`)})}return out}}]};var teamsDomain={name:"teams",summary:"Microsoft \
|
|
172
|
+
Teams\uFF08\u30C1\u30FC\u30E0\u30FB\u30C1\u30E3\u30CD\u30EB\u30FB\u30C1\u30E3\u30C3\u30C8\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u30FB\u30E1\u30F3\u30B7\u30E7\u30F3\u30FB\u304A\u6C17\u306B\u5165\u308A\uFF09",operations:[],subresources:[meResource,favoriteResource,teamResource,memberResource,channelResource,chatResource,messageResource,replyResource,reactionResource,mentionResource]};export{teamsDomain};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{placeholderTaskKey,stepToItem}from"./chunk-YAN3G35K.js";import{
|
|
3
|
+
import{placeholderTaskKey,stepToItem}from"./chunk-YAN3G35K.js";import{redactLoopOutput}from"./chunk-VEEZJNOB.js";import{localDate}from"./chunk-7QHDTO2Z.js";import{normalizeSkillName,skillOfItem}from"./chunk-ZFSWQQH3.js";import{DEFAULT_SKILL_PREFIX,SKILL_PREFIX_RE,setSkillPrefix,skillCommand,skillPrefix}from"./chunk-6CS5L24D.js";import{describeError,pick,pickString}from"./chunk-GYX2ZXQM.js";import{isTaskKey}from"./chunk-SBRTBKEZ.js";import{createHash,randomBytes}from"crypto";import fs from"fs";import path from"path";var INFLIGHT_STALE_HOURS=3;function staleFloorHours(aiTimeoutSec){return Math.ceil(aiTimeoutSec*2/3600)}function inflightStaleHours(aiTimeoutSec,baseHours=INFLIGHT_STALE_HOURS){const base=Number.isFinite(baseHours)&&baseHours>0?baseHours:INFLIGHT_STALE_HOURS;return Math.max(base,staleFloorHours(aiTimeoutSec))}function ageMinutesOf(item,now){for(const raw of[item.started_at,item.updated_at,item.dequeued_at,item.created_at]){if(!raw)continue;const ts=Date.parse(raw);if(Number.isNaN(ts))continue;return Math.
|
|
4
4
|
floor((now.getTime()-ts)/6e4)}return null}function inflightEntries(items,now=new Date,staleHours=INFLIGHT_STALE_HOURS){const staleMinutes=staleHours*60;const byKey=new Map;for(const item of items){const key=(item.task_key??"").trim();if(!key)continue;const ageMinutes=ageMinutesOf(item,now);if(ageMinutes!==null&&ageMinutes>staleMinutes)continue;const entry={key,runner:item.runner_id??"-",ageMinutes,label:(item.label??"").slice(0,60)};const prev=byKey.get(key);if(!prev||(entry.ageMinutes??-1)>(prev.
|
|
5
5
|
ageMinutes??-1))byKey.set(key,entry)}return[...byKey.values()].sort((a,b)=>a.key.localeCompare(b.key))}function formatInflightEntry(entry){const age=entry.ageMinutes===null?"\u4E0D\u660E":`${entry.ageMinutes}\u5206`;return`${entry.key} runner=${entry.runner} \u7D4C\u904E=${age}`}async function createItem(api,body){const res=await api.create(redactItemBody(body));if(isTriggerBlocked(res))return{itemId:null,detail:triggerBlockedDetail(res),blocked:true};if(!res.ok)return{itemId:null,detail:describeError(res)};for(const p of["item_id","id","item.item_id","item.id","data.item_id","data.id"]){const v=pickString(res.json,p);if(v)return{itemId:v,detail:""}}return{itemId:null,detail:`item_id \u3092\u8AAD\u3081\u307E\u305B\u3093: ${res.raw.slice(0,200)}`}}function isTriggerBlocked(res){
|
|
6
6
|
if(res.status!==409)return false;const json=res.json&&typeof res.json==="object"?res.json:{};const data=json["data"]&&typeof json["data"]==="object"?json["data"]:{};return[json["reason"],json["error"],data["reason"]].includes("loop_trigger_blocked")}function triggerBlockedDetail(res){const message=pickString(res.json,"error_description")||pickString(res.json,"message");const parts=[pickString(res.json,"block.task_key")&&pickString(res.json,"block.skill")?`${pickString(res.json,"block.task_key")}\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{loadDomain}from"./chunk-
|
|
3
|
+
import{loadDomain}from"./chunk-WDE24TCO.js";import{evaluateQuery}from"./chunk-F5QDUPQO.js";import{renderDocument,renderOutput}from"./chunk-P4QSPSOQ.js";import{JsonBodyWithView}from"./chunk-Q3B65OFC.js";import{NO_REDACT_NOTICE,withCommonFlags}from"./chunk-W4NLJ2YK.js";import{redactSecretValues,redactSecrets,withDebug}from"./chunk-BD7O73GK.js";import{parseOperationArgs}from"./chunk-VGT2EGH6.js";import{Resolver,requireDefaultProject}from"./chunk-QV4K6V2L.js";
|
|
4
4
|
import{ApiError,MultipartBody,TwpApiClient,appendQuery}from"./chunk-SH2YLLVL.js";import{ResolveError}from"./chunk-HVZUXLQ4.js";import{DEFAULT_MAX_ITEMS,DEFAULT_MAX_PAGES,nextPageNotes,positiveInteger,shellQuote}from"./chunk-MI6HVYR2.js";import{isRecord}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,EXIT_API_CLIENT,EXIT_API_SERVER,EXIT_AUTH,EXIT_FAILURE,EXIT_OK,EXIT_USAGE,EXIT_WAIT_TIMEOUT,NetworkError,UsageError,WaitTimeoutError}from"./chunk-VFPY2A23.js";
|
|
5
5
|
import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{AuthSession,NotLoggedInError,SessionExpiredError,loadCredentials}from"./chunk-XNLIEUAW.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{effectiveApiUrl,loadUserConfig,resolveConfiguredBacklogSpace,resolveConfiguredOutput,resolveProfile}from"./chunk-EDF4U5BT.js";import{HELP_TOKEN}from"./chunk-KD4YXQOZ.js";import{OUTPUT_FORMATS,resolveOutputFormat}from"./chunk-RKBUJKI5.js";import{stringWidth}from"./chunk-UREA4ZIG.js";
|
|
6
6
|
import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import fs from"fs";import path from"path";function alignedList(entries,indent=" "){const width=entries.reduce((max,[left])=>Math.max(max,stringWidth(left)),0);return entries.map(([left,right])=>`${indent}${left}${" ".repeat(Math.max(0,width-stringWidth(left)))} ${right}`).join("\n")}function subresourcesOf(resource){return resource.subresources??[]}function renderResourceHelp(resource,path2){const subresources=subresourcesOf(resource);const operationSection=resource.operations.length===0?"":`
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{buildDiffLines,diffStat}from"./chunk-VRBI2NPI.js";import{dateFlag}from"./chunk-EXT4AIDF.js";import{composeDocument,meetingContentToText,metaLine,noteContentToText,oneLine,textOutline,textSection,wikiContentToText}from"./chunk-62GRAKUD.js";import{boundedText}from"./chunk-JJSBBWJ5.js";import{charCount,readBody}from"./chunk-HEH3PUW2.js";import"./chunk-
|
|
4
|
-
import{
|
|
5
|
-
UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import path from"path";var WIKI_PATH="/api/v2/wiki";var WIKI_SUMMARY_FIELDS="summary";function withoutContent(page){const rest={...page};delete rest["content"];return rest}var NOTES_PATH="/api/v2/notes";var MEETINGS_PATH="/api/v2/meetings";var ROOT_PARENT="root";var WIKI_STATUSES=["draft","published"];var WIKI_CONTENT_FORMATS=["html","markdown"];var NOTE_STATUSES=["draft","published"];var NOTE_VISIBILITIES=["private","tenant","external","public"];var NOTE_SORTS=["manual","created_at","updated_at","view_count","comment\
|
|
3
|
+
import{buildDiffLines,diffStat}from"./chunk-VRBI2NPI.js";import{dateFlag}from"./chunk-EXT4AIDF.js";import{composeDocument,meetingContentToText,metaLine,noteContentToText,oneLine,textOutline,textSection,wikiContentToText}from"./chunk-62GRAKUD.js";import{boundedText}from"./chunk-JJSBBWJ5.js";import{charCount,readBody}from"./chunk-HEH3PUW2.js";import{repeatedValues}from"./chunk-VGT2EGH6.js";import{ApiError}from"./chunk-SH2YLLVL.js";import{ResolveError,isSafePathSegment}from"./chunk-HVZUXLQ4.js";
|
|
4
|
+
import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import path from"path";var WIKI_PATH="/api/v2/wiki";var WIKI_SUMMARY_FIELDS="summary";function withoutContent(page){const rest={...page};delete rest["content"];return rest}var NOTES_PATH="/api/v2/notes";var MEETINGS_PATH="/api/v2/meetings";var ROOT_PARENT="root";var WIKI_STATUSES=["draft","published"];var WIKI_CONTENT_FORMATS=["html","markdown"];var NOTE_STATUSES=["draft","published"];var NOTE_VISIBILITIES=["private","tenant","external","public"];var NOTE_SORTS=["manual","created_at","updated_at","view_count","comment\
|
|
6
5
|
_count","reaction_count"];var MEETING_STATUSES=["draft","published","archived"];var MEETING_TYPES=["regular","client","internal","retrospective","decision","one_on_one"];var MEETING_SORTS=["meeting_date","created_at","updated_at","title"];var SORT_ORDERS=["asc","desc"];var MEETING_TAGS_MAX=20;var MEETING_TAG_MAX_CHARS=50;var DATE_FLOOR="0000-01-01";var DATE_CEIL="9999-12-31";var WIKI_LIST_COLUMNS=["id","title","status","parent_page_id","updated_at","updated_by_name"];var WIKI_STALE_COLUMNS=["id",
|
|
7
6
|
"title","status","verified_at","knowledge_kind","evidence_task_keys","updated_at"];var WIKI_CHILD_COLUMNS=["id","title","status","child_count","updated_at","updated_by_name"];var WIKI_SEARCH_COLUMNS=["id","title","status","search_excerpt","updated_at","updated_by_name"];var WIKI_GET_COLUMNS=["id","title","status","content_format","parent_page_id","version","tags","verified_at","evidence_task_keys","knowledge_kind","updated_at","updated_by_name"];var NOTE_LIST_COLUMNS=["id","title","status","visi\
|
|
8
7
|
bility","created_by_name","updated_at","comment_count","reaction_count"];var NOTE_GET_COLUMNS=["id","title","status","visibility","content_type","category_name","tags","created_by_name","updated_at","view_count"];var MEETING_LIST_COLUMNS=["id","meeting_date","title","meeting_type","status","project_name","created_by_name"];var MEETING_GET_COLUMNS=["id","title","meeting_date","meeting_type","status","project_name","category_name","created_by_name","updated_at"];var TEXT_OUTPUT_HELP="--output text\
|
|
@@ -231,19 +230,28 @@ input,"twp wiki append","\u30DA\u30FC\u30B8","twp wiki list"),"POST","append",{}
|
|
|
231
230
|
WIKI_MOVE_USAGE)}if(parent===void 0&&sortOrder===void 0){throw new UsageError(`--parent \u304B --sort-order \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u6700\u4E0A\u4F4D\u3078\u79FB\u3059\u306A\u3089 --parent ${ROOT_PARENT}\uFF09`,WIKI_MOVE_USAGE)}return{method:"PUT",path:`${WIKI_PATH}/${encodeURIComponent(id)}/move`,body:{...parent!==void 0?{parent_page_id:parent}:{},...sortOrder!==void 0?{sort_order:sortOrder}:{}}}},summarize:body=>pick(pageFrom(body),WIKI_GET_COLUMNS),raw:pageFrom};
|
|
232
231
|
async function previewWikiDelete(input,ctx){const id=singleId(input,"twp wiki delete","\u30DA\u30FC\u30B8","twp wiki list");const page=pageFrom(await ctx.send({method:"GET",path:`${WIKI_PATH}/${encodeURIComponent(id)}`}));return{notes:[`\u524A\u9664\u3059\u308B\u30DA\u30FC\u30B8: ${String(page["title"]??"(\u4EF6\u540D\u306A\u3057)")}\uFF08\u7248 ${String(page["version"]??"?")}\u30FBID ${id}\uFF09`],warnings:[]}}var wikiDelete={name:"delete",summary:`${WIKI_LABEL}\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\uFF09`,
|
|
233
232
|
usage:"twp wiki delete <\u30DA\u30FC\u30B8ID> --yes",description:"\u9001\u308B\u524D\u306B\u30DA\u30FC\u30B8\u3092\u53D6\u5F97\u3057\u3001\u6D88\u3048\u308B\u30DA\u30FC\u30B8\u306E\u4EF6\u540D\u3092 stderr \u306B\u51FA\u3057\u307E\u3059\u3002\n\u30DA\u30FC\u30B8\u306B\u7D10\u3065\u304F\u30BF\u30B9\u30AF\u3068\u306E\u30EA\u30F3\u30AF\u3082\u524A\u9664\u3055\u308C\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u51E6\u7406\uFF09\u3002\u524A\u9664\u3067\u304D\u308B\u306E\u306F\u4F5C\u6210\u8005\u30FBwiki \u306E\u7BA1\u7406\u8005\u30FB\u7D44\u7E54\u306E\u7BA1\u7406\u8005\u3067\u3059\u3002",
|
|
234
|
-
destructive:true,flags:[],preview:previewWikiDelete,plan:input=>({method:"DELETE",path:`${WIKI_PATH}/${encodeURIComponent(singleId(input,"twp wiki delete","\u30DA\u30FC\u30B8","twp wiki list"))}`}),summarize:body=>acknowledgement(body,`${WIKI_LABEL}\u306E\u524A\u9664`),raw:body=>acknowledgement(body,`${WIKI_LABEL}\u306E\u524A\u9664`)};var NOTE_LABEL="\u30CE\u30FC\u30C8";var
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
destructive:true,flags:[],preview:previewWikiDelete,plan:input=>({method:"DELETE",path:`${WIKI_PATH}/${encodeURIComponent(singleId(input,"twp wiki delete","\u30DA\u30FC\u30B8","twp wiki list"))}`}),summarize:body=>acknowledgement(body,`${WIKI_LABEL}\u306E\u524A\u9664`),raw:body=>acknowledgement(body,`${WIKI_LABEL}\u306E\u524A\u9664`)};var NOTE_LABEL="\u30CE\u30FC\u30C8";var NOTE_LIST_BASE_PAGING=envelopePaging({label:`${NOTE_LABEL}\u4E00\u89A7`});function noteItemsKey(body){return isRecord(body)&&
|
|
234
|
+
Array.isArray(body["notes"])&&!Array.isArray(body["items"])?"notes":"items"}var notePaging={...NOTE_LIST_BASE_PAGING,items(body){return noteItemsKey(body)==="notes"?body["notes"]:NOTE_LIST_BASE_PAGING.items(body)},withItems(body,merged){const key=noteItemsKey(body);if(key==="items")return NOTE_LIST_BASE_PAGING.withItems(body,merged);return{...body,notes:[...merged]}}};var NOTE_SCOPE_EXCLUSIVE=["--mine","--favorite","--status","--visibility","--category","--sort"];function noteListScope(input){const subscribed=input.
|
|
235
|
+
flags.has("--subscribed");const isPublic=input.flags.has("--public");if(subscribed&&isPublic)throw new UsageError("--subscribed \u3068 --public \u306F\u4F75\u7528\u3067\u304D\u307E\u305B\u3093","\u3069\u3061\u3089\u304B\u4E00\u65B9\u306E\u4E00\u89A7\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");if(!subscribed&&input.flags.has("--tenant")){throw new UsageError("--tenant \u306F --subscribed \u3068\u4E00\u7DD2\u306B\u3060\u3051\u6307\u5B9A\u3067\u304D\u307E\u3059","\u8CFC\u8AAD\u5148\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\u30921\u30C6\u30CA\u30F3\u30C8\
|
|
236
|
+
\u306B\u7D5E\u308B\u6307\u5B9A\u3067\u3059\u3002")}const scope=subscribed?"subscribed":isPublic?"public":"tenant";if(scope!=="tenant"){const clash=NOTE_SCOPE_EXCLUSIVE.filter(flag=>input.flags.has(flag));if(clash.length>0){throw new UsageError(`--${scope} \u3068 ${clash.join(" / ")} \u306F\u4F75\u7528\u3067\u304D\u307E\u305B\u3093`,`--${scope} \u306E\u4E00\u89A7\u3067\u7D5E\u308A\u8FBC\u3081\u308B\u306E\u306F --tag / --keyword${scope==="subscribed"?" / --tenant":""} \u3060\u3051\u3067\u3059\uFF08\u30B5\u30FC\u30D0\u304C\u4ED6\u306E\u6761\u4EF6\u3092\u53D7\u3051\u307E\u305B\u3093\uFF09\u3002`)}}
|
|
237
|
+
return scope}function noteListQuery(input){const scope=noteListScope(input);const common={tag:nonEmpty(input.flags,"--tag"),keyword:nonEmpty(input.flags,"--keyword"),limit:pageLimit(input),cursor:nonEmpty(input.flags,"--cursor")};if(scope==="public")return common;if(scope==="subscribed")return{...common,tenant_id:noteRefFlag(input,"--tenant","\u30C6\u30CA\u30F3\u30C8")};return{...common,status:oneOf(input,"--status",NOTE_STATUSES),visibility:oneOf(input,"--visibility",NOTE_VISIBILITIES),category_id:noteRefFlag(
|
|
238
|
+
input,"--category","\u30AB\u30C6\u30B4\u30EA"),sort_by:oneOf(input,"--sort",NOTE_SORTS),mine:input.flags.has("--mine")?"true":void 0,is_favorited:input.flags.has("--favorite")?"true":void 0}}function noteRefFlag(input,flag,label){const raw=nonEmpty(input.flags,flag);if(raw===void 0)return void 0;const value=raw.trim();if(!isSafePathSegment(value))throw new UsageError(`${flag} \u306B${label}\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${raw}`,`${flag} help`);return value}
|
|
239
|
+
function noteListPath(input){const scope=noteListScope(input);return scope==="tenant"?NOTES_PATH:`${NOTES_PATH}/${scope}`}var noteList={name:"list",summary:`${NOTE_LABEL}\u3092\u4E00\u89A7\u3059\u308B\uFF08--mine \u3067\u81EA\u5206\u306E\u3082\u306E\u30FB--subscribed \u3067\u8CFC\u8AAD\u5148\u30FB--public \u3067\u516C\u958B\u30CE\u30FC\u30C8\uFF09`,usage:"twp note list [--mine] [--favorite] [--status <draft|published>] [--visibility <\u516C\u958B\u7BC4\u56F2>] [--category <\u30AB\u30C6\u30B4\u30EAID>] [--tag <\u30BF\u30B0>] [--keyword <\u8A9E>] [--s\
|
|
240
|
+
ort <\u4E26\u3073\u9806>] [--all] [--limit <\u4EF6\u6570>]\n twp note list --subscribed [--tenant <\u30C6\u30CA\u30F3\u30C8ID>] [--tag <\u30BF\u30B0>] [--keyword <\u8A9E>] [--all]\n twp note list --public [--tag <\u30BF\u30B0>] [--keyword <\u8A9E>] [--all]",description:`\u4ED6\u4EBA\u306E\u4E0B\u66F8\u304D\u30FB\u975E\u516C\u958B\u306E\u30CE\u30FC\u30C8\u306F\u51FA\u307E\u305B\u3093\uFF08\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u3092\u9664\u304F\u3002\u30B5\u30FC\u30D0\u306E\u5224\u5B9A\uFF09\u3002\u533F\u540D\u306E\u30CE\u30FC\u30C8\u306F\u4F5C\u6210\u8005\u304C\u4F0F\u305B\u3089\u308C\u307E\u3059\u3002
|
|
237
241
|
--visibility \u306F ${NOTE_VISIBILITIES.join(" / ")}\u3001--sort \u306F ${NOTE_SORTS.join(" / ")} \u3067\u3059\uFF08\u6253\u3061\u9593\u9055\u3044\u306F\u9001\u308B\u524D\u306B\u6B62\u3081\u307E\u3059\uFF09\u3002
|
|
242
|
+
--category \u306F\u30AB\u30C6\u30B4\u30EA\u306E ID \u3067\u3059\uFF08twp note category list \u306E id \u5217\uFF09\u3002
|
|
243
|
+
--subscribed \u306F\u8CFC\u8AAD\u3057\u3066\u3044\u308B\u4ED6\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\uFF08twp note subscription list \u306E\u8CFC\u8AAD\u5148\uFF09\u3001--public \u306F\u516C\u958B\u7BC4\u56F2 public \u306E\u30CE\u30FC\u30C8\u3092\u4E00\u89A7\u3057\u307E\u3059\u3002
|
|
244
|
+
\u3053\u306E2\u3064\u306F\u5225\u306E\u4E00\u89A7\u306A\u306E\u3067\u3001--tag / --keyword\uFF08--subscribed \u306F --tenant \u3082\uFF09\u4EE5\u5916\u306E\u7D5E\u308A\u8FBC\u307F\u3068\u306F\u4F75\u7528\u3067\u304D\u307E\u305B\u3093\u3002
|
|
238
245
|
|
|
239
246
|
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08\u672C\u6587 content \u3092\u542B\u3080\uFF09\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
240
247
|
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${NOTE_LIST_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002\u672C\u6587\u306F twp note get \u3067\u8AAD\u3081\u307E\u3059\u3002
|
|
241
248
|
|
|
242
249
|
`+LIST_PAGING_HELP,flags:[...LIST_FLAGS,{name:"--mine",summary:"\u81EA\u5206\u304C\u4F5C\u6210\u3057\u305F\u30CE\u30FC\u30C8\u3060\u3051\uFF08\u81EA\u5206\u306E\u4E0B\u66F8\u304D\u30FB\u975E\u516C\u958B\u3092\u542B\u3080\uFF09",takesValue:false},{name:"--favorite",summary:"\u304A\u6C17\u306B\u5165\u308A\u306B\u767B\u9332\u3057\u305F\u30CE\u30FC\u30C8\u3060\u3051",takesValue:false},{name:"--status",summary:`\u72B6\u614B\u3067\u7D5E\u308A\u8FBC\u3080\uFF08${NOTE_STATUSES.join(" / ")}\uFF09`,takesValue:true,
|
|
243
|
-
placeholder:"<\u72B6\u614B>"},{name:"--visibility",summary:`\u516C\u958B\u7BC4\u56F2\u3067\u7D5E\u308A\u8FBC\u3080\uFF08${NOTE_VISIBILITIES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u516C\u958B\u7BC4\u56F2>"},{name:"--
|
|
244
|
-
join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u4E26\u3073\u9806>"}
|
|
245
|
-
|
|
246
|
-
\
|
|
250
|
+
placeholder:"<\u72B6\u614B>"},{name:"--visibility",summary:`\u516C\u958B\u7BC4\u56F2\u3067\u7D5E\u308A\u8FBC\u3080\uFF08${NOTE_VISIBILITIES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u516C\u958B\u7BC4\u56F2>"},{name:"--category",summary:"\u30AB\u30C6\u30B4\u30EA\u306E ID \u3067\u7D5E\u308A\u8FBC\u3080\uFF08twp note category list\uFF09",takesValue:true,placeholder:"<\u30AB\u30C6\u30B4\u30EAID>"},{name:"--tag",summary:"\u30BF\u30B0\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"\
|
|
251
|
+
<\u30BF\u30B0>"},{name:"--keyword",summary:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u8A9E>"},{name:"--sort",summary:`\u4E26\u3073\u9806\uFF08${NOTE_SORTS.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u4E26\u3073\u9806>"},{name:"--subscribed",summary:"\u8CFC\u8AAD\u3057\u3066\u3044\u308B\u4ED6\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\u3092\u4E00\u89A7\u3059\u308B",takesValue:false},{name:"--tenant",summary:"--subscribed \u306E\u4E00\u89A7\u3092\u8CFC\u8AAD\u5148\u30C6\u30CA\u30F3\u30C81\
|
|
252
|
+
\u3064\u306B\u7D5E\u308B\uFF08\u30C6\u30CA\u30F3\u30C8ID\uFF09",takesValue:true,placeholder:"<\u30C6\u30CA\u30F3\u30C8ID>"},{name:"--public",summary:"\u516C\u958B\u7BC4\u56F2 public \u306E\u30CE\u30FC\u30C8\u3092\u4E00\u89A7\u3059\u308B",takesValue:false}],paging:notePaging,plan(input){noArgs(input,"twp note list");return{method:"GET",path:noteListPath(input),query:noteListQuery(input)}},summarize:body=>envelopeRows(body,notePaging,`${NOTE_LABEL}\u4E00\u89A7`).map(row=>pick(row,NOTE_LIST_COLUMNS)),
|
|
253
|
+
raw:body=>envelopeRows(body,notePaging,`${NOTE_LABEL}\u4E00\u89A7`),notes:scanTruncatedNote(`${NOTE_LABEL}\u4E00\u89A7`)};function noteDocument(body){const note=record(body,"note",NOTE_LABEL);return composeDocument(note["title"],[...metaLine("\u72B6\u614B",note["status"]),...metaLine("\u516C\u958B\u7BC4\u56F2",note["visibility"]),...metaLine("\u30AB\u30C6\u30B4\u30EA",note["category_name"]),...metaLine("\u30BF\u30B0",note["tags"]),...metaLine("\u4F5C\u6210\u8005",note["created_by_name"]),...metaLine(
|
|
254
|
+
"\u66F4\u65B0",note["updated_at"]),...metaLine("ID",note["id"])],[{body:noteContentToText(note["content"],note["content_type"])}])}var noteGet={name:"get",summary:`${NOTE_LABEL}1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08--output text \u3067\u672C\u6587\u3092\u8AAD\u3080\uFF09`,usage:"twp note get <\u30CE\u30FC\u30C8ID>",description:`${TEXT_OUTPUT_HELP}
|
|
247
255
|
|
|
248
256
|
--output table / tsv \u306F\u8981\u7D04\u5217\uFF08${NOTE_GET_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002
|
|
249
257
|
\u958B\u304F\u3068\u30CE\u30FC\u30C8\u306E\u95B2\u89A7\u6570\u304C1\u5897\u3048\u307E\u3059\uFF08\u753B\u9762\u3067\u958B\u304F\u306E\u3068\u540C\u3058\u304F\u30B5\u30FC\u30D0\u304C\u6570\u3048\u307E\u3059\uFF09\u3002`,flags:[],plan:input=>({method:"GET",path:`${NOTES_PATH}/${encodeURIComponent(singleId(input,"twp note get","\u30CE\u30FC\u30C8","twp note list"))}`}),summarize:body=>pick(record(body,"note",NOTE_LABEL),NOTE_GET_COLUMNS),raw:body=>record(body,"note",NOTE_LABEL),document:noteDocument};
|
|
@@ -278,4 +286,4 @@ ine"]],["\u72B6\u614B",status]])}`]}).join("\n")}function attendeeNames(value,ke
|
|
|
278
286
|
--output table / tsv \u306F\u8981\u7D04\u5217\uFF08${MEETING_GET_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002
|
|
279
287
|
\u95B2\u89A7\u3067\u304D\u306A\u3044\u8B70\u4E8B\u9332\u306F\u300C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u300D\u306B\u306A\u308A\u307E\u3059\uFF08\u516C\u958B\u7BC4\u56F2\u306E\u5224\u5B9A\u306F\u30B5\u30FC\u30D0\uFF09\u3002`,flags:[],plan:input=>({method:"GET",path:`${MEETINGS_PATH}/${encodeURIComponent(singleId(input,"twp meeting get","\u8B70\u4E8B\u9332","twp meeting list"))}`}),summarize:body=>pick(record(body,"meeting",MEETING_LABEL),MEETING_GET_COLUMNS),raw:body=>record(body,"meeting",
|
|
280
288
|
MEETING_LABEL),document:meetingDocument};var wikiDomain={name:"wiki",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E wiki\uFF08\u4E00\u89A7\u30FB\u672C\u6587\u30FB\u69CB\u9020\u30FB\u30BF\u30B0\u30FB\u7248\u306E\u5C65\u6B74\u3068\u5DEE\u5206\u30FB\u88AB\u30EA\u30F3\u30AF\u30FB\u95A2\u9023\u30BF\u30B9\u30AF\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u8FFD\u8A18\u30FB\u79FB\u52D5\u30FB\u524A\u9664\uFF09",operations:[wikiList,wikiGet,wikiTree,wikiTagList,wikiDigest,wikiVersions,wikiVersion,wikiDiff,
|
|
281
|
-
wikiBacklinks,wikiLinkedTasks,wikiCreate,wikiUpdate,wikiAppend,wikiMove,wikiDelete]};var
|
|
289
|
+
wikiBacklinks,wikiLinkedTasks,wikiCreate,wikiUpdate,wikiAppend,wikiMove,wikiDelete]};var meetingDomain={name:"meeting",summary:"\u8B70\u4E8B\u9332\uFF08\u671F\u9593\u3067\u306E\u4E00\u89A7\u30FB\u672C\u6587\u3092\u8AAD\u3080\uFF09",operations:[meetingList,meetingGet]};export{NOTES_PATH,WIKI_CONTENT_FORMATS,NOTE_STATUSES,NOTE_VISIBILITIES,NOTE_GET_COLUMNS,TEXT_OUTPUT_HELP,noArgs,singleId,oneOf,pageLimit,record,envelopeRows,scanTruncatedNote,resolveWikiPath,digestSummary,fitDigest,CONTENT_FILE_FLAG,WIKI_FORMAT_BY_EXTENSION,NOTE_LABEL,noteList,noteGet,wikiDomain,meetingDomain};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
var LOADERS={agent:async()=>(await import("./agent-KR74GXNL.js")).agentDomain,"agent-loop":async()=>(await import("./agent-loop-
|
|
4
|
-
attendanceDomainWithRecords,"audit-log":async()=>(await import("./audit-log-ZGK7IVLD.js")).auditLogDomain,backlog:async()=>(await import("./backlog-SXIC4PHA.js")).backlogDomain,brief:async()=>(await import("./brief-
|
|
3
|
+
var LOADERS={agent:async()=>(await import("./agent-KR74GXNL.js")).agentDomain,"agent-loop":async()=>(await import("./agent-loop-DDEL6F4B.js")).agentLoopDomain,"ai-review-reason":async()=>(await import("./sales-ai-review-W2V5IIQ7.js")).aiReviewReasonDomain,analysis:async()=>(await import("./analysis-IHPEFRMJ.js")).analysisDomain,announcement:async()=>(await import("./announcement-77BM6C2F.js")).announcementDomain,"api-key":async()=>(await import("./api-key-TH4FGLMP.js")).apiKeyDomain,attendance:async()=>(await import("./attendance-correct-BIOLK5US.js")).
|
|
4
|
+
attendanceDomainWithRecords,"audit-log":async()=>(await import("./audit-log-ZGK7IVLD.js")).auditLogDomain,backlog:async()=>(await import("./backlog-SXIC4PHA.js")).backlogDomain,brief:async()=>(await import("./brief-2JDLQOYS.js")).briefDomain,budget:async()=>(await import("./budget-NBOOIARX.js")).budgetDomain,"business-hours":async()=>(await import("./business-hours-37MRL53C.js")).businessHoursDomain,"business-place":async()=>(await import("./sales-master-D3NPW3KR.js")).businessPlaceDomain,
|
|
5
5
|
company:async()=>(await import("./company-F3H523MI.js")).companyDomain,content:async()=>(await import("./content-MLJ6MLWA.js")).contentDomain,contract:async()=>(await import("./contract-23A4EYDW.js")).contractDomain,corporate:async()=>(await import("./corporate-VYVFVJBA.js")).corporateDomain,customer:async()=>(await import("./company-F3H523MI.js")).customerDomain,department:async()=>(await import("./department-S3DWJHGT.js")).departmentDomain,deposit:async()=>(await import("./deposit-NLX7OAMP.js")).
|
|
6
6
|
depositDomain,estimate:async()=>(await import("./estimate-K6VP4CN6.js")).estimateDomain,evaluation:async()=>(await import("./evaluation-M7CWWFYU.js")).evaluationDomain,expense:async()=>(await import("./expense-SIL6XPVV.js")).expenseDomain,faq:async()=>(await import("./faq-KXKVX2GT.js")).faqDomain,"fiscal-year":async()=>(await import("./fiscal-year-XO657XXK.js")).fiscalYearDomain,github:async()=>(await import("./github-LWRGYHUT.js")).githubDomain,holiday:async()=>(await import("./holiday-D7IDQD7O.js")).
|
|
7
7
|
holidayDomain,"goal-sheet":async()=>(await import("./evaluation-M7CWWFYU.js")).goalSheetDomain,inquiry:async()=>(await import("./inquiry-7PVPTY6L.js")).inquiryDomain,invoice:async()=>(await import("./invoice-HGZAW3CS.js")).invoiceDomain,"job-title":async()=>(await import("./job-title-RON7XPAX.js")).jobTitleDomain,knowledge:async()=>(await import("./domain-knowledge-TGJ4AFPJ.js")).knowledgeDomain,leave:async()=>(await import("./leave-J7PCTD7B.js")).leaveDomain,license:async()=>(await import("./license-G32TELK2.js")).
|
|
8
|
-
licenseDomain,"login-history":async()=>(await import("./login-history-UFYI3EXG.js")).loginHistoryDomain,media:async()=>(await import("./media-
|
|
8
|
+
licenseDomain,"login-history":async()=>(await import("./login-history-UFYI3EXG.js")).loginHistoryDomain,media:async()=>(await import("./media-FEZK3NAX.js")).mediaDomain,meeting:async()=>(await import("./knowledge-WVHKCKC4.js")).meetingDomain,note:async()=>(await import("./note-2RJWN5TQ.js")).noteDomain,notification:async()=>(await import("./notification-WRJWXTVV.js")).notificationDomain,ojt:async()=>(await import("./ojt-CA57LGQV.js")).ojtDomain,onedrive:async()=>(await import("./onedrive-Z43D26SJ.js")).
|
|
9
9
|
onedriveDomain,outlook:async()=>(await import("./outlook-LU42AHOQ.js")).outlookDomain,payee:async()=>(await import("./sales-master-D3NPW3KR.js")).payeeDomain,position:async()=>(await import("./position-IQ57YOK6.js")).positionDomain,project:async()=>(await import("./project-4J7UVMDK.js")).projectDomain,prospect:async()=>(await import("./prospect-QFT3AHLN.js")).prospectDomain,purchase:async()=>(await import("./purchase-XFRGUNL3.js")).purchaseDomain,qualification:async()=>(await import("./skill-EAJMCUNG.js")).
|
|
10
10
|
qualificationDomain,receivable:async()=>(await import("./receivable-NJG4BGDR.js")).receivableDomain,redmine:async()=>(await import("./redmine-PKQ3U6WD.js")).redmineDomain,report:async()=>(await import("./report-CPUCZWJI.js")).reportDomain,"role-template":async()=>(await import("./evaluation-M7CWWFYU.js")).roleTemplateDomain,"rounding-setting":async()=>(await import("./sales-numbering-7C5V5R5P.js")).roundingSettingDomain,"seal-impression":async()=>(await import("./sales-master-D3NPW3KR.js")).
|
|
11
|
-
sealImpressionDomain,search:async()=>(await import("./search-BLABJVLN.js")).searchDomain,secret:async()=>(await import("./secret-P42JCOI4.js")).secretDomain,segment:async()=>(await import("./segment-ABWMWTDO.js")).segmentDomain,shift:async()=>(await import("./attendance-lists-O6GVIJQA.js")).shiftDomain,skill:async()=>(await import("./skill-EAJMCUNG.js")).skillDomain,slack:async()=>(await import("./slack-WP7I3XST.js")).slackDomain,sns:async()=>(await import("./sns-
|
|
12
|
-
snsDomain,"staffing-board":async()=>(await import("./staffing-board-NK5OZS33.js")).staffingBoardDomain,storage:async()=>(await import("./storage-AQDCEBDJ.js")).storageDomain,"supplier-payment":async()=>(await import("./supplier-payment-GFNM3V5U.js")).supplierPaymentDomain,support:async()=>(await import("./support-STDLB7EO.js")).supportDomain,task:async()=>(await import("./task-WXOWJ5VV.js")).taskDomain,teams:async()=>(await import("./teams-
|
|
13
|
-
userDomain,"user-contract-type":async()=>(await import("./user-contract-type-NCO5QWQD.js")).userContractTypeDomain,"user-group":async()=>(await import("./user-group-AAY546AB.js")).userGroupDomain,wiki:async()=>(await import("./knowledge-
|
|
11
|
+
sealImpressionDomain,search:async()=>(await import("./search-BLABJVLN.js")).searchDomain,secret:async()=>(await import("./secret-P42JCOI4.js")).secretDomain,segment:async()=>(await import("./segment-ABWMWTDO.js")).segmentDomain,shift:async()=>(await import("./attendance-lists-O6GVIJQA.js")).shiftDomain,skill:async()=>(await import("./skill-EAJMCUNG.js")).skillDomain,slack:async()=>(await import("./slack-WP7I3XST.js")).slackDomain,sns:async()=>(await import("./sns-BINSUYD4.js")).
|
|
12
|
+
snsDomain,"staffing-board":async()=>(await import("./staffing-board-NK5OZS33.js")).staffingBoardDomain,storage:async()=>(await import("./storage-AQDCEBDJ.js")).storageDomain,"supplier-payment":async()=>(await import("./supplier-payment-GFNM3V5U.js")).supplierPaymentDomain,support:async()=>(await import("./support-STDLB7EO.js")).supportDomain,task:async()=>(await import("./task-WXOWJ5VV.js")).taskDomain,teams:async()=>(await import("./teams-NQFFNTBK.js")).teamsDomain,user:async()=>(await import("./user-TVWMXKQT.js")).
|
|
13
|
+
userDomain,"user-contract-type":async()=>(await import("./user-contract-type-NCO5QWQD.js")).userContractTypeDomain,"user-group":async()=>(await import("./user-group-AAY546AB.js")).userGroupDomain,wiki:async()=>(await import("./knowledge-WVHKCKC4.js")).wikiDomain,workchange:async()=>(await import("./attendance-lists-O6GVIJQA.js")).workchangeDomain,"worker-agent":async()=>(await import("./worker-agent-YQL7CWG4.js")).workerAgentDomain,workflow:async()=>(await import("./workflow-FRNUNSDR.js")).workflowDomain};
|
|
14
14
|
async function loadDomain(name){return LOADERS[name]()}export{loadDomain};
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
3
3
|
const require = __twpCreateRequire(import.meta.url);
|
|
4
|
-
import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromEnv}from"./chunk-42WDHGWC.js";import"./chunk-2LOT54OO.js";import"./chunk-NJL3H2BB.js";import"./chunk-KD4YXQOZ.js";import"./chunk-AH4KHEAC.js";import{formatUnknownArgs}from"./chunk-OKATZ4SN.js";import"./chunk-VSJBJXZO.js";var VERSION=true?"0.
|
|
4
|
+
import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromEnv}from"./chunk-42WDHGWC.js";import"./chunk-2LOT54OO.js";import"./chunk-NJL3H2BB.js";import"./chunk-KD4YXQOZ.js";import"./chunk-AH4KHEAC.js";import{formatUnknownArgs}from"./chunk-OKATZ4SN.js";import"./chunk-VSJBJXZO.js";var VERSION=true?"0.125.0":"0.0.0-dev";var HELP=`twp ${VERSION} \u2014 TWP CLI
|
|
5
5
|
|
|
6
6
|
\u4F7F\u3044\u65B9:
|
|
7
7
|
twp \u5BFE\u8A71 TUI \u3092\u8D77\u52D5
|
|
@@ -829,6 +829,8 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromE
|
|
|
829
829
|
X \u4E0A\u306E\u81EA\u5206\u306E\u6295\u7A3F\uFF08\u6307\u6A19\u3064\u304D\uFF09\u304B\u3001TWP \u306E\u4E0B\u66F8\u304D\u30FB\u4E88\u7D04\uFF08--status\uFF09\u3092\u4E00\u89A7\u3059\u308B
|
|
830
830
|
twp sns post --channel x --text-file <\u30D1\u30B9> [--thread-file <\u30D1\u30B9> \u2026] [--media <\u753B\u50CF>] [--at <\u65E5\u6642>] --yes
|
|
831
831
|
X \u3078\u6295\u7A3F\u3059\u308B\u30FB\u4E88\u7D04\u3059\u308B\uFF08\u8CBB\u7528\u3092\u8868\u793A\u3057\u3066\u304B\u3089\u9001\u308B\u30FB--yes \u304C\u5FC5\u8981\uFF09
|
|
832
|
+
twp sns edit --channel x <UUID> [--text-file <\u30D1\u30B9>] [--media <\u753B\u50CF> | --clear-media] --yes
|
|
833
|
+
TWP \u306E\u4E0B\u66F8\u304D\u30FB\u4E88\u7D04\u4E2D\u306E\u6295\u7A3F\u306E\u672C\u6587\u30FB\u753B\u50CF\u3092\u7DE8\u96C6\u3059\u308B\uFF08\u5909\u66F4\u524D\u5F8C\u3092\u8868\u793A\u3057\u3066\u304B\u3089\u9001\u308B\uFF09
|
|
832
834
|
twp sns delete --channel x <ID> --yes
|
|
833
835
|
X \u306E\u6295\u7A3F\uFF08\u6570\u5B57\u306E ID\uFF09\u304B\u3001TWP \u306E\u4E0B\u66F8\u304D\u30FB\u4E88\u7D04\uFF08UUID\uFF09\u3092\u524A\u9664\u3059\u308B
|
|
834
836
|
twp sns draft --channel <\u30C1\u30E3\u30CD\u30EB> (--from content:<ID> | --from post:<ID> | --text-file <\u30D1\u30B9>) --yes
|
|
@@ -1295,8 +1297,41 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromE
|
|
|
1295
1297
|
wiki \u30DA\u30FC\u30B8\u306E\u89AA\u30DA\u30FC\u30B8\u3092\u4ED8\u3051\u66FF\u3048\u308B\uFF08root \u3067\u6700\u4E0A\u4F4D\u3078\uFF09
|
|
1296
1298
|
twp wiki delete <\u30DA\u30FC\u30B8ID>
|
|
1297
1299
|
wiki \u30DA\u30FC\u30B8\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\uFF09
|
|
1298
|
-
twp note list \
|
|
1300
|
+
twp note list \u30CE\u30FC\u30C8\u3092\u4E00\u89A7\u3059\u308B\uFF08--mine \u3067\u81EA\u5206\u306E\u3082\u306E\u30FB--subscribed \u3067\u8CFC\u8AAD\u5148\u30FB--public \u3067\u516C\u958B\u30CE\u30FC\u30C8\uFF09
|
|
1299
1301
|
twp note get <\u30CE\u30FC\u30C8ID> \u30CE\u30FC\u30C81\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08--output text \u3067\u672C\u6587\u3092\u8AAD\u3080\uFF09
|
|
1302
|
+
twp note create \u30CE\u30FC\u30C8\u3092\u4F5C\u6210\u3059\u308B\uFF08\u672C\u6587\u306F --content-file \u306E\u30D5\u30A1\u30A4\u30EB\u304B\u3089\uFF09
|
|
1303
|
+
twp note update <\u30CE\u30FC\u30C8ID>
|
|
1304
|
+
\u30CE\u30FC\u30C8\u3092\u66F4\u65B0\u3059\u308B\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\uFF09
|
|
1305
|
+
twp note delete <\u30CE\u30FC\u30C8ID>
|
|
1306
|
+
\u30CE\u30FC\u30C8\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\uFF09
|
|
1307
|
+
twp note comment list <\u30CE\u30FC\u30C8ID>
|
|
1308
|
+
\u30CE\u30FC\u30C8\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u4E00\u89A7\u3059\u308B
|
|
1309
|
+
twp note comment create <\u30CE\u30FC\u30C8ID>
|
|
1310
|
+
\u30CE\u30FC\u30C8\u306B\u30B3\u30E1\u30F3\u30C8\u3059\u308B\uFF08--body \u304B --body-file\uFF09
|
|
1311
|
+
twp note comment update <\u30CE\u30FC\u30C8ID> <\u30B3\u30E1\u30F3\u30C8ID>
|
|
1312
|
+
\u30CE\u30FC\u30C8\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u66F8\u304D\u63DB\u3048\u308B
|
|
1313
|
+
twp note comment delete <\u30CE\u30FC\u30C8ID> <\u30B3\u30E1\u30F3\u30C8ID>
|
|
1314
|
+
\u30CE\u30FC\u30C8\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\uFF09
|
|
1315
|
+
twp note favorite add <\u30CE\u30FC\u30C8ID>
|
|
1316
|
+
\u30CE\u30FC\u30C8\u3092\u304A\u6C17\u306B\u5165\u308A\u306B\u767B\u9332\u3059\u308B
|
|
1317
|
+
twp note favorite remove <\u30CE\u30FC\u30C8ID>
|
|
1318
|
+
\u30CE\u30FC\u30C8\u3092\u304A\u6C17\u306B\u5165\u308A\u304B\u3089\u5916\u3059
|
|
1319
|
+
twp note reaction list <\u30CE\u30FC\u30C8ID>
|
|
1320
|
+
\u30CE\u30FC\u30C8\u306E\u3044\u3044\u306D\u306E\u6570\u3068\u3001\u3044\u3044\u306D\u3057\u305F\u4EBA\u3092\u8868\u793A\u3059\u308B
|
|
1321
|
+
twp note reaction toggle <\u30CE\u30FC\u30C8ID>
|
|
1322
|
+
\u30CE\u30FC\u30C8\u306E\u3044\u3044\u306D\u3092\u4ED8\u3051\u308B\uFF0F\u5916\u3059\uFF08\u62BC\u3059\u305F\u3073\u306B\u53CD\u8EE2\uFF09
|
|
1323
|
+
twp note tag list \u30CE\u30FC\u30C8\u3067\u4F7F\u308F\u308C\u3066\u3044\u308B\u30BF\u30B0\u3092\u4E00\u89A7\u3059\u308B
|
|
1324
|
+
twp note category list \u30CE\u30FC\u30C8\u306E\u30AB\u30C6\u30B4\u30EA\u3092\u4E00\u89A7\u3059\u308B
|
|
1325
|
+
twp note subscription list
|
|
1326
|
+
\u8CFC\u8AAD\u3057\u3066\u3044\u308B\u4ED6\u30C6\u30CA\u30F3\u30C8\u3092\u4E00\u89A7\u3059\u308B
|
|
1327
|
+
twp note subscription available
|
|
1328
|
+
\u8CFC\u8AAD\u3067\u304D\u308B\u4ED6\u30C6\u30CA\u30F3\u30C8\u3092\u4E00\u89A7\u3059\u308B\uFF08\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u306E\u307F\uFF09
|
|
1329
|
+
twp note subscription add <\u30C6\u30CA\u30F3\u30C8ID>
|
|
1330
|
+
\u4ED6\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\u3092\u8CFC\u8AAD\u3059\u308B\uFF08\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u306E\u307F\uFF09
|
|
1331
|
+
twp note subscription remove <\u30C6\u30CA\u30F3\u30C8ID>
|
|
1332
|
+
\u8CFC\u8AAD\u3092\u3084\u3081\u308B\uFF08\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u306E\u307F\u30FB--yes \u304C\u8981\u308B\uFF09
|
|
1333
|
+
twp note thumbnail regenerate <\u30CE\u30FC\u30C8ID>
|
|
1334
|
+
\u30CE\u30FC\u30C8\u306E\u30B5\u30E0\u30CD\u30A4\u30EB\uFF08AI \u753B\u50CF\uFF09\u3092\u4F5C\u308A\u76F4\u3059
|
|
1300
1335
|
twp meeting list \u8B70\u4E8B\u9332\u3092\u4E00\u89A7\u3059\u308B\uFF08--from/--to \u3067\u958B\u50AC\u65E5\u306E\u671F\u9593\uFF09
|
|
1301
1336
|
twp meeting get <\u8B70\u4E8B\u9332ID>
|
|
1302
1337
|
\u8B70\u4E8B\u93321\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08--output text \u3067\u672C\u6587\u3092\u8AAD\u3080\uFF09
|
|
@@ -1787,16 +1822,16 @@ TUI \u5185:
|
|
|
1787
1822
|
\u4F1A\u8A71\u30FB\u30ED\u30FC\u30AB\u30EB\u30C4\u30FC\u30EB\uFF08\u30D5\u30A1\u30A4\u30EB\u30FB\u30B3\u30DE\u30F3\u30C9\u30FBgit\uFF09\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u30AF\u30EC\u30B8\u30C3\u30C8\u3067\u5B9F\u969B\u306B\u52D5\u304D\u307E\u3059\u3002
|
|
1788
1823
|
`;function ignoreEpipe(stream){stream.on("error",err=>{if(err.code==="EPIPE")process.exit(0);throw err})}async function main(){const nodeMajor=Number(process.versions.node.split(".")[0]);if(nodeMajor<22){process.stderr.write(`twp-cli \u306B\u306F Node.js 22 \u4EE5\u4E0A\u304C\u5FC5\u8981\u3067\u3059\uFF08\u73FE\u5728: ${process.versions.node}\uFF09
|
|
1789
1824
|
`);process.exit(1)}ignoreEpipe(process.stdout);ignoreEpipe(process.stderr);if(process.env["TWP_AUTO_UPDATE_WORKER"]==="1"){const{runAutoUpdateWorker}=await import("./auto-update-worker-26OZDLQ7.js");await runAutoUpdateWorker().catch(()=>void 0);return}const[first,...rest]=process.argv.slice(2);if(first==="__complete"||first==="completion"){const completion=await import("./completion-CHN73KVQ.js");if(first==="completion"){process.exitCode=completion.runCompletion(rest,process.stdout,process.stderr);return}
|
|
1790
|
-
const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-
|
|
1825
|
+
const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-NC3KLYHI.js"),import("./config-XYWRBIC6.js")]);process.exitCode=await completion.runComplete(rest,process.stdout,{loadDomain,profileNames:()=>Object.keys(loadUserConfig().profiles??{})});return}if(first==="configure"){const autoUpdate2=await import("./auto-update-FXXQHBV5.js");autoUpdate2.registerRunning();autoUpdate2.onStartup(VERSION);const{runConfigure}=await import("./configure-BJGPASNG.js");process.exitCode=
|
|
1791
1826
|
await runConfigure(rest);return}const args=parseArgv(process.argv.slice(2));if(args.command==="version"){process.stdout.write(`${VERSION}
|
|
1792
1827
|
`);return}if(args.command==="help"){process.stdout.write(HELP);return}if(args.movedCommand!==void 0){const{MOVED_QUEUE_COMMAND_MESSAGE}=await import("./dispatch-ZWCEVLKZ.js");process.stderr.write(MOVED_QUEUE_COMMAND_MESSAGE);process.exitCode=2;return}if(args.unknown.length>0){process.stderr.write(`\u4E0D\u660E\u306A\u5F15\u6570: ${formatUnknownArgs(args.unknown)}
|
|
1793
1828
|
|
|
1794
|
-
${HELP}`);process.exitCode=2;return}const autoUpdate=await import("./auto-update-FXXQHBV5.js");autoUpdate.registerRunning();if(args.command==="task-loop"&&args.taskLoopAction!=="capacity"){process.env[autoUpdate.DISABLE_ENV]="1"}else if(args.command!=="update"){autoUpdate.onStartup(VERSION)}if(args.command==="domain"&&args.domain!==void 0){const{runDomain}=await import("./run-
|
|
1795
|
-
{},argv:args.domainArgv,help:args.domainHelp,globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,refresh:args.refresh,quiet:args.quiet||quietFromEnv(process.env)},version:VERSION});return}if(args.command==="api"){const{runApiCommand}=await import("./api-command-
|
|
1829
|
+
${HELP}`);process.exitCode=2;return}const autoUpdate=await import("./auto-update-FXXQHBV5.js");autoUpdate.registerRunning();if(args.command==="task-loop"&&args.taskLoopAction!=="capacity"){process.env[autoUpdate.DISABLE_ENV]="1"}else if(args.command!=="update"){autoUpdate.onStartup(VERSION)}if(args.command==="domain"&&args.domain!==void 0){const{runDomain}=await import("./run-GUA6UQTY.js");process.exitCode=await runDomain({domain:args.domain,...args.operation!==void 0?{operation:args.operation}:
|
|
1830
|
+
{},argv:args.domainArgv,help:args.domainHelp,globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,refresh:args.refresh,quiet:args.quiet||quietFromEnv(process.env)},version:VERSION});return}if(args.command==="api"){const{runApiCommand}=await import("./api-command-Z5LXIW43.js");process.exitCode=await runApiCommand({argv:args.domainArgv,help:args.domainHelp,
|
|
1796
1831
|
globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,quiet:args.quiet||quietFromEnv(process.env)},version:VERSION});return}if(args.command==="update"){const{runUpdate}=await import("./update-QGM225Q7.js");process.exitCode=await runUpdate({...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}if(args.command==="login"||args.
|
|
1797
1832
|
command==="logout"||args.command==="whoami"){const{runLogin,runLogout,runWhoami}=await import("./commands-EII35DA5.js");const options={profile:args.profile,method:args.loginMethod,tenant:args.tenant,noBrowser:args.loginNoBrowser,cliVersion:VERSION,force:args.logoutForce,...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{}};const runner=args.command==="login"?runLogin:args.command==="logout"?runLogout:runWhoami;process.exitCode=await runner(options);return}
|
|
1798
|
-
if(args.command==="task-loop"){const{runTaskLoop}=await import("./commands-
|
|
1833
|
+
if(args.command==="task-loop"){const{runTaskLoop}=await import("./commands-TSQN2TW7.js");process.exitCode=await runTaskLoop({action:args.taskLoopAction??"run",project:args.project,profile:args.profile,safe:args.safe,daemon:args.daemon,interval:args.interval,maxCycles:args.maxCycles,forceRunner:args.forceRunner,force:args.stopForce,drain:args.stopDrain,engine:args.engine,version:VERSION,verbose:args.verbose,scheduleNow:args.scheduleNow,scheduleCounts:args.scheduleCounts,scheduleGate:args.scheduleGate,
|
|
1799
1834
|
scheduleOp:args.scheduleOp,scheduleConfigOp:args.scheduleConfigOp,scheduleId:args.scheduleId,charterOp:args.charterOp,charterInput:args.charterFile,charterOutput:args.charterOut,charterRevision:args.charterRevision,settingsOp:args.settingsOp,orientationOp:args.orientationOp,orientationArgs:args.orientationArgs,skillOp:args.skillOp,skillName:args.skillName,skillAll:args.skillAll,skillDir:args.skillDir,skillConfig:args.skillConfig,output:args.output,query:args.query,revisionFrom:args.revisionFrom,
|
|
1800
1835
|
revisionTo:args.revisionTo,planOp:args.planOp,capacityOp:args.capacityOp,includeStopped:args.includeStopped,runnerOp:args.runnerOp,runnerId:args.runnerTargetId,triggerOp:args.triggerOp,triggerId:args.triggerId,triggerKey:args.triggerKey,triggerLimit:args.triggerLimit,planEmpty:args.planEmpty,planCheck:args.planCheck,yes:args.yes,ais:args.ais,workspace:args.workspace,aiConfigFile:args.aiConfigFile,noAiConfigFile:args.noAiConfigFile});return}if(args.command==="print"){const{runOneShot}=await import("./oneshot-WDI2RR2Y.js");
|
|
1801
|
-
process.exitCode=await runOneShot({prompt:args.prompt??"",fromStdin:args.promptFromStdin,mode:args.mode??"dev",...args.permissionMode!==void 0?{permissionMode:args.permissionMode}:{},allowedTools:args.allowedTools,disallowedTools:args.disallowedTools,...args.model!==void 0?{model:args.model}:{},...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}const{startTui}=await import("./app-
|
|
1836
|
+
process.exitCode=await runOneShot({prompt:args.prompt??"",fromStdin:args.promptFromStdin,mode:args.mode??"dev",...args.permissionMode!==void 0?{permissionMode:args.permissionMode}:{},allowedTools:args.allowedTools,disallowedTools:args.disallowedTools,...args.model!==void 0?{model:args.model}:{},...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}const{startTui}=await import("./app-STLDLWJJ.js");await startTui({mode:args.mode,permissionMode:args.permissionMode,allowedTools:args.
|
|
1802
1837
|
allowedTools,disallowedTools:args.disallowedTools,model:args.model,profile:args.profile,noTui:args.noTui||!process.stdout.isTTY,doctor:args.doctor,version:VERSION})}await main();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,promptSection}from"./chunk-5E7S5INB.js";import{InstanceLock,buildLockOwner,defaultIsLoopProcess,writeLockOwner}from"./chunk-3WHC4FSG.js";import{LoopSettingsApplier,renderStepBudget}from"./chunk-KYGDPWMC.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import{CANCELLED_MESSAGE,buildLoopConfig,evaluateOwnership,exportStateDirEnv,isCancelRequested,localConfigPath,loopStateDir,nextRunInOnExit,partialWorkHints}from"./chunk-7QHDTO2Z.js";import{describeOperations,evaluatePlanGate,fleetLastEmptyFinishMs,planGateStatePath,recordPlanned}from"./chunk-DWW7EKJD.js";import{CapacityReporter}from"./chunk-VYDPW2YO.js";import{formatHookIds,formatHookWiring,runHook,runPrefetch,runPreflight}from"./chunk-TTST7UDR.js";
|
|
3
|
+
import{ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,promptSection}from"./chunk-5E7S5INB.js";import{EngineNotConfiguredError,NoopEngine,UnknownEngineError,aiUnavailableLabel,assertKnownEngine,failureHint,isAiUnavailable,needsHumanToRestoreAi}from"./chunk-REWDCJNB.js";import{claudeConfigDir,resolveDetectDeps}from"./chunk-GODJH2PQ.js";import{InstanceLock,buildLockOwner,defaultIsLoopProcess,writeLockOwner}from"./chunk-3WHC4FSG.js";import{LoopSettingsApplier,renderStepBudget}from"./chunk-KYGDPWMC.js";
|
|
4
|
+
import{ServerSkillCatalog,formatSkillOrigins}from"./chunk-DZFULJR3.js";import"./chunk-MYBIPHZ7.js";import"./chunk-A4LFG7MW.js";import{NO_PLAN_SESSION,RECENT_ADVANCE_WINDOW_HOURS,buildDynamicBlocks,buildRecentCandidateIndex,createItem,enqueueBlockerRecovery,enqueueDevVerifyForMerged,enqueueReleasePartialMergeRerun,enqueueReleasePhase5Recovery,fileSkillNames,findRecentCandidate,formatInflightEntry,formatPlanResultLine,formatRecentAdvance,formatResumeHold,inflightEntries,inflightStaleHours,
|
|
5
|
+
openPlanSession,parseOutcomeCode,parseReleaseResult,parseTaskStatusSnapshot,pendingTaskKeys,resolveRecentAdvance,resolveResumeHold,shouldSuppressForResume,shouldSuppressForStatus,staleFloorHours,unavailableChecks,windowStartMicros}from"./chunk-2LFYNWTT.js";import"./chunk-VRBI2NPI.js";import{duplicateTaskKeyDropReason,excludedKeyInArgs,extractPlanJson,parseOpsCount,parsePlanExcludeKeys,placeholderTaskKey,releaseDeployDropReason,stepToItem,zeroTargetDropReasons}from"./chunk-YAN3G35K.js";
|
|
6
|
+
import{redactLoopOutput}from"./chunk-VEEZJNOB.js";import{CANCELLED_MESSAGE,buildLoopConfig,evaluateOwnership,exportStateDirEnv,isCancelRequested,localConfigPath,loopStateDir,nextRunInOnExit,partialWorkHints}from"./chunk-7QHDTO2Z.js";import{describeOperations,evaluatePlanGate,fleetLastEmptyFinishMs,planGateStatePath,recordPlanned}from"./chunk-DWW7EKJD.js";import{CapacityReporter}from"./chunk-VYDPW2YO.js";import{formatHookIds,formatHookWiring,runHook,runPrefetch,runPreflight}from"./chunk-TTST7UDR.js";
|
|
7
7
|
import{exclusiveInflightEntries,formatExclusiveEntry,normalizeSkillName,slotCheckCommandText,spawnSyncResolved}from"./chunk-ZFSWQQH3.js";import{setSkillPrefix,skillCommand,skillFromPrompt,stripSkillCommand}from"./chunk-6CS5L24D.js";import{killProcessTree}from"./chunk-N2UVRM3Z.js";import{AgentLoopApi,describeError,filterByStatus,isPermanent,pick,pickString}from"./chunk-GYX2ZXQM.js";import{PRIVATE_PROJECT_REF,isPrivateProjectId,isPrivateProjectRef,privateProjectId,projectFileKey}from"./chunk-RMFLTSOV.js";
|
|
8
8
|
import"./chunk-BD7O73GK.js";import{ULID_RE,loopProjectIdPolicy,resolveProjectRef}from"./chunk-HVZUXLQ4.js";import"./chunk-SBRTBKEZ.js";import"./chunk-VFPY2A23.js";import{joinFor}from"./chunk-PMOUHEJQ.js";import{AuthSession}from"./chunk-XNLIEUAW.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{compareVersionCores,parseVersionCore}from"./chunk-DXXFUNYN.js";import"./chunk-5WGOHFAS.js";import{effectiveApiUrl,resolveProfile}from"./chunk-EDF4U5BT.js";
|
|
9
9
|
import{twpHomeDir}from"./chunk-RZVI6PMW.js";import{effectiveOrientation,renderOrientationSection}from"./chunk-NJL3H2BB.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import fs10 from"fs";import path8 from"path";import fs from"fs";import path from"path";var LoopLogger=class{constructor(runnerId,logFile,out=process.stdout,now=()=>new Date){this.runnerId=runnerId;this.out=out;this.now=now;if(logFile){fs.mkdirSync(path.dirname(logFile),{recursive:true});this.stream=fs.createWriteStream(logFile,{flags:"a"})}}runnerId;out;now;stream=null;log(message){const d=this.now();const ts=`${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;const line=`[${ts}] [${this.runnerId}] ${stripTerminalControls(
|
|
@@ -320,7 +320,7 @@ handlers.onRestart({from:decision.from,to:decision.to})};const timer=setInterval
|
|
|
320
320
|
pid<=0)return null;return{pid,at:sanitizeAt(at)}}catch{return null}}function sanitizeAt(at){if(typeof at!=="string")return"";return at.replace(/[\u0000-\u001f\u007f]/g," ").slice(0,MAX_AT_LENGTH)}function clearMarker(lockDir2,kind,deps={}){const rm=deps.rmSync??(p=>fs9.rmSync(p,{recursive:true,force:true}));try{rm(markerPath(lockDir2,kind))}catch{}}function watchMarker(lockDir2,kind,selfPid,onStop,deps={}){let fired=false;const timer=setInterval(()=>{if(fired)return;const req=readMarker(lockDir2,kind,deps);if(req===null||req.pid!==selfPid)return;fired=true;onStop(req)},deps.intervalMs??POLL_MS);timer.unref?.();return()=>{fired=true;clearInterval(timer)}}function safe(s){return stripTerminalControls(s)}function compactTimestamp(at=new Date){const p2=n=>String(n).padStart(2,"0");return`${at.getFullYear()}${p2(at.getMonth()+1)}${p2(at.getDate())}-${p2(at.getHours())}${p2(at.getMinutes())}${p2(at.getSeconds())}`}async function buildEngine(config,log){if(config.engine==="noop")return new NoopEngine;const{DispatchEngine}=await import("./ai-dispatch-63HQS7Z2.js");const{DEFAULT_PREFLIGHT_HOSTS}=await import("./ai-dispatch-63HQS7Z2.js");const extraHosts=config.
|
|
321
321
|
operations.preflightHosts;return new DispatchEngine(config.ai,log,{workspace:config.workspace,charterFile:config.charterFile??void 0,charterEnabled:config.charterEnabled,...config.charterPrefix===null?{}:{charterPrefix:config.charterPrefix},...config.charterSuffix===null?{}:{charterSuffix:config.charterSuffix},serverPrompts:()=>config.serverPrompts??{},compileCommand:config.compileCommand??void 0,skillOverlayDir:path8.join(config.stateDir,"skill-overlay",projectFileKey(config.projectId)),launcher:config.
|
|
322
322
|
claudeLauncher,...extraHosts.length>0?{preflightHosts:[...DEFAULT_PREFLIGHT_HOSTS,...extraHosts]}:{}})}function lockDir(config){return path8.join(config.stateDir,`task-loop-${projectFileKey(config.projectId)}.lock.d`)}function runnerIdPersisted(stateDir,env=process.env){if((env.RUNNER_ID?.trim()??"")!=="")return true;const file=env.RUNNER_ID_FILE&&env.RUNNER_ID_FILE.trim()!==""?env.RUNNER_ID_FILE:path8.join(stateDir,"runner-id");return fs10.existsSync(file)}async function runTaskLoop(opts){if(opts.
|
|
323
|
-
action==="stop")return await stopLoop(opts);if(opts.action==="plan"){if(opts.planOp!=="submit"){process.stderr.write("plan \u306B\u306F submit \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\n");return 2}const{runPlanSubmit}=await import("./plan-submit-
|
|
323
|
+
action==="stop")return await stopLoop(opts);if(opts.action==="plan"){if(opts.planOp!=="submit"){process.stderr.write("plan \u306B\u306F submit \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\n");return 2}const{runPlanSubmit}=await import("./plan-submit-WY6MIKFG.js");return runPlanSubmit({file:opts.charterInput,empty:opts.planEmpty===true,check:opts.planCheck===true},{env:process.env,readStdin:()=>fs10.readFileSync(0,"utf8"),stdout:s=>process.stdout.write(s),stderr:s=>process.stderr.write(
|
|
324
324
|
s)})}const profile=resolveProfile(opts.profile);let creds;try{creds=new AuthSession(profile.name,profile.apiUrl).loadOrThrow()}catch(err){process.stderr.write(`${err.message}
|
|
325
325
|
`);return 1}const apiUrl=effectiveApiUrl(profile,creds.api_url);const session=new AuthSession(profile.name,apiUrl);if(opts.action==="capacity"&&opts.capacityOp==="list"){let filterId;if(opts.project!==void 0&&opts.project!==""){try{filterId=(await new ProjectApi(apiUrl,session).resolve(opts.project)).id}catch(err){process.stderr.write(`${err.message}
|
|
326
326
|
`);return 1}}const api2=new AgentLoopApi({apiUrl,projectId:filterId??"",session});const{runCapacityList}=await import("./capacity-list-command-EUU3H5ZE.js");return runCapacityList({get:()=>api2.runnersOverview()},{output:opts.output,query:opts.query,includeStopped:opts.includeStopped===true,projectId:filterId})}const projectRef=opts.project??process.env.TWP_PROJECT??"";if(projectRef===""){process.stderr.write("--project <\u30AD\u30FC|UUID> \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08TWP_PROJECT \u3067\u3082\u53EF\uFF09\n");
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{CONTENT_FILE_FLAG,NOTES_PATH,NOTE_GET_COLUMNS,NOTE_LABEL,NOTE_STATUSES,NOTE_VISIBILITIES,TEXT_OUTPUT_HELP,WIKI_CONTENT_FORMATS,WIKI_FORMAT_BY_EXTENSION,digestSummary,envelopeRows,fitDigest,meetingDomain,noArgs,noteGet,noteList,oneOf,pageLimit,record,resolveWikiPath,scanTruncatedNote,singleId,wikiDomain}from"./chunk-ERMKZMGS.js";import"./chunk-VRBI2NPI.js";import"./chunk-EXT4AIDF.js";import"./chunk-62GRAKUD.js";import"./chunk-JJSBBWJ5.js";import"./chunk-HEH3PUW2.js";
|
|
4
|
+
import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-VGT2EGH6.js";import"./chunk-QV4K6V2L.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import"./chunk-MMVXE2CJ.js";import"./chunk-SBRTBKEZ.js";import"./chunk-MI6HVYR2.js";import"./chunk-PS5QFKHB.js";import"./chunk-3ZRMMBP5.js";import"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";
|
|
5
|
+
import"./chunk-RZVI6PMW.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{CONTENT_FILE_FLAG,NOTES_PATH,NOTE_GET_COLUMNS,NOTE_LABEL,NOTE_STATUSES,NOTE_VISIBILITIES,TEXT_OUTPUT_HELP,WIKI_CONTENT_FORMATS,WIKI_FORMAT_BY_EXTENSION,digestSummary,envelopeRows,fitDigest,meetingDomain,noArgs,noteGet,noteList,oneOf,pageLimit,record,resolveWikiPath,scanTruncatedNote,singleId,wikiDomain};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{checkOutTarget}from"./chunk-
|
|
3
|
+
import{checkOutTarget}from"./chunk-37G5JJIY.js";import"./chunk-WDE24TCO.js";import"./chunk-F5QDUPQO.js";import"./chunk-P4QSPSOQ.js";import{contentTypeFor,inspectLocalFile}from"./chunk-6FGR3U5C.js";import{checkUploadQuota}from"./chunk-V64CGX7V.js";import"./chunk-Q3B65OFC.js";import{parseWaitOptions,waitUntilTerminal}from"./chunk-WVCEKC7V.js";import"./chunk-RMFLTSOV.js";import{readBody}from"./chunk-HEH3PUW2.js";import"./chunk-W4NLJ2YK.js";
|
|
4
4
|
import"./chunk-BD7O73GK.js";import{repeatedValues}from"./chunk-VGT2EGH6.js";import"./chunk-QV4K6V2L.js";import{ApiError}from"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import{collapsesInUrlPath,isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-MMVXE2CJ.js";import"./chunk-SBRTBKEZ.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger,readEnvelopeCursor,shellQuote}from"./chunk-MI6HVYR2.js";import{requireResolved,
|
|
5
5
|
singleRef,withResolved}from"./chunk-PS5QFKHB.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,NetworkError,UsageError,WaitTimeoutError}from"./chunk-VFPY2A23.js";import"./chunk-KIZIRVW6.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-KD4YXQOZ.js";import"./chunk-OKATZ4SN.js";import"./chunk-RKBUJKI5.js";
|
|
6
6
|
import"./chunk-UREA4ZIG.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import crypto2 from"crypto";import fs2 from"fs";import path from"path";var SCOPE_PERSONAL="personal";var SCOPE_PROJECT="project";var UUID=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var FORBIDDEN_NAME=/[/\\:*?"<>|]/;var NAME_MAX=255;var ROW_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","updated_at"];var TRASH_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","deleted_at"];function folderRows(raw){return raw.map(row=>{const id=row["id"];const name=row["name"];const parentId=row["parent_id"];if(typeof id!==
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{CONTENT_FILE_FLAG,NOTES_PATH,NOTE_GET_COLUMNS,NOTE_LABEL,NOTE_STATUSES,NOTE_VISIBILITIES,noArgs,noteGet,noteList,oneOf,pageLimit,record,singleId}from"./chunk-ERMKZMGS.js";import"./chunk-VRBI2NPI.js";import"./chunk-EXT4AIDF.js";import"./chunk-62GRAKUD.js";import"./chunk-JJSBBWJ5.js";import{charCount,readBody}from"./chunk-HEH3PUW2.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import{repeatedValues}from"./chunk-VGT2EGH6.js";
|
|
4
|
+
import"./chunk-QV4K6V2L.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import{isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-MMVXE2CJ.js";import"./chunk-SBRTBKEZ.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty}from"./chunk-MI6HVYR2.js";import"./chunk-PS5QFKHB.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";
|
|
5
|
+
import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import path from"path";var NOTE_CONTENT_MAX_BYTES=3e5;var NOTE_TITLE_MAX_CHARS=255;var NOTE_TAG_MAX_CHARS=50;var NOTE_COMMENT_MAX_CHARS=1e4;var NOTE_COMMENT_COLUMNS=["id","created_by_name","content","created_at","updated_at"];var NOTE_CATEGORY_COLUMNS=["id","name","description","note_count","sort_order"];var NOTE_SUBSCRIPTION_COLUMNS=["target_tenant_id","target_tenant_name","subscribed_by_name","subscribed_at"];var NOTE_AVAILABLE_COLUMNS=["tenant_id","tenant_name","note_count"];var NOTE_FORMAT_BY_EXTENSION={".md":"mar\
|
|
6
|
+
kdown",".markdown":"markdown",".html":"html",".htm":"html"};var NOTE_CONTENT_TYPES=["html","markdown"];function noteId(input,command){return singleId(input,command,NOTE_LABEL,"twp note list")}function notePath(id){return`${NOTES_PATH}/${encodeURIComponent(id)}`}function noteFrom(body){return record(body,"note",NOTE_LABEL)}function arrayOf(body,key,label){const value=isRecord(body)&&body["result"]===true?body[key]:void 0;if(!Array.isArray(value))throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u306B ${key}\
|
|
7
|
+
\u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return value}function noteAndComment(input,command){const[rawNote,rawComment,...rest]=input.args;const note=rawNote?.trim()??"";const comment=rawComment?.trim()??"";if(note===""||comment==="")throw new UsageError("\u30CE\u30FC\u30C8\u306E ID \u3068\u30B3\u30E1\u30F3\u30C8\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",`${command} <\u30CE\u30FC\u30C8ID> <\u30B3\u30E1\u30F3\u30C8I\
|
|
8
|
+
D>`);if(rest.length>0)throw new UsageError(`${command} \u304C\u53D7\u3051\u53D6\u308C\u308B\u5F15\u6570\u306F2\u3064\u3060\u3051\u3067\u3059: ${rest.join(" ")}`,`${command} help`);for(const[value,label,where]of[[note,"\u30CE\u30FC\u30C8","twp note list"],[comment,"\u30B3\u30E1\u30F3\u30C8","twp note comment list"]]){if(!isSafePathSegment(value))throw new UsageError(`${label}\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${value}`,`${label}\u306E ID \u306F ${where} \u306E id \u5217\
|
|
9
|
+
\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002`)}return{note,comment}}var NOTE_CREATE_USAGE="twp note create --title <\u4EF6\u540D> --content-file <\u30D1\u30B9|-> [--content-format <html|markdown>] [--status <draft|published>] [--visibility <\u516C\u958B\u7BC4\u56F2>] [--category <\u30AB\u30C6\u30B4\u30EAID>] [--tag <\u30BF\u30B0>]... [--eyecatch <\u30D5\u30A1\u30A4\u30EBID>] [--anonymous|--no-anonymous]";var NOTE_UPDATE_USAGE="twp note update <\u30CE\u30FC\u30C8ID> [--title <\u4EF6\u540D>] [--content-file <\u30D1\u30B9|->] [-\
|
|
10
|
+
-content-format <html|markdown>] [--status <draft|published>] [--visibility <\u516C\u958B\u7BC4\u56F2>] [--category <\u30AB\u30C6\u30B4\u30EAID>|--clear-category] [--tag <\u30BF\u30B0>...|--clear-tags] [--eyecatch <\u30D5\u30A1\u30A4\u30EBID>|--clear-eyecatch] [--anonymous|--no-anonymous]";var NOTE_WRITE_FLAGS=[{name:"--title",summary:`\u4EF6\u540D\uFF08${NOTE_TITLE_MAX_CHARS}\u6587\u5B57\u4EE5\u5185\uFF09`,takesValue:true,placeholder:"<\u4EF6\u540D>"},CONTENT_FILE_FLAG,{name:"--content-format",
|
|
11
|
+
summary:`\u672C\u6587\u306E\u5F62\u5F0F\uFF08${NOTE_CONTENT_TYPES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u5F62\u5F0F>"},{name:"--status",summary:`\u72B6\u614B\uFF08${NOTE_STATUSES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u72B6\u614B>"},{name:"--visibility",summary:`\u516C\u958B\u7BC4\u56F2\uFF08${NOTE_VISIBILITIES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u516C\u958B\u7BC4\u56F2>"},{name:"--category",summary:"\u30AB\u30C6\u30B4\u30EA\u306E ID\uFF08twp note category list\uFF09",
|
|
12
|
+
takesValue:true,placeholder:"<\u30AB\u30C6\u30B4\u30EAID>"},{name:"--tag",summary:`\u30BF\u30B0\uFF08\u8907\u6570\u56DE\u53EF\u30FB${NOTE_TAG_MAX_CHARS}\u6587\u5B57\u4EE5\u5185\u3002\u6307\u5B9A\u3059\u308B\u3068\u30BF\u30B0\u3092\u307E\u308B\u3054\u3068\u7F6E\u304D\u63DB\u3048\u308B\uFF09`,takesValue:true,placeholder:"<\u30BF\u30B0>",repeatable:true},{name:"--eyecatch",summary:"\u30A2\u30A4\u30AD\u30E3\u30C3\u30C1\u753B\u50CF\u306E\u30D5\u30A1\u30A4\u30EBID\uFF08\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6E08\u307F\u306E\u3082\u306E\u3002\u30ED\u30FC\u30AB\u30EB\u306E\u30D1\u30B9\u3067\u306F\u306A\u3044\uFF09",
|
|
13
|
+
takesValue:true,placeholder:"<\u30D5\u30A1\u30A4\u30EBID>"},{name:"--anonymous",summary:"\u533F\u540D\u3067\u6295\u7A3F\u3059\u308B\uFF08\u4F5C\u6210\u8005\u3092\u4F0F\u305B\u308B\uFF09",takesValue:false},{name:"--no-anonymous",summary:"\u533F\u540D\u306B\u3057\u306A\u3044\uFF08\u4F5C\u6210\u8005\u3092\u8868\u793A\u3059\u308B\uFF09",takesValue:false}];var NOTE_WRITE_HELP=`\u672C\u6587\u306F --content-file \u306E\u30D5\u30A1\u30A4\u30EB\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09\u304B\u3089\u8AAD\u307F\u3001\u52A0\u5DE5\u305B\u305A\u306B\u9001\u308A\u307E\u3059\uFF08\u5148\u982D\u306E BOM \u3060\u3051\u843D\u3068\u3057\u307E\u3059\uFF09\u3002
|
|
14
|
+
\u672C\u6587\u306E\u5F62\u5F0F\u306F --content-format\uFF08html / markdown\uFF09\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002\u7701\u304F\u3068 --content-file \u306E\u62E1\u5F35\u5B50\u3067\u6C7A\u3081\u307E\u3059\uFF08.md / .markdown \u306F markdown\u3001.html / .htm \u306F html\uFF09\u3002\u6C7A\u307E\u3089\u306A\u3051\u308C\u3070\u5F62\u5F0F\u3092\u9001\u3089\u305A\u3001\u30B5\u30FC\u30D0\u306E\u65E2\u5B9A\uFF08HTML\uFF09\u306B\u306A\u308A\u307E\u3059\u3002
|
|
15
|
+
\u672C\u6587\u306E\u4E0A\u9650\u306F\u30B5\u30FC\u30D0\u3068\u540C\u3058 ${NOTE_CONTENT_MAX_BYTES.toLocaleString("en-US")} \u30D0\u30A4\u30C8\uFF08UTF-8\uFF09\u3067\u3059\u3002
|
|
16
|
+
\u533F\u540D\u306E\u65E2\u5B9A\u306F\u30B5\u30FC\u30D0\u304C\u6C7A\u3081\u307E\u3059\uFF08--anonymous / --no-anonymous \u3092\u7701\u304F\u3068\u9001\u308A\u307E\u305B\u3093\uFF09\u3002`;function noteContentType(input){const explicit=oneOf(input,"--content-format",NOTE_CONTENT_TYPES);if(explicit!==void 0)return{format:explicit};const file=input.flags.get("--content-file");if(file===void 0||file==="-")return void 0;const extension=path.extname(file).toLowerCase();const format=NOTE_FORMAT_BY_EXTENSION[extension];
|
|
17
|
+
return format===void 0?void 0:{format,inferredFrom:extension}}function noteTitle(input){const raw=input.flags.get("--title");if(raw===void 0)return void 0;if(raw.trim()==="")throw new UsageError("--title \u304C\u7A7A\u3067\u3059","\u4EF6\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");const count=charCount(raw);if(count>NOTE_TITLE_MAX_CHARS){throw new UsageError(`--title \u304C\u9577\u3059\u304E\u307E\u3059\uFF08${count} \u6587\u5B57\u30FB\u4E0A\u9650 ${NOTE_TITLE_MAX_CHARS} \
|
|
18
|
+
\u6587\u5B57\uFF09`,`\u30B5\u30FC\u30D0\u306E\u4E0A\u9650\u304C${NOTE_TITLE_MAX_CHARS}\u6587\u5B57\u3067\u3059\u3002`)}return raw}function noteTags(input){const tags=repeatedValues(input,"--tag").map(tag=>tag.trim());const clear=input.flags.has("--clear-tags");if(clear&&tags.length>0)throw new UsageError("--tag \u3068 --clear-tags \u306F\u4F75\u7528\u3067\u304D\u307E\u305B\u3093","--tag \u306F\u30BF\u30B0\u3092\u307E\u308B\u3054\u3068\u7F6E\u304D\u63DB\u3048\u307E\u3059\u3002\u6D88\u3059\u3060\u3051\u306A\u3089 --clear-tags \u3060\u3051\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
19
|
+
if(clear)return[];if(tags.length===0)return void 0;for(const tag of tags){if(tag==="")throw new UsageError("--tag \u304C\u7A7A\u3067\u3059","\u30BF\u30B0\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");if(charCount(tag)>NOTE_TAG_MAX_CHARS)throw new UsageError(`--tag \u304C\u9577\u3059\u304E\u307E\u3059\uFF08${tag}\u30FB\u4E0A\u9650 ${NOTE_TAG_MAX_CHARS} \u6587\u5B57\uFF09`,`\u30B5\u30FC\u30D0\u306E\u4E0A\u9650\u304C${NOTE_TAG_MAX_CHARS}\u6587\u5B57\u3067\u3059\u3002`)}return[...new Set(
|
|
20
|
+
tags)]}function clearableId(input,flag,clearFlag,label){const raw=nonEmpty(input.flags,flag);if(clearFlag!==void 0&&input.flags.has(clearFlag)){if(raw!==void 0)throw new UsageError(`${flag} \u3068 ${clearFlag} \u306F\u4F75\u7528\u3067\u304D\u307E\u305B\u3093`,`${label}\u3092\u5916\u3059\u306A\u3089 ${clearFlag} \u3060\u3051\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return null}if(raw===void 0)return void 0;const value=raw.trim();if(!isSafePathSegment(value))throw new UsageError(
|
|
21
|
+
`${flag} \u306B${label}\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${raw}`,`${flag} help`);return value}function noteAnonymous(input){const on=input.flags.has("--anonymous");const off=input.flags.has("--no-anonymous");if(on&&off)throw new UsageError("--anonymous \u3068 --no-anonymous \u306F\u4F75\u7528\u3067\u304D\u307E\u305B\u3093");if(on)return true;if(off)return false;return void 0}async function noteContent(input,usage){const content=await readBody(input,{flag:"--\
|
|
22
|
+
content",fileFlag:"--content-file",label:"\u30CE\u30FC\u30C8\u306E\u672C\u6587",maxChars:NOTE_CONTENT_MAX_BYTES,usage});if(content!==void 0){const bytes=Buffer.byteLength(content,"utf8");if(bytes>NOTE_CONTENT_MAX_BYTES){throw new UsageError(`\u30CE\u30FC\u30C8\u306E\u672C\u6587\u304C\u5927\u304D\u3059\u304E\u307E\u3059\uFF08${bytes} \u30D0\u30A4\u30C8\u30FB\u4E0A\u9650 ${NOTE_CONTENT_MAX_BYTES} \u30D0\u30A4\u30C8\uFF09`,"\u30B5\u30FC\u30D0\u306E\u4E0A\u9650\u3067\u3059\u3002\u5206\u5272\u3059\u308B\u304B\u5185\u5BB9\u3092\u77ED\u304F\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}}
|
|
23
|
+
return content}function noteFields(input,update){const title=noteTitle(input);const status=oneOf(input,"--status",NOTE_STATUSES);const visibility=oneOf(input,"--visibility",NOTE_VISIBILITIES);const category=clearableId(input,"--category",update?"--clear-category":void 0,"\u30AB\u30C6\u30B4\u30EA");const tags=noteTags(input);const eyecatch=clearableId(input,"--eyecatch",update?"--clear-eyecatch":void 0,"\u30D5\u30A1\u30A4\u30EB");const anonymous=noteAnonymous(input);const type=noteContentType(input);
|
|
24
|
+
return{...title!==void 0?{title}:{},...type!==void 0?{content_type:type.format}:{},...status!==void 0?{status}:{},...visibility!==void 0?{visibility}:{},...category!==void 0?{category_id:category}:{},...tags!==void 0?{tags}:{},...eyecatch!==void 0?{eyecatch_file_id:eyecatch}:{},...anonymous!==void 0?{is_anonymous:anonymous}:{}}}function formatNotes(input){const type=noteContentType(input);if(type?.inferredFrom!==void 0){return[`--content-format \u3092\u7701\u3044\u305F\u306E\u3067\u3001--content-file \u306E\u62E1\u5F35\u5B50\uFF08${type.
|
|
25
|
+
inferredFrom}\uFF09\u304B\u3089 ${type.format} \u3068\u3057\u3066\u9001\u308A\u307E\u3059\u3002`]}if(type===void 0&&input.flags.has("--content-file")){return["--content-format \u3092\u7701\u304D\u3001\u62E1\u5F35\u5B50\u304B\u3089\u3082\u5F62\u5F0F\u304C\u6C7A\u307E\u3089\u306A\u3044\u306E\u3067\u5F62\u5F0F\u3092\u9001\u308A\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u306E\u65E2\u5B9A\u306F HTML\uFF09\u3002"]}return[]}var noteCreate={name:"create",summary:`${NOTE_LABEL}\u3092\u4F5C\u6210\u3059\u308B\uFF08\u672C\u6587\u306F\u30D5\u30A1\u30A4\u30EB\u304B\u3089\uFF09`,
|
|
26
|
+
usage:NOTE_CREATE_USAGE,description:`${NOTE_WRITE_HELP}
|
|
27
|
+
--status / --visibility \u3092\u7701\u304F\u3068\u30B5\u30FC\u30D0\u306E\u65E2\u5B9A\u3067\u4F5C\u308A\u307E\u3059\u3002
|
|
28
|
+
|
|
29
|
+
\u4F8B:
|
|
30
|
+
twp note create --title \u9031\u5831 --content-file weekly.md --status published --visibility tenant --tag \u9031\u5831
|
|
31
|
+
cat memo.html | twp note create --title \u4E0B\u66F8\u304D --content-file - --dry-run`,flags:[...NOTE_WRITE_FLAGS],async prepare(input){noArgs(input,"twp note create");if(noteTitle(input)===void 0)throw new UsageError("--title \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",NOTE_CREATE_USAGE);noteFields(input,false);const content=await noteContent(input,NOTE_CREATE_USAGE);if(content===void 0)throw new UsageError("\u672C\u6587\u3092 --content-file \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09",
|
|
32
|
+
NOTE_CREATE_USAGE);return{...input,resolved:{...input.resolved,content}}},plan(input){const content=input.resolved?.["content"];if(content===void 0)throw new UsageError("\u672C\u6587\u3092 --content-file \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09",NOTE_CREATE_USAGE);return{method:"POST",path:NOTES_PATH,body:{...noteFields(input,false),content}}},plannedNotes:input=>formatNotes(input),summarize:body=>pick(noteFrom(body),NOTE_GET_COLUMNS),raw:noteFrom};
|
|
33
|
+
var noteUpdate={name:"update",summary:`${NOTE_LABEL}\u3092\u66F4\u65B0\u3059\u308B\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\uFF09`,usage:NOTE_UPDATE_USAGE,description:`${NOTE_WRITE_HELP}
|
|
34
|
+
\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\u3092\u9001\u308A\u307E\u3059\u3002--tag \u306F\u30BF\u30B0\u3092\u307E\u308B\u3054\u3068\u7F6E\u304D\u63DB\u3048\u3001--clear-tags \u3067\u7A7A\u306B\u3057\u307E\u3059\u3002
|
|
35
|
+
--clear-category / --clear-eyecatch \u3067\u30AB\u30C6\u30B4\u30EA\u30FB\u30A2\u30A4\u30AD\u30E3\u30C3\u30C1\u3092\u5916\u3057\u307E\u3059\u3002--content-format \u306F --content-file \u3068\u4E00\u7DD2\u306B\u3060\u3051\u6307\u5B9A\u3067\u304D\u307E\u3059\uFF08\u5F62\u5F0F\u3060\u3051\u3092\u5909\u3048\u308B\u3068\u672C\u6587\u304C\u5909\u63DB\u3055\u308C\u305A\u306B\u8868\u793A\u304C\u5D29\u308C\u307E\u3059\uFF09\u3002
|
|
36
|
+
\u66F4\u65B0\u3067\u304D\u308B\u306E\u306F\u4F5C\u6210\u8005\u3068\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u3067\u3059\uFF08\u6A29\u9650\u304C\u7121\u3051\u308C\u3070\u30B5\u30FC\u30D0\u306E 403 \u306E\u6587\u9762\u3092\u305D\u306E\u307E\u307E\u51FA\u3057\u307E\u3059\uFF09\u3002
|
|
37
|
+
|
|
38
|
+
\u4F8B:
|
|
39
|
+
twp note update 0f8b2c6e-... --status published
|
|
40
|
+
twp note update 0f8b2c6e-... --content-file memo.md --tag \u624B\u9806 --tag \u904B\u7528`,flags:[...NOTE_WRITE_FLAGS,{name:"--clear-category",summary:"\u30AB\u30C6\u30B4\u30EA\u3092\u5916\u3059",takesValue:false},{name:"--clear-tags",summary:"\u30BF\u30B0\u3092\u7A7A\u306B\u3059\u308B",takesValue:false},{name:"--clear-eyecatch",summary:"\u30A2\u30A4\u30AD\u30E3\u30C3\u30C1\u3092\u5916\u3059",takesValue:false}],async prepare(input){noteId(input,"twp note update");if(input.flags.has("--content-\
|
|
41
|
+
format")&&!input.flags.has("--content-file")){throw new UsageError("--content-format \u306F --content-file \u3068\u4E00\u7DD2\u306B\u3060\u3051\u6307\u5B9A\u3067\u304D\u307E\u3059","\u5F62\u5F0F\u3060\u3051\u3092\u5909\u3048\u308B\u3068\u3001\u3044\u307E\u306E\u672C\u6587\u304C\u5909\u63DB\u3055\u308C\u305A\u306B\u5225\u306E\u5F62\u5F0F\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u672C\u6587\u3054\u3068\u9001\u308A\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}const fields=noteFields(
|
|
42
|
+
input,true);const content=await noteContent(input,NOTE_UPDATE_USAGE);if(content===void 0&&Object.keys(fields).length===0){throw new UsageError("\u66F4\u65B0\u3059\u308B\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",NOTE_UPDATE_USAGE)}return content===void 0?input:{...input,resolved:{...input.resolved,content}}},plan(input){const content=input.resolved?.["content"];return{method:"PUT",path:notePath(noteId(input,"twp note update")),body:{...noteFields(input,
|
|
43
|
+
true),...content!==void 0?{content}:{}}}},plannedNotes:input=>formatNotes(input),summarize:body=>pick(noteFrom(body),NOTE_GET_COLUMNS),raw:noteFrom};async function previewNoteDelete(input,ctx){const id=noteId(input,"twp note delete");const note=noteFrom(await ctx.send({method:"GET",path:notePath(id)}));return{notes:[`\u524A\u9664\u3059\u308B${NOTE_LABEL}: ${String(note["title"]??"(\u4EF6\u540D\u306A\u3057)")}\uFF08ID ${id}\uFF09`],warnings:[]}}var noteDelete={name:"delete",summary:`${NOTE_LABEL}\
|
|
44
|
+
\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\uFF09`,usage:"twp note delete <\u30CE\u30FC\u30C8ID> --yes",description:"\u9001\u308B\u524D\u306B\u30CE\u30FC\u30C8\u3092\u53D6\u5F97\u3057\u3001\u6D88\u3048\u308B\u30CE\u30FC\u30C8\u306E\u4EF6\u540D\u3092 stderr \u306B\u51FA\u3057\u307E\u3059\uFF08\u53D6\u5F97\u3067\u30B5\u30FC\u30D0\u304C\u95B2\u89A7\u6570\u30921\u5897\u3084\u3057\u307E\u3059\uFF09\u3002\n\u524A\u9664\u3067\u304D\u308B\u306E\u306F\u4F5C\u6210\u8005\u3068\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u3067\u3059\u3002",
|
|
45
|
+
destructive:true,flags:[],preview:previewNoteDelete,plan:input=>({method:"DELETE",path:notePath(noteId(input,"twp note delete"))}),summarize:body=>acknowledgement(body,`${NOTE_LABEL}\u306E\u524A\u9664`),raw:body=>acknowledgement(body,`${NOTE_LABEL}\u306E\u524A\u9664`)};var commentPaging=envelopePaging({label:`${NOTE_LABEL}\u306E\u30B3\u30E1\u30F3\u30C8\u4E00\u89A7`});var COMMENT_BODY_FLAGS=[{name:"--body",summary:"\u30B3\u30E1\u30F3\u30C8\u672C\u6587\uFF08\u6539\u884C\u3084\u8A18\u53F7\u3092\u542B\u3080\u306A\u3089 --body-file\uFF09",
|
|
46
|
+
takesValue:true,placeholder:"<\u672C\u6587>"},{name:"--body-file",summary:"\u30B3\u30E1\u30F3\u30C8\u672C\u6587\u3092\u8AAD\u3080\u30D5\u30A1\u30A4\u30EB\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9|->"}];async function commentBody(input,usage){return readBody(input,{flag:"--body",fileFlag:"--body-file",label:"\u30B3\u30E1\u30F3\u30C8",maxChars:NOTE_COMMENT_MAX_CHARS,usage})}function commentFrom(body){return record(body,"comment","\u30B3\u30E1\u30F3\u30C8")}
|
|
47
|
+
var COMMENT_CREATE_USAGE="twp note comment create <\u30CE\u30FC\u30C8ID> --body <\u672C\u6587>|--body-file <\u30D1\u30B9|-> [--anonymous]";var COMMENT_UPDATE_USAGE="twp note comment update <\u30CE\u30FC\u30C8ID> <\u30B3\u30E1\u30F3\u30C8ID> --body <\u672C\u6587>|--body-file <\u30D1\u30B9|->";var commentList={name:"list",summary:`${NOTE_LABEL}\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u4E00\u89A7\u3059\u308B`,usage:"twp note comment list <\u30CE\u30FC\u30C8ID> [--all] [--limit <\u4EF6\u6570>]",description:`\
|
|
48
|
+
\u533F\u540D\u306E\u30B3\u30E1\u30F3\u30C8\u306F\u6295\u7A3F\u8005\u304C\u4F0F\u305B\u3089\u308C\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u5224\u5B9A\uFF09\u3002
|
|
49
|
+
|
|
50
|
+
${LIST_PAGING_HELP}`,flags:[...LIST_FLAGS],paging:commentPaging,plan:input=>({method:"GET",path:`${notePath(noteId(input,"twp note comment list"))}/comments`,query:{limit:pageLimit(input),cursor:nonEmpty(input.flags,"--cursor")}}),summarize:body=>commentPaging.items(body).map(row=>pick(row,NOTE_COMMENT_COLUMNS)),raw:body=>commentPaging.items(body)};var commentCreate={name:"create",summary:`${NOTE_LABEL}\u306B\u30B3\u30E1\u30F3\u30C8\u3059\u308B`,usage:COMMENT_CREATE_USAGE,description:`\u672C\u6587\u306F ${NOTE_COMMENT_MAX_CHARS.
|
|
51
|
+
toLocaleString("en-US")} \u6587\u5B57\u307E\u3067\u3067\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u4E0A\u9650\uFF09\u3002\u533F\u540D\u306E\u65E2\u5B9A\u306F\u30B5\u30FC\u30D0\u304C\u6C7A\u3081\u307E\u3059\u3002
|
|
52
|
+
\u4E0B\u66F8\u304D\uFF08draft\uFF09\u306E\u30CE\u30FC\u30C8\u306B\u306F\u30B3\u30E1\u30F3\u30C8\u3067\u304D\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u304C 422 \u3067\u65AD\u308A\u307E\u3059\uFF09\u3002`,flags:[...COMMENT_BODY_FLAGS,{name:"--anonymous",summary:"\u533F\u540D\u3067\u30B3\u30E1\u30F3\u30C8\u3059\u308B",takesValue:false}],async prepare(input){noteId(input,"twp note comment create");const content=await commentBody(input,COMMENT_CREATE_USAGE);if(content===void 0)throw new UsageError("\
|
|
53
|
+
\u30B3\u30E1\u30F3\u30C8\u306E\u672C\u6587\u3092 --body \u304B --body-file \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",COMMENT_CREATE_USAGE);return{...input,resolved:{...input.resolved,content}}},plan(input){const content=input.resolved?.["content"];if(content===void 0)throw new UsageError("\u30B3\u30E1\u30F3\u30C8\u306E\u672C\u6587\u3092 --body \u304B --body-file \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",COMMENT_CREATE_USAGE);return{method:"POST",path:`${notePath(noteId(
|
|
54
|
+
input,"twp note comment create"))}/comments`,body:{content,...input.flags.has("--anonymous")?{is_anonymous:true}:{}}}},summarize:body=>pick(commentFrom(body),NOTE_COMMENT_COLUMNS),raw:commentFrom};var commentUpdate={name:"update",summary:`${NOTE_LABEL}\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u66F8\u304D\u63DB\u3048\u308B`,usage:COMMENT_UPDATE_USAGE,description:"\u66F8\u304D\u63DB\u3048\u3089\u308C\u308B\u306E\u306F\u30B3\u30E1\u30F3\u30C8\u306E\u6295\u7A3F\u8005\u3067\u3059\uFF08\u6A29\u9650\u304C\u7121\u3051\u308C\u3070\u30B5\u30FC\u30D0\u306E 403 \u306E\u6587\u9762\u3092\u305D\u306E\u307E\u307E\u51FA\u3057\u307E\u3059\uFF09\u3002",
|
|
55
|
+
flags:[...COMMENT_BODY_FLAGS],async prepare(input){noteAndComment(input,"twp note comment update");const content=await commentBody(input,COMMENT_UPDATE_USAGE);if(content===void 0)throw new UsageError("\u30B3\u30E1\u30F3\u30C8\u306E\u672C\u6587\u3092 --body \u304B --body-file \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",COMMENT_UPDATE_USAGE);return{...input,resolved:{...input.resolved,content}}},plan(input){const{note,comment}=noteAndComment(input,"twp note comment update");const content=input.
|
|
56
|
+
resolved?.["content"];if(content===void 0)throw new UsageError("\u30B3\u30E1\u30F3\u30C8\u306E\u672C\u6587\u3092 --body \u304B --body-file \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",COMMENT_UPDATE_USAGE);return{method:"PUT",path:`${notePath(note)}/comments/${encodeURIComponent(comment)}`,body:{content}}},summarize:body=>pick(commentFrom(body),NOTE_COMMENT_COLUMNS),raw:commentFrom};var commentDelete={name:"delete",summary:`${NOTE_LABEL}\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\uFF09`,
|
|
57
|
+
usage:"twp note comment delete <\u30CE\u30FC\u30C8ID> <\u30B3\u30E1\u30F3\u30C8ID> --yes",description:"\u524A\u9664\u3067\u304D\u308B\u306E\u306F\u30B3\u30E1\u30F3\u30C8\u306E\u6295\u7A3F\u8005\u3068\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u3067\u3059\u3002",destructive:true,flags:[],plan(input){const{note,comment}=noteAndComment(input,"twp note comment delete");return{method:"DELETE",path:`${notePath(note)}/comments/${encodeURIComponent(comment)}`}},summarize:body=>acknowledgement(body,"\u30B3\u30E1\u30F3\u30C8\u306E\
|
|
58
|
+
\u524A\u9664"),raw:body=>acknowledgement(body,"\u30B3\u30E1\u30F3\u30C8\u306E\u524A\u9664")};var commentResource={name:"comment",summary:"\u30CE\u30FC\u30C8\u306E\u30B3\u30E1\u30F3\u30C8\uFF08\u4E00\u89A7\u30FB\u6295\u7A3F\u30FB\u66F8\u304D\u63DB\u3048\u30FB\u524A\u9664\uFF09",operations:[commentList,commentCreate,commentUpdate,commentDelete]};function favoriteAck(body,label){if(!isRecord(body)||body["message"]!=="success"){throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u304C\u60F3\u5B9A\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
|
|
59
|
+
return{result:true,message:"success"}}var FAVORITE_HELP="\u30B5\u30FC\u30D0\u306F\u30CE\u30FC\u30C8\u304C\u5B58\u5728\u3059\u308B\u304B\u3092\u78BA\u304B\u3081\u305A\u306B\u53D7\u3051\u4ED8\u3051\u307E\u3059\uFF08\u5B58\u5728\u3057\u306A\u3044 ID \u3067\u3082\u6210\u529F\u3057\u307E\u3059\uFF09\u3002ID \u306F twp note list \u306E id \u5217\u304B\u3089\u53D6\u3063\u3066\u304F\u3060\u3055\u3044\u3002";var favoriteAdd={name:"add",summary:`${NOTE_LABEL}\u3092\u304A\u6C17\u306B\u5165\u308A\u306B\u767B\u9332\u3059\u308B`,
|
|
60
|
+
usage:"twp note favorite add <\u30CE\u30FC\u30C8ID>",description:`${FAVORITE_HELP}
|
|
61
|
+
\u767B\u9332\u6E08\u307F\u306A\u3089\u4F55\u3082\u3057\u307E\u305B\u3093\u3002\u304A\u6C17\u306B\u5165\u308A\u306F twp note list --favorite \u3067\u4E00\u89A7\u3067\u304D\u307E\u3059\u3002`,flags:[],plan:input=>({method:"POST",path:`${notePath(noteId(input,"twp note favorite add"))}/favorite`}),summarize:body=>favoriteAck(body,"\u304A\u6C17\u306B\u5165\u308A\u306E\u767B\u9332"),raw:body=>favoriteAck(body,"\u304A\u6C17\u306B\u5165\u308A\u306E\u767B\u9332")};var favoriteRemove={name:"remove",summary:`${NOTE_LABEL}\
|
|
62
|
+
\u3092\u304A\u6C17\u306B\u5165\u308A\u304B\u3089\u5916\u3059`,usage:"twp note favorite remove <\u30CE\u30FC\u30C8ID>",description:`${FAVORITE_HELP}
|
|
63
|
+
\u767B\u9332\u3057\u3066\u3044\u306A\u304F\u3066\u3082\u6210\u529F\u3057\u307E\u3059\u3002`,flags:[],plan:input=>({method:"DELETE",path:`${notePath(noteId(input,"twp note favorite remove"))}/favorite`}),summarize:body=>favoriteAck(body,"\u304A\u6C17\u306B\u5165\u308A\u306E\u89E3\u9664"),raw:body=>favoriteAck(body,"\u304A\u6C17\u306B\u5165\u308A\u306E\u89E3\u9664")};function reactionSummary(body,label){if(!isRecord(body)||body["result"]!==true||typeof body["reacted"]!=="boolean"||typeof body["cou\
|
|
64
|
+
nt"]!=="number"){throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u304C\u60F3\u5B9A\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return body}var reactionList={name:"list",summary:`${NOTE_LABEL}\u306E\u3044\u3044\u306D\u306E\u6570\u3068\u3001\u3044\u3044\u306D\u3057\u305F\u4EBA\u3092\u8868\u793A\u3059\u308B`,usage:"twp note reaction list <\u30CE\u30FC\u30C8ID>",description:"reacted \u306F\u81EA\u5206\u304C\u3044\u3044\u306D\u3057\u3066\u3044\u308B\u304B\u3001us\
|
|
65
|
+
ers \u306F\u3044\u3044\u306D\u3057\u305F\u4EBA\u3067\u3059\uFF08\u533F\u540D\u306E\u6271\u3044\u306F\u30B5\u30FC\u30D0\u306E\u5224\u5B9A\uFF09\u3002",flags:[],plan:input=>({method:"GET",path:`${notePath(noteId(input,"twp note reaction list"))}/reactions`}),summarize:body=>pick(reactionSummary(body,"\u3044\u3044\u306D"),["count","reacted","users"]),raw:body=>reactionSummary(body,"\u3044\u3044\u306D")};var reactionToggle={name:"toggle",summary:`${NOTE_LABEL}\u306E\u3044\u3044\u306D\u3092\u4ED8\u3051\u308B\uFF0F\u5916\u3059\uFF08\u62BC\u3059\u305F\u3073\u306B\u53CD\u8EE2\uFF09`,
|
|
66
|
+
usage:"twp note reaction toggle <\u30CE\u30FC\u30C8ID>",description:"\u753B\u9762\u306E\u3044\u3044\u306D\u30DC\u30BF\u30F3\u3068\u540C\u3058\u304F\u3001\u62BC\u3059\u305F\u3073\u306B\u4ED8\u304F\uFF0F\u5916\u308C\u308B\u304C\u5165\u308C\u66FF\u308F\u308A\u307E\u3059\u3002\u7D50\u679C\u306E reacted \u304C\u64CD\u4F5C\u5F8C\u306E\u72B6\u614B\u3067\u3059\u3002\n\u4E0B\u66F8\u304D\uFF08draft\uFF09\u306E\u30CE\u30FC\u30C8\u306B\u306F\u3044\u3044\u306D\u3067\u304D\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u304C 422 \u3067\u65AD\u308A\u307E\u3059\uFF09\u3002",
|
|
67
|
+
flags:[],plan:input=>({method:"POST",path:`${notePath(noteId(input,"twp note reaction toggle"))}/reactions/toggle`}),summarize:body=>pick(reactionSummary(body,"\u3044\u3044\u306D"),["reacted","count"]),raw:body=>reactionSummary(body,"\u3044\u3044\u306D")};function tagRows(body){return arrayOf(body,"tags","\u30CE\u30FC\u30C8\u306E\u30BF\u30B0\u4E00\u89A7").map(tag=>isRecord(tag)?tag:{tag})}var tagList={name:"list",summary:"\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\u3067\u4F7F\u308F\u308C\u3066\u3044\u308B\u30BF\u30B0\u3092\u4E00\u89A7\u3059\u308B",
|
|
68
|
+
usage:"twp note tag list",flags:[],plan(input){noArgs(input,"twp note tag list");return{method:"GET",path:`${NOTES_PATH}/tags`}},summarize:tagRows,raw:tagRows};var categoryList={name:"list",summary:"\u30CE\u30FC\u30C8\u306E\u30AB\u30C6\u30B4\u30EA\u3092\u4E00\u89A7\u3059\u308B\uFF08twp note create / list \u306E --category \u306B\u4F7F\u3046 ID\uFF09",usage:"twp note category list",flags:[],plan(input){noArgs(input,"twp note category list");return{method:"GET",path:"/api/v2/note-categories"}},summarize:body=>arrayOf(
|
|
69
|
+
body,"items","\u30CE\u30FC\u30C8\u306E\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7").map(row=>pick(row,NOTE_CATEGORY_COLUMNS)),raw:body=>arrayOf(body,"items","\u30CE\u30FC\u30C8\u306E\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7")};var SUBSCRIPTIONS_PATH="/api/v2/note-subscriptions";var SUBSCRIPTION_ADMIN_HELP="\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u5B9F\u884C\u3067\u304D\u307E\u3059\uFF08\u6A29\u9650\u304C\u7121\u3051\u308C\u3070\u30B5\u30FC\u30D0\u306E 403 \u306E\u6587\u9762\u3092\u305D\u306E\u307E\u307E\u51FA\u3057\u307E\u3059\uFF09\u3002";
|
|
70
|
+
function tenantArg(input,command){const[raw,...rest]=input.args;const id=raw?.trim()??"";if(id==="")throw new UsageError("\u30C6\u30CA\u30F3\u30C8\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",`${command} <\u30C6\u30CA\u30F3\u30C8ID>\uFF08twp note subscription available \u306E tenant_id \u5217\uFF09`);if(rest.length>0)throw new UsageError(`${command} \u304C\u53D7\u3051\u53D6\u308C\u308B\u30C6\u30CA\u30F3\u30C8 ID \u306F1\u3064\u3060\u3051\u3067\u3059: ${rest.join(" ")}`,`${command}\
|
|
71
|
+
help`);if(!isSafePathSegment(id))throw new UsageError(`\u30C6\u30CA\u30F3\u30C8\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${id}`,"twp note subscription available \u306E tenant_id \u5217\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002");return id}var subscriptionList={name:"list",summary:"\u8CFC\u8AAD\u3057\u3066\u3044\u308B\u4ED6\u30C6\u30CA\u30F3\u30C8\u3092\u4E00\u89A7\u3059\u308B",usage:"twp note subscription list",description:"\u8CFC\u8AAD\u5148\u306E\u30CE\u30FC\u30C8\u306F twp note list --subscribed\
|
|
72
|
+
\u3067\u8AAD\u3081\u307E\u3059\u3002",flags:[],plan(input){noArgs(input,"twp note subscription list");return{method:"GET",path:SUBSCRIPTIONS_PATH}},summarize:body=>arrayOf(body,"subscriptions","\u8CFC\u8AAD\u4E00\u89A7").map(row=>pick(row,NOTE_SUBSCRIPTION_COLUMNS)),raw:body=>arrayOf(body,"subscriptions","\u8CFC\u8AAD\u4E00\u89A7")};var subscriptionAvailable={name:"available",summary:"\u8CFC\u8AAD\u3067\u304D\u308B\u4ED6\u30C6\u30CA\u30F3\u30C8\uFF08\u516C\u958B\u30CE\u30FC\u30C8\u306E\u4EF6\u6570\u3064\u304D\uFF09\u3092\u4E00\u89A7\u3059\u308B",
|
|
73
|
+
usage:"twp note subscription available",description:SUBSCRIPTION_ADMIN_HELP,flags:[],plan(input){noArgs(input,"twp note subscription available");return{method:"GET",path:`${SUBSCRIPTIONS_PATH}/available`}},summarize:body=>arrayOf(body,"tenants","\u8CFC\u8AAD\u3067\u304D\u308B\u30C6\u30CA\u30F3\u30C8\u4E00\u89A7").map(row=>pick(row,NOTE_AVAILABLE_COLUMNS)),raw:body=>arrayOf(body,"tenants","\u8CFC\u8AAD\u3067\u304D\u308B\u30C6\u30CA\u30F3\u30C8\u4E00\u89A7")};function subscriptionFrom(body){const row=isRecord(
|
|
74
|
+
body)&&body["result"]===true?body["subscription"]:void 0;if(!isRecord(row)||typeof row["target_tenant_id"]!=="string"){throw new ApiResponseError("\u8CFC\u8AAD\u306E\u5FDC\u7B54\u306B subscription \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return row}var subscriptionAdd={name:"add",summary:"\u4ED6\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\u3092\u8CFC\u8AAD\u3059\u308B",usage:"twp note subscription add <\u30C6\u30CA\u30F3\u30C8ID>",
|
|
75
|
+
description:`${SUBSCRIPTION_ADMIN_HELP}
|
|
76
|
+
\u81EA\u30C6\u30CA\u30F3\u30C8\u30FB\u8CFC\u8AAD\u6E08\u307F\u306E\u30C6\u30CA\u30F3\u30C8\u306F\u30B5\u30FC\u30D0\u304C\u65AD\u308A\u307E\u3059\u3002`,flags:[],plan:input=>({method:"POST",path:SUBSCRIPTIONS_PATH,body:{target_tenant_id:tenantArg(input,"twp note subscription add")}}),summarize:body=>pick(subscriptionFrom(body),NOTE_SUBSCRIPTION_COLUMNS),raw:subscriptionFrom};var subscriptionRemove={name:"remove",summary:"\u4ED6\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\u306E\u8CFC\u8AAD\u3092\u3084\u3081\u308B\uFF08--yes \u304C\u8981\u308B\uFF09",
|
|
77
|
+
usage:"twp note subscription remove <\u30C6\u30CA\u30F3\u30C8ID> --yes",description:`${SUBSCRIPTION_ADMIN_HELP}
|
|
78
|
+
\u30C6\u30CA\u30F3\u30C8\u5168\u4F53\u306E\u8CFC\u8AAD\u304C\u5916\u308C\u3001\u5168\u54E1\u306E twp note list --subscribed \u304B\u3089\u6D88\u3048\u307E\u3059\u3002`,destructive:true,flags:[],plan:input=>({method:"DELETE",path:`${SUBSCRIPTIONS_PATH}/${encodeURIComponent(tenantArg(input,"twp note subscription remove"))}`}),summarize:body=>acknowledgement(body,"\u8CFC\u8AAD\u306E\u89E3\u9664"),raw:body=>acknowledgement(body,"\u8CFC\u8AAD\u306E\u89E3\u9664")};var thumbnailRegenerate={name:"regene\
|
|
79
|
+
rate",summary:`${NOTE_LABEL}\u306E\u30B5\u30E0\u30CD\u30A4\u30EB\uFF08AI \u753B\u50CF\uFF09\u3092\u4F5C\u308A\u76F4\u3059`,usage:"twp note thumbnail regenerate <\u30CE\u30FC\u30C8ID> --yes",description:"\u4F5C\u308A\u76F4\u3057\u3092\u4F9D\u983C\u3059\u308B\u3060\u3051\u3067\u3001\u753B\u50CF\u306F\u5F8C\u304B\u3089\u5DEE\u3057\u66FF\u308F\u308A\u307E\u3059\uFF08\u975E\u540C\u671F\uFF09\u3002AI \u753B\u50CF\u306E\u751F\u6210\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u30AF\u30EC\u30B8\u30C3\u30C8\u3092\u6D88\u8CBB\u3059\u308B\u305F\u3081 --yes \u304C\u8981\u308A\u307E\u3059\n\uFF08--dry-run \u306F\u9001\u308B\u30EA\u30AF\u30A8\u30B9\u30C8\u3060\u3051\u3092\u8868\u793A\u3057\u3001\u6D88\u8CBB\u3057\u307E\u305B\u3093\uFF09\u3002\u5B9F\u884C\u3067\u304D\u308B\u306E\u306F\u4F5C\u6210\u8005\u3068\u30CE\u30FC\u30C8\u306E\u7BA1\u7406\u8005\u3067\u3059\u3002",
|
|
80
|
+
destructive:true,confirmation:"AI \u30AF\u30EC\u30B8\u30C3\u30C8\u3092\u6D88\u8CBB\u3059\u308B\u64CD\u4F5C",flags:[],plan:input=>({method:"POST",path:`${notePath(noteId(input,"twp note thumbnail regenerate <\u30CE\u30FC\u30C8ID> --yes"))}/regenerate-thumbnail`}),summarize:body=>acknowledgement(body,"\u30B5\u30E0\u30CD\u30A4\u30EB\u306E\u518D\u751F\u6210"),raw:body=>acknowledgement(body,"\u30B5\u30E0\u30CD\u30A4\u30EB\u306E\u518D\u751F\u6210")};var noteDomain={name:"note",summary:"\u30CE\u30FC\u30C8\uFF08\u4E00\u89A7\u30FB\u672C\u6587\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\
|
|
81
|
+
\u30FB\u524A\u9664\u30FB\u30B3\u30E1\u30F3\u30C8\u30FB\u304A\u6C17\u306B\u5165\u308A\u30FB\u3044\u3044\u306D\u30FB\u30BF\u30B0\u30FB\u30AB\u30C6\u30B4\u30EA\u30FB\u8CFC\u8AAD\u30FB\u30B5\u30E0\u30CD\u30A4\u30EB\uFF09",operations:[noteList,noteGet,noteCreate,noteUpdate,noteDelete],subresources:[commentResource,{name:"favorite",summary:"\u304A\u6C17\u306B\u5165\u308A\uFF08\u767B\u9332\u30FB\u89E3\u9664\uFF09",operations:[favoriteAdd,favoriteRemove]},{name:"reaction",summary:"\u3044\u3044\u306D\uFF08\u8868\u793A\u30FB\u4ED8\u3051\u308B\uFF0F\u5916\u3059\uFF09",
|
|
82
|
+
operations:[reactionList,reactionToggle]},{name:"tag",summary:"\u30BF\u30B0\u306E\u4E00\u89A7",operations:[tagList]},{name:"category",summary:"\u30AB\u30C6\u30B4\u30EA\u306E\u4E00\u89A7",operations:[categoryList]},{name:"subscription",summary:"\u4ED6\u30C6\u30CA\u30F3\u30C8\u306E\u30CE\u30FC\u30C8\u306E\u8CFC\u8AAD\uFF08\u4E00\u89A7\u30FB\u8CFC\u8AAD\u3067\u304D\u308B\u5148\u30FB\u8CFC\u8AAD\u30FB\u89E3\u9664\uFF09",operations:[subscriptionList,subscriptionAvailable,subscriptionAdd,subscriptionRemove]},
|
|
83
|
+
{name:"thumbnail",summary:"\u30B5\u30E0\u30CD\u30A4\u30EB\uFF08AI \u753B\u50CF\u306E\u4F5C\u308A\u76F4\u3057\uFF09",operations:[thumbnailRegenerate]}]};export{noteDomain};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{NO_PLAN_SESSION,PLAN_DIR_ENV,PLAN_TOKEN_ENV,checkPlan,fileSkillNames,formatCheck,openPlanSession,runPlanSubmit}from"./chunk-
|
|
3
|
+
import{NO_PLAN_SESSION,PLAN_DIR_ENV,PLAN_TOKEN_ENV,checkPlan,fileSkillNames,formatCheck,openPlanSession,runPlanSubmit}from"./chunk-2LFYNWTT.js";import"./chunk-YAN3G35K.js";import"./chunk-VEEZJNOB.js";import"./chunk-7QHDTO2Z.js";import"./chunk-DWW7EKJD.js";import"./chunk-VYDPW2YO.js";import"./chunk-TTST7UDR.js";import"./chunk-ZFSWQQH3.js";import"./chunk-6CS5L24D.js";import"./chunk-N2UVRM3Z.js";import"./chunk-GYX2ZXQM.js";import"./chunk-RMFLTSOV.js";
|
|
4
4
|
import"./chunk-BD7O73GK.js";import"./chunk-SBRTBKEZ.js";import"./chunk-PMOUHEJQ.js";import"./chunk-J7QYPKVK.js";import"./chunk-5WGOHFAS.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{NO_PLAN_SESSION,PLAN_DIR_ENV,PLAN_TOKEN_ENV,checkPlan,fileSkillNames,formatCheck,openPlanSession,runPlanSubmit};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{loadDomain}from"./chunk-
|
|
3
|
+
import{loadDomain}from"./chunk-WDE24TCO.js";import"./chunk-VSJBJXZO.js";export{loadDomain};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{CURATED_PAGING_VOCABULARY,buildPrepareContext,checkOutTarget,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain}from"./chunk-
|
|
3
|
+
import{CURATED_PAGING_VOCABULARY,buildPrepareContext,checkOutTarget,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain}from"./chunk-37G5JJIY.js";import"./chunk-WDE24TCO.js";import"./chunk-F5QDUPQO.js";import"./chunk-P4QSPSOQ.js";import"./chunk-Q3B65OFC.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-VGT2EGH6.js";import"./chunk-QV4K6V2L.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";
|
|
4
4
|
import"./chunk-HVZUXLQ4.js";import"./chunk-MMVXE2CJ.js";import"./chunk-SBRTBKEZ.js";import"./chunk-MI6HVYR2.js";import"./chunk-3ZRMMBP5.js";import"./chunk-VFPY2A23.js";import"./chunk-KIZIRVW6.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-KD4YXQOZ.js";import"./chunk-OKATZ4SN.js";import"./chunk-RKBUJKI5.js";import"./chunk-UREA4ZIG.js";
|
|
5
5
|
import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{CURATED_PAGING_VOCABULARY,buildPrepareContext,checkOutTarget,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain};
|
|
@@ -46,8 +46,8 @@ ine"&&Number.isFinite(fetchedAt)&&Date.now()-fetchedAt<2*60*1e3){notes.push("\u2
|
|
|
46
46
|
return notes}};var POST_USAGE="twp sns post --channel x [--account <ID|@\u540D\u524D>] (--text <\u6587\u5B57\u5217> | --text-file <\u30D1\u30B9>) [--thread <\u6587\u5B57\u5217> \u2026 | --thread-file <\u30D1\u30B9> \u2026] [--media <\u753B\u50CF> \u2026] [--at <\u65E5\u6642>] --yes";function parseAt(raw,now=new Date){const m=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?(Z|[+-]\d{2}:\d{2})?$/.exec(raw.trim());const bad=()=>{throw new UsageError(`--at \u306F YYYY-MM-DDTHH:MM\uFF08\u65E5\u672C\u6642\u9593\uFF09\u304B\u3001\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\u4ED8\u304D\
|
|
47
47
|
\u306E\u65E5\u6642\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${raw}\uFF09`,"\u4F8B: --at 2026-11-04T09:30 \uFF0F --at 2026-11-04T00:30Z")};if(m===null)return bad();const[,y,mo,d,h,mi,s="00",zone]=m;const parts=[Number(y),Number(mo),Number(d),Number(h),Number(mi),Number(s)];const check=new Date(Date.UTC(parts[0],parts[1]-1,parts[2],parts[3],parts[4],parts[5]));if(check.getUTCFullYear()!==parts[0]||check.getUTCMonth()!==parts[1]-1||check.getUTCDate()!==
|
|
48
48
|
parts[2]||check.getUTCHours()!==parts[3]||check.getUTCMinutes()!==parts[4]||check.getUTCSeconds()!==parts[5]){return bad()}const offset=zone??"+09:00";const iso=`${y}-${mo}-${d}T${h}:${mi}:${s}${offset==="Z"?"Z":offset}`;const at=new Date(iso);if(Number.isNaN(at.getTime()))return bad();if(at.getTime()<=now.getTime()){throw new UsageError(`--at \u306E\u65E5\u6642\uFF08${iso}\uFF09\u304C\u904E\u304E\u3066\u3044\u307E\u3059\u3002\u4E88\u7D04\u306F\u73FE\u5728\u3088\u308A\u5F8C\u306E\u65E5\u6642\u306B\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
49
|
-
POST_USAGE)}return{iso,assumedJst:zone===void 0}}function mediaFiles(input){const raws=repeatedValues(input,"--media");if(raws.length>X_MAX_IMAGES)throw new UsageError(`X \u306B\u4ED8\u3051\u3089\u308C\u308B\u753B\u50CF\u306F ${X_MAX_IMAGES} \u679A\u307E\u3067\u3067\u3059\uFF08${raws.length} \u679A\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\uFF09`,
|
|
50
|
-
name);if(!X_IMAGE_TYPES.includes(contentType)){throw new UsageError(`X \u306B\u306F\u753B\u50CF\uFF08JPEG\u30FBPNG\u30FBWEBP\u30FBGIF\uFF09\u3060\u3051\u3092\u4ED8\u3051\u3089\u308C\u307E\u3059: ${file}`,
|
|
49
|
+
POST_USAGE)}return{iso,assumedJst:zone===void 0}}function mediaFiles(input,usage=POST_USAGE){const raws=repeatedValues(input,"--media");if(raws.length>X_MAX_IMAGES)throw new UsageError(`X \u306B\u4ED8\u3051\u3089\u308C\u308B\u753B\u50CF\u306F ${X_MAX_IMAGES} \u679A\u307E\u3067\u3067\u3059\uFF08${raws.length} \u679A\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\uFF09`,usage);return raws.map(raw=>{const{file,size}=inspectLocalFile(raw,"--media",usage);const name=path.basename(file);const contentType=contentTypeFor(
|
|
50
|
+
name);if(!X_IMAGE_TYPES.includes(contentType)){throw new UsageError(`X \u306B\u306F\u753B\u50CF\uFF08JPEG\u30FBPNG\u30FBWEBP\u30FBGIF\uFF09\u3060\u3051\u3092\u4ED8\u3051\u3089\u308C\u307E\u3059: ${file}`,usage)}const max=contentType==="image/gif"?X_MAX_GIF_BYTES:X_MAX_IMAGE_BYTES;if(size>max)throw new UsageError(`\u753B\u50CF\u304C\u5927\u304D\u3059\u304E\u307E\u3059\uFF08${contentType==="image/gif"?"GIF \u306F 15MB":"5MB"}\u307E\u3067\uFF09: ${file}`,usage);return{file,name,size,contentType}})}
|
|
51
51
|
async function readText(input,usage,required){const text=await readBody(input,{flag:"--text",fileFlag:"--text-file",label:"\u672C\u6587",maxChars:BODY_MAX_CHARS,usage});if(required&&(text===void 0||text.trim()===""))throw new UsageError("\u672C\u6587\uFF08--text \u304B --text-file\uFF09\u304B\u753B\u50CF\uFF08--media\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);return text}async function readThread(input){const inline=repeatedValues(input,THREAD_FLAG.name);const files=repeatedValues(
|
|
52
52
|
input,THREAD_FILE_FLAG.name);if(inline.length>0&&files.length>0){throw new UsageError("--thread \u3068 --thread-file \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\uFF08\u4EF6\u306E\u9806\u5E8F\u304C\u6C7A\u307E\u3089\u306A\u3044\u305F\u3081\uFF09",POST_USAGE)}const[flag,values]=inline.length>0?[THREAD_FLAG.name,inline]:[THREAD_FILE_FLAG.name,files];const parts=[];for(const[i,value]of values.entries()){if(flag===THREAD_FILE_FLAG.name&&value==="-"){throw new UsageError("--thre\
|
|
53
53
|
ad-file \u306B\u6A19\u6E96\u5165\u529B\uFF08-\uFF09\u306F\u4F7F\u3048\u307E\u305B\u3093\u3002\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",POST_USAGE)}const flags=new Map([...input.flags].filter(([name])=>name!=="--text"&&name!=="--text-file"));flags.set(flag,value);const text=await readBody({args:[],flags},{flag:THREAD_FLAG.name,fileFlag:THREAD_FILE_FLAG.name,label:`\u30B9\u30EC\u30C3\u30C9\u306E${i+2}\u4EF6\u76EE`,maxChars:BODY_MAX_CHARS,usage:POST_USAGE});
|
|
@@ -85,11 +85,36 @@ DELETE_USAGE)}if(input.flags.has("--account"))throw new UsageError("TWP \u306E\u
|
|
|
85
85
|
DELETE_USAGE)}if(post["status"]==="published"){const external=str(post["external_post_id"]);throw new UsageError(`\u6295\u7A3F ${ref} \u306F\u6295\u7A3F\u6E08\u307F\u306E\u305F\u3081 TWP \u5074\u3067\u306F\u6D88\u305B\u307E\u305B\u3093`,external!==null&&TWEET_ID.test(external)?`X \u4E0A\u306E\u6295\u7A3F\u3092\u6D88\u3059\u306A\u3089: twp sns delete --channel ${channel} ${external} --yes`:"X \u4E0A\u306E\u6295\u7A3F\u306F twp sns list --channel x \u306E id\uFF08\u6570\u5B57\uFF09\u3067\u6D88\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
86
86
|
return withResolved(input,{kind:"post",id:ref,channel,status:String(post["status_label"]??post["status"]??""),body:oneLine(String(post["body"]??"")),updatedAt:String(post["updated_at"]??"")})},plan(input){const id=requireResolved(input,"id");if(requireResolved(input,"kind")==="tweet"){return{method:"DELETE",path:`${X_PATH}/connections/${segment(requireResolved(input,"connectionId"),"\u9023\u643AID")}/tweets/${segment(id,"\u6295\u7A3FID")}`}}return{method:"DELETE",path:`${POSTS_PATH}/${segment(id,
|
|
87
87
|
"\u6295\u7A3FID")}`,body:{expected_updated_at:requireResolved(input,"updatedAt")}}},plannedNotes(input){if(requireResolved(input,"kind")==="tweet")return[`${accountNote(input)} / X \u306E\u6295\u7A3F ${requireResolved(input,"id")} \u3092\u524A\u9664\u3057\u307E\u3059\u3002`];return[`TWP \u306E\u6295\u7A3F\uFF08${requireResolved(input,"status")}\uFF09\u300C${input.resolved?.["body"]??""}\u300D\u3092\u524A\u9664\u3057\u307E\u3059\u3002`]},async preview(input,ctx){if(requireResolved(input,"kind")!==
|
|
88
|
-
"tweet")return{notes:[],warnings:[]};const price=await xPricing(ctx);return{notes:[`X \u306E\u6295\u7A3F\u306E\u524A\u9664\u3067 ${credits(price.delete)} \u3092\u6D88\u8CBB\u3057\u307E\u3059\u3002`],warnings:[]}},summarize:body=>({deleted:isRecord(body)&&body["result"]===true}),raw:body=>body,notes:()=>["\u524A\u9664\u3057\u307E\u3057\u305F\u3002"]};var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
"tweet")return{notes:[],warnings:[]};const price=await xPricing(ctx);return{notes:[`X \u306E\u6295\u7A3F\u306E\u524A\u9664\u3067 ${credits(price.delete)} \u3092\u6D88\u8CBB\u3057\u307E\u3059\u3002`],warnings:[]}},summarize:body=>({deleted:isRecord(body)&&body["result"]===true}),raw:body=>body,notes:()=>["\u524A\u9664\u3057\u307E\u3057\u305F\u3002"]};var EDIT_USAGE="twp sns edit --channel <\u30C1\u30E3\u30CD\u30EB> <UUID> [--text <\u6587\u5B57\u5217> | --text-file <\u30D1\u30B9>] [--media <\u753B\u50CF> \u2026 | --clear-media] --yes";
|
|
89
|
+
var EDITABLE_STATUSES=["draft","scheduled"];var STATUS_LABELS={draft:"\u4E0B\u66F8\u304D",scheduled:"\u4E88\u7D04\u4E2D",publishing:"\u6295\u7A3F\u51E6\u7406\u4E2D",published:"\u6295\u7A3F\u6E08\u307F",failed:"\u5931\u6557"};function conflictMessage(error,bodyDone,channel){const reason=isRecord(error.body)&&typeof error.body["message"]==="string"?error.body["message"]:"\u6295\u7A3F\u304C\u4ED6\u306E\u64CD\u4F5C\u3067\u66F4\u65B0\u3055\u308C\u3066\u3044\u307E\u3059\u3002";return new ApiRejectedError(
|
|
90
|
+
`\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${reason.replace(/画面を再読み込みしてから操作してください。?/,"").trim().replace(/。$/,"")||"\u6295\u7A3F\u306E\u72B6\u614B\u304C\u5909\u308F\u308A\u307E\u3057\u305F"}\uFF09\u3002${bodyDone?"\u672C\u6587\u306F\u66F4\u65B0\u3057\u307E\u3057\u305F\u304C\u3001\u753B\u50CF\u306F\u4ED8\u3051\u66FF\u3048\u3066\u3044\u307E\u305B\u3093\u3002":"\u4E0A\u66F8\u304D\u306F\u3057\u3066\u3044\u307E\u305B\u3093\u3002"}twp \
|
|
91
|
+
sns list --channel ${channel} --status all \u3067\u6700\u65B0\u306E\u5185\u5BB9\u3092\u78BA\u304B\u3081\u3066\u304B\u3089\u6253\u3061\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}function editChanges(input){const rawText=input.resolved?.["text"];const rawMedia=input.resolved?.["media"];return{...rawText!==void 0&&rawText!==input.resolved?.["oldBody"]?{text:JSON.parse(rawText)}:{},...rawMedia!==void 0?{media:JSON.parse(rawMedia)}:{},clearMedia:input.resolved?.["clearMedia"]==="1"}}function editPath(input,suffix=""){
|
|
92
|
+
return`${POSTS_PATH}/${segment(requireResolved(input,"id"),"\u6295\u7A3FID")}${suffix}`}function uploadPlan(m){return{method:"POST",path:"/api/v2/sns/media/upload-url",body:{file_name:m.name,content_type:m.contentType,file_size:m.size}}}function patchPlan(input,text,version){return{method:"PATCH",path:editPath(input),body:{body:text,expected_updated_at:version}}}function editPlan(input){const{text,media}=editChanges(input);if(media!==void 0&&media.length>0)return uploadPlan(media[0]);if(text!==void 0)
|
|
93
|
+
return patchPlan(input,text,requireResolved(input,"updatedAt"));return{method:"PUT",path:editPath(input,"/media"),body:{attachment_ids:[],expected_updated_at:requireResolved(input,"updatedAt")}}}var editOperation={name:"edit",summary:"TWP \u306E\u4E0B\u66F8\u304D\u30FB\u4E88\u7D04\u4E2D\u306E\u6295\u7A3F\u306E\u672C\u6587\u30FB\u753B\u50CF\u3092\u7DE8\u96C6\u3059\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09",usage:EDIT_USAGE,description:"twp sns list --channel x --status draft|scheduled \u306E id\uFF08UUID\uFF09\u3092\
|
|
94
|
+
\u6E21\u3057\u307E\u3059\u3002\u7DE8\u96C6\u3067\u304D\u308B\u306E\u306F\u4E0B\u66F8\u304D\u3068\u4E88\u7D04\u4E2D\u3060\u3051\u3067\u3059\n\uFF08\u6295\u7A3F\u6E08\u307F\u306E X \u306E\u6295\u7A3F\u306F X \u306B\u7DE8\u96C6\u306E API \u304C\u7121\u3044\u305F\u3081\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093\uFF09\u3002\u4E88\u7D04\u65E5\u6642\u306F\u5909\u308F\u308A\u307E\u305B\u3093\u3002\n\n --text / --text-file \u672C\u6587\u3092\u7F6E\u304D\u63DB\u3048\u308B\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09\n --media <\u753B\u50CF> \u753B\u50CF\u3092\u7F6E\u304D\u63DB\u3048\u308B\uFF08\u7E70\u308A\u8FD4\u3057\u30674\u679A\u307E\u3067\u3002\u3044\u307E\u4ED8\u3044\u3066\u3044\u308B\u753B\u50CF\u306F\u5916\u308C\u307E\u3059\uFF09\n --clear-media \u753B\u50CF\u3092\u3059\u3079\u3066\u5916\u3059\n\u753B\u50CF\u306F X \u306E\u6295\u7A3F\u3067\u3060\u3051\u5DEE\u3057\u66FF\u3048\u3089\u308C\u307E\u3059\uFF08JPEG\u30FBPNG\u30FBWEBP\u30FBGIF\uFF09\u3002\u30B9\u30EC\u30C3\u30C9\u306E\u7D9A\u304D\uFF082\u4EF6\u76EE\u4EE5\u964D\uFF09\u306F\u5909\u3048\u307E\u305B\u3093\u3002\n\n\u26A0 \u4E88\u7D04\u4E2D\u306E\u6295\u7A3F\u306F\u3001\u4E88\u7D04\u306E\u6642\u523B\u306B\u3053\u306E\u5185\u5BB9\u3067\u516C\u958B\u3055\u308C\u307E\u3059\u3002\u9001\u308B\u524D\u306B\u5909\u66F4\u524D\u5F8C\u306E\u672C\u6587\u3068\u753B\u50CF\u306E\u679A\u6570\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n --dry-run \u3067\u9001\u308B\u306F\u305A\u306E\u5185\u5BB9\u3092\u78BA\u304B\u3081\u3066\u304B\u3089 --yes \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\uFF08--dry-run \u3067\u3082\u6295\u7A3F\u306E\u53D6\u5F97\u306E\u305F\u3081 GET \u30921\u672C\u9001\u308A\u307E\u3059\uFF09\u3002\n\u53D6\u5F97\u3057\u3066\u304B\u3089\u9001\u308B\u307E\u3067\u306B\u753B\u9762\u306A\u3069\u4ED6\u3067\u66F4\u65B0\u3055\u308C\u3066\u3044\u305F\u3089\u3001\u4E0A\u66F8\u304D\u305B\u305A\u306B\u6B62\u3081\u307E\u3059\uFF08\u7D42\u4E86\u30B3\u30FC\u30C9 3\uFF09\u3002",
|
|
95
|
+
destructive:true,confirmation:"\u6295\u7A3F\u306E\u5185\u5BB9\u3092\u66F8\u304D\u63DB\u3048\u308B\u64CD\u4F5C\uFF08\u4E88\u7D04\u4E2D\u306A\u3089\u4E88\u7D04\u306E\u6642\u523B\u306B\u3053\u306E\u5185\u5BB9\u3067\u516C\u958B\u3055\u308C\u307E\u3059\uFF09",flags:[CHANNEL_FLAG,{name:"--id",summary:"\u6295\u7A3FID\uFF08\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF09",takesValue:true,placeholder:"<UUID>"},TEXT_FLAG,TEXT_FILE_FLAG,{name:"--media",summary:"\u7F6E\u304D\u63DB\u3048\u308B\u753B\u50CF\u306E\u30D1\u30B9\uFF08\u7E70\u308A\u8FD4\u3057\u30674\u679A\u307E\u3067\uFF09",
|
|
96
|
+
takesValue:true,placeholder:"<\u30D1\u30B9>",repeatable:true},{name:"--clear-media",summary:"\u753B\u50CF\u3092\u3059\u3079\u3066\u5916\u3059",takesValue:false}],async prepare(input,ctx){const ref=singleRef(input,{flag:"--id",label:"\u6295\u7A3FID",usage:EDIT_USAGE});if(!UUID.test(ref)){throw new UsageError(`\u6295\u7A3FID ${ref} \u306F TWP \u306E\u6295\u7A3FID\uFF08UUID\uFF09\u3067\u306F\u3042\u308A\u307E\u305B\u3093`,TWEET_ID.test(ref)?"\u6295\u7A3F\u6E08\u307F\u306E X \u306E\u6295\u7A3F\u306F\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093\uFF08X \u306B\u7DE8\u96C6\u306E API \u304C\u3042\u308A\u307E\u305B\u3093\uFF09\u3002":
|
|
97
|
+
EDIT_USAGE)}const channel=oneChannel(input,EDIT_USAGE,DRAFT_CHANNELS);const clearMedia=input.flags.has("--clear-media");const mediaGiven=repeatedValues(input,"--media").length>0;if(clearMedia&&mediaGiven)throw new UsageError("--media \u3068 --clear-media \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093",EDIT_USAGE);if((clearMedia||mediaGiven)&&!POSTABLE_CHANNELS.includes(channel)){throw new UsageError(`${channelName(channel)} \u306E\u6295\u7A3F\u306E\u753B\u50CF\u306F twp sns \u3067\u306F\u307E\u3060\u5DEE\u3057\u66FF\u3048\u3089\u308C\u307E\u305B\u3093\uFF08\u3044\u307E\u306F ${POSTABLE_CHANNELS.
|
|
98
|
+
map(channelName).join("\u30FB")} \u3060\u3051\u3067\u3059\uFF09`,EDIT_USAGE)}const media=mediaGiven?mediaFiles(input,EDIT_USAGE):void 0;const text=await readText(input,EDIT_USAGE,false);if(text===void 0&&!mediaGiven&&!clearMedia){throw new UsageError("\u5909\u3048\u308B\u5185\u5BB9\uFF08--text / --text-file / --media / --clear-media\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",EDIT_USAGE)}const post=await ctx.resolver.snsJson(`${POSTS_PATH}/${encodeURIComponent(ref)}`,"SNS\u6295\u7A3F");
|
|
99
|
+
if(post["channel"]!==channel){throw new UsageError(`\u6295\u7A3F ${ref} \u306F ${channelName(String(post["channel"]??""))} \u306E\u6295\u7A3F\u3067\u3059\uFF08--channel ${channel} \u3068\u9055\u3044\u307E\u3059\uFF09`,EDIT_USAGE)}const status=String(post["status"]??"");if(!EDITABLE_STATUSES.includes(status)){throw new UsageError(`\u6295\u7A3F ${ref} \u306F\u300C${STATUS_LABELS[status]??status}\u300D\u306E\u305F\u3081\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093\uFF08\u7DE8\u96C6\u3067\u304D\u308B\u306E\u306F\u4E0B\u66F8\u304D\u3068\u4E88\u7D04\u4E2D\u3060\u3051\u3067\u3059\uFF09`,
|
|
100
|
+
status==="published"?"X \u306B\u51FA\u305F\u6295\u7A3F\u306F\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093\uFF08X \u306B\u7DE8\u96C6\u306E API \u304C\u3042\u308A\u307E\u305B\u3093\uFF09\u3002\u76F4\u3059\u306A\u3089\u524A\u9664\u3057\u3066\u6295\u7A3F\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002":"\u5185\u5BB9\u3092\u5909\u3048\u308B\u306A\u3089\u3001\u524A\u9664\u3057\u3066\u4F5C\u308A\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp sns delete / twp sns post\uFF09\u3002")}const updatedAt=str(
|
|
101
|
+
post["updated_at"]);if(updatedAt===null)throw new ApiResponseError("SNS\u6295\u7A3F\u306E\u5FDC\u7B54\u306B updated_at \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");const oldBody=String(post["body"]??"");const oldMedia=Array.isArray(post["media_attachment_ids"])?post["media_attachment_ids"].length:0;if(text===oldBody&&!mediaGiven&&!clearMedia){throw new UsageError("\u672C\u6587\u304C\u3044\u307E\u3068\u540C\u3058\u3067\u3001\u307B\u304B\u306B\u5909\u3048\u308B\u5185\u5BB9\u304C\u3042\u308A\u307E\u305B\u3093\uFF08\u4F55\u3082\u9001\u308A\u307E\u305B\u3093\uFF09",
|
|
102
|
+
EDIT_USAGE)}const nextMedia=media!==void 0?media.length:clearMedia?0:oldMedia;if(status==="scheduled"&&(text??oldBody).trim()===""&&nextMedia===0){throw new UsageError("\u4E88\u7D04\u4E2D\u306E\u6295\u7A3F\u306E\u672C\u6587\u3068\u753B\u50CF\u3092\u4E21\u65B9\u3068\u3082\u7A7A\u306B\u306F\u3067\u304D\u307E\u305B\u3093\uFF08\u4E88\u7D04\u306E\u6642\u523B\u306B\u516C\u958B\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\uFF09","\u5916\u3059\u306A\u3089\u4E88\u7D04\u3092\u53D6\u308A\u6D88\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp sns delete\uFF09\u3002")}
|
|
103
|
+
return withResolved(input,{id:ref,channel,status,updatedAt,scheduledAt:String(post["scheduled_at"]??""),oldBody:JSON.stringify(oldBody),oldMedia:String(oldMedia),threadParts:String(Array.isArray(post["thread_bodies"])?post["thread_bodies"].length:0),...text!==void 0?{text:JSON.stringify(text)}:{},...media!==void 0?{media:JSON.stringify(media)}:{},clearMedia:clearMedia?"1":"0"})},plan:editPlan,plannedNotes(input){const{text,media,clearMedia}=editChanges(input);const status=requireResolved(input,"\
|
|
104
|
+
status");const oldBody=JSON.parse(requireResolved(input,"oldBody"));const oldMedia=Number(requireResolved(input,"oldMedia"));const notes=[`\u5BFE\u8C61: ${channelName(requireResolved(input,"channel"))} \u306E${STATUS_LABELS[status]??status}\uFF08${requireResolved(input,"id")}\uFF09`+(status==="scheduled"?` / \u4E88\u7D04: ${input.resolved?.["scheduledAt"]??""}\uFF08\u5909\u3048\u307E\u305B\u3093\uFF09`:"")];if(text===void 0)notes.push(`\u672C\u6587: \u5909\u3048\u307E\u305B\u3093\u30FB\u9001\u308A\u307E\u305B\u3093\uFF08${charCount(
|
|
105
|
+
oldBody)} \u6587\u5B57\u300C${oneLine(oldBody)}\u300D\uFF09`);else notes.push(`\u672C\u6587: ${charCount(oldBody)} \u6587\u5B57\u300C${oneLine(oldBody)}\u300D \u2192 ${charCount(text)} \u6587\u5B57\u300C${oneLine(text)}\u300D`);if(media!==void 0)notes.push(`\u753B\u50CF: ${oldMedia} \u679A \u2192 ${media.length} \u679A\uFF08${media.map(m=>m.name).join("\u3001")}\u30FB\u3044\u307E\u306E\u753B\u50CF\u306F\u5916\u308C\u307E\u3059\uFF09`);else if(clearMedia)notes.push(`\u753B\u50CF: ${oldMedia} \u679A \u2192 \
|
|
106
|
+
0 \u679A\uFF08\u3059\u3079\u3066\u5916\u3057\u307E\u3059\uFF09`);else notes.push(`\u753B\u50CF: \u5909\u3048\u307E\u305B\u3093\uFF08${oldMedia} \u679A\uFF09`);const thread=Number(input.resolved?.["threadParts"]??"0");if(thread>0)notes.push(`\u30B9\u30EC\u30C3\u30C9\u306E\u7D9A\u304D\uFF08${thread} \u4EF6\uFF09\u306F\u5909\u3048\u307E\u305B\u3093\u3002`);const steps=[...media!==void 0?["\u753B\u50CF\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\uFF08upload-url \u2192 S3\u3002\u6295\u7A3F\u306F\u307E\u3060\u5909\u308F\u308A\u307E\u305B\u3093\uFF09"]:
|
|
107
|
+
[],...text!==void 0?["\u672C\u6587\u3092\u66F4\u65B0\u3057\uFF08PATCH\uFF09"]:[],...media!==void 0?["\u753B\u50CF\u3092\u4ED8\u3051\u66FF\u3048\uFF08PUT .../media\uFF09"]:clearMedia?["\u753B\u50CF\u3092\u5916\u3057\uFF08PUT .../media\uFF09"]:[]];notes.push(`\u3053\u306E\u3042\u3068: ${steps.join("\u3001")}\u3001\u6700\u5F8C\u306B\u6295\u7A3F\u3092\u53D6\u308A\u76F4\u3057\u3066\u53CD\u6620\u3092\u78BA\u304B\u3081\u307E\u3059\u3002`);if(status==="scheduled")notes.push("\u26A0 \u4E88\u7D04\u4E2D\u306E\u6295\u7A3F\u3067\u3059\u3002\u4E88\u7D04\u306E\u6642\u523B\u306B\u3053\u306E\u5185\u5BB9\u3067\u516C\u958B\u3055\u308C\u307E\u3059\
|
|
108
|
+
\u3002");return notes},async preview(input){const{text}=editChanges(input);if(text!==void 0&&requireResolved(input,"channel")==="x"&&URL_PATTERN.test(text)&&!URL_PATTERN.test(JSON.parse(requireResolved(input,"oldBody")))){return{notes:["\u26A0 \u65B0\u3057\u3044\u672C\u6587\u306B URL \u304C\u3042\u308B\u305F\u3081\u3001\u6295\u7A3F\u3059\u308B\u3068\u304D\u306F\u300C\u30EA\u30F3\u30AF\u4ED8\u304D\u6295\u7A3F\u300D\u306E\u5358\u4FA1\u306B\u306A\u308A\u307E\u3059\u3002"],warnings:[]}}return{notes:[],
|
|
109
|
+
warnings:[]}},async execute(input,ctx){const{text,media,clearMedia}=editChanges(input);const id=requireResolved(input,"id");let version=requireResolved(input,"updatedAt");const ids=[];for(const m of media??[]){const{id:attachmentId,uploadUrl}=issued(await ctx.send(uploadPlan(m)));const bytes=new Uint8Array(fs.readFileSync(m.file));if(bytes.byteLength!==m.size)throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u306E\u5927\u304D\u3055\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF08${m.
|
|
110
|
+
size} \u2192 ${bytes.byteLength} \u30D0\u30A4\u30C8\uFF09: ${m.file}`);await ctx.putSigned(uploadUrl,bytes,m.contentType);ids.push(attachmentId)}let bodyDone=false;try{if(text!==void 0){const updated=dataRecord(await ctx.send(patchPlan(input,text,version)),"\u6295\u7A3F\u306E\u7DE8\u96C6");const next=str(updated["updated_at"]);if(next===null)throw new ApiResponseError("\u6295\u7A3F\u306E\u7DE8\u96C6\u306E\u5FDC\u7B54\u306B updated_at \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
111
|
+
version=next;bodyDone=true}if(media!==void 0||clearMedia){dataRecord(await ctx.send({method:"PUT",path:editPath(input,"/media"),body:{attachment_ids:ids,expected_updated_at:version}}),"\u753B\u50CF\u306E\u4ED8\u3051\u66FF\u3048")}}catch(error){if(error instanceof ApiError&&error.status===409)throw conflictMessage(error,bodyDone,requireResolved(input,"channel"));if(bodyDone)ctx.warn(`\u672C\u6587\u306F\u66F4\u65B0\u3057\u307E\u3057\u305F\u3002\u753B\u50CF\u306E\u4ED8\u3051\u66FF\u3048\u3067\u6B62\u307E\u3063\u305F\u305F\u3081\u3001\u753B\u50CF\u306F\u5909\u3048\u3066\u3044\u307E\u305B\u3093\uFF08${id}\
|
|
112
|
+
\uFF09\u3002`);throw error}try{return{data:dataRecord(await ctx.send({method:"GET",path:editPath(input)}),"\u7DE8\u96C6\u5F8C\u306E\u6295\u7A3F")}}catch(error){ctx.warn(`\u7DE8\u96C6\u306F\u53CD\u6620\u6E08\u307F\u3067\u3059\u3002\u78BA\u8A8D\u306E\u305F\u3081\u306E\u53D6\u308A\u76F4\u3057\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u6253\u3061\u76F4\u3055\u305A twp sns list --channel ${requireResolved(input,"channel")} --status all \u3067\u78BA\u304B\u3081\u3066\u304F\u3060\u3055\u3044\u3002`);
|
|
113
|
+
throw error}},summarize:body=>postRow(isRecord(body)&&isRecord(body["data"])?body["data"]:{}),raw:body=>isRecord(body)?body["data"]:body,notes(body){const row=isRecord(body)&&isRecord(body["data"])?body["data"]:{};const media=Array.isArray(row["media_attachment_ids"])?row["media_attachment_ids"].length:0;const text=String(row["body"]??"");return[`\u7DE8\u96C6\u3057\u307E\u3057\u305F\uFF08\u53D6\u308A\u76F4\u3057\u305F\u5185\u5BB9: \u672C\u6587 ${charCount(text)} \u6587\u5B57\u300C${oneLine(text)}\
|
|
114
|
+
\u300D / \u753B\u50CF ${media} \u679A\uFF09\u3002`]}};var DRAFT_USAGE="twp sns draft --channel <\u30C1\u30E3\u30CD\u30EB> [--channel \u2026] (--from content:<ID> | --from post:<ID> | --text <\u6587\u5B57\u5217> | --text-file <\u30D1\u30B9>) [--tone polite|casual|business] --yes";function contentToSourceText(content){const htmlToText=value=>value.replace(/<br\s*\/?>/gi,"\n").replace(/<\/(p|div|h[1-6]|li)>/gi,"\n").replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/</g,"<").replace(/>/g,
|
|
115
|
+
">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&");const parts=[];const collect=(value,depth)=>{if(depth>6||value===null||value===void 0)return;if(typeof value==="string"){const text=htmlToText(value).trim();if(text!=="")parts.push(text)}else if(Array.isArray(value))value.forEach(v=>collect(v,depth+1));else if(isRecord(value))Object.values(value).forEach(v=>collect(v,depth+1))};collect(content["content"],0);const title=typeof content["title"]==="string"?content["title"]:"";return[
|
|
116
|
+
title,...parts].filter(p=>p.trim()!=="").join("\n\n")}function truncateSource(text){const chars=[...text.replace(/\n{3,}/g,"\n\n").trim()];return chars.length>DRAFT_SOURCE_MAX?{text:chars.slice(0,DRAFT_SOURCE_MAX).join(""),truncated:true}:{text:chars.join(""),truncated:false}}function draftRows(body){const drafts=dataRecord(body,"\u539F\u7A3F\u306E\u4F5C\u6210")["drafts"];if(!Array.isArray(drafts))throw new ApiResponseError("\u539F\u7A3F\u306E\u4F5C\u6210\u306E\u5FDC\u7B54\u306B drafts \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
117
|
+
return drafts.filter(isRecord)}var draftOperation={name:"draft",summary:"AI \u3067\u30C1\u30E3\u30CD\u30EB\u3054\u3068\u306E\u6295\u7A3F\u539F\u7A3F\u3092\u4F5C\u308B\uFF08\u4FDD\u5B58\u3082\u6295\u7A3F\u3082\u3057\u306A\u3044\u30FB--yes \u304C\u5FC5\u8981\uFF09",usage:DRAFT_USAGE,description:`\u26A0 AI \u30AF\u30EC\u30B8\u30C3\u30C8\u3092\u6D88\u8CBB\u3057\u307E\u3059\u3002--yes \u304C\u7121\u3051\u308C\u3070\u5B9F\u884C\u3057\u307E\u305B\u3093\u3002
|
|
93
118
|
|
|
94
119
|
\u7D20\u6750\u306F\u6B21\u306E\u3069\u308C\u304B1\u3064\u3067\u3059\u3002
|
|
95
120
|
--from content:<ID> \u30B3\u30F3\u30C6\u30F3\u30C4\u7BA1\u7406\uFF08CMS\uFF09\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\uFF08\u30BF\u30A4\u30C8\u30EB\u3068\u672C\u6587\u306E\u5404\u9805\u76EE\u3092\u7D20\u6750\u306B\u3057\u307E\u3059\uFF09
|
|
@@ -110,4 +135,4 @@ input,"channels"));const notes=[`\u7D20\u6750: ${requireResolved(input,"source")
|
|
|
110
135
|
|
|
111
136
|
${String(row["body"]??"")}`).join("\n\n"),notes(body){const notes=[];for(const row of draftRows(body)){const label=channelName(String(row["channel"]??""));if(row["within_limit"]!==true)notes.push(`\u26A0 ${label}: \u6587\u5B57\u6570\u306E\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u304B\u7A7A\u3067\u3059\uFF08${String(row["length"])} / ${String(row["limit"])} \u6587\u5B57\uFF09\u3002\u76F4\u3057\u3066\u304B\u3089\u6295\u7A3F\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);if(row["channel"]==="x"&&
|
|
112
137
|
row["contains_url"]===true)notes.push(`\u26A0 ${label}: \u672C\u6587\u306B URL \u304C\u3042\u308B\u305F\u3081\u3001\u305D\u306E\u307E\u307E\u6295\u7A3F\u3059\u308B\u3068\u300C\u30EA\u30F3\u30AF\u4ED8\u304D\u6295\u7A3F\u300D\u306E\u5358\u4FA1\u306B\u306A\u308A\u307E\u3059\u3002`)}notes.push("\u539F\u7A3F\u306F\u4FDD\u5B58\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6295\u7A3F\u3059\u308B\u306A\u3089\u672C\u6587\u3092\u30D5\u30A1\u30A4\u30EB\u3078\u4FDD\u5B58\u3057\u3066 twp sns post --channel x --text-file <\u30D1\u30B9> --yes \u306B\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
113
|
-
return notes}};var snsDomain={name:"sns",summary:"\u5E83\u5831\u306E SNS \u6295\u7A3F\uFF08\u9023\u643A\u4E00\u89A7\u30FB\u6295\u7A3F\u4E00\u89A7\u30FB\u6295\u7A3F\u30FB\u4E88\u7D04\u30FB\u524A\u9664\u30FBAI \u539F\u7A3F\u4F5C\u6210\uFF09",operations:[accountsOperation,listOperation,postOperation,deleteOperation,draftOperation]};export{contentToSourceText,countX,parseAt,snsDomain,xPartsViolation};
|
|
138
|
+
return notes}};var snsDomain={name:"sns",summary:"\u5E83\u5831\u306E SNS \u6295\u7A3F\uFF08\u9023\u643A\u4E00\u89A7\u30FB\u6295\u7A3F\u4E00\u89A7\u30FB\u6295\u7A3F\u30FB\u4E88\u7D04\u30FB\u4E0B\u66F8\u304D\u3068\u4E88\u7D04\u306E\u7DE8\u96C6\u30FB\u524A\u9664\u30FBAI \u539F\u7A3F\u4F5C\u6210\uFF09",operations:[accountsOperation,listOperation,postOperation,editOperation,deleteOperation,draftOperation]};export{contentToSourceText,countX,parseAt,snsDomain,xPartsViolation};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{teamsDomain}from"./chunk-
|
|
3
|
+
import{teamsDomain}from"./chunk-267PCVC4.js";import"./chunk-5JUE6FZC.js";import"./chunk-M37IYSEG.js";import"./chunk-Q3B65OFC.js";import"./chunk-HEH3PUW2.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-VGT2EGH6.js";import"./chunk-MMVXE2CJ.js";import"./chunk-MI6HVYR2.js";import"./chunk-PS5QFKHB.js";import"./chunk-3ZRMMBP5.js";import"./chunk-VFPY2A23.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";
|
|
4
4
|
import"./chunk-VSJBJXZO.js";export{teamsDomain};
|