mcp-efficiency-engine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CODEOWNERS +40 -0
- package/.github/GITHUB_MCP_INTEGRATION.md +366 -0
- package/.github/ISSUE_TEMPLATE/bug.md +51 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +45 -0
- package/.github/ISSUE_TEMPLATE/question.md +18 -0
- package/.github/agents/backend.agent.md +18 -0
- package/.github/agents/community-manager.agent.md +18 -0
- package/.github/agents/dba.agent.md +18 -0
- package/.github/agents/frontend-agent.agent.md +18 -0
- package/.github/agents/github-repository-manager.agent.md +338 -0
- package/.github/agents/iot.agent.md +20 -0
- package/.github/agents/legacy.agent.md +18 -0
- package/.github/agents/rag-azure.agent.md +18 -0
- package/.github/agents/rag-local.agent.md +18 -0
- package/.github/agents/snapshot.agent.md +18 -0
- package/.github/agents/ux-ui.agent.md +18 -0
- package/.github/agents/wiki-agent.agent.md +23 -0
- package/.github/copilot-instructions.md +44 -0
- package/.github/instructions/always-on-optimization.instructions.md +54 -0
- package/.github/prompts/auto-route.prompt.md +33 -0
- package/.github/prompts/azure-rag.query.prompt.md +19 -0
- package/.github/prompts/backend.fix-bug.prompt.md +13 -0
- package/.github/prompts/cavecrew.prompt.md +16 -0
- package/.github/prompts/caveman-commit.prompt.md +14 -0
- package/.github/prompts/caveman-compress.prompt.md +15 -0
- package/.github/prompts/caveman-debug.prompt.md +13 -0
- package/.github/prompts/caveman-help.prompt.md +11 -0
- package/.github/prompts/caveman-review.prompt.md +15 -0
- package/.github/prompts/caveman-stats.prompt.md +11 -0
- package/.github/prompts/caveman.prompt.md +11 -0
- package/.github/prompts/community.post.prompt.md +14 -0
- package/.github/prompts/dba.query-review.prompt.md +15 -0
- package/.github/prompts/dev.fix-bug.prompt.md +13 -0
- package/.github/prompts/frontend.code.prompt.md +13 -0
- package/.github/prompts/legacy.impact-analysis.prompt.md +14 -0
- package/.github/prompts/project.kickoff-analysis.prompt.md +51 -0
- package/.github/prompts/rag.knowledge-answer.prompt.md +13 -0
- package/.github/prompts/token-saver-review.prompt.md +14 -0
- package/.github/prompts/ux-ui.review.prompt.md +14 -0
- package/.github/pull_request_template.md +71 -0
- package/.github/skills/ahorro-tokens/SKILL.md +36 -0
- package/.github/skills/azure-rag-enterprise/SKILL.md +24 -0
- package/.github/skills/backend-coding/SKILL.md +24 -0
- package/.github/skills/cavecrew/SKILL.md +17 -0
- package/.github/skills/caveman/SKILL.md +25 -0
- package/.github/skills/caveman-commit/SKILL.md +15 -0
- package/.github/skills/caveman-compress/SKILL.md +14 -0
- package/.github/skills/caveman-help/SKILL.md +19 -0
- package/.github/skills/caveman-mode/SKILL.md +43 -0
- package/.github/skills/caveman-review/SKILL.md +16 -0
- package/.github/skills/caveman-stats/SKILL.md +13 -0
- package/.github/skills/community-content/SKILL.md +22 -0
- package/.github/skills/database-analysis/SKILL.md +23 -0
- package/.github/skills/dev-coding/SKILL.md +24 -0
- package/.github/skills/frontend-coding/SKILL.md +24 -0
- package/.github/skills/human-in-the-loop/SKILL.md +47 -0
- package/.github/skills/iot-architecture/SKILL.md +22 -0
- package/.github/skills/legacy-migration/SKILL.md +22 -0
- package/.github/skills/rag-knowledge/SKILL.md +21 -0
- package/.github/skills/token-saver/SKILL.md +36 -0
- package/.github/skills/ux-ui-governance/SKILL.md +24 -0
- package/.github/skills/wiki-tools.json +24 -0
- package/.github/workflows/auto-devlog.yml +56 -0
- package/.github/workflows/auto-manage-issues.yml +64 -0
- package/.github/workflows/auto-sync.yml +54 -0
- package/.github/workflows/autodocs-sync.yml +114 -0
- package/.github/workflows/ci.yml +68 -0
- package/.github/workflows/pages.yml +59 -0
- package/.github/workflows/routing-evals.yml +59 -0
- package/.github/workflows/techriders-coverage-effective.yml +91 -0
- package/.vscode/mcp.json +44 -0
- package/AGENTS.md +160 -0
- package/ARCHITECTURE.md +57 -0
- package/FINAL_USAGE_GUIDE.md +106 -0
- package/LICENSE +21 -0
- package/README.md +385 -0
- package/README_WIKI.md +130 -0
- package/autodocs/README.md +22 -0
- package/autodocs/schema/wiki-node.schema.json +56 -0
- package/autolearning/feedback-loop.md +90 -0
- package/bin/install-host.js +326 -0
- package/bin/mcpee.js +116 -0
- package/context/repomix/repomix.config.json +20 -0
- package/memory/cross-memory-reasoning.md +17 -0
- package/memory/mempry-registry.yml +16 -0
- package/observability/evals/chat-token-usage-report.json +64 -0
- package/observability/evals/chat-token-usage-report.md +33 -0
- package/observability/evals/iteration-value-report.json +76 -0
- package/observability/evals/iteration-value-report.md +39 -0
- package/observability/evals/learning-loop-report.json +268 -0
- package/observability/evals/learning-loop-report.md +37 -0
- package/observability/evals/repo-intake-eval-cases.md +23 -0
- package/observability/evals/routing-eval-cases.json +68 -0
- package/observability/evals/routing-eval-cases.md +25 -0
- package/observability/evals/routing-eval-report.json +72 -0
- package/observability/evaluation.md +34 -0
- package/observability/logs/copilot-usage-ingest-report.json +13 -0
- package/observability/logs/iteration-metrics.jsonl +75 -0
- package/observability/logs/learning-feedback.jsonl +152 -0
- package/observability/logs/routing-decisions.jsonl +333 -0
- package/observability/logs/session/agent-pipeline-preflight-20260701-004146.log +8 -0
- package/observability/logs/session/agent-pipeline-preflight-20260701-005554.log +8 -0
- package/observability/logs/session/agent-pipeline-preflight-20260701-010351.log +8 -0
- package/observability/logs/session/agent-pipeline-preflight-20260704-145829.log +8 -0
- package/observability/logs/session/agent-pipeline-preflight-20260704-150021.log +8 -0
- package/observability/logs/session/agent-pipeline-preflight-20260704-154328.log +8 -0
- package/observability/logs/session/bye-20260629-221513.json +39 -0
- package/observability/logs/session/bye-20260629-221545.json +59 -0
- package/observability/logs/session/bye-20260629-222007.json +52 -0
- package/observability/logs/session/bye-20260629-222133.json +59 -0
- package/observability/logs/session/bye-20260629-222412.json +45 -0
- package/observability/logs/session/bye-20260629-223224.json +52 -0
- package/observability/logs/session/bye-20260629-224050.json +59 -0
- package/observability/logs/session/bye-20260630-105732.json +24 -0
- package/observability/logs/session/bye-20260630-211536.json +87 -0
- package/observability/logs/session/bye-20260630-223423.json +87 -0
- package/observability/logs/session/bye-20260630-232534.json +87 -0
- package/observability/logs/session/bye-20260701-003638.json +126 -0
- package/observability/logs/session/bye-20260701-003849.json +126 -0
- package/observability/logs/session/bye-20260701-004315.json +138 -0
- package/observability/logs/session/bye-20260701-004559.json +76 -0
- package/observability/logs/session/bye-20260701-005913.json +138 -0
- package/observability/logs/session/bye-20260701-010753.json +138 -0
- package/observability/logs/session/bye-20260703-194106.json +24 -0
- package/observability/logs/session/bye-20260703-233443.json +76 -0
- package/observability/logs/session/bye-20260703-233653.json +76 -0
- package/observability/logs/session/bye-20260704-150317.json +152 -0
- package/observability/logs/session/bye-20260704-150929.json +75 -0
- package/observability/logs/session/bye-20260704-151050.json +75 -0
- package/observability/logs/session/bye-20260705-115458.json +165 -0
- package/observability/logs/session/codegraph-status-20260701-004228.log +39 -0
- package/observability/logs/session/codegraph-status-20260701-004310.log +39 -0
- package/observability/logs/session/codegraph-status-20260701-005637.log +39 -0
- package/observability/logs/session/codegraph-status-20260701-005908.log +39 -0
- package/observability/logs/session/codegraph-status-20260701-010444.log +39 -0
- package/observability/logs/session/codegraph-status-20260701-010747.log +39 -0
- package/observability/logs/session/codegraph-status-20260704-150137.log +26 -0
- package/observability/logs/session/codegraph-status-20260704-150313.log +28 -0
- package/observability/logs/session/codegraph-status-20260704-154445.log +26 -0
- package/observability/logs/session/codegraph-status-20260705-115454.log +27 -0
- package/observability/logs/session/codegraph-sync-20260701-004211.log +88 -0
- package/observability/logs/session/codegraph-sync-20260701-004241.log +82 -0
- package/observability/logs/session/codegraph-sync-20260701-005620.log +89 -0
- package/observability/logs/session/codegraph-sync-20260701-005840.log +88 -0
- package/observability/logs/session/codegraph-sync-20260701-010419.log +93 -0
- package/observability/logs/session/codegraph-sync-20260701-010609.log +90 -0
- package/observability/logs/session/codegraph-sync-20260704-145856.log +70 -0
- package/observability/logs/session/codegraph-sync-20260704-150047.log +53 -0
- package/observability/logs/session/codegraph-sync-20260704-150204.log +44 -0
- package/observability/logs/session/codegraph-sync-20260704-154353.log +26 -0
- package/observability/logs/session/codegraph-sync-20260705-115337.log +32 -0
- package/observability/logs/session/hi-20260629-221459.json +38 -0
- package/observability/logs/session/hi-20260629-221945.json +59 -0
- package/observability/logs/session/hi-20260629-222108.json +66 -0
- package/observability/logs/session/hi-20260629-222352.json +45 -0
- package/observability/logs/session/hi-20260629-225719.json +59 -0
- package/observability/logs/session/hi-20260629-233722.json +52 -0
- package/observability/logs/session/hi-20260629-233913.json +198 -0
- package/observability/logs/session/hi-20260630-110156.json +177 -0
- package/observability/logs/session/hi-20260630-191243.json +184 -0
- package/observability/logs/session/hi-20260630-230050.json +234 -0
- package/observability/logs/session/hi-20260630-230523.json +227 -0
- package/observability/logs/session/hi-20260630-230855.json +227 -0
- package/observability/logs/session/hi-20260630-231638.json +227 -0
- package/observability/logs/session/hi-20260630-231756.json +219 -0
- package/observability/logs/session/hi-20260701-002842.json +234 -0
- package/observability/logs/session/hi-20260701-003458.json +282 -0
- package/observability/logs/session/hi-20260701-004233.json +290 -0
- package/observability/logs/session/hi-20260701-004554.json +236 -0
- package/observability/logs/session/hi-20260701-005641.json +290 -0
- package/observability/logs/session/hi-20260701-010450.json +290 -0
- package/observability/logs/session/hi-20260703-233854.json +312 -0
- package/observability/logs/session/hi-20260703-234448.json +318 -0
- package/observability/logs/session/hi-20260704-145907.json +353 -0
- package/observability/logs/session/hi-20260704-150141.json +392 -0
- package/observability/logs/session/hi-20260704-154448.json +392 -0
- package/observability/logs/session/iteration-value-refresh-20260701-004309.log +3 -0
- package/observability/logs/session/iteration-value-refresh-20260701-005907.log +3 -0
- package/observability/logs/session/iteration-value-refresh-20260701-010747.log +3 -0
- package/observability/logs/session/iteration-value-refresh-20260704-150312.log +3 -0
- package/observability/logs/session/iteration-value-refresh-20260705-115453.log +3 -0
- package/observability/logs/session/learning-loop-refresh-20260701-004309.log +3 -0
- package/observability/logs/session/learning-loop-refresh-20260701-005906.log +3 -0
- package/observability/logs/session/learning-loop-refresh-20260701-010745.log +3 -0
- package/observability/logs/session/learning-loop-refresh-20260704-150309.log +3 -0
- package/observability/logs/session/learning-loop-refresh-20260705-115450.log +3 -0
- package/observability/logs/session/project-notes-refresh-20260701-004227.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260701-004308.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260701-005636.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260701-005906.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260701-010443.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260701-010744.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260704-150133.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260704-150309.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260704-154442.log +1 -0
- package/observability/logs/session/project-notes-refresh-20260705-115449.log +1 -0
- package/observability/logs/session/repo-intake-20260701-004218.log +6 -0
- package/observability/logs/session/repo-intake-20260701-005626.log +6 -0
- package/observability/logs/session/repo-intake-20260701-010433.log +6 -0
- package/observability/logs/session/repo-intake-20260704-150053.log +6 -0
- package/observability/logs/session/repo-intake-20260704-154404.log +6 -0
- package/observability/logs/session/repo-intake-refresh-20260701-004247.log +6 -0
- package/observability/logs/session/repo-intake-refresh-20260701-005847.log +6 -0
- package/observability/logs/session/repo-intake-refresh-20260701-010615.log +6 -0
- package/observability/logs/session/repo-intake-refresh-20260704-150209.log +6 -0
- package/observability/logs/session/repo-intake-refresh-20260705-115342.log +6 -0
- package/observability/logs/session/repo-registry-validation-20260701-004234.log +2 -0
- package/observability/logs/session/repo-registry-validation-20260701-004556.log +2 -0
- package/observability/logs/session/repo-registry-validation-20260701-005833.log +2 -0
- package/observability/logs/session/repo-registry-validation-20260701-010601.log +2 -0
- package/observability/logs/session/repo-registry-validation-20260704-150155.log +2 -0
- package/observability/logs/session/repo-registry-validation-20260705-115323.log +2 -0
- package/observability/logs/session/repomix-refresh-20260701-003823.log +4236 -0
- package/observability/logs/session/repomix-refresh-20260701-004251.log +4275 -0
- package/observability/logs/session/repomix-refresh-20260701-005850.log +4248 -0
- package/observability/logs/session/repomix-refresh-20260701-010619.log +6531 -0
- package/observability/logs/session/repomix-refresh-20260704-150239.log +652 -0
- package/observability/logs/session/repomix-refresh-20260705-115419.log +178 -0
- package/observability/logs/session/routing-evals-20260701-004221.log +2 -0
- package/observability/logs/session/routing-evals-20260701-004235.log +2 -0
- package/observability/logs/session/routing-evals-20260701-005629.log +2 -0
- package/observability/logs/session/routing-evals-20260701-005834.log +2 -0
- package/observability/logs/session/routing-evals-20260701-010437.log +2 -0
- package/observability/logs/session/routing-evals-20260701-010603.log +2 -0
- package/observability/logs/session/routing-evals-20260704-150125.log +2 -0
- package/observability/logs/session/routing-evals-20260704-150157.log +2 -0
- package/observability/logs/session/routing-evals-20260704-154434.log +2 -0
- package/observability/logs/session/routing-evals-20260705-115327.log +2 -0
- package/observability/logs/session/sibling-discovery-refresh-20260701-004250.log +3 -0
- package/observability/logs/session/sibling-discovery-refresh-20260701-005850.log +3 -0
- package/observability/logs/session/sibling-discovery-refresh-20260701-010618.log +3 -0
- package/observability/logs/session/sibling-discovery-refresh-20260704-150238.log +3 -0
- package/observability/logs/session/sibling-discovery-refresh-20260705-115418.log +3 -0
- package/observability/logs.schema.json +95 -0
- package/observability/logs.schema.md +26 -0
- package/observability/metrics.md +35 -0
- package/observability/routing-evaluator.md +37 -0
- package/observability/scoring-rubric.md +38 -0
- package/optimization/ALWAYS_ON_OPTIMIZATION.md +98 -0
- package/optimization/caveman-mode.md +62 -0
- package/optimization/examples/login-bug.md +25 -0
- package/optimization/examples/sla-query.md +25 -0
- package/optimization/optimization-routing.md +30 -0
- package/optimization/policies/response-style.policy.md +45 -0
- package/optimization/policies/token-budget.policy.md +28 -0
- package/optimization/profiles/always-on.profile.md +19 -0
- package/optimization/profiles/architecture.profile.md +20 -0
- package/optimization/profiles/debug.profile.md +20 -0
- package/optimization/profiles/enterprise-rag.profile.md +20 -0
- package/optimization/profiles/training.profile.md +20 -0
- package/optimization/token-saver.md +58 -0
- package/orchestrator/corporate-routing.md +51 -0
- package/orchestrator/decision-matrix.md +33 -0
- package/orchestrator/fallback.md +29 -0
- package/orchestrator/repo-routing.md +58 -0
- package/orchestrator/router.md +75 -0
- package/orchestrator/wiki/__init__.py +5 -0
- package/orchestrator/wiki/graph_consolidator.py +506 -0
- package/orchestrator/wiki/incremental_engine.py +57 -0
- package/orchestrator/wiki/plugin_manager.py +40 -0
- package/package.json +70 -0
- package/policies/context-policy.md +25 -0
- package/policies/cost-policy.md +25 -0
- package/policies/repo-intake-policy.md +36 -0
- package/policies/security-policy.md +25 -0
- package/repo-intake/README.md +81 -0
- package/repo-intake/templates/agent.template.md +4 -0
- package/repo-intake/templates/context-manifest.template.md +4 -0
- package/repo-intake/templates/skill.template.md +3 -0
- package/repo-registry/repos.schema.json +102 -0
- package/repo-registry/repos.template.json +26 -0
- package/requirements.txt +1 -0
- package/scripts/README.md +109 -0
- package/scripts/__init__.py +0 -0
- package/scripts/bootstrap-portable.cmd +4 -0
- package/scripts/bootstrap-portable.ps1 +90 -0
- package/scripts/context/azure-rag-mcp-adapter.py +1 -0
- package/scripts/context/build-graphify.ps1 +1 -0
- package/scripts/context/build-repomix.ps1 +1 -0
- package/scripts/discovery/discover-boost-repos.cmd +4 -0
- package/scripts/discovery/discover-boost-repos.py +186 -0
- package/scripts/discovery/refresh-project-notes.py +179 -0
- package/scripts/github/INSTALL.md +295 -0
- package/scripts/github/README.md +455 -0
- package/scripts/github/apply-boost-templates.ps1 +163 -0
- package/scripts/github/apply-single-repo.ps1 +85 -0
- package/scripts/github/create-devlog.ps1 +380 -0
- package/scripts/github/manage-issues.ps1 +332 -0
- package/scripts/github/sync-repo.ps1 +267 -0
- package/scripts/intake/agent-pipeline-preflight.py +151 -0
- package/scripts/intake/init-template-registry.cmd +4 -0
- package/scripts/intake/init-template-registry.ps1 +258 -0
- package/scripts/intake/repo-intake.py +354 -0
- package/scripts/intake/resolve-routing.py +620 -0
- package/scripts/intake/run-repo-intake.cmd +4 -0
- package/scripts/intake/run-repo-intake.ps1 +46 -0
- package/scripts/intake/run-routing-evals.py +147 -0
- package/scripts/intake/validate-database-routing.py +91 -0
- package/scripts/intake/validate-rag-routing.py +85 -0
- package/scripts/intake/validate-repo-registry.ps1 +20 -0
- package/scripts/intake/validate-repo-registry.py +286 -0
- package/scripts/intake/validate-security.py +170 -0
- package/scripts/learning/autolearning-gate.py +71 -0
- package/scripts/learning/chat-token-usage-report.py +326 -0
- package/scripts/learning/ingest-copilot-session-usage.py +421 -0
- package/scripts/learning/iteration-value-report.py +275 -0
- package/scripts/learning/learning-loop-report.py +272 -0
- package/scripts/learning/record-iteration-metrics.py +116 -0
- package/scripts/learning/record-learning-feedback.py +91 -0
- package/scripts/ops/bye.ps1 +620 -0
- package/scripts/ops/compare-demo-results.ps1 +826 -0
- package/scripts/ops/demo1.ps1 +11 -0
- package/scripts/ops/demo2.ps1 +11 -0
- package/scripts/ops/demo3.ps1 +11 -0
- package/scripts/ops/demo4.ps1 +11 -0
- package/scripts/ops/hi.ps1 +1045 -0
- package/scripts/ops/llm-token-probe.py +164 -0
- package/scripts/ops/run-all-demos.ps1 +39 -0
- package/scripts/ops/run-demo-block.ps1 +85 -0
- package/scripts/ops/run-demo-session.ps1 +532 -0
- package/scripts/setup/optimize-engines.ps1 +183 -0
- package/scripts/setup/setup-codegraph.ps1 +3 -0
- package/scripts/setup/setup-gitnexus.ps1 +3 -0
- package/scripts/setup/setup-graphify.ps1 +2 -0
- package/scripts/setup/setup-prerequisites.ps1 +205 -0
- package/scripts/setup/start-gitnexus.ps1 +71 -0
- package/scripts/setup/validate-context.ps1 +361 -0
- package/scripts/wiki/__init__.py +0 -0
- package/scripts/wiki/compiler_main.py +189 -0
- package/scripts/wiki/normalizer.py +206 -0
- package/scripts/wiki/providers/base_provider.py +25 -0
- package/scripts/wiki/providers/codegraph_provider.py +49 -0
- package/scripts/wiki/providers/graphify_provider.py +49 -0
- package/scripts/wiki/providers/repo_content_provider.py +408 -0
- package/scripts/wiki/query_autodocs.py +60 -0
- package/scripts/wiki/validator.py +183 -0
- package/scripts/wiki/wiki_compiler.py +5 -0
- package/specs/architecture.spec.md +32 -0
- package/specs/azure-rag.spec.md +28 -0
- package/specs/coding-standards.spec.md +24 -0
- package/specs/database.spec.md +29 -0
- package/specs/migration.spec.md +26 -0
- package/specs/observability.spec.md +24 -0
- package/specs/optimization.spec.md +31 -0
- package/specs/rag.spec.md +30 -0
- package/specs/repo-intake.spec.md +25 -0
- package/specs/routing.spec.md +24 -0
- package/specs/security.spec.md +30 -0
- package/specs/wiki/provider-contract.json +33 -0
- package/specs/wiki/unified-knowledge-graph.json +25 -0
- package/templates/BOOST_README_TEMPLATE.md +96 -0
- package/templates/CODEOWNERS_TEMPLATE.txt +29 -0
- package/templates/LICENSE_MIT_TEMPLATE.txt +21 -0
- package/templates/PERSONAL_README_TEMPLATE.md +90 -0
- package/templates/README_boost_RAG_Azure.md +46 -0
- package/templates/README_boost_azure_iot_edge.md +48 -0
- package/templates/README_boost_backend.md +47 -0
- package/templates/README_boost_dba.md +57 -0
- package/templates/ci.yml.template +73 -0
- package/tooling/tooling.manifest.json +72 -0
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[switch]$SkipRegistryValidation,
|
|
3
|
+
[switch]$SkipRoutingEvals,
|
|
4
|
+
[switch]$SkipCodegraphStatus,
|
|
5
|
+
[switch]$SkipGitSnapshot,
|
|
6
|
+
[switch]$SkipGraphRefresh,
|
|
7
|
+
[switch]$SkipIntakeRefresh,
|
|
8
|
+
[switch]$SkipSiblingDiscoveryRefresh,
|
|
9
|
+
[switch]$SkipRepomixRefresh,
|
|
10
|
+
[switch]$SkipProjectNotesRefresh,
|
|
11
|
+
[switch]$SkipLearningRefresh,
|
|
12
|
+
[switch]$SkipIterationValueRefresh,
|
|
13
|
+
[switch]$SkipCopilotUsageIngest,
|
|
14
|
+
[switch]$SkipChatTokenUsageReport,
|
|
15
|
+
[switch]$SkipRetentionCleanup,
|
|
16
|
+
[ValidateRange(1, 3650)]
|
|
17
|
+
[int]$RetentionDays = 15
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
Set-StrictMode -Version Latest
|
|
21
|
+
$ErrorActionPreference = 'Stop'
|
|
22
|
+
|
|
23
|
+
function Get-PythonCommand {
|
|
24
|
+
if (Get-Command py -ErrorAction SilentlyContinue) {
|
|
25
|
+
return @('py', '-3')
|
|
26
|
+
}
|
|
27
|
+
if (Get-Command python -ErrorAction SilentlyContinue) {
|
|
28
|
+
return @('python')
|
|
29
|
+
}
|
|
30
|
+
throw 'Python is required (py or python not found in PATH).'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function New-StepResult {
|
|
34
|
+
param(
|
|
35
|
+
[string]$Name,
|
|
36
|
+
[bool]$Required,
|
|
37
|
+
[bool]$Success,
|
|
38
|
+
[double]$DurationSec,
|
|
39
|
+
[string]$Message
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return [ordered]@{
|
|
43
|
+
name = $Name
|
|
44
|
+
required = $Required
|
|
45
|
+
success = $Success
|
|
46
|
+
duration_sec = [math]::Round($DurationSec, 2)
|
|
47
|
+
message = $Message
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function Get-StepStatus {
|
|
52
|
+
param(
|
|
53
|
+
[string]$Name
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
$step = $script:Steps | Where-Object { $_.name -eq $Name } | Select-Object -Last 1
|
|
57
|
+
if ($null -eq $step) {
|
|
58
|
+
return 'skipped'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ([bool]$step.success) {
|
|
62
|
+
return 'ok'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return 'failed'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function Test-CommandAvailable {
|
|
69
|
+
param(
|
|
70
|
+
[string]$Name
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return [bool](Get-Command $Name -ErrorAction SilentlyContinue)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function Invoke-ObservabilityRetentionCleanup {
|
|
77
|
+
param(
|
|
78
|
+
[string]$RepoRoot,
|
|
79
|
+
[int]$DaysToKeep
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
$sessionDir = Join-Path $RepoRoot 'observability/logs/session'
|
|
83
|
+
if (-not (Test-Path $sessionDir)) {
|
|
84
|
+
return [ordered]@{
|
|
85
|
+
applied = $true
|
|
86
|
+
days = $DaysToKeep
|
|
87
|
+
session_dir = $sessionDir
|
|
88
|
+
deleted_files = 0
|
|
89
|
+
deleted_bytes = 0
|
|
90
|
+
cutoff_utc = (Get-Date).ToUniversalTime().AddDays(-$DaysToKeep).ToString('o')
|
|
91
|
+
note = 'session directory does not exist'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$cutoffUtc = (Get-Date).ToUniversalTime().AddDays(-$DaysToKeep)
|
|
96
|
+
$candidates = @(Get-ChildItem -Path $sessionDir -File -ErrorAction SilentlyContinue |
|
|
97
|
+
Where-Object { $_.LastWriteTimeUtc -lt $cutoffUtc })
|
|
98
|
+
|
|
99
|
+
$deletedFiles = 0
|
|
100
|
+
$deletedBytes = 0L
|
|
101
|
+
foreach ($file in $candidates) {
|
|
102
|
+
try {
|
|
103
|
+
$deletedBytes += [int64]$file.Length
|
|
104
|
+
Remove-Item -Path $file.FullName -Force -ErrorAction Stop
|
|
105
|
+
$deletedFiles += 1
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
Write-Host ("[info] Retention skip delete: {0} -> {1}" -f $file.FullName, $_.Exception.Message) -ForegroundColor DarkYellow
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return [ordered]@{
|
|
113
|
+
applied = $true
|
|
114
|
+
days = $DaysToKeep
|
|
115
|
+
session_dir = $sessionDir
|
|
116
|
+
deleted_files = $deletedFiles
|
|
117
|
+
deleted_bytes = $deletedBytes
|
|
118
|
+
cutoff_utc = $cutoffUtc.ToString('o')
|
|
119
|
+
note = ''
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function New-StepLogPath {
|
|
124
|
+
param(
|
|
125
|
+
[string]$StepName
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
$logDir = Join-Path $repoRoot 'observability/logs/session'
|
|
129
|
+
New-Item -ItemType Directory -Path $logDir -Force | Out-Null
|
|
130
|
+
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
|
131
|
+
$safeName = ($StepName.ToLowerInvariant() -replace '[^a-z0-9]+', '-') -replace '(^-|-$)', ''
|
|
132
|
+
return Join-Path $logDir ("{0}-{1}.log" -f $safeName, $stamp)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function Invoke-LoggedAction {
|
|
136
|
+
param(
|
|
137
|
+
[string]$StepName,
|
|
138
|
+
[scriptblock]$Action,
|
|
139
|
+
[string[]]$InfoLines = @()
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
$logPath = New-StepLogPath -StepName $StepName
|
|
143
|
+
& $Action *> $logPath
|
|
144
|
+
$exitCode = $LASTEXITCODE
|
|
145
|
+
if ($exitCode -ne 0) {
|
|
146
|
+
throw "$StepName failed with exit code $exitCode. Log: $logPath"
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
foreach ($infoLine in $InfoLines) {
|
|
150
|
+
Write-Host ("[info] {0}" -f $infoLine)
|
|
151
|
+
}
|
|
152
|
+
Write-Host ("[info] Log: {0}" -f $logPath)
|
|
153
|
+
|
|
154
|
+
return $logPath
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function Get-ByeSummary {
|
|
158
|
+
param(
|
|
159
|
+
[string]$RepoRoot,
|
|
160
|
+
[datetime]$StartedAt,
|
|
161
|
+
[datetime]$EndedAt
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
$okCount = @($script:Steps | Where-Object { $_.success }).Count
|
|
165
|
+
$failedCount = @($script:Steps | Where-Object { -not $_.success -and $_.required }).Count
|
|
166
|
+
$optionalFailedCount = @($script:Steps | Where-Object { -not $_.success -and -not $_.required }).Count
|
|
167
|
+
$skipped = @()
|
|
168
|
+
|
|
169
|
+
if ($SkipRegistryValidation) { $skipped += 'Validate repo registry (strict)' }
|
|
170
|
+
if ($SkipRoutingEvals) { $skipped += 'Run routing evals' }
|
|
171
|
+
if ($SkipGraphRefresh) { $skipped += 'Refresh codegraph index sync' }
|
|
172
|
+
if ($SkipIntakeRefresh) { $skipped += 'Refresh repo intake artifacts' }
|
|
173
|
+
if ($SkipSiblingDiscoveryRefresh) { $skipped += 'Refresh sibling repos discovery proposal' }
|
|
174
|
+
if ($SkipRepomixRefresh) { $skipped += 'Refresh repomix context export' }
|
|
175
|
+
if ($SkipProjectNotesRefresh) { $skipped += 'Refresh project notes from observability' }
|
|
176
|
+
if ($SkipLearningRefresh) { $skipped += 'Refresh learning loop report' }
|
|
177
|
+
if ($SkipIterationValueRefresh) { $skipped += 'Refresh iteration value report' }
|
|
178
|
+
if ($SkipRetentionCleanup) { $skipped += 'Apply observability retention cleanup' }
|
|
179
|
+
if ($SkipCodegraphStatus) { $skipped += 'Check codegraph status' }
|
|
180
|
+
if ($SkipGitSnapshot) { $skipped += 'Collect git snapshot' }
|
|
181
|
+
|
|
182
|
+
$engineSummary = [ordered]@{
|
|
183
|
+
codegraph = [ordered]@{
|
|
184
|
+
command_available = Test-CommandAvailable -Name 'codegraph'
|
|
185
|
+
index_present = Test-Path (Join-Path $RepoRoot '.codegraph')
|
|
186
|
+
sync = Get-StepStatus -Name 'Refresh codegraph index sync'
|
|
187
|
+
status = Get-StepStatus -Name 'Check codegraph status'
|
|
188
|
+
}
|
|
189
|
+
git = [ordered]@{
|
|
190
|
+
command_available = Test-CommandAvailable -Name 'git'
|
|
191
|
+
snapshot = Get-StepStatus -Name 'Collect git snapshot'
|
|
192
|
+
}
|
|
193
|
+
repomix = [ordered]@{
|
|
194
|
+
refresh = Get-StepStatus -Name 'Refresh repomix context export'
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
$artifactSummary = [ordered]@{
|
|
199
|
+
repo_registry = Get-StepStatus -Name 'Validate repo registry (strict)'
|
|
200
|
+
repo_intake = Get-StepStatus -Name 'Refresh repo intake artifacts'
|
|
201
|
+
routing_evals = Get-StepStatus -Name 'Run routing evals'
|
|
202
|
+
sibling_discovery = Get-StepStatus -Name 'Refresh sibling repos discovery proposal'
|
|
203
|
+
project_notes = Get-StepStatus -Name 'Refresh project notes from observability'
|
|
204
|
+
learning_loop = Get-StepStatus -Name 'Refresh learning loop report'
|
|
205
|
+
iteration_value = Get-StepStatus -Name 'Refresh iteration value report'
|
|
206
|
+
repomix_output = Test-Path (Join-Path $RepoRoot 'context/repomix/repomix-output.xml')
|
|
207
|
+
retention_cleanup = [ordered]@{
|
|
208
|
+
status = Get-StepStatus -Name 'Apply observability retention cleanup'
|
|
209
|
+
days = $RetentionDays
|
|
210
|
+
deleted_files = [int]$script:RetentionCleanupReport.deleted_files
|
|
211
|
+
deleted_bytes = [int64]$script:RetentionCleanupReport.deleted_bytes
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return [ordered]@{
|
|
216
|
+
result = if ($script:HasFailures) { 'failed' } else { 'ok' }
|
|
217
|
+
started_at = $StartedAt.ToString('o')
|
|
218
|
+
ended_at = $EndedAt.ToString('o')
|
|
219
|
+
duration_sec = [math]::Round((($EndedAt - $StartedAt).TotalSeconds), 2)
|
|
220
|
+
steps = [ordered]@{
|
|
221
|
+
total = @($script:Steps).Count
|
|
222
|
+
ok = $okCount
|
|
223
|
+
failed_required = $failedCount
|
|
224
|
+
failed_optional = $optionalFailedCount
|
|
225
|
+
skipped = $skipped.Count
|
|
226
|
+
}
|
|
227
|
+
engines = $engineSummary
|
|
228
|
+
artifacts = $artifactSummary
|
|
229
|
+
skipped_steps = $skipped
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function Write-ByeSummary {
|
|
234
|
+
param(
|
|
235
|
+
[object]$Summary,
|
|
236
|
+
[string]$ReportPath
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
Write-Host ''
|
|
240
|
+
Write-Host '=== BYE SUMMARY ===' -ForegroundColor Cyan
|
|
241
|
+
Write-Host ("Result: {0} | Duration: {1}s" -f $Summary.result.ToUpperInvariant(), $Summary.duration_sec)
|
|
242
|
+
Write-Host ("Steps: total={0}, ok={1}, failed_required={2}, failed_optional={3}, skipped={4}" -f $Summary.steps.total, $Summary.steps.ok, $Summary.steps.failed_required, $Summary.steps.failed_optional, $Summary.steps.skipped)
|
|
243
|
+
Write-Host 'Engines:'
|
|
244
|
+
Write-Host ("- codegraph: command={0}, index={1}, sync={2}, status={3}" -f $Summary.engines.codegraph.command_available, $Summary.engines.codegraph.index_present, $Summary.engines.codegraph.sync, $Summary.engines.codegraph.status)
|
|
245
|
+
Write-Host ("- git: command={0}, snapshot={1}" -f $Summary.engines.git.command_available, $Summary.engines.git.snapshot)
|
|
246
|
+
Write-Host ("- repomix: refresh={0}" -f $Summary.engines.repomix.refresh)
|
|
247
|
+
Write-Host 'Artifacts:'
|
|
248
|
+
Write-Host ("- repo-registry: {0}" -f $Summary.artifacts.repo_registry)
|
|
249
|
+
Write-Host ("- repo-intake: {0}" -f $Summary.artifacts.repo_intake)
|
|
250
|
+
Write-Host ("- routing-evals: {0}" -f $Summary.artifacts.routing_evals)
|
|
251
|
+
Write-Host ("- sibling-discovery: {0}" -f $Summary.artifacts.sibling_discovery)
|
|
252
|
+
Write-Host ("- project-notes: {0}" -f $Summary.artifacts.project_notes)
|
|
253
|
+
Write-Host ("- learning-loop: {0}" -f $Summary.artifacts.learning_loop)
|
|
254
|
+
Write-Host ("- iteration-value: {0}" -f $Summary.artifacts.iteration_value)
|
|
255
|
+
Write-Host ("- repomix-output: {0}" -f $Summary.artifacts.repomix_output)
|
|
256
|
+
Write-Host ("- retention-cleanup: status={0}, days={1}, deleted_files={2}, deleted_bytes={3}" -f $Summary.artifacts.retention_cleanup.status, $Summary.artifacts.retention_cleanup.days, $Summary.artifacts.retention_cleanup.deleted_files, $Summary.artifacts.retention_cleanup.deleted_bytes)
|
|
257
|
+
if (@($Summary.skipped_steps).Count -gt 0) {
|
|
258
|
+
Write-Host ("Skipped: {0}" -f (($Summary.skipped_steps) -join ', '))
|
|
259
|
+
}
|
|
260
|
+
Write-Host ("Report: {0}" -f $ReportPath)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function Invoke-Step {
|
|
264
|
+
param(
|
|
265
|
+
[string]$Name,
|
|
266
|
+
[scriptblock]$Action,
|
|
267
|
+
[bool]$Required = $true
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
$start = Get-Date
|
|
271
|
+
$success = $false
|
|
272
|
+
$message = 'ok'
|
|
273
|
+
|
|
274
|
+
try {
|
|
275
|
+
& $Action
|
|
276
|
+
$success = $true
|
|
277
|
+
Write-Host "[ok] $Name" -ForegroundColor Green
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
$message = $_.Exception.Message
|
|
281
|
+
if ($Required) {
|
|
282
|
+
$script:HasFailures = $true
|
|
283
|
+
Write-Host "[fail] $Name -> $message" -ForegroundColor Red
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
Write-Host "[info] $Name -> $message" -ForegroundColor DarkYellow
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
$duration = ((Get-Date) - $start).TotalSeconds
|
|
291
|
+
$script:Steps += (New-StepResult -Name $Name -Required $Required -Success $success -DurationSec $duration -Message $message)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function Resolve-CopilotSessionLogPath {
|
|
295
|
+
$fromEnv = [string]$env:VSCODE_TARGET_SESSION_LOG
|
|
296
|
+
if (-not [string]::IsNullOrWhiteSpace($fromEnv)) {
|
|
297
|
+
if (Test-Path $fromEnv) {
|
|
298
|
+
return (Resolve-Path $fromEnv).Path
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
$workspaceStorage = Join-Path $env:APPDATA 'Code\User\workspaceStorage'
|
|
303
|
+
if (-not (Test-Path $workspaceStorage)) {
|
|
304
|
+
return ''
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
$candidates = Get-ChildItem -Path $workspaceStorage -Recurse -File -Filter 'main.jsonl' -ErrorAction SilentlyContinue |
|
|
308
|
+
Where-Object { $_.FullName -match 'GitHub\.copilot-chat[\\/]debug-logs[\\/][0-9a-fA-F-]{36}[\\/]main\.jsonl$' } |
|
|
309
|
+
Sort-Object LastWriteTime -Descending
|
|
310
|
+
|
|
311
|
+
if ($null -eq $candidates -or $candidates.Count -eq 0) {
|
|
312
|
+
return ''
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return $candidates[0].FullName
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
|
319
|
+
Set-Location $repoRoot
|
|
320
|
+
|
|
321
|
+
$script:Steps = @()
|
|
322
|
+
$script:HasFailures = $false
|
|
323
|
+
$script:StepLogs = [ordered]@{}
|
|
324
|
+
$script:RetentionCleanupReport = [ordered]@{
|
|
325
|
+
applied = $false
|
|
326
|
+
days = $RetentionDays
|
|
327
|
+
session_dir = (Join-Path $repoRoot 'observability/logs/session')
|
|
328
|
+
deleted_files = 0
|
|
329
|
+
deleted_bytes = 0
|
|
330
|
+
cutoff_utc = ''
|
|
331
|
+
note = ''
|
|
332
|
+
}
|
|
333
|
+
$startedAt = Get-Date
|
|
334
|
+
|
|
335
|
+
Write-Host '=== BYE SHUTDOWN ===' -ForegroundColor Cyan
|
|
336
|
+
Write-Host "Repo: $repoRoot"
|
|
337
|
+
Write-Host "Time: $startedAt"
|
|
338
|
+
|
|
339
|
+
if (-not $SkipRegistryValidation) {
|
|
340
|
+
Invoke-Step -Name 'Validate repo registry (strict)' -Action {
|
|
341
|
+
$script:StepLogs['repo-registry-validation'] = Invoke-LoggedAction -StepName 'repo-registry-validation' -Action {
|
|
342
|
+
& pwsh -NoProfile -ExecutionPolicy Bypass -File .\scripts\intake\validate-repo-registry.ps1 -Strict
|
|
343
|
+
}
|
|
344
|
+
} -Required $true
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
Write-Host '[skip] Validate repo registry (strict)'
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (-not $SkipRoutingEvals) {
|
|
351
|
+
Invoke-Step -Name 'Run routing evals' -Action {
|
|
352
|
+
$py = Get-PythonCommand
|
|
353
|
+
$cmd = $py[0]
|
|
354
|
+
$pyParts = @()
|
|
355
|
+
if ($py.Length -gt 1) {
|
|
356
|
+
$pyParts = $py[1..($py.Length - 1)]
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
$script:StepLogs['routing-evals'] = Invoke-LoggedAction -StepName 'routing-evals' -Action {
|
|
360
|
+
& $cmd @pyParts .\scripts\intake\run-routing-evals.py
|
|
361
|
+
}
|
|
362
|
+
} -Required $true
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
Write-Host '[skip] Run routing evals'
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (-not $SkipGraphRefresh) {
|
|
369
|
+
Invoke-Step -Name 'Refresh codegraph index sync' -Action {
|
|
370
|
+
if (-not (Get-Command codegraph -ErrorAction SilentlyContinue)) {
|
|
371
|
+
throw 'codegraph command not found'
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
$script:StepLogs['codegraph-sync'] = Invoke-LoggedAction -StepName 'codegraph-sync' -Action {
|
|
375
|
+
& codegraph sync
|
|
376
|
+
}
|
|
377
|
+
} -Required $false
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
Write-Host '[skip] Refresh codegraph index sync'
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (-not $SkipIntakeRefresh) {
|
|
384
|
+
Invoke-Step -Name 'Refresh repo intake artifacts' -Action {
|
|
385
|
+
$script:StepLogs['repo-intake-refresh'] = Invoke-LoggedAction -StepName 'repo-intake-refresh' -Action {
|
|
386
|
+
& .\scripts\intake\run-repo-intake.cmd
|
|
387
|
+
}
|
|
388
|
+
} -Required $true
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
Write-Host '[skip] Refresh repo intake artifacts'
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (-not $SkipSiblingDiscoveryRefresh) {
|
|
395
|
+
Invoke-Step -Name 'Refresh sibling repos discovery proposal' -Action {
|
|
396
|
+
$py = Get-PythonCommand
|
|
397
|
+
$cmd = $py[0]
|
|
398
|
+
$pyParts = @()
|
|
399
|
+
if ($py.Length -gt 1) {
|
|
400
|
+
$pyParts = $py[1..($py.Length - 1)]
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
$script:StepLogs['sibling-discovery-refresh'] = Invoke-LoggedAction -StepName 'sibling-discovery-refresh' -Action {
|
|
404
|
+
& $cmd @pyParts .\scripts\discovery\discover-boost-repos.py --root C:/repo
|
|
405
|
+
}
|
|
406
|
+
} -Required $false
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
Write-Host '[skip] Refresh sibling repos discovery proposal'
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (-not $SkipRepomixRefresh) {
|
|
413
|
+
Invoke-Step -Name 'Refresh repomix context export' -Action {
|
|
414
|
+
$repomixLogPath = Invoke-LoggedAction -StepName 'repomix-refresh' -Action {
|
|
415
|
+
& pwsh -NoProfile -ExecutionPolicy Bypass -File .\scripts\context\build-repomix.ps1
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
$repomixOutputPath = Join-Path $repoRoot 'context/repomix/repomix-output.xml'
|
|
419
|
+
Write-Host ("[info] Repomix output: {0}" -f $repomixOutputPath)
|
|
420
|
+
Write-Host ("[info] Repomix log: {0}" -f $repomixLogPath)
|
|
421
|
+
$script:StepLogs['repomix-refresh'] = $repomixLogPath
|
|
422
|
+
} -Required $false
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
Write-Host '[skip] Refresh repomix context export'
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (-not $SkipProjectNotesRefresh) {
|
|
429
|
+
Invoke-Step -Name 'Refresh project notes from observability' -Action {
|
|
430
|
+
$py = Get-PythonCommand
|
|
431
|
+
$cmd = $py[0]
|
|
432
|
+
$pyParts = @()
|
|
433
|
+
if ($py.Length -gt 1) {
|
|
434
|
+
$pyParts = $py[1..($py.Length - 1)]
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
$script:StepLogs['project-notes-refresh'] = Invoke-LoggedAction -StepName 'project-notes-refresh' -Action {
|
|
438
|
+
& $cmd @pyParts .\scripts\discovery\refresh-project-notes.py
|
|
439
|
+
}
|
|
440
|
+
} -Required $false
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
Write-Host '[skip] Refresh project notes from observability'
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (-not $SkipLearningRefresh) {
|
|
447
|
+
Invoke-Step -Name 'Refresh learning loop report' -Action {
|
|
448
|
+
$py = Get-PythonCommand
|
|
449
|
+
$cmd = $py[0]
|
|
450
|
+
$pyParts = @()
|
|
451
|
+
if ($py.Length -gt 1) {
|
|
452
|
+
$pyParts = $py[1..($py.Length - 1)]
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
$script:StepLogs['learning-loop-refresh'] = Invoke-LoggedAction -StepName 'learning-loop-refresh' -Action {
|
|
456
|
+
& $cmd @pyParts .\scripts\learning\learning-loop-report.py
|
|
457
|
+
}
|
|
458
|
+
} -Required $false
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
Write-Host '[skip] Refresh learning loop report'
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (-not $SkipCopilotUsageIngest) {
|
|
465
|
+
Invoke-Step -Name 'Ingest Copilot session token usage (best effort)' -Action {
|
|
466
|
+
$py = Get-PythonCommand
|
|
467
|
+
$cmd = $py[0]
|
|
468
|
+
$pyParts = @()
|
|
469
|
+
if ($py.Length -gt 1) {
|
|
470
|
+
$pyParts = $py[1..($py.Length - 1)]
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
$sessionLogPath = Resolve-CopilotSessionLogPath
|
|
474
|
+
if ([string]::IsNullOrWhiteSpace($sessionLogPath)) {
|
|
475
|
+
Write-Host '[info] No Copilot session log found. Skipping ingest step without error.'
|
|
476
|
+
return
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
Write-Host ("[info] Using Copilot session log: {0}" -f $sessionLogPath)
|
|
480
|
+
|
|
481
|
+
& $cmd @pyParts .\scripts\learning\ingest-copilot-session-usage.py --session-log $sessionLogPath
|
|
482
|
+
if ($LASTEXITCODE -ne 0) {
|
|
483
|
+
throw "ingest-copilot-session-usage failed with exit code $LASTEXITCODE"
|
|
484
|
+
}
|
|
485
|
+
} -Required $false
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
Write-Host '[skip] Ingest Copilot session token usage (best effort)'
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (-not $SkipChatTokenUsageReport) {
|
|
492
|
+
Invoke-Step -Name 'Refresh chat token usage report' -Action {
|
|
493
|
+
$py = Get-PythonCommand
|
|
494
|
+
$cmd = $py[0]
|
|
495
|
+
$pyParts = @()
|
|
496
|
+
if ($py.Length -gt 1) {
|
|
497
|
+
$pyParts = $py[1..($py.Length - 1)]
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
$plan = $env:COPILOT_PLAN
|
|
501
|
+
if ([string]::IsNullOrWhiteSpace($plan)) {
|
|
502
|
+
$plan = 'business'
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
$seats = $env:COPILOT_SEATS
|
|
506
|
+
if ([string]::IsNullOrWhiteSpace($seats)) {
|
|
507
|
+
$seats = '1'
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
Write-Host "[info] chat-token-usage-report plan=$plan seats=$seats"
|
|
511
|
+
& $cmd @pyParts .\scripts\learning\chat-token-usage-report.py --plan $plan --seats $seats
|
|
512
|
+
if ($LASTEXITCODE -ne 0) {
|
|
513
|
+
throw "chat-token-usage-report failed with exit code $LASTEXITCODE"
|
|
514
|
+
}
|
|
515
|
+
} -Required $false
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
Write-Host '[skip] Refresh chat token usage report'
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (-not $SkipIterationValueRefresh) {
|
|
522
|
+
Invoke-Step -Name 'Refresh iteration value report' -Action {
|
|
523
|
+
$py = Get-PythonCommand
|
|
524
|
+
$cmd = $py[0]
|
|
525
|
+
$pyParts = @()
|
|
526
|
+
if ($py.Length -gt 1) {
|
|
527
|
+
$pyParts = $py[1..($py.Length - 1)]
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
$script:StepLogs['iteration-value-refresh'] = Invoke-LoggedAction -StepName 'iteration-value-refresh' -Action {
|
|
531
|
+
& $cmd @pyParts .\scripts\learning\iteration-value-report.py
|
|
532
|
+
}
|
|
533
|
+
} -Required $false
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
Write-Host '[skip] Refresh iteration value report'
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (-not $SkipRetentionCleanup) {
|
|
540
|
+
Invoke-Step -Name 'Apply observability retention cleanup' -Action {
|
|
541
|
+
$script:RetentionCleanupReport = Invoke-ObservabilityRetentionCleanup -RepoRoot $repoRoot -DaysToKeep $RetentionDays
|
|
542
|
+
Write-Host ("[info] Retention policy: keep_last_days={0}, deleted_files={1}, deleted_bytes={2}" -f $script:RetentionCleanupReport.days, $script:RetentionCleanupReport.deleted_files, $script:RetentionCleanupReport.deleted_bytes)
|
|
543
|
+
} -Required $false
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
Write-Host '[skip] Apply observability retention cleanup'
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (-not $SkipCodegraphStatus) {
|
|
550
|
+
Invoke-Step -Name 'Check codegraph status' -Action {
|
|
551
|
+
if (-not (Get-Command codegraph -ErrorAction SilentlyContinue)) {
|
|
552
|
+
throw 'codegraph command not found'
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
$script:StepLogs['codegraph-status'] = Invoke-LoggedAction -StepName 'codegraph-status' -Action {
|
|
556
|
+
& codegraph status
|
|
557
|
+
}
|
|
558
|
+
} -Required $false
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
Write-Host '[skip] Check codegraph status'
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (-not $SkipGitSnapshot) {
|
|
565
|
+
Invoke-Step -Name 'Collect git snapshot' -Action {
|
|
566
|
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
|
567
|
+
throw 'git command not found'
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
$branch = (git rev-parse --abbrev-ref HEAD).Trim()
|
|
571
|
+
$statusLines = @(git status --porcelain)
|
|
572
|
+
$changed = $statusLines.Count
|
|
573
|
+
$staged = @($statusLines | Where-Object { $_.Length -ge 1 -and $_.Substring(0, 1) -ne ' ' }).Count
|
|
574
|
+
$unstaged = @($statusLines | Where-Object { $_.Length -ge 2 -and $_.Substring(1, 1) -ne ' ' }).Count
|
|
575
|
+
|
|
576
|
+
$sample = @($statusLines | Select-Object -First 5) -join '; '
|
|
577
|
+
Write-Host "[info] Branch: $branch"
|
|
578
|
+
Write-Host "[info] Staged: $staged, Unstaged: $unstaged"
|
|
579
|
+
if ($sample) {
|
|
580
|
+
Write-Host "[info] Sample changes: $sample"
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if ($changed -gt 0) {
|
|
584
|
+
Write-Host "[info] Uncommitted changes detected: $changed"
|
|
585
|
+
}
|
|
586
|
+
} -Required $false
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
Write-Host '[skip] Collect git snapshot'
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
$endedAt = Get-Date
|
|
593
|
+
$summary = Get-ByeSummary -RepoRoot $repoRoot -StartedAt $startedAt -EndedAt $endedAt
|
|
594
|
+
$report = [ordered]@{
|
|
595
|
+
session = 'bye'
|
|
596
|
+
started_at = $startedAt.ToString('o')
|
|
597
|
+
ended_at = $endedAt.ToString('o')
|
|
598
|
+
duration_sec = [math]::Round((($endedAt - $startedAt).TotalSeconds), 2)
|
|
599
|
+
repo = 'workspace-root'
|
|
600
|
+
success = (-not $script:HasFailures)
|
|
601
|
+
summary = $summary
|
|
602
|
+
step_logs = $script:StepLogs
|
|
603
|
+
steps = $script:Steps
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
$reportDir = Join-Path $repoRoot 'observability/logs/session'
|
|
607
|
+
New-Item -ItemType Directory -Path $reportDir -Force | Out-Null
|
|
608
|
+
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
|
609
|
+
$reportPath = Join-Path $reportDir "bye-$stamp.json"
|
|
610
|
+
$report | ConvertTo-Json -Depth 8 | Set-Content -Path $reportPath -Encoding UTF8
|
|
611
|
+
|
|
612
|
+
Write-ByeSummary -Summary $summary -ReportPath $reportPath
|
|
613
|
+
|
|
614
|
+
if ($script:HasFailures) {
|
|
615
|
+
Write-Host 'BYE shutdown checks finished with errors.' -ForegroundColor Red
|
|
616
|
+
exit 1
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
Write-Host 'BYE shutdown checks completed successfully.' -ForegroundColor Green
|
|
620
|
+
exit 0
|