@namewta/speculo 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +42 -29
  2. package/dist/src/agent-skills.d.ts +43 -17
  3. package/dist/src/agent-skills.js +95 -28
  4. package/dist/src/agent-skills.js.map +1 -1
  5. package/dist/src/cli.js +43 -27
  6. package/dist/src/cli.js.map +1 -1
  7. package/dist/src/index.d.ts +20 -6
  8. package/dist/src/index.js +36 -11
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/install-ui.d.ts +61 -0
  11. package/dist/src/install-ui.js +268 -0
  12. package/dist/src/install-ui.js.map +1 -0
  13. package/dist/src/interaction.d.ts +5 -0
  14. package/dist/src/interaction.js +10 -0
  15. package/dist/src/interaction.js.map +1 -0
  16. package/dist/src/transaction.d.ts +2 -0
  17. package/dist/src/transaction.js +16 -0
  18. package/dist/src/transaction.js.map +1 -1
  19. package/dist/src/workflows.js +2 -2
  20. package/dist/src/workflows.js.map +1 -1
  21. package/package.json +2 -2
  22. package/template/canonical/canonical-specdev-goal-plan.md +1747 -662
  23. package/template/canonical/canonical-specdev-grill-with-docs.md +1065 -233
  24. package/template/canonical/canonical-specdev-spec.md +1066 -278
  25. package/template/canonical/canonical-specdev-tickets.md +926 -184
  26. package/template/canonical/canonical-specdev-wayfinder.md +1060 -222
  27. package/template/commands/handoff/COMMAND.md +10 -0
  28. package/template/references/coordination/coordination-contract.md +12 -10
  29. package/template/references/coordination/modes/cli.md +6 -6
  30. package/template/references/coordination/modes/herdr.md +18 -3
  31. package/template/references/coordination/modes/orca.md +32 -9
  32. package/template/references/coordination/result-and-recovery.md +7 -4
  33. package/template/references/coordination/session-files.md +93 -0
  34. package/template/references/coordination/task-brief.md +10 -8
  35. package/template/workflows/specdev/SKILL.md +2 -2
  36. package/template/workflows/specdev/common/rules/adr-format.md +5 -11
  37. package/template/workflows/specdev/common/rules/artifact-contract.md +2 -2
  38. package/template/workflows/specdev/common/rules/change-completion.md +7 -2
  39. package/template/workflows/specdev/common/rules/domain-runtime.md +2 -2
  40. package/template/workflows/specdev/common/rules/evidence-and-verification.md +2 -2
  41. package/template/workflows/specdev/common/rules/execution-policy.md +28 -0
  42. package/template/workflows/specdev/common/rules/operating-governance.md +2 -2
  43. package/template/workflows/specdev/common/rules/path-ownership.md +3 -3
  44. package/template/workflows/specdev/common/rules/path-reference-contract.md +2 -0
  45. package/template/workflows/specdev/common/rules/planning-principles.md +1 -1
  46. package/template/workflows/specdev/common/rules/readiness-and-depth.md +5 -5
  47. package/template/workflows/specdev/common/rules/workflow-routing.md +3 -3
  48. package/template/workflows/specdev/common/rules/workflow-state-and-lifecycle.md +2 -0
  49. package/template/workflows/specdev/common/skills/code-review/SKILL.md +12 -7
  50. package/template/workflows/specdev/common/skills/code-review/references/result-reuse.md +3 -3
  51. package/template/workflows/specdev/common/skills/code-review/references/review-evidence.md +44 -0
  52. package/template/workflows/specdev/common/skills/code-review/references/reviewer-contracts.md +17 -5
  53. package/template/workflows/specdev/common/skills/code-review/references/working-tree-review.md +15 -0
  54. package/template/workflows/specdev/common/skills/dev-worktree/SKILL.md +11 -11
  55. package/template/workflows/specdev/common/skills/dev-worktree/references/create.md +20 -12
  56. package/template/workflows/specdev/common/skills/dev-worktree/references/finalize.md +14 -12
  57. package/template/workflows/specdev/common/tools/README.md +9 -1
  58. package/template/workflows/specdev/common/tools/change-artifacts.mjs +8 -11
  59. package/template/workflows/specdev/common/tools/plan-contract.mjs +13 -6
  60. package/template/workflows/specdev/common/tools/review-evidence.mjs +117 -0
  61. package/template/workflows/specdev/common/tools/review-scope.mjs +90 -5
  62. package/template/workflows/specdev/common/tools/tests/engineering.test.mjs +2 -2
  63. package/template/workflows/specdev/common/tools/tests/review-evidence.test.mjs +74 -0
  64. package/template/workflows/specdev/common/tools/tests/review-fixture.mjs +31 -0
  65. package/template/workflows/specdev/common/tools/tests/review-working-tree.test.mjs +59 -0
  66. package/template/workflows/specdev/common/tools/validate-specdev.mjs +210 -114
  67. package/template/workflows/specdev/manifest.json +4 -6
  68. package/template/workflows/specdev/specdev-c-code-review/SKILL.md +6 -6
  69. package/template/workflows/specdev/specdev-c-code-review/assets/code-review-template.md +5 -1
  70. package/template/workflows/specdev/specdev-c-code-review/references/source-files-review.md +2 -2
  71. package/template/workflows/specdev/specdev-i-implement/SKILL.md +6 -6
  72. package/template/workflows/specdev/specdev-i-implement/assets/evidence-template.md +16 -10
  73. package/template/workflows/specdev/specdev-i-implement/references/execution-preflight.md +8 -4
  74. package/template/workflows/specdev/specdev-i-implement/references/implementation-procedure.md +22 -18
  75. package/template/workflows/specdev/specdev-i-init-setup/SKILL.md +1 -1
  76. package/template/workflows/specdev/specdev-l-learn/SKILL.md +35 -0
  77. package/template/workflows/specdev/specdev-l-learn/references/learning-change.md +23 -0
  78. package/template/workflows/specdev/specdev-l-learn/references/lesson-format.md +61 -0
  79. package/template/workflows/specdev/specdev-p-goal-plan/SKILL.md +3 -3
  80. package/template/workflows/specdev/specdev-p-goal-plan/assets/goal-plan-template.md +4 -0
  81. package/template/workflows/specdev/specdev-p-goal-plan/assets/lightweight-goal-plan-template.md +2 -0
  82. package/template/workflows/specdev/specdev-p-goal-plan/references/completion-control.md +3 -0
  83. package/template/workflows/specdev/specdev-p-goal-plan/references/orchestration-protocol.md +1 -1
  84. package/template/workflows/specdev/specdev-p-goal-plan/references/planning-modes.md +2 -2
  85. package/template/workflows/specdev/specdev-p-goal-plan/references/single-change-plan.md +2 -2
  86. package/template/workflows/specdev/specdev-r-retro/SKILL.md +1 -1
  87. package/template/workflows/specdev/specdev-s-spec/SKILL.md +3 -3
  88. package/template/workflows/specdev/specdev-s-spec/assets/spec-template.md +15 -65
  89. package/template/workflows/specdev/specdev-t-tickets/SKILL.md +1 -1
  90. package/template/workflows/specdev/specdev-t-tickets/assets/ticket-template.md +19 -103
  91. package/template/workflows/specdev/specdev-t-tickets/assets/tickets-map-template.md +3 -1
  92. package/template/workflows/specdev/specdev-t-tickets/references/planning-procedure.md +5 -19
  93. package/template/workflows/specdev/specdev-t-tickets/references/ticket-readiness.md +5 -5
  94. package/template/workflows/specdev/specdev-l-learn-change/SKILL.md +0 -33
  95. package/template/workflows/specdev/specdev-l-learn-change/references/lesson-format.md +0 -51
package/README.md CHANGED
@@ -1,52 +1,65 @@
1
1
  # Speculo
2
2
 
3
- Domain methods, standard Agent Skills and explicit Commands for AI-assisted work. Version 2.0.0.
3
+ Reusable methods for software development, learning, operations, decisions and content creation, used by your current AI app or CLI. Speculo provides readable Skills, explicit Commands and recoverable project artifacts. Without an explicit execution choice, work proceeds normally in the current host; requests for CLI interaction, Herdr or another method select that route.
4
4
 
5
- [中文说明](README-ZH.md) · [Architecture](docs/architecture.md) · [All capabilities](docs/capabilities.md) · [Recovery](docs/transaction-recovery.md)
5
+ [中文说明](README-ZH.md) · **[User manual (中文)](docs/README.md)** · [Getting started (中文)](docs/getting-started.md) · [All capabilities](docs/capabilities.md) · [Troubleshooting](docs/troubleshooting.md)
6
6
 
7
- ## Install
7
+ ## Get started
8
8
 
9
- Requires Node.js >=22.22.3 <25. Repository package manager: pnpm 11.1.3.
9
+ Requires Node.js `>=22.22.3 <25`. Run in the project where you want to use Speculo:
10
10
 
11
- ~~~bash
11
+ ```bash
12
12
  npm install -g @namewta/speculo
13
- speculo init . --workflows specdev,learning --agent-skills domains
14
- speculo init . --workflows all --agent-skills all --claude-skills all
13
+ speculo init . --workflows specdev,learning --skill-targets agents --skills domain/specdev,domain/learning
15
14
  speculo doctor .
16
- ~~~
15
+ ```
17
16
 
18
- The source installation lives in .agents/speculo/. Runtime state lives in .agents/speculo/.speculo/. The project AGENTS file receives only managed discovery and knowledge blocks. Existing CLAUDE instructions remain user owned.
17
+ Then ask your AI:
19
18
 
20
- A fresh non-interactive init installs the core. Select domains with --workflows; --core-only refreshes core assets. Previously installed unselected domains remain available. Exposure to each host is separate: --agent-skills and --claude-skills accept none, keep, domains, all, or comma-separated business IDs such as specdev/implement,command/status. Fresh installs expose nothing by default; refresh keeps existing selections.
19
+ ```text
20
+ Read this project's AGENTS.md and use specdev/init-setup to inspect the project
21
+ entry points and test commands. Keep this task read-only.
22
+ ```
21
23
 
22
- Domain and Work pointers preserve source YAML verbatim and require reading the authoritative source entry first. Command wrappers carry host-specific explicit invocation policies. Conflicting third-party directories and edited files are preserved, with per-asset warnings.
24
+ For all domains and public entries, use `--workflows all --skills all`. Use `--skill-targets claude` for hosts reading `.claude/skills/`, or `--skill-targets agents,claude` to expose the same selection in both locations. Installation, host exposure and execution are separate steps. See the [walkthrough](docs/getting-started.md) and [CLI reference](docs/cli.md).
23
25
 
24
- ## Capabilities
26
+ ## Workflow guides
25
27
 
26
- Five domains contain 38 Works: SpecDev (15), Learning (9), OPS (5), Person (2), Media (7). Ten Commands cover documentation sync, archive/consolidation, history squash, repository audit, handoff, retrospective, status, source ZIP, upstream sync and engineering standards. Shared references own coordination, retrospective and writing methods. Twelve canonical documents provide isolated single-file use.
28
+ Five domains contain 38 Works. Each guide explains every Work's purpose, use cases, inputs, outputs, example requests and next steps. The detailed manual is currently in Chinese.
27
29
 
28
- AI agents follow these methods using current tools. Coordination supports Lead, Orca, Herdr and a user-selected headless CLI. Read the selected tool's current guide before using it. Speculo provides no model runner, orchestration service, sandbox or Run state machine. Optional project choices are stored in state/coordination/project.json; without them, Lead is the default. Lead verifies candidate evidence and continues the authorized Goal through implementation, repair, integration and completion.
30
+ | Domain | Works | What it covers |
31
+ |---|---:|---|
32
+ | [SpecDev — software development](docs/workflows/specdev.md) | 15 | Discovery, specifications, prototypes, tickets, goals, implementation, reviews, diagnosis and delivery |
33
+ | [Learning](docs/workflows/learning.md) | 9 | Course planning, complete lessons, tutor questions, exploration, homework, review and consolidation |
34
+ | [OPS — operations and deployment](docs/workflows/ops.md) | 5 | Controller setup, trusted server access, host environments, project deployment and offline inventory |
35
+ | [Person — analysis and decisions](docs/workflows/person.md) | 2 | Two-sided steelman deliberation and a dedicated diagnostic, strategic and action-planning method |
36
+ | [Media — content creation](docs/workflows/media.md) | 7 | Briefs, reference analysis, visual prompts, video, local drafts and evidence-based retrospectives |
29
37
 
30
- Discovery and configuration grant no authority for commits, pushes, publishing, deployment or other effects. Existing authorization and each action's owning entry determine what may run.
38
+ Enter the Work you need; there is no mandatory end-to-end sequence. Complete approved Specs and Ready Tickets can enter implementation directly. Execution method and current/worktree selection remain independent. See the [workflow comparison](docs/workflows/README.md).
31
39
 
32
- Ordinary SpecDev Works can also run directly with an explicit project, method-resource root and approved data root; CLI installation is optional. New changes keep one overall Outcome in README and progress in README, a lightweight Goal, or Ticket/Evidence according to scope. Complex planning, design approval and integration checks remain in their owning artifacts.
40
+ External CLI, Herdr and Orca tasks use compact Markdown inputs and reports, with focused summaries and searchable session references. See [agent handoffs](docs/agent-handoffs.md) (Chinese).
33
41
 
34
- A closes out change, ADR, context and current engineering docs, plus DESIGN when relevant. Required current-document maintenance and design publication finish before the change moves to changes/archive under the same stable name. A completed or cancelled Outcome alone does not authorize archiving or prove its evidence.
42
+ ## Commands by category
35
43
 
36
- Current engineering docs are created only on an explicit baseline request and point to existing project owners when available. I/A maintain the relevant scope; docs-sync remains the manual global audit/update/commit command, with its own Git and state contract.
44
+ The ten Commands are explicit requests to an AI, not `speculo <command>` terminal subcommands.
37
45
 
38
- ## Version boundary
46
+ | Category | Guides |
47
+ |---|---|
48
+ | [Navigation and handoff](docs/commands/README.md#navigation) | [status](docs/commands/status.md), [handoff](docs/commands/handoff.md) |
49
+ | [Documentation, standards and knowledge](docs/commands/README.md#documentation) | [docs-sync](docs/commands/docs-sync.md), [engineering-standards-builder](docs/commands/engineering-standards-builder.md), [archive-and-consolidate](docs/commands/archive-and-consolidate.md) |
50
+ | [Git analysis and history](docs/commands/README.md#git) | [git-repository-audit](docs/commands/git-repository-audit.md), [git-history-squash](docs/commands/git-history-squash.md), [upstream-fork-sync](docs/commands/upstream-fork-sync.md) |
51
+ | [Source exchange and feedback](docs/commands/README.md#exchange) | [source-code-zip](docs/commands/source-code-zip.md), [retro](docs/commands/retro.md) |
39
52
 
40
- CLI installations retain the strict agents-v2 layout, staging and transaction recovery. New SpecDev activity uses the Markdown protocol and does not seed global/change status mirrors. Old active data requires an explicit, scoped conversion; mixed or unknown input blocks affected writes. Legacy monthly archives remain frozen in place and are read through a separate historical resolver. Other domains retain their own persistence contracts. See the [conversion guide](scripts/references/migrate-specdev-markdown.md) for the repository maintenance tool; init does not run it automatically.
53
+ ## Data, permissions and portable use
41
54
 
42
- ## Develop
55
+ Authoritative methods install into `.agents/speculo/`; runtime data lives in `.agents/speculo/.speculo/`. Optional host projections live in `.agents/skills/` and `.claude/skills/`. Existing user instructions, third-party Skills and edited files retain their ownership. See [concepts and invocation](docs/concepts.md).
43
56
 
44
- ~~~bash
45
- pnpm install --frozen-lockfile
46
- pnpm generate-assets
47
- pnpm check
48
- pnpm verify-bin
49
- pnpm verify-generated
50
- ~~~
57
+ Discovery and installation do not authorize commits, pushes, publishing, deployment or archival moves. Existing scoped authorization is reused; additional effects follow their owning entry. Speculo does not provide a model runner, sandbox or persistent orchestration service.
51
58
 
52
- Generators must be reproducible. Tests use disposable fixtures. Static format checks do not certify host invocation or live model behavior. See LICENSE and THIRD-PARTY-NOTICES.md for provenance and licensing. Version tags trigger release CI; publishing requires explicit authorization.
59
+ Ordinary SpecDev Works also support [direct use with explicit project, method and data roots](docs/workflows/specdev.md#不安装-cli-时如何使用). Browser-only AI environments can use [12 standalone Canonical documents](docs/canonical.md). For refresh and failures, see [CLI usage](docs/cli.md) and [transaction recovery](docs/transaction-recovery.md).
60
+
61
+ ## Project and maintenance
62
+
63
+ [Architecture](docs/architecture.md) · [Contributor guide](docs/contributing.md) · [Changelog](CHANGELOG.md) · [License](LICENSE) · [Third-party notices](THIRD-PARTY-NOTICES.md)
64
+
65
+ Repository package manager: `pnpm@11.1.3`. The current version is defined in [package.json](package.json). Documentation describes the current product and its use; one-off implementation reports belong outside the user manual.
@@ -1,51 +1,77 @@
1
- import { type Asset } from "./assets.js";
1
+ import { type Asset, type AssetCatalog } from "./assets.js";
2
2
  import { type RefreshBlocker } from "./refresh.js";
3
3
  import type { SkillRecord } from "./transaction.js";
4
- import type { WorkflowCatalog } from "./workflows.js";
5
4
  export declare const MANAGED_MANIFEST = "projections.json";
6
5
  export type ProjectionHost = "agents" | "claude";
7
- export type AgentSkillRequest = {
8
- mode: "none" | "keep" | "domains" | "all";
6
+ export type SkillRequest = {
7
+ mode: "none" | "keep" | "all";
9
8
  } | {
10
9
  mode: "set";
11
10
  assetIds: string[];
12
11
  };
12
+ export type ExposureSelection = {
13
+ targets: ProjectionHost[];
14
+ assetIds: string[];
15
+ };
16
+ export type ExposureSummary = ExposureSelection & {
17
+ added: string[];
18
+ retained: string[];
19
+ removed: string[];
20
+ };
21
+ export type ProjectionSummary = {
22
+ enabled: boolean;
23
+ affected: boolean;
24
+ selected: string[];
25
+ added: string[];
26
+ retained: string[];
27
+ removed: string[];
28
+ ready: number;
29
+ conflicts: string[];
30
+ created: number;
31
+ updated: number;
32
+ deleted: number;
33
+ };
34
+ export type ProjectionSummaries = Record<ProjectionHost, ProjectionSummary>;
35
+ /** Every UI mode and command-line request resolves against the staged catalog. */
36
+ export declare function resolveProjectionIds(request: SkillRequest, catalog: AssetCatalog, existing: string[]): string[];
13
37
  type ManagedProjectionFile = {
14
38
  path: string;
15
39
  asset_id: string;
16
40
  sha256: string;
17
41
  };
18
42
  export type ManagedManifest = {
19
- schema_version: 2;
43
+ schema_version: 3;
20
44
  package_version: string;
21
- selections: Record<ProjectionHost, string[]>;
45
+ targets: ProjectionHost[];
46
+ asset_ids: string[];
22
47
  files: ManagedProjectionFile[];
23
48
  };
24
49
  export declare function sha256Buffer(value: Buffer | string): string;
25
- export declare function parseAgentSkillSpec(spec: string): AgentSkillRequest;
50
+ export declare function parseSkillSpec(spec: string): SkillRequest;
51
+ export declare function normalizeSkillTargets(targets: readonly ProjectionHost[]): ProjectionHost[];
52
+ export declare function parseSkillTargets(spec: string): ProjectionHost[];
53
+ export declare function validateExposureRequest(targets: ProjectionHost[] | undefined, request: SkillRequest | undefined): void;
26
54
  export declare function readProjectionManifest(target: string): Promise<ManagedManifest | null>;
27
55
  export declare function renderSkillPointer(asset: Asset, source: Buffer, host: ProjectionHost): Record<string, string>;
28
- export declare function resolveAgentSkillRequest(options: {
56
+ export declare function resolveExposure(options: {
29
57
  target: string;
30
- packageRoot: string;
31
- catalog: WorkflowCatalog;
32
- installedWorkflowIds: string[];
33
- request?: AgentSkillRequest;
58
+ catalog: AssetCatalog;
59
+ targets?: ProjectionHost[];
60
+ request?: SkillRequest;
34
61
  prompt: boolean;
35
- }): Promise<AgentSkillRequest>;
62
+ }): Promise<ExposureSelection>;
36
63
  export declare function planSkillProjection(options: {
37
64
  target: string;
38
65
  stagedRoot: string;
39
- packageRoot: string;
40
66
  packageVersion: string;
41
- installedWorkflowIds: string[];
42
- request: AgentSkillRequest;
43
- claudeRequest?: AgentSkillRequest;
67
+ exposure: ExposureSelection;
44
68
  }): Promise<{
45
69
  records: SkillRecord[] | null;
46
70
  blockers: RefreshBlocker[];
47
71
  warnings: RefreshBlocker[];
48
72
  count: number;
73
+ summaries: ProjectionSummaries;
74
+ exposure: ExposureSummary;
49
75
  }>;
50
76
  export declare function inspectProjectedSkills(target: string, _installed: string[]): Promise<Array<{
51
77
  id: string;
@@ -4,17 +4,55 @@ import { join, posix } from "node:path";
4
4
  import { readAssetCatalog, parseFrontmatter } from "./assets.js";
5
5
  import { containedPath, INSTALL_ROOT, safeRelativePath } from "./paths.js";
6
6
  import { RefreshBlockedError } from "./refresh.js";
7
- import { readImage } from "./external-files.js";
7
+ import { image, readImage } from "./external-files.js";
8
8
  export const MANAGED_MANIFEST = "projections.json";
9
+ /** Every UI mode and command-line request resolves against the staged catalog. */
10
+ export function resolveProjectionIds(request, catalog, existing) {
11
+ let ids;
12
+ switch (request.mode) {
13
+ case "none":
14
+ ids = [];
15
+ break;
16
+ case "keep":
17
+ ids = existing;
18
+ break;
19
+ case "all":
20
+ ids = catalog.assets.map(a => a.id);
21
+ break;
22
+ case "set":
23
+ ids = request.assetIds;
24
+ break;
25
+ default: throw new Error("invalid-projection-selection");
26
+ }
27
+ for (const id of ids)
28
+ if (!catalog.assets.some(a => a.id === id))
29
+ throw new RefreshBlockedError([{ code: "unknown-projection-asset", path: id, message: "select an installed public asset business id" }]);
30
+ return [...new Set(ids)].sort();
31
+ }
9
32
  export function sha256Buffer(value) { return createHash('sha256').update(value).digest('hex'); }
10
- export function parseAgentSkillSpec(spec) {
11
- if (['none', 'keep', 'domains', 'all'].includes(spec))
33
+ const BUSINESS_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
34
+ export function parseSkillSpec(spec) {
35
+ if (['none', 'keep', 'all'].includes(spec))
12
36
  return { mode: spec };
13
37
  const ids = spec.split(',');
14
- if (!ids.length || ids.some(id => !/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/.test(id)))
15
- throw new Error('projection selection must be none|keep|domains|all or comma-separated business ids');
38
+ if (!ids.length || ids.some(id => !BUSINESS_ID.test(id)))
39
+ throw new Error('--skills must be none|keep|all or comma-separated business ids');
16
40
  return { mode: 'set', assetIds: [...new Set(ids)].sort() };
17
41
  }
42
+ export function normalizeSkillTargets(targets) {
43
+ if (!Array.isArray(targets) || targets.some(host => host !== 'agents' && host !== 'claude'))
44
+ throw new Error('--skill-targets must be agents|claude|agents,claude|none');
45
+ return ['agents', 'claude'].filter(host => targets.includes(host));
46
+ }
47
+ export function parseSkillTargets(spec) {
48
+ return spec === 'none' ? [] : normalizeSkillTargets(spec.split(','));
49
+ }
50
+ export function validateExposureRequest(targets, request) {
51
+ if (targets !== undefined)
52
+ normalizeSkillTargets(targets);
53
+ if (targets?.length === 0 && request && request.mode !== 'none')
54
+ throw new Error('--skill-targets none conflicts with --skills other than none');
55
+ }
18
56
  export async function readProjectionManifest(target) {
19
57
  let content;
20
58
  try {
@@ -26,14 +64,18 @@ export async function readProjectionManifest(target) {
26
64
  throw e;
27
65
  }
28
66
  const m = JSON.parse(content);
29
- if (m.schema_version !== 2 || typeof m.package_version !== 'string' || !m.selections || !['agents', 'claude'].every(h => Array.isArray(m.selections[h]) && m.selections[h].every(id => typeof id === 'string')) || !Array.isArray(m.files) || new Set(m.files.map(f => f.path)).size !== m.files.length)
67
+ if (!m || m.schema_version !== 3)
68
+ throw new Error('invalid-projection-manifest: expected schema_version 3; older formats are not migrated');
69
+ if (typeof m.package_version !== 'string' || !Array.isArray(m.targets) || m.targets.some(h => h !== 'agents' && h !== 'claude') || new Set(m.targets).size !== m.targets.length || !Array.isArray(m.asset_ids) || m.asset_ids.some(id => typeof id !== 'string' || !BUSINESS_ID.test(id)) || new Set(m.asset_ids).size !== m.asset_ids.length || (!m.targets.length && m.asset_ids.length) || !Array.isArray(m.files))
30
70
  throw new Error('invalid-projection-manifest');
31
71
  for (const file of m.files)
32
- if (!safeRelativePath(file.path) || !/^\.(agents|claude)\/skills\/[a-z0-9-]+\/(SKILL\.md|agents\/openai\.yaml)$/.test(file.path) || typeof file.asset_id !== 'string' || !/^[a-f0-9]{64}$/.test(file.sha256))
72
+ if (!file || typeof file.path !== 'string' || !safeRelativePath(file.path) || !/^\.(agents|claude)\/skills\/[a-z0-9-]+\/(SKILL\.md|agents\/openai\.yaml)$/.test(file.path) || typeof file.asset_id !== 'string' || !BUSINESS_ID.test(file.asset_id) || typeof file.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(file.sha256))
33
73
  throw new Error('invalid-projection-record');
74
+ if (new Set(m.files.map(f => f.path)).size !== m.files.length)
75
+ throw new Error('invalid-projection-manifest');
34
76
  return m;
35
77
  }
36
- function fileNode(content) { return { kind: 'file', content: Buffer.from(content).toString('base64'), mode: 0o644 }; }
78
+ function fileNode(content) { return { kind: 'file', ...image(content) }; }
37
79
  async function assertProjectionCasing(target, path) {
38
80
  let parent = target;
39
81
  for (const part of path.split('/')) {
@@ -71,27 +113,38 @@ export function renderSkillPointer(asset, source, host) {
71
113
  files[`${destination}/agents/openai.yaml`] = 'policy:\n allow_implicit_invocation: false\n';
72
114
  return files;
73
115
  }
74
- export async function resolveAgentSkillRequest(options) {
75
- if (options.request)
76
- return options.request;
77
- const existing = await readProjectionManifest(options.target);
78
- if (!options.prompt)
79
- return { mode: existing ? 'keep' : 'none' };
80
- const { select } = await import('@inquirer/prompts');
81
- return { mode: await select({ message: '选择 .agents/skills 能力曝光范围:', choices: [{ name: '保留现有选择', value: 'keep' }, { name: '不曝光', value: 'none' }, { name: '已安装领域入口', value: 'domains' }, { name: '全部已安装公开入口', value: 'all' }], default: existing ? 'keep' : 'none' }) };
116
+ export async function resolveExposure(options) {
117
+ validateExposureRequest(options.targets, options.request);
118
+ const manifest = await readProjectionManifest(options.target);
119
+ const existing = { targets: manifest?.targets ?? ['agents'], assetIds: manifest?.asset_ids ?? [] };
120
+ if (options.prompt) {
121
+ const { promptExposureConfiguration } = await import('./install-ui.js');
122
+ return promptExposureConfiguration({ catalog: options.catalog, existing, hasHistory: manifest !== null, targets: options.targets, request: options.request });
123
+ }
124
+ const targets = normalizeSkillTargets(options.targets ?? existing.targets);
125
+ if (!targets.length) {
126
+ validateExposureRequest(targets, options.request);
127
+ return { targets, assetIds: [] };
128
+ }
129
+ return { targets, assetIds: resolveProjectionIds(options.request ?? { mode: manifest ? 'keep' : 'none' }, options.catalog, existing.assetIds) };
82
130
  }
83
131
  export async function planSkillProjection(options) {
84
132
  const old = await readProjectionManifest(options.target), catalog = await readAssetCatalog(options.stagedRoot);
85
- const next = { schema_version: 2, package_version: options.packageVersion, selections: { agents: [], claude: [] }, files: [] };
133
+ const targets = normalizeSkillTargets(options.exposure.targets);
134
+ if (!targets.length && options.exposure.assetIds.length)
135
+ throw new Error('cannot expose skills without a target');
136
+ const assetIds = resolveProjectionIds({ mode: 'set', assetIds: options.exposure.assetIds }, catalog, []);
137
+ const priorSelection = old?.asset_ids ?? [];
138
+ const exposure = { targets, assetIds, added: assetIds.filter(id => !priorSelection.includes(id)), retained: assetIds.filter(id => priorSelection.includes(id)), removed: priorSelection.filter(id => !assetIds.includes(id)) };
139
+ const next = { schema_version: 3, package_version: options.packageVersion, targets, asset_ids: assetIds, files: [] };
86
140
  const records = [], warnings = [];
141
+ const summaries = {};
87
142
  for (const host of ['agents', 'claude']) {
88
- const request = host === 'agents' ? options.request : options.claudeRequest ?? { mode: 'keep' };
89
- const ids = request.mode === 'none' ? [] : request.mode === 'keep' ? old?.selections[host] ?? [] : request.mode === 'all' ? catalog.assets.map(a => a.id) : request.mode === 'domains' ? catalog.assets.filter(a => a.kind === 'domain-skill').map(a => a.id) : request.assetIds;
90
- for (const id of ids)
91
- if (!catalog.assets.some(a => a.id === id))
92
- throw new RefreshBlockedError([{ code: 'unknown-projection-asset', path: id, message: 'select an installed public asset business id' }]);
93
- next.selections[host] = [...ids].sort();
143
+ const enabled = targets.includes(host);
144
+ const priorIds = old?.targets.includes(host) ? old.asset_ids : [];
145
+ const ids = enabled ? assetIds : [];
94
146
  const previous = (old?.files ?? []).filter(f => f.path.startsWith(`.${host}/skills/`));
147
+ const summary = summaries[host] = { enabled, affected: enabled || !!old?.targets.includes(host) || previous.length > 0, selected: ids, added: ids.filter(id => !priorIds.includes(id)), retained: ids.filter(id => priorIds.includes(id)), removed: priorIds.filter(id => !ids.includes(id)).sort(), ready: 0, conflicts: [], created: 0, updated: 0, deleted: 0 };
95
148
  const allIds = [...new Set([...ids, ...previous.map(f => f.asset_id)])];
96
149
  for (const id of allIds) {
97
150
  const owned = previous.filter(f => f.asset_id === id), asset = catalog.assets.find(a => a.id === id), desired = ids.includes(id) && asset ? renderSkillPointer(asset, await readFile(join(options.stagedRoot, asset.entry)), host) : {};
@@ -122,17 +175,28 @@ export async function planSkillProjection(options) {
122
175
  }
123
176
  records.push(...pending);
124
177
  next.files.push(...registered);
178
+ if (ids.includes(id)) {
179
+ summary.ready++;
180
+ if (pending.length) {
181
+ if (owned.length)
182
+ summary.updated++;
183
+ else
184
+ summary.created++;
185
+ }
186
+ }
187
+ else if (pending.length)
188
+ summary.deleted++;
125
189
  }
126
190
  catch (e) {
127
191
  warnings.push({ code: 'managed-asset-conflict', path: `${host}:${id}`, message: String(e) });
192
+ summary.conflicts.push(id);
128
193
  next.files.push(...owned);
129
194
  }
130
195
  }
131
196
  }
132
197
  next.files.sort((a, b) => a.path.localeCompare(b.path));
133
- if (old || next.files.length || next.selections.agents.length || next.selections.claude.length)
134
- await writeFile(join(options.stagedRoot, '.speculo', MANAGED_MANIFEST), JSON.stringify(next, null, 2) + '\n');
135
- return { records: records.length ? records : null, blockers: [], warnings, count: next.files.filter(f => f.path.endsWith('/SKILL.md')).length };
198
+ await writeFile(join(options.stagedRoot, '.speculo', MANAGED_MANIFEST), JSON.stringify(next, null, 2) + '\n');
199
+ return { records: records.length ? records : null, blockers: [], warnings, count: next.files.filter(f => f.path.endsWith('/SKILL.md')).length, summaries, exposure };
136
200
  }
137
201
  export async function inspectProjectedSkills(target, _installed) {
138
202
  try {
@@ -145,8 +209,11 @@ export async function inspectProjectedSkills(target, _installed) {
145
209
  if (node.kind !== 'file' || sha256Buffer(Buffer.from(node.content, 'base64')) !== record.sha256)
146
210
  checks.push({ id: `projection-file:${record.path}`, ok: false, message: 'owned projection drifted; preserve and reconcile explicitly' });
147
211
  }
148
- for (const host of ['agents', 'claude'])
149
- for (const id of manifest.selections[host]) {
212
+ for (const record of manifest.files)
213
+ if (!manifest.targets.some(host => record.path.startsWith(`.${host}/skills/`)) || !manifest.asset_ids.includes(record.asset_id))
214
+ checks.push({ id: `projection-retained:${record.path}`, ok: false, message: 'disabled projection retained due to conflict; preserve and reconcile explicitly' });
215
+ for (const host of manifest.targets)
216
+ for (const id of manifest.asset_ids) {
150
217
  const asset = catalog.assets.find(a => a.id === id);
151
218
  let ok = !!asset;
152
219
  if (asset) {
@@ -1 +1 @@
1
- {"version":3,"file":"agent-skills.js","sour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YAAY,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAC,IAAI,CAAC,CAAC;oBAC7G,KAAI,MAAM,CAAC,CAAC,EAAC,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAC,CAAC;wBAAA,MAAM,MAAM,GAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA,EAAE,CAAA,CAAC,CAAC,IAAI,KAAG,CAAC,CAAC,CAAC;wBAAA,MAAM,IAAI,GAAC,MAAM,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAC,CAAC;wBAAA,EAAE,GAAC,EAAE,IAAE,CAAC,CAAC,MAAM,IAAE,MAAM,CAAC,MAAM,KAAG,YAAY,CAAC,IAAI,CAAC,IAAE,IAAI,CAAC,IAAI,KAAG,MAAM,IAAE,IAAI,CAAC,OAAO,KAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oBAAA,CAAC;gBAAA,CAAC;gBACpQ,MAAM,CAAC,IAAI,CAAC,EAAC,EAAE,EAAC,cAAc,IAAI,IAAI,EAAE,EAAE,EAAC,EAAE,EAAC,OAAO,EAAC,EAAE,CAAA,CAAC,CAAA,+DAA+D,CAAA,CAAC,CAAA,2CAA2C,EAAC,CAAC,CAAC;YACxK,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAAA,OAAM,CAAC,EAAC,CAAC;QAAA,OAAO,CAAC,EAAC,EAAE,EAAC,aAAa,EAAC,EAAE,EAAC,KAAK,EAAC,OAAO,EAAC,MAAM,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC;IAAA,CAAC;AACnE,CAAC"}
package/dist/src/cli.js CHANGED
@@ -1,14 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { dirname, resolve } from "node:path";
2
+ import { dirname, join, resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { initSpeculo } from "./index.js";
5
- import { parseAgentSkillSpec } from "./agent-skills.js";
6
- import { isInteractive as catalogIsInteractive } from "./workflows.js";
5
+ import { parseSkillSpec, parseSkillTargets, validateExposureRequest } from "./agent-skills.js";
6
+ import { discoverWorkflowCatalog, isInteractive as catalogIsInteractive } from "./workflows.js";
7
7
  import { RefreshBlockedError } from "./refresh.js";
8
8
  import { checkForUpdate, formatVersionBanner } from "./version.js";
9
9
  import { doctorSpeculo } from "./doctor.js";
10
10
  import { recoverInstall } from "./transaction.js";
11
- import { resolvePathReference } from "./paths.js";
11
+ import { INSTALL_ROOT, resolvePathReference } from "./paths.js";
12
+ import { pathExists } from "./utils.js";
13
+ import { InstallCancelled } from "./interaction.js";
12
14
  const REMOVED_COMMANDS = new Set(["migrate", "mirror-skills", "update"]);
13
15
  const REMOVED_OPTIONS = new Set(["--all", "--apply", "--dry-run"]);
14
16
  function usage() {
@@ -19,11 +21,12 @@ function usage() {
19
21
  " speculo doctor [target] [--json]",
20
22
  " speculo recover [target] --transaction <id>",
21
23
  " speculo resolve [target] --path <reference>",
22
- " speculo init [target] [--workflows <id,id> | --core-only] [--agent-skills <selection>] [--claude-skills <selection>]",
24
+ " speculo init [target] [--workflows <id,id> | --core-only] [--skill-targets <targets>] [--skills <selection>]",
23
25
  "",
24
26
  "Commands:",
25
27
  " init Install or directly refresh Speculo assets and selected workflow packages.",
26
- " --agent-skills / --claude-skills: none|keep|domains|all|<business-id,id>.",
28
+ " --skill-targets: agents|claude|agents,claude|none. --skills: none|keep|all|<business-id,id>.",
29
+ " Interactive: choose targets, then one shared selection: all, groups, custom, keep, or none.",
27
30
  " version Print the current Speculo version and check for updates.",
28
31
  " doctor Validate installation integrity and report recovery evidence (read-only).",
29
32
  " recover Explicitly roll back an interrupted transaction, or finish committed cleanup.",
@@ -31,20 +34,11 @@ function usage() {
31
34
  " Non-interactive init: core-only on first install; existing supported workflows on refresh.",
32
35
  ].join("\n");
33
36
  }
34
- function isInteractive() {
35
- return process.stdin.isTTY === true;
36
- }
37
37
  async function showVersionWithCheck(packageRoot, packageName) {
38
38
  const info = await checkForUpdate(packageRoot, packageName);
39
39
  console.log(formatVersionBanner(info));
40
40
  return info;
41
41
  }
42
- async function confirmContinue() {
43
- if (!isInteractive())
44
- return true;
45
- const { confirm } = await import("@inquirer/prompts");
46
- return confirm({ message: "是否继续运行 speculo init?", default: true });
47
- }
48
42
  function assertNoRemovedOption(argv) {
49
43
  const option = argv.find((argument) => REMOVED_OPTIONS.has(argument));
50
44
  if (option)
@@ -84,6 +78,7 @@ async function main(argv) {
84
78
  console.error("speculo " + command + " has been removed. Run speculo init [target] to refresh Speculo.");
85
79
  return 1;
86
80
  }
81
+ let ui;
87
82
  try {
88
83
  assertNoRemovedOption(argv);
89
84
  const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
@@ -118,30 +113,42 @@ async function main(argv) {
118
113
  console.log(await resolvePathReference(args.target, value));
119
114
  return 0;
120
115
  }
121
- const args = parseArguments(command === "init" ? rest : argv, new Set(["--core-only"]), new Set(["--workflows", "--agent-skills", "--claude-skills"]));
116
+ const args = parseArguments(command === "init" ? rest : argv, new Set(["--core-only"]), new Set(["--workflows", "--skill-targets", "--skills"]));
122
117
  if (args.flags.has("--core-only") && args.values.has("--workflows"))
123
118
  throw new Error("--core-only and --workflows are mutually exclusive");
124
119
  const requested = args.values.get("--workflows");
125
120
  if (requested !== undefined && !/^[a-z0-9-]+(?:,[a-z0-9-]+)*$/.test(requested))
126
121
  throw new Error("--workflows requires comma-separated workflow ids");
127
- const selection = args.flags.has("--core-only") ? { workflowIds: [] } : requested === undefined ? undefined : { workflowIds: requested.split(",") };
128
- const requestedSkills = args.values.get("--agent-skills");
129
- const agentSkills = requestedSkills === undefined ? undefined : parseAgentSkillSpec(requestedSkills);
122
+ const selection = args.flags.has("--core-only") ? { workflowIds: [] } : requested === undefined ? undefined :
123
+ { workflowIds: requested === "all" ? [...(await discoverWorkflowCatalog(packageRoot)).keys()].sort() : requested.split(",") };
124
+ const skills = args.values.has("--skills") ? parseSkillSpec(args.values.get("--skills")) : undefined;
125
+ const skillTargets = args.values.has("--skill-targets") ? parseSkillTargets(args.values.get("--skill-targets")) : undefined;
126
+ validateExposureRequest(skillTargets, skills);
130
127
  const targetArg = args.target;
131
- await showVersionWithCheck(packageRoot, packageName);
132
- if (!(await confirmContinue())) {
133
- console.log("已取消。");
128
+ if (catalogIsInteractive()) {
129
+ const { createInstallUI } = await import("./install-ui.js");
130
+ ui = createInstallUI();
131
+ ui.start(await checkForUpdate(packageRoot, packageName), resolve(targetArg), await pathExists(join(resolve(targetArg), INSTALL_ROOT)));
132
+ }
133
+ else {
134
+ await showVersionWithCheck(packageRoot, packageName);
135
+ }
136
+ const result = await initSpeculo(targetArg, {
137
+ packageRoot, selection, skillTargets, skills, promptExposure: !!ui,
138
+ confirmInstall: ui?.confirm, onProgress: ui?.progress,
139
+ });
140
+ if (ui) {
141
+ ui.finish(result);
134
142
  return 0;
135
143
  }
136
- const result = await initSpeculo(targetArg, { packageRoot, selection, agentSkills, claudeSkills: args.values.has("--claude-skills") ? parseAgentSkillSpec(args.values.get("--claude-skills")) : undefined, promptAgentSkills: catalogIsInteractive() && agentSkills === undefined });
137
144
  console.log(result.mode === "init" ? "Speculo initialized in " + result.target : "Speculo refreshed in " + result.target);
138
145
  console.log(" replaced " + result.refresh.managedFiles + " managed files");
139
146
  console.log(" preserved " + result.refresh.preservedFiles + " runtime files");
140
147
  console.log(" reconciled config: " + result.refresh.config.added + " added, " +
141
148
  result.refresh.config.updated + " updated, " + result.refresh.config.preserved + " preserved, " +
142
149
  result.refresh.config.removed + " removed");
143
- if (result.agentSkills.projected)
144
- console.log(` projected ${result.agentSkills.projected} public entries`);
150
+ if (result.exposure.projected)
151
+ console.log(` projected ${result.exposure.projected} public entries`);
145
152
  for (const warning of result.warnings)
146
153
  console.log(" warning: " + warning);
147
154
  if (result.refresh.backupPath)
@@ -152,13 +159,22 @@ async function main(argv) {
152
159
  return 0;
153
160
  }
154
161
  catch (error) {
162
+ if (ui)
163
+ ui.fail(error);
164
+ if (error instanceof InstallCancelled) {
165
+ if (!ui)
166
+ console.log(error.message);
167
+ return error.exitCode;
168
+ }
155
169
  if (error instanceof RefreshBlockedError) {
156
- console.error(error.message);
170
+ if (!ui)
171
+ console.error(error.message);
157
172
  for (const blocker of error.blockers)
158
173
  console.error(" " + blocker.code + " " + blocker.path + ": " + blocker.message);
159
174
  return 2;
160
175
  }
161
- console.error(error instanceof Error ? error.message : String(error));
176
+ if (!ui)
177
+ console.error(error instanceof Error ? error.message : String(error));
162
178
  return 1;
163
179
  }
164
180
  }