@aiwg/cli 2026.11.3 → 2026.11.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/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +3 -2
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +12 -9
- package/agentic/code/addons/aiwg-utils/rules/anti-laziness.md +2 -0
- package/agentic/code/addons/composition-engine/lib/runtime.mjs +5 -26
- package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +22 -0
- package/agentic/code/providers/capability-matrix.yaml +15 -18
- package/dist/src/a2a/hitl-authorization.js +46 -0
- package/dist/src/a2a/hitl-driver.js +5 -5
- package/dist/src/artifacts/browser-export.js +2 -0
- package/dist/src/artifacts/framework-source-digest.js +1 -1
- package/dist/src/artifacts/index-builder.js +5 -25
- package/dist/src/artifacts/index-capability.js +24 -0
- package/dist/src/artifacts/query-engine-discover-output.js +8 -3
- package/dist/src/artifacts/query-engine-rules.js +27 -9
- package/dist/src/artifacts/query-engine-scoring.js +5 -5
- package/dist/src/artifacts/query-engine-show-card.js +5 -1
- package/dist/src/artifacts/query-engine-show-load.js +1 -1
- package/dist/src/artifacts/query-engine-show.js +3 -3
- package/dist/src/artifacts/query-engine-templates.js +10 -4
- package/dist/src/artifacts/query-engine-verbose.js +18 -4
- package/dist/src/artifacts/relations-builder.js +1 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/checkpoint-handoff.js +2 -1
- package/dist/src/cli/handlers/guided-setup.js +3 -1
- package/dist/src/cli/handlers/refresh-managed-deployment.js +17 -5
- package/dist/src/cli/handlers/rules.js +1 -1
- package/dist/src/cli/handlers/sessions.js +1 -1
- package/dist/src/cli/handlers/steward.js +1 -1
- package/dist/src/cli/handlers/use.js +1 -2
- package/dist/src/cli/handlers/utility-doctor.js +5 -2
- package/dist/src/cli/handlers/workspace.js +1 -1
- package/dist/src/cli/services/deployment-probe-scope.js +40 -0
- package/dist/src/cli/services/deployment-verification.js +4 -5
- package/dist/src/config/aiwg-config.js +6 -0
- package/dist/src/config/authorization-cli.js +61 -3
- package/dist/src/config/cli-help.js +1 -1
- package/dist/src/config/cli.js +4 -2
- package/dist/src/config/host-resource-runtime.mjs +1 -1
- package/dist/src/config/user-registry.js +9 -1
- package/dist/src/config/worker-owner-lock.js +90 -10
- package/dist/src/decision/graph-flow-adapter.js +1 -1
- package/dist/src/effects/authorization-grant.js +50 -0
- package/dist/src/effects/authorization-store.js +130 -0
- package/dist/src/effects/index.js +2 -0
- package/dist/src/effects/ledger.js +1 -0
- package/dist/src/effects/lifecycle.js +1 -1
- package/dist/src/effects/reader.js +4 -0
- package/dist/src/effects/records.js +4 -0
- package/dist/src/effects/schema.js +2 -0
- package/dist/src/extensions/claude-hooks-installer.js +7 -7
- package/dist/src/extensions/muse-managed-hooks.js +11 -0
- package/dist/src/extensions/user-hook-diagnostics.js +32 -0
- package/dist/src/extensions/verified-hook-command.js +32 -0
- package/dist/src/lint/rule-conflicts.js +52 -0
- package/dist/src/lint/runner.js +3 -0
- package/dist/src/mcp/cli.mjs +3 -1
- package/dist/src/mcp/elicitation.mjs +30 -0
- package/dist/src/mcp/grok-build-config.mjs +1 -1
- package/dist/src/mcp/muse-native-config.mjs +1 -0
- package/dist/src/mcp/server.mjs +2 -0
- package/dist/src/mcp/tools/authorization.mjs +78 -0
- package/dist/src/policy/authorization-capture.js +64 -0
- package/dist/src/policy/authorization-operations.js +108 -0
- package/dist/src/policy/hitl-check.js +3 -2
- package/dist/src/policy/hitl-consume.js +14 -0
- package/dist/src/policy/hitl-durable-store.js +60 -0
- package/dist/src/policy/hitl-durable.js +60 -0
- package/dist/src/policy/hitl-receipt.js +5 -0
- package/dist/src/policy/hitl.js +44 -6
- package/dist/src/process/bounded-child-process.mjs +49 -39
- package/dist/src/providers/capability-matrix.yaml +15 -18
- package/dist/src/providers/deployment-ownership.d.mts +1 -0
- package/dist/src/providers/deployment-ownership.mjs +21 -2
- package/dist/src/providers/grok-build-headless.js +170 -77
- package/dist/src/providers/grok-build-inspect.js +1 -0
- package/dist/src/providers/grok-build-paths.js +2 -0
- package/dist/src/providers/muse-paths.js +4 -2
- package/dist/src/providers/provider-context-contracts.js +12 -4
- package/dist/src/providers/provider-definition-schema.js +6 -0
- package/dist/src/providers/provider-seeds-1.js +3 -3
- package/dist/src/providers/provider-seeds-2.js +6 -4
- package/dist/src/providers/provider-seeds-3.js +6 -6
- package/dist/src/rules/activation.d.mts +2 -0
- package/dist/src/rules/activation.mjs +16 -7
- package/dist/src/rules/inline-budget.d.mts +2 -1
- package/dist/src/rules/inline-budget.mjs +4 -2
- package/dist/src/rules/inventory.js +3 -0
- package/dist/src/rules/precedence.d.mts +6 -0
- package/dist/src/rules/precedence.mjs +49 -0
- package/dist/src/rules/project-precedence.js +73 -0
- package/dist/src/rules/rule-frontmatter.schema.json +15 -0
- package/dist/src/serve/a2a-terminal-observer.js +12 -3
- package/dist/src/serve/mission-hitl.js +20 -1
- package/dist/src/sessions/adapters/grok-build-fallback.js +33 -0
- package/dist/src/sessions/adapters/grok-build-native-records.js +64 -0
- package/dist/src/sessions/adapters/grok-build-native.js +92 -100
- package/dist/src/sessions/adapters/grok-build.js +65 -24
- package/dist/src/sessions/grok-build-cli-output.js +113 -0
- package/dist/src/sessions/grok-build-cli.js +4 -28
- package/dist/src/smiths/context-pipeline/bridge-ownership.js +4 -3
- package/dist/src/smiths/context-pipeline/finalization.js +5 -0
- package/dist/src/smiths/context-pipeline/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +20 -17
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +2 -1
- package/dist/src/smiths/context-pipeline/workspace-document.js +6 -0
- package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -12
- package/dist/src/smiths/hook-bridge/codex-translator.js +11 -14
- package/dist/src/smiths/hook-bridge/codex-trust.js +7 -2
- package/dist/src/smiths/hook-bridge/copilot-translator.js +2 -1
- package/dist/src/smiths/hook-bridge/grok-build-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +78 -0
- package/dist/src/smiths/hook-bridge/hermes-translator.js +5 -3
- package/dist/src/smiths/hook-bridge/index.js +3 -1
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +3 -2
- package/package.json +7 -1
- package/tools/agents/deploy-agents.mjs +5 -6
- package/tools/agents/deploy-options.mjs +1 -0
- package/tools/agents/providers/base-frontmatter.mjs +3 -2
- package/tools/agents/providers/claude-post-deploy.mjs +1 -1
- package/tools/agents/providers/codex-post-deploy.mjs +1 -1
- package/tools/agents/providers/generic.mjs +66 -0
- package/tools/agents/providers/grok-build.mjs +3 -1
- package/tools/agents/providers/muse-hooks.mjs +13 -11
- package/tools/agents/providers/muse-prompt-discovery.mjs +5 -1
- package/tools/agents/providers/muse.mjs +2 -1
- package/tools/agents/providers/openclaw.mjs +2 -1
- package/tools/agents/providers/rule-deployment-prepare.mjs +5 -3
- package/tools/agents/providers/rule-deployment-state.mjs +14 -6
- package/tools/agents/providers/rule-startup.mjs +11 -10
- package/tools/agents/providers/staged-directory-reference.mjs +14 -0
- package/tools/agents/providers/user-hooks.mjs +26 -0
- package/tools/cli/authorization-health.mjs +20 -0
- package/tools/cli/workspace-status.mjs +7 -0
- package/tools/commands/deploy-prompts-codex.mjs +15 -1
- package/vscode-extension/schemas/aiwg.config.v1.json +20 -0
|
@@ -5,6 +5,7 @@ import { delimiter, dirname, isAbsolute, join, parse, resolve } from 'node:path'
|
|
|
5
5
|
import { promisify } from 'node:util';
|
|
6
6
|
import { resolveGrokHomeResult } from '../providers/grok-build-paths.js';
|
|
7
7
|
import { SessionContractError } from './contracts.js';
|
|
8
|
+
import { validateGrokHeadlessEnvelope, parseGrokSessionIds } from './grok-build-cli-output.js';
|
|
8
9
|
import { validateGrokBuildMarkdown } from './adapters/grok-build.js';
|
|
9
10
|
const execFile = promisify(execFileCallback);
|
|
10
11
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -15,7 +16,7 @@ export async function grokBuildList(options, limit = 20) {
|
|
|
15
16
|
throw new SessionContractError('INVALID_ARGUMENT', 'Grok Build list limit must be 1..500');
|
|
16
17
|
}
|
|
17
18
|
const stdout = await runGrok(options, ['sessions', 'list', '--limit', String(limit)]);
|
|
18
|
-
return
|
|
19
|
+
return parseGrokSessionIds(stdout, 'list');
|
|
19
20
|
}
|
|
20
21
|
export async function grokBuildSearch(options, query, limit = 20) {
|
|
21
22
|
if (!query.trim() || query.length > 500 || /[\x00-\x1f\x7f]/.test(query)) {
|
|
@@ -25,7 +26,7 @@ export async function grokBuildSearch(options, query, limit = 20) {
|
|
|
25
26
|
throw new SessionContractError('INVALID_ARGUMENT', 'Grok Build search limit must be 1..500');
|
|
26
27
|
}
|
|
27
28
|
const stdout = await runGrok(options, ['sessions', 'search', query, '--limit', String(limit)]);
|
|
28
|
-
return
|
|
29
|
+
return parseGrokSessionIds(stdout, 'search');
|
|
29
30
|
}
|
|
30
31
|
export async function grokBuildExport(options, sessionId, outputDirectory) {
|
|
31
32
|
const id = assertGrokSessionId(sessionId);
|
|
@@ -70,6 +71,7 @@ export function parseGrokHeadlessSessionId(output, format) {
|
|
|
70
71
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
71
72
|
throw new SessionContractError('SCHEMA_DRIFT', 'Grok Build headless event must be an object');
|
|
72
73
|
}
|
|
74
|
+
validateGrokHeadlessEnvelope(value, format);
|
|
73
75
|
const id = value.sessionId;
|
|
74
76
|
if (id !== undefined) {
|
|
75
77
|
if (typeof id !== 'string' || !UUID.test(id)) {
|
|
@@ -201,32 +203,6 @@ async function isExecutableFile(path) {
|
|
|
201
203
|
return false;
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
|
-
function parseSessionIds(stdout, mode) {
|
|
205
|
-
const ids = [];
|
|
206
|
-
let recognized = false;
|
|
207
|
-
for (const line of stdout.split(/\r?\n/)) {
|
|
208
|
-
if (!line.trim())
|
|
209
|
-
continue;
|
|
210
|
-
if (line === 'No sessions found.' || line.startsWith('SESSION ID ') || line.startsWith('Label: ')
|
|
211
|
-
|| line === '(no label)' || /^Total: \d+$/.test(line)) {
|
|
212
|
-
recognized = true;
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
const id = /^([0-9a-f-]{36})(?:\s|$)/i.exec(line)?.[1];
|
|
216
|
-
if (id && UUID.test(id)) {
|
|
217
|
-
ids.push(id.toLowerCase());
|
|
218
|
-
recognized = true;
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
if (mode === 'search' && /^ \S/.test(line) && recognized)
|
|
222
|
-
continue;
|
|
223
|
-
throw new SessionContractError('SCHEMA_DRIFT', `unrecognized Grok Build ${mode} output; check CLI version`);
|
|
224
|
-
}
|
|
225
|
-
if (!recognized) {
|
|
226
|
-
throw new SessionContractError('SCHEMA_DRIFT', `empty Grok Build ${mode} output; check CLI version`);
|
|
227
|
-
}
|
|
228
|
-
return [...new Set(ids)];
|
|
229
|
-
}
|
|
230
206
|
async function safeDirectory(input) {
|
|
231
207
|
if (!isAbsolute(input) || parse(resolve(input)).root === resolve(input)) {
|
|
232
208
|
throw new SessionContractError('SOURCE_NOT_AUTHORIZED', 'Grok Build directory must be an absolute non-root path');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Migrate startup ownership without nesting markers or discarding operator text.
|
|
2
|
+
import { buildRuleStartupBootstrapBlock } from './workspace-bootstrap.js';
|
|
2
3
|
export const AGENTS_HEADER = '# AGENTS.md\n<!-- aiwg-managed -->\n<!-- Generated by AIWG. Edit AGENTS.override.md for operator additions. -->\n';
|
|
3
4
|
const bootstrapBlock = /<!-- AIWG:provider-bootstrap:start -->[\s\S]*?<!-- AIWG:provider-bootstrap:end -->/g;
|
|
4
5
|
export const hasRuleStartup = (content) => /<!-- AIWG:rule-hook-[\w-]+:start -->/.test(content);
|
|
@@ -42,9 +43,9 @@ export function preserveBridgeOperatorText(existing, generated) {
|
|
|
42
43
|
const fallback = generated.match(bootstrapBlock)?.[0];
|
|
43
44
|
if (!fallback)
|
|
44
45
|
return generated;
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
const bootstrap = hasRuleStartup(existing) ?
|
|
46
|
+
// Refresh the shared rule-deployment bootstrap too; retain core and harness
|
|
47
|
+
// hooks independently rather than preserving obsolete startup instructions.
|
|
48
|
+
const bootstrap = hasRuleStartup(existing) ? buildRuleStartupBootstrapBlock() : fallback;
|
|
48
49
|
return normalizeRuleStartup(existing, bootstrap, true);
|
|
49
50
|
}
|
|
50
51
|
//# sourceMappingURL=bridge-ownership.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RULE_PRECEDENCE_TEXT } from '../../rules/precedence.mjs';
|
|
1
2
|
import { maskCodeRegions } from './code-regions.js';
|
|
2
3
|
import { assertSafeContextFile, writeContextFileSync } from './context-file-safety.js';
|
|
3
4
|
/**
|
|
@@ -68,6 +69,10 @@ export async function buildContextFinalizationBlock(projectPath, documentPath =
|
|
|
68
69
|
`- Recorded deployments: ${formatList([...providerDeployments].sort())}`,
|
|
69
70
|
'- Generated framework context: `AIWG.md`',
|
|
70
71
|
'',
|
|
72
|
+
'### Rule Precedence',
|
|
73
|
+
'',
|
|
74
|
+
RULE_PRECEDENCE_TEXT,
|
|
75
|
+
'',
|
|
71
76
|
'### Capability Routing',
|
|
72
77
|
'',
|
|
73
78
|
'Routing authority: `aiwg show rule skill-discovery` (kernel); capability phrases: `aiwg show skill aiwg-utils-quickref`.',
|
|
@@ -319,7 +319,7 @@ export async function generate(opts) {
|
|
|
319
319
|
// AGENTS.md emission is gated on the provider's link-mechanism: codex/copilot/
|
|
320
320
|
// cursor/windsurf/hermes/warp/factory/opencode use AGENTS.md as their bridge
|
|
321
321
|
// to AIWG.md. Claude uses CLAUDE.md hook instead (#1437); openclaw is
|
|
322
|
-
// home-dir-only
|
|
322
|
+
// home-dir-only; generic emits a portable, host-loaded AGENTS.md bridge.
|
|
323
323
|
if (opts.provider !== 'flue' && !opts.skip?.agentsMd && shouldEmitAgentsMd(opts.provider)) {
|
|
324
324
|
const agentsMdPath = path.join(opts.projectPath, 'AGENTS.md');
|
|
325
325
|
let canWrite = true;
|
|
@@ -11,6 +11,24 @@ export const PROVIDER_RULE_AUTHORITY = [
|
|
|
11
11
|
'guidance. Platform capability and safety constraints remain absolute; see WORKSPACE.md',
|
|
12
12
|
'"Precedence" for the capability-versus-directive distinction.',
|
|
13
13
|
];
|
|
14
|
+
const PROSE_LOADING = [
|
|
15
|
+
"On a new task, first run discovery for the request (`aiwg discover --stdin <<'AIWG_REQUEST'`, the request, then `AIWG_REQUEST`) before any other tool call or answer. Pass the request literally on heredoc lines, never as a quoted command argument.",
|
|
16
|
+
'',
|
|
17
|
+
'After discovery, read and follow [WORKSPACE.md](./WORKSPACE.md) for project context.',
|
|
18
|
+
'Then read [AIWG.md](./AIWG.md) for AIWG discovery, quickrefs, and framework routing.',
|
|
19
|
+
'',
|
|
20
|
+
'These are explicit reading instructions. Plain Markdown links are not claimed to auto-load.',
|
|
21
|
+
];
|
|
22
|
+
function wrapProviderBootstrap(loading) {
|
|
23
|
+
return [
|
|
24
|
+
PROVIDER_BOOTSTRAP_START, '', '# Provider workspace bootstrap', '',
|
|
25
|
+
...loading, ...PROVIDER_RULE_AUTHORITY, '', PROVIDER_BOOTSTRAP_END,
|
|
26
|
+
].join('\n');
|
|
27
|
+
}
|
|
28
|
+
// Rule projection can use a synthetic corpus without the provider capability matrix.
|
|
29
|
+
export function buildRuleStartupBootstrapBlock() {
|
|
30
|
+
return wrapProviderBootstrap(PROSE_LOADING);
|
|
31
|
+
}
|
|
14
32
|
export function buildProviderBootstrapBlock(provider) {
|
|
15
33
|
const definition = getProviderDefinition(provider);
|
|
16
34
|
const contract = definition?.context;
|
|
@@ -34,7 +52,6 @@ export function buildProviderBootstrapBlock(provider) {
|
|
|
34
52
|
// is asserted here rather than left to be inferred once WORKSPACE.md loads.
|
|
35
53
|
// A session directive that arrives later cannot claim precedence it was never
|
|
36
54
|
// granted (#2512).
|
|
37
|
-
const authority = PROVIDER_RULE_AUTHORITY;
|
|
38
55
|
// #227: Muse gets its own discover-first bridge text — Muse-native
|
|
39
56
|
// instruction order (this AGENTS.md first, then WORKSPACE.md, then AIWG.md)
|
|
40
57
|
// plus the trust-gated load caveat — instead of the generic prose-directive.
|
|
@@ -52,22 +69,8 @@ export function buildProviderBootstrapBlock(provider) {
|
|
|
52
69
|
'WORKSPACE.md and AIWG.md are registered through the provider configuration.',
|
|
53
70
|
'Read and follow WORKSPACE.md first; use AIWG.md second for AIWG discovery and routing.',
|
|
54
71
|
]
|
|
55
|
-
:
|
|
56
|
-
|
|
57
|
-
'Then read [AIWG.md](./AIWG.md) for AIWG discovery, quickrefs, and framework routing.',
|
|
58
|
-
'',
|
|
59
|
-
'These are explicit reading instructions. Plain Markdown links are not claimed to auto-load.',
|
|
60
|
-
];
|
|
61
|
-
return [
|
|
62
|
-
PROVIDER_BOOTSTRAP_START,
|
|
63
|
-
'',
|
|
64
|
-
'# Provider workspace bootstrap',
|
|
65
|
-
'',
|
|
66
|
-
...loading,
|
|
67
|
-
...authority,
|
|
68
|
-
'',
|
|
69
|
-
PROVIDER_BOOTSTRAP_END,
|
|
70
|
-
].join('\n');
|
|
72
|
+
: PROSE_LOADING;
|
|
73
|
+
return wrapProviderBootstrap(loading);
|
|
71
74
|
}
|
|
72
75
|
export const PROVIDER_BOOTSTRAP_HEADING = '# Provider workspace bootstrap';
|
|
73
76
|
/**
|
|
@@ -7,6 +7,7 @@ import { auditWorkspaceContext } from './workspace-audit.js';
|
|
|
7
7
|
import { PROVIDER_BOOTSTRAP_START, readOptional, resolveProjectRelative, WORKSPACE_MANAGED_START, WORKSPACE_OPERATOR_START, WORKSPACE_SIGNATURE, } from './workspace-context-shared.js';
|
|
8
8
|
import { BOOTSTRAP_AUTHORITY_SIGNATURE, WORKSPACE_PRECEDENCE_SIGNATURE, WORKSPACE_PRECEDENCE_SUPERSEDED } from './workspace-document.js';
|
|
9
9
|
import { configuredProviders } from './workspace-migration.js';
|
|
10
|
+
import { diagnoseUserHookCommands } from '../../extensions/user-hook-diagnostics.js';
|
|
10
11
|
import { diagnoseCodexHookTrust } from '../hook-bridge/codex-trust.js';
|
|
11
12
|
import { diagnoseFactoryHookTrust } from '../hook-bridge/factory-trust.js';
|
|
12
13
|
import { maskCodeRegions } from './code-regions.js';
|
|
@@ -37,7 +38,7 @@ export async function workspaceLinkedFiles(projectPath) {
|
|
|
37
38
|
return [...new Set(files)].sort();
|
|
38
39
|
}
|
|
39
40
|
export async function diagnoseWorkspaceContext(projectPath) {
|
|
40
|
-
const diagnostics =
|
|
41
|
+
const diagnostics = await diagnoseUserHookCommands();
|
|
41
42
|
const codexTrust = await diagnoseCodexHookTrust(projectPath);
|
|
42
43
|
if (codexTrust)
|
|
43
44
|
diagnostics.push(codexTrust);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { projectRulePrecedenceText } from '../../rules/project-precedence.js';
|
|
2
|
+
import { RULE_PRECEDENCE_TEXT } from '../../rules/precedence.mjs';
|
|
1
3
|
// Render and preserve the canonical WORKSPACE document and resident memory.
|
|
2
4
|
import * as path from 'node:path';
|
|
3
5
|
import { readAiwgConfigCandidate } from '../../config/aiwg-config.js';
|
|
@@ -94,6 +96,7 @@ export async function providerCopiesStatus(projectPath) {
|
|
|
94
96
|
}
|
|
95
97
|
export function buildWorkspaceManagedBlock(projectPath, providerFiles = [], residentMemory = '') {
|
|
96
98
|
const links = workspaceLinks(projectPath, providerFiles);
|
|
99
|
+
const ordering = projectRulePrecedenceText(projectPath);
|
|
97
100
|
return [
|
|
98
101
|
WORKSPACE_MANAGED_START,
|
|
99
102
|
'',
|
|
@@ -119,6 +122,9 @@ export function buildWorkspaceManagedBlock(projectPath, providerFiles = [], resi
|
|
|
119
122
|
'constraint. "Format commits this way" is a directive, and an AIWG rule on commit content wins.',
|
|
120
123
|
'When a directive and an AIWG rule conflict, follow the rule and say plainly that you did.',
|
|
121
124
|
'',
|
|
125
|
+
RULE_PRECEDENCE_TEXT,
|
|
126
|
+
...(ordering ? ['', ordering] : []),
|
|
127
|
+
'',
|
|
122
128
|
'### Ownership',
|
|
123
129
|
'',
|
|
124
130
|
'- Edit project-neutral notes only inside the protected Project Context section below.',
|
|
@@ -9,7 +9,7 @@ import { writeContextFileSync } from './context-file-safety.js';
|
|
|
9
9
|
import { readAiwgOperatorNotes } from './finalization.js';
|
|
10
10
|
import { auditWorkspaceContext } from './workspace-audit.js';
|
|
11
11
|
import { buildProviderBootstrapFile } from './workspace-bootstrap.js';
|
|
12
|
-
import { atomicWrite, PROJECT_CONTEXT_PLACEHOLDER,
|
|
12
|
+
import { atomicWrite, PROJECT_CONTEXT_PLACEHOLDER, readOptional, resolveProjectRelative, sha256, } from './workspace-context-shared.js';
|
|
13
13
|
import { buildWorkspaceDocument, residentMemoryForRegeneration } from './workspace-document.js';
|
|
14
14
|
import { extractExistingProjectContext, mergeProjectExtraction } from './workspace-extraction.js';
|
|
15
15
|
export function projectOutputPath(projectPath, absPath) {
|
|
@@ -94,17 +94,7 @@ export async function stageMigrationWrites(projectPath, audit, options = {}) {
|
|
|
94
94
|
// Shared AGENTS.md is deliberately provider-neutral prose so sequential
|
|
95
95
|
// multi-provider deployment cannot make the last provider win.
|
|
96
96
|
const provider = targetProviderIds.length === 1 ? targetProviderIds[0] : 'generic';
|
|
97
|
-
const content = provider
|
|
98
|
-
? [
|
|
99
|
-
'# Provider workspace bootstrap', WORKSPACE_SIGNATURE,
|
|
100
|
-
'<!-- Generated by AIWG. Project/operator context belongs in WORKSPACE.md. -->', '',
|
|
101
|
-
PROVIDER_BOOTSTRAP_START, '',
|
|
102
|
-
'Read and follow [WORKSPACE.md](./WORKSPACE.md) first.',
|
|
103
|
-
'Then read [AIWG.md](./AIWG.md) for AIWG discovery and framework routing.',
|
|
104
|
-
'These are explicit reading instructions; a plain Markdown link is not claimed to auto-load.', '',
|
|
105
|
-
PROVIDER_BOOTSTRAP_END, '',
|
|
106
|
-
].join('\n')
|
|
107
|
-
: buildProviderBootstrapFile(provider);
|
|
97
|
+
const content = buildProviderBootstrapFile(provider);
|
|
108
98
|
writes.set(target, content);
|
|
109
99
|
}
|
|
110
100
|
// Any detected operator-owned root startup file participates in the explicit
|
|
@@ -4,6 +4,7 @@ import * as path from 'node:path';
|
|
|
4
4
|
import { randomUUID } from 'node:crypto';
|
|
5
5
|
import { substituteEnvVars } from './shim.js';
|
|
6
6
|
import { loadHookSources } from './loader.js';
|
|
7
|
+
import { verifiedHookCommand } from '../../extensions/verified-hook-command.js';
|
|
7
8
|
import { tomlString } from '../../mcp/toml-string.mjs';
|
|
8
9
|
// Verified with the installed 0.165.0 app-server hooks/list. Config keys use
|
|
9
10
|
// PascalCase; snake_case names (user_prompt_submit, pre_tool_use, etc.) are IDs
|
|
@@ -12,15 +13,6 @@ const CODEX_EVENTS = new Set([
|
|
|
12
13
|
'PreToolUse', 'PostToolUse', 'UserPromptSubmit', 'SessionStart', 'SessionEnd',
|
|
13
14
|
'PermissionRequest', 'PreCompact', 'PostCompact', 'SubagentStart', 'SubagentStop', 'Stop',
|
|
14
15
|
]);
|
|
15
|
-
// Codex runs hooks in the session cwd, which may be below the hooks.json root.
|
|
16
|
-
const PROMPT_DISCOVERY_LAUNCHER = [
|
|
17
|
-
'const fs=require("node:fs"),path=require("node:path");',
|
|
18
|
-
'for(let dir=process.cwd();;dir=path.dirname(dir)){',
|
|
19
|
-
'const script=path.join(dir,".codex/hooks/aiwg-prompt-discovery.cjs");',
|
|
20
|
-
'if(fs.existsSync(script)){require(script);break;}',
|
|
21
|
-
'if(path.dirname(dir)===dir)break;',
|
|
22
|
-
'}',
|
|
23
|
-
].join('');
|
|
24
16
|
function shellArgument(value, expandEnvironment = true) {
|
|
25
17
|
// Preserve environment references, but never evaluate argument substitutions.
|
|
26
18
|
const escaped = value.replace(/[\\"`$]/g, '\\$&');
|
|
@@ -28,9 +20,9 @@ function shellArgument(value, expandEnvironment = true) {
|
|
|
28
20
|
? escaped.replace(/\\\$(\{[A-Z_][A-Z0-9_]*\}|[A-Z_][A-Z0-9_]*)/g, '$$$1') : escaped;
|
|
29
21
|
return `"${argument}"`;
|
|
30
22
|
}
|
|
31
|
-
function commandHook(source
|
|
23
|
+
function commandHook(source) {
|
|
32
24
|
const command = substituteEnvVars(source.command, 'codex');
|
|
33
|
-
const args = (source.args || []).map(a => shellArgument(substituteEnvVars(a, 'codex')
|
|
25
|
+
const args = (source.args || []).map(a => shellArgument(substituteEnvVars(a, 'codex')));
|
|
34
26
|
return {
|
|
35
27
|
type: 'command', command: [command, ...args].join(' '),
|
|
36
28
|
...(source.timeout === undefined ? {} : { timeout: source.timeout }),
|
|
@@ -105,7 +97,7 @@ export async function translateForCodex(source, options) {
|
|
|
105
97
|
const events = source.events.filter(event => CODEX_EVENTS.has(event));
|
|
106
98
|
if (!events.length)
|
|
107
99
|
return { ...result, skipped: true, skipReason: 'no Codex-mapped events' };
|
|
108
|
-
const directory = path.join(options.projectPath, '.codex');
|
|
100
|
+
const directory = options.hookDirectory ?? path.join(options.projectPath, '.codex');
|
|
109
101
|
const configPath = path.join(directory, 'hooks.json');
|
|
110
102
|
const promptHook = source.id === 'aiwg-prompt-discovery';
|
|
111
103
|
const scriptPath = path.join(directory, 'hooks', 'aiwg-prompt-discovery.cjs');
|
|
@@ -153,10 +145,15 @@ export async function translateForCodex(source, options) {
|
|
|
153
145
|
throw new Error('Prompt discovery source is missing its shared script');
|
|
154
146
|
await fs.mkdir(path.dirname(scriptPath), { recursive: true });
|
|
155
147
|
await fs.copyFile(source.args[0], scriptPath);
|
|
156
|
-
|
|
148
|
+
}
|
|
149
|
+
const hook = commandHook(source);
|
|
150
|
+
if (promptHook) {
|
|
151
|
+
const anchor = options.hookDirectory ? directory : options.commandRoot ?? options.projectPath;
|
|
152
|
+
hook.command = verifiedHookCommand(anchor, path.relative(options.hookDirectory ? directory : options.projectPath, scriptPath).replaceAll('\\', '/'), await fs.readFile(scriptPath), [], options.scope);
|
|
153
|
+
hook.statusMessage = 'AIWG prompt discovery';
|
|
157
154
|
}
|
|
158
155
|
for (const event of events)
|
|
159
|
-
(hooks[event] ??= []).push({ hooks: [
|
|
156
|
+
(hooks[event] ??= []).push({ hooks: [hook] });
|
|
160
157
|
doc.hooks = hooks;
|
|
161
158
|
await fs.mkdir(directory, { recursive: true });
|
|
162
159
|
if (existing && !managed) {
|
|
@@ -3,7 +3,12 @@ import { promises as fs } from 'node:fs';
|
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
5
|
import { getStaticTOMLValue, parseTOML } from 'toml-eslint-parser';
|
|
6
|
-
|
|
6
|
+
// Printed after deploy: one line that fits an 80-column terminal.
|
|
7
|
+
export const CODEX_HOOK_TRUST_NEXT_STEP = 'Trust this project in Codex and approve its AIWG hook; codex exec needs both.';
|
|
8
|
+
// Full explanation for doctor and docs (#4035).
|
|
9
|
+
export const CODEX_EXEC_HOOK_TRUST_DETAIL = 'Codex 0.167 requires saved folder and hook trust for codex exec; a per-run -c project trust override '
|
|
10
|
+
+ 'does not enable project hooks, even with --dangerously-bypass-hook-trust. '
|
|
11
|
+
+ 'Review and save trust interactively for each worker worktree before automation; AIWG never grants trust.';
|
|
7
12
|
export function codexHookTrustNextStep(trust) {
|
|
8
13
|
return trust && (trust.project !== 'trusted' || trust.hookReview !== 'approved')
|
|
9
14
|
? CODEX_HOOK_TRUST_NEXT_STEP : '';
|
|
@@ -44,7 +49,7 @@ export async function diagnoseCodexHookTrust(projectPath) {
|
|
|
44
49
|
// Review state is never observable offline, so a trusted project is only advisory.
|
|
45
50
|
severity: trust.project === 'trusted' ? 'info' : 'warning', code: 'codex-prompt-discovery-trust', path: '.codex/hooks.json',
|
|
46
51
|
message: 'Codex prompt-discovery hook installed but inactive or unverified (untrusted project or unreviewed hook). '
|
|
47
|
-
+ `Project trust: ${trust.project}; hook review: ${trust.hookReview}. ${nextStep}`,
|
|
52
|
+
+ `Project trust: ${trust.project}; hook review: ${trust.hookReview}. ${nextStep} ${CODEX_EXEC_HOOK_TRUST_DETAIL}`,
|
|
48
53
|
} : null;
|
|
49
54
|
}
|
|
50
55
|
//# sourceMappingURL=codex-trust.js.map
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { promises as fs } from 'node:fs';
|
|
12
12
|
import * as path from 'node:path';
|
|
13
13
|
import { substituteEnvVars } from './shim.js';
|
|
14
|
+
import { PROMPT_DISCOVERY_GAPS } from './prompt-discovery-gaps.js';
|
|
14
15
|
const COPILOT_EVENT_MAP = {
|
|
15
16
|
PreToolUse: 'pre_tool_use',
|
|
16
17
|
PostToolUse: 'post_tool_use',
|
|
@@ -28,7 +29,7 @@ export async function translateForCopilot(source, options) {
|
|
|
28
29
|
};
|
|
29
30
|
if (source.degradeOn?.includes('copilot')) {
|
|
30
31
|
result.skipped = true;
|
|
31
|
-
result.skipReason = 'degrade-on declared copilot';
|
|
32
|
+
result.skipReason = source.id === 'aiwg-prompt-discovery' ? PROMPT_DISCOVERY_GAPS.copilot : 'degrade-on declared copilot';
|
|
32
33
|
return result;
|
|
33
34
|
}
|
|
34
35
|
const hooksDir = path.join(options.projectPath, '.github', 'hooks');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Grok Build hook translator. Deployment writes project JSON only; trust remains an operator action. */
|
|
2
2
|
import { promises as fs } from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
|
+
import { PROMPT_DISCOVERY_GAPS } from './prompt-discovery-gaps.js';
|
|
4
5
|
export const GROK_EVENT_MAP = {
|
|
5
6
|
SessionStart: 'SessionStart',
|
|
6
7
|
SessionEnd: 'SessionEnd',
|
|
@@ -15,7 +16,8 @@ function safeId(id) {
|
|
|
15
16
|
export async function translateForGrokBuild(source, options) {
|
|
16
17
|
const result = { provider: 'grok-build', emittedPaths: [], warnings: [], skipped: false };
|
|
17
18
|
if (source.degradeOn?.includes('grok-build'))
|
|
18
|
-
return { ...result, skipped: true,
|
|
19
|
+
return { ...result, skipped: true,
|
|
20
|
+
skipReason: source.id === 'aiwg-prompt-discovery' ? PROMPT_DISCOVERY_GAPS['grok-build'] : 'degrade-on declared grok-build' };
|
|
19
21
|
const id = safeId(source.id);
|
|
20
22
|
if (!id)
|
|
21
23
|
return { ...result, skipped: true, skipReason: 'hook id is not a safe Grok file name' };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Deploy prompt discovery through Hermes's documented pre_llm_call shell hook.
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { isMap, isSeq, parseDocument } from 'yaml';
|
|
5
|
+
import { resolveHermesHomePath } from '../../providers/hermes-home.js';
|
|
6
|
+
import { captureDeploymentOutputs, recordDeploymentOutputs } from '../../providers/deployment-ownership.mjs';
|
|
7
|
+
import { managedHookScriptState } from '../../extensions/managed-hook-script-state.js';
|
|
8
|
+
export async function translateHermesPromptDiscovery(source, options) {
|
|
9
|
+
const home = resolveHermesHomePath();
|
|
10
|
+
const directory = path.join(home, 'agent-hooks');
|
|
11
|
+
const script = path.join(directory, 'aiwg-prompt-discovery.cjs');
|
|
12
|
+
const config = path.join(home, 'config.yaml');
|
|
13
|
+
const result = { provider: 'hermes', skipped: false, warnings: [], emittedPaths: [] };
|
|
14
|
+
if (options.dryRun)
|
|
15
|
+
return { ...result, emittedPaths: [script, config].map(file => `${file} (dry-run)`) };
|
|
16
|
+
for (const file of [home, directory, script, config]) {
|
|
17
|
+
try {
|
|
18
|
+
if ((await fs.lstat(file)).isSymbolicLink())
|
|
19
|
+
throw new Error(`Refusing symlinked Hermes hook target: ${file}`);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (error.code !== 'ENOENT')
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const original = await fs.readFile(config, 'utf8').catch(error => {
|
|
27
|
+
if (error.code !== 'ENOENT')
|
|
28
|
+
throw error;
|
|
29
|
+
return '';
|
|
30
|
+
});
|
|
31
|
+
const doc = parseDocument(original || '{}');
|
|
32
|
+
if (doc.errors.length || !isMap(doc.contents))
|
|
33
|
+
throw new Error(`Invalid Hermes config: ${config}`);
|
|
34
|
+
if (!doc.has('hooks'))
|
|
35
|
+
doc.set('hooks', doc.createNode({}));
|
|
36
|
+
const hooks = doc.get('hooks', true);
|
|
37
|
+
if (!isMap(hooks))
|
|
38
|
+
throw new Error('Invalid Hermes hooks mapping');
|
|
39
|
+
if (!hooks.has('pre_llm_call'))
|
|
40
|
+
hooks.set('pre_llm_call', doc.createNode([]));
|
|
41
|
+
const entries = hooks.get('pre_llm_call', true);
|
|
42
|
+
if (!isSeq(entries) || entries.items.some(entry => !isMap(entry) || typeof entry.get('command') !== 'string')) {
|
|
43
|
+
throw new Error('Invalid Hermes pre_llm_call hooks');
|
|
44
|
+
}
|
|
45
|
+
const quote = (value) => `'${value.replaceAll("'", "'\"'\"'")}'`;
|
|
46
|
+
const registration = { command: `node ${quote(script)}`, timeout: source.timeout ?? 2,
|
|
47
|
+
_aiwg_managed: true, _aiwg_id: source.id };
|
|
48
|
+
const managed = entries.items.filter(entry => isMap(entry) && entry.get('_aiwg_managed') === true && entry.get('_aiwg_id') === source.id);
|
|
49
|
+
const current = managed[0];
|
|
50
|
+
// Leave matching nodes intact to preserve comments and byte-stable redeployment.
|
|
51
|
+
if (managed.length !== 1 || !isMap(current) || JSON.stringify(current.toJSON()) !== JSON.stringify(registration)) {
|
|
52
|
+
entries.items = entries.items.filter(entry => !managed.includes(entry));
|
|
53
|
+
entries.add(doc.createNode(registration));
|
|
54
|
+
}
|
|
55
|
+
const sourceScript = source.args?.[0];
|
|
56
|
+
if (!sourceScript)
|
|
57
|
+
throw new Error('Missing shared prompt discovery script');
|
|
58
|
+
const bytes = await fs.readFile(sourceScript);
|
|
59
|
+
const roots = [config, directory, path.join(home, '.aiwg-manifest.json')];
|
|
60
|
+
const before = captureDeploymentOutputs(roots);
|
|
61
|
+
const state = await managedHookScriptState(home, path.relative(home, script), bytes);
|
|
62
|
+
if (state === 'operator-edited' || state === 'unreadable')
|
|
63
|
+
result.warnings.push(`${script}: kept (${state})`);
|
|
64
|
+
else {
|
|
65
|
+
await fs.mkdir(directory, { recursive: true });
|
|
66
|
+
if (state)
|
|
67
|
+
await fs.writeFile(script, bytes, { mode: 0o755 });
|
|
68
|
+
result.emittedPaths.push(script);
|
|
69
|
+
}
|
|
70
|
+
const text = doc.toString();
|
|
71
|
+
if (text !== original)
|
|
72
|
+
await fs.writeFile(config, text);
|
|
73
|
+
result.emittedPaths.push(config);
|
|
74
|
+
recordDeploymentOutputs(before, roots, { frameworkSlug: 'aiwg-hooks', claimUnchangedSettings: false, writtenFiles: result.emittedPaths });
|
|
75
|
+
result.warnings.push('Hermes pre_llm_call hook configured; approve the command in Hermes before use. Consent and safe mode are unchanged.');
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=hermes-prompt-discovery.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Prompt discovery uses documented pre_llm_call shell hooks and native context JSON.
|
|
2
3
|
* Hermes hook translator — emits a Python plugin stub at
|
|
3
4
|
* ~/.hermes/plugins/<id>.py that registers itself with Hermes' Python
|
|
4
5
|
* plugin system and shells out to the AIWG hook command.
|
|
@@ -11,7 +12,7 @@ import { promises as fs } from 'node:fs';
|
|
|
11
12
|
import * as path from 'node:path';
|
|
12
13
|
import { homedir } from 'node:os';
|
|
13
14
|
import { substituteEnvVars } from './shim.js';
|
|
14
|
-
import {
|
|
15
|
+
import { translateHermesPromptDiscovery } from './hermes-prompt-discovery.js';
|
|
15
16
|
const HERMES_EVENT_MAP = {
|
|
16
17
|
PreToolUse: 'pre_tool',
|
|
17
18
|
PostToolUse: 'post_tool',
|
|
@@ -64,10 +65,11 @@ export async function translateForHermes(source, options) {
|
|
|
64
65
|
};
|
|
65
66
|
if (source.degradeOn?.includes('hermes')) {
|
|
66
67
|
result.skipped = true;
|
|
67
|
-
result.skipReason =
|
|
68
|
-
? PROMPT_DISCOVERY_GAPS['hermes'] : 'degrade-on declared hermes';
|
|
68
|
+
result.skipReason = 'degrade-on declared hermes';
|
|
69
69
|
return result;
|
|
70
70
|
}
|
|
71
|
+
if (source.id === 'aiwg-prompt-discovery')
|
|
72
|
+
return translateHermesPromptDiscovery(source, options);
|
|
71
73
|
const events = source.events
|
|
72
74
|
.map((e) => HERMES_EVENT_MAP[e])
|
|
73
75
|
.filter((e) => Boolean(e));
|
|
@@ -18,6 +18,7 @@ import { translateForFactory } from './factory-translator.js';
|
|
|
18
18
|
import { translateForHermes } from './hermes-translator.js';
|
|
19
19
|
import { translateForGrokBuild } from './grok-build-translator.js';
|
|
20
20
|
import { getProviderDefinition } from '../../providers/provider-definitions.js';
|
|
21
|
+
import { resolveHermesHomePath } from '../../providers/hermes-home.js';
|
|
21
22
|
export { AIWG_ENV_VARS, NATIVE_ENV_VAR_MAP } from './types.js';
|
|
22
23
|
export { substituteEnvVars, generateShimBash, EXIT_CODE_MAP } from './shim.js';
|
|
23
24
|
export { translateForCodex, renderCodexHookToml, injectHookBlock as injectCodexHookBlock } from './codex-translator.js';
|
|
@@ -68,7 +69,8 @@ export async function bridgeAll(sources, providers, options) {
|
|
|
68
69
|
try {
|
|
69
70
|
const roots = [path.join(options.projectPath, '.factory/hooks'), path.join(options.projectPath, '.factory/hooks.json'), path.join(options.projectPath, '.github/hooks'),
|
|
70
71
|
path.join(options.projectPath, '.grok/hooks'), path.join(options.projectPath, '.codex/hooks.json'), path.join(options.projectPath, '.codex/hooks'),
|
|
71
|
-
path.join(homedir(), '.hermes/plugins')
|
|
72
|
+
path.join(homedir(), '.hermes/plugins'), resolveHermesHomePath('config.yaml'), resolveHermesHomePath('agent-hooks'),
|
|
73
|
+
resolveHermesHomePath('.aiwg-manifest.json')];
|
|
72
74
|
const before = options.dryRun ? undefined : captureDeploymentOutputs(roots);
|
|
73
75
|
const r = await translator(source, options);
|
|
74
76
|
if (before)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// Explain
|
|
1
|
+
// Explain bootstrap fallbacks where an event mapping has no prompt context contract.
|
|
2
2
|
export const PROMPT_DISCOVERY_GAPS = {
|
|
3
|
-
|
|
3
|
+
copilot: 'Prompt discovery uses the .github/copilot-instructions.md bootstrap rule; installed help documents no prompt-context injection contract.',
|
|
4
|
+
'grok-build': 'Prompt discovery uses the AGENTS.md bootstrap rule; Grok discards allowing UserPromptSubmit stdout (no additionalContext).',
|
|
4
5
|
};
|
|
5
6
|
//# sourceMappingURL=prompt-discovery-gaps.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwg/cli",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.4",
|
|
4
4
|
"description": "Lightweight AIWG CLI for signed, versioned web-backed resources.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"agentic/code/addons/aiwg-utils/rules/anti-laziness.md",
|
|
33
33
|
"agentic/code/addons/aiwg-utils/rules/anti-laziness.core.md",
|
|
34
34
|
"agentic/code/addons/composition-engine/lib/runtime.mjs",
|
|
35
|
+
"agentic/code/addons/composition-engine/lib/authority.mjs",
|
|
35
36
|
"agentic/code/addons/composition-engine/lib/validator.mjs",
|
|
36
37
|
"agentic/code/addons/composition-engine/schemas/flow-graph.schema.json",
|
|
37
38
|
"schemas/security/",
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"schemas/models/",
|
|
42
43
|
"vscode-extension/schemas/aiwg.config.v1.json",
|
|
43
44
|
"dist/src/",
|
|
45
|
+
"dist/src/cli/services/deployment-probe-scope.js",
|
|
44
46
|
"!dist/**/*.d.ts",
|
|
45
47
|
"!dist/**/*.map",
|
|
46
48
|
"dist/src/api/index.d.ts",
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
"tools/ralph-external/lib/behavior-registry.mjs",
|
|
58
60
|
"tools/warp/warp-content.mjs",
|
|
59
61
|
"tools/cli/decision-offload-report.mjs",
|
|
62
|
+
"tools/cli/authorization-health.mjs",
|
|
60
63
|
"tools/cli/workspace-status.mjs",
|
|
61
64
|
"tools/ralph-external/session-launcher.mjs",
|
|
62
65
|
"tools/ralph-external/process-monitor.mjs",
|
|
@@ -106,6 +109,9 @@
|
|
|
106
109
|
"tools/agents/deploy-options.mjs",
|
|
107
110
|
"tools/agents/deploy-support.mjs",
|
|
108
111
|
"tools/agents/use-rule-selection.mjs",
|
|
112
|
+
"dist/src/extensions/verified-hook-command.js",
|
|
113
|
+
"dist/src/extensions/user-hook-diagnostics.js",
|
|
114
|
+
"tools/agents/providers/user-hooks.mjs",
|
|
109
115
|
"tools/agents/providers/",
|
|
110
116
|
"tools/providers/antigravity-transport.mjs",
|
|
111
117
|
"tools/commands/deploy-prompts-codex.mjs",
|
|
@@ -101,7 +101,7 @@ const PROVIDER_ALIASES = {
|
|
|
101
101
|
'dsh': 'deepseek-harness',
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
const AVAILABLE_PROVIDERS = ['antigravity', 'claude', 'factory', 'codex', 'opencode', 'copilot', 'cursor', 'flue', 'pi', 'omp', 'deepseek-harness', 'warp', 'windsurf', 'hermes', 'openclaw', 'openhuman', 'grokbot', 'grok-build', 'muse'];
|
|
104
|
+
const AVAILABLE_PROVIDERS = ['antigravity', 'claude', 'factory', 'codex', 'opencode', 'copilot', 'cursor', 'flue', 'pi', 'omp', 'deepseek-harness', 'warp', 'windsurf', 'hermes', 'openclaw', 'openhuman', 'grokbot', 'grok-build', 'muse', 'generic'];
|
|
105
105
|
|
|
106
106
|
const UNSUPPORTED_PROVIDER_HINTS = {
|
|
107
107
|
'devin-cli': [
|
|
@@ -369,7 +369,7 @@ async function mainUnlocked(args, internal) {
|
|
|
369
369
|
try {
|
|
370
370
|
if (!internal.finalizeOnly) {
|
|
371
371
|
if (cfg.kernelOnly && (!cfg.deferRuleProjection || preparationActive)
|
|
372
|
-
&& !['claude', 'codex', 'cursor', 'hermes', 'warp', 'openclaw', 'flue', 'pi', 'copilot', 'factory', 'opencode', 'windsurf', 'antigravity', 'muse', 'omp', 'grok-build'].includes(provider.name)) {
|
|
372
|
+
&& !['claude', 'codex', 'cursor', 'hermes', 'warp', 'openclaw', 'flue', 'pi', 'copilot', 'factory', 'opencode', 'windsurf', 'antigravity', 'muse', 'omp', 'grok-build', 'generic'].includes(provider.name)) {
|
|
373
373
|
const { deployWithRuleDelivery } = await import('./providers/rule-delivery.mjs');
|
|
374
374
|
await deployWithRuleDelivery(opts, provider, staged => provider.deploy(staged));
|
|
375
375
|
} else await provider.deploy(opts);
|
|
@@ -377,10 +377,9 @@ async function mainUnlocked(args, internal) {
|
|
|
377
377
|
if (preparationActive) return;
|
|
378
378
|
|
|
379
379
|
// User settings are outside staging: write only after a real promotion.
|
|
380
|
-
if (
|
|
381
|
-
const {
|
|
382
|
-
|
|
383
|
-
for (const warning of result?.warnings || []) console.warn(`Claude settings: ${warning}`);
|
|
380
|
+
if (cfg.userScope && !cfg.dryRun) {
|
|
381
|
+
const { installUserHooks } = await import('./providers/user-hooks.mjs');
|
|
382
|
+
await installUserHooks(provider.name, cfg);
|
|
384
383
|
}
|
|
385
384
|
|
|
386
385
|
const mirroredCommandCount = mirrorSkillsAsCommands(provider, cfg.target, srcRoot, opts);
|
|
@@ -234,6 +234,7 @@ Providers (all deploy agents, commands, skills, and rules):
|
|
|
234
234
|
grokbot - Grok Bot (AGENTS.md bridge; skills only with AIWG_GROKBOT_SKILLS_DIR)
|
|
235
235
|
grok-build - Grok Build (experimental; .grok paths + $GROK_HOME; no bare grok alias)
|
|
236
236
|
muse - Muse Code (stable; AGENTS.md bridge; .agents/skills + XDG user root; managed hooks, opt-in --mcp; no aliases)
|
|
237
|
+
generic - Portable Markdown (AGENTS.md + rules; .agents/skills kernel; host must load explicitly)
|
|
237
238
|
hermes - Hermes Agent (MCP-based integration)
|
|
238
239
|
Skills: $HERMES_HOME/skills/ (user-global; defaults to ~/.hermes/skills/) | Agents: AGENTS.md
|
|
239
240
|
Commands/Rules: served via MCP, not file-deployed
|
|
@@ -7,12 +7,13 @@ import { path } from './base-runtime.mjs';
|
|
|
7
7
|
* Returns { frontmatter: string, body: string, metadata: object }
|
|
8
8
|
*/
|
|
9
9
|
export function parseFrontmatter(content) {
|
|
10
|
-
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
10
|
+
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
|
|
11
11
|
if (!fmMatch) {
|
|
12
12
|
return { frontmatter: null, body: content, metadata: {} };
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const [,
|
|
15
|
+
const [, rawFrontmatter, body] = fmMatch;
|
|
16
|
+
const frontmatter = rawFrontmatter.replace(/\r\n/g, '\n');
|
|
16
17
|
|
|
17
18
|
// Parse simple YAML key-value pairs
|
|
18
19
|
const metadata = {};
|
|
@@ -43,7 +43,7 @@ export async function postDeploy(targetDir, opts) {
|
|
|
43
43
|
if (opts.attribution !== false || hooks) {
|
|
44
44
|
const { installAiwgHooks } = await importImpl(import.meta.url, 'extensions/claude-hooks-installer.js');
|
|
45
45
|
const { deploymentOwner } = await importImpl(import.meta.url, 'providers/deployment-ownership.mjs');
|
|
46
|
-
const result = await installAiwgHooks({ frameworkSlug: deploymentOwner(opts), claimUnchangedSettings: !addonPass, projectPath: targetDir,
|
|
46
|
+
const result = await installAiwgHooks({ frameworkSlug: deploymentOwner(opts), claimUnchangedSettings: !addonPass, projectPath: targetDir, commandRoot: opts.logicalOutputPath?.(targetDir),
|
|
47
47
|
frameworkRoot: fileURLToPath(new URL('../../../', import.meta.url)),
|
|
48
48
|
attribution: opts.attribution !== false, hooks, dryRun: opts.dryRun });
|
|
49
49
|
if (!opts.dryRun && result) opts.writtenFiles?.push(result.settingsPath, ...result.installedScripts);
|
|
@@ -14,7 +14,7 @@ export async function postDeploy(targetDir, opts) {
|
|
|
14
14
|
const { installCodexPromptDiscovery } = await importImpl(import.meta.url, 'smiths/hook-bridge/codex-translator.js');
|
|
15
15
|
const packageRoot = fileURLToPath(new URL('../../../', import.meta.url));
|
|
16
16
|
// Runtime hooks belong to this package, even when deploying an external bundle.
|
|
17
|
-
await installCodexPromptDiscovery({ projectPath: targetDir, frameworkRoot: packageRoot, dryRun: opts.dryRun });
|
|
17
|
+
await installCodexPromptDiscovery({ projectPath: targetDir, commandRoot: opts.logicalOutputPath?.(targetDir), frameworkRoot: packageRoot, dryRun: opts.dryRun });
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (opts.createAgentsMd) {
|