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.
- package/CHANGELOG.md +267 -0
- package/docs/ADR/ADR-014-presentation-domain-dependency.md +82 -0
- package/package.json +1 -1
- package/scripts/harness/adr-foundation/application/dto/application-errors.ts +0 -13
- package/scripts/harness/agent-integration/{infrastructure → application}/ports/cli-executor-port.ts +2 -2
- package/scripts/harness/agent-integration/application/usecases/handle-post-tool-use-usecase.ts +2 -2
- package/scripts/harness/agent-integration/application/usecases/handle-pre-tool-use-usecase.ts +28 -8
- package/scripts/harness/agent-integration/application/usecases/handle-stop-usecase.ts +1 -1
- package/scripts/harness/agent-integration/domain/ports/error-guidance-query-port.ts +0 -8
- package/scripts/harness/agent-integration/domain/ports/phase-gate-query-port.ts +6 -0
- package/scripts/harness/agent-integration/domain/services/fallback-verification-service.ts +2 -17
- package/scripts/harness/agent-integration/index.ts +3 -4
- package/scripts/harness/agent-integration/infrastructure/adapters/child-process-cli-executor-adapter.ts +2 -2
- package/scripts/harness/agent-integration/infrastructure/adapters/env-file-reentry-guard-state-adapter.ts +2 -10
- package/scripts/harness/agent-integration/infrastructure/adapters/phase-gate-query-adapter.ts +30 -0
- package/scripts/harness/agent-integration/presentation/session-start-hook.ts +2 -17
- package/scripts/harness/agent-integration/presentation/user-prompt-submit-hook.ts +2 -21
- package/scripts/harness/biome-ast-engine/composition-root.ts +2 -18
- package/scripts/harness/biome-ast-engine/domain/services/lint-runner.ts +19 -3
- package/scripts/harness/biome-ast-engine/domain/services/rule-definition-registry.ts +29 -3
- package/scripts/harness/biome-ast-engine/domain/value-objects/import-graph.ts +22 -6
- package/scripts/harness/biome-ast-engine/domain/value-objects/layer-name.ts +1 -1
- package/scripts/harness/biome-ast-engine/infrastructure/adapters/typescript-source-module-analyzer-adapter.ts +38 -48
- package/scripts/harness/biome-ast-engine/infrastructure/parsers/layer-comment-parser.ts +2 -8
- package/scripts/harness/biome-ast-engine/infrastructure/parsers/unit-comment-parser.ts +3 -10
- package/scripts/harness/ci-governance/application/usecases/generate-ci-template-usecase.ts +2 -2
- package/scripts/harness/ci-governance/domain/types/lesson-artifact.ts +5 -13
- package/scripts/harness/ci-governance/domain/types/template-type.ts +2 -6
- package/scripts/harness/ci-governance/domain/types/trigger-condition.ts +2 -6
- package/scripts/harness/ci-governance/infrastructure/adapters/harness-api-command-existence-adapter.ts +2 -6
- package/scripts/harness/ci-governance/infrastructure/adapters/validator-id-registry-adapter.ts +2 -6
- package/scripts/harness/ci-governance/infrastructure/schema/error-history-schema.ts +2 -6
- package/scripts/harness/ci-governance/presentation/handlers/migrate-agents-md-handler.ts +1 -1
- package/scripts/harness/config-foundation/domain/errors/config-foundation-domain-error.ts +3 -6
- package/scripts/harness/config-foundation/domain/errors/invalid-preset-error.ts +3 -6
- package/scripts/harness/config-foundation/domain/harness-config.ts +2 -1
- package/scripts/harness/config-foundation/domain/value-objects/phase-dependencies-config.ts +2 -1
- package/scripts/harness/config-foundation/index.ts +2 -11
- package/scripts/harness/harness-error/application/dto/error-definition-summary.ts +3 -6
- package/scripts/harness/harness-error/application/dto/harness-error-contract.ts +3 -6
- package/scripts/harness/harness-error/application/dto/validator-issue-draft.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/adr-reference-not-found-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/duplicate-error-code-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/invalid-adr-ref-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/invalid-error-code-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/invalid-severity-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/missing-adr-ref-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/missing-fix-example-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/severity-downgrade-violation-error.ts +3 -6
- package/scripts/harness/harness-error/domain/errors/unknown-error-definition-error.ts +3 -6
- package/scripts/harness/harness-error/domain/ports/fix-example-validator-port.ts +3 -7
- package/scripts/harness/nyquist-validation/application/dto/analyze-impact-output.ts +2 -6
- package/scripts/harness/nyquist-validation/infrastructure/adapters/ajv-json-schema-validator-adapter.ts +7 -19
- package/scripts/harness/nyquist-validation/infrastructure/adapters/traceability-model-story-registry-adapter.ts +4 -8
- package/scripts/harness/phase-dependency-model/application/usecases/check-story-reflection-usecase.ts +2 -13
- package/scripts/harness/phase-dependency-model/domain/ports/story-reflection-file-system-port.ts +2 -6
- package/scripts/harness/quick-mode/application/dto/change-category-classification-contract.ts +3 -7
- package/scripts/harness/quick-mode/index.ts +2 -13
- package/scripts/harness/setup/skill-deployer.ts +3 -58
- package/scripts/harness/skill-quality/infrastructure/adapters/ajv-lesson-artifact-schema-adapter.ts +3 -3
- package/scripts/harness/traceability-model/domain/services/metadata-validator.ts +1 -1
- package/scripts/harness/traceability-model/domain/value-objects/story-id.ts +3 -3
- package/scripts/harness/traceability-model/infrastructure/parsers/story-catalog-parser.ts +2 -2
- package/scripts/harness/validator-system/application/dto/run-full-validation-input.ts +4 -10
- package/scripts/harness/validator-system/domain/ports/adr-reference-port.ts +2 -6
- package/scripts/harness/validator-system/domain/ports/it-test-file-analyzer-port.ts +2 -10
- package/scripts/harness/validator-system/domain/ports/metadata-policy-port.ts +3 -6
- package/scripts/harness/validator-system/domain/ports/source-analysis-port.ts +2 -7
- package/scripts/harness/validator-system/domain/ports/source-code-analyzer-port.ts +2 -7
- package/scripts/harness/validator-system/domain/ports/source-file-text-scanner-port.ts +2 -9
- package/scripts/harness/validator-system/domain/ports/test-quality-analyzer-port.ts +3 -6
- package/scripts/harness/validator-system/domain/services/cli-e2e-test-existence-service.ts +3 -11
- package/scripts/harness/validator-system/domain/services/stub-comment-detection-service.ts +3 -8
- package/scripts/harness/validator-system/infrastructure/adapters/cli-command-registry-adapter.ts +3 -7
- package/scripts/harness/adr-foundation/application/dto/seed-adr-definition.ts +0 -21
- package/scripts/harness/adr-foundation/application/usecases/seed-initial-adrs-use-case.ts +0 -84
- package/scripts/harness/adr-foundation/infrastructure/seeds/initial-adr-definitions.ts +0 -161
- package/scripts/harness/agent-integration/domain/ports/import-analyzer-port.ts +0 -13
- package/scripts/harness/agent-integration/infrastructure/adapters/regex-import-analyzer-adapter.ts +0 -69
- package/scripts/harness/ci-governance/application/dto/validate-pointers-input.ts +0 -8
- package/scripts/harness/ci-governance/presentation/dto/ci-governance-render-options.ts +0 -9
- package/scripts/harness/ci-governance/presentation/formatters/error-repetition-formatter.ts +0 -26
- package/scripts/harness/config-foundation/infrastructure/registries/composite-feature-registry-adapter.ts +0 -22
- package/scripts/harness/nyquist-validation/domain/errors/story-not-found-error.ts +0 -14
- package/scripts/harness/nyquist-validation/presentation/dto/cli-render-options.ts +0 -12
- package/scripts/harness/quick-mode/application/dto/build-relaxation-profile-input.ts +0 -12
- package/scripts/harness/quick-mode/application/dto/execute-quick-ci-check-input.ts +0 -11
- package/scripts/harness/quick-mode/application/dto/judge-quick-mode-eligibility-input.ts +0 -10
- package/scripts/harness/quick-mode/domain/ports/quick-mode-config-port.ts +0 -12
- package/scripts/harness/quick-mode/domain/ports/validator-id-registry-port.ts +0 -10
- package/scripts/harness/shared-kernel/harness-api.ts +0 -6
- package/scripts/harness/shared-kernel/quick-mode.ts +0 -15
- package/scripts/harness/shared-kernel/validator-system.ts +0 -14
- package/scripts/harness/skill-quality/application/mappers/cascade-update-result-mapper.ts +0 -16
- package/scripts/harness/skill-quality/application/mappers/coverage-report-mapper.ts +0 -37
- package/scripts/harness/skill-quality/application/mappers/lesson-artifact-mapper.ts +0 -11
- package/scripts/harness/skill-quality/domain/types/unit-name.ts +0 -5
- package/scripts/harness/traceability-model/application/dto/metadata-validation-input.ts +0 -12
- package/scripts/harness/traceability-model/domain/constants/traceability-link-types.ts +0 -14
|
@@ -10,7 +10,7 @@ export interface ParsedStoryCatalog {
|
|
|
10
10
|
readonly aliasMap: ReadonlyMap<string, string>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const STORY_ID_LINE_PATTERN = /\bH[0-9]{2}-[0-9]{2}\b/g;
|
|
13
|
+
const STORY_ID_LINE_PATTERN = /\bH(?:F\d+|[0-9]{2})-[0-9]{2}\b/g;
|
|
14
14
|
const TABLE_ALIAS_PATTERN =
|
|
15
15
|
/\|\s*(H[0-9]{2}-[0-9]{2})\s*\|.*?\|\s*(US-[0-9]{3})\s*\|/g;
|
|
16
16
|
const INLINE_ALIAS_PATTERN =
|
|
@@ -58,7 +58,7 @@ export function parseStoryCatalog(content: string): ParsedStoryCatalog {
|
|
|
58
58
|
|
|
59
59
|
// 前後行コンテキスト形式: H03-01 の直後に 旧US: US-001
|
|
60
60
|
for (let i = 0; i < lines.length; i++) {
|
|
61
|
-
const storyIdMatch = /\b(H[0-9]{2}-[0-9]{2})\b/.exec(lines[i]);
|
|
61
|
+
const storyIdMatch = /\b(H(?:F\d+|[0-9]{2})-[0-9]{2})\b/.exec(lines[i]);
|
|
62
62
|
if (storyIdMatch) {
|
|
63
63
|
const nextLine = i + 1 < lines.length ? lines[i + 1] : '';
|
|
64
64
|
const legacyMatch = /旧US\s*[::]\s*(US-[0-9]{3})/.exec(nextLine);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* RunFullValidationInput — H08-06 UseCase入力DTO
|
|
6
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer application
|
|
3
|
+
|
|
7
4
|
export interface RunFullValidationInput {
|
|
8
5
|
readonly targetPaths: readonly string[];
|
|
9
6
|
readonly unitName: string;
|
|
@@ -13,9 +10,6 @@ export interface RunFullValidationInput {
|
|
|
13
10
|
readonly failOnWarning?: boolean;
|
|
14
11
|
readonly coverageReportPath?: string;
|
|
15
12
|
readonly requirementMatrixPath?: string;
|
|
16
|
-
/**
|
|
17
|
-
* ISSUE-005 P1-4: 実行レイヤー絞り込み。未指定は全レイヤー実行。
|
|
18
|
-
* 指定された場合、`includeL4` より優先される。
|
|
19
|
-
*/
|
|
13
|
+
/** 指定時は includeL4 より優先。未指定は全レイヤー実行。 */
|
|
20
14
|
readonly targetLayers?: readonly ('L2' | 'L3' | 'L4')[];
|
|
21
15
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @unit validator-system
|
|
4
|
-
*
|
|
5
|
-
* ItTestFileAnalyzerPort — ITテストファイルのvi.mock解析ポート
|
|
6
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
7
3
|
|
|
8
4
|
export interface ItTestMockCall {
|
|
9
5
|
readonly filePath: string;
|
|
@@ -11,10 +7,6 @@ export interface ItTestMockCall {
|
|
|
11
7
|
}
|
|
12
8
|
|
|
13
9
|
export interface ItTestFileAnalyzerPort {
|
|
14
|
-
/**
|
|
15
|
-
* 指定ファイル群のITテストファイルをスキャンし、vi.mockで内部モジュールを
|
|
16
|
-
* モックしている箇所を返す。
|
|
17
|
-
*/
|
|
18
10
|
findMockCallsInItTests(targetPaths?: readonly string[]): Promise<readonly ItTestMockCall[]>;
|
|
19
11
|
}
|
|
20
12
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* MetadataPolicyPort — traceability-model メタデータ検証仕様
|
|
6
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
3
|
+
|
|
7
4
|
import type { HarnessErrorLike } from '../value-objects/validation-result.js';
|
|
8
5
|
|
|
9
6
|
export interface MetadataPolicyPort {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @unit validator-system
|
|
4
|
-
*
|
|
5
|
-
* SourceAnalysisPort — biome-ast-engine ImportGraph相当データ(L4-003)
|
|
6
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
7
3
|
|
|
8
4
|
export interface ImportGraphData {
|
|
9
5
|
readonly nodes: readonly { filePath: string; exports: readonly string[] }[];
|
|
10
6
|
readonly edges: readonly { from: string; to: string; importedNames: readonly string[] }[];
|
|
11
|
-
/** DeadCodeDetectionService用: 未使用エクスポート・到達不能コード */
|
|
12
7
|
readonly unusedExports?: readonly string[];
|
|
13
8
|
readonly unreachableCode?: readonly { filePath: string; range: { startLine: number; endLine: number } }[];
|
|
14
9
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @unit validator-system
|
|
4
|
-
*
|
|
5
|
-
* SourceCodeAnalyzerPort — AST解析結果取得(L4-001, L4-003)
|
|
6
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
7
3
|
|
|
8
4
|
export interface SourceAnalysisResult {
|
|
9
5
|
readonly unitName: string;
|
|
@@ -14,6 +10,5 @@ export interface SourceAnalysisResult {
|
|
|
14
10
|
|
|
15
11
|
export interface SourceCodeAnalyzerPort {
|
|
16
12
|
analyzeExports(targetUnits?: readonly string[]): Promise<readonly SourceAnalysisResult[]>;
|
|
17
|
-
/** DriftDetectionService用: 要素名一覧取得 */
|
|
18
13
|
getElements?(targetUnits?: readonly string[]): Promise<string[]>;
|
|
19
14
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @unit validator-system
|
|
4
|
-
*
|
|
5
|
-
* SourceFileTextScannerPort — ソースファイルテキストスキャンポート
|
|
6
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
7
3
|
|
|
8
4
|
export interface TextScanMatch {
|
|
9
5
|
readonly filePath: string;
|
|
@@ -12,9 +8,6 @@ export interface TextScanMatch {
|
|
|
12
8
|
}
|
|
13
9
|
|
|
14
10
|
export interface SourceFileTextScannerPort {
|
|
15
|
-
/**
|
|
16
|
-
* 指定ファイル群のソースファイルをスキャンし、パターンに一致する行を返す。
|
|
17
|
-
*/
|
|
18
11
|
scanForPattern(pattern: RegExp, targetPaths?: readonly string[]): Promise<readonly TextScanMatch[]>;
|
|
19
12
|
}
|
|
20
13
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* TestQualityAnalyzerPort — AAAパターン・命名規約解析(L2-003)
|
|
6
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
3
|
+
|
|
7
4
|
import type { HarnessErrorLike } from '../value-objects/validation-result.js';
|
|
8
5
|
|
|
9
6
|
export interface TestQualityAnalyzerPort {
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* CliE2eTestExistenceService — H08-09: CLIコマンドE2Eテスト存在チェックドメインサービス
|
|
6
|
-
* CLIハンドラー定義とE2Eテストファイルの突合検証を行う。
|
|
7
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
3
|
+
|
|
8
4
|
import { CliE2eTestCoverageReport, type CliCommandCoverageEntry } from '../value-objects/cli-e2e-test-coverage-report.js';
|
|
9
5
|
|
|
10
6
|
export class CliE2eTestExistenceService {
|
|
11
|
-
/**
|
|
12
|
-
* 登録済みCLIコマンドとE2Eテストファイル一覧を突合し、カバレッジレポートを生成する。
|
|
13
|
-
* E2Eテストファイルのパスまたは内容にコマンド名が含まれていればカバー済みとみなす。
|
|
14
|
-
*/
|
|
15
7
|
check(commands: readonly string[], e2eTestFiles: readonly string[]): CliE2eTestCoverageReport {
|
|
16
8
|
const e2eContent = e2eTestFiles.join('\n').toLowerCase();
|
|
17
9
|
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* StubCommentDetectionService — H08-08: スタブコメント残存検出ドメインサービス
|
|
6
|
-
* ソースファイル内の stub 実装コメントパターンを検出する。
|
|
7
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer domain
|
|
3
|
+
|
|
8
4
|
import type { TextScanMatch } from '../ports/source-file-text-scanner-port.js';
|
|
9
5
|
import { StubCommentReport, type StubCommentEntry } from '../value-objects/stub-comment-report.js';
|
|
10
6
|
|
|
11
7
|
export class StubCommentDetectionService {
|
|
12
|
-
/** スタブコメント検出パターン */
|
|
13
8
|
static readonly STUB_COMMENT_PATTERN = /\/\/\s*(stub実装|Stub implementation|stub implementation|TODO.*stub|STUB)/i;
|
|
14
9
|
|
|
15
10
|
detect(matches: readonly TextScanMatch[]): StubCommentReport {
|
package/scripts/harness/validator-system/infrastructure/adapters/cli-command-registry-adapter.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* CliCommandRegistryAdapter — CliCommandRegistryPort実装
|
|
6
|
-
* 登録済みCLIコマンド名一覧を提供する。
|
|
7
|
-
*/
|
|
1
|
+
// @unit validator-system
|
|
2
|
+
// @layer infrastructure
|
|
3
|
+
|
|
8
4
|
import type { CliCommandRegistryPort } from '../../domain/ports/cli-command-registry-port.js';
|
|
9
5
|
|
|
10
6
|
export interface CliCommandRegistryAdapterOptions {
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @layer application
|
|
3
|
-
* @unit adr-foundation
|
|
4
|
-
*/
|
|
5
|
-
export interface SeedAdrDefinition {
|
|
6
|
-
readonly title: string;
|
|
7
|
-
readonly status: 'Proposed' | 'Accepted' | 'Deprecated' | 'Superseded';
|
|
8
|
-
readonly date: string;
|
|
9
|
-
readonly body: {
|
|
10
|
-
readonly context: string;
|
|
11
|
-
readonly decision: string;
|
|
12
|
-
readonly consequences: string;
|
|
13
|
-
readonly alternatives?: string;
|
|
14
|
-
};
|
|
15
|
-
readonly archgate?: {
|
|
16
|
-
readonly enforcedBy: ReadonlyArray<{
|
|
17
|
-
readonly validatorId: string;
|
|
18
|
-
readonly errorCode: string;
|
|
19
|
-
}>;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @layer application
|
|
3
|
-
* @unit adr-foundation
|
|
4
|
-
*/
|
|
5
|
-
import { ADR } from '../../domain/aggregates/adr.js';
|
|
6
|
-
import type { AdrDocumentParserPort } from '../../domain/ports/adr-document-parser-port.js';
|
|
7
|
-
import type { AdrRepositoryPort } from '../../domain/ports/adr-repository-port.js';
|
|
8
|
-
import { AdrValidationService } from '../../domain/services/adr-validation-service.js';
|
|
9
|
-
import { AdrId } from '../../domain/value-objects/adr-id.js';
|
|
10
|
-
import {
|
|
11
|
-
DuplicateAdrIdApplicationError,
|
|
12
|
-
SeedAdrDefinitionCountError,
|
|
13
|
-
} from '../dto/application-errors.js';
|
|
14
|
-
import type { SeedAdrDefinition } from '../dto/seed-adr-definition.js';
|
|
15
|
-
|
|
16
|
-
export interface SeedInitialAdrsInput {
|
|
17
|
-
readonly definitions: SeedAdrDefinition[];
|
|
18
|
-
readonly overwrite?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface SeedInitialAdrsOutput {
|
|
22
|
-
readonly created: readonly string[];
|
|
23
|
-
readonly skipped: readonly string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export class SeedInitialAdrsUseCase {
|
|
27
|
-
constructor(
|
|
28
|
-
private readonly adrRepository: AdrRepositoryPort,
|
|
29
|
-
private readonly documentParser: AdrDocumentParserPort,
|
|
30
|
-
) {}
|
|
31
|
-
|
|
32
|
-
async execute(input: SeedInitialAdrsInput): Promise<Readonly<SeedInitialAdrsOutput>> {
|
|
33
|
-
if (input.definitions.length !== 11) {
|
|
34
|
-
throw new SeedAdrDefinitionCountError(input.definitions.length);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const created: string[] = [];
|
|
38
|
-
const skipped: string[] = [];
|
|
39
|
-
|
|
40
|
-
for (const [index, definition] of input.definitions.entries()) {
|
|
41
|
-
const adrId = AdrId.create(String(index + 1).padStart(3, '0'));
|
|
42
|
-
const adrRef = adrId.toAdrRef();
|
|
43
|
-
|
|
44
|
-
if (created.includes(adrRef) || skipped.includes(adrRef)) {
|
|
45
|
-
throw new DuplicateAdrIdApplicationError(adrRef);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const adr = ADR.create(
|
|
49
|
-
{
|
|
50
|
-
adr_id: adrId.value,
|
|
51
|
-
title: definition.title,
|
|
52
|
-
status: definition.status,
|
|
53
|
-
date: definition.date,
|
|
54
|
-
archgate: definition.archgate
|
|
55
|
-
? {
|
|
56
|
-
adr_id: adrId.value,
|
|
57
|
-
enforced_by: definition.archgate.enforcedBy.map((entry) => ({
|
|
58
|
-
validator_id: entry.validatorId,
|
|
59
|
-
error_code: entry.errorCode,
|
|
60
|
-
})),
|
|
61
|
-
}
|
|
62
|
-
: undefined,
|
|
63
|
-
},
|
|
64
|
-
definition.body,
|
|
65
|
-
new AdrValidationService(),
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const exists = await this.adrRepository.exists(adrId);
|
|
69
|
-
if (exists && input.overwrite !== true) {
|
|
70
|
-
skipped.push(adrRef);
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
this.documentParser.serializeDocument(adr);
|
|
75
|
-
await this.adrRepository.save(adr);
|
|
76
|
-
created.push(adrRef);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return Object.freeze({
|
|
80
|
-
created: Object.freeze(created),
|
|
81
|
-
skipped: Object.freeze(skipped),
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @layer infrastructure
|
|
3
|
-
* @unit adr-foundation
|
|
4
|
-
*/
|
|
5
|
-
import type { SeedAdrDefinition } from '../../application/dto/seed-adr-definition.js';
|
|
6
|
-
|
|
7
|
-
export const INITIAL_ADR_DEFINITIONS: readonly SeedAdrDefinition[] = [
|
|
8
|
-
{
|
|
9
|
-
title: 'Package separation',
|
|
10
|
-
status: 'Accepted',
|
|
11
|
-
date: '2026-03-13',
|
|
12
|
-
body: {
|
|
13
|
-
context:
|
|
14
|
-
'The harness codebase has grown beyond a single-package structure. Build times increase and cross-cutting changes create unnecessary coupling.',
|
|
15
|
-
decision:
|
|
16
|
-
'Separate the repository into discrete packages aligned with bounded contexts, each with its own build and test lifecycle.',
|
|
17
|
-
consequences:
|
|
18
|
-
'Packages can evolve independently. CI must orchestrate multi-package builds. Shared kernel contracts must be explicitly published.',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
title: 'Full migration from ESLint to Biome',
|
|
23
|
-
status: 'Accepted',
|
|
24
|
-
date: '2026-03-13',
|
|
25
|
-
body: {
|
|
26
|
-
context:
|
|
27
|
-
'The project currently uses ESLint for linting. Biome offers faster execution and unified formatting with linting in a single tool.',
|
|
28
|
-
decision:
|
|
29
|
-
'Migrate all linting and formatting from ESLint and Prettier to Biome as the sole toolchain.',
|
|
30
|
-
consequences:
|
|
31
|
-
'Tooling becomes simpler and faster. Custom ESLint rules must be re-implemented as Biome plugins or GritQL patterns.',
|
|
32
|
-
alternatives:
|
|
33
|
-
'Keep dual toolchain with ESLint for rules not yet supported by Biome.',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
title: 'Quality harness owns K1-K13',
|
|
38
|
-
status: 'Accepted',
|
|
39
|
-
date: '2026-03-13',
|
|
40
|
-
body: {
|
|
41
|
-
context:
|
|
42
|
-
'Quality indicators K1 through K13 are defined across multiple documents with no single owner enforcing them.',
|
|
43
|
-
decision:
|
|
44
|
-
'The quality harness unit owns the enforcement of all K1-K13 indicators, providing validators and gates for each.',
|
|
45
|
-
consequences:
|
|
46
|
-
'A single unit is accountable for quality enforcement. Other units must integrate through the harness contract rather than implementing ad-hoc checks.',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: 'FUSE Hooks Engine is out of v1 scope',
|
|
51
|
-
status: 'Proposed',
|
|
52
|
-
date: '2026-03-13',
|
|
53
|
-
body: {
|
|
54
|
-
context:
|
|
55
|
-
'The FUSE Hooks Engine provides extensible event-driven hooks but adds significant complexity to the initial delivery.',
|
|
56
|
-
decision:
|
|
57
|
-
'Defer the FUSE Hooks Engine to a post-v1 phase. The v1 harness will use direct invocation patterns.',
|
|
58
|
-
consequences:
|
|
59
|
-
'Reduced initial scope and risk. Hook-based extensibility will require a migration path when introduced later.',
|
|
60
|
-
alternatives:
|
|
61
|
-
'Include a minimal hooks engine in v1 with limited extensibility.',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
title: 'HarnessError requires fix_example',
|
|
66
|
-
status: 'Accepted',
|
|
67
|
-
date: '2026-03-13',
|
|
68
|
-
body: {
|
|
69
|
-
context:
|
|
70
|
-
'Developers receiving harness errors often lack actionable guidance on how to resolve violations.',
|
|
71
|
-
decision:
|
|
72
|
-
'Every HarnessError definition must include a fix_example field demonstrating the corrective action.',
|
|
73
|
-
consequences:
|
|
74
|
-
'Error definitions are more verbose but significantly more useful. All existing error definitions must be updated to include examples.',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
title: 'Strict quick mode eligibility',
|
|
79
|
-
status: 'Accepted',
|
|
80
|
-
date: '2026-03-13',
|
|
81
|
-
body: {
|
|
82
|
-
context:
|
|
83
|
-
'Quick mode bypasses expensive validators but must not compromise quality gates for critical changes.',
|
|
84
|
-
decision:
|
|
85
|
-
'Define strict eligibility criteria for quick mode based on file change scope and affected layers.',
|
|
86
|
-
consequences:
|
|
87
|
-
'Quick mode runs faster for eligible changes. Complex cross-layer changes always run the full validator stack.',
|
|
88
|
-
alternatives:
|
|
89
|
-
'Allow developers to manually opt into quick mode regardless of change scope.',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
title: 'Separate config files',
|
|
94
|
-
status: 'Accepted',
|
|
95
|
-
date: '2026-03-13',
|
|
96
|
-
body: {
|
|
97
|
-
context:
|
|
98
|
-
'A single monolithic configuration file makes it difficult to manage unit-specific settings and increases merge conflicts.',
|
|
99
|
-
decision:
|
|
100
|
-
'Split configuration into separate files per concern: phasegate.config.json for core settings, with unit-specific overrides.',
|
|
101
|
-
consequences:
|
|
102
|
-
'Configuration is modular and easier to maintain. The config loader must implement a merge strategy for layered configs.',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
title: 'Nyquist integration for truths and artifacts',
|
|
107
|
-
status: 'Proposed',
|
|
108
|
-
date: '2026-03-13',
|
|
109
|
-
body: {
|
|
110
|
-
context:
|
|
111
|
-
'Nyquist provides a truth-source registry and artifact tracking system that could centralize harness state management.',
|
|
112
|
-
decision:
|
|
113
|
-
'Integrate with Nyquist for truth registration and artifact lifecycle tracking.',
|
|
114
|
-
consequences:
|
|
115
|
-
'Harness gains a centralized truth source. A dependency on Nyquist availability is introduced.',
|
|
116
|
-
alternatives:
|
|
117
|
-
'Build a standalone truth registry within the harness codebase.',
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
title: 'Artifact-driven state derivation',
|
|
122
|
-
status: 'Accepted',
|
|
123
|
-
date: '2026-03-13',
|
|
124
|
-
body: {
|
|
125
|
-
context:
|
|
126
|
-
'Harness state is currently computed on-the-fly, leading to inconsistent results across different invocation points.',
|
|
127
|
-
decision:
|
|
128
|
-
'Derive harness state exclusively from persisted artifacts, making state deterministic and reproducible.',
|
|
129
|
-
consequences:
|
|
130
|
-
'State becomes auditable and cacheable. All state-changing operations must produce artifacts as their primary output.',
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
title: 'Validator stack detection',
|
|
135
|
-
status: 'Accepted',
|
|
136
|
-
date: '2026-03-13',
|
|
137
|
-
body: {
|
|
138
|
-
context:
|
|
139
|
-
'Validators are registered individually, but their execution order and dependencies are not explicitly managed.',
|
|
140
|
-
decision:
|
|
141
|
-
'Implement automatic validator stack detection that resolves execution order based on declared dependencies and layer constraints.',
|
|
142
|
-
consequences:
|
|
143
|
-
'Validator execution order is deterministic and verifiable. Circular dependencies are detected at registration time.',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
title: 'Temporary 4-layer definition with return path to 5-layer',
|
|
148
|
-
status: 'Proposed',
|
|
149
|
-
date: '2026-03-13',
|
|
150
|
-
body: {
|
|
151
|
-
context:
|
|
152
|
-
'The target architecture defines 5 layers, but the current codebase structure and team familiarity support only 4 layers.',
|
|
153
|
-
decision:
|
|
154
|
-
'Adopt a temporary 4-layer definition (domain, application, infrastructure, presentation) with a documented return path to the 5-layer target.',
|
|
155
|
-
consequences:
|
|
156
|
-
'Initial implementation is simpler. The migration plan to 5 layers must be maintained and reviewed periodically.',
|
|
157
|
-
alternatives:
|
|
158
|
-
'Adopt the full 5-layer structure from the start despite the complexity cost.',
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
] as const;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @layer domain
|
|
3
|
-
* @unit agent-integration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface ImportAnalysisResult {
|
|
7
|
-
filePath: string;
|
|
8
|
-
agentApiImports: string[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ImportAnalyzerPort {
|
|
12
|
-
analyzeAgentApiImports(targetFilePaths: string[]): Promise<ImportAnalysisResult[]>;
|
|
13
|
-
}
|
package/scripts/harness/agent-integration/infrastructure/adapters/regex-import-analyzer-adapter.ts
DELETED
|
@@ -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,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
|
-
}
|