Просмотр исходного кода

chore: add open-source infrastructure

- Issue templates (bug report, feature request) with structured forms
- PR template with summary/changes/test plan sections
- CHANGELOG.md covering v0.1.0 through v0.3.6
- CONTRIBUTING.md with setup, conventions, and workflow
- Release workflow: auto-create GitHub release from version tags
majx_mac 8 месяцев назад
Родитель
Сommit
29e4c15989

+ 81 - 0
.github/ISSUE_TEMPLATE/bug_report.yml

@@ -0,0 +1,81 @@
+name: Bug Report
+description: Report a bug in InkOS
+labels: ["bug"]
+body:
+  - type: markdown
+    attributes:
+      value: |
+        Thanks for reporting a bug. Please fill in the details below.
+
+  - type: input
+    id: version
+    attributes:
+      label: InkOS Version
+      description: Run `inkos --version` to get this
+      placeholder: "0.3.6"
+    validations:
+      required: true
+
+  - type: dropdown
+    id: component
+    attributes:
+      label: Component
+      options:
+        - CLI (inkos command)
+        - Writer Agent
+        - Auditor / Continuity Check
+        - Reviser Agent
+        - Scheduler / Daemon
+        - Detection (AIGC)
+        - State Management
+        - Other
+    validations:
+      required: true
+
+  - type: textarea
+    id: description
+    attributes:
+      label: What happened?
+      description: Describe the bug clearly
+    validations:
+      required: true
+
+  - type: textarea
+    id: expected
+    attributes:
+      label: Expected behavior
+      description: What should have happened?
+    validations:
+      required: true
+
+  - type: textarea
+    id: reproduce
+    attributes:
+      label: Steps to reproduce
+      description: Minimal steps to trigger the bug
+      placeholder: |
+        1. inkos init
+        2. inkos book create --title "test" --genre xuanhuan --platform tomato
+        3. inkos write next test
+        4. ...
+    validations:
+      required: true
+
+  - type: textarea
+    id: logs
+    attributes:
+      label: Error logs
+      description: Paste relevant error output
+      render: shell
+
+  - type: input
+    id: node
+    attributes:
+      label: Node.js version
+      placeholder: "22.x"
+
+  - type: input
+    id: os
+    attributes:
+      label: Operating System
+      placeholder: "macOS 15 / Ubuntu 24.04 / Windows 11"

+ 45 - 0
.github/ISSUE_TEMPLATE/feature_request.yml

@@ -0,0 +1,45 @@
+name: Feature Request
+description: Suggest a new feature or enhancement
+labels: ["enhancement"]
+body:
+  - type: markdown
+    attributes:
+      value: |
+        Have an idea for InkOS? Describe it below.
+
+  - type: dropdown
+    id: area
+    attributes:
+      label: Area
+      options:
+        - Writing Quality (agents, prompts, truth files)
+        - AIGC Detection & Anti-detection
+        - Automation (scheduler, daemon, webhooks)
+        - CLI / UX
+        - Genre System
+        - Export / Integration
+        - Other
+    validations:
+      required: true
+
+  - type: textarea
+    id: problem
+    attributes:
+      label: Problem or motivation
+      description: What problem does this solve? Why is it needed?
+    validations:
+      required: true
+
+  - type: textarea
+    id: solution
+    attributes:
+      label: Proposed solution
+      description: How would you solve it? Include API/CLI examples if possible.
+    validations:
+      required: true
+
+  - type: textarea
+    id: alternatives
+    attributes:
+      label: Alternatives considered
+      description: Other approaches you thought of

+ 17 - 0
.github/PULL_REQUEST_TEMPLATE.md

@@ -0,0 +1,17 @@
+## Summary
+
+<!-- What does this PR do? 1-3 bullet points -->
+
+## Changes
+
+<!-- List key files changed and why -->
+
+## Test plan
+
+- [ ] `pnpm typecheck` passes
+- [ ] `pnpm test` passes (all existing + new tests)
+- [ ] Manual verification: <!-- describe what you tested -->
+
+## Related issues
+
+<!-- Closes #XX, Fixes #XX, etc. -->

+ 34 - 0
.github/workflows/release.yml

@@ -0,0 +1,34 @@
+name: Release
+
+on:
+  push:
+    tags: ["v*"]
+
+permissions:
+  contents: write
+
+jobs:
+  create-release:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Extract version from tag
+        id: version
+        run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
+
+      - name: Extract changelog section
+        id: changelog
+        run: |
+          VERSION="${{ steps.version.outputs.version }}"
+          # Extract the section for this version from CHANGELOG.md
+          awk "/^## ${VERSION}$/,/^## [0-9]/" CHANGELOG.md | head -n -1 | tail -n +2 > /tmp/release-notes.md
+          echo "notes<<EOF" >> "$GITHUB_OUTPUT"
+          cat /tmp/release-notes.md >> "$GITHUB_OUTPUT"
+          echo "EOF" >> "$GITHUB_OUTPUT"
+
+      - name: Create GitHub Release
+        uses: softprops/action-gh-release@v2
+        with:
+          body: ${{ steps.changelog.outputs.notes }}
+          generate_release_notes: false

+ 84 - 0
CHANGELOG.md

@@ -0,0 +1,84 @@
+# Changelog
+
+## 0.3.6
+
+### Features
+- **10 quality & automation enhancements**
+  - Sensitive word detection (dim 27): built-in political/sexual/violence word lists
+  - Multi-model routing: `modelOverrides` config maps agent roles to different models
+  - Spot-fix revise mode: targeted minimal changes with half token budget
+  - Character dialogue fingerprinting: extracts per-character speaking style from recent chapters
+  - Entity-based context retrieval: lightweight relevant-summary matching from chapter summaries
+  - Post-write constraint validation: regex-based prohibition checks (zero LLM cost)
+  - Temperature retry threading: scheduler→runner→writer for quality gate retries
+  - Failure clustering: per-dimension failure tracking with diagnostic webhook alerts
+  - Auto-detection loop in daemon: audit pass → detect → anti-detect rewrite
+  - Analytics CLI: `inkos analytics [book-id]` for chapter/word/audit statistics
+- Word count control via `--words` flag
+
+### Fixes
+- Align capability declarations with actual implementation (genre enum, audit dimensions, truth file count, revise modes)
+
+## 0.3.5
+
+### Features
+- **12-feature enhancement** (Phases 1–12 from plan)
+  - Chapter summaries for cross-chapter coherence
+  - Structural AI-tells detection (paragraph uniformity, cliche density, formulaic transitions)
+  - Webhook notifications with HMAC signing
+  - Subplot progress board
+  - Emotional arc tracking
+  - Character interaction matrix with information boundaries
+  - Pacing health scoring
+  - AIGC detection API integration (`inkos detect`)
+  - Style fingerprint learning (`inkos style analyze/import`)
+  - Anti-detect rewrite pipeline stage
+  - Smart scheduler with quality gates
+  - Detection feedback loop with history analytics
+
+### Fixes
+- Shared prepack/postpack scripts prevent `workspace:*` leaking into npm tarballs
+
+## 0.3.4
+
+### Features
+- CLI UX improvements: auto-detect book-id, `--json` output everywhere, `inkos update` command
+- Variadic args for `review approve/reject`
+
+## 0.3.2
+
+### Features
+- Dual API format support (OpenAI + Anthropic SDK)
+- API key security: key stored in `.env` only, not in `inkos.json`
+- Optional LLM params (temperature, maxTokens)
+- Global LLM config via `~/.inkos/.env`
+- `inkos init` works without arguments (uses current directory)
+- Friendly LLM error messages + `inkos doctor` API connectivity test
+
+## 0.3.0
+
+### Features
+- Three-layer rule architecture: platform → genre → book
+- Genre profiles: xuanhuan, xianxia, urban, horror
+- Genre-aware architect, 19-dimension auditor, reviser modes (polish/rewrite/rework)
+- Genre CLI commands: `inkos genre list/show/edit`
+- Writer prompts extracted into genre-aware prompt builder
+
+## 0.2.0
+
+### Features
+- Pluggable radar via `RadarSource` interface
+- State snapshots and chapter rewrite command
+- Numeric verification rules
+- Batch approve command
+- Export command for publishing
+- Book write lock with index-based chapter numbering
+
+## 0.1.0
+
+### Initial Release
+- Multi-agent pipeline: Writer → Auditor → Reviser
+- CLI with init, config, book, write, review, status, radar, up/down commands
+- Three truth files: current_state, particle_ledger, pending_hooks
+- Architect agent for world-building and volume outlines
+- OpenAI-compatible LLM provider

+ 58 - 0
CONTRIBUTING.md

@@ -0,0 +1,58 @@
+# Contributing to InkOS
+
+## Setup
+
+```bash
+git clone https://github.com/Narcooo/inkos.git
+cd inkos
+pnpm install
+pnpm build
+```
+
+## Development
+
+```bash
+pnpm dev          # Watch mode (core + cli)
+pnpm typecheck    # Type checking
+pnpm test         # Run all tests
+```
+
+### Project Structure
+
+```
+packages/
+  core/     # Agents, pipeline, state, models — the engine
+  cli/      # Commander.js CLI — thin wrapper over core
+  studio/   # Web UI (future)
+```
+
+### Key conventions
+
+- **TypeScript strict mode** — no `any` unless unavoidable
+- **Immutable patterns** — create new objects, never mutate
+- **Small files** — 200–400 lines typical, 800 max
+- **Zod schemas** — all external data validated at boundaries
+- **Tests** — `vitest`, co-located in `__tests__/`
+
+## Submitting changes
+
+1. Fork and create a feature branch
+2. Write tests for new functionality
+3. Ensure `pnpm typecheck && pnpm test` passes
+4. Open a PR with a clear description
+
+### Commit messages
+
+```
+<type>: <description>
+
+Types: feat, fix, refactor, docs, test, chore, perf
+```
+
+## Reporting bugs
+
+Use the [bug report template](https://github.com/Narcooo/inkos/issues/new?template=bug_report.yml).
+
+## Feature requests
+
+Use the [feature request template](https://github.com/Narcooo/inkos/issues/new?template=feature_request.yml).