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: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"c8": "./dist/index.js"
},
"exports": {
"./runtime": "./dist/runtime.js"
"./runtime": {
"types": "./dist/runtime.d.ts",
"default": "./dist/runtime.js"
}
},
"files": [
"dist",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,8 @@ export async function initPlugin(pluginName?: string): Promise<void> {
agents
);

// Create .gitignore
writeFileSync(join(pluginDir, '.gitignore'), getTemplate('.gitignore'));
// Create .gitignore (stored as 'gitignore' to survive npm publish)
writeFileSync(join(pluginDir, '.gitignore'), getTemplate('gitignore'));

logger.success('Plugin scaffolding created successfully!');
const nextSteps = renderTemplate('init-plugin-next-steps.txt', templateVars);
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions src/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"watch": "tsc --watch"
},
"devDependencies": {
"typescript": "^5.0.0",
"@types/node": "^22.0.0"
"@camunda8/cli": "*",
"@types/node": "^22.0.0",
"typescript": "^5.0.0"
}
}
4 changes: 2 additions & 2 deletions src/templates/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"rootDir": "./src",
"strict": true,
Expand Down
38 changes: 38 additions & 0 deletions tests/integration/plugin-lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,44 @@ describe('Plugin Lifecycle Integration Tests', () => {
}
}
});

test('init plugin should scaffold all required files', () => {
const name = 'test-init-files';
const dir = join(process.cwd(), `c8ctl-${name}`);

if (existsSync(dir)) {
rmSync(dir, { recursive: true, force: true });
}

try {
const output = execSync(`node src/index.ts init plugin ${name}`, {
cwd: process.cwd(),
encoding: 'utf-8',
timeout: 5000,
});

assert.ok(output.includes('Plugin scaffolding created successfully'),
'Init command should succeed');

const expectedFiles = [
'package.json',
'tsconfig.json',
'c8ctl-plugin.js',
'README.md',
'AGENTS.md',
'.gitignore',
join('src', 'c8ctl-plugin.ts'),
];

for (const file of expectedFiles) {
assert.ok(existsSync(join(dir, file)), `${file} should exist after init`);
}
} finally {
if (existsSync(dir)) {
rmSync(dir, { recursive: true, force: true });
}
}
});

test('should complete full plugin lifecycle with init, build, load, execute, and help', async () => {
const scaffoldPluginName = 'test-scaffold';
Expand Down