@fission-ai/openspec 0.9.0 → 0.9.2

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);
@@ -4,6 +4,7 @@ import { SlashCommandConfigurator } from "./base.js";
4
4
  import { TemplateManager } from "../../templates/index.js";
5
5
  import { FileSystemUtils } from "../../../utils/file-system.js";
6
6
  import { OPENSPEC_MARKERS } from "../../config.js";
7
+ // Use POSIX-style paths for consistent logging across platforms.
7
8
  const FILE_PATHS = {
8
9
  proposal: ".codex/prompts/openspec-proposal.md",
9
10
  apply: ".codex/prompts/openspec-apply.md",
@@ -43,8 +44,8 @@ $ARGUMENTS`,
43
44
  getGlobalPromptsDir() {
44
45
  const home = (process.env.CODEX_HOME && process.env.CODEX_HOME.trim())
45
46
  ? process.env.CODEX_HOME.trim()
46
- : path.join(os.homedir(), ".codex");
47
- return path.join(home, "prompts");
47
+ : FileSystemUtils.joinPath(os.homedir(), ".codex");
48
+ return FileSystemUtils.joinPath(home, "prompts");
48
49
  }
49
50
  // Codex discovers prompts globally. Generate directly in the global directory
50
51
  // and wrap shared body with markers.
@@ -53,7 +54,7 @@ $ARGUMENTS`,
53
54
  for (const target of this.getTargets()) {
54
55
  const body = TemplateManager.getSlashCommandBody(target.id).trim();
55
56
  const promptsDir = this.getGlobalPromptsDir();
56
- const filePath = path.join(promptsDir, path.basename(target.path));
57
+ const filePath = FileSystemUtils.joinPath(promptsDir, path.basename(target.path));
57
58
  await FileSystemUtils.createDirectory(path.dirname(filePath));
58
59
  if (await FileSystemUtils.fileExists(filePath)) {
59
60
  await this.updateFullFile(filePath, target.id, body);
@@ -74,7 +75,7 @@ $ARGUMENTS`,
74
75
  const updated = [];
75
76
  for (const target of this.getTargets()) {
76
77
  const promptsDir = this.getGlobalPromptsDir();
77
- const filePath = path.join(promptsDir, path.basename(target.path));
78
+ const filePath = FileSystemUtils.joinPath(promptsDir, path.basename(target.path));
78
79
  if (await FileSystemUtils.fileExists(filePath)) {
79
80
  const body = TemplateManager.getSlashCommandBody(target.id).trim();
80
81
  await this.updateFullFile(filePath, target.id, body);
@@ -102,7 +103,7 @@ $ARGUMENTS`,
102
103
  resolveAbsolutePath(_projectPath, id) {
103
104
  const promptsDir = this.getGlobalPromptsDir();
104
105
  const fileName = path.basename(FILE_PATHS[id]);
105
- return path.join(promptsDir, fileName);
106
+ return FileSystemUtils.joinPath(promptsDir, fileName);
106
107
  }
107
108
  }
108
109
  //# sourceMappingURL=codex.js.map
@@ -70,7 +70,9 @@ export class UpdateCommand {
70
70
  summaryParts.push(`Updated AI tool files: ${aiToolFiles.join(', ')}`);
71
71
  }
72
72
  if (updatedSlashFiles.length > 0) {
73
- summaryParts.push(`Updated slash commands: ${updatedSlashFiles.join(', ')}`);
73
+ // Normalize to forward slashes for cross-platform log consistency
74
+ const normalized = updatedSlashFiles.map((p) => p.replace(/\\/g, '/'));
75
+ summaryParts.push(`Updated slash commands: ${normalized.join(', ')}`);
74
76
  }
75
77
  const failedItems = [
76
78
  ...failedFiles,
@@ -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.0",
3
+ "version": "0.9.2",
4
4
  "description": "AI-native system for spec-driven development",
5
5
  "keywords": [
6
6
  "openspec",