@pippit-dev/cli 0.0.22 → 0.0.23
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/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
6622f32c85491b9287ac690b269ad42a67c652793261c1068a1a39958505db31 pippit-tool-cli-0.0.23-darwin-amd64.tar.gz
|
|
2
|
+
fe18af3140b0def41eb954e671d81a9e4fd6e9973c87a942c6b7cd59363731e3 pippit-tool-cli-0.0.23-darwin-arm64.tar.gz
|
|
3
|
+
9a5b56a42a0611a540d30f04ba50ce430040188c67446bcd42bd0297c6bbee60 pippit-tool-cli-0.0.23-linux-amd64.tar.gz
|
|
4
|
+
bad0a2c0d311bda3fce24652a4116b1d620fc12008a1f5b2ea77017f677dd9c8 pippit-tool-cli-0.0.23-linux-arm64.tar.gz
|
|
5
|
+
cb44ff96743bd5a47eec7d05b5a228b491c36907ba2f013af4c7b2259b18781f pippit-tool-cli-0.0.23-windows-amd64.zip
|
|
6
|
+
70ea30297e07c800a14c4aa52eecc6d9ea7f78a259892b5f9efc05d9e7385d22 pippit-tool-cli-0.0.23-windows-arm64.zip
|
package/cmd/short_drama_test.go
CHANGED
|
@@ -184,9 +184,7 @@ func TestShortDramaSubmitRunRequiresAccessKey(t *testing.T) {
|
|
|
184
184
|
if err == nil {
|
|
185
185
|
t.Fatal("Execute() error = nil, want access key error")
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
t.Fatalf("error = %q, want access key guidance", err)
|
|
189
|
-
}
|
|
187
|
+
assertAccessKeyGuidance(t, err)
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
func TestShortDramaUploadFile(t *testing.T) {
|
|
@@ -286,9 +284,7 @@ func TestShortDramaUploadFileRequiresAccessKey(t *testing.T) {
|
|
|
286
284
|
if err == nil {
|
|
287
285
|
t.Fatal("Execute() error = nil, want access key error")
|
|
288
286
|
}
|
|
289
|
-
|
|
290
|
-
t.Fatalf("error = %q, want access key guidance", err)
|
|
291
|
-
}
|
|
287
|
+
assertAccessKeyGuidance(t, err)
|
|
292
288
|
}
|
|
293
289
|
|
|
294
290
|
func TestShortDramaUploadFileRejectsUnsupportedFileType(t *testing.T) {
|
|
@@ -768,9 +764,7 @@ func TestShortDramaGetThreadRequiresAccessKey(t *testing.T) {
|
|
|
768
764
|
if err == nil {
|
|
769
765
|
t.Fatal("Execute() error = nil, want access key error")
|
|
770
766
|
}
|
|
771
|
-
|
|
772
|
-
t.Fatalf("error = %q, want access key guidance", err)
|
|
773
|
-
}
|
|
767
|
+
assertAccessKeyGuidance(t, err)
|
|
774
768
|
}
|
|
775
769
|
|
|
776
770
|
func TestShortDramaListThreadFile(t *testing.T) {
|
|
@@ -892,6 +886,23 @@ func TestShortDramaListThreadFileRequiresThreadID(t *testing.T) {
|
|
|
892
886
|
}
|
|
893
887
|
}
|
|
894
888
|
|
|
889
|
+
func TestShortDramaListThreadFileRequiresAccessKey(t *testing.T) {
|
|
890
|
+
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
891
|
+
t.Fatal("server should not receive request without access key")
|
|
892
|
+
}))
|
|
893
|
+
defer server.Close()
|
|
894
|
+
|
|
895
|
+
var stdout, stderr bytes.Buffer
|
|
896
|
+
root := newTestRootCommandWithAccessKey(t, &stdout, &stderr, server.URL, "")
|
|
897
|
+
root.SetArgs([]string{"short-drama", "+list-thread-file", "--thread-id", "thread_123"})
|
|
898
|
+
|
|
899
|
+
err := root.Execute()
|
|
900
|
+
if err == nil {
|
|
901
|
+
t.Fatal("Execute() error = nil, want access key error")
|
|
902
|
+
}
|
|
903
|
+
assertAccessKeyGuidance(t, err)
|
|
904
|
+
}
|
|
905
|
+
|
|
895
906
|
func TestShortDramaListThreadFileRejectsPageSizeAboveMax(t *testing.T) {
|
|
896
907
|
var stdout, stderr bytes.Buffer
|
|
897
908
|
root := NewRootCommand(&stdout, &stderr)
|
|
@@ -925,6 +936,23 @@ func newTestRootCommandWithAccessKey(t *testing.T, stdout, stderr io.Writer, bas
|
|
|
925
936
|
return newRootCommand(stdout, stderr, runner)
|
|
926
937
|
}
|
|
927
938
|
|
|
939
|
+
func assertAccessKeyGuidance(t *testing.T, err error) {
|
|
940
|
+
t.Helper()
|
|
941
|
+
if err == nil {
|
|
942
|
+
t.Fatal("error = nil, want access key guidance")
|
|
943
|
+
}
|
|
944
|
+
msg := err.Error()
|
|
945
|
+
if !strings.Contains(msg, "XYQ_ACCESS_KEY is required") {
|
|
946
|
+
t.Fatalf("error = %q, want access key guidance", err)
|
|
947
|
+
}
|
|
948
|
+
if !strings.Contains(msg, "https://xyq.jianying.com/home?tab_name=home") {
|
|
949
|
+
t.Fatalf("error = %q, want access key settings URL", err)
|
|
950
|
+
}
|
|
951
|
+
if !strings.Contains(msg, `export XYQ_ACCESS_KEY="<access-key>"`) {
|
|
952
|
+
t.Fatalf("error = %q, want setup command guidance", err)
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
928
956
|
func decodeJSON(t *testing.T, data []byte) map[string]any {
|
|
929
957
|
t.Helper()
|
|
930
958
|
var got map[string]any
|
|
@@ -22,7 +22,7 @@ func (a *accessKeyAuthorizer) Inject(ctx context.Context, req *http.Request) err
|
|
|
22
22
|
return err
|
|
23
23
|
}
|
|
24
24
|
if a.accessKey == "" && req.Method == http.MethodPost {
|
|
25
|
-
return fmt.Errorf("%s
|
|
25
|
+
return fmt.Errorf("%s 缺失. 请前往小云雀官网个人设置页创建 Access Key,地址:https://xyq.jianying.com/home?tab_name=home\n配置后重试:\n export %s=\"<your-access-key>\"", config.EnvXYQAccessKey, config.EnvXYQAccessKey)
|
|
26
26
|
}
|
|
27
27
|
if a.accessKey != "" {
|
|
28
28
|
req.Header.Set("Authorization", "Bearer "+a.accessKey)
|
package/package.json
CHANGED
|
@@ -67,6 +67,14 @@ metadata:
|
|
|
67
67
|
npx @pippit-dev/cli@latest install
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
部分功能需要先配置 `XYQ_ACCESS_KEY`。缺失时 CLI 会直接提示用户先创建 Access Key,此时请等待用户给与Access Key后再继续运行。
|
|
71
|
+
|
|
72
|
+
Access Key 创建地址:https://xyq.jianying.com/home?tab_name=home
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
export XYQ_ACCESS_KEY="<access-key>"
|
|
76
|
+
```
|
|
77
|
+
|
|
70
78
|
## 使用方法
|
|
71
79
|
|
|
72
80
|
### 1. 提交短剧任务
|