Update npm packages (73 packages including @jqhtml 2.3.36)
Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
89
node_modules/playwright/lib/agents/agentParser.js
generated
vendored
Normal file
89
node_modules/playwright/lib/agents/agentParser.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var agentParser_exports = {};
|
||||
__export(agentParser_exports, {
|
||||
parseAgentSpec: () => parseAgentSpec
|
||||
});
|
||||
module.exports = __toCommonJS(agentParser_exports);
|
||||
var import_fs = __toESM(require("fs"));
|
||||
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
||||
async function parseAgentSpec(filePath) {
|
||||
const source = await import_fs.default.promises.readFile(filePath, "utf-8");
|
||||
const { header, content } = extractYamlAndContent(source);
|
||||
const { instructions, examples } = extractInstructionsAndExamples(content);
|
||||
return {
|
||||
...header,
|
||||
instructions,
|
||||
examples
|
||||
};
|
||||
}
|
||||
function extractYamlAndContent(markdown) {
|
||||
const lines = markdown.split("\n");
|
||||
if (lines[0] !== "---")
|
||||
throw new Error("Markdown file must start with YAML front matter (---)");
|
||||
let yamlEndIndex = -1;
|
||||
for (let i = 1; i < lines.length; i++) {
|
||||
if (lines[i] === "---") {
|
||||
yamlEndIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (yamlEndIndex === -1)
|
||||
throw new Error("YAML front matter must be closed with ---");
|
||||
const yamlLines = lines.slice(1, yamlEndIndex);
|
||||
const yamlRaw = yamlLines.join("\n");
|
||||
const contentLines = lines.slice(yamlEndIndex + 1);
|
||||
const content = contentLines.join("\n");
|
||||
let header;
|
||||
try {
|
||||
header = import_utilsBundle.yaml.parse(yamlRaw);
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to parse YAML header: ${error.message}`);
|
||||
}
|
||||
if (!header.name)
|
||||
throw new Error('YAML header must contain a "name" field');
|
||||
if (!header.description)
|
||||
throw new Error('YAML header must contain a "description" field');
|
||||
return { header, content };
|
||||
}
|
||||
function extractInstructionsAndExamples(content) {
|
||||
const examples = [];
|
||||
const instructions = content.split("<example>")[0].trim();
|
||||
const exampleRegex = /<example>([\s\S]*?)<\/example>/g;
|
||||
let match;
|
||||
while ((match = exampleRegex.exec(content)) !== null) {
|
||||
const example = match[1].trim();
|
||||
examples.push(example.replace(/[\n]/g, " ").replace(/ +/g, " "));
|
||||
}
|
||||
return { instructions, examples };
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
parseAgentSpec
|
||||
});
|
||||
101
node_modules/playwright/lib/agents/generateAgents.js
generated
vendored
101
node_modules/playwright/lib/agents/generateAgents.js
generated
vendored
@@ -39,67 +39,20 @@ var import_path = __toESM(require("path"));
|
||||
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_seed = require("../mcp/test/seed");
|
||||
class AgentParser {
|
||||
static async loadAgents() {
|
||||
const files = await import_fs.default.promises.readdir(__dirname);
|
||||
return Promise.all(files.filter((file) => file.endsWith(".agent.md")).map((file) => AgentParser.parseFile(import_path.default.join(__dirname, file))));
|
||||
}
|
||||
static async parseFile(filePath) {
|
||||
const source = await import_fs.default.promises.readFile(filePath, "utf-8");
|
||||
const { header, content } = this.extractYamlAndContent(source);
|
||||
const { instructions, examples } = this.extractInstructionsAndExamples(content);
|
||||
return { header, instructions, examples };
|
||||
}
|
||||
static extractYamlAndContent(markdown) {
|
||||
const lines = markdown.split("\n");
|
||||
if (lines[0] !== "---")
|
||||
throw new Error("Markdown file must start with YAML front matter (---)");
|
||||
let yamlEndIndex = -1;
|
||||
for (let i = 1; i < lines.length; i++) {
|
||||
if (lines[i] === "---") {
|
||||
yamlEndIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (yamlEndIndex === -1)
|
||||
throw new Error("YAML front matter must be closed with ---");
|
||||
const yamlLines = lines.slice(1, yamlEndIndex);
|
||||
const yamlRaw = yamlLines.join("\n");
|
||||
const contentLines = lines.slice(yamlEndIndex + 1);
|
||||
const content = contentLines.join("\n");
|
||||
let header;
|
||||
try {
|
||||
header = import_utilsBundle.yaml.parse(yamlRaw);
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to parse YAML header: ${error.message}`);
|
||||
}
|
||||
if (!header.name)
|
||||
throw new Error('YAML header must contain a "name" field');
|
||||
if (!header.description)
|
||||
throw new Error('YAML header must contain a "description" field');
|
||||
return { header, content };
|
||||
}
|
||||
static extractInstructionsAndExamples(content) {
|
||||
const examples = [];
|
||||
const instructions = content.split("<example>")[0].trim();
|
||||
const exampleRegex = /<example>([\s\S]*?)<\/example>/g;
|
||||
let match;
|
||||
while ((match = exampleRegex.exec(content)) !== null) {
|
||||
const example = match[1].trim();
|
||||
examples.push(example.replace(/[\n]/g, " ").replace(/ +/g, " "));
|
||||
}
|
||||
return { instructions, examples };
|
||||
}
|
||||
var import_agentParser = require("./agentParser");
|
||||
async function loadAgentSpecs() {
|
||||
const files = await import_fs.default.promises.readdir(__dirname);
|
||||
return Promise.all(files.filter((file) => file.endsWith(".agent.md")).map((file) => (0, import_agentParser.parseAgentSpec)(import_path.default.join(__dirname, file))));
|
||||
}
|
||||
class ClaudeGenerator {
|
||||
static async init(config, projectName, prompts) {
|
||||
await initRepo(config, projectName, {
|
||||
promptsFolder: prompts ? ".claude/prompts" : void 0
|
||||
});
|
||||
const agents = await AgentParser.loadAgents();
|
||||
const agents = await loadAgentSpecs();
|
||||
await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
|
||||
for (const agent of agents)
|
||||
await writeFile(`.claude/agents/${agent.header.name}.md`, ClaudeGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
||||
await writeFile(`.claude/agents/${agent.name}.md`, ClaudeGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
||||
await writeFile(".mcp.json", JSON.stringify({
|
||||
mcpServers: {
|
||||
"playwright-test": {
|
||||
@@ -124,11 +77,11 @@ class ClaudeGenerator {
|
||||
const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
|
||||
const lines = [];
|
||||
const header = {
|
||||
name: agent.header.name,
|
||||
description: agent.header.description + examples,
|
||||
tools: agent.header.tools.map((tool) => asClaudeTool(tool)).join(", "),
|
||||
model: agent.header.model,
|
||||
color: agent.header.color
|
||||
name: agent.name,
|
||||
description: agent.description + examples,
|
||||
tools: agent.tools.map((tool) => asClaudeTool(tool)).join(", "),
|
||||
model: agent.model,
|
||||
color: agent.color
|
||||
};
|
||||
lines.push(`---`);
|
||||
lines.push(import_utilsBundle.yaml.stringify(header, { lineWidth: 1e5 }) + `---`);
|
||||
@@ -143,12 +96,12 @@ class OpencodeGenerator {
|
||||
defaultAgentName: "Build",
|
||||
promptsFolder: prompts ? ".opencode/prompts" : void 0
|
||||
});
|
||||
const agents = await AgentParser.loadAgents();
|
||||
const agents = await loadAgentSpecs();
|
||||
for (const agent of agents) {
|
||||
const prompt = [agent.instructions];
|
||||
prompt.push("");
|
||||
prompt.push(...agent.examples.map((example) => `<example>${example}</example>`));
|
||||
await writeFile(`.opencode/prompts/${agent.header.name}.md`, prompt.join("\n"), "\u{1F916}", "agent definition");
|
||||
await writeFile(`.opencode/prompts/${agent.name}.md`, prompt.join("\n"), "\u{1F916}", "agent definition");
|
||||
}
|
||||
await writeFile("opencode.json", OpencodeGenerator.configuration(agents), "\u{1F527}", "opencode configuration");
|
||||
initRepoDone();
|
||||
@@ -176,13 +129,13 @@ class OpencodeGenerator {
|
||||
result["agent"] = {};
|
||||
for (const agent of agents) {
|
||||
const tools = {};
|
||||
result["agent"][agent.header.name] = {
|
||||
description: agent.header.description,
|
||||
result["agent"][agent.name] = {
|
||||
description: agent.description,
|
||||
mode: "subagent",
|
||||
prompt: `{file:.opencode/prompts/${agent.header.name}.md}`,
|
||||
prompt: `{file:.opencode/prompts/${agent.name}.md}`,
|
||||
tools
|
||||
};
|
||||
for (const tool of agent.header.tools)
|
||||
for (const tool of agent.tools)
|
||||
asOpencodeTool(tools, tool);
|
||||
}
|
||||
result["mcp"]["playwright-test"] = {
|
||||
@@ -200,10 +153,10 @@ class CopilotGenerator {
|
||||
promptsFolder: prompts ? ".github/prompts" : void 0,
|
||||
promptSuffix: "prompt"
|
||||
});
|
||||
const agents = await AgentParser.loadAgents();
|
||||
const agents = await loadAgentSpecs();
|
||||
await import_fs.default.promises.mkdir(".github/agents", { recursive: true });
|
||||
for (const agent of agents)
|
||||
await writeFile(`.github/agents/${agent.header.name}.agent.md`, CopilotGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
||||
await writeFile(`.github/agents/${agent.name}.agent.md`, CopilotGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
||||
await deleteFile(`.github/chatmodes/ \u{1F3AD} planner.chatmode.md`, "legacy planner chatmode");
|
||||
await deleteFile(`.github/chatmodes/\u{1F3AD} generator.chatmode.md`, "legacy generator chatmode");
|
||||
await deleteFile(`.github/chatmodes/\u{1F3AD} healer.chatmode.md`, "legacy healer chatmode");
|
||||
@@ -228,14 +181,14 @@ class CopilotGenerator {
|
||||
const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
|
||||
const lines = [];
|
||||
const header = {
|
||||
"name": agent.header.name,
|
||||
"description": agent.header.description + examples,
|
||||
"tools": agent.header.tools,
|
||||
"name": agent.name,
|
||||
"description": agent.description + examples,
|
||||
"tools": agent.tools,
|
||||
"model": "Claude Sonnet 4",
|
||||
"mcp-servers": CopilotGenerator.mcpServers
|
||||
};
|
||||
lines.push(`---`);
|
||||
lines.push(import_utilsBundle.yaml.stringify(header) + `---`);
|
||||
lines.push(import_utilsBundle.yaml.stringify(header, { lineWidth: 1e5 }) + `---`);
|
||||
lines.push("");
|
||||
lines.push(agent.instructions);
|
||||
lines.push("");
|
||||
@@ -260,7 +213,7 @@ class VSCodeGenerator {
|
||||
await initRepo(config, projectName, {
|
||||
promptsFolder: void 0
|
||||
});
|
||||
const agents = await AgentParser.loadAgents();
|
||||
const agents = await loadAgentSpecs();
|
||||
const nameMap = /* @__PURE__ */ new Map([
|
||||
["playwright-test-planner", " \u{1F3AD} planner"],
|
||||
["playwright-test-generator", "\u{1F3AD} generator"],
|
||||
@@ -268,7 +221,7 @@ class VSCodeGenerator {
|
||||
]);
|
||||
await import_fs.default.promises.mkdir(".github/chatmodes", { recursive: true });
|
||||
for (const agent of agents)
|
||||
await writeFile(`.github/chatmodes/${nameMap.get(agent.header.name)}.chatmode.md`, VSCodeGenerator.agentSpec(agent), "\u{1F916}", "chatmode definition");
|
||||
await writeFile(`.github/chatmodes/${nameMap.get(agent.name)}.chatmode.md`, VSCodeGenerator.agentSpec(agent), "\u{1F916}", "chatmode definition");
|
||||
await VSCodeGenerator.appendToMCPJson();
|
||||
initRepoDone();
|
||||
}
|
||||
@@ -307,7 +260,7 @@ class VSCodeGenerator {
|
||||
return `${vscodeMcpName}/${second}`;
|
||||
return vscodeToolMap.get(first) || first;
|
||||
}
|
||||
const tools = agent.header.tools.map(asVscodeTool).flat().sort((a, b) => {
|
||||
const tools = agent.tools.map(asVscodeTool).flat().sort((a, b) => {
|
||||
const indexA = vscodeToolsOrder.indexOf(a);
|
||||
const indexB = vscodeToolsOrder.indexOf(b);
|
||||
if (indexA === -1 && indexB === -1)
|
||||
@@ -320,7 +273,7 @@ class VSCodeGenerator {
|
||||
}).map((tool) => `'${tool}'`).join(", ");
|
||||
const lines = [];
|
||||
lines.push(`---`);
|
||||
lines.push(`description: ${agent.header.description}.`);
|
||||
lines.push(`description: ${agent.description}.`);
|
||||
lines.push(`tools: [${tools}]`);
|
||||
lines.push(`---`);
|
||||
lines.push("");
|
||||
|
||||
1
node_modules/playwright/lib/agents/playwright-test-planner.agent.md
generated
vendored
1
node_modules/playwright/lib/agents/playwright-test-planner.agent.md
generated
vendored
@@ -17,6 +17,7 @@ tools:
|
||||
- playwright-test/browser_navigate_back
|
||||
- playwright-test/browser_network_requests
|
||||
- playwright-test/browser_press_key
|
||||
- playwright-test/browser_run_code
|
||||
- playwright-test/browser_select_option
|
||||
- playwright-test/browser_snapshot
|
||||
- playwright-test/browser_take_screenshot
|
||||
|
||||
Reference in New Issue
Block a user