speccrew 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/package.json +2 -4
  2. package/bin/postinstall.js +0 -157
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -22,9 +22,7 @@
22
22
  "docs/",
23
23
  "README*.md"
24
24
  ],
25
- "scripts": {
26
- "postinstall": "node bin/postinstall.js"
27
- },
25
+
28
26
  "engines": {
29
27
  "node": ">=16.0.0"
30
28
  },
@@ -1,157 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const readline = require('readline');
6
-
7
- // Get package version
8
- function getPackageVersion() {
9
- try {
10
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
11
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
12
- return packageJson.version;
13
- } catch (e) {
14
- return 'unknown';
15
- }
16
- }
17
-
18
- // Get npm package root directory
19
- function getPackageRoot() {
20
- return path.resolve(__dirname, '..');
21
- }
22
-
23
- // Check if a path is a speccrew file (starts with speccrew-)
24
- function isSpeccrewFile(name) {
25
- return name.startsWith('speccrew-');
26
- }
27
-
28
- // Count agents and skills in the package
29
- function countPackageResources(packageRoot) {
30
- let agentCount = 0;
31
- let skillCount = 0;
32
-
33
- const agentsDir = path.join(packageRoot, '.speccrew', 'agents');
34
- const skillsDir = path.join(packageRoot, '.speccrew', 'skills');
35
-
36
- if (fs.existsSync(agentsDir)) {
37
- const entries = fs.readdirSync(agentsDir, { withFileTypes: true });
38
- agentCount = entries.filter(e => isSpeccrewFile(e.name)).length;
39
- }
40
-
41
- if (fs.existsSync(skillsDir)) {
42
- const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
43
- skillCount = entries.filter(e => isSpeccrewFile(e.name)).length;
44
- }
45
-
46
- return { agentCount, skillCount };
47
- }
48
-
49
- // Detect IDE directories in the project
50
- function detectIDE(projectRoot) {
51
- const ideConfigs = [
52
- { id: 'qoder', name: 'Qoder', baseDir: '.qoder' },
53
- { id: 'cursor', name: 'Cursor', baseDir: '.cursor' },
54
- { id: 'claude', name: 'Claude', baseDir: '.claude' },
55
- ];
56
-
57
- const detected = [];
58
- for (const config of ideConfigs) {
59
- const basePath = path.join(projectRoot, config.baseDir);
60
- if (fs.existsSync(basePath)) {
61
- detected.push(config);
62
- }
63
- }
64
- return detected;
65
- }
66
-
67
- // Ask user for confirmation
68
- function askConfirm(message) {
69
- return new Promise((resolve) => {
70
- const rl = readline.createInterface({
71
- input: process.stdin,
72
- output: process.stdout,
73
- });
74
-
75
- rl.question(message, (answer) => {
76
- rl.close();
77
- const normalized = answer.trim().toLowerCase();
78
- resolve(normalized === '' || normalized === 'y' || normalized === 'yes');
79
- });
80
- });
81
- }
82
-
83
- // Main postinstall logic
84
- async function main() {
85
- const version = getPackageVersion();
86
- const packageRoot = getPackageRoot();
87
-
88
- // Get the project directory where npm install was run
89
- const initCwd = process.env.INIT_CWD;
90
-
91
- // If INIT_CWD is not set or doesn't exist, just show welcome message
92
- if (!initCwd || !fs.existsSync(initCwd)) {
93
- console.log(`\nSpecCrew v${version}\n`);
94
- console.log("Run 'speccrew init' in your project directory to get started.\n");
95
- return;
96
- }
97
-
98
- // Count resources in the package
99
- const { agentCount, skillCount } = countPackageResources(packageRoot);
100
-
101
- // Detect IDE in the project directory
102
- const detectedIDEs = detectIDE(initCwd);
103
-
104
- // Display welcome banner
105
- console.log(`\nSpecCrew v${version}\n`);
106
-
107
- // Display installation summary
108
- console.log('Installation Summary:');
109
- console.log(` Project: ${initCwd}`);
110
-
111
- if (detectedIDEs.length === 0) {
112
- console.log(' IDE: Not detected (use --ide to specify)');
113
- } else if (detectedIDEs.length === 1) {
114
- console.log(` IDE: ${detectedIDEs[0].name} (${detectedIDEs[0].baseDir}/)`);
115
- } else {
116
- console.log(` IDE: ${detectedIDEs.map(i => i.name).join(', ')}`);
117
- }
118
-
119
- console.log(` Agents: ${agentCount} agents`);
120
- console.log(` Skills: ${skillCount} skills`);
121
- console.log(` Workspace: speccrew-workspace/`);
122
- console.log(` Docs: README + Getting Started guides\n`);
123
-
124
- // Non-interactive environment check
125
- if (!process.stdin.isTTY) {
126
- console.log("Run 'speccrew init' in your project directory to complete installation.\n");
127
- return;
128
- }
129
-
130
- // No IDE detected - prompt user to specify
131
- if (detectedIDEs.length === 0) {
132
- console.log('No supported IDE detected in your project directory.');
133
- console.log("Run 'speccrew init --ide <name>' to specify an IDE.");
134
- console.log('Supported IDEs: qoder, cursor, claude\n');
135
- return;
136
- }
137
-
138
- // Ask for confirmation
139
- try {
140
- const confirmed = await askConfirm('Proceed with installation? (Y/n) ');
141
-
142
- if (confirmed) {
143
- // Import and run init
144
- const { runInit } = require('../lib/commands/init.js');
145
- await runInit({ projectRoot: initCwd, skipConfirm: true });
146
- } else {
147
- console.log('\nInstallation skipped. You can run \'speccrew init\' later in your project directory.\n');
148
- }
149
- } catch (error) {
150
- console.log(`\nInstallation skipped. You can run 'speccrew init' later in your project directory.\n`);
151
- }
152
- }
153
-
154
- // Run main with error handling - postinstall failures should not block npm install
155
- main().catch(() => {
156
- console.log('\nPostinstall hook encountered an issue. You can run \'speccrew init\' manually.\n');
157
- });