pi-harness-runtime 1.1.405 → 1.1.407

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.
Files changed (128) hide show
  1. package/index.ts +67 -0
  2. package/package.json +1 -1
  3. package/packages/a2a-adapter/package.json +1 -1
  4. package/packages/agent-policy/package.json +1 -1
  5. package/packages/architecture-generator/package.json +1 -1
  6. package/packages/auth/package.json +1 -1
  7. package/packages/autonomous-refactor/package.json +1 -1
  8. package/packages/autonomous-runtime/package.json +1 -1
  9. package/packages/cache-strategy/package.json +1 -1
  10. package/packages/capability-registry/package.json +1 -1
  11. package/packages/checkpoint/package.json +1 -1
  12. package/packages/cli-plugin-sdk/package.json +1 -1
  13. package/packages/clipboard/package.json +1 -1
  14. package/packages/clipboard-plugin/package.json +1 -1
  15. package/packages/code-generation/package.json +1 -1
  16. package/packages/code-review/package.json +1 -1
  17. package/packages/codex-adapter/package.json +1 -1
  18. package/packages/codex-watcher/package.json +1 -1
  19. package/packages/config-capture/package.json +1 -1
  20. package/packages/connection-runtime/package.json +1 -1
  21. package/packages/context-compiler/package.json +1 -1
  22. package/packages/context-discovery/package.json +1 -1
  23. package/packages/context-manager/package.json +1 -1
  24. package/packages/contracts/package.json +1 -1
  25. package/packages/cookie-sanitizer/package.json +1 -1
  26. package/packages/cost-optimizer/package.json +1 -1
  27. package/packages/dependency-analyzer/package.json +1 -1
  28. package/packages/django-plugin/package.json +1 -1
  29. package/packages/doc-generator/package.json +1 -1
  30. package/packages/durable-review/package.json +1 -1
  31. package/packages/e2e-tester/package.json +1 -1
  32. package/packages/evaluation-engine/package.json +1 -1
  33. package/packages/evaluation-runner/package.json +1 -1
  34. package/packages/event-bus/package.json +1 -1
  35. package/packages/event-sink/package.json +1 -1
  36. package/packages/event-store/package.json +1 -1
  37. package/packages/experience-replay/package.json +1 -1
  38. package/packages/feedback-collector/package.json +1 -1
  39. package/packages/file-copy-helper/package.json +1 -1
  40. package/packages/framework-detector/package.json +1 -1
  41. package/packages/framework-plugin-sdk/package.json +1 -1
  42. package/packages/frappe-plugin/package.json +1 -1
  43. package/packages/generic-web-plugin/package.json +1 -1
  44. package/packages/health-monitor/package.json +1 -1
  45. package/packages/intent-analyzer/package.json +1 -1
  46. package/packages/jev-judge/package.json +1 -1
  47. package/packages/knowledge-graph/package.json +1 -1
  48. package/packages/knowledge-retrieval/package.json +1 -1
  49. package/packages/laravel-plugin/package.json +1 -1
  50. package/packages/learning-engine/package.json +1 -1
  51. package/packages/logging/package.json +1 -1
  52. package/packages/mcp-adapter/package.json +1 -1
  53. package/packages/memory-engine/package.json +1 -1
  54. package/packages/milestone-manager/package.json +1 -1
  55. package/packages/model-registry/package.json +1 -1
  56. package/packages/nextjs-plugin/package.json +1 -1
  57. package/packages/notification/package.json +1 -1
  58. package/packages/observability/package.json +1 -1
  59. package/packages/okf-indexer/package.json +1 -1
  60. package/packages/paperclip-integration/package.json +1 -1
  61. package/packages/performance-optimizer/package.json +1 -1
  62. package/packages/permission-mode/package.json +1 -1
  63. package/packages/privilege-broker/package.json +1 -1
  64. package/packages/project-analyzer/package.json +1 -1
  65. package/packages/project-bootstrap/package.json +1 -1
  66. package/packages/projection-engine/package.json +1 -1
  67. package/packages/prompt-compiler/package.json +1 -1
  68. package/packages/prompt-versioning/package.json +1 -1
  69. package/packages/provider-adapter-sdk/package.json +1 -1
  70. package/packages/provider-router/package.json +1 -1
  71. package/packages/provider-selector/package.json +1 -1
  72. package/packages/providers/package.json +1 -1
  73. package/packages/qdrant-skills/package.json +1 -1
  74. package/packages/quota-manager/package.json +1 -1
  75. package/packages/rate-limiter/package.json +1 -1
  76. package/packages/react-vite-plugin/package.json +1 -1
  77. package/packages/relay/package.json +1 -1
  78. package/packages/release-manager/package.json +1 -1
  79. package/packages/requirement-compiler/package.json +1 -1
  80. package/packages/runtime/package.json +1 -1
  81. package/packages/scheduler/package.json +1 -1
  82. package/packages/scheduler-adapter/package.json +1 -1
  83. package/packages/session/package.json +1 -1
  84. package/packages/session-api/package.json +1 -1
  85. package/packages/session-export/package.json +1 -1
  86. package/packages/shared-context/package.json +1 -1
  87. package/packages/skill-mcp-client/package.json +1 -1
  88. package/packages/skill-registry/package.json +1 -1
  89. package/packages/skills/package.json +1 -1
  90. package/packages/sprint-planner/package.json +1 -1
  91. package/packages/subscription-engine/package.json +1 -1
  92. package/packages/task-compiler/package.json +1 -1
  93. package/packages/telegram/package.json +1 -1
  94. package/packages/tencentdb-memory/package.json +1 -1
  95. package/packages/tencentdb-sync/package.json +1 -1
  96. package/packages/test-data-generator/package.json +1 -1
  97. package/packages/test-generator/package.json +1 -1
  98. package/packages/todo-bd-sync/package.json +1 -1
  99. package/packages/token-estimation/package.json +1 -1
  100. package/packages/token-optimizer/package.json +1 -1
  101. package/packages/tooling-preference/dist/changed-files.d.ts +45 -0
  102. package/packages/tooling-preference/dist/changed-files.d.ts.map +1 -0
  103. package/packages/tooling-preference/dist/changed-files.js +125 -0
  104. package/packages/tooling-preference/dist/changed-files.js.map +1 -0
  105. package/packages/tooling-preference/dist/index.d.ts +2 -0
  106. package/packages/tooling-preference/dist/index.d.ts.map +1 -1
  107. package/packages/tooling-preference/dist/index.js +2 -0
  108. package/packages/tooling-preference/dist/index.js.map +1 -1
  109. package/packages/tooling-preference/dist/quality-check.d.ts +75 -0
  110. package/packages/tooling-preference/dist/quality-check.d.ts.map +1 -0
  111. package/packages/tooling-preference/dist/quality-check.js +216 -0
  112. package/packages/tooling-preference/dist/quality-check.js.map +1 -0
  113. package/packages/tooling-preference/package.json +1 -1
  114. package/packages/tooling-preference/src/changed-files.ts +147 -0
  115. package/packages/tooling-preference/src/index.ts +19 -0
  116. package/packages/tooling-preference/src/quality-check.ts +279 -0
  117. package/packages/tooling-preference/tests/changed-files.test.ts +124 -0
  118. package/packages/tooling-preference/tests/quality-check.test.ts +272 -0
  119. package/packages/trajectory/package.json +1 -1
  120. package/packages/tui/package.json +1 -1
  121. package/packages/types/package.json +1 -1
  122. package/packages/voice-api/package.json +1 -1
  123. package/packages/webmcp-tester/package.json +1 -1
  124. package/packages/wiki/package.json +1 -1
  125. package/packages/workflow-events/package.json +1 -1
  126. package/packages/workspace-scanner/package.json +1 -1
  127. package/packages/worktree/package.json +1 -1
  128. package/packages/write-review/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/performance-optimizer",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Performance optimization analyzer for pi-harness runtime (RFC-0056)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/permission-mode",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "description": "Runtime permission modes for pi-harness - Supervised/Auto/Full-access",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/privilege-broker",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Privilege Broker — capability registry and command executor for autonomous runtime (RFC-0101 §7)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/project-analyzer",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Project analysis system for pi-harness-runtime - detects frameworks, rules, and project structure",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/project-bootstrap",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Project scaffolding from typed ProjectSpec",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/projection-engine",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/prompt-compiler",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Deterministic prompt compiler for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/prompt-versioning",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "description": "Version control for prompts with rollback support (RFC-0019)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/provider-adapter-sdk",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "SDK for building, testing, and registering AI provider adapters",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/provider-router",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Enhanced Provider Router for pi-harness-runtime — intelligent routing with capabilities, costs, and quotas",
5
5
  "type": "module",
6
6
  "main": "./dist/provider-router.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/provider-selector",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Multi-Provider Selector — route requests by cost, quality, and latency (RFC-0012)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/providers",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "pi-harness-runtime — providers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/qdrant-skills",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Qdrant vector search integration for Hermes-style skill system",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/quota-manager",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "pi-harness-runtime — quota-manager",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/rate-limiter",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "description": "Rate limiting with token bucket algorithm (RFC-0023)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/react-vite-plugin",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "React/Vite framework analysis — components, config, TypeScript setup",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/relay",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "description": "Cloud relay for remote access - T3 Connect style for pi-harness",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/release-manager",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "description": "Release management for pi-harness",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/requirement-compiler",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Compiles raw requirements into validated CompiledRequirement with ambiguity detection and risk tagging",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/runtime",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "pi-harness-runtime — runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/scheduler",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "pi-harness-runtime — scheduler",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/scheduler-adapter",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Scheduler Adapter — cron, systemd, launchd, internal adapters for autonomous runtime (RFC-0101 §6)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/session",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Session management system for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/session-api",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/session-export",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/shared-context",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "pi-harness-runtime — shared-context",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/skill-mcp-client",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "MCP client for Skills SaaS backend",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/skill-registry",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Skill Registry for pi-harness-runtime — dynamic skill discovery and invocation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/skills",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "File-based skill system with pi.dev compatibility and Hermes self-improvement",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/sprint-planner",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "description": "Sprint planning engine for pi-harness",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/subscription-engine",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/task-compiler",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Task Compiler for pi-harness-runtime — produces deterministic task DAG from CompiledRequirement",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/telegram",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "pi-harness-runtime — Telegram inbound/outbound",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/tencentdb-memory",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "TencentDB Agent Memory client - sync skills to centralized knowledge base",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/tencentdb-sync",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Sync SKILL.md skills to TencentDB-Agent-Memory server (RFC-0105/0106)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/test-data-generator",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Test data generation for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/test-generator",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Auto-Test Generator — generate unit and E2E tests from source code (RFC-0013)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/todo-bd-sync",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Two-way sync between rpiv-todo overlay and bd issue tracker",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-estimation",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "pi-harness-runtime — token-estimation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-optimizer",
3
- "version": "1.1.405",
3
+ "version": "1.1.407",
4
4
  "description": "Token Budget Optimizer — maximize prompt value within token limits (RFC-0011)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The JavaScript/TypeScript files a session changed.
3
+ *
4
+ * The harness has no list of "the files Pi changed": the worktree is the
5
+ * only honest source. The detection reads the git status of the workspace
6
+ * (modified, staged and untracked files) and keeps the JavaScript and
7
+ * TypeScript ones. A workspace that is not a git repository yields nothing
8
+ * - the harness never guesses which files belong to the session.
9
+ */
10
+ /** The extensions the quality check looks at. */
11
+ export declare const JS_TS_EXTENSIONS: readonly [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
12
+ export interface ChangedFilesResult {
13
+ /** The changed JS/TS files, relative to the workspace root. */
14
+ files: string[];
15
+ /** Was the worktree read at all? */
16
+ detected: boolean;
17
+ /** Why the result is what it is - a human wording. */
18
+ reason: string;
19
+ }
20
+ /**
21
+ * Is this path a JavaScript or TypeScript source file?
22
+ */
23
+ export declare function isJsTsFile(path: string): boolean;
24
+ /**
25
+ * Is this path inside a directory the check must not read?
26
+ */
27
+ export declare function isIgnoredPath(path: string): boolean;
28
+ /**
29
+ * Parse the output of `git status --porcelain -z`.
30
+ *
31
+ * Every record is "XY <path>"; a rename or a copy carries the original
32
+ * path in the next record, which is not a change of its own.
33
+ */
34
+ export declare function parseGitStatus(output: string): string[];
35
+ /**
36
+ * The JavaScript/TypeScript files that changed in the workspace.
37
+ *
38
+ * The detection never fails the session: a workspace without git (or
39
+ * without a repository) simply has no changed files.
40
+ */
41
+ export declare function detectChangedJsTsFiles(workspaceRoot: string, options?: {
42
+ timeoutMs?: number;
43
+ gitBin?: string;
44
+ }): ChangedFilesResult;
45
+ //# sourceMappingURL=changed-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changed-files.d.ts","sourceRoot":"","sources":["../src/changed-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,YAC5B,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,CACG,CAAC;AAaX,MAAM,WAAW,kBAAkB;IAClC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGhD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKnD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBvD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,kBAAkB,CAmDpB"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * The JavaScript/TypeScript files a session changed.
3
+ *
4
+ * The harness has no list of "the files Pi changed": the worktree is the
5
+ * only honest source. The detection reads the git status of the workspace
6
+ * (modified, staged and untracked files) and keeps the JavaScript and
7
+ * TypeScript ones. A workspace that is not a git repository yields nothing
8
+ * - the harness never guesses which files belong to the session.
9
+ */
10
+ import { spawnSync } from "node:child_process";
11
+ /** The extensions the quality check looks at. */
12
+ export const JS_TS_EXTENSIONS = [
13
+ ".ts",
14
+ ".tsx",
15
+ ".mts",
16
+ ".cts",
17
+ ".js",
18
+ ".jsx",
19
+ ".mjs",
20
+ ".cjs",
21
+ ];
22
+ /** Directories that never hold source the check should read. */
23
+ const IGNORED_PATH_PARTS = new Set([
24
+ "node_modules",
25
+ "dist",
26
+ "build",
27
+ "out",
28
+ "coverage",
29
+ ".next",
30
+ ".turbo",
31
+ ]);
32
+ /**
33
+ * Is this path a JavaScript or TypeScript source file?
34
+ */
35
+ export function isJsTsFile(path) {
36
+ const lower = path.toLowerCase();
37
+ return JS_TS_EXTENSIONS.some((extension) => lower.endsWith(extension));
38
+ }
39
+ /**
40
+ * Is this path inside a directory the check must not read?
41
+ */
42
+ export function isIgnoredPath(path) {
43
+ return path
44
+ .split("/")
45
+ .filter((part) => part.length > 0)
46
+ .some((part) => IGNORED_PATH_PARTS.has(part));
47
+ }
48
+ /**
49
+ * Parse the output of `git status --porcelain -z`.
50
+ *
51
+ * Every record is "XY <path>"; a rename or a copy carries the original
52
+ * path in the next record, which is not a change of its own.
53
+ */
54
+ export function parseGitStatus(output) {
55
+ const paths = [];
56
+ const records = output.split("\0").filter((record) => record.length > 0);
57
+ for (let index = 0; index < records.length; index++) {
58
+ const record = records[index];
59
+ if (!record || record.length < 4)
60
+ continue;
61
+ const status = record.slice(0, 2);
62
+ const path = record.slice(3).trim();
63
+ if (!path)
64
+ continue;
65
+ paths.push(path);
66
+ // A rename or a copy is followed by the original path.
67
+ if (status.includes("R") || status.includes("C"))
68
+ index++;
69
+ }
70
+ return paths;
71
+ }
72
+ /**
73
+ * The JavaScript/TypeScript files that changed in the workspace.
74
+ *
75
+ * The detection never fails the session: a workspace without git (or
76
+ * without a repository) simply has no changed files.
77
+ */
78
+ export function detectChangedJsTsFiles(workspaceRoot, options = {}) {
79
+ const timeoutMs = options.timeoutMs ?? 5000;
80
+ const gitBin = options.gitBin ?? "git";
81
+ let output = "";
82
+ try {
83
+ const result = spawnSync(gitBin, ["status", "--porcelain=v1", "-z", "--untracked-files=all"], {
84
+ cwd: workspaceRoot,
85
+ encoding: "utf8",
86
+ timeout: timeoutMs,
87
+ maxBuffer: 8 * 1024 * 1024,
88
+ });
89
+ if (result.error || result.status !== 0) {
90
+ return {
91
+ files: [],
92
+ detected: false,
93
+ reason: result.error
94
+ ? "git could not be run"
95
+ : "the workspace is not a git repository",
96
+ };
97
+ }
98
+ output = result.stdout ?? "";
99
+ }
100
+ catch {
101
+ return { files: [], detected: false, reason: "git could not be run" };
102
+ }
103
+ const seen = new Set();
104
+ const files = [];
105
+ for (const path of parseGitStatus(output)) {
106
+ const normalized = path.replace(/\\/g, "/");
107
+ if (seen.has(normalized))
108
+ continue;
109
+ if (!isJsTsFile(normalized) || isIgnoredPath(normalized))
110
+ continue;
111
+ seen.add(normalized);
112
+ files.push(normalized);
113
+ }
114
+ files.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
115
+ let reason = "no changed file";
116
+ if (files.length > 0) {
117
+ reason = `${files.length} changed file(s)`;
118
+ }
119
+ return {
120
+ files,
121
+ detected: true,
122
+ reason,
123
+ };
124
+ }
125
+ //# sourceMappingURL=changed-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changed-files.js","sourceRoot":"","sources":["../src/changed-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,iDAAiD;AACjD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;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,CAAC;QACR,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACvE,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YAAE,SAAS;QACnC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC;YAAE,SAAS;QACnE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,IAAI,MAAM,GAAG,iBAAiB,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,kBAAkB,CAAC;IAC5C,CAAC;IAED,OAAO;QACN,KAAK;QACL,QAAQ,EAAE,IAAI;QACd,MAAM;KACN,CAAC;AACH,CAAC"}
@@ -10,4 +10,6 @@ export { detectPackageManager, detectToolingContext, evaluateBiomeProposalEligib
10
10
  export { buildToolingButtons, buildToolingImplementationPrompt, buildToolingProposalMessage, buildToolingRequestId, buildToolingUserKey, parseToolingTarget, TOOLING_ACTION, type ToolingButton, type ToolingChoice, type ToolingPreference, type ToolingTarget, } from "./proposal.js";
11
11
  export { harnessRuntimeDir, shouldAskAgain, ToolingPreferenceStore, toolingPreferenceKey, type ToolingPreferenceRecord, } from "./store.js";
12
12
  export { ToolingRequestRegistry, type ToolingRequest, type ToolingResolution, } from "./registry.js";
13
+ export { detectChangedJsTsFiles, isIgnoredPath, isJsTsFile, parseGitStatus, JS_TS_EXTENSIONS, type ChangedFilesResult, } from "./changed-files.js";
14
+ export { formatQualityCheckStatus, readWorkspaceScripts, runQualityCheck, selectQualityCheck, type QualityCheckPlan, type QualityCheckResult, type QualityCheckTool, } from "./quality-check.js";
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,EAChC,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,mBAAmB,EACnB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,uBAAuB,GAC5B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACtB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,EAChC,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,mBAAmB,EACnB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,uBAAuB,GAC5B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,KAAK,kBAAkB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACrB,MAAM,oBAAoB,CAAC"}
@@ -10,4 +10,6 @@ export { detectPackageManager, detectToolingContext, evaluateBiomeProposalEligib
10
10
  export { buildToolingButtons, buildToolingImplementationPrompt, buildToolingProposalMessage, buildToolingRequestId, buildToolingUserKey, parseToolingTarget, TOOLING_ACTION, } from "./proposal.js";
11
11
  export { harnessRuntimeDir, shouldAskAgain, ToolingPreferenceStore, toolingPreferenceKey, } from "./store.js";
12
12
  export { ToolingRequestRegistry, } from "./registry.js";
13
+ export { detectChangedJsTsFiles, isIgnoredPath, isJsTsFile, parseGitStatus, JS_TS_EXTENSIONS, } from "./changed-files.js";
14
+ export { formatQualityCheckStatus, readWorkspaceScripts, runQualityCheck, selectQualityCheck, } from "./quality-check.js";
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,GAGhC,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,mBAAmB,EACnB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GAKd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,GAEpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,sBAAsB,GAGtB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,GAGhC,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,mBAAmB,EACnB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GAKd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,GAEpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,sBAAsB,GAGtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,cAAc,EACd,gBAAgB,GAEhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GAIlB,MAAM,oBAAoB,CAAC"}