@wangs-ui/create-react-app 1.0.37 → 1.0.39

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/dist/bin.js CHANGED
@@ -7,6 +7,7 @@ import { styleText } from "node:util";
7
7
  import * as l from "node:readline";
8
8
  import l__default from "node:readline";
9
9
  import { ReadStream } from "node:tty";
10
+ import { execSync } from "node:child_process";
10
11
  //#region \0rolldown/runtime.js
11
12
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
12
13
  //#endregion
@@ -645,6 +646,23 @@ var V = class {
645
646
  }
646
647
  }
647
648
  };
649
+ var r = class extends V {
650
+ get cursor() {
651
+ return this.value ? 0 : 1;
652
+ }
653
+ get _value() {
654
+ return this.cursor === 0;
655
+ }
656
+ constructor(t) {
657
+ super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
658
+ this.value = this._value;
659
+ }), this.on("confirm", (i) => {
660
+ this.output.write(import_src.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
661
+ }), this.on("cursor", () => {
662
+ this.value = !this.value;
663
+ });
664
+ }
665
+ };
648
666
  var a = class extends V {
649
667
  options;
650
668
  cursor = 0;
@@ -812,6 +830,35 @@ var limitOptions = ({ cursor: l, options: e, style: w, output: p = process.stdou
812
830
  for (const t of s) for (const n of t) x.push(n);
813
831
  return c && x.push(M), x;
814
832
  };
833
+ var confirm = (i) => {
834
+ const a = i.active ?? "Yes", s = i.inactive ?? "No";
835
+ return new r({
836
+ active: a,
837
+ inactive: s,
838
+ signal: i.signal,
839
+ input: i.input,
840
+ output: i.output,
841
+ initialValue: i.initialValue ?? true,
842
+ render() {
843
+ const e = i.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = e ? `${styleText("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(i.output, i.message, l, u), o = `${e ? `${styleText("gray", S_BAR)}
844
+ ` : ""}${f}
845
+ `, c = this.value ? a : s;
846
+ switch (this.state) {
847
+ case "submit": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", c)}`;
848
+ case "cancel": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], c)}${e ? `
849
+ ${styleText("gray", S_BAR)}` : ""}`;
850
+ default: {
851
+ const r = e ? `${styleText("cyan", S_BAR)} ` : "", g = e ? styleText("cyan", S_BAR_END) : "";
852
+ return `${o}${r}${this.value ? `${styleText("green", S_RADIO_ACTIVE)} ${a}` : `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`}${i.vertical ? e ? `
853
+ ${styleText("cyan", S_BAR)} ` : `
854
+ ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", s)}` : `${styleText("green", S_RADIO_ACTIVE)} ${s}`}
855
+ ${g}
856
+ `;
857
+ }
858
+ }
859
+ }
860
+ }).prompt();
861
+ };
815
862
  var MULTISELECT_INSTRUCTIONS = [
816
863
  `${styleText("dim", "↑/↓")} to navigate`,
817
864
  `${styleText("dim", "Space:")} select`,
@@ -1122,46 +1169,106 @@ function copyProjectTemplate(options) {
1122
1169
  }
1123
1170
  }
1124
1171
  //#endregion
1125
- //#region ../skills/dist/src-DZa2DBdf.js
1172
+ //#region src/utils/git.ts
1173
+ function initGitRepository(targetDir) {
1174
+ try {
1175
+ if (fs.existsSync(path.join(targetDir, ".git"))) return false;
1176
+ try {
1177
+ execSync("git init -b main", {
1178
+ cwd: targetDir,
1179
+ stdio: "ignore"
1180
+ });
1181
+ } catch {
1182
+ execSync("git init", {
1183
+ cwd: targetDir,
1184
+ stdio: "ignore"
1185
+ });
1186
+ }
1187
+ } catch {
1188
+ return false;
1189
+ }
1190
+ try {
1191
+ execSync("git add -A", {
1192
+ cwd: targetDir,
1193
+ stdio: "ignore"
1194
+ });
1195
+ let hasAuthor = true;
1196
+ try {
1197
+ execSync("git config user.name", {
1198
+ cwd: targetDir,
1199
+ stdio: "ignore"
1200
+ });
1201
+ } catch {
1202
+ hasAuthor = false;
1203
+ }
1204
+ if (hasAuthor) execSync("git commit -m \"chore: initial commit from @wangs-ui/create-react-app\"", {
1205
+ cwd: targetDir,
1206
+ stdio: "ignore"
1207
+ });
1208
+ else execSync("git -c user.name=\"Wangs UI Scaffolder\" -c user.email=\"dev@wangs-ui.internal\" commit -m \"chore: initial commit from @wangs-ui/create-react-app\"", {
1209
+ cwd: targetDir,
1210
+ stdio: "ignore"
1211
+ });
1212
+ return true;
1213
+ } catch {
1214
+ return false;
1215
+ }
1216
+ }
1217
+ //#endregion
1218
+ //#region ../skills/dist/src-95qOyh-g.js
1219
+ var SKILL_default$5 = "---\nname: create-form\ndescription: Real-world patterns for building strongly-typed forms, multipart file uploads, server validation mapping, and dirty tracking with @wangs-ui/form.\n---\n\n# Skill: Real-World Form Workflows with `@wangs-ui/form`\n\nUse this skill when building CRUD forms, data entry dialogs, multi-field settings pages, or multipart forms in Wangs UI applications.\n\n---\n\n## 1. MCP Inspection Step (Before Building Fields)\n\nBefore implementing specific input controls, query the MCP server to inspect their exact prop signatures:\n\n- `get-documentation({ id: \"select\" })` — Check option formats (`{ label, value }` vs object).\n- `get-documentation({ id: \"datepicker\" })` — Check `selectionMode` (`single`, `range`, `multiple`) and date format props.\n- `get-documentation({ id: \"multiselect\" })` — Check chips display and filter behavior.\n- `get-documentation({ id: \"fileupload\" })` — Check accepted mime types and upload handlers.\n\n---\n\n## 2. Recipe 1: Standard CRUD Form with Server Validation Mapping\n\nReal-world forms must handle async submission, loading state, and map backend validation errors back into `<Field>` errors:\n\n```tsx\nimport React, { useState } from 'react';\nimport Card from '@wangs-ui/react-core/primitive/card';\nimport Button from '@wangs-ui/react-core/primitive/button';\nimport InputText from '@wangs-ui/react-core/primitive/inputtext';\nimport Select from '@wangs-ui/react-core/primitive/select';\nimport { Form, Field } from '@wangs-ui/react-core';\nimport { useFormControl } from '@wangs-ui/form';\nimport { useI18n } from '@wangs-ui/react-i18n';\n\ninterface UserFormValues {\n fullName: string;\n email: string;\n role: string;\n}\n\nexport default function UserForm({ onSuccess }: { onSuccess?: () => void }) {\n const { t } = useI18n();\n const formControl = useFormControl<UserFormValues>({ type: 'json' });\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n const roleOptions = [\n { label: t('Administrator'), value: 'admin' },\n { label: t('Operator'), value: 'operator' },\n { label: t('Viewer'), value: 'viewer' },\n ];\n\n const handleSubmit = async (values: UserFormValues) => {\n setIsSubmitting(true);\n try {\n // Execute API call: await api.createUser(values);\n onSuccess?.();\n } catch (err: any) {\n // Map server validation error directly to field\n if (err?.fieldErrors?.email) {\n formControl.setError('email', {\n type: 'server',\n message: err.fieldErrors.email,\n });\n }\n } finally {\n setIsSubmitting(false);\n }\n };\n\n return (\n <Card className=\"p-6\">\n <Form control={formControl} onSubmit={handleSubmit} className=\"flex flex-col gap-m\">\n <h2 className=\"heading-2\">{t('User Information')}</h2>\n\n {/* Text Field */}\n <Field<string>\n name=\"fullName\"\n label={t('Full Name')}\n required\n rules={{ required: t('Full name is required') }}\n >\n {(field) => (\n <InputText {...field} placeholder={t('e.g. Jane Doe')} value={field.value || ''} />\n )}\n </Field>\n\n {/* Email Field with Regex Validation */}\n <Field<string>\n name=\"email\"\n label={t('Email Address')}\n required\n rules={{\n required: t('Email is required'),\n pattern: {\n value: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n message: t('Enter a valid email address'),\n },\n }}\n >\n {(field) => (\n <InputText {...field} placeholder={t('name@company.com')} value={field.value || ''} />\n )}\n </Field>\n\n {/* Select Dropdown Field */}\n <Field<string>\n name=\"role\"\n label={t('Access Role')}\n required\n rules={{ required: t('Role selection is required') }}\n >\n {(field) => (\n <Select\n {...field}\n options={roleOptions}\n placeholder={t('Select role')}\n value={field.value}\n onChange={(e) => field.onChange(e.value)}\n />\n )}\n </Field>\n\n {/* Form Actions */}\n <div className=\"flex justify-end gap-s pt-s\">\n <Button\n type=\"button\"\n variant=\"text\"\n label={t('Reset')}\n onClick={() => formControl.reset()}\n disabled={isSubmitting}\n />\n <Button type=\"submit\" label={t('Save User')} severity=\"primary\" loading={isSubmitting} />\n </div>\n </Form>\n </Card>\n );\n}\n```\n\n---\n\n## 3. Recipe 2: Multipart Form (File Upload + Metadata)\n\nFor file uploads (avatar, attachment, documents), set `type: 'formdata'`:\n\n```tsx\nimport { useFormControl } from '@wangs-ui/form';\n\ninterface ProfileUploadValues {\n displayName: string;\n avatar: File | null;\n}\n\n// Generates FormData under the hood\nconst formControl = useFormControl<ProfileUploadValues>({ type: 'formdata' });\n```\n\n---\n\n## 4. Key Implementation Rules\n\n1. **Always Use `<Form>` & `<Field>`**: Never bind raw uncontrolled inputs.\n2. **Translate All Labels & Error Messages**: Wrap text in `t('...')`.\n3. **Handle Loading State**: Disable reset buttons and set `loading={isSubmitting}` on submit buttons.\n";
1220
+ var SKILL_default$4 = "---\nname: data-table\ndescription: Real-world patterns for building full CRUD DataTables with server pagination, search filters, batch actions, and confirmation modals.\n---\n\n# Skill: Real-World DataTable & Filter Workflows\n\nUse this skill when building administrative grids, filtered listing pages, or management dashboards with `@wangs-ui/react-core`.\n\n---\n\n## 1. MCP Inspection Step (Before Building Table)\n\nQuery the MCP server to inspect supported features and slots:\n\n- `get-documentation({ id: \"datatable\" })` — Check `paginator`, `lazy`, `onPage`, `onSort`, `selectionMode`, and `dataKey`.\n- `get-documentation({ id: \"column\" })` — Check `body` template, `sortable`, `frozen`, and `headerStyle`.\n- `get-documentation({ id: \"tag\" })` — Check severity colors for status pill badges (`success`, `warning`, `danger`, `info`).\n\n---\n\n## 2. Recipe: Full CRUD Data Grid with Filter Toolbar & Batch Actions\n\n```tsx\nimport React, { useState } from 'react';\nimport DataTable, { Column } from '@wangs-ui/react-core/primitive/datatable';\nimport Button from '@wangs-ui/react-core/primitive/button';\nimport InputText from '@wangs-ui/react-core/primitive/inputtext';\nimport Select from '@wangs-ui/react-core/primitive/select';\nimport Tag from '@wangs-ui/react-core/primitive/tag';\nimport Dialog from '@wangs-ui/react-core/primitive/dialog';\nimport Card from '@wangs-ui/react-core/primitive/card';\nimport { useI18n } from '@wangs-ui/react-i18n';\nimport { SearchLine, DeleteBin6Line, EditLine, AddLine } from '@wangs-ui/react-icons';\n\ninterface CustomerRecord {\n id: string;\n name: string;\n email: string;\n status: 'active' | 'pending' | 'suspended';\n createdAt: string;\n}\n\nexport default function CustomerManagementView() {\n const { t } = useI18n();\n const [records, setRecords] = useState<CustomerRecord[]>([]);\n const [loading, setLoading] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [selectedStatus, setSelectedStatus] = useState<string | null>(null);\n const [selectedRows, setSelectedRows] = useState<CustomerRecord[]>([]);\n const [deleteTarget, setDeleteTarget] = useState<CustomerRecord | null>(null);\n\n // Status Badge Template\n const statusTemplate = (row: CustomerRecord) => {\n const severityMap: Record<string, 'success' | 'warning' | 'danger'> = {\n active: 'success',\n pending: 'warning',\n suspended: 'danger',\n };\n return <Tag value={t(row.status)} severity={severityMap[row.status] || 'info'} />;\n };\n\n // Row Actions Template\n const actionsTemplate = (row: CustomerRecord) => (\n <div className=\"flex items-center gap-xs\">\n <Button\n variant=\"text\"\n icon={<EditLine />}\n aria-label={t('Edit')}\n onClick={() => console.log('Edit', row.id)}\n />\n <Button\n variant=\"text\"\n severity=\"danger\"\n icon={<DeleteBin6Line />}\n aria-label={t('Delete')}\n onClick={() => setDeleteTarget(row)}\n />\n </div>\n );\n\n return (\n <Card className=\"flex flex-col gap-m p-6\">\n {/* 1. Filter & Search Toolbar */}\n <div className=\"flex flex-wrap items-center justify-between gap-s\">\n <div className=\"flex flex-wrap items-center gap-s\">\n <InputText\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder={t('Search customer...')}\n className=\"w-64\"\n />\n <Select\n value={selectedStatus}\n options={[\n { label: t('All Statuses'), value: null },\n { label: t('Active'), value: 'active' },\n { label: t('Pending'), value: 'pending' },\n { label: t('Suspended'), value: 'suspended' },\n ]}\n onChange={(e) => setSelectedStatus(e.value)}\n placeholder={t('Filter status')}\n />\n </div>\n\n <Button label={t('Add Customer')} icon={<AddLine />} severity=\"primary\" />\n </div>\n\n {/* 2. Batch Selection Action Bar */}\n {selectedRows.length > 0 && (\n <div className=\"flex items-center justify-between rounded bg-primary-50 px-4 py-2 text-primary-900\">\n <span className=\"p font-medium\">\n {t('{{count}} items selected', { count: selectedRows.length })}\n </span>\n <Button\n size=\"small\"\n severity=\"danger\"\n label={t('Delete Selected')}\n icon={<DeleteBin6Line />}\n onClick={() => console.log('Batch delete', selectedRows)}\n />\n </div>\n )}\n\n {/* 3. Paginated DataTable */}\n <DataTable\n value={records}\n loading={loading}\n selection={selectedRows}\n onSelectionChange={(e) => setSelectedRows(e.value)}\n dataKey=\"id\"\n paginator\n rows={10}\n rowsPerPageOptions={[10, 25, 50]}\n emptyMessage={t('No customers found')}\n >\n <Column selectionMode=\"multiple\" headerStyle={{ width: '3rem' }} />\n <Column field=\"name\" header={t('Customer Name')} sortable />\n <Column field=\"email\" header={t('Email')} sortable />\n <Column field=\"status\" header={t('Status')} body={statusTemplate} sortable />\n <Column header={t('Actions')} body={actionsTemplate} headerStyle={{ width: '6rem' }} />\n </DataTable>\n\n {/* 4. Delete Confirmation Dialog */}\n <Dialog\n visible={!!deleteTarget}\n onHide={() => setDeleteTarget(null)}\n header={t('Delete Customer')}\n footer={\n <div className=\"flex justify-end gap-xs\">\n <Button variant=\"text\" label={t('Cancel')} onClick={() => setDeleteTarget(null)} />\n <Button\n severity=\"danger\"\n label={t('Delete')}\n onClick={() => {\n // Execute delete API\n setDeleteTarget(null);\n }}\n />\n </div>\n }\n >\n <p className=\"p\">\n {t('Are you sure you want to delete {{name}}?', { name: deleteTarget?.name })}\n </p>\n </Dialog>\n </Card>\n );\n}\n```\n\n---\n\n## 3. Mandatory Best Practices\n\n1. **Always Supply `dataKey`**: Never enable row selection without `dataKey=\"id\"`.\n2. **Translate All Headers & Messages**: Pass table headers and empty state messages into `t()`.\n3. **Control Batch Action Appearance**: Show batch action banner only when `selectedRows.length > 0`.\n";
1221
+ var SKILL_default$3 = "---\nname: dialog-modal\ndescription: Real-world patterns for modal forms, async confirmation workflows, and multi-step dialogs with Wangs UI Dialog and Modal components.\n---\n\n# Skill: Real-World Dialog & Modal Workflows\n\nUse this skill when building interactive modals, create/edit modal forms, destructive action confirmations, or slide-in overlay panels.\n\n---\n\n## 1. MCP Inspection Step (Before Implementing Overlays)\n\nQuery the MCP server to check overlay configuration and animation options:\n\n- `get-documentation({ id: \"dialog\" })` — Check `header`, `footer`, `visible`, `onHide`, `modal`, and `dismissableMask`.\n- `get-documentation({ id: \"modal\" })` — Check fullscreen modes, size variants, and slide-in drawer options.\n- `get-documentation({ id: \"toast\" })` — Check severity toasts (`success`, `error`, `info`, `warn`) to trigger after modal actions.\n\n---\n\n## 2. Recipe: Create/Edit Form inside a Modal Dialog\n\nThis real-world recipe coordinates a modal wrapper with an embedded `@wangs-ui/form`, handles saving state, prevents accidental dismiss while saving, and resets state upon close:\n\n```tsx\nimport React, { useState, useEffect } from 'react';\nimport Dialog from '@wangs-ui/react-core/primitive/dialog';\nimport Button from '@wangs-ui/react-core/primitive/button';\nimport InputText from '@wangs-ui/react-core/primitive/inputtext';\nimport { Form, Field } from '@wangs-ui/react-core';\nimport { useFormControl } from '@wangs-ui/form';\nimport { useI18n } from '@wangs-ui/react-i18n';\n\ninterface EditItemModel {\n title: string;\n code: string;\n}\n\ninterface ItemModalProps {\n visible: boolean;\n item?: EditItemModel | null;\n onHide: () => void;\n onSaved: (item: EditItemModel) => void;\n}\n\nexport default function ItemFormModal({ visible, item, onHide, onSaved }: ItemModalProps) {\n const { t } = useI18n();\n const formControl = useFormControl<EditItemModel>({ type: 'json' });\n const [saving, setSaving] = useState(false);\n\n // Sync form values when modal opens or item changes\n useEffect(() => {\n if (visible) {\n formControl.reset(item || { title: '', code: '' });\n }\n }, [visible, item]);\n\n const handleFormSubmit = async (values: EditItemModel) => {\n setSaving(true);\n try {\n // Execute API call: await api.save(values);\n onSaved(values);\n onHide();\n } finally {\n setSaving(false);\n }\n };\n\n const footerActions = (\n <div className=\"flex justify-end gap-xs\">\n <Button type=\"button\" variant=\"text\" label={t('Cancel')} onClick={onHide} disabled={saving} />\n <Button\n type=\"submit\"\n form=\"modal-item-form\"\n label={item ? t('Save Changes') : t('Create Item')}\n severity=\"primary\"\n loading={saving}\n />\n </div>\n );\n\n return (\n <Dialog\n visible={visible}\n onHide={() => !saving && onHide()}\n header={item ? t('Edit Item') : t('New Item')}\n footer={footerActions}\n style={{ width: '450px' }}\n modal\n >\n <Form\n id=\"modal-item-form\"\n control={formControl}\n onSubmit={handleFormSubmit}\n className=\"flex flex-col gap-m pt-xs\"\n >\n <Field<string>\n name=\"title\"\n label={t('Item Title')}\n required\n rules={{ required: t('Title is required') }}\n >\n {(field) => (\n <InputText {...field} placeholder={t('Enter title')} value={field.value || ''} />\n )}\n </Field>\n\n <Field<string>\n name=\"code\"\n label={t('Item Code')}\n required\n rules={{ required: t('Code is required') }}\n >\n {(field) => (\n <InputText {...field} placeholder={t('e.g. SKU-100')} value={field.value || ''} />\n )}\n </Field>\n </Form>\n </Dialog>\n );\n}\n```\n\n---\n\n## 3. Mandatory Best Practices\n\n1. **Decouple Submit Button from Form Body**: Use `form=\"modal-item-form\"` on the submit button inside `footer` so actions stay neatly aligned in the footer bar.\n2. **Prevent Close During Mutation**: Guard `onHide={() => !saving && onHide()}` to prevent accidental dismissal during in-flight network requests.\n3. **Always Reset on Open**: Sync initial values in an effect keyed on `visible`.\n";
1222
+ var SKILL_default$2 = "---\nname: i18n-usage\ndescription: Real-world internationalization, currency formatting, localized date pickers, and plural interpolation with @wangs-ui/react-i18n.\n---\n\n# Skill: Application Internationalization & Formatting\n\nUse this skill when handling multi-language UI, currency inputs, localized dates, or dynamic sentence translations.\n\n---\n\n## 1. MCP Inspection Step (Before Localizing Complex Components)\n\nQuery the MCP server to inspect component-specific localization props:\n\n- `get-documentation({ id: \"currencyinput\" })` — Check currency prefix, locale formatting, and min/max constraints.\n- `get-documentation({ id: \"datepicker\" })` — Check month/day names, firstDayOfWeek, and dateFormat options.\n- `get-documentation({ id: \"languageswitcher\" })` — Check language picker dropdown variants.\n\n---\n\n## 2. Recipe: Localized Currency, Date, and Pluralization Flow\n\n```tsx\nimport React, { useState } from 'react';\nimport Card from '@wangs-ui/react-core/primitive/card';\nimport CurrencyInput from '@wangs-ui/react-core/primitive/currencyinput';\nimport DatePicker from '@wangs-ui/react-core/primitive/datepicker';\nimport { useI18n } from '@wangs-ui/react-i18n';\n\nexport default function InvoiceSummary() {\n const { t, currentLocale, setLocale } = useI18n();\n const [amount, setAmount] = useState<number | null>(1500000);\n const [dueDate, setDueDate] = useState<Date | null>(new Date());\n const itemCount = 5;\n\n return (\n <Card className=\"flex flex-col gap-m p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"heading-2\">{t('Invoice Summary')}</h2>\n {/* Language selector toggle */}\n <button\n className=\"text-primary-600 underline text-sm\"\n onClick={() => setLocale(currentLocale === 'en' ? 'id' : 'en')}\n >\n {currentLocale === 'en' ? 'Bahasa Indonesia' : 'English'}\n </button>\n </div>\n\n {/* 1. Currency Formatting Input */}\n <div className=\"flex flex-col gap-xs\">\n <label className=\"heading-4\">{t('Total Amount')}</label>\n <CurrencyInput\n value={amount}\n onValueChange={(e) => setAmount(e.value ?? null)}\n currency={currentLocale === 'id' ? 'IDR' : 'USD'}\n locale={currentLocale === 'id' ? 'id-ID' : 'en-US'}\n />\n </div>\n\n {/* 2. Localized Date Picker */}\n <div className=\"flex flex-col gap-xs\">\n <label className=\"heading-4\">{t('Payment Due Date')}</label>\n <DatePicker\n value={dueDate}\n onChange={(e) => setDueDate(e.value as Date)}\n dateFormat={currentLocale === 'id' ? 'dd/mm/yy' : 'mm/dd/yy'}\n showIcon\n />\n </div>\n\n {/* 3. Parameterized Translation */}\n <p className=\"p text-secondary-600\">\n {t('Invoice includes {{count}} billed line items.', { count: itemCount })}\n </p>\n </Card>\n );\n}\n```\n\n---\n\n## 3. Mandatory Translation Rules\n\n1. **Sentence Keys in Natural English**: Always write `t('Invoice Summary')` instead of artificial dotted paths like `t('invoice.summary.title')`.\n2. **Dynamic Variables in Double Braces**: Always use `t('Hello, {{name}}', { name })`.\n3. **No Concatenation**: Never write `t('Total:') + ' ' + total`. Use `t('Total: {{total}}', { total })`.\n";
1223
+ var SKILL_default$1 = "---\nname: layout-navigation\ndescription: Guidelines and patterns for page layout, sidebar navigation, breadcrumbs, and tabs using Wangs UI layout blocks.\n---\n\n# Skill: Layout & Navigation Structure\n\nUse this skill when constructing application shells, multi-level sidebars, page headers, breadcrumbs, or tabbed views with `@wangs-ui/react-core`.\n\n---\n\n## 1. App Shell Pattern\n\n```tsx\nimport React from 'react';\nimport AppLayout from '@wangs-ui/react-core/blocks/applayout';\nimport Sidebar from '@wangs-ui/react-core/blocks/sidebar';\nimport Breadcrumb from '@wangs-ui/react-core/primitive/breadcrumb';\nimport { HomeLine, UserLine, SettingsLine } from '@wangs-ui/react-icons';\nimport { useI18n } from '@wangs-ui/react-i18n';\n\nexport default function MainAppShell({ children }: { children: React.ReactNode }) {\n const { t } = useI18n();\n\n const navigationItems = [\n { label: t('Dashboard'), icon: <HomeLine />, href: '/dashboard' },\n { label: t('Users'), icon: <UserLine />, href: '/users' },\n { label: t('Settings'), icon: <SettingsLine />, href: '/settings' },\n ];\n\n return (\n <AppLayout\n sidebar={<Sidebar items={navigationItems} />}\n header={\n <header className=\"flex h-14 items-center justify-between border-b border-secondary-200 px-6\">\n <Breadcrumb model={[{ label: t('Home') }, { label: t('Dashboard') }]} />\n </header>\n }\n >\n <main className=\"p-6\">{children}</main>\n </AppLayout>\n );\n}\n```\n\n---\n\n## 2. Best Practices\n\n1. **Page Title & Breadcrumb Alignment**:\n Every page view inside the layout should provide clear `.heading-1` hierarchy and synchronized breadcrumbs.\n2. **Spacing Grid Consistency**:\n Use consistent outer container padding (`p-6` / `p-xxl`) across views.\n3. **Tabbed Subviews**:\n When separating complex forms or detail views, use `<Tabs>` component with controlled tab index.\n\n---\n\n## 3. MCP Navigation & Block Inspection\n\nTo inspect complete navigation options, badge counters, collapsible sidebars, or responsive header controls:\n\n- Call MCP tool `get-documentation({ id: \"sidebar\" })` or `get-documentation({ id: \"breadcrumb\" })` to view full configuration options and live stories.\n";
1224
+ var SKILL_default = "---\nname: wangs-ui-components\ndescription: Foundational rules, subpath imports, design tokens, and the MCP Discovery Protocol for building React apps with Wangs UI.\n---\n\n# Skill: Wangs UI Component Fundamentals & MCP Protocol\n\nUse this skill whenever you write or modify UI components using Wangs UI (`@wangs-ui/react-core`, `@wangs-ui/react-icons`, `@wangs-ui/react-presets`).\n\n---\n\n## 1. The MCP Discovery Protocol (Mandatory Before Writing Code)\n\nDo **NOT** guess component props, Pass-Through (`pt`) slots, or event names. Follow this discovery protocol:\n\n```mermaid\ngraph TD\n A[Identify Component Needed] --> B[Call get-documentation id]\n B --> C{Need live story / variant?}\n C -->|Yes| D[Call get-documentation-for-story]\n C -->|No| E[Check Graphify: query_graph]\n D --> E\n E --> F[Implement Component with Subpath Imports]\n```\n\n1. **Step 1: Inspect Props & Types**:\n Call `get-documentation({ id: \"<component-name>\" })` (e.g. `button`, `inputtext`, `datatable`) to get the exact prop interfaces, severity variants, and sizes.\n2. **Step 2: Inspect Live Usage & Slots**:\n Call `get-documentation-for-story({ id: \"<component-name>\", storyName: \"<variant>\" })` to view how props, icons, and pass-through (`pt`) classes are composed in real code.\n3. **Step 3: Inspect Codebase Relationships**:\n Call `query_graph({ query: \"<ComponentName>\" })` to see how other parts of the monorepo compose this component.\n\n---\n\n## 2. Subpath Modular Imports (Mandatory)\n\nAlways import via specific subpaths to guarantee tree-shaking and avoid bundling entire packages:\n\n```tsx\n// Primitives\nimport Button from '@wangs-ui/react-core/primitive/button';\nimport Card from '@wangs-ui/react-core/primitive/card';\nimport InputText from '@wangs-ui/react-core/primitive/inputtext';\nimport Select from '@wangs-ui/react-core/primitive/select';\nimport Tag from '@wangs-ui/react-core/primitive/tag';\n\n// Providers & Hooks\nimport { WangsUiProvider } from '@wangs-ui/react-core/api';\nimport { useI18n } from '@wangs-ui/react-i18n';\n\n// Icons\nimport { SearchLine, AddLine, DeleteBin6Line, CheckLine } from '@wangs-ui/react-icons';\n```\n\n---\n\n## 3. Strict Primitive Substitution Rule\n\nNever write raw HTML when a Wangs UI primitive exists:\n\n| Forbidden Raw HTML | Mandatory Wangs UI Component | Subpath Import |\n| :------------------------ | :--------------------------- | :------------------------------------------- |\n| `<button>` | `Button` | `@wangs-ui/react-core/primitive/button` |\n| `<input type=\"text\">` | `InputText` | `@wangs-ui/react-core/primitive/inputtext` |\n| `<input type=\"number\">` | `InputNumber` | `@wangs-ui/react-core/primitive/inputnumber` |\n| `<input type=\"checkbox\">` | `Checkbox` | `@wangs-ui/react-core/primitive/checkbox` |\n| `<select>` | `Select` | `@wangs-ui/react-core/primitive/select` |\n| `<dialog>` / modal | `Dialog` / `Modal` | `@wangs-ui/react-core/primitive/dialog` |\n| `<table>` | `DataTable` | `@wangs-ui/react-core/primitive/datatable` |\n| Container box | `Card` | `@wangs-ui/react-core/primitive/card` |\n| Pill badge | `Tag` / `Badge` | `@wangs-ui/react-core/primitive/tag` |\n\n---\n\n## 4. Typography Scale & 4px Spacing Tokens\n\n### Typography Helper Classes\n\n- `.heading-1` — Page title (22px, 600)\n- `.heading-2` — Section / Card title (18px, 600)\n- `.heading-3` — Sub-header (16px, 500)\n- `.heading-4` — Field label (14px, 500)\n- `.heading-5` — Small group header (12px, 600)\n- `.p` — Body copy (12px, 500)\n\n### 4px Spacing Tokens\n\n- Gap: `gap-xs` (4px), `gap-s` (6px), `gap-md` (8px), `gap-m` (12px), `gap-l` (16px), `gap-xl` (20px), `gap-xxl` (24px)\n- Padding: `p-xs`, `p-s`, `p-md`, `p-m`, `p-l`, `p-xl`, `p-xxl`\n";
1126
1225
  var __dirname$1 = path.dirname(fileURLToPath(import.meta.url));
1127
- function getSkillsDir() {
1226
+ var EMBEDDED_SKILLS_RAW = {
1227
+ "create-form": SKILL_default$5,
1228
+ "data-table": SKILL_default$4,
1229
+ "dialog-modal": SKILL_default$3,
1230
+ "i18n-usage": SKILL_default$2,
1231
+ "layout-navigation": SKILL_default$1,
1232
+ "wangs-ui-components": SKILL_default
1233
+ };
1234
+ function parseSkillContent(id, content) {
1235
+ let name = id;
1236
+ let description = "Wangs UI consumer skill";
1237
+ const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n/);
1238
+ if (frontmatterMatch) {
1239
+ const fm = frontmatterMatch[1];
1240
+ const nameMatch = fm.match(/^name:\s*(.+)$/m);
1241
+ const descMatch = fm.match(/^description:\s*(.+)$/m);
1242
+ if (nameMatch) name = nameMatch[1].trim();
1243
+ if (descMatch) description = descMatch[1].trim();
1244
+ }
1245
+ return {
1246
+ id,
1247
+ name,
1248
+ description,
1249
+ content
1250
+ };
1251
+ }
1252
+ function loadAllSkills() {
1253
+ if (Object.keys(EMBEDDED_SKILLS_RAW).length > 0) return Object.entries(EMBEDDED_SKILLS_RAW).map(([id, content]) => parseSkillContent(id, content));
1128
1254
  const candidates = [
1129
1255
  path.resolve(__dirname$1, "skills"),
1130
1256
  path.resolve(__dirname$1, "../skills"),
1131
1257
  path.resolve(__dirname$1, "../../skills")
1132
1258
  ];
1133
- for (const c of candidates) if (fs.existsSync(c)) return c;
1134
- return path.resolve(__dirname$1, "skills");
1135
- }
1136
- function loadAllSkills() {
1137
- const skillsDir = getSkillsDir();
1138
- if (!fs.existsSync(skillsDir)) return [];
1139
- const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
1140
- const skills = [];
1141
- for (const entry of entries) if (entry.isDirectory()) {
1142
- const skillMdPath = path.join(skillsDir, entry.name, "SKILL.md");
1143
- if (fs.existsSync(skillMdPath)) {
1144
- const content = fs.readFileSync(skillMdPath, "utf-8");
1145
- const { name: entryName } = entry;
1146
- let name = entryName;
1147
- let description = "Wangs UI consumer skill";
1148
- const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n/);
1149
- if (frontmatterMatch) {
1150
- const fm = frontmatterMatch[1];
1151
- const nameMatch = fm.match(/^name:\s*(.+)$/m);
1152
- const descMatch = fm.match(/^description:\s*(.+)$/m);
1153
- if (nameMatch) name = nameMatch[1].trim();
1154
- if (descMatch) description = descMatch[1].trim();
1259
+ for (const skillsDir of candidates) if (fs.existsSync(skillsDir)) {
1260
+ const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
1261
+ const skills = [];
1262
+ for (const entry of entries) if (entry.isDirectory()) {
1263
+ const skillMdPath = path.join(skillsDir, entry.name, "SKILL.md");
1264
+ if (fs.existsSync(skillMdPath)) {
1265
+ const content = fs.readFileSync(skillMdPath, "utf-8");
1266
+ skills.push(parseSkillContent(entry.name, content));
1155
1267
  }
1156
- skills.push({
1157
- id: entry.name,
1158
- name,
1159
- description,
1160
- content
1161
- });
1162
1268
  }
1269
+ if (skills.length > 0) return skills;
1163
1270
  }
1164
- return skills;
1271
+ return [];
1165
1272
  }
1166
1273
  function getAgentSkillDirs(baseDir = process.cwd()) {
1167
1274
  const dirs = [];
@@ -1190,7 +1297,7 @@ function installSkill(skill, baseDir = process.cwd()) {
1190
1297
  //#endregion
1191
1298
  //#region src/utils/mcpInstaller.ts
1192
1299
  function setupAgentConfigurations(options) {
1193
- const { targetDir, templateDir, agents } = options;
1300
+ const { targetDir, templateDir, agents, skills } = options;
1194
1301
  const configuredAgents = [];
1195
1302
  const agentsTemplateDir = path.join(templateDir, "agents");
1196
1303
  const agentsMdSrc = path.join(agentsTemplateDir, "AGENTS.md");
@@ -1234,8 +1341,9 @@ function setupAgentConfigurations(options) {
1234
1341
  configuredAgents.push("Antigravity IDE & CLI (.agents/mcp_config.json)");
1235
1342
  }
1236
1343
  const allSkills = loadAllSkills();
1237
- for (const skill of allSkills) installSkill(skill, targetDir);
1238
- if (allSkills.length > 0) configuredAgents.push(`Wangs UI Consumer Skills (${allSkills.map((s) => s.id).join(", ")})`);
1344
+ const selectedSkills = skills !== void 0 ? allSkills.filter((s) => skills.includes(s.id)) : allSkills;
1345
+ for (const skill of selectedSkills) installSkill(skill, targetDir);
1346
+ if (selectedSkills.length > 0) configuredAgents.push(`Wangs UI Consumer Skills (${selectedSkills.map((s) => s.id).join(", ")})`);
1239
1347
  return configuredAgents;
1240
1348
  }
1241
1349
  //#endregion
@@ -1270,7 +1378,7 @@ function getRunCommand(pm, script) {
1270
1378
  //#region src/index.ts
1271
1379
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
1272
1380
  function generateProject(options) {
1273
- const { projectName, targetDir, preset, agents } = options;
1381
+ const { projectName, targetDir, preset, agents, skills, git } = options;
1274
1382
  let templateDir = path.resolve(__dirname, "../template");
1275
1383
  if (!fs.existsSync(templateDir)) templateDir = path.resolve(__dirname, "template");
1276
1384
  const s = spinner();
@@ -1290,15 +1398,19 @@ function generateProject(options) {
1290
1398
  if (agents.length > 0) configuredAgents = setupAgentConfigurations({
1291
1399
  targetDir,
1292
1400
  templateDir,
1293
- agents
1401
+ agents,
1402
+ skills
1294
1403
  });
1404
+ let gitInitialized = false;
1405
+ if (git !== false) gitInitialized = initGitRepository(targetDir);
1295
1406
  s.stop("Project structure initialized.");
1296
1407
  const pm = detectPackageManager();
1297
1408
  const installCmd = getInstallCommand(pm);
1298
1409
  const devCmd = getRunCommand(pm, "dev");
1299
1410
  const lintCmd = getRunCommand(pm, "lint");
1300
- if (configuredAgents.length > 0) {
1301
- console.log("\n\x1B[1m🤖 AI Agent MCP & Skills Configured:\x1B[0m");
1411
+ if (configuredAgents.length > 0 || gitInitialized) {
1412
+ console.log("\n\x1B[1m Setup Highlights:\x1B[0m");
1413
+ if (gitInitialized) console.log(" \x1B[32m✔\x1B[0m Git repository initialized (initial commit created)");
1302
1414
  for (const agent of configuredAgents) console.log(` \x1b[32m✔\x1b[0m ${agent}`);
1303
1415
  }
1304
1416
  outro(`\x1b[32m✨ Project created successfully!\x1b[0m\n\n\x1b[1mNext steps:\x1b[0m\n ${targetDir === process.cwd() ? "" : `cd ${path.relative(process.cwd(), targetDir)}\n `}${installCmd}\n ${devCmd}\n ${lintCmd} \x1b[2m(runs Oxlint)\x1b[0m`);
@@ -1306,7 +1418,8 @@ function generateProject(options) {
1306
1418
  //#endregion
1307
1419
  //#region src/prompts.ts
1308
1420
  async function promptUser(initialOptions) {
1309
- let { projectName, preset, agents } = initialOptions;
1421
+ let { projectName, preset, agents, skills, git } = initialOptions;
1422
+ const allSkills = loadAllSkills();
1310
1423
  if (initialOptions.yes) return {
1311
1424
  projectName: projectName || "my-wangs-app",
1312
1425
  preset: "fixedasset",
@@ -1315,9 +1428,11 @@ async function promptUser(initialOptions) {
1315
1428
  "opencode",
1316
1429
  "claude",
1317
1430
  "kilo"
1318
- ]
1431
+ ],
1432
+ skills: skills || allSkills.map((s) => s.id),
1433
+ git: git !== void 0 ? git : true
1319
1434
  };
1320
- intro(`\x1b[36m🚀 Wangs UI React App Scaffolder\x1b[0m (v1.0.37)`);
1435
+ intro(`\x1b[36m🚀 Wangs UI React App Scaffolder\x1b[0m (v1.0.39)`);
1321
1436
  if (!projectName) {
1322
1437
  const nameResponse = await text({
1323
1438
  message: "What is your project name?",
@@ -1390,10 +1505,40 @@ async function promptUser(initialOptions) {
1390
1505
  }
1391
1506
  agents = agentsResponse;
1392
1507
  }
1508
+ if (!skills && agents.length > 0 && allSkills.length > 0) {
1509
+ const skillsResponse = await multiselect({
1510
+ message: "Select Wangs UI AI Skills to install: (Space to select/deselect, Enter to submit)",
1511
+ options: allSkills.map((s) => ({
1512
+ value: s.id,
1513
+ label: s.id,
1514
+ hint: s.description
1515
+ })),
1516
+ initialValues: allSkills.map((s) => s.id),
1517
+ required: false
1518
+ });
1519
+ if (isCancel(skillsResponse)) {
1520
+ cancel("Project scaffolding cancelled.");
1521
+ process$1.exit(0);
1522
+ }
1523
+ skills = skillsResponse;
1524
+ }
1525
+ if (git === void 0) {
1526
+ const gitResponse = await confirm({
1527
+ message: "Initialize a new git repository and create initial commit?",
1528
+ initialValue: true
1529
+ });
1530
+ if (isCancel(gitResponse)) {
1531
+ cancel("Project scaffolding cancelled.");
1532
+ process$1.exit(0);
1533
+ }
1534
+ git = Boolean(gitResponse);
1535
+ }
1393
1536
  return {
1394
1537
  projectName,
1395
1538
  preset: "fixedasset",
1396
- agents
1539
+ agents,
1540
+ skills: skills || allSkills.map((s) => s.id),
1541
+ git: Boolean(git)
1397
1542
  };
1398
1543
  }
1399
1544
  //#endregion
@@ -1440,15 +1585,29 @@ async function main() {
1440
1585
  "claude",
1441
1586
  "antigravity"
1442
1587
  ].includes(a));
1443
- } else if (!arg.startsWith("-") && !options.projectName) options.projectName = arg;
1588
+ } else if (arg.startsWith("--skill=") || arg.startsWith("--skills=")) {
1589
+ const val = arg.split("=")[1];
1590
+ if (val === "all") options.skills = void 0;
1591
+ else if (val === "none") options.skills = [];
1592
+ else options.skills = val.split(",").map((s) => s.trim()).filter(Boolean);
1593
+ } else if ((arg === "--skill" || arg === "--skills") && args[i + 1]) {
1594
+ const val = args[++i];
1595
+ if (val === "all") options.skills = void 0;
1596
+ else if (val === "none") options.skills = [];
1597
+ else options.skills = val.split(",").map((s) => s.trim()).filter(Boolean);
1598
+ } else if (arg === "--git" || arg === "--git=true") options.git = true;
1599
+ else if (arg === "--no-git" || arg === "--git=false") options.git = false;
1600
+ else if (!arg.startsWith("-") && !options.projectName) options.projectName = arg;
1444
1601
  }
1445
- const { projectName, preset, agents } = await promptUser(options);
1602
+ const { projectName, preset, agents, skills, git } = await promptUser(options);
1446
1603
  const targetDir = path.resolve(process$1.cwd(), projectName);
1447
1604
  generateProject({
1448
1605
  projectName: path.basename(targetDir),
1449
1606
  targetDir,
1450
1607
  preset,
1451
- agents
1608
+ agents,
1609
+ skills,
1610
+ git
1452
1611
  });
1453
1612
  }
1454
1613
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wangs-ui/create-react-app",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "Scaffold a modern React app with Wangs UI, Vite 8, Oxlint, Oxfmt, and AI Agent MCP integration",
5
5
  "keywords": [
6
6
  "antigravity",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@clack/prompts": "^1.7.0",
54
- "@wangs-ui/skills": "1.0.37"
54
+ "@wangs-ui/skills": "1.0.39"
55
55
  },
56
56
  "devDependencies": {},
57
57
  "scripts": {
@@ -13,10 +13,10 @@
13
13
  "format:check": "oxfmt --check"
14
14
  },
15
15
  "dependencies": {
16
- "@wangs-ui/react-core": "^1.0.37",
17
- "@wangs-ui/react-i18n": "^1.0.37",
18
- "@wangs-ui/react-icons": "^1.0.37",
19
- "@wangs-ui/react-presets": "^1.0.37",
16
+ "@wangs-ui/react-core": "^1.0.39",
17
+ "@wangs-ui/react-i18n": "^1.0.39",
18
+ "@wangs-ui/react-icons": "^1.0.39",
19
+ "@wangs-ui/react-presets": "^1.0.39",
20
20
  "clsx": "^2.1.1",
21
21
  "react": "^19.2.7",
22
22
  "react-dom": "^19.2.7",