@ggailabs/cli-context 0.5.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 +197 -0
- package/dist/generators/agents/agentConfig.d.ts +4 -0
- package/dist/generators/agents/agentConfig.d.ts.map +1 -0
- package/dist/generators/agents/agentConfig.js +180 -0
- package/dist/generators/agents/agentConfig.js.map +1 -0
- package/dist/generators/agents/agentGenerator.d.ts +9 -0
- package/dist/generators/agents/agentGenerator.d.ts.map +1 -0
- package/dist/generators/agents/agentGenerator.js +97 -0
- package/dist/generators/agents/agentGenerator.js.map +1 -0
- package/dist/generators/agents/agentTypes.d.ts +4 -0
- package/dist/generators/agents/agentTypes.d.ts.map +1 -0
- package/dist/generators/agents/agentTypes.js +25 -0
- package/dist/generators/agents/agentTypes.js.map +1 -0
- package/dist/generators/agents/index.d.ts +4 -0
- package/dist/generators/agents/index.d.ts.map +1 -0
- package/dist/generators/agents/index.js +12 -0
- package/dist/generators/agents/index.js.map +1 -0
- package/dist/generators/agents/templates/index.d.ts +4 -0
- package/dist/generators/agents/templates/index.d.ts.map +1 -0
- package/dist/generators/agents/templates/index.js +8 -0
- package/dist/generators/agents/templates/index.js.map +1 -0
- package/dist/generators/agents/templates/indexTemplate.d.ts +3 -0
- package/dist/generators/agents/templates/indexTemplate.d.ts.map +1 -0
- package/dist/generators/agents/templates/indexTemplate.js +36 -0
- package/dist/generators/agents/templates/indexTemplate.js.map +1 -0
- package/dist/generators/agents/templates/playbookTemplate.d.ts +4 -0
- package/dist/generators/agents/templates/playbookTemplate.d.ts.map +1 -0
- package/dist/generators/agents/templates/playbookTemplate.js +99 -0
- package/dist/generators/agents/templates/playbookTemplate.js.map +1 -0
- package/dist/generators/agents/templates/types.d.ts +14 -0
- package/dist/generators/agents/templates/types.d.ts.map +1 -0
- package/dist/generators/agents/templates/types.js +3 -0
- package/dist/generators/agents/templates/types.js.map +1 -0
- package/dist/generators/documentation/documentationGenerator.d.ts +15 -0
- package/dist/generators/documentation/documentationGenerator.d.ts.map +1 -0
- package/dist/generators/documentation/documentationGenerator.js +188 -0
- package/dist/generators/documentation/documentationGenerator.js.map +1 -0
- package/dist/generators/documentation/guideRegistry.d.ts +6 -0
- package/dist/generators/documentation/guideRegistry.d.ts.map +1 -0
- package/dist/generators/documentation/guideRegistry.js +82 -0
- package/dist/generators/documentation/guideRegistry.js.map +1 -0
- package/dist/generators/documentation/index.d.ts +2 -0
- package/dist/generators/documentation/index.d.ts.map +1 -0
- package/dist/generators/documentation/index.js +6 -0
- package/dist/generators/documentation/index.js.map +1 -0
- package/dist/generators/documentation/templates/apiReferenceTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/apiReferenceTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/apiReferenceTemplate.js +490 -0
- package/dist/generators/documentation/templates/apiReferenceTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/architectureTemplate.d.ts +3 -0
- package/dist/generators/documentation/templates/architectureTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/architectureTemplate.js +66 -0
- package/dist/generators/documentation/templates/architectureTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/common.d.ts +7 -0
- package/dist/generators/documentation/templates/common.d.ts.map +1 -0
- package/dist/generators/documentation/templates/common.js +58 -0
- package/dist/generators/documentation/templates/common.js.map +1 -0
- package/dist/generators/documentation/templates/dataFlowTemplate.d.ts +3 -0
- package/dist/generators/documentation/templates/dataFlowTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/dataFlowTemplate.js +40 -0
- package/dist/generators/documentation/templates/dataFlowTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.js +44 -0
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/glossaryTemplate.d.ts +3 -0
- package/dist/generators/documentation/templates/glossaryTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/glossaryTemplate.js +41 -0
- package/dist/generators/documentation/templates/glossaryTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/index.d.ts +15 -0
- package/dist/generators/documentation/templates/index.d.ts.map +1 -0
- package/dist/generators/documentation/templates/index.js +30 -0
- package/dist/generators/documentation/templates/index.js.map +1 -0
- package/dist/generators/documentation/templates/indexTemplate.d.ts +3 -0
- package/dist/generators/documentation/templates/indexTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/indexTemplate.js +42 -0
- package/dist/generators/documentation/templates/indexTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/migrationTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/migrationTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/migrationTemplate.js +422 -0
- package/dist/generators/documentation/templates/migrationTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/onboardingTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/onboardingTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/onboardingTemplate.js +431 -0
- package/dist/generators/documentation/templates/onboardingTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/projectOverviewTemplate.d.ts +3 -0
- package/dist/generators/documentation/templates/projectOverviewTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/projectOverviewTemplate.js +65 -0
- package/dist/generators/documentation/templates/projectOverviewTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/securityTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/securityTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/securityTemplate.js +39 -0
- package/dist/generators/documentation/templates/securityTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/testingTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/testingTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/testingTemplate.js +45 -0
- package/dist/generators/documentation/templates/testingTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/toolingTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/toolingTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/toolingTemplate.js +42 -0
- package/dist/generators/documentation/templates/toolingTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/troubleshootingTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/troubleshootingTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/troubleshootingTemplate.js +292 -0
- package/dist/generators/documentation/templates/troubleshootingTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/types.d.ts +23 -0
- package/dist/generators/documentation/templates/types.d.ts.map +1 -0
- package/dist/generators/documentation/templates/types.js +3 -0
- package/dist/generators/documentation/templates/types.js.map +1 -0
- package/dist/generators/plans/index.d.ts +2 -0
- package/dist/generators/plans/index.d.ts.map +1 -0
- package/dist/generators/plans/index.js +6 -0
- package/dist/generators/plans/index.js.map +1 -0
- package/dist/generators/plans/planGenerator.d.ts +22 -0
- package/dist/generators/plans/planGenerator.d.ts.map +1 -0
- package/dist/generators/plans/planGenerator.js +109 -0
- package/dist/generators/plans/planGenerator.js.map +1 -0
- package/dist/generators/plans/templates/indexTemplate.d.ts +3 -0
- package/dist/generators/plans/templates/indexTemplate.d.ts.map +1 -0
- package/dist/generators/plans/templates/indexTemplate.js +37 -0
- package/dist/generators/plans/templates/indexTemplate.js.map +1 -0
- package/dist/generators/plans/templates/planTemplate.d.ts +3 -0
- package/dist/generators/plans/templates/planTemplate.d.ts.map +1 -0
- package/dist/generators/plans/templates/planTemplate.js +166 -0
- package/dist/generators/plans/templates/planTemplate.js.map +1 -0
- package/dist/generators/plans/templates/types.d.ts +19 -0
- package/dist/generators/plans/templates/types.d.ts.map +1 -0
- package/dist/generators/plans/templates/types.js +3 -0
- package/dist/generators/plans/templates/types.js.map +1 -0
- package/dist/generators/shared/contextGenerator.d.ts +7 -0
- package/dist/generators/shared/contextGenerator.d.ts.map +1 -0
- package/dist/generators/shared/contextGenerator.js +13 -0
- package/dist/generators/shared/contextGenerator.js.map +1 -0
- package/dist/generators/shared/directoryTemplateHelpers.d.ts +2 -0
- package/dist/generators/shared/directoryTemplateHelpers.d.ts.map +1 -0
- package/dist/generators/shared/directoryTemplateHelpers.js +12 -0
- package/dist/generators/shared/directoryTemplateHelpers.js.map +1 -0
- package/dist/generators/shared/generatorUtils.d.ts +16 -0
- package/dist/generators/shared/generatorUtils.d.ts.map +1 -0
- package/dist/generators/shared/generatorUtils.js +119 -0
- package/dist/generators/shared/generatorUtils.js.map +1 -0
- package/dist/generators/shared/index.d.ts +4 -0
- package/dist/generators/shared/index.d.ts.map +1 -0
- package/dist/generators/shared/index.js +10 -0
- package/dist/generators/shared/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +571 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/defaults.d.ts +3 -0
- package/dist/prompts/defaults.d.ts.map +1 -0
- package/dist/prompts/defaults.js +95 -0
- package/dist/prompts/defaults.js.map +1 -0
- package/dist/services/baseLLMClient.d.ts +12 -0
- package/dist/services/baseLLMClient.d.ts.map +1 -0
- package/dist/services/baseLLMClient.js +80 -0
- package/dist/services/baseLLMClient.js.map +1 -0
- package/dist/services/fill/fillService.d.ts +46 -0
- package/dist/services/fill/fillService.d.ts.map +1 -0
- package/dist/services/fill/fillService.js +254 -0
- package/dist/services/fill/fillService.js.map +1 -0
- package/dist/services/init/initService.d.ts +37 -0
- package/dist/services/init/initService.d.ts.map +1 -0
- package/dist/services/init/initService.js +167 -0
- package/dist/services/init/initService.js.map +1 -0
- package/dist/services/llmClientFactory.d.ts +8 -0
- package/dist/services/llmClientFactory.d.ts.map +1 -0
- package/dist/services/llmClientFactory.js +23 -0
- package/dist/services/llmClientFactory.js.map +1 -0
- package/dist/services/openRouterClient.d.ts +9 -0
- package/dist/services/openRouterClient.d.ts.map +1 -0
- package/dist/services/openRouterClient.js +49 -0
- package/dist/services/openRouterClient.js.map +1 -0
- package/dist/services/plan/planService.d.ts +57 -0
- package/dist/services/plan/planService.d.ts.map +1 -0
- package/dist/services/plan/planService.js +334 -0
- package/dist/services/plan/planService.js.map +1 -0
- package/dist/services/shared/llmConfig.d.ts +22 -0
- package/dist/services/shared/llmConfig.d.ts.map +1 -0
- package/dist/services/shared/llmConfig.js +38 -0
- package/dist/services/shared/llmConfig.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/cliUI.d.ts +27 -0
- package/dist/utils/cliUI.d.ts.map +1 -0
- package/dist/utils/cliUI.js +252 -0
- package/dist/utils/cliUI.js.map +1 -0
- package/dist/utils/fileMapper.d.ts +11 -0
- package/dist/utils/fileMapper.d.ts.map +1 -0
- package/dist/utils/fileMapper.js +146 -0
- package/dist/utils/fileMapper.js.map +1 -0
- package/dist/utils/gitService.d.ts +50 -0
- package/dist/utils/gitService.d.ts.map +1 -0
- package/dist/utils/gitService.js +470 -0
- package/dist/utils/gitService.js.map +1 -0
- package/dist/utils/i18n.d.ts +171 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +381 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/promptLoader.d.ts +12 -0
- package/dist/utils/promptLoader.d.ts.map +1 -0
- package/dist/utils/promptLoader.js +81 -0
- package/dist/utils/promptLoader.js.map +1 -0
- package/dist/utils/versionChecker.d.ts +15 -0
- package/dist/utils/versionChecker.d.ts.map +1 -0
- package/dist/utils/versionChecker.js +49 -0
- package/dist/utils/versionChecker.js.map +1 -0
- package/package.json +76 -0
- package/prompts/update_plan_prompt.md +41 -0
- package/prompts/update_scaffold_prompt.md +47 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UPDATE_PLAN_PROMPT_FALLBACK = exports.UPDATE_SCAFFOLD_PROMPT_FALLBACK = void 0;
|
|
4
|
+
exports.UPDATE_SCAFFOLD_PROMPT_FALLBACK = `# Prompt: Update Repository Documentation and Agent Playbooks
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
You are an AI assistant responsible for refreshing the documentation (\`docs/\`) and agent playbooks (\`agents/\`) generated by the ai-context scaffolding tool. Your goal is to bring every guide up to date with the latest repository state, fill in placeholder sections, and maintain cross-references between docs and agent instructions.
|
|
8
|
+
|
|
9
|
+
## Context Gathering Checklist
|
|
10
|
+
1. Run \`git status -sb\` to understand pending changes.
|
|
11
|
+
2. Review the latest merged commits or PRs related to documentation, architecture, workflow, or testing.
|
|
12
|
+
3. Inspect \`package.json\`, CI configuration, and any release or roadmap notes stored in the repository.
|
|
13
|
+
4. Check \`docs/README.md\` for the current document map and update AI markers (\`agent-update:*\`).
|
|
14
|
+
5. Identify unresolved placeholders marked as \`<!-- agent-fill:* -->\`.
|
|
15
|
+
|
|
16
|
+
## Update Procedure
|
|
17
|
+
1. **Select a Guide**
|
|
18
|
+
- Navigate to \`docs/<guide>.md\`.
|
|
19
|
+
- Read the YAML front matter (\`ai_update_goal\`, \`required_inputs\`, \`success_criteria\`) and ensure you collect the listed inputs before editing.
|
|
20
|
+
|
|
21
|
+
2. **Edit Within Update Wrappers**
|
|
22
|
+
- Update content strictly inside the matching \`<!-- agent-update:start:... -->\` block and keep the closing \`<!-- agent-update:end -->\` tag.
|
|
23
|
+
- Remove or replace any \`TODO\` text with accurate, current information.
|
|
24
|
+
- When you complete a placeholder slot (\`<!-- agent-fill:... -->\`), remove the wrapper and provide the finalized description.
|
|
25
|
+
|
|
26
|
+
3. **Cross-Link Updates**
|
|
27
|
+
- Verify that links between docs remain valid.
|
|
28
|
+
- If you add new guides or sections, update \`docs/README.md\` and the document map table.
|
|
29
|
+
|
|
30
|
+
4. **Agent Playbook Alignment**
|
|
31
|
+
- For each change in \`docs/\`, adjust the related \`agents/*.md\` playbooks.
|
|
32
|
+
- Ensure the "Documentation Touchpoints" list references the correct \`agent-update\` markers.
|
|
33
|
+
- Update collaboration checklists and evidence sections to reflect the latest workflows.
|
|
34
|
+
|
|
35
|
+
5. **Evidence & Traceability**
|
|
36
|
+
- Note key sources (commit hashes, issues, ADRs) in the "Evidence to Capture" or "AI Update Checklist" summary lines.
|
|
37
|
+
- If anything is ambiguous or requires human follow-up, leave a concise note clearly labelled for maintainers.
|
|
38
|
+
|
|
39
|
+
## Acceptance Criteria
|
|
40
|
+
- Every guide’s \`success_criteria\` field is satisfied.
|
|
41
|
+
- No unresolved \`TODO\` or \`agent-fill\` blocks remain unless they require explicit human input; in such cases, add a comment explaining the dependency.
|
|
42
|
+
- Agent playbooks list accurate responsibilities, best practices, and pointer links to the refreshed docs.
|
|
43
|
+
- Changes are self-contained, well-formatted Markdown, and reference any new external resources introduced.
|
|
44
|
+
|
|
45
|
+
## Deliverables
|
|
46
|
+
- Updated Markdown files committed to the repository.
|
|
47
|
+
- A short changelog or PR description summarizing:
|
|
48
|
+
- Guides touched
|
|
49
|
+
- Key decisions or facts added
|
|
50
|
+
- Evidence links and any pending follow-ups
|
|
51
|
+
`;
|
|
52
|
+
exports.UPDATE_PLAN_PROMPT_FALLBACK = `# Prompt: Update Collaboration Plans
|
|
53
|
+
|
|
54
|
+
## Purpose
|
|
55
|
+
You are an AI assistant responsible for refining collaboration plans that live in the \`.context/plans/\` directory. Each plan orchestrates work across documentation guides (\`docs/\`) and agent playbooks (\`agents/\`). Your goal is to replace placeholders with actionable guidance that keeps the plan aligned with the referenced docs, agents, and repository context.
|
|
56
|
+
|
|
57
|
+
## Preparation Checklist
|
|
58
|
+
1. Review the plan’s YAML front matter to understand the stated \`ai_update_goal\`, \`required_inputs\`, and \`success_criteria\`.
|
|
59
|
+
2. Inspect the provided documentation excerpts (from \`docs/\`) and agent playbooks to ensure the plan reflects their current guidance.
|
|
60
|
+
3. Confirm that the “Agent Lineup” and “Documentation Touchpoints” tables link to real files and reference the correct \`agent-update\` markers.
|
|
61
|
+
4. Note any TODOs, \`agent-fill\` placeholders, or missing evidence sections that must be resolved.
|
|
62
|
+
|
|
63
|
+
## Update Procedure
|
|
64
|
+
1. **Task Snapshot**
|
|
65
|
+
- Summarize the primary goal and success signal in concrete terms.
|
|
66
|
+
- List authoritative references (docs, issues, specs) that contributors should consult.
|
|
67
|
+
|
|
68
|
+
2. **Agent Alignment**
|
|
69
|
+
- For each agent in the lineup, describe why they are involved and call out the first responsibility they should focus on.
|
|
70
|
+
- Ensure playbook links and responsibility summaries match the referenced agent files.
|
|
71
|
+
|
|
72
|
+
3. **Documentation Touchpoints**
|
|
73
|
+
- Map each plan stage to the docs excerpts provided, highlighting which sections need to be updated during execution.
|
|
74
|
+
- Keep the table sorted and ensure the listed \`agent-update\` markers exist.
|
|
75
|
+
|
|
76
|
+
4. **Working Phases**
|
|
77
|
+
- Break the work into sequential phases that each include a numbered list of steps, accountable owners, deliverables, and evidence expectations.
|
|
78
|
+
- Close every phase with an explicit Git commit checkpoint (for example, \`git commit -m "chore(plan): complete phase 1"\`) so progress is recorded in version control.
|
|
79
|
+
- Reference documentation and agent resources that the team should consult while executing each phase.
|
|
80
|
+
|
|
81
|
+
5. **Evidence & Follow-up**
|
|
82
|
+
- Specify the artefacts that must be captured (PR links, test runs, change logs) before the plan is considered complete.
|
|
83
|
+
- Record any follow-up actions or decisions that require human confirmation.
|
|
84
|
+
|
|
85
|
+
## Acceptance Criteria
|
|
86
|
+
- Every TODO or placeholder inside the plan’s \`agent-update\` block is resolved or accompanied by a clear escalation note.
|
|
87
|
+
- Tables reference existing files and stay in sync with the docs/agent indices.
|
|
88
|
+
- Phases provide actionable guidance, include numbered steps, and end with an explicit Git commit checkpoint.
|
|
89
|
+
- The plan remains fully self-contained and ready for contributors to execute.
|
|
90
|
+
|
|
91
|
+
## Deliverables
|
|
92
|
+
- Updated plan Markdown returned verbatim.
|
|
93
|
+
- No additional commentary outside the Markdown output.
|
|
94
|
+
`;
|
|
95
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/prompts/defaults.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C9C,CAAC;AAEW,QAAA,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C1C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UsageStats } from '../types';
|
|
2
|
+
export declare abstract class BaseLLMClient {
|
|
3
|
+
protected usageStats: UsageStats;
|
|
4
|
+
constructor(model: string);
|
|
5
|
+
abstract generateText(prompt: string, systemPrompt?: string): Promise<string>;
|
|
6
|
+
generateDocumentation(codeContent: string, filePath: string, context: string): Promise<string>;
|
|
7
|
+
generateAgentPrompt(repoStructure: string, fileContext: string, agentType: string): Promise<string>;
|
|
8
|
+
getUsageStats(): UsageStats;
|
|
9
|
+
resetUsageStats(): void;
|
|
10
|
+
protected trackUsage(usage: any): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=baseLLMClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseLLMClient.d.ts","sourceRoot":"","sources":["../../src/services/baseLLMClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,8BAAsB,aAAa;IACjC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;gBAErB,KAAK,EAAE,MAAM;IAUzB,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAEvE,qBAAqB,CACzB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC;IAwBZ,mBAAmB,CACvB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;IAyBlB,aAAa,IAAI,UAAU;IAI3B,eAAe,IAAI,IAAI;IAWvB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;CAQvC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseLLMClient = void 0;
|
|
4
|
+
class BaseLLMClient {
|
|
5
|
+
constructor(model) {
|
|
6
|
+
this.usageStats = {
|
|
7
|
+
totalCalls: 0,
|
|
8
|
+
totalPromptTokens: 0,
|
|
9
|
+
totalCompletionTokens: 0,
|
|
10
|
+
totalTokens: 0,
|
|
11
|
+
model
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
async generateDocumentation(codeContent, filePath, context) {
|
|
15
|
+
const systemPrompt = `You are a technical documentation expert. Generate clear, comprehensive documentation for the provided code file. Include:
|
|
16
|
+
1. Purpose and overview
|
|
17
|
+
2. Key components/functions
|
|
18
|
+
3. Dependencies and relationships
|
|
19
|
+
4. Usage examples where applicable
|
|
20
|
+
5. Important notes or gotchas
|
|
21
|
+
|
|
22
|
+
Focus on being practical and helpful for developers working with this codebase.`;
|
|
23
|
+
const prompt = `File: ${filePath}
|
|
24
|
+
|
|
25
|
+
Context: ${context}
|
|
26
|
+
|
|
27
|
+
Code:
|
|
28
|
+
\`\`\`
|
|
29
|
+
${codeContent}
|
|
30
|
+
\`\`\`
|
|
31
|
+
|
|
32
|
+
Generate comprehensive documentation for this file.`;
|
|
33
|
+
return this.generateText(prompt, systemPrompt);
|
|
34
|
+
}
|
|
35
|
+
async generateAgentPrompt(repoStructure, fileContext, agentType) {
|
|
36
|
+
const systemPrompt = `You are an expert at creating AI agent prompts for software development. Create a specialized prompt that would help an AI assistant understand and work effectively with this specific codebase.
|
|
37
|
+
|
|
38
|
+
The prompt should include:
|
|
39
|
+
1. Clear understanding of the codebase structure and patterns
|
|
40
|
+
2. Key conventions and best practices used in this project
|
|
41
|
+
3. Important files and their purposes
|
|
42
|
+
4. Common tasks and workflows
|
|
43
|
+
5. Specific guidance for the agent type requested
|
|
44
|
+
|
|
45
|
+
Make the prompt practical and actionable.`;
|
|
46
|
+
const prompt = `Codebase Structure:
|
|
47
|
+
${repoStructure}
|
|
48
|
+
|
|
49
|
+
File Context:
|
|
50
|
+
${fileContext}
|
|
51
|
+
|
|
52
|
+
Agent Type: ${agentType}
|
|
53
|
+
|
|
54
|
+
Generate a comprehensive agent prompt that would help an AI assistant work effectively with this codebase for ${agentType} tasks.`;
|
|
55
|
+
return this.generateText(prompt, systemPrompt);
|
|
56
|
+
}
|
|
57
|
+
getUsageStats() {
|
|
58
|
+
return { ...this.usageStats };
|
|
59
|
+
}
|
|
60
|
+
resetUsageStats() {
|
|
61
|
+
const model = this.usageStats.model;
|
|
62
|
+
this.usageStats = {
|
|
63
|
+
totalCalls: 0,
|
|
64
|
+
totalPromptTokens: 0,
|
|
65
|
+
totalCompletionTokens: 0,
|
|
66
|
+
totalTokens: 0,
|
|
67
|
+
model
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
trackUsage(usage) {
|
|
71
|
+
if (usage) {
|
|
72
|
+
this.usageStats.totalCalls++;
|
|
73
|
+
this.usageStats.totalPromptTokens += usage.prompt_tokens || usage.input_tokens || 0;
|
|
74
|
+
this.usageStats.totalCompletionTokens += usage.completion_tokens || usage.output_tokens || 0;
|
|
75
|
+
this.usageStats.totalTokens += usage.total_tokens || (usage.prompt_tokens + usage.completion_tokens) || 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.BaseLLMClient = BaseLLMClient;
|
|
80
|
+
//# sourceMappingURL=baseLLMClient.js.map
|
|
@@ -0,0 +1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,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,iBAAiB,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC;YACpF,IAAI,CAAC,UAAU,CAAC,qBAAqB,IAAI,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,CAAC;YAC7F,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC5G,CAAC;IACH,CAAC;CACF;AA/FD,sCA+FC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CLIInterface } from '../../utils/cliUI';
|
|
2
|
+
import type { TranslateFn } from '../../utils/i18n';
|
|
3
|
+
import { FileMapper } from '../../utils/fileMapper';
|
|
4
|
+
import { LLMClientFactory } from '../llmClientFactory';
|
|
5
|
+
import type { LLMConfig } from '../../types';
|
|
6
|
+
export interface FillCommandFlags {
|
|
7
|
+
output?: string;
|
|
8
|
+
prompt?: string;
|
|
9
|
+
include?: string[];
|
|
10
|
+
exclude?: string[];
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
limit?: number;
|
|
13
|
+
model?: string;
|
|
14
|
+
provider?: LLMConfig['provider'];
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
interface FillServiceDependencies {
|
|
19
|
+
ui: CLIInterface;
|
|
20
|
+
t: TranslateFn;
|
|
21
|
+
version: string;
|
|
22
|
+
defaultModel: string;
|
|
23
|
+
fileMapperFactory?: (exclude: string[] | undefined) => FileMapper;
|
|
24
|
+
llmClientFactory?: typeof LLMClientFactory;
|
|
25
|
+
}
|
|
26
|
+
export declare class FillService {
|
|
27
|
+
private readonly ui;
|
|
28
|
+
private readonly t;
|
|
29
|
+
private readonly version;
|
|
30
|
+
private readonly defaultModel;
|
|
31
|
+
private readonly fileMapperFactory;
|
|
32
|
+
private readonly llmClientFactory;
|
|
33
|
+
constructor(dependencies: FillServiceDependencies);
|
|
34
|
+
run(repoPath: string, rawOptions: FillCommandFlags): Promise<void>;
|
|
35
|
+
private processTarget;
|
|
36
|
+
private collectTargets;
|
|
37
|
+
private displayPromptSource;
|
|
38
|
+
private displayablePath;
|
|
39
|
+
private ensureDirectoryExists;
|
|
40
|
+
private buildContextSummary;
|
|
41
|
+
private buildUserPrompt;
|
|
42
|
+
private printLlmSummary;
|
|
43
|
+
private ensureTrailingNewline;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=fillService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fillService.d.ts","sourceRoot":"","sources":["../../../src/services/fill/fillService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAA6B,MAAM,aAAa,CAAC;AAIxE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAyBD,UAAU,uBAAuB;IAC/B,EAAE,EAAE,YAAY,CAAC;IACjB,CAAC,EAAE,WAAW,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,KAAK,UAAU,CAAC;IAClE,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAC;CAC5C;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAe;IAClC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAc;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgD;IAClF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA0B;gBAE/C,YAAY,EAAE,uBAAuB;IAS3C,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;YAuF1D,aAAa;YA8Bb,cAAc;IAqB5B,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,eAAe;YAKT,qBAAqB;IAOnC,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,eAAe;IA6BvB,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,qBAAqB;CAG9B"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.FillService = void 0;
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const fs = __importStar(require("fs-extra"));
|
|
42
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
43
|
+
const glob_1 = require("glob");
|
|
44
|
+
const promptLoader_1 = require("../../utils/promptLoader");
|
|
45
|
+
const fileMapper_1 = require("../../utils/fileMapper");
|
|
46
|
+
const llmClientFactory_1 = require("../llmClientFactory");
|
|
47
|
+
const llmConfig_1 = require("../shared/llmConfig");
|
|
48
|
+
class FillService {
|
|
49
|
+
constructor(dependencies) {
|
|
50
|
+
this.ui = dependencies.ui;
|
|
51
|
+
this.t = dependencies.t;
|
|
52
|
+
this.version = dependencies.version;
|
|
53
|
+
this.defaultModel = dependencies.defaultModel;
|
|
54
|
+
this.fileMapperFactory = dependencies.fileMapperFactory ?? ((exclude) => new fileMapper_1.FileMapper(exclude ?? []));
|
|
55
|
+
this.llmClientFactory = dependencies.llmClientFactory ?? llmClientFactory_1.LLMClientFactory;
|
|
56
|
+
}
|
|
57
|
+
async run(repoPath, rawOptions) {
|
|
58
|
+
const resolvedRepo = path.resolve(repoPath);
|
|
59
|
+
const outputDir = path.resolve(rawOptions.output || './.context');
|
|
60
|
+
const docsDir = path.join(outputDir, 'docs');
|
|
61
|
+
const agentsDir = path.join(outputDir, 'agents');
|
|
62
|
+
await this.ensureDirectoryExists(docsDir, this.t('errors.fill.missingDocsScaffold'));
|
|
63
|
+
await this.ensureDirectoryExists(agentsDir, this.t('errors.fill.missingAgentsScaffold'));
|
|
64
|
+
const llmConfig = await (0, llmConfig_1.resolveLlmConfig)({
|
|
65
|
+
rawOptions: {
|
|
66
|
+
provider: rawOptions.provider,
|
|
67
|
+
model: rawOptions.model,
|
|
68
|
+
apiKey: rawOptions.apiKey,
|
|
69
|
+
baseUrl: rawOptions.baseUrl
|
|
70
|
+
},
|
|
71
|
+
fallbackModel: this.defaultModel,
|
|
72
|
+
t: this.t,
|
|
73
|
+
factory: this.llmClientFactory
|
|
74
|
+
});
|
|
75
|
+
const scaffoldPrompt = await (0, promptLoader_1.resolveScaffoldPrompt)(rawOptions.prompt, missingPath => this.t('errors.fill.promptMissing', { path: missingPath }));
|
|
76
|
+
const options = {
|
|
77
|
+
repoPath: resolvedRepo,
|
|
78
|
+
outputDir,
|
|
79
|
+
docsDir,
|
|
80
|
+
agentsDir,
|
|
81
|
+
include: rawOptions.include,
|
|
82
|
+
exclude: rawOptions.exclude,
|
|
83
|
+
verbose: Boolean(rawOptions.verbose),
|
|
84
|
+
limit: rawOptions.limit,
|
|
85
|
+
provider: llmConfig.provider,
|
|
86
|
+
model: llmConfig.model,
|
|
87
|
+
apiKey: llmConfig.apiKey,
|
|
88
|
+
baseUrl: llmConfig.baseUrl,
|
|
89
|
+
systemPrompt: scaffoldPrompt.content
|
|
90
|
+
};
|
|
91
|
+
this.displayPromptSource(scaffoldPrompt.path, scaffoldPrompt.source);
|
|
92
|
+
this.ui.displayWelcome(this.version);
|
|
93
|
+
this.ui.displayProjectInfo(options.repoPath, options.outputDir, `fill:${options.provider}`);
|
|
94
|
+
const fileMapper = this.fileMapperFactory(options.exclude);
|
|
95
|
+
this.ui.displayStep(1, 3, this.t('steps.fill.analyze'));
|
|
96
|
+
this.ui.startSpinner(this.t('spinner.repo.scanning'));
|
|
97
|
+
const repoStructure = await fileMapper.mapRepository(options.repoPath, options.include);
|
|
98
|
+
this.ui.updateSpinner(this.t('spinner.repo.scanComplete', {
|
|
99
|
+
fileCount: repoStructure.totalFiles,
|
|
100
|
+
directoryCount: repoStructure.directories.length
|
|
101
|
+
}), 'success');
|
|
102
|
+
const targets = await this.collectTargets(options);
|
|
103
|
+
if (targets.length === 0) {
|
|
104
|
+
this.ui.displayWarning(this.t('warnings.fill.noTargets'));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const llmClient = this.llmClientFactory.createClient({
|
|
108
|
+
apiKey: options.apiKey,
|
|
109
|
+
model: options.model,
|
|
110
|
+
provider: options.provider,
|
|
111
|
+
baseUrl: options.baseUrl
|
|
112
|
+
});
|
|
113
|
+
const contextSummary = this.buildContextSummary(repoStructure);
|
|
114
|
+
const results = [];
|
|
115
|
+
this.ui.displayStep(2, 3, this.t('steps.fill.processFiles', { count: targets.length, model: options.model }));
|
|
116
|
+
for (const target of targets) {
|
|
117
|
+
const result = await this.processTarget(target, llmClient, options, contextSummary);
|
|
118
|
+
results.push(result);
|
|
119
|
+
}
|
|
120
|
+
this.ui.displayStep(3, 3, this.t('steps.fill.summary'));
|
|
121
|
+
this.printLlmSummary(llmClient.getUsageStats(), results);
|
|
122
|
+
this.ui.displaySuccess(this.t('success.fill.completed'));
|
|
123
|
+
}
|
|
124
|
+
async processTarget(target, llmClient, options, contextSummary) {
|
|
125
|
+
this.ui.startSpinner(this.t('spinner.fill.processing', { path: target.relativePath }));
|
|
126
|
+
try {
|
|
127
|
+
const userPrompt = this.buildUserPrompt(target.relativePath, target.content, contextSummary, target.isAgent);
|
|
128
|
+
const updatedContent = await llmClient.generateText(userPrompt, options.systemPrompt);
|
|
129
|
+
if (!updatedContent || !updatedContent.trim()) {
|
|
130
|
+
this.ui.updateSpinner(this.t('spinner.fill.noContent', { path: target.relativePath }), 'warn');
|
|
131
|
+
return { file: target.relativePath, status: 'skipped', message: this.t('messages.fill.emptyResponse') };
|
|
132
|
+
}
|
|
133
|
+
await fs.writeFile(target.fullPath, this.ensureTrailingNewline(updatedContent));
|
|
134
|
+
this.ui.updateSpinner(this.t('spinner.fill.updated', { path: target.relativePath }), 'success');
|
|
135
|
+
return { file: target.relativePath, status: 'updated' };
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
this.ui.updateSpinner(this.t('spinner.fill.failed', { path: target.relativePath }), 'fail');
|
|
139
|
+
return {
|
|
140
|
+
file: target.relativePath,
|
|
141
|
+
status: 'failed',
|
|
142
|
+
message: error instanceof Error ? error.message : String(error)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async collectTargets(options) {
|
|
147
|
+
const docFiles = await (0, glob_1.glob)('**/*.md', { cwd: options.docsDir, absolute: true });
|
|
148
|
+
const agentFiles = await (0, glob_1.glob)('**/*.md', { cwd: options.agentsDir, absolute: true });
|
|
149
|
+
const candidates = [...docFiles, ...agentFiles];
|
|
150
|
+
const targets = [];
|
|
151
|
+
for (const fullPath of candidates) {
|
|
152
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
153
|
+
const isAgent = fullPath.includes(`${path.sep}agents${path.sep}`);
|
|
154
|
+
const relativePath = path.relative(options.outputDir, fullPath);
|
|
155
|
+
targets.push({ fullPath, relativePath, isAgent, content });
|
|
156
|
+
if (options.limit && targets.length >= options.limit) {
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return targets;
|
|
161
|
+
}
|
|
162
|
+
displayPromptSource(promptPath, source) {
|
|
163
|
+
if (source === 'custom' && promptPath) {
|
|
164
|
+
this.ui.displayInfo(this.t('info.prompt.title'), this.t('info.prompt.usingCustom', { path: this.displayablePath(promptPath) }));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (source === 'package' && promptPath) {
|
|
168
|
+
this.ui.displayInfo(this.t('info.prompt.title'), this.t('info.prompt.usingPackage', { path: this.displayablePath(promptPath) }));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
this.ui.displayInfo(this.t('info.prompt.title'), this.t('info.prompt.usingBundled'));
|
|
172
|
+
}
|
|
173
|
+
displayablePath(promptPath) {
|
|
174
|
+
const relative = path.relative(process.cwd(), promptPath);
|
|
175
|
+
return relative || promptPath;
|
|
176
|
+
}
|
|
177
|
+
async ensureDirectoryExists(dir, message) {
|
|
178
|
+
const exists = await fs.pathExists(dir);
|
|
179
|
+
if (!exists) {
|
|
180
|
+
throw new Error(message);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
buildContextSummary(repoStructure) {
|
|
184
|
+
const directories = new Set();
|
|
185
|
+
repoStructure.directories.forEach(dir => {
|
|
186
|
+
const [first] = dir.relativePath.split(/[\\/]/).filter(Boolean);
|
|
187
|
+
if (first) {
|
|
188
|
+
directories.add(first);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const topDirs = Array.from(directories).sort().slice(0, 12);
|
|
192
|
+
const totalSizeMb = (repoStructure.totalSize / (1024 * 1024)).toFixed(2);
|
|
193
|
+
return [
|
|
194
|
+
`Top-level directories: ${topDirs.length ? topDirs.join(', ') : 'n/a'}`,
|
|
195
|
+
`Total files scanned: ${repoStructure.totalFiles}`,
|
|
196
|
+
`Repository size (approx.): ${totalSizeMb} MB`
|
|
197
|
+
].join('\n');
|
|
198
|
+
}
|
|
199
|
+
buildUserPrompt(relativePath, currentContent, contextSummary, isAgent) {
|
|
200
|
+
const guidance = [
|
|
201
|
+
'- Preserve YAML front matter and existing `agent-update` sections.',
|
|
202
|
+
'- Replace TODOs and resolve `agent-fill` placeholders with concrete information.',
|
|
203
|
+
'- Ensure success criteria in the front matter are satisfied.',
|
|
204
|
+
'- Return only the full updated Markdown for this file.'
|
|
205
|
+
];
|
|
206
|
+
if (isAgent) {
|
|
207
|
+
guidance.push('- Keep agent responsibilities, best practices, and documentation touchpoints aligned with the latest docs.');
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
guidance.push('- Maintain accurate cross-links between docs and referenced resources.');
|
|
211
|
+
}
|
|
212
|
+
return [
|
|
213
|
+
`Target file: ${relativePath}`,
|
|
214
|
+
'Repository summary:',
|
|
215
|
+
contextSummary,
|
|
216
|
+
'',
|
|
217
|
+
'Guidance:',
|
|
218
|
+
...guidance,
|
|
219
|
+
'',
|
|
220
|
+
'Current content:',
|
|
221
|
+
'<file>',
|
|
222
|
+
currentContent,
|
|
223
|
+
'</file>'
|
|
224
|
+
].join('\n');
|
|
225
|
+
}
|
|
226
|
+
printLlmSummary(usage, results) {
|
|
227
|
+
const updated = results.filter(result => result.status === 'updated').length;
|
|
228
|
+
const skipped = results.filter(result => result.status === 'skipped').length;
|
|
229
|
+
const failed = results.filter(result => result.status === 'failed');
|
|
230
|
+
console.log('\n' + chalk_1.default.bold('📄 LLM Fill Summary'));
|
|
231
|
+
console.log(chalk_1.default.gray('─'.repeat(50)));
|
|
232
|
+
console.log(`${chalk_1.default.blue('Updated files:')} ${chalk_1.default.white(updated.toString())}`);
|
|
233
|
+
console.log(`${chalk_1.default.blue('Skipped files:')} ${chalk_1.default.white(skipped.toString())}`);
|
|
234
|
+
console.log(`${chalk_1.default.blue('Failures:')} ${failed.length}`);
|
|
235
|
+
if (usage.totalCalls > 0) {
|
|
236
|
+
console.log(chalk_1.default.gray('─'.repeat(50)));
|
|
237
|
+
console.log(`${chalk_1.default.blue('LLM calls:')} ${usage.totalCalls}`);
|
|
238
|
+
console.log(`${chalk_1.default.blue('Prompt tokens:')} ${usage.totalPromptTokens}`);
|
|
239
|
+
console.log(`${chalk_1.default.blue('Completion tokens:')} ${usage.totalCompletionTokens}`);
|
|
240
|
+
console.log(`${chalk_1.default.blue('Model:')} ${usage.model}`);
|
|
241
|
+
}
|
|
242
|
+
if (failed.length > 0) {
|
|
243
|
+
console.log(chalk_1.default.gray('─'.repeat(50)));
|
|
244
|
+
failed.forEach(item => {
|
|
245
|
+
console.log(`${chalk_1.default.red('✖')} ${chalk_1.default.white(item.file)} — ${chalk_1.default.gray(item.message || 'Unknown error')}`);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
ensureTrailingNewline(content) {
|
|
250
|
+
return content.endsWith('\n') ? content : `${content}\n`;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
exports.FillService = FillService;
|
|
254
|
+
//# sourceMappingURL=fillService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fillService.js","sourceRoot":"","sources":["../../../src/services/fill/fillService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAC/B,kDAA0B;AAC1B,+BAA4B;AAI5B,2DAAiE;AACjE,uDAAoD;AACpD,0DAAuD;AAGvD,mDAAuD;AA+CvD,MAAa,WAAW;IAQtB,YAAY,YAAqC;QAC/C,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC;QAC1B,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;QACxB,IAAI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AAC,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACxC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACpB,OAAO,CAAC,GAAG,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC;YAC9G,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEO,qBAAqB,CAAC,OAAe;QAC3C,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC;IAC3D,CAAC;CACF;AA5QD,kCA4QC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FileMapper } from '../../utils/fileMapper';
|
|
2
|
+
import { DocumentationGenerator } from '../../generators/documentation/documentationGenerator';
|
|
3
|
+
import { AgentGenerator } from '../../generators/agents/agentGenerator';
|
|
4
|
+
import type { CLIInterface } from '../../utils/cliUI';
|
|
5
|
+
import type { TranslateFn } from '../../utils/i18n';
|
|
6
|
+
export interface InitCommandFlags {
|
|
7
|
+
output?: string;
|
|
8
|
+
include?: string[];
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
docsOnly?: boolean;
|
|
12
|
+
agentsOnly?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface InitServiceDependencies {
|
|
15
|
+
ui: CLIInterface;
|
|
16
|
+
t: TranslateFn;
|
|
17
|
+
version: string;
|
|
18
|
+
documentationGenerator?: DocumentationGenerator;
|
|
19
|
+
agentGenerator?: AgentGenerator;
|
|
20
|
+
fileMapperFactory?: (exclude: string[] | undefined) => FileMapper;
|
|
21
|
+
}
|
|
22
|
+
export declare class InitService {
|
|
23
|
+
private readonly ui;
|
|
24
|
+
private readonly t;
|
|
25
|
+
private readonly version;
|
|
26
|
+
private readonly documentationGenerator;
|
|
27
|
+
private readonly agentGenerator;
|
|
28
|
+
private readonly fileMapperFactory;
|
|
29
|
+
constructor(dependencies: InitServiceDependencies);
|
|
30
|
+
run(repoPath: string, type: string, rawOptions: InitCommandFlags): Promise<void>;
|
|
31
|
+
private confirmOverwriteIfNeeded;
|
|
32
|
+
private directoryHasContent;
|
|
33
|
+
private generateScaffolds;
|
|
34
|
+
private ensurePaths;
|
|
35
|
+
}
|
|
36
|
+
export declare function resolveScaffoldType(type: string, rawOptions: InitCommandFlags, t: TranslateFn): 'docs' | 'agents' | 'both';
|
|
37
|
+
//# sourceMappingURL=initService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initService.d.ts","sourceRoot":"","sources":["../../../src/services/init/initService.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAGpE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,YAAY,CAAC;IACjB,CAAC,EAAE,WAAW,CAAC;IACf,OAAO,EAAE,MAA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