@shirokuma-library/shirokuma-docs 0.1.0-alpha.5

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.

Potentially problematic release.


This version of @shirokuma-library/shirokuma-docs might be problematic. Click here for more details.

Files changed (753) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +308 -0
  3. package/README.md +308 -0
  4. package/THIRD_PARTY_NOTICES.md +18 -0
  5. package/bin/shirokuma-docs +2 -0
  6. package/dist/analyzers/details-test-analysis.d.ts +31 -0
  7. package/dist/analyzers/details-test-analysis.d.ts.map +1 -0
  8. package/dist/analyzers/details-test-analysis.js +172 -0
  9. package/dist/analyzers/details-test-analysis.js.map +1 -0
  10. package/dist/analyzers/feature-map-builder.d.ts +20 -0
  11. package/dist/analyzers/feature-map-builder.d.ts.map +1 -0
  12. package/dist/analyzers/feature-map-builder.js +154 -0
  13. package/dist/analyzers/feature-map-builder.js.map +1 -0
  14. package/dist/analyzers/feature-map-references.d.ts +34 -0
  15. package/dist/analyzers/feature-map-references.d.ts.map +1 -0
  16. package/dist/analyzers/feature-map-references.js +249 -0
  17. package/dist/analyzers/feature-map-references.js.map +1 -0
  18. package/dist/analyzers/reference-analyzer.d.ts +95 -0
  19. package/dist/analyzers/reference-analyzer.d.ts.map +1 -0
  20. package/dist/analyzers/reference-analyzer.js +372 -0
  21. package/dist/analyzers/reference-analyzer.js.map +1 -0
  22. package/dist/commands/adr.d.ts +26 -0
  23. package/dist/commands/adr.d.ts.map +1 -0
  24. package/dist/commands/adr.js +129 -0
  25. package/dist/commands/adr.js.map +1 -0
  26. package/dist/commands/api-tools.d.ts +83 -0
  27. package/dist/commands/api-tools.d.ts.map +1 -0
  28. package/dist/commands/api-tools.js +775 -0
  29. package/dist/commands/api-tools.js.map +1 -0
  30. package/dist/commands/coverage.d.ts +139 -0
  31. package/dist/commands/coverage.d.ts.map +1 -0
  32. package/dist/commands/coverage.js +481 -0
  33. package/dist/commands/coverage.js.map +1 -0
  34. package/dist/commands/deps.d.ts +24 -0
  35. package/dist/commands/deps.d.ts.map +1 -0
  36. package/dist/commands/deps.js +211 -0
  37. package/dist/commands/deps.js.map +1 -0
  38. package/dist/commands/details-context.d.ts +38 -0
  39. package/dist/commands/details-context.d.ts.map +1 -0
  40. package/dist/commands/details-context.js +193 -0
  41. package/dist/commands/details-context.js.map +1 -0
  42. package/dist/commands/details-types.d.ts +315 -0
  43. package/dist/commands/details-types.d.ts.map +1 -0
  44. package/dist/commands/details-types.js +7 -0
  45. package/dist/commands/details-types.js.map +1 -0
  46. package/dist/commands/details.d.ts +24 -0
  47. package/dist/commands/details.d.ts.map +1 -0
  48. package/dist/commands/details.js +299 -0
  49. package/dist/commands/details.js.map +1 -0
  50. package/dist/commands/discussion-templates.d.ts +26 -0
  51. package/dist/commands/discussion-templates.d.ts.map +1 -0
  52. package/dist/commands/discussion-templates.js +270 -0
  53. package/dist/commands/discussion-templates.js.map +1 -0
  54. package/dist/commands/discussions.d.ts +31 -0
  55. package/dist/commands/discussions.d.ts.map +1 -0
  56. package/dist/commands/discussions.js +743 -0
  57. package/dist/commands/discussions.js.map +1 -0
  58. package/dist/commands/feature-map-types.d.ts +294 -0
  59. package/dist/commands/feature-map-types.d.ts.map +1 -0
  60. package/dist/commands/feature-map-types.js +8 -0
  61. package/dist/commands/feature-map-types.js.map +1 -0
  62. package/dist/commands/feature-map.d.ts +30 -0
  63. package/dist/commands/feature-map.d.ts.map +1 -0
  64. package/dist/commands/feature-map.js +137 -0
  65. package/dist/commands/feature-map.js.map +1 -0
  66. package/dist/commands/generate.d.ts +16 -0
  67. package/dist/commands/generate.d.ts.map +1 -0
  68. package/dist/commands/generate.js +88 -0
  69. package/dist/commands/generate.js.map +1 -0
  70. package/dist/commands/gh-discussions.d.ts +31 -0
  71. package/dist/commands/gh-discussions.d.ts.map +1 -0
  72. package/dist/commands/gh-discussions.js +743 -0
  73. package/dist/commands/gh-discussions.js.map +1 -0
  74. package/dist/commands/gh-issues-pr.d.ts +74 -0
  75. package/dist/commands/gh-issues-pr.d.ts.map +1 -0
  76. package/dist/commands/gh-issues-pr.js +417 -0
  77. package/dist/commands/gh-issues-pr.js.map +1 -0
  78. package/dist/commands/gh-issues.d.ts +90 -0
  79. package/dist/commands/gh-issues.d.ts.map +1 -0
  80. package/dist/commands/gh-issues.js +1297 -0
  81. package/dist/commands/gh-issues.js.map +1 -0
  82. package/dist/commands/gh-projects.d.ts +54 -0
  83. package/dist/commands/gh-projects.d.ts.map +1 -0
  84. package/dist/commands/gh-projects.js +966 -0
  85. package/dist/commands/gh-projects.js.map +1 -0
  86. package/dist/commands/gh-repo.d.ts +18 -0
  87. package/dist/commands/gh-repo.d.ts.map +1 -0
  88. package/dist/commands/gh-repo.js +253 -0
  89. package/dist/commands/gh-repo.js.map +1 -0
  90. package/dist/commands/github-data.d.ts +67 -0
  91. package/dist/commands/github-data.d.ts.map +1 -0
  92. package/dist/commands/github-data.js +361 -0
  93. package/dist/commands/github-data.js.map +1 -0
  94. package/dist/commands/i18n.d.ts +102 -0
  95. package/dist/commands/i18n.d.ts.map +1 -0
  96. package/dist/commands/i18n.js +829 -0
  97. package/dist/commands/i18n.js.map +1 -0
  98. package/dist/commands/impact.d.ts +14 -0
  99. package/dist/commands/impact.d.ts.map +1 -0
  100. package/dist/commands/impact.js +263 -0
  101. package/dist/commands/impact.js.map +1 -0
  102. package/dist/commands/init.d.ts +53 -0
  103. package/dist/commands/init.d.ts.map +1 -0
  104. package/dist/commands/init.js +429 -0
  105. package/dist/commands/init.js.map +1 -0
  106. package/dist/commands/issues-pr.d.ts +74 -0
  107. package/dist/commands/issues-pr.d.ts.map +1 -0
  108. package/dist/commands/issues-pr.js +417 -0
  109. package/dist/commands/issues-pr.js.map +1 -0
  110. package/dist/commands/issues.d.ts +76 -0
  111. package/dist/commands/issues.d.ts.map +1 -0
  112. package/dist/commands/issues.js +1285 -0
  113. package/dist/commands/issues.js.map +1 -0
  114. package/dist/commands/link-docs.d.ts +21 -0
  115. package/dist/commands/link-docs.d.ts.map +1 -0
  116. package/dist/commands/link-docs.js +990 -0
  117. package/dist/commands/link-docs.js.map +1 -0
  118. package/dist/commands/lint-annotations.d.ts +28 -0
  119. package/dist/commands/lint-annotations.d.ts.map +1 -0
  120. package/dist/commands/lint-annotations.js +511 -0
  121. package/dist/commands/lint-annotations.js.map +1 -0
  122. package/dist/commands/lint-code.d.ts +26 -0
  123. package/dist/commands/lint-code.d.ts.map +1 -0
  124. package/dist/commands/lint-code.js +428 -0
  125. package/dist/commands/lint-code.js.map +1 -0
  126. package/dist/commands/lint-coverage.d.ts +33 -0
  127. package/dist/commands/lint-coverage.d.ts.map +1 -0
  128. package/dist/commands/lint-coverage.js +379 -0
  129. package/dist/commands/lint-coverage.js.map +1 -0
  130. package/dist/commands/lint-docs.d.ts +23 -0
  131. package/dist/commands/lint-docs.d.ts.map +1 -0
  132. package/dist/commands/lint-docs.js +338 -0
  133. package/dist/commands/lint-docs.js.map +1 -0
  134. package/dist/commands/lint-structure.d.ts +38 -0
  135. package/dist/commands/lint-structure.d.ts.map +1 -0
  136. package/dist/commands/lint-structure.js +350 -0
  137. package/dist/commands/lint-structure.js.map +1 -0
  138. package/dist/commands/lint-tests.d.ts +25 -0
  139. package/dist/commands/lint-tests.d.ts.map +1 -0
  140. package/dist/commands/lint-tests.js +105 -0
  141. package/dist/commands/lint-tests.js.map +1 -0
  142. package/dist/commands/lint-workflow.d.ts +36 -0
  143. package/dist/commands/lint-workflow.d.ts.map +1 -0
  144. package/dist/commands/lint-workflow.js +255 -0
  145. package/dist/commands/lint-workflow.js.map +1 -0
  146. package/dist/commands/overview.d.ts +21 -0
  147. package/dist/commands/overview.d.ts.map +1 -0
  148. package/dist/commands/overview.js +1300 -0
  149. package/dist/commands/overview.js.map +1 -0
  150. package/dist/commands/packages.d.ts +107 -0
  151. package/dist/commands/packages.d.ts.map +1 -0
  152. package/dist/commands/packages.js +308 -0
  153. package/dist/commands/packages.js.map +1 -0
  154. package/dist/commands/portal-nextjs.d.ts +23 -0
  155. package/dist/commands/portal-nextjs.d.ts.map +1 -0
  156. package/dist/commands/portal-nextjs.js +336 -0
  157. package/dist/commands/portal-nextjs.js.map +1 -0
  158. package/dist/commands/portal.d.ts +24 -0
  159. package/dist/commands/portal.d.ts.map +1 -0
  160. package/dist/commands/portal.js +16 -0
  161. package/dist/commands/portal.js.map +1 -0
  162. package/dist/commands/projects.d.ts +54 -0
  163. package/dist/commands/projects.d.ts.map +1 -0
  164. package/dist/commands/projects.js +969 -0
  165. package/dist/commands/projects.js.map +1 -0
  166. package/dist/commands/repo-pairs.d.ts +19 -0
  167. package/dist/commands/repo-pairs.d.ts.map +1 -0
  168. package/dist/commands/repo-pairs.js +529 -0
  169. package/dist/commands/repo-pairs.js.map +1 -0
  170. package/dist/commands/repo.d.ts +18 -0
  171. package/dist/commands/repo.d.ts.map +1 -0
  172. package/dist/commands/repo.js +253 -0
  173. package/dist/commands/repo.js.map +1 -0
  174. package/dist/commands/schema.d.ts +49 -0
  175. package/dist/commands/schema.d.ts.map +1 -0
  176. package/dist/commands/schema.js +830 -0
  177. package/dist/commands/schema.js.map +1 -0
  178. package/dist/commands/screenshots.d.ts +203 -0
  179. package/dist/commands/screenshots.d.ts.map +1 -0
  180. package/dist/commands/screenshots.js +1234 -0
  181. package/dist/commands/screenshots.js.map +1 -0
  182. package/dist/commands/search-index.d.ts +83 -0
  183. package/dist/commands/search-index.d.ts.map +1 -0
  184. package/dist/commands/search-index.js +389 -0
  185. package/dist/commands/search-index.js.map +1 -0
  186. package/dist/commands/session.d.ts +153 -0
  187. package/dist/commands/session.d.ts.map +1 -0
  188. package/dist/commands/session.js +1243 -0
  189. package/dist/commands/session.js.map +1 -0
  190. package/dist/commands/test-cases-types.d.ts +154 -0
  191. package/dist/commands/test-cases-types.d.ts.map +1 -0
  192. package/dist/commands/test-cases-types.js +7 -0
  193. package/dist/commands/test-cases-types.js.map +1 -0
  194. package/dist/commands/test-cases.d.ts +28 -0
  195. package/dist/commands/test-cases.d.ts.map +1 -0
  196. package/dist/commands/test-cases.js +192 -0
  197. package/dist/commands/test-cases.js.map +1 -0
  198. package/dist/commands/typedoc.d.ts +21 -0
  199. package/dist/commands/typedoc.d.ts.map +1 -0
  200. package/dist/commands/typedoc.js +192 -0
  201. package/dist/commands/typedoc.js.map +1 -0
  202. package/dist/commands/update-skills.d.ts +56 -0
  203. package/dist/commands/update-skills.d.ts.map +1 -0
  204. package/dist/commands/update-skills.js +620 -0
  205. package/dist/commands/update-skills.js.map +1 -0
  206. package/dist/generators/details-entity-pages.d.ts +40 -0
  207. package/dist/generators/details-entity-pages.d.ts.map +1 -0
  208. package/dist/generators/details-entity-pages.js +301 -0
  209. package/dist/generators/details-entity-pages.js.map +1 -0
  210. package/dist/generators/details-html.d.ts +23 -0
  211. package/dist/generators/details-html.d.ts.map +1 -0
  212. package/dist/generators/details-html.js +324 -0
  213. package/dist/generators/details-html.js.map +1 -0
  214. package/dist/generators/details-module-page.d.ts +33 -0
  215. package/dist/generators/details-module-page.d.ts.map +1 -0
  216. package/dist/generators/details-module-page.js +408 -0
  217. package/dist/generators/details-module-page.js.map +1 -0
  218. package/dist/generators/details-styles.d.ts +39 -0
  219. package/dist/generators/details-styles.d.ts.map +1 -0
  220. package/dist/generators/details-styles.js +409 -0
  221. package/dist/generators/details-styles.js.map +1 -0
  222. package/dist/generators/feature-map-html.d.ts +66 -0
  223. package/dist/generators/feature-map-html.d.ts.map +1 -0
  224. package/dist/generators/feature-map-html.js +569 -0
  225. package/dist/generators/feature-map-html.js.map +1 -0
  226. package/dist/generators/feature-map-styles.d.ts +39 -0
  227. package/dist/generators/feature-map-styles.d.ts.map +1 -0
  228. package/dist/generators/feature-map-styles.js +449 -0
  229. package/dist/generators/feature-map-styles.js.map +1 -0
  230. package/dist/generators/test-cases-hierarchy.d.ts +21 -0
  231. package/dist/generators/test-cases-hierarchy.d.ts.map +1 -0
  232. package/dist/generators/test-cases-hierarchy.js +336 -0
  233. package/dist/generators/test-cases-hierarchy.js.map +1 -0
  234. package/dist/generators/test-cases-main.d.ts +20 -0
  235. package/dist/generators/test-cases-main.d.ts.map +1 -0
  236. package/dist/generators/test-cases-main.js +439 -0
  237. package/dist/generators/test-cases-main.js.map +1 -0
  238. package/dist/generators/test-cases-styles.d.ts +64 -0
  239. package/dist/generators/test-cases-styles.d.ts.map +1 -0
  240. package/dist/generators/test-cases-styles.js +1277 -0
  241. package/dist/generators/test-cases-styles.js.map +1 -0
  242. package/dist/index.d.ts +13 -0
  243. package/dist/index.d.ts.map +1 -0
  244. package/dist/index.js +517 -0
  245. package/dist/index.js.map +1 -0
  246. package/dist/lint/annotation-lint.d.ts +198 -0
  247. package/dist/lint/annotation-lint.d.ts.map +1 -0
  248. package/dist/lint/annotation-lint.js +510 -0
  249. package/dist/lint/annotation-lint.js.map +1 -0
  250. package/dist/lint/annotation-types.d.ts +161 -0
  251. package/dist/lint/annotation-types.d.ts.map +1 -0
  252. package/dist/lint/annotation-types.js +31 -0
  253. package/dist/lint/annotation-types.js.map +1 -0
  254. package/dist/lint/code-types.d.ts +135 -0
  255. package/dist/lint/code-types.d.ts.map +1 -0
  256. package/dist/lint/code-types.js +25 -0
  257. package/dist/lint/code-types.js.map +1 -0
  258. package/dist/lint/coverage-types.d.ts +128 -0
  259. package/dist/lint/coverage-types.d.ts.map +1 -0
  260. package/dist/lint/coverage-types.js +24 -0
  261. package/dist/lint/coverage-types.js.map +1 -0
  262. package/dist/lint/docs-types.d.ts +214 -0
  263. package/dist/lint/docs-types.d.ts.map +1 -0
  264. package/dist/lint/docs-types.js +18 -0
  265. package/dist/lint/docs-types.js.map +1 -0
  266. package/dist/lint/formatters/index.d.ts +14 -0
  267. package/dist/lint/formatters/index.d.ts.map +1 -0
  268. package/dist/lint/formatters/index.js +28 -0
  269. package/dist/lint/formatters/index.js.map +1 -0
  270. package/dist/lint/formatters/json.d.ts +11 -0
  271. package/dist/lint/formatters/json.d.ts.map +1 -0
  272. package/dist/lint/formatters/json.js +12 -0
  273. package/dist/lint/formatters/json.js.map +1 -0
  274. package/dist/lint/formatters/summary.d.ts +11 -0
  275. package/dist/lint/formatters/summary.d.ts.map +1 -0
  276. package/dist/lint/formatters/summary.js +37 -0
  277. package/dist/lint/formatters/summary.js.map +1 -0
  278. package/dist/lint/formatters/terminal.d.ts +11 -0
  279. package/dist/lint/formatters/terminal.d.ts.map +1 -0
  280. package/dist/lint/formatters/terminal.js +99 -0
  281. package/dist/lint/formatters/terminal.js.map +1 -0
  282. package/dist/lint/index.d.ts +18 -0
  283. package/dist/lint/index.d.ts.map +1 -0
  284. package/dist/lint/index.js +103 -0
  285. package/dist/lint/index.js.map +1 -0
  286. package/dist/lint/rules/annotation-required.d.ts +35 -0
  287. package/dist/lint/rules/annotation-required.d.ts.map +1 -0
  288. package/dist/lint/rules/annotation-required.js +127 -0
  289. package/dist/lint/rules/annotation-required.js.map +1 -0
  290. package/dist/lint/rules/code-rules.d.ts +12 -0
  291. package/dist/lint/rules/code-rules.d.ts.map +1 -0
  292. package/dist/lint/rules/code-rules.js +11 -0
  293. package/dist/lint/rules/code-rules.js.map +1 -0
  294. package/dist/lint/rules/describe-coverage.d.ts +8 -0
  295. package/dist/lint/rules/describe-coverage.d.ts.map +1 -0
  296. package/dist/lint/rules/describe-coverage.js +43 -0
  297. package/dist/lint/rules/describe-coverage.js.map +1 -0
  298. package/dist/lint/rules/duplicate-testdoc.d.ts +8 -0
  299. package/dist/lint/rules/duplicate-testdoc.d.ts.map +1 -0
  300. package/dist/lint/rules/duplicate-testdoc.js +38 -0
  301. package/dist/lint/rules/duplicate-testdoc.js.map +1 -0
  302. package/dist/lint/rules/index.d.ts +29 -0
  303. package/dist/lint/rules/index.d.ts.map +1 -0
  304. package/dist/lint/rules/index.js +55 -0
  305. package/dist/lint/rules/index.js.map +1 -0
  306. package/dist/lint/rules/server-action-structure.d.ts +37 -0
  307. package/dist/lint/rules/server-action-structure.d.ts.map +1 -0
  308. package/dist/lint/rules/server-action-structure.js +151 -0
  309. package/dist/lint/rules/server-action-structure.js.map +1 -0
  310. package/dist/lint/rules/skipped-test-report.d.ts +11 -0
  311. package/dist/lint/rules/skipped-test-report.d.ts.map +1 -0
  312. package/dist/lint/rules/skipped-test-report.js +31 -0
  313. package/dist/lint/rules/skipped-test-report.js.map +1 -0
  314. package/dist/lint/rules/structure-rules.d.ts +67 -0
  315. package/dist/lint/rules/structure-rules.d.ts.map +1 -0
  316. package/dist/lint/rules/structure-rules.js +615 -0
  317. package/dist/lint/rules/structure-rules.js.map +1 -0
  318. package/dist/lint/rules/testdoc-japanese.d.ts +8 -0
  319. package/dist/lint/rules/testdoc-japanese.d.ts.map +1 -0
  320. package/dist/lint/rules/testdoc-japanese.js +31 -0
  321. package/dist/lint/rules/testdoc-japanese.js.map +1 -0
  322. package/dist/lint/rules/testdoc-min-length.d.ts +8 -0
  323. package/dist/lint/rules/testdoc-min-length.d.ts.map +1 -0
  324. package/dist/lint/rules/testdoc-min-length.js +31 -0
  325. package/dist/lint/rules/testdoc-min-length.js.map +1 -0
  326. package/dist/lint/rules/testdoc-required.d.ts +8 -0
  327. package/dist/lint/rules/testdoc-required.d.ts.map +1 -0
  328. package/dist/lint/rules/testdoc-required.js +27 -0
  329. package/dist/lint/rules/testdoc-required.js.map +1 -0
  330. package/dist/lint/rules/workflow-branch-naming.d.ts +20 -0
  331. package/dist/lint/rules/workflow-branch-naming.d.ts.map +1 -0
  332. package/dist/lint/rules/workflow-branch-naming.js +85 -0
  333. package/dist/lint/rules/workflow-branch-naming.js.map +1 -0
  334. package/dist/lint/rules/workflow-commit-format.d.ts +27 -0
  335. package/dist/lint/rules/workflow-commit-format.d.ts.map +1 -0
  336. package/dist/lint/rules/workflow-commit-format.js +92 -0
  337. package/dist/lint/rules/workflow-commit-format.js.map +1 -0
  338. package/dist/lint/rules/workflow-issue-fields.d.ts +24 -0
  339. package/dist/lint/rules/workflow-issue-fields.d.ts.map +1 -0
  340. package/dist/lint/rules/workflow-issue-fields.js +89 -0
  341. package/dist/lint/rules/workflow-issue-fields.js.map +1 -0
  342. package/dist/lint/rules/workflow-main-protection.d.ts +32 -0
  343. package/dist/lint/rules/workflow-main-protection.d.ts.map +1 -0
  344. package/dist/lint/rules/workflow-main-protection.js +114 -0
  345. package/dist/lint/rules/workflow-main-protection.js.map +1 -0
  346. package/dist/lint/structure-types.d.ts +216 -0
  347. package/dist/lint/structure-types.d.ts.map +1 -0
  348. package/dist/lint/structure-types.js +96 -0
  349. package/dist/lint/structure-types.js.map +1 -0
  350. package/dist/lint/types.d.ts +154 -0
  351. package/dist/lint/types.d.ts.map +1 -0
  352. package/dist/lint/types.js +21 -0
  353. package/dist/lint/types.js.map +1 -0
  354. package/dist/lint/workflow-types.d.ts +90 -0
  355. package/dist/lint/workflow-types.d.ts.map +1 -0
  356. package/dist/lint/workflow-types.js +7 -0
  357. package/dist/lint/workflow-types.js.map +1 -0
  358. package/dist/md/analyzer/index.d.ts +46 -0
  359. package/dist/md/analyzer/index.d.ts.map +1 -0
  360. package/dist/md/analyzer/index.js +288 -0
  361. package/dist/md/analyzer/index.js.map +1 -0
  362. package/dist/md/builder/index.d.ts +91 -0
  363. package/dist/md/builder/index.d.ts.map +1 -0
  364. package/dist/md/builder/index.js +446 -0
  365. package/dist/md/builder/index.js.map +1 -0
  366. package/dist/md/cli/analyze.d.ts +11 -0
  367. package/dist/md/cli/analyze.d.ts.map +1 -0
  368. package/dist/md/cli/analyze.js +118 -0
  369. package/dist/md/cli/analyze.js.map +1 -0
  370. package/dist/md/cli/build.d.ts +11 -0
  371. package/dist/md/cli/build.d.ts.map +1 -0
  372. package/dist/md/cli/build.js +74 -0
  373. package/dist/md/cli/build.js.map +1 -0
  374. package/dist/md/cli/extract.d.ts +25 -0
  375. package/dist/md/cli/extract.d.ts.map +1 -0
  376. package/dist/md/cli/extract.js +230 -0
  377. package/dist/md/cli/extract.js.map +1 -0
  378. package/dist/md/cli/index.d.ts +3 -0
  379. package/dist/md/cli/index.d.ts.map +1 -0
  380. package/dist/md/cli/index.js +99 -0
  381. package/dist/md/cli/index.js.map +1 -0
  382. package/dist/md/cli/lint.d.ts +11 -0
  383. package/dist/md/cli/lint.d.ts.map +1 -0
  384. package/dist/md/cli/lint.js +165 -0
  385. package/dist/md/cli/lint.js.map +1 -0
  386. package/dist/md/cli/list.d.ts +16 -0
  387. package/dist/md/cli/list.d.ts.map +1 -0
  388. package/dist/md/cli/list.js +85 -0
  389. package/dist/md/cli/list.js.map +1 -0
  390. package/dist/md/cli/program.d.ts +11 -0
  391. package/dist/md/cli/program.d.ts.map +1 -0
  392. package/dist/md/cli/program.js +104 -0
  393. package/dist/md/cli/program.js.map +1 -0
  394. package/dist/md/cli/validate.d.ts +8 -0
  395. package/dist/md/cli/validate.d.ts.map +1 -0
  396. package/dist/md/cli/validate.js +82 -0
  397. package/dist/md/cli/validate.js.map +1 -0
  398. package/dist/md/constants.d.ts +69 -0
  399. package/dist/md/constants.d.ts.map +1 -0
  400. package/dist/md/constants.js +69 -0
  401. package/dist/md/constants.js.map +1 -0
  402. package/dist/md/extractor/index.d.ts +57 -0
  403. package/dist/md/extractor/index.d.ts.map +1 -0
  404. package/dist/md/extractor/index.js +359 -0
  405. package/dist/md/extractor/index.js.map +1 -0
  406. package/dist/md/index.d.ts +26 -0
  407. package/dist/md/index.d.ts.map +1 -0
  408. package/dist/md/index.js +30 -0
  409. package/dist/md/index.js.map +1 -0
  410. package/dist/md/linter/index.d.ts +20 -0
  411. package/dist/md/linter/index.d.ts.map +1 -0
  412. package/dist/md/linter/index.js +412 -0
  413. package/dist/md/linter/index.js.map +1 -0
  414. package/dist/md/linter/token-optimizer.d.ts +66 -0
  415. package/dist/md/linter/token-optimizer.d.ts.map +1 -0
  416. package/dist/md/linter/token-optimizer.js +292 -0
  417. package/dist/md/linter/token-optimizer.js.map +1 -0
  418. package/dist/md/lister/index.d.ts +42 -0
  419. package/dist/md/lister/index.d.ts.map +1 -0
  420. package/dist/md/lister/index.js +317 -0
  421. package/dist/md/lister/index.js.map +1 -0
  422. package/dist/md/parser/heading-numbers.d.ts +43 -0
  423. package/dist/md/parser/heading-numbers.d.ts.map +1 -0
  424. package/dist/md/parser/heading-numbers.js +97 -0
  425. package/dist/md/parser/heading-numbers.js.map +1 -0
  426. package/dist/md/parser/section-meta.d.ts +50 -0
  427. package/dist/md/parser/section-meta.d.ts.map +1 -0
  428. package/dist/md/parser/section-meta.js +212 -0
  429. package/dist/md/parser/section-meta.js.map +1 -0
  430. package/dist/md/parser/template.d.ts +56 -0
  431. package/dist/md/parser/template.d.ts.map +1 -0
  432. package/dist/md/parser/template.js +122 -0
  433. package/dist/md/parser/template.js.map +1 -0
  434. package/dist/md/plugins/loader.d.ts +15 -0
  435. package/dist/md/plugins/loader.d.ts.map +1 -0
  436. package/dist/md/plugins/loader.js +80 -0
  437. package/dist/md/plugins/loader.js.map +1 -0
  438. package/dist/md/plugins/normalize-headings.d.ts +43 -0
  439. package/dist/md/plugins/normalize-headings.d.ts.map +1 -0
  440. package/dist/md/plugins/normalize-headings.js +51 -0
  441. package/dist/md/plugins/normalize-headings.js.map +1 -0
  442. package/dist/md/plugins/normalize-whitespace.d.ts +46 -0
  443. package/dist/md/plugins/normalize-whitespace.d.ts.map +1 -0
  444. package/dist/md/plugins/normalize-whitespace.js +86 -0
  445. package/dist/md/plugins/normalize-whitespace.js.map +1 -0
  446. package/dist/md/plugins/remove-badges.d.ts +36 -0
  447. package/dist/md/plugins/remove-badges.d.ts.map +1 -0
  448. package/dist/md/plugins/remove-badges.js +59 -0
  449. package/dist/md/plugins/remove-badges.js.map +1 -0
  450. package/dist/md/plugins/remove-comments.d.ts +27 -0
  451. package/dist/md/plugins/remove-comments.d.ts.map +1 -0
  452. package/dist/md/plugins/remove-comments.js +40 -0
  453. package/dist/md/plugins/remove-comments.js.map +1 -0
  454. package/dist/md/plugins/remove-duplicates.d.ts +40 -0
  455. package/dist/md/plugins/remove-duplicates.d.ts.map +1 -0
  456. package/dist/md/plugins/remove-duplicates.js +72 -0
  457. package/dist/md/plugins/remove-duplicates.js.map +1 -0
  458. package/dist/md/plugins/remove-internal-links.d.ts +38 -0
  459. package/dist/md/plugins/remove-internal-links.d.ts.map +1 -0
  460. package/dist/md/plugins/remove-internal-links.js +66 -0
  461. package/dist/md/plugins/remove-internal-links.js.map +1 -0
  462. package/dist/md/plugins/strip-heading-numbers.d.ts +35 -0
  463. package/dist/md/plugins/strip-heading-numbers.d.ts.map +1 -0
  464. package/dist/md/plugins/strip-heading-numbers.js +59 -0
  465. package/dist/md/plugins/strip-heading-numbers.js.map +1 -0
  466. package/dist/md/plugins/strip-section-meta.d.ts +37 -0
  467. package/dist/md/plugins/strip-section-meta.d.ts.map +1 -0
  468. package/dist/md/plugins/strip-section-meta.js +62 -0
  469. package/dist/md/plugins/strip-section-meta.js.map +1 -0
  470. package/dist/md/types/config.d.ts +260 -0
  471. package/dist/md/types/config.d.ts.map +1 -0
  472. package/dist/md/types/config.js +156 -0
  473. package/dist/md/types/config.js.map +1 -0
  474. package/dist/md/types/document.d.ts +37 -0
  475. package/dist/md/types/document.d.ts.map +1 -0
  476. package/dist/md/types/document.js +2 -0
  477. package/dist/md/types/document.js.map +1 -0
  478. package/dist/md/types/validation.d.ts +107 -0
  479. package/dist/md/types/validation.d.ts.map +1 -0
  480. package/dist/md/types/validation.js +2 -0
  481. package/dist/md/types/validation.js.map +1 -0
  482. package/dist/md/utils/code-blocks.d.ts +136 -0
  483. package/dist/md/utils/code-blocks.d.ts.map +1 -0
  484. package/dist/md/utils/code-blocks.js +178 -0
  485. package/dist/md/utils/code-blocks.js.map +1 -0
  486. package/dist/md/utils/config.d.ts +10 -0
  487. package/dist/md/utils/config.d.ts.map +1 -0
  488. package/dist/md/utils/config.js +99 -0
  489. package/dist/md/utils/config.js.map +1 -0
  490. package/dist/md/utils/file-collector.d.ts +78 -0
  491. package/dist/md/utils/file-collector.d.ts.map +1 -0
  492. package/dist/md/utils/file-collector.js +100 -0
  493. package/dist/md/utils/file-collector.js.map +1 -0
  494. package/dist/md/utils/markdown.d.ts +18 -0
  495. package/dist/md/utils/markdown.d.ts.map +1 -0
  496. package/dist/md/utils/markdown.js +93 -0
  497. package/dist/md/utils/markdown.js.map +1 -0
  498. package/dist/md/utils/remark.d.ts +91 -0
  499. package/dist/md/utils/remark.d.ts.map +1 -0
  500. package/dist/md/utils/remark.js +125 -0
  501. package/dist/md/utils/remark.js.map +1 -0
  502. package/dist/md/utils/tokens.d.ts +9 -0
  503. package/dist/md/utils/tokens.d.ts.map +1 -0
  504. package/dist/md/utils/tokens.js +31 -0
  505. package/dist/md/utils/tokens.js.map +1 -0
  506. package/dist/md/validator/index.d.ts +40 -0
  507. package/dist/md/validator/index.d.ts.map +1 -0
  508. package/dist/md/validator/index.js +289 -0
  509. package/dist/md/validator/index.js.map +1 -0
  510. package/dist/parsers/details-jsdoc.d.ts +46 -0
  511. package/dist/parsers/details-jsdoc.d.ts.map +1 -0
  512. package/dist/parsers/details-jsdoc.js +262 -0
  513. package/dist/parsers/details-jsdoc.js.map +1 -0
  514. package/dist/parsers/details-zod.d.ts +22 -0
  515. package/dist/parsers/details-zod.d.ts.map +1 -0
  516. package/dist/parsers/details-zod.js +145 -0
  517. package/dist/parsers/details-zod.js.map +1 -0
  518. package/dist/parsers/drizzle-schema.d.ts +92 -0
  519. package/dist/parsers/drizzle-schema.d.ts.map +1 -0
  520. package/dist/parsers/drizzle-schema.js +376 -0
  521. package/dist/parsers/drizzle-schema.js.map +1 -0
  522. package/dist/parsers/feature-map-tags.d.ts +45 -0
  523. package/dist/parsers/feature-map-tags.d.ts.map +1 -0
  524. package/dist/parsers/feature-map-tags.js +292 -0
  525. package/dist/parsers/feature-map-tags.js.map +1 -0
  526. package/dist/parsers/feature-map-type-extraction.d.ts +62 -0
  527. package/dist/parsers/feature-map-type-extraction.d.ts.map +1 -0
  528. package/dist/parsers/feature-map-type-extraction.js +347 -0
  529. package/dist/parsers/feature-map-type-extraction.js.map +1 -0
  530. package/dist/parsers/feature-map-utils.d.ts +34 -0
  531. package/dist/parsers/feature-map-utils.d.ts.map +1 -0
  532. package/dist/parsers/feature-map-utils.js +101 -0
  533. package/dist/parsers/feature-map-utils.js.map +1 -0
  534. package/dist/parsers/jsdoc-common.d.ts +209 -0
  535. package/dist/parsers/jsdoc-common.d.ts.map +1 -0
  536. package/dist/parsers/jsdoc-common.js +655 -0
  537. package/dist/parsers/jsdoc-common.js.map +1 -0
  538. package/dist/parsers/jsdoc.d.ts +76 -0
  539. package/dist/parsers/jsdoc.d.ts.map +1 -0
  540. package/dist/parsers/jsdoc.js +238 -0
  541. package/dist/parsers/jsdoc.js.map +1 -0
  542. package/dist/parsers/screenshot-annotations.d.ts +96 -0
  543. package/dist/parsers/screenshot-annotations.d.ts.map +1 -0
  544. package/dist/parsers/screenshot-annotations.js +227 -0
  545. package/dist/parsers/screenshot-annotations.js.map +1 -0
  546. package/dist/parsers/test-annotations.d.ts +46 -0
  547. package/dist/parsers/test-annotations.d.ts.map +1 -0
  548. package/dist/parsers/test-annotations.js +393 -0
  549. package/dist/parsers/test-annotations.js.map +1 -0
  550. package/dist/parsers/test-categorization.d.ts +42 -0
  551. package/dist/parsers/test-categorization.d.ts.map +1 -0
  552. package/dist/parsers/test-categorization.js +182 -0
  553. package/dist/parsers/test-categorization.js.map +1 -0
  554. package/dist/parsers/zod-schema.d.ts +105 -0
  555. package/dist/parsers/zod-schema.d.ts.map +1 -0
  556. package/dist/parsers/zod-schema.js +270 -0
  557. package/dist/parsers/zod-schema.js.map +1 -0
  558. package/dist/utils/action-inference.d.ts +23 -0
  559. package/dist/utils/action-inference.d.ts.map +1 -0
  560. package/dist/utils/action-inference.js +36 -0
  561. package/dist/utils/action-inference.js.map +1 -0
  562. package/dist/utils/app-inference.d.ts +31 -0
  563. package/dist/utils/app-inference.d.ts.map +1 -0
  564. package/dist/utils/app-inference.js +41 -0
  565. package/dist/utils/app-inference.js.map +1 -0
  566. package/dist/utils/auto-infer.d.ts +93 -0
  567. package/dist/utils/auto-infer.d.ts.map +1 -0
  568. package/dist/utils/auto-infer.js +184 -0
  569. package/dist/utils/auto-infer.js.map +1 -0
  570. package/dist/utils/config.d.ts +709 -0
  571. package/dist/utils/config.d.ts.map +1 -0
  572. package/dist/utils/config.js +504 -0
  573. package/dist/utils/config.js.map +1 -0
  574. package/dist/utils/file.d.ts +46 -0
  575. package/dist/utils/file.d.ts.map +1 -0
  576. package/dist/utils/file.js +103 -0
  577. package/dist/utils/file.js.map +1 -0
  578. package/dist/utils/formatters.d.ts +111 -0
  579. package/dist/utils/formatters.d.ts.map +1 -0
  580. package/dist/utils/formatters.js +164 -0
  581. package/dist/utils/formatters.js.map +1 -0
  582. package/dist/utils/gh-config.d.ts +99 -0
  583. package/dist/utils/gh-config.d.ts.map +1 -0
  584. package/dist/utils/gh-config.js +247 -0
  585. package/dist/utils/gh-config.js.map +1 -0
  586. package/dist/utils/github.d.ts +98 -0
  587. package/dist/utils/github.d.ts.map +1 -0
  588. package/dist/utils/github.js +295 -0
  589. package/dist/utils/github.js.map +1 -0
  590. package/dist/utils/html.d.ts +107 -0
  591. package/dist/utils/html.d.ts.map +1 -0
  592. package/dist/utils/html.js +376 -0
  593. package/dist/utils/html.js.map +1 -0
  594. package/dist/utils/i18n.d.ts +40 -0
  595. package/dist/utils/i18n.d.ts.map +1 -0
  596. package/dist/utils/i18n.js +148 -0
  597. package/dist/utils/i18n.js.map +1 -0
  598. package/dist/utils/logger.d.ts +20 -0
  599. package/dist/utils/logger.d.ts.map +1 -0
  600. package/dist/utils/logger.js +49 -0
  601. package/dist/utils/logger.js.map +1 -0
  602. package/dist/utils/project-fields.d.ts +71 -0
  603. package/dist/utils/project-fields.d.ts.map +1 -0
  604. package/dist/utils/project-fields.js +318 -0
  605. package/dist/utils/project-fields.js.map +1 -0
  606. package/dist/utils/repo-pairs.d.ts +94 -0
  607. package/dist/utils/repo-pairs.d.ts.map +1 -0
  608. package/dist/utils/repo-pairs.js +196 -0
  609. package/dist/utils/repo-pairs.js.map +1 -0
  610. package/dist/utils/route-inference.d.ts +81 -0
  611. package/dist/utils/route-inference.d.ts.map +1 -0
  612. package/dist/utils/route-inference.js +137 -0
  613. package/dist/utils/route-inference.js.map +1 -0
  614. package/dist/utils/setup-check.d.ts +34 -0
  615. package/dist/utils/setup-check.d.ts.map +1 -0
  616. package/dist/utils/setup-check.js +136 -0
  617. package/dist/utils/setup-check.js.map +1 -0
  618. package/dist/utils/shirokumaignore.d.ts +55 -0
  619. package/dist/utils/shirokumaignore.d.ts.map +1 -0
  620. package/dist/utils/shirokumaignore.js +94 -0
  621. package/dist/utils/shirokumaignore.js.map +1 -0
  622. package/dist/utils/skills-repo.d.ts +353 -0
  623. package/dist/utils/skills-repo.d.ts.map +1 -0
  624. package/dist/utils/skills-repo.js +793 -0
  625. package/dist/utils/skills-repo.js.map +1 -0
  626. package/dist/utils/status-workflow.d.ts +54 -0
  627. package/dist/utils/status-workflow.d.ts.map +1 -0
  628. package/dist/utils/status-workflow.js +103 -0
  629. package/dist/utils/status-workflow.js.map +1 -0
  630. package/dist/validators/frontmatter.d.ts +41 -0
  631. package/dist/validators/frontmatter.d.ts.map +1 -0
  632. package/dist/validators/frontmatter.js +117 -0
  633. package/dist/validators/frontmatter.js.map +1 -0
  634. package/dist/validators/link-checker.d.ts +48 -0
  635. package/dist/validators/link-checker.d.ts.map +1 -0
  636. package/dist/validators/link-checker.js +108 -0
  637. package/dist/validators/link-checker.js.map +1 -0
  638. package/dist/validators/markdown-structure.d.ts +50 -0
  639. package/dist/validators/markdown-structure.d.ts.map +1 -0
  640. package/dist/validators/markdown-structure.js +253 -0
  641. package/dist/validators/markdown-structure.js.map +1 -0
  642. package/i18n/cli/en.json +155 -0
  643. package/i18n/cli/ja.json +155 -0
  644. package/i18n/discussion/en.json +191 -0
  645. package/i18n/discussion/ja.json +191 -0
  646. package/package.json +113 -0
  647. package/portal/app/api-tools/api-tools-client.tsx +411 -0
  648. package/portal/app/api-tools/api-tools-document.tsx +240 -0
  649. package/portal/app/api-tools/page.tsx +56 -0
  650. package/portal/app/api-tools/swagger-view.tsx +114 -0
  651. package/portal/app/apps/[appId]/[type]/[module]/[item]/item-tabs-client.tsx +71 -0
  652. package/portal/app/apps/[appId]/[type]/[module]/[item]/page.tsx +1422 -0
  653. package/portal/app/apps/[appId]/[type]/[module]/page.tsx +373 -0
  654. package/portal/app/apps/[appId]/feature-map/feature-map-app-document.tsx +298 -0
  655. package/portal/app/apps/[appId]/feature-map/page.tsx +224 -0
  656. package/portal/app/apps/[appId]/i18n/page.tsx +139 -0
  657. package/portal/app/apps/[appId]/test-cases/page.tsx +840 -0
  658. package/portal/app/apps/[appId]/tools/[tool]/page.tsx +351 -0
  659. package/portal/app/apps/[appId]/tools/api-tools-client.tsx +429 -0
  660. package/portal/app/apps/[appId]/tools/page.tsx +119 -0
  661. package/portal/app/db-schema/[db]/[table]/page.tsx +235 -0
  662. package/portal/app/db-schema/[db]/diagram/page.tsx +81 -0
  663. package/portal/app/db-schema/[db]/page.tsx +148 -0
  664. package/portal/app/db-schema/db-schema-document.tsx +100 -0
  665. package/portal/app/db-schema/diagram/client.tsx +211 -0
  666. package/portal/app/db-schema/diagram/page.tsx +20 -0
  667. package/portal/app/db-schema/page.tsx +145 -0
  668. package/portal/app/db-schema/table-detail-document.tsx +710 -0
  669. package/portal/app/db-schema/table-detail.tsx +747 -0
  670. package/portal/app/db-schema/table-list-document.tsx +224 -0
  671. package/portal/app/db-schema/table-list.tsx +247 -0
  672. package/portal/app/details/[type]/[module]/[item]/item-tabs-client.tsx +71 -0
  673. package/portal/app/details/[type]/[module]/[item]/page.tsx +1286 -0
  674. package/portal/app/details/[type]/[module]/page.tsx +884 -0
  675. package/portal/app/feature-map/feature-map-client.tsx +681 -0
  676. package/portal/app/feature-map/feature-map-document.tsx +313 -0
  677. package/portal/app/feature-map/page.tsx +438 -0
  678. package/portal/app/globals.css +205 -0
  679. package/portal/app/i18n/[...namespace]/page.tsx +190 -0
  680. package/portal/app/i18n/i18n-client.tsx +369 -0
  681. package/portal/app/i18n/page.tsx +339 -0
  682. package/portal/app/layout.tsx +37 -0
  683. package/portal/app/overview/page.tsx +65 -0
  684. package/portal/app/packages/[packageId]/page.tsx +201 -0
  685. package/portal/app/packages/page.tsx +148 -0
  686. package/portal/app/page.tsx +568 -0
  687. package/portal/app/test-cases/[file]/[line]/page.tsx +455 -0
  688. package/portal/app/test-cases/[file]/[line]/test-detail-document.tsx +335 -0
  689. package/portal/app/test-cases/[file]/page.tsx +323 -0
  690. package/portal/app/test-cases/[file]/test-file-document.tsx +335 -0
  691. package/portal/app/test-cases/page.tsx +546 -0
  692. package/portal/app/test-cases/test-cases-document.tsx +384 -0
  693. package/portal/components/code-block.tsx +57 -0
  694. package/portal/components/document/doc-params-table.tsx +71 -0
  695. package/portal/components/document/doc-section.tsx +133 -0
  696. package/portal/components/document/doc-table.tsx +119 -0
  697. package/portal/components/document/index.ts +9 -0
  698. package/portal/components/drawflow-er-diagram.tsx +607 -0
  699. package/portal/components/interactive-er-diagram.tsx +228 -0
  700. package/portal/components/layout/app-sidebar.tsx +490 -0
  701. package/portal/components/layout/er-sidebar.tsx +116 -0
  702. package/portal/components/layout/global-header.tsx +117 -0
  703. package/portal/components/layout/layout-content.tsx +48 -0
  704. package/portal/components/markdown-content.tsx +120 -0
  705. package/portal/components/mermaid-diagram.tsx +83 -0
  706. package/portal/components/reactflow-er-diagram.tsx +475 -0
  707. package/portal/components/search-dialog.tsx +268 -0
  708. package/portal/components/shared/coverage-score-bar.tsx +144 -0
  709. package/portal/components/swagger/endpoint-accordion.tsx +117 -0
  710. package/portal/components/swagger/index.ts +7 -0
  711. package/portal/components/swagger/method-badge.tsx +55 -0
  712. package/portal/components/swagger/params-table.tsx +78 -0
  713. package/portal/components/tabs-with-hash.tsx +43 -0
  714. package/portal/components/test/index.ts +2 -0
  715. package/portal/components/test/test-bdd-card.tsx +192 -0
  716. package/portal/components/test/test-matrix.tsx +242 -0
  717. package/portal/components/ui/accordion.tsx +66 -0
  718. package/portal/components/ui/badge.tsx +46 -0
  719. package/portal/components/ui/breadcrumb.tsx +109 -0
  720. package/portal/components/ui/button.tsx +62 -0
  721. package/portal/components/ui/card.tsx +92 -0
  722. package/portal/components/ui/collapsible.tsx +33 -0
  723. package/portal/components/ui/dialog.tsx +118 -0
  724. package/portal/components/ui/progress.tsx +28 -0
  725. package/portal/components/ui/scroll-area.tsx +58 -0
  726. package/portal/components/ui/sheet.tsx +139 -0
  727. package/portal/components/ui/table.tsx +116 -0
  728. package/portal/components/ui/tabs.tsx +66 -0
  729. package/portal/components.json +21 -0
  730. package/portal/lib/constants/test-categories.ts +186 -0
  731. package/portal/lib/data-loader.ts +1181 -0
  732. package/portal/lib/db-schema-utils.ts +182 -0
  733. package/portal/lib/format.ts +43 -0
  734. package/portal/lib/hooks/use-hash-tab.ts +144 -0
  735. package/portal/lib/path-utils.ts +25 -0
  736. package/portal/lib/search-index-generator.ts +214 -0
  737. package/portal/lib/search.ts +126 -0
  738. package/portal/lib/sidebar-context.tsx +111 -0
  739. package/portal/lib/types.ts +740 -0
  740. package/portal/lib/utils.ts +6 -0
  741. package/portal/next.config.ts +21 -0
  742. package/portal/package.json +45 -0
  743. package/portal/postcss.config.mjs +8 -0
  744. package/portal/tsconfig.json +41 -0
  745. package/portal/types/drawflow.d.ts +80 -0
  746. package/templates/README.md +73 -0
  747. package/templates/coverage.html +367 -0
  748. package/templates/dark-theme.css +443 -0
  749. package/templates/discussion/adr.yml.hbs +65 -0
  750. package/templates/discussion/handovers.yml.hbs +57 -0
  751. package/templates/discussion/knowledge.yml.hbs +60 -0
  752. package/templates/discussion/reports.yml.hbs +68 -0
  753. package/templates/discussion/research.yml.hbs +61 -0
@@ -0,0 +1,793 @@
1
+ /**
2
+ * Bundled plugin utilities for shirokuma-skills-en
3
+ *
4
+ * @description Constants, validators, and helpers for installing/updating
5
+ * the bundled shirokuma-skills-en plugin. Skills and rules are bundled in
6
+ * the plugin/ directory within the shirokuma-docs npm package.
7
+ */
8
+ import { join, dirname } from "node:path";
9
+ import { existsSync, mkdirSync, rmSync, readFileSync, writeFileSync, readdirSync, statSync } from "node:fs";
10
+ import { execFileSync } from "node:child_process";
11
+ import { fileURLToPath } from "node:url";
12
+ import { homedir } from "node:os";
13
+ import { createLogger } from "./logger.js";
14
+ // ========================================
15
+ // Constants
16
+ // ========================================
17
+ /**
18
+ * Plugin name for the bundled skills/rules package
19
+ */
20
+ export const PLUGIN_NAME = "shirokuma-skills-en";
21
+ /**
22
+ * Japanese language plugin name (parallel plugin for i18n)
23
+ */
24
+ export const PLUGIN_NAME_JA = "shirokuma-skills-ja";
25
+ /**
26
+ * Hooks-only plugin name (language-independent safety hooks)
27
+ */
28
+ export const PLUGIN_NAME_HOOKS = "shirokuma-hooks";
29
+ /**
30
+ * Available skills list (matches actual plugin/skills/ directory names)
31
+ */
32
+ export const AVAILABLE_SKILLS = [
33
+ // Meta skills (managing Claude Code configuration)
34
+ "managing-agents",
35
+ "managing-skills",
36
+ "managing-plugins",
37
+ "managing-output-styles",
38
+ "managing-rules",
39
+ // Development skills
40
+ "frontend-designing",
41
+ "nextjs-vibe-coding",
42
+ "reviewing-on-issue",
43
+ "codebase-rule-discovery",
44
+ // Fork skills (formerly agents, merged in #182)
45
+ "best-practices-researching",
46
+ "claude-config-reviewing",
47
+ // Workflow skills
48
+ "planning-on-issue",
49
+ "working-on-issue",
50
+ "committing-on-issue",
51
+ "creating-pr-on-issue",
52
+ // GitHub integration skills
53
+ "github-project-setup",
54
+ "starting-session",
55
+ "ending-session",
56
+ "showing-github",
57
+ "managing-github-items",
58
+ "project-config-generator",
59
+ // Release management
60
+ "publishing",
61
+ ];
62
+ /**
63
+ * Available rules list
64
+ */
65
+ export const AVAILABLE_RULES = [
66
+ "best-practices-first.md",
67
+ "config-authoring-flow.md",
68
+ "git-commit-style.md",
69
+ "output-destinations.md",
70
+ "skill-authoring.md",
71
+ "github/branch-workflow.md",
72
+ "github/discussions-usage.md",
73
+ "github/pr-review-response.md",
74
+ "github/project-items.md",
75
+ "nextjs/known-issues.md",
76
+ "nextjs/lib-structure.md",
77
+ "nextjs/radix-ui-hydration.md",
78
+ "nextjs/server-actions.md",
79
+ "nextjs/tailwind-v4.md",
80
+ "nextjs/tech-stack.md",
81
+ "nextjs/testing.md",
82
+ "shirokuma-docs/cli-invocation.md",
83
+ "shirokuma-docs/plugin-cache.md",
84
+ "shirokuma-docs/shirokuma-annotations.md",
85
+ ];
86
+ /**
87
+ * Deploy target directory for rules (relative to project root)
88
+ */
89
+ export const DEPLOYED_RULES_DIR = ".claude/rules/shirokuma";
90
+ /**
91
+ * Deploy target directory for Japanese rules (relative to project root)
92
+ */
93
+ export const DEPLOYED_RULES_DIR_JA = ".claude/rules/shirokuma-ja";
94
+ /**
95
+ * Gitignore entries managed by shirokuma-docs init
96
+ */
97
+ export const GITIGNORE_ENTRIES = [
98
+ ".claude/rules/shirokuma/",
99
+ ".claude/plans/",
100
+ ];
101
+ // ========================================
102
+ // Path Resolution
103
+ // ========================================
104
+ /**
105
+ * Get path to a bundled plugin directory by name
106
+ *
107
+ * Resolves the plugin directory relative to this module's location.
108
+ * In development: {repo-root}/plugin/{pluginName}/
109
+ * When installed: {node_modules/shirokuma-docs}/plugin/{pluginName}/
110
+ *
111
+ * @param pluginName - Plugin directory name
112
+ * @returns Absolute path to the bundled plugin directory
113
+ */
114
+ export function getBundledPluginPathFor(pluginName) {
115
+ const thisFile = fileURLToPath(import.meta.url);
116
+ // From src/utils/skills-repo.ts → go up 2 levels to package root
117
+ // From dist/utils/skills-repo.js → go up 2 levels to package root
118
+ const packageRoot = join(dirname(thisFile), "..", "..");
119
+ return join(packageRoot, "plugin", pluginName);
120
+ }
121
+ /**
122
+ * Get path to the bundled plugin directory (EN)
123
+ *
124
+ * @returns Absolute path to the bundled plugin directory
125
+ */
126
+ export function getBundledPluginPath() {
127
+ return getBundledPluginPathFor(PLUGIN_NAME);
128
+ }
129
+ /**
130
+ * Get path to the bundled Japanese plugin directory
131
+ *
132
+ * @returns Absolute path to the bundled Japanese plugin directory
133
+ */
134
+ export function getBundledPluginPathJa() {
135
+ return getBundledPluginPathFor(PLUGIN_NAME_JA);
136
+ }
137
+ /**
138
+ * Check if the Japanese plugin is bundled in this package
139
+ *
140
+ * @returns true if the Japanese plugin directory exists
141
+ */
142
+ export function hasJaPlugin() {
143
+ return existsSync(join(getBundledPluginPathJa(), ".claude-plugin", "plugin.json"));
144
+ }
145
+ /**
146
+ * Check if the hooks plugin is bundled in this package
147
+ *
148
+ * @returns true if the hooks plugin directory exists
149
+ */
150
+ export function hasHooksPlugin() {
151
+ return existsSync(join(getBundledPluginPathFor(PLUGIN_NAME_HOOKS), ".claude-plugin", "plugin.json"));
152
+ }
153
+ /**
154
+ * Get version from package.json
155
+ *
156
+ * @returns Package version string or "unknown"
157
+ */
158
+ export function getPackageVersion() {
159
+ try {
160
+ const thisFile = fileURLToPath(import.meta.url);
161
+ const packageRoot = join(dirname(thisFile), "..", "..");
162
+ const packageJsonPath = join(packageRoot, "package.json");
163
+ const content = readFileSync(packageJsonPath, "utf-8");
164
+ const pkg = JSON.parse(content);
165
+ return pkg.version ?? "unknown";
166
+ }
167
+ catch {
168
+ return "unknown";
169
+ }
170
+ }
171
+ /**
172
+ * Get version from the bundled plugin's plugin.json
173
+ *
174
+ * @returns Plugin version string or "unknown"
175
+ */
176
+ export function getPluginVersion() {
177
+ try {
178
+ const pluginJsonPath = join(getBundledPluginPath(), ".claude-plugin", "plugin.json");
179
+ const content = readFileSync(pluginJsonPath, "utf-8");
180
+ const pluginJson = JSON.parse(content);
181
+ return pluginJson.version ?? "unknown";
182
+ }
183
+ catch {
184
+ return "unknown";
185
+ }
186
+ }
187
+ // ========================================
188
+ // Validation
189
+ // ========================================
190
+ /**
191
+ * Validate skill name against AVAILABLE_SKILLS list
192
+ *
193
+ * @param skill - Skill name to validate
194
+ * @returns true if skill is in the available list
195
+ */
196
+ export function isValidSkill(skill) {
197
+ return AVAILABLE_SKILLS.includes(skill);
198
+ }
199
+ /**
200
+ * Validate skill name format (prevents path traversal)
201
+ *
202
+ * Accepts: lowercase alphanumeric + hyphens (e.g., "managing-agents", "reviewing-on-issue")
203
+ * Rejects: dots, slashes, underscores, spaces, uppercase, empty strings
204
+ *
205
+ * @param name - Skill name to validate
206
+ * @returns true if the name is a safe, valid format
207
+ */
208
+ export function isValidSkillName(name) {
209
+ return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(name);
210
+ }
211
+ // ========================================
212
+ // Bundled Skills Discovery
213
+ // ========================================
214
+ /**
215
+ * Get list of skill names from the bundled plugin directory
216
+ *
217
+ * Scans the plugin/skills/ directory to detect available skills,
218
+ * independent of the AVAILABLE_SKILLS constant.
219
+ *
220
+ * @returns Array of valid skill names found in the bundled plugin
221
+ */
222
+ export function getBundledSkillNames() {
223
+ const skillsDir = join(getBundledPluginPath(), "skills");
224
+ if (!existsSync(skillsDir)) {
225
+ return [];
226
+ }
227
+ return readdirSync(skillsDir).filter(name => {
228
+ const fullPath = join(skillsDir, name);
229
+ return statSync(fullPath).isDirectory() && isValidSkillName(name);
230
+ });
231
+ }
232
+ // ========================================
233
+ // Bundled Rules Discovery
234
+ // ========================================
235
+ /**
236
+ * Get list of rule file paths from the bundled plugin directory
237
+ *
238
+ * Scans plugin/rules/ up to 2 levels deep (root + 1 subdirectory),
239
+ * returning relative paths like "best-practices-first.md",
240
+ * "github/project-items.md", etc.
241
+ *
242
+ * Note: Matches the depth of getInstalledRules(). If deeper nesting
243
+ * is needed in the future, both functions should be updated together.
244
+ *
245
+ * @returns Array of relative rule file paths
246
+ */
247
+ export function getBundledRuleNames() {
248
+ return getBundledRuleNamesFrom(join(getBundledPluginPath(), "rules"));
249
+ }
250
+ /**
251
+ * Get list of rule file paths from a given rules directory
252
+ *
253
+ * Scans up to 2 levels deep (root + 1 subdirectory).
254
+ *
255
+ * @param rulesDir - Absolute path to rules directory
256
+ * @returns Array of relative rule file paths
257
+ */
258
+ export function getBundledRuleNamesFrom(rulesDir) {
259
+ if (!existsSync(rulesDir)) {
260
+ return [];
261
+ }
262
+ const rules = [];
263
+ const entries = readdirSync(rulesDir, { withFileTypes: true });
264
+ for (const entry of entries) {
265
+ if (entry.isFile() && entry.name.endsWith(".md")) {
266
+ rules.push(entry.name);
267
+ }
268
+ else if (entry.isDirectory()) {
269
+ const subDir = join(rulesDir, entry.name);
270
+ const subEntries = readdirSync(subDir, { withFileTypes: true });
271
+ for (const subEntry of subEntries) {
272
+ if (subEntry.isFile() && subEntry.name.endsWith(".md")) {
273
+ rules.push(`${entry.name}/${subEntry.name}`);
274
+ }
275
+ }
276
+ }
277
+ }
278
+ return rules.sort();
279
+ }
280
+ // ========================================
281
+ // Self-Repository Detection
282
+ // ========================================
283
+ /**
284
+ * Detect if the project is the shirokuma-docs repository itself
285
+ *
286
+ * When running inside the shirokuma-docs repo, the bundled plugin source
287
+ * (plugin/shirokuma-skills-en/) is directly available, so copying to
288
+ * .claude/plugins/ is unnecessary.
289
+ *
290
+ * @param projectPath - Project root path
291
+ * @returns true if the project contains the plugin source
292
+ */
293
+ export function isSelfRepo(projectPath) {
294
+ return existsSync(join(projectPath, "plugin", PLUGIN_NAME, ".claude-plugin", "plugin.json"));
295
+ }
296
+ /**
297
+ * Get the effective plugin directory for a project
298
+ *
299
+ * For self-repo (shirokuma-docs itself): returns the bundled source path
300
+ * For external projects: global cache → bundled fallback
301
+ *
302
+ * @param projectPath - Project root path
303
+ * @returns Absolute path to the effective plugin directory
304
+ */
305
+ export function getEffectivePluginDir(projectPath) {
306
+ if (isSelfRepo(projectPath)) {
307
+ return getBundledPluginPath();
308
+ }
309
+ // 外部: キャッシュ → bundled フォールバック
310
+ return getGlobalCachePath(PLUGIN_NAME) ?? getBundledPluginPath();
311
+ }
312
+ // ========================================
313
+ // Plugin Installation
314
+ // ========================================
315
+ /**
316
+ * Install the bundled plugin to a project (self-repo 用)
317
+ *
318
+ * self-repo(shirokuma-docs 自身)では bundled source を直接使用するためスキップ。
319
+ * 外部プロジェクトでは ensureMarketplace() + registerPluginCache() を使用する。
320
+ * この関数は後方互換性のために残しているが、外部プロジェクトでのローカルコピーは
321
+ * 不要になった。
322
+ *
323
+ * @param projectPath - Target project root path
324
+ * @param verbose - Enable verbose logging
325
+ * @returns true on success, false on failure
326
+ */
327
+ export async function installPlugin(projectPath, verbose, pluginName = PLUGIN_NAME) {
328
+ const logger = createLogger(verbose);
329
+ const srcPath = getBundledPluginPathFor(pluginName);
330
+ if (!existsSync(srcPath)) {
331
+ logger.error(`Bundled plugin not found: ${srcPath}`);
332
+ return false;
333
+ }
334
+ // self-repo / 外部ともにローカルコピーは不要
335
+ if (isSelfRepo(projectPath)) {
336
+ logger.info("Self-repo detected: skipping plugin copy (using bundled source directly)");
337
+ }
338
+ else {
339
+ logger.info("External project: skipping local copy (using marketplace + cache)");
340
+ }
341
+ return true;
342
+ }
343
+ // ========================================
344
+ // Installed Skills/Rules Discovery
345
+ // ========================================
346
+ /**
347
+ * Get list of installed skill names from a project
348
+ *
349
+ * Scans the effective plugin directory for installed skills.
350
+ * For self-repo, reads from bundled source; otherwise from .claude/plugins/.
351
+ *
352
+ * @param projectPath - Project root path
353
+ * @returns Array of installed skill names
354
+ */
355
+ export function getInstalledSkills(projectPath) {
356
+ const skillsDir = join(getEffectivePluginDir(projectPath), "skills");
357
+ if (!existsSync(skillsDir)) {
358
+ return [];
359
+ }
360
+ return readdirSync(skillsDir).filter(name => {
361
+ const fullPath = join(skillsDir, name);
362
+ return statSync(fullPath).isDirectory() && isValidSkillName(name);
363
+ });
364
+ }
365
+ /**
366
+ * Get list of installed rule names from a project
367
+ *
368
+ * Scans the effective plugin directory for installed rules.
369
+ * For self-repo, reads from bundled source; otherwise from .claude/plugins/.
370
+ *
371
+ * @param projectPath - Project root path
372
+ * @returns Array of installed rule file paths
373
+ */
374
+ export function getInstalledRules(projectPath) {
375
+ const rulesDir = join(getEffectivePluginDir(projectPath), "rules");
376
+ if (!existsSync(rulesDir)) {
377
+ return [];
378
+ }
379
+ const rules = [];
380
+ const entries = readdirSync(rulesDir, { withFileTypes: true });
381
+ for (const entry of entries) {
382
+ if (entry.isFile() && entry.name.endsWith(".md")) {
383
+ rules.push(entry.name);
384
+ }
385
+ else if (entry.isDirectory()) {
386
+ // Scan subdirectories (e.g., github/, nextjs/)
387
+ const subDir = join(rulesDir, entry.name);
388
+ const subEntries = readdirSync(subDir, { withFileTypes: true });
389
+ for (const subEntry of subEntries) {
390
+ if (subEntry.isFile() && subEntry.name.endsWith(".md")) {
391
+ rules.push(`${entry.name}/${subEntry.name}`);
392
+ }
393
+ }
394
+ }
395
+ }
396
+ return rules;
397
+ }
398
+ // ========================================
399
+ // Gitignore Management
400
+ // ========================================
401
+ /**
402
+ * .gitignore にエントリを追加する(重複チェック付き)
403
+ *
404
+ * @param projectPath - プロジェクトルートパス
405
+ * @param options - オプション(dryRun, verbose)
406
+ * @returns 追加されたエントリ数
407
+ */
408
+ export function updateGitignore(projectPath, options = {}) {
409
+ const logger = createLogger(options.verbose ?? false);
410
+ const gitignorePath = join(projectPath, ".gitignore");
411
+ const added = [];
412
+ const alreadyPresent = [];
413
+ // 既存の .gitignore を読み込む(なければ空)
414
+ let content = "";
415
+ if (existsSync(gitignorePath)) {
416
+ content = readFileSync(gitignorePath, "utf-8");
417
+ }
418
+ // 各行をパースして既存エントリを収集
419
+ const existingEntries = new Set(content.split("\n")
420
+ .map(line => line.trim())
421
+ .filter(line => line && !line.startsWith("#")));
422
+ // 追加が必要なエントリを判定
423
+ const toAdd = [];
424
+ for (const entry of GITIGNORE_ENTRIES) {
425
+ if (existingEntries.has(entry)) {
426
+ alreadyPresent.push(entry);
427
+ }
428
+ else {
429
+ toAdd.push(entry);
430
+ }
431
+ }
432
+ if (toAdd.length === 0) {
433
+ logger.info(" .gitignore: 全エントリが既に存在します");
434
+ return { added, alreadyPresent };
435
+ }
436
+ // セクションコメント付きで追加
437
+ const section = [
438
+ "",
439
+ "# shirokuma-docs (managed by shirokuma-docs init)",
440
+ ...toAdd,
441
+ "",
442
+ ].join("\n");
443
+ const newContent = content.endsWith("\n") ? content + section : content + "\n" + section;
444
+ if (!options.dryRun) {
445
+ writeFileSync(gitignorePath, newContent, "utf-8");
446
+ }
447
+ for (const entry of toAdd) {
448
+ added.push(entry);
449
+ logger.info(` + ${entry}`);
450
+ }
451
+ return { added, alreadyPresent };
452
+ }
453
+ /**
454
+ * .gitignore から特定のエントリを削除する
455
+ *
456
+ * @param projectPath - プロジェクトルートパス
457
+ * @param entry - 削除するエントリ(例: ".claude/plugins/")
458
+ * @returns true: 削除成功、false: エントリが見つからないまたはファイルなし
459
+ */
460
+ export function removeGitignoreEntry(projectPath, entry) {
461
+ const gitignorePath = join(projectPath, ".gitignore");
462
+ if (!existsSync(gitignorePath))
463
+ return false;
464
+ const content = readFileSync(gitignorePath, "utf-8");
465
+ const lines = content.split("\n");
466
+ const filtered = lines.filter(line => line.trim() !== entry);
467
+ if (filtered.length === lines.length)
468
+ return false;
469
+ writeFileSync(gitignorePath, filtered.join("\n"), "utf-8");
470
+ return true;
471
+ }
472
+ /**
473
+ * レガシー .claude/plugins/ ディレクトリを削除する(マイグレーション用)
474
+ *
475
+ * 旧バージョンの init で作成された .claude/plugins/ ディレクトリと
476
+ * 対応する .gitignore エントリを削除する。
477
+ *
478
+ * @param projectPath - プロジェクトルートパス
479
+ */
480
+ export function cleanupLegacyPluginDir(projectPath) {
481
+ const legacyDir = join(projectPath, ".claude", "plugins");
482
+ if (existsSync(legacyDir)) {
483
+ rmSync(legacyDir, { recursive: true, force: true });
484
+ }
485
+ removeGitignoreEntry(projectPath, ".claude/plugins/");
486
+ }
487
+ // ========================================
488
+ // Rule Deployment
489
+ // ========================================
490
+ /**
491
+ * Deploy plugin rules to .claude/rules/shirokuma/ for Claude Code auto-loading
492
+ *
493
+ * Copies rule files from the bundled plugin directly to the target directory.
494
+ * The shirokuma/ directory is fully owned by shirokuma-docs, so files are
495
+ * always overwritten without conflict detection.
496
+ *
497
+ * @param projectPath - Target project root path
498
+ * @param options - Deploy options (dryRun, verbose)
499
+ * @returns Deploy result with per-file status
500
+ */
501
+ export async function deployRules(projectPath, options = {}) {
502
+ const logger = createLogger(options.verbose ?? false);
503
+ const pluginPath = options.bundledPluginPath ?? getBundledPluginPath();
504
+ const bundledRulesDir = join(pluginPath, "rules");
505
+ const targetDir = options.targetDir ?? join(projectPath, DEPLOYED_RULES_DIR);
506
+ const ruleNames = getBundledRuleNamesFrom(bundledRulesDir);
507
+ const results = [];
508
+ if (!existsSync(bundledRulesDir)) {
509
+ logger.warn("Bundled rules directory not found");
510
+ return { deployed: results, targetDir, unmanagedFiles: [] };
511
+ }
512
+ // Ensure target directory exists once before processing files
513
+ if (!options.dryRun) {
514
+ mkdirSync(targetDir, { recursive: true });
515
+ }
516
+ for (const ruleName of ruleNames) {
517
+ const srcPath = join(bundledRulesDir, ruleName);
518
+ const destPath = join(targetDir, ruleName);
519
+ try {
520
+ const sourceContent = readFileSync(srcPath, "utf-8");
521
+ const isNew = !existsSync(destPath);
522
+ // Check if content is identical (for reporting)
523
+ if (!isNew) {
524
+ const existingContent = readFileSync(destPath, "utf-8");
525
+ if (existingContent === sourceContent) {
526
+ results.push({ name: ruleName, status: "unchanged" });
527
+ continue;
528
+ }
529
+ }
530
+ // Deploy or overwrite
531
+ if (!options.dryRun) {
532
+ if (ruleName.includes("/")) {
533
+ mkdirSync(dirname(destPath), { recursive: true });
534
+ }
535
+ writeFileSync(destPath, sourceContent, "utf-8");
536
+ }
537
+ results.push({ name: ruleName, status: isNew ? "deployed" : "updated" });
538
+ logger.info(` ${isNew ? "+" : "↑"} ${ruleName} (${isNew ? "deployed" : "updated"})`);
539
+ }
540
+ catch (error) {
541
+ results.push({
542
+ name: ruleName,
543
+ status: "error",
544
+ reason: error instanceof Error ? error.message : String(error),
545
+ });
546
+ logger.warn(` ✗ ${ruleName} (error: ${error instanceof Error ? error.message : String(error)})`);
547
+ }
548
+ }
549
+ // 管理外ファイル検出(targetDir にあるが bundled にないファイル)
550
+ const unmanagedFiles = [];
551
+ if (existsSync(targetDir)) {
552
+ const scanForUnmanaged = (dir, prefix) => {
553
+ const entries = readdirSync(dir, { withFileTypes: true });
554
+ for (const entry of entries) {
555
+ if (entry.isFile() && entry.name.endsWith(".md")) {
556
+ const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
557
+ if (!ruleNames.includes(relativePath)) {
558
+ unmanagedFiles.push(relativePath);
559
+ }
560
+ }
561
+ else if (entry.isDirectory()) {
562
+ scanForUnmanaged(join(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
563
+ }
564
+ }
565
+ };
566
+ scanForUnmanaged(targetDir, "");
567
+ }
568
+ if (unmanagedFiles.length > 0) {
569
+ logger.warn(`管理外ファイル検出: ${unmanagedFiles.length}件`);
570
+ for (const file of unmanagedFiles) {
571
+ logger.warn(` ? ${file} (管理外)`);
572
+ }
573
+ }
574
+ return { deployed: results, targetDir, unmanagedFiles };
575
+ }
576
+ // ========================================
577
+ // Marketplace Management
578
+ // ========================================
579
+ /**
580
+ * マーケットプレース名(marketplace.json の name フィールドで解決)
581
+ */
582
+ export const MARKETPLACE_NAME = "shirokuma-library";
583
+ /**
584
+ * マーケットプレースリポジトリ
585
+ */
586
+ export const MARKETPLACE_REPO = "ShirokumaLibrary/shirokuma-plugins";
587
+ /**
588
+ * マーケットプレースが登録済みか確認し、未登録なら追加する
589
+ *
590
+ * `claude plugin marketplace list` で確認し、MARKETPLACE_NAME が
591
+ * 含まれていなければ `claude plugin marketplace add` で登録する。
592
+ *
593
+ * 既存の登録(directory/github)は上書きしない。
594
+ *
595
+ * @returns true: 登録済みまたは登録成功、false: 登録失敗
596
+ */
597
+ export function ensureMarketplace() {
598
+ try {
599
+ const output = execFileSync("claude", ["plugin", "marketplace", "list"], { encoding: "utf-8", timeout: 15000, stdio: "pipe" });
600
+ if (output.includes(MARKETPLACE_NAME)) {
601
+ return true;
602
+ }
603
+ }
604
+ catch {
605
+ // CLI エラー: 登録を試みる
606
+ }
607
+ try {
608
+ execFileSync("claude", ["plugin", "marketplace", "add", MARKETPLACE_REPO], { encoding: "utf-8", timeout: 30000, stdio: "pipe" });
609
+ return true;
610
+ }
611
+ catch {
612
+ return false;
613
+ }
614
+ }
615
+ /**
616
+ * グローバルキャッシュ内のプラグインディレクトリパスを解決する
617
+ *
618
+ * キャッシュパス: ~/.claude/plugins/cache/{marketplace}/{pluginName}/{version}/
619
+ *
620
+ * @param pluginName - プラグイン名
621
+ * @param version - 特定バージョン(省略時は最新を自動検出)
622
+ * @returns キャッシュパス、見つからない場合は null
623
+ */
624
+ export function getGlobalCachePath(pluginName, version) {
625
+ const cacheBase = join(homedir(), ".claude", "plugins", "cache", MARKETPLACE_NAME, pluginName);
626
+ if (!existsSync(cacheBase))
627
+ return null;
628
+ if (version) {
629
+ const versionDir = join(cacheBase, version);
630
+ return existsSync(versionDir) ? versionDir : null;
631
+ }
632
+ // version 未指定: ディレクトリをスキャンし最新を返す
633
+ // NOTE: 辞書順ソート。0.10.x 以降では semver ソートが必要になる
634
+ const versions = readdirSync(cacheBase)
635
+ .filter(name => {
636
+ try {
637
+ return statSync(join(cacheBase, name)).isDirectory();
638
+ }
639
+ catch {
640
+ return false;
641
+ }
642
+ })
643
+ .sort()
644
+ .reverse();
645
+ return versions.length > 0 ? join(cacheBase, versions[0]) : null;
646
+ }
647
+ // ========================================
648
+ // Cache Registration
649
+ // ========================================
650
+ /**
651
+ * Plugin identifier for Claude Code's plugin registry
652
+ */
653
+ export const PLUGIN_REGISTRY_ID = "shirokuma-skills-en@shirokuma-library";
654
+ /**
655
+ * Japanese plugin identifier for Claude Code's plugin registry
656
+ */
657
+ export const PLUGIN_REGISTRY_ID_JA = "shirokuma-skills-ja@shirokuma-library";
658
+ /**
659
+ * Hooks plugin identifier for Claude Code's plugin registry
660
+ */
661
+ export const PLUGIN_REGISTRY_ID_HOOKS = "shirokuma-hooks@shirokuma-library";
662
+ /**
663
+ * Register the plugin in Claude Code's global cache
664
+ *
665
+ * Runs `claude plugin install` to copy from .claude/plugins/ to the global
666
+ * cache (~/.claude/plugins/cache/). Claude Code only reads skills from the
667
+ * global cache, not the project-local directory.
668
+ *
669
+ * @param projectPath - Project root path
670
+ * @param options - Registration options
671
+ * @returns Registration result
672
+ */
673
+ export function registerPluginCache(projectPath, options = {}) {
674
+ // Check if claude CLI is available
675
+ if (!isClaudeCliAvailable()) {
676
+ return {
677
+ success: false,
678
+ method: "skipped",
679
+ message: "claude CLI not found in PATH",
680
+ };
681
+ }
682
+ const id = options.registryId ?? PLUGIN_REGISTRY_ID;
683
+ // In reinstall mode (e.g., same-version update), uninstall first
684
+ if (options.reinstall) {
685
+ try {
686
+ execFileSync("claude", ["plugin", "uninstall", id, "--scope", "project"], { cwd: projectPath, stdio: "pipe", timeout: 30000 });
687
+ }
688
+ catch {
689
+ // Ignore uninstall errors (plugin might not be installed yet)
690
+ }
691
+ }
692
+ // Install plugin to global cache
693
+ try {
694
+ execFileSync("claude", ["plugin", "install", id, "--scope", "project"], { cwd: projectPath, stdio: "pipe", timeout: 30000 });
695
+ return {
696
+ success: true,
697
+ method: options.reinstall ? "reinstall" : "install",
698
+ };
699
+ }
700
+ catch (error) {
701
+ const stderr = isSpawnError(error) ? String(error.stderr) : "";
702
+ return {
703
+ success: false,
704
+ method: options.reinstall ? "reinstall" : "install",
705
+ message: stderr || (error instanceof Error ? error.message : String(error)),
706
+ };
707
+ }
708
+ }
709
+ /**
710
+ * Check if the `claude` CLI is available in PATH
711
+ *
712
+ * @returns true if claude CLI is installed and accessible
713
+ */
714
+ export function isClaudeCliAvailable() {
715
+ try {
716
+ execFileSync("claude", ["--version"], { stdio: "pipe", timeout: 5000 });
717
+ return true;
718
+ }
719
+ catch {
720
+ return false;
721
+ }
722
+ }
723
+ /**
724
+ * Type guard for child_process spawn errors with stderr
725
+ */
726
+ function isSpawnError(error) {
727
+ return error instanceof Error && "stderr" in error;
728
+ }
729
+ // ========================================
730
+ // Language Detection
731
+ // ========================================
732
+ /**
733
+ * プロジェクトの .claude/settings.json から language 設定を読み取る
734
+ *
735
+ * @param projectPath - プロジェクトルートパス
736
+ * @returns "english" | "japanese" | null(未設定時)
737
+ */
738
+ export function getLanguageSetting(projectPath) {
739
+ const settingsPath = join(projectPath, ".claude", "settings.json");
740
+ if (!existsSync(settingsPath)) {
741
+ return null;
742
+ }
743
+ try {
744
+ const content = readFileSync(settingsPath, "utf-8");
745
+ const settings = JSON.parse(content);
746
+ return settings.language ?? null;
747
+ }
748
+ catch {
749
+ return null;
750
+ }
751
+ }
752
+ // ========================================
753
+ // Rule Cleanup
754
+ // ========================================
755
+ /**
756
+ * Remove all deployed rules by deleting .claude/rules/shirokuma/ directory
757
+ *
758
+ * The shirokuma/ directory is fully owned by shirokuma-docs, so the entire
759
+ * directory is removed without per-file checks.
760
+ *
761
+ * @param projectPath - Project root path
762
+ * @param options - Clean options (dryRun, verbose)
763
+ * @returns Array of removed items (for reporting)
764
+ */
765
+ export async function cleanDeployedRules(projectPath, options = {}) {
766
+ const logger = createLogger(options.verbose ?? false);
767
+ const targetDir = join(projectPath, DEPLOYED_RULES_DIR);
768
+ const results = [];
769
+ if (!existsSync(targetDir)) {
770
+ return results;
771
+ }
772
+ // Collect all files for reporting
773
+ const scanDir = (dir, prefix) => {
774
+ const entries = readdirSync(dir, { withFileTypes: true });
775
+ for (const entry of entries) {
776
+ if (entry.isFile()) {
777
+ const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
778
+ results.push({ name: relativePath, status: "removed" });
779
+ logger.info(` - ${relativePath} (removed)`);
780
+ }
781
+ else if (entry.isDirectory()) {
782
+ scanDir(join(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
783
+ }
784
+ }
785
+ };
786
+ scanDir(targetDir, "");
787
+ // Remove entire directory
788
+ if (!options.dryRun) {
789
+ rmSync(targetDir, { recursive: true, force: true });
790
+ }
791
+ return results;
792
+ }
793
+ //# sourceMappingURL=skills-repo.js.map