@pieai/doc-gov 0.3.2 → 0.3.4

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/README.md CHANGED
@@ -6,6 +6,9 @@ AI-assisted projects.
6
6
  It checks whether governed Markdown documents have the right frontmatter,
7
7
  lifecycle status, links, manifest freshness, agents-routing, and project wiring.
8
8
 
9
+ `@pieai/doc-gov` is the validator package. For reusable starter/profile assets
10
+ and read-only project-level init/sync checks, use `@pieai/pro-gov` beside it.
11
+
9
12
  ## Install
10
13
 
11
14
  ```bash
@@ -42,7 +45,7 @@ pnpm doc-gov migrate --profile engineering-runtime --check
42
45
  By default, Project Governance System governs:
43
46
 
44
47
  - `docs/**`
45
- - AI entry files such as `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md`
48
+ - AI entry files/config adapters such as `AGENTS.md`, `CLAUDE.md`, and `.gemini/settings.json`
46
49
  - documentation-governance templates, manifest, and agents-routing files
47
50
 
48
51
  It does not try to swallow product artifacts, prompts, generated media,
@@ -61,5 +64,6 @@ The CLI is in public preview. The read-only checks are the stable path:
61
64
  - `doctor`
62
65
  - `migrate --profile <profile> --check`
63
66
 
64
- Future `migrate --apply` and full init profiles should be added only after more
65
- real projects prove the same migration shape.
67
+ Future write-mode migration or apply behavior should be added only after more
68
+ real projects prove the same migration shape. Project-level write behavior
69
+ belongs in `pro-gov`, not in the validator by default.
package/cli-guide.md CHANGED
@@ -6,6 +6,10 @@ This package is the upstream CLI source for Project Governance System. It can
6
6
  be installed by downstream projects as `@pieai/doc-gov` so scripts, hooks, and
7
7
  CI all use the same CLI source.
8
8
 
9
+ It is intentionally the validator package. Install `@pieai/pro-gov` beside it
10
+ when a project needs packaged starter/profile assets or read-only init/sync
11
+ planning.
12
+
9
13
  ## Lifecycle
10
14
 
11
15
  Normal documents:
@@ -86,4 +90,6 @@ pnpm --filter @pieai/doc-gov typecheck
86
90
 
87
91
  This package is the preferred CLI source for new adoption work. Existing
88
92
  legacy projects should move from local CLI copies to `@pieai/doc-gov` when
89
- their scripts, local hooks, and CI are updated together.
93
+ their scripts, local hooks, and CI are updated together. Use `@pieai/pro-gov`
94
+ for the project-level asset surface instead of copying the whole upstream
95
+ repository into each target project.
package/dist/cli.js CHANGED
@@ -869,8 +869,9 @@ function runCheck() {
869
869
  }
870
870
 
871
871
  // src/commands/doctor.ts
872
+ import { spawnSync } from "node:child_process";
872
873
  import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
873
- import { join as join9 } from "node:path";
874
+ import { isAbsolute, join as join9, resolve as resolve2 } from "node:path";
874
875
 
875
876
  // src/core/router-integrity.ts
876
877
  import { existsSync as existsSync6, readdirSync as readdirSync5, readFileSync as readFileSync6 } from "node:fs";
@@ -1264,7 +1265,7 @@ function checkRouterIntegrity(rootDir = process.cwd()) {
1264
1265
  issues.push({
1265
1266
  file,
1266
1267
  code: "project-root-integration-path",
1267
- message: `Project-level root integrations path must not exist: ${file}. Keep upstream integration docs in project-governance-system; use AGENTS.md or docs/reference/integrations/ only when project-specific guidance is needed.`
1268
+ message: `Project-level root integrations path must not exist: ${file}. Keep upstream integration docs in the Project Governance System upstream repository; use AGENTS.md or docs/reference/integrations/ only when project-specific guidance is needed.`
1268
1269
  });
1269
1270
  }
1270
1271
  }
@@ -1333,8 +1334,20 @@ function checkRouterIntegrity(rootDir = process.cwd()) {
1333
1334
  function isCentralRepository(rootDir) {
1334
1335
  const packageJsonPath = join8(rootDir, "package.json");
1335
1336
  if (!existsSync6(packageJsonPath)) return false;
1336
- const packageJson = readFileSync6(packageJsonPath, "utf8");
1337
- return packageJson.includes('"name": "project-governance-system"') && existsSync6(join8(rootDir, "profiles")) && existsSync6(join8(rootDir, "starter")) && existsSync6(join8(rootDir, "integrations"));
1337
+ const packageName = readPackageName(packageJsonPath);
1338
+ const centralPackageNames = /* @__PURE__ */ new Set(["project-governance-system", "pro-gov"]);
1339
+ return centralPackageNames.has(packageName) && hasCentralRepositoryShape(rootDir);
1340
+ }
1341
+ function readPackageName(packageJsonPath) {
1342
+ try {
1343
+ const packageJson = JSON.parse(readFileSync6(packageJsonPath, "utf8"));
1344
+ return typeof packageJson.name === "string" ? packageJson.name : "";
1345
+ } catch {
1346
+ return "";
1347
+ }
1348
+ }
1349
+ function hasCentralRepositoryShape(rootDir) {
1350
+ return existsSync6(join8(rootDir, "profiles")) && existsSync6(join8(rootDir, "starter")) && existsSync6(join8(rootDir, "integrations"));
1338
1351
  }
1339
1352
  function validateProjectAgentsRouting(rootDir) {
1340
1353
  const issues = [];
@@ -1552,8 +1565,8 @@ function checkLefthook(rootDir) {
1552
1565
  });
1553
1566
  }
1554
1567
  }
1555
- const preCommit = join9(rootDir, ".git/hooks/pre-commit");
1556
- const commitMsg = join9(rootDir, ".git/hooks/commit-msg");
1568
+ const preCommit = resolveGitHookPath(rootDir, "pre-commit");
1569
+ const commitMsg = resolveGitHookPath(rootDir, "commit-msg");
1557
1570
  if (!hookCallsLefthook(preCommit)) {
1558
1571
  issues.push({
1559
1572
  severity: "error",
@@ -1603,6 +1616,14 @@ function checkDocsCheckWorkflow(rootDir) {
1603
1616
  function hookCallsLefthook(path) {
1604
1617
  return existsSync7(path) && readFileSync7(path, "utf8").includes("lefthook");
1605
1618
  }
1619
+ function resolveGitHookPath(rootDir, hookName) {
1620
+ const result = spawnSync("git", ["-C", rootDir, "rev-parse", "--git-path", `hooks/${hookName}`], {
1621
+ encoding: "utf8"
1622
+ });
1623
+ const gitPath = result.status === 0 ? result.stdout.trim() : "";
1624
+ if (!gitPath) return join9(rootDir, ".git/hooks", hookName);
1625
+ return isAbsolute(gitPath) ? gitPath : resolve2(rootDir, gitPath);
1626
+ }
1606
1627
 
1607
1628
  // src/commands/find.ts
1608
1629
  function runFind(args2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pieai/doc-gov",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "AI-native documentation governance CLI for project docs, agent routing, and lifecycle checks.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -10,15 +10,15 @@
10
10
  "project-management",
11
11
  "markdown"
12
12
  ],
13
- "homepage": "https://github.com/PieAIStudio/project-governance-system#readme",
13
+ "homepage": "https://github.com/PieAIStudio/ProjectGovernanceSystem#readme",
14
14
  "bugs": {
15
- "url": "https://github.com/PieAIStudio/project-governance-system/issues"
15
+ "url": "https://github.com/PieAIStudio/ProjectGovernanceSystem/issues"
16
16
  },
17
17
  "license": "MIT",
18
18
  "author": "PieAI <PIEAI@hotmail.com>",
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/PieAIStudio/project-governance-system.git",
21
+ "url": "git+https://github.com/PieAIStudio/ProjectGovernanceSystem.git",
22
22
  "directory": "packages/doc-gov"
23
23
  },
24
24
  "bin": {