@fission-ai/openspec 0.17.2 → 0.19.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 (89) hide show
  1. package/README.md +52 -0
  2. package/dist/cli/index.js +39 -3
  3. package/dist/commands/artifact-workflow.d.ts +17 -0
  4. package/dist/commands/artifact-workflow.js +823 -0
  5. package/dist/commands/completion.js +42 -6
  6. package/dist/core/archive.d.ts +0 -5
  7. package/dist/core/archive.js +4 -257
  8. package/dist/core/artifact-graph/graph.d.ts +56 -0
  9. package/dist/core/artifact-graph/graph.js +141 -0
  10. package/dist/core/artifact-graph/index.d.ts +7 -0
  11. package/dist/core/artifact-graph/index.js +13 -0
  12. package/dist/core/artifact-graph/instruction-loader.d.ts +130 -0
  13. package/dist/core/artifact-graph/instruction-loader.js +173 -0
  14. package/dist/core/artifact-graph/resolver.d.ts +61 -0
  15. package/dist/core/artifact-graph/resolver.js +187 -0
  16. package/dist/core/artifact-graph/schema.d.ts +13 -0
  17. package/dist/core/artifact-graph/schema.js +108 -0
  18. package/dist/core/artifact-graph/state.d.ts +12 -0
  19. package/dist/core/artifact-graph/state.js +54 -0
  20. package/dist/core/artifact-graph/types.d.ts +45 -0
  21. package/dist/core/artifact-graph/types.js +43 -0
  22. package/dist/core/completions/command-registry.js +7 -1
  23. package/dist/core/completions/factory.d.ts +15 -2
  24. package/dist/core/completions/factory.js +19 -1
  25. package/dist/core/completions/generators/bash-generator.d.ts +32 -0
  26. package/dist/core/completions/generators/bash-generator.js +174 -0
  27. package/dist/core/completions/generators/fish-generator.d.ts +32 -0
  28. package/dist/core/completions/generators/fish-generator.js +157 -0
  29. package/dist/core/completions/generators/powershell-generator.d.ts +32 -0
  30. package/dist/core/completions/generators/powershell-generator.js +198 -0
  31. package/dist/core/completions/generators/zsh-generator.d.ts +0 -14
  32. package/dist/core/completions/generators/zsh-generator.js +55 -124
  33. package/dist/core/completions/installers/bash-installer.d.ts +87 -0
  34. package/dist/core/completions/installers/bash-installer.js +318 -0
  35. package/dist/core/completions/installers/fish-installer.d.ts +43 -0
  36. package/dist/core/completions/installers/fish-installer.js +143 -0
  37. package/dist/core/completions/installers/powershell-installer.d.ts +88 -0
  38. package/dist/core/completions/installers/powershell-installer.js +327 -0
  39. package/dist/core/completions/installers/zsh-installer.d.ts +1 -12
  40. package/dist/core/completions/templates/bash-templates.d.ts +6 -0
  41. package/dist/core/completions/templates/bash-templates.js +24 -0
  42. package/dist/core/completions/templates/fish-templates.d.ts +7 -0
  43. package/dist/core/completions/templates/fish-templates.js +39 -0
  44. package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
  45. package/dist/core/completions/templates/powershell-templates.js +25 -0
  46. package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
  47. package/dist/core/completions/templates/zsh-templates.js +36 -0
  48. package/dist/core/config.js +1 -0
  49. package/dist/core/configurators/slash/codebuddy.js +6 -9
  50. package/dist/core/configurators/slash/continue.d.ts +9 -0
  51. package/dist/core/configurators/slash/continue.js +46 -0
  52. package/dist/core/configurators/slash/registry.js +3 -0
  53. package/dist/core/converters/json-converter.js +2 -1
  54. package/dist/core/global-config.d.ts +10 -0
  55. package/dist/core/global-config.js +28 -0
  56. package/dist/core/index.d.ts +1 -1
  57. package/dist/core/index.js +1 -1
  58. package/dist/core/list.d.ts +6 -1
  59. package/dist/core/list.js +88 -6
  60. package/dist/core/specs-apply.d.ts +73 -0
  61. package/dist/core/specs-apply.js +384 -0
  62. package/dist/core/templates/skill-templates.d.ts +86 -0
  63. package/dist/core/templates/skill-templates.js +1934 -0
  64. package/dist/core/update.js +1 -1
  65. package/dist/core/validation/validator.js +2 -1
  66. package/dist/core/view.js +28 -8
  67. package/dist/telemetry/config.d.ts +32 -0
  68. package/dist/telemetry/config.js +68 -0
  69. package/dist/telemetry/index.d.ts +31 -0
  70. package/dist/telemetry/index.js +145 -0
  71. package/dist/utils/change-metadata.d.ts +47 -0
  72. package/dist/utils/change-metadata.js +130 -0
  73. package/dist/utils/change-utils.d.ts +51 -0
  74. package/dist/utils/change-utils.js +100 -0
  75. package/dist/utils/file-system.d.ts +11 -0
  76. package/dist/utils/file-system.js +50 -2
  77. package/dist/utils/index.d.ts +3 -1
  78. package/dist/utils/index.js +4 -1
  79. package/package.json +5 -1
  80. package/schemas/spec-driven/schema.yaml +148 -0
  81. package/schemas/spec-driven/templates/design.md +19 -0
  82. package/schemas/spec-driven/templates/proposal.md +23 -0
  83. package/schemas/spec-driven/templates/spec.md +8 -0
  84. package/schemas/spec-driven/templates/tasks.md +9 -0
  85. package/schemas/tdd/schema.yaml +213 -0
  86. package/schemas/tdd/templates/docs.md +15 -0
  87. package/schemas/tdd/templates/implementation.md +11 -0
  88. package/schemas/tdd/templates/spec.md +11 -0
  89. package/schemas/tdd/templates/test.md +11 -0
@@ -0,0 +1,318 @@
1
+ import { promises as fs } from 'fs';
2
+ import path from 'path';
3
+ import os from 'os';
4
+ import { FileSystemUtils } from '../../../utils/file-system.js';
5
+ /**
6
+ * Installer for Bash completion scripts.
7
+ * Supports bash-completion package and standalone installations.
8
+ */
9
+ export class BashInstaller {
10
+ homeDir;
11
+ /**
12
+ * Markers for .bashrc configuration management
13
+ */
14
+ BASHRC_MARKERS = {
15
+ start: '# OPENSPEC:START',
16
+ end: '# OPENSPEC:END',
17
+ };
18
+ constructor(homeDir = os.homedir()) {
19
+ this.homeDir = homeDir;
20
+ }
21
+ /**
22
+ * Check if bash-completion is installed
23
+ *
24
+ * @returns true if bash-completion directories exist
25
+ */
26
+ async isBashCompletionInstalled() {
27
+ const paths = [
28
+ '/usr/share/bash-completion', // Linux system-wide
29
+ '/usr/local/share/bash-completion', // Homebrew Intel (main)
30
+ '/opt/homebrew/etc/bash_completion.d', // Homebrew Apple Silicon
31
+ '/usr/local/etc/bash_completion.d', // Homebrew Intel (alt path)
32
+ '/etc/bash_completion.d', // Legacy fallback
33
+ ];
34
+ for (const p of paths) {
35
+ try {
36
+ const stat = await fs.stat(p);
37
+ if (stat.isDirectory()) {
38
+ return true;
39
+ }
40
+ }
41
+ catch {
42
+ // Continue checking other paths
43
+ }
44
+ }
45
+ return false;
46
+ }
47
+ /**
48
+ * Get the appropriate installation path for the completion script
49
+ *
50
+ * @returns Installation path
51
+ */
52
+ async getInstallationPath() {
53
+ // Try user-local bash-completion directory first
54
+ const localCompletionDir = path.join(this.homeDir, '.local', 'share', 'bash-completion', 'completions');
55
+ // For user installation, use local directory
56
+ return path.join(localCompletionDir, 'openspec');
57
+ }
58
+ /**
59
+ * Backup an existing completion file if it exists
60
+ *
61
+ * @param targetPath - Path to the file to backup
62
+ * @returns Path to the backup file, or undefined if no backup was needed
63
+ */
64
+ async backupExistingFile(targetPath) {
65
+ try {
66
+ await fs.access(targetPath);
67
+ // File exists, create a backup
68
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
69
+ const backupPath = `${targetPath}.backup-${timestamp}`;
70
+ await fs.copyFile(targetPath, backupPath);
71
+ return backupPath;
72
+ }
73
+ catch {
74
+ // File doesn't exist, no backup needed
75
+ return undefined;
76
+ }
77
+ }
78
+ /**
79
+ * Get the path to .bashrc file
80
+ *
81
+ * @returns Path to .bashrc
82
+ */
83
+ getBashrcPath() {
84
+ return path.join(this.homeDir, '.bashrc');
85
+ }
86
+ /**
87
+ * Generate .bashrc configuration content
88
+ *
89
+ * @param completionsDir - Directory containing completion scripts
90
+ * @returns Configuration content
91
+ */
92
+ generateBashrcConfig(completionsDir) {
93
+ return [
94
+ '# OpenSpec shell completions configuration',
95
+ `if [ -d "${completionsDir}" ]; then`,
96
+ ` for f in "${completionsDir}"/*; do`,
97
+ ' [ -f "$f" ] && . "$f"',
98
+ ' done',
99
+ 'fi',
100
+ ].join('\n');
101
+ }
102
+ /**
103
+ * Configure .bashrc to enable completions
104
+ *
105
+ * @param completionsDir - Directory containing completion scripts
106
+ * @returns true if configured successfully, false otherwise
107
+ */
108
+ async configureBashrc(completionsDir) {
109
+ // Check if auto-configuration is disabled
110
+ if (process.env.OPENSPEC_NO_AUTO_CONFIG === '1') {
111
+ return false;
112
+ }
113
+ try {
114
+ const bashrcPath = this.getBashrcPath();
115
+ const config = this.generateBashrcConfig(completionsDir);
116
+ // Check write permissions
117
+ const canWrite = await FileSystemUtils.canWriteFile(bashrcPath);
118
+ if (!canWrite) {
119
+ return false;
120
+ }
121
+ // Use marker-based update
122
+ await FileSystemUtils.updateFileWithMarkers(bashrcPath, config, this.BASHRC_MARKERS.start, this.BASHRC_MARKERS.end);
123
+ return true;
124
+ }
125
+ catch (error) {
126
+ // Fail gracefully - don't break installation
127
+ console.debug(`Unable to configure .bashrc for completions: ${error.message}`);
128
+ return false;
129
+ }
130
+ }
131
+ /**
132
+ * Remove .bashrc configuration
133
+ * Used during uninstallation
134
+ *
135
+ * @returns true if removed successfully, false otherwise
136
+ */
137
+ async removeBashrcConfig() {
138
+ try {
139
+ const bashrcPath = this.getBashrcPath();
140
+ // Check if file exists
141
+ try {
142
+ await fs.access(bashrcPath);
143
+ }
144
+ catch {
145
+ // File doesn't exist, nothing to remove
146
+ return true;
147
+ }
148
+ // Read file content
149
+ const content = await fs.readFile(bashrcPath, 'utf-8');
150
+ // Check if markers exist
151
+ if (!content.includes(this.BASHRC_MARKERS.start) || !content.includes(this.BASHRC_MARKERS.end)) {
152
+ // Markers don't exist, nothing to remove
153
+ return true;
154
+ }
155
+ // Remove content between markers (including markers)
156
+ const lines = content.split('\n');
157
+ const startIndex = lines.findIndex((line) => line.trim() === this.BASHRC_MARKERS.start);
158
+ const endIndex = lines.findIndex((line) => line.trim() === this.BASHRC_MARKERS.end);
159
+ if (startIndex === -1 || endIndex === -1 || endIndex < startIndex) {
160
+ // Invalid marker placement
161
+ return false;
162
+ }
163
+ // Remove lines between markers (inclusive)
164
+ lines.splice(startIndex, endIndex - startIndex + 1);
165
+ // Remove trailing empty lines
166
+ while (lines.length > 0 && lines[lines.length - 1].trim() === '') {
167
+ lines.pop();
168
+ }
169
+ // Write back
170
+ await fs.writeFile(bashrcPath, lines.join('\n'), 'utf-8');
171
+ return true;
172
+ }
173
+ catch (error) {
174
+ // Fail gracefully
175
+ console.debug(`Unable to remove .bashrc configuration: ${error.message}`);
176
+ return false;
177
+ }
178
+ }
179
+ /**
180
+ * Install the completion script
181
+ *
182
+ * @param completionScript - The completion script content to install
183
+ * @returns Installation result with status and instructions
184
+ */
185
+ async install(completionScript) {
186
+ try {
187
+ const targetPath = await this.getInstallationPath();
188
+ // Check for bash-completion package
189
+ const hasBashCompletion = await this.isBashCompletionInstalled();
190
+ // Check if already installed with same content
191
+ let isUpdate = false;
192
+ try {
193
+ const existingContent = await fs.readFile(targetPath, 'utf-8');
194
+ if (existingContent === completionScript) {
195
+ // Already installed and up to date
196
+ return {
197
+ success: true,
198
+ installedPath: targetPath,
199
+ message: 'Completion script is already installed (up to date)',
200
+ instructions: [
201
+ 'The completion script is already installed and up to date.',
202
+ 'If completions are not working, try: exec bash',
203
+ ],
204
+ };
205
+ }
206
+ // File exists but content is different - this is an update
207
+ isUpdate = true;
208
+ }
209
+ catch (error) {
210
+ // File doesn't exist or can't be read, proceed with installation
211
+ console.debug(`Unable to read existing completion file at ${targetPath}: ${error.message}`);
212
+ }
213
+ // Ensure the directory exists
214
+ const targetDir = path.dirname(targetPath);
215
+ await fs.mkdir(targetDir, { recursive: true });
216
+ // Backup existing file if updating
217
+ const backupPath = isUpdate ? await this.backupExistingFile(targetPath) : undefined;
218
+ // Write the completion script
219
+ await fs.writeFile(targetPath, completionScript, 'utf-8');
220
+ // Auto-configure .bashrc
221
+ const bashrcConfigured = await this.configureBashrc(targetDir);
222
+ // Generate instructions if .bashrc wasn't auto-configured
223
+ const instructions = bashrcConfigured ? undefined : this.generateInstructions(targetPath);
224
+ // Collect warnings
225
+ const warnings = [];
226
+ if (!hasBashCompletion) {
227
+ warnings.push('⚠️ Warning: bash-completion package not detected', '', 'The completion script requires bash-completion to function.', 'Install it with:', ' brew install bash-completion@2', '', 'Then add to your ~/.bash_profile:', ' [[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"');
228
+ }
229
+ // Determine appropriate message
230
+ let message;
231
+ if (isUpdate) {
232
+ message = backupPath
233
+ ? 'Completion script updated successfully (previous version backed up)'
234
+ : 'Completion script updated successfully';
235
+ }
236
+ else {
237
+ message = bashrcConfigured
238
+ ? 'Completion script installed and .bashrc configured successfully'
239
+ : 'Completion script installed successfully for Bash';
240
+ }
241
+ return {
242
+ success: true,
243
+ installedPath: targetPath,
244
+ backupPath,
245
+ bashrcConfigured,
246
+ message,
247
+ instructions,
248
+ warnings: warnings.length > 0 ? warnings : undefined,
249
+ };
250
+ }
251
+ catch (error) {
252
+ return {
253
+ success: false,
254
+ message: `Failed to install completion script: ${error instanceof Error ? error.message : String(error)}`,
255
+ };
256
+ }
257
+ }
258
+ /**
259
+ * Generate user instructions for enabling completions
260
+ *
261
+ * @param installedPath - Path where the script was installed
262
+ * @returns Array of instruction strings
263
+ */
264
+ generateInstructions(installedPath) {
265
+ const completionsDir = path.dirname(installedPath);
266
+ return [
267
+ 'Completion script installed successfully.',
268
+ '',
269
+ 'To enable completions, add the following to your ~/.bashrc file:',
270
+ '',
271
+ ` # Source OpenSpec completions`,
272
+ ` if [ -d "${completionsDir}" ]; then`,
273
+ ` for f in "${completionsDir}"/*; do`,
274
+ ' [ -f "$f" ] && . "$f"',
275
+ ' done',
276
+ ' fi',
277
+ '',
278
+ 'Then restart your shell or run: exec bash',
279
+ ];
280
+ }
281
+ /**
282
+ * Uninstall the completion script
283
+ *
284
+ * @param options - Optional uninstall options
285
+ * @param options.yes - Skip confirmation prompt (handled by command layer)
286
+ * @returns Uninstallation result
287
+ */
288
+ async uninstall(options) {
289
+ try {
290
+ const targetPath = await this.getInstallationPath();
291
+ // Check if installed
292
+ try {
293
+ await fs.access(targetPath);
294
+ }
295
+ catch {
296
+ return {
297
+ success: false,
298
+ message: 'Completion script is not installed',
299
+ };
300
+ }
301
+ // Remove the completion script
302
+ await fs.unlink(targetPath);
303
+ // Remove .bashrc configuration
304
+ await this.removeBashrcConfig();
305
+ return {
306
+ success: true,
307
+ message: 'Completion script uninstalled successfully',
308
+ };
309
+ }
310
+ catch (error) {
311
+ return {
312
+ success: false,
313
+ message: `Failed to uninstall completion script: ${error instanceof Error ? error.message : String(error)}`,
314
+ };
315
+ }
316
+ }
317
+ }
318
+ //# sourceMappingURL=bash-installer.js.map
@@ -0,0 +1,43 @@
1
+ import { InstallationResult } from '../factory.js';
2
+ /**
3
+ * Installer for Fish completion scripts.
4
+ * Fish automatically loads completions from ~/.config/fish/completions/
5
+ */
6
+ export declare class FishInstaller {
7
+ private readonly homeDir;
8
+ constructor(homeDir?: string);
9
+ /**
10
+ * Get the installation path for Fish completions
11
+ *
12
+ * @returns Installation path
13
+ */
14
+ getInstallationPath(): string;
15
+ /**
16
+ * Backup an existing completion file if it exists
17
+ *
18
+ * @param targetPath - Path to the file to backup
19
+ * @returns Path to the backup file, or undefined if no backup was needed
20
+ */
21
+ backupExistingFile(targetPath: string): Promise<string | undefined>;
22
+ /**
23
+ * Install the completion script
24
+ *
25
+ * @param completionScript - The completion script content to install
26
+ * @returns Installation result with status and instructions
27
+ */
28
+ install(completionScript: string): Promise<InstallationResult>;
29
+ /**
30
+ * Uninstall the completion script
31
+ *
32
+ * @param options - Optional uninstall options
33
+ * @param options.yes - Skip confirmation prompt (handled by command layer)
34
+ * @returns Uninstallation result
35
+ */
36
+ uninstall(options?: {
37
+ yes?: boolean;
38
+ }): Promise<{
39
+ success: boolean;
40
+ message: string;
41
+ }>;
42
+ }
43
+ //# sourceMappingURL=fish-installer.d.ts.map
@@ -0,0 +1,143 @@
1
+ import { promises as fs } from 'fs';
2
+ import path from 'path';
3
+ import os from 'os';
4
+ /**
5
+ * Installer for Fish completion scripts.
6
+ * Fish automatically loads completions from ~/.config/fish/completions/
7
+ */
8
+ export class FishInstaller {
9
+ homeDir;
10
+ constructor(homeDir = os.homedir()) {
11
+ this.homeDir = homeDir;
12
+ }
13
+ /**
14
+ * Get the installation path for Fish completions
15
+ *
16
+ * @returns Installation path
17
+ */
18
+ getInstallationPath() {
19
+ return path.join(this.homeDir, '.config', 'fish', 'completions', 'openspec.fish');
20
+ }
21
+ /**
22
+ * Backup an existing completion file if it exists
23
+ *
24
+ * @param targetPath - Path to the file to backup
25
+ * @returns Path to the backup file, or undefined if no backup was needed
26
+ */
27
+ async backupExistingFile(targetPath) {
28
+ try {
29
+ await fs.access(targetPath);
30
+ // File exists, create a backup
31
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
32
+ const backupPath = `${targetPath}.backup-${timestamp}`;
33
+ await fs.copyFile(targetPath, backupPath);
34
+ return backupPath;
35
+ }
36
+ catch {
37
+ // File doesn't exist, no backup needed
38
+ return undefined;
39
+ }
40
+ }
41
+ /**
42
+ * Install the completion script
43
+ *
44
+ * @param completionScript - The completion script content to install
45
+ * @returns Installation result with status and instructions
46
+ */
47
+ async install(completionScript) {
48
+ try {
49
+ const targetPath = this.getInstallationPath();
50
+ // Check if already installed with same content
51
+ let isUpdate = false;
52
+ try {
53
+ const existingContent = await fs.readFile(targetPath, 'utf-8');
54
+ if (existingContent === completionScript) {
55
+ // Already installed and up to date
56
+ return {
57
+ success: true,
58
+ installedPath: targetPath,
59
+ message: 'Completion script is already installed (up to date)',
60
+ instructions: [
61
+ 'The completion script is already installed and up to date.',
62
+ 'Fish automatically loads completions - they should be available immediately.',
63
+ ],
64
+ };
65
+ }
66
+ // File exists but content is different - this is an update
67
+ isUpdate = true;
68
+ }
69
+ catch (error) {
70
+ // File doesn't exist or can't be read, proceed with installation
71
+ console.debug(`Unable to read existing completion file at ${targetPath}: ${error.message}`);
72
+ }
73
+ // Ensure the directory exists
74
+ const targetDir = path.dirname(targetPath);
75
+ await fs.mkdir(targetDir, { recursive: true });
76
+ // Backup existing file if updating
77
+ const backupPath = isUpdate ? await this.backupExistingFile(targetPath) : undefined;
78
+ // Write the completion script
79
+ await fs.writeFile(targetPath, completionScript, 'utf-8');
80
+ // Determine appropriate message
81
+ let message;
82
+ if (isUpdate) {
83
+ message = backupPath
84
+ ? 'Completion script updated successfully (previous version backed up)'
85
+ : 'Completion script updated successfully';
86
+ }
87
+ else {
88
+ message = 'Completion script installed successfully for Fish';
89
+ }
90
+ return {
91
+ success: true,
92
+ installedPath: targetPath,
93
+ backupPath,
94
+ message,
95
+ instructions: [
96
+ 'Fish automatically loads completions from ~/.config/fish/completions/',
97
+ 'Completions are available immediately - no shell restart needed.',
98
+ ],
99
+ };
100
+ }
101
+ catch (error) {
102
+ return {
103
+ success: false,
104
+ message: `Failed to install completion script: ${error instanceof Error ? error.message : String(error)}`,
105
+ };
106
+ }
107
+ }
108
+ /**
109
+ * Uninstall the completion script
110
+ *
111
+ * @param options - Optional uninstall options
112
+ * @param options.yes - Skip confirmation prompt (handled by command layer)
113
+ * @returns Uninstallation result
114
+ */
115
+ async uninstall(options) {
116
+ try {
117
+ const targetPath = this.getInstallationPath();
118
+ // Check if installed
119
+ try {
120
+ await fs.access(targetPath);
121
+ }
122
+ catch {
123
+ return {
124
+ success: false,
125
+ message: 'Completion script is not installed',
126
+ };
127
+ }
128
+ // Remove the completion script
129
+ await fs.unlink(targetPath);
130
+ return {
131
+ success: true,
132
+ message: 'Completion script uninstalled successfully',
133
+ };
134
+ }
135
+ catch (error) {
136
+ return {
137
+ success: false,
138
+ message: `Failed to uninstall completion script: ${error instanceof Error ? error.message : String(error)}`,
139
+ };
140
+ }
141
+ }
142
+ }
143
+ //# sourceMappingURL=fish-installer.js.map
@@ -0,0 +1,88 @@
1
+ import { InstallationResult } from '../factory.js';
2
+ /**
3
+ * Installer for PowerShell completion scripts.
4
+ * Works with both Windows PowerShell 5.1 and PowerShell Core 7+
5
+ */
6
+ export declare class PowerShellInstaller {
7
+ private readonly homeDir;
8
+ /**
9
+ * Markers for PowerShell profile configuration management
10
+ */
11
+ private readonly PROFILE_MARKERS;
12
+ constructor(homeDir?: string);
13
+ /**
14
+ * Get PowerShell profile path
15
+ * Prefers $PROFILE environment variable, falls back to platform defaults
16
+ *
17
+ * @returns Profile path
18
+ */
19
+ getProfilePath(): string;
20
+ /**
21
+ * Get all PowerShell profile paths to configure.
22
+ * On Windows, returns both PowerShell Core and Windows PowerShell 5.1 paths.
23
+ * On Unix, returns PowerShell Core path only.
24
+ */
25
+ private getAllProfilePaths;
26
+ /**
27
+ * Get the installation path for the completion script
28
+ *
29
+ * @returns Installation path
30
+ */
31
+ getInstallationPath(): string;
32
+ /**
33
+ * Backup an existing completion file if it exists
34
+ *
35
+ * @param targetPath - Path to the file to backup
36
+ * @returns Path to the backup file, or undefined if no backup was needed
37
+ */
38
+ backupExistingFile(targetPath: string): Promise<string | undefined>;
39
+ /**
40
+ * Generate PowerShell profile configuration content
41
+ *
42
+ * @param scriptPath - Path to the completion script
43
+ * @returns Configuration content
44
+ */
45
+ private generateProfileConfig;
46
+ /**
47
+ * Configure PowerShell profile to source the completion script
48
+ *
49
+ * @param scriptPath - Path to the completion script
50
+ * @returns true if configured successfully, false otherwise
51
+ */
52
+ configureProfile(scriptPath: string): Promise<boolean>;
53
+ /**
54
+ * Remove PowerShell profile configuration
55
+ * Used during uninstallation
56
+ *
57
+ * @returns true if removed successfully, false otherwise
58
+ */
59
+ removeProfileConfig(): Promise<boolean>;
60
+ /**
61
+ * Install the completion script
62
+ *
63
+ * @param completionScript - The completion script content to install
64
+ * @returns Installation result with status and instructions
65
+ */
66
+ install(completionScript: string): Promise<InstallationResult>;
67
+ /**
68
+ * Generate user instructions for enabling completions
69
+ *
70
+ * @param installedPath - Path where the script was installed
71
+ * @returns Array of instruction strings
72
+ */
73
+ private generateInstructions;
74
+ /**
75
+ * Uninstall the completion script
76
+ *
77
+ * @param options - Optional uninstall options
78
+ * @param options.yes - Skip confirmation prompt (handled by command layer)
79
+ * @returns Uninstallation result
80
+ */
81
+ uninstall(options?: {
82
+ yes?: boolean;
83
+ }): Promise<{
84
+ success: boolean;
85
+ message: string;
86
+ }>;
87
+ }
88
+ //# sourceMappingURL=powershell-installer.d.ts.map