@aiwg/cli 2026.11.8 → 2026.11.9
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/README.md +1 -1
- package/agentic/code/providers/capability-matrix.yaml +4 -4
- package/agentic/code/providers/model-capabilities.v1.json +150 -28
- package/agentic/code/providers/model-catalog.v1.json +6 -5
- package/bin/aiwg.mjs +3 -1
- package/dist/src/agents/agent-packager.js +3 -3
- package/dist/src/artifacts/cli.js +6 -2
- package/dist/src/artifacts/fortemi-core-sync.js +2 -0
- package/dist/src/artifacts/index-query-help.js +27 -0
- package/dist/src/artifacts/query-engine-installation.js +17 -4
- package/dist/src/artifacts/query-engine-name-intent.js +56 -0
- package/dist/src/artifacts/query-engine-scoring.js +14 -8
- package/dist/src/artifacts/query-engine-show-card.js +3 -3
- package/dist/src/cli/agent-spawn.js +4 -4
- package/dist/src/cli/handlers/best-practices-audit.js +1 -1
- package/dist/src/cli/handlers/bundle-deployment-mode.js +26 -13
- package/dist/src/cli/handlers/bundle-reconciliation.js +2 -2
- package/dist/src/cli/handlers/init.js +1 -1
- package/dist/src/cli/handlers/issues.js +5 -0
- package/dist/src/cli/handlers/marketplace-plugin-search.js +6 -5
- package/dist/src/cli/handlers/marketplace.js +1 -1
- package/dist/src/cli/handlers/models-muse-wrapper.js +32 -0
- package/dist/src/cli/handlers/models.js +5 -4
- package/dist/src/cli/handlers/refresh-artifact-freshness.js +51 -0
- package/dist/src/cli/handlers/refresh-bundles.js +3 -0
- package/dist/src/cli/handlers/refresh-managed-deployment.js +6 -4
- package/dist/src/cli/handlers/refresh.js +7 -3
- package/dist/src/cli/handlers/repo-access.js +15 -2
- package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
- package/dist/src/cli/handlers/steward.js +1 -1
- package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
- package/dist/src/cli/handlers/subcommands-discovery.js +5 -0
- package/dist/src/cli/handlers/subcommands-list.js +1 -1
- package/dist/src/cli/handlers/subcommands-plugins.js +1 -1
- package/dist/src/cli/handlers/subcommands-storage.js +11 -0
- package/dist/src/cli/handlers/team.js +1 -1
- package/dist/src/cli/handlers/use-additive-bundles.js +9 -2
- package/dist/src/cli/handlers/use-bundle-counts.js +1 -1
- package/dist/src/cli/handlers/use-copy-selection.js +42 -0
- package/dist/src/cli/handlers/use.js +33 -38
- package/dist/src/cli/handlers/workspace-context.js +4 -0
- package/dist/src/cli/help-generator.js +1 -1
- package/dist/src/cli/new-project-options.js +46 -0
- package/dist/src/cli/router.js +15 -4
- package/dist/src/cli/scope-resolver.js +6 -6
- package/dist/src/cli/services/deployment-probe-scope.js +11 -0
- package/dist/src/cli/services/deployment-staleness.js +83 -0
- package/dist/src/cli/services/deployment-verification.js +20 -11
- package/dist/src/config/aiwg-config.js +1 -1
- package/dist/src/config/authorization-cli.js +36 -1
- package/dist/src/config/config-normalization.js +3 -1
- package/dist/src/data/community.yaml +3 -3
- package/dist/src/extensions/commands/definitions.js +2 -2
- package/dist/src/extensions/manifest.js +27 -1
- package/dist/src/extensions/user-hook-diagnostics.js +6 -4
- package/dist/src/extensions/verified-hook-command.js +7 -5
- package/dist/src/features/catalog.js +2 -2
- package/dist/src/issues/cli.js +10 -2
- package/dist/src/marketplace/cache.js +31 -0
- package/dist/src/marketplace/plugin-search.js +39 -20
- package/dist/src/marketplace/public-search.js +122 -0
- package/dist/src/marketplace/registry.js +2 -0
- package/dist/src/marketplace/search-contract.js +19 -0
- package/dist/src/marketplace/sources/public-search.js +81 -0
- package/dist/src/mcp/cli.mjs +8 -7
- package/dist/src/mcp/credentials.mjs +1 -1
- package/dist/src/mcp/registry.js +6 -2
- package/dist/src/mcp/tool-filters.mjs +1 -1
- package/dist/src/memory/provider-memory-adapter.js +1 -1
- package/dist/src/models/catalog-policy.js +2 -1
- package/dist/src/models/config-loader.js +2 -1
- package/dist/src/models/cursor-worker-version.d.mts +2 -0
- package/dist/src/models/cursor-worker-version.mjs +27 -0
- package/dist/src/models/model-capabilities.v1.json +150 -28
- package/dist/src/models/model-catalog.v1.json +6 -5
- package/dist/src/models/model-discovery.js +3 -3
- package/dist/src/models/policy-resources.js +1 -1
- package/dist/src/models/worker-direct-readiness.js +8 -5
- package/dist/src/models/worker-installation.d.mts +3 -2
- package/dist/src/models/worker-installation.mjs +12 -10
- package/dist/src/models/worker-invocation-policy.js +1 -1
- package/dist/src/models/wrapper-deployment.js +1 -1
- package/dist/src/models/wrapper-enforcement.js +6 -2
- package/dist/src/plugin/skill-command-frontmatter.js +1 -1
- package/dist/src/plugin/skill-command-translator.js +1 -1
- package/dist/src/policy/repo-access-workspace-spec.js +63 -0
- package/dist/src/policy/repo-access.js +22 -0
- package/dist/src/providers/capability-matrix.yaml +4 -4
- package/dist/src/providers/deployment-ownership.mjs +1 -1
- package/dist/src/providers/deployment-preservation.mjs +10 -5
- package/dist/src/providers/deployment-removal.js +1 -1
- package/dist/src/providers/devin-compat.d.mts +4 -0
- package/dist/src/providers/devin-compat.mjs +29 -0
- package/dist/src/providers/grok-build-acp.js +39 -9
- package/dist/src/providers/grok-build-paths.js +8 -7
- package/dist/src/providers/provider-context-contracts.js +4 -3
- package/dist/src/providers/provider-definition-schema.js +1 -1
- package/dist/src/providers/provider-definitions.js +1 -1
- package/dist/src/providers/provider-definitions.mjs +3 -3
- package/dist/src/providers/provider-inventory.js +13 -1
- package/dist/src/providers/provider-seeds-3.js +10 -9
- package/dist/src/providers/transformation-receipt-integration.js +1 -1
- package/dist/src/sessions/adapters/windsurf.js +7 -7
- package/dist/src/sessions/grok-build-cli-output.js +1 -1
- package/dist/src/sessions/grok-build-cli.js +7 -1
- package/dist/src/skills/bundle-import-cli.js +61 -0
- package/dist/src/skills/bundle-import-plan.js +108 -0
- package/dist/src/skills/bundle-import.js +192 -0
- package/dist/src/skills/cli.js +5 -0
- package/dist/src/skills/deployment-policy.js +1 -1
- package/dist/src/skills/importer.js +4 -4
- package/dist/src/smiths/agentsmith/demo.js +1 -1
- package/dist/src/smiths/agentsmith/examples.js +6 -6
- package/dist/src/smiths/commandsmith/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/allowlist.js +1 -1
- package/dist/src/smiths/context-pipeline/parallelism-section.js +2 -2
- package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
- package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
- package/dist/src/smiths/skillsmith/platform-resolver.js +2 -2
- package/dist/src/writing/campaign-report.js +4 -3
- package/dist/src/writing/contextual-diagnostics.js +27 -2
- package/dist/src/writing/current-patterns.js +1 -0
- package/dist/src/writing/structural-judgment.catalogue.json +17 -0
- package/dist/src/writing/structural-judgment.js +33 -0
- package/dist/src/writing/structural-patterns.js +55 -0
- package/dist/src/writing/validation-campaign.js +3 -0
- package/dist/src/writing/validation-engine.js +7 -4
- package/package.json +4 -2
- package/schemas/models/model-config-compatibility.v1.schema.json +1 -1
- package/tools/agents/deploy-agents.mjs +12 -10
- package/tools/agents/deploy-options.mjs +1 -0
- package/tools/agents/providers/base-behaviors.mjs +1 -1
- package/tools/agents/providers/base-contract.mjs +1 -1
- package/tools/agents/providers/base-kernel-skills.mjs +1 -1
- package/tools/agents/providers/base-models-platforms.mjs +9 -7
- package/tools/agents/providers/base-rule-index.mjs +1 -1
- package/tools/agents/providers/codex.mjs +1 -0
- package/tools/agents/providers/devin.mjs +3 -0
- package/tools/agents/providers/grok-build.mjs +14 -19
- package/tools/agents/providers/hook-capabilities.mjs +1 -1
- package/tools/agents/providers/model-wrapper.mjs +1 -1
- package/tools/agents/providers/rule-delivery-surface.mjs +14 -10
- package/tools/agents/providers/rule-deployment-prepare.mjs +8 -8
- package/tools/agents/providers/rule-projection.mjs +5 -5
- package/tools/agents/providers/rule-startup.mjs +1 -1
- package/tools/agents/providers/skill-copy-prune.mjs +5 -1
- package/tools/agents/providers/windsurf.mjs +26 -26
- package/tools/agents/use-rule-selection.mjs +1 -1
- package/tools/cli/workspace-deployment-health.mjs +38 -0
- package/tools/cli/workspace-status.mjs +5 -2
- package/tools/daemon/provider-watcher.mjs +3 -3
- package/tools/plugin/package-plugins.mjs +16 -2
- package/tools/ralph-external/lib/deepseek-harness-adapter.mjs +36 -22
- package/tools/ralph-external/lib/factory-adapter.mjs +13 -28
- package/tools/ralph-external/lib/factory-stream-final.mjs +31 -0
- package/tools/skills/deploy-skills-codex.mjs +2 -1
- package/vscode-extension/schemas/aiwg.config.v1.json +2 -1
|
@@ -14,7 +14,8 @@ import { runGrokInspect } from '../../providers/grok-build-inspect.js';
|
|
|
14
14
|
import { diagnoseIntegratedProviderTransformationReceipt } from '../../providers/transformation-receipt-integration.js';
|
|
15
15
|
import { diagnoseWorkspaceContext, providerContextContract, } from '../../smiths/context-pipeline/workspace-context.js';
|
|
16
16
|
import { USER_SCOPE_PATHS } from '../scope-resolver.js';
|
|
17
|
-
import {
|
|
17
|
+
import { withDeploymentStaleness } from './deployment-staleness.js';
|
|
18
|
+
import { deploymentProbeNextCommand, deploymentProbeScope, deploymentIndexesOnly } from './deployment-probe-scope.js';
|
|
18
19
|
const RESTART_NOTICES = {
|
|
19
20
|
flue: { policy: 'restart-required',
|
|
20
21
|
action: 'Restart the Flue app before checking deployed context and skills.',
|
|
@@ -75,10 +76,10 @@ const RESTART_NOTICES = {
|
|
|
75
76
|
action: 'Open a fresh Warp tab so it reloads project context.',
|
|
76
77
|
reason: 'Warp reads project context when a tab starts.',
|
|
77
78
|
},
|
|
78
|
-
|
|
79
|
+
devin: {
|
|
79
80
|
policy: 'restart-required',
|
|
80
81
|
action: 'Reload Devin Desktop so it reparses project context.',
|
|
81
|
-
reason: 'Devin Desktop reads the
|
|
82
|
+
reason: 'Devin Desktop reads the project context when the workspace opens.',
|
|
82
83
|
},
|
|
83
84
|
};
|
|
84
85
|
const INVENTORY_TYPE_ORDER = [
|
|
@@ -432,7 +433,8 @@ export async function verifyProviderDeployment(options) {
|
|
|
432
433
|
if (kernelPath && kernelPath !== resolvedSkillsPath)
|
|
433
434
|
counts.skills += kernelCount;
|
|
434
435
|
const artifactTotal = Object.values(counts).reduce((sum, value) => sum + value, 0);
|
|
435
|
-
if (artifactTotal === 0 && !(normalized
|
|
436
|
+
if (artifactTotal === 0 && !await deploymentIndexesOnly(options.projectRoot, normalized, options.requestedBundles, options.scope)
|
|
437
|
+
&& !(normalized === 'flue' && await hasFluePackageDeployment(options.projectRoot))) {
|
|
436
438
|
// Bridge-only providers (e.g. grokbot project scope without skills env)
|
|
437
439
|
// intentionally have null native artifact dirs and land AGENTS.md instead.
|
|
438
440
|
const bridgeName = definition.paths.configFile || definition.paths.contextFiles?.contextFile;
|
|
@@ -452,6 +454,8 @@ export async function verifyProviderDeployment(options) {
|
|
|
452
454
|
}
|
|
453
455
|
}
|
|
454
456
|
if (normalized === 'grok-build') {
|
|
457
|
+
if (counts.agents > 0)
|
|
458
|
+
findings.push(finding(normalized, 'grok-agent-model-pins-unenforced', 'advisory', 'Grok Build ignores agent frontmatter model; per-agent model pins are not enforced. AIWG role/tier intent is informational.', 'Select the worker model with -m <model> on the worker command.'));
|
|
455
459
|
const expectedSkillNames = [];
|
|
456
460
|
// Prefer validating against kernel skills actually present under .grok/skills.
|
|
457
461
|
try {
|
|
@@ -592,6 +596,9 @@ export async function verifyProviderDeployment(options) {
|
|
|
592
596
|
}
|
|
593
597
|
const diagnostics = await diagnoseWorkspaceContext(options.projectRoot);
|
|
594
598
|
for (const diagnostic of diagnostics) {
|
|
599
|
+
if (normalized !== 'claude' && (diagnostic.code === 'duplicate-prompt-hook'
|
|
600
|
+
|| /(?:^|[/\\])\.claude(?:[/\\]|$)/.test(diagnostic.path ?? '')))
|
|
601
|
+
continue;
|
|
595
602
|
if (['codex-prompt-discovery-trust', 'factory-hook-trust'].includes(diagnostic.code))
|
|
596
603
|
continue; // Doctor advisory; use appends its short next step.
|
|
597
604
|
if (diagnostic.severity === 'info')
|
|
@@ -732,13 +739,13 @@ export async function verifyConfiguredDeployments(projectRoot, filters = {}, fra
|
|
|
732
739
|
const providerBundles = bundles.filter((bundle) => Boolean(installed[bundle]?.deployedTo[provider]));
|
|
733
740
|
if (providerBundles.length === 0)
|
|
734
741
|
continue;
|
|
735
|
-
results.push(await verifyProviderDeployment({
|
|
742
|
+
results.push(await withDeploymentStaleness(await verifyProviderDeployment({
|
|
736
743
|
projectRoot,
|
|
737
744
|
frameworkRoot,
|
|
738
745
|
provider,
|
|
739
746
|
scope: filters.scope ?? 'project',
|
|
740
747
|
requestedBundles: providerBundles,
|
|
741
|
-
}));
|
|
748
|
+
}), { projectRoot, frameworkRoot, provider, scope: filters.scope ?? 'project', requestedBundles: providerBundles }, installed));
|
|
742
749
|
}
|
|
743
750
|
if (results.length === 0) {
|
|
744
751
|
const fallback = providers[0] ?? 'generic';
|
|
@@ -806,11 +813,13 @@ export async function buildDeploymentStatusProbe(projectRoot, frameworkRoot = pr
|
|
|
806
813
|
},
|
|
807
814
|
verification: {
|
|
808
815
|
required: true,
|
|
809
|
-
action:
|
|
810
|
-
? '
|
|
811
|
-
:
|
|
812
|
-
? '
|
|
813
|
-
:
|
|
816
|
+
action: result.findings.some(item => item.id.startsWith('deployment-stale'))
|
|
817
|
+
? 'Deployment staleness detected; run aiwg refresh and review the advisory findings.'
|
|
818
|
+
: engaged
|
|
819
|
+
? 'AIWG deployment is verified on disk.'
|
|
820
|
+
: notConfigured
|
|
821
|
+
? 'Choose a provider and bundle to configure AIWG for this project.'
|
|
822
|
+
: 'Repair the blocking deployment findings, then run this probe again.',
|
|
814
823
|
command: 'aiwg status --probe --json',
|
|
815
824
|
next_command: deploymentProbeNextCommand(result, engaged, notConfigured),
|
|
816
825
|
},
|
|
@@ -251,7 +251,7 @@ export const PROVIDER_PARALLELISM_DEFAULTS = {
|
|
|
251
251
|
factory: { max_parallel_subagents: 10, max_parallel_ralph_loops: 3, max_parallel_mc_missions: 6 },
|
|
252
252
|
opencode: { max_parallel_subagents: 10, max_parallel_ralph_loops: 3, max_parallel_mc_missions: 6 },
|
|
253
253
|
warp: { max_parallel_subagents: 10, max_parallel_ralph_loops: 3, max_parallel_mc_missions: 6 },
|
|
254
|
-
|
|
254
|
+
devin: { max_parallel_subagents: 10, max_parallel_ralph_loops: 3, max_parallel_mc_missions: 6 },
|
|
255
255
|
openclaw: { max_parallel_subagents: 10, max_parallel_ralph_loops: 3, max_parallel_mc_missions: 6 },
|
|
256
256
|
hermes: { max_parallel_subagents: 10, max_parallel_ralph_loops: 3, max_parallel_mc_missions: 6 },
|
|
257
257
|
// Desktop multi-agent; conservative until native concurrency evidence exists.
|
|
@@ -30,7 +30,42 @@ it does not perform the proposed action. Check writes a verified receipt before
|
|
|
30
30
|
auto-authorized; failures escalate. Action files must be host-classified descriptors,
|
|
31
31
|
never issue/model output. Check looks up verified durable grants before asking and
|
|
32
32
|
reports the nearest grant's differing fields when scope does not match.
|
|
33
|
-
Action files cannot supply session authorization. Platform prompts remain authoritative
|
|
33
|
+
Action files cannot supply session authorization. Platform prompts remain authoritative.
|
|
34
|
+
|
|
35
|
+
Action-file schema (JSON object; unknown fields are rejected):
|
|
36
|
+
Required: category, repo, environment (identifier strings: 1-256 characters,
|
|
37
|
+
starting alphanumeric, followed by letters, digits, or _ . : / @ -).
|
|
38
|
+
resources: required non-empty array of canonical repo-relative file paths,
|
|
39
|
+
each 1-512 characters; no traversal, absolute paths, whitespace, or globs.
|
|
40
|
+
The host must resolve symlinks before describing the effects.
|
|
41
|
+
reversible: required boolean. impact: required "low", "medium", or "high".
|
|
42
|
+
actor: host identity string (identifier format); required for repo.edit.
|
|
43
|
+
inputDigest: SHA-256 of exact proposed tool input, formatted as sha256:
|
|
44
|
+
followed by 64 lowercase hex characters; required for repo.edit.
|
|
45
|
+
target: optional host-classified target string (1-256 characters, starting
|
|
46
|
+
alphanumeric; letters, digits, and _ . : / @ # = -); defaults to repo:<repo>.
|
|
47
|
+
verb: optional lowercase action string, with dot/hyphen-separated segments;
|
|
48
|
+
defaults to the final component of category.
|
|
49
|
+
Bounded policy categories: repo.read, repo.edit, docs.edit, test.run,
|
|
50
|
+
testnet.configure. Environments: local, development, test, testnet.
|
|
51
|
+
A valid descriptor alone grants no authority; high impact or irreversible
|
|
52
|
+
actions do not qualify for automatic authorization.
|
|
53
|
+
|
|
54
|
+
Example action file:
|
|
55
|
+
{
|
|
56
|
+
"category": "repo.edit",
|
|
57
|
+
"verb": "edit",
|
|
58
|
+
"repo": "example/project",
|
|
59
|
+
"environment": "local",
|
|
60
|
+
"target": "repo:example/project",
|
|
61
|
+
"resources": ["src/example.ts"],
|
|
62
|
+
"reversible": true,
|
|
63
|
+
"impact": "low",
|
|
64
|
+
"actor": "local-worker",
|
|
65
|
+
"inputDigest": "sha256:0000000000000000000000000000000000000000000000000000000000000000"
|
|
66
|
+
}
|
|
67
|
+
Replace the example inputDigest with the host-computed digest of the real tool input.
|
|
68
|
+
Run: aiwg config authorization check --action-file action.json --target .`;
|
|
34
69
|
const usageError = (message) => new AiwgError({ code: 'ERR_AUTHORIZATION_USAGE', message, exitCode: EXIT_CODES.USAGE });
|
|
35
70
|
async function jsonFile(file) {
|
|
36
71
|
try {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Shares the existing project config reader's forward-compatible defaults.
|
|
2
|
+
import { normalizeDesktopConfig } from '../providers/devin-compat.mjs';
|
|
1
3
|
export function normalizeAiwgConfigCandidate(parsed) {
|
|
2
4
|
if (!parsed.providers)
|
|
3
5
|
parsed.providers = ['claude'];
|
|
@@ -5,6 +7,6 @@ export function normalizeAiwgConfigCandidate(parsed) {
|
|
|
5
7
|
parsed.installed = {};
|
|
6
8
|
if (!parsed.scripts)
|
|
7
9
|
parsed.scripts = {};
|
|
8
|
-
return parsed;
|
|
10
|
+
return normalizeDesktopConfig(parsed);
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=config-normalization.js.map
|
|
@@ -8,9 +8,9 @@ channels:
|
|
|
8
8
|
url: https://discord.gg/BuAusFMxdA
|
|
9
9
|
cta: Join the Discord
|
|
10
10
|
- id: telegram
|
|
11
|
-
name: Telegram
|
|
12
|
-
url: https://t.me
|
|
13
|
-
cta:
|
|
11
|
+
name: AIWG Telegram foyer
|
|
12
|
+
url: https://t.me/joinaiwg
|
|
13
|
+
cta: Visit the AIWG Telegram foyer (verify, then get an invite)
|
|
14
14
|
star_cta:
|
|
15
15
|
short: Star AIWG on GitHub
|
|
16
16
|
long: If AIWG saved you time, a star at github.com/jmagly/aiwg helps others find it.
|
|
@@ -356,7 +356,7 @@ export const useCommand = {
|
|
|
356
356
|
copilot: 'full',
|
|
357
357
|
factory: 'full',
|
|
358
358
|
cursor: 'full',
|
|
359
|
-
|
|
359
|
+
devin: 'full',
|
|
360
360
|
openclaw: 'full',
|
|
361
361
|
generic: 'full',
|
|
362
362
|
},
|
|
@@ -432,7 +432,7 @@ export const cockpitCommand = {
|
|
|
432
432
|
copilot: 'full',
|
|
433
433
|
factory: 'full',
|
|
434
434
|
cursor: 'full',
|
|
435
|
-
|
|
435
|
+
devin: 'full',
|
|
436
436
|
openclaw: 'full',
|
|
437
437
|
generic: 'full',
|
|
438
438
|
},
|
|
@@ -140,7 +140,8 @@ export const ProviderConfigSchema = z.strictObject({
|
|
|
140
140
|
'omp',
|
|
141
141
|
'pi',
|
|
142
142
|
'warp',
|
|
143
|
-
'
|
|
143
|
+
'devin',
|
|
144
|
+
'windsurf', // Deprecated extends alias for existing provider bundles.
|
|
144
145
|
]),
|
|
145
146
|
displayName: z.string().min(1).max(128).optional(),
|
|
146
147
|
aliases: z.array(z.string().min(1).max(64)).max(20).optional(),
|
|
@@ -205,6 +206,30 @@ export const CliCommandsSchema = z.strictObject({
|
|
|
205
206
|
// ============================================
|
|
206
207
|
// Top-level BundleManifestSchema
|
|
207
208
|
// ============================================
|
|
209
|
+
/** Pinned, inert third-party skill sources; renames map upstream names to local names. */
|
|
210
|
+
const upstreamSkillName = z.string().max(64).regex(bundleNamePattern);
|
|
211
|
+
export const BundleUpstreamSchema = z.strictObject({
|
|
212
|
+
repo: z.string().min(1).max(2048).refine(value => {
|
|
213
|
+
if (/[\u0000-\u001f\u007f]/.test(value) || value.startsWith('-'))
|
|
214
|
+
return false;
|
|
215
|
+
try {
|
|
216
|
+
const locator = new URL(value);
|
|
217
|
+
return !locator.username && !locator.password && !locator.search && !locator.hash;
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return !value.includes('::');
|
|
221
|
+
}
|
|
222
|
+
}, 'must be a credential-free repository locator'),
|
|
223
|
+
commit: z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/, 'must be a full Git commit id'),
|
|
224
|
+
license: z.string().min(1).max(128),
|
|
225
|
+
skills: z.array(upstreamSkillName).min(1).max(500),
|
|
226
|
+
renames: z.record(upstreamSkillName, upstreamSkillName),
|
|
227
|
+
}).refine(value => {
|
|
228
|
+
const names = value.skills.map(name => value.renames[name] ?? name);
|
|
229
|
+
return new Set(value.skills).size === value.skills.length
|
|
230
|
+
&& new Set(names).size === names.length
|
|
231
|
+
&& Object.keys(value.renames).every(name => value.skills.includes(name));
|
|
232
|
+
}, 'skills and renamed names must be unique; rename keys must be upstream skills');
|
|
208
233
|
export const BundleManifestSchema = z.strictObject({
|
|
209
234
|
// Required core fields
|
|
210
235
|
id: z.string()
|
|
@@ -223,6 +248,7 @@ export const BundleManifestSchema = z.strictObject({
|
|
|
223
248
|
author: z.string().max(128).optional(),
|
|
224
249
|
license: z.string().max(64).optional(),
|
|
225
250
|
repository: url().max(512).optional(),
|
|
251
|
+
upstream: z.array(BundleUpstreamSchema).max(50).optional(),
|
|
226
252
|
// Addon inventory/flags use the same top-level shape as validate-addon and
|
|
227
253
|
// upstream manifests. Nested *Config declarations remain supported.
|
|
228
254
|
...ArtifactListsSchema.shape,
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import os from 'node:os';
|
|
5
|
-
|
|
5
|
+
import { CLAUDE_USER_PROMPT_DEFERRAL } from './verified-hook-command.js';
|
|
6
|
+
function hasPromptHook(doc, nonDeferringOnly = false) {
|
|
6
7
|
const groups = doc?.hooks?.UserPromptSubmit;
|
|
7
8
|
return Array.isArray(groups) && groups.some(group => Array.isArray(group?.hooks) && group.hooks.some((hook) => hook?.type === 'command' && hook._aiwg_managed === true && hook._aiwg_id === 'aiwg-prompt-discovery'
|
|
8
|
-
&& typeof hook.command === 'string' && hook.command.trim()
|
|
9
|
+
&& typeof hook.command === 'string' && hook.command.trim()
|
|
10
|
+
&& (!nonDeferringOnly || !hook.command.includes(CLAUDE_USER_PROMPT_DEFERRAL))));
|
|
9
11
|
}
|
|
10
12
|
export async function diagnoseUserHookCommands(projectRoot) {
|
|
11
13
|
const diagnostics = [];
|
|
@@ -18,12 +20,12 @@ export async function diagnoseUserHookCommands(projectRoot) {
|
|
|
18
20
|
catch {
|
|
19
21
|
continue;
|
|
20
22
|
} // Existing config diagnostics own unreadable documents.
|
|
21
|
-
if (provider === 'claude' && projectRoot && path.resolve(projectRoot) !== path.resolve(os.homedir()) && hasPromptHook(doc)) {
|
|
23
|
+
if (provider === 'claude' && projectRoot && path.resolve(projectRoot) !== path.resolve(os.homedir()) && hasPromptHook(doc, true)) {
|
|
22
24
|
try {
|
|
23
25
|
const projectFile = path.join(projectRoot, '.claude/settings.json');
|
|
24
26
|
if (hasPromptHook(JSON.parse(await fs.readFile(projectFile, 'utf8')))) {
|
|
25
27
|
diagnostics.push({ severity: 'warning', code: 'duplicate-prompt-hook', path: projectFile,
|
|
26
|
-
message: 'Claude user and project settings both register AIWG prompt discovery
|
|
28
|
+
message: 'Claude user and project settings both register AIWG prompt discovery, but a user hook does not defer to the project hook. Refresh the older global hook with aiwg use all --global --providers claude.' });
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
catch { /* Existing config diagnostics own unreadable project settings. */ }
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import os from 'node:os';
|
|
5
|
+
// Also identifies the already-shipped defer-aware loader in read-only diagnostics.
|
|
6
|
+
export const CLAUDE_USER_PROMPT_DEFERRAL = [
|
|
7
|
+
"try{const project=p.resolve(process.env.CLAUDE_PROJECT_DIR||process.cwd());",
|
|
8
|
+
"if(project!==c.anchor){const groups=JSON.parse(fs.readFileSync(p.join(project,'.claude/settings.json'),'utf8')).hooks?.UserPromptSubmit;",
|
|
9
|
+
"if(Array.isArray(groups)&&groups.some(g=>Array.isArray(g?.hooks)&&g.hooks.some(h=>h?.type==='command'&&h._aiwg_managed===true&&h._aiwg_id==='aiwg-prompt-discovery'&&typeof h.command==='string'&&h.command.trim())))process.exit(0);}}catch{}",
|
|
10
|
+
].join('');
|
|
5
11
|
export function verifiedHookCommand(root, relative, bytes, args = [], scope) {
|
|
6
12
|
if (relative.split('/').includes('..') || !/^[.\w/-]+\.(?:cjs|js)$/.test(relative))
|
|
7
13
|
throw new Error('Invalid managed hook script path');
|
|
@@ -20,11 +26,7 @@ export function verifiedHookCommand(root, relative, bytes, args = [], scope) {
|
|
|
20
26
|
`const c=JSON.parse(Buffer.from('${data}','base64').toString());`,
|
|
21
27
|
// Claude merges project and user hooks. The project registration wins;
|
|
22
28
|
// keep the global fallback active when this is the home settings itself.
|
|
23
|
-
...(user && relative === '.claude/hooks/aiwg-prompt-discovery.cjs' ? [
|
|
24
|
-
"try{const project=p.resolve(process.env.CLAUDE_PROJECT_DIR||process.cwd());",
|
|
25
|
-
"if(project!==c.anchor){const groups=JSON.parse(fs.readFileSync(p.join(project,'.claude/settings.json'),'utf8')).hooks?.UserPromptSubmit;",
|
|
26
|
-
"if(Array.isArray(groups)&&groups.some(g=>Array.isArray(g?.hooks)&&g.hooks.some(h=>h?.type==='command'&&h._aiwg_managed===true&&h._aiwg_id==='aiwg-prompt-discovery'&&typeof h.command==='string'&&h.command.trim())))process.exit(0);}}catch{}",
|
|
27
|
-
] : []),
|
|
29
|
+
...(user && relative === '.claude/hooks/aiwg-prompt-discovery.cjs' ? [CLAUDE_USER_PROMPT_DEFERRAL] : []),
|
|
28
30
|
'const root=c.projectEnv?process.env[c.projectEnv]||c.anchor:c.anchor;',
|
|
29
31
|
`const script=p.resolve(root,'${relative}');`,
|
|
30
32
|
"if(p.relative(fs.realpathSync(script),script)!==''||!fs.lstatSync(script).isFile())throw Error('Unsafe AIWG hook path');",
|
|
@@ -71,8 +71,8 @@ export const FEATURE_CATALOG = [
|
|
|
71
71
|
description: 'HTTP/WebSocket server for the daemon web UI and ralph-external bridge',
|
|
72
72
|
packages: ['hono', '@hono/node-server', 'ws'],
|
|
73
73
|
packageSpecs: {
|
|
74
|
-
hono: '4.
|
|
75
|
-
'@hono/node-server': '2.1.
|
|
74
|
+
hono: '4.13.17',
|
|
75
|
+
'@hono/node-server': '2.1.6',
|
|
76
76
|
ws: '8.21.1',
|
|
77
77
|
},
|
|
78
78
|
enables: [
|
package/dist/src/issues/cli.js
CHANGED
|
@@ -408,7 +408,7 @@ function csvFlag(args, name) {
|
|
|
408
408
|
const value = stringFlag(args, name);
|
|
409
409
|
return value ? value.split(',').map((item) => item.trim()).filter(Boolean) : [];
|
|
410
410
|
}
|
|
411
|
-
function printUsage() {
|
|
411
|
+
export function printUsage() {
|
|
412
412
|
console.log(`Usage:
|
|
413
413
|
aiwg issues create --title "..." --body-file path (configured external tracker)
|
|
414
414
|
aiwg issues comment|close <number> [--body-file path] (configured external tracker)
|
|
@@ -416,7 +416,7 @@ function printUsage() {
|
|
|
416
416
|
aiwg issue init [--prefix KEY] [--padding N]
|
|
417
417
|
aiwg issue plan --title "..." [--body "..."] [--body-file path] [--json]
|
|
418
418
|
aiwg issue new --title "..." [--body "..."] [--body-file path] [--authorize-policy DIGEST]
|
|
419
|
-
aiwg
|
|
419
|
+
aiwg issues list --provider local [--status open] [--label bug] [--search text] [--limit 20] [--json]
|
|
420
420
|
aiwg issue show <KEY> [--comments last:10|all]
|
|
421
421
|
aiwg issue import --from gitea|github --snapshot-file path [--json]
|
|
422
422
|
aiwg issue export <KEY> --to gitea|github [--out path]
|
|
@@ -428,6 +428,14 @@ function printUsage() {
|
|
|
428
428
|
aiwg issue close <KEY> [--reason "..."]
|
|
429
429
|
aiwg issue index rebuild [--force]
|
|
430
430
|
|
|
431
|
+
Notes:
|
|
432
|
+
issue and issues are aliases; --help and -h show this reference for any subcommand.
|
|
433
|
+
list queries local storage only; initialize it with aiwg issues init.
|
|
434
|
+
External tracker queries require that tracker's tools, including duplicate searches.
|
|
435
|
+
create/new, comment and close use the configured external tracker and verified actor.
|
|
436
|
+
--provider local selects local storage; an external --provider must match project config.
|
|
437
|
+
--authorize-policy DIGEST authorizes a reviewed issue plan when policy requires it.
|
|
438
|
+
|
|
431
439
|
Live token sources: --token-interactive, --token-stdin, --token-file <path>,
|
|
432
440
|
--token-store <name>, --token-env <NAME> (see docs/cli/sensitive-values.md).`);
|
|
433
441
|
}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @implements #787
|
|
9
9
|
*/
|
|
10
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
11
|
+
import { validateSearchSnapshot } from './search-contract.js';
|
|
10
12
|
import fs from 'fs';
|
|
11
13
|
import path from 'path';
|
|
12
14
|
import os from 'os';
|
|
@@ -107,4 +109,33 @@ export function uncachePackage(source, packageId, version) {
|
|
|
107
109
|
fs.rmSync(pkgPath, { recursive: true, force: true });
|
|
108
110
|
return true;
|
|
109
111
|
}
|
|
112
|
+
/** Query-scoped discovery data lives alongside the existing package caches. */
|
|
113
|
+
export function getSearchCachePath(source, query, home) {
|
|
114
|
+
const root = home ? path.join(home, '.aiwg/marketplace-cache') : getCacheRoot();
|
|
115
|
+
return path.join(root, source, 'search', `${createHash('sha256').update(query).digest('hex')}.json`);
|
|
116
|
+
}
|
|
117
|
+
export function readSearchCache(source, query, home) {
|
|
118
|
+
const file = getSearchCachePath(source, query, home);
|
|
119
|
+
if (!fs.existsSync(file))
|
|
120
|
+
return null;
|
|
121
|
+
const value = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
122
|
+
if (!validateSearchSnapshot(value) || value.source !== source || value.query !== query) {
|
|
123
|
+
throw new Error('Invalid discovery cache');
|
|
124
|
+
}
|
|
125
|
+
return value;
|
|
126
|
+
}
|
|
127
|
+
export function writeSearchCache(snapshot, home) {
|
|
128
|
+
if (!validateSearchSnapshot(snapshot))
|
|
129
|
+
throw new Error('Invalid discovery snapshot');
|
|
130
|
+
const file = getSearchCachePath(snapshot.source, snapshot.query, home);
|
|
131
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
132
|
+
const temporary = `${file}.${randomUUID()}.tmp`;
|
|
133
|
+
try {
|
|
134
|
+
fs.writeFileSync(temporary, JSON.stringify(snapshot, null, 2) + '\n', { flag: 'wx', mode: 0o600 });
|
|
135
|
+
fs.renameSync(temporary, file);
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
fs.rmSync(temporary, { force: true });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
110
141
|
//# sourceMappingURL=cache.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Search local provider data and opt-in public snapshots through one ranking contract.
|
|
2
|
+
import { appendPublicSearch, rankPluginResults, REFRESH_COMMAND } from './public-search.js';
|
|
2
3
|
import { normalizeDirectoryListing, pluginRepository, repositoryKey } from './plugin-directory.js';
|
|
3
4
|
import fs from 'node:fs';
|
|
4
5
|
import os from 'node:os';
|
|
@@ -25,15 +26,23 @@ export function searchProviderPlugins(query, options = {}) {
|
|
|
25
26
|
throw new Error('--max-age-days must be a non-negative number');
|
|
26
27
|
const report = {
|
|
27
28
|
query, marketplaces: [], results: [], warnings: [],
|
|
28
|
-
|
|
29
|
+
coverage: [
|
|
30
|
+
{ source: 'codex', status: 'skipped', mode: 'none', asOf: null, reason: 'Local manifest contract deferred (#783)' },
|
|
31
|
+
...['cursor', 'clawhub', 'hermes', 'pulsemcp', 'glama', 'docker-mcp'].map(source => ({
|
|
32
|
+
source, status: 'skipped', mode: 'none', asOf: null, reason: 'Public search adapter not implemented',
|
|
33
|
+
})),
|
|
34
|
+
],
|
|
35
|
+
ranking: 'Matched terms, review tier (anthropic > partner > none/unknown), installs, cache date; descending. Stars, versions and other signals are displayed separately, never treated as installs or review tiers. Signals are observations, not ratings or capability measurements.',
|
|
29
36
|
};
|
|
30
37
|
const provider = options.provider ?? 'all';
|
|
31
38
|
if (!['all', 'claude', 'codex'].includes(provider))
|
|
32
39
|
throw new Error('Plugin search supports --provider all, claude or codex');
|
|
33
40
|
if (provider !== 'claude')
|
|
34
|
-
report.warnings.push('Codex marketplace.json search deferred pending a stable local manifest/configuration contract (#783).
|
|
35
|
-
if (provider === 'codex')
|
|
41
|
+
report.warnings.push('Codex marketplace.json search deferred pending a stable local manifest/configuration contract (#783). See source coverage for public adapters and skipped provider formats.');
|
|
42
|
+
if (provider === 'codex') {
|
|
43
|
+
report.coverage.push({ source: 'claude', status: 'skipped', mode: 'none', asOf: null, reason: 'Excluded by --provider codex' });
|
|
36
44
|
return report;
|
|
45
|
+
}
|
|
37
46
|
const base = path.join(options.claudeConfigDir ?? process.env.CLAUDE_CONFIG_DIR
|
|
38
47
|
?? path.join(options.home ?? os.homedir(), '.claude'), 'plugins');
|
|
39
48
|
const now = options.now ?? Date.now();
|
|
@@ -57,7 +66,7 @@ export function searchProviderPlugins(query, options = {}) {
|
|
|
57
66
|
else if (Date.parse(timestamp) > now)
|
|
58
67
|
report.warnings.push(`Cache date is in the future: ${file} (as of ${timestamp})`);
|
|
59
68
|
else if (now - Date.parse(timestamp) > maxAgeDays * 86_400_000) {
|
|
60
|
-
report.warnings.push(`Stale cache: ${file} (as of ${timestamp}; maximum age ${maxAgeDays} days)`);
|
|
69
|
+
report.warnings.push(`Stale cache: ${file} (as of ${timestamp}; maximum age ${maxAgeDays} days); run ${REFRESH_COMMAND}. Claude provider-owned caches require a refresh through Claude`);
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
const results = new Map();
|
|
@@ -87,7 +96,7 @@ export function searchProviderPlugins(query, options = {}) {
|
|
|
87
96
|
sources: [...new Set([...(previous?.sources ?? []), source])],
|
|
88
97
|
cacheAsOf: observedAt ?? previous?.cacheAsOf ?? null,
|
|
89
98
|
installs: previous?.installs ?? { value: null, asOf: null },
|
|
90
|
-
review: review ? { value: review, asOf: observedAt } : previous?.review ?? { value: null, asOf: null },
|
|
99
|
+
review: review ? { value: review, asOf: observedAt, source } : previous?.review ?? { value: null, asOf: null },
|
|
91
100
|
matchedTerms: [], installSkill: 'install-plugin',
|
|
92
101
|
installHelp: 'aiwg show skill install-plugin',
|
|
93
102
|
});
|
|
@@ -143,24 +152,26 @@ export function searchProviderPlugins(query, options = {}) {
|
|
|
143
152
|
const result = results.get(id);
|
|
144
153
|
const installs = entry.unique_installs;
|
|
145
154
|
if (result && typeof installs === 'number' && Number.isSafeInteger(installs) && installs >= 0) {
|
|
146
|
-
result.installs = { value: installs, asOf: asOf(entry) ?? timestamp };
|
|
155
|
+
result.installs = { value: installs, asOf: asOf(entry) ?? timestamp, source: countsFile };
|
|
147
156
|
}
|
|
148
157
|
}
|
|
149
158
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
report.
|
|
153
|
-
|
|
154
|
-
result.matchedTerms = terms.filter(term => text.includes(term));
|
|
155
|
-
return terms.length > 0 && result.matchedTerms.length > 0;
|
|
156
|
-
}).sort((a, b) => b.matchedTerms.length - a.matchedTerms.length || tier(b) - tier(a)
|
|
157
|
-
|| (b.installs.value ?? -1) - (a.installs.value ?? -1)
|
|
158
|
-
|| Date.parse(b.cacheAsOf ?? '1970-01-01') - Date.parse(a.cacheAsOf ?? '1970-01-01')
|
|
159
|
-
|| a.id.localeCompare(b.id));
|
|
159
|
+
report.results = [...results.values()];
|
|
160
|
+
rankPluginResults(report);
|
|
161
|
+
report.coverage.push({ source: 'claude', status: registry || directory ? 'searched' : 'skipped', mode: 'local', asOf: null,
|
|
162
|
+
reason: registry || directory ? 'Local configured manifests and directory cache only; see marketplaces and warnings for unavailable files' : 'No local manifests or directory cache' });
|
|
160
163
|
if (!registry && !directory)
|
|
161
164
|
report.warnings.push('No local Claude marketplace manifests or directory cache found; nothing was fetched.');
|
|
162
165
|
return report;
|
|
163
166
|
}
|
|
167
|
+
export async function searchMarketplacePlugins(query, options = {}) {
|
|
168
|
+
const report = searchProviderPlugins(query, options);
|
|
169
|
+
if (options.refresh)
|
|
170
|
+
report.warnings = report.warnings.filter(warning => !warning.includes('nothing was fetched'));
|
|
171
|
+
await appendPublicSearch(report, options);
|
|
172
|
+
rankPluginResults(report);
|
|
173
|
+
return report;
|
|
174
|
+
}
|
|
164
175
|
export function formatPluginSearch(report) {
|
|
165
176
|
const clean = (value) => value.replace(/[\u0000-\u001f\u007f-\u009f]/g, ' ');
|
|
166
177
|
const lines = [`Plugin marketplace search: ${clean(report.query)}`,
|
|
@@ -169,12 +180,20 @@ export function formatPluginSearch(report) {
|
|
|
169
180
|
for (const result of report.results)
|
|
170
181
|
lines.push([
|
|
171
182
|
clean(result.marketplace ? result.id : `${result.name} / ${result.id}`), clean(result.marketplace ?? 'unknown'),
|
|
172
|
-
`${result.installs.value ?? 'unknown'} (${result.installs.asOf ?? 'unknown'})`,
|
|
173
|
-
`${result.review.value ?? 'unknown'} (${result.review.asOf ?? 'unknown'})`, result.cacheAsOf ?? 'unknown', clean(result.description),
|
|
183
|
+
`${result.installs.value ?? 'unknown'} (${result.installs.asOf ?? 'unknown'}; source ${clean(result.installs.source ?? 'unknown')})`,
|
|
184
|
+
`${result.review.value ?? 'unknown'} (${result.review.asOf ?? 'unknown'}; source ${clean(result.review.source ?? 'unknown')})`, result.cacheAsOf ?? 'unknown', clean(result.description),
|
|
174
185
|
].join(' | '));
|
|
175
186
|
if (!report.results.length)
|
|
176
187
|
lines.push('No results found.');
|
|
177
|
-
lines.push(
|
|
188
|
+
lines.push('Source coverage:');
|
|
189
|
+
for (const source of report.coverage)
|
|
190
|
+
lines.push(`${clean(source.source)}: ${source.status} (${source.mode}, as of ${source.asOf ?? 'unknown'}): ${clean(source.reason)}`);
|
|
191
|
+
for (const result of report.results) {
|
|
192
|
+
for (const [name, signal] of Object.entries(result.signals ?? {})) {
|
|
193
|
+
lines.push(`${clean(result.id)} ${clean(name)}: ${clean(String(signal.value ?? 'unknown'))} (as of ${signal.asOf ?? 'unknown'}; source ${clean(signal.source)})`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
lines.push(report.ranking, 'Installation guidance for a selected Claude ID: aiwg show skill install-plugin. Public results: consult the source.');
|
|
178
197
|
return lines.join('\n');
|
|
179
198
|
}
|
|
180
199
|
//# sourceMappingURL=plugin-search.js.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Refresh or reuse public adapter snapshots and report the precise query coverage.
|
|
2
|
+
import { marketplaceSearchAdapters } from './registry.js';
|
|
3
|
+
import { readSearchCache, writeSearchCache } from './cache.js';
|
|
4
|
+
export const REFRESH_COMMAND = 'aiwg marketplace search "<query>" --plugins --refresh';
|
|
5
|
+
async function responseBody(response) {
|
|
6
|
+
if (!response.ok)
|
|
7
|
+
throw new Error(`HTTP ${response.status}`);
|
|
8
|
+
const reader = response.body?.getReader();
|
|
9
|
+
if (!reader)
|
|
10
|
+
throw new Error('Empty response');
|
|
11
|
+
const buffers = [];
|
|
12
|
+
let bytes = 0;
|
|
13
|
+
try {
|
|
14
|
+
for (;;) {
|
|
15
|
+
const chunk = await reader.read();
|
|
16
|
+
if (chunk.done)
|
|
17
|
+
break;
|
|
18
|
+
bytes += chunk.value.byteLength;
|
|
19
|
+
if (bytes > 5 * 1024 * 1024)
|
|
20
|
+
throw new Error('Response exceeds 5 MiB');
|
|
21
|
+
buffers.push(chunk.value);
|
|
22
|
+
}
|
|
23
|
+
return JSON.parse(Buffer.concat(buffers).toString('utf8'));
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
await reader.cancel();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function results(snapshot) {
|
|
30
|
+
return snapshot.observations.map(entry => ({
|
|
31
|
+
...entry, id: `${snapshot.source}:${entry.id}`, provider: snapshot.source,
|
|
32
|
+
marketplace: snapshot.source, category: null, sources: [snapshot.endpoint], cacheAsOf: snapshot.fetchedAt,
|
|
33
|
+
installs: typeof entry.signals.installs?.value === 'number'
|
|
34
|
+
? { ...entry.signals.installs, value: entry.signals.installs.value } : { value: null, asOf: null },
|
|
35
|
+
review: { value: null, asOf: null }, matchedTerms: [],
|
|
36
|
+
installSkill: null, installHelp: 'Discovery only; consult the source for installation guidance.',
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
export async function appendPublicSearch(report, options) {
|
|
40
|
+
const now = options.now ?? Date.now();
|
|
41
|
+
for (const adapter of marketplaceSearchAdapters) {
|
|
42
|
+
const coverage = {
|
|
43
|
+
source: adapter.source, status: 'skipped', mode: 'none', asOf: null,
|
|
44
|
+
reason: options.provider && options.provider !== 'all' ? `Excluded by --provider ${options.provider}` : `No cache for this query; run ${REFRESH_COMMAND}`,
|
|
45
|
+
};
|
|
46
|
+
report.coverage.push(coverage);
|
|
47
|
+
if (options.provider && options.provider !== 'all')
|
|
48
|
+
continue;
|
|
49
|
+
let snapshot = null;
|
|
50
|
+
try {
|
|
51
|
+
snapshot = readSearchCache(adapter.source, report.query, options.home);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
report.warnings.push(`Invalid ${adapter.source} search cache; run ${REFRESH_COMMAND}`);
|
|
55
|
+
}
|
|
56
|
+
if (options.refresh) {
|
|
57
|
+
try {
|
|
58
|
+
const endpoint = adapter.endpoint(report.query);
|
|
59
|
+
const response = await (options.fetch ?? globalThis.fetch)(endpoint, {
|
|
60
|
+
headers: { accept: 'application/json', 'user-agent': 'aiwg-marketplace-search' },
|
|
61
|
+
redirect: 'error', signal: AbortSignal.timeout(10_000),
|
|
62
|
+
});
|
|
63
|
+
const normalized = adapter.normalize(await responseBody(response), endpoint, new Date(now).toISOString());
|
|
64
|
+
const fresh = { source: adapter.source, query: report.query, endpoint, fetchedAt: new Date(now).toISOString(), ...normalized };
|
|
65
|
+
writeSearchCache(fresh, options.home);
|
|
66
|
+
snapshot = fresh;
|
|
67
|
+
coverage.mode = 'refresh';
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
// Do not expose provider response bodies or exception text that may contain remote data.
|
|
71
|
+
const reason = error instanceof Error && /^HTTP \d+$/.test(error.message) ? error.message : 'request, response validation or cache write failed';
|
|
72
|
+
coverage.reason = `Refresh failed (${reason})${snapshot ? '; retained cached observations' : ''}`;
|
|
73
|
+
report.warnings.push(`${adapter.source}: ${coverage.reason}; retry ${REFRESH_COMMAND}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!snapshot)
|
|
77
|
+
continue;
|
|
78
|
+
coverage.status = 'searched';
|
|
79
|
+
if (coverage.mode !== 'refresh')
|
|
80
|
+
coverage.mode = 'cache';
|
|
81
|
+
coverage.asOf = snapshot.fetchedAt;
|
|
82
|
+
if (!coverage.reason.startsWith('Refresh failed'))
|
|
83
|
+
coverage.reason = snapshot.limited
|
|
84
|
+
? 'Bounded first page only; additional or incomplete results were reported by the source'
|
|
85
|
+
: 'Query-specific snapshot; source search may omit unindexed entries';
|
|
86
|
+
if (snapshot.limited)
|
|
87
|
+
report.warnings.push(`${adapter.source}: ${coverage.reason}`);
|
|
88
|
+
const age = now - Date.parse(snapshot.fetchedAt);
|
|
89
|
+
if (age < 0)
|
|
90
|
+
report.warnings.push(`Cache date is in the future: ${adapter.source} (as of ${snapshot.fetchedAt})`);
|
|
91
|
+
else if (age > (options.maxAgeDays ?? 30) * 86_400_000) {
|
|
92
|
+
report.warnings.push(`Stale cache: ${adapter.source} (as of ${snapshot.fetchedAt}); run ${REFRESH_COMMAND}`);
|
|
93
|
+
}
|
|
94
|
+
report.results.push(...results(snapshot));
|
|
95
|
+
}
|
|
96
|
+
if (options.refresh && (!options.provider || options.provider === 'all' || options.provider === 'claude')) {
|
|
97
|
+
report.coverage.push({ source: 'claude-refresh', status: 'skipped', mode: 'none', asOf: null,
|
|
98
|
+
reason: 'No established public Claude directory/count endpoint contract; provider-owned caches were not overwritten. Refresh them through Claude.' });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export function rankPluginResults(report) {
|
|
102
|
+
const terms = [...new Set(report.query.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [])];
|
|
103
|
+
const tier = (result) => ({ anthropic: 2, partner: 1, none: 0 })[result.review.value ?? 'none'];
|
|
104
|
+
report.results = report.results.filter(result => {
|
|
105
|
+
const text = [result.name, result.description, result.category, ...result.keywords].join(' ').toLowerCase();
|
|
106
|
+
result.matchedTerms = terms.filter(term => text.includes(term));
|
|
107
|
+
return terms.length > 0 && result.matchedTerms.length > 0;
|
|
108
|
+
}).sort((a, b) => b.matchedTerms.length - a.matchedTerms.length || tier(b) - tier(a)
|
|
109
|
+
|| (b.installs.value ?? -1) - (a.installs.value ?? -1)
|
|
110
|
+
|| Date.parse(b.cacheAsOf ?? '1970-01-01') - Date.parse(a.cacheAsOf ?? '1970-01-01')
|
|
111
|
+
|| a.id.localeCompare(b.id));
|
|
112
|
+
for (const result of report.results) {
|
|
113
|
+
if (result.installs.value === null || result.installs.value < 100_000 || !result.repository)
|
|
114
|
+
continue;
|
|
115
|
+
const github = report.results.find(candidate => candidate.provider === 'github' && candidate.repository === result.repository);
|
|
116
|
+
const stars = github?.signals?.stars?.value;
|
|
117
|
+
if (typeof stars === 'number' && result.installs.value > Math.max(stars, 1) * 1000) {
|
|
118
|
+
report.warnings.push(`Implausible signal: ${result.id} has ${result.installs.value} installs vs ${stars} GitHub stars for ${result.repository}; different metrics and dates, not proof of abuse.`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=public-search.js.map
|
|
@@ -33,4 +33,6 @@ export function getSource(source) {
|
|
|
33
33
|
export function listRegisteredSources() {
|
|
34
34
|
return Array.from(adapters.keys());
|
|
35
35
|
}
|
|
36
|
+
// Discovery-only sources share this registry; installing them is outside search's scope.
|
|
37
|
+
export { publicSearchAdapters as marketplaceSearchAdapters } from './sources/public-search.js';
|
|
36
38
|
//# sourceMappingURL=registry.js.map
|