@quatronic/sdk 0.7.0-rc.9 → 0.7.0-test.1a5da40
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.
- package/dist/{chunk-2AYDFLKR.js → chunk-F3NHTHFO.js} +6 -104
- package/dist/chunk-F3NHTHFO.js.map +1 -0
- package/dist/chunk-P7HNHLW7.js +65 -0
- package/dist/chunk-P7HNHLW7.js.map +1 -0
- package/dist/chunk-QMOZDE3U.js +158 -0
- package/dist/chunk-QMOZDE3U.js.map +1 -0
- package/dist/chunk-TOBGX4CZ.js +109 -0
- package/dist/chunk-TOBGX4CZ.js.map +1 -0
- package/dist/chunk-WU7N4PET.js +20 -0
- package/dist/chunk-WU7N4PET.js.map +1 -0
- package/dist/cli/legacy/qdc-sourcemaps.js +16 -6
- package/dist/cli/skills-postinstall.js +133 -3
- package/dist/cli/skills.js +133 -3
- package/dist/cli/sourcemaps.js +16 -6
- package/dist/integrations/index.d.ts +3 -75
- package/dist/integrations/index.js +6 -4
- package/dist/mail/index.d.ts +9 -0
- package/dist/mail/index.js +26 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/next/auth/index.d.ts +12 -0
- package/dist/next/auth/index.js +14 -155
- package/dist/next/auth/index.js.map +1 -1
- package/dist/next/boot/index.d.ts +33 -0
- package/dist/next/boot/index.js +21 -0
- package/dist/next/boot/index.js.map +1 -0
- package/dist/next/db/index.d.ts +18 -1
- package/dist/next/db/index.js +25 -0
- package/dist/next/db/index.js.map +1 -1
- package/dist/next/global-error/index.d.ts +9 -0
- package/dist/next/global-error/index.js +17 -0
- package/dist/next/global-error/index.js.map +1 -0
- package/dist/next/integrations/index.d.ts +2 -1
- package/dist/next/integrations/index.js +6 -4
- package/dist/next/platform/index.d.ts +19 -0
- package/dist/next/platform/index.js +44 -0
- package/dist/next/platform/index.js.map +1 -0
- package/dist/next/security/index.d.ts +23 -1
- package/dist/next/security/index.js +38 -55
- package/dist/next/security/index.js.map +1 -1
- package/dist/next/sentry/register.js +5 -13
- package/dist/next/sentry/register.js.map +1 -1
- package/dist/next/users/index.js +7 -4
- package/dist/next/users/index.js.map +1 -1
- package/dist/node/boot/index.d.ts +9 -0
- package/dist/node/boot/index.js +13 -0
- package/dist/node/boot/index.js.map +1 -0
- package/dist/node/integrations/index.d.ts +2 -1
- package/dist/node/integrations/index.js +6 -4
- package/dist/node-Z7ERWJDZ.js +46 -0
- package/dist/node-Z7ERWJDZ.js.map +1 -0
- package/dist/types-CAwj03sM.d.ts +75 -0
- package/migrations/bootstrap-qore-env/codemod.mjs +77 -0
- package/migrations/bootstrap-qore-env/instructions.md +28 -0
- package/migrations/bootstrap-qore-env/meta.json +7 -0
- package/migrations/global-error/codemod.mjs +28 -0
- package/migrations/global-error/instructions.md +26 -0
- package/migrations/global-error/meta.json +7 -0
- package/migrations/local-db-port/codemod.mjs +61 -0
- package/migrations/local-db-port/instructions.md +35 -0
- package/migrations/local-db-port/meta.json +7 -0
- package/migrations/mail-reexport/codemod.mjs +64 -0
- package/migrations/mail-reexport/instructions.md +27 -0
- package/migrations/mail-reexport/meta.json +7 -0
- package/migrations/platform-routes/codemod.mjs +45 -0
- package/migrations/platform-routes/instructions.md +30 -0
- package/migrations/platform-routes/meta.json +7 -0
- package/migrations/qore-boot/codemod.mjs +261 -0
- package/migrations/qore-boot/instructions.md +74 -0
- package/migrations/qore-boot/meta.json +7 -0
- package/migrations/qore-proxy/codemod.mjs +88 -0
- package/migrations/qore-proxy/instructions.md +56 -0
- package/migrations/qore-proxy/meta.json +7 -0
- package/migrations/run.mjs +322 -0
- package/migrations/sourcemaps-finalize/codemod.mjs +63 -0
- package/migrations/sourcemaps-finalize/instructions.md +56 -0
- package/migrations/sourcemaps-finalize/meta.json +7 -0
- package/package.json +26 -4
- package/skills/qore-enable-auth-method/SKILL.md +4 -3
- package/skills/qore-use-mail-domain/SKILL.next.md +4 -4
- package/workspace-requirements.json +4 -0
- package/dist/chunk-2AYDFLKR.js.map +0 -1
|
@@ -23,13 +23,14 @@ var BUNDLE = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
|
23
23
|
var SCRIPT = /\.(js|mjs|cjs)$/;
|
|
24
24
|
var MAPPING_URL = /^\/\/# sourceMappingURL=(\S+)[ \t]*$/gm;
|
|
25
25
|
var STANDALONE_SERVER = "standalone/.next/server/";
|
|
26
|
+
var isCommand = (cmd) => cmd === "upload" || cmd === "finalize";
|
|
26
27
|
function parseArgs(argv) {
|
|
27
28
|
const [cmd, dir, ...rest] = argv;
|
|
28
|
-
if (cmd
|
|
29
|
+
if (!isCommand(cmd) || !dir) return { error: "usage: qore-sourcemaps upload|finalize <dir> [--bundle <name>]" };
|
|
29
30
|
let bundle = "app";
|
|
30
31
|
if (rest[0] === "--bundle") bundle = rest[1] ?? "";
|
|
31
32
|
if (!BUNDLE.test(bundle)) return { error: `invalid bundle name: ${bundle}` };
|
|
32
|
-
return { dir, bundle };
|
|
33
|
+
return { cmd, dir, bundle };
|
|
33
34
|
}
|
|
34
35
|
function nextRoots(has) {
|
|
35
36
|
if (!has("BUILD_ID") || !has("server")) return null;
|
|
@@ -122,11 +123,11 @@ async function runCommand(cmd, args) {
|
|
|
122
123
|
env: { ...process.env, COPYFILE_DISABLE: "1" }
|
|
123
124
|
});
|
|
124
125
|
}
|
|
125
|
-
function walkDir(dir, prefix = "") {
|
|
126
|
+
function walkDir(dir, prefix = "", modules = false) {
|
|
126
127
|
const out = [];
|
|
127
128
|
for (const d of readdirSync(join(dir, prefix), { withFileTypes: true })) {
|
|
128
129
|
const rel = prefix ? `${prefix}/${d.name}` : d.name;
|
|
129
|
-
if (d.isDirectory() && d.name !== "node_modules") out.push(...walkDir(dir, rel));
|
|
130
|
+
if (d.isDirectory() && (modules || d.name !== "node_modules")) out.push(...walkDir(dir, rel, modules));
|
|
130
131
|
else if (d.isFile()) out.push(rel);
|
|
131
132
|
}
|
|
132
133
|
return out;
|
|
@@ -134,6 +135,7 @@ function walkDir(dir, prefix = "") {
|
|
|
134
135
|
var defaultIo = () => ({
|
|
135
136
|
env: process.env,
|
|
136
137
|
walk: (dir) => walkDir(dir),
|
|
138
|
+
walkAll: (dir) => walkDir(dir, "", true),
|
|
137
139
|
exists: existsSync,
|
|
138
140
|
readText: (p) => readFileSync(p, "utf8"),
|
|
139
141
|
writeText: (p, t) => writeFileSync(p, t),
|
|
@@ -154,11 +156,18 @@ function tryRemove(io, path) {
|
|
|
154
156
|
} catch {
|
|
155
157
|
}
|
|
156
158
|
}
|
|
159
|
+
function removeAllMaps(io, dir) {
|
|
160
|
+
try {
|
|
161
|
+
for (const p of io.walkAll(dir)) if (p.endsWith(".map")) tryRemove(io, join(dir, p));
|
|
162
|
+
} catch (err) {
|
|
163
|
+
console.warn(`qore-sourcemaps: cleanup skipped: ${describe(err, io.env.QORE_BUILD_UPLOAD_TOKEN)}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
157
166
|
async function main(argv = process.argv.slice(2), io = defaultIo()) {
|
|
158
167
|
const args = parseArgs(argv);
|
|
159
168
|
if ("error" in args) {
|
|
160
169
|
console.warn(`qore-sourcemaps: ${args.error}`);
|
|
161
|
-
const dir2 = argv[0]
|
|
170
|
+
const dir2 = isCommand(argv[0]) ? argv[1] : void 0;
|
|
162
171
|
if (dir2 && !dir2.startsWith("-")) {
|
|
163
172
|
try {
|
|
164
173
|
for (const m of listMaps(io.walk(dir2))) tryRemove(io, join(dir2, m));
|
|
@@ -168,7 +177,7 @@ async function main(argv = process.argv.slice(2), io = defaultIo()) {
|
|
|
168
177
|
}
|
|
169
178
|
return;
|
|
170
179
|
}
|
|
171
|
-
const { dir, bundle } = args;
|
|
180
|
+
const { cmd, dir, bundle } = args;
|
|
172
181
|
const at = (rel) => join(dir, rel);
|
|
173
182
|
let maps = [];
|
|
174
183
|
const scratch = [];
|
|
@@ -222,6 +231,7 @@ async function main(argv = process.argv.slice(2), io = defaultIo()) {
|
|
|
222
231
|
} finally {
|
|
223
232
|
for (const m of maps) tryRemove(io, at(m));
|
|
224
233
|
for (const s of scratch) tryRemove(io, s);
|
|
234
|
+
if (cmd === "finalize") removeAllMaps(io, dir);
|
|
225
235
|
}
|
|
226
236
|
}
|
|
227
237
|
function isMainModule() {
|
|
@@ -172,6 +172,103 @@ off the SDK's lint rules that check the same things.
|
|
|
172
172
|
The \`qore-\` prefix is reserved for managed skills. Sync never touches a skill
|
|
173
173
|
it does not ship, so your own skills are safe under any other name.
|
|
174
174
|
`;
|
|
175
|
+
var APP_README_PATH = "README.md";
|
|
176
|
+
function isLegacyAppReadme(text) {
|
|
177
|
+
const flat = text.replace(/\s+/g, " ");
|
|
178
|
+
return flat.includes("frozen at generation time") && flat.includes("The `quatronic-` prefix is reserved");
|
|
179
|
+
}
|
|
180
|
+
var APP_README_HEAD = `# Claude Code setup for this app
|
|
181
|
+
|
|
182
|
+
This app ships with a Qore Claude Code setup, committed into this repo. The
|
|
183
|
+
\`qore-*\` skills are managed by the SDK; everything else here is yours.
|
|
184
|
+
`;
|
|
185
|
+
var APP_README_CONVENTIONS = `## Conventions
|
|
186
|
+
|
|
187
|
+
- The \`qore-*\` skills are managed by \`@quatronic/sdk\` and stay current with it:
|
|
188
|
+
every SDK upgrade PR re-syncs them. How to turn one off, extend it with your
|
|
189
|
+
own conventions, replace it or keep your own copy is in
|
|
190
|
+
\`qore/README.md\`; editing a managed skill in place does not stick.
|
|
191
|
+
- The \`qore-\` prefix is reserved for managed skills. Name your own skills
|
|
192
|
+
without it (e.g. \`.claude/skills/export-report/SKILL.md\`); sync never touches
|
|
193
|
+
them.
|
|
194
|
+
- \`settings.json\` is yours: it was generated once and nothing re-syncs it.
|
|
195
|
+
`;
|
|
196
|
+
function appReadme(runtime) {
|
|
197
|
+
if (runtime === "next") {
|
|
198
|
+
return `${APP_README_HEAD}
|
|
199
|
+
> New here? Run \`/qore-recommended-tools\` for optional, public skills and
|
|
200
|
+
> plugins (like \`superpowers\` and \`frontend-design\`) that pair well with this app.
|
|
201
|
+
|
|
202
|
+
## What's here
|
|
203
|
+
|
|
204
|
+
- \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
|
|
205
|
+
written (\`.env.example\` stays readable), destructive git is blocked, and \`git push\` plus edits to the auth/SDK
|
|
206
|
+
boundary files ask for confirmation.
|
|
207
|
+
- \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
|
|
208
|
+
\`qore/skills.md\` (imported into \`CLAUDE.md\`). Highlights:
|
|
209
|
+
\`/qore-ship-checklist\` (the quality gate to run before every PR),
|
|
210
|
+
\`/qore-author-skill\` to write your own, and \`/qore-recommended-tools\` for
|
|
211
|
+
optional public skills/plugins.
|
|
212
|
+
- \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
|
|
213
|
+
\`skills.md\` (the index) and \`manifest.json\` (what sync manages).
|
|
214
|
+
- \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
|
|
215
|
+
pipeline, which runs lint, format-check, typecheck, unit tests,
|
|
216
|
+
integration tests and build on every pull request and on every push to
|
|
217
|
+
\`main\`. Each of those is one of *your* \`package.json\` scripts, so change
|
|
218
|
+
what a check does by changing the script. Add your own jobs to the
|
|
219
|
+
\`verify\` job's \`needs:\` list; leave the shared call alone, as edits to it
|
|
220
|
+
are replaced when the pipeline is upgraded.
|
|
221
|
+
|
|
222
|
+
${APP_README_CONVENTIONS}`;
|
|
223
|
+
}
|
|
224
|
+
return `${APP_README_HEAD}
|
|
225
|
+
## What's here
|
|
226
|
+
|
|
227
|
+
- \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
|
|
228
|
+
written, destructive git is blocked, and \`git push\` asks for confirmation.
|
|
229
|
+
- \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
|
|
230
|
+
\`qore/skills.md\` (imported into \`CLAUDE.md\`).
|
|
231
|
+
- \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
|
|
232
|
+
\`skills.md\` (the index) and \`manifest.json\` (what sync manages).
|
|
233
|
+
- \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
|
|
234
|
+
pipeline, which runs typecheck, unit tests and build on every pull request
|
|
235
|
+
and on every push to \`main\`. Each of those is one of *your*
|
|
236
|
+
\`package.json\` scripts, so change what a check does by changing the
|
|
237
|
+
script; adding a \`lint\` script is not enough on its own, since the call
|
|
238
|
+
also has to ask for that check. Add your own jobs to the \`verify\` job's
|
|
239
|
+
\`needs:\` list; leave the shared call alone, as edits to it are replaced
|
|
240
|
+
when the pipeline is upgraded.
|
|
241
|
+
|
|
242
|
+
${APP_README_CONVENTIONS}`;
|
|
243
|
+
}
|
|
244
|
+
var TABLE_ROW = /^\s*\|(.*)\|\s*$/;
|
|
245
|
+
var TABLE_RULE = /^\s*\|[\s:|-]+\|\s*$/;
|
|
246
|
+
var firstCell = (line) => TABLE_ROW.exec(line)?.[1].split("|")[0].trim();
|
|
247
|
+
function replaceSkillsTable(md, names) {
|
|
248
|
+
const eol = md.includes("\r\n") ? "\r\n" : "\n";
|
|
249
|
+
const lines = md.split(/\r?\n/);
|
|
250
|
+
for (let i = 0; i + 2 < lines.length; i++) {
|
|
251
|
+
if (!/^skill$/i.test(firstCell(lines[i]) ?? "") || !TABLE_RULE.test(lines[i + 1])) continue;
|
|
252
|
+
let end = i + 2;
|
|
253
|
+
while (end < lines.length && firstCell(lines[end]) !== void 0) end++;
|
|
254
|
+
const rows = lines.slice(i + 2, end);
|
|
255
|
+
const managed = rows.length > 0 && rows.every((r) => {
|
|
256
|
+
const name = /^`\/?([a-z0-9-]+)`$/.exec(firstCell(r))?.[1];
|
|
257
|
+
return name !== void 0 && names.has(name);
|
|
258
|
+
});
|
|
259
|
+
if (!managed) continue;
|
|
260
|
+
const out = [];
|
|
261
|
+
lines.forEach((line, j) => {
|
|
262
|
+
if (j === i) out.push(CLAUDE_MD_IMPORT);
|
|
263
|
+
else if (j > i && j < end) return;
|
|
264
|
+
else if (line.trim() === CLAUDE_MD_IMPORT) {
|
|
265
|
+
if (out.at(-1)?.trim() === "") out.pop();
|
|
266
|
+
} else out.push(line);
|
|
267
|
+
});
|
|
268
|
+
return out.join(eol);
|
|
269
|
+
}
|
|
270
|
+
return void 0;
|
|
271
|
+
}
|
|
175
272
|
function buildTree(catalog, sources, f) {
|
|
176
273
|
const skills = renderSkills(catalog, sources, f);
|
|
177
274
|
for (const entry of catalog.skills) {
|
|
@@ -246,6 +343,7 @@ function planSync(s) {
|
|
|
246
343
|
let claudeMd = s.claudeMd;
|
|
247
344
|
const claudeMdRenamed = [];
|
|
248
345
|
let claudeMdImportAdded = false;
|
|
346
|
+
let claudeMdTableReplaced = false;
|
|
249
347
|
if (claudeMd !== void 0) {
|
|
250
348
|
for (const entry of s.catalog.skills) {
|
|
251
349
|
for (const legacy of entry.legacyNames ?? []) {
|
|
@@ -255,6 +353,11 @@ function planSync(s) {
|
|
|
255
353
|
claudeMdRenamed.push([legacy, entry.name]);
|
|
256
354
|
}
|
|
257
355
|
}
|
|
356
|
+
const withoutTable = replaceSkillsTable(claudeMd, new Set(s.catalog.skills.map((e) => e.name)));
|
|
357
|
+
if (withoutTable !== void 0) {
|
|
358
|
+
claudeMd = withoutTable;
|
|
359
|
+
claudeMdTableReplaced = true;
|
|
360
|
+
}
|
|
258
361
|
if (!claudeMd.split(/\r?\n/).some((l) => l.trim() === CLAUDE_MD_IMPORT)) {
|
|
259
362
|
claudeMd = `${claudeMd.replace(/\s*$/, "")}
|
|
260
363
|
|
|
@@ -263,6 +366,9 @@ ${CLAUDE_MD_IMPORT}
|
|
|
263
366
|
claudeMdImportAdded = true;
|
|
264
367
|
}
|
|
265
368
|
}
|
|
369
|
+
const currentReadme = s.read(APP_README_PATH);
|
|
370
|
+
const appReadmeReplaced = currentReadme !== void 0 && isLegacyAppReadme(currentReadme);
|
|
371
|
+
if (appReadmeReplaced) writes.set(APP_README_PATH, appReadme(s.features.runtime));
|
|
266
372
|
const manifest = {
|
|
267
373
|
schemaVersion: 1,
|
|
268
374
|
sdkVersion: s.sdkVersion,
|
|
@@ -271,6 +377,10 @@ ${CLAUDE_MD_IMPORT}
|
|
|
271
377
|
detached: [...detached].sort(),
|
|
272
378
|
files: Object.fromEntries([...tree].map(([rel, c]) => [rel, hashContent(c)]))
|
|
273
379
|
};
|
|
380
|
+
const skillsIn = (rels) => new Set([...rels].map(skillOf).filter((n) => n !== void 0 && !detached.has(n)));
|
|
381
|
+
const before = skillsIn(Object.keys(known));
|
|
382
|
+
const after = skillsIn(tree.keys());
|
|
383
|
+
const touched = skillsIn([...writes.keys(), ...deletes]);
|
|
274
384
|
const manifestText = renderManifest(manifest);
|
|
275
385
|
if (s.read(MANIFEST_PATH) === void 0 || normalise(s.read(MANIFEST_PATH)) !== manifestText) {
|
|
276
386
|
writes.set(MANIFEST_PATH, manifestText);
|
|
@@ -281,10 +391,15 @@ ${CLAUDE_MD_IMPORT}
|
|
|
281
391
|
edited: edited.sort(),
|
|
282
392
|
adopted: adopted.sort(),
|
|
283
393
|
legacyRemoved: legacyRemoved.sort(),
|
|
394
|
+
skillsAdded: [...after].filter((n) => !before.has(n)).sort(),
|
|
395
|
+
skillsUpdated: [...after].filter((n) => before.has(n) && touched.has(n)).sort(),
|
|
396
|
+
skillsRemoved: [...before].filter((n) => !after.has(n)).sort(),
|
|
284
397
|
manifest,
|
|
285
398
|
claudeMd: claudeMd === s.claudeMd ? void 0 : claudeMd,
|
|
286
399
|
claudeMdRenamed: claudeMdRenamed.sort(([a], [b]) => a.localeCompare(b)),
|
|
287
|
-
claudeMdImportAdded
|
|
400
|
+
claudeMdImportAdded,
|
|
401
|
+
claudeMdTableReplaced,
|
|
402
|
+
appReadmeReplaced
|
|
288
403
|
};
|
|
289
404
|
}
|
|
290
405
|
function planChanges(p) {
|
|
@@ -295,12 +410,18 @@ function renderReport(p, opts) {
|
|
|
295
410
|
const lines = [
|
|
296
411
|
"### Qore skills",
|
|
297
412
|
"",
|
|
298
|
-
`Synced the managed skills for \`@quatronic/sdk@${p.manifest.sdkVersion}\` (runtime \`${f.runtime}\`, auth \`${f.auth}\`, database \`${f.db ? "yes" : "no"}\`${opts.inferred ? ", inferred from the app \u2014 pin with `qore-skills sync --features`" : ", pinned in the manifest"}).`
|
|
413
|
+
`${opts.check ? "Out of date: `qore-skills sync` would update" : "Synced"} the managed skills for \`@quatronic/sdk@${p.manifest.sdkVersion}\` (runtime \`${f.runtime}\`, auth \`${f.auth}\`, database \`${f.db ? "yes" : "no"}\`${opts.inferred ? ", inferred from the app \u2014 pin with `qore-skills sync --features`" : ", pinned in the manifest"}).`
|
|
299
414
|
];
|
|
300
415
|
const managedWrites = [...p.writes.keys()].filter((r) => r !== MANIFEST_PATH);
|
|
301
416
|
if (!managedWrites.length && !p.deletes.length && p.claudeMd === void 0) {
|
|
302
417
|
lines.push("", "No skill content changed.");
|
|
303
418
|
}
|
|
419
|
+
const skills = (title, names) => {
|
|
420
|
+
if (names.length) lines.push("", `**${title}:** ${names.map((n) => `\`${n}\``).join(", ")}`);
|
|
421
|
+
};
|
|
422
|
+
skills("Skills added", p.skillsAdded);
|
|
423
|
+
skills("Skills updated", p.skillsUpdated);
|
|
424
|
+
skills("Skills removed", p.skillsRemoved);
|
|
304
425
|
const section = (title, items, note) => {
|
|
305
426
|
if (!items.length) return;
|
|
306
427
|
lines.push("", `**${title}** ${note}`, "", ...items.map((i) => `- \`.claude/${i}\``));
|
|
@@ -316,9 +437,18 @@ function renderReport(p, opts) {
|
|
|
316
437
|
p.legacyRemoved,
|
|
317
438
|
"(replaced by their `qore-*` names; a local edit to one is in this change's diff):"
|
|
318
439
|
);
|
|
440
|
+
if (p.appReadmeReplaced) {
|
|
441
|
+
lines.push(
|
|
442
|
+
"",
|
|
443
|
+
"**`.claude/README.md`** replaced: the generator's text said this setup is frozen and yours to edit, which the managed skills no longer are. A change of your own to it is in this change's diff."
|
|
444
|
+
);
|
|
445
|
+
}
|
|
319
446
|
if (p.claudeMd !== void 0) {
|
|
320
447
|
lines.push("", "**`CLAUDE.md`:**", "");
|
|
321
448
|
for (const [from, to] of p.claudeMdRenamed) lines.push(`- Renamed \`${from}\` to \`${to}\`.`);
|
|
449
|
+
if (p.claudeMdTableReplaced) {
|
|
450
|
+
lines.push(`- Replaced the generated skills table with \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
|
|
451
|
+
}
|
|
322
452
|
if (p.claudeMdImportAdded) lines.push(`- Imports \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
|
|
323
453
|
}
|
|
324
454
|
return `${lines.join("\n")}
|
|
@@ -454,7 +584,7 @@ function main(argv = process.argv.slice(2)) {
|
|
|
454
584
|
return 0;
|
|
455
585
|
}
|
|
456
586
|
const { plan: p, inferred } = plan(args.cwd, args.features);
|
|
457
|
-
const report = renderReport(p, { inferred });
|
|
587
|
+
const report = renderReport(p, { inferred, check: args.cmd === "check" });
|
|
458
588
|
if (args.cmd === "check") {
|
|
459
589
|
const changed = planChanges(p);
|
|
460
590
|
if (args.json) {
|
package/dist/cli/skills.js
CHANGED
|
@@ -171,6 +171,103 @@ off the SDK's lint rules that check the same things.
|
|
|
171
171
|
The \`qore-\` prefix is reserved for managed skills. Sync never touches a skill
|
|
172
172
|
it does not ship, so your own skills are safe under any other name.
|
|
173
173
|
`;
|
|
174
|
+
var APP_README_PATH = "README.md";
|
|
175
|
+
function isLegacyAppReadme(text) {
|
|
176
|
+
const flat = text.replace(/\s+/g, " ");
|
|
177
|
+
return flat.includes("frozen at generation time") && flat.includes("The `quatronic-` prefix is reserved");
|
|
178
|
+
}
|
|
179
|
+
var APP_README_HEAD = `# Claude Code setup for this app
|
|
180
|
+
|
|
181
|
+
This app ships with a Qore Claude Code setup, committed into this repo. The
|
|
182
|
+
\`qore-*\` skills are managed by the SDK; everything else here is yours.
|
|
183
|
+
`;
|
|
184
|
+
var APP_README_CONVENTIONS = `## Conventions
|
|
185
|
+
|
|
186
|
+
- The \`qore-*\` skills are managed by \`@quatronic/sdk\` and stay current with it:
|
|
187
|
+
every SDK upgrade PR re-syncs them. How to turn one off, extend it with your
|
|
188
|
+
own conventions, replace it or keep your own copy is in
|
|
189
|
+
\`qore/README.md\`; editing a managed skill in place does not stick.
|
|
190
|
+
- The \`qore-\` prefix is reserved for managed skills. Name your own skills
|
|
191
|
+
without it (e.g. \`.claude/skills/export-report/SKILL.md\`); sync never touches
|
|
192
|
+
them.
|
|
193
|
+
- \`settings.json\` is yours: it was generated once and nothing re-syncs it.
|
|
194
|
+
`;
|
|
195
|
+
function appReadme(runtime) {
|
|
196
|
+
if (runtime === "next") {
|
|
197
|
+
return `${APP_README_HEAD}
|
|
198
|
+
> New here? Run \`/qore-recommended-tools\` for optional, public skills and
|
|
199
|
+
> plugins (like \`superpowers\` and \`frontend-design\`) that pair well with this app.
|
|
200
|
+
|
|
201
|
+
## What's here
|
|
202
|
+
|
|
203
|
+
- \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
|
|
204
|
+
written (\`.env.example\` stays readable), destructive git is blocked, and \`git push\` plus edits to the auth/SDK
|
|
205
|
+
boundary files ask for confirmation.
|
|
206
|
+
- \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
|
|
207
|
+
\`qore/skills.md\` (imported into \`CLAUDE.md\`). Highlights:
|
|
208
|
+
\`/qore-ship-checklist\` (the quality gate to run before every PR),
|
|
209
|
+
\`/qore-author-skill\` to write your own, and \`/qore-recommended-tools\` for
|
|
210
|
+
optional public skills/plugins.
|
|
211
|
+
- \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
|
|
212
|
+
\`skills.md\` (the index) and \`manifest.json\` (what sync manages).
|
|
213
|
+
- \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
|
|
214
|
+
pipeline, which runs lint, format-check, typecheck, unit tests,
|
|
215
|
+
integration tests and build on every pull request and on every push to
|
|
216
|
+
\`main\`. Each of those is one of *your* \`package.json\` scripts, so change
|
|
217
|
+
what a check does by changing the script. Add your own jobs to the
|
|
218
|
+
\`verify\` job's \`needs:\` list; leave the shared call alone, as edits to it
|
|
219
|
+
are replaced when the pipeline is upgraded.
|
|
220
|
+
|
|
221
|
+
${APP_README_CONVENTIONS}`;
|
|
222
|
+
}
|
|
223
|
+
return `${APP_README_HEAD}
|
|
224
|
+
## What's here
|
|
225
|
+
|
|
226
|
+
- \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
|
|
227
|
+
written, destructive git is blocked, and \`git push\` asks for confirmation.
|
|
228
|
+
- \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
|
|
229
|
+
\`qore/skills.md\` (imported into \`CLAUDE.md\`).
|
|
230
|
+
- \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
|
|
231
|
+
\`skills.md\` (the index) and \`manifest.json\` (what sync manages).
|
|
232
|
+
- \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
|
|
233
|
+
pipeline, which runs typecheck, unit tests and build on every pull request
|
|
234
|
+
and on every push to \`main\`. Each of those is one of *your*
|
|
235
|
+
\`package.json\` scripts, so change what a check does by changing the
|
|
236
|
+
script; adding a \`lint\` script is not enough on its own, since the call
|
|
237
|
+
also has to ask for that check. Add your own jobs to the \`verify\` job's
|
|
238
|
+
\`needs:\` list; leave the shared call alone, as edits to it are replaced
|
|
239
|
+
when the pipeline is upgraded.
|
|
240
|
+
|
|
241
|
+
${APP_README_CONVENTIONS}`;
|
|
242
|
+
}
|
|
243
|
+
var TABLE_ROW = /^\s*\|(.*)\|\s*$/;
|
|
244
|
+
var TABLE_RULE = /^\s*\|[\s:|-]+\|\s*$/;
|
|
245
|
+
var firstCell = (line) => TABLE_ROW.exec(line)?.[1].split("|")[0].trim();
|
|
246
|
+
function replaceSkillsTable(md, names) {
|
|
247
|
+
const eol = md.includes("\r\n") ? "\r\n" : "\n";
|
|
248
|
+
const lines = md.split(/\r?\n/);
|
|
249
|
+
for (let i = 0; i + 2 < lines.length; i++) {
|
|
250
|
+
if (!/^skill$/i.test(firstCell(lines[i]) ?? "") || !TABLE_RULE.test(lines[i + 1])) continue;
|
|
251
|
+
let end = i + 2;
|
|
252
|
+
while (end < lines.length && firstCell(lines[end]) !== void 0) end++;
|
|
253
|
+
const rows = lines.slice(i + 2, end);
|
|
254
|
+
const managed = rows.length > 0 && rows.every((r) => {
|
|
255
|
+
const name = /^`\/?([a-z0-9-]+)`$/.exec(firstCell(r))?.[1];
|
|
256
|
+
return name !== void 0 && names.has(name);
|
|
257
|
+
});
|
|
258
|
+
if (!managed) continue;
|
|
259
|
+
const out = [];
|
|
260
|
+
lines.forEach((line, j) => {
|
|
261
|
+
if (j === i) out.push(CLAUDE_MD_IMPORT);
|
|
262
|
+
else if (j > i && j < end) return;
|
|
263
|
+
else if (line.trim() === CLAUDE_MD_IMPORT) {
|
|
264
|
+
if (out.at(-1)?.trim() === "") out.pop();
|
|
265
|
+
} else out.push(line);
|
|
266
|
+
});
|
|
267
|
+
return out.join(eol);
|
|
268
|
+
}
|
|
269
|
+
return void 0;
|
|
270
|
+
}
|
|
174
271
|
function buildTree(catalog, sources, f) {
|
|
175
272
|
const skills = renderSkills(catalog, sources, f);
|
|
176
273
|
for (const entry of catalog.skills) {
|
|
@@ -245,6 +342,7 @@ function planSync(s) {
|
|
|
245
342
|
let claudeMd = s.claudeMd;
|
|
246
343
|
const claudeMdRenamed = [];
|
|
247
344
|
let claudeMdImportAdded = false;
|
|
345
|
+
let claudeMdTableReplaced = false;
|
|
248
346
|
if (claudeMd !== void 0) {
|
|
249
347
|
for (const entry of s.catalog.skills) {
|
|
250
348
|
for (const legacy of entry.legacyNames ?? []) {
|
|
@@ -254,6 +352,11 @@ function planSync(s) {
|
|
|
254
352
|
claudeMdRenamed.push([legacy, entry.name]);
|
|
255
353
|
}
|
|
256
354
|
}
|
|
355
|
+
const withoutTable = replaceSkillsTable(claudeMd, new Set(s.catalog.skills.map((e) => e.name)));
|
|
356
|
+
if (withoutTable !== void 0) {
|
|
357
|
+
claudeMd = withoutTable;
|
|
358
|
+
claudeMdTableReplaced = true;
|
|
359
|
+
}
|
|
257
360
|
if (!claudeMd.split(/\r?\n/).some((l) => l.trim() === CLAUDE_MD_IMPORT)) {
|
|
258
361
|
claudeMd = `${claudeMd.replace(/\s*$/, "")}
|
|
259
362
|
|
|
@@ -262,6 +365,9 @@ ${CLAUDE_MD_IMPORT}
|
|
|
262
365
|
claudeMdImportAdded = true;
|
|
263
366
|
}
|
|
264
367
|
}
|
|
368
|
+
const currentReadme = s.read(APP_README_PATH);
|
|
369
|
+
const appReadmeReplaced = currentReadme !== void 0 && isLegacyAppReadme(currentReadme);
|
|
370
|
+
if (appReadmeReplaced) writes.set(APP_README_PATH, appReadme(s.features.runtime));
|
|
265
371
|
const manifest = {
|
|
266
372
|
schemaVersion: 1,
|
|
267
373
|
sdkVersion: s.sdkVersion,
|
|
@@ -270,6 +376,10 @@ ${CLAUDE_MD_IMPORT}
|
|
|
270
376
|
detached: [...detached].sort(),
|
|
271
377
|
files: Object.fromEntries([...tree].map(([rel, c]) => [rel, hashContent(c)]))
|
|
272
378
|
};
|
|
379
|
+
const skillsIn = (rels) => new Set([...rels].map(skillOf).filter((n) => n !== void 0 && !detached.has(n)));
|
|
380
|
+
const before = skillsIn(Object.keys(known));
|
|
381
|
+
const after = skillsIn(tree.keys());
|
|
382
|
+
const touched = skillsIn([...writes.keys(), ...deletes]);
|
|
273
383
|
const manifestText = renderManifest(manifest);
|
|
274
384
|
if (s.read(MANIFEST_PATH) === void 0 || normalise(s.read(MANIFEST_PATH)) !== manifestText) {
|
|
275
385
|
writes.set(MANIFEST_PATH, manifestText);
|
|
@@ -280,10 +390,15 @@ ${CLAUDE_MD_IMPORT}
|
|
|
280
390
|
edited: edited.sort(),
|
|
281
391
|
adopted: adopted.sort(),
|
|
282
392
|
legacyRemoved: legacyRemoved.sort(),
|
|
393
|
+
skillsAdded: [...after].filter((n) => !before.has(n)).sort(),
|
|
394
|
+
skillsUpdated: [...after].filter((n) => before.has(n) && touched.has(n)).sort(),
|
|
395
|
+
skillsRemoved: [...before].filter((n) => !after.has(n)).sort(),
|
|
283
396
|
manifest,
|
|
284
397
|
claudeMd: claudeMd === s.claudeMd ? void 0 : claudeMd,
|
|
285
398
|
claudeMdRenamed: claudeMdRenamed.sort(([a], [b]) => a.localeCompare(b)),
|
|
286
|
-
claudeMdImportAdded
|
|
399
|
+
claudeMdImportAdded,
|
|
400
|
+
claudeMdTableReplaced,
|
|
401
|
+
appReadmeReplaced
|
|
287
402
|
};
|
|
288
403
|
}
|
|
289
404
|
function planChanges(p) {
|
|
@@ -294,12 +409,18 @@ function renderReport(p, opts) {
|
|
|
294
409
|
const lines = [
|
|
295
410
|
"### Qore skills",
|
|
296
411
|
"",
|
|
297
|
-
`Synced the managed skills for \`@quatronic/sdk@${p.manifest.sdkVersion}\` (runtime \`${f.runtime}\`, auth \`${f.auth}\`, database \`${f.db ? "yes" : "no"}\`${opts.inferred ? ", inferred from the app \u2014 pin with `qore-skills sync --features`" : ", pinned in the manifest"}).`
|
|
412
|
+
`${opts.check ? "Out of date: `qore-skills sync` would update" : "Synced"} the managed skills for \`@quatronic/sdk@${p.manifest.sdkVersion}\` (runtime \`${f.runtime}\`, auth \`${f.auth}\`, database \`${f.db ? "yes" : "no"}\`${opts.inferred ? ", inferred from the app \u2014 pin with `qore-skills sync --features`" : ", pinned in the manifest"}).`
|
|
298
413
|
];
|
|
299
414
|
const managedWrites = [...p.writes.keys()].filter((r) => r !== MANIFEST_PATH);
|
|
300
415
|
if (!managedWrites.length && !p.deletes.length && p.claudeMd === void 0) {
|
|
301
416
|
lines.push("", "No skill content changed.");
|
|
302
417
|
}
|
|
418
|
+
const skills = (title, names) => {
|
|
419
|
+
if (names.length) lines.push("", `**${title}:** ${names.map((n) => `\`${n}\``).join(", ")}`);
|
|
420
|
+
};
|
|
421
|
+
skills("Skills added", p.skillsAdded);
|
|
422
|
+
skills("Skills updated", p.skillsUpdated);
|
|
423
|
+
skills("Skills removed", p.skillsRemoved);
|
|
303
424
|
const section = (title, items, note) => {
|
|
304
425
|
if (!items.length) return;
|
|
305
426
|
lines.push("", `**${title}** ${note}`, "", ...items.map((i) => `- \`.claude/${i}\``));
|
|
@@ -315,9 +436,18 @@ function renderReport(p, opts) {
|
|
|
315
436
|
p.legacyRemoved,
|
|
316
437
|
"(replaced by their `qore-*` names; a local edit to one is in this change's diff):"
|
|
317
438
|
);
|
|
439
|
+
if (p.appReadmeReplaced) {
|
|
440
|
+
lines.push(
|
|
441
|
+
"",
|
|
442
|
+
"**`.claude/README.md`** replaced: the generator's text said this setup is frozen and yours to edit, which the managed skills no longer are. A change of your own to it is in this change's diff."
|
|
443
|
+
);
|
|
444
|
+
}
|
|
318
445
|
if (p.claudeMd !== void 0) {
|
|
319
446
|
lines.push("", "**`CLAUDE.md`:**", "");
|
|
320
447
|
for (const [from, to] of p.claudeMdRenamed) lines.push(`- Renamed \`${from}\` to \`${to}\`.`);
|
|
448
|
+
if (p.claudeMdTableReplaced) {
|
|
449
|
+
lines.push(`- Replaced the generated skills table with \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
|
|
450
|
+
}
|
|
321
451
|
if (p.claudeMdImportAdded) lines.push(`- Imports \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
|
|
322
452
|
}
|
|
323
453
|
return `${lines.join("\n")}
|
|
@@ -450,7 +580,7 @@ function main(argv = process.argv.slice(2)) {
|
|
|
450
580
|
return 0;
|
|
451
581
|
}
|
|
452
582
|
const { plan: p, inferred } = plan(args.cwd, args.features);
|
|
453
|
-
const report = renderReport(p, { inferred });
|
|
583
|
+
const report = renderReport(p, { inferred, check: args.cmd === "check" });
|
|
454
584
|
if (args.cmd === "check") {
|
|
455
585
|
const changed = planChanges(p);
|
|
456
586
|
if (args.json) {
|
package/dist/cli/sourcemaps.js
CHANGED
|
@@ -15,13 +15,14 @@ var BUNDLE = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
|
15
15
|
var SCRIPT = /\.(js|mjs|cjs)$/;
|
|
16
16
|
var MAPPING_URL = /^\/\/# sourceMappingURL=(\S+)[ \t]*$/gm;
|
|
17
17
|
var STANDALONE_SERVER = "standalone/.next/server/";
|
|
18
|
+
var isCommand = (cmd) => cmd === "upload" || cmd === "finalize";
|
|
18
19
|
function parseArgs(argv) {
|
|
19
20
|
const [cmd, dir, ...rest] = argv;
|
|
20
|
-
if (cmd
|
|
21
|
+
if (!isCommand(cmd) || !dir) return { error: "usage: qore-sourcemaps upload|finalize <dir> [--bundle <name>]" };
|
|
21
22
|
let bundle = "app";
|
|
22
23
|
if (rest[0] === "--bundle") bundle = rest[1] ?? "";
|
|
23
24
|
if (!BUNDLE.test(bundle)) return { error: `invalid bundle name: ${bundle}` };
|
|
24
|
-
return { dir, bundle };
|
|
25
|
+
return { cmd, dir, bundle };
|
|
25
26
|
}
|
|
26
27
|
function nextRoots(has) {
|
|
27
28
|
if (!has("BUILD_ID") || !has("server")) return null;
|
|
@@ -114,11 +115,11 @@ async function runCommand(cmd, args) {
|
|
|
114
115
|
env: { ...process.env, COPYFILE_DISABLE: "1" }
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
|
-
function walkDir(dir, prefix = "") {
|
|
118
|
+
function walkDir(dir, prefix = "", modules = false) {
|
|
118
119
|
const out = [];
|
|
119
120
|
for (const d of readdirSync(join(dir, prefix), { withFileTypes: true })) {
|
|
120
121
|
const rel = prefix ? `${prefix}/${d.name}` : d.name;
|
|
121
|
-
if (d.isDirectory() && d.name !== "node_modules") out.push(...walkDir(dir, rel));
|
|
122
|
+
if (d.isDirectory() && (modules || d.name !== "node_modules")) out.push(...walkDir(dir, rel, modules));
|
|
122
123
|
else if (d.isFile()) out.push(rel);
|
|
123
124
|
}
|
|
124
125
|
return out;
|
|
@@ -126,6 +127,7 @@ function walkDir(dir, prefix = "") {
|
|
|
126
127
|
var defaultIo = () => ({
|
|
127
128
|
env: process.env,
|
|
128
129
|
walk: (dir) => walkDir(dir),
|
|
130
|
+
walkAll: (dir) => walkDir(dir, "", true),
|
|
129
131
|
exists: existsSync,
|
|
130
132
|
readText: (p) => readFileSync(p, "utf8"),
|
|
131
133
|
writeText: (p, t) => writeFileSync(p, t),
|
|
@@ -146,11 +148,18 @@ function tryRemove(io, path) {
|
|
|
146
148
|
} catch {
|
|
147
149
|
}
|
|
148
150
|
}
|
|
151
|
+
function removeAllMaps(io, dir) {
|
|
152
|
+
try {
|
|
153
|
+
for (const p of io.walkAll(dir)) if (p.endsWith(".map")) tryRemove(io, join(dir, p));
|
|
154
|
+
} catch (err) {
|
|
155
|
+
console.warn(`qore-sourcemaps: cleanup skipped: ${describe(err, io.env.QORE_BUILD_UPLOAD_TOKEN)}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
149
158
|
async function main(argv = process.argv.slice(2), io = defaultIo()) {
|
|
150
159
|
const args = parseArgs(argv);
|
|
151
160
|
if ("error" in args) {
|
|
152
161
|
console.warn(`qore-sourcemaps: ${args.error}`);
|
|
153
|
-
const dir2 = argv[0]
|
|
162
|
+
const dir2 = isCommand(argv[0]) ? argv[1] : void 0;
|
|
154
163
|
if (dir2 && !dir2.startsWith("-")) {
|
|
155
164
|
try {
|
|
156
165
|
for (const m of listMaps(io.walk(dir2))) tryRemove(io, join(dir2, m));
|
|
@@ -160,7 +169,7 @@ async function main(argv = process.argv.slice(2), io = defaultIo()) {
|
|
|
160
169
|
}
|
|
161
170
|
return;
|
|
162
171
|
}
|
|
163
|
-
const { dir, bundle } = args;
|
|
172
|
+
const { cmd, dir, bundle } = args;
|
|
164
173
|
const at = (rel) => join(dir, rel);
|
|
165
174
|
let maps = [];
|
|
166
175
|
const scratch = [];
|
|
@@ -214,6 +223,7 @@ async function main(argv = process.argv.slice(2), io = defaultIo()) {
|
|
|
214
223
|
} finally {
|
|
215
224
|
for (const m of maps) tryRemove(io, at(m));
|
|
216
225
|
for (const s of scratch) tryRemove(io, s);
|
|
226
|
+
if (cmd === "finalize") removeAllMaps(io, dir);
|
|
217
227
|
}
|
|
218
228
|
}
|
|
219
229
|
function isMainModule() {
|
|
@@ -1,79 +1,7 @@
|
|
|
1
|
+
import { I as IntegrationMap, a as IntegrationDefinition, E as EnvRef } from '../types-CAwj03sM.js';
|
|
2
|
+
export { A as AUTH_ENV_FIELDS, b as AUTH_SECRET_FIELDS, c as AuthKind, d as EnvKey, e as IntegrationAuth, P as Protocol, R as RESERVED_KEY_PREFIX, f as defineIntegrations } from '../types-CAwj03sM.js';
|
|
1
3
|
import { E as Env } from '../env-R-bci5RU.js';
|
|
2
4
|
|
|
3
|
-
/**
|
|
4
|
-
* How an integration authenticates. Every field except `header` and
|
|
5
|
-
* `credentialsIn` names an **env key** — the SDK reads the value from the
|
|
6
|
-
* environment at call time, never from the declaration — so a declaration can
|
|
7
|
-
* sit in source control and carry no secret.
|
|
8
|
-
*/
|
|
9
|
-
type AuthKind = "none" | "api_key_header" | "bearer_static" | "basic" | "oauth2_client_credentials";
|
|
10
|
-
/** What the API speaks. Informational for the portal; the client sends bytes either way. */
|
|
11
|
-
type Protocol = "rest" | "odata" | "soap" | "graphql";
|
|
12
|
-
/** The name of an env var, e.g. `SAP_BASE_URL`. */
|
|
13
|
-
type EnvKey = string;
|
|
14
|
-
/**
|
|
15
|
-
* A reference to an env var. The short form is required; the object form can
|
|
16
|
-
* be optional and carry a default the app falls back on when the key is unset.
|
|
17
|
-
*/
|
|
18
|
-
type EnvRef = EnvKey | {
|
|
19
|
-
key: EnvKey;
|
|
20
|
-
optional?: boolean;
|
|
21
|
-
default?: string | number | boolean;
|
|
22
|
-
};
|
|
23
|
-
type IntegrationAuth = {
|
|
24
|
-
kind: "none";
|
|
25
|
-
} | {
|
|
26
|
-
kind: "api_key_header";
|
|
27
|
-
header: string;
|
|
28
|
-
apiKey: EnvKey;
|
|
29
|
-
} | {
|
|
30
|
-
kind: "bearer_static";
|
|
31
|
-
token: EnvKey;
|
|
32
|
-
} | {
|
|
33
|
-
kind: "basic";
|
|
34
|
-
username: EnvKey;
|
|
35
|
-
password: EnvKey;
|
|
36
|
-
} | {
|
|
37
|
-
kind: "oauth2_client_credentials";
|
|
38
|
-
tokenUrl: EnvKey;
|
|
39
|
-
clientId: EnvKey;
|
|
40
|
-
clientSecret: EnvKey;
|
|
41
|
-
scope?: EnvKey;
|
|
42
|
-
audience?: EnvKey;
|
|
43
|
-
/** Where the client credentials go on the token request. Default `"header"`. */
|
|
44
|
-
credentialsIn?: "header" | "body";
|
|
45
|
-
};
|
|
46
|
-
interface IntegrationDefinition {
|
|
47
|
-
/** Human name shown in the portal, e.g. "SAP S/4HANA Cloud". */
|
|
48
|
-
label: string;
|
|
49
|
-
protocol: Protocol;
|
|
50
|
-
/** Env key holding the base URL for this environment. */
|
|
51
|
-
baseUrl: EnvKey;
|
|
52
|
-
auth: IntegrationAuth;
|
|
53
|
-
/** Further env the app reads for this integration, by logical name. */
|
|
54
|
-
config?: Record<string, EnvRef>;
|
|
55
|
-
}
|
|
56
|
-
type IntegrationMap = Record<string, IntegrationDefinition>;
|
|
57
|
-
/**
|
|
58
|
-
* Identity function that pins the literal types of the map, so an alias typo
|
|
59
|
-
* at a call site is a compile error (`keyof M`) rather than a runtime
|
|
60
|
-
* `not_declared`. Same shape as `definePermissions` in `auth-core`.
|
|
61
|
-
*/
|
|
62
|
-
declare function defineIntegrations<const M extends IntegrationMap>(map: M): M;
|
|
63
|
-
/**
|
|
64
|
-
* Which fields of each auth kind name an env key. Shared with the manifest
|
|
65
|
-
* extractor and the portal, which derive the required-env list from a
|
|
66
|
-
* declaration without evaluating app code.
|
|
67
|
-
*/
|
|
68
|
-
declare const AUTH_ENV_FIELDS: Record<AuthKind, readonly string[]>;
|
|
69
|
-
/** Auth fields whose env value is a secret, so the portal masks it. */
|
|
70
|
-
declare const AUTH_SECRET_FIELDS: readonly ["apiKey", "token", "password", "clientSecret"];
|
|
71
|
-
/**
|
|
72
|
-
* Env keys under this prefix belong to the platform
|
|
73
|
-
* (`QORE_INTEGRATION_<ALIAS>_LOGGING` today). A declaration may not claim one.
|
|
74
|
-
*/
|
|
75
|
-
declare const RESERVED_KEY_PREFIX = "QORE_INTEGRATION_";
|
|
76
|
-
|
|
77
5
|
interface IntegrationProblem {
|
|
78
6
|
alias: string;
|
|
79
7
|
key: string;
|
|
@@ -213,4 +141,4 @@ declare const INTEGRATION_SPAN_TYPE_ATTR = "qore.span.type";
|
|
|
213
141
|
/** A cached OAuth2 token is refreshed this long before it expires. */
|
|
214
142
|
declare const OAUTH_REFRESH_SKEW_MS = 30000;
|
|
215
143
|
|
|
216
|
-
export {
|
|
144
|
+
export { DEFAULT_INTEGRATION_TIMEOUT_MS, EnvRef, INTEGRATION_ALIAS_ATTR, INTEGRATION_SPAN_TYPE, INTEGRATION_SPAN_TYPE_ATTR, type IntegrationClient, type IntegrationConfig, IntegrationDefinition, IntegrationError, type IntegrationErrorCode, type IntegrationHandle, IntegrationMap, type IntegrationProblem, type IntegrationRequest, OAUTH_REFRESH_SKEW_MS, PLATFORM_MANAGED_HOSTS, type ParamValue, allKeys, assertIntegrations, createIntegrationClient, isPlatformManagedHost, loggingEnabled, loggingKey, readRef, requiredKeys };
|