phasegate 0.73.0 → 0.83.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/package.json +1 -1
  3. package/scripts/harness/agent-integration/{infrastructure → application}/ports/cli-executor-port.ts +2 -2
  4. package/scripts/harness/agent-integration/application/usecases/handle-post-tool-use-usecase.ts +2 -2
  5. package/scripts/harness/agent-integration/application/usecases/handle-pre-tool-use-usecase.ts +60 -11
  6. package/scripts/harness/agent-integration/application/usecases/handle-stop-usecase.ts +1 -1
  7. package/scripts/harness/agent-integration/domain/ports/phase-gate-query-port.ts +6 -0
  8. package/scripts/harness/agent-integration/domain/services/fallback-verification-service.ts +2 -17
  9. package/scripts/harness/agent-integration/index.ts +3 -4
  10. package/scripts/harness/agent-integration/infrastructure/adapters/child-process-cli-executor-adapter.ts +2 -2
  11. package/scripts/harness/agent-integration/infrastructure/adapters/env-file-reentry-guard-state-adapter.ts +2 -10
  12. package/scripts/harness/agent-integration/infrastructure/adapters/phase-gate-query-adapter.ts +30 -0
  13. package/scripts/harness/agent-integration/presentation/session-start-hook.ts +2 -17
  14. package/scripts/harness/agent-integration/presentation/user-prompt-submit-hook.ts +2 -21
  15. package/scripts/harness/biome-ast-engine/composition-root.ts +2 -18
  16. package/scripts/harness/biome-ast-engine/domain/services/lint-runner.ts +19 -3
  17. package/scripts/harness/biome-ast-engine/domain/services/rule-definition-registry.ts +28 -3
  18. package/scripts/harness/biome-ast-engine/domain/value-objects/import-graph.ts +22 -6
  19. package/scripts/harness/biome-ast-engine/infrastructure/adapters/typescript-source-module-analyzer-adapter.ts +38 -48
  20. package/scripts/harness/biome-ast-engine/infrastructure/parsers/layer-comment-parser.ts +2 -8
  21. package/scripts/harness/biome-ast-engine/infrastructure/parsers/unit-comment-parser.ts +3 -10
  22. package/scripts/harness/ci-governance/application/usecases/generate-ci-template-usecase.ts +2 -2
  23. package/scripts/harness/ci-governance/domain/types/lesson-artifact.ts +5 -13
  24. package/scripts/harness/ci-governance/domain/types/template-type.ts +2 -6
  25. package/scripts/harness/ci-governance/domain/types/trigger-condition.ts +2 -6
  26. package/scripts/harness/ci-governance/infrastructure/adapters/harness-api-command-existence-adapter.ts +2 -6
  27. package/scripts/harness/ci-governance/infrastructure/adapters/validator-id-registry-adapter.ts +2 -6
  28. package/scripts/harness/ci-governance/infrastructure/schema/error-history-schema.ts +2 -6
  29. package/scripts/harness/ci-governance/presentation/handlers/migrate-agents-md-handler.ts +1 -1
  30. package/scripts/harness/config-foundation/domain/errors/config-foundation-domain-error.ts +3 -6
  31. package/scripts/harness/config-foundation/domain/errors/invalid-preset-error.ts +3 -6
  32. package/scripts/harness/config-foundation/domain/harness-config.ts +2 -1
  33. package/scripts/harness/config-foundation/domain/value-objects/phase-dependencies-config.ts +2 -1
  34. package/scripts/harness/config-foundation/index.ts +2 -11
  35. package/scripts/harness/harness-error/application/dto/error-definition-summary.ts +3 -6
  36. package/scripts/harness/harness-error/application/dto/harness-error-contract.ts +3 -6
  37. package/scripts/harness/harness-error/application/dto/validator-issue-draft.ts +3 -6
  38. package/scripts/harness/harness-error/domain/errors/adr-reference-not-found-error.ts +3 -6
  39. package/scripts/harness/harness-error/domain/errors/duplicate-error-code-error.ts +3 -6
  40. package/scripts/harness/harness-error/domain/errors/invalid-adr-ref-error.ts +3 -6
  41. package/scripts/harness/harness-error/domain/errors/invalid-error-code-error.ts +3 -6
  42. package/scripts/harness/harness-error/domain/errors/invalid-severity-error.ts +3 -6
  43. package/scripts/harness/harness-error/domain/errors/missing-adr-ref-error.ts +3 -6
  44. package/scripts/harness/harness-error/domain/errors/missing-fix-example-error.ts +3 -6
  45. package/scripts/harness/harness-error/domain/errors/severity-downgrade-violation-error.ts +3 -6
  46. package/scripts/harness/harness-error/domain/errors/unknown-error-definition-error.ts +3 -6
  47. package/scripts/harness/harness-error/domain/ports/fix-example-validator-port.ts +3 -7
  48. package/scripts/harness/nyquist-validation/application/dto/analyze-impact-output.ts +2 -6
  49. package/scripts/harness/nyquist-validation/infrastructure/adapters/ajv-json-schema-validator-adapter.ts +7 -19
  50. package/scripts/harness/nyquist-validation/infrastructure/adapters/traceability-model-story-registry-adapter.ts +4 -8
  51. package/scripts/harness/phase-dependency-model/application/usecases/check-story-reflection-usecase.ts +2 -13
  52. package/scripts/harness/phase-dependency-model/domain/ports/story-reflection-file-system-port.ts +2 -6
  53. package/scripts/harness/quick-mode/application/dto/change-category-classification-contract.ts +3 -7
  54. package/scripts/harness/quick-mode/index.ts +2 -13
  55. package/scripts/harness/setup/skill-deployer.ts +3 -58
  56. package/scripts/harness/skill-quality/infrastructure/adapters/ajv-lesson-artifact-schema-adapter.ts +3 -3
  57. package/scripts/harness/validator-system/application/dto/run-full-validation-input.ts +4 -10
  58. package/scripts/harness/validator-system/domain/ports/adr-reference-port.ts +2 -6
  59. package/scripts/harness/validator-system/domain/ports/it-test-file-analyzer-port.ts +2 -10
  60. package/scripts/harness/validator-system/domain/ports/metadata-policy-port.ts +3 -6
  61. package/scripts/harness/validator-system/domain/ports/source-analysis-port.ts +2 -7
  62. package/scripts/harness/validator-system/domain/ports/source-code-analyzer-port.ts +2 -7
  63. package/scripts/harness/validator-system/domain/ports/source-file-text-scanner-port.ts +2 -9
  64. package/scripts/harness/validator-system/domain/ports/test-quality-analyzer-port.ts +3 -6
  65. package/scripts/harness/validator-system/domain/services/cli-e2e-test-existence-service.ts +3 -11
  66. package/scripts/harness/validator-system/domain/services/stub-comment-detection-service.ts +3 -8
  67. package/scripts/harness/validator-system/infrastructure/adapters/cli-command-registry-adapter.ts +3 -7
  68. package/scripts/harness/agent-integration/domain/ports/import-analyzer-port.ts +0 -13
  69. package/scripts/harness/agent-integration/infrastructure/adapters/regex-import-analyzer-adapter.ts +0 -69
  70. package/scripts/harness/ci-governance/application/dto/validate-pointers-input.ts +0 -8
  71. package/scripts/harness/ci-governance/presentation/dto/ci-governance-render-options.ts +0 -9
  72. package/scripts/harness/ci-governance/presentation/formatters/error-repetition-formatter.ts +0 -26
  73. package/scripts/harness/config-foundation/infrastructure/registries/composite-feature-registry-adapter.ts +0 -22
  74. package/scripts/harness/nyquist-validation/domain/errors/story-not-found-error.ts +0 -14
  75. package/scripts/harness/nyquist-validation/presentation/dto/cli-render-options.ts +0 -12
  76. package/scripts/harness/quick-mode/application/dto/build-relaxation-profile-input.ts +0 -12
  77. package/scripts/harness/quick-mode/application/dto/execute-quick-ci-check-input.ts +0 -11
  78. package/scripts/harness/quick-mode/application/dto/judge-quick-mode-eligibility-input.ts +0 -10
  79. package/scripts/harness/quick-mode/domain/ports/quick-mode-config-port.ts +0 -12
  80. package/scripts/harness/quick-mode/domain/ports/validator-id-registry-port.ts +0 -10
  81. package/scripts/harness/shared-kernel/harness-api.ts +0 -6
  82. package/scripts/harness/shared-kernel/quick-mode.ts +0 -15
  83. package/scripts/harness/shared-kernel/validator-system.ts +0 -14
  84. package/scripts/harness/skill-quality/application/mappers/cascade-update-result-mapper.ts +0 -16
  85. package/scripts/harness/skill-quality/application/mappers/coverage-report-mapper.ts +0 -37
  86. package/scripts/harness/skill-quality/application/mappers/lesson-artifact-mapper.ts +0 -11
  87. package/scripts/harness/skill-quality/domain/types/unit-name.ts +0 -5
  88. package/scripts/harness/traceability-model/application/dto/metadata-validation-input.ts +0 -12
  89. package/scripts/harness/traceability-model/domain/constants/traceability-link-types.ts +0 -14
@@ -1,69 +0,0 @@
1
- /**
2
- * @layer infrastructure
3
- * @unit agent-integration
4
- *
5
- * RegexImportAnalyzerAdapter (TsMorphImportAnalyzerAdapter の代替実装)
6
- * ts-morph が利用不可のため、正規表現ベースの import 解析を実装する
7
- *
8
- * 設計注意: ts-morph は package.json に含まれていないため、
9
- * node:fs/promises + 正規表現で @anthropic-ai/claude-code の import を検出する
10
- */
11
-
12
- import * as fs from 'node:fs/promises';
13
- import type { ImportAnalyzerPort, ImportAnalysisResult } from '../../domain/ports/import-analyzer-port.js';
14
-
15
- /** エージェント固有APIのパターン */
16
- const AGENT_API_PATTERNS = [
17
- '@anthropic-ai/claude-code',
18
- 'claude-code',
19
- ];
20
-
21
- /**
22
- * TypeScript ファイルから import 文を解析し、
23
- * エージェント固有APIの import を検出する
24
- */
25
- function detectAgentImportsInContent(content: string): string[] {
26
- const detected: string[] = [];
27
- // import { ... } from '...' または import ... from '...' のパターン
28
- const importRegex = /import\s+(?:[^'"]*from\s+)?['"]([^'"]+)['"]/g;
29
- let match: RegExpExecArray | null;
30
-
31
- while ((match = importRegex.exec(content)) !== null) {
32
- const modulePath = match[1];
33
- if (modulePath && AGENT_API_PATTERNS.some((pattern) => modulePath === pattern || modulePath.startsWith(`${pattern}/`))) {
34
- if (!detected.includes(modulePath)) {
35
- detected.push(modulePath);
36
- }
37
- }
38
- }
39
-
40
- return detected;
41
- }
42
-
43
- export class RegexImportAnalyzerAdapter implements ImportAnalyzerPort {
44
- async analyzeAgentApiImports(targetFilePaths: string[]): Promise<ImportAnalysisResult[]> {
45
- if (targetFilePaths.length === 0) {
46
- return [];
47
- }
48
-
49
- const results: ImportAnalysisResult[] = [];
50
-
51
- for (const filePath of targetFilePaths) {
52
- let content: string;
53
- try {
54
- content = await fs.readFile(filePath, 'utf8');
55
- } catch (error) {
56
- // ファイルが存在しない場合はエラーを再スロー
57
- throw new Error(`ファイルの読み取りに失敗しました: ${filePath}: ${String(error)}`);
58
- }
59
-
60
- const agentApiImports = detectAgentImportsInContent(content);
61
- results.push({ filePath, agentApiImports });
62
- }
63
-
64
- return results;
65
- }
66
- }
67
-
68
- // TsMorphImportAnalyzerAdapter として同じクラスを re-export
69
- export { RegexImportAnalyzerAdapter as TsMorphImportAnalyzerAdapter };
@@ -1,8 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit ci-governance
4
- */
5
-
6
- export interface ValidatePointersInput {
7
- readonly includeAdrLinks: boolean;
8
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * @layer presentation
3
- * @unit ci-governance
4
- */
5
-
6
- export interface CiGovernanceRenderOptions {
7
- readonly format: 'human' | 'json';
8
- readonly verbose: boolean;
9
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * @layer presentation
3
- * @unit ci-governance
4
- */
5
-
6
- import type { RecordErrorOccurrenceOutput } from '../../application/dto/record-error-occurrence-output.js';
7
-
8
- export class ErrorRepetitionFormatter {
9
- formatHuman(output: RecordErrorOccurrenceOutput): string {
10
- const lines: string[] = [];
11
-
12
- lines.push(`Error occurrence recorded (count: ${output.currentCount})`);
13
- if (output.escalated) {
14
- lines.push('⚠️ ESCALATED: Error has occurred too many times');
15
- if (output.escalationAction) {
16
- lines.push(` [${output.escalationAction.logLevel.toUpperCase()}] ${output.escalationAction.messageTemplate}`);
17
- }
18
- }
19
-
20
- return lines.join('\n');
21
- }
22
-
23
- formatJson(output: RecordErrorOccurrenceOutput): string {
24
- return JSON.stringify(output, null, 2);
25
- }
26
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * @layer infrastructure
3
- * @unit config-foundation
4
- */
5
- import type { FeatureRegistryPort } from '../../domain/ports/feature-registry-port.js';
6
-
7
- export interface CompositeFeatureRegistryAdapterDependencies {
8
- readonly sources: readonly FeatureRegistryPort[];
9
- }
10
-
11
- export class CompositeFeatureRegistryAdapter implements FeatureRegistryPort {
12
- private readonly sources: readonly FeatureRegistryPort[];
13
-
14
- constructor(dependencies: CompositeFeatureRegistryAdapterDependencies) {
15
- this.sources = dependencies.sources;
16
- }
17
-
18
- listAvailable(): readonly string[] {
19
- const merged = this.sources.flatMap((source) => source.listAvailable());
20
- return [...new Set(merged)];
21
- }
22
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @layer domain
3
- * @unit nyquist-validation
4
- *
5
- * storyId が matrix に存在しない場合のエラー
6
- */
7
- import { NyquistDomainError } from './nyquist-domain-error.js';
8
-
9
- export class StoryNotFoundError extends NyquistDomainError {
10
- constructor(storyId: string) {
11
- super(`storyIdが見つかりません: ${storyId}`);
12
- this.name = 'StoryNotFoundError';
13
- }
14
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * @layer presentation
3
- * @unit nyquist-validation
4
- */
5
-
6
- export interface CliRenderOptions {
7
- readonly format: 'human' | 'agent' | 'json';
8
- readonly verbose: boolean;
9
- readonly color: boolean;
10
- }
11
-
12
- // @story-id H08-07
@@ -1,12 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit quick-mode
4
- *
5
- * BuildRelaxationProfileUseCase の入力 DTO
6
- */
7
-
8
- import type { QuickModeEligibilityContract } from './quick-mode-eligibility-contract.js';
9
-
10
- export interface BuildRelaxationProfileInput {
11
- readonly eligibilityContract: QuickModeEligibilityContract;
12
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit quick-mode
4
- *
5
- * ExecuteQuickCiCheckUseCase の入力 DTO
6
- */
7
-
8
- export interface ExecuteQuickCiCheckInput {
9
- readonly changedFiles?: readonly { filePath: string; changeKind: string }[];
10
- readonly dryRun?: boolean;
11
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit quick-mode
4
- *
5
- * JudgeQuickModeEligibilityUseCase の入力 DTO
6
- */
7
-
8
- export interface JudgeQuickModeEligibilityInput {
9
- readonly changedFiles?: readonly { filePath: string; changeKind: string }[];
10
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * @layer domain
3
- * @unit quick-mode
4
- *
5
- * QuickModeConfig取得のドメインポート
6
- */
7
-
8
- import type { QuickModeConfig } from '../value-objects/quick-mode-config.js';
9
-
10
- export interface QuickModeConfigPort {
11
- getQuickModeConfig(): Promise<QuickModeConfig>;
12
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * @layer domain
3
- * @unit quick-mode
4
- *
5
- * ValidatorId一覧取得のドメインポート
6
- */
7
-
8
- export interface ValidatorIdRegistryPort {
9
- getAllValidatorIds(): Promise<readonly string[]>;
10
- }
@@ -1,6 +0,0 @@
1
- // @layer domain
2
- // harness-api.ts — Shared Kernel public entry for harness-api types
3
-
4
- export type { HarnessApiResponseContract } from '../harness-api/application/dto/harness-api-response-contract.js';
5
- export { HarnessApiResponse } from '../harness-api/domain/value-objects/harness-api-response.js';
6
- export type { ResponseStatus, ExitCode, HarnessError, ResponseSummary } from '../harness-api/domain/value-objects/harness-api-response.js';
@@ -1,15 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit quick-mode
4
- *
5
- * quick-mode ユニットの Shared Kernel 公開面(Cross-Unit Contract 再エクスポート)
6
- */
7
-
8
- // Public DTOs (Shared Kernel contracts)
9
- export type { QuickModeDecisionContract } from '../quick-mode/application/dto/quick-mode-decision-contract.js';
10
- export type { QuickModeEligibilityContract } from '../quick-mode/application/dto/quick-mode-eligibility-contract.js';
11
- export type { ValidatorRelaxationProfileContract } from '../quick-mode/application/dto/validator-relaxation-profile-contract.js';
12
-
13
- // Composition Root
14
- export { createQuickModeCompositionRoot } from '../quick-mode/composition-root.js';
15
- export type { QuickModeCompositionRoot } from '../quick-mode/composition-root.js';
@@ -1,14 +0,0 @@
1
- /**
2
- * @layer shared-kernel
3
- * @unit validator-system
4
- *
5
- * Cross-Unit Contract 再エクスポート
6
- * ValidatorRegistry インターフェース + ValidationResult Contract
7
- */
8
- export type { ValidationResultContract } from '../validator-system/application/dto/validation-result-contract.js';
9
- export type { ValidatorRelaxationProfile } from '../validator-system/application/dto/validator-relaxation-profile.js';
10
- export type { AggregatedValidationReport } from '../validator-system/application/dto/aggregated-validation-report.js';
11
- export { ValidatorId, InvalidValidatorIdError } from '../validator-system/domain/value-objects/validator-id.js';
12
- export { ValidatorRegistry, UnknownValidatorError } from '../validator-system/domain/services/validator-registry.js';
13
- export { createValidatorSystemModule } from '../validator-system/composition-root.js';
14
- export type { ValidatorSystemModule } from '../validator-system/composition-root.js';
@@ -1,16 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit skill-quality
4
- */
5
- import type { CascadeUpdateResult } from '../../domain/value-objects/cascade-update-result.js';
6
- import type { ApplyCascadeUpdateOutput } from '../dto/apply-cascade-update-output.js';
7
-
8
- export class CascadeUpdateResultMapper {
9
- static toOutput(result: CascadeUpdateResult): ApplyCascadeUpdateOutput {
10
- return {
11
- updatedCount: result.updatedCount,
12
- appliedStoryIds: result.appliedStoryIds,
13
- errors: result.errors,
14
- };
15
- }
16
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit skill-quality
4
- */
5
- import type { CoverageReport } from '../../domain/value-objects/coverage-report.js';
6
-
7
- export interface CoverageReportDto {
8
- readonly requirementCoverage: {
9
- readonly total: number;
10
- readonly covered: number;
11
- readonly coverageRate: number;
12
- readonly uncoveredIds: readonly string[];
13
- };
14
- readonly codeCoverage: {
15
- readonly lineCoverage: number;
16
- readonly branchCoverage: number;
17
- readonly functionCoverage: number;
18
- };
19
- }
20
-
21
- export class CoverageReportMapper {
22
- static toDto(report: CoverageReport): CoverageReportDto {
23
- return {
24
- requirementCoverage: {
25
- total: report.requirementCoverage.total,
26
- covered: report.requirementCoverage.covered,
27
- coverageRate: report.requirementCoverage.coverageRate,
28
- uncoveredIds: report.requirementCoverage.uncoveredIds,
29
- },
30
- codeCoverage: {
31
- lineCoverage: report.codeCoverage.lineCoverage,
32
- branchCoverage: report.codeCoverage.branchCoverage,
33
- functionCoverage: report.codeCoverage.functionCoverage,
34
- },
35
- };
36
- }
37
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit skill-quality
4
- */
5
- import type { LessonArtifact, LessonArtifactJson } from '../../domain/aggregates/lesson-artifact.js';
6
-
7
- export class LessonArtifactMapper {
8
- static toJson(artifact: LessonArtifact): LessonArtifactJson {
9
- return artifact.toJson();
10
- }
11
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * @layer domain
3
- * @unit skill-quality
4
- */
5
- export type UnitName = string;
@@ -1,12 +0,0 @@
1
- /**
2
- * @layer application
3
- * @unit traceability-model
4
- */
5
-
6
- import type { ProjectRelativePath } from '../../domain/value-objects/project-relative-path.js';
7
-
8
- export interface MetadataValidationInput {
9
- readonly filePaths: readonly ProjectRelativePath[];
10
- readonly failOnWarning?: boolean;
11
- readonly format?: string;
12
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @layer domain
3
- * @unit traceability-model
4
- *
5
- * 逆引きチェーンで使用するリンク種別
6
- */
7
- export const TRACEABILITY_LINK_TYPES = Object.freeze([
8
- 'implementation-to-unit',
9
- 'unit-to-design',
10
- 'design-to-story',
11
- 'story-to-plan',
12
- ] as const);
13
-
14
- export type TraceabilityLinkType = (typeof TRACEABILITY_LINK_TYPES)[number];