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/dist/plugin.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/plugin/src/index.ts
|
|
3
|
+
function definePlugin(def) {
|
|
4
|
+
if (!def.id || def.id.trim().length === 0) {
|
|
5
|
+
throw new Error("Plugin id must be a non-empty string.");
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
_tag: "FeatlockPlugin",
|
|
9
|
+
id: def.id.trim(),
|
|
10
|
+
guarded: def.guarded === true,
|
|
11
|
+
setup: def.setup
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function isFeatlockPlugin(value) {
|
|
15
|
+
if (typeof value !== "object" || value === null)
|
|
16
|
+
return false;
|
|
17
|
+
const rec = value;
|
|
18
|
+
return typeof rec.id === "string" && rec.id.length > 0 && typeof rec.setup === "function";
|
|
19
|
+
}
|
|
20
|
+
var Plugin = {
|
|
21
|
+
define: definePlugin
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
Plugin,
|
|
25
|
+
definePlugin,
|
|
26
|
+
isFeatlockPlugin
|
|
27
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@featlock/plugin-demo-toggle",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Standalone reference test plugin proving easy ON/OFF toggle behavior across extractors, invariants, guards, and CLI commands.",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@featlock/plugin": "^0.1.0"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Plugin } from "@featlock/plugin";
|
|
2
|
+
|
|
3
|
+
export default Plugin.define({
|
|
4
|
+
id: "featlock.demo.toggle",
|
|
5
|
+
async setup(ctx) {
|
|
6
|
+
await ctx.extractor.transform((ed) => {
|
|
7
|
+
ed.add({
|
|
8
|
+
id: "featlock.demo.toggle.extractor",
|
|
9
|
+
label: "Demo Toggle Feature Extractor",
|
|
10
|
+
extract: () => ({
|
|
11
|
+
features: [
|
|
12
|
+
{
|
|
13
|
+
id: "feat.demo.toggle-canary",
|
|
14
|
+
area: "demo-toggle",
|
|
15
|
+
name: "Demo Toggle Canary Feature",
|
|
16
|
+
summary: "Emitted only when @featlock/plugin-demo-toggle is enabled.",
|
|
17
|
+
acceptanceCriteria: "Present when plugin is ON; absent with zero residue when plugin is OFF.",
|
|
18
|
+
status: "active",
|
|
19
|
+
source: "demo-toggle",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
tests: [],
|
|
23
|
+
invariants: [
|
|
24
|
+
{
|
|
25
|
+
id: "inv:demo:toggle-canary",
|
|
26
|
+
featureId: "feat.demo.toggle-canary",
|
|
27
|
+
kind: "demo-canary",
|
|
28
|
+
statement: "Demo toggle canary invariant is active while plugin is mounted.",
|
|
29
|
+
file: "package.json",
|
|
30
|
+
line: 1,
|
|
31
|
+
confidence: 1,
|
|
32
|
+
source: "demo-toggle",
|
|
33
|
+
status: "active",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
await ctx.command.transform((ed) => {
|
|
41
|
+
ed.add({
|
|
42
|
+
id: "demo-ping",
|
|
43
|
+
description: "Verify @featlock/plugin-demo-toggle is active",
|
|
44
|
+
run: (c) => {
|
|
45
|
+
console.log(c.asJson ? JSON.stringify({ demoToggle: "ON", pluginId: "featlock.demo.toggle" }) : "demo-toggle plugin is ON");
|
|
46
|
+
return 0;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "featlock",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Tight-core, plugin-extensible SQLite feature, test, and invariant registry & agent guard system — combining AST scanners, RepoSpec graphs, Veristack verification signals, and multi-pass AI agent discovery.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/a1ter-nate/featlock#readme",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/a1ter-nate/featlock/issues"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"features",
|
|
13
|
+
"invariants",
|
|
14
|
+
"anti-deletion",
|
|
15
|
+
"sqlite",
|
|
16
|
+
"ai-agents",
|
|
17
|
+
"static-analysis",
|
|
18
|
+
"verification",
|
|
19
|
+
"guardrails",
|
|
20
|
+
"bun"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"bin/",
|
|
27
|
+
"dist/",
|
|
28
|
+
"examples/plugins/demo-toggle/",
|
|
29
|
+
"skill/",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/a1ter-nate/featlock.git"
|
|
36
|
+
},
|
|
37
|
+
"bin": {
|
|
38
|
+
"featlock": "bin/featlock.mjs",
|
|
39
|
+
"flk": "bin/featlock.mjs"
|
|
40
|
+
},
|
|
41
|
+
"workspaces": [
|
|
42
|
+
"packages/*",
|
|
43
|
+
"packages/plugins/*"
|
|
44
|
+
],
|
|
45
|
+
"exports": {
|
|
46
|
+
".": "./dist/core.mjs",
|
|
47
|
+
"./core": "./dist/core.mjs",
|
|
48
|
+
"./plugin": "./dist/plugin.mjs"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"bun": ">=1.2.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "bun build src/cli.ts --outfile dist/cli.mjs --target bun --external oxc-parser",
|
|
55
|
+
"build:pkg": "bun run build && bun build packages/core/src/index.ts --outfile dist/core.mjs --target bun --external oxc-parser && bun build packages/plugin/src/index.ts --outfile dist/plugin.mjs --target bun",
|
|
56
|
+
"prepack": "bun run build:pkg",
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"test": "bun test ./tests/ ./packages/",
|
|
59
|
+
"test:plugins": "bun test ./packages/",
|
|
60
|
+
"test:product": "bun test ./tests/",
|
|
61
|
+
"check:max-lines": "node scripts/check-max-lines.mjs",
|
|
62
|
+
"perf:check": "bun scripts/check-perf-budget.mjs",
|
|
63
|
+
"lint:oxlint": "bunx oxlint -c .oxlintrc.json --deny-warnings src packages tests examples",
|
|
64
|
+
"lint:no-comments": "bunx vstack no-comments . --fail",
|
|
65
|
+
"lint:state-machines": "bunx vstack state-machines . --fail",
|
|
66
|
+
"check:vstack": "bunx vstack verify . --strict",
|
|
67
|
+
"check:repospec": "bunx repospec check . --allow-fail",
|
|
68
|
+
"check:self-features": "bun src/cli.ts check .",
|
|
69
|
+
"check": "bun run typecheck && bun run lint:oxlint && bun run check:max-lines && bun run build && bun run perf:check && bun run lint:no-comments && bun run lint:state-machines && bunx vstack formal-sync . --fail && bunx vstack laws . --fail && bunx vstack verify . --strict && bun run check:self-features"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"oxc-parser": "^0.160.0"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@types/bun": "latest",
|
|
76
|
+
"fast-check": "^4.11.0",
|
|
77
|
+
"oxlint": "^1.95.0",
|
|
78
|
+
"repospec": "^5.0.0",
|
|
79
|
+
"typescript": "^5.8.2",
|
|
80
|
+
"veristack": "^0.1.18"
|
|
81
|
+
}
|
|
82
|
+
}
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: featlock
|
|
3
|
+
description: Guard product features, linked tests, and deep invariants with SQLite traceability, AST + RepoSpec + Veristack scanners, and multi-pass AI agent discovery.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FeatLock Agent Workflow
|
|
7
|
+
|
|
8
|
+
Use FeatLock before adding, modifying, or removing any product capability so features and invariants are never silently lost, broken, or duplicated.
|
|
9
|
+
|
|
10
|
+
## 4-Pass Invariant & Feature Protocol
|
|
11
|
+
|
|
12
|
+
1. **Orient before coding**
|
|
13
|
+
- Run `featlock query <topic>` and `featlock check-dup "<proposed feature>"`.
|
|
14
|
+
- If a matching feature exists, improve it instead of recreating it.
|
|
15
|
+
2. **Extract & mine invariants (deterministic + agent passes)**
|
|
16
|
+
- Run `featlock extract . --json` (combines AST, RepoSpec, and Veristack bridges).
|
|
17
|
+
- Run `featlock agent-pass . --json` and execute Passes 1–4 (Inventory → Test Binding → Deep Invariant Mining → Guard Audit).
|
|
18
|
+
3. **Record automatically**
|
|
19
|
+
- New capability: `featlock record-new --id feat.<area>.<slug> --area <area> --name "<Name>" --summary "<Summary>" --test <path/to/test.ts>`
|
|
20
|
+
- Improvement to existing capability: `featlock record-improvement --id <featureId> --summary "<What improved>" --test <path/to/test.ts>`
|
|
21
|
+
4. **Never silently delete features or invariants**
|
|
22
|
+
- `features/registry.sql` enforces SQLite `BEFORE DELETE` `RAISE(ABORT, ...)` triggers and git-diff anti-deletion guards.
|
|
23
|
+
- If asked to remove an active feature or invariant, STOP, confirm with the user, record an ADR reference + `removal_reason`, and run `ALLOW_FEATURE_REMOVAL=1 featlock check .`.
|