@astryxdesign/cli 0.1.4-canary.2e83161 → 0.1.4-canary.32fe72d
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.
- package/package.json +9 -9
- package/src/commands/agent-docs.mjs +5 -7
- package/src/commands/agent-docs.test.mjs +0 -33
- package/src/commands/init.mjs +1 -1
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.doc.mjs +0 -14
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.tsx +0 -44
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.doc.mjs +0 -15
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.tsx +0 -107
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.1.4-canary.
|
|
3
|
+
"version": "0.1.4-canary.32fe72d",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"zod": "^4.4.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@astryxdesign/charts": "0.1.4-canary.
|
|
79
|
-
"@astryxdesign/core": "0.1.4-canary.
|
|
80
|
-
"@astryxdesign/lab": "0.1.4-canary.
|
|
81
|
-
"@astryxdesign/theme-neutral": "0.1.4-canary.
|
|
78
|
+
"@astryxdesign/charts": "0.1.4-canary.32fe72d",
|
|
79
|
+
"@astryxdesign/core": "0.1.4-canary.32fe72d",
|
|
80
|
+
"@astryxdesign/lab": "0.1.4-canary.32fe72d",
|
|
81
|
+
"@astryxdesign/theme-neutral": "0.1.4-canary.32fe72d",
|
|
82
82
|
"gpt-tokenizer": "^3.4.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@astryxdesign/charts": "0.1.4-canary.
|
|
100
|
-
"@astryxdesign/core": "0.1.4-canary.
|
|
101
|
-
"@astryxdesign/lab": "0.1.4-canary.
|
|
102
|
-
"@astryxdesign/theme-neutral": "0.1.4-canary.
|
|
99
|
+
"@astryxdesign/charts": "0.1.4-canary.32fe72d",
|
|
100
|
+
"@astryxdesign/core": "0.1.4-canary.32fe72d",
|
|
101
|
+
"@astryxdesign/lab": "0.1.4-canary.32fe72d",
|
|
102
|
+
"@astryxdesign/theme-neutral": "0.1.4-canary.32fe72d",
|
|
103
103
|
"gpt-tokenizer": "^3.4.0"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
@@ -9,12 +9,11 @@
|
|
|
9
9
|
* - Claude Code: CLAUDE.md (root) or .claude/CLAUDE.md
|
|
10
10
|
* - Cursor: .cursorrules
|
|
11
11
|
* - Codex/generic: AGENTS.md
|
|
12
|
-
* - Hermes Agent: .hermes.md or HERMES.md (existing), else AGENTS.md
|
|
13
12
|
*
|
|
14
13
|
* Auto-detect: discovers existing files and updates them in place.
|
|
15
14
|
* Default (no existing files): creates .claude/CLAUDE.md.
|
|
16
15
|
*
|
|
17
|
-
* --agent <tool>: target a specific tool preset (claude, cursor, codex,
|
|
16
|
+
* --agent <tool>: target a specific tool preset (claude, cursor, codex, all)
|
|
18
17
|
* --agent-docs-path <path>: explicit file path(s)
|
|
19
18
|
*/
|
|
20
19
|
|
|
@@ -47,7 +46,6 @@ const AGENT_PRESETS = {
|
|
|
47
46
|
claude: [CLAUDE_MD, CLAUDE_DIR_MD],
|
|
48
47
|
cursor: ['.cursorrules', AGENTS_MD],
|
|
49
48
|
codex: [AGENTS_MD],
|
|
50
|
-
hermes: ['.hermes.md', 'HERMES.md', AGENTS_MD],
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
/**
|
|
@@ -66,7 +64,7 @@ export function discoverAgentDocs(targetDir) {
|
|
|
66
64
|
* Searches for existing files first, falls back to default creation path.
|
|
67
65
|
*
|
|
68
66
|
* @param {string} targetDir
|
|
69
|
-
* @param {string} agent - Preset name: 'claude', 'cursor', 'codex', '
|
|
67
|
+
* @param {string} agent - Preset name: 'claude', 'cursor', 'codex', 'all'
|
|
70
68
|
* @returns {{inject: string[], create: string[]}} Files to inject into vs create fresh
|
|
71
69
|
*/
|
|
72
70
|
export function resolveAgentPaths(targetDir, agent) {
|
|
@@ -388,7 +386,7 @@ export function removeAgentDocs(targetDir) {
|
|
|
388
386
|
* @param {object} [options]
|
|
389
387
|
* @param {boolean} [options.zh]
|
|
390
388
|
* @param {string} [options.lang]
|
|
391
|
-
* @param {string} [options.agent] - Tool preset: 'claude', 'cursor', 'codex', '
|
|
389
|
+
* @param {string} [options.agent] - Tool preset: 'claude', 'cursor', 'codex', 'all'
|
|
392
390
|
* @param {string[]} [options.paths] - Explicit paths (overrides agent/auto-detect)
|
|
393
391
|
* @param {boolean} [options.onlyReplace] - Only update files that already have Astryx markers (for upgrades)
|
|
394
392
|
* @returns {string[]} List of files written
|
|
@@ -470,14 +468,14 @@ export function installAgentDocs(targetDir, {zh = false, lang, agent, paths, onl
|
|
|
470
468
|
return written;
|
|
471
469
|
}
|
|
472
470
|
|
|
473
|
-
const VALID_AGENTS = ['claude', 'cursor', 'codex', '
|
|
471
|
+
const VALID_AGENTS = ['claude', 'cursor', 'codex', 'all'];
|
|
474
472
|
|
|
475
473
|
export function registerAgentDocs(program) {
|
|
476
474
|
program
|
|
477
475
|
.command('agent-docs')
|
|
478
476
|
.description('Install/update the component index for AI coding agents')
|
|
479
477
|
.option('--remove', 'Remove the design system section from all agent doc files')
|
|
480
|
-
.option('--agent <tool>', 'Target tool: claude, cursor, codex,
|
|
478
|
+
.option('--agent <tool>', 'Target tool: claude, cursor, codex, all')
|
|
481
479
|
.option('--agent-docs-path <path...>', 'Explicit file path(s) to write to')
|
|
482
480
|
.action(options => {
|
|
483
481
|
const targetDir = process.cwd();
|
|
@@ -449,17 +449,6 @@ describe('installAgentDocs', () => {
|
|
|
449
449
|
expect(fs.existsSync(path.join(tmpDir, 'AGENTS.md'))).toBe(true);
|
|
450
450
|
});
|
|
451
451
|
|
|
452
|
-
it('respects --agent hermes preset: creates AGENTS.md', () => {
|
|
453
|
-
setupCorePackage(tmpDir);
|
|
454
|
-
|
|
455
|
-
const written = installAgentDocs(tmpDir, {agent: 'hermes'});
|
|
456
|
-
|
|
457
|
-
expect(written).toEqual(['AGENTS.md']);
|
|
458
|
-
const content = fs.readFileSync(path.join(tmpDir, 'AGENTS.md'), 'utf-8');
|
|
459
|
-
expect(content).toContain('<!-- ASTRYX:START -->');
|
|
460
|
-
expect(fs.existsSync(path.join(tmpDir, '.claude'))).toBe(false);
|
|
461
|
-
});
|
|
462
|
-
|
|
463
452
|
it('respects explicit --paths', () => {
|
|
464
453
|
setupCorePackage(tmpDir);
|
|
465
454
|
|
|
@@ -559,26 +548,4 @@ describe('resolveAgentPaths', () => {
|
|
|
559
548
|
expect(result.create).toContain('AGENTS.md');
|
|
560
549
|
expect(result.create).toContain('.claude/CLAUDE.md');
|
|
561
550
|
});
|
|
562
|
-
|
|
563
|
-
it('hermes preset creates AGENTS.md when nothing exists', () => {
|
|
564
|
-
const result = resolveAgentPaths(tmpDir, 'hermes');
|
|
565
|
-
expect(result).toEqual({inject: [], create: ['AGENTS.md']});
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
it('hermes preset finds existing .hermes.md', () => {
|
|
569
|
-
fs.writeFileSync(path.join(tmpDir, '.hermes.md'), '');
|
|
570
|
-
const result = resolveAgentPaths(tmpDir, 'hermes');
|
|
571
|
-
expect(result).toEqual({inject: ['.hermes.md'], create: []});
|
|
572
|
-
});
|
|
573
|
-
|
|
574
|
-
it('hermes preset finds existing HERMES.md when no .hermes.md', () => {
|
|
575
|
-
fs.writeFileSync(path.join(tmpDir, 'HERMES.md'), '');
|
|
576
|
-
const result = resolveAgentPaths(tmpDir, 'hermes');
|
|
577
|
-
expect(result).toEqual({inject: ['HERMES.md'], create: []});
|
|
578
|
-
});
|
|
579
|
-
|
|
580
|
-
it('claude preset still creates .claude/CLAUDE.md when nothing exists (hermes is additive)', () => {
|
|
581
|
-
const result = resolveAgentPaths(tmpDir, 'claude');
|
|
582
|
-
expect(result).toEqual({inject: [], create: ['.claude/CLAUDE.md']});
|
|
583
|
-
});
|
|
584
551
|
});
|
package/src/commands/init.mjs
CHANGED
|
@@ -198,7 +198,7 @@ export function registerInit(program) {
|
|
|
198
198
|
.option('--features <list>', 'Comma-separated features to install (agents, theme, template)')
|
|
199
199
|
.option('--all', 'Install all features, no prompts')
|
|
200
200
|
.option('--remove-agents', 'Remove AI agent docs from all agent doc files')
|
|
201
|
-
.option('--agent <tool>', 'Target AI tool for agent docs: claude, cursor, codex,
|
|
201
|
+
.option('--agent <tool>', 'Target AI tool for agent docs: claude, cursor, codex, all')
|
|
202
202
|
.option('--agent-docs-path <path...>', 'Explicit file path(s) for agent docs')
|
|
203
203
|
.action(async (options) => {
|
|
204
204
|
const targetDir = process.cwd();
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'ContextMenuItem',
|
|
7
|
-
name: 'ContextMenuItem — Basic',
|
|
8
|
-
displayName: 'ContextMenuItem — Basic',
|
|
9
|
-
description:
|
|
10
|
-
'Context menu items with labels and secondary descriptions. Use ContextMenuItem to render custom menu entries with consistent styling.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['ContextMenu', 'ContextMenuItem'],
|
|
14
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {ContextMenu, ContextMenuItem} from '@astryxdesign/core/ContextMenu';
|
|
6
|
-
|
|
7
|
-
export default function ContextMenuItemBasic() {
|
|
8
|
-
return (
|
|
9
|
-
<ContextMenu
|
|
10
|
-
menuContent={
|
|
11
|
-
<>
|
|
12
|
-
<ContextMenuItem
|
|
13
|
-
label="Edit"
|
|
14
|
-
description="Modify this item"
|
|
15
|
-
onClick={() => {}}
|
|
16
|
-
/>
|
|
17
|
-
<ContextMenuItem
|
|
18
|
-
label="Duplicate"
|
|
19
|
-
description="Create a copy"
|
|
20
|
-
onClick={() => {}}
|
|
21
|
-
/>
|
|
22
|
-
<ContextMenuItem
|
|
23
|
-
label="Delete"
|
|
24
|
-
description="This action cannot be undone"
|
|
25
|
-
onClick={() => {}}
|
|
26
|
-
/>
|
|
27
|
-
</>
|
|
28
|
-
}>
|
|
29
|
-
<div
|
|
30
|
-
style={{
|
|
31
|
-
padding: '48px',
|
|
32
|
-
borderWidth: '2px',
|
|
33
|
-
borderStyle: 'dashed',
|
|
34
|
-
borderColor: 'var(--color-border)',
|
|
35
|
-
borderRadius: '8px',
|
|
36
|
-
textAlign: 'center',
|
|
37
|
-
color: 'var(--color-text-secondary)',
|
|
38
|
-
userSelect: 'none',
|
|
39
|
-
}}>
|
|
40
|
-
Right-click this area
|
|
41
|
-
</div>
|
|
42
|
-
</ContextMenu>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'ContextMenuItem',
|
|
7
|
-
name: 'ContextMenuItem',
|
|
8
|
-
displayName: 'Context Menu Item',
|
|
9
|
-
description:
|
|
10
|
-
'Context menu with custom-rendered items using ContextMenuItem for icons and descriptions.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
isShowcase: true,
|
|
13
|
-
aspectRatio: 16 / 9,
|
|
14
|
-
componentsUsed: ['ContextMenu', 'ContextMenuItem'],
|
|
15
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {ContextMenu, ContextMenuItem} from '@astryxdesign/core/ContextMenu';
|
|
6
|
-
|
|
7
|
-
const PencilIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
8
|
-
<svg
|
|
9
|
-
viewBox="0 0 24 24"
|
|
10
|
-
fill="none"
|
|
11
|
-
stroke="currentColor"
|
|
12
|
-
strokeWidth={1.5}
|
|
13
|
-
strokeLinecap="round"
|
|
14
|
-
strokeLinejoin="round"
|
|
15
|
-
{...props}>
|
|
16
|
-
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
17
|
-
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
|
|
18
|
-
</svg>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const CopyIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
22
|
-
<svg
|
|
23
|
-
viewBox="0 0 24 24"
|
|
24
|
-
fill="none"
|
|
25
|
-
stroke="currentColor"
|
|
26
|
-
strokeWidth={1.5}
|
|
27
|
-
strokeLinecap="round"
|
|
28
|
-
strokeLinejoin="round"
|
|
29
|
-
{...props}>
|
|
30
|
-
<rect x="9" y="9" width="13" height="13" rx="2" />
|
|
31
|
-
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
32
|
-
</svg>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const ShareIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
36
|
-
<svg
|
|
37
|
-
viewBox="0 0 24 24"
|
|
38
|
-
fill="none"
|
|
39
|
-
stroke="currentColor"
|
|
40
|
-
strokeWidth={1.5}
|
|
41
|
-
strokeLinecap="round"
|
|
42
|
-
strokeLinejoin="round"
|
|
43
|
-
{...props}>
|
|
44
|
-
<circle cx="18" cy="5" r="3" />
|
|
45
|
-
<circle cx="6" cy="12" r="3" />
|
|
46
|
-
<circle cx="18" cy="19" r="3" />
|
|
47
|
-
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49" />
|
|
48
|
-
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
|
|
49
|
-
</svg>
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const TrashIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
53
|
-
<svg
|
|
54
|
-
viewBox="0 0 24 24"
|
|
55
|
-
fill="none"
|
|
56
|
-
stroke="currentColor"
|
|
57
|
-
strokeWidth={1.5}
|
|
58
|
-
strokeLinecap="round"
|
|
59
|
-
strokeLinejoin="round"
|
|
60
|
-
{...props}>
|
|
61
|
-
<polyline points="3 6 5 6 21 6" />
|
|
62
|
-
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
63
|
-
</svg>
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
export default function ContextMenuItemShowcase() {
|
|
67
|
-
return (
|
|
68
|
-
<ContextMenu
|
|
69
|
-
menuContent={
|
|
70
|
-
<>
|
|
71
|
-
<ContextMenuItem
|
|
72
|
-
icon={PencilIcon}
|
|
73
|
-
label="Edit"
|
|
74
|
-
description="Modify this item"
|
|
75
|
-
onClick={() => {}}
|
|
76
|
-
/>
|
|
77
|
-
<ContextMenuItem
|
|
78
|
-
icon={CopyIcon}
|
|
79
|
-
label="Duplicate"
|
|
80
|
-
description="Create a copy"
|
|
81
|
-
onClick={() => {}}
|
|
82
|
-
/>
|
|
83
|
-
<ContextMenuItem icon={ShareIcon} label="Share" onClick={() => {}} />
|
|
84
|
-
<ContextMenuItem
|
|
85
|
-
icon={TrashIcon}
|
|
86
|
-
label="Delete"
|
|
87
|
-
description="This action cannot be undone"
|
|
88
|
-
onClick={() => {}}
|
|
89
|
-
/>
|
|
90
|
-
</>
|
|
91
|
-
}>
|
|
92
|
-
<div
|
|
93
|
-
style={{
|
|
94
|
-
padding: '48px',
|
|
95
|
-
borderWidth: '2px',
|
|
96
|
-
borderStyle: 'dashed',
|
|
97
|
-
borderColor: 'var(--color-border)',
|
|
98
|
-
borderRadius: '8px',
|
|
99
|
-
textAlign: 'center',
|
|
100
|
-
color: 'var(--color-text-secondary)',
|
|
101
|
-
userSelect: 'none',
|
|
102
|
-
}}>
|
|
103
|
-
Right-click this area
|
|
104
|
-
</div>
|
|
105
|
-
</ContextMenu>
|
|
106
|
-
);
|
|
107
|
-
}
|