cortex-kit 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yazan Ghafir
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # cortex-kit
2
+
3
+ CLI tool that scaffolds AI-native projects with AGENTS.md specifications for AI coding assistants.
4
+
5
+ ## Features
6
+
7
+ - Single command to initialize AI-native project structure
8
+ - AGENTS.md template with software development best practices
9
+ - Framework-agnostic (works with any tech stack)
10
+ - Compatible with 20+ AI coding tools (Claude Code, GitHub Copilot, Cursor, etc.)
11
+ - Zero dependencies
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ # Use with npx (no installation needed)
17
+ npx cortex-kit init my-project
18
+
19
+ # Or install globally
20
+ npm install -g cortex-kit
21
+ cortex-kit init my-project
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ### Create a new project
27
+ ```bash
28
+ npx cortex-kit init my-awesome-project
29
+ cd my-awesome-project
30
+ ```
31
+
32
+ ### Initialize in current directory
33
+ ```bash
34
+ npx cortex-kit init .
35
+ ```
36
+
37
+ ## What Gets Generated
38
+
39
+ - `AGENTS.md` - Project context for AI coding agents (workflows, testing, conventions)
40
+ - `CLAUDE.md` - Reference to AGENTS.md for Claude Code
41
+ - `README.md` - Setup instructions for your team
42
+ - `docs/` - Empty directory for architecture documentation
43
+
44
+ ## Next Steps After Generation
45
+
46
+ 1. Customize `AGENTS.md` with your project details:
47
+ - Update project overview
48
+ - Add build and test commands
49
+ - Specify coding conventions
50
+ - Add project-specific guidelines
51
+
52
+ 2. Start coding with AI assistants (Claude Code, Copilot, Cursor, etc.)
53
+
54
+ 3. Document architecture decisions in `docs/`
55
+
56
+ ## Why AGENTS.md?
57
+
58
+ AGENTS.md is an open standard used by 60,000+ projects to provide context to AI coding agents. It's like a README for AI - containing build steps, conventions, and practices that AI agents need to work effectively.
59
+
60
+ Learn more: [agents.md](https://agents.md/)
61
+
62
+ ## Requirements
63
+
64
+ - Node.js 18 or higher
65
+
66
+ ## License
67
+
68
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { init } from '../src/index.js';
4
+
5
+ // Parse command line arguments
6
+ const args = process.argv.slice(2);
7
+ const command = args[0];
8
+ const projectName = args[1] || '.';
9
+
10
+ // Simple argument validation
11
+ if (!command) {
12
+ console.error('Error: No command provided');
13
+ console.log('Usage: cortex-kit init [project-name]');
14
+ console.log(' cortex-kit init . (for current directory)');
15
+ process.exit(1);
16
+ }
17
+
18
+ if (command !== 'init') {
19
+ console.error(`Error: Unknown command "${command}"`);
20
+ console.log('Available commands: init');
21
+ process.exit(1);
22
+ }
23
+
24
+ // Execute init command
25
+ try {
26
+ await init(projectName);
27
+ } catch (error) {
28
+ console.error('Error:', error.message);
29
+ process.exit(1);
30
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "cortex-kit",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool that scaffolds AI-native projects with AGENTS.md specifications",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "bin": {
8
+ "cortex-kit": "./bin/cli.js"
9
+ },
10
+ "scripts": {
11
+ "test": "./tests/test.sh",
12
+ "prepublishOnly": "./tests/test.sh"
13
+ },
14
+ "keywords": [
15
+ "cli",
16
+ "agents.md",
17
+ "claude-code",
18
+ "ai-native",
19
+ "scaffold",
20
+ "ai-coding",
21
+ "copilot",
22
+ "cursor"
23
+ ],
24
+ "author": "Yazan Ghafir",
25
+ "license": "MIT",
26
+ "engines": {
27
+ "node": ">=18.0.0"
28
+ },
29
+ "files": [
30
+ "bin/",
31
+ "src/"
32
+ ]
33
+ }
@@ -0,0 +1,31 @@
1
+ import { writeFile, readFile } from 'fs/promises';
2
+ import { join, dirname } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ /**
9
+ * Generate all template files in target directory
10
+ * @param {string} targetDir - Target directory path
11
+ */
12
+ export async function generateFiles(targetDir) {
13
+ const templates = [
14
+ { name: 'AGENTS.md', dest: 'AGENTS.md' },
15
+ { name: 'CLAUDE.md', dest: 'CLAUDE.md' },
16
+ { name: 'README.md', dest: 'README.md' }
17
+ ];
18
+
19
+ for (const template of templates) {
20
+ const templatePath = join(__dirname, 'templates', template.name);
21
+ const destPath = join(targetDir, template.dest);
22
+
23
+ try {
24
+ const content = await readFile(templatePath, 'utf-8');
25
+ await writeFile(destPath, content, 'utf-8');
26
+ console.log(`✓ Generated ${template.dest}`);
27
+ } catch (error) {
28
+ throw new Error(`Failed to generate ${template.dest}: ${error.message}`);
29
+ }
30
+ }
31
+ }
package/src/index.js ADDED
@@ -0,0 +1,59 @@
1
+ import { resolve, join } from 'path';
2
+ import { mkdir } from 'fs/promises';
3
+ import { generateFiles } from './generator.js';
4
+
5
+ /**
6
+ * Initialize a new AI-native project
7
+ * @param {string} projectName - Name of project or '.' for current directory
8
+ */
9
+ export async function init(projectName) {
10
+ // Determine target directory
11
+ const targetDir = projectName === '.'
12
+ ? process.cwd()
13
+ : resolve(process.cwd(), projectName);
14
+
15
+ const isCurrentDir = projectName === '.';
16
+ const displayName = isCurrentDir ? 'current directory' : projectName;
17
+
18
+ console.log(`🚀 Initializing cortex-kit in ${displayName}...`);
19
+
20
+ // Create project directory if not current directory
21
+ if (!isCurrentDir) {
22
+ try {
23
+ await mkdir(targetDir, { recursive: true });
24
+ console.log(`✓ Created directory: ${projectName}`);
25
+ } catch (error) {
26
+ if (error.code === 'EEXIST') {
27
+ console.log(`✓ Directory exists: ${projectName}`);
28
+ } else {
29
+ throw new Error(`Failed to create directory: ${error.message}`);
30
+ }
31
+ }
32
+ }
33
+
34
+ // Create docs directory
35
+ const docsDir = join(targetDir, 'docs');
36
+ try {
37
+ await mkdir(docsDir, { recursive: true });
38
+ console.log('✓ Created docs/ directory');
39
+ } catch (error) {
40
+ throw new Error(`Failed to create docs directory: ${error.message}`);
41
+ }
42
+
43
+ // Generate all template files
44
+ await generateFiles(targetDir);
45
+
46
+ console.log('\n✨ Setup complete!');
47
+ console.log('\nNext steps:');
48
+ if (!isCurrentDir) {
49
+ console.log(` cd ${projectName}`);
50
+ }
51
+ console.log(' 1. Customize AGENTS.md with your project details');
52
+ console.log(' 2. Add build and test commands to AGENTS.md');
53
+ console.log(' 3. Open your project with Claude Code or other AI tools');
54
+ console.log('\nGenerated files:');
55
+ console.log(' - AGENTS.md: Project context for AI coding agents');
56
+ console.log(' - CLAUDE.md: Reference to AGENTS.md');
57
+ console.log(' - README.md: Setup instructions');
58
+ console.log(' - docs/: Architecture documentation folder');
59
+ }
@@ -0,0 +1,85 @@
1
+ # Project Context for AI Agents
2
+
3
+ ## Development Workflow
4
+
5
+ ### Before Starting Work
6
+ 1. Understand the requirements and scope
7
+ 2. Check existing documentation in `docs/`
8
+ 3. Review relevant code and tests
9
+ 4. Plan the approach before implementing
10
+
11
+ ### Implementation Process
12
+ 1. Write clean, readable code with clear intent
13
+ 2. Follow existing patterns and conventions in the codebase
14
+ 3. Keep changes focused and atomic
15
+ 4. Add comments only for complex logic that isn't self-evident
16
+
17
+ ### Testing Requirements
18
+ - **Always write tests** for new features and bug fixes
19
+ - Run all tests before considering work complete
20
+ - Include both positive and negative test cases
21
+ - Ensure tests are deterministic and reliable
22
+ - Test edge cases and error conditions
23
+
24
+ ### Development Testing
25
+ - **Run tests after every change** to catch issues early
26
+ - Fix failing tests immediately, don't accumulate technical debt
27
+ - Verify tests pass locally before committing
28
+ - Add regression tests for bugs to prevent recurrence
29
+
30
+ ## Code Quality Standards
31
+
32
+ ### General Principles
33
+ - Write self-documenting code with meaningful names
34
+ - Keep functions small and focused (single responsibility)
35
+ - Avoid premature optimization
36
+ - Prefer clarity over cleverness
37
+ - Don't repeat yourself (DRY) but avoid premature abstraction
38
+
39
+ ### Error Handling
40
+ - Handle errors gracefully and provide clear messages
41
+ - Validate input at system boundaries
42
+ - Don't swallow exceptions silently
43
+ - Use appropriate error types for different scenarios
44
+
45
+ ### Security
46
+ - Never commit secrets, API keys, or credentials
47
+ - Validate and sanitize all external input
48
+ - Follow security best practices for your tech stack
49
+ - Consider security implications of changes
50
+
51
+ ## Documentation
52
+
53
+ ### Code Documentation
54
+ - Document **why**, not **what** (code shows what)
55
+ - Update documentation when changing behavior
56
+ - Keep documentation close to the code it describes
57
+
58
+ ### Architecture Documentation
59
+ - Document architectural decisions in `docs/architecture/`
60
+ - Include context, decision, and consequences (ADR format)
61
+ - Update architecture docs when making structural changes
62
+ - Explain trade-offs and alternatives considered
63
+
64
+ ### API Documentation
65
+ - Document public interfaces and APIs in `docs/api/`
66
+ - Include usage examples
67
+ - Document expected inputs, outputs, and error cases
68
+
69
+ ## Git Workflow
70
+
71
+ ### Commits
72
+ - Write clear, descriptive commit messages
73
+ - Keep commits focused on a single logical change
74
+ - Commit message format: Brief summary, detailed explanation if needed
75
+ - Don't commit broken code or failing tests
76
+
77
+ ### Before Committing
78
+ - [ ] All tests pass
79
+ - [ ] Code is clean and follows conventions
80
+ - [ ] No debug code, console logs, or commented-out code
81
+ - [ ] Documentation updated if needed
82
+
83
+ ---
84
+
85
+ **Note**: Customize this file with project-specific details like build commands, test commands, and tech stack conventions as your project evolves.
@@ -0,0 +1 @@
1
+ AGENTS.md
@@ -0,0 +1,55 @@
1
+ # AI-Native Project Setup
2
+
3
+ This project is configured for AI-native development with AI coding assistants.
4
+
5
+ ## What's Included
6
+
7
+ ### AGENTS.md
8
+ Project context and conventions for AI coding agents (Claude Code, GitHub Copilot, Cursor, etc.). This file contains:
9
+ - Development workflow and best practices
10
+ - Testing requirements and quality standards
11
+ - Documentation guidelines
12
+ - Project-specific build and test commands
13
+
14
+ **This is the main file to customize** with your project's conventions, tech stack, and workflows.
15
+
16
+ ### CLAUDE.md
17
+ A reference file that points to `AGENTS.md`, telling Claude Code to read the AGENTS.md file for project context.
18
+
19
+ ### docs/
20
+ Empty directory for architecture documentation, design decisions, and API docs.
21
+
22
+ ## Getting Started
23
+
24
+ ### 1. Customize AGENTS.md
25
+ Update the following sections in `AGENTS.md`:
26
+ - **Project Overview**: Describe what your project does
27
+ - **Build Commands**: Add your actual build commands (e.g., `npm run build`, `cargo build`)
28
+ - **Test Commands**: Add your test commands (e.g., `npm test`, `pytest`)
29
+ - **Project-Specific Guidelines**: Add any conventions specific to your project
30
+
31
+ ### 2. Use with AI Coding Tools
32
+ AI coding assistants will automatically read `AGENTS.md` to understand:
33
+ - How to build and test your project
34
+ - Code quality standards to follow
35
+ - Testing requirements
36
+ - Documentation expectations
37
+
38
+ ### 3. Document Your Architecture
39
+ Create subdirectories in `docs/` as needed:
40
+ - `docs/architecture/` - Architectural decisions and design docs
41
+ - `docs/api/` - API documentation
42
+ - `docs/guides/` - Development guides
43
+
44
+ ## Why AGENTS.md?
45
+
46
+ AGENTS.md is an open standard used by 60,000+ projects to provide context to AI coding agents. It's like a README for AI - containing build steps, conventions, and practices that AI agents need to work effectively on your codebase.
47
+
48
+ ## Learn More
49
+
50
+ - [AGENTS.md Specification](https://agents.md/)
51
+ - [Claude Code Documentation](https://code.claude.com/docs)
52
+
53
+ ---
54
+
55
+ Generated with [cortex-kit](https://www.npmjs.com/package/cortex-kit)