devworkspace 0.4.5 → 0.5.0

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 (256) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +7 -0
  3. package/dist/cli/args.d.ts +30 -0
  4. package/dist/cli/args.js +10 -0
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/cli/help.js +134 -0
  7. package/dist/cli/help.js.map +1 -1
  8. package/dist/cli/render.d.ts +6 -0
  9. package/dist/cli/render.js +106 -0
  10. package/dist/cli/render.js.map +1 -1
  11. package/dist/cli/run.js +351 -1
  12. package/dist/cli/run.js.map +1 -1
  13. package/dist/core/contracts.d.ts +70 -0
  14. package/dist/core/contracts.js +88 -0
  15. package/dist/core/contracts.js.map +1 -0
  16. package/dist/discovery/commands.d.ts +1 -1
  17. package/dist/discovery/commands.js.map +1 -1
  18. package/dist/discovery/detect.d.ts +2 -70
  19. package/dist/discovery/detect.js.map +1 -1
  20. package/dist/discovery/entrypoints.d.ts +2 -11
  21. package/dist/discovery/entrypoints.js.map +1 -1
  22. package/dist/discovery/types.d.ts +79 -0
  23. package/dist/discovery/types.js +2 -0
  24. package/dist/discovery/types.js.map +1 -0
  25. package/dist/dx/dashboard.d.ts +21 -0
  26. package/dist/dx/dashboard.js +274 -0
  27. package/dist/dx/dashboard.js.map +1 -0
  28. package/dist/dx/guidance.d.ts +21 -0
  29. package/dist/dx/guidance.js +266 -0
  30. package/dist/dx/guidance.js.map +1 -0
  31. package/dist/dx/index.d.ts +4 -0
  32. package/dist/dx/index.js +5 -0
  33. package/dist/dx/index.js.map +1 -0
  34. package/dist/dx/onboarding.d.ts +23 -0
  35. package/dist/dx/onboarding.js +155 -0
  36. package/dist/dx/onboarding.js.map +1 -0
  37. package/dist/dx/types.d.ts +70 -0
  38. package/dist/dx/types.js +3 -0
  39. package/dist/dx/types.js.map +1 -0
  40. package/dist/index.d.ts +35 -0
  41. package/dist/index.js +28 -0
  42. package/dist/index.js.map +1 -1
  43. package/dist/integrations/persistentPath.d.ts +2 -9
  44. package/dist/integrations/persistentPath.js.map +1 -1
  45. package/dist/integrations/types.d.ts +4 -1
  46. package/dist/integrations/types.js.map +1 -1
  47. package/dist/intelligence/agents/profiles.d.ts +2 -0
  48. package/dist/intelligence/agents/profiles.js +326 -0
  49. package/dist/intelligence/agents/profiles.js.map +1 -0
  50. package/dist/intelligence/agents/registry.d.ts +15 -0
  51. package/dist/intelligence/agents/registry.js +108 -0
  52. package/dist/intelligence/agents/registry.js.map +1 -0
  53. package/dist/intelligence/agents/types.d.ts +43 -0
  54. package/dist/intelligence/agents/types.js +2 -0
  55. package/dist/intelligence/agents/types.js.map +1 -0
  56. package/dist/intelligence/observability/tracer.d.ts +13 -0
  57. package/dist/intelligence/observability/tracer.js +129 -0
  58. package/dist/intelligence/observability/tracer.js.map +1 -0
  59. package/dist/intelligence/observability/types.d.ts +38 -0
  60. package/dist/intelligence/observability/types.js +2 -0
  61. package/dist/intelligence/observability/types.js.map +1 -0
  62. package/dist/intelligence/orchestration/engine.d.ts +42 -0
  63. package/dist/intelligence/orchestration/engine.js +418 -0
  64. package/dist/intelligence/orchestration/engine.js.map +1 -0
  65. package/dist/intelligence/orchestration/lock-manager.d.ts +21 -0
  66. package/dist/intelligence/orchestration/lock-manager.js +70 -0
  67. package/dist/intelligence/orchestration/lock-manager.js.map +1 -0
  68. package/dist/intelligence/orchestration/store.d.ts +11 -0
  69. package/dist/intelligence/orchestration/store.js +73 -0
  70. package/dist/intelligence/orchestration/store.js.map +1 -0
  71. package/dist/intelligence/orchestration/types.d.ts +100 -0
  72. package/dist/intelligence/orchestration/types.js +48 -0
  73. package/dist/intelligence/orchestration/types.js.map +1 -0
  74. package/dist/intelligence/routing/matcher.d.ts +7 -0
  75. package/dist/intelligence/routing/matcher.js +96 -0
  76. package/dist/intelligence/routing/matcher.js.map +1 -0
  77. package/dist/intelligence/routing/router.d.ts +9 -0
  78. package/dist/intelligence/routing/router.js +198 -0
  79. package/dist/intelligence/routing/router.js.map +1 -0
  80. package/dist/intelligence/routing/types.d.ts +64 -0
  81. package/dist/intelligence/routing/types.js +2 -0
  82. package/dist/intelligence/routing/types.js.map +1 -0
  83. package/dist/intelligence/runtime/adk/adapter.d.ts +7 -0
  84. package/dist/intelligence/runtime/adk/adapter.js +60 -0
  85. package/dist/intelligence/runtime/adk/adapter.js.map +1 -0
  86. package/dist/intelligence/runtime/adk/detector.d.ts +7 -0
  87. package/dist/intelligence/runtime/adk/detector.js +28 -0
  88. package/dist/intelligence/runtime/adk/detector.js.map +1 -0
  89. package/dist/intelligence/runtime/external.d.ts +9 -0
  90. package/dist/intelligence/runtime/external.js +102 -0
  91. package/dist/intelligence/runtime/external.js.map +1 -0
  92. package/dist/intelligence/runtime/native.d.ts +19 -0
  93. package/dist/intelligence/runtime/native.js +99 -0
  94. package/dist/intelligence/runtime/native.js.map +1 -0
  95. package/dist/intelligence/runtime/types.d.ts +49 -0
  96. package/dist/intelligence/runtime/types.js +2 -0
  97. package/dist/intelligence/runtime/types.js.map +1 -0
  98. package/dist/intelligence/security/audit.d.ts +8 -0
  99. package/dist/intelligence/security/audit.js +43 -0
  100. package/dist/intelligence/security/audit.js.map +1 -0
  101. package/dist/intelligence/security/policy.d.ts +12 -0
  102. package/dist/intelligence/security/policy.js +153 -0
  103. package/dist/intelligence/security/policy.js.map +1 -0
  104. package/dist/intelligence/security/types.d.ts +25 -0
  105. package/dist/intelligence/security/types.js +2 -0
  106. package/dist/intelligence/security/types.js.map +1 -0
  107. package/dist/intelligence/skills/builtins.d.ts +2 -0
  108. package/dist/intelligence/skills/builtins.js +379 -0
  109. package/dist/intelligence/skills/builtins.js.map +1 -0
  110. package/dist/intelligence/skills/loader.d.ts +4 -0
  111. package/dist/intelligence/skills/loader.js +84 -0
  112. package/dist/intelligence/skills/loader.js.map +1 -0
  113. package/dist/intelligence/skills/registry.d.ts +15 -0
  114. package/dist/intelligence/skills/registry.js +134 -0
  115. package/dist/intelligence/skills/registry.js.map +1 -0
  116. package/dist/intelligence/skills/types.d.ts +35 -0
  117. package/dist/intelligence/skills/types.js +2 -0
  118. package/dist/intelligence/skills/types.js.map +1 -0
  119. package/dist/intelligence/verification/engine.d.ts +23 -0
  120. package/dist/intelligence/verification/engine.js +66 -0
  121. package/dist/intelligence/verification/engine.js.map +1 -0
  122. package/dist/intelligence/verification/reviewer.d.ts +8 -0
  123. package/dist/intelligence/verification/reviewer.js +55 -0
  124. package/dist/intelligence/verification/reviewer.js.map +1 -0
  125. package/dist/intelligence/verification/types.d.ts +32 -0
  126. package/dist/intelligence/verification/types.js +2 -0
  127. package/dist/intelligence/verification/types.js.map +1 -0
  128. package/dist/mcp/setup.d.ts +2 -4
  129. package/dist/mcp/setup.js.map +1 -1
  130. package/dist/mcp/tools.js +6 -6
  131. package/dist/mcp/tools.js.map +1 -1
  132. package/dist/mcp/types.d.ts +4 -0
  133. package/dist/mcp/types.js.map +1 -1
  134. package/dist/mcp/verify.d.ts +1 -1
  135. package/dist/mcp/verify.js.map +1 -1
  136. package/dist/security/redact.js +3 -2
  137. package/dist/security/redact.js.map +1 -1
  138. package/dist/services/doctor.js +4 -0
  139. package/dist/services/doctor.js.map +1 -1
  140. package/dist/services/intelligence.d.ts +44 -0
  141. package/dist/services/intelligence.js +119 -0
  142. package/dist/services/intelligence.js.map +1 -0
  143. package/dist/services/standards.d.ts +85 -0
  144. package/dist/services/standards.js +230 -0
  145. package/dist/services/standards.js.map +1 -0
  146. package/dist/services/taskContext.js +4 -0
  147. package/dist/services/taskContext.js.map +1 -1
  148. package/dist/standards/acquisition/ingest.d.ts +12 -0
  149. package/dist/standards/acquisition/ingest.js +98 -0
  150. package/dist/standards/acquisition/ingest.js.map +1 -0
  151. package/dist/standards/applicability/engine.d.ts +38 -0
  152. package/dist/standards/applicability/engine.js +250 -0
  153. package/dist/standards/applicability/engine.js.map +1 -0
  154. package/dist/standards/builtin/code-quality.d.ts +2 -0
  155. package/dist/standards/builtin/code-quality.js +53 -0
  156. package/dist/standards/builtin/code-quality.js.map +1 -0
  157. package/dist/standards/builtin/database-safety.d.ts +2 -0
  158. package/dist/standards/builtin/database-safety.js +56 -0
  159. package/dist/standards/builtin/database-safety.js.map +1 -0
  160. package/dist/standards/builtin/index.d.ts +8 -0
  161. package/dist/standards/builtin/index.js +14 -0
  162. package/dist/standards/builtin/index.js.map +1 -0
  163. package/dist/standards/builtin/security-baseline.d.ts +2 -0
  164. package/dist/standards/builtin/security-baseline.js +64 -0
  165. package/dist/standards/builtin/security-baseline.js.map +1 -0
  166. package/dist/standards/builtin/testing-contracts.d.ts +2 -0
  167. package/dist/standards/builtin/testing-contracts.js +54 -0
  168. package/dist/standards/builtin/testing-contracts.js.map +1 -0
  169. package/dist/standards/builtin/undo-kit.d.ts +8 -0
  170. package/dist/standards/builtin/undo-kit.js +106 -0
  171. package/dist/standards/builtin/undo-kit.js.map +1 -0
  172. package/dist/standards/config/config.d.ts +12 -0
  173. package/dist/standards/config/config.js +110 -0
  174. package/dist/standards/config/config.js.map +1 -0
  175. package/dist/standards/distribution/cache.d.ts +57 -0
  176. package/dist/standards/distribution/cache.js +411 -0
  177. package/dist/standards/distribution/cache.js.map +1 -0
  178. package/dist/standards/distribution/index.d.ts +6 -0
  179. package/dist/standards/distribution/index.js +7 -0
  180. package/dist/standards/distribution/index.js.map +1 -0
  181. package/dist/standards/distribution/keys.d.ts +53 -0
  182. package/dist/standards/distribution/keys.js +269 -0
  183. package/dist/standards/distribution/keys.js.map +1 -0
  184. package/dist/standards/distribution/package.d.ts +25 -0
  185. package/dist/standards/distribution/package.js +248 -0
  186. package/dist/standards/distribution/package.js.map +1 -0
  187. package/dist/standards/distribution/server.d.ts +38 -0
  188. package/dist/standards/distribution/server.js +204 -0
  189. package/dist/standards/distribution/server.js.map +1 -0
  190. package/dist/standards/distribution/sync.d.ts +51 -0
  191. package/dist/standards/distribution/sync.js +212 -0
  192. package/dist/standards/distribution/sync.js.map +1 -0
  193. package/dist/standards/distribution/types.d.ts +140 -0
  194. package/dist/standards/distribution/types.js +26 -0
  195. package/dist/standards/distribution/types.js.map +1 -0
  196. package/dist/standards/engine/compliance.d.ts +2 -0
  197. package/dist/standards/engine/compliance.js +45 -0
  198. package/dist/standards/engine/compliance.js.map +1 -0
  199. package/dist/standards/engine/engine.d.ts +14 -0
  200. package/dist/standards/engine/engine.js +114 -0
  201. package/dist/standards/engine/engine.js.map +1 -0
  202. package/dist/standards/engine/reporter.d.ts +2 -0
  203. package/dist/standards/engine/reporter.js +42 -0
  204. package/dist/standards/engine/reporter.js.map +1 -0
  205. package/dist/standards/index.d.ts +18 -0
  206. package/dist/standards/index.js +19 -0
  207. package/dist/standards/index.js.map +1 -0
  208. package/dist/standards/registry/registry.d.ts +29 -0
  209. package/dist/standards/registry/registry.js +210 -0
  210. package/dist/standards/registry/registry.js.map +1 -0
  211. package/dist/standards/schema/types.d.ts +133 -0
  212. package/dist/standards/schema/types.js +33 -0
  213. package/dist/standards/schema/types.js.map +1 -0
  214. package/dist/standards/schema/validate.d.ts +6 -0
  215. package/dist/standards/schema/validate.js +131 -0
  216. package/dist/standards/schema/validate.js.map +1 -0
  217. package/dist/standards/templates/index.d.ts +11 -0
  218. package/dist/standards/templates/index.js +176 -0
  219. package/dist/standards/templates/index.js.map +1 -0
  220. package/dist/standards/validators/database.d.ts +5 -0
  221. package/dist/standards/validators/database.js +122 -0
  222. package/dist/standards/validators/database.js.map +1 -0
  223. package/dist/standards/validators/quality.d.ts +6 -0
  224. package/dist/standards/validators/quality.js +91 -0
  225. package/dist/standards/validators/quality.js.map +1 -0
  226. package/dist/standards/validators/registry.d.ts +11 -0
  227. package/dist/standards/validators/registry.js +83 -0
  228. package/dist/standards/validators/registry.js.map +1 -0
  229. package/dist/standards/validators/security.d.ts +7 -0
  230. package/dist/standards/validators/security.js +182 -0
  231. package/dist/standards/validators/security.js.map +1 -0
  232. package/dist/standards/validators/testing.d.ts +6 -0
  233. package/dist/standards/validators/testing.js +142 -0
  234. package/dist/standards/validators/testing.js.map +1 -0
  235. package/dist/standards/validators/types.d.ts +11 -0
  236. package/dist/standards/validators/types.js +2 -0
  237. package/dist/standards/validators/types.js.map +1 -0
  238. package/dist/standards/validators/undo-kit.d.ts +7 -0
  239. package/dist/standards/validators/undo-kit.js +334 -0
  240. package/dist/standards/validators/undo-kit.js.map +1 -0
  241. package/dist/tasks/routing.js +5 -3
  242. package/dist/tasks/routing.js.map +1 -1
  243. package/dist/utils/fs.d.ts +1 -1
  244. package/dist/utils/fs.js.map +1 -1
  245. package/dist/utils/lock.js +11 -3
  246. package/dist/utils/lock.js.map +1 -1
  247. package/dist/utils/paths.js +29 -0
  248. package/dist/utils/paths.js.map +1 -1
  249. package/dist/utils/proc.js +2 -0
  250. package/dist/utils/proc.js.map +1 -1
  251. package/docs/contributing.md +9 -0
  252. package/docs/getting-started.md +7 -0
  253. package/docs/security/HOME_SERVER_THREAT_MODEL.md +72 -0
  254. package/docs/security/THREAT_MODEL.md +101 -0
  255. package/docs/standards.md +143 -0
  256. package/package.json +1 -1
@@ -0,0 +1,379 @@
1
+ export const BUILTIN_SKILLS = {
2
+ 'api-development': {
3
+ id: 'api-development',
4
+ name: 'API Development',
5
+ version: '1.0.0',
6
+ description: 'RESTful and RPC API design, request validation, structured error modeling, and idempotency.',
7
+ category: 'development',
8
+ capabilities: ['api-design', 'input-validation', 'http-semantics', 'idempotency'],
9
+ requiredTools: ['get_file_context'],
10
+ dependencies: [],
11
+ permissions: { readFiles: true, writeFiles: true },
12
+ tags: ['api', 'rest', 'endpoints', 'schemas'],
13
+ isBuiltin: true,
14
+ sourceScope: 'builtin',
15
+ progressiveContent: {
16
+ summary: 'Design robust, backward-compatible endpoints with strict schema validation and predictable status codes.',
17
+ principles: [
18
+ 'Validate all incoming inputs at the system boundary using strict schema checkers (e.g. Zod).',
19
+ 'Use appropriate HTTP status codes (400 bad request, 401 unauth, 403 forbidden, 404 not found, 409 conflict, 422 unprocessable).',
20
+ 'Never return stack traces, internal database columns, or unmasked secrets in error payloads.',
21
+ ],
22
+ guidelines: [
23
+ 'Ensure POST endpoints that create resources return 201 Created and Location header where appropriate.',
24
+ 'Implement idempotency keys for sensitive non-idempotent mutation operations.',
25
+ 'Structure JSON error responses uniformly: { error: { code, message, details } }.',
26
+ ],
27
+ referenceChecklist: [
28
+ 'Inputs validated against schema before business logic executes',
29
+ 'Authentication and authorization checks precede state mutations',
30
+ 'Zero sensitive credentials logged or returned in response bodies',
31
+ ],
32
+ antiPatterns: [
33
+ 'Returning 200 OK with an error payload in the JSON body',
34
+ 'Relying on client-side validation alone',
35
+ 'Leaking SQL or ORM internal error strings to consumers',
36
+ ],
37
+ },
38
+ },
39
+ 'database-design': {
40
+ id: 'database-design',
41
+ name: 'Database Design',
42
+ version: '1.0.0',
43
+ description: 'Relational & document schema modeling, normalization, foreign key integrity, and migration authoring.',
44
+ category: 'architecture',
45
+ capabilities: ['schema-modeling', 'normalization', 'migrations', 'foreign-keys'],
46
+ requiredTools: ['get_file_context'],
47
+ dependencies: [],
48
+ permissions: { readFiles: true, writeFiles: true },
49
+ tags: ['sql', 'database', 'schema', 'migrations'],
50
+ isBuiltin: true,
51
+ sourceScope: 'builtin',
52
+ progressiveContent: {
53
+ summary: 'Model durable, normalized relational schemas with explicit constraints and reversible migrations.',
54
+ principles: [
55
+ 'Prefer 3rd Normal Form (3NF) for transactional operational data to eliminate update anomalies.',
56
+ 'Enforce referential integrity using explicit foreign keys and check constraints at the database level.',
57
+ 'All database migrations must be atomic, idempotent, and reversible (supporting up and down steps).',
58
+ ],
59
+ guidelines: [
60
+ 'Index foreign key columns that participate in JOINs and filtering.',
61
+ 'Use UTC timestamps (TIMESTAMPTZ) for all created_at and updated_at audit columns.',
62
+ 'Avoid locking production tables during column additions by providing sensible defaults without table-rewrites.',
63
+ ],
64
+ referenceChecklist: [
65
+ 'Primary keys defined for all relational tables',
66
+ 'Migration files versioned sequentially and tested in isolation',
67
+ 'Rollback scripts verified against existing test fixtures',
68
+ ],
69
+ antiPatterns: [
70
+ 'Storing comma-separated or unvalidated stringified arrays instead of proper join tables',
71
+ 'Creating non-reversible migrations with irreversible column drops',
72
+ 'Omitting foreign key constraints to save indexing time',
73
+ ],
74
+ },
75
+ },
76
+ 'database-optimization': {
77
+ id: 'database-optimization',
78
+ name: 'Database Optimization',
79
+ version: '1.0.0',
80
+ description: 'Query tuning, index strategy, query execution plans (EXPLAIN), and N+1 query elimination.',
81
+ category: 'performance',
82
+ capabilities: ['query-tuning', 'indexing', 'n-plus-1-prevention', 'explain-analysis'],
83
+ requiredTools: ['get_file_context', 'execute_check'],
84
+ dependencies: ['database-design'],
85
+ permissions: { readFiles: true, writeFiles: true, executeTerminal: true },
86
+ tags: ['database', 'performance', 'sql', 'indexing'],
87
+ isBuiltin: true,
88
+ sourceScope: 'builtin',
89
+ progressiveContent: {
90
+ summary: 'Optimize database access patterns to eliminate slow queries, full table scans, and round-trip latency.',
91
+ principles: [
92
+ 'Always inspect EXPLAIN ANALYZE before adding indexes to prevent useless index bloat.',
93
+ 'Batch relational loads using eager loading or dataloaders to eliminate N+1 queries.',
94
+ 'Select only necessary columns rather than SELECT *.',
95
+ ],
96
+ guidelines: [
97
+ 'Add composite indexes where queries filter on multiple columns (left-to-right prefix rule).',
98
+ 'Use keyset pagination instead of OFFSET/LIMIT for high-volume datasets.',
99
+ 'Set query execution timeouts to prevent runaway resource exhaustion.',
100
+ ],
101
+ referenceChecklist: [
102
+ 'No N+1 loops inside iteration blocks',
103
+ 'Indexes match high-frequency WHERE and ORDER BY clauses',
104
+ 'Transactions kept as short as possible to avoid lock contention',
105
+ ],
106
+ },
107
+ },
108
+ debugging: {
109
+ id: 'debugging',
110
+ name: 'Debugging',
111
+ version: '1.0.0',
112
+ description: 'Systematic fault reproduction, binary search localization, heap/stack diagnosis, and regression tests.',
113
+ category: 'development',
114
+ capabilities: ['fault-reproduction', 'root-cause-analysis', 'stack-diagnosis', 'regression-testing'],
115
+ requiredTools: ['get_file_context', 'execute_check'],
116
+ dependencies: [],
117
+ permissions: { readFiles: true, writeFiles: true, executeTerminal: true },
118
+ tags: ['debug', 'fix', 'regression', 'diagnosis'],
119
+ isBuiltin: true,
120
+ sourceScope: 'builtin',
121
+ progressiveContent: {
122
+ summary: 'Diagnose failures systematically by establishing a reproducible failing test before modifying code.',
123
+ principles: [
124
+ 'Never guess or apply shotgun fixes. Reproduce the bug deterministically in a minimal test case first.',
125
+ 'Binary search through suspect code paths and recent git commits (git bisect).',
126
+ 'Fix the root cause, not just the symptom, and verify no related invariants break.',
127
+ ],
128
+ guidelines: [
129
+ 'Capture the exact input payload, environment variables, and preconditions that trigger the failure.',
130
+ 'Verify the regression test fails with the reported defect before applying the patch.',
131
+ 'Confirm the regression test passes after the patch without relaxing existing assertions.',
132
+ ],
133
+ },
134
+ },
135
+ 'test-driven-development': {
136
+ id: 'test-driven-development',
137
+ name: 'Test-Driven Development',
138
+ version: '1.0.0',
139
+ description: 'Red-Green-Refactor discipline, unit & integration test authoring, test isolation, and contract assertions.',
140
+ category: 'testing',
141
+ capabilities: ['unit-testing', 'test-isolation', 'mock-boundaries', 'regression-safeguards'],
142
+ requiredTools: ['get_file_context', 'execute_check'],
143
+ dependencies: [],
144
+ permissions: { readFiles: true, writeFiles: true, executeTerminal: true },
145
+ tags: ['tdd', 'tests', 'unit', 'quality'],
146
+ isBuiltin: true,
147
+ sourceScope: 'builtin',
148
+ progressiveContent: {
149
+ summary: 'Drive software design through executable specifications, testing behavior rather than internal implementation details.',
150
+ principles: [
151
+ 'Red: Write a concise, failing test describing the desired behavior.',
152
+ 'Green: Write the minimal amount of code required to make the test pass.',
153
+ 'Refactor: Clean up structure, remove duplication, and improve readability while keeping tests green.',
154
+ ],
155
+ guidelines: [
156
+ 'Keep unit tests fast, isolated, and side-effect free (use in-memory doubles for external I/O).',
157
+ 'Assert on observable behavior and contracts rather than private member state.',
158
+ 'Ensure each test tests exactly one logical concept with clear assertion failure messages.',
159
+ ],
160
+ },
161
+ },
162
+ 'code-review': {
163
+ id: 'code-review',
164
+ name: 'Code Review',
165
+ version: '1.0.0',
166
+ description: 'Static analysis checklist, readability, maintainability, architectural invariants, and smell detection.',
167
+ category: 'development',
168
+ capabilities: ['diff-inspection', 'smell-detection', 'convention-audit', 'clean-code'],
169
+ requiredTools: ['get_file_context'],
170
+ dependencies: [],
171
+ permissions: { readFiles: true },
172
+ tags: ['review', 'quality', 'clean-code'],
173
+ isBuiltin: true,
174
+ sourceScope: 'builtin',
175
+ progressiveContent: {
176
+ summary: 'Independently inspect code changes for design clarity, maintainability, edge cases, and architectural compliance.',
177
+ principles: [
178
+ 'Verify that changes fulfill stated requirements without introducing undocumented side-effects.',
179
+ 'Enforce consistent naming, error handling, and separation of concerns.',
180
+ 'Check boundary conditions: empty arrays, null/undefined, extreme numbers, concurrent mutations.',
181
+ ],
182
+ guidelines: [
183
+ 'Review the git diff comprehensively before signing off on any task.',
184
+ 'Flag unnecessary complexity or over-engineering (YAGNI).',
185
+ 'Verify that relevant tests were updated or added to accompany the code change.',
186
+ ],
187
+ },
188
+ },
189
+ 'security-audit': {
190
+ id: 'security-audit',
191
+ name: 'Security Audit',
192
+ version: '1.0.0',
193
+ description: 'OWASP vulnerability identification, secret leakage prevention, input sanitization, and permission boundaries.',
194
+ category: 'security',
195
+ capabilities: ['vulnerability-detection', 'secret-scanning', 'input-sanitization', 'permission-validation'],
196
+ requiredTools: ['get_file_context', 'execute_check'],
197
+ dependencies: [],
198
+ permissions: { readFiles: true, executeTerminal: true },
199
+ tags: ['security', 'audit', 'owasp', 'cve'],
200
+ isBuiltin: true,
201
+ sourceScope: 'builtin',
202
+ progressiveContent: {
203
+ summary: 'Harden codebases against injection, credential leakage, path traversal, and unauthorized access.',
204
+ principles: [
205
+ 'Assume all external input is potentially malicious. Sanitize and validate against strict schemas.',
206
+ 'Zero secrets in source control or persistent contexts. Verify .env and credentials remain blacklisted.',
207
+ 'Enforce principle of least privilege across process execution, filesystem access, and API scopes.',
208
+ ],
209
+ guidelines: [
210
+ 'Prevent SQL/NoSQL injection by using parameterized queries and trusted ORMs exclusively.',
211
+ 'Block path traversal by resolving paths strictly within the designated repository root.',
212
+ 'Run npm audit / dependency vulnerability scans as a mandatory check.',
213
+ ],
214
+ },
215
+ },
216
+ 'performance-optimization': {
217
+ id: 'performance-optimization',
218
+ name: 'Performance Optimization',
219
+ version: '1.0.0',
220
+ description: 'Latency profiling, algorithmic time/space complexity reduction, memory leak detection, and async tuning.',
221
+ category: 'performance',
222
+ capabilities: ['latency-profiling', 'memory-management', 'complexity-reduction', 'throughput-tuning'],
223
+ requiredTools: ['get_file_context', 'execute_check'],
224
+ dependencies: [],
225
+ permissions: { readFiles: true, writeFiles: true, executeTerminal: true },
226
+ tags: ['performance', 'optimization', 'latency', 'profiling'],
227
+ isBuiltin: true,
228
+ sourceScope: 'builtin',
229
+ progressiveContent: {
230
+ summary: 'Measure and eliminate runtime bottlenecks, excessive allocations, and non-linear algorithmic complexity.',
231
+ principles: [
232
+ 'Measure before optimizing. Avoid premature optimization that sacrifices code clarity.',
233
+ 'Reduce algorithmic complexity (e.g. O(N^2) to O(N) using HashMaps/Sets for lookups).',
234
+ 'Avoid memory leaks caused by lingering event listeners, unbounded caches, or circular references.',
235
+ ],
236
+ guidelines: [
237
+ 'Use stream processing for large files and payloads rather than buffering everything in memory.',
238
+ 'Leverage asynchronous non-blocking I/O and worker threads for CPU-bound computations.',
239
+ 'Profile CPU and memory allocation profiles under realistic workloads.',
240
+ ],
241
+ },
242
+ },
243
+ refactoring: {
244
+ id: 'refactoring',
245
+ name: 'Refactoring',
246
+ version: '1.0.0',
247
+ description: 'Transform internal code structure without changing external observable behavior; reduce technical debt.',
248
+ category: 'development',
249
+ capabilities: ['structural-cleanup', 'modularity', 'dry-principle', 'extract-functions'],
250
+ requiredTools: ['get_file_context', 'execute_check'],
251
+ dependencies: ['test-driven-development'],
252
+ permissions: { readFiles: true, writeFiles: true, executeTerminal: true },
253
+ tags: ['refactor', 'clean-code', 'modularity'],
254
+ isBuiltin: true,
255
+ sourceScope: 'builtin',
256
+ progressiveContent: {
257
+ summary: 'Improve code readability, reduce coupling, and eliminate duplication while verifying behavior remains identical.',
258
+ principles: [
259
+ 'Establish passing baseline tests before touching any code.',
260
+ 'Refactor in small, verifiable micro-steps, running tests after each transformation.',
261
+ 'Do not combine behavioral changes or feature additions with refactoring.',
262
+ ],
263
+ guidelines: [
264
+ 'Extract long functions into small, cohesive, well-named functions with clear responsibilities.',
265
+ 'Replace magic numbers and strings with well-scoped constants or enumerations.',
266
+ 'Keep public module contracts and API signatures backward-compatible.',
267
+ ],
268
+ },
269
+ },
270
+ documentation: {
271
+ id: 'documentation',
272
+ name: 'Documentation',
273
+ version: '1.0.0',
274
+ description: 'Technical writing, OpenAPI documentation, code architecture references, and onboarding prompts.',
275
+ category: 'documentation',
276
+ capabilities: ['technical-writing', 'markdown-docs', 'api-specs', 'onboarding'],
277
+ requiredTools: ['get_file_context'],
278
+ dependencies: [],
279
+ permissions: { readFiles: true, writeFiles: true },
280
+ tags: ['docs', 'writing', 'readme', 'api-docs'],
281
+ isBuiltin: true,
282
+ sourceScope: 'builtin',
283
+ progressiveContent: {
284
+ summary: 'Create clear, concise, accurate documentation that stays synchronized with actual codebase behavior.',
285
+ principles: [
286
+ 'Documentation must reflect working reality; verify commands and configuration snippets.',
287
+ 'Write for the reader: state prerequisites, provide actionable copy-pasteable examples, explain failure modes.',
288
+ 'Keep documentation close to code (READMEs, JSDoc, markdown guides) and update it in the same PR.',
289
+ ],
290
+ guidelines: [
291
+ 'Document the WHY behind architecture decisions, not just the WHAT.',
292
+ 'Structure technical guides with: Overview, Prerequisites, Step-by-Step, Verification, Troubleshooting.',
293
+ 'Avoid outdated narrative documentation that drifts immediately from code.',
294
+ ],
295
+ },
296
+ },
297
+ 'ci-cd': {
298
+ id: 'ci-cd',
299
+ name: 'CI/CD & DevOps',
300
+ version: '1.0.0',
301
+ description: 'Continuous integration workflows, reproducible automated builds, release gates, and container checks.',
302
+ category: 'operations',
303
+ capabilities: ['pipeline-authoring', 'release-gating', 'reproducible-builds', 'action-automation'],
304
+ requiredTools: ['get_file_context', 'execute_check'],
305
+ dependencies: [],
306
+ permissions: { readFiles: true, writeFiles: true, executeTerminal: true },
307
+ tags: ['ci', 'cd', 'devops', 'actions', 'workflows'],
308
+ isBuiltin: true,
309
+ sourceScope: 'builtin',
310
+ progressiveContent: {
311
+ summary: 'Automate build, test, and release verification pipelines to ensure software can be deployed reliably at any time.',
312
+ principles: [
313
+ 'Pipelines must be deterministic: identical commits yield identical build artifacts.',
314
+ 'Fail fast: run fast lint and typechecks before launching expensive integration/e2e test suites.',
315
+ 'Pin actions and dependencies to known secure versions or hashes.',
316
+ ],
317
+ guidelines: [
318
+ 'Never store plaintext secrets or deployment tokens in repository files or unmasked CI outputs.',
319
+ 'Ensure build and release pipelines are fully reproducible locally via standard scripts.',
320
+ 'Enforce clean working trees and git tag matching on release workflows.',
321
+ ],
322
+ },
323
+ },
324
+ 'dependency-management': {
325
+ id: 'dependency-management',
326
+ name: 'Dependency Management',
327
+ version: '1.0.0',
328
+ description: 'Dependency health auditing, minimal version bumping, transitive vulnerability remediation, and licensing.',
329
+ category: 'operations',
330
+ capabilities: ['audit-security', 'version-management', 'license-compliance', 'lockfile-integrity'],
331
+ requiredTools: ['get_file_context', 'execute_check'],
332
+ dependencies: [],
333
+ permissions: { readFiles: true, writeFiles: true, executeTerminal: true },
334
+ tags: ['dependencies', 'npm', 'packages', 'audit'],
335
+ isBuiltin: true,
336
+ sourceScope: 'builtin',
337
+ progressiveContent: {
338
+ summary: 'Audit, update, and constrain third-party dependencies to protect security, performance, and license compliance.',
339
+ principles: [
340
+ 'Prefer zero or minimal dependencies. The fastest, most secure code is code you do not need to import.',
341
+ 'Audit third-party licenses for compatibility before introducing dependencies into the project.',
342
+ 'Commit lockfiles (package-lock.json) and verify checksum integrity to prevent supply-chain tampering.',
343
+ ],
344
+ guidelines: [
345
+ 'Run security audits (`npm audit`) to identify known CVEs in production dependencies.',
346
+ 'Do not introduce runtime dependencies when Node.js standard library APIs suffice.',
347
+ 'Keep devDependencies segregated from production dependencies.',
348
+ ],
349
+ },
350
+ },
351
+ 'architecture-analysis': {
352
+ id: 'architecture-analysis',
353
+ name: 'Architecture Analysis',
354
+ version: '1.0.0',
355
+ description: 'Codebase boundary auditing, circular dependency detection, AST symbol topology, and modular coupling analysis.',
356
+ category: 'architecture',
357
+ capabilities: ['dependency-graphing', 'cycle-detection', 'coupling-metrics', 'modular-boundaries'],
358
+ requiredTools: ['get_project_overview', 'get_file_context', 'trace_symbol_dependencies'],
359
+ dependencies: [],
360
+ permissions: { readFiles: true },
361
+ tags: ['architecture', 'graph', 'ast', 'coupling'],
362
+ isBuiltin: true,
363
+ sourceScope: 'builtin',
364
+ progressiveContent: {
365
+ summary: 'Audit system components, data flow, and dependency topologies to maintain modular, acyclic architecture.',
366
+ principles: [
367
+ 'Enforce directional dependency rules (e.g. high-level business logic must not depend on low-level infrastructure).',
368
+ 'Eliminate circular dependencies between packages and modules.',
369
+ 'Maximize cohesion within modules while minimizing coupling across module boundaries.',
370
+ ],
371
+ guidelines: [
372
+ 'Utilize DevWorkspace AST knowledge graphs (`graphify-out/graph.json`) to trace symbol references.',
373
+ 'Identify God classes or overly large modules that accumulate disproportionate dependencies.',
374
+ 'Record structural shifts as durable decisions in the ADR log.',
375
+ ],
376
+ },
377
+ },
378
+ };
379
+ //# sourceMappingURL=builtins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../../src/intelligence/skills/builtins.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAkC;IAC3D,iBAAiB,EAAE;QACjB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,6FAA6F;QAC1G,QAAQ,EAAE,aAAa;QACvB,YAAY,EAAE,CAAC,YAAY,EAAE,kBAA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7B,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,gHAAgH;QAC7H,QAAQ,EAAE,cAAc;QACxB,YAAY,EAAE,CAAC,qBAAqB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,CAAC;QAClG,aAAa,EAAE,CAAC,sBAAsB,EAAE,kBAAkB,EAAE,2BAA2B,CAAC;QACxF,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;QAChC,IAAI,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC;QAClD,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,SAAS;QACtB,kBAAkB,EAAE;YAClB,OAAO,EAAE,0GAA0G;YACnH,UAAU,EAAE;gBACV,oHAAoH;gBACpH,+DAA+D;gBAC/D,sFAAsF;aACvF;YACD,UAAU,EAAE;gBACV,mGAAmG;gBACnG,6FAA6F;gBAC7F,+DAA+D;aAChE;SACF;KACF;CACF,CAAC","sourcesContent":["import type { SkillManifest } from './types.js';\n\nexport const BUILTIN_SKILLS: Record<string, SkillManifest> = {\n 'api-development': {\n id: 'api-development',\n name: 'API Development',\n version: '1.0.0',\n description: 'RESTful and RPC API design, request validation, structured error modeling, and idempotency.',\n category: 'development',\n capabilities: ['api-design', 'input-validation', 'http-semantics', 'idempotency'],\n requiredTools: ['get_file_context'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true },\n tags: ['api', 'rest', 'endpoints', 'schemas'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Design robust, backward-compatible endpoints with strict schema validation and predictable status codes.',\n principles: [\n 'Validate all incoming inputs at the system boundary using strict schema checkers (e.g. Zod).',\n 'Use appropriate HTTP status codes (400 bad request, 401 unauth, 403 forbidden, 404 not found, 409 conflict, 422 unprocessable).',\n 'Never return stack traces, internal database columns, or unmasked secrets in error payloads.',\n ],\n guidelines: [\n 'Ensure POST endpoints that create resources return 201 Created and Location header where appropriate.',\n 'Implement idempotency keys for sensitive non-idempotent mutation operations.',\n 'Structure JSON error responses uniformly: { error: { code, message, details } }.',\n ],\n referenceChecklist: [\n 'Inputs validated against schema before business logic executes',\n 'Authentication and authorization checks precede state mutations',\n 'Zero sensitive credentials logged or returned in response bodies',\n ],\n antiPatterns: [\n 'Returning 200 OK with an error payload in the JSON body',\n 'Relying on client-side validation alone',\n 'Leaking SQL or ORM internal error strings to consumers',\n ],\n },\n },\n\n 'database-design': {\n id: 'database-design',\n name: 'Database Design',\n version: '1.0.0',\n description: 'Relational & document schema modeling, normalization, foreign key integrity, and migration authoring.',\n category: 'architecture',\n capabilities: ['schema-modeling', 'normalization', 'migrations', 'foreign-keys'],\n requiredTools: ['get_file_context'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true },\n tags: ['sql', 'database', 'schema', 'migrations'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Model durable, normalized relational schemas with explicit constraints and reversible migrations.',\n principles: [\n 'Prefer 3rd Normal Form (3NF) for transactional operational data to eliminate update anomalies.',\n 'Enforce referential integrity using explicit foreign keys and check constraints at the database level.',\n 'All database migrations must be atomic, idempotent, and reversible (supporting up and down steps).',\n ],\n guidelines: [\n 'Index foreign key columns that participate in JOINs and filtering.',\n 'Use UTC timestamps (TIMESTAMPTZ) for all created_at and updated_at audit columns.',\n 'Avoid locking production tables during column additions by providing sensible defaults without table-rewrites.',\n ],\n referenceChecklist: [\n 'Primary keys defined for all relational tables',\n 'Migration files versioned sequentially and tested in isolation',\n 'Rollback scripts verified against existing test fixtures',\n ],\n antiPatterns: [\n 'Storing comma-separated or unvalidated stringified arrays instead of proper join tables',\n 'Creating non-reversible migrations with irreversible column drops',\n 'Omitting foreign key constraints to save indexing time',\n ],\n },\n },\n\n 'database-optimization': {\n id: 'database-optimization',\n name: 'Database Optimization',\n version: '1.0.0',\n description: 'Query tuning, index strategy, query execution plans (EXPLAIN), and N+1 query elimination.',\n category: 'performance',\n capabilities: ['query-tuning', 'indexing', 'n-plus-1-prevention', 'explain-analysis'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: ['database-design'],\n permissions: { readFiles: true, writeFiles: true, executeTerminal: true },\n tags: ['database', 'performance', 'sql', 'indexing'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Optimize database access patterns to eliminate slow queries, full table scans, and round-trip latency.',\n principles: [\n 'Always inspect EXPLAIN ANALYZE before adding indexes to prevent useless index bloat.',\n 'Batch relational loads using eager loading or dataloaders to eliminate N+1 queries.',\n 'Select only necessary columns rather than SELECT *.',\n ],\n guidelines: [\n 'Add composite indexes where queries filter on multiple columns (left-to-right prefix rule).',\n 'Use keyset pagination instead of OFFSET/LIMIT for high-volume datasets.',\n 'Set query execution timeouts to prevent runaway resource exhaustion.',\n ],\n referenceChecklist: [\n 'No N+1 loops inside iteration blocks',\n 'Indexes match high-frequency WHERE and ORDER BY clauses',\n 'Transactions kept as short as possible to avoid lock contention',\n ],\n },\n },\n\n debugging: {\n id: 'debugging',\n name: 'Debugging',\n version: '1.0.0',\n description: 'Systematic fault reproduction, binary search localization, heap/stack diagnosis, and regression tests.',\n category: 'development',\n capabilities: ['fault-reproduction', 'root-cause-analysis', 'stack-diagnosis', 'regression-testing'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true, executeTerminal: true },\n tags: ['debug', 'fix', 'regression', 'diagnosis'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Diagnose failures systematically by establishing a reproducible failing test before modifying code.',\n principles: [\n 'Never guess or apply shotgun fixes. Reproduce the bug deterministically in a minimal test case first.',\n 'Binary search through suspect code paths and recent git commits (git bisect).',\n 'Fix the root cause, not just the symptom, and verify no related invariants break.',\n ],\n guidelines: [\n 'Capture the exact input payload, environment variables, and preconditions that trigger the failure.',\n 'Verify the regression test fails with the reported defect before applying the patch.',\n 'Confirm the regression test passes after the patch without relaxing existing assertions.',\n ],\n },\n },\n\n 'test-driven-development': {\n id: 'test-driven-development',\n name: 'Test-Driven Development',\n version: '1.0.0',\n description: 'Red-Green-Refactor discipline, unit & integration test authoring, test isolation, and contract assertions.',\n category: 'testing',\n capabilities: ['unit-testing', 'test-isolation', 'mock-boundaries', 'regression-safeguards'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true, executeTerminal: true },\n tags: ['tdd', 'tests', 'unit', 'quality'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Drive software design through executable specifications, testing behavior rather than internal implementation details.',\n principles: [\n 'Red: Write a concise, failing test describing the desired behavior.',\n 'Green: Write the minimal amount of code required to make the test pass.',\n 'Refactor: Clean up structure, remove duplication, and improve readability while keeping tests green.',\n ],\n guidelines: [\n 'Keep unit tests fast, isolated, and side-effect free (use in-memory doubles for external I/O).',\n 'Assert on observable behavior and contracts rather than private member state.',\n 'Ensure each test tests exactly one logical concept with clear assertion failure messages.',\n ],\n },\n },\n\n 'code-review': {\n id: 'code-review',\n name: 'Code Review',\n version: '1.0.0',\n description: 'Static analysis checklist, readability, maintainability, architectural invariants, and smell detection.',\n category: 'development',\n capabilities: ['diff-inspection', 'smell-detection', 'convention-audit', 'clean-code'],\n requiredTools: ['get_file_context'],\n dependencies: [],\n permissions: { readFiles: true },\n tags: ['review', 'quality', 'clean-code'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Independently inspect code changes for design clarity, maintainability, edge cases, and architectural compliance.',\n principles: [\n 'Verify that changes fulfill stated requirements without introducing undocumented side-effects.',\n 'Enforce consistent naming, error handling, and separation of concerns.',\n 'Check boundary conditions: empty arrays, null/undefined, extreme numbers, concurrent mutations.',\n ],\n guidelines: [\n 'Review the git diff comprehensively before signing off on any task.',\n 'Flag unnecessary complexity or over-engineering (YAGNI).',\n 'Verify that relevant tests were updated or added to accompany the code change.',\n ],\n },\n },\n\n 'security-audit': {\n id: 'security-audit',\n name: 'Security Audit',\n version: '1.0.0',\n description: 'OWASP vulnerability identification, secret leakage prevention, input sanitization, and permission boundaries.',\n category: 'security',\n capabilities: ['vulnerability-detection', 'secret-scanning', 'input-sanitization', 'permission-validation'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: [],\n permissions: { readFiles: true, executeTerminal: true },\n tags: ['security', 'audit', 'owasp', 'cve'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Harden codebases against injection, credential leakage, path traversal, and unauthorized access.',\n principles: [\n 'Assume all external input is potentially malicious. Sanitize and validate against strict schemas.',\n 'Zero secrets in source control or persistent contexts. Verify .env and credentials remain blacklisted.',\n 'Enforce principle of least privilege across process execution, filesystem access, and API scopes.',\n ],\n guidelines: [\n 'Prevent SQL/NoSQL injection by using parameterized queries and trusted ORMs exclusively.',\n 'Block path traversal by resolving paths strictly within the designated repository root.',\n 'Run npm audit / dependency vulnerability scans as a mandatory check.',\n ],\n },\n },\n\n 'performance-optimization': {\n id: 'performance-optimization',\n name: 'Performance Optimization',\n version: '1.0.0',\n description: 'Latency profiling, algorithmic time/space complexity reduction, memory leak detection, and async tuning.',\n category: 'performance',\n capabilities: ['latency-profiling', 'memory-management', 'complexity-reduction', 'throughput-tuning'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true, executeTerminal: true },\n tags: ['performance', 'optimization', 'latency', 'profiling'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Measure and eliminate runtime bottlenecks, excessive allocations, and non-linear algorithmic complexity.',\n principles: [\n 'Measure before optimizing. Avoid premature optimization that sacrifices code clarity.',\n 'Reduce algorithmic complexity (e.g. O(N^2) to O(N) using HashMaps/Sets for lookups).',\n 'Avoid memory leaks caused by lingering event listeners, unbounded caches, or circular references.',\n ],\n guidelines: [\n 'Use stream processing for large files and payloads rather than buffering everything in memory.',\n 'Leverage asynchronous non-blocking I/O and worker threads for CPU-bound computations.',\n 'Profile CPU and memory allocation profiles under realistic workloads.',\n ],\n },\n },\n\n refactoring: {\n id: 'refactoring',\n name: 'Refactoring',\n version: '1.0.0',\n description: 'Transform internal code structure without changing external observable behavior; reduce technical debt.',\n category: 'development',\n capabilities: ['structural-cleanup', 'modularity', 'dry-principle', 'extract-functions'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: ['test-driven-development'],\n permissions: { readFiles: true, writeFiles: true, executeTerminal: true },\n tags: ['refactor', 'clean-code', 'modularity'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Improve code readability, reduce coupling, and eliminate duplication while verifying behavior remains identical.',\n principles: [\n 'Establish passing baseline tests before touching any code.',\n 'Refactor in small, verifiable micro-steps, running tests after each transformation.',\n 'Do not combine behavioral changes or feature additions with refactoring.',\n ],\n guidelines: [\n 'Extract long functions into small, cohesive, well-named functions with clear responsibilities.',\n 'Replace magic numbers and strings with well-scoped constants or enumerations.',\n 'Keep public module contracts and API signatures backward-compatible.',\n ],\n },\n },\n\n documentation: {\n id: 'documentation',\n name: 'Documentation',\n version: '1.0.0',\n description: 'Technical writing, OpenAPI documentation, code architecture references, and onboarding prompts.',\n category: 'documentation',\n capabilities: ['technical-writing', 'markdown-docs', 'api-specs', 'onboarding'],\n requiredTools: ['get_file_context'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true },\n tags: ['docs', 'writing', 'readme', 'api-docs'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Create clear, concise, accurate documentation that stays synchronized with actual codebase behavior.',\n principles: [\n 'Documentation must reflect working reality; verify commands and configuration snippets.',\n 'Write for the reader: state prerequisites, provide actionable copy-pasteable examples, explain failure modes.',\n 'Keep documentation close to code (READMEs, JSDoc, markdown guides) and update it in the same PR.',\n ],\n guidelines: [\n 'Document the WHY behind architecture decisions, not just the WHAT.',\n 'Structure technical guides with: Overview, Prerequisites, Step-by-Step, Verification, Troubleshooting.',\n 'Avoid outdated narrative documentation that drifts immediately from code.',\n ],\n },\n },\n\n 'ci-cd': {\n id: 'ci-cd',\n name: 'CI/CD & DevOps',\n version: '1.0.0',\n description: 'Continuous integration workflows, reproducible automated builds, release gates, and container checks.',\n category: 'operations',\n capabilities: ['pipeline-authoring', 'release-gating', 'reproducible-builds', 'action-automation'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true, executeTerminal: true },\n tags: ['ci', 'cd', 'devops', 'actions', 'workflows'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Automate build, test, and release verification pipelines to ensure software can be deployed reliably at any time.',\n principles: [\n 'Pipelines must be deterministic: identical commits yield identical build artifacts.',\n 'Fail fast: run fast lint and typechecks before launching expensive integration/e2e test suites.',\n 'Pin actions and dependencies to known secure versions or hashes.',\n ],\n guidelines: [\n 'Never store plaintext secrets or deployment tokens in repository files or unmasked CI outputs.',\n 'Ensure build and release pipelines are fully reproducible locally via standard scripts.',\n 'Enforce clean working trees and git tag matching on release workflows.',\n ],\n },\n },\n\n 'dependency-management': {\n id: 'dependency-management',\n name: 'Dependency Management',\n version: '1.0.0',\n description: 'Dependency health auditing, minimal version bumping, transitive vulnerability remediation, and licensing.',\n category: 'operations',\n capabilities: ['audit-security', 'version-management', 'license-compliance', 'lockfile-integrity'],\n requiredTools: ['get_file_context', 'execute_check'],\n dependencies: [],\n permissions: { readFiles: true, writeFiles: true, executeTerminal: true },\n tags: ['dependencies', 'npm', 'packages', 'audit'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Audit, update, and constrain third-party dependencies to protect security, performance, and license compliance.',\n principles: [\n 'Prefer zero or minimal dependencies. The fastest, most secure code is code you do not need to import.',\n 'Audit third-party licenses for compatibility before introducing dependencies into the project.',\n 'Commit lockfiles (package-lock.json) and verify checksum integrity to prevent supply-chain tampering.',\n ],\n guidelines: [\n 'Run security audits (`npm audit`) to identify known CVEs in production dependencies.',\n 'Do not introduce runtime dependencies when Node.js standard library APIs suffice.',\n 'Keep devDependencies segregated from production dependencies.',\n ],\n },\n },\n\n 'architecture-analysis': {\n id: 'architecture-analysis',\n name: 'Architecture Analysis',\n version: '1.0.0',\n description: 'Codebase boundary auditing, circular dependency detection, AST symbol topology, and modular coupling analysis.',\n category: 'architecture',\n capabilities: ['dependency-graphing', 'cycle-detection', 'coupling-metrics', 'modular-boundaries'],\n requiredTools: ['get_project_overview', 'get_file_context', 'trace_symbol_dependencies'],\n dependencies: [],\n permissions: { readFiles: true },\n tags: ['architecture', 'graph', 'ast', 'coupling'],\n isBuiltin: true,\n sourceScope: 'builtin',\n progressiveContent: {\n summary: 'Audit system components, data flow, and dependency topologies to maintain modular, acyclic architecture.',\n principles: [\n 'Enforce directional dependency rules (e.g. high-level business logic must not depend on low-level infrastructure).',\n 'Eliminate circular dependencies between packages and modules.',\n 'Maximize cohesion within modules while minimizing coupling across module boundaries.',\n ],\n guidelines: [\n 'Utilize DevWorkspace AST knowledge graphs (`graphify-out/graph.json`) to trace symbol references.',\n 'Identify God classes or overly large modules that accumulate disproportionate dependencies.',\n 'Record structural shifts as durable decisions in the ADR log.',\n ],\n },\n },\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import type { SkillManifest, SkillValidationResult } from './types.js';
2
+ export declare function validateSkillManifest(manifest: unknown): SkillValidationResult;
3
+ export declare function loadSkillFromFile(workspaceRoot: string, relativePath: string): Promise<SkillManifest>;
4
+ export declare function formatProgressiveSkillInstructions(skill: SkillManifest, level?: 'summary' | 'detailed' | 'full'): string;
@@ -0,0 +1,84 @@
1
+ import { promises as fs } from 'node:fs';
2
+ import { assertNoSymlinkEscape, resolveInside, toPosix } from '../../utils/paths.js';
3
+ export function validateSkillManifest(manifest) {
4
+ const errors = [];
5
+ const warnings = [];
6
+ if (typeof manifest !== 'object' || manifest === null) {
7
+ return { valid: false, errors: ['Manifest must be a non-null object.'], warnings: [] };
8
+ }
9
+ const m = manifest;
10
+ if (!m.id || typeof m.id !== 'string' || !/^[a-z0-9-_]+$/i.test(m.id)) {
11
+ errors.push('Skill id is required and must be alphanumeric with hyphens or underscores.');
12
+ }
13
+ if (!m.name || typeof m.name !== 'string' || m.name.trim().length === 0) {
14
+ errors.push('Skill name is required.');
15
+ }
16
+ if (!m.version || typeof m.version !== 'string' || !/^\d+\.\d+\.\d+/.test(m.version)) {
17
+ errors.push('Skill version must be valid semver (e.g. 1.0.0).');
18
+ }
19
+ if (!m.category || typeof m.category !== 'string') {
20
+ errors.push('Skill category is required.');
21
+ }
22
+ if (!m.progressiveContent || typeof m.progressiveContent !== 'object') {
23
+ errors.push('Skill must specify progressiveContent object.');
24
+ }
25
+ else {
26
+ if (!m.progressiveContent.summary || typeof m.progressiveContent.summary !== 'string') {
27
+ errors.push('progressiveContent.summary is required.');
28
+ }
29
+ }
30
+ return {
31
+ valid: errors.length === 0,
32
+ errors,
33
+ warnings,
34
+ };
35
+ }
36
+ export async function loadSkillFromFile(workspaceRoot, relativePath) {
37
+ const safePath = resolveInside(workspaceRoot, relativePath);
38
+ await assertNoSymlinkEscape(workspaceRoot, safePath);
39
+ const raw = await fs.readFile(safePath, 'utf8');
40
+ let parsed;
41
+ try {
42
+ parsed = JSON.parse(raw);
43
+ }
44
+ catch (err) {
45
+ throw new Error(`Failed to parse skill JSON at ${toPosix(relativePath)}: ${err.message}`, { cause: err });
46
+ }
47
+ const validation = validateSkillManifest(parsed);
48
+ if (!validation.valid) {
49
+ throw new Error(`Invalid skill manifest at ${toPosix(relativePath)}: ${validation.errors.join('; ')}`);
50
+ }
51
+ const manifest = parsed;
52
+ manifest.installedPath = toPosix(relativePath);
53
+ manifest.sourceScope = 'project';
54
+ manifest.isBuiltin = false;
55
+ return manifest;
56
+ }
57
+ export function formatProgressiveSkillInstructions(skill, level = 'summary') {
58
+ const parts = [
59
+ `### Skill: ${skill.name} (${skill.id} v${skill.version})`,
60
+ skill.progressiveContent.summary,
61
+ ];
62
+ if (level === 'detailed' || level === 'full') {
63
+ if (skill.progressiveContent.principles.length > 0) {
64
+ parts.push('**Core Principles:**');
65
+ parts.push(...skill.progressiveContent.principles.map((p) => `- ${p}`));
66
+ }
67
+ if (skill.progressiveContent.guidelines.length > 0) {
68
+ parts.push('**Execution Guidelines:**');
69
+ parts.push(...skill.progressiveContent.guidelines.map((g) => `- ${g}`));
70
+ }
71
+ }
72
+ if (level === 'full') {
73
+ if (skill.progressiveContent.referenceChecklist && skill.progressiveContent.referenceChecklist.length > 0) {
74
+ parts.push('**Verification Checklist:**');
75
+ parts.push(...skill.progressiveContent.referenceChecklist.map((c) => `- [ ] ${c}`));
76
+ }
77
+ if (skill.progressiveContent.antiPatterns && skill.progressiveContent.antiPatterns.length > 0) {
78
+ parts.push('**Anti-Patterns to Avoid:**');
79
+ parts.push(...skill.progressiveContent.antiPatterns.map((a) => `- [!] ${a}`));
80
+ }
81
+ }
82
+ return parts.join('\n');
83
+ }
84
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/intelligence/skills/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAErF,MAAM,UAAU,qBAAqB,CAAC,QAAiB;IACrD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,qCAAqC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzF,CAAC;IAED,MAAM,CAAC,GAAG,QAAkC,CAAC;IAE7C,IAAI,CAAC,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,CAAC;YAC9F,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport type { SkillManifest, SkillValidationResult } from './types.js';\nimport { assertNoSymlinkEscape, resolveInside, toPosix } from '../../utils/paths.js';\n\nexport function validateSkillManifest(manifest: unknown): SkillValidationResult {\n const errors: string[] = [];\n const warnings: string[] = [];\n\n if (typeof manifest !== 'object' || manifest === null) {\n return { valid: false, errors: ['Manifest must be a non-null object.'], warnings: [] };\n }\n\n const m = manifest as Partial<SkillManifest>;\n\n if (!m.id || typeof m.id !== 'string' || !/^[a-z0-9-_]+$/i.test(m.id)) {\n errors.push('Skill id is required and must be alphanumeric with hyphens or underscores.');\n }\n\n if (!m.name || typeof m.name !== 'string' || m.name.trim().length === 0) {\n errors.push('Skill name is required.');\n }\n\n if (!m.version || typeof m.version !== 'string' || !/^\\d+\\.\\d+\\.\\d+/.test(m.version)) {\n errors.push('Skill version must be valid semver (e.g. 1.0.0).');\n }\n\n if (!m.category || typeof m.category !== 'string') {\n errors.push('Skill category is required.');\n }\n\n if (!m.progressiveContent || typeof m.progressiveContent !== 'object') {\n errors.push('Skill must specify progressiveContent object.');\n } else {\n if (!m.progressiveContent.summary || typeof m.progressiveContent.summary !== 'string') {\n errors.push('progressiveContent.summary is required.');\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n warnings,\n };\n}\n\nexport async function loadSkillFromFile(workspaceRoot: string, relativePath: string): Promise<SkillManifest> {\n const safePath = resolveInside(workspaceRoot, relativePath);\n await assertNoSymlinkEscape(workspaceRoot, safePath);\n\n const raw = await fs.readFile(safePath, 'utf8');\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (err: any) {\n throw new Error(`Failed to parse skill JSON at ${toPosix(relativePath)}: ${err.message}`, { cause: err });\n }\n\n const validation = validateSkillManifest(parsed);\n if (!validation.valid) {\n throw new Error(`Invalid skill manifest at ${toPosix(relativePath)}: ${validation.errors.join('; ')}`);\n }\n\n const manifest = parsed as SkillManifest;\n manifest.installedPath = toPosix(relativePath);\n manifest.sourceScope = 'project';\n manifest.isBuiltin = false;\n return manifest;\n}\n\nexport function formatProgressiveSkillInstructions(skill: SkillManifest, level: 'summary' | 'detailed' | 'full' = 'summary'): string {\n const parts: string[] = [\n `### Skill: ${skill.name} (${skill.id} v${skill.version})`,\n skill.progressiveContent.summary,\n ];\n\n if (level === 'detailed' || level === 'full') {\n if (skill.progressiveContent.principles.length > 0) {\n parts.push('**Core Principles:**');\n parts.push(...skill.progressiveContent.principles.map((p) => `- ${p}`));\n }\n if (skill.progressiveContent.guidelines.length > 0) {\n parts.push('**Execution Guidelines:**');\n parts.push(...skill.progressiveContent.guidelines.map((g) => `- ${g}`));\n }\n }\n\n if (level === 'full') {\n if (skill.progressiveContent.referenceChecklist && skill.progressiveContent.referenceChecklist.length > 0) {\n parts.push('**Verification Checklist:**');\n parts.push(...skill.progressiveContent.referenceChecklist.map((c) => `- [ ] ${c}`));\n }\n if (skill.progressiveContent.antiPatterns && skill.progressiveContent.antiPatterns.length > 0) {\n parts.push('**Anti-Patterns to Avoid:**');\n parts.push(...skill.progressiveContent.antiPatterns.map((a) => `- [!] ${a}`));\n }\n }\n\n return parts.join('\\n');\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { SkillManifest, SkillValidationResult } from './types.js';
2
+ export declare class SkillRegistry {
3
+ private workspaceRoot;
4
+ constructor(workspaceRoot: string);
5
+ private projectSkillsPath;
6
+ loadProjectSkills(): Promise<Record<string, SkillManifest>>;
7
+ listAllSkills(): Promise<SkillManifest[]>;
8
+ getSkill(id: string): Promise<SkillManifest | null>;
9
+ searchSkills(query: string): Promise<SkillManifest[]>;
10
+ installSkill(manifest: SkillManifest): Promise<SkillManifest>;
11
+ removeSkill(id: string): Promise<boolean>;
12
+ findSkillsByCapability(capability: string): Promise<SkillManifest[]>;
13
+ formatSkillInstructions(skillIds: string[]): Promise<string>;
14
+ validate(manifest: unknown): SkillValidationResult;
15
+ }