Skip to content

Commit 1459960

Browse files
authored
refactor: rename workflow registry entry type
Refs #209
1 parent f153dd7 commit 1459960

12 files changed

Lines changed: 67 additions & 65 deletions

docs/product-name-audit.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ git grep -n -i -E 'kapi|ilchul' -- ':!package-lock.json' ':!node_modules'
2121
| Storage/config | `.ilchul`, `~/.ilchul`, `.kapi` historical references, and `ILCHUL_*` environment variables appear in docs/tests/runtime setup. | storage/config namespace | `.ilchul` is active storage; `.kapi` is legacy evidence only and must not be deleted by this issue. |
2222
| GitHub review integration | `kapi-agent`, `kapi-agent/review`, and `kapi-review` remain literal external integration names. | external integration | Keep literal names while the GitHub App and required checks use them. |
2323
| Documentation/history | README, policy docs, references, and historical explanations still mention Kapi and Ilchul. | documentation/history | New public runtime examples should use `ilchul`; internal implementation examples may use `runctl` / `runtime`; historical and compatibility prose may keep product names with context. |
24-
| Core/domain/application identifiers | Existing exported types and classes such as `KapiRegistryEntry`, `KapiService`, and `KapiStore` remain product-prefixed. The local factory export is now `createLocalWorkflowService`. | known reusable-code leakage reduced by bounded slices | Follow-up slices should rename these by boundary (`RegistryEntry`, `WorkflowService`, `WorkflowStore`, etc.) with compatibility exports where safe. |
24+
| Core/domain/application identifiers | The registry entry type now uses `WorkflowRegistryEntry`; exported classes such as `KapiService` and `KapiStore` remain product-prefixed. The local factory export is now `createLocalWorkflowService`. | known reusable-code leakage reduced by bounded slices | Follow-up slices should rename remaining service/store identifiers by boundary (`WorkflowService`, `WorkflowStore`, etc.) with compatibility exports where safe. |
2525
| Application service filenames | The service implementation and factory now use semantic filenames: `src/application/workflow-service.ts` and `src/adapters/workflow-service-factory.ts`. | internal semantic implementation | Keep imports on the semantic service paths; exported class/function names are intentionally left for a smaller follow-up compatibility slice. |
2626
| CLI worker/runtime helper filenames | Worker event, runtime observation, and GitHub issue context helpers now use semantic filenames: `src/cli/worker-events.ts`, `src/cli/worker-runtime.ts`, and `src/cli/github-issue-context.ts`. | internal semantic implementation | Keep imports on the semantic helper paths; remaining worker event payload names such as `kapi.worker.*` are external event contracts, not filenames. |
2727

@@ -33,6 +33,8 @@ git grep -n -i -E 'kapi|ilchul' -- ':!package-lock.json' ':!node_modules'
3333
- Application service implementation import paths no longer use `kapi-*` filenames for the generic workflow service and local service factory.
3434
- The local service factory export uses the semantic `createLocalWorkflowService` name instead of `createLocalKapiService`.
3535
- Presentation helper exports use semantic workflow/tool names for generic helpers (`WorkflowToolDefinition`, `shouldBlockWorkflowToolCall`, `formatWorkflowError`).
36+
- PR review state helpers use generic pull-request / agent-review names (`PullRequestReviewState`, `PullRequestReviewView`, `latestAgentReview`, `reviewCheckConclusion`).
37+
- Registry entry types now use the semantic `WorkflowRegistryEntry` name across the domain, adapter, CLI, presentation, and tests.
3638

3739
## Residual scan after service filename rename
3840

src/adapters/registry-store.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { KapiRegistryEntry, RegistryActivePointer, RegistryIndex, RegistryListResult } from "../domain/registry.js";
1+
import type { WorkflowRegistryEntry, RegistryActivePointer, RegistryIndex, RegistryListResult } from "../domain/registry.js";
22
import { fs, isNotFoundError, path } from "./fs-path.js";
33

44
const SAFE_REGISTRY_SLUG = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
@@ -10,7 +10,7 @@ export function assertSafeRegistrySlug(slug: string): void {
1010
export class FileRegistryStore {
1111
constructor(private readonly rootName = ".ilchul") {}
1212

13-
async saveEntry(baseRepo: string, entry: KapiRegistryEntry, options: { setActive?: boolean } = {}): Promise<void> {
13+
async saveEntry(baseRepo: string, entry: WorkflowRegistryEntry, options: { setActive?: boolean } = {}): Promise<void> {
1414
const file = this.entryPath(baseRepo, entry.slug);
1515
await this.writeJsonAtomic(file, entry);
1616
const entries = await this.listEntries(baseRepo);
@@ -19,19 +19,19 @@ export class FileRegistryStore {
1919
if (options.setActive) await this.setActive(baseRepo, entry);
2020
}
2121

22-
async loadEntry(baseRepo: string, slug: string): Promise<KapiRegistryEntry | undefined> {
23-
const entry = await this.readJson<KapiRegistryEntry>(this.entryPath(baseRepo, slug));
22+
async loadEntry(baseRepo: string, slug: string): Promise<WorkflowRegistryEntry | undefined> {
23+
const entry = await this.readJson<WorkflowRegistryEntry>(this.entryPath(baseRepo, slug));
2424
if (!entry) return undefined;
2525
return this.validateLoadedEntry(entry, slug);
2626
}
2727

28-
async listEntries(baseRepo: string): Promise<KapiRegistryEntry[]> {
28+
async listEntries(baseRepo: string): Promise<WorkflowRegistryEntry[]> {
2929
return (await this.listEntriesTolerant(baseRepo, { strict: true })).entries;
3030
}
3131

3232
async listEntriesTolerant(baseRepo: string, options: { strict?: boolean } = {}): Promise<RegistryListResult> {
3333
const dir = this.workflowsDir(baseRepo);
34-
const entries: KapiRegistryEntry[] = [];
34+
const entries: WorkflowRegistryEntry[] = [];
3535
const warnings: RegistryListResult["warnings"] = [];
3636
try {
3737
for (const item of await fs.readdir(dir, { withFileTypes: true })) {
@@ -40,7 +40,7 @@ export class FileRegistryStore {
4040
if (!this.isSafeRegistrySlug(fileSlug)) continue;
4141
const file = path.join(dir, item.name);
4242
try {
43-
const entry = await this.readJson<KapiRegistryEntry>(file);
43+
const entry = await this.readJson<WorkflowRegistryEntry>(file);
4444
if (!entry) continue;
4545
const validEntry = this.validateListedEntry(entry, fileSlug);
4646
if (validEntry) entries.push(validEntry);
@@ -55,7 +55,7 @@ export class FileRegistryStore {
5555
return { entries: entries.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt) || a.slug.localeCompare(b.slug)), warnings };
5656
}
5757

58-
async setActive(baseRepo: string, entry: KapiRegistryEntry): Promise<void> {
58+
async setActive(baseRepo: string, entry: WorkflowRegistryEntry): Promise<void> {
5959
const active: RegistryActivePointer = {
6060
schemaVersion: 1,
6161
slug: entry.slug,
@@ -66,7 +66,7 @@ export class FileRegistryStore {
6666
await this.writeJsonAtomic(this.activePath(baseRepo), active);
6767
}
6868

69-
async loadActive(baseRepo: string): Promise<KapiRegistryEntry | undefined> {
69+
async loadActive(baseRepo: string): Promise<WorkflowRegistryEntry | undefined> {
7070
const active = await this.readJson<RegistryActivePointer>(this.activePath(baseRepo));
7171
if (!active) return undefined;
7272
return this.loadEntry(baseRepo, active.slug);
@@ -106,18 +106,18 @@ export class FileRegistryStore {
106106
return SAFE_REGISTRY_SLUG.test(slug);
107107
}
108108

109-
private validateLoadedEntry(entry: KapiRegistryEntry, expectedSlug: string): KapiRegistryEntry {
109+
private validateLoadedEntry(entry: WorkflowRegistryEntry, expectedSlug: string): WorkflowRegistryEntry {
110110
assertSafeRegistrySlug(entry.slug);
111111
if (entry.slug !== expectedSlug) throw new Error(`Kapi registry entry slug mismatch: expected ${expectedSlug}, found ${entry.slug}`);
112112
return entry;
113113
}
114114

115-
private validateListedEntry(entry: KapiRegistryEntry, fileSlug: string): KapiRegistryEntry | undefined {
115+
private validateListedEntry(entry: WorkflowRegistryEntry, fileSlug: string): WorkflowRegistryEntry | undefined {
116116
if (!this.isSafeRegistrySlug(entry.slug)) return undefined;
117117
return entry.slug === fileSlug ? entry : undefined;
118118
}
119119

120-
private async writeIndex(baseRepo: string, entries: KapiRegistryEntry[]): Promise<void> {
120+
private async writeIndex(baseRepo: string, entries: WorkflowRegistryEntry[]): Promise<void> {
121121
const index: RegistryIndex = {
122122
schemaVersion: 1,
123123
updatedAt: new Date().toISOString(),

0 commit comments

Comments
 (0)