Files
YG-Rules/skill/yg-rules-pipeline/references/local-pipeline.md

51 lines
1.3 KiB
Markdown

# Local Pipeline Reference
## Purpose
Run the existing project code without Flask:
```text
input folder
-> domains.json
-> schema.json
-> guidance file records
-> guidance_analysis records
-> RuleGenerationService task
-> output/rules-{task_id}/rules-{task_id}.xlsx
-> output/rules-{task_id}/rules-{task_id}.md
```
## Input Discovery
The script searches the input directory for:
- `domains.xlsx`, `domains.xls`, `domains.csv`, or `domains.json`
- `schema.xlsx` or `schema.xls`
- `guidance/`
Domain guidance lookup uses exact domain directory names. If a domain is named `过度负债`, put files under:
```text
guidance/过度负债/
```
Put shared policy files under:
```text
guidance/_all/
```
## State Mutation
`DomainStorage.save_domains()` replaces `data/domains.json`. This is intentional for a folder-driven run.
`SchemaStorage.save()` replaces `data/schema.json` and starts background schema description generation. Rule generation can still use parsed schema modules immediately.
Guidance file uploads append file records to current domains.
## Completion
Rule generation is asynchronous. Poll `RuleGenerationService.get_status(task_id)` until `status` is `done` or `failed`.
Treat `failed` as a completed task state but return nonzero from CLI unless `--allow-failed` is added in the future.