feat: add tmp/ directory for temp files and cookie, add .gitignore
- tmp/ 用于存放临时文件(文档缓存、cookie等),已加入 .gitignore - 文档中所有临时文件和 cookie 路径统一指向 tmp/ - SKILL.md 架构图增加 tmp/ 说明 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# 临时文件 / 配置文件,不纳入版本管理
|
||||||
|
tmp/
|
||||||
@@ -28,6 +28,11 @@ media-center/
|
|||||||
│ └── quark/
|
│ └── quark/
|
||||||
│ └── v1/{install,usage,maintain}.md
|
│ └── v1/{install,usage,maintain}.md
|
||||||
│
|
│
|
||||||
|
├── tmp/ # 临时文件 / cookie(已 gitignore)
|
||||||
|
│ ├── cookie_quark.txt # 夸克 Cookie
|
||||||
|
│ ├── doc_raw.json # 文档结构缓存
|
||||||
|
│ └── doc_content.txt # 提取的全文缓存
|
||||||
|
│
|
||||||
└── ref/ # 参考归档
|
└── ref/ # 参考归档
|
||||||
├── tencent-docs/
|
├── tencent-docs/
|
||||||
├── tx-doc-large-reader/
|
├── tx-doc-large-reader/
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ mcporter call tencent-docs smartcanvas.read file_id=<FILE_ID> size=10
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 获取完整文档结构
|
# 获取完整文档结构
|
||||||
mcporter call tencent-docs doc.resolve_document_structure file_id=<FILE_ID> > doc_raw.json
|
mcporter call tencent-docs doc.resolve_document_structure file_id=<FILE_ID> > tmp/doc_raw.json
|
||||||
|
|
||||||
# 提取纯文本
|
# 提取纯文本
|
||||||
python -X utf8 -c "
|
python -X utf8 -c "
|
||||||
import json
|
import json
|
||||||
with open('doc_raw.json','r',encoding='utf-8') as f:
|
with open('tmp/doc_raw.json','r',encoding='utf-8') as f:
|
||||||
data=json.load(f)
|
data=json.load(f)
|
||||||
texts=[]
|
texts=[]
|
||||||
for n in data.get('nodes',[]):
|
for n in data.get('nodes',[]):
|
||||||
@@ -55,13 +55,13 @@ for n in data.get('nodes',[]):
|
|||||||
hl=n.get('heading_level',0)
|
hl=n.get('heading_level',0)
|
||||||
if p:
|
if p:
|
||||||
texts.append(('#'*hl+' '+p) if hl>0 else p)
|
texts.append(('#'*hl+' '+p) if hl>0 else p)
|
||||||
with open('doc_content.txt','w',encoding='utf-8') as f:
|
with open('tmp/doc_content.txt','w',encoding='utf-8') as f:
|
||||||
f.write('\n'.join(texts))
|
f.write('\n'.join(texts))
|
||||||
print(f'Done: {len(texts)} paragraphs')
|
print(f'Done: {len(texts)} paragraphs')
|
||||||
"
|
"
|
||||||
|
|
||||||
# 清理中间文件
|
# 清理中间文件
|
||||||
rm doc_raw.json
|
rm tmp/doc_raw.json
|
||||||
```
|
```
|
||||||
|
|
||||||
### 第二步 B:smartcanvas 类型(支持分页)
|
### 第二步 B:smartcanvas 类型(支持分页)
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ mcporter config add netdisk \
|
|||||||
--env "NETDISK_QUARK_COOKIE=粘贴你的完整Cookie"
|
--env "NETDISK_QUARK_COOKIE=粘贴你的完整Cookie"
|
||||||
```
|
```
|
||||||
|
|
||||||
> Cookie 是敏感信息,建议保存在单独的文件(如 `项目根目录/cookie/quark.txt`)中,
|
> Cookie 是敏感信息,保存在 `tmp/cookie_quark.txt`(已加入 `.gitignore`),
|
||||||
> 使用时 `COOKIE=$(cat cookie/quark.txt)`,避免在命令行历史中泄露。
|
> 使用时 `COOKIE=$(cat tmp/cookie_quark.txt)`,避免在命令行历史中泄露。
|
||||||
|
|
||||||
### 3. 验证
|
### 3. 验证
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ mcporter call 'netdisk.list(cloud: "quark", path: "/目标目录")'
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 从文件读取避免泄露(推荐)
|
# 从文件读取避免泄露(推荐)
|
||||||
COOKIE=$(cat cookie/quark.txt)
|
COOKIE=$(cat tmp/cookie_quark.txt)
|
||||||
|
|
||||||
# 或直接写入(注意命令行历史)
|
# 或直接写入(注意命令行历史)
|
||||||
# COOKIE="你的夸克Cookie"
|
# COOKIE="你的夸克Cookie"
|
||||||
|
|||||||
Reference in New Issue
Block a user