@a13xu/lucid 1.16.1 → 1.16.2
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/README.md +1 -1
- package/build/compression/semantic.js +5 -1
- package/build/guardian/checklist.d.ts +2 -1
- package/build/guardian/checklist.js +20 -1
- package/build/guardian/coding-rules.d.ts +2 -1
- package/build/guardian/coding-rules.js +20 -1
- package/build/index.js +491 -742
- package/build/tools/plan.js +2 -2
- package/package.json +3 -1
- package/skills/lucid-audit/SKILL.md +11 -0
- package/skills/lucid-context/SKILL.md +9 -0
- package/skills/lucid-plan/SKILL.md +9 -0
- package/skills/lucid-security/SKILL.md +9 -0
- package/skills/lucid-start/SKILL.md +9 -0
- package/skills/lucid-webdev/SKILL.md +14 -0
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ Default DB path: `~/.claude/memory.db`
|
|
|
96
96
|
| `plan_create` | Create a development plan with title, description, and tasks. Returns plan ID. |
|
|
97
97
|
| `plan_list` | List all plans with status summary (total/done/in-progress tasks). |
|
|
98
98
|
| `plan_get` | Get full plan details including all tasks and their status. |
|
|
99
|
-
| `plan_update_task` | Update a task's status (`
|
|
99
|
+
| `plan_update_task` | Update a task's status (`pending` → `in_progress` → `done` \| `blocked`) and optionally add notes. Accepts `task_id` as number or string. |
|
|
100
100
|
|
|
101
101
|
### Reward system
|
|
102
102
|
| Tool | Description |
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
import { join } from "path";
|
|
14
14
|
import { homedir } from "os";
|
|
15
15
|
import { mkdirSync } from "fs";
|
|
16
|
-
|
|
16
|
+
// Microsoft's original repo ships only PyTorch weights, so transformers.js
|
|
17
|
+
// (ONNX Runtime) cannot load it. ldenoue/* mirrors the same checkpoint with
|
|
18
|
+
// pre-built `onnx/model.onnx` (710 MB) and `onnx/model_quantized.onnx` (179 MB),
|
|
19
|
+
// matching the dtype lookups used below.
|
|
20
|
+
const MODEL_ID = "ldenoue/llmlingua-2-bert-base-multilingual-cased-meetingbank";
|
|
17
21
|
const MODELS_DIR = join(homedir(), ".lucid", "models");
|
|
18
22
|
let _pipeline = null;
|
|
19
23
|
let _loadError = null;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const ORIGINAL_CHECKLIST = "# Logic Guardian \u2014 Validation Checklist (5 passes)\n\n## Pass 1: Logic Trace\nTrace through the code with CONCRETE values:\n- Happy path \u2192 real values, write each variable state\n- Empty/zero \u2192 null, 0, \"\", []\n- Boundary \u2192 first element, last element, max int, single char\n- Error case \u2192 network down, file missing, permission denied\n\nSTOP if any trace produces unexpected output. Fix before continuing.\n\n## Pass 2: Contract Verification\n- [ ] Preconditions: what must be true BEFORE this runs? Is it checked?\n- [ ] Postconditions: what must be true AFTER? Can you prove it?\n- [ ] Invariants: what must ALWAYS be true? Does the code maintain it?\n- [ ] Return type: does EVERY code path return the expected type?\n- [ ] Side effects: are all side effects intentional?\n\n## Pass 3: Stupid Mistakes Checklist\n\n### Off-by-one\n- [ ] < vs <= \u2014 verify with boundary values\n- [ ] Array indices \u2014 last is length - 1\n- [ ] Loop iterations \u2014 exactly N times?\n\n### Null/Undefined Propagation\n- [ ] Every .property access \u2014 can the object be null?\n- [ ] Every array index \u2014 can the array be empty?\n- [ ] Every map lookup \u2014 can the key be missing?\n\n### Type Confusion\n- [ ] String vs Number comparisons\n- [ ] Integer vs Float division\n- [ ] Boolean coercion edge cases\n\n### Logic Inversions (THE #1 LLM drift pattern)\n- [ ] if/else \u2014 is the condition testing what you THINK?\n- [ ] Early returns \u2014 does the guard return the RIGHT value?\n- [ ] filter/find/some \u2014 keeping the RIGHT elements?\n- [ ] Error handling \u2014 catching and re-throwing correctly?\n\n### State & Mutation\n- [ ] Mutating shared object when you should copy?\n- [ ] Async state read after it might have changed?\n\n### Copy-Paste Drift\n- [ ] ALL variable names updated in copied blocks?\n- [ ] Conditions changed, not just variable names?\n\n## Pass 4: Integration Sanity\n- [ ] Breaks existing callers?\n- [ ] Imports/exports correct?\n- [ ] If async, all callers awaiting it?\n- [ ] If type changed, all usages updated?\n\n## Pass 5: Explain It Test\nIn ONE sentence: what does this code do?\nIf you can't explain it, or the sentence doesn't match the code \u2192 something is wrong.\n\n## Anti-Drift Triggers\nSTOP if you find yourself thinking:\n- \"This is similar to...\" \u2192 You're pattern-matching. TRACE THE LOGIC.\n- \"This should work because the other one does\" \u2192 VERIFY INDEPENDENTLY.\n- \"I'll just copy and change the names\" \u2192 CHECK EVERY DIFFERENCE.\n- \"The error handling is probably fine\" \u2192 TRACE THE ERROR PATH.\n- \"This is standard boilerplate\" \u2192 Verify it fits this context.\n";
|
|
2
|
+
export declare const CHECKLIST: string;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { existsSync, readFileSync } from "fs";
|
|
4
|
+
export const ORIGINAL_CHECKLIST = `# Logic Guardian — Validation Checklist (5 passes)
|
|
2
5
|
|
|
3
6
|
## Pass 1: Logic Trace
|
|
4
7
|
Trace through the code with CONCRETE values:
|
|
@@ -65,3 +68,19 @@ STOP if you find yourself thinking:
|
|
|
65
68
|
- "The error handling is probably fine" → TRACE THE ERROR PATH.
|
|
66
69
|
- "This is standard boilerplate" → Verify it fits this context.
|
|
67
70
|
`;
|
|
71
|
+
// Opt-in: if a pre-compressed copy exists at ~/.lucid/compressed-prompts/checklist.txt
|
|
72
|
+
// (produced by `npm run compress-prompts`), serve that instead. Falls back to the
|
|
73
|
+
// original on any error so this is always safe.
|
|
74
|
+
function loadCompressed() {
|
|
75
|
+
try {
|
|
76
|
+
const p = join(homedir(), ".lucid", "compressed-prompts", "checklist.txt");
|
|
77
|
+
if (!existsSync(p))
|
|
78
|
+
return null;
|
|
79
|
+
const text = readFileSync(p, "utf-8").trim();
|
|
80
|
+
return text.length > 0 ? text : null;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export const CHECKLIST = loadCompressed() ?? ORIGINAL_CHECKLIST;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const ORIGINAL_CODING_RULES = "# 25 Golden Rules \u2014 Code Quality Checklist\n\n## Section 1: General Quality (Rules 1\u201310)\n\n- [ ] **Rule 1 \u2014 File Size**: File is under 500 lines (components under 300).\n PASS: file has fewer lines. FAIL: file exceeds limit \u2014 split into modules.\n\n- [ ] **Rule 2 \u2014 Function Length**: Every function/method is under 60 lines.\n PASS: function is focused and short. FAIL: function exceeds 60 lines \u2014 break it up.\n\n- [ ] **Rule 3 \u2014 Meaningful Names**: No vague variable names (x, tmp, data, val, obj, foo, bar).\n No vague function names (doSomething, handleStuff, processData, manage, doWork).\n PASS: names explain purpose. FAIL: name is a placeholder \u2014 rename to intent.\n\n- [ ] **Rule 4 \u2014 Single Responsibility**: Functions/methods do exactly ONE thing.\n If the name contains \"And\" or \"Or\", it is doing two things.\n PASS: one verb, one concept. FAIL: split into two functions.\n\n- [ ] **Rule 5 \u2014 No Dead Code**: No commented-out code blocks (3+ consecutive lines with =, (, {, ;).\n PASS: code is live. FAIL: remove dead code \u2014 use version control for history.\n\n- [ ] **Rule 6 \u2014 Explicit Error Handling**: Errors are caught, logged, or re-thrown.\n No silent swallowing (catch {} or except: pass).\n PASS: every error path is handled. FAIL: add logging or re-throw.\n\n- [ ] **Rule 7 \u2014 No Magic Numbers**: Numeric literals are replaced with named constants.\n PASS: constants have descriptive names. FAIL: extract to a named constant.\n\n- [ ] **Rule 8 \u2014 Max 3 Nesting Levels**: Code is not nested more than 3 levels deep.\n PASS: deepest indent is 3 levels. FAIL: extract logic or use early returns.\n\n- [ ] **Rule 9 \u2014 DRY (Don't Repeat Yourself)**: No near-duplicate blocks of code.\n PASS: logic is extracted into a shared function. FAIL: refactor duplicates.\n\n- [ ] **Rule 10 \u2014 Explicit Return Types**: Typed languages declare return types on public functions.\n PASS: all public functions have explicit return types. FAIL: add return type annotation.\n\n## Section 2: Frontend Components (Rules 11\u201318)\n\n- [ ] **Rule 11 \u2014 Component Size**: UI components are under 300 lines.\n PASS: component is focused. FAIL: extract sub-components or custom hooks.\n\n- [ ] **Rule 12 \u2014 No Inline Styles**: No style={{ }} in JSX/Vue templates.\n PASS: styles are in CSS/SCSS/CSS-in-JS. FAIL: move to stylesheet or styled component.\n\n- [ ] **Rule 13 \u2014 Prop Limit**: Components accept at most 8 props.\n PASS: props are few and cohesive. FAIL: group related props into an object.\n\n- [ ] **Rule 14 \u2014 Prefer Composition**: Large components are split into sub-components.\n No \"god components\" handling layout + data + formatting + interaction.\n PASS: each component has one visual/logical role. FAIL: extract a sub-component.\n\n- [ ] **Rule 15 \u2014 No Direct DOM Access**: No document.querySelector / getElementById in components.\n PASS: refs are used (useRef, ref=). FAIL: replace with ref mechanism.\n\n- [ ] **Rule 16 \u2014 Data Fetching in Services/Hooks**: No fetch() or axios calls in component body.\n PASS: data fetching is in a custom hook or service. FAIL: extract to useXxx hook.\n\n- [ ] **Rule 17 \u2014 One Styling System**: File uses only one styling approach\n (Tailwind OR styled-components OR CSS modules \u2014 not all three).\n PASS: consistent styling. FAIL: standardize on one approach.\n\n- [ ] **Rule 18 \u2014 No Nested Ternaries in JSX**: JSX conditionals use if/else or variables, not nested ternaries.\n PASS: conditions are readable. FAIL: extract condition to a variable or early return.\n\n## Section 3: Architecture (Rules 19\u201325)\n\n- [ ] **Rule 19 \u2014 Single Source of Truth**: State is not duplicated across multiple stores or components.\n PASS: one authoritative source for each piece of state. FAIL: remove duplication.\n\n- [ ] **Rule 20 \u2014 UI/Logic Separation**: Business logic is not inside UI components.\n PASS: components call services/hooks; logic lives elsewhere. FAIL: extract to service.\n\n- [ ] **Rule 21 \u2014 Dependency Abstraction**: External APIs/SDKs are wrapped in adapter/service layers.\n PASS: swapping a library touches one file. FAIL: add an abstraction layer.\n\n- [ ] **Rule 22 \u2014 No Circular Imports**: Module dependency graph is a DAG (no cycles).\n PASS: import graph has no cycles. FAIL: restructure modules to remove the cycle.\n\n- [ ] **Rule 23 \u2014 Config in Dedicated Files**: Magic strings and environment-specific values are in config files.\n PASS: config is centralized. FAIL: extract to config.ts or .env.\n\n- [ ] **Rule 24 \u2014 Public API Coverage**: Every exported function has a corresponding test.\n PASS: public API is covered by tests. FAIL: write a test for the new export.\n\n- [ ] **Rule 25 \u2014 No God Objects**: Classes/modules are focused \u2014 no object that knows everything.\n PASS: objects have clear, narrow responsibilities. FAIL: split the god object.\n\n---\n\n## Quick Check Before Marking Done\n\n1. Run `check_code_quality` on modified files \u2014 fix HIGH severity issues.\n2. Run `validate_file` (Logic Guardian) \u2014 fix correctness bugs first.\n3. Verify rules 3, 4, 8 manually (naming and nesting are hard to auto-detect fully).\n4. For frontend work, verify rules 12, 15, 16 \u2014 these are the most common oversights.\n";
|
|
2
|
+
export declare const CODING_RULES: string;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { existsSync, readFileSync } from "fs";
|
|
4
|
+
export const ORIGINAL_CODING_RULES = `# 25 Golden Rules — Code Quality Checklist
|
|
2
5
|
|
|
3
6
|
## Section 1: General Quality (Rules 1–10)
|
|
4
7
|
|
|
@@ -95,3 +98,19 @@ export const CODING_RULES = `# 25 Golden Rules — Code Quality Checklist
|
|
|
95
98
|
3. Verify rules 3, 4, 8 manually (naming and nesting are hard to auto-detect fully).
|
|
96
99
|
4. For frontend work, verify rules 12, 15, 16 — these are the most common oversights.
|
|
97
100
|
`;
|
|
101
|
+
// Opt-in: if a pre-compressed copy exists at ~/.lucid/compressed-prompts/coding-rules.txt
|
|
102
|
+
// (produced by `npm run compress-prompts`), serve that instead. Falls back to the
|
|
103
|
+
// original on any error so this is always safe.
|
|
104
|
+
function loadCompressed() {
|
|
105
|
+
try {
|
|
106
|
+
const p = join(homedir(), ".lucid", "compressed-prompts", "coding-rules.txt");
|
|
107
|
+
if (!existsSync(p))
|
|
108
|
+
return null;
|
|
109
|
+
const text = readFileSync(p, "utf-8").trim();
|
|
110
|
+
return text.length > 0 ? text : null;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export const CODING_RULES = loadCompressed() ?? ORIGINAL_CODING_RULES;
|