specweave 1.0.32 → 1.0.33

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.
Files changed (123) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CLAUDE.md +205 -148
  3. package/README.md +0 -2
  4. package/bin/specweave.js +11 -0
  5. package/dist/src/cli/commands/init.js +1 -1
  6. package/dist/src/cli/commands/init.js.map +1 -1
  7. package/dist/src/cli/commands/update-instructions.d.ts +16 -0
  8. package/dist/src/cli/commands/update-instructions.d.ts.map +1 -0
  9. package/dist/src/cli/commands/update-instructions.js +134 -0
  10. package/dist/src/cli/commands/update-instructions.js.map +1 -0
  11. package/dist/src/cli/helpers/init/directory-structure.d.ts +28 -1
  12. package/dist/src/cli/helpers/init/directory-structure.d.ts.map +1 -1
  13. package/dist/src/cli/helpers/init/directory-structure.js +163 -33
  14. package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
  15. package/dist/src/cli/helpers/init/index.d.ts +2 -1
  16. package/dist/src/cli/helpers/init/index.d.ts.map +1 -1
  17. package/dist/src/cli/helpers/init/index.js +3 -1
  18. package/dist/src/cli/helpers/init/index.js.map +1 -1
  19. package/dist/src/cli/helpers/init/instruction-file-merger.d.ts +23 -0
  20. package/dist/src/cli/helpers/init/instruction-file-merger.d.ts.map +1 -0
  21. package/dist/src/cli/helpers/init/instruction-file-merger.js +243 -0
  22. package/dist/src/cli/helpers/init/instruction-file-merger.js.map +1 -0
  23. package/dist/src/cli/helpers/init/plugin-installer.js +49 -0
  24. package/dist/src/cli/helpers/init/plugin-installer.js.map +1 -1
  25. package/dist/src/config/types.d.ts +2 -2
  26. package/dist/src/core/living-docs/external-sync-orchestrator.d.ts +26 -0
  27. package/dist/src/core/living-docs/external-sync-orchestrator.d.ts.map +1 -1
  28. package/dist/src/core/living-docs/external-sync-orchestrator.js +61 -0
  29. package/dist/src/core/living-docs/external-sync-orchestrator.js.map +1 -1
  30. package/dist/src/core/living-docs/scaffolding/index.d.ts +12 -0
  31. package/dist/src/core/living-docs/scaffolding/index.d.ts.map +1 -0
  32. package/dist/src/core/living-docs/scaffolding/index.js +15 -0
  33. package/dist/src/core/living-docs/scaffolding/index.js.map +1 -0
  34. package/dist/src/core/living-docs/scaffolding/merger.d.ts +183 -0
  35. package/dist/src/core/living-docs/scaffolding/merger.d.ts.map +1 -0
  36. package/dist/src/core/living-docs/scaffolding/merger.js +523 -0
  37. package/dist/src/core/living-docs/scaffolding/merger.js.map +1 -0
  38. package/dist/src/core/living-docs/scaffolding/scaffold.d.ts +102 -0
  39. package/dist/src/core/living-docs/scaffolding/scaffold.d.ts.map +1 -0
  40. package/dist/src/core/living-docs/scaffolding/scaffold.js +346 -0
  41. package/dist/src/core/living-docs/scaffolding/scaffold.js.map +1 -0
  42. package/dist/src/core/living-docs/scaffolding/template-engine.d.ts +108 -0
  43. package/dist/src/core/living-docs/scaffolding/template-engine.d.ts.map +1 -0
  44. package/dist/src/core/living-docs/scaffolding/template-engine.js +204 -0
  45. package/dist/src/core/living-docs/scaffolding/template-engine.js.map +1 -0
  46. package/dist/src/core/living-docs/sync-helpers/generators.d.ts +38 -2
  47. package/dist/src/core/living-docs/sync-helpers/generators.d.ts.map +1 -1
  48. package/dist/src/core/living-docs/sync-helpers/generators.js +65 -10
  49. package/dist/src/core/living-docs/sync-helpers/generators.js.map +1 -1
  50. package/dist/src/core/living-docs/sync-helpers/index.d.ts +1 -1
  51. package/dist/src/core/living-docs/sync-helpers/index.d.ts.map +1 -1
  52. package/dist/src/core/living-docs/sync-helpers/index.js.map +1 -1
  53. package/dist/src/core/tools/index.d.ts +11 -0
  54. package/dist/src/core/tools/index.d.ts.map +1 -0
  55. package/dist/src/core/tools/index.js +10 -0
  56. package/dist/src/core/tools/index.js.map +1 -0
  57. package/dist/src/core/tools/tool-event-bus.d.ts +33 -0
  58. package/dist/src/core/tools/tool-event-bus.d.ts.map +1 -0
  59. package/dist/src/core/tools/tool-event-bus.js +84 -0
  60. package/dist/src/core/tools/tool-event-bus.js.map +1 -0
  61. package/dist/src/core/tools/tool-index-builder.d.ts +27 -0
  62. package/dist/src/core/tools/tool-index-builder.d.ts.map +1 -0
  63. package/dist/src/core/tools/tool-index-builder.js +289 -0
  64. package/dist/src/core/tools/tool-index-builder.js.map +1 -0
  65. package/dist/src/core/tools/tool-registry.d.ts +51 -0
  66. package/dist/src/core/tools/tool-registry.d.ts.map +1 -0
  67. package/dist/src/core/tools/tool-registry.js +224 -0
  68. package/dist/src/core/tools/tool-registry.js.map +1 -0
  69. package/dist/src/core/tools/tool-search-engine.d.ts +22 -0
  70. package/dist/src/core/tools/tool-search-engine.d.ts.map +1 -0
  71. package/dist/src/core/tools/tool-search-engine.js +174 -0
  72. package/dist/src/core/tools/tool-search-engine.js.map +1 -0
  73. package/dist/src/core/tools/types/tool-registry-types.d.ts +112 -0
  74. package/dist/src/core/tools/types/tool-registry-types.d.ts.map +1 -0
  75. package/dist/src/core/tools/types/tool-registry-types.js +7 -0
  76. package/dist/src/core/tools/types/tool-registry-types.js.map +1 -0
  77. package/dist/src/init/compliance/types.d.ts +1 -1
  78. package/package.json +1 -1
  79. package/plugins/specweave/hooks/hooks.json +3 -13
  80. package/plugins/specweave/hooks/lib/common-setup.sh +47 -321
  81. package/plugins/specweave/hooks/lib/migrate-increment-work.sh +5 -5
  82. package/plugins/specweave/hooks/lib/sync-spec-content.sh +5 -5
  83. package/plugins/specweave/hooks/universal/dispatcher.mjs +4 -5
  84. package/plugins/specweave/hooks/universal/fail-fast-wrapper.sh +43 -296
  85. package/plugins/specweave/hooks/universal/hook-wrapper.sh +3 -1
  86. package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
  87. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +2 -2
  88. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +1 -10
  89. package/plugins/specweave/hooks/v2/guards/completion-guard.sh +12 -29
  90. package/plugins/specweave/hooks/v2/guards/increment-duplicate-guard.sh +27 -29
  91. package/plugins/specweave/hooks/v2/guards/metadata-json-guard.sh +10 -4
  92. package/plugins/specweave/hooks/v2/guards/spec-validation-guard.sh +139 -0
  93. package/plugins/specweave/hooks/v2/guards/task-ac-sync-guard.sh +4 -2
  94. package/plugins/specweave/hooks/v2/session-end.sh +3 -1
  95. package/plugins/specweave/hooks/v2/session-start.sh +3 -1
  96. package/plugins/specweave/skills/increment-planner/templates/plan.md +14 -0
  97. package/plugins/specweave/skills/update-instructions/SKILL.md +80 -0
  98. package/plugins/specweave-ado/hooks/post-living-docs-update.sh +1 -1
  99. package/plugins/specweave-mobile/README.md +55 -35
  100. package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +805 -329
  101. package/plugins/specweave-mobile/skills/expo-workflow/SKILL.md +226 -9
  102. package/plugins/specweave-mobile/skills/native-modules/SKILL.md +221 -20
  103. package/plugins/specweave-mobile/skills/performance-optimization/SKILL.md +186 -14
  104. package/plugins/specweave-mobile/skills/react-native-setup/SKILL.md +151 -54
  105. package/plugins/specweave-release/commands/npm.md +61 -17
  106. package/plugins/specweave-release/hooks/post-task-completion.sh +2 -3
  107. package/src/templates/AGENTS.md.template +34 -0
  108. package/src/templates/CLAUDE.md.template +121 -155
  109. package/plugins/specweave/hooks/config-env-separator.sh +0 -99
  110. package/plugins/specweave/hooks/github-metadata-guard.sh +0 -73
  111. package/plugins/specweave/hooks/lib/circuit-breaker.sh +0 -381
  112. package/plugins/specweave/hooks/lib/crash-prevention.sh +0 -336
  113. package/plugins/specweave/hooks/lib/logging.sh +0 -231
  114. package/plugins/specweave/hooks/lib/metrics.sh +0 -347
  115. package/plugins/specweave/hooks/lib/semaphore.sh +0 -216
  116. package/plugins/specweave/hooks/project-folder-guard.sh +0 -274
  117. package/plugins/specweave/hooks/spec-project-validator.sh +0 -210
  118. package/plugins/specweave/hooks/v2/guards/bash-file-guard.sh +0 -212
  119. package/plugins/specweave/hooks/v2/guards/bash-file-guard.test.sh +0 -163
  120. package/plugins/specweave/hooks/v2/guards/features-folder-guard.sh +0 -51
  121. package/plugins/specweave/hooks/v2/guards/increment-root-guard.sh +0 -63
  122. package/plugins/specweave/hooks/v2/guards/per-us-project-validator.sh +0 -335
  123. package/plugins/specweave/hooks/v2/guards/per-us-project-validator.test.sh +0 -406
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Tool Search Engine - BM25-inspired keyword matching
3
+ * @module core/tools/tool-search-engine
4
+ * @since v0.35.0
5
+ */
6
+ const K1 = 1.2;
7
+ const B = 0.75;
8
+ const KEYWORD_EXACT_WEIGHT = 3.0;
9
+ const KEYWORD_PARTIAL_WEIGHT = 1.5;
10
+ const DESCRIPTION_WEIGHT = 1.0;
11
+ const CAPABILITY_WEIGHT = 2.0;
12
+ const NAME_WEIGHT = 2.5;
13
+ export class ToolSearchEngine {
14
+ constructor() {
15
+ this.tools = new Map();
16
+ this.keywordIndex = new Map();
17
+ this.idfCache = new Map();
18
+ this.avgDocLength = 0;
19
+ }
20
+ buildIndex(tools) {
21
+ this.tools.clear();
22
+ this.keywordIndex.clear();
23
+ this.idfCache.clear();
24
+ let totalKeywords = 0;
25
+ for (const tool of tools) {
26
+ this.tools.set(tool.id, tool);
27
+ for (const keyword of tool.keywords) {
28
+ const lower = keyword.toLowerCase();
29
+ if (!this.keywordIndex.has(lower)) {
30
+ this.keywordIndex.set(lower, new Set());
31
+ }
32
+ this.keywordIndex.get(lower).add(tool.id);
33
+ }
34
+ totalKeywords += tool.keywords.length;
35
+ }
36
+ this.avgDocLength = tools.length > 0 ? totalKeywords / tools.length : 0;
37
+ for (const keyword of this.keywordIndex.keys()) {
38
+ this.idfCache.set(keyword, this.calculateIDF(keyword));
39
+ }
40
+ }
41
+ search(query, options = {}) {
42
+ const { limit = 10, minScore = 0.1, type, plugin } = options;
43
+ const queryTerms = this.tokenize(query);
44
+ if (queryTerms.length === 0)
45
+ return [];
46
+ const results = [];
47
+ for (const tool of this.tools.values()) {
48
+ if (type) {
49
+ const types = Array.isArray(type) ? type : [type];
50
+ if (!types.includes(tool.type))
51
+ continue;
52
+ }
53
+ if (plugin) {
54
+ const plugins = Array.isArray(plugin) ? plugin : [plugin];
55
+ if (!plugins.includes(tool.pluginName))
56
+ continue;
57
+ }
58
+ const { score, matchedKeywords } = this.calculateScore(tool, queryTerms);
59
+ if (score >= minScore) {
60
+ results.push({
61
+ tool: { ...tool },
62
+ score: Math.min(score, 1),
63
+ matchedKeywords,
64
+ snippet: this.generateSnippet(tool, matchedKeywords),
65
+ });
66
+ }
67
+ }
68
+ results.sort((a, b) => b.score - a.score);
69
+ return results.slice(0, limit);
70
+ }
71
+ suggest(partialQuery, limit = 5) {
72
+ const queryLower = partialQuery.toLowerCase();
73
+ const suggestions = [];
74
+ for (const tool of this.tools.values()) {
75
+ let score = 0;
76
+ if (tool.name.toLowerCase().includes(queryLower))
77
+ score += NAME_WEIGHT;
78
+ for (const keyword of tool.keywords) {
79
+ if (keyword.toLowerCase().startsWith(queryLower))
80
+ score += KEYWORD_PARTIAL_WEIGHT;
81
+ }
82
+ if (score > 0)
83
+ suggestions.push({ tool, score });
84
+ }
85
+ suggestions.sort((a, b) => b.score - a.score);
86
+ return suggestions.slice(0, limit).map((s) => s.tool);
87
+ }
88
+ getByKeyword(keyword) {
89
+ const lower = keyword.toLowerCase();
90
+ const toolIds = this.keywordIndex.get(lower);
91
+ if (!toolIds)
92
+ return [];
93
+ return Array.from(toolIds).map((id) => this.tools.get(id)).filter(Boolean);
94
+ }
95
+ tokenize(text) {
96
+ return text
97
+ .toLowerCase()
98
+ .split(/[\s,.:;!?()[\]{}'"]+/)
99
+ .map((t) => t.replace(/[^a-z0-9-]/g, ''))
100
+ .filter((t) => t.length >= 2);
101
+ }
102
+ calculateScore(tool, queryTerms) {
103
+ let score = 0;
104
+ const matchedKeywords = [];
105
+ const toolKeywordsLower = tool.keywords.map((k) => k.toLowerCase());
106
+ const nameLower = tool.name.toLowerCase();
107
+ const descLower = tool.description.toLowerCase();
108
+ for (const term of queryTerms) {
109
+ if (toolKeywordsLower.includes(term)) {
110
+ const idf = this.idfCache.get(term) ?? 1;
111
+ score += KEYWORD_EXACT_WEIGHT * idf;
112
+ matchedKeywords.push(term);
113
+ continue;
114
+ }
115
+ let partialMatch = false;
116
+ for (const keyword of toolKeywordsLower) {
117
+ if (keyword.includes(term) || term.includes(keyword)) {
118
+ score += KEYWORD_PARTIAL_WEIGHT;
119
+ matchedKeywords.push(keyword);
120
+ partialMatch = true;
121
+ break;
122
+ }
123
+ }
124
+ if (partialMatch)
125
+ continue;
126
+ if (nameLower.includes(term)) {
127
+ score += NAME_WEIGHT;
128
+ matchedKeywords.push(term);
129
+ continue;
130
+ }
131
+ if (descLower.includes(term)) {
132
+ score += DESCRIPTION_WEIGHT;
133
+ continue;
134
+ }
135
+ if (tool.capabilities) {
136
+ for (const cap of tool.capabilities) {
137
+ if (cap.keywords.some((k) => k.toLowerCase().includes(term))) {
138
+ score += CAPABILITY_WEIGHT;
139
+ break;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ const docLength = tool.keywords.length;
145
+ if (docLength > 0 && this.avgDocLength > 0) {
146
+ const lengthNorm = 1 - B + B * (docLength / this.avgDocLength);
147
+ score = score / lengthNorm;
148
+ }
149
+ const maxPossibleScore = queryTerms.length * KEYWORD_EXACT_WEIGHT * 2;
150
+ const normalizedScore = maxPossibleScore > 0 ? score / maxPossibleScore : 0;
151
+ return { score: normalizedScore, matchedKeywords: [...new Set(matchedKeywords)] };
152
+ }
153
+ calculateIDF(term) {
154
+ const toolIds = this.keywordIndex.get(term);
155
+ if (!toolIds || toolIds.size === 0)
156
+ return 1;
157
+ const N = this.tools.size;
158
+ const df = toolIds.size;
159
+ return Math.log((N - df + 0.5) / (df + 0.5) + 1);
160
+ }
161
+ generateSnippet(tool, matchedKeywords) {
162
+ if (matchedKeywords.length === 0)
163
+ return tool.description.slice(0, 100);
164
+ let snippet = tool.description;
165
+ for (const keyword of matchedKeywords) {
166
+ // Escape regex special characters to prevent injection
167
+ const escaped = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
168
+ const regex = new RegExp(`\\b${escaped}\\b`, 'gi');
169
+ snippet = snippet.replace(regex, `**${keyword}**`);
170
+ }
171
+ return snippet.slice(0, 150);
172
+ }
173
+ }
174
+ //# sourceMappingURL=tool-search-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-search-engine.js","sourceRoot":"","sources":["../../../../src/core/tools/tool-search-engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,EAAE,GAAG,GAAG,CAAC;AACf,MAAM,CAAC,GAAG,IAAI,CAAC;AACf,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,OAAO,gBAAgB;IAM3B;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,UAAU,CAAC,KAAoB;QAC7B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,aAAa,GAAG,CAAC,CAAC;QAEtB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YAC9B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACpC,M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.0
5
+ */
6
+ export type ToolType = 'skill' | 'agent' | 'command';
7
+ export interface ToolCapability {
8
+ description: string;
9
+ keywords: string[];
10
+ }
11
+ export interface IndexedTool {
12
+ id: string;
13
+ name: string;
14
+ type: ToolType;
15
+ pluginName: string;
16
+ description: string;
17
+ keywords: string[];
18
+ capabilities?: ToolCapability[];
19
+ relativePath: string;
20
+ loaded: boolean;
21
+ indexedAt: string;
22
+ contentHash?: string;
23
+ modelPreference?: string;
24
+ allowedTools?: string[];
25
+ }
26
+ export interface LoadedTool extends IndexedTool {
27
+ content: string;
28
+ systemPrompt?: string;
29
+ loaded: true;
30
+ }
31
+ export interface ToolSearchResult {
32
+ tool: IndexedTool;
33
+ score: number;
34
+ matchedKeywords: string[];
35
+ snippet?: string;
36
+ }
37
+ export interface ToolSearchOptions {
38
+ limit?: number;
39
+ minScore?: number;
40
+ type?: ToolType | ToolType[];
41
+ plugin?: string | string[];
42
+ includeContent?: boolean;
43
+ }
44
+ export interface ToolRegistryData {
45
+ version: string;
46
+ tools: Record<string, IndexedTool>;
47
+ metadata: {
48
+ created: string;
49
+ lastUpdated: string;
50
+ toolCount: number;
51
+ buildDuration?: number;
52
+ };
53
+ keywordIndex?: Record<string, string[]>;
54
+ }
55
+ export interface IndexBuildOptions {
56
+ force?: boolean;
57
+ plugins?: string[];
58
+ emitEvents?: boolean;
59
+ pluginsDir?: string;
60
+ }
61
+ export interface IndexBuildResult {
62
+ success: boolean;
63
+ toolCount: number;
64
+ skillCount: number;
65
+ agentCount: number;
66
+ commandCount: number;
67
+ duration: number;
68
+ errors: string[];
69
+ warnings: string[];
70
+ }
71
+ export interface ToolEventBase {
72
+ timestamp: string;
73
+ }
74
+ export interface ToolIndexedEvent extends ToolEventBase {
75
+ type: 'ToolIndexed';
76
+ tool: IndexedTool;
77
+ }
78
+ export interface ToolLoadedEvent extends ToolEventBase {
79
+ type: 'ToolLoaded';
80
+ toolId: string;
81
+ tool: LoadedTool;
82
+ }
83
+ export interface RegistryRebuiltEvent extends ToolEventBase {
84
+ type: 'RegistryRebuilt';
85
+ result: IndexBuildResult;
86
+ }
87
+ export interface ToolSelectedEvent extends ToolEventBase {
88
+ type: 'ToolSelected';
89
+ toolId: string;
90
+ query: string;
91
+ score: number;
92
+ context?: string;
93
+ }
94
+ export type ToolEvent = ToolIndexedEvent | ToolLoadedEvent | RegistryRebuiltEvent | ToolSelectedEvent;
95
+ export type ToolEventType = ToolEvent['type'];
96
+ export type ToolEventHandler<T extends ToolEvent = ToolEvent> = (event: T) => void | Promise<void>;
97
+ export interface ToolValidationResult {
98
+ valid: boolean;
99
+ errors: string[];
100
+ warnings: string[];
101
+ }
102
+ export interface ToolRegistryStats {
103
+ totalTools: number;
104
+ skillCount: number;
105
+ agentCount: number;
106
+ commandCount: number;
107
+ loadedCount: number;
108
+ pluginCount: number;
109
+ keywordCount: number;
110
+ lastUpdated: string;
111
+ }
112
+ //# sourceMappingURL=tool-registry-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry-types.d.ts","sourceRoot":"","sources":["../../../../../src/core/tools/types/tool-registry-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,W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AE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Tool Registry Type Definitions
3
+ * @module core/tools/types/tool-registry-types
4
+ * @since v0.35.0
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=tool-registry-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry-types.js","sourceRoot":"","sources":["../../../../../src/core/tools/types/tool-registry-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -61,12 +61,12 @@ export declare const ComplianceStandardSchema: z.ZodObject<{
61
61
  healthcare: "healthcare";
62
62
  personal: "personal";
63
63
  payment: "payment";
64
+ children: "children";
64
65
  location: "location";
65
66
  financial: "financial";
66
67
  government: "government";
67
68
  student: "student";
68
69
  biometric: "biometric";
69
- children: "children";
70
70
  sensitive: "sensitive";
71
71
  }>>;
72
72
  regions: z.ZodArray<z.ZodString>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specweave",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "Spec-driven development framework for Claude Code. AI-native workflow with living documentation, intelligent agents, and multilingual support (9 languages). Enterprise-grade traceability with permanent specs and temporary increments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,16 +31,6 @@
31
31
  }
32
32
  ]
33
33
  },
34
- {
35
- "matcher": "Write|Edit",
36
- "matcher_content": "\\.specweave/docs/internal/specs/_features/",
37
- "hooks": [
38
- {
39
- "type": "command",
40
- "command": "bash -c 'W=\"${CLAUDE_PLUGIN_ROOT}/hooks/universal/fail-fast-wrapper.sh\"; S=\"${CLAUDE_PLUGIN_ROOT}/hooks/v2/guards/features-folder-guard.sh\"; [[ -x \"$W\" ]] && exec \"$W\" \"$S\" || (cat >/dev/null && printf \"{\\\"decision\\\":\\\"allow\\\"}\")'"
41
- }
42
- ]
43
- },
44
34
  {
45
35
  "matcher": "Write",
46
36
  "matcher_content": "\\.specweave/increments/\\d{3,4}E?-[^/]+/",
@@ -52,12 +42,12 @@
52
42
  ]
53
43
  },
54
44
  {
55
- "matcher": "Edit|Write",
56
- "matcher_content": "/src/.*\\.ts$",
45
+ "matcher": "Write",
46
+ "matcher_content": "\\.specweave/(increments/\\d{3,4}E?-[^/]+/spec\\.md|docs/internal/specs/)",
57
47
  "hooks": [
58
48
  {
59
49
  "type": "command",
60
- "command": "bash -c 'W=\"${CLAUDE_PLUGIN_ROOT}/hooks/universal/fail-fast-wrapper.sh\"; S=\"${CLAUDE_PLUGIN_ROOT}/hooks/config-env-separator.sh\"; [[ -x \"$W\" ]] && exec \"$W\" \"$S\" || (cat >/dev/null && printf \"{\\\"decision\\\":\\\"allow\\\"}\")'"
50
+ "command": "bash -c 'W=\"${CLAUDE_PLUGIN_ROOT}/hooks/universal/fail-fast-wrapper.sh\"; S=\"${CLAUDE_PLUGIN_ROOT}/hooks/v2/guards/spec-validation-guard.sh\"; [[ -x \"$W\" ]] && exec \"$W\" \"$S\" || (cat >/dev/null && printf \"{\\\"decision\\\":\\\"allow\\\"}\")'"
61
51
  }
62
52
  ]
63
53
  }