@ysk-kit/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/LICENSE +21 -0
  2. package/dist/add-capability.d.ts +4 -0
  3. package/dist/add-capability.d.ts.map +1 -0
  4. package/dist/add-capability.js +104 -0
  5. package/dist/add-capability.js.map +1 -0
  6. package/dist/add-module.d.ts +5 -0
  7. package/dist/add-module.d.ts.map +1 -0
  8. package/dist/add-module.js +210 -0
  9. package/dist/add-module.js.map +1 -0
  10. package/dist/agent-stubs.d.ts +3 -0
  11. package/dist/agent-stubs.d.ts.map +1 -0
  12. package/dist/agent-stubs.js +25 -0
  13. package/dist/agent-stubs.js.map +1 -0
  14. package/dist/apply-capability.d.ts +3 -0
  15. package/dist/apply-capability.d.ts.map +1 -0
  16. package/dist/apply-capability.js +189 -0
  17. package/dist/apply-capability.js.map +1 -0
  18. package/dist/capability-catalog.d.ts +25 -0
  19. package/dist/capability-catalog.d.ts.map +1 -0
  20. package/dist/capability-catalog.js +123 -0
  21. package/dist/capability-catalog.js.map +1 -0
  22. package/dist/capability-patches.d.ts +40 -0
  23. package/dist/capability-patches.d.ts.map +1 -0
  24. package/dist/capability-patches.js +616 -0
  25. package/dist/capability-patches.js.map +1 -0
  26. package/dist/check-agent.d.ts +9 -0
  27. package/dist/check-agent.d.ts.map +1 -0
  28. package/dist/check-agent.js +85 -0
  29. package/dist/check-agent.js.map +1 -0
  30. package/dist/generate-openapi.d.ts +2 -0
  31. package/dist/generate-openapi.d.ts.map +1 -0
  32. package/dist/generate-openapi.js +52 -0
  33. package/dist/generate-openapi.js.map +1 -0
  34. package/dist/help.d.ts +2 -0
  35. package/dist/help.d.ts.map +1 -0
  36. package/dist/help.js +54 -0
  37. package/dist/help.js.map +1 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +59 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/merge-prisma.d.ts +15 -0
  43. package/dist/merge-prisma.d.ts.map +1 -0
  44. package/dist/merge-prisma.js +90 -0
  45. package/dist/merge-prisma.js.map +1 -0
  46. package/dist/patch-text.d.ts +17 -0
  47. package/dist/patch-text.d.ts.map +1 -0
  48. package/dist/patch-text.js +72 -0
  49. package/dist/patch-text.js.map +1 -0
  50. package/dist/upgrade.d.ts +16 -0
  51. package/dist/upgrade.d.ts.map +1 -0
  52. package/dist/upgrade.js +110 -0
  53. package/dist/upgrade.js.map +1 -0
  54. package/package.json +41 -0
  55. package/templates/agent/skills/add-capability/SKILL.md +8 -0
  56. package/templates/agent/skills/add-module/SKILL.md +8 -0
  57. package/templates/agent/skills/envelope-api/SKILL.md +8 -0
  58. package/templates/agent/skills/fix-layers/SKILL.md +8 -0
  59. package/templates/agent/skills/new-product/SKILL.md +8 -0
  60. package/templates/agent/skills/verify-change/SKILL.md +8 -0
  61. package/templates/agent/ysk-kit.mdc +6 -0
  62. package/templates/capabilities/billing/apps/api/src/modules/billing/application/billing-service.ts +140 -0
  63. package/templates/capabilities/billing/apps/api/src/modules/billing/domain/billing-port.ts +23 -0
  64. package/templates/capabilities/billing/apps/api/src/modules/billing/domain/subscription-repository.ts +22 -0
  65. package/templates/capabilities/billing/apps/api/src/modules/billing/infra/billing-router.ts +85 -0
  66. package/templates/capabilities/billing/apps/api/src/modules/billing/infra/billing.app.test.ts +273 -0
  67. package/templates/capabilities/billing/apps/api/src/modules/billing/infra/log-billing.ts +31 -0
  68. package/templates/capabilities/billing/apps/api/src/modules/billing/infra/memory-subscription-repository.ts +27 -0
  69. package/templates/capabilities/billing/apps/api/src/modules/billing/infra/prisma-subscription-repository.ts +52 -0
  70. package/templates/capabilities/billing/apps/api/src/modules/billing/infra/stripe-billing.test.ts +127 -0
  71. package/templates/capabilities/billing/apps/api/src/modules/billing/infra/stripe-billing.ts +160 -0
  72. package/templates/capabilities/billing/apps/web/src/features/orgs/billing-page.tsx +183 -0
  73. package/templates/capabilities/billing/packages/contracts/src/api/billing.ts +85 -0
  74. package/templates/capabilities/billing/packages/contracts/src/dto/billing.ts +59 -0
  75. package/templates/capabilities/billing/packages/sdk/src/resources/billing.ts +38 -0
  76. package/templates/capabilities/billing/packages/web-sdk/src/billing-hooks.ts +56 -0
  77. package/templates/capabilities/llm/apps/api/src/modules/llm/application/llm-service.ts +48 -0
  78. package/templates/capabilities/llm/apps/api/src/modules/llm/domain/usage-repository.ts +10 -0
  79. package/templates/capabilities/llm/apps/api/src/modules/llm/infra/llm-router.ts +88 -0
  80. package/templates/capabilities/llm/apps/api/src/modules/llm/infra/llm.app.test.ts +89 -0
  81. package/templates/capabilities/llm/apps/api/src/modules/llm/infra/memory-usage-repository.ts +13 -0
  82. package/templates/capabilities/llm/apps/api/src/modules/llm/infra/prisma-usage-repository.ts +17 -0
  83. package/templates/capabilities/llm/apps/web/src/features/llm/llm-page.tsx +53 -0
  84. package/templates/capabilities/llm/packages/contracts/src/api/llm.ts +26 -0
  85. package/templates/capabilities/llm/packages/contracts/src/dto/llm.ts +33 -0
  86. package/templates/capabilities/llm/packages/sdk/src/resources/llm.ts +68 -0
  87. package/templates/capabilities/llm/packages/web-sdk/src/llm-hooks.ts +12 -0
  88. package/templates/capabilities/push/apps/api/src/modules/devices/application/device-service.ts +42 -0
  89. package/templates/capabilities/push/apps/api/src/modules/devices/domain/device-repository.ts +22 -0
  90. package/templates/capabilities/push/apps/api/src/modules/devices/infra/device-router.ts +42 -0
  91. package/templates/capabilities/push/apps/api/src/modules/devices/infra/device.app.test.ts +34 -0
  92. package/templates/capabilities/push/apps/api/src/modules/devices/infra/memory-device-repository.ts +33 -0
  93. package/templates/capabilities/push/apps/api/src/modules/devices/infra/prisma-device-repository.ts +42 -0
  94. package/templates/capabilities/push/apps/mobile/src/adapters/push.ts +21 -0
  95. package/templates/capabilities/push/packages/contracts/src/api/devices.ts +33 -0
  96. package/templates/capabilities/push/packages/contracts/src/dto/device.ts +18 -0
  97. package/templates/capabilities/push/packages/sdk/src/resources/devices.ts +10 -0
  98. package/templates/capabilities/team/apps/api/src/modules/organizations/application/organization-service.ts +272 -0
  99. package/templates/capabilities/team/apps/api/src/modules/organizations/domain/organization-repository.ts +58 -0
  100. package/templates/capabilities/team/apps/api/src/modules/organizations/infra/memory-organization-repository.ts +141 -0
  101. package/templates/capabilities/team/apps/api/src/modules/organizations/infra/organization-router.ts +130 -0
  102. package/templates/capabilities/team/apps/api/src/modules/organizations/infra/organization.app.test.ts +213 -0
  103. package/templates/capabilities/team/apps/api/src/modules/organizations/infra/prisma-organization-repository.ts +142 -0
  104. package/templates/capabilities/team/apps/mobile/src/screens/invite-screen.tsx +40 -0
  105. package/templates/capabilities/team/apps/mobile/src/screens/org-detail-screen.tsx +154 -0
  106. package/templates/capabilities/team/apps/mobile/src/screens/orgs-screen.tsx +53 -0
  107. package/templates/capabilities/team/apps/web/src/features/orgs/invite-page.tsx +77 -0
  108. package/templates/capabilities/team/apps/web/src/features/orgs/org-detail-page.tsx +138 -0
  109. package/templates/capabilities/team/apps/web/src/features/orgs/orgs-page.tsx +73 -0
  110. package/templates/capabilities/team/packages/contracts/src/api/organizations.ts +154 -0
  111. package/templates/capabilities/team/packages/contracts/src/dto/organization.ts +58 -0
  112. package/templates/capabilities/team/packages/sdk/src/resources/organizations.ts +53 -0
  113. package/templates/capabilities/team/packages/web-sdk/src/organizations-hooks.ts +80 -0
  114. package/templates/module/api.ts.tmpl +32 -0
  115. package/templates/module/application-service.ts.tmpl +9 -0
  116. package/templates/module/domain-repository.ts.tmpl +15 -0
  117. package/templates/module/dto.ts.tmpl +21 -0
  118. package/templates/module/memory-repository.ts.tmpl +36 -0
  119. package/templates/module/model.prisma.tmpl +8 -0
  120. package/templates/module/prisma-repository.ts.tmpl +38 -0
  121. package/templates/module/router.ts.tmpl +32 -0
  122. package/templates/module/sdk-resource.ts.tmpl +17 -0
  123. package/templates/module/service.test.ts.tmpl +33 -0
  124. package/templates/module/web-hooks.ts.tmpl +24 -0
  125. package/templates/module/web-page.tsx.tmpl +69 -0
@@ -0,0 +1,616 @@
1
+ import { ensureMarkerBlock, ensureNamedImport, expressRouteInsertBefore, insertAfterLastImport, insertBeforeMatch, } from './patch-text';
2
+ const ensureTypeField = (src, afterNeedle, fieldLine) => {
3
+ if (src.includes(fieldLine.trim()))
4
+ return src;
5
+ if (!src.includes(afterNeedle))
6
+ return src;
7
+ return src.replace(afterNeedle, `${afterNeedle}\n ${fieldLine}`);
8
+ };
9
+ const ensureReturnKey = (src, key) => {
10
+ if (src.includes(` ${key},\n`) || src.includes(` ${key}:`))
11
+ return src;
12
+ if (!src.includes(' pingReady: async () => {'))
13
+ return src;
14
+ return src.replace(' pingReady: async () => {', ` ${key},\n pingReady: async () => {`);
15
+ };
16
+ const ensureInputKey = (src, after, field) => {
17
+ if (src.includes(field.trim()))
18
+ return src;
19
+ if (!src.includes(after))
20
+ return src;
21
+ return src.replace(after, `${after}\n ${field}`);
22
+ };
23
+ const ensureContract = (src, file, contractName, key) => {
24
+ let next = insertAfterLastImport(src, `import { ${contractName} } from './${file}';`);
25
+ if (!next.includes(`${key}: ${contractName}`)) {
26
+ next = insertBeforeMatch(next, '\n});', `\n ${key}: ${contractName},`);
27
+ }
28
+ const exportLine = `export * from './${file}';`;
29
+ if (!next.includes(exportLine)) {
30
+ next = `${next.trimEnd()}\n${exportLine}\n`;
31
+ }
32
+ return next;
33
+ };
34
+ const ensureFastifyMount = (src, name, body) => {
35
+ const next = ensureMarkerBlock(src, `${name}:fastify`, ` ${body}`, ' if (input.bullmqQueues) await mountBullBoardFastify');
36
+ if (next.includes(`ysk-add:${name}:fastify`))
37
+ return next;
38
+ if (src.includes('mountFastify(app, appContract.notifications')) {
39
+ return src.replace('mountFastify(app, appContract.notifications, notificationHandlers(input.notificationService));', `mountFastify(app, appContract.notifications, notificationHandlers(input.notificationService));\n ${body}`);
40
+ }
41
+ return next;
42
+ };
43
+ export const patchTeamApp = (src) => {
44
+ let next = insertAfterLastImport(src, "import { registerOrganizationRoutes } from './modules/organizations/infra/organization-router';");
45
+ next = insertAfterLastImport(next, "import type { OrganizationService } from './modules/organizations/application/organization-service';");
46
+ next = ensureTypeField(next, 'userService: UserService;', 'organizationService: OrganizationService;');
47
+ return ensureMarkerBlock(next, 'team', ' registerOrganizationRoutes(app, input.organizationService);', expressRouteInsertBefore(next));
48
+ };
49
+ export const patchTeamComposition = (src) => {
50
+ let next = insertAfterLastImport(src, "import { createOrganizationService } from './modules/organizations/application/organization-service';");
51
+ next = insertAfterLastImport(next, "import { createPrismaOrganizationRepository } from './modules/organizations/infra/prisma-organization-repository';");
52
+ next = insertAfterLastImport(next, "import type { OrganizationService } from './modules/organizations/application/organization-service';");
53
+ next = ensureTypeField(next, 'userService: UserService;', 'organizationService: OrganizationService;');
54
+ next = ensureMarkerBlock(next, 'team', ` const orgs = createPrismaOrganizationRepository(prisma);
55
+ const organizationService = createOrganizationService({ orgs, users, jobs: queue, audit, webPublicUrl: env.WEB_PUBLIC_URL });`, ' return {');
56
+ return ensureReturnKey(next, 'organizationService');
57
+ };
58
+ export const patchTeamFastify = (src) => {
59
+ const next = insertAfterLastImport(src, "import { organizationHandlers } from './modules/organizations/infra/organization-router';");
60
+ return ensureFastifyMount(next, 'team', 'mountFastify(app, appContract.organizations, organizationHandlers(input.organizationService));');
61
+ };
62
+ export const patchTeamMain = (src) => ensureInputKey(src, 'userService: composition.userService,', 'organizationService: composition.organizationService,');
63
+ export const patchTeamMemory = (src) => {
64
+ let next = insertAfterLastImport(src, "import { createOrganizationService } from './modules/organizations/application/organization-service';");
65
+ next = insertAfterLastImport(next, "import { createMemoryOrganizationRepository } from './modules/organizations/infra/memory-organization-repository';");
66
+ if (!next.includes('createMemoryOrganizationRepository()')) {
67
+ next = next.replace('const users = createMemoryUserRepository();', 'const users = createMemoryUserRepository();\n const orgs = createMemoryOrganizationRepository();');
68
+ }
69
+ next = ensureInputKey(next, 'userService: createUserService(users, audit, queue, sessions),', "organizationService: createOrganizationService({\n orgs,\n users,\n jobs: queue,\n audit,\n webPublicUrl: 'http://localhost:5173',\n }),");
70
+ if (next.includes('return { input, otpSink, mail, jobs, realtime, users, sessions };') &&
71
+ !next.includes('sessions, orgs')) {
72
+ next = next.replace('return { input, otpSink, mail, jobs, realtime, users, sessions };', 'return { input, otpSink, mail, jobs, realtime, users, sessions, orgs };');
73
+ }
74
+ return next;
75
+ };
76
+ export const patchTeamSdk = (src) => {
77
+ let next = insertAfterLastImport(src, "import { organizationsResource } from './resources/organizations';");
78
+ if (!next.includes('organizations: organizationsResource(http)')) {
79
+ if (next.includes('users: usersResource(http),')) {
80
+ next = next.replace('users: usersResource(http),', 'users: usersResource(http),\n organizations: organizationsResource(http),');
81
+ }
82
+ else {
83
+ next = insertBeforeMatch(next, 'connectRealtime:', ' organizations: organizationsResource(http),\n ');
84
+ }
85
+ }
86
+ return next;
87
+ };
88
+ export const patchTeamWebSdk = (src) => {
89
+ const line = `export {
90
+ createOrganizationHooks,
91
+ organizationQueryKey,
92
+ organizationsQueryKey,
93
+ } from './organizations-hooks';`;
94
+ if (src.includes("from './organizations-hooks'"))
95
+ return src;
96
+ return `${src.trimEnd()}\n${line}\n`;
97
+ };
98
+ export const patchTeamWeb = (src) => {
99
+ let next = insertAfterLastImport(src, "import { InvitePage } from './features/orgs/invite-page';");
100
+ next = insertAfterLastImport(next, "import { OrgDetailPage } from './features/orgs/org-detail-page';");
101
+ next = insertAfterLastImport(next, "import { OrgsPage } from './features/orgs/orgs-page';");
102
+ next = ensureMarkerBlock(next, 'team:web', `const orgsRoute = createRoute({
103
+ getParentRoute: () => rootRoute,
104
+ path: '/orgs',
105
+ component: OrgsPage,
106
+ });
107
+
108
+ const orgDetailRoute = createRoute({
109
+ getParentRoute: () => rootRoute,
110
+ path: '/orgs/$organizationId',
111
+ component: function OrgDetailRoute() {
112
+ const { organizationId } = orgDetailRoute.useParams();
113
+ return <OrgDetailPage organizationId={organizationId} />;
114
+ },
115
+ });
116
+
117
+ const inviteRoute = createRoute({
118
+ getParentRoute: () => rootRoute,
119
+ path: '/invite',
120
+ component: InvitePage,
121
+ });
122
+ `, 'const routeTree = ');
123
+ if (!next.includes('orgsRoute,') && next.includes('export const router')) {
124
+ next = insertBeforeMatch(next, '\n]);\n\nexport const router', '\n orgsRoute,\n orgDetailRoute,\n inviteRoute,');
125
+ }
126
+ if (next.includes('<span className="ml-auto" />') && !next.includes('to="/orgs"')) {
127
+ next = next.replace('<span className="ml-auto" />', `<Link to="/orgs" className="text-zinc-600 hover:text-zinc-900">
128
+ Orgs
129
+ </Link>
130
+ <span className="ml-auto" />`);
131
+ }
132
+ if (next.includes('<Link to="/notifications"') &&
133
+ !next.includes('to="/orgs"') &&
134
+ next.includes('className={navClass}')) {
135
+ next = next.replace(` <Link to="/notifications" className={navClass}>
136
+ Inbox
137
+ </Link>`, ` <Link to="/notifications" className={navClass}>
138
+ Inbox
139
+ </Link>
140
+ <Link to="/orgs" className={navClass}>
141
+ Orgs
142
+ </Link>`);
143
+ }
144
+ return next;
145
+ };
146
+ export const patchTeamContracts = (src) => ensureContract(src, 'organizations', 'organizationsContract', 'organizations');
147
+ export const patchTeamMobileApp = (src) => {
148
+ let next = insertAfterLastImport(src, "import { InviteScreen } from './screens/invite-screen';");
149
+ next = insertAfterLastImport(next, "import { OrgDetailScreen } from './screens/org-detail-screen';");
150
+ next = insertAfterLastImport(next, "import { OrgsScreen } from './screens/orgs-screen';");
151
+ next = next.replace("type Screen = 'login' | 'home' | 'inbox';", "type Screen = 'login' | 'home' | 'inbox' | 'orgs' | 'org-detail' | 'invite';");
152
+ if (!next.includes('organizationId')) {
153
+ next = next.replace(" const [screen, setScreen] = useState<Screen>('login');\n", " const [screen, setScreen] = useState<Screen>('login');\n const [organizationId, setOrganizationId] = useState<string | null>(null);\n");
154
+ }
155
+ if (!next.includes('onAcceptInvite')) {
156
+ next = next.replace(`{screen === 'login' ? <LoginScreen onSignedIn={() => setScreen('home')} /> : null}`, `{screen === 'login' ? (
157
+ <LoginScreen
158
+ onSignedIn={() => setScreen('home')}
159
+ onAcceptInvite={() => setScreen('invite')}
160
+ />
161
+ ) : null}`);
162
+ }
163
+ if (!next.includes('onOrgs')) {
164
+ next = next.replace(`<HomeScreen onInbox={() => setScreen('inbox')} onLogout={() => setScreen('login')} />`, `<HomeScreen
165
+ onInbox={() => setScreen('inbox')}
166
+ onOrgs={() => setScreen('orgs')}
167
+ onLogout={() => setScreen('login')}
168
+ />`);
169
+ }
170
+ if (!next.includes('<OrgsScreen')) {
171
+ next = next.replace(`{screen === 'inbox' ? <InboxScreen onBack={() => setScreen('home')} /> : null}`, `{screen === 'inbox' ? <InboxScreen onBack={() => setScreen('home')} /> : null}
172
+ {screen === 'orgs' ? (
173
+ <OrgsScreen
174
+ onBack={() => setScreen('home')}
175
+ onOpen={(id) => {
176
+ setOrganizationId(id);
177
+ setScreen('org-detail');
178
+ }}
179
+ />
180
+ ) : null}
181
+ {screen === 'org-detail' && organizationId ? (
182
+ <OrgDetailScreen organizationId={organizationId} onBack={() => setScreen('orgs')} />
183
+ ) : null}
184
+ {screen === 'invite' ? (
185
+ <InviteScreen onDone={() => setScreen('login')} />
186
+ ) : null}`);
187
+ }
188
+ return next;
189
+ };
190
+ export const patchTeamMobileHome = (src) => {
191
+ if (src.includes('onOrgs'))
192
+ return src;
193
+ let next = src.replace(`export function HomeScreen({
194
+ onInbox,
195
+ onLogout,
196
+ }: {
197
+ onInbox: () => void;
198
+ onLogout: () => void;
199
+ }) {`, `export function HomeScreen({
200
+ onInbox,
201
+ onOrgs,
202
+ onLogout,
203
+ }: {
204
+ onInbox: () => void;
205
+ onOrgs: () => void;
206
+ onLogout: () => void;
207
+ }) {`);
208
+ next = next.replace('export function HomeScreen({ onInbox, onLogout }: { onInbox: () => void; onLogout: () => void }) {', `export function HomeScreen({
209
+ onInbox,
210
+ onOrgs,
211
+ onLogout,
212
+ }: {
213
+ onInbox: () => void;
214
+ onOrgs: () => void;
215
+ onLogout: () => void;
216
+ }) {`);
217
+ if (!next.includes('title="Organizations"')) {
218
+ next = next.replace('<Button title="Inbox" onPress={onInbox} />', `<Button title="Inbox" onPress={onInbox} />
219
+ <Button title="Organizations" onPress={onOrgs} />`);
220
+ }
221
+ return next;
222
+ };
223
+ export const patchTeamMobileLogin = (src) => {
224
+ if (src.includes('onAcceptInvite'))
225
+ return src;
226
+ let next = src.replace(`export function LoginScreen({
227
+ onSignedIn,
228
+ }: {
229
+ onSignedIn: () => void;
230
+ }) {`, `export function LoginScreen({
231
+ onSignedIn,
232
+ onAcceptInvite,
233
+ }: {
234
+ onSignedIn: () => void;
235
+ onAcceptInvite: () => void;
236
+ }) {`);
237
+ next = next.replace('export function LoginScreen({ onSignedIn }: { onSignedIn: () => void }) {', `export function LoginScreen({
238
+ onSignedIn,
239
+ onAcceptInvite,
240
+ }: {
241
+ onSignedIn: () => void;
242
+ onAcceptInvite: () => void;
243
+ }) {`);
244
+ if (!next.includes('title="Accept invite"')) {
245
+ next = next.replace(/<Button title="Sign in" onPress=\{[^}]+\} \/>/, (match) => `${match}\n <Button title="Accept invite" onPress={onAcceptInvite} />`);
246
+ }
247
+ return next;
248
+ };
249
+ export const patchLlmApp = (src) => {
250
+ let next = insertAfterLastImport(src, "import { registerLlmRoutes } from './modules/llm/infra/llm-router';");
251
+ next = insertAfterLastImport(next, "import type { LlmService } from './modules/llm/application/llm-service';");
252
+ next = ensureTypeField(next, 'notificationService: NotificationService;', 'llmService: LlmService;');
253
+ return ensureMarkerBlock(next, 'llm', ' registerLlmRoutes(app, input.llmService);', expressRouteInsertBefore(next));
254
+ };
255
+ export const patchLlmComposition = (src) => {
256
+ let next = insertAfterLastImport(src, "import { createLlmFromEnv, type ILlmPort } from '@ysk-kit/llm';");
257
+ next = insertAfterLastImport(next, "import { createLlmService, type LlmService } from './modules/llm/application/llm-service';");
258
+ next = insertAfterLastImport(next, "import { createPrismaLlmUsageRepository } from './modules/llm/infra/prisma-usage-repository';");
259
+ next = ensureTypeField(next, 'mail: IMailPort;', 'llm: ILlmPort;');
260
+ next = ensureTypeField(next, 'llm: ILlmPort;', 'llmService: LlmService;');
261
+ if (next.includes('mail?: IMailPort;') && !next.includes('llm?: ILlmPort;')) {
262
+ next = next.replace('mail?: IMailPort;', 'mail?: IMailPort;\n llm?: ILlmPort;');
263
+ }
264
+ next = ensureMarkerBlock(next, 'llm', ` const llm = opts?.llm ?? createLlmFromEnv(env);
265
+ const llmService = createLlmService({
266
+ llm,
267
+ usage: createPrismaLlmUsageRepository(prisma),
268
+ configured: Boolean(env.LLM_API_KEY || env.XAI_API_KEY),
269
+ production: env.NODE_ENV === 'production',
270
+ });`, ' return {');
271
+ next = ensureReturnKey(next, 'llm');
272
+ return ensureReturnKey(next, 'llmService');
273
+ };
274
+ export const patchLlmFastify = (src) => {
275
+ let next = insertAfterLastImport(src, "import { llmHandlers, writeLlmSse } from './modules/llm/infra/llm-router';");
276
+ next = ensureNamedImport(next, '@ysk-kit/contracts', [
277
+ 'appContract',
278
+ 'claimsHasPermission',
279
+ 'LlmCompleteCommandSchema',
280
+ ]);
281
+ next = ensureFastifyMount(next, 'llm', 'mountFastify(app, appContract.llm, llmHandlers(input.llmService));');
282
+ return ensureMarkerBlock(next, 'llm:stream', ` app.post('/v1/llm/stream', async (req, reply) => {
283
+ if (!req.auth) throw new AppError('UNAUTHENTICATED');
284
+ if (!claimsHasPermission(req.auth, 'llm.use')) throw new AppError('FORBIDDEN');
285
+ const parsed = LlmCompleteCommandSchema.parse(req.body);
286
+ reply.hijack();
287
+ reply.raw.writeHead(200, {
288
+ 'content-type': 'text/event-stream',
289
+ 'cache-control': 'no-cache, no-transform',
290
+ connection: 'keep-alive',
291
+ 'x-accel-buffering': 'no',
292
+ });
293
+ await writeLlmSse(
294
+ input.llmService,
295
+ req.auth.sub,
296
+ parsed,
297
+ String(req.headers[REQUEST_ID_HEADER] ?? ''),
298
+ (chunk) => {
299
+ reply.raw.write(chunk);
300
+ },
301
+ () => {
302
+ reply.raw.end();
303
+ },
304
+ );
305
+ });`, ' if (input.allowLocalUpload && input.storage.putLocal)');
306
+ };
307
+ export const patchLlmMain = (src) => ensureInputKey(src, 'notificationService: composition.notificationService,', 'llmService: composition.llmService,');
308
+ export const patchLlmMemory = (src) => {
309
+ let next = insertAfterLastImport(src, "import { createFakeLlm } from '@ysk-kit/llm';");
310
+ next = insertAfterLastImport(next, "import { createLlmService } from './modules/llm/application/llm-service';");
311
+ next = insertAfterLastImport(next, "import { createMemoryLlmUsageRepository } from './modules/llm/infra/memory-usage-repository';");
312
+ if (!next.includes('createMemoryLlmUsageRepository()')) {
313
+ next = next.replace('const realtime = createMemoryRealtime();', 'const realtime = createMemoryRealtime();\n const usage = createMemoryLlmUsageRepository();');
314
+ }
315
+ next = ensureInputKey(next, 'notificationService: createNotificationService(notifications),', "llmService: createLlmService({\n llm: createFakeLlm({ text: 'pong' }),\n usage,\n configured: true,\n production: false,\n }),");
316
+ if (next.includes('return { input, otpSink, mail, jobs, realtime, users, sessions') &&
317
+ !next.includes('usage,')) {
318
+ next = next.replace('return { input, otpSink, mail, jobs, realtime, users, sessions', 'return { input, otpSink, mail, jobs, realtime, usage, users, sessions');
319
+ }
320
+ return next;
321
+ };
322
+ export const patchLlmSdk = (src) => {
323
+ let next = insertAfterLastImport(src, "import { llmResource } from './resources/llm';");
324
+ if (!next.includes('llm: llmResource(http')) {
325
+ const block = ` llm: llmResource(http, {
326
+ baseUrl,
327
+ platform: opts.platform,
328
+ tokenStore,
329
+ ...(opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
330
+ }),`;
331
+ if (next.includes('users: usersResource(http),')) {
332
+ next = next.replace('users: usersResource(http),', `users: usersResource(http),\n${block}`);
333
+ }
334
+ else {
335
+ next = insertBeforeMatch(next, 'connectRealtime:', `${block}\n `);
336
+ }
337
+ }
338
+ return next;
339
+ };
340
+ export const patchLlmWebSdk = (src) => {
341
+ const line = "export { createLlmHooks } from './llm-hooks';";
342
+ if (src.includes(line))
343
+ return src;
344
+ return `${src.trimEnd()}\n${line}\n`;
345
+ };
346
+ export const patchLlmWeb = (src) => {
347
+ let next = insertAfterLastImport(src, "import { LlmPage } from './features/llm/llm-page';");
348
+ next = ensureMarkerBlock(next, 'llm:web', `const llmRoute = createRoute({
349
+ getParentRoute: () => rootRoute,
350
+ path: '/llm',
351
+ component: LlmPage,
352
+ });
353
+ `, 'const routeTree = ');
354
+ if (!next.includes('llmRoute,') && next.includes('export const router')) {
355
+ next = insertBeforeMatch(next, '\n]);\n\nexport const router', '\n llmRoute,');
356
+ }
357
+ if (next.includes('<span className="ml-auto" />') && !next.includes('to="/llm"')) {
358
+ next = next.replace('<span className="ml-auto" />', `<Link to="/llm" className="text-zinc-600 hover:text-zinc-900">
359
+ LLM
360
+ </Link>
361
+ <span className="ml-auto" />`);
362
+ }
363
+ return next;
364
+ };
365
+ export const patchLlmContracts = (src) => ensureContract(src, 'llm', 'llmContract', 'llm');
366
+ export const patchPushApp = (src) => {
367
+ let next = insertAfterLastImport(src, "import { registerDeviceRoutes } from './modules/devices/infra/device-router';");
368
+ next = insertAfterLastImport(next, "import type { DeviceService } from './modules/devices/application/device-service';");
369
+ next = ensureTypeField(next, 'notificationService: NotificationService;', 'deviceService: DeviceService;');
370
+ return ensureMarkerBlock(next, 'push', ' registerDeviceRoutes(app, input.deviceService);', expressRouteInsertBefore(next));
371
+ };
372
+ export const patchPushComposition = (src) => {
373
+ let next = insertAfterLastImport(src, "import { createPushFromEnv, type IPushPort } from '@ysk-kit/push';");
374
+ next = insertAfterLastImport(next, "import { createDeviceService, type DeviceService } from './modules/devices/application/device-service';");
375
+ next = insertAfterLastImport(next, "import type { IDeviceRepository } from './modules/devices/domain/device-repository';");
376
+ next = insertAfterLastImport(next, "import { createPrismaDeviceRepository } from './modules/devices/infra/prisma-device-repository';");
377
+ next = ensureTypeField(next, 'realtime: IRealtimePort;', 'devices: IDeviceRepository;');
378
+ next = ensureTypeField(next, 'devices: IDeviceRepository;', 'deviceService: DeviceService;');
379
+ next = ensureTypeField(next, 'deviceService: DeviceService;', 'push: IPushPort;');
380
+ next = ensureMarkerBlock(next, 'push', ` const devices = createPrismaDeviceRepository(prisma);
381
+ const push = createPushFromEnv(env);
382
+ const deviceService = createDeviceService(devices);`, ' return {');
383
+ next = ensureReturnKey(next, 'devices');
384
+ next = ensureReturnKey(next, 'deviceService');
385
+ return ensureReturnKey(next, 'push');
386
+ };
387
+ export const patchPushFastify = (src) => {
388
+ const next = insertAfterLastImport(src, "import { deviceHandlers } from './modules/devices/infra/device-router';");
389
+ return ensureFastifyMount(next, 'push', 'mountFastify(app, appContract.devices, deviceHandlers(input.deviceService));');
390
+ };
391
+ export const patchPushMain = (src) => {
392
+ let next = ensureInputKey(src, 'notificationService: composition.notificationService,', 'deviceService: composition.deviceService,');
393
+ if (next.includes('registerWorkers({') && !next.includes('devices: composition.devices')) {
394
+ next = next.replace('realtime,', 'realtime,\n devices: composition.devices,\n push: composition.push,');
395
+ if (!next.includes('devices: composition.devices')) {
396
+ next = next.replace('realtime: composition.realtime,', 'realtime: composition.realtime,\n devices: composition.devices,\n push: composition.push,');
397
+ }
398
+ }
399
+ return next;
400
+ };
401
+ export const patchPushWorker = (src) => {
402
+ if (src.includes('devices: composition.devices'))
403
+ return src;
404
+ if (src.includes('realtime: composition.realtime,')) {
405
+ return src.replace('realtime: composition.realtime,', 'realtime: composition.realtime,\n devices: composition.devices,\n push: composition.push,');
406
+ }
407
+ return src;
408
+ };
409
+ export const patchPushMemory = (src) => {
410
+ let next = insertAfterLastImport(src, "import { createLogPush } from '@ysk-kit/push';");
411
+ next = insertAfterLastImport(next, "import { createDeviceService } from './modules/devices/application/device-service';");
412
+ next = insertAfterLastImport(next, "import { createMemoryDeviceRepository } from './modules/devices/infra/memory-device-repository';");
413
+ if (!next.includes('createMemoryDeviceRepository()')) {
414
+ next = next.replace('const notifications = createMemoryNotificationRepository();', 'const notifications = createMemoryNotificationRepository();\n const devices = createMemoryDeviceRepository();\n const push = createLogPush();');
415
+ }
416
+ next = ensureInputKey(next, 'notificationService: createNotificationService(notifications),', 'deviceService: createDeviceService(devices),');
417
+ if (next.includes('registerWorkers({') && !next.includes('devices,')) {
418
+ next = next.replace('realtime,', 'realtime,\n devices,\n push,');
419
+ }
420
+ if (next.includes('return { input, otpSink, mail, jobs, realtime') &&
421
+ !/return \{ input, otpSink, mail, jobs, realtime[^}]*\bpush\b/.test(next)) {
422
+ next = next.replace('return { input, otpSink, mail, jobs, realtime', 'return { input, otpSink, mail, jobs, realtime, push');
423
+ }
424
+ return next;
425
+ };
426
+ export const patchPushSdk = (src) => {
427
+ let next = insertAfterLastImport(src, "import { devicesResource } from './resources/devices';");
428
+ if (!next.includes('devices: devicesResource(http)')) {
429
+ if (next.includes('users: usersResource(http),')) {
430
+ next = next.replace('users: usersResource(http),', 'users: usersResource(http),\n devices: devicesResource(http),');
431
+ }
432
+ else {
433
+ next = insertBeforeMatch(next, 'connectRealtime:', ' devices: devicesResource(http),\n ');
434
+ }
435
+ }
436
+ return next;
437
+ };
438
+ export const patchPushContracts = (src) => ensureContract(src, 'devices', 'devicesContract', 'devices');
439
+ export const patchBillingApp = (src) => {
440
+ let next = insertAfterLastImport(src, "import type { BillingService } from './modules/billing/application/billing-service';");
441
+ next = insertAfterLastImport(next, "import { registerBillingRoutes } from './modules/billing/infra/billing-router';");
442
+ next = insertAfterLastImport(next, "import { verifyStripeSignature } from './modules/billing/infra/stripe-billing';");
443
+ next = ensureNamedImport(next, '@ysk-kit/api-express', ['requireAuth', 'requirePermission']);
444
+ next = ensureTypeField(next, 'apiKeyService: ApiKeyService;', 'billingService: BillingService;');
445
+ if (!next.includes('stripeWebhookSecret?: string;')) {
446
+ next = ensureTypeField(next, 'jwtSecret: string;', 'stripeWebhookSecret?: string;');
447
+ }
448
+ next = ensureMarkerBlock(next, 'billing:webhook', ` if (input.stripeWebhookSecret) {
449
+ const webhookSecret = input.stripeWebhookSecret;
450
+ app.post('/v1/billing/webhook', express.raw({ type: '*/*' }), async (req, res, next) => {
451
+ try {
452
+ const event = verifyStripeSignature(
453
+ Buffer.isBuffer(req.body) ? req.body : Buffer.from(String(req.body ?? '')),
454
+ String(req.headers['stripe-signature'] ?? ''),
455
+ webhookSecret,
456
+ );
457
+ if (event.type === 'checkout.session.completed') {
458
+ const organizationId = event.data.object.metadata?.organizationId;
459
+ const planCode = event.data.object.metadata?.planCode;
460
+ const seatRaw = Number(event.data.object.metadata?.seatCount ?? '1');
461
+ const seatCount = Number.isFinite(seatRaw) && seatRaw >= 1 ? Math.floor(seatRaw) : 1;
462
+ if (organizationId && (planCode === 'pro' || planCode === 'free')) {
463
+ const customer = event.data.object.customer;
464
+ await input.billingService.activate(
465
+ organizationId,
466
+ planCode,
467
+ typeof customer === 'string' ? customer : undefined,
468
+ seatCount,
469
+ );
470
+ }
471
+ }
472
+ res.status(200).json({ ok: true, data: { received: true } });
473
+ } catch (error) {
474
+ next(error);
475
+ }
476
+ });
477
+ }`, " app.use(express.json({ limit: '2mb' }));");
478
+ next = ensureMarkerBlock(next, 'billing', ' registerBillingRoutes(app, input.billingService);', expressRouteInsertBefore(next));
479
+ return ensureMarkerBlock(next, 'billing:pdf', ` app.get(
480
+ '/v1/billing/invoices/:id/pdf',
481
+ requireAuth,
482
+ requirePermission('billing.checkout'),
483
+ async (req, res, next) => {
484
+ try {
485
+ const url = await input.billingService.invoicePdf(
486
+ req.auth?.sub ?? '',
487
+ String(req.query.organizationId ?? ''),
488
+ String(req.params.id ?? ''),
489
+ );
490
+ if (!url) throw new AppError('NOT_FOUND');
491
+ res.redirect(302, url.url);
492
+ } catch (error) {
493
+ next(error);
494
+ }
495
+ },
496
+ );`, expressRouteInsertBefore(next));
497
+ };
498
+ export const patchBillingComposition = (src) => {
499
+ let next = insertAfterLastImport(src, "import { createBillingService, type BillingService } from './modules/billing/application/billing-service';");
500
+ next = insertAfterLastImport(next, "import { createLogBilling } from './modules/billing/infra/log-billing';");
501
+ next = insertAfterLastImport(next, "import { createPrismaSubscriptionRepository } from './modules/billing/infra/prisma-subscription-repository';");
502
+ next = insertAfterLastImport(next, "import { createBillingFromEnv } from './modules/billing/infra/stripe-billing';");
503
+ next = ensureTypeField(next, 'apiKeyService: ApiKeyService;', 'billingService: BillingService;');
504
+ next = ensureMarkerBlock(next, 'billing', ` const billingService = createBillingService({
505
+ subscriptions: createPrismaSubscriptionRepository(prisma),
506
+ billing: createBillingFromEnv(env, createLogBilling()),
507
+ orgs,
508
+ });`, ' return {');
509
+ return ensureReturnKey(next, 'billingService');
510
+ };
511
+ export const patchBillingFastify = (src) => {
512
+ let next = insertAfterLastImport(src, "import { billingHandlers } from './modules/billing/infra/billing-router';");
513
+ next = insertAfterLastImport(next, "import { verifyStripeSignature } from './modules/billing/infra/stripe-billing';");
514
+ next = ensureNamedImport(next, '@ysk-kit/contracts', ['appContract', 'claimsHasPermission']);
515
+ next = ensureMarkerBlock(next, 'billing:webhook', ` if (input.stripeWebhookSecret) {
516
+ const webhookSecret = input.stripeWebhookSecret;
517
+ await app.register(async (scope) => {
518
+ scope.addContentTypeParser('application/json', { parseAs: 'buffer' }, (_req, body, done) => {
519
+ done(null, body);
520
+ });
521
+ scope.post('/v1/billing/webhook', async (req, reply) => {
522
+ const event = verifyStripeSignature(
523
+ Buffer.isBuffer(req.body) ? req.body : Buffer.from(String(req.body ?? '')),
524
+ String(req.headers['stripe-signature'] ?? ''),
525
+ webhookSecret,
526
+ );
527
+ if (event.type === 'checkout.session.completed') {
528
+ const organizationId = event.data.object.metadata?.organizationId;
529
+ const planCode = event.data.object.metadata?.planCode;
530
+ const seatRaw = Number(event.data.object.metadata?.seatCount ?? '1');
531
+ const seatCount = Number.isFinite(seatRaw) && seatRaw >= 1 ? Math.floor(seatRaw) : 1;
532
+ if (organizationId && (planCode === 'pro' || planCode === 'free')) {
533
+ const customer = event.data.object.customer;
534
+ await input.billingService.activate(
535
+ organizationId,
536
+ planCode,
537
+ typeof customer === 'string' ? customer : undefined,
538
+ seatCount,
539
+ );
540
+ }
541
+ }
542
+ return reply.status(200).send({ ok: true, data: { received: true } });
543
+ });
544
+ });
545
+ }`, ' mountFastify(app, appContract.health');
546
+ next = ensureFastifyMount(next, 'billing', 'mountFastify(app, appContract.billing, billingHandlers(input.billingService));');
547
+ return ensureMarkerBlock(next, 'billing:pdf', ` app.get('/v1/billing/invoices/:id/pdf', async (req, reply) => {
548
+ if (!req.auth) throw new AppError('UNAUTHENTICATED');
549
+ if (!claimsHasPermission(req.auth, 'billing.checkout')) throw new AppError('FORBIDDEN');
550
+ const url = await input.billingService.invoicePdf(
551
+ req.auth.sub,
552
+ String((req.query as { organizationId?: string }).organizationId ?? ''),
553
+ String((req.params as { id?: string }).id ?? ''),
554
+ );
555
+ if (!url) throw new AppError('NOT_FOUND');
556
+ return reply.redirect(url.url);
557
+ });`, ' if (input.bullmqQueues) await mountBullBoardFastify');
558
+ };
559
+ export const patchBillingMain = (src) => {
560
+ let next = ensureInputKey(src, 'apiKeyService: composition.apiKeyService,', 'billingService: composition.billingService,');
561
+ if (!next.includes('stripeWebhookSecret: composition.env.STRIPE_WEBHOOK_SECRET') &&
562
+ next.includes("allowLocalUpload: composition.env.NODE_ENV !== 'production',")) {
563
+ next = next.replace("allowLocalUpload: composition.env.NODE_ENV !== 'production',", `allowLocalUpload: composition.env.NODE_ENV !== 'production',
564
+ ...(composition.env.STRIPE_WEBHOOK_SECRET
565
+ ? { stripeWebhookSecret: composition.env.STRIPE_WEBHOOK_SECRET }
566
+ : {}),`);
567
+ }
568
+ return next;
569
+ };
570
+ export const patchBillingMemory = (src) => {
571
+ let next = insertAfterLastImport(src, "import { createBillingService } from './modules/billing/application/billing-service';");
572
+ next = insertAfterLastImport(next, "import { createLogBilling } from './modules/billing/infra/log-billing';");
573
+ next = insertAfterLastImport(next, "import { createMemorySubscriptionRepository } from './modules/billing/infra/memory-subscription-repository';");
574
+ return ensureInputKey(next, 'apiKeyService,', `billingService: createBillingService({
575
+ subscriptions: createMemorySubscriptionRepository(),
576
+ billing: createLogBilling(),
577
+ orgs,
578
+ }),`);
579
+ };
580
+ export const patchBillingSdk = (src) => {
581
+ let next = insertAfterLastImport(src, "import { billingResource } from './resources/billing';");
582
+ if (!next.includes('billing: billingResource(http)')) {
583
+ if (next.includes('users: usersResource(http),')) {
584
+ next = next.replace('users: usersResource(http),', 'users: usersResource(http),\n billing: billingResource(http),');
585
+ }
586
+ else {
587
+ next = insertBeforeMatch(next, 'connectRealtime:', ' billing: billingResource(http),\n ');
588
+ }
589
+ }
590
+ return next;
591
+ };
592
+ export const patchBillingWebSdk = (src) => {
593
+ const line = "export { createBillingHooks, billingQueryKey } from './billing-hooks';";
594
+ if (src.includes(line))
595
+ return src;
596
+ return `${src.trimEnd()}\n${line}\n`;
597
+ };
598
+ export const patchBillingWeb = (src) => {
599
+ let next = insertAfterLastImport(src, "import { BillingPage } from './features/orgs/billing-page';");
600
+ next = ensureMarkerBlock(next, 'billing:web', `const orgBillingRoute = createRoute({
601
+ getParentRoute: () => rootRoute,
602
+ path: '/orgs/$organizationId/billing',
603
+ component: function OrgBillingRoute() {
604
+ const { organizationId } = orgBillingRoute.useParams();
605
+ return <BillingPage organizationId={organizationId} />;
606
+ },
607
+ });
608
+ `, 'const routeTree = ');
609
+ if (!next.includes('orgBillingRoute,') && next.includes('export const router')) {
610
+ next = insertBeforeMatch(next, '\n]);\n\nexport const router', '\n orgBillingRoute,');
611
+ }
612
+ return next;
613
+ };
614
+ export const patchBillingContracts = (src) => ensureContract(src, 'billing', 'billingContract', 'billing');
615
+ export const SOURCE_CAPABILITIES = ['llm', 'team', 'billing', 'push'];
616
+ //# sourceMappingURL=capability-patches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-patches.js","sourceRoot":"","sources":["../src/capability-patches.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE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