baseline: dsh 工作区基线快照(2026-09-10,全新历史起点)
本提交为 dsh_mcn_workshop 仓库的首个提交(旧仓 dsh_MCNProject 已停用), 完整固化 C:/Users/Administrator/.dsh 当前磁盘状态。 1) 临时数据清理:移出 sessions/(81M)、logs/、skill-backup-20260906/(14M)、 scripts/__pycache__、storages/workspace.json.bak —— 合计 94M(.dsh 162M → 68M) 2) 凭据脱敏:.credentials.yaml(含明文 DEEPSEEK_API_KEY)移出 git 跟踪并加入 .gitignore;mcn-data-insight/scripts/setup_redfox_key.py 中真实 key 示例改为占位符 3) .gitignore 增补 logs/、skill-backup-*/ 规则 4) 技能结构以当前磁盘状态为准:skills/ = mcn-short-video / impeccable / taste-skill / dsh-multi-user-migration;旧技能目录(mcn-dou-analysis、storyboard-prompt、 short-video-script、browser-harness、mcn-data-insight)与 profiles/web/node_modules/dsh-vision-router 本地已不存在,本提交记为删除
This commit is contained in:
commit
856e632807
880 files changed
+225426
No files matched your search
@@ -0,0 +1,120 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
手动升级 @deepseek-ai/dsh(绕过 npm/npx,本机 npm 写 cacache 卡死)
|
||||
用法:
|
||||
python -S dsh_upgrade.py [目标版本]
|
||||
例: python -S dsh_upgrade.py 0.1.1-rc.2
|
||||
(不传版本则用 DSH_UPGRADE_VERSION 环境变量或默认值)
|
||||
"""
|
||||
import urllib.request, tarfile, io, json, os, shutil, sys, time, glob
|
||||
|
||||
# 自动检测最新旧版 dsh 缓存目录(_npx 下含 @deepseek-ai/dsh 的目录,取修改时间最新)
|
||||
def find_src():
|
||||
base = r'C:\Users\maidou\AppData\Local\npm-cache\_npx'
|
||||
hits = glob.glob(os.path.join(base, '*', 'node_modules', '@deepseek-ai', 'dsh', 'package.json'))
|
||||
if not hits:
|
||||
print('错误: 未找到旧版 dsh 缓存目录(_npx 下无 @deepseek-ai/dsh)'); sys.exit(1)
|
||||
hits.sort(key=os.path.getmtime, reverse=True)
|
||||
pkg = os.path.dirname(hits[0]) # .../@deepseek-ai/dsh
|
||||
return os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(pkg))))
|
||||
# 上推4层: node_modules/@deepseek-ai/dsh -> _npx/<hash>
|
||||
|
||||
SRC = find_src()
|
||||
SRC_HASH = os.path.basename(SRC)
|
||||
DST = os.path.join(r'D:\dsh-install', SRC_HASH)
|
||||
VERSION = sys.argv[1] if len(sys.argv) > 1 else os.environ.get('DSH_UPGRADE_VERSION', '0.1.1-rc.2')
|
||||
SCOPE = '@deepseek-ai'
|
||||
REG = 'https://registry.npmmirror.com'
|
||||
|
||||
NM = os.path.join(DST, 'node_modules')
|
||||
SCOPE_DIR = os.path.join(NM, SCOPE)
|
||||
|
||||
def log(msg):
|
||||
print(msg, flush=True)
|
||||
|
||||
def download(url, timeout=60):
|
||||
req = urllib.request.Request(url, headers={'User-Agent': 'python-dsh-upgrade'})
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
return r.read()
|
||||
|
||||
def pkg_url(name):
|
||||
# name: 'dsh-app-boot'
|
||||
return f'{REG}/{SCOPE}/{name}/-/{name}-{VERSION}.tgz'
|
||||
|
||||
def extract_tarball(data, target):
|
||||
tf = tarfile.open(fileobj=io.BytesIO(data), mode='r:gz')
|
||||
members = tf.getmembers()
|
||||
for m in members:
|
||||
if m.isdir():
|
||||
continue
|
||||
if not m.name.startswith('package/'):
|
||||
continue
|
||||
rel = m.name[len('package/'):]
|
||||
dest = os.path.join(target, rel)
|
||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||
src_f = tf.extractfile(m)
|
||||
if src_f is None:
|
||||
continue
|
||||
with open(dest, 'wb') as f:
|
||||
f.write(src_f.read())
|
||||
tf.close()
|
||||
|
||||
def update_pkg(pkg_dir, pkg_name):
|
||||
url = pkg_url(pkg_name)
|
||||
try:
|
||||
data = download(url)
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
target = os.path.join(pkg_dir, pkg_name)
|
||||
if os.path.exists(target):
|
||||
shutil.rmtree(target)
|
||||
os.makedirs(target)
|
||||
extract_tarball(data, target)
|
||||
return True, ''
|
||||
|
||||
def main():
|
||||
t0 = time.time()
|
||||
# ---- 1. 复制旧目录 ----
|
||||
if not os.path.exists(DST):
|
||||
log(f'[1/4] 复制旧目录 {SRC} -> {DST} (291MB, 约1-2分钟) ...')
|
||||
shutil.copytree(SRC, DST)
|
||||
log(f' 复制完成 ({time.time()-t0:.0f}s)')
|
||||
else:
|
||||
log('[1/4] 目标目录已存在,跳过复制')
|
||||
|
||||
# ---- 2. 升级 @deepseek-ai/* 家族 ----
|
||||
if not os.path.isdir(SCOPE_DIR):
|
||||
log(f'错误: {SCOPE_DIR} 不存在'); sys.exit(1)
|
||||
names = sorted(os.listdir(SCOPE_DIR))
|
||||
log(f'[2/4] 扫描 {SCOPE} 下 {len(names)} 个包,升级到 {VERSION} ...')
|
||||
updated, skipped, failed = [], [], []
|
||||
for i, name in enumerate(names, 1):
|
||||
ok, err = update_pkg(SCOPE_DIR, name)
|
||||
if ok:
|
||||
updated.append(name)
|
||||
log(f' [{i}/{len(names)}] UPDATED {name}@{VERSION}')
|
||||
else:
|
||||
skipped.append(name)
|
||||
if i % 20 == 0 or i == len(names):
|
||||
log(f' [{i}/{len(names)}] ... 已跳过 {len(skipped)} 个(无 {VERSION} 版本)')
|
||||
log(f' 升级 {len(updated)} 个,跳过 {len(skipped)} 个,失败 {len(failed)} 个')
|
||||
|
||||
# ---- 3. 升级 dsh 本体 ----
|
||||
log('[3/4] 升级 @deepseek-ai/dsh 本体 ...')
|
||||
ok, err = update_pkg(SCOPE_DIR, 'dsh')
|
||||
log(f' dsh 本体: {"OK" if ok else "FAIL " + err}')
|
||||
|
||||
# ---- 4. 验证 ----
|
||||
log('[4/4] 验证版本 ...')
|
||||
pj = os.path.join(SCOPE_DIR, 'dsh', 'package.json')
|
||||
if os.path.exists(pj):
|
||||
with open(pj, encoding='utf-8') as f:
|
||||
ver = json.load(f).get('version')
|
||||
log(f' @deepseek-ai/dsh version = {ver}')
|
||||
else:
|
||||
log(' 错误: dsh/package.json 不存在')
|
||||
log(f'总耗时 {time.time()-t0:.0f}s')
|
||||
log('DONE')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,113 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
补缺脚本:扫描 D:\dsh-install 下所有已装包的 dependencies,
|
||||
把缺失的包(新版 dsh 新增的依赖)从 npmmirror 下载补上。
|
||||
用法: python -S fix_deps.py [版本号]
|
||||
"""
|
||||
import urllib.request, tarfile, io, json, os, shutil, sys, glob
|
||||
|
||||
# 自动检测 D:\dsh-install 下最新部署目录(避免硬编码 hash,换机器/升级通用)
|
||||
_install_dirs = sorted(glob.glob(r'D:\dsh-install\*'), key=os.path.getmtime, reverse=True)
|
||||
if _install_dirs:
|
||||
NM = os.path.join(_install_dirs[0], 'node_modules')
|
||||
else:
|
||||
print('错误: D:\dsh-install 下无部署目录,先跑 dsh_upgrade.py'); sys.exit(1)
|
||||
REG = 'https://registry.npmmirror.com'
|
||||
VERSION = sys.argv[1] if len(sys.argv) > 1 else os.environ.get('DSH_UPGRADE_VERSION', '0.1.1-rc.2')
|
||||
|
||||
def log(m):
|
||||
print(m, flush=True)
|
||||
|
||||
def get(url, timeout=60):
|
||||
req = urllib.request.Request(url, headers={'User-Agent': 'python-fix-deps'})
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
return r.read()
|
||||
|
||||
def collect_pkg_map():
|
||||
"""遍历所有已装包,返回 {包名: package.json 路径}"""
|
||||
pmap = {}
|
||||
for n in os.listdir(NM):
|
||||
p = os.path.join(NM, n, 'package.json')
|
||||
if n.startswith('@'):
|
||||
d = os.path.join(NM, n)
|
||||
if os.path.isdir(d):
|
||||
for s in os.listdir(d):
|
||||
q = os.path.join(d, s, 'package.json')
|
||||
if os.path.exists(q):
|
||||
pmap[f'{n}/{s}'] = q
|
||||
elif os.path.exists(p):
|
||||
pmap[n] = p
|
||||
return pmap
|
||||
|
||||
def resolve_version(full_name):
|
||||
if full_name.startswith('@deepseek-ai/'):
|
||||
return VERSION
|
||||
try:
|
||||
d = json.loads(get(f'{REG}/{full_name}'))
|
||||
return d['dist-tags']['latest']
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def install_pkg(full_name):
|
||||
ver = resolve_version(full_name)
|
||||
if not ver:
|
||||
log(f' SKIP {full_name}(版本解析失败)')
|
||||
return False
|
||||
esc = full_name.replace('/', '%2F')
|
||||
pkg_short = full_name.split('/')[-1]
|
||||
url = f'{REG}/{esc}/-/{pkg_short}-{ver}.tgz'
|
||||
try:
|
||||
data = get(url)
|
||||
except Exception as e:
|
||||
log(f' FAIL {full_name}@{ver}: {e}')
|
||||
return False
|
||||
target = os.path.join(NM, *full_name.split('/'))
|
||||
if os.path.exists(target):
|
||||
shutil.rmtree(target)
|
||||
os.makedirs(target, exist_ok=True)
|
||||
tf = tarfile.open(fileobj=io.BytesIO(data), mode='r:gz')
|
||||
for m in tf.getmembers():
|
||||
if m.isdir() or not m.name.startswith('package/'):
|
||||
continue
|
||||
rel = m.name[len('package/'):]
|
||||
dest = os.path.join(target, rel)
|
||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||
src = tf.extractfile(m)
|
||||
if src:
|
||||
with open(dest, 'wb') as f:
|
||||
f.write(src.read())
|
||||
tf.close()
|
||||
log(f' INSTALL {full_name}@{ver}')
|
||||
return True
|
||||
|
||||
def main():
|
||||
missing = {}
|
||||
for round_no in range(1, 9):
|
||||
pmap = collect_pkg_map()
|
||||
have = set(pmap.keys())
|
||||
missing = {}
|
||||
for name, pj in pmap.items():
|
||||
try:
|
||||
with open(pj, encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
except Exception:
|
||||
continue
|
||||
for dep_key in ('dependencies', 'optionalDependencies'):
|
||||
for dep, spec in (data.get(dep_key) or {}).items():
|
||||
if dep not in have:
|
||||
missing[dep] = spec
|
||||
if not missing:
|
||||
log(f'第 {round_no} 轮: 无缺失,依赖完整')
|
||||
break
|
||||
log(f'第 {round_no} 轮: 缺 {len(missing)} 个依赖')
|
||||
ok = sum(1 for dep in sorted(missing) if install_pkg(dep))
|
||||
if ok == 0:
|
||||
log('本轮 0 成功,停止')
|
||||
break
|
||||
have = collect_pkg_map()
|
||||
final = sorted(d for d in missing if d not in have)
|
||||
log('最终缺失: ' + (', '.join(final) if final else '无'))
|
||||
log('DONE')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user