@polardbx/pxbaas 0.0.0-stage → 0.1.0-beta.10

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.
Files changed (312) hide show
  1. package/README.md +223 -2
  2. package/bin/pxbaas.js +13 -0
  3. package/dist/app/local-index.d.ts +70 -0
  4. package/dist/app/local-index.d.ts.map +1 -0
  5. package/dist/app/local-index.js +140 -0
  6. package/dist/app/local-index.js.map +1 -0
  7. package/dist/app/preflight.d.ts +61 -0
  8. package/dist/app/preflight.d.ts.map +1 -0
  9. package/dist/app/preflight.js +115 -0
  10. package/dist/app/preflight.js.map +1 -0
  11. package/dist/app/spec-lint.d.ts +45 -0
  12. package/dist/app/spec-lint.d.ts.map +1 -0
  13. package/dist/app/spec-lint.js +423 -0
  14. package/dist/app/spec-lint.js.map +1 -0
  15. package/dist/app/templates.d.ts +167 -0
  16. package/dist/app/templates.d.ts.map +1 -0
  17. package/dist/app/templates.js +151 -0
  18. package/dist/app/templates.js.map +1 -0
  19. package/dist/cli/help-guides.d.ts +17 -0
  20. package/dist/cli/help-guides.d.ts.map +1 -0
  21. package/dist/cli/help-guides.js +132 -0
  22. package/dist/cli/help-guides.js.map +1 -0
  23. package/dist/cli/root.d.ts +3 -0
  24. package/dist/cli/root.d.ts.map +1 -0
  25. package/dist/cli/root.js +75 -0
  26. package/dist/cli/root.js.map +1 -0
  27. package/dist/commands/app/index.d.ts +8 -0
  28. package/dist/commands/app/index.d.ts.map +1 -0
  29. package/dist/commands/app/index.js +1907 -0
  30. package/dist/commands/app/index.js.map +1 -0
  31. package/dist/commands/auth/index.d.ts +3 -0
  32. package/dist/commands/auth/index.d.ts.map +1 -0
  33. package/dist/commands/auth/index.js +198 -0
  34. package/dist/commands/auth/index.js.map +1 -0
  35. package/dist/commands/completion/index.d.ts +3 -0
  36. package/dist/commands/completion/index.d.ts.map +1 -0
  37. package/dist/commands/completion/index.js +14 -0
  38. package/dist/commands/completion/index.js.map +1 -0
  39. package/dist/commands/data/index.d.ts +55 -0
  40. package/dist/commands/data/index.d.ts.map +1 -0
  41. package/dist/commands/data/index.js +407 -0
  42. package/dist/commands/data/index.js.map +1 -0
  43. package/dist/commands/db/index.d.ts +29 -0
  44. package/dist/commands/db/index.d.ts.map +1 -0
  45. package/dist/commands/db/index.js +500 -0
  46. package/dist/commands/db/index.js.map +1 -0
  47. package/dist/commands/doctor/index.d.ts +3 -0
  48. package/dist/commands/doctor/index.d.ts.map +1 -0
  49. package/dist/commands/doctor/index.js +305 -0
  50. package/dist/commands/doctor/index.js.map +1 -0
  51. package/dist/commands/functions/delete.d.ts +3 -0
  52. package/dist/commands/functions/delete.d.ts.map +1 -0
  53. package/dist/commands/functions/delete.js +55 -0
  54. package/dist/commands/functions/delete.js.map +1 -0
  55. package/dist/commands/functions/deploy.d.ts +3 -0
  56. package/dist/commands/functions/deploy.d.ts.map +1 -0
  57. package/dist/commands/functions/deploy.js +118 -0
  58. package/dist/commands/functions/deploy.js.map +1 -0
  59. package/dist/commands/functions/index.d.ts +3 -0
  60. package/dist/commands/functions/index.d.ts.map +1 -0
  61. package/dist/commands/functions/index.js +15 -0
  62. package/dist/commands/functions/index.js.map +1 -0
  63. package/dist/commands/functions/list.d.ts +6 -0
  64. package/dist/commands/functions/list.d.ts.map +1 -0
  65. package/dist/commands/functions/list.js +63 -0
  66. package/dist/commands/functions/list.js.map +1 -0
  67. package/dist/commands/functions/new.d.ts +7 -0
  68. package/dist/commands/functions/new.d.ts.map +1 -0
  69. package/dist/commands/functions/new.js +72 -0
  70. package/dist/commands/functions/new.js.map +1 -0
  71. package/dist/commands/gen/index.d.ts +3 -0
  72. package/dist/commands/gen/index.d.ts.map +1 -0
  73. package/dist/commands/gen/index.js +323 -0
  74. package/dist/commands/gen/index.js.map +1 -0
  75. package/dist/commands/guide/index.d.ts +8 -0
  76. package/dist/commands/guide/index.d.ts.map +1 -0
  77. package/dist/commands/guide/index.js +20 -0
  78. package/dist/commands/guide/index.js.map +1 -0
  79. package/dist/commands/instance/index.d.ts +8 -0
  80. package/dist/commands/instance/index.d.ts.map +1 -0
  81. package/dist/commands/instance/index.js +481 -0
  82. package/dist/commands/instance/index.js.map +1 -0
  83. package/dist/commands/login/index.d.ts +3 -0
  84. package/dist/commands/login/index.d.ts.map +1 -0
  85. package/dist/commands/login/index.js +145 -0
  86. package/dist/commands/login/index.js.map +1 -0
  87. package/dist/commands/logout/index.d.ts +3 -0
  88. package/dist/commands/logout/index.d.ts.map +1 -0
  89. package/dist/commands/logout/index.js +41 -0
  90. package/dist/commands/logout/index.js.map +1 -0
  91. package/dist/commands/profile/import-env.d.ts +18 -0
  92. package/dist/commands/profile/import-env.d.ts.map +1 -0
  93. package/dist/commands/profile/import-env.js +206 -0
  94. package/dist/commands/profile/import-env.js.map +1 -0
  95. package/dist/commands/profile/index.d.ts +3 -0
  96. package/dist/commands/profile/index.d.ts.map +1 -0
  97. package/dist/commands/profile/index.js +124 -0
  98. package/dist/commands/profile/index.js.map +1 -0
  99. package/dist/commands/rest/index.d.ts +3 -0
  100. package/dist/commands/rest/index.d.ts.map +1 -0
  101. package/dist/commands/rest/index.js +102 -0
  102. package/dist/commands/rest/index.js.map +1 -0
  103. package/dist/commands/skill/index.d.ts +11 -0
  104. package/dist/commands/skill/index.d.ts.map +1 -0
  105. package/dist/commands/skill/index.js +228 -0
  106. package/dist/commands/skill/index.js.map +1 -0
  107. package/dist/commands/status/index.d.ts +3 -0
  108. package/dist/commands/status/index.d.ts.map +1 -0
  109. package/dist/commands/status/index.js +59 -0
  110. package/dist/commands/status/index.js.map +1 -0
  111. package/dist/commands/storage/index.d.ts +3 -0
  112. package/dist/commands/storage/index.d.ts.map +1 -0
  113. package/dist/commands/storage/index.js +400 -0
  114. package/dist/commands/storage/index.js.map +1 -0
  115. package/dist/commands/tenant/index.d.ts +19 -0
  116. package/dist/commands/tenant/index.d.ts.map +1 -0
  117. package/dist/commands/tenant/index.js +667 -0
  118. package/dist/commands/tenant/index.js.map +1 -0
  119. package/dist/commands/whoami/index.d.ts +3 -0
  120. package/dist/commands/whoami/index.d.ts.map +1 -0
  121. package/dist/commands/whoami/index.js +101 -0
  122. package/dist/commands/whoami/index.js.map +1 -0
  123. package/dist/credentials/commit.d.ts +38 -0
  124. package/dist/credentials/commit.d.ts.map +1 -0
  125. package/dist/credentials/commit.js +57 -0
  126. package/dist/credentials/commit.js.map +1 -0
  127. package/dist/credentials/credential-store.d.ts +86 -0
  128. package/dist/credentials/credential-store.d.ts.map +1 -0
  129. package/dist/credentials/credential-store.js +282 -0
  130. package/dist/credentials/credential-store.js.map +1 -0
  131. package/dist/credentials/env-file.d.ts +85 -0
  132. package/dist/credentials/env-file.d.ts.map +1 -0
  133. package/dist/credentials/env-file.js +193 -0
  134. package/dist/credentials/env-file.js.map +1 -0
  135. package/dist/credentials/formatter.d.ts +39 -0
  136. package/dist/credentials/formatter.d.ts.map +1 -0
  137. package/dist/credentials/formatter.js +79 -0
  138. package/dist/credentials/formatter.js.map +1 -0
  139. package/dist/credentials/index.d.ts +13 -0
  140. package/dist/credentials/index.d.ts.map +1 -0
  141. package/dist/credentials/index.js +13 -0
  142. package/dist/credentials/index.js.map +1 -0
  143. package/dist/credentials/jwt-introspect.d.ts +39 -0
  144. package/dist/credentials/jwt-introspect.d.ts.map +1 -0
  145. package/dist/credentials/jwt-introspect.js +64 -0
  146. package/dist/credentials/jwt-introspect.js.map +1 -0
  147. package/dist/credentials/masker.d.ts +23 -0
  148. package/dist/credentials/masker.d.ts.map +1 -0
  149. package/dist/credentials/masker.js +40 -0
  150. package/dist/credentials/masker.js.map +1 -0
  151. package/dist/credentials/profile.d.ts +95 -0
  152. package/dist/credentials/profile.d.ts.map +1 -0
  153. package/dist/credentials/profile.js +207 -0
  154. package/dist/credentials/profile.js.map +1 -0
  155. package/dist/credentials/tenant-guard.d.ts +16 -0
  156. package/dist/credentials/tenant-guard.d.ts.map +1 -0
  157. package/dist/credentials/tenant-guard.js +53 -0
  158. package/dist/credentials/tenant-guard.js.map +1 -0
  159. package/dist/credentials/tty-guard.d.ts +29 -0
  160. package/dist/credentials/tty-guard.d.ts.map +1 -0
  161. package/dist/credentials/tty-guard.js +79 -0
  162. package/dist/credentials/tty-guard.js.map +1 -0
  163. package/dist/db/apply-schema.d.ts +144 -0
  164. package/dist/db/apply-schema.d.ts.map +1 -0
  165. package/dist/db/apply-schema.js +359 -0
  166. package/dist/db/apply-schema.js.map +1 -0
  167. package/dist/db/introspect.d.ts +54 -0
  168. package/dist/db/introspect.d.ts.map +1 -0
  169. package/dist/db/introspect.js +140 -0
  170. package/dist/db/introspect.js.map +1 -0
  171. package/dist/db/sql-file.d.ts +104 -0
  172. package/dist/db/sql-file.d.ts.map +1 -0
  173. package/dist/db/sql-file.js +584 -0
  174. package/dist/db/sql-file.js.map +1 -0
  175. package/dist/instance/provision.d.ts +89 -0
  176. package/dist/instance/provision.d.ts.map +1 -0
  177. package/dist/instance/provision.js +139 -0
  178. package/dist/instance/provision.js.map +1 -0
  179. package/dist/instance/zero-store.d.ts +47 -0
  180. package/dist/instance/zero-store.d.ts.map +1 -0
  181. package/dist/instance/zero-store.js +91 -0
  182. package/dist/instance/zero-store.js.map +1 -0
  183. package/dist/instance/zero-whitelist.d.ts +39 -0
  184. package/dist/instance/zero-whitelist.d.ts.map +1 -0
  185. package/dist/instance/zero-whitelist.js +67 -0
  186. package/dist/instance/zero-whitelist.js.map +1 -0
  187. package/dist/main.d.ts +3 -0
  188. package/dist/main.d.ts.map +1 -0
  189. package/dist/main.js +69 -0
  190. package/dist/main.js.map +1 -0
  191. package/dist/skill/agents-md.d.ts +25 -0
  192. package/dist/skill/agents-md.d.ts.map +1 -0
  193. package/dist/skill/agents-md.js +62 -0
  194. package/dist/skill/agents-md.js.map +1 -0
  195. package/dist/skill/assets.d.ts +38 -0
  196. package/dist/skill/assets.d.ts.map +1 -0
  197. package/dist/skill/assets.js +111 -0
  198. package/dist/skill/assets.js.map +1 -0
  199. package/dist/skill/hint.d.ts +39 -0
  200. package/dist/skill/hint.d.ts.map +1 -0
  201. package/dist/skill/hint.js +109 -0
  202. package/dist/skill/hint.js.map +1 -0
  203. package/dist/skill/hosts.d.ts +45 -0
  204. package/dist/skill/hosts.d.ts.map +1 -0
  205. package/dist/skill/hosts.js +96 -0
  206. package/dist/skill/hosts.js.map +1 -0
  207. package/dist/skill/installer.d.ts +100 -0
  208. package/dist/skill/installer.d.ts.map +1 -0
  209. package/dist/skill/installer.js +241 -0
  210. package/dist/skill/installer.js.map +1 -0
  211. package/dist/skill/ownership.d.ts +35 -0
  212. package/dist/skill/ownership.d.ts.map +1 -0
  213. package/dist/skill/ownership.js +52 -0
  214. package/dist/skill/ownership.js.map +1 -0
  215. package/dist/tenant/bundle.d.ts +66 -0
  216. package/dist/tenant/bundle.d.ts.map +1 -0
  217. package/dist/tenant/bundle.js +132 -0
  218. package/dist/tenant/bundle.js.map +1 -0
  219. package/dist/tenant/guide.d.ts +50 -0
  220. package/dist/tenant/guide.d.ts.map +1 -0
  221. package/dist/tenant/guide.js +152 -0
  222. package/dist/tenant/guide.js.map +1 -0
  223. package/dist/tenant/probe.d.ts +65 -0
  224. package/dist/tenant/probe.d.ts.map +1 -0
  225. package/dist/tenant/probe.js +159 -0
  226. package/dist/tenant/probe.js.map +1 -0
  227. package/dist/tenant/verify.d.ts +37 -0
  228. package/dist/tenant/verify.d.ts.map +1 -0
  229. package/dist/tenant/verify.js +132 -0
  230. package/dist/tenant/verify.js.map +1 -0
  231. package/dist/version.d.ts +29 -0
  232. package/dist/version.d.ts.map +1 -0
  233. package/dist/version.js +65 -0
  234. package/dist/version.js.map +1 -0
  235. package/package.json +63 -3
  236. package/skills/pxbaas-app-spec/SKILL.md +165 -0
  237. package/skills/pxbaas-app-spec/references/deploy-options.md +158 -0
  238. package/skills/pxbaas-app-spec/references/guardrails-pitfalls.md +89 -0
  239. package/skills/pxbaas-app-spec/references/runtime-contract.md +151 -0
  240. package/skills/pxbaas-app-spec/references/ssr-session.md +121 -0
  241. package/skills/pxbaas-app-spec/references/templates-examples.md +311 -0
  242. package/skills/pxbaas-cli/SKILL.md +186 -0
  243. package/skills/pxbaas-cli/references/api-reference.md +68 -0
  244. package/skills/pxbaas-cli/references/app-deploy.md +186 -0
  245. package/skills/pxbaas-cli/references/auth-and-credentials.md +116 -0
  246. package/skills/pxbaas-cli/references/data-postgrest.md +101 -0
  247. package/skills/pxbaas-cli/references/db-and-meta.md +102 -0
  248. package/skills/pxbaas-cli/references/edge-functions.md +71 -0
  249. package/skills/pxbaas-cli/references/multi-tenant-apps.md +138 -0
  250. package/skills/pxbaas-cli/references/provision.md +101 -0
  251. package/skills/pxbaas-cli/references/safety-and-two-phase.md +78 -0
  252. package/skills/pxbaas-cli/references/storage.md +61 -0
  253. package/skills/pxbaas-cli/references/tenant-admin.md +122 -0
  254. package/skills/pxbaas-cli/references/troubleshooting.md +76 -0
  255. package/templates/webapp/api/index.ts +55 -0
  256. package/templates/webapp/csr-bff/README.md +81 -0
  257. package/templates/webapp/csr-bff/backend/index.ts +168 -0
  258. package/templates/webapp/csr-bff/db/rls.json +13 -0
  259. package/templates/webapp/csr-bff/db/schema.sql +49 -0
  260. package/templates/webapp/csr-bff/frontend/dist/admin.html +101 -0
  261. package/templates/webapp/csr-bff/frontend/dist/article.html +44 -0
  262. package/templates/webapp/csr-bff/frontend/dist/blog.js +206 -0
  263. package/templates/webapp/csr-bff/frontend/dist/blogger.html +53 -0
  264. package/templates/webapp/csr-bff/frontend/dist/index.html +70 -0
  265. package/templates/webapp/csr-bff/frontend/dist/login.html +56 -0
  266. package/templates/webapp/csr-bff/frontend/dist/profile.html +59 -0
  267. package/templates/webapp/csr-bff/frontend/dist/signup.html +78 -0
  268. package/templates/webapp/csr-bff/frontend/dist/style.css +27 -0
  269. package/templates/webapp/manifest.json +419 -0
  270. package/templates/webapp/mpa/about.html +29 -0
  271. package/templates/webapp/mpa/app.js +42 -0
  272. package/templates/webapp/mpa/index.html +42 -0
  273. package/templates/webapp/mpa/index.ts +60 -0
  274. package/templates/webapp/mpa/style.css +42 -0
  275. package/templates/webapp/react-vite/frontend/index.html +12 -0
  276. package/templates/webapp/react-vite/frontend/package-lock.json +1826 -0
  277. package/templates/webapp/react-vite/frontend/package.json +23 -0
  278. package/templates/webapp/react-vite/frontend/src/App.tsx +34 -0
  279. package/templates/webapp/react-vite/frontend/src/main.tsx +13 -0
  280. package/templates/webapp/react-vite/frontend/src/style.css +46 -0
  281. package/templates/webapp/react-vite/frontend/tsconfig.json +20 -0
  282. package/templates/webapp/react-vite/frontend/vite.config.ts +10 -0
  283. package/templates/webapp/react-vite-hono/backend/index.ts +38 -0
  284. package/templates/webapp/react-vite-hono/frontend/index.html +12 -0
  285. package/templates/webapp/react-vite-hono/frontend/package-lock.json +1826 -0
  286. package/templates/webapp/react-vite-hono/frontend/package.json +23 -0
  287. package/templates/webapp/react-vite-hono/frontend/src/App.tsx +47 -0
  288. package/templates/webapp/react-vite-hono/frontend/src/main.tsx +13 -0
  289. package/templates/webapp/react-vite-hono/frontend/src/style.css +66 -0
  290. package/templates/webapp/react-vite-hono/frontend/tsconfig.json +20 -0
  291. package/templates/webapp/react-vite-hono/frontend/vite.config.ts +10 -0
  292. package/templates/webapp/spa/index.ts +119 -0
  293. package/templates/webapp/ssr-auth/backend/index.ts +133 -0
  294. package/templates/webapp/ssr-auth/frontend/dist/index.html +15 -0
  295. package/templates/webapp/ssr-blog/README.md +111 -0
  296. package/templates/webapp/ssr-blog/backend/index.ts +764 -0
  297. package/templates/webapp/ssr-blog/db/rls.json +13 -0
  298. package/templates/webapp/ssr-blog/db/schema.sql +51 -0
  299. package/templates/webapp/ssr-blog/frontend/dist/index.html +39 -0
  300. package/templates/webapp/ssr-frameworks/README.md +64 -0
  301. package/templates/webapp/ssr-frameworks/backend/index.ts +241 -0
  302. package/templates/webapp/ssr-frameworks/frontend/dist/index.html +31 -0
  303. package/templates/webapp/ssr-hono/backend/index.ts +111 -0
  304. package/templates/webapp/ssr-hono/frontend/dist/index.html +12 -0
  305. package/templates/webapp/ssr-shop/README.md +80 -0
  306. package/templates/webapp/ssr-shop/backend/index.ts +491 -0
  307. package/templates/webapp/ssr-shop/db/rls.json +16 -0
  308. package/templates/webapp/ssr-shop/db/schema.sql +90 -0
  309. package/templates/webapp/ssr-shop/frontend/dist/index.html +12 -0
  310. package/templates/webapp/vanilla-static/frontend/dist/app.js +6 -0
  311. package/templates/webapp/vanilla-static/frontend/dist/index.html +19 -0
  312. package/templates/webapp/vanilla-static/frontend/dist/style.css +43 -0
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Managed AGENTS.md block for agents without a SKILL.md convention.
3
+ *
4
+ * Cloud agents (Devin, Jules, Copilot coding agent) and guideline-only tools
5
+ * (Junie, Comate, CodeArts, Windsurf, Kiro steering) read repository-level
6
+ * AGENTS.md. `pxbaas skill install --scope project --agents-md` writes a small
7
+ * marker-delimited block pointing at the exported skill directories and
8
+ * `pxbaas guide`. Everything outside the markers is never touched, and the
9
+ * block is idempotently replaced on re-install.
10
+ */
11
+ import { readFile, writeFile, rm } from 'node:fs/promises';
12
+ import { existsSync } from 'node:fs';
13
+ import { join } from 'node:path';
14
+ export const AGENTS_MD_FILE = 'AGENTS.md';
15
+ export const BEGIN_MARKER = '<!-- BEGIN pxbaas-skills (managed by pxbaas skill install; do not edit) -->';
16
+ export const END_MARKER = '<!-- END pxbaas-skills -->';
17
+ function escapeRe(s) {
18
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
19
+ }
20
+ function blockRegex() {
21
+ return new RegExp(`\\n*${escapeRe(BEGIN_MARKER)}[\\s\\S]*?${escapeRe(END_MARKER)}\\n*`);
22
+ }
23
+ export function renderBlock(lines) {
24
+ return [BEGIN_MARKER, ...lines, END_MARKER].join('\n');
25
+ }
26
+ export async function upsertAgentsMdBlock(projectRoot, lines) {
27
+ const path = join(projectRoot, AGENTS_MD_FILE);
28
+ const block = renderBlock(lines);
29
+ if (!existsSync(path)) {
30
+ await writeFile(path, `${block}\n`, 'utf8');
31
+ return { path, created: true };
32
+ }
33
+ const content = await readFile(path, 'utf8');
34
+ const updated = blockRegex().test(content)
35
+ ? content.replace(blockRegex(), `${block}\n`)
36
+ : `${content.replace(/\s*$/, '')}\n\n${block}\n`;
37
+ await writeFile(path, updated, 'utf8');
38
+ return { path, created: false };
39
+ }
40
+ export async function removeAgentsMdBlock(projectRoot) {
41
+ const path = join(projectRoot, AGENTS_MD_FILE);
42
+ if (!existsSync(path))
43
+ return { path, removed: false, deletedFile: false };
44
+ const content = await readFile(path, 'utf8');
45
+ if (!blockRegex().test(content))
46
+ return { path, removed: false, deletedFile: false };
47
+ const stripped = content.replace(blockRegex(), '');
48
+ if (stripped.trim() === '') {
49
+ await rm(path);
50
+ return { path, removed: true, deletedFile: true };
51
+ }
52
+ await writeFile(path, stripped, 'utf8');
53
+ return { path, removed: true, deletedFile: false };
54
+ }
55
+ export async function agentsMdBlockPresent(projectRoot) {
56
+ const path = join(projectRoot, AGENTS_MD_FILE);
57
+ if (!existsSync(path))
58
+ return false;
59
+ const content = await readFile(path, 'utf8');
60
+ return blockRegex().test(content);
61
+ }
62
+ //# sourceMappingURL=agents-md.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../../src/skill/agents-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAC1C,MAAM,CAAC,MAAM,YAAY,GACvB,6EAA6E,CAAC;AAChF,MAAM,CAAC,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAEvD,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,CAAC,CAAC,OAAO,CAAC,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bundled Agent Skills at runtime.
3
+ *
4
+ * Distribution route A (ctxdb0-style): skills ship as package files under
5
+ * `apps/baas/skills/<skill>/` and `package.json#files` includes `skills`.
6
+ * We resolve the package root by walking up from this module until we find a
7
+ * `skills/` directory containing at least one `<skill>/SKILL.md`. This works for
8
+ * the compiled layout (`dist/skill/assets.js`) and for direct source execution.
9
+ *
10
+ * There can be MULTIPLE bundled skills (e.g. `pxbaas-cli`, `pxbaas-app-spec`);
11
+ * `pxbaas skill install` installs all of them by default.
12
+ *
13
+ * NOTE: the standalone single-file binary (`bun build --compile`) does not carry
14
+ * these files on disk; resolution then fails and callers surface a clear
15
+ * "requires the npm/source install" error.
16
+ */
17
+ /** Thrown when the bundled skills cannot be located (e.g. single-binary mode). */
18
+ export declare class SkillAssetsNotFoundError extends Error {
19
+ constructor(message: string);
20
+ }
21
+ /** Walk up from the current module to find the app package root (holds `skills/`). */
22
+ export declare function resolvePackageRoot(startDir?: string): string | null;
23
+ /** Absolute path to the bundled `skills/` directory. */
24
+ export declare function resolveSkillsRoot(startDir?: string): string;
25
+ /** Names of all bundled skills under a given `skills/` root (subdirs with a SKILL.md). */
26
+ export declare function listBundledSkillsIn(skillsRoot: string): Promise<string[]>;
27
+ /** Names of all bundled skills (subdirs of the resolved `skills/` that contain a SKILL.md). */
28
+ export declare function listBundledSkills(startDir?: string): Promise<string[]>;
29
+ /** Absolute path to one bundled skill directory. */
30
+ export declare function resolveSkillAssetDir(skillName: string, startDir?: string): string;
31
+ /** Read the CLI version from the resolved package.json (best-effort). */
32
+ export declare function readCliVersion(startDir?: string): Promise<string>;
33
+ /**
34
+ * Recursively list a skill's files as POSIX-style relative paths (e.g. `SKILL.md`,
35
+ * `references/db-and-meta.md`). Skips hidden files/dirs and `node_modules`.
36
+ */
37
+ export declare function listSkillFiles(assetDir: string): Promise<string[]>;
38
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/skill/assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,kFAAkF;AAClF,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAUD,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,QAAQ,GAAE,MAAoB,GAAG,MAAM,GAAG,IAAI,CAShF;AAED,wDAAwD;AACxD,wBAAgB,iBAAiB,CAAC,QAAQ,GAAE,MAAoB,GAAG,MAAM,CAQxE;AAED,0FAA0F;AAC1F,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQ/E;AAED,+FAA+F;AAC/F,wBAAsB,iBAAiB,CAAC,QAAQ,GAAE,MAAoB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEzF;AAED,oDAAoD;AACpD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAoB,GAAG,MAAM,CAE9F;AAED,yEAAyE;AACzE,wBAAsB,cAAc,CAAC,QAAQ,GAAE,MAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CASpF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBxE"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Locate the bundled Agent Skills at runtime.
3
+ *
4
+ * Distribution route A (ctxdb0-style): skills ship as package files under
5
+ * `apps/baas/skills/<skill>/` and `package.json#files` includes `skills`.
6
+ * We resolve the package root by walking up from this module until we find a
7
+ * `skills/` directory containing at least one `<skill>/SKILL.md`. This works for
8
+ * the compiled layout (`dist/skill/assets.js`) and for direct source execution.
9
+ *
10
+ * There can be MULTIPLE bundled skills (e.g. `pxbaas-cli`, `pxbaas-app-spec`);
11
+ * `pxbaas skill install` installs all of them by default.
12
+ *
13
+ * NOTE: the standalone single-file binary (`bun build --compile`) does not carry
14
+ * these files on disk; resolution then fails and callers surface a clear
15
+ * "requires the npm/source install" error.
16
+ */
17
+ import { existsSync } from 'node:fs';
18
+ import { readFile, readdir } from 'node:fs/promises';
19
+ import { dirname, join, relative, sep } from 'node:path';
20
+ import { fileURLToPath } from 'node:url';
21
+ /** Thrown when the bundled skills cannot be located (e.g. single-binary mode). */
22
+ export class SkillAssetsNotFoundError extends Error {
23
+ constructor(message) {
24
+ super(message);
25
+ this.name = 'SkillAssetsNotFoundError';
26
+ }
27
+ }
28
+ function moduleDir() {
29
+ return dirname(fileURLToPath(import.meta.url));
30
+ }
31
+ function isSkillsRoot(dir) {
32
+ return existsSync(join(dir, 'skills')) && existsSync(join(dir, 'package.json'));
33
+ }
34
+ /** Walk up from the current module to find the app package root (holds `skills/`). */
35
+ export function resolvePackageRoot(startDir = moduleDir()) {
36
+ let dir = startDir;
37
+ for (let i = 0; i < 8; i++) {
38
+ if (isSkillsRoot(dir))
39
+ return dir;
40
+ const parent = dirname(dir);
41
+ if (parent === dir)
42
+ break;
43
+ dir = parent;
44
+ }
45
+ return null;
46
+ }
47
+ /** Absolute path to the bundled `skills/` directory. */
48
+ export function resolveSkillsRoot(startDir = moduleDir()) {
49
+ const root = resolvePackageRoot(startDir);
50
+ if (!root) {
51
+ throw new SkillAssetsNotFoundError('Bundled skills not found. `pxbaas skill install` requires the npm or source install (the standalone single-file binary does not bundle skill assets).');
52
+ }
53
+ return join(root, 'skills');
54
+ }
55
+ /** Names of all bundled skills under a given `skills/` root (subdirs with a SKILL.md). */
56
+ export async function listBundledSkillsIn(skillsRoot) {
57
+ const entries = await readdir(skillsRoot, { withFileTypes: true });
58
+ const names = [];
59
+ for (const e of entries) {
60
+ if (!e.isDirectory() || e.name.startsWith('.'))
61
+ continue;
62
+ if (existsSync(join(skillsRoot, e.name, 'SKILL.md')))
63
+ names.push(e.name);
64
+ }
65
+ return names.sort();
66
+ }
67
+ /** Names of all bundled skills (subdirs of the resolved `skills/` that contain a SKILL.md). */
68
+ export async function listBundledSkills(startDir = moduleDir()) {
69
+ return listBundledSkillsIn(resolveSkillsRoot(startDir));
70
+ }
71
+ /** Absolute path to one bundled skill directory. */
72
+ export function resolveSkillAssetDir(skillName, startDir = moduleDir()) {
73
+ return join(resolveSkillsRoot(startDir), skillName);
74
+ }
75
+ /** Read the CLI version from the resolved package.json (best-effort). */
76
+ export async function readCliVersion(startDir = moduleDir()) {
77
+ const root = resolvePackageRoot(startDir);
78
+ if (!root)
79
+ return 'unknown';
80
+ try {
81
+ const pkg = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
82
+ return pkg.version ?? 'unknown';
83
+ }
84
+ catch {
85
+ return 'unknown';
86
+ }
87
+ }
88
+ /**
89
+ * Recursively list a skill's files as POSIX-style relative paths (e.g. `SKILL.md`,
90
+ * `references/db-and-meta.md`). Skips hidden files/dirs and `node_modules`.
91
+ */
92
+ export async function listSkillFiles(assetDir) {
93
+ const out = [];
94
+ async function walk(dir) {
95
+ const entries = await readdir(dir, { withFileTypes: true });
96
+ for (const entry of entries) {
97
+ if (entry.name.startsWith('.') || entry.name === 'node_modules')
98
+ continue;
99
+ const full = join(dir, entry.name);
100
+ if (entry.isDirectory()) {
101
+ await walk(full);
102
+ }
103
+ else if (entry.isFile()) {
104
+ out.push(relative(assetDir, full).split(sep).join('/'));
105
+ }
106
+ }
107
+ }
108
+ await walk(assetDir);
109
+ return out.sort();
110
+ }
111
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/skill/assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,a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C,OAAO,IAAI,SAAS,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,KAAK,UAAU,IAAI,CAAC,GAAW;QAC7B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;gBAAE,SAAS;YAC1E,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC1B,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * First-run skill hint (option A).
3
+ *
4
+ * Nudges the user once — on any `pxbaas` command — that a bundled Agent Skill can
5
+ * be installed into a detected Agent host, so they discover `pxbaas skill install`
6
+ * without us silently writing into their agent config on npm install.
7
+ *
8
+ * Deliberately non-intrusive:
9
+ * - prints to **stderr** (never pollutes `--json` stdout that agents parse)
10
+ * - skipped when `--json`, when running any `skill` subcommand, when no host is
11
+ * detected, when the skill is already installed in a detected host, when the
12
+ * hint was shown before (state under ~/.baas), or when BAAS_NO_SKILL_HINT is set
13
+ * - never throws: a hint failure must not break the actual command
14
+ */
15
+ export interface SkillHintOptions {
16
+ /** Global --json flag; when true the hint is suppressed. */
17
+ json?: boolean;
18
+ /** $HOME override (defaults to os.homedir()). Injectable for tests. */
19
+ homeDir?: string;
20
+ /** Invoked command path, e.g. "db query" or "skill install". */
21
+ commandPath?: string;
22
+ /** Environment override (defaults to process.env). Injectable for tests. */
23
+ env?: NodeJS.ProcessEnv;
24
+ /** stderr writer override. Injectable for tests. */
25
+ stderr?: (line: string) => void;
26
+ }
27
+ /**
28
+ * Print the one-time skill hint when appropriate. Safe to call before any
29
+ * command action; resolves without side effects when suppressed.
30
+ */
31
+ export declare function maybePrintSkillHint(options?: SkillHintOptions): Promise<void>;
32
+ /**
33
+ * First-run hint shown when NO profile is configured yet: point the user to
34
+ * `pxbaas provision` (free 15-day Zero instance) or `pxbaas login` (own instance).
35
+ * Non-intrusive: stderr, once, skipped under --json / on onboarding commands /
36
+ * when a profile already exists / when BAAS_NO_PROVISION_HINT is set.
37
+ */
38
+ export declare function maybePrintProvisionHint(options?: SkillHintOptions): Promise<void>;
39
+ //# sourceMappingURL=hint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../src/skill/hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAQD;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCvF;AAKD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC3F"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * First-run skill hint (option A).
3
+ *
4
+ * Nudges the user once — on any `pxbaas` command — that a bundled Agent Skill can
5
+ * be installed into a detected Agent host, so they discover `pxbaas skill install`
6
+ * without us silently writing into their agent config on npm install.
7
+ *
8
+ * Deliberately non-intrusive:
9
+ * - prints to **stderr** (never pollutes `--json` stdout that agents parse)
10
+ * - skipped when `--json`, when running any `skill` subcommand, when no host is
11
+ * detected, when the skill is already installed in a detected host, when the
12
+ * hint was shown before (state under ~/.baas), or when BAAS_NO_SKILL_HINT is set
13
+ * - never throws: a hint failure must not break the actual command
14
+ */
15
+ import { existsSync } from 'node:fs';
16
+ import { mkdir, writeFile } from 'node:fs/promises';
17
+ import { homedir } from 'node:os';
18
+ import { dirname, join } from 'node:path';
19
+ import { detectInstalledHosts, hostSkillDir } from './hosts.js';
20
+ import { classifyTarget } from './ownership.js';
21
+ import { ProfileManager } from '../credentials/profile.js';
22
+ const STATE_RELPATH = join('.baas', 'skill-hint.json');
23
+ function truthy(value) {
24
+ return ['1', 'true', 'yes', 'on'].includes((value ?? '').toLowerCase());
25
+ }
26
+ /**
27
+ * Print the one-time skill hint when appropriate. Safe to call before any
28
+ * command action; resolves without side effects when suppressed.
29
+ */
30
+ export async function maybePrintSkillHint(options = {}) {
31
+ const env = options.env ?? process.env;
32
+ const home = options.homeDir ?? homedir();
33
+ const write = options.stderr ?? ((line) => process.stderr.write(line + '\n'));
34
+ // Suppress in machine-readable mode and when explicitly disabled.
35
+ if (options.json)
36
+ return;
37
+ if (truthy(env.BAAS_NO_SKILL_HINT))
38
+ return;
39
+ // Do not hint while the user is already running `pxbaas skill ...`.
40
+ const root = (options.commandPath ?? '').trim().split(/\s+/)[0];
41
+ if (root === 'skill')
42
+ return;
43
+ // Only relevant when at least one supported Agent host directory exists.
44
+ const hosts = detectInstalledHosts(home);
45
+ if (hosts.length === 0)
46
+ return;
47
+ // Stay quiet if the skill is already installed in any detected host.
48
+ for (const host of hosts) {
49
+ if ((await classifyTarget(hostSkillDir(host, home))) === 'owned')
50
+ return;
51
+ }
52
+ // First-run only: skip if we already showed the hint.
53
+ const stateFile = join(home, STATE_RELPATH);
54
+ if (existsSync(stateFile))
55
+ return;
56
+ write(`Tip: enable the baas AI-agent skill for detected host(s): ${hosts.join(', ')}.`);
57
+ write(` Run: pxbaas skill install --host ${hosts[0]} (or --all). Set BAAS_NO_SKILL_HINT=1 to silence.`);
58
+ // Record that we showed it (best-effort; never fail the command).
59
+ try {
60
+ await mkdir(dirname(stateFile), { mode: 0o700, recursive: true });
61
+ await writeFile(stateFile, JSON.stringify({ shown: true, at: new Date().toISOString(), hosts }, null, 2) + '\n', { mode: 0o600 });
62
+ }
63
+ catch {
64
+ // ignore — the hint is cosmetic
65
+ }
66
+ }
67
+ const PROVISION_STATE_RELPATH = join('.baas', 'provision-hint.json');
68
+ const PROVISION_SKIP_ROOTS = new Set(['provision', 'instance', 'login', 'logout', 'profile']);
69
+ /**
70
+ * First-run hint shown when NO profile is configured yet: point the user to
71
+ * `pxbaas provision` (free 15-day Zero instance) or `pxbaas login` (own instance).
72
+ * Non-intrusive: stderr, once, skipped under --json / on onboarding commands /
73
+ * when a profile already exists / when BAAS_NO_PROVISION_HINT is set.
74
+ */
75
+ export async function maybePrintProvisionHint(options = {}) {
76
+ const env = options.env ?? process.env;
77
+ const home = options.homeDir ?? homedir();
78
+ const write = options.stderr ?? ((line) => process.stderr.write(line + '\n'));
79
+ if (options.json)
80
+ return;
81
+ if (truthy(env.BAAS_NO_PROVISION_HINT) || truthy(env.BAAS_NO_SKILL_HINT))
82
+ return;
83
+ const root = (options.commandPath ?? '').trim().split(/\s+/)[0];
84
+ if (PROVISION_SKIP_ROOTS.has(root))
85
+ return;
86
+ // Skip when a profile is already configured.
87
+ try {
88
+ const current = await new ProfileManager(join(home, '.baas')).getCurrentProfile();
89
+ if (current)
90
+ return;
91
+ }
92
+ catch {
93
+ return; // profile lookup failed — stay quiet
94
+ }
95
+ const stateFile = join(home, PROVISION_STATE_RELPATH);
96
+ if (existsSync(stateFile))
97
+ return;
98
+ write('Tip: no BaaS instance configured yet.');
99
+ write(' Run: pxbaas provision (claim a free 15-day PolarDB-X Zero instance)');
100
+ write(' or: pxbaas login (use your own instance). Set BAAS_NO_PROVISION_HINT=1 to silence.');
101
+ try {
102
+ await mkdir(dirname(stateFile), { mode: 0o700, recursive: true });
103
+ await writeFile(stateFile, JSON.stringify({ shown: true, at: new Date().toISOString() }, null, 2) + '\n', { mode: 0o600 });
104
+ }
105
+ catch {
106
+ // ignore — the hint is cosmetic
107
+ }
108
+ }
109
+ //# sourceMappingURL=hint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hint.js","sourceRoot":"","sources":["../../src/skill/hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAe3D,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAEvD,SAA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AAC;IAAC,MAAM,CAAC;QACP,gCAAgC;IAClC,CAAC;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Skill host mapping & detection.
3
+ *
4
+ * Mirrors the ctxdb0 `#skillTarget` convention: each supported Agent host keeps
5
+ * its skills under `~/.<host>/skills/<skill>/`. User-level hosts are verified
6
+ * against vendor docs; unverified locations are NOT hardcoded here.
7
+ *
8
+ * Two install scopes exist:
9
+ * - `user` (default): the per-host directory under $HOME.
10
+ * - `project`: the repository-level convention (e.g. `.agents/skills`), so the
11
+ * skills travel with the code and cloud agents cloning the repo pick them up.
12
+ *
13
+ * The vendor-neutral key `agents` maps to `~/.agents/skills` / `.agents/skills`,
14
+ * which Codex scans and Copilot reads. It is intentionally excluded from `--all`
15
+ * (install it explicitly) to avoid duplicate copies next to per-host installs.
16
+ */
17
+ export type HostName = 'qoder' | 'claude' | 'cursor' | 'qwen' | 'hermes' | 'codex' | 'gemini' | 'copilot' | 'qwenworkcn' | 'agents';
18
+ /** Hosts supported by `pxbaas skill install --scope user`. */
19
+ export declare const SUPPORTED_HOSTS: HostName[];
20
+ /** Neutral locations: never installed by `--all`, only by explicit `--host`. */
21
+ export declare const ALL_EXCLUDED_HOSTS: HostName[];
22
+ /**
23
+ * Host keys accepted for `--scope project`. Some (trae/codebuddy/cline) publish
24
+ * only a repository-level convention, so they are project-scope only.
25
+ * Every path below is taken from vendor documentation; do not add guesses.
26
+ */
27
+ export type ProjectHost = 'claude' | 'qwen' | 'codex' | 'agents' | 'gemini' | 'copilot' | 'trae' | 'codebuddy' | 'cline';
28
+ export declare const PROJECT_HOSTS: ProjectHost[];
29
+ /** Repository-relative skills directory per project-scope host. */
30
+ export declare const PROJECT_SKILL_DIR: Record<ProjectHost, string>;
31
+ export declare function isHostName(value: string): value is HostName;
32
+ export declare function isProjectHost(value: string): value is ProjectHost;
33
+ /** `~/.<host>/skills` root for a user-scope host. */
34
+ export declare function hostSkillsRoot(host: HostName, homeDir: string): string;
35
+ /** Full target directory for a skill under a user-scope host. */
36
+ export declare function hostSkillDir(host: HostName, homeDir: string, skillName?: string): string;
37
+ /** Repository-level skills root for a project-scope host. */
38
+ export declare function projectSkillsRoot(host: ProjectHost, projectRoot: string): string;
39
+ /**
40
+ * Detect which supported hosts already have a `~/.<host>` directory, i.e. hosts
41
+ * the user plausibly uses. Used for auto-selection and `--all` (which further
42
+ * excludes ALL_EXCLUDED_HOSTS at the caller).
43
+ */
44
+ export declare function detectInstalledHosts(homeDir: string): HostName[];
45
+ //# sourceMappingURL=hosts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosts.d.ts","sourceRoot":"","sources":["../../src/skill/hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,QAAQ,CAAC;AAEb,8DAA8D;AAC9D,eAAO,MAAM,eAAe,EAAE,QAAQ,EAWrC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,EAAe,CAAC;AAgBzD;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,WAAW,GACX,OAAO,CAAC;AAEZ,eAAO,MAAM,aAAa,EAAE,WAAW,EAUtC,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAUzD,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAE3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW,CAEjE;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,SAAe,GAAG,MAAM,CAE9F;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,EAAE,CAEhE"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Skill host mapping & detection.
3
+ *
4
+ * Mirrors the ctxdb0 `#skillTarget` convention: each supported Agent host keeps
5
+ * its skills under `~/.<host>/skills/<skill>/`. User-level hosts are verified
6
+ * against vendor docs; unverified locations are NOT hardcoded here.
7
+ *
8
+ * Two install scopes exist:
9
+ * - `user` (default): the per-host directory under $HOME.
10
+ * - `project`: the repository-level convention (e.g. `.agents/skills`), so the
11
+ * skills travel with the code and cloud agents cloning the repo pick them up.
12
+ *
13
+ * The vendor-neutral key `agents` maps to `~/.agents/skills` / `.agents/skills`,
14
+ * which Codex scans and Copilot reads. It is intentionally excluded from `--all`
15
+ * (install it explicitly) to avoid duplicate copies next to per-host installs.
16
+ */
17
+ import { existsSync } from 'node:fs';
18
+ import { join } from 'node:path';
19
+ /** Hosts supported by `pxbaas skill install --scope user`. */
20
+ export const SUPPORTED_HOSTS = [
21
+ 'qoder',
22
+ 'claude',
23
+ 'cursor',
24
+ 'qwen',
25
+ 'hermes',
26
+ 'codex',
27
+ 'gemini',
28
+ 'copilot',
29
+ 'qwenworkcn',
30
+ 'agents',
31
+ ];
32
+ /** Neutral locations: never installed by `--all`, only by explicit `--host`. */
33
+ export const ALL_EXCLUDED_HOSTS = ['agents'];
34
+ /** Host name -> the dot-directory under $HOME that hosts its config/skills. */
35
+ const HOST_DIR = {
36
+ qoder: '.qoder',
37
+ claude: '.claude',
38
+ cursor: '.cursor',
39
+ qwen: '.qwen',
40
+ hermes: '.hermes',
41
+ codex: '.codex',
42
+ gemini: '.gemini',
43
+ copilot: '.copilot',
44
+ qwenworkcn: '.qwenworkcn',
45
+ agents: '.agents',
46
+ };
47
+ export const PROJECT_HOSTS = [
48
+ 'claude',
49
+ 'qwen',
50
+ 'codex',
51
+ 'agents',
52
+ 'gemini',
53
+ 'copilot',
54
+ 'trae',
55
+ 'codebuddy',
56
+ 'cline',
57
+ ];
58
+ /** Repository-relative skills directory per project-scope host. */
59
+ export const PROJECT_SKILL_DIR = {
60
+ claude: '.claude/skills',
61
+ qwen: '.qwen/skills',
62
+ codex: '.agents/skills',
63
+ agents: '.agents/skills',
64
+ gemini: '.gemini/skills',
65
+ copilot: '.github/skills',
66
+ trae: '.trae/skills',
67
+ codebuddy: '.codebuddy/skills',
68
+ cline: '.cline/skills',
69
+ };
70
+ export function isHostName(value) {
71
+ return SUPPORTED_HOSTS.includes(value);
72
+ }
73
+ export function isProjectHost(value) {
74
+ return PROJECT_HOSTS.includes(value);
75
+ }
76
+ /** `~/.<host>/skills` root for a user-scope host. */
77
+ export function hostSkillsRoot(host, homeDir) {
78
+ return join(homeDir, HOST_DIR[host], 'skills');
79
+ }
80
+ /** Full target directory for a skill under a user-scope host. */
81
+ export function hostSkillDir(host, homeDir, skillName = 'pxbaas-cli') {
82
+ return join(hostSkillsRoot(host, homeDir), skillName);
83
+ }
84
+ /** Repository-level skills root for a project-scope host. */
85
+ export function projectSkillsRoot(host, projectRoot) {
86
+ return join(projectRoot, PROJECT_SKILL_DIR[host]);
87
+ }
88
+ /**
89
+ * Detect which supported hosts already have a `~/.<host>` directory, i.e. hosts
90
+ * the user plausibly uses. Used for auto-selection and `--all` (which further
91
+ * excludes ALL_EXCLUDED_HOSTS at the caller).
92
+ */
93
+ export function detectInstalledHosts(homeDir) {
94
+ return SUPPORTED_HOSTS.filter((host) => existsSync(join(homeDir, HOST_DIR[host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,EAAE,eAAe;CACvB,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAQ,eAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAQ,aAA0B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,cAAc,CAAC,IAAc,EAAE,OAAe;IAC5D,OAAO,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,YAAY,CAAC,IAAc,EAAE,OAAe,EAAE,SAAS,GAAG,YAAY;IACpF,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;AACxD,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,iBAAiB,CAAC,IAAiB,EAAE,WAAmB;IACtE,OAAO,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * SkillManager — install/list/remove ALL bundled Agent Skills (e.g. `pxbaas-cli`,
3
+ * `pxbaas-app-spec`) into supported Agent hosts.
4
+ *
5
+ * Purely local and offline: never touches credentials, profiles, or the network,
6
+ * so agents can run it without `pxbaas login`. `homeDir` and `skillsRoot` are
7
+ * injectable for testing.
8
+ *
9
+ * Layout: each host has a skills root (`~/.<host>/skills`); every bundled skill is
10
+ * installed into `<skillsRoot>/<skillName>/` with its own fail-closed owner marker.
11
+ */
12
+ export type InstallScope = 'user' | 'project';
13
+ export type InstallStatus = 'installed' | 'updated' | 'skipped-foreign' | 'dry-run' | 'error';
14
+ export type RemoveStatus = 'removed' | 'not-installed' | 'skipped-foreign' | 'dry-run' | 'error';
15
+ export type ListStatus = 'installed' | 'not-installed' | 'foreign';
16
+ export interface SkillResult {
17
+ host: string;
18
+ skill: string;
19
+ targetDir: string;
20
+ status: InstallStatus | RemoveStatus | ListStatus;
21
+ scope?: InstallScope;
22
+ filesWritten?: string[];
23
+ skillVersion?: string;
24
+ installedAt?: string;
25
+ reason?: string;
26
+ }
27
+ export interface SkillManagerOptions {
28
+ /** Base home directory (defaults to os.homedir()). Injectable for tests. */
29
+ homeDir?: string;
30
+ /** Directory containing all bundled skills (defaults to resolveSkillsRoot()). */
31
+ skillsRoot?: string;
32
+ /** CLI version stamped into markers (defaults to readCliVersion()). */
33
+ cliVersion?: string;
34
+ /** Repository root for `--scope project` targets (defaults to process.cwd()). */
35
+ projectRoot?: string;
36
+ }
37
+ export interface InstallOptions {
38
+ dryRun?: boolean;
39
+ force?: boolean;
40
+ /** Restrict to specific skill names (default: all bundled skills). */
41
+ skills?: string[];
42
+ }
43
+ export interface RemoveOptions {
44
+ dryRun?: boolean;
45
+ confirm?: boolean;
46
+ skills?: string[];
47
+ }
48
+ /** A resolved install/remove target: a host label plus its skills root directory. */
49
+ export interface ResolvedTarget {
50
+ host: string;
51
+ destRoot: string;
52
+ scope: InstallScope;
53
+ }
54
+ export declare class SkillManager {
55
+ private readonly homeDir;
56
+ private readonly skillsRoot;
57
+ private readonly cliVersion;
58
+ private readonly projectRoot;
59
+ private skillsCache;
60
+ constructor(options?: SkillManagerOptions);
61
+ /** Async factory that resolves the CLI version from package.json. */
62
+ static create(options?: SkillManagerOptions): Promise<SkillManager>;
63
+ /** Bundled skill names (memoized). */
64
+ bundledSkills(): Promise<string[]>;
65
+ private selectedSkills;
66
+ /**
67
+ * Resolve which host skills-roots to act on.
68
+ * - `--dir` wins (single custom skills-root, host label "custom")
69
+ * - `--scope project` requires `--host` (a ProjectHost) or `--dir`; `--all` is
70
+ * user-scope only because writing every vendor repo directory is spammy
71
+ * - `--all` (user scope) → every detected host except ALL_EXCLUDED_HOSTS
72
+ * - `--host <h>` → that host
73
+ * - none → auto-detect: exactly one detected host is used; 0 or >1 is an error
74
+ */
75
+ resolveTargets(opts: {
76
+ host?: string;
77
+ all?: boolean;
78
+ dir?: string;
79
+ scope?: InstallScope;
80
+ }): ResolvedTarget[];
81
+ /** Install all (or selected) bundled skills into each target's skills root. */
82
+ install(targets: ResolvedTarget[], options?: InstallOptions): Promise<SkillResult[]>;
83
+ private installOne;
84
+ /** Report install state of every bundled skill across all detected hosts. */
85
+ list(options?: {
86
+ skills?: string[];
87
+ }): Promise<SkillResult[]>;
88
+ /** Report install state of bundled skills in repository-level directories. */
89
+ listProject(options?: {
90
+ skills?: string[];
91
+ }): Promise<SkillResult[]>;
92
+ private listOne;
93
+ /**
94
+ * Remove bundled skills from each target. Only removes directories owned by
95
+ * pxbaas-cli. Two-phase: without `confirm` (or with `dryRun`) it only previews.
96
+ */
97
+ remove(targets: ResolvedTarget[], options?: RemoveOptions): Promise<SkillResult[]>;
98
+ private removeOne;
99
+ }
100
+ //# sourceMappingURL=installer.d.ts.map