@deftai/directive-core 0.61.1 → 0.61.2

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.
@@ -14,6 +14,7 @@ import { resolveInstalledContentRoot } from "../deposit/resolve-content.js";
14
14
  import { readCorePackageVersion } from "../engine-version.js";
15
15
  import { ensureInitGitignoreLines, reconstituteDepositFromContent } from "./gitignore.js";
16
16
  import { buildLegacyRefusalJson, buildLegacyRefusalMessage, detectLegacyLayout, LEGACY_LAYOUT_REFUSED_EXIT_CODE, LegacyLayoutRefusedError, } from "./legacy-detect.js";
17
+ import { printMigrateNudgeIfNeeded } from "./migrate.js";
17
18
  import { CANONICAL_INSTALL_ROOT, depositNeutralization, ensureTaskfile, writeAgentsMd, writeAgentsSkills, writeConsumerGitHooks, writeConsumerVbrief, writeInstallManifest, } from "./scaffold.js";
18
19
  export function parseInitArgv(canonicalArgv, userArgv = []) {
19
20
  const args = [...canonicalArgv, ...userArgv];
@@ -109,6 +110,7 @@ export function printNextSteps(result, io) {
109
110
  io.printf(" 2. Deft skill auto-discovery is partially implemented — if your agent doesn't\n");
110
111
  io.printf(' start setup automatically, tell it: "Use AGENTS.md"\n');
111
112
  io.printf(" 3. On first session, the agent will guide you through creating USER.md and PROJECT-DEFINITION.vbrief.json\n");
113
+ printMigrateNudgeIfNeeded(result.projectDir, io);
112
114
  io.printf("\n");
113
115
  }
114
116
  export async function runInitDeposit(args, io, seams = {}) {
@@ -85,4 +85,13 @@ export interface RunMigrateCliOptions {
85
85
  * stderr; config errors print to stderr; success prints to stdout.
86
86
  */
87
87
  export declare function runMigrateCli(options: RunMigrateCliOptions): number;
88
+ /** One-line nudge for init/update/session completion when provenance is unstamped (#2059). */
89
+ export declare const MIGRATE_COMPLETION_NUDGE = "[deft] One-time: run `directive migrate` to stamp npm provenance (idempotent). See content/UPGRADING.md.";
90
+ /** True when a canonical-vendored deposit exists and lacks the npm-managed sentinel. */
91
+ export declare function shouldEmitMigrateNudge(projectRoot: string, seams?: Pick<MigrateSeams, "isFile" | "readText">): boolean;
92
+ export interface MigrateNudgeIo {
93
+ printf: (text: string) => void;
94
+ }
95
+ /** Prints {@link MIGRATE_COMPLETION_NUDGE} when {@link shouldEmitMigrateNudge} is true. */
96
+ export declare function printMigrateNudgeIfNeeded(projectRoot: string, io: MigrateNudgeIo, seams?: Pick<MigrateSeams, "isFile" | "readText">): void;
88
97
  //# sourceMappingURL=migrate.d.ts.map
@@ -193,4 +193,27 @@ export function runMigrateCli(options) {
193
193
  }
194
194
  return result.exitCode;
195
195
  }
196
+ /** One-line nudge for init/update/session completion when provenance is unstamped (#2059). */
197
+ export const MIGRATE_COMPLETION_NUDGE = "[deft] One-time: run `directive migrate` to stamp npm provenance (idempotent). See content/UPGRADING.md.";
198
+ /** True when a canonical-vendored deposit exists and lacks the npm-managed sentinel. */
199
+ export function shouldEmitMigrateNudge(projectRoot, seams = {}) {
200
+ const isFile = seams.isFile ?? existsSync;
201
+ const readText = seams.readText ?? defaultReadText;
202
+ const manifestPath = detectCanonicalVendoredManifest(projectRoot, isFile);
203
+ if (manifestPath === null)
204
+ return false;
205
+ const text = readText(manifestPath);
206
+ if (text === null)
207
+ return false;
208
+ const manifest = parseInstallManifest(text);
209
+ if (Object.keys(manifest).length === 0)
210
+ return false;
211
+ return !isNpmManaged(manifest);
212
+ }
213
+ /** Prints {@link MIGRATE_COMPLETION_NUDGE} when {@link shouldEmitMigrateNudge} is true. */
214
+ export function printMigrateNudgeIfNeeded(projectRoot, io, seams = {}) {
215
+ if (shouldEmitMigrateNudge(projectRoot, seams)) {
216
+ io.printf(`\n${MIGRATE_COMPLETION_NUDGE}\n`);
217
+ }
218
+ }
196
219
  //# sourceMappingURL=migrate.js.map
@@ -18,6 +18,7 @@ import { DEV_FALLBACK } from "../platform/constants.js";
18
18
  import { gitPorcelain } from "../story-ready/git.js";
19
19
  import { parseInitArgv } from "./init-deposit.js";
20
20
  import { buildLegacyRefusalJson, buildLegacyRefusalMessage, detectLegacyLayout, LEGACY_LAYOUT_REFUSED_EXIT_CODE, LegacyLayoutRefusedError, } from "./legacy-detect.js";
21
+ import { printMigrateNudgeIfNeeded } from "./migrate.js";
21
22
  import { CANONICAL_INSTALL_ROOT, depositNeutralization, writeAgentsMd, writeInstallManifest, } from "./scaffold.js";
22
23
  const INSTALLER_MANAGED_EXACT = new Set([
23
24
  "AGENTS.md",
@@ -231,6 +232,7 @@ export function printUpdateComplete(result, io) {
231
232
  if (result.versionSkewNotice) {
232
233
  io.printf(`\n${result.versionSkewNotice}\n`);
233
234
  }
235
+ printMigrateNudgeIfNeeded(result.projectDir, io);
234
236
  io.printf("\n");
235
237
  }
236
238
  export async function runRefreshDeposit(args, io, seams = {}) {
@@ -1,4 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ import { runningInsideDeftRepo } from "../doctor/paths.js";
3
+ import { MIGRATE_COMPLETION_NUDGE, shouldEmitMigrateNudge } from "../init-deposit/migrate.js";
2
4
  import { disclosureLine } from "../policy/disclosure.js";
3
5
  import { resolvePolicy } from "../policy/resolve.js";
4
6
  import { runDefaultMode } from "../triage/welcome/default-mode.js";
@@ -263,6 +265,9 @@ export function runSessionStart(projectRoot, options = {}) {
263
265
  lines.push(message);
264
266
  }
265
267
  }
268
+ if (!runningInsideDeftRepo(projectRoot) && shouldEmitMigrateNudge(projectRoot)) {
269
+ lines.push(MIGRATE_COMPLETION_NUDGE);
270
+ }
266
271
  const payload = newRitualStatePayload({
267
272
  sessionId: (options.newSessionId ?? randomUUID)(),
268
273
  gitHead: gitHeadValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive-core",
3
- "version": "0.61.1",
3
+ "version": "0.61.2",
4
4
  "description": "TypeScript engine core for the Directive framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -221,8 +221,8 @@
221
221
  "provenance": true
222
222
  },
223
223
  "dependencies": {
224
- "@deftai/directive-content": "^0.61.1",
225
- "@deftai/directive-types": "^0.61.1"
224
+ "@deftai/directive-content": "^0.61.2",
225
+ "@deftai/directive-types": "^0.61.2"
226
226
  },
227
227
  "scripts": {
228
228
  "build": "tsc -b",