@soleri/cli 1.2.0 → 1.4.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 (56) hide show
  1. package/README.md +30 -1
  2. package/dist/commands/create.js +6 -3
  3. package/dist/commands/create.js.map +1 -1
  4. package/dist/commands/governance.d.ts +2 -0
  5. package/dist/commands/governance.js +97 -0
  6. package/dist/commands/governance.js.map +1 -0
  7. package/dist/commands/hooks.js +40 -11
  8. package/dist/commands/hooks.js.map +1 -1
  9. package/dist/hook-packs/a11y/hookify.focus-ring-required.local.md +1 -0
  10. package/dist/hook-packs/a11y/hookify.semantic-html.local.md +1 -0
  11. package/dist/hook-packs/a11y/hookify.ux-touch-targets.local.md +1 -0
  12. package/dist/hook-packs/a11y/manifest.json +1 -0
  13. package/dist/hook-packs/clean-commits/hookify.no-ai-attribution.local.md +1 -0
  14. package/dist/hook-packs/clean-commits/manifest.json +1 -0
  15. package/dist/hook-packs/css-discipline/hookify.no-important.local.md +1 -0
  16. package/dist/hook-packs/css-discipline/hookify.no-inline-styles.local.md +1 -0
  17. package/dist/hook-packs/css-discipline/manifest.json +1 -0
  18. package/dist/hook-packs/full/manifest.json +1 -0
  19. package/dist/hook-packs/installer.d.ts +18 -5
  20. package/dist/hook-packs/installer.js +29 -10
  21. package/dist/hook-packs/installer.js.map +1 -1
  22. package/dist/hook-packs/installer.ts +42 -10
  23. package/dist/hook-packs/registry.d.ts +6 -2
  24. package/dist/hook-packs/registry.js +46 -13
  25. package/dist/hook-packs/registry.js.map +1 -1
  26. package/dist/hook-packs/registry.ts +49 -13
  27. package/dist/hook-packs/typescript-safety/hookify.no-any-types.local.md +1 -0
  28. package/dist/hook-packs/typescript-safety/hookify.no-console-log.local.md +1 -0
  29. package/dist/hook-packs/typescript-safety/manifest.json +1 -0
  30. package/dist/main.js +3 -1
  31. package/dist/main.js.map +1 -1
  32. package/dist/utils/checks.d.ts +1 -0
  33. package/dist/utils/checks.js +17 -0
  34. package/dist/utils/checks.js.map +1 -1
  35. package/package.json +2 -1
  36. package/src/__tests__/create.test.ts +110 -1
  37. package/src/commands/create.ts +5 -3
  38. package/src/commands/governance.ts +114 -0
  39. package/src/commands/hooks.ts +54 -11
  40. package/src/hook-packs/a11y/hookify.focus-ring-required.local.md +1 -0
  41. package/src/hook-packs/a11y/hookify.semantic-html.local.md +1 -0
  42. package/src/hook-packs/a11y/hookify.ux-touch-targets.local.md +1 -0
  43. package/src/hook-packs/a11y/manifest.json +1 -0
  44. package/src/hook-packs/clean-commits/hookify.no-ai-attribution.local.md +1 -0
  45. package/src/hook-packs/clean-commits/manifest.json +1 -0
  46. package/src/hook-packs/css-discipline/hookify.no-important.local.md +1 -0
  47. package/src/hook-packs/css-discipline/hookify.no-inline-styles.local.md +1 -0
  48. package/src/hook-packs/css-discipline/manifest.json +1 -0
  49. package/src/hook-packs/full/manifest.json +1 -0
  50. package/src/hook-packs/installer.ts +42 -10
  51. package/src/hook-packs/registry.ts +49 -13
  52. package/src/hook-packs/typescript-safety/hookify.no-any-types.local.md +1 -0
  53. package/src/hook-packs/typescript-safety/hookify.no-console-log.local.md +1 -0
  54. package/src/hook-packs/typescript-safety/manifest.json +1 -0
  55. package/src/main.ts +3 -1
  56. package/src/utils/checks.ts +18 -0
@@ -0,0 +1,114 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import type { Command } from 'commander';
5
+ import { detectAgent } from '../utils/agent-context.js';
6
+ import * as log from '../utils/logger.js';
7
+
8
+ const VALID_PRESETS = ['strict', 'moderate', 'permissive'] as const;
9
+
10
+ export function registerGovernance(program: Command): void {
11
+ program
12
+ .command('governance')
13
+ .description('Manage vault governance policy for an agent')
14
+ .option('--preset <name>', 'Apply preset (strict|moderate|permissive)')
15
+ .option('--show', 'Show current policy and quota status')
16
+ .action(async (opts: { preset?: string; show?: boolean }) => {
17
+ const agent = detectAgent();
18
+ if (!agent) {
19
+ log.fail('Not in a Soleri agent project', 'Run from an agent directory');
20
+ process.exit(1);
21
+ }
22
+
23
+ const dbPath = join(homedir(), `.${agent.agentId}`, 'vault.db');
24
+ if (!existsSync(dbPath)) {
25
+ log.fail('Vault DB not found', `Expected ${dbPath}`);
26
+ log.info('Run the agent once to initialize its vault database.');
27
+ process.exit(1);
28
+ }
29
+
30
+ // Dynamic import to avoid loading better-sqlite3 unless needed
31
+ const { Vault, Governance } = await import('@soleri/core');
32
+ const vault = new Vault(dbPath);
33
+
34
+ try {
35
+ const governance = new Governance(vault);
36
+
37
+ if (opts.preset) {
38
+ if (!VALID_PRESETS.includes(opts.preset as typeof VALID_PRESETS[number])) {
39
+ log.fail('Invalid preset', `Must be one of: ${VALID_PRESETS.join(', ')}`);
40
+ process.exit(1);
41
+ }
42
+
43
+ governance.applyPreset(
44
+ agent.agentId,
45
+ opts.preset as 'strict' | 'moderate' | 'permissive',
46
+ 'soleri-cli',
47
+ );
48
+ log.heading('Governance — Preset Applied');
49
+ log.pass(`Preset "${opts.preset}" applied to ${agent.agentId}`);
50
+ console.log();
51
+ showPolicy(governance, agent.agentId);
52
+ } else {
53
+ // Default: --show
54
+ log.heading('Governance — Current Policy');
55
+ showPolicy(governance, agent.agentId);
56
+ console.log();
57
+ showQuotaStatus(governance, agent.agentId);
58
+ }
59
+ } finally {
60
+ vault.close();
61
+ }
62
+ });
63
+ }
64
+
65
+ function showPolicy(governance: InstanceType<typeof import('@soleri/core').Governance>, agentId: string): void {
66
+ const policy = governance.getPolicy(agentId);
67
+
68
+ log.info('Quotas:');
69
+ log.dim(` Max entries total: ${policy.quotas.maxEntriesTotal}`);
70
+ log.dim(` Max entries per category: ${policy.quotas.maxEntriesPerCategory}`);
71
+ log.dim(` Max entries per type: ${policy.quotas.maxEntriesPerType}`);
72
+ log.dim(` Warn at: ${policy.quotas.warnAtPercent}%`);
73
+
74
+ console.log();
75
+ log.info('Retention:');
76
+ log.dim(` Archive after: ${policy.retention.archiveAfterDays} days`);
77
+ log.dim(` Min hits to keep: ${policy.retention.minHitsToKeep}`);
78
+ log.dim(` Delete archived after: ${policy.retention.deleteArchivedAfterDays} days`);
79
+
80
+ console.log();
81
+ log.info('Auto-capture:');
82
+ log.dim(` Enabled: ${policy.autoCapture.enabled}`);
83
+ log.dim(` Require review: ${policy.autoCapture.requireReview}`);
84
+ log.dim(` Max pending proposals: ${policy.autoCapture.maxPendingProposals}`);
85
+ log.dim(` Auto-expire: ${policy.autoCapture.autoExpireDays} days`);
86
+ }
87
+
88
+ function showQuotaStatus(governance: InstanceType<typeof import('@soleri/core').Governance>, agentId: string): void {
89
+ const status = governance.getQuotaStatus(agentId);
90
+
91
+ log.info(`Quota usage: ${status.total} / ${status.maxTotal}`);
92
+
93
+ if (status.isWarning) {
94
+ log.warn('Approaching quota limit', `${Math.round((status.total / status.maxTotal) * 100)}% used`);
95
+ } else {
96
+ log.pass('Within quota', `${Math.round((status.total / status.maxTotal) * 100)}% used`);
97
+ }
98
+
99
+ if (Object.keys(status.byType).length > 0) {
100
+ console.log();
101
+ log.info('By type:');
102
+ for (const [type, count] of Object.entries(status.byType)) {
103
+ log.dim(` ${type}: ${count}`);
104
+ }
105
+ }
106
+
107
+ if (Object.keys(status.byCategory).length > 0) {
108
+ console.log();
109
+ log.info('By category:');
110
+ for (const [cat, count] of Object.entries(status.byCategory)) {
111
+ log.dim(` ${cat}: ${count}`);
112
+ }
113
+ }
114
+ }
@@ -87,8 +87,9 @@ export function registerHooks(program: Command): void {
87
87
  hooks
88
88
  .command('add-pack')
89
89
  .argument('<pack>', 'Hook pack name')
90
- .description('Install a hook pack globally (~/.claude/)')
91
- .action((packName: string) => {
90
+ .option('--project', 'Install to project .claude/ instead of global ~/.claude/')
91
+ .description('Install a hook pack globally (~/.claude/) or per-project (--project)')
92
+ .action((packName: string, opts: { project?: boolean }) => {
92
93
  const pack = getPack(packName);
93
94
  if (!pack) {
94
95
  const available = listPacks().map((p) => p.name);
@@ -96,15 +97,17 @@ export function registerHooks(program: Command): void {
96
97
  process.exit(1);
97
98
  }
98
99
 
99
- const { installed, skipped } = installPack(packName);
100
+ const projectDir = opts.project ? process.cwd() : undefined;
101
+ const target = opts.project ? '.claude/' : '~/.claude/';
102
+ const { installed, skipped } = installPack(packName, { projectDir });
100
103
  for (const hook of installed) {
101
- log.pass(`Installed hookify.${hook}.local.md`);
104
+ log.pass(`Installed hookify.${hook}.local.md → ${target}`);
102
105
  }
103
106
  for (const hook of skipped) {
104
107
  log.dim(` hookify.${hook}.local.md — already exists, skipped`);
105
108
  }
106
109
  if (installed.length > 0) {
107
- log.info(`Pack "${packName}" installed (${installed.length} hooks)`);
110
+ log.info(`Pack "${packName}" installed (${installed.length} hooks) → ${target}`);
108
111
  } else {
109
112
  log.info(`Pack "${packName}" — all hooks already installed`);
110
113
  }
@@ -113,8 +116,9 @@ export function registerHooks(program: Command): void {
113
116
  hooks
114
117
  .command('remove-pack')
115
118
  .argument('<pack>', 'Hook pack name')
116
- .description('Remove a hook pack from ~/.claude/')
117
- .action((packName: string) => {
119
+ .option('--project', 'Remove from project .claude/ instead of global ~/.claude/')
120
+ .description('Remove a hook pack')
121
+ .action((packName: string, opts: { project?: boolean }) => {
118
122
  const pack = getPack(packName);
119
123
  if (!pack) {
120
124
  const available = listPacks().map((p) => p.name);
@@ -122,7 +126,8 @@ export function registerHooks(program: Command): void {
122
126
  process.exit(1);
123
127
  }
124
128
 
125
- const { removed } = removePack(packName);
129
+ const projectDir = opts.project ? process.cwd() : undefined;
130
+ const { removed } = removePack(packName, { projectDir });
126
131
  if (removed.length === 0) {
127
132
  log.info(`No hooks from pack "${packName}" found to remove.`);
128
133
  } else {
@@ -144,15 +149,53 @@ export function registerHooks(program: Command): void {
144
149
  for (const pack of packs) {
145
150
  const status = isPackInstalled(pack.name);
146
151
 
152
+ const versionLabel = pack.version ? ` v${pack.version}` : '';
153
+ const sourceLabel = pack.source === 'local' ? ' [local]' : '';
154
+
147
155
  if (status === true) {
148
- log.pass(`${pack.name}`, `${pack.description} (${pack.hooks.length} hooks)`);
156
+ log.pass(
157
+ `${pack.name}${versionLabel}${sourceLabel}`,
158
+ `${pack.description} (${pack.hooks.length} hooks)`,
159
+ );
149
160
  } else if (status === 'partial') {
150
- log.warn(`${pack.name}`, `${pack.description} (${pack.hooks.length} hooks) — partial`);
161
+ log.warn(
162
+ `${pack.name}${versionLabel}${sourceLabel}`,
163
+ `${pack.description} (${pack.hooks.length} hooks) — partial`,
164
+ );
151
165
  } else {
152
- log.dim(` ${pack.name} — ${pack.description} (${pack.hooks.length} hooks)`);
166
+ log.dim(
167
+ ` ${pack.name}${versionLabel}${sourceLabel} — ${pack.description} (${pack.hooks.length} hooks)`,
168
+ );
153
169
  }
154
170
  }
155
171
  });
172
+
173
+ hooks
174
+ .command('upgrade-pack')
175
+ .argument('<pack>', 'Hook pack name')
176
+ .option('--project', 'Upgrade in project .claude/ instead of global ~/.claude/')
177
+ .description('Upgrade a hook pack to the latest version (overwrites existing files)')
178
+ .action((packName: string, opts: { project?: boolean }) => {
179
+ const pack = getPack(packName);
180
+ if (!pack) {
181
+ const available = listPacks().map((p) => p.name);
182
+ log.fail(`Unknown pack "${packName}". Available: ${available.join(', ')}`);
183
+ process.exit(1);
184
+ }
185
+
186
+ const projectDir = opts.project ? process.cwd() : undefined;
187
+ const packVersion = pack.manifest.version ?? 'unknown';
188
+
189
+ // Remove then reinstall to force overwrite
190
+ removePack(packName, { projectDir });
191
+ const { installed } = installPack(packName, { projectDir });
192
+
193
+ for (const hook of installed) {
194
+ log.pass(`hookify.${hook}.local.md → v${packVersion}`);
195
+ }
196
+
197
+ log.info(`Pack "${packName}" upgraded to v${packVersion} (${installed.length} hooks)`);
198
+ });
156
199
  }
157
200
 
158
201
  function isValidEditor(editor: string): editor is EditorId {
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: a11y
3
+ # Version: 1.0.0
3
4
  # Rule: focus-ring-required
4
5
  name: focus-ring-required
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: a11y
3
+ # Version: 1.0.0
3
4
  # Rule: semantic-html
4
5
  name: semantic-html
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: a11y
3
+ # Version: 1.0.0
3
4
  # Rule: ux-touch-targets
4
5
  name: ux-touch-targets
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "a11y",
3
+ "version": "1.0.0",
3
4
  "description": "Accessibility enforcement",
4
5
  "hooks": ["semantic-html", "focus-ring-required", "ux-touch-targets"]
5
6
  }
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: clean-commits
3
+ # Version: 1.0.0
3
4
  # Rule: no-ai-attribution
4
5
  name: no-ai-attribution
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "clean-commits",
3
+ "version": "1.0.0",
3
4
  "description": "No AI attribution in git commits",
4
5
  "hooks": ["no-ai-attribution"]
5
6
  }
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: css-discipline
3
+ # Version: 1.0.0
3
4
  # Rule: no-important
4
5
  name: no-important
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: css-discipline
3
+ # Version: 1.0.0
3
4
  # Rule: no-inline-styles
4
5
  name: no-inline-styles
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "css-discipline",
3
+ "version": "1.0.0",
3
4
  "description": "CSS best practices",
4
5
  "hooks": ["no-important", "no-inline-styles"]
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "full",
3
+ "version": "1.0.0",
3
4
  "description": "Complete quality suite — all 8 hooks",
4
5
  "hooks": ["no-any-types", "no-console-log", "no-important", "no-inline-styles", "semantic-html", "focus-ring-required", "ux-touch-targets", "no-ai-attribution"],
5
6
  "composedFrom": ["typescript-safety", "a11y", "css-discipline", "clean-commits"]
@@ -1,11 +1,17 @@
1
1
  /**
2
- * Hook pack installer — copies hookify files to ~/.claude/ for global enforcement.
2
+ * Hook pack installer — copies hookify files to ~/.claude/ (global) or project .claude/ (local).
3
3
  */
4
- import { existsSync, copyFileSync, unlinkSync, mkdirSync } from 'node:fs';
4
+ import { existsSync, copyFileSync, unlinkSync, mkdirSync, readFileSync } from 'node:fs';
5
5
  import { join } from 'node:path';
6
6
  import { homedir } from 'node:os';
7
7
  import { getPack } from './registry.js';
8
8
 
9
+ /** Resolve the target .claude/ directory. */
10
+ function resolveClaudeDir(projectDir?: string): string {
11
+ if (projectDir) return join(projectDir, '.claude');
12
+ return join(homedir(), '.claude');
13
+ }
14
+
9
15
  /**
10
16
  * Resolve all hookify file paths for a pack, handling composed packs.
11
17
  * Returns a map of hook name → source file path.
@@ -38,16 +44,19 @@ function resolveHookFiles(packName: string): Map<string, string> {
38
44
  }
39
45
 
40
46
  /**
41
- * Install a hook pack globally to ~/.claude/.
47
+ * Install a hook pack to ~/.claude/ (default) or project .claude/ (--project).
42
48
  * Skips files that already exist (idempotent).
43
49
  */
44
- export function installPack(packName: string): { installed: string[]; skipped: string[] } {
50
+ export function installPack(
51
+ packName: string,
52
+ options?: { projectDir?: string },
53
+ ): { installed: string[]; skipped: string[] } {
45
54
  const pack = getPack(packName);
46
55
  if (!pack) {
47
56
  throw new Error(`Unknown hook pack: "${packName}"`);
48
57
  }
49
58
 
50
- const claudeDir = join(homedir(), '.claude');
59
+ const claudeDir = resolveClaudeDir(options?.projectDir);
51
60
  mkdirSync(claudeDir, { recursive: true });
52
61
 
53
62
  const hookFiles = resolveHookFiles(packName);
@@ -68,15 +77,18 @@ export function installPack(packName: string): { installed: string[]; skipped: s
68
77
  }
69
78
 
70
79
  /**
71
- * Remove a hook pack's files from ~/.claude/.
80
+ * Remove a hook pack's files from target directory.
72
81
  */
73
- export function removePack(packName: string): { removed: string[] } {
82
+ export function removePack(
83
+ packName: string,
84
+ options?: { projectDir?: string },
85
+ ): { removed: string[] } {
74
86
  const pack = getPack(packName);
75
87
  if (!pack) {
76
88
  throw new Error(`Unknown hook pack: "${packName}"`);
77
89
  }
78
90
 
79
- const claudeDir = join(homedir(), '.claude');
91
+ const claudeDir = resolveClaudeDir(options?.projectDir);
80
92
  const removed: string[] = [];
81
93
 
82
94
  for (const hook of pack.manifest.hooks) {
@@ -94,11 +106,14 @@ export function removePack(packName: string): { removed: string[] } {
94
106
  * Check if a pack is installed.
95
107
  * Returns true (all hooks present), false (none present), or 'partial'.
96
108
  */
97
- export function isPackInstalled(packName: string): boolean | 'partial' {
109
+ export function isPackInstalled(
110
+ packName: string,
111
+ options?: { projectDir?: string },
112
+ ): boolean | 'partial' {
98
113
  const pack = getPack(packName);
99
114
  if (!pack) return false;
100
115
 
101
- const claudeDir = join(homedir(), '.claude');
116
+ const claudeDir = resolveClaudeDir(options?.projectDir);
102
117
  let present = 0;
103
118
 
104
119
  for (const hook of pack.manifest.hooks) {
@@ -111,3 +126,20 @@ export function isPackInstalled(packName: string): boolean | 'partial' {
111
126
  if (present === pack.manifest.hooks.length) return true;
112
127
  return 'partial';
113
128
  }
129
+
130
+ /**
131
+ * Get the installed version of a hook from its file header.
132
+ * Returns null if no version found or file doesn't exist.
133
+ */
134
+ export function getInstalledHookVersion(
135
+ hook: string,
136
+ options?: { projectDir?: string },
137
+ ): string | null {
138
+ const claudeDir = resolveClaudeDir(options?.projectDir);
139
+ const filePath = join(claudeDir, `hookify.${hook}.local.md`);
140
+ if (!existsSync(filePath)) return null;
141
+
142
+ const content = readFileSync(filePath, 'utf-8');
143
+ const match = content.match(/^# Version: (.+)$/m);
144
+ return match ? match[1] : null;
145
+ }
@@ -11,21 +11,27 @@ export interface HookPackManifest {
11
11
  description: string;
12
12
  hooks: string[];
13
13
  composedFrom?: string[];
14
+ version?: string;
15
+ /** Whether this pack is built-in or user-defined */
16
+ source?: 'built-in' | 'local';
14
17
  }
15
18
 
16
19
  const __filename = fileURLToPath(import.meta.url);
17
20
  const __dirname = dirname(__filename);
18
21
 
19
22
  /** Root directory containing all built-in hook packs. */
20
- function getPacksRoot(): string {
23
+ function getBuiltinRoot(): string {
21
24
  return __dirname;
22
25
  }
23
26
 
24
- /**
25
- * List all available built-in hook packs.
26
- */
27
- export function listPacks(): HookPackManifest[] {
28
- const root = getPacksRoot();
27
+ /** Local custom packs directory. */
28
+ function getLocalRoot(): string {
29
+ return join(process.cwd(), '.soleri', 'hook-packs');
30
+ }
31
+
32
+ /** Scan a directory for pack manifests. */
33
+ function scanPacksDir(root: string, source: 'built-in' | 'local'): HookPackManifest[] {
34
+ if (!existsSync(root)) return [];
29
35
  const entries = readdirSync(root, { withFileTypes: true });
30
36
  const packs: HookPackManifest[] = [];
31
37
 
@@ -36,6 +42,7 @@ export function listPacks(): HookPackManifest[] {
36
42
 
37
43
  try {
38
44
  const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8')) as HookPackManifest;
45
+ manifest.source = source;
39
46
  packs.push(manifest);
40
47
  } catch {
41
48
  // Skip malformed manifests
@@ -46,18 +53,47 @@ export function listPacks(): HookPackManifest[] {
46
53
  }
47
54
 
48
55
  /**
49
- * Get a specific pack by name.
56
+ * List all available hook packs (built-in + local custom).
57
+ * Local packs in .soleri/hook-packs/ override built-in packs with the same name.
58
+ */
59
+ export function listPacks(): HookPackManifest[] {
60
+ const builtIn = scanPacksDir(getBuiltinRoot(), 'built-in');
61
+ const local = scanPacksDir(getLocalRoot(), 'local');
62
+
63
+ // Local packs override built-in packs with same name
64
+ const byName = new Map<string, HookPackManifest>();
65
+ for (const pack of builtIn) byName.set(pack.name, pack);
66
+ for (const pack of local) byName.set(pack.name, pack);
67
+
68
+ return Array.from(byName.values());
69
+ }
70
+
71
+ /**
72
+ * Get a specific pack by name. Local packs take precedence.
50
73
  */
51
74
  export function getPack(name: string): { manifest: HookPackManifest; dir: string } | null {
52
- const root = getPacksRoot();
53
- const dir = join(root, name);
54
- const manifestPath = join(dir, 'manifest.json');
75
+ // Check local first
76
+ const localDir = join(getLocalRoot(), name);
77
+ const localManifest = join(localDir, 'manifest.json');
78
+ if (existsSync(localManifest)) {
79
+ try {
80
+ const manifest = JSON.parse(readFileSync(localManifest, 'utf-8')) as HookPackManifest;
81
+ manifest.source = 'local';
82
+ return { manifest, dir: localDir };
83
+ } catch {
84
+ // Fall through to built-in
85
+ }
86
+ }
55
87
 
56
- if (!existsSync(manifestPath)) return null;
88
+ // Then built-in
89
+ const builtinDir = join(getBuiltinRoot(), name);
90
+ const builtinManifest = join(builtinDir, 'manifest.json');
91
+ if (!existsSync(builtinManifest)) return null;
57
92
 
58
93
  try {
59
- const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8')) as HookPackManifest;
60
- return { manifest, dir };
94
+ const manifest = JSON.parse(readFileSync(builtinManifest, 'utf-8')) as HookPackManifest;
95
+ manifest.source = 'built-in';
96
+ return { manifest, dir: builtinDir };
61
97
  } catch {
62
98
  return null;
63
99
  }
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: typescript-safety
3
+ # Version: 1.0.0
3
4
  # Rule: no-any-types
4
5
  name: no-any-types
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  # Soleri Hook Pack: typescript-safety
3
+ # Version: 1.0.0
3
4
  # Rule: no-console-log
4
5
  name: no-console-log
5
6
  enabled: true
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "typescript-safety",
3
+ "version": "1.0.0",
3
4
  "description": "Block unsafe TypeScript patterns",
4
5
  "hooks": ["no-any-types", "no-console-log"]
5
6
  }
package/src/main.ts CHANGED
@@ -8,13 +8,14 @@ import { registerInstallKnowledge } from './commands/install-knowledge.js';
8
8
  import { registerDev } from './commands/dev.js';
9
9
  import { registerDoctor } from './commands/doctor.js';
10
10
  import { registerHooks } from './commands/hooks.js';
11
+ import { registerGovernance } from './commands/governance.js';
11
12
 
12
13
  const program = new Command();
13
14
 
14
15
  program
15
16
  .name('soleri')
16
17
  .description('Developer CLI for creating and managing Soleri AI agents')
17
- .version('1.0.0');
18
+ .version('1.4.0');
18
19
 
19
20
  registerCreate(program);
20
21
  registerList(program);
@@ -23,5 +24,6 @@ registerInstallKnowledge(program);
23
24
  registerDev(program);
24
25
  registerDoctor(program);
25
26
  registerHooks(program);
27
+ registerGovernance(program);
26
28
 
27
29
  program.parse();
@@ -6,6 +6,7 @@ import { join } from 'node:path';
6
6
  import { execFileSync } from 'node:child_process';
7
7
  import { homedir } from 'node:os';
8
8
  import { detectAgent } from './agent-context.js';
9
+ import { getInstalledPacks } from '../hook-packs/registry.js';
9
10
 
10
11
  interface CheckResult {
11
12
  status: 'pass' | 'fail' | 'warn';
@@ -134,6 +135,22 @@ function checkCognee(): CheckResult {
134
135
  }
135
136
  }
136
137
 
138
+ export function checkHookPacks(): CheckResult {
139
+ const installed = getInstalledPacks();
140
+ if (installed.length === 0) {
141
+ return {
142
+ status: 'warn',
143
+ label: 'Hook packs',
144
+ detail: 'none installed — run soleri hooks list-packs',
145
+ };
146
+ }
147
+ return {
148
+ status: 'pass',
149
+ label: 'Hook packs',
150
+ detail: installed.join(', '),
151
+ };
152
+ }
153
+
137
154
  export function runAllChecks(dir?: string): CheckResult[] {
138
155
  return [
139
156
  checkNodeVersion(),
@@ -143,6 +160,7 @@ export function runAllChecks(dir?: string): CheckResult[] {
143
160
  checkNodeModules(dir),
144
161
  checkAgentBuild(dir),
145
162
  checkMcpRegistration(dir),
163
+ checkHookPacks(),
146
164
  checkCognee(),
147
165
  ];
148
166
  }