weflow-cli 1.8.0 → 1.8.1

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +159 -1
  2. package/OPERATIONS.md +42 -6
  3. package/README.en.md +3 -3
  4. package/README.md +3 -3
  5. package/bin/weflow-cli.ts +3 -1
  6. package/dist/bin/weflow-cli.js +3 -1
  7. package/dist/bin/weflow-cli.js.map +1 -1
  8. package/dist/src/panel/server.js +1 -1
  9. package/dist/src/panel/server.js.map +1 -1
  10. package/dist/src/services/assistantPrivacy.d.ts.map +1 -1
  11. package/dist/src/services/assistantPrivacy.js +7 -2
  12. package/dist/src/services/assistantPrivacy.js.map +1 -1
  13. package/dist/src/services/assistantService.d.ts.map +1 -1
  14. package/dist/src/services/assistantService.js +10 -1
  15. package/dist/src/services/assistantService.js.map +1 -1
  16. package/dist/src/services/assistantTools.d.ts +12 -0
  17. package/dist/src/services/assistantTools.d.ts.map +1 -1
  18. package/dist/src/services/assistantTools.js +29 -3
  19. package/dist/src/services/assistantTools.js.map +1 -1
  20. package/dist/src/services/wereadService.d.ts +33 -6
  21. package/dist/src/services/wereadService.d.ts.map +1 -1
  22. package/dist/src/services/wereadService.js +27 -2
  23. package/dist/src/services/wereadService.js.map +1 -1
  24. package/docs/BRANCHES.md +13 -4
  25. package/docs/PROJECT_STATE.md +299 -299
  26. package/package.json +1 -1
  27. package/resources/panel/main.cjs +43 -7
  28. package/resources/panel/mascot-thinking.png +0 -0
  29. package/resources/panel/panel.css +415 -407
  30. package/resources/panel/preload.cjs +79 -72
  31. package/resources/panel/renderer.js +470 -441
  32. package/scripts/_utils.py +23 -1
  33. package/scripts/backfill_articles.py +438 -438
  34. package/scripts/compile_wiki.py +18 -17
  35. package/scripts/wiki_lint.py +429 -397
  36. package/src/panel/server.ts +424 -424
  37. package/src/services/assistantPrivacy.ts +7 -2
  38. package/src/services/assistantService.ts +11 -1
  39. package/src/services/assistantTools.ts +33 -3
  40. package/src/services/wereadService.ts +43 -7
  41. package/resources/panel/mascot-focus.png +0 -0
@@ -24,8 +24,8 @@ from collections import defaultdict, Counter
24
24
 
25
25
  sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
26
26
  from _utils import (CHAT_CARD_PREFIX, CONCEPT_DIRS, call_deepseek, # noqa: E402
27
- SEPARATOR, get_api_key, load_config, parse_frontmatter,
28
- write_with_frontmatter)
27
+ normalize_concept_name, SEPARATOR, get_api_key, load_config,
28
+ parse_frontmatter, write_with_frontmatter)
29
29
 
30
30
  # Default paths
31
31
  SOURCE_ROOT = 'output/biz-daily'
@@ -652,20 +652,8 @@ def replace_source_section(text: str, lines: list) -> str:
652
652
  return text[:head] + SOURCE_SECTION + '\n\n' + '\n'.join(lines) + '\n' + tail
653
653
 
654
654
 
655
- NORM_STRIP_RE = re.compile(r'[\s\-_·、,.。::/\\()()\[\]【】"\’]+')
656
-
657
-
658
- def normalize_concept_name(name: str) -> str:
659
- """判「这两个名字是不是同一个概念」用的规范形。
660
-
661
- 去空格、连字符、下划线、标点,转小写,再去掉英文复数尾 —— 实测这样能把
662
- `GPT 5.6`/`GPT-5.6`/`GPT5.6`、`AI 工具`/`AI工具`、`AI skill`/`AI skills` 收到一起。
663
-
664
- **它也会把 `news`/`new` 收到一起**,所以它只用来**提议**合并;真正的裁决是
665
- "留来源最多的那张页",而且删之前还有 `--dry-run` 可以看名单。
666
- """
667
- stripped = NORM_STRIP_RE.sub('', name.casefold().strip())
668
- return re.sub(r'(?<=[a-z])s$', '', stripped)
655
+ # `normalize_concept_name`(以及它用的 `NORM_STRIP_RE`)现在住在 `_utils`,与 `wiki_lint`
656
+ # 共用一份 —— 见那里的说明。留这句是为了下次有人在这里找它时不用翻。
669
657
 
670
658
 
671
659
  def build_pages_from_cards(pages_dir: str, card_dirs=None, dry_run: bool = False,
@@ -782,6 +770,7 @@ def merge_duplicate_pages(pages_dir: str, dry_run: bool = False) -> dict:
782
770
  text = main.read_text(encoding='utf-8')
783
771
  fm, body = parse_frontmatter(text)
784
772
  aliases = [str(a) for a in (fm.get('aliases') or [])]
773
+ main_sources = [str(s) for s in (fm.get('sources') or [])]
785
774
  keep, have = [], set()
786
775
  for line in text.split('\n'):
787
776
  if line.startswith('- [[') and ']] ' + SEPARATOR + ' ' in line:
@@ -799,6 +788,16 @@ def merge_duplicate_pages(pages_dir: str, dry_run: bool = False) -> dict:
799
788
  keep.append(line)
800
789
  moved += 1
801
790
  other_fm, _ = parse_frontmatter(other_text)
791
+ # `sources:` 也要取并集。**这是 2026-09-28 补的**:此前它只从主页面带过去,
792
+ # 于是被并那张卡的名单整条消失 —— 实测合并的 315 组**每一组**都少了至少一条。
793
+ # 这个键不是装饰:`--relabel` 靠 `source_kinds_for(frontmatter['sources'])` 推
794
+ # `来源/文章|聊天|收藏` 标签,少一条就可能少一个标签。正文的来源行一直是对的
795
+ # (上面并过了),只有 frontmatter 这一侧漏。
796
+ # 同目录内各页的命名约定是一致的(`Wiki/Concepts` 一个知识库、`Chat/Concepts`
797
+ # 另一个),所以取并集不会把两套名字混进来。
798
+ for name in (other_fm.get('sources') or []):
799
+ if name not in main_sources:
800
+ main_sources.append(str(name))
802
801
  for name in [other.stem] + [str(x) for x in (other_fm.get('aliases') or [])]:
803
802
  if name != main.stem and name not in aliases:
804
803
  aliases.append(name)
@@ -810,6 +809,8 @@ def merge_duplicate_pages(pages_dir: str, dry_run: bool = False) -> dict:
810
809
  examples.append({'main': main.stem, 'absorbed': [o.stem for o in others]})
811
810
  if not dry_run:
812
811
  fm['aliases'] = sorted(aliases)
812
+ if main_sources:
813
+ fm['sources'] = main_sources
813
814
  write_with_frontmatter(str(main), fm,
814
815
  replace_source_section(body, sorted(keep)) if keep else body)
815
816
  return {'groups': merged, 'removed': removed, 'aliased': aliased,
@@ -971,7 +972,7 @@ def generate_concept(name: str, refs: list[dict], api_key: str, origin: str = ''
971
972
  body_parts.append(f'- [[{r["file"]}]] — {r["title"]}\n')
972
973
 
973
974
  # Frontmatter
974
- # 与正文同源同序:`--refresh-sources` 判"要不要写盘"就是看这两者一致不一致
975
+ # 与正文同源同序:`--refresh-sources` 判"要不要写盘"就是看这两者一致不一致
975
976
  source_files = [r['file'] for r in refs]
976
977
  today = time.strftime('%Y-%m-%d')
977
978
  fm = {