aiwcli 0.11.1 → 0.12.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/dist/commands/clear.d.ts +8 -0
- package/dist/commands/clear.js +86 -0
- package/dist/lib/bmad-installer.d.ts +2 -27
- package/dist/lib/bmad-installer.js +3 -43
- package/dist/lib/claude-settings-types.d.ts +2 -1
- package/dist/lib/env-compat.d.ts +0 -8
- package/dist/lib/env-compat.js +0 -12
- package/dist/lib/git/index.d.ts +0 -1
- package/dist/lib/gitignore-manager.d.ts +0 -2
- package/dist/lib/gitignore-manager.js +1 -1
- package/dist/lib/hooks-merger.d.ts +1 -15
- package/dist/lib/hooks-merger.js +1 -1
- package/dist/lib/index.d.ts +3 -7
- package/dist/lib/index.js +3 -11
- package/dist/lib/output.d.ts +2 -1
- package/dist/lib/settings-hierarchy.d.ts +1 -13
- package/dist/lib/settings-hierarchy.js +1 -1
- package/dist/lib/template-installer.d.ts +5 -9
- package/dist/lib/template-installer.js +3 -13
- package/dist/lib/template-linter.d.ts +3 -10
- package/dist/lib/template-linter.js +2 -2
- package/dist/lib/template-resolver.d.ts +6 -0
- package/dist/lib/template-resolver.js +10 -0
- package/dist/lib/template-settings-reconstructor.d.ts +1 -1
- package/dist/lib/template-settings-reconstructor.js +17 -24
- package/dist/lib/terminal.d.ts +3 -14
- package/dist/lib/terminal.js +0 -4
- package/dist/lib/version.d.ts +2 -11
- package/dist/lib/version.js +3 -3
- package/dist/lib/windsurf-hooks-merger.d.ts +1 -15
- package/dist/lib/windsurf-hooks-merger.js +1 -1
- package/dist/templates/_shared/.codex/workflows/handoff.md +1 -1
- package/dist/templates/_shared/.windsurf/workflows/handoff.md +1 -1
- package/dist/templates/_shared/hooks-ts/session_end.ts +75 -4
- package/dist/templates/_shared/hooks-ts/session_start.ts +11 -13
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +6 -8
- package/dist/templates/_shared/lib-ts/CLAUDE.md +56 -7
- package/dist/templates/_shared/lib-ts/base/hook-utils.ts +176 -29
- package/dist/templates/_shared/lib-ts/base/logger.ts +1 -1
- package/dist/templates/_shared/lib-ts/base/state-io.ts +11 -2
- package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +181 -165
- package/dist/templates/_shared/lib-ts/context/plan-manager.ts +14 -13
- package/dist/templates/_shared/lib-ts/handoff/handoff-reader.ts +3 -2
- package/dist/templates/_shared/lib-ts/package.json +1 -2
- package/dist/templates/_shared/lib-ts/templates/plan-context.ts +27 -34
- package/dist/templates/_shared/lib-ts/types.ts +17 -2
- package/dist/templates/_shared/scripts/resume_handoff.ts +4 -4
- package/dist/templates/_shared/scripts/save_handoff.ts +7 -7
- package/dist/templates/_shared/scripts/status_line.ts +104 -71
- package/dist/templates/_shared/workflows/handoff.md +1 -1
- package/dist/templates/cc-native/.claude/settings.json +182 -175
- package/dist/templates/cc-native/_cc-native/agents/CLAUDE.md +23 -1
- package/dist/templates/cc-native/_cc-native/agents/plan-questions/PLAN-QUESTIONER.md +70 -0
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +6 -1
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +142 -111
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +54 -0
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +52 -0
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +53 -0
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +19 -19
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +6 -5
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +114 -83
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +107 -10
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/corroboration.ts +6 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +0 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/orchestrator.ts +40 -219
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +41 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-questions.ts +102 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/agent.ts +26 -227
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/base/base-agent.ts +217 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/index.ts +4 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/claude-agent.ts +65 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/codex-agent.ts +185 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/gemini-agent.ts +39 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/orchestrator-claude-agent.ts +195 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/schemas.ts +201 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/types.ts +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +17 -16
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +13 -108
- package/dist/templates/cc-native/_cc-native/lib-ts/verdict.ts +3 -3
- package/dist/templates/cc-native/_cc-native/plan-review.config.json +2 -14
- package/oclif.manifest.json +1 -1
- package/package.json +1 -2
- package/dist/templates/cc-native/_cc-native/hooks/add_plan_context.ts +0 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/codex.ts +0 -130
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/gemini.ts +0 -107
- /package/dist/templates/cc-native/_cc-native/agents/{ARCH-EVOLUTION.md → plan-review/ARCH-EVOLUTION.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{ARCH-PATTERNS.md → plan-review/ARCH-PATTERNS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{ARCH-STRUCTURE.md → plan-review/ARCH-STRUCTURE.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{ASSUMPTION-TRACER.md → plan-review/ASSUMPTION-TRACER.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{CLARITY-AUDITOR.md → plan-review/CLARITY-AUDITOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{COMPLETENESS-FEASIBILITY.md → plan-review/COMPLETENESS-FEASIBILITY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{COMPLETENESS-GAPS.md → plan-review/COMPLETENESS-GAPS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{COMPLETENESS-ORDERING.md → plan-review/COMPLETENESS-ORDERING.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{CONSTRAINT-VALIDATOR.md → plan-review/CONSTRAINT-VALIDATOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DESIGN-ADR-VALIDATOR.md → plan-review/DESIGN-ADR-VALIDATOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DESIGN-SCALE-MATCHER.md → plan-review/DESIGN-SCALE-MATCHER.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DEVILS-ADVOCATE.md → plan-review/DEVILS-ADVOCATE.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DOCUMENTATION-PHILOSOPHY.md → plan-review/DOCUMENTATION-PHILOSOPHY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{HANDOFF-READINESS.md → plan-review/HANDOFF-READINESS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{HIDDEN-COMPLEXITY.md → plan-review/HIDDEN-COMPLEXITY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{INCREMENTAL-DELIVERY.md → plan-review/INCREMENTAL-DELIVERY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-DEPENDENCY.md → plan-review/RISK-DEPENDENCY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-FMEA.md → plan-review/RISK-FMEA.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-PREMORTEM.md → plan-review/RISK-PREMORTEM.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-REVERSIBILITY.md → plan-review/RISK-REVERSIBILITY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{SCOPE-BOUNDARY.md → plan-review/SCOPE-BOUNDARY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{SIMPLICITY-GUARDIAN.md → plan-review/SIMPLICITY-GUARDIAN.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{SKEPTIC.md → plan-review/SKEPTIC.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-BEHAVIOR-AUDITOR.md → plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-CHARACTERIZATION.md → plan-review/TESTDRIVEN-CHARACTERIZATION.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-FIRST-VALIDATOR.md → plan-review/TESTDRIVEN-FIRST-VALIDATOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-PYRAMID-ANALYZER.md → plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TRADEOFF-COSTS.md → plan-review/TRADEOFF-COSTS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TRADEOFF-STAKEHOLDERS.md → plan-review/TRADEOFF-STAKEHOLDERS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{VERIFY-COVERAGE.md → plan-review/VERIFY-COVERAGE.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{VERIFY-STRENGTH.md → plan-review/VERIFY-STRENGTH.md} +0 -0
package/dist/commands/clear.d.ts
CHANGED
|
@@ -65,4 +65,12 @@ export default class ClearCommand extends BaseCommand {
|
|
|
65
65
|
* Settings reconstruction handles hooks/permissions; this only strips the methods object.
|
|
66
66
|
*/
|
|
67
67
|
private removeMethodEntries;
|
|
68
|
+
/**
|
|
69
|
+
* Remove shared IDE content (e.g., command files from _shared template).
|
|
70
|
+
*
|
|
71
|
+
* When all templates are removed, files installed from _shared/.claude/ and
|
|
72
|
+
* _shared/.windsurf/ should also be removed. Walks the shared template source
|
|
73
|
+
* and deletes matching files from the target, then prunes empty directories.
|
|
74
|
+
*/
|
|
75
|
+
private removeSharedIdeContent;
|
|
68
76
|
}
|
package/dist/commands/clear.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Flags } from '@oclif/core';
|
|
|
5
5
|
import BaseCommand from '../lib/base-command.js';
|
|
6
6
|
import { computeGitignoreRemovals, pruneGitignoreStaleEntries, removeGitignoreEntries } from '../lib/gitignore-manager.js';
|
|
7
7
|
import { pathExists } from '../lib/paths.js';
|
|
8
|
+
import { getSharedTemplatePath } from '../lib/template-resolver.js';
|
|
8
9
|
import { reconstructIdeSettings } from '../lib/template-settings-reconstructor.js';
|
|
9
10
|
import { EXIT_CODES } from '../types/exit-codes.js';
|
|
10
11
|
/**
|
|
@@ -187,6 +188,53 @@ async function shouldDeleteIdeFolder(targetDir, ideFolder) {
|
|
|
187
188
|
async function removeDirectory(dir) {
|
|
188
189
|
await fs.rm(dir, { force: true, recursive: true });
|
|
189
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Recursively remove files from targetDir that match files in sourceDir.
|
|
193
|
+
* Only removes files that exist in the source template — user-created files are preserved.
|
|
194
|
+
* Prunes empty directories after file removal.
|
|
195
|
+
*
|
|
196
|
+
* @param sourceDir - Template source directory to match against
|
|
197
|
+
* @param targetDir - Target directory to remove matching files from
|
|
198
|
+
*/
|
|
199
|
+
async function removeMatchingFiles(sourceDir, targetDir) {
|
|
200
|
+
let entries;
|
|
201
|
+
try {
|
|
202
|
+
entries = await fs.readdir(sourceDir, { withFileTypes: true });
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
for (const entry of entries) {
|
|
208
|
+
const sourcePath = join(sourceDir, entry.name);
|
|
209
|
+
const targetPath = join(targetDir, entry.name);
|
|
210
|
+
if (entry.isDirectory()) {
|
|
211
|
+
// Recurse into subdirectories
|
|
212
|
+
await removeMatchingFiles(sourcePath, targetPath); // eslint-disable-line no-await-in-loop
|
|
213
|
+
}
|
|
214
|
+
else if (entry.isFile()) {
|
|
215
|
+
// Skip settings files — handled by reconstruction
|
|
216
|
+
if (entry.name === 'settings.json' || entry.name === 'hooks.json')
|
|
217
|
+
continue;
|
|
218
|
+
// Remove matching file from target
|
|
219
|
+
try {
|
|
220
|
+
await fs.rm(targetPath, { force: true }); // eslint-disable-line no-await-in-loop
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
// File doesn't exist or can't be removed
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Prune target directory if now empty
|
|
228
|
+
try {
|
|
229
|
+
const remaining = await fs.readdir(targetDir);
|
|
230
|
+
if (remaining.length === 0) {
|
|
231
|
+
await fs.rmdir(targetDir);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// Directory doesn't exist or can't be accessed
|
|
236
|
+
}
|
|
237
|
+
}
|
|
190
238
|
/**
|
|
191
239
|
* Clear workflow folders, output folders, IDE method folders, and update configurations.
|
|
192
240
|
*/
|
|
@@ -497,6 +545,25 @@ export default class ClearCommand extends BaseCommand {
|
|
|
497
545
|
}
|
|
498
546
|
}
|
|
499
547
|
}
|
|
548
|
+
// Remove shared IDE content when no templates remain
|
|
549
|
+
if (methodsToRemove.length > 0) {
|
|
550
|
+
const allMethodsAfterRemove = await getInstalledMethodNames(targetDir);
|
|
551
|
+
const remainingAfterRemove = [...allMethodsAfterRemove].filter(m => !methodsToRemove.includes(m));
|
|
552
|
+
if (remainingAfterRemove.length === 0) {
|
|
553
|
+
await this.removeSharedIdeContent(targetDir);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
// Clean up backup files created during reconstruction
|
|
557
|
+
const backupCleanups = Object.values(IDE_FOLDERS).map(async (ide) => {
|
|
558
|
+
const backupPath = join(targetDir, ide.root, `${ide.settingsFile}.backup`);
|
|
559
|
+
try {
|
|
560
|
+
await fs.rm(backupPath, { force: true });
|
|
561
|
+
}
|
|
562
|
+
catch {
|
|
563
|
+
// Backup doesn't exist or can't be removed
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
await Promise.all(backupCleanups);
|
|
500
567
|
// Check if IDE folders should be fully deleted (empty settings + empty subfolders)
|
|
501
568
|
let removedClaudeDir = false;
|
|
502
569
|
let removedWindsurfDir = false;
|
|
@@ -920,4 +987,23 @@ export default class ClearCommand extends BaseCommand {
|
|
|
920
987
|
});
|
|
921
988
|
await Promise.all(ops);
|
|
922
989
|
}
|
|
990
|
+
/**
|
|
991
|
+
* Remove shared IDE content (e.g., command files from _shared template).
|
|
992
|
+
*
|
|
993
|
+
* When all templates are removed, files installed from _shared/.claude/ and
|
|
994
|
+
* _shared/.windsurf/ should also be removed. Walks the shared template source
|
|
995
|
+
* and deletes matching files from the target, then prunes empty directories.
|
|
996
|
+
*/
|
|
997
|
+
async removeSharedIdeContent(targetDir) {
|
|
998
|
+
const sharedTemplatePath = getSharedTemplatePath();
|
|
999
|
+
for (const ide of Object.values(IDE_FOLDERS)) {
|
|
1000
|
+
const sharedIdeFolder = join(sharedTemplatePath, ide.root);
|
|
1001
|
+
if (!(await pathExists(sharedIdeFolder)))
|
|
1002
|
+
continue; // eslint-disable-line no-await-in-loop
|
|
1003
|
+
const targetIdeFolder = join(targetDir, ide.root);
|
|
1004
|
+
if (!(await pathExists(targetIdeFolder)))
|
|
1005
|
+
continue; // eslint-disable-line no-await-in-loop
|
|
1006
|
+
await removeMatchingFiles(sharedIdeFolder, targetIdeFolder); // eslint-disable-line no-await-in-loop
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
923
1009
|
}
|
|
@@ -1,38 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* BMAD installation configuration
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
interface BmadInstallConfig {
|
|
5
5
|
projectName: string;
|
|
6
6
|
targetDir: string;
|
|
7
7
|
username: string;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Generate core module configuration YAML
|
|
11
|
-
*/
|
|
12
|
-
export declare function generateCoreConfig(username: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Generate BMM module configuration YAML
|
|
15
|
-
*/
|
|
16
|
-
export declare function generateBmmConfig(projectName: string, username: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Generate installation manifest YAML
|
|
19
|
-
*/
|
|
20
|
-
export declare function generateManifest(): string;
|
|
21
9
|
/**
|
|
22
10
|
* Install BMAD structure in target directory
|
|
23
11
|
*/
|
|
24
12
|
export declare function installBmad(config: BmadInstallConfig): Promise<void>;
|
|
25
|
-
|
|
26
|
-
* Generate BMAD configuration files in the target directory.
|
|
27
|
-
* Used as a post-install hook after template installation.
|
|
28
|
-
*
|
|
29
|
-
* @param targetDir - Directory where BMAD was installed
|
|
30
|
-
* @param username - Username for configuration
|
|
31
|
-
* @param projectName - Project name for configuration
|
|
32
|
-
*/
|
|
33
|
-
export declare function generateBmadConfigs(targetDir: string, username: string, projectName: string): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Detect username from git config or environment variables.
|
|
36
|
-
* Priority: git config user.name > USER env > USERNAME env > fallback to "User"
|
|
37
|
-
*/
|
|
38
|
-
export declare function detectUsername(): Promise<string>;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
1
|
import { promises as fs } from 'node:fs';
|
|
3
2
|
import { join } from 'node:path';
|
|
4
3
|
import { copyDir } from './template-installer.js';
|
|
@@ -10,7 +9,7 @@ const BMAD_VERSION = '6.0.0-alpha.22';
|
|
|
10
9
|
/**
|
|
11
10
|
* Generate core module configuration YAML
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
function generateCoreConfig(username) {
|
|
14
13
|
const now = new Date().toISOString();
|
|
15
14
|
return `# CORE Module Configuration
|
|
16
15
|
# Generated by AI Workflow CLI
|
|
@@ -26,7 +25,7 @@ output_folder: "{project-root}/_bmad-output"
|
|
|
26
25
|
/**
|
|
27
26
|
* Generate BMM module configuration YAML
|
|
28
27
|
*/
|
|
29
|
-
|
|
28
|
+
function generateBmmConfig(projectName, username) {
|
|
30
29
|
const now = new Date().toISOString();
|
|
31
30
|
return `# BMM Module Configuration
|
|
32
31
|
# Generated by AI Workflow CLI
|
|
@@ -51,7 +50,7 @@ output_folder: "{project-root}/_bmad-output"
|
|
|
51
50
|
/**
|
|
52
51
|
* Generate installation manifest YAML
|
|
53
52
|
*/
|
|
54
|
-
|
|
53
|
+
function generateManifest() {
|
|
55
54
|
const now = new Date().toISOString();
|
|
56
55
|
return `installation:
|
|
57
56
|
version: ${BMAD_VERSION}
|
|
@@ -104,42 +103,3 @@ export async function installBmad(config) {
|
|
|
104
103
|
await fs.writeFile(join(targetBmmPath, 'config.yaml'), generateBmmConfig(projectName, username), 'utf8');
|
|
105
104
|
await fs.writeFile(join(targetConfigPath, 'manifest.yaml'), generateManifest(), 'utf8');
|
|
106
105
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Generate BMAD configuration files in the target directory.
|
|
109
|
-
* Used as a post-install hook after template installation.
|
|
110
|
-
*
|
|
111
|
-
* @param targetDir - Directory where BMAD was installed
|
|
112
|
-
* @param username - Username for configuration
|
|
113
|
-
* @param projectName - Project name for configuration
|
|
114
|
-
*/
|
|
115
|
-
export async function generateBmadConfigs(targetDir, username, projectName) {
|
|
116
|
-
const bmadPath = join(targetDir, '_bmad');
|
|
117
|
-
const coreConfigPath = join(bmadPath, 'core', 'config.yaml');
|
|
118
|
-
const bmmConfigPath = join(bmadPath, 'bmm', 'config.yaml');
|
|
119
|
-
const manifestPath = join(bmadPath, '_config', 'manifest.yaml');
|
|
120
|
-
await fs.writeFile(coreConfigPath, generateCoreConfig(username), 'utf8');
|
|
121
|
-
await fs.writeFile(bmmConfigPath, generateBmmConfig(projectName, username), 'utf8');
|
|
122
|
-
await fs.writeFile(manifestPath, generateManifest(), 'utf8');
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Detect username from git config or environment variables.
|
|
126
|
-
* Priority: git config user.name > USER env > USERNAME env > fallback to "User"
|
|
127
|
-
*/
|
|
128
|
-
export async function detectUsername() {
|
|
129
|
-
// Try git config first
|
|
130
|
-
try {
|
|
131
|
-
const gitUser = execSync('git config user.name', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
132
|
-
const username = gitUser.trim();
|
|
133
|
-
if (username)
|
|
134
|
-
return username;
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
// Git command failed or not configured, continue to env vars
|
|
138
|
-
}
|
|
139
|
-
// Try environment variables
|
|
140
|
-
const envUser = process.env['USER'] ?? process.env['USERNAME'];
|
|
141
|
-
if (envUser)
|
|
142
|
-
return envUser;
|
|
143
|
-
// Fallback
|
|
144
|
-
return 'User';
|
|
145
|
-
}
|
|
@@ -55,7 +55,7 @@ export type EnvConfig = Record<string, string>;
|
|
|
55
55
|
/**
|
|
56
56
|
* Method installation tracking metadata
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
interface MethodTracking {
|
|
59
59
|
/** IDEs configured for this method */
|
|
60
60
|
ides?: string[];
|
|
61
61
|
/** ISO timestamp when method was installed */
|
|
@@ -102,3 +102,4 @@ export interface SettingsLocation {
|
|
|
102
102
|
/** Type of settings file */
|
|
103
103
|
type: SettingsFileType;
|
|
104
104
|
}
|
|
105
|
+
export {};
|
package/dist/lib/env-compat.d.ts
CHANGED
|
@@ -16,11 +16,3 @@ export declare function loadEnvWithCompatibility(): void;
|
|
|
16
16
|
* Get AIW_DIR environment variable
|
|
17
17
|
*/
|
|
18
18
|
export declare function getAiwDir(): string | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Get AIW_CONFIG environment variable
|
|
21
|
-
*/
|
|
22
|
-
export declare function getAiwConfig(): string | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Check if using legacy environment variables
|
|
25
|
-
*/
|
|
26
|
-
export declare function isUsingLegacyEnvVars(): boolean;
|
package/dist/lib/env-compat.js
CHANGED
|
@@ -21,15 +21,3 @@ export function loadEnvWithCompatibility() {
|
|
|
21
21
|
export function getAiwDir() {
|
|
22
22
|
return process.env['AIW_DIR'];
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Get AIW_CONFIG environment variable
|
|
26
|
-
*/
|
|
27
|
-
export function getAiwConfig() {
|
|
28
|
-
return process.env['AIW_CONFIG'];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Check if using legacy environment variables
|
|
32
|
-
*/
|
|
33
|
-
export function isUsingLegacyEnvVars() {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
package/dist/lib/git/index.d.ts
CHANGED
|
@@ -7,5 +7,4 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { branchExists, deleteBranch, getCurrentBranch, getMainBranch } from './branch.js';
|
|
9
9
|
export { hasMergeRequest, hasUnpushedCommits } from './safety-checks.js';
|
|
10
|
-
export type { GitCommandOptions, WorktreeInfo } from './types.js';
|
|
11
10
|
export { createWorktree, deleteWorktreeFolder, getAllWorktrees, getWorktreePath } from './worktree.js';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** Standard gitignore entries managed by AIW */
|
|
2
2
|
export declare const AIW_GITIGNORE_ENTRIES: string[];
|
|
3
|
-
/** Entries that should NEVER be removed from gitignore, even on clear */
|
|
4
|
-
export declare const AIW_PERMANENT_ENTRIES: string[];
|
|
5
3
|
/**
|
|
6
4
|
* Prune stale entries from the AIW Installation section in .gitignore.
|
|
7
5
|
* Checks each entry against disk existence and removes entries whose paths don't exist.
|
|
@@ -8,7 +8,7 @@ const AIW_GITIGNORE_HEADER = '# AIW Installation';
|
|
|
8
8
|
/** Standard gitignore entries managed by AIW */
|
|
9
9
|
export const AIW_GITIGNORE_ENTRIES = ['.aiwcli', '_output', '.claude', '.windsurf'];
|
|
10
10
|
/** Entries that should NEVER be removed from gitignore, even on clear */
|
|
11
|
-
|
|
11
|
+
const AIW_PERMANENT_ENTRIES = ['_output'];
|
|
12
12
|
/**
|
|
13
13
|
* Prune stale entries from the AIW Installation section in .gitignore.
|
|
14
14
|
* Checks each entry against disk existence and removes entries whose paths don't exist.
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import type { ClaudeSettings
|
|
2
|
-
/**
|
|
3
|
-
* Merge hooks configurations from template into existing
|
|
4
|
-
*
|
|
5
|
-
* Strategy:
|
|
6
|
-
* - For each event type in template hooks
|
|
7
|
-
* - Concatenate with existing hooks for that event
|
|
8
|
-
* - Deduplicate based on matcher configuration
|
|
9
|
-
* - Maintain order: existing hooks first, then template hooks
|
|
10
|
-
*
|
|
11
|
-
* @param existing - Existing hooks configuration (will not be modified)
|
|
12
|
-
* @param template - Template hooks configuration to merge
|
|
13
|
-
* @returns New merged hooks configuration
|
|
14
|
-
*/
|
|
15
|
-
export declare function mergeHooks(existing: HooksConfig | undefined, template: HooksConfig | undefined): HooksConfig;
|
|
1
|
+
import type { ClaudeSettings } from './claude-settings-types.js';
|
|
16
2
|
/**
|
|
17
3
|
* Merge complete Claude settings configurations
|
|
18
4
|
*
|
package/dist/lib/hooks-merger.js
CHANGED
|
@@ -31,7 +31,7 @@ function areHookMatchersEqual(a, b) {
|
|
|
31
31
|
* @param template - Template hooks configuration to merge
|
|
32
32
|
* @returns New merged hooks configuration
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
function mergeHooks(existing, template) {
|
|
35
35
|
return mergeConfigByEventType(existing, template, (existingMatchers, templateMatchers) => mergeArraysWithDedup(existingMatchers, templateMatchers, areHookMatchersEqual));
|
|
36
36
|
}
|
|
37
37
|
/**
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
* Re-exports all library modules from this barrel file.
|
|
4
4
|
*/
|
|
5
5
|
export { type AiwcliConfig, getAiwDir, loadConfig, validateAiwDir, } from './config.js';
|
|
6
|
-
export { debug,
|
|
7
|
-
export { AiwError, ConfigNotFoundError, EnvironmentError,
|
|
8
|
-
export {
|
|
9
|
-
export { branchExists, createWorktree, deleteBranch, deleteWorktreeFolder, getAllWorktrees, getCurrentBranch, getMainBranch, getWorktreePath, type GitCommandOptions, hasMergeRequest, hasUnpushedCommits, type WorktreeInfo, } from './git/index.js';
|
|
10
|
-
export { findWorkspaceRoot, isWorkspace, pathExists, resolvePath, } from './paths.js';
|
|
11
|
-
export { spawnProcess, type SpawnProcessOptions } from './spawn.js';
|
|
12
|
-
export { escapeShellArg, launchTerminal, type TerminalLaunchOptions, type TerminalLaunchResult, } from './terminal.js';
|
|
6
|
+
export { debug, isDebugEnabled, setDebugEnabled } from './debug.js';
|
|
7
|
+
export { AiwError, ConfigNotFoundError, EnvironmentError, } from './errors.js';
|
|
8
|
+
export { isWorkspace, resolvePath, } from './paths.js';
|
package/dist/lib/index.js
CHANGED
|
@@ -5,16 +5,8 @@
|
|
|
5
5
|
// Configuration resolution
|
|
6
6
|
export { getAiwDir, loadConfig, validateAiwDir, } from './config.js';
|
|
7
7
|
// Debug logging
|
|
8
|
-
export { debug,
|
|
8
|
+
export { debug, isDebugEnabled, setDebugEnabled } from './debug.js';
|
|
9
9
|
// Custom error classes and utilities
|
|
10
|
-
export { AiwError, ConfigNotFoundError, EnvironmentError,
|
|
11
|
-
// Generic merge utilities
|
|
12
|
-
export { mergeArraysWithDedup, mergeConfigByEventType } from './generic-merge.js';
|
|
13
|
-
// Git utilities
|
|
14
|
-
export { branchExists, createWorktree, deleteBranch, deleteWorktreeFolder, getAllWorktrees, getCurrentBranch, getMainBranch, getWorktreePath, hasMergeRequest, hasUnpushedCommits, } from './git/index.js';
|
|
10
|
+
export { AiwError, ConfigNotFoundError, EnvironmentError, } from './errors.js';
|
|
15
11
|
// Cross-platform path utilities
|
|
16
|
-
export {
|
|
17
|
-
// Process spawning utilities
|
|
18
|
-
export { spawnProcess } from './spawn.js';
|
|
19
|
-
// Cross-platform terminal launching
|
|
20
|
-
export { escapeShellArg, launchTerminal, } from './terminal.js';
|
|
12
|
+
export { isWorkspace, resolvePath, } from './paths.js';
|
package/dist/lib/output.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type ProcessLike } from './tty-detection.js';
|
|
|
10
10
|
* Dependencies for output functions.
|
|
11
11
|
* Allows tests to inject mock values without mutating global state.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
interface OutputDependencies {
|
|
14
14
|
proc?: ProcessLike;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -49,3 +49,4 @@ export declare function logWarning(message: string, quiet?: boolean, deps?: Outp
|
|
|
49
49
|
* @param deps - Optional dependencies for testing
|
|
50
50
|
*/
|
|
51
51
|
export declare function logDebug(message: string, deps?: OutputDependencies): void;
|
|
52
|
+
export {};
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import type { ClaudeSettings
|
|
2
|
-
/**
|
|
3
|
-
* Discover Claude settings files in the hierarchy
|
|
4
|
-
*
|
|
5
|
-
* Settings hierarchy (in order of precedence):
|
|
6
|
-
* 1. Local Project Settings: `.claude/settings.local.json` (gitignored)
|
|
7
|
-
* 2. Project Settings: `.claude/settings.json` (shared with team)
|
|
8
|
-
* 3. User Settings: `~/.claude/settings.json` (global)
|
|
9
|
-
*
|
|
10
|
-
* @param projectDir - Project directory path
|
|
11
|
-
* @returns Array of settings locations in order of precedence
|
|
12
|
-
*/
|
|
13
|
-
export declare function discoverSettingsFiles(projectDir: string): Promise<SettingsLocation[]>;
|
|
1
|
+
import type { ClaudeSettings } from './claude-settings-types.js';
|
|
14
2
|
/**
|
|
15
3
|
* Read Claude settings from file
|
|
16
4
|
*
|
|
@@ -14,7 +14,7 @@ import { pathExists } from './paths.js';
|
|
|
14
14
|
* @param projectDir - Project directory path
|
|
15
15
|
* @returns Array of settings locations in order of precedence
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
async function discoverSettingsFiles(projectDir) {
|
|
18
18
|
const locations = [];
|
|
19
19
|
// User settings (global)
|
|
20
20
|
const userSettingsPath = join(homedir(), '.claude', 'settings.json');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration for template installation
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
interface TemplateInstallConfig {
|
|
5
5
|
/** List of IDE names to install (e.g., ['claude', 'windsurf']) */
|
|
6
6
|
ides: string[];
|
|
7
7
|
/** Project name for configuration generation */
|
|
@@ -18,7 +18,7 @@ export interface TemplateInstallConfig {
|
|
|
18
18
|
/**
|
|
19
19
|
* Status of a single template item (file or folder)
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
interface TemplateItemStatus {
|
|
22
22
|
/** Whether the item exists in target directory */
|
|
23
23
|
exists: boolean;
|
|
24
24
|
/** Whether the item is a directory */
|
|
@@ -29,7 +29,7 @@ export interface TemplateItemStatus {
|
|
|
29
29
|
/**
|
|
30
30
|
* Result of checking template installation status
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
interface TemplateInstallationStatus {
|
|
33
33
|
/** Items that already exist in target directory */
|
|
34
34
|
existing: TemplateItemStatus[];
|
|
35
35
|
/** Items that are missing from target directory */
|
|
@@ -42,7 +42,7 @@ export interface TemplateInstallationStatus {
|
|
|
42
42
|
/**
|
|
43
43
|
* Result of template installation
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
interface InstallationResult {
|
|
46
46
|
/** List of folder names that were installed (for gitignore) */
|
|
47
47
|
installedFolders: string[];
|
|
48
48
|
/** Whether shared settings were merged into IDE settings */
|
|
@@ -61,11 +61,6 @@ export interface InstallationResult {
|
|
|
61
61
|
* @returns Status of template items
|
|
62
62
|
*/
|
|
63
63
|
export declare function checkTemplateStatus(templatePath: string, targetDir: string, ides: string[], templateName: string): Promise<TemplateInstallationStatus>;
|
|
64
|
-
/**
|
|
65
|
-
* Patterns to exclude when copying template directories.
|
|
66
|
-
* These are development/test artifacts that shouldn't be packaged.
|
|
67
|
-
*/
|
|
68
|
-
export declare const EXCLUDED_PATTERNS: (string | RegExp)[];
|
|
69
64
|
/**
|
|
70
65
|
* Check if a filename should be excluded from copying
|
|
71
66
|
*/
|
|
@@ -94,3 +89,4 @@ export declare function copyDir(src: string, dest: string, excludeIdeFolders?: b
|
|
|
94
89
|
* @throws Error if template doesn't exist or requested IDE folder not found
|
|
95
90
|
*/
|
|
96
91
|
export declare function installTemplate(config: TemplateInstallConfig): Promise<InstallationResult>;
|
|
92
|
+
export {};
|
|
@@ -75,24 +75,14 @@ export async function checkTemplateStatus(templatePath, targetDir, ides, templat
|
|
|
75
75
|
* Patterns to exclude when copying template directories.
|
|
76
76
|
* These are development/test artifacts that shouldn't be packaged.
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
const EXCLUDED_PATTERNS = new Set([
|
|
79
79
|
'_output',
|
|
80
|
-
|
|
81
|
-
'.pytest_cache',
|
|
82
|
-
'conftest.py',
|
|
83
|
-
/^test_.*\.py$/,
|
|
84
|
-
/.*\.pyc$/,
|
|
85
|
-
];
|
|
80
|
+
]);
|
|
86
81
|
/**
|
|
87
82
|
* Check if a filename should be excluded from copying
|
|
88
83
|
*/
|
|
89
84
|
export function shouldExclude(name) {
|
|
90
|
-
return EXCLUDED_PATTERNS.
|
|
91
|
-
if (typeof pattern === 'string') {
|
|
92
|
-
return name === pattern;
|
|
93
|
-
}
|
|
94
|
-
return pattern.test(name);
|
|
95
|
-
});
|
|
85
|
+
return EXCLUDED_PATTERNS.has(name);
|
|
96
86
|
}
|
|
97
87
|
/**
|
|
98
88
|
* Copy directory recursively with proper error handling.
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* - Proper template references (_{method}/templates/)
|
|
8
8
|
* - Correct workflow references (/method:workflow)
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
interface LintViolation {
|
|
11
11
|
file: string;
|
|
12
12
|
line: number;
|
|
13
13
|
match: string;
|
|
14
14
|
message: string;
|
|
15
15
|
rule: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
interface LintRule {
|
|
18
18
|
description: string;
|
|
19
19
|
/** Message template - use {match} for the matched text */
|
|
20
20
|
message: string;
|
|
@@ -31,19 +31,12 @@ export declare function getRulesForMethod(method: string): LintRule[];
|
|
|
31
31
|
* Lint a single file's content
|
|
32
32
|
*/
|
|
33
33
|
export declare function lintFileContent(content: string, filePath: string, rules: LintRule[]): LintViolation[];
|
|
34
|
-
/**
|
|
35
|
-
* Get all markdown files in a template method directory
|
|
36
|
-
*/
|
|
37
|
-
export declare function getTemplateMarkdownFiles(templatesDir: string, method: string): string[];
|
|
38
34
|
/**
|
|
39
35
|
* Lint all markdown files for a specific template method
|
|
40
36
|
*/
|
|
41
37
|
export declare function lintTemplateMethod(templatesDir: string, method: string): LintViolation[];
|
|
42
|
-
/**
|
|
43
|
-
* Lint all template methods in a templates directory
|
|
44
|
-
*/
|
|
45
|
-
export declare function lintAllTemplates(templatesDir: string): Map<string, LintViolation[]>;
|
|
46
38
|
/**
|
|
47
39
|
* Format violations for display
|
|
48
40
|
*/
|
|
49
41
|
export declare function formatViolations(violations: LintViolation[], basePath?: string): string;
|
|
42
|
+
export {};
|
|
@@ -97,7 +97,7 @@ export function lintFileContent(content, filePath, rules) {
|
|
|
97
97
|
/**
|
|
98
98
|
* Get all markdown files in a template method directory
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
function getTemplateMarkdownFiles(templatesDir, method) {
|
|
101
101
|
const methodDir = path.join(templatesDir, method);
|
|
102
102
|
const files = [];
|
|
103
103
|
if (!existsSync(methodDir)) {
|
|
@@ -144,7 +144,7 @@ export function lintTemplateMethod(templatesDir, method) {
|
|
|
144
144
|
/**
|
|
145
145
|
* Lint all template methods in a templates directory
|
|
146
146
|
*/
|
|
147
|
-
|
|
147
|
+
function lintAllTemplates(templatesDir) {
|
|
148
148
|
const results = new Map();
|
|
149
149
|
const methods = ['cc-native'];
|
|
150
150
|
for (const method of methods) {
|
|
@@ -17,4 +17,10 @@ export declare function getTemplatePath(templateName: string): Promise<string>;
|
|
|
17
17
|
* @returns Array of template names (e.g., ['bmad', 'gsr'])
|
|
18
18
|
* @throws Error if templates directory cannot be read (indicates corrupted installation)
|
|
19
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* Get the absolute path to the _shared template directory.
|
|
22
|
+
*
|
|
23
|
+
* @returns Absolute path to the _shared template
|
|
24
|
+
*/
|
|
25
|
+
export declare function getSharedTemplatePath(): string;
|
|
20
26
|
export declare function getAvailableTemplates(): Promise<string[]>;
|
|
@@ -43,6 +43,16 @@ export async function getTemplatePath(templateName) {
|
|
|
43
43
|
* @returns Array of template names (e.g., ['bmad', 'gsr'])
|
|
44
44
|
* @throws Error if templates directory cannot be read (indicates corrupted installation)
|
|
45
45
|
*/
|
|
46
|
+
/**
|
|
47
|
+
* Get the absolute path to the _shared template directory.
|
|
48
|
+
*
|
|
49
|
+
* @returns Absolute path to the _shared template
|
|
50
|
+
*/
|
|
51
|
+
export function getSharedTemplatePath() {
|
|
52
|
+
const currentFilePath = fileURLToPath(import.meta.url);
|
|
53
|
+
const currentDir = dirname(currentFilePath);
|
|
54
|
+
return join(currentDir, '..', 'templates', '_shared');
|
|
55
|
+
}
|
|
46
56
|
export async function getAvailableTemplates() {
|
|
47
57
|
const currentFileUrl = import.meta.url;
|
|
48
58
|
const currentFilePath = fileURLToPath(currentFileUrl);
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* The function:
|
|
21
21
|
* 1. Starts with empty settings
|
|
22
|
-
* 2. Merges _shared template settings (
|
|
22
|
+
* 2. Merges _shared template settings (when active templates exist)
|
|
23
23
|
* 3. For each active template, merges its template-source settings
|
|
24
24
|
* 4. Writes the result to the IDE settings file
|
|
25
25
|
*
|