phasegate 0.74.0 → 0.91.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 (99) hide show
  1. package/CHANGELOG.md +267 -0
  2. package/docs/ADR/ADR-014-presentation-domain-dependency.md +82 -0
  3. package/package.json +1 -1
  4. package/scripts/harness/adr-foundation/application/dto/application-errors.ts +0 -13
  5. package/scripts/harness/agent-integration/{infrastructure → application}/ports/cli-executor-port.ts +2 -2
  6. package/scripts/harness/agent-integration/application/usecases/handle-post-tool-use-usecase.ts +2 -2
  7. package/scripts/harness/agent-integration/application/usecases/handle-pre-tool-use-usecase.ts +28 -8
  8. package/scripts/harness/agent-integration/application/usecases/handle-stop-usecase.ts +1 -1
  9. package/scripts/harness/agent-integration/domain/ports/error-guidance-query-port.ts +0 -8
  10. package/scripts/harness/agent-integration/domain/ports/phase-gate-query-port.ts +6 -0
  11. package/scripts/harness/agent-integration/domain/services/fallback-verification-service.ts +2 -17
  12. package/scripts/harness/agent-integration/index.ts +3 -4
  13. package/scripts/harness/agent-integration/infrastructure/adapters/child-process-cli-executor-adapter.ts +2 -2
  14. package/scripts/harness/agent-integration/infrastructure/adapters/env-file-reentry-guard-state-adapter.ts +2 -10
  15. package/scripts/harness/agent-integration/infrastructure/adapters/phase-gate-query-adapter.ts +30 -0
  16. package/scripts/harness/agent-integration/presentation/session-start-hook.ts +2 -17
  17. package/scripts/harness/agent-integration/presentation/user-prompt-submit-hook.ts +2 -21
  18. package/scripts/harness/biome-ast-engine/composition-root.ts +2 -18
  19. package/scripts/harness/biome-ast-engine/domain/services/lint-runner.ts +19 -3
  20. package/scripts/harness/biome-ast-engine/domain/services/rule-definition-registry.ts +29 -3
  21. package/scripts/harness/biome-ast-engine/domain/value-objects/import-graph.ts +22 -6
  22. package/scripts/harness/biome-ast-engine/domain/value-objects/layer-name.ts +1 -1
  23. package/scripts/harness/biome-ast-engine/infrastructure/adapters/typescript-source-module-analyzer-adapter.ts +38 -48
  24. package/scripts/harness/biome-ast-engine/infrastructure/parsers/layer-comment-parser.ts +2 -8
  25. package/scripts/harness/biome-ast-engine/infrastructure/parsers/unit-comment-parser.ts +3 -10
  26. package/scripts/harness/ci-governance/application/usecases/generate-ci-template-usecase.ts +2 -2
  27. package/scripts/harness/ci-governance/domain/types/lesson-artifact.ts +5 -13
  28. package/scripts/harness/ci-governance/domain/types/template-type.ts +2 -6
  29. package/scripts/harness/ci-governance/domain/types/trigger-condition.ts +2 -6
  30. package/scripts/harness/ci-governance/infrastructure/adapters/harness-api-command-existence-adapter.ts +2 -6
  31. package/scripts/harness/ci-governance/infrastructure/adapters/validator-id-registry-adapter.ts +2 -6
  32. package/scripts/harness/ci-governance/infrastructure/schema/error-history-schema.ts +2 -6
  33. package/scripts/harness/ci-governance/presentation/handlers/migrate-agents-md-handler.ts +1 -1
  34. package/scripts/harness/config-foundation/domain/errors/config-foundation-domain-error.ts +3 -6
  35. package/scripts/harness/config-foundation/domain/errors/invalid-preset-error.ts +3 -6
  36. package/scripts/harness/config-foundation/domain/harness-config.ts +2 -1
  37. package/scripts/harness/config-foundation/domain/value-objects/phase-dependencies-config.ts +2 -1
  38. package/scripts/harness/config-foundation/index.ts +2 -11
  39. package/scripts/harness/harness-error/application/dto/error-definition-summary.ts +3 -6
  40. package/scripts/harness/harness-error/application/dto/harness-error-contract.ts +3 -6
  41. package/scripts/harness/harness-error/application/dto/validator-issue-draft.ts +3 -6
  42. package/scripts/harness/harness-error/domain/errors/adr-reference-not-found-error.ts +3 -6
  43. package/scripts/harness/harness-error/domain/errors/duplicate-error-code-error.ts +3 -6
  44. package/scripts/harness/harness-error/domain/errors/invalid-adr-ref-error.ts +3 -6
  45. package/scripts/harness/harness-error/domain/errors/invalid-error-code-error.ts +3 -6
  46. package/scripts/harness/harness-error/domain/errors/invalid-severity-error.ts +3 -6
  47. package/scripts/harness/harness-error/domain/errors/missing-adr-ref-error.ts +3 -6
  48. package/scripts/harness/harness-error/domain/errors/missing-fix-example-error.ts +3 -6
  49. package/scripts/harness/harness-error/domain/errors/severity-downgrade-violation-error.ts +3 -6
  50. package/scripts/harness/harness-error/domain/errors/unknown-error-definition-error.ts +3 -6
  51. package/scripts/harness/harness-error/domain/ports/fix-example-validator-port.ts +3 -7
  52. package/scripts/harness/nyquist-validation/application/dto/analyze-impact-output.ts +2 -6
  53. package/scripts/harness/nyquist-validation/infrastructure/adapters/ajv-json-schema-validator-adapter.ts +7 -19
  54. package/scripts/harness/nyquist-validation/infrastructure/adapters/traceability-model-story-registry-adapter.ts +4 -8
  55. package/scripts/harness/phase-dependency-model/application/usecases/check-story-reflection-usecase.ts +2 -13
  56. package/scripts/harness/phase-dependency-model/domain/ports/story-reflection-file-system-port.ts +2 -6
  57. package/scripts/harness/quick-mode/application/dto/change-category-classification-contract.ts +3 -7
  58. package/scripts/harness/quick-mode/index.ts +2 -13
  59. package/scripts/harness/setup/skill-deployer.ts +3 -58
  60. package/scripts/harness/skill-quality/infrastructure/adapters/ajv-lesson-artifact-schema-adapter.ts +3 -3
  61. package/scripts/harness/traceability-model/domain/services/metadata-validator.ts +1 -1
  62. package/scripts/harness/traceability-model/domain/value-objects/story-id.ts +3 -3
  63. package/scripts/harness/traceability-model/infrastructure/parsers/story-catalog-parser.ts +2 -2
  64. package/scripts/harness/validator-system/application/dto/run-full-validation-input.ts +4 -10
  65. package/scripts/harness/validator-system/domain/ports/adr-reference-port.ts +2 -6
  66. package/scripts/harness/validator-system/domain/ports/it-test-file-analyzer-port.ts +2 -10
  67. package/scripts/harness/validator-system/domain/ports/metadata-policy-port.ts +3 -6
  68. package/scripts/harness/validator-system/domain/ports/source-analysis-port.ts +2 -7
  69. package/scripts/harness/validator-system/domain/ports/source-code-analyzer-port.ts +2 -7
  70. package/scripts/harness/validator-system/domain/ports/source-file-text-scanner-port.ts +2 -9
  71. package/scripts/harness/validator-system/domain/ports/test-quality-analyzer-port.ts +3 -6
  72. package/scripts/harness/validator-system/domain/services/cli-e2e-test-existence-service.ts +3 -11
  73. package/scripts/harness/validator-system/domain/services/stub-comment-detection-service.ts +3 -8
  74. package/scripts/harness/validator-system/infrastructure/adapters/cli-command-registry-adapter.ts +3 -7
  75. package/scripts/harness/adr-foundation/application/dto/seed-adr-definition.ts +0 -21
  76. package/scripts/harness/adr-foundation/application/usecases/seed-initial-adrs-use-case.ts +0 -84
  77. package/scripts/harness/adr-foundation/infrastructure/seeds/initial-adr-definitions.ts +0 -161
  78. package/scripts/harness/agent-integration/domain/ports/import-analyzer-port.ts +0 -13
  79. package/scripts/harness/agent-integration/infrastructure/adapters/regex-import-analyzer-adapter.ts +0 -69
  80. package/scripts/harness/ci-governance/application/dto/validate-pointers-input.ts +0 -8
  81. package/scripts/harness/ci-governance/presentation/dto/ci-governance-render-options.ts +0 -9
  82. package/scripts/harness/ci-governance/presentation/formatters/error-repetition-formatter.ts +0 -26
  83. package/scripts/harness/config-foundation/infrastructure/registries/composite-feature-registry-adapter.ts +0 -22
  84. package/scripts/harness/nyquist-validation/domain/errors/story-not-found-error.ts +0 -14
  85. package/scripts/harness/nyquist-validation/presentation/dto/cli-render-options.ts +0 -12
  86. package/scripts/harness/quick-mode/application/dto/build-relaxation-profile-input.ts +0 -12
  87. package/scripts/harness/quick-mode/application/dto/execute-quick-ci-check-input.ts +0 -11
  88. package/scripts/harness/quick-mode/application/dto/judge-quick-mode-eligibility-input.ts +0 -10
  89. package/scripts/harness/quick-mode/domain/ports/quick-mode-config-port.ts +0 -12
  90. package/scripts/harness/quick-mode/domain/ports/validator-id-registry-port.ts +0 -10
  91. package/scripts/harness/shared-kernel/harness-api.ts +0 -6
  92. package/scripts/harness/shared-kernel/quick-mode.ts +0 -15
  93. package/scripts/harness/shared-kernel/validator-system.ts +0 -14
  94. package/scripts/harness/skill-quality/application/mappers/cascade-update-result-mapper.ts +0 -16
  95. package/scripts/harness/skill-quality/application/mappers/coverage-report-mapper.ts +0 -37
  96. package/scripts/harness/skill-quality/application/mappers/lesson-artifact-mapper.ts +0 -11
  97. package/scripts/harness/skill-quality/domain/types/unit-name.ts +0 -5
  98. package/scripts/harness/traceability-model/application/dto/metadata-validation-input.ts +0 -12
  99. package/scripts/harness/traceability-model/domain/constants/traceability-link-types.ts +0 -14
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit config-foundation
4
- *
5
- * config-foundation ドメイン層の基底エラークラス
6
- */
1
+ // @unit config-foundation
2
+ // @layer domain
3
+
7
4
  export class ConfigFoundationDomainError extends Error {
8
5
  readonly errorCode: string;
9
6
 
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit config-foundation
4
- *
5
- * project.preset が許可列挙値に一致しない場合のエラー
6
- */
1
+ // @unit config-foundation
2
+ // @layer domain
3
+
7
4
  import { ConfigFoundationDomainError } from './config-foundation-domain-error.js';
8
5
 
9
6
  export class InvalidPresetError extends ConfigFoundationDomainError {
@@ -8,6 +8,7 @@ import { UnsupportedFeatureError } from './errors/unsupported-feature-error.js';
8
8
  import { LayersConfig } from './value-objects/layers-config.js';
9
9
  import { PathsConfig } from './value-objects/paths-config.js';
10
10
  import { PhaseDependenciesConfig } from './value-objects/phase-dependencies-config.js';
11
+ import type { PhaseDependenciesPresetId } from './value-objects/phase-dependencies-config.js';
11
12
  import { PlanningModeConfig } from './value-objects/planning-mode-config.js';
12
13
  import { ProjectConfig } from './value-objects/project-config.js';
13
14
  import { QuickModeConfig } from './value-objects/quick-mode-config.js';
@@ -23,7 +24,7 @@ import type { L4Config } from './value-objects/l4-config.js';
23
24
  export type LayerId = 'L1' | 'L2' | 'L3' | 'L4';
24
25
  export type PresetId = 'minimal' | 'standard' | 'strict';
25
26
  export type PlanningModeValue = 'interactive' | 'embedded-qa';
26
- export type PhaseDependenciesPresetId = 'default' | 'full' | 'standard' | 'minimal' | 'custom';
27
+ export type { PhaseDependenciesPresetId };
27
28
  type DeepPartial<T> = {
28
29
  [K in keyof T]?: T[K] extends Array<infer TItem>
29
30
  ? Array<DeepPartial<TItem>>
@@ -7,7 +7,8 @@
7
7
  */
8
8
  import { CustomPhaseRule } from './custom-phase-rule.js';
9
9
  import type { CustomPhaseRuleProps } from './custom-phase-rule.js';
10
- import type { PhaseDependenciesPresetId } from '../harness-config.js';
10
+
11
+ export type PhaseDependenciesPresetId = 'default' | 'full' | 'standard' | 'minimal' | 'custom';
11
12
 
12
13
  export interface PhaseDependenciesConfigProps {
13
14
  readonly preset: PhaseDependenciesPresetId;
@@ -1,26 +1,17 @@
1
- /**
2
- * @layer public-api
3
- * @unit config-foundation
4
- *
5
- * config-foundation ユニットのバレルエクスポート。
6
- */
1
+ // @unit config-foundation
2
+ // @layer public-api
7
3
 
8
- // Composition Root
9
4
  export { createConfigFoundationModule } from './composition-root.js';
10
5
 
11
- // Application — usecases
12
6
  export { LoadResolvedConfigUseCase } from './application/usecases/load-resolved-config-use-case.js';
13
7
 
14
- // Application — DTOs
15
8
  export type { ResolvedConfigOutput } from './application/dto/resolved-config-output.js';
16
9
  export type { FeatureToggleResult } from './application/dto/feature-toggle-result.js';
17
10
  export type { AvailableFeatureItem } from './application/dto/available-feature-item.js';
18
11
 
19
- // Presentation — CLI handlers
20
12
  export { EnableFeatureCommandHandler } from './presentation/cli/enable-feature-command-handler.js';
21
13
  export { DisableFeatureCommandHandler } from './presentation/cli/disable-feature-command-handler.js';
22
14
 
23
- // Domain — ports
24
15
  export type { ConfigRepositoryPort } from './domain/ports/config-repository-port.js';
25
16
  export type { ConfigSchemaValidatorPort } from './domain/ports/config-schema-validator-port.js';
26
17
  export type { FeatureRegistryPort } from './domain/ports/feature-registry-port.js';
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer application
3
- * @unit harness-error
4
- *
5
- * ErrorDefinition の一覧投影DTO
6
- */
1
+ // @unit harness-error
2
+ // @layer application
3
+
7
4
  export interface ErrorDefinitionSummary {
8
5
  readonly code: string;
9
6
  readonly title: string;
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer application
3
- * @unit harness-error
4
- *
5
- * HarnessError の公開契約DTO
6
- */
1
+ // @unit harness-error
2
+ // @layer application
3
+
7
4
  export interface HarnessErrorContract {
8
5
  readonly code: string;
9
6
  readonly severity: 'error' | 'warning';
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer application
3
- * @unit harness-error
4
- *
5
- * validator出力の正規化前DTO
6
- */
1
+ // @unit harness-error
2
+ // @layer application
3
+
7
4
  export interface ValidatorIssueDraft {
8
5
  readonly code: string;
9
6
  readonly message: string;
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * ADR参照先が実在しない場合に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class AdrReferenceNotFoundError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * ErrorDefinitionRegistry に重複コードが登録された場合に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class DuplicateErrorCodeError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * AdrRef の形式不正時に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class InvalidAdrRefError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * ErrorCode の形式不正時に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class InvalidErrorCodeError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * Severity の入力不正時に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class InvalidSeverityError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * ADR参照が必須なのに未指定の場合に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class MissingAdrRefError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * fix_example が必須なのに未指定の場合に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class MissingFixExampleError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * severity の格下げ(error -> warning)が試みられた場合に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class SeverityDowngradeViolationError extends HarnessErrorDomainError {
@@ -1,9 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * ErrorDefinitionRegistry に未登録のコードが指定された場合に送出されるドメインエラー
6
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
7
4
  import { HarnessErrorDomainError } from './harness-error-domain-error.js';
8
5
 
9
6
  export class UnknownErrorDefinitionError extends HarnessErrorDomainError {
@@ -1,10 +1,6 @@
1
- /**
2
- * @layer domain
3
- * @unit harness-error
4
- *
5
- * FixExample検証ポート
6
- * Infrastructure層が実装し、構文妥当性確認と適用後のvalidator通過を検証する
7
- */
1
+ // @unit harness-error
2
+ // @layer domain
3
+
8
4
  import type { ErrorCode } from '../value-objects/error-code.js';
9
5
  import type { FixExample } from '../value-objects/fix-example.js';
10
6
  import type { FixExampleValidationResult } from '../value-objects/fix-example-validation-result.js';
@@ -1,9 +1,5 @@
1
- /**
2
- * @layer application
3
- * @unit nyquist-validation
4
- *
5
- * H07-04: AnalyzeImpactUseCase 出力DTO
6
- */
1
+ // @unit nyquist-validation
2
+ // @layer application
7
3
 
8
4
  export interface TestReferenceDto {
9
5
  readonly filePath: string;
@@ -4,20 +4,13 @@
4
4
  *
5
5
  * JSONスキーマバリデーション実装: Ajv
6
6
  */
7
- import Ajv from 'ajv';
7
+ import AjvModule, { type ErrorObject, type ValidateFunction } from 'ajv';
8
+ const Ajv = AjvModule.default ?? AjvModule;
8
9
  import type { NyquistHarnessError } from '../../domain/services/ac-coverage-gate-policy.js';
9
10
  import type { AjvValidatorPort } from '../../application/usecases/validate-matrix-usecase.js';
10
11
  import { loadMatrixSchema } from '../schema/matrix-schema-loader.js';
11
12
 
12
- interface AjvErrorObject {
13
- keyword: string;
14
- instancePath: string;
15
- schemaPath: string;
16
- params: Record<string, unknown>;
17
- message?: string;
18
- }
19
-
20
- function convertAjvError(err: AjvErrorObject): NyquistHarnessError {
13
+ function convertAjvError(err: ErrorObject): NyquistHarnessError {
21
14
  let message: string;
22
15
 
23
16
  switch (err.keyword) {
@@ -41,27 +34,22 @@ function convertAjvError(err: AjvErrorObject): NyquistHarnessError {
41
34
  }
42
35
 
43
36
  export class AjvJsonSchemaValidatorAdapter implements AjvValidatorPort {
44
- // biome-ignore lint/suspicious/noExplicitAny: Ajv v8 namespace/class type conflict
45
- private readonly ajv: any;
37
+ private readonly ajv: InstanceType<typeof Ajv>;
46
38
 
47
39
  constructor() {
48
- // biome-ignore lint/suspicious/noExplicitAny: Ajv v8 default export typing
49
- this.ajv = new (Ajv as any)({ allErrors: true });
40
+ this.ajv = new Ajv({ allErrors: true });
50
41
  }
51
42
 
52
43
  async validate(data: unknown): Promise<{ valid: boolean; errors: NyquistHarnessError[] }> {
53
44
  const schema = await loadMatrixSchema();
54
- const validateFn = this.ajv.compile(schema as object);
45
+ const validateFn: ValidateFunction = this.ajv.compile(schema as object);
55
46
  const valid = validateFn(data);
56
47
 
57
48
  if (valid) {
58
49
  return { valid: true, errors: [] };
59
50
  }
60
51
 
61
- // biome-ignore lint/suspicious/noExplicitAny: Ajv error objects typed via AjvErrorObject cast
62
- const errors: NyquistHarnessError[] = (validateFn.errors ?? []).map((e: any) =>
63
- convertAjvError(e as AjvErrorObject)
64
- );
52
+ const errors: NyquistHarnessError[] = (validateFn.errors ?? []).map((e) => convertAjvError(e));
65
53
  return { valid: false, errors };
66
54
  }
67
55
  }
@@ -1,14 +1,10 @@
1
- /**
2
- * @layer infrastructure
3
- * @unit nyquist-validation
4
- *
5
- * StoryRegistryPort 実装: traceability-model アダプタ
6
- * @stub wave2-pending
7
- */
1
+ // @unit nyquist-validation
2
+ // @layer infrastructure
3
+ // @stub wave2-pending
4
+
8
5
  import type { StoryRegistryPort } from '../../domain/ports/story-registry-port.js';
9
6
 
10
7
  export interface TraceabilityModelStoryRegistryAdapterDeps {
11
- /** traceability-model から有効なstoryIdを取得するコールバック(Wave2暫定) */
12
8
  getStoryIds: () => Promise<readonly string[]>;
13
9
  }
14
10
 
@@ -1,16 +1,5 @@
1
- /**
2
- * @layer application
3
- * @unit phase-dependency-model
4
- *
5
- * CheckStoryReflectionUseCase
6
- * StoryReflectionChecker をオーケストレーションし、inception → product への
7
- * storyId 反映状況を検証するユースケース。
8
- *
9
- * 入力: unitId, StoryReflectionConfig
10
- * 出力: StoryReflectionResult(pass/fail + violations/warnings)
11
- *
12
- * enabled=false の場合は即座に pass を返す。
13
- */
1
+ // @unit phase-dependency-model
2
+ // @layer application
14
3
 
15
4
  import type { StoryReflectionChecker } from '../../domain/services/story-reflection-checker.js';
16
5
  import type { StoryReflectionConfig } from '../../domain/values/story-reflection-config.js';
@@ -1,12 +1,8 @@
1
- /**
2
- * @layer domain
3
- * @unit phase-dependency-model
4
- */
1
+ // @unit phase-dependency-model
2
+ // @layer domain
5
3
 
6
4
  export interface StoryReflectionFileSystemPort {
7
- /** inception/{unit}/ 配下の storyId ディレクトリ名一覧を返す */
8
5
  listStoryDirectories(unitId: string): Promise<readonly string[]>;
9
- /** ファイルの存在チェック */
10
6
  fileExists(path: string): Promise<boolean>;
11
7
  /** product 文書内に @story-id {storyId} アノテーションが含まれているか */
12
8
  fileContainsStoryAnnotation(
@@ -1,10 +1,6 @@
1
- /**
2
- * @layer application
3
- * @unit quick-mode
4
- * @story H10-05
5
- *
6
- * ChangeCategoryClassification の公開 DTO
7
- */
1
+ // @unit quick-mode
2
+ // @layer application
3
+ // @story H10-05
8
4
 
9
5
  export interface ChangeCategoryPerFile {
10
6
  readonly path: string;
@@ -1,11 +1,6 @@
1
- /**
2
- * @layer application
3
- * @unit quick-mode
4
- *
5
- * quick-mode ユニットの公開エントリポイント
6
- */
1
+ // @unit quick-mode
2
+ // @layer application
7
3
 
8
- // Domain Value Objects
9
4
  export { ChangeCategory, UnknownChangeCategoryError } from './domain/value-objects/change-category.js';
10
5
  export { ChangedFile } from './domain/value-objects/changed-file.js';
11
6
  export { ChangeClassification } from './domain/value-objects/change-classification.js';
@@ -14,29 +9,23 @@ export { QuickModeDecision } from './domain/value-objects/quick-mode-decision.js
14
9
  export { QuickModeEligibility } from './domain/value-objects/quick-mode-eligibility.js';
15
10
  export { ValidatorRelaxationProfile } from './domain/value-objects/validator-relaxation-profile.js';
16
11
 
17
- // Domain Services
18
12
  export { QuickModeJudgmentEngine } from './domain/services/quick-mode-judgment-engine.js';
19
13
  export { ValidatorRelaxationService } from './domain/services/validator-relaxation-service.js';
20
14
 
21
- // Application DTOs
22
15
  export type { QuickModeDecisionContract } from './application/dto/quick-mode-decision-contract.js';
23
16
  export type { QuickModeEligibilityContract } from './application/dto/quick-mode-eligibility-contract.js';
24
17
  export type { ValidatorRelaxationProfileContract } from './application/dto/validator-relaxation-profile-contract.js';
25
18
 
26
- // Application UseCases
27
19
  export { JudgeQuickModeEligibilityUseCase } from './application/usecases/judge-quick-mode-eligibility-usecase.js';
28
20
  export { BuildRelaxationProfileUseCase, QuickModeNotEligibleError } from './application/usecases/build-relaxation-profile-usecase.js';
29
21
  export { ExecuteQuickCiCheckUseCase } from './application/usecases/execute-quick-ci-check-usecase.js';
30
22
 
31
- // Application Mappers
32
23
  export { QuickModeDecisionContractMapper } from './application/mappers/quick-mode-decision-contract-mapper.js';
33
24
 
34
- // Infrastructure Adapters
35
25
  export { GitDiffChangedFilesAdapter, GitNotAvailableError, GitCommandError } from './infrastructure/adapters/git-diff-changed-files-adapter.js';
36
26
  export { HarnessConfigQuickModeConfigAdapter, HarnessConfigNotFoundError, HarnessConfigParseError } from './infrastructure/adapters/harness-config-quick-mode-config-adapter.js';
37
27
  export { ValidatorSystemValidatorIdRegistryAdapter } from './infrastructure/adapters/validator-system-validator-id-registry-adapter.js';
38
28
 
39
- // Presentation
40
29
  export { CiCheckQuickModeHandler } from './presentation/handlers/ci-check-quick-mode-handler.js';
41
30
  export { HumanQuickModeFormatter } from './presentation/formatters/human-quick-mode-formatter.js';
42
31
  export { AgentQuickModeFormatter } from './presentation/formatters/agent-quick-mode-formatter.js';
@@ -1,12 +1,5 @@
1
- /**
2
- * @layer infrastructure
3
- *
4
- * Harnessスキルのデプロイメントインフラ。
5
- * パッケージルートの skills/ を対象プロジェクトの .claude/skills/ にコピーする。
6
- * harness init / harness update-skills コマンドから呼び出される。
7
- *
8
- * Note: import.meta.url を使わず、呼び出し元 (main.ts) がパスを解決して渡す設計。
9
- */
1
+ // @layer infrastructure
2
+ // Note: import.meta.url を使わず、呼び出し元 (main.ts) がパスを解決して渡す設計。
10
3
 
11
4
  import { join } from 'node:path';
12
5
  import { promises as fs } from 'node:fs';
@@ -60,9 +53,6 @@ export const SKILL_CATEGORIES: Record<SkillCategory, readonly string[]> = {
60
53
  ],
61
54
  } as const;
62
55
 
63
- /**
64
- * 指定された SkillSet に含まれるスキル名の一覧を返す。
65
- */
66
56
  export function getSkillsForSet(skillSet: SkillSet): string[] {
67
57
  if (skillSet === 'core') {
68
58
  return [...SKILL_CATEGORIES.core];
@@ -74,9 +64,6 @@ export function getSkillsForSet(skillSet: SkillSet): string[] {
74
64
  ];
75
65
  }
76
66
 
77
- /**
78
- * スキル名からカテゴリを逆引きする。未知のスキルは null を返す。
79
- */
80
67
  export function getCategoryForSkill(skillName: string): SkillCategory | null {
81
68
  for (const [category, skills] of Object.entries(SKILL_CATEGORIES)) {
82
69
  if ((skills as readonly string[]).includes(skillName)) {
@@ -128,13 +115,6 @@ async function copyDirectory(src: string, dest: string): Promise<number> {
128
115
  return count;
129
116
  }
130
117
 
131
- /**
132
- * skills/ ディレクトリを対象プロジェクトの .claude/skills/ にデプロイする。
133
- * 既存ファイルは上書きされる(update-skills でも同じ関数を使う)。
134
- *
135
- * @param harnessRoot - harnessパッケージのルートディレクトリ(skills/がある場所)
136
- * @param projectRoot - デプロイ先プロジェクトのルートディレクトリ
137
- */
138
118
  export async function deploySkills(
139
119
  harnessRoot: string,
140
120
  projectRoot: string,
@@ -168,10 +148,6 @@ export async function deploySkills(
168
148
  return { deployedSkills: skills, targetDir: skillsTarget, version, deployedAt, skillSet };
169
149
  }
170
150
 
171
- /**
172
- * デプロイ済みバージョン情報を読み取る。
173
- * .harness-version ファイルが存在しない場合は null を返す。
174
- */
175
151
  export async function getDeployedVersion(projectRoot: string): Promise<VersionInfo | null> {
176
152
  const versionFile = join(projectRoot, SKILLS_TARGET_DIR, HARNESS_VERSION_FILE);
177
153
  try {
@@ -188,14 +164,6 @@ export interface DeployHooksResult {
188
164
  settingsCreated: boolean;
189
165
  }
190
166
 
191
- /**
192
- * templates/.claude/scripts/ を対象プロジェクトの .claude/scripts/ にデプロイする。
193
- * templates/.claude/settings.json も存在しなければ作成する。
194
- * 既存のスクリプトは上書き、settings.json は既存があればスキップ。
195
- *
196
- * @param harnessRoot - harnessパッケージのルートディレクトリ
197
- * @param projectRoot - デプロイ先プロジェクトのルートディレクトリ
198
- */
199
167
  export async function deployHookScripts(
200
168
  harnessRoot: string,
201
169
  projectRoot: string,
@@ -220,7 +188,6 @@ export async function deployHookScripts(
220
188
  }
221
189
  }
222
190
  } catch {
223
- // テンプレートが存在しない場合はスキップ
224
191
  }
225
192
 
226
193
  // settings.json を作成(既存があればスキップ)
@@ -238,17 +205,12 @@ export async function deployHookScripts(
238
205
  await fs.copyFile(settingsSource, settingsTarget);
239
206
  settingsCreated = true;
240
207
  } catch {
241
- // テンプレートが存在しない場合はスキップ
242
- }
208
+ }
243
209
  }
244
210
 
245
211
  return { scriptsDeployed, settingsCreated };
246
212
  }
247
213
 
248
- /**
249
- * phasegate.config.json のデフォルトテンプレートを生成する。
250
- * 対象プロジェクトに phasegate.config.json が存在しない場合のみ作成する。
251
- */
252
214
  export async function initHarnessConfig(
253
215
  projectRoot: string,
254
216
  projectName: string,
@@ -298,12 +260,6 @@ export interface DeployDesignDocsResult {
298
260
  skippedFiles: string[];
299
261
  }
300
262
 
301
- /**
302
- * 設計原則ドキュメントを対象プロジェクトの docs/ にデプロイする。
303
- * - docs/folder_management_rules.md → <projectRoot>/docs/folder_management_rules.md
304
- * - docs/principles/*.md → <projectRoot>/docs/principles/*.md
305
- * 既存ファイルは上書きせずスキップする。
306
- */
307
263
  export async function deployDesignDocs(
308
264
  harnessRoot: string,
309
265
  projectRoot: string,
@@ -367,10 +323,6 @@ export interface DeployHuskyHookResult {
367
323
  path: string;
368
324
  }
369
325
 
370
- /**
371
- * husky pre-commit フックを対象プロジェクトの .husky/ にデプロイする。
372
- * 既存があればスキップする。実行権限 0o755 を付与する。
373
- */
374
326
  export async function deployHuskyHook(
375
327
  harnessRoot: string,
376
328
  projectRoot: string,
@@ -381,7 +333,6 @@ export async function deployHuskyHook(
381
333
  await fs.access(targetPath);
382
334
  return { created: false, path: targetPath };
383
335
  } catch {
384
- // 配置先が存在しない場合は新規作成
385
336
  }
386
337
 
387
338
  const sourcePath = join(harnessRoot, 'templates', '.husky', 'pre-commit');
@@ -397,11 +348,6 @@ export interface DeployCodexHooksResult {
397
348
  path: string;
398
349
  }
399
350
 
400
- /**
401
- * Codex CLI 向け hooks.json を対象プロジェクトの .codex/ にデプロイする。
402
- * 既存があればスキップする (ユーザー定義 hooks を上書きしない)。
403
- * ISSUE-013 Wave 2: --agent codex フラグ経由で init から呼び出される。
404
- */
405
351
  export async function deployCodexHooks(
406
352
  harnessRoot: string,
407
353
  projectRoot: string,
@@ -412,7 +358,6 @@ export async function deployCodexHooks(
412
358
  await fs.access(targetPath);
413
359
  return { created: false, path: targetPath };
414
360
  } catch {
415
- // 配置先が存在しない場合は新規作成
416
361
  }
417
362
 
418
363
  const sourcePath = join(harnessRoot, 'templates', '.codex', 'hooks.json');
@@ -2,8 +2,8 @@
2
2
  * @layer infrastructure
3
3
  * @unit skill-quality
4
4
  */
5
- import AjvModule from 'ajv';
6
- const Ajv = (AjvModule as any).default ?? AjvModule;
5
+ import AjvModule, { type ErrorObject } from 'ajv';
6
+ const Ajv = AjvModule.default ?? AjvModule;
7
7
  import type { LessonArtifactSchemaPort } from '../../domain/ports/lesson-artifact-schema-port.js';
8
8
  import type { ValidationViolation } from '../../domain/types/validation-violation.js';
9
9
 
@@ -29,7 +29,7 @@ export class AjvLessonArtifactSchemaAdapter implements LessonArtifactSchemaPort
29
29
  async validate(json: unknown): Promise<readonly ValidationViolation[]> {
30
30
  const valid = this.compiledValidator(json);
31
31
  if (valid) return [];
32
- return (this.compiledValidator.errors ?? []).map((err: any) => ({
32
+ return (this.compiledValidator.errors ?? []).map((err: ErrorObject) => ({
33
33
  ruleId: 'SCHEMA_VIOLATION',
34
34
  message: err.message ?? 'Schema validation error',
35
35
  location: err.instancePath,
@@ -13,7 +13,7 @@ import {
13
13
  import type { StoryIdLike } from '../value-objects/story-reference.js';
14
14
  import type { StoryIdAnnotation } from '../value-objects/story-id-annotation.js';
15
15
 
16
- const STORY_ID_PATTERN = /^H[0-9]{2}-[0-9]{2}$/;
16
+ const STORY_ID_PATTERN = /^H(?:F\d+|[0-9]{2})-[0-9]{2}$/;
17
17
  const VALID_LAYER_NAMES = new Set([
18
18
  'domain',
19
19
  'application',
@@ -2,13 +2,13 @@
2
2
  * @layer domain
3
3
  * @unit traceability-model
4
4
  *
5
- * HXX-XX形式の正規ストーリーID
5
+ * HXX-XX形式の正規ストーリーID(Phase 2 拡張 Epic として HF\d+-XX も許容)
6
6
  */
7
- const STORY_ID_PATTERN = /^H(?<epicNumber>[0-9]{2})-(?<storyNumber>[0-9]{2})$/;
7
+ const STORY_ID_PATTERN = /^H(?<epicNumber>F\d+|\d{2})-(?<storyNumber>\d{2})$/;
8
8
 
9
9
  export class StoryIdFormatError extends Error {
10
10
  constructor(value: string) {
11
- super(`StoryIdはHXX-XX形式で指定してください: ${value}`);
11
+ super(`StoryIdはHXX-XX形式(HF\\d+-XX も可)で指定してください: ${value}`);
12
12
  this.name = 'StoryIdFormatError';
13
13
  }
14
14
  }