@sharpee/devkit 1.0.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 (73) hide show
  1. package/cli.d.ts +3 -0
  2. package/cli.d.ts.map +1 -0
  3. package/cli.js +219 -0
  4. package/cli.js.map +1 -0
  5. package/commands/browser.d.ts +10 -0
  6. package/commands/browser.d.ts.map +1 -0
  7. package/commands/browser.js +107 -0
  8. package/commands/browser.js.map +1 -0
  9. package/commands/build.d.ts +38 -0
  10. package/commands/build.d.ts.map +1 -0
  11. package/commands/build.js +165 -0
  12. package/commands/build.js.map +1 -0
  13. package/commands/bundle.d.ts +9 -0
  14. package/commands/bundle.d.ts.map +1 -0
  15. package/commands/bundle.js +46 -0
  16. package/commands/bundle.js.map +1 -0
  17. package/commands/clean.d.ts +7 -0
  18. package/commands/clean.d.ts.map +1 -0
  19. package/commands/clean.js +31 -0
  20. package/commands/clean.js.map +1 -0
  21. package/commands/register.d.ts +5 -0
  22. package/commands/register.d.ts.map +1 -0
  23. package/commands/register.js +45 -0
  24. package/commands/register.js.map +1 -0
  25. package/commands/test-npm.d.ts +34 -0
  26. package/commands/test-npm.d.ts.map +1 -0
  27. package/commands/test-npm.js +155 -0
  28. package/commands/test-npm.js.map +1 -0
  29. package/commands/verify.d.ts +7 -0
  30. package/commands/verify.d.ts.map +1 -0
  31. package/commands/verify.js +27 -0
  32. package/commands/verify.js.map +1 -0
  33. package/commands/zifmia.d.ts +10 -0
  34. package/commands/zifmia.d.ts.map +1 -0
  35. package/commands/zifmia.js +56 -0
  36. package/commands/zifmia.js.map +1 -0
  37. package/consumer-gen.d.ts +49 -0
  38. package/consumer-gen.d.ts.map +1 -0
  39. package/consumer-gen.js +137 -0
  40. package/consumer-gen.js.map +1 -0
  41. package/index.d.ts +29 -0
  42. package/index.d.ts.map +1 -0
  43. package/index.js +55 -0
  44. package/index.js.map +1 -0
  45. package/package.json +42 -0
  46. package/registry.d.ts +33 -0
  47. package/registry.d.ts.map +1 -0
  48. package/registry.js +81 -0
  49. package/registry.js.map +1 -0
  50. package/repo.d.ts +64 -0
  51. package/repo.d.ts.map +1 -0
  52. package/repo.js +185 -0
  53. package/repo.js.map +1 -0
  54. package/standalone/build-browser.d.ts +10 -0
  55. package/standalone/build-browser.d.ts.map +1 -0
  56. package/standalone/build-browser.js +208 -0
  57. package/standalone/build-browser.js.map +1 -0
  58. package/standalone/build.d.ts +8 -0
  59. package/standalone/build.d.ts.map +1 -0
  60. package/standalone/build.js +319 -0
  61. package/standalone/build.js.map +1 -0
  62. package/standalone/ifid.d.ts +2 -0
  63. package/standalone/ifid.d.ts.map +1 -0
  64. package/standalone/ifid.js +71 -0
  65. package/standalone/ifid.js.map +1 -0
  66. package/standalone/init-browser.d.ts +10 -0
  67. package/standalone/init-browser.d.ts.map +1 -0
  68. package/standalone/init-browser.js +194 -0
  69. package/standalone/init-browser.js.map +1 -0
  70. package/standalone/init.d.ts +10 -0
  71. package/standalone/init.d.ts.map +1 -0
  72. package/standalone/init.js +183 -0
  73. package/standalone/init.js.map +1 -0
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runBundle = runBundle;
4
+ /**
5
+ * bundle.ts — `devkit bundle`: assemble the CLI platform bundle `dist/cli/sharpee.js`
6
+ * by running the exact esbuild command build.sh uses (build_bundle, 580-630).
7
+ *
8
+ * Owner context: @sharpee/devkit (ADR-180 Phase 3). Byte-for-byte parity with
9
+ * build.sh is the contract — the esbuild flag list and alias order are verbatim.
10
+ *
11
+ * Public interface: runBundle(opts) -> void. Throws if the bundle is absent/empty
12
+ * after esbuild (the no-silent-✓ invariant).
13
+ */
14
+ const node_child_process_1 = require("node:child_process");
15
+ const node_fs_1 = require("node:fs");
16
+ const node_path_1 = require("node:path");
17
+ const repo_1 = require("../repo");
18
+ /** Assemble dist/cli/sharpee.js + sharpee.d.ts. Assumes platform packages are built. */
19
+ function runBundle(opts = {}) {
20
+ const root = opts.root ?? (0, repo_1.findRepoRoot)();
21
+ const log = (m) => !opts.quiet && console.log(m);
22
+ log('=== Bundling -> dist/cli/sharpee.js ===');
23
+ (0, node_fs_1.mkdirSync)((0, node_path_1.join)(root, 'dist', 'cli'), { recursive: true });
24
+ const args = [
25
+ 'esbuild',
26
+ 'scripts/bundle-entry.js',
27
+ '--bundle',
28
+ '--platform=node',
29
+ '--target=node18',
30
+ '--outfile=dist/cli/sharpee.js',
31
+ '--external:readline',
32
+ '--format=cjs',
33
+ '--sourcemap',
34
+ ...repo_1.BUNDLE_ALIASES.map(([name, path]) => `--alias:${name}=${path}`),
35
+ ];
36
+ (0, node_child_process_1.execFileSync)('npx', args, { cwd: root, stdio: opts.quiet ? 'ignore' : 'inherit' });
37
+ // Hand-written declarations (verbatim build.sh heredoc).
38
+ (0, node_fs_1.writeFileSync)((0, node_path_1.join)(root, 'dist', 'cli', 'sharpee.d.ts'), repo_1.BUNDLE_DTS);
39
+ // Invariant: assert the artifact exists and is non-empty (no silent success on a no-op build).
40
+ const out = (0, node_path_1.join)(root, 'dist', 'cli', 'sharpee.js');
41
+ if (!(0, node_fs_1.existsSync)(out) || (0, node_fs_1.statSync)(out).size === 0) {
42
+ throw new Error('bundle failed: dist/cli/sharpee.js is missing or empty after esbuild');
43
+ }
44
+ log(`bundle: dist/cli/sharpee.js (${(0, node_fs_1.statSync)(out).size} bytes)`);
45
+ }
46
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/commands/bundle.ts"],"names":[],"mappings":";;AAuBA,8BA8BC;AArDD;;;;;;;;;GASG;AACH,2DAAkD;AAClD,qCAAyE;AACzE,yCAAiC;AACjC,kCAAmE;AASnE,wFAAwF;AACxF,SAAgB,SAAS,CAAC,OAAsB,EAAE;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAA,mBAAY,GAAE,CA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C,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface CleanOptions {
2
+ root?: string;
3
+ quiet?: boolean;
4
+ }
5
+ /** Run every package's `clean` script, then remove the top-level `dist/`. */
6
+ export declare function runClean(opts?: CleanOptions): void;
7
+ //# sourceMappingURL=clean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/commands/clean.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,IAAI,GAAE,YAAiB,GAAG,IAAI,CAYtD"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runClean = runClean;
4
+ /**
5
+ * clean.ts — `devkit clean`: build-artifact hygiene.
6
+ *
7
+ * Owner context: @sharpee/devkit (ADR-180 Phase 3d). Removes the artifact classes
8
+ * that caused silent no-op builds (stale .tsbuildinfo) and stale dist trees, by
9
+ * running each package's own `clean` script plus wiping the top-level bundle dir.
10
+ *
11
+ * Public interface: runClean(opts) -> void.
12
+ */
13
+ const node_child_process_1 = require("node:child_process");
14
+ const node_fs_1 = require("node:fs");
15
+ const node_path_1 = require("node:path");
16
+ const repo_1 = require("../repo");
17
+ /** Run every package's `clean` script, then remove the top-level `dist/`. */
18
+ function runClean(opts = {}) {
19
+ const root = opts.root ?? (0, repo_1.findRepoRoot)();
20
+ const log = (m) => !opts.quiet && console.log(m);
21
+ log('=== devkit clean ===');
22
+ // Each package's clean removes dist/, dist-esm/, tsconfig.tsbuildinfo (2026-06-17 fix).
23
+ (0, node_child_process_1.execFileSync)('pnpm', ['-r', '--if-present', 'run', 'clean'], {
24
+ cwd: root,
25
+ stdio: opts.quiet ? 'ignore' : 'inherit',
26
+ });
27
+ // Top-level bundle/client outputs are not owned by any package's clean.
28
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(root, 'dist'), { recursive: true, force: true });
29
+ log('clean: per-package artifacts + top-level dist/ removed');
30
+ }
31
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/commands/clean.ts"],"names":[],"mappings":";;AAoBA,4BAYC;AAhCD;;;;;;;;GAQG;AACH,2DAAkD;AAClD,qCAAiC;AACjC,yCAAiC;AACjC,kCAAuC;AAOvC,6EAA6E;AAC7E,SAAgB,QAAQ,CAAC,OAAqB,EAAE;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAA,mBAAY,GAAE,CAAC;IACzC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC5B,wFAAwF;IACxF,IAAA,iCAAY,EAAC,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE;QAC3D,GAAG,EAAE,IAAI;QACT,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;KACzC,CAAC,CAAC;IACH,wEAAwE;IACxE,IAAA,gBAAM,EAAC,IAAA,gBAAI,EAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,GAAG,CAAC,wDAAwD,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** `sharpee register <location> [--name <n>]` — upsert a name→path mapping. */
2
+ export declare function runRegister(args: string[]): void;
3
+ /** `sharpee list` — show registered stories, flagging stale entries. */
4
+ export declare function runList(): void;
5
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/commands/register.ts"],"names":[],"mappings":"AAWA,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAYhD;AAED,wEAAwE;AACxE,wBAAgB,OAAO,IAAI,IAAI,CAU9B"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runRegister = runRegister;
4
+ exports.runList = runList;
5
+ /**
6
+ * register.ts — `sharpee register <location>` and `sharpee list` (ADR-180 Decision 4,
7
+ * amended: the location-registry verb is `register`).
8
+ *
9
+ * Owner context: @sharpee/devkit. Convenience over the `~/.sharpee/devkit` registry so
10
+ * a story (anywhere) can be referenced by name. Pure orchestration over registry.ts.
11
+ *
12
+ * Public interface: runRegister(args), runList().
13
+ */
14
+ const registry_1 = require("../registry");
15
+ /** `sharpee register <location> [--name <n>]` — upsert a name→path mapping. */
16
+ function runRegister(args) {
17
+ let location;
18
+ let name;
19
+ for (let i = 0; i < args.length; i++) {
20
+ if (args[i] === '--name')
21
+ name = args[++i];
22
+ else if (!args[i].startsWith('-') && !location)
23
+ location = args[i];
24
+ else
25
+ throw new Error(`unexpected argument: ${args[i]}`);
26
+ }
27
+ if (!location)
28
+ throw new Error('register requires a <location>');
29
+ const entry = (0, registry_1.registerStory)(location, name);
30
+ console.log(`registered '${entry.name}' → ${entry.path}`);
31
+ console.log(`(${(0, registry_1.registryPath)()})`);
32
+ }
33
+ /** `sharpee list` — show registered stories, flagging stale entries. */
34
+ function runList() {
35
+ const entries = (0, registry_1.listStories)();
36
+ if (entries.length === 0) {
37
+ console.log('No registered stories. Use `sharpee register <location>`.');
38
+ return;
39
+ }
40
+ const width = Math.max(...entries.map((e) => e.name.length));
41
+ for (const e of entries) {
42
+ console.log(` ${e.name.padEnd(width)} ${e.path}${e.stale ? ' [STALE: path missing]' : ''}`);
43
+ }
44
+ }
45
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/commands/register.ts"],"names":[],"mappings":";;AAYA,kCAYC;AAGD,0BAUC;AArCD;;;;;;;;GAQG;AACH,0CAAuE;AAEvE,+EAA+E;AAC/E,SAAgB,WAAW,CAAC,IAAc;IACxC,IAAI,QAA4B,CAAC;IACjC,IAAI,IAAwB,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;YAAE,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;aACtC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;YAAE,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;;YAC9D,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,IAAA,wBAAa,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,IAAI,IAAA,uBAAY,GAAE,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,wEAAwE;AACxE,SAAgB,OAAO;IACrB,MAAM,OAAO,GAAG,IAAA,sBAAW,GAAE,CAAC;IAC9B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACzE,OAAO;IACT,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
@@ -0,0 +1,34 @@
1
+ /** Default staging dir written by `tsf build --npm`. */
2
+ export declare const DEFAULT_STAGING: string;
3
+ export interface TestNpmOptions {
4
+ /** Story location (a directory containing package.json + src/). */
5
+ location: string;
6
+ /** 'local' (default) packs ~/.tsf-publish tarballs; 'registry' installs published versions. */
7
+ mode?: 'local' | 'registry';
8
+ /** Override the staging dir (local mode). Defaults to ~/.tsf-publish/sharpee. */
9
+ stagingDir?: string;
10
+ /** Glob of transcripts relative to location (default `tests/transcripts/*.transcript`). */
11
+ transcripts?: string;
12
+ /** Run transcripts as one stateful chain (dungeo walkthroughs) instead of per-file. */
13
+ chain?: boolean;
14
+ /** Compile only; skip transcript execution. */
15
+ quick?: boolean;
16
+ /** Registry version/range for @sharpee deps (registry mode; default 'latest'). */
17
+ registryVersion?: string;
18
+ /** Keep the temp dir for debugging (default false). */
19
+ keep?: boolean;
20
+ }
21
+ export interface TestNpmResult {
22
+ passed: number;
23
+ failed: number;
24
+ failures: string[];
25
+ /** false when --quick (compilation only). */
26
+ ran: boolean;
27
+ }
28
+ /**
29
+ * Stand up the consumer, install, compile, and run the story's transcripts.
30
+ * @throws if the location is not a story (no package.json or no src/), or if
31
+ * install/compile fails.
32
+ */
33
+ export declare function runTestNpm(opts: TestNpmOptions): TestNpmResult;
34
+ //# sourceMappingURL=test-npm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-npm.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/commands/test-npm.ts"],"names":[],"mappings":"AAiBA,wDAAwD;AACxD,eAAO,MAAM,eAAe,QAA6C,CAAC;AA0B1E,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5B,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uFAAuF;IACvF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kFAAkF;IAClF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6CAA6C;IAC7C,GAAG,EAAE,OAAO,CAAC;CACd;AAmBD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,aAAa,CAwF9D"}
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_STAGING = void 0;
4
+ exports.runTestNpm = runTestNpm;
5
+ /**
6
+ * test-npm.ts — `devkit test:npm <location>`: stand up an isolated consumer
7
+ * project for a story, install its `@sharpee/*` closure (local staging tarballs
8
+ * or registry), compile it, and run its transcripts.
9
+ *
10
+ * Owner context: @sharpee/devkit (ADR-180 Phase 2). One parameterized command that
11
+ * replaces npm-test/, npm-test-dungeo/, and npm-test-familyzoo/ (AC-4).
12
+ *
13
+ * Public interface: runTestNpm(opts) -> TestNpmResult. The CLI maps the result to
14
+ * an exit code; tests assert on the returned counts.
15
+ */
16
+ const node_child_process_1 = require("node:child_process");
17
+ const node_fs_1 = require("node:fs");
18
+ const node_os_1 = require("node:os");
19
+ const node_path_1 = require("node:path");
20
+ const consumer_gen_1 = require("../consumer-gen");
21
+ /** Default staging dir written by `tsf build --npm`. */
22
+ exports.DEFAULT_STAGING = (0, node_path_1.join)((0, node_os_1.homedir)(), '.tsf-publish', 'sharpee');
23
+ /** Story source files that are platform/UI entry points, never part of an npm consumer build. */
24
+ const EXCLUDED_SRC = ['browser-entry.ts', 'react-entry.tsx'];
25
+ /** The generated consumer tsconfig (inlined — it is a generated artifact, never edited). */
26
+ const CONSUMER_TSCONFIG = {
27
+ compilerOptions: {
28
+ target: 'ES2022',
29
+ module: 'CommonJS',
30
+ moduleResolution: 'node',
31
+ lib: ['ES2022', 'DOM'],
32
+ outDir: 'dist',
33
+ rootDir: 'src',
34
+ strict: true,
35
+ esModuleInterop: true,
36
+ skipLibCheck: true,
37
+ declaration: false,
38
+ sourceMap: true,
39
+ forceConsistentCasingInFileNames: true,
40
+ resolveJsonModule: true,
41
+ },
42
+ include: ['src/**/*'],
43
+ exclude: ['node_modules', 'dist', 'src/browser-entry.ts', 'src/react-entry.tsx', 'src/**/*.test.ts'],
44
+ };
45
+ /**
46
+ * Expand a `dir/<glob>` pattern (single `*` wildcard in the filename) against
47
+ * `location`. Returns absolute paths sorted by name.
48
+ */
49
+ function expandGlob(location, pattern) {
50
+ const slash = pattern.lastIndexOf('/');
51
+ const dir = slash >= 0 ? pattern.slice(0, slash) : '.';
52
+ const filePat = slash >= 0 ? pattern.slice(slash + 1) : pattern;
53
+ const abs = (0, node_path_1.join)(location, dir);
54
+ if (!(0, node_fs_1.existsSync)(abs))
55
+ return [];
56
+ const re = new RegExp('^' + filePat.replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*') + '$');
57
+ return (0, node_fs_1.readdirSync)(abs)
58
+ .filter((f) => re.test(f))
59
+ .sort()
60
+ .map((f) => (0, node_path_1.join)(abs, f));
61
+ }
62
+ /**
63
+ * Stand up the consumer, install, compile, and run the story's transcripts.
64
+ * @throws if the location is not a story (no package.json or no src/), or if
65
+ * install/compile fails.
66
+ */
67
+ function runTestNpm(opts) {
68
+ const { location } = opts;
69
+ const mode = opts.mode ?? 'local';
70
+ const stagingDir = opts.stagingDir ?? exports.DEFAULT_STAGING;
71
+ const transcriptGlob = opts.transcripts ?? 'tests/transcripts/*.transcript';
72
+ const storyPkgPath = (0, node_path_1.join)(location, 'package.json');
73
+ if (!(0, node_fs_1.existsSync)(storyPkgPath))
74
+ throw new Error(`no package.json at story location: ${location}`);
75
+ if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(location, 'src')))
76
+ throw new Error(`no src/ at story location: ${location}`);
77
+ const tmp = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'devkit-npm-'));
78
+ const log = (m) => console.log(m);
79
+ try {
80
+ log(`=== devkit test:npm — ${(0, node_path_1.basename)(location)} (${mode}) ===`);
81
+ log(`temp: ${tmp}`);
82
+ // 1. Generate the consumer package.json (+ vendor tarballs for local mode).
83
+ const vendor = (0, node_path_1.join)(tmp, 'vendor');
84
+ (0, node_fs_1.mkdirSync)(vendor, { recursive: true });
85
+ const { closure, haveTranscriptTester } = (0, consumer_gen_1.generateConsumer)({
86
+ mode,
87
+ storyPkgPath,
88
+ stagingDir,
89
+ vendorDir: vendor,
90
+ outPkgPath: (0, node_path_1.join)(tmp, 'package.json'),
91
+ registryVersion: opts.registryVersion,
92
+ });
93
+ log(`closure (${closure.length}): ${closure.map((n) => n.replace('@sharpee/', '')).join(', ')}`);
94
+ if (!haveTranscriptTester) {
95
+ throw new Error('@sharpee/transcript-tester missing from staging — cannot run transcripts');
96
+ }
97
+ // 2. Copy story src (minus platform entry points) + tsconfig.
98
+ (0, node_fs_1.cpSync)((0, node_path_1.join)(location, 'src'), (0, node_path_1.join)(tmp, 'src'), { recursive: true });
99
+ for (const f of EXCLUDED_SRC)
100
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(tmp, 'src', f), { force: true });
101
+ (0, node_fs_1.writeFileSync)((0, node_path_1.join)(tmp, 'tsconfig.json'), JSON.stringify(CONSUMER_TSCONFIG, null, 2) + '\n');
102
+ // 3. Copy transcripts.
103
+ const transcripts = expandGlob(location, transcriptGlob);
104
+ if (!opts.quick && transcripts.length === 0) {
105
+ throw new Error(`no transcripts matched '${transcriptGlob}' under ${location}`);
106
+ }
107
+ const tDir = (0, node_path_1.join)(tmp, 'transcripts');
108
+ (0, node_fs_1.mkdirSync)(tDir, { recursive: true });
109
+ for (const t of transcripts)
110
+ (0, node_fs_1.cpSync)(t, (0, node_path_1.join)(tDir, (0, node_path_1.basename)(t)));
111
+ // 4. Install + compile.
112
+ const run = (cmd, args) => (0, node_child_process_1.execFileSync)(cmd, args, { cwd: tmp, stdio: 'inherit' });
113
+ log('--- npm install ---');
114
+ run('npm', ['install', '--no-fund', '--no-audit']);
115
+ log('--- tsc ---');
116
+ run('npx', ['tsc']);
117
+ if (opts.quick) {
118
+ log('compile-only (--quick) — OK');
119
+ return { passed: 0, failed: 0, failures: [], ran: false };
120
+ }
121
+ // 5. Run transcripts (chain = one stateful invocation; else per-file count).
122
+ log('--- transcripts ---');
123
+ const rel = transcripts.map((t) => (0, node_path_1.join)('transcripts', (0, node_path_1.basename)(t)));
124
+ if (opts.chain) {
125
+ try {
126
+ run('npx', ['transcript-test', '.', '--chain', ...rel]);
127
+ return { passed: transcripts.length, failed: 0, failures: [], ran: true };
128
+ }
129
+ catch {
130
+ return { passed: 0, failed: transcripts.length, failures: ['chain'], ran: true };
131
+ }
132
+ }
133
+ let passed = 0;
134
+ const failures = [];
135
+ for (const r of rel) {
136
+ try {
137
+ run('npx', ['transcript-test', '.', r]);
138
+ passed++;
139
+ }
140
+ catch {
141
+ failures.push((0, node_path_1.basename)(r, '.transcript'));
142
+ }
143
+ }
144
+ return { passed, failed: failures.length, failures, ran: true };
145
+ }
146
+ finally {
147
+ if (opts.keep) {
148
+ console.log(`(kept temp dir: ${tmp})`);
149
+ }
150
+ else {
151
+ (0, node_fs_1.rmSync)(tmp, { recursive: true, force: true });
152
+ }
153
+ }
154
+ }
155
+ //# sourceMappingURL=test-npm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-npm.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/commands/test-npm.ts"],"names":[],"mappings":";;;AA6FA,gCAwFC;AArLD;;;;;;;;;;GAUG;AACH,2DAAkD;AAClD,qCAAyG;AACzG,qCAA0C;AAC1C,yCAA2C;AAC3C,kDAAmD;AAEnD,wDAAwD;AAC3C,QAAA,eAAe,GAAG,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;AAE1E,iGAAiG;AACjG,MAAM,YAAY,GAAG,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AAE7D,4FAA4F;AAC5F,MAAM,iBAAiB,GAAG;IACxB,eAAe,EAAE;QACf,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,UAAU;QAClB,gBAAgB,EAAE,MAAM;QACxB,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;QACtB,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,IAAI;QACZ,eAAe,EAAE,IAAI;QACrB,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,IAAI;QACf,gCAAgC,EAAE,IAAI;QACtC,iBAAiB,EAA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run the beta publish. */
6
+ export declare function runVerify(opts?: VerifyOptions): void;
7
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/commands/verify.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,IAAI,GAAE,aAAkB,GAAG,IAAI,CAWxD"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runVerify = runVerify;
4
+ /**
5
+ * verify.ts — `devkit verify`: publish verification.
6
+ *
7
+ * Owner context: @sharpee/devkit (ADR-180 Phase 3d). Replaces the dead `publish:beta`
8
+ * chain: builds the npm output via tsf and dry-runs the publish, so the staged
9
+ * packages are proven installable/publishable without releasing.
10
+ *
11
+ * Public interface: runVerify(opts) -> void.
12
+ */
13
+ const node_child_process_1 = require("node:child_process");
14
+ const repo_1 = require("../repo");
15
+ /** Build the npm staging (`tsf build --npm`) and dry-run the beta publish. */
16
+ function runVerify(opts = {}) {
17
+ const root = opts.root ?? (0, repo_1.findRepoRoot)();
18
+ const tsf = (0, repo_1.tsfBin)(root);
19
+ const log = (m) => !opts.quiet && console.log(m);
20
+ const stdio = opts.quiet ? 'ignore' : 'inherit';
21
+ log('=== devkit verify: tsf build --npm ===');
22
+ (0, node_child_process_1.execFileSync)(tsf, ['build', '--npm'], { cwd: root, stdio });
23
+ log('=== devkit verify: tsf publish --tag beta --dry-run ===');
24
+ (0, node_child_process_1.execFileSync)(tsf, ['publish', '--tag', 'beta', '--dry-run'], { cwd: root, stdio });
25
+ log('verify: npm build + publish dry-run OK');
26
+ }
27
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/commands/verify.ts"],"names":[],"mappings":";;AAkBA,8BAWC;AA7BD;;;;;;;;GAQG;AACH,2DAAkD;AAClD,kCAA+C;AAO/C,8EAA8E;AAC9E,SAAgB,SAAS,CAAC,OAAsB,EAAE;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAA,mBAAY,GAAE,CAAC;IACzC,MAAM,GAAG,GAAG,IAAA,aAAM,EAAC,IAAI,CAAC,CAAC;IACzB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhD,GAAG,CAAC,wCAAwC,CAAC,CAAC;IAC9C,IAAA,iCAAY,EAAC,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5D,GAAG,CAAC,yDAAyD,CAAC,CAAC;IAC/D,IAAA,iCAAY,EAAC,GAAG,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACnF,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface ZifmiaBuildOptions {
2
+ quiet?: boolean;
3
+ }
4
+ /**
5
+ * Build the zifmia server and surface the Story Runtime Baseline version (for the
6
+ * operator's `docker build --build-arg BASELINE_VERSION=`).
7
+ * @throws if tools/zifmia is absent or the build produces no dist/.
8
+ */
9
+ export declare function buildZifmiaServer(root: string, opts?: ZifmiaBuildOptions): void;
10
+ //# sourceMappingURL=zifmia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zifmia.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/commands/zifmia.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,kBAAuB,GAAG,IAAI,CAgCnF"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildZifmiaServer = buildZifmiaServer;
4
+ /**
5
+ * zifmia.ts — `devkit build --zifmia`: build the corrected multi-user server
6
+ * (ADR-177) at tools/zifmia/ (build.sh build_zifmia_server, 996-1032).
7
+ *
8
+ * Owner context: @sharpee/devkit (ADR-180 Phase 3c). devkit invokes the zifmia
9
+ * package's own build verbatim (`pnpm --filter @sharpee/zifmia build`) — it does
10
+ * not reimplement it. Per ADR-180 the `.sharpee` story bundle is deferred, so this
11
+ * target does not build one.
12
+ *
13
+ * Public interface: buildZifmiaServer(root, opts) -> void.
14
+ */
15
+ const node_child_process_1 = require("node:child_process");
16
+ const node_fs_1 = require("node:fs");
17
+ const node_path_1 = require("node:path");
18
+ /**
19
+ * Build the zifmia server and surface the Story Runtime Baseline version (for the
20
+ * operator's `docker build --build-arg BASELINE_VERSION=`).
21
+ * @throws if tools/zifmia is absent or the build produces no dist/.
22
+ */
23
+ function buildZifmiaServer(root, opts = {}) {
24
+ const log = (m) => !opts.quiet && console.log(m);
25
+ const zifmiaDir = (0, node_path_1.join)(root, 'tools', 'zifmia');
26
+ if (!(0, node_fs_1.existsSync)(zifmiaDir))
27
+ throw new Error('tools/zifmia not found');
28
+ log('=== Building zifmia (multi-user server, ADR-177) ===');
29
+ (0, node_child_process_1.execFileSync)('pnpm', ['--filter', '@sharpee/zifmia', 'build'], {
30
+ cwd: root,
31
+ stdio: opts.quiet ? 'ignore' : 'inherit',
32
+ });
33
+ // ADR-178 §AC-3: surface the baseline version sourced from the built manifest.
34
+ const baselineMod = (0, node_path_1.join)(root, 'packages', 'story-runtime-baseline', 'dist', 'index.js');
35
+ if ((0, node_fs_1.existsSync)(baselineMod)) {
36
+ try {
37
+ const ver = (0, node_child_process_1.execFileSync)('node', ['-p', `require(${JSON.stringify(baselineMod)}).BASELINE_VERSION`], {
38
+ cwd: root,
39
+ encoding: 'utf8',
40
+ }).trim();
41
+ if (ver) {
42
+ log(`Story Runtime Baseline: v${ver}`);
43
+ log(` (docker build expects --build-arg BASELINE_VERSION=${ver}; docker-compose.yml does this automatically)`);
44
+ }
45
+ }
46
+ catch {
47
+ /* baseline version is informational only — never fail the build over it */
48
+ }
49
+ }
50
+ // Invariant: assert the server dist exists (no silent success).
51
+ const dist = (0, node_path_1.join)(zifmiaDir, 'dist');
52
+ if (!(0, node_fs_1.existsSync)(dist))
53
+ throw new Error('zifmia build produced no tools/zifmia/dist/');
54
+ log('Output: tools/zifmia/dist/');
55
+ }
56
+ //# sourceMappingURL=zifmia.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zifmia.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/commands/zifmia.ts"],"names":[],"mappings":";;AAwBA,8CAgCC;AAxDD;;;;;;;;;;GAUG;AACH,2DAAkD;AAClD,qCAAqC;AACrC,yCAAiC;AAMjC;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAY,EAAE,OAA2B,EAAE;IAC3E,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,IAAA,oBAAU,EAAC,SAAS,CAAC;QAAE,MAAM,IAAI,KAAK,CAA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> its staging subdirectory. The directory name
4
+ * is not assumed to equal the short package name, so each package.json is read.
5
+ * @throws if stagingDir does not exist.
6
+ */
7
+ export declare function scanStaging(stagingDir: string): StagingMap;
8
+ /** The story's directly-declared `@sharpee/*` dependencies (the closure seed). */
9
+ export declare function readSharpeeSeed(storyPkgPath: string): string[];
10
+ /**
11
+ * Transitive closure over `@sharpee/*` deps. Pure: `depsOf(name)` returns the
12
+ * `@sharpee/*` deps of `name`. Returns every reachable package including the seed.
13
+ */
14
+ export declare function computeClosure(seed: string[], depsOf: (name: string) => string[]): Set<string>;
15
+ /** `depsOf` backed by the staging map — only deps present in staging are followed. */
16
+ export declare function stagingDepsOf(stagingDir: string, staging: StagingMap, name: string): string[];
17
+ export interface GenerateConsumerOptions {
18
+ /** 'local' packs the full closure as tarballs from staging; 'registry' declares seed deps. */
19
+ mode: 'local' | 'registry';
20
+ /** Path to the story's package.json (source of the seed deps). */
21
+ storyPkgPath: string;
22
+ /** `~/.tsf-publish/sharpee` — the `tsf build --npm` output (local mode only). */
23
+ stagingDir: string;
24
+ /** Directory to write tarballs into (local mode only). */
25
+ vendorDir: string;
26
+ /** Where the generated consumer package.json is written. */
27
+ outPkgPath: string;
28
+ /** Registry version/range for `@sharpee/*` deps in registry mode (default 'latest'). */
29
+ registryVersion?: string;
30
+ }
31
+ export interface GenerateConsumerResult {
32
+ /** Packages written as runtime deps (full closure in local mode; seed in registry mode). */
33
+ closure: string[];
34
+ /** true if transcript-tester is available as a dev dep (always true in registry mode). */
35
+ haveTranscriptTester: boolean;
36
+ }
37
+ /**
38
+ * Generate the consumer package.json.
39
+ *
40
+ * Local mode packs the story's **full transitive `@sharpee` closure** into tarballs
41
+ * and `file:`-refs them — required because `file:` deps do not resolve their own
42
+ * `@sharpee` deps from anywhere. Registry mode declares only the story's **seed**
43
+ * `@sharpee` deps and lets npm resolve transitive deps from the registry, exactly
44
+ * as a real consumer install would (avoids staging-vs-registry graph divergence).
45
+ *
46
+ * @throws (local mode) if any seed dep is absent from the local staging.
47
+ */
48
+ export declare function generateConsumer(opts: GenerateConsumerOptions): GenerateConsumerResult;
49
+ //# sourceMappingURL=consumer-gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumer-gen.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/devkit/src/consumer-gen.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAa1D;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAG9D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAU9F;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAK7F;AAED,MAAM,WAAW,uBAAuB;IACtC,8FAA8F;IAC9F,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,4FAA4F;IAC5F,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,0FAA0F;IAC1F,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,sBAAsB,CAwDtF"}