@shahmarasy/prodo 0.1.3 → 0.1.5
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.
- package/README.md +201 -97
- package/bin/prodo.cjs +6 -6
- package/dist/agents/agent-registry.d.ts +13 -0
- package/dist/agents/agent-registry.js +79 -0
- package/dist/agents/anthropic/index.d.ts +9 -0
- package/dist/agents/anthropic/index.js +55 -0
- package/dist/agents/base.d.ts +25 -0
- package/dist/agents/base.js +71 -0
- package/dist/agents/google/index.d.ts +9 -0
- package/dist/agents/google/index.js +53 -0
- package/dist/agents/mock/index.d.ts +11 -0
- package/dist/agents/mock/index.js +26 -0
- package/dist/agents/openai/index.d.ts +9 -0
- package/dist/agents/openai/index.js +57 -0
- package/dist/agents/system-prompts.d.ts +3 -0
- package/dist/agents/system-prompts.js +32 -0
- package/dist/agents.js +4 -2
- package/dist/artifacts.d.ts +1 -0
- package/dist/artifacts.js +265 -31
- package/dist/cli/agent-command-installer.d.ts +4 -0
- package/dist/cli/agent-command-installer.js +148 -0
- package/dist/cli/agent-ids.d.ts +15 -0
- package/dist/cli/agent-ids.js +49 -0
- package/dist/cli/doctor.d.ts +1 -0
- package/dist/cli/doctor.js +144 -0
- package/dist/cli/fix-tui.d.ts +4 -0
- package/dist/cli/fix-tui.js +79 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +465 -0
- package/dist/cli/init-tui.d.ts +23 -0
- package/dist/cli/init-tui.js +176 -0
- package/dist/cli/init.d.ts +11 -0
- package/dist/cli/init.js +334 -0
- package/dist/cli/normalize-interactive.d.ts +8 -0
- package/dist/cli/normalize-interactive.js +167 -0
- package/dist/cli/preset-loader.d.ts +4 -0
- package/dist/cli/preset-loader.js +210 -0
- package/dist/cli.js +80 -3
- package/dist/core/artifact-registry.d.ts +11 -0
- package/dist/core/artifact-registry.js +49 -0
- package/dist/core/artifacts.d.ts +10 -0
- package/dist/core/artifacts.js +892 -0
- package/dist/core/clean.d.ts +10 -0
- package/dist/core/clean.js +74 -0
- package/dist/core/consistency.d.ts +8 -0
- package/dist/core/consistency.js +328 -0
- package/dist/core/constants.d.ts +7 -0
- package/dist/core/constants.js +64 -0
- package/dist/core/errors.d.ts +3 -0
- package/dist/core/errors.js +10 -0
- package/dist/core/fix.d.ts +31 -0
- package/dist/core/fix.js +188 -0
- package/dist/core/hook-executor.d.ts +1 -0
- package/dist/core/hook-executor.js +175 -0
- package/dist/core/markdown.d.ts +16 -0
- package/dist/core/markdown.js +81 -0
- package/dist/core/normalize.d.ts +8 -0
- package/dist/core/normalize.js +125 -0
- package/dist/core/normalized-brief.d.ts +48 -0
- package/dist/core/normalized-brief.js +182 -0
- package/dist/core/output-index.d.ts +13 -0
- package/dist/core/output-index.js +55 -0
- package/dist/core/paths.d.ts +17 -0
- package/dist/core/paths.js +80 -0
- package/dist/core/project-config.d.ts +14 -0
- package/dist/core/project-config.js +69 -0
- package/dist/core/registry.d.ts +13 -0
- package/dist/core/registry.js +115 -0
- package/dist/core/settings.d.ts +7 -0
- package/dist/core/settings.js +35 -0
- package/dist/core/template-engine.d.ts +3 -0
- package/dist/core/template-engine.js +43 -0
- package/dist/core/template-resolver.d.ts +15 -0
- package/dist/core/template-resolver.js +46 -0
- package/dist/core/templates.d.ts +33 -0
- package/dist/core/templates.js +440 -0
- package/dist/core/terminology.d.ts +21 -0
- package/dist/core/terminology.js +143 -0
- package/dist/core/tracing.d.ts +21 -0
- package/dist/core/tracing.js +74 -0
- package/dist/core/types.d.ts +35 -0
- package/dist/core/types.js +5 -0
- package/dist/core/utils.d.ts +7 -0
- package/dist/core/utils.js +66 -0
- package/dist/core/validate.d.ts +10 -0
- package/dist/core/validate.js +226 -0
- package/dist/core/validator.d.ts +5 -0
- package/dist/core/validator.js +76 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/version.js +30 -0
- package/dist/core/workflow-commands.d.ts +7 -0
- package/dist/core/workflow-commands.js +29 -0
- package/dist/i18n/en.json +45 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.js +63 -0
- package/dist/i18n/tr.json +45 -0
- package/dist/init-tui.d.ts +3 -0
- package/dist/init-tui.js +28 -1
- package/dist/init.d.ts +1 -0
- package/dist/init.js +9 -3
- package/dist/normalize.js +55 -7
- package/dist/providers/index.d.ts +2 -1
- package/dist/providers/index.js +20 -6
- package/dist/providers/mock-provider.d.ts +1 -1
- package/dist/providers/mock-provider.js +7 -6
- package/dist/providers/openai-provider.d.ts +1 -1
- package/dist/providers/openai-provider.js +3 -2
- package/dist/settings.d.ts +1 -0
- package/dist/settings.js +2 -1
- package/dist/skills/engine.d.ts +10 -0
- package/dist/skills/engine.js +75 -0
- package/dist/skills/fix-skill.d.ts +2 -0
- package/dist/skills/fix-skill.js +38 -0
- package/dist/skills/generate-artifact-skill.d.ts +2 -0
- package/dist/skills/generate-artifact-skill.js +32 -0
- package/dist/skills/generate-pipeline-skill.d.ts +2 -0
- package/dist/skills/generate-pipeline-skill.js +45 -0
- package/dist/skills/normalize-skill.d.ts +2 -0
- package/dist/skills/normalize-skill.js +29 -0
- package/dist/skills/types.d.ts +28 -0
- package/dist/skills/types.js +2 -0
- package/dist/skills/validate-skill.d.ts +2 -0
- package/dist/skills/validate-skill.js +29 -0
- package/dist/templates.d.ts +1 -1
- package/dist/templates.js +2 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +13 -0
- package/dist/validator.js +0 -4
- package/dist/workflow-commands.js +2 -1
- package/package.json +74 -45
- package/presets/fintech/preset.json +48 -1
- package/presets/fintech/prompts/prd.md +99 -2
- package/presets/marketplace/preset.json +51 -1
- package/presets/marketplace/prompts/prd.md +140 -2
- package/presets/saas/preset.json +53 -1
- package/presets/saas/prompts/prd.md +150 -2
- package/src/agents/agent-registry.ts +93 -0
- package/src/agents/anthropic/index.ts +86 -0
- package/src/agents/anthropic/manifest.json +7 -0
- package/src/agents/base.ts +77 -0
- package/src/agents/google/index.ts +79 -0
- package/src/agents/google/manifest.json +7 -0
- package/src/agents/mock/index.ts +32 -0
- package/src/agents/mock/manifest.json +7 -0
- package/src/agents/openai/index.ts +83 -0
- package/src/agents/openai/manifest.json +7 -0
- package/src/agents/system-prompts.ts +35 -0
- package/src/{agent-command-installer.ts → cli/agent-command-installer.ts} +164 -164
- package/src/{agents.ts → cli/agent-ids.ts} +58 -56
- package/src/{doctor.ts → cli/doctor.ts} +157 -137
- package/src/cli/fix-tui.ts +111 -0
- package/src/{cli.ts → cli/index.ts} +459 -319
- package/src/{init-tui.ts → cli/init-tui.ts} +208 -179
- package/src/{init.ts → cli/init.ts} +398 -391
- package/src/cli/normalize-interactive.ts +241 -0
- package/src/{preset-loader.ts → cli/preset-loader.ts} +237 -237
- package/src/{artifact-registry.ts → core/artifact-registry.ts} +69 -69
- package/src/{artifacts.ts → core/artifacts.ts} +1081 -777
- package/src/core/clean.ts +88 -0
- package/src/{consistency.ts → core/consistency.ts} +374 -303
- package/src/{constants.ts → core/constants.ts} +72 -72
- package/src/{errors.ts → core/errors.ts} +7 -7
- package/src/core/fix.ts +253 -0
- package/src/{hook-executor.ts → core/hook-executor.ts} +196 -196
- package/src/{markdown.ts → core/markdown.ts} +93 -73
- package/src/core/normalize.ts +145 -0
- package/src/{normalized-brief.ts → core/normalized-brief.ts} +227 -206
- package/src/{output-index.ts → core/output-index.ts} +59 -59
- package/src/{paths.ts → core/paths.ts} +75 -71
- package/src/{project-config.ts → core/project-config.ts} +78 -78
- package/src/{registry.ts → core/registry.ts} +119 -119
- package/src/{settings.ts → core/settings.ts} +35 -34
- package/src/core/template-engine.ts +45 -0
- package/src/{template-resolver.ts → core/template-resolver.ts} +54 -54
- package/src/{templates.ts → core/templates.ts} +452 -450
- package/src/core/terminology.ts +177 -0
- package/src/core/tracing.ts +110 -0
- package/src/{types.ts → core/types.ts} +46 -46
- package/src/{utils.ts → core/utils.ts} +64 -50
- package/src/{validate.ts → core/validate.ts} +252 -246
- package/src/{validator.ts → core/validator.ts} +92 -96
- package/src/{version.ts → core/version.ts} +24 -24
- package/src/{workflow-commands.ts → core/workflow-commands.ts} +32 -31
- package/src/i18n/en.json +45 -0
- package/src/i18n/index.ts +58 -0
- package/src/i18n/tr.json +45 -0
- package/src/providers/index.ts +29 -12
- package/src/providers/mock-provider.ts +200 -199
- package/src/providers/openai-provider.ts +88 -87
- package/src/skills/engine.ts +94 -0
- package/src/skills/fix-skill.ts +38 -0
- package/src/skills/generate-artifact-skill.ts +32 -0
- package/src/skills/generate-pipeline-skill.ts +49 -0
- package/src/skills/normalize-skill.ts +29 -0
- package/src/skills/types.ts +36 -0
- package/src/skills/validate-skill.ts +29 -0
- package/templates/commands/prodo-fix.md +46 -0
- package/templates/commands/prodo-normalize.md +118 -23
- package/templates/commands/prodo-prd.md +138 -17
- package/templates/commands/prodo-stories.md +153 -17
- package/templates/commands/prodo-techspec.md +167 -17
- package/templates/commands/prodo-validate.md +184 -26
- package/templates/commands/prodo-wireframe.md +188 -17
- package/templates/commands/prodo-workflow.md +200 -17
- package/src/normalize.ts +0 -89
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import { settingsPath } from "./paths";
|
|
3
|
-
import { fileExists } from "./utils";
|
|
4
|
-
|
|
5
|
-
export type ProdoSettings = {
|
|
6
|
-
lang: string;
|
|
7
|
-
ai?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import { settingsPath } from "./paths";
|
|
3
|
+
import { fileExists } from "./utils";
|
|
4
|
+
|
|
5
|
+
export type ProdoSettings = {
|
|
6
|
+
lang: string;
|
|
7
|
+
ai?: string;
|
|
8
|
+
author?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const DEFAULT_SETTINGS: ProdoSettings = {
|
|
12
|
+
lang: "en"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export async function readSettings(cwd: string): Promise<ProdoSettings> {
|
|
16
|
+
const path = settingsPath(cwd);
|
|
17
|
+
if (!(await fileExists(path))) return { ...DEFAULT_SETTINGS };
|
|
18
|
+
try {
|
|
19
|
+
const raw = await fs.readFile(path, "utf8");
|
|
20
|
+
const parsed = JSON.parse(raw) as Partial<ProdoSettings>;
|
|
21
|
+
return {
|
|
22
|
+
lang: typeof parsed.lang === "string" && parsed.lang.trim() ? parsed.lang.trim() : "en",
|
|
23
|
+
ai: typeof parsed.ai === "string" && parsed.ai.trim() ? parsed.ai.trim() : undefined,
|
|
24
|
+
author: typeof parsed.author === "string" && parsed.author.trim() ? parsed.author.trim() : undefined
|
|
25
|
+
};
|
|
26
|
+
} catch {
|
|
27
|
+
return { ...DEFAULT_SETTINGS };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function writeSettings(cwd: string, settings: ProdoSettings): Promise<string> {
|
|
32
|
+
const path = settingsPath(cwd);
|
|
33
|
+
await fs.writeFile(path, `${JSON.stringify(settings, null, 2)}\n`, "utf8");
|
|
34
|
+
return path;
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import nunjucks from "nunjucks";
|
|
2
|
+
|
|
3
|
+
const env = new nunjucks.Environment(null, {
|
|
4
|
+
autoescape: false,
|
|
5
|
+
throwOnUndefined: false,
|
|
6
|
+
trimBlocks: false,
|
|
7
|
+
lstripBlocks: false
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
env.addFilter("slug", (value: string): string => {
|
|
11
|
+
return (value || "")
|
|
12
|
+
.toLowerCase()
|
|
13
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
14
|
+
.replace(/^-+|-+$/g, "") || "item";
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
env.addFilter("bold", (value: string): string => {
|
|
18
|
+
return `**${value ?? ""}**`;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
env.addFilter("dateFormat", (value: string | Date | undefined): string => {
|
|
22
|
+
if (!value) return new Date().toISOString().split("T")[0];
|
|
23
|
+
const d = typeof value === "string" ? new Date(value) : value;
|
|
24
|
+
return d.toISOString().split("T")[0];
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
env.addFilter("upper", (value: string): string => {
|
|
28
|
+
return (value ?? "").toUpperCase();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
env.addFilter("default", (value: unknown, fallback: string): string => {
|
|
32
|
+
if (value === null || value === undefined || value === "") return fallback;
|
|
33
|
+
return String(value);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export function renderTemplate(
|
|
37
|
+
content: string,
|
|
38
|
+
context: Record<string, unknown>
|
|
39
|
+
): string {
|
|
40
|
+
return env.renderString(content, context);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getTemplateEnv(): nunjucks.Environment {
|
|
44
|
+
return env;
|
|
45
|
+
}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import {
|
|
3
|
-
overrideTemplateCandidatePaths,
|
|
4
|
-
templateCandidatePaths
|
|
5
|
-
} from "./paths";
|
|
6
|
-
import { extractRequiredHeadings } from "./markdown";
|
|
7
|
-
import type { ArtifactType } from "./types";
|
|
8
|
-
import { fileExists } from "./utils";
|
|
9
|
-
|
|
10
|
-
type ResolveOptions = {
|
|
11
|
-
cwd: string;
|
|
12
|
-
artifactType: ArtifactType;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export async function resolveTemplate(options: ResolveOptions): Promise<{ path: string; content: string } | null> {
|
|
16
|
-
const { cwd, artifactType } = options;
|
|
17
|
-
const candidates: string[] = [
|
|
18
|
-
...overrideTemplateCandidatePaths(cwd, artifactType),
|
|
19
|
-
...templateCandidatePaths(cwd, artifactType)
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
for (const filePath of candidates) {
|
|
23
|
-
if (await fileExists(filePath)) {
|
|
24
|
-
const content = await fs.readFile(filePath, "utf8");
|
|
25
|
-
return { path: filePath, content };
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function resolveCompanionTemplate(
|
|
32
|
-
options: ResolveOptions
|
|
33
|
-
): Promise<{ path: string; content: string } | null> {
|
|
34
|
-
const { cwd, artifactType } = options;
|
|
35
|
-
const nativeExt = artifactType === "workflow" ? ".mmd" : artifactType === "wireframe" ? ".html" : null;
|
|
36
|
-
if (!nativeExt) return null;
|
|
37
|
-
|
|
38
|
-
const candidates: string[] = [
|
|
39
|
-
...overrideTemplateCandidatePaths(cwd, artifactType),
|
|
40
|
-
...templateCandidatePaths(cwd, artifactType)
|
|
41
|
-
].filter((candidate) => candidate.toLowerCase().endsWith(nativeExt));
|
|
42
|
-
|
|
43
|
-
for (const filePath of candidates) {
|
|
44
|
-
if (await fileExists(filePath)) {
|
|
45
|
-
const content = await fs.readFile(filePath, "utf8");
|
|
46
|
-
return { path: filePath, content };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function extractRequiredHeadingsFromTemplate(content: string): string[] {
|
|
53
|
-
return extractRequiredHeadings(content);
|
|
54
|
-
}
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import {
|
|
3
|
+
overrideTemplateCandidatePaths,
|
|
4
|
+
templateCandidatePaths
|
|
5
|
+
} from "./paths";
|
|
6
|
+
import { extractRequiredHeadings } from "./markdown";
|
|
7
|
+
import type { ArtifactType } from "./types";
|
|
8
|
+
import { fileExists } from "./utils";
|
|
9
|
+
|
|
10
|
+
type ResolveOptions = {
|
|
11
|
+
cwd: string;
|
|
12
|
+
artifactType: ArtifactType;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export async function resolveTemplate(options: ResolveOptions): Promise<{ path: string; content: string } | null> {
|
|
16
|
+
const { cwd, artifactType } = options;
|
|
17
|
+
const candidates: string[] = [
|
|
18
|
+
...overrideTemplateCandidatePaths(cwd, artifactType),
|
|
19
|
+
...templateCandidatePaths(cwd, artifactType)
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
for (const filePath of candidates) {
|
|
23
|
+
if (await fileExists(filePath)) {
|
|
24
|
+
const content = await fs.readFile(filePath, "utf8");
|
|
25
|
+
return { path: filePath, content };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function resolveCompanionTemplate(
|
|
32
|
+
options: ResolveOptions
|
|
33
|
+
): Promise<{ path: string; content: string } | null> {
|
|
34
|
+
const { cwd, artifactType } = options;
|
|
35
|
+
const nativeExt = artifactType === "workflow" ? ".mmd" : artifactType === "wireframe" ? ".html" : null;
|
|
36
|
+
if (!nativeExt) return null;
|
|
37
|
+
|
|
38
|
+
const candidates: string[] = [
|
|
39
|
+
...overrideTemplateCandidatePaths(cwd, artifactType),
|
|
40
|
+
...templateCandidatePaths(cwd, artifactType)
|
|
41
|
+
].filter((candidate) => candidate.toLowerCase().endsWith(nativeExt));
|
|
42
|
+
|
|
43
|
+
for (const filePath of candidates) {
|
|
44
|
+
if (await fileExists(filePath)) {
|
|
45
|
+
const content = await fs.readFile(filePath, "utf8");
|
|
46
|
+
return { path: filePath, content };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function extractRequiredHeadingsFromTemplate(content: string): string[] {
|
|
53
|
+
return extractRequiredHeadings(content);
|
|
54
|
+
}
|