spec-feature 1.0.0 → 1.0.2

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 (3) hide show
  1. package/README.md +44 -0
  2. package/bin/cli.js +28 -6
  3. package/package.json +10 -2
package/README.md CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  SpecFeature is a sequential process for preparing and maintaining features: from formulating business context to verifying completed tasks. It helps synchronize product, engineering, and QA teams, reduce the number of "on-the-fly" changes, and establish success criteria before development begins. All artifacts are generated by LLM based on a single input context.
4
4
 
5
+ ## Installation
6
+
7
+ ### Using npx (recommended)
8
+
9
+ The easiest way to use SpecFeature is through npx:
10
+
11
+ ```bash
12
+ # Initialize SpecFeature in current directory
13
+ npx spec-feature init
14
+
15
+ # Initialize SpecFeature with custom folder name
16
+ npx spec-feature init my-project-docs
17
+ ```
18
+
19
+ This will create a `spec` folder (or your custom folder name) with the complete SpecFeature structure ready to use.
20
+
21
+ ### Global installation
22
+
23
+ For frequent use, you can install SpecFeature globally:
24
+
25
+ ```bash
26
+ npm install -g spec-feature
27
+
28
+ # Then use it anywhere
29
+ spec-feature init
30
+ spec-feature init my-features
31
+ ```
32
+
33
+ ### Local installation
34
+
35
+ To install SpecFeature in your project:
36
+
37
+ ```bash
38
+ npm install spec-feature
39
+
40
+ # Add to package.json scripts
41
+ {
42
+ "scripts": {
43
+ "init-spec": "spec-feature init",
44
+ "init-docs": "spec-feature init documentation"
45
+ }
46
+ }
47
+ ```
48
+
5
49
  ## Directory structure `/spec`
6
50
 
7
51
  ### Initial structure (created during initialization)
package/bin/cli.js CHANGED
@@ -12,21 +12,43 @@ const command = args[0];
12
12
 
13
13
  if (command === "init") {
14
14
  const targetDir = process.cwd();
15
+ const folderName = args[1] || "spec"; // Use provided folder name or default to "spec"
16
+ const destinationDir = path.join(targetDir, folderName);
15
17
  const templatesDir = path.join(__dirname, "../spec");
16
18
 
19
+ function copyRecursive(src, dest) {
20
+ const stat = fs.statSync(src);
21
+
22
+ if (stat.isDirectory()) {
23
+ if (!fs.existsSync(dest)) {
24
+ fs.mkdirSync(dest, { recursive: true });
25
+ }
26
+ fs.readdirSync(src).forEach(file => {
27
+ copyRecursive(path.join(src, file), path.join(dest, file));
28
+ });
29
+ } else {
30
+ fs.copyFileSync(src, dest);
31
+ }
32
+ }
33
+
34
+ // Create the destination directory if it doesn't exist
35
+ if (!fs.existsSync(destinationDir)) {
36
+ fs.mkdirSync(destinationDir, { recursive: true });
37
+ }
38
+
17
39
  fs.readdirSync(templatesDir).forEach(file => {
18
40
  const src = path.join(templatesDir, file);
19
- const dest = path.join(targetDir, file);
41
+ const dest = path.join(destinationDir, file);
20
42
 
21
43
  if (!fs.existsSync(dest)) {
22
- fs.copyFileSync(src, dest);
23
- console.log(`Created file: ${file}`);
44
+ copyRecursive(src, dest);
45
+ console.log(`Created: ${folderName}/${file}`);
24
46
  } else {
25
- console.log(`Skipped (already exists): ${file}`);
47
+ console.log(`Skipped (already exists): ${folderName}/${file}`);
26
48
  }
27
49
  });
28
50
 
29
- console.log("✅ SpecFeature initialized!");
51
+ console.log(`✅ SpecFeature initialized in '${folderName}' folder!`);
30
52
  } else {
31
- console.log("Usage: npx spec-feature init");
53
+ console.log("Usage: npx spec-feature init [folder-name]");
32
54
  }
package/package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "spec-feature",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "bin": {
5
5
  "spec-feature": "./bin/cli.js"
6
6
  },
7
- "type": "module"
7
+ "type": "module",
8
+ "keywords": [
9
+ "spec-feature",
10
+ "spec",
11
+ "feature",
12
+ "sdd",
13
+ "ai",
14
+ "llm"
15
+ ]
8
16
  }