@fission-ai/openspec 1.4.1 → 1.6.0-beta.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 (241) hide show
  1. package/README.md +37 -4
  2. package/dist/cli/index.d.ts +5 -0
  3. package/dist/cli/index.js +95 -95
  4. package/dist/commands/change.d.ts +5 -2
  5. package/dist/commands/change.js +23 -55
  6. package/dist/commands/config.js +6 -65
  7. package/dist/commands/context.d.ts +3 -0
  8. package/dist/commands/context.js +155 -0
  9. package/dist/commands/doctor.d.ts +8 -0
  10. package/dist/commands/doctor.js +163 -0
  11. package/dist/commands/shared-gather.d.ts +14 -0
  12. package/dist/commands/shared-gather.js +31 -0
  13. package/dist/commands/shared-output.d.ts +18 -0
  14. package/dist/commands/shared-output.js +61 -0
  15. package/dist/commands/show.d.ts +11 -6
  16. package/dist/commands/show.js +70 -25
  17. package/dist/commands/spec.d.ts +5 -1
  18. package/dist/commands/spec.js +15 -4
  19. package/dist/commands/store.d.ts +3 -0
  20. package/dist/commands/store.js +547 -0
  21. package/dist/commands/validate.d.ts +10 -0
  22. package/dist/commands/validate.js +88 -40
  23. package/dist/commands/workflow/index.d.ts +0 -2
  24. package/dist/commands/workflow/index.js +0 -1
  25. package/dist/commands/workflow/instructions.d.ts +11 -1
  26. package/dist/commands/workflow/instructions.js +71 -22
  27. package/dist/commands/workflow/new-change.d.ts +6 -3
  28. package/dist/commands/workflow/new-change.js +42 -77
  29. package/dist/commands/workflow/shared.d.ts +15 -3
  30. package/dist/commands/workflow/shared.js +20 -3
  31. package/dist/commands/workflow/status.d.ts +2 -0
  32. package/dist/commands/workflow/status.js +19 -17
  33. package/dist/commands/workset-input.d.ts +19 -0
  34. package/dist/commands/workset-input.js +112 -0
  35. package/dist/commands/workset-prompts.d.ts +12 -0
  36. package/dist/commands/workset-prompts.js +143 -0
  37. package/dist/commands/workset.d.ts +25 -0
  38. package/dist/commands/workset.js +446 -0
  39. package/dist/core/archive.d.ts +17 -6
  40. package/dist/core/archive.js +220 -68
  41. package/dist/core/artifact-graph/index.d.ts +1 -1
  42. package/dist/core/artifact-graph/instruction-loader.d.ts +18 -13
  43. package/dist/core/artifact-graph/instruction-loader.js +8 -31
  44. package/dist/core/change-metadata/schema.d.ts +1 -0
  45. package/dist/core/change-metadata/schema.js +4 -2
  46. package/dist/core/change-status-policy.d.ts +5 -18
  47. package/dist/core/change-status-policy.js +2 -37
  48. package/dist/core/command-generation/adapters/bob.js +1 -14
  49. package/dist/core/command-generation/adapters/claude.d.ts +1 -1
  50. package/dist/core/command-generation/adapters/claude.js +4 -15
  51. package/dist/core/command-generation/adapters/cursor.js +1 -14
  52. package/dist/core/command-generation/adapters/index.d.ts +2 -0
  53. package/dist/core/command-generation/adapters/index.js +2 -0
  54. package/dist/core/command-generation/adapters/oh-my-pi.d.ts +21 -0
  55. package/dist/core/command-generation/adapters/oh-my-pi.js +44 -0
  56. package/dist/core/command-generation/adapters/pi.js +1 -14
  57. package/dist/core/command-generation/adapters/trae.d.ts +13 -0
  58. package/dist/core/command-generation/adapters/trae.js +48 -0
  59. package/dist/core/command-generation/adapters/windsurf.js +1 -14
  60. package/dist/core/command-generation/registry.js +4 -0
  61. package/dist/core/command-generation/yaml.d.ts +22 -0
  62. package/dist/core/command-generation/yaml.js +38 -0
  63. package/dist/core/completions/command-registry.js +87 -289
  64. package/dist/core/completions/generators/zsh-generator.js +3 -1
  65. package/dist/core/completions/installers/bash-installer.js +3 -0
  66. package/dist/core/completions/installers/fish-installer.js +8 -0
  67. package/dist/core/completions/installers/powershell-installer.js +30 -2
  68. package/dist/core/completions/installers/zsh-installer.js +3 -0
  69. package/dist/core/completions/shared-flags.d.ts +1 -0
  70. package/dist/core/completions/shared-flags.js +5 -0
  71. package/dist/core/config-schema.d.ts +2 -1
  72. package/dist/core/config-schema.js +26 -0
  73. package/dist/core/config.js +1 -0
  74. package/dist/core/file-state.d.ts +36 -0
  75. package/dist/core/file-state.js +112 -0
  76. package/dist/core/global-config.d.ts +2 -0
  77. package/dist/core/id.d.ts +17 -0
  78. package/dist/core/id.js +30 -0
  79. package/dist/core/index.d.ts +3 -3
  80. package/dist/core/index.js +3 -3
  81. package/dist/core/init.js +27 -6
  82. package/dist/core/list.d.ts +2 -0
  83. package/dist/core/list.js +37 -14
  84. package/dist/core/openers.d.ts +77 -0
  85. package/dist/core/openers.js +251 -0
  86. package/dist/core/openspec-root.d.ts +45 -0
  87. package/dist/core/openspec-root.js +195 -0
  88. package/dist/core/parsers/change-parser.js +2 -1
  89. package/dist/core/parsers/markdown-parser.d.ts +0 -3
  90. package/dist/core/parsers/markdown-parser.js +5 -59
  91. package/dist/core/parsers/requirement-blocks.d.ts +11 -0
  92. package/dist/core/parsers/requirement-blocks.js +42 -8
  93. package/dist/core/parsers/requirement-text.d.ts +55 -0
  94. package/dist/core/parsers/requirement-text.js +136 -0
  95. package/dist/core/planning-home.d.ts +1 -6
  96. package/dist/core/planning-home.js +2 -43
  97. package/dist/core/profile-sync-drift.js +1 -0
  98. package/dist/core/profiles.d.ts +2 -2
  99. package/dist/core/profiles.js +2 -1
  100. package/dist/core/project-config.d.ts +44 -1
  101. package/dist/core/project-config.js +160 -10
  102. package/dist/core/references.d.ts +63 -0
  103. package/dist/core/references.js +310 -0
  104. package/dist/core/relationship-health.d.ts +65 -0
  105. package/dist/core/relationship-health.js +64 -0
  106. package/dist/core/root-selection.d.ts +122 -0
  107. package/dist/core/root-selection.js +337 -0
  108. package/dist/core/schemas/base.schema.js +7 -2
  109. package/dist/core/shared/allowed-tools.d.ts +12 -0
  110. package/dist/core/shared/allowed-tools.js +12 -0
  111. package/dist/core/shared/skill-generation.js +5 -1
  112. package/dist/core/shared/tool-detection.d.ts +2 -2
  113. package/dist/core/shared/tool-detection.js +2 -0
  114. package/dist/core/specs-apply.d.ts +6 -1
  115. package/dist/core/specs-apply.js +41 -5
  116. package/dist/core/store/errors.d.ts +20 -0
  117. package/dist/core/{context-store → store}/errors.js +3 -3
  118. package/dist/core/store/foundation.d.ts +56 -0
  119. package/dist/core/store/foundation.js +251 -0
  120. package/dist/core/store/git.d.ts +23 -0
  121. package/dist/core/store/git.js +137 -0
  122. package/dist/core/{context-store → store}/index.d.ts +0 -1
  123. package/dist/core/{context-store → store}/index.js +0 -1
  124. package/dist/core/store/operations.d.ts +114 -0
  125. package/dist/core/store/operations.js +803 -0
  126. package/dist/core/store/registry.d.ts +58 -0
  127. package/dist/core/store/registry.js +275 -0
  128. package/dist/core/templates/skill-templates.d.ts +1 -0
  129. package/dist/core/templates/skill-templates.js +1 -0
  130. package/dist/core/templates/workflows/apply-change.js +5 -4
  131. package/dist/core/templates/workflows/archive-change.js +5 -4
  132. package/dist/core/templates/workflows/bulk-archive-change.js +5 -4
  133. package/dist/core/templates/workflows/continue-change.js +7 -2
  134. package/dist/core/templates/workflows/explore.js +5 -0
  135. package/dist/core/templates/workflows/ff-change.js +5 -0
  136. package/dist/core/templates/workflows/new-change.js +5 -0
  137. package/dist/core/templates/workflows/onboard.js +4 -1
  138. package/dist/core/templates/workflows/propose.js +5 -0
  139. package/dist/core/templates/workflows/store-selection.d.ts +8 -0
  140. package/dist/core/templates/workflows/store-selection.js +8 -0
  141. package/dist/core/templates/workflows/sync-specs.js +5 -4
  142. package/dist/core/templates/workflows/update-change.d.ts +10 -0
  143. package/dist/core/templates/workflows/update-change.js +167 -0
  144. package/dist/core/templates/workflows/verify-change.js +5 -4
  145. package/dist/core/update.js +4 -4
  146. package/dist/core/validation/validator.d.ts +7 -0
  147. package/dist/core/validation/validator.js +101 -38
  148. package/dist/core/view.js +1 -1
  149. package/dist/core/working-set.d.ts +47 -0
  150. package/dist/core/working-set.js +43 -0
  151. package/dist/core/worksets.d.ts +75 -0
  152. package/dist/core/worksets.js +245 -0
  153. package/dist/core/zod-issues.d.ts +4 -0
  154. package/dist/core/zod-issues.js +10 -0
  155. package/dist/utils/change-metadata.d.ts +1 -0
  156. package/dist/utils/change-metadata.js +1 -1
  157. package/dist/utils/change-utils.js +15 -0
  158. package/dist/utils/file-system.js +36 -17
  159. package/dist/utils/task-progress.d.ts +10 -1
  160. package/dist/utils/task-progress.js +66 -2
  161. package/package.json +26 -23
  162. package/dist/commands/context-store.d.ts +0 -3
  163. package/dist/commands/context-store.js +0 -475
  164. package/dist/commands/initiative.d.ts +0 -13
  165. package/dist/commands/initiative.js +0 -318
  166. package/dist/commands/workflow/initiative-link.d.ts +0 -24
  167. package/dist/commands/workflow/initiative-link.js +0 -47
  168. package/dist/commands/workflow/set-change.d.ts +0 -13
  169. package/dist/commands/workflow/set-change.js +0 -87
  170. package/dist/commands/workspace/context-status.d.ts +0 -4
  171. package/dist/commands/workspace/context-status.js +0 -59
  172. package/dist/commands/workspace/open-target-selection.d.ts +0 -13
  173. package/dist/commands/workspace/open-target-selection.js +0 -146
  174. package/dist/commands/workspace/open-view.d.ts +0 -62
  175. package/dist/commands/workspace/open-view.js +0 -249
  176. package/dist/commands/workspace/open.d.ts +0 -37
  177. package/dist/commands/workspace/open.js +0 -110
  178. package/dist/commands/workspace/opener-selection.d.ts +0 -11
  179. package/dist/commands/workspace/opener-selection.js +0 -98
  180. package/dist/commands/workspace/operations.d.ts +0 -29
  181. package/dist/commands/workspace/operations.js +0 -543
  182. package/dist/commands/workspace/prompt-theme.d.ts +0 -29
  183. package/dist/commands/workspace/prompt-theme.js +0 -24
  184. package/dist/commands/workspace/registration.d.ts +0 -13
  185. package/dist/commands/workspace/registration.js +0 -84
  186. package/dist/commands/workspace/selection.d.ts +0 -8
  187. package/dist/commands/workspace/selection.js +0 -104
  188. package/dist/commands/workspace/setup-prompts.d.ts +0 -13
  189. package/dist/commands/workspace/setup-prompts.js +0 -121
  190. package/dist/commands/workspace/types.d.ts +0 -103
  191. package/dist/commands/workspace/types.js +0 -36
  192. package/dist/commands/workspace.d.ts +0 -5
  193. package/dist/commands/workspace.js +0 -574
  194. package/dist/core/collections/index.d.ts +0 -3
  195. package/dist/core/collections/index.js +0 -3
  196. package/dist/core/collections/initiatives/collection.d.ts +0 -4
  197. package/dist/core/collections/initiatives/collection.js +0 -17
  198. package/dist/core/collections/initiatives/index.d.ts +0 -6
  199. package/dist/core/collections/initiatives/index.js +0 -6
  200. package/dist/core/collections/initiatives/operations.d.ts +0 -49
  201. package/dist/core/collections/initiatives/operations.js +0 -175
  202. package/dist/core/collections/initiatives/resolution.d.ts +0 -87
  203. package/dist/core/collections/initiatives/resolution.js +0 -374
  204. package/dist/core/collections/initiatives/schema.d.ts +0 -41
  205. package/dist/core/collections/initiatives/schema.js +0 -134
  206. package/dist/core/collections/initiatives/templates.d.ts +0 -12
  207. package/dist/core/collections/initiatives/templates.js +0 -90
  208. package/dist/core/collections/runtime.d.ts +0 -46
  209. package/dist/core/collections/runtime.js +0 -194
  210. package/dist/core/context-store/binding.d.ts +0 -53
  211. package/dist/core/context-store/binding.js +0 -197
  212. package/dist/core/context-store/errors.d.ts +0 -20
  213. package/dist/core/context-store/foundation.d.ts +0 -55
  214. package/dist/core/context-store/foundation.js +0 -321
  215. package/dist/core/context-store/operations.d.ts +0 -85
  216. package/dist/core/context-store/operations.js +0 -528
  217. package/dist/core/context-store/registry.d.ts +0 -45
  218. package/dist/core/context-store/registry.js +0 -229
  219. package/dist/core/workspace/foundation.d.ts +0 -67
  220. package/dist/core/workspace/foundation.js +0 -295
  221. package/dist/core/workspace/index.d.ts +0 -8
  222. package/dist/core/workspace/index.js +0 -8
  223. package/dist/core/workspace/legacy-state.d.ts +0 -28
  224. package/dist/core/workspace/legacy-state.js +0 -200
  225. package/dist/core/workspace/link-input.d.ts +0 -9
  226. package/dist/core/workspace/link-input.js +0 -32
  227. package/dist/core/workspace/open-surface.d.ts +0 -45
  228. package/dist/core/workspace/open-surface.js +0 -215
  229. package/dist/core/workspace/openers.d.ts +0 -21
  230. package/dist/core/workspace/openers.js +0 -124
  231. package/dist/core/workspace/registry.d.ts +0 -24
  232. package/dist/core/workspace/registry.js +0 -146
  233. package/dist/core/workspace/skills.d.ts +0 -57
  234. package/dist/core/workspace/skills.js +0 -334
  235. package/dist/core/workspace/state-io.d.ts +0 -10
  236. package/dist/core/workspace/state-io.js +0 -121
  237. package/schemas/workspace-planning/schema.yaml +0 -72
  238. package/schemas/workspace-planning/templates/design.md +0 -33
  239. package/schemas/workspace-planning/templates/proposal.md +0 -28
  240. package/schemas/workspace-planning/templates/spec.md +0 -9
  241. package/schemas/workspace-planning/templates/tasks.md +0 -15
@@ -1,20 +1,13 @@
1
- import type { ChangeMetadata } from './change-metadata/index.js';
2
1
  import type { PlanningHome } from './planning-home.js';
3
2
  export interface PlanningHomeSummary {
4
- kind: 'repo' | 'workspace';
3
+ kind: 'repo';
5
4
  root: string;
6
5
  changesDir: string;
7
6
  defaultSchema: string;
8
- workspaceName?: string;
9
- }
10
- export interface AffectedAreasSummary {
11
- known: string[];
12
- unresolved: boolean;
13
- invalid: string[];
14
7
  }
15
8
  export interface ActionContext {
16
- mode: 'repo-local' | 'workspace-planning';
17
- sourceOfTruth: 'repo' | 'workspace-local';
9
+ mode: 'repo-local';
10
+ sourceOfTruth: 'repo';
18
11
  planningArtifacts: string[];
19
12
  linkedContext: Array<{
20
13
  name: string;
@@ -27,24 +20,18 @@ export interface ChangeStatusPolicyArtifact {
27
20
  id: string;
28
21
  status: 'done' | 'ready' | 'blocked';
29
22
  }
30
- export interface AffectedAreasInput {
31
- planningHome?: PlanningHome;
32
- metadata?: ChangeMetadata;
33
- }
34
23
  export interface ChangeNextStepsInput {
35
24
  changeName: string;
36
- planningHome?: PlanningHome;
37
25
  artifactStatuses: ChangeStatusPolicyArtifact[];
38
- affectedAreas?: AffectedAreasSummary;
39
26
  allArtifactsComplete: boolean;
27
+ /** Selected store id; next-step commands must carry it. */
28
+ storeId?: string;
40
29
  }
41
30
  export interface ActionContextInput {
42
- planningHome?: PlanningHome;
43
31
  projectRoot: string;
44
32
  artifactIds: string[];
45
33
  }
46
34
  export declare function summarizePlanningHome(planningHome: PlanningHome | undefined): PlanningHomeSummary | undefined;
47
- export declare function summarizeAffectedAreas(input: AffectedAreasInput): AffectedAreasSummary | undefined;
48
35
  export declare function buildActionContext(input: ActionContextInput): ActionContext;
49
36
  export declare function buildNextSteps(input: ChangeNextStepsInput): string[];
50
37
  //# sourceMappingURL=change-status-policy.d.ts.map
@@ -7,39 +7,9 @@ export function summarizePlanningHome(planningHome) {
7
7
  root: planningHome.root,
8
8
  changesDir: planningHome.changesDir,
9
9
  defaultSchema: planningHome.defaultSchema,
10
- ...(planningHome.workspace ? { workspaceName: planningHome.workspace.name } : {}),
11
- };
12
- }
13
- export function summarizeAffectedAreas(input) {
14
- if (input.planningHome?.kind !== 'workspace') {
15
- return undefined;
16
- }
17
- const known = Array.from(new Set(input.metadata?.affected_areas ?? [])).sort((a, b) => a.localeCompare(b));
18
- const validAreas = new Set(input.planningHome.workspace?.links ?? []);
19
- const invalid = known.filter((areaName) => validAreas.size > 0 && !validAreas.has(areaName));
20
- return {
21
- known,
22
- unresolved: known.length === 0,
23
- invalid,
24
10
  };
25
11
  }
26
12
  export function buildActionContext(input) {
27
- if (input.planningHome?.kind === 'workspace') {
28
- return {
29
- mode: 'workspace-planning',
30
- sourceOfTruth: 'workspace-local',
31
- planningArtifacts: input.artifactIds,
32
- linkedContext: (input.planningHome.workspace?.links ?? []).map((name) => ({ name })),
33
- allowedEditRoots: [],
34
- requiresAffectedAreaSelection: true,
35
- constraints: [
36
- 'Treat workspace-local planning artifacts as compatibility context for this local view.',
37
- 'Use initiatives for durable coordination when initiative context exists.',
38
- 'Treat linked repos and folders as context until an explicit edit root is selected.',
39
- 'Do not make implementation edits without an explicit allowed edit root.',
40
- ],
41
- };
42
- }
43
13
  return {
44
14
  mode: 'repo-local',
45
15
  sourceOfTruth: 'repo',
@@ -54,17 +24,12 @@ export function buildNextSteps(input) {
54
24
  const readyArtifact = input.artifactStatuses.find((artifact) => artifact.status === 'ready');
55
25
  const steps = [];
56
26
  if (readyArtifact) {
57
- steps.push(`Run openspec instructions ${readyArtifact.id} --change "${input.changeName}" --json before writing that artifact.`);
27
+ const storeFlag = input.storeId ? ` --store ${input.storeId}` : '';
28
+ steps.push(`Run openspec instructions ${readyArtifact.id} --change "${input.changeName}"${storeFlag} --json before writing that artifact.`);
58
29
  }
59
30
  else if (input.allArtifactsComplete) {
60
31
  steps.push('All planning artifacts are complete; review tasks before implementation.');
61
32
  }
62
- if (input.planningHome?.kind === 'workspace') {
63
- if (input.affectedAreas?.unresolved) {
64
- steps.push('Identify affected areas in change metadata or coordination tasks as planning continues.');
65
- }
66
- steps.push('Select an affected area and allowed edit root before implementation edits.');
67
- }
68
33
  return steps;
69
34
  }
70
35
  //# sourceMappingURL=change-status-policy.js.map
@@ -6,20 +6,7 @@
6
6
  */
7
7
  import path from 'path';
8
8
  import { transformToHyphenCommands } from '../../../utils/command-references.js';
9
- /**
10
- * Escapes a string value for safe YAML output.
11
- * Quotes the string if it contains special YAML characters.
12
- */
13
- function escapeYamlValue(value) {
14
- // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
15
- const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
16
- if (needsQuoting) {
17
- // Use double quotes and escape internal double quotes and backslashes
18
- const escaped = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
19
- return `"${escaped}"`;
20
- }
21
- return value;
22
- }
9
+ import { escapeYamlValue } from '../yaml.js';
23
10
  /**
24
11
  * Bob Shell adapter for command generation.
25
12
  * File path: .bob/commands/opsx-<id>.md
@@ -7,7 +7,7 @@ import type { ToolCommandAdapter } from '../types.js';
7
7
  /**
8
8
  * Claude Code adapter for command generation.
9
9
  * File path: .claude/commands/opsx/<id>.md
10
- * Frontmatter: name, description, category, tags
10
+ * Frontmatter: name, description, allowed-tools, category, tags
11
11
  */
12
12
  export declare const claudeAdapter: ToolCommandAdapter;
13
13
  //# sourceMappingURL=claude.d.ts.map
@@ -4,20 +4,8 @@
4
4
  * Formats commands for Claude Code following its frontmatter specification.
5
5
  */
6
6
  import path from 'path';
7
- /**
8
- * Escapes a string value for safe YAML output.
9
- * Quotes the string if it contains special YAML characters.
10
- */
11
- function escapeYamlValue(value) {
12
- // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
13
- const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
14
- if (needsQuoting) {
15
- // Use double quotes and escape internal double quotes and backslashes
16
- const escaped = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
17
- return `"${escaped}"`;
18
- }
19
- return value;
20
- }
7
+ import { escapeYamlValue } from '../yaml.js';
8
+ import { OPENSPEC_CLI_ALLOWED_TOOLS } from '../../shared/allowed-tools.js';
21
9
  /**
22
10
  * Formats a tags array as a YAML array with proper escaping.
23
11
  */
@@ -28,7 +16,7 @@ function formatTagsArray(tags) {
28
16
  /**
29
17
  * Claude Code adapter for command generation.
30
18
  * File path: .claude/commands/opsx/<id>.md
31
- * Frontmatter: name, description, category, tags
19
+ * Frontmatter: name, description, allowed-tools, category, tags
32
20
  */
33
21
  export const claudeAdapter = {
34
22
  toolId: 'claude',
@@ -39,6 +27,7 @@ export const claudeAdapter = {
39
27
  return `---
40
28
  name: ${escapeYamlValue(content.name)}
41
29
  description: ${escapeYamlValue(content.description)}
30
+ allowed-tools: ${OPENSPEC_CLI_ALLOWED_TOOLS}
42
31
  category: ${escapeYamlValue(content.category)}
43
32
  tags: ${formatTagsArray(content.tags)}
44
33
  ---
@@ -5,20 +5,7 @@
5
5
  * Cursor uses a different frontmatter format and file naming convention.
6
6
  */
7
7
  import path from 'path';
8
- /**
9
- * Escapes a string value for safe YAML output.
10
- * Quotes the string if it contains special YAML characters.
11
- */
12
- function escapeYamlValue(value) {
13
- // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
14
- const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
15
- if (needsQuoting) {
16
- // Use double quotes and escape internal double quotes and backslashes
17
- const escaped = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
18
- return `"${escaped}"`;
19
- }
20
- return value;
21
- }
8
+ import { escapeYamlValue } from '../yaml.js';
22
9
  /**
23
10
  * Cursor adapter for command generation.
24
11
  * File path: .cursor/commands/opsx-<id>.md
@@ -22,11 +22,13 @@ export { iflowAdapter } from './iflow.js';
22
22
  export { junieAdapter } from './junie.js';
23
23
  export { kilocodeAdapter } from './kilocode.js';
24
24
  export { kiroAdapter } from './kiro.js';
25
+ export { ohMyPiAdapter } from './oh-my-pi.js';
25
26
  export { opencodeAdapter } from './opencode.js';
26
27
  export { piAdapter } from './pi.js';
27
28
  export { qoderAdapter } from './qoder.js';
28
29
  export { lingmaAdapter } from './lingma.js';
29
30
  export { qwenAdapter } from './qwen.js';
30
31
  export { roocodeAdapter } from './roocode.js';
32
+ export { traeAdapter } from './trae.js';
31
33
  export { windsurfAdapter } from './windsurf.js';
32
34
  //# sourceMappingURL=index.d.ts.map
@@ -22,11 +22,13 @@ export { iflowAdapter } from './iflow.js';
22
22
  export { junieAdapter } from './junie.js';
23
23
  export { kilocodeAdapter } from './kilocode.js';
24
24
  export { kiroAdapter } from './kiro.js';
25
+ export { ohMyPiAdapter } from './oh-my-pi.js';
25
26
  export { opencodeAdapter } from './opencode.js';
26
27
  export { piAdapter } from './pi.js';
27
28
  export { qoderAdapter } from './qoder.js';
28
29
  export { lingmaAdapter } from './lingma.js';
29
30
  export { qwenAdapter } from './qwen.js';
30
31
  export { roocodeAdapter } from './roocode.js';
32
+ export { traeAdapter } from './trae.js';
31
33
  export { windsurfAdapter } from './windsurf.js';
32
34
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Oh My Pi (OMP) Command Adapter
3
+ *
4
+ * Formats commands for Oh My Pi following its slash command specification.
5
+ * OMP loads slash commands from .omp/commands/*.md with YAML frontmatter.
6
+ * The filename (minus .md) becomes the slash command name.
7
+ */
8
+ import type { ToolCommandAdapter } from '../types.js';
9
+ /**
10
+ * Oh My Pi adapter for command generation.
11
+ * File path: .omp/commands/opsx-<id>.md
12
+ * Frontmatter: description
13
+ *
14
+ * OMP uses the filename (minus .md) as the slash command name, so
15
+ * opsx-propose.md → /opsx-propose. Command references in the body
16
+ * are transformed from /opsx: to /opsx- for consistency, and
17
+ * $@ is injected after **Input**: headings so user-supplied arguments
18
+ * (e.g. /opsx-propose my-feature) are visible to the agent.
19
+ */
20
+ export declare const ohMyPiAdapter: ToolCommandAdapter;
21
+ //# sourceMappingURL=oh-my-pi.d.ts.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Oh My Pi (OMP) Command Adapter
3
+ *
4
+ * Formats commands for Oh My Pi following its slash command specification.
5
+ * OMP loads slash commands from .omp/commands/*.md with YAML frontmatter.
6
+ * The filename (minus .md) becomes the slash command name.
7
+ */
8
+ import path from 'path';
9
+ import { transformToHyphenCommands } from '../../../utils/command-references.js';
10
+ import { escapeYamlValue } from '../yaml.js';
11
+ const OMP_INPUT_HEADING = /^\*\*Input\*\*:[^\n]*$/m;
12
+ function injectOmpArgs(body) {
13
+ if (body.includes('$@') || body.includes('$ARGUMENTS')) {
14
+ return body;
15
+ }
16
+ return body.replace(OMP_INPUT_HEADING, (heading) => `${heading}\n**Provided arguments**: $@`);
17
+ }
18
+ /**
19
+ * Oh My Pi adapter for command generation.
20
+ * File path: .omp/commands/opsx-<id>.md
21
+ * Frontmatter: description
22
+ *
23
+ * OMP uses the filename (minus .md) as the slash command name, so
24
+ * opsx-propose.md → /opsx-propose. Command references in the body
25
+ * are transformed from /opsx: to /opsx- for consistency, and
26
+ * $@ is injected after **Input**: headings so user-supplied arguments
27
+ * (e.g. /opsx-propose my-feature) are visible to the agent.
28
+ */
29
+ export const ohMyPiAdapter = {
30
+ toolId: 'oh-my-pi',
31
+ getFilePath(commandId) {
32
+ return path.join('.omp', 'commands', `opsx-${commandId}.md`);
33
+ },
34
+ formatFile(content) {
35
+ const transformedBody = transformToHyphenCommands(content.body);
36
+ return `---
37
+ description: ${escapeYamlValue(content.description)}
38
+ ---
39
+
40
+ ${injectOmpArgs(transformedBody)}
41
+ `;
42
+ },
43
+ };
44
+ //# sourceMappingURL=oh-my-pi.js.map
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import path from 'path';
8
8
  import { transformToHyphenCommands } from '../../../utils/command-references.js';
9
+ import { escapeYamlValue } from '../yaml.js';
9
10
  const PI_INPUT_HEADING = /^\*\*Input\*\*:[^\n]*$/m;
10
11
  function injectPiArgs(body) {
11
12
  if (body.includes('$@') || body.includes('$ARGUMENTS')) {
@@ -13,20 +14,6 @@ function injectPiArgs(body) {
13
14
  }
14
15
  return body.replace(PI_INPUT_HEADING, (heading) => `${heading}\n**Provided arguments**: $@`);
15
16
  }
16
- /**
17
- * Escapes a string value for safe YAML output.
18
- * Quotes the string if it contains special YAML characters.
19
- */
20
- function escapeYamlValue(value) {
21
- // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
22
- const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
23
- if (needsQuoting) {
24
- // Use double quotes and escape internal double quotes and backslashes
25
- const escaped = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
26
- return `"${escaped}"`;
27
- }
28
- return value;
29
- }
30
17
  /**
31
18
  * Pi adapter for prompt template generation.
32
19
  * File path: .pi/prompts/opsx-<id>.md
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Trae Command Adapter
3
+ *
4
+ * Formats commands for Trae IDE following its command specification.
5
+ */
6
+ import type { ToolCommandAdapter } from '../types.js';
7
+ /**
8
+ * Trae adapter for command generation.
9
+ * File path: .trae/commands/opsx-<id>.md
10
+ * Frontmatter: name, description
11
+ */
12
+ export declare const traeAdapter: ToolCommandAdapter;
13
+ //# sourceMappingURL=trae.d.ts.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Trae Command Adapter
3
+ *
4
+ * Formats commands for Trae IDE following its command specification.
5
+ */
6
+ import path from 'path';
7
+ /**
8
+ * Escapes a string value for safe YAML output.
9
+ * Quotes the string if it contains special YAML characters.
10
+ */
11
+ function escapeYamlValue(value) {
12
+ if (value === '') {
13
+ return '""';
14
+ }
15
+ // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
16
+ const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
17
+ if (needsQuoting) {
18
+ // Use double quotes and escape internal double quotes, backslashes, and newlines
19
+ const escaped = value
20
+ .replace(/\\/g, '\\\\')
21
+ .replace(/"/g, '\\"')
22
+ .replace(/\n/g, '\\n')
23
+ .replace(/\r/g, '\\r');
24
+ return `"${escaped}"`;
25
+ }
26
+ return value;
27
+ }
28
+ /**
29
+ * Trae adapter for command generation.
30
+ * File path: .trae/commands/opsx-<id>.md
31
+ * Frontmatter: name, description
32
+ */
33
+ export const traeAdapter = {
34
+ toolId: 'trae',
35
+ getFilePath(commandId) {
36
+ return path.join('.trae', 'commands', `opsx-${commandId}.md`);
37
+ },
38
+ formatFile(content) {
39
+ return `---
40
+ name: ${escapeYamlValue(content.name)}
41
+ description: ${escapeYamlValue(content.description)}
42
+ ---
43
+
44
+ ${content.body}
45
+ `;
46
+ },
47
+ };
48
+ //# sourceMappingURL=trae.js.map
@@ -5,20 +5,7 @@
5
5
  * Windsurf uses a similar format to Claude but may have different conventions.
6
6
  */
7
7
  import path from 'path';
8
- /**
9
- * Escapes a string value for safe YAML output.
10
- * Quotes the string if it contains special YAML characters.
11
- */
12
- function escapeYamlValue(value) {
13
- // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
14
- const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
15
- if (needsQuoting) {
16
- // Use double quotes and escape internal double quotes and backslashes
17
- const escaped = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
18
- return `"${escaped}"`;
19
- }
20
- return value;
21
- }
8
+ import { escapeYamlValue } from '../yaml.js';
22
9
  /**
23
10
  * Formats a tags array as a YAML array with proper escaping.
24
11
  */
@@ -23,12 +23,14 @@ import { iflowAdapter } from './adapters/iflow.js';
23
23
  import { junieAdapter } from './adapters/junie.js';
24
24
  import { kilocodeAdapter } from './adapters/kilocode.js';
25
25
  import { kiroAdapter } from './adapters/kiro.js';
26
+ import { ohMyPiAdapter } from './adapters/oh-my-pi.js';
26
27
  import { opencodeAdapter } from './adapters/opencode.js';
27
28
  import { piAdapter } from './adapters/pi.js';
28
29
  import { qoderAdapter } from './adapters/qoder.js';
29
30
  import { lingmaAdapter } from './adapters/lingma.js';
30
31
  import { qwenAdapter } from './adapters/qwen.js';
31
32
  import { roocodeAdapter } from './adapters/roocode.js';
33
+ import { traeAdapter } from './adapters/trae.js';
32
34
  import { windsurfAdapter } from './adapters/windsurf.js';
33
35
  /**
34
36
  * Registry for looking up tool command adapters.
@@ -56,12 +58,14 @@ export class CommandAdapterRegistry {
56
58
  CommandAdapterRegistry.register(junieAdapter);
57
59
  CommandAdapterRegistry.register(kilocodeAdapter);
58
60
  CommandAdapterRegistry.register(kiroAdapter);
61
+ CommandAdapterRegistry.register(ohMyPiAdapter);
59
62
  CommandAdapterRegistry.register(opencodeAdapter);
60
63
  CommandAdapterRegistry.register(piAdapter);
61
64
  CommandAdapterRegistry.register(qoderAdapter);
62
65
  CommandAdapterRegistry.register(lingmaAdapter);
63
66
  CommandAdapterRegistry.register(qwenAdapter);
64
67
  CommandAdapterRegistry.register(roocodeAdapter);
68
+ CommandAdapterRegistry.register(traeAdapter);
65
69
  CommandAdapterRegistry.register(windsurfAdapter);
66
70
  }
67
71
  /**
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shared YAML frontmatter helpers for command adapters.
3
+ *
4
+ * Several tool adapters emit YAML frontmatter and need to escape
5
+ * user-facing strings (name, description, category, tags) so the
6
+ * generated file stays valid YAML. This module centralizes that logic
7
+ * so the behavior is identical across adapters and fixed in one place.
8
+ */
9
+ /**
10
+ * Escapes a string value for safe YAML output.
11
+ *
12
+ * Quotes the value with double quotes when it contains characters that
13
+ * carry special meaning in YAML (or leading/trailing whitespace), and
14
+ * escapes the characters that are not representable verbatim inside a
15
+ * double-quoted scalar: backslash, double quote, line feed and carriage
16
+ * return. Values without special characters are returned unquoted.
17
+ *
18
+ * @param value - The raw string to embed in YAML frontmatter.
19
+ * @returns The value, double-quoted and escaped when necessary.
20
+ */
21
+ export declare function escapeYamlValue(value: string): string;
22
+ //# sourceMappingURL=yaml.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Shared YAML frontmatter helpers for command adapters.
3
+ *
4
+ * Several tool adapters emit YAML frontmatter and need to escape
5
+ * user-facing strings (name, description, category, tags) so the
6
+ * generated file stays valid YAML. This module centralizes that logic
7
+ * so the behavior is identical across adapters and fixed in one place.
8
+ */
9
+ /**
10
+ * Escapes a string value for safe YAML output.
11
+ *
12
+ * Quotes the value with double quotes when it contains characters that
13
+ * carry special meaning in YAML (or leading/trailing whitespace), and
14
+ * escapes the characters that are not representable verbatim inside a
15
+ * double-quoted scalar: backslash, double quote, line feed and carriage
16
+ * return. Values without special characters are returned unquoted.
17
+ *
18
+ * @param value - The raw string to embed in YAML frontmatter.
19
+ * @returns The value, double-quoted and escaped when necessary.
20
+ */
21
+ export function escapeYamlValue(value) {
22
+ // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
23
+ const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
24
+ if (needsQuoting) {
25
+ // Use double quotes and escape characters that are not safe to emit
26
+ // verbatim inside a double-quoted YAML scalar. Carriage returns must be
27
+ // escaped too: a literal CR inside double quotes is subject to YAML line
28
+ // folding/normalization and would silently corrupt the round-tripped value.
29
+ const escaped = value
30
+ .replace(/\\/g, '\\\\')
31
+ .replace(/"/g, '\\"')
32
+ .replace(/\n/g, '\\n')
33
+ .replace(/\r/g, '\\r');
34
+ return `"${escaped}"`;
35
+ }
36
+ return value;
37
+ }
38
+ //# sourceMappingURL=yaml.js.map