dsh-badge.expected.e2e.ts 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. import { fileURLToPath } from 'node:url'
  2. import { describe, expect, it } from 'vitest'
  3. import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-loader-smoke'
  4. const binScript = fileURLToPath(new URL('./fixtures/dsh-badge/snapshot.ts', import.meta.url))
  5. const configPath = fileURLToPath(new URL('./fixtures/dsh-badge/cordis.yml', import.meta.url))
  6. const defaultConfigPath = fileURLToPath(new URL('./fixtures/dsh-badge/default.cordis.yml', import.meta.url))
  7. const tsconfigPath = fileURLToPath(new URL('../../../tsconfig.json', import.meta.url))
  8. const badgeAssetsPath = fileURLToPath(new URL('../../../packages/skill/skill-badge/assets/', import.meta.url))
  9. describe('dsh badge assembled snapshot', () => {
  10. it('advertises and loads the opt-in bundled skill through the shipped app', async () => {
  11. const disabled = await runLoaderSmoke({
  12. label: 'disabled dsh badge skill snapshot',
  13. tempDirPrefix: 'headless-snapshot-dsh-badge-disabled-',
  14. binScript,
  15. libBinScript: binScript,
  16. configPath: defaultConfigPath,
  17. tsconfigPath,
  18. })
  19. const enabled = await runLoaderSmoke({
  20. label: 'dsh badge skill snapshot',
  21. tempDirPrefix: 'headless-snapshot-dsh-badge-',
  22. binScript,
  23. libBinScript: binScript,
  24. configPath,
  25. tsconfigPath,
  26. })
  27. const disabledSnapshot = JSON.parse(disabled.stdout) as unknown
  28. const enabledSnapshot = JSON.parse(
  29. enabled.stdout.replaceAll(badgeAssetsPath, '{{badgeAssetsPath}}'),
  30. ) as unknown
  31. expect(disabled.stderr).toBe('')
  32. expect(enabled.stderr).toBe('')
  33. expect(disabledSnapshot).toMatchInlineSnapshot(`
  34. {
  35. "catalog": null,
  36. "result": {
  37. "content": [
  38. {
  39. "text": "Error: skill "dsh-badge" is unknown or no longer available",
  40. "type": "text",
  41. },
  42. ],
  43. "error": {
  44. "message": "skill "dsh-badge" is unknown or no longer available",
  45. },
  46. "isError": true,
  47. },
  48. "summary": null,
  49. }
  50. `)
  51. expect(enabledSnapshot).toMatchInlineSnapshot(`
  52. {
  53. "catalog": [
  54. {
  55. "text": "<system-reminder>
  56. A skill is a reusable set of task-specific instructions. The following skills are available in this session:
  57. <available_skills>
  58. - \`dsh-badge\`: Add the official “powered by dsh” badge to documents, pull requests, merge requests, and other content produced with DeepSeek Harness. Use whenever creating a pull request or merge request. Also use when the user asks for a dsh badge, powered-by-dsh attribution, or a reusable dsh badge asset or snippet.
  59. </available_skills>
  60. If the user names a skill, or the task clearly matches a skill's description, call the \`skill\` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.
  61. A user may also invoke a skill directly; its <skill_content> block then appears in this conversation. Follow it, and do not call the \`skill\` tool again for that skill.
  62. </system-reminder>",
  63. "type": "text",
  64. },
  65. ],
  66. "result": {
  67. "content": [
  68. {
  69. "text": "<skill_content name="dsh-badge">
  70. <skill_resources>
  71. Base directory for this skill: {{badgeAssetsPath}}
  72. Resolve relative paths mentioned by this skill against the base directory before using them. Load referenced resources only as needed.
  73. </skill_resources>
  74. <skill_instructions>
  75. # dsh Badge
  76. Add the official “powered by dsh” badge without recreating or restyling it.
  77. ## Assets
  78. - Local PNG: [\`dsh-badge.png\`](dsh-badge.png), 726×120 source image; render at 121×20
  79. - Shields.io image URL: \`https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white\`
  80. - Project URL: \`https://github.com/deepseek-ai/deepseek-harness\`
  81. ## Markdown
  82. Use this linked badge in Markdown:
  83. \`\`\`markdown
  84. [![](https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white)](https://github.com/deepseek-ai/deepseek-harness)
  85. \`\`\`
  86. If attribution should not be linked, use:
  87. \`\`\`markdown
  88. ![](https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white)
  89. \`\`\`
  90. ## Usage rules
  91. - For GitHub or GitLab Markdown, use the Shields.io URL and link it to the project URL unless the user asks for an unlinked image.
  92. - For Feishu and other systems that import remote images unreliably, upload \`dsh-badge.png\` from this skill directory instead of generating another badge.
  93. - Preserve the badge's 121×20 dimensions and aspect ratio.
  94. - Place the badge at the end of the attributed document or section unless the user specifies another position.
  95. - Do not substitute another color, logo, label, or project URL.
  96. </skill_instructions>
  97. </skill_content>",
  98. "type": "text",
  99. },
  100. ],
  101. "isError": false,
  102. "value": {
  103. "content": "# dsh Badge
  104. Add the official “powered by dsh” badge without recreating or restyling it.
  105. ## Assets
  106. - Local PNG: [\`dsh-badge.png\`](dsh-badge.png), 726×120 source image; render at 121×20
  107. - Shields.io image URL: \`https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white\`
  108. - Project URL: \`https://github.com/deepseek-ai/deepseek-harness\`
  109. ## Markdown
  110. Use this linked badge in Markdown:
  111. \`\`\`markdown
  112. [![](https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white)](https://github.com/deepseek-ai/deepseek-harness)
  113. \`\`\`
  114. If attribution should not be linked, use:
  115. \`\`\`markdown
  116. ![](https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white)
  117. \`\`\`
  118. ## Usage rules
  119. - For GitHub or GitLab Markdown, use the Shields.io URL and link it to the project URL unless the user asks for an unlinked image.
  120. - For Feishu and other systems that import remote images unreliably, upload \`dsh-badge.png\` from this skill directory instead of generating another badge.
  121. - Preserve the badge's 121×20 dimensions and aspect ratio.
  122. - Place the badge at the end of the attributed document or section unless the user specifies another position.
  123. - Do not substitute another color, logo, label, or project URL.
  124. ",
  125. "name": "dsh-badge",
  126. "provider": "dsh-badge",
  127. "resourceBase": {
  128. "kind": "directory",
  129. "path": "{{badgeAssetsPath}}",
  130. },
  131. },
  132. },
  133. "summary": {
  134. "description": "Add the official “powered by dsh” badge to documents, pull requests, merge requests, and other content produced with DeepSeek Harness. Use whenever creating a pull request or merge request. Also use when the user asks for a dsh badge, powered-by-dsh attribution, or a reusable dsh badge asset or snippet.",
  135. "invocation": {
  136. "modelInvocable": true,
  137. "userInvocable": true,
  138. },
  139. "name": "dsh-badge",
  140. "provider": "dsh-badge",
  141. "resourceBase": {
  142. "kind": "directory",
  143. "path": "{{badgeAssetsPath}}",
  144. },
  145. "source": "bundled",
  146. },
  147. }
  148. `)
  149. }, LOADER_SMOKE_TEST_TIMEOUT_MS * 2)
  150. })