@shepai/cli 1.151.2-pr438.6135e39 → 1.151.2-pr468.4830e01
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/apis/json-schema/AgentType.yaml +1 -0
- package/apis/json-schema/WorkflowConfig.yaml +0 -5
- package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts +0 -28
- package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/services/github-repository-service.interface.d.ts +0 -37
- package/dist/packages/core/src/application/ports/output/services/github-repository-service.interface.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/services/github-repository-service.interface.js +0 -12
- package/dist/packages/core/src/application/ports/output/services/index.d.ts +3 -5
- package/dist/packages/core/src/application/ports/output/services/index.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/services/index.js +1 -2
- package/dist/packages/core/src/domain/generated/output.d.ts +1 -185
- package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
- package/dist/packages/core/src/domain/generated/output.js +1 -0
- package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/di/container.js +4 -4
- package/dist/packages/core/src/infrastructure/services/agents/common/agent-executor-factory.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/common/agent-executor-factory.service.js +22 -0
- package/dist/packages/core/src/infrastructure/services/agents/common/agent-validator.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/common/agent-validator.service.js +1 -0
- package/dist/packages/core/src/infrastructure/services/agents/common/executors/codex-cli-executor.service.d.ts +61 -0
- package/dist/packages/core/src/infrastructure/services/agents/common/executors/codex-cli-executor.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/agents/common/executors/codex-cli-executor.service.js +628 -0
- package/dist/packages/core/src/infrastructure/services/agents/sessions/codex-cli-session.repository.d.ts +62 -0
- package/dist/packages/core/src/infrastructure/services/agents/sessions/codex-cli-session.repository.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/agents/sessions/codex-cli-session.repository.js +356 -0
- package/dist/packages/core/src/infrastructure/services/external/github-repository.service.d.ts +1 -3
- package/dist/packages/core/src/infrastructure/services/external/github-repository.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/external/github-repository.service.js +1 -37
- package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts +1 -2
- package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +0 -21
- package/dist/src/presentation/cli/index.js +0 -2
- package/dist/src/presentation/tui/prompts/agent-select.prompt.d.ts +6 -2
- package/dist/src/presentation/tui/prompts/agent-select.prompt.d.ts.map +1 -1
- package/dist/src/presentation/tui/prompts/agent-select.prompt.js +7 -2
- package/dist/src/presentation/web/app/actions/get-all-agent-models.d.ts.map +1 -1
- package/dist/src/presentation/web/app/actions/get-all-agent-models.js +4 -2
- package/dist/src/presentation/web/components/common/feature-node/agent-type-icons.d.ts +1 -1
- package/dist/src/presentation/web/components/common/feature-node/agent-type-icons.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/agent-type-icons.js +2 -0
- package/dist/src/presentation/web/components/common/feature-node/agent-type-icons.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/agent-type-icons.stories.js +1 -0
- package/dist/src/presentation/web/components/features/settings/AgentModelPicker/AgentModelPicker.stories.d.ts +1 -0
- package/dist/src/presentation/web/components/features/settings/AgentModelPicker/AgentModelPicker.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/settings/AgentModelPicker/AgentModelPicker.stories.js +7 -0
- package/dist/src/presentation/web/components/features/settings/agent-settings-section.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/settings/agent-settings-section.js +1 -0
- package/dist/src/presentation/web/components/features/settings/agent-settings-section.stories.d.ts +1 -0
- package/dist/src/presentation/web/components/features/settings/agent-settings-section.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/settings/agent-settings-section.stories.js +8 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +1 -1
- package/web/.next/required-server-files.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +29 -29
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +29 -29
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
- package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
- package/web/.next/server/app/api/graph-data/route.js.nft.json +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__c6e32a23._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__c6e32a23._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0b150ddf._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2138fa7e._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2138fa7e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3ef34e4c._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3ef34e4c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0c473fef._.js +2 -2
- package/web/.next/server/chunks/ssr/_0c473fef._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_4093a637._.js +1 -1
- package/web/.next/server/chunks/ssr/_4093a637._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_8fcc39d4._.js +1 -1
- package/web/.next/server/chunks/ssr/{_c2ca0f1b._.js → _b47f40e8._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_c2ca0f1b._.js.map → _b47f40e8._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d4b20e29._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_dc9a9d32._.js → _dd815000._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_dc9a9d32._.js.map → _dd815000._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_e9e9ed20._.js +2 -2
- package/web/.next/server/chunks/ssr/_e9e9ed20._.js.map +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{src_presentation_web_aa941041._.js → src_presentation_web_4f99488d._.js} +2 -2
- package/web/.next/server/chunks/ssr/{src_presentation_web_aa941041._.js.map → src_presentation_web_4f99488d._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +45 -45
- package/web/.next/static/chunks/{87b72b8a10f8255b.js → 2ef0f4ca4e98c9a7.js} +2 -2
- package/web/.next/static/chunks/{359b2815c5ed39cc.js → 3a7945f19b79b23f.js} +1 -1
- package/web/.next/static/chunks/{4a28fd1bca225386.js → 4e0a2f0a76498c81.js} +1 -1
- package/web/.next/static/chunks/{80915095cec414bf.js → 5942cf630e48ca8d.js} +1 -1
- package/web/.next/static/chunks/{5e1877d1f1bcfd77.js → 6a5afc469cf09a04.js} +1 -1
- package/web/.next/static/chunks/{76a3f345f8cf2608.js → 866b1f54b7f49d15.js} +1 -1
- package/web/.next/static/chunks/89b3762438e133be.js +1 -0
- package/web/.next/static/chunks/{25889ca8401d1bc0.js → 956b17e72f758911.js} +1 -1
- package/web/.next/static/chunks/{79eae02d0342fb73.js → 98126d854a888c69.js} +1 -1
- package/web/.next/static/chunks/{c2388f8bc58b2a21.js → a7d8b0dda225c732.js} +1 -1
- package/web/.next/static/chunks/{08baac5434d9528e.js → ae411737fa84a470.js} +7 -7
- package/web/.next/static/chunks/{091de81012e2bc48.js → be299036f3de6864.js} +1 -1
- package/web/.next/static/chunks/{ed9408f100149c34.js → ca8a36bfe8400d5d.js} +1 -1
- package/web/public/icons/agents/openai.svg +3 -0
- package/apis/json-schema/AgentRunDetail.yaml +0 -28
- package/apis/json-schema/DoctorDiagnosticReport.yaml +0 -76
- package/apis/json-schema/FailedRunSummary.yaml +0 -22
- package/apis/json-schema/SystemInfo.yaml +0 -22
- package/apis/json-schema/WorkerLogEntry.yaml +0 -27
- package/dist/packages/core/src/application/ports/output/services/github-issue-service.interface.d.ts +0 -57
- package/dist/packages/core/src/application/ports/output/services/github-issue-service.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/github-issue-service.interface.js +0 -39
- package/dist/packages/core/src/application/use-cases/doctor/doctor-diagnose.use-case.d.ts +0 -64
- package/dist/packages/core/src/application/use-cases/doctor/doctor-diagnose.use-case.d.ts.map +0 -1
- package/dist/packages/core/src/application/use-cases/doctor/doctor-diagnose.use-case.js +0 -493
- package/dist/packages/core/src/infrastructure/services/external/github-issue-creator.service.d.ts +0 -17
- package/dist/packages/core/src/infrastructure/services/external/github-issue-creator.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/external/github-issue-creator.service.js +0 -69
- package/dist/src/presentation/cli/commands/doctor.command.d.ts +0 -20
- package/dist/src/presentation/cli/commands/doctor.command.d.ts.map +0 -1
- package/dist/src/presentation/cli/commands/doctor.command.js +0 -129
- package/web/.next/static/chunks/e760b952ba1a10d4.js +0 -1
- /package/web/.next/static/{-o7QIcv1p5C722dwF4EFd → MUDs2V0kbD3BsECyukWE4}/_buildManifest.js +0 -0
- /package/web/.next/static/{-o7QIcv1p5C722dwF4EFd → MUDs2V0kbD3BsECyukWE4}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{-o7QIcv1p5C722dwF4EFd → MUDs2V0kbD3BsECyukWE4}/_ssgManifest.js +0 -0
|
@@ -1,493 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Doctor Diagnose Use Case
|
|
3
|
-
*
|
|
4
|
-
* Orchestrates the shep doctor workflow:
|
|
5
|
-
* 1. Collect diagnostic context (failed agent runs, version, system info)
|
|
6
|
-
* 2. Create a structured GitHub issue on shep-ai/cli
|
|
7
|
-
* 3. Optionally attempt a fix via AI agent
|
|
8
|
-
* 4. Open a PR with the fix (direct push for maintainers, fork for contributors)
|
|
9
|
-
*
|
|
10
|
-
* Following Clean Architecture: all external operations are injected via interfaces.
|
|
11
|
-
*/
|
|
12
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
13
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
16
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17
|
-
};
|
|
18
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
20
|
-
};
|
|
21
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
22
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
23
|
-
};
|
|
24
|
-
import { injectable, inject } from 'tsyringe';
|
|
25
|
-
import { randomUUID } from 'node:crypto';
|
|
26
|
-
import { tmpdir, homedir } from 'node:os';
|
|
27
|
-
import { mkdir, rm, readFile } from 'node:fs/promises';
|
|
28
|
-
import path from 'node:path';
|
|
29
|
-
import { AgentRunStatus } from '../../../domain/generated/output.js';
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
|
-
// Constants
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
const SHEP_REPO = 'shep-ai/cli';
|
|
34
|
-
const MAX_FAILED_RUNS = 10;
|
|
35
|
-
const ISSUE_LABELS = ['bug', 'shep-doctor'];
|
|
36
|
-
const MAX_AGENT_RUN_DETAILS = 10;
|
|
37
|
-
const MAX_WORKER_LOG_CHARS = 50_000;
|
|
38
|
-
const MAX_PROMPT_CHARS = 10_000;
|
|
39
|
-
const MAX_RESULT_CHARS = 10_000;
|
|
40
|
-
const MAX_CONVERSATION_CHARS = 20_000;
|
|
41
|
-
const MAX_PLAN_CHARS = 20_000;
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
|
-
// Use Case
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
let DoctorDiagnoseUseCase = class DoctorDiagnoseUseCase {
|
|
46
|
-
agentRunRepo;
|
|
47
|
-
versionService;
|
|
48
|
-
issueService;
|
|
49
|
-
repoService;
|
|
50
|
-
prService;
|
|
51
|
-
agentExecutorProvider;
|
|
52
|
-
execFile;
|
|
53
|
-
featureRepo;
|
|
54
|
-
phaseTimingRepo;
|
|
55
|
-
constructor(agentRunRepo, versionService, issueService, repoService, prService, agentExecutorProvider, execFile, featureRepo, phaseTimingRepo) {
|
|
56
|
-
this.agentRunRepo = agentRunRepo;
|
|
57
|
-
this.versionService = versionService;
|
|
58
|
-
this.issueService = issueService;
|
|
59
|
-
this.repoService = repoService;
|
|
60
|
-
this.prService = prService;
|
|
61
|
-
this.agentExecutorProvider = agentExecutorProvider;
|
|
62
|
-
this.execFile = execFile;
|
|
63
|
-
this.featureRepo = featureRepo;
|
|
64
|
-
this.phaseTimingRepo = phaseTimingRepo;
|
|
65
|
-
}
|
|
66
|
-
async execute(input) {
|
|
67
|
-
// Step 1: Collect diagnostics
|
|
68
|
-
const diagnosticReport = await this.collectDiagnostics(input.description, input.featureId);
|
|
69
|
-
// Step 2: Create GitHub issue
|
|
70
|
-
const issueTitle = this.formatIssueTitle(input.description);
|
|
71
|
-
const issueBody = this.formatIssueBody(diagnosticReport);
|
|
72
|
-
const { url: issueUrl, number: issueNumber } = await this.issueService.createIssue(SHEP_REPO, issueTitle, issueBody, ISSUE_LABELS);
|
|
73
|
-
// Step 3: If no fix requested, return early
|
|
74
|
-
if (!input.fix) {
|
|
75
|
-
return {
|
|
76
|
-
diagnosticReport,
|
|
77
|
-
issueUrl,
|
|
78
|
-
issueNumber,
|
|
79
|
-
cleanedUp: false,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
// Step 4: Attempt fix
|
|
83
|
-
return this.attemptFix(input, diagnosticReport, issueUrl, issueNumber);
|
|
84
|
-
}
|
|
85
|
-
// -------------------------------------------------------------------------
|
|
86
|
-
// Diagnostic Collection (Task 10)
|
|
87
|
-
// -------------------------------------------------------------------------
|
|
88
|
-
async collectDiagnostics(userDescription, featureId) {
|
|
89
|
-
let resolvedFeatureId;
|
|
90
|
-
let featureName;
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
-
let feature;
|
|
93
|
-
if (featureId) {
|
|
94
|
-
feature =
|
|
95
|
-
(await this.featureRepo.findById(featureId)) ??
|
|
96
|
-
(await this.featureRepo.findByIdPrefix(featureId));
|
|
97
|
-
if (feature) {
|
|
98
|
-
resolvedFeatureId = feature.id;
|
|
99
|
-
featureName = feature.name;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// Fetch all runs once — used for both failed summaries and enrichment
|
|
103
|
-
const allRuns = await this.agentRunRepo.list();
|
|
104
|
-
const [failedRunSummaries, systemInfo, cliVersion] = await Promise.all([
|
|
105
|
-
Promise.resolve(this.filterFailedRuns(allRuns, resolvedFeatureId)),
|
|
106
|
-
this.collectSystemInfo(),
|
|
107
|
-
Promise.resolve(this.versionService.getVersion().version),
|
|
108
|
-
]);
|
|
109
|
-
const report = {
|
|
110
|
-
userDescription,
|
|
111
|
-
failedRunSummaries,
|
|
112
|
-
systemInfo,
|
|
113
|
-
cliVersion,
|
|
114
|
-
featureId: resolvedFeatureId,
|
|
115
|
-
featureName,
|
|
116
|
-
};
|
|
117
|
-
// Enrich with feature-scoped data when a feature is resolved
|
|
118
|
-
if (feature) {
|
|
119
|
-
report.featureLifecycle = feature.lifecycle;
|
|
120
|
-
report.featureBranch = feature.branch;
|
|
121
|
-
report.featureDescription = feature.description;
|
|
122
|
-
report.featureWorkflowConfig = JSON.stringify({
|
|
123
|
-
fast: feature.fast,
|
|
124
|
-
push: feature.push,
|
|
125
|
-
openPr: feature.openPr,
|
|
126
|
-
approvalGates: feature.approvalGates,
|
|
127
|
-
});
|
|
128
|
-
if (feature.messages?.length) {
|
|
129
|
-
const serialized = JSON.stringify(feature.messages);
|
|
130
|
-
report.conversationMessages = this.truncate(serialized, MAX_CONVERSATION_CHARS).text;
|
|
131
|
-
}
|
|
132
|
-
if (feature.plan) {
|
|
133
|
-
const serialized = JSON.stringify(feature.plan);
|
|
134
|
-
report.featurePlan = this.truncate(serialized, MAX_PLAN_CHARS).text;
|
|
135
|
-
}
|
|
136
|
-
// Parallel async enrichments
|
|
137
|
-
const featureRuns = allRuns.filter((r) => r.featureId === resolvedFeatureId);
|
|
138
|
-
const [specYamls, workerLogs, phaseTimings] = await Promise.all([
|
|
139
|
-
this.collectSpecYamls(feature.specPath),
|
|
140
|
-
this.collectWorkerLogs(featureRuns),
|
|
141
|
-
this.collectPhaseTimings(resolvedFeatureId),
|
|
142
|
-
]);
|
|
143
|
-
Object.assign(report, specYamls);
|
|
144
|
-
report.workerLogs = workerLogs.length > 0 ? workerLogs : undefined;
|
|
145
|
-
report.phaseTimings = phaseTimings;
|
|
146
|
-
report.agentRunDetails = this.buildAgentRunDetails(featureRuns);
|
|
147
|
-
}
|
|
148
|
-
return report;
|
|
149
|
-
}
|
|
150
|
-
filterFailedRuns(allRuns, featureId) {
|
|
151
|
-
let filtered = allRuns.filter((run) => run.status === AgentRunStatus.failed);
|
|
152
|
-
if (featureId) {
|
|
153
|
-
filtered = filtered.filter((run) => run.featureId === featureId);
|
|
154
|
-
}
|
|
155
|
-
return filtered.slice(0, MAX_FAILED_RUNS).map((run) => this.sanitizeRunSummary(run));
|
|
156
|
-
}
|
|
157
|
-
sanitizeRunSummary(run) {
|
|
158
|
-
return {
|
|
159
|
-
agentType: run.agentType,
|
|
160
|
-
agentName: run.agentName,
|
|
161
|
-
error: run.error ?? 'Unknown error',
|
|
162
|
-
timestamp: run.createdAt instanceof Date ? run.createdAt.toISOString() : String(run.createdAt),
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
async collectSystemInfo() {
|
|
166
|
-
let ghVersion = 'unknown';
|
|
167
|
-
try {
|
|
168
|
-
const { stdout } = await this.execFile('gh', ['--version']);
|
|
169
|
-
ghVersion = stdout.trim();
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
// gh not installed or not available — use fallback
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
nodeVersion: process.version,
|
|
176
|
-
platform: process.platform,
|
|
177
|
-
arch: process.arch,
|
|
178
|
-
ghVersion,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
// -------------------------------------------------------------------------
|
|
182
|
-
// Enrichment helpers
|
|
183
|
-
// -------------------------------------------------------------------------
|
|
184
|
-
truncate(content, maxChars) {
|
|
185
|
-
if (content.length <= maxChars) {
|
|
186
|
-
return { text: content, truncated: false };
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
text: `${content.slice(0, maxChars)}\n... [truncated, ${content.length} chars total]`,
|
|
190
|
-
truncated: true,
|
|
191
|
-
originalLength: content.length,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
async collectSpecYamls(specPath) {
|
|
195
|
-
if (!specPath)
|
|
196
|
-
return {};
|
|
197
|
-
const files = [
|
|
198
|
-
'spec.yaml',
|
|
199
|
-
'research.yaml',
|
|
200
|
-
'plan.yaml',
|
|
201
|
-
'tasks.yaml',
|
|
202
|
-
'feature.yaml',
|
|
203
|
-
];
|
|
204
|
-
const keys = [
|
|
205
|
-
'specYaml',
|
|
206
|
-
'researchYaml',
|
|
207
|
-
'planYaml',
|
|
208
|
-
'tasksYaml',
|
|
209
|
-
'featureStatusYaml',
|
|
210
|
-
];
|
|
211
|
-
const results = {};
|
|
212
|
-
const reads = await Promise.all(files.map((f) => this.readFileSafe(path.join(specPath, f))));
|
|
213
|
-
for (let i = 0; i < files.length; i++) {
|
|
214
|
-
if (reads[i]) {
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
|
-
results[keys[i]] = reads[i];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return results;
|
|
220
|
-
}
|
|
221
|
-
async collectWorkerLogs(featureRuns) {
|
|
222
|
-
const logDir = path.join(homedir(), '.shep', 'logs');
|
|
223
|
-
const entries = [];
|
|
224
|
-
for (const run of featureRuns) {
|
|
225
|
-
const logPath = path.join(logDir, `worker-${run.id}.log`);
|
|
226
|
-
const content = await this.readFileSafe(logPath);
|
|
227
|
-
if (content) {
|
|
228
|
-
const { text, truncated, originalLength } = this.truncate(content, MAX_WORKER_LOG_CHARS);
|
|
229
|
-
entries.push({
|
|
230
|
-
agentRunId: run.id,
|
|
231
|
-
agentName: run.agentName,
|
|
232
|
-
content: text,
|
|
233
|
-
truncated,
|
|
234
|
-
originalLength,
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return entries;
|
|
239
|
-
}
|
|
240
|
-
async collectPhaseTimings(featureId) {
|
|
241
|
-
try {
|
|
242
|
-
const timings = await this.phaseTimingRepo.findByFeatureId(featureId);
|
|
243
|
-
return timings.length > 0 ? JSON.stringify(timings) : undefined;
|
|
244
|
-
}
|
|
245
|
-
catch {
|
|
246
|
-
return undefined;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
buildAgentRunDetails(featureRuns) {
|
|
250
|
-
if (featureRuns.length === 0)
|
|
251
|
-
return undefined;
|
|
252
|
-
return featureRuns.slice(0, MAX_AGENT_RUN_DETAILS).map((run) => ({
|
|
253
|
-
agentType: run.agentType,
|
|
254
|
-
agentName: run.agentName,
|
|
255
|
-
prompt: this.truncate(run.prompt, MAX_PROMPT_CHARS).text,
|
|
256
|
-
result: run.result ? this.truncate(run.result, MAX_RESULT_CHARS).text : undefined,
|
|
257
|
-
error: run.error ?? undefined,
|
|
258
|
-
timestamp: run.createdAt instanceof Date ? run.createdAt.toISOString() : String(run.createdAt),
|
|
259
|
-
}));
|
|
260
|
-
}
|
|
261
|
-
async readFileSafe(filePath) {
|
|
262
|
-
try {
|
|
263
|
-
return await readFile(filePath, 'utf-8');
|
|
264
|
-
}
|
|
265
|
-
catch {
|
|
266
|
-
return undefined;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
// -------------------------------------------------------------------------
|
|
270
|
-
// Issue Formatting (Task 11)
|
|
271
|
-
// -------------------------------------------------------------------------
|
|
272
|
-
formatIssueTitle(description) {
|
|
273
|
-
const firstLine = description.split('\n')[0].trim();
|
|
274
|
-
const truncated = firstLine.length > 60 ? `${firstLine.slice(0, 60)}...` : firstLine;
|
|
275
|
-
return `[shep doctor] ${truncated}`;
|
|
276
|
-
}
|
|
277
|
-
formatIssueBody(report) {
|
|
278
|
-
const sections = [];
|
|
279
|
-
sections.push('## Problem Description\n');
|
|
280
|
-
sections.push(report.userDescription);
|
|
281
|
-
if (report.featureId) {
|
|
282
|
-
sections.push('\n## Feature Context\n');
|
|
283
|
-
sections.push(`- **Feature ID:** ${report.featureId}`);
|
|
284
|
-
if (report.featureName)
|
|
285
|
-
sections.push(`- **Feature Name:** ${report.featureName}`);
|
|
286
|
-
if (report.featureLifecycle)
|
|
287
|
-
sections.push(`- **Lifecycle:** ${report.featureLifecycle}`);
|
|
288
|
-
if (report.featureBranch)
|
|
289
|
-
sections.push(`- **Branch:** ${report.featureBranch}`);
|
|
290
|
-
if (report.featureDescription)
|
|
291
|
-
sections.push(`- **Description:** ${report.featureDescription}`);
|
|
292
|
-
if (report.featureWorkflowConfig)
|
|
293
|
-
sections.push(`- **Workflow Config:** ${report.featureWorkflowConfig}`);
|
|
294
|
-
}
|
|
295
|
-
sections.push('\n## Environment\n');
|
|
296
|
-
sections.push(`- **shep CLI version:** ${report.cliVersion}`);
|
|
297
|
-
sections.push(`- **Node.js:** ${report.systemInfo.nodeVersion}`);
|
|
298
|
-
sections.push(`- **Platform:** ${report.systemInfo.platform} (${report.systemInfo.arch})`);
|
|
299
|
-
sections.push(`- **gh CLI:** ${report.systemInfo.ghVersion}`);
|
|
300
|
-
if (report.failedRunSummaries.length > 0) {
|
|
301
|
-
const heading = report.featureId
|
|
302
|
-
? '\n## Failed Agent Runs (feature-scoped)\n'
|
|
303
|
-
: '\n## Recent Failed Agent Runs\n';
|
|
304
|
-
sections.push(heading);
|
|
305
|
-
for (const run of report.failedRunSummaries) {
|
|
306
|
-
sections.push(`### ${run.agentName} (${run.agentType})`);
|
|
307
|
-
sections.push(`- **Error:** ${run.error}`);
|
|
308
|
-
sections.push(`- **Timestamp:** ${run.timestamp}`);
|
|
309
|
-
sections.push('');
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
if (report.agentRunDetails?.length) {
|
|
313
|
-
sections.push('\n## Agent Run Details\n');
|
|
314
|
-
for (const detail of report.agentRunDetails) {
|
|
315
|
-
sections.push(`<details><summary>Agent: ${detail.agentName} (${detail.agentType})</summary>\n`);
|
|
316
|
-
sections.push(`### Prompt\n\`\`\`\n${detail.prompt}\n\`\`\`\n`);
|
|
317
|
-
if (detail.result) {
|
|
318
|
-
sections.push(`### Result\n\`\`\`\n${detail.result}\n\`\`\`\n`);
|
|
319
|
-
}
|
|
320
|
-
if (detail.error) {
|
|
321
|
-
sections.push(`### Error\n\`\`\`\n${detail.error}\n\`\`\`\n`);
|
|
322
|
-
}
|
|
323
|
-
sections.push('</details>\n');
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if (report.conversationMessages) {
|
|
327
|
-
const msgCount = (report.conversationMessages.match(/"id"/g) ?? []).length;
|
|
328
|
-
sections.push('\n## Conversation History\n');
|
|
329
|
-
sections.push(`<details><summary>Messages (${msgCount} messages)</summary>\n`);
|
|
330
|
-
sections.push(`\`\`\`json\n${report.conversationMessages}\n\`\`\`\n`);
|
|
331
|
-
sections.push('</details>\n');
|
|
332
|
-
}
|
|
333
|
-
if (report.featurePlan) {
|
|
334
|
-
sections.push('\n## Feature Plan\n');
|
|
335
|
-
sections.push('<details><summary>Plan & Tasks</summary>\n');
|
|
336
|
-
sections.push(`\`\`\`json\n${report.featurePlan}\n\`\`\`\n`);
|
|
337
|
-
sections.push('</details>\n');
|
|
338
|
-
}
|
|
339
|
-
// Spec files
|
|
340
|
-
const specEntries = [
|
|
341
|
-
['spec.yaml', report.specYaml],
|
|
342
|
-
['research.yaml', report.researchYaml],
|
|
343
|
-
['plan.yaml', report.planYaml],
|
|
344
|
-
['tasks.yaml', report.tasksYaml],
|
|
345
|
-
['feature.yaml', report.featureStatusYaml],
|
|
346
|
-
];
|
|
347
|
-
const hasSpecs = specEntries.some(([, v]) => v);
|
|
348
|
-
if (hasSpecs) {
|
|
349
|
-
sections.push('\n## Spec Files\n');
|
|
350
|
-
for (const [name, content] of specEntries) {
|
|
351
|
-
if (content) {
|
|
352
|
-
sections.push(`<details><summary>${name}</summary>\n`);
|
|
353
|
-
sections.push(`\`\`\`yaml\n${content}\n\`\`\`\n`);
|
|
354
|
-
sections.push('</details>\n');
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (report.workerLogs?.length) {
|
|
359
|
-
sections.push('\n## Worker Logs\n');
|
|
360
|
-
for (const log of report.workerLogs) {
|
|
361
|
-
const suffix = log.truncated ? ` (truncated, ${log.originalLength} chars total)` : '';
|
|
362
|
-
sections.push(`<details><summary>Worker log: ${log.agentName} (${log.agentRunId})${suffix}</summary>\n`);
|
|
363
|
-
sections.push(`\`\`\`\n${log.content}\n\`\`\`\n`);
|
|
364
|
-
sections.push('</details>\n');
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
if (report.phaseTimings) {
|
|
368
|
-
sections.push('\n## Phase Timings\n');
|
|
369
|
-
sections.push('<details><summary>Phase timing data</summary>\n');
|
|
370
|
-
sections.push(`\`\`\`json\n${report.phaseTimings}\n\`\`\`\n`);
|
|
371
|
-
sections.push('</details>\n');
|
|
372
|
-
}
|
|
373
|
-
sections.push('\n---\n');
|
|
374
|
-
sections.push('_Reported via `shep doctor`_');
|
|
375
|
-
return sections.join('\n');
|
|
376
|
-
}
|
|
377
|
-
// -------------------------------------------------------------------------
|
|
378
|
-
// Fix Workflow (Task 11)
|
|
379
|
-
// -------------------------------------------------------------------------
|
|
380
|
-
async attemptFix(input, diagnosticReport, issueUrl, issueNumber) {
|
|
381
|
-
const isUserWorkdir = !!input.workdir;
|
|
382
|
-
const workdir = input.workdir ?? path.join(tmpdir(), `shep-doctor-${randomUUID()}`);
|
|
383
|
-
// Use a mutable result object so finally block can update cleanedUp
|
|
384
|
-
const result = {
|
|
385
|
-
diagnosticReport,
|
|
386
|
-
issueUrl,
|
|
387
|
-
issueNumber,
|
|
388
|
-
cleanedUp: false,
|
|
389
|
-
};
|
|
390
|
-
try {
|
|
391
|
-
// Ensure working directory exists
|
|
392
|
-
await mkdir(workdir, { recursive: true });
|
|
393
|
-
// Check push access (fall back to contributor flow on error)
|
|
394
|
-
let hasPushAccess = false;
|
|
395
|
-
try {
|
|
396
|
-
hasPushAccess = await this.repoService.checkPushAccess(SHEP_REPO);
|
|
397
|
-
}
|
|
398
|
-
catch {
|
|
399
|
-
// NFR-9: fall back to fork path on any detection failure
|
|
400
|
-
}
|
|
401
|
-
const flowType = hasPushAccess ? 'maintainer' : 'contributor';
|
|
402
|
-
result.flowType = flowType;
|
|
403
|
-
// Clone repository (direct or via fork)
|
|
404
|
-
let repoToClone = SHEP_REPO;
|
|
405
|
-
if (flowType === 'contributor') {
|
|
406
|
-
const { nameWithOwner } = await this.repoService.forkRepository(SHEP_REPO);
|
|
407
|
-
repoToClone = nameWithOwner;
|
|
408
|
-
}
|
|
409
|
-
await this.repoService.cloneRepository(repoToClone, workdir, undefined);
|
|
410
|
-
// Create fix branch
|
|
411
|
-
const branchName = `doctor/fix-${issueNumber}`;
|
|
412
|
-
await this.execFile('git', ['checkout', '-b', branchName], {
|
|
413
|
-
cwd: workdir,
|
|
414
|
-
});
|
|
415
|
-
// Invoke AI agent
|
|
416
|
-
try {
|
|
417
|
-
const executor = await this.agentExecutorProvider.getExecutor();
|
|
418
|
-
const prompt = this.buildFixPrompt(diagnosticReport, issueNumber);
|
|
419
|
-
await executor.execute(prompt, { cwd: workdir });
|
|
420
|
-
}
|
|
421
|
-
catch (agentError) {
|
|
422
|
-
result.error = `Fix attempt failed: ${agentError.message}`;
|
|
423
|
-
return result;
|
|
424
|
-
}
|
|
425
|
-
// Check if agent produced changes
|
|
426
|
-
const hasChanges = await this.prService.hasUncommittedChanges(workdir);
|
|
427
|
-
if (!hasChanges) {
|
|
428
|
-
result.error = 'Fix attempt produced no changes';
|
|
429
|
-
return result;
|
|
430
|
-
}
|
|
431
|
-
// Commit, push, and create PR
|
|
432
|
-
await this.prService.commitAll(workdir, `fix: address issue #${issueNumber} reported via shep doctor`);
|
|
433
|
-
await this.prService.push(workdir, branchName, true);
|
|
434
|
-
const prResult = await this.prService.createPrFromArgs(workdir, {
|
|
435
|
-
title: `fix: address shep doctor issue #${issueNumber}`,
|
|
436
|
-
body: `## Summary\n\nAutomated fix attempt for #${issueNumber}.\n\nThis PR was created by \`shep doctor\` after diagnosing a reported issue.\n\nRelates to #${issueNumber}`,
|
|
437
|
-
labels: ['shep-doctor'],
|
|
438
|
-
base: 'main',
|
|
439
|
-
repo: flowType === 'contributor' ? SHEP_REPO : undefined,
|
|
440
|
-
});
|
|
441
|
-
result.prUrl = prResult.url;
|
|
442
|
-
return result;
|
|
443
|
-
}
|
|
444
|
-
finally {
|
|
445
|
-
// Cleanup temp directory (unless user specified --workdir)
|
|
446
|
-
if (!isUserWorkdir) {
|
|
447
|
-
try {
|
|
448
|
-
await rm(workdir, { recursive: true, force: true });
|
|
449
|
-
result.cleanedUp = true;
|
|
450
|
-
}
|
|
451
|
-
catch {
|
|
452
|
-
// Best-effort cleanup
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
buildFixPrompt(report, issueNumber) {
|
|
458
|
-
const lines = [];
|
|
459
|
-
lines.push(`You are fixing issue #${issueNumber} in the shep-ai/cli codebase.`);
|
|
460
|
-
lines.push('');
|
|
461
|
-
lines.push('## Problem Description');
|
|
462
|
-
lines.push(report.userDescription);
|
|
463
|
-
lines.push('');
|
|
464
|
-
if (report.failedRunSummaries.length > 0) {
|
|
465
|
-
lines.push('## Error Context');
|
|
466
|
-
for (const run of report.failedRunSummaries) {
|
|
467
|
-
lines.push(`- Agent: ${run.agentName} (${run.agentType})`);
|
|
468
|
-
lines.push(` Error: ${run.error}`);
|
|
469
|
-
}
|
|
470
|
-
lines.push('');
|
|
471
|
-
}
|
|
472
|
-
lines.push('## Instructions');
|
|
473
|
-
lines.push('1. Analyze the codebase to identify the root cause');
|
|
474
|
-
lines.push('2. Implement a fix for the identified issue');
|
|
475
|
-
lines.push('3. Run tests to verify the fix works');
|
|
476
|
-
lines.push('4. Keep changes minimal and focused');
|
|
477
|
-
return lines.join('\n');
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
DoctorDiagnoseUseCase = __decorate([
|
|
481
|
-
injectable(),
|
|
482
|
-
__param(0, inject('IAgentRunRepository')),
|
|
483
|
-
__param(1, inject('IVersionService')),
|
|
484
|
-
__param(2, inject('IGitHubIssueService')),
|
|
485
|
-
__param(3, inject('IGitHubRepositoryService')),
|
|
486
|
-
__param(4, inject('IGitPrService')),
|
|
487
|
-
__param(5, inject('IAgentExecutorProvider')),
|
|
488
|
-
__param(6, inject('ExecFunction')),
|
|
489
|
-
__param(7, inject('IFeatureRepository')),
|
|
490
|
-
__param(8, inject('IPhaseTimingRepository')),
|
|
491
|
-
__metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object, Function, Object, Object])
|
|
492
|
-
], DoctorDiagnoseUseCase);
|
|
493
|
-
export { DoctorDiagnoseUseCase };
|
package/dist/packages/core/src/infrastructure/services/external/github-issue-creator.service.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub Issue Creator Service Implementation
|
|
3
|
-
*
|
|
4
|
-
* Implements IGitHubIssueService using the gh CLI for creating issues
|
|
5
|
-
* on GitHub repositories. Wraps `gh issue create` with structured
|
|
6
|
-
* error handling and result parsing.
|
|
7
|
-
*/
|
|
8
|
-
import type { ExecFunction } from '../git/worktree.service.js';
|
|
9
|
-
import type { IGitHubIssueService, GitHubIssueCreateResult } from '../../../application/ports/output/services/github-issue-service.interface.js';
|
|
10
|
-
export declare class GitHubIssueCreatorService implements IGitHubIssueService {
|
|
11
|
-
private readonly execFile;
|
|
12
|
-
constructor(execFile: ExecFunction);
|
|
13
|
-
createIssue(repo: string, title: string, body: string, labels: string[]): Promise<GitHubIssueCreateResult>;
|
|
14
|
-
private parseIssueNumberFromUrl;
|
|
15
|
-
private mapError;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=github-issue-creator.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-issue-creator.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/external/github-issue-creator.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,8EAA8E,CAAC;AAMtF,qBACa,yBAA0B,YAAW,mBAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAErE,WAAW,CACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,uBAAuB,CAAC;IAkBnC,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,QAAQ;CAuCjB"}
|
package/dist/packages/core/src/infrastructure/services/external/github-issue-creator.service.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub Issue Creator Service Implementation
|
|
3
|
-
*
|
|
4
|
-
* Implements IGitHubIssueService using the gh CLI for creating issues
|
|
5
|
-
* on GitHub repositories. Wraps `gh issue create` with structured
|
|
6
|
-
* error handling and result parsing.
|
|
7
|
-
*/
|
|
8
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
9
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
-
};
|
|
14
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
16
|
-
};
|
|
17
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
18
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
19
|
-
};
|
|
20
|
-
import { injectable, inject } from 'tsyringe';
|
|
21
|
-
import { GitHubIssueError, GitHubIssueErrorCode, } from '../../../application/ports/output/services/github-issue-service.interface.js';
|
|
22
|
-
let GitHubIssueCreatorService = class GitHubIssueCreatorService {
|
|
23
|
-
execFile;
|
|
24
|
-
constructor(execFile) {
|
|
25
|
-
this.execFile = execFile;
|
|
26
|
-
}
|
|
27
|
-
async createIssue(repo, title, body, labels) {
|
|
28
|
-
const args = ['issue', 'create', '--repo', repo, '--title', title, '--body', body];
|
|
29
|
-
for (const label of labels) {
|
|
30
|
-
args.push('--label', label);
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const { stdout } = await this.execFile('gh', args);
|
|
34
|
-
const url = stdout.trim();
|
|
35
|
-
const number = this.parseIssueNumberFromUrl(url);
|
|
36
|
-
return { url, number };
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
throw this.mapError(error);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
parseIssueNumberFromUrl(url) {
|
|
43
|
-
const match = url.match(/\/issues\/(\d+)/);
|
|
44
|
-
return match ? parseInt(match[1], 10) : 0;
|
|
45
|
-
}
|
|
46
|
-
mapError(error) {
|
|
47
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
48
|
-
const cause = error instanceof Error ? error : undefined;
|
|
49
|
-
const errnoCode = error?.code;
|
|
50
|
-
if (errnoCode === 'ENOENT' || message.includes('ENOENT')) {
|
|
51
|
-
return new GitHubIssueError('GitHub CLI (gh) is not installed. Install it from https://cli.github.com/', GitHubIssueErrorCode.GH_NOT_FOUND, cause);
|
|
52
|
-
}
|
|
53
|
-
if (message.includes('auth') || message.includes('Authentication') || message.includes('403')) {
|
|
54
|
-
return new GitHubIssueError('GitHub CLI is not authenticated. Run `gh auth login` to sign in.', GitHubIssueErrorCode.AUTH_FAILURE, cause);
|
|
55
|
-
}
|
|
56
|
-
if (message.includes('network') ||
|
|
57
|
-
message.includes('ECONNREFUSED') ||
|
|
58
|
-
message.includes('ETIMEDOUT')) {
|
|
59
|
-
return new GitHubIssueError(`Network error creating issue: ${message}`, GitHubIssueErrorCode.NETWORK_ERROR, cause);
|
|
60
|
-
}
|
|
61
|
-
return new GitHubIssueError(`Failed to create issue on ${message}`, GitHubIssueErrorCode.CREATE_FAILED, cause);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
GitHubIssueCreatorService = __decorate([
|
|
65
|
-
injectable(),
|
|
66
|
-
__param(0, inject('ExecFunction')),
|
|
67
|
-
__metadata("design:paramtypes", [Function])
|
|
68
|
-
], GitHubIssueCreatorService);
|
|
69
|
-
export { GitHubIssueCreatorService };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Doctor Command
|
|
3
|
-
*
|
|
4
|
-
* Diagnoses shep operation failures, opens a GitHub issue on shep-ai/cli,
|
|
5
|
-
* and optionally invokes an AI agent to attempt a fix and open a PR.
|
|
6
|
-
*
|
|
7
|
-
* Usage: shep doctor [description] [options]
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* $ shep doctor "agent crashed during planning"
|
|
11
|
-
* $ shep doctor --fix
|
|
12
|
-
* $ shep doctor --no-fix
|
|
13
|
-
* $ shep doctor "broken workflow" --fix --workdir /tmp/my-fix
|
|
14
|
-
*/
|
|
15
|
-
import { Command } from 'commander';
|
|
16
|
-
/**
|
|
17
|
-
* Create the doctor command
|
|
18
|
-
*/
|
|
19
|
-
export declare function createDoctorCommand(): Command;
|
|
20
|
-
//# sourceMappingURL=doctor.command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.command.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/cli/commands/doctor.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAgF7C"}
|