@fission-ai/openspec 1.1.0 → 1.1.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.
@@ -4,6 +4,7 @@
4
4
  * Formats commands for OpenCode following its frontmatter specification.
5
5
  */
6
6
  import path from 'path';
7
+ import { transformToHyphenCommands } from '../../../utils/command-references.js';
7
8
  /**
8
9
  * OpenCode adapter for command generation.
9
10
  * File path: .opencode/command/opsx-<id>.md
@@ -15,11 +16,13 @@ export const opencodeAdapter = {
15
16
  return path.join('.opencode', 'command', `opsx-${commandId}.md`);
16
17
  },
17
18
  formatFile(content) {
19
+ // Transform command references from colon to hyphen format for OpenCode
20
+ const transformedBody = transformToHyphenCommands(content.body);
18
21
  return `---
19
22
  description: ${content.description}
20
23
  ---
21
24
 
22
- ${content.body}
25
+ ${transformedBody}
23
26
  `;
24
27
  },
25
28
  };
package/dist/core/init.js CHANGED
@@ -10,6 +10,7 @@ import ora from 'ora';
10
10
  import * as fs from 'fs';
11
11
  import { createRequire } from 'module';
12
12
  import { FileSystemUtils } from '../utils/file-system.js';
13
+ import { transformToHyphenCommands } from '../utils/command-references.js';
13
14
  import { AI_TOOLS, OPENSPEC_DIR_NAME, } from './config.js';
14
15
  import { PALETTE } from './styles/palette.js';
15
16
  import { isInteractive } from '../utils/interactive.js';
@@ -301,7 +302,9 @@ export class InitCommand {
301
302
  const skillDir = path.join(skillsDir, dirName);
302
303
  const skillFile = path.join(skillDir, 'SKILL.md');
303
304
  // Generate SKILL.md content with YAML frontmatter including generatedBy
304
- const skillContent = generateSkillContent(template, OPENSPEC_VERSION);
305
+ // Use hyphen-based command references for OpenCode
306
+ const transformer = tool.value === 'opencode' ? transformToHyphenCommands : undefined;
307
+ const skillContent = generateSkillContent(template, OPENSPEC_VERSION, transformer);
305
308
  // Write the skill file
306
309
  await FileSystemUtils.writeFile(skillFile, skillContent);
307
310
  }
@@ -36,6 +36,7 @@ export declare function getCommandContents(): CommandContent[];
36
36
  *
37
37
  * @param template - The skill template
38
38
  * @param generatedByVersion - The OpenSpec version to embed in the file
39
+ * @param transformInstructions - Optional callback to transform the instructions content
39
40
  */
40
- export declare function generateSkillContent(template: SkillTemplate, generatedByVersion: string): string;
41
+ export declare function generateSkillContent(template: SkillTemplate, generatedByVersion: string, transformInstructions?: (instructions: string) => string): string;
41
42
  //# sourceMappingURL=skill-generation.d.ts.map
@@ -57,8 +57,12 @@ export function getCommandContents() {
57
57
  *
58
58
  * @param template - The skill template
59
59
  * @param generatedByVersion - The OpenSpec version to embed in the file
60
+ * @param transformInstructions - Optional callback to transform the instructions content
60
61
  */
61
- export function generateSkillContent(template, generatedByVersion) {
62
+ export function generateSkillContent(template, generatedByVersion, transformInstructions) {
63
+ const instructions = transformInstructions
64
+ ? transformInstructions(template.instructions)
65
+ : template.instructions;
62
66
  return `---
63
67
  name: ${template.name}
64
68
  description: ${template.description}
@@ -70,7 +74,7 @@ metadata:
70
74
  generatedBy: "${generatedByVersion}"
71
75
  ---
72
76
 
73
- ${template.instructions}
77
+ ${instructions}
74
78
  `;
75
79
  }
76
80
  //# sourceMappingURL=skill-generation.js.map
@@ -9,6 +9,7 @@ import chalk from 'chalk';
9
9
  import ora from 'ora';
10
10
  import { createRequire } from 'module';
11
11
  import { FileSystemUtils } from '../utils/file-system.js';
12
+ import { transformToHyphenCommands } from '../utils/command-references.js';
12
13
  import { AI_TOOLS, OPENSPEC_DIR_NAME } from './config.js';
13
14
  import { generateCommands, CommandAdapterRegistry, } from './command-generation/index.js';
14
15
  import { getConfiguredTools, getAllToolVersionStatus, getSkillTemplates, getCommandContents, generateSkillContent, getToolsWithSkillsDir, } from './shared/index.js';
@@ -73,7 +74,9 @@ export class UpdateCommand {
73
74
  for (const { template, dirName } of skillTemplates) {
74
75
  const skillDir = path.join(skillsDir, dirName);
75
76
  const skillFile = path.join(skillDir, 'SKILL.md');
76
- const skillContent = generateSkillContent(template, OPENSPEC_VERSION);
77
+ // Use hyphen-based command references for OpenCode
78
+ const transformer = tool.value === 'opencode' ? transformToHyphenCommands : undefined;
79
+ const skillContent = generateSkillContent(template, OPENSPEC_VERSION, transformer);
77
80
  await FileSystemUtils.writeFile(skillFile, skillContent);
78
81
  }
79
82
  // Update commands
@@ -277,7 +280,9 @@ export class UpdateCommand {
277
280
  for (const { template, dirName } of skillTemplates) {
278
281
  const skillDir = path.join(skillsDir, dirName);
279
282
  const skillFile = path.join(skillDir, 'SKILL.md');
280
- const skillContent = generateSkillContent(template, OPENSPEC_VERSION);
283
+ // Use hyphen-based command references for OpenCode
284
+ const transformer = tool.value === 'opencode' ? transformToHyphenCommands : undefined;
285
+ const skillContent = generateSkillContent(template, OPENSPEC_VERSION, transformer);
281
286
  await FileSystemUtils.writeFile(skillFile, skillContent);
282
287
  }
283
288
  // Create commands
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Command Reference Utilities
3
+ *
4
+ * Utilities for transforming command references to tool-specific formats.
5
+ */
6
+ /**
7
+ * Transforms colon-based command references to hyphen-based format.
8
+ * Converts `/opsx:` patterns to `/opsx-` for tools that use hyphen syntax.
9
+ *
10
+ * @param text - The text containing command references
11
+ * @returns Text with command references transformed to hyphen format
12
+ *
13
+ * @example
14
+ * transformToHyphenCommands('/opsx:new') // returns '/opsx-new'
15
+ * transformToHyphenCommands('Use /opsx:apply to implement') // returns 'Use /opsx-apply to implement'
16
+ */
17
+ export declare function transformToHyphenCommands(text: string): string;
18
+ //# sourceMappingURL=command-references.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Command Reference Utilities
3
+ *
4
+ * Utilities for transforming command references to tool-specific formats.
5
+ */
6
+ /**
7
+ * Transforms colon-based command references to hyphen-based format.
8
+ * Converts `/opsx:` patterns to `/opsx-` for tools that use hyphen syntax.
9
+ *
10
+ * @param text - The text containing command references
11
+ * @returns Text with command references transformed to hyphen format
12
+ *
13
+ * @example
14
+ * transformToHyphenCommands('/opsx:new') // returns '/opsx-new'
15
+ * transformToHyphenCommands('Use /opsx:apply to implement') // returns 'Use /opsx-apply to implement'
16
+ */
17
+ export function transformToHyphenCommands(text) {
18
+ return text.replace(/\/opsx:/g, '/opsx-');
19
+ }
20
+ //# sourceMappingURL=command-references.js.map
@@ -2,4 +2,5 @@ export { validateChangeName, createChange } from './change-utils.js';
2
2
  export type { ValidationResult, CreateChangeOptions } from './change-utils.js';
3
3
  export { readChangeMetadata, writeChangeMetadata, resolveSchemaForChange, validateSchemaName, ChangeMetadataError, } from './change-metadata.js';
4
4
  export { FileSystemUtils, removeMarkerBlock } from './file-system.js';
5
+ export { transformToHyphenCommands } from './command-references.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,6 @@ export { validateChangeName, createChange } from './change-utils.js';
4
4
  export { readChangeMetadata, writeChangeMetadata, resolveSchemaForChange, validateSchemaName, ChangeMetadataError, } from './change-metadata.js';
5
5
  // File system utilities
6
6
  export { FileSystemUtils, removeMarkerBlock } from './file-system.js';
7
+ // Command reference utilities
8
+ export { transformToHyphenCommands } from './command-references.js';
7
9
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fission-ai/openspec",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "AI-native system for spec-driven development",
5
5
  "keywords": [
6
6
  "openspec",