@open-agent-toolkit/cli 0.2.51 → 0.2.52
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/assets/bundle-metadata.json +1 -1
- package/assets/docs/cli-utilities/bootstrap.md +6 -2
- package/assets/docs/cli-utilities/tool-packs.md +87 -33
- package/assets/docs/provider-sync/commands.md +30 -2
- package/assets/docs/provider-sync/config.md +19 -0
- package/assets/docs/provider-sync/manifest-and-drift.md +37 -0
- package/assets/docs/provider-sync/providers.md +69 -2
- package/assets/docs/provider-sync/scope-and-surface.md +44 -0
- package/assets/docs/reference/cli-reference.md +1 -0
- package/assets/docs/reference/oat-directory-structure.md +11 -4
- package/assets/docs/workflows/projects/evidence-layers.md +110 -1
- package/assets/docs/workflows/projects/implementation-execution.md +13 -0
- package/assets/docs/workflows/projects/orchestration-model.md +18 -0
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/oat-dispatch-subagents/SKILL.md +57 -1
- package/assets/skills/oat-dispatch-subagents/references/record-schema.md +77 -1
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +1 -1
- package/assets/skills/oat-project-dispatch-subagents/SKILL.md +24 -1
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-implement/references/dispatch-and-dry-run.md +11 -0
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-plan-writing/SKILL.md +12 -1
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-review-provide/SKILL.md +12 -1
- package/assets/skills/oat-project-review-provide-remote/SKILL.md +12 -1
- package/dist/agents/canonical/index.d.ts +2 -0
- package/dist/agents/canonical/index.d.ts.map +1 -1
- package/dist/agents/canonical/index.js +1 -0
- package/dist/agents/canonical/resolve.d.ts +45 -0
- package/dist/agents/canonical/resolve.d.ts.map +1 -0
- package/dist/agents/canonical/resolve.js +175 -0
- package/dist/commands/decision/agents-guidance.d.ts +2 -2
- package/dist/commands/decision/agents-guidance.d.ts.map +1 -1
- package/dist/commands/decision/agents-guidance.js +1 -4
- package/dist/commands/decision/index.d.ts.map +1 -1
- package/dist/commands/decision/index.js +25 -6
- package/dist/commands/docs/init/index.d.ts +7 -1
- package/dist/commands/docs/init/index.d.ts.map +1 -1
- package/dist/commands/docs/init/index.js +53 -20
- package/dist/commands/doctor/index.d.ts +8 -2
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +157 -46
- package/dist/commands/init/index.d.ts +8 -3
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +64 -26
- package/dist/commands/init/tools/index.d.ts +12 -12
- package/dist/commands/init/tools/index.d.ts.map +1 -1
- package/dist/commands/init/tools/index.js +430 -99
- package/dist/commands/init/tools/install-state.d.ts +2 -0
- package/dist/commands/init/tools/install-state.d.ts.map +1 -1
- package/dist/commands/init/tools/install-state.js +11 -0
- package/dist/commands/init/tools/project-guidance.d.ts +49 -0
- package/dist/commands/init/tools/project-guidance.d.ts.map +1 -0
- package/dist/commands/init/tools/project-guidance.js +144 -0
- package/dist/commands/init/tools/workflows/index.d.ts +7 -0
- package/dist/commands/init/tools/workflows/index.d.ts.map +1 -1
- package/dist/commands/init/tools/workflows/index.js +160 -7
- package/dist/commands/pjm/index.d.ts.map +1 -1
- package/dist/commands/pjm/index.js +28 -3
- package/dist/commands/pjm/init.d.ts +5 -0
- package/dist/commands/pjm/init.d.ts.map +1 -1
- package/dist/commands/pjm/init.js +19 -3
- package/dist/commands/project/dispatch/index.d.ts +10 -0
- package/dist/commands/project/dispatch/index.d.ts.map +1 -0
- package/dist/commands/project/dispatch/index.js +137 -0
- package/dist/commands/project/dispatch/record.d.ts +91 -0
- package/dist/commands/project/dispatch/record.d.ts.map +1 -0
- package/dist/commands/project/dispatch/record.js +402 -0
- package/dist/commands/project/index.d.ts.map +1 -1
- package/dist/commands/project/index.js +2 -0
- package/dist/commands/providers/inspect/inspect.d.ts +8 -1
- package/dist/commands/providers/inspect/inspect.d.ts.map +1 -1
- package/dist/commands/providers/inspect/inspect.js +146 -26
- package/dist/commands/providers/list/list.d.ts +8 -1
- package/dist/commands/providers/list/list.d.ts.map +1 -1
- package/dist/commands/providers/list/list.js +139 -23
- package/dist/commands/providers/providers.types.d.ts +25 -1
- package/dist/commands/providers/providers.types.d.ts.map +1 -1
- package/dist/commands/providers/set/index.d.ts +9 -1
- package/dist/commands/providers/set/index.d.ts.map +1 -1
- package/dist/commands/providers/set/index.js +43 -33
- package/dist/commands/remove/skill/remove-skill.d.ts.map +1 -1
- package/dist/commands/remove/skill/remove-skill.js +11 -0
- package/dist/commands/shared/agents-md.d.ts +42 -14
- package/dist/commands/shared/agents-md.d.ts.map +1 -1
- package/dist/commands/shared/agents-md.js +364 -70
- package/dist/commands/status/index.d.ts +8 -3
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +147 -32
- package/dist/commands/sync/apply.d.ts.map +1 -1
- package/dist/commands/sync/apply.js +220 -29
- package/dist/commands/sync/dry-run.d.ts.map +1 -1
- package/dist/commands/sync/dry-run.js +30 -6
- package/dist/commands/sync/index.d.ts +17 -2
- package/dist/commands/sync/index.d.ts.map +1 -1
- package/dist/commands/sync/index.js +106 -41
- package/dist/commands/sync/sync.types.d.ts +39 -2
- package/dist/commands/sync/sync.types.d.ts.map +1 -1
- package/dist/commands/sync/sync.utils.d.ts +5 -1
- package/dist/commands/sync/sync.utils.d.ts.map +1 -1
- package/dist/commands/sync/sync.utils.js +73 -0
- package/dist/commands/tools/info/info-tool.d.ts +2 -0
- package/dist/commands/tools/info/info-tool.d.ts.map +1 -1
- package/dist/commands/tools/info/info-tool.js +34 -12
- package/dist/commands/tools/install/index.d.ts.map +1 -1
- package/dist/commands/tools/install/index.js +19 -3
- package/dist/commands/tools/list/list-tools.d.ts +2 -0
- package/dist/commands/tools/list/list-tools.d.ts.map +1 -1
- package/dist/commands/tools/list/list-tools.js +36 -7
- package/dist/commands/tools/remove/index.d.ts.map +1 -1
- package/dist/commands/tools/remove/index.js +150 -21
- package/dist/commands/tools/remove/remove-tools.d.ts +20 -0
- package/dist/commands/tools/remove/remove-tools.d.ts.map +1 -1
- package/dist/commands/tools/remove/remove-tools.js +122 -1
- package/dist/commands/tools/shared/format-pack-inventory.d.ts +19 -0
- package/dist/commands/tools/shared/format-pack-inventory.d.ts.map +1 -1
- package/dist/commands/tools/shared/format-pack-inventory.js +109 -0
- package/dist/commands/tools/shared/pack-evidence.d.ts +66 -0
- package/dist/commands/tools/shared/pack-evidence.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-evidence.js +132 -0
- package/dist/commands/tools/shared/pack-inventory.d.ts +1 -0
- package/dist/commands/tools/shared/pack-inventory.d.ts.map +1 -1
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts +44 -0
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-lifecycle-outcome.js +91 -0
- package/dist/commands/tools/update/index.d.ts.map +1 -1
- package/dist/commands/tools/update/index.js +74 -4
- package/dist/commands/tools/update/update-tools.d.ts +5 -0
- package/dist/commands/tools/update/update-tools.d.ts.map +1 -1
- package/dist/commands/tools/update/update-tools.js +64 -2
- package/dist/config/oat-config.d.ts +5 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +17 -5
- package/dist/config/user-sync-config.d.ts +1 -0
- package/dist/config/user-sync-config.d.ts.map +1 -1
- package/dist/config/user-sync-config.js +8 -0
- package/dist/drift/detector.d.ts +2 -2
- package/dist/drift/detector.d.ts.map +1 -1
- package/dist/drift/detector.js +18 -0
- package/dist/drift/strays.d.ts.map +1 -1
- package/dist/drift/strays.js +5 -0
- package/dist/engine/collection-sync.d.ts +14 -0
- package/dist/engine/collection-sync.d.ts.map +1 -0
- package/dist/engine/collection-sync.js +282 -0
- package/dist/engine/compute-plan.d.ts +8 -1
- package/dist/engine/compute-plan.d.ts.map +1 -1
- package/dist/engine/compute-plan.js +303 -12
- package/dist/engine/engine.types.d.ts +61 -0
- package/dist/engine/engine.types.d.ts.map +1 -1
- package/dist/engine/execute-plan.d.ts +22 -2
- package/dist/engine/execute-plan.d.ts.map +1 -1
- package/dist/engine/execute-plan.js +459 -27
- package/dist/engine/provider-path-safety.d.ts +1 -0
- package/dist/engine/provider-path-safety.d.ts.map +1 -1
- package/dist/engine/provider-path-safety.js +15 -0
- package/dist/engine/scanner.d.ts +2 -2
- package/dist/engine/scanner.d.ts.map +1 -1
- package/dist/engine/scanner.js +21 -4
- package/dist/fs/io.d.ts +67 -0
- package/dist/fs/io.d.ts.map +1 -1
- package/dist/fs/io.js +536 -3
- package/dist/manifest/index.d.ts +2 -2
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/manifest/manager.d.ts +2 -2
- package/dist/manifest/manager.d.ts.map +1 -1
- package/dist/manifest/manager.js +20 -3
- package/dist/manifest/manifest.types.d.ts +704 -13
- package/dist/manifest/manifest.types.d.ts.map +1 -1
- package/dist/manifest/manifest.types.js +131 -15
- package/dist/providers/codex/codec/sync-extension.d.ts.map +1 -1
- package/dist/providers/codex/codec/sync-extension.js +41 -10
- package/dist/providers/cursor/codec/sync-extension.d.ts.map +1 -1
- package/dist/providers/cursor/codec/sync-extension.js +41 -10
- package/dist/providers/identity/absolute-paths.d.ts +68 -0
- package/dist/providers/identity/absolute-paths.d.ts.map +1 -0
- package/dist/providers/identity/absolute-paths.js +144 -0
- package/dist/providers/identity/claude-runtime-observation.d.ts +105 -0
- package/dist/providers/identity/claude-runtime-observation.d.ts.map +1 -0
- package/dist/providers/identity/claude-runtime-observation.fixtures.d.ts +40 -0
- package/dist/providers/identity/claude-runtime-observation.fixtures.d.ts.map +1 -0
- package/dist/providers/identity/claude-runtime-observation.fixtures.js +146 -0
- package/dist/providers/identity/claude-runtime-observation.js +229 -0
- package/dist/providers/identity/codex-runtime-observation.d.ts +75 -0
- package/dist/providers/identity/codex-runtime-observation.d.ts.map +1 -0
- package/dist/providers/identity/codex-runtime-observation.fixtures.d.ts +37 -0
- package/dist/providers/identity/codex-runtime-observation.fixtures.d.ts.map +1 -0
- package/dist/providers/identity/codex-runtime-observation.fixtures.js +539 -0
- package/dist/providers/identity/codex-runtime-observation.js +255 -0
- package/dist/providers/identity/generic-dispatch-record.d.ts +313 -0
- package/dist/providers/identity/generic-dispatch-record.d.ts.map +1 -0
- package/dist/providers/identity/generic-dispatch-record.js +539 -0
- package/dist/providers/identity/oat-dispatch-record.d.ts +1964 -0
- package/dist/providers/identity/oat-dispatch-record.d.ts.map +1 -0
- package/dist/providers/identity/oat-dispatch-record.js +691 -0
- package/dist/providers/identity/runtime-observation.d.ts +100 -0
- package/dist/providers/identity/runtime-observation.d.ts.map +1 -0
- package/dist/providers/identity/runtime-observation.js +169 -0
- package/dist/providers/shared/index.d.ts +2 -0
- package/dist/providers/shared/index.d.ts.map +1 -1
- package/dist/providers/shared/index.js +1 -0
- package/dist/providers/shared/materialization-extension.d.ts +12 -0
- package/dist/providers/shared/materialization-extension.d.ts.map +1 -1
- package/dist/providers/shared/registry.d.ts +69 -0
- package/dist/providers/shared/registry.d.ts.map +1 -0
- package/dist/providers/shared/registry.js +252 -0
- package/dist/providers/shared/restart-adviser.d.ts +26 -0
- package/dist/providers/shared/restart-adviser.d.ts.map +1 -0
- package/dist/providers/shared/restart-adviser.js +96 -0
- package/dist/shared/types.d.ts +4 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ToolPackEvidence } from '../../tools/shared/pack-evidence.js';
|
|
1
2
|
import type { PackInventory } from '../../tools/shared/pack-inventory.js';
|
|
2
3
|
import type { PackName, ToolInfo } from '../../tools/shared/types.js';
|
|
3
4
|
export type PackInstallLocation = 'not-installed' | 'project' | 'user' | 'both';
|
|
@@ -9,4 +10,5 @@ export interface PackInstallState {
|
|
|
9
10
|
export declare function resolvePackInstallLocation(project: boolean, user: boolean): PackInstallLocation;
|
|
10
11
|
export declare function buildPackInstallStateMap<TPack extends PackName>(packs: readonly TPack[], tools: ToolInfo[]): Record<TPack, PackInstallState>;
|
|
11
12
|
export declare function buildPackInstallStateMapFromInventory<TPack extends PackName>(packs: readonly TPack[], inventories: readonly PackInventory[]): Record<TPack, PackInstallState>;
|
|
13
|
+
export declare function buildPackInstallStateMapFromEvidence<TPack extends PackName>(packs: readonly TPack[], evidence: readonly ToolPackEvidence[]): Record<TPack, PackInstallState>;
|
|
12
14
|
//# sourceMappingURL=install-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-state.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/tools/install-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO,GACZ,mBAAmB,CAcrB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,QAAQ,EAC7D,KAAK,EAAE,SAAS,KAAK,EAAE,EACvB,KAAK,EAAE,QAAQ,EAAE,GAChB,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CA8BjC;AAED,wBAAgB,qCAAqC,CAAC,KAAK,SAAS,QAAQ,EAC1E,KAAK,EAAE,SAAS,KAAK,EAAE,EACvB,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAgBjC"}
|
|
1
|
+
{"version":3,"file":"install-state.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/tools/install-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO,GACZ,mBAAmB,CAcrB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,QAAQ,EAC7D,KAAK,EAAE,SAAS,KAAK,EAAE,EACvB,KAAK,EAAE,QAAQ,EAAE,GAChB,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CA8BjC;AAED,wBAAgB,qCAAqC,CAAC,KAAK,SAAS,QAAQ,EAC1E,KAAK,EAAE,SAAS,KAAK,EAAE,EACvB,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAgBjC;AAED,wBAAgB,oCAAoC,CAAC,KAAK,SAAS,QAAQ,EACzE,KAAK,EAAE,SAAS,KAAK,EAAE,EACvB,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GACpC,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAejC"}
|
|
@@ -45,3 +45,14 @@ export function buildPackInstallStateMapFromInventory(packs, inventories) {
|
|
|
45
45
|
];
|
|
46
46
|
}));
|
|
47
47
|
}
|
|
48
|
+
export function buildPackInstallStateMapFromEvidence(packs, evidence) {
|
|
49
|
+
return Object.fromEntries(packs.map((pack) => {
|
|
50
|
+
const packEvidence = evidence.find((candidate) => candidate.pack === pack);
|
|
51
|
+
const project = packEvidence?.knownRealizedScopes.includes('project') ?? false;
|
|
52
|
+
const user = packEvidence?.knownRealizedScopes.includes('user') ?? false;
|
|
53
|
+
return [
|
|
54
|
+
pack,
|
|
55
|
+
{ project, user, location: resolvePackInstallLocation(project, user) },
|
|
56
|
+
];
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { AgentsMdManualPatch } from '../../shared/agents-md.js';
|
|
2
|
+
import type { PromptContext } from '../../shared/shared.prompts.js';
|
|
3
|
+
import type { PackName } from '../../tools/shared/types.js';
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
export type ProjectGuidanceChoice = {
|
|
6
|
+
choice: 'accepted';
|
|
7
|
+
source: 'prompt' | 'flag';
|
|
8
|
+
} | {
|
|
9
|
+
choice: 'declined';
|
|
10
|
+
source: 'prompt' | 'flag';
|
|
11
|
+
} | {
|
|
12
|
+
choice: 'not-requested';
|
|
13
|
+
source: 'non-interactive-default';
|
|
14
|
+
};
|
|
15
|
+
export type AgentsGuidanceAction = 'declined' | 'not-requested' | 'create' | 'no-change' | 'manual-required' | 'blocked';
|
|
16
|
+
export interface ProjectGuidancePack {
|
|
17
|
+
pack: PackName;
|
|
18
|
+
scope: 'project' | 'user' | 'both';
|
|
19
|
+
}
|
|
20
|
+
export interface AgentsGuidancePlan {
|
|
21
|
+
repoRoot: string | null;
|
|
22
|
+
target: string | null;
|
|
23
|
+
action: AgentsGuidanceAction;
|
|
24
|
+
sectionKey: 'tools';
|
|
25
|
+
body: string;
|
|
26
|
+
legacySectionAction: 'preserve' | 'remove';
|
|
27
|
+
reason: string;
|
|
28
|
+
choice: ProjectGuidanceChoice;
|
|
29
|
+
manualPatch?: AgentsMdManualPatch;
|
|
30
|
+
}
|
|
31
|
+
export interface PlanProjectGuidanceInput {
|
|
32
|
+
repoRoot: string | null;
|
|
33
|
+
packs: readonly ProjectGuidancePack[];
|
|
34
|
+
explicitChoice?: boolean;
|
|
35
|
+
interactive: boolean;
|
|
36
|
+
confirmAction: (message: string, context: PromptContext) => Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
export declare function reportableProjectGuidance(plan: AgentsGuidancePlan): {
|
|
39
|
+
action: AgentsGuidanceAction;
|
|
40
|
+
choice: ProjectGuidanceChoice;
|
|
41
|
+
reason: string;
|
|
42
|
+
manualPatch?: AgentsMdManualPatch | undefined;
|
|
43
|
+
};
|
|
44
|
+
export declare function buildToolPacksSectionBody(packs: readonly ProjectGuidancePack[]): string;
|
|
45
|
+
export declare function parseProjectGuidanceFlags(args: readonly string[]): boolean | undefined;
|
|
46
|
+
export declare function commandProjectGuidanceChoice(command: Command): boolean | undefined;
|
|
47
|
+
export declare function withProjectGuidanceOptions<TCommand extends Command>(command: TCommand): TCommand;
|
|
48
|
+
export declare function planProjectGuidance(input: PlanProjectGuidanceInput): Promise<AgentsGuidancePlan>;
|
|
49
|
+
//# sourceMappingURL=project-guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-guidance.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/tools/project-guidance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,qBAAqB,GAC7B;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAE,GACjD;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAE,GACjD;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,yBAAyB,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,eAAe,GACf,QAAQ,GACR,WAAW,GACX,iBAAiB,GACjB,SAAS,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACtC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9E;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB;;;;;EAOjE;AAgBD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,mBAAmB,EAAE,GACpC,MAAM,CA2CR;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,OAAO,GAAG,SAAS,CAYrB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,GACf,OAAO,GAAG,SAAS,CAKrB;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,SAAS,OAAO,EACjE,OAAO,EAAE,QAAQ,GAChB,QAAQ,CAcV;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,kBAAkB,CAAC,CAyE7B"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { CliError } from '../../../errors/index.js';
|
|
3
|
+
export function reportableProjectGuidance(plan) {
|
|
4
|
+
return {
|
|
5
|
+
action: plan.action,
|
|
6
|
+
choice: plan.choice,
|
|
7
|
+
reason: plan.reason,
|
|
8
|
+
...(plan.manualPatch ? { manualPatch: plan.manualPatch } : {}),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const PACK_DESCRIPTIONS = {
|
|
12
|
+
core: 'Diagnostics and documentation (oat-doctor, oat-docs)',
|
|
13
|
+
docs: 'Documentation and instruction governance workflows',
|
|
14
|
+
workflows: 'Project lifecycle (create, discover, plan, implement, review, complete)',
|
|
15
|
+
ideas: 'Idea capture and refinement',
|
|
16
|
+
'project-management': 'Local backlog, roadmap, and reference doc management (oat-pjm-* skills)',
|
|
17
|
+
utility: 'Standalone utilities (skill authoring, maintainability review, code reviews)',
|
|
18
|
+
research: 'Research, analysis, verification, and synthesis',
|
|
19
|
+
brainstorm: 'Always-on brainstorming entry point with visual companion',
|
|
20
|
+
};
|
|
21
|
+
export function buildToolPacksSectionBody(packs) {
|
|
22
|
+
const userPacks = packs.filter((pack) => pack.scope === 'user' || pack.scope === 'both');
|
|
23
|
+
const hasWorkflows = packs.some((pack) => pack.pack === 'workflows');
|
|
24
|
+
const lines = [
|
|
25
|
+
'## Tool Packs',
|
|
26
|
+
'',
|
|
27
|
+
'- **Skills directory:** `.agents/skills/`',
|
|
28
|
+
'- **Discover available skills:** scan `.agents/skills/*/SKILL.md`',
|
|
29
|
+
'- **Refresh provider views:** `oat sync --scope all`',
|
|
30
|
+
'- **Update skills to latest versions:** `oat tools update`',
|
|
31
|
+
];
|
|
32
|
+
if (userPacks.length > 0) {
|
|
33
|
+
lines.push(`- **User-scoped skills:** \`~/.agents/skills/\` (${userPacks.map(({ pack }) => pack).join(', ')} packs installed at user scope)`);
|
|
34
|
+
}
|
|
35
|
+
lines.push('', '### Installed Packs', '');
|
|
36
|
+
for (const { pack, scope } of packs) {
|
|
37
|
+
const suffix = scope === 'user'
|
|
38
|
+
? ' _(user scope)_'
|
|
39
|
+
: scope === 'both'
|
|
40
|
+
? ' _(project + user scope)_'
|
|
41
|
+
: '';
|
|
42
|
+
lines.push(`- **${pack}** — ${PACK_DESCRIPTIONS[pack]}${suffix}`);
|
|
43
|
+
}
|
|
44
|
+
if (hasWorkflows) {
|
|
45
|
+
lines.push('', '### Workflow Execution Continuation', '', '- This guidance applies only to OAT project lifecycle execution, such as `oat-project-implement`, and OAT project review/receive flows. It does not apply to non-OAT tasks or ad-hoc work outside the OAT project workflow.', '- When executing an OAT project implementation or OAT project review workflow, do not stop at task boundaries, phase boundaries, or other clean checkpoints unless the configured HiLL checkpoint has been reached, a real blocker exists, or explicit user input is required.', '- Status summaries, completed bookkeeping, and "clean boundary" pauses are not valid stop reasons. After updating tracking artifacts, continue execution until an allowed stop condition applies.');
|
|
46
|
+
}
|
|
47
|
+
return lines.join('\n');
|
|
48
|
+
}
|
|
49
|
+
export function parseProjectGuidanceFlags(args) {
|
|
50
|
+
const accepted = args.includes('--project-guidance');
|
|
51
|
+
const declined = args.includes('--no-project-guidance');
|
|
52
|
+
if (accepted && declined) {
|
|
53
|
+
throw new CliError('--project-guidance and --no-project-guidance cannot be used together.', 1);
|
|
54
|
+
}
|
|
55
|
+
if (accepted)
|
|
56
|
+
return true;
|
|
57
|
+
if (declined)
|
|
58
|
+
return false;
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
export function commandProjectGuidanceChoice(command) {
|
|
62
|
+
let root = command;
|
|
63
|
+
while (root.parent)
|
|
64
|
+
root = root.parent;
|
|
65
|
+
const rawArgs = root.rawArgs;
|
|
66
|
+
return parseProjectGuidanceFlags(rawArgs ?? process.argv.slice(2));
|
|
67
|
+
}
|
|
68
|
+
export function withProjectGuidanceOptions(command) {
|
|
69
|
+
if (!command.options.some(({ long }) => long === '--project-guidance')) {
|
|
70
|
+
command.option('--project-guidance', 'Create missing or print manual repository AGENTS.md tool guidance');
|
|
71
|
+
}
|
|
72
|
+
if (!command.options.some(({ long }) => long === '--no-project-guidance')) {
|
|
73
|
+
command.option('--no-project-guidance', 'Decline repository AGENTS.md tool guidance');
|
|
74
|
+
}
|
|
75
|
+
return command;
|
|
76
|
+
}
|
|
77
|
+
export async function planProjectGuidance(input) {
|
|
78
|
+
let choice;
|
|
79
|
+
if (input.explicitChoice === true) {
|
|
80
|
+
choice = { choice: 'accepted', source: 'flag' };
|
|
81
|
+
}
|
|
82
|
+
else if (input.explicitChoice === false) {
|
|
83
|
+
choice = { choice: 'declined', source: 'flag' };
|
|
84
|
+
}
|
|
85
|
+
else if (!input.interactive) {
|
|
86
|
+
choice = {
|
|
87
|
+
choice: 'not-requested',
|
|
88
|
+
source: 'non-interactive-default',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const accepted = await input.confirmAction('Create missing or propose manual repository AGENTS.md tool guidance?', { interactive: input.interactive });
|
|
93
|
+
choice = accepted
|
|
94
|
+
? { choice: 'accepted', source: 'prompt' }
|
|
95
|
+
: { choice: 'declined', source: 'prompt' };
|
|
96
|
+
}
|
|
97
|
+
const body = buildToolPacksSectionBody(input.packs);
|
|
98
|
+
if (choice.choice === 'declined') {
|
|
99
|
+
return {
|
|
100
|
+
repoRoot: input.repoRoot,
|
|
101
|
+
target: input.repoRoot ? join(input.repoRoot, 'AGENTS.md') : null,
|
|
102
|
+
action: 'declined',
|
|
103
|
+
sectionKey: 'tools',
|
|
104
|
+
body,
|
|
105
|
+
legacySectionAction: 'preserve',
|
|
106
|
+
reason: 'Project guidance was declined; capability placement is unchanged.',
|
|
107
|
+
choice,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (choice.choice === 'not-requested') {
|
|
111
|
+
return {
|
|
112
|
+
repoRoot: input.repoRoot,
|
|
113
|
+
target: input.repoRoot ? join(input.repoRoot, 'AGENTS.md') : null,
|
|
114
|
+
action: 'not-requested',
|
|
115
|
+
sectionKey: 'tools',
|
|
116
|
+
body,
|
|
117
|
+
legacySectionAction: 'preserve',
|
|
118
|
+
reason: 'Project guidance was not requested. Re-run with --project-guidance to create an absent AGENTS.md or print a manual patch for an existing one.',
|
|
119
|
+
choice,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (!input.repoRoot) {
|
|
123
|
+
return {
|
|
124
|
+
repoRoot: null,
|
|
125
|
+
target: null,
|
|
126
|
+
action: 'blocked',
|
|
127
|
+
sectionKey: 'tools',
|
|
128
|
+
body,
|
|
129
|
+
legacySectionAction: 'preserve',
|
|
130
|
+
reason: 'Project guidance requires a repository root; capability installation remains independent.',
|
|
131
|
+
choice,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
repoRoot: input.repoRoot,
|
|
136
|
+
target: join(input.repoRoot, 'AGENTS.md'),
|
|
137
|
+
action: 'create',
|
|
138
|
+
sectionKey: 'tools',
|
|
139
|
+
body,
|
|
140
|
+
legacySectionAction: 'remove',
|
|
141
|
+
reason: 'Project guidance was accepted. An absent AGENTS.md may be created; an existing file requires a manual patch.',
|
|
142
|
+
choice,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type CommandContext, type GlobalOptions } from '../../../../app/command-context.js';
|
|
2
|
+
import { type AgentsMdMutationOptions, type UpsertSectionResult } from '../../../shared/agents-md.js';
|
|
2
3
|
import { type PromptContext } from '../../../shared/shared.prompts.js';
|
|
4
|
+
import type { ScanToolsOptions } from '../../../tools/shared/scan-tools.js';
|
|
5
|
+
import type { ToolInfo } from '../../../tools/shared/types.js';
|
|
3
6
|
import { Command } from 'commander';
|
|
7
|
+
import { planProjectGuidance } from '../project-guidance.js';
|
|
4
8
|
import { type InstallWorkflowsOptions, type InstallWorkflowsResult, type InstallWorkflowsScope } from './install-workflows.js';
|
|
5
9
|
interface InitToolsWorkflowsDependencies {
|
|
6
10
|
buildCommandContext: (options: GlobalOptions) => CommandContext;
|
|
@@ -9,6 +13,9 @@ interface InitToolsWorkflowsDependencies {
|
|
|
9
13
|
resolveAssetsRoot: () => Promise<string>;
|
|
10
14
|
installWorkflows: (options: InstallWorkflowsOptions) => Promise<InstallWorkflowsResult>;
|
|
11
15
|
confirmAction: (message: string, ctx: PromptContext) => Promise<boolean>;
|
|
16
|
+
scanTools: (options: ScanToolsOptions) => Promise<ToolInfo[]>;
|
|
17
|
+
planProjectGuidance: typeof planProjectGuidance;
|
|
18
|
+
upsertAgentsMdSection: (repoRoot: string, key: string, body: string, options?: AgentsMdMutationOptions) => Promise<UpsertSectionResult>;
|
|
12
19
|
}
|
|
13
20
|
export declare function createInitToolsWorkflowsCommand(overrides?: Partial<InitToolsWorkflowsDependencies>): Command;
|
|
14
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init/tools/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init/tools/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EAIzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,iCAAiC,CAAC;AAQzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAGL,mBAAmB,EAIpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAM7B,UAAU,8BAA8B;IACtC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,gBAAgB,EAAE,CAChB,KAAK,EAAE,qBAAqB,EAC5B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,KACT,MAAM,CAAC;IACZ,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,gBAAgB,EAAE,CAChB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzE,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9D,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,qBAAqB,EAAE,CACrB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,uBAAuB,KAC9B,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACnC;AA+SD,wBAAgB,+BAA+B,CAC7C,SAAS,GAAE,OAAO,CAAC,8BAA8B,CAAM,GACtD,OAAO,CAuBT"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { buildCommandContext, } from '../../../../app/command-context.js';
|
|
2
|
+
import { formatAgentsMdGuidanceResult, formatAgentsMdMutationFailure, upsertAgentsMdSection, } from '../../../shared/agents-md.js';
|
|
2
3
|
import { withScopeOption } from '../../../shared/scope-option.js';
|
|
3
4
|
import { confirmAction, } from '../../../shared/shared.prompts.js';
|
|
4
5
|
import { readGlobalOptions } from '../../../shared/shared.utils.js';
|
|
5
6
|
import { canonicalPathsForPack, setInstalledCanonicalPaths, } from '../../../tools/shared/install-sync-context.js';
|
|
6
7
|
import { getPackDefinition } from '../../../tools/shared/pack-manifest.js';
|
|
8
|
+
import { scanTools } from '../../../tools/shared/scan-tools.js';
|
|
7
9
|
import { resolveAssetsRoot } from '../../../../fs/assets.js';
|
|
8
10
|
import { resolveProjectRoot, resolveScopeRoot } from '../../../../fs/paths.js';
|
|
9
11
|
import { Command } from 'commander';
|
|
12
|
+
import { commandProjectGuidanceChoice, planProjectGuidance, reportableProjectGuidance, withProjectGuidanceOptions, } from '../project-guidance.js';
|
|
10
13
|
import { installWorkflows as defaultInstallWorkflows, } from './install-workflows.js';
|
|
11
14
|
const DEFAULT_DEPENDENCIES = {
|
|
12
15
|
buildCommandContext,
|
|
@@ -15,29 +18,174 @@ const DEFAULT_DEPENDENCIES = {
|
|
|
15
18
|
resolveAssetsRoot,
|
|
16
19
|
installWorkflows: defaultInstallWorkflows,
|
|
17
20
|
confirmAction,
|
|
21
|
+
scanTools,
|
|
22
|
+
planProjectGuidance,
|
|
23
|
+
upsertAgentsMdSection,
|
|
18
24
|
};
|
|
19
|
-
|
|
25
|
+
const ALL_TOOL_PACKS = [
|
|
26
|
+
'core',
|
|
27
|
+
'ideas',
|
|
28
|
+
'docs',
|
|
29
|
+
'workflows',
|
|
30
|
+
'utility',
|
|
31
|
+
'project-management',
|
|
32
|
+
'research',
|
|
33
|
+
'brainstorm',
|
|
34
|
+
];
|
|
35
|
+
function realizedProjectGuidancePacks(tools) {
|
|
36
|
+
return ALL_TOOL_PACKS.flatMap((pack) => {
|
|
37
|
+
const project = tools.some((tool) => tool.pack === pack && tool.scope === 'project');
|
|
38
|
+
const user = tools.some((tool) => tool.pack === pack && tool.scope === 'user');
|
|
39
|
+
if (!project && !user)
|
|
40
|
+
return [];
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
pack,
|
|
44
|
+
scope: project && user ? 'both' : project ? 'project' : 'user',
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async function applyProjectGuidance(plan, dependencies) {
|
|
50
|
+
if (plan.action !== 'create' || !plan.repoRoot)
|
|
51
|
+
return plan;
|
|
52
|
+
try {
|
|
53
|
+
const result = await dependencies.upsertAgentsMdSection(plan.repoRoot, plan.sectionKey, plan.body, plan.legacySectionAction === 'remove'
|
|
54
|
+
? { removeSectionKeys: ['workflows'] }
|
|
55
|
+
: undefined);
|
|
56
|
+
if (result.action === 'manual-required') {
|
|
57
|
+
return {
|
|
58
|
+
...plan,
|
|
59
|
+
action: 'manual-required',
|
|
60
|
+
reason: 'Accepted project guidance requires the reported manual AGENTS.md patch. Capability placement and PJM adoption were unchanged.',
|
|
61
|
+
manualPatch: result.manualPatch,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (result.action === 'blocked') {
|
|
65
|
+
return {
|
|
66
|
+
...plan,
|
|
67
|
+
action: 'blocked',
|
|
68
|
+
reason: `Accepted project guidance was blocked: ${result.blocked?.reason ?? 'AGENTS.md could not be planned safely.'} ${result.blocked?.action ?? ''}`.trim(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...plan,
|
|
73
|
+
action: result.action === 'created' ? 'create' : 'no-change',
|
|
74
|
+
reason: `Accepted project guidance ${result.action}. Capability placement and PJM adoption were unchanged.`,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
...plan,
|
|
80
|
+
action: 'blocked',
|
|
81
|
+
reason: `Accepted project guidance was blocked: ${formatAgentsMdMutationFailure(error)}`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function reportSuccess(context, scope, targetRoot, assetsRoot, result, projectGuidance) {
|
|
20
86
|
if (context.json) {
|
|
87
|
+
if (projectGuidance.action === 'blocked' ||
|
|
88
|
+
projectGuidance.action === 'manual-required') {
|
|
89
|
+
context.logger.json({
|
|
90
|
+
status: 'partial',
|
|
91
|
+
scope,
|
|
92
|
+
capability: {
|
|
93
|
+
status: 'complete',
|
|
94
|
+
skills: result.copiedSkills.length + result.updatedSkills.length,
|
|
95
|
+
agents: result.copiedAgents.length + result.updatedAgents.length,
|
|
96
|
+
templates: result.copiedTemplates.length + result.updatedTemplates.length,
|
|
97
|
+
scripts: result.copiedScripts.length + result.updatedScripts.length,
|
|
98
|
+
},
|
|
99
|
+
projectGuidance: reportableProjectGuidance(projectGuidance),
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
21
103
|
context.logger.json({
|
|
22
104
|
status: 'ok',
|
|
23
105
|
scope,
|
|
24
106
|
targetRoot,
|
|
25
107
|
assetsRoot,
|
|
26
108
|
result,
|
|
109
|
+
projectGuidance: reportableProjectGuidance(projectGuidance),
|
|
27
110
|
});
|
|
28
111
|
return;
|
|
29
112
|
}
|
|
30
113
|
context.logger.info('Installed workflows tool pack.');
|
|
31
114
|
context.logger.info(`Scope: ${scope}`);
|
|
32
|
-
|
|
115
|
+
if (projectGuidance.action !== 'blocked' &&
|
|
116
|
+
projectGuidance.action !== 'manual-required') {
|
|
117
|
+
context.logger.info(`Target root: ${targetRoot}`);
|
|
118
|
+
}
|
|
33
119
|
context.logger.info(`Skills: copied=${result.copiedSkills.length}, updated=${result.updatedSkills.length}, skipped=${result.skippedSkills.length}`);
|
|
34
120
|
context.logger.info(`Agents: copied=${result.copiedAgents.length}, updated=${result.updatedAgents.length}, skipped=${result.skippedAgents.length}`);
|
|
35
121
|
context.logger.info(`Templates: copied=${result.copiedTemplates.length}, updated=${result.updatedTemplates.length}, skipped=${result.skippedTemplates.length}`);
|
|
36
122
|
context.logger.info(`Scripts: copied=${result.copiedScripts.length}, updated=${result.updatedScripts.length}, skipped=${result.skippedScripts.length}`);
|
|
37
123
|
context.logger.info(`Projects root initialized: ${result.projectsRootInitialized ? 'yes' : 'no'}`);
|
|
124
|
+
const guidanceMessage = `Project guidance: ${projectGuidance.action} — ${projectGuidance.reason}`;
|
|
125
|
+
if (projectGuidance.action === 'blocked' ||
|
|
126
|
+
projectGuidance.action === 'manual-required') {
|
|
127
|
+
context.logger.warn(guidanceMessage);
|
|
128
|
+
if (projectGuidance.manualPatch) {
|
|
129
|
+
for (const line of formatAgentsMdGuidanceResult({
|
|
130
|
+
action: 'manual-required',
|
|
131
|
+
manualPatch: projectGuidance.manualPatch,
|
|
132
|
+
})) {
|
|
133
|
+
context.logger.info(line);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
context.logger.info(guidanceMessage);
|
|
139
|
+
}
|
|
38
140
|
context.logger.info(`Run: oat sync --scope ${scope}`);
|
|
39
141
|
}
|
|
40
|
-
async function
|
|
142
|
+
async function planAndApplyProjectGuidance(context, scope, targetRoot, assetsRoot, explicitChoice, dependencies) {
|
|
143
|
+
const projectTarget = scope === 'project' ? targetRoot : null;
|
|
144
|
+
const initialPlan = await dependencies.planProjectGuidance({
|
|
145
|
+
repoRoot: projectTarget,
|
|
146
|
+
packs: [],
|
|
147
|
+
explicitChoice,
|
|
148
|
+
interactive: context.interactive,
|
|
149
|
+
confirmAction: dependencies.confirmAction,
|
|
150
|
+
});
|
|
151
|
+
if (initialPlan.choice.choice !== 'accepted')
|
|
152
|
+
return initialPlan;
|
|
153
|
+
try {
|
|
154
|
+
let repoRoot = projectTarget;
|
|
155
|
+
if (!repoRoot) {
|
|
156
|
+
repoRoot = await dependencies.resolveProjectRoot(context.cwd);
|
|
157
|
+
}
|
|
158
|
+
const userRoot = dependencies.resolveScopeRoot('user', context.cwd, context.home);
|
|
159
|
+
const [projectTools, userTools] = await Promise.all([
|
|
160
|
+
dependencies.scanTools({
|
|
161
|
+
scope: 'project',
|
|
162
|
+
scopeRoot: repoRoot,
|
|
163
|
+
assetsRoot,
|
|
164
|
+
}),
|
|
165
|
+
dependencies.scanTools({
|
|
166
|
+
scope: 'user',
|
|
167
|
+
scopeRoot: userRoot,
|
|
168
|
+
assetsRoot,
|
|
169
|
+
}),
|
|
170
|
+
]);
|
|
171
|
+
const completePlan = await dependencies.planProjectGuidance({
|
|
172
|
+
repoRoot,
|
|
173
|
+
packs: realizedProjectGuidancePacks([...projectTools, ...userTools]),
|
|
174
|
+
explicitChoice: true,
|
|
175
|
+
interactive: false,
|
|
176
|
+
confirmAction: dependencies.confirmAction,
|
|
177
|
+
});
|
|
178
|
+
return applyProjectGuidance(completePlan, dependencies);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
return {
|
|
182
|
+
...initialPlan,
|
|
183
|
+
action: 'blocked',
|
|
184
|
+
reason: `Accepted project guidance was blocked: ${formatAgentsMdMutationFailure(error)}`,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async function runInitToolsWorkflows(context, options, dependencies, explicitProjectGuidance) {
|
|
41
189
|
try {
|
|
42
190
|
const scope = context.scope === 'project' || context.scope === 'user'
|
|
43
191
|
? context.scope
|
|
@@ -62,8 +210,13 @@ async function runInitToolsWorkflows(context, options, dependencies) {
|
|
|
62
210
|
scope,
|
|
63
211
|
force: options.force,
|
|
64
212
|
});
|
|
65
|
-
|
|
66
|
-
|
|
213
|
+
const projectGuidance = await planAndApplyProjectGuidance(context, scope, targetRoot, assetsRoot, explicitProjectGuidance, dependencies);
|
|
214
|
+
reportSuccess(context, scope, targetRoot, assetsRoot, result, projectGuidance);
|
|
215
|
+
process.exitCode =
|
|
216
|
+
projectGuidance.action === 'blocked' ||
|
|
217
|
+
projectGuidance.action === 'manual-required'
|
|
218
|
+
? 1
|
|
219
|
+
: 0;
|
|
67
220
|
return true;
|
|
68
221
|
}
|
|
69
222
|
catch (error) {
|
|
@@ -83,12 +236,12 @@ export function createInitToolsWorkflowsCommand(overrides = {}) {
|
|
|
83
236
|
...DEFAULT_DEPENDENCIES,
|
|
84
237
|
...overrides,
|
|
85
238
|
};
|
|
86
|
-
return withScopeOption(new Command('workflows'))
|
|
239
|
+
return withProjectGuidanceOptions(withScopeOption(new Command('workflows')))
|
|
87
240
|
.description('Install OAT workflows skills, agents, templates, and scripts')
|
|
88
241
|
.option('--force', 'Overwrite existing files where applicable')
|
|
89
242
|
.action(async (options, command) => {
|
|
90
243
|
const context = dependencies.buildCommandContext(readGlobalOptions(command));
|
|
91
|
-
const didInstall = await runInitToolsWorkflows(context, options, dependencies);
|
|
244
|
+
const didInstall = await runInitToolsWorkflows(context, options, dependencies, commandProjectGuidanceChoice(command));
|
|
92
245
|
if (didInstall) {
|
|
93
246
|
setInstalledCanonicalPaths(command, canonicalPathsForPack('workflows'));
|
|
94
247
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAA0B,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAiBnE,UAAU,sBAAsB;IAC9B,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD;AA6FD,wBAAgB,gBAAgB,CAC9B,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,OAAO,CAyLT"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import { buildCommandContext } from '../../app/command-context.js';
|
|
3
|
+
import { formatAgentsMdGuidanceResult } from '../shared/agents-md.js';
|
|
3
4
|
import { readGlobalOptions } from '../shared/shared.utils.js';
|
|
4
5
|
import { resolveAssetsRoot } from '../../fs/assets.js';
|
|
5
6
|
import { resolveProjectRoot } from '../../fs/paths.js';
|
|
@@ -102,11 +103,27 @@ export function createPjmCommand(overrides = {}) {
|
|
|
102
103
|
templatesRoot: resolve(projectRoot, '.oat', 'templates'),
|
|
103
104
|
home: context.home,
|
|
104
105
|
});
|
|
106
|
+
const guidanceIncomplete = Object.values(result.guidance ?? {}).some(({ action }) => action === 'manual-required' || action === 'blocked');
|
|
105
107
|
if (context.json) {
|
|
106
|
-
|
|
108
|
+
if (guidanceIncomplete) {
|
|
109
|
+
context.logger.json({
|
|
110
|
+
status: 'partial',
|
|
111
|
+
scaffold: { status: 'complete' },
|
|
112
|
+
adoption: { status: 'declared' },
|
|
113
|
+
created: result.created,
|
|
114
|
+
skipped: result.skipped,
|
|
115
|
+
guidance: result.guidance,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const { guidance: _guidance, ...completed } = result;
|
|
120
|
+
context.logger.json({ status: 'ok', ...completed });
|
|
121
|
+
}
|
|
107
122
|
}
|
|
108
123
|
else {
|
|
109
|
-
context.logger.info(
|
|
124
|
+
context.logger.info(guidanceIncomplete
|
|
125
|
+
? 'Initialized PJM repo reference scaffold.'
|
|
126
|
+
: `Initialized PJM repo reference scaffold at ${result.repoRoot}`);
|
|
110
127
|
if (result.created.length > 0) {
|
|
111
128
|
context.logger.info(`Created: ${result.created.join(', ')}`);
|
|
112
129
|
}
|
|
@@ -114,8 +131,16 @@ export function createPjmCommand(overrides = {}) {
|
|
|
114
131
|
context.logger.info(`Skipped existing: ${result.skipped.join(', ')}`);
|
|
115
132
|
}
|
|
116
133
|
context.logger.info(INSTRUCTIONS_SYNC_HINT);
|
|
134
|
+
if (guidanceIncomplete) {
|
|
135
|
+
context.logger.warn('PJM scaffold and adoption completed; AGENTS.md guidance requires manual action.');
|
|
136
|
+
for (const guidance of Object.values(result.guidance ?? {})) {
|
|
137
|
+
for (const line of formatAgentsMdGuidanceResult(guidance)) {
|
|
138
|
+
context.logger.info(line);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
117
142
|
}
|
|
118
|
-
process.exitCode = 0;
|
|
143
|
+
process.exitCode = guidanceIncomplete ? 1 : 0;
|
|
119
144
|
}
|
|
120
145
|
catch (error) {
|
|
121
146
|
reportError(context, error);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type UpsertSectionResult } from '../shared/agents-md.js';
|
|
1
2
|
export interface InitializeRepoReferenceOptions {
|
|
2
3
|
repoRoot: string;
|
|
3
4
|
assetsRoot: string;
|
|
@@ -9,6 +10,10 @@ export interface RepoReferenceInitResult {
|
|
|
9
10
|
repoRoot: string;
|
|
10
11
|
created: string[];
|
|
11
12
|
skipped: string[];
|
|
13
|
+
guidance: {
|
|
14
|
+
projectManagement: UpsertSectionResult;
|
|
15
|
+
decisions: UpsertSectionResult;
|
|
16
|
+
};
|
|
12
17
|
}
|
|
13
18
|
export declare const INSTRUCTIONS_SYNC_HINT: string;
|
|
14
19
|
export declare const CANONICAL_REPO_REFERENCE_PATHS: readonly [...("AGENTS.md" | "README.md" | "pjm/AGENTS.md" | "pjm/current-state.md" | "pjm/handoffs/README.md" | "pjm/roadmap.md" | "reference/AGENTS.md")[], "pjm/backlog/index.md", "pjm/backlog/completed.md", "pjm/backlog/items/.gitkeep", "pjm/backlog/archived/.gitkeep", "reference/decisions/AGENTS.md", "reference/decisions/index.md"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/init.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,4BAA4B,CAAC;AAMpC,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE;QACR,iBAAiB,EAAE,mBAAmB,CAAC;QACvC,SAAS,EAAE,mBAAmB,CAAC;KAChC,CAAC;CACH;AAoBD,eAAO,MAAM,sBAAsB,QAEiD,CAAC;AAerF,eAAO,MAAM,8BAA8B,kVAIjC,CAAC;AAEX,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAiC7C,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC,CAsHlC"}
|
|
@@ -4,7 +4,7 @@ import { initializeBacklog } from '../backlog/init.js';
|
|
|
4
4
|
import { buildDecisionAgentsSectionBody, DECISION_AGENTS_SECTION_KEY, initializeScopedDecisionAgentsGuidance, } from '../decision/agents-guidance.js';
|
|
5
5
|
import { initializeDecisionRecords } from '../decision/init.js';
|
|
6
6
|
import { buildProjectManagementAgentsSectionBody, PROJECT_MANAGEMENT_AGENTS_SECTION_KEY, } from '../init/tools/project-management/agents-guidance.js';
|
|
7
|
-
import {
|
|
7
|
+
import { upsertAgentsMdSections, } from '../shared/agents-md.js';
|
|
8
8
|
import { stripTemplateFrontmatter } from '../shared/strip-template-frontmatter.js';
|
|
9
9
|
import { readOatConfig, writeOatConfig } from '../../config/oat-config.js';
|
|
10
10
|
import { resolvePjmTemplate } from './template-source.js';
|
|
@@ -138,11 +138,27 @@ export async function initializeRepoReference(options) {
|
|
|
138
138
|
// it is written here — after scaffold verification and alongside the
|
|
139
139
|
// `pjm.initialized` marker — so installing the capability at any scope never
|
|
140
140
|
// implies that this repository adopted PJM.
|
|
141
|
-
await
|
|
142
|
-
|
|
141
|
+
const guidance = await upsertAgentsMdSections(projectRoot, [
|
|
142
|
+
{
|
|
143
|
+
key: PROJECT_MANAGEMENT_AGENTS_SECTION_KEY,
|
|
144
|
+
body: buildProjectManagementAgentsSectionBody(),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
key: DECISION_AGENTS_SECTION_KEY,
|
|
148
|
+
body: buildDecisionAgentsSectionBody(),
|
|
149
|
+
},
|
|
150
|
+
]);
|
|
143
151
|
return {
|
|
144
152
|
repoRoot: options.repoRoot,
|
|
145
153
|
created,
|
|
146
154
|
skipped,
|
|
155
|
+
guidance: {
|
|
156
|
+
projectManagement: guidance[PROJECT_MANAGEMENT_AGENTS_SECTION_KEY] ?? {
|
|
157
|
+
action: 'no-change',
|
|
158
|
+
},
|
|
159
|
+
decisions: guidance[DECISION_AGENTS_SECTION_KEY] ?? {
|
|
160
|
+
action: 'no-change',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
147
163
|
};
|
|
148
164
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CommandContext, type GlobalOptions } from '../../../app/command-context.js';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
export interface ProjectDispatchCommandDependencies {
|
|
4
|
+
buildCommandContext: (options: GlobalOptions) => CommandContext;
|
|
5
|
+
resolveProjectRoot: (cwd: string) => Promise<string>;
|
|
6
|
+
readFile: (path: string) => Promise<string>;
|
|
7
|
+
readStdin: () => Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createProjectDispatchCommand(overrides?: Partial<ProjectDispatchCommandDependencies>): Command;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/dispatch/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,MAAM,WAAW,kCAAkC;IACjD,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAClC;AA0ID,wBAAgB,4BAA4B,CAC1C,SAAS,GAAE,OAAO,CAAC,kCAAkC,CAAM,GAC1D,OAAO,CA2BT"}
|