Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Issue #37 is intentionally split into reviewable child slices: executable CLI se

### Review CLI Harness

`kapi-review github-pr` emits non-posting JSON for kapi-agent review/check automation. The harness now reports semantic change metrics, a `TRIVIAL`/`LOW_RISK`/`STANDARD`/`HIGH_RISK`/`CRITICAL` risk profile, required evidence gates, structured finding validation, bundled repo-local review guidance, isolated read-only runner prompt provenance, optional `--runner-output-file` structured findings ingestion, optional `--runner-command` isolated runner invocation, and the legacy changed-line context. Runner commands receive a temporary `KAPI_REVIEW_RUNNER_INPUT` JSON file containing the read-only runner metadata, risk/context, review body, and the bundled-guidance prompt material, execute from that temporary workspace with a minimal sanitized environment, then return structured findings JSON for deterministic validation. Size is a risk signal rather than the only decision: docs/generated-heavy changes can pass the size gate when semantic source risk is low, while sensitive paths require stronger evidence even when small. Low-confidence `BLOCKER` findings are normalized to non-blocking `QUESTION` findings so uncertain reviewer signals do not masquerade as merge-blocking defects. GitHub merge enforcement for formal kapi-agent approval lives in `.github/workflows/kapi-agent-formal-approval-gate.yml`; require `require formal kapi-agent approval` plus `kapi-agent/review` in branch protection/rulesets. Re-review requests after stale/non-approving kapi-agent reviews must put `@kapi-agent review`, the current head SHA, `What changed`, `Why this closes the prior feedback`, and `Verification` in the same author comment; see `docs/kapi-agent-approval-gate.md`.
`ilchul-review github-pr` emits non-posting JSON for kapi-agent review/check automation. The harness now reports semantic change metrics, a `TRIVIAL`/`LOW_RISK`/`STANDARD`/`HIGH_RISK`/`CRITICAL` risk profile, required evidence gates, structured finding validation, bundled repo-local review guidance, isolated read-only runner prompt provenance, optional `--runner-output-file` structured findings ingestion, optional `--runner-command` isolated runner invocation, and the legacy changed-line context. Runner commands receive a temporary `KAPI_REVIEW_RUNNER_INPUT` JSON file containing the read-only runner metadata, risk/context, review body, and the bundled-guidance prompt material, execute from that temporary workspace with a minimal sanitized environment, then return structured findings JSON for deterministic validation. Size is a risk signal rather than the only decision: docs/generated-heavy changes can pass the size gate when semantic source risk is low, while sensitive paths require stronger evidence even when small. Low-confidence `BLOCKER` findings are normalized to non-blocking `QUESTION` findings so uncertain reviewer signals do not masquerade as merge-blocking defects. GitHub merge enforcement for formal kapi-agent approval lives in `.github/workflows/kapi-agent-formal-approval-gate.yml`; require `require formal kapi-agent approval` plus `kapi-agent/review` in branch protection/rulesets. Re-review requests after stale/non-approving kapi-agent reviews must put `@kapi-agent review`, the current head SHA, `What changed`, `Why this closes the prior feedback`, and `Verification` in the same author comment; see `docs/kapi-agent-approval-gate.md`.

### Agent Tools

Expand Down
11 changes: 11 additions & 0 deletions bin/ilchul-review.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env node
import { spawnSync } from "node:child_process";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";

const require = createRequire(import.meta.url);
const tsxLoader = require.resolve("tsx");
const cliPath = fileURLToPath(new URL("../src/cli/review-gate-cli.ts", import.meta.url));
const result = spawnSync(process.execPath, ["--import", tsxLoader, cliPath, ...process.argv.slice(2)], { stdio: "inherit" });
if (result.error) throw result.error;
process.exitCode = result.status ?? 1;
69 changes: 52 additions & 17 deletions docs/product-name-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ git grep -n -i -E 'kapi|ilchul' -- ':!package-lock.json' ':!node_modules'

| Surface | Current state | Classification | Follow-up direction |
| --- | --- | --- | --- |
| Package metadata | `package.json` is still named `ka-pi`; package bins include public `ilchul` and external `kapi-review`, but no `kapi` runtime bin. | package brand / external review integration | Do not retain a `kapi` runtime CLI alias. Prefer `ilchul` for public runtime docs and examples; reserve `runctl` for internal runtime implementation naming. Keep `kapi-review` while the GitHub review integration uses that command. |
| Package metadata | `package.json` is still named `ka-pi`; package bins include public `ilchul` and review harness `ilchul-review`, but no `kapi` runtime bin. | package brand / external review integration | Do not retain a `kapi` runtime CLI alias. Prefer `ilchul` for public runtime docs and examples; reserve `runctl` for internal runtime implementation naming. Use `ilchul-review` for the review harness CLI while keeping `kapi-agent` and `kapi-agent/review` as GitHub integration names. |
| CLI runtime entrypoint | `src/cli/runctl-cli.ts` and related tests use semantic runtime names. This slice keeps the public `ilchul` command wired through the internal `bin/runctl.mjs` wrapper and semantic `parseRuntimeArgs` / `runRuntimeCli` exports, removes the old `bin/kapi.mjs` shim, and verifies package-local/prefix installs do not expose `kapi`. | public brand command with internal semantic implementation | Internal runtime callers should import from `src/cli/runctl-cli.ts` and use semantic runtime exports; product-named runtime command aliases must not be reintroduced at the package/bin edge. |
| CLI setup helper | `setup:cli` still invokes `scripts/setup-runctl-cli.mjs`, but its completion text now points to `ilchul --help`. | internal semantic filename plus brand-facing user guidance | Keep output brand-facing where users see it and implementation filename semantic internally. |
| Slash commands and workflow IDs | `/kapi-*`, `kapi-ralph`, `kapi-autoresearch`, and related state fields remain serialized workflow contracts. | persisted compatibility identifiers | Do not rename without an explicit compatibility/deprecation migration. |
| 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. |
| 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. |
| GitHub review integration | `kapi-agent` and `kapi-agent/review` remain literal GitHub integration names; the local review harness CLI is `ilchul-review`. | external integration | Keep literal names while the GitHub App and required checks use them. |
| 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. |
| Core/domain/application identifiers | The registry entry type now uses `WorkflowRegistryEntry`; the store interface/class now use `WorkflowStore` / `FileWorkflowStore`; the service class and active tests now use `WorkflowService` without the temporary `KapiService` compatibility export. | reusable-code leakage removed from the active service/store surface | Keep future reusable service/store imports on the semantic `Workflow*` names. |
| Application service filenames | The service implementation and factory now use semantic filenames: `src/application/workflow-service.ts` and `src/adapters/workflow-service-factory.ts`; the primary exported service class is now `WorkflowService`. | internal semantic implementation | Keep imports on the semantic service paths; do not reintroduce a product-named service alias for reusable internal code. |
Expand All @@ -39,36 +39,71 @@ git grep -n -i -E 'kapi|ilchul' -- ':!package-lock.json' ':!node_modules'
- Service source surfaces now use semantic `WorkflowService` in the implementation, local factory, presentation layer, runtime probe scripts, and active tests; the temporary `KapiService` export has been removed after migrating the large remaining test clusters.
- Presentation registration/UI action helpers now use semantic workflow names (`registerWorkflowExtension`, `registerWorkflowCommandsAndTools`, `registerWorkflowTools`, `WorkflowUiActionContext`, `installWorkflowAutocomplete`, `toggleWorkflowWidgetExpanded`) while leaving public `kapi_*` tool names and `/kapi-*` contracts intact.
- Adapter/domain private helper names now use semantic state/workflow naming for symlink guards, managed autoresearch symlinks, worker branch validation, and prompt rule rendering while preserving user-facing Kapi contract text.
- Review gate helper exports now use semantic review-gate names (`ReviewGateInput`, `ReviewGateResult`, `buildReviewGate`, `runReviewGateCli`, `parseReviewGateArgs`, `REVIEW_GATE_MAX_CHANGED_LINES`) while preserving the `kapi-review` CLI and `kapi-agent` review contract text.
- Runtime package metadata now exposes only the `ilchul` runtime bin and the external `kapi-review` review harness; `kapi` is absent from `package.json` / `package-lock.json`, `bin/kapi.mjs` is removed, and `test/cli-bin.test.ts` asserts package-local and isolated-prefix installs do not expose a `kapi` runtime command.
- Review gate helper exports now use semantic review-gate names (`ReviewGateInput`, `ReviewGateResult`, `buildReviewGate`, `runReviewGateCli`, `parseReviewGateArgs`, `REVIEW_GATE_MAX_CHANGED_LINES`) while renaming the review harness CLI to `ilchul-review` and preserving the `kapi-agent` review contract text.
- Runtime package metadata now exposes only the `ilchul` runtime bin and the `ilchul-review` review harness; `kapi` is absent from `package.json` / `package-lock.json`, `bin/kapi.mjs` is removed, and `test/cli-bin.test.ts` asserts package-local and isolated-prefix installs do not expose a `kapi` runtime command.

## Residual scan after runtime alias removal

```text
find src -iname '*kapi*' -print
src/.kapi
src/.kapi/lanes/kapi-autoresearch
src/.kapi/lanes/kapi-autoresearch/kapi-ux-개선-계획
src/cli/kapi-review-cli.ts
git ls-files 'src/*kapi*' 'src/**/*kapi*' | sort
# count: 0 tracked filename hits

node -e 'const p=require("./package.json"); console.log(JSON.stringify(p.bin,null,2))'
{
"ilchul": "./bin/runctl.mjs",
"kapi-review": "./src/cli/kapi-review-cli.ts"
"ilchul-review": "./bin/ilchul-review.mjs"
}

rg -n '"kapi"\\s*:|bin/kapi|npm exec -- kapi|kapi compatibility alias|kapi --help' package.json package-lock.json README.md docs test bin src scripts
test/cli-bin.test.ts:41:test("package metadata exposes ilchul runtime bin without kapi compatibility alias", async () => {
rg -n '"kapi"\\s*:|"kapi-review"|bin/kapi|npm exec -- kapi|kapi compatibility alias|kapi --help' package.json package-lock.json README.md docs test bin src scripts
test/cli-bin.test.ts:41:test("package metadata exposes ilchul bins without kapi compatibility aliases", async () => {
```

Remaining `src/` filename hits are legacy fixture state under `src/.kapi` and the literal `kapi-review` external integration CLI. Runtime package metadata no longer exposes a `kapi` bin, and the old direct `bin/kapi.mjs` shim is removed.
Tracked `src/` filename scans now have no `kapi` hits. Runtime package metadata no longer exposes a `kapi` bin, and the old direct `bin/kapi.mjs` shim is removed. The review harness is exposed through `bin/ilchul-review.mjs` and implemented by semantic `src/cli/review-gate-cli.ts`. Local ignored/generated fixture state under `src/.kapi` may exist in developer worktrees, but it is not part of the committed source tree scan.

## Final acceptance scan counts

The final issue #209 residual scans were run against the committed runtime-alias-retirement tree. Active `src/` content counts exclude only ignored/generated fixture state so the evidence is reproducible from a clean checkout:

```text
rg -n -i 'kapi' src --glob '!src/.kapi/**' --glob '!src/.git/**'
# 497 matching lines / 586 matches across 36 active src files

rg -n 'Kapi[A-Z]|\bkapi[A-Z_-]|kapi-' src test docs package.json package-lock.json
# 1285 matching lines / 1462 matches across source, tests, docs, and package metadata

rg -n '\b(class|interface|type|function|const|let|var|enum)\s+[A-Za-z0-9_]*Kapi[A-Za-z0-9_]*|\b(class|interface|type|function|const|let|var|enum)\s+kapi[A-Za-z0-9_]*' src
# no internal reusable declaration-name hits
```

Active `src/` residual category counts:

| Category | Lines | Matches | Files | Why retained |
| --- | ---: | ---: | ---: | --- |
| User-facing compatibility text | 228 | 240 | 25 | Status/help/diagnostic wording still describes the existing Kapi workflow contract exposed to users. |
| Serialized workflow/event contracts | 124 | 147 | 20 | Workflow IDs, event kinds, run-contract source kinds, and persisted state keys remain compatibility contracts. |
| Slash commands / public tool contracts | 99 | 126 | 12 | `/kapi-*`, `kapi_*`, and `@kapi:` surfaces are public contract names pending a separate migration plan. |
| External review integration | 20 | 44 | 5 | `ilchul-review`, `kapi-agent`, and `kapi-agent/review` are literal external integration names. |
| Environment/runtime compatibility | 10 | 11 | 7 | `KAPI_*` environment variables remain compatibility inputs for runtime dispatch and tests. |
| Other compatibility literals | 16 | 18 | 10 | Shell labels, fixture command strings, and small compatibility literals that are not reusable implementation identifiers. |

## Issue #209 acceptance mapping

| Acceptance criterion | Status | Evidence |
| --- | --- | --- |
| `src/` contains no `kapi` in filenames except explicitly justified boundary exceptions. | Met | Tracked filename scan has 0 hits. The review harness source is now semantic `src/cli/review-gate-cli.ts`; ignored/generated local `src/.kapi` fixture state is not part of the committed source tree. |
| Internal reusable exports/types/functions/classes no longer use `Kapi*` / `kapi*` naming. | Met | Declaration-name scan returns no active `src` hits. Remaining exported literals are serialized contracts, event names, or external integration strings. |
| Remaining `kapi` hits in `src/` are limited to documented compatibility contracts, serialized workflow IDs, slash-command literals, or intentionally named external integrations. | Met | Category table above classifies all 497 active `src` matching lines / 586 matches. |
| Public runtime command examples remain `ilchul`; internal implementation names remain generic. | Met | Package bins are `ilchul` and `ilchul-review`; runtime internals use `runctl` / `runtime` / `workflow` / `worker` names where reusable. |
| Tests prove package/runtime CLI does not expose a `kapi` runtime alias. | Met | `test/cli-bin.test.ts` covers package-local `npm exec -- kapi --help` failure and isolated-prefix absence of a `kapi` shim. |
| Final scan report includes remaining exception categories and counts. | Met | This section records filename, content, semantic scan, declaration scan, and residual category counts. |

## Remaining justified product-name identifiers

- **External review integration:** `kapi-review`, `kapi-agent`, `kapi-agent/review`.
- **Persisted contracts:** `/kapi-*` slash commands, `kapi-*` workflow IDs, existing serialized state expectations.
- **Storage/config namespace:** `.ilchul`, `~/.ilchul`, `ILCHUL_*`, legacy `.kapi` references.
- **External integration:** `kapi-agent`, `kapi-agent/review`.
- **External review integration:** `ilchul-review`, `kapi-agent`, `kapi-agent/review`.
- **Persisted contracts:** `/kapi-*` slash commands, `kapi-*` workflow IDs, `kapi.worker.*` / `kapi.pr.*` event names, `kapi-workflow` run-contract source kind, and existing serialized state expectations.
- **Public tool / command contracts:** `kapi_*` tool names and `@kapi:` UI completion syntax.
- **User-facing compatibility text:** status, help, validation, and diagnostic strings that describe the still-public Kapi workflow contract.
- **Storage/config namespace:** `.ilchul`, `~/.ilchul`, `ILCHUL_*`, legacy `.kapi` references, and compatibility `KAPI_*` environment inputs.
- **Documentation/history:** prose explaining migration context or historical behavior.

## Not changed in this slice
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"bin": {
"ilchul": "./bin/runctl.mjs",
"kapi-review": "./src/cli/kapi-review-cli.ts"
"ilchul-review": "./bin/ilchul-review.mjs"
},
"keywords": [
"pi-package",
Expand Down
Loading
Loading