@miller-tech/uap 1.148.16 → 1.148.17

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-preflight.d.ts","sourceRoot":"","sources":["../../src/delivery/project-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,EAAE,EAAE,OAAO,CAAC;IACZ,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,iDAAiD;AACjD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAsC7D;AAED,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAKtE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Project preflight — refuse to start a mission in a project that structurally
3
+ * CANNOT deliver, and self-heal the config posture that must always hold.
4
+ *
5
+ * Why this exists: a fresh scaffold silently reproduced two blockers that had
6
+ * already been diagnosed and hand-fixed once. `uap init` did not `git init`, so
7
+ * the project was not a repo — and deliver's candidate workspace is worktree
8
+ * based, so deliver, epics, orchestration and tasks were ALL dead. Nothing said
9
+ * so; the mission just failed to make progress. A hand-patched project is not a
10
+ * fix, because the next scaffold reset recreates the same hole.
11
+ *
12
+ * Two classes of problem, deliberately handled differently:
13
+ * - BLOCKER (not a git repo): deliver cannot function. Fail loudly with the
14
+ * exact command to fix it. Failing closed beats burning a turn budget on a
15
+ * mission that cannot land.
16
+ * - POSTURE (deliver.orchestrate / deliver.epics unset): the desired state is
17
+ * "always on". Refusing to run would punish every project that simply never
18
+ * set the key, so SELF-HEAL: write the intended posture and say so. Explicit
19
+ * `false`/`'off'` is a real operator decision and is never overridden.
20
+ */
21
+ import { spawnSync } from 'child_process';
22
+ import { existsSync, readFileSync, writeFileSync } from 'fs';
23
+ import { join } from 'path';
24
+ /** True when `dir` is inside a git work tree. */
25
+ export function isGitRepo(dir) {
26
+ const r = spawnSync('git', ['rev-parse', '--is-inside-work-tree'], {
27
+ cwd: dir,
28
+ encoding: 'utf-8',
29
+ stdio: ['ignore', 'pipe', 'ignore'],
30
+ });
31
+ return r.status === 0 && String(r.stdout).trim() === 'true';
32
+ }
33
+ /**
34
+ * Check a project can actually deliver, healing config posture as needed.
35
+ * Pure-ish: only writes `.uap.json`, and only to add absent keys.
36
+ */
37
+ export function preflightProject(dir) {
38
+ const blockers = [];
39
+ const healed = [];
40
+ if (!isGitRepo(dir)) {
41
+ blockers.push('not a git repository — deliver runs each candidate in a git worktree, so ' +
42
+ 'deliver, epics, orchestration and tasks cannot run at all here.\n' +
43
+ ` fix: git -C ${dir} init && git -C ${dir} add -A && git -C ${dir} commit -m "baseline"`);
44
+ }
45
+ const configPath = join(dir, '.uap.json');
46
+ if (existsSync(configPath)) {
47
+ try {
48
+ const cfg = JSON.parse(readFileSync(configPath, 'utf-8'));
49
+ const deliver = cfg.deliver ?? {};
50
+ let changed = false;
51
+ // Absent => the intended always-on posture. An explicit false/'off' is an
52
+ // operator decision and must survive.
53
+ for (const key of ['orchestrate', 'epics']) {
54
+ if (deliver[key] === undefined) {
55
+ deliver[key] = 'on';
56
+ healed.push(`deliver.${key} was unset — defaulted to "on"`);
57
+ changed = true;
58
+ }
59
+ }
60
+ if (changed) {
61
+ cfg.deliver = deliver;
62
+ writeFileSync(configPath, JSON.stringify(cfg, null, 2));
63
+ }
64
+ }
65
+ catch {
66
+ // A malformed .uap.json is the config layer's problem to report, not ours;
67
+ // never let preflight throw out of a mission start.
68
+ }
69
+ }
70
+ return { ok: blockers.length === 0, blockers, healed };
71
+ }
72
+ /** Human-readable preflight failure, with the fix inline. */
73
+ export function formatPreflightFailure(result) {
74
+ return [
75
+ 'This project cannot deliver:',
76
+ ...result.blockers.map((b) => ` ✗ ${b}`),
77
+ ].join('\n');
78
+ }
79
+ //# sourceMappingURL=project-preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-preflight.js","sourceRoot":"","sources":["../../src/delivery/project-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAW5B,iDAAiD;AACjD,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,uBAAuB,CAAC,EAAE;QACjE,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;KACpC,CAAC,CAAC;IACH,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QACpB,QAAQ,CAAC,IAAI,CACX,2EAA2E;YACzE,mEAAmE;YACnE,iBAAiB,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,uBAAuB,CAC5F,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAC1C,IAAI,UAA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@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.148.16",
3
+ "version": "1.148.17",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",