@pasosdejesus/m 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.
- package/dist/blockchain/deployments.d.ts +40 -0
- package/dist/blockchain/deployments.d.ts.map +1 -0
- package/dist/blockchain/deployments.js +64 -0
- package/dist/debug/DebugConsole.d.ts +22 -0
- package/dist/debug/DebugConsole.d.ts.map +1 -0
- package/dist/debug/DebugConsole.js +79 -0
- package/dist/debug/Logger.d.ts +38 -0
- package/dist/debug/Logger.d.ts.map +1 -0
- package/dist/debug/Logger.js +94 -0
- package/dist/debug/index.d.ts +6 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +4 -0
- package/dist/debug/useLogger.d.ts +14 -0
- package/dist/debug/useLogger.d.ts.map +1 -0
- package/dist/debug/useLogger.js +23 -0
- package/dist/debug/utils.d.ts +10 -0
- package/dist/debug/utils.d.ts.map +1 -0
- package/dist/debug/utils.js +53 -0
- package/dist/e2e/assertions.d.ts +5 -0
- package/dist/e2e/assertions.d.ts.map +1 -0
- package/dist/e2e/assertions.js +18 -0
- package/dist/e2e/browser.d.ts +37 -0
- package/dist/e2e/browser.d.ts.map +1 -0
- package/dist/e2e/browser.js +97 -0
- package/dist/e2e/env.d.ts +18 -0
- package/dist/e2e/env.d.ts.map +1 -0
- package/dist/e2e/env.js +57 -0
- package/dist/e2e/index.d.ts +11 -0
- package/dist/e2e/index.d.ts.map +1 -0
- package/dist/e2e/index.js +8 -0
- package/dist/e2e/navigation.d.ts +4 -0
- package/dist/e2e/navigation.d.ts.map +1 -0
- package/dist/e2e/navigation.js +32 -0
- package/dist/e2e/siwe-mock.d.ts +11 -0
- package/dist/e2e/siwe-mock.d.ts.map +1 -0
- package/dist/e2e/siwe-mock.js +112 -0
- package/dist/e2e/siwe.d.ts +15 -0
- package/dist/e2e/siwe.d.ts.map +1 -0
- package/dist/e2e/siwe.js +85 -0
- package/dist/e2e/wallet-mock.d.ts +13 -0
- package/dist/e2e/wallet-mock.d.ts.map +1 -0
- package/dist/e2e/wallet-mock.js +91 -0
- package/dist/i18n/common-cli.d.ts +11 -0
- package/dist/i18n/common-cli.d.ts.map +1 -0
- package/dist/i18n/common-cli.js +22 -0
- package/dist/i18n/createTranslator.d.ts +28 -0
- package/dist/i18n/createTranslator.d.ts.map +1 -0
- package/dist/i18n/createTranslator.js +48 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/locales/cli.d.ts +3 -0
- package/dist/i18n/locales/cli.d.ts.map +1 -0
- package/dist/i18n/locales/cli.js +180 -0
- package/dist/i18n/types.d.ts +3 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +10 -0
- package/dist/m.d.ts +2 -0
- package/dist/m.d.ts.map +1 -0
- package/dist/m.js +334 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +7 -0
- package/dist/shadcn_components/cn.d.ts +13 -0
- package/dist/shadcn_components/cn.d.ts.map +1 -0
- package/dist/shadcn_components/cn.js +15 -0
- package/dist/shadcn_components/ui/accordion.d.ts +8 -0
- package/dist/shadcn_components/ui/accordion.d.ts.map +1 -0
- package/dist/shadcn_components/ui/accordion.js +14 -0
- package/dist/shadcn_components/ui/alert-dialog.d.ts +21 -0
- package/dist/shadcn_components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/shadcn_components/ui/alert-dialog.js +27 -0
- package/dist/shadcn_components/ui/alert.d.ts +9 -0
- package/dist/shadcn_components/ui/alert.d.ts.map +1 -0
- package/dist/shadcn_components/ui/alert.js +22 -0
- package/dist/shadcn_components/ui/avatar.d.ts +7 -0
- package/dist/shadcn_components/ui/avatar.d.ts.map +1 -0
- package/dist/shadcn_components/ui/avatar.js +12 -0
- package/dist/shadcn_components/ui/badge.d.ts +10 -0
- package/dist/shadcn_components/ui/badge.d.ts.map +1 -0
- package/dist/shadcn_components/ui/badge.js +22 -0
- package/dist/shadcn_components/ui/button.d.ts +11 -0
- package/dist/shadcn_components/ui/button.d.ts.map +1 -0
- package/dist/shadcn_components/ui/button.js +31 -0
- package/dist/shadcn_components/ui/card.d.ts +10 -0
- package/dist/shadcn_components/ui/card.d.ts.map +1 -0
- package/dist/shadcn_components/ui/card.js +24 -0
- package/dist/shadcn_components/ui/checkbox.d.ts +5 -0
- package/dist/shadcn_components/ui/checkbox.d.ts.map +1 -0
- package/dist/shadcn_components/ui/checkbox.js +9 -0
- package/dist/shadcn_components/ui/dialog.d.ts +20 -0
- package/dist/shadcn_components/ui/dialog.d.ts.map +1 -0
- package/dist/shadcn_components/ui/dialog.js +23 -0
- package/dist/shadcn_components/ui/dropdown-menu.d.ts +28 -0
- package/dist/shadcn_components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/shadcn_components/ui/dropdown-menu.js +36 -0
- package/dist/shadcn_components/ui/form.d.ts +24 -0
- package/dist/shadcn_components/ui/form.d.ts.map +1 -0
- package/dist/shadcn_components/ui/form.js +63 -0
- package/dist/shadcn_components/ui/input.d.ts +4 -0
- package/dist/shadcn_components/ui/input.d.ts.map +1 -0
- package/dist/shadcn_components/ui/input.js +6 -0
- package/dist/shadcn_components/ui/label.d.ts +6 -0
- package/dist/shadcn_components/ui/label.d.ts.map +1 -0
- package/dist/shadcn_components/ui/label.js +10 -0
- package/dist/shadcn_components/ui/menubar.d.ts +29 -0
- package/dist/shadcn_components/ui/menubar.d.ts.map +1 -0
- package/dist/shadcn_components/ui/menubar.js +46 -0
- package/dist/shadcn_components/ui/popover.d.ts +7 -0
- package/dist/shadcn_components/ui/popover.d.ts.map +1 -0
- package/dist/shadcn_components/ui/popover.js +10 -0
- package/dist/shadcn_components/ui/progress.d.ts +5 -0
- package/dist/shadcn_components/ui/progress.d.ts.map +1 -0
- package/dist/shadcn_components/ui/progress.js +8 -0
- package/dist/shadcn_components/ui/radio-group.d.ts +6 -0
- package/dist/shadcn_components/ui/radio-group.d.ts.map +1 -0
- package/dist/shadcn_components/ui/radio-group.js +15 -0
- package/dist/shadcn_components/ui/scroll-area.d.ts +6 -0
- package/dist/shadcn_components/ui/scroll-area.d.ts.map +1 -0
- package/dist/shadcn_components/ui/scroll-area.js +12 -0
- package/dist/shadcn_components/ui/select.d.ts +14 -0
- package/dist/shadcn_components/ui/select.d.ts.map +1 -0
- package/dist/shadcn_components/ui/select.js +27 -0
- package/dist/shadcn_components/ui/separator.d.ts +5 -0
- package/dist/shadcn_components/ui/separator.d.ts.map +1 -0
- package/dist/shadcn_components/ui/separator.js +8 -0
- package/dist/shadcn_components/ui/sheet.d.ts +26 -0
- package/dist/shadcn_components/ui/sheet.d.ts.map +1 -0
- package/dist/shadcn_components/ui/sheet.js +37 -0
- package/dist/shadcn_components/ui/skeleton.d.ts +3 -0
- package/dist/shadcn_components/ui/skeleton.d.ts.map +1 -0
- package/dist/shadcn_components/ui/skeleton.js +6 -0
- package/dist/shadcn_components/ui/slider.d.ts +5 -0
- package/dist/shadcn_components/ui/slider.d.ts.map +1 -0
- package/dist/shadcn_components/ui/slider.js +8 -0
- package/dist/shadcn_components/ui/switch.d.ts +5 -0
- package/dist/shadcn_components/ui/switch.d.ts.map +1 -0
- package/dist/shadcn_components/ui/switch.js +8 -0
- package/dist/shadcn_components/ui/table.d.ts +11 -0
- package/dist/shadcn_components/ui/table.d.ts.map +1 -0
- package/dist/shadcn_components/ui/table.js +20 -0
- package/dist/shadcn_components/ui/tabs.d.ts +8 -0
- package/dist/shadcn_components/ui/tabs.d.ts.map +1 -0
- package/dist/shadcn_components/ui/tabs.js +13 -0
- package/dist/shadcn_components/ui/textarea.d.ts +4 -0
- package/dist/shadcn_components/ui/textarea.d.ts.map +1 -0
- package/dist/shadcn_components/ui/textarea.js +8 -0
- package/dist/shadcn_components/ui/toast.d.ts +16 -0
- package/dist/shadcn_components/ui/toast.d.ts.map +1 -0
- package/dist/shadcn_components/ui/toast.js +34 -0
- package/dist/shadcn_components/ui/toaster.d.ts +2 -0
- package/dist/shadcn_components/ui/toaster.d.ts.map +1 -0
- package/dist/shadcn_components/ui/toaster.js +10 -0
- package/dist/shadcn_components/ui/tooltip.d.ts +8 -0
- package/dist/shadcn_components/ui/tooltip.d.ts.map +1 -0
- package/dist/shadcn_components/ui/tooltip.js +11 -0
- package/dist/shadcn_components/ui/use-toast.d.ts +45 -0
- package/dist/shadcn_components/ui/use-toast.d.ts.map +1 -0
- package/dist/shadcn_components/ui/use-toast.js +126 -0
- package/dist/tasks/context.d.ts +13 -0
- package/dist/tasks/context.d.ts.map +1 -0
- package/dist/tasks/context.js +310 -0
- package/dist/tasks/create.d.ts +2 -0
- package/dist/tasks/create.d.ts.map +1 -0
- package/dist/tasks/create.js +91 -0
- package/dist/tasks/db.d.ts +19 -0
- package/dist/tasks/db.d.ts.map +1 -0
- package/dist/tasks/db.js +791 -0
- package/dist/tasks/e2e.d.ts +2 -0
- package/dist/tasks/e2e.d.ts.map +1 -0
- package/dist/tasks/e2e.js +124 -0
- package/dist/tasks/edit.d.ts +7 -0
- package/dist/tasks/edit.d.ts.map +1 -0
- package/dist/tasks/edit.js +471 -0
- package/dist/tasks/engine.d.ts +2 -0
- package/dist/tasks/engine.d.ts.map +1 -0
- package/dist/tasks/engine.js +149 -0
- package/dist/tasks/env-diff.d.ts +2 -0
- package/dist/tasks/env-diff.d.ts.map +1 -0
- package/dist/tasks/env-diff.js +140 -0
- package/dist/tasks/fuzzy.d.ts +9 -0
- package/dist/tasks/fuzzy.d.ts.map +1 -0
- package/dist/tasks/fuzzy.js +153 -0
- package/dist/tasks/glob.d.ts +5 -0
- package/dist/tasks/glob.d.ts.map +1 -0
- package/dist/tasks/glob.js +57 -0
- package/dist/tasks/grep.d.ts +9 -0
- package/dist/tasks/grep.d.ts.map +1 -0
- package/dist/tasks/grep.js +93 -0
- package/dist/tasks/readfile.d.ts +2 -0
- package/dist/tasks/readfile.d.ts.map +1 -0
- package/dist/tasks/readfile.js +177 -0
- package/dist/tasks/update.d.ts +5 -0
- package/dist/tasks/update.d.ts.map +1 -0
- package/dist/tasks/update.js +200 -0
- package/dist/tasks/util.d.ts +12 -0
- package/dist/tasks/util.d.ts.map +1 -0
- package/dist/tasks/util.js +42 -0
- package/dist/tasks/wallet.d.ts +2 -0
- package/dist/tasks/wallet.d.ts.map +1 -0
- package/dist/tasks/wallet.js +697 -0
- package/dist/tasks/writefile.d.ts +2 -0
- package/dist/tasks/writefile.d.ts.map +1 -0
- package/dist/tasks/writefile.js +66 -0
- package/dist/templates/AGENTS.md.hbs +81 -0
- package/dist/templates/ARCHITECTURE.md.hbs +146 -0
- package/dist/templates/CONTRIBUTING.md.hbs +83 -0
- package/dist/templates/LICENCIA.md +21 -0
- package/dist/templates/LICENSE.md +15 -0
- package/dist/templates/Makefile +16 -0
- package/dist/templates/README.md.hbs +111 -0
- package/dist/templates/apps/.env.example.hbs +75 -0
- package/dist/templates/apps/hardhat/.prettierrc +16 -0
- package/dist/templates/apps/hardhat/MOCK_USDT_README.md +20 -0
- package/dist/templates/apps/hardhat/Makefile +13 -0
- package/dist/templates/apps/hardhat/README.md +129 -0
- package/dist/templates/apps/hardhat/bin/MusdtVerification +4 -0
- package/dist/templates/apps/hardhat/bin/approveDepositOwner +7 -0
- package/dist/templates/apps/hardhat/bin/contractVerification +9 -0
- package/dist/templates/apps/hardhat/bin/deployMockUSDT +7 -0
- package/dist/templates/apps/hardhat/bin/prepadJ.sh +14 -0
- package/dist/templates/apps/hardhat/bin/verifyMockUSDT +7 -0
- package/dist/templates/apps/hardhat/contracts/MockUSDT.sol +47 -0
- package/dist/templates/apps/hardhat/hardhat.config.ts +102 -0
- package/dist/templates/apps/hardhat/package.json +55 -0
- package/dist/templates/apps/hardhat/scripts/approveDepositOwner.ts +22 -0
- package/dist/templates/apps/hardhat/scripts/deployMockUSDT.ts +49 -0
- package/dist/templates/apps/hardhat/scripts/verifyDeployment.ts +93 -0
- package/dist/templates/apps/hardhat/scripts/verifyMockUSDT.ts +52 -0
- package/dist/templates/apps/hardhat/sync-abis.mjs +58 -0
- package/dist/templates/apps/hardhat/test/MockUSDT.test.ts +40 -0
- package/dist/templates/apps/hardhat/tsconfig.json +27 -0
- package/dist/templates/apps/nextjs/.config/kysely.config.ts +36 -0
- package/dist/templates/apps/nextjs/Makefile +24 -0
- package/dist/templates/apps/nextjs/README.md.hbs +76 -0
- package/dist/templates/apps/nextjs/abis/IERC20.json +74 -0
- package/dist/templates/apps/nextjs/abis/MockUSDT.json +242 -0
- package/dist/templates/apps/nextjs/abis/ReentrancyGuard.json +1 -0
- package/dist/templates/apps/nextjs/app/globals.css +3 -0
- package/dist/templates/apps/nextjs/app/layout.tsx.hbs +26 -0
- package/dist/templates/apps/nextjs/app/page.tsx.hbs +225 -0
- package/dist/templates/apps/nextjs/app/testui/page.tsx +371 -0
- package/dist/templates/apps/nextjs/bin/m +8 -0
- package/dist/templates/apps/nextjs/components.json +21 -0
- package/dist/templates/apps/nextjs/next-env.d.ts +5 -0
- package/dist/templates/apps/nextjs/next.config.ts +10 -0
- package/dist/templates/apps/nextjs/package.json.hbs +48 -0
- package/dist/templates/apps/nextjs/pnpm-workspace.yaml +13 -0
- package/dist/templates/apps/nextjs/postcss.config.mjs +6 -0
- package/dist/templates/apps/nextjs/tailwind.config.js +11 -0
- package/dist/templates/apps/nextjs/tests/helpers.ts +31 -0
- package/dist/templates/apps/nextjs/tests/index.test.ts +7 -0
- package/dist/templates/apps/nextjs/tests/setup-env.ts.hbs +8 -0
- package/dist/templates/apps/nextjs/tests/test-utils.example.test.ts +168 -0
- package/dist/templates/apps/nextjs/tsconfig.json +44 -0
- package/dist/templates/apps/nextjs/tsconfig.test.json +38 -0
- package/dist/templates/apps/nextjs/vitest.config.ts +13 -0
- package/dist/test-utils/fs-mocks.d.ts +32 -0
- package/dist/test-utils/fs-mocks.d.ts.map +1 -0
- package/dist/test-utils/fs-mocks.js +63 -0
- package/dist/test-utils/i18n-mock.d.ts +21 -0
- package/dist/test-utils/i18n-mock.d.ts.map +1 -0
- package/dist/test-utils/i18n-mock.js +29 -0
- package/dist/test-utils/index.d.ts +12 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +11 -0
- package/dist/test-utils/kysely-mocks.d.ts +298 -0
- package/dist/test-utils/kysely-mocks.d.ts.map +1 -0
- package/dist/test-utils/kysely-mocks.js +173 -0
- package/dist/test-utils/radix-mocks.d.ts +134 -0
- package/dist/test-utils/radix-mocks.d.ts.map +1 -0
- package/dist/test-utils/radix-mocks.js +175 -0
- package/dist/test-utils/rainbowkit-mocks.d.ts +80 -0
- package/dist/test-utils/rainbowkit-mocks.d.ts.map +1 -0
- package/dist/test-utils/rainbowkit-mocks.js +247 -0
- package/dist/test-utils/viem-mocks.d.ts +86 -0
- package/dist/test-utils/viem-mocks.d.ts.map +1 -0
- package/dist/test-utils/viem-mocks.js +54 -0
- package/dist/util/cli-parser.d.ts +20 -0
- package/dist/util/cli-parser.d.ts.map +1 -0
- package/dist/util/cli-parser.js +38 -0
- package/dist/util/colors.d.ts +5 -0
- package/dist/util/colors.d.ts.map +1 -0
- package/dist/util/colors.js +5 -0
- package/dist/util/locale.d.ts +3 -0
- package/dist/util/locale.d.ts.map +1 -0
- package/dist/util/locale.js +10 -0
- package/dist/wba/client.d.ts +19 -0
- package/dist/wba/client.d.ts.map +1 -0
- package/dist/wba/client.js +31 -0
- package/dist/wba/index.d.ts +4 -0
- package/dist/wba/index.d.ts.map +1 -0
- package/dist/wba/index.js +2 -0
- package/dist/wba/routes/event.d.ts +32 -0
- package/dist/wba/routes/event.d.ts.map +1 -0
- package/dist/wba/routes/event.js +42 -0
- package/dist/wba/routes/index.d.ts +3 -0
- package/dist/wba/routes/index.d.ts.map +1 -0
- package/dist/wba/routes/index.js +2 -0
- package/dist/wba/routes/summary.d.ts +44 -0
- package/dist/wba/routes/summary.d.ts.map +1 -0
- package/dist/wba/routes/summary.js +146 -0
- package/dist/wba/server.d.ts +18 -0
- package/dist/wba/server.d.ts.map +1 -0
- package/dist/wba/server.js +29 -0
- package/dist/wba/types.d.ts +68 -0
- package/dist/wba/types.d.ts.map +1 -0
- package/dist/wba/types.js +6 -0
- package/package.json +223 -0
- package/src/blockchain/README.md +80 -0
- package/src/debug/README.md +94 -0
- package/src/e2e/README.md +105 -0
- package/src/i18n/README.md +143 -0
- package/src/shadcn_components/README.md +125 -0
- package/src/tasks/README.md +69 -0
- package/src/test-utils/README.md +638 -0
- package/src/util/README.md +18 -0
- package/src/wba/README.md +175 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
4
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
5
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
8
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/shadcn_components/ui/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAA;AAI3D,QAAA,MAAM,eAAe,iDAA4B,CAAA;AAEjD,QAAA,MAAM,OAAO,yCAAwB,CAAA;AAErC,QAAA,MAAM,cAAc,gHAA2B,CAAA;AAE/C,QAAA,MAAM,cAAc,gKAalB,CAAA;AAGF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
5
|
+
import { cn } from '../cn.js';
|
|
6
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
7
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
8
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
9
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(TooltipPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn('z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className), ...props })));
|
|
10
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
11
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ToastActionElement, ToastProps } from './toast.js';
|
|
3
|
+
type ToasterToast = ToastProps & {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
action?: ToastActionElement;
|
|
8
|
+
};
|
|
9
|
+
declare const actionTypes: {
|
|
10
|
+
readonly ADD_TOAST: "ADD_TOAST";
|
|
11
|
+
readonly UPDATE_TOAST: "UPDATE_TOAST";
|
|
12
|
+
readonly DISMISS_TOAST: "DISMISS_TOAST";
|
|
13
|
+
readonly REMOVE_TOAST: "REMOVE_TOAST";
|
|
14
|
+
};
|
|
15
|
+
type ActionType = typeof actionTypes;
|
|
16
|
+
type Action = {
|
|
17
|
+
type: ActionType['ADD_TOAST'];
|
|
18
|
+
toast: ToasterToast;
|
|
19
|
+
} | {
|
|
20
|
+
type: ActionType['UPDATE_TOAST'];
|
|
21
|
+
toast: Partial<ToasterToast>;
|
|
22
|
+
} | {
|
|
23
|
+
type: ActionType['DISMISS_TOAST'];
|
|
24
|
+
toastId?: ToasterToast['id'];
|
|
25
|
+
} | {
|
|
26
|
+
type: ActionType['REMOVE_TOAST'];
|
|
27
|
+
toastId?: ToasterToast['id'];
|
|
28
|
+
};
|
|
29
|
+
interface State {
|
|
30
|
+
toasts: ToasterToast[];
|
|
31
|
+
}
|
|
32
|
+
export declare const reducer: (state: State, action: Action) => State;
|
|
33
|
+
type Toast = Omit<ToasterToast, 'id'>;
|
|
34
|
+
declare function toast({ ...props }: Toast): {
|
|
35
|
+
id: string;
|
|
36
|
+
dismiss: () => void;
|
|
37
|
+
update: (props: ToasterToast) => void;
|
|
38
|
+
};
|
|
39
|
+
declare function useToast(): {
|
|
40
|
+
toast: typeof toast;
|
|
41
|
+
dismiss: (toastId?: string) => void;
|
|
42
|
+
toasts: ToasterToast[];
|
|
43
|
+
};
|
|
44
|
+
export { useToast, toast };
|
|
45
|
+
//# sourceMappingURL=use-toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../../src/shadcn_components/ui/use-toast.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAKhE,KAAK,YAAY,GAAG,UAAU,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAED,QAAA,MAAM,WAAW;;;;;CAKP,CAAA;AASV,KAAK,UAAU,GAAG,OAAO,WAAW,CAAA;AAEpC,KAAK,MAAM,GACP;IACE,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC7B,KAAK,EAAE,YAAY,CAAA;CACpB,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,CAAA;AAEL,UAAU,KAAK;IACb,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB;AAoBD,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,KAAG,KAmDtD,CAAA;AAaD,KAAK,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAErC,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK;;;oBAGT,YAAY;EAwBpC;AAED,iBAAS,QAAQ;;wBAgBO,MAAM;YApIpB,YAAY,EAAE;EAsIvB;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// Inspired by react-hot-toast library
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
const TOAST_LIMIT = 4;
|
|
5
|
+
const TOAST_REMOVE_DELAY = 1000000;
|
|
6
|
+
const actionTypes = {
|
|
7
|
+
ADD_TOAST: 'ADD_TOAST',
|
|
8
|
+
UPDATE_TOAST: 'UPDATE_TOAST',
|
|
9
|
+
DISMISS_TOAST: 'DISMISS_TOAST',
|
|
10
|
+
REMOVE_TOAST: 'REMOVE_TOAST',
|
|
11
|
+
};
|
|
12
|
+
let count = 0;
|
|
13
|
+
function genId() {
|
|
14
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
15
|
+
return count.toString();
|
|
16
|
+
}
|
|
17
|
+
const toastTimeouts = new Map();
|
|
18
|
+
const addToRemoveQueue = (toastId) => {
|
|
19
|
+
if (toastTimeouts.has(toastId)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const timeout = setTimeout(() => {
|
|
23
|
+
toastTimeouts.delete(toastId);
|
|
24
|
+
dispatch({
|
|
25
|
+
type: 'REMOVE_TOAST',
|
|
26
|
+
toastId: toastId,
|
|
27
|
+
});
|
|
28
|
+
}, TOAST_REMOVE_DELAY);
|
|
29
|
+
toastTimeouts.set(toastId, timeout);
|
|
30
|
+
};
|
|
31
|
+
export const reducer = (state, action) => {
|
|
32
|
+
switch (action.type) {
|
|
33
|
+
case 'ADD_TOAST':
|
|
34
|
+
return {
|
|
35
|
+
...state,
|
|
36
|
+
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
|
37
|
+
};
|
|
38
|
+
case 'UPDATE_TOAST':
|
|
39
|
+
return {
|
|
40
|
+
...state,
|
|
41
|
+
toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t),
|
|
42
|
+
};
|
|
43
|
+
case 'DISMISS_TOAST': {
|
|
44
|
+
const { toastId } = action;
|
|
45
|
+
if (toastId) {
|
|
46
|
+
addToRemoveQueue(toastId);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
state.toasts.forEach((toast) => {
|
|
50
|
+
addToRemoveQueue(toast.id);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
...state,
|
|
55
|
+
toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined
|
|
56
|
+
? {
|
|
57
|
+
...t,
|
|
58
|
+
open: false,
|
|
59
|
+
}
|
|
60
|
+
: t),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
case 'REMOVE_TOAST':
|
|
64
|
+
if (action.toastId === undefined) {
|
|
65
|
+
return {
|
|
66
|
+
...state,
|
|
67
|
+
toasts: [],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
...state,
|
|
72
|
+
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const listeners = [];
|
|
77
|
+
let memoryState = { toasts: [] };
|
|
78
|
+
function dispatch(action) {
|
|
79
|
+
memoryState = reducer(memoryState, action);
|
|
80
|
+
listeners.forEach((listener) => {
|
|
81
|
+
listener(memoryState);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function toast({ ...props }) {
|
|
85
|
+
const id = genId();
|
|
86
|
+
const update = (props) => dispatch({
|
|
87
|
+
type: 'UPDATE_TOAST',
|
|
88
|
+
toast: { ...props, id },
|
|
89
|
+
});
|
|
90
|
+
const dismiss = () => dispatch({ type: 'DISMISS_TOAST', toastId: id });
|
|
91
|
+
dispatch({
|
|
92
|
+
type: 'ADD_TOAST',
|
|
93
|
+
toast: {
|
|
94
|
+
...props,
|
|
95
|
+
id,
|
|
96
|
+
open: true,
|
|
97
|
+
onOpenChange: (open) => {
|
|
98
|
+
if (!open)
|
|
99
|
+
dismiss();
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
id: id,
|
|
105
|
+
dismiss,
|
|
106
|
+
update,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function useToast() {
|
|
110
|
+
const [state, setState] = React.useState(memoryState);
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
listeners.push(setState);
|
|
113
|
+
return () => {
|
|
114
|
+
const index = listeners.indexOf(setState);
|
|
115
|
+
if (index > -1) {
|
|
116
|
+
listeners.splice(index, 1);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}, [state]);
|
|
120
|
+
return {
|
|
121
|
+
...state,
|
|
122
|
+
toast,
|
|
123
|
+
dismiss: (toastId) => dispatch({ type: 'DISMISS_TOAST', toastId }),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export { useToast, toast };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ContextOptions {
|
|
2
|
+
output?: string;
|
|
3
|
+
branch?: string;
|
|
4
|
+
exclude?: string[];
|
|
5
|
+
maxSize?: number;
|
|
6
|
+
includePatterns?: string[];
|
|
7
|
+
noClipboard?: boolean;
|
|
8
|
+
full?: boolean;
|
|
9
|
+
limit?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function runAiContext(options?: ContextOptions): Promise<void>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/tasks/context.ts"],"names":[],"mappings":"AA0BA,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmQD,wBAAsB,YAAY,CAAC,OAAO,GAAE,cAAmB,iBAoF5D"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { createWriteStream, existsSync, readFileSync } from 'node:fs';
|
|
5
|
+
import { info, success, warn, problem } from '../util/colors.js';
|
|
6
|
+
import { createTranslator } from '../i18n/createTranslator.js';
|
|
7
|
+
import { detectLocale } from '../util/locale.js';
|
|
8
|
+
import commonCli from '../i18n/common-cli.js';
|
|
9
|
+
const t = createTranslator(detectLocale(), {
|
|
10
|
+
en: {
|
|
11
|
+
'context.generating': '📁 Generating project context...',
|
|
12
|
+
'context.not_git': '❌ Error: Not in a git repository',
|
|
13
|
+
'context.git_hint': ' Run: git init (or clone a repository)',
|
|
14
|
+
'context.branch': ' Branch: {{0}}',
|
|
15
|
+
'context.output': ' Output: {{0}}',
|
|
16
|
+
},
|
|
17
|
+
es: {
|
|
18
|
+
'context.generating': '📁 Generando contexto del proyecto...',
|
|
19
|
+
'context.not_git': '❌ Error: No estás en un repositorio git',
|
|
20
|
+
'context.git_hint': ' Ejecuta: git init (o clona un repositorio)',
|
|
21
|
+
'context.branch': ' Branch: {{0}}',
|
|
22
|
+
'context.output': ' Output: {{0}}',
|
|
23
|
+
},
|
|
24
|
+
}, commonCli);
|
|
25
|
+
const DEFAULT_EXCLUDES = [
|
|
26
|
+
'dist', 'build', 'node_modules', 'coverage', '.next',
|
|
27
|
+
'__pycache__', '*.lock', '*.map', '*.min.js', '*.log',
|
|
28
|
+
'*.tmp', '.DS_Store', 'templates', 'tests'
|
|
29
|
+
];
|
|
30
|
+
const MAX_FILE_SIZE = 30 * 1024; // 30KB por defecto
|
|
31
|
+
const DEFAULT_LIMIT_KB = 100; // 100KB por defecto para el contexto total
|
|
32
|
+
async function findGitRoot() {
|
|
33
|
+
const result = spawnSync('git', ['rev-parse', '--show-toplevel'], {
|
|
34
|
+
encoding: 'utf-8',
|
|
35
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
36
|
+
});
|
|
37
|
+
if (result.status === 0) {
|
|
38
|
+
return result.stdout.trim();
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
async function getCurrentBranch() {
|
|
43
|
+
const result = spawnSync('git', ['branch', '--show-current'], {
|
|
44
|
+
encoding: 'utf-8',
|
|
45
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
46
|
+
});
|
|
47
|
+
if (result.status === 0 && result.stdout.trim()) {
|
|
48
|
+
return result.stdout.trim();
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
async function getRemoteUrl() {
|
|
53
|
+
const result = spawnSync('git', ['config', '--get', 'remote.origin.url'], {
|
|
54
|
+
encoding: 'utf-8',
|
|
55
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
56
|
+
});
|
|
57
|
+
if (result.status === 0 && result.stdout.trim()) {
|
|
58
|
+
// Sanitizar: eliminar credenciales
|
|
59
|
+
return result.stdout.trim().replace(/\/\/[^@]*@/, '//');
|
|
60
|
+
}
|
|
61
|
+
return 'local';
|
|
62
|
+
}
|
|
63
|
+
function isExcluded(filePath, excludes) {
|
|
64
|
+
for (const pattern of excludes) {
|
|
65
|
+
// Soporte para patrones glob simples
|
|
66
|
+
if (pattern.includes('*')) {
|
|
67
|
+
const regex = new RegExp(pattern.replace(/\*/g, '.*'));
|
|
68
|
+
if (regex.test(filePath))
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Coincidencia exacta o de directorio
|
|
73
|
+
if (filePath === pattern ||
|
|
74
|
+
filePath.startsWith(`${pattern}/`) ||
|
|
75
|
+
filePath.includes(`/${pattern}/`)) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
function detectLanguage(filePath) {
|
|
83
|
+
const ext = filePath.split('.').pop()?.toLowerCase() || '';
|
|
84
|
+
const langMap = {
|
|
85
|
+
'sh': 'bash', 'bash': 'bash', 'zsh': 'bash',
|
|
86
|
+
'py': 'python',
|
|
87
|
+
'js': 'javascript', 'ts': 'typescript',
|
|
88
|
+
'jsx': 'jsx', 'tsx': 'tsx',
|
|
89
|
+
'json': 'json',
|
|
90
|
+
'md': 'markdown',
|
|
91
|
+
'yml': 'yaml', 'yaml': 'yaml',
|
|
92
|
+
'c': 'c', 'h': 'c',
|
|
93
|
+
'cpp': 'cpp', 'hpp': 'cpp',
|
|
94
|
+
'go': 'go',
|
|
95
|
+
'rs': 'rust',
|
|
96
|
+
'sql': 'sql',
|
|
97
|
+
'html': 'html', 'css': 'css',
|
|
98
|
+
'toml': 'toml',
|
|
99
|
+
'tf': 'hcl', 'tfvars': 'hcl'
|
|
100
|
+
};
|
|
101
|
+
return langMap[ext] || '';
|
|
102
|
+
}
|
|
103
|
+
async function getFileList(branch) {
|
|
104
|
+
const branchArg = branch || await getCurrentBranch() || 'HEAD';
|
|
105
|
+
const result = spawnSync('git', ['ls-tree', '-r', '--name-only', branchArg], {
|
|
106
|
+
encoding: 'utf-8',
|
|
107
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
108
|
+
});
|
|
109
|
+
if (result.status !== 0) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
return result.stdout.trim().split('\n').filter((f) => f);
|
|
113
|
+
}
|
|
114
|
+
async function getDirectoryTree(excludes = DEFAULT_EXCLUDES) {
|
|
115
|
+
// Construir patrones de exclusión para tree
|
|
116
|
+
const excludePatterns = excludes.filter(e => !e.includes('*')).join('|');
|
|
117
|
+
let treeCmd = ['tree', '-a', '--dirsfirst', '-L', '2'];
|
|
118
|
+
if (excludePatterns) {
|
|
119
|
+
treeCmd = treeCmd.concat(['-I', excludePatterns]);
|
|
120
|
+
}
|
|
121
|
+
const result = spawnSync('tree', treeCmd, {
|
|
122
|
+
encoding: 'utf-8',
|
|
123
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
124
|
+
});
|
|
125
|
+
if (result.status !== 0) {
|
|
126
|
+
// Fallback a find si tree no está disponible
|
|
127
|
+
let findCmd = ['find', '.', '-type', 'd', '-maxdepth', '2'];
|
|
128
|
+
for (const pattern of excludes) {
|
|
129
|
+
if (!pattern.includes('*')) {
|
|
130
|
+
findCmd = findCmd.concat(['-not', '-path', `./${pattern}/*`, '-not', '-path', `./${pattern}`]);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const findResult = spawnSync('find', findCmd, {
|
|
134
|
+
encoding: 'utf-8',
|
|
135
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
136
|
+
});
|
|
137
|
+
return findResult.stdout || 'tree command not available';
|
|
138
|
+
}
|
|
139
|
+
return result.stdout;
|
|
140
|
+
}
|
|
141
|
+
async function getGitLog(limit = 5) {
|
|
142
|
+
const result = spawnSync('git', ['log', `-${limit}`, '--stat', '--oneline'], {
|
|
143
|
+
encoding: 'utf-8',
|
|
144
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
145
|
+
});
|
|
146
|
+
if (result.status !== 0) {
|
|
147
|
+
return 'git log not available';
|
|
148
|
+
}
|
|
149
|
+
return result.stdout;
|
|
150
|
+
}
|
|
151
|
+
async function writeContextFile(outputPath, files, excludes, maxSize, maxTotalBytes) {
|
|
152
|
+
const gitRoot = await findGitRoot();
|
|
153
|
+
const projectName = gitRoot ? gitRoot.split('/').pop() || 'proyecto' : 'proyecto';
|
|
154
|
+
const branch = await getCurrentBranch() || 'unknown';
|
|
155
|
+
const remoteUrl = await getRemoteUrl();
|
|
156
|
+
// Usar un array para acumular el contenido y escribirlo de una vez
|
|
157
|
+
const chunks = [];
|
|
158
|
+
// Cabecera del documento
|
|
159
|
+
chunks.push(`# Contexto del Proyecto: ${projectName}\n\n`);
|
|
160
|
+
chunks.push(`- **Branch:** ${branch}\n`);
|
|
161
|
+
chunks.push(`- **Repositorio:** ${remoteUrl}\n`);
|
|
162
|
+
chunks.push(`- **Fecha:** ${new Date().toISOString()}\n`);
|
|
163
|
+
chunks.push(`- **Ruta:** ${gitRoot || process.cwd()}\n\n`);
|
|
164
|
+
// Estructura de directorios
|
|
165
|
+
chunks.push(`## Estructura de Directorios\n\n`);
|
|
166
|
+
chunks.push(`\`\`\`\n`);
|
|
167
|
+
const tree = await getDirectoryTree(excludes);
|
|
168
|
+
chunks.push(tree);
|
|
169
|
+
chunks.push(`\`\`\`\n\n`);
|
|
170
|
+
// Historial de Git
|
|
171
|
+
chunks.push(`## Historial de Git (últimos 5 commits)\n\n`);
|
|
172
|
+
chunks.push(`\`\`\`\n`);
|
|
173
|
+
const gitLog = await getGitLog(5);
|
|
174
|
+
chunks.push(gitLog);
|
|
175
|
+
chunks.push(`\`\`\`\n\n`);
|
|
176
|
+
chunks.push(`---\n\n`);
|
|
177
|
+
let count = 0;
|
|
178
|
+
let totalSize = 0;
|
|
179
|
+
let skippedSize = 0;
|
|
180
|
+
let skippedExclude = 0;
|
|
181
|
+
let skippedLimit = 0;
|
|
182
|
+
for (const file of files) {
|
|
183
|
+
// Verificar exclusión
|
|
184
|
+
if (isExcluded(file, excludes)) {
|
|
185
|
+
skippedExclude++;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const fullPath = join(gitRoot || process.cwd(), file);
|
|
189
|
+
try {
|
|
190
|
+
const fileStat = await stat(fullPath);
|
|
191
|
+
// Verificar límite total antes de agregar
|
|
192
|
+
if (maxTotalBytes && totalSize + fileStat.size > maxTotalBytes) {
|
|
193
|
+
skippedLimit++;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (fileStat.size > maxSize) {
|
|
197
|
+
warn(` ⚠️ Omitido (>${maxSize / 1024}KB): ${file} (${Math.round(fileStat.size / 1024)}KB)`);
|
|
198
|
+
skippedSize++;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const content = await readFile(fullPath, 'utf-8');
|
|
202
|
+
const lang = detectLanguage(file);
|
|
203
|
+
const timestamp = new Date().toISOString().replace(/[-:]/g, '').slice(0, 15);
|
|
204
|
+
chunks.push(`___INICIO_ARCHIVO_${timestamp}___ ${file}\n\n`);
|
|
205
|
+
chunks.push(`\`\`\`${lang}\n`);
|
|
206
|
+
chunks.push(content);
|
|
207
|
+
if (!content.endsWith('\n'))
|
|
208
|
+
chunks.push('\n');
|
|
209
|
+
chunks.push(`\`\`\`\n\n`);
|
|
210
|
+
count++;
|
|
211
|
+
totalSize += fileStat.size;
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
warn(` ⚠️ No se pudo leer: ${file}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Escribir todo de una vez
|
|
218
|
+
const writeStream = createWriteStream(outputPath);
|
|
219
|
+
writeStream.write(chunks.join(''));
|
|
220
|
+
writeStream.end();
|
|
221
|
+
// Esperar a que termine de escribir
|
|
222
|
+
await new Promise((resolve) => {
|
|
223
|
+
writeStream.on('close', () => resolve());
|
|
224
|
+
});
|
|
225
|
+
return { count, totalSize, skippedSize, skippedExclude, skippedLimit };
|
|
226
|
+
}
|
|
227
|
+
function loadExcludeFile(excludeFile) {
|
|
228
|
+
if (!excludeFile || !existsSync(excludeFile)) {
|
|
229
|
+
return DEFAULT_EXCLUDES;
|
|
230
|
+
}
|
|
231
|
+
const content = readFileSync(excludeFile, 'utf-8');
|
|
232
|
+
return content
|
|
233
|
+
.split('\n')
|
|
234
|
+
.map((line) => line.trim())
|
|
235
|
+
.filter((line) => line && !line.startsWith('#'));
|
|
236
|
+
}
|
|
237
|
+
export async function runAiContext(options = {}) {
|
|
238
|
+
const outputFile = options.output || 'contexto.md';
|
|
239
|
+
const branch = options.branch;
|
|
240
|
+
const maxSize = options.full ? Number.MAX_SAFE_INTEGER : (options.maxSize || MAX_FILE_SIZE);
|
|
241
|
+
const excludePatterns = options.exclude || loadExcludeFile('.contextignore');
|
|
242
|
+
info(t("context.generating"));
|
|
243
|
+
if (branch)
|
|
244
|
+
info(` Branch: ${branch}`);
|
|
245
|
+
info(` Output: ${outputFile}`);
|
|
246
|
+
info(` Excluyendo: ${excludePatterns.slice(0, 5).join(', ')}${excludePatterns.length > 5 ? '...' : ''}`);
|
|
247
|
+
console.log('');
|
|
248
|
+
// Verificar que estamos en un repositorio git
|
|
249
|
+
const gitRoot = await findGitRoot();
|
|
250
|
+
if (!gitRoot) {
|
|
251
|
+
problem(t("context.not_git"));
|
|
252
|
+
problem(t("context.git_hint"));
|
|
253
|
+
}
|
|
254
|
+
// Obtener lista de archivos
|
|
255
|
+
const files = await getFileList(branch);
|
|
256
|
+
if (files.length === 0) {
|
|
257
|
+
problem('❌ Error: No se encontraron archivos en el repositorio');
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
// Aplicar límite de tamaño si se especificó
|
|
261
|
+
const limitKB = options.limit || DEFAULT_LIMIT_KB;
|
|
262
|
+
const maxTotalBytes = limitKB * 1024;
|
|
263
|
+
let currentTotalBytes = 0;
|
|
264
|
+
// Escribir archivo de contexto con límite
|
|
265
|
+
const result = await writeContextFile(outputFile, files, excludePatterns, maxSize, maxTotalBytes);
|
|
266
|
+
const outputStat = await stat(outputFile);
|
|
267
|
+
const outputSizeKB = Math.round(outputStat.size / 1024);
|
|
268
|
+
const totalSizeKB = Math.round(result.totalSize / 1024);
|
|
269
|
+
console.log('');
|
|
270
|
+
success(`✅ Contexto generado: ${outputFile}`);
|
|
271
|
+
info(` Archivos incluidos: ${result.count}`);
|
|
272
|
+
info(` Tamaño total contenido: ${totalSizeKB}KB`);
|
|
273
|
+
info(` Tamaño del archivo: ${outputSizeKB}KB`);
|
|
274
|
+
if (limitKB && result.skippedLimit > 0) {
|
|
275
|
+
info(` Limitado por --limit ${limitKB}KB: ${result.skippedLimit} archivos omitidos`);
|
|
276
|
+
}
|
|
277
|
+
if (result.skippedExclude > 0)
|
|
278
|
+
info(` Omitidos por patrón: ${result.skippedExclude}`);
|
|
279
|
+
if (result.skippedSize > 0)
|
|
280
|
+
info(` Omitidos por tamaño (>${maxSize / 1024}KB): ${result.skippedSize}`);
|
|
281
|
+
console.log('');
|
|
282
|
+
info(`📋 Para enviar a DeepSeek:`);
|
|
283
|
+
info(` 1. En chat.deepseek.com haz clic en "Adjuntar archivo"`);
|
|
284
|
+
info(` 2. Selecciona ${outputFile}`);
|
|
285
|
+
info(` 3. El archivo se cargará automáticamente`);
|
|
286
|
+
if (result.count === 0) {
|
|
287
|
+
warn(`\n⚠️ Advertencia: No se incluyó ningún archivo.`);
|
|
288
|
+
warn(` Revisa tus patrones de exclusión en .contextignore`);
|
|
289
|
+
}
|
|
290
|
+
const shouldCopy = !options.noClipboard; // Por defecto true
|
|
291
|
+
// Copiar al portapapeles si no es --no-clip
|
|
292
|
+
if (shouldCopy) {
|
|
293
|
+
try {
|
|
294
|
+
const content = await readFile(outputFile, 'utf-8');
|
|
295
|
+
const { execSync } = await import('node:child_process');
|
|
296
|
+
// Usar execSync con input - esto funciona bien en OpenBSD
|
|
297
|
+
execSync('xclip -selection clipboard', {
|
|
298
|
+
input: content,
|
|
299
|
+
encoding: 'utf-8',
|
|
300
|
+
stdio: ['pipe', 'ignore', 'ignore']
|
|
301
|
+
});
|
|
302
|
+
success(`📋 Contexto copiado al portapapeles (${outputSizeKB}KB)`);
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
warn(`⚠️ No se pudo copiar al portapapeles: ${err.message}`);
|
|
306
|
+
warn(' El archivo se guardó como: ' + outputFile);
|
|
307
|
+
}
|
|
308
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/tasks/create.ts"],"names":[],"mappings":"AA4DA,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,iBAuCxE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname } from 'path';
|
|
5
|
+
import { problem, success } from '../util/colors.js';
|
|
6
|
+
import { createTranslator } from '../i18n/createTranslator.js';
|
|
7
|
+
import { detectLocale } from '../util/locale.js';
|
|
8
|
+
import commonCli from '../i18n/common-cli.js';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
const t = createTranslator(detectLocale(), {
|
|
12
|
+
en: {
|
|
13
|
+
'create.generating': 'Generating project in {{0}}...',
|
|
14
|
+
'create.file_added': 'Added {{0}}',
|
|
15
|
+
'create.error': 'Error creating project: {{0}}',
|
|
16
|
+
'create.done': 'Project created successfully.',
|
|
17
|
+
},
|
|
18
|
+
es: {
|
|
19
|
+
'create.generating': 'Generando proyecto en {{0}}...',
|
|
20
|
+
'create.file_added': 'Agregado {{0}}',
|
|
21
|
+
'create.error': 'Error al crear el proyecto: {{0}}',
|
|
22
|
+
'create.done': 'Proyecto creado exitosamente.',
|
|
23
|
+
},
|
|
24
|
+
}, commonCli);
|
|
25
|
+
function getTemplateDir() {
|
|
26
|
+
// __dirname is dist/tasks/ in the npm package; dist/templates/ is where build copies templates
|
|
27
|
+
const distTemplates = path.join(__dirname, '..', 'templates');
|
|
28
|
+
if (fs.existsSync(distTemplates))
|
|
29
|
+
return distTemplates;
|
|
30
|
+
// Fallback for development: source tree templates/
|
|
31
|
+
const srcTemplates = path.join(__dirname, '..', '..', 'templates');
|
|
32
|
+
if (fs.existsSync(srcTemplates))
|
|
33
|
+
return srcTemplates;
|
|
34
|
+
return path.join(__dirname, 'templates');
|
|
35
|
+
}
|
|
36
|
+
function render(content, name, description) {
|
|
37
|
+
const pkg = JSON.parse(fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'));
|
|
38
|
+
return content
|
|
39
|
+
.replace(/\{\{name\}\}/g, name)
|
|
40
|
+
.replace(/\{\{description\}\}/g, description)
|
|
41
|
+
.replace(/\{\{m_version\}\}/g, pkg.version);
|
|
42
|
+
}
|
|
43
|
+
function getAllFiles(dir) {
|
|
44
|
+
const files = [];
|
|
45
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
const fullPath = path.join(dir, entry.name);
|
|
48
|
+
if (entry.name === 'pnpm-lock.yaml' || entry.name.startsWith('.env'))
|
|
49
|
+
continue;
|
|
50
|
+
if (entry.isDirectory()) {
|
|
51
|
+
files.push(...getAllFiles(fullPath));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
files.push(fullPath);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return files;
|
|
58
|
+
}
|
|
59
|
+
export async function runCreateProject(name, description) {
|
|
60
|
+
const desc = description || '';
|
|
61
|
+
const templateDir = getTemplateDir();
|
|
62
|
+
const cwd = process.cwd();
|
|
63
|
+
const destDir = path.resolve(cwd, name);
|
|
64
|
+
if (fs.existsSync(destDir)) {
|
|
65
|
+
problem(t('create.error', `Directory ${name} already exists`));
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
const allFiles = getAllFiles(templateDir);
|
|
69
|
+
const templateBase = templateDir.replace(/\/+$/, '');
|
|
70
|
+
for (const srcPath of allFiles) {
|
|
71
|
+
const destRelPath = path.relative(templateBase, srcPath).replace(/\.hbs$/, '');
|
|
72
|
+
const destPath = path.join(destDir, destRelPath);
|
|
73
|
+
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
74
|
+
if (srcPath.endsWith('.hbs')) {
|
|
75
|
+
const content = fs.readFileSync(srcPath, 'utf-8');
|
|
76
|
+
const rendered = render(content, name, desc);
|
|
77
|
+
fs.writeFileSync(destPath, rendered, 'utf-8');
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
fs.copyFileSync(srcPath, destPath);
|
|
81
|
+
}
|
|
82
|
+
success(t('create.file_added', '/' + destRelPath));
|
|
83
|
+
}
|
|
84
|
+
// Make bin/m executable
|
|
85
|
+
const binM = path.join(destDir, 'apps', 'nextjs', 'bin', 'm');
|
|
86
|
+
if (fs.existsSync(binM)) {
|
|
87
|
+
fs.chmodSync(binM, 0o755);
|
|
88
|
+
success(`Made ${path.join(name, 'apps', 'nextjs', 'bin', 'm')} executable`);
|
|
89
|
+
}
|
|
90
|
+
success(t('create.done'));
|
|
91
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare function runDbCreate(): Promise<void>;
|
|
2
|
+
export declare function runDbDrop(): Promise<void>;
|
|
3
|
+
export declare function runDbSuperCreateUser(): Promise<void>;
|
|
4
|
+
export declare function runDbConsole(query?: string): Promise<void>;
|
|
5
|
+
export declare function runDbTestConnection(): Promise<void>;
|
|
6
|
+
export declare function runDbStructureDump(): Promise<void>;
|
|
7
|
+
export declare function runDbStructureLoad(): Promise<void>;
|
|
8
|
+
export declare function runDbTypesGen(): Promise<void>;
|
|
9
|
+
export declare function runDbMigrate(): Promise<void>;
|
|
10
|
+
export declare function runDbMigMake(name: string): Promise<void>;
|
|
11
|
+
export declare function runDbRollback(): Promise<void>;
|
|
12
|
+
export declare function runDbDump(name?: string): Promise<void>;
|
|
13
|
+
export declare function runDbRestore(name?: string): Promise<void>;
|
|
14
|
+
export declare function runDbSeed(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* db:check — verify expected DB schemas for installed modules.
|
|
17
|
+
*/
|
|
18
|
+
export declare function runDbCheck(): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/tasks/db.ts"],"names":[],"mappings":"AAyNA,wBAAsB,WAAW,kBAUhC;AAED,wBAAsB,SAAS,kBAU9B;AAED,wBAAsB,oBAAoB,kBAyIzC;AAED,wBAAsB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,iBAyDhD;AAED,wBAAsB,mBAAmB,kBAkBxC;AAkBD,wBAAsB,kBAAkB,kBAyCvC;AAED,wBAAsB,kBAAkB,kBAgCvC;AAED,wBAAsB,aAAa,kBAclC;AAED,wBAAsB,YAAY,kBAwCjC;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,iBA4B9C;AAED,wBAAsB,aAAa,kBAuBlC;AAED,wBAAsB,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,iBA6B5C;AAED,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,iBAmD/C;AAED,wBAAsB,SAAS,kBAAoD;AAEnF;;GAEG;AACH,wBAAsB,UAAU,kBAsF/B"}
|