@codeam/shared 2.61.26 → 2.61.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +145 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +145 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1022,7 +1022,7 @@ function getIntegrationBranding(id) {
|
|
|
1022
1022
|
return INTEGRATION_BRANDING[id] ?? null;
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
|
-
// src/skills/
|
|
1025
|
+
// src/skills/code-review.ts
|
|
1026
1026
|
var CODE_REVIEW_BODY = `Use this skill when reviewing a pull request. It defines what a high-signal
|
|
1027
1027
|
review looks like so your inline comments are worth the author's time.
|
|
1028
1028
|
|
|
@@ -1055,6 +1055,18 @@ line, each led by a severity tag (blocker/should-fix/nit) and a concrete reason
|
|
|
1055
1055
|
(the failure scenario or risk), not a restatement of the diff. If the change is
|
|
1056
1056
|
correct and well-tested, approve and say so \u2014 finding nothing is a valid outcome.
|
|
1057
1057
|
Review only the diff and its direct blast radius; do not demand unrelated refactors.`;
|
|
1058
|
+
var codeReviewSkill = {
|
|
1059
|
+
id: "code-review",
|
|
1060
|
+
name: "Code Review",
|
|
1061
|
+
description: `High-signal PR review: prioritize correctness \u2192 security \u2192 tests \u2192 clarity, one anchored finding per comment.`,
|
|
1062
|
+
source: "curated",
|
|
1063
|
+
delivery: {
|
|
1064
|
+
skillFile: { body: CODE_REVIEW_BODY },
|
|
1065
|
+
instruction: { body: CODE_REVIEW_INSTRUCTION }
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
// src/skills/resolve-conflicts.ts
|
|
1058
1070
|
var RESOLVE_CONFLICTS_BODY = `Use this skill when resolving merge conflicts on a pull request. The goal is a
|
|
1059
1071
|
merge that preserves BOTH sides' intent, not one that just makes the file compile.
|
|
1060
1072
|
|
|
@@ -1078,28 +1090,134 @@ and prefer a union of intents; drop a side only when the two are mutually exclus
|
|
|
1078
1090
|
keeping the side that matches the PR's purpose. Leave no conflict markers behind
|
|
1079
1091
|
(grep for them). Regenerate lockfiles rather than hand-merging them. The result must
|
|
1080
1092
|
build and pass tests \u2014 run them \u2014 before you commit and push.`;
|
|
1081
|
-
var
|
|
1082
|
-
"
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
instruction: { body: CODE_REVIEW_INSTRUCTION }
|
|
1090
|
-
}
|
|
1091
|
-
},
|
|
1092
|
-
"resolve-conflicts": {
|
|
1093
|
-
id: "resolve-conflicts",
|
|
1094
|
-
name: "Resolve Conflicts",
|
|
1095
|
-
description: `Merge-conflict resolution that preserves both sides' intent, leaves no markers, and keeps the build green.`,
|
|
1096
|
-
source: "curated",
|
|
1097
|
-
delivery: {
|
|
1098
|
-
skillFile: { body: RESOLVE_CONFLICTS_BODY },
|
|
1099
|
-
instruction: { body: RESOLVE_CONFLICTS_INSTRUCTION }
|
|
1100
|
-
}
|
|
1093
|
+
var resolveConflictsSkill = {
|
|
1094
|
+
id: "resolve-conflicts",
|
|
1095
|
+
name: "Resolve Conflicts",
|
|
1096
|
+
description: `Merge-conflict resolution that preserves both sides' intent, leaves no markers, and keeps the build green.`,
|
|
1097
|
+
source: "curated",
|
|
1098
|
+
delivery: {
|
|
1099
|
+
skillFile: { body: RESOLVE_CONFLICTS_BODY },
|
|
1100
|
+
instruction: { body: RESOLVE_CONFLICTS_INSTRUCTION }
|
|
1101
1101
|
}
|
|
1102
1102
|
};
|
|
1103
|
+
|
|
1104
|
+
// src/skills/spec-driven-development.ts
|
|
1105
|
+
var SPEC_DRIVEN_BODY = `Use this skill for any coding task that isn't a trivial one-liner. Build the right
|
|
1106
|
+
thing, provably, with the least ceremony the task warrants \u2014 specification before
|
|
1107
|
+
code, but its depth scales to the work. Skipping it yields code that looks right yet
|
|
1108
|
+
solves the wrong problem or breaks something you never checked.
|
|
1109
|
+
|
|
1110
|
+
## Step 0 \u2014 Right-size the work (always first)
|
|
1111
|
+
- **Quick** \u2014 a typo, copy tweak, one-line fix, a single file with no unknowns.
|
|
1112
|
+
No ceremony: make the change, run the relevant test/build, confirm it. Do NOT
|
|
1113
|
+
write a spec for a typo.
|
|
1114
|
+
- **Standard** \u2014 a feature or fix across a few files, some unknowns, a testable
|
|
1115
|
+
outcome. A light inline pass (a 2-3 sentence spec + a short plan), then build
|
|
1116
|
+
test-first, then verify. No scaffolding files.
|
|
1117
|
+
- **Deep** \u2014 large, ambiguous, risky, or touching many files / shared contracts /
|
|
1118
|
+
data / auth. The full flow below, tracking the work in beads (\`bd\`), not scratch
|
|
1119
|
+
files.
|
|
1120
|
+
When unsure, start one level lighter and escalate the moment real ambiguity or risk
|
|
1121
|
+
appears. State which level you picked in one line.
|
|
1122
|
+
|
|
1123
|
+
## Step 1 \u2014 Ground in the real codebase (before specifying anything non-trivial)
|
|
1124
|
+
You are almost never in a greenfield. Before you spec or plan, survey the real code:
|
|
1125
|
+
the existing patterns for this kind of change, the files you'll touch, the test
|
|
1126
|
+
setup, prior art, and the constraints (auth, data, shared types, CLAUDE.md
|
|
1127
|
+
conventions). A spec written in a vacuum produces a plan that fights the codebase.
|
|
1128
|
+
Read first; never assume.
|
|
1129
|
+
|
|
1130
|
+
## Step 2 \u2014 Specify: the WHAT and WHY (not the HOW)
|
|
1131
|
+
State the user-visible outcome and why it matters, then the acceptance criteria \u2014
|
|
1132
|
+
each concrete and testable ("tapping X shows Y", "the endpoint returns 409 when Z"),
|
|
1133
|
+
never vague ("works well"). List what is out of scope. Put NO implementation detail
|
|
1134
|
+
here (no file names, no libraries). If a requirement is ambiguous, mark it rather
|
|
1135
|
+
than guess.
|
|
1136
|
+
|
|
1137
|
+
## Step 3 \u2014 Clarify: resolve ambiguity, but don't stall
|
|
1138
|
+
Gather the ambiguities that would actually change what you build. Ask the
|
|
1139
|
+
highest-leverage ones \u2014 batched, at most ~3, phrased as concrete choices. For
|
|
1140
|
+
low-stakes unknowns, pick a sensible default and SAY so ("assuming X unless you tell
|
|
1141
|
+
me otherwise") instead of asking. On a conversational/mobile client every round-trip
|
|
1142
|
+
is expensive \u2014 don't pester; decide what you safely can.
|
|
1143
|
+
|
|
1144
|
+
## Step 4 \u2014 Plan: the HOW, grounded and simple
|
|
1145
|
+
Design against the real code. Apply the simplicity gates before committing:
|
|
1146
|
+
- **Fewest moving parts** that satisfy the criteria. If you add a layer or
|
|
1147
|
+
abstraction, justify it or drop it.
|
|
1148
|
+
- **Use the framework/library directly** \u2014 don't wrap it for flexibility you don't
|
|
1149
|
+
need yet.
|
|
1150
|
+
- **Minimal blast radius** \u2014 touch what the change needs, nothing more.
|
|
1151
|
+
State the test strategy (what proves each criterion) and name the real risks. Keep
|
|
1152
|
+
the plan short.
|
|
1153
|
+
|
|
1154
|
+
## Step 5 \u2014 Tasks: small, verifiable, ordered
|
|
1155
|
+
Split the plan into tasks that each end in something you can run and check. Mark
|
|
1156
|
+
independent ones as parallelizable. Each task is the smallest unit worth its own
|
|
1157
|
+
check. Sequence by dependency.
|
|
1158
|
+
|
|
1159
|
+
## Step 6 \u2014 Implement: test-first by default
|
|
1160
|
+
For each task: write the test that would fail without the change, watch it fail, make
|
|
1161
|
+
it pass, keep it green. Follow the patterns you found in Step 1. Commit in logical
|
|
1162
|
+
units. Escape hatch: for a genuine spike or exploratory UI where test-first is
|
|
1163
|
+
impractical, say so explicitly and add the test right after \u2014 never skip it silently.
|
|
1164
|
+
|
|
1165
|
+
## Step 7 \u2014 Verify + self-review (what separates "done" from "looks done")
|
|
1166
|
+
Return to the acceptance criteria and prove EACH one is met \u2014 run the tests, diff the
|
|
1167
|
+
behavior, look at the real output. Then review your own work adversarially:
|
|
1168
|
+
- What did I NOT test?
|
|
1169
|
+
- What did I change that I didn't need to?
|
|
1170
|
+
- What could this have broken (the blast radius)?
|
|
1171
|
+
- Does anything contradict the spec?
|
|
1172
|
+
Fix what you find before declaring done. "The tests I wrote pass" is not "it works".
|
|
1173
|
+
|
|
1174
|
+
## Step 8 \u2014 Done + handoff
|
|
1175
|
+
Done means acceptance criteria met, tests green, no known regressions. Summarize what
|
|
1176
|
+
changed in plain terms. File any deferred work or follow-ups to beads (\`bd\`) so
|
|
1177
|
+
nothing is lost. Never claim done on unverified work.
|
|
1178
|
+
|
|
1179
|
+
## Principles (the constitution)
|
|
1180
|
+
- Clarify before you build; verify before you call it done.
|
|
1181
|
+
- Testable beats descriptive \u2014 a criterion you can't check isn't one.
|
|
1182
|
+
- Grounded beats greenfield \u2014 fit the codebase that exists.
|
|
1183
|
+
- Simple beats clever \u2014 the least structure that works.
|
|
1184
|
+
- Scale the process to the task \u2014 ceremony on a typo is a bug.
|
|
1185
|
+
- Real work goes to beads, not throwaway files in someone's repo.`;
|
|
1186
|
+
var SPEC_DRIVEN_INSTRUCTION = `Follow spec-driven development, scaled to the task:
|
|
1187
|
+
1. Right-size first. A trivial change (typo, one file, no unknowns) \u2192 just make it
|
|
1188
|
+
well and verify, no ceremony. A feature/ambiguous/risky change \u2192 spec \u2192 plan \u2192
|
|
1189
|
+
build \u2192 verify.
|
|
1190
|
+
2. Ground in the real codebase before planning \u2014 read the existing patterns, tests,
|
|
1191
|
+
and constraints. Never assume; read first.
|
|
1192
|
+
3. Specify the WHAT and WHY as testable acceptance criteria, not the HOW. Mark
|
|
1193
|
+
ambiguities instead of guessing.
|
|
1194
|
+
4. Clarify only the highest-leverage unknowns (batch <=3, concrete choices); default
|
|
1195
|
+
the low-stakes ones and say so. Don't stall on round-trips.
|
|
1196
|
+
5. Plan the simplest approach that fits the code: fewest moving parts, use libraries
|
|
1197
|
+
directly, minimal blast radius. State how each criterion will be tested.
|
|
1198
|
+
6. Implement test-first by default; follow existing patterns; commit in logical units.
|
|
1199
|
+
7. Verify EACH acceptance criterion (run tests, diff behavior), then self-review
|
|
1200
|
+
adversarially: what's untested? what did I change needlessly? what could I have
|
|
1201
|
+
broken? what contradicts the spec? Fix before declaring done.
|
|
1202
|
+
8. Track deferred work in beads (bd), not scratch files. Simple beats clever; verify
|
|
1203
|
+
before done.`;
|
|
1204
|
+
var specDrivenDevelopmentSkill = {
|
|
1205
|
+
id: "spec-driven-development",
|
|
1206
|
+
name: "Spec-Driven Development",
|
|
1207
|
+
description: `Spec-driven development scaled to the task: right-size, ground in the code, write testable acceptance criteria, plan simply, build test-first, and verify every criterion before done.`,
|
|
1208
|
+
source: "curated",
|
|
1209
|
+
delivery: {
|
|
1210
|
+
skillFile: { body: SPEC_DRIVEN_BODY },
|
|
1211
|
+
instruction: { body: SPEC_DRIVEN_INSTRUCTION }
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1215
|
+
// src/skills/registry.ts
|
|
1216
|
+
var SKILL_REGISTRY = {
|
|
1217
|
+
"code-review": codeReviewSkill,
|
|
1218
|
+
"resolve-conflicts": resolveConflictsSkill,
|
|
1219
|
+
"spec-driven-development": specDrivenDevelopmentSkill
|
|
1220
|
+
};
|
|
1103
1221
|
function isSkillId(id) {
|
|
1104
1222
|
return Object.prototype.hasOwnProperty.call(SKILL_REGISTRY, id);
|
|
1105
1223
|
}
|
|
@@ -1247,7 +1365,12 @@ var USER_EVENTS = {
|
|
|
1247
1365
|
// VCS / PR Command Center — the backend publishes this after an agent finishes
|
|
1248
1366
|
// reviewing a PR (verdict + comment count + findings), driving the mobile
|
|
1249
1367
|
// completion screen + push. Mirrored in repo A's app-shared events.ts.
|
|
1250
|
-
VCS_AGENT_REVIEW_COMPLETE: "vcs_agent_review_complete"
|
|
1368
|
+
VCS_AGENT_REVIEW_COMPLETE: "vcs_agent_review_complete",
|
|
1369
|
+
/** PR-review launch progress toast — the "Review with an agent" flow shows a
|
|
1370
|
+
* toast when the review runs server-side (Inngest). Mobile-only surface,
|
|
1371
|
+
* produced by api-v2 (the CLI neither produces nor consumes it). Mirrored in
|
|
1372
|
+
* repo A. */
|
|
1373
|
+
PR_REVIEW_LAUNCH: "pr_review_launch"
|
|
1251
1374
|
};
|
|
1252
1375
|
|
|
1253
1376
|
// src/preview-prompts.ts
|