@tiangong-ai/cli 0.0.3 → 0.0.6
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/AGENTS.md +6 -2
- package/README.md +78 -1
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +2062 -8
- package/dist/cli.js.map +1 -1
- package/package.json +5 -1
package/AGENTS.md
CHANGED
|
@@ -15,8 +15,8 @@ checkPaths:
|
|
|
15
15
|
- .docpact/config.yaml
|
|
16
16
|
- docs/agents/**
|
|
17
17
|
- src/**
|
|
18
|
-
lastReviewedAt: 2026-05-
|
|
19
|
-
lastReviewedCommit:
|
|
18
|
+
lastReviewedAt: 2026-05-10
|
|
19
|
+
lastReviewedCommit: f45edb6f41dd767911b3788eb8bc75e9bcb8ba33
|
|
20
20
|
---
|
|
21
21
|
|
|
22
22
|
# Tiangong AI CLI Contract
|
|
@@ -38,6 +38,10 @@ This repository owns the Tiangong AI command-line interface.
|
|
|
38
38
|
|
|
39
39
|
- `tiangong-ai doctor`
|
|
40
40
|
- `tiangong-ai kb ingest`
|
|
41
|
+
- `tiangong-ai kb ingest bulk`
|
|
42
|
+
- `tiangong-ai kb ingest jobs`
|
|
43
|
+
- `tiangong-ai kb ingest resume`
|
|
44
|
+
- `tiangong-ai kb ingest export`
|
|
41
45
|
- `tiangong-ai kb collections`
|
|
42
46
|
- `tiangong-ai kb status`
|
|
43
47
|
|
package/README.md
CHANGED
|
@@ -55,12 +55,85 @@ Upload a folder recursively with local checkpointing:
|
|
|
55
55
|
tiangong-ai kb ingest upload /path/to/folder --recursive --concurrency 3 --retries 3
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
Bulk scan a large folder and emit a structural JSON summary:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
tiangong-ai kb ingest bulk scan /path/to/folder --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Dry-run a layered metadata map against a folder and collection schema:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
tiangong-ai kb ingest bulk dry-run /path/to/folder \
|
|
68
|
+
--collection-path /course/thu_humanities \
|
|
69
|
+
--metadata-map metadata-map.yaml \
|
|
70
|
+
--json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The same dry-run is also available through the skill-facing alias:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
tiangong-ai kb ingest metadata dry-run /path/to/folder \
|
|
77
|
+
--collection-path /course/thu_humanities \
|
|
78
|
+
--metadata-map metadata-map.yaml \
|
|
79
|
+
--json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Run a resumable sliding-window bulk ingest:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
tiangong-ai kb ingest bulk /path/to/folder \
|
|
86
|
+
--collection-path /course/thu_humanities \
|
|
87
|
+
--metadata-map metadata-map.yaml \
|
|
88
|
+
--window-size 100 \
|
|
89
|
+
--top-up-max 50 \
|
|
90
|
+
--upload-concurrency 4 \
|
|
91
|
+
--poll-interval 30
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`tiangong-ai kb ingest bulk run /path/to/folder` is accepted as an explicit
|
|
95
|
+
alias for wrappers that want a verb before the folder path.
|
|
96
|
+
|
|
97
|
+
Bulk ingest uses SQLite as its checkpoint source. By default, job files are
|
|
98
|
+
stored under the OS app-data directory:
|
|
99
|
+
|
|
100
|
+
- macOS: `~/Library/Application Support/tiangong-ai/kb-ingest/jobs/<job-id>.sqlite`
|
|
101
|
+
- Linux: `~/.local/share/tiangong-ai/kb-ingest/jobs/<job-id>.sqlite`
|
|
102
|
+
- Windows: `%APPDATA%/tiangong-ai/kb-ingest/jobs/<job-id>.sqlite`
|
|
103
|
+
|
|
104
|
+
Use `--state /path/to/job.sqlite` to override the checkpoint path. Bulk jobs do
|
|
105
|
+
not use `.tiangong-kb-ingest-manifest.jsonl` as their checkpoint.
|
|
106
|
+
|
|
107
|
+
Bulk ingest always creates 300dpi-normalized ingest copies for `.docx` files
|
|
108
|
+
and creates PDF split parts when a PDF exceeds the active upload limit. Derived
|
|
109
|
+
files stay under `.tiangong-kb-ingest-derived` by default, and that directory is
|
|
110
|
+
excluded from future bulk scans. DOCX copies keep the original logical path for
|
|
111
|
+
metadata-map evaluation, and the generated DOCX copy is uploaded even when
|
|
112
|
+
normalization does not materially reduce file size. PDF split parts keep the
|
|
113
|
+
original logical parent directory. Upload metadata remains the user/business
|
|
114
|
+
metadata produced by the metadata map.
|
|
115
|
+
|
|
116
|
+
Manage bulk jobs:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
tiangong-ai kb ingest jobs
|
|
120
|
+
tiangong-ai kb ingest status <job-id>
|
|
121
|
+
tiangong-ai kb ingest resume <job-id>
|
|
122
|
+
tiangong-ai kb ingest export <job-id> --format csv
|
|
123
|
+
```
|
|
124
|
+
|
|
58
125
|
List uploadable collections:
|
|
59
126
|
|
|
60
127
|
```bash
|
|
61
128
|
tiangong-ai kb collections list --capability upload
|
|
62
129
|
```
|
|
63
130
|
|
|
131
|
+
Resolve a collection and include the effective metadata schema:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
tiangong-ai kb collections schema --collection-path /course/thu_humanities --json
|
|
135
|
+
```
|
|
136
|
+
|
|
64
137
|
Check document status:
|
|
65
138
|
|
|
66
139
|
```bash
|
|
@@ -70,7 +143,11 @@ tiangong-ai kb ingest status <document-id>
|
|
|
70
143
|
## Boundary
|
|
71
144
|
|
|
72
145
|
The CLI is a thin local client. It sends bearer-token requests to the Tiangong
|
|
73
|
-
KB ingest API and records local
|
|
146
|
+
KB ingest API and records local checkpoints for batch recovery. Non-bulk upload
|
|
147
|
+
still uses a JSONL manifest. Bulk ingest uses SQLite and releases sliding-window
|
|
148
|
+
capacity only when document status is `completed` and both `opensearchIndexed`
|
|
149
|
+
and `pineconeIndexed` are true. If the status API does not return those index
|
|
150
|
+
flags yet, the file remains in `waiting_for_index_flags`. The backend owns
|
|
74
151
|
authorization, collection permissions, duplicate detection, NAS raw writes,
|
|
75
152
|
parse queueing, and status transitions.
|
|
76
153
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const DEFAULT_API_BASE_URL = "https://thuenv.tiangong.world:7300";
|
|
2
2
|
export declare const DEFAULT_API_PATH_PREFIX = "/api/v1/kb";
|
|
3
|
-
|
|
3
|
+
interface Output {
|
|
4
|
+
write(text: string): unknown;
|
|
5
|
+
}
|
|
4
6
|
export interface CliIO {
|
|
5
7
|
env: NodeJS.ProcessEnv;
|
|
6
8
|
stdout: Output;
|