teamix-evo 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -167,36 +167,41 @@ TEAMIX_DEBUG=1 teamix-evo tokens init opentrek
167
167
 
168
168
  ## 命令参考
169
169
 
170
- | 命令 | 说明 |
171
- | --------------------------------------------------- | ------------------------------------------------------------------------------- |
172
- | `teamix-evo init [-y] [--dry-run] [--variant <n>]` | 普通版接入:检测冲突 → wizard → 静默落地(已有 npm 工程入口) |
173
- | `teamix-evo update [--dry-run] [--cwd <dir>]` | 一键升级已装资源(tokens + skills,ADR 0003 三态 + ADR 0035 短路) |
174
- | `teamix-evo restore [ts] [--list] [-y]` | 回滚 `.teamix-evo/` 到指定 snapshot(ADR 0019 §2 — 自身可逆) |
175
- | `teamix-evo switch <new-variant> [--apply] [-y]` | variant 切换:默认 dry-run 展示 file-level diff,--apply 才真写(ADR 0019 §D3) |
176
- | `teamix-evo tokens init <variant>` | 初始化 tokens |
177
- | `teamix-evo tokens list-variants` | 列出可用 variant |
178
- | `teamix-evo tokens list` | 查看已装机的 variant |
179
- | `teamix-evo tokens update` | 更新已装资源(stub,v0.7 见 ADR 0019) |
180
- | `teamix-evo tokens uninstall` | 卸载已装 tokens |
181
- | `teamix-evo tokens audit` | 审计 tokens 引用(4 类:redundant / kept / migrate / custom,v3↔v4 语义比较) |
182
- | `teamix-evo skills init` | 自举 skills(按 variant + scope 全装 — ADR 0034) |
183
- | `teamix-evo skills add <name...>` | 增量装指定 skill(`<name...>` 必填) |
184
- | `teamix-evo skills list` | 列出所有 skill 的安装状态 |
185
- | `teamix-evo skills update [name...] [--dry-run]` | 升级 skills(双闸 + version 短路 — ADR 0035) |
186
- | `teamix-evo skills sync [name...]` | IDE 镜像(漂移恢复用) |
187
- | `teamix-evo skills doctor` | 检测源/镜像漂移(ADR 0013) |
188
- | `teamix-evo skills uninstall` | 卸载 skills( + 镜像 + lock) |
189
- | `teamix-evo ui init` | 初始化 ui 配置(aliases / iconLibrary / tsx / rsc) |
190
- | `teamix-evo ui add <id...>` | 安装指定 ui 组件源码 |
191
- | `teamix-evo ui list [--installed]` | 列出可用/已安装 ui 组件 |
192
- | `teamix-evo ui promote-to-biz <id...>` | ui 组件提升为业务组件(8 模式:Coexist/Preset/Wrapper/Compose/Variant/Fork/TokenOnly/ManualReview) |
193
- | `teamix-evo biz-ui list-variants` | 列出 biz-ui 包内提供的业务变体 |
194
- | `teamix-evo biz-ui add <id...> --variant <name>` | 安装变体感知业务组件(`--variant` 必填) |
195
- | `teamix-evo templates list-variants` | 列出 templates 包内提供的页面模板变体 |
196
- | `teamix-evo templates add <id...> --variant <name>` | 安装变体感知页面模板(`--variant` 必填) |
197
- | `teamix-evo lint init [-y]` | 一键安装 ESLint + Stylelint token-discipline 规则集 |
198
- | `teamix-evo logs analyze [...]` | 分析 vibe-logger AI 调用链(`.log/ai/**/*.jsonl`) |
199
- | `teamix-evo logs trace [...]` | 按会话还原 AI 调用链(prompt → PreToolUse → PostToolUse → Stop) |
170
+ | 命令 | 说明 |
171
+ | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
172
+ | `teamix-evo init [-y] [--dry-run] [--variant <n>]` | 普通版接入:检测冲突 → wizard → 静默落地(已有 npm 工程入口) |
173
+ | `teamix-evo update [--dry-run] [--cwd <dir>]` | 一键升级已装资源(tokens + skills,ADR 0003 三态 + ADR 0035 短路) |
174
+ | `teamix-evo restore [ts] [--list] [-y]` | 回滚 `.teamix-evo/` 到指定 snapshot(ADR 0019 §2 — 自身可逆) |
175
+ | `teamix-evo switch <new-variant> [--apply] [-y]` | variant 切换:默认 dry-run 展示 file-level diff,--apply 才真写(ADR 0019 §D3) |
176
+ | `teamix-evo tokens init <variant>` | 初始化 tokens |
177
+ | `teamix-evo tokens list-variants` | 列出可用 variant |
178
+ | `teamix-evo tokens list` | 查看已装机的 variant |
179
+ | `teamix-evo tokens update` | 更新已装资源(stub,v0.7 见 ADR 0019) |
180
+ | `teamix-evo tokens uninstall` | 卸载已装 tokens |
181
+ | `teamix-evo tokens audit` | 审计 tokens 引用(4 类:redundant / kept / migrate / custom,v3↔v4 语义比较) |
182
+ | `teamix-evo tokens diagnose` | 诊断 tokens 使用情况,生成分级报告(L1-L3)+ `.treatment-plan.md` |
183
+ | `teamix-evo tokens treat [--lock-baseline] [--apply]` | 一键 token 治理流水线:lint → codemod → lint → 报告 → 可选锁定 baseline |
184
+ | `teamix-evo tokens codemod [name] [--apply] [--list]` | 执行指定 token codemod(5 个可用:hsl-to-v4 / hex-to-token / tw-scale-to-semantic / space-to-gap / arbitrary-to-token) |
185
+ | `teamix-evo tokens reflect [--min-frequency <n>]` | 扫描重复色值,推荐新增项目级 token(反哺 overrides.css) |
186
+ | `teamix-evo tokens baseline-check` | 对比 baseline 检查 token 违规是否超标(CI 友好,exitCode=1 on fail) |
187
+ | `teamix-evo skills init` | 自举 skills(按 variant + scope 全装 — ADR 0034) |
188
+ | `teamix-evo skills add <name...>` | 增量装指定 skill(`<name...>` 必填) |
189
+ | `teamix-evo skills list` | 列出所有 skill 的安装状态 |
190
+ | `teamix-evo skills update [name...] [--dry-run]` | 升级 skills(双闸 + version 短路 — ADR 0035) |
191
+ | `teamix-evo skills sync [name...]` | IDE 镜像(漂移恢复用) |
192
+ | `teamix-evo skills doctor` | 检测源/镜像漂移(ADR 0013) |
193
+ | `teamix-evo skills uninstall` | 卸载 skills(源 + 镜像 + lock) |
194
+ | `teamix-evo ui init` | 初始化 ui 配置(aliases / iconLibrary / tsx / rsc) |
195
+ | `teamix-evo ui add <id...>` | 安装指定 ui 组件源码 |
196
+ | `teamix-evo ui list [--installed]` | 列出可用/已安装 ui 组件 |
197
+ | `teamix-evo ui promote-to-biz <id...>` | ui 组件提升为业务组件(8 模式:Coexist/Preset/Wrapper/Compose/Variant/Fork/TokenOnly/ManualReview) |
198
+ | `teamix-evo biz-ui list-variants` | 列出 biz-ui 包内提供的业务变体 |
199
+ | `teamix-evo biz-ui add <id...> --variant <name>` | 安装变体感知业务组件(`--variant` 必填) |
200
+ | `teamix-evo templates list-variants` | 列出 templates 包内提供的页面模板变体 |
201
+ | `teamix-evo templates add <id...> --variant <name>` | 安装变体感知页面模板(`--variant` 必填) |
202
+ | `teamix-evo lint init [-y]` | 一键安装 ESLint + Stylelint token-discipline 规则集 |
203
+ | `teamix-evo logs analyze [...]` | 分析 vibe-logger AI 调用链(`.log/ai/**/*.jsonl`) |
204
+ | `teamix-evo logs trace [...]` | 按会话还原 AI 调用链(prompt → PreToolUse → PostToolUse → Stop) |
200
205
 
201
206
  > 占位组件 → 真组件的升级流程**不是** CLI 子命令,由
202
207
  > [`teamix-evo-manage`](../../packages/skills/src/teamix-evo-manage/SKILL.md)
@@ -474,6 +474,12 @@ type RunLintInitResult = {
474
474
  * existed.
475
475
  */
476
476
  packageJsonPatched?: boolean;
477
+ /**
478
+ * True when the consumer's existing stylelint config was kept (skip /
479
+ * merge) and does not extend a teamix-evo preset — token definition
480
+ * files may trigger false-positive lint errors without `ignoreFiles`.
481
+ */
482
+ stylelintIgnoreFilesWarning?: boolean;
477
483
  } | {
478
484
  status: 'already-initialized';
479
485
  };
@@ -686,6 +692,33 @@ interface InitWizardAnswers {
686
692
  conflictDecisions: Record<ConflictKey, ConflictStrategy>;
687
693
  }
688
694
 
695
+ interface UiConflictEntry {
696
+ /** UI entry id from manifest (e.g. "button") */
697
+ id: string;
698
+ /** Absolute path on disk that conflicts */
699
+ targetPath: string;
700
+ /** Project-relative posix path for display */
701
+ relativePath: string;
702
+ /**
703
+ * Heuristic guess: true when the existing file looks like an unmodified
704
+ * shadcn/ui original (no `data-slot` attribute from teamix-evo).
705
+ * v1 uses filename + content heuristics; future versions may hash-compare.
706
+ */
707
+ isShadcnOriginal: boolean;
708
+ }
709
+ interface UiConflictReport {
710
+ /** Entries whose target file already exists on disk */
711
+ conflictEntries: UiConflictEntry[];
712
+ /** Number of manifest entries with no on-disk conflict */
713
+ unconflictedTargets: number;
714
+ /** Total manifest entries checked */
715
+ totalEntries: number;
716
+ /** True when at least one conflict exists — caller should block */
717
+ shouldBlock: boolean;
718
+ /** Distinct target alias directories that have conflicts */
719
+ conflictDirs: string[];
720
+ }
721
+
689
722
  /** Result of `createSnapshot` when a snapshot was actually taken. */
690
723
  interface SnapshotResult {
691
724
  /** Filesystem-safe UTC timestamp identifier (e.g. `2026-06-11T20-59-03-000Z`). */
@@ -729,7 +762,19 @@ interface FileChange {
729
762
  * No interactive prompts, no `process.exit`. Throws on hard failure (P8).
730
763
  */
731
764
 
732
- type ProjectInitStepName = 'tokens' | 'skills' | 'agents-md' | 'ui-init' | 'ui-add' | 'lint';
765
+ /**
766
+ * Strategy for handling UI component conflicts when existing shadcn/ui
767
+ * components are found in the target project.
768
+ *
769
+ * - `isolate-progressive` (Path A): move existing → shadcn-ui/, install
770
+ * fresh teamix-evo components into ui/, rewrite imports, let user
771
+ * migrate at their own pace.
772
+ * - `isolate-aggressive` (Path C): same as A + immediately generate
773
+ * upgrade staging so user can batch-replace.
774
+ * - `frozen-skip`: legacy behaviour — skip existing files, no migration.
775
+ */
776
+ type UiConflictStrategy = 'isolate-progressive' | 'isolate-aggressive' | 'frozen-skip';
777
+ type ProjectInitStepName = 'tokens' | 'skills' | 'agents-md' | 'ui-init' | 'ui-add' | 'lint' | 'gitignore';
733
778
  type ProjectInitStepStatus = 'ok' | 'skip' | 'fail' | 'planned';
734
779
  interface ProjectInitStep {
735
780
  name: ProjectInitStepName;
@@ -807,6 +852,18 @@ interface RunProjectInitOptions {
807
852
  * Phase 3.E: existing Stylelint config paths (relative to `projectRoot`).
808
853
  */
809
854
  legacyStylelintPaths?: string[];
855
+ /**
856
+ * UI conflict resolution strategy. When omitted AND conflicts are
857
+ * detected, the orchestrator returns `uiDecisionRequired` so the
858
+ * caller can prompt the user. When `-y` (non-interactive), defaults
859
+ * to `'isolate-progressive'`.
860
+ */
861
+ uiConflictStrategy?: UiConflictStrategy;
862
+ /**
863
+ * When true, treat the invocation as non-interactive (`-y` flag).
864
+ * Affects default conflict strategy selection.
865
+ */
866
+ nonInteractive?: boolean;
810
867
  /** Step-level progress hook (caller controls presentation). */
811
868
  onStep?: (step: ProjectInitStep) => void;
812
869
  /**
@@ -815,6 +872,21 @@ interface RunProjectInitOptions {
815
872
  */
816
873
  dryRun?: boolean;
817
874
  }
875
+ /**
876
+ * Returned when UI conflicts are detected and no `uiConflictStrategy` was
877
+ * provided. The caller should present the options to the user and re-invoke
878
+ * `runProjectInit` with the chosen strategy.
879
+ */
880
+ interface UiDecisionRequired {
881
+ /** The full conflict report for display */
882
+ report: UiConflictReport;
883
+ /** Available strategies with human-readable descriptions */
884
+ options: Array<{
885
+ strategy: UiConflictStrategy;
886
+ label: string;
887
+ description: string;
888
+ }>;
889
+ }
818
890
  interface RunProjectInitResult {
819
891
  status: 'installed' | 'partial' | 'dry-run';
820
892
  steps: ProjectInitStep[];
@@ -845,6 +917,12 @@ interface RunProjectInitResult {
845
917
  snapshot?: SnapshotResult | null;
846
918
  /** Reason a snapshot capture failed (best-effort — never blocks init). */
847
919
  snapshotError?: string;
920
+ /**
921
+ * Present when UI conflicts are detected and no `uiConflictStrategy`
922
+ * was provided (interactive mode). Caller should prompt the user with
923
+ * `options`, then re-invoke with the chosen strategy.
924
+ */
925
+ uiDecisionRequired?: UiDecisionRequired;
848
926
  }
849
927
  /**
850
928
  * Existing-project init pipeline.