ai-project-boilerplate 1.2.0 → 1.3.1

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/bin/cli.js CHANGED
@@ -36,6 +36,72 @@ function compareVersions(a, b) {
36
36
  return 0;
37
37
  }
38
38
 
39
+ function getPrefsPath() {
40
+ const os = require("os");
41
+ return path.join(os.homedir(), ".config", "ai-project", "prefs.json");
42
+ }
43
+
44
+ function loadPrefs() {
45
+ try {
46
+ return JSON.parse(fs.readFileSync(getPrefsPath(), "utf8"));
47
+ } catch {
48
+ return {};
49
+ }
50
+ }
51
+
52
+ function savePrefs(prefs) {
53
+ const prefsPath = getPrefsPath();
54
+ fs.mkdirSync(path.dirname(prefsPath), { recursive: true });
55
+ fs.writeFileSync(prefsPath, JSON.stringify(prefs, null, 2));
56
+ }
57
+
58
+ function checkPackageManager() {
59
+ const isPnpm = __filename.includes("pnpm");
60
+ if (isPnpm) return;
61
+
62
+ const prefs = loadPrefs();
63
+ if (prefs.suppressPnpmWarning) return;
64
+
65
+ const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
66
+ const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
67
+ const bold = (s) => `\x1b[1m${s}\x1b[0m`;
68
+ const dim = (s) => `\x1b[2m${s}\x1b[0m`;
69
+
70
+ const hasPnpm = (() => {
71
+ try { require("child_process").execSync("pnpm --version", { stdio: "ignore" }); return true; } catch { return false; }
72
+ })();
73
+
74
+ const strip = (s) => s.replace(/\x1b\[[0-9;]*m/g, "");
75
+
76
+ let lines;
77
+ if (hasPnpm) {
78
+ const cmd = bold(cyan("pnpm add -g ai-project-boilerplate"));
79
+ lines = [
80
+ ` ${bold(yellow("RECOMMENDED:"))} install via pnpm for best compatibility`,
81
+ ` Run ${cmd}`,
82
+ ` To suppress this warning: ${bold(cyan("ai-project --no-pnpm-warning"))}`,
83
+ ];
84
+ } else {
85
+ const installCmd = bold(cyan("npm install -g pnpm"));
86
+ const migrateCmd = bold(cyan("pnpm add -g ai-project-boilerplate"));
87
+ lines = [
88
+ ` ${bold(yellow("RECOMMENDED:"))} install via pnpm for best compatibility`,
89
+ ` 1. Install pnpm: ${installCmd}`,
90
+ ` 2. Then migrate: ${migrateCmd}`,
91
+ ` To suppress this warning: ${bold(cyan("ai-project --no-pnpm-warning"))}`,
92
+ ];
93
+ }
94
+
95
+ const width = Math.max(...lines.map(l => strip(l).length)) + 2;
96
+ const border = yellow("─".repeat(width));
97
+
98
+ console.error(`\n${yellow("┌")}${border}${yellow("┐")}`);
99
+ for (const line of lines) {
100
+ console.error(`${yellow("│")} ${line.padEnd(line.length + width - strip(line).length - 1)}${yellow("│")}`);
101
+ }
102
+ console.error(`${yellow("└")}${border}${yellow("┘")}\n`);
103
+ }
104
+
39
105
  async function checkForUpdate() {
40
106
  const latest = await fetchLatestVersion();
41
107
  if (latest && compareVersions(latest, CURRENT_VERSION) > 0) {
@@ -85,6 +151,18 @@ function copyTemplate(src, dest) {
85
151
  async function main() {
86
152
  const args = process.argv.slice(2);
87
153
 
154
+ // Handle --no-pnpm-warning
155
+ if (args[0] === '--no-pnpm-warning') {
156
+ const prefs = loadPrefs();
157
+ prefs.suppressPnpmWarning = true;
158
+ savePrefs(prefs);
159
+ console.log("pnpm warning suppressed. To re-enable, delete ~/.config/ai-project/prefs.json");
160
+ process.exit(0);
161
+ }
162
+
163
+ // Check package manager preference
164
+ checkPackageManager();
165
+
88
166
  // Always check for updates first
89
167
  await checkForUpdate();
90
168
 
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "ai-project-boilerplate",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "CLI to scaffold AI-collaborated projects with stage-based AI instruction files",
5
5
  "bin": {
6
6
  "ai-project": "bin/cli.js"
7
7
  },
8
+ "scripts": {
9
+ "preuninstall": "node scripts/preuninstall.js"
10
+ },
8
11
  "files": [
9
12
  "bin",
10
- "template"
13
+ "template",
14
+ "scripts/preuninstall.js"
11
15
  ],
12
16
  "keywords": [
13
17
  "ai",
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+ const os = require("os");
5
+
6
+ const prefsPath = path.join(os.homedir(), ".config", "ai-project", "prefs.json");
7
+ try {
8
+ fs.rmSync(prefsPath, { force: true });
9
+ } catch {
10
+ // silently ignore
11
+ }
@@ -14,35 +14,16 @@
14
14
  - `feature/<short-description>` — for new functionality
15
15
  - `fix/<short-description>` — for bug fixes
16
16
  ### PR Flow
17
- ```bash
18
- # 1. Create and switch to branch
19
- git checkout -b feature/<short-description>
20
-
21
- # 2. Implement, commit changes, then push
22
- git push -u origin feature/<short-description>
23
-
24
- # 3. Create PR
25
- gh pr create --title "<title>" --body "$(cat <<'EOF'
26
- ## Summary
27
- - <bullet points>
28
-
29
- ## Test plan
30
- - [ ] <manual test steps>
31
- EOF
32
- )"
33
-
34
- # 4. Check CI status
35
- gh pr checks
36
-
37
- # 5. Merge and delete branch after approval
38
- gh pr merge --squash --delete-branch
39
- ```
17
+ 1. Create a feature or fix branch and push to remote
18
+ 2. Open a pull request targeting `main` (e.g. via `gh pr create` or your Git host's UI)
19
+ 3. Check CI status (e.g. `gh pr checks`)
20
+ 4. Merge and delete the branch after approval (e.g. `gh pr merge --squash --delete-branch`)
40
21
 
41
22
  ### Release Flow
42
- ```bash
43
- # Bump version, tag, and create GitHub release
44
- ./scripts/release.sh <patch|minor|major>
45
- ```
23
+ 1. Bump the version (follow your project's versioning convention)
24
+ 2. Commit the version change and tag the commit (e.g. `vX.Y.Z`)
25
+ 3. Push the tag to remote
26
+ 4. Publish / deploy (e.g. create a release on your Git host, publish to a registry, deploy to an environment)
46
27
 
47
28
  ## Key Conventions
48
29
  <!-- Naming, file organization, patterns to follow -->