@helvetia-design/skills 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +10 -10
  2. package/dist/cli.js +193 -14
  3. package/package.json +4 -2
  4. package/sbom.cdx.json +9610 -9319
  5. package/skills/ds-migrate-from-baloise/SKILL.md +209 -24
  6. package/skills/ds-migrate-from-baloise/components/accordion/migration.md +79 -42
  7. package/skills/ds-migrate-from-baloise/components/app/migration.md +93 -40
  8. package/skills/ds-migrate-from-baloise/components/badge/migration.md +32 -18
  9. package/skills/ds-migrate-from-baloise/components/button/migration.md +168 -0
  10. package/skills/ds-migrate-from-baloise/components/card/migration.md +89 -70
  11. package/skills/ds-migrate-from-baloise/components/carousel/migration.md +83 -48
  12. package/skills/ds-migrate-from-baloise/components/checkbox/migration.md +285 -0
  13. package/skills/ds-migrate-from-baloise/components/close/migration.md +77 -0
  14. package/skills/ds-migrate-from-baloise/components/content/migration.md +88 -0
  15. package/skills/ds-migrate-from-baloise/components/data/migration.md +100 -0
  16. package/skills/ds-migrate-from-baloise/components/date/migration.md +107 -0
  17. package/skills/ds-migrate-from-baloise/components/divider/migration.md +100 -0
  18. package/skills/ds-migrate-from-baloise/components/dropdown/migration.md +150 -0
  19. package/skills/ds-migrate-from-baloise/components/field/migration.md +82 -0
  20. package/skills/ds-migrate-from-baloise/components/file-upload/migration.md +95 -0
  21. package/skills/ds-migrate-from-baloise/components/footer/migration.md +84 -0
  22. package/skills/ds-migrate-from-baloise/components/form/migration.md +106 -0
  23. package/skills/ds-migrate-from-baloise/components/heading/migration.md +106 -0
  24. package/skills/ds-migrate-from-baloise/components/hint/migration.md +71 -0
  25. package/skills/ds-migrate-from-baloise/components/icon/migration.md +46 -32
  26. package/skills/ds-migrate-from-baloise/components/input/migration.md +158 -0
  27. package/skills/ds-migrate-from-baloise/components/input-slider/migration.md +103 -0
  28. package/skills/ds-migrate-from-baloise/components/input-stepper/migration.md +97 -0
  29. package/skills/ds-migrate-from-baloise/components/label/migration.md +95 -0
  30. package/skills/ds-migrate-from-baloise/components/list/migration.md +290 -0
  31. package/skills/ds-migrate-from-baloise/components/logo/migration.md +78 -0
  32. package/skills/ds-migrate-from-baloise/components/modal/migration.md +223 -0
  33. package/skills/ds-migrate-from-baloise/components/navbar/migration.md +120 -0
  34. package/skills/ds-migrate-from-baloise/components/notification/migration.md +85 -0
  35. package/skills/ds-migrate-from-baloise/components/number-input/migration.md +102 -0
  36. package/skills/ds-migrate-from-baloise/components/pagination/migration.md +96 -0
  37. package/skills/ds-migrate-from-baloise/components/popup/migration.md +143 -0
  38. package/skills/ds-migrate-from-baloise/components/progress-bar/migration.md +83 -0
  39. package/skills/ds-migrate-from-baloise/components/radio/migration.md +159 -0
  40. package/skills/ds-migrate-from-baloise/components/segment/migration.md +108 -0
  41. package/skills/ds-migrate-from-baloise/components/select/migration.md +124 -0
  42. package/skills/ds-migrate-from-baloise/components/shape/migration.md +80 -0
  43. package/skills/ds-migrate-from-baloise/components/sheet/migration.md +75 -0
  44. package/skills/ds-migrate-from-baloise/components/snackbar/migration.md +207 -0
  45. package/skills/ds-migrate-from-baloise/components/spinner/migration.md +19 -13
  46. package/skills/ds-migrate-from-baloise/components/stack/migration.md +108 -0
  47. package/skills/ds-migrate-from-baloise/components/steps/migration.md +278 -0
  48. package/skills/ds-migrate-from-baloise/components/table/migration.md +93 -0
  49. package/skills/ds-migrate-from-baloise/components/tabs/migration.md +284 -0
  50. package/skills/ds-migrate-from-baloise/components/tag/migration.md +96 -0
  51. package/skills/ds-migrate-from-baloise/components/text/migration.md +45 -31
  52. package/skills/ds-migrate-from-baloise/components/textarea/migration.md +105 -0
  53. package/skills/ds-migrate-from-baloise/components/time-input/migration.md +187 -0
  54. package/skills/ds-migrate-from-baloise/components/toast/migration.md +127 -45
  55. package/skills/ds-migrate-from-baloise/components/tooltip/migration.md +39 -23
  56. package/skills/ds-migrate-from-baloise/scripts/detect-baloise.mjs +287 -81
  57. package/skills/ds-migrate-from-baloise/scripts/scan-assets.mjs +168 -0
  58. package/skills/ds-migrate-from-baloise/scripts/scan-bal-accordion.mjs +7 -6
  59. package/skills/ds-migrate-from-baloise/scripts/scan-bal-app.mjs +8 -7
  60. package/skills/ds-migrate-from-baloise/scripts/scan-bal-badge.mjs +7 -6
  61. package/skills/ds-migrate-from-baloise/scripts/scan-bal-button.mjs +71 -0
  62. package/skills/ds-migrate-from-baloise/scripts/scan-bal-card.mjs +7 -6
  63. package/skills/ds-migrate-from-baloise/scripts/scan-bal-carousel.mjs +7 -6
  64. package/skills/ds-migrate-from-baloise/scripts/scan-bal-checkbox.mjs +119 -0
  65. package/skills/ds-migrate-from-baloise/scripts/scan-bal-close.mjs +70 -0
  66. package/skills/ds-migrate-from-baloise/scripts/scan-bal-content.mjs +70 -0
  67. package/skills/ds-migrate-from-baloise/scripts/scan-bal-data.mjs +70 -0
  68. package/skills/ds-migrate-from-baloise/scripts/scan-bal-date.mjs +71 -0
  69. package/skills/ds-migrate-from-baloise/scripts/scan-bal-divider.mjs +70 -0
  70. package/skills/ds-migrate-from-baloise/scripts/scan-bal-dropdown.mjs +71 -0
  71. package/skills/ds-migrate-from-baloise/scripts/scan-bal-field.mjs +71 -0
  72. package/skills/ds-migrate-from-baloise/scripts/scan-bal-file-upload.mjs +70 -0
  73. package/skills/ds-migrate-from-baloise/scripts/scan-bal-footer.mjs +70 -0
  74. package/skills/ds-migrate-from-baloise/scripts/scan-bal-form.mjs +70 -0
  75. package/skills/ds-migrate-from-baloise/scripts/scan-bal-heading.mjs +70 -0
  76. package/skills/ds-migrate-from-baloise/scripts/scan-bal-hint.mjs +70 -0
  77. package/skills/ds-migrate-from-baloise/scripts/scan-bal-icon.mjs +7 -6
  78. package/skills/ds-migrate-from-baloise/scripts/scan-bal-input-slider.mjs +71 -0
  79. package/skills/ds-migrate-from-baloise/scripts/scan-bal-input-stepper.mjs +71 -0
  80. package/skills/ds-migrate-from-baloise/scripts/scan-bal-input.mjs +71 -0
  81. package/skills/ds-migrate-from-baloise/scripts/scan-bal-label.mjs +70 -0
  82. package/skills/ds-migrate-from-baloise/scripts/scan-bal-list.mjs +71 -0
  83. package/skills/ds-migrate-from-baloise/scripts/scan-bal-logo.mjs +70 -0
  84. package/skills/ds-migrate-from-baloise/scripts/scan-bal-modal.mjs +103 -0
  85. package/skills/ds-migrate-from-baloise/scripts/scan-bal-navbar.mjs +71 -0
  86. package/skills/ds-migrate-from-baloise/scripts/scan-bal-notification.mjs +70 -0
  87. package/skills/ds-migrate-from-baloise/scripts/scan-bal-number-input.mjs +71 -0
  88. package/skills/ds-migrate-from-baloise/scripts/scan-bal-pagination.mjs +71 -0
  89. package/skills/ds-migrate-from-baloise/scripts/scan-bal-popup.mjs +87 -0
  90. package/skills/ds-migrate-from-baloise/scripts/scan-bal-progress-bar.mjs +70 -0
  91. package/skills/ds-migrate-from-baloise/scripts/scan-bal-radio.mjs +79 -0
  92. package/skills/ds-migrate-from-baloise/scripts/scan-bal-segment.mjs +71 -0
  93. package/skills/ds-migrate-from-baloise/scripts/scan-bal-select.mjs +71 -0
  94. package/skills/ds-migrate-from-baloise/scripts/scan-bal-shape.mjs +70 -0
  95. package/skills/ds-migrate-from-baloise/scripts/scan-bal-sheet.mjs +70 -0
  96. package/skills/ds-migrate-from-baloise/scripts/scan-bal-snackbar.mjs +86 -0
  97. package/skills/ds-migrate-from-baloise/scripts/scan-bal-spinner.mjs +7 -6
  98. package/skills/ds-migrate-from-baloise/scripts/scan-bal-stack.mjs +70 -0
  99. package/skills/ds-migrate-from-baloise/scripts/scan-bal-steps.mjs +71 -0
  100. package/skills/ds-migrate-from-baloise/scripts/scan-bal-table.mjs +70 -0
  101. package/skills/ds-migrate-from-baloise/scripts/scan-bal-tabs.mjs +71 -0
  102. package/skills/ds-migrate-from-baloise/scripts/scan-bal-tag.mjs +71 -0
  103. package/skills/ds-migrate-from-baloise/scripts/scan-bal-text.mjs +7 -6
  104. package/skills/ds-migrate-from-baloise/scripts/scan-bal-textarea.mjs +71 -0
  105. package/skills/ds-migrate-from-baloise/scripts/scan-bal-time-input.mjs +71 -0
  106. package/skills/ds-migrate-from-baloise/scripts/scan-bal-toast.mjs +25 -9
  107. package/skills/ds-migrate-from-baloise/scripts/scan-bal-tooltip.mjs +7 -6
  108. package/skills/ds-migrate-from-baloise/scripts/scan-cleanup.mjs +311 -0
  109. package/skills/ds-migrate-from-baloise/scripts/scan-css-utils.mjs +694 -0
  110. package/skills/ds-migrate-from-baloise/scripts/scan-icon-imports.mjs +209 -0
  111. package/skills/ds-migrate-from-baloise/scripts/scan-migratable.mjs +132 -21
  112. package/skills/ds-migrate-from-baloise/scripts/source-scan.mjs +618 -47
  113. package/skills/ds-migrate-from-baloise/shared/batch.md +139 -0
  114. package/skills/ds-migrate-from-baloise/shared/cleanup.md +74 -0
  115. package/skills/ds-migrate-from-baloise/shared/css-utils-map.json +706 -0
  116. package/skills/ds-migrate-from-baloise/shared/css-utils.md +132 -0
  117. package/skills/ds-migrate-from-baloise/shared/field.md +107 -0
  118. package/skills/ds-migrate-from-baloise/shared/fonts-favicons.md +117 -0
  119. package/skills/ds-migrate-from-baloise/shared/icon-name-map.json +22 -0
  120. package/skills/ds-migrate-from-baloise/shared/icons.md +143 -0
  121. package/skills/ds-migrate-from-baloise/shared/legacy-config.md +62 -0
  122. package/skills/ds-migrate-from-baloise/shared/report.md +94 -0
package/README.md CHANGED
@@ -46,7 +46,7 @@ Explore all available components, design tokens, and examples in the [component
46
46
 
47
47
  ## Contributing
48
48
 
49
- We welcome contributions! Please read our [CONTRIBUTING.md](https://github.com/helvetia-design/system/blob/next/CONTRIBUTING.md) guide to learn about:
49
+ We welcome contributions! Please read our [CONTRIBUTING.md](https://github.com/helvetia-design/system/blob/main/CONTRIBUTING.md) guide to learn about:
50
50
 
51
51
  - Reporting bugs and requesting features
52
52
  - Development setup and workflow
@@ -54,21 +54,21 @@ We welcome contributions! Please read our [CONTRIBUTING.md](https://github.com/h
54
54
  - Testing and code quality standards
55
55
  - Semantic versioning and changesets
56
56
 
57
- Follow our [Code of Conduct](https://github.com/helvetia-design/system/blob/next/CODE_OF_CONDUCT.md) for all interactions.
57
+ Follow our [Code of Conduct](https://github.com/helvetia-design/system/blob/main/CODE_OF_CONDUCT.md) for all interactions.
58
58
 
59
59
  ## Learn More
60
60
 
61
61
  - **[Documentation](https://helvetia-design.vercel.app)** — Component library, design tokens, and interactive examples in Storybook
62
62
  - **[Quick Start](https://helvetia-design.vercel.app/?path=/docs/development-getting-started--documentation)** — Get started with the design system in your project
63
63
  - **[llms.txt](https://helvetia-design.vercel.app/llms.txt)** / **[llms-full.txt](https://helvetia-design.vercel.app/llms-full.txt)** — Machine-readable component API and usage docs for AI coding tools ([llmstxt.org](https://llmstxt.org))
64
- - **[CHANGELOG.md](https://github.com/helvetia-design/system/blob/next/CHANGELOG.md)** — Release notes, version history, and changes for each version
65
- - **[ARCHITECTURE.md](https://github.com/helvetia-design/system/blob/next/docs/ARCHITECTURE.md)** — System design, workspace structure, component lifecycle, web components patterns, CSS variables, testing strategy
66
- - **[DEVELOPMENT.md](https://github.com/helvetia-design/system/blob/next/docs/DEVELOPMENT.md)** — Local setup, dev servers, building, testing, troubleshooting
67
- - **[CONTRIBUTING.md](https://github.com/helvetia-design/system/blob/next/CONTRIBUTING.md)** — Contribution workflow, PR process, component checklist, accessibility requirements
68
- - **[STYLE_GUIDE.md](https://github.com/helvetia-design/system/blob/next/docs/STYLE_GUIDE.md)** — Code standards, naming conventions, best practices
69
- - **[SECURITY.md](https://github.com/helvetia-design/system/blob/next/SECURITY.md)** — Security policy, vulnerability reporting, and compliance guidelines
70
- - **[CODE_OF_CONDUCT.md](https://github.com/helvetia-design/system/blob/next/CODE_OF_CONDUCT.md)** — Community standards and expectations
64
+ - **[CHANGELOG.md](https://github.com/helvetia-design/system/blob/main/CHANGELOG.md)** — Release notes, version history, and changes for each version
65
+ - **[ARCHITECTURE.md](https://github.com/helvetia-design/system/blob/main/docs/ARCHITECTURE.md)** — System design, workspace structure, component lifecycle, web components patterns, CSS variables, testing strategy
66
+ - **[DEVELOPMENT.md](https://github.com/helvetia-design/system/blob/main/docs/DEVELOPMENT.md)** — Local setup, dev servers, building, testing, troubleshooting
67
+ - **[CONTRIBUTING.md](https://github.com/helvetia-design/system/blob/main/CONTRIBUTING.md)** — Contribution workflow, PR process, component checklist, accessibility requirements
68
+ - **[STYLE_GUIDE.md](https://github.com/helvetia-design/system/blob/main/docs/STYLE_GUIDE.md)** — Code standards, naming conventions, best practices
69
+ - **[SECURITY.md](https://github.com/helvetia-design/system/blob/main/SECURITY.md)** — Security policy, vulnerability reporting, and compliance guidelines
70
+ - **[CODE_OF_CONDUCT.md](https://github.com/helvetia-design/system/blob/main/CODE_OF_CONDUCT.md)** — Community standards and expectations
71
71
 
72
72
  ## License
73
73
 
74
- This project is licensed under the Apache License 2.0. See [LICENSE](https://github.com/helvetia-design/system/blob/next/LICENSE) for details.
74
+ This project is licensed under the Apache License 2.0. See [LICENSE](https://github.com/helvetia-design/system/blob/main/LICENSE) for details.
package/dist/cli.js CHANGED
@@ -1,11 +1,31 @@
1
1
  #!/usr/bin/env node
2
+ import { createHash } from 'node:crypto';
2
3
  import { existsSync, readFileSync, realpathSync } from 'node:fs';
3
- import { cp, mkdir, rm } from 'node:fs/promises';
4
+ import { cp, lstat, mkdir, readdir, readFile, readlink, rename, rm, writeFile } from 'node:fs/promises';
4
5
  import { dirname, join, resolve } from 'node:path';
5
6
  import { fileURLToPath, pathToFileURL } from 'node:url';
6
7
  const PACKAGE_NAME = '@helvetia-design/skills';
7
8
  const SKILL_NAME = 'ds-migrate-from-baloise';
8
- const USAGE = 'Usage: skills add\n';
9
+ const USAGE = 'Usage: skills add [--force]\n';
10
+ const MARKER_FILE = '.installed.json';
11
+ const LOCK_FILES = [
12
+ 'package-lock.json',
13
+ 'pnpm-lock.yaml',
14
+ 'yarn.lock',
15
+ 'bun.lock',
16
+ 'npm-shrinkwrap.json'
17
+ ];
18
+ const RM_OPTIONS = {
19
+ recursive: true,
20
+ force: true,
21
+ maxRetries: 3
22
+ };
23
+ function sha256(content) {
24
+ return createHash('sha256').update(content).digest('hex');
25
+ }
26
+ function normalizeLineEndings(content) {
27
+ return Buffer.from(content.toString('latin1').replace(/\r\n/g, '\n'), 'latin1');
28
+ }
9
29
  function findPackageRoot(startDir) {
10
30
  let dir = startDir;
11
31
  while(true){
@@ -13,7 +33,10 @@ function findPackageRoot(startDir) {
13
33
  if (existsSync(pkgPath)) {
14
34
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
15
35
  if (pkg.name === PACKAGE_NAME) {
16
- return dir;
36
+ return {
37
+ dir,
38
+ version: pkg.version ?? 'unknown'
39
+ };
17
40
  }
18
41
  }
19
42
  const parent = dirname(dir);
@@ -23,33 +46,189 @@ function findPackageRoot(startDir) {
23
46
  dir = parent;
24
47
  }
25
48
  }
49
+ function findProjectRoot(startDir) {
50
+ let dir = startDir;
51
+ while(true){
52
+ if (existsSync(join(dir, 'package.json')) && LOCK_FILES.some((name)=>existsSync(join(dir, name)))) {
53
+ return dir;
54
+ }
55
+ const parent = dirname(dir);
56
+ if (parent === dir) {
57
+ return startDir;
58
+ }
59
+ dir = parent;
60
+ }
61
+ }
62
+ async function hashDirectory(root) {
63
+ const hashes = {};
64
+ async function walk(dir, prefix) {
65
+ for (const entry of (await readdir(dir, {
66
+ withFileTypes: true
67
+ }))){
68
+ const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
69
+ const fullPath = join(dir, entry.name);
70
+ if (entry.isDirectory()) {
71
+ await walk(fullPath, relative);
72
+ } else if (relative !== MARKER_FILE) {
73
+ if (entry.isSymbolicLink()) {
74
+ hashes[relative] = sha256(`symlink:${await readlink(fullPath)}`);
75
+ } else if (entry.isFile()) {
76
+ hashes[relative] = sha256(normalizeLineEndings(await readFile(fullPath)));
77
+ } else {
78
+ hashes[relative] = 'special';
79
+ }
80
+ }
81
+ }
82
+ }
83
+ await walk(root, '');
84
+ return Object.fromEntries(Object.keys(hashes).sort().map((path)=>[
85
+ path,
86
+ hashes[path]
87
+ ]));
88
+ }
89
+ function diffHashes(baseline, current) {
90
+ const changes = [];
91
+ for (const [path, hash] of Object.entries(current)){
92
+ if (!(path in baseline)) {
93
+ changes.push({
94
+ path,
95
+ kind: 'added'
96
+ });
97
+ } else if (baseline[path] !== hash) {
98
+ changes.push({
99
+ path,
100
+ kind: 'changed'
101
+ });
102
+ }
103
+ }
104
+ for (const path of Object.keys(baseline)){
105
+ if (!(path in current)) {
106
+ changes.push({
107
+ path,
108
+ kind: 'removed'
109
+ });
110
+ }
111
+ }
112
+ return changes.sort((a, b)=>a.path < b.path ? -1 : 1);
113
+ }
114
+ async function readMarkerFiles(destination) {
115
+ const markerPath = join(destination, MARKER_FILE);
116
+ if (!existsSync(markerPath)) {
117
+ return {
118
+ state: 'missing'
119
+ };
120
+ }
121
+ let marker;
122
+ try {
123
+ marker = JSON.parse(await readFile(markerPath, 'utf8'));
124
+ } catch {
125
+ return {
126
+ state: 'invalid'
127
+ };
128
+ }
129
+ const files = marker?.files;
130
+ if (typeof files === 'object' && files !== null && !Array.isArray(files) && Object.values(files).every((value)=>typeof value === 'string')) {
131
+ return {
132
+ state: 'valid',
133
+ files: files
134
+ };
135
+ }
136
+ return {
137
+ state: 'invalid'
138
+ };
139
+ }
140
+ async function recoverLeftovers(temp, backup, destination) {
141
+ await rm(temp, RM_OPTIONS);
142
+ if (existsSync(backup)) {
143
+ if (existsSync(destination)) {
144
+ await rm(backup, RM_OPTIONS);
145
+ } else {
146
+ await mkdir(dirname(destination), {
147
+ recursive: true
148
+ });
149
+ await rename(backup, destination);
150
+ }
151
+ }
152
+ }
153
+ function formatChanges(changes, marker) {
154
+ const list = changes.map((change)=>` ${change.kind}: ${change.path}`).join('\n');
155
+ const note = 'These files differ from the new version. This list cannot tell local edits from upstream changes, which happens once per project:';
156
+ const reason = marker === 'valid' ? `Local changes found in the installed ${SKILL_NAME} skill:` : marker === 'invalid' ? `${MARKER_FILE} in the installed ${SKILL_NAME} skill is invalid. ${note}` : `No ${MARKER_FILE} found in the installed ${SKILL_NAME} skill (installed before this check existed). ${note}`;
157
+ return `${reason}\n${list}\nRun "skills add --force" to overwrite them.\n`;
158
+ }
26
159
  export async function run(argv, io = {
27
160
  cwd: process.cwd(),
28
161
  stdout: process.stdout,
29
162
  stderr: process.stderr
30
163
  }) {
31
- if (argv.length !== 1 || argv[0] !== 'add') {
164
+ const isAdd = argv[0] === 'add';
165
+ const force = argv.length === 2 && argv[1] === '--force';
166
+ if (!isAdd || argv.length !== 1 && !force) {
32
167
  io.stderr.write(USAGE);
33
168
  return 1;
34
169
  }
35
170
  const packageRoot = findPackageRoot(dirname(fileURLToPath(import.meta.url)));
36
- const source = join(packageRoot, 'skills', SKILL_NAME);
37
- const destination = join(io.cwd, '.claude', 'skills', SKILL_NAME);
171
+ const source = join(packageRoot.dir, 'skills', SKILL_NAME);
172
+ const claudeDir = join(findProjectRoot(io.cwd), '.claude');
173
+ const destination = join(claudeDir, 'skills', SKILL_NAME);
174
+ const temp = join(claudeDir, `.${SKILL_NAME}.tmp`);
175
+ const backup = join(claudeDir, `.${SKILL_NAME}.bak`);
176
+ const copy = io.copy ?? (async (from, to)=>cp(from, to, {
177
+ recursive: true,
178
+ force: true
179
+ }));
180
+ const swap = io.rename ?? rename;
38
181
  if (!existsSync(source)) {
39
182
  io.stderr.write(`Skill payload not found at ${source}\n`);
40
183
  return 1;
41
184
  }
185
+ await recoverLeftovers(temp, backup, destination);
186
+ if (existsSync(destination) && !force) {
187
+ if (!(await lstat(destination)).isDirectory()) {
188
+ io.stderr.write(`The installed ${SKILL_NAME} path is not a folder:\n changed: .\nRun "skills add --force" to overwrite it.\n`);
189
+ return 1;
190
+ }
191
+ const installed = await hashDirectory(destination);
192
+ const marker = await readMarkerFiles(destination);
193
+ const baseline = marker.state === 'valid' ? marker.files : await hashDirectory(source);
194
+ const changes = diffHashes(baseline, installed);
195
+ if (changes.length > 0) {
196
+ io.stderr.write(formatChanges(changes, marker.state));
197
+ return 1;
198
+ }
199
+ }
42
200
  await mkdir(dirname(destination), {
43
201
  recursive: true
44
202
  });
45
- await rm(destination, {
46
- recursive: true,
47
- force: true
48
- });
49
- await cp(source, destination, {
50
- recursive: true,
51
- force: true
52
- });
203
+ try {
204
+ await copy(source, temp);
205
+ const marker = {
206
+ version: packageRoot.version,
207
+ files: await hashDirectory(temp)
208
+ };
209
+ await writeFile(join(temp, MARKER_FILE), `${JSON.stringify(marker, null, 2)}\n`);
210
+ if (existsSync(destination)) {
211
+ await swap(destination, backup);
212
+ try {
213
+ await swap(temp, destination);
214
+ } catch (swapError) {
215
+ try {
216
+ await swap(backup, destination);
217
+ } catch (rollbackError) {
218
+ throw new AggregateError([
219
+ swapError,
220
+ rollbackError
221
+ ], `Could not swap in the new skill folder and could not restore the previous one; it is kept at ${backup}`);
222
+ }
223
+ throw swapError;
224
+ }
225
+ await rm(backup, RM_OPTIONS);
226
+ } else {
227
+ await swap(temp, destination);
228
+ }
229
+ } finally{
230
+ await rm(temp, RM_OPTIONS);
231
+ }
53
232
  io.stdout.write(`Copied ${SKILL_NAME} to ${destination}\n`);
54
233
  return 0;
55
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helvetia-design/skills",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "description": "Installer CLI that copies Claude Code skills for migrating from the Baloise Design System to the Helvetia Design System.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,9 @@
23
23
  ],
24
24
  "devDependencies": {
25
25
  "eslint": "10.12.0",
26
- "vitest": "4.1.11"
26
+ "vitest": "4.1.11",
27
+ "@helvetia-design/assets": "0.1.0",
28
+ "@helvetia-design/styles": "0.1.0"
27
29
  },
28
30
  "scripts": {
29
31
  "build": "swc src/cli.ts -o dist/cli.js --config-file .swcrc",