@netlify/agent-runner-cli 2.17.0-PAW-612.0 → 2.18.0-smtp-3.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.
- package/dist/bin-local.js +283 -268
- package/dist/bin.js +356 -341
- package/dist/index.d.ts +89 -11
- package/dist/index.js +281 -266
- package/dist/interactions-mcp-server.js +34 -34
- package/dist/skills/general-backend@backend/SKILL.md +78 -0
- package/dist/skills/netlify-functions/SKILL@backend.md +610 -0
- package/dist/skills/netlify-identity/SKILL.md +259 -563
- package/dist/skills/netlify-identity/references/advanced-patterns.md +104 -0
- package/dist/skills/netlify-identity/references/authorization-and-sessions.md +24 -0
- package/dist/skills/netlify-server@backend/SKILL.md +225 -0
- package/dist/skills/netlify-server@netlifyserver/SKILL.md +83 -31
- package/package.json +5 -3
- package/scripts/build-skills.js +40 -18
package/scripts/build-skills.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { cp, mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
2
3
|
import { createRequire } from 'node:module'
|
|
3
4
|
import path from 'node:path'
|
|
4
5
|
import process from 'node:process'
|
|
@@ -8,34 +9,55 @@ const localSkillsDir = new URL('../src/skills/', import.meta.url)
|
|
|
8
9
|
const sharedPackagePath = createRequire(import.meta.url).resolve('@netlify/skills/package.json')
|
|
9
10
|
const sharedSkillsDir = path.join(path.dirname(sharedPackagePath), 'skills')
|
|
10
11
|
export const bundledSkillsDir = fileURLToPath(new URL('../dist/skills/', import.meta.url))
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
const skillOverridesDir = fileURLToPath(new URL('../src/skill-overrides/', import.meta.url))
|
|
13
|
+
export const selectedSharedSkills = ['netlify-access-control', 'netlify-forms', 'netlify-image-cdn', 'netlify-identity']
|
|
14
|
+
|
|
15
|
+
const readOptionalFile = async (filePath) => {
|
|
16
|
+
try {
|
|
17
|
+
return await readFile(filePath, 'utf8')
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.code === 'ENOENT') return undefined
|
|
20
|
+
throw error
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const applySkillReplacements = (content, replacements) => {
|
|
25
|
+
let result = content
|
|
26
|
+
for (const { from, to } of replacements) {
|
|
27
|
+
if (!from || result.split(from).length !== 2) {
|
|
28
|
+
throw new Error(`Expected exactly one occurrence of shared skill text: ${JSON.stringify(from)}`)
|
|
29
|
+
}
|
|
30
|
+
result = result.replace(from, () => to)
|
|
31
|
+
}
|
|
32
|
+
return result
|
|
33
|
+
}
|
|
23
34
|
|
|
24
35
|
export const buildSkills = async (targetDir = bundledSkillsDir) => {
|
|
25
36
|
await rm(targetDir, { recursive: true, force: true })
|
|
26
37
|
await cp(localSkillsDir, targetDir, { recursive: true })
|
|
27
38
|
|
|
28
|
-
for (const
|
|
39
|
+
for (const name of selectedSharedSkills) {
|
|
29
40
|
await cp(path.join(sharedSkillsDir, name), path.join(targetDir, name), {
|
|
30
41
|
recursive: true,
|
|
31
42
|
force: false,
|
|
32
43
|
errorOnExist: true,
|
|
33
44
|
})
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
const overrideDir = path.join(skillOverridesDir, name)
|
|
46
|
+
const replacements = await readOptionalFile(path.join(overrideDir, 'replacements.json'))
|
|
47
|
+
const instructions = await readOptionalFile(path.join(overrideDir, 'instructions.md'))
|
|
48
|
+
if (instructions !== undefined || replacements !== undefined) {
|
|
49
|
+
const skillPath = path.join(targetDir, name, 'SKILL.md')
|
|
50
|
+
let content = await readFile(skillPath, 'utf8')
|
|
51
|
+
if (replacements !== undefined) {
|
|
52
|
+
content = applySkillReplacements(content, JSON.parse(replacements))
|
|
53
|
+
}
|
|
54
|
+
if (instructions !== undefined) {
|
|
55
|
+
content += `\n\n${instructions}`
|
|
56
|
+
}
|
|
57
|
+
await writeFile(skillPath, content)
|
|
36
58
|
}
|
|
37
|
-
|
|
38
|
-
|
|
59
|
+
const assetsDir = path.join(overrideDir, 'assets')
|
|
60
|
+
if (existsSync(assetsDir)) {
|
|
39
61
|
for (const entry of await readdir(assetsDir, { recursive: true, withFileTypes: true })) {
|
|
40
62
|
if (!entry.isFile()) continue
|
|
41
63
|
const source = path.join(entry.parentPath, entry.name)
|