@givolt/i3-composer-agent 2.2.0 → 2.2.2

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.
Files changed (137) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.codex-plugin/plugin.json +1 -1
  5. package/README.md +77 -17
  6. package/bin/asset-fingerprint.cjs +3 -4
  7. package/bin/i3-composer-agent.cjs +15 -7
  8. package/bin/install.cjs +48 -57
  9. package/bin/legacy-native-files.json +329 -0
  10. package/bin/native-command-validation.cjs +27 -0
  11. package/bin/native-layout.cjs +135 -0
  12. package/bin/native-migration.cjs +93 -0
  13. package/bin/native-runtime.cjs +57 -0
  14. package/bin/native-version-validation.cjs +8 -0
  15. package/bin/tool-selector.cjs +164 -0
  16. package/bin/wizard.cjs +9 -44
  17. package/docs/codebuddy-setup.md +12 -3
  18. package/docs/codex-setup.md +9 -4
  19. package/docs/workbuddy-setup.md +13 -4
  20. package/evals/README.md +95 -0
  21. package/evals/cases/i3-api-and-interface-design.json +45 -0
  22. package/evals/cases/i3-browser-testing-with-devtools.json +44 -0
  23. package/evals/cases/i3-ci-cd-and-automation.json +45 -0
  24. package/evals/cases/i3-code-review-and-quality.json +49 -0
  25. package/evals/cases/i3-code-simplification.json +45 -0
  26. package/evals/cases/i3-constraint-driven-development.json +79 -0
  27. package/evals/cases/i3-context-engineering.json +44 -0
  28. package/evals/cases/i3-debugging-and-error-recovery.json +58 -0
  29. package/evals/cases/i3-deprecation-and-migration.json +52 -0
  30. package/evals/cases/i3-documentation-and-adrs.json +44 -0
  31. package/evals/cases/i3-doubt-driven-development.json +43 -0
  32. package/evals/cases/i3-frontend-ui-engineering.json +52 -0
  33. package/evals/cases/i3-git-workflow-and-versioning.json +47 -0
  34. package/evals/cases/i3-idea-refine.json +43 -0
  35. package/evals/cases/i3-incremental-implementation.json +57 -0
  36. package/evals/cases/i3-interview-me.json +42 -0
  37. package/evals/cases/i3-observability-and-instrumentation.json +44 -0
  38. package/evals/cases/i3-performance-optimization.json +53 -0
  39. package/evals/cases/i3-planning-and-task-breakdown.json +45 -0
  40. package/evals/cases/i3-security-and-hardening.json +53 -0
  41. package/evals/cases/i3-shipping-and-launch.json +56 -0
  42. package/evals/cases/i3-source-driven-development.json +44 -0
  43. package/evals/cases/i3-spec-driven-development.json +72 -0
  44. package/evals/cases/i3-test-driven-development.json +73 -0
  45. package/evals/cases/i3-using-agent-skills.json +44 -0
  46. package/evals/fixtures/i3-api-and-interface-design/service-brief.md +19 -0
  47. package/evals/fixtures/i3-browser-testing-with-devtools/README.md +5 -0
  48. package/evals/fixtures/i3-browser-testing-with-devtools/index.html +24 -0
  49. package/evals/fixtures/i3-browser-testing-with-devtools/server.js +15 -0
  50. package/evals/fixtures/i3-ci-cd-and-automation/package.json +8 -0
  51. package/evals/fixtures/i3-ci-cd-and-automation/src/slug.js +3 -0
  52. package/evals/fixtures/i3-ci-cd-and-automation/test/slug.test.js +9 -0
  53. package/evals/fixtures/i3-code-review-and-quality/user-search.diff +16 -0
  54. package/evals/fixtures/i3-code-simplification/config-parser.js +46 -0
  55. package/evals/fixtures/i3-code-simplification/config-parser.test.js +15 -0
  56. package/evals/fixtures/i3-context-engineering/context-audit.md +15 -0
  57. package/evals/fixtures/i3-debugging-and-error-recovery/pagination.js +8 -0
  58. package/evals/fixtures/i3-debugging-and-error-recovery/pagination.test.js +9 -0
  59. package/evals/fixtures/i3-debugging-and-error-recovery/time-pressure.md +6 -0
  60. package/evals/fixtures/i3-deprecation-and-migration/api-inventory.md +9 -0
  61. package/evals/fixtures/i3-documentation-and-adrs/decision-context.md +16 -0
  62. package/evals/fixtures/i3-doubt-driven-development/migration-plan.md +19 -0
  63. package/evals/fixtures/i3-frontend-ui-engineering/Button.tsx +7 -0
  64. package/evals/fixtures/i3-frontend-ui-engineering/design-system.md +11 -0
  65. package/evals/fixtures/i3-git-workflow-and-versioning/.eval/working-tree.patch +21 -0
  66. package/evals/fixtures/i3-git-workflow-and-versioning/app.js +7 -0
  67. package/evals/fixtures/i3-git-workflow-and-versioning/app.test.js +9 -0
  68. package/evals/fixtures/i3-incremental-implementation/reports.js +7 -0
  69. package/evals/fixtures/i3-incremental-implementation/reports.test.js +12 -0
  70. package/evals/fixtures/i3-incremental-implementation/tasks/plan.md +8 -0
  71. package/evals/fixtures/i3-observability-and-instrumentation/operations.md +11 -0
  72. package/evals/fixtures/i3-observability-and-instrumentation/payment-retry.js +14 -0
  73. package/evals/fixtures/i3-performance-optimization/benchmark.js +15 -0
  74. package/evals/fixtures/i3-performance-optimization/products.js +14 -0
  75. package/evals/fixtures/i3-planning-and-task-breakdown/notifications-spec.md +18 -0
  76. package/evals/fixtures/i3-security-and-hardening/webhook.js +11 -0
  77. package/evals/fixtures/i3-security-and-hardening/webhook.test.js +13 -0
  78. package/evals/fixtures/i3-shipping-and-launch/authority-pressure.md +6 -0
  79. package/evals/fixtures/i3-shipping-and-launch/launch-status.md +11 -0
  80. package/evals/fixtures/i3-source-driven-development/framework-task.md +10 -0
  81. package/evals/fixtures/i3-spec-driven-development/billing-brief.md +16 -0
  82. package/evals/fixtures/i3-test-driven-development/BUG.md +10 -0
  83. package/evals/fixtures/i3-test-driven-development/README.md +28 -0
  84. package/evals/fixtures/i3-test-driven-development/package.json +9 -0
  85. package/evals/fixtures/i3-test-driven-development/src/split.js +8 -0
  86. package/evals/fixtures/i3-test-driven-development/test/split.test.js +13 -0
  87. package/evals/fixtures/i3-using-agent-skills/incident.md +6 -0
  88. package/evals/fixtures/incremental-implementation-pressure/draft-export.js +17 -0
  89. package/evals/fixtures/incremental-implementation-pressure/scenario.md +9 -0
  90. package/evals/fixtures/spec-driven-development-decomposition/portal-brief.md +22 -0
  91. package/evals/fixtures/test-driven-development-ecosystem/README.md +9 -0
  92. package/evals/fixtures/test-driven-development-ecosystem/ledger.py +15 -0
  93. package/evals/fixtures/test-driven-development-ecosystem/test_ledger.py +19 -0
  94. package/evals/plugin/code-review-fires/graders/off-by-one.md +7 -0
  95. package/evals/plugin/code-review-fires/graders/severity-labels.md +4 -0
  96. package/evals/plugin/code-review-fires/graders/skill-fired.md +5 -0
  97. package/evals/plugin/code-review-fires/prompt.md +31 -0
  98. package/evals/plugin/code-review-stays-quiet/graders/not-fired.md +8 -0
  99. package/evals/plugin/code-review-stays-quiet/graders/tdd-fired.md +6 -0
  100. package/evals/plugin/code-review-stays-quiet/prompt.md +8 -0
  101. package/evals/plugin/code-review-stays-quiet-on-commit-message/graders/not-fired.md +8 -0
  102. package/evals/plugin/code-review-stays-quiet-on-commit-message/prompt.md +25 -0
  103. package/evals/skill-impact.md +6 -0
  104. package/evals/zh-CN/cases/i3-api-and-interface-design.json +46 -0
  105. package/evals/zh-CN/cases/i3-browser-testing-with-devtools.json +45 -0
  106. package/evals/zh-CN/cases/i3-ci-cd-and-automation.json +46 -0
  107. package/evals/zh-CN/cases/i3-code-review-and-quality.json +46 -0
  108. package/evals/zh-CN/cases/i3-code-simplification.json +46 -0
  109. package/evals/zh-CN/cases/i3-constraint-driven-development.json +70 -0
  110. package/evals/zh-CN/cases/i3-context-engineering.json +45 -0
  111. package/evals/zh-CN/cases/i3-debugging-and-error-recovery.json +60 -0
  112. package/evals/zh-CN/cases/i3-deprecation-and-migration.json +45 -0
  113. package/evals/zh-CN/cases/i3-documentation-and-adrs.json +45 -0
  114. package/evals/zh-CN/cases/i3-doubt-driven-development.json +45 -0
  115. package/evals/zh-CN/cases/i3-frontend-ui-engineering.json +45 -0
  116. package/evals/zh-CN/cases/i3-git-workflow-and-versioning.json +45 -0
  117. package/evals/zh-CN/cases/i3-idea-refine.json +44 -0
  118. package/evals/zh-CN/cases/i3-incremental-implementation.json +59 -0
  119. package/evals/zh-CN/cases/i3-interview-me.json +43 -0
  120. package/evals/zh-CN/cases/i3-observability-and-instrumentation.json +46 -0
  121. package/evals/zh-CN/cases/i3-performance-optimization.json +46 -0
  122. package/evals/zh-CN/cases/i3-planning-and-task-breakdown.json +46 -0
  123. package/evals/zh-CN/cases/i3-security-and-hardening.json +46 -0
  124. package/evals/zh-CN/cases/i3-shipping-and-launch.json +59 -0
  125. package/evals/zh-CN/cases/i3-source-driven-development.json +45 -0
  126. package/evals/zh-CN/cases/i3-spec-driven-development.json +62 -0
  127. package/evals/zh-CN/cases/i3-test-driven-development.json +76 -0
  128. package/evals/zh-CN/cases/i3-using-agent-skills.json +45 -0
  129. package/package.json +236 -5
  130. package/plugin.json +1 -1
  131. package/scripts/lib/skill-lint.js +586 -0
  132. package/scripts/run-evals.js +659 -0
  133. package/scripts/validate-artifact-paths.js +130 -0
  134. package/scripts/validate-commands.js +224 -0
  135. package/scripts/validate-reference-links.js +187 -0
  136. package/scripts/validate-skills.js +70 -0
  137. package/scripts/validate-versions.js +35 -0
@@ -0,0 +1,329 @@
1
+ {
2
+ "description": "Published native file inventory through 2.2.1; directory ownership never includes user additions.",
3
+ "files": [
4
+ "agents/code-reviewer.md",
5
+ "agents/security-auditor.md",
6
+ "agents/test-engineer.md",
7
+ "agents/web-performance-auditor.md",
8
+ "commands/build.md",
9
+ "commands/code-simplify.md",
10
+ "commands/constraints.md",
11
+ "commands/i3-build.md",
12
+ "commands/i3-code-simplify.md",
13
+ "commands/i3-constraints.md",
14
+ "commands/i3-plan.md",
15
+ "commands/i3-review.md",
16
+ "commands/i3-ship.md",
17
+ "commands/i3-spec.md",
18
+ "commands/i3-test.md",
19
+ "commands/i3-webperf.md",
20
+ "commands/plan.md",
21
+ "commands/review.md",
22
+ "commands/ship.md",
23
+ "commands/spec.md",
24
+ "commands/test.md",
25
+ "commands/webperf.md",
26
+ "docs/agents.md",
27
+ "i3-composer-agent-LICENSE",
28
+ "i3-composer-agent-NOTICE.md",
29
+ "i3-composer-agent/.agents/plugins/marketplace.json",
30
+ "i3-composer-agent/.claude-plugin/marketplace.json",
31
+ "i3-composer-agent/.claude-plugin/plugin.json",
32
+ "i3-composer-agent/.claude/commands/i3-build.md",
33
+ "i3-composer-agent/.claude/commands/i3-code-simplify.md",
34
+ "i3-composer-agent/.claude/commands/i3-constraints.md",
35
+ "i3-composer-agent/.claude/commands/i3-plan.md",
36
+ "i3-composer-agent/.claude/commands/i3-review.md",
37
+ "i3-composer-agent/.claude/commands/i3-ship.md",
38
+ "i3-composer-agent/.claude/commands/i3-spec.md",
39
+ "i3-composer-agent/.claude/commands/i3-test.md",
40
+ "i3-composer-agent/.claude/commands/i3-webperf.md",
41
+ "i3-composer-agent/.codex-plugin/plugin.json",
42
+ "i3-composer-agent/.gemini/commands/i3-build.toml",
43
+ "i3-composer-agent/.gemini/commands/i3-code-simplify.toml",
44
+ "i3-composer-agent/.gemini/commands/i3-constraints.toml",
45
+ "i3-composer-agent/.gemini/commands/i3-planning.toml",
46
+ "i3-composer-agent/.gemini/commands/i3-review.toml",
47
+ "i3-composer-agent/.gemini/commands/i3-ship.toml",
48
+ "i3-composer-agent/.gemini/commands/i3-spec.toml",
49
+ "i3-composer-agent/.gemini/commands/i3-test.toml",
50
+ "i3-composer-agent/.gemini/commands/i3-webperf.toml",
51
+ "i3-composer-agent/LICENSE",
52
+ "i3-composer-agent/README.md",
53
+ "i3-composer-agent/agents/code-reviewer.md",
54
+ "i3-composer-agent/agents/security-auditor.md",
55
+ "i3-composer-agent/agents/test-engineer.md",
56
+ "i3-composer-agent/agents/web-performance-auditor.md",
57
+ "i3-composer-agent/bin/agent-targets.json",
58
+ "i3-composer-agent/bin/asset-fingerprint.cjs",
59
+ "i3-composer-agent/bin/cleanup-backups.cjs",
60
+ "i3-composer-agent/bin/i3-composer-agent.cjs",
61
+ "i3-composer-agent/bin/install.cjs",
62
+ "i3-composer-agent/bin/native-content.cjs",
63
+ "i3-composer-agent/bin/skills-registry.LICENSE",
64
+ "i3-composer-agent/bin/tool-menu.cjs",
65
+ "i3-composer-agent/bin/tool-selector.cjs",
66
+ "i3-composer-agent/bin/wizard.cjs",
67
+ "i3-composer-agent/commands/i3-build.toml",
68
+ "i3-composer-agent/commands/i3-code-simplify.toml",
69
+ "i3-composer-agent/commands/i3-constraints.toml",
70
+ "i3-composer-agent/commands/i3-planning.toml",
71
+ "i3-composer-agent/commands/i3-review.toml",
72
+ "i3-composer-agent/commands/i3-ship.toml",
73
+ "i3-composer-agent/commands/i3-spec.toml",
74
+ "i3-composer-agent/commands/i3-test.toml",
75
+ "i3-composer-agent/commands/i3-webperf.toml",
76
+ "i3-composer-agent/docs/adoption-guide.md",
77
+ "i3-composer-agent/docs/agents.md",
78
+ "i3-composer-agent/docs/antigravity-setup.md",
79
+ "i3-composer-agent/docs/codebuddy-setup.md",
80
+ "i3-composer-agent/docs/codex-setup.md",
81
+ "i3-composer-agent/docs/commandcode-setup.md",
82
+ "i3-composer-agent/docs/copilot-cli-setup.md",
83
+ "i3-composer-agent/docs/copilot-setup.md",
84
+ "i3-composer-agent/docs/cursor-setup.md",
85
+ "i3-composer-agent/docs/gemini-cli-setup.md",
86
+ "i3-composer-agent/docs/getting-started.md",
87
+ "i3-composer-agent/docs/opencode-setup.md",
88
+ "i3-composer-agent/docs/other-hosts.md",
89
+ "i3-composer-agent/docs/windsurf-setup.md",
90
+ "i3-composer-agent/docs/workbuddy-setup.md",
91
+ "i3-composer-agent/evals/README.md",
92
+ "i3-composer-agent/evals/cases/i3-api-and-interface-design.json",
93
+ "i3-composer-agent/evals/cases/i3-browser-testing-with-devtools.json",
94
+ "i3-composer-agent/evals/cases/i3-ci-cd-and-automation.json",
95
+ "i3-composer-agent/evals/cases/i3-code-review-and-quality.json",
96
+ "i3-composer-agent/evals/cases/i3-code-simplification.json",
97
+ "i3-composer-agent/evals/cases/i3-constraint-driven-development.json",
98
+ "i3-composer-agent/evals/cases/i3-context-engineering.json",
99
+ "i3-composer-agent/evals/cases/i3-debugging-and-error-recovery.json",
100
+ "i3-composer-agent/evals/cases/i3-deprecation-and-migration.json",
101
+ "i3-composer-agent/evals/cases/i3-documentation-and-adrs.json",
102
+ "i3-composer-agent/evals/cases/i3-doubt-driven-development.json",
103
+ "i3-composer-agent/evals/cases/i3-frontend-ui-engineering.json",
104
+ "i3-composer-agent/evals/cases/i3-git-workflow-and-versioning.json",
105
+ "i3-composer-agent/evals/cases/i3-idea-refine.json",
106
+ "i3-composer-agent/evals/cases/i3-incremental-implementation.json",
107
+ "i3-composer-agent/evals/cases/i3-interview-me.json",
108
+ "i3-composer-agent/evals/cases/i3-observability-and-instrumentation.json",
109
+ "i3-composer-agent/evals/cases/i3-performance-optimization.json",
110
+ "i3-composer-agent/evals/cases/i3-planning-and-task-breakdown.json",
111
+ "i3-composer-agent/evals/cases/i3-security-and-hardening.json",
112
+ "i3-composer-agent/evals/cases/i3-shipping-and-launch.json",
113
+ "i3-composer-agent/evals/cases/i3-source-driven-development.json",
114
+ "i3-composer-agent/evals/cases/i3-spec-driven-development.json",
115
+ "i3-composer-agent/evals/cases/i3-test-driven-development.json",
116
+ "i3-composer-agent/evals/cases/i3-using-agent-skills.json",
117
+ "i3-composer-agent/evals/fixtures/i3-api-and-interface-design/service-brief.md",
118
+ "i3-composer-agent/evals/fixtures/i3-browser-testing-with-devtools/README.md",
119
+ "i3-composer-agent/evals/fixtures/i3-browser-testing-with-devtools/index.html",
120
+ "i3-composer-agent/evals/fixtures/i3-browser-testing-with-devtools/server.js",
121
+ "i3-composer-agent/evals/fixtures/i3-ci-cd-and-automation/package.json",
122
+ "i3-composer-agent/evals/fixtures/i3-ci-cd-and-automation/src/slug.js",
123
+ "i3-composer-agent/evals/fixtures/i3-ci-cd-and-automation/test/slug.test.js",
124
+ "i3-composer-agent/evals/fixtures/i3-code-review-and-quality/user-search.diff",
125
+ "i3-composer-agent/evals/fixtures/i3-code-simplification/config-parser.js",
126
+ "i3-composer-agent/evals/fixtures/i3-code-simplification/config-parser.test.js",
127
+ "i3-composer-agent/evals/fixtures/i3-context-engineering/context-audit.md",
128
+ "i3-composer-agent/evals/fixtures/i3-debugging-and-error-recovery/pagination.js",
129
+ "i3-composer-agent/evals/fixtures/i3-debugging-and-error-recovery/pagination.test.js",
130
+ "i3-composer-agent/evals/fixtures/i3-debugging-and-error-recovery/time-pressure.md",
131
+ "i3-composer-agent/evals/fixtures/i3-deprecation-and-migration/api-inventory.md",
132
+ "i3-composer-agent/evals/fixtures/i3-documentation-and-adrs/decision-context.md",
133
+ "i3-composer-agent/evals/fixtures/i3-doubt-driven-development/migration-plan.md",
134
+ "i3-composer-agent/evals/fixtures/i3-frontend-ui-engineering/Button.tsx",
135
+ "i3-composer-agent/evals/fixtures/i3-frontend-ui-engineering/design-system.md",
136
+ "i3-composer-agent/evals/fixtures/i3-git-workflow-and-versioning/.eval/working-tree.patch",
137
+ "i3-composer-agent/evals/fixtures/i3-git-workflow-and-versioning/app.js",
138
+ "i3-composer-agent/evals/fixtures/i3-git-workflow-and-versioning/app.test.js",
139
+ "i3-composer-agent/evals/fixtures/i3-incremental-implementation/reports.js",
140
+ "i3-composer-agent/evals/fixtures/i3-incremental-implementation/reports.test.js",
141
+ "i3-composer-agent/evals/fixtures/i3-incremental-implementation/tasks/plan.md",
142
+ "i3-composer-agent/evals/fixtures/i3-observability-and-instrumentation/operations.md",
143
+ "i3-composer-agent/evals/fixtures/i3-observability-and-instrumentation/payment-retry.js",
144
+ "i3-composer-agent/evals/fixtures/i3-performance-optimization/benchmark.js",
145
+ "i3-composer-agent/evals/fixtures/i3-performance-optimization/products.js",
146
+ "i3-composer-agent/evals/fixtures/i3-planning-and-task-breakdown/notifications-spec.md",
147
+ "i3-composer-agent/evals/fixtures/i3-security-and-hardening/webhook.js",
148
+ "i3-composer-agent/evals/fixtures/i3-security-and-hardening/webhook.test.js",
149
+ "i3-composer-agent/evals/fixtures/i3-shipping-and-launch/authority-pressure.md",
150
+ "i3-composer-agent/evals/fixtures/i3-shipping-and-launch/launch-status.md",
151
+ "i3-composer-agent/evals/fixtures/i3-source-driven-development/framework-task.md",
152
+ "i3-composer-agent/evals/fixtures/i3-spec-driven-development/billing-brief.md",
153
+ "i3-composer-agent/evals/fixtures/i3-test-driven-development/BUG.md",
154
+ "i3-composer-agent/evals/fixtures/i3-test-driven-development/README.md",
155
+ "i3-composer-agent/evals/fixtures/i3-test-driven-development/package.json",
156
+ "i3-composer-agent/evals/fixtures/i3-test-driven-development/src/split.js",
157
+ "i3-composer-agent/evals/fixtures/i3-test-driven-development/test/split.test.js",
158
+ "i3-composer-agent/evals/fixtures/i3-using-agent-skills/incident.md",
159
+ "i3-composer-agent/evals/fixtures/incremental-implementation-pressure/draft-export.js",
160
+ "i3-composer-agent/evals/fixtures/incremental-implementation-pressure/scenario.md",
161
+ "i3-composer-agent/evals/fixtures/spec-driven-development-decomposition/portal-brief.md",
162
+ "i3-composer-agent/evals/fixtures/test-driven-development-ecosystem/README.md",
163
+ "i3-composer-agent/evals/fixtures/test-driven-development-ecosystem/ledger.py",
164
+ "i3-composer-agent/evals/fixtures/test-driven-development-ecosystem/test_ledger.py",
165
+ "i3-composer-agent/evals/plugin/code-review-fires/graders/off-by-one.md",
166
+ "i3-composer-agent/evals/plugin/code-review-fires/graders/severity-labels.md",
167
+ "i3-composer-agent/evals/plugin/code-review-fires/graders/skill-fired.md",
168
+ "i3-composer-agent/evals/plugin/code-review-fires/prompt.md",
169
+ "i3-composer-agent/evals/plugin/code-review-stays-quiet-on-commit-message/graders/not-fired.md",
170
+ "i3-composer-agent/evals/plugin/code-review-stays-quiet-on-commit-message/prompt.md",
171
+ "i3-composer-agent/evals/plugin/code-review-stays-quiet/graders/not-fired.md",
172
+ "i3-composer-agent/evals/plugin/code-review-stays-quiet/graders/tdd-fired.md",
173
+ "i3-composer-agent/evals/plugin/code-review-stays-quiet/prompt.md",
174
+ "i3-composer-agent/evals/zh-CN/cases/i3-api-and-interface-design.json",
175
+ "i3-composer-agent/evals/zh-CN/cases/i3-browser-testing-with-devtools.json",
176
+ "i3-composer-agent/evals/zh-CN/cases/i3-ci-cd-and-automation.json",
177
+ "i3-composer-agent/evals/zh-CN/cases/i3-code-review-and-quality.json",
178
+ "i3-composer-agent/evals/zh-CN/cases/i3-code-simplification.json",
179
+ "i3-composer-agent/evals/zh-CN/cases/i3-constraint-driven-development.json",
180
+ "i3-composer-agent/evals/zh-CN/cases/i3-context-engineering.json",
181
+ "i3-composer-agent/evals/zh-CN/cases/i3-debugging-and-error-recovery.json",
182
+ "i3-composer-agent/evals/zh-CN/cases/i3-deprecation-and-migration.json",
183
+ "i3-composer-agent/evals/zh-CN/cases/i3-documentation-and-adrs.json",
184
+ "i3-composer-agent/evals/zh-CN/cases/i3-doubt-driven-development.json",
185
+ "i3-composer-agent/evals/zh-CN/cases/i3-frontend-ui-engineering.json",
186
+ "i3-composer-agent/evals/zh-CN/cases/i3-git-workflow-and-versioning.json",
187
+ "i3-composer-agent/evals/zh-CN/cases/i3-idea-refine.json",
188
+ "i3-composer-agent/evals/zh-CN/cases/i3-incremental-implementation.json",
189
+ "i3-composer-agent/evals/zh-CN/cases/i3-interview-me.json",
190
+ "i3-composer-agent/evals/zh-CN/cases/i3-observability-and-instrumentation.json",
191
+ "i3-composer-agent/evals/zh-CN/cases/i3-performance-optimization.json",
192
+ "i3-composer-agent/evals/zh-CN/cases/i3-planning-and-task-breakdown.json",
193
+ "i3-composer-agent/evals/zh-CN/cases/i3-security-and-hardening.json",
194
+ "i3-composer-agent/evals/zh-CN/cases/i3-shipping-and-launch.json",
195
+ "i3-composer-agent/evals/zh-CN/cases/i3-source-driven-development.json",
196
+ "i3-composer-agent/evals/zh-CN/cases/i3-spec-driven-development.json",
197
+ "i3-composer-agent/evals/zh-CN/cases/i3-test-driven-development.json",
198
+ "i3-composer-agent/evals/zh-CN/cases/i3-using-agent-skills.json",
199
+ "i3-composer-agent/hooks/SDD-CACHE.md",
200
+ "i3-composer-agent/hooks/SIMPLIFY-IGNORE.md",
201
+ "i3-composer-agent/hooks/sdd-cache-post.sh",
202
+ "i3-composer-agent/hooks/sdd-cache-pre.sh",
203
+ "i3-composer-agent/hooks/sdd-cache-test.sh",
204
+ "i3-composer-agent/hooks/session-start-test.sh",
205
+ "i3-composer-agent/hooks/session-start.sh",
206
+ "i3-composer-agent/hooks/simplify-ignore-test.sh",
207
+ "i3-composer-agent/hooks/simplify-ignore.sh",
208
+ "i3-composer-agent/package.json",
209
+ "i3-composer-agent/plugin.json",
210
+ "i3-composer-agent/references/accessibility-checklist.md",
211
+ "i3-composer-agent/references/definition-of-done.md",
212
+ "i3-composer-agent/references/observability-checklist.md",
213
+ "i3-composer-agent/references/orchestration-patterns.md",
214
+ "i3-composer-agent/references/performance-checklist.md",
215
+ "i3-composer-agent/references/security-checklist.md",
216
+ "i3-composer-agent/references/testing-patterns.md",
217
+ "i3-composer-agent/scripts/lib/skill-lint.js",
218
+ "i3-composer-agent/scripts/run-evals.js",
219
+ "i3-composer-agent/scripts/validate-artifact-paths.js",
220
+ "i3-composer-agent/scripts/validate-commands.js",
221
+ "i3-composer-agent/scripts/validate-reference-links.js",
222
+ "i3-composer-agent/scripts/validate-skills.js",
223
+ "i3-composer-agent/scripts/validate-versions.js",
224
+ "i3-composer-agent/skills/i3-api-and-interface-design/SKILL.md",
225
+ "i3-composer-agent/skills/i3-browser-testing-with-devtools/SKILL.md",
226
+ "i3-composer-agent/skills/i3-ci-cd-and-automation/SKILL.md",
227
+ "i3-composer-agent/skills/i3-code-review-and-quality/SKILL.md",
228
+ "i3-composer-agent/skills/i3-code-simplification/SKILL.md",
229
+ "i3-composer-agent/skills/i3-constraint-driven-development/SKILL.md",
230
+ "i3-composer-agent/skills/i3-constraint-driven-development/references/floor-guard.md",
231
+ "i3-composer-agent/skills/i3-context-engineering/SKILL.md",
232
+ "i3-composer-agent/skills/i3-debugging-and-error-recovery/SKILL.md",
233
+ "i3-composer-agent/skills/i3-deprecation-and-migration/SKILL.md",
234
+ "i3-composer-agent/skills/i3-documentation-and-adrs/SKILL.md",
235
+ "i3-composer-agent/skills/i3-doubt-driven-development/SKILL.md",
236
+ "i3-composer-agent/skills/i3-frontend-ui-engineering/SKILL.md",
237
+ "i3-composer-agent/skills/i3-git-workflow-and-versioning/SKILL.md",
238
+ "i3-composer-agent/skills/i3-idea-refine/SKILL.md",
239
+ "i3-composer-agent/skills/i3-idea-refine/examples.md",
240
+ "i3-composer-agent/skills/i3-idea-refine/frameworks.md",
241
+ "i3-composer-agent/skills/i3-idea-refine/refinement-criteria.md",
242
+ "i3-composer-agent/skills/i3-idea-refine/scripts/idea-refine.sh",
243
+ "i3-composer-agent/skills/i3-incremental-implementation/SKILL.md",
244
+ "i3-composer-agent/skills/i3-interview-me/SKILL.md",
245
+ "i3-composer-agent/skills/i3-observability-and-instrumentation/SKILL.md",
246
+ "i3-composer-agent/skills/i3-performance-optimization/SKILL.md",
247
+ "i3-composer-agent/skills/i3-performance-optimization/references/optimization-patterns.md",
248
+ "i3-composer-agent/skills/i3-planning-and-task-breakdown/SKILL.md",
249
+ "i3-composer-agent/skills/i3-security-and-hardening/SKILL.md",
250
+ "i3-composer-agent/skills/i3-security-and-hardening/references/hardening-patterns.md",
251
+ "i3-composer-agent/skills/i3-shipping-and-launch/SKILL.md",
252
+ "i3-composer-agent/skills/i3-source-driven-development/SKILL.md",
253
+ "i3-composer-agent/skills/i3-spec-driven-development/SKILL.md",
254
+ "i3-composer-agent/skills/i3-test-driven-development/SKILL.md",
255
+ "i3-composer-agent/skills/i3-using-agent-skills/SKILL.md",
256
+ "references/accessibility-checklist.md",
257
+ "references/definition-of-done.md",
258
+ "references/i3-composer-agent/LICENSE",
259
+ "references/observability-checklist.md",
260
+ "references/orchestration-patterns.md",
261
+ "references/performance-checklist.md",
262
+ "references/security-checklist.md",
263
+ "references/testing-patterns.md",
264
+ "skills/api-and-interface-design/SKILL.md",
265
+ "skills/browser-testing-with-devtools/SKILL.md",
266
+ "skills/ci-cd-and-automation/SKILL.md",
267
+ "skills/code-review-and-quality/SKILL.md",
268
+ "skills/code-simplification/SKILL.md",
269
+ "skills/constraint-driven-development/SKILL.md",
270
+ "skills/constraint-driven-development/references/floor-guard.md",
271
+ "skills/context-engineering/SKILL.md",
272
+ "skills/debugging-and-error-recovery/SKILL.md",
273
+ "skills/deprecation-and-migration/SKILL.md",
274
+ "skills/documentation-and-adrs/SKILL.md",
275
+ "skills/doubt-driven-development/SKILL.md",
276
+ "skills/frontend-ui-engineering/SKILL.md",
277
+ "skills/git-workflow-and-versioning/SKILL.md",
278
+ "skills/i3-api-and-interface-design/SKILL.md",
279
+ "skills/i3-browser-testing-with-devtools/SKILL.md",
280
+ "skills/i3-ci-cd-and-automation/SKILL.md",
281
+ "skills/i3-code-review-and-quality/SKILL.md",
282
+ "skills/i3-code-simplification/SKILL.md",
283
+ "skills/i3-constraint-driven-development/SKILL.md",
284
+ "skills/i3-constraint-driven-development/references/floor-guard.md",
285
+ "skills/i3-context-engineering/SKILL.md",
286
+ "skills/i3-debugging-and-error-recovery/SKILL.md",
287
+ "skills/i3-deprecation-and-migration/SKILL.md",
288
+ "skills/i3-documentation-and-adrs/SKILL.md",
289
+ "skills/i3-doubt-driven-development/SKILL.md",
290
+ "skills/i3-frontend-ui-engineering/SKILL.md",
291
+ "skills/i3-git-workflow-and-versioning/SKILL.md",
292
+ "skills/i3-idea-refine/SKILL.md",
293
+ "skills/i3-idea-refine/examples.md",
294
+ "skills/i3-idea-refine/frameworks.md",
295
+ "skills/i3-idea-refine/refinement-criteria.md",
296
+ "skills/i3-idea-refine/scripts/idea-refine.sh",
297
+ "skills/i3-incremental-implementation/SKILL.md",
298
+ "skills/i3-interview-me/SKILL.md",
299
+ "skills/i3-observability-and-instrumentation/SKILL.md",
300
+ "skills/i3-performance-optimization/SKILL.md",
301
+ "skills/i3-performance-optimization/references/optimization-patterns.md",
302
+ "skills/i3-planning-and-task-breakdown/SKILL.md",
303
+ "skills/i3-security-and-hardening/SKILL.md",
304
+ "skills/i3-security-and-hardening/references/hardening-patterns.md",
305
+ "skills/i3-shipping-and-launch/SKILL.md",
306
+ "skills/i3-source-driven-development/SKILL.md",
307
+ "skills/i3-spec-driven-development/SKILL.md",
308
+ "skills/i3-test-driven-development/SKILL.md",
309
+ "skills/i3-using-agent-skills/SKILL.md",
310
+ "skills/idea-refine/SKILL.md",
311
+ "skills/idea-refine/examples.md",
312
+ "skills/idea-refine/frameworks.md",
313
+ "skills/idea-refine/refinement-criteria.md",
314
+ "skills/idea-refine/scripts/idea-refine.sh",
315
+ "skills/incremental-implementation/SKILL.md",
316
+ "skills/interview-me/SKILL.md",
317
+ "skills/observability-and-instrumentation/SKILL.md",
318
+ "skills/performance-optimization/SKILL.md",
319
+ "skills/performance-optimization/references/optimization-patterns.md",
320
+ "skills/planning-and-task-breakdown/SKILL.md",
321
+ "skills/security-and-hardening/SKILL.md",
322
+ "skills/security-and-hardening/references/hardening-patterns.md",
323
+ "skills/shipping-and-launch/SKILL.md",
324
+ "skills/source-driven-development/SKILL.md",
325
+ "skills/spec-driven-development/SKILL.md",
326
+ "skills/test-driven-development/SKILL.md",
327
+ "skills/using-agent-skills/SKILL.md"
328
+ ]
329
+ }
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+ const { loadInstallation } = require('./lib/installation.cjs');
7
+ const { frontmatterYamlErrors } = require('./lib/skill-lint.cjs');
8
+
9
+ try {
10
+ const { root, catalog } = loadInstallation();
11
+ let errors = 0;
12
+ for (const category of ['commands', 'agents']) {
13
+ for (const name of catalog[category]) {
14
+ const relative = `${category}/${name}.md`;
15
+ const text = fs.readFileSync(path.join(root, relative), 'utf8');
16
+ const issues = frontmatterYamlErrors(text);
17
+ const frontmatter = text.match(/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/)?.[1] || '';
18
+ if (!/^description:\s*\S/m.test(frontmatter)) issues.push('缺少 description');
19
+ if (category === 'agents' && !new RegExp(`^name:\\s*["']?${name}["']?\\s*$`, 'm').test(frontmatter)) issues.push('角色 name 与文件名不一致');
20
+ if (!text.replace(/^---[\s\S]*?\n---/, '').trim()) issues.push('缺少提示正文');
21
+ console.log(`${issues.length ? '✗' : '✓'} ${relative}`);
22
+ for (const issue of issues) { console.error(` ${issue}`); errors++; }
23
+ }
24
+ }
25
+ console.log(`已检查 ${catalog.commands.length} 个命令、${catalog.agents.length} 个角色;${errors} 个错误。`);
26
+ process.exitCode = errors ? 1 : 0;
27
+ } catch (error) { console.error(error.message); process.exitCode = 1; }
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+ const { nativeContent } = require('./native-content.cjs');
6
+ const name = 'i3-composer-agent';
7
+
8
+ function replaceOnce(text, before, after, label) {
9
+ if (text.split(before).length !== 2) throw new Error(`原生适配规则 ${label} 与发行包不匹配,请检查脚本变更。`);
10
+ return text.replace(before, after);
11
+ }
12
+
13
+ function nativeScript(text, relative) {
14
+ const setup = "const INSTALLATION = require('./lib/installation.cjs').loadInstallation();";
15
+ text = text.replaceAll("require('./lib/skill-lint')", "require('./lib/skill-lint.cjs')");
16
+ if (relative === 'scripts/lib/skill-lint.js') return text;
17
+ if (relative === 'scripts/validate-skills.js') {
18
+ text = replaceOnce(text, "const SKILLS_DIR = path.resolve(__dirname, '..', 'skills');", `${setup}\nconst SKILLS_DIR = INSTALLATION.skillsDirectory;`, relative);
19
+ return replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', 'INSTALLATION.catalog.skills', relative);
20
+ }
21
+ const rootDeclaration = relative === 'scripts/run-evals.js'
22
+ ? "const ROOT = path.join(__dirname, '..');" : "const ROOT = path.resolve(__dirname, '..');";
23
+ text = replaceOnce(text, rootDeclaration, `${setup}\nconst ROOT = INSTALLATION.root;`, relative);
24
+ if (relative === 'scripts/run-evals.js') {
25
+ text = text.replaceAll("path.join(ROOT, 'evals',", "path.join(INSTALLATION.resources.evals,")
26
+ .replaceAll("path.join(ROOT, 'evals/zh-CN/cases')", "path.join(INSTALLATION.resources.evals, 'zh-CN/cases')");
27
+ return replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', 'INSTALLATION.catalog.skills', relative);
28
+ }
29
+ if (relative === 'scripts/validate-reference-links.js') {
30
+ text = replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', 'INSTALLATION.catalog.skills', relative);
31
+ return replaceOnce(text, 'references\\/[A-Za-z0-9._-]+\\.md', 'references\\/(?:[A-Za-z0-9._-]+\\/)*[A-Za-z0-9._-]+\\.md', relative);
32
+ }
33
+ if (relative === 'scripts/validate-artifact-paths.js') {
34
+ const guarded = text.match(/const GUARDED_FILES = \[[\s\S]*?\n\];/)?.[0];
35
+ if (!guarded) throw new Error(`缺少原生产物检查配置:${relative}`);
36
+ return text.replace(guarded, `const GUARDED_FILES = [
37
+ ...INSTALLATION.catalog.commands.map(name => 'commands/' + name + '.md'),
38
+ 'skills/i3-spec-driven-development/SKILL.md',
39
+ 'skills/i3-planning-and-task-breakdown/SKILL.md',
40
+ ...INSTALLATION.manifest.assets.filter(file => /^docs\\/i3-composer-agent\\/(getting-started|adoption-guide|copilot-setup)\\.md$/.test(file)),
41
+ ];`);
42
+ }
43
+ throw new Error(`尚未适配的公共脚本:${relative}`);
44
+ }
45
+
46
+ function renderAsset(buffer, asset) {
47
+ const relative = asset.sourceRelative || '';
48
+ if (relative.startsWith('evals/fixtures/')) return buffer;
49
+ let text = buffer.toString('utf8');
50
+ if (asset.kind === 'runtime') return Buffer.from(text.replace('__I3_INSTALL_VERSION__', asset.version));
51
+ if (asset.kind === 'script') return Buffer.from(nativeScript(text, relative));
52
+ if (relative === 'hooks/session-start.sh') {
53
+ return Buffer.from(replaceOnce(text, 'SKILLS_DIR="$(dirname "$SCRIPT_DIR")/skills"',
54
+ 'SKILLS_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")/skills"', relative));
55
+ }
56
+ if (/^hooks\/.*-test\.sh$/.test(relative)) {
57
+ // Tests use their sibling hooks, including when invoked from another cwd.
58
+ text = text.replace(/(set -[^\n]+\n)/, '$1\nI3_HOOK_TEST_DIR="$(cd "$(dirname "$0")" && pwd)"\n');
59
+ text = text.replace(/"hooks\/\$script"/g, '"$I3_HOOK_TEST_DIR/$script"')
60
+ .replace(/(?<![A-Za-z0-9_/-])hooks\/([a-z-]+\.sh)(?![A-Za-z0-9_-])/g, '"$I3_HOOK_TEST_DIR/$1"');
61
+ return Buffer.from(text);
62
+ }
63
+ if (!relative.endsWith('.md')) return buffer;
64
+ if (['skill', 'command', 'persona', 'reference'].includes(asset.kind)) text = nativeContent(text, asset);
65
+ if (asset.kind === 'skill') {
66
+ text = text.replace(/^bash (skills\/[a-z0-9-]+\/scripts\/[a-z0-9.-]+\.sh)$/gm, (command, source) => {
67
+ const mapped = asset.mapping?.[source];
68
+ if (!mapped) throw new Error(`技能引用了未安装的脚本:${source}`);
69
+ const file = path.join(asset.base, mapped).replaceAll('\\', '/');
70
+ return "bash '" + file.replaceAll("'", "'\\''") + "'";
71
+ });
72
+ }
73
+ // Shared references move; skill-local references and executable assets stay.
74
+ text = text.replace(/((?:\.\.\/){2,})references\/(?!i3-composer-agent\/)/g, `$1references/${name}/`);
75
+ // Resolve actual Markdown links through the same source-to-destination map.
76
+ text = text.replace(/(\]\()([^\s)#]+)(#[^\s)]+)?(\))/g, (match, open, link, fragment = '', close) => {
77
+ if (/^(?:[a-z]+:|\/)/i.test(link)) return match;
78
+ const source = path.posix.normalize(path.posix.join(path.posix.dirname(relative), link));
79
+ const mapped = asset.mapping?.[source];
80
+ if (!mapped) return match;
81
+ return open + path.posix.relative(path.posix.dirname(asset.relative), mapped) + fragment + close;
82
+ });
83
+ if (asset.kind === 'command' || asset.kind === 'persona') {
84
+ text = text.replaceAll('docs/agents.md', `docs/${name}/agents.md`);
85
+ }
86
+ if (relative.startsWith('hooks/')) text = text.replace(/\bhooks\/(?!i3-composer-agent\/)/g, `hooks/${name}/`);
87
+ return Buffer.from(text);
88
+ }
89
+
90
+ // Enumerate individual files so user-created files inside installed directories
91
+ // never become implicitly owned. Package allowlists remain authoritative.
92
+ function nativeAssets(root, target, packageFiles, version) {
93
+ const assets = [];
94
+ const mapping = {};
95
+ function visit(sourceRelative, relative, kind) {
96
+ const source = path.join(root, sourceRelative);
97
+ const stat = fs.lstatSync(source);
98
+ if (stat.isSymbolicLink()) throw new Error(`包内容中包含符号链接(symlink):${source}`);
99
+ if (stat.isDirectory()) {
100
+ for (const entry of fs.readdirSync(source).sort()) {
101
+ if (['.DS_Store', 'results', 'node_modules', '.git', '__pycache__'].includes(entry)) continue;
102
+ visit(`${sourceRelative}/${entry}`, `${relative}/${entry}`, kind);
103
+ }
104
+ } else if (stat.isFile()) {
105
+ if (assets.some(asset => asset.relative === relative)) return;
106
+ mapping[sourceRelative] = relative;
107
+ assets.push({ source, sourceRelative, relative, destination: path.join(target.base, relative), kind, version });
108
+ } else throw new Error(`不支持的包文件:${source}`);
109
+ }
110
+ visit('skills', 'skills', 'skill');
111
+ visit('.claude/commands', 'commands', 'command');
112
+ visit('agents', 'agents', 'persona');
113
+ visit('references', `references/${name}`, 'reference');
114
+ visit('README.md', `docs/${name}/README.md`, 'docs');
115
+ for (const file of packageFiles) {
116
+ const category = file.split('/')[0];
117
+ if (!['evals', 'hooks', 'scripts', 'docs'].includes(category)) continue;
118
+ if (file === 'scripts/validate-commands.js' || file === 'scripts/validate-versions.js') continue;
119
+ const relative = `${category}/${name}${file.slice(category.length)}`.replace(/\.js$/, category === 'scripts' ? '.cjs' : '.js');
120
+ visit(file, relative, category === 'scripts' ? 'script' : category);
121
+ }
122
+ visit('bin/native-runtime.cjs', `scripts/${name}/lib/installation.cjs`, 'runtime');
123
+ visit('bin/native-command-validation.cjs', `scripts/${name}/validate-commands.cjs`, 'native-validator');
124
+ visit('bin/native-version-validation.cjs', `scripts/${name}/validate-versions.cjs`, 'native-validator');
125
+ target.catalog = {
126
+ skills: fs.readdirSync(path.join(root, 'skills')).filter(id => fs.existsSync(path.join(root, 'skills', id, 'SKILL.md'))).sort(),
127
+ commands: fs.readdirSync(path.join(root, '.claude/commands')).filter(file => file.endsWith('.md')).map(file => file.slice(0, -3)).sort(),
128
+ agents: fs.readdirSync(path.join(root, 'agents')).filter(file => file.endsWith('.md')).map(file => file.slice(0, -3)).sort(),
129
+ };
130
+ target.resources = Object.fromEntries(['references', 'evals', 'hooks', 'scripts', 'docs'].map(category => [category, `${category}/${name}`]));
131
+ for (const asset of assets) { asset.mapping = mapping; asset.base = target.base; }
132
+ return assets;
133
+ }
134
+
135
+ module.exports = { nativeAssets, renderAsset };
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+ const { fingerprint } = require('./asset-fingerprint.cjs');
6
+ const inventory = require('./legacy-native-files.json').files;
7
+ const name = 'i3-composer-agent';
8
+
9
+ function allowed(relative) {
10
+ return typeof relative === 'string' && !relative.includes('\0') && !relative.includes(':') && !relative.includes('\\')
11
+ && !relative.split('/').some(part => ['', '.', '..'].includes(part))
12
+ && (/^(skills|commands|agents|references|evals|hooks|scripts|docs)\//.test(relative)
13
+ || relative.startsWith(`${name}/`) || [`${name}-LICENSE`, `${name}-NOTICE.md`].includes(relative));
14
+ }
15
+
16
+ function fileAt(base, relative) {
17
+ if (!allowed(relative)) return undefined;
18
+ let file = base;
19
+ for (const part of relative.split('/')) {
20
+ file = path.join(file, part);
21
+ try { if (fs.lstatSync(file).isSymbolicLink()) return undefined; }
22
+ catch (error) { if (error.code === 'ENOENT') return undefined; throw error; }
23
+ }
24
+ return file;
25
+ }
26
+
27
+ function migrationAssets(target, previous, current) {
28
+ if (!previous) return [];
29
+ const assets = [];
30
+ const oldFiles = new Set();
31
+ const retired = new Set();
32
+ const base = target.base;
33
+ function retire(relative) {
34
+ if (retired.has(relative) || current.has(relative)) return;
35
+ const file = fileAt(base, relative);
36
+ if (!file || !fs.statSync(file).isFile()) return;
37
+ retired.add(relative);
38
+ assets.push({ base, destination: file, relative, kind: 'legacy' });
39
+ }
40
+ for (const relative of previous.assets) {
41
+ const file = fileAt(base, relative);
42
+ if (!file) continue;
43
+ if (fs.statSync(file).isFile()) oldFiles.add(relative);
44
+ else if (previous.layoutVersion !== 2) {
45
+ // Old manifests registered directories, not their contents. Expand only
46
+ // paths in the published inventory, never the current filesystem tree.
47
+ for (const known of inventory) if (known.startsWith(relative + '/')) oldFiles.add(known);
48
+ }
49
+ }
50
+ for (const relative of oldFiles) retire(relative);
51
+
52
+ // Evaluation output is user data, not an installed package asset. Move it
53
+ // transactionally, including plugin and locale-specific result folders.
54
+ if (previous.assets.some(file => typeof file === 'string' && file.startsWith(`${name}/`))) {
55
+ const oldEvals = path.join(base, name, 'evals');
56
+ function visit(directory, relative = '') {
57
+ if (!fs.existsSync(directory)) return;
58
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
59
+ const source = path.join(directory, entry.name);
60
+ const subpath = relative ? `${relative}/${entry.name}` : entry.name;
61
+ if (entry.isSymbolicLink()) continue;
62
+ if (entry.isDirectory()) visit(source, subpath);
63
+ else if (entry.isFile() && subpath.split('/').includes('results')) {
64
+ const destinationRelative = `evals/${name}/${subpath}`;
65
+ const destination = path.join(base, destinationRelative);
66
+ let reusable = false;
67
+ if (fs.existsSync(destination)) {
68
+ reusable = fingerprint(source) === fingerprint(destination);
69
+ if (!reusable) throw new Error(`评测结果迁移冲突,请先处理同名文件:${destination}`);
70
+ }
71
+ assets.push({ base, source, destination, relative: destinationRelative, kind: 'result', reusable,
72
+ expectedFingerprint: fingerprint(source) });
73
+ retire(`${name}/evals/${subpath}`);
74
+ }
75
+ }
76
+ }
77
+ if (fileAt(base, `${name}/evals`)) visit(oldEvals);
78
+ }
79
+ return assets;
80
+ }
81
+
82
+ function pruneRetiredDirectories(assets) {
83
+ const directories = new Set();
84
+ for (const asset of assets.filter(item => item.kind === 'legacy')) {
85
+ for (let directory = path.dirname(asset.destination); directory !== asset.base && directory.startsWith(asset.base + path.sep); directory = path.dirname(directory)) directories.add(directory);
86
+ }
87
+ for (const directory of [...directories].sort((a, b) => b.length - a.length)) {
88
+ try { fs.rmdirSync(directory); }
89
+ catch (error) { if (!['ENOENT', 'ENOTEMPTY', 'EEXIST'].includes(error.code)) throw error; }
90
+ }
91
+ }
92
+
93
+ module.exports = { migrationAssets, pruneRetiredDirectories };
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ // Installed as scripts/i3-composer-agent/lib/installation.cjs. Resolve from
4
+ // this file, never the caller's working directory or the host's package.json.
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+ const EXPECTED_VERSION = '__I3_INSTALL_VERSION__';
8
+ const root = path.resolve(__dirname, '../../..');
9
+ const manifestPath = path.join(root, '.i3-composer-agent.json');
10
+
11
+ function resolveOwned(relative) {
12
+ if (typeof relative !== 'string' || relative.includes('\\') || relative.includes(':')
13
+ || relative.includes('\0') || relative.split('/').some(part => ['', '.', '..'].includes(part))) {
14
+ throw new Error(`安装清单路径无效:${relative}`);
15
+ }
16
+ let file = root;
17
+ for (const part of relative.split('/')) {
18
+ file = path.join(file, part);
19
+ if (!fs.existsSync(file)) throw new Error(`安装内容缺失:${relative}`);
20
+ if (fs.lstatSync(file).isSymbolicLink()) throw new Error(`安装内容不能通过符号链接替代:${relative}`);
21
+ }
22
+ if (!fs.statSync(file).isFile()) throw new Error(`安装文件无效:${relative}`);
23
+ return file;
24
+ }
25
+
26
+ function loadInstallation() {
27
+ let manifest;
28
+ try { manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); }
29
+ catch (error) { throw new Error(`无法读取安装清单 ${manifestPath}:${error.message}`); }
30
+ if (manifest.name !== 'i3-composer-agent' || manifest.layoutVersion !== 2
31
+ || manifest.version !== EXPECTED_VERSION || !Array.isArray(manifest.assets) || !manifest.assets.length) {
32
+ throw new Error(`安装清单的名称、布局或版本不匹配:${manifestPath}`);
33
+ }
34
+ const assets = new Set(manifest.assets);
35
+ for (const [category, suffix] of [['skills', '/SKILL.md'], ['commands', '.md'], ['agents', '.md']]) {
36
+ const names = manifest.catalog?.[category];
37
+ if (!Array.isArray(names) || !names.length || new Set(names).size !== names.length) {
38
+ throw new Error(`安装清单缺少有效的 ${category} 目录项:${manifestPath}`);
39
+ }
40
+ for (const name of names) {
41
+ if (typeof name !== 'string' || !/^[a-z0-9][a-z0-9-]*$/.test(name)
42
+ || !assets.has(`${category}/${name}${suffix}`)) throw new Error(`安装清单目录项无效:${category}/${name}`);
43
+ }
44
+ }
45
+ for (const relative of assets) resolveOwned(relative);
46
+ const resources = {};
47
+ for (const category of ['references', 'evals', 'hooks', 'scripts', 'docs']) {
48
+ const relative = `${category}/i3-composer-agent`;
49
+ if (manifest.resources?.[category] !== relative || ![...assets].some(file => file.startsWith(relative + '/'))) {
50
+ throw new Error(`安装清单缺少资源:${category}`);
51
+ }
52
+ resources[category] = path.join(root, relative);
53
+ }
54
+ return { root, manifest, catalog: manifest.catalog, resources, skillsDirectory: path.join(root, 'skills') };
55
+ }
56
+
57
+ module.exports = { loadInstallation };