@tocca-systems/twp-cli 0.129.0 → 0.131.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 +10 -0
- package/README.md +18 -5
- package/dist/{agent-KR74GXNL.js → agent-VMSL5KHC.js} +3 -3
- package/dist/{agent-loop-DDEL6F4B.js → agent-loop-UDVQKGDK.js} +1 -1
- package/dist/{api-command-M3HVHM2R.js → api-command-EAWLRSAA.js} +3 -3
- package/dist/{app-CNQTQNVI.js → app-K27D2NEW.js} +4 -4
- package/dist/{auto-update-worker-26OZDLQ7.js → auto-update-worker-CB52KUTF.js} +2 -2
- package/dist/{brief-2JDLQOYS.js → brief-5RAVUYUW.js} +2 -2
- package/dist/{chunk-2LFYNWTT.js → chunk-3F7AKTXL.js} +1 -1
- package/dist/{chunk-65SBCDVQ.js → chunk-3TZ2S5D7.js} +1 -1
- package/dist/{chunk-JS55SZ6W.js → chunk-5WU3VNZJ.js} +1 -1
- package/dist/{chunk-7OFY7D4W.js → chunk-G2GFWPV6.js} +2 -2
- package/dist/{chunk-3OKJGOSM.js → chunk-G3LESKAB.js} +1 -1
- package/dist/{chunk-XNLIEUAW.js → chunk-GWVREACM.js} +2 -8
- package/dist/{chunk-NOUYMQNO.js → chunk-H2XVPFJL.js} +1 -1
- package/dist/chunk-ITFO5GPX.js +9 -0
- package/dist/{chunk-RPPT7CPR.js → chunk-JE4XL4ZK.js} +9 -9
- package/dist/{commands-ORKMSB6L.js → chunk-JHLJSHJ7.js} +7 -27
- package/dist/{chunk-NDJ27GG3.js → chunk-LZHNR537.js} +1 -1
- package/dist/{chunk-NFHQR7Y2.js → chunk-P2RWZXNJ.js} +1 -1
- package/dist/{chunk-XPZKSVGN.js → chunk-PAWD647P.js} +3 -3
- package/dist/{chunk-BE3KTK6C.js → chunk-QFVEHUPM.js} +1 -1
- package/dist/cli.js +10 -10
- package/dist/commands-KWQLHY2V.js +23 -0
- package/dist/commands-Q7GUXCYY.js +364 -0
- package/dist/{commands-W7Y5Z43U.js → commands-SBO7N6TG.js} +8 -8
- package/dist/{company-F3H523MI.js → company-HBNJ32PY.js} +3 -3
- package/dist/console-public-K5CP7KZJ.js +27 -0
- package/dist/{contract-23A4EYDW.js → contract-THZIHL3G.js} +2 -2
- package/dist/{corporate-5PC7K7PU.js → corporate-POQVWFKC.js} +3 -3
- package/dist/{estimate-K6VP4CN6.js → estimate-3CJGKIFQ.js} +2 -2
- package/dist/{invoice-HGZAW3CS.js → invoice-3U5BA3N5.js} +3 -2
- package/dist/{leave-J7PCTD7B.js → leave-ODNAVI3F.js} +2 -2
- package/dist/{media-3DK5TDMG.js → media-HC7EO62N.js} +3 -3
- package/dist/{oneshot-WDI2RR2Y.js → oneshot-GYXSX3VV.js} +3 -3
- package/dist/{plan-submit-WY6MIKFG.js → plan-submit-FWC3UUQD.js} +1 -1
- package/dist/{purchase-XFRGUNL3.js → purchase-NYI44K6P.js} +2 -2
- package/dist/{registry-XNB2FUTI.js → registry-6E7WSKHW.js} +1 -1
- package/dist/{run-4RB5VFDF.js → run-WWNWTKD7.js} +3 -3
- package/dist/{sales-ai-review-W2V5IIQ7.js → sales-ai-review-BKPJ7TSE.js} +3 -3
- package/dist/{sales-master-D3NPW3KR.js → sales-master-7WZ4VM3E.js} +1 -1
- package/dist/{slack-FUBJBT5W.js → slack-C6UJDHPZ.js} +9 -9
- package/dist/update-MQPXAW2C.js +3 -0
- package/dist/{user-P3ECD5TM.js → user-Y3IGTZDF.js} +2 -2
- package/dist/{worker-agent-YQL7CWG4.js → worker-agent-P3VHKVHE.js} +2 -2
- package/dist/{workflow-FRNUNSDR.js → workflow-MG4LJH3M.js} +2 -2
- package/package.json +1 -1
- package/dist/commands-EGNCVIYJ.js +0 -242
- package/dist/update-QGM225Q7.js +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
3
|
import{parseWaitOptions,waitUntilTerminal}from"./chunk-WVCEKC7V.js";import{charCount,readBody}from"./chunk-HEH3PUW2.js";import{repeatedValues}from"./chunk-VGT2EGH6.js";import{WORKER_AGENTS_PATH}from"./chunk-QV4K6V2L.js";import{ApiError}from"./chunk-SH2YLLVL.js";import{isSafePathSegment}from"./chunk-HVZUXLQ4.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";
|
|
4
|
-
import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,UsageError,WaitTimeoutError}from"./chunk-VFPY2A23.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-
|
|
4
|
+
import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,UsageError,WaitTimeoutError}from"./chunk-VFPY2A23.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-ITFO5GPX.js";var LABEL="\u30EF\u30FC\u30AB\u30FC\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8";var LIST_COLUMNS=["agent_id","name","is_enabled","schedule","next_run_at","last_run_status","last_run_at","owner_user_name"];var GET_COLUMNS=["agent_id","name","description","owner_user_name","is_enabled","schedule","next_run_at","is_running","last_run_status","last_run_at","last_run_id","allowed_tool_count","write_enabled","ai_model","consecutive_failure_count","auto_disabled_reason"];var TOOL_COLUMNS=["name","category","d\
|
|
5
5
|
isplay_name","is_mutating","is_available"];var TOOL_GET_COLUMNS=["name","category","display_name","description","is_mutating","is_destructive","is_available","required_feature","required_level","required_api_scopes"];var RUN_COLUMNS=["run_id","status","trigger","started_at","duration_ms","tool_call_count","consumed_credits","summary"];var RUN_GET_COLUMNS=["summary","status","skip_reason","error_code","error_message","run_id","agent_id","trigger","is_dry_run","started_at","finished_at","duration_\
|
|
6
6
|
ms","iteration_count","tool_call_count","mutation_count","consumed_credits","ai_model"];var STEP_COLUMNS=["step_no","type","tool_name","is_mutation","duration_ms","content","error_message"];var STEP_TYPES=["thinking","tool_call","tool_result","error","budget_warning","final_summary"];var FORBIDDEN="AI\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u6A5F\u80FD\u306E\u30E9\u30A4\u30BB\u30F3\u30B9\uFF08agent\uFF09\u304C\u3042\u306A\u305F\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u5272\u308A\u5F53\u3066\u3089\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4F7F\u3048\u307E\u305B\u3093\u3002\u30C6\u30CA\u30F3\u30C8\u306E\u7BA1\u7406\u8005\u306B\u30E9\u30A4\u30BB\u30F3\u30B9\u306E\u5272\u308A\u5F53\u3066\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002";
|
|
7
7
|
var AGENT_REF_HELP="<\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8> \u306F\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8 ID\uFF08twp worker-agent list \u306E agent_id \u5217\uFF09\u304B\u540D\u524D\u3067\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\n\u540D\u524D\u306F\u4E00\u89A7\u3068\u5B8C\u5168\u4E00\u81F4\u3067\u7167\u5408\u3057\u307E\u3059\uFF08\u540C\u540D\u304C\u8907\u6570\u3042\u308C\u3070\u5019\u88DC\u3092\u51FA\u3057\u3066\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002";function usageOf(op){return`twp worker-age\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{FORCE_FLAG,OUT_FLAG,REV_FLAG,revOf,singleId,uploadStaged}from"./chunk-
|
|
3
|
+
import{FORCE_FLAG,OUT_FLAG,REV_FLAG,revOf,singleId,uploadStaged}from"./chunk-G3LESKAB.js";import{CUSTOMER_LICENSE,childForbidden,levelForbidden}from"./chunk-PIUPLUW5.js";import{inspectLocalFile}from"./chunk-6FGR3U5C.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-53SHXSNB.js";import{SALES_ESTIMATES_PATH,isExactNumericId}from"./chunk-QV4K6V2L.js";import{nonEmpty}from"./chunk-MI6HVYR2.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";
|
|
4
4
|
import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import fs from"fs";import path from"path";var DOCUMENT_TYPES=["order_form","individual_contract","other"];var DOCUMENT_TYPE_HELP="order_form\uFF1D\u6CE8\u6587\u66F8 / individual_contract\uFF1D\u500B\u5225\u5951\u7D04\u66F8 / other\uFF1D\u305D\u306E\u4ED6\u6848\u4EF6\u66F8\u985E";var MAGIC_BYTES={pdf:["%PDF-"],jpg:["\xFF\xD8\xFF"],jpeg:["\xFF\xD8\xFF"],png:["\x89PNG\r\n\n"],xlsx:["PK","PK","PK\x07\b"],docx:["PK","PK","PK\x07\b"],xls:["\xD0\xCF\xE0\xA1\xB1\xE1"],doc:["\xD0\xCF\xE0\xA1\xB1\xE1"]};var FILE_NAME_MAX_CHARS=255;var FIELDS=[
|
|
5
5
|
{kind:"text",flag:"--name",key:"document_name",label:"\u66F8\u985E\u540D",maxChars:255,summary:"\u66F8\u985E\u540D\uFF08create \u3067\u306F\u5FC5\u9808\uFF09"},{kind:"enum",flag:"--type",key:"document_type",values:DOCUMENT_TYPES,summary:`\u66F8\u985E\u7A2E\u5225\uFF08${DOCUMENT_TYPE_HELP}\u30FBcreate \u3067\u306F\u5FC5\u9808\uFF09`}];var COLUMNS=["document_id","estimate_id","document_type","document_type_label","document_name","current_version","updated_by_name","updated_at"];var VERSION_COLUMNS=[
|
|
6
6
|
"version_number","file_name","file_size","is_current","created_by_name","created_at"];var ESTIMATE_FLAG={name:"--estimate",summary:"\u898B\u7A4D\u306E ID\uFF08twp estimate list \u306E id \u5217\u306E\u6570\u5B57\u30FB\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u898B\u7A4DID>"};var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30D5\u30A1\u30A4\u30EB\uFF08PDF\u30FBJPEG\u30FBPNG\u30FBWord\u30FBExcel\u3002\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{loadDomain}from"./chunk-
|
|
3
|
+
import{loadDomain}from"./chunk-JE4XL4ZK.js";import{evaluateQuery}from"./chunk-F5QDUPQO.js";import{renderDocument,renderOutput}from"./chunk-P4QSPSOQ.js";import{JsonBodyWithView}from"./chunk-Q3B65OFC.js";import{NO_REDACT_NOTICE,withCommonFlags}from"./chunk-W4NLJ2YK.js";import{redactSecretValues,redactSecrets,withDebug}from"./chunk-BD7O73GK.js";import{parseOperationArgs}from"./chunk-VGT2EGH6.js";import{Resolver,requireDefaultProject}from"./chunk-QV4K6V2L.js";
|
|
4
4
|
import{ApiError,MultipartBody,TwpApiClient,appendQuery}from"./chunk-SH2YLLVL.js";import{ResolveError}from"./chunk-HVZUXLQ4.js";import{DEFAULT_MAX_ITEMS,DEFAULT_MAX_PAGES,nextPageNotes,positiveInteger,shellQuote}from"./chunk-MI6HVYR2.js";import{isRecord}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,EXIT_API_CLIENT,EXIT_API_SERVER,EXIT_AUTH,EXIT_FAILURE,EXIT_OK,EXIT_USAGE,EXIT_WAIT_TIMEOUT,NetworkError,UsageError,WaitTimeoutError}from"./chunk-VFPY2A23.js";
|
|
5
|
-
import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{AuthSession,NotLoggedInError,SessionExpiredError
|
|
6
|
-
import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import fs from"fs";import path from"path";function alignedList(entries,indent=" "){const width=entries.reduce((max,[left])=>Math.max(max,stringWidth(left)),0);return entries.map(([left,right])=>`${indent}${left}${" ".repeat(Math.max(0,width-stringWidth(left)))} ${right}`).join("\n")}function subresourcesOf(resource){return resource.subresources??[]}function renderResourceHelp(resource,path2){const subresources=subresourcesOf(resource);const operationSection=resource.operations.length===0?"":`
|
|
5
|
+
import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{AuthSession,NotLoggedInError,SessionExpiredError}from"./chunk-ITFO5GPX.js";import{loadCredentials}from"./chunk-GWVREACM.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{effectiveApiUrl,loadUserConfig,resolveConfiguredBacklogSpace,resolveConfiguredOutput,resolveProfile}from"./chunk-EDF4U5BT.js";import{HELP_TOKEN}from"./chunk-ZN7AEXEI.js";import{OUTPUT_FORMATS,resolveOutputFormat}from"./chunk-RKBUJKI5.js";
|
|
6
|
+
import{stringWidth}from"./chunk-UREA4ZIG.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import fs from"fs";import path from"path";function alignedList(entries,indent=" "){const width=entries.reduce((max,[left])=>Math.max(max,stringWidth(left)),0);return entries.map(([left,right])=>`${indent}${left}${" ".repeat(Math.max(0,width-stringWidth(left)))} ${right}`).join("\n")}function subresourcesOf(resource){return resource.subresources??[]}function renderResourceHelp(resource,path2){const subresources=subresourcesOf(resource);const operationSection=resource.operations.length===0?"":`
|
|
7
7
|
\u64CD\u4F5C:
|
|
8
8
|
${alignedList(resource.operations.map(op=>[op.name,op.summary]))}
|
|
9
9
|
`;const subSection=subresources.length===0?"":`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
3
|
import{salesFeatureDenied}from"./chunk-RB74YCRT.js";import{featureLicenseGuidance}from"./chunk-57RI73JO.js";import{charCount,readBody}from"./chunk-HEH3PUW2.js";import{repeatedValues}from"./chunk-VGT2EGH6.js";import{isExactNumericId}from"./chunk-QV4K6V2L.js";import{ApiError}from"./chunk-SH2YLLVL.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";
|
|
4
|
-
import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,NetworkError,UsageError}from"./chunk-VFPY2A23.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-
|
|
4
|
+
import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,NetworkError,UsageError}from"./chunk-VFPY2A23.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-ITFO5GPX.js";var SALES_PATH="/api/v2/sales";var REASONS_PATH=`${SALES_PATH}/ai-review-reasons`;function documentForbidden(body){if(salesFeatureDenied(body))return featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406");const reason=body?.error;if(typeof reason==="string"&&reason.endsWith("\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093")){return`${reason}\uFF08\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u7D10\u3065\u304F\u66F8\u985E\u306F\u305D\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30E1\u30F3\u30D0\u30FC\u3001\u7D10\u3065\u304B\u306A\u3044\u66F8\u985E\u306F\u4F5C\u6210\u8005\u30FB\u62C5\u5F53\u8005\u3068\u7BA1\u7406\u8005\u3060\u3051\u304C\u6271\u3048\u307E\u3059\uFF09`}
|
|
5
5
|
return void 0}function reasonsForbidden(body){if(body?.error==="permission_denied")return featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406");return"\u7406\u7531\u306E\u6A2A\u65AD\u4E00\u89A7\u30FB\u6587\u6848\u751F\u6210\u30FBPR \u4F5C\u6210\u306F\u8CA9\u58F2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u4F7F\u3048\u307E\u3059\uFF08\u66F8\u985E\u3092\u8DE8\u3044\u3067\u7406\u7531\u3092\u8AAD\u3080\u305F\u3081\uFF09\u3002\u30C6\u30CA\u30F3\u30C8\u304C\u8CA9\u58F2\u7BA1\u7406\u3092\u5951\u7D04\u3057\u3066\u3044\u308B\u304B\u30FB\u3042\u306A\u305F\u306E\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u304B\u3092\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}
|
|
6
6
|
var ESTIMATE={name:"estimate",label:"\u898B\u7A4D",segment:"estimates"};var INVOICE={name:"invoice",label:"\u8ACB\u6C42",segment:"invoices"};var CONTRACT={name:"contract",label:"\u53D6\u5F15\u5951\u7D04",segment:"contracts"};var JUDGMENTS={no_issue:"\u78BA\u8A8D\u3057\u305F\u304C\u554F\u984C\u306A\u3044\u3068\u5224\u65AD\u3057\u305F",corrected:"\u6307\u6458\u3092\u53D7\u3051\u3066\u66F8\u985E\u3092\u4FEE\u6B63\u3057\u305F",not_applicable:"\u3053\u306E\u6848\u4EF6\u306B\u306F\u5F53\u3066\u306F\u307E\u3089\u306A\u3044\u6307\u6458\u3060\u3068\u5224\u65AD\u3057\u305F",
|
|
7
7
|
customer_agreed:"\u304A\u5BA2\u69D8\u3068\u500B\u5225\u306B\u8ABF\u6574\u3057\u5408\u610F\u6E08\u307F"};var AGREED_JUDGMENT="customer_agreed";var AGREED_WITH_MAX_CHARS=100;var REASON_MAX_CHARS=2e3;var LABEL_MAX_CHARS=255;var CRITERION_RE=/^[A-Za-z0-9_.:-]{1,128}$/;var MAX_REASONS=20;var DRAFT_MAX_CHARS=8e3;var TARGET_PREFIX="checklists/";var DEFAULT_TARGET="checklists/quality/estimation-billing-integrity-check.md";var WAIT_POLL_INTERVAL_MS=5e3;var WAIT_DEFAULT_SECONDS=300;var WAIT_MAX_SECONDS=540;
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
3
3
|
const require = __twpCreateRequire(import.meta.url);
|
|
4
|
-
import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromEnv}from"./chunk-4W6ZC7GV.js";import"./chunk-2LOT54OO.js";import"./chunk-NJL3H2BB.js";import"./chunk-ZN7AEXEI.js";import"./chunk-AH4KHEAC.js";import{formatUnknownArgs}from"./chunk-OKATZ4SN.js";import"./chunk-VSJBJXZO.js";var VERSION=true?"0.
|
|
4
|
+
import{GLOBAL_OPTIONS_HELP}from"./chunk-KIZIRVW6.js";import{parseArgv,quietFromEnv}from"./chunk-4W6ZC7GV.js";import"./chunk-2LOT54OO.js";import"./chunk-NJL3H2BB.js";import"./chunk-ZN7AEXEI.js";import"./chunk-AH4KHEAC.js";import{formatUnknownArgs}from"./chunk-OKATZ4SN.js";import"./chunk-VSJBJXZO.js";var VERSION=true?"0.131.0":"0.0.0-dev";var HELP=`twp ${VERSION} \u2014 TWP CLI
|
|
5
5
|
|
|
6
6
|
\u4F7F\u3044\u65B9:
|
|
7
7
|
twp \u5BFE\u8A71 TUI \u3092\u8D77\u52D5
|
|
@@ -1849,17 +1849,17 @@ TUI \u5185:
|
|
|
1849
1849
|
TWP API \u3092\u547C\u3079\u307E\u3059\u3002TWP API \u306E\u30C4\u30FC\u30EB\u306F\u65E2\u5B9A\u3067\u78BA\u8A8D\u304C\u51FA\u307E\u3059\uFF08-p \u3067\u306F\u62D2\u5426\u3002--allowed-tools \u3067\u540D\u524D\u3092\u8A31\u53EF\uFF09\u3002
|
|
1850
1850
|
\u4F1A\u8A71\u30FB\u30ED\u30FC\u30AB\u30EB\u30C4\u30FC\u30EB\uFF08\u30D5\u30A1\u30A4\u30EB\u30FB\u30B3\u30DE\u30F3\u30C9\u30FBgit\uFF09\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u30AF\u30EC\u30B8\u30C3\u30C8\u3067\u5B9F\u969B\u306B\u52D5\u304D\u307E\u3059\u3002
|
|
1851
1851
|
`;function ignoreEpipe(stream){stream.on("error",err=>{if(err.code==="EPIPE")process.exit(0);throw err})}async function main(){const nodeMajor=Number(process.versions.node.split(".")[0]);if(nodeMajor<22){process.stderr.write(`twp-cli \u306B\u306F Node.js 22 \u4EE5\u4E0A\u304C\u5FC5\u8981\u3067\u3059\uFF08\u73FE\u5728: ${process.versions.node}\uFF09
|
|
1852
|
-
`);process.exit(1)}ignoreEpipe(process.stdout);ignoreEpipe(process.stderr);if(process.env["TWP_AUTO_UPDATE_WORKER"]==="1"){const{runAutoUpdateWorker}=await import("./auto-update-worker-
|
|
1853
|
-
const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-
|
|
1852
|
+
`);process.exit(1)}ignoreEpipe(process.stdout);ignoreEpipe(process.stderr);if(process.env["TWP_AUTO_UPDATE_WORKER"]==="1"){const{runAutoUpdateWorker}=await import("./auto-update-worker-CB52KUTF.js");await runAutoUpdateWorker().catch(()=>void 0);return}const[first,...rest]=process.argv.slice(2);if(first==="__complete"||first==="completion"){const completion=await import("./completion-VJF5W2L6.js");if(first==="completion"){process.exitCode=completion.runCompletion(rest,process.stdout,process.stderr);return}
|
|
1853
|
+
const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-6E7WSKHW.js"),import("./config-XYWRBIC6.js")]);process.exitCode=await completion.runComplete(rest,process.stdout,{loadDomain,profileNames:()=>Object.keys(loadUserConfig().profiles??{})});return}if(first==="local-loop"){process.env["TWP_NO_AUTO_UPDATE"]="1";const autoUpdate2=await import("./auto-update-FXXQHBV5.js");autoUpdate2.registerRunning();const{runLocalLoopCommand}=await import("./commands-Q7GUXCYY.js");process.
|
|
1854
1854
|
exitCode=await runLocalLoopCommand(rest);return}if(first==="configure"){const autoUpdate2=await import("./auto-update-FXXQHBV5.js");autoUpdate2.registerRunning();autoUpdate2.onStartup(VERSION);const{runConfigure}=await import("./configure-BJGPASNG.js");process.exitCode=await runConfigure(rest);return}const args=parseArgv(process.argv.slice(2));if(args.command==="version"){process.stdout.write(`${VERSION}
|
|
1855
1855
|
`);return}if(args.command==="help"){process.stdout.write(HELP);return}if(args.movedCommand!==void 0){const{MOVED_QUEUE_COMMAND_MESSAGE}=await import("./dispatch-ZWCEVLKZ.js");process.stderr.write(MOVED_QUEUE_COMMAND_MESSAGE);process.exitCode=2;return}if(args.unknown.length>0){process.stderr.write(`\u4E0D\u660E\u306A\u5F15\u6570: ${formatUnknownArgs(args.unknown)}
|
|
1856
1856
|
|
|
1857
|
-
${HELP}`);process.exitCode=2;return}const autoUpdate=await import("./auto-update-FXXQHBV5.js");autoUpdate.registerRunning();if(args.command==="task-loop"&&args.taskLoopAction!=="capacity"){process.env[autoUpdate.DISABLE_ENV]="1"}else if(args.command!=="update"){autoUpdate.onStartup(VERSION)}if(args.command==="domain"&&args.domain!==void 0){const{runDomain}=await import("./run-
|
|
1858
|
-
{},argv:args.domainArgv,help:args.domainHelp,globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,refresh:args.refresh,quiet:args.quiet||quietFromEnv(process.env)},version:VERSION});return}if(args.command==="api"){const{runApiCommand}=await import("./api-command-
|
|
1859
|
-
globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,quiet:args.quiet||quietFromEnv(process.env)},version:VERSION});return}if(args.command==="update"){const{runUpdate}=await import("./update-
|
|
1860
|
-
command==="logout"||args.command==="whoami"){const{runLogin,runLogout,runWhoami}=await import("./commands-
|
|
1861
|
-
if(args.command==="task-loop"){const{runTaskLoop}=await import("./commands-
|
|
1857
|
+
${HELP}`);process.exitCode=2;return}const autoUpdate=await import("./auto-update-FXXQHBV5.js");autoUpdate.registerRunning();if(args.command==="task-loop"&&args.taskLoopAction!=="capacity"){process.env[autoUpdate.DISABLE_ENV]="1"}else if(args.command!=="update"){autoUpdate.onStartup(VERSION)}if(args.command==="domain"&&args.domain!==void 0){const{runDomain}=await import("./run-WWNWTKD7.js");process.exitCode=await runDomain({domain:args.domain,...args.operation!==void 0?{operation:args.operation}:
|
|
1858
|
+
{},argv:args.domainArgv,help:args.domainHelp,globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,refresh:args.refresh,quiet:args.quiet||quietFromEnv(process.env)},version:VERSION});return}if(args.command==="api"){const{runApiCommand}=await import("./api-command-EAWLRSAA.js");process.exitCode=await runApiCommand({argv:args.domainArgv,help:args.domainHelp,
|
|
1859
|
+
globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,quiet:args.quiet||quietFromEnv(process.env)},version:VERSION});return}if(args.command==="update"){const{runUpdate}=await import("./update-MQPXAW2C.js");process.exitCode=await runUpdate({...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}if(args.command==="login"||args.
|
|
1860
|
+
command==="logout"||args.command==="whoami"){const{runLogin,runLogout,runWhoami}=await import("./commands-KWQLHY2V.js");const options={profile:args.profile,method:args.loginMethod,tenant:args.tenant,noBrowser:args.loginNoBrowser,cliVersion:VERSION,force:args.logoutForce,...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{}};const runner=args.command==="login"?runLogin:args.command==="logout"?runLogout:runWhoami;process.exitCode=await runner(options);return}
|
|
1861
|
+
if(args.command==="task-loop"){const{runTaskLoop}=await import("./commands-SBO7N6TG.js");process.exitCode=await runTaskLoop({action:args.taskLoopAction??"run",project:args.project,profile:args.profile,safe:args.safe,daemon:args.daemon,interval:args.interval,maxCycles:args.maxCycles,forceRunner:args.forceRunner,force:args.stopForce,drain:args.stopDrain,engine:args.engine,version:VERSION,verbose:args.verbose,scheduleNow:args.scheduleNow,scheduleCounts:args.scheduleCounts,scheduleGate:args.scheduleGate,
|
|
1862
1862
|
scheduleOp:args.scheduleOp,scheduleConfigOp:args.scheduleConfigOp,scheduleId:args.scheduleId,charterOp:args.charterOp,charterInput:args.charterFile,charterOutput:args.charterOut,charterRevision:args.charterRevision,settingsOp:args.settingsOp,orientationOp:args.orientationOp,orientationArgs:args.orientationArgs,skillOp:args.skillOp,skillName:args.skillName,skillAll:args.skillAll,skillDir:args.skillDir,skillConfig:args.skillConfig,output:args.output,query:args.query,revisionFrom:args.revisionFrom,
|
|
1863
|
-
revisionTo:args.revisionTo,planOp:args.planOp,capacityOp:args.capacityOp,includeStopped:args.includeStopped,runnerOp:args.runnerOp,runnerId:args.runnerTargetId,triggerOp:args.triggerOp,triggerId:args.triggerId,triggerKey:args.triggerKey,triggerLimit:args.triggerLimit,planEmpty:args.planEmpty,planCheck:args.planCheck,yes:args.yes,ais:args.ais,workspace:args.workspace,aiConfigFile:args.aiConfigFile,noAiConfigFile:args.noAiConfigFile});return}if(args.command==="print"){const{runOneShot}=await import("./oneshot-
|
|
1864
|
-
process.exitCode=await runOneShot({prompt:args.prompt??"",fromStdin:args.promptFromStdin,mode:args.mode??"dev",...args.permissionMode!==void 0?{permissionMode:args.permissionMode}:{},allowedTools:args.allowedTools,disallowedTools:args.disallowedTools,...args.model!==void 0?{model:args.model}:{},...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}const{startTui}=await import("./app-
|
|
1863
|
+
revisionTo:args.revisionTo,planOp:args.planOp,capacityOp:args.capacityOp,includeStopped:args.includeStopped,runnerOp:args.runnerOp,runnerId:args.runnerTargetId,triggerOp:args.triggerOp,triggerId:args.triggerId,triggerKey:args.triggerKey,triggerLimit:args.triggerLimit,planEmpty:args.planEmpty,planCheck:args.planCheck,yes:args.yes,ais:args.ais,workspace:args.workspace,aiConfigFile:args.aiConfigFile,noAiConfigFile:args.noAiConfigFile});return}if(args.command==="print"){const{runOneShot}=await import("./oneshot-GYXSX3VV.js");
|
|
1864
|
+
process.exitCode=await runOneShot({prompt:args.prompt??"",fromStdin:args.promptFromStdin,mode:args.mode??"dev",...args.permissionMode!==void 0?{permissionMode:args.permissionMode}:{},allowedTools:args.allowedTools,disallowedTools:args.disallowedTools,...args.model!==void 0?{model:args.model}:{},...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}const{startTui}=await import("./app-K27D2NEW.js");await startTui({mode:args.mode,permissionMode:args.permissionMode,allowedTools:args.
|
|
1865
1865
|
allowedTools,disallowedTools:args.disallowedTools,model:args.model,profile:args.profile,noTui:args.noTui||!process.stdout.isTTY,doctor:args.doctor,version:VERSION})}await main();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{LoginError,LoginTimeoutError,browserLogin,passwordLogin,tokenLogin}from"./chunk-JHLJSHJ7.js";import{PromptAbortedError}from"./chunk-RACLI3FA.js";import"./chunk-N2UVRM3Z.js";import{ApiError,TwpApiClient}from"./chunk-SH2YLLVL.js";import{EXIT_USAGE,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-PMOUHEJQ.js";import{AuthSession,NotLoggedInError,SessionExpiredError}from"./chunk-ITFO5GPX.js";import{deleteCredentials,loadCredentials,maskToken}from"./chunk-GWVREACM.js";
|
|
4
|
+
import{httpFetch}from"./chunk-J7QYPKVK.js";import{effectiveApiUrl,resolveProfile}from"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";function writeOut(text){process.stdout.write(stripTerminalControls(text))}function writeErr(text){process.stderr.write(stripTerminalControls(text))}function makeIo(cliVersion){return{out:writeOut,fetchImpl:httpFetch,cliVersion}}var LogoutRefusedError=class extends Error{};async function run(fn){try{await fn();return 0}catch(err){if(err instanceof LogoutRefusedError){return 1}if(err instanceof UsageError){writeErr(`${err.message}
|
|
5
|
+
${err.hint?`${err.hint}
|
|
6
|
+
`:""}`);return EXIT_USAGE}if(err instanceof PromptAbortedError){writeErr("\n\u4E2D\u6B62\u3057\u307E\u3057\u305F\u3002\n");return 130}if(err instanceof LoginError||err instanceof LoginTimeoutError||err instanceof NotLoggedInError||err instanceof SessionExpiredError||err instanceof ApiError){writeErr(`${err.message}
|
|
7
|
+
`);return 1}writeErr(`\u30A8\u30E9\u30FC: ${err.message}
|
|
8
|
+
`);return 1}}async function runLogin(options){return run(async()=>{const profile=resolveProfile(options.profile);const io=makeIo(options.cliVersion);if(options.method==="password"){await passwordLogin(profile,{tenantCode:options.tenant??void 0},process.env,io)}else if(options.method==="token"){await tokenLogin(profile,process.env,io)}else{await browserLogin(profile,process.env,io,{noBrowser:options.noBrowser})}})}async function runLogout(options){return run(async()=>{const profile=resolveProfile(
|
|
9
|
+
options.profile);const creds=loadCredentials(profile.name);if(!creds){writeOut(`\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u300C${profile.name}\u300D\u306F\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u307E\u305B\u3093\u3002
|
|
10
|
+
`);return}const{describeLogoutImpact,findLoopsUsingProfile}=await import("./logout-guard-HXUAZ24F.js");const found=findLoopsUsingProfile(profile.name,options.logoutGuard);if(found.users.length>0||found.undetermined.length>0){writeErr(describeLogoutImpact(profile.name,found,options.force===true));if(options.force!==true)throw new LogoutRefusedError}const apiUrl=effectiveApiUrl(profile,creds.api_url);const revoked=await httpFetch(`${apiUrl}/api/v2/auth/logout`,{method:"POST",headers:{Accept:"applic\
|
|
11
|
+
ation/json",Authorization:`Bearer ${creds.token}`}}).then(res=>res.ok,()=>false);await deleteCredentials(profile.name);await import("./console-public-K5CP7KZJ.js").then(m=>m.revokeAllLocalLoopSessions(),()=>void 0);writeOut(`\u2705 \u30ED\u30B0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\uFF08\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB: ${profile.name} / \u30C8\u30FC\u30AF\u30F3: ${maskToken(creds.token)}\uFF09
|
|
12
|
+
`);if(!revoked){writeOut("\u26A0 \u30B5\u30FC\u30D0\u5074\u306E\u30C8\u30FC\u30AF\u30F3\u5931\u52B9\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08\u30AA\u30D5\u30E9\u30A4\u30F3\u7B49\uFF09\u3002TWP \u306E\u300C\u8A2D\u5B9A > CLI\u7AEF\u672B\u300D\u304B\u3089\u3082\u5931\u52B9\u3067\u304D\u307E\u3059\u3002\n")}})}async function runWhoami(options){return run(async()=>{const profile=resolveProfile(options.profile);const structured=options.output!==void 0||options.query!==void 0;let format=null;if(structured){
|
|
13
|
+
const{resolveOutputFormat,OUTPUT_FORMATS}=await import("./format-X65HXAAU.js");format=resolveOutputFormat({...options.output!==void 0?{flag:options.output}:{},isTty:process.stdout.isTTY===true});if(format===null){throw new UsageError(`--output \u306B\u300C${options.output??""}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F ${OUTPUT_FORMATS.join(" / ")} \u3067\u3059`)}}const stored=loadCredentials(profile.name);const apiUrl=effectiveApiUrl(
|
|
14
|
+
profile,stored?.api_url);const session=new AuthSession(profile.name,apiUrl);const client=new TwpApiClient(apiUrl,session,httpFetch,options.cliVersion);const me=await client.get("/api/v2/user");const user=me.user;const creds=loadCredentials(profile.name);if(format!==null){const value={id:user?.id??null,name:user?.name??null,email:user?.email??null,tenant_code:user?.tenant_code??null,role:user?.role??null,is_admin:user?.is_admin??null,profile:profile.name,api_url:apiUrl,expires_at:creds?.token_expires_at??
|
|
15
|
+
null};const{evaluateQuery}=await import("./query-J76QIXWR.js");const{renderOutput}=await import("./render-I6U5PEYR.js");const selected=options.query===void 0?value:await evaluateQuery(options.query,value);const text=renderOutput(selected,format);process.stdout.write(text.endsWith("\n")?text:`${text}
|
|
16
|
+
`);return}writeOut(`\u30E6\u30FC\u30B6\u30FC: ${user?.name??"?"}\uFF08${user?.email??"?"}\uFF09
|
|
17
|
+
`);writeOut(`ID: ${user?.id??"?"}
|
|
18
|
+
`);writeOut(`\u30C6\u30CA\u30F3\u30C8: ${user?.tenant_code??"?"}
|
|
19
|
+
`);writeOut(`\u30ED\u30FC\u30EB: ${user?.role??"?"}${user?.is_admin?"\uFF08\u7BA1\u7406\u8005\uFF09":""}
|
|
20
|
+
`);writeOut(`\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB: ${profile.name}
|
|
21
|
+
`);writeOut(`API: ${apiUrl}
|
|
22
|
+
`);if(creds?.token_expires_at){writeOut(`\u30C8\u30FC\u30AF\u30F3\u671F\u9650: ${creds.token_expires_at}
|
|
23
|
+
`)}})}export{runLogin,runLogout,runWhoami};
|