@givolt/i3-composer-agent 0.0.0-stage → 0.6.12

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 (213) hide show
  1. package/.agents/plugins/marketplace.json +22 -0
  2. package/.claude/commands/build.md +44 -0
  3. package/.claude/commands/code-simplify.md +22 -0
  4. package/.claude/commands/constraints.md +32 -0
  5. package/.claude/commands/plan.md +18 -0
  6. package/.claude/commands/review.md +16 -0
  7. package/.claude/commands/ship.md +72 -0
  8. package/.claude/commands/spec.md +17 -0
  9. package/.claude/commands/test.md +19 -0
  10. package/.claude/commands/webperf.md +32 -0
  11. package/.claude-plugin/marketplace.json +26 -0
  12. package/.claude-plugin/plugin.json +17 -0
  13. package/.codex-plugin/plugin.json +26 -0
  14. package/.gemini/commands/build.toml +43 -0
  15. package/.gemini/commands/code-simplify.toml +22 -0
  16. package/.gemini/commands/constraints.toml +32 -0
  17. package/.gemini/commands/planning.toml +18 -0
  18. package/.gemini/commands/review.toml +16 -0
  19. package/.gemini/commands/ship.toml +72 -0
  20. package/.gemini/commands/spec.toml +17 -0
  21. package/.gemini/commands/test.toml +19 -0
  22. package/.gemini/commands/webperf.toml +32 -0
  23. package/LICENSE +21 -0
  24. package/NOTICE.md +9 -0
  25. package/README.md +177 -2
  26. package/agents/code-reviewer.md +102 -0
  27. package/agents/security-auditor.md +112 -0
  28. package/agents/test-engineer.md +95 -0
  29. package/agents/web-performance-auditor.md +184 -0
  30. package/bin/i3-composer-agent.cjs +119 -0
  31. package/commands/build.toml +43 -0
  32. package/commands/code-simplify.toml +22 -0
  33. package/commands/constraints.toml +32 -0
  34. package/commands/planning.toml +18 -0
  35. package/commands/review.toml +16 -0
  36. package/commands/ship.toml +72 -0
  37. package/commands/spec.toml +17 -0
  38. package/commands/test.toml +19 -0
  39. package/commands/webperf.toml +32 -0
  40. package/docs/adoption-guide.md +129 -0
  41. package/docs/advanced-per-agent-configuration.md +70 -0
  42. package/docs/agents.md +123 -0
  43. package/docs/antigravity-setup.md +128 -0
  44. package/docs/codebuddy-setup.md +41 -0
  45. package/docs/codex-setup.md +34 -0
  46. package/docs/commandcode-setup.md +69 -0
  47. package/docs/comparison.md +131 -0
  48. package/docs/copilot-cli-setup.md +64 -0
  49. package/docs/copilot-setup.md +162 -0
  50. package/docs/cursor-setup.md +225 -0
  51. package/docs/developer-onboarding.md +116 -0
  52. package/docs/gemini-cli-setup.md +133 -0
  53. package/docs/getting-started.md +208 -0
  54. package/docs/opencode-setup.md +259 -0
  55. package/docs/other-hosts.md +7 -0
  56. package/docs/skill-anatomy.md +203 -0
  57. package/docs/windsurf-setup.md +48 -0
  58. package/evals/README.md +101 -0
  59. package/evals/cases/api-and-interface-design.json +45 -0
  60. package/evals/cases/browser-testing-with-devtools.json +44 -0
  61. package/evals/cases/ci-cd-and-automation.json +45 -0
  62. package/evals/cases/code-review-and-quality.json +49 -0
  63. package/evals/cases/code-simplification.json +45 -0
  64. package/evals/cases/constraint-driven-development.json +79 -0
  65. package/evals/cases/context-engineering.json +44 -0
  66. package/evals/cases/debugging-and-error-recovery.json +58 -0
  67. package/evals/cases/deprecation-and-migration.json +52 -0
  68. package/evals/cases/documentation-and-adrs.json +44 -0
  69. package/evals/cases/doubt-driven-development.json +43 -0
  70. package/evals/cases/frontend-ui-engineering.json +52 -0
  71. package/evals/cases/git-workflow-and-versioning.json +47 -0
  72. package/evals/cases/idea-refine.json +43 -0
  73. package/evals/cases/incremental-implementation.json +57 -0
  74. package/evals/cases/interview-me.json +42 -0
  75. package/evals/cases/observability-and-instrumentation.json +44 -0
  76. package/evals/cases/performance-optimization.json +53 -0
  77. package/evals/cases/planning-and-task-breakdown.json +45 -0
  78. package/evals/cases/security-and-hardening.json +53 -0
  79. package/evals/cases/shipping-and-launch.json +56 -0
  80. package/evals/cases/source-driven-development.json +44 -0
  81. package/evals/cases/spec-driven-development.json +72 -0
  82. package/evals/cases/test-driven-development.json +73 -0
  83. package/evals/cases/using-agent-skills.json +44 -0
  84. package/evals/fixtures/api-and-interface-design/service-brief.md +19 -0
  85. package/evals/fixtures/browser-testing-with-devtools/README.md +5 -0
  86. package/evals/fixtures/browser-testing-with-devtools/index.html +24 -0
  87. package/evals/fixtures/browser-testing-with-devtools/server.js +15 -0
  88. package/evals/fixtures/ci-cd-and-automation/package.json +8 -0
  89. package/evals/fixtures/ci-cd-and-automation/src/slug.js +3 -0
  90. package/evals/fixtures/ci-cd-and-automation/test/slug.test.js +9 -0
  91. package/evals/fixtures/code-review-and-quality/user-search.diff +16 -0
  92. package/evals/fixtures/code-simplification/config-parser.js +46 -0
  93. package/evals/fixtures/code-simplification/config-parser.test.js +15 -0
  94. package/evals/fixtures/context-engineering/context-audit.md +15 -0
  95. package/evals/fixtures/debugging-and-error-recovery/pagination.js +8 -0
  96. package/evals/fixtures/debugging-and-error-recovery/pagination.test.js +9 -0
  97. package/evals/fixtures/debugging-and-error-recovery/time-pressure.md +6 -0
  98. package/evals/fixtures/deprecation-and-migration/api-inventory.md +9 -0
  99. package/evals/fixtures/documentation-and-adrs/decision-context.md +16 -0
  100. package/evals/fixtures/doubt-driven-development/migration-plan.md +19 -0
  101. package/evals/fixtures/frontend-ui-engineering/Button.tsx +7 -0
  102. package/evals/fixtures/frontend-ui-engineering/design-system.md +11 -0
  103. package/evals/fixtures/git-workflow-and-versioning/.eval/working-tree.patch +21 -0
  104. package/evals/fixtures/git-workflow-and-versioning/app.js +7 -0
  105. package/evals/fixtures/git-workflow-and-versioning/app.test.js +9 -0
  106. package/evals/fixtures/incremental-implementation/reports.js +7 -0
  107. package/evals/fixtures/incremental-implementation/reports.test.js +12 -0
  108. package/evals/fixtures/incremental-implementation/tasks/plan.md +8 -0
  109. package/evals/fixtures/incremental-implementation-pressure/draft-export.js +17 -0
  110. package/evals/fixtures/incremental-implementation-pressure/scenario.md +9 -0
  111. package/evals/fixtures/observability-and-instrumentation/operations.md +11 -0
  112. package/evals/fixtures/observability-and-instrumentation/payment-retry.js +14 -0
  113. package/evals/fixtures/performance-optimization/benchmark.js +15 -0
  114. package/evals/fixtures/performance-optimization/products.js +14 -0
  115. package/evals/fixtures/planning-and-task-breakdown/notifications-spec.md +18 -0
  116. package/evals/fixtures/security-and-hardening/webhook.js +11 -0
  117. package/evals/fixtures/security-and-hardening/webhook.test.js +13 -0
  118. package/evals/fixtures/shipping-and-launch/authority-pressure.md +6 -0
  119. package/evals/fixtures/shipping-and-launch/launch-status.md +11 -0
  120. package/evals/fixtures/source-driven-development/framework-task.md +10 -0
  121. package/evals/fixtures/spec-driven-development/billing-brief.md +16 -0
  122. package/evals/fixtures/spec-driven-development-decomposition/portal-brief.md +22 -0
  123. package/evals/fixtures/test-driven-development/BUG.md +10 -0
  124. package/evals/fixtures/test-driven-development/README.md +28 -0
  125. package/evals/fixtures/test-driven-development/package.json +9 -0
  126. package/evals/fixtures/test-driven-development/src/split.js +8 -0
  127. package/evals/fixtures/test-driven-development/test/split.test.js +13 -0
  128. package/evals/fixtures/test-driven-development-ecosystem/README.md +9 -0
  129. package/evals/fixtures/test-driven-development-ecosystem/ledger.py +15 -0
  130. package/evals/fixtures/test-driven-development-ecosystem/test_ledger.py +19 -0
  131. package/evals/fixtures/using-agent-skills/incident.md +6 -0
  132. package/evals/plugin/code-review-fires/graders/off-by-one.md +7 -0
  133. package/evals/plugin/code-review-fires/graders/severity-labels.md +4 -0
  134. package/evals/plugin/code-review-fires/graders/skill-fired.md +5 -0
  135. package/evals/plugin/code-review-fires/prompt.md +31 -0
  136. package/evals/plugin/code-review-stays-quiet/graders/not-fired.md +8 -0
  137. package/evals/plugin/code-review-stays-quiet/graders/tdd-fired.md +6 -0
  138. package/evals/plugin/code-review-stays-quiet/prompt.md +8 -0
  139. package/evals/plugin/code-review-stays-quiet-on-commit-message/graders/not-fired.md +8 -0
  140. package/evals/plugin/code-review-stays-quiet-on-commit-message/prompt.md +25 -0
  141. package/evals/skill-impact.md +6 -0
  142. package/hooks/SDD-CACHE.md +167 -0
  143. package/hooks/SIMPLIFY-IGNORE.md +91 -0
  144. package/hooks/sdd-cache-post.sh +135 -0
  145. package/hooks/sdd-cache-pre.sh +106 -0
  146. package/hooks/sdd-cache-test.sh +246 -0
  147. package/hooks/session-start-test.sh +47 -0
  148. package/hooks/session-start.sh +33 -0
  149. package/hooks/simplify-ignore-test.sh +476 -0
  150. package/hooks/simplify-ignore.sh +352 -0
  151. package/package.json +31 -4
  152. package/plugin.json +5 -0
  153. package/rebrand/MAINTENANCE.md +51 -0
  154. package/rebrand/apply.cjs +121 -0
  155. package/rebrand/brand.json +9 -0
  156. package/rebrand/templates/README.md +178 -0
  157. package/rebrand/templates/codebuddy-setup.md +41 -0
  158. package/rebrand/templates/codex-setup.md +34 -0
  159. package/references/accessibility-checklist.md +160 -0
  160. package/references/definition-of-done.md +67 -0
  161. package/references/observability-checklist.md +92 -0
  162. package/references/orchestration-patterns.md +370 -0
  163. package/references/performance-checklist.md +236 -0
  164. package/references/security-checklist.md +248 -0
  165. package/references/testing-patterns.md +235 -0
  166. package/scripts/floor-guard-reference-test.js +291 -0
  167. package/scripts/lib/skill-lint-test.js +650 -0
  168. package/scripts/lib/skill-lint.js +584 -0
  169. package/scripts/run-evals-test.js +623 -0
  170. package/scripts/run-evals.js +638 -0
  171. package/scripts/validate-artifact-paths-test.js +179 -0
  172. package/scripts/validate-artifact-paths.js +128 -0
  173. package/scripts/validate-brand.cjs +36 -0
  174. package/scripts/validate-commands-test.js +216 -0
  175. package/scripts/validate-commands.js +222 -0
  176. package/scripts/validate-reference-links-test.js +495 -0
  177. package/scripts/validate-reference-links.js +187 -0
  178. package/scripts/validate-skills.js +69 -0
  179. package/scripts/validate-versions-test.js +32 -0
  180. package/scripts/validate-versions.js +35 -0
  181. package/skills/api-and-interface-design/SKILL.md +367 -0
  182. package/skills/browser-testing-with-devtools/SKILL.md +317 -0
  183. package/skills/ci-cd-and-automation/SKILL.md +390 -0
  184. package/skills/code-review-and-quality/SKILL.md +398 -0
  185. package/skills/code-simplification/SKILL.md +331 -0
  186. package/skills/constraint-driven-development/SKILL.md +311 -0
  187. package/skills/constraint-driven-development/references/floor-guard.md +182 -0
  188. package/skills/context-engineering/SKILL.md +353 -0
  189. package/skills/debugging-and-error-recovery/SKILL.md +300 -0
  190. package/skills/deprecation-and-migration/SKILL.md +247 -0
  191. package/skills/documentation-and-adrs/SKILL.md +288 -0
  192. package/skills/doubt-driven-development/SKILL.md +243 -0
  193. package/skills/frontend-ui-engineering/SKILL.md +340 -0
  194. package/skills/git-workflow-and-versioning/SKILL.md +355 -0
  195. package/skills/idea-refine/SKILL.md +178 -0
  196. package/skills/idea-refine/examples.md +238 -0
  197. package/skills/idea-refine/frameworks.md +99 -0
  198. package/skills/idea-refine/refinement-criteria.md +113 -0
  199. package/skills/idea-refine/scripts/idea-refine.sh +15 -0
  200. package/skills/incremental-implementation/SKILL.md +249 -0
  201. package/skills/interview-me/SKILL.md +235 -0
  202. package/skills/observability-and-instrumentation/SKILL.md +238 -0
  203. package/skills/performance-optimization/SKILL.md +267 -0
  204. package/skills/performance-optimization/references/optimization-patterns.md +250 -0
  205. package/skills/planning-and-task-breakdown/SKILL.md +257 -0
  206. package/skills/security-and-hardening/SKILL.md +216 -0
  207. package/skills/security-and-hardening/references/hardening-patterns.md +324 -0
  208. package/skills/shipping-and-launch/SKILL.md +330 -0
  209. package/skills/source-driven-development/SKILL.md +216 -0
  210. package/skills/spec-driven-development/SKILL.md +259 -0
  211. package/skills/test-driven-development/SKILL.md +398 -0
  212. package/skills/using-agent-skills/SKILL.md +192 -0
  213. package/tests/bundle.test.cjs +79 -0
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: using-agent-skills
3
+ description: Discovers and invokes agent skills. Use when starting a session, or when you need to decide which skill or workflow applies to the piece of work at hand. This is the meta-skill that governs how all other skills are discovered and invoked.
4
+ ---
5
+
6
+ # Using i3 Composer Agent
7
+
8
+ ## Overview
9
+
10
+ i3 Composer Agent is a collection of engineering workflow skills organized by development phase. Each skill encodes a specific process that senior engineers follow. This meta-skill helps you discover and apply the right skill for your current task.
11
+
12
+ ## Skill Discovery
13
+
14
+ When a task arrives, identify the development phase and apply the corresponding skill:
15
+
16
+ ```
17
+ Task arrives
18
+ │
19
+ ├── Don't know what you want yet? ──────→ interview-me
20
+ ├── Have a rough concept, need variants? → idea-refine
21
+ ├── New project/feature/change? ──→ spec-driven-development
22
+ ├── No quality bar written down? ──→ constraint-driven-development
23
+ ├── Have a spec, need tasks? ──────→ planning-and-task-breakdown
24
+ ├── Implementing code? ────────────→ incremental-implementation
25
+ │ ├── UI work? ─────────────────→ frontend-ui-engineering
26
+ │ ├── API work? ────────────────→ api-and-interface-design
27
+ │ ├── Need better context? ─────→ context-engineering
28
+ │ ├── Need doc-verified code? ───→ source-driven-development
29
+ │ └── Stakes high / unfamiliar code? ──→ doubt-driven-development
30
+ ├── Writing/running tests? ────────→ test-driven-development
31
+ │ └── Browser-based? ───────────→ browser-testing-with-devtools
32
+ ├── Something broke? ──────────────→ debugging-and-error-recovery
33
+ ├── Reviewing code? ───────────────→ code-review-and-quality
34
+ │ ├── Too complex? ─────────────→ code-simplification
35
+ │ ├── Security concerns? ───────→ security-and-hardening
36
+ │ └── Performance concerns? ────→ performance-optimization
37
+ ├── Committing/branching? ─────────→ git-workflow-and-versioning
38
+ ├── CI/CD pipeline work? ──────────→ ci-cd-and-automation
39
+ ├── Deprecating/migrating? ────────→ deprecation-and-migration
40
+ ├── Writing docs/ADRs? ───────────→ documentation-and-adrs
41
+ ├── Adding logs/metrics/alerts? ───→ observability-and-instrumentation
42
+ └── Deploying/launching? ─────────→ shipping-and-launch
43
+ ```
44
+
45
+ ## Core Operating Behaviors
46
+
47
+ These behaviors apply at all times, across all skills. They are non-negotiable.
48
+
49
+ ### 1. Surface Assumptions
50
+
51
+ Before implementing anything non-trivial, explicitly state your assumptions:
52
+
53
+ ```
54
+ ASSUMPTIONS I'M MAKING:
55
+ 1. [assumption about requirements]
56
+ 2. [assumption about architecture]
57
+ 3. [assumption about scope]
58
+ → Correct me now or I'll proceed with these.
59
+ ```
60
+
61
+ Don't silently fill in ambiguous requirements. The most common failure mode is making wrong assumptions and running with them unchecked. Surface uncertainty early — it's cheaper than rework.
62
+
63
+ ### 2. Manage Confusion Actively
64
+
65
+ When you encounter inconsistencies, conflicting requirements, or unclear specifications:
66
+
67
+ 1. **STOP.** Do not proceed with a guess.
68
+ 2. Name the specific confusion.
69
+ 3. Present the tradeoff or ask the clarifying question.
70
+ 4. Wait for resolution before continuing.
71
+
72
+ **Bad:** Silently picking one interpretation and hoping it's right.
73
+ **Good:** "I see X in the spec but Y in the existing code. Which takes precedence?"
74
+
75
+ ### 3. Push Back When Warranted
76
+
77
+ You are not a yes-machine. When an approach has clear problems:
78
+
79
+ - Point out the issue directly
80
+ - Explain the concrete downside (quantify when possible — "this adds ~200ms latency" not "this might be slower")
81
+ - Propose an alternative
82
+ - Accept the human's decision if they override with full information
83
+
84
+ Sycophancy is a failure mode. "Of course!" followed by implementing a bad idea helps no one. Honest technical disagreement is more valuable than false agreement.
85
+
86
+ ### 4. Enforce Simplicity
87
+
88
+ Your natural tendency is to overcomplicate. Actively resist it.
89
+
90
+ Before finishing any implementation, ask:
91
+ - Can this be done in fewer lines?
92
+ - Are these abstractions earning their complexity?
93
+ - Would a staff engineer look at this and say "why didn't you just..."?
94
+
95
+ If you build 1000 lines and 100 would suffice, you have failed. Prefer the boring, obvious solution. Cleverness is expensive.
96
+
97
+ ### 5. Maintain Scope Discipline
98
+
99
+ Touch only what you're asked to touch.
100
+
101
+ Do NOT:
102
+ - Remove comments you don't understand
103
+ - "Clean up" code orthogonal to the task
104
+ - Refactor adjacent systems as a side effect
105
+ - Delete code that seems unused without explicit approval
106
+ - Add features not in the spec because they "seem useful"
107
+
108
+ Your job is surgical precision, not unsolicited renovation.
109
+
110
+ ### 6. Verify, Don't Assume
111
+
112
+ Every skill includes a verification step. A task is not complete until verification passes. "Seems right" is never sufficient — there must be evidence (passing tests, build output, runtime data).
113
+
114
+ Per-skill verification is the local check. The project-wide bar that applies to *every* change, regardless of which skill is active, is the Definition of Done: tests pass, no regressions, behavior verified at runtime, docs updated. See `../../references/definition-of-done.md`. It complements each task's acceptance criteria rather than replacing them.
115
+
116
+ ## Failure Modes to Avoid
117
+
118
+ These are the subtle errors that look like productivity but create problems:
119
+
120
+ 1. Making wrong assumptions without checking
121
+ 2. Not managing your own confusion — plowing ahead when lost
122
+ 3. Not surfacing inconsistencies you notice
123
+ 4. Not presenting tradeoffs on non-obvious decisions
124
+ 5. Being sycophantic ("Of course!") to approaches with clear problems
125
+ 6. Overcomplicating code and APIs
126
+ 7. Modifying code or comments orthogonal to the task
127
+ 8. Removing things you don't fully understand
128
+ 9. Building without a spec because "it's obvious"
129
+ 10. Skipping verification because "it looks right"
130
+
131
+ ## Skill Rules
132
+
133
+ 1. **Check for an applicable skill before starting work.** Skills encode processes that prevent common mistakes.
134
+
135
+ 2. **Skills are workflows, not suggestions.** Follow the steps in order. Don't skip verification steps.
136
+
137
+ 3. **Multiple skills can apply.** A feature implementation might involve `idea-refine` → `spec-driven-development` → `planning-and-task-breakdown` → `incremental-implementation` → `test-driven-development` → `code-review-and-quality` → `code-simplification` → `shipping-and-launch` in sequence.
138
+
139
+ 4. **When in doubt, start with a spec.** If the task is non-trivial and there's no spec, begin with `spec-driven-development`.
140
+
141
+ ## Lifecycle Sequence
142
+
143
+ For a complete feature, the typical skill sequence is:
144
+
145
+ ```
146
+ 1. interview-me → Extract what the user actually wants
147
+ 2. idea-refine → Refine vague ideas
148
+ 3. spec-driven-development → Define what we're building
149
+ 4. planning-and-task-breakdown → Break into verifiable chunks
150
+ 5. context-engineering → Load the right context
151
+ 6. source-driven-development → Verify against official docs
152
+ 7. incremental-implementation → Build slice by slice
153
+ 8. observability-and-instrumentation → Instrument as you build (runs parallel with 7-9, not after)
154
+ 9. doubt-driven-development → Cross-examine non-trivial decisions in-flight
155
+ 10. test-driven-development → Prove each slice works
156
+ 11. code-review-and-quality → Review before merge
157
+ 12. code-simplification → Reduce unnecessary complexity while preserving behavior
158
+ 13. git-workflow-and-versioning → Clean commit history
159
+ 14. documentation-and-adrs → Document decisions
160
+ 15. deprecation-and-migration → Retire old systems and move users safely when needed
161
+ 16. shipping-and-launch → Deploy safely
162
+ ```
163
+
164
+ Not every task needs every skill. A bug fix might only need: `debugging-and-error-recovery` → `test-driven-development` → `code-review-and-quality`.
165
+
166
+ ## Quick Reference
167
+
168
+ | Phase | Skill | One-Line Summary |
169
+ |-------|-------|-----------------|
170
+ | Define | interview-me | Surface what the user actually wants before any plan, spec, or code exists |
171
+ | Define | idea-refine | Refine ideas through structured divergent and convergent thinking |
172
+ | Define | spec-driven-development | Requirements and acceptance criteria before code |
173
+ | Plan | planning-and-task-breakdown | Decompose into small, verifiable tasks |
174
+ | Build | incremental-implementation | Thin vertical slices, test each before expanding |
175
+ | Build | source-driven-development | Verify against official docs before implementing |
176
+ | Build | doubt-driven-development | Adversarial fresh-context review of every non-trivial decision |
177
+ | Build | context-engineering | Right context at the right time |
178
+ | Build | frontend-ui-engineering | Production-quality UI with accessibility |
179
+ | Build | api-and-interface-design | Stable interfaces with clear contracts |
180
+ | Verify | test-driven-development | Failing test first, then make it pass |
181
+ | Verify | browser-testing-with-devtools | Chrome DevTools MCP for runtime verification |
182
+ | Verify | debugging-and-error-recovery | Reproduce → localize → fix → guard |
183
+ | Review | code-review-and-quality | Five-axis review with quality gates |
184
+ | Review | code-simplification | Preserve behavior while reducing unnecessary complexity |
185
+ | Review | security-and-hardening | OWASP prevention, input validation, least privilege |
186
+ | Review | performance-optimization | Measure first, optimize only what matters |
187
+ | Ship | git-workflow-and-versioning | Atomic commits, clean history |
188
+ | Ship | ci-cd-and-automation | Automated quality gates on every change |
189
+ | Ship | deprecation-and-migration | Remove old systems and migrate users safely |
190
+ | Ship | documentation-and-adrs | Document the why, not just the what |
191
+ | Ship | observability-and-instrumentation | Structured logs, RED metrics, traces, symptom-based alerts |
192
+ | Ship | shipping-and-launch | Pre-launch checklist, monitoring, rollback plan |
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ const test = require('node:test');
4
+ const assert = require('node:assert/strict');
5
+ const fs = require('node:fs');
6
+ const os = require('node:os');
7
+ const path = require('node:path');
8
+ const { spawnSync } = require('node:child_process');
9
+ const root = path.resolve(__dirname, '..');
10
+ const cli = path.join(root, 'bin/i3-composer-agent.cjs');
11
+ function run(args) { return spawnSync(process.execPath, [cli, ...args], { encoding: 'utf8' }); }
12
+ function workspace(t) {
13
+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'i3-agent-bundle-'));
14
+ t.after(() => fs.rmSync(directory, { recursive: true, force: true }));
15
+ return directory;
16
+ }
17
+ test('help and version identify the package without preparing files', () => {
18
+ assert.match(run(['--help']).stdout, /@givolt\/i3-composer-agent/);
19
+ assert.equal(run(['--version']).stdout.trim(), require('../package.json').version);
20
+ });
21
+ test('dry run and invalid arguments leave the target untouched', t => {
22
+ const target = path.join(workspace(t), 'plugin');
23
+ assert.equal(run(['--codex', '--dir', target, '--dry-run']).status, 0);
24
+ assert.equal(fs.existsSync(target), false);
25
+ assert.equal(run(['--codebuddy', '--codex', '--dir', target]).status, 1);
26
+ assert.equal(run(['--extract', '--dir']).status, 1);
27
+ assert.equal(fs.existsSync(target), false);
28
+ });
29
+ test('complete bundle preserves reference links and all host assets at a path with spaces', t => {
30
+ const target = path.join(workspace(t), 'plugin with spaces');
31
+ const result = run(['--codebuddy', '--dir', target]);
32
+ assert.equal(result.status, 0, result.stderr);
33
+ assert.match(result.stdout, /\/plugin install i3-composer-agent@i3-composer-agent/);
34
+ assert.equal(fs.readdirSync(path.join(target, 'skills')).length, 25);
35
+ assert.equal(fs.readdirSync(path.join(target, '.claude/commands')).length, 9);
36
+ assert.equal(fs.readdirSync(path.join(target, 'agents')).filter(name => name.endsWith('.md')).length, 4);
37
+ assert.equal(JSON.parse(fs.readFileSync(path.join(target, '.codex-plugin/plugin.json'), 'utf8')).name, 'i3-composer-agent');
38
+ const check = spawnSync(process.execPath, [path.join(target, 'scripts/validate-reference-links.js')], { cwd: target, encoding: 'utf8' });
39
+ assert.equal(check.status, 0, check.stdout + check.stderr);
40
+ assert.equal(fs.existsSync(path.join(target, 'AGENTS.md')), false);
41
+ assert.equal(fs.existsSync(path.join(target, 'CLAUDE.md')), false);
42
+ });
43
+ test('existing unrelated files cannot be replaced even with force', t => {
44
+ const target = path.join(workspace(t), 'existing');
45
+ fs.mkdirSync(target);
46
+ fs.writeFileSync(path.join(target, 'plugin.json'), '{"name":"another-plugin"}\n');
47
+ fs.writeFileSync(path.join(target, 'keep.txt'), 'business data');
48
+ assert.equal(run(['--extract', '--dir', target]).status, 1);
49
+ assert.equal(run(['--extract', '--dir', target, '--force']).status, 1);
50
+ assert.equal(fs.readFileSync(path.join(target, 'keep.txt'), 'utf8'), 'business data');
51
+ });
52
+ test('installed packages beneath node_modules remain fully extractable', t => {
53
+ const parent = workspace(t);
54
+ const installed = path.join(parent, 'node_modules', '@givolt', 'i3-composer-agent');
55
+ assert.equal(run(['--extract', '--dir', installed]).status, 0);
56
+ const target = path.join(parent, 'plugin');
57
+ const result = spawnSync(process.execPath, [path.join(installed, 'bin/i3-composer-agent.cjs'), '--extract', '--dir', target], { encoding: 'utf8' });
58
+ assert.equal(result.status, 0, result.stderr);
59
+ assert.equal(JSON.parse(fs.readFileSync(path.join(target, 'package.json'), 'utf8')).name, '@givolt/i3-composer-agent');
60
+ assert.equal(fs.readdirSync(path.join(target, 'skills')).length, 25);
61
+ });
62
+ test('replacement preserves the complete previous bundle in a backup', t => {
63
+ const parent = workspace(t);
64
+ const target = path.join(parent, 'plugin');
65
+ assert.equal(run(['--extract', '--dir', target]).status, 0);
66
+ fs.writeFileSync(path.join(target, 'custom-note.txt'), 'preserve me');
67
+ const result = run(['--extract', '--dir', target, '--force']);
68
+ assert.equal(result.status, 0, result.stderr);
69
+ const backups = fs.readdirSync(parent).filter(name => name.startsWith('plugin.backup-'));
70
+ assert.equal(backups.length, 1);
71
+ assert.equal(fs.readFileSync(path.join(parent, backups[0], 'custom-note.txt'), 'utf8'), 'preserve me');
72
+ assert.equal(fs.existsSync(path.join(target, 'custom-note.txt')), false);
73
+ });
74
+ test('source directories and aliases cannot be overwritten', t => {
75
+ assert.equal(run(['--extract', '--dir', root, '--force']).status, 1);
76
+ const alias = path.join(workspace(t), 'source-alias');
77
+ fs.symlinkSync(root, alias, 'dir');
78
+ assert.equal(run(['--extract', '--dir', alias, '--force']).status, 1);
79
+ });