@luanpdd/kit-mcp 1.34.0 → 1.36.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 (118) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +2 -2
  3. package/bin/mcp.js +6 -6
  4. package/bin/ui.js +74 -74
  5. package/gates/ai-prompt-stability.md +120 -120
  6. package/gates/budget-description.md +68 -68
  7. package/gates/confidence.md +29 -29
  8. package/gates/dependency-check.md +33 -33
  9. package/gates/dept-cycle-prevention.md +179 -179
  10. package/gates/golden-signals-coverage.md +133 -133
  11. package/gates/legacy-refactor-safety.md +178 -178
  12. package/gates/multi-tenant-rls-coverage.md +102 -102
  13. package/gates/no-personal-uuid.md +72 -72
  14. package/gates/obs-agents-mcp-supabase.md +86 -86
  15. package/gates/obs-skills-frontmatter.md +76 -76
  16. package/gates/observability-coverage.md +151 -151
  17. package/gates/omm-no-regression.md +83 -83
  18. package/gates/postmortem-template-required.md +127 -127
  19. package/gates/prr-checklist-coverage.md +128 -128
  20. package/gates/regression.md +32 -32
  21. package/gates/release-pipeline-policy.md +132 -132
  22. package/gates/secrets-scan.md +33 -33
  23. package/gates/service-role-not-in-user-facing.md +113 -113
  24. package/gates/skill-must-include.md +71 -71
  25. package/gates/sync-idempotent.md +62 -62
  26. package/gates/verify-phase-goal.md +34 -34
  27. package/kit/agents/designer-ui.md +216 -216
  28. package/kit/agents/workflow-generator.md +537 -0
  29. package/kit/commands/adicionar-backlog.md +1 -1
  30. package/kit/commands/adicionar-fase.md +1 -1
  31. package/kit/commands/adicionar-tarefa.md +1 -1
  32. package/kit/commands/auditar-observabilidade.md +103 -103
  33. package/kit/commands/auditar-toil.md +129 -129
  34. package/kit/commands/caracterizar-prompt.md +195 -195
  35. package/kit/commands/criar-workflow.md +158 -0
  36. package/kit/commands/definir-perfil.md +1 -1
  37. package/kit/commands/definir-slo.md +108 -108
  38. package/kit/commands/fio.md +1 -1
  39. package/kit/commands/golden-signals.md +142 -142
  40. package/kit/commands/instrumentar-fase.md +200 -200
  41. package/kit/commands/investigar-producao.md +162 -162
  42. package/kit/commands/observabilidade.md +118 -118
  43. package/kit/commands/postmortem.md +179 -179
  44. package/kit/commands/prr.md +205 -205
  45. package/kit/commands/publicar-rapido.md +207 -207
  46. package/kit/commands/risk-budget.md +220 -220
  47. package/kit/commands/sre.md +230 -230
  48. package/kit/file-manifest.json +5 -2
  49. package/kit/framework/references/output-style.md +22 -22
  50. package/kit/hooks/post-apply-migration.js +199 -199
  51. package/kit/hooks/sidecar-tool-publisher.js +210 -210
  52. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
  53. package/kit/skills/_shared-legacy/glossary.md +389 -389
  54. package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
  55. package/kit/skills/_shared-observability/glossary.md +396 -396
  56. package/kit/skills/_shared-sre/glossary.md +712 -712
  57. package/kit/skills/_shared-supabase/glossary.md +234 -234
  58. package/kit/skills/blameless-postmortems/SKILL.md +340 -340
  59. package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
  60. package/kit/skills/cascading-failures/SKILL.md +311 -311
  61. package/kit/skills/core-analysis-loop/SKILL.md +352 -352
  62. package/kit/skills/distributed-tracing/SKILL.md +362 -362
  63. package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -0
  64. package/kit/skills/eliminating-toil/SKILL.md +243 -243
  65. package/kit/skills/event-based-slos/SKILL.md +296 -296
  66. package/kit/skills/four-golden-signals/SKILL.md +314 -314
  67. package/kit/skills/hermetic-builds/SKILL.md +323 -323
  68. package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
  69. package/kit/skills/llm-as-dependency/SKILL.md +436 -436
  70. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
  71. package/kit/skills/observability-driven-development/SKILL.md +315 -315
  72. package/kit/skills/observability-maturity-model/SKILL.md +222 -222
  73. package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
  74. package/kit/skills/production-readiness-review/SKILL.md +305 -305
  75. package/kit/skills/release-engineering/SKILL.md +367 -367
  76. package/kit/skills/retry-strategies/SKILL.md +372 -372
  77. package/kit/skills/sre-risk-management/SKILL.md +221 -221
  78. package/kit/skills/structured-events/SKILL.md +265 -265
  79. package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
  80. package/kit/skills/supabase-database-functions/SKILL.md +332 -332
  81. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
  82. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
  83. package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
  84. package/kit/skills/supabase-storage/SKILL.md +234 -234
  85. package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
  86. package/kit/skills/telemetry-sampling/SKILL.md +256 -256
  87. package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
  88. package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
  89. package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
  90. package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
  91. package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
  92. package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
  93. package/kit/skills/ui-tipografia/SKILL.md +211 -211
  94. package/package.json +1 -1
  95. package/src/cli/index.js +1114 -1114
  96. package/src/cli/render.js +194 -194
  97. package/src/cli/upgrade-check.js +135 -135
  98. package/src/core/error-redaction.js +76 -76
  99. package/src/core/failures.js +153 -153
  100. package/src/core/gate-runner.js +205 -205
  101. package/src/core/gates.js +82 -82
  102. package/src/core/logger.js +170 -170
  103. package/src/core/manifest-verify.js +174 -174
  104. package/src/core/metrics.js +268 -268
  105. package/src/core/notify.js +60 -60
  106. package/src/core/path-safety.js +141 -141
  107. package/src/core/replays.js +120 -120
  108. package/src/core/ui.js +185 -185
  109. package/src/mcp-server/install.js +149 -149
  110. package/src/mcp-server/roots.js +124 -124
  111. package/src/ui/auto-spawn.js +113 -113
  112. package/src/ui/browser.js +78 -78
  113. package/src/ui/client.js +130 -130
  114. package/src/ui/events.js +65 -65
  115. package/src/ui/lockfile.js +191 -191
  116. package/src/ui/port.js +67 -67
  117. package/src/ui/server.js +547 -547
  118. package/src/ui/wrapper.js +129 -129
package/src/ui/wrapper.js CHANGED
@@ -1,129 +1,129 @@
1
- // src/ui/wrapper.js
2
- // Wrap an existing onProgress callback so that calls also publish to the sidecar.
3
- // Used at callsites (CLI handlers, MCP tool handlers) — NEVER imported by core
4
- // (`syncTo`, `applyReverse`). The Stable API of core stays untouched (REQ).
5
- //
6
- // Also exports redactPath: a helper that scrubs the user's $HOME and the project
7
- // root from any string before it leaves this process. Applied uniformly here so
8
- // that path-leak protection is centralized (REQ SEC-05).
9
-
10
- import os from 'node:os';
11
- import path from 'node:path';
12
- import { publish } from './client.js';
13
- import { makeEvent, newRunId } from './events.js';
14
-
15
- // Convert any value into a payload-safe shape with paths redacted.
16
- // We touch strings only — numbers/booleans/null pass through. Nested objects
17
- // and arrays are walked.
18
- const HOME = os.homedir() || '';
19
-
20
- function escapeForReplace(s) {
21
- return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22
- }
23
-
24
- // SEC-03: Match Windows-style paths (backslash) AND POSIX-style (forward slash)
25
- // AND case variants on case-insensitive filesystems. We swap each separator for
26
- // a placeholder, then regex-escape the rest, then put back a char class that
27
- // matches either separator. 'i' flag handles case-insensitive Windows drives.
28
- const PATH_SEP_PLACEHOLDER = 'KMSEP';
29
- function buildPathRegex(rawPath) {
30
- const withPlaceholders = rawPath.replace(/[\\/]+/g, PATH_SEP_PLACEHOLDER);
31
- const escaped = escapeForReplace(withPlaceholders);
32
- const flexible = escaped.split(PATH_SEP_PLACEHOLDER).join('[\\\\/]+');
33
- return new RegExp(flexible, 'gi');
34
- }
35
-
36
- export function redactPath(value, projectRoot) {
37
- if (typeof value === 'string') {
38
- let out = value;
39
- if (projectRoot) {
40
- out = out.replace(buildPathRegex(projectRoot), '<project>');
41
- }
42
- if (HOME) {
43
- out = out.replace(buildPathRegex(HOME), '~');
44
- }
45
- return out;
46
- }
47
- if (Array.isArray(value)) {
48
- return value.map((v) => redactPath(v, projectRoot));
49
- }
50
- if (value && typeof value === 'object') {
51
- const out = {};
52
- for (const k of Object.keys(value)) {
53
- out[k] = redactPath(value[k], projectRoot);
54
- }
55
- return out;
56
- }
57
- return value;
58
- }
59
-
60
- // wrapProgressForUi(originalCb, ctx) returns a function with the same signature
61
- // as the existing onProgress callback. Calls originalCb (terminal output) AND
62
- // publishes to the sidecar. The sidecar publish is fire-and-forget; the wrapped
63
- // callback never throws even if the sidecar isn't running.
64
- //
65
- // ctx: { projectRoot, runId?, tool? }
66
- // - projectRoot — required for redaction + lockfile resolution
67
- // - runId — defaults to a fresh runId per wrapper instance
68
- // - tool — short label (e.g. 'sync', 'reverse-sync', 'gates') for grouping
69
- export function wrapProgressForUi(originalCb, ctx) {
70
- if (typeof originalCb !== 'function' && originalCb != null) {
71
- throw new TypeError('originalCb must be a function or null/undefined');
72
- }
73
- if (!ctx || typeof ctx.projectRoot !== 'string') {
74
- throw new TypeError('wrapProgressForUi requires ctx.projectRoot: string');
75
- }
76
- const projectRoot = ctx.projectRoot;
77
- const runId = ctx.runId ?? newRunId();
78
- const tool = ctx.tool ?? null;
79
-
80
- // Best-effort fire-and-forget. We deliberately swallow errors — the wrapper
81
- // must never break the caller because the optional UI isn't up.
82
- function emit(event) {
83
- publish(event, { projectRoot }).catch(() => { /* noop */ });
84
- }
85
-
86
- // Emit a run.start as soon as the wrapper is created. Caller can also emit
87
- // run.end manually (or use the `done` helper below).
88
- emit(makeEvent({
89
- type: 'run.start',
90
- runId,
91
- payload: redactPath({ tool, projectRoot, ts: Date.now() }, projectRoot),
92
- }));
93
-
94
- function wrapped(progress) {
95
- // Forward to the original callback first — if the user supplied none, skip.
96
- if (typeof originalCb === 'function') {
97
- try { originalCb(progress); } catch { /* surface from caller, not us */ }
98
- }
99
- // Convert the canonical onProgress shape ({percent, label, kind}) into a
100
- // sidecar 'progress' event. Pass extra fields through unchanged (redacted).
101
- const safe = redactPath({ tool, ...progress }, projectRoot);
102
- emit(makeEvent({ type: 'progress', runId, payload: safe }));
103
- }
104
-
105
- // Helpers for the caller — not strictly part of the onProgress signature, so
106
- // we attach them as properties.
107
- wrapped.runId = runId;
108
- wrapped.emit = (type, payload) => emit(makeEvent({
109
- type,
110
- runId,
111
- payload: redactPath(payload, projectRoot),
112
- }));
113
- wrapped.done = (payload = {}) => emit(makeEvent({
114
- type: 'run.end',
115
- runId,
116
- payload: redactPath({ tool, ...payload }, projectRoot),
117
- }));
118
- wrapped.error = (err) => emit(makeEvent({
119
- type: 'error',
120
- runId,
121
- payload: redactPath({
122
- tool,
123
- message: err?.message ?? String(err),
124
- code: err?.code ?? null,
125
- }, projectRoot),
126
- }));
127
-
128
- return wrapped;
129
- }
1
+ // src/ui/wrapper.js
2
+ // Wrap an existing onProgress callback so that calls also publish to the sidecar.
3
+ // Used at callsites (CLI handlers, MCP tool handlers) — NEVER imported by core
4
+ // (`syncTo`, `applyReverse`). The Stable API of core stays untouched (REQ).
5
+ //
6
+ // Also exports redactPath: a helper that scrubs the user's $HOME and the project
7
+ // root from any string before it leaves this process. Applied uniformly here so
8
+ // that path-leak protection is centralized (REQ SEC-05).
9
+
10
+ import os from 'node:os';
11
+ import path from 'node:path';
12
+ import { publish } from './client.js';
13
+ import { makeEvent, newRunId } from './events.js';
14
+
15
+ // Convert any value into a payload-safe shape with paths redacted.
16
+ // We touch strings only — numbers/booleans/null pass through. Nested objects
17
+ // and arrays are walked.
18
+ const HOME = os.homedir() || '';
19
+
20
+ function escapeForReplace(s) {
21
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22
+ }
23
+
24
+ // SEC-03: Match Windows-style paths (backslash) AND POSIX-style (forward slash)
25
+ // AND case variants on case-insensitive filesystems. We swap each separator for
26
+ // a placeholder, then regex-escape the rest, then put back a char class that
27
+ // matches either separator. 'i' flag handles case-insensitive Windows drives.
28
+ const PATH_SEP_PLACEHOLDER = 'KMSEP';
29
+ function buildPathRegex(rawPath) {
30
+ const withPlaceholders = rawPath.replace(/[\\/]+/g, PATH_SEP_PLACEHOLDER);
31
+ const escaped = escapeForReplace(withPlaceholders);
32
+ const flexible = escaped.split(PATH_SEP_PLACEHOLDER).join('[\\\\/]+');
33
+ return new RegExp(flexible, 'gi');
34
+ }
35
+
36
+ export function redactPath(value, projectRoot) {
37
+ if (typeof value === 'string') {
38
+ let out = value;
39
+ if (projectRoot) {
40
+ out = out.replace(buildPathRegex(projectRoot), '<project>');
41
+ }
42
+ if (HOME) {
43
+ out = out.replace(buildPathRegex(HOME), '~');
44
+ }
45
+ return out;
46
+ }
47
+ if (Array.isArray(value)) {
48
+ return value.map((v) => redactPath(v, projectRoot));
49
+ }
50
+ if (value && typeof value === 'object') {
51
+ const out = {};
52
+ for (const k of Object.keys(value)) {
53
+ out[k] = redactPath(value[k], projectRoot);
54
+ }
55
+ return out;
56
+ }
57
+ return value;
58
+ }
59
+
60
+ // wrapProgressForUi(originalCb, ctx) returns a function with the same signature
61
+ // as the existing onProgress callback. Calls originalCb (terminal output) AND
62
+ // publishes to the sidecar. The sidecar publish is fire-and-forget; the wrapped
63
+ // callback never throws even if the sidecar isn't running.
64
+ //
65
+ // ctx: { projectRoot, runId?, tool? }
66
+ // - projectRoot — required for redaction + lockfile resolution
67
+ // - runId — defaults to a fresh runId per wrapper instance
68
+ // - tool — short label (e.g. 'sync', 'reverse-sync', 'gates') for grouping
69
+ export function wrapProgressForUi(originalCb, ctx) {
70
+ if (typeof originalCb !== 'function' && originalCb != null) {
71
+ throw new TypeError('originalCb must be a function or null/undefined');
72
+ }
73
+ if (!ctx || typeof ctx.projectRoot !== 'string') {
74
+ throw new TypeError('wrapProgressForUi requires ctx.projectRoot: string');
75
+ }
76
+ const projectRoot = ctx.projectRoot;
77
+ const runId = ctx.runId ?? newRunId();
78
+ const tool = ctx.tool ?? null;
79
+
80
+ // Best-effort fire-and-forget. We deliberately swallow errors — the wrapper
81
+ // must never break the caller because the optional UI isn't up.
82
+ function emit(event) {
83
+ publish(event, { projectRoot }).catch(() => { /* noop */ });
84
+ }
85
+
86
+ // Emit a run.start as soon as the wrapper is created. Caller can also emit
87
+ // run.end manually (or use the `done` helper below).
88
+ emit(makeEvent({
89
+ type: 'run.start',
90
+ runId,
91
+ payload: redactPath({ tool, projectRoot, ts: Date.now() }, projectRoot),
92
+ }));
93
+
94
+ function wrapped(progress) {
95
+ // Forward to the original callback first — if the user supplied none, skip.
96
+ if (typeof originalCb === 'function') {
97
+ try { originalCb(progress); } catch { /* surface from caller, not us */ }
98
+ }
99
+ // Convert the canonical onProgress shape ({percent, label, kind}) into a
100
+ // sidecar 'progress' event. Pass extra fields through unchanged (redacted).
101
+ const safe = redactPath({ tool, ...progress }, projectRoot);
102
+ emit(makeEvent({ type: 'progress', runId, payload: safe }));
103
+ }
104
+
105
+ // Helpers for the caller — not strictly part of the onProgress signature, so
106
+ // we attach them as properties.
107
+ wrapped.runId = runId;
108
+ wrapped.emit = (type, payload) => emit(makeEvent({
109
+ type,
110
+ runId,
111
+ payload: redactPath(payload, projectRoot),
112
+ }));
113
+ wrapped.done = (payload = {}) => emit(makeEvent({
114
+ type: 'run.end',
115
+ runId,
116
+ payload: redactPath({ tool, ...payload }, projectRoot),
117
+ }));
118
+ wrapped.error = (err) => emit(makeEvent({
119
+ type: 'error',
120
+ runId,
121
+ payload: redactPath({
122
+ tool,
123
+ message: err?.message ?? String(err),
124
+ code: err?.code ?? null,
125
+ }, projectRoot),
126
+ }));
127
+
128
+ return wrapped;
129
+ }