@shahmarasy/prodo 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.
- package/LICENSE +21 -0
- package/README.md +157 -0
- package/bin/prodo.cjs +6 -0
- package/dist/agent-command-installer.d.ts +4 -0
- package/dist/agent-command-installer.js +158 -0
- package/dist/agents.d.ts +15 -0
- package/dist/agents.js +47 -0
- package/dist/artifact-registry.d.ts +11 -0
- package/dist/artifact-registry.js +49 -0
- package/dist/artifacts.d.ts +9 -0
- package/dist/artifacts.js +514 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +305 -0
- package/dist/consistency.d.ts +8 -0
- package/dist/consistency.js +268 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +64 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +123 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +10 -0
- package/dist/hook-executor.d.ts +1 -0
- package/dist/hook-executor.js +175 -0
- package/dist/init-tui.d.ts +21 -0
- package/dist/init-tui.js +161 -0
- package/dist/init.d.ts +10 -0
- package/dist/init.js +307 -0
- package/dist/markdown.d.ts +11 -0
- package/dist/markdown.js +66 -0
- package/dist/normalize.d.ts +7 -0
- package/dist/normalize.js +73 -0
- package/dist/normalized-brief.d.ts +39 -0
- package/dist/normalized-brief.js +170 -0
- package/dist/output-index.d.ts +13 -0
- package/dist/output-index.js +55 -0
- package/dist/paths.d.ts +16 -0
- package/dist/paths.js +76 -0
- package/dist/preset-loader.d.ts +4 -0
- package/dist/preset-loader.js +210 -0
- package/dist/project-config.d.ts +14 -0
- package/dist/project-config.js +69 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +12 -0
- package/dist/providers/mock-provider.d.ts +7 -0
- package/dist/providers/mock-provider.js +168 -0
- package/dist/providers/openai-provider.d.ts +11 -0
- package/dist/providers/openai-provider.js +69 -0
- package/dist/registry.d.ts +13 -0
- package/dist/registry.js +115 -0
- package/dist/settings.d.ts +6 -0
- package/dist/settings.js +34 -0
- package/dist/template-resolver.d.ts +11 -0
- package/dist/template-resolver.js +28 -0
- package/dist/templates.d.ts +33 -0
- package/dist/templates.js +428 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js +5 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +53 -0
- package/dist/validate.d.ts +9 -0
- package/dist/validate.js +226 -0
- package/dist/validator.d.ts +5 -0
- package/dist/validator.js +80 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +30 -0
- package/dist/workflow-commands.d.ts +7 -0
- package/dist/workflow-commands.js +28 -0
- package/package.json +45 -0
- package/presets/fintech/preset.json +1 -0
- package/presets/fintech/prompts/prd.md +3 -0
- package/presets/marketplace/preset.json +1 -0
- package/presets/marketplace/prompts/prd.md +3 -0
- package/presets/saas/preset.json +1 -0
- package/presets/saas/prompts/prd.md +3 -0
- package/src/agent-command-installer.ts +174 -0
- package/src/agents.ts +56 -0
- package/src/artifact-registry.ts +69 -0
- package/src/artifacts.ts +606 -0
- package/src/cli.ts +322 -0
- package/src/consistency.ts +303 -0
- package/src/constants.ts +72 -0
- package/src/doctor.ts +137 -0
- package/src/errors.ts +7 -0
- package/src/hook-executor.ts +196 -0
- package/src/init-tui.ts +193 -0
- package/src/init.ts +375 -0
- package/src/markdown.ts +73 -0
- package/src/normalize.ts +89 -0
- package/src/normalized-brief.ts +206 -0
- package/src/output-index.ts +59 -0
- package/src/paths.ts +72 -0
- package/src/preset-loader.ts +237 -0
- package/src/project-config.ts +78 -0
- package/src/providers/index.ts +12 -0
- package/src/providers/mock-provider.ts +188 -0
- package/src/providers/openai-provider.ts +87 -0
- package/src/registry.ts +119 -0
- package/src/settings.ts +34 -0
- package/src/template-resolver.ts +33 -0
- package/src/templates.ts +440 -0
- package/src/types.ts +46 -0
- package/src/utils.ts +50 -0
- package/src/validate.ts +246 -0
- package/src/validator.ts +96 -0
- package/src/version.ts +24 -0
- package/src/workflow-commands.ts +31 -0
- package/templates/artifacts/prd.md +219 -0
- package/templates/artifacts/stories.md +49 -0
- package/templates/artifacts/techspec.md +42 -0
- package/templates/artifacts/wireframe.html +260 -0
- package/templates/artifacts/wireframe.md +22 -0
- package/templates/artifacts/workflow.md +22 -0
- package/templates/artifacts/workflow.mmd +6 -0
- package/templates/commands/prodo-normalize.md +24 -0
- package/templates/commands/prodo-prd.md +24 -0
- package/templates/commands/prodo-stories.md +24 -0
- package/templates/commands/prodo-techspec.md +24 -0
- package/templates/commands/prodo-validate.md +24 -0
- package/templates/commands/prodo-wireframe.md +24 -0
- package/templates/commands/prodo-workflow.md +24 -0
package/src/agents.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { UserError } from "./errors";
|
|
2
|
+
|
|
3
|
+
export const AGENT_IDS = ["codex", "gemini-cli", "claude-cli"] as const;
|
|
4
|
+
export type AgentId = (typeof AGENT_IDS)[number];
|
|
5
|
+
|
|
6
|
+
export function isSupportedAgent(agent?: string): agent is AgentId {
|
|
7
|
+
if (!agent) return false;
|
|
8
|
+
return AGENT_IDS.includes(agent as AgentId);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function resolveAgent(agent?: string): AgentId | undefined {
|
|
12
|
+
if (!agent) return undefined;
|
|
13
|
+
if (!isSupportedAgent(agent)) {
|
|
14
|
+
throw new UserError(`Unsupported agent: ${agent}. Supported: ${AGENT_IDS.join(", ")}`);
|
|
15
|
+
}
|
|
16
|
+
return agent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type CommandSetItem = {
|
|
20
|
+
command: string;
|
|
21
|
+
purpose: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type AgentCommandSet = {
|
|
25
|
+
agent: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
recommended_sequence?: CommandSetItem[];
|
|
28
|
+
artifact_shortcuts?: Record<string, string>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export async function loadAgentCommandSet(_cwd: string, agent: AgentId): Promise<AgentCommandSet> {
|
|
32
|
+
const prefix = `prodo-${agent}`;
|
|
33
|
+
return {
|
|
34
|
+
agent,
|
|
35
|
+
description: "Agent-specific command set for Prodo artifact pipeline.",
|
|
36
|
+
recommended_sequence: [
|
|
37
|
+
{ command: "prodo init . --ai <agent> --lang <en|tr>", purpose: "Initialize Prodo scaffold and agent commands." },
|
|
38
|
+
{ command: `${prefix} normalize`, purpose: "Normalize start brief into normalized brief JSON." },
|
|
39
|
+
{ command: `${prefix} prd`, purpose: "Generate PRD artifact." },
|
|
40
|
+
{ command: `${prefix} workflow`, purpose: "Generate workflow artifact." },
|
|
41
|
+
{ command: `${prefix} wireframe`, purpose: "Generate wireframe artifact." },
|
|
42
|
+
{ command: `${prefix} stories`, purpose: "Generate stories artifact." },
|
|
43
|
+
{ command: `${prefix} techspec`, purpose: "Generate techspec artifact." },
|
|
44
|
+
{ command: `${prefix} validate`, purpose: "Run validation report." }
|
|
45
|
+
],
|
|
46
|
+
artifact_shortcuts: {
|
|
47
|
+
normalize: `${prefix} normalize`,
|
|
48
|
+
prd: `${prefix} prd`,
|
|
49
|
+
workflow: `${prefix} workflow`,
|
|
50
|
+
wireframe: `${prefix} wireframe`,
|
|
51
|
+
stories: `${prefix} stories`,
|
|
52
|
+
techspec: `${prefix} techspec`,
|
|
53
|
+
validate: `${prefix} validate`
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultOutputDir,
|
|
3
|
+
defaultRequiredContractsByArtifact,
|
|
4
|
+
defaultRequiredHeadings,
|
|
5
|
+
defaultUpstreamByArtifact
|
|
6
|
+
} from "./constants";
|
|
7
|
+
import { readProjectConfig } from "./project-config";
|
|
8
|
+
import { ARTIFACT_TYPES } from "./types";
|
|
9
|
+
import type { ArtifactType, ContractCoverage } from "./types";
|
|
10
|
+
|
|
11
|
+
export type ArtifactDefinition = {
|
|
12
|
+
name: ArtifactType;
|
|
13
|
+
output_dir: string;
|
|
14
|
+
required_headings: string[];
|
|
15
|
+
upstream: ArtifactType[];
|
|
16
|
+
required_contracts: Array<keyof ContractCoverage>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function normalizeName(name: string): string {
|
|
20
|
+
return name.trim().toLowerCase().replace(/[^a-z0-9_-]/g, "-");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function toDefinition(partial: {
|
|
24
|
+
name: string;
|
|
25
|
+
output_dir?: string;
|
|
26
|
+
required_headings?: string[];
|
|
27
|
+
upstream?: string[];
|
|
28
|
+
required_contracts?: Array<keyof ContractCoverage>;
|
|
29
|
+
}): ArtifactDefinition {
|
|
30
|
+
const name = normalizeName(partial.name);
|
|
31
|
+
const outputDir = partial.output_dir?.trim() || defaultOutputDir(name);
|
|
32
|
+
const requiredHeadings = partial.required_headings?.length ? partial.required_headings : defaultRequiredHeadings(name);
|
|
33
|
+
const upstream = (partial.upstream?.length ? partial.upstream : defaultUpstreamByArtifact(name)).map(normalizeName);
|
|
34
|
+
const requiredContracts = partial.required_contracts?.length
|
|
35
|
+
? partial.required_contracts
|
|
36
|
+
: defaultRequiredContractsByArtifact(name);
|
|
37
|
+
return {
|
|
38
|
+
name,
|
|
39
|
+
output_dir: outputDir,
|
|
40
|
+
required_headings: requiredHeadings,
|
|
41
|
+
upstream,
|
|
42
|
+
required_contracts: requiredContracts
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function listArtifactDefinitions(cwd: string): Promise<ArtifactDefinition[]> {
|
|
47
|
+
const config = await readProjectConfig(cwd);
|
|
48
|
+
const base = ARTIFACT_TYPES.map((name) => toDefinition({ name }));
|
|
49
|
+
const byName = new Map<string, ArtifactDefinition>(base.map((item) => [item.name, item]));
|
|
50
|
+
for (const extra of config.artifacts ?? []) {
|
|
51
|
+
const merged = toDefinition(extra);
|
|
52
|
+
byName.set(merged.name, merged);
|
|
53
|
+
}
|
|
54
|
+
return Array.from(byName.values());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function listArtifactTypes(cwd: string): Promise<ArtifactType[]> {
|
|
58
|
+
const defs = await listArtifactDefinitions(cwd);
|
|
59
|
+
return defs.map((item) => item.name);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export async function getArtifactDefinition(cwd: string, artifactType: string): Promise<ArtifactDefinition> {
|
|
63
|
+
const normalized = normalizeName(artifactType);
|
|
64
|
+
const defs = await listArtifactDefinitions(cwd);
|
|
65
|
+
const found = defs.find((item) => item.name === normalized);
|
|
66
|
+
if (found) return found;
|
|
67
|
+
return toDefinition({ name: normalized });
|
|
68
|
+
}
|
|
69
|
+
|