@getbrevo/cli 2.0.2 → 2.2.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 (220) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/README.md +32 -6
  3. package/agent-context/AGENTS.md +62 -15
  4. package/agent-context/SKILL.md +98 -14
  5. package/dist/bin/files/AGENTS.md.tmpl +119 -0
  6. package/dist/bin/files/CLAUDE.md.tmpl +139 -0
  7. package/dist/bin/files/README.md.tmpl +184 -0
  8. package/dist/bin/files/app-config.json.tmpl +16 -0
  9. package/dist/{templates → bin}/files/src/oauth/.env.example.tmpl +8 -0
  10. package/dist/{templates → bin}/files/src/oauth/.env.local.tmpl +2 -0
  11. package/dist/{templates → bin}/files/src/oauth/handler.js.tmpl +49 -7
  12. package/dist/{templates → bin}/files/src/oauth/server.js.tmpl +20 -14
  13. package/dist/{templates → bin}/files/src/oauth/token-store.js.tmpl +19 -0
  14. package/dist/bin/index.js +680 -235
  15. package/dist/bin/index.js.map +7 -1
  16. package/package.json +6 -4
  17. package/dist/api/client.d.ts +0 -25
  18. package/dist/api/client.d.ts.map +0 -1
  19. package/dist/api/client.js +0 -205
  20. package/dist/api/client.js.map +0 -1
  21. package/dist/bin/index.d.ts +0 -3
  22. package/dist/bin/index.d.ts.map +0 -1
  23. package/dist/commands/app/create.d.ts +0 -8
  24. package/dist/commands/app/create.d.ts.map +0 -1
  25. package/dist/commands/app/create.js +0 -325
  26. package/dist/commands/app/create.js.map +0 -1
  27. package/dist/commands/app/credentials.d.ts +0 -6
  28. package/dist/commands/app/credentials.d.ts.map +0 -1
  29. package/dist/commands/app/credentials.js +0 -114
  30. package/dist/commands/app/credentials.js.map +0 -1
  31. package/dist/commands/app/delete.d.ts +0 -6
  32. package/dist/commands/app/delete.d.ts.map +0 -1
  33. package/dist/commands/app/delete.js +0 -167
  34. package/dist/commands/app/delete.js.map +0 -1
  35. package/dist/commands/app/list.d.ts +0 -4
  36. package/dist/commands/app/list.d.ts.map +0 -1
  37. package/dist/commands/app/list.js +0 -71
  38. package/dist/commands/app/list.js.map +0 -1
  39. package/dist/commands/app/scaffold.d.ts +0 -5
  40. package/dist/commands/app/scaffold.d.ts.map +0 -1
  41. package/dist/commands/app/scaffold.js +0 -213
  42. package/dist/commands/app/scaffold.js.map +0 -1
  43. package/dist/commands/app/scopes.d.ts +0 -2
  44. package/dist/commands/app/scopes.d.ts.map +0 -1
  45. package/dist/commands/app/scopes.js +0 -81
  46. package/dist/commands/app/scopes.js.map +0 -1
  47. package/dist/commands/app/start.d.ts +0 -5
  48. package/dist/commands/app/start.d.ts.map +0 -1
  49. package/dist/commands/app/start.js +0 -220
  50. package/dist/commands/app/start.js.map +0 -1
  51. package/dist/commands/app/update.d.ts +0 -2
  52. package/dist/commands/app/update.d.ts.map +0 -1
  53. package/dist/commands/app/update.js +0 -444
  54. package/dist/commands/app/update.js.map +0 -1
  55. package/dist/commands/definitions.d.ts +0 -5
  56. package/dist/commands/definitions.d.ts.map +0 -1
  57. package/dist/commands/definitions.js +0 -262
  58. package/dist/commands/definitions.js.map +0 -1
  59. package/dist/commands/init.d.ts +0 -2
  60. package/dist/commands/init.d.ts.map +0 -1
  61. package/dist/commands/init.js +0 -138
  62. package/dist/commands/init.js.map +0 -1
  63. package/dist/commands/login.d.ts +0 -6
  64. package/dist/commands/login.d.ts.map +0 -1
  65. package/dist/commands/login.js +0 -251
  66. package/dist/commands/login.js.map +0 -1
  67. package/dist/commands/logout.d.ts +0 -5
  68. package/dist/commands/logout.d.ts.map +0 -1
  69. package/dist/commands/logout.js +0 -54
  70. package/dist/commands/logout.js.map +0 -1
  71. package/dist/commands/skill/install.d.ts +0 -4
  72. package/dist/commands/skill/install.d.ts.map +0 -1
  73. package/dist/commands/skill/install.js +0 -29
  74. package/dist/commands/skill/install.js.map +0 -1
  75. package/dist/commands/skill/uninstall.d.ts +0 -4
  76. package/dist/commands/skill/uninstall.d.ts.map +0 -1
  77. package/dist/commands/skill/uninstall.js +0 -23
  78. package/dist/commands/skill/uninstall.js.map +0 -1
  79. package/dist/commands/whoami.d.ts +0 -4
  80. package/dist/commands/whoami.d.ts.map +0 -1
  81. package/dist/commands/whoami.js +0 -85
  82. package/dist/commands/whoami.js.map +0 -1
  83. package/dist/container.d.ts +0 -7
  84. package/dist/container.d.ts.map +0 -1
  85. package/dist/container.js +0 -28
  86. package/dist/container.js.map +0 -1
  87. package/dist/lang/en.d.ts +0 -162
  88. package/dist/lang/en.d.ts.map +0 -1
  89. package/dist/lang/en.js +0 -189
  90. package/dist/lang/en.js.map +0 -1
  91. package/dist/lib/abort.d.ts +0 -3
  92. package/dist/lib/abort.d.ts.map +0 -1
  93. package/dist/lib/abort.js +0 -30
  94. package/dist/lib/abort.js.map +0 -1
  95. package/dist/lib/auth-guard.d.ts +0 -13
  96. package/dist/lib/auth-guard.d.ts.map +0 -1
  97. package/dist/lib/auth-guard.js +0 -60
  98. package/dist/lib/auth-guard.js.map +0 -1
  99. package/dist/lib/browser.d.ts +0 -2
  100. package/dist/lib/browser.d.ts.map +0 -1
  101. package/dist/lib/browser.js +0 -16
  102. package/dist/lib/browser.js.map +0 -1
  103. package/dist/lib/cli-version.d.ts +0 -2
  104. package/dist/lib/cli-version.d.ts.map +0 -1
  105. package/dist/lib/cli-version.js +0 -59
  106. package/dist/lib/cli-version.js.map +0 -1
  107. package/dist/lib/command-handler.d.ts +0 -10
  108. package/dist/lib/command-handler.d.ts.map +0 -1
  109. package/dist/lib/command-handler.js +0 -16
  110. package/dist/lib/command-handler.js.map +0 -1
  111. package/dist/lib/command-registry.d.ts +0 -28
  112. package/dist/lib/command-registry.d.ts.map +0 -1
  113. package/dist/lib/command-registry.js +0 -54
  114. package/dist/lib/command-registry.js.map +0 -1
  115. package/dist/lib/config.d.ts +0 -83
  116. package/dist/lib/config.d.ts.map +0 -1
  117. package/dist/lib/config.js +0 -430
  118. package/dist/lib/config.js.map +0 -1
  119. package/dist/lib/constants.d.ts +0 -48
  120. package/dist/lib/constants.d.ts.map +0 -1
  121. package/dist/lib/constants.js +0 -121
  122. package/dist/lib/constants.js.map +0 -1
  123. package/dist/lib/errors.d.ts +0 -30
  124. package/dist/lib/errors.d.ts.map +0 -1
  125. package/dist/lib/errors.js +0 -66
  126. package/dist/lib/errors.js.map +0 -1
  127. package/dist/lib/exit-codes.d.ts +0 -9
  128. package/dist/lib/exit-codes.d.ts.map +0 -1
  129. package/dist/lib/exit-codes.js +0 -12
  130. package/dist/lib/exit-codes.js.map +0 -1
  131. package/dist/lib/hidden-input.d.ts +0 -2
  132. package/dist/lib/hidden-input.d.ts.map +0 -1
  133. package/dist/lib/hidden-input.js +0 -78
  134. package/dist/lib/hidden-input.js.map +0 -1
  135. package/dist/lib/json-output.d.ts +0 -6
  136. package/dist/lib/json-output.d.ts.map +0 -1
  137. package/dist/lib/json-output.js +0 -11
  138. package/dist/lib/json-output.js.map +0 -1
  139. package/dist/lib/logger.d.ts +0 -11
  140. package/dist/lib/logger.d.ts.map +0 -1
  141. package/dist/lib/logger.js +0 -110
  142. package/dist/lib/logger.js.map +0 -1
  143. package/dist/lib/oauth-freshness.d.ts +0 -30
  144. package/dist/lib/oauth-freshness.d.ts.map +0 -1
  145. package/dist/lib/oauth-freshness.js +0 -61
  146. package/dist/lib/oauth-freshness.js.map +0 -1
  147. package/dist/lib/port.d.ts +0 -25
  148. package/dist/lib/port.d.ts.map +0 -1
  149. package/dist/lib/port.js +0 -103
  150. package/dist/lib/port.js.map +0 -1
  151. package/dist/lib/telemetry.d.ts +0 -9
  152. package/dist/lib/telemetry.d.ts.map +0 -1
  153. package/dist/lib/telemetry.js +0 -57
  154. package/dist/lib/telemetry.js.map +0 -1
  155. package/dist/lib/ui.d.ts +0 -14
  156. package/dist/lib/ui.d.ts.map +0 -1
  157. package/dist/lib/ui.js +0 -75
  158. package/dist/lib/ui.js.map +0 -1
  159. package/dist/lib/update-notifier.d.ts +0 -37
  160. package/dist/lib/update-notifier.d.ts.map +0 -1
  161. package/dist/lib/update-notifier.js +0 -298
  162. package/dist/lib/update-notifier.js.map +0 -1
  163. package/dist/lib/validators.d.ts +0 -55
  164. package/dist/lib/validators.d.ts.map +0 -1
  165. package/dist/lib/validators.js +0 -166
  166. package/dist/lib/validators.js.map +0 -1
  167. package/dist/services/account.d.ts +0 -8
  168. package/dist/services/account.d.ts.map +0 -1
  169. package/dist/services/account.js +0 -15
  170. package/dist/services/account.js.map +0 -1
  171. package/dist/services/app.d.ts +0 -38
  172. package/dist/services/app.d.ts.map +0 -1
  173. package/dist/services/app.js +0 -145
  174. package/dist/services/app.js.map +0 -1
  175. package/dist/services/browser-auth.d.ts +0 -15
  176. package/dist/services/browser-auth.d.ts.map +0 -1
  177. package/dist/services/browser-auth.js +0 -188
  178. package/dist/services/browser-auth.js.map +0 -1
  179. package/dist/services/normalize-app-id.d.ts +0 -12
  180. package/dist/services/normalize-app-id.d.ts.map +0 -1
  181. package/dist/services/normalize-app-id.js +0 -38
  182. package/dist/services/normalize-app-id.js.map +0 -1
  183. package/dist/services/oauth-metadata.d.ts +0 -7
  184. package/dist/services/oauth-metadata.d.ts.map +0 -1
  185. package/dist/services/oauth-metadata.js +0 -43
  186. package/dist/services/oauth-metadata.js.map +0 -1
  187. package/dist/services/oauth-refresh.d.ts +0 -14
  188. package/dist/services/oauth-refresh.d.ts.map +0 -1
  189. package/dist/services/oauth-refresh.js +0 -70
  190. package/dist/services/oauth-refresh.js.map +0 -1
  191. package/dist/services/scopes-html.d.ts +0 -3
  192. package/dist/services/scopes-html.d.ts.map +0 -1
  193. package/dist/services/scopes-html.js +0 -516
  194. package/dist/services/scopes-html.js.map +0 -1
  195. package/dist/services/scopes-web.d.ts +0 -12
  196. package/dist/services/scopes-web.d.ts.map +0 -1
  197. package/dist/services/scopes-web.js +0 -95
  198. package/dist/services/scopes-web.js.map +0 -1
  199. package/dist/services/skill.d.ts +0 -48
  200. package/dist/services/skill.d.ts.map +0 -1
  201. package/dist/services/skill.js +0 -223
  202. package/dist/services/skill.js.map +0 -1
  203. package/dist/skills/index.d.ts +0 -47
  204. package/dist/skills/index.d.ts.map +0 -1
  205. package/dist/skills/index.js +0 -61
  206. package/dist/skills/index.js.map +0 -1
  207. package/dist/templates/files/AGENTS.md.tmpl +0 -52
  208. package/dist/templates/files/CLAUDE.md.tmpl +0 -59
  209. package/dist/templates/files/README.md.tmpl +0 -85
  210. package/dist/templates/files/app-config.json.tmpl +0 -25
  211. package/dist/templates/index.d.ts +0 -36
  212. package/dist/templates/index.d.ts.map +0 -1
  213. package/dist/templates/index.js +0 -105
  214. package/dist/templates/index.js.map +0 -1
  215. package/dist/types.d.ts +0 -32
  216. package/dist/types.d.ts.map +0 -1
  217. package/dist/types.js +0 -3
  218. package/dist/types.js.map +0 -1
  219. /package/dist/{templates → bin}/files/gitignore.tmpl +0 -0
  220. /package/dist/{templates → bin}/files/src/oauth/package.json.tmpl +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/services/skill.ts"],"names":[],"mappings":"AAaA,wBAAgB,mBAAmB,IAAI,MAAM,CAM5C;AAwED,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,mBAAmB,GAAG,aAAa,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,YAAY;IACvB;;;OAGG;yBACkB,aAAa,EAAE;IAepC,+DAA+D;sBAC7C,MAAM,GAAG,OAAO;kBAMpB,MAAM,YAAW;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAQ,aAAa;yBA6BnD;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAQ,aAAa,EAAE;oBAI9C,eAAe,EAAE;IASjC;;;;;OAKG;+BACuB,kBAAkB,GAAQ,IAAI;CAwBzD,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAM/C,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;CAC7B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAgB5E"}
@@ -1,223 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.skillService = void 0;
37
- exports.getClaudeSkillsRoot = getClaudeSkillsRoot;
38
- exports.shouldSkipAutoRefresh = shouldSkipAutoRefresh;
39
- const fs = __importStar(require("node:fs"));
40
- const path = __importStar(require("node:path"));
41
- const os = __importStar(require("node:os"));
42
- const en_1 = require("../lang/en");
43
- const errors_1 = require("../lib/errors");
44
- const skills_1 = require("../skills");
45
- // ──────────────── Target directory ────────────────
46
- // Claude Code reads skills from `~/.claude/skills/<name>/`. The path is
47
- // overridable via BREVO_CLAUDE_HOME so tests (and future Cursor support)
48
- // can target a different root without monkey-patching `os.homedir`.
49
- function getClaudeSkillsRoot() {
50
- const override = process.env.BREVO_CLAUDE_HOME;
51
- if (override?.trim()) {
52
- return path.join(override, 'skills');
53
- }
54
- return path.join(os.homedir(), '.claude', 'skills');
55
- }
56
- function getSkillTargetDir(name) {
57
- return path.join(getClaudeSkillsRoot(), name);
58
- }
59
- // ──────────────── Install marker ────────────────
60
- // A `.brevo-skill.json` file inside each installed skill records the version
61
- // and source. It lets the auto-refresh pass decide whether a refresh is needed
62
- // and lets `brevo skill:cli uninstall` confirm we only delete directories the CLI
63
- // created — never something the user dropped in `~/.claude/skills/` manually.
64
- const MARKER_FILE = '.brevo-skill.json';
65
- function readMarker(skillDir) {
66
- try {
67
- const raw = JSON.parse(fs.readFileSync(path.join(skillDir, MARKER_FILE), 'utf-8'));
68
- if (raw &&
69
- typeof raw === 'object' &&
70
- typeof raw.name === 'string' &&
71
- typeof raw.version === 'string' &&
72
- raw.source === 'brevo-cli') {
73
- return {
74
- name: raw.name,
75
- version: raw.version,
76
- installedAt: typeof raw.installedAt === 'string' ? raw.installedAt : '',
77
- source: 'brevo-cli',
78
- };
79
- }
80
- return null;
81
- }
82
- catch {
83
- return null;
84
- }
85
- }
86
- function writeMarker(skillDir, entry) {
87
- const marker = {
88
- name: entry.name,
89
- version: entry.version,
90
- installedAt: new Date().toISOString(),
91
- source: 'brevo-cli',
92
- };
93
- fs.writeFileSync(path.join(skillDir, MARKER_FILE), JSON.stringify(marker, null, 2) + '\n', 'utf-8');
94
- }
95
- // ──────────────── File copy ────────────────
96
- function copySkillFiles(entry, targetDir) {
97
- fs.mkdirSync(targetDir, { recursive: true });
98
- for (const relative of entry.files) {
99
- const src = path.join(skills_1.SKILLS_BUNDLE_DIR, entry.subdir, relative);
100
- const dest = path.join(targetDir, relative);
101
- fs.mkdirSync(path.dirname(dest), { recursive: true });
102
- fs.copyFileSync(src, dest);
103
- }
104
- }
105
- exports.skillService = {
106
- /**
107
- * Installed skills whose marker version is behind the bundled catalog.
108
- * Pure file read — safe to call on every CLI invocation for auto-refresh.
109
- */
110
- getOutdatedSkills() {
111
- return skills_1.SKILL_CATALOG.flatMap((entry) => {
112
- const marker = readMarker(getSkillTargetDir(entry.name));
113
- if (!marker)
114
- return [];
115
- if (marker.version === entry.version)
116
- return [];
117
- return [
118
- {
119
- name: entry.name,
120
- installedVersion: marker.version,
121
- latestVersion: entry.version,
122
- },
123
- ];
124
- });
125
- },
126
- /** True when the named skill is installed (marker present). */
127
- isInstalled(name) {
128
- const entry = (0, skills_1.getSkill)(name);
129
- if (!entry)
130
- return false;
131
- return readMarker(getSkillTargetDir(entry.name)) !== null;
132
- },
133
- install(name, options = {}) {
134
- const entry = (0, skills_1.getSkill)(name);
135
- if (!entry) {
136
- throw new errors_1.CliError(unknownSkillMessage(name));
137
- }
138
- const targetDir = getSkillTargetDir(entry.name);
139
- const marker = readMarker(targetDir);
140
- if (marker && !options.force) {
141
- return {
142
- name: entry.name,
143
- version: marker.version,
144
- status: 'already-installed',
145
- path: targetDir,
146
- };
147
- }
148
- copySkillFiles(entry, targetDir);
149
- writeMarker(targetDir, entry);
150
- return {
151
- name: entry.name,
152
- version: entry.version,
153
- status: marker ? 'overwritten' : 'installed',
154
- path: targetDir,
155
- };
156
- },
157
- installAll(options = {}) {
158
- return skills_1.SKILL_CATALOG.map((entry) => this.install(entry.name, options));
159
- },
160
- uninstallAll() {
161
- return skills_1.SKILL_CATALOG.flatMap((entry) => {
162
- const targetDir = getSkillTargetDir(entry.name);
163
- if (!readMarker(targetDir))
164
- return [];
165
- fs.rmSync(targetDir, { recursive: true, force: true });
166
- return [{ name: entry.name, path: targetDir }];
167
- });
168
- },
169
- /**
170
- * Refresh installed skills whose marker version drifts from the bundled
171
- * catalog. Pure local file ops — safe to call after every CLI invocation.
172
- * Errors during the refresh emit a single error line and never throw,
173
- * so a broken refresh can't block the user's actual command.
174
- */
175
- autoRefreshOutdated(opts = {}) {
176
- if (shouldSkipAutoRefresh(opts))
177
- return;
178
- let outdated;
179
- try {
180
- outdated = this.getOutdatedSkills();
181
- }
182
- catch {
183
- return;
184
- }
185
- if (outdated.length === 0)
186
- return;
187
- const output = opts.output ?? process.stderr;
188
- for (const s of outdated) {
189
- try {
190
- this.install(s.name, { force: true });
191
- output.write(` ${en_1.messages.SKILL_AUTOREFRESHED(s.name, s.installedVersion, s.latestVersion)}\n`);
192
- }
193
- catch (err) {
194
- const msg = err instanceof Error ? err.message : String(err);
195
- output.write(` ${en_1.messages.SKILL_AUTOREFRESH_FAILED(s.name, msg)}\n`);
196
- }
197
- }
198
- },
199
- };
200
- function shouldSkipAutoRefresh(opts = {}) {
201
- const env = opts.env ?? process.env;
202
- const argv = opts.argv ?? process.argv;
203
- // CI runners shouldn't have surprise mutations to ~/.claude.
204
- if (env.CI === 'true' || env.CI === '1')
205
- return true;
206
- // --json callers want deterministic, machine-readable output.
207
- if (argv.includes('--json'))
208
- return true;
209
- // The user is already managing skills — let their explicit command do the work.
210
- if (argv.length > 2 && argv[2] === 'skill:cli')
211
- return true;
212
- // Dedicated opt-out for users who hand-edit their installed SKILL.md and
213
- // don't want it clobbered on the next `brevo` run.
214
- if (env.BREVO_NO_SKILL_AUTOREFRESH === '1' || env.BREVO_NO_SKILL_AUTOREFRESH === 'true') {
215
- return true;
216
- }
217
- return false;
218
- }
219
- function unknownSkillMessage(name) {
220
- const available = skills_1.SKILL_CATALOG.map((s) => s.name).join(', ');
221
- return `Unknown skill "${name}". Available: ${available}`;
222
- }
223
- //# sourceMappingURL=skill.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/services/skill.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,kDAMC;AA6MD,sDAgBC;AAhPD,4CAA8B;AAC9B,gDAAkC;AAClC,4CAA8B;AAE9B,mCAAsC;AACtC,0CAAyC;AACzC,sCAAmF;AAEnF,qDAAqD;AACrD,wEAAwE;AACxE,yEAAyE;AACzE,oEAAoE;AAEpE,SAAgB,mBAAmB;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC/C,IAAI,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC;AAED,mDAAmD;AACnD,6EAA6E;AAC7E,+EAA+E;AAC/E,kFAAkF;AAClF,8EAA8E;AAE9E,MAAM,WAAW,GAAG,mBAAmB,CAAC;AASxC,SAAS,UAAU,CAAC,QAAgB;IAClC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,OA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I,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvC,6DAA6D;IAC7D,IAAI,GAAG,CAAC,EAAE,KAAK,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACrD,8DAA8D;IAC9D,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,gFAAgF;IAChF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC5D,yEAAyE;IACzE,mDAAmD;IACnD,IAAI,GAAG,CAAC,0BAA0B,KAAK,GAAG,IAAI,GAAG,CAAC,0BAA0B,KAAK,MAAM,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY;IACvC,MAAM,SAAS,GAAG,sBAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D,OAAO,kBAAkB,IAAI,iBAAiB,SAAS,EAAE,CAAC;AAC5D,CAAC"}
@@ -1,47 +0,0 @@
1
- import { CLI_VERSION } from '../lib/cli-version';
2
- export { CLI_VERSION };
3
- /**
4
- * Catalog of Brevo-authored agent skills installable via `brevo skill:cli install`.
5
- *
6
- * Source content lives under `agent-context/` at the repo root — the same
7
- * directory the README documents for manual install (`cp .../agent-context/
8
- * SKILL.md ...`). Keeping a single source avoids drift between the
9
- * programmatic install path and the documented manual path.
10
- *
11
- * **Skill version is the CLI version.** Every published CLI release carries
12
- * its own bundled `agent-context/`, so installed skills auto-refresh after a
13
- * CLI upgrade even if `SKILL.md` itself didn't change. This eliminates the
14
- * "forgot to bump skill version when editing SKILL.md" failure mode.
15
- *
16
- * To add a new skill:
17
- * 1. Drop SKILL.md (+ any supporting files) under `agent-context/<subdir>/`,
18
- * or directly under `agent-context/` if it shares the brevo-cli layout.
19
- * 2. Add an entry below with `subdir` pointing at the right directory.
20
- */
21
- export interface SkillEntry {
22
- /** Stable, kebab-case identifier for the skill catalog entry. */
23
- name: string;
24
- /** Short one-line summary. */
25
- description: string;
26
- /** Tracks the CLI version (see `CLI_VERSION` below). */
27
- version: string;
28
- /**
29
- * Subdirectory under `SKILLS_BUNDLE_DIR` that holds this skill's files.
30
- * `''` means files live directly in the bundle root (used by brevo-cli,
31
- * which shares `agent-context/` with the manually-installable copy).
32
- */
33
- subdir: string;
34
- /** Files to copy, relative to `SKILLS_BUNDLE_DIR/<subdir>/`. */
35
- files: string[];
36
- }
37
- export declare const SKILL_CATALOG: readonly SkillEntry[];
38
- /**
39
- * Absolute path to the bundled skill source directory. Resolved relative to
40
- * this file so the same code works under ts-jest (`src/skills/`), built dev
41
- * builds (`dist/skills/`), and the published tarball
42
- * (`node_modules/@getbrevo/cli/dist/skills/`). The `agent-context/` directory
43
- * is shipped at the package root via `package.json` `files:`.
44
- */
45
- export declare const SKILLS_BUNDLE_DIR: string;
46
- export declare function getSkill(name: string): SkillEntry | undefined;
47
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,UAAU;IACzB,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EASrC,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,QAAuD,CAAC;AAEtF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE7D"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SKILLS_BUNDLE_DIR = exports.SKILL_CATALOG = exports.CLI_VERSION = void 0;
37
- exports.getSkill = getSkill;
38
- const path = __importStar(require("node:path"));
39
- const cli_version_1 = require("../lib/cli-version");
40
- Object.defineProperty(exports, "CLI_VERSION", { enumerable: true, get: function () { return cli_version_1.CLI_VERSION; } });
41
- exports.SKILL_CATALOG = [
42
- {
43
- name: 'brevo-cli',
44
- description: 'Agent primer for the Brevo Developer CLI — decision tree, hard rules, and command map for the `brevo` binary.',
45
- version: cli_version_1.CLI_VERSION,
46
- subdir: '',
47
- files: ['SKILL.md'],
48
- },
49
- ];
50
- /**
51
- * Absolute path to the bundled skill source directory. Resolved relative to
52
- * this file so the same code works under ts-jest (`src/skills/`), built dev
53
- * builds (`dist/skills/`), and the published tarball
54
- * (`node_modules/@getbrevo/cli/dist/skills/`). The `agent-context/` directory
55
- * is shipped at the package root via `package.json` `files:`.
56
- */
57
- exports.SKILLS_BUNDLE_DIR = path.resolve(__dirname, '..', '..', 'agent-context');
58
- function getSkill(name) {
59
- return exports.SKILL_CATALOG.find((s) => s.name === name);
60
- }
61
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,4BAEC;AA/DD,gDAAkC;AAElC,oDAAiD;AACxC,4FADA,yBAAW,OACA;AAsCP,QAAA,aAAa,GAA0B;IAClD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,+GAA+G;QACjH,OAAO,EAAE,yBAAW;QACpB,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,CAAC,UAAU,CAAC;KACpB;CACO,CAAC;AAEX;;;;;;GAMG;AACU,QAAA,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;AAEtF,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,qBAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACpD,CAAC"}
@@ -1,52 +0,0 @@
1
- # {{APP_NAME}} — Agent Context
2
-
3
- This project is a Brevo OAuth 2.0 integration scaffolded with the Brevo CLI.
4
-
5
- > **This is a test app** for local OAuth testing. Not for production use.
6
-
7
- ## What this does
8
- Implements the authorization code flow to obtain access tokens for the Brevo API.
9
-
10
- ## Project structure
11
- ```
12
- .
13
- ├── app-config.json App metadata (app ID, redirect URIs, scopes, logo URL)
14
- ├── .gitignore Ignores .env.local and build artifacts
15
- ├── AGENTS.md AI agent guidance (this file)
16
- ├── CLAUDE.md Claude Code guidance
17
- ├── README.md Human-facing setup guide
18
- └── src/
19
- └── oauth/ Self-contained OAuth test feature
20
- ├── package.json Dependencies and scripts
21
- ├── server.js Test server — Express app + dotenv + routes
22
- ├── handler.js OAuth routes (/auth/login, /auth/callback, /auth/refresh)
23
- ├── token-store.js In-memory token management (swap for DB in production)
24
- ├── .env.example Credential template (safe to commit)
25
- └── .env.local Local credentials (gitignored — never commit)
26
- ```
27
-
28
- ## OAuth server
29
- - OAuth uses realm-based paths: `/realms/{realm}/oauth/...`
30
- - Default realm: `partner`
31
- - Token endpoint expects `application/x-www-form-urlencoded` body (not query params)
32
- - Grant types used by this scaffold: `authorization_code` (callback) and `refresh_token` (`/auth/refresh`)
33
- - Other grant types supported by the Brevo OAuth server but not wired into this scaffold: `client_credentials`
34
-
35
- ## OAuth flow
36
- 1. `/auth/login` — generates CSRF state, redirects user to `{OAUTH_BASE}/realms/{realm}/oauth/authorize`
37
- 2. User authorizes -> OAuth server redirects to `/auth/callback` with an auth code
38
- 3. Server validates state, exchanges code for access + refresh tokens via `POST /realms/{realm}/oauth/token`
39
- 4. Verifies connection via `GET /realms/{realm}/oauth/userinfo`
40
- 5. `/auth/refresh` — refreshes tokens using `refresh_token` grant
41
-
42
- ## Development
43
- ```bash
44
- yarn --cwd src/oauth install
45
- # or: npm --prefix src/oauth install
46
- brevo app start oauth # port is read from app-config.json; override with --port
47
- ```
48
-
49
- ## Docs
50
- - [Brevo API Documentation](https://developers.brevo.com)
51
- - [Brevo CLI reference](https://developers.brevo.com/docs/cli-reference) — full command and option list
52
- - [Brevo CLI repo](https://github.com/getbrevo/brevo-cli)
@@ -1,59 +0,0 @@
1
- # CLAUDE.md — {{APP_NAME}}
2
-
3
- ## Project
4
- Brevo OAuth integration for app `{{APP_ID}}`.
5
- Scaffolded with the [Brevo CLI](https://github.com/getbrevo/brevo-cli) — see the [Brevo CLI reference](https://developers.brevo.com/docs/cli-reference) for the full command list.
6
-
7
- > **This is a test app** scaffolded by the Brevo CLI to help you test your OAuth integration locally.
8
-
9
- ## Run
10
- ```bash
11
- yarn --cwd src/oauth install
12
- # or: npm --prefix src/oauth install
13
- brevo app start oauth # port is read from app-config.json; override with --port
14
- ```
15
-
16
- ## Structure
17
- ```
18
- .
19
- ├── app-config.json App metadata (ID, scopes, redirect URLs, logo URL)
20
- ├── .gitignore Ignores .env.local and build artifacts
21
- ├── AGENTS.md AI agent guidance
22
- ├── CLAUDE.md Claude Code guidance (this file)
23
- ├── README.md Human-facing setup guide
24
- └── src/
25
- └── oauth/ Self-contained OAuth test feature
26
- ├── package.json Dependencies and scripts
27
- ├── server.js Test server entry point
28
- ├── handler.js OAuth routes (/auth/login, /auth/callback, /auth/refresh)
29
- ├── token-store.js In-memory token store
30
- ├── .env.example Credential template (committed)
31
- └── .env.local Local credentials (gitignored — never commit)
32
- ```
33
-
34
- ## OAuth server
35
- - OAuth endpoints use realm-based paths: `/realms/{realm}/oauth/...`
36
- - Default realm: `partner`
37
- - Env vars `OAUTH_BASE` and `OAUTH_REALM` control the OAuth server and realm
38
-
39
- ### Endpoints used
40
- | Endpoint | Purpose |
41
- |----------|---------|
42
- | `GET /realms/{realm}/oauth/authorize` | Authorization (redirect user here) |
43
- | `POST /realms/{realm}/oauth/token` | Exchange code or refresh token for access token |
44
- | `GET /realms/{realm}/oauth/userinfo` | Fetch user profile with Bearer token |
45
- | `POST /realms/{realm}/oauth/revoke` | Revoke a token |
46
- | `POST /realms/{realm}/oauth/introspect` | Token introspection (RFC 7662) |
47
- | `GET /realms/{realm}/.well-known/openid-configuration` | OIDC discovery |
48
-
49
- ## Key flows
50
- - `/auth/login` — generates random CSRF state, redirects to OAuth authorize endpoint
51
- - `/auth/callback` — validates state, POSTs code to `/realms/{realm}/oauth/token`, stores tokens
52
- - `/auth/refresh` — refreshes tokens using `refresh_token` grant
53
-
54
- ## Next steps
55
- - Replace the in-memory token store in `src/oauth/token-store.js` with a real database (the global singleton is process-local so data is lost on restart, and it is not session-isolated, so multiple users/sessions/tabs can read or overwrite the same in-memory tokens)
56
- - Handle token-refresh failures — `/auth/refresh` currently returns a 500 on any error; surface 401 vs 5xx distinctly so callers can re-trigger `/auth/login` when the refresh token has expired
57
- - Add `/auth/logout` that calls `POST /realms/{realm}/oauth/revoke` and clears the token store (the endpoint is supported by the OAuth server but the scaffold doesn't use it yet)
58
- - Add automated tests around the callback and refresh routes (e.g. with `supertest` + axios mocks) before extending the flow
59
- - Persist (or rotate) the CSRF `state` per session — the scaffold stores a single global state, which is fine for solo localhost testing but not for anything else
@@ -1,85 +0,0 @@
1
- # {{APP_NAME}}
2
-
3
- Brevo OAuth integration for testing and implementing app authorization flows, scaffolded with the Brevo CLI.
4
-
5
- > **This is a starter / test app** to help you exercise the OAuth flow locally. Treat it as a reference — it is not intended for production use.
6
-
7
- ## Setup
8
-
9
- 1. Install dependencies for the oauth feature:
10
-
11
- ```bash
12
- yarn --cwd src/oauth install
13
- # or: npm --prefix src/oauth install
14
- ```
15
-
16
- 2. Start the local OAuth test server (the CLI reads `app-config.json` for port and redirect URLs):
17
-
18
- ```bash
19
- brevo app start oauth
20
- # or choose a port: brevo app start oauth --port 3000
21
- ```
22
-
23
- 3. Open the login URL printed by the CLI (typically `http://localhost:<port>/auth/login`). The OAuth server redirects back to `http://localhost:<port>/auth/callback` — make sure that URL is registered on your app's redirect list.
24
-
25
- ## Project structure
26
-
27
- ```
28
- .
29
- ├── app-config.json App config — ID, scopes, redirect URLs, logo URL
30
- ├── .gitignore Ignores .env.local and build artifacts
31
- ├── AGENTS.md AI agent guidance
32
- ├── CLAUDE.md Claude Code guidance
33
- ├── README.md (this file)
34
- └── src/
35
- └── oauth/ Self-contained OAuth test feature
36
- ├── package.json Dependencies & `yarn start` script
37
- ├── server.js Test server entry point
38
- ├── handler.js OAuth routes (/auth/login, /auth/callback, /auth/refresh)
39
- ├── token-store.js In-memory token management
40
- ├── .env.example Credential template (committed)
41
- └── .env.local Local credentials (gitignored, chmod 600)
42
- ```
43
-
44
- ## Credentials
45
-
46
- - Client ID and secret are written to `src/oauth/.env.local` during scaffold (file permissions `600`).
47
- - Re-fetch them any time with `brevo app credentials --app-id {{APP_ID}} --reveal-secret`.
48
- - `.env.local` is in `.gitignore` — **never commit it**.
49
-
50
- ## Security
51
-
52
- - Never commit `src/oauth/.env.local` — it contains your client secret.
53
- - The test server uses a random `state` parameter for CSRF protection and binds to localhost only.
54
- - Access tokens are kept in process memory; restarting the server clears them.
55
-
56
- ## Updating your app
57
-
58
- Push changes to Brevo directly from the CLI:
59
-
60
- ```bash
61
- brevo app update --name "New Name"
62
- brevo app update --redirect-url https://myapp.com/callback
63
- brevo app update --name "New Name" --redirect-url https://myapp.com/callback
64
- brevo app update --logo-uri https://example.com/logo.png
65
- ```
66
-
67
- `--redirect-url` is repeatable and **appends** to existing URLs.
68
-
69
- To avoid unintentionally accumulating stale redirect URLs over time:
70
-
71
- - Periodically review your redirect list and remove obsolete entries in `app-config.json`.
72
- - Run `brevo app update` **without flags** to replace the remote configuration with the local file.
73
- - When flags are provided, the local `app-config.json` is updated automatically after a successful API call.
74
-
75
- Outside this project directory, target an app by ID:
76
-
77
- ```bash
78
- brevo app update --app-id {{APP_ID}} --name "New Name"
79
- ```
80
-
81
- ## Docs
82
-
83
- - [Brevo API Documentation](https://developers.brevo.com)
84
- - [Brevo CLI reference](https://developers.brevo.com/docs/cli-reference)
85
- - [Brevo CLI](https://github.com/getbrevo/brevo-cli)
@@ -1,25 +0,0 @@
1
- {
2
- "appId": "{{APP_ID}}",
3
- "appName": "{{APP_NAME}}",
4
- "logoUri": "{{LOGO_URI}}",
5
- "cliVersion": "{{CLI_VERSION}}",
6
- "auth": {
7
- "type": "private",
8
- "scopes": {{SCOPES_JSON}},
9
- "redirectUrls": {{REDIRECT_URLS_JSON}}
10
- },
11
- "distribution": "private",
12
- "permittedUrls": {
13
- "fetch": [],
14
- "img": [],
15
- "iframe": [],
16
- "js": [],
17
- "css": []
18
- },
19
- "support": {
20
- "supportEmail": "",
21
- "documentationUrl": "",
22
- "supportUrl": "",
23
- "supportPhone": ""
24
- }
25
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Replace all occurrences of the given keys in a template string.
3
- * Keys should include delimiters (e.g. '{{APP_NAME}}').
4
- */
5
- export declare function applyVars(template: string, vars: Record<string, string>): string;
6
- /**
7
- * Scaffold file manifest — maps output file paths to their .tmpl source files.
8
- * Add new templates here; the scaffold command picks them up automatically.
9
- */
10
- export interface TemplateFile {
11
- /** Relative output path inside the scaffolded project */
12
- outputPath: string;
13
- /** Relative path inside templates/files/ */
14
- templatePath: string;
15
- }
16
- export declare const TEMPLATE_MANIFEST: TemplateFile[];
17
- /**
18
- * Load all templates from disk, apply variable substitution, and return
19
- * an array of { name, content } ready to write.
20
- */
21
- export declare function loadAllTemplates(vars: Record<string, string>): Array<{
22
- name: string;
23
- content: string;
24
- }>;
25
- export declare const oauthServerJsTemplate: string;
26
- export declare const oauthHandlerTemplate: string;
27
- export declare const tokenStoreJsTemplate: string;
28
- export declare const envExampleTemplate: string;
29
- export declare const envLocalTemplate: string;
30
- export declare const gitignoreTemplate: string;
31
- export declare const packageJsonTemplate: string;
32
- export declare const appConfigTemplate: string;
33
- export declare const agentsMdTemplate: string;
34
- export declare const claudeMdTemplate: string;
35
- export declare const readmeTemplate: string;
36
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAMhF;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,YAAY,EAqB3C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAK1C;AAKD,eAAO,MAAM,qBAAqB,QAA2C,CAAC;AAC9E,eAAO,MAAM,oBAAoB,QAA4C,CAAC;AAC9E,eAAO,MAAM,oBAAoB,QAAgD,CAAC;AAClF,eAAO,MAAM,kBAAkB,QAA8C,CAAC;AAC9E,eAAO,MAAM,gBAAgB,QAA4C,CAAC;AAC1E,eAAO,MAAM,iBAAiB,QAAiC,CAAC;AAChE,eAAO,MAAM,mBAAmB,QAA8C,CAAC;AAC/E,eAAO,MAAM,iBAAiB,QAAuC,CAAC;AACtE,eAAO,MAAM,gBAAgB,QAAiC,CAAC;AAC/D,eAAO,MAAM,gBAAgB,QAAiC,CAAC;AAC/D,eAAO,MAAM,cAAc,QAAiC,CAAC"}