@namewta/speculo 0.1.20 → 0.2.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/README.md +68 -78
- package/dist/src/cli.js +57 -34
- package/dist/src/cli.js.map +1 -1
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.js +128 -168
- package/dist/src/index.js.map +1 -1
- package/dist/src/migrate.d.ts +38 -0
- package/dist/src/migrate.js +646 -0
- package/dist/src/migrate.js.map +1 -0
- package/dist/src/workflows.d.ts +7 -37
- package/dist/src/workflows.js +49 -123
- package/dist/src/workflows.js.map +1 -1
- package/package.json +6 -4
- package/template/.speculo/README.md +20 -0
- package/template/.speculo/workspace.json +12 -0
- package/template/commands/docs-sync.md +28 -0
- package/template/commands/finalize.md +37 -0
- package/template/commands/knowledge-prune.md +20 -0
- package/template/commands/retro.md +15 -8
- package/template/commands/status.md +8 -51
- package/template/skills/agents-md-builder/SKILL.md +14 -101
- package/template/skills/change-lifecycle/SKILL.md +25 -0
- package/template/{workflows/dev/_templates → skills/change-lifecycle/assets}/completion-summary-template.md +2 -2
- package/template/{workflows/dev/_templates → skills/change-lifecycle/assets}/completion-verification-template.md +1 -1
- package/template/skills/change-lifecycle/references/completion-gate.md +19 -0
- package/template/skills/change-lifecycle/references/finalize-archive.md +32 -0
- package/template/skills/docs-sync/SKILL.md +22 -0
- package/template/skills/docs-sync/assets/report-template.md +45 -0
- package/template/skills/docs-sync/assets/state-template.json +20 -0
- package/template/skills/docs-sync/assets/workflow-scope-template.json +9 -0
- package/template/skills/docs-sync/references/agents-contract.md +43 -0
- package/template/skills/docs-sync/references/changelog-contract.md +39 -0
- package/template/skills/docs-sync/references/document-lifecycle-contract.md +38 -0
- package/template/skills/docs-sync/references/git-state-contract.md +67 -0
- package/template/skills/docs-sync/references/readme-contract.md +44 -0
- package/template/skills/docs-sync/references/workflow-scope-contract.md +50 -0
- package/template/skills/github-npm-ops/SKILL.md +14 -39
- package/template/skills/github-npm-ops/references/failure-recovery.md +3 -3
- package/template/skills/github-npm-ops/references/issue-pr-triage.md +1 -1
- package/template/skills/github-npm-ops/references/preflight-checklist.md +4 -4
- package/template/skills/github-npm-ops/references/release-notes-injection.md +1 -1
- package/template/skills/github-npm-ops/references/release-pipeline.md +13 -13
- package/template/skills/github-npm-ops/references/version-bump-flow.md +3 -3
- package/template/skills/knowledge-prune/SKILL.md +29 -0
- package/template/skills/knowledge-prune/references/audit-rules.md +24 -0
- package/template/skills/runtime-context/SKILL.md +43 -0
- package/template/skills/runtime-context/references/path-resolution.md +32 -0
- package/template/skills/speculo-retro/SKILL.md +13 -37
- package/template/skills/speculo-retro/references/friction-taxonomy.md +3 -3
- package/template/skills/speculo-retro/references/issue-drafting-sop.md +3 -3
- package/template/skills/worktree-isolation/SKILL.md +10 -46
- package/template/skills/worktree-isolation/references/audit-branch-tree.md +2 -2
- package/template/skills/worktree-isolation/references/create-worktree.md +6 -6
- package/template/skills/worktree-isolation/references/merge-and-cleanup.md +5 -5
- package/template/vendor/README.md +11 -10
- package/template/vendor/matt-pocock/README.md +41 -0
- package/template/vendor/matt-pocock/engineering/README.md +28 -0
- package/template/vendor/matt-pocock/engineering/ask-matt/SKILL.md +76 -0
- package/template/vendor/matt-pocock/engineering/code-review/SKILL.md +89 -0
- package/template/vendor/matt-pocock/engineering/codebase-design/DEEPENING.md +37 -0
- package/template/vendor/matt-pocock/engineering/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/template/vendor/matt-pocock/engineering/codebase-design/SKILL.md +114 -0
- package/template/vendor/matt-pocock/engineering/diagnosing-bugs/SKILL.md +134 -0
- package/template/vendor/matt-pocock/engineering/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/template/vendor/matt-pocock/engineering/domain-modeling/ADR-FORMAT.md +47 -0
- package/template/vendor/matt-pocock/engineering/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/template/vendor/matt-pocock/engineering/domain-modeling/SKILL.md +74 -0
- package/template/vendor/matt-pocock/engineering/grill-with-docs/SKILL.md +7 -0
- package/template/vendor/matt-pocock/engineering/implement/SKILL.md +15 -0
- package/template/vendor/matt-pocock/engineering/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/template/vendor/matt-pocock/engineering/improve-codebase-architecture/SKILL.md +66 -0
- package/template/vendor/matt-pocock/engineering/prototype/LOGIC.md +79 -0
- package/template/vendor/matt-pocock/engineering/prototype/SKILL.md +30 -0
- package/template/vendor/matt-pocock/engineering/prototype/UI.md +112 -0
- package/template/vendor/matt-pocock/engineering/research/SKILL.md +12 -0
- package/template/vendor/matt-pocock/engineering/resolving-merge-conflicts/SKILL.md +14 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/SKILL.md +127 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/domain.md +51 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/issue-tracker-github.md +45 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/issue-tracker-gitlab.md +46 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/issue-tracker-local.md +30 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/triage-labels.md +15 -0
- package/template/vendor/matt-pocock/engineering/tdd/SKILL.md +36 -0
- package/template/vendor/matt-pocock/engineering/tdd/mocking.md +59 -0
- package/template/vendor/matt-pocock/engineering/tdd/tests.md +77 -0
- package/template/vendor/matt-pocock/engineering/to-spec/SKILL.md +75 -0
- package/template/vendor/matt-pocock/engineering/to-tickets/SKILL.md +113 -0
- package/template/vendor/matt-pocock/engineering/triage/AGENT-BRIEF.md +204 -0
- package/template/vendor/matt-pocock/engineering/triage/OUT-OF-SCOPE.md +104 -0
- package/template/vendor/matt-pocock/engineering/triage/SKILL.md +112 -0
- package/template/vendor/matt-pocock/engineering/wayfinder/SKILL.md +127 -0
- package/template/vendor/matt-pocock/in-progress/README.md +10 -0
- package/template/vendor/matt-pocock/in-progress/claude-handoff/SKILL.md +18 -0
- package/template/vendor/matt-pocock/in-progress/loop-me/SKILL.md +32 -0
- package/template/vendor/matt-pocock/in-progress/wizard/SKILL.md +45 -0
- package/template/vendor/matt-pocock/in-progress/wizard/template.sh +211 -0
- package/template/vendor/matt-pocock/in-progress/writing-beats/SKILL.md +67 -0
- package/template/vendor/matt-pocock/in-progress/writing-fragments/SKILL.md +78 -0
- package/template/vendor/matt-pocock/in-progress/writing-shape/SKILL.md +79 -0
- package/template/vendor/matt-pocock/productivity/README.md +18 -0
- package/template/vendor/matt-pocock/productivity/grill-me/SKILL.md +7 -0
- package/template/vendor/matt-pocock/productivity/grilling/SKILL.md +12 -0
- package/template/vendor/matt-pocock/productivity/handoff/SKILL.md +16 -0
- package/template/vendor/matt-pocock/productivity/teach/GLOSSARY-FORMAT.md +35 -0
- package/template/vendor/matt-pocock/productivity/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/template/vendor/matt-pocock/productivity/teach/MISSION-FORMAT.md +31 -0
- package/template/vendor/matt-pocock/productivity/teach/RESOURCES-FORMAT.md +32 -0
- package/template/vendor/matt-pocock/productivity/teach/SKILL.md +140 -0
- package/template/vendor/matt-pocock/productivity/writing-great-skills/GLOSSARY.md +201 -0
- package/template/vendor/matt-pocock/productivity/writing-great-skills/SKILL.md +83 -0
- package/template/workflows/matt-pocock/WORKFLOW.md +145 -0
- package/template/workflows/matt-pocock/_state/status.json +5 -0
- package/template/workflows/matt-pocock/routes/architecture.md +24 -0
- package/template/workflows/matt-pocock/routes/diagnose.md +22 -0
- package/template/workflows/matt-pocock/routes/experimental.md +18 -0
- package/template/workflows/matt-pocock/routes/idea-to-delivery.md +63 -0
- package/template/workflows/matt-pocock/routes/merge-conflicts.md +19 -0
- package/template/workflows/matt-pocock/routes/productivity.md +25 -0
- package/template/workflows/matt-pocock/routes/research-prototype.md +20 -0
- package/template/workflows/matt-pocock/routes/review.md +19 -0
- package/template/workflows/matt-pocock/routes/setup.md +42 -0
- package/template/workflows/matt-pocock/routes/triage.md +25 -0
- package/template/workflows/matt-pocock/routes/wayfinder.md +27 -0
- package/template/workflows/person/M-mao-zedong-cognitive-os/M-mao-zedong-cognitive-os.md +74 -185
- package/template/workflows/person/M-mao-zedong-cognitive-os/activate.md +3 -2
- package/template/workflows/person/M-mao-zedong-cognitive-os/books/README.md +12 -238
- package/template/workflows/person/M-mao-zedong-cognitive-os/deliver.md +6 -5
- package/template/workflows/person/M-mao-zedong-cognitive-os/diagnose.md +5 -63
- package/template/workflows/person/M-mao-zedong-cognitive-os/mobilize.md +7 -54
- package/template/workflows/person/M-mao-zedong-cognitive-os/references/research/15-quote-bank.md +10 -10
- package/template/workflows/person/M-mao-zedong-cognitive-os/strategize.md +6 -72
- package/template/workflows/person/WORKFLOW.md +68 -0
- package/template/workflows/person/_state/.config/LESSONS.md +3 -0
- package/template/workflows/person/_state/.config/RULES.md +3 -0
- package/template/workflows/person/_state/changes/.gitkeep +1 -0
- package/template/workflows/person/_state/status.json +5 -0
- package/template/.speculo/.config/LESSONS.md +0 -9
- package/template/.speculo/.config/RULES.md +0 -11
- package/template/.speculo/AGENTS.md +0 -30
- package/template/.speculo/archive/AGENTS.md +0 -28
- package/template/.speculo/archive/dev/.gitkeep +0 -0
- package/template/.speculo/archive/person/.gitkeep +0 -0
- package/template/.speculo/dev/.gitkeep +0 -0
- package/template/.speculo/dev/docs-sync-state.json +0 -14
- package/template/.speculo/dev-status.json +0 -3
- package/template/.speculo/doc-status.json +0 -3
- package/template/.speculo/person/.gitkeep +0 -0
- package/template/.speculo/person-status.json +0 -1
- package/template/commands/archive.md +0 -68
- package/template/commands/caveman.md +0 -50
- package/template/commands/config-prune.md +0 -59
- package/template/commands/grill-me.md +0 -48
- package/template/commands/handoff.md +0 -59
- package/template/commands/scaffold-exercises.md +0 -56
- package/template/commands/write-a-skill.md +0 -52
- package/template/skills/caveman/SKILL.md +0 -38
- package/template/skills/caveman/references/compression-rules.md +0 -102
- package/template/skills/config-prune/SKILL.md +0 -66
- package/template/skills/grill-me/SKILL.md +0 -40
- package/template/skills/handoff/SKILL.md +0 -50
- package/template/skills/scaffold-exercises/SKILL.md +0 -41
- package/template/skills/scaffold-exercises/references/exercise-structure.md +0 -85
- package/template/skills/scaffold-exercises/references/lint-and-git.md +0 -54
- package/template/skills/speculo-write/SKILL.md +0 -56
- package/template/skills/speculo-write/references/asset-selection-sop.md +0 -67
- package/template/skills/speculo-write/references/authoring-quality-levers.md +0 -61
- package/template/skills/speculo-write/references/command-authoring-sop.md +0 -98
- package/template/skills/speculo-write/references/migration-sop.md +0 -101
- package/template/skills/speculo-write/references/persistence-contract-sop.md +0 -192
- package/template/skills/speculo-write/references/skill-authoring-sop.md +0 -212
- package/template/skills/speculo-write/references/validation-checklist.md +0 -85
- package/template/skills/speculo-write/references/workflow-authoring-sop.md +0 -132
- package/template/vendor/codebase-design/DEEPENING.md +0 -37
- package/template/vendor/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/template/vendor/codebase-design/SKILL.md +0 -114
- package/template/vendor/officecli/SKILL.md +0 -415
- package/template/vendor/resolving-merge-conflicts/SKILL.md +0 -14
- package/template/workflows/dev/01-grill-with-docs/01-grill-with-docs.md +0 -107
- package/template/workflows/dev/01-grill-with-docs/grill-context-scan.md +0 -30
- package/template/workflows/dev/01-grill-with-docs/grill-decision.md +0 -38
- package/template/workflows/dev/02-prd/02-prd.md +0 -70
- package/template/workflows/dev/02-prd/prd-synthesis.md +0 -30
- package/template/workflows/dev/02-prd/prd-zoom-out.md +0 -29
- package/template/workflows/dev/03-tdd/03-tdd.md +0 -158
- package/template/workflows/dev/03-tdd/mocking.md +0 -43
- package/template/workflows/dev/03-tdd/refactoring.md +0 -10
- package/template/workflows/dev/03-tdd/tdd-finish.md +0 -34
- package/template/workflows/dev/03-tdd/tdd-loop.md +0 -36
- package/template/workflows/dev/03-tdd/tdd-plan.md +0 -37
- package/template/workflows/dev/03-tdd/tests.md +0 -61
- package/template/workflows/dev/04-finalize/04-finalize.md +0 -137
- package/template/workflows/dev/04-finalize/completion-gate.md +0 -41
- package/template/workflows/dev/04-finalize/finalize-archive.md +0 -55
- package/template/workflows/dev/A-improve-architecture/A-improve-architecture.md +0 -143
- package/template/workflows/dev/A-improve-architecture/HTML-REPORT.md +0 -123
- package/template/workflows/dev/AGENTS.md +0 -87
- package/template/workflows/dev/D-docs-sync/D-docs-sync.md +0 -127
- package/template/workflows/dev/D-docs-sync/agents-contract.md +0 -95
- package/template/workflows/dev/D-docs-sync/changelog-contract.md +0 -155
- package/template/workflows/dev/D-docs-sync/config-contract.md +0 -75
- package/template/workflows/dev/D-docs-sync/docs-sync-diff.md +0 -86
- package/template/workflows/dev/D-docs-sync/docs-sync-finish.md +0 -37
- package/template/workflows/dev/D-docs-sync/docs-sync-state.md +0 -47
- package/template/workflows/dev/D-docs-sync/docs-sync-update.md +0 -44
- package/template/workflows/dev/D-docs-sync/knowledge-extract.md +0 -66
- package/template/workflows/dev/D-docs-sync/readme-contract.md +0 -124
- package/template/workflows/dev/D-docs-sync/state-json-schema.md +0 -172
- package/template/workflows/dev/H-diagnose/H-diagnose.md +0 -119
- package/template/workflows/dev/H-diagnose/diagnose-fix.md +0 -34
- package/template/workflows/dev/H-diagnose/diagnose-guide.md +0 -144
- package/template/workflows/dev/H-diagnose/diagnose-loop.md +0 -41
- package/template/workflows/dev/H-diagnose/scripts/hitl-loop.template.sh +0 -41
- package/template/workflows/dev/I-to-issues/I-to-issues.md +0 -140
- package/template/workflows/dev/I-to-issues/issues-slices.md +0 -211
- package/template/workflows/dev/M-domain-modeling/ADR-FORMAT.md +0 -74
- package/template/workflows/dev/M-domain-modeling/CONTEXT-FORMAT.md +0 -67
- package/template/workflows/dev/M-domain-modeling/M-domain-modeling.md +0 -118
- package/template/workflows/dev/R-review/R-review.md +0 -163
- package/template/workflows/dev/R-review/code-quality-checklist.md +0 -118
- package/template/workflows/dev/R-review/removal-checklist.md +0 -53
- package/template/workflows/dev/R-review/review-axes.md +0 -61
- package/template/workflows/dev/R-review/review-setup.md +0 -73
- package/template/workflows/dev/R-review/review-verdict.md +0 -43
- package/template/workflows/dev/R-review/security-checklist.md +0 -126
- package/template/workflows/dev/R-review/solid-checklist.md +0 -73
- package/template/workflows/dev/_templates/diagnosis-template.md +0 -20
- package/template/workflows/dev/_templates/docs-sync-report-template.md +0 -45
- package/template/workflows/dev/_templates/docs-sync-state-template.json +0 -14
- package/template/workflows/dev/_templates/domain-model-log-template.md +0 -20
- package/template/workflows/dev/_templates/grill-context-map-template.md +0 -20
- package/template/workflows/dev/_templates/grill-decision-log-template.md +0 -20
- package/template/workflows/dev/_templates/issues-slices-template.md +0 -106
- package/template/workflows/dev/_templates/prd-overview-template.md +0 -20
- package/template/workflows/dev/_templates/prd-template.md +0 -26
- package/template/workflows/dev/_templates/regression-template.md +0 -20
- package/template/workflows/dev/_templates/review-report-template.md +0 -30
- package/template/workflows/dev/_templates/review-sources-template.md +0 -33
- package/template/workflows/dev/_templates/review-verdict-template.md +0 -33
- package/template/workflows/dev/_templates/tdd-log-template.md +0 -23
- package/template/workflows/dev/_templates/tdd-plan-template.md +0 -35
- package/template/workflows/dev/_templates/tdd-verification-template.md +0 -26
- package/template/workflows/doc/AGENTS.md +0 -72
- package/template/workflows/doc/B-writing-beats/B-writing-beats.md +0 -79
- package/template/workflows/doc/B-writing-beats/writing-beats-append.md +0 -31
- package/template/workflows/doc/B-writing-beats/writing-beats-options.md +0 -29
- package/template/workflows/doc/E-edit-article/E-edit-article.md +0 -79
- package/template/workflows/doc/E-edit-article/edit-article-plan.md +0 -30
- package/template/workflows/doc/E-edit-article/edit-article-rewrite.md +0 -31
- package/template/workflows/doc/F-writing-fragments/F-writing-fragments.md +0 -80
- package/template/workflows/doc/F-writing-fragments/writing-fragments-interview.md +0 -32
- package/template/workflows/doc/F-writing-fragments/writing-fragments-log.md +0 -29
- package/template/workflows/doc/S-writing-shape/S-writing-shape.md +0 -81
- package/template/workflows/doc/S-writing-shape/writing-shape-block.md +0 -32
- package/template/workflows/doc/S-writing-shape/writing-shape-opening.md +0 -27
- package/template/workflows/doc/T-teach/T-teach.md +0 -147
- package/template/workflows/doc/T-teach/teach-lesson-wrap.md +0 -63
- package/template/workflows/doc/T-teach/teach-lesson.md +0 -53
- package/template/workflows/doc/T-teach/teach-mission.md +0 -33
- package/template/workflows/doc/T-teach/teach-resources.md +0 -36
- package/template/workflows/doc/_templates/edit-article-plan-template.md +0 -25
- package/template/workflows/doc/_templates/edit-article-template.md +0 -7
- package/template/workflows/doc/_templates/teach-glossary-template.md +0 -26
- package/template/workflows/doc/_templates/teach-learning-record-template.md +0 -38
- package/template/workflows/doc/_templates/teach-mission-template.md +0 -19
- package/template/workflows/doc/_templates/teach-resources-template.md +0 -18
- package/template/workflows/doc/_templates/writing-article-template.md +0 -7
- package/template/workflows/doc/_templates/writing-beat-options-template.md +0 -21
- package/template/workflows/doc/_templates/writing-fragments-template.md +0 -7
- package/template/workflows/doc/_templates/writing-interview-log-template.md +0 -21
- package/template/workflows/doc/_templates/writing-shape-log-template.md +0 -25
- package/template/workflows/person/AGENTS.md +0 -60
- /package/template/{.speculo/.config/adr → workflows/matt-pocock/_state/archive}/.gitkeep +0 -0
- /package/template/{.speculo/.config/context → workflows/matt-pocock/_state/changes}/.gitkeep +0 -0
- /package/template/{.speculo/archive/doc → workflows/person/_state/.config/context}/.gitkeep +0 -0
- /package/template/{.speculo/doc → workflows/person/_state/archive}/.gitkeep +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# 设计两次(Design It Twice)
|
|
2
|
-
|
|
3
|
-
当用户想要为选定的深化候选探索替代接口时,使用此并行子代理模式。基于"设计两次"(Ousterhout)——你的第一个想法不太可能是最好的。
|
|
4
|
-
|
|
5
|
-
使用 [SKILL.md](SKILL.md) 中的术语——**module(模块)**、**interface(接口)**、**seam(接缝)**、**adapter(适配器)**、**leverage(杠杆)**。
|
|
6
|
-
|
|
7
|
-
## 流程
|
|
8
|
-
|
|
9
|
-
### 1. 界定问题空间
|
|
10
|
-
|
|
11
|
-
在生成子代理之前,为选定候选编写面向用户的问题空间说明:
|
|
12
|
-
|
|
13
|
-
- 任何新接口需要满足的约束
|
|
14
|
-
- 它将依赖的依赖项,以及它们属于哪个类别(参见 [DEEPENING.md](DEEPENING.md))
|
|
15
|
-
- 一个粗略的说明性代码草图,用于将约束具体化——不是提案,只是将约束变得具体的方式
|
|
16
|
-
|
|
17
|
-
将此展示给用户,然后立即进入第 2 步。用户在子代理并行工作时阅读和思考。
|
|
18
|
-
|
|
19
|
-
### 2. 生成子代理
|
|
20
|
-
|
|
21
|
-
使用 Agent 工具并行生成 3 个以上的子代理。每个子代理必须为深化后的模块生成一个**截然不同**的接口。
|
|
22
|
-
|
|
23
|
-
为每个子代理提供一个单独的技术概要(文件路径、耦合细节、来自 [DEEPENING.md](DEEPENING.md) 的依赖类别、接缝背后的内容)。该概要独立于第 1 步中面向用户的问题空间说明。给每个代理不同的设计约束:
|
|
24
|
-
|
|
25
|
-
- 代理 1:"最小化接口——目标是最多 1–3 个入口点。最大化每个入口点的杠杆效应。"
|
|
26
|
-
- 代理 2:"最大化灵活性——支持多种用例和扩展。"
|
|
27
|
-
- 代理 3:"针对最常见调用方优化——让默认情况变得简单。"
|
|
28
|
-
- 代理 4(如适用):"围绕端口与适配器设计跨接缝依赖。"
|
|
29
|
-
|
|
30
|
-
在概要中同时包含 [SKILL.md](SKILL.md) 词汇和 CONTEXT.md 词汇,以便每个子代理在命名时与架构语言和项目的领域语言保持一致。
|
|
31
|
-
|
|
32
|
-
每个子代理输出:
|
|
33
|
-
|
|
34
|
-
1. 接口(类型、方法、参数——加上不变量、排序、错误模式)
|
|
35
|
-
2. 使用示例,展示调用方如何使用
|
|
36
|
-
3. 实现隐藏在接缝背后的内容
|
|
37
|
-
4. 依赖策略和适配器(参见 [DEEPENING.md](DEEPENING.md))
|
|
38
|
-
5. 权衡——杠杆效应高的地方,薄弱的地方
|
|
39
|
-
|
|
40
|
-
### 3. 展示与比较
|
|
41
|
-
|
|
42
|
-
依次展示设计,以便用户逐一消化,然后用文字进行比较。通过**深度**(接口层面的杠杆效应)、**局部性**(变更集中的位置)和**接缝位置**进行对比。
|
|
43
|
-
|
|
44
|
-
比较后,给出你自己的推荐:你认为哪个设计最强以及为什么。如果来自不同设计的元素可以很好地组合,提出一个混合方案。要有明确的观点——用户想要的是一个强有力的解读,而不是一份菜单。
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: codebase-design
|
|
3
|
-
description: 设计深层模块的共享词汇。适用于用户想要设计或改进模块接口、寻找深化机会、决定接缝位置、使代码更可测试或对 AI 更可导航,或其他技能需要深层模块词汇的场景。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 代码库设计
|
|
7
|
-
|
|
8
|
-
设计**深层模块**:大量行为隐藏在小型接口之后,放置在清晰的接缝处,通过该接口可测试。在任何设计或重构代码的地方使用这套语言和原则。目标是为调用者提供杠杆,为维护者提供局部性,为所有人提供可测试性。
|
|
9
|
-
|
|
10
|
-
## 词汇表
|
|
11
|
-
|
|
12
|
-
严格使用这些术语——不要替换为"组件"、"服务"、"API"或"边界"。一致的语言是全部要点。
|
|
13
|
-
|
|
14
|
-
**模块**——任何有接口和实现的东西。刻意与规模无关:一个函数、类、包或跨层切片。*避免*:单元、组件、服务。
|
|
15
|
-
|
|
16
|
-
**接口**——调用者正确使用模块必须知道的一切:类型签名,还有不变量、排序约束、错误模式、所需配置和性能特征。*避免*:API、签名(太窄——它们仅指向类型层面的表面)。
|
|
17
|
-
|
|
18
|
-
**实现**——模块内部的内容,其代码体。区别于**适配器**:一个东西可以是一个小适配器带大实现(一个 Postgres 仓库)或一个大适配器带小实现(一个内存假对象)。当接缝是主题时用"适配器";否则用"实现"。
|
|
19
|
-
|
|
20
|
-
**深度**——接口处的杠杆:调用者(或测试)每学习单位接口能运用的行为量。一个模块是**深的**,当大量行为隐藏在小型接口之后;是**浅的**,当接口几乎和实现一样复杂。
|
|
21
|
-
|
|
22
|
-
**接缝** *(Michael Feathers)*——一个可以在不编辑该处的情况下改变行为的地方;模块接口所在的*位置*。接缝放在哪里是其自身的设计决策,区别于接缝后面是什么。*避免*:边界(被 DDD 的有界上下文过载)。
|
|
23
|
-
|
|
24
|
-
**适配器**——在接缝处满足接口的具体事物。描述*角色*(它填补哪个槽位),而非实质(里面是什么)。
|
|
25
|
-
|
|
26
|
-
**杠杆**——调用者从深度中获得的东西:每学习单位接口获得更多能力。一个实现付出,在 N 个调用点和 M 个测试中获得回报。
|
|
27
|
-
|
|
28
|
-
**局部性**——维护者从深度中获得的东西:变更、bug、知识和验证集中在一处,而不是分散在调用者中。一处修复,处处修复。
|
|
29
|
-
|
|
30
|
-
## 深 vs 浅
|
|
31
|
-
|
|
32
|
-
**深层模块** = 小接口 + 大量实现:
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
┌─────────────────────┐
|
|
36
|
-
│ 小型接口 │ ← 少数方法,简单参数
|
|
37
|
-
├─────────────────────┤
|
|
38
|
-
│ │
|
|
39
|
-
│ 深层实现 │ ← 复杂逻辑隐藏
|
|
40
|
-
│ │
|
|
41
|
-
└─────────────────────┘
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**浅层模块** = 大接口 + 少量实现(应避免):
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
┌─────────────────────────────────┐
|
|
48
|
-
│ 大型接口 │ ← 许多方法,复杂参数
|
|
49
|
-
├─────────────────────────────────┤
|
|
50
|
-
│ 薄实现 │ ← 只是传递
|
|
51
|
-
└─────────────────────────────────┘
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
设计接口时,问:
|
|
55
|
-
|
|
56
|
-
- 我能减少方法数量吗?
|
|
57
|
-
- 我能简化参数吗?
|
|
58
|
-
- 我能隐藏更多复杂性在内部吗?
|
|
59
|
-
|
|
60
|
-
## 原则
|
|
61
|
-
|
|
62
|
-
- **深度是接口的属性,而非实现的属性。** 一个深层模块可以在内部由小型、可 mock、可替换的部件组成——它们只是不是接口的一部分。一个模块可以有**内部接缝**(对其实现私有,由其自己的测试使用)以及其接口处的**外部接缝**。
|
|
63
|
-
- **删除测试。** 想象删除该模块。如果复杂性消失,它就是个传递。如果复杂性在 N 个调用者中重新出现,它就在赚取它的价值。
|
|
64
|
-
- **接口就是测试表面。** 调用者和测试跨越同一接缝。如果你想测试到接口*之外*,模块的形状可能不对。
|
|
65
|
-
- **一个适配器意味着假设的接缝。两个适配器意味着真实的接缝。** 除非某物确实在接缝处变化,否则不要引入接缝。
|
|
66
|
-
|
|
67
|
-
## 为可测试性设计
|
|
68
|
-
|
|
69
|
-
好的接口使测试变得自然:
|
|
70
|
-
|
|
71
|
-
1. **接受依赖,而非创建依赖。**
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
// 可测试
|
|
75
|
-
function processOrder(order, paymentGateway) {}
|
|
76
|
-
|
|
77
|
-
// 难以测试
|
|
78
|
-
function processOrder(order) {
|
|
79
|
-
const gateway = new StripeGateway();
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
2. **返回结果,而非产生副作用。**
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
// 可测试
|
|
87
|
-
function calculateDiscount(cart): Discount {}
|
|
88
|
-
|
|
89
|
-
// 难以测试
|
|
90
|
-
function applyDiscount(cart): void {
|
|
91
|
-
cart.total -= discount;
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
3. **小表面积。** 更少的方法 = 需要更少的测试。更少的参数 = 更简单的测试设置。
|
|
96
|
-
|
|
97
|
-
## 关系
|
|
98
|
-
|
|
99
|
-
- 一个**模块**有且仅有一个**接口**(它呈现给调用者和测试的表面)。
|
|
100
|
-
- **深度**是**模块**的属性,对照其**接口**来衡量。
|
|
101
|
-
- **接缝**是模块**接口**所在之处。
|
|
102
|
-
- **适配器**位于**接缝**处并满足**接口**。
|
|
103
|
-
- **深度**为调用者产生**杠杆**,为维护者产生**局部性**。
|
|
104
|
-
|
|
105
|
-
## 拒绝的框架
|
|
106
|
-
|
|
107
|
-
- **深度为实现行数与接口行数之比**(Ousterhout):奖励填充实现。我们改用深度作为杠杆。
|
|
108
|
-
- **"接口"作为 TypeScript `interface` 关键字或类的公共方法**:太窄——这里的接口包括调用者必须知道的每个事实。
|
|
109
|
-
- **"边界"**:被 DDD 的有界上下文过载。说**接缝**或**接口**。
|
|
110
|
-
|
|
111
|
-
## 深入探索
|
|
112
|
-
|
|
113
|
-
- **给定依赖深化一个集群**——参见 [DEEPENING.md](DEEPENING.md):依赖类别、接缝规范和替换而非分层的测试。
|
|
114
|
-
- **探索替代接口**——参见 [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md):启动并行子代理以几种截然不同的方式设计接口,然后比较深度、局部性和接缝位置。
|
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: officecli
|
|
3
|
-
description: Create, analyze, proofread, and modify Office documents (.docx, .xlsx, .pptx) using the officecli CLI tool. Use when the user wants to create, inspect, check formatting, find issues, add charts, or modify Office documents.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# officecli
|
|
7
|
-
|
|
8
|
-
AI-friendly CLI for .docx, .xlsx, .pptx. Single binary, no dependencies, no Office installation needed.
|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
If `officecli` is not installed:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# macOS / Linux
|
|
16
|
-
curl -fsSL https://d.officecli.ai/install.sh | bash
|
|
17
|
-
|
|
18
|
-
# Windows (PowerShell)
|
|
19
|
-
irm https://d.officecli.ai/install.ps1 | iex
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Verify with `officecli --version`. If still not found after install, open a new terminal.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Strategy
|
|
27
|
-
|
|
28
|
-
**L1 (read) → L2 (DOM edit) → L3 (raw XML)**. Always prefer higher layers. Add `--json` for structured output.
|
|
29
|
-
|
|
30
|
-
**Before doc work, check Specialized Skills** (bottom of this file). Fundraising decks, academic papers, financial models, dashboards, and Morph animations need their own skill loaded first — `load_skill` once, then proceed.
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Help System (IMPORTANT)
|
|
35
|
-
|
|
36
|
-
**When unsure about property names, value formats, or command syntax, ALWAYS run help instead of guessing.** One help query beats guess-fail-retry loops.
|
|
37
|
-
|
|
38
|
-
`officecli help` ≡ `officecli --help`, and `officecli <cmd> --help` ≡ `officecli help <cmd>` — same content.
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
officecli help # All commands + global options + schema entry points
|
|
42
|
-
officecli help docx # List all docx elements
|
|
43
|
-
officecli help docx paragraph # Full schema: properties, aliases, examples, readbacks
|
|
44
|
-
officecli help docx set paragraph # Verb-filtered: only props usable with `set`
|
|
45
|
-
officecli help docx paragraph --json # Structured schema (machine-readable)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Format aliases: `word`→`docx`, `excel`→`xlsx`, `ppt`/`powerpoint`→`pptx`. Verbs: `add`, `set`, `get`, `query`, `remove`. MCP exposes the same schema via `{"command":"help","format":"docx","type":"paragraph"}`.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Performance: Resident Mode
|
|
53
|
-
|
|
54
|
-
**Every command auto-starts a resident on first access** (60s idle timeout) — file-lock conflicts are automatically avoided. Explicit `open`/`close` is still recommended for longer sessions (12min idle):
|
|
55
|
-
```bash
|
|
56
|
-
officecli open report.docx # explicitly keep in memory
|
|
57
|
-
officecli set report.docx ... # no file I/O overhead
|
|
58
|
-
officecli close report.docx # save and release
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Opt out of auto-start: `OFFICECLI_NO_AUTO_RESIDENT=1`.
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Quick Start
|
|
66
|
-
|
|
67
|
-
**PPT:**
|
|
68
|
-
```bash
|
|
69
|
-
officecli create slides.pptx
|
|
70
|
-
officecli add slides.pptx / --type slide --prop title="Q4 Report" --prop background=1A1A2E
|
|
71
|
-
officecli add slides.pptx '/slide[1]' --type shape --prop text="Revenue grew 25%" --prop x=2cm --prop y=5cm --prop font=Arial --prop size=24 --prop color=FFFFFF
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**Word:**
|
|
75
|
-
```bash
|
|
76
|
-
officecli create report.docx
|
|
77
|
-
officecli add report.docx /body --type paragraph --prop text="Executive Summary" --prop style=Heading1
|
|
78
|
-
officecli add report.docx /body --type paragraph --prop text="Revenue increased by 25% year-over-year."
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
**Excel:**
|
|
82
|
-
```bash
|
|
83
|
-
officecli create data.xlsx
|
|
84
|
-
officecli set data.xlsx /Sheet1/A1 --prop value="Name" --prop bold=true
|
|
85
|
-
officecli set data.xlsx /Sheet1/A2 --prop value="Alice"
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## L1: Create, Read & Inspect
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
officecli create <file> # Create blank .docx/.xlsx/.pptx (type from extension)
|
|
94
|
-
officecli view <file> <mode> # outline | stats | issues | text | annotated | html
|
|
95
|
-
officecli get <file> <path> --depth N # Get a node and its children [--json]
|
|
96
|
-
officecli query <file> <selector> # CSS-like query
|
|
97
|
-
officecli validate <file> # Validate against OpenXML schema
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### view modes
|
|
101
|
-
|
|
102
|
-
| Mode | Description | Useful flags |
|
|
103
|
-
|------|-------------|-------------|
|
|
104
|
-
| `outline` | Document structure | |
|
|
105
|
-
| `stats` | Statistics (pages, words, shapes) | |
|
|
106
|
-
| `issues` | Formatting/content/structure problems | `--type format\|content\|structure`, `--limit N` |
|
|
107
|
-
| `text` | Plain text extraction | `--start N --end N`, `--max-lines N` |
|
|
108
|
-
| `annotated` | Text with formatting annotations | |
|
|
109
|
-
| `html` | Static HTML snapshot — same renderer as `watch`, no server needed | `--browser`, `--page N` (docx), `--start N --end N` (pptx) |
|
|
110
|
-
| `screenshot` / `svg` / `pdf` / `forms` | PNG via headless browser / SVG (pptx slide) / PDF via exporter plugin / form-fields JSON via format-handler plugin | `-o`, `--screenshot-width/-height`, pptx `--grid N` |
|
|
111
|
-
|
|
112
|
-
Use `view html` for one-shot snapshots (CI artifacts, archival, diffing); use `watch` when you need live refresh or browser-side click-to-select.
|
|
113
|
-
|
|
114
|
-
### get
|
|
115
|
-
|
|
116
|
-
Any XML path via element localName. Use `--depth N` to expand children. Add `--json` for structured output. Default text output is grep-friendly: `path (type) "text" key=val key=val ...`
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
officecli get report.docx '/body/p[3]' --depth 2 --json
|
|
120
|
-
officecli get slides.pptx '/slide[1]' --depth 1 # list all shapes on slide 1
|
|
121
|
-
officecli get data.xlsx '/Sheet1/B2' --json
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Stable ID Addressing
|
|
125
|
-
|
|
126
|
-
Elements with stable IDs return `@attr=value` paths instead of positional indices. Prefer these in multi-step workflows — positional indices shift on insert/delete, stable IDs do not.
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
/slide[1]/shape[@id=550950021] # PPT shape
|
|
130
|
-
/slide[1]/table[@id=1388430425]/tr[1]/tc[2] # PPT table
|
|
131
|
-
/body/p[@paraId=1A2B3C4D] # Word paragraph
|
|
132
|
-
/comments/comment[@commentId=1] # Word comment
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
PPT also accepts `@name=` (e.g. `shape[@name=Title 1]`), with morph `!!` prefix awareness. Elements without stable IDs (slide, run, tr/tc, row) fall back to positional indices.
|
|
136
|
-
|
|
137
|
-
### query
|
|
138
|
-
|
|
139
|
-
CSS-like selectors: `[attr=value]`, `[attr!=value]`, `[attr~=text]`, `[attr>=value]`, `[attr<=value]`, `:contains("text")`, `:empty`, `:has(formula)`, `:no-alt`. Boolean `and`/`or` supported across `query`/`set`/`remove`: `cell[value>5000 or value<100]`, `cell[(type=Number or type=Date) and value>0]`. Excel row-by-column-name: `Sheet1!row[Salary>5000]`. `set` accepts selectors and Excel-native paths (parity with `get`/`query`). Bare unscoped selectors rejected on `set`/`remove`.
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
officecli query report.docx 'paragraph[style=Normal] > run[font!=Arial]'
|
|
143
|
-
officecli query slides.pptx 'shape[fill=FF0000]'
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Watch & Interactive Selection
|
|
149
|
-
|
|
150
|
-
Live HTML preview that auto-refreshes on every file change. Browsers can click / shift-click / box-drag to select shapes; the CLI can read the current browser selection and act on it.
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
officecli watch <file> [--port N] # Start preview server (default port 26315)
|
|
154
|
-
officecli unwatch <file> # Stop
|
|
155
|
-
officecli goto <file> <path> # Scroll watching browser(s) to element (docx: p / table / tr / tc)
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Open the printed `http://localhost:N` URL. Click to select; shift/cmd/ctrl+click to multi-select; drag from empty space to box-select. PPT/Word use blue outline; Excel uses native-style green selection (double-click cell to edit inline; drag a chart to reposition).
|
|
159
|
-
|
|
160
|
-
### `get <file> selected` — read what the user clicked
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
officecli get <file> selected [--json]
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Returns DocumentNodes for whatever is currently selected. Empty result if nothing selected. Exit code != 0 if no watch is running.
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
# User clicks shapes in the browser, then asks "make these red"
|
|
170
|
-
PATHS=$(officecli get deck.pptx selected --json | jq -r '.data.Results[].path')
|
|
171
|
-
for p in $PATHS; do officecli set deck.pptx "$p" --prop fill=FF0000; done
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Key properties
|
|
175
|
-
|
|
176
|
-
- **Selection survives file edits.** Paths use stable `@id=` form.
|
|
177
|
-
- **All connected browsers share one selection.** Last-write-wins.
|
|
178
|
-
- **Same-file single-watch.** A given file can have only one watch process at a time.
|
|
179
|
-
- **Group shapes select as a whole.** Drilling into individual children of a group is not supported in v1.
|
|
180
|
-
- **Coverage:** `.pptx` shapes/pictures/tables/charts/connectors/groups; `.docx` top-level paragraphs and tables. Inherited layout/master decorations and Word nested elements (table cells, run-level) are not addressable. **`.xlsx` does not emit `data-path`** — `mark`/`selection` on xlsx always resolve `stale=true` (v2 candidate).
|
|
181
|
-
|
|
182
|
-
### Marks — edit proposals waiting for review
|
|
183
|
-
|
|
184
|
-
Use `mark` when changes need human review BEFORE they hit the file. Marks live in the watch process only; a separate `set` pipeline applies accepted ones. For one-shot changes use `set` directly; for permanent file annotations use `add --type comment` (Word native).
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
officecli mark <file> <path> [--prop find=... color=... note=... tofix=... regex=true] [--json]
|
|
188
|
-
officecli unmark <file> [--path <p> | --all] [--json]
|
|
189
|
-
officecli get-marks <file> [--json]
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Props: `find` (literal or regex when `regex=true`; raw form `find='r"[abc]"'`), `color` (hex / `rgb(...)` / 22 named whitelist), `note`, `tofix` (drives apply pipeline). **Path** must be `data-path` format from watch HTML — see subskills for full pipeline.
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## L2: DOM Operations
|
|
197
|
-
|
|
198
|
-
### set — modify properties
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
officecli set <file> <path> --prop key=value [--prop ...]
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
**Any XML attribute is settable** via element path (found via `get --depth N`) — even attributes not currently present. Without `find=`, `set` applies format to the entire element.
|
|
205
|
-
|
|
206
|
-
**Value formats:**
|
|
207
|
-
|
|
208
|
-
| Type | Format | Examples |
|
|
209
|
-
|------|--------|---------|
|
|
210
|
-
| Colors | Hex (with/without `#`), named, RGB, theme | `FF0000`, `#FF0000`, `red`, `rgb(255,0,0)`, `accent1`..`accent6` |
|
|
211
|
-
| Spacing | Unit-qualified | `12pt`, `0.5cm`, `1.5x`, `150%` |
|
|
212
|
-
| Dimensions | EMU or suffixed | `914400`, `2.54cm`, `1in`, `72pt`, `96px` |
|
|
213
|
-
|
|
214
|
-
**Dotted-attr aliases** — `font.<attr>` forms accepted on shape/run/paragraph/table/row/cell/section/styles, e.g. `--prop font.color=red --prop font.bold=true --prop font.size=14pt`. Run `officecli help <fmt> <element>` for the full list.
|
|
215
|
-
|
|
216
|
-
### find — format or replace matched text
|
|
217
|
-
|
|
218
|
-
Use top-level `--find` / `--replace` on `set` (and `--find` on `query`). Legacy `--prop find=X` still works but emits a hint.
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
# Format matched text (auto-splits runs)
|
|
222
|
-
officecli set doc.docx '/body/p[1]' --find weather --prop bold=true --prop color=red
|
|
223
|
-
|
|
224
|
-
# Regex matching (regex= still a prop flag)
|
|
225
|
-
officecli set doc.docx '/body/p[1]' --find '\d+%' --prop regex=true --prop color=red
|
|
226
|
-
|
|
227
|
-
# Replace text (use `/` for whole-document scope)
|
|
228
|
-
officecli set doc.docx / --find draft --replace final
|
|
229
|
-
|
|
230
|
-
# docx: tracked Find&Replace
|
|
231
|
-
officecli set doc.docx / --find draft --replace final --prop revision.author=Alice
|
|
232
|
-
|
|
233
|
-
# PPT — same syntax, different paths
|
|
234
|
-
officecli set slides.pptx / --find draft --replace final
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**Path controls search scope:** `/` = whole document, `/body/p[1]` or `/slide[N]/shape[M]` = specific element, `/header[1]` / `/footer[1]` = headers/footers.
|
|
238
|
-
|
|
239
|
-
**Notes:**
|
|
240
|
-
- Case-sensitive by default. Case-insensitive: `--prop 'find=(?i)error' --prop regex=true`
|
|
241
|
-
- Matches work across run boundaries
|
|
242
|
-
- No match = silent success. `--json` includes `"matched": N`
|
|
243
|
-
- **Excel:** only `find` + `replace` supported (no find + format props)
|
|
244
|
-
|
|
245
|
-
### add — add elements or clone
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
officecli add <file> <parent> --type <type> [--prop ...]
|
|
249
|
-
officecli add <file> <parent> --type <type> --after <path> [--prop ...] # insert after anchor
|
|
250
|
-
officecli add <file> <parent> --type <type> --before <path> [--prop ...] # insert before anchor
|
|
251
|
-
officecli add <file> <parent> --type <type> --index N [--prop ...] # 0-based position (legacy)
|
|
252
|
-
officecli add <file> <parent> --from <path> # clone existing element
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
`--after`, `--before`, `--index` are mutually exclusive. No position flag = append to end.
|
|
256
|
-
|
|
257
|
-
**Element types (with aliases):**
|
|
258
|
-
|
|
259
|
-
| Format | Types |
|
|
260
|
-
|--------|-------|
|
|
261
|
-
| **pptx** | slide (incl. hidden), shape (font.latin/ea/cs, direction=rtl, underline.color, highlight=COLOR (Add/Set/Get/HTML preview), effective.X+effective.X.src; arrow alias for rightArrow; slideMaster/slideLayout typed add/set/remove), picture (SVG, brightness/contrast/glow/shadow, rotation, link, tooltip), chart (direction=rtl, pieOfPie, barOfPie, axisLine/gridline per-attr setters, animation+chartBuild=byCategory|bySeries, line dropLines/hiLowLines/upDownBars, anchor=x,y,w,h shorthand), table (cell direction=rtl, fill/background, built-in PowerPoint style catalogue, /col[C] get + swap/copyFrom, row/col Move/CopyFrom), row (tr), connector (from/to accept @name=, startshape/endshape SetByPath), group (link, tooltip, deep walk by get/query/add/remove), video/audio (loop, autoStart alias), equation, notes (direction=rtl, lang), comment (legacy + modern p188 threaded round-trip), animation (15 emphasis + 16 exit presets, multi-effect chains, motion-path presets, repeat/restart/autoReverse, chart animations), transition (12 p15 presets + morph/p14), paragraph (para), run, zoom, ole (preview=, full dump round-trip via add-part+raw-set), placeholder (phType=...), model3d (rotation=ax,ay,az; full dump round-trip), smartart (dump round-trip via add-part). |
|
|
262
|
-
| **docx** | paragraph (direction/font.latin/ea/cs, bold.cs/italic.cs/size.cs, lang.latin/ea/cs, wordWrap, framePr.\*, tabs shorthand), run (lang slots, direction, underline.color, position half-pts, **revision.type=ins\|del\|format\|moveFrom\|moveTo + revision.action=accept\|reject** with .author/.date — `/revision[@author=X]` selector for filtered accept/reject), table (direction=rtl, hMerge, **virtual column ops**: add/remove/move/copyfrom on /body/tbl[N]/col), row (tr), cell (td), image, header/footer (direction), section (pageNumFmt full enum, direction=rtl, rtlGutter, pgBorders=box), bookmark, comment, footnote, endnote, formfield, sdt, chart, equation, field (28 types), hyperlink, style (direction, indents, pbdr, lineSpacing on Add/Set), toc, watermark, break, ole, **num/abstractNum/lvl**, **tab**, **textbox/shape** (full Add+Get; geometry, fill, line, wrap, alt, anchor, **rotation, verticalText (eaVert/vert/vert270/wordArt\*), gradient, shadow, opacity**), embedded **OLE round-trip on dump→batch**. docDefaults.rtl, autoHyphenation, `get /` exposes locale + /comments /footnotes /endnotes. `create --minimal` for raw OOXML scaffolding. |
|
|
263
|
-
| **xlsx** | sheet (visible/hidden/veryHidden, print margins, printTitleRows/Cols, rightToLeft sheetView, cascade-aware rename), row (c{N}= cell-content shorthand; add accepts --from /Sheet/col[L]; formula-ref rewrite on insert), col (formula-ref rewrite, named-range follow on move), cell (type=richtext+runs, merge=range/sweep, direction=rtl, phonetic; **--shift left\|up on remove, shift=right\|down on add** — Excel UI dialog parity; formula auto-detect; OFFSET/INDIRECT in calc), chart (per-axis RTL/title, anchor=x,y,w,h, pareto), image (SVG), comment (direction=rtl), table (listobject), namedrange (definedname, volatile, `[@name=X]`; formula-body inlined at parse), pivottable (cache CoW + cross-pivot sharing, labelFilter, topN, fillDownLabels, calculatedField), sparkline, validation, autofilter, shape, textbox, CF (databar/colorscale/iconset/formulacf/cellIs/topN/aboveAverage), ole, csv. Query supports `merge`/`mergedrange`. Workbook: password. Shape selector enumerates leaves inside grpSp. |
|
|
264
|
-
|
|
265
|
-
### Pivot tables (xlsx)
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
officecli add data.xlsx /Sheet1 --type pivottable \
|
|
269
|
-
--prop source="Sheet1!A1:E100" --prop rows=Region,Category \
|
|
270
|
-
--prop cols=Year --prop values="Sales:sum,Qty:count" \
|
|
271
|
-
--prop grandTotals=rows --prop subtotals=off --prop sort=asc
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
Key props: `rows`, `cols`, `values` (Field:func[:showDataAs]), `filters`, `source`, `position`, `layout` (compact/outline/tabular), `repeatLabels`, `blankRows`, `aggregate`, `showDataAs` (percent_of_total/row/col, running_total), `grandTotals`, `subtotals`, `sort`. Aggregators: sum, count, average, max, min, product, stdDev, stdDevp, var, varp, countNums. Date columns auto-group. Run `officecli help xlsx pivottable` for full schema.
|
|
275
|
-
|
|
276
|
-
### Document-level properties (all formats)
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
officecli set doc.docx / --prop docDefaults.font=Arial --prop docDefaults.fontSize=11pt
|
|
280
|
-
officecli set doc.docx / --prop protection=forms --prop evenAndOddHeaders=true
|
|
281
|
-
officecli set data.xlsx / --prop calc.mode=manual --prop calc.refMode=r1c1
|
|
282
|
-
officecli set slides.pptx / --prop defaultFont=Arial --prop show.loop=true --prop print.what=handouts
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Run `officecli help <format> /` for all document-level properties (docDefaults, docGrid, CJK spacing, calc, print, show, theme, extended).
|
|
286
|
-
|
|
287
|
-
### Sort (xlsx)
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
officecli set data.xlsx /Sheet1 --prop sort="C desc" --prop sortHeader=true
|
|
291
|
-
officecli set data.xlsx '/Sheet1/A1:D100' --prop sort="A asc" --prop sortHeader=true
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
Format: `COL DIR[, COL DIR ...]`. Rejects ranges with merged cells or formulas. Sidecar metadata (hyperlinks, comments, conditional formatting, drawings) follows rows automatically.
|
|
295
|
-
|
|
296
|
-
### Text-anchored insert (`--after find:X` / `--before find:X`)
|
|
297
|
-
|
|
298
|
-
Locate an insertion point by text match within a paragraph. Inline types (run, picture, hyperlink) insert within the paragraph; block types (table, paragraph) auto-split it. PPT only supports inline.
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
# Word: inline run after matched text
|
|
302
|
-
officecli add doc.docx '/body/p[1]' --type run --after find:weather --prop text=" (sunny)"
|
|
303
|
-
|
|
304
|
-
# Word: block table after matched text (auto-splits paragraph)
|
|
305
|
-
officecli add doc.docx '/body/p[1]' --type table --after "find:First sentence." --prop rows=2 --prop cols=2
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### Clone
|
|
309
|
-
|
|
310
|
-
`officecli add <file> / --from '/slide[1]'` — copies with all cross-part relationships.
|
|
311
|
-
|
|
312
|
-
### move, swap, remove
|
|
313
|
-
|
|
314
|
-
```bash
|
|
315
|
-
officecli move <file> <path> [--to <parent>] [--index N] [--after <path>] [--before <path>]
|
|
316
|
-
officecli swap <file> <path1> <path2>
|
|
317
|
-
officecli remove <file> '/body/p[4]'
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
When using `--after` or `--before`, `--to` can be omitted — the target container is inferred from the anchor.
|
|
321
|
-
|
|
322
|
-
### batch — multiple operations in one save cycle
|
|
323
|
-
|
|
324
|
-
Continues on error by default (returns exit 1 if any item fails). Use `--stop-on-error` to abort on the first failure. `--force` is the docx-protection bypass.
|
|
325
|
-
|
|
326
|
-
`officecli dump <file> [<path>]` emits a replayable batch JSON for round-trip — `.docx` (full coverage) and `.pptx` (text/tables/pictures/charts/notes/theme + OLE/3D/video/audio/SmartArt/morph/p15 transitions via raw-set passthrough). Path defaults to `/` (whole document); pass a subtree path (`/body`, `/body/p[N]`, `/body/tbl[N]`, `/theme`, `/settings`, `/numbering`, `/styles`) to scope the dump. `officecli refresh <file.docx>` recalculates TOC page numbers / PAGE / cross-references after replay (Word backend on Windows; headless-HTML fallback elsewhere). `officecli plugins list` extends support to `.doc`, `.hwpx`, `.pdf` export.
|
|
327
|
-
|
|
328
|
-
```bash
|
|
329
|
-
echo '[
|
|
330
|
-
{"command":"set","path":"/Sheet1/A1","props":{"value":"Name","bold":"true"}},
|
|
331
|
-
{"command":"set","path":"/Sheet1/B1","props":{"value":"Score","bold":"true"}}
|
|
332
|
-
]' | officecli batch data.xlsx --json
|
|
333
|
-
|
|
334
|
-
officecli batch data.xlsx --commands '[{"op":"set","path":"/Sheet1/A1","props":{"value":"Done"}}]' --json
|
|
335
|
-
officecli batch data.xlsx --input updates.json --force --json
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
Supports: `add`, `set`, `get`, `query`, `remove`, `move`, `swap`, `view`, `raw`, `raw-set`, `validate`. Fields: `command` (or `op`), `path`, `parent`, `type`, `from`, `to`, `index`, `after`, `before`, `props`, `selector`, `mode`, `depth`, `part`, `xpath`, `action`, `xml`.
|
|
339
|
-
|
|
340
|
-
---
|
|
341
|
-
|
|
342
|
-
## L3: Raw XML
|
|
343
|
-
|
|
344
|
-
Use when L2 cannot express what you need. No xmlns declarations needed — prefixes auto-registered.
|
|
345
|
-
|
|
346
|
-
```bash
|
|
347
|
-
officecli raw <file> <part> # view raw XML
|
|
348
|
-
officecli raw-set <file> <part> --xpath "..." --action replace --xml '<w:p>...</w:p>'
|
|
349
|
-
officecli add-part <file> <parent> # create new document part (returns rId)
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
`raw-set` actions: `append`, `prepend`, `insertbefore`, `insertafter`, `replace`, `remove`, `setattr`. Run `officecli help <format> raw` for available parts.
|
|
353
|
-
|
|
354
|
-
---
|
|
355
|
-
|
|
356
|
-
## Common Pitfalls
|
|
357
|
-
|
|
358
|
-
| Pitfall | Correct Approach |
|
|
359
|
-
|---------|-----------------|
|
|
360
|
-
| `--name "foo"` | Use `--prop name="foo"` — all attributes go through `--prop` |
|
|
361
|
-
| Unquoted `[N]` paths in zsh/bash | Always quote: `'/slide[1]'` or `"/slide[1]"` (shell glob-expands brackets) |
|
|
362
|
-
| PPT `shape[1]` for content | `shape[1]` is typically the title placeholder. Use `shape[2]+` for content shapes |
|
|
363
|
-
| `/shape[myname]` | Name indexing not supported. Use numeric index or `@name=` (PPT only) |
|
|
364
|
-
| Guessing property names | Run `officecli help <format> <element>` to see exact names |
|
|
365
|
-
| Modifying an open file | Close the file in PowerPoint/WPS first |
|
|
366
|
-
| `\n` in shell strings | Use `\\n` for newlines in `--prop text="..."` |
|
|
367
|
-
| `$` in shell text | `--prop text="$15M"` strips `$15`. Use single quotes: `--prop text='$15M'`, or heredoc batch |
|
|
368
|
-
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
## Specialized Skills
|
|
372
|
-
|
|
373
|
-
`officecli load_skill <name>` — output is a SKILL.md, follow its rules.
|
|
374
|
-
|
|
375
|
-
**Loading rule**:
|
|
376
|
-
- Pick the most specific match in "When to use"; if none fits, load the format default (`word` / `pptx` / `excel`).
|
|
377
|
-
- Scenes already contain the format default's rules — load **one** skill per artifact, never stack.
|
|
378
|
-
- Loaded rules persist across turns; don't re-load each reply.
|
|
379
|
-
- Two distinct artifacts → two separate loads.
|
|
380
|
-
|
|
381
|
-
### Word (.docx)
|
|
382
|
-
|
|
383
|
-
| Name | When to use |
|
|
384
|
-
|------|-------------|
|
|
385
|
-
| `word` | Reports, letters, memos, proposals, generic documents |
|
|
386
|
-
| `academic-paper` | Journal / conference / thesis: APA / Chicago / IEEE / MLA citations, equations, SEQ + PAGEREF cross-refs, multi-column journal layout, bibliography. NOT for business reports or letters (route those to `word`) |
|
|
387
|
-
|
|
388
|
-
### PowerPoint (.pptx)
|
|
389
|
-
|
|
390
|
-
| Name | When to use |
|
|
391
|
-
|------|-------------|
|
|
392
|
-
| `pptx` | Generic decks: board reviews, sales decks, all-hands, product launches |
|
|
393
|
-
| `pitch-deck` | **Fundraising only** — seed / Series A-C / SAFE / convertible / strategic raise. NOT for sales / product / board decks (route those to `pptx`) |
|
|
394
|
-
| `morph-ppt` | Cinematic Morph-animated presentations. NOT for static decks (route those to `pptx`) |
|
|
395
|
-
| `morph-ppt-3d` | 3D Morph: GLB models, camera moves, depth. NOT for 2D-only Morph (route those to `morph-ppt`) |
|
|
396
|
-
|
|
397
|
-
### Excel (.xlsx)
|
|
398
|
-
|
|
399
|
-
| Name | When to use |
|
|
400
|
-
|------|-------------|
|
|
401
|
-
| `excel` | Generic workbooks, formulas, pivots, trackers |
|
|
402
|
-
| `financial-model` | Financial models, scenarios, projections. NOT for general data analysis (route those to `excel`) |
|
|
403
|
-
| `data-dashboard` | CSV/tabular data → KPI / analytics / executive dashboards with charts and sparklines. NOT for raw data tracking (route those to `excel`) |
|
|
404
|
-
|
|
405
|
-
Example: a fundraising deck task → `officecli load_skill pitch-deck` → use the printed rules.
|
|
406
|
-
|
|
407
|
-
---
|
|
408
|
-
|
|
409
|
-
## Notes
|
|
410
|
-
|
|
411
|
-
- Paths are **1-based** (XPath convention): `'/body/p[3]'` = third paragraph
|
|
412
|
-
- `--index` is **0-based** (array convention): `--index 0` = first position
|
|
413
|
-
- **Excel exception**: for `add --type row` and `add --type col`, `--index N` is **1-based** (matches OOXML RowIndex / column letter index). `--index 5` inserts at row 5 / column 5.
|
|
414
|
-
- After modifications, verify with `validate` and/or `view issues`
|
|
415
|
-
- **When unsure**, run `officecli help <format> <element>` instead of guessing
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: resolving-merge-conflicts
|
|
3
|
-
description: "适用于需要解决进行中的 git merge/rebase 冲突的场景。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
1. **查看当前状态**——merge/rebase 的当前状态。检查 git 历史以及冲突文件。
|
|
7
|
-
|
|
8
|
-
2. **找到每个冲突的主要来源。** 深入理解每次更改的原因以及原始意图。阅读提交消息、查看 PR、查看原始 issue/工单。
|
|
9
|
-
|
|
10
|
-
3. **解决每个冲突块。** 在可能的情况下保留两种意图。当不兼容时,选择与合并声明目标匹配的那个并注明权衡。**不要**发明新行为。始终解决;永远不要 `--abort`。
|
|
11
|
-
|
|
12
|
-
4. 发现项目的**自动化检查**并运行它们——通常是类型检查,然后是测试,然后是格式化。修复合并破坏的任何内容。
|
|
13
|
-
|
|
14
|
-
5. **完成 merge/rebase。** 暂存所有内容并提交。如果正在 rebase,继续 rebase 过程直到所有提交都被 rebase。
|