@tocca-systems/twp-cli 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.public.md +8 -0
- package/README.md +56 -0
- package/dist/{agent-loop-EKI2OHKK.js → agent-loop-ZJWMWB24.js} +1 -1
- package/dist/{ai-dispatch-6SO35NT6.js → ai-dispatch-YADG7BDD.js} +2 -2
- package/dist/{api-command-7EIZLSHR.js → api-command-OXFQL6OQ.js} +3 -3
- package/dist/{app-N35JE7PR.js → app-HDUWKPFQ.js} +5 -5
- package/dist/{auto-update-CV2MM32C.js → auto-update-JNSBIQM6.js} +1 -1
- package/dist/{auto-update-worker-OBFGN6FY.js → auto-update-worker-Y44TD6FD.js} +2 -2
- package/dist/{backlog-EJDTUNDB.js → backlog-7BCJWAE2.js} +2 -2
- package/dist/{chunk-ILKQDXI5.js → chunk-2NKVGAAE.js} +1 -1
- package/dist/{chunk-NERYSBA4.js → chunk-4VZKNEVN.js} +3 -2
- package/dist/{chunk-QOFVMK2T.js → chunk-AGEDFRUQ.js} +2 -2
- package/dist/chunk-D233KKXW.js +4 -0
- package/dist/{chunk-YGEKDAXF.js → chunk-FJESEWMF.js} +1 -1
- package/dist/chunk-KAP6IM5C.js +5 -0
- package/dist/chunk-LON7FN5A.js +66 -0
- package/dist/{chunk-OJTKOH6L.js → chunk-OK4ITT5Y.js} +3 -2
- package/dist/{chunk-USLXUAAC.js → chunk-ONTK2FR4.js} +1 -1
- package/dist/{chunk-Z2MNO3FT.js → chunk-PWXXCLVZ.js} +3 -4
- package/dist/{chunk-BKZGBJWT.js → chunk-QWSXHHFT.js} +1 -1
- package/dist/{chunk-Z4KADBYH.js → chunk-RDS6IJDZ.js} +4 -6
- package/dist/{chunk-PK6CUUAQ.js → chunk-REPGG75N.js} +1 -1
- package/dist/{chunk-VYDEUFGU.js → chunk-RFBFR567.js} +1 -1
- package/dist/{chunk-EEADECIU.js → chunk-V4UGLDEH.js} +1 -1
- package/dist/{chunk-XAMHF5MK.js → chunk-VDP6DKOM.js} +1 -1
- package/dist/chunk-WBAEUHJB.js +3 -0
- package/dist/cli.js +37 -8
- package/dist/{commands-XKWUVV3J.js → commands-EVWYBQEK.js} +3 -3
- package/dist/{commands-PYGNSAR6.js → commands-YQTCGNDN.js} +32 -31
- package/dist/completion-RGC3UZFI.js +70 -0
- package/dist/config-3CNEQ7KN.js +3 -0
- package/dist/configure-PIOFJFL5.js +31 -0
- package/dist/{department-Y5KW5LPI.js → department-XVOQ254P.js} +2 -2
- package/dist/{inquiry-LKAMOBYD.js → inquiry-EY5XY4UP.js} +2 -2
- package/dist/{job-title-XKP7FLV5.js → job-title-QHIKTYLH.js} +1 -1
- package/dist/{leave-AHBSMFWZ.js → leave-C6K724AF.js} +2 -2
- package/dist/{logout-guard-XIPTIA5C.js → logout-guard-I3YHI2VW.js} +1 -1
- package/dist/{media-M6Q4WTGX.js → media-BFCZJMEU.js} +2 -2
- package/dist/notification-6T22IDIZ.js +32 -0
- package/dist/{oneshot-NGQ6G5OG.js → oneshot-IZCRIJJJ.js} +2 -2
- package/dist/{position-SLHMC5JP.js → position-SBZD7AFE.js} +2 -2
- package/dist/{project-DBNWB47J.js → project-RAYRR6JS.js} +1 -1
- package/dist/registry-ZYCO5S5Z.js +3 -0
- package/dist/run-TBGMRJ4P.js +4 -0
- package/dist/{schedule-command-FJU7JFNR.js → schedule-command-IGTMCOA7.js} +1 -1
- package/dist/{server-settings-RC5BOWUW.js → server-settings-OE6Q77RE.js} +1 -1
- package/dist/{server-skills-SY6MRBKE.js → server-skills-MW6YNLNT.js} +1 -1
- package/dist/{setup-42N2ND7U.js → setup-FREKDQVC.js} +1 -1
- package/dist/{task-RZSQKNQY.js → task-GKHDJZLP.js} +3 -3
- package/dist/update-MAQJ6VWV.js +3 -0
- package/dist/{user-TYUNJQL6.js → user-GPAPJUHB.js} +3 -3
- package/dist/workflow-UNOJLZ4I.js +53 -0
- package/package.json +1 -1
- package/dist/chunk-AHEESHT5.js +0 -3
- package/dist/chunk-R6DZCBX4.js +0 -59
- package/dist/run-EFEWX4MY.js +0 -4
- package/dist/update-RLKK6N7U.js +0 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{BUILTIN_COMMANDS,GLOBAL_FLAGS,TASK_LOOP_ACTIONS,VALUE_FLAGS}from"./chunk-AGEDFRUQ.js";import"./chunk-NAUH75MM.js";import{API_TOKEN,DOMAIN_NAMES,HELP_TOKEN,isDomainName}from"./chunk-WBAEUHJB.js";import"./chunk-QQRJLH6B.js";import{OUTPUT_FORMATS}from"./chunk-K2ONOH3L.js";import"./chunk-WVS4W5FY.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var EXTRA_TOP_LEVEL=[API_TOKEN,HELP_TOKEN,"completion","configure"];var COMPLETION_SHELLS=["bash","zsh","fish","powershell"];var TOP_LEVEL_FLAGS=["--help","--version","-p","--print","--profile","--mode","--permission-mode","--model","--allowed-tools","--disallowed-tools","--no-tui","--doctor"];var DOMAIN_GLOBAL_FLAGS=[...GLOBAL_FLAGS].filter(flag=>flag.startsWith("--"));function staticValues(flag,ctx){if(flag==="--output")return OUTPUT_FORMATS;if(flag==="--profile")return ctx.profileNames();return void 0}
|
|
4
|
+
function positionals(words,takesValue){const out=[];for(let i=0;i<words.length;i++){const word=words[i]??"";if(word==="--"){out.push(...words.slice(i+1));break}if(word.startsWith("-")){if(!word.includes("=")&&takesValue(word))i++;continue}out.push(word)}return out}function byPrefix(candidates,current){const seen=new Set;for(const candidate of candidates){if(candidate.startsWith(current))seen.add(candidate)}return[...seen]}function remainingFlags(flags,words){const used=new Set(words.filter(w=>w.
|
|
5
|
+
startsWith("--")).map(w=>w.split("=")[0]));return[...flags.filter(f=>f.repeatable===true||!used.has(f.name)).map(f=>f.name),...DOMAIN_GLOBAL_FLAGS.filter(f=>!used.has(f))]}async function complete(words,current,ctx){const previous=words[words.length-1];if(previous!==void 0&&previous.startsWith("--")&&!previous.includes("=")){const values=staticValues(previous,ctx);if(values!==void 0)return byPrefix(values,current)}const eq=current.indexOf("=");if(current.startsWith("--")&&eq>0){const flag=current.
|
|
6
|
+
slice(0,eq);const values=staticValues(flag,ctx);return values===void 0?[]:byPrefix(values.map(v=>`${flag}=${v}`),current)}const pos=positionals(words,flag=>VALUE_FLAGS.has(flag));const[first,second]=pos;if(first===void 0){if(current.startsWith("-"))return byPrefix([...TOP_LEVEL_FLAGS,...DOMAIN_GLOBAL_FLAGS],current);return byPrefix([...BUILTIN_COMMANDS,...DOMAIN_NAMES,...EXTRA_TOP_LEVEL],current)}if(first==="completion")return pos.length===1?byPrefix(COMPLETION_SHELLS,current):[];if(first==="con\
|
|
7
|
+
figure")return current.startsWith("-")?byPrefix(["--profile"],current):[];if(first===HELP_TOKEN)return pos.length===1?byPrefix([...DOMAIN_NAMES,API_TOKEN],current):[];if(first==="task-loop"){if(pos.length===1&&!current.startsWith("-"))return byPrefix(TASK_LOOP_ACTIONS,current);if(pos.length===2&&(second==="charter"||second==="skill")&&!current.startsWith("-")){return byPrefix(["push","pull"],current)}return[]}if(!isDomainName(first))return[];const domain=await ctx.loadDomain(first);const subresources=domain.
|
|
8
|
+
subresources??[];if(second===void 0){if(current.startsWith("-"))return byPrefix(DOMAIN_GLOBAL_FLAGS,current);return byPrefix([...domain.operations.map(op=>op.name),...subresources.map(sub2=>sub2.name),HELP_TOKEN],current)}const sub=subresources.find(resource=>resource.name===second);let operation;if(sub!==void 0){const third=pos[2];if(third===void 0){if(current.startsWith("-"))return byPrefix(DOMAIN_GLOBAL_FLAGS,current);return byPrefix([...sub.operations.map(op=>op.name),HELP_TOKEN],current)}operation=
|
|
9
|
+
sub.operations.find(op=>op.name===third)}else{operation=domain.operations.find(op=>op.name===second)}if(operation===void 0)return[];if(!current.startsWith("-"))return[];return byPrefix(remainingFlags(operation.flags,words),current)}function completionScript(shell){switch(shell){case"bash":return`# twp \u306E bash \u88DC\u5B8C\uFF08twp completion bash \u304C\u51FA\u529B\uFF09
|
|
10
|
+
# \u8AAD\u307F\u8FBC\u307F: eval "$(twp completion bash)" \uFF0F \u5E38\u7528: ~/.bashrc \u306B\u540C\u30581\u884C\u3092\u66F8\u304F
|
|
11
|
+
# \uFF08source <(...) \u306F macOS \u6A19\u6E96\u306E bash 3.2 \u3067\u8AAD\u307F\u8FBC\u307E\u308C\u306A\u3044\u306E\u3067\u4F7F\u308F\u306A\u3044\uFF09
|
|
12
|
+
# \u78BA\u5B9A\u6E08\u307F\u306E\u8A9E\u306F\u914D\u5217\u30B9\u30E9\u30A4\u30B9\u3067\u306F\u306A\u304F\u30EB\u30FC\u30D7\u3067\u96C6\u3081\u308B\uFF08macOS \u6A19\u6E96\u306E bash 3.2 \u3067\u3082\u540C\u3058\u306B\u52D5\u304B\u3059\u305F\u3081\uFF09
|
|
13
|
+
_twp_complete() {
|
|
14
|
+
local cur="\${COMP_WORDS[COMP_CWORD]}" i
|
|
15
|
+
local -a args=()
|
|
16
|
+
for ((i = 1; i < COMP_CWORD; i++)); do args+=("\${COMP_WORDS[i]}"); done
|
|
17
|
+
local IFS=$'\\n'
|
|
18
|
+
COMPREPLY=( $(twp __complete "--current=\${cur}" "\${args[@]}" 2>/dev/null) )
|
|
19
|
+
}
|
|
20
|
+
complete -o default -F _twp_complete twp
|
|
21
|
+
`;case"zsh":return`#compdef twp
|
|
22
|
+
# twp \u306E zsh \u88DC\u5B8C\uFF08twp completion zsh \u304C\u51FA\u529B\uFF09
|
|
23
|
+
# \u8AAD\u307F\u8FBC\u307F: source <(twp completion zsh) \uFF0F \u5E38\u7528: ~/.zshrc \u306E compinit \u3088\u308A\u5F8C\u306B\u540C\u30581\u884C\u3092\u66F8\u304F
|
|
24
|
+
_twp() {
|
|
25
|
+
local -a candidates
|
|
26
|
+
candidates=(\${(f)"$(twp __complete "--current=\${words[CURRENT]}" "\${(@)words[2,CURRENT-1]}" 2>/dev/null)"})
|
|
27
|
+
(( \${#candidates} )) && compadd -- "\${candidates[@]}"
|
|
28
|
+
}
|
|
29
|
+
if (( $+functions[compdef] )); then
|
|
30
|
+
compdef _twp twp
|
|
31
|
+
else
|
|
32
|
+
print -u2 "twp: compinit \u304C\u8AAD\u307F\u8FBC\u307E\u308C\u3066\u3044\u307E\u305B\u3093\uFF08autoload -Uz compinit && compinit \u3092\u5148\u306B\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\uFF09"
|
|
33
|
+
fi
|
|
34
|
+
`;case"fish":return`# twp \u306E fish \u88DC\u5B8C\uFF08twp completion fish \u304C\u51FA\u529B\uFF09
|
|
35
|
+
# \u8AAD\u307F\u8FBC\u307F: twp completion fish | source \uFF0F \u5E38\u7528: twp completion fish > ~/.config/fish/completions/twp.fish
|
|
36
|
+
function __twp_complete
|
|
37
|
+
set -l tokens (commandline -opc)
|
|
38
|
+
set -e tokens[1]
|
|
39
|
+
twp __complete "--current="(commandline -ct) $tokens 2>/dev/null
|
|
40
|
+
end
|
|
41
|
+
complete -c twp -f -a '(__twp_complete)'
|
|
42
|
+
`;case"powershell":return`# twp \u306E PowerShell \u88DC\u5B8C\uFF08twp completion powershell \u304C\u51FA\u529B\uFF09
|
|
43
|
+
# \u8AAD\u307F\u8FBC\u307F: twp completion powershell | Out-String | Invoke-Expression
|
|
44
|
+
# \u5E38\u7528: \u4E0A\u306E1\u884C\u3092 $PROFILE \u306B\u66F8\u304F
|
|
45
|
+
Register-ArgumentCompleter -Native -CommandName twp -ScriptBlock {
|
|
46
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
47
|
+
$words = @($commandAst.CommandElements |
|
|
48
|
+
Where-Object { $_.Extent.EndOffset -le $cursorPosition } |
|
|
49
|
+
Select-Object -Skip 1 |
|
|
50
|
+
ForEach-Object { $_.ToString() })
|
|
51
|
+
if ($wordToComplete -ne '' -and $words.Count -gt 0) {
|
|
52
|
+
$words = @($words | Select-Object -First ($words.Count - 1))
|
|
53
|
+
}
|
|
54
|
+
& twp __complete "--current=$wordToComplete" @words 2>$null | ForEach-Object {
|
|
55
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`}}function isShell(value){return value!==void 0&&COMPLETION_SHELLS.includes(value)}var COMPLETION_HELP=`\u4F7F\u3044\u65B9: twp completion <bash|zsh|fish|powershell>
|
|
59
|
+
|
|
60
|
+
\u30B7\u30A7\u30EB\u88DC\u5B8C\u306E\u30B9\u30AF\u30EA\u30D7\u30C8\u3092 stdout \u3078\u51FA\u3057\u307E\u3059\u3002\u30B3\u30DE\u30F3\u30C9\u540D\u30FB\u64CD\u4F5C\u540D\u30FB\u30D5\u30E9\u30B0\u540D\u3092\u88DC\u5B8C\u3057\u307E\u3059
|
|
61
|
+
\uFF08\u5019\u88DC\u306F\u5B9F\u884C\u6642\u306B twp \u81EA\u8EAB\u304B\u3089\u5F15\u304F\u306E\u3067\u3001twp \u3092\u66F4\u65B0\u3059\u308C\u3070\u88DC\u5B8C\u3082\u8FFD\u968F\u3057\u307E\u3059\uFF09\u3002
|
|
62
|
+
|
|
63
|
+
bash eval "$(twp completion bash)" \u3092 ~/.bashrc \u3078
|
|
64
|
+
zsh source <(twp completion zsh) \u3092 ~/.zshrc \u306E compinit \u3088\u308A\u5F8C\u3078
|
|
65
|
+
fish twp completion fish > ~/.config/fish/completions/twp.fish
|
|
66
|
+
powershell twp completion powershell | Out-String | Invoke-Expression \u3092 $PROFILE \u3078
|
|
67
|
+
`;function runCompletion(argv,out,err){const[shell,...rest]=argv;if(shell===void 0||shell==="-h"||shell==="--help"||shell===HELP_TOKEN){(shell===void 0?err:out).write(COMPLETION_HELP);return shell===void 0?2:0}if(!isShell(shell)||rest.length>0){err.write(`\u5BFE\u5FDC\u3057\u3066\u3044\u306A\u3044\u6307\u5B9A\u3067\u3059: ${argv.join(" ")}
|
|
68
|
+
|
|
69
|
+
${COMPLETION_HELP}`);return 2}out.write(completionScript(shell));return 0}async function runComplete(argv,out,ctx){const[head,...words]=argv;const current=head!==void 0&&head.startsWith("--current=")?head.slice("--current=".length):"";const rest=head!==void 0&&head.startsWith("--current=")?words:[...argv];try{const candidates=await complete(rest,current,ctx);if(candidates.length>0)out.write(`${candidates.join("\n")}
|
|
70
|
+
`)}catch{}return 0}export{COMPLETION_SHELLS,complete,completionScript,runComplete,runCompletion};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{DEFAULT_API_URL,DEFAULT_FRONTEND_URL,DEFAULT_RELAY_URL,effectiveApiUrl,effectiveRelayUrl,loadProjectConfig,loadUserConfig,resolveConfiguredModel,resolveConfiguredOutput,resolveProfile,resolveProfileName,userConfigPath}from"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";export{DEFAULT_API_URL,DEFAULT_FRONTEND_URL,DEFAULT_RELAY_URL,effectiveApiUrl,effectiveRelayUrl,loadProjectConfig,loadUserConfig,resolveConfiguredModel,resolveConfiguredOutput,resolveProfile,resolveProfileName,userConfigPath};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{PromptAbortedError,promptText}from"./chunk-L37NS5L2.js";import{writePrivateFileAtomic}from"./chunk-D233KKXW.js";import{loadUserConfig,resolveProfileName,userConfigPath}from"./chunk-4VZKNEVN.js";import{splitFlagToken}from"./chunk-QQRJLH6B.js";import{OUTPUT_FORMATS,isOutputFormat}from"./chunk-K2ONOH3L.js";import"./chunk-WVS4W5FY.js";import"./chunk-NHYMHCAT.js";import{ensureTwpHome}from"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";var CLEAR="-";var HELP=`\u4F7F\u3044\u65B9: twp configure [--profile <\u540D\u524D>]
|
|
4
|
+
|
|
5
|
+
\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u306E\u65E2\u5B9A\u3092\u5BFE\u8A71\u3067\u8A2D\u5B9A\u3057\u3001~/.twp/config.json \u306B\u4FDD\u5B58\u3057\u307E\u3059
|
|
6
|
+
\uFF08\u8A8D\u8A3C\u60C5\u5831\u306B\u306F\u89E6\u308A\u307E\u305B\u3093\u3002\u30ED\u30B0\u30A4\u30F3\u306F twp login\uFF09\u3002
|
|
7
|
+
|
|
8
|
+
\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8 --project \u3092\u7701\u7565\u3057\u305F\u3068\u304D\u306B\u4F7F\u3046\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u30B3\u30FC\u30C9\u304B ID\uFF09
|
|
9
|
+
\u65E2\u5B9A\u306E\u51FA\u529B\u5F62\u5F0F ${OUTPUT_FORMATS.join(" | ")}\uFF08--output \u3092\u7701\u7565\u3057\u305F\u3068\u304D\u306B\u4F7F\u3046\uFF09
|
|
10
|
+
\u65E2\u5B9A\u306E\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB --profile \u3092\u7701\u7565\u3057\u305F\u3068\u304D\u306B\u4F7F\u3046\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB
|
|
11
|
+
|
|
12
|
+
Enter \u3067\u73FE\u5728\u306E\u5024\u306E\u307E\u307E\u3001\u300C${CLEAR}\u300D\u3067\u8A2D\u5B9A\u3092\u6D88\u3057\u307E\u3059\u3002
|
|
13
|
+
--profile \u3092\u7701\u7565\u3059\u308B\u3068\u3001\u3044\u307E\u89E3\u6C7A\u3055\u308C\u308B\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\uFF08TWP_PROFILE / .twp/config.json /
|
|
14
|
+
\u65E2\u5B9A\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB / default \u306E\u9806\uFF09\u3092\u8A2D\u5B9A\u3057\u307E\u3059\u3002
|
|
15
|
+
`;function defaultWrite(env){return config=>{ensureTwpHome(env);const file=userConfigPath(env);writePrivateFileAtomic(file,`${JSON.stringify(config,null,2)}
|
|
16
|
+
`);return file}}function parseArgs(argv){let profile;for(let i=0;i<argv.length;i++){const raw=argv[i]??"";const{name,value}=splitFlagToken(raw);if(name==="-h"||name==="--help"||raw==="help")return{help:true};if(name==="--profile"){const next=value??argv[i+1];if(next===void 0||next.trim()===""||value===void 0&&next.startsWith("-")){return{help:false,error:"--profile \u306B\u306F\u540D\u524D\u304C\u5FC5\u8981\u3067\u3059"}}if(value===void 0)i++;profile=next.trim();continue}return{help:false,error:`\
|
|
17
|
+
\u4E0D\u660E\u306A\u5F15\u6570: ${raw}`}}return{help:false,...profile!==void 0?{profile}:{}}}function answerToValue(answer,current){if(answer==="")return current;if(answer===CLEAR)return void 0;return answer}function shown(value){return value===void 0||value===""?"\u672A\u8A2D\u5B9A":value}async function runConfigure(argv,io){const env=io?.env??process.env;const full={ask:io?.ask??promptText,out:io?.out??process.stdout,err:io?.err??process.stderr,env,cwd:io?.cwd??process.cwd(),write:io?.write??defaultWrite(
|
|
18
|
+
env)};const args=parseArgs(argv);if(args.help){full.out.write(HELP);return 0}if(args.error!==void 0){full.err.write(`${args.error}
|
|
19
|
+
|
|
20
|
+
${HELP}`);return 2}let config;try{config=loadUserConfig(full.env)}catch(err){full.err.write(`${err.message}
|
|
21
|
+
\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u3092\u76F4\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
22
|
+
`);return 1}const profileName=args.profile??resolveProfileName(void 0,full.env,full.cwd);const profile={...config.profiles?.[profileName]??{}};full.out.write(`\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u300C${profileName}\u300D\u3092\u8A2D\u5B9A\u3057\u307E\u3059\uFF08Enter \u3067\u636E\u3048\u7F6E\u304D\u30FB\u300C${CLEAR}\u300D\u3067\u6D88\u53BB\uFF09
|
|
23
|
+
`);try{const project=answerToValue(await full.ask(`\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8 [${shown(profile.project)}]: `),profile.project);const outputAnswer=await full.ask(`\u65E2\u5B9A\u306E\u51FA\u529B\u5F62\u5F0F\uFF08${OUTPUT_FORMATS.join(" / ")}\uFF09 [${shown(profile.output)}]: `);const output=answerToValue(outputAnswer,profile.output);if(output!==void 0&&output!==profile.output&&!isOutputFormat(output)){full.err.write(`\u51FA\u529B\u5F62\u5F0F\u306F ${OUTPUT_FORMATS.join(
|
|
24
|
+
" / ")} \u306E\u3044\u305A\u308C\u304B\u3067\u3059\uFF08\u6307\u5B9A: ${output}\uFF09\u3002\u4F55\u3082\u4FDD\u5B58\u3057\u3066\u3044\u307E\u305B\u3093\u3002
|
|
25
|
+
`);return 2}const currentDefault=config.default_profile??"default";let makeDefault=false;if(currentDefault!==profileName){const answer=await full.ask(`\u300C${profileName}\u300D\u3092\u65E2\u5B9A\u306E\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u306B\u3057\u307E\u3059\u304B\uFF08\u73FE\u5728: ${currentDefault}\uFF09 [y/N]: `);makeDefault=/^y(es)?$/i.test(answer)}if(project===void 0)delete profile.project;else profile.project=project;if(output===void 0)delete profile.output;else profile.output=output;const next={
|
|
26
|
+
...config,profiles:{...config.profiles??{},[profileName]:profile},...makeDefault?{default_profile:profileName}:{}};const file=full.write(next);full.out.write(`\u4FDD\u5B58\u3057\u307E\u3057\u305F: ${file}
|
|
27
|
+
\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB ${profileName}${makeDefault||currentDefault===profileName?"\uFF08\u65E2\u5B9A\uFF09":""}
|
|
28
|
+
\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8 ${shown(profile.project)}
|
|
29
|
+
\u65E2\u5B9A\u306E\u51FA\u529B\u5F62\u5F0F ${shown(profile.output)}
|
|
30
|
+
`);if(full.env.TWP_PROJECT!==void 0&&full.env.TWP_PROJECT.trim()!==""&&profile.project!==void 0){full.err.write(`\u6CE8\u8A18: TWP_PROJECT\uFF08${full.env.TWP_PROJECT}\uFF09\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u3053\u306E\u7AEF\u672B\u3067\u306F\u65E2\u5B9A\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3088\u308A\u305D\u3061\u3089\u304C\u512A\u5148\u3055\u308C\u307E\u3059\u3002
|
|
31
|
+
`)}return 0}catch(err){if(err instanceof PromptAbortedError){full.err.write("\u5165\u529B\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u4F55\u3082\u4FDD\u5B58\u3057\u3066\u3044\u307E\u305B\u3093\u3002\n");return 1}throw err}}export{runConfigure};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{cacheNote,createFlags,fieldBody,hasAnyField,idSegment,masterFields,masterItem,masterListOperation,masterRows,referencedDeleteGuidance,resolveRefFields,targetId,updateFlags}from"./chunk-
|
|
4
|
-
|
|
3
|
+
import{cacheNote,createFlags,fieldBody,hasAnyField,idSegment,masterFields,masterItem,masterListOperation,masterRows,referencedDeleteGuidance,resolveRefFields,targetId,updateFlags}from"./chunk-V4UGLDEH.js";import"./chunk-UDPJ2IGK.js";import{DEPARTMENTS_PATH}from"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import"./chunk-GMBJTG6A.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import"./chunk-G4OO4M44.js";
|
|
4
|
+
import"./chunk-II5RVJQN.js";import{withResolved}from"./chunk-ZN5EFDH7.js";import{acknowledgement,isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";var LABEL="\u90E8\u7F72";var LIST_COLUMNS=["id","code","name","parent_id","level","effective_status","valid_from","valid_to","member_count"];var GET_COLUMNS=["id","code","name","name_short","parent_id","level","sort","effective_status","valid_from","valid_to","description"];var TREE_COLUMNS=["depth","name","code","id","effective_status","valid_to"];var MEMBER_COLUMNS=["id","user_id","position_id","job_title_id","start_date","end_date","is_primary","is_current","effective_status"];var REF_FLAG={name:"\
|
|
5
5
|
--department",summary:"\u5BFE\u8C61\u306E\u90E8\u7F72\uFF08\u4F4D\u7F6E\u5F15\u6570\u306E\u4EE3\u308F\u308A\u306B\u4F7F\u3048\u308B\uFF09",takesValue:true,placeholder:"<\u90E8\u7F72>"};var REF_HELP="<\u90E8\u7F72> \u306F\u540D\u524D\u30FB\u30B3\u30FC\u30C9\u30FBID \u306E\u3069\u308C\u3067\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\uFF08\u540D\u524D\u304C\u8907\u6570\u306B\u4E00\u81F4\u3059\u308C\u3070\u5019\u88DC\u3092\u51FA\u3057\u3066\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002\nID \u4EE5\u5916\u306F\u90E8\u7F72\u4E00\u89A7\uFF08\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3068\u7167\u5408\u3057\u307E\u3059\u3002";
|
|
6
6
|
var FIELDS=masterFields(LABEL,[{kind:"text",flag:"--name-short",key:"name_short",label:"\u7565\u79F0",maxChars:50,summary:"\u7565\u79F0"},{kind:"ref",flag:"--parent",key:"parent_id",summary:"\u89AA\u90E8\u7F72\uFF08\u540D\u524D\u30FB\u30B3\u30FC\u30C9\u30FBID\uFF09",placeholder:"<\u90E8\u7F72>",clearFlag:"--no-parent",clearSummary:"\u89AA\u90E8\u7F72\u3092\u5916\u3057\u3066\u6700\u4E0A\u4F4D\u306B\u3059\u308B",resolve:(ctx,ref,flag)=>ctx.resolver.department(ref,flag)},{kind:"integer",flag:"--sor\
|
|
7
7
|
t",key:"sort",label:"\u8868\u793A\u9806",min:0,summary:"\u8868\u793A\u9806\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09"},{kind:"date",flag:"--valid-from",key:"valid_from",summary:"\u6709\u52B9\u958B\u59CB\u65E5\uFF08YYYY-MM-DD\u30FBnone \u3067\u6D88\u3059\uFF09"},{kind:"date",flag:"--valid-to",key:"valid_to",summary:"\u6709\u52B9\u7D42\u4E86\u65E5\uFF08YYYY-MM-DD\u30FBnone \u3067\u6D88\u3059\uFF09\u3002\u3053\u306E\u65E5\u306E\u7FCC\u65E5\u304B\u3089\u7121\u52B9\u306B\u306A\u308B"},{kind:"boolean",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{repeatedValues}from"./chunk-IOGVQVGD.js";import{booleanText,boundedText}from"./chunk-UDPJ2IGK.js";import{INQUIRY_CATEGORIES_PATH}from"./chunk-
|
|
4
|
-
import"./chunk-
|
|
3
|
+
import{repeatedValues}from"./chunk-IOGVQVGD.js";import{booleanText,boundedText}from"./chunk-UDPJ2IGK.js";import{INQUIRY_CATEGORIES_PATH}from"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import{UUID_RE,isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-II5RVJQN.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";
|
|
4
|
+
import{isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";var LABEL="\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA";var LIST_COLUMNS=["id","category_code","title","sort","is_active","notification_user_count"];var GET_COLUMNS=["id","category_code","title","description","sort","is_active","notification_users"];var FORBIDDEN=`\u7BA1\u7406\u8005\u306E\u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059\u3002${LABEL}\u306E\u8A73\u7D30\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u306F\u554F\u3044\u5408\u308F\u305B\u6A5F\u80FD\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u884C\u3048\u307E\u3059`;
|
|
5
5
|
var SORT_LAST="last";var CODE_RE=/^[a-zA-Z0-9_-]+$/;var REF_HELP="<\u30AB\u30C6\u30B4\u30EA> \u306F\u30AB\u30C6\u30B4\u30EA\u30B3\u30FC\u30C9\u30FB\u540D\u524D\uFF08title\uFF09\u30FBID \u306E\u3069\u308C\u3067\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\uFF08\u540D\u524D\u304C\u8907\u6570\u306B\u4E00\u81F4\u3059\u308C\u3070\u5019\u88DC\u3092\u51FA\u3057\u3066\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002\nID \u4EE5\u5916\u306F\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7\uFF08\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3068\u7167\u5408\u3057\u307E\u3059\u3002";
|
|
6
6
|
var NOTIFY_HELP="--notify \u306F\u901A\u77E5\u5148\u306E\u30E6\u30FC\u30B6\u30FC\u3067\u3001\u8907\u6570\u56DE\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\u30E6\u30FC\u30B6\u30FC\u306F ID\u30FB\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30FB\u793E\u54E1\u756A\u53F7\u30FB\u6C0F\u540D\u3067\u6307\u5B9A\u3067\u304D\u307E\u3059\n\uFF08ID \u4EE5\u5916\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3068\u7167\u5408\u3057\u307E\u3059\u3002\u7D44\u7E54\u7BA1\u7406\u8005\u3067\u306A\u3044\u5834\u5408\u306F ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09\u3002";
|
|
7
7
|
var CATEGORY_FLAG={name:"--category",summary:"\u5BFE\u8C61\u306E\u30AB\u30C6\u30B4\u30EA\uFF08\u4F4D\u7F6E\u5F15\u6570\u306E\u4EE3\u308F\u308A\u306B\u4F7F\u3048\u308B\uFF09",takesValue:true,placeholder:"<\u30AB\u30C6\u30B4\u30EA>"};var CODE_FLAG={name:"--code",summary:"\u30AB\u30C6\u30B4\u30EA\u30B3\u30FC\u30C9\uFF08\u82F1\u6570\u5B57\u30FB_\u30FB- \u3067100\u6587\u5B57\u4EE5\u5185\u3002\u30C6\u30CA\u30F3\u30C8\u5185\u3067\u4E00\u610F\uFF09",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9>"};var TITLE_FLAG={
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{STATUS_VALUES,flatMasterDomain}from"./chunk-
|
|
3
|
+
import{STATUS_VALUES,flatMasterDomain}from"./chunk-V4UGLDEH.js";import"./chunk-UDPJ2IGK.js";import{JOB_TITLES_PATH}from"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import"./chunk-GMBJTG6A.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";import"./chunk-ZN5EFDH7.js";import"./chunk-ZWVYVS2A.js";import"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.js";
|
|
4
4
|
import"./chunk-VSJBJXZO.js";var jobTitleDomain=flatMasterDomain({name:"job-title",label:"\u8077\u4F4D",path:JOB_TITLES_PATH,itemKey:"job_title",summary:"\u8077\u4F4D\u30DE\u30B9\u30BF\uFF08\u4E00\u89A7\u30FB\u53D6\u5F97\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF09",listColumns:["id","code","name","sort_order","status","position_id","base_selling_price","base_cost_price"],getColumns:["id","code","name","name_short","sort_order","status","position_id","base_selling_price","base_cost_price","description"],fields:[
|
|
5
5
|
{kind:"text",flag:"--name-short",key:"name_short",label:"\u7565\u79F0",maxChars:50,summary:"\u7565\u79F0"},{kind:"integer",flag:"--sort-order",key:"sort_order",label:"\u8868\u793A\u9806",min:0,max:9999,summary:"\u8868\u793A\u9806\uFF080\u301C9999\uFF09"},{kind:"enum",flag:"--status",key:"status",values:STATUS_VALUES,summary:"\u72B6\u614B\uFF08active: \u6709\u52B9 / inactive: \u7121\u52B9\uFF09"},{kind:"text",flag:"--description",key:"description",label:"\u8AAC\u660E",maxChars:1e3,summary:"\u8AAC\u660E"},
|
|
6
6
|
{kind:"integer",flag:"--base-selling-price",key:"base_selling_price",label:"\u57FA\u6E96\u58F2\u4FA1",min:0,summary:"\u57FA\u6E96\u58F2\u4FA1\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09"},{kind:"integer",flag:"--base-cost-price",key:"base_cost_price",label:"\u57FA\u6E96\u539F\u4FA1",min:0,summary:"\u57FA\u6E96\u539F\u4FA1\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09"},{kind:"text",flag:"--skill-requirements",key:"skill_requirements",label:"\u30B9\u30AD\u30EB\u8981\u4EF6",maxChars:5e3,summary:"\u30B9\u30AD\u30EB\u8981\u4EF6"},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{USER_REF_FLAG,USER_REF_HELP,userPath}from"./chunk-2M2JQ23W.js";import"./chunk-
|
|
4
|
-
|
|
3
|
+
import{USER_REF_FLAG,USER_REF_HELP,userPath}from"./chunk-2M2JQ23W.js";import"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import"./chunk-GMBJTG6A.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import"./chunk-II5RVJQN.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import{isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";
|
|
4
|
+
import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";var LIST_USAGE="twp leave list";var GRANTS_USAGE="twp leave grants [<\u30E6\u30FC\u30B6\u30FC> | --user <\u30E6\u30FC\u30B6\u30FC>]";var USAGE_COLUMNS=["used_date","type_label","days","hours","status_label","reason","is_post_application","id"];var GRANT_COLUMNS=["grant_date","type_label","days","remaining_days","remaining_hours","expiry_date","status_label","reason","id"];function noArgs(input,operation){if(input.args.length>0){throw new UsageError(`${operation} \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.
|
|
5
5
|
args.join(" ")}`,`twp leave ${operation} help`)}}function summaryBody(body){if(!isRecord(body)||!isRecord(body["summary"])){throw new ApiResponseError("\u6709\u7D66\u30B5\u30DE\u30EA\u306E\u5FDC\u7B54\u306B summary \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return body}function usagesBody(body){if(!isRecord(body)||!Array.isArray(body["usages"])){throw new ApiResponseError("\u6709\u7D66\u306E\u53D6\u5F97\u5C65\u6B74\u306E\u5FDC\u7B54\u306B usages \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
6
6
|
return body}function grantsBody(body){if(!isRecord(body)||!Array.isArray(body["grants"])){throw new ApiResponseError("\u6709\u7D66\u306E\u4ED8\u4E0E\u5C65\u6B74\u306E\u5FDC\u7B54\u306B grants \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return body}function listBody(body){const combined=isRecord(body)?body:{};return{summary:summaryBody(combined["summary"]),usages:usagesBody(combined["usages"])}}async function list(input,ctx){
|
|
7
7
|
const summary=summaryBody(await ctx.send(listPlan(input)));const usages=await ctx.send({method:"GET",path:"/api/v1/paid-leave/me/usages"});return{summary,usages}}function listPlan(input){noArgs(input,"list");return{method:"GET",path:"/api/v1/paid-leave/me"}}function listNotes(body){const{summary:sheet}=listBody(body);const summary=sheet["summary"];const hours=typeof summary["total_remaining_hours"]==="number"&&summary["total_remaining_hours"]>0?` ${String(summary["total_remaining_hours"])} \u6642\u9593`:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{defaultIsLoopProcess,readLockOwner,sameTwpHome}from"./chunk-3WHC4FSG.js";import{loopStateDir}from"./chunk-JXIIXUAO.js";import"./chunk-N2UVRM3Z.js";import"./chunk-Y2XAWM2X.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import{twpHomeDir}from"./chunk-RZVI6PMW.js";import
|
|
3
|
+
import{defaultIsLoopProcess,readLockOwner,sameTwpHome}from"./chunk-3WHC4FSG.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import{loopStateDir}from"./chunk-JXIIXUAO.js";import"./chunk-N2UVRM3Z.js";import"./chunk-Y2XAWM2X.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import{twpHomeDir}from"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";var PIDLESS_GRACE_MS=6e4;function defaultStateDirs(env){const dirs=[loopStateDir(env),loopStateDir({})].map(d=>path.resolve(d));return[...new Set(dirs)]}function readPidFile(lockDir){try{const raw=fs.readFileSync(path.join(lockDir,"pid"),"utf8").split("\n")[0]?.trim()??"";const n=Number.parseInt(raw,10);return{pid:Number.isInteger(n)&&n>0?n:null,error:null}}catch(err){const code=err.code;return{pid:null,error:code==="ENOENT"?null:code??err.message}}}function findLoopsUsingProfile(profileName,deps={}){
|
|
4
4
|
const env=deps.env??process.env;const now=deps.now??Date.now;const isLoopProcess=deps.isLoopProcess??defaultIsLoopProcess;const myHome=twpHomeDir(env);const result={users:[],undetermined:[]};for(const stateDir of deps.stateDirs??defaultStateDirs(env)){let dirs;try{dirs=fs.readdirSync(stateDir).filter(d=>/^task-loop-.*\.lock\.d$/.test(d))}catch(err){if(err.code==="ENOENT")continue;result.undetermined.push({pid:null,lockDir:stateDir,reason:`\u30ED\u30C3\u30AF\u306E\u7F6E\u304D\u5834\u6240\u3092\u8AAD\u3081\u307E\u305B\u3093\uFF08${err.
|
|
5
5
|
code??err.message}\uFF09`});continue}for(const dir of dirs){const lockDir=path.join(stateDir,dir);const pidFile=readPidFile(lockDir);if(pidFile.error!==null){result.undetermined.push({pid:null,lockDir,reason:`pid \u3092\u8AAD\u3081\u307E\u305B\u3093\uFF08${pidFile.error}\uFF09`});continue}const owner=readLockOwner(lockDir);let pid=pidFile.pid;if(pid===null){if(owner.ok){pid=owner.owner.pid}else{let ageMs=null;try{ageMs=now()-fs.statSync(lockDir).mtimeMs}catch{}if(ageMs!==null&&ageMs>=PIDLESS_GRACE_MS)
|
|
6
6
|
continue;result.undetermined.push({pid:null,lockDir,reason:"\u30ED\u30C3\u30AF\u306B pid \u304C\u3042\u308A\u307E\u305B\u3093\uFF08\u8D77\u52D5\u76F4\u5F8C\u306E\u53EF\u80FD\u6027\uFF09"});continue}}if(!isLoopProcess(pid))continue;if(!owner.ok){result.undetermined.push({pid,lockDir,reason:owner.reason});continue}if(owner.owner.pid!==pid){result.undetermined.push({pid,lockDir,reason:`\u6240\u6709\u8005\u306E\u8A18\u9332\uFF08pid=${owner.owner.pid}\uFF09\u304C\u30ED\u30C3\u30AF\u306E pid \u3068\u4E00\u81F4\u3057\u307E\u305B\u3093`});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{contentTypeFor}from"./chunk-
|
|
4
|
-
|
|
3
|
+
import{contentTypeFor}from"./chunk-FJESEWMF.js";import"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import{checkUploadQuota}from"./chunk-DDKZ5IPT.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import"./chunk-GY7KI5E5.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";
|
|
4
|
+
import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import{isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.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
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
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
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",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{boundedText}from"./chunk-UDPJ2IGK.js";import{NOTIFICATIONS_PATH}from"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";import{requireResolved,withResolved}from"./chunk-ZN5EFDH7.js";
|
|
4
|
+
import{isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";var LABEL="\u901A\u77E5";var LIST_COLUMNS=["id","datetime","category_name","status_name","title"];var GET_COLUMNS=["id","datetime","category","category_name","status_name","read_time","title","content","url"];var CATEGORY_FLAG={name:"--category",summary:"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA\u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u30AD\u30FC\u304B\u540D\u524D\u3002twp notification categories \u3067\u4E00\u89A7\u3067\u304D\u308B\uFF09",takesValue:true,placeholder:"<\u30AB\u30C6\u30B4\u30EA>"};var CATEGORY_HELP="\
|
|
5
|
+
--category \u306F\u30AB\u30C6\u30B4\u30EA\u306E\u30AD\u30FC\uFF08workflow_approval\uFF09\u304B\u540D\u524D\uFF08\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u627F\u8A8D\u4F9D\u983C\uFF09\u3067\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\n\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7\u3068\u7167\u5408\u3059\u308B\u306E\u3067\u3001\u6253\u3061\u9593\u9055\u3048\u305F\u30AB\u30C6\u30B4\u30EA\u3092\u300C0\u4EF6\u300D\u3068\u3057\u3066\u8FD4\u3059\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u4E00\u89A7\u306F\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3002";
|
|
6
|
+
async function resolveCategory(input,ctx){const raw=nonEmpty(input.flags,CATEGORY_FLAG.name);if(raw===void 0)return input;return withResolved(input,{category:(await ctx.resolver.notificationCategory(raw.trim())).id})}function noArgs(input,op){if(input.args.length>0){throw new UsageError(`${op} \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,`twp notification ${op} help`)}}function notificationId(input,op){const[raw,...rest]=input.args;const id=raw?.trim()??
|
|
7
|
+
"";if(id==="")throw new UsageError("\u901A\u77E5\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",`twp notification ${op} help`);if(rest.length>0)throw new UsageError(`${op} \u304C\u53D7\u3051\u53D6\u308C\u308B\u901A\u77E5 ID \u306F1\u3064\u3060\u3051\u3067\u3059: ${rest.join(" ")}`,`twp notification ${op} help`);if(!isSafePathSegment(id)){throw new UsageError(`\u901A\u77E5\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${id}`,"\u901A\u77E5\u306E ID \u306F twp notification li\
|
|
8
|
+
st \u306E id \u5217\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002")}return id}function itemPath(id,suffix=""){return`${NOTIFICATIONS_PATH}/${encodeURIComponent(id)}${suffix}`}function envelope(body,what){if(!isRecord(body)||body["result"]!==true){throw new ApiResponseError(`${what}\u306E\u5FDC\u7B54\u306E\u5F62\u304C\u60F3\u5B9A\u3068\u9055\u3044\u307E\u3059\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return body}var listPaging=envelopePaging({label:`${LABEL}\
|
|
9
|
+
\u4E00\u89A7`,itemsKey:"list"});function listRows(body){envelope(body,`${LABEL}\u4E00\u89A7`);return listPaging.items(body)}function detail(body){const row=envelope(body,LABEL);if(typeof row["id"]!=="string"){throw new ApiResponseError(`${LABEL}\u306E\u5FDC\u7B54\u306B id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return withoutResult(row)}function counts(body){const row=envelope(body,"\u901A\u77E5\u4EF6\u6570");for(const key of[
|
|
10
|
+
"unread_count","unreact_count"]){if(typeof row[key]!=="number")throw new ApiResponseError(`\u901A\u77E5\u4EF6\u6570\u306E\u5FDC\u7B54\u306B ${key} \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return withoutResult(row)}function categories(body){const list=envelope(body,"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7")["categories"];if(!Array.isArray(list))throw new ApiResponseError("\u901A\u77E5\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7\u306E\u5FDC\u7B54\u306B categories \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\
|
|
11
|
+
\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return list}function readResult(body){const row=envelope(body,"\u65E2\u8AAD\u5316");if(typeof row["status_name"]!=="string"){throw new ApiResponseError("\u65E2\u8AAD\u5316\u306E\u5FDC\u7B54\u306B status_name \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return withoutResult(row)}function readAllResult(body){const count=envelope(body,"\u4E00\u62EC\u65E2\u8AAD\u5316")["\
|
|
12
|
+
read_count"];if(typeof count!=="number")throw new ApiResponseError("\u4E00\u62EC\u65E2\u8AAD\u5316\u306E\u5FDC\u7B54\u306B read_count \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return{read_count:count}}function withoutResult(row){return Object.fromEntries(Object.entries(row).filter(([key])=>key!=="result"))}var listOperation={name:"list",summary:`\u81EA\u5206\u5B9B\u3066\u306E${LABEL}\u3092\u4E00\u89A7\u3059\u308B\uFF08\u65B0\u3057\u3044\u9806\uFF09`,
|
|
13
|
+
usage:"twp notification list [--unread] [--category <\u30AB\u30C6\u30B4\u30EA>] [--keyword <\u8A9E>] [--all] [--limit <\u4EF6\u6570>] [--cursor <\u30AB\u30FC\u30BD\u30EB>]",description:`\u65E2\u5B9A\u306F\u65E2\u8AAD\u30FB\u672A\u8AAD\u3092\u554F\u308F\u305A\u5168\u4EF6\u3067\u3059\u3002--unread \u3067\u672A\u8AAD\u3060\u3051\u306B\u7D5E\u308A\u307E\u3059\u3002
|
|
14
|
+
${CATEGORY_HELP}
|
|
15
|
+
|
|
16
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
17
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${LIST_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002
|
|
18
|
+
|
|
19
|
+
`+LIST_PAGING_HELP,flags:[...LIST_FLAGS,{name:"--unread",summary:"\u672A\u8AAD\u3060\u3051\u306B\u7D5E\u308A\u8FBC\u3080",takesValue:false},CATEGORY_FLAG,{name:"--keyword",summary:"\u30BF\u30A4\u30C8\u30EB\u30FB\u672C\u6587\u306E\u8A9E\u3067\u7D5E\u308A\u8FBC\u3080\uFF08255\u6587\u5B57\u4EE5\u5185\uFF09",takesValue:true,placeholder:"<\u8A9E>"}],paging:listPaging,prepare(input,ctx){noArgs(input,"list");listQuery(input);return resolveCategory(input,ctx)},plan:input=>({method:"GET",path:NOTIFICATIONS_PATH,
|
|
20
|
+
query:listQuery(input)}),summarize:body=>listRows(body).map(row=>pick(row,LIST_COLUMNS)),raw:body=>listRows(body),notes:body=>isRecord(body)&&body["search_limited"]===true?["\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22\u306F\u30B5\u30FC\u30D0\u304C\u8D70\u67FB\u3059\u308B\u4EF6\u6570\u306B\u4E0A\u9650\u304C\u3042\u308A\u307E\u3059\u3002\u3053\u306E\u7D50\u679C\u306F\u5168\u4EF6\u3092\u691C\u7D22\u3057\u305F\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08--category \u3067\u7D5E\u308B\u3068\u5C4A\u304F\u7BC4\u56F2\u304C\u5E83\u304C\u308A\u307E\u3059\uFF09\u3002"]:
|
|
21
|
+
[]};function listQuery(input){const keyword=boundedText(input,"--keyword",{maxChars:255,label:"\u691C\u7D22\u8A9E"});const limit=positiveInteger(input.flags,"--limit");if(limit!==void 0&&limit>100){throw new UsageError(`--limit \u306F 1\u301C100 \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${limit}`,"\u30B5\u30FC\u30D0\u306E\u4E0A\u9650\u304C100\u4EF6\u3067\u3059\u3002\u5168\u4EF6\u306F --all \u3067\u8FBF\u308C\u307E\u3059\u3002")}return{action_required:0,read_status:input.flags.has("\
|
|
22
|
+
--unread")?"unread":void 0,category:input.resolved?.["category"],search_keyword:keyword,limit,cursor:nonEmpty(input.flags,"--cursor")}}var getOperation={name:"get",summary:`\u81EA\u5206\u5B9B\u3066\u306E${LABEL}1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B`,usage:"twp notification get <\u901A\u77E5ID>",description:"\u898B\u308B\u3060\u3051\u3067\u306F\u65E2\u8AAD\u306B\u306A\u308A\u307E\u305B\u3093\uFF08\u65E2\u8AAD\u306B\u3059\u308B\u306E\u306F twp notification read\uFF09\u3002\n\u30B5\u30FC\u30D0\u306F\u65B0\u3057\u3044\u307B\u3046\u304B\u3089200\u4EF6\u306E\u4E2D\u3067\u3060\u3051\u901A\u77E5\u3092\u63A2\u3059\u306E\u3067\u3001\u305D\u308C\u3088\u308A\u53E4\u3044\u901A\u77E5\u306F\u300C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u300D\u306B\u306A\u308A\u307E\u3059\u3002\n\n--output json \u306F\u901A\u77E5\u306E\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08\u524D\u5F8C\u306E\u901A\u77E5\u306E prev_id / next_id \u3092\u542B\u3080\uFF09\u3092\u51FA\u3057\u307E\u3059\u3002",
|
|
23
|
+
flags:[],plan:input=>({method:"GET",path:itemPath(notificationId(input,"get"))}),summarize:body=>pick(detail(body),GET_COLUMNS),raw:detail};var countsOperation={name:"counts",summary:`\u81EA\u5206\u5B9B\u3066\u306E\u672A\u8AAD\u30FB\u672A\u5BFE\u5FDC\u306E${LABEL}\u4EF6\u6570\u3092\u8868\u793A\u3059\u308B`,usage:"twp notification counts",description:"unread_count \u306F\u672A\u8AAD\u3001unreact_count \u306F\u65E2\u8AAD\u306E\u3046\u3061\u5BFE\u5FDC\u304C\u8981\u308B\u306E\u306B\u307E\u3060\u5BFE\u5FDC\u3057\u3066\u3044\u306A\u3044\u3082\u306E\u306E\u4EF6\u6570\u3067\u3059\u3002",
|
|
24
|
+
flags:[],plan(input){noArgs(input,"counts");return{method:"GET",path:`${NOTIFICATIONS_PATH}/counts`}},summarize:counts,raw:counts};var categoriesOperation={name:"categories",summary:`${LABEL}\u30AB\u30C6\u30B4\u30EA\u3092\u4E00\u89A7\u3059\u308B\uFF08--category \u306B\u6E21\u305B\u308B\u30AD\u30FC\u3068\u540D\u524D\uFF09`,usage:"twp notification categories",description:"\u3053\u306E API \u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3092\u6301\u305F\u305A\u3001\u5168\u4EF6\u3092\u8FD4\u3057\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306E\u5B9A\u7FA9\u305D\u306E\u3082\u306E\u3067\u3001\u30C6\u30CA\u30F3\u30C8\u306B\u4F9D\u308A\u307E\u305B\u3093\uFF09\u3002",
|
|
25
|
+
flags:[],plan(input){noArgs(input,"categories");return{method:"GET",path:`${NOTIFICATIONS_PATH}/categories`}},summarize:body=>categories(body).map(row=>pick(row,["key","name"])),raw:categories};var readOperation={name:"read",summary:`\u81EA\u5206\u5B9B\u3066\u306E${LABEL}1\u4EF6\u3092\u65E2\u8AAD\u306B\u3059\u308B`,usage:"twp notification read <\u901A\u77E5ID>",description:"\u65E2\u306B\u65E2\u8AAD\u306E\u901A\u77E5\u306B\u6253\u3063\u3066\u3082\u5909\u308F\u308A\u307E\u305B\u3093\u3002\u51FA\u529B\u306F\u65E2\u8AAD\u306B\u3057\u305F\u5F8C\u306E\u72B6\u614B\uFF08status_name\uFF09\u3067\u3059\u3002",
|
|
26
|
+
flags:[],plan:input=>({method:"POST",path:itemPath(notificationId(input,"read"),"/read")}),summarize:readResult,raw:readResult};var readAllOperation={name:"read-all",summary:`\u81EA\u5206\u5B9B\u3066\u306E\u672A\u8AAD\u306E${LABEL}\u3092\u307E\u3068\u3081\u3066\u65E2\u8AAD\u306B\u3059\u308B\uFF08--yes \u304C\u8981\u308B\uFF09`,usage:"twp notification read-all [--category <\u30AB\u30C6\u30B4\u30EA>] --yes",description:`\u672A\u8AAD\u3092\u307E\u3068\u3081\u3066\u65E2\u8AAD\u306B\u3057\u307E\u3059\u3002\u65E2\u8AAD\u3092\u672A\u8AAD\u3078\u623B\u3059\u624B\u6BB5\u306F\u7121\u3044\u306E\u3067 --yes \u304C\u8981\u308A\u307E\u3059\u3002
|
|
27
|
+
\u9001\u308B\u524D\u306B\u5BFE\u8C61\u306E\u672A\u8AAD\u4EF6\u6570\u3092\u6570\u3048\u3066 stderr \u306B\u51FA\u3057\u307E\u3059\u3002--dry-run \u306A\u3089\u4EF6\u6570\u3092\u51FA\u3059\u3060\u3051\u3067\u65E2\u8AAD\u306B\u3057\u307E\u305B\u3093\u3002
|
|
28
|
+
${CATEGORY_HELP}
|
|
29
|
+
\u4EF6\u6570\u306F --category \u304C\u7121\u3051\u308C\u3070\u672A\u8AAD\u4EF6\u6570\uFF081\u5F80\u5FA9\uFF09\u3001\u3042\u308C\u3070\u672A\u8AAD\u4E00\u89A7\u3092\u8FBF\u3063\u3066\u6570\u3048\u307E\u3059\uFF082,000\u4EF6\u3092\u8D85\u3048\u305F\u3089\u300C\u4EE5\u4E0A\u300D\u3068\u51FA\u3057\u307E\u3059\uFF09\u3002`,destructive:true,flags:[CATEGORY_FLAG],async prepare(input,ctx){noArgs(input,"read-all");const resolved=await resolveCategory(input,ctx);const unread=await ctx.resolver.notificationUnreadCount(
|
|
30
|
+
resolved.resolved?.["category"]??null);return withResolved(resolved,{unreadCount:String(unread.count),unreadComplete:unread.complete?"1":"0"})},plan:input=>{const category=input.resolved?.["category"];return{method:"POST",path:`${NOTIFICATIONS_PATH}/read-all`,body:category!==void 0?{category}:{}}},plannedNotes(input){const count=requireResolved(input,"unreadCount");const scope=input.resolved?.["category"]!==void 0?`\u30AB\u30C6\u30B4\u30EA ${input.resolved["category"]} \u306E`:"";const amount=input.
|
|
31
|
+
resolved?.["unreadComplete"]==="1"?`${count} \u4EF6`:`${count} \u4EF6\u4EE5\u4E0A`;return[`\u65E2\u8AAD\u306B\u3059\u308B\u5BFE\u8C61: ${scope}\u672A\u8AAD ${amount}\uFF08\u9001\u308B\u76F4\u524D\u306B\u6570\u3048\u305F\u4EF6\u6570\u3067\u3059\u3002\u305D\u306E\u5F8C\u306B\u5C4A\u3044\u305F\u901A\u77E5\u3082\u65E2\u8AAD\u306B\u306A\u308A\u307E\u3059\uFF09`]},summarize:readAllResult,raw:readAllResult};var notificationDomain={name:"notification",summary:"\u81EA\u5206\u5B9B\u3066\u306E\u901A\u77E5\uFF08\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u4EF6\u6570\u30FB\u30AB\u30C6\u30B4\u30EA\u30FB\u65E2\u8AAD\u5316\uFF09",
|
|
32
|
+
operations:[listOperation,getOperation,countsOperation,categoriesOperation,readOperation,readAllOperation]};export{notificationDomain};
|
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
4
|
-
|
|
3
|
+
import{activateModeFiles,activatePermissionSettings,buildResidentSet,buildSystemPrompt,createAuditLogger,createTwpToolkit,currentBranch,displayCwd,residentInputs,runTurn}from"./chunk-OK4ITT5Y.js";import"./chunk-NZ7WI4RZ.js";import"./chunk-YVAN3H5W.js";import"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import"./chunk-GMBJTG6A.js";import{RelayError,createRuntime,pickModel}from"./chunk-PWXXCLVZ.js";import"./chunk-D233KKXW.js";import"./chunk-XNLIEUAW.js";
|
|
4
|
+
import"./chunk-J7QYPKVK.js";import{checkMinSupportedVersion,enforceMinSupportedVersion,floorNeedsRefresh}from"./chunk-DXXFUNYN.js";import"./chunk-4VZKNEVN.js";import{getMode}from"./chunk-NAUH75MM.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-N2UVRM3Z.js";import"./chunk-II5RVJQN.js";import"./chunk-7WSNIXTQ.js";import"./chunk-PMOUHEJQ.js";import"./chunk-RZVI6PMW.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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{STATUS_VALUES,booleanQuery,flatMasterDomain}from"./chunk-
|
|
4
|
-
import"./chunk-
|
|
3
|
+
import{STATUS_VALUES,booleanQuery,flatMasterDomain}from"./chunk-V4UGLDEH.js";import"./chunk-UDPJ2IGK.js";import{POSITIONS_PATH}from"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import"./chunk-GMBJTG6A.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";import"./chunk-ZN5EFDH7.js";import"./chunk-ZWVYVS2A.js";import"./chunk-7WSNIXTQ.js";
|
|
4
|
+
import"./chunk-RZVI6PMW.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
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
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
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\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{collapsesInUrlPath,safeProjectIdPolicy}from"./chunk-GMBJTG6A.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-G4OO4M44.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,4 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{CURATED_PAGING_VOCABULARY,buildPrepareContext,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain}from"./chunk-RDS6IJDZ.js";import"./chunk-KAP6IM5C.js";import"./chunk-GDM2QUBL.js";import"./chunk-5Q2CH4E7.js";import"./chunk-YVAN3H5W.js";import"./chunk-IOGVQVGD.js";import"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import"./chunk-GMBJTG6A.js";import"./chunk-TAN5I2DP.js";import"./chunk-XNLIEUAW.js";
|
|
4
|
+
import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-WBAEUHJB.js";import"./chunk-QQRJLH6B.js";import"./chunk-K2ONOH3L.js";import"./chunk-WVS4W5FY.js";import"./chunk-NHYMHCAT.js";import"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";import"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.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-
|
|
3
|
+
import{REQUIRE_ZERO_STATUS,ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,parseTs}from"./chunk-RFBFR567.js";import"./chunk-QWSXHHFT.js";import"./chunk-J7QYPKVK.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-GY7KI5E5.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-
|
|
3
|
+
import{LoopSettingsApplier,PROMPT_KEYS,formatConfigHash,parseServerSettings,renderStepBudget}from"./chunk-VDP6DKOM.js";import"./chunk-QWSXHHFT.js";import"./chunk-J7QYPKVK.js";import"./chunk-NHYMHCAT.js";import"./chunk-Y2XAWM2X.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import"./chunk-VSJBJXZO.js";export{LoopSettingsApplier,PROMPT_KEYS,formatConfigHash,parseServerSettings,renderStepBudget};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{ServerSkillCatalog,expandServerSkills,formatSkillOrigins,parseSkillBody,parseSkillList,prepareSkillOverlay,referencedSkills,stripFrontmatter}from"./chunk-
|
|
3
|
+
import{ServerSkillCatalog,expandServerSkills,formatSkillOrigins,parseSkillBody,parseSkillList,prepareSkillOverlay,referencedSkills,stripFrontmatter}from"./chunk-ONTK2FR4.js";import"./chunk-VK2Z4QGC.js";import"./chunk-P4AEFKLM.js";import"./chunk-VRBI2NPI.js";import"./chunk-QWSXHHFT.js";import"./chunk-J7QYPKVK.js";import"./chunk-NHYMHCAT.js";import"./chunk-GY7KI5E5.js";import"./chunk-7WSNIXTQ.js";import"./chunk-VSJBJXZO.js";export{ServerSkillCatalog,expandServerSkills,formatSkillOrigins,parseSkillBody,parseSkillList,prepareSkillOverlay,referencedSkills,stripFrontmatter};
|
|
@@ -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{
|
|
3
|
+
import{detectAiClis,formatDetection,isDetectableAi,isSelectable}from"./chunk-5PU5QU5U.js";import{PromptAbortedError,promptText}from"./chunk-L37NS5L2.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import{localConfigPath,parseClaudeLauncher}from"./chunk-JXIIXUAO.js";import"./chunk-N2UVRM3Z.js";import{AiConfig}from"./chunk-Y2XAWM2X.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import"./chunk-RZVI6PMW.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));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{PROJECT_FLAG,TASK_REF_FLAG,TASK_REF_HELP,classifyTaskRef,rejectPrivateSurface,rejectRedundantProject,resolveTaskLocation,taskAttachmentResource,taskSurface,wantsPrivateSurface}from"./chunk-
|
|
4
|
-
|
|
5
|
-
import"./chunk-
|
|
3
|
+
import{PROJECT_FLAG,TASK_REF_FLAG,TASK_REF_HELP,classifyTaskRef,rejectPrivateSurface,rejectRedundantProject,resolveTaskLocation,taskAttachmentResource,taskSurface,wantsPrivateSurface}from"./chunk-FJESEWMF.js";import{charCount,readBody}from"./chunk-HGTG5XQ7.js";import{repeatedValues}from"./chunk-IOGVQVGD.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-V4UGLDEH.js";import{boundedText,decimal,isoDate,priority}from"./chunk-UDPJ2IGK.js";import{PRIVATE_TASKS_PATH,
|
|
4
|
+
TASK_MASTERS}from"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import{UUID_RE,isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-DDKZ5IPT.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import{PRIVATE_PROJECT_REF}from"./chunk-GY7KI5E5.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";
|
|
5
|
+
import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import{acknowledgement,isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.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
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(
|
|
7
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!==
|
|
8
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(
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{fetchLatestVersion,isBehindLatest,runUpdate}from"./chunk-REPGG75N.js";import"./chunk-PWXXCLVZ.js";import"./chunk-D233KKXW.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-2NKVGAAE.js";import"./chunk-DXXFUNYN.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";export{fetchLatestVersion,isBehindLatest,runUpdate};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{repeatedValues}from"./chunk-IOGVQVGD.js";import{createFlags,fieldBody,hasAnyField,resolveRefFields,updateFlags}from"./chunk-
|
|
4
|
-
import
|
|
5
|
-
import"./chunk-VSJBJXZO.js";import fs3 from"fs";import fs from"fs";var BOM=new RegExp(`^${String.fromCharCode(65279)}`);function decodeCsvText(bytes){try{return new TextDecoder("utf-8",{fatal:true}).decode(bytes).replace(BOM,"")}catch{return new TextDecoder("shift_jis").decode(bytes)}}function readCsvFileText(file,usage,maxBytes,tooLarge){try{const stat=fs.statSync(file);if(!stat.isFile())throw new UsageError(`--file \u306B\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u4EE5\u5916\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093: ${file}`,usage);if(stat.size>maxBytes)
|
|
3
|
+
import{repeatedValues}from"./chunk-IOGVQVGD.js";import{createFlags,fieldBody,hasAnyField,resolveRefFields,updateFlags}from"./chunk-V4UGLDEH.js";import{booleanText,boundedText,isoDate,isoDateValue}from"./chunk-UDPJ2IGK.js";import{USER_REF_FLAG,USER_REF_HELP,prepareUser,userPath}from"./chunk-2M2JQ23W.js";import{DEPARTMENTS_PATH,ORG_MASTER_LIMIT,POSITIONS_PATH}from"./chunk-LON7FN5A.js";import{ApiError}from"./chunk-FTYJZFEK.js";import{ResolveError,isSafePathSegment}from"./chunk-GMBJTG6A.js";
|
|
4
|
+
import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,flagSegment,nonEmpty,positiveInteger,shellQuote}from"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import{isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";
|
|
5
|
+
import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";import fs3 from"fs";import fs from"fs";var BOM=new RegExp(`^${String.fromCharCode(65279)}`);function decodeCsvText(bytes){try{return new TextDecoder("utf-8",{fatal:true}).decode(bytes).replace(BOM,"")}catch{return new TextDecoder("shift_jis").decode(bytes)}}function readCsvFileText(file,usage,maxBytes,tooLarge){try{const stat=fs.statSync(file);if(!stat.isFile())throw new UsageError(`--file \u306B\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u4EE5\u5916\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093: ${file}`,usage);if(stat.size>maxBytes)
|
|
6
6
|
throw tooLarge(stat.size);return decodeCsvText(fs.readFileSync(file))}catch(err){if(err instanceof UsageError)throw err;const reason=err.code??err.message;throw new UsageError(`--file \u306E\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u3081\u307E\u305B\u3093: ${file}\uFF08${reason}\uFF09`,usage)}}var ASSIGNMENT_COLUMNS=["id","department_name","position_name","start_date","end_date","is_primary","is_current","is_approval_route","effective_status"];function assignmentRows(body){const response=isRecord(body)&&"response"in body?body["response"]:body;const list=isRecord(response)?response["list"]:void 0;if(!Array.isArray(list)){throw new ApiResponseError("\u6240\u5C5E\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")}
|
|
7
7
|
return list}async function nameMap(ctx,path,label2){try{const body=await ctx.send({method:"GET",path,query:{limit:ORG_MASTER_LIMIT}});const list=isRecord(body)?body["list"]:void 0;if(!Array.isArray(list))throw new Error(`${label2}\u4E00\u89A7\u306E\u5FDC\u7B54\u306B list \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093`);const count=isRecord(body)?body["count"]:void 0;if(typeof count==="number"&&count>list.length){ctx.warn(`${label2}\u4E00\u89A7\u304C ${count} \u4EF6\u4E2D ${list.length} \u4EF6\u3067\u5207\u308A\u8A70\u3081\u3089\
|
|
8
8
|
\u308C\u305F\u305F\u3081\u3001\u4E00\u90E8\u306E${label2}\u540D\u306F\u7A7A\u6B04\u3067\u3059\u3002ID \u306F --output json \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002`)}const map={};for(const row of list){if(isRecord(row)&&typeof row["id"]==="string"&&typeof row["name"]==="string"){map[row["id"]]=row["name"]}}return map}catch(err){ctx.warn(`${label2}\u540D\u3092\u53D6\u5F97\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001${label2}\u540D\u306E\u5217\u306F\u7A7A\u6B04\u3067\u3059\uFF08${err.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{WORKFLOWS_PATH}from"./chunk-LON7FN5A.js";import"./chunk-FTYJZFEK.js";import{UUID_RE,isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-NHYMHCAT.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-G4OO4M44.js";import"./chunk-II5RVJQN.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import{isRecord,pick}from"./chunk-ZWVYVS2A.js";
|
|
4
|
+
import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";var WORKFLOW_FLAG={name:"--workflow",summary:"\u7533\u8ACB\u66F8\uFF08\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\uFF09\u306E\u540D\u524D\u304B ID \u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC>"};var CATEGORIES={undefined:"\u6C4E\u7528",paid_holiday:"\u6709\u7D66\u4F11\u6687",substitute_holiday:"\u632F\u66FF\u4F11\u6687",comp_holiday:"\u4EE3\u4F11",absence:"\u6B20\u52E4",special_holiday:"\u7279\u5225\u4F11\u6687",other_leave:"\u305D\u306E\u4ED6\u4F11\u6687\u30FB\u6B20\u52E4",
|
|
5
|
+
sales:"\u53D6\u5F15",commuting_expenses:"\u901A\u52E4\u4EA4\u901A\u8CBB",cms_publish:"\u30B3\u30F3\u30C6\u30F3\u30C4\u516C\u958B",equipment_lending:"\u5099\u54C1\u8CB8\u51FA",ai_tool_license:"AI\u30C4\u30FC\u30EB\u30E9\u30A4\u30BB\u30F3\u30B9",qualification_bonus:"\u5408\u683C\u304A\u795D\u3044\u91D1"};var CATEGORY_HELP=`\u30AB\u30C6\u30B4\u30EA: ${Object.entries(CATEGORIES).map(([key,label])=>`${key}\uFF08${label}\uFF09`).join(" / ")}`;var WORKFLOW_STATUSES=["active","inactive","draft"];var INSTANCE_STATUSES=[
|
|
6
|
+
"new","in_progress","approved","rejected","canceled","sent_back"];var INSTANCE_STATUS_HELP="\u72B6\u614B: new\uFF08\u4E0B\u66F8\u304D\uFF09/ in_progress\uFF08\u627F\u8A8D\u5F85\u3061\uFF09/ approved\uFF08\u627F\u8A8D\u6E08\u307F\uFF09/ rejected\uFF08\u5374\u4E0B\uFF09/ canceled\uFF08\u53D6\u6D88\uFF09/ sent_back\uFF08\u5DEE\u3057\u623B\u3057\uFF09";var WORKFLOW_COLUMNS=["id","name","defined_category","status","is_hidden","valid_from","valid_to"];var WORKFLOW_ADMIN_COLUMNS=[...WORKFLOW_COLUMNS,"s\
|
|
7
|
+
tep_count"];var WORKFLOW_GET_COLUMNS=["id","name","defined_category","status","is_hidden","valid_from","valid_to","description"];var INSTANCE_COLUMNS=["id","title","workflow_name","status","current_step_no","applicant_name","applied_at","completed_at"];var INSTANCE_GET_COLUMNS=["id","title","workflow_id","workflow_name","status","current_step_no","applicant_name","applied_at","completed_at","can_approve","is_editable","is_cancelable"];var PENDING_COLUMNS=["id","title","workflow_name","applicant_\
|
|
8
|
+
name","current_step_no","applied_at","delegated_from_user_id"];var INSTANCES_PATH=`${WORKFLOWS_PATH}/instances`;function enumFlag(input,flag,values,help){const raw=nonEmpty(input.flags,flag);if(raw===void 0)return void 0;const value=raw.trim();if(!values.includes(value)){throw new UsageError(`${flag} \u306B\u6307\u5B9A\u3067\u304D\u306A\u3044\u5024\u3067\u3059: ${raw}`,help)}return value}function category(input){return enumFlag(input,"--category",Object.keys(CATEGORIES),CATEGORY_HELP)}function noArgs(input,usage){
|
|
9
|
+
if(input.args.length>0){throw new UsageError(`\u4F4D\u7F6E\u5F15\u6570\u306F\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,usage)}}function listRows(body,label){const list=isRecord(body)?body["list"]:void 0;if(!Array.isArray(list)){throw new ApiResponseError(`${label}\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`)}return list}function objectOf(body,key,label){
|
|
10
|
+
const value=isRecord(body)?body[key]:void 0;if(!isRecord(value)){throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u306B ${key} \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return value}function idPath(base,id,label){if(!isSafePathSegment(id)){throw new ApiResponseError(`\u30B5\u30FC\u30D0\u304C\u8FD4\u3057\u305F${label} ID \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${id}\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
|
|
11
|
+
return`${base}/${encodeURIComponent(id)}`}async function workflowId(ref,ctx,flag){return UUID_RE.test(ref)?ref:(await ctx.resolver.workflow(ref,flag)).id}function countNote(rows,what){return[`${what}: ${String(rows.length)} \u4EF6`]}var LIST_USAGE="twp workflow list [--status <active|inactive|draft>] [--category <\u30AB\u30C6\u30B4\u30EA>]";var GET_USAGE="twp workflow get <\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC>";var APPLICABLE_USAGE="twp workflow applicable [--category <\u30AB\u30C6\u30B4\u30EA>]";
|
|
12
|
+
var workflowOperations=[{name:"list",summary:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\uFF08\u7533\u8ACB\u66F8\uFF09\u306E\u5B9A\u7FA9\u3092\u4E00\u89A7\u3059\u308B\uFF08\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306E\u7BA1\u7406\u8005\uFF09",usage:LIST_USAGE,description:`GET /api/v2/workflows \u3092\u8868\u793A\u3057\u307E\u3059\uFF08\u975E\u8868\u793A\u30FB\u7121\u52B9\u3092\u542B\u3080\u30C6\u30CA\u30F3\u30C8\u306E\u5168\u7533\u8ACB\u66F8\uFF09\u3002
|
|
13
|
+
\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u8AAD\u3081\u307E\u3059\u3002\u81EA\u5206\u304C\u7533\u8ACB\u3067\u304D\u308B\u7533\u8ACB\u66F8\u306F twp workflow applicable \u3067\u898B\u3089\u308C\u307E\u3059\u3002
|
|
14
|
+
${CATEGORY_HELP}
|
|
15
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08\u627F\u8A8D\u8005\u30FB\u5BFE\u8C61\u8005\u306E\u6761\u4EF6\u3092\u542B\u3080\uFF09\u3092\u51FA\u3057\u307E\u3059\u3002`,flags:[{name:"--status",summary:"\u72B6\u614B\u3067\u7D5E\u308A\u8FBC\u3080\uFF08active: \u6709\u52B9 / inactive: \u7121\u52B9 / draft: \u4E0B\u66F8\u304D\uFF09",takesValue:true,placeholder:"<\u72B6\u614B>"},{name:"--category",summary:"\u30AB\u30C6\u30B4\u30EA\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,
|
|
16
|
+
placeholder:"<\u30AB\u30C6\u30B4\u30EA>"}],plan(input){noArgs(input,LIST_USAGE);return{method:"GET",path:WORKFLOWS_PATH,query:{status:enumFlag(input,"--status",WORKFLOW_STATUSES,"\u72B6\u614B: active\uFF08\u6709\u52B9\uFF09/ inactive\uFF08\u7121\u52B9\uFF09/ draft\uFF08\u4E0B\u66F8\u304D\uFF09"),category:category(input)}}},summarize:body=>listRows(body,"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u4E00\u89A7").map(row=>pick(row,WORKFLOW_ADMIN_COLUMNS)),raw:body=>listRows(body,"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u4E00\u89A7"),
|
|
17
|
+
notes:body=>countNote(listRows(body,"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u4E00\u89A7"),"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC"),forbidden:"\u6A29\u9650\u304C\u8DB3\u308A\u307E\u305B\u3093\u3002\u7533\u8ACB\u66F8\u306E\u5B9A\u7FA9\u306E\u4E00\u89A7\u306F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u898B\u3089\u308C\u307E\u3059\u3002\u81EA\u5206\u304C\u7533\u8ACB\u3067\u304D\u308B\u7533\u8ACB\u66F8\u306F twp workflow applicable \u3067\u898B\u3089\u308C\u307E\u3059"},
|
|
18
|
+
{name:"get",summary:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\uFF08\u7533\u8ACB\u66F8\uFF091\u4EF6\u306E\u5B9A\u7FA9\u3092\u8868\u793A\u3059\u308B\uFF08\u627F\u8A8D\u306E\u6BB5\u30FB\u5165\u529B\u9805\u76EE\u3092\u542B\u3080\uFF09",usage:GET_USAGE,description:"<\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC> \u306F\u7533\u8ACB\u66F8\u306E\u540D\u524D\u304B ID\uFF08UUID\uFF09\u3067\u3059\u3002\u540D\u524D\u306F\u81EA\u5206\u304C\u7533\u8ACB\u3067\u304D\u308B\u7533\u8ACB\u66F8\u304B\u3089\u5B8C\u5168\u4E00\u81F4\u3067\u63A2\u3057\u307E\u3059\n\uFF08\u7533\u8ACB\u3067\u304D\u306A\u3044\u7533\u8ACB\u66F8\u306F ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002ID \u306F twp workflow list / instance list \u3067\u5206\u304B\u308A\u307E\u3059\uFF09\u3002\n--output table / text / tsv \u306F\u8981\u7D04\u5217\u3067\u3001\u627F\u8A8D\u306E\u6BB5\u306E\u6570\u3068\u5165\u529B\u9805\u76EE\u306E\u6570\u306F stderr \u306B\u51FA\u3057\u307E\u3059\u3002\n--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08steps\u30FBform_definition \
|
|
19
|
+
\u3092\u542B\u3080\uFF09\u3092\u51FA\u3057\u307E\u3059\u3002",flags:[],async prepare(input,ctx){const ref=singleRef(input,{flag:"<\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC>",label:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC",usage:GET_USAGE});return withResolved(input,{workflowId:await workflowId(ref,ctx,"<\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC>")})},plan:input=>({method:"GET",path:idPath(WORKFLOWS_PATH,requireResolved(input,"workflowId"),"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC")}),summarize:body=>pick(objectOf(
|
|
20
|
+
body,"workflow","\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u8A73\u7D30"),WORKFLOW_GET_COLUMNS),raw:body=>objectOf(body,"workflow","\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u8A73\u7D30"),notes(body){const workflow=objectOf(body,"workflow","\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u8A73\u7D30");const steps=Array.isArray(workflow["steps"])?workflow["steps"].length:null;const form=isRecord(workflow["form_definition"])?workflow["form_definition"]["form_column_list"]:void 0;const fields=Array.isArray(form)?form.length:
|
|
21
|
+
null;return[`\u627F\u8A8D\u306E\u6BB5: ${steps===null?"\u4E0D\u660E":`${String(steps)} \u6BB5`}\u30FB\u5165\u529B\u9805\u76EE: ${fields===null?"\u4E0D\u660E":`${String(fields)} \u9805\u76EE`}\uFF08\u5168\u9805\u76EE\u306F --output json \u306E steps / form_definition\uFF09`]}},{name:"applicable",summary:"\u81EA\u5206\u304C\u7533\u8ACB\u3067\u304D\u308B\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\uFF08\u7533\u8ACB\u66F8\uFF09\u3092\u4E00\u89A7\u3059\u308B",usage:APPLICABLE_USAGE,description:`GET /api/v2/w\
|
|
22
|
+
orkflows/applicable\uFF08--category \u304C\u3042\u308C\u3070 applicable/{category}\uFF09\u3092\u8868\u793A\u3057\u307E\u3059\u3002
|
|
23
|
+
--category \u7121\u3057\u3067\u306F\u975E\u8868\u793A\u306E\u7533\u8ACB\u66F8\u306F\u51FA\u307E\u305B\u3093\u3002--category \u3092\u4ED8\u3051\u308B\u3068\u975E\u8868\u793A\u306E\u7533\u8ACB\u66F8\u3082\u51FA\u307E\u3059
|
|
24
|
+
\uFF08\u6709\u7D66\u4F11\u6687\u306A\u3069\u306E\u7533\u8ACB\u66F8\u306F\u3001\u753B\u9762\u306E\u5225\u30E1\u30CB\u30E5\u30FC\u304B\u3089\u4F7F\u3046\u305F\u3081\u975E\u8868\u793A\u306B\u306A\u3063\u3066\u3044\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\uFF09\u3002
|
|
25
|
+
${CATEGORY_HELP}
|
|
26
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002`,flags:[{name:"--category",summary:"\u30AB\u30C6\u30B4\u30EA\u306E\u7533\u8ACB\u66F8\u3060\u3051\u3092\u51FA\u3059\uFF08\u975E\u8868\u793A\u3082\u542B\u3080\uFF09",takesValue:true,placeholder:"<\u30AB\u30C6\u30B4\u30EA>"}],plan(input){noArgs(input,APPLICABLE_USAGE);const value=category(input);return{method:"GET",path:value===void 0?`${WORKFLOWS_PATH}/applicable`:`${WORKFLOWS_PATH}/\
|
|
27
|
+
applicable/${encodeURIComponent(value)}`}},summarize:body=>listRows(body,"\u7533\u8ACB\u3067\u304D\u308B\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC").map(row=>pick(row,WORKFLOW_COLUMNS)),raw:body=>listRows(body,"\u7533\u8ACB\u3067\u304D\u308B\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC"),notes:body=>countNote(listRows(body,"\u7533\u8ACB\u3067\u304D\u308B\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC"),"\u7533\u8ACB\u3067\u304D\u308B\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC")}];var INSTANCE_LIST_USAGE="twp workflow instance l\
|
|
28
|
+
ist [--workflow <\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC>] [--status <\u72B6\u614B>] [--all] [--limit <\u4EF6\u6570>] [--cursor <\u30AB\u30FC\u30BD\u30EB>]";var INSTANCE_GET_USAGE="twp workflow instance get <\u7533\u8ACBID>";var HISTORY_USAGE="twp workflow instance history [--workflow <\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC>] [--status <\u72B6\u614B>] [--keyword <\u8A9E>] [--all] [--limit <\u4EF6\u6570>] [--cursor <\u30AB\u30FC\u30BD\u30EB>]";var instancePaging=envelopePaging({label:"\u7533\u8ACB\u4E00\u89A7"});
|
|
29
|
+
var historyPaging=envelopePaging({label:"\u627F\u8A8D\u5C65\u6B74"});var STATUS_FLAG={name:"--status",summary:"\u7533\u8ACB\u306E\u72B6\u614B\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u72B6\u614B>"};async function prepareWorkflowFilter(input,ctx){instanceStatus(input);const ref=nonEmpty(input.flags,WORKFLOW_FLAG.name);if(ref===void 0)return input;return withResolved(input,{workflowId:await workflowId(ref.trim(),ctx,WORKFLOW_FLAG.name)})}function instanceStatus(input){return enumFlag(
|
|
30
|
+
input,"--status",INSTANCE_STATUSES,INSTANCE_STATUS_HELP)}function workflowFilter(input){return input.flags.has(WORKFLOW_FLAG.name)?requireResolved(input,"workflowId"):void 0}var instanceResource={name:"instance",summary:"\u7533\u8ACB\uFF08\u81EA\u5206\u306E\u7533\u8ACB\u306E\u4E00\u89A7\u30FB1\u4EF6\u306E\u8A73\u7D30\u30FB\u627F\u8A8D\u5C65\u6B74\uFF09",operations:[{name:"list",summary:"\u81EA\u5206\u304C\u51FA\u3057\u305F\u7533\u8ACB\u3092\u4E00\u89A7\u3059\u308B",usage:INSTANCE_LIST_USAGE,description:`\
|
|
31
|
+
GET /api/v2/workflows/instances \u3092\u8868\u793A\u3057\u307E\u3059\uFF08\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u308B\u672C\u4EBA\u304C\u7533\u8ACB\u8005\u306E\u3082\u306E\u3002\u4E0B\u66F8\u304D\u3092\u542B\u3080\uFF09\u3002
|
|
32
|
+
--workflow \u306F\u7533\u8ACB\u66F8\u306E\u540D\u524D\u304B ID\uFF08UUID\uFF09\u3067\u3059\u3002\u540D\u524D\u306F\u81EA\u5206\u304C\u7533\u8ACB\u3067\u304D\u308B\u7533\u8ACB\u66F8\u304B\u3089\u5B8C\u5168\u4E00\u81F4\u3067\u63A2\u3057\u307E\u3059\u3002
|
|
33
|
+
${INSTANCE_STATUS_HELP}
|
|
34
|
+
\u7D5E\u308A\u8FBC\u307F\u306F\u30B5\u30FC\u30D0\u304C\u8AAD\u3093\u3060\u3042\u3068\u306B\u639B\u304B\u308B\u305F\u3081\u30011\u30DA\u30FC\u30B8\u304C --limit \u3088\u308A\u5C11\u306A\u304F\u8FD4\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\uFF08\u7D9A\u304D\u306F --all \u3067\u8FBF\u308C\u307E\u3059\uFF09\u3002
|
|
35
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08form_data \u3092\u542B\u3080\uFF09\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
36
|
+
|
|
37
|
+
`+LIST_PAGING_HELP,flags:[...LIST_FLAGS,WORKFLOW_FLAG,STATUS_FLAG],paging:instancePaging,prepare:prepareWorkflowFilter,plan(input){noArgs(input,INSTANCE_LIST_USAGE);return{method:"GET",path:INSTANCES_PATH,query:{limit:positiveInteger(input.flags,"--limit"),cursor:nonEmpty(input.flags,"--cursor"),workflow_id:workflowFilter(input),status:instanceStatus(input)}}},summarize:body=>instancePaging.items(body).map(row=>pick(row,INSTANCE_COLUMNS)),raw:body=>instancePaging.items(body)},{name:"get",summary:"\
|
|
38
|
+
\u7533\u8ACB1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u627F\u8A8D\u306E\u7D4C\u904E\u3092\u542B\u3080\uFF09",usage:INSTANCE_GET_USAGE,description:"GET /api/v2/workflows/instances/{id} \u3092\u8868\u793A\u3057\u307E\u3059\u3002<\u7533\u8ACBID> \u306F UUID \u3067\u3059\uFF08twp workflow instance list \u3067\u5206\u304B\u308A\u307E\u3059\uFF09\u3002\n\u898B\u3089\u308C\u308B\u306E\u306F\u3001\u81EA\u5206\u306E\u7533\u8ACB\u30FB\u81EA\u5206\u304C\u627F\u8A8D\u8005\u306E\u7533\u8ACB\u30FB\u95B2\u89A7\u3092\u8A31\u3055\u308C\u305F\u7533\u8ACB\u3060\u3051\u3067\u3059\uFF08\u7121\u3051\u308C\u3070\u7D42\u4E86\u30B3\u30FC\u30C9 3\uFF09\u3002\n--output table / text / tsv \u306F\u8981\u7D04\u5217\u3067\u3001\u627F\u8A8D\u306E\u7D4C\u904E\uFF08step_history\uFF09\u306E\u4EF6\u6570\u306F stderr \u306B\u51FA\u3057\u307E\u3059\u3002\n--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08form_data\u30FBstep_history\u30FBworkflow_steps \u3092\u542B\u3080\uFF09\u3092\u51FA\u3057\u307E\u3059\u3002",
|
|
39
|
+
flags:[],plan(input){const id=singleRef(input,{flag:"<\u7533\u8ACBID>",label:"\u7533\u8ACBID",usage:INSTANCE_GET_USAGE});if(!UUID_RE.test(id)){throw new UsageError(`\u7533\u8ACBID \u306F UUID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${id}`,INSTANCE_GET_USAGE)}return{method:"GET",path:`${INSTANCES_PATH}/${encodeURIComponent(id)}`}},summarize:body=>pick(objectOf(body,"instance","\u7533\u8ACB\u8A73\u7D30"),INSTANCE_GET_COLUMNS),raw:body=>objectOf(body,"instance","\u7533\u8ACB\u8A73\u7D30"),
|
|
40
|
+
notes(body){const instance=objectOf(body,"instance","\u7533\u8ACB\u8A73\u7D30");const history=Array.isArray(instance["step_history"])?instance["step_history"].length:null;const notes=[`\u627F\u8A8D\u306E\u7D4C\u904E: ${history===null?"\u4E0D\u660E":`${String(history)} \u4EF6`}\uFF08\u5168\u9805\u76EE\u306F --output json \u306E step_history\uFF09`];if(typeof instance["approval_blocked_reason"]==="string"&&instance["approval_blocked_reason"]!==""){notes.push(`\u627F\u8A8D\u3067\u304D\u306A\u3044\u7406\u7531: ${instance["\
|
|
41
|
+
approval_blocked_reason"]}`)}return notes},forbidden:"\u6A29\u9650\u304C\u8DB3\u308A\u307E\u305B\u3093\u3002\u898B\u3089\u308C\u308B\u306E\u306F\u3001\u81EA\u5206\u306E\u7533\u8ACB\u30FB\u81EA\u5206\u304C\u627F\u8A8D\u8005\u306E\u7533\u8ACB\u30FB\u95B2\u89A7\u3092\u8A31\u3055\u308C\u305F\u7533\u8ACB\u3060\u3051\u3067\u3059"},{name:"history",summary:"\u627F\u8A8D\u5C65\u6B74\uFF08\u81EA\u5206\u304C\u7533\u8ACB\u3057\u305F\u30FB\u627F\u8A8D\u306B\u95A2\u308F\u3063\u305F\u7533\u8ACB\uFF09\u3092\u4E00\u89A7\u3059\u308B",
|
|
42
|
+
usage:HISTORY_USAGE,description:`GET /api/v2/workflows/history \u3092\u8868\u793A\u3057\u307E\u3059\u3002\u4E0B\u66F8\u304D\u306F\u51FA\u307E\u305B\u3093\u3002
|
|
43
|
+
\u30C6\u30CA\u30F3\u30C8\u306E\u7BA1\u7406\u8005\u306F\u30C6\u30CA\u30F3\u30C8\u5185\u306E\u5168\u7533\u8ACB\u3001\u305D\u308C\u4EE5\u5916\u306F\u81EA\u5206\u304C\u7533\u8ACB\u8005\u304B\u627F\u8A8D\u306E\u64CD\u4F5C\u3092\u3057\u305F\u7533\u8ACB\u3067\u3059\u3002
|
|
44
|
+
--workflow \u306F\u7533\u8ACB\u66F8\u306E\u540D\u524D\u304B ID\uFF08UUID\uFF09\u3001--keyword \u306F\u30BF\u30A4\u30C8\u30EB\u7B49\u306E\u8A9E\u3067\u7D5E\u308A\u8FBC\u307F\u307E\u3059\u3002
|
|
45
|
+
${INSTANCE_STATUS_HELP}
|
|
46
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
47
|
+
|
|
48
|
+
`+LIST_PAGING_HELP,flags:[...LIST_FLAGS,WORKFLOW_FLAG,STATUS_FLAG,{name:"--keyword",summary:"\u30BF\u30A4\u30C8\u30EB\u7B49\u306E\u8A9E\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u8A9E>"}],paging:historyPaging,prepare:prepareWorkflowFilter,plan(input){noArgs(input,HISTORY_USAGE);return{method:"GET",path:`${WORKFLOWS_PATH}/history`,query:{limit:positiveInteger(input.flags,"--limit"),cursor:nonEmpty(input.flags,"--cursor"),workflow_id:workflowFilter(input),status:instanceStatus(
|
|
49
|
+
input),keyword:nonEmpty(input.flags,"--keyword")}}},summarize:body=>historyPaging.items(body).map(row=>pick(row,INSTANCE_COLUMNS)),raw:body=>historyPaging.items(body)}]};var PENDING_USAGE="twp workflow approval pending [--count]";function pendingCount(body){const count=isRecord(body)?body["count"]:void 0;if(typeof count!=="number"){throw new ApiResponseError("\u627F\u8A8D\u5F85\u3061\u4EF6\u6570\u306E\u5FDC\u7B54\u306B count \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
50
|
+
return count}var approvalResource={name:"approval",summary:"\u627F\u8A8D\uFF08\u81EA\u5206\u306E\u627F\u8A8D\u5F85\u3061\uFF09",operations:[{name:"pending",summary:"\u81EA\u5206\u304C\u627F\u8A8D\u3067\u304D\u308B\u627F\u8A8D\u5F85\u3061\u306E\u7533\u8ACB\u3092\u4E00\u89A7\u3059\u308B\uFF08--count \u3067\u4EF6\u6570\u3060\u3051\uFF09",usage:PENDING_USAGE,description:"GET /api/v2/workflows/approvals/pending\uFF08--count \u306A\u3089 approvals/pending/count\uFF09\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n\u81EA\u5206\u304C\u627F\u8A8D\u8005\u306E\u7533\u8ACB\u306B\u52A0\u3048\u3066\u3001\u4EE3\u7406\u627F\u8A8D\u3092\u4EFB\u3055\u308C\u305F\u7533\u8ACB\u3082\u51FA\u307E\u3059\uFF08delegated_from_us\
|
|
51
|
+
er_id \u304C\u59D4\u4EFB\u5143\uFF09\u3002\n--count \u306E --output json \u306F {count} \u3067\u3059\u3002\n\u627F\u8A8D\u30FB\u5374\u4E0B\u30FB\u5DEE\u3057\u623B\u3057\u306F CLI \u304B\u3089\u306F\u307E\u3060\u3067\u304D\u307E\u305B\u3093\uFF08\u753B\u9762\u304B\u3089\u884C\u3063\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",flags:[{name:"--count",summary:"\u4EF6\u6570\u3060\u3051\u3092\u51FA\u3059",takesValue:false}],plan(input){noArgs(input,PENDING_USAGE);return{method:"GET",path:`${WORKFLOWS_PATH}\
|
|
52
|
+
/approvals/pending${input.flags.has("--count")?"/count":""}`}},summarize:body=>isRecord(body)&&"count"in body&&!("list"in body)?{count:pendingCount(body)}:listRows(body,"\u627F\u8A8D\u5F85\u3061").map(row=>pick(row,PENDING_COLUMNS)),raw:body=>isRecord(body)&&"count"in body&&!("list"in body)?{count:pendingCount(body)}:listRows(body,"\u627F\u8A8D\u5F85\u3061"),notes:body=>isRecord(body)&&"count"in body&&!("list"in body)?[`\u627F\u8A8D\u5F85\u3061: ${String(pendingCount(body))} \u4EF6`]:countNote(listRows(
|
|
53
|
+
body,"\u627F\u8A8D\u5F85\u3061"),"\u627F\u8A8D\u5F85\u3061")}]};var workflowDomain={name:"workflow",summary:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\uFF08\u7533\u8ACB\u66F8\u306E\u5B9A\u7FA9\u30FB\u7533\u8ACB\u30FB\u627F\u8A8D\u5F85\u3061\uFF09\u306E\u53C2\u7167",operations:workflowOperations,subresources:[instanceResource,approvalResource]};export{workflowDomain};
|