@rigstate/cli 0.7.17 → 0.7.19
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/.rigstate/cache/heuristics.json +79 -0
- package/.rigstate/daemon.pid +1 -0
- package/.rigstate/daemon.state.json +8 -0
- package/.rigstate/guardian.lock +5 -0
- package/.rigstate/rules-cache.json +166 -0
- package/dist/index.cjs +112 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +112 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/daemon.ts +16 -5
- package/src/daemon/file-watcher.ts +24 -19
- package/src/index.ts +4 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"skillId": "rigstate-legacy-renovator",
|
|
4
|
+
"patterns": {
|
|
5
|
+
"content": [
|
|
6
|
+
"Vibeline"
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"confidence": "high"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"skillId": "sec-sql-01",
|
|
13
|
+
"patterns": {
|
|
14
|
+
"files": [
|
|
15
|
+
"**/*.ts",
|
|
16
|
+
"**/*.js"
|
|
17
|
+
],
|
|
18
|
+
"content": [
|
|
19
|
+
"rpc(",
|
|
20
|
+
"execute(",
|
|
21
|
+
"query("
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"confidence": "high"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"skillId": "sec-rls-01",
|
|
28
|
+
"patterns": {
|
|
29
|
+
"files": [
|
|
30
|
+
"supabase/migrations/*.sql"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"confidence": "high"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"skillId": "sec-key-01",
|
|
37
|
+
"patterns": {
|
|
38
|
+
"content": [
|
|
39
|
+
"sk_live_",
|
|
40
|
+
"sk_test_",
|
|
41
|
+
"AIza",
|
|
42
|
+
"eyJ"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"confidence": "high"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"skillId": "sec-ui-01",
|
|
49
|
+
"patterns": {
|
|
50
|
+
"content": [
|
|
51
|
+
"dangerouslySetInnerHTML"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"confidence": "high"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"skillId": "sec-auth-04",
|
|
58
|
+
"patterns": {
|
|
59
|
+
"files": [
|
|
60
|
+
"app/api/**/*.ts",
|
|
61
|
+
"app/api/**/*.js"
|
|
62
|
+
],
|
|
63
|
+
"content": [
|
|
64
|
+
"supabase.from",
|
|
65
|
+
"db.select"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"confidence": "high"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"skillId": "rigstate-integrity-gate",
|
|
72
|
+
"patterns": {
|
|
73
|
+
"content": [
|
|
74
|
+
"[CORE INTEGRITY]"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"confidence": "high"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
36637
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
{
|
|
2
|
+
"timestamp": "2026-01-25T20:16:38.778Z",
|
|
3
|
+
"projectId": "bb9f8445-39fd-438c-8ab6-8057f5514395",
|
|
4
|
+
"rules": [
|
|
5
|
+
{
|
|
6
|
+
"id": "7eec5cbe-b7e4-4710-ba93-6231e3fc180c",
|
|
7
|
+
"rule_name": "modular_actions",
|
|
8
|
+
"rule_type": "CUSTOM",
|
|
9
|
+
"value": {
|
|
10
|
+
"description": "Server actions should be split by domain"
|
|
11
|
+
},
|
|
12
|
+
"severity": "info",
|
|
13
|
+
"description": "Keep server actions modular and domain-specific.",
|
|
14
|
+
"source": "global",
|
|
15
|
+
"is_enabled": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "600c2477-c85e-4939-8ff7-cb31d388be67",
|
|
19
|
+
"rule_name": "STRICT_MODULARIZATION",
|
|
20
|
+
"rule_type": "CUSTOM",
|
|
21
|
+
"value": {
|
|
22
|
+
"enforce_separation": true
|
|
23
|
+
},
|
|
24
|
+
"severity": "error",
|
|
25
|
+
"description": "Enforce strict separation between Logic (Hooks/Labs) and UI Components.",
|
|
26
|
+
"source": "global",
|
|
27
|
+
"is_enabled": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "639aec86-e7d1-4a95-bde8-1f41d8336ce3",
|
|
31
|
+
"rule_name": "COMPLEXITY_GUARD",
|
|
32
|
+
"rule_type": "CUSTOM",
|
|
33
|
+
"value": {
|
|
34
|
+
"max_complexity": 10
|
|
35
|
+
},
|
|
36
|
+
"severity": "warning",
|
|
37
|
+
"description": "Warn when functions become too complex (cyclomatic complexity > 10).",
|
|
38
|
+
"source": "global",
|
|
39
|
+
"is_enabled": true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "d82d6647-bb47-4295-a5a7-799ebc39d04d",
|
|
43
|
+
"rule_name": "TYPED_CONTRACTS",
|
|
44
|
+
"rule_type": "CUSTOM",
|
|
45
|
+
"value": {
|
|
46
|
+
"strict_interfaces": true
|
|
47
|
+
},
|
|
48
|
+
"severity": "error",
|
|
49
|
+
"description": "Require explicit TypeScript interfaces for all component props and API responses.",
|
|
50
|
+
"source": "global",
|
|
51
|
+
"is_enabled": true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "865bdd84-870b-4c7a-99f1-8a3297abde68",
|
|
55
|
+
"rule_name": "SINGLE_RESPONSIBILITY",
|
|
56
|
+
"rule_type": "CUSTOM",
|
|
57
|
+
"value": {
|
|
58
|
+
"max_exports": 1
|
|
59
|
+
},
|
|
60
|
+
"severity": "info",
|
|
61
|
+
"description": "Encourage one primary export per file to maintain single responsibility.",
|
|
62
|
+
"source": "global",
|
|
63
|
+
"is_enabled": true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "4e9a89af-89ca-4af6-916f-40846821aa09",
|
|
67
|
+
"rule_name": "folder_structure",
|
|
68
|
+
"rule_type": "CUSTOM",
|
|
69
|
+
"value": {
|
|
70
|
+
"required_folders": [
|
|
71
|
+
"lib",
|
|
72
|
+
"components",
|
|
73
|
+
"actions"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"severity": "warning",
|
|
77
|
+
"description": "Require standard folder structure (lib/, components/, actions/).",
|
|
78
|
+
"source": "global",
|
|
79
|
+
"is_enabled": true
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "6c2b4d8a-c82b-4dc0-b205-c932558bc1c2",
|
|
83
|
+
"rule_name": "max_file_lines",
|
|
84
|
+
"rule_type": "MAX_FILE_LINES",
|
|
85
|
+
"value": {
|
|
86
|
+
"limit": 300,
|
|
87
|
+
"warning_threshold": 250
|
|
88
|
+
},
|
|
89
|
+
"severity": "warning",
|
|
90
|
+
"description": "Files should not exceed 300 lines. Warning at 250.",
|
|
91
|
+
"source": "global",
|
|
92
|
+
"is_enabled": true
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "31942cae-6be9-4961-a969-498af7450e00",
|
|
96
|
+
"rule_name": "MAX_FILE_LINES",
|
|
97
|
+
"rule_type": "MAX_FILE_LINES",
|
|
98
|
+
"value": {
|
|
99
|
+
"limit": 300
|
|
100
|
+
},
|
|
101
|
+
"severity": "warning",
|
|
102
|
+
"description": "Enforce a maximum of 300 lines per file to ensure readability.",
|
|
103
|
+
"source": "global",
|
|
104
|
+
"is_enabled": true
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "13ab9d0c-1943-44ad-8da9-7fd9e9b357f3",
|
|
108
|
+
"rule_name": "max_function_lines",
|
|
109
|
+
"rule_type": "MAX_FUNCTION_LINES",
|
|
110
|
+
"value": {
|
|
111
|
+
"limit": 50,
|
|
112
|
+
"warning_threshold": 35
|
|
113
|
+
},
|
|
114
|
+
"severity": "warning",
|
|
115
|
+
"description": "Functions should not exceed 50 lines. Warning at 35.",
|
|
116
|
+
"source": "global",
|
|
117
|
+
"is_enabled": true
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": "4749bce0-21eb-48a4-ad72-0e8e8f8ca032",
|
|
121
|
+
"rule_name": "component_naming",
|
|
122
|
+
"rule_type": "NAMING_CONVENTION",
|
|
123
|
+
"value": {
|
|
124
|
+
"context": "React components",
|
|
125
|
+
"pattern": "^[A-Z][a-zA-Z]*$"
|
|
126
|
+
},
|
|
127
|
+
"severity": "warning",
|
|
128
|
+
"description": "React components must use PascalCase.",
|
|
129
|
+
"source": "global",
|
|
130
|
+
"is_enabled": true
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "9fdddfc2-7af3-4e51-8ed8-4d0ca4a05a98",
|
|
134
|
+
"rule_name": "no_console_log",
|
|
135
|
+
"rule_type": "PATTERN_FORBIDDEN",
|
|
136
|
+
"value": {
|
|
137
|
+
"pattern": "console\\.log",
|
|
138
|
+
"allow_in": [
|
|
139
|
+
"*.test.ts",
|
|
140
|
+
"*.spec.ts"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"severity": "info",
|
|
144
|
+
"description": "Avoid console.log in production code.",
|
|
145
|
+
"source": "global",
|
|
146
|
+
"is_enabled": true
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"id": "d403cd91-7b9e-410b-819a-c515664904f7",
|
|
150
|
+
"rule_name": "require_error_handling",
|
|
151
|
+
"rule_type": "PATTERN_REQUIRED",
|
|
152
|
+
"value": {
|
|
153
|
+
"context": "async functions",
|
|
154
|
+
"pattern": "try.*catch|.catch\\("
|
|
155
|
+
},
|
|
156
|
+
"severity": "warning",
|
|
157
|
+
"description": "All async operations must have error handling.",
|
|
158
|
+
"source": "global",
|
|
159
|
+
"is_enabled": true
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"settings": {
|
|
163
|
+
"lmax": 400,
|
|
164
|
+
"lmax_warning": 350
|
|
165
|
+
}
|
|
166
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -1752,6 +1752,65 @@ var require_dist2 = __commonJS({
|
|
|
1752
1752
|
}
|
|
1753
1753
|
});
|
|
1754
1754
|
|
|
1755
|
+
// package.json
|
|
1756
|
+
var require_package = __commonJS({
|
|
1757
|
+
"package.json"(exports2, module2) {
|
|
1758
|
+
module2.exports = {
|
|
1759
|
+
name: "@rigstate/cli",
|
|
1760
|
+
version: "0.7.19",
|
|
1761
|
+
description: "Rigstate CLI - Code audit, sync and supervision tool",
|
|
1762
|
+
type: "module",
|
|
1763
|
+
main: "./dist/index.js",
|
|
1764
|
+
bin: {
|
|
1765
|
+
rigstate: "dist/index.js"
|
|
1766
|
+
},
|
|
1767
|
+
scripts: {
|
|
1768
|
+
dev: "tsup --watch",
|
|
1769
|
+
build: "tsup",
|
|
1770
|
+
lint: "tsc --noEmit",
|
|
1771
|
+
start: "node dist/index.js",
|
|
1772
|
+
test: "node dist/index.js --help"
|
|
1773
|
+
},
|
|
1774
|
+
dependencies: {
|
|
1775
|
+
"@rigstate/rules-engine": "*",
|
|
1776
|
+
"@rigstate/shared": "*",
|
|
1777
|
+
uuid: "^9.0.1",
|
|
1778
|
+
"@types/diff": "^7.0.2",
|
|
1779
|
+
"@types/inquirer": "^9.0.9",
|
|
1780
|
+
axios: "^1.6.5",
|
|
1781
|
+
chalk: "^5.3.0",
|
|
1782
|
+
chokidar: "^3.6.0",
|
|
1783
|
+
commander: "^12.0.0",
|
|
1784
|
+
conf: "^12.0.0",
|
|
1785
|
+
diff: "^4.0.2",
|
|
1786
|
+
dotenv: "^16.4.1",
|
|
1787
|
+
glob: "^10.3.10",
|
|
1788
|
+
inquirer: "^9.3.8",
|
|
1789
|
+
ora: "^8.0.1"
|
|
1790
|
+
},
|
|
1791
|
+
devDependencies: {
|
|
1792
|
+
"@types/node": "^20.11.5",
|
|
1793
|
+
"@types/uuid": "^10.0.0",
|
|
1794
|
+
tsup: "^8.0.1",
|
|
1795
|
+
typescript: "^5.3.3"
|
|
1796
|
+
},
|
|
1797
|
+
engines: {
|
|
1798
|
+
node: ">=18.0.0"
|
|
1799
|
+
},
|
|
1800
|
+
keywords: [
|
|
1801
|
+
"rigstate",
|
|
1802
|
+
"cli",
|
|
1803
|
+
"audit",
|
|
1804
|
+
"security",
|
|
1805
|
+
"code-quality",
|
|
1806
|
+
"supervisor"
|
|
1807
|
+
],
|
|
1808
|
+
author: "Rigstate",
|
|
1809
|
+
license: "MIT"
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
});
|
|
1813
|
+
|
|
1755
1814
|
// src/index.ts
|
|
1756
1815
|
init_cjs_shims();
|
|
1757
1816
|
var import_commander23 = require("commander");
|
|
@@ -3208,34 +3267,47 @@ function createFileWatcher(watchPath) {
|
|
|
3208
3267
|
emitter.start = () => {
|
|
3209
3268
|
const absolutePath = import_path15.default.resolve(process.cwd(), watchPath);
|
|
3210
3269
|
watcher = chokidar.watch(absolutePath, {
|
|
3211
|
-
ignored:
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3270
|
+
ignored: (pathStr) => {
|
|
3271
|
+
const segments = pathStr.split(import_path15.default.sep);
|
|
3272
|
+
const ignoreDirs = [
|
|
3273
|
+
"node_modules",
|
|
3274
|
+
".git",
|
|
3275
|
+
".next",
|
|
3276
|
+
".turbo",
|
|
3277
|
+
"dist",
|
|
3278
|
+
"build",
|
|
3279
|
+
".rigstate",
|
|
3280
|
+
"coverage",
|
|
3281
|
+
"tmp",
|
|
3282
|
+
"temp",
|
|
3283
|
+
"vendor",
|
|
3284
|
+
".cache",
|
|
3285
|
+
"public",
|
|
3286
|
+
"artifacts",
|
|
3287
|
+
"out",
|
|
3288
|
+
".vercel",
|
|
3289
|
+
".npm"
|
|
3290
|
+
];
|
|
3291
|
+
if (segments.some((segment) => ignoreDirs.includes(segment))) {
|
|
3292
|
+
return true;
|
|
3293
|
+
}
|
|
3294
|
+
const isFile = !!import_path15.default.extname(pathStr);
|
|
3295
|
+
if (isFile && !isCodeFile3(pathStr)) {
|
|
3296
|
+
return true;
|
|
3297
|
+
}
|
|
3298
|
+
return false;
|
|
3299
|
+
},
|
|
3227
3300
|
persistent: true,
|
|
3228
3301
|
ignoreInitial: true,
|
|
3229
3302
|
ignorePermissionErrors: true,
|
|
3230
|
-
|
|
3231
|
-
|
|
3303
|
+
depth: 10,
|
|
3304
|
+
// Reduced from 20 for large monorepos
|
|
3232
3305
|
awaitWriteFinish: {
|
|
3233
3306
|
stabilityThreshold: 300,
|
|
3234
3307
|
pollInterval: 100
|
|
3235
3308
|
},
|
|
3236
3309
|
usePolling: false,
|
|
3237
3310
|
atomic: true
|
|
3238
|
-
// Handle atomic writes (like vim/saving) better
|
|
3239
3311
|
});
|
|
3240
3312
|
watcher.on("change", (filePath) => {
|
|
3241
3313
|
if (isCodeFile3(filePath)) {
|
|
@@ -3915,10 +3987,20 @@ function createDaemonCommand() {
|
|
|
3915
3987
|
}
|
|
3916
3988
|
const spinner = (0, import_ora8.default)();
|
|
3917
3989
|
try {
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3990
|
+
const pidPath = import_path19.default.join(process.cwd(), PID_FILE);
|
|
3991
|
+
try {
|
|
3992
|
+
const content = await import_promises17.default.readFile(pidPath, "utf-8");
|
|
3993
|
+
const pid = parseInt(content.trim(), 10);
|
|
3994
|
+
try {
|
|
3995
|
+
process.kill(pid, 0);
|
|
3996
|
+
console.log(import_chalk19.default.yellow("\u26A0 Another daemon instance is active (PID " + pid + ")."));
|
|
3997
|
+
console.log(import_chalk19.default.dim(` Run "rigstate daemon status" for details or Ctrl+C to stop.
|
|
3998
|
+
`));
|
|
3999
|
+
} catch {
|
|
4000
|
+
await import_promises17.default.unlink(pidPath).catch(() => {
|
|
4001
|
+
});
|
|
4002
|
+
}
|
|
4003
|
+
} catch {
|
|
3922
4004
|
}
|
|
3923
4005
|
spinner.start("Initializing Guardian Daemon...");
|
|
3924
4006
|
const daemonInstance = await createDaemon({
|
|
@@ -9703,14 +9785,14 @@ function createReleaseCommand() {
|
|
|
9703
9785
|
spinner.text = "Scanning completed tasks...";
|
|
9704
9786
|
const pkgPath = import_path23.default.resolve(process.cwd(), "package.json");
|
|
9705
9787
|
const pkgContent = await import_promises20.default.readFile(pkgPath, "utf-8");
|
|
9706
|
-
const
|
|
9707
|
-
const currentVersion =
|
|
9788
|
+
const pkg2 = JSON.parse(pkgContent);
|
|
9789
|
+
const currentVersion = pkg2.version;
|
|
9708
9790
|
const [major, minor, patch] = currentVersion.split(".").map(Number);
|
|
9709
9791
|
let newVersion = currentVersion;
|
|
9710
9792
|
if (type === "major") newVersion = `${major + 1}.0.0`;
|
|
9711
9793
|
if (type === "minor") newVersion = `${major}.${minor + 1}.0`;
|
|
9712
9794
|
if (type === "patch") newVersion = `${major}.${minor}.${patch + 1}`;
|
|
9713
|
-
spinner.succeed(`Bumping ${
|
|
9795
|
+
spinner.succeed(`Bumping ${pkg2.name} from ${import_chalk30.default.dim(currentVersion)} to ${import_chalk30.default.green(newVersion)}`);
|
|
9714
9796
|
const { confirm } = await import_inquirer5.default.prompt([{
|
|
9715
9797
|
type: "confirm",
|
|
9716
9798
|
name: "confirm",
|
|
@@ -9721,8 +9803,8 @@ function createReleaseCommand() {
|
|
|
9721
9803
|
console.log("Aborted.");
|
|
9722
9804
|
return;
|
|
9723
9805
|
}
|
|
9724
|
-
|
|
9725
|
-
await import_promises20.default.writeFile(pkgPath, JSON.stringify(
|
|
9806
|
+
pkg2.version = newVersion;
|
|
9807
|
+
await import_promises20.default.writeFile(pkgPath, JSON.stringify(pkg2, null, 4));
|
|
9726
9808
|
const changelogPath = import_path23.default.resolve(process.cwd(), "CHANGELOG.md");
|
|
9727
9809
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
9728
9810
|
const entry = `
|
|
@@ -9882,9 +9964,10 @@ async function checkVersion() {
|
|
|
9882
9964
|
|
|
9883
9965
|
// src/index.ts
|
|
9884
9966
|
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
9967
|
+
var pkg = require_package();
|
|
9885
9968
|
import_dotenv.default.config();
|
|
9886
9969
|
var program = new import_commander23.Command();
|
|
9887
|
-
program.name("rigstate").description("CLI for Rigstate - The AI-Native Dev Studio").version(
|
|
9970
|
+
program.name("rigstate").description("CLI for Rigstate - The AI-Native Dev Studio").version(pkg.version);
|
|
9888
9971
|
program.addCommand(createLoginCommand());
|
|
9889
9972
|
program.addCommand(createLinkCommand());
|
|
9890
9973
|
program.addCommand(createScanCommand());
|