fix: use Gitea-compatible package scope
This commit is contained in:
@@ -13,7 +13,7 @@ A native Pi extension that coordinates trusted personal policies after workspace
|
||||
Installation is a separate, user-level mutation and is **not** performed by this repository's tests:
|
||||
|
||||
```bash
|
||||
pi install npm:@_jb/pi-native-hooks
|
||||
pi install npm:@jbcode/pi-native-hooks
|
||||
```
|
||||
|
||||
For monorepo development, use the curated link policy or load `extensions/native-hooks/extensions/pi-native-hooks/index.ts` directly.
|
||||
|
||||
@@ -113,7 +113,7 @@ The loader must:
|
||||
7. isolate a throwing/invalid module so other policies still load, while surfacing the exact file and error; and
|
||||
8. reload policies only when Pi recreates the extension on `/reload` or session replacement.
|
||||
|
||||
The package exposes `@_jb/pi-native-hooks/policy` type declarations. An authorized initializer writes a personal `tsconfig.json` with a path mapping to the installed package so policies can use `import type` plus `satisfies` without a runtime package import. Runtime validation remains authoritative because type checking can be skipped or stale.
|
||||
The package exposes `@jbcode/pi-native-hooks/policy` type declarations. An authorized initializer writes a personal `tsconfig.json` with a path mapping to the installed package so policies can use `import type` plus `satisfies` without a runtime package import. Runtime validation remains authoritative because type checking can be skipped or stale.
|
||||
|
||||
Suggested personal layout:
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { VerificationPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { VerificationPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const manifests = new Set(["package.json", "bun.lock", "tsconfig.json"]);
|
||||
const behavior = (path: string) => /^(extensions|scripts|services|skills|config)\//.test(path) || manifests.has(path);
|
||||
const types = (path: string) => /\.tsx?$/.test(path) || manifests.has(path);
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import type { VerificationPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { VerificationPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const manifests = new Set(["package.json", "bun.lock", "tsconfig.json"]);
|
||||
const behavior = (path: string) => /^(extensions|src|tests|examples|skills)\//.test(path) || manifests.has(path);
|
||||
const types = (path: string) => /\.tsx?$/.test(path) || manifests.has(path);
|
||||
export default { kind: "verification", id: "pi-native-hooks-verification", project: { matches: (project) => project.packageName === "@_jb/pi-native-hooks" }, requirements: [
|
||||
export default { kind: "verification", id: "pi-native-hooks-verification", project: { matches: (project) => project.packageName === "@jbcode/pi-native-hooks" }, requirements: [
|
||||
{ id: "tests", command: "bun run test", cwd: "project-root", affects: behavior },
|
||||
{ id: "typecheck", command: "bun run typecheck", cwd: "project-root", affects: types },
|
||||
] } satisfies VerificationPolicy;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { DiagnosticPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { DiagnosticPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const ruleIds = new Set(["typescript-no-dynamic-import-ts", "typescript-no-dynamic-import-tsx"]);
|
||||
export default {
|
||||
kind: "diagnostic", id: "typescript-no-dynamic-import", analyzerKeys: ["ast-grep:personal"],
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { DiagnosticPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { DiagnosticPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const ruleIds = new Set(["typescript-no-non-null-assertion-ts", "typescript-no-non-null-assertion-tsx"]);
|
||||
export default {
|
||||
kind: "diagnostic", id: "typescript-no-non-null-assertion", analyzerKeys: ["ast-grep:personal"],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"allowImportingTsExtensions": true,
|
||||
"paths": { "@_jb/pi-native-hooks/policy": ["__PI_NATIVE_HOOKS_PACKAGE_ROOT__/src/policy.ts"] }
|
||||
"paths": { "@jbcode/pi-native-hooks/policy": ["__PI_NATIVE_HOOKS_PACKAGE_ROOT__/src/policy.ts"] }
|
||||
},
|
||||
"include": ["policies/*.ts"]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { VerificationPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { VerificationPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const manifests = new Set(["package.json", "bun.lock", "tsconfig.json"]);
|
||||
const behavior = (path: string) => /^(extensions|scripts|services|skills|config)\//.test(path) || manifests.has(path);
|
||||
const types = (path: string) => /\.tsx?$/.test(path) || manifests.has(path);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { VerificationPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { VerificationPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const manifests = new Set(["package.json", "bun.lock", "tsconfig.json"]);
|
||||
const behavior = (path: string) => /^(extensions|src|tests|examples|skills)\//.test(path) || manifests.has(path);
|
||||
const types = (path: string) => /\.tsx?$/.test(path) || manifests.has(path);
|
||||
export default { kind: "verification", id: "pi-native-hooks-verification", project: { matches: (project) => project.packageName === "@_jb/pi-native-hooks" }, requirements: [
|
||||
export default { kind: "verification", id: "pi-native-hooks-verification", project: { matches: (project) => project.packageName === "@jbcode/pi-native-hooks" }, requirements: [
|
||||
{ id: "tests", command: "bun run test", cwd: "project-root", affects: behavior },
|
||||
{ id: "typecheck", command: "bun run typecheck", cwd: "project-root", affects: types },
|
||||
] } satisfies VerificationPolicy;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DiagnosticPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { DiagnosticPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const ruleIds = new Set(["typescript-no-dynamic-import-ts", "typescript-no-dynamic-import-tsx"]);
|
||||
export default {
|
||||
kind: "diagnostic", id: "typescript-no-dynamic-import", analyzerKeys: ["ast-grep:personal"],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DiagnosticPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { DiagnosticPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const ruleIds = new Set(["typescript-no-non-null-assertion-ts", "typescript-no-non-null-assertion-tsx"]);
|
||||
export default {
|
||||
kind: "diagnostic", id: "typescript-no-non-null-assertion", analyzerKeys: ["ast-grep:personal"],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@_jb/pi-native-hooks",
|
||||
"name": "@jbcode/pi-native-hooks",
|
||||
"version": "0.1.0",
|
||||
"description": "Native Pi hooks runtime for shared diagnostics and verification gates.",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Policy contracts
|
||||
|
||||
The authoritative declarations are exported by `@_jb/pi-native-hooks/policy` from `src/policy.ts`. Do not copy them into personal config.
|
||||
The authoritative declarations are exported by `@jbcode/pi-native-hooks/policy` from `src/policy.ts`. Do not copy them into personal config.
|
||||
|
||||
A diagnostic policy declares `kind`, a unique `id`, analyzer keys, `appliesTo`, and a pure `evaluate`. `evaluate` receives readonly normalized snapshots and a process-free policy context. Filter findings by exact rule ID and return bounded guidance plus the supported suppression form.
|
||||
|
||||
@@ -9,7 +9,7 @@ A verification policy declares a project matcher and exact requirements. Each re
|
||||
Use:
|
||||
|
||||
```ts
|
||||
import type { DiagnosticPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { DiagnosticPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
export default { /* ... */ } satisfies DiagnosticPolicy;
|
||||
```
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { VerificationPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { VerificationPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const manifests = new Set(["package.json", "bun.lock", "tsconfig.json"]);
|
||||
const behavior = (path: string) => /^(extensions|scripts|services|skills|config)\//.test(path) || manifests.has(path);
|
||||
const types = (path: string) => /\.tsx?$/.test(path) || manifests.has(path);
|
||||
|
||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
import type { VerificationPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { VerificationPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const manifests = new Set(["package.json", "bun.lock", "tsconfig.json"]);
|
||||
const behavior = (path: string) => /^(extensions|src|tests|examples|skills)\//.test(path) || manifests.has(path);
|
||||
const types = (path: string) => /\.tsx?$/.test(path) || manifests.has(path);
|
||||
export default { kind: "verification", id: "pi-native-hooks-verification", project: { matches: (project) => project.packageName === "@_jb/pi-native-hooks" }, requirements: [
|
||||
export default { kind: "verification", id: "pi-native-hooks-verification", project: { matches: (project) => project.packageName === "@jbcode/pi-native-hooks" }, requirements: [
|
||||
{ id: "tests", command: "bun run test", cwd: "project-root", affects: behavior },
|
||||
{ id: "typecheck", command: "bun run typecheck", cwd: "project-root", affects: types },
|
||||
] } satisfies VerificationPolicy;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { DiagnosticPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { DiagnosticPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const ruleIds = new Set(["typescript-no-dynamic-import-ts", "typescript-no-dynamic-import-tsx"]);
|
||||
export default {
|
||||
kind: "diagnostic", id: "typescript-no-dynamic-import", analyzerKeys: ["ast-grep:personal"],
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { DiagnosticPolicy } from "@_jb/pi-native-hooks/policy";
|
||||
import type { DiagnosticPolicy } from "@jbcode/pi-native-hooks/policy";
|
||||
const ruleIds = new Set(["typescript-no-non-null-assertion-ts", "typescript-no-non-null-assertion-tsx"]);
|
||||
export default {
|
||||
kind: "diagnostic", id: "typescript-no-non-null-assertion", analyzerKeys: ["ast-grep:personal"],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"allowImportingTsExtensions": true,
|
||||
"paths": { "@_jb/pi-native-hooks/policy": ["__PI_NATIVE_HOOKS_PACKAGE_ROOT__/src/policy.ts"] }
|
||||
"paths": { "@jbcode/pi-native-hooks/policy": ["__PI_NATIVE_HOOKS_PACKAGE_ROOT__/src/policy.ts"] }
|
||||
},
|
||||
"include": ["policies/*.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user