prizmkit 1.1.181 → 1.1.183

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.1.181",
3
- "bundledAt": "2026-09-11T01:19:27.025Z",
4
- "bundledFrom": "203a6c3"
2
+ "frameworkVersion": "1.1.183",
3
+ "bundledAt": "2026-09-17T12:36:02.984Z",
4
+ "bundledFrom": "9a9990c"
5
5
  }
@@ -26,8 +26,6 @@ PrizmKit uses three JSON plan-list schemas under `dev-pipeline/templates/`:
26
26
  ## Feature-Specific Fields
27
27
 
28
28
  - `estimated_complexity`: maps feature work to `lite`, `standard`, or `full` prompt modes.
29
- - `session_granularity`: feature, sub-feature, or auto execution strategy.
30
- - `sub_features`: optional sub-feature decomposition.
31
29
  - `completion_notes`: downstream dependency context after completion.
32
30
  - `testing`: optional testing expectations for the scoped test gate.
33
31
 
@@ -19,9 +19,7 @@
19
19
  "TypeScript compiles without errors",
20
20
  "ESLint and Prettier configs applied"
21
21
  ],
22
- "status": "pending",
23
- "session_granularity": "feature",
24
- "sub_features": []
22
+ "status": "pending"
25
23
  },
26
24
  {
27
25
  "id": "F-002",
@@ -39,9 +37,7 @@
39
37
  "Protected API routes reject unauthenticated requests",
40
38
  "Session persists across page refreshes"
41
39
  ],
42
- "status": "pending",
43
- "session_granularity": "feature",
44
- "sub_features": []
40
+ "status": "pending"
45
41
  },
46
42
  {
47
43
  "id": "F-003",
@@ -59,9 +55,7 @@
59
55
  "Delete task with confirmation",
60
56
  "Task validation enforced on both client and server"
61
57
  ],
62
- "status": "pending",
63
- "session_granularity": "feature",
64
- "sub_features": []
58
+ "status": "pending"
65
59
  },
66
60
  {
67
61
  "id": "F-004",
@@ -79,20 +73,7 @@
79
73
  "Project-level task filtering",
80
74
  "Team member list with role display"
81
75
  ],
82
- "status": "pending",
83
- "session_granularity": "auto",
84
- "sub_features": [
85
- {
86
- "id": "F-004-A",
87
- "title": "Project CRUD & Organization",
88
- "description": "Create, read, update, delete projects. Associate tasks with projects."
89
- },
90
- {
91
- "id": "F-004-B",
92
- "title": "Team & Permissions",
93
- "description": "Team creation, member invitation, role-based access control."
94
- }
95
- ]
76
+ "status": "pending"
96
77
  },
97
78
  {
98
79
  "id": "F-005",
@@ -110,9 +91,7 @@
110
91
  "Graceful fallback when WebSocket disconnects",
111
92
  "No duplicate notifications"
112
93
  ],
113
- "status": "pending",
114
- "session_granularity": "feature",
115
- "sub_features": []
94
+ "status": "pending"
116
95
  },
117
96
  {
118
97
  "id": "F-006",
@@ -131,9 +110,7 @@
131
110
  "Project progress bars",
132
111
  "Date range filtering for all charts"
133
112
  ],
134
- "status": "pending",
135
- "session_granularity": "feature",
136
- "sub_features": []
113
+ "status": "pending"
137
114
  }
138
115
  ],
139
116
  "global_context": {
@@ -42,16 +42,20 @@ REQUIRED_FEATURE_FIELDS = [
42
42
  "acceptance_criteria",
43
43
  "status",
44
44
  ]
45
- ALLOWED_FEATURE_FIELDS = set(REQUIRED_FEATURE_FIELDS) | {
45
+ CURRENT_FEATURE_FIELDS = set(REQUIRED_FEATURE_FIELDS) | {
46
46
  "estimated_complexity",
47
- "session_granularity",
48
- "sub_features",
49
47
  "model",
50
48
  "completion_notes",
51
49
  "user_context",
52
50
  "browser_interaction",
53
51
  "testing",
54
52
  }
53
+ # Historical lists may still carry these keys. They are ignored residue, not
54
+ # current planning fields, and must not fail unknown-field validation.
55
+ LEFTOVER_IGNORED_FEATURE_FIELDS = {
56
+ "session_granularity",
57
+ "sub_features",
58
+ }
55
59
 
56
60
 
57
61
  def parse_args():
@@ -149,7 +153,11 @@ def validate_features(features):
149
153
  "Feature at index {} missing required field: {}".format(i, field)
150
154
  )
151
155
 
152
- unknown = set(feature) - ALLOWED_FEATURE_FIELDS
156
+ unknown = (
157
+ set(feature)
158
+ - CURRENT_FEATURE_FIELDS
159
+ - LEFTOVER_IGNORED_FEATURE_FIELDS
160
+ )
153
161
  if unknown:
154
162
  errors.append(
155
163
  "Feature at index {} has unknown fields: {}".format(
@@ -45,7 +45,7 @@
45
45
  "id": {
46
46
  "type": "string",
47
47
  "pattern": "^F-\\d{3}(-[A-Z])?$",
48
- "description": "Feature ID, format F-001, F-002... Optional sub-feature suffix: F-001-A"
48
+ "description": "Feature ID, format F-001, F-002..."
49
49
  },
50
50
  "title": {
51
51
  "type": "string",
@@ -106,41 +106,8 @@
106
106
  ],
107
107
  "description": "Feature status. Pipeline manages status transitions automatically."
108
108
  },
109
- "session_granularity": {
110
- "type": "string",
111
- "enum": [
112
- "feature",
113
- "sub_feature",
114
- "auto"
115
- ],
116
- "default": "feature",
117
- "description": "Session execution strategy: feature=one-session-per-feature, sub_feature=one-session-per-sub-feature, auto=pipeline-decides"
118
- },
119
- "sub_features": {
120
- "type": "array",
121
- "items": {
122
- "type": "object",
123
- "required": [
124
- "id",
125
- "title",
126
- "description"
127
- ],
128
- "properties": {
129
- "id": {
130
- "type": "string",
131
- "pattern": "^F-\\d{3}-[A-Z]$"
132
- },
133
- "title": {
134
- "type": "string",
135
- "minLength": 1
136
- },
137
- "description": {
138
- "type": "string",
139
- "minLength": 1
140
- }
141
- }
142
- }
143
- },
109
+ "session_granularity": {},
110
+ "sub_features": {},
144
111
  "model": {
145
112
  "type": "string",
146
113
  "description": "AI model ID for this feature. Overrides $MODEL env var."
@@ -777,6 +777,40 @@ def test_init_scripts_reject_unknown_item_fields(tmp_path):
777
777
  assert any("unknown fields: unexpected_field" in error for error in payload["errors"])
778
778
 
779
779
 
780
+ def test_init_pipeline_accepts_historical_leftover_nested_fields(tmp_path):
781
+ paths = _make_paths(tmp_path / "init-feature-leftover-nested")
782
+ items = _family_items("feature", [("F-001", [], "pending")])
783
+ items[0]["session_granularity"] = "auto"
784
+ items[0]["sub_features"] = [
785
+ {
786
+ "id": "F-001-A",
787
+ "title": "Nested leftover",
788
+ "description": "Unused nested work that Runtime never scheduled.",
789
+ }
790
+ ]
791
+ plan_path = _write_family_plan(paths, "feature", items)
792
+ result = subprocess.run(
793
+ [
794
+ PYTHON_310_PLUS,
795
+ str(PIPELINE_ROOT / "scripts" / "init-pipeline.py"),
796
+ "--feature-list",
797
+ str(plan_path),
798
+ "--state-dir",
799
+ str(paths.project_root / ".prizmkit" / "state" / "init-feature-leftover-nested"),
800
+ ],
801
+ cwd=REPO_ROOT,
802
+ stdout=subprocess.PIPE,
803
+ stderr=subprocess.PIPE,
804
+ text=True,
805
+ check=False,
806
+ )
807
+
808
+ assert result.returncode == 0, (result.stdout, result.stderr)
809
+ payload = json.loads(result.stdout)
810
+ assert payload["valid"] is True
811
+ assert "errors" not in payload or payload["errors"] == []
812
+
813
+
780
814
  @pytest.mark.parametrize("location", ("root", "global_context"))
781
815
  def test_init_scripts_reject_unknown_list_fields(tmp_path, location):
782
816
  script_config = {
@@ -861,6 +895,38 @@ def test_planner_validators_reject_unknown_item_fields():
861
895
  assert any("unknown fields: unexpected_field" in error for error in result["errors"])
862
896
 
863
897
 
898
+ def test_feature_planner_validator_accepts_historical_leftover_nested_fields():
899
+ from importlib.util import module_from_spec, spec_from_file_location
900
+
901
+ script_path = REPO_ROOT / (
902
+ "core/skills/orchestration-skill/pipelines/feature-planner/scripts/validate-and-generate.py"
903
+ )
904
+ spec = spec_from_file_location("feature_planner_leftover_nested", script_path)
905
+ module = module_from_spec(spec)
906
+ spec.loader.exec_module(module)
907
+ items = _family_items("feature", [("F-001", [], "pending")])
908
+ items[0]["description"] = (
909
+ "Historical list item that already stored unused nested leftover "
910
+ "fields from an older planner and must still validate successfully."
911
+ )
912
+ items[0]["session_granularity"] = "auto"
913
+ items[0]["sub_features"] = [
914
+ {
915
+ "id": "F-001-A",
916
+ "title": "Nested leftover",
917
+ "description": "Unused nested work that Runtime never scheduled.",
918
+ }
919
+ ]
920
+ result = module.validate_feature_list({
921
+ "$schema": "dev-pipeline-feature-list-v1",
922
+ "project_name": "Fake",
923
+ "features": items,
924
+ })
925
+
926
+ assert result["valid"] is True, result["errors"]
927
+ assert "total_sub_features" not in result["stats"]
928
+
929
+
864
930
  @pytest.mark.parametrize("location", ("root", "global_context"))
865
931
  def test_planner_validators_reject_unknown_list_fields(location):
866
932
  from importlib.util import module_from_spec, spec_from_file_location
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.181",
2
+ "version": "1.1.183",
3
3
  "skills": {
4
4
  "prizmkit": {
5
5
  "description": "Framework introduction and navigation for the formal single-requirement lifecycle, project initialization, Prizm docs, and independent deployment.",
@@ -66,7 +66,7 @@ These notes are maintainer records for option-derived design modules. Do not inj
66
66
  | `{{ test_coverage }}` | Q15 answer | `Shared components + critical path E2E` |
67
67
  | `{{ unit_test_framework }}` | Q16 answer | `Vitest` |
68
68
  | `{{ e2e_framework }}` | Q17 answer | `Playwright` |
69
- | `{{ ai_max_lines }}` | Q22 answer (number) | `300` |
69
+ | `{{ ai_max_lines }}` | Q22 answer | `No numeric file-size limit. Prefer extraction when a change would make an already-long file longer.` |
70
70
  | `{{ lcp_target }}` | Q23 answer | `<2.5s` |
71
71
  | `{{ font_strategy }}` | Q4b answer | Direct fill |
72
72
  | `{{ bundle_size }}` | Q24 answer | `<300KB (<100KB gzipped)` |
@@ -156,7 +156,8 @@ Appendix placeholders are auto-generated by AI in Phase 4:
156
156
  | Q20 = No | `D-AI-BREAK-LOOSE-01` | `{{ ai_breaking_change_rule }}` |
157
157
  | Q21 = Forbid; config files must be manually edited | `D-AI-CONFIG-FRONTEND-STRICT-01` | `{{ ai_config_rule }}` |
158
158
  | Q21 = Allowed, must explain each change | `D-AI-CONFIG-FRONTEND-LOOSE-01` | `{{ ai_config_rule }}` |
159
- | Q22 = Any value N | `D-AI-LINES-01` (replace `{{ ai_max_lines }}`) | `{{ ai_max_lines }}` |
159
+ | Q22 = 200 / 300 / 500 | `D-AI-LINES-01` | `{{ ai_max_lines }}` |
160
+ | Q22 = No numeric limit | `D-AI-LINES-NONE-01` | `{{ ai_max_lines }}` |
160
161
  | Q23 = LCP <2.5s | `D-PERF-25-01` | `{{ performance_rules }}` |
161
162
  | Q23 = LCP <1.5s | `D-PERF-15-01` | `{{ performance_rules }}` |
162
163
  | Q23 = Not required yet | `D-PERF-NONE-01` | `{{ performance_rules }}` |
@@ -189,8 +190,10 @@ Appendix placeholders are auto-generated by AI in Phase 4:
189
190
  ### D-REACT-02
190
191
  **Trigger**: Q1 = React | **Inject into**: `{{ style_specific_rules }}` (only when Q4 is not CSS-in-JS)
191
192
 
192
- - React components use `clsx` / `classnames` to concatenate className. Forbid string concatenation.
193
- - Conditional styles must be expressed in `clsx`. Avoid ternary operator stacking.
193
+ - Compose `className` values without inventing a helper package.
194
+ - If `clsx` or `classnames` is already in `package.json`, use that installed helper for conditional classes and do not reintroduce ad-hoc string concatenation for the same cases.
195
+ - If neither helper is installed, follow the project's existing composition pattern (for example array `.filter(Boolean).join(' ')` or equivalent). Do not add `clsx` or `classnames` unless Q19 authorizes a new dependency.
196
+ - Never emit Must-install for `clsx` or `classnames` when they are absent and Q19 forbids self-initiated dependencies.
194
197
 
195
198
  ### D-VUE-01
196
199
  **Trigger**: Q1 = Vue 3 | **Inject into**: `{{ tech_stack_rules }}`
@@ -287,7 +290,9 @@ Appendix placeholders are auto-generated by AI in Phase 4:
287
290
  - Extract as `@apply` component class (only for generic semantic components), or
288
291
  - Split into sub-components.
289
292
  - State variant order fixed: `base → hover → focus → active → disabled → dark`.
290
- - Forbid writing complex conditional class string concatenation in templates. Must use `clsx` or `tailwind-variants` / `cva`.
293
+ - Forbid writing complex conditional class string concatenation in templates.
294
+ - If `clsx`, `tailwind-variants`, or `cva` is already in `package.json`, use that installed helper for complex conditional classes.
295
+ - If none of those helpers are installed, extract a sub-component or `@apply` class instead of adding a package, unless Q19 authorizes the dependency.
291
296
  - Recommend installing and enabling `prettier-plugin-tailwindcss` for automatic utility class sorting. This remains non-binding unless already selected or present.
292
297
  - Dense tables and lists: do not rely on `nowrap` or `max-width` without truncation or wrapping. Cover primitive defaults such as `whitespace-nowrap` on table cells. Do not stack `min-width` / `min-w-*` tracks that overflow the content pane. `nowrap` is only for short status, numeric, or action cells.
293
298
 
@@ -601,8 +606,20 @@ Appendix placeholders are auto-generated by AI in Phase 4:
601
606
  - Search the relevant component ownership areas before creating a duplicate; do not invent or periodically maintain an unselected index file. Never invent `src/components/index.ts` when no component registry was detected or selected.
602
607
 
603
608
  ### D-AI-LINES-01
604
- **Trigger**: Q22 = N | **Inject into**: `{{ ai_max_lines }}`
605
- **Generation rule**: Directly replace the placeholder with the user's chosen value (200 / 300 / 500 / no limit).
609
+ **Trigger**: Q22 = 200 / 300 / 500 | **Inject into**: `{{ ai_max_lines }}`
610
+ **Generation rule**: Replace the placeholder with the selected number plus an explicit no-checker statement.
611
+
612
+ - Record the selected file-size preference of N lines.
613
+ - There is no automated line-count checker, split hint, lint, or CI gate for this number.
614
+ - Prefer extraction when a change would make an already-long file longer, instead of appending unrelated responsibility.
615
+ - Legitimate long files such as generated parsers or schema/type collections may stay long.
616
+
617
+ ### D-AI-LINES-NONE-01
618
+ **Trigger**: Q22 = No numeric limit | **Inject into**: `{{ ai_max_lines }}`
619
+
620
+ - No numeric file-size limit.
621
+ - Prefer extraction when a change would make an already-long file longer, instead of appending unrelated responsibility.
622
+ - Legitimate long files such as generated parsers or schema/type collections may stay long.
606
623
 
607
624
  ### D-PERF-25-01
608
625
  **Trigger**: Q23 = LCP < 2.5s | **Inject into**: `{{ performance_rules }}`
@@ -818,7 +835,7 @@ Appendix placeholders are auto-generated by AI in Phase 4:
818
835
  | `{{ test_coverage }}` | Q15 answer | Direct fill |
819
836
  | `{{ unit_test_framework }}` | Q16 answer | Direct fill |
820
837
  | `{{ e2e_framework }}` | Q17 answer | Direct fill |
821
- | `{{ ai_max_lines }}` | Q22 answer | Direct fill (D-AI-LINES-01) |
838
+ | `{{ ai_max_lines }}` | Q22 answer | Direct fill (D-AI-LINES-01 / D-AI-LINES-NONE-01) |
822
839
  | `{{ lcp_target }}` | Q23 answer | Direct fill |
823
840
  | `{{ bundle_size }}` | Q24 answer | Direct fill |
824
841
  | `{{ token_layering_rules }}` | D-TOKEN-{1L/2L/3L}-01 | Derivation |
@@ -299,12 +299,12 @@ Total: 25 questions.
299
299
  ### Q22. AI Single File Generation Limit
300
300
  - **Options**:
301
301
  - A) 200 lines
302
- - B) 300 lines **【Recommended】**
302
+ - B) 300 lines
303
303
  - C) 500 lines
304
- - D) No limit
305
- - **Strict option**: A
306
- - **Note**: Exceeding the limit auto-triggers a split hint to prevent god components.
307
- - **Maps to**: `{{ ai_max_lines }}` (appears in TL;DR + §3.3 + §7.3 + §8.2 — AI replaces the value in all locations)
304
+ - D) No numeric limit **【Recommended】**
305
+ - **Strict option**: D
306
+ - **Note**: There is no automated line-count checker or split hint. Numeric options record a selected preference only. The recommended default is no numeric cap; prefer extraction when a change would make an already-long file longer.
307
+ - **Maps to**: `{{ ai_max_lines }}` (Decision Ledger in §1 and File-size guidance in §6.2)
308
308
 
309
309
  ---
310
310
 
@@ -106,6 +106,7 @@ Check every fixed and derived rule against the ledger:
106
106
  - A selected `none` or `not required` decision suppresses incompatible requirement blocks.
107
107
  - Cross-layer references must agree on shared decisions; report disagreement instead of choosing silently.
108
108
  - If two active rules require incompatible behavior, fail generation, identify both source blocks, repair the source/decision state, and rerun the gate.
109
+ - A Must-level derivation that names a package is incompatible with dependency permission forbid unless that package is already present or the decision ledger selected it. Fail generation rather than emit both.
109
110
 
110
111
  ## Step 7: Render and Validate
111
112
 
@@ -49,7 +49,6 @@ SCHEMA_VERSION = "dev-pipeline-feature-list-v1"
49
49
  VALID_STATUSES = {"pending", "in_progress", "completed", "failed", "skipped", "split", "auto_skipped"}
50
50
  VALID_COMPLEXITIES = {"low", "medium", "high", "critical"}
51
51
  VALID_PRIORITIES = {"critical", "high", "medium", "low"}
52
- VALID_GRANULARITIES = {"feature", "sub_feature", "auto"}
53
52
  ALLOWED_LIST_FIELDS = {
54
53
  "$schema", "project_name", "project_description", "created_at",
55
54
  "created_by", "features", "global_context",
@@ -59,14 +58,15 @@ ALLOWED_GLOBAL_CONTEXT_FIELDS = {
59
58
  "frontend_styling", "backend_framework", "database", "orm",
60
59
  "design_system", "testing_strategy", "bundler", "project_type",
61
60
  }
62
- ALLOWED_FEATURE_FIELDS = {
61
+ CURRENT_FEATURE_FIELDS = {
63
62
  "id", "title", "description", "priority", "estimated_complexity",
64
- "dependencies", "acceptance_criteria", "status", "session_granularity",
65
- "sub_features", "model", "completion_notes", "user_context",
66
- "browser_interaction", "testing",
63
+ "dependencies", "acceptance_criteria", "status", "model", "completion_notes",
64
+ "user_context", "browser_interaction", "testing",
67
65
  }
66
+ # Historical lists may still carry these keys. They are ignored residue, not
67
+ # current planning fields, and must not fail unknown-field validation.
68
+ LEFTOVER_IGNORED_FEATURE_FIELDS = {"session_granularity", "sub_features"}
68
69
  FEATURE_ID_RE = re.compile(r"^F-\d{3}(-[A-Z])?$")
69
- SUB_FEATURE_ID_RE = re.compile(r"^F-\d{3}-[A-Z]$")
70
70
 
71
71
  # Keywords in acceptance criteria that indicate UI/browser interaction behavior.
72
72
  UI_KEYWORDS_RE = re.compile(
@@ -249,7 +249,6 @@ def validate_feature_list(data, is_new_plan=True):
249
249
  "warnings": warnings,
250
250
  "stats": {
251
251
  "total_features": 0,
252
- "total_sub_features": 0,
253
252
  "complexity_distribution": {},
254
253
  "max_dependency_depth": 0,
255
254
  "has_cycles": False,
@@ -267,7 +266,6 @@ def validate_feature_list(data, is_new_plan=True):
267
266
  seen_ids = set()
268
267
  priorities = []
269
268
  complexity_dist = {"low": 0, "medium": 0, "high": 0, "critical": 0}
270
- total_sub_features = 0
271
269
 
272
270
  for idx, feat in enumerate(features):
273
271
  label = "features[{}]".format(idx)
@@ -283,7 +281,11 @@ def validate_feature_list(data, is_new_plan=True):
283
281
  label, ", ".join(sorted(missing))
284
282
  ))
285
283
 
286
- unknown = set(feat.keys()) - ALLOWED_FEATURE_FIELDS
284
+ unknown = (
285
+ set(feat.keys())
286
+ - CURRENT_FEATURE_FIELDS
287
+ - LEFTOVER_IGNORED_FEATURE_FIELDS
288
+ )
287
289
  if unknown:
288
290
  errors.append("{} has unknown fields: {}".format(
289
291
  label, ", ".join(sorted(unknown))
@@ -380,16 +382,6 @@ def validate_feature_list(data, is_new_plan=True):
380
382
  else:
381
383
  complexity_dist[complexity] += 1
382
384
 
383
- # -- Optional leftover keys (historical lists only; not taught for new items) --
384
- granularity = feat.get("session_granularity")
385
- if granularity is not None and granularity not in VALID_GRANULARITIES:
386
- errors.append(
387
- "{}: session_granularity '{}' invalid, must be one of: {}".format(
388
- label, granularity, ", ".join(sorted(VALID_GRANULARITIES))
389
- )
390
- )
391
-
392
- subs = feat.get("sub_features")
393
385
  # -- Browser interaction check (warning for frontend features) --
394
386
  has_frontend = bool(
395
387
  data.get("global_context", {}).get("frontend_framework")
@@ -406,40 +398,6 @@ def validate_feature_list(data, is_new_plan=True):
406
398
  "field. Consider adding browser verification.".format(label)
407
399
  )
408
400
 
409
- if isinstance(subs, list):
410
- for sidx, sub in enumerate(subs):
411
- sub_label = "{}->sub_features[{}]".format(label, sidx)
412
- if not isinstance(sub, dict):
413
- errors.append("{} is not an object".format(sub_label))
414
- continue
415
-
416
- sub_missing = {"id", "title", "description"} - set(sub.keys())
417
- if sub_missing:
418
- errors.append("{} missing required keys: {}".format(
419
- sub_label, ", ".join(sorted(sub_missing))
420
- ))
421
-
422
- sub_id = sub.get("id", "")
423
- if not SUB_FEATURE_ID_RE.match(str(sub_id)):
424
- errors.append(
425
- "{}: id '{}' must be F-NNN-X format".format(sub_label, sub_id)
426
- )
427
-
428
- # Sub-feature ID should share parent prefix
429
- parent_prefix = str(fid).rstrip("ABCDEFGHIJKLMNOPQRSTUVWXYZ").rstrip("-")
430
- sub_prefix = str(sub_id)[:5] # e.g. "F-001"
431
- if parent_prefix and sub_prefix != parent_prefix:
432
- warnings.append(
433
- "{}: sub-feature '{}' does not share parent prefix '{}'".format(
434
- sub_label, sub_id, parent_prefix
435
- )
436
- )
437
-
438
- if sub_id in seen_ids:
439
- errors.append("{}: duplicate id '{}'".format(sub_label, sub_id))
440
- seen_ids.add(sub_id)
441
- total_sub_features += 1
442
-
443
401
  # ------------------------------------------------------------------
444
402
  # 3. Dependency validation
445
403
  # ------------------------------------------------------------------
@@ -470,7 +428,6 @@ def validate_feature_list(data, is_new_plan=True):
470
428
  "warnings": warnings,
471
429
  "stats": {
472
430
  "total_features": len(features),
473
- "total_sub_features": total_sub_features,
474
431
  "complexity_distribution": complexity_dist,
475
432
  "max_dependency_depth": max_depth,
476
433
  "has_cycles": has_cycles,
@@ -699,7 +656,6 @@ def cmd_validate(args):
699
656
  "warnings": [],
700
657
  "stats": {
701
658
  "total_features": 0,
702
- "total_sub_features": 0,
703
659
  "complexity_distribution": {},
704
660
  "max_dependency_depth": 0,
705
661
  "has_cycles": False,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.1.181",
3
+ "version": "1.1.183",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/config.js CHANGED
@@ -28,7 +28,6 @@ import {
28
28
  installSettings,
29
29
  installProjectMemory,
30
30
  installPipeline,
31
- installGitignore,
32
31
  installGitHook,
33
32
  installPrizmkitScripts,
34
33
  resolveSkillList,
@@ -53,7 +52,7 @@ import {
53
52
  selectRulesPreset,
54
53
  confirmPipeline,
55
54
  } from './prompts.js';
56
- import { isKnownPlatform, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
55
+ import { isKnownPlatform, platformLabel, privateProjectMemoryFile, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
57
56
  import { normalizeRuntime, runtimeLabel } from './runtimes.js';
58
57
  import { applyAiCliLaunchToConfig, resolveAiCliLaunchSelection, storedAiCliLaunch } from './ai-cli-launch.js';
59
58
 
@@ -737,14 +736,7 @@ export async function runConfig(directory, options = {}) {
737
736
  }
738
737
  }
739
738
 
740
- // 5f. Update .gitignore
741
- console.log(chalk.blue('\n Gitignore:'));
742
- await installGitignore(projectRoot, {
743
- pipeline: newConfig.pipeline,
744
- privateMemoryFiles: privateProjectMemoryFiles(newPlatforms),
745
- }, false);
746
-
747
- // 5g. Runtime-aware git hook and PrizmKit helper scripts
739
+ // 5f. Runtime-aware git hook and PrizmKit helper scripts
748
740
  if (newConfig.runtime !== currentConfig.runtime || runtimeManifestNeedsNormalization || runtimeOptionNeedsNormalization) {
749
741
  console.log(chalk.blue('\n Git Hook:'));
750
742
  await installGitHook(projectRoot, false, newConfig.runtime);
@@ -15,7 +15,7 @@ import { execSync } from 'node:child_process';
15
15
  import path from 'path';
16
16
  import os from 'node:os';
17
17
  import fs from 'fs-extra';
18
- import { resolvePayloadPlatforms } from './platforms.js';
18
+ import { payloadSkillRoots } from './platforms.js';
19
19
 
20
20
  /**
21
21
  * @param {Object} skill - Skill definition from external_skills.known
@@ -99,11 +99,5 @@ export async function cleanExternalSkillArtifacts(projectRoot, platform, aiCli =
99
99
  }
100
100
 
101
101
  function getTargetDirs(platform, projectRoot, aiCli = '') {
102
- return resolvePayloadPlatforms(platform, aiCli).map(p => {
103
- if (p === 'codebuddy') return path.join(projectRoot, '.codebuddy', 'skills');
104
- if (p === 'codex') return path.join(projectRoot, '.agents', 'skills');
105
- if (p === 'pi') return path.join(projectRoot, '.pi', 'skills');
106
- if (p === 'cursor') return path.join(projectRoot, '.cursor', 'skills');
107
- return path.join(projectRoot, '.claude', 'skills');
108
- });
102
+ return payloadSkillRoots(platform, projectRoot, aiCli);
109
103
  }
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Generate only explicit private host-memory ignores.
3
3
  *
4
- * `.prizmkit/**` tracking policy is project-controlled: this module never adds,
5
- * removes, or interprets framework-directory ignore entries.
4
+ * `.prizmkit/**` tracking policy is project-controlled: this module never adds
5
+ * framework-directory ignore entries. Only install appends private host-memory
6
+ * ignores; upgrade and config must not write `.gitignore`.
6
7
  */
7
8
 
8
9
  /**
package/src/platforms.js CHANGED
@@ -1,3 +1,4 @@
1
+ import path from 'path';
1
2
  import { isBuiltInAiCli } from './ai-cli-launch.js';
2
3
 
3
4
  export const PLATFORM_IDS = ['codebuddy', 'claude', 'codex', 'pi', 'cursor'];
@@ -93,3 +94,15 @@ export function defaultCliForPlatform(platform) {
93
94
  if (platform === 'cursor') return 'agent';
94
95
  return '';
95
96
  }
97
+
98
+ export function nativeSkillRoot(platform, projectRoot) {
99
+ if (platform === 'codebuddy') return path.join(projectRoot, '.codebuddy', 'skills');
100
+ if (platform === 'codex') return path.join(projectRoot, '.agents', 'skills');
101
+ if (platform === 'pi') return path.join(projectRoot, '.pi', 'skills');
102
+ if (platform === 'cursor') return path.join(projectRoot, '.cursor', 'skills');
103
+ return path.join(projectRoot, '.claude', 'skills');
104
+ }
105
+
106
+ export function payloadSkillRoots(platform, projectRoot, aiCli = '') {
107
+ return resolvePayloadPlatforms(platform, aiCli).map(p => nativeSkillRoot(p, projectRoot));
108
+ }
package/src/scaffold.js CHANGED
@@ -25,8 +25,8 @@ import {
25
25
  getSkillCandidatePaths,
26
26
  } from './metadata.js';
27
27
  import { generateGitignore } from './gitignore-template.js';
28
- import { buildManifest, writeManifest } from './manifest.js';
29
- import { defaultCliForPlatform, expandPlatforms, isKnownPlatform, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
28
+ import { buildManifest, readManifestForLifecycle, writeManifest } from './manifest.js';
29
+ import { defaultCliForPlatform, expandPlatforms, isKnownPlatform, nativeSkillRoot, payloadSkillRoots, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
30
30
  import { normalizeRuntime, runtimeLabel } from './runtimes.js';
31
31
  import { applyAiCliLaunchToConfig, resolveAiCliLaunchSelection } from './ai-cli-launch.js';
32
32
 
@@ -1378,26 +1378,30 @@ export async function installGitignore(projectRoot, options = {}, dryRun) {
1378
1378
  pipeline: options.pipeline,
1379
1379
  privateMemoryFiles: options.privateMemoryFiles || [],
1380
1380
  });
1381
+ const existed = await fs.pathExists(targetPath);
1381
1382
 
1382
- if (!templateContent) {
1383
- if (dryRun) console.log(chalk.gray(' [dry-run] .gitignore (no managed private-memory entries)'));
1383
+ if (dryRun) {
1384
+ if (!templateContent) {
1385
+ if (!existed) console.log(chalk.gray(' [dry-run] .gitignore (no managed private-memory entries)'));
1386
+ return;
1387
+ }
1388
+ console.log(chalk.gray(' [dry-run] .gitignore (private host memory only)'));
1384
1389
  return;
1385
1390
  }
1386
1391
 
1387
- if (dryRun) {
1388
- console.log(chalk.gray(` [dry-run] .gitignore (private host memory only)`));
1392
+ if (!templateContent) {
1393
+ if (!existed) console.log(chalk.gray(' • .gitignore (no managed private-memory entries)'));
1389
1394
  return;
1390
1395
  }
1391
1396
 
1392
- if (await fs.pathExists(targetPath)) {
1393
- // 合并模式:追加缺失条目
1394
- const existing = await fs.readFile(targetPath, 'utf-8');
1395
- const existingLines = new Set(existing.split('\n').map(l => l.trim()));
1397
+ if (existed) {
1398
+ const current = await fs.readFile(targetPath, 'utf-8');
1399
+ const existingLines = new Set(current.split('\n').map(l => l.trim()));
1396
1400
  const templateLines = templateContent.split('\n').map(l => l.trim()).filter(Boolean);
1397
1401
  const missing = templateLines.filter(line => !existingLines.has(line) && !line.startsWith('#'));
1398
1402
 
1399
1403
  if (missing.length > 0) {
1400
- const separator = existing.endsWith('\n') ? '' : '\n';
1404
+ const separator = current.endsWith('\n') ? '' : '\n';
1401
1405
  const managedHeader = '# PrizmKit private host memory';
1402
1406
  const header = existingLines.has(managedHeader) ? '' : `${managedHeader}\n`;
1403
1407
  await fs.appendFile(targetPath, separator + '\n' + header + missing.join('\n') + '\n');
@@ -1405,23 +1409,90 @@ export async function installGitignore(projectRoot, options = {}, dryRun) {
1405
1409
  } else {
1406
1410
  console.log(chalk.green(' ✓ .gitignore (up-to-date)'));
1407
1411
  }
1408
- } else {
1409
- await fs.writeFile(targetPath, `${templateContent}\n`);
1410
- console.log(chalk.green(' ✓ .gitignore'));
1412
+ return;
1411
1413
  }
1414
+
1415
+ await fs.writeFile(targetPath, `${templateContent}\n`);
1416
+ console.log(chalk.green(' ✓ .gitignore'));
1412
1417
  }
1413
1418
 
1414
1419
  // ============================================================
1415
1420
  // Playwright CLI 安装
1416
1421
  // ============================================================
1417
1422
 
1423
+ const PLAYWRIGHT_SKILL_NAME = 'playwright-cli';
1424
+
1425
+ function extrasContextObject(value) {
1426
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
1427
+ }
1428
+
1429
+ function resolveOpenCliAutoDownload(autoDownloadOrContext, fallback = true) {
1430
+ if (extrasContextObject(autoDownloadOrContext)) {
1431
+ if (Object.prototype.hasOwnProperty.call(autoDownloadOrContext, 'openCliAutoDownload')) {
1432
+ return Boolean(autoDownloadOrContext.openCliAutoDownload);
1433
+ }
1434
+ return fallback;
1435
+ }
1436
+ if (typeof autoDownloadOrContext === 'boolean') return autoDownloadOrContext;
1437
+ return fallback;
1438
+ }
1439
+
1440
+ function completePlaywrightSkillDir(dir) {
1441
+ return dir && fs.pathExistsSync(path.join(dir, 'SKILL.md')) ? dir : null;
1442
+ }
1443
+
1444
+ function discoverPlaywrightSkillSource(projectRoot) {
1445
+ const home = process.env.HOME || process.env.USERPROFILE || '.';
1446
+ return completePlaywrightSkillDir(path.join(projectRoot, '.claude', 'skills', PLAYWRIGHT_SKILL_NAME))
1447
+ || completePlaywrightSkillDir(path.join(home, '.claude', 'skills', PLAYWRIGHT_SKILL_NAME));
1448
+ }
1449
+
1450
+ async function distributePlaywrightSkill(projectRoot, extrasContext, dryRun) {
1451
+ const platform = extrasContext?.platform;
1452
+ if (!platform) {
1453
+ console.log(chalk.yellow(' ⚠ playwright-cli skills were not copied: install platform is missing'));
1454
+ return;
1455
+ }
1456
+ const aiCli = extrasContext?.aiCli || '';
1457
+ const payloadPlatforms = resolvePayloadPlatforms(platform, aiCli);
1458
+ const destinations = payloadSkillRoots(platform, projectRoot, aiCli).map(root => path.join(root, PLAYWRIGHT_SKILL_NAME));
1459
+ if (dryRun) {
1460
+ for (const dest of destinations) {
1461
+ console.log(chalk.gray(` [dry-run] ${path.relative(projectRoot, dest)}`));
1462
+ }
1463
+ return;
1464
+ }
1465
+ const source = discoverPlaywrightSkillSource(projectRoot);
1466
+ if (!source) {
1467
+ console.log(chalk.yellow(' ⚠ playwright-cli skill tree was not found after install --skills'));
1468
+ return;
1469
+ }
1470
+ const sourceReal = await fs.realpath(source).catch(() => path.resolve(source));
1471
+ for (const dest of destinations) {
1472
+ const destReal = await fs.realpath(dest).catch(() => path.resolve(dest));
1473
+ if (destReal === sourceReal) continue;
1474
+ await fs.remove(dest).catch(() => {});
1475
+ await fs.copy(source, dest);
1476
+ console.log(chalk.green(` ✓ ${path.relative(projectRoot, dest)}`));
1477
+ }
1478
+ if (!payloadPlatforms.includes('claude')) {
1479
+ const leftover = path.join(nativeSkillRoot('claude', projectRoot), PLAYWRIGHT_SKILL_NAME);
1480
+ if (await fs.pathExists(leftover)) {
1481
+ await fs.remove(leftover);
1482
+ console.log(chalk.gray(` • removed leftover ${path.relative(projectRoot, leftover)}`));
1483
+ }
1484
+ }
1485
+ }
1486
+
1418
1487
  /**
1419
1488
  * 安装 playwright-cli(全局 npm 包 + AI agent skills)
1420
1489
  * 用于浏览器交互验证(browser_interaction 功能)
1421
1490
  */
1422
- export async function installPlaywrightCli(projectRoot, dryRun) {
1491
+ export async function installPlaywrightCli(projectRoot, dryRun, extrasContext = {}) {
1492
+ const context = extrasContextObject(extrasContext) ? extrasContext : {};
1423
1493
  if (dryRun) {
1424
1494
  console.log(chalk.gray(' [dry-run] @playwright/cli (global install + workspace init)'));
1495
+ await distributePlaywrightSkill(projectRoot, context, true);
1425
1496
  return;
1426
1497
  }
1427
1498
 
@@ -1451,6 +1522,7 @@ export async function installPlaywrightCli(projectRoot, dryRun) {
1451
1522
  if (fs.pathExistsSync(dotPlaywright)) {
1452
1523
  fs.removeSync(dotPlaywright);
1453
1524
  }
1525
+ await distributePlaywrightSkill(projectRoot, context, false);
1454
1526
  } catch (e) {
1455
1527
  console.log(chalk.yellow(` ⚠ Skills install skipped: ${e.message}`));
1456
1528
  console.log(chalk.yellow(' ⚠ Run manually: playwright-cli install --skills'));
@@ -1500,6 +1572,7 @@ function isOpenCliAvailable() {
1500
1572
  * 用于浏览器交互验证,复用 Chrome 已登录会话(OAuth/SSO/第三方集成)
1501
1573
  */
1502
1574
  export async function installOpenCli(projectRoot, dryRun, autoDownload = true) {
1575
+ const shouldAutoDownload = resolveOpenCliAutoDownload(autoDownload);
1503
1576
  if (dryRun) {
1504
1577
  console.log(chalk.gray(' [dry-run] @jackwener/opencli (global install)'));
1505
1578
  return;
@@ -1531,7 +1604,7 @@ export async function installOpenCli(projectRoot, dryRun, autoDownload = true) {
1531
1604
  );
1532
1605
  if (fs.pathExistsSync(extensionManifest)) {
1533
1606
  console.log(chalk.green(' ✓ OpenCLI extension files (already downloaded)'));
1534
- } else if (autoDownload) {
1607
+ } else if (shouldAutoDownload) {
1535
1608
  await downloadOpenCliExtension();
1536
1609
  } else {
1537
1610
  printOpenCliManualSteps();
@@ -1717,6 +1790,20 @@ export async function scaffold(config) {
1717
1790
  console.log('');
1718
1791
  }
1719
1792
 
1793
+ let existingManifest = null;
1794
+ try {
1795
+ existingManifest = await readManifestForLifecycle(projectRoot);
1796
+ } catch {
1797
+ existingManifest = null;
1798
+ }
1799
+ const { reconcileDroppedPayloadPlatformRules } = await import('./upgrade.js');
1800
+ await reconcileDroppedPayloadPlatformRules(projectRoot, {
1801
+ manifest: existingManifest,
1802
+ nextPlatforms: payloadPlatforms,
1803
+ rulesMeta: await loadRulesMetadata(),
1804
+ dryRun,
1805
+ });
1806
+
1720
1807
  // 6. Pipeline
1721
1808
  let installedPipelineFiles = [];
1722
1809
  if (pipeline) {
@@ -1784,7 +1871,7 @@ export async function scaffold(config) {
1784
1871
  if (playwrightCli) {
1785
1872
  activeExtras.push('playwright-cli');
1786
1873
  console.log(chalk.blue(` ${EXTRAS_REGISTRY['playwright-cli'].label}:`));
1787
- await installPlaywrightCli(projectRoot, dryRun);
1874
+ await installPlaywrightCli(projectRoot, dryRun, { platform, aiCli: resolvedAiCli });
1788
1875
  console.log('');
1789
1876
  }
1790
1877
  if (openCli) {
package/src/upgrade.js CHANGED
@@ -23,7 +23,6 @@ import {
23
23
  installPipeline,
24
24
  installPrizmkitScripts,
25
25
  installGitHook,
26
- installGitignore,
27
26
  installProjectMemory,
28
27
  resolvePipelineFileList,
29
28
  findStaleManagedPipelineFiles,
@@ -33,7 +32,7 @@ import {
33
32
  removeRetiredAgentTeamArtifacts,
34
33
  EXTRAS_REGISTRY,
35
34
  } from './scaffold.js';
36
- import { platformLabel, privateProjectMemoryFiles, resolvePayloadPlatforms } from './platforms.js';
35
+ import { expandPlatforms, PLATFORM_IDS, platformLabel, resolvePayloadPlatforms, uniquePlatforms } from './platforms.js';
37
36
  import { normalizeRuntime, runtimeLabel } from './runtimes.js';
38
37
 
39
38
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -119,31 +118,123 @@ export async function removeAgentFiles(platform, projectRoot, agentFileNames, dr
119
118
  }
120
119
  }
121
120
 
121
+ export const CURSOR_FRAMEWORK_RULE_SOURCE = 'prizmkit-framework.md';
122
+
123
+ function ruleInstallBasename(platform, fileName) {
124
+ const baseName = path.basename(fileName);
125
+ return platform === 'codebuddy' || platform === 'cursor'
126
+ ? baseName.replace(/\.md$/, '.mdc')
127
+ : baseName;
128
+ }
129
+
130
+ function platformRuleSearchRoots(platform, projectRoot) {
131
+ if (platform === 'claude') return [path.join(projectRoot, '.claude', 'rules')];
132
+ if (platform === 'codex') {
133
+ return [
134
+ path.join(projectRoot, '.agents', 'rules'),
135
+ path.join(projectRoot, '.codex', 'rules'),
136
+ ];
137
+ }
138
+ if (platform === 'pi') return [path.join(projectRoot, '.pi', 'rules')];
139
+ if (platform === 'cursor') return [path.join(projectRoot, '.cursor', 'rules')];
140
+ return [path.join(projectRoot, '.codebuddy', 'rules')];
141
+ }
142
+
143
+ export function managedRuleFileNames(rulesMeta, manifest) {
144
+ const names = new Set();
145
+ for (const key of Object.keys(rulesMeta?.rules || {})) {
146
+ names.add(`${path.basename(key)}.md`);
147
+ }
148
+ for (const recorded of manifest?.files?.rules || []) {
149
+ const baseName = path.basename(recorded);
150
+ names.add(baseName.endsWith('.mdc') ? baseName.replace(/\.mdc$/, '.md') : baseName);
151
+ }
152
+ names.add(CURSOR_FRAMEWORK_RULE_SOURCE);
153
+ return [...names];
154
+ }
155
+
156
+ export function previousPayloadPlatformsFromManifest(manifest) {
157
+ if (!manifest) return [];
158
+ const listed = [];
159
+ if (Array.isArray(manifest.files?.payloadPlatforms)) {
160
+ listed.push(...manifest.files.payloadPlatforms);
161
+ }
162
+ if (manifest.platform) {
163
+ const group = manifest.platform === 'both' ? 'all' : manifest.platform;
164
+ listed.push(...expandPlatforms(group));
165
+ }
166
+ return uniquePlatforms(listed);
167
+ }
168
+
169
+ export async function detectManagedRulePlatforms(projectRoot, ruleFileNames) {
170
+ const found = [];
171
+ for (const platform of PLATFORM_IDS) {
172
+ let hit = false;
173
+ for (const dir of platformRuleSearchRoots(platform, projectRoot)) {
174
+ for (const fileName of ruleFileNames) {
175
+ if (await fs.pathExists(path.join(dir, ruleInstallBasename(platform, fileName)))) {
176
+ hit = true;
177
+ break;
178
+ }
179
+ }
180
+ if (hit) break;
181
+ }
182
+ if (hit) found.push(platform);
183
+ }
184
+ return found;
185
+ }
186
+
187
+ export async function collectPreviousPayloadPlatforms(projectRoot, manifest, ruleFileNames) {
188
+ return uniquePlatforms([
189
+ ...previousPayloadPlatformsFromManifest(manifest),
190
+ ...(await detectManagedRulePlatforms(projectRoot, ruleFileNames)),
191
+ ]);
192
+ }
193
+
194
+ export async function removeDroppedPayloadPlatformRules({
195
+ projectRoot,
196
+ previousPlatforms,
197
+ nextPlatforms,
198
+ ruleFileNames,
199
+ dryRun,
200
+ }) {
201
+ const next = new Set(nextPlatforms);
202
+ const dropped = uniquePlatforms(previousPlatforms).filter(platform => !next.has(platform));
203
+ if (!dropped.length) return dropped;
204
+ console.log(chalk.blue('\n Dropped-platform rules:'));
205
+ for (const platform of dropped) {
206
+ console.log(chalk.blue(` Removing leftover PrizmKit rules (${platformLabel(platform)}):`));
207
+ await removeRuleFiles(platform, projectRoot, ruleFileNames, dryRun);
208
+ }
209
+ return dropped;
210
+ }
211
+
212
+ export async function reconcileDroppedPayloadPlatformRules(projectRoot, {
213
+ manifest,
214
+ nextPlatforms,
215
+ rulesMeta,
216
+ dryRun,
217
+ }) {
218
+ const ruleFileNames = managedRuleFileNames(rulesMeta, manifest);
219
+ const previousPlatforms = await collectPreviousPayloadPlatforms(projectRoot, manifest, ruleFileNames);
220
+ return removeDroppedPayloadPlatformRules({
221
+ projectRoot,
222
+ previousPlatforms,
223
+ nextPlatforms,
224
+ ruleFileNames,
225
+ dryRun,
226
+ });
227
+ }
228
+
122
229
  /**
123
230
  * Remove rule files for a specific platform.
124
231
  */
125
232
  export async function removeRuleFiles(platform, projectRoot, ruleFileNames, dryRun) {
126
233
  for (const fileName of ruleFileNames) {
127
- const baseName = path.basename(fileName);
128
- const dir = platform === 'claude'
129
- ? path.join(projectRoot, '.claude', 'rules')
130
- : platform === 'codex'
131
- ? path.join(projectRoot, '.agents', 'rules')
132
- : platform === 'pi'
133
- ? path.join(projectRoot, '.pi', 'rules')
134
- : platform === 'cursor'
135
- ? path.join(projectRoot, '.cursor', 'rules')
136
- : path.join(projectRoot, '.codebuddy', 'rules');
137
- // Cursor and CodeBuddy use .mdc; Claude/Codex/Pi use Markdown.
138
- const targetName = platform === 'codebuddy' || platform === 'cursor'
139
- ? baseName.replace(/\.md$/, '.mdc')
140
- : baseName;
234
+ const targetName = ruleInstallBasename(platform, fileName);
141
235
  const filePaths = platform === 'codex'
142
- ? [
143
- path.join(dir, targetName),
144
- path.join(projectRoot, '.codex', 'rules', targetName),
145
- ]
146
- : [path.join(dir, targetName)];
236
+ ? platformRuleSearchRoots(platform, projectRoot).map(dir => path.join(dir, targetName))
237
+ : [path.join(platformRuleSearchRoots(platform, projectRoot)[0], targetName)];
147
238
  for (const filePath of filePaths) {
148
239
  if (await fs.pathExists(filePath)) {
149
240
  if (dryRun) {
@@ -412,7 +503,7 @@ export async function runUpgrade(directory, options = {}) {
412
503
  const entry = EXTRAS_REGISTRY[extraName];
413
504
  if (!entry) continue;
414
505
  console.log(chalk.blue(` ${entry.label}:`));
415
- await entry.install(projectRoot, dryRun);
506
+ await entry.install(projectRoot, dryRun, { platform, aiCli });
416
507
  console.log('');
417
508
  }
418
509
  }
@@ -421,13 +512,6 @@ export async function runUpgrade(directory, options = {}) {
421
512
  console.log(chalk.blue(' Git Hook:'));
422
513
  await installGitHook(projectRoot, dryRun, runtime);
423
514
 
424
- // .gitignore
425
- console.log(chalk.blue(' Gitignore:'));
426
- await installGitignore(projectRoot, {
427
- pipeline,
428
- privateMemoryFiles: privateProjectMemoryFiles(payloadPlatforms),
429
- }, dryRun);
430
-
431
515
  // PrizmKit scripts
432
516
  console.log(chalk.blue(' PrizmKit Scripts:'));
433
517
  await installPrizmkitScripts(projectRoot, dryRun, runtime);
@@ -438,6 +522,13 @@ export async function runUpgrade(directory, options = {}) {
438
522
  await installProjectMemory(p, projectRoot, dryRun);
439
523
  }
440
524
 
525
+ await reconcileDroppedPayloadPlatformRules(projectRoot, {
526
+ manifest: oldManifest,
527
+ nextPlatforms: payloadPlatforms,
528
+ rulesMeta,
529
+ dryRun,
530
+ });
531
+
441
532
  // 8. Write new manifest
442
533
  if (!dryRun) {
443
534
  await writeManifest(projectRoot, newManifest);