@fission-ai/openspec 0.9.1 → 0.10.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.
@@ -1,4 +1,3 @@
1
- import path from 'path';
2
1
  import { FileSystemUtils } from '../../../utils/file-system.js';
3
2
  import { TemplateManager } from '../../templates/index.js';
4
3
  import { OPENSPEC_MARKERS } from '../../config.js';
@@ -15,7 +14,7 @@ export class SlashCommandConfigurator {
15
14
  const createdOrUpdated = [];
16
15
  for (const target of this.getTargets()) {
17
16
  const body = TemplateManager.getSlashCommandBody(target.id).trim();
18
- const filePath = path.join(projectPath, target.path);
17
+ const filePath = FileSystemUtils.joinPath(projectPath, target.path);
19
18
  if (await FileSystemUtils.fileExists(filePath)) {
20
19
  await this.updateBody(filePath, body);
21
20
  }
@@ -36,7 +35,7 @@ export class SlashCommandConfigurator {
36
35
  async updateExisting(projectPath, _openspecDir) {
37
36
  const updated = [];
38
37
  for (const target of this.getTargets()) {
39
- const filePath = path.join(projectPath, target.path);
38
+ const filePath = FileSystemUtils.joinPath(projectPath, target.path);
40
39
  if (await FileSystemUtils.fileExists(filePath)) {
41
40
  const body = TemplateManager.getSlashCommandBody(target.id).trim();
42
41
  await this.updateBody(filePath, body);
@@ -49,7 +48,7 @@ export class SlashCommandConfigurator {
49
48
  // to redirect to tool-specific locations (e.g., global directories).
50
49
  resolveAbsolutePath(projectPath, id) {
51
50
  const rel = this.getRelativePath(id);
52
- return path.join(projectPath, rel);
51
+ return FileSystemUtils.joinPath(projectPath, rel);
53
52
  }
54
53
  async updateBody(filePath, body) {
55
54
  const content = await FileSystemUtils.readFile(filePath);
@@ -44,8 +44,8 @@ $ARGUMENTS`,
44
44
  getGlobalPromptsDir() {
45
45
  const home = (process.env.CODEX_HOME && process.env.CODEX_HOME.trim())
46
46
  ? process.env.CODEX_HOME.trim()
47
- : path.join(os.homedir(), ".codex");
48
- return path.join(home, "prompts");
47
+ : FileSystemUtils.joinPath(os.homedir(), ".codex");
48
+ return FileSystemUtils.joinPath(home, "prompts");
49
49
  }
50
50
  // Codex discovers prompts globally. Generate directly in the global directory
51
51
  // and wrap shared body with markers.
@@ -54,7 +54,7 @@ $ARGUMENTS`,
54
54
  for (const target of this.getTargets()) {
55
55
  const body = TemplateManager.getSlashCommandBody(target.id).trim();
56
56
  const promptsDir = this.getGlobalPromptsDir();
57
- const filePath = path.join(promptsDir, path.basename(target.path));
57
+ const filePath = FileSystemUtils.joinPath(promptsDir, path.basename(target.path));
58
58
  await FileSystemUtils.createDirectory(path.dirname(filePath));
59
59
  if (await FileSystemUtils.fileExists(filePath)) {
60
60
  await this.updateFullFile(filePath, target.id, body);
@@ -75,7 +75,7 @@ $ARGUMENTS`,
75
75
  const updated = [];
76
76
  for (const target of this.getTargets()) {
77
77
  const promptsDir = this.getGlobalPromptsDir();
78
- const filePath = path.join(promptsDir, path.basename(target.path));
78
+ const filePath = FileSystemUtils.joinPath(promptsDir, path.basename(target.path));
79
79
  if (await FileSystemUtils.fileExists(filePath)) {
80
80
  const body = TemplateManager.getSlashCommandBody(target.id).trim();
81
81
  await this.updateFullFile(filePath, target.id, body);
@@ -103,7 +103,7 @@ $ARGUMENTS`,
103
103
  resolveAbsolutePath(_projectPath, id) {
104
104
  const promptsDir = this.getGlobalPromptsDir();
105
105
  const fileName = path.basename(FILE_PATHS[id]);
106
- return path.join(promptsDir, fileName);
106
+ return FileSystemUtils.joinPath(promptsDir, fileName);
107
107
  }
108
108
  }
109
109
  //# sourceMappingURL=codex.js.map
package/dist/core/init.js CHANGED
@@ -137,6 +137,14 @@ const toolSelectionWizard = createPrompt((config, done) => {
137
137
  return;
138
138
  }
139
139
  if (isEnterKey(key)) {
140
+ const current = config.choices[cursor];
141
+ if (current &&
142
+ current.selectable &&
143
+ !selectedSet.has(current.value)) {
144
+ const next = new Set(selected);
145
+ next.add(current.value);
146
+ updateSelected(next);
147
+ }
140
148
  setStep('review');
141
149
  setError(null);
142
150
  return;
@@ -195,7 +203,7 @@ const toolSelectionWizard = createPrompt((config, done) => {
195
203
  }
196
204
  else if (step === 'select') {
197
205
  lines.push(PALETTE.white(config.baseMessage));
198
- lines.push(PALETTE.midGray('Use ↑/↓ to move · Space to toggle · Enter to review selections.'));
206
+ lines.push(PALETTE.midGray('Use ↑/↓ to move · Space to toggle · Enter selects highlighted tool and reviews.'));
199
207
  lines.push('');
200
208
  lines.push(page);
201
209
  lines.push('');
@@ -1,4 +1,7 @@
1
1
  export declare class FileSystemUtils {
2
+ private static isWindowsBasePath;
3
+ private static normalizeSegments;
4
+ static joinPath(basePath: string, ...segments: string[]): string;
2
5
  static createDirectory(dirPath: string): Promise<void>;
3
6
  static fileExists(filePath: string): Promise<boolean>;
4
7
  static canWriteFile(filePath: string): Promise<boolean>;
@@ -30,6 +30,27 @@ function findMarkerIndex(content, marker, fromIndex = 0) {
30
30
  return -1;
31
31
  }
32
32
  export class FileSystemUtils {
33
+ static isWindowsBasePath(basePath) {
34
+ return /^[A-Za-z]:[\\/]/.test(basePath) || basePath.startsWith('\\');
35
+ }
36
+ static normalizeSegments(segments) {
37
+ return segments
38
+ .flatMap((segment) => segment.split(/[\\/]+/u))
39
+ .filter((part) => part.length > 0);
40
+ }
41
+ static joinPath(basePath, ...segments) {
42
+ const normalizedSegments = this.normalizeSegments(segments);
43
+ if (this.isWindowsBasePath(basePath)) {
44
+ const normalizedBasePath = path.win32.normalize(basePath);
45
+ return normalizedSegments.length
46
+ ? path.win32.join(normalizedBasePath, ...normalizedSegments)
47
+ : normalizedBasePath;
48
+ }
49
+ const posixBasePath = basePath.replace(/\\/g, '/');
50
+ return normalizedSegments.length
51
+ ? path.posix.join(posixBasePath, ...normalizedSegments)
52
+ : path.posix.normalize(posixBasePath);
53
+ }
33
54
  static async createDirectory(dirPath) {
34
55
  await fs.mkdir(dirPath, { recursive: true });
35
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fission-ai/openspec",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "AI-native system for spec-driven development",
5
5
  "keywords": [
6
6
  "openspec",