diy-pc-ingest
Setup (required)
This skill is intended to be shared. Do not hardcode your Notion IDs or token in the skill.
Install the required dependency skill via ClawHub before using this skill:
CODEBLOCK0
1) Read the "DIY-PC Notion Targets" table in TOOLS.md for the datasourceid and database_id values for each target. Pass them as explicit CLI arguments:
- -
--pcconfig-dsid, INLINECODE1 - INLINECODE2 , INLINECODE3
- INLINECODE4 , INLINECODE5
- INLINECODE6 , INLINECODE7
2) Provide Notion auth for notion-api-automation (notionctl):
- - env:
NOTION_API_KEY (recommended)
Notes:
- - This skill uses Notion-Version
2025-09-03 by default.
Data flow disclosure
- - Local input: pasted receipts/spec notes are parsed locally.
- External enrichment (optional):
web_search/web_fetch may send partial product text to external web providers. - Notion write path: records are queried/upserted via
notion-api-automation/scripts/notionctl.mjs.
Security rules:
- - If user does not want external enrichment, skip
web_search/web_fetch and proceed with local extraction only. - Use minimal-scope Notion integration permissions (only target DIY_PC data sources).
Canonical Notion targets
Use data_sources endpoints for schema/query, and pages endpoint for row creation.
IDs are documented in the "DIY-PC Notion Targets" table in TOOLS.md. Pass them as CLI arguments at runtime.
Workflow (A: user pastes raw text)
1) Read the pasted text and decide target table per item:
- エンクロージャー: USB/RAID/HDDケース/ドック、ベイ数、JAN/型番、"安全な取り外し"表示名。
- ストレージ: HDD/SSD/NVMe/SATA/容量/シリアル/健康状態。
- PCConfig: CPU/GPU/RAM/PSU/MB/ケース/冷却/NIC/キャプチャ等。
2) Extract fields (best-effort). Prefer Japanese column names as they exist in each table.
3) Enrich specs using websearch/webfetch when it reduces user work (e.g., bay count, interface, capacity, form factor). Keep it minimal; don't overfill.
4) Ask follow-up questions only for fields needed to avoid ambiguity or bad joins.
- ストレージ: Serial missing → ask for serial (or confirm creating as "暫定/シリアル不明").
- エンクロージャー: ベイ数 or USB/Thunderbolt/LAN unclear → ask.
- PCConfig: Identifier/型番 missing but needed to match existing row → ask.
- - If a key collides with multiple rows, do not write; ask user.
5) Search existing records in Notion using scripts/notion_apply_records.js (auto-discovery mode):
- Provide JSONL records (one per item) on stdin.
- Script will:
- find an existing row by key (see below)
- report what would be created/updated/skipped without making changes
- Do not write anything (no create/update operations)
- Use this to preview results before actual upsert.
6) Review search results and confirm with user:
- Show what would be created/updated/skipped
- Ask for confirmation before proceeding to actual upsert
7) Upsert into Notion using scripts/notion_apply_records.js:
- Provide JSONL records (one per item) on stdin.
- Script will:
- find an existing row by key (see below)
- patch only missing fields unless overwrite=true
- otherwise create a new row
8) Report results (created/updated/skipped) and link any created rows.
3
Upsert keys (rules)
- - ストレージ:
シリアル (exact) is the primary key. If the existing row was created without serial, allow a safe fallback match by title + (optional) 購入日/価格(円) to support post-fill of serial/health/scan-date. - エンクロージャー:
取り外し表示名 (exact) else title/name. - PCConfig:
(Name + Purchase Date) を複合キーとして扱う(exact)。重複ヒット時は書き込まず質問。 - If a key collides with multiple rows, do not write; ask user.
JSONL input format for the apply script
Each line is a JSON object:
CODEBLOCK1
Optional control fields (for cleanup / manual fixes):
- -
page_id (or id): update this Notion page directly (bypasses upsert matching) - INLINECODE27 : archive the page (useful for de-dup)
- INLINECODE28 : allow overwriting existing values (including clearing with null)
Optional behavior flags:
- -
mirror_to_pcconfig: true (only for target=storage): also create/update a pcconfig row for the installed component.
- requires:
現在の接続先PC,
購入日, INLINECODE34
Targets: INLINECODE35
Property value encoding:
- - select/status: string name
- richtext: string
- number: number
- date: INLINECODE36
- checkbox: boolean
- relation: array of pageids (advanced; avoid unless needed)
Notes
- - Always use Notion-Version
2025-09-03. - Prefer
POST /v1/data_sources/{id}/query over /databases/{id}/query. - Relation schema updates require
relation.data_source_id (not database_id).
Note (implementation)
- - JS implementation is the default: INLINECODE41
- Legacy Python implementation is kept for reference: INLINECODE42
Notion tooling (recommended)
- - Install
notion-api-automation via ClawHub for Notion API debugging: INLINECODE44 - This skill does not depend on
skills/notionkit/*. - Primary ingestion path is
scripts/notion_apply_records.js; use skills/notion-api-automation/scripts/notionctl.mjs for diagnostics/manual API operations.
diy-pc-ingest
设置(必需)
此技能旨在共享。请不要在技能中硬编码您的Notion ID或令牌。
使用此技能前,请通过ClawHub安装所需的依赖技能:
clawhub install notion-api-automation
1) 阅读TOOLS.md中的DIY-PC Notion Targets表格,获取每个目标对应的datasourceid和database_id值。将它们作为显式CLI参数传递:
- - --pcconfig-dsid、--pcconfig-dbid
- --pcinput-dsid、--pcinput-dbid
- --storage-dsid、--storage-dbid
- --enclosure-dsid、--enclosure-dbid
2) 为notion-api-automation(notionctl)提供Notion认证:
注意:
- - 此技能默认使用Notion-Version 2025-09-03。
数据流说明
- - 本地输入:粘贴的收据/规格说明在本地解析。
- 外部增强(可选):websearch/webfetch可能将部分产品文本发送到外部网络提供商。
- Notion写入路径:通过notion-api-automation/scripts/notionctl.mjs查询/更新记录。
安全规则:
- - 如果用户不希望进行外部增强,则跳过websearch/webfetch,仅进行本地提取。
- 使用最小范围的Notion集成权限(仅针对DIY_PC数据源)。
标准Notion目标
使用data_sources端点进行模式/查询,使用pages端点创建行。
ID记录在TOOLS.md的DIY-PC Notion Targets表格中。运行时作为CLI参数传递。
工作流程(A:用户粘贴原始文本)
1) 读取粘贴的文本,为每个项目决定目标表格:
- エンクロージャー:USB/RAID/HDDケース/ドック、ベイ数、JAN/型番、安全な取り外し表示名。
- ストレージ:HDD/SSD/NVMe/SATA/容量/シリアル/健康状態。
- PCConfig:CPU/GPU/RAM/PSU/MB/ケース/冷却/NIC/キャプチャ等。
2) 提取字段(尽力而为)。优先使用每个表格中存在的日文列名。
3) 使用websearch/webfetch丰富规格信息,当这能减少用户工作量时(例如,托架数量、接口、容量、外形尺寸)。保持最小化;不要过度填充。
4) 仅针对避免歧义或错误关联所需的字段提出后续问题。
- ストレージ:缺少序列号 → 询问序列号(或确认创建为暂定/シリアル不明)。
- エンクロージャー:托架数量或USB/Thunderbolt/LAN不明确 → 询问。
- PCConfig:标识符/型号缺失但需要匹配现有行 → 询问。
5) 使用scripts/notionapplyrecords.js搜索Notion中的现有记录(自动发现模式):
- 在标准输入中提供JSONL记录(每项一条)。
- 脚本将:
- 通过键查找现有行(见下文)
- 报告将要创建/更新/跳过的内容,但不进行更改
- 不写入任何内容(不执行创建/更新操作)
- 在实际更新前使用此功能预览结果。
6) 审查搜索结果并与用户确认:
- 显示将要创建/更新/跳过的内容
- 在实际更新前请求确认
7) 使用scripts/notionapplyrecords.js更新到Notion:
- 在标准输入中提供JSONL记录(每项一条)。
- 脚本将:
- 通过键查找现有行(见下文)
- 仅修补缺失字段,除非overwrite=true
- 否则创建新行
8) 报告结果(已创建/已更新/已跳过)并链接任何已创建的行。
更新键(规则)
- - ストレージ:シリアル(精确匹配)是主键。如果现有行创建时没有序列号,允许通过标题+(可选)購入日/価格(円)进行安全回退匹配,以支持后续填充序列号/健康状态/扫描日期。
- エンクロージャー:取り外し表示名(精确匹配),否则使用标题/名称。
- PCConfig:将(Name + Purchase Date)作为复合键处理(精确匹配)。重复命中时不写入,询问用户。
- 如果某个键与多行冲突,则不写入;询问用户。
应用脚本的JSONL输入格式
每行是一个JSON对象:
json
{target:enclosure,title:RATOC RS-EC32-R5G,properties:{種別:USBケース,接続:USB,ベイ数:2,普段つないでるPC:RECRYZEN,購入日:2026-01-18,購入店:PCワンズ,価格(円):8977,取り外し表示名:RS-EC32-R5G,メモ:JAN: 4949090752191}}
可选控制字段(用于清理/手动修复):
- - page_id(或id):直接更新此Notion页面(绕过更新匹配)
- archive: true:归档页面(用于去重)
- overwrite: true:允许覆盖现有值(包括使用null清除)
可选行为标志:
- - mirrortopcconfig: true(仅适用于target=storage):同时为已安装组件创建/更新pcconfig行。
- 需要:現在の接続先PC、購入日、Name
目标:enclosure | storage | pcconfig | pcinput
属性值编码:
- - select/status:字符串名称
- richtext:字符串
- number:数字
- date:YYYY-MM-DD
- checkbox:布尔值
- relation:pageid数组(高级用法;除非必要避免使用)
注意
- - 始终使用Notion-Version 2025-09-03。
- 优先使用POST /v1/datasources/{id}/query而非/databases/{id}/query。
- 关系模式更新需要relation.datasourceid(而非databaseid)。
注意(实现)
- - JS实现为默认:scripts/notionapplyrecords.js
- 保留旧版Python实现供参考:scripts/deprecated/notionapply_records.py
Notion工具(推荐)
- - 通过ClawHub安装notion-api-automation用于Notion API调试:clawhub install notion-api-automation
- 此技能不依赖skills/notionkit/*。
- 主要摄取路径为scripts/notionapplyrecords.js;使用skills/notion-api-automation/scripts/notionctl.mjs进行诊断/手动API操作。