clavix 5.2.1 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +3 -4
  2. package/dist/cli/commands/diagnose.js +1 -1
  3. package/dist/cli/commands/init.d.ts +4 -0
  4. package/dist/cli/commands/init.js +130 -24
  5. package/dist/cli/commands/update.js +1 -1
  6. package/dist/constants.d.ts +18 -0
  7. package/dist/constants.js +24 -0
  8. package/dist/core/adapter-registry.d.ts +39 -0
  9. package/dist/core/adapter-registry.js +208 -0
  10. package/dist/core/adapters/base-adapter.d.ts +1 -0
  11. package/dist/core/adapters/base-adapter.js +14 -1
  12. package/dist/core/adapters/universal-adapter.d.ts +49 -0
  13. package/dist/core/adapters/universal-adapter.js +88 -0
  14. package/dist/core/command-transformer.d.ts +11 -12
  15. package/dist/core/command-transformer.js +11 -12
  16. package/dist/core/doc-injector.d.ts +0 -4
  17. package/dist/core/doc-injector.js +5 -10
  18. package/dist/core/template-assembler.d.ts +1 -1
  19. package/dist/core/template-assembler.js +1 -1
  20. package/dist/templates/agents/agents.md +1 -2
  21. package/dist/templates/agents/copilot-instructions.md +1 -2
  22. package/dist/templates/agents/octo.md +1 -1
  23. package/dist/templates/agents/warp.md +2 -2
  24. package/dist/templates/instructions/core/file-operations.md +15 -11
  25. package/dist/templates/slash-commands/_canonical/plan.md +1 -2
  26. package/dist/templates/slash-commands/_components/MANIFEST.md +81 -0
  27. package/dist/templates/slash-commands/_components/agent-protocols/AGENT_MANUAL.md +1 -1
  28. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +15 -17
  29. package/dist/types/adapter-config.d.ts +73 -0
  30. package/dist/types/adapter-config.js +24 -0
  31. package/dist/types/config.js +3 -2
  32. package/dist/utils/error-utils.d.ts +4 -0
  33. package/dist/utils/error-utils.js +6 -0
  34. package/dist/utils/file-system.js +7 -12
  35. package/dist/utils/legacy-command-cleanup.d.ts +14 -0
  36. package/dist/utils/legacy-command-cleanup.js +14 -0
  37. package/dist/utils/logger.d.ts +32 -0
  38. package/dist/utils/logger.js +56 -0
  39. package/dist/utils/string-utils.d.ts +10 -0
  40. package/dist/utils/string-utils.js +12 -0
  41. package/dist/utils/version.d.ts +20 -0
  42. package/dist/utils/version.js +43 -0
  43. package/oclif.manifest.json +130 -0
  44. package/package.json +1 -1
  45. package/dist/cli/commands/config.d.ts +0 -28
  46. package/dist/cli/commands/config.js +0 -447
  47. package/dist/templates/slash-commands/_components/agent-protocols/decision-rules.md +0 -232
  48. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +0 -177
@@ -32,6 +32,10 @@ interface NodeJSError extends Error {
32
32
  * Type guard to check if error is a NodeJS error with code property
33
33
  */
34
34
  export declare function isNodeError(error: unknown): error is NodeJSError;
35
+ /**
36
+ * Check if error is a permission error (EACCES or EPERM)
37
+ */
38
+ export declare function isPermissionError(error: unknown): boolean;
35
39
  export declare function handleCliError(error: unknown, defaultHandler: (err: unknown) => Promise<void>, exitFn?: (code: number) => void): Promise<void>;
36
40
  export {};
37
41
  //# sourceMappingURL=error-utils.d.ts.map
@@ -63,6 +63,12 @@ export function toError(error) {
63
63
  export function isNodeError(error) {
64
64
  return isError(error) && 'code' in error && typeof error.code === 'string';
65
65
  }
66
+ /**
67
+ * Check if error is a permission error (EACCES or EPERM)
68
+ */
69
+ export function isPermissionError(error) {
70
+ return isNodeError(error) && (error.code === 'EACCES' || error.code === 'EPERM');
71
+ }
66
72
  export async function handleCliError(error, defaultHandler, exitFn = process.exit) {
67
73
  // Type guard for OCLIF errors
68
74
  const isOclifError = (err) => {
@@ -1,6 +1,7 @@
1
1
  import fs from 'fs-extra';
2
2
  import * as path from 'path';
3
3
  import { PermissionError, DataError } from '../types/errors.js';
4
+ import { isPermissionError, toError } from './error-utils.js';
4
5
  /**
5
6
  * FileSystem utility class for safe file operations
6
7
  */
@@ -34,8 +35,7 @@ export class FileSystem {
34
35
  throw new DataError('Failed to write file and restore backup', `Check file permissions for ${fullPath}`);
35
36
  }
36
37
  }
37
- const { isNodeError, toError } = await import('./error-utils.js');
38
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'EPERM')) {
38
+ if (isPermissionError(error)) {
39
39
  throw new PermissionError(`Permission denied: Cannot write to ${filePath}`, 'Try running with appropriate permissions or check file ownership');
40
40
  }
41
41
  throw toError(error);
@@ -53,8 +53,7 @@ export class FileSystem {
53
53
  return await fs.readFile(fullPath, 'utf-8');
54
54
  }
55
55
  catch (error) {
56
- const { isNodeError, toError } = await import('./error-utils.js');
57
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'EPERM')) {
56
+ if (isPermissionError(error)) {
58
57
  throw new PermissionError(`Permission denied: Cannot read ${filePath}`, 'Check file permissions');
59
58
  }
60
59
  throw toError(error);
@@ -69,8 +68,7 @@ export class FileSystem {
69
68
  await fs.ensureDir(fullPath);
70
69
  }
71
70
  catch (error) {
72
- const { isNodeError, toError } = await import('./error-utils.js');
73
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'EPERM')) {
71
+ if (isPermissionError(error)) {
74
72
  throw new PermissionError(`Permission denied: Cannot create directory ${dirPath}`, 'Check parent directory permissions');
75
73
  }
76
74
  throw toError(error);
@@ -162,8 +160,7 @@ export class FileSystem {
162
160
  return files;
163
161
  }
164
162
  catch (error) {
165
- const { isNodeError, toError } = await import('./error-utils.js');
166
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'EPERM')) {
163
+ if (isPermissionError(error)) {
167
164
  throw new PermissionError(`Permission denied: Cannot read directory ${dirPath}`, 'Check directory permissions');
168
165
  }
169
166
  throw toError(error);
@@ -179,8 +176,7 @@ export class FileSystem {
179
176
  await fs.copy(srcPath, destPath);
180
177
  }
181
178
  catch (error) {
182
- const { isNodeError, toError } = await import('./error-utils.js');
183
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'EPERM')) {
179
+ if (isPermissionError(error)) {
184
180
  throw new PermissionError(`Permission denied: Cannot copy from ${src} to ${dest}`, 'Check file permissions');
185
181
  }
186
182
  throw toError(error);
@@ -197,8 +193,7 @@ export class FileSystem {
197
193
  }
198
194
  }
199
195
  catch (error) {
200
- const { isNodeError, toError } = await import('./error-utils.js');
201
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'EPERM')) {
196
+ if (isPermissionError(error)) {
202
197
  throw new PermissionError(`Permission denied: Cannot remove ${filePath}`, 'Check file permissions');
203
198
  }
204
199
  throw toError(error);
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Legacy Command Cleanup Utility
3
+ *
4
+ * This module handles cleanup of old command naming patterns from previous
5
+ * Clavix versions. It identifies files using deprecated naming conventions
6
+ * and assists in migration to the current standard.
7
+ *
8
+ * @deprecated This module is scheduled for removal in v6.0.0.
9
+ * By that version, all legacy naming patterns should be fully migrated.
10
+ * After v6.0.0, the cleanup functionality will no longer be needed as
11
+ * the transition period will be complete.
12
+ *
13
+ * @since v4.12.0
14
+ */
1
15
  import { AgentAdapter } from '../types/agent.js';
2
16
  export declare function collectLegacyCommandFiles(adapter: AgentAdapter, commandNames: string[]): Promise<string[]>;
3
17
  //# sourceMappingURL=legacy-command-cleanup.d.ts.map
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Legacy Command Cleanup Utility
3
+ *
4
+ * This module handles cleanup of old command naming patterns from previous
5
+ * Clavix versions. It identifies files using deprecated naming conventions
6
+ * and assists in migration to the current standard.
7
+ *
8
+ * @deprecated This module is scheduled for removal in v6.0.0.
9
+ * By that version, all legacy naming patterns should be fully migrated.
10
+ * After v6.0.0, the cleanup functionality will no longer be needed as
11
+ * the transition period will be complete.
12
+ *
13
+ * @since v4.12.0
14
+ */
1
15
  import * as path from 'path';
2
16
  import { FileSystem } from './file-system.js';
3
17
  /**
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Centralized logging utility for Clavix
3
+ * Respects DEBUG environment variable for verbose output
4
+ */
5
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
6
+ /**
7
+ * Logger utility with consistent formatting
8
+ */
9
+ export declare const logger: {
10
+ /**
11
+ * Debug messages - only shown when DEBUG=true
12
+ */
13
+ debug: (message: string, ...args: unknown[]) => void;
14
+ /**
15
+ * Informational messages
16
+ */
17
+ info: (message: string, ...args: unknown[]) => void;
18
+ /**
19
+ * Warning messages
20
+ */
21
+ warn: (message: string, ...args: unknown[]) => void;
22
+ /**
23
+ * Error messages
24
+ */
25
+ error: (message: string, ...args: unknown[]) => void;
26
+ /**
27
+ * Log with specific level
28
+ */
29
+ log: (level: LogLevel, message: string, ...args: unknown[]) => void;
30
+ };
31
+ export {};
32
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Centralized logging utility for Clavix
3
+ * Respects DEBUG environment variable for verbose output
4
+ */
5
+ const isDebug = () => process.env.DEBUG === 'true' || process.env.DEBUG === '1';
6
+ /**
7
+ * Logger utility with consistent formatting
8
+ */
9
+ export const logger = {
10
+ /**
11
+ * Debug messages - only shown when DEBUG=true
12
+ */
13
+ debug: (message, ...args) => {
14
+ if (isDebug()) {
15
+ console.log(`[DEBUG] ${message}`, ...args);
16
+ }
17
+ },
18
+ /**
19
+ * Informational messages
20
+ */
21
+ info: (message, ...args) => {
22
+ console.log(message, ...args);
23
+ },
24
+ /**
25
+ * Warning messages
26
+ */
27
+ warn: (message, ...args) => {
28
+ console.warn(`[WARN] ${message}`, ...args);
29
+ },
30
+ /**
31
+ * Error messages
32
+ */
33
+ error: (message, ...args) => {
34
+ console.error(`[ERROR] ${message}`, ...args);
35
+ },
36
+ /**
37
+ * Log with specific level
38
+ */
39
+ log: (level, message, ...args) => {
40
+ switch (level) {
41
+ case 'debug':
42
+ logger.debug(message, ...args);
43
+ break;
44
+ case 'info':
45
+ logger.info(message, ...args);
46
+ break;
47
+ case 'warn':
48
+ logger.warn(message, ...args);
49
+ break;
50
+ case 'error':
51
+ logger.error(message, ...args);
52
+ break;
53
+ }
54
+ },
55
+ };
56
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * String utility functions for Clavix
3
+ */
4
+ /**
5
+ * Escape special characters in a string for use in a regular expression
6
+ * @param str - The string to escape
7
+ * @returns The escaped string safe for use in RegExp
8
+ */
9
+ export declare function escapeRegex(str: string): string;
10
+ //# sourceMappingURL=string-utils.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * String utility functions for Clavix
3
+ */
4
+ /**
5
+ * Escape special characters in a string for use in a regular expression
6
+ * @param str - The string to escape
7
+ * @returns The escaped string safe for use in RegExp
8
+ */
9
+ export function escapeRegex(str) {
10
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
11
+ }
12
+ //# sourceMappingURL=string-utils.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Version utility for Clavix
3
+ * Centralizes version reading from package.json
4
+ */
5
+ /**
6
+ * Get the current Clavix version from package.json
7
+ * Returns '0.0.0' if package.json cannot be read
8
+ */
9
+ export declare function getVersion(): Promise<string>;
10
+ /**
11
+ * Get version synchronously (for use in type definitions)
12
+ * Falls back to hardcoded version if file cannot be read
13
+ */
14
+ export declare function getVersionSync(): string;
15
+ /**
16
+ * Current version constant (set at module load time)
17
+ * Use this when you need a static version value
18
+ */
19
+ export declare const CLAVIX_VERSION: string;
20
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Version utility for Clavix
3
+ * Centralizes version reading from package.json
4
+ */
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+ /**
11
+ * Get the current Clavix version from package.json
12
+ * Returns '0.0.0' if package.json cannot be read
13
+ */
14
+ export async function getVersion() {
15
+ try {
16
+ const packageJsonPath = path.join(__dirname, '../../package.json');
17
+ const packageJson = await fs.readJson(packageJsonPath);
18
+ return packageJson.version || '0.0.0';
19
+ }
20
+ catch {
21
+ return '0.0.0';
22
+ }
23
+ }
24
+ /**
25
+ * Get version synchronously (for use in type definitions)
26
+ * Falls back to hardcoded version if file cannot be read
27
+ */
28
+ export function getVersionSync() {
29
+ try {
30
+ const packageJsonPath = path.join(__dirname, '../../package.json');
31
+ const packageJson = fs.readJsonSync(packageJsonPath);
32
+ return packageJson.version || '0.0.0';
33
+ }
34
+ catch {
35
+ return '0.0.0';
36
+ }
37
+ }
38
+ /**
39
+ * Current version constant (set at module load time)
40
+ * Use this when you need a static version value
41
+ */
42
+ export const CLAVIX_VERSION = getVersionSync();
43
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1,130 @@
1
+ {
2
+ "commands": {
3
+ "diagnose": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Diagnose Clavix installation and configuration",
7
+ "examples": [
8
+ "<%= config.bin %> <%= command.id %>",
9
+ "<%= config.bin %> <%= command.id %> # Check setup and report issues"
10
+ ],
11
+ "flags": {},
12
+ "hasDynamicHelp": false,
13
+ "hiddenAliases": [],
14
+ "id": "diagnose",
15
+ "pluginAlias": "clavix",
16
+ "pluginName": "clavix",
17
+ "pluginType": "core",
18
+ "strict": true,
19
+ "enableJsonFlag": false,
20
+ "DOC_GENERATORS": [
21
+ "agents-md",
22
+ "octo-md",
23
+ "warp-md",
24
+ "copilot-instructions"
25
+ ],
26
+ "isESM": true,
27
+ "relativePath": [
28
+ "dist",
29
+ "cli",
30
+ "commands",
31
+ "diagnose.js"
32
+ ]
33
+ },
34
+ "init": {
35
+ "aliases": [],
36
+ "args": {},
37
+ "description": "Initialize Clavix in the current project",
38
+ "examples": [
39
+ "<%= config.bin %> <%= command.id %>"
40
+ ],
41
+ "flags": {},
42
+ "hasDynamicHelp": false,
43
+ "hiddenAliases": [],
44
+ "id": "init",
45
+ "pluginAlias": "clavix",
46
+ "pluginName": "clavix",
47
+ "pluginType": "core",
48
+ "strict": true,
49
+ "enableJsonFlag": false,
50
+ "isESM": true,
51
+ "relativePath": [
52
+ "dist",
53
+ "cli",
54
+ "commands",
55
+ "init.js"
56
+ ]
57
+ },
58
+ "update": {
59
+ "aliases": [],
60
+ "args": {},
61
+ "description": "Update managed blocks and slash commands",
62
+ "examples": [
63
+ "<%= config.bin %> <%= command.id %>",
64
+ "<%= config.bin %> <%= command.id %> --docs-only",
65
+ "<%= config.bin %> <%= command.id %> --commands-only"
66
+ ],
67
+ "flags": {
68
+ "docs-only": {
69
+ "description": "Update only documentation blocks (AGENTS.md, CLAUDE.md, OCTO.md, WARP.md)",
70
+ "name": "docs-only",
71
+ "allowNo": false,
72
+ "type": "boolean"
73
+ },
74
+ "commands-only": {
75
+ "description": "Update only slash command files",
76
+ "name": "commands-only",
77
+ "allowNo": false,
78
+ "type": "boolean"
79
+ },
80
+ "force": {
81
+ "char": "f",
82
+ "description": "Force update even if files haven't changed",
83
+ "name": "force",
84
+ "allowNo": false,
85
+ "type": "boolean"
86
+ }
87
+ },
88
+ "hasDynamicHelp": false,
89
+ "hiddenAliases": [],
90
+ "id": "update",
91
+ "pluginAlias": "clavix",
92
+ "pluginName": "clavix",
93
+ "pluginType": "core",
94
+ "strict": true,
95
+ "enableJsonFlag": false,
96
+ "isESM": true,
97
+ "relativePath": [
98
+ "dist",
99
+ "cli",
100
+ "commands",
101
+ "update.js"
102
+ ]
103
+ },
104
+ "version": {
105
+ "aliases": [],
106
+ "args": {},
107
+ "description": "Display Clavix version",
108
+ "examples": [
109
+ "<%= config.bin %> <%= command.id %>"
110
+ ],
111
+ "flags": {},
112
+ "hasDynamicHelp": false,
113
+ "hiddenAliases": [],
114
+ "id": "version",
115
+ "pluginAlias": "clavix",
116
+ "pluginName": "clavix",
117
+ "pluginType": "core",
118
+ "strict": true,
119
+ "enableJsonFlag": false,
120
+ "isESM": true,
121
+ "relativePath": [
122
+ "dist",
123
+ "cli",
124
+ "commands",
125
+ "version.js"
126
+ ]
127
+ }
128
+ },
129
+ "version": "5.2.1"
130
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "5.2.1",
3
+ "version": "5.3.1",
4
4
  "description": "Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation.\n\nSLASH COMMANDS (in your AI assistant):\n /clavix:improve Optimize prompts with auto-depth\n /clavix:prd Generate PRD through questions\n /clavix:plan Create task breakdown from PRD\n /clavix:implement Execute tasks with progress tracking\n /clavix:start Begin conversational session\n /clavix:summarize Extract requirements from conversation\n\nWorks with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,28 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- export default class Config extends Command {
3
- static description: string;
4
- static examples: string[];
5
- static args: {
6
- action: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
- key: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
8
- value: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
9
- };
10
- static flags: {};
11
- run(): Promise<void>;
12
- private showInteractiveMenu;
13
- private manageIntegrations;
14
- private addIntegrations;
15
- private removeIntegrations;
16
- private replaceIntegrations;
17
- private getConfig;
18
- private setConfig;
19
- private editConfig;
20
- private resetConfig;
21
- private editPreferences;
22
- private loadConfig;
23
- private saveConfig;
24
- private displayConfig;
25
- private getNestedValue;
26
- private setNestedValue;
27
- }
28
- //# sourceMappingURL=config.d.ts.map