rigjs 4.0.15 → 4.0.17
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/.claude/skills/rig-wiki/SKILL.md +28 -2
- package/RIG_WIKI_SKILL.md +28 -2
- package/built/index.js +191 -184
- package/lib/crew/index.ts +31 -0
- package/lib/crew/pending.ts +388 -0
- package/lib/crew/vault.ts +23 -0
- package/lib/wiki/ingest.ts +1 -1
- package/lib/wiki/init.ts +3 -0
- package/lib/wiki/pathGuard.ts +24 -7
- package/lib/wiki/survey.ts +10 -4
- package/lib/wiki/wikiignore.ts +93 -0
- package/package.json +3 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// .wikiignore — wiki-only ignore file with the same syntax as .gitignore.
|
|
2
|
+
//
|
|
3
|
+
// Why a separate file? `.gitignore` is shared with git; many repos
|
|
4
|
+
// (including the overmind workspace) intentionally commit directories
|
|
5
|
+
// like `keychain/` that the wiki MUST NEVER ingest. Mixing wiki-only
|
|
6
|
+
// excludes into `.gitignore` would break that contract. `.wikiignore`
|
|
7
|
+
// is read only by the wiki walker.
|
|
8
|
+
//
|
|
9
|
+
// Lookup rule: starting from each candidate's directory, walk up
|
|
10
|
+
// looking for `.wikiignore`. Every `.wikiignore` found along the path
|
|
11
|
+
// up to (and including) `vaultRoot` contributes rules, with patterns
|
|
12
|
+
// resolved relative to the dir that file lives in — same as gitignore.
|
|
13
|
+
//
|
|
14
|
+
// Implementation note: we use the `ignore` package because it
|
|
15
|
+
// faithfully implements gitignore semantics (anchoring, negation,
|
|
16
|
+
// `**`, trailing slash). Inlining a hand-rolled matcher invites subtle
|
|
17
|
+
// bugs that would silently exfiltrate sensitive paths.
|
|
18
|
+
|
|
19
|
+
import fs from 'fs';
|
|
20
|
+
import path from 'path';
|
|
21
|
+
import ignore, { Ignore } from 'ignore';
|
|
22
|
+
|
|
23
|
+
const FILENAME = '.wikiignore';
|
|
24
|
+
|
|
25
|
+
interface Layer {
|
|
26
|
+
dir: string; // dir the .wikiignore lives in
|
|
27
|
+
matcher: Ignore;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns the set of absolute paths matched by any `.wikiignore` file
|
|
32
|
+
* found in `vaultRoot` or any directory between a candidate and
|
|
33
|
+
* `vaultRoot` (inclusive). Paths above `vaultRoot` are NOT consulted.
|
|
34
|
+
*/
|
|
35
|
+
export function batchWikiIgnored(absPaths: string[], vaultRoot: string): Set<string> {
|
|
36
|
+
const ignored = new Set<string>();
|
|
37
|
+
if (absPaths.length === 0) return ignored;
|
|
38
|
+
|
|
39
|
+
const root = path.resolve(vaultRoot);
|
|
40
|
+
const layerCache = new Map<string, Layer | null>();
|
|
41
|
+
|
|
42
|
+
// Build the ordered list of layers (root-most first) that apply to a
|
|
43
|
+
// given candidate. Layers above `root` are ignored.
|
|
44
|
+
function layersFor(abs: string): Layer[] {
|
|
45
|
+
const layers: Layer[] = [];
|
|
46
|
+
let dir = path.dirname(abs);
|
|
47
|
+
while (true) {
|
|
48
|
+
const cached = layerCache.get(dir);
|
|
49
|
+
if (cached !== undefined) {
|
|
50
|
+
if (cached) layers.push(cached);
|
|
51
|
+
} else {
|
|
52
|
+
const file = path.join(dir, FILENAME);
|
|
53
|
+
let layer: Layer | null = null;
|
|
54
|
+
if (fs.existsSync(file)) {
|
|
55
|
+
try {
|
|
56
|
+
const src = fs.readFileSync(file, 'utf8');
|
|
57
|
+
layer = { dir, matcher: ignore().add(src) };
|
|
58
|
+
} catch { /* unreadable — treat as no layer */ }
|
|
59
|
+
}
|
|
60
|
+
layerCache.set(dir, layer);
|
|
61
|
+
if (layer) layers.push(layer);
|
|
62
|
+
}
|
|
63
|
+
if (dir === root) break;
|
|
64
|
+
const parent = path.dirname(dir);
|
|
65
|
+
if (parent === dir) break; // hit filesystem root before vaultRoot
|
|
66
|
+
dir = parent;
|
|
67
|
+
}
|
|
68
|
+
// root-most should win on equal-specificity → reverse so root is first
|
|
69
|
+
return layers.reverse();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
for (const abs of absPaths) {
|
|
73
|
+
if (!abs.startsWith(root + path.sep) && abs !== root) continue;
|
|
74
|
+
const layers = layersFor(abs);
|
|
75
|
+
if (layers.length === 0) continue;
|
|
76
|
+
// Each layer matches paths relative to its own dir, gitignore-style.
|
|
77
|
+
// A later layer's negation can override an earlier match.
|
|
78
|
+
let isIgnored = false;
|
|
79
|
+
for (const layer of layers) {
|
|
80
|
+
const rel = path.relative(layer.dir, abs);
|
|
81
|
+
if (!rel || rel.startsWith('..')) continue;
|
|
82
|
+
// `ignore` returns { ignored, unignored } via .test(); we mirror its
|
|
83
|
+
// semantics by chaining .test() so negations later in the same file
|
|
84
|
+
// can flip the bit back.
|
|
85
|
+
const res = layer.matcher.test(rel);
|
|
86
|
+
if (res.ignored) isIgnored = true;
|
|
87
|
+
else if (res.unignored) isIgnored = false;
|
|
88
|
+
}
|
|
89
|
+
if (isIgnored) ignored.add(abs);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return ignored;
|
|
93
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rigjs",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"versionCode":
|
|
3
|
+
"version": "4.0.17",
|
|
4
|
+
"versionCode": 26052424,
|
|
5
5
|
"description": "A multi-repos dev tool based on yarn and git.Rigjs is intended to be the simplest way to develop,share and deliver codes between different developers or different projects.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"modular",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"compare-versions": "^4.1.3",
|
|
79
79
|
"dayjs": "^1.11.0",
|
|
80
80
|
"dotenv": "^16.0.3",
|
|
81
|
+
"ignore": "^7.0.5",
|
|
81
82
|
"inquirer": "7.3.3",
|
|
82
83
|
"js-yaml": "^4.1.1",
|
|
83
84
|
"json5": "2.1.3",
|