@shahmarasy/prodo 0.1.4 → 0.1.6

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 (205) hide show
  1. package/README.md +201 -97
  2. package/bin/prodo.cjs +6 -6
  3. package/dist/agents/agent-registry.d.ts +13 -0
  4. package/dist/agents/agent-registry.js +79 -0
  5. package/dist/agents/anthropic/index.d.ts +9 -0
  6. package/dist/agents/anthropic/index.js +55 -0
  7. package/dist/agents/base.d.ts +25 -0
  8. package/dist/agents/base.js +71 -0
  9. package/dist/agents/google/index.d.ts +9 -0
  10. package/dist/agents/google/index.js +53 -0
  11. package/dist/agents/mock/index.d.ts +11 -0
  12. package/dist/agents/mock/index.js +26 -0
  13. package/dist/agents/openai/index.d.ts +9 -0
  14. package/dist/agents/openai/index.js +57 -0
  15. package/dist/agents/system-prompts.d.ts +3 -0
  16. package/dist/agents/system-prompts.js +32 -0
  17. package/dist/cli/agent-command-installer.d.ts +4 -0
  18. package/dist/cli/agent-command-installer.js +148 -0
  19. package/dist/cli/agent-ids.d.ts +15 -0
  20. package/dist/cli/agent-ids.js +49 -0
  21. package/dist/cli/doctor.d.ts +1 -0
  22. package/dist/cli/doctor.js +144 -0
  23. package/dist/cli/fix-tui.d.ts +4 -0
  24. package/dist/cli/fix-tui.js +79 -0
  25. package/dist/cli/index.d.ts +9 -0
  26. package/dist/cli/index.js +467 -0
  27. package/dist/cli/init-tui.d.ts +23 -0
  28. package/dist/cli/init-tui.js +183 -0
  29. package/dist/cli/init.d.ts +12 -0
  30. package/dist/cli/init.js +335 -0
  31. package/dist/cli/normalize-interactive.d.ts +8 -0
  32. package/dist/cli/normalize-interactive.js +167 -0
  33. package/dist/cli/preset-loader.d.ts +4 -0
  34. package/dist/cli/preset-loader.js +210 -0
  35. package/dist/core/artifact-registry.d.ts +11 -0
  36. package/dist/core/artifact-registry.js +49 -0
  37. package/dist/core/artifacts.d.ts +10 -0
  38. package/dist/core/artifacts.js +892 -0
  39. package/dist/core/clean.d.ts +10 -0
  40. package/dist/core/clean.js +74 -0
  41. package/dist/core/consistency.d.ts +8 -0
  42. package/dist/core/consistency.js +328 -0
  43. package/dist/core/constants.d.ts +7 -0
  44. package/dist/core/constants.js +64 -0
  45. package/dist/core/errors.d.ts +3 -0
  46. package/dist/core/errors.js +10 -0
  47. package/dist/core/fix.d.ts +31 -0
  48. package/dist/core/fix.js +188 -0
  49. package/dist/core/hook-executor.d.ts +1 -0
  50. package/dist/core/hook-executor.js +175 -0
  51. package/dist/core/markdown.d.ts +16 -0
  52. package/dist/core/markdown.js +81 -0
  53. package/dist/core/normalize.d.ts +8 -0
  54. package/dist/core/normalize.js +125 -0
  55. package/dist/core/normalized-brief.d.ts +48 -0
  56. package/dist/core/normalized-brief.js +182 -0
  57. package/dist/core/output-index.d.ts +13 -0
  58. package/dist/core/output-index.js +55 -0
  59. package/dist/core/paths.d.ts +17 -0
  60. package/dist/core/paths.js +80 -0
  61. package/dist/core/project-config.d.ts +14 -0
  62. package/dist/core/project-config.js +69 -0
  63. package/dist/core/registry.d.ts +13 -0
  64. package/dist/core/registry.js +115 -0
  65. package/dist/core/settings.d.ts +8 -0
  66. package/dist/core/settings.js +43 -0
  67. package/dist/core/template-engine.d.ts +3 -0
  68. package/dist/core/template-engine.js +43 -0
  69. package/dist/core/template-resolver.d.ts +15 -0
  70. package/dist/core/template-resolver.js +46 -0
  71. package/dist/core/templates.d.ts +33 -0
  72. package/dist/core/templates.js +440 -0
  73. package/dist/core/terminology.d.ts +21 -0
  74. package/dist/core/terminology.js +143 -0
  75. package/dist/core/tracing.d.ts +21 -0
  76. package/dist/core/tracing.js +74 -0
  77. package/dist/core/types.d.ts +35 -0
  78. package/dist/core/types.js +5 -0
  79. package/dist/core/utils.d.ts +7 -0
  80. package/dist/core/utils.js +66 -0
  81. package/dist/core/validate.d.ts +10 -0
  82. package/dist/core/validate.js +226 -0
  83. package/dist/core/validator.d.ts +5 -0
  84. package/dist/core/validator.js +76 -0
  85. package/dist/core/version.d.ts +1 -0
  86. package/dist/core/version.js +30 -0
  87. package/dist/core/workflow-commands.d.ts +7 -0
  88. package/dist/core/workflow-commands.js +29 -0
  89. package/dist/i18n/en.json +45 -0
  90. package/dist/i18n/index.d.ts +5 -0
  91. package/dist/i18n/index.js +63 -0
  92. package/dist/i18n/tr.json +45 -0
  93. package/dist/providers/index.d.ts +2 -1
  94. package/dist/providers/index.js +20 -6
  95. package/dist/providers/mock-provider.d.ts +1 -1
  96. package/dist/providers/mock-provider.js +12 -11
  97. package/dist/providers/openai-provider.d.ts +1 -1
  98. package/dist/providers/openai-provider.js +13 -13
  99. package/dist/skill-engine/context.d.ts +7 -0
  100. package/dist/skill-engine/context.js +76 -0
  101. package/dist/skill-engine/discovery.d.ts +2 -0
  102. package/dist/skill-engine/discovery.js +52 -0
  103. package/dist/skill-engine/graph.d.ts +4 -0
  104. package/dist/skill-engine/graph.js +114 -0
  105. package/dist/skill-engine/index.d.ts +11 -0
  106. package/dist/skill-engine/index.js +49 -0
  107. package/dist/skill-engine/pipeline.d.ts +9 -0
  108. package/dist/skill-engine/pipeline.js +84 -0
  109. package/dist/skill-engine/registry.d.ts +12 -0
  110. package/dist/skill-engine/registry.js +74 -0
  111. package/dist/skill-engine/types.d.ts +66 -0
  112. package/dist/skill-engine/types.js +2 -0
  113. package/dist/skill-engine/validator.d.ts +4 -0
  114. package/dist/skill-engine/validator.js +90 -0
  115. package/dist/skills/engine.d.ts +10 -0
  116. package/dist/skills/engine.js +75 -0
  117. package/dist/skills/fix-skill.d.ts +2 -0
  118. package/dist/skills/fix-skill.js +38 -0
  119. package/dist/skills/fix.d.ts +2 -0
  120. package/dist/skills/fix.js +41 -0
  121. package/dist/skills/generate-artifact-skill.d.ts +2 -0
  122. package/dist/skills/generate-artifact-skill.js +32 -0
  123. package/dist/skills/generate-artifact.d.ts +2 -0
  124. package/dist/skills/generate-artifact.js +42 -0
  125. package/dist/skills/generate-pipeline-skill.d.ts +2 -0
  126. package/dist/skills/generate-pipeline-skill.js +45 -0
  127. package/dist/skills/normalize-skill.d.ts +2 -0
  128. package/dist/skills/normalize-skill.js +29 -0
  129. package/dist/skills/normalize.d.ts +2 -0
  130. package/dist/skills/normalize.js +29 -0
  131. package/dist/skills/register-core.d.ts +2 -0
  132. package/dist/skills/register-core.js +21 -0
  133. package/dist/skills/types.d.ts +28 -0
  134. package/dist/skills/types.js +2 -0
  135. package/dist/skills/validate-skill.d.ts +2 -0
  136. package/dist/skills/validate-skill.js +29 -0
  137. package/dist/skills/validate.d.ts +2 -0
  138. package/dist/skills/validate.js +37 -0
  139. package/package.json +72 -45
  140. package/src/agents/agent-registry.ts +93 -0
  141. package/src/agents/anthropic/index.ts +86 -0
  142. package/src/agents/anthropic/manifest.json +7 -0
  143. package/src/agents/base.ts +77 -0
  144. package/src/agents/google/index.ts +79 -0
  145. package/src/agents/google/manifest.json +7 -0
  146. package/src/agents/mock/index.ts +32 -0
  147. package/src/agents/mock/manifest.json +7 -0
  148. package/src/agents/openai/index.ts +83 -0
  149. package/src/agents/openai/manifest.json +7 -0
  150. package/src/agents/system-prompts.ts +35 -0
  151. package/src/{agent-command-installer.ts → cli/agent-command-installer.ts} +164 -164
  152. package/src/{agents.ts → cli/agent-ids.ts} +58 -58
  153. package/src/{doctor.ts → cli/doctor.ts} +157 -137
  154. package/src/cli/fix-tui.ts +111 -0
  155. package/src/{cli.ts → cli/index.ts} +463 -410
  156. package/src/{init-tui.ts → cli/init-tui.ts} +49 -37
  157. package/src/{init.ts → cli/init.ts} +399 -398
  158. package/src/cli/normalize-interactive.ts +241 -0
  159. package/src/{preset-loader.ts → cli/preset-loader.ts} +237 -237
  160. package/src/{artifact-registry.ts → core/artifact-registry.ts} +69 -69
  161. package/src/{artifacts.ts → core/artifacts.ts} +1081 -1072
  162. package/src/core/clean.ts +88 -0
  163. package/src/{consistency.ts → core/consistency.ts} +374 -303
  164. package/src/{constants.ts → core/constants.ts} +72 -72
  165. package/src/{errors.ts → core/errors.ts} +7 -7
  166. package/src/core/fix.ts +253 -0
  167. package/src/{hook-executor.ts → core/hook-executor.ts} +196 -196
  168. package/src/{markdown.ts → core/markdown.ts} +93 -73
  169. package/src/{normalize.ts → core/normalize.ts} +145 -137
  170. package/src/{normalized-brief.ts → core/normalized-brief.ts} +227 -206
  171. package/src/{output-index.ts → core/output-index.ts} +59 -59
  172. package/src/{paths.ts → core/paths.ts} +75 -71
  173. package/src/{project-config.ts → core/project-config.ts} +78 -78
  174. package/src/{registry.ts → core/registry.ts} +119 -119
  175. package/src/{settings.ts → core/settings.ts} +8 -2
  176. package/src/core/template-engine.ts +45 -0
  177. package/src/{template-resolver.ts → core/template-resolver.ts} +54 -54
  178. package/src/{templates.ts → core/templates.ts} +452 -452
  179. package/src/core/terminology.ts +177 -0
  180. package/src/core/tracing.ts +110 -0
  181. package/src/{types.ts → core/types.ts} +46 -46
  182. package/src/{utils.ts → core/utils.ts} +64 -64
  183. package/src/{validate.ts → core/validate.ts} +252 -246
  184. package/src/{validator.ts → core/validator.ts} +92 -92
  185. package/src/{version.ts → core/version.ts} +24 -24
  186. package/src/{workflow-commands.ts → core/workflow-commands.ts} +32 -32
  187. package/src/i18n/en.json +45 -0
  188. package/src/i18n/index.ts +58 -0
  189. package/src/i18n/tr.json +45 -0
  190. package/src/providers/index.ts +29 -12
  191. package/src/providers/mock-provider.ts +200 -199
  192. package/src/providers/openai-provider.ts +88 -88
  193. package/src/skill-engine/context.ts +90 -0
  194. package/src/skill-engine/discovery.ts +57 -0
  195. package/src/skill-engine/graph.ts +136 -0
  196. package/src/skill-engine/index.ts +55 -0
  197. package/src/skill-engine/pipeline.ts +112 -0
  198. package/src/skill-engine/registry.ts +75 -0
  199. package/src/skill-engine/types.ts +81 -0
  200. package/src/skill-engine/validator.ts +135 -0
  201. package/src/skills/fix.ts +45 -0
  202. package/src/skills/generate-artifact.ts +48 -0
  203. package/src/skills/normalize.ts +32 -0
  204. package/src/skills/register-core.ts +27 -0
  205. package/src/skills/validate.ts +40 -0
@@ -0,0 +1 @@
1
+ export declare function readCliVersion(cwd: string): Promise<string>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.readCliVersion = readCliVersion;
7
+ const promises_1 = __importDefault(require("node:fs/promises"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const utils_1 = require("./utils");
10
+ async function readCliVersion(cwd) {
11
+ const candidates = [
12
+ node_path_1.default.join(cwd, "package.json"),
13
+ node_path_1.default.resolve(__dirname, "..", "..", "package.json")
14
+ ];
15
+ for (const candidate of candidates) {
16
+ if (!(await (0, utils_1.fileExists)(candidate)))
17
+ continue;
18
+ try {
19
+ const raw = await promises_1.default.readFile(candidate, "utf8");
20
+ const parsed = JSON.parse(raw);
21
+ if (typeof parsed.version === "string" && parsed.version.trim().length > 0) {
22
+ return parsed.version.trim();
23
+ }
24
+ }
25
+ catch {
26
+ // ignore and continue
27
+ }
28
+ }
29
+ return "0.0.0";
30
+ }
@@ -0,0 +1,7 @@
1
+ export type WorkflowCommand = {
2
+ name: string;
3
+ cliSubcommand: string;
4
+ description: string;
5
+ };
6
+ export declare const WORKFLOW_COMMANDS: WorkflowCommand[];
7
+ export declare function buildWorkflowCommands(artifactTypes: string[]): WorkflowCommand[];
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WORKFLOW_COMMANDS = void 0;
4
+ exports.buildWorkflowCommands = buildWorkflowCommands;
5
+ const BASE_WORKFLOW_COMMANDS = [
6
+ { name: "prodo-normalize", cliSubcommand: "normalize", description: "Normalize start brief into normalized brief JSON." },
7
+ { name: "prodo-prd", cliSubcommand: "prd", description: "Generate PRD artifact from normalized brief." },
8
+ { name: "prodo-workflow", cliSubcommand: "workflow", description: "Generate workflow artifact." },
9
+ { name: "prodo-wireframe", cliSubcommand: "wireframe", description: "Generate wireframe artifact." },
10
+ { name: "prodo-stories", cliSubcommand: "stories", description: "Generate stories artifact." },
11
+ { name: "prodo-techspec", cliSubcommand: "techspec", description: "Generate technical specification artifact." },
12
+ { name: "prodo-validate", cliSubcommand: "validate", description: "Run schema and cross-artifact consistency validation." },
13
+ { name: "prodo-fix", cliSubcommand: "fix", description: "Auto-fix artifacts based on validation report and brief." }
14
+ ];
15
+ exports.WORKFLOW_COMMANDS = BASE_WORKFLOW_COMMANDS;
16
+ function buildWorkflowCommands(artifactTypes) {
17
+ const commandByName = new Map(BASE_WORKFLOW_COMMANDS.map((item) => [item.name, item]));
18
+ for (const type of artifactTypes) {
19
+ const name = `prodo-${type}`;
20
+ if (commandByName.has(name))
21
+ continue;
22
+ commandByName.set(name, {
23
+ name,
24
+ cliSubcommand: type,
25
+ description: `Generate ${type} artifact from normalized brief.`
26
+ });
27
+ }
28
+ return Array.from(commandByName.values());
29
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "user_action": "User action",
3
+ "main_flow": "Main Flow",
4
+ "user": "User",
5
+ "success": "Success",
6
+ "error": "Error",
7
+ "flow_focus": "Flow Focus",
8
+ "initial_version": "Initial version",
9
+ "fix_revision": "Post-validation fix revision",
10
+ "primary_user": "Primary user",
11
+ "back": "Back",
12
+ "next": "Next",
13
+ "save": "Save",
14
+ "content": "Content",
15
+ "primary_info_area": "Primary information area",
16
+ "status_indicator": "Status indicator",
17
+ "form": "Form",
18
+ "field": "Field",
19
+ "description": "Description",
20
+ "contract": "Contract",
21
+ "actor": "Actor",
22
+ "detailed_input_area": "Detailed Input Area",
23
+ "upload_area": "Upload Area",
24
+ "low_fidelity_wireframe": "Low-fidelity wireframe.",
25
+ "confirmation_text": "Confirmation text",
26
+ "header_and_navigation": "Header and navigation",
27
+ "content_section": "Content section",
28
+ "form_section": "Form section",
29
+ "text_input": "Text input",
30
+ "to_be_refined": "To be refined.",
31
+ "note": "Note",
32
+ "requirement_item": "Requirement item",
33
+ "contract_coverage": "Contract coverage",
34
+ "screen": "Screen",
35
+ "for_artifact": "for",
36
+ "fix_proposal": "Fix Proposal",
37
+ "fix_complete": "Fix complete — validation passed.",
38
+ "fix_still_failing": "Fix applied but validation still failing.",
39
+ "fix_cancelled": "Fix cancelled.",
40
+ "no_issues": "No blocking issues found. Nothing to fix.",
41
+ "issues_found": "Issues found",
42
+ "artifacts_to_regenerate": "Artifacts to regenerate",
43
+ "general": "General",
44
+ "suggestion_prefix": "→"
45
+ }
@@ -0,0 +1,5 @@
1
+ type TranslationMap = Record<string, string>;
2
+ export declare function t(key: string, lang?: string): string;
3
+ export declare function loadTranslations(lang: string): TranslationMap;
4
+ export declare function availableLanguages(): string[];
5
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.t = t;
7
+ exports.loadTranslations = loadTranslations;
8
+ exports.availableLanguages = availableLanguages;
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const cache = new Map();
12
+ function loadJson(lang) {
13
+ if (cache.has(lang))
14
+ return cache.get(lang);
15
+ const filePath = node_path_1.default.resolve(__dirname, `${lang}.json`);
16
+ try {
17
+ const raw = node_fs_1.default.readFileSync(filePath, "utf8");
18
+ const parsed = JSON.parse(raw);
19
+ cache.set(lang, parsed);
20
+ return parsed;
21
+ }
22
+ catch {
23
+ cache.set(lang, {});
24
+ return {};
25
+ }
26
+ }
27
+ function normalizeLang(lang) {
28
+ if (!lang)
29
+ return "en";
30
+ const code = lang.toLowerCase().trim();
31
+ if (code.startsWith("tr"))
32
+ return "tr";
33
+ if (code.startsWith("en"))
34
+ return "en";
35
+ return code;
36
+ }
37
+ function t(key, lang) {
38
+ const normalized = normalizeLang(lang);
39
+ const translations = loadJson(normalized);
40
+ if (key in translations)
41
+ return translations[key];
42
+ if (normalized !== "en") {
43
+ const fallback = loadJson("en");
44
+ if (key in fallback)
45
+ return fallback[key];
46
+ }
47
+ return key;
48
+ }
49
+ function loadTranslations(lang) {
50
+ return { ...loadJson(normalizeLang(lang)) };
51
+ }
52
+ function availableLanguages() {
53
+ const dir = node_path_1.default.resolve(__dirname);
54
+ try {
55
+ return node_fs_1.default.readdirSync(dir)
56
+ .filter((f) => f.endsWith(".json"))
57
+ .map((f) => f.replace(".json", ""))
58
+ .sort();
59
+ }
60
+ catch {
61
+ return ["en"];
62
+ }
63
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "user_action": "Kullanıcı işlemi",
3
+ "main_flow": "Ana Akış",
4
+ "user": "Kullanıcı",
5
+ "success": "Başarı",
6
+ "error": "Hata",
7
+ "flow_focus": "Akış Odağı",
8
+ "initial_version": "İlk sürüm",
9
+ "fix_revision": "Doğrulama sonrası düzeltme revizyonu",
10
+ "primary_user": "Birincil kullanıcı",
11
+ "back": "Geri",
12
+ "next": "Devam",
13
+ "save": "Kaydet",
14
+ "content": "İçerik",
15
+ "primary_info_area": "Birincil bilgi alanı",
16
+ "status_indicator": "Durum göstergesi",
17
+ "form": "Form",
18
+ "field": "Alan",
19
+ "description": "Açıklama",
20
+ "contract": "Kontrat",
21
+ "actor": "Aktör",
22
+ "detailed_input_area": "Detaylı Giriş Alanı",
23
+ "upload_area": "Dosya Alanı",
24
+ "low_fidelity_wireframe": "Düşük sadakatli wireframe.",
25
+ "confirmation_text": "Onay metni",
26
+ "header_and_navigation": "Başlık ve gezinme",
27
+ "content_section": "İçerik bölümü",
28
+ "form_section": "Form bölümü",
29
+ "text_input": "Metin alanı",
30
+ "to_be_refined": "Detay daha sonra netleştirilecek.",
31
+ "note": "Not",
32
+ "requirement_item": "Gereksinim maddesi",
33
+ "contract_coverage": "Kontrat kapsamı",
34
+ "screen": "Ekran",
35
+ "for_artifact": "için",
36
+ "fix_proposal": "Düzeltme Önerisi",
37
+ "fix_complete": "Düzeltme tamamlandı — doğrulama geçti.",
38
+ "fix_still_failing": "Düzeltme uygulandı ama doğrulama hâlâ başarısız.",
39
+ "fix_cancelled": "Düzeltme iptal edildi.",
40
+ "no_issues": "Engel teşkil eden sorun bulunamadı. Düzeltilecek bir şey yok.",
41
+ "issues_found": "Bulunan sorunlar",
42
+ "artifacts_to_regenerate": "Yeniden oluşturulacak artefaktlar",
43
+ "general": "Genel",
44
+ "suggestion_prefix": "→"
45
+ }
@@ -1,2 +1,3 @@
1
- import type { LLMProvider } from "../types";
1
+ import type { LLMProvider } from "../core/types";
2
2
  export declare function createProvider(): LLMProvider;
3
+ export { getGlobalRegistry } from "../agents/agent-registry";
@@ -1,12 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGlobalRegistry = void 0;
3
4
  exports.createProvider = createProvider;
4
- const mock_provider_1 = require("./mock-provider");
5
- const openai_provider_1 = require("./openai-provider");
5
+ const agent_registry_1 = require("../agents/agent-registry");
6
+ let cachedProvider = null;
7
+ let cachedAgentName = null;
6
8
  function createProvider() {
7
- const provider = (process.env.PRODO_LLM_PROVIDER ?? "mock").toLowerCase();
8
- if (provider === "openai") {
9
- return new openai_provider_1.OpenAIProvider();
9
+ const agentName = process.env.PRODO_AGENT ??
10
+ process.env.PRODO_LLM_PROVIDER ??
11
+ "mock";
12
+ if (cachedProvider && cachedAgentName === agentName) {
13
+ return cachedProvider;
10
14
  }
11
- return new mock_provider_1.MockProvider();
15
+ const registry = (0, agent_registry_1.getGlobalRegistry)();
16
+ const agent = registry.get(agentName);
17
+ if (!agent) {
18
+ const available = registry.list().map((a) => a.name).join(", ");
19
+ throw new Error(`Unknown agent: "${agentName}". Available: ${available}`);
20
+ }
21
+ cachedProvider = registry.toProvider(agent);
22
+ cachedAgentName = agentName;
23
+ return cachedProvider;
12
24
  }
25
+ var agent_registry_2 = require("../agents/agent-registry");
26
+ Object.defineProperty(exports, "getGlobalRegistry", { enumerable: true, get: function () { return agent_registry_2.getGlobalRegistry; } });
@@ -1,4 +1,4 @@
1
- import type { LLMProvider, ProviderSchemaHint } from "../types";
1
+ import type { LLMProvider, ProviderSchemaHint } from "../core/types";
2
2
  export declare class MockProvider implements LLMProvider {
3
3
  generate(_prompt: string, inputContext: Record<string, unknown>, schemaHint: ProviderSchemaHint): Promise<{
4
4
  body: string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MockProvider = void 0;
4
+ const i18n_1 = require("../i18n");
4
5
  function asStringArray(value) {
5
6
  if (!Array.isArray(value))
6
7
  return [];
@@ -107,27 +108,27 @@ function buildArtifactBody(schemaHint, inputContext) {
107
108
  const lang = typeof inputContext.outputLanguage === "string" ? inputContext.outputLanguage.toLowerCase() : "en";
108
109
  const items = normalizeSectionItems(inputContext);
109
110
  const coverage = coverageItems(schemaHint, inputContext);
110
- const localizedItems = lang === "tr" ? items.map((_, index) => `Gereksinim maddesi ${index + 1}`) : items;
111
+ const localizedItems = lang === "tr" ? items.map((_, index) => `${(0, i18n_1.t)("requirement_item", lang)} ${index + 1}`) : items;
111
112
  const localizedCoverage = lang === "tr"
112
113
  ? coverage.map((item, index) => ({
113
114
  id: item.id,
114
- text: `Kontrat kapsami ${index + 1}`
115
+ text: `${(0, i18n_1.t)("contract_coverage", lang)} ${index + 1}`
115
116
  }))
116
117
  : coverage;
117
- const fallback = lang === "tr" ? "Detay daha sonra netlestirilecek." : "To be refined.";
118
+ const fallback = (0, i18n_1.t)("to_be_refined", lang);
118
119
  const sections = schemaHint.requiredHeadings.map((heading) => headingBlock(heading, localizedItems, fallback, localizedCoverage));
119
120
  const title = lang === "tr"
120
- ? `# ${productName} icin ${schemaHint.artifactType.toUpperCase()}`
121
- : `# ${schemaHint.artifactType.toUpperCase()} for ${productName}`;
121
+ ? `# ${productName} ${(0, i18n_1.t)("for_artifact", lang)} ${schemaHint.artifactType.toUpperCase()}`
122
+ : `# ${schemaHint.artifactType.toUpperCase()} ${(0, i18n_1.t)("for_artifact", lang)} ${productName}`;
122
123
  if (schemaHint.artifactType === "workflow") {
123
- return `${title}\n\n${sections.join("\n")}\n\n\`\`\`mermaid
124
- flowchart TD
125
- A[Start] --> B[[F1] User Action]
126
- B --> C[System Step]
127
- C --> D[Done]
124
+ return `${title}\n\n${sections.join("\n")}\n\n\`\`\`mermaid
125
+ flowchart TD
126
+ A[Start] --> B[[F1] User Action]
127
+ B --> C[System Step]
128
+ C --> D[Done]
128
129
  \`\`\``.trim();
129
130
  }
130
- return `${title}\n\n${sections.join("\n")}\n\n${lang === "tr" ? "Not" : "Note"}: ${fallback}`.trim();
131
+ return `${title}\n\n${sections.join("\n")}\n\n${(0, i18n_1.t)("note", lang)}: ${fallback}`.trim();
131
132
  }
132
133
  function semanticIssuesWithMock(inputContext) {
133
134
  const pair = inputContext.pair;
@@ -1,4 +1,4 @@
1
- import type { LLMProvider, ProviderSchemaHint } from "../types";
1
+ import type { LLMProvider, ProviderSchemaHint } from "../core/types";
2
2
  export declare class OpenAIProvider implements LLMProvider {
3
3
  private readonly apiKey;
4
4
  private readonly model;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpenAIProvider = void 0;
4
- const errors_1 = require("../errors");
4
+ const errors_1 = require("../core/errors");
5
5
  class OpenAIProvider {
6
6
  apiKey;
7
7
  model;
@@ -21,23 +21,23 @@ class OpenAIProvider {
21
21
  : "en";
22
22
  const mode = schemaHint.artifactType;
23
23
  const system = mode === "normalize"
24
- ? `You normalize messy human product briefs into strict JSON.
25
- Return valid JSON only, no markdown. Include confidence scores (0..1) for critical fields.
24
+ ? `You normalize messy human product briefs into strict JSON.
25
+ Return valid JSON only, no markdown. Include confidence scores (0..1) for critical fields.
26
26
  Preserve source language and Unicode characters exactly; never transliterate Turkish letters to ASCII.`
27
27
  : mode === "semantic_consistency"
28
- ? `You detect semantic inconsistencies between paired artifacts.
28
+ ? `You detect semantic inconsistencies between paired artifacts.
29
29
  Return valid JSON only: { "issues": [{level, code, check, contract_id, file, message, suggestion}] }.`
30
30
  : mode === "contract_relevance"
31
- ? `You verify whether tagged content actually matches the referenced contract text.
31
+ ? `You verify whether tagged content actually matches the referenced contract text.
32
32
  Return valid JSON only: { "relevant": boolean, "score": number, "reason": string }.`
33
- : `You are a product-document generator.
34
- Return only Markdown body content.
35
- Headings required:
36
- ${schemaHint.requiredHeadings.join("\n")}
37
- Required contract tags:
38
- ${schemaHint.requiredContracts.join(", ")}
39
- Use tags like [G1], [F2], [C1] where relevant.
40
- Output language: ${outputLanguage}
33
+ : `You are a product-document generator.
34
+ Return only Markdown body content.
35
+ Headings required:
36
+ ${schemaHint.requiredHeadings.join("\n")}
37
+ Required contract tags:
38
+ ${schemaHint.requiredContracts.join(", ")}
39
+ Use tags like [G1], [F2], [C1] where relevant.
40
+ Output language: ${outputLanguage}
41
41
  Do not translate required headings.`;
42
42
  const user = `${prompt}\n\nContext JSON:\n${JSON.stringify(inputContext, null, 2)}`;
43
43
  const response = await fetch(`${this.baseUrl}/chat/completions`, {
@@ -0,0 +1,7 @@
1
+ import type { ArtifactType } from "../core/types";
2
+ import type { PipelineState } from "./types";
3
+ export declare function createPipelineState(cwd: string): PipelineState;
4
+ export declare function hydrateStateFromDisk(cwd: string, state: PipelineState, artifactTypes: ArtifactType[]): Promise<void>;
5
+ export declare function isOutputSatisfied(outputName: string, state: PipelineState, artifactType?: string): boolean;
6
+ export declare function wireInputsFromState(inputNames: string[], state: PipelineState): Record<string, unknown>;
7
+ export declare function wireOutputsToState(outputs: Record<string, unknown>, state: PipelineState, skillName: string): void;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPipelineState = createPipelineState;
4
+ exports.hydrateStateFromDisk = hydrateStateFromDisk;
5
+ exports.isOutputSatisfied = isOutputSatisfied;
6
+ exports.wireInputsFromState = wireInputsFromState;
7
+ exports.wireOutputsToState = wireOutputsToState;
8
+ const paths_1 = require("../core/paths");
9
+ const output_index_1 = require("../core/output-index");
10
+ const utils_1 = require("../core/utils");
11
+ function createPipelineState(cwd) {
12
+ return {
13
+ cwd,
14
+ normalizedBriefPath: undefined,
15
+ generatedArtifacts: new Map(),
16
+ validationResult: undefined,
17
+ custom: {},
18
+ startedAt: new Date().toISOString(),
19
+ completedSkills: []
20
+ };
21
+ }
22
+ async function hydrateStateFromDisk(cwd, state, artifactTypes) {
23
+ const nbPath = (0, paths_1.normalizedBriefPath)(cwd);
24
+ if (!state.normalizedBriefPath && (await (0, utils_1.fileExists)(nbPath))) {
25
+ state.normalizedBriefPath = nbPath;
26
+ }
27
+ for (const type of artifactTypes) {
28
+ if (!state.generatedArtifacts.has(type)) {
29
+ const active = await (0, output_index_1.getActiveArtifactPath)(cwd, type);
30
+ if (active) {
31
+ state.generatedArtifacts.set(type, active);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ function isOutputSatisfied(outputName, state, artifactType) {
37
+ if (outputName === "normalizedBriefPath") {
38
+ return typeof state.normalizedBriefPath === "string" && state.normalizedBriefPath.length > 0;
39
+ }
40
+ if (outputName === "artifactPath" && artifactType) {
41
+ return state.generatedArtifacts.has(artifactType);
42
+ }
43
+ if (outputName === "validationResult") {
44
+ return state.validationResult !== undefined;
45
+ }
46
+ return false;
47
+ }
48
+ function wireInputsFromState(inputNames, state) {
49
+ const inputs = {};
50
+ for (const name of inputNames) {
51
+ if (name === "cwd")
52
+ inputs.cwd = state.cwd;
53
+ else if (name === "normalizedBriefPath")
54
+ inputs.normalizedBriefPath = state.normalizedBriefPath;
55
+ else if (name in state.custom)
56
+ inputs[name] = state.custom[name];
57
+ }
58
+ return inputs;
59
+ }
60
+ function wireOutputsToState(outputs, state, skillName) {
61
+ if ("normalizedBriefPath" in outputs && typeof outputs.normalizedBriefPath === "string") {
62
+ state.normalizedBriefPath = outputs.normalizedBriefPath;
63
+ }
64
+ if ("artifactPath" in outputs && typeof outputs.artifactPath === "string") {
65
+ const artifactType = skillName;
66
+ state.generatedArtifacts.set(artifactType, outputs.artifactPath);
67
+ }
68
+ if ("validationResult" in outputs && outputs.validationResult && typeof outputs.validationResult === "object") {
69
+ state.validationResult = outputs.validationResult;
70
+ }
71
+ for (const [key, value] of Object.entries(outputs)) {
72
+ if (!["normalizedBriefPath", "artifactPath", "validationResult"].includes(key)) {
73
+ state.custom[key] = value;
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,2 @@
1
+ import type { Skill } from "./types";
2
+ export declare function discoverSkills(cwd: string, log?: (message: string) => void): Promise<Skill[]>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.discoverSkills = discoverSkills;
7
+ const promises_1 = __importDefault(require("node:fs/promises"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const paths_1 = require("../core/paths");
10
+ const utils_1 = require("../core/utils");
11
+ function isValidManifest(obj) {
12
+ if (!obj || typeof obj !== "object")
13
+ return false;
14
+ const m = obj;
15
+ return (typeof m.name === "string" &&
16
+ typeof m.version === "string" &&
17
+ typeof m.description === "string" &&
18
+ Array.isArray(m.depends_on) &&
19
+ Array.isArray(m.inputs) &&
20
+ Array.isArray(m.outputs));
21
+ }
22
+ async function discoverSkills(cwd, log) {
23
+ const skillsDir = node_path_1.default.join((0, paths_1.prodoPath)(cwd), "skills");
24
+ if (!(await (0, utils_1.fileExists)(skillsDir)))
25
+ return [];
26
+ const entries = await promises_1.default.readdir(skillsDir);
27
+ const jsFiles = entries.filter((e) => e.endsWith(".js"));
28
+ const skills = [];
29
+ for (const file of jsFiles) {
30
+ const fullPath = node_path_1.default.resolve(skillsDir, file);
31
+ try {
32
+ const mod = require(fullPath);
33
+ const manifest = mod.manifest;
34
+ const execute = mod.execute;
35
+ if (!isValidManifest(manifest)) {
36
+ log?.(`[Skill Discovery] Skipping ${file}: invalid or missing manifest`);
37
+ continue;
38
+ }
39
+ if (typeof execute !== "function") {
40
+ log?.(`[Skill Discovery] Skipping ${file}: missing execute function`);
41
+ continue;
42
+ }
43
+ skills.push({ manifest, execute: execute });
44
+ log?.(`[Skill Discovery] Loaded plugin: ${manifest.name} v${manifest.version}`);
45
+ }
46
+ catch (err) {
47
+ const message = err instanceof Error ? err.message : String(err);
48
+ log?.(`[Skill Discovery] Failed to load ${file}: ${message}`);
49
+ }
50
+ }
51
+ return skills;
52
+ }
@@ -0,0 +1,4 @@
1
+ import type { ExecutionTier, SkillManifest } from "./types";
2
+ export declare function detectCycles(manifests: Map<string, SkillManifest>): string[][] | null;
3
+ export declare function buildExecutionPlan(manifests: Map<string, SkillManifest>, targetSkills: string[]): ExecutionTier[];
4
+ export declare function getExecutionOrder(manifests: Map<string, SkillManifest>, targetSkills: string[]): string[];
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectCycles = detectCycles;
4
+ exports.buildExecutionPlan = buildExecutionPlan;
5
+ exports.getExecutionOrder = getExecutionOrder;
6
+ const errors_1 = require("../core/errors");
7
+ function detectCycles(manifests) {
8
+ const WHITE = 0;
9
+ const GRAY = 1;
10
+ const BLACK = 2;
11
+ const color = new Map();
12
+ const cycles = [];
13
+ for (const name of manifests.keys()) {
14
+ color.set(name, WHITE);
15
+ }
16
+ function dfs(node, path) {
17
+ color.set(node, GRAY);
18
+ path.push(node);
19
+ const manifest = manifests.get(node);
20
+ if (manifest) {
21
+ for (const dep of manifest.depends_on) {
22
+ if (!manifests.has(dep))
23
+ continue;
24
+ const c = color.get(dep) ?? WHITE;
25
+ if (c === GRAY) {
26
+ const cycleStart = path.indexOf(dep);
27
+ cycles.push([...path.slice(cycleStart), dep]);
28
+ }
29
+ else if (c === WHITE) {
30
+ dfs(dep, path);
31
+ }
32
+ }
33
+ }
34
+ path.pop();
35
+ color.set(node, BLACK);
36
+ }
37
+ for (const name of manifests.keys()) {
38
+ if (color.get(name) === WHITE) {
39
+ dfs(name, []);
40
+ }
41
+ }
42
+ return cycles.length > 0 ? cycles : null;
43
+ }
44
+ function collectTransitiveDeps(target, manifests, collected) {
45
+ if (collected.has(target))
46
+ return;
47
+ collected.add(target);
48
+ const manifest = manifests.get(target);
49
+ if (!manifest)
50
+ return;
51
+ for (const dep of manifest.depends_on) {
52
+ if (manifests.has(dep)) {
53
+ collectTransitiveDeps(dep, manifests, collected);
54
+ }
55
+ }
56
+ }
57
+ function buildExecutionPlan(manifests, targetSkills) {
58
+ const needed = new Set();
59
+ for (const target of targetSkills) {
60
+ collectTransitiveDeps(target, manifests, needed);
61
+ }
62
+ const filteredManifests = new Map();
63
+ for (const name of needed) {
64
+ const m = manifests.get(name);
65
+ if (m)
66
+ filteredManifests.set(name, m);
67
+ }
68
+ const cycles = detectCycles(filteredManifests);
69
+ if (cycles) {
70
+ const cycleStr = cycles.map((c) => c.join(" → ")).join("; ");
71
+ throw new errors_1.UserError(`Dependency cycle detected: ${cycleStr}`);
72
+ }
73
+ const inDegree = new Map();
74
+ for (const name of filteredManifests.keys()) {
75
+ inDegree.set(name, 0);
76
+ }
77
+ for (const [, manifest] of filteredManifests) {
78
+ for (const dep of manifest.depends_on) {
79
+ if (filteredManifests.has(dep)) {
80
+ inDegree.set(manifest.name, (inDegree.get(manifest.name) ?? 0) + 1);
81
+ }
82
+ }
83
+ }
84
+ const tiers = [];
85
+ const remaining = new Set(filteredManifests.keys());
86
+ let tierNum = 0;
87
+ while (remaining.size > 0) {
88
+ const ready = [];
89
+ for (const name of remaining) {
90
+ if ((inDegree.get(name) ?? 0) === 0) {
91
+ ready.push(name);
92
+ }
93
+ }
94
+ if (ready.length === 0) {
95
+ throw new errors_1.UserError(`Cannot resolve execution order for: ${Array.from(remaining).join(", ")}`);
96
+ }
97
+ ready.sort();
98
+ tiers.push({ tier: tierNum, skills: ready });
99
+ for (const name of ready) {
100
+ remaining.delete(name);
101
+ for (const [otherName, manifest] of filteredManifests) {
102
+ if (manifest.depends_on.includes(name) && remaining.has(otherName)) {
103
+ inDegree.set(otherName, (inDegree.get(otherName) ?? 0) - 1);
104
+ }
105
+ }
106
+ }
107
+ tierNum += 1;
108
+ }
109
+ return tiers;
110
+ }
111
+ function getExecutionOrder(manifests, targetSkills) {
112
+ const tiers = buildExecutionPlan(manifests, targetSkills);
113
+ return tiers.flatMap((t) => t.skills);
114
+ }
@@ -0,0 +1,11 @@
1
+ import { SkillPipeline } from "./pipeline";
2
+ import type { PipelineState } from "./types";
3
+ export declare function createEngine(cwd: string, log?: (message: string) => void): Promise<SkillPipeline>;
4
+ export declare function createHydratedState(cwd: string): Promise<PipelineState>;
5
+ export { SkillPipeline } from "./pipeline";
6
+ export { SkillRegistry } from "./registry";
7
+ export { createPipelineState, hydrateStateFromDisk } from "./context";
8
+ export { buildExecutionPlan, detectCycles, getExecutionOrder } from "./graph";
9
+ export { discoverSkills } from "./discovery";
10
+ export { validateInputs, validateOutputs, validateInputPaths } from "./validator";
11
+ export type { Skill, SkillManifest, SkillInput, SkillOutput, SkillContext, SkillExecuteFn, PipelineState, PipelineOptions, ExecutionTier, SkillError, ProgressCallback } from "./types";