featlock 0.0.0-stage → 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +45 -2
- package/bin/featlock.mjs +11 -0
- package/dist/cli.mjs +2787 -0
- package/dist/core.mjs +2735 -0
- package/dist/plugin.mjs +27 -0
- package/examples/plugins/demo-toggle/package.json +12 -0
- package/examples/plugins/demo-toggle/src/index.ts +51 -0
- package/package.json +80 -4
- package/skill/SKILL.md +23 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 a1ter-nate
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# FeatLock (`featlock` / `flk`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Lock your product features, linked tests, and deep invariants so AI agents never silently drop, weaken, or duplicate them.**
|
|
4
|
+
|
|
5
|
+
FeatLock is the third pillar alongside [RepoSpec](https://github.com/a1ter-nate/repospec) (architecture graph compiler) and [Veristack](https://github.com/a1ter-nate/veristack) (9-rung verification ladder). Built on a tight-core + dogfooded-plugin architecture:
|
|
6
|
+
|
|
7
|
+
- **Canonical Git-tracked SQL (`features/registry.sql`) + SQLite (`.featlock/registry.sqlite`)** with engine-level `BEFORE DELETE` `RAISE(ABORT, ...)` triggers protecting active features, linked tests, and invariants.
|
|
8
|
+
- **Live code-anchored invariant protection:** Every extracted guard stores a line-number-independent `guard_anchor` and exact `root_test_path`. Deleting or weakening a guard in source code—or deleting a feature module without an ADR—blocks immediately (`invariant-guard-dropped-in-code` / `feature-removed-from-code`), while benign line shifts produce zero false positives.
|
|
9
|
+
- **Polyglot extraction & bridge plugins** across TypeScript, Rust, Python, Go, C#, and SQL:
|
|
10
|
+
- `@featlock/plugin-ast-scanner` (`oxc-parser` + polyglot guard/symbol/root-test extractor)
|
|
11
|
+
- `@featlock/plugin-repospec-bridge` (consumes `repospec.sqlite`, `repospec.json`, and `rules/*.sql`)
|
|
12
|
+
- `@featlock/plugin-veristack-bridge` (consumes `.verification/control-plan.json`, `.verification/laws/*.laws.json`, and `.verification/rungs.json`)
|
|
13
|
+
- `@featlock/plugin-invariant-passes` (4-pass AI agent discovery packets: Inventory → Test Binding → Deep Invariant Mining → Regression Guard Audit)
|
|
14
|
+
- **Non-removable anti-deletion guard (`@featlock/plugin-anti-deletion-guard`, `guarded: true`)** enforcing ADR-gated removals (`ALLOW_FEATURE_REMOVAL=1`), root-test liveness, and `--strict-drift` checks for unrecorded new features, invariants, and capability tests.
|
|
15
|
+
- **Agent harnesses & portable skill** (`@featlock/plugin-harnesses` + `skill/SKILL.md`) for Claude Code, Codex, Cursor, and GitHub Copilot.
|
|
16
|
+
|
|
17
|
+
## Install & Quick Start
|
|
18
|
+
|
|
19
|
+
Requires [Bun](https://bun.sh) `>= 1.2.0`.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bun add -d featlock
|
|
23
|
+
|
|
24
|
+
# 1. Extract features, exact root tests, and code-anchored invariants into features/registry.sql
|
|
25
|
+
bunx featlock extract . --write
|
|
26
|
+
|
|
27
|
+
# 2. Guard against silent feature/invariant regressions (and flag unrecorded additions)
|
|
28
|
+
bunx featlock check .
|
|
29
|
+
bunx featlock check . --strict-drift
|
|
30
|
+
|
|
31
|
+
# 3. Query existing features or check for overlap before building something new
|
|
32
|
+
bunx featlock query "auth"
|
|
33
|
+
bunx featlock check-dup "jwt bearer validation"
|
|
34
|
+
|
|
35
|
+
# 4. Record intentional new features or improvements
|
|
36
|
+
bunx featlock record-new --id feat.billing.retry --area billing --name "Retry Queue" --summary "Retries transient gateway failures" --test tests/billing.test.ts
|
|
37
|
+
bunx featlock record-improvement --id feat.billing.retry --summary "Added exponential backoff cap"
|
|
38
|
+
|
|
39
|
+
# 5. Emit 4-pass AI agent invariant discovery packets & wire coding-agent hooks
|
|
40
|
+
bunx featlock agent-pass . --json
|
|
41
|
+
bunx featlock hooks on
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
[MIT](./LICENSE)
|
package/bin/featlock.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const srcCli = path.join(rootDir, "src", "cli.ts");
|
|
8
|
+
const distCli = path.join(rootDir, "dist", "cli.mjs");
|
|
9
|
+
|
|
10
|
+
const entry = fs.existsSync(srcCli) ? srcCli : distCli;
|
|
11
|
+
await import(pathToFileURL(entry).href);
|