soturail 0.2.1 → 0.2.3

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.
Files changed (45) hide show
  1. package/README.md +81 -0
  2. package/dist/cli.js +6 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/bench.d.ts +14 -3
  5. package/dist/commands/bench.js +237 -180
  6. package/dist/commands/bench.js.map +1 -1
  7. package/dist/commands/release.d.ts +3 -0
  8. package/dist/commands/release.js +59 -0
  9. package/dist/commands/release.js.map +1 -0
  10. package/dist/commands/run.js +20 -1
  11. package/dist/commands/run.js.map +1 -1
  12. package/dist/commands/self.d.ts +2 -0
  13. package/dist/commands/self.js +49 -0
  14. package/dist/commands/self.js.map +1 -0
  15. package/dist/commands/stats.d.ts +6 -0
  16. package/dist/commands/stats.js +28 -0
  17. package/dist/commands/stats.js.map +1 -1
  18. package/dist/core/config.d.ts +1 -1
  19. package/dist/core/config.js +1 -0
  20. package/dist/core/config.js.map +1 -1
  21. package/dist/core/file-scanner.js +6 -2
  22. package/dist/core/file-scanner.js.map +1 -1
  23. package/dist/core/metrics-store.d.ts +7 -0
  24. package/dist/core/metrics-store.js.map +1 -1
  25. package/dist/core/release-preflight.d.ts +22 -0
  26. package/dist/core/release-preflight.js +199 -0
  27. package/dist/core/release-preflight.js.map +1 -0
  28. package/dist/core/self-dogfood.d.ts +56 -0
  29. package/dist/core/self-dogfood.js +323 -0
  30. package/dist/core/self-dogfood.js.map +1 -0
  31. package/dist/core/version.d.ts +1 -0
  32. package/dist/core/version.js +3 -0
  33. package/dist/core/version.js.map +1 -0
  34. package/docs/benchmarking.md +4 -2
  35. package/docs/hooks/claude.md +4 -0
  36. package/docs/hooks/codex.md +11 -0
  37. package/docs/hooks/cursor.md +11 -0
  38. package/docs/hooks/gemini.md +11 -0
  39. package/docs/hooks.md +11 -0
  40. package/docs/release-checklist.md +76 -6
  41. package/docs/release-workflow.md +84 -0
  42. package/docs/skill-rail.md +28 -0
  43. package/docs/windows.md +97 -0
  44. package/docs/workflow-rail.md +26 -0
  45. package/package.json +9 -3
package/README.md CHANGED
@@ -8,6 +8,8 @@
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6)](tsconfig.json)
9
9
  [![MIT License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
10
10
  [![CI](https://github.com/Soturine/soturail/actions/workflows/ci.yml/badge.svg)](https://github.com/Soturine/soturail/actions/workflows/ci.yml)
11
+ [![npm version](https://img.shields.io/npm/v/soturail.svg)](https://www.npmjs.com/package/soturail)
12
+ [![npm downloads](https://img.shields.io/npm/dm/soturail.svg)](https://www.npmjs.com/package/soturail)
11
13
  [![local-first](https://img.shields.io/badge/local--first-yes-f97316)](docs/security-model.md)
12
14
  [![context-engineering](https://img.shields.io/badge/context--engineering-SotuRail-7c3aed)](docs/prompt-caching.md)
13
15
 
@@ -24,6 +26,48 @@ It wraps a repository and terminal session with reversible evidence rails: heuri
24
26
 
25
27
  v0.2.x is early but functional. TypeScript mode is stable for local usage. Native Rust mode is optional and focused on hot paths. Benchmarks are local and reproducible. External comparisons are optional and user-provided.
26
28
 
29
+ ## Built With SotuRail
30
+
31
+ SotuRail now dogfoods itself for release-oriented development. `soturail self all` runs repository checks, indexing, build, tests, benchmarks and a local Markdown report through SotuRail's own rails.
32
+
33
+ ## Self-Dogfooding
34
+
35
+ ```bash
36
+ soturail self doctor
37
+ soturail self index
38
+ soturail self build
39
+ soturail self test
40
+ soturail self bench
41
+ soturail self report
42
+ soturail self all
43
+ ```
44
+
45
+ Reports are written to `.soturail/reports/self-dogfood.md` with stable project context first and dynamic raw IDs, command status and benchmark data later.
46
+
47
+ ## Release Workflow
48
+
49
+ Release automation is local-first and conservative:
50
+
51
+ ```bash
52
+ npm run release:check
53
+ npm run release:prepare -- --version X.Y.Z
54
+ npm run release:publish -- --version X.Y.Z
55
+ npm run release:full -- --version X.Y.Z
56
+ ```
57
+
58
+ The release script never runs `npm audit fix --force`, never publishes when build/tests/runtime audit fail and never creates a GitHub release before npm publish succeeds. See [docs/release-workflow.md](docs/release-workflow.md).
59
+
60
+ ## Release Reliability
61
+
62
+ SotuRail includes a release preflight check to prevent stale package metadata, broken npm CLI binaries, missing release notes, and changelog/version mismatches.
63
+
64
+ ```bash
65
+ npm run build
66
+ npm test
67
+ npm run release:check
68
+ npm pack --dry-run
69
+ ```
70
+
27
71
  ## 2. Why SotuRail Exists
28
72
 
29
73
  AI coding agents often receive too much unstable context: full files, noisy test logs, repeated terminal output and long conversational summaries. SotuRail is designed to unify those workflows into one independent local-first tool without sending telemetry or inventing provider metrics.
@@ -51,6 +95,23 @@ SotuRail aims to unify these ideas into one local-first workflow: reversible raw
51
95
 
52
96
  ## 5. Installation
53
97
 
98
+ Use directly with npx:
99
+
100
+ ```bash
101
+ npx soturail --help
102
+ npx soturail@0.2.3 --help
103
+ ```
104
+
105
+ Install globally:
106
+
107
+ ```bash
108
+ npm install -g soturail
109
+ soturail --help
110
+ soturail --version
111
+ ```
112
+
113
+ For local development from source:
114
+
54
115
  ```bash
55
116
  npm install
56
117
  npm run build
@@ -65,6 +126,8 @@ npm run build:native # optional, requires cargo
65
126
  npm run build:all # TypeScript + native, requires cargo
66
127
  ```
67
128
 
129
+ npm package: https://www.npmjs.com/package/soturail
130
+
68
131
  ## Native Performance Path
69
132
 
70
133
  TypeScript remains the public CLI, orchestration, docs and npm distribution layer. Rust handles optional hot paths where streaming, low overhead and binary execution matter:
@@ -132,6 +195,10 @@ soturail bench compare-optional --tool squeez
132
195
  - Knowledge-to-Rules is reusable structuring, not pure compression; structured rules can be larger than a tiny source document because they add citations and validator metadata.
133
196
  - Native performance compares Rust and TypeScript only when `soturail-native` is built locally.
134
197
 
198
+ ## Honest Metrics
199
+
200
+ Local token counts are deterministic estimates. SotuRail reports raw payload tokens, reduced payload tokens, metadata overhead and net estimated tokens. For tiny outputs, compression may be ineffective once recovery metadata is included; SotuRail says that directly while preserving raw recovery paths.
201
+
135
202
  ## 9. Agent Hooks
136
203
 
137
204
  SotuRail provides cautious hook scaffolding and prompt-only fallbacks:
@@ -145,6 +212,8 @@ soturail hooks prompt-only codex
145
212
 
146
213
  Host APIs vary, so SotuRail never writes guessed config without showing the target and creating backups for existing files.
147
214
 
215
+ Review generated hooks before enabling them. SotuRail should never auto-install unreviewed third-party skills, hooks or scripts.
216
+
148
217
  ## 10. Agent Response Compression
149
218
 
150
219
  SotuRail includes Caveman-like output compression as inspiration, implemented independently with professional modes:
@@ -192,6 +261,18 @@ SotuRail reports estimated cache stability only. It never claims real provider c
192
261
 
193
262
  Raw logs may contain secrets because they preserve real terminal output. Treat `.soturail/raw/` as local evidence, not public artifact material.
194
263
 
264
+ ## Windows Notes
265
+
266
+ Windows users should see [docs/windows.md](docs/windows.md) for CMD vs PowerShell quoting, global install, `npx`, local tarball testing and common paste mistakes such as copying Markdown code-fence labels into CMD.
267
+
268
+ ## Road To Skill Rail
269
+
270
+ Skill Rail and Workflow Rail are planned, not implemented in v0.2.x. See [docs/skill-rail.md](docs/skill-rail.md) and [docs/workflow-rail.md](docs/workflow-rail.md) for the security-first roadmap.
271
+
272
+ ## Comparison Philosophy
273
+
274
+ SotuRail is inspired by the broader context-engineering ecosystem, including terminal reducers, agent response compression, spec-driven workflows, local memory, rules extraction, hooks, benchmarks and skill registries. SotuRail does not vendor or depend on those projects. It aims to unify similar ideas into one local-first workflow while keeping benchmarks honest.
275
+
195
276
  ## 14. Roadmap
196
277
 
197
278
  See [ROADMAP.md](ROADMAP.md). v0.3.0 focuses on deeper native paths, MCP, hardened PDF extraction, semantic memory approval, Tree-sitter repo maps and optional local embeddings.
package/dist/cli.js CHANGED
@@ -16,14 +16,17 @@ import { registerNativeCommand } from "./commands/native.js";
16
16
  import { registerReadCommand } from "./commands/read.js";
17
17
  import { registerRunCommand } from "./commands/run.js";
18
18
  import { registerRulesCommand } from "./commands/rules.js";
19
+ import { registerSelfCommand } from "./commands/self.js";
19
20
  import { registerSpecCommand } from "./commands/spec.js";
20
21
  import { registerStatsCommand } from "./commands/stats.js";
22
+ import { registerReleaseCommand } from "./commands/release.js";
23
+ import { SOTURAIL_VERSION } from "./core/version.js";
21
24
  export function buildProgram() {
22
25
  const program = new Command();
23
26
  program
24
27
  .name("soturail")
25
28
  .description("Local-first Context OS rails for AI coding agents.")
26
- .version("0.2.1")
29
+ .version(SOTURAIL_VERSION)
27
30
  .showHelpAfterError();
28
31
  registerInitCommand(program);
29
32
  registerIndexCommand(program);
@@ -39,6 +42,8 @@ export function buildProgram() {
39
42
  registerMemoryCommand(program);
40
43
  registerNativeCommand(program);
41
44
  registerRulesCommand(program);
45
+ registerReleaseCommand(program);
46
+ registerSelfCommand(program);
42
47
  registerDoctorCommand(program);
43
48
  registerStatsCommand(program);
44
49
  return program;
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAA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qB,CAAC,OAAO,CAAC,CAAC;IAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC/B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7B,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC/B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;IACrE,YAAY,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC/D,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,OAAO,IAAI,CAAC,CAAC;QACrD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -4,28 +4,39 @@ interface BenchOptions {
4
4
  engine?: ReducerEngine;
5
5
  tool?: string;
6
6
  }
7
- interface BenchResult {
7
+ export type BenchmarkCategory = "terminal_compression" | "agent_response_compression" | "knowledge_structuring" | "cache_stability" | "native_engine";
8
+ export interface BenchResult {
9
+ case_id: string;
8
10
  name: string;
9
- category: "terminal_compression" | "agent_response_compression" | "json_tool_payload_compression" | "knowledge_structuring" | "native_performance";
11
+ category: BenchmarkCategory;
10
12
  engine: string;
11
13
  raw_bytes: number;
12
14
  reduced_bytes: number;
15
+ raw_tokens: number;
16
+ reduced_tokens: number;
17
+ reduction_percent: number | null;
13
18
  estimated_raw_tokens: number;
14
19
  estimated_reduced_tokens: number;
15
20
  compression_ratio_percent: number | null;
21
+ runtime_ms: number;
16
22
  wall_time_ms: number;
23
+ quality_passed: boolean;
24
+ preserved_errors_count: number;
25
+ preserved_paths_count: number;
26
+ preserved_commands_count: number;
17
27
  preserved_error_lines_count: number;
18
28
  preserved_file_paths_count: number;
19
29
  raw_id: string | null;
20
30
  raw_sha256: string;
21
31
  reduced_sha256: string;
22
- quality_passed: boolean;
32
+ notes: string;
23
33
  details: Record<string, unknown>;
24
34
  }
25
35
  export declare function prepareBenchmarks(root?: string): Promise<string>;
26
36
  export declare function runBenchmarks(options?: BenchOptions, root?: string): Promise<BenchResult[]>;
27
37
  export declare function compareEngines(root?: string): Promise<string>;
28
38
  export declare function reportBenchmarks(root?: string): Promise<string>;
39
+ export declare function summarizeBenchmarkResults(results: BenchResult[]): string;
29
40
  export declare function compareOptional(tool: string, root?: string): Promise<string>;
30
41
  export declare function registerBenchCommand(program: Command): void;
31
42
  export {};