release-skill 0.9.1 → 0.9.3

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 (148) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codebuddy-plugin/plugin.json +1 -1
  4. package/.codex-plugin/plugin.json +2 -2
  5. package/.kimi-plugin/plugin.json +1 -1
  6. package/CHANGELOG.md +49 -0
  7. package/INSTALL.md +2 -2
  8. package/INSTALL.zh-CN.md +2 -2
  9. package/README.md +24 -26
  10. package/README.zh-CN.md +20 -23
  11. package/adapters/claude/.claude-plugin/marketplace.json +1 -1
  12. package/adapters/claude/.claude-plugin/plugin.json +1 -1
  13. package/adapters/claude/bin/consumer-contract-vectors.json +7 -7
  14. package/adapters/claude/bin/error-codes.json +1 -1
  15. package/adapters/claude/bin/foundation-resource-binding.json +1 -1
  16. package/adapters/claude/bin/registry.json +22 -1
  17. package/adapters/claude/bin/release-skill.bundle.mjs +4068 -1962
  18. package/adapters/claude/bin/rules.json +1 -1
  19. package/adapters/claude/schemas/release-project.schema.json +4 -0
  20. package/adapters/claude/schemas/release-run.schema.json +41 -1
  21. package/adapters/claude/skills/release-config/SKILL.md +5 -3
  22. package/adapters/claude/skills/release-docs/SKILL.md +4 -2
  23. package/adapters/claude/skills/release-finish/SKILL.md +2 -0
  24. package/adapters/claude/skills/release-help/SKILL.md +11 -3
  25. package/adapters/claude/skills/release-marketplace/SKILL.md +3 -1
  26. package/adapters/claude/skills/release-prepare/SKILL.md +2 -0
  27. package/adapters/claude/skills/release-publish/SKILL.md +17 -10
  28. package/adapters/claude/skills/release-verify/SKILL.md +2 -0
  29. package/adapters/claude/src/schemas/executable-identity-observation.schema.json +162 -0
  30. package/adapters/claude/src/schemas/filesystem-tree-observation.schema.json +18 -2
  31. package/adapters/claude/src/schemas/plugin-verification-request.schema.json +147 -22
  32. package/adapters/claude/src/schemas/plugin-verification-result.schema.json +436 -18
  33. package/adapters/claude/src/schemas/skill-family-directory-verification-request.schema.json +100 -0
  34. package/adapters/claude/src/schemas/skill-family-directory-verification-result.schema.json +193 -0
  35. package/adapters/codex/.codex-plugin/plugin.json +2 -2
  36. package/adapters/codex/bin/consumer-contract-vectors.json +7 -7
  37. package/adapters/codex/bin/error-codes.json +1 -1
  38. package/adapters/codex/bin/foundation-resource-binding.json +1 -1
  39. package/adapters/codex/bin/registry.json +22 -1
  40. package/adapters/codex/bin/release-skill.bundle.mjs +4068 -1962
  41. package/adapters/codex/bin/rules.json +1 -1
  42. package/adapters/codex/schemas/release-project.schema.json +4 -0
  43. package/adapters/codex/schemas/release-run.schema.json +41 -1
  44. package/adapters/codex/skills/release-config/SKILL.md +5 -3
  45. package/adapters/codex/skills/release-docs/SKILL.md +4 -2
  46. package/adapters/codex/skills/release-finish/SKILL.md +2 -0
  47. package/adapters/codex/skills/release-help/SKILL.md +11 -3
  48. package/adapters/codex/skills/release-marketplace/SKILL.md +3 -1
  49. package/adapters/codex/skills/release-prepare/SKILL.md +2 -0
  50. package/adapters/codex/skills/release-publish/SKILL.md +17 -10
  51. package/adapters/codex/skills/release-verify/SKILL.md +2 -0
  52. package/adapters/codex/src/schemas/executable-identity-observation.schema.json +162 -0
  53. package/adapters/codex/src/schemas/filesystem-tree-observation.schema.json +18 -2
  54. package/adapters/codex/src/schemas/plugin-verification-request.schema.json +147 -22
  55. package/adapters/codex/src/schemas/plugin-verification-result.schema.json +436 -18
  56. package/adapters/codex/src/schemas/skill-family-directory-verification-request.schema.json +100 -0
  57. package/adapters/codex/src/schemas/skill-family-directory-verification-result.schema.json +193 -0
  58. package/adapters/kimi/.kimi-plugin/plugin.json +1 -1
  59. package/adapters/kimi/bin/consumer-contract-vectors.json +7 -7
  60. package/adapters/kimi/bin/error-codes.json +1 -1
  61. package/adapters/kimi/bin/foundation-resource-binding.json +1 -1
  62. package/adapters/kimi/bin/registry.json +22 -1
  63. package/adapters/kimi/bin/release-skill.bundle.mjs +4068 -1962
  64. package/adapters/kimi/bin/rules.json +1 -1
  65. package/adapters/kimi/schemas/release-project.schema.json +4 -0
  66. package/adapters/kimi/schemas/release-run.schema.json +41 -1
  67. package/adapters/kimi/skills/release-config/SKILL.md +5 -3
  68. package/adapters/kimi/skills/release-docs/SKILL.md +4 -2
  69. package/adapters/kimi/skills/release-finish/SKILL.md +2 -0
  70. package/adapters/kimi/skills/release-help/SKILL.md +11 -3
  71. package/adapters/kimi/skills/release-marketplace/SKILL.md +3 -1
  72. package/adapters/kimi/skills/release-prepare/SKILL.md +2 -0
  73. package/adapters/kimi/skills/release-publish/SKILL.md +17 -10
  74. package/adapters/kimi/skills/release-verify/SKILL.md +2 -0
  75. package/adapters/kimi/src/schemas/executable-identity-observation.schema.json +162 -0
  76. package/adapters/kimi/src/schemas/filesystem-tree-observation.schema.json +18 -2
  77. package/adapters/kimi/src/schemas/plugin-verification-request.schema.json +147 -22
  78. package/adapters/kimi/src/schemas/plugin-verification-result.schema.json +436 -18
  79. package/adapters/kimi/src/schemas/skill-family-directory-verification-request.schema.json +100 -0
  80. package/adapters/kimi/src/schemas/skill-family-directory-verification-result.schema.json +193 -0
  81. package/adapters/workbuddy/.codebuddy-plugin/plugin.json +1 -1
  82. package/adapters/workbuddy/bin/consumer-contract-vectors.json +7 -7
  83. package/adapters/workbuddy/bin/error-codes.json +1 -1
  84. package/adapters/workbuddy/bin/foundation-resource-binding.json +1 -1
  85. package/adapters/workbuddy/bin/registry.json +22 -1
  86. package/adapters/workbuddy/bin/release-skill.bundle.mjs +4068 -1962
  87. package/adapters/workbuddy/bin/rules.json +1 -1
  88. package/adapters/workbuddy/schemas/release-project.schema.json +4 -0
  89. package/adapters/workbuddy/schemas/release-run.schema.json +41 -1
  90. package/adapters/workbuddy/skills/release-config/SKILL.md +5 -3
  91. package/adapters/workbuddy/skills/release-docs/SKILL.md +4 -2
  92. package/adapters/workbuddy/skills/release-finish/SKILL.md +2 -0
  93. package/adapters/workbuddy/skills/release-help/SKILL.md +11 -3
  94. package/adapters/workbuddy/skills/release-marketplace/SKILL.md +3 -1
  95. package/adapters/workbuddy/skills/release-prepare/SKILL.md +2 -0
  96. package/adapters/workbuddy/skills/release-publish/SKILL.md +17 -10
  97. package/adapters/workbuddy/skills/release-verify/SKILL.md +2 -0
  98. package/adapters/workbuddy/src/schemas/executable-identity-observation.schema.json +162 -0
  99. package/adapters/workbuddy/src/schemas/filesystem-tree-observation.schema.json +18 -2
  100. package/adapters/workbuddy/src/schemas/plugin-verification-request.schema.json +147 -22
  101. package/adapters/workbuddy/src/schemas/plugin-verification-result.schema.json +436 -18
  102. package/adapters/workbuddy/src/schemas/skill-family-directory-verification-request.schema.json +100 -0
  103. package/adapters/workbuddy/src/schemas/skill-family-directory-verification-result.schema.json +193 -0
  104. package/bin/consumer-contract-vectors.json +7 -7
  105. package/bin/error-codes.json +1 -1
  106. package/bin/foundation-resource-binding.json +1 -1
  107. package/bin/registry.json +22 -1
  108. package/bin/release-skill-cli.mjs +32 -0
  109. package/bin/release-skill.bundle.mjs +4068 -1962
  110. package/bin/rules.json +1 -1
  111. package/package.json +5 -5
  112. package/platform-manifest.json +4 -4
  113. package/references/01-state-machine.md +16 -1
  114. package/references/05-evidence-and-errors.md +2 -2
  115. package/schemas/release-project.schema.json +4 -0
  116. package/schemas/release-run.schema.json +41 -1
  117. package/skills/release-config/SKILL.md +5 -3
  118. package/skills/release-docs/SKILL.md +4 -2
  119. package/skills/release-finish/SKILL.md +2 -0
  120. package/skills/release-help/SKILL.md +11 -3
  121. package/skills/release-marketplace/SKILL.md +3 -1
  122. package/skills/release-prepare/SKILL.md +2 -0
  123. package/skills/release-publish/SKILL.md +17 -10
  124. package/skills/release-verify/SKILL.md +2 -0
  125. package/skills-src/release-config/SKILL.md +5 -3
  126. package/skills-src/release-docs/SKILL.md +4 -2
  127. package/skills-src/release-finish/SKILL.md +2 -0
  128. package/skills-src/release-help/SKILL.md +11 -3
  129. package/skills-src/release-marketplace/SKILL.md +3 -1
  130. package/skills-src/release-prepare/SKILL.md +2 -0
  131. package/skills-src/release-publish/SKILL.md +17 -10
  132. package/skills-src/release-verify/SKILL.md +2 -0
  133. package/src/commands/prepare.mjs +139 -5
  134. package/src/commands/route.mjs +597 -18
  135. package/src/commands/setup.mjs +2 -0
  136. package/src/commands/ship.mjs +19 -0
  137. package/src/commands/verify.mjs +21 -0
  138. package/src/core/adoption-assessment.mjs +59 -0
  139. package/src/core/foundation-plugin-verification.mjs +213 -1
  140. package/src/core/hook-cache.mjs +318 -26
  141. package/src/core/hooks.mjs +8 -1
  142. package/src/producers/foundation-resource-projection.mjs +3 -3
  143. package/src/schemas/executable-identity-observation.schema.json +162 -0
  144. package/src/schemas/filesystem-tree-observation.schema.json +18 -2
  145. package/src/schemas/plugin-verification-request.schema.json +147 -22
  146. package/src/schemas/plugin-verification-result.schema.json +436 -18
  147. package/src/schemas/skill-family-directory-verification-request.schema.json +100 -0
  148. package/src/schemas/skill-family-directory-verification-result.schema.json +193 -0
@@ -25,7 +25,7 @@ import { promisify } from 'node:util';
25
25
 
26
26
  const execFile = promisify(execFileCb);
27
27
 
28
- import { classifyPathInput, writeFileAtomic } from 'skill-family-harness-node';
28
+ import { classifyPathInput, writeFileAtomic, withTemporaryWorkspace } from 'skill-family-harness-node';
29
29
  import { loadProjectConfig } from '../core/config.mjs';
30
30
  import { captureBaseline } from '../core/baseline.mjs';
31
31
  import { runHook } from '../core/hooks.mjs';
@@ -323,9 +323,16 @@ export async function runDeclaredHooks(config, root, evidence, hookFn = runHook,
323
323
 
324
324
  // --- Incremental cache lookup (opt-in only; default zero change) ---
325
325
  let cacheKey;
326
+ let cacheReceipt;
327
+ let cacheRootBinding;
326
328
  if (cacheEnabled && hook.cacheable === true) {
327
329
  try {
328
- ({ cacheKey } = await computeHookCacheKey(hook, root));
330
+ ({ cacheKey, receipt: cacheReceipt, projectRootBinding: cacheRootBinding } = await computeHookCacheKey(hook, root, {
331
+ env: options.env ?? process.env,
332
+ ...(typeof options.observeExecutableIdentityFn === 'function'
333
+ ? { observeExecutableIdentityFn: options.observeExecutableIdentityFn }
334
+ : {}),
335
+ }));
329
336
  } catch (err) {
330
337
  await evidence.append({
331
338
  phase: 'hooks',
@@ -336,7 +343,9 @@ export async function runDeclaredHooks(config, root, evidence, hookFn = runHook,
336
343
  throw err;
337
344
  }
338
345
 
339
- const cached = await readHookCache(root, name, cacheKey);
346
+ const cached = cacheKey ? await readHookCache(root, name, cacheKey, {
347
+ rootBinding: cacheRootBinding,
348
+ }) : null;
340
349
  if (cached) {
341
350
  // Cache hit: skip execution. The authorization gate already passed and
342
351
  // no GATE is bypassed — ordering and failure semantics are untouched.
@@ -407,12 +416,13 @@ export async function runDeclaredHooks(config, root, evidence, hookFn = runHook,
407
416
  }
408
417
 
409
418
  // --- Write cache on success only; failures are never cached ---
410
- if (cacheEnabled && hook.cacheable === true && cacheKey) {
419
+ if (cacheEnabled && hook.cacheable === true && cacheKey && cacheReceipt) {
411
420
  const written = await writeHookCache(root, name, cacheKey, {
412
421
  exitCode: 0,
413
422
  stdoutTail: result.stdout.slice(-4000),
414
423
  stderrTail: result.stderr.slice(-4000),
415
- });
424
+ receipt: cacheReceipt,
425
+ }, { rootBinding: cacheRootBinding });
416
426
  if (!written.ok) {
417
427
  // The cache is an optimisation, not a gate: a write failure must not
418
428
  // abort prepare. Surface it as a warning-level evidence event.
@@ -2794,6 +2804,119 @@ async function runPrepareSkillResourceClosureGate({
2794
2804
  return skillResourceClosureResults;
2795
2805
  }
2796
2806
 
2807
+ /**
2808
+ * R93-01: optionally inspect the public surface before the first declared
2809
+ * hook. The staging and closure checks are deliberately ephemeral: their
2810
+ * result is an execution gate, not a plan/approval/publish receipt. The
2811
+ * normal post-hook snapshot and closure gate remains authoritative.
2812
+ */
2813
+ async function runPreHookPublicSurfaceGate({
2814
+ config,
2815
+ root,
2816
+ resolvedVersions,
2817
+ evidence,
2818
+ skipDeclaredHooks,
2819
+ workflow,
2820
+ }) {
2821
+ if (config.policy?.preHookPublicSurfaceCheck !== true) return;
2822
+
2823
+ const declaredHookCount = Object.values(config.hooks ?? {})
2824
+ .filter((hook) => hook && hook.command).length;
2825
+ if (skipDeclaredHooks || declaredHookCount === 0) {
2826
+ await evidence.append({
2827
+ phase: 'pre-hook-public-surface',
2828
+ status: 'skipped',
2829
+ reason: skipDeclaredHooks
2830
+ ? `workflow "${workflow}" trims code-class hooks`
2831
+ : 'no declared hooks',
2832
+ });
2833
+ return;
2834
+ }
2835
+
2836
+ await evidence.append({ phase: 'pre-hook-public-surface', status: 'started' });
2837
+ let currentUnitId = null;
2838
+ let unitCount = 0;
2839
+ try {
2840
+ await withTemporaryWorkspace(async (workspace) => {
2841
+ const stagingRoot = workspace.root;
2842
+ const unitResults = [];
2843
+ for (const unit of config.releaseUnits ?? []) {
2844
+ currentUnitId = unit.id;
2845
+ const outputDir = resolveUnitScopedPath(stagingRoot, unit.id);
2846
+ const publicManifest = await buildPublicStaging({
2847
+ sourceRoot: root,
2848
+ unit,
2849
+ outputDir,
2850
+ });
2851
+ unitResults.push({
2852
+ unit,
2853
+ manifest: {
2854
+ entries: publicManifest.entries,
2855
+ files: publicManifest.entries.map((entry) => entry.path).sort(),
2856
+ totalSize: publicManifest.totalSize,
2857
+ fileCount: publicManifest.fileCount,
2858
+ contentHash: publicManifest.contentHash,
2859
+ snapshotDigest: publicManifest.contentHash,
2860
+ source: unit.source,
2861
+ outputDir: publicManifest.outputDir,
2862
+ },
2863
+ });
2864
+ }
2865
+
2866
+ const { frozenManifestByDist } = await resolveDistributionManifestFacts(
2867
+ unitResults,
2868
+ resolvedVersions,
2869
+ );
2870
+ unitCount = unitResults.length;
2871
+ // Reuse the production closure/host-surface implementation, but do not
2872
+ // append its ordinary phase events or retain its receipt in the plan.
2873
+ await runPrepareSkillResourceClosureGate({
2874
+ unitResults,
2875
+ frozenManifestByDist,
2876
+ freezeTimestamp: null,
2877
+ evidence: { append: async () => undefined },
2878
+ skipSkillResourceClosure: false,
2879
+ workflow: 'pre-hook-public-surface',
2880
+ });
2881
+ });
2882
+ await evidence.append({
2883
+ phase: 'pre-hook-public-surface',
2884
+ status: 'passed',
2885
+ unitCount,
2886
+ });
2887
+ } catch (error) {
2888
+ const details = {
2889
+ ...(error instanceof ReleaseError ? error.details : {}),
2890
+ phase: 'pre-hook-public-surface',
2891
+ unitId: error?.details?.unitId ?? currentUnitId,
2892
+ };
2893
+ if (Array.isArray(details.findings)) {
2894
+ details.findings = details.findings.slice(0, 50);
2895
+ }
2896
+ await evidence.append({
2897
+ phase: 'pre-hook-public-surface',
2898
+ status: 'failed',
2899
+ error: { code: error.code ?? GATE_FAILED, message: error.message },
2900
+ });
2901
+ if (error instanceof ReleaseError) {
2902
+ throw new ReleaseError(
2903
+ error.code,
2904
+ `pre-hook public surface check failed before hooks: ${error.message}`,
2905
+ details,
2906
+ error.exitCode,
2907
+ );
2908
+ }
2909
+ throw new ReleaseError(
2910
+ GATE_FAILED,
2911
+ `pre-hook public surface check failed before hooks: ${error.message}`,
2912
+ details,
2913
+ );
2914
+ } finally {
2915
+ // withTemporaryWorkspace disposes the Foundation-managed staging root on
2916
+ // both success and failure; no project run artifact is retained.
2917
+ }
2918
+ }
2919
+
2797
2920
  export async function prepareRelease(options) {
2798
2921
  const {
2799
2922
  root,
@@ -3309,6 +3432,17 @@ export async function prepareRelease(options) {
3309
3432
  });
3310
3433
  }
3311
3434
 
3435
+ // R93-01: optional ephemeral public-surface check immediately before the
3436
+ // first hook. Its staging and closure receipt never enter the plan.
3437
+ await runPreHookPublicSurfaceGate({
3438
+ config,
3439
+ root: realRoot,
3440
+ resolvedVersions,
3441
+ evidence,
3442
+ skipDeclaredHooks,
3443
+ workflow,
3444
+ });
3445
+
3312
3446
  // --- Step 3: Run declared hooks ---
3313
3447
  let hookRecords = [];
3314
3448
  if (skipDeclaredHooks) {