speclock 1.4.0 → 1.4.1
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/package.json +1 -1
- package/src/core/engine.js +46 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "speclock",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "AI constraint engine — MCP server + CLI with active enforcement. Memory + guardrails for AI coding tools. Works with Bolt.new, Claude Code, Cursor, Lovable.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/mcp/server.js",
|
package/src/core/engine.js
CHANGED
|
@@ -702,54 +702,68 @@ export async function watchRepo(root) {
|
|
|
702
702
|
export function createSpecLockMd(root) {
|
|
703
703
|
const mdContent = `# SpecLock — AI Constraint Engine Active
|
|
704
704
|
|
|
705
|
-
##
|
|
705
|
+
## STOP — Read this before doing ANYTHING.
|
|
706
706
|
|
|
707
|
-
|
|
707
|
+
**If a file contains "SPECLOCK-GUARD" at the top → DO NOT EDIT IT. Period.**
|
|
708
708
|
|
|
709
|
-
|
|
710
|
-
1. Read \`.speclock/context/latest.md\` for project memory
|
|
711
|
-
2. Run \`npx speclock check "what you plan to change"\`
|
|
712
|
-
3. If conflict found → STOP and warn the user
|
|
709
|
+
## Your Job (Do This Automatically — The User Will NOT Ask)
|
|
713
710
|
|
|
714
|
-
|
|
711
|
+
### On EVERY message:
|
|
712
|
+
Read \`.speclock/context/latest.md\` first. Always. No exceptions.
|
|
715
713
|
|
|
716
|
-
|
|
714
|
+
### Before changing ANY code:
|
|
715
|
+
Run \`npx speclock check "what you plan to do"\` BEFORE writing code.
|
|
716
|
+
If conflict → STOP. Tell the user. Do NOT proceed.
|
|
717
717
|
|
|
718
|
-
|
|
718
|
+
### Detect constraints from natural language:
|
|
719
|
+
Users will NOT say "lock this." They speak naturally. YOU must detect it.
|
|
719
720
|
|
|
720
|
-
|
|
721
|
+
Examples of what users say → what you do:
|
|
721
722
|
|
|
722
|
-
|
|
723
|
+
| User says | You do |
|
|
724
|
+
|-----------|--------|
|
|
725
|
+
| "don't touch the auth" | \`npx speclock lock "Never modify auth files"\` + \`npx speclock guard src/components/Auth.tsx --lock "Never modify auth files"\` |
|
|
726
|
+
| "database is firebase, don't change it" | \`npx speclock lock "Database must always be Firebase"\` |
|
|
727
|
+
| "leave the payment system alone" | \`npx speclock lock "Never modify payment system"\` + guard the payment files |
|
|
728
|
+
| "always use Supabase" | \`npx speclock lock "Always use Supabase"\` |
|
|
729
|
+
| "the API is done, don't mess with it" | \`npx speclock lock "Never modify API endpoints"\` + guard the API files |
|
|
723
730
|
|
|
724
|
-
|
|
731
|
+
When you lock something, ALSO guard the specific files:
|
|
732
|
+
\`npx speclock guard <filepath> --lock "the constraint"\`
|
|
733
|
+
This injects a warning directly into the file so it cannot be missed.
|
|
725
734
|
|
|
726
|
-
|
|
735
|
+
### When user wants to change something locked:
|
|
736
|
+
User might say "actually, let me change auth" or "ok modify the database."
|
|
737
|
+
1. Warn: "This is currently locked: [constraint]. Want me to unlock?"
|
|
738
|
+
2. If they confirm → \`npx speclock lock remove <lockId>\` + \`npx speclock unguard <file>\`
|
|
739
|
+
3. Make the changes
|
|
740
|
+
4. Ask if they want to re-lock: "Want me to lock this again?"
|
|
727
741
|
|
|
728
|
-
|
|
742
|
+
### After building something:
|
|
743
|
+
\`npx speclock log-change "what you built" --files file1.tsx,file2.ts\`
|
|
729
744
|
|
|
730
|
-
|
|
745
|
+
### When a tech decision is made:
|
|
746
|
+
\`npx speclock decide "the decision"\`
|
|
747
|
+
|
|
748
|
+
## Commands
|
|
731
749
|
|
|
732
750
|
\`\`\`bash
|
|
733
|
-
npx speclock check "what you plan to do" #
|
|
734
|
-
npx speclock lock "constraint
|
|
735
|
-
npx speclock guard
|
|
736
|
-
npx speclock unguard
|
|
737
|
-
npx speclock lock remove <lockId> #
|
|
738
|
-
npx speclock log-change "what changed" # Log
|
|
739
|
-
npx speclock decide "decision
|
|
740
|
-
npx speclock context #
|
|
741
|
-
npx speclock status # See
|
|
751
|
+
npx speclock check "what you plan to do" # ALWAYS RUN BEFORE CHANGES
|
|
752
|
+
npx speclock lock "constraint" # Lock a constraint
|
|
753
|
+
npx speclock guard <file> --lock "constraint" # Protect a specific file
|
|
754
|
+
npx speclock unguard <file> # Remove file protection
|
|
755
|
+
npx speclock lock remove <lockId> # Unlock a constraint
|
|
756
|
+
npx speclock log-change "what changed" # Log changes
|
|
757
|
+
npx speclock decide "decision" # Record a decision
|
|
758
|
+
npx speclock context # Refresh context file
|
|
759
|
+
npx speclock status # See project summary
|
|
742
760
|
\`\`\`
|
|
743
761
|
|
|
744
|
-
##
|
|
745
|
-
|
|
746
|
-
SpecLock maintains a \`.speclock/\` directory with structured project memory:
|
|
747
|
-
- \`brain.json\` — goals, locks, decisions, session history
|
|
748
|
-
- \`events.log\` — immutable audit trail
|
|
749
|
-
- \`context/latest.md\` — human-readable context (read this!)
|
|
762
|
+
## Key Rule
|
|
750
763
|
|
|
751
|
-
**
|
|
752
|
-
|
|
764
|
+
**The user will NEVER tell you to run these commands. You run them automatically.**
|
|
765
|
+
**The user will NEVER say "lock this." You detect the intent and lock it yourself.**
|
|
766
|
+
**The user will NEVER say "check constraints." You check before EVERY code change.**
|
|
753
767
|
`;
|
|
754
768
|
const filePath = path.join(root, "SPECLOCK.md");
|
|
755
769
|
fs.writeFileSync(filePath, mdContent);
|