create-pmos 0.464.0 → 0.465.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.464.0",
3
+ "version": "0.465.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -32,6 +32,19 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.465.0",
37
+ "at": "2026-10-31T03:26:05.595Z",
38
+ "f": 3,
39
+ "prs": [
40
+ {
41
+ "n": 1117,
42
+ "t": "A folder with no profile file and no code is a document repository (D68)",
43
+ "s": "A folder with no profile file and no code is a document repository",
44
+ "k": "new"
45
+ }
46
+ ]
47
+ },
35
48
  {
36
49
  "v": "0.464.0",
37
50
  "at": "2026-10-31T02:53:30.027Z",
@@ -284,19 +297,6 @@
284
297
  "k": "new"
285
298
  }
286
299
  ]
287
- },
288
- {
289
- "v": "0.445.0",
290
- "at": "2026-10-29T02:05:03.398Z",
291
- "f": 3,
292
- "prs": [
293
- {
294
- "n": 1090,
295
- "t": "Faster pages, panels on Board and Intelligence, task status on timelines, Jira moves (feedback batch 19)",
296
- "s": "Faster pages, panels on Board and Intelligence, task status on timelines, Jira moves (feedback batch 19)",
297
- "k": "new"
298
- }
299
- ]
300
300
  }
301
301
  ]
302
302
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@ac4e7733
1
+ kernel-source: pmos@24687539
2
2
  assembled: 2026-10-31
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-31T02:53:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-31T03:26:02Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-31T02:53:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-31T03:26:02Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-31T02:53:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-31T03:26:02Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.465.0",
4
+ "at": "2026-10-31T03:26:05.595Z",
5
+ "f": 3,
6
+ "prs": [
7
+ {
8
+ "n": 1117,
9
+ "t": "A folder with no profile file and no code is a document repository (D68)",
10
+ "s": "A folder with no profile file and no code is a document repository",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.464.0",
4
17
  "at": "2026-10-31T02:53:30.027Z",
@@ -41,13 +41,16 @@ async function blocker(root, moment, { now = Date.now(), lastFail = 0 } = {}) {
41
41
  if (lastFail && now - lastFail < RETRY_MS) return 'the last auto-sync failed; it waits before trying again';
42
42
  const st = await syncLib.status(root);
43
43
  if (!st.ok) return st.error || 'not a git repository';
44
- if (!st.upstream) return 'no upstream';
45
44
  if (st.state === 'mid-operation') return 'a merge, rebase or cherry-pick is in progress';
46
45
  const docs = syncLib.profileOf(root) === 'pm-artifacts';
47
- const remote = st.upstream.split('/')[0];
46
+ // A document folder on a branch nobody pushed has no upstream, and is exactly what the repair puts right (a branch an agent made
47
+ // locally is the usual case), so the branch rule is read before the upstream rule there. The sync itself still needs an upstream.
48
+ if (!st.upstream && !docs) return 'no upstream';
49
+ const remote = st.upstream ? st.upstream.split('/')[0] : 'origin';
48
50
  const def = await syncLib.defaultBranchOf(root, remote);
49
- if (!def) return `PMOS cannot tell the default branch of ${remote}, so it does not save your records on its own`;
51
+ if (!def) return st.upstream ? `PMOS cannot tell the default branch of ${remote}, so it does not save your records on its own` : 'no upstream';
50
52
  if (st.branch !== def) return `'${st.branch}' is not the default branch of ${remote}, so PMOS is not saving your records. Switch this folder back to '${def}'`;
53
+ if (!st.upstream) return 'no upstream';
51
54
  if (st.ahead && !docs) {
52
55
  const paths = await syncLib.unpushedPaths(root, st.upstream);
53
56
  if (!paths) return 'the unpushed commits cannot be read';
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+ /* lib/profile-default.js — every product is a document repository unless it holds code or says otherwise (D68; the PM, 2026-10-31:
3
+ * "all user's product is document only, unless the user stated that it is others").
4
+ *
5
+ * D68 gave a new repository the `pm-artifacts` profile (create-pmos writes `.pmos-profile`; `--code` opts out). A repository made before
6
+ * that has no `.pmos-profile`, so PMOS read it as a CODE repository: its records were saved only on the default branch, nothing put its
7
+ * folder back, and a worktree was made per initiative. Scarlet, CAS and OOH Digital were like this, and Scarlet's folder sat on a feature
8
+ * branch with its records unsaved.
9
+ *
10
+ * ensure(root) → { action, why }
11
+ * 'wrote' the folder had no profile and no code: `.pmos-profile` now says pm-artifacts (written with the 'wx' flag, never over a file)
12
+ * 'kept' a `.pmos-profile` exists: whatever it says is the answer, including product-code
13
+ * 'code' the folder holds code, so it stays a code repository and nothing is written
14
+ * 'skip' not a folder, or a linked worktree (its repository owns the file)
15
+ * looksLikeCode(root) → { code, why }
16
+ *
17
+ * "Holds code" is read from the files, not guessed from a name: a package or build manifest, or a source file, within three levels, outside the
18
+ * folders a document repository fills with its own kit and records (pmos, .claude, planning, node_modules, .git and build output). A folder with
19
+ * more than CAP entries to look at counts as code: a large tree is rarely a PM's documents, and a wrong "document" would have PMOS save every file. */
20
+ const fs = require('fs');
21
+ const path = require('path');
22
+
23
+ const PROFILE = '.pmos-profile';
24
+ const CAP = 20000;
25
+ const MAX_DEPTH = 3;
26
+ const SKIP = new Set(['node_modules', '.git', 'pmos', '.claude', 'planning', 'dist', 'build', 'vendor', '.venv', 'venv', '__pycache__', '.next', 'target', 'Pods']);
27
+ const CODE_EXT = new Set(['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'py', 'rb', 'go', 'rs', 'java', 'kt', 'kts', 'swift', 'm', 'mm', 'c', 'cc', 'cpp', 'h', 'hpp', 'cs', 'php', 'scala', 'dart', 'lua', 'ex', 'exs']);
28
+ const MANIFESTS = new Set(['package.json', 'pyproject.toml', 'requirements.txt', 'setup.py', 'go.mod', 'Cargo.toml', 'pom.xml', 'build.gradle', 'build.gradle.kts', 'Gemfile', 'composer.json', 'Package.swift', 'Podfile', 'pubspec.yaml', 'mix.exs']);
29
+
30
+ function looksLikeCode(root, { cap = CAP } = {}) {
31
+ let seen = 0;
32
+ const walk = (dir, depth) => {
33
+ let entries; try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return null; }
34
+ for (const e of entries) {
35
+ if (++seen > cap) return `more than ${cap} entries`;
36
+ if (e.isDirectory()) {
37
+ if (/\.(xcodeproj|xcworkspace)$/.test(e.name)) return `${e.name} is an Xcode project`;
38
+ if (SKIP.has(e.name) || depth >= MAX_DEPTH) continue;
39
+ const hit = walk(path.join(dir, e.name), depth + 1);
40
+ if (hit) return hit;
41
+ } else if (MANIFESTS.has(e.name)) return `${path.relative(root, path.join(dir, e.name))} is a build manifest`;
42
+ else if (/\.(csproj|sln)$/.test(e.name)) return `${e.name} is a .NET project`;
43
+ else {
44
+ const x = path.extname(e.name).slice(1).toLowerCase();
45
+ if (x && CODE_EXT.has(x)) return `${path.relative(root, path.join(dir, e.name))} is source code`;
46
+ }
47
+ }
48
+ return null;
49
+ };
50
+ const why = walk(path.resolve(root), 0);
51
+ return { code: !!why, why: why || '' };
52
+ }
53
+
54
+ function ensure(root) {
55
+ let st; try { st = fs.statSync(root); } catch { return { action: 'skip', why: 'not a folder' }; }
56
+ if (!st.isDirectory()) return { action: 'skip', why: 'not a folder' };
57
+ const file = path.join(root, PROFILE);
58
+ if (fs.existsSync(file)) return { action: 'kept', why: 'a profile is declared' };
59
+ // `.git` as a FILE is a linked worktree (or a submodule): the repository's own folder owns the profile
60
+ try { if (fs.statSync(path.join(root, '.git')).isFile()) return { action: 'skip', why: 'a linked worktree' }; } catch { /* no .git: a folder with no git is a document folder too */ }
61
+ const c = looksLikeCode(root);
62
+ if (c.code) return { action: 'code', why: c.why };
63
+ try {
64
+ fs.writeFileSync(file, 'pm-artifacts\n# PMOS repository profile (D68): pm-artifacts | product-code\n', { flag: 'wx' });
65
+ return { action: 'wrote', why: 'no profile and no code' };
66
+ } catch (e) { return { action: e && e.code === 'EEXIST' ? 'kept' : 'skip', why: String((e && e.message) || e).slice(0, 120) }; }
67
+ }
68
+
69
+ /** On for a real server; off for a scratch server (its own PMOS_STATE_DIR, which every suite sets); PMOS_AUTO_PROFILE overrides both. */
70
+ function enabledFor(env = process.env) {
71
+ const v = String(env.PMOS_AUTO_PROFILE || '').trim();
72
+ if (v === '0') return false;
73
+ if (v === '1') return true;
74
+ return !String(env.PMOS_STATE_DIR || '').trim();
75
+ }
76
+
77
+ module.exports = { ensure, looksLikeCode, enabledFor, CAP };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.464.0",
3
+ "version": "0.465.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.464.0",
9
+ "version": "0.465.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.464.0",
3
+ "version": "0.465.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -623,9 +623,17 @@ function registerWorkspace(root, name) {
623
623
  }
624
624
  const w = { id, name: name || path.basename(abs) || abs, root: abs, addedAt: nowISO() };
625
625
  workspaces.set(id, w);
626
+ defaultProfileFor_(abs);
626
627
  saveWorkspaces(); pushWorkspaces();
627
628
  return w;
628
629
  }
630
+ // D68, and the PM's rule of 2026-10-31: every product is a document repository unless it holds code or says otherwise. A folder with no
631
+ // `.pmos-profile` and no code gets `pm-artifacts` (lib/profile-default.js), when a real server registers it and again at startup. A scratch
632
+ // server (its own PMOS_STATE_DIR, which every suite sets) writes nothing unless PMOS_AUTO_PROFILE=1; PMOS_AUTO_PROFILE=0 turns it off.
633
+ function defaultProfileFor_(root) {
634
+ if (!require('./lib/profile-default.js').enabledFor(process.env) || (HOME_ENABLED && path.resolve(root) === path.resolve(SELF_ROOT))) return null;
635
+ try { return require('./lib/profile-default.js').ensure(root); } catch { return null; }
636
+ }
629
637
  // Forgetting a workspace never touches the repo — it only stops hosting it here. Blocked
630
638
  // while it still owns sessions, so scrollback is never orphaned by a click.
631
639
  /**
@@ -10902,7 +10910,7 @@ if (require.main === module) {
10902
10910
  if (shareStore.list(STATE).length) startShareServer(); // premium-viewer-share (D97): the share links' own server, on loopback, only while a link is open
10903
10911
  if (ONLINE.settings.on && !BIND.publicHost) console.log(` online: https://${ONLINE.settings.host}/ (Cloudflare Access sign-in, tunnel ${ONLINE.settings.tunnel})`);
10904
10912
  // bring in what another machine pushed while this one was off (D70 as amended); never on the request path
10905
- { const t = setTimeout(() => { autoSync.startup().catch(() => {}); }, 3000); if (t.unref) t.unref(); }
10913
+ { const t = setTimeout(() => { for (const w of workspaces.values()) defaultProfileFor_(w.root); pushWorkspaces(); autoSync.startup().catch(() => {}); }, 3000); if (t.unref) t.unref(); }
10906
10914
  // load the route modules now, not on the first page's first call: the reload after an update no longer waits for them (page-speed)
10907
10915
  setImmediate(() => { try { routeModules.status(); } catch { /* a broken module answers on its own call */ } });
10908
10916
  });
@@ -83,6 +83,7 @@
83
83
  "folder-repair.test.js",
84
84
  "folder-needs.test.js",
85
85
  "worktree-gc.test.js",
86
+ "profile-default.test.js",
86
87
  "schedule-cli.test.js",
87
88
  "initiative-surface.test.js",
88
89
  "guide.test.js",
@@ -198,6 +199,7 @@
198
199
  "folder-repair.test.js": 4,
199
200
  "folder-needs.test.js": 1,
200
201
  "worktree-gc.test.js": 3,
202
+ "profile-default.test.js": 1,
201
203
  "program-deleted.test.js": 1,
202
204
  "schedule-cli.test.js": 3,
203
205
  "initiative-surface.test.js": 3,