@1agh/maude 0.15.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 (211) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -0
  3. package/cli/bin/maude.exe +15 -0
  4. package/cli/bin/maude.mjs +45 -0
  5. package/cli/bin/mdcc.exe +10 -0
  6. package/cli/bin/mdcc.mjs +7 -0
  7. package/cli/cli-wrapper.cjs +67 -0
  8. package/cli/commands/config.mjs +94 -0
  9. package/cli/commands/design.mjs +386 -0
  10. package/cli/commands/help.mjs +57 -0
  11. package/cli/commands/init.mjs +178 -0
  12. package/cli/commands/version.mjs +7 -0
  13. package/cli/install.cjs +113 -0
  14. package/cli/lib/argv.mjs +37 -0
  15. package/cli/lib/argv.test.mjs +46 -0
  16. package/cli/lib/copy-tree.mjs +78 -0
  17. package/package.json +94 -0
  18. package/plugins/design/dev-server/annotations-context-toolbar.tsx +397 -0
  19. package/plugins/design/dev-server/annotations-layer.tsx +1717 -0
  20. package/plugins/design/dev-server/api.ts +674 -0
  21. package/plugins/design/dev-server/bin/_screenshot-playwright.mjs +50 -0
  22. package/plugins/design/dev-server/bin/bootstrap-check.sh +83 -0
  23. package/plugins/design/dev-server/bin/canvas-edit.sh +48 -0
  24. package/plugins/design/dev-server/bin/handoff.sh +27 -0
  25. package/plugins/design/dev-server/bin/screenshot.sh +232 -0
  26. package/plugins/design/dev-server/bin/server-up.sh +135 -0
  27. package/plugins/design/dev-server/bin/slug.sh +22 -0
  28. package/plugins/design/dev-server/bin/smoke.sh +272 -0
  29. package/plugins/design/dev-server/build.ts +267 -0
  30. package/plugins/design/dev-server/canvas-build.ts +219 -0
  31. package/plugins/design/dev-server/canvas-edit.ts +388 -0
  32. package/plugins/design/dev-server/canvas-header.ts +165 -0
  33. package/plugins/design/dev-server/canvas-icons.tsx +131 -0
  34. package/plugins/design/dev-server/canvas-lib-inline.ts +260 -0
  35. package/plugins/design/dev-server/canvas-lib-resolver.ts +85 -0
  36. package/plugins/design/dev-server/canvas-lib.tsx +1995 -0
  37. package/plugins/design/dev-server/canvas-meta.schema.json +181 -0
  38. package/plugins/design/dev-server/canvas-pipeline.ts +270 -0
  39. package/plugins/design/dev-server/canvas-shell.tsx +813 -0
  40. package/plugins/design/dev-server/client/app.jsx +2027 -0
  41. package/plugins/design/dev-server/client/hmr.mjs +85 -0
  42. package/plugins/design/dev-server/client/iframe-lazy.mjs +121 -0
  43. package/plugins/design/dev-server/client/index.html +15 -0
  44. package/plugins/design/dev-server/client/styles/0-reset.css +18 -0
  45. package/plugins/design/dev-server/client/styles/1-tokens.css +297 -0
  46. package/plugins/design/dev-server/client/styles/2-layout.css +35 -0
  47. package/plugins/design/dev-server/client/styles/3-shell.css +906 -0
  48. package/plugins/design/dev-server/client/styles/4-components.css +1268 -0
  49. package/plugins/design/dev-server/client/styles/5-utilities.css +4 -0
  50. package/plugins/design/dev-server/client/styles/_index.css +24 -0
  51. package/plugins/design/dev-server/client/styles.css +1419 -0
  52. package/plugins/design/dev-server/config.schema.json +147 -0
  53. package/plugins/design/dev-server/context-menu.tsx +343 -0
  54. package/plugins/design/dev-server/context.ts +173 -0
  55. package/plugins/design/dev-server/dist/client.bundle.js +20323 -0
  56. package/plugins/design/dev-server/dist/styles.css +2875 -0
  57. package/plugins/design/dev-server/examples/README.md +9 -0
  58. package/plugins/design/dev-server/examples/perf-100-artboards.tsx +113 -0
  59. package/plugins/design/dev-server/fs-watch.ts +63 -0
  60. package/plugins/design/dev-server/handoff.ts +721 -0
  61. package/plugins/design/dev-server/history.ts +125 -0
  62. package/plugins/design/dev-server/hmr-broadcast.ts +114 -0
  63. package/plugins/design/dev-server/http.ts +413 -0
  64. package/plugins/design/dev-server/input-router.tsx +485 -0
  65. package/plugins/design/dev-server/inspect.ts +365 -0
  66. package/plugins/design/dev-server/locator.ts +159 -0
  67. package/plugins/design/dev-server/mem.ts +97 -0
  68. package/plugins/design/dev-server/runtime-bundle.ts +235 -0
  69. package/plugins/design/dev-server/server.mjs +1246 -0
  70. package/plugins/design/dev-server/server.ts +131 -0
  71. package/plugins/design/dev-server/test/_helpers.ts +81 -0
  72. package/plugins/design/dev-server/test/active-state.test.ts +145 -0
  73. package/plugins/design/dev-server/test/annotations-api.test.ts +146 -0
  74. package/plugins/design/dev-server/test/annotations-layer.test.ts +419 -0
  75. package/plugins/design/dev-server/test/binary-smoke.test.ts +47 -0
  76. package/plugins/design/dev-server/test/bundle-smoke.test.ts +29 -0
  77. package/plugins/design/dev-server/test/canvas-build.test.ts +78 -0
  78. package/plugins/design/dev-server/test/canvas-edit.test.ts +139 -0
  79. package/plugins/design/dev-server/test/canvas-header.test.ts +127 -0
  80. package/plugins/design/dev-server/test/canvas-lib-inline.test.ts +146 -0
  81. package/plugins/design/dev-server/test/canvas-lib-resolver.test.ts +112 -0
  82. package/plugins/design/dev-server/test/canvas-meta-api.test.ts +236 -0
  83. package/plugins/design/dev-server/test/canvas-pipeline.test.ts +180 -0
  84. package/plugins/design/dev-server/test/canvas-route.test.ts +176 -0
  85. package/plugins/design/dev-server/test/fs-watch.test.ts +41 -0
  86. package/plugins/design/dev-server/test/handoff-static-frames.test.ts +215 -0
  87. package/plugins/design/dev-server/test/handoff.test.ts +281 -0
  88. package/plugins/design/dev-server/test/history-rollback.test.ts +62 -0
  89. package/plugins/design/dev-server/test/hmr-broadcast.test.ts +108 -0
  90. package/plugins/design/dev-server/test/input-router.test.ts +316 -0
  91. package/plugins/design/dev-server/test/locator.test.ts +214 -0
  92. package/plugins/design/dev-server/test/perf-harness.ts +193 -0
  93. package/plugins/design/dev-server/test/phase-3.6-smoke.test.ts +77 -0
  94. package/plugins/design/dev-server/test/runtime-bundle.test.ts +69 -0
  95. package/plugins/design/dev-server/test/server-lifecycle.test.ts +28 -0
  96. package/plugins/design/dev-server/test/tool-palette.test.tsx +55 -0
  97. package/plugins/design/dev-server/test/use-annotation-selection.test.tsx +77 -0
  98. package/plugins/design/dev-server/test/use-artboard-drag.test.ts +325 -0
  99. package/plugins/design/dev-server/test/use-selection-set.test.tsx +166 -0
  100. package/plugins/design/dev-server/test/use-snap-guides.test.ts +190 -0
  101. package/plugins/design/dev-server/test/use-tool-mode.test.tsx +93 -0
  102. package/plugins/design/dev-server/test/ws-handshake.test.ts +33 -0
  103. package/plugins/design/dev-server/tool-palette.tsx +278 -0
  104. package/plugins/design/dev-server/tsconfig.json +26 -0
  105. package/plugins/design/dev-server/use-annotation-selection.tsx +92 -0
  106. package/plugins/design/dev-server/use-annotations-visibility.tsx +43 -0
  107. package/plugins/design/dev-server/use-artboard-drag.tsx +445 -0
  108. package/plugins/design/dev-server/use-selection-set.tsx +224 -0
  109. package/plugins/design/dev-server/use-snap-guides.tsx +215 -0
  110. package/plugins/design/dev-server/use-tool-mode.tsx +114 -0
  111. package/plugins/design/dev-server/ws.ts +90 -0
  112. package/plugins/design/templates/_shell.html +177 -0
  113. package/plugins/design/templates/canvas.tsx.template +54 -0
  114. package/plugins/design/templates/design-system-inspiration/_MAPPING.md +277 -0
  115. package/plugins/design/templates/design-system-inspiration/_README.md +71 -0
  116. package/plugins/design/templates/design-system-inspiration/audience-consumer/components-banner.html +68 -0
  117. package/plugins/design/templates/design-system-inspiration/audience-consumer/components-empty-state-generous.html +39 -0
  118. package/plugins/design/templates/design-system-inspiration/audience-consumer/components-feature-grid.html +62 -0
  119. package/plugins/design/templates/design-system-inspiration/audience-consumer/components-marketing-card.html +63 -0
  120. package/plugins/design/templates/design-system-inspiration/audience-consumer/components-testimonial.html +80 -0
  121. package/plugins/design/templates/design-system-inspiration/audience-developer/components-code-block.html +71 -0
  122. package/plugins/design/templates/design-system-inspiration/audience-developer/components-diff-view.html +65 -0
  123. package/plugins/design/templates/design-system-inspiration/audience-developer/components-log-stream.html +62 -0
  124. package/plugins/design/templates/design-system-inspiration/audience-developer/components-monospace-table.html +57 -0
  125. package/plugins/design/templates/design-system-inspiration/audience-developer/components-terminal-pane.html +67 -0
  126. package/plugins/design/templates/design-system-inspiration/audience-developer/type-mono.html +57 -0
  127. package/plugins/design/templates/design-system-inspiration/audience-pro/colors-presence.html +74 -0
  128. package/plugins/design/templates/design-system-inspiration/audience-pro/components-command-palette.html +90 -0
  129. package/plugins/design/templates/design-system-inspiration/audience-pro/components-keyboard.html +51 -0
  130. package/plugins/design/templates/design-system-inspiration/audience-pro/components-list.html +89 -0
  131. package/plugins/design/templates/design-system-inspiration/audience-pro/components-shortcuts-overlay.html +85 -0
  132. package/plugins/design/templates/design-system-inspiration/audience-pro/components-toast-menu.html +80 -0
  133. package/plugins/design/templates/design-system-inspiration/core/INDEX.md.tpl +25 -0
  134. package/plugins/design/templates/design-system-inspiration/core/README.orchestration.md.tpl +71 -0
  135. package/plugins/design/templates/design-system-inspiration/core/README.philosophy.md.tpl +77 -0
  136. package/plugins/design/templates/design-system-inspiration/core/SKILL.md.tpl +50 -0
  137. package/plugins/design/templates/design-system-inspiration/core/colors_and_type.css.tpl +111 -0
  138. package/plugins/design/templates/design-system-inspiration/core/config.json.tpl +28 -0
  139. package/plugins/design/templates/design-system-inspiration/core/preview/_layout.css +113 -0
  140. package/plugins/design/templates/design-system-inspiration/core/preview/colors-accent.html +48 -0
  141. package/plugins/design/templates/design-system-inspiration/core/preview/colors-surfaces.html +49 -0
  142. package/plugins/design/templates/design-system-inspiration/core/preview/colors-text.html +52 -0
  143. package/plugins/design/templates/design-system-inspiration/core/preview/components-buttons.html +83 -0
  144. package/plugins/design/templates/design-system-inspiration/core/preview/components-cards.html +79 -0
  145. package/plugins/design/templates/design-system-inspiration/core/preview/components-inputs.html +82 -0
  146. package/plugins/design/templates/design-system-inspiration/core/preview/motion.html +66 -0
  147. package/plugins/design/templates/design-system-inspiration/core/preview/spacing-scale.html +53 -0
  148. package/plugins/design/templates/design-system-inspiration/core/preview/type-scale.html +62 -0
  149. package/plugins/design/templates/design-system-inspiration/foundations/borders.html +39 -0
  150. package/plugins/design/templates/design-system-inspiration/foundations/elevation.html +46 -0
  151. package/plugins/design/templates/design-system-inspiration/foundations/focus.html +48 -0
  152. package/plugins/design/templates/design-system-inspiration/foundations/grid.html +51 -0
  153. package/plugins/design/templates/design-system-inspiration/foundations/iconography.html +73 -0
  154. package/plugins/design/templates/design-system-inspiration/foundations/opacity.html +45 -0
  155. package/plugins/design/templates/design-system-inspiration/foundations/radii.html +40 -0
  156. package/plugins/design/templates/design-system-inspiration/foundations/selection.html +45 -0
  157. package/plugins/design/templates/design-system-inspiration/meta/accessibility.html +62 -0
  158. package/plugins/design/templates/design-system-inspiration/meta/i18n.html +73 -0
  159. package/plugins/design/templates/design-system-inspiration/meta/presence-multiplayer.html +71 -0
  160. package/plugins/design/templates/design-system-inspiration/meta/tokens-index.html +80 -0
  161. package/plugins/design/templates/design-system-inspiration/patterns/patterns-auth.html +78 -0
  162. package/plugins/design/templates/design-system-inspiration/patterns/patterns-data-density.html +61 -0
  163. package/plugins/design/templates/design-system-inspiration/patterns/patterns-error-pages.html +70 -0
  164. package/plugins/design/templates/design-system-inspiration/patterns/patterns-form-layouts.html +70 -0
  165. package/plugins/design/templates/design-system-inspiration/patterns/patterns-onboarding.html +71 -0
  166. package/plugins/design/templates/design-system-inspiration/patterns/patterns-pricing.html +83 -0
  167. package/plugins/design/templates/design-system-inspiration/platform-desktop/components-resize-panels.html +63 -0
  168. package/plugins/design/templates/design-system-inspiration/platform-desktop/ui_kits-desktop-index.html +55 -0
  169. package/plugins/design/templates/design-system-inspiration/platform-desktop/ui_kits-desktop-showcase.html +302 -0
  170. package/plugins/design/templates/design-system-inspiration/platform-mobile/components-bottom-sheet.html +63 -0
  171. package/plugins/design/templates/design-system-inspiration/platform-mobile/components-pull-to-refresh.html +74 -0
  172. package/plugins/design/templates/design-system-inspiration/platform-mobile/components-segmented-control.html +51 -0
  173. package/plugins/design/templates/design-system-inspiration/platform-mobile/components-tab-bar.html +57 -0
  174. package/plugins/design/templates/design-system-inspiration/platform-mobile/ui_kits-mobile-index.html +58 -0
  175. package/plugins/design/templates/design-system-inspiration/platform-mobile/ui_kits-mobile-showcase.html +237 -0
  176. package/plugins/design/templates/design-system-inspiration/status/colors-status.html +49 -0
  177. package/plugins/design/templates/design-system-inspiration/status/components-status.html +63 -0
  178. package/plugins/design/templates/design-system-inspiration/status/skeletons.html +74 -0
  179. package/plugins/design/templates/design-system-inspiration/theme-both/colors-themes-side-by-side.html +59 -0
  180. package/plugins/design/templates/design-system-inspiration/universal/components-callout.html +74 -0
  181. package/plugins/design/templates/design-system-inspiration/universal/components-dialogs.html +81 -0
  182. package/plugins/design/templates/design-system-inspiration/universal/components-tables.html +101 -0
  183. package/plugins/design/templates/design-system-inspiration/universal/components-toggles.html +74 -0
  184. package/plugins/design/templates/design-system-inspiration/universal/components-tooltips.html +74 -0
  185. package/plugins/design/templates/design-system-inspiration/universal/empty-state.html.tpl +34 -0
  186. package/plugins/design/templates/design-system-inspiration/universal/logo.html +42 -0
  187. package/plugins/design/templates/ds-specimen.tsx.template +59 -0
  188. package/plugins/flow/.claude-plugin/config.schema.json +398 -0
  189. package/plugins/flow/README.md +45 -0
  190. package/plugins/flow/templates/ai-skeleton/INDEX.md +50 -0
  191. package/plugins/flow/templates/ai-skeleton/README.md +46 -0
  192. package/plugins/flow/templates/ai-skeleton/browser/har/.gitkeep +0 -0
  193. package/plugins/flow/templates/ai-skeleton/browser/snapshots/.gitkeep +0 -0
  194. package/plugins/flow/templates/ai-skeleton/business/README.md +12 -0
  195. package/plugins/flow/templates/ai-skeleton/context/README.md +12 -0
  196. package/plugins/flow/templates/ai-skeleton/decisions/README.md +20 -0
  197. package/plugins/flow/templates/ai-skeleton/design-import/.gitkeep +0 -0
  198. package/plugins/flow/templates/ai-skeleton/dev-logs/.gitkeep +0 -0
  199. package/plugins/flow/templates/ai-skeleton/device/.gitkeep +0 -0
  200. package/plugins/flow/templates/ai-skeleton/docs/README.md +5 -0
  201. package/plugins/flow/templates/ai-skeleton/logs/.gitkeep +0 -0
  202. package/plugins/flow/templates/ai-skeleton/logs/README.md +13 -0
  203. package/plugins/flow/templates/ai-skeleton/plans/README.md +16 -0
  204. package/plugins/flow/templates/ai-skeleton/plans/archive/.gitkeep +0 -0
  205. package/plugins/flow/templates/ai-skeleton/release-guide.md +35 -0
  206. package/plugins/flow/templates/ai-skeleton/reviews/README.md +15 -0
  207. package/plugins/flow/templates/ai-skeleton/scenarios/README.md +26 -0
  208. package/plugins/flow/templates/ai-skeleton/scenarios/_lib/.gitkeep +0 -0
  209. package/plugins/flow/templates/ai-skeleton/state/STATE.md +25 -0
  210. package/plugins/flow/templates/ai-skeleton/templates/HANDOFF.md +32 -0
  211. package/plugins/flow/templates/ai-skeleton/workflows.config.json +74 -0
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable */
3
+ // Postinstall: resolve the matching @1agh/maude-<slug> sub-package and
4
+ // write its absolute binary path to `cli/.platform-binary-path` so the
5
+ // dispatcher (`cli/bin/maude.mjs`) can `execFileSync` the native binary for
6
+ // hot paths (`maude design serve`) with zero Node startup tax on subsequent
7
+ // invocations.
8
+ //
9
+ // Pragmatic deviation from plan T12: see DDR-015. The full "maude IS the
10
+ // binary" port (delete maude.mjs entirely) is deferred — currently the binary
11
+ // only handles the dev-server, so we route only that subcommand through it.
12
+ // CLI subcommands (init, config, version) keep running on Node for now.
13
+
14
+ 'use strict';
15
+
16
+ const fs = require('node:fs');
17
+ const path = require('node:path');
18
+
19
+ const HERE = __dirname;
20
+ const SIDE_CHANNEL = path.join(HERE, '.platform-binary-path');
21
+
22
+ function isLocalDev() {
23
+ // Don't run inside the source tree (when the user is developing the package itself).
24
+ return fs.existsSync(path.join(HERE, '..', 'packages', 'maude-darwin-arm64', 'package.json'));
25
+ }
26
+
27
+ function detectSlug() {
28
+ const p = process.platform;
29
+ const a = process.arch;
30
+
31
+ if (p === 'darwin') {
32
+ if (a === 'arm64') return 'darwin-arm64';
33
+ try {
34
+ const { execSync } = require('node:child_process');
35
+ const t = execSync('sysctl -n sysctl.proc_translated', {
36
+ stdio: ['ignore', 'pipe', 'ignore'],
37
+ })
38
+ .toString()
39
+ .trim();
40
+ if (t === '1') return 'darwin-arm64';
41
+ } catch {
42
+ /* not running under Rosetta */
43
+ }
44
+ return 'darwin-x64';
45
+ }
46
+
47
+ if (p === 'linux') {
48
+ const isMusl = (() => {
49
+ try {
50
+ const report = process.report?.getReport?.();
51
+ const glibc = report?.header?.glibcVersionRuntime;
52
+ return !glibc;
53
+ } catch {
54
+ return false;
55
+ }
56
+ })();
57
+ if (a === 'arm64') return isMusl ? 'linux-arm64-musl' : 'linux-arm64';
58
+ return isMusl ? 'linux-x64-musl' : 'linux-x64';
59
+ }
60
+
61
+ if (p === 'win32') return 'win32-x64';
62
+
63
+ throw new Error(`Unsupported platform: ${p}-${a}`);
64
+ }
65
+
66
+ function resolveBinary(slug) {
67
+ const pkg = `@1agh/maude-${slug}`;
68
+ const filename = process.platform === 'win32' ? 'maude.exe' : 'maude';
69
+ try {
70
+ const manifest = require.resolve(`${pkg}/package.json`);
71
+ return path.join(path.dirname(manifest), filename);
72
+ } catch (err) {
73
+ throw new Error(
74
+ `Cannot find ${pkg}. Reinstall with \`npm i -g @1agh/maude\` or \`npm rebuild @1agh/maude\`. (${err?.message ? err.message : err})`
75
+ );
76
+ }
77
+ }
78
+
79
+ function main() {
80
+ // Accept both env-var names for one cycle (BC alias). Drop MD_CLAUDE_SKIP_POSTINSTALL in v0.17.x.
81
+ if (
82
+ process.env.MAUDE_SKIP_POSTINSTALL === '1' ||
83
+ process.env.MD_CLAUDE_SKIP_POSTINSTALL === '1'
84
+ ) {
85
+ console.log('@1agh/maude: postinstall skipped via MAUDE_SKIP_POSTINSTALL=1');
86
+ return;
87
+ }
88
+ if (isLocalDev()) {
89
+ return;
90
+ }
91
+ try {
92
+ const slug = detectSlug();
93
+ const bin = resolveBinary(slug);
94
+ if (!fs.existsSync(bin)) {
95
+ throw new Error(`binary missing at ${bin}`);
96
+ }
97
+ fs.writeFileSync(SIDE_CHANNEL, bin, 'utf8');
98
+ try {
99
+ fs.chmodSync(bin, 0o755);
100
+ } catch {
101
+ /* read-only fs / Windows — ignore */
102
+ }
103
+ console.log(`@1agh/maude: registered ${slug} binary (${bin})`);
104
+ } catch (err) {
105
+ console.error(`@1agh/maude: postinstall failed — ${err?.message ? err.message : err}`);
106
+ console.error(
107
+ ' `maude design serve` will fall back to running server.ts on Bun (if available).'
108
+ );
109
+ process.exit(0); // Don't fail the install.
110
+ }
111
+ }
112
+
113
+ main();
@@ -0,0 +1,37 @@
1
+ // Minimal flag/positional parser. No deps.
2
+ //
3
+ // parseArgs(['--name', 'foo', '--force', 'pos1'])
4
+ // → { flags: { name: 'foo', force: true }, positional: ['pos1'] }
5
+ //
6
+ // Boolean flags must be in the `booleans` set or they consume the next arg.
7
+ export function parseArgs(args, { booleans = [] } = {}) {
8
+ const flags = {};
9
+ const positional = [];
10
+ for (let i = 0; i < args.length; i++) {
11
+ const a = args[i];
12
+ if (a === '--') {
13
+ positional.push(...args.slice(i + 1));
14
+ break;
15
+ }
16
+ if (a.startsWith('--')) {
17
+ const eq = a.indexOf('=');
18
+ if (eq !== -1) {
19
+ flags[a.slice(2, eq)] = a.slice(eq + 1);
20
+ } else {
21
+ const key = a.slice(2);
22
+ if (booleans.includes(key)) {
23
+ flags[key] = true;
24
+ } else {
25
+ flags[key] = args[++i];
26
+ }
27
+ }
28
+ } else if (a.startsWith('-') && a.length > 1) {
29
+ const key = a.slice(1);
30
+ if (booleans.includes(key)) flags[key] = true;
31
+ else flags[key] = args[++i];
32
+ } else {
33
+ positional.push(a);
34
+ }
35
+ }
36
+ return { flags, positional };
37
+ }
@@ -0,0 +1,46 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { parseArgs } from './argv.mjs';
4
+
5
+ test('value flag with --key value', () => {
6
+ const { flags, positional } = parseArgs(['--name', 'foo']);
7
+ assert.equal(flags.name, 'foo');
8
+ assert.deepEqual(positional, []);
9
+ });
10
+
11
+ test('value flag with --key=value', () => {
12
+ const { flags } = parseArgs(['--name=foo']);
13
+ assert.equal(flags.name, 'foo');
14
+ });
15
+
16
+ test('boolean flag declared in booleans set', () => {
17
+ const { flags, positional } = parseArgs(['--force', 'pos1'], { booleans: ['force'] });
18
+ assert.equal(flags.force, true);
19
+ assert.deepEqual(positional, ['pos1']);
20
+ });
21
+
22
+ test('positional args collected', () => {
23
+ const { positional } = parseArgs(['init', 'my-project']);
24
+ assert.deepEqual(positional, ['init', 'my-project']);
25
+ });
26
+
27
+ test('-- separator dumps remaining as positional', () => {
28
+ const { flags, positional } = parseArgs(['--name', 'foo', '--', '--not-a-flag', 'x']);
29
+ assert.equal(flags.name, 'foo');
30
+ assert.deepEqual(positional, ['--not-a-flag', 'x']);
31
+ });
32
+
33
+ test('short flag -p value', () => {
34
+ const { flags } = parseArgs(['-p', '4399']);
35
+ assert.equal(flags.p, '4399');
36
+ });
37
+
38
+ test('mixed flags + positionals', () => {
39
+ const { flags, positional } = parseArgs(
40
+ ['design', 'serve', '--port', '4399', '--root', '/tmp/x'],
41
+ { booleans: [] }
42
+ );
43
+ assert.equal(flags.port, '4399');
44
+ assert.equal(flags.root, '/tmp/x');
45
+ assert.deepEqual(positional, ['design', 'serve']);
46
+ });
@@ -0,0 +1,78 @@
1
+ import { copyFile, mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises';
2
+ import { basename, join, relative } from 'node:path';
3
+
4
+ // Recursively copy `src` → `dest`. Returns { created, skipped, replaced }.
5
+ // - never overwrites unless { force }
6
+ // - .gitkeep files are copied as empty dirs only when the dir is otherwise empty
7
+ // - if `transform({ srcPath, destPath, contents })` is provided, runs it before write
8
+ // for files matching `transformGlob` (substring match on srcPath).
9
+ // - if `rename(name)` is provided, rewrites entry filenames before computing dest
10
+ // (used to strip `.tpl` suffix during design-system scaffold).
11
+ export async function copyTree(src, dest, opts = {}) {
12
+ const {
13
+ force = false,
14
+ dryRun = false,
15
+ transform = null,
16
+ transformMatch = () => false,
17
+ rename = (name) => name,
18
+ } = opts;
19
+ const stats = { created: [], skipped: [], replaced: [] };
20
+
21
+ async function walk(srcDir, destDir) {
22
+ await ensureDir(destDir, dryRun);
23
+ const entries = await readdir(srcDir, { withFileTypes: true });
24
+ for (const entry of entries) {
25
+ const srcPath = join(srcDir, entry.name);
26
+ const destName = entry.isDirectory() ? entry.name : rename(entry.name);
27
+ const destPath = join(destDir, destName);
28
+ if (entry.isDirectory()) {
29
+ await walk(srcPath, destPath);
30
+ continue;
31
+ }
32
+ const exists = await fileExists(destPath);
33
+ if (entry.name === '.gitkeep') {
34
+ // Only carry .gitkeep over if dest dir is otherwise empty after this run.
35
+ // We still copy it to keep the dir tracked; harmless if non-empty.
36
+ if (!exists) {
37
+ if (!dryRun) await copyFile(srcPath, destPath);
38
+ stats.created.push(relative(dest, destPath));
39
+ } else {
40
+ stats.skipped.push(relative(dest, destPath));
41
+ }
42
+ continue;
43
+ }
44
+ if (exists && !force) {
45
+ stats.skipped.push(relative(dest, destPath));
46
+ continue;
47
+ }
48
+ if (transform && transformMatch(srcPath)) {
49
+ const contents = await readFile(srcPath, 'utf8');
50
+ const out = await transform({ srcPath, destPath, contents });
51
+ if (!dryRun) await writeFile(destPath, out);
52
+ } else {
53
+ if (!dryRun) await copyFile(srcPath, destPath);
54
+ }
55
+ if (exists) stats.replaced.push(relative(dest, destPath));
56
+ else stats.created.push(relative(dest, destPath));
57
+ }
58
+ }
59
+
60
+ await walk(src, dest);
61
+ return stats;
62
+ }
63
+
64
+ async function ensureDir(dir, dryRun) {
65
+ if (dryRun) return;
66
+ await mkdir(dir, { recursive: true });
67
+ }
68
+
69
+ async function fileExists(p) {
70
+ try {
71
+ await stat(p);
72
+ return true;
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+
78
+ export { basename };
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@1agh/maude",
3
+ "version": "0.15.0",
4
+ "description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=20",
8
+ "pnpm": ">=9",
9
+ "bun": ">=1.3"
10
+ },
11
+ "packageManager": "pnpm@11.0.4",
12
+ "bin": {
13
+ "maude": "cli/bin/maude.mjs",
14
+ "mdcc": "cli/bin/mdcc.mjs",
15
+ "maude-safe": "cli/cli-wrapper.cjs",
16
+ "mdcc-safe": "cli/cli-wrapper.cjs",
17
+ "claude-design-server": "plugins/design/dev-server/server.mjs"
18
+ },
19
+ "scripts": {
20
+ "start": "bun run plugins/design/dev-server/server.ts",
21
+ "dev": "bun run plugins/design/dev-server/server.ts --port 4399",
22
+ "dev:site": "pnpm --filter @maude/site dev --port 4398",
23
+ "build": "pnpm -r --if-present run build",
24
+ "build:binary": "bun run plugins/design/dev-server/build.ts --release",
25
+ "test": "node --test --test-reporter=spec cli/**/*.test.mjs",
26
+ "test:dev-server": "cd plugins/design/dev-server && bun test",
27
+ "lint": "biome check .",
28
+ "format": "biome format --write .",
29
+ "changeset": "changeset",
30
+ "changeset:version": "bash scripts/changesets-version.sh",
31
+ "release": "pnpm build && changeset publish",
32
+ "maude": "node cli/bin/maude.mjs",
33
+ "mdcc": "node cli/bin/mdcc.mjs",
34
+ "video:smoke": "bash scripts/video/smoke/run.sh",
35
+ "video:smoke:terminal": "vhs scripts/video/smoke/terminal.tape",
36
+ "video:smoke:browser": "playwright test --config scripts/video/smoke/playwright.config.ts",
37
+ "video:smoke:card": "remotion render scripts/video/smoke/card/index.tsx SmokeCard scripts/video/.work/smoke/card.mp4 --mute",
38
+ "postinstall": "node cli/install.cjs",
39
+ "prepublishOnly": "bash scripts/check-version-parity.sh"
40
+ },
41
+ "optionalDependencies": {
42
+ "@1agh/maude-darwin-arm64": "0.15.0",
43
+ "@1agh/maude-darwin-x64": "0.15.0",
44
+ "@1agh/maude-linux-arm64": "0.15.0",
45
+ "@1agh/maude-linux-arm64-musl": "0.15.0",
46
+ "@1agh/maude-linux-x64": "0.15.0",
47
+ "@1agh/maude-linux-x64-musl": "0.15.0",
48
+ "@1agh/maude-win32-x64": "0.15.0"
49
+ },
50
+ "files": [
51
+ "cli",
52
+ "plugins/design/dev-server",
53
+ "plugins/design/templates",
54
+ "plugins/flow/templates",
55
+ "plugins/flow/.claude-plugin/config.schema.json",
56
+ "LICENSE",
57
+ "README.md"
58
+ ],
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/1aGh/maude.git"
62
+ },
63
+ "homepage": "https://github.com/1aGh/maude#readme",
64
+ "bugs": {
65
+ "url": "https://github.com/1aGh/maude/issues"
66
+ },
67
+ "license": "MIT",
68
+ "author": "Michal Dovrtěl (1aGh)",
69
+ "keywords": [
70
+ "claude-code",
71
+ "claude-marketplace",
72
+ "claude-plugin",
73
+ "maude",
74
+ "mdcc",
75
+ "agentic-workflow",
76
+ "design-tools",
77
+ "design-system",
78
+ "dev-server",
79
+ "scaffold"
80
+ ],
81
+ "devDependencies": {
82
+ "@biomejs/biome": "^1.9.4",
83
+ "@changesets/cli": "^2.27.10",
84
+ "@playwright/test": "^1.60.0",
85
+ "@remotion/bundler": "^4.0.463",
86
+ "@remotion/cli": "^4.0.463",
87
+ "@remotion/renderer": "^4.0.463",
88
+ "@types/react": "^19.2.14",
89
+ "@types/react-dom": "^19.2.3",
90
+ "react": "^19.2.6",
91
+ "react-dom": "^19.2.6",
92
+ "remotion": "^4.0.463"
93
+ }
94
+ }