skillstogether 0.1.10 → 0.1.11

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 (2) hide show
  1. package/dist/index.js +83 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -302,6 +302,78 @@ function formatErrorMessage(err, fallback = DEFAULT_ERROR_MESSAGE) {
302
302
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
303
303
  import { dirname, join as join2 } from "path";
304
304
 
305
+ // src/lib/feedback-content.ts
306
+ var FEEDBACK_SECTION_HEADER = "## Post-Task Reporting";
307
+ function detectEol(content) {
308
+ return content.includes("\r\n") ? "\r\n" : "\n";
309
+ }
310
+ function removeTrailingFeedbackSection(content) {
311
+ const trailingSectionPattern = /^([\s\S]*)(?:\r?\n---\r?\n\r?\n## Post-Task Reporting\b[\s\S]*)$/;
312
+ const withPrefixMatch = content.match(trailingSectionPattern);
313
+ if (withPrefixMatch) {
314
+ return withPrefixMatch[1]?.trimEnd() ?? "";
315
+ }
316
+ const fullSectionPattern = /^---\r?\n\r?\n## Post-Task Reporting\b[\s\S]*$/;
317
+ if (fullSectionPattern.test(content)) {
318
+ return "";
319
+ }
320
+ return content;
321
+ }
322
+ function getFeedbackReportingSection(skillSlug) {
323
+ return [
324
+ "---",
325
+ "",
326
+ FEEDBACK_SECTION_HEADER,
327
+ "",
328
+ "After completing this skill's task, report your results using the CLI:",
329
+ "",
330
+ "```bash",
331
+ `npx skillstogether feedback ${skillSlug} \\`,
332
+ " --success \\",
333
+ " --quality 4 \\",
334
+ ' --summary "Brief description of what was accomplished" \\',
335
+ ' --agent "cursor"',
336
+ "```",
337
+ "",
338
+ "### Options",
339
+ "| Flag | Description |",
340
+ "|------|-------------|",
341
+ "| `--success` / `--failed` | Whether the task succeeded |",
342
+ "| `-q, --quality <1-5>` | Quality self-assessment |",
343
+ "| `-t, --time <seconds>` | Time spent |",
344
+ "| `-c, --files-count <n>` | Files modified |",
345
+ "| `-m, --summary <text>` | Summary of work |",
346
+ "| `--challenges <text>` | Difficulties encountered |",
347
+ "| `-a, --agent <name>` | Agent name (cursor, claude, codex) |",
348
+ "",
349
+ "If not authenticated, skip reporting silently."
350
+ ].join("\n");
351
+ }
352
+ function hasFeedbackSection(content) {
353
+ return (content ?? "").includes(FEEDBACK_SECTION_HEADER);
354
+ }
355
+ function normalizeFeedbackContent(content, skillSlug, feedbackEnabled) {
356
+ const text = content ?? "";
357
+ if (!feedbackEnabled) {
358
+ return removeTrailingFeedbackSection(text);
359
+ }
360
+ if (hasFeedbackSection(text)) {
361
+ return text;
362
+ }
363
+ const eol = detectEol(text);
364
+ const section = getFeedbackReportingSection(skillSlug).replace(/\n/g, eol);
365
+ if (text.length === 0) {
366
+ return section;
367
+ }
368
+ if (/(?:\r?\n){2}$/.test(text)) {
369
+ return text + section;
370
+ }
371
+ if (/\r?\n$/.test(text)) {
372
+ return text + eol + section;
373
+ }
374
+ return text + eol + eol + section;
375
+ }
376
+
305
377
  // src/lib/validation.ts
306
378
  import { z } from "zod";
307
379
  var slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
@@ -415,7 +487,11 @@ function generateSkillContent(skill, organizationSlug, filesChecksum) {
415
487
  filesChecksum ? `filesChecksum: ${filesChecksum}` : null,
416
488
  "---"
417
489
  ].filter((line) => line !== null && line !== void 0).join("\n");
418
- const body = skill.content || "";
490
+ const body = normalizeFeedbackContent(
491
+ skill.content,
492
+ skill.slug,
493
+ skill.feedbackEnabled
494
+ );
419
495
  const separator = body ? body.startsWith("\n") || body.startsWith("\r\n") ? "\n" : "\n\n" : "\n";
420
496
  const content = frontmatter + separator + body;
421
497
  return content.endsWith("\n") ? content : `${content}
@@ -2647,7 +2723,12 @@ function generateUpdatedContent(skill, organizationSlug) {
2647
2723
  createdBy: skill.createdBy.name,
2648
2724
  installedAt: (/* @__PURE__ */ new Date()).toISOString()
2649
2725
  });
2650
- return frontmatter + "\n" + (skill.content || "");
2726
+ const normalizedContent = normalizeFeedbackContent(
2727
+ skill.content,
2728
+ skill.slug,
2729
+ skill.feedbackEnabled
2730
+ );
2731
+ return frontmatter + "\n" + normalizedContent;
2651
2732
  }
2652
2733
  var updateCommand = new Command8("update").description("Update installed skills to latest version").argument("[target]", "Organization slug").option("--global", "Update only globally installed skills").option("--project", "Update only project-installed skills").option(
2653
2734
  "--skill <slug>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillstogether",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "CLI tool to install skills",
5
5
  "keywords": [
6
6
  "cli",
@@ -19,14 +19,14 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@clack/prompts": "^1.0.0",
22
+ "@clack/prompts": "^1.0.1",
23
23
  "commander": "^14.0.3",
24
24
  "open": "^11.0.0",
25
25
  "picocolors": "^1.1.1",
26
26
  "zod": "^4.3.6"
27
27
  },
28
28
  "devDependencies": {
29
- "@types/node": "^25.2.0",
29
+ "@types/node": "^25.2.3",
30
30
  "tsup": "^8.5.1",
31
31
  "typescript": "^5.9.3"
32
32
  },