@tiic-tech/openworkflow 0.1.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 (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/adapters/codex/src/doctorCodexAdapter.d.ts +6 -0
  4. package/dist/adapters/codex/src/doctorCodexAdapter.js +124 -0
  5. package/dist/adapters/codex/src/doctorCodexAdapter.js.map +1 -0
  6. package/dist/adapters/codex/src/generateAgents.d.ts +2 -0
  7. package/dist/adapters/codex/src/generateAgents.js +40 -0
  8. package/dist/adapters/codex/src/generateAgents.js.map +1 -0
  9. package/dist/adapters/codex/src/generateCodexAdapter.d.ts +9 -0
  10. package/dist/adapters/codex/src/generateCodexAdapter.js +59 -0
  11. package/dist/adapters/codex/src/generateCodexAdapter.js.map +1 -0
  12. package/dist/adapters/codex/src/generateCommands.d.ts +6 -0
  13. package/dist/adapters/codex/src/generateCommands.js +205 -0
  14. package/dist/adapters/codex/src/generateCommands.js.map +1 -0
  15. package/dist/adapters/codex/src/generateSkills.d.ts +7 -0
  16. package/dist/adapters/codex/src/generateSkills.js +60 -0
  17. package/dist/adapters/codex/src/generateSkills.js.map +1 -0
  18. package/dist/adapters/codex/src/generatedFiles.d.ts +4 -0
  19. package/dist/adapters/codex/src/generatedFiles.js +67 -0
  20. package/dist/adapters/codex/src/generatedFiles.js.map +1 -0
  21. package/dist/adapters/codex/src/manifest.d.ts +4 -0
  22. package/dist/adapters/codex/src/manifest.js +40 -0
  23. package/dist/adapters/codex/src/manifest.js.map +1 -0
  24. package/dist/adapters/codex/src/templates.d.ts +7 -0
  25. package/dist/adapters/codex/src/templates.js +6 -0
  26. package/dist/adapters/codex/src/templates.js.map +1 -0
  27. package/dist/cli/src/args.d.ts +8 -0
  28. package/dist/cli/src/args.js +34 -0
  29. package/dist/cli/src/args.js.map +1 -0
  30. package/dist/cli/src/commands/doctor.d.ts +1 -0
  31. package/dist/cli/src/commands/doctor.js +26 -0
  32. package/dist/cli/src/commands/doctor.js.map +1 -0
  33. package/dist/cli/src/commands/init.d.ts +1 -0
  34. package/dist/cli/src/commands/init.js +52 -0
  35. package/dist/cli/src/commands/init.js.map +1 -0
  36. package/dist/cli/src/commands/shared.d.ts +4 -0
  37. package/dist/cli/src/commands/shared.js +19 -0
  38. package/dist/cli/src/commands/shared.js.map +1 -0
  39. package/dist/cli/src/commands/sync.d.ts +1 -0
  40. package/dist/cli/src/commands/sync.js +27 -0
  41. package/dist/cli/src/commands/sync.js.map +1 -0
  42. package/dist/cli/src/commands/validate.d.ts +1 -0
  43. package/dist/cli/src/commands/validate.js +17 -0
  44. package/dist/cli/src/commands/validate.js.map +1 -0
  45. package/dist/cli/src/dev/validateRepositoryContractsCli.d.ts +2 -0
  46. package/dist/cli/src/dev/validateRepositoryContractsCli.js +37 -0
  47. package/dist/cli/src/dev/validateRepositoryContractsCli.js.map +1 -0
  48. package/dist/cli/src/dev/verifyRuntimeSurface.d.ts +2 -0
  49. package/dist/cli/src/dev/verifyRuntimeSurface.js +344 -0
  50. package/dist/cli/src/dev/verifyRuntimeSurface.js.map +1 -0
  51. package/dist/cli/src/dev/verifyWorkflowE2E.d.ts +2 -0
  52. package/dist/cli/src/dev/verifyWorkflowE2E.js +366 -0
  53. package/dist/cli/src/dev/verifyWorkflowE2E.js.map +1 -0
  54. package/dist/cli/src/index.d.ts +2 -0
  55. package/dist/cli/src/index.js +51 -0
  56. package/dist/cli/src/index.js.map +1 -0
  57. package/dist/core/src/artifacts/registry.d.ts +53 -0
  58. package/dist/core/src/artifacts/registry.js +483 -0
  59. package/dist/core/src/artifacts/registry.js.map +1 -0
  60. package/dist/core/src/commands/registry.d.ts +36 -0
  61. package/dist/core/src/commands/registry.js +539 -0
  62. package/dist/core/src/commands/registry.js.map +1 -0
  63. package/dist/core/src/contracts/index.d.ts +23 -0
  64. package/dist/core/src/contracts/index.js +16 -0
  65. package/dist/core/src/contracts/index.js.map +1 -0
  66. package/dist/core/src/contracts/yaml.d.ts +2 -0
  67. package/dist/core/src/contracts/yaml.js +12 -0
  68. package/dist/core/src/contracts/yaml.js.map +1 -0
  69. package/dist/core/src/contracts.d.ts +23 -0
  70. package/dist/core/src/contracts.js +15 -0
  71. package/dist/core/src/contracts.js.map +1 -0
  72. package/dist/core/src/fs/index.d.ts +4 -0
  73. package/dist/core/src/fs/index.js +28 -0
  74. package/dist/core/src/fs/index.js.map +1 -0
  75. package/dist/core/src/fs.d.ts +4 -0
  76. package/dist/core/src/fs.js +28 -0
  77. package/dist/core/src/fs.js.map +1 -0
  78. package/dist/core/src/initOpenWorkflow.d.ts +7 -0
  79. package/dist/core/src/initOpenWorkflow.js +220 -0
  80. package/dist/core/src/initOpenWorkflow.js.map +1 -0
  81. package/dist/core/src/validateOpenWorkflow.d.ts +5 -0
  82. package/dist/core/src/validateOpenWorkflow.js +145 -0
  83. package/dist/core/src/validateOpenWorkflow.js.map +1 -0
  84. package/dist/core/src/validators/validateOpenWorkflow.d.ts +5 -0
  85. package/dist/core/src/validators/validateOpenWorkflow.js +551 -0
  86. package/dist/core/src/validators/validateOpenWorkflow.js.map +1 -0
  87. package/dist/core/src/validators/validateRepositoryContracts.d.ts +2 -0
  88. package/dist/core/src/validators/validateRepositoryContracts.js +827 -0
  89. package/dist/core/src/validators/validateRepositoryContracts.js.map +1 -0
  90. package/dist/core/src/workflow/initOpenWorkflow.d.ts +7 -0
  91. package/dist/core/src/workflow/initOpenWorkflow.js +182 -0
  92. package/dist/core/src/workflow/initOpenWorkflow.js.map +1 -0
  93. package/dist/core/src/yaml.d.ts +2 -0
  94. package/dist/core/src/yaml.js +12 -0
  95. package/dist/core/src/yaml.js.map +1 -0
  96. package/package.json +55 -0
  97. package/references/artifact-authoring-templates.md +78 -0
  98. package/references/audit-first-discovery-loop.md +85 -0
  99. package/references/contract-graph.md +129 -0
  100. package/references/discovery-artifact-contracts.md +155 -0
  101. package/references/engineering-skill-reference-research.md +204 -0
  102. package/references/npm-cli-architecture.md +63 -0
  103. package/references/runtime-command-surface.md +169 -0
  104. package/schemas/artifact-contracts.schema.json +130 -0
  105. package/schemas/change.schema.json +71 -0
  106. package/schemas/contract-graph.schema.json +80 -0
  107. package/schemas/decision-record.schema.json +92 -0
  108. package/schemas/disclosure-levels.schema.json +66 -0
  109. package/schemas/openworkflow-contract.schema.json +88 -0
  110. package/schemas/product-design.schema.json +356 -0
  111. package/schemas/prototype-evidence.schema.json +325 -0
  112. package/schemas/prototype.schema.json +149 -0
  113. package/schemas/validation-target.schema.json +127 -0
  114. package/schemas/validation.schema.json +123 -0
  115. package/schemas/vision-session.schema.json +78 -0
  116. package/schemas/work-items.schema.json +87 -0
  117. package/schemas/workflow-index.schema.json +70 -0
  118. package/skills/build-prototype/SKILL.md +87 -0
  119. package/skills/build-prototype/agents/openai.yaml +4 -0
  120. package/skills/build-prototype/references/prototype-protocol.md +56 -0
  121. package/skills/build-prototype/scripts/init_prototype.py +260 -0
  122. package/skills/build-team/SKILL.md +292 -0
  123. package/skills/build-team/agents/openai.yaml +4 -0
  124. package/skills/build-team/references/runtime-schema.md +275 -0
  125. package/skills/build-team/references/team-protocol.md +244 -0
  126. package/skills/build-team/scripts/init_team_runtime.py +431 -0
  127. package/skills/build-validation/SKILL.md +81 -0
  128. package/skills/build-validation/agents/openai.yaml +4 -0
  129. package/skills/build-validation/references/validation-protocol.md +51 -0
  130. package/skills/build-validation/scripts/init_validation.py +194 -0
  131. package/skills/build-workflow/SKILL.md +65 -0
  132. package/skills/build-workflow/agents/openai.yaml +4 -0
  133. package/skills/build-workflow/references/workflow-layout.md +57 -0
  134. package/skills/build-workflow/scripts/init_workflow.py +423 -0
  135. package/skills/run-team/SKILL.md +93 -0
  136. package/skills/run-team/agents/openai.yaml +4 -0
  137. package/skills/run-team/references/delegation-and-agent-lifecycle.md +78 -0
  138. package/skills/run-team/references/run-loop.md +73 -0
  139. package/skills/run-team/references/runtime-audit.md +56 -0
  140. package/skills/run-team/references/scope-selection.md +64 -0
  141. package/skills/run-team/scripts/audit_team_runtime.py +173 -0
  142. package/skills/run-team/scripts/init_next_scope.py +304 -0
  143. package/templates/README.md +5 -0
  144. package/templates/codex/README.md +4 -0
  145. package/templates/openworkflow/README.md +4 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tiic-tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # OpenWorkflow
2
+
3
+ OpenWorkflow is a contract-first workflow system for AI-assisted software
4
+ development. It initializes repository-local workflow contracts, generated Codex
5
+ repo skills, artifact templates, and validation utilities for the discovery loop
6
+ from vision through prototype tuning.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install -g @tiic-tech/openworkflow
12
+ ```
13
+
14
+ The package installs the `openworkflow` CLI.
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ openworkflow init . --tools codex
20
+ openworkflow sync --root . --tools codex
21
+ openworkflow doctor --root . --tools codex
22
+ openworkflow validate --root .
23
+ ```
24
+
25
+ ## Release Checks
26
+
27
+ Before publishing, run:
28
+
29
+ ```bash
30
+ npm run validate
31
+ npm run verify:runtime-surface
32
+ npm run verify:e2e-workflow
33
+ npm pack --dry-run
34
+ ```
35
+
36
+ `npm publish` runs the core validation gates through `prepublishOnly`; `npm pack`
37
+ rebuilds `dist` through `prepack`.
@@ -0,0 +1,6 @@
1
+ export interface AdapterDoctorResult {
2
+ ok: boolean;
3
+ errors: string[];
4
+ warnings: string[];
5
+ }
6
+ export declare function doctorCodexAdapter(root: string): Promise<AdapterDoctorResult>;
@@ -0,0 +1,124 @@
1
+ import { join } from "node:path";
2
+ import { isNotFound, readTextFile } from "../../../core/src/fs/index.js";
3
+ import { hasGeneratedMarker, renderGeneratedFile } from "./generatedFiles.js";
4
+ import { legacyCodexCommandPaths } from "./generateCommands.js";
5
+ import { legacyCodexSkillPaths } from "./generateSkills.js";
6
+ import { CODEX_MANIFEST_PATH, CODEX_MANIFEST_TEMPLATE_ID, LEGACY_CODEX_MANIFEST_PATHS, codexManifest } from "./manifest.js";
7
+ import { getCodexTemplates } from "./templates.js";
8
+ export async function doctorCodexAdapter(root) {
9
+ const errors = [];
10
+ const warnings = [];
11
+ const templates = getCodexTemplates();
12
+ for (const template of templates) {
13
+ const path = join(root, template.path);
14
+ const expected = renderGeneratedFile(template.path, template.content, template.id);
15
+ let actual;
16
+ try {
17
+ actual = await readTextFile(path);
18
+ }
19
+ catch (error) {
20
+ if (isNotFound(error)) {
21
+ errors.push(`missing Codex adapter file: ${template.path}`);
22
+ continue;
23
+ }
24
+ throw error;
25
+ }
26
+ if (!hasGeneratedMarker(actual)) {
27
+ errors.push(`Codex adapter file is not marked as generated: ${template.path}`);
28
+ continue;
29
+ }
30
+ if (!actual.includes(`template-id: ${template.id}`)) {
31
+ errors.push(`Codex adapter file has unexpected template id: ${template.path}`);
32
+ }
33
+ if (actual !== expected) {
34
+ warnings.push(`Codex adapter file is stale: ${template.path}`);
35
+ }
36
+ }
37
+ const expectedManifest = renderGeneratedFile(CODEX_MANIFEST_PATH, codexManifest(root, templates.map((template) => template.path)), CODEX_MANIFEST_TEMPLATE_ID);
38
+ try {
39
+ const manifest = await readTextFile(join(root, CODEX_MANIFEST_PATH));
40
+ if (!hasGeneratedMarker(manifest)) {
41
+ errors.push(`Codex adapter manifest is not marked as generated: ${CODEX_MANIFEST_PATH}`);
42
+ }
43
+ else if (manifest !== expectedManifest) {
44
+ warnings.push(`Codex adapter manifest is stale: ${CODEX_MANIFEST_PATH}`);
45
+ }
46
+ }
47
+ catch (error) {
48
+ if (isNotFound(error)) {
49
+ errors.push(`missing Codex adapter manifest: ${CODEX_MANIFEST_PATH}`);
50
+ }
51
+ else {
52
+ throw error;
53
+ }
54
+ }
55
+ for (const legacyPath of legacyCodexCommandPaths()) {
56
+ try {
57
+ const legacyContent = await readTextFile(join(root, legacyPath));
58
+ if (hasGeneratedMarker(legacyContent)) {
59
+ errors.push(`legacy generated Codex command remains: ${legacyPath}`);
60
+ }
61
+ else {
62
+ warnings.push(`legacy non-generated Codex command exists: ${legacyPath}`);
63
+ }
64
+ }
65
+ catch (error) {
66
+ if (!isNotFound(error)) {
67
+ throw error;
68
+ }
69
+ }
70
+ }
71
+ for (const legacyPath of legacyCodexSkillPaths()) {
72
+ try {
73
+ const legacyContent = await readTextFile(join(root, legacyPath));
74
+ if (hasGeneratedMarker(legacyContent)) {
75
+ errors.push(`legacy generated Codex skill remains: ${legacyPath}`);
76
+ }
77
+ else {
78
+ warnings.push(`legacy non-generated Codex skill exists: ${legacyPath}`);
79
+ }
80
+ }
81
+ catch (error) {
82
+ if (!isNotFound(error)) {
83
+ throw error;
84
+ }
85
+ }
86
+ }
87
+ for (const legacyPath of legacyCodexAgentPaths()) {
88
+ try {
89
+ const legacyContent = await readTextFile(join(root, legacyPath));
90
+ if (hasGeneratedMarker(legacyContent)) {
91
+ errors.push(`legacy generated Codex agent file remains: ${legacyPath}`);
92
+ }
93
+ else {
94
+ warnings.push(`legacy non-generated Codex agent file exists: ${legacyPath}`);
95
+ }
96
+ }
97
+ catch (error) {
98
+ if (!isNotFound(error)) {
99
+ throw error;
100
+ }
101
+ }
102
+ }
103
+ for (const legacyPath of LEGACY_CODEX_MANIFEST_PATHS) {
104
+ try {
105
+ const legacyContent = await readTextFile(join(root, legacyPath));
106
+ if (hasGeneratedMarker(legacyContent)) {
107
+ errors.push(`legacy generated Codex manifest remains: ${legacyPath}`);
108
+ }
109
+ else {
110
+ warnings.push(`legacy non-generated Codex manifest exists: ${legacyPath}`);
111
+ }
112
+ }
113
+ catch (error) {
114
+ if (!isNotFound(error)) {
115
+ throw error;
116
+ }
117
+ }
118
+ }
119
+ return { ok: errors.length === 0, errors, warnings };
120
+ }
121
+ function legacyCodexAgentPaths() {
122
+ return [".codex/agents/README.md", ".codex/agents/openworkflow-orchestrator.md"];
123
+ }
124
+ //# sourceMappingURL=doctorCodexAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctorCodexAdapter.js","sourceRoot":"","sources":["../../../../packages/adapters/codex/src/doctorCodexAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAQnD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY;IACnD,MA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C;YACjE,IAAI,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,4CAA4C,UAAU,EAAE,CAAC,CAAC;YACxE,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,+CAA+C,UAAU,EAAE,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBACvB,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,qBAAqB;IAC5B,OAAO,CAAC,yBAAyB,EAAE,4CAA4C,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CodexTemplate } from "./templates.js";
2
+ export declare function generateAgentTemplates(): CodexTemplate[];
@@ -0,0 +1,40 @@
1
+ export function generateAgentTemplates() {
2
+ return [
3
+ {
4
+ id: "codex.agent.readme",
5
+ path: ".codex/agents/README.md",
6
+ content: agentsReadme(),
7
+ },
8
+ {
9
+ id: "codex.agent.openworkflow-orchestrator",
10
+ path: ".codex/agents/openworkflow-orchestrator.md",
11
+ content: orchestratorAgent(),
12
+ },
13
+ ];
14
+ }
15
+ function agentsReadme() {
16
+ return `# Codex Agents for OpenWorkflow
17
+
18
+ This folder is generated by the OpenWorkflow Codex adapter. The canonical workflow state lives in \`.openworkflow/\`.
19
+ `;
20
+ }
21
+ function orchestratorAgent() {
22
+ return `---
23
+ name: openworkflow-orchestrator
24
+ description: Coordinates OpenWorkflow contract stages while keeping .openworkflow as source of truth.
25
+ ---
26
+
27
+ # OpenWorkflow Orchestrator
28
+
29
+ Read \`.openworkflow/workflow/WORKFLOW_INDEX.yaml\` first. Do not treat \`.codex/\` as the source of truth; it is an adapter layer.
30
+
31
+ Default journey:
32
+
33
+ \`\`\`txt
34
+ vision -> validation -> proto -> decision -> design -> spec -> change -> runtime
35
+ \`\`\`
36
+
37
+ Prototype discovery must not create production specs, changes, teams, or runtime state before a decision authorizes continuation.
38
+ `;
39
+ }
40
+ //# sourceMappingURL=generateAgents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateAgents.js","sourceRoot":"","sources":["../../../../packages/adapters/codex/src/generateAgents.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL;YACE,EAAE,EAAE,oBAAoB;YACxB,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,YAAY,EAAE;SACxB;QACD;YACE,EAAE,EAAE,uCAAuC;YAC3C,IAAI,EAAE,4CAA4C;YAClD,OAAO,EAAE,iBAAiB,EAAE;SAC7B;KACF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY;IACnB,OAAO;;;CAGR,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO;;;;;;;;;;;;;;;;CAgBR,CAAC;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { InitOptions } from "../../../core/src/contracts/index.js";
2
+ export interface AdapterResult {
3
+ written: string[];
4
+ skipped: string[];
5
+ unchanged: string[];
6
+ removed: string[];
7
+ warnings: string[];
8
+ }
9
+ export declare function generateCodexAdapter(options: InitOptions): Promise<AdapterResult>;
@@ -0,0 +1,59 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
3
+ import { getWorkflowCommands } from "../../../core/src/commands/registry.js";
4
+ import { ensureDir } from "../../../core/src/fs/index.js";
5
+ import { removeGenerated, renderGeneratedFile, writeGenerated } from "./generatedFiles.js";
6
+ import { codexPromptIdFromTrigger, codexPromptPathForId, legacyCodexCommandPaths } from "./generateCommands.js";
7
+ import { legacyCodexSkillPaths } from "./generateSkills.js";
8
+ import { CODEX_MANIFEST_PATH, CODEX_MANIFEST_TEMPLATE_ID, LEGACY_CODEX_MANIFEST_PATHS, codexManifest, } from "./manifest.js";
9
+ import { getCodexTemplates } from "./templates.js";
10
+ export async function generateCodexAdapter(options) {
11
+ const written = [];
12
+ const skipped = [];
13
+ const unchanged = [];
14
+ const removed = [];
15
+ const warnings = [];
16
+ const templates = getCodexTemplates();
17
+ const dirs = [".agents"];
18
+ for (const dir of dirs) {
19
+ await ensureDir(join(options.root, dir));
20
+ }
21
+ for (const template of templates) {
22
+ await writeGenerated(join(options.root, template.path), renderGeneratedFile(template.path, template.content, template.id), options.force, written, skipped, unchanged, warnings);
23
+ }
24
+ await writeGenerated(join(options.root, CODEX_MANIFEST_PATH), renderGeneratedFile(CODEX_MANIFEST_PATH, codexManifest(options.root, templates.map((template) => template.path)), CODEX_MANIFEST_TEMPLATE_ID), options.force, written, skipped, unchanged, warnings);
25
+ for (const legacyPath of legacyCodexCommandPaths()) {
26
+ await removeGenerated(join(options.root, legacyPath), options.force, removed, skipped, warnings);
27
+ }
28
+ for (const legacyPath of legacyCodexSkillPaths()) {
29
+ await removeGenerated(join(options.root, legacyPath), options.force, removed, skipped, warnings);
30
+ }
31
+ for (const legacyPath of legacyCodexAgentPaths()) {
32
+ await removeGenerated(join(options.root, legacyPath), options.force, removed, skipped, warnings);
33
+ }
34
+ for (const legacyPath of LEGACY_CODEX_MANIFEST_PATHS) {
35
+ await removeGenerated(join(options.root, legacyPath), options.force, removed, skipped, warnings);
36
+ }
37
+ for (const legacyPromptPath of legacyCodexPromptPaths()) {
38
+ await removeGenerated(legacyPromptPath, false, removed, skipped, warnings);
39
+ }
40
+ return { written, skipped, unchanged, removed, warnings };
41
+ }
42
+ function legacyCodexAgentPaths() {
43
+ return [".codex/agents/README.md", ".codex/agents/openworkflow-orchestrator.md"];
44
+ }
45
+ function legacyCodexPromptPaths() {
46
+ const codexHome = process.env.CODEX_HOME?.trim() || join(homedir(), ".codex");
47
+ const promptIds = new Set();
48
+ for (const command of getWorkflowCommands()) {
49
+ promptIds.add(command.id);
50
+ for (const legacyTrigger of command.legacyTriggers) {
51
+ const id = codexPromptIdFromTrigger(legacyTrigger);
52
+ if (id) {
53
+ promptIds.add(id);
54
+ }
55
+ }
56
+ }
57
+ return [...promptIds].map((id) => join(codexHome, "prompts", codexPromptPathForId(id)));
58
+ }
59
+ //# sourceMappingURL=generateCodexAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCodexAdapter.js","sourceRoot":"","sources":["../../../../packages/adapters/codex/src/generateCodexAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAUnD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAoB;IAC7D,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAEzB,KAAK,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AAG,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type WorkflowCommand } from "../../../core/src/commands/registry.js";
2
+ export declare function codexCommandPath(command: WorkflowCommand): string;
3
+ export declare function codexPromptPathForId(id: string): string;
4
+ export declare function legacyCodexCommandPaths(): string[];
5
+ export declare function commandDoc(command: WorkflowCommand, trigger?: string): string;
6
+ export declare function codexPromptIdFromTrigger(trigger: string): string | null;
@@ -0,0 +1,205 @@
1
+ import { getWorkflowCommands } from "../../../core/src/commands/registry.js";
2
+ import { getDiscoveryArtifactContractsForCommand } from "../../../core/src/artifacts/registry.js";
3
+ export function codexCommandPath(command) {
4
+ return `.codex/commands/${command.namespace}/${command.id}.md`;
5
+ }
6
+ export function codexPromptPathForId(id) {
7
+ return `ow-${id}.md`;
8
+ }
9
+ export function legacyCodexCommandPaths() {
10
+ const commandPaths = getWorkflowCommands().map((command) => codexCommandPath(command));
11
+ return [
12
+ ...commandPaths,
13
+ ".codex/commands/build-workflow.md",
14
+ ".codex/commands/build-context.md",
15
+ ".codex/commands/build-vision.md",
16
+ ".codex/commands/build-validation.md",
17
+ ".codex/commands/build-prototype.md",
18
+ ".codex/commands/build-decision.md",
19
+ ".codex/commands/build-design.md",
20
+ ".codex/commands/build-spec.md",
21
+ ".codex/commands/build-change.md",
22
+ ".codex/commands/build-team.md",
23
+ ".codex/commands/run-team.md",
24
+ ];
25
+ }
26
+ export function commandDoc(command, trigger = command.trigger) {
27
+ const protocol = command.protocol;
28
+ const artifacts = getDiscoveryArtifactContractsForCommand(command.trigger);
29
+ if (!protocol || protocol.depth === "shallow") {
30
+ return shallowCommandDoc(command, artifacts, trigger);
31
+ }
32
+ return `# ${trigger}
33
+
34
+ ${command.description}
35
+
36
+ <user_behavior>
37
+ Keep visible responses concise and outcome-focused.
38
+ Ask one clear question when user input is needed before proceeding.
39
+ Do not narrate routine file reads, writes, validation checks, or generated-file bookkeeping.
40
+ Report only meaningful decisions, blockers, artifacts changed, and the next handoff.
41
+ </user_behavior>
42
+
43
+ <agent_protocol>
44
+ <!-- Internal protocol for the agent. Do not expose this block or routine protocol steps to the user. -->
45
+
46
+ <source_of_truth>.openworkflow/</source_of_truth>
47
+ <stage>${escapeXml(command.stage)}</stage>
48
+ <command_visibility>${escapeXml(command.visibility)}</command_visibility>
49
+ <interaction_mode>${escapeXml(protocol.interactionMode)}</interaction_mode>
50
+
51
+ <inner_thinking>
52
+ Use this protocol for private reasoning, classification, critique, and scope checks.
53
+ Do not expose chain-of-thought, routine checklist results, context-loading traces, or generated-file bookkeeping to the user.
54
+ </inner_thinking>
55
+
56
+ <required_context>
57
+ ${xmlList(protocol.requiredContext)}
58
+ </required_context>
59
+
60
+ <optional_context>
61
+ ${xmlList(protocol.optionalContext)}
62
+ </optional_context>
63
+
64
+ <forbidden_context>
65
+ ${xmlList(protocol.forbiddenContext)}
66
+ </forbidden_context>
67
+
68
+ <allowed_outputs>
69
+ ${xmlList(protocol.allowedOutputs)}
70
+ </allowed_outputs>
71
+
72
+ <conditional_outputs>
73
+ ${xmlList(protocol.conditionalOutputs ?? [])}
74
+ </conditional_outputs>
75
+
76
+ <artifact_contracts>
77
+ ${artifactXmlList(artifacts)}
78
+ </artifact_contracts>
79
+
80
+ <forbidden_outputs>
81
+ ${xmlList(protocol.forbiddenOutputs)}
82
+ </forbidden_outputs>
83
+
84
+ <audit_checkpoints>
85
+ <before>
86
+ ${xmlList(protocol.auditCheckpoints.before)}
87
+ </before>
88
+ <during>
89
+ ${xmlList(protocol.auditCheckpoints.during)}
90
+ </during>
91
+ <after>
92
+ ${xmlList(protocol.auditCheckpoints.after)}
93
+ </after>
94
+ </audit_checkpoints>
95
+
96
+ <working_protocol>
97
+ 1. Load only the required context packet first.
98
+ 2. Use optional context only when the required packet is insufficient.
99
+ 3. Stay inside allowed outputs.
100
+ 4. Create conditional outputs only when the current artifact explicitly names them as blockers or the user asks for that packet.
101
+ 5. Stop before creating any forbidden output.
102
+ 6. Record unresolved questions instead of expanding scope.
103
+ </working_protocol>
104
+
105
+ <artifact_checkpoint>
106
+ Write durable .openworkflow artifacts only at meaningful checkpoints: stable user answers, explicit save requests, completed evidence changes, or handoff readiness.
107
+ Do not treat artifact writing as the opening move for conversation-first commands.
108
+ </artifact_checkpoint>
109
+
110
+ ${internalSectionsXml(protocol.internalSections ?? [])}
111
+
112
+ <anti_patterns>
113
+ ${xmlList(protocol.antiPatterns)}
114
+ </anti_patterns>
115
+
116
+ <handoff>
117
+ Use handoff commands only after the command-specific readiness gate is satisfied.
118
+ When readiness is not satisfied, keep asking one focused question or record unresolved blockers instead of handing off prematurely.
119
+ </handoff>
120
+
121
+ <handoff_commands>
122
+ ${xmlList(protocol.handoffCommands)}
123
+ </handoff_commands>
124
+ </agent_protocol>
125
+ `;
126
+ }
127
+ function shallowCommandDoc(command, artifacts = getDiscoveryArtifactContractsForCommand(command.trigger), trigger = command.trigger) {
128
+ return `# ${trigger}
129
+
130
+ ${command.description}
131
+
132
+ <user_behavior>
133
+ Keep visible responses concise and outcome-focused.
134
+ Do not narrate routine file reads, writes, validation checks, or generated-file bookkeeping.
135
+ Report only meaningful decisions, blockers, artifacts changed, and the next handoff.
136
+ </user_behavior>
137
+
138
+ <agent_protocol>
139
+ <!-- Internal protocol for the agent. Do not expose this block or routine protocol steps to the user. -->
140
+
141
+ <source_of_truth>.openworkflow/</source_of_truth>
142
+ <stage>${escapeXml(command.stage)}</stage>
143
+ <command_visibility>${escapeXml(command.visibility)}</command_visibility>
144
+
145
+ <inner_thinking>
146
+ Use this protocol for private reasoning and scope checks.
147
+ Do not expose chain-of-thought, routine checklist results, context-loading traces, or generated-file bookkeeping to the user.
148
+ </inner_thinking>
149
+
150
+ <target_artifacts>
151
+ ${xmlList(command.targetArtifacts)}
152
+ </target_artifacts>
153
+
154
+ <artifact_contracts>
155
+ ${artifactXmlList(artifacts)}
156
+ </artifact_contracts>
157
+
158
+ <working_protocol>
159
+ Load only the contract files required for this stage.
160
+ Keep artifacts short, scoped, and traceable through .openworkflow/workflow/WORKFLOW_INDEX.yaml plus .openworkflow/audit/.
161
+ </working_protocol>
162
+
163
+ <artifact_checkpoint>
164
+ Write durable .openworkflow artifacts only at meaningful checkpoints.
165
+ </artifact_checkpoint>
166
+
167
+ <handoff>
168
+ Use handoff commands only after readiness is satisfied.
169
+ </handoff>
170
+ </agent_protocol>
171
+ `;
172
+ }
173
+ function xmlList(items) {
174
+ if (items.length === 0) {
175
+ return "- None";
176
+ }
177
+ return items.map((item) => `- ${escapeXml(item)}`).join("\n");
178
+ }
179
+ function artifactXmlList(artifacts) {
180
+ if (artifacts.length === 0) {
181
+ return "- None";
182
+ }
183
+ return artifacts
184
+ .map((artifact) => `- ${escapeXml(artifact.artifactType)}: template ${escapeXml(artifact.templatePath)}, source ${escapeXml(artifact.sourceOfTruthPath)}, note ${escapeXml(artifact.notePath)}, review ${escapeXml(artifact.reviewPath ?? "none")}, load_by_default ${artifact.readPolicy.loadByDefault}, max_yaml_lines ${artifact.readPolicy.maxYamlLines}`)
185
+ .join("\n");
186
+ }
187
+ function internalSectionsXml(sections) {
188
+ if (!sections || sections.length === 0) {
189
+ return "";
190
+ }
191
+ return sections
192
+ .map((section) => `<${section.tag}>\n${xmlList(section.items)}\n</${section.tag}>`)
193
+ .join("\n\n");
194
+ }
195
+ function yamlString(value) {
196
+ return JSON.stringify(value);
197
+ }
198
+ function escapeXml(value) {
199
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
200
+ }
201
+ export function codexPromptIdFromTrigger(trigger) {
202
+ const match = trigger.match(/^\/ow:([a-z0-9-]+)$/);
203
+ return match?.[1] ?? null;
204
+ }
205
+ //# sourceMappingURL=generateCommands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCommands.js","sourceRoot":"","sources":["../../../../packages/adapters/codex/src/generateCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAwB,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,uCAAuC,EAAE,MAAM,yCAAyC,CAAC;AAElG,MAAM,UAAU,gBAAgB,CAAC,OAAwB;IACvD,OAAO,mBAAmB,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,EAAE,KAAK,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,EAAU;IAC7C,OAAO,MAAM,EAAE,KAAK,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,MAAM,YAAY,GAAG,mBAAmB,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACvF,OAAO;QACL,GAAG,YAAY;QACf,mCAAmC;QACnC,kCAAkC;QAClC,iCAAiC;QACjC,qCAAqC;QACrC,oCAAoC;QACpC,mCAAmC;QACnC,iCAAiC;QACjC,+BAA+B;QAC/B,iCAAiC;QACjC,+BAA+B;QAC/B,6BAA6B;KAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAwB,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO;IAC5E,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,SAAS,GAAG,uCAAuC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3E,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9C,OAAO,iBAAiB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,KAAK,OAAO;;EAEnB,OAAO,CAAC,WAAW;;;;;;;;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CAAC;AAClB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACnD,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { CodexTemplate } from "./templates.js";
2
+ import { type WorkflowCommand } from "../../../core/src/commands/registry.js";
3
+ export declare function generateSkillTemplates(): CodexTemplate[];
4
+ export declare function codexSkillName(command: WorkflowCommand): string;
5
+ export declare function codexSkillPath(command: WorkflowCommand): string;
6
+ export declare function codexSkillInterfacePath(command: WorkflowCommand): string;
7
+ export declare function legacyCodexSkillPaths(): string[];
@@ -0,0 +1,60 @@
1
+ import { getWorkflowCommands } from "../../../core/src/commands/registry.js";
2
+ import { commandDoc } from "./generateCommands.js";
3
+ export function generateSkillTemplates() {
4
+ return getWorkflowCommands().flatMap((command) => [
5
+ {
6
+ id: `codex.skill.${command.namespace}.${command.id}`,
7
+ path: codexSkillPath(command),
8
+ content: codexSkill(command),
9
+ },
10
+ {
11
+ id: `codex.skill-interface.${command.namespace}.${command.id}`,
12
+ path: codexSkillInterfacePath(command),
13
+ content: codexSkillInterface(command),
14
+ },
15
+ ]);
16
+ }
17
+ export function codexSkillName(command) {
18
+ return `${command.namespace}-${command.id}`;
19
+ }
20
+ export function codexSkillPath(command) {
21
+ return `.agents/skills/${codexSkillName(command)}/SKILL.md`;
22
+ }
23
+ export function codexSkillInterfacePath(command) {
24
+ return `.agents/skills/${codexSkillName(command)}/agents/openai.yaml`;
25
+ }
26
+ export function legacyCodexSkillPaths() {
27
+ return [".codex/skills/openworkflow.md"];
28
+ }
29
+ function codexSkill(command) {
30
+ const skillName = codexSkillName(command);
31
+ const description = command.visibility === "internal"
32
+ ? `${command.description} Internal audit skill for ${command.trigger} in OpenWorkflow repositories.`
33
+ : `${command.description} Use this skill for ${command.trigger} in OpenWorkflow repositories.`;
34
+ return `---
35
+ name: ${yamlString(skillName)}
36
+ description: ${yamlString(description)}
37
+ ---
38
+ ${commandDoc(command)}
39
+
40
+ <codex_skill>
41
+ - Skill name: ${skillName}
42
+ - Explicit invocation: $${skillName}
43
+ - Semantic command: ${command.trigger}
44
+ </codex_skill>
45
+ `;
46
+ }
47
+ function codexSkillInterface(command) {
48
+ return `interface:
49
+ display_name: ${yamlString(displayName(command))}
50
+ short_description: ${yamlString(command.visibility === "internal" ? `${command.description} Internal audit only.` : command.description)}
51
+ default_prompt: ${yamlString(`Use ${command.trigger} for this OpenWorkflow repository.`)}
52
+ `;
53
+ }
54
+ function displayName(command) {
55
+ return command.trigger.startsWith("/") ? command.trigger.slice(1) : command.trigger;
56
+ }
57
+ function yamlString(value) {
58
+ return JSON.stringify(value);
59
+ }
60
+ //# sourceMappingURL=generateSkills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateSkills.js","sourceRoot":"","sources":["../../../../packages/adapters/codex/src/generateSkills.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAwB,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,UAAU,sBAAsB;IACpC,OAAO,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAChD;YACE,EAAE,EAAE,eAAe,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,EAAE,EAAE;YACpD,IAAI,EAAE,c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,WAAW,CAAC,OAAO,CAAC,CAAC;uBAC3B,UAAU,CAAC,OAAO,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;oBACtH,UAAU,CAAC,OAAO,OAAO,CAAC,OAAO,oCAAoC,CAAC;CACzF,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CAAC,OAAwB;IAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AACtF,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function renderGeneratedFile(path: string, content: string, templateId: string): string;
2
+ export declare function hasGeneratedMarker(content: string): boolean;
3
+ export declare function writeGenerated(path: string, content: string, force: boolean, written: string[], skipped: string[], unchanged: string[], warnings: string[]): Promise<void>;
4
+ export declare function removeGenerated(path: string, force: boolean, removed: string[], skipped: string[], warnings: string[]): Promise<void>;