{"id":18986,"date":"2025-01-20T22:17:05","date_gmt":"2025-01-20T14:17:05","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=18986"},"modified":"2025-01-20T22:17:05","modified_gmt":"2025-01-20T14:17:05","slug":"shortest","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/pt\/shortest\/","title":{"rendered":"Shortest\uff1aAI\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884c\u7aef\u5230\u7aef\u6d4b\u8bd5"},"content":{"rendered":"<p>Shortest\u662f\u4e00\u4e2a\u7531Anti-Work\u56e2\u961f\u5f00\u53d1\u7684AI\u9a71\u52a8\u7684\u81ea\u7136\u8bed\u8a00\u7aef\u5230\u7aef\u6d4b\u8bd5\u6846\u67b6\u3002\u5b83\u57fa\u4e8ePlaywright\u6784\u5efa\uff0c\u652f\u6301GitHub\u96c6\u6210\u548c\u53cc\u56e0\u7d20\u8ba4\u8bc1\uff082FA\uff09\u3002Shortest\u7684\u4e3b\u8981\u7279\u70b9\u662f\u901a\u8fc7\u81ea\u7136\u8bed\u8a00\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\uff0c\u5e76\u5229\u7528Anthropic <a href=\"https:\/\/www.kdjingpai.com\/ja\/claudeanquanfubai\/\">Claude<\/a> API\u8fdb\u884cAI\u9a71\u52a8\u7684\u6d4b\u8bd5\u6267\u884c\u3002\u8be5\u6846\u67b6\u65e8\u5728\u7b80\u5316\u6d4b\u8bd5\u6d41\u7a0b\uff0c\u63d0\u9ad8\u6d4b\u8bd5\u6548\u7387\uff0c\u4f7f\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u8f7b\u677e\u5730\u7f16\u5199\u548c\u7ef4\u62a4\u6d4b\u8bd5\u7528\u4f8b\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18988\" title=\"Shortest\uff1aAI\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884c\u7aef\u5230\u7aef\u6d4b\u8bd5-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/f9b2f7063352bfc.png\" alt=\"Shortest\uff1aAI\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884c\u7aef\u5230\u7aef\u6d4b\u8bd5-1\" width=\"1882\" height=\"944\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/f9b2f7063352bfc.png 1882w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/f9b2f7063352bfc-300x150.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/f9b2f7063352bfc-1024x514.png 1024w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/f9b2f7063352bfc-768x385.png 768w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/f9b2f7063352bfc-1536x770.png 1536w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/f9b2f7063352bfc-18x9.png 18w\" sizes=\"auto, (max-width: 1882px) 100vw, 1882px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18987\" title=\"Shortest\uff1aAI\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884c\u7aef\u5230\u7aef\u6d4b\u8bd5-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/91eb240120088a5.png\" alt=\"Shortest\uff1aAI\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884c\u7aef\u5230\u7aef\u6d4b\u8bd5-1\" width=\"1652\" height=\"1011\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/91eb240120088a5.png 1652w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/91eb240120088a5-300x184.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/91eb240120088a5-1024x627.png 1024w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/91eb240120088a5-768x470.png 768w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/91eb240120088a5-1536x940.png 1536w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/91eb240120088a5-18x12.png 18w\" sizes=\"auto, (max-width: 1652px) 100vw, 1652px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li><strong>\u81ea\u7136\u8bed\u8a00\u6d4b\u8bd5\u7f16\u5199<\/strong>\uff1a\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\uff0c\u964d\u4f4e\u4e86\u7f16\u5199\u6d4b\u8bd5\u7684\u95e8\u69db\u3002<\/li>\n<li><strong>AI\u9a71\u52a8\u7684\u6d4b\u8bd5\u6267\u884c<\/strong>\uff1a\u5229\u7528Anthropic Claude API\u8fdb\u884cAI\u9a71\u52a8\u7684\u6d4b\u8bd5\u6267\u884c\uff0c\u81ea\u52a8\u5316\u7a0b\u5ea6\u9ad8\u3002<\/li>\n<li><strong>\u57fa\u4e8ePlaywright<\/strong>\uff1a\u6784\u5efa\u5728Playwright\u4e4b\u4e0a\uff0c\u63d0\u4f9b\u5f3a\u5927\u7684\u6d4f\u89c8\u5668\u81ea\u52a8\u5316\u529f\u80fd\u3002<\/li>\n<li><strong>GitHub\u96c6\u6210<\/strong>\uff1a\u652f\u6301\u4e0eGitHub\u7684\u65e0\u7f1d\u96c6\u6210\uff0c\u5305\u62ec\u53cc\u56e0\u7d20\u8ba4\u8bc1\uff082FA\uff09\u3002<\/li>\n<li><strong>\u90ae\u4ef6\u9a8c\u8bc1<\/strong>\uff1a\u901a\u8fc7Mailosaur\u8fdb\u884c\u90ae\u4ef6\u9a8c\u8bc1\uff0c\u786e\u4fdd\u6d4b\u8bd5\u7684\u5168\u9762\u6027\u3002<\/li>\n<li><strong>\u56de\u8c03\u51fd\u6570<\/strong>\uff1a\u652f\u6301\u4f7f\u7528\u56de\u8c03\u51fd\u6570\u6dfb\u52a0\u989d\u5916\u7684\u65ad\u8a00\u548c\u903b\u8f91\u3002<\/li>\n<li><strong>\u751f\u547d\u5468\u671f\u94a9\u5b50<\/strong>\uff1a\u63d0\u4f9b\u751f\u547d\u5468\u671f\u94a9\u5b50\uff0c\u5141\u8bb8\u5728\u6d4b\u8bd5\u6267\u884c\u524d\u540e\u6267\u884c\u81ea\u5b9a\u4e49\u903b\u8f91\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5\u6d41\u7a0b<\/h3>\n<ol>\n<li>\u4f7f\u7528npm\u3001pnpm\u6216yarn\u5b89\u88c5Shortest\uff1a<\/li>\n<\/ol>\n<pre><code>   npm install -D @antiwork\/shortest\r\n# \u6216\u8005\r\npnpm add -D @antiwork\/shortest\r\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u5c06<code>.shortest\/<\/code>\u6dfb\u52a0\u5230<code>.gitignore<\/code>\u4e2d\uff0c\u4ee5\u5b58\u50a8\u6bcf\u6b21\u6d4b\u8bd5\u8fd0\u884c\u7684\u622a\u56fe\u548c\u7f13\u5b58\uff1a<\/li>\n<\/ol>\n<pre><code>   echo \".shortest\/\" &gt;&gt; .gitignore\r\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u786e\u5b9a\u6d4b\u8bd5\u5165\u53e3\u5e76\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0Anthropic API\u5bc6\u94a5\uff1a<\/li>\n<\/ol>\n<pre><code>   \/\/ shortest.config.ts\r\nimport type { ShortestConfig } from \"@antiwork\/shortest\";\r\nexport default {\r\nheadless: false,\r\nbaseUrl: \"http:\/\/localhost:3000\",\r\ntestPattern: \"**\/*.test.ts\",\r\nanthropicKey: process.env.ANTHROPIC_API_KEY,\r\n} satisfies ShortestConfig;\r\n<\/code><\/pre>\n<h3>\u4f7f\u7528\u6d41\u7a0b<\/h3>\n<ol>\n<li>\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\uff1a<\/li>\n<\/ol>\n<pre><code>   \/\/ app\/__tests__\/login.test.ts\r\nimport { shortest } from \"@antiwork\/shortest\";\r\nshortest(\"Login to the app using email and password\", {\r\nusername: process.env.GITHUB_USERNAME,\r\npassword: process.env.GITHUB_PASSWORD,\r\n});\r\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u4f7f\u7528\u56de\u8c03\u51fd\u6570\u6dfb\u52a0\u989d\u5916\u7684\u65ad\u8a00\u548c\u903b\u8f91\uff1a<\/li>\n<\/ol>\n<pre><code>   import { shortest } from \"@antiwork\/shortest\";\r\nimport { db } from \"@\/lib\/db\/drizzle\";\r\nimport { users } from \"@\/lib\/db\/schema\";\r\nimport { eq } from \"drizzle-orm\";\r\nshortest(\"Login to the app using username and password\", {\r\nusername: process.env.USERNAME,\r\npassword: process.env.PASSWORD,\r\n}).after(async ({ page }) =&gt; {\r\nconst clerkId = await page.evaluate(() =&gt; {\r\nreturn window.localStorage.getItem(\"clerk-user\");\r\n});\r\nif (!clerkId) {\r\nthrow new Error(\"User not found in database\");\r\n}\r\nconst [user] = await db\r\n.select()\r\n.from(users)\r\n.where(eq(users.clerkId, clerkId))\r\n.limit(1);\r\nexpect(user).toBeDefined();\r\n});\r\n<\/code><\/pre>\n<h3>\u8fd0\u884c\u6d4b\u8bd5<\/h3>\n<ol>\n<li>\u4f7f\u7528npx\u3001pnpm\u6216yarn\u8fd0\u884c\u6d4b\u8bd5\uff1a<\/li>\n<\/ol>\n<pre><code>   npx shortest\r\n# \u6216\u8005\r\npnpm shortest\r\n# \u6216\u8005\r\nyarn shortest\r\n<\/code><\/pre>\n<h3>\u8be6\u7ec6\u529f\u80fd\u4ecb\u7ecd<\/h3>\n<ul>\n<li><strong>\u81ea\u7136\u8bed\u8a00\u6d4b\u8bd5\u7f16\u5199<\/strong>\uff1aShortest\u5141\u8bb8\u7528\u6237\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\uff0c\u4f8b\u5982\u201c\u767b\u5f55\u5e94\u7528\u5e76\u4f7f\u7528\u7535\u5b50\u90ae\u4ef6\u548c\u5bc6\u7801\u201d\u3002\u8fd9\u79cd\u65b9\u5f0f\u964d\u4f4e\u4e86\u7f16\u5199\u6d4b\u8bd5\u7684\u6280\u672f\u95e8\u69db\uff0c\u4f7f\u975e\u6280\u672f\u4eba\u5458\u4e5f\u80fd\u53c2\u4e0e\u6d4b\u8bd5\u7f16\u5199\u3002<\/li>\n<li><strong>AI\u9a71\u52a8\u7684\u6d4b\u8bd5\u6267\u884c<\/strong>\uff1aShortest\u5229\u7528Anthropic Claude API\u8fdb\u884cAI\u9a71\u52a8\u7684\u6d4b\u8bd5\u6267\u884c\uff0c\u80fd\u591f\u667a\u80fd\u5730\u7406\u89e3\u548c\u6267\u884c\u6d4b\u8bd5\u7528\u4f8b\uff0c\u63d0\u9ad8\u6d4b\u8bd5\u7684\u81ea\u52a8\u5316\u7a0b\u5ea6\u548c\u51c6\u786e\u6027\u3002<\/li>\n<li><strong>\u57fa\u4e8ePlaywright<\/strong>\uff1aShortest\u57fa\u4e8ePlaywright\u6784\u5efa\uff0c\u63d0\u4f9b\u5f3a\u5927\u7684\u6d4f\u89c8\u5668\u81ea\u52a8\u5316\u529f\u80fd\uff0c\u652f\u6301\u591a\u79cd\u6d4f\u89c8\u5668\u548c\u8bbe\u5907\u7684\u6d4b\u8bd5\u3002<\/li>\n<li><strong>GitHub\u96c6\u6210<\/strong>\uff1aShortest\u652f\u6301\u4e0eGitHub\u7684\u65e0\u7f1d\u96c6\u6210\uff0c\u5305\u62ec\u53cc\u56e0\u7d20\u8ba4\u8bc1\uff082FA\uff09\uff0c\u786e\u4fdd\u6d4b\u8bd5\u8fc7\u7a0b\u7684\u5b89\u5168\u6027\u548c\u53ef\u9760\u6027\u3002<\/li>\n<li><strong>\u90ae\u4ef6\u9a8c\u8bc1<\/strong>\uff1a\u901a\u8fc7Mailosaur\u8fdb\u884c\u90ae\u4ef6\u9a8c\u8bc1\uff0c\u786e\u4fdd\u6d4b\u8bd5\u7684\u5168\u9762\u6027\u548c\u51c6\u786e\u6027\u3002<\/li>\n<li><strong>\u56de\u8c03\u51fd\u6570<\/strong>\uff1aShortest\u652f\u6301\u4f7f\u7528\u56de\u8c03\u51fd\u6570\u6dfb\u52a0\u989d\u5916\u7684\u65ad\u8a00\u548c\u903b\u8f91\uff0c\u5141\u8bb8\u7528\u6237\u5728\u6d4b\u8bd5\u6267\u884c\u540e\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u9a8c\u8bc1\u548c\u64cd\u4f5c\u3002<\/li>\n<li><strong>\u751f\u547d\u5468\u671f\u94a9\u5b50<\/strong>\uff1aShortest\u63d0\u4f9b\u751f\u547d\u5468\u671f\u94a9\u5b50\uff0c\u5141\u8bb8\u7528\u6237\u5728\u6d4b\u8bd5\u6267\u884c\u524d\u540e\u6267\u884c\u81ea\u5b9a\u4e49\u903b\u8f91\uff0c\u4f8b\u5982\u5728\u6d4b\u8bd5\u524d\u8bbe\u7f6e\u6d4b\u8bd5\u73af\u5883\uff0c\u5728\u6d4b\u8bd5\u540e\u6e05\u7406\u6d4b\u8bd5\u6570\u636e\u7b49\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Shortest\u662f\u4e00\u4e2a\u7531Anti-Work\u56e2\u961f\u5f00\u53d1\u7684AI\u9a71\u52a8\u7684\u81ea\u7136\u8bed\u8a00\u7aef\u5230\u7aef\u6d4b\u8bd5\u6846\u67b6\u3002\u5b83\u57fa\u4e8ePlaywright\u6784\u5efa\uff0c\u652f\u6301GitHub\u96c6\u6210\u548c\u53cc\u56e0\u7d20\u8ba4\u8bc1\uff082FA\uff09\u3002Shortest\u7684\u4e3b\u8981\u7279\u70b9\u662f\u901a\u8fc7\u81ea\u7136\u8bed\u8a00\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\uff0c\u5e76\u5229\u7528Anthropic&#8230;<\/p>\n","protected":false},"author":1,"featured_media":61687,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[230,373],"class_list":["post-18986","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","tag-aikaiyuanxiangmu","tag-zhuomianzidonghuazhian"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/18986","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/comments?post=18986"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/18986\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media\/61687"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media?parent=18986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/categories?post=18986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/tags?post=18986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}