clearai-dsh 0.1.0
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/CHANGELOG.md +26 -0
- package/LICENSE +201 -0
- package/README.md +138 -0
- package/README.zh-CN.md +138 -0
- package/bin/clearai.mjs +224 -0
- package/brand/README.md +41 -0
- package/brand/logo-512-dark.png +0 -0
- package/brand/logo-512.png +0 -0
- package/brand/logo-lockup-dark.png +0 -0
- package/brand/logo-lockup.png +0 -0
- package/brand/logo-lockup.svg +12 -0
- package/brand/logo-wordmark.svg +6 -0
- package/brand/logo.svg +19 -0
- package/cordis.patch.yml +39 -0
- package/lib/client.js +3071 -0
- package/lib/fold.js +1576 -0
- package/lib/host.js +605 -0
- package/package.json +65 -0
- package/presets/clearai/agent.cordis.yml +226 -0
- package/presets/clearai/plugins/brain.js +547 -0
- package/presets/clearai/plugins/clearai-kernel.js +5485 -0
- package/presets/clearai/plugins/ontology.js +306 -0
- package/presets/clearai/plugins/prompts.js +312 -0
- package/presets/clearai/preset.yml +5 -0
- package/presets/clearai/skills/clearai-loop/SKILL.md +89 -0
- package/presets/clearai/template/knowledge/README.md +25 -0
- package/presets/clearai/template/memory/README.md +34 -0
- package/presets/clearai/template/project.md +49 -0
- package/presets/clearai/template/skills/README.md +37 -0
- package/presets/clearai/template/skills/chart-diagram-qa/SKILL.md +43 -0
- package/presets/clearai/template/skills/citation-management/SKILL.md +73 -0
- package/presets/clearai/template/skills/citation-management/references/bibtex_formatting.md +908 -0
- package/presets/clearai/template/skills/citation-management/references/citation_validation.md +794 -0
- package/presets/clearai/template/skills/citation-management/references/google_scholar_search.md +725 -0
- package/presets/clearai/template/skills/citation-management/references/metadata_extraction.md +870 -0
- package/presets/clearai/template/skills/citation-management/references/pubmed_search.md +839 -0
- package/presets/clearai/template/skills/citation-management/scripts/doi_to_bibtex.py +204 -0
- package/presets/clearai/template/skills/citation-management/scripts/extract_metadata.py +569 -0
- package/presets/clearai/template/skills/citation-management/scripts/format_bibtex.py +349 -0
- package/presets/clearai/template/skills/citation-management/scripts/generate_schematic.py +139 -0
- package/presets/clearai/template/skills/citation-management/scripts/generate_schematic_ai.py +817 -0
- package/presets/clearai/template/skills/citation-management/scripts/search_google_scholar.py +282 -0
- package/presets/clearai/template/skills/citation-management/scripts/search_pubmed.py +398 -0
- package/presets/clearai/template/skills/citation-management/scripts/validate_citations.py +497 -0
- package/presets/clearai/template/skills/data-analysis/SKILL.md +92 -0
- package/presets/clearai/template/skills/data-analysis/checklists/readiness_check.md +23 -0
- package/presets/clearai/template/skills/data-analysis/templates/analysis_report.md.tpl +63 -0
- package/presets/clearai/template/skills/data-analysis/templates/cleaning_rules_draft.yaml.tpl +32 -0
- package/presets/clearai/template/skills/data-analysis/templates/data_dictionary.md.tpl +12 -0
- package/presets/clearai/template/skills/data-analysis/templates/domain_knowledge_template.md.tpl +316 -0
- package/presets/clearai/template/skills/data-analysis/templates/feature_candidates.json.tpl +20 -0
- package/presets/clearai/template/skills/data-analysis/templates/quality_scorecard.md.tpl +30 -0
- package/presets/clearai/template/skills/data-analysis/workflows/01-data-profiling.md +42 -0
- package/presets/clearai/template/skills/data-analysis/workflows/02-quality-audit.md +36 -0
- package/presets/clearai/template/skills/data-analysis/workflows/03-physical-correlation.md +25 -0
- package/presets/clearai/template/skills/data-analysis/workflows/04-unstructured-mining.md +26 -0
- package/presets/clearai/template/skills/data-qa-analysis/SKILL.md +102 -0
- package/presets/clearai/template/skills/data-qa-analysis/checklists/readiness_check.md +62 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/best_in_class_report.md.tpl +56 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/cleaning_rules_draft.yaml.tpl +56 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/data_dictionary.md.tpl +13 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/data_source_inventory_and_lineage.md.tpl +146 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/data_status_report.md.tpl +60 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/steady_state_rules.yaml.tpl +41 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/subsystem_registry.md.tpl +101 -0
- package/presets/clearai/template/skills/data-qa-analysis/templates/unified_execution_plan.md.tpl +100 -0
- package/presets/clearai/template/skills/data-qa-analysis/workflows/01-data-source-inventory-and-lineage.md +194 -0
- package/presets/clearai/template/skills/data-qa-analysis/workflows/02-data-alignment-and-tag-semantics.md +122 -0
- package/presets/clearai/template/skills/data-qa-analysis/workflows/03-steady-state-identification.md +126 -0
- package/presets/clearai/template/skills/data-qa-analysis/workflows/04-consumption-analysis.md +152 -0
- package/presets/clearai/template/skills/data-qa-analysis/workflows/05-best-in-class-and-optimization-space.md +78 -0
- package/presets/clearai/template/skills/domain-presearch/SKILL.md +131 -0
- package/presets/clearai/template/skills/domain-presearch/checklists/domain_checklist.md +24 -0
- package/presets/clearai/template/skills/domain-presearch/references/figure_code.md +78 -0
- package/presets/clearai/template/skills/domain-presearch/references/strategic_frameworks.md +38 -0
- package/presets/clearai/template/skills/exploration-loop/SKILL.md +81 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/SKILL.md +77 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/references/bioinformatics_genomics_formats.md +664 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/references/chemistry_molecular_formats.md +664 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/references/general_scientific_formats.md +518 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/references/microscopy_imaging_formats.md +620 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/references/proteomics_metabolomics_formats.md +517 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/references/spectroscopy_analytical_formats.md +633 -0
- package/presets/clearai/template/skills/exploratory-data-analysis/scripts/eda_analyzer.py +547 -0
- package/presets/clearai/template/skills/hypothesis-generation/SKILL.md +73 -0
- package/presets/clearai/template/skills/hypothesis-generation/references/experimental_design_patterns.md +329 -0
- package/presets/clearai/template/skills/hypothesis-generation/references/hypothesis_quality_criteria.md +198 -0
- package/presets/clearai/template/skills/hypothesis-generation/references/literature_search_strategies.md +622 -0
- package/presets/clearai/template/skills/hypothesis-generation/scripts/generate_schematic.py +139 -0
- package/presets/clearai/template/skills/hypothesis-generation/scripts/generate_schematic_ai.py +817 -0
- package/presets/clearai/template/skills/literature-review/SKILL.md +72 -0
- package/presets/clearai/template/skills/literature-review/references/citation_styles.md +166 -0
- package/presets/clearai/template/skills/literature-review/references/database_strategies.md +455 -0
- package/presets/clearai/template/skills/literature-review/scripts/generate_pdf.py +176 -0
- package/presets/clearai/template/skills/literature-review/scripts/generate_schematic.py +139 -0
- package/presets/clearai/template/skills/literature-review/scripts/generate_schematic_ai.py +817 -0
- package/presets/clearai/template/skills/literature-review/scripts/search_databases.py +303 -0
- package/presets/clearai/template/skills/literature-review/scripts/verify_citations.py +221 -0
- package/presets/clearai/template/skills/paper-lookup/SKILL.md +59 -0
- package/presets/clearai/template/skills/paper-lookup/references/arxiv.md +161 -0
- package/presets/clearai/template/skills/paper-lookup/references/biorxiv.md +118 -0
- package/presets/clearai/template/skills/paper-lookup/references/core.md +150 -0
- package/presets/clearai/template/skills/paper-lookup/references/crossref.md +181 -0
- package/presets/clearai/template/skills/paper-lookup/references/medrxiv.md +104 -0
- package/presets/clearai/template/skills/paper-lookup/references/openalex.md +174 -0
- package/presets/clearai/template/skills/paper-lookup/references/pmc.md +152 -0
- package/presets/clearai/template/skills/paper-lookup/references/pubmed.md +124 -0
- package/presets/clearai/template/skills/paper-lookup/references/semantic-scholar.md +203 -0
- package/presets/clearai/template/skills/paper-lookup/references/unpaywall.md +127 -0
- package/presets/clearai/template/skills/process-presearch/SKILL.md +196 -0
- package/presets/clearai/template/skills/process-presearch/checklists/process_checklist.md +18 -0
- package/presets/clearai/template/skills/process-presearch/references/figure_code.md +107 -0
- package/presets/clearai/template/skills/process-presearch/references/source_attribution_example.md +22 -0
- package/presets/clearai/template/skills/process-understanding-extraction/SKILL.md +69 -0
- package/presets/clearai/template/skills/process-understanding-extraction/checklists/readiness_check.md +34 -0
- package/presets/clearai/template/skills/process-understanding-extraction/templates/docx_raw_dump_extractor.py.tpl +132 -0
- package/presets/clearai/template/skills/process-understanding-extraction/templates/entity_map_unit_topology.json.tpl +86 -0
- package/presets/clearai/template/skills/process-understanding-extraction/templates/process_brief.md.tpl +89 -0
- package/presets/clearai/template/skills/process-understanding-extraction/templates/process_brief_builder_from_raw_dump.py.tpl +203 -0
- package/presets/clearai/template/skills/process-understanding-extraction/templates/process_flow_mermaid.md.tpl +41 -0
- package/presets/clearai/template/skills/process-understanding-extraction/templates/unified_execution_plan.md.tpl +53 -0
- package/presets/clearai/template/skills/process-understanding-extraction/workflows/01-process-doc-discovery.md +173 -0
- package/presets/clearai/template/skills/process-understanding-extraction/workflows/02-process-understanding-and-diagramming.md +106 -0
- package/presets/clearai/template/skills/scientific-brainstorming/SKILL.md +64 -0
- package/presets/clearai/template/skills/scientific-brainstorming/references/brainstorming_methods.md +326 -0
- package/presets/clearai/template/skills/scientific-critical-thinking/SKILL.md +72 -0
- package/presets/clearai/template/skills/scientific-critical-thinking/references/common_biases.md +364 -0
- package/presets/clearai/template/skills/scientific-critical-thinking/references/evidence_hierarchy.md +485 -0
- package/presets/clearai/template/skills/scientific-critical-thinking/references/experimental_design.md +496 -0
- package/presets/clearai/template/skills/scientific-critical-thinking/references/logical_fallacies.md +478 -0
- package/presets/clearai/template/skills/scientific-critical-thinking/references/scientific_method.md +169 -0
- package/presets/clearai/template/skills/scientific-critical-thinking/references/statistical_pitfalls.md +506 -0
- package/presets/clearai/template/skills/skill-creator/SKILL.md +109 -0
- package/presets/clearai/template/skills/skill-creator/references/authoring-guide.md +89 -0
- package/presets/clearai/template/skills/statistical-analysis/SKILL.md +79 -0
- package/presets/clearai/template/skills/statistical-analysis/references/assumptions_and_diagnostics.md +369 -0
- package/presets/clearai/template/skills/statistical-analysis/references/bayesian_statistics.md +653 -0
- package/presets/clearai/template/skills/statistical-analysis/references/effect_sizes_and_power.md +578 -0
- package/presets/clearai/template/skills/statistical-analysis/references/reporting_standards.md +469 -0
- package/presets/clearai/template/skills/statistical-analysis/references/test_selection_guide.md +129 -0
- package/presets/clearai/template/skills/statistical-analysis/scripts/assumption_checks.py +538 -0
- package/presets/clearai/template/skills/web-artifact/SKILL.md +165 -0
- package/presets/clearai/template/skills/web-artifact/assets/renderer/renderer.css +229 -0
- package/presets/clearai/template/skills/web-artifact/assets/renderer/renderer.js +373 -0
- package/presets/clearai/template/skills/web-artifact/assets/vendor/elkjs/LICENSE +263 -0
- package/presets/clearai/template/skills/web-artifact/assets/vendor/elkjs/UPSTREAM.md +26 -0
- package/presets/clearai/template/skills/web-artifact/assets/vendor/elkjs/elk.bundled.js +6605 -0
- package/presets/clearai/template/skills/web-artifact/references/when-drawing-a-topology.md +150 -0
- package/presets/clearai/template/skills/web-artifact/references/when-the-page-must-work-offline.md +62 -0
- package/presets/clearai/template/skills/web-artifact/scripts/check_artifact.py +167 -0
- package/presets/clearai/template/skills/web-artifact/scripts/render_topology.js +272 -0
- package/presets/clearai/template/skills/what-if-oracle/LICENSE.txt +5 -0
- package/presets/clearai/template/skills/what-if-oracle/SKILL.md +72 -0
- package/presets/clearai/template/skills/what-if-oracle/references/scenario-templates.md +154 -0
package/bin/clearai.mjs
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* clearai-dsh 的安装侧工具:**只做三件事,而且都不改别人的东西**。
|
|
4
|
+
*
|
|
5
|
+
* 分包的三样东西落在三个平面:
|
|
6
|
+
* · 宿主半(`lib/host.js`)—— 由包自带的 `cordis.patch.yml` 在 profile 层插一行,`dsh plugin add` 自动生效;
|
|
7
|
+
* · 浏览器半(`lib/client.js`)—— 同一份清单里的 `dsh.client`,浏览器 Loader 自己扫;
|
|
8
|
+
* · agent 预设(`presets/clearai/`)—— **名册(roster)只从 root 目录扫**,包没法直接声明,
|
|
9
|
+
* 所以要么把 root 指进包里,要么把它播种到用户根。这一件就是本工具存在的理由。
|
|
10
|
+
*
|
|
11
|
+
* 三种处理方式(按「原生程度」排序,默认只**打印**不改):
|
|
12
|
+
* doctor 看现状:包在哪、预设在哪、名册能不能看见它、探测到的 dsh / profile 是什么
|
|
13
|
+
* root-yaml 打印**可以直接粘进 profile 的 `cordis.patch.yml`** 的那一行(路径已算成绝对路径)
|
|
14
|
+
* seed 把预设**播种**到用户根 `~/.dsh/.agent-presets/<id>`(带哈希记账:改过的不覆盖)
|
|
15
|
+
* unseed 撤掉播种:只删「我们播的、且没被改过」的文件;用户 fork 的 id 一律不碰
|
|
16
|
+
*
|
|
17
|
+
* 纪律(与内核播种模板技能同一条):**改过的东西不覆盖,只如实报漂移**;删东西之前先看哈希。
|
|
18
|
+
* 不改用户的 `cordis.patch.yml` —— 那一行的内容由人自己粘(工具只负责把绝对路径算对)。
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { createHash } from 'node:crypto'
|
|
22
|
+
import { execFileSync } from 'node:child_process'
|
|
23
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
24
|
+
import { homedir } from 'node:os'
|
|
25
|
+
import { dirname, join, relative, resolve } from 'node:path'
|
|
26
|
+
import { fileURLToPath } from 'node:url'
|
|
27
|
+
|
|
28
|
+
const HERE = dirname(fileURLToPath(import.meta.url))
|
|
29
|
+
const PKG_DIR = resolve(HERE, '..')
|
|
30
|
+
const PRESET_ID = 'clearai'
|
|
31
|
+
const PRESET_SRC = join(PKG_DIR, 'presets', PRESET_ID)
|
|
32
|
+
const DSH_HOME = process.env.DSH_HOME ?? join(homedir(), '.dsh')
|
|
33
|
+
const LEDGER = join(DSH_HOME, '.clearai-dsh.json')
|
|
34
|
+
|
|
35
|
+
const argv = process.argv.slice(2)
|
|
36
|
+
const command = argv[0] ?? 'doctor'
|
|
37
|
+
const flag = (name) => argv.includes(`--${name}`)
|
|
38
|
+
const value = (name, fallback) => {
|
|
39
|
+
const index = argv.indexOf(`--${name}`)
|
|
40
|
+
return index >= 0 && argv[index + 1] !== undefined ? argv[index + 1] : fallback
|
|
41
|
+
}
|
|
42
|
+
const profile = value('profile', 'web')
|
|
43
|
+
|
|
44
|
+
/** 递归列出文件(相对路径 → sha256 前 16 位)。只为记账,不为校验完整性。 */
|
|
45
|
+
function hashTree(root) {
|
|
46
|
+
const out = {}
|
|
47
|
+
const walk = (dir) => {
|
|
48
|
+
let entries = []
|
|
49
|
+
try {
|
|
50
|
+
entries = readdirSync(dir, { withFileTypes: true })
|
|
51
|
+
} catch {
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
for (const entry of entries) {
|
|
55
|
+
const full = join(dir, entry.name)
|
|
56
|
+
if (entry.isDirectory()) walk(full)
|
|
57
|
+
else if (entry.isFile()) out[relative(root, full)] = createHash('sha256').update(readFileSync(full)).digest('hex').slice(0, 16)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
walk(root)
|
|
61
|
+
return out
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function readLedger() {
|
|
65
|
+
try {
|
|
66
|
+
const parsed = JSON.parse(readFileSync(LEDGER, 'utf8'))
|
|
67
|
+
return parsed !== null && typeof parsed === 'object' ? parsed : {}
|
|
68
|
+
} catch {
|
|
69
|
+
return {}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function writeLedger(next) {
|
|
74
|
+
try {
|
|
75
|
+
mkdirSync(dirname(LEDGER), { recursive: true })
|
|
76
|
+
writeFileSync(LEDGER, `${JSON.stringify(next, null, 2)}\n`, 'utf8')
|
|
77
|
+
return true
|
|
78
|
+
} catch {
|
|
79
|
+
return false
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** 名册会扫哪些 root —— 与 `@deepseek-ai/dsh-agent-presets` 的规则同形(自带 → 配置 → 用户根)。 */
|
|
84
|
+
function rosterRoots() {
|
|
85
|
+
return [join(DSH_HOME, '.agent-presets')]
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function doctor() {
|
|
89
|
+
const rows = []
|
|
90
|
+
rows.push(`包目录 ${PKG_DIR}`)
|
|
91
|
+
rows.push(`预设源 ${PRESET_SRC}${existsSync(join(PRESET_SRC, 'agent.cordis.yml')) ? '(agent.cordis.yml ✓)' : '(缺 agent.cordis.yml ✗)'}`)
|
|
92
|
+
rows.push(`DSH_HOME ${DSH_HOME}`)
|
|
93
|
+
const roots = rosterRoots()
|
|
94
|
+
for (const root of roots) {
|
|
95
|
+
const dir = join(root, PRESET_ID)
|
|
96
|
+
const present = existsSync(join(dir, 'agent.cordis.yml'))
|
|
97
|
+
rows.push(`用户根 ${dir} ${present ? '✓ 名册看得见' : '✗ 还没有(用 seed 播种,或把 root-yaml 那一行粘进 profile)'}`)
|
|
98
|
+
}
|
|
99
|
+
const profileDir = join(DSH_HOME, 'profiles', profile)
|
|
100
|
+
rows.push(`profile ${profileDir}${existsSync(profileDir) ? '' : '(不存在:先跑一次 dsh --profile ' + profile + ')'}`)
|
|
101
|
+
/**
|
|
102
|
+
* 宿主行与名册 root **问组合**,不问某个文件(2026-09-11 修:装出来的形态下这两行来自
|
|
103
|
+
* **包的补丁层**,不在 profile 的 cordis.patch.yml 里 —— 读文件的写法会误报「还没挂」)。
|
|
104
|
+
* 事实在组合里;问不到就如实说问不到,不猜。
|
|
105
|
+
*/
|
|
106
|
+
const composed = (() => {
|
|
107
|
+
try {
|
|
108
|
+
return execFileSync('npx', ['--no-install', '@deepseek-ai/dsh', '--profile', profile, '--dump-config'], { encoding: 'utf8', env: { ...process.env, DSH_HOME }, timeout: 120000, stdio: ['ignore', 'pipe', 'ignore'] })
|
|
109
|
+
} catch {
|
|
110
|
+
return null
|
|
111
|
+
}
|
|
112
|
+
})()
|
|
113
|
+
if (composed === null) {
|
|
114
|
+
rows.push('组合 (问不到:dsh 不可用或超时 —— 下面两条无法判定)')
|
|
115
|
+
} else {
|
|
116
|
+
const rowIds = [...composed.matchAll(/^- id: (\S+)$/gm)].map((match) => match[1])
|
|
117
|
+
rows.push(`宿主行 ${rowIds.includes('clearai-host') ? '在组合里 ✓' : '不在组合里(先 dsh plugin --profile ' + profile + ' add <本包>)'}`)
|
|
118
|
+
const roster = /- id: agent-presets[\s\S]{0,600}?\n\s*- path:[^\n]*/.exec(composed)
|
|
119
|
+
const expr = roster === null ? null : roster[0].split('\n').pop().trim()
|
|
120
|
+
rows.push(`名册 root ${expr === null ? '组合里没看到 roots(这个部署可能不挂名册)' : `${expr}(dump 打的是表达式原文,求值在装载时)`}`)
|
|
121
|
+
}
|
|
122
|
+
const ledger = readLedger()
|
|
123
|
+
rows.push(`播种记账 ${Object.keys(ledger).length === 0 ? '(空)' : `${Object.keys(ledger).length} 个条目 · ${LEDGER}`}`)
|
|
124
|
+
for (const row of rows) console.log(` ${row}`)
|
|
125
|
+
console.log('\n提示:doctor 只读;它不会替你改 profile,也不会替你播种。')
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function rootYaml() {
|
|
129
|
+
const line = [
|
|
130
|
+
'# ClearAI 预设的 root(由 clearai-dsh 的 bin 打印,路径已算成绝对路径)',
|
|
131
|
+
'- id: \'@deepseek-ai/dsh-agent-presets\'',
|
|
132
|
+
' config:',
|
|
133
|
+
' # ⚠️ 补丁层会**替换整份 config**:下面这些键必须与你部署里那份一致,否则会丢。',
|
|
134
|
+
' # 先 `dsh --profile <p> --dump-config | grep -A 20 agent-presets` 看一眼当前值再粘。',
|
|
135
|
+
' default: standard',
|
|
136
|
+
' includeShippedRoot: true',
|
|
137
|
+
' includeUserRoot: true',
|
|
138
|
+
' roots:',
|
|
139
|
+
` - path: '${join(PKG_DIR, 'presets')}'`,
|
|
140
|
+
' trust: system',
|
|
141
|
+
].join('\n')
|
|
142
|
+
console.log(line)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function seed() {
|
|
146
|
+
if (!existsSync(join(PRESET_SRC, 'agent.cordis.yml'))) {
|
|
147
|
+
console.error(`✗ 包里没有预设:${PRESET_SRC}`)
|
|
148
|
+
process.exit(1)
|
|
149
|
+
}
|
|
150
|
+
const root = value('root', rosterRoots()[0])
|
|
151
|
+
const dest = join(root, PRESET_ID)
|
|
152
|
+
const next = hashTree(PRESET_SRC)
|
|
153
|
+
const before = readLedger()
|
|
154
|
+
const previous = before[PRESET_ID]?.files ?? {}
|
|
155
|
+
const seeded = []
|
|
156
|
+
const refreshed = []
|
|
157
|
+
const drifted = []
|
|
158
|
+
for (const [rel, hash] of Object.entries(next)) {
|
|
159
|
+
const target = join(dest, rel)
|
|
160
|
+
const onDisk = existsSync(target) ? createHash('sha256').update(readFileSync(target)).digest('hex').slice(0, 16) : null
|
|
161
|
+
if (onDisk === null) {
|
|
162
|
+
mkdirSync(dirname(target), { recursive: true })
|
|
163
|
+
cpSync(join(PRESET_SRC, rel), target)
|
|
164
|
+
seeded.push(rel)
|
|
165
|
+
continue
|
|
166
|
+
}
|
|
167
|
+
if (onDisk === hash) continue
|
|
168
|
+
// 改过的不覆盖:与内核播种模板技能同一条纪律
|
|
169
|
+
if (previous[rel] !== undefined && onDisk !== previous[rel]) {
|
|
170
|
+
drifted.push(rel)
|
|
171
|
+
continue
|
|
172
|
+
}
|
|
173
|
+
cpSync(join(PRESET_SRC, rel), target)
|
|
174
|
+
refreshed.push(rel)
|
|
175
|
+
}
|
|
176
|
+
before[PRESET_ID] = { files: next, at: new Date().toISOString(), dest }
|
|
177
|
+
writeLedger(before)
|
|
178
|
+
console.log(` 播种到 ${dest}`)
|
|
179
|
+
console.log(` 新增 ${seeded.length} · 刷新 ${refreshed.length}${drifted.length === 0 ? '' : ` · **你改过、没覆盖** ${drifted.length}(${drifted.slice(0, 5).join('、')})`}`)
|
|
180
|
+
console.log(' 下一步:重启 dsh(或刷新页面)后,预设选择器里应出现「ClearAI」。')
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function unseed() {
|
|
184
|
+
const ledger = readLedger()
|
|
185
|
+
const entry = ledger[PRESET_ID]
|
|
186
|
+
if (entry === undefined) {
|
|
187
|
+
console.log(' 没有播种记账:什么都不做(不知道哪些是我们播的,就不删)。')
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
const dest = entry.dest ?? join(rosterRoots()[0], PRESET_ID)
|
|
191
|
+
const removed = []
|
|
192
|
+
const kept = []
|
|
193
|
+
for (const [rel, hash] of Object.entries(entry.files ?? {})) {
|
|
194
|
+
const target = join(dest, rel)
|
|
195
|
+
if (!existsSync(target)) continue
|
|
196
|
+
const onDisk = createHash('sha256').update(readFileSync(target)).digest('hex').slice(0, 16)
|
|
197
|
+
if (onDisk === hash) {
|
|
198
|
+
rmSync(target)
|
|
199
|
+
removed.push(rel)
|
|
200
|
+
} else {
|
|
201
|
+
kept.push(rel)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
delete ledger[PRESET_ID]
|
|
205
|
+
writeLedger(ledger)
|
|
206
|
+
console.log(` 删掉 ${removed.length} 个「我们播的、没被改过」的文件`)
|
|
207
|
+
if (kept.length > 0) console.log(` **保留** ${kept.length} 个你改过的文件(它们现在是你的):${kept.slice(0, 5).join('、')}`)
|
|
208
|
+
// 空目录收掉(只收我们知道的那些;非空绝不动)
|
|
209
|
+
try {
|
|
210
|
+
if (existsSync(dest) && readdirSync(dest).length === 0) rmSync(dest, { recursive: true })
|
|
211
|
+
} catch {
|
|
212
|
+
/* 收不掉就算了,不影响判定 */
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (command === 'doctor') doctor()
|
|
217
|
+
else if (command === 'root-yaml') rootYaml()
|
|
218
|
+
else if (command === 'seed') seed()
|
|
219
|
+
else if (command === 'unseed') unseed()
|
|
220
|
+
else if (command === 'version' || flag('version')) console.log(JSON.parse(readFileSync(join(PKG_DIR, 'package.json'), 'utf8')).version)
|
|
221
|
+
else {
|
|
222
|
+
console.error(`unknown command: ${command}\n用法:clearai-dsh [doctor|root-yaml|seed|unseed] [--profile web] [--root <dir>]`)
|
|
223
|
+
process.exit(2)
|
|
224
|
+
}
|
package/brand/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ClearAI brand mark
|
|
2
|
+
|
|
3
|
+
**The mark is one glyph: the opening of a `c`, plus one fact.**
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
c = Clear (say it clearly)
|
|
7
|
+
opening = it does not close — completion passes admission, it is not declared by the model
|
|
8
|
+
solid dot = a fact (the emerald used in the world tree when a branch is adopted)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Three meanings in one shape, nothing spare. That is why it was chosen.
|
|
12
|
+
|
|
13
|
+
## Files
|
|
14
|
+
|
|
15
|
+
| File | What it is | Used by |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `logo.svg` | **the single master** (1024 grid; the main stroke is `currentColor`) | every bitmap is generated from it |
|
|
18
|
+
| `logo-wordmark.svg` | the wordmark `clearai` (`clear` in ink, `ai` in brand teal); typeset, not outlined | lockups |
|
|
19
|
+
| `logo-lockup.svg` | mark + wordmark, horizontally locked | README, package page, documents |
|
|
20
|
+
| `logo-512.png` · `logo-512-dark.png` | the mark, transparent, ink / inverted | README (light / dark) |
|
|
21
|
+
| `logo-lockup.png` · `logo-lockup-dark.png` | the lockup, ink / inverted | README, npm page |
|
|
22
|
+
| `build-icons.mjs` | **the generator**: master → the four bitmaps above | re-run it after any change to the master |
|
|
23
|
+
|
|
24
|
+
Bitmaps are never hand-edited: `build-icons.mjs` regenerates the whole set in one command, and a hand-exported file would be a second ledger for the brand.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
node brand/build-icons.mjs # needs google-chrome on PATH (headless rasteriser)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Rules
|
|
31
|
+
|
|
32
|
+
- **Minimum size 16px.** The 16px column is the only judge; test any new proposal there first.
|
|
33
|
+
- **One source, two themes.** The main stroke is `currentColor`; colour comes from context, so it is never hard-coded in the master.
|
|
34
|
+
- **The dot stays emerald `#10B981`.** It is a product-semantic colour (the world tree's "adopted / settled"), and does not follow the theme.
|
|
35
|
+
- **Do not move the dot back to the centre.** A dot at the centre is © and CircleCI (ring plus centre dot — same structure); our dot sits **in the opening**.
|
|
36
|
+
- **Do not straighten the opening.** An opening pointing due right is just a `c`; angled up-right (centred on −35°) is what makes it recognisable.
|
|
37
|
+
- Backgrounds: light `#FBFAF7` (warm paper) / dark `#1C1A18` (warm ink); brand teal `#3E8E7A`.
|
|
38
|
+
|
|
39
|
+
## What was removed
|
|
40
|
+
|
|
41
|
+
Only the chosen brand assets and their generator belong to this repository. The master artwork is the sole source for generated bitmaps; no external archive or prior design process is required to interpret the brand.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!-- 组合标:主标 + 字标(横向锁定;间距 = 主标宽度的 18%) -->
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1088 240" width="1088" height="240" fill="none">
|
|
3
|
+
<g transform="translate(0,20) scale(0.1953)">
|
|
4
|
+
<circle cx="512" cy="512" r="326" stroke="currentColor" stroke-width="118" pathLength="360"
|
|
5
|
+
stroke-dasharray="270 90" stroke-linecap="round" transform="rotate(10 512 512)"/>
|
|
6
|
+
<circle cx="792" cy="308" r="104" fill="#10B981"/>
|
|
7
|
+
</g>
|
|
8
|
+
<g transform="translate(268,0)">
|
|
9
|
+
<text x="0" y="178" font-family="Helvetica Neue, Helvetica, Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif"
|
|
10
|
+
font-size="196" font-weight="560" letter-spacing="-7" fill="currentColor">clear<tspan fill="#3E8E7A">ai</tspan></text>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!-- 字标(排版示意;真做要转曲或定制字形):clear 用墨色,ai 用品牌青。
|
|
2
|
+
它只与主标**组合**使用,不单独当应用图标(16px 下字母没意义)。 -->
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 880 240" width="880" height="240" fill="none">
|
|
4
|
+
<text x="0" y="178" font-family="Helvetica Neue, Helvetica, Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif"
|
|
5
|
+
font-size="196" font-weight="560" letter-spacing="-7" fill="currentColor">clear<tspan fill="#3E8E7A">ai</tspan></text>
|
|
6
|
+
</svg>
|
package/brand/logo.svg
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
ClearAI 主标 —— 「c 的开口 + 一颗事实点」(定稿,w2c)。
|
|
3
|
+
|
|
4
|
+
为什么长这样(三件语义一个字形):
|
|
5
|
+
· c = Clear(说清楚)
|
|
6
|
+
· 开口 = 不闭合:完成要过观测准入,不由模型宣布(缺口**故意**留在右上,不是正右)
|
|
7
|
+
· 实心点 = 事实(世界树里「采纳/落定」那枚 emerald)
|
|
8
|
+
|
|
9
|
+
结构上与已知标记刻意错开:©(C 在圈里)、CircleCI(环 + **圆心**点)、Coda(C 在方块里)——
|
|
10
|
+
我们的点**不在圆心**,而在**开口里**;开口**斜朝右上**,不是正右。
|
|
11
|
+
|
|
12
|
+
几何(1024 网格):环心线 R=326,笔画 118,开口 90° 以 -35° 为中心;点 r=104,坐在开口的角平分线上。
|
|
13
|
+
主笔是 currentColor(深浅两版同一份源),点固定 emerald(产品里「采纳/落定」的颜色)。
|
|
14
|
+
-->
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1024" height="1024" fill="none">
|
|
16
|
+
<circle cx="512" cy="512" r="326" stroke="currentColor" stroke-width="118" pathLength="360"
|
|
17
|
+
stroke-dasharray="270 90" stroke-linecap="round" transform="rotate(10 512 512)"/>
|
|
18
|
+
<circle cx="792" cy="308" r="104" fill="#10B981"/>
|
|
19
|
+
</svg>
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# clearai-dsh 的 bundle patch:宿主平面的一行。
|
|
2
|
+
#
|
|
3
|
+
# 为什么宿主半必须在**补丁层**而不是 agent 预设里:
|
|
4
|
+
# 客户端模块扫描只扫宿主 Loader 的行 —— 预设里的行浏览器看不见,面板就长不出来。
|
|
5
|
+
# 而投影单元 `clearai`(把工具写下的变更记录折成视图)也是宿主平面的:它在会话日志上注册一个投影,
|
|
6
|
+
# 多个会话共享同一个注册表。
|
|
7
|
+
#
|
|
8
|
+
# 行名用**包名**(不是文件路径):Loader 从组合自身的 base 解析它,也就是装进 profile 的那份包。
|
|
9
|
+
# 打包纪律④:发行物里不出现任何绝对路径,也不出现仓库结构。
|
|
10
|
+
|
|
11
|
+
- insert:
|
|
12
|
+
- id: clearai-host
|
|
13
|
+
name: 'clearai-dsh'
|
|
14
|
+
|
|
15
|
+
# 预设(agent.cordis.yml)不在补丁层 —— 它由名册(roster)从 preset root 扫描。
|
|
16
|
+
# 预设的注册方式有三种候选(补丁层重述名册行 / 播种到用户根 / 打印待粘贴的行),
|
|
17
|
+
# 由 S2 的干净 profile 探针决定,不在这里拍脑袋。
|
|
18
|
+
|
|
19
|
+
# ── 预设的 root:现场算出来,零安装期写入(S2 探针的结论)──────────────────────
|
|
20
|
+
#
|
|
21
|
+
# 名册(roster)只从 **root 目录**扫预设,而后端包没法自己声明一个 root —— 这是整个打包里
|
|
22
|
+
# 唯一没有现成通道的一环。S2 在干净 profile 上把三件事都量过了:
|
|
23
|
+
# · `!!js` 在**补丁行**里确实会被求值(与自带补丁用 `!!js dshHomePath(...)` 同一条路);
|
|
24
|
+
# · 但 `baseUrl` 在补丁层里是**profile 目录**,不是本包目录(`resolvedRoots` 实测:
|
|
25
|
+
# `path:"BASEURL=file:///…/profiles/clearai-test/"`)——所以「拿 baseUrl 当包目录」不成立;
|
|
26
|
+
# · 而包在 profile 里的位置是**可预测的**:`dsh plugin add` 就是把它装进 profile 的
|
|
27
|
+
# `node_modules/`。于是 root 可以现场算出来:`<profile>/node_modules/clearai-dsh/presets/`。
|
|
28
|
+
#
|
|
29
|
+
# 于是不需要任何安装期写入(不改用户的文件、不需要 bin 先跑一遍),归属也落在 system 信任层。
|
|
30
|
+
# 想改预设的人仍然有两条路:`clearai-dsh seed`(播种到用户根,可改可回滚)或复制成新 id。
|
|
31
|
+
- id: agent-presets
|
|
32
|
+
config:
|
|
33
|
+
# ⚠️ 补丁层替换**整份** config:下面这些键要与部署里那份保持一致(上游将来加字段要跟上)。
|
|
34
|
+
default: standard
|
|
35
|
+
includeShippedRoot: true
|
|
36
|
+
includeUserRoot: true
|
|
37
|
+
roots:
|
|
38
|
+
- path: !!js "process.getBuiltinModule('node:url').fileURLToPath(new URL('node_modules/clearai-dsh/presets/', baseUrl))"
|
|
39
|
+
trust: system
|