@tocca-systems/twp-cli 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.public.md +14 -0
  2. package/README.md +240 -6
  3. package/command-model/department.json +1 -1
  4. package/dist/agent-loop-ZP47LTUE.js +75 -0
  5. package/dist/{api-command-CLARDKAL.js → api-command-VWJXBUCJ.js} +3 -3
  6. package/dist/{app-X3IKIAKB.js → app-3JIU5OUX.js} +49 -48
  7. package/dist/attendance-42XLURM7.js +21 -0
  8. package/dist/{auto-update-FBZGOQFI.js → auto-update-CV2MM32C.js} +1 -1
  9. package/dist/{auto-update-worker-SI7TVSCN.js → auto-update-worker-OBFGN6FY.js} +2 -2
  10. package/dist/{backlog-X2MQTA6F.js → backlog-KSMQIC2R.js} +2 -2
  11. package/dist/charter-command-ULFOEZWE.js +26 -0
  12. package/dist/{chunk-APYYF7H6.js → chunk-5Q2CH4E7.js} +1 -1
  13. package/dist/{chunk-M3GWY6NT.js → chunk-7WSNIXTQ.js} +2 -1
  14. package/dist/chunk-BKZGBJWT.js +15 -0
  15. package/dist/chunk-DDKZ5IPT.js +11 -0
  16. package/dist/chunk-FTYJZFEK.js +10 -0
  17. package/dist/{chunk-2VISRLWS.js → chunk-G4OO4M44.js} +9 -9
  18. package/dist/{chunk-E4H22AO5.js → chunk-GDM2QUBL.js} +1 -1
  19. package/dist/{chunk-X4RS5VBH.js → chunk-GMBJTG6A.js} +1 -1
  20. package/dist/{chunk-QVXZEUKN.js → chunk-HGTG5XQ7.js} +1 -1
  21. package/dist/{chunk-DSDVIU6A.js → chunk-ILKQDXI5.js} +1 -1
  22. package/dist/{chunk-O52CUEDO.js → chunk-IOGVQVGD.js} +1 -1
  23. package/dist/chunk-IRAZ27WL.js +38 -0
  24. package/dist/{chunk-7PRQ7JW2.js → chunk-KEP5QSS4.js} +40 -15
  25. package/dist/chunk-KUIFIN7P.js +57 -0
  26. package/dist/{chunk-JB27KNCX.js → chunk-NIAOX77K.js} +29 -25
  27. package/dist/chunk-P4AEFKLM.js +13 -0
  28. package/dist/{chunk-SJRK4AVE.js → chunk-PK6CUUAQ.js} +1 -1
  29. package/dist/chunk-SP27PYHC.js +3 -0
  30. package/dist/chunk-UDPJ2IGK.js +7 -0
  31. package/dist/chunk-VCZVITWG.js +13 -0
  32. package/dist/{chunk-XLE4HW6B.js → chunk-VGMWPPGD.js} +12 -10
  33. package/dist/{chunk-UG2I6VRD.js → chunk-VYDEUFGU.js} +1 -1
  34. package/dist/{chunk-Y2QAP6SU.js → chunk-WQ66EYZS.js} +1 -1
  35. package/dist/chunk-X45SJNT2.js +62 -0
  36. package/dist/{chunk-EQWW2F5V.js → chunk-YVAN3H5W.js} +4 -4
  37. package/dist/chunk-YWGYRISN.js +34 -0
  38. package/dist/{chunk-WOUKWOAR.js → chunk-Z2MNO3FT.js} +10 -9
  39. package/dist/chunk-ZN5EFDH7.js +5 -0
  40. package/dist/chunk-ZWVYVS2A.js +4 -0
  41. package/dist/cli.js +100 -8
  42. package/dist/{commands-BE67IDNQ.js → commands-OFLBUP6O.js} +8 -8
  43. package/dist/{commands-JNG5TZ77.js → commands-RG7M6E5K.js} +79 -84
  44. package/dist/department-GH475WCF.js +33 -0
  45. package/dist/job-title-FC2GWDE7.js +8 -0
  46. package/dist/{logout-guard-CMZZBRUL.js → logout-guard-3PB3VMGP.js} +1 -1
  47. package/dist/media-TD7D4TXF.js +64 -0
  48. package/dist/{oneshot-NA756EBO.js → oneshot-QQOOZZDT.js} +5 -5
  49. package/dist/position-4RHTV3IK.js +8 -0
  50. package/dist/{project-2LJZW747.js → project-DBNWB47J.js} +1 -1
  51. package/dist/query-EEALMOSO.js +3 -0
  52. package/dist/{render-ICZOK3HV.js → render-K45EOLHX.js} +1 -1
  53. package/dist/{run-XCAJDHFU.js → run-VNHAQO24.js} +2 -2
  54. package/dist/{schedule-command-GKXKNMLG.js → schedule-command-FJU7JFNR.js} +1 -1
  55. package/dist/{server-settings-CG3EM7R7.js → server-settings-YL6KALXG.js} +1 -1
  56. package/dist/{setup-UI6V2Q3V.js → setup-BJKIHANC.js} +1 -1
  57. package/dist/skill-command-V26WGVXU.js +61 -0
  58. package/dist/storage-ANKKJJJO.js +3 -0
  59. package/dist/{task-GKNM3G4K.js → task-7VOYCG26.js} +7 -63
  60. package/dist/{update-TVVBJNN7.js → update-RLKK6N7U.js} +1 -1
  61. package/dist/user-UU2SLVC4.js +336 -0
  62. package/package.json +1 -1
  63. package/dist/charter-command-UPKTVL7H.js +0 -36
  64. package/dist/chunk-7LTTKKQA.js +0 -56
  65. package/dist/chunk-GFC2ASHE.js +0 -6
  66. package/dist/chunk-JKSXUBND.js +0 -9
  67. package/dist/chunk-LD3AKGH6.js +0 -30
  68. package/dist/chunk-ODLJ2LNQ.js +0 -13
  69. package/dist/chunk-PEGUHUTD.js +0 -3
  70. package/dist/query-NJMVSQR6.js +0 -3
  71. package/dist/user-EU7Z3DAO.js +0 -24
@@ -0,0 +1,64 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{contentTypeFor}from"./chunk-KUIFIN7P.js";import"./chunk-GY7KI5E5.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-G4OO4M44.js";import"./chunk-NIAOX77K.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-FTYJZFEK.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import"./chunk-II5RVJQN.js";import{checkUploadQuota}from"./chunk-DDKZ5IPT.js";import{isRecord,
4
+ pick}from"./chunk-ZWVYVS2A.js";import"./chunk-J7QYPKVK.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";import crypto from"crypto";import fs from"fs";import path from"path";var SCOPE_PERSONAL="personal";var SCOPE_PROJECT="project";var LIST_COLUMNS=["id","file_name","content_type","file_size","folder_id","public_status","updated_at"];var UPLOAD_COLUMNS=["id","file_name","content_type","file_size","folder_id","scope","content_hash"];var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30ED\u30FC\u30AB\u30EB\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\uFF08\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9>"};var NAME_FLAG={
5
+ name:"--name",summary:"\u4FDD\u5B58\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u540D\uFF08\u7701\u7565\u6642\u306F\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3002\u540C\u540D\u304C\u3042\u308B\u3068\u30B5\u30FC\u30D0\u304C\u5225\u540D\u306B\u3057\u307E\u3059\uFF09",takesValue:true,placeholder:"<\u30D5\u30A1\u30A4\u30EB\u540D>"};var CONTENT_TYPE_FLAG={name:"--content-type",summary:"Content-Type\uFF08\u7701\u7565\u6642\u306F\u62E1\u5F35\u5B50\u304B\u3089\u63A8\u5B9A\u3002\u4E0D\u660E\u306A\u3089 application/octet-stream\uFF09",
6
+ takesValue:true,placeholder:"<\u578B>"};var FOLDER_FLAG={name:"--folder",summary:"\u30D5\u30A9\u30EB\u30C0ID\uFF08\u7701\u7565\u6642\u306F\u30B9\u30B3\u30FC\u30D7\u306E\u6700\u4E0A\u4F4D\uFF09",takesValue:true,placeholder:"<\u30D5\u30A9\u30EB\u30C0ID>"};var MEDIA_PROJECT_FLAG={name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5BFE\u8C61\u306B\u3059\u308B\uFF08\u30B3\u30FC\u30C9\u307E\u305F\u306F ID\uFF09\u3002\u7701\u7565\u6642\u306F\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB",
7
+ takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"};var KEYWORD_FLAG={name:"--keyword",summary:"\u30D5\u30A1\u30A4\u30EB\u540D\u30FB\u5185\u5BB9\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22\uFF08\u691C\u7D22\u6642\u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3057\u307E\u305B\u3093\uFF09",takesValue:true,placeholder:"<\u30AD\u30FC\u30EF\u30FC\u30C9>"};var FILE_REF_FLAG={name:"--id",summary:"\u30D5\u30A1\u30A4\u30EBID\u3002\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF08\u4E21\u65B9\u6307\u5B9A\u306F\u30A8\u30E9\u30FC\uFF09",
8
+ takesValue:true,placeholder:"<\u30D5\u30A1\u30A4\u30EBID>"};var OUT_FLAG={name:"--out",summary:"\u66F8\u304D\u51FA\u3057\u5148\u306E\u30D5\u30A1\u30A4\u30EB\u30D1\u30B9\uFF08\u5FC5\u9808\u3002\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9>"};var FORCE_FLAG={name:"--force",summary:"\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308C\u3070\u4E0A\u66F8\u304D\u3059\u308B\uFF08\u65E2\u5B9A\u3067\u306F\u4E0A\u66F8\u304D\u3057\u306A\u3044\uFF09",
9
+ takesValue:false};var UUID=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function folderId(input){const value=nonEmpty(input.flags,"--folder");if(value!==void 0&&!UUID.test(value)){throw new UsageError(`--folder \u306B\u306F\u30D5\u30A9\u30EB\u30C0ID\uFF08UUID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${value}`)}return value}async function resolveScope(input,ctx){const ref=nonEmpty(input.flags,"--project");if(ref===void 0)return{scope:SCOPE_PERSONAL};return{
10
+ scope:SCOPE_PROJECT,scopeId:await ctx.projectId(ref)}}function fileRef(input,usage){const id=singleRef(input,{flag:"--id",label:"\u30D5\u30A1\u30A4\u30EBID",usage});if(!isSafePathSegment(id))throw new UsageError(`\u30D5\u30A1\u30A4\u30EBID \u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${id}`);return id}function filePath(id){return`/api/v2/media/files/${encodeURIComponent(id)}`}function listRows(body){const data=isRecord(body)?body["data"]:void 0;if(!Array.isArray(data)){throw new ApiResponseError(
11
+ "\u30E1\u30C7\u30A3\u30A2\u4E00\u89A7\u306E\u5FDC\u7B54\u306B data \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return data}function dataOf(body,label){const data=isRecord(body)?body["data"]:void 0;if(!isRecord(data)){throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u306B data \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return data}
12
+ function localFile(input){const raw=input.flags.get("--file");if(raw===void 0||raw.trim()===""){throw new UsageError("--file \u306F\u5FC5\u9808\u3067\u3059","twp media upload --file <\u30D1\u30B9>")}if(input.args.length>0){throw new UsageError(`upload \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,"twp media upload --file <\u30D1\u30B9>")}const file=path.resolve(raw.trim());let stat;try{stat=fs.statSync(file)}catch{throw new UsageError(`\u30D5\
13
+ \u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093: ${file}`)}if(!stat.isFile())throw new UsageError(`\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ${file}`);if(stat.size===0)throw new UsageError(`\u7A7A\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093: ${file}`);const nameFlag=nonEmpty(input.flags,"--name");const name=nameFlag??path.basename(file);const contentType=nonEmpty(input.flags,"--content-ty\
14
+ pe")??contentTypeFor(name);return{file,name,size:stat.size,contentType}}function uploadUrlPlan(input){const resolved=input.resolved??{};const body={file_name:requireResolved(input,"fileName"),content_type:requireResolved(input,"contentType"),file_size:Number(requireResolved(input,"fileSize")),scope:requireResolved(input,"scope")};if(resolved["scopeId"]!==void 0)body["scope_id"]=resolved["scopeId"];const folder=folderId(input);if(folder!==void 0)body["folder_id"]=folder;return{method:"POST",path:"\
15
+ /api/v2/media/files/upload-url",body}}function issued(body){const data=dataOf(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C");const id=data["file_id"];const uploadUrl=data["upload_url"];if(!isSafePathSegment(id)||typeof uploadUrl!=="string"||!/^https:\/\//.test(uploadUrl)){throw new ApiResponseError("\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C\u306E\u5FDC\u7B54\u306B data.file_id / data.upload_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
16
+ return{id,uploadUrl}}var discardGuidance=id=>` \u7834\u68C4: twp media delete ${id} --yes\uFF08\u30B4\u30DF\u7BB1\u3078\u79FB\u3057\u307E\u3059\u3002\u5B8C\u5168\u306B\u6D88\u3059\u306A\u3089 twp api /v2/media/files/${id}/permanent --method DELETE --yes\uFF09`;function orphanGuidance(id,stage){if(stage==="transfer"){return`\u30D5\u30A1\u30A4\u30EB ${id} \u306F\u4EEE\u767B\u9332\u3055\u308C\u307E\u3057\u305F\u304C\u3001\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u8EE2\u9001\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
17
+ \u30B5\u30FC\u30D0\u306B\u306F\u4E2D\u8EAB\u306E\u7121\u3044\u4EEE\u767B\u9332\u306E\u30D5\u30A1\u30A4\u30EB\u304C\u6B8B\u3063\u3066\u304A\u308A\u3001\u81EA\u52D5\u3067\u306F\u524A\u9664\u3055\u308C\u307E\u305B\u3093\u3002\u7834\u68C4\u3057\u3066\u304B\u3089\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
18
+ `+discardGuidance(id)}return`\u30D5\u30A1\u30A4\u30EB ${id} \u306F\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u8EE2\u9001\u307E\u3067\u5B8C\u4E86\u3057\u307E\u3057\u305F\u304C\u3001\u5B8C\u4E86\u767B\u9332\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
19
+ \u30B5\u30FC\u30D0\u306B\u306F\u4EEE\u767B\u9332\u306E\u30D5\u30A1\u30A4\u30EB\u304C\u6B8B\u3063\u3066\u304A\u308A\u3001\u81EA\u52D5\u3067\u306F\u524A\u9664\u3055\u308C\u307E\u305B\u3093\u3002\u6B21\u306E\u3069\u3061\u3089\u304B\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
20
+ \u518D\u767B\u9332: twp api /v2/media/files/${id}/complete --method POST --yes
21
+ `+discardGuidance(id)}async function upload(input,ctx){const file=requireResolved(input,"file");const size=Number(requireResolved(input,"fileSize"));const contentType=requireResolved(input,"contentType");const bytes=new Uint8Array(fs.readFileSync(file));if(bytes.byteLength!==size){throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u306E\u5927\u304D\u3055\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF08${size} \u2192 ${bytes.byteLength} \u30D0\u30A4\u30C8\uFF09: ${file}`)}
22
+ const localHash=crypto.createHash("sha256").update(bytes).digest("hex");await checkUploadQuota(ctx,size);const{id,uploadUrl}=issued(await ctx.send(uploadUrlPlan(input)));try{await ctx.putSigned(uploadUrl,bytes,contentType)}catch(err){ctx.warn(orphanGuidance(id,"transfer"));throw err}let completed;try{completed=dataOf(await ctx.send({method:"POST",path:`${filePath(id)}/complete`,body:{}}),"\u5B8C\u4E86\u767B\u9332")}catch(err){ctx.warn(orphanGuidance(id,"complete"));throw err}const serverHash=completed["\
23
+ content_hash"];if(typeof serverHash==="string"&&serverHash!==""){if(serverHash.toLowerCase()!==localHash){ctx.warn(`\u30D5\u30A1\u30A4\u30EB ${id} \u306F\u30B5\u30FC\u30D0\u306B\u767B\u9332\u6E08\u307F\u306E\u307E\u307E\u6B8B\u3063\u3066\u3044\u307E\u3059\u3002
24
+ ${discardGuidance(id)}`);throw new ApiResponseError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u305F\u30D5\u30A1\u30A4\u30EB ${id} \u306E\u5185\u5BB9\u304C\u30ED\u30FC\u30AB\u30EB\u3068\u4E00\u81F4\u3057\u307E\u305B\u3093\uFF08\u30ED\u30FC\u30AB\u30EB sha256 ${localHash} / \u30B5\u30FC\u30D0 ${serverHash}\uFF09\u3002`)}}else{ctx.warn(`\u30B5\u30FC\u30D0\u304C content_hash \u3092\u8FD4\u3055\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u30D5\u30A1\u30A4\u30EB ${id} \u306E\u5185\u5BB9\u306F\u7167\u5408\u3057\u3066\u3044\u307E\u305B\u3093\u3002`)}
25
+ return completed}var BULK_MAX=100;var BULK_DOWNLOAD_MAX=50;function bulkIds(input,usage,max){const ids=input.args.map(arg=>arg.trim()).filter(arg=>arg!=="");if(ids.length===0)throw new UsageError("\u30D5\u30A1\u30A4\u30EBID \u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);if(ids.length>max)throw new UsageError(`\u4E00\u5EA6\u306B\u6307\u5B9A\u3067\u304D\u308B\u30D5\u30A1\u30A4\u30EB\u306F ${max} \u4EF6\u307E\u3067\u3067\u3059\uFF08${ids.length} \u4EF6\u6307\u5B9A\uFF09`,
26
+ usage);const bad=ids.filter(id=>!UUID.test(id));if(bad.length>0)throw new UsageError(`\u30D5\u30A1\u30A4\u30EBID\uFF08UUID\uFF09\u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${bad.join(" ")}`,usage);const duplicated=ids.filter((id,index)=>ids.indexOf(id)!==index);if(duplicated.length>0)throw new UsageError(`\u540C\u3058\u30D5\u30A1\u30A4\u30EBID \u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059: ${[...new Set(duplicated)].join(" ")}`,usage);return ids}function bulkResult(body,label){const data=dataOf(
27
+ body,label);const{success,failed}=data;const rolledBack=data["rolled_back"]??[];if(!Array.isArray(success)||!Array.isArray(failed)||!Array.isArray(rolledBack)){throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u306B data.success / failed \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return{success:success.map(String),failed:failed.map(row=>({id:String(isRecord(row)?row["id"]??row["file_id"]:row),reason:String(isRecord(
28
+ row)?row["reason"]??row["error"]??"":"")})),rolledBack:rolledBack.map(String)}}function assertBulkSucceeded(result,requested,label,ctx){if(result.failed.length===0)return;const lines=[`${label}: ${requested} \u4EF6\u4E2D ${result.failed.length} \u4EF6\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002`];for(const row of result.failed)lines.push(` \u5931\u6557: ${row.id}\uFF08${row.reason}\uFF09`);lines.push(result.success.length===0?" \u9069\u7528\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002":
29
+ ` \u9069\u7528\u6E08\u307F\uFF08\u623B\u3055\u308C\u3066\u3044\u306A\u3044\uFF09: ${result.success.join(" ")}`);if(result.rolledBack.length>0)lines.push(` \u5931\u6557\u306E\u305F\u3081\u5143\u306B\u623B\u3057\u305F\u3082\u306E: ${result.rolledBack.join(" ")}`);ctx.warn(lines.join("\n"));throw new ApiRejectedError(`${label}\u306F\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093\uFF08${result.failed.length} \u4EF6\u5931\u6557\u30FB${result.success.length} \u4EF6\u9069\u7528\uFF09\u3002`)}function bulkSummary(body){
30
+ const data=isRecord(body)?body["data"]:void 0;const count=key=>isRecord(data)&&Array.isArray(data[key])?data[key].length:0;return{message:isRecord(body)?body["message"]??null:null,success:count("success"),failed:count("failed"),rolled_back:count("rolled_back")}}var BULK_STATUS_OPERATIONS=[{name:"bulk-publish",endpoint:"publish",label:"\u4E00\u62EC\u516C\u958B",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u516C\u958B\u3059\u308B",description:"\u30D5\u30A1\u30A4\u30EB\u3092\u516C\u958B\u72B6\u614B\u306B\u3057\u307E\u3059\u3002"},
31
+ {name:"bulk-unpublish",endpoint:"unpublish",label:"\u4E00\u62EC\u975E\u516C\u958B",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u975E\u516C\u958B\u306B\u3059\u308B",description:"\u30D5\u30A1\u30A4\u30EB\u3092\u975E\u516C\u958B\uFF08\u4E0B\u66F8\u304D\uFF09\u306B\u623B\u3057\u307E\u3059\u3002"},{name:"bulk-archive",endpoint:"archive",label:"\u4E00\u62EC\u30A2\u30FC\u30AB\u30A4\u30D6",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B",
32
+ description:"\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u72B6\u614B\u306B\u3057\u307E\u3059\uFF08\u524A\u9664\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002"},{name:"bulk-restore",endpoint:"restore",label:"\u4E00\u62EC\u5FA9\u5143",summary:"\u30B4\u30DF\u7BB1\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5FA9\u5143\u3059\u308B",description:"twp media delete / bulk-delete \u3067\u30B4\u30DF\u7BB1\u3078\u79FB\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u5143\u306B\u623B\u3057\u307E\u3059\uFF08\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u89E3\u9664\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002"}];
33
+ function bulkUsage(name,extra=""){return`twp media ${name} <\u30D5\u30A1\u30A4\u30EBID>...${extra}`}function bulkStatusOperation(spec){const usage=bulkUsage(spec.name);return{name:spec.name,summary:spec.summary,usage,description:`${spec.description}
34
+ \u30D5\u30A1\u30A4\u30EBID\uFF08twp media list \u306E id\uFF09\u3092\u4F4D\u7F6E\u5F15\u6570\u3067\u4E26\u3079\u307E\u3059\uFF08${BULK_MAX} \u4EF6\u307E\u3067\uFF09\u3002
35
+ `+BULK_FAILURE_HELP,flags:[],plan:input=>({method:"POST",path:`/api/v2/media/files/bulk/${spec.endpoint}`,body:{file_ids:bulkIds(input,usage,BULK_MAX)}}),plannedNotes:input=>[`${bulkIds(input,usage,BULK_MAX).length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5BFE\u8C61\u306B\u3057\u307E\u3059\u3002`],execute:(input,ctx)=>runBulk(ctx,bulkIds(input,usage,BULK_MAX),spec.endpoint,spec.label,{}),summarize:bulkSummary,raw:body=>body}}var BULK_FAILURE_HELP="1\u4EF6\u3067\u3082\u5931\u6557\u3059\u308B\u3068\u7D42\u4E86\u30B3\u30FC\u30C9 3 \u3067\u7D42\u308F\u308A\u3001\u5931\u6557\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3068\u7406\u7531\u30FB\u9069\u7528\u6E08\u307F\u306E\u30D5\u30A1\u30A4\u30EB\u3092\
36
+ stderr \u306B\u51FA\u3057\u307E\u3059\n\uFF08\u30B5\u30FC\u30D0\u306F\u5931\u6557\u304C\u3042\u3063\u3066\u3082 HTTP 200 \u3092\u8FD4\u3059\u305F\u3081\uFF09\u3002bulk-publish / bulk-unpublish / bulk-archive \u306F\n\u5B58\u5728\u3057\u306A\u3044 ID \u304C1\u4EF6\u3067\u3082\u3042\u308B\u3068\u4ED6\u3082\u9069\u7528\u3057\u307E\u305B\u3093\u3002bulk-restore / bulk-move / bulk-delete \u306F1\u4EF6\u305A\u3064\u51E6\u7406\u3057\u3001\n\u5931\u6557\u3057\u305F\u3082\u306E\u4EE5\u5916\u306F\u9069\u7528\u3055\u308C\u307E\u3059\u3002";
37
+ async function runBulk(ctx,ids,endpoint,label,extra){const body=await ctx.send({method:"POST",path:`/api/v2/media/files/bulk/${endpoint}`,body:{file_ids:ids,...extra}});assertBulkSucceeded(bulkResult(body,label),ids.length,label,ctx);return body}var PERMANENT_FLAG={name:"--permanent",summary:"\u30B4\u30DF\u7BB1\u306B\u3042\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u5B8C\u5168\u306B\u524A\u9664\u3059\u308B\uFF08\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002\u5148\u306B bulk-delete \u3067\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u3053\u3068\uFF09",
38
+ takesValue:false};var MOVE_FOLDER_FLAG={name:"--folder",summary:"\u79FB\u52D5\u5148\u306E\u30D5\u30A9\u30EB\u30C0ID\uFF08\u7701\u7565\u6642\u306F\u30B9\u30B3\u30FC\u30D7\u306E\u6700\u4E0A\u4F4D\uFF09",takesValue:true,placeholder:"<\u30D5\u30A9\u30EB\u30C0ID>"};var MOVE_PROJECT_FLAG={name:"--project",summary:"\u79FB\u52D5\u5148\u3092\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u3059\u308B\uFF08\u30B3\u30FC\u30C9\u307E\u305F\u306F ID\uFF09\u3002\u7701\u7565\u6642\u306F\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB",
39
+ takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"};var BULK_DELETE_USAGE=bulkUsage("bulk-delete"," --yes [--permanent]");var BULK_MOVE_USAGE=bulkUsage("bulk-move"," [--project <\u30B3\u30FC\u30C9|ID>] [--folder <\u30D5\u30A9\u30EB\u30C0ID>]");var BULK_DOWNLOAD_USAGE=bulkUsage("bulk-download"," --out <\u30D1\u30B9.zip> [--force]");function bulkDeleteEndpoint(input){return input.flags.has("--permanent")?{endpoint:"permanent-delete",label:"\u4E00\u62EC\u5B8C\u5168\u524A\u9664"}:{endpoint:"delet\
40
+ e",label:"\u4E00\u62EC\u524A\u9664"}}var BULK_OPERATIONS=[...BULK_STATUS_OPERATIONS.map(bulkStatusOperation),{name:"bulk-move",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5225\u306E\u30D5\u30A9\u30EB\u30C0\u30FB\u30B9\u30B3\u30FC\u30D7\u3078\u79FB\u3059",usage:BULK_MOVE_USAGE,description:"\u79FB\u52D5\u5148\u306F --project\uFF08\u7121\u3051\u308C\u3070\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\uFF09\u3068 --folder\uFF08\u7121\u3051\u308C\u3070\u6700\u4E0A\u4F4D\uFF09\u3067\u6C7A\u307E\u308A\u307E\u3059\u3002\n--project \u3092\u4ED8\u3051\u306A\u3044\u3068\u304D\u3001\u65E2\u5B9A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08TWP_PROJECT \u7B49\uFF09\u306F\u4F7F\u3044\u307E\u305B\u3093\uFF08\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\u3078\u79FB\u3057\u307E\u3059\uFF09\u3002\n"+
41
+ BULK_FAILURE_HELP,flags:[MOVE_PROJECT_FLAG,MOVE_FOLDER_FLAG],async prepare(input,ctx){bulkIds(input,BULK_MOVE_USAGE,BULK_MAX);folderId(input);const scope=await resolveScope(input,ctx);const scopeId=scope["scopeId"]??(await ctx.resolver.currentUser()).id;return withResolved(input,{scope:requireScope(scope),scopeId})},plan:input=>({method:"POST",path:"/api/v2/media/files/bulk/move",body:bulkMoveBody(input)}),plannedNotes:input=>[`${bulkIds(input,BULK_MOVE_USAGE,BULK_MAX).length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u79FB\u3057\u307E\u3059\u3002`],
42
+ execute:(input,ctx)=>{const{file_ids:ids,...extra}=bulkMoveBody(input);return runBulk(ctx,ids,"move","\u4E00\u62EC\u79FB\u52D5",extra)},summarize:bulkSummary,raw:body=>body},{name:"bulk-delete",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\uFF08--permanent \u3067\u30B4\u30DF\u7BB1\u304B\u3089\u5B8C\u5168\u524A\u9664\uFF09",usage:BULK_DELETE_USAGE,description:"\u65E2\u5B9A\u306F\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u3060\u3051\u3067\u3001twp media bulk-restore \u3067\u623B\u305B\u307E\u3059\u3002\n--permanent \u3092\u4ED8\u3051\u308B\u3068\u30B4\u30DF\u7BB1\u306B\u3042\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u5B8C\u5168\u306B\u524A\u9664\u3057\u3001\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002\n\u30B4\u30DF\u7BB1\
43
+ \u306B\u7121\u3044\u30D5\u30A1\u30A4\u30EB\u306F\u5B8C\u5168\u524A\u9664\u3067\u304D\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u304C\u300C\u5148\u306B\u30B4\u30DF\u7BB1\u306B\u79FB\u52D5\u3057\u3066\u304F\u3060\u3055\u3044\u300D\u3067\u62D2\u5426\u3057\u307E\u3059\uFF09\u3002\n\u7834\u58CA\u7684\u306A\u64CD\u4F5C\u3068\u3057\u3066\u6271\u3046\u305F\u3081 --yes \u304C\u5FC5\u8981\u3067\u3059\u3002\u5BFE\u8C61\u4EF6\u6570\u306F --dry-run \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002\n"+BULK_FAILURE_HELP,
44
+ destructive:true,flags:[PERMANENT_FLAG],plan:input=>({method:"POST",path:`/api/v2/media/files/bulk/${bulkDeleteEndpoint(input).endpoint}`,body:{file_ids:bulkIds(input,BULK_DELETE_USAGE,BULK_MAX)}}),plannedNotes:input=>[input.flags.has("--permanent")?`${bulkIds(input,BULK_DELETE_USAGE,BULK_MAX).length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5B8C\u5168\u306B\u524A\u9664\u3057\u307E\u3059\uFF08\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\uFF09\u3002`:`${bulkIds(input,BULK_DELETE_USAGE,BULK_MAX).
45
+ length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3057\u307E\u3059\u3002`],execute:(input,ctx)=>{const{endpoint,label}=bulkDeleteEndpoint(input);return runBulk(ctx,bulkIds(input,BULK_DELETE_USAGE,BULK_MAX),endpoint,label,{})},summarize:bulkSummary,raw:body=>body},{name:"bulk-download",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092 ZIP \u306B\u307E\u3068\u3081\u3066\u66F8\u304D\u51FA\u3059",usage:BULK_DOWNLOAD_USAGE,description:`\u30B5\u30FC\u30D0\u304C ZIP \u3092\u4F5C\u308A\u3001\u305D\u306E\u7F72\u540DURL\u304B\u3089\u672C\u4F53\u3092\
46
+ \u53D7\u3051\u53D6\u308A\u307E\u3059\uFF08${BULK_DOWNLOAD_MAX} \u4EF6\u307E\u3067\uFF09\u3002
47
+ \u30B5\u30FC\u30D0\u306F\u5B58\u5728\u3057\u306A\u3044\u30FB\u8AAD\u3081\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u3092\u9ED9\u3063\u3066\u9664\u3044\u3066 ZIP \u3092\u4F5C\u308B\u306E\u3067\u3001ZIP \u306B\u5165\u3063\u305F\u4EF6\u6570\u304C
48
+ \u6307\u5B9A\u3088\u308A\u5C11\u306A\u3051\u308C\u3070\u66F8\u304D\u51FA\u3055\u305A\u306B\u7D42\u4E86\u30B3\u30FC\u30C9 3 \u3067\u7D42\u308F\u308A\u307E\u3059\u3002
49
+ \u66F8\u304D\u51FA\u3057\u5148\u306F --out \u3067\u5FC5\u305A\u6307\u5B9A\u3057\u307E\u3059\u3002\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u306F --force \u304C\u7121\u3051\u308C\u3070\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\u3002`,flags:[OUT_FLAG,FORCE_FLAG],download:{outFlag:"--out",forceFlag:"--force",signedUrl(body,plan){const data=dataOf(body,"\u4E00\u62EC\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9");const requested=isRecord(plan.body)&&Array.isArray(plan.body["file_ids"])?plan.body["file_ids"].length:
50
+ 0;const packed=data["file_count"];if(typeof packed==="number"&&packed<requested){throw new ApiRejectedError(`ZIP \u306B\u5165\u3063\u305F\u306E\u306F ${requested} \u4EF6\u4E2D ${packed} \u4EF6\u3067\u3057\u305F\uFF08\u5B58\u5728\u3057\u306A\u3044\u30FB\u8AAD\u3081\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u304C\u9664\u304B\u308C\u3066\u3044\u307E\u3059\uFF09\u3002\u66F8\u304D\u51FA\u3057\u3066\u3044\u307E\u305B\u3093\u3002twp media list \u3067 ID \u3092\u78BA\u304B\u3081\u3066\u6307\u5B9A\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
51
+ const url=data["download_url"];if(typeof url!=="string"||!/^https:\/\//.test(url)){throw new ApiResponseError("\u4E00\u62EC\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306E\u5FDC\u7B54\u306B data.download_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return url}},plan:input=>({method:"POST",path:"/api/v2/media/files/bulk/download",body:{file_ids:bulkIds(input,BULK_DOWNLOAD_USAGE,BULK_DOWNLOAD_MAX)}}),summarize:body=>body,raw:body=>body}];
52
+ function requireScope(scope){const value=scope["scope"];if(value===void 0)throw new Error("resolveScope \u304C scope \u3092\u8FD4\u3057\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u914D\u7DDA\u306E\u8AA4\u308A\uFF09");return value}function bulkMoveBody(input){const body={file_ids:bulkIds(input,BULK_MOVE_USAGE,BULK_MAX),scope:requireResolved(input,"scope"),scope_id:requireResolved(input,"scopeId")};const folder=folderId(input);if(folder!==void 0)body["folder_id"]=folder;return body}var LIST_USAGE="\
53
+ twp media list [--project <\u30B3\u30FC\u30C9|ID>] [--folder <\u30D5\u30A9\u30EB\u30C0ID>] [--keyword <\u8A9E>]";var UPLOAD_USAGE="twp media upload --file <\u30D1\u30B9> [--project <\u30B3\u30FC\u30C9|ID>] [--folder <\u30D5\u30A9\u30EB\u30C0ID>] [--name <\u540D\u524D>]";var DOWNLOAD_USAGE="twp media download <\u30D5\u30A1\u30A4\u30EBID> --out <\u30D1\u30B9> [--force]";var DELETE_USAGE="twp media delete <\u30D5\u30A1\u30A4\u30EBID> --yes";var mediaDomain={name:"media",summary:"\u30E1\u30C7\u30A3\u30A2\u30E9\u30A4\u30D6\u30E9\u30EA\u306E\u30D5\u30A1\u30A4\u30EB\uFF08\u30A2\u30C3\u30D7\u30ED\
54
+ \u30FC\u30C9\u30FB\u4E00\u89A7\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30FB\u524A\u9664\u30FB\u4E00\u62EC\u64CD\u4F5C\uFF09",operations:[{name:"list",summary:"\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u3059\u308B\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\uFF09",usage:LIST_USAGE,description:"--project \u3092\u4ED8\u3051\u308B\u3068\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u3001\u7121\u3051\u308C\u3070\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u30D5\u30A9\u30EB\u30C0\u3092\u4ED8\u3051\u306A\u3051\u308C\u3070\u30B9\u30B3\u30FC\u30D7\u306E\u6700\u4E0A\u4F4D\u306B\u3042\u308B\u30D5\u30A1\u30A4\u30EB\u3060\u3051\u3067\u3059\uFF08\u4E0B\u4F4D\u30D5\u30A9\u30EB\u30C0\u306F\u542B\u307F\u307E\u305B\u3093\uFF09\u3002\n\n"+
55
+ LIST_PAGING_HELP,flags:[MEDIA_PROJECT_FLAG,FOLDER_FLAG,KEYWORD_FLAG,...LIST_FLAGS],paging:envelopePaging({label:"\u30E1\u30C7\u30A3\u30A2\u4E00\u89A7",itemsKey:"data"}),async prepare(input,ctx){if(input.args.length>0){throw new UsageError(`list \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,LIST_USAGE)}return withResolved(input,await resolveScope(input,ctx))},plan(input){const resolved=input.resolved??{};const keyword=nonEmpty(input.flags,
56
+ "--keyword");return{method:"GET",path:"/api/v2/media/files",query:{scope:requireResolved(input,"scope"),scope_id:resolved["scopeId"],folder_id:folderId(input),keyword,limit:positiveInteger(input.flags,"--limit"),cursor:nonEmpty(input.flags,"--cursor")}}},summarize:body=>listRows(body).map(row=>pick(row,LIST_COLUMNS)),raw:body=>listRows(body),notes(body,input){if(nonEmpty(input.flags,"--keyword")===void 0)return[];const meta=isRecord(body)?body["meta"]:void 0;const total=isRecord(meta)?meta["tota\
57
+ l"]:void 0;const shown=listRows(body).length;if(typeof total!=="number"||total<=shown)return[];return[`\u691C\u7D22\u7D50\u679C ${total} \u4EF6\u306E\u3046\u3061 ${shown} \u4EF6\u3060\u3051\u3092\u8868\u793A\u3057\u3066\u3044\u307E\u3059\uFF08\u691C\u7D22\u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3057\u307E\u305B\u3093\u3002--limit \u3092\u4E0A\u3052\u308B\u304B\u8A9E\u3092\u7D5E\u3063\u3066\u304F\u3060\u3055\u3044\uFF09\u3002`]}},{name:"upload",summary:"\u30ED\u30FC\u30AB\u30EB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\uFF08\u767A\u884C\u30FB\u8EE2\u9001\u30FB\u5B8C\u4E86\u767B\u9332\u30921\u30B3\u30DE\u30F3\u30C9\u3067\uFF09",
58
+ usage:UPLOAD_USAGE,description:"\u5BB9\u91CF\u3092\u78BA\u304B\u3081\u3066\u304B\u3089\u3001\u6B21\u306E3\u5F80\u5FA9\u30921\u30B3\u30DE\u30F3\u30C9\u3067\u884C\u3044\u307E\u3059\u3002\n 0. POST /api/v2/storage/check-upload\uFF08\u30C6\u30CA\u30F3\u30C8\u306E\u5BB9\u91CF\u691C\u67FB\u3002\u8D85\u904E\u306A\u3089\u4F55\u3082\u767B\u9332\u305B\u305A\u306B\u6B62\u307E\u308A\u307E\u3059\uFF09\n 1. POST /api/v2/media/files/upload-url\uFF08\u7F72\u540DURL\u306E\u767A\u884C\u3002\u3053\u3053\u3067\u30D5\u30A1\u30A4\u30EB\u304C\u4EEE\u767B\u9332\u3055\u308C\u307E\u3059\uFF09\n 2. \u7F72\u540DURL\u3078 PUT\uFF08\u30D5\u30A1\u30A4\u30EB\u672C\u4F53\u3002TWP \u306E\u8A8D\u8A3C\u60C5\u5831\u306F\u9001\u308A\u307E\u305B\u3093\uFF09\n 3. POST /api/v2/media/files/{id}/complete\uFF08\u5B8C\u4E86\u767B\u9332\uFF09\n\u5B8C\u4E86\u767B\u9332\u306E\u5FDC\u7B54\u306E content_hash\uFF08sha256\uFF09\u3092\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u3068\u7A81\u304D\u5408\u308F\u305B\u3001\u4E00\u81F4\u3057\u306A\u3051\u308C\u3070\u5931\u6557\u3057\u307E\u3059\u3002\n2\u30FB3 \u304C\u5931\u6557\u3057\u305F\u5834\u5408\u306F\u30D5\u30A1\u30A4\u30EBID\u3068\u518D\u767B\u9332\u30FB\u7834\u68C4\u306E\u624B\u9806\u3092 stderr \u306B\u51FA\u3057\u3066\u5931\u6557\u3057\u307E\u3059\uFF08\u4EEE\u767B\u9332\u306F\u81EA\u52D5\u3067\u306F\u6D88\u3048\u307E\u305B\u3093\uFF09\u3002\n--dry-run \u306F 1 \u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3060\u3051\u3092\u8868\u793A\u3057\u307E\u3059\uFF082 \u4EE5\u964D\u306F 1 \u306E\u5FDC\u7B54\u306B\u4F9D\u5B58\u3059\u308B\u305F\u3081\uFF09\u3002",
59
+ flags:[FILE_FLAG,MEDIA_PROJECT_FLAG,FOLDER_FLAG,NAME_FLAG,CONTENT_TYPE_FLAG],async prepare(input,ctx){const local=localFile(input);folderId(input);return withResolved(input,{...await resolveScope(input,ctx),file:local.file,fileName:local.name,fileSize:String(local.size),contentType:local.contentType})},plan:uploadUrlPlan,plannedNotes:input=>[`\u5B9F\u884C\u6642\u306F\u3001\u3053\u306E\u524D\u306B\u5BB9\u91CF\u691C\u67FB\uFF08POST /api/v2/storage/check-upload\uFF09\u3092\u9001\u308A\u3001\u3053\u306E\u3042\u3068\u7F72\u540DURL\u3078 ${requireResolved(
60
+ input,"fileSize")} \u30D0\u30A4\u30C8\u3092 PUT \u3057\u3001\u5B8C\u4E86\u767B\u9332\uFF08POST \u2026/complete\uFF09\u3092\u9001\u308A\u307E\u3059\u3002`],execute:upload,summarize:body=>pick(body,UPLOAD_COLUMNS),raw:body=>body},{name:"download",summary:"\u30D5\u30A1\u30A4\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u30D5\u30A1\u30A4\u30EB\u3078\u66F8\u304D\u51FA\u3059",usage:DOWNLOAD_USAGE,description:"\u30D5\u30A1\u30A4\u30EBID \u306F twp media list \u306E id \u3067\u3059\u3002\n\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u7528\u306E\u7F72\u540DURL\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089\u672C\u4F53\u3092\u53D7\u3051\u53D6\u308A\u307E\u3059\uFF08\u7F72\u540DURL\u3078 TWP \u306E\u8A8D\u8A3C\u60C5\
61
+ \u5831\u306F\u9001\u308A\u307E\u305B\u3093\uFF09\u3002\n\u66F8\u304D\u51FA\u3057\u5148\u306F --out \u3067\u5FC5\u305A\u6307\u5B9A\u3057\u307E\u3059\uFF08\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09\u3002\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u306F --force \u304C\u7121\u3051\u308C\u3070\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\u3002",flags:[FILE_REF_FLAG,OUT_FLAG,FORCE_FLAG],download:{outFlag:"--out",forceFlag:"--force",signedUrl(body){const url=dataOf(body,"\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9URL\u53D6\u5F97")["\
62
+ download_url"];if(typeof url!=="string"||!/^https:\/\//.test(url)){throw new ApiResponseError("\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9URL\u53D6\u5F97\u306E\u5FDC\u7B54\u306B data.download_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return url}},plan:input=>({method:"GET",path:`${filePath(fileRef(input,DOWNLOAD_USAGE))}/download-url`}),summarize:body=>body,raw:body=>body},{name:"delete",summary:"\u30D5\u30A1\u30A4\u30EB\u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3059",
63
+ usage:DELETE_USAGE,description:"\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u3060\u3051\u3067\u3001\u753B\u9762\u306E\u30B4\u30DF\u7BB1\u304B\u3089\u5FA9\u5143\u3067\u304D\u307E\u3059\uFF08\u5B8C\u5168\u524A\u9664\u306F\u3057\u307E\u305B\u3093\uFF09\u3002\n\u7834\u58CA\u7684\u306A\u64CD\u4F5C\u3068\u3057\u3066\u6271\u3046\u305F\u3081 --yes \u304C\u5FC5\u8981\u3067\u3059\u3002",destructive:true,flags:[FILE_REF_FLAG],plan:input=>({method:"DELETE",path:filePath(fileRef(input,DELETE_USAGE))}),summarize:body=>body,
64
+ raw:body=>body},...BULK_OPERATIONS]};export{mediaDomain,orphanGuidance};
@@ -1,12 +1,12 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{activateModeFiles,activatePermissionSettings,buildResidentSet,buildSystemPrompt,createAuditLogger,createTwpToolkit,currentBranch,displayCwd,residentInputs,runTurn}from"./chunk-7PRQ7JW2.js";import"./chunk-NZ7WI4RZ.js";import"./chunk-EQWW2F5V.js";import"./chunk-JB27KNCX.js";import"./chunk-JKSXUBND.js";import"./chunk-II5RVJQN.js";import"./chunk-X4RS5VBH.js";import"./chunk-N2UVRM3Z.js";import{getMode}from"./chunk-NAUH75MM.js";import{RelayError,
4
- createRuntime,pickModel}from"./chunk-WOUKWOAR.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-PMOUHEJQ.js";import{checkMinSupportedVersion,enforceMinSupportedVersion,floorNeedsRefresh}from"./chunk-DXXFUNYN.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-M3GWY6NT.js";import"./chunk-VSJBJXZO.js";async function runOneShot(opts,deps={}){const out=deps.out??(text=>void process.stdout.write(stripTerminalControls(text)));const err=deps.err??(text=>void process.stderr.write(stripTerminalControls(text)));activateModeFiles(err);const permissionLayers=activatePermissionSettings(err,{...opts.allowedTools?{allowedTools:opts.allowedTools}:{},...opts.disallowedTools?{disallowedTools:opts.disallowedTools}:{}});const prompt=opts.fromStdin?await(deps.readStdin??readStdin)():opts.prompt;if(prompt.trim()===
3
+ import{activateModeFiles,activatePermissionSettings,buildResidentSet,buildSystemPrompt,createAuditLogger,createTwpToolkit,currentBranch,displayCwd,residentInputs,runTurn}from"./chunk-KEP5QSS4.js";import"./chunk-NZ7WI4RZ.js";import"./chunk-YVAN3H5W.js";import"./chunk-N2UVRM3Z.js";import"./chunk-NIAOX77K.js";import"./chunk-GMBJTG6A.js";import"./chunk-FTYJZFEK.js";import"./chunk-II5RVJQN.js";import{getMode}from"./chunk-NAUH75MM.js";import{RelayError,
4
+ createRuntime,pickModel}from"./chunk-Z2MNO3FT.js";import"./chunk-XNLIEUAW.js";import"./chunk-PMOUHEJQ.js";import"./chunk-J7QYPKVK.js";import{checkMinSupportedVersion,enforceMinSupportedVersion,floorNeedsRefresh}from"./chunk-DXXFUNYN.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";async function runOneShot(opts,deps={}){const out=deps.out??(text=>void process.stdout.write(stripTerminalControls(text)));const err=deps.err??(text=>void process.stderr.write(stripTerminalControls(text)));activateModeFiles(err);const permissionLayers=activatePermissionSettings(err,{...opts.allowedTools?{allowedTools:opts.allowedTools}:{},...opts.disallowedTools?{disallowedTools:opts.disallowedTools}:{}});const prompt=opts.fromStdin?await(deps.readStdin??readStdin)():opts.prompt;if(prompt.trim()===
5
5
  ""){err('\u30D7\u30ED\u30F3\u30D7\u30C8\u304C\u7A7A\u3067\u3059\u3002`twp -p "\u8CEA\u554F"`\uFF08`-p -` \u3067\u6A19\u6E96\u5165\u529B\uFF09\n');return 2}const runtime=deps.runtime??createRuntime({...opts.profile!==void 0?{profile:opts.profile}:{},...opts.model!==void 0?{model:opts.model}:{},cliVersion:opts.version});const cachedFloor=runtime.loadCachedFloor();if(await checkMinSupportedVersion({current:opts.version,cachedFloor:cachedFloor.minSupportedVersion,refresh:async()=>(await runtime.loadCatalog()).
6
6
  minSupportedVersion,write:err})){return 1}if(!runtime.loggedIn){err("\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u307E\u305B\u3093\u3002`twp login` \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n");return 1}let model=runtime.configuredModel??"";let catalog=null;if(model===""){catalog=await runtime.loadCatalog();const picked=pickModel(catalog,void 0);model=picked.model;if(catalog.source!=="server"){err(`\u26A0 \u30E2\u30C7\u30EB\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081 ${model}\
7
7
  \u3067\u5B9F\u884C\u3057\u307E\u3059\uFF08${catalog.source}\uFF09
8
- `)}}else if(floorNeedsRefresh(cachedFloor.fetchedAt)){catalog=await runtime.loadCatalog()}if(catalog!==null&&enforceMinSupportedVersion({current:opts.version,floor:catalog.minSupportedVersion,write:err})){return 1}const controller=new AbortController;let interrupted=false;const onSigint=()=>{interrupted=true;controller.abort()};process.on("SIGINT",onSigint);let wroteText=false;let ownedAudit=null;try{const mode=getMode(opts.mode);const toolkit=createTwpToolkit(runtime,opts.version);const resident=buildResidentSet(
9
- mode,{...residentInputs(toolkit),...opts.permissionMode!==void 0?{permissionMode:opts.permissionMode}:{},permissionLayers});const audit=deps.audit??(ownedAudit=createAuditLogger({mode:mode.id,permissionMode:opts.permissionMode,model,cwd:process.cwd(),cliVersion:opts.version,interactive:false,onOpen:file=>err(`audit: ${file}
8
+ `)}}else if(floorNeedsRefresh(cachedFloor.fetchedAt)){catalog=await runtime.loadCatalog()}if(catalog!==null&&enforceMinSupportedVersion({current:opts.version,floor:catalog.minSupportedVersion,write:err})){return 1}const controller=new AbortController;let interrupted=false;const onSigint=()=>{interrupted=true;controller.abort()};process.on("SIGINT",onSigint);let wroteText=false;let ownedAudit=null;let cancelCatalogRefresh=()=>void 0;try{const mode=getMode(opts.mode);const toolkit=createTwpToolkit(
9
+ runtime,opts.version);void toolkit.refreshCatalog();cancelCatalogRefresh=()=>toolkit.cancelCatalogRefresh();const resident=buildResidentSet(mode,{...residentInputs(toolkit),...opts.permissionMode!==void 0?{permissionMode:opts.permissionMode}:{},permissionLayers});const audit=deps.audit??(ownedAudit=createAuditLogger({mode:mode.id,permissionMode:opts.permissionMode,model,cwd:process.cwd(),cliVersion:opts.version,interactive:false,onOpen:file=>err(`audit: ${file}
10
10
  `)}));const result=await runTurn(runtime.client,runtime.context,{input:prompt,model,system:buildSystemPrompt({cwd:displayCwd(),branch:currentBranch(),modeLabel:mode.label,cliVersion:opts.version,toolNames:resident.tools.map(t=>t.name),...mode.prompt!==void 0?{modePrompt:mode.prompt}:{}}),signal:controller.signal,onTextDelta:delta=>{wroteText=true;out(stripTerminalControls(delta))},tools:resident.tools,execute:{mode,ctx:{cwd:process.cwd()},sessionAllow:new Set,permissionLayers,...opts.permissionMode!==
11
11
  void 0?{permissionMode:opts.permissionMode}:{},resolveTool:toolkit.resolveTool,prepareIndirect:toolkit.prepareIndirect,audit},onToolUse:()=>{if(wroteText){out("\n");wroteText=false}},onToolResult:(call,result2)=>err(`tool: ${call.name} \u2192 ${result2.denied===true?"denied":result2.isError===true?"error":"ok"}
12
12
  `)});if(result.text!==""&&!result.text.endsWith("\n"))out("\n");const u=result.usage;err(`usage: model=${model} input=${u.inputTokens} cache_read=${u.cacheReadTokens} cache_write=${u.cacheWriteTokens} output=${u.outputTokens}
@@ -16,4 +16,4 @@ void 0?{permissionMode:opts.permissionMode}:{},resolveTool:toolkit.resolveTool,p
16
16
  outputTokens>0){err(`usage(\u4E2D\u65AD\u307E\u3067): input=${partial.inputTokens} cache_read=${partial.cacheReadTokens} cache_write=${partial.cacheWriteTokens} output=${partial.outputTokens}
17
17
  `)}if(e instanceof RelayError){err(`${e.message}
18
18
  `);return 1}err(`\u30A8\u30E9\u30FC: ${e.message}
19
- `);return 1}finally{process.off("SIGINT",onSigint);ownedAudit?.close()}}async function readStdin(){const chunks=[];for await(const chunk of process.stdin)chunks.push(Buffer.from(chunk));return Buffer.concat(chunks).toString("utf8")}export{runOneShot};
19
+ `);return 1}finally{cancelCatalogRefresh();process.off("SIGINT",onSigint);ownedAudit?.close()}}async function readStdin(){const chunks=[];for await(const chunk of process.stdin)chunks.push(Buffer.from(chunk));return Buffer.concat(chunks).toString("utf8")}export{runOneShot};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{STATUS_VALUES,booleanQuery,flatMasterDomain}from"./chunk-IRAZ27WL.js";import"./chunk-UDPJ2IGK.js";import"./chunk-G4OO4M44.js";import{POSITIONS_PATH}from"./chunk-NIAOX77K.js";import"./chunk-GMBJTG6A.js";import"./chunk-FTYJZFEK.js";import"./chunk-ZN5EFDH7.js";import"./chunk-II5RVJQN.js";import"./chunk-ZWVYVS2A.js";import"./chunk-J7QYPKVK.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";
4
+ import"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";var positionDomain=flatMasterDomain({name:"position",label:"\u5F79\u8077",path:POSITIONS_PATH,itemKey:"position",summary:"\u5F79\u8077\u30DE\u30B9\u30BF\uFF08\u4E00\u89A7\u30FB\u53D6\u5F97\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF09",listColumns:["id","code","name","rank","is_manager","status","user_count"],getColumns:["id","code","name","name_short","rank","is_manager","status","description"],fields:[{kind:"text",flag:"--name-short",key:"name_short",label:"\u7565\u79F0",maxChars:50,
5
+ summary:"\u7565\u79F0"},{kind:"integer",flag:"--rank",key:"rank",label:"\u30E9\u30F3\u30AF",min:0,max:9999,summary:"\u30E9\u30F3\u30AF\uFF080\u301C9999\u3002\u5927\u304D\u3044\u307B\u3069\u4E0A\u4F4D\uFF09"},{kind:"boolean",flag:"--manager",key:"is_manager",summary:"\u7BA1\u7406\u8077\u304B\uFF08true / false\uFF09"},{kind:"boolean",flag:"--can-view-personal-info",key:"can_view_personal_info",summary:"\u90E8\u4E0B\u306E\u500B\u4EBA\u60C5\u5831\u3092\u95B2\u89A7\u3067\u304D\u308B\u304B\uFF08true / false\uFF09"},
6
+ {kind:"boolean",flag:"--can-view-emergency-contact",key:"can_view_emergency_contact",summary:"\u90E8\u4E0B\u306E\u7DCA\u6025\u9023\u7D61\u5148\u3092\u95B2\u89A7\u3067\u304D\u308B\u304B\uFF08true / false\uFF09"},{kind:"boolean",flag:"--can-view-work-tel",key:"can_view_work_tel",summary:"\u90E8\u4E0B\u306E\u696D\u52D9\u7528\u96FB\u8A71\u756A\u53F7\u3092\u95B2\u89A7\u3067\u304D\u308B\u304B\uFF08true / false\uFF09"},{kind:"enum",flag:"--status",key:"status",values:STATUS_VALUES,summary:"\u72B6\u614B\uFF08active: \u6709\
7
+ \u52B9 / inactive: \u7121\u52B9\uFF09"},{kind:"text",flag:"--description",key:"description",label:"\u8AAC\u660E",maxChars:1e3,summary:"\u8AAC\u660E"}],listFilters:[{flag:{name:"--manager",summary:"\u7BA1\u7406\u8077\u304B\u3069\u3046\u304B\u3067\u7D5E\u308A\u8FBC\u3080\uFF08true / false\uFF09",takesValue:true,placeholder:"<true|false>"},query:"is_manager",value:raw=>booleanQuery("--manager",raw)}],resolve:(ctx,ref,flag)=>ctx.resolver.position(ref,flag),deleteGuidance:"\u4ECA\u5F8C\u4F7F\u308F\u306A\u3044\u5F79\u8077\u306F\u3001\u524A\u9664\u305B\u305A\u306B\u7121\u52B9\u5316\u3057\u3066\u304F\u3060\u3055\u3044: t\
8
+ wp position update <\u5F79\u8077> --status inactive\n\uFF08\u7121\u52B9\u306B\u3057\u305F\u5F79\u8077\u306F\u3001\u65B0\u3057\u3044\u6240\u5C5E\u306E\u9078\u629E\u80A2\u306B\u51FA\u306A\u304F\u306A\u308A\u307E\u3059\u3002\u904E\u53BB\u306E\u6240\u5C5E\u306E\u8A18\u9332\u306F\u305D\u306E\u307E\u307E\u6B8B\u308A\u307E\u3059\uFF09"});export{positionDomain};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{isRecord,pick,requireResolved,withResolved}from"./chunk-GFC2ASHE.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-2VISRLWS.js";import{collapsesInUrlPath,safeProjectIdPolicy}from"./chunk-X4RS5VBH.js";import{ApiResponseError,UsageError}from"./chunk-M3GWY6NT.js";import"./chunk-VSJBJXZO.js";var LIST_COLUMNS=["id","code","name","status","effective_status"];var GET_COLUMNS=["id","code","name","status","effective_status","display_flg","closed_flg","task_enabled_flg","start_date","end_date","created_at","updated_at"];var MEMBER_COLUMNS=["user_id","user_name","user_email","role","alias","department_name"];function memberItems(body){const list=isRecord(body)?body["list"]:void 0;if(!Array.isArray(list)){throw new ApiResponseError("\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7\u306E\u5FDC\u7B54\u306B list \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
3
+ import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-G4OO4M44.js";import{collapsesInUrlPath,safeProjectIdPolicy}from"./chunk-GMBJTG6A.js";import{requireResolved,withResolved}from"./chunk-ZN5EFDH7.js";import{isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";var LIST_COLUMNS=["id","code","name","status","effective_status"];var GET_COLUMNS=["id","code","name","status","effective_status","display_flg","closed_flg","task_enabled_flg","start_date","end_date","created_at","updated_at"];var MEMBER_COLUMNS=["user_id","user_name","user_email","role","alias","department_name"];function memberItems(body){const list=isRecord(body)?body["list"]:void 0;if(!Array.isArray(list)){throw new ApiResponseError("\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7\u306E\u5FDC\u7B54\u306B list \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
4
4
  return list}var listPaging=envelopePaging({label:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7"});function listItems(body){return listPaging.items(body)}function projectObject(body){const project=isRecord(body)?body["project"]:void 0;if(!isRecord(project)){throw new ApiResponseError("\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u8A73\u7D30\u306E\u5FDC\u7B54\u306B project \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return project}
5
5
  var projectDomain={name:"project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7\u30FB\u8A73\u7D30",operations:[{name:"list",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u4E00\u89A7\u3059\u308B",usage:"twp project list [--all] [--limit <\u4EF6\u6570>] [--cursor <\u30AB\u30FC\u30BD\u30EB>] [--keyword <\u8A9E>] [--status <\u72B6\u614B>]",description:"--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\n--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08id / code / name / status / effective_status\uFF09\u3067\u3059\u3002\n\u6B32\u3057\u3044\u5217\u3060\u3051\u3092\
6
6
  \u6A5F\u68B0\u51E6\u7406\u3057\u305F\u3044\u3068\u304D\u306F --query \u3067\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08--query \u306F\u751F\u30C7\u30FC\u30BF\u306B\u5BFE\u3057\u3066\u8A55\u4FA1\u3055\u308C\u307E\u3059\uFF09\u3002\n\n"+LIST_PAGING_HELP,flags:[...LIST_FLAGS,{name:"--keyword",summary:"\u30B3\u30FC\u30C9\u30FB\u540D\u79F0\u306E\u90E8\u5206\u4E00\u81F4\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u8A9E>"},{name:"--status",summary:"\u30B9\u30C6\u30FC\u30BF\u30B9\u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u4F8B: active\uFF09",
@@ -0,0 +1,3 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{evaluateQuery}from"./chunk-GDM2QUBL.js";import"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";export{evaluateQuery};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{renderOutput}from"./chunk-APYYF7H6.js";import"./chunk-EQWW2F5V.js";import"./chunk-K2ONOH3L.js";import"./chunk-WVS4W5FY.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{renderOutput};
3
+ import{renderOutput}from"./chunk-5Q2CH4E7.js";import"./chunk-YVAN3H5W.js";import"./chunk-K2ONOH3L.js";import"./chunk-WVS4W5FY.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{renderOutput};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{CURATED_PAGING_VOCABULARY,buildPrepareContext,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain}from"./chunk-7LTTKKQA.js";import"./chunk-APYYF7H6.js";import"./chunk-EQWW2F5V.js";import"./chunk-O52CUEDO.js";import"./chunk-JB27KNCX.js";import"./chunk-JKSXUBND.js";import"./chunk-II5RVJQN.js";import"./chunk-2VISRLWS.js";import"./chunk-X4RS5VBH.js";import"./chunk-TAN5I2DP.js";import"./chunk-PEGUHUTD.js";
4
- import"./chunk-QQRJLH6B.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import"./chunk-K2ONOH3L.js";import"./chunk-WVS4W5FY.js";import"./chunk-NHYMHCAT.js";import"./chunk-E4H22AO5.js";import"./chunk-M3GWY6NT.js";import"./chunk-VSJBJXZO.js";export{CURATED_PAGING_VOCABULARY,buildPrepareContext,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain};
3
+ import{CURATED_PAGING_VOCABULARY,buildPrepareContext,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain}from"./chunk-X45SJNT2.js";import"./chunk-IOGVQVGD.js";import"./chunk-5Q2CH4E7.js";import"./chunk-YVAN3H5W.js";import"./chunk-G4OO4M44.js";import"./chunk-NIAOX77K.js";import"./chunk-GMBJTG6A.js";import"./chunk-FTYJZFEK.js";import"./chunk-II5RVJQN.js";import"./chunk-TAN5I2DP.js";import"./chunk-SP27PYHC.js";
4
+ import"./chunk-QQRJLH6B.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import"./chunk-K2ONOH3L.js";import"./chunk-WVS4W5FY.js";import"./chunk-NHYMHCAT.js";import"./chunk-GDM2QUBL.js";import"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";export{CURATED_PAGING_VOCABULARY,buildPrepareContext,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{REQUIRE_ZERO_STATUS,ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,parseTs}from"./chunk-UG2I6VRD.js";import"./chunk-ODLJ2LNQ.js";import"./chunk-GY7KI5E5.js";import"./chunk-J7QYPKVK.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";async function runScheduleCommand(deps,opts){const out=deps.out??(t=>void process.stdout.write(stripTerminalControls(t)));const err=deps.err??(t=>void process.stderr.write(stripTerminalControls(t)));const schedules=new ScheduleApi(deps.api);let now;if(opts.now){const parsed=parseTs(opts.now);if(!parsed){err(`--now \u306E\u5F62\u5F0F\u304C\u4E0D\u6B63\u3067\u3059: ${opts.now}\uFF08\u4F8B 2026-08-18T15:30\uFF09
3
+ import{REQUIRE_ZERO_STATUS,ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,parseTs}from"./chunk-VYDEUFGU.js";import"./chunk-BKZGBJWT.js";import"./chunk-GY7KI5E5.js";import"./chunk-J7QYPKVK.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";async function runScheduleCommand(deps,opts){const out=deps.out??(t=>void process.stdout.write(stripTerminalControls(t)));const err=deps.err??(t=>void process.stderr.write(stripTerminalControls(t)));const schedules=new ScheduleApi(deps.api);let now;if(opts.now){const parsed=parseTs(opts.now);if(!parsed){err(`--now \u306E\u5F62\u5F0F\u304C\u4E0D\u6B63\u3067\u3059: ${opts.now}\uFF08\u4F8B 2026-08-18T15:30\uFF09
4
4
  `);return 2}now=parsed}else{now=nowInZone(deps.config.scheduleTimezone,m=>err(`${m}
5
5
  `))}const defs=await schedules.definitions();if(defs.kind==="error"){err(`\u26D4 ${defs.message}
6
6
  `);if(opts.gate!==void 0){err("\u5B9A\u7FA9\u304C\u53D6\u308C\u306A\u3044\u305F\u3081\u30B2\u30FC\u30C8\u306F\u8A31\u53EF\u6271\u3044\u306B\u3057\u307E\u3059\n");return 0}return 4}if(opts.gate!==void 0){const{allowed,reason}=gateStatus(opts.gate,now,defs.config.gates);if(allowed)return 0;out(`${reason}
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{LoopSettingsApplier,PROMPT_KEYS,formatConfigHash,parseServerSettings,renderStepBudget}from"./chunk-Y2QAP6SU.js";import"./chunk-ODLJ2LNQ.js";import"./chunk-TYNCXQSN.js";import"./chunk-GY7KI5E5.js";import"./chunk-J7QYPKVK.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{LoopSettingsApplier,PROMPT_KEYS,formatConfigHash,parseServerSettings,renderStepBudget};
3
+ import{LoopSettingsApplier,PROMPT_KEYS,formatConfigHash,parseServerSettings,renderStepBudget}from"./chunk-WQ66EYZS.js";import"./chunk-BKZGBJWT.js";import"./chunk-TYNCXQSN.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-J7QYPKVK.js";import"./chunk-5WGOHFAS.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{LoopSettingsApplier,PROMPT_KEYS,formatConfigHash,parseServerSettings,renderStepBudget};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{PromptAbortedError,promptText}from"./chunk-L37NS5L2.js";import{detectAiClis,formatDetection,isDetectableAi,isSelectable}from"./chunk-24ZZFFA3.js";import{localConfigPath,parseClaudeLauncher}from"./chunk-XLE4HW6B.js";import{AiConfig}from"./chunk-TYNCXQSN.js";import"./chunk-N2UVRM3Z.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";
3
+ import{detectAiClis,formatDetection,isDetectableAi,isSelectable}from"./chunk-24ZZFFA3.js";import{PromptAbortedError,promptText}from"./chunk-L37NS5L2.js";import{localConfigPath,parseClaudeLauncher}from"./chunk-VGMWPPGD.js";import{AiConfig}from"./chunk-TYNCXQSN.js";import"./chunk-N2UVRM3Z.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";
4
4
  import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";var RECOMMENDED_ROTATION={complex:["claude"],verify:["claude"],security:["claude"],support:["claude"],triage:["claude"],search:["claude"],simple:["claude"]};var RECOMMENDED_CHAINS={complex:["claude","codex"],verify:["claude","codex","copilot"],security:["claude","codex","copilot"],support:["claude","codex","copilot"],triage:["codex","gemini","copilot","claude"],search:["codex","gemini","copilot","claude"],simple:["codex","gemini","copilot","claude"]};var PREFERENCE=["claude","codex","gemini","co\
5
5
  pilot"];function buildAiAssignment(selected){if(selected.length===0)throw new Error("\u9078\u629E\u3055\u308C\u305FAI\u304C\u7A7A\u3067\u3059");const fallbackOrder=PREFERENCE.filter(ai=>selected.includes(ai));for(const ai of selected)if(!fallbackOrder.includes(ai))fallbackOrder.push(ai);const chains={};const rotation={};for(const category of Object.keys(RECOMMENDED_CHAINS)){const filtered=(RECOMMENDED_CHAINS[category]??[]).filter(ai=>selected.includes(ai));const chain=filtered.length>0?filtered:
6
6
  [...fallbackOrder];chains[category]=chain;const rot=(RECOMMENDED_ROTATION[category]??[]).filter(ai=>selected.includes(ai));const head=chain[0];rotation[category]=rot.length>0?rot:head===void 0?[...fallbackOrder]:[head]}return{primary_rotation:rotation,fallback_chains:chains}}var SETUP_EXIT_NO_CLI=3;var SETUP_EXIT_ABORTED=130;async function runSetup(opts){const env=opts.env??process.env;const rawOut=opts.out??(t=>void process.stdout.write(t));const rawErr=opts.err??(t=>void process.stderr.write(t));
@@ -0,0 +1,61 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{apiExit,currentRevisionOf,errorDetail,pickNumber,printDiff,readUtf8Strict,shellQuote,str,warnHiddenChars}from"./chunk-P4AEFKLM.js";import"./chunk-VRBI2NPI.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import{EXIT_API_CLIENT,EXIT_API_SERVER,EXIT_FAILURE,EXIT_OK,EXIT_USAGE}from"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";import{createHash}from"crypto";import*as fs from"fs";import*as path from"path";var DEFAULT_SKILL_DIR=".claude/commands";var NAME_PATTERN=/^[a-z][a-z0-9-]*$/;var NAME_MAX_LENGTH=64;var MAX_BODY_BYTES=35e4;var MAX_SKILLS_PER_PROJECT=200;function isValidSkillName(name){return name.length<=NAME_MAX_LENGTH&&NAME_PATTERN.test(name)}function skillDigest(body){return"sha256:"+createHash("sha256").update(Buffer.from(body,"utf8")).digest("hex")}function defaultFileKind(p){try{return fs.lstatSync(p).isFile()?"file":"other"}catch(e){return e.code==="ENOENT"?"missing":"other"}}function defaultWriteFile(p,c){
4
+ const tmp=path.join(path.dirname(p),`.${path.basename(p)}.tmp-${process.pid}`);try{fs.writeFileSync(tmp,c,{encoding:"utf8",flag:"wx"});fs.renameSync(tmp,p)}catch(e){fs.rmSync(tmp,{force:true});throw e}}async function runSkillCommand(deps,opts){const io={out:deps.out??(t=>void process.stdout.write(stripTerminalControls(t))),err:deps.err??(t=>void process.stderr.write(stripTerminalControls(t))),readFile:deps.readFile??readUtf8Strict,writeFile:deps.writeFile??defaultWriteFile,fileKind:deps.fileKind??
5
+ defaultFileKind,listDir:deps.listDir??(d=>{try{return fs.readdirSync(d)}catch{return null}}),mkdir:deps.mkdir??(d=>void fs.mkdirSync(d,{recursive:true}))};if(opts.name===void 0===!opts.all){io.err("\u30B9\u30AD\u30EB\u540D\u304B --all \u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\n");return EXIT_USAGE}if(opts.name!==void 0&&!isValidSkillName(opts.name)){io.err(`\u30B9\u30AD\u30EB\u540D\u304C\u4E0D\u6B63\u3067\u3059: ${opts.name}\uFF08\u82F1\u5C0F\u6587\u5B57\u3067\u59CB\u307E\u308A\u3001\u82F1\u5C0F\u6587\u5B57\u30FB\u6570\u5B57\
6
+ \u30FB\u30CF\u30A4\u30D5\u30F3\u3060\u3051\u306E${NAME_MAX_LENGTH}\u6587\u5B57\u4EE5\u5185\uFF09
7
+ `);return EXIT_USAGE}if(opts.op==="push"){return opts.all?pushAll(deps.api,opts,io):pushOne(deps.api,opts,opts.name,io)}return opts.all?pullAll(deps.api,opts,io):pullOne(deps.api,opts,opts.name,io)}function dirOf(opts){return opts.dir??DEFAULT_SKILL_DIR}function fileOf(opts,name){return path.join(dirOf(opts),`${name}.md`)}function rejectBody(file,body,err){if(body===""){err(`\u30D5\u30A1\u30A4\u30EB\u304C\u7A7A\u3067\u3059: ${file}\uFF08\u30B5\u30FC\u30D0\u306F\u7A7A\u306E\u672C\u6587\u3092\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093\uFF09
8
+ `);return true}const bytes=Buffer.byteLength(body,"utf8");if(bytes>MAX_BODY_BYTES){err(`\u30D5\u30A1\u30A4\u30EB\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u307E\u3059: ${file}\uFF08${bytes} / ${MAX_BODY_BYTES} \u30D0\u30A4\u30C8\uFF09
9
+ `);return true}return false}function readLocal(file,io){const kind=io.fileKind(file);if(kind==="other"){io.err(`\u901A\u5E38\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u306A\u3044\u305F\u3081\u8AAD\u307F\u307E\u305B\u3093\uFF08\u30B7\u30F3\u30DC\u30EA\u30C3\u30AF\u30EA\u30F3\u30AF\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u7B49\uFF09: ${file}
10
+ `);return null}try{return io.readFile(file)}catch(e){io.err(`\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u3081\u307E\u305B\u3093: ${file}\uFF08${e.message}\uFF09
11
+ `);return null}}async function pushOne(api,opts,name,io){let expected;if(opts.revision!==void 0){if(!/^\d+$/.test(opts.revision)){io.err(`--revision \u306F0\u4EE5\u4E0A\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${opts.revision}
12
+ `);return EXIT_USAGE}if(!opts.yes){io.err("--revision \u306F --yes \u3068\u4E00\u7DD2\u306B\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08--yes \u306A\u3057\u3067\u306F\u767B\u9332\u3057\u307E\u305B\u3093\uFF09\n");return EXIT_USAGE}expected=Number(opts.revision)}const file=fileOf(opts,name);const local=readLocal(file,io);if(local===null)return EXIT_USAGE;if(rejectBody(file,local,io.err))return EXIT_USAGE;const current=await fetchSkill(api,name,io.err);if(typeof current==="number")return current;
13
+ if(current!==null&&current.body===local){io.out(`${name}: \u5DEE\u5206\u306F\u3042\u308A\u307E\u305B\u3093\uFF08revision ${current.revision}\uFF09\u3002\u767B\u9332\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002
14
+ `);return EXIT_OK}const serverRevision=current?.revision??0;printDiff(io.out,serverLabel(name,current),file,current?.body??"",local);if(!opts.yes){io.out(`
15
+ \u767B\u9332\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u5DEE\u5206\u3067\u78BA\u5B9A\u3059\u308B\u306B\u306F\u6B21\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\uFF08revision ${serverRevision} \u3092\u9001\u308B\u306E\u3067\u3001\u305D\u306E\u5F8C\u30B5\u30FC\u30D0\u304C\u66F4\u65B0\u3055\u308C\u3066\u3044\u308C\u3070 409 \u3067\u6B62\u307E\u308A\u307E\u3059\uFF09:
16
+ ${confirmCommand(opts,name,String(serverRevision))}
17
+ `);return EXIT_USAGE}const result=await putSkill(api,name,local,expected??serverRevision,io);return result}async function pushAll(api,opts,io){let expected;if(opts.revision!==void 0){const parsed=parseRevisionMap(opts.revision);if(parsed===null){io.err(`--all \u306E --revision \u306F\u300C\u540D\u524D=\u756A\u53F7\u300D\u3092\u30AB\u30F3\u30DE\u3067\u533A\u5207\u3063\u3066\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: plan=3,review=0\uFF09: ${opts.revision}
18
+ `);return EXIT_USAGE}if(!opts.yes){io.err("--revision \u306F --yes \u3068\u4E00\u7DD2\u306B\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08--yes \u306A\u3057\u3067\u306F\u767B\u9332\u3057\u307E\u305B\u3093\uFF09\n");return EXIT_USAGE}expected=parsed}const dir=dirOf(opts);const entries=io.listDir(dir);if(entries===null){io.err(`\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8AAD\u3081\u307E\u305B\u3093: ${dir}
19
+ `);return EXIT_USAGE}const names=[];const badName=[];const notFile=[];for(const entry of entries.sort()){if(!entry.toLowerCase().endsWith(".md"))continue;const stem=entry.slice(0,-3);if(!entry.endsWith(".md")||!isValidSkillName(stem))badName.push(entry);else if(io.fileKind(path.join(dir,entry))!=="file")notFile.push(entry);else names.push(stem)}if(badName.length>0){io.out(`\u5BFE\u8C61\u5916\uFF08\u30B9\u30AD\u30EB\u540D\u306E\u5F62\u5F0F\u306B\u5408\u308F\u306A\u3044\uFF09: ${badName.join(", ")}\
20
+
21
+ `)}if(notFile.length>0){io.out(`\u5BFE\u8C61\u5916\uFF08\u901A\u5E38\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u306A\u3044\uFF1D\u30B7\u30F3\u30DC\u30EA\u30C3\u30AF\u30EA\u30F3\u30AF\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u7B49\uFF09: ${notFile.join(", ")}
22
+ `)}if(names.length===0){io.err(`${dir} \u306B\u767B\u9332\u3067\u304D\u308B\u30B9\u30AD\u30EB\u30D5\u30A1\u30A4\u30EB\uFF08<\u540D\u524D>.md\uFF09\u304C\u3042\u308A\u307E\u305B\u3093
23
+ `);return EXIT_USAGE}const locals=new Map;for(const name of names){const file=fileOf(opts,name);const body=readLocal(file,io);if(body===null)return EXIT_USAGE;if(rejectBody(file,body,io.err))return EXIT_USAGE;locals.set(name,body)}const list=await fetchList(api,io.err);if(typeof list==="number")return list;const server=new Map(list.map(s=>[s.name,s]));const plans=[];let unchanged=0;for(const name of names){const body=locals.get(name);const file=fileOf(opts,name);const summary=server.get(name);if(summary!==
24
+ void 0&&summary.digest===skillDigest(body)){unchanged++;continue}const current=summary===void 0?null:await fetchSkill(api,name,io.err);if(typeof current==="number")return current;if(current!==null&&current.body===body){unchanged++;continue}printDiff(io.out,serverLabel(name,current),file,current?.body??"",body);io.out("\n");plans.push({name,file,body,revision:current?.revision??0,isNew:current===null})}const serverOnly=list.filter(s=>!locals.has(s.name)).map(s=>s.name);io.out(`\u66F4\u65B0 ${plans.
25
+ filter(p=>!p.isNew).length} \u4EF6 / \u65B0\u898F ${plans.filter(p=>p.isNew).length} \u4EF6 / \u5DEE\u5206\u306A\u3057 ${unchanged} \u4EF6`+(serverOnly.length>0?` / \u30B5\u30FC\u30D0\u306E\u307F ${serverOnly.length} \u4EF6\uFF08\u524A\u9664\u3057\u307E\u305B\u3093: ${serverOnly.join(", ")}\uFF09`:"")+"\n");if(plans.length===0){io.out("\u5DEE\u5206\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u767B\u9332\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002\n");return EXIT_OK}const revisionArg=plans.map(
26
+ p=>`${p.name}=${p.revision}`).join(",");if(!opts.yes){io.out(`
27
+ \u767B\u9332\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u5DEE\u5206\u3067\u78BA\u5B9A\u3059\u308B\u306B\u306F\u6B21\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u8868\u793A\u3057\u305F revision \u3092\u9001\u308B\u306E\u3067\u3001\u305D\u306E\u5F8C\u30B5\u30FC\u30D0\u304C\u66F4\u65B0\u3055\u308C\u305F\u30B9\u30AD\u30EB\u306F 409 \u3067\u6B62\u307E\u308A\u307E\u3059\uFF09:
28
+ ${confirmCommand(opts,void 0,revisionArg)}
29
+ `);return EXIT_USAGE}if(expected!==void 0){const unseen=plans.filter(p=>!expected.has(p.name)).map(p=>p.name);const unknown=[...expected.keys()].filter(n=>!locals.has(n));if(unseen.length>0||unknown.length>0){io.err("\u26D4 --revision \u306E\u4E00\u89A7\u304C\u73FE\u5728\u306E\u5DEE\u5206\u3068\u4E00\u81F4\u3057\u307E\u305B\u3093\uFF08\u8868\u793A\u5F8C\u306B\u30D5\u30A1\u30A4\u30EB\u304B\u30B5\u30FC\u30D0\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF09\u30021\u4EF6\u3082\u767B\u9332\u3057\u3066\u3044\u307E\u305B\u3093\u3002"+
30
+ (unseen.length>0?` \u4E00\u89A7\u306B\u7121\u3044\u5DEE\u5206: ${unseen.join(", ")}\u3002`:"")+(unknown.length>0?` \u30D5\u30A1\u30A4\u30EB\u304C\u7121\u3044\u30B9\u30AD\u30EB: ${unknown.join(", ")}\u3002`:"")+" --yes \u3092\u5916\u3057\u3066\u5DEE\u5206\u3092\u898B\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\n");return EXIT_USAGE}const moved=plans.filter(p=>expected.get(p.name)!==p.revision);if(moved.length>0){io.err("\u26D4 \u8868\u793A\u5F8C\u306B\u30B5\u30FC\u30D0\u3067\u66F4\u65B0\u3055\u308C\u305F\u30B9\u30AD\u30EB\u304C\u3042\u308A\u307E\u3059\u3002\u4E0A\u66F8\u304D\u305B\u305A\u30011\u4EF6\u3082\u767B\u9332\u3057\u3066\u3044\u307E\u305B\u3093: "+
31
+ moved.map(p=>`${p.name}\uFF08\u6848\u5185 ${expected.get(p.name)} \u2192 \u73FE\u5728 ${p.revision}\uFF09`).join(", ")+"\u3002--yes \u3092\u5916\u3057\u3066\u5DEE\u5206\u3092\u898B\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\n");return EXIT_API_CLIENT}}const newCount=plans.filter(p=>p.isNew).length;if(list.length+newCount>MAX_SKILLS_PER_PROJECT){io.err(`\u26D4 \u767B\u9332\u3059\u308B\u3068\u30B5\u30FC\u30D0\u306E\u4E0A\u9650\uFF081\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8 ${MAX_SKILLS_PER_PROJECT} \u4EF6\uFF09\u3092\
32
+ \u8D85\u3048\u307E\u3059\uFF08\u767B\u9332\u6E08\u307F ${list.length} \u4EF6 + \u65B0\u898F ${newCount} \u4EF6\uFF09\u30021\u4EF6\u3082\u767B\u9332\u3057\u3066\u3044\u307E\u305B\u3093
33
+ `);return EXIT_USAGE}const done=[];for(const plan of plans){const code=await putSkill(api,plan.name,plan.body,expected?.get(plan.name)??plan.revision,io);if(code!==EXIT_OK){const rest=plans.slice(plans.indexOf(plan)+1).map(p=>p.name);io.err(`\u26D4 ${plan.name} \u3067\u6B62\u3081\u307E\u3057\u305F\u3002\u767B\u9332\u6E08\u307F: ${done.length>0?done.join(", "):"\u306A\u3057"} \uFF0F \u672A\u767B\u9332: ${[plan.name,...rest].join(", ")}
34
+ `);return code}done.push(plan.name)}return EXIT_OK}function parseRevisionMap(raw){const map=new Map;for(const part of raw.split(",")){const m=/^([^=]+)=(\d+)$/.exec(part);if(m===null)return null;const name=m[1];if(!isValidSkillName(name)||map.has(name))return null;map.set(name,Number(m[2]))}return map}async function putSkill(api,name,body,revision,io){const res=await api.request("PUT",`/settings/skills/${encodeURIComponent(name)}`,{body,revision});if(!res.ok){if(res.status===409){const now=currentRevisionOf(
35
+ res);io.err(`\u26D4 ${name}: 409: revision ${revision} \u3067\u9001\u308A\u307E\u3057\u305F\u304C\u3001\u30B5\u30FC\u30D0\u306F${now!==null?` revision ${now} \u306B`:""}\u66F4\u65B0\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u753B\u9762\u7B49\u3067\u7DE8\u96C6\u3055\u308C\u305F\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u4E0A\u66F8\u304D\u305B\u305A\u306B\u6B62\u3081\u307E\u3057\u305F\uFF08\u5DEE\u5206\u3092\u78BA\u8A8D\u3057\u3066\u304B\u3089\u3084\u308A\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\uFF09
36
+ ${errorDetail(res)}
37
+ `);return apiExit(res)}io.err(`\u26D4 ${name}: \u30B9\u30AD\u30EB\u5B9A\u7FA9\u3092\u767B\u9332\u3067\u304D\u307E\u305B\u3093\uFF08${errorDetail(res)}\uFF09
38
+ `);return apiExit(res)}const saved=parseDetail(res);if(saved===null){io.err(`\u26A0\uFE0F ${name}: \u5FDC\u7B54\u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\u3002\u53CD\u6620\u3055\u308C\u305F\u304B\u3092 pull \u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u5FDC\u7B54\u306E\u5148\u982D: ${res.raw.slice(0,120)}\uFF09
39
+ `);return EXIT_API_SERVER}io.out(`${name}: \u767B\u9332\u3057\u307E\u3057\u305F: revision ${saved.revision}\uFF08\u66F4\u65B0\u8005: ${saved.updatedByName||"\u4E0D\u660E"}${saved.updatedAt?`\u30FB${saved.updatedAt}`:""}\uFF09
40
+ `);return EXIT_OK}async function pullOne(api,opts,name,io){const current=await fetchSkill(api,name,io.err);if(typeof current==="number")return current;const target=fileOf(opts,name);if(current===null){io.err(`\u30B5\u30FC\u30D0\u306B\u30B9\u30AD\u30EB ${name} \u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002${target} \u306F\u5909\u66F4\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002
41
+ `);return EXIT_FAILURE}const local=readExisting(target,io);if(typeof local==="number")return local;if(local!==null){if(local===current.body){io.out(`${target} \u306F\u30B5\u30FC\u30D0\uFF08revision ${current.revision}\uFF09\u3068\u540C\u3058\u3067\u3059\u3002\u5909\u66F4\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002
42
+ `);return EXIT_OK}printDiff(io.out,target,serverLabel(name,current),local,current.body);if(!opts.yes){io.out(`
43
+ ${target} \u3092\u4E0A\u66F8\u304D\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u4E0A\u66F8\u304D\u3059\u308B\u306B\u306F --yes \u3092\u4ED8\u3051\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
44
+ `);return EXIT_USAGE}}else{warnHiddenChars(io.out,current.body)}return writeSkill(target,current,io)?EXIT_OK:EXIT_FAILURE}async function pullAll(api,opts,io){const list=await fetchList(api,io.err);if(typeof list==="number")return list;if(list.length===0){io.err("\u30B5\u30FC\u30D0\u306B\u30B9\u30AD\u30EB\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30D5\u30A1\u30A4\u30EB\u306F\u5909\u66F4\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002\n");return EXIT_FAILURE}const writes=[];
45
+ let unchanged=0;for(const summary of list){const target=fileOf(opts,summary.name);const local=readExisting(target,io);if(typeof local==="number")return local;if(local!==null&&skillDigest(local)===summary.digest){unchanged++;continue}const detail=await fetchSkill(api,summary.name,io.err);if(typeof detail==="number")return detail;if(detail===null){io.out(`${summary.name}: \u4E00\u89A7\u306E\u53D6\u5F97\u5F8C\u306B\u30B5\u30FC\u30D0\u304B\u3089\u524A\u9664\u3055\u308C\u307E\u3057\u305F\u3002\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3059\u3002
46
+ `);continue}if(local!==null&&local===detail.body){unchanged++;continue}if(local!==null){printDiff(io.out,target,serverLabel(summary.name,detail),local,detail.body);io.out("\n")}else{warnHiddenChars(io.out,detail.body,summary.name)}writes.push({target,detail,overwrite:local!==null})}const overwrites=writes.filter(w=>w.overwrite).length;io.out(`\u4E0A\u66F8\u304D ${overwrites} \u4EF6 / \u65B0\u898F ${writes.length-overwrites} \u4EF6 / \u5DEE\u5206\u306A\u3057 ${unchanged} \u4EF6
47
+ `);if(writes.length===0){io.out("\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n");return EXIT_OK}if(overwrites>0&&!opts.yes){io.out("\n\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u3044\u3066\u3044\u307E\u305B\u3093\u3002\u4E0A\u66F8\u304D\u3092\u542B\u3080\u305F\u3081\u3001--yes \u3092\u4ED8\u3051\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n");return EXIT_USAGE}const done=[];for(const w of writes){if(!writeSkill(w.target,w.detail,io)){const rest=writes.slice(writes.indexOf(
48
+ w)).map(x=>x.detail.name);io.err(`\u26D4 \u5C55\u958B\u6E08\u307F: ${done.length>0?done.join(", "):"\u306A\u3057"} \uFF0F \u672A\u5C55\u958B: ${rest.join(", ")}
49
+ `);return EXIT_FAILURE}done.push(w.detail.name)}return EXIT_OK}function readExisting(target,io){const kind=io.fileKind(target);if(kind==="missing")return null;if(kind==="other"){io.err(`\u901A\u5E38\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u306A\u3044\u305F\u3081\u66F8\u304D\u8FBC\u307F\u307E\u305B\u3093\uFF08\u30B7\u30F3\u30DC\u30EA\u30C3\u30AF\u30EA\u30F3\u30AF\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u7B49\uFF09: ${target}
50
+ `);return EXIT_FAILURE}try{return io.readFile(target)}catch(e){io.err(`\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u3081\u307E\u305B\u3093: ${target}\uFF08${e.message}\uFF09
51
+ `);return EXIT_FAILURE}}function writeSkill(target,detail,io){try{io.mkdir(path.dirname(target));io.writeFile(target,detail.body)}catch(e){io.err(`\u66F8\u304D\u8FBC\u3081\u307E\u305B\u3093: ${target}\uFF08${e.message}\uFF09
52
+ `);return false}io.out(`${target} \u306B\u5C55\u958B\u3057\u307E\u3057\u305F\uFF08revision ${detail.revision}\uFF09\u3002
53
+ `);return true}async function fetchSkill(api,name,err){const res=await api.request("GET",`/settings/skills/${encodeURIComponent(name)}`);if(!res.ok){if(res.status===404&&reasonOf(res)==="skill_not_found")return null;err(`\u26D4 \u30B9\u30AD\u30EB ${name} \u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\uFF08${errorDetail(res)}\uFF09
54
+ `);return apiExit(res)}const detail=parseDetail(res);if(detail===null){err(`\u26D4 \u30B9\u30AD\u30EB ${name} \u306E\u5FDC\u7B54\u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\uFF08\u5FDC\u7B54\u306E\u5148\u982D: ${res.raw.slice(0,120)}\uFF09
55
+ `);return EXIT_API_SERVER}if(detail.name!==name){err(`\u26D4 \u30B9\u30AD\u30EB ${name} \u3092\u6C42\u3081\u307E\u3057\u305F\u304C\u3001\u30B5\u30FC\u30D0\u306F ${detail.name} \u3092\u8FD4\u3057\u307E\u3057\u305F
56
+ `);return EXIT_API_SERVER}return detail}async function fetchList(api,err){const res=await api.request("GET","/settings/skills");if(!res.ok){err(`\u26D4 \u30B9\u30AD\u30EB\u5B9A\u7FA9\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\uFF08${errorDetail(res)}\uFF09
57
+ `);return apiExit(res)}const b=unwrap(res,"skills");const raw=b["skills"];if(!Array.isArray(raw)){err(`\u26D4 \u30B9\u30AD\u30EB\u5B9A\u7FA9\u306E\u4E00\u89A7\u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\uFF08\u5FDC\u7B54\u306E\u5148\u982D: ${res.raw.slice(0,120)}\uFF09
58
+ `);return EXIT_API_SERVER}const out=[];for(const item of raw){const r=item&&typeof item==="object"?item:{};const name=str(r["name"]);const digest=str(r["digest"]);const revision=pickNumber(r,"revision");if(!isValidSkillName(name)||!/^sha256:[0-9a-f]{64}$/.test(digest)||revision===null){err(`\u26D4 \u30B9\u30AD\u30EB\u5B9A\u7FA9\u306E\u4E00\u89A7\u306B\u5951\u7D04\u5916\u306E\u8981\u7D20\u304C\u3042\u308A\u307E\u3059\uFF08${JSON.stringify(item).slice(0,160)}\uFF09
59
+ `);return EXIT_API_SERVER}out.push({name,digest,revision})}return out}function unwrap(res,key){const json=res.json??{};const data=json["data"];if(data&&typeof data==="object"&&!Array.isArray(data)&&key in data){return data}return json}function parseDetail(res){const b=unwrap(res,"revision");const revision=pickNumber(b,"revision");const body=b["body"];const name=b["name"];if(revision===null||typeof body!=="string"||typeof name!=="string")return null;return{name,body,revision,updatedByName:str(b["\
60
+ updated_by_name"]),updatedAt:str(b["updated_at"])}}function reasonOf(res){const json=res.json??{};const data=json["data"]&&typeof json["data"]==="object"?json["data"]:{};return str(json["error"])||str(json["reason"])||str(data["reason"])}function serverLabel(name,current){if(current===null)return`\u30B5\u30FC\u30D0\uFF08${name}\u30FB\u672A\u767B\u9332\uFF09`;return`\u30B5\u30FC\u30D0\uFF08${name}\u30FBrevision ${current.revision}${current.updatedByName?`\u30FB${current.updatedByName}`:""}\uFF09`}
61
+ function confirmCommand(opts,name,revision){const parts=["twp task-loop skill push","--project",shellQuote(opts.projectRef)];if(opts.profile!==void 0)parts.push("--profile",shellQuote(opts.profile));if(opts.dir!==void 0)parts.push("--dir",shellQuote(opts.dir));parts.push(name===void 0?"--all":shellQuote(name),"--yes","--revision",shellQuote(revision));return parts.join(" ")}export{DEFAULT_SKILL_DIR,isValidSkillName,runSkillCommand,skillDigest};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{checkUploadPlan,checkUploadQuota,storageDomain}from"./chunk-DDKZ5IPT.js";import"./chunk-ZWVYVS2A.js";import"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";export{checkUploadPlan,checkUploadQuota,storageDomain};
@@ -1,61 +1,9 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{acknowledgement,isRecord,pick,requireResolved,singleRef,withResolved}from"./chunk-GFC2ASHE.js";import{charCount,readBody}from"./chunk-QVXZEUKN.js";import{repeatedValues}from"./chunk-O52CUEDO.js";import{PRIVATE_TASKS_PATH,TASK_MASTERS}from"./chunk-JB27KNCX.js";import"./chunk-JKSXUBND.js";import{PRIVATE_TASK_KEY_PREFIX,isPrivateTaskKey,isTaskKey}from"./chunk-II5RVJQN.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-2VISRLWS.js";
4
- import{isSafePathSegment,safeProjectIdPolicy}from"./chunk-X4RS5VBH.js";import{PRIVATE_PROJECT_REF,isPrivateProjectRef}from"./chunk-GY7KI5E5.js";import"./chunk-QQRJLH6B.js";import"./chunk-J7QYPKVK.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import{ApiResponseError,UsageError}from"./chunk-M3GWY6NT.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";function classifyTaskRef(ref){const value=ref.trim();if(safeProjectIdPolicy.isDirectId(value))return{kind:"id",value};if(isTaskKey(value))return{kind:"key",value};return{kind:"unknown",value}}function wantsPrivateSurface(input){const project=input.flags.get("--project");return project!==void 0&&isPrivateProjectRef(project)}function taskSurface(input,ref){const project=input.flags.get("--project");const{kind,value}=classifyTaskRef(ref);if(project!==void 0&&isPrivateProjectRef(project)){if(kind===
5
- "key"&&!isPrivateTaskKey(value)){throw new UsageError(`--project ${PRIVATE_PROJECT_REF}\uFF08\u500B\u4EBA\u30BF\u30B9\u30AF\uFF09\u306B ${value} \u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30AD\u30FC\u306F ${PRIVATE_TASK_KEY_PREFIX}-<\u756A\u53F7> \u306E\u5F62\u3067\u3059\u3002ID\uFF08UUID / ULID\uFF09\u3067\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002
6
- \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30BF\u30B9\u30AF\u3092\u6307\u3059\u306A\u3089 --project ${PRIVATE_PROJECT_REF} \u3092\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return"private"}if(kind==="key"&&isPrivateTaskKey(value)&&project===void 0){throw new UsageError(`${value} \u306F\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30AD\u30FC\u306B\u3082\u3001\u30B3\u30FC\u30C9 ${PRIVATE_TASK_KEY_PREFIX} \u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30BF\u30B9\u30AF\u30AD\u30FC\u306B\u3082\u8AAD\u3081\u307E\u3059`,
7
- `\u3069\u3061\u3089\u3092\u6307\u3059\u304B --project \u3067\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002
8
- \u500B\u4EBA\u30BF\u30B9\u30AF : --project ${PRIVATE_PROJECT_REF}
9
- \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8: --project ${PRIVATE_TASK_KEY_PREFIX}`)}return"project"}function rejectPrivateSurface(input,what){if(!wantsPrivateSurface(input))return;throw new UsageError(`--project ${PRIVATE_PROJECT_REF}\uFF08\u500B\u4EBA\u30BF\u30B9\u30AF\uFF09\u3067\u306F${what}\u3092\u6271\u3048\u307E\u305B\u3093`,`\u30B5\u30FC\u30D0\u5074\u306B\u500B\u4EBA\u30BF\u30B9\u30AF\u7528\u306E API \u304C\u3042\u308A\u307E\u305B\u3093\u3002TWP \u306E\u753B\u9762\u304B\u3089\u64CD\u4F5C\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
10
- async function resolveTaskLocation(input,ctx,ref){rejectPrivateSurface(input,"\u3053\u306E\u64CD\u4F5C");const{kind,value}=classifyTaskRef(ref);if(kind==="key"){if(isPrivateTaskKey(value)&&input.flags.get("--project")===void 0){throw new UsageError(`${value} \u306F\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30AD\u30FC\u306B\u3082\u3001\u30B3\u30FC\u30C9 ${PRIVATE_TASK_KEY_PREFIX} \u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30BF\u30B9\u30AF\u30AD\u30FC\u306B\u3082\u8AAD\u3081\u307E\u3059`,`\u3053\u306E\u64CD\u4F5C\u306F\u500B\
11
- \u4EBA\u30BF\u30B9\u30AF\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u5074\u306B API \u304C\u3042\u308A\u307E\u305B\u3093\uFF09\u3002
12
- \u30B3\u30FC\u30C9 ${PRIVATE_TASK_KEY_PREFIX} \u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30BF\u30B9\u30AF\u3092\u6307\u3059\u306A\u3089 --project ${PRIVATE_TASK_KEY_PREFIX} \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002`)}rejectRedundantProject(input,value);const resolved=await ctx.resolver.taskByKey(value);const id=resolved.task["id"];if(!isSafePathSegment(id)){throw new ApiResponseError(`\u30BF\u30B9\u30AF\u30AD\u30FC\u89E3\u6C7A\u306E\u5FDC\u7B54\u306E task.id \u3092\u305D\u306E\u307E\u307E\u4F7F\u3048\u307E\u305B\u3093\uFF08${String(
13
- id).slice(0,60)}\uFF09\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return{projectId:resolved.projectId,taskId:id}}if(kind==="unknown"){throw new UsageError(`\u30BF\u30B9\u30AF\u306E\u6307\u5B9A\u304C\u300C\u30AD\u30FC\uFF08\u4F8B ABC-123\uFF09\u300D\u306B\u3082\u300CID\uFF08UUID / ULID\uFF09\u300D\u306B\u3082\u898B\u3048\u307E\u305B\u3093: ${ref}`,"\u30AD\u30FC\u306F\u300C\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30B3\u30FC\u30C9-\u756A\u53F7\u300D\u306E\u5F62\u3067\u3059\u3002ID \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u306F --project \u3082\u5FC5\u8981\u3067\u3059\u3002")}
14
- if(kind!=="id"){const exhaustive=kind;throw new Error(`\u672A\u77E5\u306E\u30BF\u30B9\u30AF\u53C2\u7167\u306E\u7A2E\u5225\u3067\u3059: ${String(exhaustive)}`)}return{projectId:await ctx.projectId(input.flags.get("--project")),taskId:value}}function rejectRedundantProject(input,ref){const project=input.flags.get("--project");if(project===void 0)return;if(isPrivateTaskKey(ref)){if(isPrivateProjectRef(project))return;if(project.trim().toLowerCase()===PRIVATE_TASK_KEY_PREFIX.toLowerCase())return;throw new UsageError(
15
- `\u30AD\u30FC ${ref} \u3068 --project ${project} \u304C\u98DF\u3044\u9055\u3063\u3066\u3044\u307E\u3059`,`${ref} \u304C\u6307\u305B\u308B\u306E\u306F\u6B21\u306E2\u3064\u3060\u3051\u3067\u3059\u3002
16
- \u500B\u4EBA\u30BF\u30B9\u30AF : --project ${PRIVATE_PROJECT_REF}
17
- \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8: --project ${PRIVATE_TASK_KEY_PREFIX}\uFF08\u30AD\u30FC\u306E\u63A5\u982D\u8F9E\u3068\u540C\u3058\u30B3\u30FC\u30C9\uFF09
18
- \u5225\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30BF\u30B9\u30AF\u3092\u6307\u3059\u306A\u3089\u3001\u30AD\u30FC\u3067\u306F\u306A\u304F\u305D\u306E\u30BF\u30B9\u30AF\u306E ID\uFF08UUID / ULID\uFF09\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}throw new UsageError(`\u30AD\u30FC\u5F62\u5F0F\uFF08${ref}\uFF09\u3067\u6307\u5B9A\u3057\u305F\u3068\u304D\u306B --project \u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08--project ${project} \u306F\u7121\u8996\u3055\u308C\u307E\u3059\uFF09`,"\
19
- \u30AD\u30FC\u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u542B\u3093\u3067\u3044\u308B\u306E\u3067 --project \u3092\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002--project \u304C\u8981\u308B\u306E\u306F\u3001\u30BF\u30B9\u30AF\u3092 ID\uFF08UUID / ULID\uFF09\u3067\u6307\u5B9A\u3059\u308B\u3068\u304D\u3060\u3051\u3067\u3059\u3002")}var TASK_REF_FLAG={name:"--task",summary:"\u30BF\u30B9\u30AF\u306E\u30AD\u30FC\uFF08\u4F8B ABC-123\uFF09\u307E\u305F\u306F ID\u3002\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF08\u4E21\u65B9\u6307\u5B9A\u306F\u30A8\u30E9\u30FC\uFF09",
20
- takesValue:true,placeholder:"<\u30AD\u30FC|ID>"};var PROJECT_FLAG={name:"--project",summary:`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30B3\u30FC\u30C9\u307E\u305F\u306F ID\uFF08\u7701\u7565\u6642\u306F TWP_PROJECT / .twp/config.json / ~/.twp/config.json\uFF09\u3002\u30BF\u30B9\u30AF\u3092\u30AD\u30FC\u3067\u6307\u5B9A\u3059\u308B\u3068\u304D\u306F\u4F7F\u3048\u307E\u305B\u3093\u3002${PRIVATE_PROJECT_REF} \u3067\u500B\u4EBA\u30BF\u30B9\u30AF\u3092\u6307\u3057\u307E\u3059`,takesValue:true,placeholder:`\
21
- <\u30B3\u30FC\u30C9|ID|${PRIVATE_PROJECT_REF}>`};var TASK_REF_HELP=`\u30AD\u30FC\u5F62\u5F0F\uFF08\u4F8B ABC-123\uFF09\u306A\u3089 --project \u306F\u8981\u308A\u307E\u305B\u3093\uFF081\u5F80\u5FA9\u3067\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3054\u3068\u89E3\u6C7A\u3055\u308C\u307E\u3059\uFF09\u3002
22
- \u30AD\u30FC\u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u542B\u3093\u3067\u3044\u308B\u306E\u3067\u3001\u30AD\u30FC\u3068 --project \u3092\u4E00\u7DD2\u306B\u6307\u5B9A\u3059\u308B\u3068\u30A8\u30E9\u30FC\u306B\u306A\u308A\u307E\u3059\u3002
23
- ID\uFF08UUID / ULID\uFF09\u3067\u6307\u5B9A\u3059\u308B\u5834\u5408\u3060\u3051 --project\uFF08\u307E\u305F\u306F\u65E2\u5B9A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF09\u304C\u8981\u308A\u307E\u3059\u3002
24
- UUID / ULID \u306E\u5F62\u3092\u3057\u305F\u5024\u306F\u3001\u30AD\u30FC\u306E\u5F62\u306B\u3082\u8AAD\u3081\u308B\u3068\u304D\u3067\u3082 ID \u3068\u3057\u3066\u6271\u3044\u307E\u3059\uFF08\u4F8B: \u672B\u5C3E12\u6841\u304C\u5168\u6570\u5B57\u306E UUID\uFF09\u3002\u3053\u306E\u5834\u5408\u306F --project \u304C\u8981\u308A\u307E\u3059\u3002
25
- --task <\u30AD\u30FC|ID> \u3067\u3082\u540C\u3058\u610F\u5473\u3067\u3059\u3002\u4F4D\u7F6E\u5F15\u6570\u3068 --task \u306E\u4E21\u65B9\u3092\u6307\u5B9A\u3059\u308B\u3068\u30A8\u30E9\u30FC\u306B\u306A\u308A\u307E\u3059\u3002
26
- ${PRIVATE_TASK_KEY_PREFIX}-<\u756A\u53F7> \u306E\u5F62\u306E\u30AD\u30FC\u3060\u3051\u306F\u4F8B\u5916\u3067\u3001--project \u304C\u5FC5\u9808\u3067\u3059\uFF08\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30AD\u30FC\u3068\u3082\u3001\u30B3\u30FC\u30C9 ${PRIVATE_TASK_KEY_PREFIX} \u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30BF\u30B9\u30AF\u30AD\u30FC\u3068\u3082\u8AAD\u3081\u308B\u305F\u3081\uFF09\u3002`;var TASK_SOURCE="task";var IDS_PER_REQUEST=100;var LIST_COLUMNS=["id","file_name","content_type","file_size","is_committed","created_at"];var UPLOAD_COLUMNS=["attachment_id","task_id","file_name","content_type","file_size","attachment_count"];var CONTENT_TYPES={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".pdf":"application/pdf",".txt":"text/plain",".log":"text/plain",".md":"text/markdown",".csv":"text/csv",".json":"application/json",".zip":"\
27
- application/zip",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation"};function contentTypeFor(fileName){return CONTENT_TYPES[path.extname(fileName).toLowerCase()]??"application/octet-stream"}var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30ED\u30FC\u30AB\u30EB\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\uFF08\u5FC5\u9808\uFF09",
28
- takesValue:true,placeholder:"<\u30D1\u30B9>"};var NAME_FLAG={name:"--name",summary:"\u30B5\u30FC\u30D0\u306B\u4FDD\u5B58\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u540D\uFF08\u7701\u7565\u6642\u306F\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u540D\uFF09",takesValue:true,placeholder:"<\u30D5\u30A1\u30A4\u30EB\u540D>"};var CONTENT_TYPE_FLAG={name:"--content-type",summary:"Content-Type\uFF08\u7701\u7565\u6642\u306F\u62E1\u5F35\u5B50\u304B\u3089\u63A8\u5B9A\u3002\u4E0D\u660E\u306A\u3089 application/octet-stream\uFF09",
29
- takesValue:true,placeholder:"<\u578B>"};var OUT_FLAG={name:"--out",summary:"\u66F8\u304D\u51FA\u3057\u5148\u306E\u30D5\u30A1\u30A4\u30EB\u30D1\u30B9\uFF08\u5FC5\u9808\u3002\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9>"};var ATTACHMENT_REF_FLAG={name:"--attachment",summary:"\u6DFB\u4ED8ID\u3002\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF08\u4E21\u65B9\u6307\u5B9A\u306F\u30A8\u30E9\u30FC\uFF09",takesValue:true,placeholder:"\
30
- <\u6DFB\u4ED8ID>"};var FORCE_FLAG={name:"--force",summary:"\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308C\u3070\u4E0A\u66F8\u304D\u3059\u308B\uFF08\u65E2\u5B9A\u3067\u306F\u4E0A\u66F8\u304D\u3057\u306A\u3044\uFF09",takesValue:false};function taskPath(input){const projectId=encodeURIComponent(requireResolved(input,"projectId"));return`/api/v2/projects/${projectId}/tasks/${encodeURIComponent(requireResolved(input,"taskId"))}`}function taskAttachmentIds(body){const task=isRecord(body)?
31
- body["task"]:void 0;if(!isRecord(task)){throw new ApiResponseError("\u30BF\u30B9\u30AF\u8A73\u7D30\u306E\u5FDC\u7B54\u306B task \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}const ids=task["attachment_ids"];if(ids===null||ids===void 0)return[];if(!Array.isArray(ids)||!ids.every(id=>typeof id==="string")){throw new ApiResponseError("\u30BF\u30B9\u30AF\u8A73\u7D30\u306E attachment_ids \u304C\u6587\u5B57\u5217\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
32
- return ids}function attachmentRows(body){const data=isRecord(body)?body["data"]:void 0;if(!Array.isArray(data)){throw new ApiResponseError("\u6DFB\u4ED8\u4E00\u89A7\u306E\u5FDC\u7B54\u306B data \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return data}async function resolveTask(input,ctx,usage){const ref=singleRef(input,{flag:"--task",label:"\u30BF\u30B9\u30AF",usage});return withResolved(input,await resolveTaskLocation(
33
- input,ctx,ref))}function localFile(input){const raw=input.flags.get("--file");if(raw===void 0||raw.trim()===""){throw new UsageError("--file \u306F\u5FC5\u9808\u3067\u3059","twp task attachment upload <\u30AD\u30FC|ID> --file <\u30D1\u30B9>")}const file=path.resolve(raw.trim());let stat;try{stat=fs.statSync(file)}catch{throw new UsageError(`\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093: ${file}`)}if(!stat.isFile())throw new UsageError(`\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ${file}`);
34
- if(stat.size===0)throw new UsageError(`\u7A7A\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093: ${file}`);const nameFlag=input.flags.get("--name");const name=nameFlag!==void 0&&nameFlag.trim()!==""?nameFlag.trim():path.basename(file);const typeFlag=input.flags.get("--content-type");const contentType=typeFlag!==void 0&&typeFlag.trim()!==""?typeFlag.trim():contentTypeFor(name);return{file,name,size:stat.size,contentType}}function uploadUrlPlan(input){
35
- return{method:"POST",path:"/api/v2/attachments/upload-url",body:{file_name:requireResolved(input,"fileName"),content_type:requireResolved(input,"contentType"),file_size:Number(requireResolved(input,"fileSize")),source:TASK_SOURCE}}}function issued(body){const data=isRecord(body)?body["data"]:void 0;const id=isRecord(data)?data["id"]:void 0;const uploadUrl=isRecord(data)?data["upload_url"]:void 0;if(!isSafePathSegment(id)||typeof uploadUrl!=="string"||!/^https:\/\//.test(uploadUrl)){throw new ApiResponseError(
36
- "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C\u306E\u5FDC\u7B54\u306B data.id / data.upload_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return{id,uploadUrl}}async function upload(input,ctx){const file=requireResolved(input,"file");const size=Number(requireResolved(input,"fileSize"));const contentType=requireResolved(input,"contentType");const{id,uploadUrl}=issued(await ctx.send(uploadUrlPlan(input)));const bytes=new Uint8Array(
37
- fs.readFileSync(file));if(bytes.byteLength!==size){throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u306E\u5927\u304D\u3055\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF08${size} \u2192 ${bytes.byteLength} \u30D0\u30A4\u30C8\uFF09: ${file}`)}await ctx.putSigned(uploadUrl,bytes,contentType);try{const current=taskAttachmentIds(await ctx.send({method:"GET",path:taskPath(input)}));const next=current.includes(id)?current:[...current,id];const updated=await ctx.
38
- send({method:"PUT",path:taskPath(input),body:{attachment_ids:next}});const linked=taskAttachmentIds(updated);if(!linked.includes(id)){throw new ApiResponseError("\u30BF\u30B9\u30AF\u66F4\u65B0\u306E\u5FDC\u7B54\u306E attachment_ids \u306B\u4ECA\u56DE\u306E\u6DFB\u4ED8\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return{attachment_id:id,task_id:requireResolved(input,"taskId"),project_id:requireResolved(input,"projectId"),
39
- file_name:requireResolved(input,"fileName"),content_type:contentType,file_size:size,attachment_count:linked.length}}catch(err){ctx.warn(`\u6DFB\u4ED8 ${id} \u306F\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u307E\u3067\u5B8C\u4E86\u3057\u307E\u3057\u305F\u304C\u3001\u30BF\u30B9\u30AF\u3078\u306E\u7D10\u3065\u3051\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
40
- \u672A\u7D10\u3065\u3051\u306E\u6DFB\u4ED8\u306F\u30B5\u30FC\u30D0\u304C\u4E00\u5B9A\u6642\u9593\uFF08\u7F72\u540DURL\u306E\u6709\u52B9\u671F\u9650\uFF0B1\u6642\u9593\uFF09\u5F8C\u306B\u81EA\u52D5\u3067\u524A\u9664\u3057\u307E\u3059\u3002\u3082\u3046\u4E00\u5EA6 twp task attachment upload \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);throw err}}async function list(input,ctx){const ids=taskAttachmentIds(await ctx.send({method:"GET",path:taskPath(input)}));const rows2=[];for(let offset=0;offset<
41
- ids.length;offset+=IDS_PER_REQUEST){const chunk=ids.slice(offset,offset+IDS_PER_REQUEST);rows2.push(...attachmentRows(await ctx.send({method:"GET",path:"/api/v2/attachments",query:{ids:chunk.join(",")}})))}if(rows2.length<ids.length){ctx.warn(`\u30BF\u30B9\u30AF\u306B\u7D10\u3065\u304F\u6DFB\u4ED8 ${ids.length} \u4EF6\u306E\u3046\u3061 ${ids.length-rows2.length} \u4EF6\u306F\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u524A\u9664\u6E08\u307F\u304B\u3001\u95B2\u89A7\u3067\u304D\u307E\u305B\u3093\uFF09\u3002`)}
42
- return{data:rows2}}var taskAttachmentResource={name:"attachment",summary:"\u30BF\u30B9\u30AF\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\uFF08\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u30FB\u4E00\u89A7\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\uFF09",operations:[{name:"list",summary:"\u30BF\u30B9\u30AF\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u3059\u308B",usage:"twp task attachment list <\u30AD\u30FC|ID> [--project <\u30B3\u30FC\u30C9|ID>]",description:`${TASK_REF_HELP}
43
-
44
- \u30BF\u30B9\u30AF\u672C\u4F53\u306B\u7D10\u3065\u304F\u6DFB\u4ED8\u3060\u3051\u3092\u8FD4\u3057\u307E\u3059\uFF08\u30B3\u30E1\u30F3\u30C8\u306B\u4ED8\u3044\u305F\u6DFB\u4ED8\u306F\u542B\u307F\u307E\u305B\u3093\uFF09\u3002
45
- \u30BF\u30B9\u30AF\u3092\u53D6\u5F97\u3057\u3066\u6DFB\u4ED8 ID \u3092\u5F97\u305F\u3042\u3068\u3001ID \u3067\u30E1\u30BF\u60C5\u5831\u3092\u53D6\u5F97\u3057\u307E\u3059\uFF082\u5F80\u5FA9\u4EE5\u4E0A\uFF09\u3002`,flags:[TASK_REF_FLAG,PROJECT_FLAG],prepare:(input,ctx)=>resolveTask(input,ctx,"twp task attachment list help"),plan:input=>({method:"GET",path:taskPath(input)}),plannedNotes:()=>["\u3053\u306E\u3042\u3068\u3001\u30BF\u30B9\u30AF\u306E attachment_ids \u3067 GET /api/v2/attachments?ids=\u2026 \u3092\u9001\u308A\u307E\u3059\u3002"],
46
- execute:list,summarize:body=>attachmentRows(body).map(row=>pick(row,LIST_COLUMNS)),raw:body=>attachmentRows(body)},{name:"upload",summary:"\u30ED\u30FC\u30AB\u30EB\u30D5\u30A1\u30A4\u30EB\u3092\u30BF\u30B9\u30AF\u306B\u6DFB\u4ED8\u3059\u308B\uFF08\u767A\u884C\u30FB\u8EE2\u9001\u30FB\u7D10\u3065\u3051\u30921\u30B3\u30DE\u30F3\u30C9\u3067\uFF09",usage:"twp task attachment upload <\u30AD\u30FC|ID> --file <\u30D1\u30B9> [--name <\u30D5\u30A1\u30A4\u30EB\u540D>] [--content-type <\u578B>]",description:`${TASK_REF_HELP}\
47
-
48
-
49
- \u6B21\u306E3\u5F80\u5FA9\u30921\u30B3\u30DE\u30F3\u30C9\u3067\u884C\u3044\u307E\u3059\u3002
50
- 1. POST /api/v2/attachments/upload-url\uFF08\u7F72\u540DURL\u306E\u767A\u884C\uFF09
51
- 2. \u7F72\u540DURL\u3078 PUT\uFF08\u30D5\u30A1\u30A4\u30EB\u672C\u4F53\u3002TWP \u306E\u8A8D\u8A3C\u60C5\u5831\u306F\u9001\u308A\u307E\u305B\u3093\uFF09
52
- 3. \u30BF\u30B9\u30AF\u306E attachment_ids \u306B\u8FFD\u52A0\u3057\u3066 PUT\uFF08\u3053\u3053\u3067\u6DFB\u4ED8\u304C\u78BA\u5B9A\u3057\u307E\u3059\uFF09
53
- 3 \u304C\u5931\u6557\u3057\u305F\u5834\u5408\u306F\u6DFB\u4ED8 ID \u3092 stderr \u306B\u51FA\u3057\u3066\u5931\u6557\u3057\u307E\u3059\u3002\u672A\u78BA\u5B9A\u306E\u6DFB\u4ED8\u306F\u30B5\u30FC\u30D0\u304C\u81EA\u52D5\u3067\u524A\u9664\u3057\u307E\u3059\u3002
54
- --dry-run \u306F 1 \u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3060\u3051\u3092\u8868\u793A\u3057\u307E\u3059\uFF082 \u4EE5\u964D\u306F 1 \u306E\u5FDC\u7B54\u306B\u4F9D\u5B58\u3059\u308B\u305F\u3081\uFF09\u3002`,flags:[FILE_FLAG,NAME_FLAG,CONTENT_TYPE_FLAG,TASK_REF_FLAG,PROJECT_FLAG],async prepare(input,ctx){const local=localFile(input);const resolved=await resolveTask(input,ctx,"twp task attachment upload help");return withResolved(resolved,{file:local.file,fileName:local.name,fileSize:String(local.size),
55
- contentType:local.contentType})},plan:uploadUrlPlan,plannedNotes:input=>[`\u3053\u306E\u3042\u3068\u3001\u7F72\u540DURL\u3078 ${requireResolved(input,"fileSize")} \u30D0\u30A4\u30C8\u3092 PUT \u3057\u3001\u30BF\u30B9\u30AF\u306E attachment_ids \u306B\u8FFD\u52A0\u3057\u3066 PUT \u3057\u307E\u3059\u3002`],execute:upload,summarize:body=>pick(body,UPLOAD_COLUMNS),raw:body=>body},{name:"download",summary:"\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u30D5\u30A1\u30A4\u30EB\u3078\u66F8\u304D\u51FA\u3059",
56
- usage:"twp task attachment download <\u6DFB\u4ED8ID> --out <\u30D1\u30B9> [--force]",description:"\u6DFB\u4ED8 ID \u306F twp task attachment list \u306E id \u3067\u3059\u3002\n\u66F8\u304D\u51FA\u3057\u5148\u306F --out \u3067\u5FC5\u305A\u6307\u5B9A\u3057\u307E\u3059\uFF08\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09\u3002\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u306F --force \u304C\u7121\u3051\u308C\u3070\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\u3002",flags:[ATTACHMENT_REF_FLAG,
57
- OUT_FLAG,FORCE_FLAG],download:{outFlag:"--out",forceFlag:"--force"},plan(input){const id=singleRef(input,{flag:"--attachment",label:"\u6DFB\u4ED8ID",usage:"twp task attachment download help"});if(!isSafePathSegment(id))throw new UsageError(`\u6DFB\u4ED8ID \u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${id}`);return{method:"GET",path:`/api/v2/attachments/${encodeURIComponent(id)}/download`}},summarize:body=>body,raw:body=>body}]};var LIST_COLUMNS2=["id","created_at","created_by_name","comment_type","content"];var QUESTION_COLUMN="question";var ANSWER_COLUMN="answer";function summarizeComments(items){const answersByQuestion=new Map;for(const row of items){const answer=isRecord(row)?row["answer_to"]:void 0;if(!isRecord(answer))continue;const target=answer["comment_id"];if(typeof target!=="string"||target==="")continue;answersByQuestion.set(target,selectedKeyText(answer["selected_key"]))}return items.map(row=>{const source=isRecord(
58
- row)?row:{};const id=typeof source["id"]==="string"?source["id"]:"";const answer=isRecord(source["answer_to"])?selectedKeyText(source["answer_to"]["selected_key"]):answersByQuestion.get(id)??null;const base=pick(row,LIST_COLUMNS2);return{id:base["id"],created_at:base["created_at"],created_by_name:base["created_by_name"],comment_type:base["comment_type"],[QUESTION_COLUMN]:questionText(source["question"]),[ANSWER_COLUMN]:answer,content:base["content"]}})}function questionText(question){if(!isRecord(
3
+ import{repeatedValues}from"./chunk-IOGVQVGD.js";import{charCount,readBody}from"./chunk-HGTG5XQ7.js";import{boundedText,decimal,isoDate,priority}from"./chunk-UDPJ2IGK.js";import{PROJECT_FLAG,TASK_REF_FLAG,TASK_REF_HELP,classifyTaskRef,rejectRedundantProject,resolveTaskLocation,taskAttachmentResource,taskSurface,wantsPrivateSurface}from"./chunk-KUIFIN7P.js";import{PRIVATE_PROJECT_REF}from"./chunk-GY7KI5E5.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,
4
+ positiveInteger}from"./chunk-G4OO4M44.js";import{PRIVATE_TASKS_PATH,TASK_MASTERS}from"./chunk-NIAOX77K.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-FTYJZFEK.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import"./chunk-II5RVJQN.js";import"./chunk-DDKZ5IPT.js";import{acknowledgement,isRecord,pick}from"./chunk-ZWVYVS2A.js";import"./chunk-QQRJLH6B.js";import"./chunk-J7QYPKVK.js";import"./chunk-NERYSBA4.js";
5
+ import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";var LIST_COLUMNS=["id","created_at","created_by_name","comment_type","content"];var QUESTION_COLUMN="question";var ANSWER_COLUMN="answer";function summarizeComments(items){const answersByQuestion=new Map;for(const row of items){const answer=isRecord(row)?row["answer_to"]:void 0;if(!isRecord(answer))continue;const target=answer["comment_id"];if(typeof target!=="string"||target==="")continue;answersByQuestion.set(target,selectedKeyText(answer["selected_key"]))}return items.map(row=>{const source=isRecord(
6
+ row)?row:{};const id=typeof source["id"]==="string"?source["id"]:"";const answer=isRecord(source["answer_to"])?selectedKeyText(source["answer_to"]["selected_key"]):answersByQuestion.get(id)??null;const base=pick(row,LIST_COLUMNS);return{id:base["id"],created_at:base["created_at"],created_by_name:base["created_by_name"],comment_type:base["comment_type"],[QUESTION_COLUMN]:questionText(source["question"]),[ANSWER_COLUMN]:answer,content:base["content"]}})}function questionText(question){if(!isRecord(
59
7
  question))return null;const options=question["options"];if(!Array.isArray(options))return null;const parts=options.map(option=>{if(!isRecord(option))return null;const key=typeof option["key"]==="string"?option["key"]:null;if(key===null)return null;const label=typeof option["label"]==="string"?option["label"]:"";return label===""?key:`${key}=${label}`}).filter(part=>part!==null);return parts.length===0?null:parts.join(" / ")}function selectedKeyText(selected){if(typeof selected==="string"&&selected!==
60
8
  "")return selected;if(Array.isArray(selected)){const keys=selected.filter(key=>typeof key==="string"&&key!=="");if(keys.length>0)return keys.join(",")}return"(\u81EA\u7531\u8A18\u8FF0)"}var WRITE_COLUMNS=["id","task_id","created_at","updated_at","created_by_name","content"];var CONTENT_MAX_CHARS=1e4;var QUESTION_MAX_CHARS=2e3;var CONTENT_HTML_MAX_CHARS=1e5;var OPTION_KEY_MAX_CHARS=10;var OPTION_LABEL_MAX_CHARS=200;var OPTION_MIN=1;var OPTION_MAX=5;var SELECTED_KEY_MAX_CHARS=10;var listPaging=envelopePaging(
61
9
  {label:"\u30B3\u30E1\u30F3\u30C8\u4E00\u89A7"});function commentObject(body){const comment=isRecord(body)?body["comment"]:void 0;if(!isRecord(comment)){throw new ApiResponseError("\u30B3\u30E1\u30F3\u30C8\u306E\u5FDC\u7B54\u306B comment \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return comment}var BODY_FLAGS=[{name:"--body-file",summary:"\u672C\u6587\u3092\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u8AAD\u3080\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09\u3002\u6539\u884C\u30FBMarkdown \u3092\u58CA\u3055\u306A\u3044\u4E3B\u7D4C\u8DEF",
@@ -134,11 +82,7 @@ void 0?`\u500B\u4EBA\u30BF\u30B9\u30AF\uFF08--project ${PRIVATE_PROJECT_REF}\uFF
134
82
  ${privateHelp}`,flags:[PROJECT_FLAG],async prepare(input,ctx){if(input.args.length>0){throw new UsageError(`list \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306F --project <\u30B3\u30FC\u30C9|ID> \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}if(wantsPrivateSurface(input)){if(spec.privateEnvelope===void 0){throw new UsageError(`--project ${PRIVATE_PROJECT_REF}\uFF08\u500B\u4EBA\u30BF\u30B9\u30AF\uFF09\u306B${master.
135
83
  label}\u306F\u3042\u308A\u307E\u305B\u3093`,`\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30DE\u30B9\u30BF\u306F\u30B9\u30C6\u30FC\u30BF\u30B9\u30FB\u7A2E\u5225\u30FB\u30AB\u30C6\u30B4\u30EA\u30FB\u30E9\u30D9\u30EB\u3060\u3051\u3067\u3059\u3002`)}return withResolved(input,{surface:PRIVATE_SURFACE})}return withResolved(input,{projectId:await ctx.projectId(input.flags.get("--project"))})},plan(input){if(isPrivatePlan(input))return{method:"GET",path:`${PRIVATE_TASKS_PATH}/masters`};return{method:"GET",path:`\
136
84
  /api/v2/projects/${encodeURIComponent(requireResolved(input,"projectId"))}/${master.path}`}},async fetchCached(input,ctx){if(isPrivatePlan(input)){return ctx.resolver.privateMasterRows(spec.privateEnvelope,master.label)}return ctx.resolver.taskMasterRows(spec.kind,requireResolved(input,"projectId"))},summarize:body=>rows(body).map(row=>pick(row,spec.columns)),raw:body=>rows(body),notes:body=>rows(body).length===0?[`${master.label}\u306F1\u4EF6\u3082\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08--refresh \u3067\u53D6\u308A\u76F4\u305B\u307E\u3059\uFF09\u3002`]:
137
- []}]}}var taskMasterResources=SPECS.map(masterResource);var ISO_DATE_RE=/^\d{4}-\d{2}-\d{2}$/;function isoDate(input,flag){const raw=input.flags.get(flag);if(raw===void 0)return void 0;const value=raw.trim();if(!ISO_DATE_RE.test(value)){throw new UsageError(`${flag} \u306F YYYY-MM-DD \u306E\u5F62\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${raw}`,"\u4F8B: 2026-09-30")}const[y,m,d]=value.split("-").map(Number);const probe=new Date(Date.UTC(y,m-1,d));if(probe.getUTCFullYear()!==y||probe.getUTCMonth()+1!==m||probe.getUTCDate()!==d){throw new UsageError(
138
- `${flag} \u306B\u5B58\u5728\u3057\u306A\u3044\u65E5\u4ED8\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059: ${raw}`,"\u4F8B: 2026-09-30")}return value}function priority(input,flag="--priority"){const raw=input.flags.get(flag);if(raw===void 0)return void 0;const trimmed=raw.trim();const value=/^\d+$/.test(trimmed)?Number(trimmed):Number.NaN;if(!Number.isInteger(value)||value<1||value>3){throw new UsageError(`${flag} \u306F 1 / 2 / 3 \u306E\u3044\u305A\u308C\u304B\u3067\u3059: ${raw}`,"1: \u9AD8 \uFF0F\
139
- 2: \u4E2D \uFF0F 3: \u4F4E")}return value}function decimal(input,flag,options){const raw=input.flags.get(flag);if(raw===void 0)return void 0;const trimmed=raw.trim();const value=/^\d+(\.\d+)?$/.test(trimmed)?Number(trimmed):Number.NaN;if(!Number.isFinite(value)||value<options.min||value>options.max){throw new UsageError(`${flag} \u306F ${options.min} \u4EE5\u4E0A ${options.max} \u4EE5\u4E0B\u306E\u6570\u5024\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${raw}`,"\u4F8B: 3 / 3.5")}return value}
140
- function boundedText(input,flag,options){const raw=input.flags.get(flag);if(raw===void 0)return void 0;if(raw.trim()===""){throw new UsageError(`${flag} \u306B\u7A7A\u306E\u5024\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`${options.label}\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}const count=[...raw].length;if(count>options.maxChars){throw new UsageError(`${options.label}\u304C\u9577\u3059\u304E\u307E\u3059\uFF08${count} \u6587\u5B57\u30FB\u4E0A\u9650 ${options.maxChars}\
141
- \u6587\u5B57\uFF09`,`${flag} \u3092 ${options.maxChars} \u6587\u5B57\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return raw}var LIST_COLUMNS3=["key","subject","status_id","assignee_id","priority","due_date","updated_at"];var GET_COLUMNS=["id","key","project_id","subject","description","status_id","type_id","category_id","milestone_id","assignee_id","priority","start_date","due_date","estimated_hours","actual_hours","progress","parent_id","subtask_count","created_by","created_at","updated_by","updated_at"];var listPaging2=envelopePaging({label:"\u30BF\u30B9\u30AF\u4E00\u89A7"});var PRIVATE_HELP=`\u500B\u4EBA\u30BF\u30B9\u30AF\uFF08\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u5C5E\u3055\u306A\u3044\u81EA\u5206\u3060\u3051\u306E\
85
+ []}]}}var taskMasterResources=SPECS.map(masterResource);var LIST_COLUMNS2=["key","subject","status_id","assignee_id","priority","due_date","updated_at"];var GET_COLUMNS=["id","key","project_id","subject","description","status_id","type_id","category_id","milestone_id","assignee_id","priority","start_date","due_date","estimated_hours","actual_hours","progress","parent_id","subtask_count","created_by","created_at","updated_by","updated_at"];var listPaging2=envelopePaging({label:"\u30BF\u30B9\u30AF\u4E00\u89A7"});var PRIVATE_HELP=`\u500B\u4EBA\u30BF\u30B9\u30AF\uFF08\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u5C5E\u3055\u306A\u3044\u81EA\u5206\u3060\u3051\u306E\
142
86
  \u30BF\u30B9\u30AF\uFF09\u306F --project ${PRIVATE_PROJECT_REF} \u3067\u64CD\u4F5C\u3057\u307E\u3059\u3002
143
87
  twp task list --project ${PRIVATE_PROJECT_REF}
144
88
  \u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30AD\u30FC\u306F PRIVATE-<\u756A\u53F7> \u3067\u3059\u3002\u62C5\u5F53\u8005\u306E\u6307\u5B9A\u30FB\u7D5E\u308A\u8FBC\u307F\uFF08--assignee\uFF09\u306F\u3067\u304D\u307E\u305B\u3093
@@ -186,7 +130,7 @@ ${PRIVATE_HELP}
186
130
  takesValue:true,placeholder:"<me|\u540D\u524D|ID>"},{name:"--keyword",summary:"\u4EF6\u540D\u30FB\u672C\u6587\u306E\u90E8\u5206\u4E00\u81F4\u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u691C\u7D22\u7D4C\u8DEF\u306B\u5207\u308A\u66FF\u308F\u308A\u307E\u3059\uFF09",takesValue:true,placeholder:"<\u8A9E>"}],paging:listPaging2,async prepare(input,ctx){if(input.args.length>0){throw new UsageError(`list \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,"twp task list h\
187
131
  elp")}if(wantsPrivateSurface(input)){rejectPrivateUnsupportedFlags(input);return withResolved(input,{surface:PRIVATE_SURFACE2,...await resolvePrivateStatusAndType(input,ctx,{useDefaults:false})})}const projectId=await ctx.projectId(input.flags.get("--project"));const resolved={projectId};const status=nonEmpty(input.flags,"--status");if(status!==void 0)resolved["status_id"]=(await ctx.resolver.status(projectId,status)).id;const type=nonEmpty(input.flags,"--type");if(type!==void 0)resolved["type_i\
188
132
  d"]=(await ctx.resolver.taskType(projectId,type)).id;const assignee=nonEmpty(input.flags,"--assignee");if(assignee!==void 0)resolved["assignee_id"]=(await ctx.resolver.assignee(projectId,assignee)).id;return withResolved(input,resolved)},plan(input){const query={limit:positiveInteger(input.flags,"--limit"),cursor:nonEmpty(input.flags,"--cursor"),keyword:nonEmpty(input.flags,"--keyword"),status_id:input.resolved?.["status_id"],type_id:input.resolved?.["type_id"],assignee_id:input.resolved?.["assi\
189
- gnee_id"]};if(isPrivatePlan2(input))return{method:"GET",path:PRIVATE_TASKS_PATH,query};const projectId=requireResolved(input,"projectId");return{method:"GET",path:`/api/v2/projects/${encodeURIComponent(projectId)}/tasks`,query}},summarize:body=>listPaging2.items(body).map(row=>pick(row,LIST_COLUMNS3)),raw:body=>listPaging2.items(body)},{name:"get",summary:"\u30BF\u30B9\u30AF1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B",usage:"twp task get <\u30AD\u30FC|ID> [--project <\u30B3\u30FC\u30C9|ID|__private__>]",
133
+ gnee_id"]};if(isPrivatePlan2(input))return{method:"GET",path:PRIVATE_TASKS_PATH,query};const projectId=requireResolved(input,"projectId");return{method:"GET",path:`/api/v2/projects/${encodeURIComponent(projectId)}/tasks`,query}},summarize:body=>listPaging2.items(body).map(row=>pick(row,LIST_COLUMNS2)),raw:body=>listPaging2.items(body)},{name:"get",summary:"\u30BF\u30B9\u30AF1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B",usage:"twp task get <\u30AD\u30FC|ID> [--project <\u30B3\u30FC\u30C9|ID|__private__>]",
190
134
  description:`${TASK_REF_HELP}
191
135
 
192
136
  ${PRIVATE_HELP}`,flags:[TASK_REF_FLAG,PROJECT_FLAG],async prepare(input,ctx){const ref=singleRef(input,{flag:"--task",label:"\u30BF\u30B9\u30AF",usage:"twp task get help"});if(taskSurface(input,ref)===PRIVATE_SURFACE2){return withResolved(input,{surface:PRIVATE_SURFACE2,privateRef:privateTaskRef(ref).value})}const classified=classifyTaskRef(ref);if(classified.kind==="key"){rejectRedundantProject(input,classified.value);return withResolved(input,{mode:"key",key:classified.value})}const{projectId,
@@ -196,7 +140,7 @@ GET",path:`/api/v2/projects/${projectId}/tasks/${encodeURIComponent(requireResol
196
140
  ${PRIVATE_HELP}
197
141
 
198
142
  \u3053\u306E API \u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3092\u6301\u305F\u305A\u3001\u5E38\u306B\u5168\u4EF6\u3092\u8FD4\u3057\u307E\u3059\uFF08--all / --limit \u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002`,flags:[TASK_REF_FLAG,PROJECT_FLAG],async prepare(input,ctx){const ref=singleRef(input,{flag:"--task",label:"\u30BF\u30B9\u30AF",usage:"twp task subtasks help"});if(taskSurface(input,ref)===PRIVATE_SURFACE2){return withResolved(input,{surface:PRIVATE_SURFACE2,taskId:await resolvePrivateTaskId(
199
- ctx,ref)})}return withResolved(input,await resolveTaskLocation(input,ctx,ref))},plan(input){const taskId=encodeURIComponent(requireResolved(input,"taskId"));if(isPrivatePlan2(input)){return{method:"GET",path:`${PRIVATE_TASKS_PATH}/${taskId}/subtasks`}}const projectId=encodeURIComponent(requireResolved(input,"projectId"));return{method:"GET",path:`/api/v2/projects/${projectId}/tasks/${taskId}/subtasks`}},summarize:body=>subtaskItems(body).map(row=>pick(row,LIST_COLUMNS3)),raw:body=>subtaskItems(body)},
143
+ ctx,ref)})}return withResolved(input,await resolveTaskLocation(input,ctx,ref))},plan(input){const taskId=encodeURIComponent(requireResolved(input,"taskId"));if(isPrivatePlan2(input)){return{method:"GET",path:`${PRIVATE_TASKS_PATH}/${taskId}/subtasks`}}const projectId=encodeURIComponent(requireResolved(input,"projectId"));return{method:"GET",path:`/api/v2/projects/${projectId}/tasks/${taskId}/subtasks`}},summarize:body=>subtaskItems(body).map(row=>pick(row,LIST_COLUMNS2)),raw:body=>subtaskItems(body)},
200
144
  {name:"create",summary:"\u30BF\u30B9\u30AF\u3092\u4F5C\u6210\u3059\u308B",usage:'twp task create --subject "<\u4EF6\u540D>" [--project <\u30B3\u30FC\u30C9|ID|__private__>] [--type <\u540D\u524D>] [--status <\u540D\u524D>] [--assignee <me|\u540D\u524D>] [--category <\u540D\u524D>] [--label <\u540D\u524D>] [--parent <\u30AD\u30FC|ID>]',description:`--subject \u3060\u3051\u304C\u5FC5\u9808\u3067\u3059\u3002--status / --type \u3092\u7701\u304F\u3068\u3001\u305D\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u65E2\u5B9A\u306B\u6307\u5B9A\u3057\u3066\u3044\u308B
201
145
  \u3082\u306E\u3092\u4F7F\u3044\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u5074\u3067\u306F\u3069\u3061\u3089\u3082\u5FC5\u9808\u9805\u76EE\u3067\u3059\uFF09\u3002\u65E2\u5B9A\u3092\u4F7F\u3063\u305F\u5834\u5408\u306F stderr \u306B\u6CE8\u8A18\u304C\u51FA\u307E\u3059\u3002
202
146
 
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{fetchLatestVersion,isBehindLatest,runUpdate}from"./chunk-SJRK4AVE.js";import"./chunk-WOUKWOAR.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-PMOUHEJQ.js";import"./chunk-DSDVIU6A.js";import"./chunk-DXXFUNYN.js";import"./chunk-NERYSBA4.js";import"./chunk-5WGOHFAS.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{fetchLatestVersion,isBehindLatest,runUpdate};
3
+ import{fetchLatestVersion,isBehindLatest,runUpdate}from"./chunk-PK6CUUAQ.js";import"./chunk-Z2MNO3FT.js";import"./chunk-XNLIEUAW.js";import"./chunk-PMOUHEJQ.js";import"./chunk-J7QYPKVK.js";import"./chunk-ILKQDXI5.js";import"./chunk-DXXFUNYN.js";import"./chunk-5WGOHFAS.js";import"./chunk-NERYSBA4.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{fetchLatestVersion,isBehindLatest,runUpdate};