Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/moody-plants-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@plotday/sdk": patch
---

Fixed: Add lint and deploy scripts to generated package.json
17 changes: 14 additions & 3 deletions sdk/cli/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function generateCommand(options: GenerateOptions) {
if (!fs.existsSync(specPath)) {
out.error(
`Spec file not found: ${path.relative(process.cwd(), specPath)}`,
'Create a plot-agent.md file describing your agent, or use --spec to specify a different file'
"Create a plot-agent.md file describing your agent, or use --spec to specify a different file"
);
process.exit(1);
}
Expand Down Expand Up @@ -168,7 +168,8 @@ export async function generateCommand(options: GenerateOptions) {

// Call generate API
try {
out.progress("Generating agent from spec...");
const relativeSpecPath = path.relative(process.cwd(), specPath);
out.progress(`Generate agent from ${relativeSpecPath}...`);

const response = await fetch(`${options.apiUrl}/v1/agent/generate`, {
method: "POST",
Expand Down Expand Up @@ -235,7 +236,14 @@ export async function generateCommand(options: GenerateOptions) {
version: "1.0.0",
displayName: source.displayName,
plotAgentId: agentId,
scripts: {
lint: "plot agent lint",
deploy: "plot agent deploy",
},
dependencies: source.dependencies,
devDependencies: {
typescript: "latest",
},
};
writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");

Expand Down Expand Up @@ -269,7 +277,10 @@ export async function generateCommand(options: GenerateOptions) {
"utf-8"
);
// Replace template variables
readmeTemplate = readmeTemplate.replace(/\{\{displayName\}\}/g, source.displayName);
readmeTemplate = readmeTemplate.replace(
/\{\{displayName\}\}/g,
source.displayName
);
readmeTemplate = readmeTemplate.replace(/\{\{packageManager\}\}/g, "pnpm");
writeFile(readmePath, readmeTemplate);

Expand Down