aiwcli 0.9.6 → 0.9.8

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 (91) hide show
  1. package/dist/commands/init/index.d.ts +0 -8
  2. package/dist/commands/init/index.js +5 -35
  3. package/dist/lib/index.d.ts +3 -4
  4. package/dist/lib/index.js +3 -5
  5. package/dist/lib/settings-hierarchy.js +5 -16
  6. package/dist/lib/template-installer.d.ts +9 -0
  7. package/dist/lib/template-installer.js +3 -14
  8. package/dist/lib/template-merger.js +1 -12
  9. package/dist/lib/windsurf-hooks-hierarchy.js +2 -13
  10. package/dist/templates/CLAUDE.md +49 -18
  11. package/dist/templates/_shared/hooks/__pycache__/__init__.cpython-313.pyc +0 -0
  12. package/dist/templates/_shared/hooks/__pycache__/archive_plan.cpython-313.pyc +0 -0
  13. package/dist/templates/_shared/hooks/__pycache__/context_enforcer.cpython-313.pyc +0 -0
  14. package/dist/templates/_shared/hooks/__pycache__/context_monitor.cpython-313.pyc +0 -0
  15. package/dist/templates/_shared/hooks/__pycache__/file-suggestion.cpython-313.pyc +0 -0
  16. package/dist/templates/_shared/hooks/__pycache__/session_start.cpython-313.pyc +0 -0
  17. package/dist/templates/_shared/hooks/__pycache__/task_create_atomicity.cpython-313.pyc +0 -0
  18. package/dist/templates/_shared/hooks/__pycache__/task_create_capture.cpython-313.pyc +0 -0
  19. package/dist/templates/_shared/hooks/__pycache__/task_update_capture.cpython-313.pyc +0 -0
  20. package/dist/templates/_shared/hooks/__pycache__/user_prompt_submit.cpython-313.pyc +0 -0
  21. package/dist/templates/_shared/hooks/context_enforcer.py +21 -71
  22. package/dist/templates/_shared/hooks/context_monitor.py +78 -1
  23. package/dist/templates/_shared/hooks/pre_compact.py +89 -0
  24. package/dist/templates/_shared/hooks/session_end.py +111 -0
  25. package/dist/templates/_shared/hooks/session_start.py +104 -47
  26. package/dist/templates/_shared/hooks/task_create_atomicity.py +33 -61
  27. package/dist/templates/_shared/hooks/task_create_capture.py +1 -0
  28. package/dist/templates/_shared/hooks/task_update_capture.py +15 -0
  29. package/dist/templates/_shared/hooks/user_prompt_submit.py +13 -27
  30. package/dist/templates/_shared/lib/__pycache__/__init__.cpython-313.pyc +0 -0
  31. package/dist/templates/_shared/lib/base/__pycache__/__init__.cpython-313.pyc +0 -0
  32. package/dist/templates/_shared/lib/base/__pycache__/atomic_write.cpython-313.pyc +0 -0
  33. package/dist/templates/_shared/lib/base/__pycache__/constants.cpython-313.pyc +0 -0
  34. package/dist/templates/_shared/lib/base/__pycache__/hook_utils.cpython-313.pyc +0 -0
  35. package/dist/templates/_shared/lib/base/__pycache__/inference.cpython-313.pyc +0 -0
  36. package/dist/templates/_shared/lib/base/__pycache__/stop_words.cpython-313.pyc +0 -0
  37. package/dist/templates/_shared/lib/base/__pycache__/subprocess_utils.cpython-313.pyc +0 -0
  38. package/dist/templates/_shared/lib/base/__pycache__/utils.cpython-313.pyc +0 -0
  39. package/dist/templates/_shared/lib/base/constants.py +18 -4
  40. package/dist/templates/_shared/lib/base/hook_utils.py +0 -24
  41. package/dist/templates/_shared/lib/base/stop_words.py +23 -0
  42. package/dist/templates/_shared/lib/base/utils.py +9 -4
  43. package/dist/templates/_shared/lib/context/__init__.py +0 -8
  44. package/dist/templates/_shared/lib/context/__pycache__/__init__.cpython-313.pyc +0 -0
  45. package/dist/templates/_shared/lib/context/__pycache__/cache.cpython-313.pyc +0 -0
  46. package/dist/templates/_shared/lib/context/__pycache__/context_extractor.cpython-313.pyc +0 -0
  47. package/dist/templates/_shared/lib/context/__pycache__/context_manager.cpython-313.pyc +0 -0
  48. package/dist/templates/_shared/lib/context/__pycache__/discovery.cpython-313.pyc +0 -0
  49. package/dist/templates/_shared/lib/context/__pycache__/event_log.cpython-313.pyc +0 -0
  50. package/dist/templates/_shared/lib/context/__pycache__/plan_archive.cpython-313.pyc +0 -0
  51. package/dist/templates/_shared/lib/context/__pycache__/task_sync.cpython-313.pyc +0 -0
  52. package/dist/templates/_shared/lib/context/auto_state.py +167 -0
  53. package/dist/templates/_shared/lib/context/context_manager.py +6 -3
  54. package/dist/templates/_shared/lib/context/discovery.py +167 -57
  55. package/dist/templates/_shared/lib/context/event_log.py +8 -0
  56. package/dist/templates/_shared/lib/context/plan_archive.py +0 -146
  57. package/dist/templates/_shared/lib/context/task_sync.py +160 -43
  58. package/dist/templates/_shared/lib/templates/__pycache__/__init__.cpython-313.pyc +0 -0
  59. package/dist/templates/_shared/lib/templates/__pycache__/formatters.cpython-313.pyc +0 -0
  60. package/dist/templates/_shared/lib/templates/__pycache__/persona_questions.cpython-313.pyc +0 -0
  61. package/dist/templates/_shared/lib/templates/__pycache__/plan_context.cpython-313.pyc +0 -0
  62. package/dist/templates/_shared/lib/templates/plan_context.py +24 -41
  63. package/dist/templates/cc-native/.claude/settings.json +32 -10
  64. package/dist/templates/cc-native/_cc-native/agents/CLAUDE.md +1 -1
  65. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +8 -1
  66. package/dist/templates/cc-native/_cc-native/hooks/__pycache__/add_plan_context.cpython-313.pyc +0 -0
  67. package/dist/templates/cc-native/_cc-native/hooks/__pycache__/cc-native-plan-review.cpython-313.pyc +0 -0
  68. package/dist/templates/cc-native/_cc-native/hooks/__pycache__/suggest-fresh-perspective.cpython-313.pyc +0 -0
  69. package/dist/templates/cc-native/_cc-native/hooks/add_plan_context.py +1 -8
  70. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.py +65 -47
  71. package/dist/templates/cc-native/_cc-native/lib/CLAUDE.md +29 -6
  72. package/dist/templates/cc-native/_cc-native/lib/__init__.py +0 -4
  73. package/dist/templates/cc-native/_cc-native/lib/__pycache__/__init__.cpython-313.pyc +0 -0
  74. package/dist/templates/cc-native/_cc-native/lib/__pycache__/atomic_write.cpython-313.pyc +0 -0
  75. package/dist/templates/cc-native/_cc-native/lib/__pycache__/constants.cpython-313.pyc +0 -0
  76. package/dist/templates/cc-native/_cc-native/lib/__pycache__/debug.cpython-313.pyc +0 -0
  77. package/dist/templates/cc-native/_cc-native/lib/__pycache__/orchestrator.cpython-313.pyc +0 -0
  78. package/dist/templates/cc-native/_cc-native/lib/__pycache__/state.cpython-313.pyc +0 -0
  79. package/dist/templates/cc-native/_cc-native/lib/__pycache__/utils.cpython-313.pyc +0 -0
  80. package/dist/templates/cc-native/_cc-native/lib/orchestrator.py +71 -15
  81. package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/__init__.cpython-313.pyc +0 -0
  82. package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/agent.cpython-313.pyc +0 -0
  83. package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/base.cpython-313.pyc +0 -0
  84. package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/codex.cpython-313.pyc +0 -0
  85. package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/gemini.cpython-313.pyc +0 -0
  86. package/dist/templates/cc-native/_cc-native/lib/reviewers/agent.py +6 -4
  87. package/dist/templates/cc-native/_cc-native/lib/state.py +11 -9
  88. package/dist/templates/cc-native/_cc-native/lib/utils.py +26 -109
  89. package/dist/templates/cc-native/_cc-native/scripts/__pycache__/aggregate_agents.cpython-313.pyc +0 -0
  90. package/oclif.manifest.json +1 -1
  91. package/package.json +1 -1
@@ -45,10 +45,6 @@ export default class Init extends BaseCommand {
45
45
  * @param templatePath - Template source path
46
46
  */
47
47
  private mergeWindsurfTemplateHooks;
48
- /**
49
- * Check if a path exists
50
- */
51
- private pathExists;
52
48
  /**
53
49
  * Perform post-installation actions.
54
50
  *
@@ -90,10 +86,6 @@ export default class Init extends BaseCommand {
90
86
  * @returns Wizard configuration result
91
87
  */
92
88
  private runInteractiveWizard;
93
- /**
94
- * Check if a file should be excluded from copying
95
- */
96
- private shouldExcludeFile;
97
89
  /**
98
90
  * Track method installation in settings.json
99
91
  *
@@ -8,8 +8,9 @@ import { detectUsername } from '../../lib/user-utils.js';
8
8
  import { updateGitignore } from '../../lib/gitignore-manager.js';
9
9
  import { mergeClaudeSettings } from '../../lib/hooks-merger.js';
10
10
  import { IdePathResolver } from '../../lib/ide-path-resolver.js';
11
+ import { pathExists } from '../../lib/paths.js';
11
12
  import { getTargetSettingsFile, readClaudeSettings, writeClaudeSettings } from '../../lib/settings-hierarchy.js';
12
- import { checkTemplateStatus, installTemplate } from '../../lib/template-installer.js';
13
+ import { checkTemplateStatus, installTemplate, shouldExclude } from '../../lib/template-installer.js';
13
14
  import { getAvailableTemplates, getTemplatePath } from '../../lib/template-resolver.js';
14
15
  import { getTargetHooksFile, readWindsurfHooks, writeWindsurfHooks } from '../../lib/windsurf-hooks-hierarchy.js';
15
16
  import { mergeWindsurfHooks } from '../../lib/windsurf-hooks-merger.js';
@@ -91,13 +92,13 @@ export default class Init extends BaseCommand {
91
92
  const containerDir = resolver.getAiwcliContainer();
92
93
  await fs.mkdir(containerDir, { recursive: true });
93
94
  const sharedDestPath = resolver.getSharedFolder();
94
- const sharedExists = await this.pathExists(sharedDestPath);
95
+ const sharedExists = await pathExists(sharedDestPath);
95
96
  if (!sharedExists) {
96
97
  const currentFilePath = fileURLToPath(import.meta.url);
97
98
  const currentDir = dirname(currentFilePath);
98
99
  const templatesRoot = join(dirname(dirname(currentDir)), 'templates');
99
100
  const sharedSrcPath = join(templatesRoot, '_shared');
100
- if (!(await this.pathExists(sharedSrcPath))) {
101
+ if (!(await pathExists(sharedSrcPath))) {
101
102
  this.error(`Shared folder not found at ${sharedSrcPath}. This indicates a corrupted installation.`, {
102
103
  exit: EXIT_CODES.ENVIRONMENT_ERROR,
103
104
  });
@@ -235,7 +236,7 @@ export default class Init extends BaseCommand {
235
236
  const operations = entries
236
237
  .filter((entry) => {
237
238
  // Standard exclusions (test files, cache, etc.)
238
- if (this.shouldExcludeFile(entry.name)) {
239
+ if (shouldExclude(entry.name)) {
239
240
  return false;
240
241
  }
241
242
  // Exclude IDE config folders if requested (used for _shared folder)
@@ -352,18 +353,6 @@ export default class Init extends BaseCommand {
352
353
  // Don't fail the entire installation if hook merging fails
353
354
  }
354
355
  }
355
- /**
356
- * Check if a path exists
357
- */
358
- async pathExists(path) {
359
- try {
360
- await fs.access(path);
361
- return true;
362
- }
363
- catch {
364
- return false;
365
- }
366
- }
367
356
  /**
368
357
  * Perform post-installation actions.
369
358
  *
@@ -511,25 +500,6 @@ export default class Init extends BaseCommand {
511
500
  confirmed,
512
501
  };
513
502
  }
514
- /**
515
- * Check if a file should be excluded from copying
516
- */
517
- shouldExcludeFile(name) {
518
- const excludedPatterns = [
519
- '_output',
520
- '__pycache__',
521
- '.pytest_cache',
522
- 'conftest.py',
523
- /^test_.*\.py$/,
524
- /.*\.pyc$/,
525
- ];
526
- return excludedPatterns.some((pattern) => {
527
- if (typeof pattern === 'string') {
528
- return name === pattern;
529
- }
530
- return pattern.test(name);
531
- });
532
- }
533
503
  /**
534
504
  * Track method installation in settings.json
535
505
  *
@@ -3,11 +3,10 @@
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, debugConfig, debugSpawn, debugVersion, isDebugEnabled, setDebugEnabled } from './debug.js';
7
- export { getAiwConfig, getAiwDir as getAiwDirFromEnv, isUsingLegacyEnvVars, loadEnvWithCompatibility, } from './env-compat.js';
8
- export { AiwError, ConfigNotFoundError, EnvironmentError, formatErrorMessage, InvalidUsageError, ProcessSpawnError, } from './errors.js';
6
+ export { debug, debugSpawn, debugVersion, isDebugEnabled, setDebugEnabled } from './debug.js';
7
+ export { AiwError, ConfigNotFoundError, EnvironmentError, InvalidUsageError, ProcessSpawnError, } from './errors.js';
9
8
  export { mergeArraysWithDedup, mergeConfigByEventType } from './generic-merge.js';
10
9
  export { branchExists, createWorktree, deleteBranch, deleteWorktreeFolder, getAllWorktrees, getCurrentBranch, getMainBranch, getWorktreePath, type GitCommandOptions, hasMergeRequest, hasUnpushedCommits, type WorktreeInfo, } from './git/index.js';
11
- export { expandPath, findWorkspaceRoot, getHomePath, getWorkspacePath, isWorkspace, normalizePath, pathExists, resolvePath, toUnixPath, toWindowsPath, } from './paths.js';
10
+ export { findWorkspaceRoot, isWorkspace, pathExists, resolvePath, } from './paths.js';
12
11
  export { spawnProcess, type SpawnProcessOptions } from './spawn.js';
13
12
  export { escapeShellArg, launchTerminal, type TerminalLaunchOptions, type TerminalLaunchResult, } from './terminal.js';
package/dist/lib/index.js CHANGED
@@ -5,17 +5,15 @@
5
5
  // Configuration resolution
6
6
  export { getAiwDir, loadConfig, validateAiwDir, } from './config.js';
7
7
  // Debug logging
8
- export { debug, debugConfig, debugSpawn, debugVersion, isDebugEnabled, setDebugEnabled } from './debug.js';
9
- // Environment variable compatibility
10
- export { getAiwConfig, getAiwDir as getAiwDirFromEnv, isUsingLegacyEnvVars, loadEnvWithCompatibility, } from './env-compat.js';
8
+ export { debug, debugSpawn, debugVersion, isDebugEnabled, setDebugEnabled } from './debug.js';
11
9
  // Custom error classes and utilities
12
- export { AiwError, ConfigNotFoundError, EnvironmentError, formatErrorMessage, InvalidUsageError, ProcessSpawnError, } from './errors.js';
10
+ export { AiwError, ConfigNotFoundError, EnvironmentError, InvalidUsageError, ProcessSpawnError, } from './errors.js';
13
11
  // Generic merge utilities
14
12
  export { mergeArraysWithDedup, mergeConfigByEventType } from './generic-merge.js';
15
13
  // Git utilities
16
14
  export { branchExists, createWorktree, deleteBranch, deleteWorktreeFolder, getAllWorktrees, getCurrentBranch, getMainBranch, getWorktreePath, hasMergeRequest, hasUnpushedCommits, } from './git/index.js';
17
15
  // Cross-platform path utilities
18
- export { expandPath, findWorkspaceRoot, getHomePath, getWorkspacePath, isWorkspace, normalizePath, pathExists, resolvePath, toUnixPath, toWindowsPath, } from './paths.js';
16
+ export { findWorkspaceRoot, isWorkspace, pathExists, resolvePath, } from './paths.js';
19
17
  // Process spawning utilities
20
18
  export { spawnProcess } from './spawn.js';
21
19
  // Cross-platform terminal launching
@@ -2,6 +2,7 @@ import { promises as fs } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
3
  import { join } from 'node:path';
4
4
  import { IdePathResolver } from './ide-path-resolver.js';
5
+ import { pathExists } from './paths.js';
5
6
  /**
6
7
  * Discover Claude settings files in the hierarchy
7
8
  *
@@ -20,36 +21,24 @@ export async function discoverSettingsFiles(projectDir) {
20
21
  locations.push({
21
22
  type: 'user',
22
23
  path: userSettingsPath,
23
- exists: await fileExists(userSettingsPath),
24
+ exists: await pathExists(userSettingsPath),
24
25
  });
25
26
  // Project settings (shared)
26
27
  const projectSettingsPath = join(projectDir, '.claude', 'settings.json');
27
28
  locations.push({
28
29
  type: 'project',
29
30
  path: projectSettingsPath,
30
- exists: await fileExists(projectSettingsPath),
31
+ exists: await pathExists(projectSettingsPath),
31
32
  });
32
33
  // Local project settings (gitignored)
33
34
  const localSettingsPath = join(projectDir, '.claude', 'settings.local.json');
34
35
  locations.push({
35
36
  type: 'local',
36
37
  path: localSettingsPath,
37
- exists: await fileExists(localSettingsPath),
38
+ exists: await pathExists(localSettingsPath),
38
39
  });
39
40
  return locations;
40
41
  }
41
- /**
42
- * Check if file exists
43
- */
44
- async function fileExists(path) {
45
- try {
46
- await fs.access(path);
47
- return true;
48
- }
49
- catch {
50
- return false;
51
- }
52
- }
53
42
  /**
54
43
  * Read Claude settings from file
55
44
  *
@@ -81,7 +70,7 @@ export async function writeClaudeSettings(path, settings) {
81
70
  const dir = join(path, '..');
82
71
  await fs.mkdir(dir, { recursive: true });
83
72
  // Backup existing file if it exists
84
- if (await fileExists(path)) {
73
+ if (await pathExists(path)) {
85
74
  const backupPath = `${path}.backup`;
86
75
  await fs.copyFile(path, backupPath);
87
76
  }
@@ -67,6 +67,15 @@ export interface InstallationResult {
67
67
  * @returns Status of template items
68
68
  */
69
69
  export declare function checkTemplateStatus(templatePath: string, targetDir: string, ides: string[], templateName: string): Promise<TemplateInstallationStatus>;
70
+ /**
71
+ * Patterns to exclude when copying template directories.
72
+ * These are development/test artifacts that shouldn't be packaged.
73
+ */
74
+ export declare const EXCLUDED_PATTERNS: (string | RegExp)[];
75
+ /**
76
+ * Check if a filename should be excluded from copying
77
+ */
78
+ export declare function shouldExclude(name: string): boolean;
70
79
  /**
71
80
  * Copy directory recursively with proper error handling.
72
81
  * Excludes test files, cache directories, and output folders.
@@ -1,6 +1,7 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { IdePathResolver } from './ide-path-resolver.js';
4
+ import { pathExists } from './paths.js';
4
5
  import { mergeTemplateContent } from './template-merger.js';
5
6
  /**
6
7
  * Deep merge two settings objects, combining hook arrays.
@@ -93,18 +94,6 @@ async function mergeSharedSettingsFromSource(targetDir, sourceSettingsPath) {
93
94
  return false;
94
95
  }
95
96
  }
96
- /**
97
- * Check if a path exists
98
- */
99
- async function pathExists(path) {
100
- try {
101
- await fs.access(path);
102
- return true;
103
- }
104
- catch {
105
- return false;
106
- }
107
- }
108
97
  /**
109
98
  * Check template installation status for a method.
110
99
  * Returns which items exist and which are missing.
@@ -178,7 +167,7 @@ export async function checkTemplateStatus(templatePath, targetDir, ides, templat
178
167
  * Patterns to exclude when copying template directories.
179
168
  * These are development/test artifacts that shouldn't be packaged.
180
169
  */
181
- const EXCLUDED_PATTERNS = [
170
+ export const EXCLUDED_PATTERNS = [
182
171
  '_output',
183
172
  '__pycache__',
184
173
  '.pytest_cache',
@@ -189,7 +178,7 @@ const EXCLUDED_PATTERNS = [
189
178
  /**
190
179
  * Check if a filename should be excluded from copying
191
180
  */
192
- function shouldExclude(name) {
181
+ export function shouldExclude(name) {
193
182
  return EXCLUDED_PATTERNS.some((pattern) => {
194
183
  if (typeof pattern === 'string') {
195
184
  return name === pattern;
@@ -1,22 +1,11 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import { join } from 'node:path';
3
+ import { pathExists } from './paths.js';
3
4
  /**
4
5
  * Content folder types that should be recursively merged rather than skipped.
5
6
  * These are the canonical folder names used in templates for organizing content.
6
7
  */
7
8
  export const CONTENT_FOLDER_TYPES = ['agents', 'commands', 'workflows', 'tasks'];
8
- /**
9
- * Check if a path exists
10
- */
11
- async function pathExists(path) {
12
- try {
13
- await fs.access(path);
14
- return true;
15
- }
16
- catch {
17
- return false;
18
- }
19
- }
20
9
  /**
21
10
  * Recursively find folders matching the method name within a directory tree.
22
11
  * This finds folders like `.claude/commands/bmad/` when methodName is 'bmad'.
@@ -1,17 +1,6 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- /**
4
- * Check if file exists
5
- */
6
- async function fileExists(path) {
7
- try {
8
- await fs.access(path);
9
- return true;
10
- }
11
- catch {
12
- return false;
13
- }
14
- }
3
+ import { pathExists } from './paths.js';
15
4
  /**
16
5
  * Read Windsurf hooks from file
17
6
  *
@@ -43,7 +32,7 @@ export async function writeWindsurfHooks(path, hooks) {
43
32
  const dir = join(path, '..');
44
33
  await fs.mkdir(dir, { recursive: true });
45
34
  // Backup existing file if it exists
46
- if (await fileExists(path)) {
35
+ if (await pathExists(path)) {
47
36
  const backupPath = `${path}.backup`;
48
37
  await fs.copyFile(path, backupPath);
49
38
  }
@@ -17,24 +17,53 @@ Include `_output/{method}/` in template `.gitignore`.
17
17
 
18
18
  ## Directory Structure
19
19
 
20
+ Each template installs into `.aiwcli/` (method files) and `.{ide}/` (IDE integration). The `_shared/` template provides cross-method infrastructure used by all methods.
21
+
20
22
  ```
21
- packages/cli/src/templates/{method}/
22
- ├── _{method}/ # Method-specific shared files
23
- │ ├── templates/*.md.template
24
- │ └── workflows/*.md # Canonical workflow definitions
25
- ├── .{ide}/{ide-folder}/{method}/*.md # IDE command stubs
26
- ├── .gitignore # Output ignore rules
27
- ├── {METHOD}-README.md # User documentation
28
- ├── TEMPLATE-SCHEMA.md # Schema reference
29
- └── MIGRATION.md # Breaking changes
23
+ packages/cli/src/templates/
24
+ ├── _shared/ # Cross-method infrastructure (installed by all methods)
25
+ │ ├── hooks/ # Shared hook scripts (context, tasks, sessions)
26
+ │ └── lib/ # Shared Python libraries
27
+ ├── base/ # Core: atomic_write, constants, inference, utils
28
+ ├── context/ # Context management, event sourcing, discovery
29
+ ├── handoff/ # Session handoff document generation
30
+ │ └── templates/ # Output formatters, plan context templates
31
+
32
+ ├── cc-native/ # CC-Native method template
33
+ │ ├── _cc-native/ # Method-specific hooks, lib, agents, workflows, scripts
34
+ │ ├── _shared/ # Copy of shared infrastructure (installed together)
35
+ │ ├── .claude/ # Claude Code: settings.json, commands/, agents/
36
+ │ ├── .windsurf/ # Windsurf: workflows/
37
+ │ └── .gitignore
38
+
39
+ ├── gsd/ # GSD method template
40
+ │ ├── .aiwcli/_gsd/ # Templates, workflows, hooks, config, docs
41
+ │ ├── .claude/ # Claude Code: settings.json, commands/, agents/
42
+ │ ├── .windsurf/ # Windsurf: workflows/
43
+ │ ├── GSD-README.md
44
+ │ ├── TEMPLATE-SCHEMA.md
45
+ │ └── MIGRATION.md
46
+
47
+ ├── bmad/ # BMAD method template
48
+ │ ├── .aiwcli/_bmad/ # Agents, workflows, teams, testarch, config
49
+ │ ├── .claude/ # Claude Code: settings.json, commands/
50
+ │ └── ...
51
+
52
+ ├── planning-with-files/ # Planning-with-Files method template
53
+ │ ├── .claude/ # Claude Code: settings.json, skills/
54
+ │ ├── .windsurf/ # Windsurf: workflows/, scripts/
55
+ │ └── ...
56
+
57
+ └── CLAUDE.md # This file
30
58
  ```
31
59
 
32
60
  ### Tier Details
33
61
 
34
62
  | Tier | Location | Purpose |
35
63
  |------|----------|---------|
36
- | General | `_{method}/` | IDE-agnostic templates and canonical workflows |
37
- | IDE | `.{ide}/{folder}/{method}/` | Lightweight stubs that load canonical workflows |
64
+ | Shared | `_shared/` | Cross-method hooks and libraries (context management, task sync, sessions) |
65
+ | Method | `_{method}/` or `.aiwcli/_{method}/` | Method-specific templates, workflows, hooks, config |
66
+ | IDE | `.{ide}/` | IDE-specific command stubs, settings, workflow definitions |
38
67
  | Config | `.{ide}/settings.json` | Hooks, model prefs, method settings (merged on install) |
39
68
 
40
69
  ---
@@ -57,7 +86,7 @@ When multiple templates install, settings.json files merge:
57
86
 
58
87
  ## Hooks
59
88
 
60
- **Location:** `.claude/hooks/{method}-{hook-name}.{ext}`
89
+ **Location:** Hooks live in `.aiwcli/_shared/hooks/` (cross-method) and `.aiwcli/_{method}/hooks/` (method-specific). They are configured in `.{ide}/settings.json`, not placed in IDE directories.
61
90
 
62
91
  **Configuration:**
63
92
  ```json
@@ -65,14 +94,14 @@ When multiple templates install, settings.json files merge:
65
94
  "hooks": {
66
95
  "PostToolUse": [{
67
96
  "matcher": "Write",
68
- "hooks": [{ "type": "command", "command": "python .claude/hooks/gsd-plan-review.py", "timeout": 300000 }]
97
+ "hooks": [{ "type": "command", "command": "python .aiwcli/_cc-native/hooks/cc-native-plan-review.py", "timeout": 300000 }]
69
98
  }]
70
99
  }
71
100
  }
72
101
  ```
73
102
 
74
103
  **Requirements:**
75
- - Prefix with method name (e.g., `gsd-plan-review.py`)
104
+ - Prefix method-specific hooks with method name (e.g., `cc-native-plan-review.py`)
76
105
  - Use relative paths from project root
77
106
  - Write outputs to `_output/{method}/`
78
107
  - Specify timeouts
@@ -119,8 +148,8 @@ Load and execute `_{method}/workflows/{name}.md`.
119
148
  | Reference Type | Pattern |
120
149
  |----------------|---------|
121
150
  | Templates | `_{method}/templates/FILE.md.template` |
122
- | Workflows (Claude) | `/gsd:other-workflow` |
123
- | Workflows (Windsurf) | `other-workflow` from GSD workflows |
151
+ | Workflows (Claude) | `/gsd:workflow-name` (maps to `.claude/commands/gsd/workflow-name.md`) |
152
+ | Workflows (Windsurf) | `workflow-name` from method workflows |
124
153
  | Outputs | `_output/{method}/{subdir}/FILE.md` |
125
154
 
126
155
  ---
@@ -143,8 +172,8 @@ Load and execute `_{method}/workflows/{name}.md`.
143
172
 
144
173
  **New Template:**
145
174
  - [ ] Create `_{method}/` with `templates/` and `workflows/`
146
- - [ ] Create `.claude/commands/{method}/` stubs
147
- - [ ] Create `.windsurf/workflows/{method}/` stubs
175
+ - [ ] Create `.claude/commands/{method}/` stubs (Claude Code)
176
+ - [ ] Create `.windsurf/workflows/{method}/` stubs (Windsurf)
148
177
  - [ ] Add `.gitignore` with `_output/{method}/`
149
178
  - [ ] Create `{METHOD}-README.md`, `TEMPLATE-SCHEMA.md`, `MIGRATION.md`
150
179
  - [ ] Configure method-namespaced settings in `.claude/settings.json`
@@ -165,6 +194,7 @@ Load and execute `_{method}/workflows/{name}.md`.
165
194
  - Keep canonical workflows in `_{method}/workflows/`
166
195
  - Use relative paths from project root
167
196
  - Document changes in TEMPLATE-SCHEMA.md
197
+ - Place hooks in `.aiwcli/` directories, wire them in `.{ide}/settings.json`
168
198
 
169
199
  **Avoid:**
170
200
  - Outputs in project root
@@ -172,3 +202,4 @@ Load and execute `_{method}/workflows/{name}.md`.
172
202
  - Hooks without method prefix
173
203
  - Full workflows in IDE command files
174
204
  - Hardcoded paths without method namespace
205
+ - Putting hook scripts directly in IDE directories (`.claude/hooks/`)