@meshy-ai/cli 0.3.1 → 0.4.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/README.md +69 -565
- package/dist/cmd/auth.d.ts.map +1 -1
- package/dist/cmd/auth.js +14 -12
- package/dist/cmd/auth.js.map +1 -1
- package/dist/cmd/download.d.ts.map +1 -1
- package/dist/cmd/download.js +3 -2
- package/dist/cmd/download.js.map +1 -1
- package/dist/cmd/make.d.ts.map +1 -1
- package/dist/cmd/make.js +26 -10
- package/dist/cmd/make.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/color.d.ts +37 -0
- package/dist/internal/color.d.ts.map +1 -0
- package/dist/internal/color.js +57 -0
- package/dist/internal/color.js.map +1 -0
- package/dist/internal/command-helpers.d.ts.map +1 -1
- package/dist/internal/command-helpers.js +5 -1
- package/dist/internal/command-helpers.js.map +1 -1
- package/dist/internal/context.d.ts +5 -0
- package/dist/internal/context.d.ts.map +1 -1
- package/dist/internal/context.js +5 -0
- package/dist/internal/context.js.map +1 -1
- package/dist/internal/doctor.d.ts +1 -0
- package/dist/internal/doctor.d.ts.map +1 -1
- package/dist/internal/doctor.js +17 -5
- package/dist/internal/doctor.js.map +1 -1
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +13 -4
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/global-options.d.ts.map +1 -1
- package/dist/internal/global-options.js +7 -3
- package/dist/internal/global-options.js.map +1 -1
- package/dist/internal/logger.d.ts.map +1 -1
- package/dist/internal/logger.js +2 -0
- package/dist/internal/logger.js.map +1 -1
- package/dist/internal/oauth-page.d.ts +4 -0
- package/dist/internal/oauth-page.d.ts.map +1 -0
- package/dist/internal/oauth-page.js +67 -0
- package/dist/internal/oauth-page.js.map +1 -0
- package/dist/internal/oauth.d.ts.map +1 -1
- package/dist/internal/oauth.js +10 -35
- package/dist/internal/oauth.js.map +1 -1
- package/dist/internal/output.d.ts +30 -4
- package/dist/internal/output.d.ts.map +1 -1
- package/dist/internal/output.js +96 -13
- package/dist/internal/output.js.map +1 -1
- package/dist/internal/progress.d.ts +62 -0
- package/dist/internal/progress.d.ts.map +1 -0
- package/dist/internal/progress.js +198 -0
- package/dist/internal/progress.js.map +1 -0
- package/dist/internal/runtime.d.ts +16 -1
- package/dist/internal/runtime.d.ts.map +1 -1
- package/dist/internal/runtime.js +22 -7
- package/dist/internal/runtime.js.map +1 -1
- package/dist/internal/task-command.d.ts +0 -1
- package/dist/internal/task-command.d.ts.map +1 -1
- package/dist/internal/task-command.js +40 -10
- package/dist/internal/task-command.js.map +1 -1
- package/dist/internal/update-notifier.d.ts +10 -2
- package/dist/internal/update-notifier.d.ts.map +1 -1
- package/dist/internal/update-notifier.js +13 -6
- package/dist/internal/update-notifier.js.map +1 -1
- package/dist/internal/version.d.ts +10 -0
- package/dist/internal/version.d.ts.map +1 -1
- package/dist/internal/version.js +17 -6
- package/dist/internal/version.js.map +1 -1
- package/dist/internal/views.d.ts +57 -0
- package/dist/internal/views.d.ts.map +1 -0
- package/dist/internal/views.js +570 -0
- package/dist/internal/views.js.map +1 -0
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +4 -1
- package/dist/root.js.map +1 -1
- package/package.json +3 -3
- package/skills/meshy-cli/SKILL.md +11 -3
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Official assets/brand/meshy-wordmark-64.svg from meshy-webapp. Inlined so
|
|
2
|
+
// loopback pages work offline and never send callback URLs to an asset host.
|
|
3
|
+
const WORDMARK = "<svg width=\"167\" height=\"64\" viewBox=\"0 0 167 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M14.2969 22.4252C14.9296 20.9408 15.7192 19.4795 16.6565 18.0801L16.6723 18.0561L16.6724 18.056C16.7744 17.9014 16.8775 17.7485 16.9815 17.5972C23.1414 8.04275 36.3664 2.31737 47.5481 7.38933C56.3853 11.1718 60.6204 18.8956 60.498 25.7723C60.437 29.2014 59.2779 32.5467 56.8846 34.9649C56.475 35.3787 56.0363 35.7582 55.5703 36.1013C57.7296 37.8158 59.1422 39.9011 59.509 42.3375C60.0579 45.9836 58.0909 49.2423 55.3218 51.6463C49.7812 56.4564 39.3989 59.471 27.5725 58.2142C25.6077 58.0356 18.5098 56.6402 16.8938 54.0464C16.0389 53.634 15.2584 53.1452 14.5841 52.5708C13.4789 51.6293 12.566 50.3728 12.2295 48.7882C11.7399 46.4825 13.006 42.5653 15.6349 41.4448C16.5804 46.0878 19.9516 46.3695 22.4549 46.631C23.48 45.7702 23.974 45.2828 25.0058 43.9917C23.0032 44.1533 20.461 43.6072 18.5098 42.5653C14.9307 40.6543 12.7746 37.1443 12.5399 32.1303C12.3074 28.8456 13.0132 25.4374 14.2969 22.4252ZM19.3257 19.1502C19.2237 19.2979 19.1227 19.4475 19.0227 19.599C19.0159 19.6093 19.0091 19.6196 19.0024 19.6299C18.1591 20.8877 17.4512 22.198 16.8865 23.523C16.8888 23.5436 16.8912 23.564 16.8938 23.5844C15.7304 26.3701 15.1861 29.2129 15.3361 31.7683C15.3406 31.8438 15.3456 31.9191 15.3513 31.9942L15.3517 32.0004L15.3505 31.9943L15.3508 32.0006C15.3537 32.0629 15.3569 32.1248 15.3605 32.1863C15.7728 39.2526 20.5964 41.5153 26.5237 41.4448C27.4837 41.4334 28.4727 41.3608 29.4766 41.2375C29.218 42.3503 28.928 43.3138 28.5605 44.1533C28.0339 45.3564 27.3481 46.3046 26.3675 47.0721C29.9008 47.3393 33.7261 46.8181 37.1502 45.7702C41.8806 45.4239 49.2211 42.7116 47.7309 37.4836L47.7311 37.4836C47.7067 37.398 47.6799 37.3117 47.6507 37.2248C47.4908 36.6314 47.2989 36.0541 47.103 35.5078L47.0883 35.4668L47.1054 35.4836C48.1595 35.5872 49.1403 35.5592 50.0454 35.4163C50.1192 35.4047 50.1925 35.3922 50.2654 35.3791C50.4263 35.3499 50.5847 35.3171 50.7407 35.2807C50.9024 35.243 51.0614 35.2014 51.2178 35.156C51.7603 34.9987 52.2704 34.7962 52.7475 34.5531C52.7525 34.5505 52.7576 34.548 52.7626 34.5454C52.7675 34.5429 52.7723 34.5404 52.7771 34.5379L52.7778 34.5376C52.8538 34.4985 52.929 34.4583 53.0034 34.4171C60.5794 30.2211 59.3648 15.4804 46.4105 9.9563C36.7515 5.55601 24.8968 10.4718 19.3257 19.1502ZM50.6458 36.3694C56.408 43.0418 50.7232 49.1011 41.7447 52.4313C45.083 50.2746 47.8237 46.897 49.4745 42.0012C39.4856 51.4511 16.5661 52.4292 15.4975 46.0878C15.4775 45.8653 15.4672 45.6349 15.467 45.3965L15.4674 45.3922C13.1685 49.9102 18.2595 52.7069 25.2308 53.1118C25.2608 53.1136 25.2908 53.1153 25.3208 53.1169C25.4656 53.1249 25.6111 53.1318 25.7575 53.1377C26.506 53.1679 27.2742 53.171 28.0553 53.1463C28.068 53.1459 28.0806 53.1455 28.0932 53.1451C29.2037 53.1086 30.3402 53.016 31.4839 52.8647C35.5957 52.321 39.801 51.0204 43.2255 48.8565C41.3022 50.5283 39.422 51.7472 37.5069 52.641C34.4932 54.0473 31.3927 54.6484 27.9005 54.9412L27.8925 54.9419C27.0891 55.0092 26.265 55.0601 25.4165 55.1008C26.2248 55.2405 27.0369 55.3481 27.849 55.4214C29.1316 55.5582 30.3912 55.6417 31.6236 55.6761C33.9472 55.741 36.1741 55.6314 38.2753 55.3759C53.1632 53.5663 61.7415 44.4381 53.7049 38.2053C53.4313 37.9932 53.1385 37.7844 52.826 37.5793C52.1843 37.1582 51.4596 36.753 50.6486 36.367L50.6408 36.3634L50.6459 36.3693L50.6458 36.3694Z\" fill=\"#C5F955\"/><path d=\"M19.0225 19.599C12.3803 29.6631 14.1483 42.9758 28.4613 40.6167L42.6511 35.9458C55.9407 31.5233 56.5756 17.9711 48.1912 11.9974C41.8377 7.47047 27.1142 7.33981 19.0225 19.599Z\" fill=\"#FF3E8F\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M26.4383 27.5192C32.7413 25.8138 39.4138 18.5659 40.4399 9.27475C38.2573 9.07291 35.8296 9.22115 33.1745 9.8067C25.1824 11.5696 19.5002 17.3888 16.8857 23.5231C17.4163 28.2761 24.7826 27.9679 26.4383 27.5192Z\" fill=\"#C5F955\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M26.4386 27.5189C32.7417 25.8135 38.6419 18.8331 39.668 9.54199L37.8585 9.97477C34.9373 20.4729 26.7086 27.8406 19.3193 25.7888C20.4109 27.812 25.5858 27.7501 26.4386 27.5189Z\" fill=\"#67B800\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M37.9259 11.4835C29.5867 9.8128 19.7545 15.0791 17.4214 24.1638C20.811 17.6581 30.1649 11.7939 37.9259 11.4835Z\" fill=\"#E9FFCE\"/><path d=\"M54.7368 19.8304L41.9563 37.3942L28.9344 40.1436C28.7951 40.2449 28.6701 40.2011 28.6672 40.2001L28.6671 40.2001L28.9344 40.1436C29.1459 39.9899 29.3903 39.5016 29.2899 38.0214C29.0197 37.2546 28.8379 35.4466 27.001 34.217C26.119 33.6265 25.284 32.8413 25.4303 31.7901C25.5747 30.7527 26.5106 30.1377 27.529 29.8929C36.3299 27.7778 40.3974 18.7668 41.3011 10.2524L49.0086 13.5897L54.7368 19.8304Z\" fill=\"#C91C65\"/><path d=\"M46.7106 31.0158C41.3861 28.7257 43.999 18.7334 50.1552 16.376C50.1574 16.379 50.1596 16.382 50.1618 16.3851C46.4076 19.4331 45.7526 26.0359 48.7215 29.1893C48.3034 29.6422 47.8426 30.0896 47.3375 30.5295C47.1375 30.6905 46.9283 30.8527 46.7106 31.0158Z\" fill=\"#4C8700\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M16.1445 34.8384C20.6167 34.2091 27.9044 36.0871 28.1463 40.1365C23.1395 40.4254 17.7411 37.8237 16.1445 34.8384Z\" fill=\"#67B800\"/><path d=\"M16.857 35.8695C17.5197 36.3307 18.4981 36.753 19.8984 37.0541C21.956 37.4965 24.2516 37.2122 25.8732 36.7917C23.3064 35.1051 19.1075 34.4215 16.1445 34.8384C16.3319 35.1887 16.5716 35.5338 16.857 35.8695Z\" fill=\"#C5F955\"/><path d=\"M31.1725 37.3194C31.9135 29.202 43.3748 27.9896 45.236 33.1135C45.3879 33.5731 45.5786 34.0738 45.7801 34.603C46.3298 36.0465 46.9601 37.7018 47.1058 39.312C44.8836 43.3834 37.0854 46.7263 29.6318 47.1054C31.8948 42.3463 31.1725 37.3194 31.1725 37.3194Z\" fill=\"white\"/><path d=\"M44.6534 42.5082L37.1242 45.7714C42.1885 43.1192 42.4495 31.9296 37.0249 33.047L41.5276 31.1294L45.7474 34.7924L44.6534 42.5082Z\" fill=\"#FF97C2\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M46.4099 9.95619C44.8816 9.25999 43.227 8.76152 41.4925 8.50994L41.4928 8.50904L41.4758 8.50751C32.724 7.24649 23.7937 11.8801 19.0877 19.5277C23.7532 13.2644 32.2512 9.63751 39.2848 10.6157C38.6897 14.1588 36.3997 19.4347 32.2512 23.1688C28.1337 26.8749 21.893 28.2729 18.0681 25.9903C20.8877 29.3418 29.4564 28.9125 34.1121 24.8903C38.4773 21.1191 41.1823 15.2248 41.68 11.1229C41.8837 11.1727 42.085 11.2252 42.2837 11.2806C44.4064 11.954 44.9959 13.7805 45.1392 15.0582C45.2339 15.9023 44.7108 16.6389 44.0892 17.2196C42.7729 18.4492 41.4611 20.4329 40.6996 22.5665C39.8401 24.9746 38.694 27.4637 36.6082 28.9492C35.6754 29.6136 34.9353 30.1855 34.3655 30.6836C32.377 31.9947 30.8468 34.1525 30.2531 37.236C30.1676 37.6802 30.1194 37.94 30.0503 38.3261C23.1293 39.7019 16.7498 38.63 15.3498 31.9942C15.7393 40.3701 22.2183 42.1291 29.4759 41.2373C28.8468 43.9451 28.0316 45.7689 26.3669 47.0719C27.6276 47.1673 28.9256 47.1623 30.2292 47.0688C31.3624 45.6652 31.7518 43.1845 32.0846 41.0645L32.0846 41.0644C32.1611 40.5772 32.2346 40.1089 32.3134 39.6772C32.3481 39.4811 32.3861 39.2895 32.4273 39.1025C32.4582 38.9601 32.4904 38.8235 32.5241 38.6935H32.5243C34.6952 30.1632 43.8025 31.6688 44.2444 37.5733C44.2546 37.7102 44.2658 37.8429 44.2767 37.9722C44.476 40.3425 44.5771 41.5452 37.1234 45.7717L37.1227 45.772C41.9294 45.4287 49.4651 42.6323 47.6501 37.2247C47.4862 36.6165 47.2886 36.025 47.0877 35.4667L47.1048 35.4835C60.5721 36.8079 62.0805 16.6386 46.4099 9.95619ZM50.1552 16.3759C43.999 18.7333 41.3861 28.7256 46.7106 31.0157L48.7214 29.1892C45.7526 26.0358 46.4075 19.433 50.1618 16.385L50.1552 16.3759Z\" fill=\"#181818\"/><path d=\"M27.8484 55.4213C50.4664 57.8349 65.9673 43.6488 50.6402 36.3633C56.4111 43.0381 50.7255 49.1 41.7443 52.4312C45.0826 50.2745 47.8233 46.8969 49.4741 42.0011C39.1333 51.784 14.9344 52.4875 15.4671 45.3901C11.2712 53.6348 31.6831 56.1494 43.2248 48.8564C37.5767 53.7659 32.3009 54.7704 25.4159 55.1007C26.2241 55.2404 27.0363 55.348 27.8484 55.4213Z\" fill=\"#181818\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M23.3318 24.1181C22.444 24.0955 21.8465 23.6468 21.9972 23.1159C22.4462 21.5346 22.784 19.1014 22.6058 17.1552C22.5579 16.6322 23.2481 16.1317 24.1473 16.0372C25.0466 15.9427 25.8144 16.29 25.8623 16.8129C26.0553 18.921 25.6947 21.4986 25.2123 23.1978C25.0616 23.7287 24.2197 24.1407 23.3318 24.1181Z\" fill=\"#181818\"/><path d=\"M22.1712 23.7176C22.1712 23.7176 22.7031 24.0384 23.4654 23.6297C24.697 22.9696 24.9843 18.9924 24.9843 16.6696C24.9843 16.042 24.2121 16.0312 24.2121 16.0312C25.0832 15.9596 25.8155 16.3026 25.8623 16.8129C26.0553 18.921 25.6947 21.4986 25.2123 23.1978C25.0616 23.7287 24.2197 24.1407 23.3318 24.1181C22.8182 24.105 22.4018 23.9493 22.1712 23.7176Z\" fill=\"#FF3E8F\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M30.2845 20.9211C29.3967 20.8985 28.7991 20.4497 28.9499 19.9188C29.3988 18.3376 29.7367 15.9044 29.5584 13.9581C29.5106 13.4352 30.2007 12.9347 31.1 12.8402C31.9992 12.7457 32.767 13.093 32.8149 13.6159C33.008 15.724 32.6474 18.3015 32.1649 20.0007C32.0142 20.5316 31.1723 20.9437 30.2845 20.9211Z\" fill=\"#181818\"/><path d=\"M29.1238 20.5206C29.1238 20.5206 29.6557 20.8414 30.418 20.4327C31.6496 19.7725 31.9369 15.7954 31.9369 13.4725C31.9369 12.845 31.1647 12.8341 31.1647 12.8341C32.0358 12.7625 32.7682 13.1056 32.8149 13.6159C33.008 15.724 32.6474 18.3015 32.1649 20.0007C32.0142 20.5316 31.1723 20.9437 30.2845 20.9211C29.7709 20.908 29.3544 20.7523 29.1238 20.5206Z\" fill=\"#FF3E8F\"/><path d=\"M11.9473 5.5L13.2806 9.12726L16.8839 10.4695L13.2806 11.8117L11.9473 15.4389L10.614 11.8117L7.01074 10.4695L10.614 9.12726L11.9473 5.5Z\" fill=\"#C5F955\"/><path d=\"M6.3143 14.8867L7.07442 16.969L9.1286 17.7396L7.07442 18.5101L6.3143 20.5924L5.55418 18.5101L3.5 17.7396L5.55418 16.969L6.3143 14.8867Z\" fill=\"#C5F955\"/><path class=\"meshy-wordmark-letters\" d=\"M74.24 53V11.84H81.912L85.216 33.176L85.496 35.36H85.608L85.888 33.176L89.192 11.84H96.864V53H91.264V25.392H90.928L90.704 27.128L87.12 53H83.984L80.4 27.128L80.176 25.392H79.84V53H74.24ZM107.525 53.448C105.266 53.448 103.484 52.6733 102.177 51.124C100.889 49.556 100.245 47.6427 100.245 45.384V29.984C100.245 27.5947 100.889 25.6533 102.177 24.16C103.465 22.6667 105.266 21.92 107.581 21.92C109.093 21.92 110.39 22.2653 111.473 22.956C112.574 23.6467 113.414 24.5893 113.993 25.784C114.572 26.96 114.861 28.304 114.861 29.816V38.72H105.509V45.384C105.509 46.1493 105.677 46.8587 106.013 47.512C106.368 48.1467 106.89 48.464 107.581 48.464C108.309 48.464 108.822 48.1653 109.121 47.568C109.438 46.9707 109.597 46.2427 109.597 45.384V42.024H114.861V45.552C114.861 47.9227 114.217 49.836 112.929 51.292C111.66 52.7293 109.858 53.448 107.525 53.448ZM105.509 34.296H109.597V29.984C109.597 29.144 109.448 28.416 109.149 27.8C108.869 27.1653 108.346 26.848 107.581 26.848C106.872 26.848 106.349 27.1747 106.013 27.828C105.677 28.4627 105.509 29.1813 105.509 29.984V34.296ZM124.486 53.448C123.161 53.448 122.003 53.224 121.014 52.776C120.025 52.328 119.203 51.6933 118.55 50.872C117.897 50.032 117.402 49.0427 117.066 47.904C116.749 46.7653 116.59 45.496 116.59 44.096H121.854C121.854 45.3467 122.05 46.4387 122.442 47.372C122.853 48.2867 123.534 48.744 124.486 48.744C125.307 48.744 125.839 48.3987 126.082 47.708C126.325 47.0173 126.446 46.224 126.446 45.328C126.446 44.2827 126.035 43.2187 125.214 42.136C124.411 41.0347 123.571 40.0547 122.694 39.196C121.182 37.7027 119.922 36.228 118.914 34.772C117.925 33.316 117.43 31.608 117.43 29.648C117.43 27.3333 118.037 25.4667 119.25 24.048C120.463 22.6293 122.19 21.92 124.43 21.92C125.774 21.92 126.903 22.0973 127.818 22.452C128.751 22.8067 129.498 23.3387 130.058 24.048C130.618 24.7573 131.019 25.6253 131.262 26.652C131.523 27.6787 131.654 28.864 131.654 30.208H126.39C126.39 29.2373 126.287 28.3973 126.082 27.688C125.877 26.9787 125.363 26.624 124.542 26.624C123.87 26.624 123.394 26.9133 123.114 27.492C122.834 28.052 122.694 28.7707 122.694 29.648C122.694 30.6747 122.937 31.5893 123.422 32.392C123.926 33.176 124.757 34.1373 125.914 35.276C127.37 36.6947 128.695 38.2067 129.89 39.812C131.103 41.4173 131.71 43.1627 131.71 45.048C131.71 46.28 131.542 47.4093 131.206 48.436C130.889 49.4627 130.413 50.3493 129.778 51.096C129.162 51.8427 128.406 52.4213 127.51 52.832C126.633 53.2427 125.625 53.448 124.486 53.448ZM133.939 53V11.84H139.595V24.468C140.08 23.964 140.799 23.4133 141.751 22.816C142.703 22.2187 143.608 21.92 144.467 21.92C145.4 21.92 146.184 22.1907 146.819 22.732C147.454 23.2733 147.93 24.0013 148.247 24.916C148.564 25.812 148.723 26.8107 148.723 27.912V53H143.067V29.088C143.067 28.528 142.936 28.08 142.675 27.744C142.432 27.3893 142.143 27.212 141.807 27.212C141.415 27.212 140.948 27.436 140.407 27.884C139.866 28.3133 139.595 28.7987 139.595 29.34V53H133.939ZM152.64 63.976C152.398 63.976 152.108 63.9667 151.772 63.948C151.436 63.9293 151.11 63.892 150.792 63.836V58.824C150.848 58.8427 150.998 58.8613 151.24 58.88C151.483 58.9173 151.642 58.936 151.716 58.936C152.762 58.936 153.602 58.656 154.236 58.096C154.89 57.536 155.347 56.7893 155.608 55.856C155.702 55.576 155.748 55.2493 155.748 54.876C155.767 54.5027 155.776 54.176 155.776 53.896L150.568 22.368H156.112L158.352 41.464L158.464 43.592H158.688L158.8 41.464L161.04 22.368H166.584L161.152 55.296C160.947 56.9387 160.48 58.4133 159.752 59.72C159.043 61.0453 158.091 62.0813 156.896 62.828C155.702 63.5933 154.283 63.976 152.64 63.976Z\" fill=\"#C5F955\"/></svg>";
|
|
4
|
+
const COPY = {
|
|
5
|
+
en: {
|
|
6
|
+
authorized: "Meshy CLI authorized",
|
|
7
|
+
canceled: "Connection canceled",
|
|
8
|
+
error: "Unable to connect",
|
|
9
|
+
next: "Return to your terminal to continue. You can close this tab.",
|
|
10
|
+
canceledNext: "No access was granted. You can close this tab.",
|
|
11
|
+
retry: "Return to your terminal and try signing in again.",
|
|
12
|
+
details: "Error details",
|
|
13
|
+
back: "Back to Meshy",
|
|
14
|
+
},
|
|
15
|
+
zh: {
|
|
16
|
+
authorized: "已授权 Meshy CLI",
|
|
17
|
+
canceled: "连接已取消",
|
|
18
|
+
error: "无法完成连接",
|
|
19
|
+
next: "请回到终端继续操作。此页面可以关闭。",
|
|
20
|
+
canceledNext: "未授予访问权限。此页面可以关闭。",
|
|
21
|
+
retry: "请回到终端,重新发起登录。",
|
|
22
|
+
details: "错误详情",
|
|
23
|
+
back: "返回 Meshy",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
function escapeHtml(text) {
|
|
27
|
+
return text.replace(/&/g, "&").replace(/</g, "<")
|
|
28
|
+
.replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
29
|
+
}
|
|
30
|
+
export function renderCallbackPage(status, message = "", acceptLanguage = "") {
|
|
31
|
+
const locale = /^zh\b/i.test(acceptLanguage.trim()) ? "zh" : "en";
|
|
32
|
+
const copy = COPY[locale];
|
|
33
|
+
const title = copy[status];
|
|
34
|
+
const description = status === "authorized" ? copy.next : status === "canceled" ? copy.canceledNext : copy.retry;
|
|
35
|
+
const glyph = status === "authorized" ? '<path d="m6 12 4 4 8-8"/>' : '<path d="m7 7 10 10M17 7 7 17"/>';
|
|
36
|
+
return `<!doctype html>
|
|
37
|
+
<html lang="${locale}">
|
|
38
|
+
<head>
|
|
39
|
+
<meta charset="utf-8">
|
|
40
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
41
|
+
<meta name="referrer" content="no-referrer">
|
|
42
|
+
<title>Meshy — ${title}</title>
|
|
43
|
+
<style>
|
|
44
|
+
*{box-sizing:border-box}html{color-scheme:dark}body{margin:0;background:#0e0e0e;color:#dedede;font:14px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif}
|
|
45
|
+
main{position:relative;isolation:isolate;min-height:100svh;display:grid;place-items:center;padding:40px 20px;background:radial-gradient(ellipse 85% 65% at 50% 0%,#c5f95526,transparent 75%),radial-gradient(ellipse 440px 380px at 50% 42%,#c5f95508,transparent)}
|
|
46
|
+
main::before{content:"";position:absolute;z-index:-1;inset:0;pointer-events:none;opacity:.4;background-image:linear-gradient(to right,#3f3f3f 1px,transparent 1px),linear-gradient(to bottom,#3f3f3f 1px,transparent 1px);background-position:center top;background-size:56px 56px;-webkit-mask-image:linear-gradient(to bottom,black,transparent 85%);mask-image:linear-gradient(to bottom,black,transparent 85%)}
|
|
47
|
+
.flow{width:100%;max-width:440px}.brand{display:flex;justify-content:center;margin-bottom:32px}.brand svg{height:56px;width:auto}
|
|
48
|
+
.surface{border:1px solid #303030;border-radius:28px;background:radial-gradient(ellipse 90% 260px at 50% 0%,#c5f9550b,transparent),#1e1e1e;padding:36px;text-align:center;box-shadow:inset 0 1px 0 #ffffff0f,0 24px 80px #00000040}
|
|
49
|
+
.symbol{display:grid;place-items:center;width:56px;height:56px;margin:0 auto;color:#c5f955;border:1px solid #c5f95533;border-radius:18px;background:#c5f9550d}.symbol svg{width:30px;height:30px}
|
|
50
|
+
[data-status="error"] .symbol{color:#f55959;border-color:#664343;background:#292222}[data-status="canceled"] .symbol{color:#9b9b9b;border-color:#3f3f3f;background:#262626}
|
|
51
|
+
h1{margin:24px 0 12px;color:white;font-size:24px;font-weight:600;line-height:1.3;letter-spacing:-.025em;text-wrap:balance}p{margin:0;color:#9b9b9b;text-wrap:pretty}
|
|
52
|
+
.back{display:inline-block;margin-top:28px;color:#9b9b9b;text-underline-offset:4px}.back:hover{color:white}:focus-visible{outline:2px solid #c5f955;outline-offset:4px}
|
|
53
|
+
details{margin-top:24px;text-align:left;color:#9b9b9b;font-size:12px}summary{cursor:pointer;text-align:center;list-style:none}summary::-webkit-details-marker{display:none}summary:hover{color:#dedede}summary::after{content:"";display:inline-block;width:5px;height:5px;margin-left:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg);transition:transform 150ms ease}details[open] summary::after{transform:translateY(1px) rotate(225deg)}.detail{margin-top:12px;overflow-wrap:anywhere}code{display:block;margin-top:24px;padding:12px;border-radius:12px;background:#181818;color:#dedede;font-size:14px}
|
|
54
|
+
@media(max-width:480px){.surface{padding:32px 24px}}
|
|
55
|
+
</style>
|
|
56
|
+
</head>
|
|
57
|
+
<body><main><div class="flow">
|
|
58
|
+
<div class="brand" role="img" aria-label="Meshy">${WORDMARK}</div>
|
|
59
|
+
<section class="surface" data-status="${status}" aria-labelledby="result-title">
|
|
60
|
+
<div class="symbol" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${glyph}</svg></div>
|
|
61
|
+
<h1 id="result-title">${title}</h1><p>${description}</p>
|
|
62
|
+
${status === "error" ? '<code>meshy auth login</code>' : ""}
|
|
63
|
+
${status === "error" && message ? `<details><summary>${copy.details}</summary><p class="detail">${escapeHtml(message)}</p></details>` : ""}
|
|
64
|
+
<a class="back" href="https://www.meshy.ai/" rel="noreferrer">${copy.back}</a>
|
|
65
|
+
</section></div></main></body></html>`;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=oauth-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-page.js","sourceRoot":"","sources":["../../src/internal/oauth-page.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,6EAA6E;AAC7E,MAAM,QAAQ,GAAG,iraAAira,CAAC;AAEnsa,MAAM,IAAI,GAAG;IACX,EAAE,EAAE;QACF,UAAU,EAAE,sBAAsB;QAClC,QAAQ,EAAE,qBAAqB;QAC/B,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,8DAA8D;QACpE,YAAY,EAAE,gDAAgD;QAC9D,KAAK,EAAE,mDAAmD;QAC1D,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QAC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AK,WAAW,WAAW;EACjD,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE;EACzD,MAAM,KAAK,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,qBAAqB,IAAI,CAAC,OAAO,+BAA+B,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;gEAC1E,IAAI,CAAC,IAAI;sCACnC,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/internal/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/internal/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAS3C,oEAAoE;AACpE,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAMD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CASzE;AAMD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,E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@@ -18,6 +18,7 @@ import { createServer } from "node:http";
|
|
|
18
18
|
import { spawn } from "node:child_process";
|
|
19
19
|
import { HintedError } from "./errors.js";
|
|
20
20
|
import { USER_AGENT } from "./user-agent.js";
|
|
21
|
+
import { renderCallbackPage } from "./oauth-page.js";
|
|
21
22
|
// ---------------------------------------------------------------------------
|
|
22
23
|
// PKCE helpers
|
|
23
24
|
// ---------------------------------------------------------------------------
|
|
@@ -47,38 +48,7 @@ export function buildAuthorizeUrl(params) {
|
|
|
47
48
|
url.searchParams.set("code_challenge_method", "S256");
|
|
48
49
|
return url.toString();
|
|
49
50
|
}
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// HTML helpers
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
/** Escape characters that are special in HTML to prevent reflected XSS. */
|
|
54
|
-
function escapeHtml(text) {
|
|
55
|
-
return text
|
|
56
|
-
.replace(/&/g, "&")
|
|
57
|
-
.replace(/</g, "<")
|
|
58
|
-
.replace(/>/g, ">")
|
|
59
|
-
.replace(/"/g, """)
|
|
60
|
-
.replace(/'/g, "'");
|
|
61
|
-
}
|
|
62
51
|
const CALLBACK_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
|
|
63
|
-
const SUCCESS_HTML = `<!DOCTYPE html>
|
|
64
|
-
<html lang="en">
|
|
65
|
-
<head><meta charset="utf-8"><title>Meshy — Login successful</title></head>
|
|
66
|
-
<body>
|
|
67
|
-
<h1>Login successful</h1>
|
|
68
|
-
<p>You can close this tab and return to the terminal.</p>
|
|
69
|
-
</body>
|
|
70
|
-
</html>`;
|
|
71
|
-
function errorHtml(msg) {
|
|
72
|
-
return `<!DOCTYPE html>
|
|
73
|
-
<html lang="en">
|
|
74
|
-
<head><meta charset="utf-8"><title>Meshy — Login failed</title></head>
|
|
75
|
-
<body>
|
|
76
|
-
<h1>Login failed</h1>
|
|
77
|
-
<p>${escapeHtml(msg)}</p>
|
|
78
|
-
<p>Return to the terminal for details.</p>
|
|
79
|
-
</body>
|
|
80
|
-
</html>`;
|
|
81
|
-
}
|
|
82
52
|
/**
|
|
83
53
|
* Starts a loopback HTTP server bound to 127.0.0.1 only.
|
|
84
54
|
*
|
|
@@ -122,6 +92,10 @@ export function startCallbackServer(preferredPort, expectedState) {
|
|
|
122
92
|
res.end("Not found");
|
|
123
93
|
return;
|
|
124
94
|
}
|
|
95
|
+
res.setHeader("Cache-Control", "no-store");
|
|
96
|
+
res.setHeader("Referrer-Policy", "no-referrer");
|
|
97
|
+
res.setHeader("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'");
|
|
98
|
+
const language = req.headers["accept-language"];
|
|
125
99
|
const code = url.searchParams.get("code") ?? undefined;
|
|
126
100
|
const state = url.searchParams.get("state") ?? undefined;
|
|
127
101
|
const error = url.searchParams.get("error") ?? undefined;
|
|
@@ -129,7 +103,7 @@ export function startCallbackServer(preferredPort, expectedState) {
|
|
|
129
103
|
if (error) {
|
|
130
104
|
const msg = errorDescription ?? error;
|
|
131
105
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
132
|
-
res.end(
|
|
106
|
+
res.end(renderCallbackPage(error === "access_denied" ? "canceled" : "error", msg, language));
|
|
133
107
|
settle(new HintedError({
|
|
134
108
|
message: `Authorization denied: ${msg}`,
|
|
135
109
|
code: "oauth_denied",
|
|
@@ -140,7 +114,7 @@ export function startCallbackServer(preferredPort, expectedState) {
|
|
|
140
114
|
// State verification: reject mismatches before showing any success page.
|
|
141
115
|
if (state !== expectedState) {
|
|
142
116
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
143
|
-
res.end(
|
|
117
|
+
res.end(renderCallbackPage("error", "OAuth state mismatch. Start a new login from your terminal.", language));
|
|
144
118
|
settle(new HintedError({
|
|
145
119
|
message: "OAuth state mismatch — possible CSRF attack. Run: meshy auth login",
|
|
146
120
|
code: "oauth_state_mismatch",
|
|
@@ -154,7 +128,7 @@ export function startCallbackServer(preferredPort, expectedState) {
|
|
|
154
128
|
// the user while the terminal fails with oauth_no_code.
|
|
155
129
|
if (!code) {
|
|
156
130
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
157
|
-
res.end(
|
|
131
|
+
res.end(renderCallbackPage("error", "No authorization code received. Start a new login from your terminal.", language));
|
|
158
132
|
settle(new HintedError({
|
|
159
133
|
message: "No authorization code received from the callback.",
|
|
160
134
|
code: "oauth_no_code",
|
|
@@ -163,7 +137,8 @@ export function startCallbackServer(preferredPort, expectedState) {
|
|
|
163
137
|
return;
|
|
164
138
|
}
|
|
165
139
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
166
|
-
|
|
140
|
+
// Receiving a code precedes token exchange and credential persistence.
|
|
141
|
+
res.end(renderCallbackPage("authorized", "", language));
|
|
167
142
|
settle({ code, state });
|
|
168
143
|
});
|
|
169
144
|
function tryListen(port, fallback) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/internal/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/internal/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,KAAK,EAAE,MAA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;QACtB,YAAY,EAAE,MAAM,CAAC,WAAW;KACjC,CAAC,CAAC;AACL,CAAC;AAOD,+CAA+C;AAC/C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAA2B;IAC7D,OAAO,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE;QACjC,UAAU,EAAE,eAAe;QAC3B,aAAa,EAAE,MAAM,CAAC,YAAY;QAClC,SAAS,EAAE,WAAW;KACvB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Output rendering.
|
|
3
|
-
*
|
|
2
|
+
* Output rendering.
|
|
3
|
+
*
|
|
4
|
+
* `--format` defaults to the shape the destination can actually use: `pretty`
|
|
5
|
+
* when stdout is a TTY (a human typed the command), `json` otherwise — piped,
|
|
6
|
+
* redirected, or spawned as a subprocess, which covers every agent, script and
|
|
7
|
+
* CI run. This is the `gh` / `npm` / `kubectl` convention; printing raw JSON
|
|
8
|
+
* braces at a person is the `aws` one. Nothing about the machine contract
|
|
9
|
+
* moves: a pipe still gets exactly the same bytes as before, and `--format
|
|
10
|
+
* json` / `--json` still force it.
|
|
4
11
|
*
|
|
5
12
|
* Legacy path (`emit`): bare payloads, optionally decorated with
|
|
6
13
|
* `_notice.update` when a newer meshy-cli version is available. See
|
|
@@ -10,6 +17,7 @@
|
|
|
10
17
|
* the six top-level keys are the contract. Humans on a TTY still get the
|
|
11
18
|
* update hint on stderr.
|
|
12
19
|
*/
|
|
20
|
+
import { type Painter } from "./color.js";
|
|
13
21
|
import type { StreamEventEnvelope, V1Envelope } from "./result.js";
|
|
14
22
|
export type OutputFormat = "json" | "pretty" | "ndjson";
|
|
15
23
|
export interface OutputOptions {
|
|
@@ -25,9 +33,27 @@ export declare function emit(value: unknown, opts: OutputOptions): void;
|
|
|
25
33
|
export declare function writeStdout(text: string): Promise<void>;
|
|
26
34
|
/** Print one v1 envelope in the requested rendering. */
|
|
27
35
|
export declare function emitEnvelope(envelope: V1Envelope, format: OutputFormat): Promise<void>;
|
|
36
|
+
/** `warning: …` lines on stderr, painted for stderr. */
|
|
37
|
+
export declare function printWarnings(warnings: ReadonlyArray<{
|
|
38
|
+
message: string;
|
|
39
|
+
}>): void;
|
|
28
40
|
/** Print one stream event (ndjson only; json/pretty callers print the final envelope instead). */
|
|
29
41
|
export declare function emitStreamEvent(event: StreamEventEnvelope): Promise<void>;
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The raw renderings. `pretty` here is the generic dump; what a person sees
|
|
44
|
+
* goes through the per-command views in views.ts (emit / emitEnvelope).
|
|
45
|
+
*
|
|
46
|
+
* `paint` defaults to plain: a caller that does not say where the text is going
|
|
47
|
+
* gets no escapes. Only the stdout paths opt in — a file must never receive
|
|
48
|
+
* them, or `--format pretty -o notes.txt` writes control codes to disk.
|
|
49
|
+
*/
|
|
50
|
+
export declare function render(value: unknown, format: OutputFormat, paint?: Painter): string;
|
|
51
|
+
export declare function renderPretty(value: unknown, indent?: number, paint?: Painter): string;
|
|
52
|
+
/**
|
|
53
|
+
* The format to use when `--format` was not given. A TTY means a person is
|
|
54
|
+
* reading; anything else is a pipe, a file or a subprocess, and must keep
|
|
55
|
+
* getting JSON.
|
|
56
|
+
*/
|
|
57
|
+
export declare function defaultOutputFormat(isTTY?: boolean): OutputFormat;
|
|
32
58
|
export declare function parseOutputFormat(raw: string | undefined): OutputFormat;
|
|
33
59
|
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/internal/output.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/internal/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAG7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,UA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output rendering.
|
|
3
|
+
*
|
|
4
|
+
* `--format` defaults to the shape the destination can actually use: `pretty`
|
|
5
|
+
* when stdout is a TTY (a human typed the command), `json` otherwise — piped,
|
|
6
|
+
* redirected, or spawned as a subprocess, which covers every agent, script and
|
|
7
|
+
* CI run. This is the `gh` / `npm` / `kubectl` convention; printing raw JSON
|
|
8
|
+
* braces at a person is the `aws` one. Nothing about the machine contract
|
|
9
|
+
* moves: a pipe still gets exactly the same bytes as before, and `--format
|
|
10
|
+
* json` / `--json` still force it.
|
|
4
11
|
*
|
|
5
12
|
* Legacy path (`emit`): bare payloads, optionally decorated with
|
|
6
13
|
* `_notice.update` when a newer meshy-cli version is available. See
|
|
@@ -12,10 +19,14 @@
|
|
|
12
19
|
*/
|
|
13
20
|
import { writeFileSync } from "node:fs";
|
|
14
21
|
import { attachUpdateNotice, getUpdateNotice, printHumanUpdateHint } from "./update-notifier.js";
|
|
22
|
+
import { painterFor, plain } from "./color.js";
|
|
23
|
+
import { currentCommand } from "./context.js";
|
|
24
|
+
import { renderView } from "./views.js";
|
|
15
25
|
export function emit(value, opts) {
|
|
16
26
|
const notice = getUpdateNotice();
|
|
17
27
|
const decorated = attachUpdateNotice(value, opts.format, notice);
|
|
18
|
-
const
|
|
28
|
+
const paint = opts.file ? plain : painterFor(process.stdout);
|
|
29
|
+
const text = opts.format === "pretty" ? pretty(decorated, paint) : render(decorated, opts.format, paint);
|
|
19
30
|
if (opts.file) {
|
|
20
31
|
writeFileSync(opts.file, text.endsWith("\n") ? text : `${text}\n`, "utf8");
|
|
21
32
|
}
|
|
@@ -42,15 +53,38 @@ export function writeStdout(text) {
|
|
|
42
53
|
}
|
|
43
54
|
/** Print one v1 envelope in the requested rendering. */
|
|
44
55
|
export async function emitEnvelope(envelope, format) {
|
|
45
|
-
const
|
|
56
|
+
const paint = painterFor(process.stdout);
|
|
57
|
+
const text = format === "pretty" ? pretty(envelope, paint) : render(envelope, format, paint);
|
|
46
58
|
await writeStdout(`${text}\n`);
|
|
59
|
+
// A person reads warnings as prose; the envelope keeps them for machines.
|
|
60
|
+
if (format === "pretty")
|
|
61
|
+
printWarnings(envelope.warnings);
|
|
47
62
|
printHumanUpdateHint(getUpdateNotice(), process);
|
|
48
63
|
}
|
|
64
|
+
/** `warning: …` lines on stderr, painted for stderr. */
|
|
65
|
+
export function printWarnings(warnings) {
|
|
66
|
+
const paint = painterFor(process.stderr);
|
|
67
|
+
for (const w of warnings)
|
|
68
|
+
process.stderr.write(`${paint("warning:", "yellow")} ${w.message}\n`);
|
|
69
|
+
}
|
|
70
|
+
/** The per-command human view (views.ts) for the command that is running. */
|
|
71
|
+
function pretty(value, paint) {
|
|
72
|
+
const ctx = currentCommand();
|
|
73
|
+
return renderView(ctx?.command, value, paint, ctx?.view);
|
|
74
|
+
}
|
|
49
75
|
/** Print one stream event (ndjson only; json/pretty callers print the final envelope instead). */
|
|
50
76
|
export async function emitStreamEvent(event) {
|
|
51
77
|
await writeStdout(`${JSON.stringify(event)}\n`);
|
|
52
78
|
}
|
|
53
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The raw renderings. `pretty` here is the generic dump; what a person sees
|
|
81
|
+
* goes through the per-command views in views.ts (emit / emitEnvelope).
|
|
82
|
+
*
|
|
83
|
+
* `paint` defaults to plain: a caller that does not say where the text is going
|
|
84
|
+
* gets no escapes. Only the stdout paths opt in — a file must never receive
|
|
85
|
+
* them, or `--format pretty -o notes.txt` writes control codes to disk.
|
|
86
|
+
*/
|
|
87
|
+
export function render(value, format, paint = plain) {
|
|
54
88
|
switch (format) {
|
|
55
89
|
case "json":
|
|
56
90
|
return JSON.stringify(value, null, 2);
|
|
@@ -59,34 +93,83 @@ export function render(value, format) {
|
|
|
59
93
|
return value.map((v) => JSON.stringify(v)).join("\n");
|
|
60
94
|
return JSON.stringify(value);
|
|
61
95
|
case "pretty":
|
|
62
|
-
return renderPretty(value);
|
|
96
|
+
return renderPretty(value, 0, paint);
|
|
63
97
|
}
|
|
64
98
|
}
|
|
65
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Values whose meaning a reader scans for rather than reads: task and check
|
|
101
|
+
* states. Matched case-insensitively on the whole value, so a prompt or a
|
|
102
|
+
* model name containing the word is never repainted.
|
|
103
|
+
*/
|
|
104
|
+
const VALUE_STYLES = {
|
|
105
|
+
ok: "green",
|
|
106
|
+
pass: "green",
|
|
107
|
+
passed: "green",
|
|
108
|
+
succeeded: "green",
|
|
109
|
+
success: "green",
|
|
110
|
+
ready: "green",
|
|
111
|
+
true: "green",
|
|
112
|
+
fail: "red",
|
|
113
|
+
failed: "red",
|
|
114
|
+
error: "red",
|
|
115
|
+
false: "red",
|
|
116
|
+
skipped: "yellow",
|
|
117
|
+
pending: "yellow",
|
|
118
|
+
in_progress: "yellow",
|
|
119
|
+
canceled: "yellow",
|
|
120
|
+
cancelled: "yellow",
|
|
121
|
+
warn: "yellow",
|
|
122
|
+
warning: "yellow",
|
|
123
|
+
};
|
|
124
|
+
function paintScalar(v, paint) {
|
|
125
|
+
if (v === null || v === undefined)
|
|
126
|
+
return paint("-", "dim");
|
|
127
|
+
const text = String(v);
|
|
128
|
+
const style = VALUE_STYLES[text.toLowerCase()];
|
|
129
|
+
return style ? paint(text, style) : text;
|
|
130
|
+
}
|
|
131
|
+
export function renderPretty(value, indent = 0, paint = plain) {
|
|
66
132
|
const pad = " ".repeat(indent);
|
|
67
133
|
if (value === null || value === undefined)
|
|
68
|
-
return `${pad}
|
|
134
|
+
return `${pad}${paint("-", "dim")}`;
|
|
69
135
|
if (typeof value !== "object")
|
|
70
|
-
return `${pad}${
|
|
136
|
+
return `${pad}${paintScalar(value, paint)}`;
|
|
71
137
|
if (Array.isArray(value)) {
|
|
72
138
|
if (value.length === 0)
|
|
73
139
|
return `${pad}[]`;
|
|
74
|
-
return value.map((v) => `${pad}- ${renderPretty(v, indent + 1).trimStart()}`).join("\n");
|
|
140
|
+
return value.map((v) => `${pad}${paint("-", "dim")} ${renderPretty(v, indent + 1, paint).trimStart()}`).join("\n");
|
|
75
141
|
}
|
|
76
142
|
const entries = Object.entries(value);
|
|
77
143
|
if (entries.length === 0)
|
|
78
144
|
return `${pad}{}`;
|
|
79
145
|
return entries
|
|
80
146
|
.map(([k, v]) => {
|
|
147
|
+
const key = paint(`${k}:`, "dim");
|
|
81
148
|
if (v !== null && typeof v === "object") {
|
|
82
|
-
|
|
149
|
+
// An empty array/object reads as `warnings: []`, not a dangling key
|
|
150
|
+
// with `[]` on the next line. Only matters now that pretty is what a
|
|
151
|
+
// person sees by default.
|
|
152
|
+
const nested = renderPretty(v, indent + 1, paint);
|
|
153
|
+
if (nested.trim() === "[]" || nested.trim() === "{}")
|
|
154
|
+
return `${pad}${key} ${nested.trim()}`;
|
|
155
|
+
return `${pad}${key}\n${nested}`;
|
|
83
156
|
}
|
|
84
|
-
return `${pad}${
|
|
157
|
+
return `${pad}${key} ${paintScalar(v, paint)}`;
|
|
85
158
|
})
|
|
86
159
|
.join("\n");
|
|
87
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* The format to use when `--format` was not given. A TTY means a person is
|
|
163
|
+
* reading; anything else is a pipe, a file or a subprocess, and must keep
|
|
164
|
+
* getting JSON.
|
|
165
|
+
*/
|
|
166
|
+
export function defaultOutputFormat(isTTY = Boolean(process.stdout.isTTY)) {
|
|
167
|
+
return isTTY ? "pretty" : "json";
|
|
168
|
+
}
|
|
88
169
|
export function parseOutputFormat(raw) {
|
|
89
|
-
|
|
170
|
+
if (raw === undefined)
|
|
171
|
+
return defaultOutputFormat();
|
|
172
|
+
const v = raw.toLowerCase();
|
|
90
173
|
if (v === "json" || v === "pretty" || v === "ndjson")
|
|
91
174
|
return v;
|
|
92
175
|
throw new Error(`invalid --format '${raw}'. Expected: json | pretty | ndjson`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/internal/output.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/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;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAK,GAAY,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAChF,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAuB;IACvD,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,mBAAmB,EAAE,CAAC;IACpD,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAC5B,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IAC/D,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,qCAAqC,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress on stderr while a task runs.
|
|
3
|
+
*
|
|
4
|
+
* The mode follows where stderr goes, never a flag:
|
|
5
|
+
* - live: stderr is a terminal (not CI, not TERM=dumb). One line is redrawn
|
|
6
|
+
* in place — spinner, status, clock — and frozen as a ✓ / ✗ line
|
|
7
|
+
* when the step ends, so finished steps stay on screen.
|
|
8
|
+
* - lines: anything else (agents, CI, `2> log`). One plain line per step
|
|
9
|
+
* start, per status or percentage change, and per step end. Same
|
|
10
|
+
* text 0.3.x printed, minus the repeat on every poll.
|
|
11
|
+
* - off: `--format ndjson`: its consumers read events, and stderr stays quiet.
|
|
12
|
+
*
|
|
13
|
+
* Only stderr is ever written. Nothing here is a machine contract — the skill
|
|
14
|
+
* docs tell agents never to scrape it.
|
|
15
|
+
*/
|
|
16
|
+
import type { OutputFormat } from "./output.js";
|
|
17
|
+
export type ProgressMode = "live" | "lines" | "off";
|
|
18
|
+
export type ProgressOutcome = "ok" | "failed" | "timeout";
|
|
19
|
+
export interface ProgressStream {
|
|
20
|
+
isTTY?: boolean;
|
|
21
|
+
columns?: number;
|
|
22
|
+
write(chunk: string): unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface ProgressStep {
|
|
25
|
+
/** What the step is, e.g. `[1/2] text-to-3d preview (geometry)`. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Resource id for lines-mode status lines: `[text-to-3d] IN_PROGRESS 42%`. */
|
|
28
|
+
resource: string;
|
|
29
|
+
taskId?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Progress {
|
|
32
|
+
readonly mode: ProgressMode;
|
|
33
|
+
start(step: ProgressStep): void;
|
|
34
|
+
tick(status: string | null | undefined, pct?: number | null): void;
|
|
35
|
+
/** End the step. `detail` replaces the outcome word (e.g. the FAILED status). */
|
|
36
|
+
finish(outcome: ProgressOutcome, detail?: string): void;
|
|
37
|
+
/** Erase the live line without ending the step; the next frame redraws it. */
|
|
38
|
+
clear(): void;
|
|
39
|
+
/** Stop the clock and erase the live line; the step is abandoned. */
|
|
40
|
+
stop(): void;
|
|
41
|
+
}
|
|
42
|
+
export interface ProgressOptions {
|
|
43
|
+
stream?: ProgressStream;
|
|
44
|
+
env?: NodeJS.ProcessEnv;
|
|
45
|
+
/** Show nothing unless live (downloads: fast, and never announced before). */
|
|
46
|
+
liveOnly?: boolean;
|
|
47
|
+
/** Test hooks. */
|
|
48
|
+
now?: () => number;
|
|
49
|
+
intervalMs?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare function progressMode(format: OutputFormat, stream?: {
|
|
52
|
+
isTTY?: boolean;
|
|
53
|
+
}, env?: NodeJS.ProcessEnv): ProgressMode;
|
|
54
|
+
export declare function clearActiveProgress(): void;
|
|
55
|
+
export declare function stopActiveProgress(): void;
|
|
56
|
+
export declare function createProgress(format: OutputFormat, opts?: ProgressOptions): Progress;
|
|
57
|
+
/**
|
|
58
|
+
* Run `fn` under a live-only spinner (downloads). The spinner is erased, not
|
|
59
|
+
* frozen: the result view lists what was saved. Agents and logs see nothing new.
|
|
60
|
+
*/
|
|
61
|
+
export declare function withSpinner<T>(format: OutputFormat, label: string, fn: () => Promise<T>): Promise<T>;
|
|
62
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/internal/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AACpD,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACnE,iFAAiF;IACjF,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD,8EAA8E;IAC9E,KAAK,IAAI,IAAI,CAAC;IACd,qEAAqE;IACrE,IAAI,IAAI,IAAI,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,G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