@k2works/claude-code-booster 0.14.0 → 0.16.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.
Files changed (79) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +42 -42
  3. package/bin/claude-code-booster +68 -68
  4. package/lib/assets/.claude/.mcp.json +45 -45
  5. package/lib/assets/.claude/COMMAND_TEMPLATE.md +122 -122
  6. package/lib/assets/.claude/README.md +140 -140
  7. package/lib/assets/.claude/commands/analysis-architecture.md +98 -98
  8. package/lib/assets/.claude/commands/analysis-data-model.md +94 -94
  9. package/lib/assets/.claude/commands/analysis-domain-model.md +101 -101
  10. package/lib/assets/.claude/commands/analysis-non-functional.md +103 -103
  11. package/lib/assets/.claude/commands/analysis-operation.md +104 -104
  12. package/lib/assets/.claude/commands/analysis-requirements.md +100 -100
  13. package/lib/assets/.claude/commands/analysis-tech-stack.md +113 -113
  14. package/lib/assets/.claude/commands/analysis-test-strategy.md +101 -101
  15. package/lib/assets/.claude/commands/analysis-ui-design.md +100 -100
  16. package/lib/assets/.claude/commands/analysis-usecases.md +100 -100
  17. package/lib/assets/.claude/commands/analysis.md +103 -103
  18. package/lib/assets/.claude/commands/dev-backend.md +144 -144
  19. package/lib/assets/.claude/commands/dev-frontend.md +126 -126
  20. package/lib/assets/.claude/commands/dev.md +96 -96
  21. package/lib/assets/.claude/commands/docs.md +213 -213
  22. package/lib/assets/.claude/commands/git-commit.md +47 -47
  23. package/lib/assets/.claude/commands/kill.md +108 -108
  24. package/lib/assets/.claude/commands/ops.md +507 -507
  25. package/lib/assets/.claude/commands/plan-github.md +212 -212
  26. package/lib/assets/.claude/commands/plan.md +237 -237
  27. package/lib/assets/.claude/commands/progress.md +171 -171
  28. package/lib/assets/.claude/settings.json +7 -7
  29. package/lib/assets/.claude/skills/ai-agent-guidelines/SKILL.md +119 -119
  30. package/lib/assets/.claude/skills/git-commit/SKILL.md +106 -106
  31. package/lib/assets/.devcontainer/devcontainer.json +34 -34
  32. package/lib/assets/.github/workflows/docker-publish.yml +77 -77
  33. package/lib/assets/.github/workflows/mkdocs.yml +39 -39
  34. package/lib/assets/AGENTS.md +94 -94
  35. package/lib/assets/CLAUDE.md +319 -319
  36. package/lib/assets/Dockerfile +97 -96
  37. package/lib/assets/README.md +234 -234
  38. package/lib/assets/docker-compose.yml +33 -31
  39. package/lib/assets/docs/assets/css/extra.css +29 -29
  40. package/lib/assets/docs/assets/js/extra.js +44 -44
  41. package/lib/assets/docs/index.md +14 -14
  42. package/lib/assets/docs/reference/Java/343/202/242/343/203/227/343/203/252/343/202/261/343/203/274/343/202/267/343/203/247/343/203/263/347/222/260/345/242/203/346/247/213/347/257/211/343/202/254/343/202/244/343/203/211.md +569 -569
  43. package/lib/assets/docs/reference/TypeScript/343/202/242/343/203/227/343/203/252/343/202/261/343/203/274/343/202/267/343/203/247/343/203/263/347/222/260/345/242/203/346/247/213/347/257/211/343/202/254/343/202/244/343/203/211.md +464 -464
  44. package/lib/assets/docs/reference/UI/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +445 -445
  45. package/lib/assets/docs/reference//343/202/210/343/201/204/343/202/275/343/203/225/343/203/210/343/202/246/343/202/247/343/202/242/343/201/250/343/201/257.md +219 -219
  46. package/lib/assets/docs/reference//343/202/242/343/203/274/343/202/255/343/203/206/343/202/257/343/203/201/343/203/243/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +2193 -2193
  47. package/lib/assets/docs/reference//343/202/244/343/203/263/343/203/225/343/203/251/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +1878 -1878
  48. package/lib/assets/docs/reference//343/202/250/343/202/257/343/202/271/343/203/210/343/203/252/343/203/274/343/203/240/343/203/227/343/203/255/343/202/260/343/203/251/343/203/237/343/203/263/343/202/260.md +554 -554
  49. package/lib/assets/docs/reference//343/202/263/343/203/274/343/203/207/343/202/243/343/203/263/343/202/260/343/201/250/343/203/206/343/202/271/343/203/210/343/202/254/343/202/244/343/203/211.md +703 -703
  50. package/lib/assets/docs/reference//343/203/206/343/202/271/343/203/210/346/210/246/347/225/245/343/202/254/343/202/244/343/203/211.md +1309 -1309
  51. package/lib/assets/docs/reference//343/203/207/343/203/274/343/202/277/343/203/242/343/203/207/343/203/253/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +311 -311
  52. package/lib/assets/docs/reference//343/203/211/343/203/241/343/202/244/343/203/263/343/203/242/343/203/207/343/203/253/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +599 -599
  53. package/lib/assets/docs/reference//343/203/246/343/203/274/343/202/271/343/202/261/343/203/274/343/202/271/344/275/234/346/210/220/343/202/254/343/202/244/343/203/211.md +671 -671
  54. package/lib/assets/docs/reference//343/203/252/343/203/252/343/203/274/343/202/271/343/203/273/343/202/244/343/203/206/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263/350/250/210/347/224/273/343/202/254/343/202/244/343/203/211.md +523 -523
  55. package/lib/assets/docs/reference//350/246/201/344/273/266/345/256/232/347/276/251/343/202/254/343/202/244/343/203/211.md +1248 -1248
  56. package/lib/assets/docs/reference//351/201/213/347/224/250/350/246/201/344/273/266/345/256/232/347/276/251/343/202/254/343/202/244/343/203/211.md +392 -392
  57. package/lib/assets/docs/reference//351/226/213/347/231/272/343/202/254/343/202/244/343/203/211.md +235 -235
  58. package/lib/assets/docs/reference//351/235/236/346/251/237/350/203/275/350/246/201/344/273/266/345/256/232/347/276/251/343/202/254/343/202/244/343/203/211.md +1230 -1230
  59. package/lib/assets/docs/template/ADR.md +30 -30
  60. package/lib/assets/docs/template/README.md +50 -50
  61. package/lib/assets/docs/template//343/201/276/343/201/232/343/201/223/343/202/214/343/202/222/350/252/255/343/202/202/343/201/206/343/203/252/343/202/271/343/203/210.md +12 -12
  62. package/lib/assets/docs/template//343/202/244/343/203/206/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263/345/256/214/344/272/206/345/240/261/345/221/212/346/233/270.md +58 -58
  63. package/lib/assets/docs/template//343/202/244/343/203/263/343/202/273/343/203/227/343/202/267/343/203/247/343/203/263/343/203/207/343/203/203/343/202/255.md +13 -13
  64. package/lib/assets/docs/template//345/256/214/345/205/250/345/275/242/345/274/217/343/201/256/343/203/246/343/203/274/343/202/271/343/202/261/343/203/274/343/202/271.md +68 -68
  65. package/lib/assets/docs/template//350/246/201/344/273/266/345/256/232/347/276/251.md +669 -669
  66. package/lib/assets/docs/template//350/250/255/350/250/210.md +163 -163
  67. package/lib/assets/flake.nix +22 -22
  68. package/lib/assets/gulpfile.js +18 -18
  69. package/lib/assets/mkdocs.yml +63 -63
  70. package/lib/assets/ops/docker/mkdoc/Dockerfile +19 -19
  71. package/lib/assets/ops/nix/environments/node/shell.nix +20 -20
  72. package/lib/assets/ops/nix/environments/python/shell.nix +20 -19
  73. package/lib/assets/ops/nix/shells/shell.nix +17 -17
  74. package/lib/assets/ops/scripts/journal.js +180 -180
  75. package/lib/assets/ops/scripts/mkdocs.js +113 -113
  76. package/lib/assets/package-lock.json +1640 -1640
  77. package/lib/assets/package.json +33 -33
  78. package/lib/gulpfile.js +37 -37
  79. package/package.json +40 -40
@@ -1,17 +1,17 @@
1
- { packages ? import <nixpkgs> {} }:
2
- packages.mkShell {
3
- buildInputs = with packages; [
4
- git
5
- curl
6
- wget
7
- vim
8
- tmux
9
- zip
10
- unzip
11
- ];
12
- # ホスト環境から完全に分離する
13
- pure = true;
14
- shellHook = ''
15
- echo "Welcome to the common development environment"
16
- '';
17
- }
1
+ { packages ? import <nixpkgs> {} }:
2
+ packages.mkShell {
3
+ buildInputs = with packages; [
4
+ git
5
+ curl
6
+ wget
7
+ vim
8
+ tmux
9
+ zip
10
+ unzip
11
+ ];
12
+ # ホスト環境から完全に分離する
13
+ pure = true;
14
+ shellHook = ''
15
+ echo "Welcome to the common development environment"
16
+ '';
17
+ }
@@ -1,180 +1,180 @@
1
- 'use strict';
2
-
3
- import fs from 'fs';
4
- import path from 'path';
5
- import { execSync } from 'child_process';
6
-
7
- // Increase buffer to safely handle large diffs/logs
8
- const MAX_BUFFER = 256 * 1024 * 1024; // 256 MB
9
-
10
- // Function to register the journal:generate task
11
- export default function(gulp) {
12
- // Helper function to generate journal for a specific date
13
- const generateJournalForDate = (dateStr, journalDir) => {
14
- // Format date as YYYYMMDD
15
- const dateObj = new Date(dateStr);
16
- const formattedDate = dateObj.toISOString().slice(0, 10).replace(/-/g, '');
17
-
18
- // File path for this date's journal
19
- const journalFile = path.join(journalDir, `${formattedDate}.md`);
20
-
21
- // Get commits for this date
22
- const commits = execSync(`git log --since="${dateStr} 00:00:00" --until="${dateStr} 23:59:59" --format="%h %s%n%b"`, { maxBuffer: MAX_BUFFER }).toString();
23
-
24
- // Skip if no commits
25
- if (!commits.trim()) {
26
- console.log(`No commits found for ${dateStr}`);
27
- return false;
28
- }
29
-
30
- // Get detailed changes for each commit on this date
31
- const commitHashesOutput = execSync(`git log --since="${dateStr} 00:00:00" --until="${dateStr} 23:59:59" --format="%h"`, { maxBuffer: MAX_BUFFER }).toString();
32
- const commitHashes = commitHashesOutput.split('\n').map(line => line.trim()).filter(Boolean);
33
-
34
- const detailedCommits = [];
35
-
36
- commitHashes.forEach(hash => {
37
- // Get commit details
38
- const commitMessage = execSync(`git show -s --format="%s%n%b" ${hash}`, { maxBuffer: MAX_BUFFER }).toString().trim();
39
-
40
- // Get files changed
41
- const filesChangedOutput = execSync(`git show --name-status ${hash}`, { maxBuffer: MAX_BUFFER }).toString();
42
- const filesChanged = filesChangedOutput.split('\n')
43
- .map(line => line.trim())
44
- .filter(line => /^[AMDRT]\s/.test(line));
45
-
46
- // Get code changes (diff) with robust handling for large diffs
47
- let diff = '';
48
- try {
49
- diff = execSync(`git show ${hash} --color=never`, { maxBuffer: MAX_BUFFER }).toString();
50
- } catch (e) {
51
- // Fallback to a summary if diff is too large or any error occurs
52
- const summary = execSync(`git show --stat --oneline ${hash} --color=never`, { maxBuffer: MAX_BUFFER }).toString();
53
- diff = `[Diff too large or failed to load. Showing summary instead.]\n\n${summary}`;
54
- }
55
-
56
- detailedCommits.push({
57
- hash,
58
- message: commitMessage,
59
- filesChanged,
60
- diff
61
- });
62
- });
63
-
64
- // Create journal content
65
- let content = `# 作業履歴 ${dateStr}\n\n`;
66
- content += `## 概要\n\n`;
67
- content += `${dateStr}の作業内容をまとめています。\n\n`;
68
-
69
- // Add each commit
70
- detailedCommits.forEach(commit => {
71
- content += `## コミット: ${commit.hash}\n\n`;
72
- content += `### メッセージ\n\n`;
73
- content += `\`\`\`\n${commit.message}\n\`\`\`\n\n`;
74
-
75
- content += `### 変更されたファイル\n\n`;
76
- commit.filesChanged.forEach(file => {
77
- content += `- ${file}\n`;
78
- });
79
- content += `\n`;
80
-
81
- content += `### 変更内容\n\n`;
82
- content += `\`\`\`diff\n${commit.diff}\n\`\`\`\n\n`;
83
-
84
- // Add PlantUML diagram placeholder if there are significant structural changes
85
- const hasStructuralChanges = commit.filesChanged.some(f =>
86
- f.endsWith('.rb') &&
87
- (f.includes('model') || f.includes('controller') || f.includes('service'))
88
- );
89
-
90
- if (hasStructuralChanges) {
91
- content += `### 構造変更\n\n`;
92
- content += `\`\`\`plantuml\n@startuml\n`;
93
- content += `' このコミットによる構造変更を表すダイアグラムをここに追加してください\n`;
94
- content += `' 例:\n`;
95
- content += `' class NewClass\n`;
96
- content += `' class ExistingClass\n`;
97
- content += `' NewClass --> ExistingClass\n`;
98
- content += `@enduml\n\`\`\`\n\n`;
99
- }
100
- });
101
-
102
- // Write to file
103
- fs.writeFileSync(journalFile, content);
104
- console.log(`Created journal entry for ${dateStr} at ${journalFile}`);
105
- return true;
106
- };
107
-
108
- // Journal generation task for a specific date
109
- gulp.task('journal:generate:date', (done) => {
110
- // Get date from command line arguments
111
- const args = process.argv.slice(3);
112
- const dateArg = args.find(arg => arg.startsWith('--date='));
113
-
114
- if (!dateArg) {
115
- console.error('Error: Please provide a date using --date=YYYY-MM-DD format');
116
- done();
117
- return;
118
- }
119
-
120
- const dateStr = dateArg.split('=')[1];
121
-
122
- // Validate date format
123
- if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
124
- console.error('Error: Date must be in YYYY-MM-DD format');
125
- done();
126
- return;
127
- }
128
-
129
- // Directory to store journal entries
130
- const journalDir = path.join('docs', 'journal');
131
-
132
- // Create directory if it doesn't exist
133
- if (!fs.existsSync(journalDir)) {
134
- fs.mkdirSync(journalDir, { recursive: true });
135
- }
136
-
137
- const result = generateJournalForDate(dateStr, journalDir);
138
-
139
- if (!result) {
140
- console.log(`No journal entry was created for ${dateStr}`);
141
- }
142
-
143
- done();
144
- });
145
-
146
- // Journal generation task for all dates
147
- gulp.task('journal:generate', (done) => {
148
- // Directory to store journal entries
149
- const journalDir = path.join('docs', 'journal');
150
-
151
- // Create directory if it doesn't exist
152
- if (!fs.existsSync(journalDir)) {
153
- fs.mkdirSync(journalDir, { recursive: true });
154
- }
155
-
156
- // Get all commit dates
157
- const datesOutput = execSync('git log --format=%ad --date=short', { maxBuffer: MAX_BUFFER }).toString();
158
- const dates = [...new Set(datesOutput.split('\n').map(line => line.trim()).filter(Boolean))];
159
-
160
- dates.forEach(dateStr => {
161
- // Format date as YYYYMMDD
162
- const dateObj = new Date(dateStr);
163
- const formattedDate = dateObj.toISOString().slice(0, 10).replace(/-/g, '');
164
-
165
- // File path for this date's journal
166
- const journalFile = path.join(journalDir, `${formattedDate}.md`);
167
-
168
- // Skip if file already exists
169
- if (fs.existsSync(journalFile)) {
170
- return;
171
- }
172
-
173
- // Generate journal for this date
174
- generateJournalForDate(dateStr, journalDir);
175
- });
176
-
177
- console.log("Journal generation completed.");
178
- done();
179
- });
180
- }
1
+ 'use strict';
2
+
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import { execSync } from 'child_process';
6
+
7
+ // Increase buffer to safely handle large diffs/logs
8
+ const MAX_BUFFER = 256 * 1024 * 1024; // 256 MB
9
+
10
+ // Function to register the journal:generate task
11
+ export default function(gulp) {
12
+ // Helper function to generate journal for a specific date
13
+ const generateJournalForDate = (dateStr, journalDir) => {
14
+ // Format date as YYYYMMDD
15
+ const dateObj = new Date(dateStr);
16
+ const formattedDate = dateObj.toISOString().slice(0, 10).replace(/-/g, '');
17
+
18
+ // File path for this date's journal
19
+ const journalFile = path.join(journalDir, `${formattedDate}.md`);
20
+
21
+ // Get commits for this date
22
+ const commits = execSync(`git log --since="${dateStr} 00:00:00" --until="${dateStr} 23:59:59" --format="%h %s%n%b"`, { maxBuffer: MAX_BUFFER }).toString();
23
+
24
+ // Skip if no commits
25
+ if (!commits.trim()) {
26
+ console.log(`No commits found for ${dateStr}`);
27
+ return false;
28
+ }
29
+
30
+ // Get detailed changes for each commit on this date
31
+ const commitHashesOutput = execSync(`git log --since="${dateStr} 00:00:00" --until="${dateStr} 23:59:59" --format="%h"`, { maxBuffer: MAX_BUFFER }).toString();
32
+ const commitHashes = commitHashesOutput.split('\n').map(line => line.trim()).filter(Boolean);
33
+
34
+ const detailedCommits = [];
35
+
36
+ commitHashes.forEach(hash => {
37
+ // Get commit details
38
+ const commitMessage = execSync(`git show -s --format="%s%n%b" ${hash}`, { maxBuffer: MAX_BUFFER }).toString().trim();
39
+
40
+ // Get files changed
41
+ const filesChangedOutput = execSync(`git show --name-status ${hash}`, { maxBuffer: MAX_BUFFER }).toString();
42
+ const filesChanged = filesChangedOutput.split('\n')
43
+ .map(line => line.trim())
44
+ .filter(line => /^[AMDRT]\s/.test(line));
45
+
46
+ // Get code changes (diff) with robust handling for large diffs
47
+ let diff = '';
48
+ try {
49
+ diff = execSync(`git show ${hash} --color=never`, { maxBuffer: MAX_BUFFER }).toString();
50
+ } catch (e) {
51
+ // Fallback to a summary if diff is too large or any error occurs
52
+ const summary = execSync(`git show --stat --oneline ${hash} --color=never`, { maxBuffer: MAX_BUFFER }).toString();
53
+ diff = `[Diff too large or failed to load. Showing summary instead.]\n\n${summary}`;
54
+ }
55
+
56
+ detailedCommits.push({
57
+ hash,
58
+ message: commitMessage,
59
+ filesChanged,
60
+ diff
61
+ });
62
+ });
63
+
64
+ // Create journal content
65
+ let content = `# 作業履歴 ${dateStr}\n\n`;
66
+ content += `## 概要\n\n`;
67
+ content += `${dateStr}の作業内容をまとめています。\n\n`;
68
+
69
+ // Add each commit
70
+ detailedCommits.forEach(commit => {
71
+ content += `## コミット: ${commit.hash}\n\n`;
72
+ content += `### メッセージ\n\n`;
73
+ content += `\`\`\`\n${commit.message}\n\`\`\`\n\n`;
74
+
75
+ content += `### 変更されたファイル\n\n`;
76
+ commit.filesChanged.forEach(file => {
77
+ content += `- ${file}\n`;
78
+ });
79
+ content += `\n`;
80
+
81
+ content += `### 変更内容\n\n`;
82
+ content += `\`\`\`diff\n${commit.diff}\n\`\`\`\n\n`;
83
+
84
+ // Add PlantUML diagram placeholder if there are significant structural changes
85
+ const hasStructuralChanges = commit.filesChanged.some(f =>
86
+ f.endsWith('.rb') &&
87
+ (f.includes('model') || f.includes('controller') || f.includes('service'))
88
+ );
89
+
90
+ if (hasStructuralChanges) {
91
+ content += `### 構造変更\n\n`;
92
+ content += `\`\`\`plantuml\n@startuml\n`;
93
+ content += `' このコミットによる構造変更を表すダイアグラムをここに追加してください\n`;
94
+ content += `' 例:\n`;
95
+ content += `' class NewClass\n`;
96
+ content += `' class ExistingClass\n`;
97
+ content += `' NewClass --> ExistingClass\n`;
98
+ content += `@enduml\n\`\`\`\n\n`;
99
+ }
100
+ });
101
+
102
+ // Write to file
103
+ fs.writeFileSync(journalFile, content);
104
+ console.log(`Created journal entry for ${dateStr} at ${journalFile}`);
105
+ return true;
106
+ };
107
+
108
+ // Journal generation task for a specific date
109
+ gulp.task('journal:generate:date', (done) => {
110
+ // Get date from command line arguments
111
+ const args = process.argv.slice(3);
112
+ const dateArg = args.find(arg => arg.startsWith('--date='));
113
+
114
+ if (!dateArg) {
115
+ console.error('Error: Please provide a date using --date=YYYY-MM-DD format');
116
+ done();
117
+ return;
118
+ }
119
+
120
+ const dateStr = dateArg.split('=')[1];
121
+
122
+ // Validate date format
123
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
124
+ console.error('Error: Date must be in YYYY-MM-DD format');
125
+ done();
126
+ return;
127
+ }
128
+
129
+ // Directory to store journal entries
130
+ const journalDir = path.join('docs', 'journal');
131
+
132
+ // Create directory if it doesn't exist
133
+ if (!fs.existsSync(journalDir)) {
134
+ fs.mkdirSync(journalDir, { recursive: true });
135
+ }
136
+
137
+ const result = generateJournalForDate(dateStr, journalDir);
138
+
139
+ if (!result) {
140
+ console.log(`No journal entry was created for ${dateStr}`);
141
+ }
142
+
143
+ done();
144
+ });
145
+
146
+ // Journal generation task for all dates
147
+ gulp.task('journal:generate', (done) => {
148
+ // Directory to store journal entries
149
+ const journalDir = path.join('docs', 'journal');
150
+
151
+ // Create directory if it doesn't exist
152
+ if (!fs.existsSync(journalDir)) {
153
+ fs.mkdirSync(journalDir, { recursive: true });
154
+ }
155
+
156
+ // Get all commit dates
157
+ const datesOutput = execSync('git log --format=%ad --date=short', { maxBuffer: MAX_BUFFER }).toString();
158
+ const dates = [...new Set(datesOutput.split('\n').map(line => line.trim()).filter(Boolean))];
159
+
160
+ dates.forEach(dateStr => {
161
+ // Format date as YYYYMMDD
162
+ const dateObj = new Date(dateStr);
163
+ const formattedDate = dateObj.toISOString().slice(0, 10).replace(/-/g, '');
164
+
165
+ // File path for this date's journal
166
+ const journalFile = path.join(journalDir, `${formattedDate}.md`);
167
+
168
+ // Skip if file already exists
169
+ if (fs.existsSync(journalFile)) {
170
+ return;
171
+ }
172
+
173
+ // Generate journal for this date
174
+ generateJournalForDate(dateStr, journalDir);
175
+ });
176
+
177
+ console.log("Journal generation completed.");
178
+ done();
179
+ });
180
+ }
@@ -1,114 +1,114 @@
1
- 'use strict';
2
-
3
- import {execSync} from 'child_process';
4
- import fs from 'fs';
5
- import path from 'path';
6
-
7
- /**
8
- * @type {boolean} Windows環境かどうかをチェック
9
- */
10
- const isWindows = process.platform === 'win32';
11
-
12
- // Function to register the mkdocs:serve task
13
- export default function (gulp) {
14
- // Helper function to remove site directory
15
- const removeSiteDirectory = () => {
16
- const siteDir = path.join(process.cwd(), 'site');
17
- if (fs.existsSync(siteDir)) {
18
- console.log('Removing existing site directory...');
19
- fs.rmSync(siteDir, {recursive: true, force: true});
20
- console.log('Site directory removed successfully!');
21
- }
22
- };
23
-
24
- // MkDocs serve task
25
- gulp.task('mkdocs:serve', (done) => {
26
- try {
27
- console.log('Starting MkDocs server using Docker Compose...');
28
-
29
- // Normalize DOCKER_HOST on Windows if it's incorrect
30
- const env = { ...process.env };
31
- if (isWindows && env.DOCKER_HOST === 'npipe://./pipe/docker_engine') {
32
- env.DOCKER_HOST = 'npipe:////./pipe/docker_engine';
33
- }
34
-
35
- // Execute docker-compose up command to start mkdocs service
36
- execSync('docker compose up -d mkdocs', {stdio: 'inherit', env});
37
-
38
- console.log('\nMkDocs server started successfully!');
39
- console.log('Documentation is now available at http://localhost:8000');
40
- console.log('Press Ctrl+C to stop the server when done.');
41
-
42
- done();
43
- } catch (error) {
44
- console.error('Error starting MkDocs server:', error.message);
45
- done(error);
46
- }
47
- });
48
-
49
- // MkDocs build task
50
- gulp.task('mkdocs:build', (done) => {
51
- try {
52
- console.log('Building MkDocs documentation...');
53
-
54
- // Normalize DOCKER_HOST on Windows if it's incorrect
55
- const env = { ...process.env };
56
- if (isWindows && env.DOCKER_HOST === 'npipe://./pipe/docker_engine') {
57
- env.DOCKER_HOST = 'npipe:////./pipe/docker_engine';
58
- }
59
-
60
- // Remove existing site directory before building
61
- removeSiteDirectory();
62
-
63
- // Execute docker-compose run command to build mkdocs documentation
64
- execSync('docker compose run --rm mkdocs mkdocs build', {stdio: 'inherit', env});
65
-
66
- console.log('\nMkDocs documentation built successfully!');
67
-
68
- done();
69
- } catch (error) {
70
- console.error('Error building MkDocs documentation:', error.message);
71
- done(error);
72
- }
73
- });
74
-
75
- // MkDocs stop task
76
- gulp.task('mkdocs:stop', (done) => {
77
- try {
78
- console.log('Stopping MkDocs server...');
79
-
80
- // Normalize DOCKER_HOST on Windows if it's incorrect
81
- const env = { ...process.env };
82
- if (isWindows && env.DOCKER_HOST === 'npipe://./pipe/docker_engine') {
83
- env.DOCKER_HOST = 'npipe:////./pipe/docker_engine';
84
- }
85
-
86
- // Execute docker-compose down command to stop mkdocs service
87
- execSync('docker compose down', {stdio: 'inherit', env});
88
-
89
- console.log('MkDocs server stopped successfully!');
90
-
91
- done();
92
- } catch (error) {
93
- console.error('Error stopping MkDocs server:', error.message);
94
- done(error);
95
- }
96
- });
97
-
98
- // MkDocs open task
99
- gulp.task('mkdocs:open', (done) => {
100
- try {
101
- console.log('Opening MkDocs server...');
102
-
103
- const command = isWindows ? 'start http://localhost:8000' : 'open http://localhost:8000';
104
- execSync(command, {stdio: 'inherit'});
105
-
106
- console.log('MkDocs server opened successfully!');
107
-
108
- done();
109
- } catch (error) {
110
- console.error('Error opening MkDocs server:', error.message);
111
- done(error);
112
- }
113
- });
1
+ 'use strict';
2
+
3
+ import {execSync} from 'child_process';
4
+ import fs from 'fs';
5
+ import path from 'path';
6
+
7
+ /**
8
+ * @type {boolean} Windows環境かどうかをチェック
9
+ */
10
+ const isWindows = process.platform === 'win32';
11
+
12
+ // Function to register the mkdocs:serve task
13
+ export default function (gulp) {
14
+ // Helper function to remove site directory
15
+ const removeSiteDirectory = () => {
16
+ const siteDir = path.join(process.cwd(), 'site');
17
+ if (fs.existsSync(siteDir)) {
18
+ console.log('Removing existing site directory...');
19
+ fs.rmSync(siteDir, {recursive: true, force: true});
20
+ console.log('Site directory removed successfully!');
21
+ }
22
+ };
23
+
24
+ // MkDocs serve task
25
+ gulp.task('mkdocs:serve', (done) => {
26
+ try {
27
+ console.log('Starting MkDocs server using Docker Compose...');
28
+
29
+ // Normalize DOCKER_HOST on Windows if it's incorrect
30
+ const env = { ...process.env };
31
+ if (isWindows && env.DOCKER_HOST === 'npipe://./pipe/docker_engine') {
32
+ env.DOCKER_HOST = 'npipe:////./pipe/docker_engine';
33
+ }
34
+
35
+ // Execute docker-compose up command to start mkdocs service
36
+ execSync('docker compose up -d mkdocs', {stdio: 'inherit', env});
37
+
38
+ console.log('\nMkDocs server started successfully!');
39
+ console.log('Documentation is now available at http://localhost:8000');
40
+ console.log('Press Ctrl+C to stop the server when done.');
41
+
42
+ done();
43
+ } catch (error) {
44
+ console.error('Error starting MkDocs server:', error.message);
45
+ done(error);
46
+ }
47
+ });
48
+
49
+ // MkDocs build task
50
+ gulp.task('mkdocs:build', (done) => {
51
+ try {
52
+ console.log('Building MkDocs documentation...');
53
+
54
+ // Normalize DOCKER_HOST on Windows if it's incorrect
55
+ const env = { ...process.env };
56
+ if (isWindows && env.DOCKER_HOST === 'npipe://./pipe/docker_engine') {
57
+ env.DOCKER_HOST = 'npipe:////./pipe/docker_engine';
58
+ }
59
+
60
+ // Remove existing site directory before building
61
+ removeSiteDirectory();
62
+
63
+ // Execute docker-compose run command to build mkdocs documentation
64
+ execSync('docker compose run --rm mkdocs mkdocs build', {stdio: 'inherit', env});
65
+
66
+ console.log('\nMkDocs documentation built successfully!');
67
+
68
+ done();
69
+ } catch (error) {
70
+ console.error('Error building MkDocs documentation:', error.message);
71
+ done(error);
72
+ }
73
+ });
74
+
75
+ // MkDocs stop task
76
+ gulp.task('mkdocs:stop', (done) => {
77
+ try {
78
+ console.log('Stopping MkDocs server...');
79
+
80
+ // Normalize DOCKER_HOST on Windows if it's incorrect
81
+ const env = { ...process.env };
82
+ if (isWindows && env.DOCKER_HOST === 'npipe://./pipe/docker_engine') {
83
+ env.DOCKER_HOST = 'npipe:////./pipe/docker_engine';
84
+ }
85
+
86
+ // Execute docker-compose down command to stop mkdocs service
87
+ execSync('docker compose down', {stdio: 'inherit', env});
88
+
89
+ console.log('MkDocs server stopped successfully!');
90
+
91
+ done();
92
+ } catch (error) {
93
+ console.error('Error stopping MkDocs server:', error.message);
94
+ done(error);
95
+ }
96
+ });
97
+
98
+ // MkDocs open task
99
+ gulp.task('mkdocs:open', (done) => {
100
+ try {
101
+ console.log('Opening MkDocs server...');
102
+
103
+ const command = isWindows ? 'start http://localhost:8000' : 'open http://localhost:8000';
104
+ execSync(command, {stdio: 'inherit'});
105
+
106
+ console.log('MkDocs server opened successfully!');
107
+
108
+ done();
109
+ } catch (error) {
110
+ console.error('Error opening MkDocs server:', error.message);
111
+ done(error);
112
+ }
113
+ });
114
114
  }