@tocca-systems/twp-cli 0.126.0 → 0.127.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.public.md +14 -0
  2. package/README.md +42 -11
  3. package/dist/{api-command-7HSZ2VT5.js → api-command-HXPD6GA3.js} +2 -2
  4. package/dist/{app-3PXJSRXI.js → app-HRBJ435D.js} +3 -3
  5. package/dist/{backlog-SXIC4PHA.js → backlog-J4BDNFXR.js} +37 -23
  6. package/dist/{chunk-ERMKZMGS.js → chunk-44U6JBPQ.js} +45 -43
  7. package/dist/{chunk-42WDHGWC.js → chunk-4W6ZC7GV.js} +1 -1
  8. package/dist/{chunk-3WHC4FSG.js → chunk-I4KGIIYH.js} +6 -6
  9. package/dist/{chunk-ZWXLHGH6.js → chunk-IC52VYM4.js} +2 -2
  10. package/dist/chunk-QNPBMR5E.js +14 -0
  11. package/dist/chunk-ZN7AEXEI.js +4 -0
  12. package/dist/cli.js +35 -13
  13. package/dist/{commands-TSQN2TW7.js → commands-44V2CA5N.js} +3 -3
  14. package/dist/{commands-EII35DA5.js → commands-UT5FMOFA.js} +1 -1
  15. package/dist/{completion-CHN73KVQ.js → completion-LAXSYWLZ.js} +1 -1
  16. package/dist/journal-GGGYNNXX.js +63 -0
  17. package/dist/knowledge-LFK6JLI6.js +5 -0
  18. package/dist/{logout-guard-UVMBBP26.js → logout-guard-MS3N5XKP.js} +1 -1
  19. package/dist/{media-E2G6DUXN.js → media-ZYPI7N66.js} +2 -2
  20. package/dist/{note-2RJWN5TQ.js → note-FXJBYKDJ.js} +1 -1
  21. package/dist/redmine-H2IGEHH5.js +88 -0
  22. package/dist/{registry-FNRF7ZD7.js → registry-ZTPZYTW3.js} +1 -1
  23. package/dist/{run-RYRFXAGW.js → run-C2WIXH7T.js} +2 -2
  24. package/dist/{slack-WP7I3XST.js → slack-FUBJBT5W.js} +39 -21
  25. package/dist/{user-TVWMXKQT.js → user-P3ECD5TM.js} +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunk-JAJSMUER.js +0 -14
  28. package/dist/chunk-KD4YXQOZ.js +0 -4
  29. package/dist/knowledge-WVHKCKC4.js +0 -5
  30. package/dist/redmine-PKQ3U6WD.js +0 -74
@@ -1,7 +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{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\
3
+ import{buildDiffLines,diffStat}from"./chunk-VRBI2NPI.js";import{PRIVATE_PROJECT_REF,isPrivateProjectRef}from"./chunk-RMFLTSOV.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";
4
+ import{ApiError}from"./chunk-SH2YLLVL.js";import{ResolveError,isSafePathSegment}from"./chunk-HVZUXLQ4.js";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\
5
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",
6
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\
7
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\
@@ -18,7 +18,8 @@ twp wiki list \u306E id \u5217\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002")
18
18
  []}function wikiListQuery(input){return{project_id:requireResolved(input,"project"),status:oneOf(input,"--status",WIKI_STATUSES),stale_days:staleDays(input),tag:nonEmpty(input.flags,"--tag"),keyword:nonEmpty(input.flags,"--keyword"),limit:pageLimit(input),cursor:nonEmpty(input.flags,"--cursor"),fields:WIKI_SUMMARY_FIELDS}}function childrenOf(body,parent){const tree=isRecord(body)&&body["result"]===true?body["tree"]:void 0;if(!Array.isArray(tree))throw new ApiResponseError(`${WIKI_LABEL}\u306E\u30C4\u30EA\u30FC\u306E\u5FDC\u7B54\u306B \
19
19
  tree \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);const find=roots=>{const stack=[...roots];while(stack.length>0){const node=stack.pop();if(!isRecord(node))continue;const children2=Array.isArray(node["children"])?node["children"]:[];if(node["id"]===parent)return children2;for(const child of children2)stack.push(child)}return void 0};const children=parent===ROOT_PARENT?tree:find(tree);if(children===void 0){throw new ResolveError(
20
20
  `\u89AA\u30DA\u30FC\u30B8 ${parent} \u306F\u3053\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E wiki \u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093\uFF08\u524A\u9664\u6E08\u307F\u30FB\u4ED6\u4EBA\u306E\u4E0B\u66F8\u304D\u30FB\u5225\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30DA\u30FC\u30B8\u306F\u898B\u3048\u307E\u305B\u3093\uFF09`,404)}return children.filter(isRecord).map(node=>{const{children:grand,...page}=node;return{...withoutContent(page),child_count:Array.isArray(grand)?grand.length:0}})}
21
- var wikiList={name:"list",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E${WIKI_LABEL}\u3092\u4E00\u89A7\u3059\u308B\uFF08--parent \u3067\u89AA\u30DA\u30FC\u30B8\u76F4\u4E0B\uFF09`,usage:"twp wiki list [--project <\u30B3\u30FC\u30C9|ID>] [--parent <\u30DA\u30FC\u30B8ID>|root] [--status <draft|published>] [--tag <\u30BF\u30B0>] [--keyword <\u8A9E>] [--stale-days <\u65E5\u6570>] [--all] [--limit <\u4EF6\u6570>]",description:`wiki \u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3054\u3068\u3067\u3059\u3002--project \u3092\u7701\u304F\u3068\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08TWP_PROJECT \u7B49\uFF09\u3092\u4F7F\u3044\u307E\u3059\u3002
21
+ var wikiList={name:"list",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E${WIKI_LABEL}\u3092\u4E00\u89A7\u3059\u308B\uFF08--parent \u3067\u89AA\u30DA\u30FC\u30B8\u76F4\u4E0B\uFF09`,usage:"twp wiki list [--project <\u30B3\u30FC\u30C9|ID|__private__>] [--parent <\u30DA\u30FC\u30B8ID>|root] [--status <draft|published>] [--tag <\u30BF\u30B0>] [--keyword <\u8A9E>] [--stale-days <\u65E5\u6570>] [--all] [--limit <\u4EF6\u6570>]",description:`wiki \u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3054\u3068\u3067\u3059\u3002--project \u3092\u7701\u304F\u3068\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08TWP_PROJECT \u7B49\uFF09\u3092\u4F7F\
22
+ \u3044\u307E\u3059\u3002--project __private__ \u306F\u81EA\u5206\u3060\u3051\u304C\u8AAD\u307F\u66F8\u304D\u3067\u304D\u308B\u500B\u4EBA wiki \u3067\u3059\u3002
22
23
  --parent <\u30DA\u30FC\u30B8ID> \u306F\u305D\u306E\u30DA\u30FC\u30B8\u76F4\u4E0B\u306E\u5B50\u30DA\u30FC\u30B8\u3060\u3051\u3001--parent ${ROOT_PARENT} \u306F\u6700\u4E0A\u4F4D\u306E\u30DA\u30FC\u30B8\u3060\u3051\u3092\u51FA\u3057\u307E\u3059\uFF08\u5B6B\u306F child_count \u5217\u3067\u6570\u3060\u3051\u5206\u304B\u308A\u307E\u3059\uFF09\u3002
23
24
  --parent \u306F\u30DA\u30FC\u30B8\u306E\u89AA\u5B50\u69CB\u9020\u30921\u56DE\u3067\u5F15\u3044\u3066\u9078\u3076\u306E\u3067\u3001${PARENT_EXCLUSIVE.join(" / ")} \u3068\u306F\u4F75\u7528\u3067\u304D\u307E\u305B\u3093\u3002
24
25
  \u4E0B\u66F8\u304D\u306F\u4F5C\u6210\u8005\u3068 wiki \u306E\u7BA1\u7406\u8005\u306B\u3057\u304B\u898B\u3048\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u306E\u5224\u5B9A\uFF09\u3002
@@ -33,23 +34,23 @@ var wikiList={name:"list",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E${W
33
34
  --output json \u306F API \u304C\u8FD4\u3059\u30D5\u30A3\u30FC\u30EB\u30C9\u304B\u3089\u672C\u6587 content \u3092\u9664\u3044\u305F\u3082\u306E\u3067\u3001\u4EE3\u308F\u308A\u306B\u5192\u982D\u306E\u8981\u7D04 summary\uFF08\u5E73\u6587\u3067\u5148\u982D200\u6587\u5B57\uFF09\u3068\u672C\u6587\u306E\u6587\u5B57\u6570 content_length \u304C\u5165\u308A\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u304C\u5BFE\u5FDC\u3057\u3066\u3044\u308C\u3070\uFF09\u3002
34
35
  --output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${WIKI_LIST_COLUMNS.join(" / ")}\u3002--parent \u3067\u306F parent_page_id \u306E\u4EE3\u308F\u308A\u306B child_count\u3001--stale-days \u3067\u306F ${WIKI_STALE_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002\u672C\u6587\u306F twp wiki get \u3067\u8AAD\u3081\u307E\u3059\u3002
35
36
 
36
- `+LIST_PAGING_HELP,flags:[...LIST_FLAGS,{name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF09",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"},{name:"--parent",summary:`\u89AA\u30DA\u30FC\u30B8\u306E ID\uFF08\u76F4\u4E0B\u306E\u5B50\u3060\u3051\u3092\u51FA\u3059\uFF09\u3002${ROOT_PARENT} \u3067\u6700\u4E0A\u4F4D`,takesValue:true,placeholder:"<\u30DA\u30FC\u30B8ID>|root"},
37
- {name:"--status",summary:`\u72B6\u614B\u3067\u7D5E\u308A\u8FBC\u3080\uFF08${WIKI_STATUSES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u72B6\u614B>"},{name:"--tag",summary:"\u30BF\u30B0\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u30BF\u30B0>"},{name:"--keyword",summary:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u691C\u7D22\u3059\u308B\uFF08\u95A2\u9023\u5EA6\u9806\u30FB\u629C\u7C8B\u3064\u304D\u3002\u4F5C\u6210\u76F4\u5F8C\u306E\u30DA\u30FC\u30B8\u306F\u51FA\u306A\u3044\u3053\u3068\u304C\u3042\u308B\uFF09",
38
- takesValue:true,placeholder:"<\u8A9E>"},{name:"--stale-days",summary:"\u6700\u7D42\u5B9F\u6E2C\u65E5\u304C N \u65E5\u4EE5\u4E0A\u524D\uFF08\u672A\u8A2D\u5B9A\u3092\u542B\u3080\uFF09\u306E\u30DA\u30FC\u30B8\u3060\u3051\u30FB\u53E4\u3044\u9806",takesValue:true,placeholder:"<\u65E5\u6570>"}],paging:wikiPaging,async prepare(input,ctx){noArgs(input,"twp wiki list");parentRef(input);oneOf(input,"--status",WIKI_STATUSES);staleDays(input);pageLimit(input);return withResolved(input,{project:await ctx.projectId(
39
- input.flags.get("--project"))})},plan(input){return parentRef(input)!==void 0?{method:"GET",path:`${WIKI_PATH}/tree`,query:wikiTreeQuery(input)}:{method:"GET",path:WIKI_PATH,query:wikiListQuery(input)}},narrow(body,input){const parent=parentRef(input);if(parent===void 0){return staleDays(input)!==void 0&&isRecord(body)?{...body,[STALE_VIEW]:true}:body}return{result:true,items:childrenOf(body,parent),has_more:false,next_cursor:null}},notes:(body,input)=>[...staleDaysNotes(body,input),...isRecord(
37
+ `+LIST_PAGING_HELP,flags:[...LIST_FLAGS,{name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3002__private__ \u3067\u81EA\u5206\u3060\u3051\u306E\u500B\u4EBA wiki\uFF09",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID|__private__>"},{name:"--parent",summary:`\u89AA\u30DA\u30FC\u30B8\u306E ID\uFF08\u76F4\u4E0B\u306E\u5B50\u3060\u3051\u3092\u51FA\u3059\uFF09\u3002${ROOT_PARENT}\
38
+ \u3067\u6700\u4E0A\u4F4D`,takesValue:true,placeholder:"<\u30DA\u30FC\u30B8ID>|root"},{name:"--status",summary:`\u72B6\u614B\u3067\u7D5E\u308A\u8FBC\u3080\uFF08${WIKI_STATUSES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u72B6\u614B>"},{name:"--tag",summary:"\u30BF\u30B0\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u30BF\u30B0>"},{name:"--keyword",summary:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u691C\u7D22\u3059\u308B\uFF08\u95A2\u9023\u5EA6\u9806\u30FB\u629C\u7C8B\u3064\u304D\u3002\u4F5C\u6210\u76F4\u5F8C\u306E\u30DA\u30FC\u30B8\u306F\u51FA\u306A\u3044\u3053\u3068\u304C\u3042\u308B\uFF09",
39
+ takesValue:true,placeholder:"<\u8A9E>"},{name:"--stale-days",summary:"\u6700\u7D42\u5B9F\u6E2C\u65E5\u304C N \u65E5\u4EE5\u4E0A\u524D\uFF08\u672A\u8A2D\u5B9A\u3092\u542B\u3080\uFF09\u306E\u30DA\u30FC\u30B8\u3060\u3051\u30FB\u53E4\u3044\u9806",takesValue:true,placeholder:"<\u65E5\u6570>"}],paging:wikiPaging,async prepare(input,ctx){noArgs(input,"twp wiki list");parentRef(input);oneOf(input,"--status",WIKI_STATUSES);staleDays(input);pageLimit(input);return withResolved(input,{project:await wikiProjectId(
40
+ ctx,input.flags.get("--project"))})},plan(input){return parentRef(input)!==void 0?{method:"GET",path:`${WIKI_PATH}/tree`,query:wikiTreeQuery(input)}:{method:"GET",path:WIKI_PATH,query:wikiListQuery(input)}},narrow(body,input){const parent=parentRef(input);if(parent===void 0){return staleDays(input)!==void 0&&isRecord(body)?{...body,[STALE_VIEW]:true}:body}return{result:true,items:childrenOf(body,parent),has_more:false,next_cursor:null}},notes:(body,input)=>[...staleDaysNotes(body,input),...isRecord(
40
41
  body)&&body["search_mode"]==="in_memory"?["\u691C\u7D22\u7D22\u5F15\u304C\u4F7F\u3048\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u30B5\u30FC\u30D0\u306F\u5F93\u6765\u306E\u90E8\u5206\u4E00\u81F4\uFF08\u66F4\u65B0\u65E5\u6642\u9806\u30FB\u629C\u7C8B\u306A\u3057\uFF09\u3067\u7D5E\u308A\u8FBC\u307F\u307E\u3057\u305F\u3002"]:[]],summarize:body=>{const rows=envelopeRows(body,wikiPaging,`${WIKI_LABEL}\u4E00\u89A7`);const columns=rows.some(row=>isRecord(row)&&"child_count"in row)?WIKI_CHILD_COLUMNS:isRecord(
41
42
  body)&&body[STALE_VIEW]===true?WIKI_STALE_COLUMNS:rows.some(row=>isRecord(row)&&"search_excerpt"in row)?WIKI_SEARCH_COLUMNS:WIKI_LIST_COLUMNS;return rows.map(row=>pick(row,columns))},raw:body=>envelopeRows(body,wikiPaging,`${WIKI_LABEL}\u4E00\u89A7`).map(row=>isRecord(row)?withoutContent(row):row)};function wikiTreeQuery(input){return{project_id:requireResolved(input,"project"),fields:WIKI_SUMMARY_FIELDS}}function wikiDocument(body){const view=wikiGetView(body);if(view!==void 0)return wikiViewDocument(
42
43
  view);const page=record(body,"page",WIKI_LABEL);return composeDocument(page["title"],[...metaLine("\u72B6\u614B",page["status"]),...metaLine("\u5F62\u5F0F",page["content_format"]),...metaLine("\u30BF\u30B0",page["tags"]),...metaLine("\u89AA\u30DA\u30FC\u30B8",page["parent_page_id"]),...metaLine("\u6700\u7D42\u5B9F\u6E2C\u65E5",page["verified_at"]),...metaLine("\u6839\u62E0\u30BF\u30B9\u30AF",page["evidence_task_keys"]),...metaLine("\u7A2E\u5225",page["knowledge_kind"]),...metaLine("\u7248",page["\
43
- version"]),...metaLine("\u66F4\u65B0",page["updated_at"]),...metaLine("\u66F4\u65B0\u8005",page["updated_by_name"]),...metaLine("ID",page["id"])],[{body:wikiContentToText(page["content"],page["content_format"])}])}var WIKI_GET_USAGE="twp wiki get <\u30DA\u30FC\u30B8ID> [<\u30DA\u30FC\u30B8ID> ...] | --path <\u89AA\u4EF6\u540D/\u5B50\u4EF6\u540D> [--project <\u30B3\u30FC\u30C9|ID>]\uFF081\u4EF6\u306E\u3068\u304D\u306F [--outline | --section <\u898B\u51FA\u3057>] \u3082\u4ED8\u3051\u3089\u308C\u308B\uFF09";
44
+ version"]),...metaLine("\u66F4\u65B0",page["updated_at"]),...metaLine("\u66F4\u65B0\u8005",page["updated_by_name"]),...metaLine("ID",page["id"])],[{body:wikiContentToText(page["content"],page["content_format"])}])}var WIKI_GET_USAGE="twp wiki get <\u30DA\u30FC\u30B8ID> [<\u30DA\u30FC\u30B8ID> ...] | --path <\u89AA\u4EF6\u540D/\u5B50\u4EF6\u540D> [--project <\u30B3\u30FC\u30C9|ID|__private__>]\uFF081\u4EF6\u306E\u3068\u304D\u306F [--outline | --section <\u898B\u51FA\u3057>] \u3082\u4ED8\u3051\u3089\u308C\u308B\uFF09";
44
45
  function wikiPathSegments(raw){const text2=raw.trim().replace(/^\//,"");const segments=[];let current="";for(let i=0;i<text2.length;i++){const ch=text2[i];const next=text2[i+1];if(ch==="\\"&&(next==="/"||next==="\\")){current+=next;i++}else if(ch==="/"){segments.push(current);current=""}else{current+=ch}}segments.push(current);if(segments.some(segment=>segment.trim()==="")){throw new UsageError(`--path \u306B\u7A7A\u306E\u4EF6\u540D\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059: ${raw}`,"\u300C\u89AA\u4EF6\u540D/\
45
46
  \u5B50\u4EF6\u540D\u300D\u306E\u5F62\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4EF6\u540D\u306E\u4E2D\u306E / \u306F \\/ \u3068\u66F8\u304D\u307E\u3059\uFF09\u3002")}return segments}function wikiPathRef(input){const raw=input.flags.get("--path");if(raw===void 0){if(input.flags.has("--project")){throw new UsageError("--project \u306F --path \u3068\u4E00\u7DD2\u306B\u3060\u3051\u6307\u5B9A\u3067\u304D\u307E\u3059","\u30DA\u30FC\u30B8 ID \u3067\u53D6\u308B\u3068\u304D\u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u6307\u5B9A\u306F\u8981\u308A\u307E\u305B\u3093\u3002")}
46
47
  return void 0}if(input.args.length>0){throw new UsageError(`\u30DA\u30FC\u30B8 ID\uFF08${input.args.join(" ")}\uFF09\u3068 --path \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,WIKI_GET_USAGE)}if(raw.trim()==="")throw new UsageError("--path \u306B\u7A7A\u306E\u5024\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093",WIKI_GET_USAGE);return wikiPathSegments(raw)}function foldTitle(value){return typeof value==="string"?value.trim().toLowerCase():void 0}function wikiPathNodes(nodes,trail){
47
48
  return nodes.filter(isRecord).map(page=>({page,trail:[...trail,typeof page["title"]==="string"?page["title"]:""],children:Array.isArray(page["children"])?page["children"]:[]}))}function formatTrail(trail){return trail.map(title=>title.replace(/\\/g,"\\\\").replace(/\//g,"\\/")).join("/")}function describeNode(node){return`${formatTrail(node.trail)}\uFF08${String(node.page["id"])}\uFF09`}function listNodes(nodes,limit=10){const shown=nodes.slice(0,limit).map(describeNode).join(" / ");return nodes.
48
- length>limit?`${shown} \u2026\uFF08\u5168 ${nodes.length} \u4EF6\uFF09`:shown}function nodesTitled(tree,title){const needle=foldTitle(title);const found=[];const stack=wikiPathNodes(tree,[]).reverse();while(stack.length>0){const node=stack.pop();if(foldTitle(node.page["title"])===needle)found.push(node);stack.push(...wikiPathNodes(node.children,node.trail).reverse())}return found}function resolveWikiPath(body,segments,raw){const tree=isRecord(body)&&body["result"]===true?body["tree"]:void 0;if(!Array.
49
- isArray(tree))throw new ApiResponseError(`${WIKI_LABEL}\u306E\u30C4\u30EA\u30FC\u306E\u5FDC\u7B54\u306B tree \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);let frontier=wikiPathNodes(tree,[]);for(const[depth,segment]of segments.entries()){const needle=foldTitle(segment);const hits=frontier.filter(node=>foldTitle(node.page["title"])===needle&&typeof node.page["id"]==="string");if(hits.length===0){const where=depth===
50
- 0?"\u6700\u4E0A\u4F4D":`\u300C${formatTrail(segments.slice(0,depth))}\u300D\u306E\u76F4\u4E0B`;const elsewhere=nodesTitled(tree,segment);const titles=[...new Set(frontier.map(node=>node.trail.at(-1)??""))].filter(title=>title!=="");const hint=elsewhere.length>0?`\u540C\u3058\u4EF6\u540D\u306E\u30DA\u30FC\u30B8\u306F\u5225\u306E\u5834\u6240\u306B\u3042\u308A\u307E\u3059: ${listNodes(elsewhere)}`:titles.length>0?`${where}\u306E\u4EF6\u540D: ${titles.slice(0,10).join(" / ")}${titles.length>10?` \u2026\uFF08\u5168\
51
- ${titles.length} \u4EF6\uFF09`:""}`:`${where}\u306B\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002`;throw new UsageError(`--path \u306E\u300C${raw}\u300D\u306B\u4E00\u81F4\u3059\u308B ${WIKI_LABEL}\u304C\u3042\u308A\u307E\u305B\u3093\uFF08${where}\u306B\u300C${segment}\u300D\u3068\u3044\u3046\u4EF6\u540D\u306E\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u524A\u9664\u6E08\u307F\u30FB\u4ED6\u4EBA\u306E\u4E0B\u66F8\u304D\u306F\u898B\u3048\u307E\u305B\u3093\uFF09`,hint)}
52
- if(depth===segments.length-1){if(hits.length===1)return String(hits[0]?.page["id"]);throw new UsageError(`--path \u306E\u300C${raw}\u300D\u304C ${WIKI_LABEL}${hits.length}\u4EF6\u306B\u4E00\u81F4\u3057\u307E\u3059: ${listNodes(hits)}`,"\u30DA\u30FC\u30B8 ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp wiki get <\u30DA\u30FC\u30B8ID>\uFF09\u3002")}frontier=hits.flatMap(node=>wikiPathNodes(node.children,node.trail))}throw new Error("\u5185\u90E8\u30A8\u30E9\u30FC: --path \u306E\u4EF6\u540D\u304C\u7A7A\u3067\u3059")}
49
+ length>limit?`${shown} \u2026\uFF08\u5168 ${nodes.length} \u4EF6\uFF09`:shown}function nodesTitled(tree,title){const needle=foldTitle(title);const found=[];const stack=wikiPathNodes(tree,[]).reverse();while(stack.length>0){const node=stack.pop();if(foldTitle(node.page["title"])===needle)found.push(node);stack.push(...wikiPathNodes(node.children,node.trail).reverse())}return found}function wikiProjectId(ctx,explicit){if(explicit!==void 0&&isPrivateProjectRef(explicit))return Promise.resolve(PRIVATE_PROJECT_REF);
50
+ return ctx.projectId(explicit)}function resolveWikiPath(body,segments,raw){const tree=isRecord(body)&&body["result"]===true?body["tree"]:void 0;if(!Array.isArray(tree))throw new ApiResponseError(`${WIKI_LABEL}\u306E\u30C4\u30EA\u30FC\u306E\u5FDC\u7B54\u306B tree \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);let frontier=wikiPathNodes(tree,[]);for(const[depth,segment]of segments.entries()){const needle=foldTitle(
51
+ segment);const hits=frontier.filter(node=>foldTitle(node.page["title"])===needle&&typeof node.page["id"]==="string");if(hits.length===0){const where=depth===0?"\u6700\u4E0A\u4F4D":`\u300C${formatTrail(segments.slice(0,depth))}\u300D\u306E\u76F4\u4E0B`;const elsewhere=nodesTitled(tree,segment);const titles=[...new Set(frontier.map(node=>node.trail.at(-1)??""))].filter(title=>title!=="");const hint=elsewhere.length>0?`\u540C\u3058\u4EF6\u540D\u306E\u30DA\u30FC\u30B8\u306F\u5225\u306E\u5834\u6240\u306B\u3042\u308A\u307E\u3059: ${listNodes(
52
+ elsewhere)}`:titles.length>0?`${where}\u306E\u4EF6\u540D: ${titles.slice(0,10).join(" / ")}${titles.length>10?` \u2026\uFF08\u5168 ${titles.length} \u4EF6\uFF09`:""}`:`${where}\u306B\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002`;throw new UsageError(`--path \u306E\u300C${raw}\u300D\u306B\u4E00\u81F4\u3059\u308B ${WIKI_LABEL}\u304C\u3042\u308A\u307E\u305B\u3093\uFF08${where}\u306B\u300C${segment}\u300D\u3068\u3044\u3046\u4EF6\u540D\u306E\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u524A\u9664\u6E08\u307F\u30FB\u4ED6\u4EBA\u306E\u4E0B\u66F8\u304D\u306F\u898B\u3048\u307E\u305B\u3093\uFF09`,
53
+ hint)}if(depth===segments.length-1){if(hits.length===1)return String(hits[0]?.page["id"]);throw new UsageError(`--path \u306E\u300C${raw}\u300D\u304C ${WIKI_LABEL}${hits.length}\u4EF6\u306B\u4E00\u81F4\u3057\u307E\u3059: ${listNodes(hits)}`,"\u30DA\u30FC\u30B8 ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp wiki get <\u30DA\u30FC\u30B8ID>\uFF09\u3002")}frontier=hits.flatMap(node=>wikiPathNodes(node.children,node.trail))}throw new Error("\u5185\u90E8\u30A8\u30E9\u30FC: --path \u306E\u4EF6\u540D\u304C\u7A7A\u3067\u3059")}
53
54
  function isWikiPages(body){return isRecord(body)&&Array.isArray(body["pages"])}function wikiGetIds(input){const ids=input.args.map(raw=>raw.trim());if(ids.length===0||ids.every(id=>id===""))throw new UsageError("\u30DA\u30FC\u30B8\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044","twp wiki get help");for(const id of ids){if(!isSafePathSegment(id))throw new UsageError(`\u30DA\u30FC\u30B8\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${id===""?"(\u7A7A)":id}`,
54
55
  "\u30DA\u30FC\u30B8\u306E ID \u306F twp wiki list \u306E id \u5217\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002")}return ids}function wikiPagePlan(id){return{method:"GET",path:`${WIKI_PATH}/${encodeURIComponent(id)}`}}function isPageFailure(err){return err instanceof ApiError&&err.status!==401&&err.status!==429}async function wikiGetMany(input,ctx){const ids=wikiGetIds(input);if(ids.length===1)return ctx.send(wikiPagePlan(ids[0]));const pages=[];const failed=[];for(const id of ids){let body;try{
55
56
  body=await ctx.send(wikiPagePlan(id))}catch(err){if(!isPageFailure(err))throw err;failed.push({target:id,error:err});continue}pages.push(record(body,"page",WIKI_LABEL))}const result={result:true,pages,failed};return result}function wikiGetPlan(input){return wikiPathRef(input)!==void 0?{method:"GET",path:`${WIKI_PATH}/tree`,query:wikiTreeQuery(input)}:wikiPagePlan(wikiGetIds(input)[0])}var WIKI_VIEW_KEY="twp_wiki_view";var WIKI_SECTION_CANDIDATES_MAX=50;var WIKI_VIEW_PAGE_FIELDS=["id","title","ve\
@@ -89,12 +90,12 @@ ID \u3092\u8907\u6570\u4E26\u3079\u308B\u30681\u4EF6\u305A\u3064\u53D6\u5F97\u30
89
90
  twp wiki get --path "\u904B\u7528/\u30EA\u30EA\u30FC\u30B9\u624B\u9806" --output text
90
91
  twp wiki get --project TWP --path "\u8A2D\u8A08\\/\u65B9\u91DD/DB"
91
92
  twp wiki get 0f8b2c6e-... --outline
92
- twp wiki get --path "\u904B\u7528/\u30EA\u30EA\u30FC\u30B9\u624B\u9806" --section "\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF"`,flags:[{name:"--path",summary:"\u4EF6\u540D\u306E\u968E\u5C64\uFF08\u89AA\u4EF6\u540D/\u5B50\u4EF6\u540D\uFF09\u3067\u30DA\u30FC\u30B8\u3092\u6307\u3059",takesValue:true,placeholder:"<\u89AA\u4EF6\u540D/\u5B50\u4EF6\u540D>"},{name:"--project",summary:"--path \u3067\u5F15\u304F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF09",
93
- takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"},{name:"--outline",summary:"\u898B\u51FA\u3057\u306E\u4E00\u89A7\uFF08\u968E\u5C64\u30FB\u7BC0\u306E\u6587\u5B57\u6570\uFF09\u3060\u3051\u3092\u51FA\u3059",takesValue:false},{name:"--section",summary:"\u305D\u306E\u898B\u51FA\u3057\u306E\u7BC0\u3060\u3051\u3092\u51FA\u3059",takesValue:true,placeholder:"<\u898B\u51FA\u3057>"}],async prepare(input,ctx){wikiGetMode(input);if(wikiPathRef(input)===void 0)return input;return withResolved(input,{project:await ctx.
94
- projectId(input.flags.get("--project"))})},plan:input=>{wikiGetMode(input);return wikiGetPlan(input)},plannedNotes:input=>{if(wikiPathRef(input)!==void 0)return[`\u3053\u306E\u3042\u3068\u3001\u4EF6\u540D\u306E\u968E\u5C64\u304B\u3089\u6C7A\u3081\u305F\u30DA\u30FC\u30B8\u3092 GET ${WIKI_PATH}/<\u30DA\u30FC\u30B8ID> \u3067\u53D6\u5F97\u3057\u307E\u3059\u3002`];const ids=wikiGetIds(input);return ids.length>1?[`\u3053\u306E\u3042\u3068\u3001\u6B8B\u308A\u306E ${ids.length-1} \u4EF6\u3082 GET ${WIKI_PATH}\
95
- /<\u30DA\u30FC\u30B8ID> \u30671\u4EF6\u305A\u3064\u53D6\u5F97\u3057\u307E\u3059\u3002`]:[]},execute:wikiGetExecute,summarize:body=>{if(isWikiPages(body))return body.pages.map(page=>pick(page,WIKI_GET_COLUMNS));const view=wikiGetView(body);if(view===void 0)return pick(record(body,"page",WIKI_LABEL),WIKI_GET_COLUMNS);if(view.kind==="outline"){if(view.outline.length===0)return[{version:view.page["version"],level:null,title:null,chars:null}];return view.outline.map(h=>({version:view.page["version"],
96
- ...h}))}return{...view.page,section:view.section.title,level:view.section.level,content:view.section.content}},raw:body=>{if(isWikiPages(body))return body.pages;const view=wikiGetView(body);return view===void 0?record(body,"page",WIKI_LABEL):wikiViewRaw(view)},notes:body=>{const view=wikiGetView(body);if(view?.kind!=="section"||view.section.matches<2)return[];return[`\u898B\u51FA\u3057\u300C${oneLine(view.section.title)}\u300D\u306F\u30DA\u30FC\u30B8\u5185\u306B ${view.section.matches} \u500B\u3042\u308A\u307E\u3059\u3002\u6700\u521D\u306E\
97
- \u3082\u306E\u3092\u51FA\u3057\u307E\u3057\u305F\u3002`]},document:body=>{if(!isWikiPages(body))return wikiDocument(body);const total=body.pages.length;return body.pages.map((page,index)=>{const title=typeof page["title"]==="string"&&page["title"].trim()!==""?oneLine(page["title"]):"(\u7121\u984C)";return`=== ${index+1}/${total} ${title}\uFF08ID: ${String(page["id"]??"")}\uFF09 ===
93
+ twp wiki get --path "\u904B\u7528/\u30EA\u30EA\u30FC\u30B9\u624B\u9806" --section "\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF"`,flags:[{name:"--path",summary:"\u4EF6\u540D\u306E\u968E\u5C64\uFF08\u89AA\u4EF6\u540D/\u5B50\u4EF6\u540D\uFF09\u3067\u30DA\u30FC\u30B8\u3092\u6307\u3059",takesValue:true,placeholder:"<\u89AA\u4EF6\u540D/\u5B50\u4EF6\u540D>"},{name:"--project",summary:"--path \u3067\u5F15\u304F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3002__private__ \u3067\u81EA\u5206\u3060\u3051\u306E\u500B\u4EBA wiki\uFF09",
94
+ takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID|__private__>"},{name:"--outline",summary:"\u898B\u51FA\u3057\u306E\u4E00\u89A7\uFF08\u968E\u5C64\u30FB\u7BC0\u306E\u6587\u5B57\u6570\uFF09\u3060\u3051\u3092\u51FA\u3059",takesValue:false},{name:"--section",summary:"\u305D\u306E\u898B\u51FA\u3057\u306E\u7BC0\u3060\u3051\u3092\u51FA\u3059",takesValue:true,placeholder:"<\u898B\u51FA\u3057>"}],async prepare(input,ctx){wikiGetMode(input);if(wikiPathRef(input)===void 0)return input;return withResolved(
95
+ input,{project:await wikiProjectId(ctx,input.flags.get("--project"))})},plan:input=>{wikiGetMode(input);return wikiGetPlan(input)},plannedNotes:input=>{if(wikiPathRef(input)!==void 0)return[`\u3053\u306E\u3042\u3068\u3001\u4EF6\u540D\u306E\u968E\u5C64\u304B\u3089\u6C7A\u3081\u305F\u30DA\u30FC\u30B8\u3092 GET ${WIKI_PATH}/<\u30DA\u30FC\u30B8ID> \u3067\u53D6\u5F97\u3057\u307E\u3059\u3002`];const ids=wikiGetIds(input);return ids.length>1?[`\u3053\u306E\u3042\u3068\u3001\u6B8B\u308A\u306E ${ids.length-
96
+ 1} \u4EF6\u3082 GET ${WIKI_PATH}/<\u30DA\u30FC\u30B8ID> \u30671\u4EF6\u305A\u3064\u53D6\u5F97\u3057\u307E\u3059\u3002`]:[]},execute:wikiGetExecute,summarize:body=>{if(isWikiPages(body))return body.pages.map(page=>pick(page,WIKI_GET_COLUMNS));const view=wikiGetView(body);if(view===void 0)return pick(record(body,"page",WIKI_LABEL),WIKI_GET_COLUMNS);if(view.kind==="outline"){if(view.outline.length===0)return[{version:view.page["version"],level:null,title:null,chars:null}];return view.outline.map(h=>({
97
+ version:view.page["version"],...h}))}return{...view.page,section:view.section.title,level:view.section.level,content:view.section.content}},raw:body=>{if(isWikiPages(body))return body.pages;const view=wikiGetView(body);return view===void 0?record(body,"page",WIKI_LABEL):wikiViewRaw(view)},notes:body=>{const view=wikiGetView(body);if(view?.kind!=="section"||view.section.matches<2)return[];return[`\u898B\u51FA\u3057\u300C${oneLine(view.section.title)}\u300D\u306F\u30DA\u30FC\u30B8\u5185\u306B ${view.
98
+ section.matches} \u500B\u3042\u308A\u307E\u3059\u3002\u6700\u521D\u306E\u3082\u306E\u3092\u51FA\u3057\u307E\u3057\u305F\u3002`]},document:body=>{if(!isWikiPages(body))return wikiDocument(body);const total=body.pages.length;return body.pages.map((page,index)=>{const title=typeof page["title"]==="string"&&page["title"].trim()!==""?oneLine(page["title"]):"(\u7121\u984C)";return`=== ${index+1}/${total} ${title}\uFF08ID: ${String(page["id"]??"")}\uFF09 ===
98
99
 
99
100
  ${wikiDocument({result:true,page})}`}).join("\n")},failures:body=>isWikiPages(body)?body.failed:[]};var WIKI_VERSIONS_MAX=100;var WIKI_TAGS_MAX=50;var WIKI_TREE_COLUMNS=["depth","id","title","status","child_count","parent_page_id","updated_at"];var WIKI_VERSION_COLUMNS=["version","title","content_format","changed_by_name","changed_at"];var WIKI_BACKLINK_COLUMNS=["id","title","status","link_context","updated_at","updated_by_name"];var WIKI_LINKED_TASK_COLUMNS=["key","subject","status_id","task_id",
100
101
  "project_id","created_by_name","created_at"];function pageIdAndRest(input,usage){const[raw,...rest]=input.args;const id=raw?.trim()??"";if(id==="")throw new UsageError("\u30DA\u30FC\u30B8\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);if(!isSafePathSegment(id))throw new UsageError(`\u30DA\u30FC\u30B8\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${id}`,"\u30DA\u30FC\u30B8\u306E ID \u306F twp wiki list / twp wiki tree \u306E id \u5217\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002");
@@ -102,13 +103,13 @@ return{id,rest}}function versionNumber(raw,usage){const value=raw.trim();const n
102
103
  \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return rows}function flattenTree(body){return flattenNodes(arrayField(body,"tree",`${WIKI_LABEL}\u306E\u30C4\u30EA\u30FC`)).map(row=>{const page={...row};delete page["content"];return page})}function flattenNodes(tree){const out=[];const stack=[...tree].reverse().map(node=>({node,depth:0}));while(stack.length>0){const{node,depth}=stack.pop();if(!isRecord(node))continue;
103
104
  const children=Array.isArray(node["children"])?node["children"]:[];const page={...node,depth,child_count:children.length};delete page["children"];out.push(page);for(let i=children.length-1;i>=0;i--)stack.push({node:children[i],depth:depth+1})}return out}function treeDocument(body){const rows=flattenTree(body);if(rows.length===0)return"\uFF08wiki \u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\n";return`${rows.map(row=>{const title=typeof row["title"]==="string"&&row["title"].trim()!==
104
105
  ""?oneLine(row["title"]):"(\u7121\u984C)";const children=typeof row["child_count"]==="number"&&row["child_count"]>0?`\u30FB\u5B50 ${row["child_count"]}`:"";return`${" ".repeat(Number(row["depth"])||0)}- ${title} [${String(row["status"]??"?")}${children}] ${String(row["id"])}`}).join("\n")}
105
- `}var projectFlag={name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF09",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"};var wikiTree={name:"tree",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E${WIKI_LABEL}\u306E\u89AA\u5B50\u69CB\u9020\u3092\u51FA\u3059\uFF08\u672C\u6587\u306F\u51FA\u3055\u306A\u3044\uFF09`,usage:"twp wiki tree [--project <\u30B3\u30FC\u30C9|ID>]",
106
- description:`\u5168\u30DA\u30FC\u30B8\u3092\u89AA\u5B50\u306E\u9806\uFF08\u753B\u9762\u306E\u4E26\u3073\uFF09\u30671\u884C\u305A\u3064\u51FA\u3057\u307E\u3059\u3002--output text \u306F\u5B57\u4E0B\u3052\u3057\u305F\u6728\u3001table / tsv \u306F\u8981\u7D04\u5217\uFF08${WIKI_TREE_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002
106
+ `}var projectFlag={name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3002__private__ \u3067\u81EA\u5206\u3060\u3051\u306E\u500B\u4EBA wiki\uFF09",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID|__private__>"};var wikiTree={name:"tree",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E${WIKI_LABEL}\u306E\u89AA\u5B50\u69CB\u9020\u3092\u51FA\u3059\uFF08\u672C\u6587\u306F\u51FA\u3055\u306A\u3044\uFF09`,
107
+ usage:"twp wiki tree [--project <\u30B3\u30FC\u30C9|ID|__private__>]",description:`\u5168\u30DA\u30FC\u30B8\u3092\u89AA\u5B50\u306E\u9806\uFF08\u753B\u9762\u306E\u4E26\u3073\uFF09\u30671\u884C\u305A\u3064\u51FA\u3057\u307E\u3059\u3002--output text \u306F\u5B57\u4E0B\u3052\u3057\u305F\u6728\u3001table / tsv \u306F\u8981\u7D04\u5217\uFF08${WIKI_TREE_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002
107
108
  **\u672C\u6587\u306F\u3069\u306E\u51FA\u529B\u5F62\u5F0F\u3067\u3082\u51FA\u3057\u307E\u305B\u3093**\uFF08--output json \u3082\u3001\u5404\u30DA\u30FC\u30B8\u304B\u3089 content \u3068 children \u3092\u5916\u3057 depth / child_count \u3092\u8DB3\u3057\u305F\u5E73\u3089\u306A\u914D\u5217\u3067\u3059\u3002\u30B5\u30FC\u30D0\u304C\u5BFE\u5FDC\u3057\u3066\u3044\u308C\u3070\u5192\u982D\u306E\u8981\u7D04 summary\uFF08\u5E73\u6587\u3067\u5148\u982D200\u6587\u5B57\uFF09\u3068\u672C\u6587\u306E\u6587\u5B57\u6570 content_length \u304C\u5165\u308A\u307E\u3059\uFF09\u3002\u672C\u6587\u306F twp wiki get \u3067\u8AAD\u3081\u307E\u3059\u3002
108
- \u4E0B\u66F8\u304D\u306F\u4F5C\u6210\u8005\u3068 wiki \u306E\u7BA1\u7406\u8005\u306B\u3057\u304B\u898B\u3048\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u306E\u5224\u5B9A\uFF09\u3002`,flags:[projectFlag],async prepare(input,ctx){noArgs(input,"twp wiki tree");return withResolved(input,{project:await ctx.projectId(input.flags.get("--project"))})},plan:input=>({method:"GET",path:`${WIKI_PATH}/tree`,query:wikiTreeQuery(input)}),summarize:body=>flattenTree(body).map(row=>pick(row,WIKI_TREE_COLUMNS)),raw:flattenTree,
109
- document:treeDocument};var wikiTagList={name:"tags",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E${WIKI_LABEL}\u306B\u4ED8\u3044\u3066\u3044\u308B\u30BF\u30B0\u3092\u51FA\u3059`,usage:"twp wiki tags [--project <\u30B3\u30FC\u30C9|ID>]",description:"\u516C\u958B\uFF08published\uFF09\u306E\u30DA\u30FC\u30B8\u306B\u4ED8\u3044\u305F\u30BF\u30B0\u3092\u3001\u4ED8\u3044\u3066\u3044\u308B\u30DA\u30FC\u30B8\u306E\u591A\u3044\u9806\u306B\u6700\u592750\u4EF6\u51FA\u3057\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u4ED5\u69D8\u3002\u4EF6\u6570\u306F\u8FD4\u308A\u307E\u305B\u3093\uFF09\u3002\n\u4E0B\u66F8\u304D\u306B\u3060\u3051\u4ED8\u3044\u305F\u30BF\u30B0\u306F\u51FA\u307E\u305B\u3093\u3002\u30BF\u30B0\u3067\u30DA\u30FC\u30B8\u3092\u7D5E\u308B\u306A\u3089 twp wiki list --tag <\u30BF\u30B0> \u3067\u3059\u3002",
110
- flags:[projectFlag],async prepare(input,ctx){noArgs(input,"twp wiki tags");return withResolved(input,{project:await ctx.projectId(input.flags.get("--project"))})},plan:input=>({method:"GET",path:`${WIKI_PATH}/tags`,query:{project_id:requireResolved(input,"project")}}),summarize:body=>arrayField(body,"tags",`${WIKI_LABEL}\u306E\u30BF\u30B0`).map(tag=>({tag})),raw:body=>arrayField(body,"tags",`${WIKI_LABEL}\u306E\u30BF\u30B0`),notes:body=>arrayField(body,"tags",`${WIKI_LABEL}\u306E\u30BF\u30B0`).length>=
111
- WIKI_TAGS_MAX?[`\u30B5\u30FC\u30D0\u304C\u8FD4\u3059\u30BF\u30B0\u306E\u4E0A\u9650\uFF08${WIKI_TAGS_MAX}\u4EF6\uFF09\u306B\u9054\u3057\u307E\u3057\u305F\u3002\u3053\u308C\u3088\u308A\u5C11\u306A\u3044\u30DA\u30FC\u30B8\u306B\u3060\u3051\u4ED8\u3044\u305F\u30BF\u30B0\u306F\u51FA\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002`]:[]};var WIKI_DIGEST_USAGE="twp wiki digest [--project <\u30B3\u30FC\u30C9|ID>] [--parent <\u30DA\u30FC\u30B8ID>] [--tag <\u30BF\u30B0>] [--max-chars <\u6587\u5B57\u6570>]";
109
+ \u4E0B\u66F8\u304D\u306F\u4F5C\u6210\u8005\u3068 wiki \u306E\u7BA1\u7406\u8005\u306B\u3057\u304B\u898B\u3048\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u306E\u5224\u5B9A\uFF09\u3002`,flags:[projectFlag],async prepare(input,ctx){noArgs(input,"twp wiki tree");return withResolved(input,{project:await wikiProjectId(ctx,input.flags.get("--project"))})},plan:input=>({method:"GET",path:`${WIKI_PATH}/tree`,query:wikiTreeQuery(input)}),summarize:body=>flattenTree(body).map(row=>pick(row,WIKI_TREE_COLUMNS)),
110
+ raw:flattenTree,document:treeDocument};var wikiTagList={name:"tags",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E${WIKI_LABEL}\u306B\u4ED8\u3044\u3066\u3044\u308B\u30BF\u30B0\u3092\u51FA\u3059`,usage:"twp wiki tags [--project <\u30B3\u30FC\u30C9|ID|__private__>]",description:"\u516C\u958B\uFF08published\uFF09\u306E\u30DA\u30FC\u30B8\u306B\u4ED8\u3044\u305F\u30BF\u30B0\u3092\u3001\u4ED8\u3044\u3066\u3044\u308B\u30DA\u30FC\u30B8\u306E\u591A\u3044\u9806\u306B\u6700\u592750\u4EF6\u51FA\u3057\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u4ED5\u69D8\u3002\u4EF6\u6570\u306F\u8FD4\u308A\u307E\u305B\u3093\uFF09\u3002\n\u4E0B\u66F8\u304D\u306B\u3060\u3051\u4ED8\u3044\u305F\u30BF\u30B0\u306F\u51FA\u307E\u305B\u3093\u3002\u30BF\u30B0\u3067\u30DA\u30FC\u30B8\u3092\u7D5E\u308B\u306A\u3089 twp wiki list --tag <\u30BF\u30B0> \u3067\u3059\u3002",
111
+ flags:[projectFlag],async prepare(input,ctx){noArgs(input,"twp wiki tags");return withResolved(input,{project:await wikiProjectId(ctx,input.flags.get("--project"))})},plan:input=>({method:"GET",path:`${WIKI_PATH}/tags`,query:{project_id:requireResolved(input,"project")}}),summarize:body=>arrayField(body,"tags",`${WIKI_LABEL}\u306E\u30BF\u30B0`).map(tag=>({tag})),raw:body=>arrayField(body,"tags",`${WIKI_LABEL}\u306E\u30BF\u30B0`),notes:body=>arrayField(body,"tags",`${WIKI_LABEL}\u306E\u30BF\u30B0`).
112
+ length>=WIKI_TAGS_MAX?[`\u30B5\u30FC\u30D0\u304C\u8FD4\u3059\u30BF\u30B0\u306E\u4E0A\u9650\uFF08${WIKI_TAGS_MAX}\u4EF6\uFF09\u306B\u9054\u3057\u307E\u3057\u305F\u3002\u3053\u308C\u3088\u308A\u5C11\u306A\u3044\u30DA\u30FC\u30B8\u306B\u3060\u3051\u4ED8\u3044\u305F\u30BF\u30B0\u306F\u51FA\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002`]:[]};var WIKI_DIGEST_USAGE="twp wiki digest [--project <\u30B3\u30FC\u30C9|ID|__private__>] [--parent <\u30DA\u30FC\u30B8ID>] [--tag <\u30BF\u30B0>] [--max-chars <\u6587\u5B57\u6570>]";
112
113
  var WIKI_DIGEST_SUMMARY_MAX=200;var WIKI_DIGEST_COLUMNS=["id","title","summary","tags","version","updated_at"];function digestSummary(content,format){const paragraphs=wikiContentToText(content,format).split(/\n\s*\n/);const isHeadingOrImage=line=>/^#{1,6}\s/.test(line)||/^!\[[^\]]*\]\([^)]*\)$/.test(line);const first=paragraphs.map(paragraph=>{const lines=paragraph.split("\n").map(line=>line.trim()).filter(line=>line!=="");const start=lines.findIndex(line=>!isHeadingOrImage(line));return start<0?
113
114
  []:lines.slice(start)}).find(lines=>lines.length>0);if(first===void 0)return"";const text2=oneLine(first.join("\n"));const chars=[...text2];return chars.length>WIKI_DIGEST_SUMMARY_MAX?`${chars.slice(0,WIKI_DIGEST_SUMMARY_MAX-1).join("")}\u2026`:text2}function digestParent(input){const raw=nonEmpty(input.flags,"--parent");if(raw===void 0)return void 0;const parent=raw.trim();if(parent!==ROOT_PARENT&&!isSafePathSegment(parent)){throw new UsageError(`\u89AA\u30DA\u30FC\u30B8\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${parent}`,
114
115
  "\u30DA\u30FC\u30B8\u306E ID \u306F twp wiki tree \u306E id \u5217\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002")}return parent===ROOT_PARENT?void 0:parent}function digestEntry(page){const meta=[`id: ${page.id}`,...metaLine("\u7248",page.version),...metaLine("\u66F4\u65B0",page.updated_at),...metaLine("\u30BF\u30B0",page.tags),...page.status==="draft"?["\u72B6\u614B: draft"]:[]].join(" \u30FB ");return[`## ${page.title}`,meta,...page.summary===""?[]:[page.summary]].join("\n")}function digestOmittedLine(omitted,maxChars){
@@ -124,8 +125,9 @@ id:String(row["id"]),title,summary:digestSummary(row["content"],row["content_for
124
125
  --max-chars <\u6587\u5B57\u6570> \u306F --output text \u306E\u51FA\u529B\u5168\u4F53\u306E\u6587\u5B57\u6570\u306E\u4E0A\u9650\u3067\u3059\u3002\u53CE\u307E\u3089\u306A\u3044\u30DA\u30FC\u30B8\u306F\u4E26\u3073\u306E\u5F8C\u308D\u304B\u3089\u843D\u3068\u3057\u3001\u843D\u3068\u3057\u305F\u4EF6\u6570\u3092\u300C\u7701\u7565 N \u4EF6\u300D\u3068\u3057\u3066\u5FC5\u305A\u51FA\u3057\u307E\u3059\uFF08text \u306F\u672B\u5C3E\u306E\u884C\u3001json \u306F omitted\u3001table / tsv \u306F stderr\uFF09\u30021\u4EF6\u3082\u53CE\u307E\u3089\u306A\u3044\u4E0A\u9650\u3067\u3082\u7701\u7565\u306E\u884C\u306F\u51FA\u3057\u307E\u3059\uFF08\u305D\u306E\u5834\u5408\u3060\u3051\u4E0A\u9650\u3092\u8D85\u3048\u307E\u3059\uFF09\u3002json / table / tsv \u306F text \u3068\u540C\u3058\u30DA\u30FC\u30B8\u3060\u3051\u3092\u51FA\u3057\u307E\u3059\u304C\u3001\u6587\u5B57\u6570\u306E\u4E0A\u9650\u305D\u306E\u3082\u306E\u306F text \u306B\u3060\u3051\u5F53\u305F\u308A\u307E\u3059\u3002
125
126
  --tag \u306F\u30BF\u30B0\u306E\u5B8C\u5168\u4E00\u81F4\u3067\u3059\u3002--parent root \u306F\u5168\u30DA\u30FC\u30B8\uFF08\u7D5E\u3089\u306A\u3044\u306E\u3068\u540C\u3058\uFF09\u3067\u3059\u3002
126
127
  \u4E0B\u66F8\u304D\u306F\u4F5C\u6210\u8005\u3068 wiki \u306E\u7BA1\u7406\u8005\u306B\u3057\u304B\u898B\u3048\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u306E\u5224\u5B9A\uFF09\u3002`,flags:[projectFlag,{name:"--parent",summary:"\u89AA\u30DA\u30FC\u30B8\u306E ID\uFF08\u305D\u306E\u914D\u4E0B\u3060\u3051\u3092\u51FA\u3059\uFF09",takesValue:true,placeholder:"<\u30DA\u30FC\u30B8ID>"},{name:"--tag",summary:"\u3053\u306E\u30BF\u30B0\u304C\u4ED8\u3044\u305F\u30DA\u30FC\u30B8\u3060\u3051\u3092\u51FA\u3059",
127
- takesValue:true,placeholder:"<\u30BF\u30B0>"},{name:"--max-chars",summary:"--output text \u306E\u51FA\u529B\u5168\u4F53\u306E\u6587\u5B57\u6570\u306E\u4E0A\u9650\uFF08\u8D85\u3048\u308B\u5206\u306F\u300C\u7701\u7565 N \u4EF6\u300D\u3068\u51FA\u3059\uFF09",takesValue:true,placeholder:"<\u6587\u5B57\u6570>"}],async prepare(input,ctx){noArgs(input,"twp wiki digest");digestParent(input);positiveInteger(input.flags,"--max-chars");return withResolved(input,{project:await ctx.projectId(input.flags.get(
128
- "--project"))})},plan:input=>({method:"GET",path:`${WIKI_PATH}/tree`,query:{project_id:requireResolved(input,"project")}}),narrow:(body,input)=>({result:true,digest:fitDigest(digestPages(body,input),positiveInteger(input.flags,"--max-chars")??null)}),summarize:body=>digestOf(body).pages.map(page=>pick({...page,tags:page.tags.join(", ")},WIKI_DIGEST_COLUMNS)),raw:body=>digestOf(body),document:body=>{const digest=digestOf(body);return`${digestText(digest.pages,digest.omitted,digest.max_chars)}
128
+ takesValue:true,placeholder:"<\u30BF\u30B0>"},{name:"--max-chars",summary:"--output text \u306E\u51FA\u529B\u5168\u4F53\u306E\u6587\u5B57\u6570\u306E\u4E0A\u9650\uFF08\u8D85\u3048\u308B\u5206\u306F\u300C\u7701\u7565 N \u4EF6\u300D\u3068\u51FA\u3059\uFF09",takesValue:true,placeholder:"<\u6587\u5B57\u6570>"}],async prepare(input,ctx){noArgs(input,"twp wiki digest");digestParent(input);positiveInteger(input.flags,"--max-chars");return withResolved(input,{project:await wikiProjectId(ctx,input.flags.
129
+ get("--project"))})},plan:input=>({method:"GET",path:`${WIKI_PATH}/tree`,query:{project_id:requireResolved(input,"project")}}),narrow:(body,input)=>({result:true,digest:fitDigest(digestPages(body,input),positiveInteger(input.flags,"--max-chars")??null)}),summarize:body=>digestOf(body).pages.map(page=>pick({...page,tags:page.tags.join(", ")},WIKI_DIGEST_COLUMNS)),raw:body=>digestOf(body),document:body=>{const digest=digestOf(body);return`${digestText(digest.pages,digest.omitted,digest.max_chars)}\
130
+
129
131
  `},notes:body=>{const digest=digestOf(body);return digest.omitted>0&&digest.max_chars!==null?[`${digest.total} \u4EF6\u4E2D ${digest.omitted} \u4EF6\u3092\u7701\u7565\u3057\u307E\u3057\u305F\uFF08--max-chars ${digest.max_chars} \u306B\u53CE\u307E\u3089\u306A\u3044\u305F\u3081\uFF09\u3002`]:[]}};var WIKI_VERSIONS_USAGE="twp wiki versions <\u30DA\u30FC\u30B8ID> [--limit <\u4EF6\u6570>]";function versionsLimit(input){const limit=positiveInteger(input.flags,"--limit");if(limit!==void 0&&limit>WIKI_VERSIONS_MAX){
130
132
  throw new UsageError(`--limit \u306F 1\u301C${WIKI_VERSIONS_MAX} \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${limit}`,`\u30B5\u30FC\u30D0\u304C\u8FD4\u3059\u7248\u306E\u5C65\u6B74\u306F\u65B0\u3057\u3044\u9806\u306B\u6700\u5927${WIKI_VERSIONS_MAX}\u4EF6\u3067\u3059\u3002`)}return limit}var wikiVersions={name:"versions",summary:`${WIKI_LABEL}\u306E\u7248\u306E\u5C65\u6B74\u3092\u65B0\u3057\u3044\u9806\u306B\u51FA\u3059`,usage:WIKI_VERSIONS_USAGE,description:`\u7248\u306F\u672C\u6587\u304B\u4EF6\u540D\u3092\u5909\u3048\u305F\u3068\u304D\u306B1\u3064\u4E0A\u304C\u308A\u307E\u3059\u3002\u65E2\u5B9A\u306F\
131
133
  \u65B0\u3057\u3044\u9806\u306B20\u4EF6\u3001--limit \u3067\u6700\u5927${WIKI_VERSIONS_MAX}\u4EF6\u3067\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u4E0A\u9650\u3002\u305D\u308C\u3088\u308A\u53E4\u3044\u7248\u306F\u4E00\u89A7\u306B\u51FA\u307E\u305B\u3093\u304C\u3001\u7248\u756A\u53F7\u304C\u5206\u304B\u308C\u3070 twp wiki version \u3067\u8AAD\u3081\u307E\u3059\uFF09\u3002
@@ -158,8 +160,8 @@ twp wiki linked-tasks <\u30DA\u30FC\u30B8ID>",description:`\u30BF\u30B9\u30AF\u5
158
160
  status_id \u306F\u30BF\u30B9\u30AF\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u306E ID \u3067\u3059\uFF08\u540D\u524D\u306F twp task status list \u3067\u5F15\u3051\u307E\u3059\uFF09\u3002
159
161
 
160
162
  --output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${WIKI_LINKED_TASK_COLUMNS.join(" / ")}\uFF09\u3001--output json \u306F\u30EA\u30F3\u30AF\u306E\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08task \u306E\u5165\u308C\u5B50\u3092\u542B\u3080\uFF09\u3067\u3059\u3002`,flags:[],plan:input=>({method:"GET",path:`${WIKI_PATH}/${encodeURIComponent(singleId(input,"twp wiki linked-tasks","\u30DA\u30FC\u30B8","twp wiki list"))}/linked-tasks`}),summarize:body=>arrayField(body,"linked_tasks",`${WIKI_LABEL}\
161
- \u306E\u95A2\u9023\u30BF\u30B9\u30AF`).map(linkedTaskRow),raw:body=>arrayField(body,"linked_tasks",`${WIKI_LABEL}\u306E\u95A2\u9023\u30BF\u30B9\u30AF`)};var WIKI_CONTENT_MAX_CHARS=4e5;var WIKI_TITLE_MAX_CHARS=255;var WIKI_TAG_MAX_CHARS=50;var WIKI_CREATE_USAGE="twp wiki create --project <\u30B3\u30FC\u30C9|ID> --title <\u4EF6\u540D> --content-file <\u30D1\u30B9|-> [--content-format <html|markdown>] [--parent <\u30DA\u30FC\u30B8ID>] [--status <draft|published>] [--tag <\u30BF\u30B0>]... [--verified-at <\u65E5\u4ED8|today>] [--evidence-task <\u30AD\u30FC>]... [--kind <\u7A2E\u5225>]";
162
- var WIKI_UPDATE_USAGE="twp wiki update <\u30DA\u30FC\u30B8ID> [--title <\u4EF6\u540D>] [--content-file <\u30D1\u30B9|->] [--content-format <html|markdown>] [--status <draft|published>] [--tag <\u30BF\u30B0>]... [--clear-tags] [--verified-at <\u65E5\u4ED8|today>|--clear-verified-at] [--evidence-task <\u30AD\u30FC>...|--clear-evidence-tasks] [--kind <\u7A2E\u5225>|--clear-kind] [--if-version <\u7248>]\n twp wiki update <\u30DA\u30FC\u30B8ID> --section <\u898B\u51FA\u3057> --content-file <\u30D1\u30B9|-> [--if-version <\u7248>]";
163
+ \u306E\u95A2\u9023\u30BF\u30B9\u30AF`).map(linkedTaskRow),raw:body=>arrayField(body,"linked_tasks",`${WIKI_LABEL}\u306E\u95A2\u9023\u30BF\u30B9\u30AF`)};var WIKI_CONTENT_MAX_CHARS=4e5;var WIKI_TITLE_MAX_CHARS=255;var WIKI_TAG_MAX_CHARS=50;var WIKI_CREATE_USAGE="twp wiki create --project <\u30B3\u30FC\u30C9|ID|__private__> --title <\u4EF6\u540D> --content-file <\u30D1\u30B9|-> [--content-format <html|markdown>] [--parent <\u30DA\u30FC\u30B8ID>] [--status <draft|published>] [--tag <\u30BF\u30B0>]... [--verified-at <\u65E5\u4ED8|today>] [--evidence-task <\u30AD\u30FC>]... [--k\
164
+ ind <\u7A2E\u5225>]";var WIKI_UPDATE_USAGE="twp wiki update <\u30DA\u30FC\u30B8ID> [--title <\u4EF6\u540D>] [--content-file <\u30D1\u30B9|->] [--content-format <html|markdown>] [--status <draft|published>] [--tag <\u30BF\u30B0>]... [--clear-tags] [--verified-at <\u65E5\u4ED8|today>|--clear-verified-at] [--evidence-task <\u30AD\u30FC>...|--clear-evidence-tasks] [--kind <\u7A2E\u5225>|--clear-kind] [--if-version <\u7248>]\n twp wiki update <\u30DA\u30FC\u30B8ID> --section <\u898B\u51FA\u3057> --content-file <\u30D1\u30B9|-> [--if-version <\u7248>]";
163
165
  var WIKI_APPEND_USAGE="twp wiki append <\u30DA\u30FC\u30B8ID> --content-file <\u30D1\u30B9|-> [--if-version <\u7248>]";var WIKI_MOVE_USAGE="twp wiki move <\u30DA\u30FC\u30B8ID> [--parent <\u30DA\u30FC\u30B8ID>|root] [--sort-order <\u9806>]";var CONTENT_FILE_FLAG={name:"--content-file",summary:"\u672C\u6587\u3092\u8AAD\u3080\u30D5\u30A1\u30A4\u30EB\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09\u3002\u52A0\u5DE5\u305B\u305A\u306B\u9001\u308B",takesValue:true,placeholder:"<\u30D1\u30B9|->"};var WIKI_CONTENT_FORMAT_FLAG={
164
166
  name:"--content-format",summary:`\u672C\u6587\u306E\u5F62\u5F0F\uFF08${WIKI_CONTENT_FORMATS.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u5F62\u5F0F>"};var WIKI_FORMAT_BY_EXTENSION={".md":"markdown",".markdown":"markdown",".html":"html",".htm":"html"};function inferredWikiFormat(input){if(input.flags.has("--content-format"))return void 0;const file=input.flags.get("--content-file");if(file===void 0||file==="-")return void 0;const extension=path.extname(file).toLowerCase();const format=WIKI_FORMAT_BY_EXTENSION[extension];
165
167
  return format===void 0?void 0:{format,extension}}var WIKI_STATUS_FLAG={name:"--status",summary:`\u72B6\u614B\uFF08${WIKI_STATUSES.join(" / ")}\uFF09`,takesValue:true,placeholder:"<\u72B6\u614B>"};var WIKI_TAG_FLAG={name:"--tag",summary:`\u30BF\u30B0\uFF08\u8907\u6570\u56DE\u53EF\u30FB${WIKI_TAG_MAX_CHARS}\u6587\u5B57\u4EE5\u5185\uFF09`,takesValue:true,placeholder:"<\u30BF\u30B0>",repeatable:true};var WIKI_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\n\u672C\u6587\u306E\u5F62\u5F0F\u306F --cont\
@@ -186,20 +188,20 @@ ${WIKI_FRESHNESS_HELP}
186
188
  twp wiki create --project TWP --title \u904B\u7528\u624B\u9806 --content-file notes.html --status published --tag \u904B\u7528
187
189
  twp wiki create --project TWP --title \u843D\u3068\u3057\u7A74 --content-file notes.md --content-format markdown --verified-at today --evidence-task PRJ-123 --kind \u843D\u3068\u3057\u7A74
188
190
  twp wiki create --project TWP --title \u904B\u7528\u624B\u9806 --content-file notes.md # \u62E1\u5F35\u5B50\u304B\u3089 markdown
189
- cat page.html | twp wiki create --title \u4E0B\u66F8\u304D --content-file - --dry-run`,flags:[{name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF09",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"},{name:"--title",summary:`\u4EF6\u540D\uFF08\u5FC5\u9808\u30FB${WIKI_TITLE_MAX_CHARS}\u6587\u5B57\u4EE5\u5185\uFF09`,takesValue:true,placeholder:"<\u4EF6\u540D>"},
190
- CONTENT_FILE_FLAG,WIKI_CONTENT_FORMAT_FLAG,{name:"--parent",summary:"\u89AA\u30DA\u30FC\u30B8\u306E ID\uFF08\u7701\u7565\u6642\u306F\u6700\u4E0A\u4F4D\uFF09",takesValue:true,placeholder:"<\u30DA\u30FC\u30B8ID>"},WIKI_STATUS_FLAG,WIKI_TAG_FLAG,...WIKI_FRESHNESS_FLAGS],async prepare(input,ctx){noArgs(input,"twp wiki create");if(wikiTitle(input)===void 0)throw new UsageError("--title \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",WIKI_CREATE_USAGE);oneOf(input,"--status",WIKI_STATUSES);oneOf(
191
- input,"--content-format",WIKI_CONTENT_FORMATS);wikiTags(input);wikiParent(input,false);wikiFreshnessBody(input);const content=await wikiContent(input,WIKI_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",WIKI_CREATE_USAGE);return withResolved(input,{project:await ctx.projectId(input.flags.get("--project")),content})},plan(input){const parent=wikiParent(input,
192
- false);const contentFormat=oneOf(input,"--content-format",WIKI_CONTENT_FORMATS)??inferredWikiFormat(input)?.format;return{method:"POST",path:WIKI_PATH,body:{project_id:requireResolved(input,"project"),title:wikiTitle(input),content:requireResolved(input,"content"),...contentFormat!==void 0?{content_format:contentFormat}:{},...oneOf(input,"--status",WIKI_STATUSES)!==void 0?{status:oneOf(input,"--status",WIKI_STATUSES)}:{},...parent!==void 0?{parent_page_id:parent}:{},...wikiTags(input)!==void 0?{
193
- tags:wikiTags(input)}:{},...wikiFreshnessBody(input)}}},plannedNotes:input=>[...input.flags.has("--status")?[]:["--status \u3092\u7701\u3044\u305F\u306E\u3067\u4E0B\u66F8\u304D\uFF08draft\uFF09\u3067\u4F5C\u308A\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u65E2\u5B9A\uFF09\u3002"],...wikiCreateFormatNotes(input)],summarize:body=>pick(pageFrom(body),WIKI_GET_COLUMNS),raw:pageFrom};function wikiCreateFormatNotes(input){if(input.flags.has("--content-format"))return[];const inferred=inferredWikiFormat(
194
- input);if(inferred!==void 0){return[`--content-format \u3092\u7701\u3044\u305F\u306E\u3067\u3001--content-file \u306E\u62E1\u5F35\u5B50\uFF08${inferred.extension}\uFF09\u304B\u3089 ${inferred.format} \u306E\u30DA\u30FC\u30B8\u3068\u3057\u3066\u4F5C\u308A\u307E\u3059\u3002\u9055\u3046\u5F62\u5F0F\u306B\u3059\u308B\u306A\u3089 --content-format \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`]}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\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u65E2\u5B9A\u306E\u5F62\u5F0F\u3067\u4F5C\u308A\u307E\u3059\uFF08\u672A\u8A2D\u5B9A\u306A\u3089 HTML\u3002twp projec\
195
- t get \u306E wiki_default_content_format \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\uFF09\u3002"]}async function previewWikiUpdate(input,ctx){return previewWikiWrite(input,ctx,"twp wiki update")}async function previewWikiWrite(input,ctx,command){const expected=positiveInteger(input.flags,"--if-version");const inferred=inferredWikiFormat(input);if(expected===void 0&&inferred===void 0)return{notes:[],warnings:[]};const id=singleId(input,command,"\u30DA\u30FC\u30B8","twp wiki list");const page=pageFrom(
196
- await ctx.send({method:"GET",path:`${WIKI_PATH}/${encodeURIComponent(id)}`}));const notes=[];if(expected!==void 0){const current=page["version"];if(current!==expected){throw new ApiRejectedError(`\u30DA\u30FC\u30B8 ${id} \u306E\u7248\u304C ${String(current)} \u3067\u3059\uFF08--if-version ${expected}\uFF09\u3002\u4ED6\u306E\u66F4\u65B0\u3068\u885D\u7A81\u3057\u305F\u306E\u3067\u4F55\u3082\u9001\u3063\u3066\u3044\u307E\u305B\u3093\u3002twp wiki get \u3067\u6700\u65B0\u306E\u672C\u6587\u3092\u8AAD\u307F\u3001\u53CD\u6620\u3057\u76F4\u3057\u3066\u304B\u3089 --if-version \u3092\u4ED8\u3051\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
197
- notes.push(`\u7248 ${expected} \u3092\u78BA\u8A8D\u3057\u307E\u3057\u305F\uFF08\u7248\u7167\u5408\u306B\u5BFE\u5FDC\u3057\u305F\u30B5\u30FC\u30D0\u3067\u306F\u9001\u4FE1\u6642\u306B\u3082\u7167\u5408\u3057\u3001\u9593\u306B\u4ED6\u306E\u66F4\u65B0\u304C\u3042\u308C\u3070 409 \u3067\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002`)}if(inferred!==void 0){const pageFormat=typeof page["content_format"]==="string"&&page["content_format"]!==""?page["content_format"]:"html";if(pageFormat!==inferred.format){throw new ApiRejectedError(
198
- `\u30DA\u30FC\u30B8 ${id} \u306E\u5F62\u5F0F\u306F ${pageFormat} \u3067\u3059\u304C\u3001--content-file \u306E\u62E1\u5F35\u5B50\uFF08${inferred.extension}\uFF09\u306F ${inferred.format} \u3067\u3059\u3002\u4F55\u3082\u9001\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u30DA\u30FC\u30B8\u306E\u5F62\u5F0F\u306F\u4F5C\u6210\u5F8C\u306B\u5909\u3048\u3089\u308C\u307E\u305B\u3093\u3002\u672C\u6587\u3092 ${pageFormat} \u3067\u66F8\u304D\u76F4\u3059\u304B\u3001${inferred.format} \u3067\u65B0\u3057\u3044\u30DA\u30FC\u30B8\u3092\u4F5C\u3063\u3066\u304F\u3060\u3055\u3044\uFF08\u3053\u306E\u672C\u6587\u3092\u305D\u306E\u307E\u307E\u9001\u308B\
199
- \u306A\u3089 --content-format ${pageFormat} \u3092\u660E\u793A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09\u3002`)}notes.push(`--content-file \u306E\u62E1\u5F35\u5B50\uFF08${inferred.extension}\uFF09\u304C\u30DA\u30FC\u30B8\u306E\u5F62\u5F0F\uFF08${pageFormat}\uFF09\u3068\u4E00\u81F4\u3059\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u307E\u3057\u305F\u3002`)}return{notes,warnings:[]}}var WIKI_SECTION_FLAG={name:"--section",summary:"\u3053\u306E\u898B\u51FA\u3057\u306E\u7BC0\u306E\u672C\u6587\u3060\u3051\u3092\u5DEE\u3057\u66FF\u3048\u308B\uFF08--content-file \u3068 --if-version \u3060\u3051\u3068\u4F75\u7528\u3067\u304D\u308B\uFF09",
200
- takesValue:true,placeholder:"<\u898B\u51FA\u3057>"};var WIKI_PARTIAL_COLUMNS=["id","title","version","content_format","updated_at"];function wikiSectionHeading(input){const raw=input.flags.get("--section");if(raw===void 0)return void 0;if(raw.trim().replace(/^#+/,"").trim()===""){throw new UsageError("--section \u306B\u898B\u51FA\u3057\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044","\u898B\u51FA\u3057\u306F twp wiki get <\u30DA\u30FC\u30B8ID> --outline \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002")}
201
- return raw}var WIKI_PARTIAL_EXCLUSIVE_FLAGS=["--title","--content-format","--status","--tag","--clear-tags","--verified-at","--clear-verified-at","--evidence-task","--clear-evidence-tasks","--kind","--clear-kind"];async function prepareWikiPartial(input,usage){const extra=WIKI_PARTIAL_EXCLUSIVE_FLAGS.filter(flag=>input.flags.has(flag));if(extra.length>0){throw new UsageError(`--section \u3068 ${extra.join(" / ")} \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u7BC0\u306E\u5DEE\u3057\u66FF\u3048\u3067\u306F\u672C\u6587\uFF08--c\
202
- ontent-file\uFF09\u3068 --if-version \u3060\u3051\u3092\u9001\u308A\u307E\u3059\u3002
191
+ cat page.html | twp wiki create --title \u4E0B\u66F8\u304D --content-file - --dry-run`,flags:[{name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\u3002\u7701\u7565\u6642\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3002__private__ \u3067\u81EA\u5206\u3060\u3051\u306E\u500B\u4EBA wiki\uFF09",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID|__private__>"},{name:"--title",summary:`\u4EF6\u540D\uFF08\u5FC5\u9808\u30FB${WIKI_TITLE_MAX_CHARS}\
192
+ \u6587\u5B57\u4EE5\u5185\uFF09`,takesValue:true,placeholder:"<\u4EF6\u540D>"},CONTENT_FILE_FLAG,WIKI_CONTENT_FORMAT_FLAG,{name:"--parent",summary:"\u89AA\u30DA\u30FC\u30B8\u306E ID\uFF08\u7701\u7565\u6642\u306F\u6700\u4E0A\u4F4D\uFF09",takesValue:true,placeholder:"<\u30DA\u30FC\u30B8ID>"},WIKI_STATUS_FLAG,WIKI_TAG_FLAG,...WIKI_FRESHNESS_FLAGS],async prepare(input,ctx){noArgs(input,"twp wiki create");if(wikiTitle(input)===void 0)throw new UsageError("--title \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",
193
+ WIKI_CREATE_USAGE);oneOf(input,"--status",WIKI_STATUSES);oneOf(input,"--content-format",WIKI_CONTENT_FORMATS);wikiTags(input);wikiParent(input,false);wikiFreshnessBody(input);const content=await wikiContent(input,WIKI_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",WIKI_CREATE_USAGE);return withResolved(input,{project:await wikiProjectId(ctx,input.flags.get(
194
+ "--project")),content})},plan(input){const parent=wikiParent(input,false);const contentFormat=oneOf(input,"--content-format",WIKI_CONTENT_FORMATS)??inferredWikiFormat(input)?.format;return{method:"POST",path:WIKI_PATH,body:{project_id:requireResolved(input,"project"),title:wikiTitle(input),content:requireResolved(input,"content"),...contentFormat!==void 0?{content_format:contentFormat}:{},...oneOf(input,"--status",WIKI_STATUSES)!==void 0?{status:oneOf(input,"--status",WIKI_STATUSES)}:{},...parent!==
195
+ void 0?{parent_page_id:parent}:{},...wikiTags(input)!==void 0?{tags:wikiTags(input)}:{},...wikiFreshnessBody(input)}}},plannedNotes:input=>[...input.flags.has("--status")?[]:["--status \u3092\u7701\u3044\u305F\u306E\u3067\u4E0B\u66F8\u304D\uFF08draft\uFF09\u3067\u4F5C\u308A\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u65E2\u5B9A\uFF09\u3002"],...wikiCreateFormatNotes(input)],summarize:body=>pick(pageFrom(body),WIKI_GET_COLUMNS),raw:pageFrom};function wikiCreateFormatNotes(input){if(input.flags.has(
196
+ "--content-format"))return[];const inferred=inferredWikiFormat(input);if(inferred!==void 0){return[`--content-format \u3092\u7701\u3044\u305F\u306E\u3067\u3001--content-file \u306E\u62E1\u5F35\u5B50\uFF08${inferred.extension}\uFF09\u304B\u3089 ${inferred.format} \u306E\u30DA\u30FC\u30B8\u3068\u3057\u3066\u4F5C\u308A\u307E\u3059\u3002\u9055\u3046\u5F62\u5F0F\u306B\u3059\u308B\u306A\u3089 --content-format \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`]}return["--content-format \u3092\u7701\u304D\u3001\u62E1\
197
+ \u5F35\u5B50\u304B\u3089\u3082\u5F62\u5F0F\u304C\u6C7A\u307E\u3089\u306A\u3044\u306E\u3067\u5F62\u5F0F\u3092\u9001\u308A\u307E\u305B\u3093\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u65E2\u5B9A\u306E\u5F62\u5F0F\u3067\u4F5C\u308A\u307E\u3059\uFF08\u672A\u8A2D\u5B9A\u306A\u3089 HTML\u3002twp project get \u306E wiki_default_content_format \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\uFF09\u3002"]}async function previewWikiUpdate(input,ctx){return previewWikiWrite(input,ctx,"twp wiki update")}async function previewWikiWrite(input,ctx,command){
198
+ const expected=positiveInteger(input.flags,"--if-version");const inferred=inferredWikiFormat(input);if(expected===void 0&&inferred===void 0)return{notes:[],warnings:[]};const id=singleId(input,command,"\u30DA\u30FC\u30B8","twp wiki list");const page=pageFrom(await ctx.send({method:"GET",path:`${WIKI_PATH}/${encodeURIComponent(id)}`}));const notes=[];if(expected!==void 0){const current=page["version"];if(current!==expected){throw new ApiRejectedError(`\u30DA\u30FC\u30B8 ${id} \u306E\u7248\u304C ${String(
199
+ current)} \u3067\u3059\uFF08--if-version ${expected}\uFF09\u3002\u4ED6\u306E\u66F4\u65B0\u3068\u885D\u7A81\u3057\u305F\u306E\u3067\u4F55\u3082\u9001\u3063\u3066\u3044\u307E\u305B\u3093\u3002twp wiki get \u3067\u6700\u65B0\u306E\u672C\u6587\u3092\u8AAD\u307F\u3001\u53CD\u6620\u3057\u76F4\u3057\u3066\u304B\u3089 --if-version \u3092\u4ED8\u3051\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}notes.push(`\u7248 ${expected} \u3092\u78BA\u8A8D\u3057\u307E\u3057\u305F\uFF08\u7248\u7167\u5408\u306B\u5BFE\u5FDC\u3057\u305F\u30B5\u30FC\u30D0\u3067\u306F\u9001\u4FE1\u6642\u306B\u3082\u7167\u5408\u3057\u3001\u9593\u306B\u4ED6\u306E\u66F4\u65B0\u304C\u3042\u308C\u3070 409 \u3067\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002`)}
200
+ if(inferred!==void 0){const pageFormat=typeof page["content_format"]==="string"&&page["content_format"]!==""?page["content_format"]:"html";if(pageFormat!==inferred.format){throw new ApiRejectedError(`\u30DA\u30FC\u30B8 ${id} \u306E\u5F62\u5F0F\u306F ${pageFormat} \u3067\u3059\u304C\u3001--content-file \u306E\u62E1\u5F35\u5B50\uFF08${inferred.extension}\uFF09\u306F ${inferred.format} \u3067\u3059\u3002\u4F55\u3082\u9001\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u30DA\u30FC\u30B8\u306E\u5F62\u5F0F\u306F\u4F5C\u6210\u5F8C\u306B\u5909\u3048\u3089\u308C\u307E\u305B\u3093\u3002\u672C\u6587\u3092 ${pageFormat}\
201
+ \u3067\u66F8\u304D\u76F4\u3059\u304B\u3001${inferred.format} \u3067\u65B0\u3057\u3044\u30DA\u30FC\u30B8\u3092\u4F5C\u3063\u3066\u304F\u3060\u3055\u3044\uFF08\u3053\u306E\u672C\u6587\u3092\u305D\u306E\u307E\u307E\u9001\u308B\u306A\u3089 --content-format ${pageFormat} \u3092\u660E\u793A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09\u3002`)}notes.push(`--content-file \u306E\u62E1\u5F35\u5B50\uFF08${inferred.extension}\uFF09\u304C\u30DA\u30FC\u30B8\u306E\u5F62\u5F0F\uFF08${pageFormat}\uFF09\u3068\u4E00\u81F4\u3059\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u307E\u3057\u305F\u3002`)}
202
+ return{notes,warnings:[]}}var WIKI_SECTION_FLAG={name:"--section",summary:"\u3053\u306E\u898B\u51FA\u3057\u306E\u7BC0\u306E\u672C\u6587\u3060\u3051\u3092\u5DEE\u3057\u66FF\u3048\u308B\uFF08--content-file \u3068 --if-version \u3060\u3051\u3068\u4F75\u7528\u3067\u304D\u308B\uFF09",takesValue:true,placeholder:"<\u898B\u51FA\u3057>"};var WIKI_PARTIAL_COLUMNS=["id","title","version","content_format","updated_at"];function wikiSectionHeading(input){const raw=input.flags.get("--section");if(raw===void 0)
203
+ return void 0;if(raw.trim().replace(/^#+/,"").trim()===""){throw new UsageError("--section \u306B\u898B\u51FA\u3057\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044","\u898B\u51FA\u3057\u306F twp wiki get <\u30DA\u30FC\u30B8ID> --outline \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002")}return raw}var WIKI_PARTIAL_EXCLUSIVE_FLAGS=["--title","--content-format","--status","--tag","--clear-tags","--verified-at","--clear-verified-at","--evidence-task","--clear-evidence-tasks","--kind","--clear\
204
+ -kind"];async function prepareWikiPartial(input,usage){const extra=WIKI_PARTIAL_EXCLUSIVE_FLAGS.filter(flag=>input.flags.has(flag));if(extra.length>0){throw new UsageError(`--section \u3068 ${extra.join(" / ")} \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u7BC0\u306E\u5DEE\u3057\u66FF\u3048\u3067\u306F\u672C\u6587\uFF08--content-file\uFF09\u3068 --if-version \u3060\u3051\u3092\u9001\u308A\u307E\u3059\u3002
203
205
  ${usage}`)}positiveInteger(input.flags,"--if-version");const content=await wikiContent(input,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",usage);return withResolved(input,{content})}function wikiPartialPlan(input,id,method,action,extra){const expectedVersion=positiveInteger(input.flags,"--if-version");return{method,path:`${WIKI_PATH}/${encodeURIComponent(id)}/${action}`,
204
206
  body:{...extra,content:input.resolved?.["content"],...expectedVersion!==void 0?{expected_version:expectedVersion}:{}}}}function wikiPartialResult(body){return record(body,"data",WIKI_LABEL)}var wikiUpdate={name:"update",summary:`${WIKI_LABEL}\u3092\u66F4\u65B0\u3059\u308B\uFF08\u4EF6\u540D\u30FB\u672C\u6587\u30FB\u72B6\u614B\u30FB\u30BF\u30B0\uFF09`,usage:WIKI_UPDATE_USAGE,description:`${WIKI_WRITE_HELP}
205
207
  \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 \u306F\u30BF\u30B0\u3092\u7A7A\u306B\u3057\u307E\u3059\u3002
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{isModeId,isPermissionModeId}from"./chunk-2LOT54OO.js";import{ORIENTATION_OPS}from"./chunk-NJL3H2BB.js";import{API_TOKEN,HELP_TOKEN,isDomainName}from"./chunk-KD4YXQOZ.js";import{BOOLEAN_FLAGS,dispatch,resolveRoute,rewriteQueueCommand}from"./chunk-AH4KHEAC.js";import{splitFlagToken}from"./chunk-OKATZ4SN.js";var TRIGGER_OPS=["list","show","push","delete","history","release"];var GLOBAL_FLAGS=new Set(["-h","--help","-v","--version","--profile","--output","--query","--dry-run","--debug","--yes","-y","--refresh","--quiet","-q"]);function quietFromEnv(env){const raw=env["TWP_QUIET"]?.trim().toLowerCase();return raw==="1"||raw==="true"}function parseArgv(rawArgv){const out={command:"tui",safe:false,daemon:false,forceRunner:false,stopForce:false,logoutForce:false,stopDrain:false,noTui:false,doctor:false,yes:false,skillAll:false,orientationArgs:[],includeStopped:false,planEmpty:false,
3
+ import{isModeId,isPermissionModeId}from"./chunk-2LOT54OO.js";import{ORIENTATION_OPS}from"./chunk-NJL3H2BB.js";import{API_TOKEN,HELP_TOKEN,isDomainName}from"./chunk-ZN7AEXEI.js";import{BOOLEAN_FLAGS,dispatch,resolveRoute,rewriteQueueCommand}from"./chunk-AH4KHEAC.js";import{splitFlagToken}from"./chunk-OKATZ4SN.js";var TRIGGER_OPS=["list","show","push","delete","history","release"];var GLOBAL_FLAGS=new Set(["-h","--help","-v","--version","--profile","--output","--query","--dry-run","--debug","--yes","-y","--refresh","--quiet","-q"]);function quietFromEnv(env){const raw=env["TWP_QUIET"]?.trim().toLowerCase();return raw==="1"||raw==="true"}function parseArgv(rawArgv){const out={command:"tui",safe:false,daemon:false,forceRunner:false,stopForce:false,logoutForce:false,stopDrain:false,noTui:false,doctor:false,yes:false,skillAll:false,orientationArgs:[],includeStopped:false,planEmpty:false,
4
4
  planCheck:false,noAiConfigFile:false,verbose:false,loginMethod:"browser",loginNoBrowser:false,promptFromStdin:false,domainArgv:[],domainHelp:false,dryRun:false,debug:false,refresh:false,quiet:false,unknown:[],allowedTools:[],disallowedTools:[]};const queue=rewriteQueueCommand(rawArgv);if(queue.moved!==void 0){out.movedCommand=queue.moved;return out}const argv=queue.argv;const route=resolveRoute(dispatch(argv));const consumed=new Set;const[firstIndex,secondIndex]=route.consumed;if(route.kind==="b\
5
5
  uiltin"){out.command=route.command;if(route.action!==void 0)out.taskLoopAction=route.action;for(const index of route.consumed)consumed.add(index)}else if(route.kind==="domain"){if(route.domain===HELP_TOKEN){if(route.operation===void 0){out.command="help";if(firstIndex!==void 0)consumed.add(firstIndex)}else if(isDomainName(route.operation)){out.command="domain";out.domain=route.operation;out.domainHelp=true;if(firstIndex!==void 0)consumed.add(firstIndex);if(secondIndex!==void 0)consumed.add(secondIndex)}else if(route.
6
6
  operation===API_TOKEN){out.command="api";out.domainHelp=true;if(firstIndex!==void 0)consumed.add(firstIndex);if(secondIndex!==void 0)consumed.add(secondIndex)}}else if(route.domain===API_TOKEN){out.command="api";if(firstIndex!==void 0)consumed.add(firstIndex)}else if(isDomainName(route.domain)){out.command="domain";out.domain=route.domain;if(route.operation!==void 0)out.operation=route.operation;for(const index of route.consumed)consumed.add(index)}}const hasSubcommandToken=route.kind==="builtin"||
@@ -1,13 +1,13 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{system32}from"./chunk-N2UVRM3Z.js";import{execFileSync}from"child_process";import fs from"fs";import path from"path";var DEFAULT_GRACE_MS=6e4;var InstanceLock=class{constructor(lockDir,opts={}){this.lockDir=lockDir;this.opts=opts}lockDir;opts;owned=null;acquire(){const mine=this.tryMkdir();if(mine)return{acquired:true,reason:"",note:null};const oldPid=this.readPid();if(oldPid!==null){if(this.isLoop(oldPid)){return{acquired:false,reason:`\u540C\u3058\u30DE\u30B7\u30F3\u3067\u5225\u306E task-loop \u304C\u7A3C\u50CD\u4E2D\u3067\u3059\uFF08pid=${oldPid} / \u30ED\u30C3\u30AF: ${this.lockDir}\uFF09`,note:null}}const note=`\
4
- \u30ED\u30C3\u30AF\u306EPID ${oldPid} \u306F\u5225\u306E\u30D7\u30ED\u30BB\u30B9\u306B\u518D\u5229\u7528\u3055\u308C\u3066\u3044\u307E\u3059\uFF08\u30EB\u30FC\u30D7\u3067\u306F\u306A\u3044\uFF09\u2192 \u6B8B\u9AB8\u3068\u3057\u3066\u5F15\u304D\u53D6\u308A\u307E\u3059`;return this.takeOver(note)}const age=this.lockAgeMs();const grace=this.opts.graceMs??DEFAULT_GRACE_MS;if(age===null||age<grace){return{acquired:false,reason:`\u30ED\u30C3\u30AF\u304C\u4F5C\u6210\u76F4\u5F8C\u306E\u305F\u3081\u5F85\u6A5F\u5074\u306B\u5012\u3057\u307E\u3059\uFF08\u30ED\u30C3\u30AF: ${this.
3
+ import{system32}from"./chunk-N2UVRM3Z.js";import{execFileSync}from"child_process";import fs from"fs";import path from"path";var DEFAULT_GRACE_MS=6e4;var InstanceLock=class{constructor(lockDir,opts={}){this.lockDir=lockDir;this.opts=opts}lockDir;opts;owned=null;acquire(){const mine=this.tryMkdir();if(mine)return{acquired:true,reason:"",note:null};const oldPid=this.readPid();if(oldPid!==null){if(this.isLoop(oldPid)){return{acquired:false,reason:`\u540C\u3058\u30DE\u30B7\u30F3\u3067\u5225\u306E ${this.opts.processLabel??"task-loop"} \u304C\u7A3C\u50CD\u4E2D\u3067\u3059\uFF08pid=${oldPid} / \u30ED\u30C3\u30AF: ${this.lockDir}\
4
+ \uFF09`,note:null}}const note=`\u30ED\u30C3\u30AF\u306EPID ${oldPid} \u306F\u5225\u306E\u30D7\u30ED\u30BB\u30B9\u306B\u518D\u5229\u7528\u3055\u308C\u3066\u3044\u307E\u3059\uFF08\u30EB\u30FC\u30D7\u3067\u306F\u306A\u3044\uFF09\u2192 \u6B8B\u9AB8\u3068\u3057\u3066\u5F15\u304D\u53D6\u308A\u307E\u3059`;return this.takeOver(note)}const age=this.lockAgeMs();const grace=this.opts.graceMs??DEFAULT_GRACE_MS;if(age===null||age<grace){return{acquired:false,reason:`\u30ED\u30C3\u30AF\u304C\u4F5C\u6210\u76F4\u5F8C\u306E\u305F\u3081\u5F85\u6A5F\u5074\u306B\u5012\u3057\u307E\u3059\uFF08\u30ED\u30C3\u30AF: ${this.
5
5
  lockDir}\uFF09`,note:null}}return this.takeOver(`\u30ED\u30C3\u30AF\u306B pid \u304C\u306A\u304F\u4F5C\u6210\u304B\u3089 ${Math.trunc(age/1e3)} \u79D2\u7D4C\u904E\u3057\u3066\u3044\u307E\u3059 \u2192 \u6B8B\u9AB8\u3068\u3057\u3066\u5F15\u304D\u53D6\u308A\u307E\u3059`)}release(){if(!this.owned)return;if(this.readPid()===process.pid){fs.rmSync(this.owned,{recursive:true,force:true})}this.owned=null}takeOver(note){fs.rmSync(this.lockDir,{recursive:true,force:true});if(this.tryMkdir())return{acquired:true,
6
6
  reason:"",note};return{acquired:false,reason:`\u30ED\u30C3\u30AF\u306E\u5F15\u304D\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08\u5225\u30D7\u30ED\u30BB\u30B9\u304C\u5148\u306B\u53D6\u5F97\u3057\u305F\u53EF\u80FD\u6027\uFF09: ${this.lockDir}`,note:null}}tryMkdir(){try{fs.mkdirSync(path.dirname(this.lockDir),{recursive:true,mode:448});fs.mkdirSync(this.lockDir,{mode:448})}catch{return false}try{fs.writeFileSync(path.join(this.lockDir,"pid"),`${process.pid}
7
- `)}catch{}this.owned=this.lockDir;return true}readPid(){try{const raw=fs.readFileSync(path.join(this.lockDir,"pid"),"utf8").split("\n")[0]?.trim();const pid=Number.parseInt(raw??"",10);return Number.isInteger(pid)&&pid>0?pid:null}catch{return null}}lockAgeMs(){try{const now=this.opts.now?.()??Date.now();return now-fs.statSync(this.lockDir).mtimeMs}catch{return null}}isLoop(pid){if(this.opts.isLoopProcess)return this.opts.isLoopProcess(pid);return defaultIsLoopProcess(pid)}};function defaultIsLoopProcess(pid,deps={}){
8
- try{process.kill(pid,0)}catch(err){const code=err.code;if(code==="EPERM")return true;return false}const cmdline=readCommandLine(pid,deps);if(cmdline===null)return true;return cmdline.includes("task-loop")}function readCommandLine(pid,deps={}){const platform=deps.platform??process.platform;const env=deps.env??process.env;const nonEmpty=v=>v.trim()===""?null:v;if(platform==="linux"){try{const read=deps.readProc??(p=>fs.readFileSync(`/proc/${p}/cmdline`,"utf8"));return nonEmpty(read(pid).replace(/\0/g,
9
- " "))}catch{return null}}const run=deps.run??((file,args)=>execFileSync(file,[...args],{encoding:"utf8",timeout:2e4,stdio:["ignore","pipe","ignore"],windowsHide:true}));if(platform==="win32"){const ps=system32(env,"WindowsPowerShell","v1.0","powershell.exe");if(ps===null)return null;try{const filter=`ProcessId=${String(Math.trunc(pid))}`;const cmd=`(Get-CimInstance Win32_Process -Filter "${filter}").CommandLine | Out-String -Width 32767`;return nonEmpty(run(ps,["-NoProfile","-NonInteractive","-C\
10
- ommand",cmd]))}catch{return null}}try{return nonEmpty(run("ps",["-ww","-p",String(Math.trunc(pid)),"-o","command="]))}catch{return null}}import fs2 from"fs";import path2 from"path";var LOCK_OWNER_FILE="owner.json";var MAX_OWNER_BYTES=4096;function lockOwnerPath(lockDir){return path2.join(lockDir,LOCK_OWNER_FILE)}function buildLockOwner(input){return{pid:input.pid,profile:input.profile,twp_home:path2.resolve(input.twpHome),project_ref:input.projectRef,project_id:input.projectId,started_at:(input.now??new Date).toISOString()}}function writeLockOwner(lockDir,owner){try{fs2.writeFileSync(lockOwnerPath(lockDir),`${JSON.stringify(owner)}\
7
+ `)}catch{}this.owned=this.lockDir;return true}readPid(){try{const raw=fs.readFileSync(path.join(this.lockDir,"pid"),"utf8").split("\n")[0]?.trim();const pid=Number.parseInt(raw??"",10);return Number.isInteger(pid)&&pid>0?pid:null}catch{return null}}lockAgeMs(){try{const now=this.opts.now?.()??Date.now();return now-fs.statSync(this.lockDir).mtimeMs}catch{return null}}isLoop(pid){if(this.opts.isLoopProcess)return this.opts.isLoopProcess(pid);return defaultIsLoopProcess(pid)}};function defaultIsLoopProcess(pid,deps={},marker="\
8
+ task-loop"){try{process.kill(pid,0)}catch(err){const code=err.code;if(code==="EPERM")return true;return false}const cmdline=readCommandLine(pid,deps);if(cmdline===null)return true;return cmdline.includes(marker)}function readCommandLine(pid,deps={}){const platform=deps.platform??process.platform;const env=deps.env??process.env;const nonEmpty=v=>v.trim()===""?null:v;if(platform==="linux"){try{const read=deps.readProc??(p=>fs.readFileSync(`/proc/${p}/cmdline`,"utf8"));return nonEmpty(read(pid).replace(
9
+ /\0/g," "))}catch{return null}}const run=deps.run??((file,args)=>execFileSync(file,[...args],{encoding:"utf8",timeout:2e4,stdio:["ignore","pipe","ignore"],windowsHide:true}));if(platform==="win32"){const ps=system32(env,"WindowsPowerShell","v1.0","powershell.exe");if(ps===null)return null;try{const filter=`ProcessId=${String(Math.trunc(pid))}`;const cmd=`(Get-CimInstance Win32_Process -Filter "${filter}").CommandLine | Out-String -Width 32767`;return nonEmpty(run(ps,["-NoProfile","-NonInteractiv\
10
+ e","-Command",cmd]))}catch{return null}}try{return nonEmpty(run("ps",["-ww","-p",String(Math.trunc(pid)),"-o","command="]))}catch{return null}}import fs2 from"fs";import path2 from"path";var LOCK_OWNER_FILE="owner.json";var MAX_OWNER_BYTES=4096;function lockOwnerPath(lockDir){return path2.join(lockDir,LOCK_OWNER_FILE)}function buildLockOwner(input){return{pid:input.pid,profile:input.profile,twp_home:path2.resolve(input.twpHome),project_ref:input.projectRef,project_id:input.projectId,started_at:(input.now??new Date).toISOString()}}function writeLockOwner(lockDir,owner){try{fs2.writeFileSync(lockOwnerPath(lockDir),`${JSON.stringify(owner)}\
11
11
 
12
12
  `,{mode:384});return null}catch(err){return err.message}}function readLockOwner(lockDir){let raw;try{const st=fs2.lstatSync(lockOwnerPath(lockDir));if(!st.isFile())return{ok:false,reason:`${LOCK_OWNER_FILE} \u304C\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093`};if(st.size>MAX_OWNER_BYTES)return{ok:false,reason:`${LOCK_OWNER_FILE} \u304C\u5927\u304D\u3059\u304E\u307E\u3059\uFF08${st.size} \u30D0\u30A4\u30C8\uFF09`};raw=fs2.readFileSync(lockOwnerPath(lockDir),
13
13
  "utf8")}catch(err){const code=err.code;return{ok:false,reason:code==="ENOENT"?`${LOCK_OWNER_FILE} \u304C\u3042\u308A\u307E\u305B\u3093\uFF08\u3053\u306E\u8A18\u9332\u3092\u66F8\u304B\u306A\u3044\u65E7\u7248\u306E twp \u3067\u8D77\u52D5\u3055\u308C\u305F\u30EB\u30FC\u30D7\u306E\u53EF\u80FD\u6027\uFF09`:`${LOCK_OWNER_FILE} \u3092\u8AAD\u3081\u307E\u305B\u3093\uFF08${code??err.message}\uFF09`}}let parsed;try{parsed=JSON.parse(raw)}catch{return{ok:false,reason:`${LOCK_OWNER_FILE} \u304C JSON \u3068\u3057\u3066\u8AAD\u3081\u307E\u305B\u3093`}}
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{loadDomain}from"./chunk-JAJSMUER.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";
3
+ import{loadDomain}from"./chunk-QNPBMR5E.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
- 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";
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-ZN7AEXEI.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?"":`
7
7
  \u64CD\u4F5C:
8
8
  ${alignedList(resource.operations.map(op=>[op.name,op.summary]))}
@@ -0,0 +1,14 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
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-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-J4BDNFXR.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
+ 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
+ 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
+ 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,journal:async()=>(await import("./journal-GGGYNNXX.js")).journalDomain,knowledge:async()=>(await import("./domain-knowledge-TGJ4AFPJ.js")).knowledgeDomain,leave:async()=>(await import("./leave-J7PCTD7B.js")).
8
+ leaveDomain,license:async()=>(await import("./license-G32TELK2.js")).licenseDomain,"login-history":async()=>(await import("./login-history-UFYI3EXG.js")).loginHistoryDomain,media:async()=>(await import("./media-ZYPI7N66.js")).mediaDomain,meeting:async()=>(await import("./knowledge-LFK6JLI6.js")).meetingDomain,note:async()=>(await import("./note-FXJBYKDJ.js")).noteDomain,notification:async()=>(await import("./notification-WRJWXTVV.js")).notificationDomain,ojt:async()=>(await import("./ojt-CA57LGQV.js")).
9
+ ojtDomain,onedrive:async()=>(await import("./onedrive-Z43D26SJ.js")).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")).
10
+ purchaseDomain,qualification:async()=>(await import("./skill-EAJMCUNG.js")).qualificationDomain,receivable:async()=>(await import("./receivable-NJG4BGDR.js")).receivableDomain,redmine:async()=>(await import("./redmine-H2IGEHH5.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,
11
+ "seal-impression":async()=>(await import("./sales-master-D3NPW3KR.js")).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-FUBJBT5W.js")).
12
+ slackDomain,sns:async()=>(await import("./sns-ZOY5WPLI.js")).snsDomain,"staffing-board":async()=>(await import("./staffing-board-RR4FJBJJ.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")).
13
+ teamsDomain,user:async()=>(await import("./user-P3ECD5TM.js")).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-LFK6JLI6.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")).
14
+ workflowDomain};async function loadDomain(name){return LOADERS[name]()}export{loadDomain};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ var DOMAIN_NAMES=["agent","agent-loop","ai-review-reason","analysis","announcement","api-key","attendance","audit-log","backlog","brief","budget","business-hours","business-place","company","content","contract","corporate","customer","department","deposit","estimate","evaluation","expense","faq","fiscal-year","github","goal-sheet","holiday","inquiry","invoice","job-title","journal","knowledge","leave","license","login-history","media","meeting","note","notification","ojt","onedrive","outlook","p\
4
+ ayee","position","project","prospect","purchase","qualification","receivable","redmine","report","role-template","rounding-setting","seal-impression","search","secret","segment","shift","skill","slack","sns","staffing-board","storage","supplier-payment","support","task","teams","user","user-contract-type","user-group","wiki","workchange","worker-agent","workflow"];function isDomainName(value){return value!==void 0&&DOMAIN_NAMES.includes(value)}var HELP_TOKEN="help";var API_TOKEN="api";export{DOMAIN_NAMES,isDomainName,HELP_TOKEN,API_TOKEN};
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.126.0":"0.0.0-dev";var HELP=`twp ${VERSION} \u2014 TWP CLI
4
+ import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromEnv}from"./chunk-4W6ZC7GV.js";import"./chunk-2LOT54OO.js";import"./chunk-NJL3H2BB.js";import"./chunk-ZN7AEXEI.js";import"./chunk-AH4KHEAC.js";import{formatUnknownArgs}from"./chunk-OKATZ4SN.js";import"./chunk-VSJBJXZO.js";var VERSION=true?"0.127.1":"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
@@ -690,19 +690,24 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromE
690
690
  Backlog \u306E\u81EA\u5206\u3042\u3066\u306E\u304A\u77E5\u3089\u305B\u306E\u4EF6\u6570\uFF08--unread \u3067\u672A\u8AAD\u3060\u3051\uFF09
691
691
  twp backlog notification read <\u304A\u77E5\u3089\u305BID>
692
692
  Backlog \u306E\u304A\u77E5\u3089\u305B\u3092\u65E2\u8AAD\u306B\u3059\u308B\uFF08\u5916\u90E8\u3078\u51FA\u308B\u30FB--yes \u304C\u8981\u308B\uFF09
693
+ twp backlog activity list
694
+ Backlog \u306E\u81EA\u5206\uFF08--user \u3067\u4ED6\u306E\u30E6\u30FC\u30B6\u30FC\uFF09\u306E\u6700\u8FD1\u306E\u66F4\u65B0\u3092\u4E00\u89A7\u3059\u308B
693
695
  twp redmine space list \u767B\u9332\u6E08\u307F\u306E Redmine \u63A5\u7D9A\u5148\u3092\u4E00\u89A7\u3059\u308B
694
696
  twp redmine project list
695
697
  Redmine \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u4E00\u89A7\u3059\u308B
696
698
  twp redmine issue list Redmine \u30C1\u30B1\u30C3\u30C8\u3092\u4E00\u89A7\u3059\u308B\uFF08--project / --status / --assignee\uFF09
697
699
  twp redmine issue get <\u30C1\u30B1\u30C3\u30C8\u756A\u53F7>
698
- Redmine \u30C1\u30B1\u30C3\u30C81\u4EF6\u3092\u8868\u793A\u3059\u308B\uFF08\u672C\u6587\u30FB\u30B3\u30E1\u30F3\u30C8\u30FB\u6DFB\u4ED8\u30FB\u30A6\u30A9\u30C3\u30C1\u30E3\u30FC\u30FB\u9078\u3079\u308B\u72B6\u614B\u3064\u304D\uFF09
700
+ Redmine \u30C1\u30B1\u30C3\u30C81\u4EF6\u3092\u8868\u793A\u3059\u308B\uFF08\u672C\u6587\u30FB\u30B3\u30E1\u30F3\u30C8\u30FB\u6DFB\u4ED8\u30FB\u30A6\u30A9\u30C3\u30C1\u30E3\u30FC\u30FB\u95A2\u9023\u30FB\u9078\u3079\u308B\u72B6\u614B\u3064\u304D\uFF09
699
701
  twp redmine issue update <\u30C1\u30B1\u30C3\u30C8\u756A\u53F7> --notes-file <\u30D1\u30B9> --yes
700
- Redmine \u30C1\u30B1\u30C3\u30C8\u306B\u6CE8\u8A18\u3092\u4ED8\u3051\u3001\u72B6\u614B\u30FB\u62C5\u5F53\u30FB\u671F\u65E5\u30FB\u958B\u59CB\u65E5\u30FB\u9032\u6357\u7387\u3092\u5909\u3048\u308B\uFF08\u5916\u90E8\u3078\u51FA\u308B\u30FB--yes \u304C\u8981\u308B\uFF09
702
+ Redmine \u30C1\u30B1\u30C3\u30C8\u306B\u6CE8\u8A18\u3092\u4ED8\u3051\u3001\u72B6\u614B\u30FB\u62C5\u5F53\u30FB\u671F\u65E5\u30FB\u958B\u59CB\u65E5\u30FB\u9032\u6357\u7387\u30FB\u6982\u8981\u30FB\u4E88\u5B9A\u5DE5\u6570\u3092\u5909\u3048\u308B\uFF08\u5916\u90E8\u3078\u51FA\u308B\u30FB--yes \u304C\u8981\u308B\uFF09
701
703
  twp redmine attachment list <\u30C1\u30B1\u30C3\u30C8\u756A\u53F7>
702
704
  Redmine \u30C1\u30B1\u30C3\u30C8\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u3059\u308B\uFF08id / filename / filesize\uFF09
703
705
  twp redmine attachment download <\u6DFB\u4ED8ID> --out <\u30D1\u30B9>
704
706
  Redmine \u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092 --out \u3078\u66F8\u304D\u51FA\u3059
705
707
  twp redmine user me \u3053\u306E Redmine \u63A5\u7D9A\u5148\u306E API \u30AD\u30FC\u306E\u6301\u3061\u4E3B\uFF08\u81EA\u5206\uFF09\u3092\u8868\u793A\u3059\u308B
708
+ twp redmine user get <\u30E6\u30FC\u30B6\u30FCID>
709
+ Redmine \u306E\u30E6\u30FC\u30B6\u30FC1\u4EBA\u3092\u8868\u793A\u3059\u308B\uFF08login\uFF1D\u6CE8\u8A18\u306E\u300C@\u30ED\u30B0\u30A4\u30F3\u540D\u300D\uFF09
710
+ twp redmine status list Redmine \u306E\u72B6\u614B\u3092\u4E00\u89A7\u3059\u308B\uFF08\u540D\u524D\u3068 is_closed\uFF09
706
711
  twp redmine member list Redmine \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30E1\u30F3\u30D0\u30FC\u3092\u4E00\u89A7\u3059\u308B\uFF08--project \u304C\u8981\u308B\uFF09
707
712
  twp github account list \u767B\u9332\u6E08\u307F\u306E GitHub \u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4E00\u89A7\u3059\u308B
708
713
  twp github user me GitHub \u306E\u30C8\u30FC\u30AF\u30F3\u306E\u6301\u3061\u4E3B\uFF08\u81EA\u5206\u306E login\uFF09\u3092\u8868\u793A\u3059\u308B
@@ -749,9 +754,10 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromE
749
754
  \u30E1\u30FC\u30EB\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u3059\u308B
750
755
  twp outlook attachment download <\u30E1\u30FC\u30EBID> <\u6DFB\u4ED8ID> --out <\u30D1\u30B9>
751
756
  \u30E1\u30FC\u30EB\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092 --out \u3078\u66F8\u304D\u51FA\u3059
752
- twp outlook event list \u4E88\u5B9A\u8868\u306E\u4E88\u5B9A\u3092\u4E00\u89A7\u3059\u308B\uFF08--from / --to \u306F\u65E5\u672C\u6642\u9593\u306E\u65E5\u4ED8\uFF09
753
- twp outlook event view --from <yyyy-MM-dd> [--to <yyyy-MM-dd>]
754
- \u671F\u9593\u5185\u306E\u4E88\u5B9A\u3092\u3001\u7E70\u308A\u8FD4\u3057\u306E\u4E88\u5B9A\u30921\u56DE\u305A\u3064\u306B\u5C55\u958B\u3057\u3066\u4E00\u89A7\u3059\u308B\uFF08\u53C2\u52A0 URL \u3064\u304D\uFF09
757
+ twp outlook event list [--from <yyyy-MM-dd>] [--to <yyyy-MM-dd>] [--full]
758
+ \u4E88\u5B9A\u8868\u306E\u4E88\u5B9A\u3092\u4E00\u89A7\u3059\u308B\uFF08--from / --to \u306F\u65E5\u672C\u6642\u9593\u306E\u65E5\u4ED8\u3002\u672C\u6587\u30FB\u53C2\u52A0\u8005\u306F --full\uFF09
759
+ twp outlook event view --from <yyyy-MM-dd> [--to <yyyy-MM-dd>] [--full]
760
+ \u671F\u9593\u5185\u306E\u4E88\u5B9A\u3092\u3001\u7E70\u308A\u8FD4\u3057\u306E\u4E88\u5B9A\u30921\u56DE\u305A\u3064\u306B\u5C55\u958B\u3057\u3066\u5168\u4EF6\u4E00\u89A7\u3059\u308B\uFF08\u53C2\u52A0 URL \u3064\u304D\u3002\u672C\u6587\u30FB\u53C2\u52A0\u8005\u306F --full\uFF09
755
761
  twp outlook event get <\u4E88\u5B9AID>
756
762
  \u4E88\u5B9A1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u51FA\u5E2D\u8005\u30FB\u672C\u6587\u3064\u304D\uFF09
757
763
  twp outlook event create --subject <\u4EF6\u540D> --start <\u65E5\u6642> --end <\u65E5\u6642> --yes
@@ -815,10 +821,18 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromE
815
821
  \u30C1\u30E3\u30CD\u30EB\u30FBDM \u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u4E00\u89A7\u3059\u308B\uFF08--oldest / --latest\uFF09
816
822
  twp slack message send --channel <ID> --body-file <\u30D1\u30B9> --yes
817
823
  \u30C1\u30E3\u30CD\u30EB\u30FBDM \u306B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u9001\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09
824
+ twp slack message permalink <ts> --channel <ID>
825
+ \u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30EA\u30F3\u30AF\uFF08permalink\uFF09\u3092\u5F97\u308B
818
826
  twp slack reply list <ts> --channel <ID>
819
827
  \u30B9\u30EC\u30C3\u30C9\u306E\u8FD4\u4FE1\u3092\u4E00\u89A7\u3059\u308B
820
828
  twp slack reply send <ts> --channel <ID> --body-file <\u30D1\u30B9> --yes
821
829
  \u30B9\u30EC\u30C3\u30C9\u3078\u8FD4\u4FE1\u3059\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09
830
+ twp slack reaction list <ts> --channel <ID>
831
+ \u30E1\u30C3\u30BB\u30FC\u30B81\u4EF6\u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u4E00\u89A7\u3059\u308B\uFF08\u8AB0\u304C\u4ED8\u3051\u305F\u304B\u3092\u542B\u3080\uFF09
832
+ twp slack reaction add <ts> --channel <ID> --reaction <\u7D75\u6587\u5B57> --yes
833
+ \u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u4ED8\u3051\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09
834
+ twp slack reaction remove <ts> --channel <ID> --reaction <\u7D75\u6587\u5B57> --yes
835
+ \u81EA\u5206\u304C\u4ED8\u3051\u305F\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u5916\u3059\uFF08--yes \u304C\u5FC5\u8981\uFF09
822
836
  twp slack mention list \u81EA\u5206\u5B9B\u3066\u306E\u30E1\u30F3\u30B7\u30E7\u30F3\u3092\u4E00\u89A7\u3059\u308B
823
837
  twp slack search messages <\u691C\u7D22\u8A9E>
824
838
  \u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u691C\u7D22\u3059\u308B\uFF08Slack \u306E\u691C\u7D22\u69CB\u6587\uFF09
@@ -1578,6 +1592,14 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromE
1578
1592
  \u6708\u3092\u7DE0\u3081\u308B\uFF08\u305D\u306E\u6708\u306E\u5165\u91D1\u3092\u52D5\u304B\u305B\u306A\u304F\u3059\u308B\u30FB--yes \u304C\u8981\u308B\uFF09
1579
1593
  twp receivable closing reopen <\u5E74\u6708>
1580
1594
  \u6708\u306E\u7DE0\u3081\u3092\u89E3\u9664\u3059\u308B\uFF08\u78BA\u5B9A\u5024\u3092\u6D88\u3059\u30FB--yes \u304C\u8981\u308B\uFF09
1595
+ twp journal list \u4ED5\u8A33\u5E33\uFF08\u78BA\u5B9A\u6E08\u307F\u306E\u4F1D\u7968\uFF09\u3092\u4E00\u89A7\u3059\u308B\uFF08--from/--to\u30FB--fiscal-year\uFF09
1596
+ twp journal get <\u4F1D\u7968ID>
1597
+ \u78BA\u5B9A\u6E08\u307F\u306E\u4F1D\u79681\u4EF6\u3092\u8868\u793A\u3059\u308B\uFF08\u8D64\u9ED2\u8A02\u6B63\u306E\u53C2\u7167\u30FB\u8A02\u6B63\u524A\u9664\u5C65\u6B74\u3064\u304D\uFF09
1598
+ twp journal draft list \u632F\u66FF\u4F1D\u7968\u306E\u4E0B\u66F8\u304D\u30FB\u627F\u8A8D\u4E2D\u3092\u4E00\u89A7\u3059\u308B\uFF08--status\uFF09
1599
+ twp journal draft get <\u4E0B\u66F8\u304DID>
1600
+ \u4E0B\u66F8\u304D1\u4EF6\u3092\u8868\u793A\u3059\u308B
1601
+ twp journal draft create
1602
+ \u632F\u66FF\u4F1D\u7968\u306E\u4E0B\u66F8\u304D\u3092\u4F5C\u308B\uFF08--content-file\u30FB\u78BA\u5B9A\u306F\u753B\u9762\u3067\u884C\u3046\uFF09
1581
1603
  twp purchase list \u4ED5\u5165\u3092\u4E00\u89A7\u3059\u308B\uFF08--status\u30FB--supplier\u30FB--from/--to\uFF09
1582
1604
  twp purchase get <\u4ED5\u5165ID>
1583
1605
  \u4ED5\u51651\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B
@@ -1819,17 +1841,17 @@ TUI \u5185:
1819
1841
  TWP API \u3092\u547C\u3079\u307E\u3059\u3002TWP API \u306E\u30C4\u30FC\u30EB\u306F\u65E2\u5B9A\u3067\u78BA\u8A8D\u304C\u51FA\u307E\u3059\uFF08-p \u3067\u306F\u62D2\u5426\u3002--allowed-tools \u3067\u540D\u524D\u3092\u8A31\u53EF\uFF09\u3002
1820
1842
  \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
1821
1843
  `;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
1822
- `);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}
1823
- const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-FNRF7ZD7.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=
1844
+ `);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-LAXSYWLZ.js");if(first==="completion"){process.exitCode=completion.runCompletion(rest,process.stdout,process.stderr);return}
1845
+ const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-ZTPZYTW3.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=
1824
1846
  await runConfigure(rest);return}const args=parseArgv(process.argv.slice(2));if(args.command==="version"){process.stdout.write(`${VERSION}
1825
1847
  `);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)}
1826
1848
 
1827
- ${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-RYRFXAGW.js");process.exitCode=await runDomain({domain:args.domain,...args.operation!==void 0?{operation:args.operation}:
1828
- {},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-7HSZ2VT5.js");process.exitCode=await runApiCommand({argv:args.domainArgv,help:args.domainHelp,
1849
+ ${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-C2WIXH7T.js");process.exitCode=await runDomain({domain:args.domain,...args.operation!==void 0?{operation:args.operation}:
1850
+ {},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-HXPD6GA3.js");process.exitCode=await runApiCommand({argv:args.domainArgv,help:args.domainHelp,
1829
1851
  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.
1830
- 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}
1831
- 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,
1852
+ command==="logout"||args.command==="whoami"){const{runLogin,runLogout,runWhoami}=await import("./commands-UT5FMOFA.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}
1853
+ if(args.command==="task-loop"){const{runTaskLoop}=await import("./commands-44V2CA5N.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,
1832
1854
  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,
1833
1855
  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");
1834
- 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-3PXJSRXI.js");await startTui({mode:args.mode,permissionMode:args.permissionMode,allowedTools:args.
1856
+ 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-HRBJ435D.js");await startTui({mode:args.mode,permissionMode:args.permissionMode,allowedTools:args.
1835
1857
  allowedTools,disallowedTools:args.disallowedTools,model:args.model,profile:args.profile,noTui:args.noTui||!process.stdout.isTTY,doctor:args.doctor,version:VERSION})}await main();
@@ -1,8 +1,8 @@
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{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";
3
+ import{ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,promptSection}from"./chunk-5E7S5INB.js";import{NO_PLAN_SESSION,RECENT_ADVANCE_WINDOW_HOURS,buildDynamicBlocks,buildRecentCandidateIndex,createItem,enqueueBlockerRecovery,enqueueDevVerifyForMerged,enqueueReleasePartialMergeRerun,enqueueReleasePhase5Recovery,fileSkillNames,findRecentCandidate,formatInflightEntry,formatPlanResultLine,formatRecentAdvance,formatResumeHold,inflightEntries,inflightStaleHours,openPlanSession,parseOutcomeCode,
4
+ parseReleaseResult,parseTaskStatusSnapshot,pendingTaskKeys,resolveRecentAdvance,resolveResumeHold,shouldSuppressForResume,shouldSuppressForStatus,staleFloorHours,unavailableChecks,windowStartMicros}from"./chunk-2LFYNWTT.js";import{EngineNotConfiguredError,NoopEngine,UnknownEngineError,aiUnavailableLabel,assertKnownEngine,failureHint,isAiUnavailable,needsHumanToRestoreAi}from"./chunk-REWDCJNB.js";import{claudeConfigDir,resolveDetectDeps}from"./chunk-GODJH2PQ.js";import{InstanceLock,
5
+ buildLockOwner,defaultIsLoopProcess,writeLockOwner}from"./chunk-I4KGIIYH.js";import{LoopSettingsApplier,renderStepBudget}from"./chunk-KYGDPWMC.js";import{ServerSkillCatalog,formatSkillOrigins}from"./chunk-DZFULJR3.js";import"./chunk-MYBIPHZ7.js";import"./chunk-A4LFG7MW.js";import"./chunk-VRBI2NPI.js";import{duplicateTaskKeyDropReason,excludedKeyInArgs,extractPlanJson,parseOpsCount,parsePlanExcludeKeys,placeholderTaskKey,releaseDeployDropReason,stepToItem,zeroTargetDropReasons}from"./chunk-YAN3G35K.js";
6
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";
@@ -50,7 +50,7 @@ ${err.hint?`${err.hint}
50
50
  `);return 1}writeErr(`\u30A8\u30E9\u30FC: ${err.message}
51
51
  `);return 1}}async function runLogin(options){return run(async()=>{const profile=resolveProfile(options.profile);const io=makeIo(options.cliVersion);if(options.method==="password"){await passwordLogin(profile,{tenantCode:options.tenant??void 0},process.env,io)}else if(options.method==="token"){await tokenLogin(profile,process.env,io)}else{await browserLogin(profile,process.env,io,{noBrowser:options.noBrowser})}})}async function runLogout(options){return run(async()=>{const profile=resolveProfile(
52
52
  options.profile);const creds=loadCredentials(profile.name);if(!creds){writeOut(`\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u300C${profile.name}\u300D\u306F\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u307E\u305B\u3093\u3002
53
- `);return}const{describeLogoutImpact,findLoopsUsingProfile}=await import("./logout-guard-UVMBBP26.js");const found=findLoopsUsingProfile(profile.name,options.logoutGuard);if(found.users.length>0||found.undetermined.length>0){writeErr(describeLogoutImpact(profile.name,found,options.force===true));if(options.force!==true)throw new LogoutRefusedError}const apiUrl=effectiveApiUrl(profile,creds.api_url);const revoked=await httpFetch(`${apiUrl}/api/v2/auth/logout`,{method:"POST",headers:{Accept:"applic\
53
+ `);return}const{describeLogoutImpact,findLoopsUsingProfile}=await import("./logout-guard-MS3N5XKP.js");const found=findLoopsUsingProfile(profile.name,options.logoutGuard);if(found.users.length>0||found.undetermined.length>0){writeErr(describeLogoutImpact(profile.name,found,options.force===true));if(options.force!==true)throw new LogoutRefusedError}const apiUrl=effectiveApiUrl(profile,creds.api_url);const revoked=await httpFetch(`${apiUrl}/api/v2/auth/logout`,{method:"POST",headers:{Accept:"applic\
54
54
  ation/json",Authorization:`Bearer ${creds.token}`}}).then(res=>res.ok,()=>false);await deleteCredentials(profile.name);writeOut(`\u2705 \u30ED\u30B0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\uFF08\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB: ${profile.name} / \u30C8\u30FC\u30AF\u30F3: ${maskToken(creds.token)}\uFF09
55
55
  `);if(!revoked){writeOut("\u26A0 \u30B5\u30FC\u30D0\u5074\u306E\u30C8\u30FC\u30AF\u30F3\u5931\u52B9\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08\u30AA\u30D5\u30E9\u30A4\u30F3\u7B49\uFF09\u3002TWP \u306E\u300C\u8A2D\u5B9A > CLI\u7AEF\u672B\u300D\u304B\u3089\u3082\u5931\u52B9\u3067\u304D\u307E\u3059\u3002\n")}})}async function runWhoami(options){return run(async()=>{const profile=resolveProfile(options.profile);const structured=options.output!==void 0||options.query!==void 0;let format=null;if(structured){
56
56
  const{resolveOutputFormat,OUTPUT_FORMATS}=await import("./format-X65HXAAU.js");format=resolveOutputFormat({...options.output!==void 0?{flag:options.output}:{},isTty:process.stdout.isTTY===true});if(format===null){throw new UsageError(`--output \u306B\u300C${options.output??""}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F ${OUTPUT_FORMATS.join(" / ")} \u3067\u3059`)}}const stored=loadCredentials(profile.name);const apiUrl=effectiveApiUrl(